WPGlobus – Multilingual Everything! - Version 2.4.2

Version Description

= 2.0.0 =

WPGlobus Version 2 supports WordPress 5.x, with Gutenberg.

Download this release

Release Info

Developer tivnet
Plugin Icon 128x128 WPGlobus – Multilingual Everything!
Version 2.4.2
Comparing to
See all releases

Code changes from version 2.4.1 to 2.4.2

Files changed (377) hide show
  1. trunk/configs/acf.json +12 -0
  2. trunk/configs/all-in-one-seo-pack.json +16 -0
  3. trunk/configs/elementor.json +5 -0
  4. trunk/configs/pods.json +12 -0
  5. trunk/configs/woocommerce.json +8 -0
  6. trunk/configs/wpglobus-seo.json +5 -0
  7. trunk/configs/wpglobus.json +5 -0
  8. trunk/configs/yoast-seo.json +14 -0
  9. trunk/data/paid_plugins.json +66 -0
  10. trunk/data/wpglobus-product-info.json +1 -0
  11. trunk/flags/ad.alt.png +0 -0
  12. trunk/flags/ad.png +0 -0
  13. trunk/flags/ae.png +0 -0
  14. trunk/flags/af.png +0 -0
  15. trunk/flags/ag.png +0 -0
  16. trunk/flags/ai.alt.png +0 -0
  17. trunk/flags/ai.png +0 -0
  18. trunk/flags/al.png +0 -0
  19. trunk/flags/am.png +0 -0
  20. trunk/flags/an.png +0 -0
  21. trunk/flags/ao.png +0 -0
  22. trunk/flags/aq.png +0 -0
  23. trunk/flags/ar.alt.png +0 -0
  24. trunk/flags/ar.png +0 -0
  25. trunk/flags/argm.jpg +0 -0
  26. trunk/flags/arle.png +0 -0
  27. trunk/flags/as.png +0 -0
  28. trunk/flags/asl.gif +0 -0
  29. trunk/flags/at.alt.png +0 -0
  30. trunk/flags/at.png +0 -0
  31. trunk/flags/au.png +0 -0
  32. trunk/flags/aw.png +0 -0
  33. trunk/flags/ax.png +0 -0
  34. trunk/flags/az.png +0 -0
  35. trunk/flags/ba.png +0 -0
  36. trunk/flags/bb.png +0 -0
  37. trunk/flags/bd.png +0 -0
  38. trunk/flags/be.png +0 -0
  39. trunk/flags/bf.png +0 -0
  40. trunk/flags/bg.png +0 -0
  41. trunk/flags/bh.png +0 -0
  42. trunk/flags/bi.alt.png +0 -0
  43. trunk/flags/bi.png +0 -0
  44. trunk/flags/big/au.png +0 -0
  45. trunk/flags/big/br.png +0 -0
  46. trunk/flags/big/ca.png +0 -0
  47. trunk/flags/big/cn.png +0 -0
  48. trunk/flags/big/cy.png +0 -0
  49. trunk/flags/big/de.png +0 -0
  50. trunk/flags/big/dk.png +0 -0
  51. trunk/flags/big/es.alt.png +0 -0
  52. trunk/flags/big/es.png +0 -0
  53. trunk/flags/big/fi.png +0 -0
  54. trunk/flags/big/ir.png +0 -0
  55. trunk/flags/big/it.png +0 -0
  56. trunk/flags/big/ru.png +0 -0
  57. trunk/flags/big/uk.png +0 -0
  58. trunk/flags/big/us.png +0 -0
  59. trunk/flags/bj.png +0 -0
  60. trunk/flags/bm.png +0 -0
  61. trunk/flags/bn.png +0 -0
  62. trunk/flags/bo.png +0 -0
  63. trunk/flags/br.png +0 -0
  64. trunk/flags/bs.png +0 -0
  65. trunk/flags/bt.png +0 -0
  66. trunk/flags/bv.png +0 -0
  67. trunk/flags/bw.png +0 -0
  68. trunk/flags/by.png +0 -0
  69. trunk/flags/bz.png +0 -0
  70. trunk/flags/ca.alt.png +0 -0
  71. trunk/flags/ca.png +0 -0
  72. trunk/flags/cc.alt.png +0 -0
  73. trunk/flags/cc.png +0 -0
  74. trunk/flags/cd.png +0 -0
  75. trunk/flags/cf.png +0 -0
  76. trunk/flags/cg.png +0 -0
  77. trunk/flags/ch.png +0 -0
  78. trunk/flags/ci.png +0 -0
  79. trunk/flags/ck.png +0 -0
  80. trunk/flags/cl.png +0 -0
  81. trunk/flags/cm.png +0 -0
  82. trunk/flags/cn.png +0 -0
  83. trunk/flags/co.png +0 -0
  84. trunk/flags/cr.alt.png +0 -0
  85. trunk/flags/cr.png +0 -0
  86. trunk/flags/cs.png +0 -0
  87. trunk/flags/cu.png +0 -0
  88. trunk/flags/cv.png +0 -0
  89. trunk/flags/cx.png +0 -0
  90. trunk/flags/cy.png +0 -0
  91. trunk/flags/cz.png +0 -0
  92. trunk/flags/de.png +0 -0
  93. trunk/flags/dj.png +0 -0
  94. trunk/flags/dk.png +0 -0
  95. trunk/flags/dm.png +0 -0
  96. trunk/flags/do.png +0 -0
  97. trunk/flags/dz.png +0 -0
  98. trunk/flags/easy_to_read.png +0 -0
  99. trunk/flags/ec.alt.png +0 -0
  100. trunk/flags/ec.png +0 -0
  101. trunk/flags/ee.png +0 -0
  102. trunk/flags/eg.png +0 -0
  103. trunk/flags/eh.alt.png +0 -0
  104. trunk/flags/eh.png +0 -0
  105. trunk/flags/en.png +0 -0
  106. trunk/flags/eo.png +0 -0
  107. trunk/flags/er.png +0 -0
  108. trunk/flags/es.alt.png +0 -0
  109. trunk/flags/es.png +0 -0
  110. trunk/flags/et.alt.png +0 -0
  111. trunk/flags/et.png +0 -0
  112. trunk/flags/eu.png +0 -0
  113. trunk/flags/eus.png +0 -0
  114. trunk/flags/fi.png +0 -0
  115. trunk/flags/fj.png +0 -0
  116. trunk/flags/fk.png +0 -0
  117. trunk/flags/fm.png +0 -0
  118. trunk/flags/fo.png +0 -0
  119. trunk/flags/fr.png +0 -0
  120. trunk/flags/fr_CA.png +0 -0
  121. trunk/flags/ga.png +0 -0
  122. trunk/flags/galego.png +0 -0
  123. trunk/flags/gb.png +0 -0
  124. trunk/flags/gd.png +0 -0
  125. trunk/flags/ge.png +0 -0
  126. trunk/flags/gf.png +0 -0
  127. trunk/flags/gg.png +0 -0
  128. trunk/flags/gh.png +0 -0
  129. trunk/flags/gi.png +0 -0
  130. trunk/flags/gl.png +0 -0
  131. trunk/flags/gm.png +0 -0
  132. trunk/flags/gn.png +0 -0
  133. trunk/flags/gp.png +0 -0
  134. trunk/flags/gq.png +0 -0
  135. trunk/flags/gr.png +0 -0
  136. trunk/flags/gs.png +0 -0
  137. trunk/flags/gt.alt.png +0 -0
  138. trunk/flags/gt.png +0 -0
  139. trunk/flags/gu.png +0 -0
  140. trunk/flags/gw.png +0 -0
  141. trunk/flags/gy.png +0 -0
  142. trunk/flags/hk.png +0 -0
  143. trunk/flags/hm.png +0 -0
  144. trunk/flags/hn.png +0 -0
  145. trunk/flags/hr.png +0 -0
  146. trunk/flags/ht.alt.png +0 -0
  147. trunk/flags/ht.png +0 -0
  148. trunk/flags/hu.png +0 -0
  149. trunk/flags/id.png +0 -0
  150. trunk/flags/ie.png +0 -0
  151. trunk/flags/il.png +0 -0
  152. trunk/flags/im.png +0 -0
  153. trunk/flags/in.png +0 -0
  154. trunk/flags/io.png +0 -0
  155. trunk/flags/iq.png +0 -0
  156. trunk/flags/ir.png +0 -0
  157. trunk/flags/is.png +0 -0
  158. trunk/flags/it.png +0 -0
  159. trunk/flags/je.png +0 -0
  160. trunk/flags/jm.png +0 -0
  161. trunk/flags/jo.png +0 -0
  162. trunk/flags/jp.png +0 -0
  163. trunk/flags/ke.png +0 -0
  164. trunk/flags/kg.png +0 -0
  165. trunk/flags/kh.png +0 -0
  166. trunk/flags/ki.png +0 -0
  167. trunk/flags/km.png +0 -0
  168. trunk/flags/kn.png +0 -0
  169. trunk/flags/kp.png +0 -0
  170. trunk/flags/kr.png +0 -0
  171. trunk/flags/ku.png +0 -0
  172. trunk/flags/kw.png +0 -0
  173. trunk/flags/ky.png +0 -0
  174. trunk/flags/kz.png +0 -0
  175. trunk/flags/la.png +0 -0
  176. trunk/flags/lb.png +0 -0
  177. trunk/flags/lc.png +0 -0
  178. trunk/flags/li.png +0 -0
  179. trunk/flags/lk.png +0 -0
  180. trunk/flags/lr.png +0 -0
  181. trunk/flags/ls.png +0 -0
  182. trunk/flags/lt.png +0 -0
  183. trunk/flags/lu.png +0 -0
  184. trunk/flags/lv.png +0 -0
  185. trunk/flags/ly.png +0 -0
  186. trunk/flags/ma.png +0 -0
  187. trunk/flags/mc.png +0 -0
  188. trunk/flags/md.png +0 -0
  189. trunk/flags/me.png +0 -0
  190. trunk/flags/mg.png +0 -0
  191. trunk/flags/mh.png +0 -0
  192. trunk/flags/mk.png +0 -0
  193. trunk/flags/ml.png +0 -0
  194. trunk/flags/mm.png +0 -0
  195. trunk/flags/mn.png +0 -0
  196. trunk/flags/mo.png +0 -0
  197. trunk/flags/montenegro.gif +0 -0
  198. trunk/flags/mp.png +0 -0
  199. trunk/flags/mq.png +0 -0
  200. trunk/flags/mr.png +0 -0
  201. trunk/flags/ms.png +0 -0
  202. trunk/flags/mt.png +0 -0
  203. trunk/flags/mu.png +0 -0
  204. trunk/flags/mv.png +0 -0
  205. trunk/flags/mw.png +0 -0
  206. trunk/flags/mx.png +0 -0
  207. trunk/flags/my.png +0 -0
  208. trunk/flags/my_MM.png +0 -0
  209. trunk/flags/mz.png +0 -0
  210. trunk/flags/na.png +0 -0
  211. trunk/flags/nc.png +0 -0
  212. trunk/flags/ne.png +0 -0
  213. trunk/flags/nf.png +0 -0
  214. trunk/flags/ng.png +0 -0
  215. trunk/flags/ni.alt.png +0 -0
  216. trunk/flags/ni.png +0 -0
  217. trunk/flags/nl.png +0 -0
  218. trunk/flags/no.png +0 -0
  219. trunk/flags/np.png +0 -0
  220. trunk/flags/nr.png +0 -0
  221. trunk/flags/nu.png +0 -0
  222. trunk/flags/nz.png +0 -0
  223. trunk/flags/om.png +0 -0
  224. trunk/flags/pa.png +0 -0
  225. trunk/flags/pe.png +0 -0
  226. trunk/flags/pf.alt.png +0 -0
  227. trunk/flags/pf.png +0 -0
  228. trunk/flags/pg.png +0 -0
  229. trunk/flags/ph.png +0 -0
  230. trunk/flags/pk.png +0 -0
  231. trunk/flags/pl.png +0 -0
  232. trunk/flags/pm.png +0 -0
  233. trunk/flags/pn.png +0 -0
  234. trunk/flags/pr.png +0 -0
  235. trunk/flags/ps.png +0 -0
  236. trunk/flags/pt.png +0 -0
  237. trunk/flags/purple.globe.png +0 -0
  238. trunk/flags/pw.png +0 -0
  239. trunk/flags/py.png +0 -0
  240. trunk/flags/qa.png +0 -0
  241. trunk/flags/re.png +0 -0
  242. trunk/flags/ro.png +0 -0
  243. trunk/flags/rs.png +0 -0
  244. trunk/flags/ru.png +0 -0
  245. trunk/flags/rw.png +0 -0
  246. trunk/flags/sa.png +0 -0
  247. trunk/flags/sb.png +0 -0
  248. trunk/flags/sc.png +0 -0
  249. trunk/flags/sd.png +0 -0
  250. trunk/flags/se.png +0 -0
  251. trunk/flags/serbska_malka.png +0 -0
  252. trunk/flags/sg.png +0 -0
  253. trunk/flags/sh.png +0 -0
  254. trunk/flags/si.png +0 -0
  255. trunk/flags/sj.png +0 -0
  256. trunk/flags/sk.png +0 -0
  257. trunk/flags/sl.png +0 -0
  258. trunk/flags/sm.png +0 -0
  259. trunk/flags/sn.png +0 -0
  260. trunk/flags/so.png +0 -0
  261. trunk/flags/sr.png +0 -0
  262. trunk/flags/st.png +0 -0
  263. trunk/flags/sv.alt.png +0 -0
  264. trunk/flags/sv.png +0 -0
  265. trunk/flags/sy.png +0 -0
  266. trunk/flags/sz.png +0 -0
  267. trunk/flags/tc.png +0 -0
  268. trunk/flags/td.png +0 -0
  269. trunk/flags/tf.png +0 -0
  270. trunk/flags/tg.png +0 -0
  271. trunk/flags/th.png +0 -0
  272. trunk/flags/tj.png +0 -0
  273. trunk/flags/tk.png +0 -0
  274. trunk/flags/tl.png +0 -0
  275. trunk/flags/tm.png +0 -0
  276. trunk/flags/tn.png +0 -0
  277. trunk/flags/to.png +0 -0
  278. trunk/flags/tr.png +0 -0
  279. trunk/flags/tt.png +0 -0
  280. trunk/flags/tv.png +0 -0
  281. trunk/flags/tw.png +0 -0
  282. trunk/flags/tz.png +0 -0
  283. trunk/flags/ua.png +0 -0
  284. trunk/flags/ug.png +0 -0
  285. trunk/flags/uk.png +0 -0
  286. trunk/flags/um.png +0 -0
  287. trunk/flags/us-uk.png +0 -0
  288. trunk/flags/us.png +0 -0
  289. trunk/flags/uy.png +0 -0
  290. trunk/flags/uz.png +0 -0
  291. trunk/flags/va.png +0 -0
  292. trunk/flags/vc.png +0 -0
  293. trunk/flags/ve.png +0 -0
  294. trunk/flags/vg.png +0 -0
  295. trunk/flags/vi.png +0 -0
  296. trunk/flags/vn.png +0 -0
  297. trunk/flags/vu.png +0 -0
  298. trunk/flags/wf.alt.png +0 -0
  299. trunk/flags/wf.png +0 -0
  300. trunk/flags/ws.png +0 -0
  301. trunk/flags/ye.png +0 -0
  302. trunk/flags/yt.png +0 -0
  303. trunk/flags/yu.png +0 -0
  304. trunk/flags/za.png +0 -0
  305. trunk/flags/zm.png +0 -0
  306. trunk/flags/zw.png +0 -0
  307. trunk/flags/zz.png +0 -0
  308. trunk/includes/admin/central/class-wpglobus-admin-central.php +172 -0
  309. trunk/includes/admin/class-wpglobus-about.php +178 -0
  310. trunk/includes/admin/class-wpglobus-admin-bar-menu.php +213 -0
  311. trunk/includes/admin/class-wpglobus-admin-menu.php +34 -0
  312. trunk/includes/admin/class-wpglobus-admin-page.php +203 -0
  313. trunk/includes/admin/class-wpglobus-admin-post.php +57 -0
  314. trunk/includes/admin/class-wpglobus-clean.php +736 -0
  315. trunk/includes/admin/class-wpglobus-customize-options.php +1571 -0
  316. trunk/includes/admin/class-wpglobus-dashboard-news.php +67 -0
  317. trunk/includes/admin/class-wpglobus-language-edit-request.php +255 -0
  318. trunk/includes/admin/class-wpglobus-language-edit.php +494 -0
  319. trunk/includes/admin/class-wpglobus-plugin-install.php +336 -0
  320. trunk/includes/admin/customize/class-wpglobus-customize-themes.php +83 -0
  321. trunk/includes/admin/customize/class-wpglobus-customize140.php +282 -0
  322. trunk/includes/admin/customize/class-wpglobus-customize170.php +300 -0
  323. trunk/includes/admin/customize/class-wpglobus-customize190.php +555 -0
  324. trunk/includes/admin/customize/wpglobus-customize-filters.php +87 -0
  325. trunk/includes/admin/customize/wpglobus-customize.php +22 -0
  326. trunk/includes/admin/debug/class-wpglobus-admin-debug.php +366 -0
  327. trunk/includes/admin/helpdesk/class-wpglobus-admin-helpdesk.php +292 -0
  328. trunk/includes/admin/helpdesk/wpglobus-admin-helpdesk-page.php +165 -0
  329. trunk/includes/admin/media/class-wpglobus-media.php +413 -0
  330. trunk/includes/admin/media/wpglobus-media.php +38 -0
  331. trunk/includes/admin/meta/class-wpglobus-meta.php +543 -0
  332. trunk/includes/admin/recommendations/class-wpglobus-admin-recommendations.php +251 -0
  333. trunk/includes/admin/register-post-types/class-wpglobus-register-post-types.php +147 -0
  334. trunk/includes/admin/wpglobus-admin.php +38 -0
  335. trunk/includes/builders/assets/wpglobus-admin-builder-49.js +348 -0
  336. trunk/includes/builders/assets/wpglobus-admin-builder-49.min.js +1 -0
  337. trunk/includes/builders/assets/wpglobus-admin-builder-51.js +348 -0
  338. trunk/includes/builders/assets/wpglobus-admin-builder-51.min.js +1 -0
  339. trunk/includes/builders/class-wpglobus-builder-update-post.php +62 -0
  340. trunk/includes/builders/class-wpglobus-builder.php +424 -0
  341. trunk/includes/builders/class-wpglobus-builders.php +1487 -0
  342. trunk/includes/builders/class-wpglobus-config-builder.php +554 -0
  343. trunk/includes/builders/elementor/class-wpglobus-elementor-front.php +353 -0
  344. trunk/includes/builders/elementor/class-wpglobus-elementor-update-post.php +118 -0
  345. trunk/includes/builders/elementor/class-wpglobus-elementor.php +483 -0
  346. trunk/includes/builders/elementor/readme.txt +8 -0
  347. trunk/includes/builders/gutenberg/assets/css/dist/wpglobus-block-editor.css +3 -0
  348. trunk/includes/builders/gutenberg/assets/css/dist/wpglobus-block-editor.css.map +1 -0
  349. trunk/includes/builders/gutenberg/assets/css/dist/wpglobus-block-editor.scss +45 -0
  350. trunk/includes/builders/gutenberg/assets/css/dist/wpglobus-switcher.css +116 -0
  351. trunk/includes/builders/gutenberg/assets/css/wpglobus-gutenberg.css +3 -0
  352. trunk/includes/builders/gutenberg/assets/css/wpglobus-gutenberg.css.map +1 -0
  353. trunk/includes/builders/gutenberg/assets/css/wpglobus-gutenberg.scss +30 -0
  354. trunk/includes/builders/gutenberg/assets/js/dist/wpglobus-block-editor.js +607 -0
  355. trunk/includes/builders/gutenberg/assets/js/dist/wpglobus-block-editor.min.js +1 -0
  356. trunk/includes/builders/gutenberg/assets/js/wpglobus-gutenberg.js +602 -0
  357. trunk/includes/builders/gutenberg/assets/js/wpglobus-gutenberg.min.js +1 -0
  358. trunk/includes/builders/gutenberg/class-wpglobus-gutenberg-update-post.php +304 -0
  359. trunk/includes/builders/gutenberg/class-wpglobus-gutenberg.php +554 -0
  360. trunk/includes/builders/js_composer/class-wpglobus-js_composer-update-post.php +119 -0
  361. trunk/includes/builders/js_composer/class-wpglobus-js_composer.php +26 -0
  362. trunk/includes/builders/pods/class-wpglobus-builder-pods.php +110 -0
  363. trunk/includes/builders/pods/class-wpglobus-pods-update-post.php +120 -0
  364. trunk/includes/builders/pods/class-wpglobus-pods.php +31 -0
  365. trunk/includes/builders/yoast_seo/class-wpglobus-yoast_seo-update-post.php +259 -0
  366. trunk/includes/builders/yoast_seo/class-wpglobus-yoast_seo.php +145 -0
  367. trunk/includes/class-wpglobus-config-vendor.php +428 -0
  368. trunk/includes/class-wpglobus-config.php +965 -0
  369. trunk/includes/class-wpglobus-core.php +338 -0
  370. trunk/includes/class-wpglobus-filters.php +1257 -0
  371. trunk/includes/class-wpglobus-plugin.php +96 -0
  372. trunk/includes/class-wpglobus-post-types.php +133 -0
  373. trunk/includes/class-wpglobus-redirect.php +99 -0
  374. trunk/includes/class-wpglobus-utils.php +478 -0
  375. trunk/includes/class-wpglobus-widget.php +302 -0
  376. trunk/includes/class-wpglobus-wp.php +267 -0
  377. trunk/includes/class-wpglobus.php +2736 -0
trunk/configs/acf.json ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "post_meta_fields": {
3
+ "*":{"file":"vendor/acf/class-wpglobus-acf.php","class":"WPGlobus_Acf_2"}
4
+ },
5
+ "post_ml_fields": {
6
+ "*":{"file":"vendor/acf/class-wpglobus-acf.php","class":"WPGlobus_Acf_2"}
7
+ },
8
+ "wp_options": {
9
+ "blogname": {},
10
+ "blogdescription": null
11
+ }
12
+ }
trunk/configs/all-in-one-seo-pack.json ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "post_meta_fields": {
3
+ "_aioseop_title": {},
4
+ "_aioseop_description": {},
5
+ "_aioseop_keywords": {}
6
+ },
7
+ "post_ml_fields": {
8
+ "aiosp_title": {},
9
+ "aiosp_description": {},
10
+ "aiosp_keywords": {}
11
+ },
12
+ "wp_options": {
13
+ "blogname": {},
14
+ "blogdescription": null
15
+ }
16
+ }
trunk/configs/elementor.json ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ {
2
+ "post_meta_fields": {
3
+ "_elementor_data": {}
4
+ }
5
+ }
trunk/configs/pods.json ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "post_meta_fields": {
3
+ "*":{"file":"vendor/pods/class-wpglobus-vendor-pods.php","class":"WPGlobus_Vendor_Pods"}
4
+ },
5
+ "post_ml_fields": {
6
+ "*":{"file":"vendor/pods/class-wpglobus-vendor-pods.php","class":"WPGlobus_Vendor_Pods"}
7
+ },
8
+ "wp_options": {
9
+ "blogname": {},
10
+ "blogdescription": null
11
+ }
12
+ }
trunk/configs/woocommerce.json ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "post_meta_fields": {
3
+ "_purchase_note": {}
4
+ },
5
+ "post_ml_fields": {
6
+ "_purchase_note": {}
7
+ }
8
+ }
trunk/configs/wpglobus-seo.json ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ {
2
+ "post_meta_fields": {
3
+ "_wpglobus_seo_test": {}
4
+ }
5
+ }
trunk/configs/wpglobus.json ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ {
2
+ "post_meta_fields": {
3
+ "_wpglobus_seo_test": {}
4
+ }
5
+ }
trunk/configs/yoast-seo.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "post_meta_fields": {
3
+ "_yoast_wpseo_title": {},
4
+ "_yoast_wpseo_metadesc": {},
5
+ "_yoast_wpseo_focuskw": {},
6
+ "_yoast_wpseo_focuskw_text_input": null,
7
+ "_yoast_wpseo_keywordsynonyms": {},
8
+ "_yoast_wpseo_focuskeywords": {}
9
+ },
10
+ "wp_options": {
11
+ "blogname": {},
12
+ "blogdescription": null
13
+ }
14
+ }
trunk/data/paid_plugins.json ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "woocommerce-wpglobus": {
3
+ "slug": "woocommerce-wpglobus",
4
+ "loader": "woocommerce-wpglobus.php",
5
+ "image_file": "woocommerce-wpglobus-logo-300x300.png",
6
+ "order": 100
7
+ },
8
+ "wpglobus-plus": {
9
+ "slug": "wpglobus-plus",
10
+ "loader": "wpglobus-plus.php",
11
+ "image_file": "wpglobus-plus-logo-300x300.png",
12
+ "order": 90
13
+ },
14
+ "wpglobus-revslider": {
15
+ "slug": "wpglobus-revslider",
16
+ "loader": "wpglobus-revslider.php",
17
+ "product_slug": "wpglobus-for-slider-revolution",
18
+ "image_file": "wpglobus-revslider-logo-400x400.png",
19
+ "order": 60,
20
+ "available": false
21
+ },
22
+ "wpglobus-language-widgets": {
23
+ "slug": "wpglobus-language-widgets",
24
+ "loader": "wpglobus-language-widgets.php",
25
+ "image_file": "wpglobus-lw-logo-400x400.png",
26
+ "order": 50
27
+ },
28
+ "wpglobus-menu-visibility": {
29
+ "slug": "wpglobus-menu-visibility",
30
+ "loader": "wpglobus-menu-visibility.php",
31
+ "image_file": "wpglobus-menu-visibility-logo.png",
32
+ "order": 40
33
+ },
34
+ "wpglobus-header-images": {
35
+ "slug": "wpglobus-header-images",
36
+ "loader": "wpglobus-header-images.php",
37
+ "image_file": "wpglobus-hi-logo-400x400.png",
38
+ "order": 30
39
+ },
40
+ "wpglobus-mobile-menu": {
41
+ "slug": "wpglobus-mobile-menu",
42
+ "loader": "wpglobus-mobile-menu.php",
43
+ "image_file": "wpglobus-mobile-menu-logo-400x400.png",
44
+ "order": 20
45
+ },
46
+ "wpglobus-multilingual-notices": {
47
+ "slug": "wpglobus-multilingual-notices",
48
+ "loader": "wpglobus-multilingual-notices.php",
49
+ "image_file": "wpglobus-multilingual-notices-logo.png",
50
+ "order": 10
51
+ },
52
+ "wpglobus-for-bridge-theme": {
53
+ "slug": "wpglobus-for-bridge-theme",
54
+ "loader": "wpglobus-for-bridge-theme.php",
55
+ "product_slug": "wpglobus-for-bridge-theme",
56
+ "image_file": "wpglobus-for-bridge-theme-logo-400x400.png",
57
+ "order": 10
58
+ },
59
+ "woocommerce-nets-netaxept": {
60
+ "slug": "woocommerce-nets-netaxept",
61
+ "loader": "woocommerce-nets-netaxept.php",
62
+ "product_slug": "multilingual-woocommerce-nets-netaxept",
63
+ "image_file": "woocommerce-wpglobus-netaxeptcw-logo-300x300.jpg",
64
+ "order": 1
65
+ }
66
+ }
trunk/data/wpglobus-product-info.json ADDED
@@ -0,0 +1 @@
 
1
+ {"multilingual-woocommerce-nets-netaxept":{"title":"{:en}Multilingual WooCommerce Nets Netaxept{:}{:ru}\u041c\u0443\u043b\u044c\u0442\u0438\u044f\u0437\u044b\u0447\u043d\u043e\u0441\u0442\u044c \u0434\u043b\u044f WooCommerce Nets Netaxept{:}","_api_new_version":"1.0.3","_api_tested_up_to":"4.9.8"},"wpglobus-menu-visibility":{"title":"WPGlobus Menu Visibility","_api_new_version":"1.2.0","_api_tested_up_to":"4.9.6"},"wpglobus-multi-currency":{"title":"{:en}WPGlobus Multi-Currency for WooCommerce{:}{:ru}WPGlobus - \u041c\u0443\u043b\u044c\u0442\u0438\u0432\u0430\u043b\u044e\u0442\u043d\u043e\u0441\u0442\u044c \u0434\u043b\u044f WooCommerce{:}","_api_new_version":"1.1.1","_api_tested_up_to":"4.9.4"},"wpglobus-language-widgets":{"title":"{:en}WPGlobus Language Widgets{:}{:ru}\u042f\u0437\u044b\u043a\u0438 WPGlobus \u0434\u043b\u044f \u0432\u0438\u0434\u0436\u0435\u0442\u043e\u0432{:}","_api_new_version":"1.1.0","_api_tested_up_to":"5.4.0"},"wpglobus-header-images":{"title":"{:en}WPGlobus Header Images{:}{:ru}WPGlobus Header Images{:}","_api_new_version":"2.0.0","_api_tested_up_to":"5.0.4"},"wpglobus-mobile-menu":{"title":"{:en}WPGlobus Mobile Menu{:}{:ru}WPGlobus Mobile Menu{:}","_api_new_version":"2.0.0","_api_tested_up_to":"5.2"},"wpglobus-for-bridge-theme":{"title":"{:en}WPGlobus for the \"Bridge\" theme{:}{:ru}WPGlobus \u0434\u043b\u044f \u0442\u0435\u043c\u044b Bridge{:}","_api_new_version":"2.2.0","_api_tested_up_to":"5.2"},"wpglobus-multilingual-notices":{"title":"{:en}WPGlobus Multilingual Notices{:}{:ru}WPGlobus - \u043c\u043d\u043e\u0433\u043e\u044f\u0437\u044b\u0447\u043d\u044b\u0435 \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u044f{:}","_api_new_version":"2.0.0","_api_tested_up_to":"5.3"},"woocommerce-wpglobus":{"title":"{:en}WPGlobus for WooCommerce{:}{:ru}\u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 WooCommerce WPGlobus{:}","_api_new_version":"3.5.11","_api_tested_up_to":"5.4.0"},"wpglobus-plus":{"title":"{:en}WPGlobus Plus multilingual extension{:}{:ru}WPGlobus \u041f\u043b\u044e\u0441{:}","_api_new_version":"1.3.10","_api_tested_up_to":"5.4.0"}}
trunk/flags/ad.alt.png ADDED
Binary file
trunk/flags/ad.png ADDED
Binary file
trunk/flags/ae.png ADDED
Binary file
trunk/flags/af.png ADDED
Binary file
trunk/flags/ag.png ADDED
Binary file
trunk/flags/ai.alt.png ADDED
Binary file
trunk/flags/ai.png ADDED
Binary file
trunk/flags/al.png ADDED
Binary file
trunk/flags/am.png ADDED
Binary file
trunk/flags/an.png ADDED
Binary file
trunk/flags/ao.png ADDED
Binary file
trunk/flags/aq.png ADDED
Binary file
trunk/flags/ar.alt.png ADDED
Binary file
trunk/flags/ar.png ADDED
Binary file
trunk/flags/argm.jpg ADDED
Binary file
trunk/flags/arle.png ADDED
Binary file
trunk/flags/as.png ADDED
Binary file
trunk/flags/asl.gif ADDED
Binary file
trunk/flags/at.alt.png ADDED
Binary file
trunk/flags/at.png ADDED
Binary file
trunk/flags/au.png ADDED
Binary file
trunk/flags/aw.png ADDED
Binary file
trunk/flags/ax.png ADDED
Binary file
trunk/flags/az.png ADDED
Binary file
trunk/flags/ba.png ADDED
Binary file
trunk/flags/bb.png ADDED
Binary file
trunk/flags/bd.png ADDED
Binary file
trunk/flags/be.png ADDED
Binary file
trunk/flags/bf.png ADDED
Binary file
trunk/flags/bg.png ADDED
Binary file
trunk/flags/bh.png ADDED
Binary file
trunk/flags/bi.alt.png ADDED
Binary file
trunk/flags/bi.png ADDED
Binary file
trunk/flags/big/au.png ADDED
Binary file
trunk/flags/big/br.png ADDED
Binary file
trunk/flags/big/ca.png ADDED
Binary file
trunk/flags/big/cn.png ADDED
Binary file
trunk/flags/big/cy.png ADDED
Binary file
trunk/flags/big/de.png ADDED
Binary file
trunk/flags/big/dk.png ADDED
Binary file
trunk/flags/big/es.alt.png ADDED
Binary file
trunk/flags/big/es.png ADDED
Binary file
trunk/flags/big/fi.png ADDED
Binary file
trunk/flags/big/ir.png ADDED
Binary file
trunk/flags/big/it.png ADDED
Binary file
trunk/flags/big/ru.png ADDED
Binary file
trunk/flags/big/uk.png ADDED
Binary file
trunk/flags/big/us.png ADDED
Binary file
trunk/flags/bj.png ADDED
Binary file
trunk/flags/bm.png ADDED
Binary file
trunk/flags/bn.png ADDED
Binary file
trunk/flags/bo.png ADDED
Binary file
trunk/flags/br.png ADDED
Binary file
trunk/flags/bs.png ADDED
Binary file
trunk/flags/bt.png ADDED
Binary file
trunk/flags/bv.png ADDED
Binary file
trunk/flags/bw.png ADDED
Binary file
trunk/flags/by.png ADDED
Binary file
trunk/flags/bz.png ADDED
Binary file
trunk/flags/ca.alt.png ADDED
Binary file
trunk/flags/ca.png ADDED
Binary file
trunk/flags/cc.alt.png ADDED
Binary file
trunk/flags/cc.png ADDED
Binary file
trunk/flags/cd.png ADDED
Binary file
trunk/flags/cf.png ADDED
Binary file
trunk/flags/cg.png ADDED
Binary file
trunk/flags/ch.png ADDED
Binary file
trunk/flags/ci.png ADDED
Binary file
trunk/flags/ck.png ADDED
Binary file
trunk/flags/cl.png ADDED
Binary file
trunk/flags/cm.png ADDED
Binary file
trunk/flags/cn.png ADDED
Binary file
trunk/flags/co.png ADDED
Binary file
trunk/flags/cr.alt.png ADDED
Binary file
trunk/flags/cr.png ADDED
Binary file
trunk/flags/cs.png ADDED
Binary file
trunk/flags/cu.png ADDED
Binary file
trunk/flags/cv.png ADDED
Binary file
trunk/flags/cx.png ADDED
Binary file
trunk/flags/cy.png ADDED
Binary file
trunk/flags/cz.png ADDED
Binary file
trunk/flags/de.png ADDED
Binary file
trunk/flags/dj.png ADDED
Binary file
trunk/flags/dk.png ADDED
Binary file
trunk/flags/dm.png ADDED
Binary file
trunk/flags/do.png ADDED
Binary file
trunk/flags/dz.png ADDED
Binary file
trunk/flags/easy_to_read.png ADDED
Binary file
trunk/flags/ec.alt.png ADDED
Binary file
trunk/flags/ec.png ADDED
Binary file
trunk/flags/ee.png ADDED
Binary file
trunk/flags/eg.png ADDED
Binary file
trunk/flags/eh.alt.png ADDED
Binary file
trunk/flags/eh.png ADDED
Binary file
trunk/flags/en.png ADDED
Binary file
trunk/flags/eo.png ADDED
Binary file
trunk/flags/er.png ADDED
Binary file
trunk/flags/es.alt.png ADDED
Binary file
trunk/flags/es.png ADDED
Binary file
trunk/flags/et.alt.png ADDED
Binary file
trunk/flags/et.png ADDED
Binary file
trunk/flags/eu.png ADDED
Binary file
trunk/flags/eus.png ADDED
Binary file
trunk/flags/fi.png ADDED
Binary file
trunk/flags/fj.png ADDED
Binary file
trunk/flags/fk.png ADDED
Binary file
trunk/flags/fm.png ADDED
Binary file
trunk/flags/fo.png ADDED
Binary file
trunk/flags/fr.png ADDED
Binary file
trunk/flags/fr_CA.png ADDED
Binary file
trunk/flags/ga.png ADDED
Binary file
trunk/flags/galego.png ADDED
Binary file
trunk/flags/gb.png ADDED
Binary file
trunk/flags/gd.png ADDED
Binary file
trunk/flags/ge.png ADDED
Binary file
trunk/flags/gf.png ADDED
Binary file
trunk/flags/gg.png ADDED
Binary file
trunk/flags/gh.png ADDED
Binary file
trunk/flags/gi.png ADDED
Binary file
trunk/flags/gl.png ADDED
Binary file
trunk/flags/gm.png ADDED
Binary file
trunk/flags/gn.png ADDED
Binary file
trunk/flags/gp.png ADDED
Binary file
trunk/flags/gq.png ADDED
Binary file
trunk/flags/gr.png ADDED
Binary file
trunk/flags/gs.png ADDED
Binary file
trunk/flags/gt.alt.png ADDED
Binary file
trunk/flags/gt.png ADDED
Binary file
trunk/flags/gu.png ADDED
Binary file
trunk/flags/gw.png ADDED
Binary file
trunk/flags/gy.png ADDED
Binary file
trunk/flags/hk.png ADDED
Binary file
trunk/flags/hm.png ADDED
Binary file
trunk/flags/hn.png ADDED
Binary file
trunk/flags/hr.png ADDED
Binary file
trunk/flags/ht.alt.png ADDED
Binary file
trunk/flags/ht.png ADDED
Binary file
trunk/flags/hu.png ADDED
Binary file
trunk/flags/id.png ADDED
Binary file
trunk/flags/ie.png ADDED
Binary file
trunk/flags/il.png ADDED
Binary file
trunk/flags/im.png ADDED
Binary file
trunk/flags/in.png ADDED
Binary file
trunk/flags/io.png ADDED
Binary file
trunk/flags/iq.png ADDED
Binary file
trunk/flags/ir.png ADDED
Binary file
trunk/flags/is.png ADDED
Binary file
trunk/flags/it.png ADDED
Binary file
trunk/flags/je.png ADDED
Binary file
trunk/flags/jm.png ADDED
Binary file
trunk/flags/jo.png ADDED
Binary file
trunk/flags/jp.png ADDED
Binary file
trunk/flags/ke.png ADDED
Binary file
trunk/flags/kg.png ADDED
Binary file
trunk/flags/kh.png ADDED
Binary file
trunk/flags/ki.png ADDED
Binary file
trunk/flags/km.png ADDED
Binary file
trunk/flags/kn.png ADDED
Binary file
trunk/flags/kp.png ADDED
Binary file
trunk/flags/kr.png ADDED
Binary file
trunk/flags/ku.png ADDED
Binary file
trunk/flags/kw.png ADDED
Binary file
trunk/flags/ky.png ADDED
Binary file
trunk/flags/kz.png ADDED
Binary file
trunk/flags/la.png ADDED
Binary file
trunk/flags/lb.png ADDED
Binary file
trunk/flags/lc.png ADDED
Binary file
trunk/flags/li.png ADDED
Binary file
trunk/flags/lk.png ADDED
Binary file
trunk/flags/lr.png ADDED
Binary file
trunk/flags/ls.png ADDED
Binary file
trunk/flags/lt.png ADDED
Binary file
trunk/flags/lu.png ADDED
Binary file
trunk/flags/lv.png ADDED
Binary file
trunk/flags/ly.png ADDED
Binary file
trunk/flags/ma.png ADDED
Binary file
trunk/flags/mc.png ADDED
Binary file
trunk/flags/md.png ADDED
Binary file
trunk/flags/me.png ADDED
Binary file
trunk/flags/mg.png ADDED
Binary file
trunk/flags/mh.png ADDED
Binary file
trunk/flags/mk.png ADDED
Binary file
trunk/flags/ml.png ADDED
Binary file
trunk/flags/mm.png ADDED
Binary file
trunk/flags/mn.png ADDED
Binary file
trunk/flags/mo.png ADDED
Binary file
trunk/flags/montenegro.gif ADDED
Binary file
trunk/flags/mp.png ADDED
Binary file
trunk/flags/mq.png ADDED
Binary file
trunk/flags/mr.png ADDED
Binary file
trunk/flags/ms.png ADDED
Binary file
trunk/flags/mt.png ADDED
Binary file
trunk/flags/mu.png ADDED
Binary file
trunk/flags/mv.png ADDED
Binary file
trunk/flags/mw.png ADDED
Binary file
trunk/flags/mx.png ADDED
Binary file
trunk/flags/my.png ADDED
Binary file
trunk/flags/my_MM.png ADDED
Binary file
trunk/flags/mz.png ADDED
Binary file
trunk/flags/na.png ADDED
Binary file
trunk/flags/nc.png ADDED
Binary file
trunk/flags/ne.png ADDED
Binary file
trunk/flags/nf.png ADDED
Binary file
trunk/flags/ng.png ADDED
Binary file
trunk/flags/ni.alt.png ADDED
Binary file
trunk/flags/ni.png ADDED
Binary file
trunk/flags/nl.png ADDED
Binary file
trunk/flags/no.png ADDED
Binary file
trunk/flags/np.png ADDED
Binary file
trunk/flags/nr.png ADDED
Binary file
trunk/flags/nu.png ADDED
Binary file
trunk/flags/nz.png ADDED
Binary file
trunk/flags/om.png ADDED
Binary file
trunk/flags/pa.png ADDED
Binary file
trunk/flags/pe.png ADDED
Binary file
trunk/flags/pf.alt.png ADDED
Binary file
trunk/flags/pf.png ADDED
Binary file
trunk/flags/pg.png ADDED
Binary file
trunk/flags/ph.png ADDED
Binary file
trunk/flags/pk.png ADDED
Binary file
trunk/flags/pl.png ADDED
Binary file
trunk/flags/pm.png ADDED
Binary file
trunk/flags/pn.png ADDED
Binary file
trunk/flags/pr.png ADDED
Binary file
trunk/flags/ps.png ADDED
Binary file
trunk/flags/pt.png ADDED
Binary file
trunk/flags/purple.globe.png ADDED
Binary file
trunk/flags/pw.png ADDED
Binary file
trunk/flags/py.png ADDED
Binary file
trunk/flags/qa.png ADDED
Binary file
trunk/flags/re.png ADDED
Binary file
trunk/flags/ro.png ADDED
Binary file
trunk/flags/rs.png ADDED
Binary file
trunk/flags/ru.png ADDED
Binary file
trunk/flags/rw.png ADDED
Binary file
trunk/flags/sa.png ADDED
Binary file
trunk/flags/sb.png ADDED
Binary file
trunk/flags/sc.png ADDED
Binary file
trunk/flags/sd.png ADDED
Binary file
trunk/flags/se.png ADDED
Binary file
trunk/flags/serbska_malka.png ADDED
Binary file
trunk/flags/sg.png ADDED
Binary file
trunk/flags/sh.png ADDED
Binary file
trunk/flags/si.png ADDED
Binary file
trunk/flags/sj.png ADDED
Binary file
trunk/flags/sk.png ADDED
Binary file
trunk/flags/sl.png ADDED
Binary file
trunk/flags/sm.png ADDED
Binary file
trunk/flags/sn.png ADDED
Binary file
trunk/flags/so.png ADDED
Binary file
trunk/flags/sr.png ADDED
Binary file
trunk/flags/st.png ADDED
Binary file
trunk/flags/sv.alt.png ADDED
Binary file
trunk/flags/sv.png ADDED
Binary file
trunk/flags/sy.png ADDED
Binary file
trunk/flags/sz.png ADDED
Binary file
trunk/flags/tc.png ADDED
Binary file
trunk/flags/td.png ADDED
Binary file
trunk/flags/tf.png ADDED
Binary file
trunk/flags/tg.png ADDED
Binary file
trunk/flags/th.png ADDED
Binary file
trunk/flags/tj.png ADDED
Binary file
trunk/flags/tk.png ADDED
Binary file
trunk/flags/tl.png ADDED
Binary file
trunk/flags/tm.png ADDED
Binary file
trunk/flags/tn.png ADDED
Binary file
trunk/flags/to.png ADDED
Binary file
trunk/flags/tr.png ADDED
Binary file
trunk/flags/tt.png ADDED
Binary file
trunk/flags/tv.png ADDED
Binary file
trunk/flags/tw.png ADDED
Binary file
trunk/flags/tz.png ADDED
Binary file
trunk/flags/ua.png ADDED
Binary file
trunk/flags/ug.png ADDED
Binary file
trunk/flags/uk.png ADDED
Binary file
trunk/flags/um.png ADDED
Binary file
trunk/flags/us-uk.png ADDED
Binary file
trunk/flags/us.png ADDED
Binary file
trunk/flags/uy.png ADDED
Binary file
trunk/flags/uz.png ADDED
Binary file
trunk/flags/va.png ADDED
Binary file
trunk/flags/vc.png ADDED
Binary file
trunk/flags/ve.png ADDED
Binary file
trunk/flags/vg.png ADDED
Binary file
trunk/flags/vi.png ADDED
Binary file
trunk/flags/vn.png ADDED
Binary file
trunk/flags/vu.png ADDED
Binary file
trunk/flags/wf.alt.png ADDED
Binary file
trunk/flags/wf.png ADDED
Binary file
trunk/flags/ws.png ADDED
Binary file
trunk/flags/ye.png ADDED
Binary file
trunk/flags/yt.png ADDED
Binary file
trunk/flags/yu.png ADDED
Binary file
trunk/flags/za.png ADDED
Binary file
trunk/flags/zm.png ADDED
Binary file
trunk/flags/zw.png ADDED
Binary file
trunk/flags/zz.png ADDED
Binary file
trunk/includes/admin/central/class-wpglobus-admin-central.php ADDED
@@ -0,0 +1,172 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * File: class-wpglobus-admin-central.php
4
+ *
5
+ * @since 1.6.6
6
+ * @package WPGlobus\Admin\Central
7
+ */
8
+
9
+ /**
10
+ * Class WPGlobus_Admin_Central.
11
+ */
12
+ if ( ! class_exists( 'WPGlobus_Admin_Central' ) ) :
13
+
14
+ class WPGlobus_Admin_Central {
15
+
16
+ /**
17
+ * Link template.
18
+ * @var string
19
+ */
20
+ public static $link_template;
21
+
22
+ /**
23
+ * Constructor.
24
+ */
25
+ public static function construct() {
26
+
27
+ self::set_vars();
28
+
29
+ add_action( 'admin_menu', array( __CLASS__, 'add_menu' ), PHP_INT_MAX );
30
+
31
+ }
32
+
33
+ /**
34
+ * Set class variables.
35
+ */
36
+ public static function set_vars() {
37
+
38
+ self::$link_template = '<a href="{{href}}" class="{{link_class}}" data-tab-id="{{tab_id}}">';
39
+ self::$link_template .= '<span class="{{span_class}}" style="vertical-align: sub;"></span>';
40
+ self::$link_template .= '{{title}}';
41
+ self::$link_template .= '</a>';
42
+
43
+ }
44
+
45
+ /**
46
+ * Add a hidden admin menu item.
47
+ * It serves as a base for several admin tabs, but currently do not have the "root" content.
48
+ */
49
+ public static function add_menu() {
50
+ add_submenu_page(
51
+ null,
52
+ '',
53
+ '',
54
+ 'administrator',
55
+ WPGlobus::PAGE_WPGLOBUS_ADMIN_CENTRAL,
56
+ array( __CLASS__, 'central_page' )
57
+ );
58
+ }
59
+
60
+ /**
61
+ * The admin central page.
62
+ */
63
+ public static function central_page() {
64
+
65
+ /**
66
+ * Filter tabs.
67
+ * Returning array.
68
+ * @since 1.6.6
69
+ *
70
+ * @param array $tabs Array of tabs.
71
+ * @param string $link_template The link template.
72
+ */
73
+ $tabs = apply_filters( 'wpglobus_admin_central_tabs', self::set_tabs(), self::$link_template );
74
+
75
+ WPGlobus_Admin_Page::print_header();
76
+
77
+ ?>
78
+ <h2 class="nav-tab-wrapper"> <?php
79
+ foreach ( $tabs as $type=>$tab ) :
80
+ $html = str_replace( '{{link_class}}', implode( ' ', $tab['link_class'] ), $tab['link'] );
81
+ $html = str_replace( '{{span_class}}', implode( ' ', $tab['span_class'] ), $html );
82
+ $html = str_replace( '{{title}}', $tab['title'], $html );
83
+ if ( ! empty( $tab['tab_id'] ) ) {
84
+ $html = str_replace( '{{href}}', '#' . $tab['tab_id'], $html );
85
+ $html = str_replace( '{{tab_id}}', $tab['tab_id'], $html );
86
+ } elseif ( ! empty( $tab['href'] ) ) {
87
+ $html = str_replace( '{{href}}', $tab['href'], $html );
88
+ $html = str_replace( '{{tab_id}}', '', $html );
89
+ } else {
90
+ $html = str_replace( '{{href}}', '#', $html );
91
+ $html = str_replace( '{{tab_id}}', '', $html );
92
+ }
93
+ echo $html; // WPCS: XSS ok.
94
+ endforeach; ?>
95
+ </h2> <?php
96
+
97
+ /**
98
+ * Fires to render a specific tab panel.
99
+ *
100
+ * @since 1.6.6
101
+ *
102
+ * @param array $tabs Array of tabs.
103
+ */
104
+ do_action( 'wpglobus_admin_central_panel', $tabs );
105
+
106
+ WPGlobus_Admin_Page::print_footer();
107
+
108
+ }
109
+
110
+ /**
111
+ * Add standard tabs.
112
+ * @return array
113
+ */
114
+ protected static function set_tabs() {
115
+
116
+ $tabs = array();
117
+
118
+ /**
119
+ * WPGlobus Guide tab.
120
+ */
121
+ $tab = array(
122
+ 'title' => __( 'Guide', 'wpglobus' ),
123
+ 'link_class' => array( 'nav-tab' ),
124
+ 'span_class' => array( 'dashicons', 'dashicons-book-alt' ),
125
+ 'link' => self::$link_template,
126
+ 'href' => WPGlobus::URL_WPGLOBUS_SITE . 'quick-start/',
127
+ 'tab_id' => ''
128
+ );
129
+ $tabs[ 'guide' ] = $tab;
130
+
131
+ /**
132
+ * WPGlobus Help Desk tab.
133
+ */
134
+ $href = add_query_arg(
135
+ array(
136
+ 'page' => WPGlobus::PAGE_WPGLOBUS_HELPDESK
137
+ ),
138
+ admin_url( 'admin.php' )
139
+ );
140
+
141
+ $tab = array(
142
+ 'title' => __( 'WPGlobus Help Desk', 'wpglobus' ),
143
+ 'link_class' => array( 'nav-tab' ),
144
+ 'span_class' => array( 'dashicons', 'dashicons-format-chat' ),
145
+ 'link' => self::$link_template,
146
+ 'href' => $href,
147
+ 'tab_id' => ''
148
+ );
149
+ $tabs[ 'helpdesk' ] = $tab;
150
+
151
+ /**
152
+ * WPGlobus Add-ons tab.
153
+ */
154
+ $href = WPGlobus_Admin_Page::url_addons();
155
+
156
+ $tab = array(
157
+ 'title' => __( 'Add-ons', 'wpglobus' ),
158
+ 'link_class' => array( 'nav-tab' ),
159
+ 'span_class' => array( 'dashicons', 'dashicons-admin-plugins' ),
160
+ 'link' => self::$link_template,
161
+ 'href' => $href,
162
+ 'tab_id' => ''
163
+ );
164
+ $tabs[ 'add_ons' ] = $tab;
165
+
166
+ return $tabs;
167
+
168
+ }
169
+ }
170
+
171
+ endif;
172
+ /* EOF */
trunk/includes/admin/class-wpglobus-about.php ADDED
@@ -0,0 +1,178 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package WPGlobus\Admin
4
+ */
5
+
6
+ /**
7
+ * Class WPGlobus_About
8
+ */
9
+ class WPGlobus_About {
10
+
11
+ /**
12
+ * For Google Analytics
13
+ */
14
+ const QA_CAMPAIGN = '?utm_source=wpglobus-admin-about&utm_medium=link&utm_campaign=activate-plugin';
15
+
16
+ /**
17
+ * Output the about screen.
18
+ */
19
+ public static function about_screen() {
20
+
21
+ WPGlobus_Admin_Page::print_header();
22
+
23
+ ?>
24
+ <h2 class="nav-tab-wrapper">
25
+ <a href="#" class="nav-tab nav-tab-active">
26
+ <?php esc_html_e( 'Quick Start', 'wpglobus' ); ?>
27
+ </a>
28
+ <a href="<?php echo esc_url( WPGlobus_Admin_Page::url_settings() ); ?>"
29
+ class="nav-tab">
30
+ <?php WPGlobus_Admin_Page::nav_tab_icon_e( 'Settings' ); ?>
31
+ <?php esc_html_e( 'Settings' ); ?>
32
+ </a>
33
+ <a href="<?php echo esc_url( WPGlobus_Admin_Page::url_addons() ); ?>"
34
+ class="nav-tab">
35
+ <?php WPGlobus_Admin_Page::nav_tab_icon_e( 'Add-ons' ); ?>
36
+ <?php esc_html_e( 'Add-ons', 'wpglobus' ); ?>
37
+ </a>
38
+ <a href="<?php echo esc_url( WPGlobus_Utils::url_wpglobus_site() . 'quick-start/' . self::QA_CAMPAIGN ); ?>"
39
+ target="_blank"
40
+ class="nav-tab">
41
+ <?php WPGlobus_Admin_Page::nav_tab_icon_e( 'Guide' ); ?>
42
+ <?php esc_html_e( 'Guide', 'wpglobus' ); ?>
43
+ </a>
44
+ <a href="<?php echo esc_url( WPGlobus_Utils::url_wpglobus_site() . 'faq/' . self::QA_CAMPAIGN ); ?>"
45
+ target="_blank"
46
+ class="nav-tab">
47
+ <?php WPGlobus_Admin_Page::nav_tab_icon_e( 'FAQ' ); ?>
48
+ <?php esc_html_e( 'FAQ', 'wpglobus' ); ?>
49
+ </a>
50
+ <a href="<?php echo esc_url( WPGlobus_Admin_Page::url_helpdesk() ); ?>"
51
+ class="nav-tab">
52
+ <?php WPGlobus_Admin_Page::nav_tab_icon_e( 'Helpdesk' ); ?>
53
+ <?php echo esc_html( WPGlobus_Admin_HelpDesk::$page_title ); ?>
54
+ </a>
55
+ </h2>
56
+
57
+ <?php if ( ! extension_loaded( 'mbstring' ) ) : ?>
58
+ <div style="background: #fff;border-left: 4px solid #dc3232;margin: 15px 15px 2px;padding: 1px 12px;">
59
+ <h4><?php esc_html_e( 'Attention: the Multibyte String PHP extension (`mbstring`) is not loaded!', 'wpglobus' ); ?></h4>
60
+ <p><?php esc_html_e( 'The mbstring extension is required for the full UTF-8 compatibility and better performance. Without it, some parts of WordPress and WPGlobus may function incorrectly. Please contact your hosting company or systems administrator.', 'wpglobus' ); ?></p>
61
+ </div>
62
+ <?php endif; ?>
63
+
64
+ <div class="feature-main feature-section col two-col">
65
+ <div class="col">
66
+ <?php self::easy_1_2_3(); ?>
67
+ </div>
68
+ <div class="col last-feature">
69
+ <?php self::translation_help(); ?>
70
+ </div>
71
+ </div>
72
+
73
+ <div class="feature-main feature-section col two-col">
74
+ <div class="col">
75
+ <?php self::important_notes(); ?>
76
+ </div>
77
+ <div class="col last-feature">
78
+ <?php self::links(); ?>
79
+ </div>
80
+ </div>
81
+
82
+ <hr />
83
+
84
+ <div class="return-to-dashboard">
85
+ <a class="button button-primary"
86
+ href="<?php echo esc_url( WPGlobus_Admin_Page::url_settings() ); ?>">
87
+ <?php esc_html_e( 'Go to WPGlobus Settings', 'wpglobus' ); ?>
88
+ </a>
89
+ </div>
90
+
91
+ <?php
92
+ WPGlobus_Admin_Page::print_footer();
93
+ }
94
+
95
+ protected static function easy_1_2_3() {
96
+ ?>
97
+ <h4 class="dashicons-before dashicons-admin-settings bar">
98
+ <?php esc_html_e( 'Easy as 1-2-3:', 'wpglobus' ); ?>
99
+ </h4>
100
+ <ul class="wpglobus-checkmarks">
101
+ <li><?php esc_html_e( 'Go to WPGlobus admin menu and choose the countries / languages;', 'wpglobus' ); ?></li>
102
+ <li><?php esc_html_e( 'Enter the translations to the posts, pages, categories, tags and menus using a clean and simple interface.', 'wpglobus' ); ?></li>
103
+ <li><?php esc_html_e( 'Switch languages at the front-end using a drop-down menu with language names and country flags.', 'wpglobus' ); ?></li>
104
+ </ul>
105
+ <?php
106
+ }
107
+
108
+ protected static function links() {
109
+ ?>
110
+ <h4 class="dashicons-before dashicons-admin-links bar">
111
+ <?php esc_html_e( 'Links:', 'wpglobus' ); ?>
112
+ </h4>
113
+ <ul>
114
+ <li>&bull; <a href="<?php echo esc_url( WPGlobus_Utils::url_wpglobus_site() . self::QA_CAMPAIGN ); ?>"
115
+ target="_blank">WPGlobus.com</a></li>
116
+ <li>&bull; <a href="<?php echo esc_url( WPGlobus_Utils::url_wpglobus_site() . 'quick-start/' . self::QA_CAMPAIGN ); ?>"
117
+ target="_blank"><?php esc_html_e( 'Guide', 'wpglobus' ); ?></a></li>
118
+ <li>&bull; <a href="<?php echo esc_url( WPGlobus_Utils::url_wpglobus_site() . 'faq/' . self::QA_CAMPAIGN ); ?>"
119
+ target="_blank"><?php esc_html_e( 'FAQs', 'wpglobus' ); ?></a></li>
120
+ <li>&bull; <a href="<?php echo esc_url( WPGlobus_Admin_Page::url_helpdesk() ); ?>"
121
+ target="_blank"><?php esc_html_e( 'Contact Us', 'wpglobus' ); ?></a></li>
122
+ <li>&bull; <a href="https://wordpress.org/support/plugin/wpglobus/reviews/?filter=5"
123
+ target="_blank"><?php esc_html_e( 'Please give us 5 stars!', 'wpglobus' ); ?></a>
124
+ <span class="wpglobus-stars">&#x2606;&#x2606;&#x2606;&#x2606;&#x2606;</span></li>
125
+
126
+ </ul>
127
+ <?php
128
+ }
129
+
130
+ protected static function translation_help() {
131
+ ?>
132
+ <h4 class="dashicons-before dashicons-translation highlight">
133
+ <?php esc_html_e( 'WPGlobus does not translate texts automatically!', 'wpglobus' ); ?>
134
+ </h4>
135
+ <p>
136
+ <?php esc_html_e( 'There are many translation companies and individual translators who can help you write and proofread the texts.', 'wpglobus' ); ?>
137
+ <?php esc_html_e( 'When you choose a translator, please look at their native language, country of residence, specialization and knowledge of WordPress.', 'wpglobus' ); ?>
138
+ </p>
139
+ <p>
140
+ <?php
141
+ printf(
142
+ // translators: %s are used to insert HTML link. Keep them in place.
143
+ esc_html__( 'We are planning to maintain a %s list of translators %s on the WPGlobus website. This is not an endorsement, just a courtesy. Please contact them directly and let us know how did it work for you!', 'wpglobus' ),
144
+ '<a href="' . esc_url( WPGlobus_Utils::url_wpglobus_site() . 'translator/' . self::QA_CAMPAIGN ) . '">',
145
+ '</a>'
146
+ ); ?>
147
+ </p>
148
+ <?php
149
+ }
150
+
151
+ protected static function important_notes() {
152
+ ?>
153
+ <h4 class="dashicons-before dashicons-info highlight">
154
+ <?php esc_html_e( 'Important notes:', 'wpglobus' ); ?>
155
+ </h4>
156
+ <ul class="wpglobus-important">
157
+
158
+ <li>
159
+ <?php _e( 'WPGlobus only supports the localization URLs in the form of <code>example.com/xx/page/</code>. We do not plan to support subdomains <code>xx.example.com</code> and language queries <code>example.com?lang=xx</code>.', 'wpglobus' ); // WPCS: XSS ok. ?>
160
+ </li>
161
+ <li>
162
+ <?php _e( 'Some themes and plugins are <strong>not multilingual-ready</strong>.', 'wpglobus' ); // WPCS: XSS ok. ?>
163
+ <?php esc_html_e( 'They might display some texts with no translation, or with all languages mixed together.', 'wpglobus' ); ?>
164
+ <?php
165
+ printf(
166
+ // translators: %s are used to insert HTML link. Keep them in place.
167
+ esc_html__( 'Please contact the theme / plugin author. If they are unable to assist, consider %s hiring the WPGlobus Team %s to write a custom code for you.', 'wpglobus' ),
168
+ '<a href="' . esc_url( WPGlobus_Utils::url_wpglobus_site() . 'professional-support/' . self::QA_CAMPAIGN ) . '">',
169
+ '</a>'
170
+ ); ?>
171
+ </li>
172
+
173
+ </ul>
174
+ <?php
175
+ }
176
+ } //class
177
+
178
+ /*EOF*/
trunk/includes/admin/class-wpglobus-admin-bar-menu.php ADDED
@@ -0,0 +1,213 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Show WPGlobus menu in admin bar.
4
+ *
5
+ * @since 2.2.7
6
+ * @package WPGlobus\Admin
7
+ */
8
+
9
+ if ( ! class_exists( 'WPGlobus_Admin_Bar_Menu' ) ) :
10
+
11
+ /**
12
+ * Class WPGlobus_Admin_Bar_Menu.
13
+ */
14
+ class WPGlobus_Admin_Bar_Menu {
15
+
16
+ /**
17
+ * Available languages.
18
+ *
19
+ * @var array
20
+ */
21
+ protected static $available_languages = array();
22
+
23
+ /**
24
+ * @since 2.2.8
25
+ */
26
+ protected static $run_script = true;
27
+
28
+ /**
29
+ * Static constructor.
30
+ *
31
+ * @param WP_Admin_Bar $wp_admin_bar Admin bar.
32
+ */
33
+ public static function construct( $wp_admin_bar ) {
34
+
35
+ $user_id = get_current_user_id();
36
+
37
+ if ( ! $user_id ) {
38
+ return;
39
+ }
40
+
41
+ self::$available_languages = get_available_languages();
42
+
43
+ $user_locale = get_user_meta( $user_id, 'locale', true );
44
+
45
+ add_action( 'admin_footer', array( __CLASS__, 'on__admin_footer' ), 1000 );
46
+
47
+ if ( empty( $user_locale ) ) {
48
+ self::add_language_menu( $wp_admin_bar );
49
+ } else {
50
+ if ( ! self::add_info_menu( $wp_admin_bar, $user_locale ) ) {
51
+ self::$run_script = false;
52
+ }
53
+ }
54
+
55
+ }
56
+
57
+ /**
58
+ * @since 2.2.8
59
+ */
60
+ public static function on__admin_footer() {
61
+
62
+ if ( ! self::$run_script ) {
63
+ return;
64
+ }
65
+
66
+ ?>
67
+ <!--suppress AnonymousFunctionJS, JSUnusedLocalSymbols -->
68
+ <script type="text/javascript">
69
+ //<![CDATA[
70
+ jQuery(document).ready(function ($) {
71
+ wpglobus_select_lang = function (locale) {
72
+ $.post(ajaxurl, {
73
+ action: 'WPGlobus_process_ajax',
74
+ order: {action: 'wpglobus_select_lang', locale: locale}
75
+ }, function (d) {
76
+ })
77
+ .done(function () {
78
+ window.location.reload();
79
+ });
80
+ }
81
+ $('#wpglobus-default-locale').on('click', function (e) {
82
+ wpglobus_select_lang('<?php echo esc_js( WPGlobus::Config()->locale[ WPGlobus::Config()->language ] ); ?>');
83
+ });
84
+
85
+ });
86
+ //]]>
87
+ </script>
88
+ <?php
89
+ }
90
+
91
+ /**
92
+ * Language menu with link to `profile.php` page.
93
+ *
94
+ * @param WP_Admin_Bar $wp_admin_bar Admin bar.
95
+ * @param string[] $user_locale User locale.
96
+ */
97
+ public static function add_info_menu( $wp_admin_bar, $user_locale ) {
98
+
99
+ $user_profile_language = array_search( $user_locale, WPGlobus::Config()->locale, true );
100
+
101
+ if ( ! $user_profile_language ) {
102
+ return false;
103
+ }
104
+
105
+ if ( empty( WPGlobus::Config()->language_name[ $user_profile_language ] ) ) {
106
+ return false;
107
+ }
108
+
109
+ $img = '';
110
+ if ( ! empty( WPGlobus::Config()->flag[ $user_profile_language ] ) ) {
111
+ $img = '<span class="ab-icon"><img src="' . WPGlobus::Config()->flags_url . WPGlobus::Config()->flag[ $user_profile_language ] . '" alt=""/></span>';
112
+ }
113
+
114
+ $wp_admin_bar->add_menu(
115
+ array(
116
+ 'id' => 'wpglobus-language-select',
117
+ 'parent' => 'top-secondary',
118
+ 'title' => $img . '<span class="ab-label">' .
119
+ WPGlobus::Config()->language_name[ $user_profile_language ] .
120
+ '</span>',
121
+ )
122
+ );
123
+
124
+ $title = esc_html__( 'Language was set on your profile page', 'wpglobus' );
125
+ $wp_admin_bar->add_menu(
126
+ array(
127
+ 'parent' => 'wpglobus-language-select',
128
+ 'id' => 'wpglobus-add-languages',
129
+ 'title' => $title,
130
+ 'href' => admin_url( 'profile.php' ),
131
+ 'meta' => array(
132
+ 'tabindex' => -1,
133
+ ),
134
+ )
135
+ );
136
+
137
+ return true;
138
+ }
139
+
140
+ /**
141
+ * Language menu in admin bar.
142
+ *
143
+ * @param WP_Admin_Bar $wp_admin_bar Admin bar.
144
+ */
145
+ public static function add_language_menu( $wp_admin_bar ) {
146
+
147
+ $available_languages = self::$available_languages;
148
+
149
+ $wp_admin_bar->add_menu(
150
+ array(
151
+ 'id' => 'wpglobus-language-select',
152
+ 'parent' => 'top-secondary',
153
+ 'title' => '<span class="ab-icon">' .
154
+ '<img alt="" src="' . WPGlobus::Config()->flags_url .
155
+ WPGlobus::Config()->flag[ WPGlobus::Config()->language ] . '"/>' .
156
+ '</span><span class="ab-label">' .
157
+ WPGlobus::Config()->language_name[ WPGlobus::Config()->language ] .
158
+ '</span>',
159
+ )
160
+ );
161
+
162
+ $add_more_languages = array();
163
+ foreach ( WPGlobus::Config()->enabled_languages as $language ) :
164
+
165
+ if ( WPGlobus::Config()->language === $language ) {
166
+ continue;
167
+ }
168
+
169
+ $locale = WPGlobus::Config()->locale[ $language ];
170
+
171
+ if ( 'en_US' !== $locale ) {
172
+ if ( ! in_array( $locale, $available_languages, true ) ) {
173
+ $add_more_languages[] = WPGlobus::Config()->language_name[ $language ];
174
+ continue;
175
+ }
176
+ }
177
+
178
+ $wp_admin_bar->add_menu(
179
+ array(
180
+ 'parent' => 'wpglobus-language-select',
181
+ 'id' => 'wpglobus-' . $language,
182
+ 'title' => '<span><img alt="" src="' . WPGlobus::Config()->flags_url . WPGlobus::Config()->flag[ $language ] . '" /></span>&nbsp;&nbsp;' . WPGlobus::Config()->language_name[ $language ],
183
+ 'href' => admin_url( 'options-general.php' ),
184
+ 'meta' => array(
185
+ 'tabindex' => -1,
186
+ 'onclick' => 'wpglobus_select_lang("' . $locale . '");return false;',
187
+ ),
188
+ )
189
+ );
190
+
191
+ endforeach;
192
+
193
+ if ( ! empty( $add_more_languages ) ) {
194
+ $title = esc_html__( 'Add', 'wpglobus' ) . ' (' . implode( ', ', $add_more_languages ) . ')';
195
+ $wp_admin_bar->add_menu(
196
+ array(
197
+ 'parent' => 'wpglobus-language-select',
198
+ 'id' => 'wpglobus-add-languages',
199
+ 'title' => $title,
200
+ 'href' => admin_url( 'options-general.php' ),
201
+ 'meta' => array(
202
+ 'tabindex' => -1,
203
+ ),
204
+ )
205
+ );
206
+ }
207
+
208
+ return;
209
+
210
+ }
211
+ }
212
+
213
+ endif;
trunk/includes/admin/class-wpglobus-admin-menu.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Show a sidebar menu item.
4
+ *
5
+ * @since 1.7.8
6
+ */
7
+
8
+ /**
9
+ * Class WPGlobus_Admin_Menu
10
+ */
11
+ class WPGlobus_Admin_Menu {
12
+
13
+ /**
14
+ * Static constructor.
15
+ */
16
+ public static function construct() {
17
+ add_action( 'admin_menu', array( __CLASS__, 'add_menu' ), PHP_INT_MAX );
18
+ }
19
+
20
+ public static function add_menu() {
21
+ $icon_class = 'dashicons dashicons-before dashicons-admin-plugins';
22
+ $menu_title = __( 'Add-ons', 'wpglobus' );
23
+ add_submenu_page(
24
+ WPGlobus::OPTIONS_PAGE_SLUG,
25
+ $menu_title,
26
+ '<span class="' . esc_attr( $icon_class )
27
+ . '" style="vertical-align:middle"></span> '
28
+ . $menu_title,
29
+ 'administrator',
30
+ WPGlobus_Admin_Page::url_addons(true)
31
+ );
32
+
33
+ }
34
+ }
trunk/includes/admin/class-wpglobus-admin-page.php ADDED
@@ -0,0 +1,203 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * File: class-wpglobus-admin-page.php
4
+ *
5
+ * @package WPGlobus\Admin
6
+ */
7
+
8
+ /**
9
+ * Helpers for building admin pages.
10
+ */
11
+ class WPGlobus_Admin_Page {
12
+
13
+ /**
14
+ * Print page header.
15
+ */
16
+ public static function print_header() {
17
+ $url_wpglobus_logo = WPGlobus::internal_images_url() . '/wpglobus-logo-180x180.png';
18
+ ?>
19
+ <style>
20
+ .wp-badge.wpglobus-badge {
21
+ background: #ffffff url(<?php echo esc_url( $url_wpglobus_logo ); ?>) no-repeat;
22
+ background-size: contain;
23
+ }
24
+ </style>
25
+
26
+ <?php echo '<div class="wrap about-wrap wpglobus-about-wrap">'; ?>
27
+
28
+ <h1 class="wpglobus"><span class="wpglobus-wp">WP</span>Globus
29
+ <span class="wpglobus-version"><?php echo esc_html( WPGLOBUS_VERSION ); ?></span>
30
+ </h1>
31
+
32
+ <div class="wpglobus-motto"><?php esc_html_e( 'Multilingual Everything!', 'wpglobus' ); ?></div>
33
+ <div class="about-text">
34
+ <?php esc_html_e( 'WPGlobus is a family of WordPress plugins assisting you in making multilingual WordPress blogs and sites.', 'wpglobus' ); ?>
35
+ </div>
36
+
37
+ <div class="wp-badge wpglobus-badge"></div>
38
+ <?php
39
+ }
40
+
41
+ /**
42
+ * Print page header.
43
+ */
44
+ public static function print_footer() {
45
+ echo '</div>';
46
+ }
47
+
48
+ /**
49
+ * URL of the WPGlobus Add-ons page.
50
+ *
51
+ * @param bool $relative Set it to true to get the URL relative to the admin.
52
+ *
53
+ * @return string
54
+ */
55
+ public static function url_addons( $relative = false ) {
56
+
57
+ $url = add_query_arg(
58
+ array(
59
+ 'tab' => 'search',
60
+ 's' => 'WPGlobus',
61
+ 'source' => 'WPGlobus',
62
+ ),
63
+ self_admin_url( 'plugin-install.php' )
64
+ );
65
+
66
+ if ( $relative ) {
67
+ $url = str_replace( self_admin_url(), '', $url );
68
+ }
69
+
70
+ return $url;
71
+
72
+ }
73
+
74
+ /**
75
+ * URL of the WPGlobus Settings page.
76
+ *
77
+ * @return string
78
+ */
79
+ public static function url_settings() {
80
+ return add_query_arg( 'page', WPGlobus::OPTIONS_PAGE_SLUG, admin_url( 'admin.php' ) );
81
+ }
82
+
83
+ /**
84
+ * URL of the WPGlobus Helpdesk page.
85
+ *
86
+ * @return string
87
+ * @since 1.9.10
88
+ */
89
+ public static function url_helpdesk() {
90
+ return add_query_arg( 'page', WPGlobus::PAGE_WPGLOBUS_HELPDESK, admin_url( 'admin.php' ) );
91
+ }
92
+
93
+ /**
94
+ * URL of the Clean-up Tool page.
95
+ *
96
+ * @return string
97
+ * @since 1.9.10
98
+ */
99
+ public static function url_clean_up_tool() {
100
+ return add_query_arg( 'page', WPGlobus::PAGE_WPGLOBUS_CLEAN, admin_url( 'admin.php' ) );
101
+ }
102
+
103
+ /**
104
+ * URL of the About page.
105
+ *
106
+ * @return string
107
+ * @since 1.9.10
108
+ */
109
+ public static function url_about() {
110
+ return add_query_arg( 'page', WPGlobus::PAGE_WPGLOBUS_ABOUT, admin_url( 'admin.php' ) );
111
+ }
112
+
113
+ /**
114
+ * URL of the Admin Central page.
115
+ *
116
+ * @param string $central_tab_id Tab on the page.
117
+ *
118
+ * @return string
119
+ * @since 1.9.10
120
+ */
121
+ public static function url_admin_central( $central_tab_id = '' ) {
122
+ return add_query_arg( 'page', WPGlobus::PAGE_WPGLOBUS_ADMIN_CENTRAL . '#' . $central_tab_id, admin_url( 'admin.php' ) );
123
+ }
124
+
125
+ /**
126
+ * URL of the Options Panel.
127
+ *
128
+ * @param string $tab Tab on the page.
129
+ *
130
+ * @return string
131
+ * @since 1.9.10
132
+ */
133
+ public static function url_options_panel( $tab = WPGlobus_Options::DEFAULT_TAB ) {
134
+
135
+ return add_query_arg( array(
136
+ 'page' => WPGlobus::OPTIONS_PAGE_SLUG,
137
+ 'tab' => $tab,
138
+ ), admin_url( 'admin.php' ) );
139
+ }
140
+
141
+ /**
142
+ * URL of the WPGlobus-Plus Panel.
143
+ *
144
+ * @param string $tab Tab on the page.
145
+ *
146
+ * @return string
147
+ * @since 1.9.10
148
+ */
149
+ public static function url_wpglobus_plus_panel( $tab = 'modules' ) {
150
+ if ( class_exists( 'WPGlobusPlus', false ) ) {
151
+ return add_query_arg( array(
152
+ 'page' => WPGlobusPlus::WPGLOBUS_PLUS_OPTIONS_PAGE,
153
+ 'tab' => $tab,
154
+ ), admin_url( 'admin.php' ) );
155
+ } else {
156
+ return admin_url();
157
+ }
158
+ }
159
+
160
+ /**
161
+ * Icon for navigation tab item.
162
+ *
163
+ * @param string $icon_class A Dashicon CSS class or our internal alias.
164
+ * @param boolean $add_dashicons_class Add "dashicons" class before icon class.
165
+ *
166
+ * @link https://developer.wordpress.org/resource/dashicons/
167
+ * @return string
168
+ */
169
+ public static function nav_tab_icon( $icon_class, $add_dashicons_class = true ) {
170
+
171
+ static $aliases = array(
172
+ 'faq' => 'dashicons-editor-help',
173
+ 'settings' => 'dashicons-admin-settings',
174
+ 'add-ons' => 'dashicons-admin-plugins',
175
+ 'guide' => 'dashicons-book-alt',
176
+ 'helpdesk' => 'dashicons-format-chat',
177
+ 'globe' => 'dashicons-admin-site',
178
+ );
179
+
180
+ $icon_class = strtolower( $icon_class );
181
+
182
+ if ( isset( $aliases[ $icon_class ] ) ) {
183
+ // An alias passed.
184
+ $icon_class = $aliases[ $icon_class ];
185
+ }
186
+
187
+ if ( $add_dashicons_class ) {
188
+ $icon_class = 'dashicons dashicons-before ' . $icon_class;
189
+ }
190
+
191
+ return $icon_class;
192
+
193
+ }
194
+
195
+ /**
196
+ * Print icon for navigation tab item.
197
+ *
198
+ * @param string $icon_class A Dashicon CSS class or our internal alias.
199
+ */
200
+ public static function nav_tab_icon_e( $icon_class ) {
201
+ echo '<span class="' . esc_attr( self::nav_tab_icon( $icon_class ) ) . '"></span>';
202
+ }
203
+ }
trunk/includes/admin/class-wpglobus-admin-post.php ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * File: class-wpglobus-admin-post.php
4
+ * Class for post.php page.
5
+ *
6
+ * @package WPGlobus\Admin
7
+ * @author Alex Gor(alexgff)
8
+ * @since 2.4
9
+ */
10
+ if ( ! class_exists( 'WPGlobus_Admin_Post' ) ) :
11
+
12
+ /**
13
+ * Class WPGlobus_Admin_Menu.
14
+ */
15
+ class WPGlobus_Admin_Post {
16
+
17
+ /**
18
+ * Static constructor.
19
+ */
20
+ public static function construct() {
21
+
22
+ if ( ! WPGlobus_WP::is_pagenow('post.php') ) {
23
+ return;
24
+ }
25
+
26
+ if ( 'off' == WPGlobus::Config()->toggle ) {
27
+ return;
28
+ }
29
+
30
+ add_filter( 'preview_post_link', array( __CLASS__, 'filter__preview_post_link' ), 5, 2 );
31
+ }
32
+
33
+ /**
34
+ * Filters the URL used for a post preview in builder mode.
35
+ * @see wp-includes/link-template.php
36
+ *
37
+ * @param string $preview_link URL used for the post preview.
38
+ * @param WP_Post $post Post object.
39
+ */
40
+ public static function filter__preview_post_link( $preview_link, $post ) {
41
+
42
+ if ( ! WPGlobus::Config()->builder->is_builder_page() ) {
43
+ return $preview_link;
44
+ }
45
+
46
+ if ( WPGlobus::Config()->builder->is_default_language() ) {
47
+ return $preview_link;
48
+
49
+ }
50
+
51
+ return WPGlobus_Utils::localize_url( $preview_link, WPGlobus::Config()->builder->get_language() );
52
+ }
53
+ }
54
+
55
+ endif;
56
+
57
+ # --- EOF
trunk/includes/admin/class-wpglobus-clean.php ADDED
@@ -0,0 +1,736 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/Admin
4
+ * @since 1.4.3
5
+ */
6
+
7
+ if ( ! class_exists( 'WPGlobus_Clean' ) ) :
8
+
9
+ /**
10
+ * Class WPGlobus_Clean
11
+ */
12
+ class WPGlobus_Clean {
13
+
14
+ const LOG_BASENAME = 'wpglobus-clean';
15
+
16
+ protected static $tables = array();
17
+
18
+ protected static $log_file = '';
19
+
20
+ /**
21
+ * Controller
22
+ */
23
+ public static function controller() {
24
+
25
+ self::_set_log_file();
26
+
27
+ self::get_table();
28
+
29
+ self::screen();
30
+
31
+ add_action( 'admin_footer', array(
32
+ 'WPGlobus_Clean',
33
+ 'action__admin_print_scripts'
34
+ ),
35
+ 99
36
+ );
37
+
38
+ }
39
+
40
+ /**
41
+ * Initialize the class variable `log_file`.
42
+ * Note: 'wp-content' can be set to a different path, so we are using the standard WP method.
43
+ * @todo Check if the folder exists and file is writeable.
44
+ */
45
+ protected static function _set_log_file() {
46
+ $upload_dir = wp_upload_dir();
47
+ $wpglobus_logs_dir = $upload_dir['basedir'] . '/' . 'wpglobus-logs';
48
+
49
+ wp_mkdir_p( $wpglobus_logs_dir );
50
+ // Protect the folder from reading via URL
51
+ if ( ! file_exists( $wpglobus_logs_dir . '/.htaccess' ) ) {
52
+ file_put_contents( $wpglobus_logs_dir . '/.htaccess', 'deny from all' );
53
+ }
54
+ if ( ! file_exists( $wpglobus_logs_dir . '/index.php' ) ) {
55
+ file_put_contents( $wpglobus_logs_dir . '/index.php', '' );
56
+ }
57
+
58
+ self::$log_file = $wpglobus_logs_dir . '/' . self::LOG_BASENAME . '.log';
59
+ }
60
+
61
+ /**
62
+ * Get table
63
+ *
64
+ * @param string $table Table name to set data.
65
+ *
66
+ * @return void
67
+ */
68
+ public static function get_table( $table = '' ) {
69
+
70
+ $get_all = false;
71
+ if ( '' === $table ) {
72
+ $get_all = true;
73
+ }
74
+
75
+ if ( 'posts' === $table || $get_all ) {
76
+
77
+ /**
78
+ * table posts
79
+ */
80
+ $posts = new stdClass();
81
+ $posts->include_fields = array(
82
+ 'post_content',
83
+ 'post_title',
84
+ 'post_excerpt',
85
+ 'post_content_filtered'
86
+ );
87
+ $posts->id_field = 'ID';
88
+ $posts->post_status = array(
89
+ 'publish',
90
+ 'draft'
91
+ );
92
+
93
+ self::$tables['posts'] = $posts;
94
+
95
+ }
96
+
97
+ if ( 'postmeta' === $table || $get_all ) {
98
+
99
+ /**
100
+ * table postmeta
101
+ */
102
+ $postmeta = new stdClass();
103
+ $postmeta->include_fields = array(
104
+ 'meta_value'
105
+ );
106
+ $postmeta->id_field = 'meta_id';
107
+
108
+ self::$tables['postmeta'] = $postmeta;
109
+
110
+ }
111
+
112
+ if ( 'options' === $table || $get_all ) {
113
+
114
+ /**
115
+ * table options
116
+ */
117
+ $options = new stdClass();
118
+ $options->include_fields = array(
119
+ 'option_value'
120
+ );
121
+ $options->id_field = 'option_id';
122
+
123
+ self::$tables['options'] = $options;
124
+
125
+ }
126
+
127
+ if ( 'terms' === $table || $get_all ) {
128
+
129
+ /**
130
+ * table terms
131
+ */
132
+ $terms = new stdClass();
133
+ $terms->include_fields = array(
134
+ 'name'
135
+ );
136
+ $terms->id_field = 'term_id';
137
+
138
+ self::$tables['terms'] = $terms;
139
+
140
+ }
141
+
142
+ if ( 'term_taxonomy' === $table || $get_all ) {
143
+
144
+ /**
145
+ * table term_taxonomy
146
+ */
147
+ $term_taxonomy = new stdClass();
148
+ $term_taxonomy->include_fields = array(
149
+ 'description'
150
+ );
151
+ $term_taxonomy->id_field = 'term_taxonomy_id';
152
+
153
+ self::$tables['term_taxonomy'] = $term_taxonomy;
154
+
155
+ }
156
+
157
+ if ( 'usermeta' === $table || $get_all ) {
158
+
159
+ /**
160
+ * table usermeta
161
+ */
162
+ $usermeta = new stdClass();
163
+ $usermeta->include_fields = array(
164
+ 'meta_value'
165
+ );
166
+
167
+ $usermeta->id_field = 'umeta_id';
168
+
169
+ self::$tables['usermeta'] = $usermeta;
170
+
171
+ }
172
+
173
+
174
+ if ( class_exists( 'WooCommerce' ) ) :
175
+
176
+ /**
177
+ * WooCommerce tables
178
+ */
179
+ if ( 'woocommerce_attribute_taxonomies' === $table || $get_all ) {
180
+ /**
181
+ * table woocommerce_attribute_taxonomies
182
+ */
183
+ $woocommerce_attribute_taxonomies = new stdClass();
184
+ $woocommerce_attribute_taxonomies->include_fields = array(
185
+ 'attribute_label'
186
+ );
187
+ $woocommerce_attribute_taxonomies->id_field = 'attribute_id';
188
+
189
+ self::$tables['woocommerce_attribute_taxonomies'] = $woocommerce_attribute_taxonomies;
190
+ }
191
+
192
+ if ( 'woocommerce_order_items' === $table || $get_all ) {
193
+ /**
194
+ * table woocommerce_order_items
195
+ */
196
+ $woocommerce_order_items = new stdClass();
197
+ $woocommerce_order_items->include_fields = array(
198
+ 'order_item_name'
199
+ );
200
+ $woocommerce_order_items->id_field = 'order_item_id';
201
+
202
+ self::$tables['woocommerce_order_items'] = $woocommerce_order_items;
203
+ }
204
+
205
+ endif;
206
+
207
+ }
208
+
209
+ /**
210
+ * Get table list
211
+ */
212
+ public static function get_table_list() {
213
+
214
+ $spinner = WPGlobus::$PLUGIN_DIR_URL . 'includes/css/images/spinner.gif';
215
+
216
+ $list = '<ul>';
217
+ foreach ( self::$tables as $table => $data ) {
218
+
219
+ $list .= '<li id="' . $table . '">';
220
+ /** @noinspection DisconnectedForeachInstructionInspection */
221
+ $list .= '<span class="wpglobus-spinner" style="float:left;margin-right:10px;"><img src="' . $spinner . '" /></span>';
222
+ $list .= '<span class="wpglobus-result" style="float:left;width:20px;height:20px;"></span>';
223
+ $list .= '<span class=""><input type="checkbox" id="cb-' . $table . '" checked disabled /></span>';
224
+ $list .= $table;
225
+ $list .= '</li>';
226
+
227
+ }
228
+ $list .= '<li id="wpglobus_options">';
229
+ $list .= '<span class="wpglobus-spinner" style="float:left;margin-right:10px;"><img src="' . $spinner . '" /></span>';
230
+ $list .= '<span class="wpglobus-result" style="float:left;width:20px;height:20px;"></span>';
231
+ $list .= '<span class=""><input type="checkbox" id="cb-wpglobus_options" name="cb-wpglobus_options" /></span>';
232
+ $list .= esc_html( __( 'Remove the WPGlobus settings (not recommended)', 'wpglobus' ) );
233
+ $list .= '</li>';
234
+ $list .= '</ul>';
235
+
236
+ return $list;
237
+
238
+ }
239
+
240
+ /**
241
+ * Ajax action handler
242
+ *
243
+ * @param string[] $order
244
+ */
245
+ public static function process_ajax( $order ) {
246
+
247
+ self::_set_log_file();
248
+
249
+ $_log = false;
250
+
251
+ if ( 'true' === $order['log'] ) {
252
+ $_log = true;
253
+ }
254
+
255
+ if ( $order['action'] === 'die' ) {
256
+ wp_send_json_success( $order );
257
+ }
258
+
259
+ if ( $order['action'] === 'wpglobus-reset' ) {
260
+
261
+ /**
262
+ * SELECT * FROM `wp_options` WHERE `option_name` REGEXP 'wpglobus'
263
+ */
264
+
265
+ global $wpdb;
266
+
267
+ /**
268
+ * Make table with prefix
269
+ */
270
+ $table = $wpdb->prefix . 'options';
271
+
272
+ $query = "SELECT `option_id`, `option_name` FROM `$table` WHERE `option_name` REGEXP 'wpglobus'";
273
+
274
+ $ids = $wpdb->get_results( $query, ARRAY_A );
275
+
276
+ $records = array();
277
+ $fields = array();
278
+
279
+ foreach ( $ids as $data ) {
280
+ foreach ( $data as $field_id => $record_id ) {
281
+ if ( 'option_id' === $field_id ) {
282
+ $records[] = $record_id;
283
+ } else if ( 'option_name' === $field_id ) {
284
+ $fields[] = $record_id;
285
+ }
286
+ }
287
+ }
288
+
289
+ $result = true;
290
+ if ( ! empty( $records ) ) {
291
+
292
+ if ( $_log ) {
293
+ self::_log( $table, '', $fields, '' );
294
+ }
295
+
296
+ $set = implode( ',', $records );
297
+ $query = "DELETE FROM $table WHERE `option_id` IN ($set)";
298
+ $result = $wpdb->query( $query );
299
+ }
300
+
301
+ if ( false === $result ) {
302
+ wp_send_json_error( $order );
303
+ }
304
+
305
+ wp_send_json_success( $order );
306
+
307
+ }
308
+
309
+ if ( $order['action'] !== 'clean' ) {
310
+ wp_send_json_error( $order );
311
+ }
312
+
313
+ self::get_table( $order['table'] );
314
+
315
+ /**
316
+ * Set of examples of sql queries
317
+ * @see http://dev.mysql.com/doc/refman/5.7/en/pattern-matching.html
318
+ * @see http://dev.mysql.com/doc/refman/5.7/en/regexp.html
319
+ */
320
+
321
+ /**
322
+ * SELECT * FROM `wp_posts` WHERE 1=1 AND `post_status` REGEXP 'publish|draft' AND (
323
+ * `post_content` REGEXP '{:[a-z]{2}|[[.[.]]:[a-z]{2}|<!--:[a-z]{2}' OR
324
+ * `post_title` REGEXP '{:[a-z]{2}|[[.[.]]:[a-z]{2}|<!--:[a-z]{2}' OR
325
+ * `post_excerpt` REGEXP '{:[a-z]{2}|[[.[.]]:[a-z]{2}|<!--:[a-z]{2}' OR
326
+ * `post_content_filtered` REGEXP '{:[a-z]{2}|[[.[.]]:[a-z]{2}|<!--:[a-z]{2}' )
327
+ */
328
+
329
+ /**
330
+ * SELECT * FROM `wp_postmeta` WHERE `meta_value` REGEXP '{:[a-z]{2}|[[.[.]]:[a-z]{2}|<!--:[a-z]{2}'
331
+ */
332
+
333
+ /**
334
+ * SELECT * FROM `wp_options` WHERE `option_value` REGEXP '{:[a-z]{2}|[[.[.]]:[a-z]{2}|<!--:[a-z]{2}'
335
+ */
336
+
337
+ /**
338
+ * SELECT * FROM `wp_terms` WHERE `name` REGEXP '{:[a-z]{2}|[[.[.]]:[a-z]{2}|<!--:[a-z]{2}'
339
+ */
340
+
341
+ /**
342
+ * SELECT * FROM `wp_term_taxonomy` WHERE `description` REGEXP '{:[a-z]{2}|[[.[.]]:[a-z]{2}|<!--:[a-z]{2}'
343
+ */
344
+
345
+ /**
346
+ * SELECT * FROM `wp_usermeta` WHERE `meta_value` REGEXP '{:[a-z]{2}|[[.[.]]:[a-z]{2}|<!--:[a-z]{2}'
347
+ */
348
+
349
+ /**
350
+ * SELECT * FROM `wp_woocommerce_attribute_taxonomies` WHERE `attribute_label` REGEXP '{:[a-z]{2}|[[.[.]]:[a-z]{2}|<!--:[a-z]{2}'
351
+ */
352
+
353
+ /**
354
+ * SELECT * FROM `wp_woocommerce_order_items` WHERE `order_item_name` REGEXP '{:[a-z]{2}|[[.[.]]:[a-z]{2}|<!--:[a-z]{2}'
355
+ */
356
+
357
+ global $wpdb;
358
+
359
+ /**
360
+ * Make table with prefix
361
+ */
362
+ $table = $wpdb->prefix . $order['table'];
363
+
364
+ /**
365
+ * Standard regexp
366
+ */
367
+ $wpg_regexp = '{:[a-z]{2}|[[.[.]]:[a-z]{2}|<!--:[a-z]{2}';
368
+
369
+ /**
370
+ * Post status
371
+ */
372
+ $post_status = '';
373
+ if ( ! empty( self::$tables[ $order['table'] ]->post_status ) ) {
374
+ /**
375
+ * Example: AND `post_status` REGEXP 'publish|draft'
376
+ */
377
+ $post_status = "AND post_status REGEXP '" . implode( '|', self::$tables[ $order['table'] ]->post_status ) . "' ";
378
+ }
379
+
380
+ /**
381
+ * Set condition
382
+ */
383
+ $condition = false;
384
+ if ( count( self::$tables[ $order['table'] ]->include_fields ) === 0 ) {
385
+ /** do nothing */
386
+ } else if ( count( self::$tables[ $order['table'] ]->include_fields ) === 1 ) {
387
+ /**
388
+ * one field
389
+ */
390
+ $field = self::$tables[ $order['table'] ]->include_fields[0];
391
+ $condition = "AND $field REGEXP '$wpg_regexp'";
392
+
393
+ } else {
394
+ /**
395
+ * multiple fields
396
+ */
397
+ $temp = array();
398
+ foreach ( self::$tables[ $order['table'] ]->include_fields as $field ) {
399
+ $temp[] = "$field REGEXP '$wpg_regexp'";
400
+ }
401
+
402
+ $condition = 'AND ( ' . implode( ' OR ', $temp ) . ' )';
403
+
404
+ }
405
+
406
+ /**
407
+ * Set record ID
408
+ */
409
+ $id = false;
410
+ if ( ! empty( self::$tables[ $order['table'] ]->id_field ) ) {
411
+ $id = self::$tables[ $order['table'] ]->id_field;
412
+ }
413
+
414
+ if ( ! $id ) {
415
+ wp_send_json_error( $order );
416
+ }
417
+
418
+ if ( ! $condition ) {
419
+ wp_send_json_error( $order );
420
+ }
421
+
422
+ $query = "SELECT $id FROM $table WHERE 1=1 $post_status $condition";
423
+
424
+ $ids = $wpdb->get_results( $query, ARRAY_A );
425
+
426
+ $result = true;
427
+
428
+ foreach ( $ids as $data ) {
429
+
430
+ foreach ( $data as $field_id => $record_id ) {
431
+
432
+ /** @noinspection DisconnectedForeachInstructionInspection */
433
+ $ifields = implode( ', ', self::$tables[ $order['table'] ]->include_fields );
434
+
435
+ $query1 = "SELECT $ifields FROM $table WHERE $field_id = '$record_id'";
436
+
437
+ /** @var array $record */
438
+ $record = $wpdb->get_results( $query1 );
439
+
440
+ $update_fields = array();
441
+
442
+ foreach ( self::$tables[ $order['table'] ]->include_fields as $include_field ) {
443
+
444
+ $value = $record[0]->$include_field;
445
+
446
+ $value = trim( $value );
447
+ if ( empty( $value ) ) {
448
+ continue;
449
+ }
450
+
451
+ $serialized = false;
452
+ if ( is_serialized( $value ) ) {
453
+ $serialized = true;
454
+ $value = maybe_unserialize( $value );
455
+ }
456
+
457
+ $converted = self::convert( $value );
458
+
459
+ if ( $_log ) {
460
+ self::_log( $table, $record_id, $value, $converted );
461
+ }
462
+
463
+ if ( $serialized ) {
464
+ $converted = maybe_serialize( $converted );
465
+ }
466
+
467
+ $update_fields[] = $include_field . "='" . $converted . "'";
468
+
469
+ } // endforeach;
470
+
471
+ if ( ! empty( $update_fields ) ) {
472
+ /**
473
+ * UPDATE record
474
+ */
475
+ $updates = implode( ', ', $update_fields );
476
+ $upd_query = "UPDATE `$table` SET $updates WHERE `$field_id` = $record_id";
477
+
478
+ $res = $wpdb->query( $upd_query );
479
+
480
+ if ( false === $res ) {
481
+ $result = false;
482
+ }
483
+
484
+ }
485
+
486
+ } // endforeach
487
+
488
+ } // endforeach
489
+
490
+ if ( false === $result ) {
491
+ wp_send_json_error( $order );
492
+ }
493
+
494
+ wp_send_json_success( $order );
495
+
496
+ }
497
+
498
+ /**
499
+ * Logger
500
+ *
501
+ * @param string $table
502
+ * @param string $id
503
+ * @param string $initial
504
+ * @param string $converted
505
+ */
506
+ public static function _log( $table = '', $id = '', $initial = '', $converted = '' ) {
507
+ error_log( date( DATE_ATOM ) . "\n", 3, self::$log_file );
508
+ error_log( 'TABLE: ' . $table . "\n", 3, self::$log_file );
509
+ error_log( 'ID: ' . $id . "\n", 3, self::$log_file );
510
+ error_log( "BEFORE: \n" . print_r( $initial, true ) . "\n", 3, self::$log_file );
511
+ if ( empty($converted) ) {
512
+ error_log( "AFTER: \n(empty)\n", 3, self::$log_file );
513
+ } else {
514
+ error_log( "AFTER: \n" . print_r( $converted, true ) . "\n", 3, self::$log_file );
515
+ }
516
+ error_log( '=================' . "\n\n", 3, self::$log_file );
517
+ }
518
+
519
+ /**
520
+ * Enqueue js
521
+ *
522
+ * @return void
523
+ */
524
+ public static function action__admin_print_scripts() {
525
+
526
+ $src = WPGlobus::$PLUGIN_DIR_URL . 'includes/js/wpglobus-clean' . WPGlobus::SCRIPT_SUFFIX() . '.js';
527
+
528
+ $result_icons['success'] = WPGlobus::$PLUGIN_DIR_URL . 'includes/css/images/success.png';
529
+ $result_icons['error'] = WPGlobus::$PLUGIN_DIR_URL . 'includes/css/images/error.png';
530
+
531
+ wp_enqueue_script(
532
+ 'wpglobus-clean',
533
+ $src,
534
+ array( 'jquery' ),
535
+ WPGLOBUS_VERSION,
536
+ true
537
+ );
538
+
539
+ wp_localize_script(
540
+ 'wpglobus-clean',
541
+ 'WPGlobusClean',
542
+ array(
543
+ 'version' => WPGLOBUS_VERSION,
544
+ 'icons' => $result_icons,
545
+ 'data' => array_merge( self::$tables, array( 'wpglobus_options' => new stdClass() ) )
546
+ )
547
+ );
548
+
549
+
550
+ }
551
+
552
+ /**
553
+ * Output the clean screen.
554
+ *
555
+ * @return void
556
+ */
557
+ public static function screen() {
558
+
559
+ /**
560
+ * For Google Analytics
561
+ */
562
+ $ga_campaign = '?utm_source=wpglobus-admin-clean&utm_medium=link&utm_campaign=clean-up-tool';
563
+
564
+ $url_wpglobus_site = WPGlobus_Utils::url_wpglobus_site();
565
+ // $url_wpglobus_site_home = $url_wpglobus_site . $ga_campaign;
566
+ $url_wpglobus_site_contact = $url_wpglobus_site . 'pg/contact-us/' . $ga_campaign;
567
+ $url_wpglobus_site_quick_start = $url_wpglobus_site . 'quick-start/' . $ga_campaign;
568
+ // $url_wpglobus_site_faq = $url_wpglobus_site . 'faq/' . $ga_campaign;
569
+ // $url_wpglobus_site_pro_support = $url_wpglobus_site . 'professional-support/' . $ga_campaign;
570
+
571
+ $url_wpglobus_logo = WPGlobus::$PLUGIN_DIR_URL . 'includes/css/images/wpglobus-logo-180x180.png';
572
+
573
+ ?>
574
+ <style>
575
+ .wp-badge.wpglobus-badge {
576
+ background: #ffffff url(<?php echo esc_url( $url_wpglobus_logo ); ?>) no-repeat;
577
+ background-size: contain;
578
+ }
579
+ </style>
580
+ <div class="wrap about-wrap wpglobus-about-wrap clean-wrap wpglobus-clean">
581
+ <h1 class="wpglobus"><span class="wpglobus-wp">WP</span>Globus
582
+ <span class="wpglobus-version"><?php echo esc_html( WPGLOBUS_VERSION ); ?></span>
583
+ </h1>
584
+
585
+ <div class="wpglobus-motto"><?php esc_html_e( 'Multilingual Everything!', 'wpglobus' ); ?></div>
586
+
587
+ <div class="about-text">
588
+ <?php esc_html_e( 'WPGlobus is a family of WordPress plugins assisting you in making multilingual WordPress blogs and sites.', 'wpglobus' ); ?>
589
+ </div>
590
+
591
+ <div class="wp-badge wpglobus-badge"></div>
592
+
593
+ <h2 class="nav-tab-wrapper">
594
+ <a href="#" class="nav-tab nav-tab-active">
595
+ <?php esc_html_e( 'Clean-up Tool', 'wpglobus' ); ?>
596
+ </a>
597
+ <a href="<?php echo esc_url( $url_wpglobus_site_quick_start ); ?>"
598
+ target="_blank"
599
+ class="nav-tab">
600
+ <?php esc_html_e( 'Guide', 'wpglobus' ); ?>
601
+ </a>
602
+ <a href="<?php echo esc_url( WPGlobus_Admin_Page::url_settings() ); ?>" class="nav-tab">
603
+ <?php esc_html_e( 'Settings' ); ?>
604
+ </a>
605
+ <a href="<?php echo esc_url( WPGlobus_Admin_Page::url_addons() ); ?>" class="nav-tab">
606
+ <?php esc_html_e( 'Add-ons', 'wpglobus' ); ?>
607
+ </a>
608
+ <a href="<?php echo esc_url( $url_wpglobus_site_contact ); ?>" class="nav-tab">
609
+ <?php esc_html_e( 'Support', 'wpglobus' ); ?>
610
+ </a>
611
+ </h2>
612
+
613
+ <div style="color: white; background-color: red; padding: .5em; margin-top: 1em;">
614
+ <?php esc_html_e( 'WARNING: this operation is non-reversible. It is strongly recommended that you backup your database before proceeding.', 'wpglobus' ); ?>
615
+ </div>
616
+
617
+ <div style="padding: .5em"><strong>
618
+ <?php esc_html_e( 'This tool should be used only if you plan to completely uninstall WPGlobus. By running it, you will remove ALL translations you have entered to your post, pages, etc., keeping only the MAIN language texts. Please make sure that all entries have some content in the main language. Otherwise, you might end up with empty titles, no content, no excerpts, blank comments and so on.', 'wpglobus' ); ?>
619
+ </strong></div>
620
+
621
+ <div style="color:red; background-color: white; padding: .5em">
622
+ <?php
623
+ echo esc_html( sprintf(
624
+ // translators: %1$s - language name, %1$s - language code. Do not remove.
625
+ __( 'The main language is currently set to %1$s (%2$s). ALL TEXTS THAT ARE NOT IN %1$s WILL BE DELETED! To change the main language, please go to Settings.', 'wpglobus' ),
626
+ WPGlobus::Config()->en_language_name[ WPGlobus::Config()->default_language ],
627
+ WPGlobus::Config()->default_language ) );
628
+
629
+ ?>
630
+ </div>
631
+
632
+ <hr />
633
+ <h3 id="about-to-clean">
634
+ <?php esc_html_e( 'You are about to clean the content of the following database tables:', 'wpglobus' ); ?>
635
+ </h3>
636
+
637
+ <?php echo self::get_table_list(); // WPCS: XSS ok. ?>
638
+
639
+ <hr />
640
+
641
+ <h3>
642
+ <?php esc_html_e( 'The operations log', 'wpglobus' ); ?>
643
+ </h3>
644
+ <div>
645
+ <?php esc_html_e( 'We are going to write a detailed log of all the database changes performed. It should help in the case you need to restore something important. The log will be written to the file:', 'wpglobus' ); ?>
646
+ </div>
647
+ <br />
648
+ <code>
649
+ <?php echo self::$log_file; // WPCS: XSS ok. ?>
650
+ </code>
651
+ <br />
652
+ <br />
653
+ <label>
654
+ <input type="checkbox" name="wpglobus-clean-log" id="wpglobus-clean-log" checked="checked" />
655
+ <?php esc_html_e( 'Uncheck if you do not want to write the operations log (we recommend to keep it checked)', 'wpglobus' ); ?>
656
+
657
+ </label>
658
+ <hr />
659
+ <h3>
660
+ <?php esc_html_e( 'You have been warned...', 'wpglobus' ); ?>
661
+ </h3>
662
+ <?php esc_html_e( 'Please confirm by checking the box below:', 'wpglobus' ); ?>
663
+ <div style="color:red; background-color: white; padding: .5em; margin: 1em 0;">
664
+ <?php esc_html_e( 'I have read and understood everything written on this page. I am aware that by using this tool I may loose some content of my website. I have made a database backup and know how to restore it if necessary. I am fully responsible for the results.', 'wpglobus' ); ?>
665
+ </div>
666
+
667
+ <label><input type="checkbox" name="wpglobus-clean-activate" id="wpglobus-clean-activate" /><?php esc_html_e( 'YES, I CONFIRM', 'wpglobus' ); ?>
668
+ </label>
669
+ <div class="return-to-dashboard">
670
+ <a id="wpglobus-clean-button" class="button button-primary hidden" href="#about-to-clean">
671
+ <?php esc_html_e( 'Process with the Clean-up', 'wpglobus' ); ?>
672
+ </a>
673
+ </div>
674
+
675
+ </div>
676
+
677
+ <?php
678
+ }
679
+
680
+ /**
681
+ * Convert string to text with default language
682
+ *
683
+ * @param mixed $data
684
+ *
685
+ * @return mixed $data
686
+ */
687
+ public static function convert( $data ) {
688
+
689
+ if ( empty( $data ) ) {
690
+ return '';
691
+ }
692
+
693
+ if ( is_null( $data ) ) {
694
+ return $data;
695
+ }
696
+
697
+ if ( is_bool( $data ) ) {
698
+ return $data;
699
+ }
700
+
701
+ if ( is_float( $data ) ) {
702
+ return $data;
703
+ }
704
+
705
+ if ( is_int( $data ) ) {
706
+ return $data;
707
+ }
708
+
709
+ if ( is_string( $data ) ) {
710
+ $data = WPGlobus_Core::text_filter( $data, WPGlobus::Config()->default_language, WPGlobus::RETURN_EMPTY );
711
+
712
+ /**
713
+ * Set double apostrophe for mySQL UPDATE
714
+ */
715
+ return str_replace( "'", "''", $data );
716
+ }
717
+
718
+ foreach ( $data as $key => $value ) {
719
+ if ( is_array( $data ) ) {
720
+ /** @noinspection AlterInForeachInspection */
721
+ $data[ $key ] = self::convert( $value );
722
+ } else if ( is_object( $data ) ) {
723
+ $data->$key = self::convert( $value );
724
+ }
725
+ }
726
+
727
+ return $data;
728
+
729
+ }
730
+
731
+
732
+ } //class
733
+
734
+ endif;
735
+
736
+ # --- EOF
trunk/includes/admin/class-wpglobus-customize-options.php ADDED
@@ -0,0 +1,1571 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WPGlobus_Customize_Options
4
+ *
5
+ * @package WPGlobus\Admin\Customizer
6
+ * @since 1.4.6
7
+ *
8
+ * @see http://www.narga.net/comprehensive-guide-wordpress-theme-options-with-customization-api/
9
+ * @see https://developer.wordpress.org/themes/advanced-topics/customizer-api/#top
10
+ * @see https://codex.wordpress.org/Theme_Customization_API
11
+ * @see #customize-controls
12
+ */
13
+
14
+ /**
15
+ * wpglobus_option
16
+ * wpglobus_option_flags
17
+ * wpglobus_option_locale
18
+ * wpglobus_option_en_language_names
19
+ * wpglobus_option_language_names
20
+ * wpglobus_option_post_meta_settings
21
+ */
22
+
23
+ /**
24
+ * WPGlobus option Customizer setting @see $wp_customize->add_setting
25
+ *
26
+ * wpglobus_option[last_tab] => are not used in customizer
27
+ *
28
+ * wpglobus_option[enabled_languages] => wpglobus_customize_enabled_languages
29
+ *
30
+ * wpglobus_option[more_languages] => are not used in customizer
31
+ *
32
+ * wpglobus_option[show_flag_name] => wpglobus_customize_language_selector_mode
33
+ *
34
+ * wpglobus_option[use_nav_menu] => wpglobus_customize_language_selector_menu
35
+ *
36
+ * wpglobus_option[selector_wp_list_pages]
37
+ * => Array
38
+ * (
39
+ * [show_selector] => 1 => wpglobus_customize_selector_wp_list_pages
40
+ * )
41
+ *
42
+ * wpglobus_option[css_editor] => wpglobus_customize_css_editor
43
+ *
44
+ */
45
+ if ( ! class_exists( 'WPGlobus_Customize_Options' ) ) :
46
+
47
+
48
+ if ( ! class_exists( 'WP_Customize_Control' ) ) {
49
+ require_once( ABSPATH . WPINC . '/class-wp-customize-control.php' );
50
+ }
51
+
52
+ /**
53
+ * Class WPGlobusTextBox.
54
+ * Adds textbox support to the theme customizer.
55
+ *
56
+ * @see wp-includes\class-wp-customize-control.php
57
+ */
58
+ class WPGlobusTextBox extends WP_Customize_Control {
59
+
60
+ public $type = 'textbox';
61
+
62
+ public $content = '';
63
+
64
+ /**
65
+ * Constructor.
66
+ *
67
+ * @param WP_Customize_Manager $manager Customizer bootstrap instance.
68
+ * @param string $id Control ID.
69
+ * @param array $args Optional. Arguments to override class property defaults.
70
+ */
71
+ public function __construct( $manager, $id, $args = array() ) {
72
+ $this->content = empty( $args['content'] ) ? '' : $args['content'];
73
+ $this->statuses = array( '' => esc_html__( 'Default', 'wpglobus' ) );
74
+ parent::__construct( $manager, $id, $args );
75
+ }
76
+
77
+ public function render_content() {
78
+
79
+ echo $this->content;
80
+
81
+ }
82
+
83
+ }
84
+
85
+ /**
86
+ * Adds checkbox with title support to the theme customizer.
87
+ *
88
+ * @see wp-includes\class-wp-customize-control.php
89
+ */
90
+ class WPGlobusCheckBox extends WP_Customize_Control {
91
+
92
+ public $type = 'wpglobus_checkbox';
93
+
94
+ public $title = '';
95
+
96
+ public function __construct( $manager, $id, $args = array() ) {
97
+
98
+ $this->title = empty( $args['title'] ) ? '' : $args['title'];
99
+
100
+ $this->statuses = array( '' => esc_html__( 'Default', 'wpglobus' ) );
101
+
102
+ parent::__construct( $manager, $id, $args );
103
+
104
+ }
105
+
106
+ public function render_content() {
107
+
108
+ ?>
109
+
110
+ <label>
111
+ <?php if ( ! empty( $this->title ) ) : ?>
112
+ <span class="customize-control-title"><?php echo esc_html( $this->title ); ?></span>
113
+ <?php endif; ?>
114
+ <div style="display:flex;">
115
+ <div style="flex:1">
116
+ <input type="checkbox" value="<?php echo esc_attr( $this->value() ); ?>" <?php $this->link(); checked( $this->value() ); ?> />
117
+ </div>
118
+ <div style="flex:8">
119
+ <?php echo esc_html( $this->label ); ?>
120
+ </div>
121
+ </div>
122
+ <?php if ( ! empty( $this->description ) ) : ?>
123
+ <span class="description customize-control-description"><?php echo esc_html($this->description); ?></span>
124
+ <?php endif; ?>
125
+ </label> <?php
126
+
127
+ }
128
+ }
129
+
130
+ /**
131
+ * Adds link support to the theme customizer.
132
+ *
133
+ * @see wp-includes\class-wp-customize-control.php
134
+ */
135
+ class WPGlobusLink extends WP_Customize_Control {
136
+
137
+ public $type = 'wpglobus_link';
138
+
139
+ public $args = array();
140
+
141
+ public function __construct( $manager, $id, $args = array() ) {
142
+
143
+ $this->args = $args;
144
+
145
+ $this->statuses = array( '' => esc_html__( 'Default', 'wpglobus' ) );
146
+
147
+ parent::__construct( $manager, $id, $args );
148
+
149
+ }
150
+
151
+ public function render_content() {
152
+
153
+ ?>
154
+
155
+ <label>
156
+ <?php if ( ! empty( $this->args['title'] ) ) : ?>
157
+ <span class="customize-control-title"><?php echo esc_html( $this->args['title'] ); ?></span>
158
+ <?php endif; ?>
159
+ <a href="<?php echo $this->args['href']; // WPCS: XSS ok. ?>" target="_blank"><?php echo $this->args['text']; // WPCS: XSS ok. ?></a>
160
+ <?php if ( ! empty( $this->description ) ) : ?>
161
+ <span class="description customize-control-description"><?php echo esc_html($this->description); ?></span>
162
+ <?php endif; ?>
163
+ </label> <?php
164
+
165
+ }
166
+ }
167
+
168
+ /**
169
+ * Adds CheckBoxSet support to the theme customizer.
170
+ *
171
+ * @see wp-includes\class-wp-customize-control.php
172
+ */
173
+ class WPGlobusCheckBoxSet extends WP_Customize_Control {
174
+
175
+ public $type = 'checkbox_set';
176
+
177
+ public $skeleton = '';
178
+
179
+ public $args = array();
180
+
181
+ public function __construct( $manager, $id, $args = array() ) {
182
+ $this->args = $args;
183
+ $this->statuses = array( '' => esc_html__( 'Default', 'wpglobus' ) );
184
+
185
+ $this->skeleton =
186
+ '<a href="{{edit-link}}" target="_blank"><span style="cursor:pointer;">Edit</span></a>&nbsp;' .
187
+ '<img style="cursor:move;" {{flag}} />&nbsp;' .
188
+ '<input name="wpglobus_item_{{name}}" id="wpglobus_item_{{id}}" type="checkbox" checked="{{checked}}" ' .
189
+ ' class="{{class}}" ' .
190
+ ' data-order="{{order}}" data-language="{{language}}" disabled="{{disabled}}" />' .
191
+ '<span style="cursor:move;">{{item}}</span>';
192
+
193
+ parent::__construct( $manager, $id, $args );
194
+
195
+ }
196
+
197
+ public function render_content() { ?>
198
+
199
+ <label>
200
+ <?php if ( ! empty( $this->label ) ) : ?>
201
+ <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
202
+ <?php endif;
203
+ if ( ! empty( $this->description ) ) : ?>
204
+ <span class="description customize-control-description"><?php echo esc_html($this->description); ?></span>
205
+ <?php endif;
206
+
207
+ $new_item = str_replace( '{{class}}', 'wpglobus-checkbox ' . $this->args['checkbox_class'], $this->skeleton );
208
+ echo '<div style="display:none;" id="wpglobus-item-skeleton">' . $new_item . '</div>'; // WPCS: XSS ok.
209
+
210
+ echo '<ul id="wpglobus-sortable" style="margin-top:10px;margin-left:20px;">';
211
+
212
+ foreach ( $this->args['items'] as $order => $item ) {
213
+
214
+ $disabled = $order == 0 ? ' disabled="disabled" ' : '';
215
+
216
+ $li_item = str_replace(
217
+ '{{flag}}',
218
+ 'src="' . WPGlobus::Config()->flags_url . WPGlobus::Config()->flag[ $item ] . '"',
219
+ $this->skeleton
220
+ );
221
+ $li_item = str_replace( '{{name}}', $item, $li_item );
222
+ $li_item = str_replace( '{{id}}', $item, $li_item );
223
+ $li_item = str_replace( 'checked="{{checked}}"', 'checked="checked"', $li_item );
224
+ $li_item = str_replace( 'disabled="{{disabled}}"', $disabled, $li_item );
225
+ $li_item = str_replace( '{{class}}', 'wpglobus-checkbox ' . $this->args['checkbox_class'], $li_item );
226
+ $li_item = str_replace( '{{item}}', WPGlobus::Config()->en_language_name[ $item ] . ' (' . $item . ')', $li_item );
227
+ $li_item = str_replace( '{{order}}', $order, $li_item );
228
+ $li_item = str_replace( '{{language}}', $item, $li_item );
229
+ $li_item = str_replace(
230
+ '{{edit-link}}',
231
+ admin_url() . 'admin.php?page=' . WPGlobus::LANGUAGE_EDIT_PAGE . '&action=edit&lang=' . $item . '"', $li_item
232
+ );
233
+
234
+ echo '<li>' . $li_item . '</li>'; // WPCS: XSS ok.
235
+
236
+ }
237
+
238
+ echo '</ul>'; ?>
239
+
240
+ </label> <hr /> <?php
241
+
242
+ }
243
+
244
+ }
245
+
246
+ /**
247
+ * Adds Fields Settings Control support to the theme customizer.
248
+ *
249
+ * @see wp-includes\class-wp-customize-control.php
250
+ */
251
+ class WPGlobusFieldsSettingsControl extends WP_Customize_Control {
252
+
253
+ public $type = 'wpglobus_fields_settings_control';
254
+
255
+ public $args = array();
256
+
257
+ public $section_template = '';
258
+
259
+ public function __construct( $manager, $id, $args = array() ) {
260
+
261
+ $this->args = $args;
262
+
263
+ $this->section_template = "<div id='wpglobus-settings-{{section}}' style='border-bottom:1px solid black;margin-bottom:5px;padding:5px;' class='items-box' data-section='{{section}}'>";
264
+ $this->section_template .= esc_html__( 'Section', 'wpglobus' ) . ": <a href='#' onclick='wp.customize.section({{section_id}}).expand();'><b>{{section_title}}</b></a>";
265
+ $this->section_template .= "<div class='items' style='padding-top:10px;'>{{items}}</div>";
266
+ $this->section_template .= "</div>";
267
+
268
+ parent::__construct( $manager, $id, $args );
269
+
270
+ }
271
+
272
+ public function render_content() {
273
+ ?>
274
+ <div class="wpglobus-fields_settings_control_box" data-section-template="<?php echo $this->section_template; // WPCS: XSS ok. ?>">
275
+ <?php if ( $this->args['start_section'] ) : ?>
276
+ <div style="border-bottom:1px solid black;margin: 0 0 5px;padding-left:5px;">
277
+ <a href="#" onclick="jQuery('.wpglobus-fields_settings_control_box .items-box' ).css('display','block');"><b><?php esc_html_e( 'Show all sections', 'wpglobus' ); ?></b></a>
278
+ </div>
279
+ <input type="submit" style="float:right;" name="<?php echo WPGlobus_Customize_Options::$controls_save_button; // WPCS: XSS ok. ?>" id="<?php echo WPGlobus_Customize_Options::$controls_save_button; // WPCS: XSS ok. ?>" class="button button-primary save" value="<?php esc_html_e( 'Save &amp; Reload', 'wpglobus' ); ?>">
280
+ <?php else: ?>
281
+ <div>
282
+ <?php if ( ! empty( $this->args['message'] ) ) {
283
+ echo $this->args['message']; // WPCS: XSS ok.
284
+ } ?>
285
+ </div>
286
+ <?php endif; ?>
287
+ </div> <!-- .wpglobus-fields_settings_control_box --> <?php
288
+ }
289
+ }
290
+
291
+ /**
292
+ * Class WPGlobus_Customize_Options
293
+ */
294
+ class WPGlobus_Customize_Options {
295
+
296
+ /**
297
+ * Array of sections
298
+ */
299
+ public static $sections = array();
300
+
301
+ /**
302
+ * Array of settings
303
+ */
304
+ public static $settings = array();
305
+
306
+ /**
307
+ * Set transient key
308
+ */
309
+ public static $enabled_post_types_key = 'wpglobus_customize_enabled_post_types';
310
+
311
+ /**
312
+ * Set option key for customizer
313
+ */
314
+ public static $options_key = 'wpglobus_customize_options';
315
+
316
+ /**
317
+ * Save button ID
318
+ */
319
+ public static $controls_save_button = 'wpglobus-user-controls-save';
320
+
321
+ /**
322
+ * Current theme.
323
+ *
324
+ * @var WP_Theme
325
+ */
326
+ public static $theme;
327
+
328
+ /**
329
+ * Current theme name.
330
+ *
331
+ * @var string
332
+ */
333
+ public static $theme_name = '';
334
+
335
+ /**
336
+ * Array of disabled themes.
337
+ * @var string[]
338
+ */
339
+ public static $disabled_themes = array();
340
+
341
+ public static function controller() {
342
+
343
+ self::$theme = wp_get_theme();
344
+ self::$theme_name = self::get_theme( 'name' );
345
+
346
+ self::$disabled_themes = array(
347
+ 'customizr',
348
+ 'customizr pro'
349
+ );
350
+
351
+ /**
352
+ * @since 1.7.7
353
+ * Don't standard loading of the option 'theme_mods_experon'. Theme uses redux.
354
+ * Don't standard behavior in customizer.
355
+ * @see https://wordpress.org/themes/experon/
356
+ */
357
+ self::$disabled_themes[] = 'experon';
358
+
359
+ /**
360
+ * @since 2.3.12
361
+ * Don't standard behavior with links in Appearance section (requires installing an additional module).
362
+ * @see https://gwangi-theme.com/
363
+ */
364
+ self::$disabled_themes[] = 'gwangi';
365
+
366
+ add_action( 'wp_loaded', array( __CLASS__, 'init' ) );
367
+
368
+ /**
369
+ * @see \WP_Customize_Manager::wp_loaded
370
+ * It calls the `customize_register` action first,
371
+ * and then - the `customize_preview_init` action
372
+ */
373
+ add_action( 'customize_register', array(
374
+ 'WPGlobus_Customize_Options',
375
+ 'action__customize_register'
376
+ ) );
377
+
378
+ /**
379
+ * @since 1.6.0
380
+ */
381
+ add_action( 'customize_register', array(
382
+ 'WPGlobus_Customize_Options',
383
+ 'action__customize_fields_settings'
384
+ ) );
385
+
386
+ add_action( 'customize_preview_init', array(
387
+ 'WPGlobus_Customize_Options',
388
+ 'action__customize_preview_init'
389
+ ), 11 );
390
+
391
+ /**
392
+ * This is called by wp-admin/customize.php
393
+ */
394
+
395
+ add_action( 'customize_controls_enqueue_scripts', array(
396
+ 'WPGlobus_Customize_Options',
397
+ 'action__customize_controls_enqueue_scripts'
398
+ ), 1010 );
399
+
400
+ add_action( 'wp_ajax_' . __CLASS__ . '_process_ajax', array(
401
+ 'WPGlobus_Customize_Options',
402
+ 'action__process_ajax'
403
+ ) );
404
+
405
+ /**
406
+ * @since 1.9.8
407
+ */
408
+ add_filter( 'wpglobus_customize_disabled_setting_mask', array(
409
+ __CLASS__,
410
+ 'filter__disabled_setting_mask'
411
+ ) );
412
+
413
+ }
414
+
415
+ /**
416
+ * Delayed processes.
417
+ * @since 1.6.0
418
+ */
419
+ public static function init() {
420
+
421
+ /**
422
+ * Hook to modify the `$disabled_themes` array.
423
+ *
424
+ * @param string[] self ::$disabled_themes
425
+ * Enter the lowercase theme name (not slug, no dashes).
426
+ * For example, to disable the "Parallax One" theme,
427
+ * enter 'parallax one'.
428
+ *
429
+ * @see second param.
430
+ *
431
+ * @param string self::$theme_name Name of current theme.
432
+ * @param WP_Theme Object self::$theme Current theme.
433
+ */
434
+ self::$disabled_themes = apply_filters( 'wpglobus_customizer_disabled_themes', self::$disabled_themes, self::$theme_name, self::$theme );
435
+ }
436
+
437
+ /**
438
+ * Ajax handler.
439
+ */
440
+ public static function action__process_ajax() {
441
+
442
+ $result = true;
443
+ $ajax_return = array();
444
+
445
+ $post_order = isset( $_POST['order'] ) ? $_POST['order'] : null; // WPCS: input var ok, sanitization ok.
446
+
447
+ $order = array();
448
+ if ( $post_order ) {
449
+ $order['action'] = sanitize_text_field( $post_order['action'] );
450
+ $order['options'] = isset($post_order['options']) ? $post_order['options'] : array();
451
+ $order['controls'] = isset($post_order['controls']) ? $post_order['controls'] : array();
452
+ }
453
+
454
+ switch ( $order['action'] ) {
455
+ case 'wpglobus_customize_save':
456
+ /**
457
+ * Options array.
458
+ *
459
+ * @var array
460
+ */
461
+ $options = get_option( WPGlobus::Config()->option );
462
+
463
+ foreach ( $order['options'] as $key => $value ) {
464
+
465
+ switch ( $key ) :
466
+ case 'show_selector':
467
+ $options['selector_wp_list_pages'][ $key ] = $value;
468
+ break;
469
+ case 'redirect_by_language':
470
+ // @todo check this option which do we really need?
471
+ $options['browser_redirect'][ $key ] = $value;
472
+ $options[ $key ] = $value;
473
+ break;
474
+ case 'use_nav_menu':
475
+ if ( '0' == $value ) {
476
+ $value = '';
477
+ } else {
478
+ $value = sanitize_text_field( $value );
479
+ }
480
+ $options[ $key ] = $value;
481
+ break;
482
+ case 'js_editor':
483
+ $value = trim($value);
484
+ if ( ! empty( $value ) ) {
485
+ $value = str_replace( '\"', '"', $value );
486
+ $value = str_replace( "\'", "'", $value );
487
+ $value = esc_html( $value );
488
+ }
489
+ $options[ $key ] = $value;
490
+ break;
491
+ default:
492
+ $options[ $key ] = $value;
493
+ endswitch;
494
+
495
+ }
496
+
497
+ update_option( WPGlobus::Config()->option, $options );
498
+ break;
499
+
500
+ case 'cb-controls-save':
501
+ $options = get_option( self::$options_key );
502
+
503
+ if ( empty( $order['controls'] ) ) {
504
+ if ( ! empty( $options['customize_user_control'][ self::$theme_name ] ) ) {
505
+ unset( $options['customize_user_control'][ self::$theme_name ] );
506
+ }
507
+ } else {
508
+
509
+ $cntrls = array();
510
+ foreach ( $order['controls'] as $cntr => $status ) {
511
+ $cntr = str_replace( '{{', '[', $cntr );
512
+ $cntr = str_replace( '}}', ']', $cntr );
513
+
514
+ $cntrls[ $cntr ] = $status;
515
+ }
516
+
517
+ $options['customize_user_control'][ self::$theme_name ] = $cntrls;
518
+ }
519
+
520
+ if ( empty( $options['customize_user_control'] ) ) {
521
+ unset( $options['customize_user_control'] );
522
+ }
523
+
524
+ if ( empty( $options ) ) {
525
+ delete_option( self::$options_key );
526
+ } else {
527
+ $result = update_option( self::$options_key, $options, false );
528
+
529
+ }
530
+
531
+ break;
532
+ }
533
+
534
+ if ( false === $result ) {
535
+ wp_send_json_error( $ajax_return );
536
+ }
537
+
538
+ wp_send_json_success( $ajax_return );
539
+ }
540
+
541
+ /**
542
+ * Section for message about unsupported theme.
543
+ *
544
+ * @param WP_Customize_Manager $wp_customize
545
+ * @param WP_Theme $theme
546
+ */
547
+ public static function sorry_section( $wp_customize, $theme ) {
548
+
549
+ /**
550
+ * Sorry section
551
+ */
552
+ $wp_customize->add_section( 'wpglobus_sorry_section', array(
553
+ 'title' => esc_html__( 'WPGlobus', 'wpglobus' ),
554
+ 'priority' => 0,
555
+ 'panel' => 'wpglobus_settings_panel'
556
+ ) );
557
+
558
+ $wp_customize->add_setting( 'sorry_message', array(
559
+ 'type' => 'option',
560
+ 'capability' => 'manage_options',
561
+ 'transport' => 'postMessage'
562
+ ) );
563
+ $wp_customize->add_control( new WPGlobusTextBox( $wp_customize,
564
+ 'sorry_message', array(
565
+ 'section' => 'wpglobus_sorry_section',
566
+ 'settings' => 'sorry_message',
567
+ 'priority' => 0,
568
+ 'content' => self::get_content( 'sorry_message', $theme )
569
+
570
+ )
571
+ ) );
572
+
573
+ }
574
+
575
+ /**
576
+ * Callback for register fields settings section.
577
+ *
578
+ * @since 1.6.0
579
+ *
580
+ * @param WP_Customize_Manager $wp_customize
581
+ */
582
+ public static function action__customize_fields_settings( WP_Customize_Manager $wp_customize ) {
583
+
584
+ if ( ! self::is_theme_enabled() ) {
585
+ return;
586
+ }
587
+
588
+ /**
589
+ * SECTION: fields settings
590
+ */
591
+ if ( 1 ) {
592
+
593
+ /**
594
+ * @since WP 4.5
595
+ * @see https://make.wordpress.org/core/2016/03/10/customizer-improvements-in-4-5/
596
+ */
597
+
598
+ global $wp_version;
599
+
600
+ $start_section = true;
601
+ $message = '';
602
+ if ( version_compare( $wp_version, '4.5-RC1', '<' ) ) :
603
+ $start_section = false;
604
+ $message = esc_html__( 'You need to update WordPress to 4.5 or later to get Fields Settings section', 'wpglobus' );
605
+ endif;
606
+
607
+ self::$sections['wpglobus_fields_settings_section'] = 'wpglobus_fields_settings_section';
608
+
609
+ $wp_customize->add_section( self::$sections['wpglobus_fields_settings_section'], array(
610
+ 'title' => esc_html__( 'Fields Settings', 'wpglobus' ),
611
+ 'priority' => 500,
612
+ 'panel' => 'wpglobus_settings_panel',
613
+ 'description' => '<div class="inner" style="background-color:#fff;padding:0 5px;">' .
614
+ self::get_content( 'settings_section_help' ) .
615
+ '</div>'
616
+ ) );
617
+
618
+ /** setting */
619
+ $wp_customize->add_setting( 'wpglobus_fields_settings_setting', array(
620
+ 'type' => 'option',
621
+ 'capability' => 'manage_options',
622
+ 'transport' => 'postMessage'
623
+ ) );
624
+
625
+ /** control */
626
+ $wp_customize->add_control( new WPGlobusFieldsSettingsControl( $wp_customize,
627
+ self::$sections['wpglobus_fields_settings_section'], array(
628
+ 'section' => self::$sections['wpglobus_fields_settings_section'],
629
+ 'settings' => 'wpglobus_fields_settings_setting',
630
+ 'priority' => 0,
631
+ 'start_section' => $start_section,
632
+ 'message' => $message
633
+
634
+ )
635
+ ) );
636
+
637
+ }
638
+
639
+ }
640
+
641
+ /**
642
+ * Callback for customize_register.
643
+ *
644
+ * @param WP_Customize_Manager $wp_customize
645
+ */
646
+ public static function action__customize_register( WP_Customize_Manager $wp_customize ) {
647
+
648
+ /**
649
+ * WPGlobus panel
650
+ */
651
+ $wp_customize->add_panel( 'wpglobus_settings_panel', array(
652
+ 'priority' => 1010,
653
+ 'capability' => 'edit_theme_options',
654
+ 'theme_supports' => '',
655
+ 'title' => esc_html__( 'WPGlobus Settings', 'wpglobus' ),
656
+ 'description' => '<div style="background-color:#eee;padding:10px 5px;">' .
657
+ self::get_content( 'welcome_message' ) .
658
+ '</div>' . self::get_content( 'deactivate_message' ),
659
+ ) );
660
+
661
+ if ( ! self::is_theme_enabled() ) {
662
+
663
+ self::sorry_section( $wp_customize, self::$theme );
664
+
665
+ return;
666
+
667
+ }
668
+
669
+ /**
670
+ * Updating options for customizer accordingly with WPGlobus::Config().
671
+ */
672
+ /** wpglobus_customize_language_selector_mode <=> wpglobus_option[show_flag_name] */
673
+ update_option( 'wpglobus_customize_language_selector_mode', WPGlobus::Config()->show_flag_name );
674
+
675
+ /** */
676
+ if ( empty( WPGlobus::Config()->nav_menu ) ) {
677
+ /**
678
+ * Menu item '--- select navigation menu ---' has value 0.
679
+ * It is used when 'Language Selector Menu' setting is not selected.
680
+ */
681
+ update_option( 'wpglobus_customize_language_selector_menu', '0' );
682
+ } else {
683
+ update_option( 'wpglobus_customize_language_selector_menu', WPGlobus::Config()->nav_menu );
684
+ }
685
+
686
+ /** wpglobus_customize_selector_wp_list_pages <=> wpglobus_option[selector_wp_list_pages][show_selector] */
687
+ update_option( 'wpglobus_customize_selector_wp_list_pages', WPGlobus::Config()->selector_wp_list_pages );
688
+
689
+ /** wpglobus_customize_css_editor <=> wpglobus_option[css_editor] */
690
+ update_option( 'wpglobus_customize_css_editor', WPGlobus::Config()->css_editor );
691
+
692
+ /** wpglobus_customize_redirect_by_language <=> wpglobus_option[browser_redirect][redirect_by_language] */
693
+ if ( empty( WPGlobus::Config()->browser_redirect['redirect_by_language'] ) || (int) WPGlobus::Config()->browser_redirect['redirect_by_language'] == 0 ) {
694
+ update_option( 'wpglobus_customize_redirect_by_language', '' );
695
+ } else {
696
+ update_option( 'wpglobus_customize_redirect_by_language', WPGlobus::Config()->browser_redirect['redirect_by_language'] );
697
+ }
698
+
699
+ /** wpglobus_customize_js_editor <=> wpglobus_option[js_editor] */
700
+ if ( empty( WPGlobus::Config()->js_editor ) ) {
701
+ update_option( 'wpglobus_customize_js_editor', '' );
702
+ } else {
703
+ update_option( 'wpglobus_customize_js_editor', WPGlobus::Config()->js_editor );
704
+ }
705
+
706
+
707
+ /** end updating options */
708
+
709
+ /**
710
+ * Init section priority.
711
+ */
712
+ $section_priority = 0;
713
+
714
+ /**
715
+ * SECTION: Help.
716
+ */
717
+ if ( 0 ) {
718
+
719
+ $section_priority = $section_priority + 0;
720
+
721
+ self::$sections['wpglobus_help_section'] = 'wpglobus_help_section';
722
+ $wp_customize->add_section( self::$sections['wpglobus_help_section'], array(
723
+ 'title' => esc_html__( 'Help', 'wpglobus' ),
724
+ 'priority' => $section_priority,
725
+ 'panel' => 'wpglobus_settings_panel',
726
+ ) );
727
+
728
+ $wp_customize->add_control( 'wpglobus_customize_add_onsZZZ', array(
729
+ 'section' => self::$sections['wpglobus_help_section'],
730
+ 'settings' => array(),
731
+ 'type' => 'button',
732
+ )
733
+ );
734
+ }
735
+ /** end SECTION: Help */
736
+
737
+ /**
738
+ * SECTION: Language.
739
+ */
740
+ if ( 1 ) {
741
+
742
+ $section_priority = $section_priority + 10;
743
+
744
+ $wp_customize->add_section( 'wpglobus_languages_section', array(
745
+ 'title' => esc_html__( 'Languages', 'wpglobus' ),
746
+ 'priority' => $section_priority,
747
+ 'panel' => 'wpglobus_settings_panel'
748
+ ) );
749
+ self::$sections['wpglobus_languages_section'] = 'wpglobus_languages_section';
750
+
751
+ /**
752
+ * Setting: Enabled languages.
753
+ */
754
+ $wp_customize->add_setting( 'wpglobus_customize_enabled_languages', array(
755
+ 'type' => 'option',
756
+ 'capability' => 'manage_options',
757
+ 'transport' => 'postMessage'
758
+ ) );
759
+ $wp_customize->add_control( new WPGlobusCheckBoxSet( $wp_customize,
760
+ 'wpglobus_customize_enabled_languages', array(
761
+ 'section' => 'wpglobus_languages_section',
762
+ 'settings' => 'wpglobus_customize_enabled_languages',
763
+ 'priority' => 0,
764
+ 'items' => WPGlobus::Config()->enabled_languages,
765
+ 'label' => esc_html__( 'Enabled Languages', 'wpglobus' ),
766
+ 'checkbox_class' => 'wpglobus-listen-change wpglobus-language-item',
767
+ 'description' => esc_html__( 'These languages are currently enabled on your site.', 'wpglobus' )
768
+
769
+ )
770
+ ) );
771
+ self::$settings['wpglobus_languages_section']['wpglobus_customize_enabled_languages']['type'] = 'checkbox_set';
772
+ /** @see option wpglobus_option['enabled_languages'] */
773
+ self::$settings['wpglobus_languages_section']['wpglobus_customize_enabled_languages']['option'] = 'enabled_languages';
774
+
775
+ /**
776
+ * Setting: Add languages.
777
+ */
778
+ /** Generate array $more_languages */
779
+ /** @var array $more_languages */
780
+ $more_languages = array();
781
+ $more_languages['select'] = '---- select ----';
782
+
783
+ foreach ( WPGlobus::Config()->flag as $code => $file ) {
784
+ if ( ! in_array( $code, WPGlobus::Config()->enabled_languages ) ) {
785
+ $lang_in_en = '';
786
+ if ( ! empty( WPGlobus::Config()->en_language_name[ $code ] ) ) {
787
+ $lang_in_en = ' (' . WPGlobus::Config()->en_language_name[ $code ] . ')';
788
+ }
789
+ // '<img src="' . WPGlobus::Config()->flags_url . $file . '" />'
790
+ $more_languages[ $code ] = WPGlobus::Config()->language_name[ $code ] . $lang_in_en;
791
+ }
792
+ }
793
+
794
+ $desc_add_languages =
795
+ esc_html__( 'Choose a language you would like to enable.', 'wpglobus' ).
796
+ '<br />'.
797
+ esc_html__( 'Press the [Save & Publish] button to confirm.', 'wpglobus' ).
798
+ '<br />';
799
+ $desc_add_languages .= sprintf(
800
+ // translators: %1$s and %2$s - placeholders to insert HTML link around 'here'
801
+ esc_html__( 'or Add new Language %1$s here %2$s', 'wpglobus' ),
802
+ '<a style="text-decoration:underline;" href="' . admin_url() . 'admin.php?page=' . WPGlobus::LANGUAGE_EDIT_PAGE . '&action=add" target="_blank">',
803
+ '</a>'
804
+ );
805
+
806
+ $wp_customize->add_setting( 'wpglobus_customize_add_language', array(
807
+ 'type' => 'option',
808
+ 'capability' => 'manage_options',
809
+ 'transport' => 'postMessage'
810
+ ) );
811
+ $wp_customize->add_control( 'wpglobus_add_languages_select_box', array(
812
+ 'settings' => 'wpglobus_customize_add_language',
813
+ 'label' => esc_html__( 'Add Languages', 'wpglobus' ),
814
+ 'section' => 'wpglobus_languages_section',
815
+ 'type' => 'select',
816
+ 'priority' => 10,
817
+ 'choices' => $more_languages,
818
+ 'description' => $desc_add_languages
819
+ ) );
820
+ //self::$settings[ 'wpglobus_languages_section' ][ 'wpglobus_customize_add_language' ] = 'select';
821
+
822
+ /**
823
+ * Setting: Language Selector Mode.
824
+ */
825
+ $wp_customize->add_setting( 'wpglobus_customize_language_selector_mode', array(
826
+ 'type' => 'option',
827
+ 'capability' => 'manage_options',
828
+ 'transport' => 'refresh'
829
+ #'transport' => 'postMessage'
830
+ ) );
831
+ $wp_customize->add_control( 'wpglobus_customize_language_selector_mode', array(
832
+ 'settings' => 'wpglobus_customize_language_selector_mode',
833
+ 'label' => esc_html__( 'Language Selector Mode', 'wpglobus' ),
834
+ 'section' => 'wpglobus_languages_section',
835
+ 'type' => 'select',
836
+ 'priority' => 20,
837
+ 'choices' => array(
838
+ 'code' => esc_html__( 'Two-letter Code with flag (en, ru, it, etc.)', 'wpglobus' ),
839
+ 'full_name' => esc_html__( 'Full Name (English, Russian, Italian, etc.)', 'wpglobus' ),
840
+ /* @since 1.2.1 */
841
+ 'name' => esc_html__( 'Full Name with flag (English, Russian, Italian, etc.)', 'wpglobus' ),
842
+ 'empty' => esc_html__( 'Flags only', 'wpglobus' )
843
+ ),
844
+ 'description' => esc_html__( 'Choose the way language name and country flag are shown in the drop-down menu', 'wpglobus' )
845
+ ) );
846
+ self::$settings['wpglobus_languages_section']['wpglobus_customize_language_selector_mode']['type'] = 'select';
847
+ /** @see option wpglobus_option['show_flag_name'] */
848
+ self::$settings['wpglobus_languages_section']['wpglobus_customize_language_selector_mode']['option'] = 'show_flag_name';
849
+
850
+ /**
851
+ * @see https://make.wordpress.org/core/2016/03/22/implementing-selective-refresh-support-for-widgets/
852
+ * @see https://make.wordpress.org/core/2016/03/10/customizer-improvements-in-4-5/
853
+ *
854
+ * $wp_customize->selective_refresh->add_partial( 'wpglobus_customize_language_selector_mode', array(
855
+ * 'selector' => '#site-navigation',
856
+ * 'render_callback' => function() {
857
+ * wp_nav_menu();
858
+ * },
859
+ * ) );
860
+ * // */
861
+
862
+ /**
863
+ * Setting: Language Selector Menu.
864
+ */
865
+ /** @var array $nav_menus */
866
+ $nav_menus = WPGlobus::_get_nav_menus();
867
+
868
+ $menus = array();
869
+
870
+ foreach ( $nav_menus as $menu ) {
871
+ $menus[ $menu->slug ] = $menu->name;
872
+ }
873
+ if ( ! empty( $nav_menus ) && count( $nav_menus ) > 1 ) {
874
+ $menus['all'] = 'All';
875
+ }
876
+ if ( ! empty( $nav_menus ) ) {
877
+ array_unshift(
878
+ $menus,
879
+ '--- ' . esc_html__('select navigation menu', 'wpglobus'). ' ---'
880
+ );
881
+ }
882
+
883
+ if ( empty( $menus ) ) {
884
+
885
+ $wp_customize->add_control( new WPGlobusLink( $wp_customize,
886
+ 'wpglobus_customize_language_selector_menu', array(
887
+ 'section' => 'wpglobus_languages_section',
888
+ 'title' => esc_html__( 'Language Selector Menu', 'wpglobus' ),
889
+ 'settings' => array(),
890
+ 'priority' => 30,
891
+ 'type' => 'wpglobus_link',
892
+ /**
893
+ * We are in Customizer, so we can "focus" to the menus and not go to menus in admin.
894
+ * The JS code and the message below are copied from
895
+ * @see WP_Nav_Menu_Widget::form
896
+ */
897
+ 'href' => esc_attr( 'javascript: wp.customize.panel( "nav_menus" ).focus();' ),
898
+ 'text' => esc_html__( 'No menus have been created yet. Create some.', 'wpglobus' ),
899
+ 'description' => esc_html__( 'Choose the navigation menu where the language selector will be shown', 'wpglobus' ),
900
+ )
901
+ ) );
902
+
903
+ self::$settings['wpglobus_languages_section']['wpglobus_customize_language_selector_menu']['type'] = 'wpglobus_link';
904
+ self::$settings['wpglobus_languages_section']['wpglobus_customize_language_selector_menu']['option'] = array();
905
+
906
+ } else {
907
+
908
+ $wp_customize->add_setting( 'wpglobus_customize_language_selector_menu', array(
909
+ 'type' => 'option',
910
+ 'capability' => 'manage_options',
911
+ 'transport' => 'postMessage'
912
+ ) );
913
+ $wp_customize->add_control( 'wpglobus_customize_language_selector_menu', array(
914
+ 'settings' => 'wpglobus_customize_language_selector_menu',
915
+ 'label' => esc_html__( 'Language Selector Menu', 'wpglobus' ),
916
+ 'section' => 'wpglobus_languages_section',
917
+ 'type' => 'select',
918
+ 'priority' => 30,
919
+ 'choices' => $menus,
920
+ 'description' => esc_html__( 'Choose the navigation menu where the language selector will be shown', 'wpglobus' ),
921
+ ) );
922
+
923
+ self::$settings['wpglobus_languages_section']['wpglobus_customize_language_selector_menu']['type'] = 'select';
924
+ /** @see option wpglobus_option['use_nav_menu'] */
925
+ self::$settings['wpglobus_languages_section']['wpglobus_customize_language_selector_menu']['option'] = 'use_nav_menu';
926
+
927
+ }
928
+
929
+ /**
930
+ * Setting: "All Pages" menus Language selector.
931
+ */
932
+ $wp_customize->add_setting( 'wpglobus_customize_selector_wp_list_pages', array(
933
+ 'type' => 'option',
934
+ 'capability' => 'manage_options',
935
+ 'transport' => 'postMessage'
936
+ ) );
937
+ $wp_customize->add_control( new WPGlobusCheckBox( $wp_customize,
938
+ 'wpglobus_customize_selector_wp_list_pages', array(
939
+ 'settings' => 'wpglobus_customize_selector_wp_list_pages',
940
+ 'title' => esc_html__( '"All Pages" menus Language selector', 'wpglobus' ),
941
+ 'section' => 'wpglobus_languages_section',
942
+ 'priority' => 40,
943
+ 'label' => esc_html__( 'Adds language selector to the menus that automatically list all existing pages (using `wp_list_pages`)', 'wpglobus' ),
944
+ )
945
+ ) );
946
+ self::$settings['wpglobus_languages_section']['wpglobus_customize_selector_wp_list_pages']['type'] = 'wpglobus_checkbox';
947
+ /** @see option wpglobus_option['selector_wp_list_pages']['show_selector'] */
948
+ self::$settings['wpglobus_languages_section']['wpglobus_customize_selector_wp_list_pages']['option'] = 'show_selector';
949
+
950
+ /**
951
+ * Setting: Custom CSS.
952
+ */
953
+ $wp_customize->add_setting( 'wpglobus_customize_css_editor', array(
954
+ 'type' => 'option',
955
+ 'capability' => 'manage_options',
956
+ 'transport' => 'postMessage'
957
+ ) );
958
+ $wp_customize->add_control( 'wpglobus_customize_css_editor', array(
959
+ 'settings' => 'wpglobus_customize_css_editor',
960
+ 'label' => esc_html__( 'Custom CSS', 'wpglobus' ),
961
+ 'section' => 'wpglobus_languages_section',
962
+ 'type' => 'textarea',
963
+ 'priority' => 50,
964
+ 'description' => esc_html__( 'Here you can enter the CSS rules to adjust the language selector menu for your theme. Look at the examples in the `style-samples.css` file.', 'wpglobus' ),
965
+ ) );
966
+ self::$settings['wpglobus_languages_section']['wpglobus_customize_css_editor']['type'] = 'textarea';
967
+ /** @see option wpglobus_option['css_editor'] */
968
+ self::$settings['wpglobus_languages_section']['wpglobus_customize_css_editor']['option'] = 'css_editor';
969
+
970
+ }
971
+ /** end SECTION: Language */
972
+
973
+ /**
974
+ * SECTION: Post types.
975
+ */
976
+ if ( 1 ) {
977
+
978
+ $section_priority = $section_priority + 10;
979
+
980
+ $section = 'wpglobus_post_types_section';
981
+
982
+ $wp_customize->add_section( $section, array(
983
+ 'title' => esc_html__( 'Post types', 'wpglobus' ),
984
+ 'priority' => $section_priority,
985
+ 'panel' => 'wpglobus_settings_panel'
986
+ ) );
987
+ self::$sections[ $section ] = $section;
988
+
989
+ if ( false === ( $enabled_post_types = get_transient( self::$enabled_post_types_key ) ) ) {
990
+
991
+ $post_types = get_post_types();
992
+
993
+ $enabled_post_types = array();
994
+
995
+ foreach ( $post_types as $post_type ) {
996
+ /**
997
+ * @see "SECTION: Post types" in includes\options\class-wpglobus-options.php for complete post type array.
998
+ */
999
+ if ( ! in_array( $post_type, WPGlobus_Post_Types::hidden_types(), true ) ) {
1000
+
1001
+ /**
1002
+ * Obsolete from 1.9.10.
1003
+ * @todo Remove after testing.
1004
+ */
1005
+ /**
1006
+
1007
+ if ( in_array( $post_type, array( 'post', 'page' ) ) ) {
1008
+ $enabled_post_types[ $post_type ] = $post_type;
1009
+ continue;
1010
+ }
1011
+
1012
+ foreach ( WPGlobus::O()->vendors_scripts as $script => $status ) {
1013
+
1014
+ if ( empty( $status ) ) {
1015
+ continue;
1016
+ }
1017
+
1018
+ if ( $script == 'ACF' || $script == 'ACFPRO' ) {
1019
+ if ( in_array( $post_type, array( 'acf-field-group', 'acf-field', 'acf' ) ) ) {
1020
+ continue 2;
1021
+ }
1022
+ }
1023
+
1024
+ if ( $script == 'WOOCOMMERCE' ) {
1025
+ if ( in_array(
1026
+ $post_type,
1027
+ array(
1028
+ 'product',
1029
+ 'product_tag',
1030
+ 'product_cat',
1031
+ 'shop_order',
1032
+ 'shop_coupon',
1033
+ 'product_variation',
1034
+ 'shop_order_refund',
1035
+ 'shop_webhook'
1036
+ )
1037
+ ) ) {
1038
+ continue 2;
1039
+ }
1040
+ }
1041
+
1042
+ if ( $script == 'WPCF7' ) {
1043
+ if ( in_array( $post_type, array( 'wpcf7_contact_form' ) ) ) {
1044
+ continue 2;
1045
+ }
1046
+ }
1047
+
1048
+ }
1049
+ // */
1050
+
1051
+ $enabled_post_types[ $post_type ] = $post_type;
1052
+
1053
+ }
1054
+ }
1055
+
1056
+ set_transient( self::$enabled_post_types_key, $enabled_post_types, 60 );
1057
+
1058
+ }
1059
+
1060
+ foreach ( $enabled_post_types as $post_type ) :
1061
+
1062
+ $status = '';
1063
+
1064
+ if ( isset( WPGlobus::Config()->extended_options['post_type'][ $post_type ] ) ) {
1065
+
1066
+ if ( WPGlobus::Config()->extended_options['post_type'][ $post_type ] == 1 ) {
1067
+ $status = '1';
1068
+ }
1069
+
1070
+ } else {
1071
+ $status = '1';
1072
+ }
1073
+
1074
+ update_option( 'wpglobus_customize_post_type_' . $post_type, $status );
1075
+
1076
+ endforeach;
1077
+
1078
+ $i = 0;
1079
+ foreach ( $enabled_post_types as $post_type ) :
1080
+
1081
+ $pst = 'wpglobus_customize_post_type_' . $post_type;
1082
+
1083
+ $wp_customize->add_setting( $pst, array(
1084
+ 'type' => 'option',
1085
+ 'capability' => 'manage_options',
1086
+ 'transport' => 'postMessage'
1087
+ ) );
1088
+
1089
+ $title = '';
1090
+ if ( $i == 0 ) {
1091
+ $title = esc_html__( 'Uncheck to disable WPGlobus', 'wpglobus' );
1092
+ }
1093
+
1094
+ $wp_customize->add_control( new WPGlobusCheckBox( $wp_customize,
1095
+ $pst, array(
1096
+ 'settings' => $pst,
1097
+ 'title' => $title,
1098
+ 'label' => $post_type,
1099
+ 'section' => $section,
1100
+ #'default' => '1',
1101
+ 'priority' => 10,
1102
+ )
1103
+ ) );
1104
+
1105
+ $i ++;
1106
+ self::$settings[ $section ][ $pst ]['type'] = 'wpglobus_checkbox';
1107
+ /** @see option wpglobus_option['post_type'] */
1108
+ self::$settings[ $section ][ $pst ]['option'] = 'post_type';
1109
+
1110
+ endforeach;
1111
+
1112
+ };
1113
+ /** end SECTION: Post types */
1114
+
1115
+ /**
1116
+ * SECTION: Redirect.
1117
+ */
1118
+ if ( 1 ) {
1119
+
1120
+ $section_priority = $section_priority + 10;
1121
+
1122
+ self::$sections['wpglobus_redirect_section'] = 'wpglobus_redirect_section';
1123
+
1124
+ $wp_customize->add_section( self::$sections['wpglobus_redirect_section'], array(
1125
+ 'title' => esc_html__( 'Redirect', 'wpglobus' ),
1126
+ 'priority' => $section_priority,
1127
+ 'panel' => 'wpglobus_settings_panel',
1128
+ ) );
1129
+
1130
+ /**
1131
+ * Option
1132
+ * [browser_redirect] => Array
1133
+ * (
1134
+ * [redirect_by_language] => 0
1135
+ * )
1136
+ */
1137
+
1138
+ /**
1139
+ * Setting wpglobus_customize_redirect_by_language.
1140
+ */
1141
+ $wp_customize->add_setting( 'wpglobus_customize_redirect_by_language', array(
1142
+ 'type' => 'option',
1143
+ 'capability' => 'manage_options',
1144
+ 'transport' => 'postMessage'
1145
+ ) );
1146
+ $wp_customize->add_control( new WPGlobusCheckBox( $wp_customize,
1147
+ 'wpglobus_customize_redirect_by_language', array(
1148
+ 'section' => self::$sections['wpglobus_redirect_section'],
1149
+ 'settings' => 'wpglobus_customize_redirect_by_language',
1150
+ 'title' => esc_html__( 'Choose the language automatically, based on:', 'wpglobus' ),
1151
+ 'priority' => 10,
1152
+ 'label' => esc_html__( 'Preferred language set in the browser', 'wpglobus' ),
1153
+ 'description' => esc_html__('When a user comes to the site for the first time, try to find the best matching language version of the page.', 'wpglobus')
1154
+ )
1155
+ ) );
1156
+
1157
+ self::$settings[ self::$sections['wpglobus_redirect_section'] ]['wpglobus_customize_redirect_by_language']['type'] = 'wpglobus_checkbox';
1158
+ /** @see option wpglobus_option[browser_redirect][redirect_by_language] */
1159
+ self::$settings[ self::$sections['wpglobus_redirect_section'] ]['wpglobus_customize_redirect_by_language']['option'] = 'redirect_by_language';
1160
+
1161
+ }
1162
+ /** end SECTION: Redirect */
1163
+
1164
+ /**
1165
+ * SECTION: Custom JS Code.
1166
+ */
1167
+ if ( 1 ) {
1168
+
1169
+ $section_priority = $section_priority + 10;
1170
+
1171
+ self::$sections['wpglobus_js_editor_section'] = 'wpglobus_js_editor_section';
1172
+
1173
+ /**
1174
+ * Setting 'wpglobus_customize_js_editor'.
1175
+ */
1176
+
1177
+ /**
1178
+ * class WP_Customize_Code_Editor_Control
1179
+ * @since WordPress 4.9.0
1180
+ * @see https://developer.wordpress.org/reference/classes/wp_customize_code_editor_control/
1181
+ */
1182
+ if ( ! class_exists('WP_Customize_Code_Editor_Control') ) {
1183
+
1184
+ $content = esc_html__( 'To add a Custom JS Code in Customizer, you need to upgrade WordPress to version 4.9 or later.', 'wpglobus' );
1185
+ $content .= '<br /><br />' .
1186
+ esc_html__( 'With your version of WordPress, please use the', 'wpglobus' ) .
1187
+ ' <a style="text-decoration:underline;" target="_blank" href="' . esc_url( admin_url() . 'admin.php?page=' . WPGlobus::OPTIONS_PAGE_SLUG . '&tab=0' ) . '">' .
1188
+ esc_html__( 'WPGlobus Settings page', 'wpglobus' ) .
1189
+ '.</a>';
1190
+
1191
+ $wp_customize->add_section( self::$sections['wpglobus_js_editor_section'], array(
1192
+ 'title' => esc_html__( 'Custom JS Code', 'wpglobus' ),
1193
+ 'priority' => $section_priority,
1194
+ 'panel' => 'wpglobus_settings_panel',
1195
+ ) );
1196
+
1197
+ $wp_customize->add_setting( 'wpglobus_customize_js_editor', array(
1198
+ 'type' => 'option',
1199
+ 'capability' => 'manage_options',
1200
+ 'transport' => 'postMessage'
1201
+ ) );
1202
+
1203
+ $wp_customize->add_control( new WPGlobusTextBox( $wp_customize,
1204
+ 'wpglobus_customize_js_editor', array(
1205
+ 'section' => self::$sections['wpglobus_js_editor_section'],
1206
+ 'settings' => 'wpglobus_customize_js_editor',
1207
+ 'content' => $content
1208
+ )
1209
+ ) );
1210
+
1211
+ } else {
1212
+
1213
+ $wp_customize->add_section( self::$sections['wpglobus_js_editor_section'], array(
1214
+ 'title' => esc_html__( 'Custom JS Code', 'wpglobus' ),
1215
+ 'priority' => $section_priority,
1216
+ 'panel' => 'wpglobus_settings_panel',
1217
+ ) );
1218
+
1219
+
1220
+ $wp_customize->add_setting( 'wpglobus_customize_js_editor', array(
1221
+ 'type' => 'option',
1222
+ 'capability' => 'manage_options',
1223
+ 'transport' => 'postMessage'
1224
+ ) );
1225
+ $wp_customize->add_control( new WP_Customize_Code_Editor_Control( $wp_customize,
1226
+ 'wpglobus_customize_js_editor', array(
1227
+ 'code_type' => 'javascript',
1228
+ #'mode' => 'javascript',
1229
+ 'input_attrs' => array('rows'=>80),
1230
+ 'section' => self::$sections['wpglobus_js_editor_section'],
1231
+ 'settings' => 'wpglobus_customize_js_editor',
1232
+ 'title' => esc_html__( 'Title', 'wpglobus' ),
1233
+ 'priority' => 10,
1234
+ 'label' => esc_html__( 'Custom JS Code', 'wpglobus' ),
1235
+ 'description' => esc_html__( '(Paste your JS code here.)', 'wpglobus' )
1236
+ )
1237
+ ) );
1238
+
1239
+ self::$settings[ self::$sections['wpglobus_js_editor_section'] ]['wpglobus_customize_js_editor']['type'] = 'code_editor';
1240
+ /** @see option wpglobus_option['css_editor'] */
1241
+ self::$settings[ self::$sections['wpglobus_js_editor_section'] ]['wpglobus_customize_js_editor']['option'] = 'js_editor';
1242
+
1243
+ }
1244
+ }
1245
+ /** end SECTION: Custom JS Code */
1246
+
1247
+ /**
1248
+ * SECTION: Add ons.
1249
+ */
1250
+ if ( 1 ) {
1251
+
1252
+ $section_priority = $section_priority + 10;
1253
+
1254
+ global $wp_version;
1255
+
1256
+ self::$sections['wpglobus_addons_section'] = 'wpglobus_addons_section';
1257
+
1258
+ if ( version_compare( $wp_version, '4.5-RC1', '<' ) ) {
1259
+
1260
+ $wp_customize->add_section( self::$sections['wpglobus_addons_section'], array(
1261
+ 'title' => esc_html__( 'Add-ons', 'wpglobus' ),
1262
+ 'priority' => $section_priority,
1263
+ 'panel' => 'wpglobus_settings_panel',
1264
+ ) );
1265
+
1266
+ /** Add ons setting */
1267
+ $wp_customize->add_setting( 'wpglobus_customize_add_ons', array(
1268
+ 'type' => 'option',
1269
+ 'capability' => 'manage_options',
1270
+ 'transport' => 'postMessage',
1271
+ ) );
1272
+
1273
+ $wp_customize->add_control( new WPGlobusCheckBox( $wp_customize,
1274
+ 'wpglobus_customize_add_ons', array(
1275
+ 'settings' => 'wpglobus_customize_add_ons',
1276
+ 'title' => esc_html__( 'Title', 'wpglobus' ),
1277
+ 'label' => esc_html__( 'Label', 'wpglobus' ),
1278
+ 'section' => self::$sections['wpglobus_addons_section'],
1279
+ 'type' => 'checkbox',
1280
+ 'priority' => 10,
1281
+ 'description' => esc_html__( 'Description', 'wpglobus' ),
1282
+ )
1283
+ ) );
1284
+
1285
+ } else {
1286
+
1287
+ /**
1288
+ * Changes in WP 4.5
1289
+ * @link https://make.wordpress.org/core/2016/03/10/customizer-improvements-in-4-5/
1290
+ */
1291
+
1292
+ $wp_customize->add_section( self::$sections['wpglobus_addons_section'], array(
1293
+ 'title' => esc_html__( 'Add-ons', 'wpglobus' ),
1294
+ 'priority' => $section_priority,
1295
+ 'panel' => 'wpglobus_settings_panel',
1296
+ ) );
1297
+
1298
+ $wp_customize->add_control( 'wpglobus_customize_add_ons', array(
1299
+ 'section' => self::$sections['wpglobus_addons_section'],
1300
+ 'settings' => array(),
1301
+ 'type' => 'button',
1302
+ )
1303
+ );
1304
+ }
1305
+ }
1306
+ /** end SECTION: Add ons */
1307
+
1308
+ /**
1309
+ * Fires to add customize settings.
1310
+ *
1311
+ * @since 1.4.6
1312
+ *
1313
+ * @param WP_Customize_Manager $wp_customize The WP Customize Manager.
1314
+ */
1315
+ do_action( 'wpglobus_customize_register', $wp_customize );
1316
+
1317
+ /** @var array $res */
1318
+ $res = apply_filters( 'wpglobus_customize_data', array(
1319
+ 'sections' => self::$sections,
1320
+ 'settings' => self::$settings,
1321
+ ) );
1322
+
1323
+ self::$sections = $res['sections'];
1324
+ self::$settings = $res['settings'];
1325
+
1326
+ }
1327
+
1328
+ /**
1329
+ * Get content for WPGlobusTextBox element.
1330
+ *
1331
+ * @param string $control
1332
+ * @param mixed $attrs
1333
+ *
1334
+ * @return string
1335
+ */
1336
+ public static function get_content( $control = '', $attrs = null ) {
1337
+
1338
+ if ( '' == $control ) {
1339
+ return '';
1340
+ }
1341
+
1342
+ $content = '';
1343
+ switch ( $control ) :
1344
+ case 'settings_section_help' :
1345
+ $content = esc_html__( 'Here you can specify which fields should be considered multilingual by WPGlobus. To exclude a field, uncheck it and then press the button below.', 'wpglobus' );
1346
+
1347
+ break;
1348
+ case 'welcome_message' :
1349
+
1350
+ $content = '<div style="width:100%;">' .
1351
+ esc_html__( 'Thank you for installing WPGlobus!', 'wpglobus' ) .
1352
+ '<br/>' .
1353
+ '&bull; ' .
1354
+ '<a style="text-decoration:underline;" target="_blank" href="' . admin_url() . 'admin.php?page=' . WPGlobus::PAGE_WPGLOBUS_ABOUT . '">' .
1355
+ esc_html__( 'Read About WPGlobus', 'wpglobus' ) .
1356
+ '</a>' .
1357
+ '<br/>' .
1358
+ '&bull; ' . esc_html__( 'Click the <strong>[Languages]</strong> tab at the left to setup the options.', 'wpglobus' ) .
1359
+ #'<br/>' .
1360
+ #'&bull; ' . esc_html__( 'Use the <strong>[Languages Table]</strong> section to add a new language or to edit the language attributes: name, code, flag icon, etc.', 'wpglobus' ) .
1361
+ '<br/>' .
1362
+ '<br/>' .
1363
+ esc_html__( 'Should you have any questions or comments, please do not hesitate to contact us.', 'wpglobus' ) .
1364
+ '<br/>' .
1365
+ '<br/>' .
1366
+ '<em>' .
1367
+ esc_html__( 'Sincerely Yours,', 'wpglobus' ) .
1368
+ '<br/>' .
1369
+ esc_html__( 'The WPGlobus Team', 'wpglobus' ) .
1370
+ '</em>' .
1371
+ '</div>';
1372
+
1373
+ break;
1374
+ case 'deactivate_message' :
1375
+
1376
+ /**
1377
+ * For Google Analytics
1378
+ */
1379
+ $ga_campaign = '?utm_source=wpglobus-admin-clean&utm_medium=link&utm_campaign=talk-to-us';
1380
+
1381
+ $url_wpglobus_site = WPGlobus_Utils::url_wpglobus_site();
1382
+ $url_wpglobus_site_submit_ticket = $url_wpglobus_site . 'support/submit-ticket/' . $ga_campaign;
1383
+
1384
+ $content = '<p><em>' .
1385
+ sprintf(
1386
+ esc_html(
1387
+ // translators: %?$s: HTML codes for hyperlink. Do not remove.
1388
+ __( 'We would hate to see you go. If something goes wrong, do not uninstall WPGlobus yet. Please %1$stalk to us%2$s and let us help!', 'wpglobus' ) ),
1389
+ '<a href="' . $url_wpglobus_site_submit_ticket . '" target="_blank" style="text-decoration:underline;">',
1390
+ '</a>'
1391
+ ) .
1392
+ '</em></p>' .
1393
+ '<hr/>' .
1394
+ '<p><i class="el el-exclamation-sign" style="color:red"></i> <strong>' .
1395
+ esc_html( __( 'Please note that if you deactivate WPGlobus, your site will show all the languages together, mixed up. You will need to remove all translations, keeping only one language.', 'wpglobus' ) ) .
1396
+ '</strong></p>' .
1397
+ '<p>' .
1398
+ sprintf(
1399
+ // translators: %s: link to the Clean-up Tool
1400
+ esc_html__( 'If there are just a few places, you should edit them manually. To automatically remove all translations at once, you can use the %s. WARNING: The clean-up operation is irreversible, so use it only if you need to completely uninstall WPGlobus.', 'wpglobus' ),
1401
+ sprintf(
1402
+ // translators: %?$s: HTML codes for hyperlink. Do not remove.
1403
+ esc_html__( '%1$sClean-up Tool%2$s', 'wpglobus' ),
1404
+ '<a style="text-decoration:underline;" target="_blank" href="' . admin_url() . 'admin.php?page=' . WPGlobus::PAGE_WPGLOBUS_CLEAN . '">',
1405
+ '</a>'
1406
+ ) ) .
1407
+ '</p>';
1408
+
1409
+ break;
1410
+ case 'sorry_message' :
1411
+
1412
+ $content = '<p><strong>' .
1413
+ sprintf(
1414
+ // translators: %s: name of current theme
1415
+ esc_html__( 'Sorry, WPGlobus customizer doesn\'t support current theme %s.', 'wpglobus' ),
1416
+ '<em>' . $attrs->__get( 'name' ) . '</em>'
1417
+ ) .
1418
+ '<br />' .
1419
+ sprintf(
1420
+ // translators: %?$s: HTML codes for hyperlink. Do not remove.
1421
+ esc_html__( 'Please use %1$sWPGlobus options page%2$s instead.', 'wpglobus' ),
1422
+ '<a style="text-decoration:underline;" target="_blank" href="' . admin_url() . 'admin.php?page=' . WPGlobus::OPTIONS_PAGE_SLUG . '&tab=0">',
1423
+ '</a>'
1424
+ ) .
1425
+ '</strong></p>';
1426
+
1427
+ break;
1428
+ endswitch;
1429
+
1430
+ return $content;
1431
+
1432
+ }
1433
+
1434
+ /**
1435
+ * Load Customize Preview JS.
1436
+ *
1437
+ * Used by hook: 'customize_preview_init'
1438
+ * @see 'customize_preview_init'
1439
+ */
1440
+ public static function action__customize_preview_init() {
1441
+
1442
+ /*
1443
+ wp_enqueue_script(
1444
+ 'wpglobus-customize-options-preview',
1445
+ WPGlobus::$PLUGIN_DIR_URL . 'includes/js/wpglobus-customize-options-preview' .
1446
+ WPGlobus::SCRIPT_SUFFIX() . '.js',
1447
+ array( 'jquery' ),
1448
+ WPGLOBUS_VERSION,
1449
+ true
1450
+ );
1451
+ // */
1452
+ /*
1453
+ wp_localize_script(
1454
+ 'wpglobus-customize-options-preview',
1455
+ 'WPGlobusCustomize',
1456
+ array(
1457
+ 'version' => WPGLOBUS_VERSION,
1458
+ #'blogname' => WPGlobus_Core::text_filter( get_option( 'blogname' ), WPGlobus::Config()->language ),
1459
+ #'blogdescription' => WPGlobus_Core::text_filter( get_option( 'blogdescription' ), WPGlobus::Config()->language )
1460
+ )
1461
+ ); // */
1462
+
1463
+ }
1464
+
1465
+ /**
1466
+ * Load Customize Control JS.
1467
+ */
1468
+ public static function action__customize_controls_enqueue_scripts() {
1469
+
1470
+ /**
1471
+ * Get customize_user_control options which there are specifically for every theme.
1472
+ */
1473
+ $options = get_option( self::$options_key );
1474
+ if ( $options == '' ) {
1475
+ $options = null;
1476
+ } else {
1477
+ if ( empty( $options['customize_user_control'] ) ) {
1478
+ $options = null;
1479
+ } else {
1480
+ $options = $options['customize_user_control'];
1481
+ }
1482
+ }
1483
+
1484
+ $i18n = array();
1485
+ $i18n['expandShrink'] = esc_html__('Expand/Shrink', 'wpglobus');
1486
+
1487
+ wp_register_script(
1488
+ 'wpglobus-customize-options',
1489
+ WPGlobus::$PLUGIN_DIR_URL . 'includes/js/wpglobus-customize-options' . WPGlobus::SCRIPT_SUFFIX() . '.js',
1490
+ array( 'jquery', 'jquery-ui-draggable' ),
1491
+ WPGLOBUS_VERSION,
1492
+ true
1493
+ );
1494
+ wp_enqueue_script( 'wpglobus-customize-options' );
1495
+ wp_localize_script(
1496
+ 'wpglobus-customize-options',
1497
+ 'WPGlobusCustomizeOptions',
1498
+ array(
1499
+ 'version' => WPGLOBUS_VERSION,
1500
+ 'i18n' => $i18n,
1501
+ 'config' => WPGlobus::Config(),
1502
+ 'ajaxurl' => admin_url( 'admin-ajax.php' ),
1503
+ 'process_ajax' => __CLASS__ . '_process_ajax',
1504
+ 'editLink' => admin_url() . 'admin.php?page=' . WPGlobus::LANGUAGE_EDIT_PAGE . '&action=edit&lang={{language}}"',
1505
+ 'settings' => self::$settings,
1506
+ 'sections' => self::$sections,
1507
+ 'addonsPage' => admin_url() . 'plugin-install.php?tab=search&s=WPGlobus&source=WPGlobus',
1508
+ 'themeName' => self::$theme_name,
1509
+ 'themeEnabled' => self::is_theme_enabled() ? 'true' : 'false',
1510
+ 'helpButton' => '<span style="float:right;cursor:pointer;" class="wpglobus-customize-icon-help customize-help-toggle dashicons dashicons-editor-help" tabindex="0" aria-expanded="false"></span>',
1511
+ 'userControl' => $options,
1512
+ 'userControlSaveButton' => self::$controls_save_button,
1513
+ 'userControlIcon' => WPGlobus::$PLUGIN_DIR_URL . 'includes/css/images/checkbox-icon.png',
1514
+ 'userControlIconClass' => 'wpglobus-customize-user-control-icon',
1515
+ 'userControlBoxSelector' => '.wpglobus-fields_settings_control_box .items-box'
1516
+ # @see WPGlobusFieldsSettingsControl class
1517
+ )
1518
+ );
1519
+
1520
+ }
1521
+
1522
+ /**
1523
+ * Get current theme or its property.
1524
+ *
1525
+ * @since 1.6.0
1526
+ *
1527
+ * @param string $param
1528
+ *
1529
+ * @return string|WP_Theme
1530
+ */
1531
+ public static function get_theme( $param = '' ) {
1532
+
1533
+ if ( 'name' === $param ) {
1534
+ return strtolower( self::$theme->name );
1535
+ }
1536
+
1537
+ return self::$theme;
1538
+
1539
+ }
1540
+
1541
+ /**
1542
+ * Check for enabled theme.
1543
+ *
1544
+ * @since 1.6.0
1545
+ * @return boolean
1546
+ */
1547
+ public static function is_theme_enabled() {
1548
+
1549
+ if ( in_array( self::$theme_name, self::$disabled_themes ) ) {
1550
+ return false;
1551
+ }
1552
+
1553
+ return true;
1554
+ }
1555
+
1556
+
1557
+ /**
1558
+ * Filter to disable the making multilingual our own settings.
1559
+ *
1560
+ * @since 1.9.8
1561
+ * @return array
1562
+ */
1563
+ public static function filter__disabled_setting_mask($disabled_setting_mask) {
1564
+ $disabled_setting_mask[] = 'wpglobus_customize_js_editor';
1565
+ return $disabled_setting_mask;
1566
+ }
1567
+
1568
+ } // class
1569
+
1570
+ endif;
1571
+ # --- EOF
trunk/includes/admin/class-wpglobus-dashboard-news.php ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class WPGlobus_Dashboard_News
5
+ * @since 1.7.7
6
+ */
7
+ class WPGlobus_Dashboard_News {
8
+
9
+ /**
10
+ * WPGlobus_Dashboard_News constructor.
11
+ */
12
+ public function __construct() {
13
+ add_action( 'wp_dashboard_setup', array(
14
+ $this,
15
+ 'action__wp_dashboard_setup'
16
+ ) );
17
+
18
+ add_filter( 'wpglobus_localize_feed_url', array(
19
+ $this,
20
+ 'filter__wpglobus_localize_feed_url'
21
+ ), 0, 2 );
22
+
23
+ }
24
+
25
+ /**
26
+ * Do not localize feed URL because we have news only in English.
27
+ *
28
+ * @param bool $need_to_localize
29
+ * @param SimplePie $feed
30
+ *
31
+ * @return bool
32
+ */
33
+ public function filter__wpglobus_localize_feed_url( $need_to_localize, $feed ) {
34
+
35
+ return $need_to_localize && WPGlobus::URL_WPGLOBUS_SITE . 'feed/' !== $feed->feed_url;
36
+ }
37
+
38
+ /**
39
+ * Setup the dashboard widget.
40
+ */
41
+ public function action__wp_dashboard_setup() {
42
+ add_meta_box( 'wpglobus_dashboard_news',
43
+ esc_html__( 'WPGlobus News', 'wpglobus' ),
44
+ array(
45
+ $this,
46
+ 'dashboard_widget'
47
+ ),
48
+ 'dashboard', 'side', 'high'
49
+ );
50
+ }
51
+
52
+ /**
53
+ * Output the widget content.
54
+ */
55
+ public function dashboard_widget() {
56
+ echo '<div class="rss-widget">';
57
+ wp_widget_rss_output( array(
58
+ 'url' => WPGlobus::URL_WPGLOBUS_SITE . 'feed/',
59
+ 'title' => esc_html__( 'WPGlobus News', 'wpglobus' ),
60
+ 'items' => 3,
61
+ 'show_summary' => 1,
62
+ 'show_author' => 0,
63
+ 'show_date' => 1
64
+ ) );
65
+ echo '</div>';
66
+ }
67
+ }
trunk/includes/admin/class-wpglobus-language-edit-request.php ADDED
@@ -0,0 +1,255 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WPGlobus / Admin / Language Edit / Request
4
+ * plugins/wpglobus/includes/admin/class-wpglobus-language-edit-request.php
5
+ *
6
+ * @package WPGlobus\Admin
7
+ * @since 1.9.7.1
8
+ */
9
+
10
+ /**
11
+ * Class WPGlobus_Language_Edit_Request
12
+ */
13
+ class WPGlobus_Language_Edit_Request {
14
+
15
+ const NONCE_ACTION = 'wpglobus-language-edit';
16
+
17
+ const ACTION_NONE = '';
18
+
19
+ const ACTION_EDIT = 'edit';
20
+
21
+ const ACTION_DELETE = 'delete';
22
+
23
+ const ACTION_ADD = 'add';
24
+
25
+ const ACTION_DONE = 'done';
26
+
27
+ /**
28
+ * GET['action']
29
+ *
30
+ * @var string
31
+ */
32
+ protected $action = self::ACTION_NONE;
33
+
34
+ /**
35
+ * GET['lang']
36
+ *
37
+ * @var string
38
+ */
39
+ protected $lang = '';
40
+
41
+ /**
42
+ * POST['submit']
43
+ *
44
+ * @var bool
45
+ */
46
+ protected $is_submit = false;
47
+
48
+ /**
49
+ * POST['delete']
50
+ *
51
+ * @var bool
52
+ */
53
+ protected $is_delete = false;
54
+
55
+
56
+ /**
57
+ * POST['wpglobus_language_code']
58
+ *
59
+ * @var string
60
+ */
61
+ protected $wpglobus_language_code = '';
62
+
63
+ /**
64
+ * POST['wpglobus_flags']
65
+ *
66
+ * @var string
67
+ */
68
+ protected $wpglobus_flags = '';
69
+
70
+ /**
71
+ * POST['wpglobus_language_name']
72
+ *
73
+ * @var string
74
+ */
75
+ protected $wpglobus_language_name = '';
76
+
77
+ /**
78
+ * POST['wpglobus_en_language_name']
79
+ *
80
+ * @var string
81
+ */
82
+ protected $wpglobus_en_language_name = '';
83
+
84
+ /**
85
+ * POST['wpglobus_locale']
86
+ *
87
+ * @var string
88
+ */
89
+ protected $wpglobus_locale = '';
90
+
91
+ /**
92
+ * WPGlobus_Language_Edit_Request constructor.
93
+ */
94
+ public function __construct() {
95
+ $this->parse_request();
96
+ }
97
+
98
+ /**
99
+ * Parse GET and POST.
100
+ */
101
+ protected function parse_request() {
102
+
103
+ check_admin_referer( self::NONCE_ACTION );
104
+
105
+ if ( isset( $_GET['action'] ) && is_string( $_GET['action'] ) ) { // WPCS: input var ok, sanitization ok.
106
+ $action = sanitize_text_field( wp_unslash( $_GET['action'] ) ); // Input var okay.
107
+ if ( in_array( $action, array(
108
+ self::ACTION_ADD,
109
+ self::ACTION_EDIT,
110
+ self::ACTION_DELETE,
111
+ self::ACTION_DONE,
112
+ ), true ) ) {
113
+ $this->action = $action;
114
+ } else {
115
+ $this->action = self::ACTION_NONE;
116
+ }
117
+ }
118
+
119
+ if ( isset( $_GET['lang'] ) && is_string( $_GET['lang'] ) ) { // WPCS: input var ok, sanitization ok.
120
+ $this->lang = sanitize_text_field( wp_unslash( $_GET['lang'] ) ); // Input var okay.
121
+ }
122
+
123
+ if ( isset( $_POST['submit'] ) ) { // Input var okay.
124
+ $this->is_submit = true;
125
+ }
126
+
127
+ if ( isset( $_POST['delete'] ) ) { // Input var okay.
128
+ $this->is_delete = true;
129
+ }
130
+
131
+ foreach (
132
+ array(
133
+ 'wpglobus_language_code',
134
+ 'wpglobus_flags',
135
+ 'wpglobus_language_name',
136
+ 'wpglobus_en_language_name',
137
+ 'wpglobus_locale',
138
+ ) as $var_name
139
+ ) {
140
+ if ( isset( $_POST[ $var_name ] ) && is_string( $_POST[ $var_name ] ) ) { // WPCS: input var ok, sanitization ok.
141
+ $this->$var_name = sanitize_text_field( wp_unslash( $_POST[ $var_name ] ) ); // Input var okay.
142
+ }
143
+ }
144
+ }
145
+
146
+ /**
147
+ * Getter.
148
+ *
149
+ * @return string
150
+ */
151
+ public function get_action() {
152
+ return $this->action;
153
+ }
154
+
155
+ /**
156
+ * Getter.
157
+ *
158
+ * @return string
159
+ */
160
+ public function get_lang() {
161
+ return $this->lang;
162
+ }
163
+
164
+ /**
165
+ * Getter.
166
+ *
167
+ * @return bool
168
+ */
169
+ public function is_submit() {
170
+ return $this->is_submit;
171
+ }
172
+
173
+ /**
174
+ * Getter.
175
+ *
176
+ * @return bool
177
+ */
178
+ public function is_delete() {
179
+ return $this->is_delete;
180
+ }
181
+
182
+ /**
183
+ * Getter.
184
+ *
185
+ * @return string
186
+ */
187
+ public function get_wpglobus_language_code() {
188
+ return $this->wpglobus_language_code;
189
+ }
190
+
191
+ /**
192
+ * Getter.
193
+ *
194
+ * @return string
195
+ */
196
+ public function get_wpglobus_flags() {
197
+ return $this->wpglobus_flags;
198
+ }
199
+
200
+ /**
201
+ * Getter.
202
+ *
203
+ * @return string
204
+ */
205
+ public function get_wpglobus_language_name() {
206
+ return $this->wpglobus_language_name;
207
+ }
208
+
209
+ /**
210
+ * Getter.
211
+ *
212
+ * @return string
213
+ */
214
+ public function get_wpglobus_en_language_name() {
215
+ return $this->wpglobus_en_language_name;
216
+ }
217
+
218
+ /**
219
+ * Getter.
220
+ *
221
+ * @return string
222
+ */
223
+ public function get_wpglobus_locale() {
224
+ return $this->wpglobus_locale;
225
+ }
226
+
227
+ public static function url_language_add() {
228
+ $url = add_query_arg( array(
229
+ 'page' => WPGlobus::LANGUAGE_EDIT_PAGE,
230
+ 'action' => self::ACTION_ADD,
231
+ ), admin_url( 'admin.php' ) );
232
+
233
+ return wp_nonce_url( $url, self::NONCE_ACTION );
234
+ }
235
+
236
+ public static function url_language_edit( $language_code ) {
237
+ $url = add_query_arg( array(
238
+ 'page' => WPGlobus::LANGUAGE_EDIT_PAGE,
239
+ 'lang' => $language_code,
240
+ 'action' => self::ACTION_EDIT,
241
+ ), admin_url( 'admin.php' ) );
242
+
243
+ return wp_nonce_url( $url, self::NONCE_ACTION );
244
+ }
245
+
246
+ public static function url_language_delete( $language_code ) {
247
+ $url = add_query_arg( array(
248
+ 'page' => WPGlobus::LANGUAGE_EDIT_PAGE,
249
+ 'lang' => $language_code,
250
+ 'action' => self::ACTION_DELETE,
251
+ ), admin_url( 'admin.php' ) );
252
+
253
+ return wp_nonce_url( $url, self::NONCE_ACTION );
254
+ }
255
+ }
trunk/includes/admin/class-wpglobus-language-edit.php ADDED
@@ -0,0 +1,494 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 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class.
9
+ require_once dirname( __FILE__ ) . '/class-wpglobus-language-edit-request.php';
10
+
11
+ /**
12
+ * Class WPGlobus_Language_Edit
13
+ */
14
+ class WPGlobus_Language_Edit {
15
+
16
+ /**
17
+ * All flag files.
18
+ *
19
+ * @var array
20
+ */
21
+ protected $all_flags = array();
22
+
23
+ /**
24
+ * Current action
25
+ *
26
+ * @var string
27
+ */
28
+ protected $action = WPGlobus_Language_Edit_Request::ACTION_ADD;
29
+
30
+ /**
31
+ * Language code
32
+ *
33
+ * @var string
34
+ */
35
+ protected $language_code = '';
36
+
37
+ /**
38
+ * Language name
39
+ *
40
+ * @var string
41
+ */
42
+ protected $language_name = '';
43
+
44
+ /**
45
+ * Language name in English
46
+ *
47
+ * @var string
48
+ */
49
+ protected $en_language_name = '';
50
+
51
+ /**
52
+ * Locale
53
+ *
54
+ * @var string
55
+ */
56
+ protected $locale = '';
57
+
58
+ /**
59
+ * Flag for the current language
60
+ *
61
+ * @var string
62
+ */
63
+ protected $flag = '';
64
+
65
+ /**
66
+ * Set to true when the form is submitted
67
+ *
68
+ * @var bool
69
+ */
70
+ protected $submit = false;
71
+
72
+ /**
73
+ * Diagnostic messages
74
+ *
75
+ * @var string[]
76
+ */
77
+ protected $submit_messages = array();
78
+
79
+ /**
80
+ * The Request object
81
+ *
82
+ * @var WPGlobus_Language_Edit_Request
83
+ */
84
+ protected $request;
85
+
86
+ /**
87
+ * Constructor
88
+ */
89
+ public function __construct() {
90
+
91
+ $this->request = new WPGlobus_Language_Edit_Request();
92
+
93
+ if ( WPGlobus_Language_Edit_Request::ACTION_DELETE === $this->request->get_action() ) {
94
+ $this->action = WPGlobus_Language_Edit_Request::ACTION_DELETE;
95
+ } elseif ( WPGlobus_Language_Edit_Request::ACTION_EDIT === $this->request->get_action() ) {
96
+ $this->action = WPGlobus_Language_Edit_Request::ACTION_EDIT;
97
+ }
98
+
99
+ $this->language_code = $this->request->get_lang();
100
+
101
+ if ( $this->request->is_submit() ) {
102
+ $this->submit = true;
103
+ $this->process_submit();
104
+ } elseif ( $this->request->is_delete() ) {
105
+ $this->process_delete();
106
+ $this->action = WPGlobus_Language_Edit_Request::ACTION_DONE;
107
+ } else {
108
+ $this->get_data();
109
+ }
110
+
111
+ if ( WPGlobus_Language_Edit_Request::ACTION_DONE !== $this->action ) {
112
+ $this->display_table();
113
+ }
114
+
115
+ add_action( 'admin_footer', array( $this, 'on_print_scripts' ), 99 );
116
+
117
+ }
118
+
119
+ /**
120
+ * Add script in admin footer
121
+ */
122
+ public function on_print_scripts() {
123
+
124
+ if ( WPGlobus_Language_Edit_Request::ACTION_DONE === $this->action ) {
125
+ $location = '?page=' . WPGlobus::OPTIONS_PAGE_SLUG;
126
+ // @formatter:off
127
+ ?>
128
+ <script>jQuery(document).ready(function () {window.location = window.location.protocol + '//' + window.location.host + window.location.pathname + '<?php echo $location; // WPCS: XSS ok. ?>'});</script>
129
+ <?php
130
+ // @formatter:on
131
+ }
132
+
133
+ wp_enqueue_script(
134
+ 'wpglobus-form',
135
+ WPGlobus::plugin_dir_url() . 'includes/js/wpglobus-form' . WPGlobus::SCRIPT_SUFFIX() . '.js',
136
+ array( 'jquery' ),
137
+ WPGLOBUS_VERSION,
138
+ true
139
+ );
140
+
141
+ }
142
+
143
+ /**
144
+ * Process delete language action
145
+ */
146
+ protected function process_delete() {
147
+
148
+ $config = WPGlobus::Config();
149
+
150
+ /**
151
+ * Get options
152
+ *
153
+ * @var array
154
+ */
155
+ $opts = get_option( $config->option );
156
+
157
+ if ( isset( $opts['enabled_languages'][ $this->language_code ] ) ) {
158
+
159
+ unset( $opts['enabled_languages'][ $this->language_code ] );
160
+
161
+ /** FIX: reset $opts['more_languages'] */
162
+ if ( array_key_exists( 'more_languages', $opts ) ) {
163
+ $opts['more_languages'] = '';
164
+ }
165
+ update_option( $config->option, $opts );
166
+
167
+ }
168
+
169
+ unset( $config->language_name[ $this->language_code ] );
170
+ update_option( $config->option_language_names, $config->language_name );
171
+
172
+ unset( $config->flag[ $this->language_code ] );
173
+ update_option( $config->option_flags, $config->flag );
174
+
175
+ unset( $config->en_language_name[ $this->language_code ] );
176
+ update_option( $config->option_en_language_names, $config->en_language_name );
177
+
178
+ unset( $config->locale[ $this->language_code ] );
179
+ update_option( $config->option_locale, $config->locale );
180
+
181
+ }
182
+
183
+ /**
184
+ * Process submit action
185
+ */
186
+ protected function process_submit() {
187
+
188
+ $code = $this->request->get_wpglobus_language_code();
189
+ if ( $code && $this->language_code === $code ) {
190
+ if ( $this->check_fields( $code, false ) ) {
191
+ $this->save();
192
+ $this->submit_messages['success'][] = __( 'Options updated', 'wpglobus' );
193
+ }
194
+ } else {
195
+ if ( $this->check_fields( $code ) ) {
196
+ $this->save( true );
197
+ $this->submit_messages['success'][] = __( 'Options updated', 'wpglobus' );
198
+ }
199
+ }
200
+ $this->get_flags();
201
+
202
+ }
203
+
204
+ /**
205
+ * Save data language to DB
206
+ *
207
+ * @param bool $update_code If need to change language code.
208
+ */
209
+ protected function save( $update_code = false ) {
210
+
211
+ $config = WPGlobus::Config();
212
+
213
+ $old_code = '';
214
+ if ( $update_code && WPGlobus_Language_Edit_Request::ACTION_EDIT === $this->action ) {
215
+ $old_code = $this->language_code ? $this->language_code : $old_code;
216
+ if ( isset( $config->language_name[ $old_code ] ) ) {
217
+ unset( $config->language_name[ $old_code ] );
218
+ }
219
+
220
+ /**
221
+ * Get options
222
+ *
223
+ * @var array
224
+ */
225
+ $opts = get_option( $config->option );
226
+ if ( isset( $opts['enabled_languages'][ $old_code ] ) ) {
227
+ unset( $opts['enabled_languages'][ $old_code ] );
228
+ update_option( $config->option, $opts );
229
+ }
230
+ if ( isset( $opts['more_languages'] ) && $old_code === $opts['more_languages'] ) {
231
+ unset( $opts['more_languages'] );
232
+ update_option( $config->option, $opts );
233
+ }
234
+ }
235
+ $config->language_name[ $this->language_code ] = $this->language_name;
236
+ update_option( $config->option_language_names, $config->language_name );
237
+
238
+ if ( $update_code && isset( $config->flag[ $old_code ] ) ) {
239
+ unset( $config->flag[ $old_code ] );
240
+ }
241
+ $config->flag[ $this->language_code ] = $this->flag;
242
+ update_option( $config->option_flags, $config->flag );
243
+
244
+ if ( $update_code && isset( $config->en_language_name[ $old_code ] ) ) {
245
+ unset( $config->en_language_name[ $old_code ] );
246
+ }
247
+ $config->en_language_name[ $this->language_code ] = $this->en_language_name;
248
+ update_option( $config->option_en_language_names, $config->en_language_name );
249
+
250
+ if ( $update_code && isset( $config->locale[ $old_code ] ) ) {
251
+ unset( $config->locale[ $old_code ] );
252
+ }
253
+ $config->locale[ $this->language_code ] = $this->locale;
254
+ update_option( $config->option_locale, $config->locale );
255
+
256
+ if ( $update_code ) {
257
+ $this->action = WPGlobus_Language_Edit_Request::ACTION_DONE;
258
+ }
259
+ }
260
+
261
+ /**
262
+ * Check form fields
263
+ *
264
+ * @param string $lang_code Language code.
265
+ * @param bool $check_code Use for language code existence check.
266
+ *
267
+ * @return bool True if no errors, false otherwise.
268
+ */
269
+ protected function check_fields( $lang_code, $check_code = true ) {
270
+ $this->submit_messages['errors'] = array();
271
+ if ( $check_code && empty( $lang_code ) ) {
272
+ $this->submit_messages['errors'][] = __( 'Please enter a language code!', 'wpglobus' );
273
+ }
274
+
275
+ if ( $check_code && $this->language_exists( $lang_code ) ) {
276
+ $this->submit_messages['errors'][] = __( 'Language code already exists!', 'wpglobus' );
277
+ }
278
+
279
+ if ( ! $this->request->get_wpglobus_flags() ) {
280
+ $this->submit_messages['errors'][] = __( 'Please specify the language flag!', 'wpglobus' );
281
+ }
282
+
283
+ if ( ! $this->request->get_wpglobus_language_name() ) {
284
+ $this->submit_messages['errors'][] = __( 'Please enter the language name!', 'wpglobus' );
285
+ }
286
+
287
+ if ( ! $this->request->get_wpglobus_en_language_name() ) {
288
+ $this->submit_messages['errors'][] = __( 'Please enter the language name in English!', 'wpglobus' );
289
+ }
290
+
291
+ if ( ! $this->request->get_wpglobus_locale() ) {
292
+ $this->submit_messages['errors'][] = __( 'Please enter the locale!', 'wpglobus' );
293
+ }
294
+
295
+ $this->language_code = $lang_code;
296
+ $this->flag = $this->request->get_wpglobus_flags();
297
+ $this->language_name = $this->request->get_wpglobus_language_name();
298
+ $this->en_language_name = $this->request->get_wpglobus_en_language_name();
299
+ $this->locale = $this->request->get_wpglobus_locale();
300
+
301
+ if ( empty( $this->submit_messages['errors'] ) ) {
302
+ return true;
303
+ }
304
+
305
+ return false;
306
+ }
307
+
308
+ /**
309
+ * Check existing language code in global $WPGlobus_Config
310
+ *
311
+ * @param string $code Language code.
312
+ *
313
+ * @return bool true if language code exists
314
+ */
315
+ protected function language_exists( $code ) {
316
+
317
+ if ( array_key_exists( $code, WPGlobus::Config()->language_name ) ) {
318
+ return true;
319
+ }
320
+
321
+ return false;
322
+ }
323
+
324
+ /**
325
+ * Get data for form fields
326
+ */
327
+ protected function get_data() {
328
+
329
+ if ( WPGlobus_Language_Edit_Request::ACTION_EDIT === $this->action
330
+ || WPGlobus_Language_Edit_Request::ACTION_DELETE === $this->action ) {
331
+
332
+ $config = WPGlobus::Config();
333
+
334
+ $this->language_name = $config->language_name[ $this->language_code ];
335
+ $this->en_language_name = $config->en_language_name[ $this->language_code ];
336
+ $this->locale = $config->locale[ $this->language_code ];
337
+ $this->flag = $config->flag[ $this->language_code ];
338
+ }
339
+ $this->get_flags();
340
+ }
341
+
342
+ /**
343
+ * Display language form
344
+ */
345
+ protected function display_table() {
346
+
347
+ $disabled = '';
348
+ if ( WPGlobus_Language_Edit_Request::ACTION_EDIT === $this->action ) {
349
+ $header = __( 'Edit Language', 'wpglobus' );
350
+ } elseif ( WPGlobus_Language_Edit_Request::ACTION_DELETE === $this->action ) {
351
+ $header = __( 'Delete Language', 'wpglobus' );
352
+ $disabled = 'disabled';
353
+ } else {
354
+ $header = __( 'Add Language', 'wpglobus' );
355
+ }
356
+ ?>
357
+ <div class="wrap">
358
+ <h1>WPGlobus: <?php echo esc_html( $header ); ?></h1>
359
+ <?php
360
+ if ( $this->submit ) {
361
+ if ( ! empty( $this->submit_messages['errors'] ) ) {
362
+ $mess = '';
363
+ foreach ( $this->submit_messages['errors'] as $message ) {
364
+ $mess .= $message . '<br />';
365
+ }
366
+ ?>
367
+ <div class="error"><p><?php echo wp_kses( $mess, array( 'br' => array() ) ); ?></p></div>
368
+ <?php
369
+ } elseif ( ! empty( $this->submit_messages['success'] ) ) {
370
+ $mess = '';
371
+ foreach ( $this->submit_messages['success'] as $message ) {
372
+ $mess .= $message . '<br />';
373
+ }
374
+ ?>
375
+ <div class="updated"><p><?php echo wp_kses( $mess, array( 'br' => array() ) ); ?></p></div>
376
+ <?php
377
+ }
378
+ }
379
+ ?>
380
+ <form id="wpglobus_edit_form" method="post" action="">
381
+ <table class="form-table">
382
+ <tr>
383
+ <th scope="row"><label
384
+ for="wpglobus_language_code"><?php esc_html_e( 'Language Code', 'wpglobus' ); ?></label>
385
+ </th>
386
+ <td>
387
+ <input name="wpglobus_language_code" <?php echo esc_attr( $disabled ); ?> type="text"
388
+ id="wpglobus_language_code"
389
+ value="<?php echo esc_attr( $this->language_code ); ?>" class="regular-text"/>
390
+
391
+ <p class="description"><?php esc_html_e( '2-Letter ISO Language Code for the Language you want to insert. (Example: en)', 'wpglobus' ); ?></p>
392
+ </td>
393
+ </tr>
394
+ <tr>
395
+ <th scope="row"><label
396
+ for="wpglobus_flags"><?php esc_html_e( 'Language flag', 'wpglobus' ); ?></label>
397
+ </th>
398
+ <td>
399
+ <select id="wpglobus_flags" name="wpglobus_flags" style="width:300px;"
400
+ class="populate">
401
+ <?php
402
+ foreach ( $this->all_flags as $file_name ) :
403
+ ?>
404
+ <option <?php selected( $this->flag === $file_name ); ?>
405
+ value="<?php echo esc_attr( $file_name ); ?>"><?php echo esc_html( $file_name ); ?></option>
406
+ <?php endforeach; ?>
407
+ </select>
408
+ </td>
409
+ </tr>
410
+ <tr>
411
+ <th scope="row"><label
412
+ for="wpglobus_language_name"><?php esc_html_e( 'Name', 'wpglobus' ); ?></label>
413
+ </th>
414
+ <td><input name="wpglobus_language_name" type="text" id="wpglobus_language_name"
415
+ value="<?php echo esc_attr( $this->language_name ); ?>" class="regular-text"/>
416
+
417
+ <p class="description"><?php esc_html_e( 'The name of the language in its native alphabet. (Examples: English, Русский)', 'wpglobus' ); ?></p>
418
+ </td>
419
+ </tr>
420
+ <tr>
421
+ <th scope="row"><label
422
+ for="wpglobus_en_language_name"><?php esc_html_e( 'Name in English', 'wpglobus' ); ?></label>
423
+ </th>
424
+ <td><input name="wpglobus_en_language_name" type="text" id="wpglobus_en_language_name"
425
+ value="<?php echo esc_attr( $this->en_language_name ); ?>" class="regular-text"/>
426
+
427
+ <p class="description"><?php esc_html_e( 'The name of the language in English', 'wpglobus' ); ?></p>
428
+ </td>
429
+ </tr>
430
+ <tr>
431
+ <th scope="row"><label
432
+ for="wpglobus_locale"><?php esc_html_e( 'Locale', 'wpglobus' ); ?></label></th>
433
+ <td><input name="wpglobus_locale" type="text" id="wpglobus_locale"
434
+ value="<?php echo esc_attr( $this->locale ); ?>"
435
+ class="regular-text"/>
436
+
437
+ <p class="description"><?php esc_html_e( 'PHP/WordPress Locale of the language. (Examples: en_US, ru_RU)', 'wpglobus' ); ?></p>
438
+ </td>
439
+ </tr>
440
+ </table>
441
+ <?php
442
+
443
+ if ( WPGlobus_Language_Edit_Request::ACTION_EDIT === $this->action
444
+ || WPGlobus_Language_Edit_Request::ACTION_ADD === $this->action ) {
445
+ ?>
446
+ <input class="button button-primary" type="submit" name="submit"
447
+ value="<?php esc_attr_e( 'Save Changes', 'wpglobus' ); ?>">
448
+ <?php
449
+
450
+ if ( WPGlobus_Language_Edit_Request::ACTION_EDIT === $this->action ) {
451
+ ?>
452
+
453
+ <a class="button button-link-delete" style="margin-left: 1em" href="<?php echo esc_url( WPGlobus_Language_Edit_Request::url_language_delete( $this->language_code ) ); ?>">
454
+ <i class="dashicons dashicons-trash" style="line-height: inherit;"></i>
455
+ <?php esc_html_e( 'Delete Language', 'wpglobus' ); ?>&hellip;</a>
456
+ <?php
457
+ }
458
+ } elseif ( WPGlobus_Language_Edit_Request::ACTION_DELETE === $this->action ) {
459
+ ?>
460
+ <div class="notice-large wp-ui-notification"><?php esc_html_e( 'Are you sure you want to delete?', 'wpglobus' ); ?></div>
461
+ <p class="submit"><input class="button button-primary" type="submit" name="delete"
462
+ value="<?php esc_attr_e( 'Delete Language', 'wpglobus' ); ?>"></p>
463
+ <?php } ?>
464
+
465
+ </form>
466
+
467
+ <hr/>
468
+ <span class="dashicons dashicons-admin-site"></span>
469
+ <a href="<?php echo esc_url( WPGlobus_Admin_Page::url_settings() ); ?>">
470
+ <?php esc_html_e( 'Back to the WPGlobus Settings', 'wpglobus' ); ?>
471
+ </a>
472
+ </div>
473
+ <?php
474
+ }
475
+
476
+ /**
477
+ * Get flag files from directory
478
+ */
479
+ protected function get_flags() {
480
+
481
+ $dir = new DirectoryIterator( WPGlobus::plugin_dir_path() . 'flags/' );
482
+
483
+ foreach ( $dir as $file ) {
484
+ /**
485
+ * File object
486
+ *
487
+ * @var DirectoryIterator $file
488
+ */
489
+ if ( $file->isFile() ) {
490
+ $this->all_flags[] = $file->getFilename();
491
+ }
492
+ }
493
+ }
494
+ }
trunk/includes/admin/class-wpglobus-plugin-install.php ADDED
@@ -0,0 +1,336 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * File: class-wpglobus-plugin-install.php
4
+ *
5
+ * @package WPGlobus\Admin
6
+ * @since 1.5.9
7
+ */
8
+
9
+ if ( ! class_exists( 'WPGlobus_Plugin_Install' ) ) :
10
+
11
+ /**
12
+ * Class WPGlobus_Plugin_Install
13
+ */
14
+ class WPGlobus_Plugin_Install {
15
+
16
+ /**
17
+ * Fake version for paid plugins to prevent the "Update Now" button from appearing.
18
+ *
19
+ * @var string
20
+ */
21
+ const FAKE_VERSION = '999';
22
+
23
+ /**
24
+ * Fake active installs for paid plugins.
25
+ *
26
+ * @var int
27
+ */
28
+ const FAKE_ACTIVE_INSTALLS = 0;
29
+
30
+ /**
31
+ * Fake "Compatible with your version of WordPress" for paid plugins.
32
+ *
33
+ * @var string
34
+ */
35
+ protected static $fake_compatible_with = '';
36
+
37
+ /**
38
+ * Array of plugin cards.
39
+ *
40
+ * @var array
41
+ */
42
+ static protected $plugin_card = array();
43
+
44
+ /**
45
+ * Array of paid plugins data.
46
+ *
47
+ * @var array
48
+ */
49
+ static protected $paid_plugins = array();
50
+
51
+ /**
52
+ * Array of free plugins data.
53
+ *
54
+ * @var array
55
+ */
56
+ static protected $free_plugins = array();
57
+
58
+ /**
59
+ * Controller.
60
+ */
61
+ public static function controller() {
62
+
63
+ // phpcs:ignore WordPress.CSRF.NonceVerification.NoNonceVerification
64
+ if ( empty( $_GET['s'] ) || 'wpglobus' !== strtolower( $_GET['s'] ) ) {
65
+ return;
66
+ }
67
+
68
+ self::$fake_compatible_with = $GLOBALS['wp_version'];
69
+
70
+ self::$plugin_card['free'] = array();
71
+ self::$plugin_card['paid'] = array();
72
+
73
+ self::setup_paid_plugins();
74
+
75
+ // Enqueue the CSS & JS scripts.
76
+ add_action( 'admin_enqueue_scripts', array( __CLASS__, 'enqueue_scripts' ) );
77
+
78
+ add_filter( 'plugins_api_result', array( __CLASS__, 'filter__plugins_api_result' ), 10, 3 );
79
+ }
80
+
81
+ /**
82
+ * List of the premium WPGlobus extensions.
83
+ * This file is created manually.
84
+ */
85
+ protected static function setup_paid_plugins() {
86
+
87
+ self::$paid_plugins = array();
88
+
89
+ $data_file = WPGlobus::data_path() . '/paid_plugins.json';
90
+
91
+ if ( is_readable( $data_file ) ) {
92
+ $_json = file_get_contents( $data_file );
93
+ self::$paid_plugins = json_decode( $_json, true );
94
+ uasort( self::$paid_plugins, array( __CLASS__, 'sort_paid_plugins' ) );
95
+ }
96
+ }
97
+
98
+ /**
99
+ * Callback for sorting the paid_plugins array.
100
+ *
101
+ * @param array $a First.
102
+ * @param array $b Second.
103
+ *
104
+ * @return int
105
+ */
106
+ public static function sort_paid_plugins( $a, $b ) {
107
+ return $a['order'] > $b['order'];
108
+ }
109
+
110
+ /**
111
+ * Filter api results
112
+ *
113
+ * @param stdClass|WP_Error $res Response object or WP_Error.
114
+ * @param string $action The type of information being requested from the Plugin Install API.
115
+ * @param stdClass $args Plugin API arguments.
116
+ *
117
+ * @return stdClass|WP_Error
118
+ */
119
+ public static function filter__plugins_api_result(
120
+ $res,
121
+ // @formatter:off
122
+ /* @noinspection PhpUnusedParameterInspection */ $action,
123
+ /* @noinspection PhpUnusedParameterInspection */ $args
124
+ // @formatter:on
125
+ ) {
126
+
127
+ if ( is_wp_error( $res ) ) {
128
+ return $res;
129
+ }
130
+
131
+ if ( empty( $res->plugins ) ) {
132
+ return $res;
133
+ }
134
+
135
+ foreach ( (array) $res->plugins as $key => $plugin ) {
136
+ if ( is_array( $plugin ) ) {
137
+ /** @since 2.1.10 */
138
+ $plugin = (object) $plugin;
139
+ }
140
+ if ( false === strpos( $plugin->slug, 'wpglobus' ) ) {
141
+ unset( $res->plugins[ $key ] );
142
+ } else {
143
+
144
+ if ( 'wpglobus-for-black-studio-tinymce-widget' === $plugin->slug ) {
145
+
146
+ /**
147
+ * Set correct slug for the
148
+ * `WPGlobus for Black Studio TinyMCE Widget` plugin.
149
+ *
150
+ * @since 1.6.3
151
+ */
152
+ $plugin->slug = 'wpglobus-for-black-studio-widget';
153
+
154
+ self::$plugin_card['free'][] = $plugin->slug;
155
+
156
+ self::$free_plugins[ $plugin->slug ]['extra_data']['correctLink'] = 'wpglobus-for-black-studio-tinymce-widget';
157
+
158
+ } else {
159
+ self::$plugin_card['free'][] = $plugin->slug;
160
+ }
161
+ }
162
+ }
163
+
164
+ $url_wpglobus_site = WPGlobus_Utils::url_wpglobus_site();
165
+
166
+ $all_products = self::get_all_product_info();
167
+
168
+ foreach ( self::$paid_plugins as $plugin => $plugin_data ) {
169
+
170
+ $plugin_file = implode( '/', array( WP_PLUGIN_DIR, $plugin_data['slug'], $plugin_data['loader'] ) );
171
+
172
+ if ( is_readable( $plugin_file ) ) {
173
+ // Plugin is installed.
174
+ self::$paid_plugins[ $plugin ]['plugin_data'] = get_plugin_data( $plugin_file, false );
175
+ } else {
176
+ self::$paid_plugins[ $plugin ]['plugin_data'] = null;
177
+
178
+ $product_slug = ( isset( $plugin_data['product_slug'] ) ? $plugin_data['product_slug'] : $plugin );
179
+
180
+ if ( isset( $all_products[ $product_slug ] ) ) {
181
+ $plugin_info = $all_products[ $product_slug ];
182
+
183
+ /**
184
+ * Titles come as multilingual strings but only in 2 languages ['en','ru']
185
+ * because the WPGlobus website has only those.
186
+ * So we need to force `en` language code if the admin language
187
+ * is out of the list.
188
+ */
189
+ $language = WPGlobus::Config()->language;
190
+ if ( ! in_array( $language, array( 'en', 'ru' ), true ) ) {
191
+ $language = 'en';
192
+ }
193
+ $_plugin_title = WPGlobus_Core::text_filter( $plugin_info['title'], $language );
194
+
195
+ self::$paid_plugins[ $plugin ]['plugin_data'] = array(
196
+ 'Description' => '', // TODO.
197
+ 'Name' => $_plugin_title,
198
+ 'Title' => $_plugin_title,
199
+ 'Version' => $plugin_info['_api_new_version'],
200
+ 'PluginURI' => $url_wpglobus_site . 'product/' .
201
+ $product_slug . '/',
202
+ );
203
+ }
204
+ }
205
+ }
206
+
207
+ /**
208
+ * Prepend the premium add-ons to the list of plugins.
209
+ */
210
+ foreach ( self::$paid_plugins as $slug => $paid_plugin ) {
211
+
212
+ $info = self::plugin_info_template();
213
+
214
+ $info->slug = $slug;
215
+
216
+ $info->icons['default'] = WPGlobus::internal_images_url() . '/' . $paid_plugin['image_file'];
217
+ $info->icons['1x'] = $info->icons['default'];
218
+ $info->icons['2x'] = $info->icons['default'];
219
+
220
+ if ( ! empty( $paid_plugin['plugin_data'] ) ) {
221
+ $info->name = $paid_plugin['plugin_data']['Name'];
222
+ $info->short_description = $paid_plugin['plugin_data']['Description'];
223
+ $info->homepage = $paid_plugin['plugin_data']['PluginURI'];
224
+ } else {
225
+ $info->name = $slug;
226
+ }
227
+
228
+ self::$plugin_card['paid'][] = $slug;
229
+
230
+ self::$paid_plugins[ $slug ]['card'] = $info;
231
+
232
+ self::$paid_plugins[ $slug ]['extra_data']['product_url'] =
233
+ self::$paid_plugins[ $slug ]['extra_data']['details_url'] =
234
+ $info->homepage;
235
+
236
+ /**
237
+ * @since 2.4.2
238
+ */
239
+ if ( isset( $paid_plugin['available'] ) && ( empty($paid_plugin['available']) || false === $paid_plugin['available'] ) ) {
240
+ // Don't add unavailable plugin in response.
241
+ } else {
242
+ array_unshift( $res->plugins, $info );
243
+ }
244
+ }
245
+
246
+ $res->info['results'] = count( $res->plugins );
247
+
248
+ return $res;
249
+ }
250
+
251
+ /**
252
+ * Get information about all premium plugins.
253
+ * This file is created automatically at build. Do not edit!
254
+ *
255
+ * @return array[]
256
+ */
257
+ protected static function get_all_product_info() {
258
+ $all_product_info = array();
259
+
260
+ $data_file = WPGlobus::data_path() . '/wpglobus-product-info.json';
261
+
262
+ if ( is_readable( $data_file ) ) {
263
+ $all_product_info_json = file_get_contents( $data_file );
264
+ $all_product_info = json_decode( $all_product_info_json, true );
265
+ }
266
+
267
+ return $all_product_info;
268
+ }
269
+
270
+ /**
271
+ * Template for plugin info.
272
+ *
273
+ * @return stdClass
274
+ */
275
+ protected static function plugin_info_template() {
276
+ $url_wpglobus_site = WPGlobus_Utils::url_wpglobus_site();
277
+
278
+ $template = new stdClass();
279
+ $template->name = '';
280
+ $template->short_description = '';
281
+ $template->author = '<a href="' . $url_wpglobus_site . '">WPGlobus</a>';
282
+ $template->author_profile = $url_wpglobus_site;
283
+ $template->homepage = $url_wpglobus_site;
284
+ $template->slug = '';
285
+ $template->rating = 100;
286
+ $template->num_ratings = 0;
287
+ $template->active_installs = self::FAKE_ACTIVE_INSTALLS;
288
+ $template->version = self::FAKE_VERSION;
289
+ $template->tested = self::$fake_compatible_with;
290
+ $template->icons['default'] = '';
291
+ $template->icons['2x'] = '';
292
+ $template->icons['1x'] = '';
293
+ $template->last_updated = date( 'c' );
294
+
295
+ return $template;
296
+ }
297
+
298
+ /**
299
+ * Enqueue admin JS scripts.
300
+ *
301
+ * @param string $hook_page The current admin page.
302
+ */
303
+ public static function enqueue_scripts( $hook_page ) {
304
+
305
+ if ( 'plugin-install.php' === $hook_page ) {
306
+
307
+ $i18n = array();
308
+ $i18n['current_version'] = esc_html__( 'Current Version', 'wpglobus' );
309
+ $i18n['get_it'] = esc_html__( 'Get it now!', 'wpglobus' );
310
+ $i18n['card_header'] = esc_html__( 'Premium add-on', 'wpglobus' );
311
+ $i18n['installed'] = esc_html__( 'Installed', 'wpglobus' );
312
+
313
+ wp_register_script(
314
+ 'wpglobus-plugin-install',
315
+ WPGlobus::$PLUGIN_DIR_URL . '/includes/js/wpglobus-plugin-install' . WPGlobus::SCRIPT_SUFFIX() . '.js',
316
+ array( 'jquery' ),
317
+ WPGLOBUS_VERSION,
318
+ true
319
+ );
320
+ wp_enqueue_script( 'wpglobus-plugin-install' );
321
+ wp_localize_script(
322
+ 'wpglobus-plugin-install',
323
+ 'WPGlobusPluginInstall',
324
+ array(
325
+ 'version' => WPGLOBUS_VERSION,
326
+ 'hookPage' => $hook_page,
327
+ 'pluginCard' => self::$plugin_card,
328
+ 'pluginData' => array_merge( self::$paid_plugins, self::$free_plugins ),
329
+ 'i18n' => $i18n,
330
+ )
331
+ );
332
+ }
333
+ }
334
+ }
335
+
336
+ endif;
trunk/includes/admin/customize/class-wpglobus-customize-themes.php ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WPGlobus Customize Themes.
4
+ *
5
+ * @package WPGlobus
6
+ * @since 1.9.12
7
+ */
8
+
9
+ /**
10
+ * Class WPGlobus_Customize_Themes.
11
+ */
12
+ if ( ! class_exists('WPGlobus_Customize_Themes') ) :
13
+
14
+ class WPGlobus_Customize_Themes {
15
+
16
+ /**
17
+ * Current theme.
18
+ */
19
+ protected static $current_theme = null;
20
+
21
+ /**
22
+ * Names of disabled themes in lowercase format.
23
+ *
24
+ * @var string[]
25
+ */
26
+ protected static $disabled_themes = array(
27
+ 'customizr',
28
+ 'customizr pro',
29
+ 'experon',
30
+ 'gwangi', // @since 2.3.12
31
+ );
32
+
33
+ /**
34
+ * Get disabled themes.
35
+ *
36
+ * @return string[]
37
+ */
38
+ public static function disabled_themes() {
39
+ $disabled_themes = self::$disabled_themes;
40
+ return $disabled_themes;
41
+ }
42
+
43
+ /**
44
+ * Get current theme name.
45
+ */
46
+ public static function current_theme() {
47
+ if ( is_null(self::$current_theme) ) {
48
+ self::$current_theme = wp_get_theme();
49
+ }
50
+ return self::get_theme( 'name' );
51
+ }
52
+
53
+ /**
54
+ * Get current theme or its property.
55
+ *
56
+ * @param string $param
57
+ *
58
+ * @return string|WP_Theme
59
+ */
60
+ public static function get_theme( $param = '' ) {
61
+ if ( is_null(self::$current_theme) ) {
62
+ self::$current_theme = wp_get_theme();
63
+ }
64
+ if ( 'name' === $param ) {
65
+ return self::$current_theme->name;
66
+ }
67
+
68
+ return self::$current_theme;
69
+
70
+ }
71
+
72
+ /**
73
+ * Get current theme in lowercase.
74
+ *
75
+ * @return string
76
+ */
77
+ public static function get_theme_name_lc() {
78
+ return strtolower( self::get_theme( 'name' ) );
79
+ }
80
+
81
+ }
82
+
83
+ endif;
trunk/includes/admin/customize/class-wpglobus-customize140.php ADDED
@@ -0,0 +1,282 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Multilingual Customizer
4
+ * @package WPGlobus\Admin\Customizer
5
+ * @since 1.4.0
6
+ */
7
+
8
+ if ( ! class_exists( 'WPGlobus_Customize' ) ) :
9
+
10
+ /**
11
+ * Class WPGlobus_Customize
12
+ */
13
+ class WPGlobus_Customize {
14
+
15
+ public static function controller() {
16
+ /**
17
+ * @see \WP_Customize_Manager::wp_loaded
18
+ * It calls the `customize_register` action first,
19
+ * and then - the `customize_preview_init` action
20
+ */
21
+ /*
22
+ add_action( 'customize_register', array(
23
+ 'WPGlobus_Customize',
24
+ 'action__customize_register'
25
+ ) ); */
26
+
27
+ /**
28
+ * @since 1.5.0
29
+ */
30
+ if ( WPGlobus_WP::is_pagenow( 'customize.php' ) ) {
31
+ require_once 'wpglobus-customize-filters.php';
32
+ }
33
+
34
+ add_action( 'customize_preview_init', array(
35
+ 'WPGlobus_Customize',
36
+ 'action__customize_preview_init'
37
+ ) );
38
+
39
+ /**
40
+ * This is called by wp-admin/customize.php
41
+ */
42
+ add_action( 'customize_controls_enqueue_scripts', array(
43
+ 'WPGlobus_Customize',
44
+ 'action__customize_controls_enqueue_scripts'
45
+ ), 1000 );
46
+
47
+ if ( WPGlobus_WP::is_admin_doing_ajax() ) {
48
+ add_filter( 'clean_url', array(
49
+ 'WPGlobus_Customize',
50
+ 'filter__clean_url'
51
+ ), 10, 2 );
52
+ }
53
+
54
+ }
55
+
56
+ /**
57
+ * Filter a string to check translations for URL.
58
+ * // We build multilingual URLs in customizer using the ':::' delimiter.
59
+ * We build multilingual URLs in customizer using the '|||' delimiter.
60
+ * See wpglobus-customize-control.js
61
+ *
62
+ * @note To work correctly, value of $url should begin with URL for default language.
63
+ * @see esc_url() - the 'clean_url' filter
64
+ * @since 1.3.0
65
+ *
66
+ * @param string $url The cleaned URL.
67
+ * @param string $original_url The URL prior to cleaning.
68
+ *
69
+ * @return string
70
+ */
71
+ public static function filter__clean_url( $url, $original_url ) {
72
+
73
+ if ( false !== strpos( $original_url, '|||' ) ) {
74
+ $arr1 = array();
75
+ $arr = explode( '|||', $original_url );
76
+ foreach ( $arr as $k => $val ) {
77
+ // Note: 'null' is a string, not real `null`.
78
+ if ( 'null' !== $val ) {
79
+ $arr1[ WPGlobus::Config()->enabled_languages[ $k ] ] = $val;
80
+ }
81
+ }
82
+ return WPGlobus_Utils::build_multilingual_string( $arr1 );
83
+ }
84
+
85
+ return $url;
86
+ }
87
+
88
+ /**
89
+ * Add multilingual controls.
90
+ * The original controls will be hidden.
91
+ * @param WP_Customize_Manager $wp_customize
92
+ */
93
+ public static function action__customize_register( WP_Customize_Manager $wp_customize ) {}
94
+
95
+ /**
96
+ * Load Customize Preview JS
97
+ * Used by hook: 'customize_preview_init'
98
+ * @see 'customize_preview_init'
99
+ */
100
+ public static function action__customize_preview_init() {
101
+ wp_enqueue_script(
102
+ 'wpglobus-customize-preview',
103
+ WPGlobus::$PLUGIN_DIR_URL . 'includes/js/wpglobus-customize-preview' .
104
+ WPGlobus::SCRIPT_SUFFIX() . '.js',
105
+ array( 'jquery', 'customize-preview' ),
106
+ WPGLOBUS_VERSION,
107
+ true
108
+ );
109
+ wp_localize_script(
110
+ 'wpglobus-customize-preview',
111
+ 'WPGlobusCustomize',
112
+ array(
113
+ 'version' => WPGLOBUS_VERSION,
114
+ 'blogname' => WPGlobus_Core::text_filter( get_option( 'blogname' ), WPGlobus::Config()->language ),
115
+ 'blogdescription' => WPGlobus_Core::text_filter( get_option( 'blogdescription' ), WPGlobus::Config()->language )
116
+ )
117
+ );
118
+ }
119
+
120
+ /**
121
+ * Load Customize Control JS
122
+ */
123
+ public static function action__customize_controls_enqueue_scripts() {
124
+
125
+ /**
126
+ * @see wp.customize.control elements
127
+ * for example wp.customize.control('blogname');
128
+ */
129
+ $disabled_setting_mask = array();
130
+
131
+ /** navigation menu elements */
132
+ $disabled_setting_mask[] = 'nav_menu_item';
133
+ $disabled_setting_mask[] = 'nav_menu[';
134
+ $disabled_setting_mask[] = 'nav_menu_locations';
135
+ $disabled_setting_mask[] = 'new_menu_name';
136
+
137
+ /** widgets */
138
+ $disabled_setting_mask[] = 'widgets';
139
+
140
+ /** color elements */
141
+ $disabled_setting_mask[] = 'color';
142
+
143
+ /** yoast seo */
144
+ $disabled_setting_mask[] = 'wpseo';
145
+
146
+ /** css elements */
147
+ $disabled_setting_mask[] = 'css';
148
+
149
+ /** social networks elements */
150
+ $disabled_setting_mask[] = 'facebook';
151
+ $disabled_setting_mask[] = 'twitter';
152
+ $disabled_setting_mask[] = 'linkedin';
153
+ $disabled_setting_mask[] = 'behance';
154
+ $disabled_setting_mask[] = 'dribbble';
155
+ $disabled_setting_mask[] = 'instagram';
156
+ /** since 1.4.4 */
157
+ $disabled_setting_mask[] = 'tumblr';
158
+ $disabled_setting_mask[] = 'flickr';
159
+ $disabled_setting_mask[] = 'wordpress';
160
+ $disabled_setting_mask[] = 'youtube';
161
+ $disabled_setting_mask[] = 'pinterest';
162
+ $disabled_setting_mask[] = 'github';
163
+ $disabled_setting_mask[] = 'rss';
164
+ $disabled_setting_mask[] = 'google';
165
+ $disabled_setting_mask[] = 'email';
166
+ /** since 1.5.9 */
167
+ $disabled_setting_mask[] = 'dropbox';
168
+ $disabled_setting_mask[] = 'foursquare';
169
+ $disabled_setting_mask[] = 'vine';
170
+ $disabled_setting_mask[] = 'vimeo';
171
+ /** since 1.6.0 */
172
+ $disabled_setting_mask[] = 'yelp';
173
+
174
+ /**
175
+ * Filter to disable fields in customizer.
176
+ * @see wp.customize.control elements
177
+ * Returning array.
178
+ * @since 1.4.0
179
+ *
180
+ * @param array $disabled_setting_mask An array of disabled masks.
181
+ */
182
+ $disabled_setting_mask = apply_filters( 'wpglobus_customize_disabled_setting_mask', $disabled_setting_mask );
183
+
184
+ $element_selector = array( 'input[type=text]', 'textarea' );
185
+
186
+ /**
187
+ * Filter for element selectors.
188
+ * Returning array.
189
+ * @since 1.4.0
190
+ *
191
+ * @param array $element_selector An array of selectors.
192
+ */
193
+ $element_selector = apply_filters( 'wpglobus_customize_element_selector', $element_selector );
194
+
195
+ $set_link_by = array( 'link', 'url' );
196
+
197
+ /**
198
+ * Filter of masks to determine links.
199
+ * @see value data-customize-setting-link of element
200
+ * Returning array.
201
+ * @since 1.4.0
202
+ *
203
+ * @param array $set_link_by An array of masks.
204
+ */
205
+ $set_link_by = apply_filters( 'wpglobus_customize_setlinkby', $set_link_by );
206
+
207
+ /**
208
+ * Filter of disabled sections.
209
+ *
210
+ * Returning array.
211
+ * @since 1.5.0
212
+ *
213
+ * @param array $disabled_sections An array of sections.
214
+ */
215
+ $disabled_sections = array();
216
+
217
+ $disabled_sections = apply_filters( 'wpglobus_customize_disabled_sections', $disabled_sections );
218
+
219
+ /**
220
+ * Generate language select button for customizer
221
+ * @since 1.6.0
222
+ *
223
+ * @todo http://stackoverflow.com/questions/9607252/how-to-detect-when-an-element-over-another-element-in-javascript
224
+ */
225
+ $attributes['href'] = '#';
226
+ $attributes['style'] = 'margin-left:48px;';
227
+ $attributes['class'] = 'customize-controls-close wpglobus-customize-selector';
228
+
229
+ /**
230
+ * Filter of attributes to generate language selector button.
231
+ * For example @see Divi theme http://www.elegantthemes.com/gallery/divi/ .
232
+ *
233
+ * Returning array.
234
+ * @since 1.6.0
235
+ *
236
+ * @param array $attributes An array of attributes.
237
+ * @param string Name of current theme.
238
+ */
239
+ $attributes = apply_filters( 'wpglobus_customize_language_selector_attrs', $attributes, WPGlobus_Customize_Options::get_theme( 'name' ) );
240
+
241
+ $string = '';
242
+
243
+ foreach ( $attributes as $attribute => $value ) {
244
+ if ( null !== $value ){
245
+ $string .= esc_attr( $attribute ) . '="' . esc_attr( $value ) . '" ';
246
+ }
247
+ }
248
+
249
+ $selector_button = sprintf(
250
+ '<a %1$s>%2$s</a>',
251
+ trim( $string ),
252
+ '<span class="wpglobus-globe"></span>'
253
+ );
254
+
255
+ wp_enqueue_script(
256
+ 'wpglobus-customize-control140',
257
+ WPGlobus::$PLUGIN_DIR_URL . 'includes/js/wpglobus-customize-control140' . WPGlobus::SCRIPT_SUFFIX() . '.js',
258
+ array( 'jquery' ),
259
+ WPGLOBUS_VERSION,
260
+ true
261
+ );
262
+ wp_localize_script(
263
+ 'wpglobus-customize-control140',
264
+ 'WPGlobusCustomize',
265
+ array(
266
+ 'version' => WPGLOBUS_VERSION,
267
+ 'selectorButton' => $selector_button,
268
+ 'languageAdmin' => WPGlobus::Config()->language,
269
+ 'disabledSettingMask' => $disabled_setting_mask,
270
+ 'elementSelector' => $element_selector,
271
+ 'setLinkBy' => $set_link_by,
272
+ 'disabledSections' => $disabled_sections,
273
+ 'controlClass' => 'wpglobus-customize-control',
274
+ )
275
+ );
276
+
277
+ }
278
+
279
+ } // class
280
+
281
+ endif;
282
+ # --- EOF
trunk/includes/admin/customize/class-wpglobus-customize170.php ADDED
@@ -0,0 +1,300 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Multilingual Customizer
4
+ * @package WPGlobus\Admin\Customizer
5
+ * @since 1.7.0
6
+ */
7
+
8
+ if ( ! class_exists( 'WPGlobus_Customize' ) ) :
9
+
10
+ /**
11
+ * Class WPGlobus_Customize
12
+ */
13
+ class WPGlobus_Customize {
14
+
15
+ public static function controller() {
16
+ /**
17
+ * @see \WP_Customize_Manager::wp_loaded
18
+ * It calls the `customize_register` action first,
19
+ * and then - the `customize_preview_init` action
20
+ */
21
+ /*
22
+ add_action( 'customize_register', array(
23
+ 'WPGlobus_Customize',
24
+ 'action__customize_register'
25
+ ) ); */
26
+
27
+ /**
28
+ * @since 1.5.0
29
+ */
30
+ if ( WPGlobus_WP::is_pagenow( 'customize.php' ) ) {
31
+ require_once 'wpglobus-customize-filters.php';
32
+ }
33
+
34
+ add_action( 'customize_preview_init', array(
35
+ 'WPGlobus_Customize',
36
+ 'action__customize_preview_init'
37
+ ) );
38
+
39
+ /**
40
+ * This is called by wp-admin/customize.php
41
+ */
42
+ add_action( 'customize_controls_enqueue_scripts', array(
43
+ 'WPGlobus_Customize',
44
+ 'action__customize_controls_enqueue_scripts'
45
+ ), 1000 );
46
+
47
+ if ( WPGlobus_WP::is_admin_doing_ajax() ) {
48
+ add_filter( 'clean_url', array(
49
+ 'WPGlobus_Customize',
50
+ 'filter__clean_url'
51
+ ), 10, 2 );
52
+ }
53
+
54
+ }
55
+
56
+ /**
57
+ * Filter a string to check translations for URL.
58
+ * // We build multilingual URLs in customizer using the ':::' delimiter.
59
+ * We build multilingual URLs in customizer using the '|||' delimiter.
60
+ * See wpglobus-customize-control.js
61
+ *
62
+ * @note To work correctly, value of $url should begin with URL for default language.
63
+ * @see esc_url() - the 'clean_url' filter
64
+ * @since 1.3.0
65
+ *
66
+ * @param string $url The cleaned URL.
67
+ * @param string $original_url The URL prior to cleaning.
68
+ *
69
+ * @return string
70
+ */
71
+ public static function filter__clean_url( $url, $original_url ) {
72
+
73
+ if ( false !== strpos( $original_url, '|||' ) ) {
74
+ $arr1 = array();
75
+ $arr = explode( '|||', $original_url );
76
+ foreach ( $arr as $k => $val ) {
77
+ // Note: 'null' is a string, not real `null`.
78
+ if ( 'null' !== $val ) {
79
+ $arr1[ WPGlobus::Config()->enabled_languages[ $k ] ] = $val;
80
+ }
81
+ }
82
+ return WPGlobus_Utils::build_multilingual_string( $arr1 );
83
+ }
84
+
85
+ return $url;
86
+ }
87
+
88
+ /**
89
+ * Add multilingual controls.
90
+ * The original controls will be hidden.
91
+ * @param WP_Customize_Manager $wp_customize
92
+ */
93
+ public static function action__customize_register( WP_Customize_Manager $wp_customize ) {}
94
+
95
+ /**
96
+ * Load Customize Preview JS
97
+ * Used by hook: 'customize_preview_init'
98
+ * @see 'customize_preview_init'
99
+ */
100
+ public static function action__customize_preview_init() {
101
+ wp_enqueue_script(
102
+ 'wpglobus-customize-preview',
103
+ WPGlobus::$PLUGIN_DIR_URL . 'includes/js/wpglobus-customize-preview' .
104
+ WPGlobus::SCRIPT_SUFFIX() . '.js',
105
+ array( 'jquery', 'customize-preview' ),
106
+ WPGLOBUS_VERSION,
107
+ true
108
+ );
109
+ wp_localize_script(
110
+ 'wpglobus-customize-preview',
111
+ 'WPGlobusCustomize',
112
+ array(
113
+ 'version' => WPGLOBUS_VERSION,
114
+ 'blogname' => WPGlobus_Core::text_filter( get_option( 'blogname' ), WPGlobus::Config()->language ),
115
+ 'blogdescription' => WPGlobus_Core::text_filter( get_option( 'blogdescription' ), WPGlobus::Config()->language )
116
+ )
117
+ );
118
+ }
119
+
120
+ /**
121
+ * Load Customize Control JS
122
+ */
123
+ public static function action__customize_controls_enqueue_scripts() {
124
+
125
+ /**
126
+ * @see wp.customize.control elements
127
+ * for example wp.customize.control('blogname');
128
+ */
129
+ $disabled_setting_mask = array();
130
+
131
+ /** navigation menu elements */
132
+ $disabled_setting_mask[] = 'nav_menu_item';
133
+ $disabled_setting_mask[] = 'nav_menu[';
134
+ $disabled_setting_mask[] = 'nav_menu_locations';
135
+ $disabled_setting_mask[] = 'new_menu_name';
136
+
137
+ /** widgets */
138
+ $disabled_setting_mask[] = 'widgets';
139
+
140
+ /** color elements */
141
+ $disabled_setting_mask[] = 'color';
142
+
143
+ /** yoast seo */
144
+ $disabled_setting_mask[] = 'wpseo';
145
+
146
+ /** css elements */
147
+ $disabled_setting_mask[] = 'css';
148
+
149
+ /** social networks elements */
150
+ $disabled_setting_mask[] = 'facebook';
151
+ $disabled_setting_mask[] = 'twitter';
152
+ $disabled_setting_mask[] = 'linkedin';
153
+ $disabled_setting_mask[] = 'behance';
154
+ $disabled_setting_mask[] = 'dribbble';
155
+ $disabled_setting_mask[] = 'instagram';
156
+ /** since 1.4.4 */
157
+ $disabled_setting_mask[] = 'tumblr';
158
+ $disabled_setting_mask[] = 'flickr';
159
+ $disabled_setting_mask[] = 'wordpress';
160
+ $disabled_setting_mask[] = 'youtube';
161
+ $disabled_setting_mask[] = 'pinterest';
162
+ $disabled_setting_mask[] = 'github';
163
+ $disabled_setting_mask[] = 'rss';
164
+ $disabled_setting_mask[] = 'google';
165
+ $disabled_setting_mask[] = 'email';
166
+ /** since 1.5.9 */
167
+ $disabled_setting_mask[] = 'dropbox';
168
+ $disabled_setting_mask[] = 'foursquare';
169
+ $disabled_setting_mask[] = 'vine';
170
+ $disabled_setting_mask[] = 'vimeo';
171
+ /** since 1.6.0 */
172
+ $disabled_setting_mask[] = 'yelp';
173
+
174
+ /**
175
+ * Exclude fields from Static Front Page section.
176
+ * It may be added to customizer in many themes.
177
+ *
178
+ * @since 1.7.6
179
+ */
180
+ $disabled_setting_mask[] = 'page_on_front';
181
+ $disabled_setting_mask[] = 'page_for_posts';
182
+
183
+ /**
184
+ * Filter to disable fields in customizer.
185
+ * @see wp.customize.control elements
186
+ * Returning array.
187
+ * @since 1.4.0
188
+ *
189
+ * @param array $disabled_setting_mask An array of disabled masks.
190
+ */
191
+ $disabled_setting_mask = apply_filters( 'wpglobus_customize_disabled_setting_mask', $disabled_setting_mask );
192
+
193
+ $element_selector = array( 'input[type=text]', 'textarea' );
194
+
195
+ /**
196
+ * Filter for element selectors.
197
+ * Returning array.
198
+ * @since 1.4.0
199
+ *
200
+ * @param array $element_selector An array of selectors.
201
+ */
202
+ $element_selector = apply_filters( 'wpglobus_customize_element_selector', $element_selector );
203
+
204
+ $set_link_by = array( 'link', 'url' );
205
+
206
+ /**
207
+ * Filter of masks to determine links.
208
+ * @see value data-customize-setting-link of element
209
+ * Returning array.
210
+ * @since 1.4.0
211
+ *
212
+ * @param array $set_link_by An array of masks.
213
+ */
214
+ $set_link_by = apply_filters( 'wpglobus_customize_setlinkby', $set_link_by );
215
+
216
+ /**
217
+ * Filter of disabled sections.
218
+ *
219
+ * Returning array.
220
+ * @since 1.5.0
221
+ *
222
+ * @param array $disabled_sections An array of sections.
223
+ */
224
+ $disabled_sections = array();
225
+
226
+ $disabled_sections = apply_filters( 'wpglobus_customize_disabled_sections', $disabled_sections );
227
+
228
+ /**
229
+ * Generate language select button for customizer
230
+ * @since 1.6.0
231
+ *
232
+ * @todo http://stackoverflow.com/questions/9607252/how-to-detect-when-an-element-over-another-element-in-javascript
233
+ */
234
+ $attributes['href'] = '#';
235
+ $attributes['style'] = 'margin-left:48px;';
236
+ $attributes['class'] = 'customize-controls-close wpglobus-customize-selector';
237
+
238
+ /**
239
+ * Filter of attributes to generate language selector button.
240
+ * For example @see Divi theme http://www.elegantthemes.com/gallery/divi/ .
241
+ *
242
+ * Returning array.
243
+ * @since 1.6.0
244
+ *
245
+ * @param array $attributes An array of attributes.
246
+ * @param string Name of current theme.
247
+ */
248
+ $attributes = apply_filters( 'wpglobus_customize_language_selector_attrs', $attributes, WPGlobus_Customize_Options::get_theme( 'name' ) );
249
+
250
+ $string = '';
251
+
252
+ foreach ( $attributes as $attribute => $value ) {
253
+ if ( null !== $value ){
254
+ $string .= esc_attr( $attribute ) . '="' . esc_attr( $value ) . '" ';
255
+ }
256
+ }
257
+
258
+ $selector_button = sprintf(
259
+ '<a %1$s>%2$s</a>',
260
+ trim( $string ),
261
+ '<span class="wpglobus-globe"></span>'
262
+ );
263
+
264
+ /**
265
+ * Since 1.7.9
266
+ */
267
+ $changeset_uuid = null;
268
+ if ( ! empty( $_GET['changeset_uuid'] ) ) { // WPCS: input var ok, sanitization ok.
269
+ $changeset_uuid = sanitize_text_field( wp_unslash( $_GET['changeset_uuid'] ) ); // WPCS: input var ok.
270
+ }
271
+
272
+ wp_enqueue_script(
273
+ 'wpglobus-customize-control170',
274
+ WPGlobus::$PLUGIN_DIR_URL . 'includes/js/wpglobus-customize-control170' . WPGlobus::SCRIPT_SUFFIX() . '.js',
275
+ array( 'jquery' ),
276
+ WPGLOBUS_VERSION,
277
+ true
278
+ );
279
+ wp_localize_script(
280
+ 'wpglobus-customize-control170',
281
+ 'WPGlobusCustomize',
282
+ array(
283
+ 'version' => WPGLOBUS_VERSION,
284
+ 'selectorButton' => $selector_button,
285
+ 'languageAdmin' => WPGlobus::Config()->language,
286
+ 'disabledSettingMask' => $disabled_setting_mask,
287
+ 'elementSelector' => $element_selector,
288
+ 'setLinkBy' => $set_link_by,
289
+ 'disabledSections' => $disabled_sections,
290
+ 'controlClass' => 'wpglobus-customize-control',
291
+ 'changeset_uuid' => $changeset_uuid
292
+ )
293
+ );
294
+
295
+ }
296
+
297
+ } // class
298
+
299
+ endif;
300
+ # --- EOF
trunk/includes/admin/customize/class-wpglobus-customize190.php ADDED
@@ -0,0 +1,555 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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controller.
19
+ */
20
+ public static function controller() {
21
+
22
+ add_action( 'admin_init', array( __CLASS__, 'on__admin_init' ), 1 );
23
+
24
+ /**
25
+ * It calls the `customize_register` action first,
26
+ * and then - the `customize_preview_init` action.
27
+ *
28
+ * @see \WP_Customize_Manager::wp_loaded
29
+ *
30
+ * add_action( 'customize_register', array(
31
+ * 'WPGlobus_Customize',
32
+ * 'action__customize_register'
33
+ * ) );
34
+ */
35
+
36
+ /**
37
+ * Customizer filters.
38
+ *
39
+ * @since 1.5.0
40
+ */
41
+ if ( WPGlobus_WP::is_pagenow( 'customize.php' ) ) {
42
+ require_once 'wpglobus-customize-filters.php';
43
+ }
44
+
45
+ add_action(
46
+ 'customize_preview_init',
47
+ array( 'WPGlobus_Customize', 'action__customize_preview_init' )
48
+ );
49
+
50
+ /**
51
+ * This is called by wp-admin/customize.php
52
+ */
53
+ add_action(
54
+ 'customize_controls_enqueue_scripts',
55
+ array( 'WPGlobus_Customize', 'action__customize_controls_enqueue_scripts' ),
56
+ 1000
57
+ );
58
+
59
+ if ( WPGlobus_WP::is_admin_doing_ajax() ) {
60
+ add_filter(
61
+ 'clean_url',
62
+ array( 'WPGlobus_Customize', 'filter__clean_url' ),
63
+ 10,
64
+ 2
65
+ );
66
+ }
67
+
68
+ /**
69
+ * Filter customize_changeset_save_data.
70
+ *
71
+ * @see wp-includes\class-wp-customize-manager.php
72
+ * @since 1.9.3
73
+ */
74
+ add_filter(
75
+ 'customize_changeset_save_data',
76
+ array( __CLASS__, 'filter__customize_changeset_save_data' ),
77
+ 1,
78
+ 2
79
+ );
80
+
81
+ }
82
+
83
+ /**
84
+ * Action on admin init.
85
+ *
86
+ * @since 1.9.3
87
+ */
88
+ public static function on__admin_init() {
89
+
90
+ $excluded_mods = array(
91
+ '0',
92
+ 'nav_menu_locations',
93
+ 'sidebars_widgets',
94
+ 'custom_css_post_id',
95
+ 'wpglobus_blogname',
96
+ 'wpglobus_blogdescription',
97
+ );
98
+
99
+ $mods = get_theme_mods();
100
+
101
+ $filtered_mods = array();
102
+
103
+ if ( $mods ) {
104
+ foreach ( $mods as $mod_key => $mod_value ) {
105
+
106
+ if ( in_array( $mod_key, $excluded_mods, true ) ) {
107
+ continue;
108
+ }
109
+
110
+ if ( ! is_string( $mod_value ) ) {
111
+ continue;
112
+ }
113
+
114
+ $filtered_mods[ $mod_key ] = $mod_value;
115
+
116
+ }
117
+ }
118
+
119
+ /**
120
+ * Filters the theme mods before save.
121
+ *
122
+ * @since 1.9.3
123
+ *
124
+ * @param array $filtered_mods Filtered theme modifications.
125
+ * @param array|void $mods Theme modifications.
126
+ */
127
+ $filtered_mods = apply_filters( 'wpglobus_customize_filtered_mods', $filtered_mods, $mods );
128
+
129
+ foreach ( $filtered_mods as $mod_key => $mod_value ) {
130
+
131
+ /**
132
+ * Filter {@see filter "pre_set_theme_mod_{$name}" in \wp-includes\theme.php}.
133
+ */
134
+ add_filter(
135
+ "pre_set_theme_mod_{$mod_key}",
136
+ array( __CLASS__, 'filter__pre_set_theme_mod' ),
137
+ 1,
138
+ 2
139
+ );
140
+
141
+ }
142
+ }
143
+
144
+ /**
145
+ * Filter a theme mod.
146
+ *
147
+ * @since 1.9.3
148
+ *
149
+ * @param string $value The value.
150
+ * @param string $old_value Unused.
151
+ *
152
+ * @return bool|string
153
+ */
154
+ public static function filter__pre_set_theme_mod(
155
+ $value,
156
+ /**
157
+ * Unused.
158
+ *
159
+ * @noinspection PhpUnusedParameterInspection
160
+ */
161
+ $old_value
162
+ ) {
163
+
164
+ if ( ! is_string( $value ) ) {
165
+ return $value;
166
+ }
167
+
168
+ $new_value = self::_build_multilingual_string( $value );
169
+
170
+ if ( $new_value ) {
171
+ return $new_value;
172
+ }
173
+
174
+ return $value;
175
+
176
+ }
177
+
178
+ /**
179
+ * Save/update a changeset.
180
+ *
181
+ * @since 1.9.3
182
+ *
183
+ * @param array $data The data.
184
+ * @param string $filter_context Unused.
185
+ *
186
+ * @return mixed
187
+ */
188
+ public static function filter__customize_changeset_save_data(
189
+ $data,
190
+ /**
191
+ * Unused.
192
+ *
193
+ * @noinspection PhpUnusedParameterInspection
194
+ */
195
+ $filter_context
196
+ ) {
197
+
198
+ foreach ( $data as $option => $value ) {
199
+
200
+ $new_value = self::_build_multilingual_string( $value['value'] );
201
+
202
+ if ( $new_value ) {
203
+ $data[ $option ]['value'] = $new_value;
204
+ }
205
+ }
206
+
207
+ return $data;
208
+
209
+ }
210
+
211
+ /**
212
+ * Build standard WPGlobus multilingual string.
213
+ *
214
+ * @since 1.9.3
215
+ *
216
+ * @param string $value The value.
217
+ *
218
+ * @return bool|string
219
+ */
220
+ public static function _build_multilingual_string( $value ) { // phpcs:ignore PSR2.Methods.MethodDeclaration.Underscore
221
+
222
+ /**
223
+ * Ignore if not a string.
224
+ *
225
+ * @since 1.9.6
226
+ */
227
+ if ( ! is_string( $value ) ) {
228
+ return $value;
229
+ }
230
+
231
+ // $new_value = '';
232
+
233
+ if ( false === strpos( $value, '|||' ) ) {
234
+ $new_value = false;
235
+ } else {
236
+
237
+ $arr1 = array();
238
+ $arr = explode( '|||', $value );
239
+ foreach ( $arr as $k => $val ) {
240
+ // Note: 'null' is a string, not real `null`.
241
+ if ( 'null' !== $val ) {
242
+ $arr1[ WPGlobus::Config()->enabled_languages[ $k ] ] = $val;
243
+ }
244
+ }
245
+
246
+ $new_value = WPGlobus_Utils::build_multilingual_string( $arr1 );
247
+
248
+ }
249
+
250
+ return $new_value;
251
+
252
+ }
253
+
254
+ /**
255
+ * Filter a string to check translations for URL.
256
+ * // We build multilingual URLs in customizer using the ':::' delimiter.
257
+ * We build multilingual URLs in customizer using the '|||' delimiter.
258
+ * See wpglobus-customize-control.js
259
+ *
260
+ * @note To work correctly, value of $url should begin with URL for default language.
261
+ * @see esc_url() - the 'clean_url' filter
262
+ * @since 1.3.0
263
+ *
264
+ * @param string $url The cleaned URL.
265
+ * @param string $original_url The URL prior to cleaning.
266
+ *
267
+ * @return string
268
+ */
269
+ public static function filter__clean_url( $url, $original_url ) {
270
+
271
+ if ( false !== strpos( $original_url, '|||' ) ) {
272
+ $arr1 = array();
273
+ $arr = explode( '|||', $original_url );
274
+ foreach ( $arr as $k => $val ) {
275
+ // Note: 'null' is a string, not real `null`.
276
+ if ( 'null' !== $val ) {
277
+ $arr1[ WPGlobus::Config()->enabled_languages[ $k ] ] = $val;
278
+ }
279
+ }
280
+
281
+ return WPGlobus_Utils::build_multilingual_string( $arr1 );
282
+ }
283
+
284
+ return $url;
285
+ }
286
+
287
+ /**
288
+ * Add multilingual controls.
289
+ * The original controls will be hidden.
290
+ *
291
+ * @param WP_Customize_Manager $wp_customize Customize Manager.
292
+ */
293
+ public static function action__customize_register( WP_Customize_Manager $wp_customize ) {
294
+ }
295
+
296
+ /**
297
+ * Load Customize Preview JS
298
+ * Used by hook: 'customize_preview_init'
299
+ *
300
+ * @see 'customize_preview_init'
301
+ */
302
+ public static function action__customize_preview_init() {
303
+ wp_enqueue_script(
304
+ 'wpglobus-customize-preview',
305
+ WPGlobus::plugin_dir_url() . 'includes/js/wpglobus-customize-preview' .
306
+ WPGlobus::SCRIPT_SUFFIX() . '.js',
307
+ array( 'jquery', 'customize-preview' ),
308
+ WPGLOBUS_VERSION,
309
+ true
310
+ );
311
+ wp_localize_script(
312
+ 'wpglobus-customize-preview',
313
+ 'WPGlobusCustomize',
314
+ array(
315
+ 'version' => WPGLOBUS_VERSION,
316
+ 'blogname' => WPGlobus_Core::text_filter( get_option( 'blogname' ), WPGlobus::Config()->language ),
317
+ 'blogdescription' => WPGlobus_Core::text_filter( get_option( 'blogdescription' ), WPGlobus::Config()->language ),
318
+ )
319
+ );
320
+ }
321
+
322
+ /**
323
+ * Load Customize Control JS
324
+ */
325
+ public static function action__customize_controls_enqueue_scripts() {
326
+
327
+ global $wp_version;
328
+
329
+ /**
330
+ * See wp.customize.control elements
331
+ * for example wp.customize.control('blogname');
332
+ */
333
+ $disabled_setting_mask = array();
334
+
335
+ // navigation menu elements.
336
+ $disabled_setting_mask[] = 'nav_menu_item';
337
+ $disabled_setting_mask[] = 'nav_menu[';
338
+ $disabled_setting_mask[] = 'nav_menu_locations';
339
+ $disabled_setting_mask[] = 'new_menu_name';
340
+
341
+ // widgets.
342
+ $disabled_setting_mask[] = 'widgets';
343
+
344
+ // color elements.
345
+ $disabled_setting_mask[] = 'color';
346
+
347
+ // yoast seo.
348
+ $disabled_setting_mask[] = 'wpseo';
349
+
350
+ // css elements.
351
+ $disabled_setting_mask[] = 'css';
352
+
353
+ // social networks elements.
354
+ $disabled_setting_mask[] = 'facebook';
355
+ $disabled_setting_mask[] = 'twitter';
356
+ $disabled_setting_mask[] = 'linkedin';
357
+ $disabled_setting_mask[] = 'behance';
358
+ $disabled_setting_mask[] = 'dribbble';
359
+ $disabled_setting_mask[] = 'instagram';
360
+ /**
361
+ * Tumblr.
362
+ *
363
+ * @since 1.4.4
364
+ */
365
+ $disabled_setting_mask[] = 'tumblr';
366
+ $disabled_setting_mask[] = 'flickr';
367
+ $disabled_setting_mask[] = 'wordpress'; // phpcs:ignore WordPress.WP.CapitalPDangit.Misspelled
368
+ $disabled_setting_mask[] = 'youtube';
369
+ $disabled_setting_mask[] = 'pinterest';
370
+ $disabled_setting_mask[] = 'github';
371
+ $disabled_setting_mask[] = 'rss';
372
+ $disabled_setting_mask[] = 'google';
373
+ $disabled_setting_mask[] = 'email';
374
+ /**
375
+ * Dropbox.
376
+ *
377
+ * @since 1.5.9
378
+ */
379
+ $disabled_setting_mask[] = 'dropbox';
380
+ $disabled_setting_mask[] = 'foursquare';
381
+ $disabled_setting_mask[] = 'vine';
382
+ $disabled_setting_mask[] = 'vimeo';
383
+ /**
384
+ * Yelp.
385
+ *
386
+ * @since 1.6.0
387
+ */
388
+ $disabled_setting_mask[] = 'yelp';
389
+
390
+ /**
391
+ * Exclude fields from Static Front Page section.
392
+ * It may be added to customizer in many themes.
393
+ *
394
+ * @since 1.7.6
395
+ */
396
+ $disabled_setting_mask[] = 'page_on_front';
397
+ $disabled_setting_mask[] = 'page_for_posts';
398
+
399
+ /**
400
+ * Filter to disable fields in customizer.
401
+ * See wp.customize.control elements
402
+ * Returning array.
403
+ *
404
+ * @since 1.4.0
405
+ *
406
+ * @param array $disabled_setting_mask An array of disabled masks.
407
+ */
408
+ $disabled_setting_mask = apply_filters( 'wpglobus_customize_disabled_setting_mask', $disabled_setting_mask );
409
+
410
+ $element_selector = array( 'input[type=text]', 'textarea' );
411
+
412
+ /**
413
+ * Filter for element selectors.
414
+ * Returning array.
415
+ *
416
+ * @since 1.4.0
417
+ *
418
+ * @param array $element_selector An array of selectors.
419
+ */
420
+ $element_selector = apply_filters( 'wpglobus_customize_element_selector', $element_selector );
421
+
422
+ $set_link_by = array( 'link', 'url' );
423
+
424
+ /**
425
+ * Filter of masks to determine links.
426
+ * See value data-customize-setting-link of element
427
+ * Returning array.
428
+ *
429
+ * @since 1.4.0
430
+ *
431
+ * @param array $set_link_by An array of masks.
432
+ */
433
+ $set_link_by = apply_filters( 'wpglobus_customize_setlinkby', $set_link_by );
434
+
435
+ /**
436
+ * Filter of disabled sections.
437
+ *
438
+ * Returning array.
439
+ *
440
+ * @since 1.5.0
441
+ *
442
+ * @param array $disabled_sections An array of sections.
443
+ */
444
+ $disabled_sections = array();
445
+
446
+ $disabled_sections = apply_filters( 'wpglobus_customize_disabled_sections', $disabled_sections );
447
+
448
+ /**
449
+ * Generate language select button for customizer
450
+ *
451
+ * @since 1.6.0
452
+ *
453
+ * @todo http://stackoverflow.com/questions/9607252/how-to-detect-when-an-element-over-another-element-in-javascript
454
+ */
455
+ $attributes['href'] = '#';
456
+ $attributes['style'] = 'margin-left:48px;';
457
+ $attributes['class'] = 'customize-controls-close wpglobus-customize-selector';
458
+
459
+ /**
460
+ * Filter of attributes to generate language selector button.
461
+ * For example @see Divi theme http://www.elegantthemes.com/gallery/divi/ .
462
+ *
463
+ * Returning array.
464
+ *
465
+ * @since 1.6.0
466
+ *
467
+ * @param array $attributes An array of attributes.
468
+ * @param string Name of current theme.
469
+ */
470
+ $attributes = apply_filters( 'wpglobus_customize_language_selector_attrs', $attributes, WPGlobus_Customize_Options::get_theme( 'name' ) );
471
+
472
+ $string = '';
473
+
474
+ foreach ( $attributes as $attribute => $value ) {
475
+ if ( null !== $value ) {
476
+ $string .= esc_attr( $attribute ) . '="' . esc_attr( $value ) . '" ';
477
+ }
478
+ }
479
+
480
+ $selector_button = sprintf(
481
+ '<a %1$s data-language="' . WPGlobus::Config()->default_language . '">%2$s</a>',
482
+ trim( $string ),
483
+ '<span class="wpglobus-globe"></span>'
484
+ );
485
+
486
+ /**
487
+ * Since 1.7.9
488
+ */
489
+ $changeset_uuid = null;
490
+ if ( ! empty( $_GET['changeset_uuid'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
491
+ $changeset_uuid = sanitize_text_field( wp_unslash( $_GET['changeset_uuid'] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
492
+ }
493
+
494
+ /**
495
+ * Since 1.9.0
496
+ */
497
+ $selector_type = 'dropdown';
498
+ $selector_types = array( 'dropdown', 'switch' );
499
+
500
+ /**
501
+ * Filter selector type.
502
+ *
503
+ * @since 1.9.0
504
+ *
505
+ * @param string $selector_type Name of the current selector type.
506
+ * @param array $selector_types An array of existing selector types.
507
+ *
508
+ * @return string
509
+ */
510
+ $selector_type = apply_filters( 'wpglobus_customize_language_selector_type', $selector_type, $selector_types );
511
+
512
+ if ( ! in_array( $selector_type, $selector_types, true ) ) {
513
+ $selector_type = 'dropdown';
514
+ }
515
+
516
+ /**
517
+ * Adjust for WP 5.2+.
518
+ *
519
+ * @since 2.2.0
520
+ */
521
+ $selector_html = '<span style="margin-left:5px;" class="wpglobus-icon-globe"></span><span class="current-language" style="font-weight:bold;">{{language}}</span>';
522
+ if ( version_compare( $wp_version, '5.1.999', '>' ) ) {
523
+ $selector_html = '<span style="position:fixed;top:-7px;">' . $selector_html . '</span>';
524
+ }
525
+
526
+ wp_enqueue_script(
527
+ 'wpglobus-customize-control190',
528
+ WPGlobus::plugin_dir_url() . 'includes/js/wpglobus-customize-control190' . WPGlobus::SCRIPT_SUFFIX() . '.js',
529
+ array( 'jquery' ),
530
+ WPGLOBUS_VERSION,
531
+ true
532
+ );
533
+ wp_localize_script(
534
+ 'wpglobus-customize-control190',
535
+ 'WPGlobusCustomize',
536
+ array(
537
+ 'version' => WPGLOBUS_VERSION,
538
+ 'selectorType' => $selector_type,
539
+ 'selectorButton' => $selector_button,
540
+ 'languageAdmin' => WPGlobus::Config()->language,
541
+ 'disabledSettingMask' => $disabled_setting_mask,
542
+ 'elementSelector' => $element_selector,
543
+ 'setLinkBy' => $set_link_by,
544
+ 'disabledSections' => $disabled_sections,
545
+ 'controlClass' => 'wpglobus-customize-control',
546
+ 'changeset_uuid' => $changeset_uuid,
547
+ 'selector_html' => $selector_html,
548
+ )
549
+ );
550
+
551
+ }
552
+
553
+ } // class
554
+
555
+ endif;
trunk/includes/admin/customize/wpglobus-customize-filters.php ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Filters for customizer
4
+ *
5
+ * All add_filter and add_action calls should be placed here
6
+ *
7
+ * @package WPGlobus\Admin\Customizer
8
+ */
9
+ add_filter( 'wpglobus_customize_disabled_sections', array( 'WPGlobus_Customize_Filters', 'disable_sections' ) );
10
+
11
+ if ( ! class_exists( 'WPGlobus_Customize_Filters' ) ) :
12
+
13
+ /**
14
+ * Class WPGlobus_Customize_Filters
15
+ */
16
+ class WPGlobus_Customize_Filters {
17
+
18
+ /**
19
+ * Disable sections in customizer.
20
+ *
21
+ * @param array $disabled_sections
22
+ *
23
+ * @return array
24
+ */
25
+ public static function disable_sections( $disabled_sections ) {
26
+
27
+ if ( class_exists( 'Easy_Google_Fonts' ) ) {
28
+ /**
29
+ * @see https://wordpress.org/plugins/easy-google-fonts/
30
+ */
31
+ $disabled_sections[] = 'tt_font_typography';
32
+ }
33
+
34
+ /**
35
+ * @since 2.2.30
36
+ */
37
+ if ( defined( 'GFP_VERSION' ) // premium
38
+ ||
39
+ defined( 'OGF_VERSION' ) // free
40
+ ) {
41
+ /**
42
+ * @see premium https://fontsplugin.com/
43
+ * @see free https://wordpress.org/plugins/olympus-google-fonts/
44
+ */
45
+ $disabled_sections[] = 'ogf_custom';
46
+ $disabled_sections[] = 'ogf_advanced__css';
47
+ }
48
+
49
+ /**
50
+ * @since 2.2.28
51
+ */
52
+ if ( class_exists( 'WPGlobus_Customize_Themes' ) ) {
53
+
54
+ /**
55
+ * @see W.I.P. `Prevent using element with no id attribute` in includes\js\wpglobus-customize-control190.js
56
+ * to getting sections for disabling.
57
+ */
58
+ $theme_name = WPGlobus_Customize_Themes::get_theme_name_lc();
59
+
60
+ if ( 'startkit' == $theme_name ) {
61
+ /**
62
+ * @see https://wordpress.org/themes/startkit/
63
+ */
64
+ $disabled_sections[] = 'slider_setting';
65
+ $disabled_sections[] = 'service_setting';
66
+ $disabled_sections[] = 'testimonial_setting';
67
+ $disabled_sections[] = 'footer_icon';
68
+ $disabled_sections[] = 'Body_typography';
69
+ $disabled_sections[] = 'paragraph_typography';
70
+ $disabled_sections[] = 'H1_typography';
71
+ $disabled_sections[] = 'H2_typography';
72
+ $disabled_sections[] = 'H3_typography';
73
+ $disabled_sections[] = 'H4_typography';
74
+ $disabled_sections[] = 'H5_typography';
75
+ $disabled_sections[] = 'H6_typography';
76
+ $disabled_sections[] = 'menu_typography';
77
+ $disabled_sections[] = 'section_typography';
78
+ }
79
+ }
80
+
81
+ return $disabled_sections;
82
+
83
+ }
84
+
85
+ }
86
+
87
+ endif;
trunk/includes/admin/customize/wpglobus-customize.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * File: wpglobus-customize.php
4
+ *
5
+ * @package WPGlobus\Admin\Customizer
6
+ */
7
+
8
+ global $wp_version;
9
+
10
+ if ( !defined('WPGLOBUS_CUSTOMIZE') || WPGLOBUS_CUSTOMIZE ) {
11
+
12
+ if ( version_compare( $wp_version, '4.9-Beta1', '>=' ) ) {
13
+ require_once 'class-wpglobus-customize190.php';
14
+ } else if( version_compare( $wp_version, '4.6', '>=' ) ) {
15
+ require_once 'class-wpglobus-customize170.php';
16
+ } else {
17
+ require_once 'class-wpglobus-customize140.php';
18
+ }
19
+ WPGlobus_Customize::controller();
20
+
21
+ }
22
+ # --- EOF
trunk/includes/admin/debug/class-wpglobus-admin-debug.php ADDED
@@ -0,0 +1,366 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WPGlobus/Admin/Debug.
4
+ *
5
+ * @package WPGlobus\Admin
6
+ */
7
+
8
+ if ( ! class_exists( 'WPGlobus_Admin_Debug' ) ) :
9
+
10
+ /**
11
+ * Class WPGlobus_Admin_Debug.
12
+ *
13
+ * @since 1.8.1
14
+ */
15
+ class WPGlobus_Admin_Debug {
16
+
17
+ /**
18
+ * Instance.
19
+ *
20
+ * @var WPGlobus_Admin_Debug
21
+ */
22
+ protected static $instance;
23
+
24
+ /**
25
+ * Debug mode.
26
+ * @since 2.2.35
27
+ */
28
+ protected static $mode = 'godmode';
29
+
30
+ /**
31
+ * Key.
32
+ * @since 2.2.35
33
+ */
34
+ protected static $key = '';
35
+
36
+ /**
37
+ * Get instance.
38
+ */
39
+ public static function get_instance() {
40
+ if ( null === self::$instance ) {
41
+ self::$instance = new self();
42
+ }
43
+
44
+ return self::$instance;
45
+ }
46
+
47
+ /**
48
+ * Constructor.
49
+ */
50
+ public function __construct() {
51
+
52
+ if ( 'meta' == $_GET['wpglobus-debug'] ) { // WPCS: input var ok, sanitization ok.
53
+ self::$mode = 'meta';
54
+ } else if ( 'wpglobus_options' == $_GET['wpglobus-debug'] || 'wpglobus-options' == $_GET['wpglobus-debug'] ) { // WPCS: input var ok, sanitization ok.
55
+ self::$mode = 'wpglobus_options';
56
+ } else if ( 'yoast' == $_GET['wpglobus-debug'] ) { // WPCS: input var ok, sanitization ok.
57
+ self::$mode = 'yoast';
58
+ }
59
+
60
+ if ( 'godmode' !== self::$mode ) {
61
+ if ( ! empty( $_GET['key'] ) ) { // WPCS: input var ok, sanitization ok. )
62
+ self::$key = sanitize_text_field($_GET['key']);
63
+ }
64
+ }
65
+
66
+ /**
67
+ * Action.
68
+ *
69
+ * @scope admin
70
+ * @since 1.8.1
71
+ */
72
+ add_action( 'admin_print_scripts', array( $this, 'on__admin_scripts' ), 99 );
73
+
74
+ /**
75
+ * Action.
76
+ *
77
+ * @scope admin
78
+ * @since 1.8.1
79
+ */
80
+ add_action( 'admin_print_styles', array( $this, 'on__admin_styles' ), 99 );
81
+
82
+ /**
83
+ * Action.
84
+ *
85
+ * @scope admin
86
+ * @since 1.8.1
87
+ */
88
+ add_action( 'admin_footer', array( $this, 'on__admin_footer' ), 9999 );
89
+
90
+ }
91
+
92
+ /**
93
+ * @since 2.2.35
94
+ */
95
+ public function is_enabled_section($section) {
96
+ if ( 'godmode' == self::$mode ) {
97
+ return true;
98
+ }
99
+ if ( $section == self::$mode ) {
100
+ return true;
101
+ }
102
+ return false;
103
+ }
104
+
105
+ /**
106
+ * Enqueue admin styles.
107
+ *
108
+ * @scope admin
109
+ * @since 1.8.1
110
+ */
111
+ public function on__admin_styles() {
112
+
113
+ wp_register_style(
114
+ 'wpglobus-admin-debug',
115
+ WPGlobus::plugin_dir_url() . 'includes/css/wpglobus-admin-debug.css',
116
+ array(),
117
+ WPGLOBUS_VERSION
118
+ );
119
+ wp_enqueue_style( 'wpglobus-admin-debug' );
120
+
121
+ }
122
+
123
+ /**
124
+ * Enqueue admin scripts.
125
+ *
126
+ * @scope admin
127
+ * @since 1.8.1
128
+ */
129
+ public function on__admin_scripts() {
130
+
131
+ wp_register_script(
132
+ 'wpglobus-admin-debug',
133
+ WPGlobus::plugin_dir_url() . 'includes/js/wpglobus-admin-debug' . WPGlobus::SCRIPT_SUFFIX() . '.js',
134
+ array( 'jquery' ),
135
+ WPGLOBUS_VERSION,
136
+ true
137
+ );
138
+ wp_enqueue_script( 'wpglobus-admin-debug' );
139
+ wp_localize_script(
140
+ 'wpglobus-admin-debug',
141
+ 'WPGlobusAdminDebug',
142
+ array(
143
+ 'version' => WPGLOBUS_VERSION,
144
+ 'data' => '',
145
+ )
146
+ );
147
+
148
+ }
149
+
150
+ /**
151
+ * Output table.
152
+ *
153
+ * @scope admin
154
+ * @since 1.8.1
155
+ */
156
+ public function on__admin_footer() {
157
+
158
+ global $wpdb, $post, $pagenow;
159
+
160
+ if ( 'post.php' == $pagenow ) {
161
+ if ( is_object( $post ) ) {
162
+ /**
163
+ * post.php page.
164
+ */
165
+ if ( empty( $post->ID ) || 0 === (int) $post->ID ) {
166
+ return;
167
+ }
168
+
169
+ /**
170
+ * Get metadata.
171
+ *
172
+ * @var array $metas
173
+ */
174
+ $meta_query = $wpdb->prepare( "SELECT meta_key, meta_value FROM $wpdb->postmeta WHERE post_id = %d", $post->ID );
175
+ $_id = $post->ID;
176
+ $meta_query_caption = "SELECT meta_key, meta_value FROM $wpdb->postmeta WHERE post_id = $_id";
177
+ $metas = $wpdb->get_results( $meta_query, ARRAY_A );
178
+ }
179
+ } else if ( 'term.php' == $pagenow ) {
180
+
181
+ if ( empty( $_GET['tag_ID'] ) ) {
182
+ return;
183
+ }
184
+
185
+ $_id = sanitize_text_field( $_GET['tag_ID'] );
186
+
187
+ /**
188
+ * Get metadata.
189
+ *
190
+ * @var array $metas
191
+ */
192
+ $meta_query = $wpdb->prepare( "SELECT meta_key, meta_value FROM $wpdb->termmeta WHERE term_id = %d", $_id );
193
+ $meta_query_caption = "SELECT meta_key, meta_value FROM $wpdb->termmeta WHERE term_id = $_id";
194
+ $metas = $wpdb->get_results( $meta_query, ARRAY_A );
195
+ } else {
196
+ return;
197
+ }
198
+
199
+ ?>
200
+ <div id="wpglobus-admin-debug-box" class="" style="display:none;">
201
+ <h4>WPGlobus debug box</h4>
202
+ <?php
203
+ if ( $this->is_enabled_section('yoast') ) :
204
+ /**
205
+ * Output yoast options.
206
+ */
207
+ if ( empty( self::$key ) ) {
208
+ $query = $wpdb->prepare( "SELECT * FROM $wpdb->options WHERE option_name LIKE '%s' OR option_name LIKE '%s'", '%wpseo%', '%yoast%' );
209
+ $query_caption = "SELECT * FROM $wpdb->options WHERE option_name LIKE '%wpseo%' OR option_name LIKE '%yoast%'";
210
+ } else {
211
+ $query = $wpdb->prepare( "SELECT * FROM $wpdb->options WHERE option_name = %s", self::$key );
212
+ $_key = self::$key;
213
+ $query_caption = "SELECT * FROM $wpdb->options WHERE option_name = $_key";
214
+ }
215
+ $results = $wpdb->get_results( $query );
216
+ ?>
217
+ <table class="table1" cellspacing="0">
218
+ <caption><strong><?php echo '"' . $query_caption . '"'; ?></strong></caption>
219
+ <thead>
220
+ <tr>
221
+ <th><strong>№</strong></th>
222
+ <th><strong>option name</strong></th>
223
+ <th><strong>value</strong></th>
224
+ </tr>
225
+ </thead>
226
+ <tbody>
227
+ <?php
228
+ $order = 1;
229
+
230
+ foreach ( $results as $key=>$value ) {
231
+ $code = false;
232
+ //if ( is_array( $meta ) ) {
233
+ //$results[$key]['meta_key'] = htmlspecialchars( $meta['meta_value'] );
234
+ //}
235
+ $args = $_GET;
236
+ if ( empty( self::$key ) ) {
237
+ $args['wpglobus-debug'] = 'yoast';
238
+ $args = array_merge( $args, array('key'=>$value->option_name) );
239
+ $_url = admin_url( add_query_arg( $args, $pagenow ) );
240
+ } else {
241
+ $_url = admin_url( add_query_arg( $args, $pagenow ) );
242
+ }
243
+ ?>
244
+ <tr>
245
+ <td><?php echo esc_html( $order ); ?></td>
246
+ <td><?php echo sprintf( '<a href="%s">%s</a>', $_url, esc_html( $value->option_name ) ); ?></td>
247
+ <?php if ( $code ) { ?>
248
+ <td>
249
+ <pre><?php echo esc_html( print_r( $value->option_value, true ) ); ?></pre>
250
+ </td>
251
+ <?php } else { ?>
252
+ <td><?php echo esc_html( print_r( $value->option_value, true ) ); ?></td>
253
+ <?php } ?>
254
+ </tr>
255
+ <?php $order ++; ?>
256
+ <?php } ?>
257
+ </tbody>
258
+ </table>
259
+ <?php
260
+ endif;
261
+
262
+ if ( $this->is_enabled_section('meta') ) :
263
+ /**
264
+ * Output metadata.
265
+ */
266
+ ?>
267
+ <table class="table2" cellspacing="0">
268
+ <caption><strong><?php echo '"' . $meta_query_caption . '"'; ?></strong></caption>
269
+ <thead>
270
+ <tr>
271
+ <th><strong>№</strong></th>
272
+ <th><strong>meta</strong></th>
273
+ <th><strong>value</strong></th>
274
+ </tr>
275
+ </thead>
276
+ <tbody>
277
+ <?php
278
+ if ( empty($metas) ) { ?>
279
+ <tr>
280
+ <td></td>
281
+ <td>No data</td>
282
+ <td>No data</td>
283
+ </tr> <?php
284
+ } else {
285
+ $order = 1;
286
+ foreach ( $metas as $key=>$meta ) {
287
+ $code = false;
288
+ if ( is_array( $meta ) ) {
289
+ $metas[$key]['meta_key'] = htmlspecialchars( $meta['meta_value'] );
290
+ }
291
+ ?>
292
+ <tr>
293
+ <td><?php echo esc_html( $order ); ?></td>
294
+ <td><?php echo esc_html( print_r( $meta[ 'meta_key' ], true ) ); ?></td>
295
+ <?php if ( $code ) { ?>
296
+ <td>
297
+ <pre><?php echo esc_html( print_r( $meta[ 'meta_value' ], true ) ); ?></pre>
298
+ </td>
299
+ <?php } else { ?>
300
+ <td><?php echo esc_html( print_r( $meta[ 'meta_value' ], true ) ); ?></td>
301
+ <?php } ?>
302
+ </tr>
303
+ <?php $order ++;
304
+ }
305
+ } ?>
306
+ </tbody>
307
+ </table>
308
+ <?php
309
+ endif;
310
+
311
+ if ( $this->is_enabled_section('wpglobus_options') ) :
312
+ /**
313
+ * Output WPGlobus options.
314
+ */
315
+ $query = "SELECT * FROM $wpdb->options WHERE option_name LIKE '%wpglobus%'";
316
+ $results = $wpdb->get_results( $query );
317
+ ?>
318
+ <table class="table3" cellspacing="0">
319
+ <caption><strong><?php echo '"SELECT * FROM $wpdb->options WHERE option_name LIKE \'%wpglobus%\'"'; ?></strong></caption>
320
+ <caption><?php echo 'Option count: ' . count( $results ); ?></caption>
321
+ <thead>
322
+ <tr>
323
+ <th><strong>Option ID</strong></th>
324
+ <th><strong>Option Name</strong></th>
325
+ <th><strong>Option Value</strong></th>
326
+ </tr>
327
+ </thead>
328
+ <tbody>
329
+ <?php
330
+
331
+ $order = 1;
332
+
333
+ foreach ( $results as $option_key => $option ) {
334
+ $code = false;
335
+ if ( is_array( $option->option_value ) ) {
336
+ foreach ( $option->option_value as $key => $value ) {
337
+ $option->option_value[ $key ] = htmlspecialchars( $value );
338
+ }
339
+ } elseif ( is_string( $option->option_value ) ) {
340
+ $option->option_value = htmlspecialchars( $option->option_value );
341
+ }
342
+ ?>
343
+ <tr>
344
+ <td><?php echo esc_html( $option->option_id ); ?></td>
345
+ <td><?php echo esc_html( print_r( $option->option_name, true ) ); ?></td>
346
+ <?php if ( $code ) { ?>
347
+ <td>
348
+ <pre><?php echo esc_html( print_r( $option->option_value, true ) ); ?></pre>
349
+ </td>
350
+ <?php } else { ?>
351
+ <td><?php echo esc_html( print_r( $option->option_value, true ) ); ?></td>
352
+ <?php } ?>
353
+ </tr>
354
+ <?php $order ++; ?>
355
+ <?php } ?>
356
+ </tbody>
357
+ </table><?php
358
+ endif; ?>
359
+ </div>
360
+
361
+ <?php
362
+ }
363
+
364
+ }
365
+
366
+ endif;
trunk/includes/admin/helpdesk/class-wpglobus-admin-helpdesk.php ADDED
@@ -0,0 +1,292 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * File: class-wpglobus-admin-helpdesk.php
4
+ *
5
+ * @package WPGlobus\Admin\HelpDesk
6
+ */
7
+
8
+
9
+ /**
10
+ * Class WPGlobus_Admin_HelpDesk.
11
+ * The Contact Support form.
12
+ */
13
+ class WPGlobus_Admin_HelpDesk {
14
+
15
+ /**
16
+ * Nonce.
17
+ *
18
+ * @var string
19
+ */
20
+ const NONCE_ACTION = 'wpglobus-helpdesk';
21
+
22
+ /**
23
+ * Email address of the Support.
24
+ *
25
+ * @var string
26
+ */
27
+ const EMAIL_SUPPORT = 'support@wpglobus.com';
28
+
29
+ /**
30
+ * Admin page title.
31
+ *
32
+ * @var string
33
+ */
34
+ public static $page_title;
35
+ /**
36
+ * Admin menu title.
37
+ *
38
+ * @var string
39
+ */
40
+ protected static $menu_title;
41
+
42
+ /**
43
+ * @var string
44
+ */
45
+ protected static $name;
46
+
47
+ /**
48
+ * @return string
49
+ */
50
+ public static function getName() {
51
+ return self::$name;
52
+ }
53
+
54
+ /**
55
+ * @var string
56
+ */
57
+ protected static $email;
58
+
59
+ /**
60
+ * @return string
61
+ */
62
+ public static function getEmail() {
63
+ return self::$email;
64
+ }
65
+
66
+ /**
67
+ * @var string
68
+ */
69
+ protected static $submission_status = 'success';
70
+
71
+ /**
72
+ * @return string
73
+ */
74
+ public static function getSubmissionStatus() {
75
+ return self::$submission_status;
76
+ }
77
+
78
+ /**
79
+ * @var string
80
+ */
81
+ protected static $submission_message = '';
82
+
83
+ /**
84
+ * @return string
85
+ */
86
+ public static function getSubmissionMessage() {
87
+ return self::$submission_message;
88
+ }
89
+
90
+ /**
91
+ * Static "constructor".
92
+ */
93
+ public static function construct() {
94
+ self::set_vars();
95
+ self::set_hooks();
96
+ }
97
+
98
+ /**
99
+ * Set class variables.
100
+ */
101
+ public static function set_vars() {
102
+ self::$page_title = __( 'WPGlobus Help Desk', 'wpglobus' );
103
+ self::$menu_title = __( 'Help Desk', 'wpglobus' );
104
+ }
105
+
106
+ /**
107
+ * Setup actions and filters.
108
+ */
109
+ protected static function set_hooks() {
110
+ add_action( 'admin_menu', array( __CLASS__, 'add_menu' ), PHP_INT_MAX );
111
+ }
112
+
113
+ /**
114
+ * Add admin menu item.
115
+ */
116
+ public static function add_menu() {
117
+ add_submenu_page(
118
+ WPGlobus::OPTIONS_PAGE_SLUG,
119
+ self::$page_title,
120
+ '<span class="' . esc_attr( WPGlobus_Admin_Page::nav_tab_icon( 'Helpdesk' ) ) . '"></span> '
121
+ . self::$menu_title,
122
+ 'administrator',
123
+ WPGlobus::PAGE_WPGLOBUS_HELPDESK,
124
+ array( __CLASS__, 'helpdesk_page' )
125
+ );
126
+ }
127
+
128
+ /**
129
+ * The admin page.
130
+ */
131
+ public static function helpdesk_page() {
132
+ /** @noinspection PhpUnusedLocalVariableInspection */
133
+ $data = self::get_data();
134
+
135
+ self::handle_submit();
136
+
137
+ /*
138
+ * Prepare data for the view.
139
+ */
140
+
141
+ $active_plugins = explode( ', ', $data['active_plugins'] );
142
+ unset( $data['active_plugins'] );
143
+
144
+ $tech_info = '';
145
+ foreach ( $data as $key => $value ) {
146
+ $tech_info .= $key . ' = ' . $value . "\n";
147
+ }
148
+
149
+ // Split one-cell formatted list of plugins into the separate rows.
150
+ foreach ( $active_plugins as $active_plugin ) {
151
+ list( $name, $version ) = explode( ':', $active_plugin );
152
+
153
+ $tech_info .= $name . ' = ' . $version . "\n";
154
+ }
155
+
156
+ /** @noinspection PhpUnusedLocalVariableInspection */
157
+ $subject = empty( $_POST['subject'] ) ? '' : sanitize_text_field( $_POST['subject'] ); // phpcs:ignore WordPress.CSRF.NonceVerification
158
+ if ( empty($subject) ) {
159
+ $subject = empty( $_GET['subject'] ) ? '' : sanitize_text_field( $_GET['subject'] ); // phpcs:ignore WordPress.CSRF.NonceVerification
160
+ }
161
+
162
+
163
+ /** @noinspection PhpUnusedLocalVariableInspection */
164
+ $details = empty( $_POST['details'] ) ? '' : sanitize_textarea_field( $_POST['details'] ); // phpcs:ignore WordPress.CSRF.NonceVerification
165
+
166
+ // Render view.
167
+ include dirname( __FILE__ ) . '/wpglobus-admin-helpdesk-page.php';
168
+
169
+ }
170
+
171
+ /**
172
+ * Handle the form submit.
173
+ */
174
+ protected static function handle_submit() {
175
+ if ( ! empty( $_POST ) ) {
176
+ check_admin_referer( self::NONCE_ACTION );
177
+
178
+ if (
179
+ empty( $_POST['name'] )
180
+ || empty( $_POST['email'] )
181
+ || empty( $_POST['subject'] )
182
+ || empty( $_POST['details'] )
183
+ ) {
184
+ self::$submission_status = 'error';
185
+ self::$submission_message = __( 'Email not sent. Please fill in the entire form.', 'wpglobus' );
186
+
187
+ return;
188
+ }
189
+
190
+ self::$name = sanitize_text_field( $_POST['name'] );
191
+ self::$email = sanitize_email( $_POST['email'] );
192
+
193
+ if ( ! self::$name || ! self::$email ) {
194
+ self::$submission_status = 'error';
195
+ self::$submission_message = __( 'Email not sent. Please verify that your name and email are entered correctly.', 'wpglobus' );
196
+
197
+ return;
198
+ }
199
+
200
+ $message = sanitize_textarea_field( $_POST['details'] );
201
+ if ( ! empty( $_POST['info'] ) ) {
202
+ $message .= "\n-----\n" . sanitize_textarea_field( $_POST['info'] );
203
+ }
204
+
205
+ $headers = array(
206
+ 'from: ' . self::$name . ' <' . self::$email . '>',
207
+ 'reply-to: ' . self::$email,
208
+ 'cc: ' . self::$email,
209
+ );
210
+
211
+ add_action( 'wp_mail_failed', array( __CLASS__, 'action__wp_mail_failed' ) );
212
+
213
+ if ( wp_mail( self::EMAIL_SUPPORT, $_POST['subject'], $message, $headers ) ) :
214
+
215
+ self::$submission_status = 'success';
216
+ self::$submission_message = __( 'Email sent.', 'wpglobus' );
217
+
218
+ endif;
219
+
220
+ remove_action( 'wp_mail_failed', array( __CLASS__, 'action__wp_mail_failed' ) );
221
+
222
+ }
223
+ }
224
+
225
+ /**
226
+ * Collect technical data.
227
+ *
228
+ * @return array
229
+ */
230
+ protected static function get_data() {
231
+ $user = wp_get_current_user();
232
+ self::$name = WPGlobus_Filters::filter__text( $user->display_name );
233
+ self::$email = $user->user_email;
234
+
235
+ $theme = wp_get_theme();
236
+
237
+ /**
238
+ * @see php_uname can be disabled in php.ini for security reasons
239
+ * disable_functions=php_uname
240
+ * @since 1.7.13
241
+ */
242
+ $OS = 'Unknown';
243
+ if ( function_exists( 'php_uname' ) ) {
244
+ $OS = implode( ' ', array(
245
+ php_uname( 's' ),
246
+ php_uname( 'r' ),
247
+ php_uname( 'v' ),
248
+ ) );
249
+ }
250
+
251
+ $data = array(
252
+ 'home_url' => home_url(),
253
+ 'site_url' => site_url(),
254
+ 'REMOTE_ADDR' => sanitize_text_field( wp_unslash( $_SERVER['REMOTE_ADDR'] ) ),
255
+ // WPCS: input var ok, sanitization ok.
256
+ 'SERVER_PORT' => sanitize_text_field( wp_unslash( $_SERVER['SERVER_PORT'] ) ),
257
+ // WPCS: input var ok, sanitization ok.
258
+ 'OS' => $OS,
259
+ 'PHP_SAPI' => PHP_SAPI,
260
+ 'PHP_VERSION' => PHP_VERSION,
261
+ 'loaded_extensions' => implode( ', ', get_loaded_extensions() ),
262
+ 'wp_version' => $GLOBALS['wp_version'],
263
+ 'is_multisite' => is_multisite() ? 'Y' : 'N',
264
+ 'theme' => $theme->display( 'Name' ) . ' ' . $theme->display( 'ThemeURI' ) . ' by ' . $theme->get( 'Author' ) . ' ' . $theme->get( 'AuthorURI' ) . ( is_child_theme() ? '; child of ' . $theme->display( 'Template' ) : '' ),
265
+ 'enabled_languages' => implode( ', ', WPGlobus::Config()->enabled_languages ),
266
+ );
267
+
268
+ // The list of plugins is formatted here for display on the admin page,
269
+ // to fit into one table cell.
270
+ $active_plugins = array();
271
+ foreach ( wp_get_active_and_valid_plugins() as $plugin ) {
272
+ $plugin_data = get_plugin_data( $plugin );
273
+ $plugin_file = str_replace( trailingslashit( WP_PLUGIN_DIR ), '', dirname( $plugin ) );
274
+
275
+ $active_plugins[] = $plugin_file . ':' . $plugin_data['Version'];
276
+ }
277
+ $data['active_plugins'] = implode( ', ', $active_plugins );
278
+
279
+ return $data;
280
+
281
+ }
282
+
283
+ /**
284
+ * Print admin notice if sending failed.
285
+ *
286
+ * @param WP_Error $error
287
+ */
288
+ public static function action__wp_mail_failed( WP_Error $error ) {
289
+ self::$submission_status = 'error';
290
+ self::$submission_message = $error->get_error_message();
291
+ }
292
+ }
trunk/includes/admin/helpdesk/wpglobus-admin-helpdesk-page.php ADDED
@@ -0,0 +1,165 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * File: view-page.php
4
+ *
5
+ * @package WPGlobus\Admin\HelpDesk
6
+ * @global string[] $data
7
+ */
8
+
9
+ // Exit if accessed directly
10
+ if ( ! defined( 'ABSPATH' ) ) {
11
+ exit;
12
+ }
13
+
14
+ WPGlobus_Admin_Page::print_header();
15
+
16
+ /**
17
+ * Vars defined in @see \WPGlobus_Admin_HelpDesk::helpdesk_page
18
+ *
19
+ * @var string $subject
20
+ * @var string $tech_info
21
+ */
22
+ ?>
23
+
24
+ <h2 class="nav-tab-wrapper wp-clearfix">
25
+ <a href="#" class="nav-tab nav-tab-active">
26
+ <?php WPGlobus_Admin_Page::nav_tab_icon_e( 'Helpdesk' ); ?>
27
+ <?php echo esc_html( WPGlobus_Admin_HelpDesk::$page_title ); ?>
28
+ </a>
29
+ <a href="<?php echo esc_url( WPGlobus_Admin_Page::url_settings() ); ?>"
30
+ class="nav-tab">
31
+ <?php WPGlobus_Admin_Page::nav_tab_icon_e( 'Settings' ); ?>
32
+ <?php esc_html_e( 'Settings' ); ?>
33
+ </a>
34
+ <a href="<?php echo esc_url( WPGlobus_Admin_Page::url_addons() ); ?>"
35
+ class="nav-tab">
36
+ <?php WPGlobus_Admin_Page::nav_tab_icon_e( 'Add-ons' ); ?>
37
+ <?php esc_html_e( 'Add-ons', 'wpglobus' ); ?>
38
+ </a>
39
+ <a href="<?php echo esc_url( WPGlobus_Utils::url_wpglobus_site() . 'quick-start/' ); ?>"
40
+ target="_blank"
41
+ class="nav-tab">
42
+ <?php WPGlobus_Admin_Page::nav_tab_icon_e( 'Guide' ); ?>
43
+ <?php esc_html_e( 'Guide', 'wpglobus' ); ?>
44
+ </a>
45
+ <a href="<?php echo esc_url( WPGlobus_Utils::url_wpglobus_site() . 'faq/' ); ?>"
46
+ target="_blank"
47
+ class="nav-tab">
48
+ <?php WPGlobus_Admin_Page::nav_tab_icon_e( 'FAQ' ); ?>
49
+ <?php esc_html_e( 'FAQ', 'wpglobus' ); ?>
50
+ </a>
51
+ <a href="<?php echo esc_url( WPGlobus_Utils::url_wpglobus_site() ); ?>"
52
+ target="_blank"
53
+ class="nav-tab">
54
+ <?php WPGlobus_Admin_Page::nav_tab_icon_e( 'globe' ); ?>
55
+ <?php echo esc_html( 'WPGlobus.com' ); ?>
56
+ </a>
57
+ </h2>
58
+
59
+ <?php if ( WPGlobus_Admin_HelpDesk::getSubmissionMessage() ) : ?>
60
+ <div class="notice notice-<?php echo esc_attr( WPGlobus_Admin_HelpDesk::getSubmissionStatus() ); ?>">
61
+ <p>
62
+ <?php echo esc_html( WPGlobus_Admin_HelpDesk::getSubmissionMessage() ); ?>
63
+ </p>
64
+ </div>
65
+ <?php endif; ?>
66
+
67
+ <p><em>
68
+ <?php esc_html_e( 'Thank you for using WPGlobus!', 'wpglobus' ); ?>
69
+ <?php esc_html_e( 'Our Support Team is here to answer your questions or concerns.', 'wpglobus' ); ?>
70
+ </em></p>
71
+ <h4><?php esc_html_e( 'To help us serve you better:', 'wpglobus' ); ?></h4>
72
+ <ol>
73
+ <li><?php esc_html_e( 'Please check if the problem persists if you switch to a standard WordPress theme.', 'wpglobus' ); ?></li>
74
+ <li><?php esc_html_e( 'Try deactivating other plugins to see if any of them conflicts with WPGlobus.', 'wpglobus' ); ?></li>
75
+ </ol>
76
+
77
+ <h4><?php esc_html_e( 'Please fill in and submit the contact form:', 'wpglobus' ); ?></h4>
78
+
79
+ <form action="<?php echo esc_url( WPGlobus_Admin_Page::url_helpdesk() ); ?>" method="post" id="wpglobus-form-helpdesk">
80
+
81
+ <table class="form-table">
82
+ <tbody>
83
+ <tr class="form-field">
84
+ <th><label for="name"><?php esc_html_e( 'Name' ); ?>:</label></th>
85
+ <td><input required="required" type="text" name="name" id="name"
86
+ value="<?php echo esc_attr( WPGlobus_Admin_HelpDesk::getName() ); ?>" data-lpignore="true"/>
87
+ </td>
88
+ </tr>
89
+ <tr class="form-field">
90
+ <th><label for="email"><?php esc_html_e( 'Email' ); ?>:</label></th>
91
+ <td>
92
+ <input required="required" type="email" name="email" id="email"
93
+ value="<?php echo esc_attr( WPGlobus_Admin_HelpDesk::getEmail() ); ?>"
94
+ data-lpignore="true"/>
95
+ <p class="description">
96
+ <strong>
97
+ <?php esc_html_e( 'Please make sure the email address is correct.', 'wpglobus' ); ?>
98
+ </strong>
99
+ </p>
100
+ </td>
101
+ </tr>
102
+ <tr class="form-field">
103
+ <th><label for="subject"><?php esc_html_e( 'Subject', 'wpglobus' ); ?>:</label></th>
104
+ <td>
105
+ <input required="required" type="text" name="subject" id="subject"
106
+ value="<?php echo esc_attr( $subject ); ?>" data-lpignore="true"/>
107
+ <p class="description">
108
+ <?php esc_html_e( 'Short description of the problem', 'wpglobus' ); ?>
109
+ </p>
110
+ </td>
111
+ </tr>
112
+ <tr class="form-field">
113
+ <th><label for="details"><?php esc_html_e( 'Detailed description', 'wpglobus' ); ?>:</label></th>
114
+ <td>
115
+ <textarea required="required" name="details" id="details"
116
+ rows="10"><?php echo esc_attr( $details ); ?></textarea>
117
+ </td>
118
+ </tr>
119
+ <tr class="form-field">
120
+ <th><label for="info"><?php esc_html_e( 'Technical Information', 'wpglobus' ); ?>:</label></th>
121
+ <td>
122
+ <textarea name="info" id="info" rows="10"
123
+ style="font-family: monospace; font-size: 10px; background-color: #eee; white-space: nowrap; overflow: hidden"
124
+ data-gramm_editor="false"
125
+ spellcheck="false"><?php echo esc_html( $tech_info ); ?></textarea>
126
+ <p class="description">
127
+ <?php esc_html_e( 'This information helps us to find the problem source', 'wpglobus' ); ?>
128
+ </p>
129
+ </td>
130
+ </tr>
131
+ </tbody>
132
+ </table>
133
+
134
+ <?php wp_nonce_field( WPGlobus_Admin_HelpDesk::NONCE_ACTION ); ?>
135
+
136
+ <button class="button-primary" type="submit" name="send_email" id="send_email">
137
+ <?php WPGlobus_Admin_Page::nav_tab_icon_e( 'Helpdesk' ); ?>
138
+ <?php esc_html_e( 'Submit' ); ?>
139
+ </button>
140
+ <script>
141
+ jQuery(function ($) {
142
+ $("#wpglobus-form-helpdesk").on("submit", function (e) {
143
+ $("#send_email").prop("disabled", true);
144
+ });
145
+ function adjustHeight(el, minHeight) {
146
+ var outerHeight = parseInt(window.getComputedStyle(el).height, 10);
147
+ var diff = outerHeight - el.clientHeight;
148
+ el.style.height = 0;
149
+ el.style.height = Math.max(minHeight, el.scrollHeight + diff) + 'px';
150
+ }
151
+ var textArea = [].slice.call(document.querySelectorAll('textarea#info'));
152
+ if ( textArea.length == 1 ) {
153
+ adjustHeight(textArea[0], textArea[0].scrollHeight);
154
+ }
155
+
156
+ });
157
+ </script>
158
+
159
+ </form>
160
+ <p>
161
+ *) <?php printf( esc_html__( 'Alternatively, please email %s. Do not forget to copy and paste the technical information to your email message.', 'wpglobus' ), '<a href="mailto:' . esc_attr( WPGlobus_Admin_HelpDesk::EMAIL_SUPPORT ) . '">' . esc_html( WPGlobus_Admin_HelpDesk::EMAIL_SUPPORT ) . '</a>' ); ?></p>
162
+
163
+ <?php
164
+
165
+ WPGlobus_Admin_Page::print_footer();
trunk/includes/admin/media/class-wpglobus-media.php ADDED
@@ -0,0 +1,413 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package WPGlobus
4
+ */
5
+
6
+ /**
7
+ * Class WPGlobus_Media.
8
+ *
9
+ * @since 1.7.3
10
+ * @since 2.2.22
11
+ */
12
+ if ( ! class_exists( 'WPGlobus_Media' ) ) :
13
+
14
+ class WPGlobus_Media {
15
+
16
+ /**
17
+ * Instance.
18
+ */
19
+ protected static $instance;
20
+
21
+ /**
22
+ * Post types to work on media page.
23
+ */
24
+ protected $enabled_post_types = array();
25
+
26
+ /**
27
+ * Get instance.
28
+ */
29
+ public static function get_instance($http_post_action = false, $http_post_actions = array()){
30
+ if( null == self::$instance ){
31
+ self::$instance = new self($http_post_action, $http_post_actions);
32
+ }
33
+ return self::$instance;
34
+ }
35
+
36
+ /**
37
+ * Constructor.
38
+ */
39
+ public function __construct($http_post_action, $http_post_actions) {
40
+
41
+ /**
42
+ * @scope admin
43
+ * @since 1.7.3
44
+ */
45
+ add_action( 'admin_print_scripts', array(
46
+ $this,
47
+ 'post_php__admin_scripts'
48
+ ), 5 );
49
+
50
+ if ( in_array($http_post_action, $http_post_actions) ) {
51
+
52
+ if ( 'send-attachment-to-editor' == $http_post_action ) {
53
+
54
+ /**
55
+ * @scope admin
56
+ * @see filter 'media_send_to_editor' in wp-admin\includes\media.php
57
+ * @since 1.7.3
58
+ */
59
+ add_filter( 'media_send_to_editor', array(
60
+ $this,
61
+ 'filter__media_send_to_editor'
62
+ ), 5, 3 );
63
+
64
+ } else if ( 'query-attachments' == $http_post_action ) {
65
+
66
+ /**
67
+ * @scope admin
68
+ * @see filter 'wp_prepare_attachment_for_js' in wp-includes\media.php
69
+ * @since 2.2.22
70
+ */
71
+ add_filter( 'wp_prepare_attachment_for_js', array(
72
+ $this,
73
+ 'filter__prepare_attachment_for_js'
74
+ ), 5, 3 );
75
+
76
+ }
77
+
78
+ return;
79
+ }
80
+
81
+ $this->enabled_post_types[] = 'attachment';
82
+
83
+ /**
84
+ * @scope admin
85
+ * @since 1.7.3
86
+ */
87
+ add_action( 'edit_form_after_editor', array(
88
+ $this,
89
+ 'language_tabs'
90
+ ) );
91
+
92
+ /**
93
+ * @scope admin
94
+ * @since 1.7.3
95
+ */
96
+ add_action( 'admin_print_scripts', array(
97
+ $this,
98
+ 'media__admin_scripts'
99
+ ) );
100
+
101
+ /**
102
+ * @scope admin
103
+ * @since 1.7.3
104
+ */
105
+ add_action( 'admin_print_styles', array(
106
+ $this,
107
+ 'action__admin_styles'
108
+ ) );
109
+
110
+
111
+
112
+ }
113
+
114
+ /**
115
+ * Filters the HTML markup for a media item sent to the editor.
116
+ *
117
+ * @scope admin
118
+ * @since 1.7.3
119
+ *
120
+ * @param string $html HTML markup.
121
+ * @param int $id Unused.
122
+ * @param array $attachment Array of attachment metadata.
123
+ *
124
+ * @return boolean
125
+ */
126
+ public function filter__media_send_to_editor( $html, $id, $attachment ) {
127
+
128
+ $fields = array(
129
+ 'post_content',
130
+ 'post_excerpt',
131
+ 'image_alt',
132
+ );
133
+
134
+ $current_language = WPGlobus::Config()->default_language;
135
+ if ( ! empty( $_POST['wpglobusLanguageTab'] ) ) { // WPCS: input var ok, sanitization ok.
136
+ /**
137
+ * See wpglobus-media.js
138
+ */
139
+ $current_language = sanitize_text_field( wp_unslash( $_POST['wpglobusLanguageTab'] ) ); // WPCS: input var ok, sanitization ok.
140
+
141
+ if ( ! in_array( $current_language, WPGlobus::Config()->enabled_languages, true ) ) {
142
+ return $html;
143
+ }
144
+ }
145
+
146
+ foreach ( $fields as $field ) {
147
+ if ( ! empty( $attachment[ $field ] ) && WPGlobus_Core::has_translations( $attachment[ $field ] ) ) {
148
+ $html = str_replace( $attachment[ $field ], WPGlobus_Core::text_filter( $attachment[ $field ], $current_language ), $html );
149
+ }
150
+ }
151
+
152
+ return $html;
153
+ }
154
+
155
+ /**
156
+ * Check for enabled post types.
157
+ *
158
+ * @scope admin
159
+ * @since 1.7.3
160
+ * @access public
161
+ *
162
+ * @return boolean
163
+ */
164
+ public function is_enabled() {
165
+
166
+ global $post;
167
+
168
+ if ( empty( $post ) ) {
169
+ return false;
170
+ }
171
+
172
+ if ( in_array( $post->post_type, $this->enabled_post_types ) ) {
173
+ return true;
174
+ }
175
+
176
+ return false;
177
+
178
+ }
179
+
180
+ /**
181
+ * Enqueue admin scripts on post.php page.
182
+ *
183
+ * @scope admin
184
+ * @since 1.7.3
185
+ * @access public
186
+ *
187
+ * @return void
188
+ */
189
+ public function post_php__admin_scripts() {
190
+
191
+ global $post;
192
+
193
+ if ( empty( $post ) ) {
194
+ return;
195
+ }
196
+
197
+ if ( in_array( $post->post_type, array( 'attachment' ) ) ) {
198
+ /**
199
+ * Don't load on edit media page.
200
+ */
201
+ return;
202
+ }
203
+
204
+ wp_register_script(
205
+ 'wpglobus-media-post-php',
206
+ WPGlobus::$PLUGIN_DIR_URL . 'includes/js/wpglobus-media-post-php' . WPGlobus::SCRIPT_SUFFIX() . '.js',
207
+ array(),
208
+ WPGLOBUS_VERSION,
209
+ true
210
+ );
211
+ wp_enqueue_script( 'wpglobus-media-post-php' );
212
+ wp_localize_script(
213
+ 'wpglobus-media-post-php',
214
+ 'WPGlobusMediaInPost',
215
+ array(
216
+ 'version' => WPGLOBUS_VERSION,
217
+ 'builderID' => WPGlobus::Config()->builder->get_id(),
218
+ )
219
+ );
220
+
221
+ }
222
+
223
+ /**
224
+ * Enqueue admin scripts.
225
+ *
226
+ * @scope admin
227
+ * @since 1.7.3
228
+ * @access public
229
+ *
230
+ * @return void
231
+ */
232
+ public function media__admin_scripts() {
233
+
234
+ if ( ! $this->is_enabled() ) {
235
+ return;
236
+ }
237
+
238
+ /**
239
+ * WordPress 4.7+ needs a new version of our admin JS.
240
+ * @since 1.7.0
241
+ */
242
+ $version = '';
243
+ if ( version_compare( $GLOBALS['wp_version'], '4.6.999', '>' ) ) {
244
+ $version = '-47';
245
+ }
246
+
247
+ wp_register_script(
248
+ 'wpglobus-admin',
249
+ WPGlobus::$PLUGIN_DIR_URL . "includes/js/wpglobus-admin$version" . WPGlobus::SCRIPT_SUFFIX() . ".js",
250
+ array( 'jquery', 'jquery-ui-dialog', 'jquery-ui-tabs' ),
251
+ WPGLOBUS_VERSION,
252
+ true
253
+ );
254
+ wp_enqueue_script( 'wpglobus-admin' );
255
+ wp_localize_script(
256
+ 'wpglobus-admin',
257
+ 'WPGlobusAdmin',
258
+ array(
259
+ 'version' => WPGLOBUS_VERSION,
260
+ 'i18n' => array(),
261
+ 'data' => array(
262
+ 'default_language' => WPGlobus::Config()->default_language
263
+ )
264
+ )
265
+ );
266
+
267
+ wp_localize_script(
268
+ 'wpglobus-admin',
269
+ 'WPGlobusCoreData',
270
+ array(
271
+ 'multisite' => 'false',
272
+ 'default_language' => WPGlobus::Config()->default_language,
273
+ 'enabled_languages' => WPGlobus::Config()->enabled_languages,
274
+ 'locale_tag_start' => WPGlobus::LOCALE_TAG_START,
275
+ 'locale_tag_end' => WPGlobus::LOCALE_TAG_END
276
+ )
277
+ );
278
+
279
+ wp_register_script(
280
+ 'wpglobus-media',
281
+ WPGlobus::$PLUGIN_DIR_URL . "includes/js/wpglobus-media" . WPGlobus::SCRIPT_SUFFIX() . ".js",
282
+ array( 'jquery', 'wpglobus-admin' ),
283
+ WPGLOBUS_VERSION,
284
+ true
285
+ );
286
+ wp_enqueue_script( 'wpglobus-media' );
287
+ wp_localize_script(
288
+ 'wpglobus-media',
289
+ 'WPGlobusMedia',
290
+ array(
291
+ 'version' => WPGLOBUS_VERSION,
292
+ 'language' => WPGlobus::Config()->default_language,
293
+ 'defaultLanguage' => WPGlobus::Config()->default_language,
294
+ 'enabledLanguages' => WPGlobus::Config()->enabled_languages,
295
+ 'attachment' => array(
296
+ 'caption' => 'attachment_caption',
297
+ 'alt' => 'attachment_alt',
298
+ 'description' => 'attachment_content',
299
+ 'title' => 'title'
300
+ )
301
+ )
302
+ );
303
+ }
304
+
305
+ /**
306
+ * Enqueue admin styles.
307
+ *
308
+ * @scope admin
309
+ * @since 1.7.3
310
+ * @access public
311
+ *
312
+ * @return void
313
+ */
314
+ public function action__admin_styles() {
315
+
316
+ if ( ! $this->is_enabled() ) {
317
+ return;
318
+ }
319
+
320
+ wp_register_style(
321
+ 'wpglobus-admin-tabs',
322
+ WPGlobus::$PLUGIN_DIR_URL . 'includes/css/wpglobus-admin-tabs.css',
323
+ array(),
324
+ WPGLOBUS_VERSION,
325
+ 'all'
326
+ );
327
+ wp_enqueue_style( 'wpglobus-admin-tabs' );
328
+
329
+ }
330
+
331
+ /**
332
+ * Add language tabs on media page.
333
+ *
334
+ * @scope admin
335
+ * @since 1.7.3
336
+ * @access public
337
+ *
338
+ * @return void
339
+ */
340
+ public function language_tabs() {
341
+
342
+ if ( ! $this->is_enabled() ) {
343
+ return;
344
+ }
345
+
346
+ ?>
347
+ <div id="wpglobus-media-body-tabs" style="margin-top:20px;" class="wpglobus-post-body-tabs">
348
+ <ul class="wpglobus-post-body-tabs-list"> <?php
349
+ $order = 0;
350
+ foreach ( WPGlobus::Config()->open_languages as $language ) {
351
+ $tab_suffix = $language == WPGlobus::Config()->default_language ? 'default' : $language; ?>
352
+ <li id="link-tab-<?php echo esc_attr( $tab_suffix ); ?>" data-language="<?php echo esc_attr( $language ); ?>"
353
+ data-order="<?php echo esc_attr( $order ); ?>"
354
+ class="wpglobus-post-tab">
355
+ <a href="#tab-<?php echo esc_attr( $tab_suffix ); ?>"><?php echo esc_html( WPGlobus::Config()->en_language_name[ $language ] ); ?></a>
356
+ </li> <?php
357
+ $order ++;
358
+ } ?>
359
+ </ul> <?php
360
+ foreach ( WPGlobus::Config()->open_languages as $language ) {
361
+ $tab_suffix = $language == WPGlobus::Config()->default_language ? 'default' : $language; ?>
362
+ <div id="tab-<?php echo esc_attr( $tab_suffix ); ?>" style="display:none;"></div> <?php
363
+ } ?>
364
+ </div>
365
+ <?php
366
+ }
367
+
368
+ /**
369
+ * Filters the attachment data prepared for JavaScript.
370
+ *
371
+ * @since 2.2.22
372
+ *
373
+ * @param array $response Array of prepared attachment data.
374
+ * @param WP_Post $attachment Attachment object.
375
+ * @param array|false $meta Array of attachment meta data, or false if there is none.
376
+ */
377
+ public function filter__prepare_attachment_for_js( $response, $attachment, $meta ) {
378
+
379
+ if ( empty( $_POST['wpglobusPrepareAttachments'] ) ) { // WPCS: input var ok, sanitization ok.
380
+ return $response;
381
+ }
382
+
383
+ $fields = array(
384
+ 'alt',
385
+ 'description',
386
+ 'caption',
387
+ // @todo may be `uploadedToTitle` field
388
+ );
389
+
390
+ $current_language = WPGlobus::Config()->default_language;
391
+ if ( ! empty( $_POST['wpglobusLanguageTab'] ) ) { // WPCS: input var ok, sanitization ok.
392
+ /**
393
+ * See includes\js\wpglobus-media.js
394
+ */
395
+ $current_language = sanitize_text_field( wp_unslash( $_POST['wpglobusLanguageTab'] ) ); // WPCS: input var ok, sanitization ok.
396
+
397
+ if ( ! in_array( $current_language, WPGlobus::Config()->enabled_languages, true ) ) {
398
+ return $response;
399
+ }
400
+ }
401
+
402
+ foreach ( $fields as $field ) {
403
+ if ( ! empty( $response[ $field ] ) && WPGlobus_Core::has_translations( $response[ $field ] ) ) {
404
+ $response[ $field ] = WPGlobus_Core::text_filter( $response[ $field ], $current_language );
405
+ }
406
+ }
407
+
408
+ return $response;
409
+ }
410
+
411
+ }
412
+
413
+ endif;
trunk/includes/admin/media/wpglobus-media.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * 1. Add multilingual Caption, Alternative Text, Description and post Title to media files.
4
+ * 2. Handling the inserting media in post.
5
+ *
6
+ * @since 2.2.22
7
+ * @package WPGlobus
8
+ */
9
+ if ( version_compare( $GLOBALS['wp_version'], '4.6.999', '>' ) ) :
10
+
11
+ $http_post_action = false;
12
+
13
+ if ( WPGlobus_WP::is_doing_ajax() ) {
14
+ if ( WPGlobus_WP::is_http_post_action('send-attachment-to-editor') ) {
15
+ $http_post_action = 'send-attachment-to-editor';
16
+ } else if ( WPGlobus_WP::is_http_post_action('query-attachments') ) {
17
+ /**
18
+ * Action for gutenberg.
19
+ */
20
+ $http_post_action = 'query-attachments';
21
+ }
22
+ }
23
+
24
+ /**
25
+ * Array of actions to handle the inserting media on post.php page.
26
+ */
27
+ $http_post_actions = array(
28
+ 'send-attachment-to-editor', // standard and builder mode (except gutenberg).
29
+ 'query-attachments' // gutenberg.
30
+ );
31
+
32
+ if ( WPGlobus_WP::is_pagenow( 'post.php' ) || $http_post_action ) {
33
+ if ( ! class_exists('WPGlobus_Media') ) {
34
+ require_once 'class-wpglobus-media.php';
35
+ }
36
+ WPGlobus_Media::get_instance($http_post_action, $http_post_actions);
37
+ }
38
+ endif;
trunk/includes/admin/meta/class-wpglobus-meta.php ADDED
@@ -0,0 +1,543 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class WPGlobus_Meta
4
+ *
5
+ * @since 1.9.17
6
+ * @since 1.9.25 Added build_multilingual_string function.
7
+ *
8
+ * @package WPGlobus\Admin\Meta
9
+ * @author Alex Gor(alexgff)
10
+ */
11
+
12
+ if ( ! class_exists( 'WPGlobus_Meta' ) ) :
13
+
14
+ /**
15
+ * Class WPGlobus_Meta.
16
+ */
17
+ class WPGlobus_Meta {
18
+
19
+ /**
20
+ * Instance of this class.
21
+ *
22
+ * @var WPGlobus_Meta
23
+ */
24
+ protected static $instance;
25
+
26
+ /**
27
+ * Meta fields.
28
+ *
29
+ * @var string[]
30
+ */
31
+ public static $meta_fields = array();
32
+
33
+ /**
34
+ * Builder.
35
+ *
36
+ * @var WPGlobus_Config_Builder
37
+ */
38
+ protected static $builder = null;
39
+
40
+ /**
41
+ * Constructor.
42
+ *
43
+ * @param string[] $meta_fields
44
+ * @param WPGlobus_Config_Builder $builder
45
+ */
46
+ protected function __construct( $meta_fields, $builder ) {
47
+
48
+ self::$meta_fields = $meta_fields;
49
+ self::$builder = $builder;
50
+
51
+ if ( is_admin() ) {
52
+ add_filter( 'get_post_metadata', array( __CLASS__, 'filter__post_metadata' ), 5, 4 );
53
+
54
+ /**
55
+ * @see update_metadata() in wp-includes\meta.php
56
+ */
57
+ add_filter( 'update_post_metadata', array( __CLASS__, 'filter__update_post_metadata' ), 5, 5 );
58
+
59
+ add_filter( 'delete_post_metadata', array( __CLASS__, 'filter__delete_metadata' ), 5, 5 );
60
+ }
61
+
62
+ }
63
+
64
+ /**
65
+ * Get instance of this class.
66
+ *
67
+ * @param string[] $meta_fields
68
+ * @param WPGlobus_Config_Builder $builder
69
+ *
70
+ * @return WPGlobus_Meta
71
+ */
72
+ public static function get_instance( $meta_fields, $builder ) {
73
+ if ( ! ( self::$instance instanceof WPGlobus_Meta ) ) {
74
+ self::$instance = new self( $meta_fields, $builder );
75
+ }
76
+
77
+ return self::$instance;
78
+ }
79
+
80
+ /**
81
+ * public static function get_post_meta( $post_id = false ) {
82
+ * $meta_cache = wp_cache_get($post_id, 'post_meta');
83
+ * }
84
+ * // */
85
+
86
+ /**
87
+ * Update post meta data.
88
+ *
89
+ * @see wp-includes\meta.php "update_{$meta_type}_metadata".
90
+ *
91
+ * @param null|bool $check Whether to allow updating metadata for the given type.
92
+ * @param int $object_id Object ID.
93
+ * @param string $meta_key Meta key.
94
+ * @param mixed $meta_value Meta value. Must be serializable if non-scalar.
95
+ * @param mixed $prev_value Optional. If specified, only update existing
96
+ * metadata entries with the specified value.
97
+ * Otherwise, update all entries.
98
+ *
99
+ * @return bool
100
+ */
101
+ public static function filter__update_post_metadata( $check, $object_id, $meta_key, $meta_value, $prev_value ) {
102
+
103
+ if ( empty( self::$meta_fields ) ) {
104
+ return $check;
105
+ }
106
+
107
+ if ( ! self::meta_key_exists( $meta_key ) ) {
108
+ return $check;
109
+ }
110
+
111
+ if ( empty( self::$builder->get_language() ) ) {
112
+ /**
113
+ * Prevent update post meta when $builder is not set.
114
+ * For example, Elementor saves meta `_elementor_data` for Template (post type `elementor_library`).
115
+ * And we have meta `_elementor_data` in `$meta_fields` array @see wpglobus\configs\elementor.json
116
+ * @since 2.2.33
117
+ */
118
+ return $check;
119
+ }
120
+
121
+ $meta_type = 'post';
122
+
123
+ /** @global wpdb $wpdb */
124
+ global $wpdb;
125
+
126
+ $table = _get_meta_table( $meta_type );
127
+ if ( ! $table ) {
128
+ return false;
129
+ }
130
+
131
+ $column = $meta_type . '_id';
132
+ $id_column = 'meta_id';
133
+
134
+ $raw_meta_key = $meta_key;
135
+
136
+ // Compare existing value to new value if no prev value given and the key exists only once.
137
+ if ( empty( $prev_value ) ) {
138
+ $old_value = get_metadata( $meta_type, $object_id, $meta_key );
139
+ if ( 1 === count( $old_value ) ) {
140
+ if ( ! empty( $old_value[0] ) && $old_value[0] === $meta_value ) {
141
+ return false;
142
+ }
143
+ }
144
+ }
145
+
146
+ $_meta_value = $meta_value;
147
+ /**
148
+ * @since 2.1.7
149
+ */
150
+ $meta_value = maybe_serialize( $meta_value );
151
+
152
+ /**
153
+ * Don't auto-modify this SQL query.
154
+ */
155
+ // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared
156
+ $meta_ids = $wpdb->get_col( $wpdb->prepare( "SELECT $id_column FROM $table WHERE meta_key = %s AND $column = %d", $meta_key, $object_id ) );
157
+
158
+ /*
159
+ // Incorrect query.
160
+ $meta_ids = $wpdb->get_col( $wpdb->prepare(
161
+ 'SELECT %s FROM %s WHERE meta_key = %s AND %s = %d',
162
+ $id_column,
163
+ $table,
164
+ $meta_key,
165
+ $column,
166
+ $object_id
167
+ ) );
168
+ // */
169
+
170
+ if ( empty( $meta_ids ) ) {
171
+
172
+ $_passed_value = $_meta_value;
173
+
174
+ if ( ! empty( $_passed_value ) && WPGlobus::Config()->default_language !== self::$builder->get_language() ) {
175
+ // phpcs:ignore Generic.CodeAnalysis.EmptyStatement
176
+ if ( WPGlobus_Core::has_translations( $_passed_value ) ) {
177
+ /**
178
+ * We get multilingual $meta_value. Let save it as is.
179
+ *
180
+ * @since 1.9.25 do nothing.
181
+ */
182
+ } else {
183
+ $_passed_value = self::build_multilingual_string( array( self::$builder->get_language() => $_passed_value ) );
184
+ }
185
+ }
186
+
187
+ return add_metadata( $meta_type, $object_id, $raw_meta_key, $_passed_value );
188
+ }
189
+
190
+ /**
191
+ * WPGlobus Core.
192
+ * We get $meta_value in language that can be retrieved with self::$builder->get_language().
193
+ */
194
+ $meta_cache = wp_cache_get( $object_id, $meta_type . '_meta' );
195
+
196
+ /**
197
+ * May be we need to update meta cache.
198
+ *
199
+ * @see 'filter__post_metadata' function.
200
+ */
201
+
202
+ // if ( !$meta_cache ) {
203
+ // $meta_cache = update_meta_cache( $meta_type, array( $object_id ) );
204
+ // $meta_cache = $meta_cache[$object_id];
205
+ // }
206
+
207
+ if ( isset( $meta_cache[ $meta_key ] ) ) {
208
+
209
+ //if ( WPGlobus_Core::has_translations( $passed_value ) ) {
210
+ // phpcs:ignore Generic.CodeAnalysis.EmptyStatement
211
+ if ( WPGlobus_Core::has_translations( $meta_value ) ) {
212
+ /**
213
+ * We get multilingual $meta_value. Let save it as is.
214
+ */
215
+ // @since 1.9.25 do nothing.
216
+ } else {
217
+
218
+ foreach ( $meta_cache[ $meta_key ] as $_key => $_ml_value ) {
219
+
220
+ $_new_ml_array = array();
221
+
222
+ if ( WPGlobus_Core::has_translations( $_ml_value ) ) {
223
+
224
+ foreach ( WPGlobus::Config()->enabled_languages as $language ) :
225
+
226
+ if ( $language === self::$builder->get_language() ) {
227
+
228
+ if ( ! empty( $meta_value ) ) {
229
+ $_new_ml_array[ $language ] = $meta_value;
230
+ }
231
+ } else {
232
+
233
+ $_value = WPGlobus_Core::text_filter( $_ml_value, $language, WPGlobus::RETURN_EMPTY );
234
+
235
+ if ( '' !== $_value ) {
236
+ $_new_ml_array[ $language ] = $_value;
237
+ }
238
+ }
239
+
240
+ endforeach;
241
+
242
+ $_new_value = self::build_multilingual_string( $_new_ml_array );
243
+
244
+ } else {
245
+
246
+ if ( WPGlobus::Config()->default_language === self::$builder->get_language() ) {
247
+ $_new_ml_array[ WPGlobus::Config()->default_language ] = $meta_value;
248
+ } else {
249
+ $_new_ml_array[ WPGlobus::Config()->default_language ] = $_ml_value;
250
+ if ( ! empty( $meta_value ) ) {
251
+ $_new_ml_array[ self::$builder->get_language() ] = $meta_value;
252
+ }
253
+ }
254
+
255
+ $_new_value = self::build_multilingual_string( $_new_ml_array );
256
+
257
+ }
258
+
259
+ if ( ! empty( $_new_value ) ) {
260
+ //$meta_value = maybe_unserialize( $_new_value );
261
+ $meta_value = $_new_value;
262
+ }
263
+ }
264
+ }
265
+ }
266
+
267
+ $data = compact( 'meta_value' );
268
+ $where = array(
269
+ $column => $object_id,
270
+ 'meta_key' => $meta_key,
271
+ );
272
+
273
+ $result = $wpdb->update( $table, $data, $where );
274
+
275
+ if ( ! $result ) {
276
+ return false;
277
+ }
278
+
279
+ wp_cache_delete( $object_id, $meta_type . '_meta' );
280
+
281
+ return true;
282
+
283
+ }
284
+
285
+ /**
286
+ * Delete metadata for the specified object.
287
+ *
288
+ * in our case we should prevent deleting multilingual string when $meta_value is empty.
289
+ *
290
+ * @see wp-includes\meta.php "delete_{$meta_type}_metadata".
291
+ *
292
+ * @param null|bool $check Whether to allow metadata deletion of the given type.
293
+ * @param int $object_id Object ID.
294
+ * @param string $meta_key Meta key.
295
+ * @param mixed $meta_value Meta value. Must be serializable if non-scalar.
296
+ * @param bool $delete_all Whether to delete the matching metadata entries
297
+ * for all objects, ignoring the specified $object_id.
298
+ * Default false.
299
+ *
300
+ * @return bool|null
301
+ */
302
+ public static function filter__delete_metadata(
303
+ $check, $object_id, $meta_key, $meta_value,
304
+ /** @noinspection PhpUnusedParameterInspection */
305
+ $delete_all = false
306
+ ) {
307
+
308
+ if ( empty( self::$meta_fields ) ) {
309
+ return $check;
310
+ }
311
+
312
+ if ( ! self::meta_key_exists( $meta_key ) ) {
313
+ return $check;
314
+ }
315
+
316
+ $result = true;
317
+
318
+ if ( empty( $meta_value ) && WPGlobus::Config()->default_language === self::$builder->get_language() ) {
319
+
320
+ /**
321
+ * @todo check for extra languages.
322
+ */
323
+
324
+ /** @global wpdb $wpdb */
325
+ global $wpdb;
326
+
327
+ $_meta_value =
328
+ $wpdb->get_col(
329
+ $wpdb->prepare(
330
+ "SELECT meta_value FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = %s",
331
+ $object_id,
332
+ $meta_key
333
+ )
334
+ );
335
+
336
+ if ( ! isset( $_meta_value ) || empty( $_meta_value[0] ) ) {
337
+ $result = null;
338
+ } else {
339
+ if ( WPGlobus_Core::has_translations( $_meta_value[0] ) ) {
340
+ $result = true;
341
+ } else {
342
+ $result = null;
343
+ }
344
+ }
345
+ }
346
+
347
+ return $result;
348
+
349
+ }
350
+
351
+ /**
352
+ * Get post meta.
353
+ *
354
+ * @see \get_metadata()
355
+ *
356
+ * @param null|array|string $check The value get_metadata() should return - a single metadata value,
357
+ * or an array of values.
358
+ * @param int $object_id Object ID.
359
+ * @param string $meta_key Meta key.
360
+ * @param bool $single Whether to return only the first value of the specified $meta_key.
361
+ *
362
+ * @return array|null|string
363
+ */
364
+ public static function filter__post_metadata( $check, $object_id, $meta_key, $single ) {
365
+
366
+ if ( empty( self::$meta_fields ) ) {
367
+ return $check;
368
+ }
369
+
370
+ if ( empty( $meta_key ) ) {
371
+ $_cache_meta_key = '__WPGLOBUS_META_KEY_EMPTY__';
372
+ } else {
373
+
374
+ if ( ! self::meta_key_exists( $meta_key ) ) {
375
+ return $check;
376
+ }
377
+ $_cache_meta_key = $meta_key;
378
+ }
379
+
380
+ $return_value = 'as_array';
381
+ if ( $single ) {
382
+ $return_value = 'as_single';
383
+ }
384
+
385
+ /**
386
+ * Disable/enable to filter meta field.
387
+ *
388
+ * @since 1.9.25
389
+ *
390
+ * @param string $meta_key Meta key.
391
+ *
392
+ * @return string|boolean String if to filter meta field or false if not.
393
+ */
394
+ if ( ! empty( $meta_key ) && is_string( $meta_key ) ) {
395
+ // phpcs:ignore WordPress.NamingConventions
396
+ $meta_key = apply_filters( 'wpglobus/meta/key', $meta_key );
397
+ if ( false === $meta_key ) {
398
+ return $check;
399
+ }
400
+ }
401
+
402
+ /**
403
+ * May be called many times on one page. Let's cache.
404
+ */
405
+ static $_cache;
406
+ //if ( isset( $_cache[ $_cache_meta_key ][ $object_id ][ $return_value ] ) ) {
407
+ // @since 2.4
408
+ //return $_cache[ $_cache_meta_key ][ $object_id ][ $return_value ];
409
+ //}
410
+
411
+ $meta_type = 'post';
412
+
413
+ $meta_cache = wp_cache_get( $object_id, $meta_type . '_meta' );
414
+
415
+ if ( ! $meta_cache ) {
416
+ $meta_cache = update_meta_cache( $meta_type, array( $object_id ) );
417
+ $meta_cache = $meta_cache[ $object_id ];
418
+ }
419
+
420
+ if ( ! $meta_key ) {
421
+
422
+ /**
423
+ * @todo add doc.
424
+ */
425
+ if ( ! empty( $meta_cache ) ) {
426
+
427
+ foreach ( $meta_cache as $_meta_key => $_values ) {
428
+ if ( self::meta_key_exists( $_meta_key ) ) {
429
+ foreach ( $_values as $__key => $__value ) {
430
+ $meta_cache[ $_meta_key ][ $__key ] = WPGlobus_Core::text_filter( $__value, self::$builder->get_language(), WPGlobus::RETURN_EMPTY );
431
+ }
432
+ }
433
+ }
434
+ }
435
+
436
+ $_cache[ $_cache_meta_key ][ $object_id ][ $return_value ] = $meta_cache;
437
+
438
+ return $meta_cache;
439
+
440
+ } else {
441
+
442
+ if ( isset( $meta_cache[ $meta_key ] ) ) {
443
+
444
+ if ( $single ) {
445
+
446
+ $_value = WPGlobus_Core::text_filter( $meta_cache[ $meta_key ][0], self::$builder->get_language(), WPGlobus::RETURN_EMPTY );
447
+
448
+ if ( ! empty( $_value ) ) {
449
+ $_value = maybe_unserialize( $_value );
450
+ }
451
+
452
+ if ( is_array( $_value ) ) {
453
+ // !!!!!!
454
+ $_value = array( $_value );
455
+ } else {
456
+ $_cache[ $_cache_meta_key ][ $object_id ][ $return_value ] = $_value;
457
+ }
458
+
459
+ return $_value;
460
+
461
+ } else {
462
+
463
+ foreach ( $meta_cache[ $meta_key ] as $_key => $_value ) {
464
+
465
+ if ( WPGlobus_Core::has_translations( $_value ) ) {
466
+ $_value = WPGlobus_Core::text_filter( $_value, self::$builder->get_language(), WPGlobus::RETURN_EMPTY );
467
+ } elseif ( self::$builder->get_language() !== WPGlobus::Config()->default_language ) {
468
+ $_value = '';
469
+ }
470
+
471
+ if ( ! empty( $_value ) ) {
472
+ $meta_cache[ $meta_key ][ $_key ] = maybe_unserialize( $_value );
473
+ } else {
474
+ $meta_cache[ $meta_key ][ $_key ] = '';
475
+ }
476
+ }
477
+
478
+ $_cache[ $_cache_meta_key ][ $object_id ][ $return_value ] = $meta_cache[ $meta_key ];
479
+
480
+ return $meta_cache[ $meta_key ];
481
+
482
+ }
483
+ }
484
+
485
+ if ( $single ) {
486
+ return '';
487
+ } else {
488
+ return array();
489
+ }
490
+ }
491
+
492
+ // We should not be here. Keeping as a precaution for potential code changes.
493
+
494
+ /** @noinspection PhpUnreachableStatementInspection */
495
+ return $check;
496
+
497
+ }
498
+
499
+ /**
500
+ * Check for meta key existence.
501
+ *
502
+ * @param string $meta_key
503
+ *
504
+ * @return bool
505
+ */
506
+ protected static function meta_key_exists( $meta_key ) {
507
+ if ( in_array( $meta_key, self::$meta_fields, true ) ) {
508
+ return true;
509
+ }
510
+
511
+ return false;
512
+ }
513
+
514
+ /**
515
+ * Build multilingual string.
516
+ *
517
+ * @since 1.9.25
518
+ * @todo First idea is: This function needs for Page Builder by SiteOrigin because it should serialize array before creating multilingual string.
519
+ *
520
+ * @param string[] $ml_array
521
+ *
522
+ * @return string
523
+ */
524
+ protected static function build_multilingual_string( $ml_array ) {
525
+
526
+ /**
527
+ * @todo W.I.P with Page Builder by SiteOrigin.
528
+ */
529
+ /**
530
+ * foreach( $ml_array as $language=>$value ) {
531
+ * if ( is_array($value) ) {
532
+ * $ml_array[$language] = maybe_serialize($value);
533
+ * }
534
+ * }
535
+ * // */
536
+
537
+ $_str = WPGlobus_Utils::build_multilingual_string( $ml_array );
538
+
539
+ return $_str;
540
+ }
541
+ }
542
+
543
+ endif;
trunk/includes/admin/recommendations/class-wpglobus-admin-recommendations.php ADDED
@@ -0,0 +1,251 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WPGlobus Recommendations.
4
+ *
5
+ * @since 1.8.7
6
+ * @package WPGlobus\Admin
7
+ */
8
+
9
+ /**
10
+ * Class Admin Recommendations.
11
+ */
12
+ class WPGlobus_Admin_Recommendations {
13
+
14
+ /**
15
+ * True if need to run JS.
16
+ *
17
+ * @var bool
18
+ */
19
+ protected static $run_js = false;
20
+
21
+ /**
22
+ * Setup actions and filters.
23
+ */
24
+ public static function setup_hooks() {
25
+ add_filter( 'woocommerce_general_settings', array( __CLASS__, 'for_woocommerce' ) );
26
+ add_filter( 'wpglobus_edit_slug_box', array( __CLASS__, 'wpg_plus_slug' ) );
27
+ add_action( 'admin_footer', array( __CLASS__, 'on__admin_footer' ), 1000 );
28
+ add_action( 'wpglobus_gutenberg_metabox', array( __CLASS__, 'on__gutenberg_metabox' ) );
29
+ add_filter(
30
+ 'plugin_action_links_' . dirname( dirname( dirname( dirname( plugin_basename( __FILE__ ) ) ) ) ) . '/wpglobus.php',
31
+ array(
32
+ __CLASS__,
33
+ 'filter__plugin_action_links',
34
+ )
35
+ );
36
+
37
+ }
38
+
39
+ /**
40
+ * Add a link to the Recommendations tab.
41
+ *
42
+ * @since 2.2.20
43
+ *
44
+ * @param array $links array of links for the plugins, adapted when the current plugin is found.
45
+ *
46
+ * @return array
47
+ */
48
+ public static function filter__plugin_action_links( $links ) {
49
+
50
+ $_url = add_query_arg( array( 'page' => WPGlobus::OPTIONS_PAGE_SLUG, 'tab' => 'recommendations' ), admin_url( 'admin.php' ) );
51
+
52
+ $recommend_link = '<a style="font-weight: bold;" href="' . $_url . '">' . esc_html__( 'Go Premium' ) . '</a>';
53
+ array_unshift( $links, $recommend_link );
54
+
55
+ return $links;
56
+ }
57
+
58
+ /**
59
+ * Recommendations for WooCommerce.
60
+ *
61
+ * @param array $settings Passed by WooCommerce.
62
+ *
63
+ * @return array
64
+ *
65
+ * @internal
66
+ */
67
+ public static function for_woocommerce( $settings ) {
68
+ // Ugly set of "IFs" to display heading only if needed, and only once.
69
+ $need_to_show_wc_heading = false;
70
+ $need_to_recommend_wpg_wc = false;
71
+ $need_to_recommend_wpg_mc = false;
72
+
73
+ if ( ! is_plugin_active( 'woocommerce-wpglobus/woocommerce-wpglobus.php' ) ) {
74
+ $need_to_show_wc_heading = true;
75
+ $need_to_recommend_wpg_wc = true;
76
+ }
77
+
78
+ if ( ! is_plugin_active( 'woocommerce-multicurrency/woocommerce-multicurrency.php' ) ) {
79
+ $need_to_show_wc_heading = true;
80
+ $need_to_recommend_wpg_mc = true;
81
+ }
82
+
83
+ if ( $need_to_show_wc_heading ) {
84
+ $id = 'wpglobus-recommend-wc-heading';
85
+ $title = '';
86
+ $desc =
87
+ '<h2><span class="wp-ui-notification" style="padding:10px 20px;">' .
88
+ '<span class="dashicons dashicons-admin-site"></span> ' .
89
+ esc_html__( 'WPGlobus Recommends:', 'wpglobus' ) .
90
+ '</span></h2>';
91
+
92
+ self::add_wc_section( $settings, $id, $title, $desc );
93
+ }
94
+
95
+ if ( $need_to_recommend_wpg_wc ) {
96
+ $url = WPGlobus_Utils::url_wpglobus_site() . 'product/woocommerce-wpglobus/';
97
+ $id = 'wpglobus-recommend-wpg-wc';
98
+ $title = '&bull; ' . esc_html__( 'WPGlobus for WooCommerce', 'wpglobus' );
99
+ $desc =
100
+ '<p class="wp-ui-text-notification">' .
101
+ '<strong>' .
102
+ esc_html__( 'Translate product titles and descriptions, product categories, tags and attributes.', 'wpglobus' ) .
103
+ '</strong>' .
104
+ '</p>' .
105
+ '<p>' .
106
+ '<strong>' .
107
+ esc_html__( 'Get it now:', 'wpglobus' ) . ' ' .
108
+ '</strong>' .
109
+ '<a href="' . esc_url( $url ) . '">' . esc_html( $url ) . '</a>' .
110
+ '</p>';
111
+ self::add_wc_section( $settings, $id, $title, $desc );
112
+ }
113
+
114
+ if ( $need_to_recommend_wpg_mc ) {
115
+ $url = WPGlobus_Utils::url_wpglobus_site() . 'product/wpglobus-multi-currency/';
116
+ $id = 'wpglobus-recommend-wpg-mc';
117
+ $title = '&bull; ' . __( 'WooCommerce Multi-Currency', 'wpglobus' );
118
+ $desc =
119
+ '<p class="wp-ui-text-notification">' .
120
+ '<strong>' .
121
+ esc_html__( 'Accept multiple currencies in your online store!', 'wpglobus' ) .
122
+ '</strong>' .
123
+ '</p>' .
124
+ '<p>' .
125
+ '<strong>' .
126
+ esc_html__( 'Check it out:', 'wpglobus' ) .
127
+ '</strong>' .
128
+ ' ' .
129
+ '<a href="' . $url . '">' . $url . '</a>' .
130
+ '</p>';
131
+ self::add_wc_section( $settings, $id, $title, $desc );
132
+ }
133
+
134
+ return $settings;
135
+
136
+ }
137
+
138
+ /**
139
+ * Generic WC option section consisting of one block of text only.
140
+ *
141
+ * @param array $settings Array of WC settings, passed by reference.
142
+ * @param string $id Section ID, must be unique.
143
+ * @param string $title Section title, no HTML.
144
+ * @param string $desc The text to display, HTML is allowed.
145
+ *
146
+ * @return void
147
+ */
148
+ protected static function add_wc_section( &$settings, $id, $title, $desc ) {
149
+ $settings[] =
150
+ array(
151
+ 'type' => 'title',
152
+ 'id' => $id,
153
+ 'title' => $title,
154
+ 'desc' => $desc,
155
+ );
156
+
157
+ $settings[] =
158
+ array(
159
+ 'type' => 'sectionend',
160
+ 'id' => $id,
161
+ );
162
+ }
163
+
164
+ /**
165
+ * Recommend WPGlobus Plus to edit permalinks.
166
+ *
167
+ * @since 1.9.6
168
+ */
169
+ public static function wpg_plus_slug() {
170
+
171
+ global $pagenow;
172
+
173
+ if ( 'post-new.php' === $pagenow ) {
174
+ return;
175
+ }
176
+
177
+ $container_start = '<p id="wpglobus-plus-slug-recommendation" style="padding:5px; font-weight: bold"><span class="dashicons dashicons-admin-site"></span> ';
178
+ $container_end = '</p>';
179
+
180
+ if ( ! is_plugin_active( 'wpglobus-plus/wpglobus-plus.php' ) ) {
181
+ $url = WPGlobus_Utils::url_wpglobus_site() . 'product/wpglobus-plus/#slug';
182
+ echo $container_start; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
183
+ esc_html_e( 'Translate permalinks with our premium add-on, WPGlobus Plus!', 'wpglobus' );
184
+ echo ' ';
185
+ esc_html_e( 'Check it out:', 'wpglobus' );
186
+ echo ' ';
187
+ echo '<a href="' . esc_url( $url ) . '" target="_blank">' . esc_html( $url ) . '</a>';
188
+ echo $container_end; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
189
+
190
+ self::$run_js = true;
191
+
192
+ } elseif ( ! class_exists( 'WPGlobusPlus_Slug', false ) ) {
193
+ $url = admin_url( 'admin.php' ) . '?page=' . WPGlobusPlus::WPGLOBUS_PLUS_OPTIONS_PAGE . '&tab=modules';
194
+ echo $container_start; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
195
+ esc_html_e( 'To translate permalinks, please activate the module Slug.', 'wpglobus' );
196
+ echo ' ';
197
+ // Do not translate.
198
+ $msg = __( 'Go to WPGlobus Plus Options page', 'wpglobus-plus' );
199
+
200
+ echo '<a href="' . esc_url( $url ) . '" target="_blank">' . esc_html( $msg ) . '.</a>';
201
+ echo $container_end; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
202
+
203
+ self::$run_js = true;
204
+
205
+ }
206
+ }
207
+
208
+ /**
209
+ * Action wpglobus_gutenberg_metabox.
210
+ *
211
+ * @since 1.9.17
212
+ */
213
+ public static function on__gutenberg_metabox() {
214
+
215
+ if ( WPGlobus::Config()->builder->is_running() ) {
216
+ self::wpg_plus_slug();
217
+ self::$run_js = false;
218
+ }
219
+
220
+ }
221
+
222
+ /**
223
+ * Action admin_footer.
224
+ *
225
+ * @since 1.9.17
226
+ */
227
+ public static function on__admin_footer() {
228
+
229
+ if ( ! self::$run_js ) {
230
+ return;
231
+ }
232
+
233
+ if ( ! WPGlobus::Config()->builder->is_running() ) {
234
+ return;
235
+ }
236
+
237
+ if ( WPGlobus::Config()->builder->get_language() === WPGlobus::Config()->default_language ) {
238
+ return;
239
+ }
240
+
241
+ ?>
242
+ <script>
243
+ var $edit_slug_box = jQuery('#edit-slug-box');
244
+ $edit_slug_box.css({'display': 'none'});
245
+ var wpglobus_slug_recomm_box = jQuery('#wpglobus-plus-slug-recommendation').remove();
246
+ $edit_slug_box.before(wpglobus_slug_recomm_box);
247
+ </script>
248
+ <?php
249
+ }
250
+
251
+ }
trunk/includes/admin/register-post-types/class-wpglobus-register-post-types.php ADDED
@@ -0,0 +1,147 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * File: class-wpglobus-register-post-types.php
4
+ *
5
+ * @since 2.2.24
6
+ * @package WPGlobus\Admin
7
+ */
8
+
9
+ /**
10
+ * Class WPGlobus_Register_Post_Types.
11
+ */
12
+ if ( ! class_exists( 'WPGlobus_Register_Post_Types' ) ) :
13
+
14
+ class WPGlobus_Register_Post_Types {
15
+
16
+ /**
17
+ * @var array
18
+ */
19
+ protected static $pages = array( 'edit.php', 'post.php' );
20
+
21
+ /**
22
+ * Don't handling with these post types.
23
+ * @var array
24
+ */
25
+ protected static $excluded_post_types = array(
26
+ 'attachment',
27
+ 'attachment:audio',
28
+ 'attachment:video',
29
+ 'revision',
30
+ 'nav_menu_item',
31
+ 'custom_css',
32
+ 'customize_changeset',
33
+ 'oembed_cache',
34
+ 'user_request',
35
+ 'wp_block',
36
+ );
37
+
38
+ /**
39
+ * @var array
40
+ */
41
+ protected static $post_types = array();
42
+
43
+ /**
44
+ * Constructor.
45
+ */
46
+ public static function construct() {
47
+
48
+ if ( ! WPGlobus_WP::is_pagenow(self::$pages) ) {
49
+ return;
50
+ }
51
+
52
+ /**
53
+ * @see wp-includes\post.php
54
+ */
55
+ add_action( 'registered_post_type', array( __CLASS__, 'on__registered' ), 10, 2 );
56
+
57
+ add_action( 'wp_loaded', array( __CLASS__, 'on__wp_loaded' ) );
58
+
59
+ }
60
+
61
+ /**
62
+ * Fires after a post type is registered.
63
+ *
64
+ * @param string $post_type Post type.
65
+ * @param WP_Post_Type $post_type_object Arguments used to register the post type.
66
+ */
67
+ public static function on__registered( $post_type, $post_type_object ) {
68
+
69
+ global $_wp_post_type_features;
70
+
71
+ if ( defined('DOING_AJAX') && DOING_AJAX ) {
72
+ return;
73
+ }
74
+
75
+ static $_init = null;
76
+
77
+ if ( is_null($_init) ) {
78
+
79
+ self::$excluded_post_types = array_merge(self::$excluded_post_types, WPGlobus::Config()->disabled_entities);
80
+
81
+ self::$excluded_post_types = array_unique( self::$excluded_post_types );
82
+
83
+ $_init = true;
84
+
85
+ }
86
+
87
+ if ( self::is_excluded_post_type($post_type) ) {
88
+ return;
89
+ }
90
+
91
+ if ( empty($_wp_post_type_features[$post_type]) ) {
92
+ return;
93
+ }
94
+
95
+ /**
96
+ * @see `use_block_editor_for_post_type()` in wp-admin\includes\post.php
97
+ */
98
+ self::$post_types[$post_type] = array(
99
+ 'show_in_rest' => $post_type_object->show_in_rest,
100
+ 'features' => $_wp_post_type_features[$post_type]
101
+ );
102
+
103
+ }
104
+
105
+ /**
106
+ * Fired to save option.
107
+ */
108
+ public static function on__wp_loaded() {
109
+
110
+ if ( defined('DOING_AJAX') && DOING_AJAX ) {
111
+ return;
112
+ }
113
+ if ( ! empty(self::$post_types) ) {
114
+ update_option( WPGlobus::Config()->option_register_post_types, self::$post_types, false );
115
+ }
116
+ }
117
+
118
+ /**
119
+ * Check for excluded post type.
120
+ *
121
+ * @return bool
122
+ */
123
+ public static function is_excluded_post_type( $post_type = '') {
124
+
125
+ if ( empty($post_type) ) {
126
+ return true;
127
+ }
128
+
129
+ if ( in_array( $post_type, self::get_excluded_post_types() ) ) {
130
+ return true;
131
+ }
132
+
133
+ return false;
134
+ }
135
+
136
+ /**
137
+ * Get excluded post types.
138
+ *
139
+ * @return array
140
+ */
141
+ public static function get_excluded_post_types() {
142
+ return self::$excluded_post_types;
143
+ }
144
+ }
145
+
146
+ endif;
147
+ /* EOF */
trunk/includes/admin/wpglobus-admin.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @since 1.8.1
4
+ * @package WPGlobus
5
+ */
6
+
7
+ /**
8
+ * Admin page central.
9
+ *
10
+ * @since 1.6.6
11
+ */
12
+ require_once dirname( __FILE__ ) . '/central/class-wpglobus-admin-central.php';
13
+ WPGlobus_Admin_Central::construct();
14
+
15
+ /**
16
+ * @since 2.2.24
17
+ */
18
+ require_once dirname( __FILE__ ) . '/register-post-types/class-wpglobus-register-post-types.php';
19
+ WPGlobus_Register_Post_Types::construct();
20
+
21
+ /**
22
+ * @since 2.4
23
+ */
24
+ require_once dirname( __FILE__ ) . '/class-wpglobus-admin-post.php';
25
+ WPGlobus_Admin_Post::construct();
26
+
27
+ if ( isset( $_GET['wpglobus-debug'] ) ) { // WPCS: input var ok, sanitization ok.
28
+ /**
29
+ * To load debug info
30
+ * site/wp-admin/post.php?post={{post_ID}}&action=edit&wpglobus-debug=godmode
31
+ * or
32
+ * site/wp-admin/post.php?post={{post_ID}}&action=edit&wpglobus-debug=meta
33
+ */
34
+ require_once dirname( __FILE__ ) . '/debug/class-wpglobus-admin-debug.php';
35
+ WPGlobus_Admin_Debug::get_instance();
36
+ }
37
+
38
+ # --- EOF
trunk/includes/builders/assets/wpglobus-admin-builder-49.js ADDED
@@ -0,0 +1,348 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * WPGlobus Administration Core.
3
+ * Interface JS functions
4
+ *
5
+ * @since 1.9.17
6
+ *
7
+ * @package WPGlobus
8
+ * @subpackage Administration
9
+ */
10
+ /*jslint browser: true*/
11
+ /*global jQuery, console, WPGlobusCore*/
12
+
13
+ var WPGlobusCore;
14
+
15
+ (function($) {
16
+ var api;
17
+ api = WPGlobusCore = {
18
+ strpos: function( haystack, needle, offset){
19
+ haystack = "" + haystack;
20
+ var i = haystack.indexOf( needle, offset );
21
+ return i >= 0 ? i : false;
22
+ },
23
+
24
+ TextFilter: function(text, language, return_in){
25
+ if ( typeof text == 'undefined' || '' === text ) { return text; }
26
+
27
+ var pos_start, pos_end, possible_delimiters = [], is_local_text_found = false;;
28
+
29
+ language = '' == language ? 'en' : language;
30
+ return_in = typeof return_in == 'undefined' || '' == return_in ? 'RETURN_IN_DEFAULT_LANGUAGE' : return_in;
31
+
32
+ possible_delimiters[0] = [];
33
+ possible_delimiters[0]['start'] = WPGlobusCoreData.locale_tag_start.replace('%s', language);
34
+ possible_delimiters[0]['end'] = WPGlobusCoreData.locale_tag_end;
35
+
36
+ possible_delimiters[1] = [];
37
+ possible_delimiters[1]['start'] = '<!--:'+language+'-->';
38
+ possible_delimiters[1]['end'] = '<!--:-->';
39
+
40
+ possible_delimiters[2] = [];
41
+ possible_delimiters[2]['start'] = '[:'+language+']';
42
+ possible_delimiters[2]['end'] = '[:';
43
+
44
+
45
+
46
+ for (var i = 0; i < 3; i++) {
47
+
48
+ pos_start = api.strpos( text, possible_delimiters[i]['start'] );
49
+ if ( pos_start === false ) {
50
+ continue;
51
+ }
52
+
53
+ pos_start = pos_start + possible_delimiters[i]['start'].length;
54
+
55
+ pos_end = api.strpos( text, possible_delimiters[i]['end'], pos_start );
56
+
57
+ if ( pos_end === false ) {
58
+ text = text.substr( pos_start );
59
+ } else {
60
+ text = text.substr( pos_start, pos_end - pos_start );
61
+ }
62
+
63
+ is_local_text_found = true;
64
+ break;
65
+
66
+ }
67
+
68
+ if ( ! is_local_text_found ) {
69
+ if ( return_in == 'RETURN_EMPTY' ) {
70
+ if ( language == WPGlobusCoreData.default_language && ! /(\{:|\[:|<!--:)[a-z]{2}/.test(text) ) {
71
+ /** do nothing */
72
+ } else {
73
+ text = '';
74
+ }
75
+ } else {
76
+ /**
77
+ * Try RETURN_IN_DEFAULT_LANGUAGE.
78
+ */
79
+ if ( language == WPGlobusCoreData.default_language ) {
80
+ if ( /(\{:|\[:|<!--:)[a-z]{2}/.test(text) ) {
81
+ text = '';
82
+ }
83
+ } else {
84
+ text = api.TextFilter( text, WPGlobusCoreData.default_language );
85
+ }
86
+ }
87
+ }
88
+ return text;
89
+ },
90
+ addLocaleMarks: function(text, language) {
91
+ return WPGlobusCoreData.locale_tag_start.replace('%s', language) + text + WPGlobusCoreData.locale_tag_end;
92
+ },
93
+ getTranslations: function(text) {
94
+ var t = {},
95
+ return_in;
96
+ $.each(WPGlobusCoreData.enabled_languages, function(i,l){
97
+ return_in = l == WPGlobusCoreData.default_language ? 'RETURN_IN_DEFAULT_LANGUAGE' : 'RETURN_EMPTY';
98
+ t[l] = api.TextFilter(text, l, return_in);
99
+ });
100
+ return t;
101
+ },
102
+ getString: function(s, newVal, l) {
103
+ if ( 'undefined' === typeof(s) ) {
104
+ return s;
105
+ }
106
+ if ( 'undefined' === typeof(newVal) ) {
107
+ newVal = '';
108
+ }
109
+ if ( 'undefined' === typeof(l) ) {
110
+ l = WPGlobusCoreData.language;
111
+ }
112
+
113
+ s = api.getTranslations(s);
114
+ s[l] = newVal;
115
+
116
+ var cS = '';
117
+
118
+ $.each(s, function(ln,val){
119
+ if ( '' != val && ln != WPGlobusCoreData.default_language) {
120
+ cS += api.addLocaleMarks(val, ln);
121
+ }
122
+ });
123
+
124
+ if ( '' != s[WPGlobusCoreData.default_language] ) {
125
+ if ( '' == cS ) {
126
+ cS = s[WPGlobusCoreData.default_language];
127
+ } else {
128
+ cS = api.addLocaleMarks(s[WPGlobusCoreData.default_language], WPGlobusCoreData.default_language) + cS;
129
+ }
130
+ }
131
+ return cS;
132
+ }
133
+ };
134
+ })(jQuery);
135
+
136
+ jQuery(document).ready(function ($) {
137
+ "use strict";
138
+
139
+ if ( 'undefined' === typeof WPGlobusAdmin ) {
140
+ return;
141
+ }
142
+
143
+ var api = {
144
+ languageSelectorBoxDelta: 0,
145
+ locationPathname: '/wp-admin/post.php',
146
+ init: function() {
147
+ //api.setCookie();
148
+ if ('taxonomy-edit' === WPGlobusAdmin.page) {
149
+ api.taxonomyEdit();
150
+ } else {
151
+ api.start();
152
+ }
153
+ },
154
+ _info: function() {
155
+ var lang = undefined;
156
+ if( $('#language').length > 0 ) {
157
+ lang = $('#language').val();
158
+ }
159
+ console.log('Current language from hidden (#language) : ', lang);
160
+
161
+ lang = undefined;
162
+ if( $('#wpglobus-language').length > 0 ) {
163
+ lang = $('#wpglobus-language').val();
164
+ }
165
+ console.log('Current language from hidden (#wpglobus-language) : ', lang);
166
+
167
+ lang = undefined;
168
+ if( $('input[name="wpglobus-language"]').length > 0 ) {
169
+ lang = $('input[name="wpglobus-language"]').val();
170
+ }
171
+ console.log('Current language from hidden (input[name="wpglobus-language"]) : ', lang);
172
+
173
+ lang = undefined;
174
+ if( $('input[name="wpglobus_language"]').length > 0 ) {
175
+ lang = $('input[name="wpglobus_language"]').val();
176
+ }
177
+ console.log('Current language from hidden (input[name="wpglobus_language"]) : ', lang);
178
+ console.log('Builder : ', WPGlobusAdmin.builder);
179
+
180
+ var content = $('#content').val();
181
+ if ( content == '' ) {
182
+ console.log('Editor content (#content) : (empty)');
183
+ } else {
184
+ console.log(content);
185
+ }
186
+ },
187
+ checkCookie: function() {
188
+ if ( -1 != window.location.search.indexOf('language=') ) {
189
+ return false;
190
+ }
191
+ if ( 'post.php' == WPGlobusAdmin.page ) {
192
+ var cookie = wpCookies.get(WPGlobusAdmin.builder.languageCookie);
193
+
194
+ if ( null !== cookie && history.pushState) {
195
+ cookie = cookie.split('+');
196
+ var language = cookie[0];
197
+ if ('undefined' !== typeof cookie[1] && cookie[1] + 0 == WPGlobusAdmin.$_get.post ) {
198
+ var newurl = window.location.protocol + "//" + window.location.host + window.location.pathname + window.location.search + '&language='+language;
199
+ window.history.pushState({path:newurl},'',newurl);
200
+ return language;
201
+ }
202
+ }
203
+ }
204
+ return false;
205
+ },
206
+ setCookie: function() {
207
+ var lang = api.checkCookie();
208
+ if ( ! lang ) {
209
+ lang = WPGlobusAdmin.$_get.language;
210
+ if ( 'undefined' === typeof lang ) {
211
+ lang = WPGlobusAdmin.data.default_language;
212
+ }
213
+ }
214
+ wpCookies.set(WPGlobusAdmin.builder.languageCookie, lang+'+'+WPGlobusAdmin.$_get.post, 31536000, api.locationPathname );
215
+ },
216
+ setLocationSearch: function() {
217
+ if ( ! history.pushState || -1 != window.location.search.indexOf('language=') ) {
218
+ return;
219
+ }
220
+ if ( WPGlobusAdmin.data.default_language != WPGlobusAdmin.currentTab ) {
221
+ var newurl = window.location.protocol + "//" + window.location.host + window.location.pathname + window.location.search + '&language='+WPGlobusAdmin.currentTab;
222
+ window.history.pushState({path:newurl},'',newurl);
223
+ }
224
+ },
225
+ taxonomyEdit: function() {
226
+
227
+ $('.wpglobus-taxonomy-tabs').insertAfter('#ajax-response');
228
+
229
+ /**
230
+ * Make class wrap as tabs container.
231
+ * Tabs on.
232
+ */
233
+ $('.wrap').tabs();
234
+
235
+ $(WPGlobusAdmin.data.multilingualSlug.title).insertAfter('.term-slug-wrap th label');
236
+
237
+ if ( WPGlobusAdmin.currentTab !== WPGlobusAdmin.data.default_language ) {
238
+ $('.wpglobus-tax-edit-tab').removeClass('ui-tabs-active ui-state-active');
239
+ $('#wpglobus-link-tab-'+WPGlobusAdmin.currentTab).addClass('ui-tabs-active ui-state-active');
240
+ }
241
+
242
+ $(document).on('click', '.wpglobus-tax-edit-tab a', function(event) {
243
+ event.preventDefault();
244
+ var _href = $(this).data('href');
245
+ location.href = _href;
246
+ });
247
+
248
+ api.setMultilingualFields();
249
+
250
+ /**
251
+ * Init Yoast tinymce editor for description.
252
+ */
253
+ $(document).on( 'tinymce-editor-init', function( event, editor ) {
254
+ $( '#' + editor.getContainer().id ).find('iframe').addClass(WPGlobusAdmin.builder.translatableClass).css({'width':''});
255
+ });
256
+ },
257
+ start: function() {
258
+ /**
259
+ *
260
+ */
261
+ api.setLocationSearch();
262
+
263
+ /**
264
+ *
265
+ */
266
+ var wrap_at = '#postdivrich',
267
+ set_title = true,
268
+ content_tabs_id = '#post-body-content';
269
+ if ( WPGlobusAdmin.data.support['editor'] === false ) {
270
+ wrap_at = '#titlediv';
271
+ set_title = false;
272
+ }
273
+ if ( WPGlobusAdmin.data.support['title'] === false ) {
274
+ set_title = false;
275
+ }
276
+
277
+ /**
278
+ * Make post-body-content as tabs container.
279
+ */
280
+ $(content_tabs_id).prepend($('.wpglobus-post-body-tabs-list'));
281
+ $.each(WPGlobusAdmin.tabs, function (index, suffix) {
282
+ if ('default' === suffix) {
283
+ $(wrap_at).wrap('<div id="tab-default"></div>');
284
+ if ( set_title ) {
285
+ $($('#titlediv')).insertBefore(wrap_at);
286
+ }
287
+ } else {
288
+ $(wrap_at+'-' + suffix).wrap('<div id="tab-' + suffix + '"></div>');
289
+ if ( set_title ) {
290
+ $($('#titlediv-' + suffix)).insertBefore(wrap_at+'-' + suffix);
291
+ }
292
+ }
293
+ });
294
+
295
+ $(content_tabs_id).addClass('wpglobus-post-body-tabs');
296
+
297
+ /**
298
+ * Set fields as multilingual.
299
+ */
300
+ //setTimeout(api.setMultilingualFields(), 1000);
301
+ api.setMultilingualFields();
302
+
303
+ /**
304
+ *
305
+ */
306
+ //api.ajaxPrefilter();
307
+
308
+ },
309
+ ajaxPrefilter: function() {
310
+ /**
311
+ * @todo WIP.
312
+ */
313
+ $.ajaxPrefilter(function( options, originalOptions, jqXHR ) {
314
+ // Modify options, control originalOptions, store jqXHR, etc
315
+ //console.log(options);
316
+ });
317
+ },
318
+ setMultilingualFields: function() {
319
+ $.each(WPGlobusAdmin.builder.multilingualFields, function(indx, field) {
320
+ var elementBy = 'name';
321
+ var node = document.getElementsByName(field);
322
+ var $element;
323
+
324
+ if ( 0 == node.length ) {
325
+ elementBy = 'id';
326
+ node = document.getElementById(field);
327
+ }
328
+
329
+ if ( null === node ) {
330
+ return;
331
+ } else {
332
+ if ( 'id' == elementBy ) {
333
+ $element = $('#'+field);
334
+ } else {
335
+ var nodeName = node[0].nodeName;
336
+ nodeName = nodeName.toLowerCase();
337
+ $element = $(nodeName+'[name="'+field+'"]');
338
+ }
339
+ $element.addClass(WPGlobusAdmin.builder.translatableClass);
340
+ }
341
+
342
+ });
343
+ }
344
+ }
345
+
346
+ WPGlobusAdmin = $.extend({}, WPGlobusAdmin, api);
347
+ WPGlobusAdmin.init();
348
+ });
trunk/includes/builders/assets/wpglobus-admin-builder-49.min.js ADDED
@@ -0,0 +1 @@
 
1
+ var WPGlobusCore;!function(l){var s;s=WPGlobusCore={strpos:function(a,t,e){var o=(a=""+a).indexOf(t,e);return 0<=o&&o},TextFilter:function(a,t,e){if(void 0===a||""===a)return a;var o,n,l=[],i=!1;t=""==t?"en":t,e=void 0===e||""==e?"RETURN_IN_DEFAULT_LANGUAGE":e,l[0]=[],l[0].start=WPGlobusCoreData.locale_tag_start.replace("%s",t),l[0].end=WPGlobusCoreData.locale_tag_end,l[1]=[],l[1].start="\x3c!--:"+t+"--\x3e",l[1].end="\x3c!--:--\x3e",l[2]=[],l[2].start="[:"+t+"]",l[2].end="[:";for(var u=0;u<3;u++)if(!1!==(o=s.strpos(a,l[u].start))){o+=l[u].start.length,a=!1===(n=s.strpos(a,l[u].end,o))?a.substr(o):a.substr(o,n-o),i=!0;break}return i||("RETURN_EMPTY"==e?(t!=WPGlobusCoreData.default_language||/(\{:|\[:|<!--:)[a-z]{2}/.test(a))&&(a=""):t==WPGlobusCoreData.default_language?/(\{:|\[:|<!--:)[a-z]{2}/.test(a)&&(a=""):a=s.TextFilter(a,WPGlobusCoreData.default_language)),a},addLocaleMarks:function(a,t){return WPGlobusCoreData.locale_tag_start.replace("%s",t)+a+WPGlobusCoreData.locale_tag_end},getTranslations:function(e){var o,n={};return l.each(WPGlobusCoreData.enabled_languages,function(a,t){o=t==WPGlobusCoreData.default_language?"RETURN_IN_DEFAULT_LANGUAGE":"RETURN_EMPTY",n[t]=s.TextFilter(e,t,o)}),n},getString:function(a,t,e){if(void 0===a)return a;void 0===t&&(t=""),void 0===e&&(e=WPGlobusCoreData.language),(a=s.getTranslations(a))[e]=t;var o="";return l.each(a,function(a,t){""!=t&&a!=WPGlobusCoreData.default_language&&(o+=s.addLocaleMarks(t,a))}),""!=a[WPGlobusCoreData.default_language]&&(o=""==o?a[WPGlobusCoreData.default_language]:s.addLocaleMarks(a[WPGlobusCoreData.default_language],WPGlobusCoreData.default_language)+o),o}}}(jQuery),jQuery(document).ready(function(i){"use strict";if("undefined"!=typeof WPGlobusAdmin){var t={languageSelectorBoxDelta:0,locationPathname:"/wp-admin/post.php",init:function(){"taxonomy-edit"===WPGlobusAdmin.page?t.taxonomyEdit():t.start()},_info:function(){var a=void 0;0<i("#language").length&&(a=i("#language").val()),console.log("Current language from hidden (#language) : ",a),a=void 0,0<i("#wpglobus-language").length&&(a=i("#wpglobus-language").val()),console.log("Current language from hidden (#wpglobus-language) : ",a),a=void 0,0<i('input[name="wpglobus-language"]').length&&(a=i('input[name="wpglobus-language"]').val()),console.log('Current language from hidden (input[name="wpglobus-language"]) : ',a),a=void 0,0<i('input[name="wpglobus_language"]').length&&(a=i('input[name="wpglobus_language"]').val()),console.log('Current language from hidden (input[name="wpglobus_language"]) : ',a),console.log("Builder : ",WPGlobusAdmin.builder);var t=i("#content").val();""==t?console.log("Editor content (#content) : (empty)"):console.log(t)},checkCookie:function(){if(-1!=window.location.search.indexOf("language="))return!1;if("post.php"==WPGlobusAdmin.page){var a=wpCookies.get(WPGlobusAdmin.builder.languageCookie);if(null!==a&&history.pushState){var t=(a=a.split("+"))[0];if(void 0!==a[1]&&a[1]+0==WPGlobusAdmin.$_get.post){var e=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search+"&language="+t;return window.history.pushState({path:e},"",e),t}}}return!1},setCookie:function(){var a=t.checkCookie();a||void 0===(a=WPGlobusAdmin.$_get.language)&&(a=WPGlobusAdmin.data.default_language),wpCookies.set(WPGlobusAdmin.builder.languageCookie,a+"+"+WPGlobusAdmin.$_get.post,31536e3,t.locationPathname)},setLocationSearch:function(){if(history.pushState&&-1==window.location.search.indexOf("language=")&&WPGlobusAdmin.data.default_language!=WPGlobusAdmin.currentTab){var a=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search+"&language="+WPGlobusAdmin.currentTab;window.history.pushState({path:a},"",a)}},taxonomyEdit:function(){i(".wpglobus-taxonomy-tabs").insertAfter("#ajax-response"),i(".wrap").tabs(),i(WPGlobusAdmin.data.multilingualSlug.title).insertAfter(".term-slug-wrap th label"),WPGlobusAdmin.currentTab!==WPGlobusAdmin.data.default_language&&(i(".wpglobus-tax-edit-tab").removeClass("ui-tabs-active ui-state-active"),i("#wpglobus-link-tab-"+WPGlobusAdmin.currentTab).addClass("ui-tabs-active ui-state-active")),i(document).on("click",".wpglobus-tax-edit-tab a",function(a){a.preventDefault();var t=i(this).data("href");location.href=t}),t.setMultilingualFields(),i(document).on("tinymce-editor-init",function(a,t){i("#"+t.getContainer().id).find("iframe").addClass(WPGlobusAdmin.builder.translatableClass).css({width:""})})},start:function(){t.setLocationSearch();var e="#postdivrich",o=!0,a="#post-body-content";!1===WPGlobusAdmin.data.support.editor&&(o=!(e="#titlediv")),!1===WPGlobusAdmin.data.support.title&&(o=!1),i(a).prepend(i(".wpglobus-post-body-tabs-list")),i.each(WPGlobusAdmin.tabs,function(a,t){"default"===t?(i(e).wrap('<div id="tab-default"></div>'),o&&i(i("#titlediv")).insertBefore(e)):(i(e+"-"+t).wrap('<div id="tab-'+t+'"></div>'),o&&i(i("#titlediv-"+t)).insertBefore(e+"-"+t))}),i(a).addClass("wpglobus-post-body-tabs"),t.setMultilingualFields()},ajaxPrefilter:function(){i.ajaxPrefilter(function(a,t,e){})},setMultilingualFields:function(){i.each(WPGlobusAdmin.builder.multilingualFields,function(a,t){var e,o="name",n=document.getElementsByName(t);if(0==n.length&&(o="id",n=document.getElementById(t)),null!==n){if("id"==o)e=i("#"+t);else{var l=n[0].nodeName;l=l.toLowerCase(),e=i(l+'[name="'+t+'"]')}e.addClass(WPGlobusAdmin.builder.translatableClass)}})}};WPGlobusAdmin=i.extend({},WPGlobusAdmin,t),WPGlobusAdmin.init()}});
trunk/includes/builders/assets/wpglobus-admin-builder-51.js ADDED
@@ -0,0 +1,348 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * WPGlobus Administration Core.
3
+ * Interface JS functions
4
+ *
5
+ * @since 1.9.17
6
+ *
7
+ * @package WPGlobus
8
+ * @subpackage Administration
9
+ */
10
+ /*jslint browser: true*/
11
+ /*global jQuery, console, WPGlobusCore*/
12
+
13
+ var WPGlobusCore;
14
+
15
+ (function($) {
16
+ var api;
17
+ api = WPGlobusCore = {
18
+ strpos: function( haystack, needle, offset){
19
+ haystack = "" + haystack;
20
+ var i = haystack.indexOf( needle, offset );
21
+ return i >= 0 ? i : false;
22
+ },
23
+
24
+ TextFilter: function(text, language, return_in){
25
+ if ( typeof text == 'undefined' || '' === text ) { return text; }
26
+
27
+ var pos_start, pos_end, possible_delimiters = [], is_local_text_found = false;;
28
+
29
+ language = '' == language ? 'en' : language;
30
+ return_in = typeof return_in == 'undefined' || '' == return_in ? 'RETURN_IN_DEFAULT_LANGUAGE' : return_in;
31
+
32
+ possible_delimiters[0] = [];
33
+ possible_delimiters[0]['start'] = WPGlobusCoreData.locale_tag_start.replace('%s', language);
34
+ possible_delimiters[0]['end'] = WPGlobusCoreData.locale_tag_end;
35
+
36
+ possible_delimiters[1] = [];
37
+ possible_delimiters[1]['start'] = '<!--:'+language+'-->';
38
+ possible_delimiters[1]['end'] = '<!--:-->';
39
+
40
+ possible_delimiters[2] = [];
41
+ possible_delimiters[2]['start'] = '[:'+language+']';
42
+ possible_delimiters[2]['end'] = '[:';
43
+
44
+
45
+
46
+ for (var i = 0; i < 3; i++) {
47
+
48
+ pos_start = api.strpos( text, possible_delimiters[i]['start'] );
49
+ if ( pos_start === false ) {
50
+ continue;
51
+ }
52
+
53
+ pos_start = pos_start + possible_delimiters[i]['start'].length;
54
+
55
+ pos_end = api.strpos( text, possible_delimiters[i]['end'], pos_start );
56
+
57
+ if ( pos_end === false ) {
58
+ text = text.substr( pos_start );
59
+ } else {
60
+ text = text.substr( pos_start, pos_end - pos_start );
61
+ }
62
+
63
+ is_local_text_found = true;
64
+ break;
65
+
66
+ }
67
+
68
+ if ( ! is_local_text_found ) {
69
+ if ( return_in == 'RETURN_EMPTY' ) {
70
+ if ( language == WPGlobusCoreData.default_language && ! /(\{:|\[:|<!--:)[a-z]{2}/.test(text) ) {
71
+ /** do nothing */
72
+ } else {
73
+ text = '';
74
+ }
75
+ } else {
76
+ /**
77
+ * Try RETURN_IN_DEFAULT_LANGUAGE.
78
+ */
79
+ if ( language == WPGlobusCoreData.default_language ) {
80
+ if ( /(\{:|\[:|<!--:)[a-z]{2}/.test(text) ) {
81
+ text = '';
82
+ }
83
+ } else {
84
+ text = api.TextFilter( text, WPGlobusCoreData.default_language );
85
+ }
86
+ }
87
+ }
88
+ return text;
89
+ },
90
+ addLocaleMarks: function(text, language) {
91
+ return WPGlobusCoreData.locale_tag_start.replace('%s', language) + text + WPGlobusCoreData.locale_tag_end;
92
+ },
93
+ getTranslations: function(text) {
94
+ var t = {},
95
+ return_in;
96
+ $.each(WPGlobusCoreData.enabled_languages, function(i,l){
97
+ return_in = l == WPGlobusCoreData.default_language ? 'RETURN_IN_DEFAULT_LANGUAGE' : 'RETURN_EMPTY';
98
+ t[l] = api.TextFilter(text, l, return_in);
99
+ });
100
+ return t;
101
+ },
102
+ getString: function(s, newVal, l) {
103
+ if ( 'undefined' === typeof(s) ) {
104
+ return s;
105
+ }
106
+ if ( 'undefined' === typeof(newVal) ) {
107
+ newVal = '';
108
+ }
109
+ if ( 'undefined' === typeof(l) ) {
110
+ l = WPGlobusCoreData.language;
111
+ }
112
+
113
+ s = api.getTranslations(s);
114
+ s[l] = newVal;
115
+
116
+ var cS = '';
117
+
118
+ $.each(s, function(ln,val){
119
+ if ( '' != val && ln != WPGlobusCoreData.default_language) {
120
+ cS += api.addLocaleMarks(val, ln);
121
+ }
122
+ });
123
+
124
+ if ( '' != s[WPGlobusCoreData.default_language] ) {
125
+ if ( '' == cS ) {
126
+ cS = s[WPGlobusCoreData.default_language];
127
+ } else {
128
+ cS = api.addLocaleMarks(s[WPGlobusCoreData.default_language], WPGlobusCoreData.default_language) + cS;
129
+ }
130
+ }
131
+ return cS;
132
+ }
133
+ };
134
+ })(jQuery);
135
+
136
+ jQuery(document).ready(function ($) {
137
+ "use strict";
138
+
139
+ if ( 'undefined' === typeof WPGlobusAdmin ) {
140
+ return;
141
+ }
142
+
143
+ var api = {
144
+ languageSelectorBoxDelta: 0,
145
+ locationPathname: '/wp-admin/post.php',
146
+ init: function() {
147
+ //api.setCookie();
148
+ if ('taxonomy-edit' === WPGlobusAdmin.page) {
149
+ api.taxonomyEdit();
150
+ } else {
151
+ api.start();
152
+ }
153
+ },
154
+ _info: function() {
155
+ var lang = undefined;
156
+ if( $('#language').length > 0 ) {
157
+ lang = $('#language').val();
158
+ }
159
+ console.log('Current language from hidden (#language) : ', lang);
160
+
161
+ lang = undefined;
162
+ if( $('#wpglobus-language').length > 0 ) {
163
+ lang = $('#wpglobus-language').val();
164
+ }
165
+ console.log('Current language from hidden (#wpglobus-language) : ', lang);
166
+
167
+ lang = undefined;
168
+ if( $('input[name="wpglobus-language"]').length > 0 ) {
169
+ lang = $('input[name="wpglobus-language"]').val();
170
+ }
171
+ console.log('Current language from hidden (input[name="wpglobus-language"]) : ', lang);
172
+
173
+ lang = undefined;
174
+ if( $('input[name="wpglobus_language"]').length > 0 ) {
175
+ lang = $('input[name="wpglobus_language"]').val();
176
+ }
177
+ console.log('Current language from hidden (input[name="wpglobus_language"]) : ', lang);
178
+ console.log('Builder : ', WPGlobusAdmin.builder);
179
+
180
+ var content = $('#content').val();
181
+ if ( content == '' ) {
182
+ console.log('Editor content (#content) : (empty)');
183
+ } else {
184
+ console.log(content);
185
+ }
186
+ },
187
+ checkCookie: function() {
188
+ if ( -1 != window.location.search.indexOf('language=') ) {
189
+ return false;
190
+ }
191
+ if ( 'post.php' == WPGlobusAdmin.page ) {
192
+ var cookie = wpCookies.get(WPGlobusAdmin.builder.languageCookie);
193
+
194
+ if ( null !== cookie && history.pushState) {
195
+ cookie = cookie.split('+');
196
+ var language = cookie[0];
197
+ if ('undefined' !== typeof cookie[1] && cookie[1] + 0 == WPGlobusAdmin.$_get.post ) {
198
+ var newurl = window.location.protocol + "//" + window.location.host + window.location.pathname + window.location.search + '&language='+language;
199
+ window.history.pushState({path:newurl},'',newurl);
200
+ return language;
201
+ }
202
+ }
203
+ }
204
+ return false;
205
+ },
206
+ setCookie: function() {
207
+ var lang = api.checkCookie();
208
+ if ( ! lang ) {
209
+ lang = WPGlobusAdmin.$_get.language;
210
+ if ( 'undefined' === typeof lang ) {
211
+ lang = WPGlobusAdmin.data.default_language;
212
+ }
213
+ }
214
+ wpCookies.set(WPGlobusAdmin.builder.languageCookie, lang+'+'+WPGlobusAdmin.$_get.post, 31536000, api.locationPathname );
215
+ },
216
+ setLocationSearch: function() {
217
+ if ( ! history.pushState || -1 != window.location.search.indexOf('language=') ) {
218
+ return;
219
+ }
220
+ if ( WPGlobusAdmin.data.default_language != WPGlobusAdmin.currentTab ) {
221
+ var newurl = window.location.protocol + "//" + window.location.host + window.location.pathname + window.location.search + '&language='+WPGlobusAdmin.currentTab;
222
+ window.history.pushState({path:newurl},'',newurl);
223
+ }
224
+ },
225
+ taxonomyEdit: function() {
226
+
227
+ $('.wpglobus-taxonomy-tabs').insertAfter('#ajax-response');
228
+
229
+ /**
230
+ * Make class wrap as tabs container.
231
+ * Tabs on.
232
+ */
233
+ $('.wrap').tabs();
234
+
235
+ $(WPGlobusAdmin.data.multilingualSlug.title).insertAfter('.term-slug-wrap th label');
236
+
237
+ if ( WPGlobusAdmin.currentTab !== WPGlobusAdmin.data.default_language ) {
238
+ $('.wpglobus-tax-edit-tab').removeClass('ui-tabs-active ui-state-active');
239
+ $('#wpglobus-link-tab-'+WPGlobusAdmin.currentTab).addClass('ui-tabs-active ui-state-active');
240
+ }
241
+
242
+ $(document).on('click', '.wpglobus-tax-edit-tab a', function(event) {
243
+ event.preventDefault();
244
+ var _href = $(this).data('href');
245
+ location.href = _href;
246
+ });
247
+
248
+ api.setMultilingualFields();
249
+
250
+ /**
251
+ * Init Yoast tinymce editor for description.
252
+ */
253
+ $(document).on( 'tinymce-editor-init', function( event, editor ) {
254
+ $( '#' + editor.getContainer().id ).find('iframe').addClass(WPGlobusAdmin.builder.translatableClass).css({'width':''});
255
+ });
256
+ },
257
+ start: function() {
258
+ /**
259
+ *
260
+ */
261
+ api.setLocationSearch();
262
+
263
+ /**
264
+ *
265
+ */
266
+ var wrap_at = '#postdivrich',
267
+ set_title = true,
268
+ content_tabs_id = '#post-body-content';
269
+ if ( WPGlobusAdmin.data.support['editor'] === false ) {
270
+ wrap_at = '#titlediv';
271
+ set_title = false;
272
+ }
273
+ if ( WPGlobusAdmin.data.support['title'] === false ) {
274
+ set_title = false;
275
+ }
276
+
277
+ /**
278
+ * Make post-body-content as tabs container.
279
+ */
280
+ $(content_tabs_id).prepend($('.wpglobus-post-body-tabs-list'));
281
+ $.each(WPGlobusAdmin.tabs, function (index, suffix) {
282
+ if ('default' === suffix) {
283
+ $(wrap_at).wrap('<div id="tab-default"></div>');
284
+ if ( set_title ) {
285
+ $($('#titlediv')).insertBefore(wrap_at);
286
+ }
287
+ } else {
288
+ $(wrap_at+'-' + suffix).wrap('<div id="tab-' + suffix + '"></div>');
289
+ if ( set_title ) {
290
+ $($('#titlediv-' + suffix)).insertBefore(wrap_at+'-' + suffix);
291
+ }
292
+ }
293
+ });
294
+
295
+ $(content_tabs_id).addClass('wpglobus-post-body-tabs');
296
+
297
+ /**
298
+ * Set fields as multilingual.
299
+ */
300
+ //setTimeout(api.setMultilingualFields(), 1000);
301
+ api.setMultilingualFields();
302
+
303
+ /**
304
+ *
305
+ */
306
+ //api.ajaxPrefilter();
307
+
308
+ },
309
+ ajaxPrefilter: function() {
310
+ /**
311
+ * @todo WIP.
312
+ */
313
+ $.ajaxPrefilter(function( options, originalOptions, jqXHR ) {
314
+ // Modify options, control originalOptions, store jqXHR, etc
315
+ //console.log(options);
316
+ });
317
+ },
318
+ setMultilingualFields: function() {
319
+ $.each(WPGlobusAdmin.builder.multilingualFields, function(indx, field) {
320
+ var elementBy = 'name';
321
+ var node = document.getElementsByName(field);
322
+ var $element;
323
+
324
+ if ( 0 == node.length ) {
325
+ elementBy = 'id';
326
+ node = document.getElementById(field);
327
+ }
328
+
329
+ if ( null === node ) {
330
+ return;
331
+ } else {
332
+ if ( 'id' == elementBy ) {
333
+ $element = $('#'+field);
334
+ } else {
335
+ var nodeName = node[0].nodeName;
336
+ nodeName = nodeName.toLowerCase();
337
+ $element = $(nodeName+'[name="'+field+'"]');
338
+ }
339
+ $element.addClass(WPGlobusAdmin.builder.translatableClass);
340
+ }
341
+
342
+ });
343
+ }
344
+ }
345
+
346
+ WPGlobusAdmin = $.extend({}, WPGlobusAdmin, api);
347
+ WPGlobusAdmin.init();
348
+ });
trunk/includes/builders/assets/wpglobus-admin-builder-51.min.js ADDED
@@ -0,0 +1 @@
 
1
+ var WPGlobusCore;!function(l){var s;s=WPGlobusCore={strpos:function(a,t,e){var o=(a=""+a).indexOf(t,e);return 0<=o&&o},TextFilter:function(a,t,e){if(void 0===a||""===a)return a;var o,n,l=[],i=!1;t=""==t?"en":t,e=void 0===e||""==e?"RETURN_IN_DEFAULT_LANGUAGE":e,l[0]=[],l[0].start=WPGlobusCoreData.locale_tag_start.replace("%s",t),l[0].end=WPGlobusCoreData.locale_tag_end,l[1]=[],l[1].start="\x3c!--:"+t+"--\x3e",l[1].end="\x3c!--:--\x3e",l[2]=[],l[2].start="[:"+t+"]",l[2].end="[:";for(var u=0;u<3;u++)if(!1!==(o=s.strpos(a,l[u].start))){o+=l[u].start.length,a=!1===(n=s.strpos(a,l[u].end,o))?a.substr(o):a.substr(o,n-o),i=!0;break}return i||("RETURN_EMPTY"==e?(t!=WPGlobusCoreData.default_language||/(\{:|\[:|<!--:)[a-z]{2}/.test(a))&&(a=""):t==WPGlobusCoreData.default_language?/(\{:|\[:|<!--:)[a-z]{2}/.test(a)&&(a=""):a=s.TextFilter(a,WPGlobusCoreData.default_language)),a},addLocaleMarks:function(a,t){return WPGlobusCoreData.locale_tag_start.replace("%s",t)+a+WPGlobusCoreData.locale_tag_end},getTranslations:function(e){var o,n={};return l.each(WPGlobusCoreData.enabled_languages,function(a,t){o=t==WPGlobusCoreData.default_language?"RETURN_IN_DEFAULT_LANGUAGE":"RETURN_EMPTY",n[t]=s.TextFilter(e,t,o)}),n},getString:function(a,t,e){if(void 0===a)return a;void 0===t&&(t=""),void 0===e&&(e=WPGlobusCoreData.language),(a=s.getTranslations(a))[e]=t;var o="";return l.each(a,function(a,t){""!=t&&a!=WPGlobusCoreData.default_language&&(o+=s.addLocaleMarks(t,a))}),""!=a[WPGlobusCoreData.default_language]&&(o=""==o?a[WPGlobusCoreData.default_language]:s.addLocaleMarks(a[WPGlobusCoreData.default_language],WPGlobusCoreData.default_language)+o),o}}}(jQuery),jQuery(document).ready(function(i){"use strict";if("undefined"!=typeof WPGlobusAdmin){var t={languageSelectorBoxDelta:0,locationPathname:"/wp-admin/post.php",init:function(){"taxonomy-edit"===WPGlobusAdmin.page?t.taxonomyEdit():t.start()},_info:function(){var a=void 0;0<i("#language").length&&(a=i("#language").val()),console.log("Current language from hidden (#language) : ",a),a=void 0,0<i("#wpglobus-language").length&&(a=i("#wpglobus-language").val()),console.log("Current language from hidden (#wpglobus-language) : ",a),a=void 0,0<i('input[name="wpglobus-language"]').length&&(a=i('input[name="wpglobus-language"]').val()),console.log('Current language from hidden (input[name="wpglobus-language"]) : ',a),a=void 0,0<i('input[name="wpglobus_language"]').length&&(a=i('input[name="wpglobus_language"]').val()),console.log('Current language from hidden (input[name="wpglobus_language"]) : ',a),console.log("Builder : ",WPGlobusAdmin.builder);var t=i("#content").val();""==t?console.log("Editor content (#content) : (empty)"):console.log(t)},checkCookie:function(){if(-1!=window.location.search.indexOf("language="))return!1;if("post.php"==WPGlobusAdmin.page){var a=wpCookies.get(WPGlobusAdmin.builder.languageCookie);if(null!==a&&history.pushState){var t=(a=a.split("+"))[0];if(void 0!==a[1]&&a[1]+0==WPGlobusAdmin.$_get.post){var e=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search+"&language="+t;return window.history.pushState({path:e},"",e),t}}}return!1},setCookie:function(){var a=t.checkCookie();a||void 0===(a=WPGlobusAdmin.$_get.language)&&(a=WPGlobusAdmin.data.default_language),wpCookies.set(WPGlobusAdmin.builder.languageCookie,a+"+"+WPGlobusAdmin.$_get.post,31536e3,t.locationPathname)},setLocationSearch:function(){if(history.pushState&&-1==window.location.search.indexOf("language=")&&WPGlobusAdmin.data.default_language!=WPGlobusAdmin.currentTab){var a=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search+"&language="+WPGlobusAdmin.currentTab;window.history.pushState({path:a},"",a)}},taxonomyEdit:function(){i(".wpglobus-taxonomy-tabs").insertAfter("#ajax-response"),i(".wrap").tabs(),i(WPGlobusAdmin.data.multilingualSlug.title).insertAfter(".term-slug-wrap th label"),WPGlobusAdmin.currentTab!==WPGlobusAdmin.data.default_language&&(i(".wpglobus-tax-edit-tab").removeClass("ui-tabs-active ui-state-active"),i("#wpglobus-link-tab-"+WPGlobusAdmin.currentTab).addClass("ui-tabs-active ui-state-active")),i(document).on("click",".wpglobus-tax-edit-tab a",function(a){a.preventDefault();var t=i(this).data("href");location.href=t}),t.setMultilingualFields(),i(document).on("tinymce-editor-init",function(a,t){i("#"+t.getContainer().id).find("iframe").addClass(WPGlobusAdmin.builder.translatableClass).css({width:""})})},start:function(){t.setLocationSearch();var e="#postdivrich",o=!0,a="#post-body-content";!1===WPGlobusAdmin.data.support.editor&&(o=!(e="#titlediv")),!1===WPGlobusAdmin.data.support.title&&(o=!1),i(a).prepend(i(".wpglobus-post-body-tabs-list")),i.each(WPGlobusAdmin.tabs,function(a,t){"default"===t?(i(e).wrap('<div id="tab-default"></div>'),o&&i(i("#titlediv")).insertBefore(e)):(i(e+"-"+t).wrap('<div id="tab-'+t+'"></div>'),o&&i(i("#titlediv-"+t)).insertBefore(e+"-"+t))}),i(a).addClass("wpglobus-post-body-tabs"),t.setMultilingualFields()},ajaxPrefilter:function(){i.ajaxPrefilter(function(a,t,e){})},setMultilingualFields:function(){i.each(WPGlobusAdmin.builder.multilingualFields,function(a,t){var e,o="name",n=document.getElementsByName(t);if(0==n.length&&(o="id",n=document.getElementById(t)),null!==n){if("id"==o)e=i("#"+t);else{var l=n[0].nodeName;l=l.toLowerCase(),e=i(l+'[name="'+t+'"]')}e.addClass(WPGlobusAdmin.builder.translatableClass)}})}};WPGlobusAdmin=i.extend({},WPGlobusAdmin,t),WPGlobusAdmin.init()}});
trunk/includes/builders/class-wpglobus-builder-update-post.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * File: class-wpglobus-builder-update-post.php
4
+ *
5
+ * @since 2.2.35
6
+ *
7
+ * @package WPGlobus\Builders
8
+ * @author Alex Gor(alexgff)
9
+ */
10
+
11
+ /**
12
+ * Class WPGlobus_Builder_Update_Post.
13
+ */
14
+ if ( ! class_exists( 'WPGlobus_Builder_Update_Post' ) ) :
15
+
16
+ class WPGlobus_Builder_Update_Post {
17
+
18
+ /**
19
+ * Builder ID.
20
+ */
21
+ protected $id = null;
22
+
23
+ /**
24
+ * Constructor.
25
+ */
26
+ public function __construct( $id ) {
27
+
28
+ $this->id = $id;
29
+
30
+ /**
31
+ * Do not start for `gutenberg`.
32
+ * The block editor prohibits saving post with an empty post title from post edit page.
33
+ */
34
+ if ( 'gutenberg' == $this->id ) {
35
+ return;
36
+ }
37
+
38
+ add_filter( 'wp_insert_post_empty_content', array( $this, 'filter__post_empty_content' ), 10, 2);
39
+ }
40
+
41
+ /**
42
+ * Filters whether the post should be considered "empty".
43
+ *
44
+ * @see wp-includes\post.php
45
+ *
46
+ * @param bool $maybe_empty Whether the post should be considered "empty".
47
+ * @param array $postarr Array of post data.
48
+ */
49
+ public function filter__post_empty_content( $maybe_empty, $postarr ) {
50
+
51
+ if ( WPGlobus::Config()->builder->is_default_language() ) {
52
+ return $maybe_empty;
53
+ }
54
+
55
+ /**
56
+ * Don't return a truthy value for extra language.
57
+ */
58
+ return false;
59
+ }
60
+ }
61
+
62
+ endif;
trunk/includes/builders/class-wpglobus-builder.php ADDED
@@ -0,0 +1,424 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * File: class-wpglobus-builder.php
4
+ *
5
+ * @package WPGlobus\Builders
6
+ * @author Alex Gor(alexgff)
7
+ */
8
+
9
+ /**
10
+ * Class WPGlobus_Builder.
11
+ *
12
+ * @since 1.9.17
13
+ */
14
+ if ( ! class_exists( 'WPGlobus_Builder' ) ) :
15
+
16
+ class WPGlobus_Builder {
17
+
18
+ /**
19
+ * Current language of post.
20
+ */
21
+ protected $language = null;
22
+
23
+ /**
24
+ * Builder ID.
25
+ */
26
+ protected $id = null;
27
+
28
+ /**
29
+ * Array of activated builders.
30
+ *
31
+ * @since 1.9.17
32
+ * @access protected
33
+ * @var array
34
+ */
35
+ // phpcs:ignore
36
+ //protected $builders = array(); TODO remove
37
+
38
+ /**
39
+ * @var array
40
+ * @todo Unused?
41
+ */
42
+ protected $builder_post = null;
43
+
44
+ /**
45
+ * Constructor method.
46
+ *
47
+ * @since 1.9.17
48
+ *
49
+ * @param string $id The Builder ID, such as 'gutenberg'.
50
+ */
51
+ public function __construct( $id ) {
52
+
53
+ $this->id = $id;
54
+
55
+ $this->set_current_language();
56
+
57
+ // phpcs:ignore
58
+ // if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
59
+ /**
60
+ * @todo Add the handling of AJAX.
61
+ */
62
+ // }
63
+
64
+ if ( is_admin() ) {
65
+
66
+ add_action( 'redirect_post_location', array( $this, 'on__redirect' ), 5, 2 );
67
+
68
+ add_filter( 'admin_body_class', array( $this, 'filter__add_admin_body_class' ) );
69
+
70
+ /**
71
+ * Add builder/add-on label to admin bar.
72
+ *
73
+ * @since 1.9.27
74
+ */
75
+ add_action( 'admin_bar_menu', array( $this, 'on__admin_bar_menu' ), 11 );
76
+
77
+ /**
78
+ * @see "{$field_no_prefix}_edit_pre" in wp-includes\post.php
79
+ */
80
+ add_filter( 'content_edit_pre', array( $this, 'filter__content' ), 5, 2 );
81
+ add_filter( 'title_edit_pre', array( $this, 'filter__title' ), 5, 2 );
82
+ add_filter( 'excerpt_edit_pre', array( $this, 'filter__excerpt' ), 5, 2 );
83
+
84
+ }
85
+
86
+ /**
87
+ * Show language tabs in post.php page.
88
+ *
89
+ * @see_file wpglobus\includes\class-wpglobus.php
90
+ */
91
+ add_filter( 'wpglobus_show_language_tabs', array( $this, 'filter__show_language_tabs' ), 5 );
92
+
93
+ }
94
+
95
+ /**
96
+ * Filter title.
97
+ *
98
+ * @param string $value The title.
99
+ * @param int $post_id Unused.
100
+ *
101
+ * @return string
102
+ */
103
+ public function filter__title(
104
+ $value, /** @noinspection PhpUnusedParameterInspection */
105
+ $post_id
106
+ ) {
107
+ $value = WPGlobus_Core::text_filter( $value, $this->get_current_language(), WPGlobus::RETURN_EMPTY );
108
+
109
+ return $value;
110
+ }
111
+
112
+ /**
113
+ * Filter content.
114
+ *
115
+ * @param string $content The content.
116
+ * @param int $post_id Post ID - Unused.
117
+ *
118
+ * @return string
119
+ */
120
+ public function filter__content(
121
+ $content, /** @noinspection PhpUnusedParameterInspection */
122
+ $post_id
123
+ ) {
124
+ $content = WPGlobus_Core::text_filter( $content, $this->get_current_language(), WPGlobus::RETURN_EMPTY );
125
+
126
+ return $content;
127
+ }
128
+
129
+ /**
130
+ * Filter excerpt.
131
+ *
132
+ * @param string $excerpt The excerpt.
133
+ * @param int $post_id Post ID - Unused.
134
+ *
135
+ * @return string
136
+ */
137
+ public function filter__excerpt(
138
+ $excerpt, /** @noinspection PhpUnusedParameterInspection */
139
+ $post_id
140
+ ) {
141
+ $excerpt = WPGlobus_Core::text_filter( $excerpt, $this->get_current_language(), WPGlobus::RETURN_EMPTY );
142
+
143
+ return $excerpt;
144
+ }
145
+
146
+ /**
147
+ * Redirect.
148
+ *
149
+ * @param string $location
150
+ * @param int $post_id Post ID - Unused.
151
+ *
152
+ * @return string
153
+ */
154
+ public function on__redirect(
155
+ $location, /** @noinspection PhpUnusedParameterInspection */
156
+ $post_id
157
+ ) {
158
+ /**
159
+ * Tested with:
160
+ * - Page Builder by SiteOrigin OK.
161
+ */
162
+ return $location . '&language=' . $this->language;
163
+ }
164
+
165
+ /**
166
+ * Getter.
167
+ *
168
+ * @return null|string
169
+ */
170
+ public function get_id() {
171
+ return $this->id;
172
+ }
173
+
174
+ /**
175
+ * Is this a "builder" post?
176
+ *
177
+ * @return bool
178
+ * @todo Unused?
179
+ */
180
+ public function is_builder_post() {
181
+ if ( is_null( $this->builder_post ) ) {
182
+ return false;
183
+ }
184
+
185
+ return true;
186
+ }
187
+
188
+ /**
189
+ * Get hidden "wpglobus-language" field.
190
+ *
191
+ * @since 1.9.17
192
+ * @return string
193
+ */
194
+ public function get_language_field() {
195
+ /**
196
+ * @see on_add_devmode_switcher() in wpglobus\includes\class-wpglobus.php
197
+ * @todo may be add special function to get hidden language field.
198
+ */
199
+ return '<input type="hidden" id="' . esc_attr( WPGlobus::get_language_meta_key() ) . '" name="' . esc_attr( WPGlobus::get_language_meta_key() ) . '" value="' . esc_attr( $this->get_current_language() ) . '" />';
200
+ }
201
+
202
+ /**
203
+ * Return current language.
204
+ *
205
+ * @since 1.9.17
206
+ * @return string
207
+ */
208
+ public function get_current_language() {
209
+ return $this->language;
210
+ }
211
+
212
+ /**
213
+ * Set current language.
214
+ *
215
+ * @since 1.9.17
216
+ * @return void
217
+ */
218
+ public function set_current_language() {
219
+
220
+ if ( ! is_null( $this->language ) ) {
221
+ return;
222
+ }
223
+
224
+ /**
225
+ * Don't duplicate the defining of current language.
226
+ * Let's just get it from WPGlobus::Config()->builder.
227
+ */
228
+ $language = WPGlobus::Config()->builder->get_language();
229
+
230
+ if ( $language ) {
231
+ // Language was set in WPGlobus_Config_Builder class.
232
+ $this->language = $language;
233
+ }
234
+
235
+ $post_id = 0;
236
+ if ( ! empty( $_REQUEST['post'] ) ) { // phpcs:ignore WordPress.CSRF.NonceVerification
237
+ $post_id = (int) $_REQUEST['post'];
238
+ } elseif ( ! empty( $_REQUEST['id'] ) ) { // phpcs:ignore WordPress.CSRF.NonceVerification
239
+ $post_id = (int) $_REQUEST['id'];
240
+ } elseif ( ! empty( $_REQUEST['post_ID'] ) ) { // phpcs:ignore WordPress.CSRF.NonceVerification
241
+ $post_id = (int) $_REQUEST['post_ID'];
242
+ }
243
+
244
+ if ( $post_id && ! is_null( $this->language ) ) {
245
+ update_post_meta( $post_id, WPGlobus::Config()->builder->get_language_meta_key(), $this->language );
246
+ }
247
+
248
+ }
249
+
250
+ /**
251
+ * Show language tabs on post.php page.
252
+ *
253
+ * @see_file includes\class-wpglobus.php
254
+ *
255
+ * @param bool $value
256
+ *
257
+ * @return bool
258
+ */
259
+ public function filter__show_language_tabs(
260
+ /** @noinspection PhpUnusedParameterInspection */
261
+ $value
262
+ ) {
263
+
264
+ global $pagenow;
265
+
266
+ $classes = array();
267
+ $classes['wpglobus-post-tab'] = 'wpglobus-post-tab';
268
+ $classes['ui-state-default'] = 'ui-state-default';
269
+ $classes['ui-corner-top'] = 'ui-corner-top';
270
+ $classes['ui-tabs-active'] = 'ui-tabs-active';
271
+ $classes['ui-tabs-loading'] = 'ui-tabs-loading';
272
+
273
+ $link_class = array();
274
+ $link_style = array();
275
+ $link_title = '';
276
+ if ( 'post-new.php' === $pagenow ) {
277
+ $link_style['cursor'] = 'cursor:not-allowed';
278
+ $link_title = esc_html__( 'Save draft before using extra language.', 'wpglobus' );
279
+ }
280
+
281
+ ?>
282
+ <ul class="wpglobus-post-body-tabs-list">
283
+ <?php
284
+ $order = 0;
285
+
286
+ $get_array = $_GET; // phpcs:ignore WordPress.CSRF.NonceVerification
287
+ /**
288
+ * Unset unneeded elements.
289
+ */
290
+ unset( $get_array['language'] );
291
+ unset( $get_array['message'] );
292
+
293
+ foreach ( WPGlobus::Config()->open_languages as $language ) {
294
+
295
+ $tab_suffix = WPGlobus::Config()->default_language === $language ? 'default' : $language;
296
+
297
+ $_classes = $classes;
298
+
299
+ $_link_class = $link_class;
300
+ $_link_style = $link_style;
301
+
302
+ if ( 'post-new.php' === $pagenow && WPGLobus::Config()->default_language === $language ) {
303
+ $_link_style['cursor'] = '';
304
+ }
305
+
306
+ $_link_class['tab-link-active'] = WPGlobus::Config()->builder->get_language() === $language ? 'wpglobus-tab-link-active' : '';
307
+
308
+ if ( $language === $this->language ) {
309
+ $_classes[] = 'ui-state-active';
310
+ }
311
+
312
+ $link = add_query_arg( array_merge( $get_array, array( 'language' => $language ) ), admin_url( $pagenow ) );
313
+ $_link_title = '';
314
+ if ( 'post-new.php' === $pagenow && WPGLobus::Config()->default_language !== $language ) {
315
+ $link = '#';
316
+ $_link_title = $link_title;
317
+ }
318
+ ?>
319
+ <li id="link-tab-<?php echo esc_attr( $tab_suffix ); ?>"
320
+ data-language="<?php echo esc_attr( $language ); ?>"
321
+ data-order="<?php echo esc_attr( $order ); ?>"
322
+ class="<?php echo esc_attr( implode( ' ', $_classes ) ); ?>">
323
+ <!--<a href="#tab-<?php echo esc_attr( $tab_suffix ); ?>"><?php echo esc_html( WPGlobus::Config()->en_language_name[ $language ] ); ?></a>-->
324
+ <a style="<?php echo esc_attr( implode( ';', $_link_style ) ); ?>"
325
+ title="<?php echo esc_attr( $_link_title ); ?>"
326
+ class="<?php echo esc_attr( implode( ' ', $_link_class ) ); ?>"
327
+ href="<?php echo esc_url( $link ); ?>"><?php echo esc_html( WPGlobus::Config()->en_language_name[ $language ] ); ?></a>
328
+ </li>
329
+ <?php
330
+ $order++;
331
+ }
332
+ ?>
333
+ </ul>
334
+ <?php
335
+ /**
336
+ * Return false to prevent output standard WPGlobus tabs.
337
+ */
338
+ return false;
339
+ }
340
+
341
+ /**
342
+ * Add class to body in admin.
343
+ *
344
+ * @see admin_body_class filter
345
+ *
346
+ * @since 1.9.17
347
+ *
348
+ * @param string $classes
349
+ *
350
+ * @return string
351
+ */
352
+ public function filter__add_admin_body_class( $classes ) {
353
+ return $classes . ' wpglobus-wp-admin-builder wpglobus-wp-admin-builder-' . $this->id;
354
+ }
355
+
356
+ /**
357
+ * Add builder label to admin bar.
358
+ *
359
+ * @since 1.9.27
360
+ *
361
+ * @param WP_Admin_Bar $wp_admin_bar
362
+ */
363
+ public function on__admin_bar_menu( WP_Admin_Bar $wp_admin_bar ) {
364
+
365
+ global $pagenow;
366
+
367
+ if ( ! in_array( $pagenow, array( 'post.php', 'post-new.php', 'term.php' ), true ) ) {
368
+ return;
369
+ }
370
+
371
+ $_builder_label = esc_html__( 'Builder', 'wpglobus' ) . ': ';
372
+ if ( class_exists( 'WPGlobus_Builders' ) ) {
373
+ $_builder = WPGlobus_Builders::get_addon( $this->id );
374
+
375
+ if ( ! empty( $_builder['admin_bar_label'] ) ) {
376
+ $_builder_label = $_builder['admin_bar_label'] . ': ';
377
+ }
378
+ if ( empty( $_builder['admin_bar_builder_label'] ) ) {
379
+ $_builder_label .= $_builder['plugin_name'];
380
+ } else {
381
+ $_builder_label .= $_builder['admin_bar_builder_label'];
382
+ }
383
+ } else {
384
+ $_builder_label .= $this->id;
385
+ }
386
+
387
+ $wp_admin_bar->add_menu(
388
+ array(
389
+ 'id' => 'wpglobus-builder-id',
390
+ 'parent' => 'top-secondary',
391
+ 'title' => '<span class="ab-label">' . $_builder_label . '</span>',
392
+ )
393
+ );
394
+
395
+ $_title = esc_html__( 'Сompatibility Settings', 'wpglobus' );
396
+
397
+ $_url = admin_url(
398
+ add_query_arg(
399
+ array(
400
+ 'page' => 'wpglobus_options',
401
+ 'tab' => 'compatibility',
402
+ ),
403
+ 'admin.php'
404
+ )
405
+ );
406
+
407
+ $wp_admin_bar->add_menu(
408
+ array(
409
+ 'parent' => 'wpglobus-builder-id',
410
+ 'id' => 'wpglobus-builder-compatibility-link',
411
+ 'title' => '<span>' . $_title . '</span>',
412
+ 'href' => $_url,
413
+ 'meta' => array(
414
+ '_target' => 'blank',
415
+ 'tabindex' => -1,
416
+ ),
417
+ )
418
+ );
419
+
420
+ }
421
+
422
+ }
423
+
424
+ endif;
trunk/includes/builders/class-wpglobus-builders.php ADDED
@@ -0,0 +1,1487 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * File: class-wpglobus-builders.php
4
+ *
5
+ * @package WPGlobus\Builders
6
+ * @author Alex Gor(alexgff)
7
+ */
8
+
9
+ /**
10
+ * Class WPGlobus_Builders.
11
+ */
12
+ if ( ! class_exists( 'WPGlobus_Builders' ) ) :
13
+
14
+ class WPGlobus_Builders {
15
+
16
+ /**
17
+ * @var array
18
+ */
19
+ protected static $attrs = array();
20
+
21
+ /**
22
+ * @var array
23
+ */
24
+ protected static $admin_attrs = array();
25
+
26
+ /**
27
+ * @var array
28
+ */
29
+ protected static $add_on = array();
30
+
31
+ /**
32
+ * @var string
33
+ * @since 2.2.11
34
+ */
35
+ protected static $post_type = null;
36
+
37
+ /**
38
+ * @var array
39
+ * @since 2.2.24
40
+ */
41
+ protected static $init_attrs = null;
42
+
43
+ /**
44
+ * @return array
45
+ */
46
+ public static function get_addons() {
47
+
48
+ if ( ! empty( self::$add_on ) ) {
49
+ return self::$add_on;
50
+ }
51
+
52
+ global $wp_version;
53
+
54
+ self::$add_on['gutenberg'] = array(
55
+ 'id' => 'gutenberg',
56
+ 'role' => 'builder',
57
+ 'admin_bar_label' => version_compare( $wp_version, '4.9.99', '>' ) ? 'Core' : 'Builder',
58
+ 'supported_min_version' => '4.0.0',
59
+ 'const' => 'GUTENBERG_VERSION',
60
+ 'plugin_name' => 'Gutenberg',
61
+ 'admin_bar_builder_label' => '',
62
+ 'plugin_uri' => 'https://github.com/WordPress/gutenberg',
63
+ 'path' => 'gutenberg/gutenberg.php',
64
+ 'stage' => 'production',
65
+ );
66
+
67
+ self::$add_on['js_composer'] = array(
68
+ 'id' => 'js_composer',
69
+ 'role' => 'builder',
70
+ 'supported_min_version' => '5.4.0',
71
+ 'const' => 'WPB_VC_VERSION',
72
+ 'plugin_name' => 'WPBakery Page Builder',
73
+ 'admin_bar_builder_label' => 'WPBakery PB',
74
+ 'plugin_uri' => 'https://wpbakery.com/',
75
+ 'path' => 'js_composer/js_composer.php',
76
+ 'stage' => 'production',
77
+ );
78
+
79
+ self::$add_on['elementor'] = array(
80
+ 'id' => 'elementor',
81
+ 'role' => 'builder',
82
+ 'supported_min_version' => '2.5.14',
83
+ 'const' => 'ELEMENTOR_VERSION',
84
+ 'plugin_name' => 'Elementor',
85
+ 'plugin_uri' => 'https://wordpress.org/plugins/elementor/',
86
+ 'path' => 'elementor/elementor.php',
87
+ 'stage' => 'beta',
88
+ 'beta_version' => '3',
89
+ );
90
+
91
+ if ( file_exists( WP_PLUGIN_DIR . '/wordpress-seo-premium/wp-seo-premium.php' ) ) {
92
+
93
+ self::$add_on['yoast_seo'] = array(
94
+ 'id' => 'yoast_seo',
95
+ 'role' => 'builder',
96
+ 'admin_bar_label' => 'Add-on',
97
+ 'supported_min_version' => '7.7',
98
+ 'const' => 'WPSEO_VERSION',
99
+ 'plugin_name' => 'Yoast SEO Premium',
100
+ 'plugin_uri' => 'https://yoast.com/wordpress/plugins/seo/',
101
+ 'path' => 'wordpress-seo-premium/wp-seo-premium.php',
102
+ 'stage' => 'production',
103
+ );
104
+
105
+ }
106
+
107
+ /**
108
+ * @since 2.3.11
109
+ */
110
+ $_file = 'wordpress-seo/wp-seo.php';
111
+ $_plugin_name = 'Yoast SEO';
112
+ if ( defined( 'WPGLOBUS_YOAST_PLUGIN_FILE' ) ) {
113
+ $_file = WPGLOBUS_YOAST_PLUGIN_FILE;
114
+ $_plugin_name = 'Yoast SEO('.$_file.')';
115
+ }
116
+
117
+ if ( file_exists( WP_PLUGIN_DIR . '/' . $_file ) ) {
118
+
119
+ if ( ! defined( 'WPSEO_PREMIUM_PLUGIN_FILE' ) ) {
120
+
121
+ self::$add_on['yoast_seo'] = array(
122
+ 'id' => 'yoast_seo',
123
+ 'role' => 'builder',
124
+ 'admin_bar_label' => 'Add-on',
125
+ 'supported_min_version' => '7.7',
126
+ 'const' => 'WPSEO_VERSION',
127
+ 'plugin_name' => $_plugin_name,
128
+ 'plugin_uri' => 'https://wordpress.org/plugins/wordpress-seo/',
129
+ 'path' => $_file,
130
+ 'stage' => 'production',
131
+ );
132
+
133
+ }
134
+ }
135
+
136
+ self::$add_on['woocommerce'] = array(
137
+ 'id' => 'woocommerce',
138
+ 'role' => 'add-on',
139
+ 'config_file' => 'woocommerce.json',
140
+ 'supported_min_version' => '3.5.1',
141
+ 'const' => 'WC_PLUGIN_FILE',
142
+ 'plugin_name' => 'WooCommerce',
143
+ 'plugin_uri' => 'https://woocommerce.com',
144
+ 'path' => 'woocommerce/woocommerce.php',
145
+ 'stage' => 'production',
146
+ );
147
+
148
+ /**
149
+ * @since 2.3.0
150
+ */
151
+ self::$add_on['pods'] = array(
152
+ 'id' => 'pods',
153
+ 'role' => 'builder',
154
+ 'admin_bar_label' => 'Add-on',
155
+ 'config_file' => 'pods.json',
156
+ 'supported_min_version' => '2.7.16',
157
+ 'const' => 'PODS_VERSION',
158
+ 'plugin_name' => 'Pods-Custom Content Types and Fields',
159
+ 'plugin_uri' => 'https://wordpress.org/plugins/pods/',
160
+ 'path' => 'pods/init.php',
161
+ 'stage' => 'production',
162
+ 'admin_bar_builder_label' => 'Pods',
163
+ );
164
+
165
+ /**
166
+ * self::$add_on['wp-subtitle'] = array(
167
+ * 'id' => 'wp-subtitle',
168
+ * 'role' => 'add-on',
169
+ * 'config_file' => 'wp-subtitle.json',
170
+ * 'supported_min_version' => '3.1',
171
+ * 'const' => 'WPSUBTITLE_DIR',
172
+ * 'plugin_name' => 'WP Subtitle',
173
+ * 'plugin_uri' => 'http://wordpress.org/plugins/wp-subtitle/',
174
+ * 'path' => 'wp-subtitle/wp-subtitle.php',
175
+ * 'stage' => 'production',
176
+ * );
177
+ * // */
178
+
179
+ /**
180
+ * self::$add_on['__test'] = array(
181
+ * 'id' => '__test',
182
+ * 'supported_min_version' => '1.0',
183
+ * 'const' => '__TEST_VERSION',
184
+ * 'plugin_name' => 'Test Add-on',
185
+ * 'plugin_uri' => '',
186
+ * 'path' => 'test-add-on/test-add-on.php',
187
+ * );
188
+ * // */
189
+
190
+ return self::$add_on;
191
+ }
192
+
193
+ /**
194
+ * @param bool $builder
195
+ *
196
+ * @return false|array
197
+ */
198
+ public static function get_addon( $builder = false ) {
199
+ if ( ! $builder ) {
200
+ return false;
201
+ }
202
+ if ( isset( self::$add_on[ $builder ] ) ) {
203
+ return self::$add_on[ $builder ];
204
+ }
205
+
206
+ return false;
207
+ }
208
+
209
+ /**
210
+ * @param bool $init
211
+ * @param array $init_attrs added @since 2.2.24
212
+ *
213
+ * @return array|bool
214
+ */
215
+ public static function get( $init = true, $init_attrs = array() ) {
216
+
217
+ // if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
218
+ //return false;
219
+ // }
220
+
221
+ /**
222
+ * @since 2.2.26
223
+ */
224
+ if ( empty($init_attrs) ) {
225
+ return false;
226
+ }
227
+
228
+ /**
229
+ * @since 2.2.24
230
+ */
231
+ self::$init_attrs = $init_attrs;
232
+
233
+ /**
234
+ * @since 2.2.24
235
+ */
236
+ $post_types = $init_attrs['post_types'];
237
+
238
+ /** @global string $pagenow */
239
+ global $pagenow;
240
+
241
+ self::$attrs = array(
242
+ 'id' => false,
243
+ 'context' => 'add-on',
244
+ 'version' => '',
245
+ 'class' => '',
246
+ 'post_type' => '',
247
+ 'post_id' => '',
248
+ 'is_admin' => true,
249
+ 'pagenow' => $pagenow,
250
+ 'builder_page' => false,
251
+ 'doing_ajax' => WPGlobus_WP::is_doing_ajax(),
252
+ 'language' => '',
253
+ 'message' => '',
254
+ 'ajax_actions' => '',
255
+ );
256
+
257
+ self::$admin_attrs = array(
258
+ 'multilingualFields' => array( 'post_title', 'excerpt' ),
259
+ 'translatableClass' => 'wpglobus-translatable',
260
+ );
261
+
262
+ /**
263
+ * @since 2.2.11
264
+ */
265
+ if ( in_array( $pagenow, array('post.php', 'post-new.php', 'media-new.php') ) ) {
266
+
267
+ /**
268
+ * @W.I.P @since 2.2.14
269
+ * if ( in_array( $pagenow, array('post.php', 'post-new.php', 'media-new.php', 'admin-ajax.php') ) ) {
270
+ */
271
+ $post_type = self::get_post_type_2();
272
+
273
+ /**
274
+ * Filter for post types.
275
+ *
276
+ * @since 2.2.11
277
+ *
278
+ * @param array $post_types Array of post types.
279
+ * @param string $post_type Current post type.
280
+ *
281
+ * @return array
282
+ */
283
+ $post_types = apply_filters( 'wpglobus_builders_post_types', $post_types, $post_type );
284
+
285
+ if ( ! array_key_exists( $post_type, $post_types ) ) {
286
+ return self::$attrs;
287
+ } else if ( ! $post_types[$post_type] ) {
288
+ return self::$attrs;
289
+ }
290
+ }
291
+
292
+ if ( $init ) {
293
+
294
+ //$builder = false;
295
+
296
+ self::get_addons();
297
+
298
+ /**
299
+ * @since 1.9.17
300
+ */
301
+ $builder = self::is_gutenberg();
302
+ if ( $builder && $builder['builder_page'] ) {
303
+ return $builder;
304
+ }
305
+
306
+ /**
307
+ * JS Composer.
308
+ *
309
+ * @since 1.9.17
310
+ * @since 2.2.3 Start js_composer as a builder.
311
+ */
312
+ if ( ! $builder || ! $builder['builder_page'] ) {
313
+ $builder = self::is_js_composer();
314
+ if ( $builder && $builder['builder_page'] ) {
315
+ return $builder;
316
+ }
317
+ }
318
+
319
+ /**
320
+ * @since 1.9.17
321
+ */
322
+ if ( ! $builder || ! $builder['builder_page'] ) {
323
+ $builder = self::is_elementor();
324
+ if ( $builder ) {
325
+ if ( $builder['is_admin'] ) {
326
+ if ( $builder['builder_page'] ) {
327
+ return $builder;
328
+ }
329
+ } else {
330
+ /** @noinspection PhpIncludeInspection */
331
+ include_once WPGlobus::$PLUGIN_DIR_PATH . 'includes/builders/elementor/class-wpglobus-elementor-front.php';
332
+ WPGlobus_Elementor_Front::init( $builder );
333
+ }
334
+ }
335
+ }
336
+
337
+ /**
338
+ * @since 1.9.17
339
+ * @W.I.P
340
+ */
341
+ /*
342
+ $builder = self::is_siteorigin_panels();
343
+ if ( $builder ) {
344
+ return $builder;
345
+ }
346
+ // */
347
+
348
+ /**
349
+ * @since 1.9.17
350
+ */
351
+ if ( ! $builder || ! $builder['builder_page'] ) {
352
+ $builder = self::is_yoast_seo();
353
+ if ( $builder && $builder['builder_page'] ) {
354
+ return $builder;
355
+ }
356
+ }
357
+
358
+ /**
359
+ * Pods – Custom Content Types and Fields.
360
+ *
361
+ * @since 2.3.0
362
+ */
363
+ if ( ! $builder || ! $builder['builder_page'] ) {
364
+ $builder = self::is_pods();
365
+ if ( $builder && $builder['builder_page'] ) {
366
+ return $builder;
367
+ }
368
+
369
+ }
370
+ }
371
+
372
+ return self::$attrs;
373
+
374
+ }
375
+
376
+ /**
377
+ * Page Builder by SiteOrigin.
378
+ * @W.I.P
379
+ * https://wordpress.org/plugins/siteorigin-panels/
380
+ */
381
+ protected static function is_siteorigin_panels() {}
382
+
383
+ /**
384
+ * Elementor Page Builder.
385
+ * https://wordpress.org/plugins/elementor/
386
+ */
387
+ protected static function is_elementor() {
388
+
389
+ if ( ! defined( 'ELEMENTOR_VERSION' ) ) {
390
+ return false;
391
+ }
392
+
393
+ $__builder = self::get_addon( 'elementor' );
394
+
395
+ if ( ! $__builder ) {
396
+ return false;
397
+ }
398
+
399
+ /** @global string $pagenow */
400
+ global $pagenow;
401
+
402
+ $load_elementor = false;
403
+
404
+ if ( version_compare( ELEMENTOR_VERSION, $__builder['supported_min_version'], '<' ) ) {
405
+
406
+ $message = 'Unsupported Elementor version.';
407
+
408
+ $_attrs = array(
409
+ 'id' => 'elementor',
410
+ 'version' => ELEMENTOR_VERSION,
411
+ 'class' => 'WPGlobus_Elementor',
412
+ 'is_admin' => false,
413
+ 'builder_page' => false,
414
+ 'message' => $message,
415
+ );
416
+
417
+ $attrs = self::get_attrs( $_attrs );
418
+
419
+ return $attrs;
420
+
421
+ } else {
422
+
423
+ if ( in_array( $pagenow, array( 'admin-ajax.php', 'post.php', 'index.php', 'post-new.php' ), true ) ) {
424
+
425
+ /**
426
+ * Init current post type.
427
+ */
428
+ $post_type = is_null(self::$post_type) ? '' : self::$post_type;
429
+
430
+ /**
431
+ * Init post ID.
432
+ */
433
+ $post_id = '';
434
+
435
+ $ajax_actions = '';
436
+ $is_admin = true;
437
+
438
+ if ( 'admin-ajax.php' === $pagenow ) {
439
+
440
+ // phpcs:ignore WordPress.Security.NonceVerification.Recommended
441
+ if ( ! isset( $_REQUEST['action'] ) || 'elementor_ajax' !== $_REQUEST['action'] ) {
442
+ return false;
443
+ }
444
+ // phpcs:ignore WordPress.Security.NonceVerification.Recommended
445
+ if ( false !== strpos( $_REQUEST['actions'], 'save_builder' ) ) {
446
+ $ajax_actions = 'save_builder';
447
+ // phpcs:ignore WordPress.Security.NonceVerification.Recommended
448
+ } elseif ( false !== strpos( $_REQUEST['actions'], '"action":"render_widget"' ) ) {
449
+ $ajax_actions = 'render_widget';
450
+ } else {
451
+ return false;
452
+ }
453
+ $load_elementor = true;
454
+ // phpcs:ignore WordPress.Security.NonceVerification.Recommended
455
+ $post_id = sanitize_text_field( $_REQUEST['editor_post_id'] );
456
+
457
+ } elseif ( 'index.php' === $pagenow ) {
458
+
459
+ /**
460
+ * @todo remove after testing.
461
+ * if ( ! isset( $_GET['elementor-preview'] ) ) {
462
+ * return false;
463
+ * }
464
+ * // */
465
+ // @W.I.P @since 2.2.11
466
+ // [REQUEST_URI] => /?p=75&elementor-preview=75&ver=1561202861
467
+
468
+ $load_elementor = false;
469
+ $is_admin = false;
470
+
471
+ /**
472
+ * @todo Preview page for draft status.
473
+ * [REQUEST_URI] => /?p=75&elementor-preview=75&ver=1561202861
474
+ * @W.I.P
475
+ * @since 2.2.11 [REQUEST_URI] was changed to `?p=75&preview_id=75&preview_nonce=da660129a7&preview=true`.
476
+ */
477
+ /*
478
+ if ( ! empty( $_GET['p'] ) ) {
479
+ $load_elementor = true;
480
+ $is_admin = true;
481
+ $post_id = sanitize_text_field( $_GET['p'] );
482
+ $post_type = self::get_post_type($post_id);
483
+
484
+ }
485
+ // */
486
+
487
+ } elseif ( 'post.php' === $pagenow ) {
488
+
489
+ $is_admin = true;
490
+ // phpcs:ignore WordPress.Security.NonceVerification.Recommended
491
+ if ( isset( $_GET['action'] ) && 'elementor' === $_GET['action'] ) {
492
+ //$is_admin = false;
493
+ $load_elementor = true;
494
+ }
495
+
496
+ /**
497
+ * $cpt_support = get_option( 'elementor_cpt_support', array('page', 'post') );
498
+ *
499
+ * @see_file elementor\includes\plugin.php
500
+ */
501
+ $cpt_support = get_option( 'elementor_cpt_support', array( 'page', 'post' ) );
502
+
503
+ // phpcs:ignore WordPress.Security.NonceVerification.Recommended
504
+ if ( empty( $post_type ) && isset( $_GET['post_type'] ) ) {
505
+ /**
506
+ * For post-new.php page.
507
+ */
508
+ // phpcs:ignore WordPress.Security.NonceVerification.Recommended
509
+ $post_type = sanitize_text_field( $_GET['post_type'] );
510
+ }
511
+
512
+ if ( empty( $post_type ) ) {
513
+ // phpcs:ignore WordPress.CSRF.NonceVerification
514
+ if ( isset( $_GET['post'] ) ) {
515
+ $post_type = self::get_post_type( $_GET['post'] ); // phpcs:ignore WordPress.CSRF.NonceVerification
516
+ } elseif ( isset( $_REQUEST['post_ID'] ) ) { // phpcs:ignore WordPress.CSRF.NonceVerification
517
+ $post_type = self::get_post_type( $_REQUEST['post_ID'] ); // phpcs:ignore WordPress.CSRF.NonceVerification
518
+ }
519
+ }
520
+
521
+ // if ( empty( $post_type ) ) {
522
+ /**
523
+ * Post type by default.
524
+ * If we can not define post type then we don't set it to default value.
525
+ * Because it may cause incorrect behavior later.
526
+ */
527
+ //$post_type = 'post';
528
+ // }
529
+
530
+ if ( in_array( $post_type, $cpt_support, true ) ) {
531
+ $load_elementor = true;
532
+ }
533
+ } else {
534
+ /**
535
+ * @todo may be use @see is_built_with_elementor() in elementor\core\base\document.php
536
+ */
537
+ $load_elementor = true;
538
+ }
539
+
540
+ $_attrs = array(
541
+ 'id' => 'elementor',
542
+ 'version' => ELEMENTOR_VERSION,
543
+ 'is_admin' => $is_admin,
544
+ 'class' => 'WPGlobus_Elementor',
545
+ 'post_type' => $post_type,
546
+ 'post_id' => $post_id,
547
+ 'builder_page' => false,
548
+ 'ajax_actions' => $ajax_actions,
549
+ 'post_css_meta_key' => '_wpglobus_elementor_css',
550
+ 'elementor_data_meta_key' => '_elementor_data',
551
+ 'elementor_css_meta_key' => '_elementor_css',
552
+ 'elementor_css_print_method' => get_option('elementor_css_print_method', 'external'), // @since 2.2.31
553
+ );
554
+
555
+ if ( $load_elementor ) {
556
+ $_attrs['builder_page'] = true;
557
+ } else {
558
+ $_attrs['builder_page'] = false;
559
+ }
560
+
561
+ $attrs = self::get_attrs( $_attrs );
562
+
563
+ return $attrs;
564
+
565
+ }
566
+ }
567
+
568
+ return false;
569
+
570
+ }
571
+
572
+ /**
573
+ * WPBakery Page Builder.
574
+ * https://wpbakery.com/
575
+ */
576
+ protected static function is_js_composer() {
577
+
578
+ if ( ! defined( 'WPB_VC_VERSION' ) ) {
579
+ return false;
580
+ }
581
+
582
+ /** @global string $pagenow */
583
+ global $pagenow;
584
+
585
+ /** @global wpdb $wpdb */
586
+ // global $wpdb;
587
+
588
+ if ( 'post.php' === $pagenow ) {
589
+
590
+ $_builder_page = true;
591
+
592
+ /**
593
+ * @see vc_editor_post_types() (js_composer\include\helpers\helpers_api.php) doesn't work here.
594
+ * so let's check the roles.
595
+ */
596
+ $_opts = wp_roles()->roles;
597
+
598
+ if ( ! function_exists( 'wp_get_current_user' ) ) {
599
+ /** @noinspection PhpIncludeInspection */
600
+ require_once ABSPATH . WPINC . '/pluggable.php';
601
+ }
602
+
603
+ $_user = wp_get_current_user();
604
+
605
+ $post_id = WPGlobus_Utils::safe_get( 'post' );
606
+
607
+ if ( empty( $post_id ) ) {
608
+ /**
609
+ * Before update post we can get empty $_GET array.
610
+ * Let's check $_POST.
611
+ */
612
+ // phpcs:ignore WordPress.Security.NonceVerification.Missing
613
+ $post_id = isset( $_POST['post_ID'] ) ? sanitize_text_field( $_POST['post_ID'] ) : '';
614
+ }
615
+
616
+ // if ( empty( $post_id ) ) {
617
+ // @todo add handling this case.
618
+ // }
619
+
620
+ // $_post_type = $wpdb->get_col( $wpdb->prepare( "SELECT post_type FROM {$wpdb->prefix}posts WHERE ID = %d", $post_id ) );
621
+ //
622
+ // $post_type = '';
623
+ // if ( ! empty( $_post_type[0] ) ) {
624
+ // $post_type = $_post_type[0];
625
+ // }
626
+
627
+ $post = get_post( $post_id );
628
+ $post_type = ( $post ? $post->post_type : '' );
629
+
630
+ if ( ! isset( $_opts[ $_user->roles[0] ]['capabilities']['vc_access_rules_post_types'] ) ) {
631
+ /**
632
+ * WPBakery Page Builder is available for pages only (settings were not saved yet).
633
+ */
634
+ if ( 'page' !== $post_type ) {
635
+ $_builder_page = false;
636
+ }
637
+ } elseif ( empty( $_opts[ $_user->roles[0] ]['capabilities']['vc_access_rules_post_types'] ) ) {
638
+ /**
639
+ * Settings exist but set to False, so all post types are disabled in WPBakery Page Builder.
640
+ */
641
+ $_builder_page = false;
642
+
643
+ } elseif ( true === $_opts[ $_user->roles[0] ]['capabilities']['vc_access_rules_post_types'] ) {
644
+ /**
645
+ * WPBakery Page Builder is available for pages only.
646
+ */
647
+ if ( 'page' !== $post_type ) {
648
+ $_builder_page = false;
649
+ }
650
+ } elseif ( 'custom' === $_opts[ $_user->roles[0] ]['capabilities']['vc_access_rules_post_types'] ) {
651
+
652
+ /**
653
+ * Custom settings for post types in WPBakery Page Builder.
654
+ */
655
+ if ( ! empty( $_opts[ $_user->roles[0] ]['capabilities'][ 'vc_access_rules_post_types/' . $post_type ] ) ) {
656
+ // Setting for this post type exists and set to True.
657
+ $_builder_page = true;
658
+ } else {
659
+ $_builder_page = false;
660
+ }
661
+ } else {
662
+ $_builder_page = false;
663
+ }
664
+
665
+ $_attrs = array(
666
+ 'id' => 'js_composer',
667
+ 'version' => WPB_VC_VERSION,
668
+ 'class' => 'WPGlobus_JS_Composer',
669
+ 'post_type' => $post_type,
670
+ 'builder_page' => $_builder_page,
671
+ );
672
+
673
+ /**
674
+ * @since 2.2.11
675
+ * @W.I.P
676
+ */
677
+ //self::$admin_attrs['multilingualFields'][] = 'wpb_visual_composer';
678
+
679
+ $attrs = self::get_attrs( $_attrs );
680
+
681
+ return $attrs;
682
+
683
+ }
684
+
685
+ return false;
686
+ }
687
+
688
+ /**
689
+ * Gutenberg.
690
+ *
691
+ * @since 1.9.17
692
+ */
693
+ protected static function is_gutenberg() {
694
+
695
+ $load_gutenberg = false;
696
+ $message = '';
697
+
698
+ /** @global string $pagenow */
699
+ global $pagenow, $wp_version;
700
+
701
+ if ( version_compare( $wp_version, '4.9.99', '>' ) ) {
702
+
703
+ $context = 'core';
704
+
705
+ /**
706
+ * @since 2.0
707
+ */
708
+ if ( 'post-new.php' === $pagenow ) {
709
+
710
+ /**
711
+ * Load specific language switcher for this page.
712
+ *
713
+ * @see get_switcher_box() in wpglobus\includes\builders\gutenberg\class-wpglobus-gutenberg.php
714
+ */
715
+ //if ( ! isset( $_GET['classic-editor'] ) ) { // phpcs:ignore WordPress.CSRF.NonceVerification
716
+ // Start Gutenberg support if classic editor was not requested.
717
+ //$load_gutenberg = true;
718
+ //}
719
+
720
+ $load_gutenberg = true;
721
+
722
+ $load_gutenberg = self::get_3rd_party_status_for_gutenberg( $load_gutenberg );
723
+
724
+ } elseif ( 'index.php' === $pagenow ) {
725
+
726
+ /**
727
+ * When Update button was clicked.
728
+ */
729
+ if ( ! is_admin() ) {
730
+ /**
731
+ * Gutenberg updates post as from front.
732
+ *
733
+ * @see $_SERVER['REQUEST_URI']
734
+ */
735
+ //$actions = array( 'edit' );
736
+ // @todo check 'wp/v2/' in wp.api.versionString (JS).
737
+
738
+ // /wp-json/wp/v2/posts/
739
+ // /wp-json/wp/v2/pages/
740
+ /**
741
+ * We need define post type for correct work.
742
+ *
743
+ * @todo check
744
+ * /wp-json/wp/v2/taxonomies?context=edit
745
+ * /wp-json/wp/v2/taxonomies?context=edit&_locale=user
746
+ * /wp-json/wp/v2/types/wp_block?_locale=user
747
+ * /wp-json/wp/v2/blocks?per_page=100&_locale=user
748
+ */
749
+
750
+ $_request_uri = explode( '/', $_SERVER['REQUEST_URI'] );
751
+ $post_id = end( $_request_uri );
752
+ $post_id = preg_replace( '/\?.*/', '', $post_id );
753
+
754
+ /**
755
+ * @todo @see https://wpglobus.freshdesk.com/a/tickets/4103
756
+ */
757
+
758
+ /**
759
+ * @since 2.3.5 Added checking $_request_uri[4].
760
+ */
761
+ $_continue = false;
762
+ if ( 0 !== (int) $post_id && ! empty($_request_uri[4]) ) {
763
+
764
+ $GLOBALS['WPGlobus']['builder'] = 'gutenberg';
765
+ $GLOBALS['WPGlobus']['context'] = $context;
766
+ $GLOBALS['WPGlobus']['post_id'] = $post_id;
767
+ switch ( $_request_uri[4] ) {
768
+ case 'posts':
769
+ $post_type = 'post';
770
+ break;
771
+ case 'pages':
772
+ $post_type = 'page';
773
+ break;
774
+ default:
775
+ $post_type = $_request_uri[4];
776
+ }
777
+ $GLOBALS['WPGlobus']['post_type'] = $post_type;
778
+ $_continue = true;
779
+ }
780
+
781
+ if ( false !== strpos( $_SERVER['REQUEST_URI'], 'wp/v2/posts' )
782
+ || false !== strpos( $_SERVER['REQUEST_URI'], 'wp/v2/pages' )
783
+ || $_continue ) {
784
+ $load_gutenberg = true;
785
+ }
786
+ }
787
+ } elseif ( 'post.php' === $pagenow ) {
788
+
789
+ $load_gutenberg = true;
790
+
791
+ $post_type = is_null(self::$post_type) ? '' : self::$post_type;
792
+
793
+ /**
794
+ * Check out $_POST['post_type'] to define post type.
795
+ *
796
+ * @since 2.1.6
797
+ */
798
+ if ( empty( $post_type ) && ! empty( $_POST['post_type'] ) ) { // phpcs:ignore WordPress.CSRF.NonceVerification
799
+ $post_type = $_POST['post_type']; // phpcs:ignore WordPress.CSRF.NonceVerification
800
+ }
801
+
802
+ if ( empty( $post_type ) && ! empty( $_GET['post'] ) ) { // phpcs:ignore WordPress.CSRF.NonceVerification
803
+ $post_type = self::get_post_type( $_GET['post'] ); // phpcs:ignore WordPress.CSRF.NonceVerification
804
+ }
805
+
806
+ /**
807
+ * @todo don't check post type @since 2.1.2
808
+ */
809
+ // if ( ! in_array( $post_type, array( 'post', 'page' ), true ) ) {
810
+ // $load_gutenberg = false;
811
+ // }
812
+
813
+ /**
814
+ * @since 2.2.24
815
+ */
816
+ if ( ! self::use_block_editor_for_post_type($post_type) ) {
817
+ /**
818
+ * Don't start Block Editor support.
819
+ */
820
+ return false;
821
+
822
+ }
823
+
824
+ $load_gutenberg = self::get_3rd_party_status_for_gutenberg( $load_gutenberg, $post_type );
825
+
826
+ }
827
+
828
+ $_attrs = array(
829
+ 'id' => 'gutenberg',
830
+ 'version' => $wp_version,
831
+ 'class' => 'WPGlobus_Gutenberg',
832
+ 'builder_page' => false,
833
+ 'pagenow' => $pagenow,
834
+ 'post_type' => empty( $post_type ) ? '' : $post_type,
835
+ 'message' => $message,
836
+ 'context' => $context,
837
+ );
838
+
839
+ if ( $load_gutenberg ) {
840
+ $_attrs['builder_page'] = true;
841
+ }
842
+
843
+ $attrs = self::get_attrs( $_attrs );
844
+
845
+ self::$add_on['gutenberg']['admin_bar_builder_label'] = 'Block Editor';
846
+
847
+ return $attrs;
848
+
849
+ }
850
+
851
+ if ( defined( 'GUTENBERG_VERSION' ) ) {
852
+
853
+ $__builder = self::get_addon( 'gutenberg' );
854
+
855
+ if ( ! $__builder ) {
856
+ return false;
857
+ }
858
+
859
+ if ( version_compare( GUTENBERG_VERSION, $__builder['supported_min_version'], '<' ) ) {
860
+
861
+ $message = 'Unsupported Gutenberg version.';
862
+
863
+ } else {
864
+
865
+ if ( self::is_gutenberg_ajax() ) {
866
+
867
+ $load_gutenberg = true;
868
+
869
+ } else {
870
+
871
+ if ( 'post-new.php' === $pagenow ) {
872
+
873
+ /**
874
+ * Load specific language switcher for this page.
875
+ *
876
+ * @see get_switcher_box() in wpglobus\includes\builders\gutenberg\class-wpglobus-gutenberg.php
877
+ */
878
+ if ( ! isset( $_GET['classic-editor'] ) ) { // phpcs:ignore WordPress.CSRF.NonceVerification
879
+ // Start Gutenberg support if classic editor was not requested.
880
+ $load_gutenberg = true;
881
+ }
882
+
883
+ /**
884
+ * @since 1.9.30
885
+ */
886
+ $load_gutenberg = self::get_3rd_party_status_for_gutenberg( $load_gutenberg );
887
+
888
+ } elseif ( 'index.php' === $pagenow ) {
889
+
890
+ /**
891
+ * When Update button was clicked.
892
+ */
893
+ if ( ! is_admin() ) {
894
+ /**
895
+ * Gutenberg updates post as from front.
896
+ *
897
+ * @see $_SERVER['REQUEST_URI']
898
+ */
899
+ //$actions = array( 'edit' );
900
+ // @todo check 'wp/v2/' in wp.api.versionString (JS).
901
+
902
+ // /wp-json/wp/v2/posts/
903
+ // /wp-json/wp/v2/pages/
904
+ // @todo check /wp-json/wp/v2/taxonomies?context=edit
905
+ if ( false !== strpos( $_SERVER['REQUEST_URI'], 'wp/v2/posts' )
906
+ || false !== strpos( $_SERVER['REQUEST_URI'], 'wp/v2/pages' ) ) {
907
+ $load_gutenberg = true;
908
+ }
909
+ }
910
+ } elseif ( 'post.php' === $pagenow ) {
911
+
912
+ $load_gutenberg = true;
913
+
914
+ $actions = array( 'edit', 'editpost' );
915
+ // phpcs:ignore WordPress.Security.NonceVerification.Recommended
916
+ if ( ! empty( $_GET['action'] ) ) {
917
+ // phpcs:ignore WordPress.Security.NonceVerification.Recommended
918
+ if ( in_array( $_GET['action'], $actions, true ) ) {
919
+ // phpcs:ignore WordPress.Security.NonceVerification.Recommended
920
+ if ( array_key_exists( 'classic-editor', $_GET ) ) {
921
+ $load_gutenberg = false;
922
+ }
923
+ // phpcs:ignore WordPress.Security.NonceVerification.Recommended
924
+ if ( isset( $_GET['meta_box'] ) && 1 === (int) $_GET['meta_box'] ) {
925
+ $load_gutenberg = true;
926
+ }
927
+ }
928
+ } elseif ( ! empty( $_POST['action'] ) ) { // phpcs:ignore WordPress.CSRF.NonceVerification
929
+ // phpcs:ignore WordPress.Security.NonceVerification.Missing
930
+ if ( in_array( $_POST['action'], $actions, true ) ) {
931
+ // phpcs:ignore WordPress.Security.NonceVerification.Missing
932
+ if ( array_key_exists( 'classic-editor', $_POST ) ) {
933
+ $load_gutenberg = false;
934
+ }
935
+ // phpcs:ignore WordPress.Security.NonceVerification.Missing
936
+ if ( isset( $_POST['meta_box'] ) && 1 === (int) $_POST['meta_box'] ) {
937
+ $load_gutenberg = true;
938
+ }
939
+ }
940
+ }
941
+
942
+ $post_type = is_null(self::$post_type) ? '' : self::$post_type;
943
+
944
+ if ( empty($post_type) && ! empty( $_GET['post'] ) ) { // phpcs:ignore WordPress.CSRF.NonceVerification
945
+ $post_type = self::get_post_type( $_GET['post'] ); // phpcs:ignore WordPress.CSRF.NonceVerification
946
+ }
947
+
948
+ /**
949
+ * Since 1.9.17 Gutenberg support will be start for posts and pages only.
950
+ */
951
+ if ( ! in_array( $post_type, array( 'post', 'page' ), true ) ) {
952
+ $load_gutenberg = false;
953
+ }
954
+
955
+ /**
956
+ * @since 1.9.30
957
+ */
958
+ $load_gutenberg = self::get_3rd_party_status_for_gutenberg( $load_gutenberg );
959
+
960
+ }
961
+ }
962
+ }
963
+
964
+ $_attrs = array(
965
+ 'id' => 'gutenberg',
966
+ 'version' => GUTENBERG_VERSION,
967
+ 'class' => 'WPGlobus_Gutenberg',
968
+ 'builder_page' => false,
969
+ 'pagenow' => $pagenow,
970
+ 'post_type' => empty( $post_type ) ? '' : $post_type,
971
+ 'message' => $message,
972
+ );
973
+
974
+ if ( $load_gutenberg ) {
975
+ $_attrs['builder_page'] = true;
976
+ }
977
+
978
+ $attrs = self::get_attrs( $_attrs );
979
+
980
+ return $attrs;
981
+
982
+ }
983
+
984
+ return $load_gutenberg;
985
+ }
986
+
987
+ /**
988
+ * @since 1.9.30
989
+ *
990
+ * @param bool $load_gutenberg
991
+ * @param string $post_type @since 2.1.6
992
+ *
993
+ * @return bool
994
+ */
995
+ protected static function get_3rd_party_status_for_gutenberg( $load_gutenberg, $post_type = '' ) {
996
+
997
+ if ( '' === $post_type ) {
998
+ $post_type = self::get_post_type_2();
999
+ }
1000
+
1001
+ if ( defined( 'WC_PLUGIN_FILE' ) ) {
1002
+ /**
1003
+ * WooCommerce.
1004
+ */
1005
+ if ( 'product' === $post_type ) {
1006
+
1007
+ $load_gutenberg = false;
1008
+
1009
+ } elseif ( '' === $post_type ) {
1010
+
1011
+ if ( ! empty( $_POST['post_type'] ) ) { // phpcs:ignore WordPress.CSRF.NonceVerification
1012
+ $post_type = $_POST['post_type']; // phpcs:ignore WordPress.CSRF.NonceVerification
1013
+ }
1014
+
1015
+ if ( empty( $post_type ) && ! empty( $_GET['post'] ) ) { // phpcs:ignore WordPress.CSRF.NonceVerification
1016
+ $post_type = self::get_post_type( $_GET['post'] ); // phpcs:ignore WordPress.CSRF.NonceVerification
1017
+ }
1018
+
1019
+ if ( empty( $post_type ) && ! empty( $_GET['post_type'] ) ) { // phpcs:ignore WordPress.CSRF.NonceVerification
1020
+ $post_type = $_GET['post_type']; // phpcs:ignore WordPress.CSRF.NonceVerification
1021
+ }
1022
+
1023
+ if ( 'product' === $post_type ) {
1024
+ $load_gutenberg = false;
1025
+ }
1026
+ }
1027
+ }
1028
+
1029
+ if ( function_exists( 'classic_editor_settings' ) ) {
1030
+ /**
1031
+ * @see ver.0.5 https://wordpress.org/plugins/classic-editor/#developers
1032
+ */
1033
+ if ( isset( $_GET['classic-editor'] ) ) { // phpcs:ignore WordPress.CSRF.NonceVerification
1034
+ /**
1035
+ * Option 'Use the Block editor by default and include optional links back to the Classic editor' was selected.
1036
+ */
1037
+ $load_gutenberg = false;
1038
+ } else {
1039
+ $classic_editor_replace = get_option( 'classic-editor-replace' );
1040
+ if ( empty( $classic_editor_replace ) || 'replace' === $classic_editor_replace ) {
1041
+ $load_gutenberg = false;
1042
+ }
1043
+ }
1044
+ }
1045
+
1046
+ if ( class_exists( 'Classic_Editor' ) ) {
1047
+ /** @global string $wp_version */
1048
+ global $wp_version;
1049
+
1050
+ if ( version_compare( $wp_version, '4.9.99', '>' ) ) { // phpcs:ignore Generic.CodeAnalysis.EmptyStatement
1051
+ // continue
1052
+ } else {
1053
+ /**
1054
+ * Incorrect work with WP 4.9
1055
+ *
1056
+ * @see https://wordpress.org/support/topic/does-nor-work-anymore-since-v-1-0/
1057
+ */
1058
+ return $load_gutenberg;
1059
+ }
1060
+
1061
+ /**
1062
+ * ver.1.0 https://wordpress.org/plugins/classic-editor/
1063
+ */
1064
+ if ( isset( $_GET['classic-editor'] ) ) { // phpcs:ignore WordPress.CSRF.NonceVerification
1065
+ /**
1066
+ * @todo
1067
+ * 1. set 'classic-editor-remember' as 'block-editor'.
1068
+ * 2. load your-site/wp-admin/post.php?post=POST_ID&action=edit&classic-editor.
1069
+ * 3. incorrect loading post page.
1070
+ */
1071
+ //update_post_meta( POST_ID, 'classic-editor-remember', 'classic-editor' );
1072
+
1073
+ $load_gutenberg = false;
1074
+ } elseif ( isset( $_GET['classic-editor__forget'] ) ) { // phpcs:ignore WordPress.CSRF.NonceVerification
1075
+ $load_gutenberg = true;
1076
+ } else {
1077
+ $post_id = isset( $_GET['post'] ) ? (int) $_GET['post'] : 0; // phpcs:ignore WordPress.CSRF.NonceVerification
1078
+
1079
+ if ( 0 === $post_id ) {
1080
+ /**
1081
+ * We need to check $_POST when the saving post in 'classic-editor' mode.
1082
+ * As option we can use $_POST['classic-editor'], but now get 'classic-editor-remember' meta.
1083
+ */
1084
+ $post_id = isset( $_POST['post_ID'] ) ? (int) $_POST['post_ID'] : 0; // phpcs:ignore WordPress.CSRF.NonceVerification
1085
+ }
1086
+
1087
+ if ( 0 !== $post_id ) {
1088
+ $classic_editor_remember = get_post_meta( $post_id, 'classic-editor-remember', true );
1089
+ if ( 'classic-editor' === $classic_editor_remember ) {
1090
+ $load_gutenberg = false;
1091
+
1092
+ return $load_gutenberg;
1093
+ } elseif ( 'block-editor' === $classic_editor_remember ) {
1094
+ $load_gutenberg = true;
1095
+
1096
+ return $load_gutenberg;
1097
+ }
1098
+ //else {
1099
+ /**
1100
+ * @todo meta doesn't exist?
1101
+ */
1102
+ //}
1103
+ }
1104
+
1105
+ $classic_editor_replace = get_option( 'classic-editor-replace' );
1106
+ if ( empty( $classic_editor_replace ) || 'classic' === $classic_editor_replace ) {
1107
+ $load_gutenberg = false;
1108
+ } elseif ( 'block' === $classic_editor_replace ) {
1109
+ $load_gutenberg = true;
1110
+ } else {
1111
+ $load_gutenberg = false;
1112
+
1113
+ }
1114
+ }
1115
+ }
1116
+
1117
+ return $load_gutenberg;
1118
+
1119
+ }
1120
+
1121
+ /**
1122
+ * Check for gutenberg ajax.
1123
+ */
1124
+ protected static function is_gutenberg_ajax() {
1125
+ $result = false;
1126
+
1127
+ // phpcs:ignore WordPress.Security.NonceVerification.Missing
1128
+ if ( empty( $_POST ) || empty( $_POST['action'] ) ) {
1129
+ return $result;
1130
+ }
1131
+
1132
+ $actions = array( 'edit', 'editpost' );
1133
+ if ( in_array( $_POST['action'], $actions, true ) ) { // phpcs:ignore WordPress.CSRF.NonceVerification
1134
+ if ( array_key_exists( 'gutenberg_meta_boxes', $_POST ) ) { // phpcs:ignore WordPress.CSRF.NonceVerification
1135
+ $result = true;
1136
+ }
1137
+ }
1138
+
1139
+ return $result;
1140
+ }
1141
+
1142
+ /**
1143
+ * Check for Yoast SEO.
1144
+ *
1145
+ * @since 1.9.17
1146
+ */
1147
+ protected static function is_yoast_seo() {
1148
+
1149
+ if ( defined( 'WPSEO_VERSION' ) ) {
1150
+
1151
+ /** @global string $pagenow */
1152
+ global $pagenow;
1153
+
1154
+ $wpseo_titles = get_option( 'wpseo_titles' );
1155
+
1156
+ if ( 'post.php' === $pagenow ) {
1157
+
1158
+ $post_type = is_null(self::$post_type) ? '' : self::$post_type;
1159
+
1160
+ if ( empty( $post_type ) && ! empty( $_GET['post'] ) ) { // phpcs:ignore WordPress.CSRF.NonceVerification
1161
+ $post_type = self::get_post_type( $_GET['post'] ); // phpcs:ignore WordPress.CSRF.NonceVerification
1162
+ }
1163
+
1164
+ if ( empty( $post_type ) ) {
1165
+ /**
1166
+ * Check $_REQUEST when post is updated.
1167
+ */
1168
+ if ( ! empty( $_REQUEST['post_type'] ) ) { // phpcs:ignore WordPress.CSRF.NonceVerification
1169
+ $post_type = $_REQUEST['post_type']; // phpcs:ignore WordPress.CSRF.NonceVerification
1170
+ }
1171
+ }
1172
+
1173
+ $_attrs = array(
1174
+ 'id' => 'yoast_seo',
1175
+ 'version' => WPSEO_VERSION,
1176
+ 'class' => 'WPGlobus_Yoast_SEO',
1177
+ 'builder_page' => false,
1178
+ 'post_type' => empty( $post_type ) ? '' : $post_type,
1179
+ );
1180
+
1181
+ if ( empty( $post_type ) ) {
1182
+ /**
1183
+ * @since 1.9.17 detect builder page using $pagenow.
1184
+ */
1185
+ $_attrs['builder_page'] = true;
1186
+ } else {
1187
+
1188
+ if ( ! array_key_exists( 'display-metabox-pt-' . $post_type, $wpseo_titles ) ) {
1189
+ /**
1190
+ * @since 2.2.25
1191
+ */
1192
+ $_attrs['builder_page'] = true;
1193
+ } elseif ( 0 === (int) $wpseo_titles[ 'display-metabox-pt-' . $post_type ] ) {
1194
+ $_attrs['builder_page'] = false;
1195
+ } else {
1196
+ $_attrs['builder_page'] = true;
1197
+ }
1198
+
1199
+ }
1200
+
1201
+ $attrs = self::get_attrs( $_attrs );
1202
+
1203
+ return $attrs;
1204
+
1205
+ } elseif ( 'term.php' === $pagenow ) {
1206
+
1207
+ $tax = empty( $_GET['taxonomy'] ) ? false : sanitize_text_field( wp_unslash( $_GET['taxonomy'] ) ); // phpcs:ignore WordPress.CSRF.NonceVerification
1208
+
1209
+ if ( $tax ) {
1210
+
1211
+ $_attrs = array(
1212
+ 'id' => 'yoast_seo',
1213
+ 'version' => WPSEO_VERSION,
1214
+ 'class' => 'WPGlobus_Yoast_SEO',
1215
+ 'builder_page' => false,
1216
+ 'post_type' => '',
1217
+ 'taxonomy' => $tax,
1218
+ );
1219
+
1220
+ self::$admin_attrs = array(
1221
+ 'multilingualFields' => array( 'name', 'description_ifr' ),
1222
+ 'translatableClass' => 'wpglobus-translatable',
1223
+ );
1224
+
1225
+ if ( isset( $wpseo_titles[ 'display-metabox-tax-' . $tax ] ) && 0 === (int) $wpseo_titles[ 'display-metabox-tax-' . $tax ] ) {
1226
+ $_attrs['builder_page'] = false;
1227
+ } else {
1228
+ $_attrs['builder_page'] = true;
1229
+ }
1230
+
1231
+ $attrs = self::get_attrs( $_attrs );
1232
+
1233
+ return $attrs;
1234
+ }
1235
+ } elseif ( 'edit-tags.php' === $pagenow ) {
1236
+ /**
1237
+ * Case when Update button was clicked on term.php page .
1238
+ */
1239
+ // phpcs:ignore WordPress.Security.NonceVerification.Missing
1240
+ $tax = empty( $_POST['taxonomy'] ) ? false : sanitize_text_field( wp_unslash( $_POST['taxonomy'] ) );
1241
+
1242
+ if ( $tax ) {
1243
+
1244
+ $_attrs = array(
1245
+ 'id' => 'yoast_seo',
1246
+ 'version' => WPSEO_VERSION,
1247
+ 'class' => 'WPGlobus_Yoast_SEO',
1248
+ 'builder_page' => false,
1249
+ 'post_type' => '',
1250
+ 'taxonomy' => $tax,
1251
+ );
1252
+
1253
+ self::$admin_attrs = array(
1254
+ 'multilingualFields' => array( 'name', 'description_ifr' ),
1255
+ 'translatableClass' => 'wpglobus-translatable',
1256
+ );
1257
+
1258
+ if ( isset( $_POST['action'] ) && 'editedtag' === $_POST['action'] ) { // phpcs:ignore WordPress.CSRF.NonceVerification
1259
+ $_attrs['builder_page'] = true;
1260
+ }
1261
+
1262
+ $attrs = self::get_attrs( $_attrs );
1263
+
1264
+ return $attrs;
1265
+ }
1266
+ }
1267
+ }
1268
+
1269
+ return false;
1270
+
1271
+ }
1272
+
1273
+ /**
1274
+ * Check for Pods – Custom Content Types and Fields.
1275
+ *
1276
+ * @since 2.3.0
1277
+ */
1278
+ protected static function is_pods() {
1279
+
1280
+ if ( ! defined( 'PODS_VERSION' ) ) {
1281
+ return false;
1282
+ }
1283
+
1284
+ $post_type = self::get_post_type_2();
1285
+
1286
+ $_attrs = array(
1287
+ 'id' => 'pods',
1288
+ 'version' => PODS_VERSION,
1289
+ 'class' => 'WPGlobus_Pods',
1290
+ 'builder_page' => false,
1291
+ 'post_type' => empty( $post_type ) ? '' : $post_type,
1292
+ );
1293
+
1294
+ require_once 'pods/class-wpglobus-builder-pods.php';
1295
+ $_attrs = WPGlobus_Builder_Pods::get_attrs( self::get_attrs( $_attrs ) );
1296
+
1297
+ if ( ! $_attrs ) {
1298
+ return false;
1299
+ }
1300
+
1301
+ return $_attrs;
1302
+ }
1303
+
1304
+ /**
1305
+ * Get attributes.
1306
+ *
1307
+ * @param array $attrs
1308
+ *
1309
+ * @return array
1310
+ */
1311
+ protected static function get_attrs( $attrs ) {
1312
+ $_attrs = array_merge( self::$attrs, $attrs );
1313
+ // phpcs:ignore Generic.CodeAnalysis.EmptyStatement.DetectedIf
1314
+ if ( isset( $_attrs['is_admin'] ) && ! $_attrs['is_admin'] ) {
1315
+ // do nothing.
1316
+ } else {
1317
+ $_attrs = array_merge( $_attrs, self::$admin_attrs );
1318
+ }
1319
+
1320
+ if ( empty( $_attrs['post_id'] ) ) {
1321
+ if ( isset( $_GET['post'] ) && is_string( $_GET['post'] ) ) { // phpcs:ignore WordPress.CSRF.NonceVerification
1322
+ /**
1323
+ * With bulk action (trash, untrash) we get $_GET['post'] as array.
1324
+ *
1325
+ * @since WPGlobus 2.0 we are working with single post only.
1326
+ */
1327
+ // phpcs:ignore WordPress.Security.NonceVerification.Recommended
1328
+ $_attrs['post_id'] = sanitize_text_field( $_GET['post'] );
1329
+ // phpcs:ignore WordPress.Security.NonceVerification.Recommended
1330
+ } elseif ( isset( $_REQUEST['post_ID'] ) && is_string( $_REQUEST['post_ID'] ) ) {
1331
+ // phpcs:ignore WordPress.Security.NonceVerification.Recommended
1332
+ $_attrs['post_id'] = sanitize_text_field( $_REQUEST['post_ID'] );
1333
+ // } else {
1334
+ // @todo Check additional ways to get post ID.
1335
+ }
1336
+ }
1337
+
1338
+ // @todo may be disable post type here.
1339
+ // $_attrs['builder_page'] = false;
1340
+ return $_attrs;
1341
+ }
1342
+
1343
+ /**
1344
+ * Get post type.
1345
+ *
1346
+ * @param string $id
1347
+ *
1348
+ * @return null|string
1349
+ */
1350
+ protected static function get_post_type( $id = '' ) {
1351
+
1352
+ /**
1353
+ * Get post type.
1354
+ *
1355
+ * @since 2.2.11
1356
+ */
1357
+ if ( ! is_null( self::$post_type ) ) {
1358
+ return self::$post_type;
1359
+ }
1360
+
1361
+ /**
1362
+ * @since 2.2.11
1363
+ * @W.I.P to use get_post_type_2()
1364
+ */
1365
+ if ( 0 === (int) $id ) {
1366
+ return null;
1367
+ }
1368
+
1369
+ /** @global wpdb $wpdb */
1370
+ global $wpdb;
1371
+
1372
+ $post_type = $wpdb->get_var( $wpdb->prepare( "SELECT post_type FROM $wpdb->posts WHERE ID = %d", $id ) );
1373
+
1374
+ return $post_type;
1375
+ }
1376
+
1377
+ /**
1378
+ * Get post type 2.
1379
+ *
1380
+ * @since 2.2.11
1381
+ */
1382
+ protected static function get_post_type_2() {
1383
+
1384
+ if ( ! is_null( self::$post_type ) ) {
1385
+ return self::$post_type;
1386
+ }
1387
+
1388
+ /** @global string $pagenow */
1389
+ global $pagenow;
1390
+
1391
+ $post_type = '';
1392
+ $post_id = '';
1393
+
1394
+ switch ($pagenow) {
1395
+ case 'media-new.php' :
1396
+ $post_type = 'attachment';
1397
+ break;
1398
+ case 'post-new.php':
1399
+ if ( isset( $_GET['post_type'] ) ) {
1400
+ // phpcs:ignore WordPress.Security.NonceVerification.Recommended
1401
+ $post_type = sanitize_text_field( $_GET['post_type'] );
1402
+ } else {
1403
+ $post_type = 'post';
1404
+ }
1405
+ break;
1406
+ /**
1407
+ * @W.I.P @since 2.2.14
1408
+ case 'admin-ajax.php' :
1409
+ $post_type = '';
1410
+ break;
1411
+ // */
1412
+ default:
1413
+ // post.php page.
1414
+ if ( isset( $_GET['post'] ) ) { // phpcs:ignore WordPress.CSRF.NonceVerification
1415
+ $post_id = $_GET['post']; // phpcs:ignore WordPress.CSRF.NonceVerification
1416
+ } else if ( isset( $_GET['post_id'] ) ) { // phpcs:ignore WordPress.CSRF.NonceVerification
1417
+ /**
1418
+ * For example when loading WPBakery PB's front editor.
1419
+ * @since 2.3.7
1420
+ */
1421
+ $post_id = $_GET['post_id']; // phpcs:ignore WordPress.CSRF.NonceVerification
1422
+ } else if ( isset( $_REQUEST['post_ID'] ) ) { // phpcs:ignore WordPress.CSRF.NonceVerification
1423
+ /**
1424
+ * Case when Update button was clicked.
1425
+ */
1426
+ $post_id = $_REQUEST['post_ID']; // phpcs:ignore WordPress.CSRF.NonceVerification
1427
+ }
1428
+ break;
1429
+ }
1430
+
1431
+ if ( ! empty($post_type) ) {
1432
+ self::$post_type = $post_type;
1433
+ return self::$post_type;
1434
+ }
1435
+
1436
+ if ( 0 === (int) $post_id ) {
1437
+ return false;
1438
+ }
1439
+
1440
+ /** @global wpdb $wpdb */
1441
+ global $wpdb;
1442
+
1443
+ self::$post_type = $wpdb->get_var( $wpdb->prepare( "SELECT post_type FROM $wpdb->posts WHERE ID = %d", $post_id ) );
1444
+
1445
+ return self::$post_type;
1446
+ }
1447
+
1448
+ /**
1449
+ * Check for post type supports.
1450
+ *
1451
+ * @since 2.2.24
1452
+ * @since 2.2.34 Fix with empty `show_in_rest`.
1453
+ *
1454
+ * @return bool
1455
+ */
1456
+ protected static function use_block_editor_for_post_type($post_type) {
1457
+
1458
+ $_opts = get_option(self::$init_attrs['options']['register_post_types']);
1459
+
1460
+ if ( empty($_opts[$post_type]) ) {
1461
+ /**
1462
+ * We don't have info about post type.
1463
+ */
1464
+ return true;
1465
+ }
1466
+
1467
+ if ( empty($_opts[$post_type]['features']['editor']) || (int) $_opts[$post_type]['features']['editor'] == 0 ) {
1468
+ /**
1469
+ * Don't start Block Editor support.
1470
+ * @see `use_block_editor_for_post_type()` in wp-admin\includes\post.php
1471
+ */
1472
+ return false;
1473
+ }
1474
+
1475
+ if ( empty($_opts[$post_type]['show_in_rest']) || (int) $_opts[$post_type]['show_in_rest'] == 0 ) {
1476
+ /**
1477
+ * Don't start Block Editor support.
1478
+ * @see `use_block_editor_for_post_type()` in wp-admin\includes\post.php
1479
+ */
1480
+ return false;
1481
+ }
1482
+
1483
+ return true;
1484
+ }
1485
+ }
1486
+
1487
+ endif;
trunk/includes/builders/class-wpglobus-config-builder.php ADDED
@@ -0,0 +1,554 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * File: class-wpglobus-config-builder.php
4
+ *
5
+ * @package WPGlobus\Builders
6
+ * @author Alex Gor(alexgff)
7
+ */
8
+
9
+ if ( ! class_exists( 'WPGlobus_Config_Builder' ) ) :
10
+
11
+ class WPGlobus_Config_Builder {
12
+
13
+ /**
14
+ * @var string|false
15
+ */
16
+ protected $id = false;
17
+
18
+ protected $is_run = false;
19
+
20
+ /**
21
+ * May be to use "wpglobus_language" meta (reserved in WPGlobus).
22
+ *
23
+ * @todo remove after test
24
+ */
25
+ //protected $language_meta_key = '_wpglobus_builder_language';
26
+
27
+ protected $language_cookie = 'wpglobus-builder-language';
28
+
29
+ protected $attrs = array();
30
+
31
+ protected $__class = null;
32
+
33
+ protected $__builder_page = false;
34
+
35
+ protected $__is_admin = false;
36
+
37
+ protected $language = false;
38
+
39
+ protected $default_language;
40
+
41
+ /**
42
+ * @since 2.2.11
43
+ */
44
+ public $post_types = array();
45
+
46
+ /**
47
+ * Constructor.
48
+ *
49
+ * @param bool $init
50
+ * @param array $init_attrs
51
+ */
52
+ public function __construct( $init = true, $init_attrs = array() ) {
53
+
54
+ if ( isset( $init_attrs['default_language'] ) ) {
55
+ $this->default_language = $init_attrs['default_language'];
56
+ }
57
+
58
+ /**
59
+ * @since 2.2.11
60
+ */
61
+ if ( isset( $init_attrs['post_types'] ) ) {
62
+ $this->post_types = $init_attrs['post_types'];
63
+ }
64
+
65
+ if ( $init ) {
66
+
67
+ require_once dirname( __FILE__ ) . '/class-wpglobus-builders.php';
68
+ /**
69
+ * @since 2.2.24 added $init_attrs.
70
+ */
71
+ $builder = WPGlobus_Builders::get(true, $init_attrs);
72
+
73
+ $this->id = $builder['id'];
74
+ unset( $builder['id'] );
75
+
76
+ if ( $this->id ) {
77
+
78
+ $this->attrs['version'] = null;
79
+
80
+ foreach ( $builder as $key => $value ) {
81
+ if ( 'class' === $key ) {
82
+ $this->__class = $value;
83
+ } elseif ( 'builder_page' === $key ) {
84
+ $this->__builder_page = $value;
85
+ } elseif ( 'is_admin' === $key ) {
86
+ $this->__is_admin = $value;
87
+ }
88
+ $this->attrs[ $key ] = $value;
89
+ }
90
+
91
+ $this->language = $this->get_language();
92
+ $this->attrs['language'] = $this->language;
93
+
94
+ } else {
95
+ unset( $this->attrs );
96
+ }
97
+ } else {
98
+
99
+ require_once dirname( __FILE__ ) . '/class-wpglobus-builders.php';
100
+ /** @noinspection PhpUnusedLocalVariableInspection */
101
+ $builder = WPGlobus_Builders::get( false );
102
+
103
+ }
104
+
105
+ }
106
+
107
+ /**
108
+ * Try to run builder.
109
+ *
110
+ * @param string $builder
111
+ * @param bool $set_run_flag
112
+ *
113
+ * @return bool
114
+ */
115
+ public function maybe_run( $builder = '', $set_run_flag = false ) {
116
+
117
+ //if ( defined('DOING_AJAX') && DOING_AJAX ) {
118
+ //return false;
119
+ //}
120
+
121
+ if ( ! $this->id ) {
122
+ return false;
123
+ }
124
+
125
+ $check_run_flag = true;
126
+
127
+ if ( is_bool( $builder ) ) {
128
+ // phpcs:ignore Generic.CodeAnalysis.EmptyStatement.DetectedIF
129
+ if ( $builder ) {
130
+ // @todo
131
+ } else {
132
+ $check_run_flag = false;
133
+ $set_run_flag = false;
134
+ }
135
+ }
136
+
137
+ if ( $check_run_flag && $this->is_run ) {
138
+ /**
139
+ * Don't run again.
140
+ */
141
+ return false;
142
+ }
143
+
144
+ if ( '' === $builder ) {
145
+ $builder = $this->id;
146
+ }
147
+
148
+ if ( ! $builder ) {
149
+ return false;
150
+ }
151
+
152
+ if ( $builder !== $this->id ) {
153
+ return false;
154
+ }
155
+
156
+ if ( $this->is_front() ) {
157
+ if ( $set_run_flag ) {
158
+ $this->is_run = true;
159
+ }
160
+
161
+ return true;
162
+ }
163
+
164
+ if ( $this->is_builder_page() ) {
165
+ if ( $set_run_flag ) {
166
+ $this->is_run = true;
167
+ }
168
+
169
+ return true;
170
+ }
171
+
172
+ return false;
173
+
174
+ }
175
+
176
+ /**
177
+ * Get attribute.
178
+ *
179
+ * @param string $attr
180
+ *
181
+ * @return bool|mixed
182
+ */
183
+ public function get( $attr = 'id' ) {
184
+ if ( ! $this->id ) {
185
+ return false;
186
+ }
187
+ if ( 'id' === $attr ) {
188
+ return $this->get_id();
189
+ }
190
+ if ( ! empty( $this->attrs[ $attr ] ) ) {
191
+ return $this->attrs[ $attr ];
192
+ }
193
+
194
+ return false;
195
+ }
196
+
197
+ /**
198
+ * Set builder language.
199
+ *
200
+ * @param string $language
201
+ */
202
+ public function set_language( $language = '' ) {
203
+ if ( ! empty( $language ) ) {
204
+ $this->language = $language;
205
+ $this->attrs['language'] = $this->language;
206
+ }
207
+ }
208
+
209
+ /**
210
+ * Get builder language.
211
+ *
212
+ * @param int|string $post_id
213
+ *
214
+ * @return array|bool|mixed|string
215
+ */
216
+ public function get_language( $post_id = '' ) {
217
+
218
+ if ( ! $this->id ) {
219
+ return false;
220
+ }
221
+
222
+ if ( ! $this->is_builder_page() ) {
223
+ /**
224
+ * @todo maybe need to check the matching of $this->language and WPGlobus::Config()->language.
225
+ * @see Set language for builder in wpglobus\includes\class-wpglobus-config.php
226
+ */
227
+ return $this->language;
228
+ }
229
+
230
+ if ( $this->language ) {
231
+ return $this->language;
232
+ }
233
+
234
+ /** @global string $pagenow */
235
+ global $pagenow;
236
+
237
+ if ( 'post-new.php' === $pagenow ) {
238
+ /**
239
+ * Correctly define language for the 'post-new.php' page.
240
+ *
241
+ * @since 2.1.1
242
+ */
243
+ $this->language = $this->default_language;
244
+
245
+ return $this->language;
246
+ }
247
+
248
+ $post_id = (int) $post_id;
249
+ if ( ! $post_id ) {
250
+ // Post ID not passed..getting from global Post.
251
+ $global_post = get_post();
252
+ if ( $global_post instanceof WP_Post ) {
253
+ $post_id = $global_post->ID;
254
+ }
255
+ }
256
+
257
+ $language = false;
258
+ if ( $post_id ) {
259
+ $language = get_post_meta( $post_id, $this->get_language_meta_key(), true );
260
+ }
261
+
262
+ if ( ! $language ) {
263
+
264
+ if ( empty( $_REQUEST ) ) { // phpcs:ignore WordPress.CSRF.NonceVerification
265
+
266
+ if ( empty( $_SERVER['HTTP_REFERER'] ) ) {
267
+ /**
268
+ * @todo front-end? check it.
269
+ */
270
+ return false;
271
+
272
+ } elseif ( false !== strpos( $_SERVER['HTTP_REFERER'], 'language=' ) ) {
273
+ $language = explode( 'language=', $_SERVER['HTTP_REFERER'] );
274
+ $language = $language[1];
275
+ }
276
+ } else {
277
+
278
+ if ( ! empty( $_REQUEST['language'] ) ) { // phpcs:ignore WordPress.CSRF.NonceVerification
279
+ $language = sanitize_text_field( $_REQUEST['language'] );
280
+ }
281
+
282
+ if ( isset( $_REQUEST[ WPGlobus::get_language_meta_key() ] ) ) { // phpcs:ignore WordPress.CSRF.NonceVerification
283
+ $language = sanitize_text_field( $_REQUEST[ WPGlobus::get_language_meta_key() ] );
284
+ }
285
+ }
286
+ }
287
+
288
+ if ( ! $language ) {
289
+
290
+ if ( isset( $_REQUEST['post'] ) && 0 !== (int) $_REQUEST['post'] ) { // phpcs:ignore WordPress.CSRF.NonceVerification
291
+
292
+ $language = get_post_meta( $_REQUEST['post'], $this->get_language_meta_key(), true ); // phpcs:ignore WordPress.CSRF.NonceVerification
293
+
294
+ } elseif ( isset( $_REQUEST['id'] ) && 0 !== (int) $_REQUEST['id'] ) { // phpcs:ignore WordPress.CSRF.NonceVerification
295
+
296
+ /**
297
+ * Case when post in draft status is autosaved.
298
+ */
299
+ $language = get_post_meta( $_REQUEST['id'], $this->get_language_meta_key(), true ); // phpcs:ignore WordPress.CSRF.NonceVerification
300
+
301
+ } elseif ( isset( $_SERVER['REQUEST_URI'] ) ) {
302
+
303
+ /**
304
+ * See also the Update action in @see \WPGlobus_Builders
305
+ */
306
+ $_continue = false;
307
+ if ( isset( $GLOBALS['WPGlobus'] ) && ! empty( $GLOBALS['WPGlobus']['post_type'] ) ) {
308
+ $_continue = true;
309
+ }
310
+ if ( false !== strpos( $_SERVER['REQUEST_URI'], '/wp-json/wp/v2/posts/' )
311
+ || false !== strpos( $_SERVER['REQUEST_URI'], '/wp-json/wp/v2/pages/' )
312
+ || $_continue ) {
313
+ /**
314
+ * Case when post status was changed ( draft->publish or publish->draft ) in Gutenberg.
315
+ *
316
+ * @see \WPGlobus_Builders::is_gutenberg()
317
+ */
318
+ if ( isset( $GLOBALS['WPGlobus'] ) && ! empty( $GLOBALS['WPGlobus']['post_id'] ) ) {
319
+ $post_id = $GLOBALS['WPGlobus']['post_id'];
320
+ } else {
321
+ $_request_uri = explode( '/', $_SERVER['REQUEST_URI'] );
322
+
323
+ $post_id = end( $_request_uri );
324
+ $post_id = preg_replace( '/\?.*/', '', $post_id );
325
+ }
326
+
327
+ if ( 0 !== (int) $post_id ) {
328
+ $language = get_post_meta( $post_id, $this->get_language_meta_key(), true ); // phpcs:ignore WordPress.CSRF.NonceVerification
329
+ }
330
+ }
331
+ }
332
+ }
333
+
334
+ if ( ! $language ) {
335
+ if ( $this->get_post_id() ) {
336
+ $language = get_post_meta( $this->get_post_id(), $this->get_language_meta_key(), true );
337
+ }
338
+ }
339
+
340
+ if ( ! $language && ! empty( $this->default_language ) ) {
341
+ /**
342
+ * Possible options when the language is not defined:
343
+ * - new post, post-new.php page;
344
+ */
345
+ $language = $this->default_language;
346
+ /**
347
+ * @todo test point if was incorrect setting of $language.
348
+ */
349
+
350
+ }
351
+
352
+ $this->language = $language;
353
+
354
+ return $language;
355
+
356
+ }
357
+
358
+ /**
359
+ * Check if builder is run.
360
+ */
361
+ public function is_run() {
362
+ if ( ! $this->id ) {
363
+ return false;
364
+ }
365
+
366
+ return $this->is_run;
367
+ }
368
+
369
+ /**
370
+ * Check if builder is run.
371
+ */
372
+ public function is_running() {
373
+ return $this->is_run();
374
+ }
375
+
376
+ /**
377
+ * Check if builder is in admin.
378
+ */
379
+ public function is_admin() {
380
+ if ( ! $this->id ) {
381
+ return false;
382
+ }
383
+
384
+ return $this->__is_admin;
385
+ }
386
+
387
+ /**
388
+ * Check if builder is in front.
389
+ */
390
+ public function is_front() {
391
+ if ( ! $this->id ) {
392
+ return false;
393
+ }
394
+
395
+ return ! $this->__is_admin;
396
+ }
397
+
398
+ /**
399
+ * Get builder ID.
400
+ */
401
+ public function get_id() {
402
+ return $this->id;
403
+ }
404
+
405
+ /**
406
+ * Get post ID.
407
+ */
408
+ public function get_post_id() {
409
+ if ( isset( $this->attrs['post_id'] ) && (int) $this->attrs['post_id'] > 0 ) {
410
+ return $this->attrs['post_id'];
411
+ }
412
+
413
+ return false;
414
+ }
415
+
416
+ /**
417
+ * Get builder class.
418
+ */
419
+ public function get_class() {
420
+ if ( ! $this->id ) {
421
+ return false;
422
+ }
423
+
424
+ return $this->__class;
425
+ }
426
+
427
+ /**
428
+ *
429
+ */
430
+ public function get_language_meta_key() {
431
+ if ( ! $this->id ) {
432
+ return false;
433
+ }
434
+
435
+ return WPGlobus::get_language_meta_key();
436
+ }
437
+
438
+ /**
439
+ *
440
+ */
441
+ public function get_cookie_name() {
442
+ if ( ! $this->id ) {
443
+ return false;
444
+ }
445
+
446
+ return $this->language_cookie;
447
+ }
448
+
449
+ /**
450
+ * @param string $cookie_name
451
+ *
452
+ * @return bool|null
453
+ */
454
+ public function get_cookie( $cookie_name = '' ) {
455
+
456
+ if ( ! $this->id ) {
457
+ return false;
458
+ }
459
+
460
+ static $_cookie_value = null;
461
+
462
+ if ( is_null( $_cookie_value ) ) {
463
+ if ( empty( $cookie_name ) ) {
464
+ $cookie_name = $this->get_cookie_name();
465
+ }
466
+ if ( empty( $_COOKIE[ $cookie_name ] ) ) {
467
+ $_cookie_value = false;
468
+ } else {
469
+ $_cookie_value = $_COOKIE[ $cookie_name ];
470
+ }
471
+ }
472
+
473
+ return $_cookie_value;
474
+ }
475
+
476
+ /**
477
+ * Check if current page is builder's page.
478
+ */
479
+ public function is_builder_page() {
480
+ if ( ! $this->id ) {
481
+ return false;
482
+ }
483
+
484
+ return $this->__builder_page;
485
+ }
486
+
487
+ /**
488
+ * Get all builder data.
489
+ */
490
+ public function get_data() {
491
+
492
+ if ( ! $this->id ) {
493
+ return false;
494
+ }
495
+
496
+ $data = array();
497
+ $data['id'] = $this->get_id();
498
+
499
+ if ( empty( $data['id'] ) ) {
500
+ return false;
501
+ }
502
+
503
+ if ( ! empty( $this->attrs ) ) {
504
+ foreach ( $this->attrs as $key => $value ) {
505
+ $data[ $key ] = $value;
506
+ }
507
+ }
508
+
509
+ $data['language'] = $this->get_language();
510
+
511
+ return $data;
512
+
513
+ }
514
+
515
+ /**
516
+ * If $this->default_language was not set, returns `null`.
517
+ * If the language is equal to the default_language, returns `true`,
518
+ * otherwise it returns `false`.
519
+ *
520
+ * @since 2.2.6
521
+ *
522
+ * @return null|boolean
523
+ */
524
+ public function is_default_language() {
525
+
526
+ if ( empty( $this->default_language ) ) {
527
+ return null;
528
+ }
529
+ if ( $this->language === $this->default_language ) {
530
+ return true;
531
+ }
532
+
533
+ return false;
534
+ }
535
+
536
+ /**
537
+ * Set multilingual fields.
538
+ *
539
+ * @param array $multilingual_fields
540
+ */
541
+ public function set_multilingual_fields( $multilingual_fields ) {
542
+
543
+ if ( ! isset( $this->attrs ) ) {
544
+ return;
545
+ }
546
+
547
+ if ( is_array( $multilingual_fields ) && ! empty( $multilingual_fields ) ) {
548
+ $this->attrs['multilingualFields'] = array_merge( $this->attrs['multilingualFields'], $multilingual_fields );
549
+ }
550
+ }
551
+
552
+ }
553
+
554
+ endif;
trunk/includes/builders/elementor/class-wpglobus-elementor-front.php ADDED
@@ -0,0 +1,353 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * File: class-wpglobus-elementor-front.php
4
+ *
5
+ * @package WPGlobus\Builders\Elementor
6
+ * @author Alex Gor(alexgff)
7
+ */
8
+
9
+ /**
10
+ * @see elementor\core\files\css\post.php
11
+ */
12
+ use Elementor\Core\Files\CSS\Post as Post_CSS;
13
+
14
+ if ( ! class_exists( 'WPGlobus_Elementor_Front' ) ) :
15
+
16
+ /**
17
+ * Class WPGlobus_Elementor_Front.
18
+ */
19
+ class WPGlobus_Elementor_Front {
20
+
21
+ public static $file_prefix = 'post-';
22
+
23
+ /**
24
+ * @since 2.1.15
25
+ */
26
+ protected static $post_css_meta_key = null;
27
+
28
+ /**
29
+ * @since 2.1.15
30
+ */
31
+ protected static $elementor_data_meta_key = null;
32
+
33
+ /**
34
+ * @since 2.1.15
35
+ */
36
+ protected static $elementor_css_meta_key = null;
37
+
38
+ /**
39
+ * Init.
40
+ */
41
+ public static function init($attrs) {
42
+
43
+ if ( ! empty($attrs['post_css_meta_key']) ) {
44
+ self::$post_css_meta_key = $attrs['post_css_meta_key'];
45
+ }
46
+
47
+ if ( ! empty($attrs['elementor_data_meta_key']) ) {
48
+ self::$elementor_data_meta_key = $attrs['elementor_data_meta_key'];
49
+ }
50
+
51
+ if ( ! empty($attrs['elementor_css_meta_key']) ) {
52
+ self::$elementor_css_meta_key = $attrs['elementor_css_meta_key'];
53
+ }
54
+
55
+ add_filter( 'get_post_metadata', array( __CLASS__, 'filter__get_metadata' ), 5, 4 );
56
+
57
+ /**
58
+ * @since 2.1.15
59
+ */
60
+ add_filter( 'update_post_metadata', array( __CLASS__, 'filter__update_metadata' ), 5, 5 );
61
+
62
+ /**
63
+ * @since 2.1.15
64
+ */
65
+ add_action( 'wp_enqueue_scripts', array( __CLASS__, 'on__enqueue_styles' ), 20 );
66
+
67
+ /**
68
+ * @todo may be use elementor action instead of `wp_enqueue_scripts`.
69
+ */
70
+ //add_action( 'elementor/frontend/after_enqueue_styles', array( __CLASS__, 'on__enqueue_styles' ) );
71
+
72
+ /**
73
+ * @since 2.1.13
74
+ * @see elementor\core\files\base.php
75
+ */
76
+ add_action( 'elementor/files/file_name', array( __CLASS__, 'filter__elementor_files_file_name' ), 5, 4 );
77
+
78
+ /**
79
+ * @since 2.2.11
80
+ * @W.I.P
81
+ * @todo maybe we need to use these filters.
82
+ */
83
+ //add_filter( 'elementor/editor/localize_settings', array( __CLASS__, 'filter__localize_settings' ), 10, 2 );
84
+ //add_action( 'elementor/editor/after_enqueue_scripts', array( __CLASS__, 'filter__localize_settings' ) );
85
+
86
+ /**
87
+ * @since 2.3.6
88
+ */
89
+ add_filter( 'wpglobus_plus_publish_template_include_handler', array( __CLASS__, 'filter__template_include_handler' ) );
90
+ }
91
+
92
+ /**
93
+ * @since 2.1.15
94
+ */
95
+ public static function on__enqueue_styles() {
96
+
97
+ if ( WPGlobus::Config()->language == WPGlobus::Config()->default_language ) {
98
+ return;
99
+ }
100
+
101
+ $css_file = new Post_CSS( get_the_ID() );
102
+
103
+ /**
104
+ * @see elementor\core\files\css\post.php
105
+ */
106
+ $handle = 'elementor-post-' . $css_file->get_post_id() .'-' . WPGlobus::Config()->language;
107
+
108
+ /**
109
+ * @see elementor\core\files\base.php
110
+ */
111
+ $url = $css_file->get_url();
112
+
113
+ wp_register_style(
114
+ $handle,
115
+ $url,
116
+ array(),
117
+ 'wpglobus-' . WPGLOBUS_VERSION
118
+
119
+ );
120
+ wp_enqueue_style($handle);
121
+ }
122
+
123
+ /**
124
+ * Filters the file name.
125
+ *
126
+ * @since 2.1.13
127
+ * @since 2.3.3 Handle multiple file names.
128
+ *
129
+ * @param string $file_name CSS file name.
130
+ * @param object $instance The file instance, which inherits Elementor\Core\Files
131
+ */
132
+ public static function filter__elementor_files_file_name( $file_name, $instance ) {
133
+
134
+ if ( WPGlobus::Config()->language == WPGlobus::Config()->default_language ) {
135
+ return $file_name;
136
+ }
137
+
138
+ if ( false === strpos( $file_name, self::$file_prefix ) ) {
139
+ return $file_name;
140
+ }
141
+
142
+ /**
143
+ * @since 2.3.3 @W.I.P May be check out for global post ID.
144
+ */
145
+ //global $post;
146
+ //if ( ! $post instanceof WP_Post ) {
147
+ //return $file_name;
148
+ //}
149
+ //$file_unique_part = str_replace( self::$file_prefix, '', $file_name );
150
+ //if ( false === strpos( $file_unique_part, $post->ID . '.' ) ) {
151
+ //return $file_name;
152
+ //}
153
+
154
+ static $_file_names = null;
155
+
156
+ if ( ! is_null( $_file_names ) && ! empty( $_file_names[$file_name] ) ) {
157
+ return $_file_names[$file_name];
158
+ }
159
+
160
+ $_file_name = $file_name;
161
+ if ( false !== strpos( $file_name, '.css' ) ) {
162
+ $_file_name = str_replace( '.css', '-' . WPGlobus::Config()->language . '.css', $file_name );
163
+ }
164
+
165
+ $_file_names[$file_name] = $_file_name;
166
+
167
+ return $_file_name;
168
+ }
169
+
170
+ /**
171
+ * Get meta callback.
172
+ *
173
+ * @scope front.
174
+ * @param $check
175
+ * @param $object_id
176
+ * @param $meta_key
177
+ * @param $single
178
+ *
179
+ * @return string
180
+ */
181
+ public static function filter__get_metadata(
182
+ $check, $object_id, $meta_key, /** @noinspection PhpUnusedParameterInspection */
183
+ $single
184
+ ) {
185
+
186
+ if ( self::$elementor_data_meta_key === $meta_key ) {
187
+
188
+ $meta_cache = wp_cache_get( $object_id, 'post_meta' );
189
+
190
+ if ( isset( $meta_cache[ $meta_key ] ) && isset( $meta_cache[ $meta_key ][0] ) ) {
191
+
192
+ /** @noinspection PhpUnusedLocalVariableInspection */
193
+ $_value = '';
194
+
195
+ if ( WPGlobus_Core::has_translations( $meta_cache[ $meta_key ][0] ) ) {
196
+ $_value = WPGlobus_Core::text_filter( $meta_cache[ $meta_key ][0], WPGlobus::Config()->language );
197
+ } else {
198
+ $_value = $meta_cache[ $meta_key ][0];
199
+ }
200
+
201
+ return $_value;
202
+
203
+ }
204
+
205
+ } elseif ( self::$elementor_css_meta_key === $meta_key ) {
206
+
207
+ if ( WPGlobus::Config()->language == WPGlobus::Config()->default_language ) {
208
+ return $check;
209
+ }
210
+
211
+ $meta_cache = wp_cache_get( $object_id, 'post_meta' );
212
+
213
+ if ( isset( $meta_cache[ self::$post_css_meta_key ] ) && isset( $meta_cache[ self::$post_css_meta_key ][0] ) ) {
214
+
215
+ $_value = '';
216
+
217
+ $has_translations = WPGlobus_Core::has_translations( $meta_cache[ self::$post_css_meta_key ][0] );
218
+
219
+ if ( $has_translations ) {
220
+ $_value = WPGlobus_Core::text_filter( $meta_cache[ self::$post_css_meta_key ][0], WPGlobus::Config()->language, WPGlobus::RETURN_EMPTY );
221
+ }
222
+
223
+ if ( ! empty($_value) ) {
224
+ $_value = maybe_unserialize( $_value );
225
+
226
+ /**
227
+ * @todo may be better return value for default language.
228
+ */
229
+ //if ( isset( $meta_cache[ self::$elementor_css_meta_key ] ) && isset( $meta_cache[ self::$elementor_css_meta_key ][0] ) ) {
230
+ //$_value = maybe_unserialize( $meta_cache[ self::$elementor_css_meta_key ] );
231
+ //}
232
+ }
233
+
234
+ return $_value;
235
+ }
236
+
237
+ }
238
+
239
+ return $check;
240
+ }
241
+
242
+ /**
243
+ * @since 2.1.15
244
+ */
245
+ public static function filter__update_metadata( $check, $object_id, $meta_key, $meta_value, $prev_value ) {
246
+
247
+ if ( self::$elementor_css_meta_key != $meta_key ) {
248
+ return $check;
249
+ }
250
+
251
+ if ( WPGlobus::Config()->language == WPGlobus::Config()->default_language ) {
252
+ return $check;
253
+ }
254
+
255
+ $meta_cache = wp_cache_get( $object_id, 'post_meta' );
256
+
257
+ if ( isset( $meta_cache[ self::$post_css_meta_key ] ) && isset( $meta_cache[ self::$post_css_meta_key ][0] ) ) {
258
+
259
+ $new_value = $check;
260
+ $_tr = array();
261
+
262
+ foreach( WPGlobus::Config()->enabled_languages as $language ) {
263
+ $_s = WPGlobus_Core::text_filter( $meta_cache[ self::$post_css_meta_key ][0], $language, WPGlobus::RETURN_EMPTY );
264
+ if ( ! empty( $_s ) ) {
265
+ $_tr[$language] = $_s;
266
+ }
267
+ }
268
+
269
+ /**
270
+ * Fix for $meta_value[0].
271
+ */
272
+ $meta_value[0] = '';
273
+
274
+ $_tr[WPGlobus::Config()->language] = maybe_serialize($meta_value);
275
+ $new_value = WPGlobus_Utils::build_multilingual_string($_tr);
276
+
277
+ if ( $new_value != $check ) {
278
+
279
+ global $wpdb;
280
+
281
+ $meta_value = $new_value;
282
+ $table = _get_meta_table('post');
283
+ $data = compact( 'meta_value' );
284
+ $where = array(
285
+ 'post_id' => $object_id,
286
+ 'meta_key' => self::$post_css_meta_key
287
+ );
288
+
289
+ $result = $wpdb->update( $table, $data, $where );
290
+
291
+ if ( ! $result ) {
292
+ return false;
293
+ }
294
+
295
+ }
296
+
297
+ return $new_value;
298
+
299
+ } else {
300
+
301
+ /**
302
+ * $meta_cache[ $meta_key ] is undefined.
303
+ */
304
+
305
+ global $wpdb;
306
+
307
+ $_tr = array();
308
+ $_tr[WPGlobus::Config()->language] = maybe_serialize($meta_value);
309
+ $new_value = WPGlobus_Utils::build_multilingual_string($_tr);
310
+
311
+ $table = _get_meta_table('post');
312
+
313
+ $result = $wpdb->insert(
314
+ $table,
315
+ array(
316
+ 'post_id' => $object_id,
317
+ 'meta_key' => self::$post_css_meta_key,
318
+ 'meta_value' => $new_value
319
+ ),
320
+ array(
321
+ '%d',
322
+ '%s',
323
+ '%s'
324
+ )
325
+ );
326
+
327
+ if ( ! $result ) {
328
+ return false;
329
+ }
330
+
331
+ return $new_value;
332
+ }
333
+
334
+ return $check;
335
+
336
+ }
337
+
338
+ /**
339
+ * @since 2.3.6
340
+ */
341
+ public static function filter__template_include_handler($handler) {
342
+ /**
343
+ * Don't fire `template_include` filter with active Elementor
344
+ * to prevent `The preview could not be loaded` for language in draft status.
345
+ */
346
+ if ( empty( $_GET['elementor-preview'] ) ) {
347
+ return $handler;
348
+ }
349
+ return false;
350
+ }
351
+ } // end class WPGlobus_Elementor_Front.
352
+
353
+ endif;
trunk/includes/builders/elementor/class-wpglobus-elementor-update-post.php ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * File: class-wpglobus-elementor-update-post.php
4
+ *
5
+ * @package WPGlobus\Builders\Elementor
6
+ * @author Alex Gor(alexgff)
7
+ */
8
+
9
+ /**
10
+ * Class WPGlobus_elementor_Update_Post.
11
+ */
12
+ if ( ! class_exists( 'WPGlobus_elementor_Update_Post' ) ) :
13
+
14
+ // phpcs:ignore PEAR.NamingConventions
15
+ class WPGlobus_elementor_Update_Post extends WPGlobus_Builder_Update_Post {
16
+
17
+ /**
18
+ * Constructor.
19
+ */
20
+ public function __construct() {
21
+
22
+ parent::__construct( 'elementor' );
23
+
24
+ /**
25
+ * @see_file wpglobus\includes\class-wpglobus.php
26
+ */
27
+ remove_action( 'wp_insert_post_data', array( 'WPGlobus', 'on_save_post_data' ), 10 );
28
+
29
+ /**
30
+ * @todo incorrect the saving post in extra languages with priority = 10
31
+ */
32
+ add_filter( 'wp_insert_post_data', array( $this, 'filter__wp_insert_post_data' ), 100, 2 );
33
+
34
+ }
35
+
36
+ /**
37
+ * Callback for 'wp_insert_post_data'.
38
+ *
39
+ * @param array $data
40
+ * @param array $postarr
41
+ *
42
+ * @return mixed
43
+ */
44
+ public function filter__wp_insert_post_data( $data, $postarr ) {
45
+
46
+ /**
47
+ * Prevent to filter disabled post type.
48
+ *
49
+ * @since 2.1.4
50
+ */
51
+ if ( in_array( $data['post_type'], WPGlobus::Config()->disabled_entities, true ) ) {
52
+ return $data;
53
+ }
54
+
55
+ global $wpdb;
56
+ $_post = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->posts WHERE ID = %d AND post_type = %s LIMIT 1", $postarr['ID'], $postarr['post_type'] ) );
57
+
58
+ $fields = array();
59
+ if ( isset( $postarr['post_title'] ) ) {
60
+ $fields['post_title'] = $postarr['post_title'];
61
+ }
62
+
63
+ if ( isset( $postarr['post_content'] ) ) {
64
+ $fields['post_content'] = $postarr['post_content'];
65
+ }
66
+
67
+ if ( isset( $postarr['post_excerpt'] ) ) {
68
+ $fields['post_excerpt'] = $postarr['post_excerpt'];
69
+ }
70
+
71
+ $builder_language = WPGlobus::Config()->builder->get_language();
72
+
73
+ if ( empty( $builder_language ) ) {
74
+
75
+ if ( empty( $postarr[ WPGlobus::get_language_meta_key() ] ) ) {
76
+ $builder_language = WPGlobus::Config()->default_language;
77
+ } else {
78
+ $builder_language = $postarr[ WPGlobus::get_language_meta_key() ];
79
+ }
80
+ }
81
+
82
+ foreach ( $fields as $field => $value ) {
83
+
84
+ $tr = array();
85
+
86
+ foreach ( WPGlobus::Config()->enabled_languages as $lang ) :
87
+
88
+ if ( $lang === $builder_language ) {
89
+
90
+ $text = $value;
91
+ if ( WPGlobus_Core::has_translations( $value ) ) {
92
+ $text = WPGlobus_Core::text_filter( $value, $lang, WPGlobus::RETURN_EMPTY );
93
+ }
94
+ if ( ! empty( $text ) ) {
95
+ $tr[ $lang ] = $text;
96
+ }
97
+ } else {
98
+ if ( isset( $_post->$field ) ) {
99
+ $text = WPGlobus_Core::text_filter( $_post->$field, $lang, WPGlobus::RETURN_EMPTY );
100
+ if ( ! empty( $text ) ) {
101
+ $tr[ $lang ] = $text;
102
+ }
103
+ }
104
+ }
105
+
106
+ endforeach;
107
+
108
+ $data[ $field ] = WPGlobus_Utils::build_multilingual_string( $tr );
109
+
110
+ }
111
+
112
+ return $data;
113
+
114
+ }
115
+
116
+ }
117
+
118
+ endif;
trunk/includes/builders/elementor/class-wpglobus-elementor.php ADDED
@@ -0,0 +1,483 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * File: class-wpglobus-elementor.php
4
+ *
5
+ * @since 2.2.31 We are providing support for `External File` only. @see elementor\core\files\css\base.php::use_external_file().
6
+ *
7
+ * @package WPGlobus\Builders\Elementor
8
+ * @author Alex Gor(alexgff)
9
+ */
10
+
11
+ if ( file_exists( WP_PLUGIN_DIR . '/elementor/core/files/manager.php' ) ) {
12
+ require_once( WP_PLUGIN_DIR . '/elementor/core/files/manager.php' );
13
+ }
14
+
15
+ if ( ! class_exists( 'WPGlobus_Elementor' ) ) :
16
+
17
+ /**
18
+ * Class WPGlobus_Elementor.
19
+ */
20
+ class WPGlobus_Elementor extends WPGlobus_Builder {
21
+
22
+ protected $base_redirect_url = '';
23
+
24
+ protected $post_content = null;
25
+
26
+ /**
27
+ * @since 2.1.15
28
+ */
29
+ protected static $post_css_meta_key = null;
30
+
31
+ /**
32
+ * @since 2.1.15
33
+ */
34
+ protected static $elementor_data_meta_key = null;
35
+
36
+ /**
37
+ * Constructor.
38
+ */
39
+ public function __construct() {
40
+
41
+ parent::__construct( 'elementor' );
42
+
43
+ $_post_css_meta_key = WPGlobus::Config()->builder->get('post_css_meta_key');
44
+ if ( ! empty( $_post_css_meta_key ) ) {
45
+ self::$post_css_meta_key = $_post_css_meta_key;
46
+ }
47
+
48
+ $_elementor_data_meta_key = WPGlobus::Config()->builder->get('elementor_data_meta_key');
49
+ if ( ! empty( $_elementor_data_meta_key ) ) {
50
+ self::$elementor_data_meta_key = $_elementor_data_meta_key;
51
+ }
52
+
53
+ if ( isset( $_GET['action'] ) && 'elementor' === $_GET['action'] ) { // phpcs:ignore WordPress.CSRF.NonceVerification
54
+ /**
55
+ * @see wp-includes/revision.php
56
+ */
57
+ $post_id = $_GET['post']; // phpcs:ignore WordPress.CSRF.NonceVerification
58
+ if ( (int) $post_id > 0 ) {
59
+ $revision = wp_get_post_autosave( $post_id );
60
+ if ( is_object( $revision ) ) {
61
+ wp_delete_post_revision( $revision->ID );
62
+ }
63
+ }
64
+ }
65
+
66
+ /**
67
+ * @see_file wpglobus\includes\class-wpglobus.php
68
+ * @todo remove after test.
69
+ */
70
+ remove_action( 'wp_insert_post_data', array( 'WPGlobus', 'on_save_post_data' ), 10 );
71
+
72
+ add_filter( 'get_post_metadata', array( $this, 'filter__post_metadata' ), 13, 4 );
73
+
74
+ // @todo may be need this filter for admin, @see includes\builders\elementor\class-wpglobus-elementor-front.php
75
+ //add_filter( 'update_post_metadata', array( $this, 'filter__update_metadata' ), 5, 5 );
76
+
77
+ /**
78
+ * Elementor editor footer.
79
+ *
80
+ * @see_file elementor\includes\editor.php
81
+ */
82
+ add_action( 'elementor/editor/footer', array( $this, 'on__elementor_footer' ), 100 );
83
+
84
+ /**
85
+ * @since 2.2.11
86
+ * @W.I.P
87
+ * @see meta classic-editor-remember = block-editor OR classic-editor
88
+ * @todo maybe to use `wp_footer` action instead of `elementor/editor/footer`.
89
+ */
90
+ //add_action( 'wp_footer', array( $this, 'on__elementor_footer' ), 100 );
91
+
92
+ /**
93
+ * @since 2.2.11
94
+ * @W.I.P
95
+ * @todo maybe useful
96
+ */
97
+ //add_filter( 'elementor/editor/localize_settings', array( $this, 'on__localize_settings' ), 10, 2 );
98
+ //add_action( 'elementor/editor/after_enqueue_scripts', array( $this, 'on__localize_settings' ) );
99
+
100
+ /**
101
+ * AJAX handling.
102
+ */
103
+ if ( defined('DOING_AJAX') && DOING_AJAX ) {
104
+ if ( 'elementor_ajax' == $_POST['action'] && false !== strpos($_POST['actions'], '"action":"save_builder"') ) {
105
+ if ( class_exists( '\Elementor\Core\Files\Manager' ) ) {
106
+ /**
107
+ * Clear Elementor cache and WPGlobus css meta.
108
+ * @since 2.1.15
109
+ */
110
+ $_fm = new \Elementor\Core\Files\Manager;
111
+ $_fm->clear_cache();
112
+ if ( ! is_null(self::$post_css_meta_key) ) {
113
+ update_post_meta( WPGlobus::Config()->builder->get('post_id'), self::$post_css_meta_key, '' );
114
+ }
115
+ }
116
+ }
117
+ }
118
+
119
+ if ( is_admin() ) {
120
+
121
+ /**
122
+ * @since 2.2.31
123
+ */
124
+ add_action( 'admin_notices', array( $this, 'on__admin_notice' ) );
125
+
126
+ add_filter( 'the_post', array( $this, 'filter__the_post' ), 5 );
127
+
128
+ /**
129
+ * @see_file elementor\core\base\document.php
130
+ */
131
+ add_filter( 'elementor/document/urls/edit', array( $this, 'filter__url' ), 5, 2 );
132
+
133
+ /**
134
+ * @see_file elementor\core\base\document.php
135
+ */
136
+ add_filter( 'elementor/document/urls/exit_to_dashboard', array( $this, 'filter__url' ), 5, 2 );
137
+
138
+ /**
139
+ * Filter Preview Button link in elementor side panel.
140
+ *
141
+ * @see_file elementor\core\base\document.php
142
+ */
143
+ add_filter( 'elementor/document/urls/wp_preview', array( $this, 'filter__preview_url' ), 5, 2 );
144
+
145
+ /**
146
+ * Filter for URL in elementor-preview-iframe.
147
+ *
148
+ * @see_file elementor\core\base\document.php
149
+ */
150
+ add_filter( 'elementor/document/urls/preview', array( $this, 'filter__preview_url' ), 5, 2 );
151
+
152
+ /**
153
+ * Filters the editor localized settings.
154
+ *
155
+ * @since 2.2.6
156
+ *
157
+ * @see_file elementor\includes\editor.php
158
+ */
159
+ add_filter( 'elementor/editor/localize_settings', array( $this, 'filter__localize_settings' ), 5, 2 );
160
+
161
+ }
162
+
163
+ }
164
+
165
+ /**
166
+ * Localize editor settings.
167
+ *
168
+ * Filters the editor localized settings.
169
+ *
170
+ * @since 2.2.6
171
+ *
172
+ * @param array $localized_settings Localized settings.
173
+ * @param int $post_id The ID of the current post being edited.
174
+ *
175
+ * @return array
176
+ */
177
+ public function filter__localize_settings( $localized_settings, $post_id ) {
178
+
179
+ if ( WPGlobus::Config()->builder->is_default_language() ) {
180
+ return $localized_settings;
181
+ }
182
+
183
+ /**
184
+ * @since 2.2.31
185
+ */
186
+ if ( 'external' !== WPGlobus::Config()->builder->get('elementor_css_print_method') ) {
187
+ return $localized_settings;
188
+ }
189
+
190
+ $url = get_permalink( $post_id );
191
+
192
+ $localized_settings['document']['urls']['permalink'] = WPGlobus_Utils::localize_url( $url, WPGlobus::Config()->builder->get_language() );
193
+
194
+ return $localized_settings;
195
+ }
196
+
197
+ /**
198
+ * To avoid output content with language marks from $post->post_content field on elementor builder page
199
+ * if "_elementor_data" meta has not content in extra language.
200
+ *
201
+ * @param WP_Post $object
202
+ *
203
+ * @return WP_Post
204
+ */
205
+ public function filter__the_post( $object ) {
206
+
207
+ if ( 'post.php' !== WPGlobus::Config()->builder->get( 'pagenow' ) ) {
208
+ return $object;
209
+ }
210
+
211
+ if ( is_null( $this->post_content ) ) {
212
+ $this->post_content = $object->post_content;
213
+ }
214
+
215
+ $_post = clone( $object );
216
+ $_post->post_content = WPGlobus_Core::text_filter( $this->post_content, WPGlobus::Config()->builder->get_language(), WPGlobus::RETURN_EMPTY );
217
+
218
+ /**
219
+ * @see \wp-includes\cache.php
220
+ */
221
+ wp_cache_replace( $object->ID, $_post, 'posts' );
222
+
223
+ return $object;
224
+
225
+ }
226
+
227
+ /**
228
+ * @todo W.I.P
229
+ */
230
+ public static function filter__update_metadata( $check, $object_id, $meta_key, $meta_value, $prev_value ) {
231
+ if ( '_elementor_css' != $meta_key ) {
232
+ return $check;
233
+ }
234
+ return $check;
235
+ }
236
+
237
+ /**
238
+ * Get meta callback.
239
+ *
240
+ * @param $check
241
+ * @param $object_id
242
+ * @param $meta_key
243
+ * @param $single
244
+ *
245
+ * @return string
246
+ */
247
+ public static function filter__post_metadata(
248
+ $check, $object_id, $meta_key, /** @noinspection PhpUnusedParameterInspection */
249
+ $single
250
+ ) {
251
+
252
+ if ( self::$elementor_data_meta_key === $meta_key ) {
253
+
254
+ $meta_cache = wp_cache_get( $object_id, 'post_meta' );
255
+
256
+ if ( is_admin() ) {
257
+
258
+ if ( isset( $meta_cache[ $meta_key ] ) && isset( $meta_cache[ $meta_key ][0] ) ) {
259
+
260
+ $_value = '';
261
+
262
+ if ( WPGlobus_Core::has_translations( $meta_cache[ $meta_key ][0] ) ) {
263
+ $_value = WPGlobus_Core::text_filter( $meta_cache[ $meta_key ][0], WPGlobus::Config()->builder->get_language() );
264
+ } else {
265
+ $_value = $meta_cache[ $meta_key ][0];
266
+ }
267
+
268
+ return $_value;
269
+
270
+ }
271
+ } else {
272
+
273
+ /**
274
+ * scope front.
275
+ */
276
+
277
+ if ( isset( $meta_cache[ $meta_key ] ) && isset( $meta_cache[ $meta_key ][0] ) ) {
278
+
279
+ /** @noinspection PhpUnusedLocalVariableInspection */
280
+ $_value = '';
281
+
282
+ if ( WPGlobus_Core::has_translations( $meta_cache[ $meta_key ][0] ) ) {
283
+ //$_value = WPGlobus_Core::text_filter( $meta_cache[ $meta_key ][0], WPGlobus::Config()->builder->get_language(), WPGlobus::RETURN_EMPTY );
284
+ /**
285
+ * We can get current language from WPGlobus::Config().
286
+ *
287
+ * @todo just for testing purposes.
288
+ */
289
+ //$_value = WPGlobus_Core::text_filter( $meta_cache[ $meta_key ][0], WPGlobus::Config()->language );
290
+
291
+ $_value = WPGlobus_Core::text_filter( $meta_cache[ $meta_key ][0], WPGlobus::Config()->builder->get_language() );
292
+ } else {
293
+ $_value = $meta_cache[ $meta_key ][0];
294
+ }
295
+
296
+ return $_value;
297
+
298
+ }
299
+ }
300
+ }
301
+
302
+ return $check;
303
+
304
+ }
305
+
306
+ /**
307
+ * Elementor editor footer.
308
+ *
309
+ * Fires on Elementor editor before closing the body tag.
310
+ * Used to prints scripts or any other HTML before closing the body tag.
311
+ */
312
+ public function on__elementor_footer() {
313
+
314
+ /**
315
+ * @since 2.2.31
316
+ */
317
+ if ( 'external' != WPGlobus::Config()->builder->get('elementor_css_print_method') ) {
318
+ return;
319
+ }
320
+
321
+ $this->base_redirect_url = str_replace( array( '&language=' . WPGlobus::Config()->builder->get_language() ), '', $this->base_redirect_url );
322
+ $this->base_redirect_url = str_replace( '&action=edit', '&action=elementor', $this->base_redirect_url );
323
+ ?>
324
+ <div id="wpglobus-elementor-wrapper">
325
+ <div class="elementor-panel-menu-item" id="wpglobus-elementor-panel-menu-item" style="cursor:auto;">
326
+ <div class="elementor-panel-menu-item-icon">
327
+ <i class="fa fa-globe"></i>
328
+ </div>
329
+ <div class="elementor-panel-menu-item-title" id="wpglobus-elementor-selector-box"
330
+ style="padding-top:0;">
331
+ <span id="wpglobus-elementor-selector-title"
332
+ style="cursor:pointer;"><?php esc_html_e( 'WPGlobus languages', 'wpglobus' ); ?></span>
333
+ <ul id="wpglobus-elementor-selector" style="display:none;margin:10px;" class="hidden">
334
+ <?php
335
+ foreach ( WPGlobus::Config()->enabled_languages as $language ) {
336
+ $_current = '';
337
+ if ( $language == WPGlobus::Config()->builder->get_language() ) {
338
+ $_current = esc_html__( 'current', 'wpglobus' );
339
+ $_current = ' - ' . $_current;
340
+ }
341
+ ?>
342
+ <li style="margin-bottom:10px;cursor:auto;">
343
+ <a href="<?php echo esc_url( $this->base_redirect_url . '&language=' . $language ); ?>"><?php echo esc_html( WPGlobus::Config()->en_language_name[ $language ] . " ($language)" ); echo $_current; ?></a>
344
+ </li>
345
+ <?php
346
+ }
347
+ ?>
348
+ </ul>
349
+ </div>
350
+ </div>
351
+ </div>
352
+ <?php // phpcs:disable ?>
353
+ <script type='text/javascript'>
354
+ /* <![CDATA[ */
355
+ var WPGlobusTimeID;
356
+ WPGlobusTimeID = setInterval(function(){
357
+ if ( jQuery("#elementor-panel-header-menu-button").length === 0 ) {
358
+ return;
359
+ }
360
+ clearInterval(WPGlobusTimeID);
361
+ var wpglobusElementorPanelMenu = jQuery("#wpglobus-elementor-wrapper").html();
362
+ jQuery(document).on('click', "#elementor-panel-header-menu-button", function () {
363
+ jQuery(".elementor-panel-menu-item").eq(7).after(wpglobusElementorPanelMenu);
364
+ });
365
+ jQuery(document).on('click', "#wpglobus-elementor-selector-title", function () {
366
+ var $t = jQuery("#wpglobus-elementor-selector");
367
+ $t.toggleClass('hidden');
368
+ if ($t.hasClass('hidden')) {
369
+ $t.css({'display': 'none'});
370
+ jQuery('#wpglobus-elementor-selector-box').css({'padding-top': '0'});
371
+ } else {
372
+ jQuery('#wpglobus-elementor-selector-box').css({'padding-top': '10px'});
373
+ $t.css({'display': 'block'});
374
+ }
375
+ });
376
+ }, 500);
377
+ /* ]]> */
378
+ </script>
379
+ <?php // phpcs:enable ?>
380
+ <?php
381
+ }
382
+
383
+ /**
384
+ * Document edit url.
385
+ *
386
+ * Filters the document edit url.
387
+ *
388
+ * @param string $url The edit url.
389
+ * @param mixed $instance The document instance.
390
+ *
391
+ * @return string
392
+ */
393
+ public function filter__url(
394
+ $url,
395
+ /**
396
+ * Unused.
397
+ *
398
+ * @noinspection PhpUnusedParameterInspection
399
+ */
400
+ $instance
401
+ ) {
402
+
403
+ if ( 'external' === WPGlobus::Config()->builder->get('elementor_css_print_method') ) {
404
+ if ( false === strpos( $url, 'language' ) ) {
405
+ $url = $url . '&language=' . WPGlobus::Config()->builder->get_language();
406
+ }
407
+ } else {
408
+ if ( false === strpos( $url, 'language' ) ) {
409
+ $url = $url . '&language=' . WPGlobus::Config()->default_language;
410
+ }
411
+ }
412
+
413
+ $this->base_redirect_url = $url;
414
+
415
+ return $url;
416
+ }
417
+
418
+ /**
419
+ * Document "WordPress preview" URL.
420
+ *
421
+ * Filters the WordPress preview URL.
422
+ *
423
+ * @param string $url WordPress preview URL.
424
+ * @param mixed $instance The document instance.
425
+ *
426
+ * @return string
427
+ */
428
+ public function filter__preview_url(
429
+ $url,
430
+ /**
431
+ * Unused.
432
+ *
433
+ * @noinspection PhpUnusedParameterInspection
434
+ */
435
+ $instance
436
+ ) {
437
+ /**
438
+ * @since 2.2.31
439
+ */
440
+ if ( 'external' !== WPGlobus::Config()->builder->get('elementor_css_print_method') ) {
441
+ return $url;
442
+ }
443
+
444
+ $url = WPGlobus_Utils::localize_url( $url, WPGlobus::Config()->builder->get_language() );
445
+
446
+ return $url;
447
+ }
448
+
449
+ /**
450
+ * Prints admin screen notices.
451
+ *
452
+ * @since 2.2.31
453
+ */
454
+ public function on__admin_notice() {
455
+
456
+ if ( 'post.php' != WPGlobus::Config()->builder->get('pagenow') ) {
457
+ return;
458
+ }
459
+
460
+ if ( 'external' == WPGlobus::Config()->builder->get('elementor_css_print_method') ) {
461
+ return;
462
+ }
463
+
464
+ $_url = add_query_arg(
465
+ array(
466
+ 'page' => 'elementor#tab-advanced',
467
+ ),
468
+ admin_url( 'admin.php' )
469
+ );
470
+
471
+ echo '<div class="notice error"><p>';
472
+ printf(
473
+ esc_html__( 'WPGlobus provides multilingual support for Elementor only when the option %1$s%2$s%3$s is set to %4$s.', 'wpglobus' ),
474
+ '<a href="'.$_url.'" target="_blank">',
475
+ '<strong>CSS Print Method</strong>',
476
+ '</a>',
477
+ '<strong>External File</strong>'
478
+ );
479
+ echo '</p></div>';
480
+ }
481
+ }
482
+
483
+ endif;
trunk/includes/builders/elementor/readme.txt ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ /**
2
+ * File: readme.txt
3
+ *
4
+ * @package WPGlobus\Builders\Elementor
5
+ * @author Alex Gor(alexgff)
6
+ */
7
+
8
+ The handling of post meta fields @see wpglobus\configs\elementor.json
trunk/includes/builders/gutenberg/assets/css/dist/wpglobus-block-editor.css ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ .edit-post-pinned-plugins .components-icon-button.is-toggled svg.dashicons-admin-site,.edit-post-pinned-plugins .components-icon-button.is-toggled svg.dashicons-admin-site *{fill:#0000ff !important;display:none}.edit-post-pinned-plugins .components-icon-button:not(.is-toggled) svg.dashicons-admin-site,.edit-post-pinned-plugins .components-icon-button:not(.is-toggled) svg.dashicons-admin-site *{fill:#0000ff;display:none}.edit-post-pinned-plugins .wpglobus-switcher-button{border-color:#cccccc;border-radius:3px}.wpglobus-block-editor-panel__notice{border-left:0}.wpglobus-block-editor-panel__notice .components-notice__content{margin-top:0;margin-bottom:0;color:#000;font-weight:500}.edit-post-layout .wpglobus-block-editor-panel__notice.components-notice{min-height:0}.edit-post-layout .wpglobus-block-editor-panel__settings-link{float:right;margin-bottom:10px}.edit-post-layout .wpglobus-block-editor-panel__info{float:left;margin-bottom:10px}.edit-post-layout .wpglobus-block-editor-panel__flag{vertical-align:middle}
2
+
3
+ /*# sourceMappingURL=wpglobus-block-editor.css.map */
trunk/includes/builders/gutenberg/assets/css/dist/wpglobus-block-editor.css.map ADDED
@@ -0,0 +1 @@
 
1
+ {"version":3,"sources":["wpglobus-block-editor.scss"],"names":[],"mappings":"AAAA,8KAEE,uBAAwB,CACxB,YAAa,CACd,0LAIC,YAAa,CACb,YAAa,CACd,oDAGC,oBAAqB,CACrB,iBAAkB,CACnB,qCAGC,aAAc,CACf,iEAGC,YAAa,CACb,eAAgB,CAChB,UAAW,CACX,eAAgB,CACjB,yEAGC,YAAa,CACd,8DAGC,WAAY,CACZ,kBAAmB,CACpB,qDAGC,UAAW,CACX,kBAAmB,CACpB,qDAGC,qBAAsB","file":"wpglobus-block-editor.css"}
trunk/includes/builders/gutenberg/assets/css/dist/wpglobus-block-editor.scss ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .edit-post-pinned-plugins .components-icon-button.is-toggled svg.dashicons-admin-site,
2
+ .edit-post-pinned-plugins .components-icon-button.is-toggled svg.dashicons-admin-site * {
3
+ fill: #0000ff !important;
4
+ display: none;
5
+ }
6
+
7
+ .edit-post-pinned-plugins .components-icon-button:not(.is-toggled) svg.dashicons-admin-site,
8
+ .edit-post-pinned-plugins .components-icon-button:not(.is-toggled) svg.dashicons-admin-site * {
9
+ fill: #0000ff;
10
+ display: none;
11
+ }
12
+
13
+ .edit-post-pinned-plugins .wpglobus-switcher-button {
14
+ border-color: #cccccc;
15
+ border-radius: 3px;
16
+ }
17
+
18
+ .wpglobus-block-editor-panel__notice {
19
+ border-left: 0;
20
+ }
21
+
22
+ .wpglobus-block-editor-panel__notice .components-notice__content {
23
+ margin-top: 0;
24
+ margin-bottom: 0;
25
+ color: #000;
26
+ font-weight: 500;
27
+ }
28
+
29
+ .edit-post-layout .wpglobus-block-editor-panel__notice.components-notice {
30
+ min-height: 0;
31
+ }
32
+
33
+ .edit-post-layout .wpglobus-block-editor-panel__settings-link {
34
+ float: right;
35
+ margin-bottom: 10px;
36
+ }
37
+
38
+ .edit-post-layout .wpglobus-block-editor-panel__info {
39
+ float: left;
40
+ margin-bottom: 10px;
41
+ }
42
+
43
+ .edit-post-layout .wpglobus-block-editor-panel__flag {
44
+ vertical-align: middle;
45
+ }
trunk/includes/builders/gutenberg/assets/css/dist/wpglobus-switcher.css ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .edit-post-pinned-plugins .components-icon-button.is-toggled svg.dashicons-admin-site,
2
+ .edit-post-pinned-plugins .components-icon-button.is-toggled svg.dashicons-admin-site *{fill:#0000ff !important;display:none}
3
+ .edit-post-pinned-plugins .components-icon-button:not(.is-toggled) svg.dashicons-admin-site,
4
+ .edit-post-pinned-plugins .components-icon-button:not(.is-toggled) svg.dashicons-admin-site *{fill:#0000ff;display:none}
5
+ .edit-post-pinned-plugins .wpglobus-switcher-button{border-color:#cccccc;border-radius:3px}
6
+ .edit-post-layout .wpglobus-switcher-panel__notice.components-notice{min-height:0}
7
+ .edit-post-layout .wpglobus-switcher-panel__settings-link{float:right;margin-bottom:10px}
8
+ .edit-post-layout .wpglobus-switcher-panel__info{float:left;margin-bottom:10px}
9
+ .edit-post-layout .wpglobus-switcher-panel__flag{vertical-align:middle}
10
+ .wpglobus-switcher-panel__notice{border-left:0}
11
+ .wpglobus-switcher-panel__notice .components-notice__content{margin-top:0;margin-bottom:0;color:#000;font-weight:500}
12
+ .wpglobus-switcher-panel__body .components-base-control__help{margin-top:10px}
13
+ .wpglobus-switcher-panel__body.is-opened{padding-top:0}
14
+ .wpglobus-switcher-components-panel .wpglobus-switcher-message {
15
+ z-index:10;width:90%;position:absolute;border:2px solid #ff8100;margin:5px 10px;padding:5px;border-radius:6px;background-color:#ff8100;
16
+ font-size:14px;color:#000;font-weight:500;text-align:center;
17
+ }
18
+ .wpglobus-switcher-pulsate-radio-on {
19
+ -webkit-animation: pulsate-radio-on 0.3s ease-in-out both;
20
+ animation: pulsate-radio-on 0.3s ease-in-out both;
21
+ }
22
+ .wpglobus-switcher-pulsate-radio-off {
23
+ -webkit-animation: pulsate-radio-off 0.3s ease-in-out both;
24
+ animation: pulsate-radio-off 0.3s ease-in-out both;
25
+ }
26
+ .wpglobus-switcher-pulsate-radio {
27
+ -webkit-animation: pulsate-radio 0.5s ease-in-out infinite both;
28
+ animation: pulsate-radio 0.5s ease-in-out infinite both;
29
+ }
30
+ /** animation pulsate-radio-on */
31
+ @-webkit-keyframes pulsate-radio-on {
32
+ 0% {
33
+ -webkit-transform: scale(0);
34
+ transform: scale(0);
35
+ }
36
+ 50% {
37
+ -webkit-transform: scale(0.7);
38
+ transform: scale(0.7);
39
+ }
40
+ 100% {
41
+ -webkit-transform: scale(1.1);
42
+ transform: scale(1.1);
43
+ }
44
+ }
45
+ @keyframes pulsate-radio-on {
46
+ 0% {
47
+ -webkit-transform: scale(0);
48
+ transform: scale(0);
49
+ }
50
+ 50% {
51
+ -webkit-transform: scale(0.7);
52
+ transform: scale(0.7);
53
+ }
54
+ 100% {
55
+ -webkit-transform: scale(1.1);
56
+ transform: scale(1.1);
57
+ }
58
+ }
59
+ /** animation pulsate-radio-off */
60
+ @-webkit-keyframes pulsate-radio-off {
61
+ 0% {
62
+ -webkit-transform: scale(1.1);
63
+ transform: scale(1.1);
64
+ }
65
+ 50% {
66
+ -webkit-transform: scale(0.7);
67
+ transform: scale(0.7);
68
+ }
69
+ 100% {
70
+ -webkit-transform: scale(0);
71
+ transform: scale(0);
72
+ }
73
+ }
74
+ @keyframes pulsate-radio-off {
75
+ 0% {
76
+ -webkit-transform: scale(1.1);
77
+ transform: scale(1.1);
78
+ }
79
+ 50% {
80
+ -webkit-transform: scale(0.7);
81
+ transform: scale(0.7);
82
+ }
83
+ 100% {
84
+ -webkit-transform: scale(0);
85
+ transform: scale(0);
86
+ }
87
+ }
88
+ /** animation pulsate-radio */
89
+ @-webkit-keyframes pulsate-radio {
90
+ 0% {
91
+ -webkit-transform: scale(1.1);
92
+ transform: scale(1.1);
93
+ }
94
+ 50% {
95
+ -webkit-transform: scale(0.7);
96
+ transform: scale(0.7);
97
+ }
98
+ 100% {
99
+ -webkit-transform: scale(1.1);
100
+ transform: scale(1.1);
101
+ }
102
+ }
103
+ @keyframes pulsate-radio {
104
+ 0% {
105
+ -webkit-transform: scale(1.1);
106
+ transform: scale(1.1);
107
+ }
108
+ 50% {
109
+ -webkit-transform: scale(0.7);
110
+ transform: scale(0.7);
111
+ }
112
+ 100% {
113
+ -webkit-transform: scale(1.1);
114
+ transform: scale(1.1);
115
+ }
116
+ }
trunk/includes/builders/gutenberg/assets/css/wpglobus-gutenberg.css ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ .wpglobus-selector-grid{display:grid;grid-template-columns:40% 60%;place-items:center;grid-gap:0}.wpglobus-selector-grid .wpglobus-gutenberg-selector-column-2{width:90px}.wpglobus-gutenberg-selector-box{margin-left:220px}@media screen and (max-width: 599px){.wpglobus-gutenberg-selector-box{margin-left:40px}}@media screen and (max-width: 700px){.wpglobus-gutenberg-selector-column-1{height:25px;width:25px}.wpglobus-gutenberg-selector-column-2{display:none}}
2
+
3
+ /*# sourceMappingURL=wpglobus-gutenberg.css.map */
trunk/includes/builders/gutenberg/assets/css/wpglobus-gutenberg.css.map ADDED
@@ -0,0 +1 @@
 
1
+ {"version":3,"sources":["wpglobus-gutenberg.scss"],"names":[],"mappings":"AAAA,wBACE,YAAa,CACb,6BAA8B,CAC9B,kBAAmB,CACnB,UAAW,CACZ,8DAGC,UAAW,CACZ,iCAGC,iBAAkB,CACnB,qCAGC,iCACE,gBAAiB,CAClB,CAGH,qCACE,sCACE,WAAY,CACZ,UAAW,CACZ,sCAEC,YAAa,CACd","file":"wpglobus-gutenberg.css"}
trunk/includes/builders/gutenberg/assets/css/wpglobus-gutenberg.scss ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .wpglobus-selector-grid {
2
+ display: grid;
3
+ grid-template-columns: 40% 60%;
4
+ place-items: center;
5
+ grid-gap: 0;
6
+ }
7
+
8
+ .wpglobus-selector-grid .wpglobus-gutenberg-selector-column-2 {
9
+ width: 90px;
10
+ }
11
+
12
+ .wpglobus-gutenberg-selector-box {
13
+ margin-left: 220px;
14
+ }
15
+
16
+ @media screen and (max-width: 599px) {
17
+ .wpglobus-gutenberg-selector-box {
18
+ margin-left: 40px;
19
+ }
20
+ }
21
+
22
+ @media screen and (max-width: 700px) {
23
+ .wpglobus-gutenberg-selector-column-1 {
24
+ height: 25px;
25
+ width: 25px;
26
+ }
27
+ .wpglobus-gutenberg-selector-column-2 {
28
+ display: none;
29
+ }
30
+ }
trunk/includes/builders/gutenberg/assets/js/dist/wpglobus-block-editor.js ADDED
@@ -0,0 +1,607 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /******/ (function(modules) { // webpackBootstrap
2
+ /******/ // The module cache
3
+ /******/ var installedModules = {};
4
+ /******/
5
+ /******/ // The require function
6
+ /******/ function __webpack_require__(moduleId) {
7
+ /******/
8
+ /******/ // Check if module is in cache
9
+ /******/ if(installedModules[moduleId]) {
10
+ /******/ return installedModules[moduleId].exports;
11
+ /******/ }
12
+ /******/ // Create a new module (and put it into the cache)
13
+ /******/ var module = installedModules[moduleId] = {
14
+ /******/ i: moduleId,
15
+ /******/ l: false,
16
+ /******/ exports: {}
17
+ /******/ };
18
+ /******/
19
+ /******/ // Execute the module function
20
+ /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
21
+ /******/
22
+ /******/ // Flag the module as loaded
23
+ /******/ module.l = true;
24
+ /******/
25
+ /******/ // Return the exports of the module
26
+ /******/ return module.exports;
27
+ /******/ }
28
+ /******/
29
+ /******/
30
+ /******/ // expose the modules object (__webpack_modules__)
31
+ /******/ __webpack_require__.m = modules;
32
+ /******/
33
+ /******/ // expose the module cache
34
+ /******/ __webpack_require__.c = installedModules;
35
+ /******/
36
+ /******/ // define getter function for harmony exports
37
+ /******/ __webpack_require__.d = function(exports, name, getter) {
38
+ /******/ if(!__webpack_require__.o(exports, name)) {
39
+ /******/ Object.defineProperty(exports, name, {
40
+ /******/ configurable: false,
41
+ /******/ enumerable: true,
42
+ /******/ get: getter
43
+ /******/ });
44
+ /******/ }
45
+ /******/ };
46
+ /******/
47
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
48
+ /******/ __webpack_require__.n = function(module) {
49
+ /******/ var getter = module && module.__esModule ?
50
+ /******/ function getDefault() { return module['default']; } :
51
+ /******/ function getModuleExports() { return module; };
52
+ /******/ __webpack_require__.d(getter, 'a', getter);
53
+ /******/ return getter;
54
+ /******/ };
55
+ /******/
56
+ /******/ // Object.prototype.hasOwnProperty.call
57
+ /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
58
+ /******/
59
+ /******/ // __webpack_public_path__
60
+ /******/ __webpack_require__.p = "";
61
+ /******/
62
+ /******/ // Load entry module and return exports
63
+ /******/ return __webpack_require__(__webpack_require__.s = 41);
64
+ /******/ })
65
+ /************************************************************************/
66
+ /******/ ([
67
+ /* 0 */
68
+ /***/ (function(module, exports) {
69
+
70
+ eval("var core = module.exports = { version: '2.6.5' };\nif (typeof __e == 'number') __e = core; // eslint-disable-line no-undef\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMC5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy8uL25vZGVfbW9kdWxlcy9jb3JlLWpzL2xpYnJhcnkvbW9kdWxlcy9fY29yZS5qcz8xNWUwIl0sInNvdXJjZXNDb250ZW50IjpbInZhciBjb3JlID0gbW9kdWxlLmV4cG9ydHMgPSB7IHZlcnNpb246ICcyLjYuNScgfTtcbmlmICh0eXBlb2YgX19lID09ICdudW1iZXInKSBfX2UgPSBjb3JlOyAvLyBlc2xpbnQtZGlzYWJsZS1saW5lIG5vLXVuZGVmXG5cblxuXG4vLy8vLy8vLy8vLy8vLy8vLy9cbi8vIFdFQlBBQ0sgRk9PVEVSXG4vLyAuL25vZGVfbW9kdWxlcy9jb3JlLWpzL2xpYnJhcnkvbW9kdWxlcy9fY29yZS5qc1xuLy8gbW9kdWxlIGlkID0gMFxuLy8gbW9kdWxlIGNodW5rcyA9IDAiXSwibWFwcGluZ3MiOiJBQUFBO0FBQ0E7Iiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///0\n");
71
+
72
+ /***/ }),
73
+ /* 1 */
74
+ /***/ (function(module, exports) {
75
+
76
+ eval("// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028\nvar global = module.exports = typeof window != 'undefined' && window.Math == Math\n ? window : typeof self != 'undefined' && self.Math == Math ? self\n // eslint-disable-next-line no-new-func\n : Function('return this')();\nif (typeof __g == 'number') __g = global; // eslint-disable-line no-undef\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMS5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy8uL25vZGVfbW9kdWxlcy9jb3JlLWpzL2xpYnJhcnkvbW9kdWxlcy9fZ2xvYmFsLmpzP2VjYWIiXSwic291cmNlc0NvbnRlbnQiOlsiLy8gaHR0cHM6Ly9naXRodWIuY29tL3psb2lyb2NrL2NvcmUtanMvaXNzdWVzLzg2I2lzc3VlY29tbWVudC0xMTU3NTkwMjhcbnZhciBnbG9iYWwgPSBtb2R1bGUuZXhwb3J0cyA9IHR5cGVvZiB3aW5kb3cgIT0gJ3VuZGVmaW5lZCcgJiYgd2luZG93Lk1hdGggPT0gTWF0aFxuICA/IHdpbmRvdyA6IHR5cGVvZiBzZWxmICE9ICd1bmRlZmluZWQnICYmIHNlbGYuTWF0aCA9PSBNYXRoID8gc2VsZlxuICAvLyBlc2xpbnQtZGlzYWJsZS1uZXh0LWxpbmUgbm8tbmV3LWZ1bmNcbiAgOiBGdW5jdGlvbigncmV0dXJuIHRoaXMnKSgpO1xuaWYgKHR5cGVvZiBfX2cgPT0gJ251bWJlcicpIF9fZyA9IGdsb2JhbDsgLy8gZXNsaW50LWRpc2FibGUtbGluZSBuby11bmRlZlxuXG5cblxuLy8vLy8vLy8vLy8vLy8vLy8vXG4vLyBXRUJQQUNLIEZPT1RFUlxuLy8gLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX2dsb2JhbC5qc1xuLy8gbW9kdWxlIGlkID0gMVxuLy8gbW9kdWxlIGNodW5rcyA9IDAiXSwibWFwcGluZ3MiOiJBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///1\n");
77
+
78
+ /***/ }),
79
+ /* 2 */
80
+ /***/ (function(module, exports) {
81
+
82
+ eval("var hasOwnProperty = {}.hasOwnProperty;\nmodule.exports = function (it, key) {\n return hasOwnProperty.call(it, key);\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMi5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy8uL25vZGVfbW9kdWxlcy9jb3JlLWpzL2xpYnJhcnkvbW9kdWxlcy9faGFzLmpzPzBmNjIiXSwic291cmNlc0NvbnRlbnQiOlsidmFyIGhhc093blByb3BlcnR5ID0ge30uaGFzT3duUHJvcGVydHk7XG5tb2R1bGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChpdCwga2V5KSB7XG4gIHJldHVybiBoYXNPd25Qcm9wZXJ0eS5jYWxsKGl0LCBrZXkpO1xufTtcblxuXG5cbi8vLy8vLy8vLy8vLy8vLy8vL1xuLy8gV0VCUEFDSyBGT09URVJcbi8vIC4vbm9kZV9tb2R1bGVzL2NvcmUtanMvbGlicmFyeS9tb2R1bGVzL19oYXMuanNcbi8vIG1vZHVsZSBpZCA9IDJcbi8vIG1vZHVsZSBjaHVua3MgPSAwIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///2\n");
83
+
84
+ /***/ }),
85
+ /* 3 */
86
+ /***/ (function(module, exports, __webpack_require__) {
87
+
88
+ eval("var anObject = __webpack_require__(10);\nvar IE8_DOM_DEFINE = __webpack_require__(31);\nvar toPrimitive = __webpack_require__(18);\nvar dP = Object.defineProperty;\n\nexports.f = __webpack_require__(4) ? Object.defineProperty : function defineProperty(O, P, Attributes) {\n anObject(O);\n P = toPrimitive(P, true);\n anObject(Attributes);\n if (IE8_DOM_DEFINE) try {\n return dP(O, P, Attributes);\n } catch (e) { /* empty */ }\n if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!');\n if ('value' in Attributes) O[P] = Attributes.value;\n return O;\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMy5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy8uL25vZGVfbW9kdWxlcy9jb3JlLWpzL2xpYnJhcnkvbW9kdWxlcy9fb2JqZWN0LWRwLmpzPzdhZjAiXSwic291cmNlc0NvbnRlbnQiOlsidmFyIGFuT2JqZWN0ID0gcmVxdWlyZSgnLi9fYW4tb2JqZWN0Jyk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Q0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///3\n");
89
+
90
+ /***/ }),
91
+ /* 4 */
92
+ /***/ (function(module, exports, __webpack_require__) {
93
+
94
+ eval("// Thank's IE8 for his funny defineProperty\nmodule.exports = !__webpack_require__(11)(function () {\n return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;\n});\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNC5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy8uL25vZGVfbW9kdWxlcy9jb3JlLWpzL2xpYnJhcnkvbW9kdWxlcy9fZGVzY3JpcHRvcnMuanM/Zjg0ZCJdLCJzb3VyY2VzQ29udGVudCI6WyIvLyBUaGFuaydzIElFOCBmb3IgaGlzIGZ1bm55IGRlZmluZVByb3BlcnR5XG5tb2R1bGUuZXhwb3J0cyA9ICFyZXF1aXJlKCcuL19mYWlscycpKGZ1bmN0aW9uICgpIHtcbiAgcmV0dXJuIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh7fSwgJ2EnLCB7IGdldDogZnVuY3Rpb24gKCkgeyByZXR1cm4gNzsgfSB9KS5hICE9IDc7XG59KTtcblxuXG5cbi8vLy8vLy8vLy8vLy8vLy8vL1xuLy8gV0VCUEFDSyBGT09URVJcbi8vIC4vbm9kZV9tb2R1bGVzL2NvcmUtanMvbGlicmFyeS9tb2R1bGVzL19kZXNjcmlwdG9ycy5qc1xuLy8gbW9kdWxlIGlkID0gNFxuLy8gbW9kdWxlIGNodW5rcyA9IDAiXSwibWFwcGluZ3MiOiJBQUFBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///4\n");
95
+
96
+ /***/ }),
97
+ /* 5 */
98
+ /***/ (function(module, exports, __webpack_require__) {
99
+
100
+ eval("var global = __webpack_require__(1);\nvar core = __webpack_require__(0);\nvar ctx = __webpack_require__(30);\nvar hide = __webpack_require__(6);\nvar has = __webpack_require__(2);\nvar PROTOTYPE = 'prototype';\n\nvar $export = function (type, name, source) {\n var IS_FORCED = type & $export.F;\n var IS_GLOBAL = type & $export.G;\n var IS_STATIC = type & $export.S;\n var IS_PROTO = type & $export.P;\n var IS_BIND = type & $export.B;\n var IS_WRAP = type & $export.W;\n var exports = IS_GLOBAL ? core : core[name] || (core[name] = {});\n var expProto = exports[PROTOTYPE];\n var target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE];\n var key, own, out;\n if (IS_GLOBAL) source = name;\n for (key in source) {\n // contains in native\n own = !IS_FORCED && target && target[key] !== undefined;\n if (own && has(exports, key)) continue;\n // export native or passed\n out = own ? target[key] : source[key];\n // prevent global pollution for namespaces\n exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key]\n // bind timers to global for call from export context\n : IS_BIND && own ? ctx(out, global)\n // wrap global constructors for prevent change them in library\n : IS_WRAP && target[key] == out ? (function (C) {\n var F = function (a, b, c) {\n if (this instanceof C) {\n switch (arguments.length) {\n case 0: return new C();\n case 1: return new C(a);\n case 2: return new C(a, b);\n } return new C(a, b, c);\n } return C.apply(this, arguments);\n };\n F[PROTOTYPE] = C[PROTOTYPE];\n return F;\n // make static versions for prototype methods\n })(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;\n // export proto methods to core.%CONSTRUCTOR%.methods.%NAME%\n if (IS_PROTO) {\n (exports.virtual || (exports.virtual = {}))[key] = out;\n // export proto methods to core.%CONSTRUCTOR%.prototype.%NAME%\n if (type & $export.R && expProto && !expProto[key]) hide(expProto, key, out);\n }\n }\n};\n// type bitmap\n$export.F = 1; // forced\n$export.G = 2; // global\n$export.S = 4; // static\n$export.P = 8; // proto\n$export.B = 16; // bind\n$export.W = 32; // wrap\n$export.U = 64; // safe\n$export.R = 128; // real proto method for `library`\nmodule.exports = $export;\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNS5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy8uL25vZGVfbW9kdWxlcy9jb3JlLWpzL2xpYnJhcnkvbW9kdWxlcy9fZXhwb3J0LmpzPzkwY2QiXSwic291cmNlc0NvbnRlbnQiOlsidmFyIGdsb2JhbCA9IHJlcXVpcmUoJy4vX2dsb2JhbCcpO1xudmFyIGNvcmUgPSByZXF1aXJlKCcuL19jb3JlJyk7XG52YXIgY3R4ID0gcmVxdWlyZSgnLi9fY3R4Jyk7XG52YXIgaGlkZSA9IHJlcXVpcmUoJy4vX2hpZGUnKTtcbnZhciBoYXMgPSByZXF1aXJlKCcuL19oYXMnKTtcbnZhciBQUk9UT1RZUEUgPSAncHJvdG90eXBlJztcblxudmFyICRleHBvcnQgPSBmdW5jdGlvbiAodHlwZSwgbmFtZSwgc291cmNlKSB7XG4gIHZhciBJU19GT1JDRUQgPSB0eXBlICYgJGV4cG9ydC5GO1xuICB2YXIgSVNfR0xPQkFMID0gdHlwZSAmICRleHBvcnQuRztcbiAgdmFyIElTX1NUQVRJQyA9IHR5cGUgJiAkZXhwb3J0LlM7XG4gIHZhciBJU19QUk9UTyA9IHR5cGUgJiAkZXhwb3J0LlA7XG4gIHZhciBJU19CSU5EID0gdHlwZSAmICRleHBvcnQuQjtcbiAgdmFyIElTX1dSQVAgPSB0eXBlICYgJGV4cG9ydC5XO1xuICB2YXIgZXhwb3J0cyA9IElTX0dMT0JBTCA/IGNvcmUgOiBjb3JlW25hbWVdIHx8IChjb3JlW25hbWVdID0ge30pO1xuICB2YXIgZXhwUHJvdG8gPSBleHBvcnRzW1BST1RPVFlQRV07XG4gIHZhciB0YXJnZXQgPSBJU19HTE9CQUwgPyBnbG9iYWwgOiBJU19TVEFUSUMgPyBnbG9iYWxbbmFtZV0gOiAoZ2xvYmFsW25hbWVdIHx8IHt9KVtQUk9UT1RZUEVdO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BvcnQuVSA9IDY0OyAgLy8gc2FmZVxuJGV4cG9ydC5SID0gMTI4OyAvLyByZWFsIHByb3RvIG1ldGhvZCBmb3IgYGxpYnJhcnlgXG5tb2R1bGUuZXhwb3J0cyA9ICRleHBvcnQ7XG5cblxuXG4vLy8vLy8vLy8vLy8vLy8vLy9cbi8vIFdFQlBBQ0sgRk9PVEVSXG4vLyAuL25vZGVfbW9kdWxlcy9jb3JlLWpzL2xpYnJhcnkvbW9kdWxlcy9fZXhwb3J0LmpzXG4vLyBtb2R1bGUgaWQgPSA1XG4vLyBtb2R1bGUgY2h1bmtzID0gMCJdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///5\n");
101
+
102
+ /***/ }),
103
+ /* 6 */
104
+ /***/ (function(module, exports, __webpack_require__) {
105
+
106
+ eval("var dP = __webpack_require__(3);\nvar createDesc = __webpack_require__(14);\nmodule.exports = __webpack_require__(4) ? function (object, key, value) {\n return dP.f(object, key, createDesc(1, value));\n} : function (object, key, value) {\n object[key] = value;\n return object;\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNi5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy8uL25vZGVfbW9kdWxlcy9jb3JlLWpzL2xpYnJhcnkvbW9kdWxlcy9faGlkZS5qcz84NDljIl0sInNvdXJjZXNDb250ZW50IjpbInZhciBkUCA9IHJlcXVpcmUoJy4vX29iamVjdC1kcCcpO1xudmFyIGNyZWF0ZURlc2MgPSByZXF1aXJlKCcuL19wcm9wZXJ0eS1kZXNjJyk7XG5tb2R1bGUuZXhwb3J0cyA9IHJlcXVpcmUoJy4vX2Rlc2NyaXB0b3JzJykgPyBmdW5jdGlvbiAob2JqZWN0LCBrZXksIHZhbHVlKSB7XG4gIHJldHVybiBkUC5mKG9iamVjdCwga2V5LCBjcmVhdGVEZXNjKDEsIHZhbHVlKSk7XG59IDogZnVuY3Rpb24gKG9iamVjdCwga2V5LCB2YWx1ZSkge1xuICBvYmplY3Rba2V5XSA9IHZhbHVlO1xuICByZXR1cm4gb2JqZWN0O1xufTtcblxuXG5cbi8vLy8vLy8vLy8vLy8vLy8vL1xuLy8gV0VCUEFDSyBGT09URVJcbi8vIC4vbm9kZV9tb2R1bGVzL2NvcmUtanMvbGlicmFyeS9tb2R1bGVzL19oaWRlLmpzXG4vLyBtb2R1bGUgaWQgPSA2XG4vLyBtb2R1bGUgY2h1bmtzID0gMCJdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///6\n");
107
+
108
+ /***/ }),
109
+ /* 7 */
110
+ /***/ (function(module, exports) {
111
+
112
+ eval("module.exports = function (it) {\n return typeof it === 'object' ? it !== null : typeof it === 'function';\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNy5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy8uL25vZGVfbW9kdWxlcy9jb3JlLWpzL2xpYnJhcnkvbW9kdWxlcy9faXMtb2JqZWN0LmpzPzEyYTgiXSwic291cmNlc0NvbnRlbnQiOlsibW9kdWxlLmV4cG9ydHMgPSBmdW5jdGlvbiAoaXQpIHtcbiAgcmV0dXJuIHR5cGVvZiBpdCA9PT0gJ29iamVjdCcgPyBpdCAhPT0gbnVsbCA6IHR5cGVvZiBpdCA9PT0gJ2Z1bmN0aW9uJztcbn07XG5cblxuXG4vLy8vLy8vLy8vLy8vLy8vLy9cbi8vIFdFQlBBQ0sgRk9PVEVSXG4vLyAuL25vZGVfbW9kdWxlcy9jb3JlLWpzL2xpYnJhcnkvbW9kdWxlcy9faXMtb2JqZWN0LmpzXG4vLyBtb2R1bGUgaWQgPSA3XG4vLyBtb2R1bGUgY2h1bmtzID0gMCJdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///7\n");
113
+
114
+ /***/ }),
115
+ /* 8 */
116
+ /***/ (function(module, exports, __webpack_require__) {
117
+
118
+ eval("// to indexed object, toObject with fallback for non-array-like ES3 strings\nvar IObject = __webpack_require__(61);\nvar defined = __webpack_require__(15);\nmodule.exports = function (it) {\n return IObject(defined(it));\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiOC5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy8uL25vZGVfbW9kdWxlcy9jb3JlLWpzL2xpYnJhcnkvbW9kdWxlcy9fdG8taW9iamVjdC5qcz80ZGM0Il0sInNvdXJjZXNDb250ZW50IjpbIi8vIHRvIGluZGV4ZWQgb2JqZWN0LCB0b09iamVjdCB3aXRoIGZhbGxiYWNrIGZvciBub24tYXJyYXktbGlrZSBFUzMgc3RyaW5nc1xudmFyIElPYmplY3QgPSByZXF1aXJlKCcuL19pb2JqZWN0Jyk7XG52YXIgZGVmaW5lZCA9IHJlcXVpcmUoJy4vX2RlZmluZWQnKTtcbm1vZHVsZS5leHBvcnRzID0gZnVuY3Rpb24gKGl0KSB7XG4gIHJldHVybiBJT2JqZWN0KGRlZmluZWQoaXQpKTtcbn07XG5cblxuXG4vLy8vLy8vLy8vLy8vLy8vLy9cbi8vIFdFQlBBQ0sgRk9PVEVSXG4vLyAuL25vZGVfbW9kdWxlcy9jb3JlLWpzL2xpYnJhcnkvbW9kdWxlcy9fdG8taW9iamVjdC5qc1xuLy8gbW9kdWxlIGlkID0gOFxuLy8gbW9kdWxlIGNodW5rcyA9IDAiXSwibWFwcGluZ3MiOiJBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///8\n");
119
+
120
+ /***/ }),
121
+ /* 9 */
122
+ /***/ (function(module, exports, __webpack_require__) {
123
+
124
+ eval("var store = __webpack_require__(17)('wks');\nvar uid = __webpack_require__(13);\nvar Symbol = __webpack_require__(1).Symbol;\nvar USE_SYMBOL = typeof Symbol == 'function';\n\nvar $exports = module.exports = function (name) {\n return store[name] || (store[name] =\n USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name));\n};\n\n$exports.store = store;\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiOS5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy8uL25vZGVfbW9kdWxlcy9jb3JlLWpzL2xpYnJhcnkvbW9kdWxlcy9fd2tzLmpzPzc1MmMiXSwic291cmNlc0NvbnRlbnQiOlsidmFyIHN0b3JlID0gcmVxdWlyZSgnLi9fc2hhcmVkJykoJ3drcycpO1xudmFyIHVpZCA9IHJlcXVpcmUoJy4vX3VpZCcpO1xudmFyIFN5bWJvbCA9IHJlcXVpcmUoJy4vX2dsb2JhbCcpLlN5bWJvbDtcbnZhciBVU0VfU1lNQk9MID0gdHlwZW9mIFN5bWJvbCA9PSAnZnVuY3Rpb24nO1xuXG52YXIgJGV4cG9ydHMgPSBtb2R1bGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChuYW1lKSB7XG4gIHJldHVybiBzdG9yZVtuYW1lXSB8fCAoc3RvcmVbbmFtZV0gPVxuICAgIFVTRV9TWU1CT0wgJiYgU3ltYm9sW25hbWVdIHx8IChVU0VfU1lNQk9MID8gU3ltYm9sIDogdWlkKSgnU3ltYm9sLicgKyBuYW1lKSk7XG59O1xuXG4kZXhwb3J0cy5zdG9yZSA9IHN0b3JlO1xuXG5cblxuLy8vLy8vLy8vLy8vLy8vLy8vXG4vLyBXRUJQQUNLIEZPT1RFUlxuLy8gLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX3drcy5qc1xuLy8gbW9kdWxlIGlkID0gOVxuLy8gbW9kdWxlIGNodW5rcyA9IDAiXSwibWFwcGluZ3MiOiJBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7Iiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///9\n");
125
+
126
+ /***/ }),
127
+ /* 10 */
128
+ /***/ (function(module, exports, __webpack_require__) {
129
+
130
+ eval("var isObject = __webpack_require__(7);\nmodule.exports = function (it) {\n if (!isObject(it)) throw TypeError(it + ' is not an object!');\n return it;\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTAuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX2FuLW9iamVjdC5qcz9lZmIzIl0sInNvdXJjZXNDb250ZW50IjpbInZhciBpc09iamVjdCA9IHJlcXVpcmUoJy4vX2lzLW9iamVjdCcpO1xubW9kdWxlLmV4cG9ydHMgPSBmdW5jdGlvbiAoaXQpIHtcbiAgaWYgKCFpc09iamVjdChpdCkpIHRocm93IFR5cGVFcnJvcihpdCArICcgaXMgbm90IGFuIG9iamVjdCEnKTtcbiAgcmV0dXJuIGl0O1xufTtcblxuXG5cbi8vLy8vLy8vLy8vLy8vLy8vL1xuLy8gV0VCUEFDSyBGT09URVJcbi8vIC4vbm9kZV9tb2R1bGVzL2NvcmUtanMvbGlicmFyeS9tb2R1bGVzL19hbi1vYmplY3QuanNcbi8vIG1vZHVsZSBpZCA9IDEwXG4vLyBtb2R1bGUgY2h1bmtzID0gMCJdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///10\n");
131
+
132
+ /***/ }),
133
+ /* 11 */
134
+ /***/ (function(module, exports) {
135
+
136
+ eval("module.exports = function (exec) {\n try {\n return !!exec();\n } catch (e) {\n return true;\n }\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTEuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX2ZhaWxzLmpzPzRiY2QiXSwic291cmNlc0NvbnRlbnQiOlsibW9kdWxlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZXhlYykge1xuICB0cnkge1xuICAgIHJldHVybiAhIWV4ZWMoKTtcbiAgfSBjYXRjaCAoZSkge1xuICAgIHJldHVybiB0cnVlO1xuICB9XG59O1xuXG5cblxuLy8vLy8vLy8vLy8vLy8vLy8vXG4vLyBXRUJQQUNLIEZPT1RFUlxuLy8gLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX2ZhaWxzLmpzXG4vLyBtb2R1bGUgaWQgPSAxMVxuLy8gbW9kdWxlIGNodW5rcyA9IDAiXSwibWFwcGluZ3MiOiJBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///11\n");
137
+
138
+ /***/ }),
139
+ /* 12 */
140
+ /***/ (function(module, exports) {
141
+
142
+ eval("module.exports = true;\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTIuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX2xpYnJhcnkuanM/M2I4OCJdLCJzb3VyY2VzQ29udGVudCI6WyJtb2R1bGUuZXhwb3J0cyA9IHRydWU7XG5cblxuXG4vLy8vLy8vLy8vLy8vLy8vLy9cbi8vIFdFQlBBQ0sgRk9PVEVSXG4vLyAuL25vZGVfbW9kdWxlcy9jb3JlLWpzL2xpYnJhcnkvbW9kdWxlcy9fbGlicmFyeS5qc1xuLy8gbW9kdWxlIGlkID0gMTJcbi8vIG1vZHVsZSBjaHVua3MgPSAwIl0sIm1hcHBpbmdzIjoiQUFBQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///12\n");
143
+
144
+ /***/ }),
145
+ /* 13 */
146
+ /***/ (function(module, exports) {
147
+
148
+ eval("var id = 0;\nvar px = Math.random();\nmodule.exports = function (key) {\n return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTMuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX3VpZC5qcz9kYzRhIl0sInNvdXJjZXNDb250ZW50IjpbInZhciBpZCA9IDA7XG52YXIgcHggPSBNYXRoLnJhbmRvbSgpO1xubW9kdWxlLmV4cG9ydHMgPSBmdW5jdGlvbiAoa2V5KSB7XG4gIHJldHVybiAnU3ltYm9sKCcuY29uY2F0KGtleSA9PT0gdW5kZWZpbmVkID8gJycgOiBrZXksICcpXycsICgrK2lkICsgcHgpLnRvU3RyaW5nKDM2KSk7XG59O1xuXG5cblxuLy8vLy8vLy8vLy8vLy8vLy8vXG4vLyBXRUJQQUNLIEZPT1RFUlxuLy8gLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX3VpZC5qc1xuLy8gbW9kdWxlIGlkID0gMTNcbi8vIG1vZHVsZSBjaHVua3MgPSAwIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///13\n");
149
+
150
+ /***/ }),
151
+ /* 14 */
152
+ /***/ (function(module, exports) {
153
+
154
+ eval("module.exports = function (bitmap, value) {\n return {\n enumerable: !(bitmap & 1),\n configurable: !(bitmap & 2),\n writable: !(bitmap & 4),\n value: value\n };\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTQuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX3Byb3BlcnR5LWRlc2MuanM/NWZjMCJdLCJzb3VyY2VzQ29udGVudCI6WyJtb2R1bGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChiaXRtYXAsIHZhbHVlKSB7XG4gIHJldHVybiB7XG4gICAgZW51bWVyYWJsZTogIShiaXRtYXAgJiAxKSxcbiAgICBjb25maWd1cmFibGU6ICEoYml0bWFwICYgMiksXG4gICAgd3JpdGFibGU6ICEoYml0bWFwICYgNCksXG4gICAgdmFsdWU6IHZhbHVlXG4gIH07XG59O1xuXG5cblxuLy8vLy8vLy8vLy8vLy8vLy8vXG4vLyBXRUJQQUNLIEZPT1RFUlxuLy8gLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX3Byb3BlcnR5LWRlc2MuanNcbi8vIG1vZHVsZSBpZCA9IDE0XG4vLyBtb2R1bGUgY2h1bmtzID0gMCJdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///14\n");
155
+
156
+ /***/ }),
157
+ /* 15 */
158
+ /***/ (function(module, exports) {
159
+
160
+ eval("// 7.2.1 RequireObjectCoercible(argument)\nmodule.exports = function (it) {\n if (it == undefined) throw TypeError(\"Can't call method on \" + it);\n return it;\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTUuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX2RlZmluZWQuanM/ZTc2OCJdLCJzb3VyY2VzQ29udGVudCI6WyIvLyA3LjIuMSBSZXF1aXJlT2JqZWN0Q29lcmNpYmxlKGFyZ3VtZW50KVxubW9kdWxlLmV4cG9ydHMgPSBmdW5jdGlvbiAoaXQpIHtcbiAgaWYgKGl0ID09IHVuZGVmaW5lZCkgdGhyb3cgVHlwZUVycm9yKFwiQ2FuJ3QgY2FsbCBtZXRob2Qgb24gIFwiICsgaXQpO1xuICByZXR1cm4gaXQ7XG59O1xuXG5cblxuLy8vLy8vLy8vLy8vLy8vLy8vXG4vLyBXRUJQQUNLIEZPT1RFUlxuLy8gLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX2RlZmluZWQuanNcbi8vIG1vZHVsZSBpZCA9IDE1XG4vLyBtb2R1bGUgY2h1bmtzID0gMCJdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///15\n");
161
+
162
+ /***/ }),
163
+ /* 16 */
164
+ /***/ (function(module, exports, __webpack_require__) {
165
+
166
+ eval("var shared = __webpack_require__(17)('keys');\nvar uid = __webpack_require__(13);\nmodule.exports = function (key) {\n return shared[key] || (shared[key] = uid(key));\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTYuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX3NoYXJlZC1rZXkuanM/NmIxZCJdLCJzb3VyY2VzQ29udGVudCI6WyJ2YXIgc2hhcmVkID0gcmVxdWlyZSgnLi9fc2hhcmVkJykoJ2tleXMnKTtcbnZhciB1aWQgPSByZXF1aXJlKCcuL191aWQnKTtcbm1vZHVsZS5leHBvcnRzID0gZnVuY3Rpb24gKGtleSkge1xuICByZXR1cm4gc2hhcmVkW2tleV0gfHwgKHNoYXJlZFtrZXldID0gdWlkKGtleSkpO1xufTtcblxuXG5cbi8vLy8vLy8vLy8vLy8vLy8vL1xuLy8gV0VCUEFDSyBGT09URVJcbi8vIC4vbm9kZV9tb2R1bGVzL2NvcmUtanMvbGlicmFyeS9tb2R1bGVzL19zaGFyZWQta2V5LmpzXG4vLyBtb2R1bGUgaWQgPSAxNlxuLy8gbW9kdWxlIGNodW5rcyA9IDAiXSwibWFwcGluZ3MiOiJBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7Iiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///16\n");
167
+
168
+ /***/ }),
169
+ /* 17 */
170
+ /***/ (function(module, exports, __webpack_require__) {
171
+
172
+ eval("var core = __webpack_require__(0);\nvar global = __webpack_require__(1);\nvar SHARED = '__core-js_shared__';\nvar store = global[SHARED] || (global[SHARED] = {});\n\n(module.exports = function (key, value) {\n return store[key] || (store[key] = value !== undefined ? value : {});\n})('versions', []).push({\n version: core.version,\n mode: __webpack_require__(12) ? 'pure' : 'global',\n copyright: '© 2019 Denis Pushkarev (zloirock.ru)'\n});\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTcuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX3NoYXJlZC5qcz83YmMwIl0sInNvdXJjZXNDb250ZW50IjpbInZhciBjb3JlID0gcmVxdWlyZSgnLi9fY29yZScpO1xudmFyIGdsb2JhbCA9IHJlcXVpcmUoJy4vX2dsb2JhbCcpO1xudmFyIFNIQVJFRCA9ICdfX2NvcmUtanNfc2hhcmVkX18nO1xudmFyIHN0b3JlID0gZ2xvYmFsW1NIQVJFRF0gfHwgKGdsb2JhbFtTSEFSRURdID0ge30pO1xuXG4obW9kdWxlLmV4cG9ydHMgPSBmdW5jdGlvbiAoa2V5LCB2YWx1ZSkge1xuICByZXR1cm4gc3RvcmVba2V5XSB8fCAoc3RvcmVba2V5XSA9IHZhbHVlICE9PSB1bmRlZmluZWQgPyB2YWx1ZSA6IHt9KTtcbn0pKCd2ZXJzaW9ucycsIFtdKS5wdXNoKHtcbiAgdmVyc2lvbjogY29yZS52ZXJzaW9uLFxuICBtb2RlOiByZXF1aXJlKCcuL19saWJyYXJ5JykgPyAncHVyZScgOiAnZ2xvYmFsJyxcbiAgY29weXJpZ2h0OiAnwqkgMjAxOSBEZW5pcyBQdXNoa2FyZXYgKHpsb2lyb2NrLnJ1KSdcbn0pO1xuXG5cblxuLy8vLy8vLy8vLy8vLy8vLy8vXG4vLyBXRUJQQUNLIEZPT1RFUlxuLy8gLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX3NoYXJlZC5qc1xuLy8gbW9kdWxlIGlkID0gMTdcbi8vIG1vZHVsZSBjaHVua3MgPSAwIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7Iiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///17\n");
173
+
174
+ /***/ }),
175
+ /* 18 */
176
+ /***/ (function(module, exports, __webpack_require__) {
177
+
178
+ eval("// 7.1.1 ToPrimitive(input [, PreferredType])\nvar isObject = __webpack_require__(7);\n// instead of the ES6 spec version, we didn't implement @@toPrimitive case\n// and the second argument - flag - preferred type is a string\nmodule.exports = function (it, S) {\n if (!isObject(it)) return it;\n var fn, val;\n if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;\n if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val;\n if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;\n throw TypeError(\"Can't convert object to primitive value\");\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTguanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX3RvLXByaW1pdGl2ZS5qcz8zMjYzIl0sInNvdXJjZXNDb250ZW50IjpbIi8vIDcuMS4xIFRvUHJpbWl0aXZlKGlucHV0IFssIFByZWZlcnJlZFR5cGVdKVxudmFyIGlzT2JqZWN0ID0gcmVxdWlyZSgnLi9faXMtb2JqZWN0Jyk7XG4vLyBpbnN0ZWFkIG9mIHRoZSBFUzYgc3BlYyB2ZXJzaW9uLCB3ZSBkaWRuJ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/***/ }),
181
+ /* 19 */
182
+ /***/ (function(module, exports) {
183
+
184
+ eval("// 7.1.4 ToInteger\nvar ceil = Math.ceil;\nvar floor = Math.floor;\nmodule.exports = function (it) {\n return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTkuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX3RvLWludGVnZXIuanM/NTJlMSJdLCJzb3VyY2VzQ29udGVudCI6WyIvLyA3LjEuNCBUb0ludGVnZXJcbnZhciBjZWlsID0gTWF0aC5jZWlsO1xudmFyIGZsb29yID0gTWF0aC5mbG9vcjtcbm1vZHVsZS5leHBvcnRzID0gZnVuY3Rpb24gKGl0KSB7XG4gIHJldHVybiBpc05hTihpdCA9ICtpdCkgPyAwIDogKGl0ID4gMCA/IGZsb29yIDogY2VpbCkoaXQpO1xufTtcblxuXG5cbi8vLy8vLy8vLy8vLy8vLy8vL1xuLy8gV0VCUEFDSyBGT09URVJcbi8vIC4vbm9kZV9tb2R1bGVzL2NvcmUtanMvbGlicmFyeS9tb2R1bGVzL190by1pbnRlZ2VyLmpzXG4vLyBtb2R1bGUgaWQgPSAxOVxuLy8gbW9kdWxlIGNodW5rcyA9IDAiXSwibWFwcGluZ3MiOiJBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///19\n");
185
+
186
+ /***/ }),
187
+ /* 20 */
188
+ /***/ (function(module, exports) {
189
+
190
+ eval("module.exports = {};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjAuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX2l0ZXJhdG9ycy5qcz9mZGI0Il0sInNvdXJjZXNDb250ZW50IjpbIm1vZHVsZS5leHBvcnRzID0ge307XG5cblxuXG4vLy8vLy8vLy8vLy8vLy8vLy9cbi8vIFdFQlBBQ0sgRk9PVEVSXG4vLyAuL25vZGVfbW9kdWxlcy9jb3JlLWpzL2xpYnJhcnkvbW9kdWxlcy9faXRlcmF0b3JzLmpzXG4vLyBtb2R1bGUgaWQgPSAyMFxuLy8gbW9kdWxlIGNodW5rcyA9IDAiXSwibWFwcGluZ3MiOiJBQUFBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///20\n");
191
+
192
+ /***/ }),
193
+ /* 21 */
194
+ /***/ (function(module, exports, __webpack_require__) {
195
+
196
+ eval("// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])\nvar anObject = __webpack_require__(10);\nvar dPs = __webpack_require__(60);\nvar enumBugKeys = __webpack_require__(23);\nvar IE_PROTO = __webpack_require__(16)('IE_PROTO');\nvar Empty = function () { /* empty */ };\nvar PROTOTYPE = 'prototype';\n\n// Create object with fake `null` prototype: use iframe Object with cleared prototype\nvar createDict = function () {\n // Thrash, waste and sodomy: IE GC bug\n var iframe = __webpack_require__(32)('iframe');\n var i = enumBugKeys.length;\n var lt = '<';\n var gt = '>';\n var iframeDocument;\n iframe.style.display = 'none';\n __webpack_require__(65).appendChild(iframe);\n iframe.src = 'javascript:'; // eslint-disable-line no-script-url\n // createDict = iframe.contentWindow.Object;\n // html.removeChild(iframe);\n iframeDocument = iframe.contentWindow.document;\n iframeDocument.open();\n iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt);\n iframeDocument.close();\n createDict = iframeDocument.F;\n while (i--) delete createDict[PROTOTYPE][enumBugKeys[i]];\n return createDict();\n};\n\nmodule.exports = Object.create || function create(O, Properties) {\n var result;\n if (O !== null) {\n Empty[PROTOTYPE] = anObject(O);\n result = new Empty();\n Empty[PROTOTYPE] = null;\n // add \"__proto__\" for Object.getPrototypeOf polyfill\n result[IE_PROTO] = O;\n } else result = createDict();\n return Properties === undefined ? result : dPs(result, Properties);\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjEuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX29iamVjdC1jcmVhdGUuanM/NjI4NiJdLCJzb3VyY2VzQ29udGVudCI6WyIvLyAxOS4xLjIuMiAvIDE1LjIuMy41IE9iamVjdC5jcmVhdGUoTyBbLCBQcm9wZXJ0aWVzXSlcbnZhciBhbk9iamVjdCA9IHJlcXVpcmUoJy4vX2FuLW9iamVjdCcpO1xudmFyIGRQcyA9IHJlcXVpcmUoJy4vX29iamVjdC1kcHMnKTtcbnZhciBlbnVtQnVnS2V5cyA9IHJlcXVpcmUoJy4vX2VudW0tYnVnLWtleXMnKTtcbnZhciBJRV9QUk9UTyA9IHJlcXVpcmUoJy4vX3NoYXJlZC1rZXknKSgnSUVfUFJPVE8nKTtcbnZhciBFbXB0eSA9IGZ1bmN0aW9uICgpIHsgLyogZW1wdHkgKi8gfTtcbnZhciBQUk9UT1RZUEUgPSAncHJvdG90eXBlJztcblxuLy8gQ3JlYXRlIG9iamVjdCB3aXRoIGZha2UgYG51bGxgIHByb3RvdHlwZTogdXNlIGlmcmFtZSBPYmplY3Qgd2l0aCBjbGVhcmVkIHByb3RvdHlwZVxudmFyIGNyZWF0ZURpY3QgPSBmdW5jdGlvbiAoKSB7XG4gIC8vIFRocmFzaCwgd2FzdGUgYW5kIHNvZG9teTogSUUgR0MgYnVnXG4gIHZhciBpZnJhbWUgPSByZXF1aXJlKCcuL19kb20tY3JlYXRlJykoJ2lmcmFtZScpO1xuICB2YXIgaSA9IGVudW1CdWdLZXlzL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biAgICAvLyBhZGQgXCJfX3Byb3RvX19cIiBmb3IgT2JqZWN0LmdldFByb3RvdHlwZU9mIHBvbHlmaWxsXG4gICAgcmVzdWx0W0lFX1BST1RPXSA9IE87XG4gIH0gZWxzZSByZXN1bHQgPSBjcmVhdGVEaWN0KCk7XG4gIHJldHVybiBQcm9wZXJ0aWVzID09PSB1bmRlZmluZWQgPyByZXN1bHQgOiBkUHMocmVzdWx0LCBQcm9wZXJ0aWVzKTtcbn07XG5cblxuXG4vLy8vLy8vLy8vLy8vLy8vLy9cbi8vIFdFQlBBQ0sgRk9PVEVSXG4vLyAuL25vZGVfbW9kdWxlcy9jb3JlLWpzL2xpYnJhcnkvbW9kdWxlcy9fb2JqZWN0LWNyZWF0ZS5qc1xuLy8gbW9kdWxlIGlkID0gMjFcbi8vIG1vZHVsZSBjaHVua3MgPSAwIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///21\n");
197
+
198
+ /***/ }),
199
+ /* 22 */
200
+ /***/ (function(module, exports, __webpack_require__) {
201
+
202
+ eval("// 19.1.2.14 / 15.2.3.14 Object.keys(O)\nvar $keys = __webpack_require__(36);\nvar enumBugKeys = __webpack_require__(23);\n\nmodule.exports = Object.keys || function keys(O) {\n return $keys(O, enumBugKeys);\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjIuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX29iamVjdC1rZXlzLmpzPzk2NGIiXSwic291cmNlc0NvbnRlbnQiOlsiLy8gMTkuMS4yLjE0IC8gMTUuMi4zLjE0IE9iamVjdC5rZXlzKE8pXG52YXIgJGtleXMgPSByZXF1aXJlKCcuL19vYmplY3Qta2V5cy1pbnRlcm5hbCcpO1xudmFyIGVudW1CdWdLZXlzID0gcmVxdWlyZSgnLi9fZW51bS1idWcta2V5cycpO1xuXG5tb2R1bGUuZXhwb3J0cyA9IE9iamVjdC5rZXlzIHx8IGZ1bmN0aW9uIGtleXMoTykge1xuICByZXR1cm4gJGtleXMoTywgZW51bUJ1Z0tleXMpO1xufTtcblxuXG5cbi8vLy8vLy8vLy8vLy8vLy8vL1xuLy8gV0VCUEFDSyBGT09URVJcbi8vIC4vbm9kZV9tb2R1bGVzL2NvcmUtanMvbGlicmFyeS9tb2R1bGVzL19vYmplY3Qta2V5cy5qc1xuLy8gbW9kdWxlIGlkID0gMjJcbi8vIG1vZHVsZSBjaHVua3MgPSAwIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///22\n");
203
+
204
+ /***/ }),
205
+ /* 23 */
206
+ /***/ (function(module, exports) {
207
+
208
+ eval("// IE 8- don't enum bug keys\nmodule.exports = (\n 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'\n).split(',');\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjMuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX2VudW0tYnVnLWtleXMuanM/YzY3NyJdLCJzb3VyY2VzQ29udGVudCI6WyIvLyBJRSA4LSBkb24ndCBlbnVtIGJ1ZyBrZXlzXG5tb2R1bGUuZXhwb3J0cyA9IChcbiAgJ2NvbnN0cnVjdG9yLGhhc093blByb3BlcnR5LGlzUHJvdG90eXBlT2YscHJvcGVydHlJc0VudW1lcmFibGUsdG9Mb2NhbGVTdHJpbmcsdG9TdHJpbmcsdmFsdWVPZidcbikuc3BsaXQoJywnKTtcblxuXG5cbi8vLy8vLy8vLy8vLy8vLy8vL1xuLy8gV0VCUEFDSyBGT09URVJcbi8vIC4vbm9kZV9tb2R1bGVzL2NvcmUtanMvbGlicmFyeS9tb2R1bGVzL19lbnVtLWJ1Zy1rZXlzLmpzXG4vLyBtb2R1bGUgaWQgPSAyM1xuLy8gbW9kdWxlIGNodW5rcyA9IDAiXSwibWFwcGluZ3MiOiJBQUFBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///23\n");
209
+
210
+ /***/ }),
211
+ /* 24 */
212
+ /***/ (function(module, exports, __webpack_require__) {
213
+
214
+ eval("var def = __webpack_require__(3).f;\nvar has = __webpack_require__(2);\nvar TAG = __webpack_require__(9)('toStringTag');\n\nmodule.exports = function (it, tag, stat) {\n if (it && !has(it = stat ? it : it.prototype, TAG)) def(it, TAG, { configurable: true, value: tag });\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjQuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX3NldC10by1zdHJpbmctdGFnLmpzPzdiYTkiXSwic291cmNlc0NvbnRlbnQiOlsidmFyIGRlZiA9IHJlcXVpcmUoJy4vX29iamVjdC1kcCcpLmY7XG52YXIgaGFzID0gcmVxdWlyZSgnLi9faGFzJyk7XG52YXIgVEFHID0gcmVxdWlyZSgnLi9fd2tzJykoJ3RvU3RyaW5nVGFnJyk7XG5cbm1vZHVsZS5leHBvcnRzID0gZnVuY3Rpb24gKGl0LCB0YWcsIHN0YXQpIHtcbiAgaWYgKGl0ICYmICFoYXMoaXQgPSBzdGF0ID8gaXQgOiBpdC5wcm90b3R5cGUsIFRBRykpIGRlZihpdCwgVEFHLCB7IGNvbmZpZ3VyYWJsZTogdHJ1ZSwgdmFsdWU6IHRhZyB9KTtcbn07XG5cblxuXG4vLy8vLy8vLy8vLy8vLy8vLy9cbi8vIFdFQlBBQ0sgRk9PVEVSXG4vLyAuL25vZGVfbW9kdWxlcy9jb3JlLWpzL2xpYnJhcnkvbW9kdWxlcy9fc2V0LXRvLXN0cmluZy10YWcuanNcbi8vIG1vZHVsZSBpZCA9IDI0XG4vLyBtb2R1bGUgY2h1bmtzID0gMCJdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7Iiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///24\n");
215
+
216
+ /***/ }),
217
+ /* 25 */
218
+ /***/ (function(module, exports, __webpack_require__) {
219
+
220
+ eval("exports.f = __webpack_require__(9);\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjUuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX3drcy1leHQuanM/MmExZSJdLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnRzLmYgPSByZXF1aXJlKCcuL193a3MnKTtcblxuXG5cbi8vLy8vLy8vLy8vLy8vLy8vL1xuLy8gV0VCUEFDSyBGT09URVJcbi8vIC4vbm9kZV9tb2R1bGVzL2NvcmUtanMvbGlicmFyeS9tb2R1bGVzL193a3MtZXh0LmpzXG4vLyBtb2R1bGUgaWQgPSAyNVxuLy8gbW9kdWxlIGNodW5rcyA9IDAiXSwibWFwcGluZ3MiOiJBQUFBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///25\n");
221
+
222
+ /***/ }),
223
+ /* 26 */
224
+ /***/ (function(module, exports, __webpack_require__) {
225
+
226
+ eval("var global = __webpack_require__(1);\nvar core = __webpack_require__(0);\nvar LIBRARY = __webpack_require__(12);\nvar wksExt = __webpack_require__(25);\nvar defineProperty = __webpack_require__(3).f;\nmodule.exports = function (name) {\n var $Symbol = core.Symbol || (core.Symbol = LIBRARY ? {} : global.Symbol || {});\n if (name.charAt(0) != '_' && !(name in $Symbol)) defineProperty($Symbol, name, { value: wksExt.f(name) });\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjYuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX3drcy1kZWZpbmUuanM/NzJiOSJdLCJzb3VyY2VzQ29udGVudCI6WyJ2YXIgZ2xvYmFsID0gcmVxdWlyZSgnLi9fZ2xvYmFsJyk7XG52YXIgY29yZSA9IHJlcXVpcmUoJy4vX2NvcmUnKTtcbnZhciBMSUJSQVJZID0gcmVxdWlyZSgnLi9fbGlicmFyeScpO1xudmFyIHdrc0V4dCA9IHJlcXVpcmUoJy4vX3drcy1leHQnKTtcbnZhciBkZWZpbmVQcm9wZXJ0eSA9IHJlcXVpcmUoJy4vX29iamVjdC1kcCcpLmY7XG5tb2R1bGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChuYW1lKSB7XG4gIHZhciAkU3ltYm9sID0gY29yZS5TeW1ib2wgfHwgKGNvcmUuU3ltYm9sID0gTElCUkFSWSA/IHt9IDogZ2xvYmFsLlN5bWJvbCB8fCB7fSk7XG4gIGlmIChuYW1lLmNoYXJBdCgwKSAhPSAnXycgJiYgIShuYW1lIGluICRTeW1ib2wpKSBkZWZpbmVQcm9wZXJ0eSgkU3ltYm9sLCBuYW1lLCB7IHZhbHVlOiB3a3NFeHQuZihuYW1lKSB9KTtcbn07XG5cblxuXG4vLy8vLy8vLy8vLy8vLy8vLy9cbi8vIFdFQlBBQ0sgRk9PVEVSXG4vLyAuL25vZGVfbW9kdWxlcy9jb3JlLWpzL2xpYnJhcnkvbW9kdWxlcy9fd2tzLWRlZmluZS5qc1xuLy8gbW9kdWxlIGlkID0gMjZcbi8vIG1vZHVsZSBjaHVua3MgPSAwIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7Iiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///26\n");
227
+
228
+ /***/ }),
229
+ /* 27 */
230
+ /***/ (function(module, exports) {
231
+
232
+ eval("exports.f = {}.propertyIsEnumerable;\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjcuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX29iamVjdC1waWUuanM/MzY5MiJdLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnRzLmYgPSB7fS5wcm9wZXJ0eUlzRW51bWVyYWJsZTtcblxuXG5cbi8vLy8vLy8vLy8vLy8vLy8vL1xuLy8gV0VCUEFDSyBGT09URVJcbi8vIC4vbm9kZV9tb2R1bGVzL2NvcmUtanMvbGlicmFyeS9tb2R1bGVzL19vYmplY3QtcGllLmpzXG4vLyBtb2R1bGUgaWQgPSAyN1xuLy8gbW9kdWxlIGNodW5rcyA9IDAiXSwibWFwcGluZ3MiOiJBQUFBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///27\n");
233
+
234
+ /***/ }),
235
+ /* 28 */
236
+ /***/ (function(module, exports, __webpack_require__) {
237
+
238
+ eval("// 7.1.13 ToObject(argument)\nvar defined = __webpack_require__(15);\nmodule.exports = function (it) {\n return Object(defined(it));\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjguanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX3RvLW9iamVjdC5qcz9iMDFkIl0sInNvdXJjZXNDb250ZW50IjpbIi8vIDcuMS4xMyBUb09iamVjdChhcmd1bWVudClcbnZhciBkZWZpbmVkID0gcmVxdWlyZSgnLi9fZGVmaW5lZCcpO1xubW9kdWxlLmV4cG9ydHMgPSBmdW5jdGlvbiAoaXQpIHtcbiAgcmV0dXJuIE9iamVjdChkZWZpbmVkKGl0KSk7XG59O1xuXG5cblxuLy8vLy8vLy8vLy8vLy8vLy8vXG4vLyBXRUJQQUNLIEZPT1RFUlxuLy8gLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX3RvLW9iamVjdC5qc1xuLy8gbW9kdWxlIGlkID0gMjhcbi8vIG1vZHVsZSBjaHVua3MgPSAwIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///28\n");
239
+
240
+ /***/ }),
241
+ /* 29 */
242
+ /***/ (function(module, exports, __webpack_require__) {
243
+
244
+ eval("// 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O)\nvar has = __webpack_require__(2);\nvar toObject = __webpack_require__(28);\nvar IE_PROTO = __webpack_require__(16)('IE_PROTO');\nvar ObjectProto = Object.prototype;\n\nmodule.exports = Object.getPrototypeOf || function (O) {\n O = toObject(O);\n if (has(O, IE_PROTO)) return O[IE_PROTO];\n if (typeof O.constructor == 'function' && O instanceof O.constructor) {\n return O.constructor.prototype;\n } return O instanceof Object ? ObjectProto : null;\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjkuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX29iamVjdC1ncG8uanM/M2YzYyJdLCJzb3VyY2VzQ29udGVudCI6WyIvLyAxOS4xLjIuOSAvIDE1LjIuMy4yIE9iamVjdC5nZXRQcm90b3R5cGVPZihPKVxudmFyIGhhcyA9IHJlcXVpcmUoJy4vX2hhcycpO1xudmFyIHRvT2JqZWN0ID0gcmVxdWlyZSgnLi9fdG8tb2JqZWN0Jyk7XG52YXIgSUVfUFJPVE8gPSByZXF1aXJlKCcuL19zaGFyZWQta2V5JykoJ0lFX1BST1RPJyk7XG52YXIgT2JqZWN0UHJvdG8gPSBPYmplY3QucHJvdG90eXBlO1xuXG5tb2R1bGUuZXhwb3J0cyA9IE9iamVjdC5nZXRQcm90b3R5cGVPZiB8fCBmdW5jdGlvbiAoTykge1xuICBPID0gdG9PYmplY3QoTyk7XG4gIGlmIChoYXMoTywgSUVfUFJPVE8pKSByZXR1cm4gT1tJRV9QUk9UT107XG4gIGlmICh0eXBlb2YgTy5jb25zdHJ1Y3RvciA9PSAnZnVuY3Rpb24nICYmIE8gaW5zdGFuY2VvZiBPLmNvbnN0cnVjdG9yKSB7XG4gICAgcmV0dXJuIE8uY29uc3RydWN0b3IucHJvdG90eXBlO1xuICB9IHJldHVybiBPIGluc3RhbmNlb2YgT2JqZWN0ID8gT2JqZWN0UHJvdG8gOiBudWxsO1xufTtcblxuXG5cbi8vLy8vLy8vLy8vLy8vLy8vL1xuLy8gV0VCUEFDSyBGT09URVJcbi8vIC4vbm9kZV9tb2R1bGVzL2NvcmUtanMvbGlicmFyeS9tb2R1bGVzL19vYmplY3QtZ3BvLmpzXG4vLyBtb2R1bGUgaWQgPSAyOVxuLy8gbW9kdWxlIGNodW5rcyA9IDAiXSwibWFwcGluZ3MiOiJBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///29\n");
245
+
246
+ /***/ }),
247
+ /* 30 */
248
+ /***/ (function(module, exports, __webpack_require__) {
249
+
250
+ eval("// optional / simple context binding\nvar aFunction = __webpack_require__(48);\nmodule.exports = function (fn, that, length) {\n aFunction(fn);\n if (that === undefined) return fn;\n switch (length) {\n case 1: return function (a) {\n return fn.call(that, a);\n };\n case 2: return function (a, b) {\n return fn.call(that, a, b);\n };\n case 3: return function (a, b, c) {\n return fn.call(that, a, b, c);\n };\n }\n return function (/* ...args */) {\n return fn.apply(that, arguments);\n };\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMzAuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX2N0eC5qcz9mOTkzIl0sInNvdXJjZXNDb250ZW50IjpbIi8vIG9wdGlvbmFsIC8gc2ltcGxlIGNvbnRleHQgYmluZGluZ1xudmFyIGFGdW5jdGlvbiA9IHJlcXVpcmUoJy4vX2EtZnVuY3Rpb24nKTtcbm1vZHVsZS5leHBvcnRzID0gZnVuY3Rpb24gKGZuLCB0aGF0LCBsZW5ndGgpIHtcbiAgYUZ1bmN0aW9uKGZuKTtcbiAgaWYgKHRoYXQgPT09IHVuZGVmaW5lZCkgcmV0dXJuIGZuO1xuICBzd2l0Y2ggKGxlbmd0aCkge1xuICAgIGNhc2UgMTogcmV0dXJuIGZ1bmN0aW9uIChhKSB7XG4gICAgICByZXR1cm4gZm4uY2FsbCh0aGF0LCBhKTtcbiAgICB9O1xuICAgIGNhc2UgMjogcmV0dXJuIGZ1bmN0aW9uIChhLCBiKSB7XG4gICAgICByZXR1cm4gZm4uY2FsbCh0aGF0LCBhLCBiKTtcbiAgICB9O1xuICAgIGNhc2UgMzogcmV0dXJuIGZ1bmN0aW9uIChhLCBiLCBjKSB7XG4gICAgICByZXR1cm4gZm4uY2FsbCh0aGF0LCBhLCBiLCBjKTtcbiAgICB9O1xuICB9XG4gIHJldHVybiBmdW5jdGlvbiAoLyogLi4uYXJncyAqLykge1xuICAgIHJldHVybiBmbi5hcHBseSh0aGF0LCBhcmd1bWVudHMpO1xuICB9O1xufTtcblxuXG5cbi8vLy8vLy8vLy8vLy8vLy8vL1xuLy8gV0VCUEFDSyBGT09URVJcbi8vIC4vbm9kZV9tb2R1bGVzL2NvcmUtanMvbGlicmFyeS9tb2R1bGVzL19jdHguanNcbi8vIG1vZHVsZSBpZCA9IDMwXG4vLyBtb2R1bGUgY2h1bmtzID0gMCJdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///30\n");
251
+
252
+ /***/ }),
253
+ /* 31 */
254
+ /***/ (function(module, exports, __webpack_require__) {
255
+
256
+ eval("module.exports = !__webpack_require__(4) && !__webpack_require__(11)(function () {\n return Object.defineProperty(__webpack_require__(32)('div'), 'a', { get: function () { return 7; } }).a != 7;\n});\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMzEuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX2llOC1kb20tZGVmaW5lLmpzPzQ5ZjAiXSwic291cmNlc0NvbnRlbnQiOlsibW9kdWxlLmV4cG9ydHMgPSAhcmVxdWlyZSgnLi9fZGVzY3JpcHRvcnMnKSAmJiAhcmVxdWlyZSgnLi9fZmFpbHMnKShmdW5jdGlvbiAoKSB7XG4gIHJldHVybiBPYmplY3QuZGVmaW5lUHJvcGVydHkocmVxdWlyZSgnLi9fZG9tLWNyZWF0ZScpKCdkaXYnKSwgJ2EnLCB7IGdldDogZnVuY3Rpb24gKCkgeyByZXR1cm4gNzsgfSB9KS5hICE9IDc7XG59KTtcblxuXG5cbi8vLy8vLy8vLy8vLy8vLy8vL1xuLy8gV0VCUEFDSyBGT09URVJcbi8vIC4vbm9kZV9tb2R1bGVzL2NvcmUtanMvbGlicmFyeS9tb2R1bGVzL19pZTgtZG9tLWRlZmluZS5qc1xuLy8gbW9kdWxlIGlkID0gMzFcbi8vIG1vZHVsZSBjaHVua3MgPSAwIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7Iiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///31\n");
257
+
258
+ /***/ }),
259
+ /* 32 */
260
+ /***/ (function(module, exports, __webpack_require__) {
261
+
262
+ eval("var isObject = __webpack_require__(7);\nvar document = __webpack_require__(1).document;\n// typeof document.createElement is 'object' in old IE\nvar is = isObject(document) && isObject(document.createElement);\nmodule.exports = function (it) {\n return is ? document.createElement(it) : {};\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMzIuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX2RvbS1jcmVhdGUuanM/MzhkZCJdLCJzb3VyY2VzQ29udGVudCI6WyJ2YXIgaXNPYmplY3QgPSByZXF1aXJlKCcuL19pcy1vYmplY3QnKTtcbnZhciBkb2N1bWVudCA9IHJlcXVpcmUoJy4vX2dsb2JhbCcpLmRvY3VtZW50O1xuLy8gdHlwZW9mIGRvY3VtZW50LmNyZWF0ZUVsZW1lbnQgaXMgJ29iamVjdCcgaW4gb2xkIElFXG52YXIgaXMgPSBpc09iamVjdChkb2N1bWVudCkgJiYgaXNPYmplY3QoZG9jdW1lbnQuY3JlYXRlRWxlbWVudCk7XG5tb2R1bGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChpdCkge1xuICByZXR1cm4gaXMgPyBkb2N1bWVudC5jcmVhdGVFbGVtZW50KGl0KSA6IHt9O1xufTtcblxuXG5cbi8vLy8vLy8vLy8vLy8vLy8vL1xuLy8gV0VCUEFDSyBGT09URVJcbi8vIC4vbm9kZV9tb2R1bGVzL2NvcmUtanMvbGlicmFyeS9tb2R1bGVzL19kb20tY3JlYXRlLmpzXG4vLyBtb2R1bGUgaWQgPSAzMlxuLy8gbW9kdWxlIGNodW5rcyA9IDAiXSwibWFwcGluZ3MiOiJBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///32\n");
263
+
264
+ /***/ }),
265
+ /* 33 */
266
+ /***/ (function(module, exports, __webpack_require__) {
267
+
268
+ "use strict";
269
+ eval("\n\nexports.__esModule = true;\n\nvar _iterator = __webpack_require__(55);\n\nvar _iterator2 = _interopRequireDefault(_iterator);\n\nvar _symbol = __webpack_require__(70);\n\nvar _symbol2 = _interopRequireDefault(_symbol);\n\nvar _typeof = typeof _symbol2.default === \"function\" && typeof _iterator2.default === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof _symbol2.default === \"function\" && obj.constructor === _symbol2.default && obj !== _symbol2.default.prototype ? \"symbol\" : typeof obj; };\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nexports.default = typeof _symbol2.default === \"function\" && _typeof(_iterator2.default) === \"symbol\" ? function (obj) {\n return typeof obj === \"undefined\" ? \"undefined\" : _typeof(obj);\n} : function (obj) {\n return obj && typeof _symbol2.default === \"function\" && obj.constructor === _symbol2.default && obj !== _symbol2.default.prototype ? \"symbol\" : typeof obj === \"undefined\" ? \"undefined\" : _typeof(obj);\n};//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMzMuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYmFiZWwtcnVudGltZS9oZWxwZXJzL3R5cGVvZi5qcz9hNDU2Il0sInNvdXJjZXNDb250ZW50IjpbIlwidXNlIHN0cmljdFwiO1xuXG5leHBvcnRzLl9fZXNNb2R1bGUgPSB0cnVlO1xuXG52YXIgX2l0ZXJhdG9yID0gcmVxdWlyZShcIi4uL2NvcmUtanMvc3ltYm9sL2l0ZXJhdG9yXCIpO1xuXG52YXIgX2l0ZXJhdG9yMiA9IF9pbnRlcm9wUmVxdWlyZURlZmF1bHQoX2l0ZXJhdG9yKTtcblxudmFyIF9zeW1ib2wgPSByZXF1aXJlKFwiLi4vY29yZS1qcy9zeW1ib2xcIik7XG5cbnZhciBfc3ltYm9sMiA9IF9pbnRlcm9wUmVxdWlyZURlZmF1bHQoX3N5bWJvbCk7XG5cbnZhciBfdHlwZW9mID0gdHlwZW9mIF9zeW1ib2wyLmRlZmF1bHQgPT09IFwiZnVuY3Rpb25cIiAmJiB0eXBlb2YgX2l0ZXJhdG9yMi5kZWZhdWx0ID09PSBcInN5bWJvbFwiID8gZnVuY3Rpb24gKG9iaikgeyByZXR1cm4gdHlwZW9mIG9iajsgfSA6IGZ1bmN0aW9uIChvYmopIHsgcmV0dXJuIG9iaiAmJiB0eXBlb2YgX3N5bWJvbDIuZGVmYXVsdCA9PT0gXCJmdW5jdGlvblwiIC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BQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBIiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///33\n");
270
+
271
+ /***/ }),
272
+ /* 34 */
273
+ /***/ (function(module, exports, __webpack_require__) {
274
+
275
+ "use strict";
276
+ eval("\nvar LIBRARY = __webpack_require__(12);\nvar $export = __webpack_require__(5);\nvar redefine = __webpack_require__(35);\nvar hide = __webpack_require__(6);\nvar Iterators = __webpack_require__(20);\nvar $iterCreate = __webpack_require__(59);\nvar setToStringTag = __webpack_require__(24);\nvar getPrototypeOf = __webpack_require__(29);\nvar ITERATOR = __webpack_require__(9)('iterator');\nvar BUGGY = !([].keys && 'next' in [].keys()); // Safari has buggy iterators w/o `next`\nvar FF_ITERATOR = '@@iterator';\nvar KEYS = 'keys';\nvar VALUES = 'values';\n\nvar returnThis = function () { return this; };\n\nmodule.exports = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) {\n $iterCreate(Constructor, NAME, next);\n var getMethod = function (kind) {\n if (!BUGGY && kind in proto) return proto[kind];\n switch (kind) {\n case KEYS: return function keys() { return new Constructor(this, kind); };\n case VALUES: return function values() { return new Constructor(this, kind); };\n } return function entries() { return new Constructor(this, kind); };\n };\n var TAG = NAME + ' Iterator';\n var DEF_VALUES = DEFAULT == VALUES;\n var VALUES_BUG = false;\n var proto = Base.prototype;\n var $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT];\n var $default = $native || getMethod(DEFAULT);\n var $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined;\n var $anyNative = NAME == 'Array' ? proto.entries || $native : $native;\n var methods, key, IteratorPrototype;\n // Fix native\n if ($anyNative) {\n IteratorPrototype = getPrototypeOf($anyNative.call(new Base()));\n if (IteratorPrototype !== Object.prototype && IteratorPrototype.next) {\n // Set @@toStringTag to native iterators\n setToStringTag(IteratorPrototype, TAG, true);\n // fix for some old engines\n if (!LIBRARY && typeof IteratorPrototype[ITERATOR] != 'function') hide(IteratorPrototype, ITERATOR, returnThis);\n }\n }\n // fix Array#{values, @@iterator}.name in V8 / FF\n if (DEF_VALUES && $native && $native.name !== VALUES) {\n VALUES_BUG = true;\n $default = function values() { return $native.call(this); };\n }\n // Define iterator\n if ((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])) {\n hide(proto, ITERATOR, $default);\n }\n // Plug for library\n Iterators[NAME] = $default;\n Iterators[TAG] = returnThis;\n if (DEFAULT) {\n methods = {\n values: DEF_VALUES ? $default : getMethod(VALUES),\n keys: IS_SET ? $default : getMethod(KEYS),\n entries: $entries\n };\n if (FORCED) for (key in methods) {\n if (!(key in proto)) redefine(proto, key, methods[key]);\n } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods);\n }\n return methods;\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMzQuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX2l0ZXItZGVmaW5lLmpzP2JjODAiXSwic291cmNlc0NvbnRlbnQiOlsiJ3VzZSBzdHJpY3QnO1xudmFyIExJQlJBUlkgPSByZXF1aXJlKCcuL19saWJyYXJ5Jyk7XG52YXIgJGV4cG9ydCA9IHJlcXVpcmUoJy4vX2V4cG9ydCcpO1xudmFyIHJlZGVmaW5lID0gcmVxdWlyZSgnLi9fcmVkZWZpbmUnKTtcbnZhciBoaWRlID0gcmVxdWlyZSgnLi9faGlkZScpO1xudmFyIEl0ZXJhdG9ycyA9IHJlcXVpcmUoJy4vX2l0ZXJhdG9ycycpO1xudmFyICRpdGVyQ3JlYXRlID0gcmVxdWly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webpack_require__(6);\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMzUuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX3JlZGVmaW5lLmpzP2YzY2QiXSwic291cmNlc0NvbnRlbnQiOlsibW9kdWxlLmV4cG9ydHMgPSByZXF1aXJlKCcuL19oaWRlJyk7XG5cblxuXG4vLy8vLy8vLy8vLy8vLy8vLy9cbi8vIFdFQlBBQ0sgRk9PVEVSXG4vLyAuL25vZGVfbW9kdWxlcy9jb3JlLWpzL2xpYnJhcnkvbW9kdWxlcy9fcmVkZWZpbmUuanNcbi8vIG1vZHVsZSBpZCA9IDM1XG4vLyBtb2R1bGUgY2h1bmtzID0gMCJdLCJtYXBwaW5ncyI6IkFBQUE7Iiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///35\n");
283
+
284
+ /***/ }),
285
+ /* 36 */
286
+ /***/ (function(module, exports, __webpack_require__) {
287
+
288
+ eval("var has = __webpack_require__(2);\nvar toIObject = __webpack_require__(8);\nvar arrayIndexOf = __webpack_require__(62)(false);\nvar IE_PROTO = __webpack_require__(16)('IE_PROTO');\n\nmodule.exports = function (object, names) {\n var O = toIObject(object);\n var i = 0;\n var result = [];\n var key;\n for (key in O) if (key != IE_PROTO) has(O, key) && result.push(key);\n // Don't enum bug & hidden keys\n while (names.length > i) if (has(O, key = names[i++])) {\n ~arrayIndexOf(result, key) || result.push(key);\n }\n return result;\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMzYuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX29iamVjdC1rZXlzLWludGVybmFsLmpzPzIx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0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///36\n");
289
+
290
+ /***/ }),
291
+ /* 37 */
292
+ /***/ (function(module, exports) {
293
+
294
+ eval("var toString = {}.toString;\n\nmodule.exports = function (it) {\n return toString.call(it).slice(8, -1);\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMzcuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX2NvZi5qcz80N2QzIl0sInNvdXJjZXNDb250ZW50IjpbInZhciB0b1N0cmluZyA9IHt9LnRvU3RyaW5nO1xuXG5tb2R1bGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChpdCkge1xuICByZXR1cm4gdG9TdHJpbmcuY2FsbChpdCkuc2xpY2UoOCwgLTEpO1xufTtcblxuXG5cbi8vLy8vLy8vLy8vLy8vLy8vL1xuLy8gV0VCUEFDSyBGT09URVJcbi8vIC4vbm9kZV9tb2R1bGVzL2NvcmUtanMvbGlicmFyeS9tb2R1bGVzL19jb2YuanNcbi8vIG1vZHVsZSBpZCA9IDM3XG4vLyBtb2R1bGUgY2h1bmtzID0gMCJdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///37\n");
295
+
296
+ /***/ }),
297
+ /* 38 */
298
+ /***/ (function(module, exports) {
299
+
300
+ eval("exports.f = Object.getOwnPropertySymbols;\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMzguanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX29iamVjdC1nb3BzLmpzP2Q2NDQiXSwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0cy5mID0gT2JqZWN0LmdldE93blByb3BlcnR5U3ltYm9scztcblxuXG5cbi8vLy8vLy8vLy8vLy8vLy8vL1xuLy8gV0VCUEFDSyBGT09URVJcbi8vIC4vbm9kZV9tb2R1bGVzL2NvcmUtanMvbGlicmFyeS9tb2R1bGVzL19vYmplY3QtZ29wcy5qc1xuLy8gbW9kdWxlIGlkID0gMzhcbi8vIG1vZHVsZSBjaHVua3MgPSAwIl0sIm1hcHBpbmdzIjoiQUFBQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///38\n");
301
+
302
+ /***/ }),
303
+ /* 39 */
304
+ /***/ (function(module, exports, __webpack_require__) {
305
+
306
+ eval("// 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O)\nvar $keys = __webpack_require__(36);\nvar hiddenKeys = __webpack_require__(23).concat('length', 'prototype');\n\nexports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {\n return $keys(O, hiddenKeys);\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMzkuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX29iamVjdC1nb3BuLmpzPzlmNDQiXSwic291cmNlc0NvbnRlbnQiOlsiLy8gMTkuMS4yLjcgLyAxNS4yLjMuNCBPYmplY3QuZ2V0T3duUHJvcGVydHlOYW1lcyhPKVxudmFyICRrZXlzID0gcmVxdWlyZSgnLi9fb2JqZWN0LWtleXMtaW50ZXJuYWwnKTtcbnZhciBoaWRkZW5LZXlzID0gcmVxdWlyZSgnLi9fZW51bS1idWcta2V5cycpLmNvbmNhdCgnbGVuZ3RoJywgJ3Byb3RvdHlwZScpO1xuXG5leHBvcnRzLmYgPSBPYmplY3QuZ2V0T3duUHJvcGVydHlOYW1lcyB8fCBmdW5jdGlvbiBnZXRPd25Qcm9wZXJ0eU5hbWVzKE8pIHtcbiAgcmV0dXJuICRrZXlzKE8sIGhpZGRlbktleXMpO1xufTtcblxuXG5cbi8vLy8vLy8vLy8vLy8vLy8vL1xuLy8gV0VCUEFDSyBGT09URVJcbi8vIC4vbm9kZV9tb2R1bGVzL2NvcmUtanMvbGlicmFyeS9tb2R1bGVzL19vYmplY3QtZ29wbi5qc1xuLy8gbW9kdWxlIGlkID0gMzlcbi8vIG1vZHVsZSBjaHVua3MgPSAwIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///39\n");
307
+
308
+ /***/ }),
309
+ /* 40 */
310
+ /***/ (function(module, exports, __webpack_require__) {
311
+
312
+ eval("var pIE = __webpack_require__(27);\nvar createDesc = __webpack_require__(14);\nvar toIObject = __webpack_require__(8);\nvar toPrimitive = __webpack_require__(18);\nvar has = __webpack_require__(2);\nvar IE8_DOM_DEFINE = __webpack_require__(31);\nvar gOPD = Object.getOwnPropertyDescriptor;\n\nexports.f = __webpack_require__(4) ? gOPD : function getOwnPropertyDescriptor(O, P) {\n O = toIObject(O);\n P = toPrimitive(P, true);\n if (IE8_DOM_DEFINE) try {\n return gOPD(O, P);\n } catch (e) { /* empty */ }\n if (has(O, P)) return createDesc(!pIE.f.call(O, P), O[P]);\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNDAuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX29iamVjdC1nb3BkLmpzPzJjYTYiXSwic291cmNlc0NvbnRlbnQiOlsidmFyIHBJRSA9IHJlc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0E7QUFDQTtBQUNBO0FBQ0E7Iiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///40\n");
313
+
314
+ /***/ }),
315
+ /* 41 */
316
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
317
+
318
+ "use strict";
319
+ eval("Object.defineProperty(__webpack_exports__, \"__esModule\", { value: true });\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__style_scss__ = __webpack_require__(42);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__style_scss___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__style_scss__);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__sidebar_js__ = __webpack_require__(43);\n// Include stylesheet\n\n\n// Import Click to Tweet Block\n//import './block.js';\n\n// Import Gutenberg Boilerplate Sidebar\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNDEuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9zcmMvaW5kZXguanM/ODc0OSJdLCJzb3VyY2VzQ29udGVudCI6WyIvLyBJbmNsdWRlIHN0eWxlc2hlZXRcbmltcG9ydCAnLi9zdHlsZS5zY3NzJztcblxuLy8gSW1wb3J0IENsaWNrIHRvIFR3ZWV0IEJsb2NrXG4vL2ltcG9ydCAnLi9ibG9jay5qcyc7XG5cbi8vIEltcG9ydCBHdXRlbmJlcmcgQm9pbGVycGxhdGUgU2lkZWJhclxuaW1wb3J0ICcuL3NpZGViYXIuanMnO1xuXG5cbi8vLy8vLy8vLy8vLy8vLy8vL1xuLy8gV0VCUEFDSyBGT09URVJcbi8vIC4vc3JjL2luZGV4LmpzXG4vLyBtb2R1bGUgaWQgPSA0MVxuLy8gbW9kdWxlIGNodW5rcyA9IDAiXSwibWFwcGluZ3MiOiJBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7Iiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///41\n");
320
+
321
+ /***/ }),
322
+ /* 42 */
323
+ /***/ (function(module, exports) {
324
+
325
+ eval("// removed by extract-text-webpack-plugin//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNDIuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9zcmMvc3R5bGUuc2Nzcz9hY2Q4Il0sInNvdXJjZXNDb250ZW50IjpbIi8vIHJlbW92ZWQgYnkgZXh0cmFjdC10ZXh0LXdlYnBhY2stcGx1Z2luXG5cblxuLy8vLy8vLy8vLy8vLy8vLy8vXG4vLyBXRUJQQUNLIEZPT1RFUlxuLy8gLi9zcmMvc3R5bGUuc2Nzc1xuLy8gbW9kdWxlIGlkID0gNDJcbi8vIG1vZHVsZSBjaHVua3MgPSAwIl0sIm1hcHBpbmdzIjoiQUFBQSIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///42\n");
326
+
327
+ /***/ }),
328
+ /* 43 */
329
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
330
+
331
+ "use strict";
332
+ eval("/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(44);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_get_prototype_of__);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_classCallCheck__ = __webpack_require__(49);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_classCallCheck___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_classCallCheck__);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_helpers_createClass__ = __webpack_require__(50);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_helpers_createClass___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_helpers_createClass__);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_helpers_possibleConstructorReturn__ = __webpack_require__(54);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_helpers_possibleConstructorReturn___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_helpers_possibleConstructorReturn__);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_helpers_inherits__ = __webpack_require__(80);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_helpers_inherits___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_babel_runtime_helpers_inherits__);\n\n\n\n\n\n/**\n * Internal block libraries.\n * @since 2.2.3\n */\nvar __ = wp.i18n.__;\nvar _wp$editPost = wp.editPost,\n PluginSidebar = _wp$editPost.PluginSidebar,\n PluginSidebarMoreMenuItem = _wp$editPost.PluginSidebarMoreMenuItem;\nvar _wp$components = wp.components,\n PanelBody = _wp$components.PanelBody,\n TextControl = _wp$components.TextControl,\n Button = _wp$components.Button,\n Notice = _wp$components.Notice;\nvar _wp$element = wp.element,\n Component = _wp$element.Component,\n Fragment = _wp$element.Fragment;\nvar withSelect = wp.data.withSelect;\nvar compose = wp.compose.compose;\n\n\nvar LanguageSwitcherNotice = function LanguageSwitcherNotice(props) {\n\tif (WPGlobusGutenberg.pagenow == WPGlobusGutenberg.postNewPage) {\n\t\treturn wp.element.createElement('div', null);\n\t}\n\n\tvar dev = '';\n\tif ('undefined' !== typeof WPGlobusBlockEditorDevelop && !WPGlobusBlockEditorDevelop.production) {\n\t\tdev = '(develop)';\n\t}\n\n\treturn wp.element.createElement(\n\t\tNotice,\n\t\t{ className: 'wpglobus-block-editor-panel__notice', status: 'informational', isDismissible: false },\n\t\t__('Select language'),\n\t\t' ',\n\t\tdev\n\t);\n};\n\nvar LanguageSwitcher = function LanguageSwitcher(props) {\n\n\tif (WPGlobusGutenberg.pagenow == WPGlobusGutenberg.postNewPage) {\n\t\treturn wp.element.createElement(\n\t\t\t'div',\n\t\t\t{ className: 'wpglobus-block-editor-panel__switcher-box' },\n\t\t\tWPGlobusGutenberg.i18n.save_post\n\t\t);\n\t}\n\n\tvar language = WPGlobusGutenberg.language;\n\tvar flagsUrl = WPGlobusGutenberg.flags_url;\n\tvar enabledLanguages = WPGlobusCoreData.enabled_languages;\n\tvar languageNames = WPGlobusCoreData.en_language_name;\n\tvar ref = location.href;\n\tvar refs = {};\n\tfor (var key in enabledLanguages) {\n\t\tif (-1 == ref.indexOf('language=' + language)) {\n\t\t\trefs[enabledLanguages[key]] = ref + '&language=' + enabledLanguages[key];\n\t\t} else {\n\t\t\trefs[enabledLanguages[key]] = ref.replace('language=' + language, 'language=' + enabledLanguages[key]);\n\t\t}\n\t}\n\n\treturn wp.element.createElement(\n\t\t'div',\n\t\t{ className: 'wpglobus-block-editor-panel__switcher-box' },\n\t\twp.element.createElement(\n\t\t\t'ul',\n\t\t\tnull,\n\t\t\tenabledLanguages.map(function (lang) {\n\t\t\t\treturn wp.element.createElement(\n\t\t\t\t\t'li',\n\t\t\t\t\t{ key: lang },\n\t\t\t\t\twp.element.createElement('img', { className: 'wpglobus-block-editor-panel__flag', height: '20px', width: '20px', src: flagsUrl[lang] }),\n\t\t\t\t\t'\\xA0\\xA0',\n\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\tButton,\n\t\t\t\t\t\t{ href: refs[lang], isSmall: true, isPrimary: true },\n\t\t\t\t\t\tlanguageNames[lang]\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t})\n\t\t)\n\t);\n};\n\nvar WPGlobusInfo = function WPGlobusInfo(props) {\n\treturn wp.element.createElement(\n\t\t'div',\n\t\t{ className: 'wpglobus-block-editor-panel__info' },\n\t\twp.element.createElement(\n\t\t\tButton,\n\t\t\t{ href: props.href, target: '_blank', isLink: true },\n\t\t\t__('WPGlobus Premium Add-ons')\n\t\t)\n\t);\n};\n\nvar SettingsLink = function SettingsLink(props) {\n\treturn wp.element.createElement(\n\t\t'div',\n\t\t{ className: 'wpglobus-block-editor-panel__settings-link' },\n\t\twp.element.createElement(\n\t\t\tButton,\n\t\t\t{ href: props.href, isLink: true },\n\t\t\t__('Settings')\n\t\t)\n\t);\n};\n\nvar registerPlugin = wp.plugins.registerPlugin;\n\nvar WPGlobus_BlockEditor = function (_Component) {\n\t__WEBPACK_IMPORTED_MODULE_4_babel_runtime_helpers_inherits___default()(WPGlobus_BlockEditor, _Component);\n\n\tfunction WPGlobus_BlockEditor() {\n\t\t__WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_classCallCheck___default()(this, WPGlobus_BlockEditor);\n\n\t\tvar _this = __WEBPACK_IMPORTED_MODULE_3_babel_runtime_helpers_possibleConstructorReturn___default()(this, (WPGlobus_BlockEditor.__proto__ || __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_get_prototype_of___default()(WPGlobus_BlockEditor)).apply(this, arguments));\n\n\t\tvar dev = '';\n\t\tif ('undefined' !== typeof WPGlobusBlockEditorDevelop && !WPGlobusBlockEditorDevelop.production) {\n\t\t\tdev = ' (develop)';\n\t\t}\n\n\t\t_this.state = {\n\t\t\toptionsTabUrl: WPGlobusGutenberg.block_editor_tab_url,\n\t\t\tstoreLink: WPGlobusGutenberg.store_link,\n\t\t\theaderTitle: __('WPGlobus') + dev,\n\t\t\tmoreMenuItemTitle: __('WPGlobus')\n\t\t};\n\n\t\tsetTimeout(function () {\n\t\t\tvar buttons = document.getElementsByClassName('components-icon-button');\n\t\t\tfor (var i = 0; i < buttons.length; i++) {\n\t\t\t\tvar status = buttons[i].getAttribute('aria-label');\n\t\t\t\t//if ( status == 'WPGlobus' ) { \n\t\t\t\tif (-1 != status.indexOf('WPGlobus')) {\n\t\t\t\t\tvar done = buttons[i].dataset.done;\n\t\t\t\t\tif ('undefined' === typeof done) {\n\t\t\t\t\t\tvar content = buttons[i].innerHTML;\n\t\t\t\t\t\t//@todo buttons[i].classList.add('wpglobus-switcher-button');\n\t\t\t\t\t\tbuttons[i].innerHTML = content + '<img height=\"20px\" width=\"20px\" src=\"' + WPGlobusGutenberg.flags_url[WPGlobusGutenberg.language] + '\" />&nbsp;' + WPGlobusAdmin.data.en_language_name[WPGlobusGutenberg.language];\n\t\t\t\t\t\tbuttons[i].dataset.done = 'yes';\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}, 500);\n\t\treturn _this;\n\t}\n\n\t__WEBPACK_IMPORTED_MODULE_2_babel_runtime_helpers_createClass___default()(WPGlobus_BlockEditor, [{\n\t\tkey: 'render',\n\t\tvalue: function render() {\n\t\t\treturn wp.element.createElement(\n\t\t\t\tFragment,\n\t\t\t\tnull,\n\t\t\t\twp.element.createElement(\n\t\t\t\t\tPluginSidebarMoreMenuItem,\n\t\t\t\t\t{\n\t\t\t\t\t\ttarget: 'wpglobus-gutenberg-sidebar'\n\t\t\t\t\t},\n\t\t\t\t\tthis.state.moreMenuItemTitle\n\t\t\t\t),\n\t\t\t\twp.element.createElement(\n\t\t\t\t\tPluginSidebar,\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'wpglobus-gutenberg-sidebar',\n\t\t\t\t\t\ttitle: this.state.headerTitle\n\t\t\t\t\t},\n\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\tPanelBody,\n\t\t\t\t\t\t{ className: 'wpglobus-block-editor-panel__body' },\n\t\t\t\t\t\twp.element.createElement(LanguageSwitcherNotice, null),\n\t\t\t\t\t\twp.element.createElement(LanguageSwitcher, null),\n\t\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\t\t'div',\n\t\t\t\t\t\t\tnull,\n\t\t\t\t\t\t\twp.element.createElement(WPGlobusInfo, { href: this.state.storeLink }),\n\t\t\t\t\t\t\twp.element.createElement(SettingsLink, { href: this.state.optionsTabUrl })\n\t\t\t\t\t\t)\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\t}]);\n\n\treturn WPGlobus_BlockEditor;\n}(Component);\n\nvar WPGBE = withSelect(function (select, _ref) {\n\tvar forceIsSaving = _ref.forceIsSaving;\n\n\tvar _select = select('core/editor'),\n\t getCurrentPostId = _select.getCurrentPostId,\n\t isSavingPost = _select.isSavingPost,\n\t isPublishingPost = _select.isPublishingPost,\n\t isAutosavingPost = _select.isAutosavingPost;\n\n\treturn {\n\t\tpostId: getCurrentPostId(),\n\t\tisSaving: forceIsSaving || isSavingPost(),\n\t\tisAutoSaving: isAutosavingPost(),\n\t\tisPublishing: isPublishingPost()\n\t};\n})(WPGlobus_BlockEditor);\n\nregisterPlugin('wpglobus-gutenberg', {\n\ticon: 'admin-site',\n\trender: WPGBE\n});//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNDMuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9zcmMvc2lkZWJhci5qcz8yNWQ1Il0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBfT2JqZWN0JGdldFByb3RvdHlwZU9mIGZyb20gJ2JhYmVsLXJ1bnRpbWUvY29yZS1qcy9vYmplY3QvZ2V0LXByb3RvdHlwZS1vZic7XG5pbXBvcnQgX2NsYXNzQ2FsbENoZWNrIGZyb20gJ2JhYmVsLXJ1bnRpbWUvaGVscGVycy9jbGFzc0NhbGxDaGVjayc7XG5pbXBvcnQgX2NyZWF0ZUNsYXNzIGZyb20gJ2JhYmVsLXJ1bnRpbWUvaGVscGVycy9jcmVhdGVDbGFzcyc7XG5pbXBvcnQgX3Bvc3NpYmxlQ29uc3RydWN0b3JSZXR1cm4gZnJvbSAnYmFiZWwtcnVudGltZS9oZWxwZXJzL3Bvc3NpYmxlQ29uc3RydWN0b3JSZXR1cm4nO1xuaW1wb3J0IF9pbmhlcml0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7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///43\n");
333
+
334
+ /***/ }),
335
+ /* 44 */
336
+ /***/ (function(module, exports, __webpack_require__) {
337
+
338
+ eval("module.exports = { \"default\": __webpack_require__(45), __esModule: true };//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNDQuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYmFiZWwtcnVudGltZS9jb3JlLWpzL29iamVjdC9nZXQtcHJvdG90eXBlLW9mLmpzPzY3MWUiXSwic291cmNlc0NvbnRlbnQiOlsibW9kdWxlLmV4cG9ydHMgPSB7IFwiZGVmYXVsdFwiOiByZXF1aXJlKFwiY29yZS1qcy9saWJyYXJ5L2ZuL29iamVjdC9nZXQtcHJvdG90eXBlLW9mXCIpLCBfX2VzTW9kdWxlOiB0cnVlIH07XG5cblxuLy8vLy8vLy8vLy8vLy8vLy8vXG4vLyBXRUJQQUNLIEZPT1RFUlxuLy8gLi9ub2RlX21vZHVsZXMvYmFiZWwtcnVudGltZS9jb3JlLWpzL29iamVjdC9nZXQtcHJvdG90eXBlLW9mLmpzXG4vLyBtb2R1bGUgaWQgPSA0NFxuLy8gbW9kdWxlIGNodW5rcyA9IDAiXSwibWFwcGluZ3MiOiJBQUFBIiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///44\n");
339
+
340
+ /***/ }),
341
+ /* 45 */
342
+ /***/ (function(module, exports, __webpack_require__) {
343
+
344
+ eval("__webpack_require__(46);\nmodule.exports = __webpack_require__(0).Object.getPrototypeOf;\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNDUuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L2ZuL29iamVjdC9nZXQtcHJvdG90eXBlLW9mLmpzPzdkMmUiXSwic291cmNlc0NvbnRlbnQiOlsicmVxdWlyZSgnLi4vLi4vbW9kdWxlcy9lczYub2JqZWN0LmdldC1wcm90b3R5cGUtb2YnKTtcbm1vZHVsZS5leHBvcnRzID0gcmVxdWlyZSgnLi4vLi4vbW9kdWxlcy9fY29yZScpLk9iamVjdC5nZXRQcm90b3R5cGVPZjtcblxuXG5cbi8vLy8vLy8vLy8vLy8vLy8vL1xuLy8gV0VCUEFDSyBGT09URVJcbi8vIC4vbm9kZV9tb2R1bGVzL2NvcmUtanMvbGlicmFyeS9mbi9vYmplY3QvZ2V0LXByb3RvdHlwZS1vZi5qc1xuLy8gbW9kdWxlIGlkID0gNDVcbi8vIG1vZHVsZSBjaHVua3MgPSAwIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///45\n");
345
+
346
+ /***/ }),
347
+ /* 46 */
348
+ /***/ (function(module, exports, __webpack_require__) {
349
+
350
+ eval("// 19.1.2.9 Object.getPrototypeOf(O)\nvar toObject = __webpack_require__(28);\nvar $getPrototypeOf = __webpack_require__(29);\n\n__webpack_require__(47)('getPrototypeOf', function () {\n return function getPrototypeOf(it) {\n return $getPrototypeOf(toObject(it));\n };\n});\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNDYuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvZXM2Lm9iamVjdC5nZXQtcHJvdG90eXBlLW9mLmpzPzJhMWUiXSwic291cmNlc0NvbnRlbnQiOlsiLy8gMTkuMS4yLjkgT2JqZWN0LmdldFByb3RvdHlwZU9mKE8pXG52YXIgdG9PYmplY3QgPSByZXF1aXJlKCcuL190by1vYmplY3QnKTtcbnZhciAkZ2V0UHJvdG90eXBlT2YgPSByZXF1aXJlKCcuL19vYmplY3QtZ3BvJyk7XG5cbnJlcXVpcmUoJy4vX29iamVjdC1zYXAnKSgnZ2V0UHJvdG90eXBlT2YnLCBmdW5jdGlvbiAoKSB7XG4gIHJldHVybiBmdW5jdGlvbiBnZXRQcm90b3R5cGVPZihpdCkge1xuICAgIHJldHVybiAkZ2V0UHJvdG90eXBlT2YodG9PYmplY3QoaXQpKTtcbiAgfTtcbn0pO1xuXG5cblxuLy8vLy8vLy8vLy8vLy8vLy8vXG4vLyBXRUJQQUNLIEZPT1RFUlxuLy8gLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvZXM2Lm9iamVjdC5nZXQtcHJvdG90eXBlLW9mLmpzXG4vLyBtb2R1bGUgaWQgPSA0NlxuLy8gbW9kdWxlIGNodW5rcyA9IDAiXSwibWFwcGluZ3MiOiJBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///46\n");
351
+
352
+ /***/ }),
353
+ /* 47 */
354
+ /***/ (function(module, exports, __webpack_require__) {
355
+
356
+ eval("// most Object methods by ES6 should accept primitives\nvar $export = __webpack_require__(5);\nvar core = __webpack_require__(0);\nvar fails = __webpack_require__(11);\nmodule.exports = function (KEY, exec) {\n var fn = (core.Object || {})[KEY] || Object[KEY];\n var exp = {};\n exp[KEY] = exec(fn);\n $export($export.S + $export.F * fails(function () { fn(1); }), 'Object', exp);\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNDcuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX29iamVjdC1zYXAuanM/YmFhNSJdLCJzb3VyY2VzQ29udGVudCI6WyIvLyBtb3N0IE9iamVjdCBtZXRob2RzIGJ5IEVTNiBzaG91bGQgYWNjZXB0IHByaW1pdGl2ZXNcbnZhciAkZXhwb3J0ID0gcmVxdWlyZSgnLi9fZXhwb3J0Jyk7XG52YXIgY29yZSA9IHJlcXVpcmUoJy4vX2NvcmUnKTtcbnZhciBmYWlscyA9IHJlcXVpcmUoJy4vX2ZhaWxzJyk7XG5tb2R1bGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChLRVksIGV4ZWMpIHtcbiAgdmFyIGZuID0gKGNvcmUuT2JqZWN0IHx8IHt9KVtLRVldIHx8IE9iamVjdFtLRVldO1xuICB2YXIgZXhwID0ge307XG4gIGV4cFtLRVldID0gZXhlYyhmbik7XG4gICRleHBvcnQoJGV4cG9ydC5TICsgJGV4cG9ydC5GICogZmFpbHMoZnVuY3Rpb24gKCkgeyBmbigxKTsgfSksICdPYmplY3QnLCBleHApO1xufTtcblxuXG5cbi8vLy8vLy8vLy8vLy8vLy8vL1xuLy8gV0VCUEFDSyBGT09URVJcbi8vIC4vbm9kZV9tb2R1bGVzL2NvcmUtanMvbGlicmFyeS9tb2R1bGVzL19vYmplY3Qtc2FwLmpzXG4vLyBtb2R1bGUgaWQgPSA0N1xuLy8gbW9kdWxlIGNodW5rcyA9IDAiXSwibWFwcGluZ3MiOiJBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///47\n");
357
+
358
+ /***/ }),
359
+ /* 48 */
360
+ /***/ (function(module, exports) {
361
+
362
+ eval("module.exports = function (it) {\n if (typeof it != 'function') throw TypeError(it + ' is not a function!');\n return it;\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNDguanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX2EtZnVuY3Rpb24uanM/OTRlOSJdLCJzb3VyY2VzQ29udGVudCI6WyJtb2R1bGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChpdCkge1xuICBpZiAodHlwZW9mIGl0ICE9ICdmdW5jdGlvbicpIHRocm93IFR5cGVFcnJvcihpdCArICcgaXMgbm90IGEgZnVuY3Rpb24hJyk7XG4gIHJldHVybiBpdDtcbn07XG5cblxuXG4vLy8vLy8vLy8vLy8vLy8vLy9cbi8vIFdFQlBBQ0sgRk9PVEVSXG4vLyAuL25vZGVfbW9kdWxlcy9jb3JlLWpzL2xpYnJhcnkvbW9kdWxlcy9fYS1mdW5jdGlvbi5qc1xuLy8gbW9kdWxlIGlkID0gNDhcbi8vIG1vZHVsZSBjaHVua3MgPSAwIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///48\n");
363
+
364
+ /***/ }),
365
+ /* 49 */
366
+ /***/ (function(module, exports, __webpack_require__) {
367
+
368
+ "use strict";
369
+ eval("\n\nexports.__esModule = true;\n\nexports.default = function (instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n};//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNDkuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYmFiZWwtcnVudGltZS9oZWxwZXJzL2NsYXNzQ2FsbENoZWNrLmpzPzY2YjkiXSwic291cmNlc0NvbnRlbnQiOlsiXCJ1c2Ugc3RyaWN0XCI7XG5cbmV4cG9ydHMuX19lc01vZHVsZSA9IHRydWU7XG5cbmV4cG9ydHMuZGVmYXVsdCA9IGZ1bmN0aW9uIChpbnN0YW5jZSwgQ29uc3RydWN0b3IpIHtcbiAgaWYgKCEoaW5zdGFuY2UgaW5zdGFuY2VvZiBDb25zdHJ1Y3RvcikpIHtcbiAgICB0aHJvdyBuZXcgVHlwZUVycm9yKFwiQ2Fubm90IGNhbGwgYSBjbGFzcyBhcyBhIGZ1bmN0aW9uXCIpO1xuICB9XG59O1xuXG5cbi8vLy8vLy8vLy8vLy8vLy8vL1xuLy8gV0VCUEFDSyBGT09URVJcbi8vIC4vbm9kZV9tb2R1bGVzL2JhYmVsLXJ1bnRpbWUvaGVscGVycy9jbGFzc0NhbGxDaGVjay5qc1xuLy8gbW9kdWxlIGlkID0gNDlcbi8vIG1vZHVsZSBjaHVua3MgPSAwIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///49\n");
370
+
371
+ /***/ }),
372
+ /* 50 */
373
+ /***/ (function(module, exports, __webpack_require__) {
374
+
375
+ "use strict";
376
+ eval("\n\nexports.__esModule = true;\n\nvar _defineProperty = __webpack_require__(51);\n\nvar _defineProperty2 = _interopRequireDefault(_defineProperty);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nexports.default = function () {\n function defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n (0, _defineProperty2.default)(target, descriptor.key, descriptor);\n }\n }\n\n return function (Constructor, protoProps, staticProps) {\n if (protoProps) defineProperties(Constructor.prototype, protoProps);\n if (staticProps) defineProperties(Constructor, staticProps);\n return Constructor;\n };\n}();//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNTAuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYmFiZWwtcnVudGltZS9oZWxwZXJzL2NyZWF0ZUNsYXNzLmpzP2MzMTAiXSwic291cmNlc0NvbnRlbnQiOlsiXCJ1c2Ugc3RyaWN0XCI7XG5cbmV4cG9ydHMuX19lc01vZHVsZSA9IHRydWU7XG5cbnZhciBfZGVmaW5lUHJvcGVydHkgPSByZXF1aXJlKFwiLi4vY29yZS1qcy9vYmplY3QvZGVmaW5lLXByb3BlcnR5XCIpO1xuXG52YXIgX2RlZmluZVByb3BlcnR5MiA9IF9pbnRlcm9wUmVxdWlyZURlZmF1bHQoX2RlZmluZVByb3BlcnR5KTtcblxuZnVuY3Rpb24gX2ludGVyb3BSZXF1aXJlRGVmYXVsdChvYmopIHsgcmV0dXJuIG9iaiAmJiBvYmouX19lc01vZHVsZSA/IG9iaiA6IHsgZGVmYXVsdDogb2JqIH07IH1cblxuZXhwb3J0cy5kZWZhdWx0ID0gZnVuY3Rpb24gKCkge1xuICBmdW5jdGlvbiBkZWZpbmVQcm9wZXJ0aWVzKHRhcmdldCwgcHJvcHMpIHtcbiAgICBmb3IgKHZhciBpID0gMDsgaSA8IHByb3BzLmxlbmd0aDsgaSsrKSB7XG4gICAgICB2YXIgZGVzY3JpcHRvciA9IHByb3BzW2ldO1xuICAgICAgZGVzY3JpcHRvci5lbnVtZXJhYmxlID0gZGVzY3JpcHRvci5lbnV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/ (function(module, exports, __webpack_require__) {
381
+
382
+ eval("module.exports = { \"default\": __webpack_require__(52), __esModule: true };//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNTEuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYmFiZWwtcnVudGltZS9jb3JlLWpzL29iamVjdC9kZWZpbmUtcHJvcGVydHkuanM/MGI4MyJdLCJzb3VyY2VzQ29udGVudCI6WyJtb2R1bGUuZXhwb3J0cyA9IHsgXCJkZWZhdWx0XCI6IHJlcXVpcmUoXCJjb3JlLWpzL2xpYnJhcnkvZm4vb2JqZWN0L2RlZmluZS1wcm9wZXJ0eVwiKSwgX19lc01vZHVsZTogdHJ1ZSB9O1xuXG5cbi8vLy8vLy8vLy8vLy8vLy8vL1xuLy8gV0VCUEFDSyBGT09URVJcbi8vIC4vbm9kZV9tb2R1bGVzL2JhYmVsLXJ1bnRpbWUvY29yZS1qcy9vYmplY3QvZGVmaW5lLXByb3BlcnR5LmpzXG4vLyBtb2R1bGUgaWQgPSA1MVxuLy8gbW9kdWxlIGNodW5rcyA9IDAiXSwibWFwcGluZ3MiOiJBQUFBIiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///51\n");
383
+
384
+ /***/ }),
385
+ /* 52 */
386
+ /***/ (function(module, exports, __webpack_require__) {
387
+
388
+ eval("__webpack_require__(53);\nvar $Object = __webpack_require__(0).Object;\nmodule.exports = function defineProperty(it, key, desc) {\n return $Object.defineProperty(it, key, desc);\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNTIuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L2ZuL29iamVjdC9kZWZpbmUtcHJvcGVydHkuanM/ZjViMCJdLCJzb3VyY2VzQ29udGVudCI6WyJyZXF1aXJlKCcuLi8uLi9tb2R1bGVzL2VzNi5vYmplY3QuZGVmaW5lLXByb3BlcnR5Jyk7XG52YXIgJE9iamVjdCA9IHJlcXVpcmUoJy4uLy4uL21vZHVsZXMvX2NvcmUnKS5PYmplY3Q7XG5tb2R1bGUuZXhwb3J0cyA9IGZ1bmN0aW9uIGRlZmluZVByb3BlcnR5KGl0LCBrZXksIGRlc2MpIHtcbiAgcmV0dXJuICRPYmplY3QuZGVmaW5lUHJvcGVydHkoaXQsIGtleSwgZGVzYyk7XG59O1xuXG5cblxuLy8vLy8vLy8vLy8vLy8vLy8vXG4vLyBXRUJQQUNLIEZPT1RFUlxuLy8gLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L2ZuL29iamVjdC9kZWZpbmUtcHJvcGVydHkuanNcbi8vIG1vZHVsZSBpZCA9IDUyXG4vLyBtb2R1bGUgY2h1bmtzID0gMCJdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///52\n");
389
+
390
+ /***/ }),
391
+ /* 53 */
392
+ /***/ (function(module, exports, __webpack_require__) {
393
+
394
+ eval("var $export = __webpack_require__(5);\n// 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes)\n$export($export.S + $export.F * !__webpack_require__(4), 'Object', { defineProperty: __webpack_require__(3).f });\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNTMuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvZXM2Lm9iamVjdC5kZWZpbmUtcHJvcGVydHkuanM/OTgyOSJdLCJzb3VyY2VzQ29udGVudCI6WyJ2YXIgJGV4cG9ydCA9IHJlcXVpcmUoJy4vX2V4cG9ydCcpO1xuLy8gMTkuMS4yLjQgLyAxNS4yLjMuNiBPYmplY3QuZGVmaW5lUHJvcGVydHkoTywgUCwgQXR0cmlidXRlcylcbiRleHBvcnQoJGV4cG9ydC5TICsgJGV4cG9ydC5GICogIXJlcXVpcmUoJy4vX2Rlc2NyaXB0b3JzJyksICdPYmplY3QnLCB7IGRlZmluZVByb3BlcnR5OiByZXF1aXJlKCcuL19vYmplY3QtZHAnKS5mIH0pO1xuXG5cblxuLy8vLy8vLy8vLy8vLy8vLy8vXG4vLyBXRUJQQUNLIEZPT1RFUlxuLy8gLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvZXM2Lm9iamVjdC5kZWZpbmUtcHJvcGVydHkuanNcbi8vIG1vZHVsZSBpZCA9IDUzXG4vLyBtb2R1bGUgY2h1bmtzID0gMCJdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///53\n");
395
+
396
+ /***/ }),
397
+ /* 54 */
398
+ /***/ (function(module, exports, __webpack_require__) {
399
+
400
+ "use strict";
401
+ eval("\n\nexports.__esModule = true;\n\nvar _typeof2 = __webpack_require__(33);\n\nvar _typeof3 = _interopRequireDefault(_typeof2);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nexports.default = function (self, call) {\n if (!self) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return call && ((typeof call === \"undefined\" ? \"undefined\" : (0, _typeof3.default)(call)) === \"object\" || typeof call === \"function\") ? call : self;\n};//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNTQuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYmFiZWwtcnVudGltZS9oZWxwZXJzL3Bvc3NpYmxlQ29uc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DQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///54\n");
402
+
403
+ /***/ }),
404
+ /* 55 */
405
+ /***/ (function(module, exports, __webpack_require__) {
406
+
407
+ eval("module.exports = { \"default\": __webpack_require__(56), __esModule: true };//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNTUuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYmFiZWwtcnVudGltZS9jb3JlLWpzL3N5bWJvbC9pdGVyYXRvci5qcz82NzM4Il0sInNvdXJjZXNDb250ZW50IjpbIm1vZHVsZS5leHBvcnRzID0geyBcImRlZmF1bHRcIjogcmVxdWlyZShcImNvcmUtanMvbGlicmFyeS9mbi9zeW1ib2wvaXRlcmF0b3JcIiksIF9fZXNNb2R1bGU6IHRydWUgfTtcblxuXG4vLy8vLy8vLy8vLy8vLy8vLy9cbi8vIFdFQlBBQ0sgRk9PVEVSXG4vLyAuL25vZGVfbW9kdWxlcy9iYWJlbC1ydW50aW1lL2NvcmUtanMvc3ltYm9sL2l0ZXJhdG9yLmpzXG4vLyBtb2R1bGUgaWQgPSA1NVxuLy8gbW9kdWxlIGNodW5rcyA9IDAiXSwibWFwcGluZ3MiOiJBQUFBIiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///55\n");
408
+
409
+ /***/ }),
410
+ /* 56 */
411
+ /***/ (function(module, exports, __webpack_require__) {
412
+
413
+ eval("__webpack_require__(57);\n__webpack_require__(66);\nmodule.exports = __webpack_require__(25).f('iterator');\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNTYuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L2ZuL3N5bWJvbC9pdGVyYXRvci5qcz9mZTdlIl0sInNvdXJjZXNDb250ZW50IjpbInJlcXVpcmUoJy4uLy4uL21vZHVsZXMvZXM2LnN0cmluZy5pdGVyYXRvcicpO1xucmVxdWlyZSgnLi4vLi4vbW9kdWxlcy93ZWIuZG9tLml0ZXJhYmxlJyk7XG5tb2R1bGUuZXhwb3J0cyA9IHJlcXVpcmUoJy4uLy4uL21vZHVsZXMvX3drcy1leHQnKS5mKCdpdGVyYXRvcicpO1xuXG5cblxuLy8vLy8vLy8vLy8vLy8vLy8vXG4vLyBXRUJQQUNLIEZPT1RFUlxuLy8gLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L2ZuL3N5bWJvbC9pdGVyYXRvci5qc1xuLy8gbW9kdWxlIGlkID0gNTZcbi8vIG1vZHVsZSBjaHVua3MgPSAwIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7Iiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///56\n");
414
+
415
+ /***/ }),
416
+ /* 57 */
417
+ /***/ (function(module, exports, __webpack_require__) {
418
+
419
+ "use strict";
420
+ eval("\nvar $at = __webpack_require__(58)(true);\n\n// 21.1.3.27 String.prototype[@@iterator]()\n__webpack_require__(34)(String, 'String', function (iterated) {\n this._t = String(iterated); // target\n this._i = 0; // next index\n// 21.1.5.2.1 %StringIteratorPrototype%.next()\n}, function () {\n var O = this._t;\n var index = this._i;\n var point;\n if (index >= O.length) return { value: undefined, done: true };\n point = $at(O, index);\n this._i += point.length;\n return { value: point, done: false };\n});\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNTcuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1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QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///57\n");
421
+
422
+ /***/ }),
423
+ /* 58 */
424
+ /***/ (function(module, exports, __webpack_require__) {
425
+
426
+ eval("var toInteger = __webpack_require__(19);\nvar defined = __webpack_require__(15);\n// true -> String#at\n// false -> String#codePointAt\nmodule.exports = function (TO_STRING) {\n return function (that, pos) {\n var s = String(defined(that));\n var i = toInteger(pos);\n var l = s.length;\n var a, b;\n if (i < 0 || i >= l) return TO_STRING ? '' : undefined;\n a = s.charCodeAt(i);\n return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff\n ? TO_STRING ? s.charAt(i) : a\n : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;\n };\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNTguanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX3N0cmluZy1hdC5qcz84N2FlIl0sInNvdXJjZXNDb250ZW50IjpbInZhciB0b0ludGVnZXIgPSByZXF1aXJlKCcuL190by1pbnRlZ2VyJyk7XG52YXIgZGVmaW5lZCA9IHJlcXVpcmUoJy4vX2RlZmluZWQnKTtcbi8vIHRydWUgIC0+IFN0cmluZyNhdFxuLy8gZmFsc2UgLT4gU3RyaW5nI2NvZGVQb2ludEF0XG5tb2R1bGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChUT19TVFJJTkcpIHtcbiAgcmV0dXJuIGZ1bmN0aW9uICh0aGF0LCBwb3MpIHtcbiAgICB2YXIgcyA9IFN0cmluZyhkZWZpbmVkKHRoYXQpKTtcbiAgICB2YXIgaSA9IHRvSW50ZWdlcihwb3MpO1xuICAgIHZhciBsID0gcy5sZW5ndGg7XG4gICAgdmFyIGEsIGI7XG4gICAgaWYgKGkgPCAwIHx8IGkgPj0gbCkgcmV0dXJuIFRPX1NUUklORyA/ICcnIDogdW5kZWZpbmVkO1xuICAgIGEgPSBzLmNoYXJDb2RlQXQoaSk7XG4gICAgcmV0dXJuIGEgPCAweGQ4MDAgfHwgYSA+IDB4ZGJmZiB8fCBpICsgMSA9PT0gbCB8fCAoYiA9IHMuY2hhckNvZGVBdChpICsgMSkpIDwgMHhkYzAwIHx8IGIgPiAweGRmZmZcbiAgICAgID8gVE9fU1RSSU5HID8gcy5jaGFyQXQoaSkgOiBhXG4gICAgICA6IFRPX1NUUklORyA/IHMuc2xpY2UoaSwgaSArIDIpIDogKGEgLSAweGQ4MDAgPDwgMTApICsgKGIgLSAweGRjMDApICsgMHgxMDAwMDtcbiAgfTtcbn07XG5cblxuXG4vLy8vLy8vLy8vLy8vLy8vLy9cbi8vIFdFQlBBQ0sgRk9PVEVSXG4vLyAuL25vZGVfbW9kdWxlcy9jb3JlLWpzL2xpYnJhcnkvbW9kdWxlcy9fc3RyaW5nLWF0LmpzXG4vLyBtb2R1bGUgaWQgPSA1OFxuLy8gbW9kdWxlIGNodW5rcyA9IDAiXSwibWFwcGluZ3MiOiJBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7Iiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///58\n");
427
+
428
+ /***/ }),
429
+ /* 59 */
430
+ /***/ (function(module, exports, __webpack_require__) {
431
+
432
+ "use strict";
433
+ eval("\nvar create = __webpack_require__(21);\nvar descriptor = __webpack_require__(14);\nvar setToStringTag = __webpack_require__(24);\nvar IteratorPrototype = {};\n\n// 25.1.2.1.1 %IteratorPrototype%[@@iterator]()\n__webpack_require__(6)(IteratorPrototype, __webpack_require__(9)('iterator'), function () { return this; });\n\nmodule.exports = function (Constructor, NAME, next) {\n Constructor.prototype = create(IteratorPrototype, { next: descriptor(1, next) });\n setToStringTag(Constructor, NAME + ' Iterator');\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNTkuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX2l0ZXItY3JlYXRlLmpzP2Y3ODUiXSwic291cmNlc0NvbnRlbnQiOlsiJ3VzZSBzdHJpY3QnO1xudmFyIGNyZWF0ZSA9IHJlcXVpcmUoJy4vX29iamVjdC1jcmVhdGUnKTtcbnZhciBkZXNjcmlwdG9yID0gcmVxdWlyZSgnLi9fcHJvcGVydHktZGVzYycpO1xudmFyIHNldFRvU3RyaW5nVGFnID0gcmVxdWlyZSgnLi9fc2V0LXRvLXN0cmluZy10YWcnKTtcbnZhciBJdGVyYXRvclByb3RvdHlwZSA9IHt9O1xuXG4vLyAyNS4xLjIuMS4xICVJdGVyYXRvclByb3RvdHlwZSVbQEBpdGVyYXRvcl0oKVxucmVxdWlyZSgnLi9faGlkZScpKEl0ZXJhdG9yUHJvdG90eXBlLCByZXF1aXJlKCcuL193a3MnKSgnaXRlcmF0b3InKSwgZnVuY3Rpb24gKCkgeyByZXR1cm4gdGhpczsgfSk7XG5cbm1vZHVsZS5leHBvcnRzID0gZnVuY3Rpb24gKENvbnN0cnVjdG9yLCBOQU1FLCBuZXh0KSB7XG4gIENvbnN0cnVjdG9yLnByb3RvdHlwZSA9IGNyZWF0ZShJdGVyYXRvclByb3RvdHlwZSwgeyBuZXh0OiBkZXNjcmlwdG9yKDEsIG5leHQpIH0pO1xuICBzZXRUb1N0cmluZ1RhZyhDb25zdHJ1Y3RvciwgTkFNRSArICcgSXRlcmF0b3InKTtcbn07XG5cblxuXG4vLy8vLy8vLy8vLy8vLy8vLy9cbi8vIFdFQlBBQ0sgRk9PVEVSXG4vLyAuL25vZGVfbW9kdWxlcy9jb3JlLWpzL2xpYnJhcnkvbW9kdWxlcy9faXRlci1jcmVhdGUuanNcbi8vIG1vZHVsZSBpZCA9IDU5XG4vLyBtb2R1bGUgY2h1bmtzID0gMCJdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7Iiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///59\n");
434
+
435
+ /***/ }),
436
+ /* 60 */
437
+ /***/ (function(module, exports, __webpack_require__) {
438
+
439
+ eval("var dP = __webpack_require__(3);\nvar anObject = __webpack_require__(10);\nvar getKeys = __webpack_require__(22);\n\nmodule.exports = __webpack_require__(4) ? Object.defineProperties : function defineProperties(O, Properties) {\n anObject(O);\n var keys = getKeys(Properties);\n var length = keys.length;\n var i = 0;\n var P;\n while (length > i) dP.f(O, P = keys[i++], Properties[P]);\n return O;\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNjAuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX29iamVjdC1kcHMuanM/YWEyYSJdLCJzb3VyY2VzQ29udGVudCI6WyJ2YXIgZFAgPSByZXF1aXJlKCcuL19vYmplY3QtZHAnKTtcbnZhciBhbk9iamVjdCA9IHJlcXVpcmUoJy4vX2FuLW9iamVjdCcpO1xudmFyIGdldEtleXMgPSByZXF1aXJlKCcuL19vYmplY3Qta2V5cycpO1xuXG5tb2R1bGUuZXhwb3J0cyA9IHJlcXVpcmUoJy4vX2Rlc2NyaXB0b3JzJykgPyBPYmplY3QuZGVmaW5lUHJvcGVydGllcyA6IGZ1bmN0aW9uIGRlZmluZVByb3BlcnRpZXMoTywgUHJvcGVydGllcykge1xuICBhbk9iamVjdChPKTtcbiAgdmFyIGtleXMgPSBnZXRLZXlzKFByb3BlcnRpZXMpO1xuICB2YXIgbGVuZ3RoID0ga2V5cy5sZW5ndGg7XG4gIHZhciBpID0gMDtcbiAgdmFyIFA7XG4gIHdoaWxlIChsZW5ndGggPiBpKSBkUC5mKE8sIFAgPSBrZXlzW2krK10sIFByb3BlcnRpZXNbUF0pO1xuICByZXR1cm4gTztcbn07XG5cblxuXG4vLy8vLy8vLy8vLy8vLy8vLy9cbi8vIFdFQlBBQ0sgRk9PVEVSXG4vLyAuL25vZGVfbW9kdWxlcy9jb3JlLWpzL2xpYnJhcnkvbW9kdWxlcy9fb2JqZWN0LWRwcy5qc1xuLy8gbW9kdWxlIGlkID0gNjBcbi8vIG1vZHVsZSBjaHVua3MgPSAwIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///60\n");
440
+
441
+ /***/ }),
442
+ /* 61 */
443
+ /***/ (function(module, exports, __webpack_require__) {
444
+
445
+ eval("// fallback for non-array-like ES3 and non-enumerable old V8 strings\nvar cof = __webpack_require__(37);\n// eslint-disable-next-line no-prototype-builtins\nmodule.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) {\n return cof(it) == 'String' ? it.split('') : Object(it);\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNjEuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX2lvYmplY3QuanM/MzE0ZSJdLCJzb3VyY2VzQ29udGVudCI6WyIvLyBmYWxsYmFjayBmb3Igbm9uLWFycmF5LWxpa2UgRVMzIGFuZCBub24tZW51bWVyYWJsZSBvbGQgVjggc3RyaW5nc1xudmFyIGNvZiA9IHJlcXVpcmUoJy4vX2NvZicpO1xuLy8gZXNsaW50LWRpc2FibGUtbmV4dC1saW5lIG5vLXByb3RvdHlwZS1idWlsdGluc1xubW9kdWxlLmV4cG9ydHMgPSBPYmplY3QoJ3onKS5wcm9wZXJ0eUlzRW51bWVyYWJsZSgwKSA/IE9iamVjdCA6IGZ1bmN0aW9uIChpdCkge1xuICByZXR1cm4gY29mKGl0KSA9PSAnU3RyaW5nJyA/IGl0LnNwbGl0KCcnKSA6IE9iamVjdChpdCk7XG59O1xuXG5cblxuLy8vLy8vLy8vLy8vLy8vLy8vXG4vLyBXRUJQQUNLIEZPT1RFUlxuLy8gLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX2lvYmplY3QuanNcbi8vIG1vZHVsZSBpZCA9IDYxXG4vLyBtb2R1bGUgY2h1bmtzID0gMCJdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///61\n");
446
+
447
+ /***/ }),
448
+ /* 62 */
449
+ /***/ (function(module, exports, __webpack_require__) {
450
+
451
+ eval("// false -> Array#indexOf\n// true -> Array#includes\nvar toIObject = __webpack_require__(8);\nvar toLength = __webpack_require__(63);\nvar toAbsoluteIndex = __webpack_require__(64);\nmodule.exports = function (IS_INCLUDES) {\n return function ($this, el, fromIndex) {\n var O = toIObject($this);\n var length = toLength(O.length);\n var index = toAbsoluteIndex(fromIndex, length);\n var value;\n // Array#includes uses SameValueZero equality algorithm\n // eslint-disable-next-line no-self-compare\n if (IS_INCLUDES && el != el) while (length > index) {\n value = O[index++];\n // eslint-disable-next-line no-self-compare\n if (value != value) return true;\n // Array#indexOf ignores holes, Array#includes - not\n } else for (;length > index; index++) if (IS_INCLUDES || index in O) {\n if (O[index] === el) return IS_INCLUDES || index || 0;\n } return !IS_INCLUDES && -1;\n };\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNjIuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX2FycmF5LWluY2x1ZGVzLmpzP2JjNTciXSwic291cmNlc0NvbnRlbnQiOlsiLy8gZmFsc2UgLT4gQXJyYXkjaW5kZXhPZlxuLy8gdHJ1ZSAgLT4gQXJyYXkjaW5jbHVkZXNcbnZhciB0b0lPYmplY3QgPSByZXF1aXJlKCcuL190by1pb2JqZWN0Jyk7XG52YXIgdG9MZW5ndGggPSByZXF1aXJlKCcuL190by1sZW5ndGgnKTtcbnZhciB0b0Fic29sdXRlSW5kZXggPSByZXF1aXJlKCcuL190by1hYnNvbHV0ZS1pbmRleCcpO1xubW9kdWxlLmV4cG9ydHMgPSBmdW5jdGlvbiAoSVNfSU5DTFVERVMpIHtcbiAgcmV0dXJuIGZ1bmN0aW9uICgkdGhpcywgZWwsIGZyb21JbmRleCkge1xuICAgIHZhciBPID0gdG9JT2JqZWN0KCR0aGlzKTtcbiAgICB2YXIgbGVuZ3RoID0gdG9MZW5ndGgoTy5sZW5ndGgpO1xuICAgIHZhciBpbmRleCA9IHRvQWJzb2x1dGVJbmRleChmcm9tSW5kZXgsIGxlbmd0aCk7XG4gICAgdmFyIHZhbHVlO1xuICAgIC8vIEFycmF5I2luY2x1ZGVzIHVzZXMgU2FtZVZhbHVlWmVybyBlcXVhbGl0eSBhbGdvcml0aG1cbiAgICAvLyBlc2xpbnQtZGlzYWJsZS1uZXh0LWxpbmUgbm8tc2VsZi1jb21wYXJlXG4gICAgaWYgKElTX0lOQ0xVREVTICYmIGVsICE9IGVsKSB3aGlsZSAobGVuZ3RoID4gaW5kZXgpIHtcbiAgICAgIHZhbHVlID0gT1tpbmRleCsrXTtcbiAgICAgIC8vIGVzbGludC1kaXNhYmxlLW5leHQtbGluZSBuby1zZWxmLWNvbXBhcmVcbiAgICAgIGlmICh2YWx1ZSAhPSB2YWx1ZSkgcmV0dXJuIHRydWU7XG4gICAgLy8gQXJyYXkjaW5kZXhPZiBpZ25vcmVzIGhvbGVzLCBBcnJheSNpbmNsdWRlcyAtIG5vdFxuICAgIH0gZWxzZSBmb3IgKDtsZW5ndGggPiBpbmRleDsgaW5kZXgrKykgaWYgKElTX0lOQ0xVREVTIHx8IGluZGV4IGluIE8pIHtcbiAgICAgIGlmIChPW2luZGV4XSA9PT0gZWwpIHJldHVybiBJU19JTkNMVURFUyB8fCBpbmRleCB8fCAwO1xuICAgIH0gcmV0dXJuICFJU19JTkNMVURFUyAmJiAtMTtcbiAgfTtcbn07XG5cblxuXG4vLy8vLy8vLy8vLy8vLy8vLy9cbi8vIFdFQlBBQ0sgRk9PVEVSXG4vLyAuL25vZGVfbW9kdWxlcy9jb3JlLWpzL2xpYnJhcnkvbW9kdWxlcy9fYXJyYXktaW5jbHVkZXMuanNcbi8vIG1vZHVsZSBpZCA9IDYyXG4vLyBtb2R1bGUgY2h1bmtzID0gMCJdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///62\n");
452
+
453
+ /***/ }),
454
+ /* 63 */
455
+ /***/ (function(module, exports, __webpack_require__) {
456
+
457
+ eval("// 7.1.15 ToLength\nvar toInteger = __webpack_require__(19);\nvar min = Math.min;\nmodule.exports = function (it) {\n return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNjMuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX3RvLWxlbmd0aC5qcz80MTExIl0sInNvdXJjZXNDb250ZW50IjpbIi8vIDcuMS4xNSBUb0xlbmd0aFxudmFyIHRvSW50ZWdlciA9IHJlcXVpcmUoJy4vX3RvLWludGVnZXInKTtcbnZhciBtaW4gPSBNYXRoLm1pbjtcbm1vZHVsZS5leHBvcnRzID0gZnVuY3Rpb24gKGl0KSB7XG4gIHJldHVybiBpdCA+IDAgPyBtaW4odG9JbnRlZ2VyKGl0KSwgMHgxZmZmZmZmZmZmZmZmZikgOiAwOyAvLyBwb3coMiwgNTMpIC0gMSA9PSA5MDA3MTk5MjU0NzQwOTkxXG59O1xuXG5cblxuLy8vLy8vLy8vLy8vLy8vLy8vXG4vLyBXRUJQQUNLIEZPT1RFUlxuLy8gLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX3RvLWxlbmd0aC5qc1xuLy8gbW9kdWxlIGlkID0gNjNcbi8vIG1vZHVsZSBjaHVua3MgPSAwIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7Iiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///63\n");
458
+
459
+ /***/ }),
460
+ /* 64 */
461
+ /***/ (function(module, exports, __webpack_require__) {
462
+
463
+ eval("var toInteger = __webpack_require__(19);\nvar max = Math.max;\nvar min = Math.min;\nmodule.exports = function (index, length) {\n index = toInteger(index);\n return index < 0 ? max(index + length, 0) : min(index, length);\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNjQuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX3RvLWFic29sdXRlLWluZGV4LmpzPzdlNDAiXSwic291cmNlc0NvbnRlbnQiOlsidmFyIHRvSW50ZWdlciA9IHJlcXVpcmUoJy4vX3RvLWludGVnZXInKTtcbnZhciBtYXggPSBNYXRoLm1heDtcbnZhciBtaW4gPSBNYXRoLm1pbjtcbm1vZHVsZS5leHBvcnRzID0gZnVuY3Rpb24gKGluZGV4LCBsZW5ndGgpIHtcbiAgaW5kZXggPSB0b0ludGVnZXIoaW5kZXgpO1xuICByZXR1cm4gaW5kZXggPCAwID8gbWF4KGluZGV4ICsgbGVuZ3RoLCAwKSA6IG1pbihpbmRleCwgbGVuZ3RoKTtcbn07XG5cblxuXG4vLy8vLy8vLy8vLy8vLy8vLy9cbi8vIFdFQlBBQ0sgRk9PVEVSXG4vLyAuL25vZGVfbW9kdWxlcy9jb3JlLWpzL2xpYnJhcnkvbW9kdWxlcy9fdG8tYWJzb2x1dGUtaW5kZXguanNcbi8vIG1vZHVsZSBpZCA9IDY0XG4vLyBtb2R1bGUgY2h1bmtzID0gMCJdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7Iiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///64\n");
464
+
465
+ /***/ }),
466
+ /* 65 */
467
+ /***/ (function(module, exports, __webpack_require__) {
468
+
469
+ eval("var document = __webpack_require__(1).document;\nmodule.exports = document && document.documentElement;\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNjUuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX2h0bWwuanM/NDRmMiJdLCJzb3VyY2VzQ29udGVudCI6WyJ2YXIgZG9jdW1lbnQgPSByZXF1aXJlKCcuL19nbG9iYWwnKS5kb2N1bWVudDtcbm1vZHVsZS5leHBvcnRzID0gZG9jdW1lbnQgJiYgZG9jdW1lbnQuZG9jdW1lbnRFbGVtZW50O1xuXG5cblxuLy8vLy8vLy8vLy8vLy8vLy8vXG4vLyBXRUJQQUNLIEZPT1RFUlxuLy8gLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX2h0bWwuanNcbi8vIG1vZHVsZSBpZCA9IDY1XG4vLyBtb2R1bGUgY2h1bmtzID0gMCJdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///65\n");
470
+
471
+ /***/ }),
472
+ /* 66 */
473
+ /***/ (function(module, exports, __webpack_require__) {
474
+
475
+ eval("__webpack_require__(67);\nvar global = __webpack_require__(1);\nvar hide = __webpack_require__(6);\nvar Iterators = __webpack_require__(20);\nvar TO_STRING_TAG = __webpack_require__(9)('toStringTag');\n\nvar DOMIterables = ('CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,' +\n 'DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,' +\n 'MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,' +\n 'SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,' +\n 'TextTrackList,TouchList').split(',');\n\nfor (var i = 0; i < DOMIterables.length; i++) {\n var NAME = DOMIterables[i];\n var Collection = global[NAME];\n var proto = Collection && Collection.prototype;\n if (proto && !proto[TO_STRING_TAG]) hide(proto, TO_STRING_TAG, NAME);\n Iterators[NAME] =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mVyTGlzdCxTdHlsZVNoZWV0TGlzdCxUZXh0VHJhY2tDdWVMaXN0LCcgK1xuICAnVGV4dFRyYWNrTGlzdCxUb3VjaExpc3QnKS5zcGxpdCgnLCcpO1xuXG5mb3IgKHZhciBpID0gMDsgaSA8IERPTUl0ZXJhYmxlcy5sZW5ndGg7IGkrKykge1xuICB2YXIgTkFNRSA9IERPTUl0ZXJhYmxlc1tpXTtcbiAgdmFyIENvbGxlY3Rpb24gPSBnbG9iYWxbTkFNRV07XG4gIHZhciBwcm90byA9IENvbGxlY3Rpb24gJiYgQ29sbGVjdGlvbi5wcm90b3R5cGU7XG4gIGlmIChwcm90byAmJiAhcHJvdG9bVE9fU1RSSU5HX1RBR10pIGhpZGUocHJvdG8sIFRPX1NUUklOR19UQUcsIE5BTUUpO1xuICBJdGVyYXRvcnNbTkFNRV0gPSBJdGVyYXRvcnMuQXJyYXk7XG59XG5cblxuXG4vLy8vLy8vLy8vLy8vLy8vLy9cbi8vIFdFQlBBQ0sgRk9PVEVSXG4vLyAuL25vZGVfbW9kdWxlcy9jb3JlLWpzL2xpYnJhcnkvbW9kdWxlcy93ZWIuZG9tLml0ZXJhYmxlLmpzXG4vLyBtb2R1bGUgaWQgPSA2NlxuLy8gbW9kdWxlIGNodW5rcyA9IDAiXSwibWFwcGluZ3MiOiJBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///66\n");
476
+
477
+ /***/ }),
478
+ /* 67 */
479
+ /***/ (function(module, exports, __webpack_require__) {
480
+
481
+ "use strict";
482
+ eval("\nvar addToUnscopables = __webpack_require__(68);\nvar step = __webpack_require__(69);\nvar Iterators = __webpack_require__(20);\nvar toIObject = __webpack_require__(8);\n\n// 22.1.3.4 Array.prototype.entries()\n// 22.1.3.13 Array.prototype.keys()\n// 22.1.3.29 Array.prototype.values()\n// 22.1.3.30 Array.prototype[@@iterator]()\nmodule.exports = __webpack_require__(34)(Array, 'Array', function (iterated, kind) {\n this._t = toIObject(iterated); // target\n this._i = 0; // next index\n this._k = kind; // kind\n// 22.1.5.2.1 %ArrayIteratorPrototype%.next()\n}, function () {\n var O = this._t;\n var kind = this._k;\n var index = this._i++;\n if (!O || index >= O.length) {\n this._t = undefined;\n return step(1);\n }\n if (kind == 'keys') return step(0, index);\n if (kind == 'values') return step(0, O[index]);\n return step(0, [index, O[index]]);\n}, 'values');\n\n// argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7)\nIterators.Arguments = Iterators.Array;\n\naddToUnscopables('keys');\naddToUnscopables('values');\naddToUnscopables('entries');\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNjcuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvZXM2LmFycmF5Lml0ZXJhdG9yLmpzP2M0NjkiXSwic291cmNlc0NvbnRlbnQiOlsiJ3VzZSBzdHJpY3QnO1xudmFyIGFkZFRvVW5zY29wYWJsZXMgPSByZXF1aXJlKCcuL19hZGQtdG8tdW5zY29wYWJsZXMnKTtcbnZhciBzdGVwID0gcmVxdWlyZSgnLi9faXRlci1zdGVwJyk7XG52YXIgSXRlcmF0b3JzID0gcmVxdWlyZSgnLi9faXRlcmF0b3JzJyk7XG52YXIgdG9JT2JqZWN0ID0gcmVxdWlyZSgnLi9fdG8taW9iamVjdCcpO1xuXG4vLyAyMi4xLjMuNCBBcnJheS5wcm90b3R5cGUuZW50cmllcygpXG4vLyAyMi4xLjMuMTMgQXJyYXkucHJvdG90eXBlLmtleXMoKVxuLy8gMjIuMS4zLjI5IEFycmF5LnByb3RvdHl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2YWx1ZXMnKTtcbmFkZFRvVW5zY29wYWJsZXMoJ2VudHJpZXMnKTtcblxuXG5cbi8vLy8vLy8vLy8vLy8vLy8vL1xuLy8gV0VCUEFDSyBGT09URVJcbi8vIC4vbm9kZV9tb2R1bGVzL2NvcmUtanMvbGlicmFyeS9tb2R1bGVzL2VzNi5hcnJheS5pdGVyYXRvci5qc1xuLy8gbW9kdWxlIGlkID0gNjdcbi8vIG1vZHVsZSBjaHVua3MgPSAwIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///67\n");
483
+
484
+ /***/ }),
485
+ /* 68 */
486
+ /***/ (function(module, exports) {
487
+
488
+ eval("module.exports = function () { /* empty */ };\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNjguanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX2FkZC10by11bnNjb3BhYmxlcy5qcz9lMjY3Il0sInNvdXJjZXNDb250ZW50IjpbIm1vZHVsZS5leHBvcnRzID0gZnVuY3Rpb24gKCkgeyAvKiBlbXB0eSAqLyB9O1xuXG5cblxuLy8vLy8vLy8vLy8vLy8vLy8vXG4vLyBXRUJQQUNLIEZPT1RFUlxuLy8gLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX2FkZC10by11bnNjb3BhYmxlcy5qc1xuLy8gbW9kdWxlIGlkID0gNjhcbi8vIG1vZHVsZSBjaHVua3MgPSAwIl0sIm1hcHBpbmdzIjoiQUFBQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///68\n");
489
+
490
+ /***/ }),
491
+ /* 69 */
492
+ /***/ (function(module, exports) {
493
+
494
+ eval("module.exports = function (done, value) {\n return { value: value, done: !!done };\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNjkuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX2l0ZXItc3RlcC5qcz8xMDY2Il0sInNvdXJjZXNDb250ZW50IjpbIm1vZHVsZS5leHBvcnRzID0gZnVuY3Rpb24gKGRvbmUsIHZhbHVlKSB7XG4gIHJldHVybiB7IHZhbHVlOiB2YWx1ZSwgZG9uZTogISFkb25lIH07XG59O1xuXG5cblxuLy8vLy8vLy8vLy8vLy8vLy8vXG4vLyBXRUJQQUNLIEZPT1RFUlxuLy8gLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX2l0ZXItc3RlcC5qc1xuLy8gbW9kdWxlIGlkID0gNjlcbi8vIG1vZHVsZSBjaHVua3MgPSAwIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7Iiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///69\n");
495
+
496
+ /***/ }),
497
+ /* 70 */
498
+ /***/ (function(module, exports, __webpack_require__) {
499
+
500
+ eval("module.exports = { \"default\": __webpack_require__(71), __esModule: true };//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNzAuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYmFiZWwtcnVudGltZS9jb3JlLWpzL3N5bWJvbC5qcz9lNTA1Il0sInNvdXJjZXNDb250ZW50IjpbIm1vZHVsZS5leHBvcnRzID0geyBcImRlZmF1bHRcIjogcmVxdWlyZShcImNvcmUtanMvbGlicmFyeS9mbi9zeW1ib2xcIiksIF9fZXNNb2R1bGU6IHRydWUgfTtcblxuXG4vLy8vLy8vLy8vLy8vLy8vLy9cbi8vIFdFQlBBQ0sgRk9PVEVSXG4vLyAuL25vZGVfbW9kdWxlcy9iYWJlbC1ydW50aW1lL2NvcmUtanMvc3ltYm9sLmpzXG4vLyBtb2R1bGUgaWQgPSA3MFxuLy8gbW9kdWxlIGNodW5rcyA9IDAiXSwibWFwcGluZ3MiOiJBQUFBIiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///70\n");
501
+
502
+ /***/ }),
503
+ /* 71 */
504
+ /***/ (function(module, exports, __webpack_require__) {
505
+
506
+ eval("__webpack_require__(72);\n__webpack_require__(77);\n__webpack_require__(78);\n__webpack_require__(79);\nmodule.exports = __webpack_require__(0).Symbol;\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNzEuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L2ZuL3N5bWJvbC9pbmRleC5qcz8wNzA3Il0sInNvdXJjZXNDb250ZW50IjpbInJlcXVpcmUoJy4uLy4uL21vZHVsZXMvZXM2LnN5bWJvbCcpO1xucmVxdWlyZSgnLi4vLi4vbW9kdWxlcy9lczYub2JqZWN0LnRvLXN0cmluZycpO1xucmVxdWlyZSgnLi4vLi4vbW9kdWxlcy9lczcuc3ltYm9sLmFzeW5jLWl0ZXJhdG9yJyk7XG5yZXF1aXJlKCcuLi8uLi9tb2R1bGVzL2VzNy5zeW1ib2wub2JzZXJ2YWJsZScpO1xubW9kdWxlLmV4cG9ydHMgPSByZXF1aXJlKCcuLi8uLi9tb2R1bGVzL19jb3JlJykuU3ltYm9sO1xuXG5cblxuLy8vLy8vLy8vLy8vLy8vLy8vXG4vLyBXRUJQQUNLIEZPT1RFUlxuLy8gLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L2ZuL3N5bWJvbC9pbmRleC5qc1xuLy8gbW9kdWxlIGlkID0gNzFcbi8vIG1vZHVsZSBjaHVua3MgPSAwIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///71\n");
507
+
508
+ /***/ }),
509
+ /* 72 */
510
+ /***/ (function(module, exports, __webpack_require__) {
511
+
512
+ "use strict";
513
+ eval("\n// ECMAScript 6 symbols shim\nvar global = __webpack_require__(1);\nvar has = __webpack_require__(2);\nvar DESCRIPTORS = __webpack_require__(4);\nvar $export = __webpack_require__(5);\nvar redefine = __webpack_require__(35);\nvar META = __webpack_require__(73).KEY;\nvar $fails = __webpack_require__(11);\nvar shared = __webpack_require__(17);\nvar setToStringTag = __webpack_require__(24);\nvar uid = __webpack_require__(13);\nvar wks = __webpack_require__(9);\nvar wksExt = __webpack_require__(25);\nvar wksDefine = __webpack_require__(26);\nvar enumKeys = __webpack_require__(74);\nvar isArray = __webpack_require__(75);\nvar anObject = __webpack_require__(10);\nvar isObject = __webpack_require__(7);\nvar toIObject = __webpack_require__(8);\nvar toPrimitive = __webpack_require__(18);\nvar createDesc = __webpack_require__(14);\nvar _create = __webpack_require__(21);\nvar gOPNExt = __webpack_require__(76);\nvar $GOPD = __webpack_require__(40);\nvar $DP = __webpack_require__(3);\nvar $keys = __webpack_require__(22);\nvar gOPD = $GOPD.f;\nvar dP = $DP.f;\nvar gOPN = gOPNExt.f;\nvar $Symbol = global.Symbol;\nvar $JSON = global.JSON;\nvar _stringify = $JSON && $JSON.stringify;\nvar PROTOTYPE = 'prototype';\nvar HIDDEN = wks('_hidden');\nvar TO_PRIMITIVE = wks('toPrimitive');\nvar isEnum = {}.propertyIsEnumerable;\nvar SymbolRegistry = shared('symbol-registry');\nvar AllSymbols = shared('symbols');\nvar OPSymbols = shared('op-symbols');\nvar ObjectProto = Object[PROTOTYPE];\nvar USE_NATIVE = typeof $Symbol == 'function';\nvar QObject = global.QObject;\n// Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173\nvar setter = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild;\n\n// fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687\nvar setSymbolDesc = DESCRIPTORS && $fails(function () {\n return _create(dP({}, 'a', {\n get: function () { return dP(this, 'a', { value: 7 }).a; }\n })).a != 7;\n}) ? function (it, key, D) {\n var protoDesc = gOPD(ObjectProto, key);\n if (protoDesc) delete ObjectProto[key];\n dP(it, key, D);\n if (protoDesc && it !== ObjectProto) dP(ObjectProto, key, protoDesc);\n} : dP;\n\nvar wrap = function (tag) {\n var sym = AllSymbols[tag] = _create($Symbol[PROTOTYPE]);\n sym._k = tag;\n return sym;\n};\n\nvar isSymbol = USE_NATIVE && typeof $Symbol.iterator == 'symbol' ? function (it) {\n return typeof it == 'symbol';\n} : function (it) {\n return it instanceof $Symbol;\n};\n\nvar $defineProperty = function defineProperty(it, key, D) {\n if (it === ObjectProto) $defineProperty(OPSymbols, key, D);\n anObject(it);\n key = toPrimitive(key, true);\n anObject(D);\n if (has(AllSymbols, key)) {\n if (!D.enumerable) {\n if (!has(it, HIDDEN)) dP(it, HIDDEN, createDesc(1, {}));\n it[HIDDEN][key] = true;\n } else {\n if (has(it, HIDDEN) && it[HIDDEN][key]) it[HIDDEN][key] = false;\n D = _create(D, { enumerable: createDesc(0, false) });\n } return setSymbolDesc(it, key, D);\n } return dP(it, key, D);\n};\nvar $defineProperties = function defineProperties(it, P) {\n anObject(it);\n var keys = enumKeys(P = toIObject(P));\n var i = 0;\n var l = keys.length;\n var key;\n while (l > i) $defineProperty(it, key = keys[i++], P[key]);\n return it;\n};\nvar $create = function create(it, P) {\n return P === undefined ? _create(it) : $defineProperties(_create(it), P);\n};\nvar $propertyIsEnumerable = function propertyIsEnumerable(key) {\n var E = isEnum.call(this, key = toPrimitive(key, true));\n if (this === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key)) return false;\n return E || !has(this, key) || !has(AllSymbols, key) || has(this, HIDDEN) && this[HIDDEN][key] ? E : true;\n};\nvar $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key) {\n it = toIObject(it);\n key = toPrimitive(key, true);\n if (it === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key)) return;\n var D = gOPD(it, key);\n if (D && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key])) D.enumerable = true;\n return D;\n};\nvar $getOwnPropertyNames = function getOwnPropertyNames(it) {\n var names = gOPN(toIObject(it));\n var result = [];\n var i = 0;\n var key;\n while (names.length > i) {\n if (!has(AllSymbols, key = names[i++]) && key != HIDDEN && key != META) result.push(key);\n } return result;\n};\nvar $getOwnPropertySymbols = function getOwnPropertySymbols(it) {\n var IS_OP = it === ObjectProto;\n var names = gOPN(IS_OP ? OPSymbols : toIObject(it));\n var result = [];\n var i = 0;\n var key;\n while (names.length > i) {\n if (has(AllSymbols, key = names[i++]) && (IS_OP ? has(ObjectProto, key) : true)) result.push(AllSymbols[key]);\n } return result;\n};\n\n// 19.4.1.1 Symbol([description])\nif (!USE_NATIVE) {\n $Symbol = function Symbol() {\n if (this instanceof $Symbol) throw TypeError('Symbol is not a constructor!');\n var tag = uid(arguments.length > 0 ? arguments[0] : undefined);\n var $set = function (value) {\n if (this === ObjectProto) $set.call(OPSymbols, value);\n if (has(this, HIDDEN) && has(this[HIDDEN], tag)) this[HIDDEN][tag] = false;\n setSymbolDesc(this, tag, createDesc(1, value));\n };\n if (DESCRIPTORS && setter) setSymbolDesc(ObjectProto, tag, { configurable: true, set: $set });\n return wrap(tag);\n };\n redefine($Symbol[PROTOTYPE], 'toString', function toString() {\n return this._k;\n });\n\n $GOPD.f = $getOwnPropertyDescriptor;\n $DP.f = $defineProperty;\n __webpack_require__(39).f = gOPNExt.f = $getOwnPropertyNames;\n __webpack_require__(27).f = $propertyIsEnumerable;\n __webpack_require__(38).f = $getOwnPropertySymbols;\n\n if (DESCRIPTORS && !__webpack_require__(12)) {\n redefine(ObjectProto, 'propertyIsEnumerable', $propertyIsEnumerable, true);\n }\n\n wksExt.f = function (name) {\n return wrap(wks(name));\n };\n}\n\n$export($export.G + $export.W + $export.F * !USE_NATIVE, { Symbol: $Symbol });\n\nfor (var es6Symbols = (\n // 19.4.2.2, 19.4.2.3, 19.4.2.4, 19.4.2.6, 19.4.2.8, 19.4.2.9, 19.4.2.10, 19.4.2.11, 19.4.2.12, 19.4.2.13, 19.4.2.14\n 'hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables'\n).split(','), j = 0; es6Symbols.length > j;)wks(es6Symbols[j++]);\n\nfor (var wellKnownSymbols = $keys(wks.store), k = 0; wellKnownSymbols.length > k;) wksDefine(wellKnownSymbols[k++]);\n\n$export($export.S + $export.F * !USE_NATIVE, 'Symbol', {\n // 19.4.2.1 Symbol.for(key)\n 'for': function (key) {\n return has(SymbolRegistry, key += '')\n ? SymbolRegistry[key]\n : SymbolRegistry[key] = $Symbol(key);\n },\n // 19.4.2.5 Symbol.keyFor(sym)\n keyFor: function keyFor(sym) {\n if (!isSymbol(sym)) throw TypeError(sym + ' is not a symbol!');\n for (var key in SymbolRegistry) if (SymbolRegistry[key] === sym) return key;\n },\n useSetter: function () { setter = true; },\n useSimple: function () { setter = false; }\n});\n\n$export($export.S + $export.F * !USE_NATIVE, 'Object', {\n // 19.1.2.2 Object.create(O [, Properties])\n create: $create,\n // 19.1.2.4 Object.defineProperty(O, P, Attributes)\n defineProperty: $defineProperty,\n // 19.1.2.3 Object.defineProperties(O, Properties)\n defineProperties: $defineProperties,\n // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P)\n getOwnPropertyDescriptor: $getOwnPropertyDescriptor,\n // 19.1.2.7 Object.getOwnPropertyNames(O)\n getOwnPropertyNames: $getOwnPropertyNames,\n // 19.1.2.8 Object.getOwnPropertySymbols(O)\n getOwnPropertySymbols: $getOwnPropertySymbols\n});\n\n// 24.3.2 JSON.stringify(value [, replacer [, space]])\n$JSON && $export($export.S + $export.F * (!USE_NATIVE || $fails(function () {\n var S = $Symbol();\n // MS Edge converts symbol values to JSON as {}\n // WebKit converts symbol values to JSON as null\n // V8 throws on boxed symbols\n return _stringify([S]) != '[null]' || _stringify({ a: S }) != '{}' || _stringify(Object(S)) != '{}';\n})), 'JSON', {\n stringify: function stringify(it) {\n var args = [it];\n var i = 1;\n var replacer, $replacer;\n while (arguments.length > i) args.push(arguments[i++]);\n $replacer = replacer = args[1];\n if (!isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined\n if (!isArray(replacer)) replacer = function (key, value) {\n if (typeof $replacer == 'function') value = $replacer.call(this, key, value);\n if (!isSymbol(value)) return value;\n };\n args[1] = replacer;\n return _stringify.apply($JSON, args);\n }\n});\n\n// 19.4.3.4 Symbol.prototype[@@toPrimitive](hint)\n$Symbol[PROTOTYPE][TO_PRIMITIVE] || __webpack_require__(6)($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf);\n// 19.4.3.5 Symbol.prototype[@@toStringTag]\nsetToStringTag($Symbol, 'Symbol');\n// 20.2.1.9 Math[@@toStringTag]\nsetToStringTag(Math, 'Math', true);\n// 24.3.3 JSON[@@toStringTag]\nsetToStringTag(global.JSON, 'JSON', true);\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNzIuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvZXM2LnN5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NBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///72\n");
514
+
515
+ /***/ }),
516
+ /* 73 */
517
+ /***/ (function(module, exports, __webpack_require__) {
518
+
519
+ eval("var META = __webpack_require__(13)('meta');\nvar isObject = __webpack_require__(7);\nvar has = __webpack_require__(2);\nvar setDesc = __webpack_require__(3).f;\nvar id = 0;\nvar isExtensible = Object.isExtensible || function () {\n return true;\n};\nvar FREEZE = !__webpack_require__(11)(function () {\n return isExtensible(Object.preventExtensions({}));\n});\nvar setMeta = function (it) {\n setDesc(it, META, { value: {\n i: 'O' + ++id, // object ID\n w: {} // weak collections IDs\n } });\n};\nvar fastKey = function (it, create) {\n // return primitive with prefix\n if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;\n if (!has(it, META)) {\n // can't set metadata to uncaught frozen object\n if (!isExtensible(it)) return 'F';\n // not necessary to add metadata\n if (!create) return 'E';\n // add missing metadata\n setMeta(it);\n // return object ID\n } return it[META].i;\n};\nvar getWeak = function (it, create) {\n if (!has(it, META)) {\n // can't set metadata to uncaught frozen object\n if (!isExtensible(it)) return true;\n // not necessary to add metadata\n if (!create) return false;\n // add missing metadata\n setMeta(it);\n // return hash weak collections IDs\n } return it[META].w;\n};\n// add metadata on freeze-family methods calling\nvar onFreeze = function (it) {\n if (FREEZE && meta.NEED && isExtensible(it) && !has(it, META)) setMeta(it);\n return it;\n};\nvar meta = module.exports = {\n KEY: META,\n NEED: false,\n fastKey: fastKey,\n getWeak: getWeak,\n onFreeze: onFreeze\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNzMuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX21ldGEuanM/ZDNhMyJdLCJzb3VyY2VzQ29udGVudC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cbn07XG5cblxuXG4vLy8vLy8vLy8vLy8vLy8vLy9cbi8vIFdFQlBBQ0sgRk9PVEVSXG4vLyAuL25vZGVfbW9kdWxlcy9jb3JlLWpzL2xpYnJhcnkvbW9kdWxlcy9fbWV0YS5qc1xuLy8gbW9kdWxlIGlkID0gNzNcbi8vIG1vZHVsZSBjaHVua3MgPSAwIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///73\n");
520
+
521
+ /***/ }),
522
+ /* 74 */
523
+ /***/ (function(module, exports, __webpack_require__) {
524
+
525
+ eval("// all enumerable object keys, includes symbols\nvar getKeys = __webpack_require__(22);\nvar gOPS = __webpack_require__(38);\nvar pIE = __webpack_require__(27);\nmodule.exports = function (it) {\n var result = getKeys(it);\n var getSymbols = gOPS.f;\n if (getSymbols) {\n var symbols = getSymbols(it);\n var isEnum = pIE.f;\n var i = 0;\n var key;\n while (symbols.length > i) if (isEnum.call(it, key = symbols[i++])) result.push(key);\n } return result;\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNzQuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZH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290IjoiIn0=\n//# sourceURL=webpack-internal:///74\n");
526
+
527
+ /***/ }),
528
+ /* 75 */
529
+ /***/ (function(module, exports, __webpack_require__) {
530
+
531
+ eval("// 7.2.2 IsArray(argument)\nvar cof = __webpack_require__(37);\nmodule.exports = Array.isArray || function isArray(arg) {\n return cof(arg) == 'Array';\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNzUuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX2lzLWFycmF5LmpzP2VkNDMiXSwic291cmNlc0NvbnRlbnQiOlsiLy8gNy4yLjIgSXNBcnJheShhcmd1bWVudClcbnZhciBjb2YgPSByZXF1aXJlKCcuL19jb2YnKTtcbm1vZHVsZS5leHBvcnRzID0gQXJyYXkuaXNBcnJheSB8fCBmdW5jdGlvbiBpc0FycmF5KGFyZykge1xuICByZXR1cm4gY29mKGFyZykgPT0gJ0FycmF5Jztcbn07XG5cblxuXG4vLy8vLy8vLy8vLy8vLy8vLy9cbi8vIFdFQlBBQ0sgRk9PVEVSXG4vLyAuL25vZGVfbW9kdWxlcy9jb3JlLWpzL2xpYnJhcnkvbW9kdWxlcy9faXMtYXJyYXkuanNcbi8vIG1vZHVsZSBpZCA9IDc1XG4vLyBtb2R1bGUgY2h1bmtzID0gMCJdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///75\n");
532
+
533
+ /***/ }),
534
+ /* 76 */
535
+ /***/ (function(module, exports, __webpack_require__) {
536
+
537
+ eval("// fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window\nvar toIObject = __webpack_require__(8);\nvar gOPN = __webpack_require__(39).f;\nvar toString = {}.toString;\n\nvar windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames\n ? Object.getOwnPropertyNames(window) : [];\n\nvar getWindowNames = function (it) {\n try {\n return gOPN(it);\n } catch (e) {\n return windowNames.slice();\n }\n};\n\nmodule.exports.f = function getOwnPropertyNames(it) {\n return windowNames && toString.call(it) == '[object Window]' ? getWindowNames(it) : gOPN(toIObject(it));\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNzYuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX29iamVjdC1nb3BuLWV4dC5qcz80NmI3Il0sInNvdXJjZXNDb250ZW50IjpbIi8vIGZhbGxiYWNrIGZvciBJRTExIGJ1Z2d5IE9iamVjdC5nZXRPd25Qcm9wZXJ0eU5hbWVzIHdpdGggaWZyYW1lIGFuZCB3aW5kb3dcbnZhciB0b0lPYmplY3QgPSByZXF1aXJlKCcuL190by1pb2JqZWN0Jyk7XG52YXIgZ09QTiA9IHJlcXVpcmUoJy4vX29iamVjdC1nb3BuJykuZjtcbnZhciB0b1N0cmluZyA9IHt9LnRvU3RyaW5nO1xuXG52YXIgd2luZG93TmFtZXMgPSB0eXBlb2Ygd2luZG93ID09ICdvYmplY3QnICYmIHdpbmRvdyAmJiBPYmplY3QuZ2V0T3duUHJvcGVydHlOYW1lc1xuICA/IE9iamVjdC5nZXRPd25Qcm9wZXJ0eU5hbWVzKHdpbmRvdykgOiBbXTtcblxudmFyIGdldFdpbmRvd05hbWVzID0gZnVuY3Rpb24gKGl0KSB7XG4gIHRyeSB7XG4gICAgcmV0dXJuIGdPUE4oaXQpO1xuICB9IGNhdGNoIChlKSB7XG4gICAgcmV0dXJuIHdpbmRvd05hbWVzLnNsaWNlKCk7XG4gIH1cbn07XG5cbm1vZHVsZS5leHBvcnRzLmYgPSBmdW5jdGlvbiBnZXRPd25Qcm9wZXJ0eU5hbWVzKGl0KSB7XG4gIHJldHVybiB3aW5kb3dOYW1lcyAmJiB0b1N0cmluZy5jYWxsKGl0KSA9PSAnW29iamVjdCBXaW5kb3ddJyA/IGdldFdpbmRvd05hbWVzKGl0KSA6IGdPUE4odG9JT2JqZWN0KGl0KSk7XG59O1xuXG5cblxuLy8vLy8vLy8vLy8vLy8vLy8vXG4vLyBXRUJQQUNLIEZPT1RFUlxuLy8gLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX29iamVjdC1nb3BuLWV4dC5qc1xuLy8gbW9kdWxlIGlkID0gNzZcbi8vIG1vZHVsZSBjaHVua3MgPSAwIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///76\n");
538
+
539
+ /***/ }),
540
+ /* 77 */
541
+ /***/ (function(module, exports) {
542
+
543
+ eval("//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNzcuanMiLCJzb3VyY2VzIjpbXSwibWFwcGluZ3MiOiIiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///77\n");
544
+
545
+ /***/ }),
546
+ /* 78 */
547
+ /***/ (function(module, exports, __webpack_require__) {
548
+
549
+ eval("__webpack_require__(26)('asyncIterator');\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNzguanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvZXM3LnN5bWJvbC5hc3luYy1pdGVyYXRvci5qcz8zOTg5Il0sInNvdXJjZXNDb250ZW50IjpbInJlcXVpcmUoJy4vX3drcy1kZWZpbmUnKSgnYXN5bmNJdGVyYXRvcicpO1xuXG5cblxuLy8vLy8vLy8vLy8vLy8vLy8vXG4vLyBXRUJQQUNLIEZPT1RFUlxuLy8gLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvZXM3LnN5bWJvbC5hc3luYy1pdGVyYXRvci5qc1xuLy8gbW9kdWxlIGlkID0gNzhcbi8vIG1vZHVsZSBjaHVua3MgPSAwIl0sIm1hcHBpbmdzIjoiQUFBQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///78\n");
550
+
551
+ /***/ }),
552
+ /* 79 */
553
+ /***/ (function(module, exports, __webpack_require__) {
554
+
555
+ eval("__webpack_require__(26)('observable');\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNzkuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvZXM3LnN5bWJvbC5vYnNlcnZhYmxlLmpzPzQxNjciXSwic291cmNlc0NvbnRlbnQiOlsicmVxdWlyZSgnLi9fd2tzLWRlZmluZScpKCdvYnNlcnZhYmxlJyk7XG5cblxuXG4vLy8vLy8vLy8vLy8vLy8vLy9cbi8vIFdFQlBBQ0sgRk9PVEVSXG4vLyAuL25vZGVfbW9kdWxlcy9jb3JlLWpzL2xpYnJhcnkvbW9kdWxlcy9lczcuc3ltYm9sLm9ic2VydmFibGUuanNcbi8vIG1vZHVsZSBpZCA9IDc5XG4vLyBtb2R1bGUgY2h1bmtzID0gMCJdLCJtYXBwaW5ncyI6IkFBQUE7Iiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///79\n");
556
+
557
+ /***/ }),
558
+ /* 80 */
559
+ /***/ (function(module, exports, __webpack_require__) {
560
+
561
+ "use strict";
562
+ eval("\n\nexports.__esModule = true;\n\nvar _setPrototypeOf = __webpack_require__(81);\n\nvar _setPrototypeOf2 = _interopRequireDefault(_setPrototypeOf);\n\nvar _create = __webpack_require__(85);\n\nvar _create2 = _interopRequireDefault(_create);\n\nvar _typeof2 = __webpack_require__(33);\n\nvar _typeof3 = _interopRequireDefault(_typeof2);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nexports.default = function (subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function, not \" + (typeof superClass === \"undefined\" ? \"undefined\" : (0, _typeof3.default)(superClass)));\n }\n\n subClass.prototype = (0, _create2.default)(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n if (superClass) _setPrototypeOf2.default ? (0, _setPrototypeOf2.default)(subClass, superClass) : subClass.__proto__ = superClass;\n};//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiODAuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYmFiZWwtcnVudGltZS9oZWxwZXJzL2luaGVyaXRzLmpzPzNkZmQiXSwic291cmNlc0NvbnRlbnQiOlsiXCJ1c2Ugc3RyaWN0XCI7XG5cbmV4cG9ydHMuX19lc01vZHVsZSA9IHRydWU7XG5cbnZhciBfc2V0UHJvdG90eXBlT2YgPSByZXF1aXJlKFwiLi4vY29yZS1qcy9vYmplY3Qvc2V0LXByb3RvdHlwZS1vZlwiKTtcblxudmFyIF9zZXRQcm90b3R5cGVPZjIgPSBfaW50ZXJvcFJlcXVpcmVEZWZhdWx0KF9zZXRQcm90b3R5cGVPZik7XG5cbnZhciBfY3JlYXRlID0gcmVxdWlyZShcIi4uL2NvcmUtanMvb2JqZWN0L2NyZWF0ZVwiKTtcblxudmF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WZhdWx0ID8gKDAsIF9zZXRQcm90b3R5cGVPZjIuZGVmYXVsdCkoc3ViQ2xhc3MsIHN1cGVyQ2xhc3MpIDogc3ViQ2xhc3MuX19wcm90b19fID0gc3VwZXJDbGFzcztcbn07XG5cblxuLy8vLy8vLy8vLy8vLy8vLy8vXG4vLyBXRUJQQUNLIEZPT1RFUlxuLy8gLi9ub2RlX21vZHVsZXMvYmFiZWwtcnVudGltZS9oZWxwZXJzL2luaGVyaXRzLmpzXG4vLyBtb2R1bGUgaWQgPSA4MFxuLy8gbW9kdWxlIGNodW5rcyA9IDAiXSwibWFwcGluZ3MiOiJBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///80\n");
563
+
564
+ /***/ }),
565
+ /* 81 */
566
+ /***/ (function(module, exports, __webpack_require__) {
567
+
568
+ eval("module.exports = { \"default\": __webpack_require__(82), __esModule: true };//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiODEuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYmFiZWwtcnVudGltZS9jb3JlLWpzL29iamVjdC9zZXQtcHJvdG90eXBlLW9mLmpzPzkyMjAiXSwic291cmNlc0NvbnRlbnQiOlsibW9kdWxlLmV4cG9ydHMgPSB7IFwiZGVmYXVsdFwiOiByZXF1aXJlKFwiY29yZS1qcy9saWJyYXJ5L2ZuL29iamVjdC9zZXQtcHJvdG90eXBlLW9mXCIpLCBfX2VzTW9kdWxlOiB0cnVlIH07XG5cblxuLy8vLy8vLy8vLy8vLy8vLy8vXG4vLyBXRUJQQUNLIEZPT1RFUlxuLy8gLi9ub2RlX21vZHVsZXMvYmFiZWwtcnVudGltZS9jb3JlLWpzL29iamVjdC9zZXQtcHJvdG90eXBlLW9mLmpzXG4vLyBtb2R1bGUgaWQgPSA4MVxuLy8gbW9kdWxlIGNodW5rcyA9IDAiXSwibWFwcGluZ3MiOiJBQUFBIiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///81\n");
569
+
570
+ /***/ }),
571
+ /* 82 */
572
+ /***/ (function(module, exports, __webpack_require__) {
573
+
574
+ eval("__webpack_require__(83);\nmodule.exports = __webpack_require__(0).Object.setPrototypeOf;\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiODIuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L2ZuL29iamVjdC9zZXQtcHJvdG90eXBlLW9mLmpzPzhiZjAiXSwic291cmNlc0NvbnRlbnQiOlsicmVxdWlyZSgnLi4vLi4vbW9kdWxlcy9lczYub2JqZWN0LnNldC1wcm90b3R5cGUtb2YnKTtcbm1vZHVsZS5leHBvcnRzID0gcmVxdWlyZSgnLi4vLi4vbW9kdWxlcy9fY29yZScpLk9iamVjdC5zZXRQcm90b3R5cGVPZjtcblxuXG5cbi8vLy8vLy8vLy8vLy8vLy8vL1xuLy8gV0VCUEFDSyBGT09URVJcbi8vIC4vbm9kZV9tb2R1bGVzL2NvcmUtanMvbGlicmFyeS9mbi9vYmplY3Qvc2V0LXByb3RvdHlwZS1vZi5qc1xuLy8gbW9kdWxlIGlkID0gODJcbi8vIG1vZHVsZSBjaHVua3MgPSAwIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///82\n");
575
+
576
+ /***/ }),
577
+ /* 83 */
578
+ /***/ (function(module, exports, __webpack_require__) {
579
+
580
+ eval("// 19.1.3.19 Object.setPrototypeOf(O, proto)\nvar $export = __webpack_require__(5);\n$export($export.S, 'Object', { setPrototypeOf: __webpack_require__(84).set });\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiODMuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvZXM2Lm9iamVjdC5zZXQtcHJvdG90eXBlLW9mLmpzPzdiMTgiXSwic291cmNlc0NvbnRlbnQiOlsiLy8gMTkuMS4zLjE5IE9iamVjdC5zZXRQcm90b3R5cGVPZihPLCBwcm90bylcbnZhciAkZXhwb3J0ID0gcmVxdWlyZSgnLi9fZXhwb3J0Jyk7XG4kZXhwb3J0KCRleHBvcnQuUywgJ09iamVjdCcsIHsgc2V0UHJvdG90eXBlT2Y6IHJlcXVpcmUoJy4vX3NldC1wcm90bycpLnNldCB9KTtcblxuXG5cbi8vLy8vLy8vLy8vLy8vLy8vL1xuLy8gV0VCUEFDSyBGT09URVJcbi8vIC4vbm9kZV9tb2R1bGVzL2NvcmUtanMvbGlicmFyeS9tb2R1bGVzL2VzNi5vYmplY3Quc2V0LXByb3RvdHlwZS1vZi5qc1xuLy8gbW9kdWxlIGlkID0gODNcbi8vIG1vZHVsZSBjaHVua3MgPSAwIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7Iiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///83\n");
581
+
582
+ /***/ }),
583
+ /* 84 */
584
+ /***/ (function(module, exports, __webpack_require__) {
585
+
586
+ eval("// Works with __proto__ only. Old v8 can't work with null proto objects.\n/* eslint-disable no-proto */\nvar isObject = __webpack_require__(7);\nvar anObject = __webpack_require__(10);\nvar check = function (O, proto) {\n anObject(O);\n if (!isObject(proto) && proto !== null) throw TypeError(proto + \": can't set as prototype!\");\n};\nmodule.exports = {\n set: Object.setPrototypeOf || ('__proto__' in {} ? // eslint-disable-line\n function (test, buggy, set) {\n try {\n set = __webpack_require__(30)(Function.call, __webpack_require__(40).f(Object.prototype, '__proto__').set, 2);\n set(test, []);\n buggy = !(test instanceof Array);\n } catch (e) { buggy = true; }\n return function setPrototypeOf(O, proto) {\n check(O, proto);\n if (buggy) O.__proto__ = proto;\n else set(O, proto);\n return O;\n };\n }({}, false) : undefined),\n check: check\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiODQuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX3NldC1wcm90by5qcz82NWE0Il0sInNvdXJjZXNDb250ZW50IjpbIi8vIFdvcmtzIHdpdGggX19wcm90b19fIG9ubHkuIE9sZCB2OCBjYW4ndCB3b3JrIHdpdGggbnVsbCBwcm90byBvYmplY3RzLlxuLyogZXNsaW50LWRpc2FibGUgbm8tcHJvdG8gKi9cbnZhciBpc09iamVjdCA9IHJlcXVpcmUoJy4vX2lzLW9iamVjdCcpO1xudmFyIGFuT2JqZWN0ID0gcmVxdWlyZSgnLi9fYW4tb2JqZWN0Jyk7XG52YXIgY2hlY2sgPSBmdW5jdGlvbiAoTywgcHJvdG8pIHtcbiAgYW5PYmplY3QoTyk7XG4gIGlmICghaXNPYmplY3QocHJvdG8pICYmIHByb3RvICE9PSBudWxsKSB0aHJvdyBUeXBlRXJyb3IocHJvdG8gKyBcIjogY2FuJ3Qgc2V0IGFzIHByb3RvdHlwZSFcIik7XG59O1xubW9kdWxlLmV4cG9ydHMgPSB7XG4gIHNldDogT2JqZWN0LnNldFByb3RvdHlwZU9mIHx8ICgnX19wcm90b19fJyBpbiB7fSA/I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lUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///84\n");
587
+
588
+ /***/ }),
589
+ /* 85 */
590
+ /***/ (function(module, exports, __webpack_require__) {
591
+
592
+ eval("module.exports = { \"default\": __webpack_require__(86), __esModule: true };//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiODUuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYmFiZWwtcnVudGltZS9jb3JlLWpzL29iamVjdC9jcmVhdGUuanM/M2FmNCJdLCJzb3VyY2VzQ29udGVudCI6WyJtb2R1bGUuZXhwb3J0cyA9IHsgXCJkZWZhdWx0XCI6IHJlcXVpcmUoXCJjb3JlLWpzL2xpYnJhcnkvZm4vb2JqZWN0L2NyZWF0ZVwiKSwgX19lc01vZHVsZTogdHJ1ZSB9O1xuXG5cbi8vLy8vLy8vLy8vLy8vLy8vL1xuLy8gV0VCUEFDSyBGT09URVJcbi8vIC4vbm9kZV9tb2R1bGVzL2JhYmVsLXJ1bnRpbWUvY29yZS1qcy9vYmplY3QvY3JlYXRlLmpzXG4vLyBtb2R1bGUgaWQgPSA4NVxuLy8gbW9kdWxlIGNodW5rcyA9IDAiXSwibWFwcGluZ3MiOiJBQUFBIiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///85\n");
593
+
594
+ /***/ }),
595
+ /* 86 */
596
+ /***/ (function(module, exports, __webpack_require__) {
597
+
598
+ eval("__webpack_require__(87);\nvar $Object = __webpack_require__(0).Object;\nmodule.exports = function create(P, D) {\n return $Object.create(P, D);\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiODYuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L2ZuL29iamVjdC9jcmVhdGUuanM/YTBjZSJdLCJzb3VyY2VzQ29udGVudCI6WyJyZXF1aXJlKCcuLi8uLi9tb2R1bGVzL2VzNi5vYmplY3QuY3JlYXRlJyk7XG52YXIgJE9iamVjdCA9IHJlcXVpcmUoJy4uLy4uL21vZHVsZXMvX2NvcmUnKS5PYmplY3Q7XG5tb2R1bGUuZXhwb3J0cyA9IGZ1bmN0aW9uIGNyZWF0ZShQLCBEKSB7XG4gIHJldHVybiAkT2JqZWN0LmNyZWF0ZShQLCBEKTtcbn07XG5cblxuXG4vLy8vLy8vLy8vLy8vLy8vLy9cbi8vIFdFQlBBQ0sgRk9PVEVSXG4vLyAuL25vZGVfbW9kdWxlcy9jb3JlLWpzL2xpYnJhcnkvZm4vb2JqZWN0L2NyZWF0ZS5qc1xuLy8gbW9kdWxlIGlkID0gODZcbi8vIG1vZHVsZSBjaHVua3MgPSAwIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///86\n");
599
+
600
+ /***/ }),
601
+ /* 87 */
602
+ /***/ (function(module, exports, __webpack_require__) {
603
+
604
+ eval("var $export = __webpack_require__(5);\n// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])\n$export($export.S, 'Object', { create: __webpack_require__(21) });\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiODcuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvZXM2Lm9iamVjdC5jcmVhdGUuanM/YjA1ZiJdLCJzb3VyY2VzQ29udGVudCI6WyJ2YXIgJGV4cG9ydCA9IHJlcXVpcmUoJy4vX2V4cG9ydCcpO1xuLy8gMTkuMS4yLjIgLyAxNS4yLjMuNSBPYmplY3QuY3JlYXRlKE8gWywgUHJvcGVydGllc10pXG4kZXhwb3J0KCRleHBvcnQuUywgJ09iamVjdCcsIHsgY3JlYXRlOiByZXF1aXJlKCcuL19vYmplY3QtY3JlYXRlJykgfSk7XG5cblxuXG4vLy8vLy8vLy8vLy8vLy8vLy9cbi8vIFdFQlBBQ0sgRk9PVEVSXG4vLyAuL25vZGVfbW9kdWxlcy9jb3JlLWpzL2xpYnJhcnkvbW9kdWxlcy9lczYub2JqZWN0LmNyZWF0ZS5qc1xuLy8gbW9kdWxlIGlkID0gODdcbi8vIG1vZHVsZSBjaHVua3MgPSAwIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7Iiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///87\n");
605
+
606
+ /***/ })
607
+ /******/ ]);
trunk/includes/builders/gutenberg/assets/js/dist/wpglobus-block-editor.min.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(c){var t={};function l(e){if(t[e])return t[e].exports;var n=t[e]={i:e,l:!1,exports:{}};return c[e].call(n.exports,n,n.exports,l),n.l=!0,n.exports}l.m=c,l.c=t,l.d=function(e,n,c){l.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:c})},l.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return l.d(n,"a",n),n},l.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},l.p="",l(l.s=41)}([function(module,exports){eval("var core = module.exports = { version: '2.6.5' };\nif (typeof __e == 'number') __e = core; // eslint-disable-line no-undef\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMC5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy8uL25vZGVfbW9kdWxlcy9jb3JlLWpzL2xpYnJhcnkvbW9kdWxlcy9fY29yZS5qcz8xNWUwIl0sInNvdXJjZXNDb250ZW50IjpbInZhciBjb3JlID0gbW9kdWxlLmV4cG9ydHMgPSB7IHZlcnNpb246ICcyLjYuNScgfTtcbmlmICh0eXBlb2YgX19lID09ICdudW1iZXInKSBfX2UgPSBjb3JlOyAvLyBlc2xpbnQtZGlzYWJsZS1saW5lIG5vLXVuZGVmXG5cblxuXG4vLy8vLy8vLy8vLy8vLy8vLy9cbi8vIFdFQlBBQ0sgRk9PVEVSXG4vLyAuL25vZGVfbW9kdWxlcy9jb3JlLWpzL2xpYnJhcnkvbW9kdWxlcy9fY29yZS5qc1xuLy8gbW9kdWxlIGlkID0gMFxuLy8gbW9kdWxlIGNodW5rcyA9IDAiXSwibWFwcGluZ3MiOiJBQUFBO0FBQ0E7Iiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///0\n")},function(module,exports){eval("// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028\nvar global = module.exports = typeof window != 'undefined' && window.Math == Math\n ? window : typeof self != 'undefined' && self.Math == Math ? self\n // eslint-disable-next-line no-new-func\n : Function('return this')();\nif (typeof __g == 'number') __g = global; // eslint-disable-line no-undef\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMS5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy8uL25vZGVfbW9kdWxlcy9jb3JlLWpzL2xpYnJhcnkvbW9kdWxlcy9fZ2xvYmFsLmpzP2VjYWIiXSwic291cmNlc0NvbnRlbnQiOlsiLy8gaHR0cHM6Ly9naXRodWIuY29tL3psb2lyb2NrL2NvcmUtanMvaXNzdWVzLzg2I2lzc3VlY29tbWVudC0xMTU3NTkwMjhcbnZhciBnbG9iYWwgPSBtb2R1bGUuZXhwb3J0cyA9IHR5cGVvZiB3aW5kb3cgIT0gJ3VuZGVmaW5lZCcgJiYgd2luZG93Lk1hdGggPT0gTWF0aFxuICA/IHdpbmRvdyA6IHR5cGVvZiBzZWxmICE9ICd1bmRlZmluZWQnICYmIHNlbGYuTWF0aCA9PSBNYXRoID8gc2VsZlxuICAvLyBlc2xpbnQtZGlzYWJsZS1uZXh0LWxpbmUgbm8tbmV3LWZ1bmNcbiAgOiBGdW5jdGlvbigncmV0dXJuIHRoaXMnKSgpO1xuaWYgKHR5cGVvZiBfX2cgPT0gJ251bWJlcicpIF9fZyA9IGdsb2JhbDsgLy8gZXNsaW50LWRpc2FibGUtbGluZSBuby11bmRlZlxuXG5cblxuLy8vLy8vLy8vLy8vLy8vLy8vXG4vLyBXRUJQQUNLIEZPT1RFUlxuLy8gLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX2dsb2JhbC5qc1xuLy8gbW9kdWxlIGlkID0gMVxuLy8gbW9kdWxlIGNodW5rcyA9IDAiXSwibWFwcGluZ3MiOiJBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///1\n")},function(module,exports){eval("var hasOwnProperty = {}.hasOwnProperty;\nmodule.exports = function (it, key) {\n return hasOwnProperty.call(it, key);\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMi5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy8uL25vZGVfbW9kdWxlcy9jb3JlLWpzL2xpYnJhcnkvbW9kdWxlcy9faGFzLmpzPzBmNjIiXSwic291cmNlc0NvbnRlbnQiOlsidmFyIGhhc093blByb3BlcnR5ID0ge30uaGFzT3duUHJvcGVydHk7XG5tb2R1bGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChpdCwga2V5KSB7XG4gIHJldHVybiBoYXNPd25Qcm9wZXJ0eS5jYWxsKGl0LCBrZXkpO1xufTtcblxuXG5cbi8vLy8vLy8vLy8vLy8vLy8vL1xuLy8gV0VCUEFDSyBGT09URVJcbi8vIC4vbm9kZV9tb2R1bGVzL2NvcmUtanMvbGlicmFyeS9tb2R1bGVzL19oYXMuanNcbi8vIG1vZHVsZSBpZCA9IDJcbi8vIG1vZHVsZSBjaHVua3MgPSAwIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///2\n")},function(module,exports,__webpack_require__){eval("var anObject = __webpack_require__(10);\nvar IE8_DOM_DEFINE = __webpack_require__(31);\nvar toPrimitive = __webpack_require__(18);\nvar dP = Object.defineProperty;\n\nexports.f = __webpack_require__(4) ? Object.defineProperty : function defineProperty(O, P, Attributes) {\n anObject(O);\n P = toPrimitive(P, true);\n anObject(Attributes);\n if (IE8_DOM_DEFINE) try {\n return dP(O, P, Attributes);\n } catch (e) { /* empty */ }\n if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!');\n if ('value' in Attributes) O[P] = Attributes.value;\n return O;\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMy5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy8uL25vZGVfbW9kdWxlcy9jb3JlLWpzL2xpYnJhcnkvbW9kdWxlcy9fb2JqZWN0LWRwLmpzPzdhZjAiXSwic291cmNlc0NvbnRlbnQiOlsidmFyIGFuT2JqZWN0ID0gcmVxdWlyZSgnLi9fYW4tb2JqZWN0Jyk7XG52YXIgSUU4X0RPTV9ERUZJTkUgPSByZXF1aXJlKCcuL19pZTgtZG9tLWRlZmluZScpO1xudmFyIHRvUHJpbWl0aXZlID0gcmVxdWlyZSgnLi9fdG8tcHJpbWl0aXZlJyk7XG52YXIgZFAgPSBPYmplY3QuZGVmaW5lUHJvcGVydHk7XG5cbmV4cG9ydHMuZiA9IHJlcXVpcmUoJy4vX2Rlc2NyaXB0b3JzJykgPyBPYmplY3QuZGVmaW5lUHJvcGVydHkgOiBmdW5jdGlvbiBkZWZpbmVQcm9wZXJ0eShPLCBQLCBBdHRyaWJ1dGVzKSB7XG4gIGFuT2JqZWN0KE8pO1xuICBQID0gdG9QcmltaXRpdmUoUCwgdHJ1ZSk7XG4gIGFuT2JqZWN0KEF0dHJpYnV0ZXMpO1xuICBpZiAoSUU4X0RPTV9ERUZJTkUpIHRyeSB7XG4gICAgcmV0dXJuIGRQKE8sIFAsIEF0dHJpYnV0ZXMpO1xuICB9IGNhdGNoIChlKSB7IC8qIGVtcHR5ICovIH1cbiAgaWYgKCdnZXQnIGluIEF0dHJpYnV0ZXMgfHwgJ3NldCcgaW4gQXR0cmlidXRlcykgdGhyb3cgVHlwZUVycm9yKCdBY2Nlc3NvcnMgbm90IHN1cHBvcnRlZCEnKTtcbiAgaWYgKCd2YWx1ZScgaW4gQXR0cmlidXRlcykgT1tQXSA9IEF0dHJpYnV0ZXMudmFsdWU7XG4gIHJldHVybiBPO1xufTtcblxuXG5cbi8vLy8vLy8vLy8vLy8vLy8vL1xuLy8gV0VCUEFDSyBGT09URVJcbi8vIC4vbm9kZV9tb2R1bGVzL2NvcmUtanMvbGlicmFyeS9tb2R1bGVzL19vYmplY3QtZHAuanNcbi8vIG1vZHVsZSBpZCA9IDNcbi8vIG1vZHVsZSBjaHVua3MgPSAwIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///3\n")},function(module,exports,__webpack_require__){eval("// Thank's IE8 for his funny defineProperty\nmodule.exports = !__webpack_require__(11)(function () {\n return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;\n});\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNC5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy8uL25vZGVfbW9kdWxlcy9jb3JlLWpzL2xpYnJhcnkvbW9kdWxlcy9fZGVzY3JpcHRvcnMuanM/Zjg0ZCJdLCJzb3VyY2VzQ29udGVudCI6WyIvLyBUaGFuaydzIElFOCBmb3IgaGlzIGZ1bm55IGRlZmluZVByb3BlcnR5XG5tb2R1bGUuZXhwb3J0cyA9ICFyZXF1aXJlKCcuL19mYWlscycpKGZ1bmN0aW9uICgpIHtcbiAgcmV0dXJuIE9iamVjdC5kZWZpbmVQcm9wZXJ0eSh7fSwgJ2EnLCB7IGdldDogZnVuY3Rpb24gKCkgeyByZXR1cm4gNzsgfSB9KS5hICE9IDc7XG59KTtcblxuXG5cbi8vLy8vLy8vLy8vLy8vLy8vL1xuLy8gV0VCUEFDSyBGT09URVJcbi8vIC4vbm9kZV9tb2R1bGVzL2NvcmUtanMvbGlicmFyeS9tb2R1bGVzL19kZXNjcmlwdG9ycy5qc1xuLy8gbW9kdWxlIGlkID0gNFxuLy8gbW9kdWxlIGNodW5rcyA9IDAiXSwibWFwcGluZ3MiOiJBQUFBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///4\n")},function(module,exports,__webpack_require__){eval("var global = __webpack_require__(1);\nvar core = __webpack_require__(0);\nvar ctx = __webpack_require__(30);\nvar hide = __webpack_require__(6);\nvar has = __webpack_require__(2);\nvar PROTOTYPE = 'prototype';\n\nvar $export = function (type, name, source) {\n var IS_FORCED = type & $export.F;\n var IS_GLOBAL = type & $export.G;\n var IS_STATIC = type & $export.S;\n var IS_PROTO = type & $export.P;\n var IS_BIND = type & $export.B;\n var IS_WRAP = type & $export.W;\n var exports = IS_GLOBAL ? core : core[name] || (core[name] = {});\n var expProto = exports[PROTOTYPE];\n var target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE];\n var key, own, out;\n if (IS_GLOBAL) source = name;\n for (key in source) {\n // contains in native\n own = !IS_FORCED && target && target[key] !== undefined;\n if (own && has(exports, key)) continue;\n // export native or passed\n out = own ? target[key] : source[key];\n // prevent global pollution for namespaces\n exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key]\n // bind timers to global for call from export context\n : IS_BIND && own ? ctx(out, global)\n // wrap global constructors for prevent change them in library\n : IS_WRAP && target[key] == out ? (function (C) {\n var F = function (a, b, c) {\n if (this instanceof C) {\n switch (arguments.length) {\n case 0: return new C();\n case 1: return new C(a);\n case 2: return new C(a, b);\n } return new C(a, b, c);\n } return C.apply(this, arguments);\n };\n F[PROTOTYPE] = C[PROTOTYPE];\n return F;\n // make static versions for prototype methods\n })(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;\n // export proto methods to core.%CONSTRUCTOR%.methods.%NAME%\n if (IS_PROTO) {\n (exports.virtual || (exports.virtual = {}))[key] = out;\n // export proto methods to core.%CONSTRUCTOR%.prototype.%NAME%\n if (type & $export.R && expProto && !expProto[key]) hide(expProto, key, out);\n }\n }\n};\n// type bitmap\n$export.F = 1; // forced\n$export.G = 2; // global\n$export.S = 4; // static\n$export.P = 8; // proto\n$export.B = 16; // bind\n$export.W = 32; // wrap\n$export.U = 64; // safe\n$export.R = 128; // real proto method for `library`\nmodule.exports = $export;\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNS5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy8uL25vZGVfbW9kdWxlcy9jb3JlLWpzL2xpYnJhcnkvbW9kdWxlcy9fZXhwb3J0LmpzPzkwY2QiXSwic291cmNlc0NvbnRlbnQiOlsidmFyIGdsb2JhbCA9IHJlcXVpcmUoJy4vX2dsb2JhbCcpO1xudmFyIGNvcmUgPSByZXF1aXJlKCcuL19jb3JlJyk7XG52YXIgY3R4ID0gcmVxdWlyZSgnLi9fY3R4Jyk7XG52YXIgaGlkZSA9IHJlcXVpcmUoJy4vX2hpZGUnKTtcbnZhciBoYXMgPSByZXF1aXJlKCcuL19oYXMnKTtcbnZhciBQUk9UT1RZUEUgPSAncHJvdG90eXBlJztcblxudm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0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///5\n")},function(module,exports,__webpack_require__){eval("var dP = __webpack_require__(3);\nvar createDesc = __webpack_require__(14);\nmodule.exports = __webpack_require__(4) ? function (object, key, value) {\n return dP.f(object, key, createDesc(1, value));\n} : function (object, key, value) {\n object[key] = value;\n return object;\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNi5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy8uL25vZGVfbW9kdWxlcy9jb3JlLWpzL2xpYnJhcnkvbW9kdWxlcy9faGlkZS5qcz84NDljIl0sInNvdXJjZXNDb250ZW50IjpbInZhciBkUCA9IHJlcXVpcmUoJy4vX29iamVjdC1kcCcpO1xudmFyIGNyZWF0ZURlc2MgPSByZXF1aXJlKCcuL19wcm9wZXJ0eS1kZXNjJyk7XG5tb2R1bGUuZXhwb3J0cyA9IHJlcXVpcmUoJy4vX2Rlc2NyaXB0b3JzJykgPyBmdW5jdGlvbiAob2JqZWN0LCBrZXksIHZhbHVlKSB7XG4gIHJldHVybiBkUC5mKG9iamVjdCwga2V5LCBjcmVhdGVEZXNjKDEsIHZhbHVlKSk7XG59IDogZnVuY3Rpb24gKG9iamVjdCwga2V5LCB2YWx1ZSkge1xuICBvYmplY3Rba2V5XSA9IHZhbHVlO1xuICByZXR1cm4gb2JqZWN0O1xufTtcblxuXG5cbi8vLy8vLy8vLy8vLy8vLy8vL1xuLy8gV0VCUEFDSyBGT09URVJcbi8vIC4vbm9kZV9tb2R1bGVzL2NvcmUtanMvbGlicmFyeS9tb2R1bGVzL19oaWRlLmpzXG4vLyBtb2R1bGUgaWQgPSA2XG4vLyBtb2R1bGUgY2h1bmtzID0gMCJdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///6\n")},function(module,exports){eval("module.exports = function (it) {\n return typeof it === 'object' ? it !== null : typeof it === 'function';\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNy5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy8uL25vZGVfbW9kdWxlcy9jb3JlLWpzL2xpYnJhcnkvbW9kdWxlcy9faXMtb2JqZWN0LmpzPzEyYTgiXSwic291cmNlc0NvbnRlbnQiOlsibW9kdWxlLmV4cG9ydHMgPSBmdW5jdGlvbiAoaXQpIHtcbiAgcmV0dXJuIHR5cGVvZiBpdCA9PT0gJ29iamVjdCcgPyBpdCAhPT0gbnVsbCA6IHR5cGVvZiBpdCA9PT0gJ2Z1bmN0aW9uJztcbn07XG5cblxuXG4vLy8vLy8vLy8vLy8vLy8vLy9cbi8vIFdFQlBBQ0sgRk9PVEVSXG4vLyAuL25vZGVfbW9kdWxlcy9jb3JlLWpzL2xpYnJhcnkvbW9kdWxlcy9faXMtb2JqZWN0LmpzXG4vLyBtb2R1bGUgaWQgPSA3XG4vLyBtb2R1bGUgY2h1bmtzID0gMCJdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///7\n")},function(module,exports,__webpack_require__){eval("// to indexed object, toObject with fallback for non-array-like ES3 strings\nvar IObject = __webpack_require__(61);\nvar defined = __webpack_require__(15);\nmodule.exports = function (it) {\n return IObject(defined(it));\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiOC5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy8uL25vZGVfbW9kdWxlcy9jb3JlLWpzL2xpYnJhcnkvbW9kdWxlcy9fdG8taW9iamVjdC5qcz80ZGM0Il0sInNvdXJjZXNDb250ZW50IjpbIi8vIHRvIGluZGV4ZWQgb2JqZWN0LCB0b09iamVjdCB3aXRoIGZhbGxiYWNrIGZvciBub24tYXJyYXktbGlrZSBFUzMgc3RyaW5nc1xudmFyIElPYmplY3QgPSByZXF1aXJlKCcuL19pb2JqZWN0Jyk7XG52YXIgZGVmaW5lZCA9IHJlcXVpcmUoJy4vX2RlZmluZWQnKTtcbm1vZHVsZS5leHBvcnRzID0gZnVuY3Rpb24gKGl0KSB7XG4gIHJldHVybiBJT2JqZWN0KGRlZmluZWQoaXQpKTtcbn07XG5cblxuXG4vLy8vLy8vLy8vLy8vLy8vLy9cbi8vIFdFQlBBQ0sgRk9PVEVSXG4vLyAuL25vZGVfbW9kdWxlcy9jb3JlLWpzL2xpYnJhcnkvbW9kdWxlcy9fdG8taW9iamVjdC5qc1xuLy8gbW9kdWxlIGlkID0gOFxuLy8gbW9kdWxlIGNodW5rcyA9IDAiXSwibWFwcGluZ3MiOiJBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///8\n")},function(module,exports,__webpack_require__){eval("var store = __webpack_require__(17)('wks');\nvar uid = __webpack_require__(13);\nvar Symbol = __webpack_require__(1).Symbol;\nvar USE_SYMBOL = typeof Symbol == 'function';\n\nvar $exports = module.exports = function (name) {\n return store[name] || (store[name] =\n USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name));\n};\n\n$exports.store = store;\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiOS5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy8uL25vZGVfbW9kdWxlcy9jb3JlLWpzL2xpYnJhcnkvbW9kdWxlcy9fd2tzLmpzPzc1MmMiXSwic291cmNlc0NvbnRlbnQiOlsidmFyIHN0b3JlID0gcmVxdWlyZSgnLi9fc2hhcmVkJykoJ3drcycpO1xudmFyIHVpZCA9IHJlcXVpcmUoJy4vX3VpZCcpO1xudmFyIFN5bWJvbCA9IHJlcXVpcmUoJy4vX2dsb2JhbCcpLlN5bWJvbDtcbnZhciBVU0VfU1lNQk9MID0gdHlwZW9mIFN5bWJvbCA9PSAnZnVuY3Rpb24nO1xuXG52YXIgJGV4cG9ydHMgPSBtb2R1bGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChuYW1lKSB7XG4gIHJldHVybiBzdG9yZVtuYW1lXSB8fCAoc3RvcmVbbmFtZV0gPVxuICAgIFVTRV9TWU1CT0wgJiYgU3ltYm9sW25hbWVdIHx8IChVU0VfU1lNQk9MID8gU3ltYm9sIDogdWlkKSgnU3ltYm9sLicgKyBuYW1lKSk7XG59O1xuXG4kZXhwb3J0cy5zdG9yZSA9IHN0b3JlO1xuXG5cblxuLy8vLy8vLy8vLy8vLy8vLy8vXG4vLyBXRUJQQUNLIEZPT1RFUlxuLy8gLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX3drcy5qc1xuLy8gbW9kdWxlIGlkID0gOVxuLy8gbW9kdWxlIGNodW5rcyA9IDAiXSwibWFwcGluZ3MiOiJBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7Iiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///9\n")},function(module,exports,__webpack_require__){eval("var isObject = __webpack_require__(7);\nmodule.exports = function (it) {\n if (!isObject(it)) throw TypeError(it + ' is not an object!');\n return it;\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTAuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX2FuLW9iamVjdC5qcz9lZmIzIl0sInNvdXJjZXNDb250ZW50IjpbInZhciBpc09iamVjdCA9IHJlcXVpcmUoJy4vX2lzLW9iamVjdCcpO1xubW9kdWxlLmV4cG9ydHMgPSBmdW5jdGlvbiAoaXQpIHtcbiAgaWYgKCFpc09iamVjdChpdCkpIHRocm93IFR5cGVFcnJvcihpdCArICcgaXMgbm90IGFuIG9iamVjdCEnKTtcbiAgcmV0dXJuIGl0O1xufTtcblxuXG5cbi8vLy8vLy8vLy8vLy8vLy8vL1xuLy8gV0VCUEFDSyBGT09URVJcbi8vIC4vbm9kZV9tb2R1bGVzL2NvcmUtanMvbGlicmFyeS9tb2R1bGVzL19hbi1vYmplY3QuanNcbi8vIG1vZHVsZSBpZCA9IDEwXG4vLyBtb2R1bGUgY2h1bmtzID0gMCJdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///10\n")},function(module,exports){eval("module.exports = function (exec) {\n try {\n return !!exec();\n } catch (e) {\n return true;\n }\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTEuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX2ZhaWxzLmpzPzRiY2QiXSwic291cmNlc0NvbnRlbnQiOlsibW9kdWxlLmV4cG9ydHMgPSBmdW5jdGlvbiAoZXhlYykge1xuICB0cnkge1xuICAgIHJldHVybiAhIWV4ZWMoKTtcbiAgfSBjYXRjaCAoZSkge1xuICAgIHJldHVybiB0cnVlO1xuICB9XG59O1xuXG5cblxuLy8vLy8vLy8vLy8vLy8vLy8vXG4vLyBXRUJQQUNLIEZPT1RFUlxuLy8gLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX2ZhaWxzLmpzXG4vLyBtb2R1bGUgaWQgPSAxMVxuLy8gbW9kdWxlIGNodW5rcyA9IDAiXSwibWFwcGluZ3MiOiJBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///11\n")},function(module,exports){eval("module.exports = true;\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTIuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX2xpYnJhcnkuanM/M2I4OCJdLCJzb3VyY2VzQ29udGVudCI6WyJtb2R1bGUuZXhwb3J0cyA9IHRydWU7XG5cblxuXG4vLy8vLy8vLy8vLy8vLy8vLy9cbi8vIFdFQlBBQ0sgRk9PVEVSXG4vLyAuL25vZGVfbW9kdWxlcy9jb3JlLWpzL2xpYnJhcnkvbW9kdWxlcy9fbGlicmFyeS5qc1xuLy8gbW9kdWxlIGlkID0gMTJcbi8vIG1vZHVsZSBjaHVua3MgPSAwIl0sIm1hcHBpbmdzIjoiQUFBQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///12\n")},function(module,exports){eval("var id = 0;\nvar px = Math.random();\nmodule.exports = function (key) {\n return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTMuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX3VpZC5qcz9kYzRhIl0sInNvdXJjZXNDb250ZW50IjpbInZhciBpZCA9IDA7XG52YXIgcHggPSBNYXRoLnJhbmRvbSgpO1xubW9kdWxlLmV4cG9ydHMgPSBmdW5jdGlvbiAoa2V5KSB7XG4gIHJldHVybiAnU3ltYm9sKCcuY29uY2F0KGtleSA9PT0gdW5kZWZpbmVkID8gJycgOiBrZXksICcpXycsICgrK2lkICsgcHgpLnRvU3RyaW5nKDM2KSk7XG59O1xuXG5cblxuLy8vLy8vLy8vLy8vLy8vLy8vXG4vLyBXRUJQQUNLIEZPT1RFUlxuLy8gLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX3VpZC5qc1xuLy8gbW9kdWxlIGlkID0gMTNcbi8vIG1vZHVsZSBjaHVua3MgPSAwIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///13\n")},function(module,exports){eval("module.exports = function (bitmap, value) {\n return {\n enumerable: !(bitmap & 1),\n configurable: !(bitmap & 2),\n writable: !(bitmap & 4),\n value: value\n };\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTQuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX3Byb3BlcnR5LWRlc2MuanM/NWZjMCJdLCJzb3VyY2VzQ29udGVudCI6WyJtb2R1bGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChiaXRtYXAsIHZhbHVlKSB7XG4gIHJldHVybiB7XG4gICAgZW51bWVyYWJsZTogIShiaXRtYXAgJiAxKSxcbiAgICBjb25maWd1cmFibGU6ICEoYml0bWFwICYgMiksXG4gICAgd3JpdGFibGU6ICEoYml0bWFwICYgNCksXG4gICAgdmFsdWU6IHZhbHVlXG4gIH07XG59O1xuXG5cblxuLy8vLy8vLy8vLy8vLy8vLy8vXG4vLyBXRUJQQUNLIEZPT1RFUlxuLy8gLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX3Byb3BlcnR5LWRlc2MuanNcbi8vIG1vZHVsZSBpZCA9IDE0XG4vLyBtb2R1bGUgY2h1bmtzID0gMCJdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///14\n")},function(module,exports){eval('// 7.2.1 RequireObjectCoercible(argument)\nmodule.exports = function (it) {\n if (it == undefined) throw TypeError("Can\'t call method on " + it);\n return it;\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTUuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX2RlZmluZWQuanM/ZTc2OCJdLCJzb3VyY2VzQ29udGVudCI6WyIvLyA3LjIuMSBSZXF1aXJlT2JqZWN0Q29lcmNpYmxlKGFyZ3VtZW50KVxubW9kdWxlLmV4cG9ydHMgPSBmdW5jdGlvbiAoaXQpIHtcbiAgaWYgKGl0ID09IHVuZGVmaW5lZCkgdGhyb3cgVHlwZUVycm9yKFwiQ2FuJ3QgY2FsbCBtZXRob2Qgb24gIFwiICsgaXQpO1xuICByZXR1cm4gaXQ7XG59O1xuXG5cblxuLy8vLy8vLy8vLy8vLy8vLy8vXG4vLyBXRUJQQUNLIEZPT1RFUlxuLy8gLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX2RlZmluZWQuanNcbi8vIG1vZHVsZSBpZCA9IDE1XG4vLyBtb2R1bGUgY2h1bmtzID0gMCJdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///15\n')},function(module,exports,__webpack_require__){eval("var shared = __webpack_require__(17)('keys');\nvar uid = __webpack_require__(13);\nmodule.exports = function (key) {\n return shared[key] || (shared[key] = uid(key));\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTYuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX3NoYXJlZC1rZXkuanM/NmIxZCJdLCJzb3VyY2VzQ29udGVudCI6WyJ2YXIgc2hhcmVkID0gcmVxdWlyZSgnLi9fc2hhcmVkJykoJ2tleXMnKTtcbnZhciB1aWQgPSByZXF1aXJlKCcuL191aWQnKTtcbm1vZHVsZS5leHBvcnRzID0gZnVuY3Rpb24gKGtleSkge1xuICByZXR1cm4gc2hhcmVkW2tleV0gfHwgKHNoYXJlZFtrZXldID0gdWlkKGtleSkpO1xufTtcblxuXG5cbi8vLy8vLy8vLy8vLy8vLy8vL1xuLy8gV0VCUEFDSyBGT09URVJcbi8vIC4vbm9kZV9tb2R1bGVzL2NvcmUtanMvbGlicmFyeS9tb2R1bGVzL19zaGFyZWQta2V5LmpzXG4vLyBtb2R1bGUgaWQgPSAxNlxuLy8gbW9kdWxlIGNodW5rcyA9IDAiXSwibWFwcGluZ3MiOiJBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7Iiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///16\n")},function(module,exports,__webpack_require__){eval("var core = __webpack_require__(0);\nvar global = __webpack_require__(1);\nvar SHARED = '__core-js_shared__';\nvar store = global[SHARED] || (global[SHARED] = {});\n\n(module.exports = function (key, value) {\n return store[key] || (store[key] = value !== undefined ? value : {});\n})('versions', []).push({\n version: core.version,\n mode: __webpack_require__(12) ? 'pure' : 'global',\n copyright: '© 2019 Denis Pushkarev (zloirock.ru)'\n});\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTcuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX3NoYXJlZC5qcz83YmMwIl0sInNvdXJjZXNDb250ZW50IjpbInZhciBjb3JlID0gcmVxdWlyZSgnLi9fY29yZScpO1xudmFyIGdsb2JhbCA9IHJlcXVpcmUoJy4vX2dsb2JhbCcpO1xudmFyIFNIQVJFRCA9ICdfX2NvcmUtanNfc2hhcmVkX18nO1xudmFyIHN0b3JlID0gZ2xvYmFsW1NIQVJFRF0gfHwgKGdsb2JhbFtTSEFSRURdID0ge30pO1xuXG4obW9kdWxlLmV4cG9ydHMgPSBmdW5jdGlvbiAoa2V5LCB2YWx1ZSkge1xuICByZXR1cm4gc3RvcmVba2V5XSB8fCAoc3RvcmVba2V5XSA9IHZhbHVlICE9PSB1bmRlZmluZWQgPyB2YWx1ZSA6IHt9KTtcbn0pKCd2ZXJzaW9ucycsIFtdKS5wdXNoKHtcbiAgdmVyc2lvbjogY29yZS52ZXJzaW9uLFxuICBtb2RlOiByZXF1aXJlKCcuL19saWJyYXJ5JykgPyAncHVyZScgOiAnZ2xvYmFsJyxcbiAgY29weXJpZ2h0OiAnwqkgMjAxOSBEZW5pcyBQdXNoa2FyZXYgKHpsb2lyb2NrLnJ1KSdcbn0pO1xuXG5cblxuLy8vLy8vLy8vLy8vLy8vLy8vXG4vLyBXRUJQQUNLIEZPT1RFUlxuLy8gLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX3NoYXJlZC5qc1xuLy8gbW9kdWxlIGlkID0gMTdcbi8vIG1vZHVsZSBjaHVua3MgPSAwIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7Iiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///17\n")},function(module,exports,__webpack_require__){eval("// 7.1.1 ToPrimitive(input [, PreferredType])\nvar isObject = __webpack_require__(7);\n// instead of the ES6 spec version, we didn't implement @@toPrimitive case\n// and the second argument - flag - preferred type is a string\nmodule.exports = function (it, S) {\n if (!isObject(it)) return it;\n var fn, val;\n if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;\n if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val;\n if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;\n throw TypeError(\"Can't convert object to primitive value\");\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTguanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX3RvLXByaW1pdGl2ZS5qcz8zMjYzIl0sInNvdXJjZXNDb250ZW50IjpbIi8vIDcuMS4xIFRvUHJpbWl0aXZlKGlucHV0IFssIFByZWZlcnJlZFR5cGVdKVxudmFyIGlzT2JqZWN0ID0gcmVxdWlyZSgnLi9faXMtb2JqZWN0Jyk7XG4vLyBpbnN0ZWFkIG9mIHRoZSBFUzYgc3BlYyB2ZXJzaW9uLCB3ZSBkaWRuJ3Qg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7.1.4 ToInteger\nvar ceil = Math.ceil;\nvar floor = Math.floor;\nmodule.exports = function (it) {\n return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTkuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX3RvLWludGVnZXIuanM/NTJlMSJdLCJzb3VyY2VzQ29udGVudCI6WyIvLyA3LjEuNCBUb0ludGVnZXJcbnZhciBjZWlsID0gTWF0aC5jZWlsO1xudmFyIGZsb29yID0gTWF0aC5mbG9vcjtcbm1vZHVsZS5leHBvcnRzID0gZnVuY3Rpb24gKGl0KSB7XG4gIHJldHVybiBpc05hTihpdCA9ICtpdCkgPyAwIDogKGl0ID4gMCA/IGZsb29yIDogY2VpbCkoaXQpO1xufTtcblxuXG5cbi8vLy8vLy8vLy8vLy8vLy8vL1xuLy8gV0VCUEFDSyBGT09URVJcbi8vIC4vbm9kZV9tb2R1bGVzL2NvcmUtanMvbGlicmFyeS9tb2R1bGVzL190by1pbnRlZ2VyLmpzXG4vLyBtb2R1bGUgaWQgPSAxOVxuLy8gbW9kdWxlIGNodW5rcyA9IDAiXSwibWFwcGluZ3MiOiJBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///19\n")},function(module,exports){eval("module.exports = {};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjAuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX2l0ZXJhdG9ycy5qcz9mZGI0Il0sInNvdXJjZXNDb250ZW50IjpbIm1vZHVsZS5leHBvcnRzID0ge307XG5cblxuXG4vLy8vLy8vLy8vLy8vLy8vLy9cbi8vIFdFQlBBQ0sgRk9PVEVSXG4vLyAuL25vZGVfbW9kdWxlcy9jb3JlLWpzL2xpYnJhcnkvbW9kdWxlcy9faXRlcmF0b3JzLmpzXG4vLyBtb2R1bGUgaWQgPSAyMFxuLy8gbW9kdWxlIGNodW5rcyA9IDAiXSwibWFwcGluZ3MiOiJBQUFBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///20\n")},function(module,exports,__webpack_require__){eval("// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])\nvar anObject = __webpack_require__(10);\nvar dPs = __webpack_require__(60);\nvar enumBugKeys = __webpack_require__(23);\nvar IE_PROTO = __webpack_require__(16)('IE_PROTO');\nvar Empty = function () { /* empty */ };\nvar PROTOTYPE = 'prototype';\n\n// Create object with fake `null` prototype: use iframe Object with cleared prototype\nvar createDict = function () {\n // Thrash, waste and sodomy: IE GC bug\n var iframe = __webpack_require__(32)('iframe');\n var i = enumBugKeys.length;\n var lt = '<';\n var gt = '>';\n var iframeDocument;\n iframe.style.display = 'none';\n __webpack_require__(65).appendChild(iframe);\n iframe.src = 'javascript:'; // eslint-disable-line no-script-url\n // createDict = iframe.contentWindow.Object;\n // html.removeChild(iframe);\n iframeDocument = iframe.contentWindow.document;\n iframeDocument.open();\n iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt);\n iframeDocument.close();\n createDict = iframeDocument.F;\n while (i--) delete createDict[PROTOTYPE][enumBugKeys[i]];\n return createDict();\n};\n\nmodule.exports = Object.create || function create(O, Properties) {\n var result;\n if (O !== null) {\n Empty[PROTOTYPE] = anObject(O);\n result = new Empty();\n Empty[PROTOTYPE] = null;\n // add \"__proto__\" for Object.getPrototypeOf polyfill\n result[IE_PROTO] = O;\n } else result = createDict();\n return Properties === undefined ? result : dPs(result, Properties);\n};\n//# sourceURL=[module]\n//# source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hdGVEaWN0KCk7XG4gIHJldHVybiBQcm9wZXJ0aWVzID09PSB1bmRlZmluZWQgPyByZXN1bHQgOiBkUHMocmVzdWx0LCBQcm9wZXJ0aWVzKTtcbn07XG5cblxuXG4vLy8vLy8vLy8vLy8vLy8vLy9cbi8vIFdFQlBBQ0sgRk9PVEVSXG4vLyAuL25vZGVfbW9kdWxlcy9jb3JlLWpzL2xpYnJhcnkvbW9kdWxlcy9fb2JqZWN0LWNyZWF0ZS5qc1xuLy8gbW9kdWxlIGlkID0gMjFcbi8vIG1vZHVsZSBjaHVua3MgPSAwIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///21\n")},function(module,exports,__webpack_require__){eval("// 19.1.2.14 / 15.2.3.14 Object.keys(O)\nvar $keys = __webpack_require__(36);\nvar enumBugKeys = __webpack_require__(23);\n\nmodule.exports = Object.keys || function keys(O) {\n return $keys(O, enumBugKeys);\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjIuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX29iamVjdC1rZXlzLmpzPzk2NGIiXSwic291cmNlc0NvbnRlbnQiOlsiLy8gMTkuMS4yLjE0IC8gMTUuMi4zLjE0IE9iamVjdC5rZXlzKE8pXG52YXIgJGtleXMgPSByZXF1aXJlKCcuL19vYmplY3Qta2V5cy1pbnRlcm5hbCcpO1xudmFyIGVudW1CdWdLZXlzID0gcmVxdWlyZSgnLi9fZW51bS1idWcta2V5cycpO1xuXG5tb2R1bGUuZXhwb3J0cyA9IE9iamVjdC5rZXlzIHx8IGZ1bmN0aW9uIGtleXMoTykge1xuICByZXR1cm4gJGtleXMoTywgZW51bUJ1Z0tleXMpO1xufTtcblxuXG5cbi8vLy8vLy8vLy8vLy8vLy8vL1xuLy8gV0VCUEFDSyBGT09URVJcbi8vIC4vbm9kZV9tb2R1bGVzL2NvcmUtanMvbGlicmFyeS9tb2R1bGVzL19vYmplY3Qta2V5cy5qc1xuLy8gbW9kdWxlIGlkID0gMjJcbi8vIG1vZHVsZSBjaHVua3MgPSAwIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///22\n")},function(module,exports){eval("// IE 8- don't enum bug keys\nmodule.exports = (\n 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'\n).split(',');\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjMuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX2VudW0tYnVnLWtleXMuanM/YzY3NyJdLCJzb3VyY2VzQ29udGVudCI6WyIvLyBJRSA4LSBkb24ndCBlbnVtIGJ1ZyBrZXlzXG5tb2R1bGUuZXhwb3J0cyA9IChcbiAgJ2NvbnN0cnVjdG9yLGhhc093blByb3BlcnR5LGlzUHJvdG90eXBlT2YscHJvcGVydHlJc0VudW1lcmFibGUsdG9Mb2NhbGVTdHJpbmcsdG9TdHJpbmcsdmFsdWVPZidcbikuc3BsaXQoJywnKTtcblxuXG5cbi8vLy8vLy8vLy8vLy8vLy8vL1xuLy8gV0VCUEFDSyBGT09URVJcbi8vIC4vbm9kZV9tb2R1bGVzL2NvcmUtanMvbGlicmFyeS9tb2R1bGVzL19lbnVtLWJ1Zy1rZXlzLmpzXG4vLyBtb2R1bGUgaWQgPSAyM1xuLy8gbW9kdWxlIGNodW5rcyA9IDAiXSwibWFwcGluZ3MiOiJBQUFBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///23\n")},function(module,exports,__webpack_require__){eval("var def = __webpack_require__(3).f;\nvar has = __webpack_require__(2);\nvar TAG = __webpack_require__(9)('toStringTag');\n\nmodule.exports = function (it, tag, stat) {\n if (it && !has(it = stat ? it : it.prototype, TAG)) def(it, TAG, { configurable: true, value: tag });\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjQuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX3NldC10by1zdHJpbmctdGFnLmpzPzdiYTkiXSwic291cmNlc0NvbnRlbnQiOlsidmFyIGRlZiA9IHJlcXVpcmUoJy4vX29iamVjdC1kcCcpLmY7XG52YXIgaGFzID0gcmVxdWlyZSgnLi9faGFzJyk7XG52YXIgVEFHID0gcmVxdWlyZSgnLi9fd2tzJykoJ3RvU3RyaW5nVGFnJyk7XG5cbm1vZHVsZS5leHBvcnRzID0gZnVuY3Rpb24gKGl0LCB0YWcsIHN0YXQpIHtcbiAgaWYgKGl0ICYmICFoYXMoaXQgPSBzdGF0ID8gaXQgOiBpdC5wcm90b3R5cGUsIFRBRykpIGRlZihpdCwgVEFHLCB7IGNvbmZpZ3VyYWJsZTogdHJ1ZSwgdmFsdWU6IHRhZyB9KTtcbn07XG5cblxuXG4vLy8vLy8vLy8vLy8vLy8vLy9cbi8vIFdFQlBBQ0sgRk9PVEVSXG4vLyAuL25vZGVfbW9kdWxlcy9jb3JlLWpzL2xpYnJhcnkvbW9kdWxlcy9fc2V0LXRvLXN0cmluZy10YWcuanNcbi8vIG1vZHVsZSBpZCA9IDI0XG4vLyBtb2R1bGUgY2h1bmtzID0gMCJdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7Iiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///24\n")},function(module,exports,__webpack_require__){eval("exports.f = __webpack_require__(9);\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjUuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX3drcy1leHQuanM/MmExZSJdLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnRzLmYgPSByZXF1aXJlKCcuL193a3MnKTtcblxuXG5cbi8vLy8vLy8vLy8vLy8vLy8vL1xuLy8gV0VCUEFDSyBGT09URVJcbi8vIC4vbm9kZV9tb2R1bGVzL2NvcmUtanMvbGlicmFyeS9tb2R1bGVzL193a3MtZXh0LmpzXG4vLyBtb2R1bGUgaWQgPSAyNVxuLy8gbW9kdWxlIGNodW5rcyA9IDAiXSwibWFwcGluZ3MiOiJBQUFBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///25\n")},function(module,exports,__webpack_require__){eval("var global = __webpack_require__(1);\nvar core = __webpack_require__(0);\nvar LIBRARY = __webpack_require__(12);\nvar wksExt = __webpack_require__(25);\nvar defineProperty = __webpack_require__(3).f;\nmodule.exports = function (name) {\n var $Symbol = core.Symbol || (core.Symbol = LIBRARY ? {} : global.Symbol || {});\n if (name.charAt(0) != '_' && !(name in $Symbol)) defineProperty($Symbol, name, { value: wksExt.f(name) });\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjYuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX3drcy1kZWZpbmUuanM/NzJiOSJdLCJzb3VyY2VzQ29udGVudCI6WyJ2YXIgZ2xvYmFsID0gcmVxdWlyZSgnLi9fZ2xvYmFsJyk7XG52YXIgY29yZSA9IHJlcXVpcmUoJy4vX2NvcmUnKTtcbnZhciBMSUJSQVJZID0gcmVxdWlyZSgnLi9fbGlicmFyeScpO1xudmFyIHdrc0V4dCA9IHJlcXVpcmUoJy4vX3drcy1leHQnKTtcbnZhciBkZWZpbmVQcm9wZXJ0eSA9IHJlcXVpcmUoJy4vX29iamVjdC1kcCcpLmY7XG5tb2R1bGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChuYW1lKSB7XG4gIHZhciAkU3ltYm9sID0gY29yZS5TeW1ib2wgfHwgKGNvcmUuU3ltYm9sID0gTElCUkFSWSA/IHt9IDogZ2xvYmFsLlN5bWJvbCB8fCB7fSk7XG4gIGlmIChuYW1lLmNoYXJBdCgwKSAhPSAnXycgJiYgIShuYW1lIGluICRTeW1ib2wpKSBkZWZpbmVQcm9wZXJ0eSgkU3ltYm9sLCBuYW1lLCB7IHZhbHVlOiB3a3NFeHQuZihuYW1lKSB9KTtcbn07XG5cblxuXG4vLy8vLy8vLy8vLy8vLy8vLy9cbi8vIFdFQlBBQ0sgRk9PVEVSXG4vLyAuL25vZGVfbW9kdWxlcy9jb3JlLWpzL2xpYnJhcnkvbW9kdWxlcy9fd2tzLWRlZmluZS5qc1xuLy8gbW9kdWxlIGlkID0gMjZcbi8vIG1vZHVsZSBjaHVua3MgPSAwIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7Iiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///26\n")},function(module,exports){eval("exports.f = {}.propertyIsEnumerable;\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjcuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX29iamVjdC1waWUuanM/MzY5MiJdLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnRzLmYgPSB7fS5wcm9wZXJ0eUlzRW51bWVyYWJsZTtcblxuXG5cbi8vLy8vLy8vLy8vLy8vLy8vL1xuLy8gV0VCUEFDSyBGT09URVJcbi8vIC4vbm9kZV9tb2R1bGVzL2NvcmUtanMvbGlicmFyeS9tb2R1bGVzL19vYmplY3QtcGllLmpzXG4vLyBtb2R1bGUgaWQgPSAyN1xuLy8gbW9kdWxlIGNodW5rcyA9IDAiXSwibWFwcGluZ3MiOiJBQUFBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///27\n")},function(module,exports,__webpack_require__){eval("// 7.1.13 ToObject(argument)\nvar defined = __webpack_require__(15);\nmodule.exports = function (it) {\n return Object(defined(it));\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjguanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX3RvLW9iamVjdC5qcz9iMDFkIl0sInNvdXJjZXNDb250ZW50IjpbIi8vIDcuMS4xMyBUb09iamVjdChhcmd1bWVudClcbnZhciBkZWZpbmVkID0gcmVxdWlyZSgnLi9fZGVmaW5lZCcpO1xubW9kdWxlLmV4cG9ydHMgPSBmdW5jdGlvbiAoaXQpIHtcbiAgcmV0dXJuIE9iamVjdChkZWZpbmVkKGl0KSk7XG59O1xuXG5cblxuLy8vLy8vLy8vLy8vLy8vLy8vXG4vLyBXRUJQQUNLIEZPT1RFUlxuLy8gLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX3RvLW9iamVjdC5qc1xuLy8gbW9kdWxlIGlkID0gMjhcbi8vIG1vZHVsZSBjaHVua3MgPSAwIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///28\n")},function(module,exports,__webpack_require__){eval("// 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O)\nvar has = __webpack_require__(2);\nvar toObject = __webpack_require__(28);\nvar IE_PROTO = __webpack_require__(16)('IE_PROTO');\nvar ObjectProto = Object.prototype;\n\nmodule.exports = Object.getPrototypeOf || function (O) {\n O = toObject(O);\n if (has(O, IE_PROTO)) return O[IE_PROTO];\n if (typeof O.constructor == 'function' && O instanceof O.constructor) {\n return O.constructor.prototype;\n } return O instanceof Object ? ObjectProto : null;\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMjkuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX29iamVjdC1ncG8uanM/M2YzYyJdLCJzb3VyY2VzQ29udGVudCI6WyIvLyAxOS4xLjIuOSAvIDE1LjIuMy4yIE9iamVjdC5nZXRQcm90b3R5cGVPZihPKVxudmFyIGhhcyA9IHJlcXVpcmUoJy4vX2hhcycpO1xudmFyIHRvT2JqZWN0ID0gcmVxdWlyZSgnLi9fdG8tb2JqZWN0Jyk7XG52YXIgSUVfUFJPVE8gPSByZXF1aXJlKCcuL19zaGFyZWQta2V5JykoJ0lFX1BST1RPJyk7XG52YXIgT2JqZWN0UHJvdG8gPSBPYmplY3QucHJvdG90eXBlO1xuXG5tb2R1bGUuZXhwb3J0cyA9IE9iamVjdC5nZXRQcm90b3R5cGVPZiB8fCBmdW5jdGlvbiAoTykge1xuICBPID0gdG9PYmplY3QoTyk7XG4gIGlmIChoYXMoTywgSUVfUFJPVE8pKSByZXR1cm4gT1tJRV9QUk9UT107XG4gIGlmICh0eXBlb2YgTy5jb25zdHJ1Y3RvciA9PSAnZnVuY3Rpb24nICYmIE8gaW5zdGFuY2VvZiBPLmNvbnN0cnVjdG9yKSB7XG4gICAgcmV0dXJuIE8uY29uc3RydWN0b3IucHJvdG90eXBlO1xuICB9IHJldHVybiBPIGluc3RhbmNlb2YgT2JqZWN0ID8gT2JqZWN0UHJvdG8gOiBudWxsO1xufTtcblxuXG5cbi8vLy8vLy8vLy8vLy8vLy8vL1xuLy8gV0VCUEFDSyBGT09URVJcbi8vIC4vbm9kZV9tb2R1bGVzL2NvcmUtanMvbGlicmFyeS9tb2R1bGVzL19vYmplY3QtZ3BvLmpzXG4vLyBtb2R1bGUgaWQgPSAyOVxuLy8gbW9kdWxlIGNodW5rcyA9IDAiXSwibWFwcGluZ3MiOiJBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///29\n")},function(module,exports,__webpack_require__){eval("// optional / simple context binding\nvar aFunction = __webpack_require__(48);\nmodule.exports = function (fn, that, length) {\n aFunction(fn);\n if (that === undefined) return fn;\n switch (length) {\n case 1: return function (a) {\n return fn.call(that, a);\n };\n case 2: return function (a, b) {\n return fn.call(that, a, b);\n };\n case 3: return function (a, b, c) {\n return fn.call(that, a, b, c);\n };\n }\n return function (/* ...args */) {\n return fn.apply(that, arguments);\n };\n};\n//# sourceURL=[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b2R1bGUgY2h1bmtzID0gMCJdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///30\n")},function(module,exports,__webpack_require__){eval("module.exports = !__webpack_require__(4) && !__webpack_require__(11)(function () {\n return Object.defineProperty(__webpack_require__(32)('div'), 'a', { get: function () { return 7; } }).a != 7;\n});\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMzEuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX2llOC1kb20tZGVmaW5lLmpzPzQ5ZjAiXSwic291cmNlc0NvbnRlbnQiOlsibW9kdWxlLmV4cG9ydHMgPSAhcmVxdWlyZSgnLi9fZGVzY3JpcHRvcnMnKSAmJiAhcmVxdWlyZSgnLi9fZmFpbHMnKShmdW5jdGlvbiAoKSB7XG4gIHJldHVybiBPYmplY3QuZGVmaW5lUHJvcGVydHkocmVxdWlyZSgnLi9fZG9tLWNyZWF0ZScpKCdkaXYnKSwgJ2EnLCB7IGdldDogZnVuY3Rpb24gKCkgeyByZXR1cm4gNzsgfSB9KS5hICE9IDc7XG59KTtcblxuXG5cbi8vLy8vLy8vLy8vLy8vLy8vL1xuLy8gV0VCUEFDSyBGT09URVJcbi8vIC4vbm9kZV9tb2R1bGVzL2NvcmUtanMvbGlicmFyeS9tb2R1bGVzL19pZTgtZG9tLWRlZmluZS5qc1xuLy8gbW9kdWxlIGlkID0gMzFcbi8vIG1vZHVsZSBjaHVua3MgPSAwIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7Iiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///31\n")},function(module,exports,__webpack_require__){eval("var isObject = __webpack_require__(7);\nvar document = __webpack_require__(1).document;\n// typeof document.createElement is 'object' in old IE\nvar is = isObject(document) && isObject(document.createElement);\nmodule.exports = function (it) {\n return is ? document.createElement(it) : {};\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMzIuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX2RvbS1jcmVhdGUuanM/MzhkZCJdLCJzb3VyY2VzQ29udGVudCI6WyJ2YXIgaXNPYmplY3QgPSByZXF1aXJlKCcuL19pcy1vYmplY3QnKTtcbnZhciBkb2N1bWVudCA9IHJlcXVpcmUoJy4vX2dsb2JhbCcpLmRvY3VtZW50O1xuLy8gdHlwZW9mIGRvY3VtZW50LmNyZWF0ZUVsZW1lbnQgaXMgJ29iamVjdCcgaW4gb2xkIElFXG52YXIgaXMgPSBpc09iamVjdChkb2N1bWVudCkgJiYgaXNPYmplY3QoZG9jdW1lbnQuY3JlYXRlRWxlbWVudCk7XG5tb2R1bGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChpdCkge1xuICByZXR1cm4gaXMgPyBkb2N1bWVudC5jcmVhdGVFbGVtZW50KGl0KSA6IHt9O1xufTtcblxuXG5cbi8vLy8vLy8vLy8vLy8vLy8vL1xuLy8gV0VCUEFDSyBGT09URVJcbi8vIC4vbm9kZV9tb2R1bGVzL2NvcmUtanMvbGlicmFyeS9tb2R1bGVzL19kb20tY3JlYXRlLmpzXG4vLyBtb2R1bGUgaWQgPSAzMlxuLy8gbW9kdWxlIGNodW5rcyA9IDAiXSwibWFwcGluZ3MiOiJBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///32\n")},function(module,exports,__webpack_require__){"use strict";eval('\n\nexports.__esModule = true;\n\nvar _iterator = __webpack_require__(55);\n\nvar _iterator2 = _interopRequireDefault(_iterator);\n\nvar _symbol = __webpack_require__(70);\n\nvar _symbol2 = _interopRequireDefault(_symbol);\n\nvar _typeof = typeof _symbol2.default === "function" && typeof _iterator2.default === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof _symbol2.default === "function" && obj.constructor === _symbol2.default && obj !== _symbol2.default.prototype ? "symbol" : typeof obj; };\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nexports.default = typeof _symbol2.default === "function" && _typeof(_iterator2.default) === "symbol" ? function (obj) {\n return typeof obj === "undefined" ? "undefined" : _typeof(obj);\n} : function (obj) {\n return obj && typeof _symbol2.default === "function" && obj.constructor === _symbol2.default && obj !== _symbol2.default.prototype ? "symbol" : typeof obj === "undefined" ? "undefined" : _typeof(obj);\n};//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMzMuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYmFiZWwtcnVudGltZS9oZWxwZXJzL3R5cGVvZi5qcz9hNDU2Il0sInNvdXJjZXNDb250ZW50IjpbIlwidXNlIHN0cmljdFwiO1xuXG5leHBvcnRzLl9fZXNNb2R1bGUgPSB0cnVlO1xuXG52YXIgX2l0ZXJhdG9yID0gcmVxdWlyZShcIi4uL2NvcmUtanMvc3ltYm9sL2l0ZXJhdG9yXCIpO1xuXG52YXIgX2l0ZXJhdG9yMiA9IF9pbnRlcm9wUmVxdWlyZURlZmF1bHQoX2l0ZXJhdG9yKTtcblxudmFyIF9zeW1ib2wgPSByZXF1aXJlKFwiLi4vY29yZS1qcy9zeW1ib2xcIik7XG5cbnZhciBfc3ltYm9sMiA9IF9pbn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b3R5cGUgPyBcInN5bWJvbFwiIDogdHlwZW9mIG9iaiA9PT0gXCJ1bmRlZmluZWRcIiA/IFwidW5kZWZpbmVkXCIgOiBfdHlwZW9mKG9iaik7XG59O1xuXG5cbi8vLy8vLy8vLy8vLy8vLy8vL1xuLy8gV0VCUEFDSyBGT09URVJcbi8vIC4vbm9kZV9tb2R1bGVzL2JhYmVsLXJ1bnRpbWUvaGVscGVycy90eXBlb2YuanNcbi8vIG1vZHVsZSBpZCA9IDMzXG4vLyBtb2R1bGUgY2h1bmtzID0gMCJdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBIiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///33\n')},function(module,exports,__webpack_require__){"use strict";eval("\nvar LIBRARY = __webpack_require__(12);\nvar $export = __webpack_require__(5);\nvar redefine = __webpack_require__(35);\nvar hide = __webpack_require__(6);\nvar Iterators = __webpack_require__(20);\nvar $iterCreate = __webpack_require__(59);\nvar setToStringTag = __webpack_require__(24);\nvar getPrototypeOf = __webpack_require__(29);\nvar ITERATOR = __webpack_require__(9)('iterator');\nvar BUGGY = !([].keys && 'next' in [].keys()); // Safari has buggy iterators w/o `next`\nvar FF_ITERATOR = '@@iterator';\nvar KEYS = 'keys';\nvar VALUES = 'values';\n\nvar returnThis = function () { return this; };\n\nmodule.exports = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) {\n $iterCreate(Constructor, NAME, next);\n var getMethod = function (kind) {\n if (!BUGGY && kind in proto) return proto[kind];\n switch (kind) {\n case KEYS: return function keys() { return new Constructor(this, kind); };\n case VALUES: return function values() { return new Constructor(this, kind); };\n } return function entries() { return new Constructor(this, kind); };\n };\n var TAG = NAME + ' Iterator';\n var DEF_VALUES = DEFAULT == VALUES;\n var VALUES_BUG = false;\n var proto = Base.prototype;\n var $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT];\n var $default = $native || getMethod(DEFAULT);\n var $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined;\n var $anyNative = NAME == 'Array' ? proto.entries || $native : $native;\n var methods, key, IteratorPrototype;\n // Fix native\n if ($anyNative) {\n IteratorPrototype = getPrototypeOf($anyNative.call(new Base()));\n if (IteratorPrototype !== Object.prototype && IteratorPrototype.next) {\n // Set @@toStringTag to native iterators\n setToStringTag(IteratorPrototype, TAG, true);\n // fix for some old engines\n if (!LIBRARY && typeof IteratorPrototype[ITERATOR] != 'function') hide(IteratorPrototype, ITERATOR, returnThis);\n }\n }\n // fix Array#{values, @@iterator}.name in V8 / FF\n if (DEF_VALUES && $native && $native.name !== VALUES) {\n VALUES_BUG = true;\n $default = function values() { return $native.call(this); };\n }\n // Define iterator\n if ((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])) {\n hide(proto, ITERATOR, $default);\n }\n // Plug for library\n Iterators[NAME] = $default;\n Iterators[TAG] = returnThis;\n if (DEFAULT) {\n methods = {\n values: DEF_VALUES ? $default : getMethod(VALUES),\n keys: IS_SET ? $default : getMethod(KEYS),\n entries: $entries\n };\n if (FORCED) for (key in methods) {\n if (!(key in proto)) redefine(proto, key, methods[key]);\n } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods);\n }\n return methods;\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMzQuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX2l0ZXItZGVmaW5lLmpzP2JjODAiXSwic291cmNlc0NvbnRlbnQiOlsiJ3VzZSBzdHJpY3QnO1xudmFyIExJ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0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7Iiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///34\n")},function(module,exports,__webpack_require__){eval("module.exports = __webpack_require__(6);\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMzUuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX3JlZGVmaW5lLmpzP2YzY2QiXSwic291cmNlc0NvbnRlbnQiOlsibW9kdWxlLmV4cG9ydHMgPSByZXF1aXJlKCcuL19oaWRlJyk7XG5cblxuXG4vLy8vLy8vLy8vLy8vLy8vLy9cbi8vIFdFQlBBQ0sgRk9PVEVSXG4vLyAuL25vZGVfbW9kdWxlcy9jb3JlLWpzL2xpYnJhcnkvbW9kdWxlcy9fcmVkZWZpbmUuanNcbi8vIG1vZHVsZSBpZCA9IDM1XG4vLyBtb2R1bGUgY2h1bmtzID0gMCJdLCJtYXBwaW5ncyI6IkFBQUE7Iiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///35\n")},function(module,exports,__webpack_require__){eval("var has = __webpack_require__(2);\nvar toIObject = __webpack_require__(8);\nvar arrayIndexOf = __webpack_require__(62)(false);\nvar IE_PROTO = __webpack_require__(16)('IE_PROTO');\n\nmodule.exports = function (object, names) {\n var O = toIObject(object);\n var i = 0;\n var result = [];\n var key;\n for (key in O) if (key != IE_PROTO) has(O, key) && result.push(key);\n // Don't enum bug & hidden keys\n while (names.length > i) if (has(O, key = names[i++])) {\n ~arrayIndexOf(result, key) || result.push(key);\n }\n return result;\n};\n//# sourceURL=[module]\n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WtleXMtaW50ZXJuYWwuanNcbi8vIG1vZHVsZSBpZCA9IDM2XG4vLyBtb2R1bGUgY2h1bmtzID0gMCJdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///36\n")},function(module,exports){eval("var toString = {}.toString;\n\nmodule.exports = function (it) {\n return toString.call(it).slice(8, -1);\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMzcuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX2NvZi5qcz80N2QzIl0sInNvdXJjZXNDb250ZW50IjpbInZhciB0b1N0cmluZyA9IHt9LnRvU3RyaW5nO1xuXG5tb2R1bGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChpdCkge1xuICByZXR1cm4gdG9TdHJpbmcuY2FsbChpdCkuc2xpY2UoOCwgLTEpO1xufTtcblxuXG5cbi8vLy8vLy8vLy8vLy8vLy8vL1xuLy8gV0VCUEFDSyBGT09URVJcbi8vIC4vbm9kZV9tb2R1bGVzL2NvcmUtanMvbGlicmFyeS9tb2R1bGVzL19jb2YuanNcbi8vIG1vZHVsZSBpZCA9IDM3XG4vLyBtb2R1bGUgY2h1bmtzID0gMCJdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///37\n")},function(module,exports){eval("exports.f = Object.getOwnPropertySymbols;\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMzguanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX29iamVjdC1nb3BzLmpzP2Q2NDQiXSwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0cy5mID0gT2JqZWN0LmdldE93blByb3BlcnR5U3ltYm9scztcblxuXG5cbi8vLy8vLy8vLy8vLy8vLy8vL1xuLy8gV0VCUEFDSyBGT09URVJcbi8vIC4vbm9kZV9tb2R1bGVzL2NvcmUtanMvbGlicmFyeS9tb2R1bGVzL19vYmplY3QtZ29wcy5qc1xuLy8gbW9kdWxlIGlkID0gMzhcbi8vIG1vZHVsZSBjaHVua3MgPSAwIl0sIm1hcHBpbmdzIjoiQUFBQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///38\n")},function(module,exports,__webpack_require__){eval("// 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O)\nvar $keys = __webpack_require__(36);\nvar hiddenKeys = __webpack_require__(23).concat('length', 'prototype');\n\nexports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {\n return $keys(O, hiddenKeys);\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMzkuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX29iamVjdC1nb3BuLmpzPzlmNDQiXSwic291cmNlc0NvbnRlbnQiOlsiLy8gMTkuMS4yLjcgLyAxNS4yLjMuNCBPYmplY3QuZ2V0T3duUHJvcGVydHlOYW1lcyhPKVxudmFyICRrZXlzID0gcmVxdWlyZSgnLi9fb2JqZWN0LWtleXMtaW50ZXJuYWwnKTtcbnZhciBoaWRkZW5LZXlzID0gcmVxdWlyZSgnLi9fZW51bS1idWcta2V5cycpLmNvbmNhdCgnbGVuZ3RoJywgJ3Byb3RvdHlwZScpO1xuXG5leHBvcnRzLmYgPSBPYmplY3QuZ2V0T3duUHJvcGVydHlOYW1lcyB8fCBmdW5jdGlvbiBnZXRPd25Qcm9wZXJ0eU5hbWVzKE8pIHtcbiAgcmV0dXJuICRrZXlzKE8sIGhpZGRlbktleXMpO1xufTtcblxuXG5cbi8vLy8vLy8vLy8vLy8vLy8vL1xuLy8gV0VCUEFDSyBGT09URVJcbi8vIC4vbm9kZV9tb2R1bGVzL2NvcmUtanMvbGlicmFyeS9tb2R1bGVzL19vYmplY3QtZ29wbi5qc1xuLy8gbW9kdWxlIGlkID0gMzlcbi8vIG1vZHVsZSBjaHVua3MgPSAwIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///39\n")},function(module,exports,__webpack_require__){eval("var pIE = __webpack_require__(27);\nvar createDesc = __webpack_require__(14);\nvar toIObject = __webpack_require__(8);\nvar toPrimitive = __webpack_require__(18);\nvar has = __webpack_require__(2);\nvar IE8_DOM_DEFINE = __webpack_require__(31);\nvar gOPD = Object.getOwnPropertyDescriptor;\n\nexports.f = __webpack_require__(4) ? gOPD : function getOwnPropertyDescriptor(O, P) {\n O = toIObject(O);\n P = toPrimitive(P, true);\n if (IE8_DOM_DEFINE) try {\n return gOPD(O, P);\n } catch (e) { /* empty */ }\n if (has(O, P)) return createDesc(!pIE.f.call(O, P), O[P]);\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNDAuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX29iamVjdC1nb3BkLmpzPzJjYTYiXSwic291cmNlc0NvbnRlbnQiOlsidmFyIHBJRSA9IHJlcXVpc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UFDQTtBQUNBO0FBQ0E7Iiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///40\n")},function(module,__webpack_exports__,__webpack_require__){"use strict";eval("Object.defineProperty(__webpack_exports__, \"__esModule\", { value: true });\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__style_scss__ = __webpack_require__(42);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__style_scss___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__style_scss__);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__sidebar_js__ = __webpack_require__(43);\n// Include stylesheet\n\n\n// Import Click to Tweet Block\n//import './block.js';\n\n// Import Gutenberg Boilerplate Sidebar\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNDEuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9zcmMvaW5kZXguanM/ODc0OSJdLCJzb3VyY2VzQ29udGVudCI6WyIvLyBJbmNsdWRlIHN0eWxlc2hlZXRcbmltcG9ydCAnLi9zdHlsZS5zY3NzJztcblxuLy8gSW1wb3J0IENsaWNrIHRvIFR3ZWV0IEJsb2NrXG4vL2ltcG9ydCAnLi9ibG9jay5qcyc7XG5cbi8vIEltcG9ydCBHdXRlbmJlcmcgQm9pbGVycGxhdGUgU2lkZWJhclxuaW1wb3J0ICcuL3NpZGViYXIuanMnO1xuXG5cbi8vLy8vLy8vLy8vLy8vLy8vL1xuLy8gV0VCUEFDSyBGT09URVJcbi8vIC4vc3JjL2luZGV4LmpzXG4vLyBtb2R1bGUgaWQgPSA0MVxuLy8gbW9kdWxlIGNodW5rcyA9IDAiXSwibWFwcGluZ3MiOiJBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7Iiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///41\n")},function(module,exports){eval("// removed by extract-text-webpack-plugin//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNDIuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9zcmMvc3R5bGUuc2Nzcz9hY2Q4Il0sInNvdXJjZXNDb250ZW50IjpbIi8vIHJlbW92ZWQgYnkgZXh0cmFjdC10ZXh0LXdlYnBhY2stcGx1Z2luXG5cblxuLy8vLy8vLy8vLy8vLy8vLy8vXG4vLyBXRUJQQUNLIEZPT1RFUlxuLy8gLi9zcmMvc3R5bGUuc2Nzc1xuLy8gbW9kdWxlIGlkID0gNDJcbi8vIG1vZHVsZSBjaHVua3MgPSAwIl0sIm1hcHBpbmdzIjoiQUFBQSIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///42\n")},function(module,__webpack_exports__,__webpack_require__){"use strict";eval("/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(44);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_get_prototype_of__);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_classCallCheck__ = __webpack_require__(49);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_classCallCheck___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_classCallCheck__);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_helpers_createClass__ = __webpack_require__(50);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_helpers_createClass___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_helpers_createClass__);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_helpers_possibleConstructorReturn__ = __webpack_require__(54);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_helpers_possibleConstructorReturn___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_helpers_possibleConstructorReturn__);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_helpers_inherits__ = __webpack_require__(80);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_helpers_inherits___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_babel_runtime_helpers_inherits__);\n\n\n\n\n\n/**\n * Internal block libraries.\n * @since 2.2.3\n */\nvar __ = wp.i18n.__;\nvar _wp$editPost = wp.editPost,\n PluginSidebar = _wp$editPost.PluginSidebar,\n PluginSidebarMoreMenuItem = _wp$editPost.PluginSidebarMoreMenuItem;\nvar _wp$components = wp.components,\n PanelBody = _wp$components.PanelBody,\n TextControl = _wp$components.TextControl,\n Button = _wp$components.Button,\n Notice = _wp$components.Notice;\nvar _wp$element = wp.element,\n Component = _wp$element.Component,\n Fragment = _wp$element.Fragment;\nvar withSelect = wp.data.withSelect;\nvar compose = wp.compose.compose;\n\n\nvar LanguageSwitcherNotice = function LanguageSwitcherNotice(props) {\n\tif (WPGlobusGutenberg.pagenow == WPGlobusGutenberg.postNewPage) {\n\t\treturn wp.element.createElement('div', null);\n\t}\n\n\tvar dev = '';\n\tif ('undefined' !== typeof WPGlobusBlockEditorDevelop && !WPGlobusBlockEditorDevelop.production) {\n\t\tdev = '(develop)';\n\t}\n\n\treturn wp.element.createElement(\n\t\tNotice,\n\t\t{ className: 'wpglobus-block-editor-panel__notice', status: 'informational', isDismissible: false },\n\t\t__('Select language'),\n\t\t' ',\n\t\tdev\n\t);\n};\n\nvar LanguageSwitcher = function LanguageSwitcher(props) {\n\n\tif (WPGlobusGutenberg.pagenow == WPGlobusGutenberg.postNewPage) {\n\t\treturn wp.element.createElement(\n\t\t\t'div',\n\t\t\t{ className: 'wpglobus-block-editor-panel__switcher-box' },\n\t\t\tWPGlobusGutenberg.i18n.save_post\n\t\t);\n\t}\n\n\tvar language = WPGlobusGutenberg.language;\n\tvar flagsUrl = WPGlobusGutenberg.flags_url;\n\tvar enabledLanguages = WPGlobusCoreData.enabled_languages;\n\tvar languageNames = WPGlobusCoreData.en_language_name;\n\tvar ref = location.href;\n\tvar refs = {};\n\tfor (var key in enabledLanguages) {\n\t\tif (-1 == ref.indexOf('language=' + language)) {\n\t\t\trefs[enabledLanguages[key]] = ref + '&language=' + enabledLanguages[key];\n\t\t} else {\n\t\t\trefs[enabledLanguages[key]] = ref.replace('language=' + language, 'language=' + enabledLanguages[key]);\n\t\t}\n\t}\n\n\treturn wp.element.createElement(\n\t\t'div',\n\t\t{ className: 'wpglobus-block-editor-panel__switcher-box' },\n\t\twp.element.createElement(\n\t\t\t'ul',\n\t\t\tnull,\n\t\t\tenabledLanguages.map(function (lang) {\n\t\t\t\treturn wp.element.createElement(\n\t\t\t\t\t'li',\n\t\t\t\t\t{ key: lang },\n\t\t\t\t\twp.element.createElement('img', { className: 'wpglobus-block-editor-panel__flag', height: '20px', width: '20px', src: flagsUrl[lang] }),\n\t\t\t\t\t'\\xA0\\xA0',\n\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\tButton,\n\t\t\t\t\t\t{ href: refs[lang], isSmall: true, isPrimary: true },\n\t\t\t\t\t\tlanguageNames[lang]\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t})\n\t\t)\n\t);\n};\n\nvar WPGlobusInfo = function WPGlobusInfo(props) {\n\treturn wp.element.createElement(\n\t\t'div',\n\t\t{ className: 'wpglobus-block-editor-panel__info' },\n\t\twp.element.createElement(\n\t\t\tButton,\n\t\t\t{ href: props.href, target: '_blank', isLink: true },\n\t\t\t__('WPGlobus Premium Add-ons')\n\t\t)\n\t);\n};\n\nvar SettingsLink = function SettingsLink(props) {\n\treturn wp.element.createElement(\n\t\t'div',\n\t\t{ className: 'wpglobus-block-editor-panel__settings-link' },\n\t\twp.element.createElement(\n\t\t\tButton,\n\t\t\t{ href: props.href, isLink: true },\n\t\t\t__('Settings')\n\t\t)\n\t);\n};\n\nvar registerPlugin = wp.plugins.registerPlugin;\n\nvar WPGlobus_BlockEditor = function (_Component) {\n\t__WEBPACK_IMPORTED_MODULE_4_babel_runtime_helpers_inherits___default()(WPGlobus_BlockEditor, _Component);\n\n\tfunction WPGlobus_BlockEditor() {\n\t\t__WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_classCallCheck___default()(this, WPGlobus_BlockEditor);\n\n\t\tvar _this = __WEBPACK_IMPORTED_MODULE_3_babel_runtime_helpers_possibleConstructorReturn___default()(this, (WPGlobus_BlockEditor.__proto__ || __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_get_prototype_of___default()(WPGlobus_BlockEditor)).apply(this, arguments));\n\n\t\tvar dev = '';\n\t\tif ('undefined' !== typeof WPGlobusBlockEditorDevelop && !WPGlobusBlockEditorDevelop.production) {\n\t\t\tdev = ' (develop)';\n\t\t}\n\n\t\t_this.state = {\n\t\t\toptionsTabUrl: WPGlobusGutenberg.block_editor_tab_url,\n\t\t\tstoreLink: WPGlobusGutenberg.store_link,\n\t\t\theaderTitle: __('WPGlobus') + dev,\n\t\t\tmoreMenuItemTitle: __('WPGlobus')\n\t\t};\n\n\t\tsetTimeout(function () {\n\t\t\tvar buttons = document.getElementsByClassName('components-icon-button');\n\t\t\tfor (var i = 0; i < buttons.length; i++) {\n\t\t\t\tvar status = buttons[i].getAttribute('aria-label');\n\t\t\t\t//if ( status == 'WPGlobus' ) { \n\t\t\t\tif (-1 != status.indexOf('WPGlobus')) {\n\t\t\t\t\tvar done = buttons[i].dataset.done;\n\t\t\t\t\tif ('undefined' === typeof done) {\n\t\t\t\t\t\tvar content = buttons[i].innerHTML;\n\t\t\t\t\t\t//@todo buttons[i].classList.add('wpglobus-switcher-button');\n\t\t\t\t\t\tbuttons[i].innerHTML = content + '<img height=\"20px\" width=\"20px\" src=\"' + WPGlobusGutenberg.flags_url[WPGlobusGutenberg.language] + '\" />&nbsp;' + WPGlobusAdmin.data.en_language_name[WPGlobusGutenberg.language];\n\t\t\t\t\t\tbuttons[i].dataset.done = 'yes';\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}, 500);\n\t\treturn _this;\n\t}\n\n\t__WEBPACK_IMPORTED_MODULE_2_babel_runtime_helpers_createClass___default()(WPGlobus_BlockEditor, [{\n\t\tkey: 'render',\n\t\tvalue: function render() {\n\t\t\treturn wp.element.createElement(\n\t\t\t\tFragment,\n\t\t\t\tnull,\n\t\t\t\twp.element.createElement(\n\t\t\t\t\tPluginSidebarMoreMenuItem,\n\t\t\t\t\t{\n\t\t\t\t\t\ttarget: 'wpglobus-gutenberg-sidebar'\n\t\t\t\t\t},\n\t\t\t\t\tthis.state.moreMenuItemTitle\n\t\t\t\t),\n\t\t\t\twp.element.createElement(\n\t\t\t\t\tPluginSidebar,\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'wpglobus-gutenberg-sidebar',\n\t\t\t\t\t\ttitle: this.state.headerTitle\n\t\t\t\t\t},\n\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\tPanelBody,\n\t\t\t\t\t\t{ className: 'wpglobus-block-editor-panel__body' },\n\t\t\t\t\t\twp.element.createElement(LanguageSwitcherNotice, null),\n\t\t\t\t\t\twp.element.createElement(LanguageSwitcher, null),\n\t\t\t\t\t\twp.element.createElement(\n\t\t\t\t\t\t\t'div',\n\t\t\t\t\t\t\tnull,\n\t\t\t\t\t\t\twp.element.createElement(WPGlobusInfo, { href: this.state.storeLink }),\n\t\t\t\t\t\t\twp.element.createElement(SettingsLink, { href: this.state.optionsTabUrl })\n\t\t\t\t\t\t)\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\t}]);\n\n\treturn WPGlobus_BlockEditor;\n}(Component);\n\nvar WPGBE = withSelect(function (select, _ref) {\n\tvar forceIsSaving = _ref.forceIsSaving;\n\n\tvar _select = select('core/editor'),\n\t getCurrentPostId = _select.getCurrentPostId,\n\t isSavingPost = _select.isSavingPost,\n\t isPublishingPost = _select.isPublishingPost,\n\t isAutosavingPost = _select.isAutosavingPost;\n\n\treturn {\n\t\tpostId: getCurrentPostId(),\n\t\tisSaving: forceIsSaving || isSavingPost(),\n\t\tisAutoSaving: isAutosavingPost(),\n\t\tisPublishing: isPublishingPost()\n\t};\n})(WPGlobus_BlockEditor);\n\nregisterPlugin('wpglobus-gutenberg', {\n\ticon: 'admin-site',\n\trender: WPGBE\n});//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNDMuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9zcmMvc2lkZWJhci5qcz8yNWQ1Il0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBfT2JqZWN0JGdldFByb3RvdHlwZU9mIGZyb20gJ2JhYmVsLXJ1bnRpbWUvY29yZS1qcy9vYmplY3QvZ2V0LXByb3RvdHlwZS1vZic7XG5pbXBvcnQgX2NsYXNzQ2FsbENoZWNrIGZyb20gJ2JhYmVsLXJ1bnRpbWUvaGVscGVycy9jbGFzc0NhbGxDaGVjayc7XG5pbXBvcnQgX2NyZWF0ZUNsYXNzIGZyb20gJ2JhYmVsLXJ1bnRpbWUvaGVscGVycy9jcmVhdGVDbGFzcyc7XG5pbXBvcnQgX3Bvc3NpYmxlQ29uc3RydWN0b3JSZXR1cm4gZnJvbSAnYmFiZWwtcnVudGltZS9oZWxwZXJzL3Bvc3NpYmxlQ29uc3RydWN0b3JSZXR1cm4nO1xuaW1wb3J0IF9pbmhlcml0cyBmcm9tICdiYWJlbC1ydW50aW1lL2hlbHBlcnMvaW5oZXJpdHMnO1xuLyoqXG4gKiBJbnRlcm5hbCBibG9jayBsaWJyYXJpZXMuXG4gKiBAc2luY2UgMi4yLjNcbiAqL1xudmFyIF9fID0gd3AuaTE4bi5f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UFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///43\n")},function(module,exports,__webpack_require__){eval('module.exports = { "default": __webpack_require__(45), __esModule: true };//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNDQuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYmFiZWwtcnVudGltZS9jb3JlLWpzL29iamVjdC9nZXQtcHJvdG90eXBlLW9mLmpzPzY3MWUiXSwic291cmNlc0NvbnRlbnQiOlsibW9kdWxlLmV4cG9ydHMgPSB7IFwiZGVmYXVsdFwiOiByZXF1aXJlKFwiY29yZS1qcy9saWJyYXJ5L2ZuL29iamVjdC9nZXQtcHJvdG90eXBlLW9mXCIpLCBfX2VzTW9kdWxlOiB0cnVlIH07XG5cblxuLy8vLy8vLy8vLy8vLy8vLy8vXG4vLyBXRUJQQUNLIEZPT1RFUlxuLy8gLi9ub2RlX21vZHVsZXMvYmFiZWwtcnVudGltZS9jb3JlLWpzL29iamVjdC9nZXQtcHJvdG90eXBlLW9mLmpzXG4vLyBtb2R1bGUgaWQgPSA0NFxuLy8gbW9kdWxlIGNodW5rcyA9IDAiXSwibWFwcGluZ3MiOiJBQUFBIiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///44\n')},function(module,exports,__webpack_require__){eval("__webpack_require__(46);\nmodule.exports = __webpack_require__(0).Object.getPrototypeOf;\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNDUuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L2ZuL29iamVjdC9nZXQtcHJvdG90eXBlLW9mLmpzPzdkMmUiXSwic291cmNlc0NvbnRlbnQiOlsicmVxdWlyZSgnLi4vLi4vbW9kdWxlcy9lczYub2JqZWN0LmdldC1wcm90b3R5cGUtb2YnKTtcbm1vZHVsZS5leHBvcnRzID0gcmVxdWlyZSgnLi4vLi4vbW9kdWxlcy9fY29yZScpLk9iamVjdC5nZXRQcm90b3R5cGVPZjtcblxuXG5cbi8vLy8vLy8vLy8vLy8vLy8vL1xuLy8gV0VCUEFDSyBGT09URVJcbi8vIC4vbm9kZV9tb2R1bGVzL2NvcmUtanMvbGlicmFyeS9mbi9vYmplY3QvZ2V0LXByb3RvdHlwZS1vZi5qc1xuLy8gbW9kdWxlIGlkID0gNDVcbi8vIG1vZHVsZSBjaHVua3MgPSAwIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///45\n")},function(module,exports,__webpack_require__){eval("// 19.1.2.9 Object.getPrototypeOf(O)\nvar toObject = __webpack_require__(28);\nvar $getPrototypeOf = __webpack_require__(29);\n\n__webpack_require__(47)('getPrototypeOf', function () {\n return function getPrototypeOf(it) {\n return $getPrototypeOf(toObject(it));\n };\n});\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNDYuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvZXM2Lm9iamVjdC5nZXQtcHJvdG90eXBlLW9mLmpzPzJhMWUiXSwic291cmNlc0NvbnRlbnQiOlsiLy8gMTkuMS4yLjkgT2JqZWN0LmdldFByb3RvdHlwZU9mKE8pXG52YXIgdG9PYmplY3QgPSByZXF1aXJlKCcuL190by1vYmplY3QnKTtcbnZhciAkZ2V0UHJvdG90eXBlT2YgPSByZXF1aXJlKCcuL19vYmplY3QtZ3BvJyk7XG5cbnJlcXVpcmUoJy4vX29iamVjdC1zYXAnKSgnZ2V0UHJvdG90eXBlT2YnLCBmdW5jdGlvbiAoKSB7XG4gIHJldHVybiBmdW5jdGlvbiBnZXRQcm90b3R5cGVPZihpdCkge1xuICAgIHJldHVybiAkZ2V0UHJvdG90eXBlT2YodG9PYmplY3QoaXQpKTtcbiAgfTtcbn0pO1xuXG5cblxuLy8vLy8vLy8vLy8vLy8vLy8vXG4vLyBXRUJQQUNLIEZPT1RFUlxuLy8gLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvZXM2Lm9iamVjdC5nZXQtcHJvdG90eXBlLW9mLmpzXG4vLyBtb2R1bGUgaWQgPSA0NlxuLy8gbW9kdWxlIGNodW5rcyA9IDAiXSwibWFwcGluZ3MiOiJBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///46\n")},function(module,exports,__webpack_require__){eval("// most Object methods by ES6 should accept primitives\nvar $export = __webpack_require__(5);\nvar core = __webpack_require__(0);\nvar fails = __webpack_require__(11);\nmodule.exports = function (KEY, exec) {\n var fn = (core.Object || {})[KEY] || Object[KEY];\n var exp = {};\n exp[KEY] = exec(fn);\n $export($export.S + $export.F * fails(function () { fn(1); }), 'Object', exp);\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNDcuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX29iamVjdC1zYXAuanM/YmFhNSJdLCJzb3VyY2VzQ29udGVudCI6WyIvLyBtb3N0IE9iamVjdCBtZXRob2RzIGJ5IEVTNiBzaG91bGQgYWNjZXB0IHByaW1pdGl2ZXNcbnZhciAkZXhwb3J0ID0gcmVxdWlyZSgnLi9fZXhwb3J0Jyk7XG52YXIgY29yZSA9IHJlcXVpcmUoJy4vX2NvcmUnKTtcbnZhciBmYWlscyA9IHJlcXVpcmUoJy4vX2ZhaWxzJyk7XG5tb2R1bGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChLRVksIGV4ZWMpIHtcbiAgdmFyIGZuID0gKGNvcmUuT2JqZWN0IHx8IHt9KVtLRVldIHx8IE9iamVjdFtLRVldO1xuICB2YXIgZXhwID0ge307XG4gIGV4cFtLRVldID0gZXhlYyhmbik7XG4gICRleHBvcnQoJGV4cG9ydC5TICsgJGV4cG9ydC5GICogZmFpbHMoZnVuY3Rpb24gKCkgeyBmbigxKTsgfSksICdPYmplY3QnLCBleHApO1xufTtcblxuXG5cbi8vLy8vLy8vLy8vLy8vLy8vL1xuLy8gV0VCUEFDSyBGT09URVJcbi8vIC4vbm9kZV9tb2R1bGVzL2NvcmUtanMvbGlicmFyeS9tb2R1bGVzL19vYmplY3Qtc2FwLmpzXG4vLyBtb2R1bGUgaWQgPSA0N1xuLy8gbW9kdWxlIGNodW5rcyA9IDAiXSwibWFwcGluZ3MiOiJBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///47\n")},function(module,exports){eval("module.exports = function (it) {\n if (typeof it != 'function') throw TypeError(it + ' is not a function!');\n return it;\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNDguanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX2EtZnVuY3Rpb24uanM/OTRlOSJdLCJzb3VyY2VzQ29udGVudCI6WyJtb2R1bGUuZXhwb3J0cyA9IGZ1bmN0aW9uIChpdCkge1xuICBpZiAodHlwZW9mIGl0ICE9ICdmdW5jdGlvbicpIHRocm93IFR5cGVFcnJvcihpdCArICcgaXMgbm90IGEgZnVuY3Rpb24hJyk7XG4gIHJldHVybiBpdDtcbn07XG5cblxuXG4vLy8vLy8vLy8vLy8vLy8vLy9cbi8vIFdFQlBBQ0sgRk9PVEVSXG4vLyAuL25vZGVfbW9kdWxlcy9jb3JlLWpzL2xpYnJhcnkvbW9kdWxlcy9fYS1mdW5jdGlvbi5qc1xuLy8gbW9kdWxlIGlkID0gNDhcbi8vIG1vZHVsZSBjaHVua3MgPSAwIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///48\n")},function(module,exports,__webpack_require__){"use strict";eval('\n\nexports.__esModule = true;\n\nexports.default = function (instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError("Cannot call a class as a function");\n }\n};//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNDkuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYmFiZWwtcnVudGltZS9oZWxwZXJzL2NsYXNzQ2FsbENoZWNrLmpzPzY2YjkiXSwic291cmNlc0NvbnRlbnQiOlsiXCJ1c2Ugc3RyaWN0XCI7XG5cbmV4cG9ydHMuX19lc01vZHVsZSA9IHRydWU7XG5cbmV4cG9ydHMuZGVmYXVsdCA9IGZ1bmN0aW9uIChpbnN0YW5jZSwgQ29uc3RydWN0b3IpIHtcbiAgaWYgKCEoaW5zdGFuY2UgaW5zdGFuY2VvZiBDb25zdHJ1Y3RvcikpIHtcbiAgICB0aHJvdyBuZXcgVHlwZUVycm9yKFwiQ2Fubm90IGNhbGwgYSBjbGFzcyBhcyBhIGZ1bmN0aW9uXCIpO1xuICB9XG59O1xuXG5cbi8vLy8vLy8vLy8vLy8vLy8vL1xuLy8gV0VCUEFDSyBGT09URVJcbi8vIC4vbm9kZV9tb2R1bGVzL2JhYmVsLXJ1bnRpbWUvaGVscGVycy9jbGFzc0NhbGxDaGVjay5qc1xuLy8gbW9kdWxlIGlkID0gNDlcbi8vIG1vZHVsZSBjaHVua3MgPSAwIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///49\n')},function(module,exports,__webpack_require__){"use strict";eval('\n\nexports.__esModule = true;\n\nvar _defineProperty = __webpack_require__(51);\n\nvar _defineProperty2 = _interopRequireDefault(_defineProperty);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nexports.default = function () {\n function defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if ("value" in descriptor) descriptor.writable = true;\n (0, _defineProperty2.default)(target, descriptor.key, descriptor);\n }\n }\n\n return function (Constructor, protoProps, staticProps) {\n if (protoProps) defineProperties(Constructor.prototype, protoProps);\n if (staticProps) defineProperties(Constructor, staticProps);\n return Constructor;\n };\n}();//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNTAuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYmFiZWwtcnVudGltZS9oZWxwZXJzL2NyZWF0ZUNsYXNzLmpzP2MzMTAiXSwic291cmNlc0NvbnRlbnQiOlsiXCJ1c2Ugc3RyaWN0XCI7XG5cbmV4cG9ydHMuX19lc01vZHVsZSA9IHRydWU7XG5cbnZhciBfZGVm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c3RydWN0b3IsIHN0YXRpY1Byb3BzKTtcbiAgICByZXR1cm4gQ29uc3RydWN0b3I7XG4gIH07XG59KCk7XG5cblxuLy8vLy8vLy8vLy8vLy8vLy8vXG4vLyBXRUJQQUNLIEZPT1RFUlxuLy8gLi9ub2RlX21vZHVsZXMvYmFiZWwtcnVudGltZS9oZWxwZXJzL2NyZWF0ZUNsYXNzLmpzXG4vLyBtb2R1bGUgaWQgPSA1MFxuLy8gbW9kdWxlIGNodW5rcyA9IDAiXSwibWFwcGluZ3MiOiJBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///50\n')},function(module,exports,__webpack_require__){eval('module.exports = { "default": __webpack_require__(52), __esModule: true };//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNTEuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYmFiZWwtcnVudGltZS9jb3JlLWpzL29iamVjdC9kZWZpbmUtcHJvcGVydHkuanM/MGI4MyJdLCJzb3VyY2VzQ29udGVudCI6WyJtb2R1bGUuZXhwb3J0cyA9IHsgXCJkZWZhdWx0XCI6IHJlcXVpcmUoXCJjb3JlLWpzL2xpYnJhcnkvZm4vb2JqZWN0L2RlZmluZS1wcm9wZXJ0eVwiKSwgX19lc01vZHVsZTogdHJ1ZSB9O1xuXG5cbi8vLy8vLy8vLy8vLy8vLy8vL1xuLy8gV0VCUEFDSyBGT09URVJcbi8vIC4vbm9kZV9tb2R1bGVzL2JhYmVsLXJ1bnRpbWUvY29yZS1qcy9vYmplY3QvZGVmaW5lLXByb3BlcnR5LmpzXG4vLyBtb2R1bGUgaWQgPSA1MVxuLy8gbW9kdWxlIGNodW5rcyA9IDAiXSwibWFwcGluZ3MiOiJBQUFBIiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///51\n')},function(module,exports,__webpack_require__){eval("__webpack_require__(53);\nvar $Object = __webpack_require__(0).Object;\nmodule.exports = function defineProperty(it, key, desc) {\n return $Object.defineProperty(it, key, desc);\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNTIuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L2ZuL29iamVjdC9kZWZpbmUtcHJvcGVydHkuanM/ZjViMCJdLCJzb3VyY2VzQ29udGVudCI6WyJyZXF1aXJlKCcuLi8uLi9tb2R1bGVzL2VzNi5vYmplY3QuZGVmaW5lLXByb3BlcnR5Jyk7XG52YXIgJE9iamVjdCA9IHJlcXVpcmUoJy4uLy4uL21vZHVsZXMvX2NvcmUnKS5PYmplY3Q7XG5tb2R1bGUuZXhwb3J0cyA9IGZ1bmN0aW9uIGRlZmluZVByb3BlcnR5KGl0LCBrZXksIGRlc2MpIHtcbiAgcmV0dXJuICRPYmplY3QuZGVmaW5lUHJvcGVydHkoaXQsIGtleSwgZGVzYyk7XG59O1xuXG5cblxuLy8vLy8vLy8vLy8vLy8vLy8vXG4vLyBXRUJQQUNLIEZPT1RFUlxuLy8gLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L2ZuL29iamVjdC9kZWZpbmUtcHJvcGVydHkuanNcbi8vIG1vZHVsZSBpZCA9IDUyXG4vLyBtb2R1bGUgY2h1bmtzID0gMCJdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///52\n")},function(module,exports,__webpack_require__){eval("var $export = __webpack_require__(5);\n// 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes)\n$export($export.S + $export.F * !__webpack_require__(4), 'Object', { defineProperty: __webpack_require__(3).f });\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNTMuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvZXM2Lm9iamVjdC5kZWZpbmUtcHJvcGVydHkuanM/OTgyOSJdLCJzb3VyY2VzQ29udGVudCI6WyJ2YXIgJGV4cG9ydCA9IHJlcXVpcmUoJy4vX2V4cG9ydCcpO1xuLy8gMTkuMS4yLjQgLyAxNS4yLjMuNiBPYmplY3QuZGVmaW5lUHJvcGVydHkoTywgUCwgQXR0cmlidXRlcylcbiRleHBvcnQoJGV4cG9ydC5TICsgJGV4cG9ydC5GICogIXJlcXVpcmUoJy4vX2Rlc2NyaXB0b3JzJyksICdPYmplY3QnLCB7IGRlZmluZVByb3BlcnR5OiByZXF1aXJlKCcuL19vYmplY3QtZHAnKS5mIH0pO1xuXG5cblxuLy8vLy8vLy8vLy8vLy8vLy8vXG4vLyBXRUJQQUNLIEZPT1RFUlxuLy8gLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvZXM2Lm9iamVjdC5kZWZpbmUtcHJvcGVydHkuanNcbi8vIG1vZHVsZSBpZCA9IDUzXG4vLyBtb2R1bGUgY2h1bmtzID0gMCJdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///53\n")},function(module,exports,__webpack_require__){"use strict";eval('\n\nexports.__esModule = true;\n\nvar _typeof2 = __webpack_require__(33);\n\nvar _typeof3 = _interopRequireDefault(_typeof2);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nexports.default = function (self, call) {\n if (!self) {\n throw new ReferenceError("this hasn\'t been initialised - super() hasn\'t been called");\n }\n\n return call && ((typeof call === "undefined" ? "undefined" : (0, _typeof3.default)(call)) === "object" || typeof call === "function") ? call : self;\n};//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNTQuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYmFiZWwtcnVudGltZS9oZWxwZXJzL3Bvc3NpYmxlQ29uc3RydWN0b3JSZXR1cm4uanM/Y2YwYSJdLCJzb3VyY2VzQ29udGVudCI6WyJcInVzZSBzdHJpY3RcIjtcblxuZXhwb3J0cy5fX2VzTW9kdWxlID0gdHJ1ZTtcblxudmFyIF90eXBlb2YyID0gcmVxdWlyZShcIi4uL2hlbHBlcnMvdHlwZW9mXCIpO1xuXG52YXIgX3R5cGVvZjMgPSBfaW50ZXJvcFJlcXVpcmVEZWZhdWx0KF90eXBlb2YyKTtcblxuZnVuY3Rpb24gX2ludGVyb3BSZXF1aXJlRGVmYXVsdChvYmopIHsgcmV0dXJuIG9iaiAmJiBvYmouX19lc01vZHVsZSA/IG9iaiA6IHsgZGVmYXVsdDogb2JqIH07IH1cblxuZXhwb3J0cy5kZWZhdWx0ID0gZnVuY3Rpb24gKHNlbGYsIGNhbGwpIHtcbiAgaWYgKCFzZWxmKSB7XG4gICAgdGhyb3cgbmV3IFJlZmVyZW5jZUVycm9yKFwidGhpcyBoYXNuJ3QgYmVlbiBpbml0aWFsaXNlZCAtIHN1cGVyKCkgaGFzbid0IGJlZW4gY2FsbGVkXCIpO1xuICB9XG5cbiAgcmV0dXJuIGNhbGwgJiYgKCh0eXBlb2YgY2FsbCA9PT0gXCJ1bmRlZmluZWRcIiA/IFwidW5kZWZpbmVkXCIgOiAoMCwgX3R5cGVvZjMuZGVmYXVsdCkoY2FsbCkpID09PSBcIm9iamVjdFwiIHx8IHR5cGVvZiBjYWxsID09PSBcImZ1bmN0aW9uXCIpID8gY2FsbCA6IHNlbGY7XG59O1xuXG5cbi8vLy8vLy8vLy8vLy8vLy8vL1xuLy8gV0VCUEFDSyBGT09URVJcbi8vIC4vbm9kZV9tb2R1bGVzL2JhYmVsLXJ1bnRpbWUvaGVscGVycy9wb3NzaWJsZUNvbnN0cnVjdG9yUmV0dXJuLmpzXG4vLyBtb2R1bGUgaWQgPSA1NFxuLy8gbW9kdWxlIGNodW5rcyA9IDAiXSwibWFwcGluZ3MiOiJBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///54\n')},function(module,exports,__webpack_require__){eval('module.exports = { "default": __webpack_require__(56), __esModule: true };//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNTUuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYmFiZWwtcnVudGltZS9jb3JlLWpzL3N5bWJvbC9pdGVyYXRvci5qcz82NzM4Il0sInNvdXJjZXNDb250ZW50IjpbIm1vZHVsZS5leHBvcnRzID0geyBcImRlZmF1bHRcIjogcmVxdWlyZShcImNvcmUtanMvbGlicmFyeS9mbi9zeW1ib2wvaXRlcmF0b3JcIiksIF9fZXNNb2R1bGU6IHRydWUgfTtcblxuXG4vLy8vLy8vLy8vLy8vLy8vLy9cbi8vIFdFQlBBQ0sgRk9PVEVSXG4vLyAuL25vZGVfbW9kdWxlcy9iYWJlbC1ydW50aW1lL2NvcmUtanMvc3ltYm9sL2l0ZXJhdG9yLmpzXG4vLyBtb2R1bGUgaWQgPSA1NVxuLy8gbW9kdWxlIGNodW5rcyA9IDAiXSwibWFwcGluZ3MiOiJBQUFBIiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///55\n')},function(module,exports,__webpack_require__){eval("__webpack_require__(57);\n__webpack_require__(66);\nmodule.exports = __webpack_require__(25).f('iterator');\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNTYuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L2ZuL3N5bWJvbC9pdGVyYXRvci5qcz9mZTdlIl0sInNvdXJjZXNDb250ZW50IjpbInJlcXVpcmUoJy4uLy4uL21vZHVsZXMvZXM2LnN0cmluZy5pdGVyYXRvcicpO1xucmVxdWlyZSgnLi4vLi4vbW9kdWxlcy93ZWIuZG9tLml0ZXJhYmxlJyk7XG5tb2R1bGUuZXhwb3J0cyA9IHJlcXVpcmUoJy4uLy4uL21vZHVsZXMvX3drcy1leHQnKS5mKCdpdGVyYXRvcicpO1xuXG5cblxuLy8vLy8vLy8vLy8vLy8vLy8vXG4vLyBXRUJQQUNLIEZPT1RFUlxuLy8gLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L2ZuL3N5bWJvbC9pdGVyYXRvci5qc1xuLy8gbW9kdWxlIGlkID0gNTZcbi8vIG1vZHVsZSBjaHVua3MgPSAwIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7Iiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///56\n")},function(module,exports,__webpack_require__){"use strict";eval("\nvar $at = __webpack_require__(58)(true);\n\n// 21.1.3.27 String.prototype[@@iterator]()\n__webpack_require__(34)(String, 'String', function (iterated) {\n this._t = String(iterated); // target\n this._i = 0; // next index\n// 21.1.5.2.1 %StringIteratorPrototype%.next()\n}, function () {\n var O = this._t;\n var index = this._i;\n var point;\n if (index >= O.length) return { value: undefined, done: true };\n point = $at(O, index);\n this._i += point.length;\n return { value: point, done: false };\n});\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNTcuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvZXM2LnN0cmluZy5pdGVyYXRvci5qcz9jZDA0Il0sInNvdXJjZXNDb250ZW50IjpbIid1c2Ugc3RyaWN0JztcbnZhciAkYXQgPSByZXF1aXJlKCcuL19zdHJpbmctYXQnKSh0cnVlKTtcblxuLy8gMjEuMS4zLjI3IFN0cmluZy5wcm90b3R5cGVbQEBpdGVyYXRvcl0oKVxucmVxdWlyZSgnLi9faXRlci1kZWZpbmUnKShTdHJpbmcsICdTdHJpbmcnLCBmdW5jdGlvbiAoaXRlcmF0ZWQpIHtcbiAgdGhpcy5fdCA9IFN0cmluZyhpdGVyYXRlZCk7IC8vIHRhcmdldFxuICB0aGlzLl9pID0gMDsgICAgICAgICAgICAgICAgLy8gbmV4dCBpbmRleFxuLy8gMjEuMS41LjIuMSAlU3RyaW5nSXRlcmF0b3JQcm90b3R5cGUlLm5leHQoKVxufSwgZnVuY3Rpb24gKCkge1xuICB2YXIgTyA9IHRoaXMuX3Q7XG4gIHZhciBpbmRleCA9IHRoaXMuX2k7XG4gIHZhciBwb2ludDtcbiAgaWYgKGluZGV4ID49IE8ubGVuZ3RoKSByZXR1cm4geyB2YWx1ZTogdW5kZWZpbmVkLCBkb25lOiB0cnVlIH07XG4gIHBvaW50ID0gJGF0KE8sIGluZGV4KTtcbiAgdGhpcy5faSArPSBwb2ludC5sZW5ndGg7XG4gIHJldHVybiB7IHZhbHVlOiBwb2ludCwgZG9uZTogZmFsc2UgfTtcbn0pO1xuXG5cblxuLy8vLy8vLy8vLy8vLy8vLy8vXG4vLyBXRUJQQUNLIEZPT1RFUlxuLy8gLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvZXM2LnN0cmluZy5pdGVyYXRvci5qc1xuLy8gbW9kdWxlIGlkID0gNTdcbi8vIG1vZHVsZSBjaHVua3MgPSAwIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///57\n")},function(module,exports,__webpack_require__){eval("var toInteger = __webpack_require__(19);\nvar defined = __webpack_require__(15);\n// true -> String#at\n// false -> String#codePointAt\nmodule.exports = function (TO_STRING) {\n return function (that, pos) {\n var s = String(defined(that));\n var i = toInteger(pos);\n var l = s.length;\n var a, b;\n if (i < 0 || i >= l) return TO_STRING ? '' : undefined;\n a = s.charCodeAt(i);\n return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff\n ? TO_STRING ? s.charAt(i) : a\n : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;\n };\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNTguanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX3N0cmluZy1hdC5qcz84N2FlIl0sInNvdXJjZXNDb250ZW50IjpbInZhciB0b0ludGVnZXIgPSByZXF1aXJlKCcuL190by1pbnRlZ2VyJyk7XG52YXIgZGVmaW5lZCA9IHJlcXVpcmUoJy4vX2RlZmluZWQnKTtcbi8vIHRydWUgIC0+IFN0cmluZyNhdFxuLy8gZmFsc2UgLT4gU3Ry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")},function(module,exports,__webpack_require__){"use strict";eval("\nvar create = __webpack_require__(21);\nvar descriptor = __webpack_require__(14);\nvar setToStringTag = __webpack_require__(24);\nvar IteratorPrototype = {};\n\n// 25.1.2.1.1 %IteratorPrototype%[@@iterator]()\n__webpack_require__(6)(IteratorPrototype, __webpack_require__(9)('iterator'), function () { return this; });\n\nmodule.exports = function (Constructor, NAME, next) {\n Constructor.prototype = create(IteratorPrototype, { next: descriptor(1, next) });\n setToStringTag(Constructor, NAME + ' Iterator');\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNTkuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX2l0ZXItY3JlYXRlLmpzP2Y3ODUiXSwic291cmNlc0NvbnRlbnQiOlsiJ3VzZSBzdHJpY3QnO1xudmFyIGNyZWF0ZSA9IHJlcXVpcmUoJy4vX29iamVjdC1jcmVhdGUnKTtcbnZhciBkZXNjcmlwdG9yID0gcmVxdWlyZSgnLi9fcHJvcGVydHktZGVzYycpO1xudmFyIHNldFRvU3RyaW5nVGFnID0gcmVxdWlyZSgnLi9fc2V0LXRvLXN0cmluZy10YWcnKTtcbnZhciBJdGVyYXRvclByb3RvdHlwZSA9IHt9O1xuXG4vLyAyNS4xLjIuMS4xICVJdGVyYXRvclByb3RvdHlwZSVbQEBpdGVyYXRvcl0oKVxucmVxdWlyZSgnLi9faGlkZScpKEl0ZXJhdG9yUHJvdG90eXBlLCByZXF1aXJlKCcuL193a3MnKSgnaXRlcmF0b3InKSwgZnVuY3Rpb24gKCkgeyByZXR1cm4gdGhpczsgfSk7XG5cbm1vZHVsZS5leHBvcnRzID0gZnVuY3Rpb24gKENvbnN0cnVjdG9yLCBOQU1FLCBuZXh0KSB7XG4gIENvbnN0cnVjdG9yLnByb3RvdHlwZSA9IGNyZWF0ZShJdGVyYXRvclByb3RvdHlwZSwgeyBuZXh0OiBkZXNjcmlwdG9yKDEsIG5leHQpIH0pO1xuICBzZXRUb1N0cmluZ1RhZyhDb25zdHJ1Y3RvciwgTkFNRSArICcgSXRlcmF0b3InKTtcbn07XG5cblxuXG4vLy8vLy8vLy8vLy8vLy8vLy9cbi8vIFdFQlBBQ0sgRk9PVEVSXG4vLyAuL25vZGVfbW9kdWxlcy9jb3JlLWpzL2xpYnJhcnkvbW9kdWxlcy9faXRlci1jcmVhdGUuanNcbi8vIG1vZHVsZSBpZCA9IDU5XG4vLyBtb2R1bGUgY2h1bmtzID0gMCJdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7Iiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///59\n")},function(module,exports,__webpack_require__){eval("var dP = __webpack_require__(3);\nvar anObject = __webpack_require__(10);\nvar getKeys = __webpack_require__(22);\n\nmodule.exports = __webpack_require__(4) ? Object.defineProperties : function defineProperties(O, Properties) {\n anObject(O);\n var keys = getKeys(Properties);\n var length = keys.length;\n var i = 0;\n var P;\n while (length > i) dP.f(O, P = keys[i++], Properties[P]);\n return O;\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNjAuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX29iamVjdC1kcHMuanM/YWEyYSJdLCJzb3VyY2VzQ29udGVudCI6WyJ2YXIgZFAgPSByZXF1aXJlKCcuL19vYmplY3QtZHAnKTtcbnZhciBhbk9iamVjdCA9IHJlcXVpcmUoJy4vX2FuLW9iamVjdCcpO1xudmFyIGdldEtleXMgPSByZXF1aXJlKCcuL19vYmplY3Qta2V5cycpO1xuXG5tb2R1bGUuZXhwb3J0cyA9IHJlcXVpcmUoJy4vX2Rlc2NyaXB0b3JzJykgPyBPYmplY3QuZGVmaW5lUHJvcGVydGllcyA6IGZ1bmN0aW9uIGRlZmluZVByb3BlcnRpZXMoTywgUHJvcGVydGllcykge1xuICBhbk9iamVjdChPKTtcbiAgdmFyIGtleXMgPSBnZXRLZXlzKFByb3BlcnRpZXMpO1xuICB2YXIgbGVuZ3RoID0ga2V5cy5sZW5ndGg7XG4gIHZhciBpID0gMDtcbiAgdmFyIFA7XG4gIHdoaWxlIChsZW5ndGggPiBpKSBkUC5mKE8sIFAgPSBrZXlzW2krK10sIFByb3BlcnRpZXNbUF0pO1xuICByZXR1cm4gTztcbn07XG5cblxuXG4vLy8vLy8vLy8vLy8vLy8vLy9cbi8vIFdFQlBBQ0sgRk9PVEVSXG4vLyAuL25vZGVfbW9kdWxlcy9jb3JlLWpzL2xpYnJhcnkvbW9kdWxlcy9fb2JqZWN0LWRwcy5qc1xuLy8gbW9kdWxlIGlkID0gNjBcbi8vIG1vZHVsZSBjaHVua3MgPSAwIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///60\n")},function(module,exports,__webpack_require__){eval("// fallback for non-array-like ES3 and non-enumerable old V8 strings\nvar cof = __webpack_require__(37);\n// eslint-disable-next-line no-prototype-builtins\nmodule.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) {\n return cof(it) == 'String' ? it.split('') : Object(it);\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNjEuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX2lvYmplY3QuanM/MzE0ZSJdLCJzb3VyY2VzQ29udGVudCI6WyIvLyBmYWxsYmFjayBmb3Igbm9uLWFycmF5LWxpa2UgRVMzIGFuZCBub24tZW51bWVyYWJsZSBvbGQgVjggc3RyaW5nc1xudmFyIGNvZiA9IHJlcXVpcmUoJy4vX2NvZicpO1xuLy8gZXNsaW50LWRpc2FibGUtbmV4dC1saW5lIG5vLXByb3RvdHlwZS1idWlsdGluc1xubW9kdWxlLmV4cG9ydHMgPSBPYmplY3QoJ3onKS5wcm9wZXJ0eUlzRW51bWVyYWJsZSgwKSA/IE9iamVjdCA6IGZ1bmN0aW9uIChpdCkge1xuICByZXR1cm4gY29mKGl0KSA9PSAnU3RyaW5nJyA/IGl0LnNwbGl0KCcnKSA6IE9iamVjdChpdCk7XG59O1xuXG5cblxuLy8vLy8vLy8vLy8vLy8vLy8vXG4vLyBXRUJQQUNLIEZPT1RFUlxuLy8gLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX2lvYmplY3QuanNcbi8vIG1vZHVsZSBpZCA9IDYxXG4vLyBtb2R1bGUgY2h1bmtzID0gMCJdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///61\n")},function(module,exports,__webpack_require__){eval("// false -> Array#indexOf\n// true -> Array#includes\nvar toIObject = __webpack_require__(8);\nvar toLength = __webpack_require__(63);\nvar toAbsoluteIndex = __webpack_require__(64);\nmodule.exports = function (IS_INCLUDES) {\n return function ($this, el, fromIndex) {\n var O = toIObject($this);\n var length = toLength(O.length);\n var index = toAbsoluteIndex(fromIndex, length);\n var value;\n // Array#includes uses SameValueZero equality algorithm\n // eslint-disable-next-line no-self-compare\n if (IS_INCLUDES && el != el) while (length > index) {\n value = O[index++];\n // eslint-disable-next-line no-self-compare\n if (value != value) return true;\n // Array#indexOf ignores holes, Array#includes - not\n } else for (;length > index; index++) if (IS_INCLUDES || index in O) {\n if (O[index] === el) return IS_INCLUDES || index || 0;\n } return !IS_INCLUDES && -1;\n };\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNjIuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX2FycmF5LWluY2x1ZGVzLmpzP2JjNTciXSwic291cmNlc0NvbnRlbnQiOlsiLy8gZmFsc2UgLT4gQXJyYXkjaW5kZXhPZlxuLy8gdHJ1ZSAgLT4gQXJyYXkjaW5jbHVkZXNcbnZhciB0b0lPYmplY3QgPSByZXF1aXJlKCcuL190by1pb2JqZWN0Jyk7XG52YXIgdG9MZW5ndGggPSByZXF1aXJlKCcuL190by1sZW5ndGgnKTtcbnZhciB0b0Fic29sdXRlSW5kZXggPSByZXF1aXJlKCcuL190by1hYnNvbHV0ZS1pbmRleCcpO1xubW9kdWxlLmV4cG9ydHMgPSBmdW5jdGlvbiAoSVNfSU5DTFVERVMpIHtcbiAgcmV0dXJuIGZ1bmN0aW9uICgkdGhpcywgZWwsIGZyb21JbmRleCkge1xuICAgIHZhciBPID0gdG9JT2JqZWN0KCR0aGlzKTtcbiAgICB2YXIgbGVuZ3RoID0gdG9MZW5ndGgoTy5sZW5ndGgpO1xuICAgIHZhciBpbmRleCA9IHRvQWJzb2x1dGVJbmRleChmcm9tSW5kZXgsIGxlbmd0aCk7XG4gICAgdmFyIHZhbHVlO1xuICAgIC8vIEFycmF5I2luY2x1ZGVzIHVzZXMgU2FtZVZhbHVlWmVybyBlcXVhbGl0eSBhbGdvcml0aG1cbiAgICAvLyBlc2xpbnQtZGlzYWJsZS1uZXh0LWxpbmUgbm8tc2VsZi1jb21wYXJlXG4gICAgaWYgKElTX0lOQ0xVREVTICYmIGVsICE9IGVsKSB3aGlsZSAobGVuZ3RoID4gaW5kZXgpIHtcbiAgICAgIHZhbHVlID0gT1tpbmRleCsrXTtcbiAgICAgIC8vIGVzbGludC1kaXNhYmxlLW5leHQtbGluZSBuby1zZWxmLWNvbXBhcmVcbiAgICAgIGlmICh2YWx1ZSAhPSB2YWx1ZSkgcmV0dXJuIHRydWU7XG4gICAgLy8gQXJyYXkjaW5kZXhPZiBpZ25vcmVzIGhvbGVzLCBBcnJheSNpbmNsdWRlcyAtIG5vdFxuICAgIH0gZWxzZSBmb3IgKDtsZW5ndGggPiBpbmRleDsgaW5kZXgrKykgaWYgKElTX0lOQ0xVREVTIHx8IGluZGV4IGluIE8pIHtcbiAgICAgIGlmIChPW2luZGV4XSA9PT0gZWwpIHJldHVybiBJU19JTkNMVURFUyB8fCBpbmRleCB8fCAwO1xuICAgIH0gcmV0dXJuICFJU19JTkNMVURFUyAmJiAtMTtcbiAgfTtcbn07XG5cblxuXG4vLy8vLy8vLy8vLy8vLy8vLy9cbi8vIFdFQlBBQ0sgRk9PVEVSXG4vLyAuL25vZGVfbW9kdWxlcy9jb3JlLWpzL2xpYnJhcnkvbW9kdWxlcy9fYXJyYXktaW5jbHVkZXMuanNcbi8vIG1vZHVsZSBpZCA9IDYyXG4vLyBtb2R1bGUgY2h1bmtzID0gMCJdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///62\n")},function(module,exports,__webpack_require__){eval("// 7.1.15 ToLength\nvar toInteger = __webpack_require__(19);\nvar min = Math.min;\nmodule.exports = function (it) {\n return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNjMuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX3RvLWxlbmd0aC5qcz80MTExIl0sInNvdXJjZXNDb250ZW50IjpbIi8vIDcuMS4xNSBUb0xlbmd0aFxudmFyIHRvSW50ZWdlciA9IHJlcXVpcmUoJy4vX3RvLWludGVnZXInKTtcbnZhciBtaW4gPSBNYXRoLm1pbjtcbm1vZHVsZS5leHBvcnRzID0gZnVuY3Rpb24gKGl0KSB7XG4gIHJldHVybiBpdCA+IDAgPyBtaW4odG9JbnRlZ2VyKGl0KSwgMHgxZmZmZmZmZmZmZmZmZikgOiAwOyAvLyBwb3coMiwgNTMpIC0gMSA9PSA5MDA3MTk5MjU0NzQwOTkxXG59O1xuXG5cblxuLy8vLy8vLy8vLy8vLy8vLy8vXG4vLyBXRUJQQUNLIEZPT1RFUlxuLy8gLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX3RvLWxlbmd0aC5qc1xuLy8gbW9kdWxlIGlkID0gNjNcbi8vIG1vZHVsZSBjaHVua3MgPSAwIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7Iiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///63\n")},function(module,exports,__webpack_require__){eval("var toInteger = __webpack_require__(19);\nvar max = Math.max;\nvar min = Math.min;\nmodule.exports = function (index, length) {\n index = toInteger(index);\n return index < 0 ? max(index + length, 0) : min(index, length);\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNjQuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX3RvLWFic29sdXRlLWluZGV4LmpzPzdlNDAiXSwic291cmNlc0NvbnRlbnQiOlsidmFyIHRvSW50ZWdlciA9IHJlcXVpcmUoJy4vX3RvLWludGVnZXInKTtcbnZhciBtYXggPSBNYXRoLm1heDtcbnZhciBtaW4gPSBNYXRoLm1pbjtcbm1vZHVsZS5leHBvcnRzID0gZnVuY3Rpb24gKGluZGV4LCBsZW5ndGgpIHtcbiAgaW5kZXggPSB0b0ludGVnZXIoaW5kZXgpO1xuICByZXR1cm4gaW5kZXggPCAwID8gbWF4KGluZGV4ICsgbGVuZ3RoLCAwKSA6IG1pbihpbmRleCwgbGVuZ3RoKTtcbn07XG5cblxuXG4vLy8vLy8vLy8vLy8vLy8vLy9cbi8vIFdFQlBBQ0sgRk9PVEVSXG4vLyAuL25vZGVfbW9kdWxlcy9jb3JlLWpzL2xpYnJhcnkvbW9kdWxlcy9fdG8tYWJzb2x1dGUtaW5kZXguanNcbi8vIG1vZHVsZSBpZCA9IDY0XG4vLyBtb2R1bGUgY2h1bmtzID0gMCJdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7Iiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///64\n")},function(module,exports,__webpack_require__){eval("var document = __webpack_require__(1).document;\nmodule.exports = document && document.documentElement;\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNjUuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX2h0bWwuanM/NDRmMiJdLCJzb3VyY2VzQ29udGVudCI6WyJ2YXIgZG9jdW1lbnQgPSByZXF1aXJlKCcuL19nbG9iYWwnKS5kb2N1bWVudDtcbm1vZHVsZS5leHBvcnRzID0gZG9jdW1lbnQgJiYgZG9jdW1lbnQuZG9jdW1lbnRFbGVtZW50O1xuXG5cblxuLy8vLy8vLy8vLy8vLy8vLy8vXG4vLyBXRUJQQUNLIEZPT1RFUlxuLy8gLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX2h0bWwuanNcbi8vIG1vZHVsZSBpZCA9IDY1XG4vLyBtb2R1bGUgY2h1bmtzID0gMCJdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///65\n")},function(module,exports,__webpack_require__){eval("__webpack_require__(67);\nvar global = __webpack_require__(1);\nvar hide = __webpack_require__(6);\nvar Iterators = __webpack_require__(20);\nvar TO_STRING_TAG = __webpack_require__(9)('toStringTag');\n\nvar DOMIterables = ('CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,' +\n 'DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,' +\n 'MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,' +\n 'SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,' +\n 'TextTrackList,TouchList').split(',');\n\nfor (var i = 0; i < DOMIterables.length; i++) {\n var NAME = DOMIterables[i];\n var Collection = global[NAME];\n var proto = Collection && Collection.prototype;\n if (proto && !proto[TO_STRING_TAG]) hide(proto, TO_STRING_TAG, NAME);\n Iterators[NAME] = Iterators.Array;\n}\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNjYuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvd2ViLmRvbS5pdGVyYWJsZS5qcz9mYWQzI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hYmxlc1tpXTtcbiAgdmFyIENvbGxlY3Rpb24gPSBnbG9iYWxbTkFNRV07XG4gIHZhciBwcm90byA9IENvbGxlY3Rpb24gJiYgQ29sbGVjdGlvbi5wcm90b3R5cGU7XG4gIGlmIChwcm90byAmJiAhcHJvdG9bVE9fU1RSSU5HX1RBR10pIGhpZGUocHJvdG8sIFRPX1NUUklOR19UQUcsIE5BTUUpO1xuICBJdGVyYXRvcnNbTkFNRV0gPSBJdGVyYXRvcnMuQXJyYXk7XG59XG5cblxuXG4vLy8vLy8vLy8vLy8vLy8vLy9cbi8vIFdFQlBBQ0sgRk9PVEVSXG4vLyAuL25vZGVfbW9kdWxlcy9jb3JlLWpzL2xpYnJhcnkvbW9kdWxlcy93ZWIuZG9tLml0ZXJhYmxlLmpzXG4vLyBtb2R1bGUgaWQgPSA2NlxuLy8gbW9kdWxlIGNodW5rcyA9IDAiXSwibWFwcGluZ3MiOiJBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///66\n")},function(module,exports,__webpack_require__){"use strict";eval("\nvar addToUnscopables = __webpack_require__(68);\nvar step = __webpack_require__(69);\nvar Iterators = __webpack_require__(20);\nvar toIObject = __webpack_require__(8);\n\n// 22.1.3.4 Array.prototype.entries()\n// 22.1.3.13 Array.prototype.keys()\n// 22.1.3.29 Array.prototype.values()\n// 22.1.3.30 Array.prototype[@@iterator]()\nmodule.exports = __webpack_require__(34)(Array, 'Array', function (iterated, kind) {\n this._t = toIObject(iterated); // target\n this._i = 0; // next index\n this._k = kind; // kind\n// 22.1.5.2.1 %ArrayIteratorPrototype%.next()\n}, function () {\n var O = this._t;\n var kind = this._k;\n var index = this._i++;\n if (!O || index >= O.length) {\n this._t = undefined;\n return step(1);\n }\n if (kind == 'keys') return step(0, index);\n if (kind == 'values') return step(0, O[index]);\n return step(0, [index, O[index]]);\n}, 'values');\n\n// argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7)\nIterators.Arguments = Iterators.Array;\n\naddToUnscopables('keys');\naddToUnscopables('values');\naddToUnscopables('entries');\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNjcuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvZXM2LmFycmF5Lml0ZXJhdG9yLmpzP2M0NjkiXSwic291cmNlc0NvbnRlbnQiOlsiJ3VzZSBzdHJpY3QnO1xudmFyIGFkZFRvVW5zY29wYWJsZXMgPSByZXF1aXJlKCcuL19hZGQtdG8tdW5zY29wYWJsZXMnKTtcbnZhciBzdGVwID0gcmVxdWlyZSgnLi9faXRlci1zdGVwJyk7XG52YXIgSXRlcmF0b3JzID0gcmVxdWlyZSgnLi9faXRlcmF0b3JzJyk7XG52YXIgdG9JT2JqZWN0ID0gcmVxdWlyZSgnLi9fdG8taW9iamVjdCcpO1xuXG4vLyAyMi4xLjMuNCBBcnJheS5wcm90b3R5cGUuZW50cmllcygpXG4vLyAyMi4xLjMuMTMgQXJyYXkucHJvdG90eXBlLmtleXMoKVxuLy8gMjIuMS4zLjI5IEFycmF5LnByb3RvdHlwZS52YWx1ZXMoKVxuLy8gMjIuMS4zLjMwIEFycmF5LnByb3RvdHlwZVtAQGl0ZXJhdG9yXSgpXG5tb2R1bGUuZXhwb3J0cyA9IHJlcXVpcmUoJy4vX2l0ZXItZGVmaW5lJykoQXJyYXksICdBcnJheScsIGZ1bmN0aW9uIChpdGVyYXRlZCwga2luZCkge1xuICB0aGlzLl90ID0gdG9JT2JqZWN0KGl0ZXJhdGVkKTsgLy8gdGFyZ2V0XG4gIHRoaXMuX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HBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///67\n")},function(module,exports){eval("module.exports = function () { /* empty */ };\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNjguanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX2FkZC10by11bnNjb3BhYmxlcy5qcz9lMjY3Il0sInNvdXJjZXNDb250ZW50IjpbIm1vZHVsZS5leHBvcnRzID0gZnVuY3Rpb24gKCkgeyAvKiBlbXB0eSAqLyB9O1xuXG5cblxuLy8vLy8vLy8vLy8vLy8vLy8vXG4vLyBXRUJQQUNLIEZPT1RFUlxuLy8gLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX2FkZC10by11bnNjb3BhYmxlcy5qc1xuLy8gbW9kdWxlIGlkID0gNjhcbi8vIG1vZHVsZSBjaHVua3MgPSAwIl0sIm1hcHBpbmdzIjoiQUFBQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///68\n")},function(module,exports){eval("module.exports = function (done, value) {\n return { value: value, done: !!done };\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNjkuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX2l0ZXItc3RlcC5qcz8xMDY2Il0sInNvdXJjZXNDb250ZW50IjpbIm1vZHVsZS5leHBvcnRzID0gZnVuY3Rpb24gKGRvbmUsIHZhbHVlKSB7XG4gIHJldHVybiB7IHZhbHVlOiB2YWx1ZSwgZG9uZTogISFkb25lIH07XG59O1xuXG5cblxuLy8vLy8vLy8vLy8vLy8vLy8vXG4vLyBXRUJQQUNLIEZPT1RFUlxuLy8gLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX2l0ZXItc3RlcC5qc1xuLy8gbW9kdWxlIGlkID0gNjlcbi8vIG1vZHVsZSBjaHVua3MgPSAwIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7Iiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///69\n")},function(module,exports,__webpack_require__){eval('module.exports = { "default": __webpack_require__(71), __esModule: true };//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNzAuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYmFiZWwtcnVudGltZS9jb3JlLWpzL3N5bWJvbC5qcz9lNTA1Il0sInNvdXJjZXNDb250ZW50IjpbIm1vZHVsZS5leHBvcnRzID0geyBcImRlZmF1bHRcIjogcmVxdWlyZShcImNvcmUtanMvbGlicmFyeS9mbi9zeW1ib2xcIiksIF9fZXNNb2R1bGU6IHRydWUgfTtcblxuXG4vLy8vLy8vLy8vLy8vLy8vLy9cbi8vIFdFQlBBQ0sgRk9PVEVSXG4vLyAuL25vZGVfbW9kdWxlcy9iYWJlbC1ydW50aW1lL2NvcmUtanMvc3ltYm9sLmpzXG4vLyBtb2R1bGUgaWQgPSA3MFxuLy8gbW9kdWxlIGNodW5rcyA9IDAiXSwibWFwcGluZ3MiOiJBQUFBIiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///70\n')},function(module,exports,__webpack_require__){eval("__webpack_require__(72);\n__webpack_require__(77);\n__webpack_require__(78);\n__webpack_require__(79);\nmodule.exports = __webpack_require__(0).Symbol;\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNzEuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L2ZuL3N5bWJvbC9pbmRleC5qcz8wNzA3Il0sInNvdXJjZXNDb250ZW50IjpbInJlcXVpcmUoJy4uLy4uL21vZHVsZXMvZXM2LnN5bWJvbCcpO1xucmVxdWlyZSgnLi4vLi4vbW9kdWxlcy9lczYub2JqZWN0LnRvLXN0cmluZycpO1xucmVxdWlyZSgnLi4vLi4vbW9kdWxlcy9lczcuc3ltYm9sLmFzeW5jLWl0ZXJhdG9yJyk7XG5yZXF1aXJlKCcuLi8uLi9tb2R1bGVzL2VzNy5zeW1ib2wub2JzZXJ2YWJsZScpO1xubW9kdWxlLmV4cG9ydHMgPSByZXF1aXJlKCcuLi8uLi9tb2R1bGVzL19jb3JlJykuU3ltYm9sO1xuXG5cblxuLy8vLy8vLy8vLy8vLy8vLy8vXG4vLyBXRUJQQUNLIEZPT1RFUlxuLy8gLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L2ZuL3N5bWJvbC9pbmRleC5qc1xuLy8gbW9kdWxlIGlkID0gNzFcbi8vIG1vZHVsZSBjaHVua3MgPSAwIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///71\n")},function(module,exports,__webpack_require__){"use strict";eval("\n// ECMAScript 6 symbols shim\nvar global = __webpack_require__(1);\nvar has = __webpack_require__(2);\nvar DESCRIPTORS = __webpack_require__(4);\nvar $export = __webpack_require__(5);\nvar redefine = __webpack_require__(35);\nvar META = __webpack_require__(73).KEY;\nvar $fails = __webpack_require__(11);\nvar shared = __webpack_require__(17);\nvar setToStringTag = __webpack_require__(24);\nvar uid = __webpack_require__(13);\nvar wks = __webpack_require__(9);\nvar wksExt = __webpack_require__(25);\nvar wksDefine = __webpack_require__(26);\nvar enumKeys = __webpack_require__(74);\nvar isArray = __webpack_require__(75);\nvar anObject = __webpack_require__(10);\nvar isObject = __webpack_require__(7);\nvar toIObject = __webpack_require__(8);\nvar toPrimitive = __webpack_require__(18);\nvar createDesc = __webpack_require__(14);\nvar _create = __webpack_require__(21);\nvar gOPNExt = __webpack_require__(76);\nvar $GOPD = __webpack_require__(40);\nvar $DP = __webpack_require__(3);\nvar $keys = __webpack_require__(22);\nvar gOPD = $GOPD.f;\nvar dP = $DP.f;\nvar gOPN = gOPNExt.f;\nvar $Symbol = global.Symbol;\nvar $JSON = global.JSON;\nvar _stringify = $JSON && $JSON.stringify;\nvar PROTOTYPE = 'prototype';\nvar HIDDEN = wks('_hidden');\nvar TO_PRIMITIVE = wks('toPrimitive');\nvar isEnum = {}.propertyIsEnumerable;\nvar SymbolRegistry = shared('symbol-registry');\nvar AllSymbols = shared('symbols');\nvar OPSymbols = shared('op-symbols');\nvar ObjectProto = Object[PROTOTYPE];\nvar USE_NATIVE = typeof $Symbol == 'function';\nvar QObject = global.QObject;\n// Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173\nvar setter = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild;\n\n// fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687\nvar setSymbolDesc = DESCRIPTORS && $fails(function () {\n return _create(dP({}, 'a', {\n get: function () { return dP(this, 'a', { value: 7 }).a; }\n })).a != 7;\n}) ? function (it, key, D) {\n var protoDesc = gOPD(ObjectProto, key);\n if (protoDesc) delete ObjectProto[key];\n dP(it, key, D);\n if (protoDesc && it !== ObjectProto) dP(ObjectProto, key, protoDesc);\n} : dP;\n\nvar wrap = function (tag) {\n var sym = AllSymbols[tag] = _create($Symbol[PROTOTYPE]);\n sym._k = tag;\n return sym;\n};\n\nvar isSymbol = USE_NATIVE && typeof $Symbol.iterator == 'symbol' ? function (it) {\n return typeof it == 'symbol';\n} : function (it) {\n return it instanceof $Symbol;\n};\n\nvar $defineProperty = function defineProperty(it, key, D) {\n if (it === ObjectProto) $defineProperty(OPSymbols, key, D);\n anObject(it);\n key = toPrimitive(key, true);\n anObject(D);\n if (has(AllSymbols, key)) {\n if (!D.enumerable) {\n if (!has(it, HIDDEN)) dP(it, HIDDEN, createDesc(1, {}));\n it[HIDDEN][key] = true;\n } else {\n if (has(it, HIDDEN) && it[HIDDEN][key]) it[HIDDEN][key] = false;\n D = _create(D, { enumerable: createDesc(0, false) });\n } return setSymbolDesc(it, key, D);\n } return dP(it, key, D);\n};\nvar $defineProperties = function defineProperties(it, P) {\n anObject(it);\n var keys = enumKeys(P = toIObject(P));\n var i = 0;\n var l = keys.length;\n var key;\n while (l > i) $defineProperty(it, key = keys[i++], P[key]);\n return it;\n};\nvar $create = function create(it, P) {\n return P === undefined ? _create(it) : $defineProperties(_create(it), P);\n};\nvar $propertyIsEnumerable = function propertyIsEnumerable(key) {\n var E = isEnum.call(this, key = toPrimitive(key, true));\n if (this === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key)) return false;\n return E || !has(this, key) || !has(AllSymbols, key) || has(this, HIDDEN) && this[HIDDEN][key] ? E : true;\n};\nvar $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key) {\n it = toIObject(it);\n key = toPrimitive(key, true);\n if (it === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key)) return;\n var D = gOPD(it, key);\n if (D && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key])) D.enumerable = true;\n return D;\n};\nvar $getOwnPropertyNames = function getOwnPropertyNames(it) {\n var names = gOPN(toIObject(it));\n var result = [];\n var i = 0;\n var key;\n while (names.length > i) {\n if (!has(AllSymbols, key = names[i++]) && key != HIDDEN && key != META) result.push(key);\n } return result;\n};\nvar $getOwnPropertySymbols = function getOwnPropertySymbols(it) {\n var IS_OP = it === ObjectProto;\n var names = gOPN(IS_OP ? OPSymbols : toIObject(it));\n var result = [];\n var i = 0;\n var key;\n while (names.length > i) {\n if (has(AllSymbols, key = names[i++]) && (IS_OP ? has(ObjectProto, key) : true)) result.push(AllSymbols[key]);\n } return result;\n};\n\n// 19.4.1.1 Symbol([description])\nif (!USE_NATIVE) {\n $Symbol = function Symbol() {\n if (this instanceof $Symbol) throw TypeError('Symbol is not a constructor!');\n var tag = uid(arguments.length > 0 ? arguments[0] : undefined);\n var $set = function (value) {\n if (this === ObjectProto) $set.call(OPSymbols, value);\n if (has(this, HIDDEN) && has(this[HIDDEN], tag)) this[HIDDEN][tag] = false;\n setSymbolDesc(this, tag, createDesc(1, value));\n };\n if (DESCRIPTORS && setter) setSymbolDesc(ObjectProto, tag, { configurable: true, set: $set });\n return wrap(tag);\n };\n redefine($Symbol[PROTOTYPE], 'toString', function toString() {\n return this._k;\n });\n\n $GOPD.f = $getOwnPropertyDescriptor;\n $DP.f = $defineProperty;\n __webpack_require__(39).f = gOPNExt.f = $getOwnPropertyNames;\n __webpack_require__(27).f = $propertyIsEnumerable;\n __webpack_require__(38).f = $getOwnPropertySymbols;\n\n if (DESCRIPTORS && !__webpack_require__(12)) {\n redefine(ObjectProto, 'propertyIsEnumerable', $propertyIsEnumerable, true);\n }\n\n wksExt.f = function (name) {\n return wrap(wks(name));\n };\n}\n\n$export($export.G + $export.W + $export.F * !USE_NATIVE, { Symbol: $Symbol });\n\nfor (var es6Symbols = (\n // 19.4.2.2, 19.4.2.3, 19.4.2.4, 19.4.2.6, 19.4.2.8, 19.4.2.9, 19.4.2.10, 19.4.2.11, 19.4.2.12, 19.4.2.13, 19.4.2.14\n 'hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables'\n).split(','), j = 0; es6Symbols.length > j;)wks(es6Symbols[j++]);\n\nfor (var wellKnownSymbols = $keys(wks.store), k = 0; wellKnownSymbols.length > k;) wksDefine(wellKnownSymbols[k++]);\n\n$export($export.S + $export.F * !USE_NATIVE, 'Symbol', {\n // 19.4.2.1 Symbol.for(key)\n 'for': function (key) {\n return has(SymbolRegistry, key += '')\n ? SymbolRegistry[key]\n : SymbolRegistry[key] = $Symbol(key);\n },\n // 19.4.2.5 Symbol.keyFor(sym)\n keyFor: function keyFor(sym) {\n if (!isSymbol(sym)) throw TypeError(sym + ' is not a symbol!');\n for (var key in SymbolRegistry) if (SymbolRegistry[key] === sym) return key;\n },\n useSetter: function () { setter = true; },\n useSimple: function () { setter = false; }\n});\n\n$export($export.S + $export.F * !USE_NATIVE, 'Object', {\n // 19.1.2.2 Object.create(O [, Properties])\n create: $create,\n // 19.1.2.4 Object.defineProperty(O, P, Attributes)\n defineProperty: $defineProperty,\n // 19.1.2.3 Object.defineProperties(O, Properties)\n defineProperties: $defineProperties,\n // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P)\n getOwnPropertyDescriptor: $getOwnPropertyDescriptor,\n // 19.1.2.7 Object.getOwnPropertyNames(O)\n getOwnPropertyNames: $getOwnPropertyNames,\n // 19.1.2.8 Object.getOwnPropertySymbols(O)\n getOwnPropertySymbols: $getOwnPropertySymbols\n});\n\n// 24.3.2 JSON.stringify(value [, replacer [, space]])\n$JSON && $export($export.S + $export.F * (!USE_NATIVE || $fails(function () {\n var S = $Symbol();\n // MS Edge converts symbol values to JSON as {}\n // WebKit converts symbol values to JSON as null\n // V8 throws on boxed symbols\n return _stringify([S]) != '[null]' || _stringify({ a: S }) != '{}' || _stringify(Object(S)) != '{}';\n})), 'JSON', {\n stringify: function stringify(it) {\n var args = [it];\n var i = 1;\n var replacer, $replacer;\n while (arguments.length > i) args.push(arguments[i++]);\n $replacer = replacer = args[1];\n if (!isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined\n if (!isArray(replacer)) replacer = function (key, value) {\n if (typeof $replacer == 'function') value = $replacer.call(this, key, value);\n if (!isSymbol(value)) return value;\n };\n args[1] = replacer;\n return _stringify.apply($JSON, args);\n }\n});\n\n// 19.4.3.4 Symbol.prototype[@@toPrimitive](hint)\n$Symbol[PROTOTYPE][TO_PRIMITIVE] || __webpack_require__(6)($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf);\n// 19.4.3.5 Symbol.prototype[@@toStringTag]\nsetToStringTag($Symbol, 'Symbol');\n// 20.2.1.9 Math[@@toStringTag]\nsetToStringTag(Math, 'Math', true);\n// 24.3.3 JSON[@@toStringTag]\nsetToStringTag(global.JSON, 'JSON', true);\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNzIuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvZXM2LnN5bWJvbC5qcz83ZDY3Il0sInNvdXJjZXNDb250ZW50IjpbIid1c2Ugc3RyaWN0Jztcbi8vIEVDTUFTY3JpcHQgNiBzeW1ib2xzIHNoaW1cbnZhciBnbG9iYWwgPSByZXF1aXJlKCcuL19nbG9iYWwnKTtcbnZhciBoYXMgPSByZXF1aXJlKCcuL19oYXMnKTtcbnZhciBERVNDUklQVE9SUyA9IHJlcXVpcmUoJy4vX2Rlc2NyaXB0b3JzJyk7XG52YXIgJGV4cG9ydCA9IHJlcXVpcmUoJy4vX2V4cG9ydCcpO1xudmFyIHJlZGVmaW5lID0gcmVxdWlyZSgnLi9fcmVkZWZpbmUnKTtcbnZhciBNRVRBID0gcmVxdWlyZSgnLi9fbWV0YScpLktFWTtcbnZhciAkZmFpbHMgPSByZXF1aXJlKCcuL19mYWlscycpO1xudmFyIHNoYXJlZCA9IHJlcXVpcmUoJy4vX3NoYXJlZCcpO1xudmFyIHNldFR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0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///72\n")},function(module,exports,__webpack_require__){eval("var META = __webpack_require__(13)('meta');\nvar isObject = __webpack_require__(7);\nvar has = __webpack_require__(2);\nvar setDesc = __webpack_require__(3).f;\nvar id = 0;\nvar isExtensible = Object.isExtensible || function () {\n return true;\n};\nvar FREEZE = !__webpack_require__(11)(function () {\n return isExtensible(Object.preventExtensions({}));\n});\nvar setMeta = function (it) {\n setDesc(it, META, { value: {\n i: 'O' + ++id, // object ID\n w: {} // weak collections IDs\n } });\n};\nvar fastKey = function (it, create) {\n // return primitive with prefix\n if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;\n if (!has(it, META)) {\n // can't set metadata to uncaught frozen object\n if (!isExtensible(it)) return 'F';\n // not necessary to add metadata\n if (!create) return 'E';\n // add missing metadata\n setMeta(it);\n // return object ID\n } return it[META].i;\n};\nvar getWeak = function (it, create) {\n if (!has(it, META)) {\n // can't set metadata to uncaught frozen object\n if (!isExtensible(it)) return true;\n // not necessary to add metadata\n if (!create) return false;\n // add missing metadata\n setMeta(it);\n // return hash weak collections IDs\n } return it[META].w;\n};\n// add metadata on freeze-family methods calling\nvar onFreeze = function (it) {\n if (FREEZE && meta.NEED && isExtensible(it) && !has(it, META)) setMeta(it);\n return it;\n};\nvar meta = module.exports = {\n KEY: META,\n NEED: false,\n fastKey: fastKey,\n getWeak: getWeak,\n onFreeze: onFreeze\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNzMuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX21ldGEuanM/ZDNhMyJdLCJzb3VyY2VzQ29udGVudCI6WyJ2YXIgTUVUQSA9IHJlcXVpcmUoJy4vX3VpZCcpKCdtZXRhJyk7XG52YXIgaXNPYmplY3QgPSByZXF1aXJlKCcuL19pcy1vYmplY3QnKTtcbnZhciBoYXMgPSByZXF1aXJlKCcuL19oYXMnKTtcbnZhciBzZXREZXNjID0gcmVxdWlyZSgnLi9fb2JqZWN0LWRwJykuZjtcbnZhciBpZCA9IDA7XG52YXIgaXNFeHRlbnNpYmxlID0gT2JqZWN0LmlzRXh0ZW5zaWJsZSB8fCBmdW5jdGlvbiAoKSB7XG4gIHJldHVybiB0cnVlO1xufTtcbnZhciBGUkVFWkUgPSAhcmVxdWlyZSgnLi9fZmFpbHMnKShmdW5jdGlvbiAoKSB7XG4gIHJldHVybiBpc0V4dGVuc2libGUoT2JqZWN0LnByZXZlbnRFeHRlbnNpb25zKHt9KSk7XG59KTtcbnZhciBzZXRNZXRhID0gZnVuY3Rpb24gKGl0KSB7XG4gIHNldERlc2MoaXQsIE1FVEEsIHsgdmFsdWU6IHtcbiAgIC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NBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///73\n")},function(module,exports,__webpack_require__){eval("// all enumerable object keys, includes symbols\nvar getKeys = __webpack_require__(22);\nvar gOPS = __webpack_require__(38);\nvar pIE = __webpack_require__(27);\nmodule.exports = function (it) {\n var result = getKeys(it);\n var getSymbols = gOPS.f;\n if (getSymbols) {\n var symbols = getSymbols(it);\n var isEnum = pIE.f;\n var i = 0;\n var key;\n while (symbols.length > i) if (isEnum.call(it, key = symbols[i++])) result.push(key);\n } return result;\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNzQuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX2VudW0ta2V5cy5qcz81ZGNlIl0sInNvdXJjZXNDb250ZW50IjpbIi8vIGFsbCBlbnVtZXJhYmxlIG9iamVjdCBrZXlzLCBpbmNsdWRlcyBzeW1ib2xzXG52YXIgZ2V0S2V5cyA9IHJlcXVpcmUoJy4vX29iamVjdC1rZXlzJyk7XG52YXIgZ09QUyA9IHJlcXVpcmUoJy4vX29iamVjdC1nb3BzJyk7XG52YXIgcElFID0gcmVxdWlyZSgnLi9fb2JqZWN0LXBpZScpO1xubW9kdWxlLmV4cG9ydHMgPSBmdW5jdGlvbiAoaXQpIHtcbiAgdmFyIHJlc3VsdCA9IGdldEtleXMoaXQpO1xuICB2YXIgZ2V0U3ltYm9scyA9IGdPUFMuZjtcbiAgaWYgKGdldFN5bWJvbHMpIHtcbiAgICB2YXIgc3ltYm9scyA9IGdldFN5bWJvbHMoaXQpO1xuICAgIHZhciBpc0VudW0gPSBwSUUuZjtcbiAgICB2YXIgaSA9IDA7XG4gICAgdmFyIGtleTtcbiAgICB3aGlsZSAoc3ltYm9scy5sZW5ndGggPiBpKSBpZiAoaXNFbnVtLmNhbGwoaXQsIGtleSA9IHN5bWJvbHNbaSsrXSkpIHJlc3VsdC5wdXNoKGtleSk7XG4gIH0gcmV0dXJuIHJlc3VsdDtcbn07XG5cblxuXG4vLy8vLy8vLy8vLy8vLy8vLy9cbi8vIFdFQlBBQ0sgRk9PVEVSXG4vLyAuL25vZGVfbW9kdWxlcy9jb3JlLWpzL2xpYnJhcnkvbW9kdWxlcy9fZW51bS1rZXlzLmpzXG4vLyBtb2R1bGUgaWQgPSA3NFxuLy8gbW9kdWxlIGNodW5rcyA9IDAiXSwibWFwcGluZ3MiOiJBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///74\n")},function(module,exports,__webpack_require__){eval("// 7.2.2 IsArray(argument)\nvar cof = __webpack_require__(37);\nmodule.exports = Array.isArray || function isArray(arg) {\n return cof(arg) == 'Array';\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNzUuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX2lzLWFycmF5LmpzP2VkNDMiXSwic291cmNlc0NvbnRlbnQiOlsiLy8gNy4yLjIgSXNBcnJheShhcmd1bWVudClcbnZhciBjb2YgPSByZXF1aXJlKCcuL19jb2YnKTtcbm1vZHVsZS5leHBvcnRzID0gQXJyYXkuaXNBcnJheSB8fCBmdW5jdGlvbiBpc0FycmF5KGFyZykge1xuICByZXR1cm4gY29mKGFyZykgPT0gJ0FycmF5Jztcbn07XG5cblxuXG4vLy8vLy8vLy8vLy8vLy8vLy9cbi8vIFdFQlBBQ0sgRk9PVEVSXG4vLyAuL25vZGVfbW9kdWxlcy9jb3JlLWpzL2xpYnJhcnkvbW9kdWxlcy9faXMtYXJyYXkuanNcbi8vIG1vZHVsZSBpZCA9IDc1XG4vLyBtb2R1bGUgY2h1bmtzID0gMCJdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///75\n")},function(module,exports,__webpack_require__){eval("// fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window\nvar toIObject = __webpack_require__(8);\nvar gOPN = __webpack_require__(39).f;\nvar toString = {}.toString;\n\nvar windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames\n ? Object.getOwnPropertyNames(window) : [];\n\nvar getWindowNames = function (it) {\n try {\n return gOPN(it);\n } catch (e) {\n return windowNames.slice();\n }\n};\n\nmodule.exports.f = function getOwnPropertyNames(it) {\n return windowNames && toString.call(it) == '[object Window]' ? getWindowNames(it) : gOPN(toIObject(it));\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNzYuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX29iamVjdC1nb3BuLWV4dC5qcz80NmI3Il0sInNvdXJjZXNDb250ZW50IjpbIi8vIGZhbGxiYWNrIGZvciBJRTExIGJ1Z2d5IE9iamVjdC5nZXRPd25Qcm9wZXJ0eU5hbWVzIHdpdGggaWZyYW1lIGFuZCB3aW5kb3dcbnZhciB0b0lPYmplY3QgPSByZXF1aXJlKCcuL190by1pb2JqZWN0Jyk7XG52YXIgZ09QTiA9IHJlcXVpcmUoJy4vX29iamVjdC1nb3BuJykuZjtcbnZhciB0b1N0cmluZyA9IHt9LnRvU3RyaW5nO1xuXG52YXIgd2luZG93TmFtZXMgPSB0eXBlb2Ygd2luZG93ID09ICdvYmplY3QnICYmIHdpbmRvdyAmJiBPYmplY3QuZ2V0T3duUHJvcGVydHlOYW1lc1xuICA/IE9iamVjdC5nZXRPd25Qcm9wZXJ0eU5hbWVzKHdpbmRvdykgOiBbXTtcblxudmFyIGdldFdpbmRvd05hbWVzID0gZnVuY3Rpb24gKGl0KSB7XG4gIHRyeSB7XG4gICAgcmV0dXJuIGdPUE4oaXQpO1xuICB9IGNhdGNoIChlKSB7XG4gICAgcmV0dXJuIHdpbmRvd05hbWVzLnNsaWNlKCk7XG4gIH1cbn07XG5cbm1vZHVsZS5leHBvcnRzLmYgPSBmdW5jdGlvbiBnZXRPd25Qcm9wZXJ0eU5hbWVzKGl0KSB7XG4gIHJldHVybiB3aW5kb3dOYW1lcyAmJiB0b1N0cmluZy5jYWxsKGl0KSA9PSAnW29iamVjdCBXaW5kb3ddJyA/IGdldFdpbmRvd05hbWVzKGl0KSA6IGdPUE4odG9JT2JqZWN0KGl0KSk7XG59O1xuXG5cblxuLy8vLy8vLy8vLy8vLy8vLy8vXG4vLyBXRUJQQUNLIEZPT1RFUlxuLy8gLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX29iamVjdC1nb3BuLWV4dC5qc1xuLy8gbW9kdWxlIGlkID0gNzZcbi8vIG1vZHVsZSBjaHVua3MgPSAwIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///76\n")},function(module,exports){eval("//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNzcuanMiLCJzb3VyY2VzIjpbXSwibWFwcGluZ3MiOiIiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///77\n")},function(module,exports,__webpack_require__){eval("__webpack_require__(26)('asyncIterator');\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNzguanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvZXM3LnN5bWJvbC5hc3luYy1pdGVyYXRvci5qcz8zOTg5Il0sInNvdXJjZXNDb250ZW50IjpbInJlcXVpcmUoJy4vX3drcy1kZWZpbmUnKSgnYXN5bmNJdGVyYXRvcicpO1xuXG5cblxuLy8vLy8vLy8vLy8vLy8vLy8vXG4vLyBXRUJQQUNLIEZPT1RFUlxuLy8gLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvZXM3LnN5bWJvbC5hc3luYy1pdGVyYXRvci5qc1xuLy8gbW9kdWxlIGlkID0gNzhcbi8vIG1vZHVsZSBjaHVua3MgPSAwIl0sIm1hcHBpbmdzIjoiQUFBQTsiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///78\n")},function(module,exports,__webpack_require__){eval("__webpack_require__(26)('observable');\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiNzkuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvZXM3LnN5bWJvbC5vYnNlcnZhYmxlLmpzPzQxNjciXSwic291cmNlc0NvbnRlbnQiOlsicmVxdWlyZSgnLi9fd2tzLWRlZmluZScpKCdvYnNlcnZhYmxlJyk7XG5cblxuXG4vLy8vLy8vLy8vLy8vLy8vLy9cbi8vIFdFQlBBQ0sgRk9PVEVSXG4vLyAuL25vZGVfbW9kdWxlcy9jb3JlLWpzL2xpYnJhcnkvbW9kdWxlcy9lczcuc3ltYm9sLm9ic2VydmFibGUuanNcbi8vIG1vZHVsZSBpZCA9IDc5XG4vLyBtb2R1bGUgY2h1bmtzID0gMCJdLCJtYXBwaW5ncyI6IkFBQUE7Iiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///79\n")},function(module,exports,__webpack_require__){"use strict";eval('\n\nexports.__esModule = true;\n\nvar _setPrototypeOf = __webpack_require__(81);\n\nvar _setPrototypeOf2 = _interopRequireDefault(_setPrototypeOf);\n\nvar _create = __webpack_require__(85);\n\nvar _create2 = _interopRequireDefault(_create);\n\nvar _typeof2 = __webpack_require__(33);\n\nvar _typeof3 = _interopRequireDefault(_typeof2);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nexports.default = function (subClass, superClass) {\n if (typeof superClass !== "function" && superClass !== null) {\n throw new TypeError("Super expression must either be null or a function, not " + (typeof superClass === "undefined" ? "undefined" : (0, _typeof3.default)(superClass)));\n }\n\n subClass.prototype = (0, _create2.default)(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n if (superClass) _setPrototypeOf2.default ? (0, _setPrototypeOf2.default)(subClass, superClass) : subClass.__proto__ = superClass;\n};//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiODAuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYmFiZWwtcnVudGltZS9oZWxwZXJzL2luaGVyaXRzLmpzPzNkZmQiXSwic291cmNlc0NvbnRlbnQiOlsiXCJ1c2Ugc3RyaWN0XCI7XG5cbmV4cG9ydHMuX19lc01vZHVsZSA9IHRydWU7XG5cbnZhciBfc2V0UHJvdG90eXBlT2YgPSByZXF1aXJlKFwiLi4vY29yZS1qcy9vYmplY3Qvc2V0LXByb3RvdHlwZS1vZlwi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BzdWJDbGFzcyxcbiAgICAgIGVudW1lcmFibGU6IGZhbHNlLFxuICAgICAgd3JpdGFibGU6IHRydWUsXG4gICAgICBjb25maWd1cmFibGU6IHRydWVcbiAgICB9XG4gIH0pO1xuICBpZiAoc3VwZXJDbGFzcykgX3NldFByb3RvdHlwZU9mMi5kZWZhdWx0ID8gKDAsIF9zZXRQcm90b3R5cGVPZjIuZGVmYXVsdCkoc3ViQ2xhc3MsIHN1cGVyQ2xhc3MpIDogc3ViQ2xhc3MuX19wcm90b19fID0gc3VwZXJDbGFzcztcbn07XG5cblxuLy8vLy8vLy8vLy8vLy8vLy8vXG4vLyBXRUJQQUNLIEZPT1RFUlxuLy8gLi9ub2RlX21vZHVsZXMvYmFiZWwtcnVudGltZS9oZWxwZXJzL2luaGVyaXRzLmpzXG4vLyBtb2R1bGUgaWQgPSA4MFxuLy8gbW9kdWxlIGNodW5rcyA9IDAiXSwibWFwcGluZ3MiOiJBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///80\n')},function(module,exports,__webpack_require__){eval('module.exports = { "default": __webpack_require__(82), __esModule: true };//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiODEuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYmFiZWwtcnVudGltZS9jb3JlLWpzL29iamVjdC9zZXQtcHJvdG90eXBlLW9mLmpzPzkyMjAiXSwic291cmNlc0NvbnRlbnQiOlsibW9kdWxlLmV4cG9ydHMgPSB7IFwiZGVmYXVsdFwiOiByZXF1aXJlKFwiY29yZS1qcy9saWJyYXJ5L2ZuL29iamVjdC9zZXQtcHJvdG90eXBlLW9mXCIpLCBfX2VzTW9kdWxlOiB0cnVlIH07XG5cblxuLy8vLy8vLy8vLy8vLy8vLy8vXG4vLyBXRUJQQUNLIEZPT1RFUlxuLy8gLi9ub2RlX21vZHVsZXMvYmFiZWwtcnVudGltZS9jb3JlLWpzL29iamVjdC9zZXQtcHJvdG90eXBlLW9mLmpzXG4vLyBtb2R1bGUgaWQgPSA4MVxuLy8gbW9kdWxlIGNodW5rcyA9IDAiXSwibWFwcGluZ3MiOiJBQUFBIiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///81\n')},function(module,exports,__webpack_require__){eval("__webpack_require__(83);\nmodule.exports = __webpack_require__(0).Object.setPrototypeOf;\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiODIuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L2ZuL29iamVjdC9zZXQtcHJvdG90eXBlLW9mLmpzPzhiZjAiXSwic291cmNlc0NvbnRlbnQiOlsicmVxdWlyZSgnLi4vLi4vbW9kdWxlcy9lczYub2JqZWN0LnNldC1wcm90b3R5cGUtb2YnKTtcbm1vZHVsZS5leHBvcnRzID0gcmVxdWlyZSgnLi4vLi4vbW9kdWxlcy9fY29yZScpLk9iamVjdC5zZXRQcm90b3R5cGVPZjtcblxuXG5cbi8vLy8vLy8vLy8vLy8vLy8vL1xuLy8gV0VCUEFDSyBGT09URVJcbi8vIC4vbm9kZV9tb2R1bGVzL2NvcmUtanMvbGlicmFyeS9mbi9vYmplY3Qvc2V0LXByb3RvdHlwZS1vZi5qc1xuLy8gbW9kdWxlIGlkID0gODJcbi8vIG1vZHVsZSBjaHVua3MgPSAwIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///82\n")},function(module,exports,__webpack_require__){eval("// 19.1.3.19 Object.setPrototypeOf(O, proto)\nvar $export = __webpack_require__(5);\n$export($export.S, 'Object', { setPrototypeOf: __webpack_require__(84).set });\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiODMuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvZXM2Lm9iamVjdC5zZXQtcHJvdG90eXBlLW9mLmpzPzdiMTgiXSwic291cmNlc0NvbnRlbnQiOlsiLy8gMTkuMS4zLjE5IE9iamVjdC5zZXRQcm90b3R5cGVPZihPLCBwcm90bylcbnZhciAkZXhwb3J0ID0gcmVxdWlyZSgnLi9fZXhwb3J0Jyk7XG4kZXhwb3J0KCRleHBvcnQuUywgJ09iamVjdCcsIHsgc2V0UHJvdG90eXBlT2Y6IHJlcXVpcmUoJy4vX3NldC1wcm90bycpLnNldCB9KTtcblxuXG5cbi8vLy8vLy8vLy8vLy8vLy8vL1xuLy8gV0VCUEFDSyBGT09URVJcbi8vIC4vbm9kZV9tb2R1bGVzL2NvcmUtanMvbGlicmFyeS9tb2R1bGVzL2VzNi5vYmplY3Quc2V0LXByb3RvdHlwZS1vZi5qc1xuLy8gbW9kdWxlIGlkID0gODNcbi8vIG1vZHVsZSBjaHVua3MgPSAwIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7Iiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///83\n")},function(module,exports,__webpack_require__){eval("// Works with __proto__ only. Old v8 can't work with null proto objects.\n/* eslint-disable no-proto */\nvar isObject = __webpack_require__(7);\nvar anObject = __webpack_require__(10);\nvar check = function (O, proto) {\n anObject(O);\n if (!isObject(proto) && proto !== null) throw TypeError(proto + \": can't set as prototype!\");\n};\nmodule.exports = {\n set: Object.setPrototypeOf || ('__proto__' in {} ? // eslint-disable-line\n function (test, buggy, set) {\n try {\n set = __webpack_require__(30)(Function.call, __webpack_require__(40).f(Object.prototype, '__proto__').set, 2);\n set(test, []);\n buggy = !(test instanceof Array);\n } catch (e) { buggy = true; }\n return function setPrototypeOf(O, proto) {\n check(O, proto);\n if (buggy) O.__proto__ = proto;\n else set(O, proto);\n return O;\n };\n }({}, false) : undefined),\n check: check\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiODQuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvX3NldC1wcm90by5qcz82NWE0Il0sInNvdXJjZXNDb250ZW50IjpbIi8vIFdvcmtzIHdpdGggX19wcm90b19fIG9ubHkuIE9sZCB2OCBjYW4ndCB3b3JrIHdpdGggbnVsbCBwcm90byBvYmplY3RzLlxuLyogZXNsaW50LWRpc2FibGUgbm8tcHJvdG8gKi9cbnZhciBpc09iamVjdCA9IHJlcXVpcmUoJy4vX2lzLW9iamVjdCcpO1xudmFyIGFuT2JqZWN0ID0gcmVxdWlyZSgnLi9fYW4tb2JqZWN0Jyk7XG52YXIgY2hlY2sgPSBmdW5jdGlvbiAoTywgcHJvdG8pIHtcbiAgYW5PYmplY3QoTyk7XG4gIGlmICghaXNPYmplY3QocHJvdG8pICYmIHByb3RvICE9PSBudWxsKSB0aHJvdyBUeXBlRXJyb3IocHJvdG8gKyBcIjogY2FuJ3Qgc2V0IGFzIHByb3RvdHlwZSFcIik7XG59O1xubW9kdWxlLmV4cG9ydHMgPSB7XG4gIHNldDogT2JqZWN0LnNldFByb3RvdHlwZU9mIHx8ICgnX19wcm90b19fJyBpbiB7fSA/IC8vIGVzbGludC1kaXNh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# sourceURL=webpack-internal:///84\n")},function(module,exports,__webpack_require__){eval('module.exports = { "default": __webpack_require__(86), __esModule: true };//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiODUuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYmFiZWwtcnVudGltZS9jb3JlLWpzL29iamVjdC9jcmVhdGUuanM/M2FmNCJdLCJzb3VyY2VzQ29udGVudCI6WyJtb2R1bGUuZXhwb3J0cyA9IHsgXCJkZWZhdWx0XCI6IHJlcXVpcmUoXCJjb3JlLWpzL2xpYnJhcnkvZm4vb2JqZWN0L2NyZWF0ZVwiKSwgX19lc01vZHVsZTogdHJ1ZSB9O1xuXG5cbi8vLy8vLy8vLy8vLy8vLy8vL1xuLy8gV0VCUEFDSyBGT09URVJcbi8vIC4vbm9kZV9tb2R1bGVzL2JhYmVsLXJ1bnRpbWUvY29yZS1qcy9vYmplY3QvY3JlYXRlLmpzXG4vLyBtb2R1bGUgaWQgPSA4NVxuLy8gbW9kdWxlIGNodW5rcyA9IDAiXSwibWFwcGluZ3MiOiJBQUFBIiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///85\n')},function(module,exports,__webpack_require__){eval("__webpack_require__(87);\nvar $Object = __webpack_require__(0).Object;\nmodule.exports = function create(P, D) {\n return $Object.create(P, D);\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiODYuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L2ZuL29iamVjdC9jcmVhdGUuanM/YTBjZSJdLCJzb3VyY2VzQ29udGVudCI6WyJyZXF1aXJlKCcuLi8uLi9tb2R1bGVzL2VzNi5vYmplY3QuY3JlYXRlJyk7XG52YXIgJE9iamVjdCA9IHJlcXVpcmUoJy4uLy4uL21vZHVsZXMvX2NvcmUnKS5PYmplY3Q7XG5tb2R1bGUuZXhwb3J0cyA9IGZ1bmN0aW9uIGNyZWF0ZShQLCBEKSB7XG4gIHJldHVybiAkT2JqZWN0LmNyZWF0ZShQLCBEKTtcbn07XG5cblxuXG4vLy8vLy8vLy8vLy8vLy8vLy9cbi8vIFdFQlBBQ0sgRk9PVEVSXG4vLyAuL25vZGVfbW9kdWxlcy9jb3JlLWpzL2xpYnJhcnkvZm4vb2JqZWN0L2NyZWF0ZS5qc1xuLy8gbW9kdWxlIGlkID0gODZcbi8vIG1vZHVsZSBjaHVua3MgPSAwIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///86\n")},function(module,exports,__webpack_require__){eval("var $export = __webpack_require__(5);\n// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])\n$export($export.S, 'Object', { create: __webpack_require__(21) });\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiODcuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvY29yZS1qcy9saWJyYXJ5L21vZHVsZXMvZXM2Lm9iamVjdC5jcmVhdGUuanM/YjA1ZiJdLCJzb3VyY2VzQ29udGVudCI6WyJ2YXIgJGV4cG9ydCA9IHJlcXVpcmUoJy4vX2V4cG9ydCcpO1xuLy8gMTkuMS4yLjIgLyAxNS4yLjMuNSBPYmplY3QuY3JlYXRlKE8gWywgUHJvcGVydGllc10pXG4kZXhwb3J0KCRleHBvcnQuUywgJ09iamVjdCcsIHsgY3JlYXRlOiByZXF1aXJlKCcuL19vYmplY3QtY3JlYXRlJykgfSk7XG5cblxuXG4vLy8vLy8vLy8vLy8vLy8vLy9cbi8vIFdFQlBBQ0sgRk9PVEVSXG4vLyAuL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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * WPGlobus Administration
3
+ * Interface JS functions
4
+ *
5
+ * @since 1.9.17
6
+ * @since 2.2.3
7
+ *
8
+ * @package WPGlobus
9
+ * @subpackage Administration/Gutenberg
10
+ */
11
+ /*jslint browser: true */
12
+ /*global jQuery, console, _wpGutenbergCodeEditorSettings*/
13
+
14
+ jQuery(document).ready(function ($) {
15
+ "use strict";
16
+
17
+ var api = {
18
+ counter: 0,
19
+ noticeOn: false,
20
+ initDone: false,
21
+ languageSelectorBoxDelta: 0,
22
+ oldLanguageSelector: false,
23
+ languageSelectorEnabled: true,
24
+ parseBool: function(b) {
25
+ return !(/^(false|0)$/i).test(b) && !!b;
26
+ },
27
+ getCounter: function(alias) {
28
+ return api.counter;
29
+ },
30
+ getOptionKey: function(alias) {
31
+ alias = alias || '';
32
+ return WPGlobusGutenberg.keyOption[alias];
33
+ },
34
+ getOptions: function() {
35
+ return WPGlobusGutenberg.options;
36
+ },
37
+ isOldLanguageSelector: function() {
38
+ return api.oldLanguageSelector;
39
+ },
40
+ isPostDisabled: function() {
41
+ return WPGlobusGutenberg.__post.disabled;
42
+ },
43
+ isEnabledTab: function(tab) {
44
+ if ( 'undefined' === typeof tab ) {
45
+ tab = 'options';
46
+ }
47
+ var enabled = false;
48
+ if ( 'options' == tab ) {
49
+ if ( api.parseBool(WPGlobusGutenberg.enabledOptionsTab) ) {
50
+ enabled = true;
51
+ }
52
+ }
53
+ return enabled;
54
+ },
55
+ init: function() {
56
+ WPGlobusGutenberg.yoastSeo = api.parseBool(WPGlobusGutenberg.yoastSeo);
57
+ if ( api.isPostDisabled() ) {
58
+ return;
59
+ }
60
+ api.initListeners();
61
+ api.setTabs();
62
+ api.formHandler();
63
+ api.attachListeners();
64
+ },
65
+ initListeners: function() {
66
+ if ( WPGlobusGutenberg.yoastSeo && 1 == $('.yoast.wpseo-metabox').length ) {
67
+ /**
68
+ * Prevent start of alert message when yoast seo is present.
69
+ * Check getEventListeners(window).beforeunload in Chrome console for beforeunload event.
70
+ * @see https://developers.google.com/web/tools/chrome-devtools/console/command-line-reference#monitoreventsobject-events
71
+ */
72
+ $(window).on('beforeunload', function (event) {
73
+ event.stopImmediatePropagation()
74
+ });
75
+ }
76
+ },
77
+ formHandler: function() {
78
+
79
+ var val = $('.metabox-base-form #referredby').attr('value');
80
+ if ( 'undefined' !== typeof val ) {
81
+ if( val.indexOf('language=en') == -1 ) {
82
+ val = val+'&language='+WPGlobusGutenberg.language;
83
+ } else {
84
+ val = val.replace('language=en', 'language='+WPGlobusGutenberg.language);
85
+ }
86
+ $('.metabox-base-form #referredby').attr('value', val);
87
+ }
88
+
89
+ val = $('input[name="_wp_original_http_referer"]').attr('value');
90
+ if ( 'undefined' !== typeof val ) {
91
+ if( val.indexOf('language=en') == -1 ) {
92
+ val = val+'&language='+WPGlobusGutenberg.language;
93
+ } else {
94
+ val = val.replace('language=en', 'language='+WPGlobusGutenberg.language);
95
+ }
96
+ $('input[name="_wp_original_http_referer"]').attr('value', val);
97
+ }
98
+ },
99
+ setTabs: function() {
100
+ if ( WPGlobusGutenberg.tabs.length == 0 ) {
101
+ api.WPGlobusSwitcherPlugin();
102
+ return;
103
+ }
104
+ api.oldLanguageSelector = true;
105
+ var intervalID = setInterval( function() {
106
+ /** var $toolbar = $('.edit-post-header'); **/
107
+ var $toolbar = $('.edit-post-header__settings');
108
+ if( $toolbar.length == 1 ) {
109
+ $toolbar.before(WPGlobusGutenberg.tabs);
110
+ /*
111
+ var width = $('.edit-post-header-toolbar').css('width');
112
+ width = width.replace('px','') * 1;
113
+ if ( width < 50 ) {
114
+ width = width + 5;
115
+ } else {
116
+ width = width + 30;
117
+ }
118
+ $('.wpglobus-gutenberg-selector-box').css({'margin-left':width+'px'});
119
+ // */
120
+ clearInterval(intervalID)
121
+ } else {
122
+ //console.log('Here: else');
123
+ }
124
+ }, 200);
125
+ },
126
+ setSelectorStatus: function() {
127
+ if ( ! api.isOldLanguageSelector() ) {
128
+ return;
129
+ }
130
+ $('.wpglobus-gutenberg-selector-box').css({'opacity':'0.2'}).attr('onclick','return false;');
131
+ api.languageSelectorEnabled = false;
132
+ var iID = setInterval( function() {
133
+ if ( $('.is-saving').length == 0 ) {
134
+ clearInterval(iID);
135
+ if ( WPGlobusGutenberg.pagenow == WPGlobusGutenberg.postNewPage ) {
136
+ if ( location.pathname.indexOf(WPGlobusGutenberg.postEditPage) != -1 ) {
137
+ WPGlobusGutenberg.pagenow = WPGlobusGutenberg.postEditPage;
138
+ $('.wpglobus-gutenberg-selector-box').css({'opacity':'1'}).attr('onclick','');
139
+ api.reloadPage();
140
+ return;
141
+ }
142
+ }
143
+ api.languageSelectorEnabled = true;
144
+ $('.wpglobus-gutenberg-selector-box').css({'opacity':'1'}).attr('onclick','');
145
+ }
146
+ }, 400);
147
+ },
148
+ reloadPage: function() {
149
+ $('.wpglobus-selector-grid').css({'grid-template-columns':'10% 90%'});
150
+ $('.wpglobus-gutenberg-selector-text').text(WPGlobusGutenberg.i18n.reload);
151
+ (function blink() {
152
+ $('.wpglobus-gutenberg-selector').fadeOut(500).fadeIn(500, blink);
153
+ })();
154
+ setTimeout( function() {
155
+ location.reload();
156
+ }, 500);
157
+ },
158
+ attachListeners: function() {
159
+ if ( ! api.isOldLanguageSelector() ) {
160
+ return;
161
+ }
162
+ /**
163
+ * Language selector.
164
+ */
165
+ $(document).on('mouseenter', '.wpglobus-gutenberg-selector', function(ev) {
166
+ if ( ! api.languageSelectorEnabled ) {
167
+ return;
168
+ }
169
+ $('.wpglobus-gutenberg-selector-dropdown').css({'display':'block'});
170
+ api.languageSelectorBoxDelta = ev.screenY;
171
+ $('.edit-post-header').css({'z-index':'100000'});
172
+ $('.wpglobus-gutenberg-selector-box').css({'z-index':'100001'});
173
+ });
174
+ $(document).on('mouseleave', '.wpglobus-gutenberg-selector', function(ev) {
175
+ if ( api.languageSelectorBoxDelta != 0 && ev.screenY - api.languageSelectorBoxDelta <= 0) {
176
+ $('.wpglobus-gutenberg-selector-dropdown').css({'display':'none'});
177
+ $('.edit-post-header').css({'z-index':'9989'});
178
+ $('.wpglobus-gutenberg-selector-box').css({'z-index':'100'});
179
+ }
180
+ });
181
+
182
+ /**
183
+ * Dropdown list.
184
+ */
185
+ $(document).on('mouseleave', '.wpglobus-gutenberg-selector-dropdown', function(ev) {
186
+ $('.wpglobus-gutenberg-selector-dropdown').css({'display':'none'});
187
+ $('.edit-post-header').css({'z-index':'9989'});
188
+ $('.wpglobus-gutenberg-selector-box').css({'z-index':'10000'});
189
+ });
190
+
191
+ /**
192
+ * editor-post-save-draft.
193
+ */
194
+ $(document).on('click', '.editor-post-save-draft', function() {
195
+ api.setSelectorStatus();
196
+ });
197
+
198
+ /**
199
+ * editor-post-publish-button.
200
+ */
201
+ $(document).on('click', '.editor-post-publish-button', function() {
202
+ api.setSelectorStatus();
203
+ });
204
+
205
+ },
206
+ WPGlobusSwitcherPlugin: function(){
207
+ // @since 2.2.3
208
+ // @since 2.2.14
209
+
210
+ if ( 'undefined' === typeof wp.editPost || 'undefined' === typeof wp.plugins ) {
211
+ // @since 2.2.15
212
+ return;
213
+ }
214
+ var language = WPGlobusGutenberg.language;
215
+ var enabledLanguages = WPGlobusCoreData.enabled_languages;
216
+ var languageNames = WPGlobusCoreData.en_language_name;
217
+ var flagsUrl = WPGlobusGutenberg.flags_url;
218
+ var switcherButtonTitle = 'WPGlobus Switcher';
219
+ var ref = location.href;
220
+ var refs = {};
221
+ for (var key in enabledLanguages) {
222
+ if ( -1 == ref.indexOf('language='+language) ) {
223
+ refs[enabledLanguages[key]] = ref + '&language='+enabledLanguages[key];
224
+ } else {
225
+ refs[enabledLanguages[key]] = ref.replace( 'language='+language, 'language='+enabledLanguages[key] );
226
+ }
227
+ }
228
+
229
+ var __ = wp.i18n.__;
230
+ var el = wp.element.createElement;
231
+ var Fragment = wp.element.Fragment;
232
+
233
+ var TabPanel = wp.components.TabPanel;
234
+ var withState = wp.compose.withState;
235
+ var RadioControl = wp.components.RadioControl;
236
+ var Notice = wp.components.Notice;
237
+ var Button = wp.components.Button;
238
+
239
+ var PluginSidebarMoreMenuItem = wp.editPost.PluginSidebarMoreMenuItem;
240
+ var PanelBody = wp.components.PanelBody;
241
+ var PluginSidebar = wp.editPost.PluginSidebar;
242
+ var registerPlugin = wp.plugins.registerPlugin;
243
+
244
+ var pluginStarButton = $('.components-panel__header.edit-post-sidebar-header button.components-icon-button').eq(0);
245
+
246
+ var switcherButtonHTML = {
247
+ flagOnly: '<img height="20px" width="20px" src="'+WPGlobusGutenberg.flags_url[WPGlobusGutenberg.language]+'" />',
248
+ flagLanguage: '<img height="20px" width="20px" src="'+WPGlobusGutenberg.flags_url[WPGlobusGutenberg.language]+'" />&nbsp;' + WPGlobusAdmin.data.en_language_name[WPGlobusGutenberg.language],
249
+ flagCode: '<img height="20px" width="20px" src="'+WPGlobusGutenberg.flags_url[WPGlobusGutenberg.language]+'" />&nbsp;' + WPGlobusGutenberg.language,
250
+ languageOnly: '&nbsp;' + WPGlobusAdmin.data.en_language_name[WPGlobusGutenberg.language],
251
+ languageCode: '&nbsp;' + WPGlobusGutenberg.language,
252
+ };
253
+
254
+ var switcherPluginButtonType = '';
255
+ var promisedPluginButtonType = '';
256
+ var optionSwitcherButtonType = api.getOptionKey('switcherButtonType');
257
+
258
+ function setSwitcherButtonType(type) {
259
+ type = type || 'flagLanguage';
260
+ switcherPluginButtonType = type;
261
+ }
262
+
263
+ function getSwitcherButtonType() {
264
+ return switcherPluginButtonType;
265
+ }
266
+
267
+ function getSwitcherButtonTitle() {
268
+ return switcherButtonTitle;
269
+ }
270
+
271
+ setSwitcherButtonType(WPGlobusGutenberg.options[optionSwitcherButtonType]);
272
+
273
+ promisedPluginButtonType = getSwitcherButtonType();
274
+
275
+ $(document).on('click', pluginStarButton, function(){
276
+ setSwitcherPluginButton();
277
+ });
278
+
279
+ function rbAnimate(start) {
280
+ if ( 'undefined' === typeof start ) {
281
+ start = true;
282
+ }
283
+ var elems = document.querySelectorAll('.wpglobus-switcher-components-radio-control .components-radio-control__input');
284
+ if ( elems.length == 0 ) {
285
+ return;
286
+ }
287
+ if ( start ) {
288
+ elems.forEach(function(elem) {
289
+ elem.classList.add(elem.value);
290
+ elem.classList.remove('wpglobus-switcher-pulsate-radio');
291
+ elem.classList.add('wpglobus-switcher-pulsate-radio-off');
292
+ });
293
+ var elem = document.querySelector('.wpglobus-switcher-components-radio-control .'+promisedPluginButtonType);
294
+ elem.classList.remove('wpglobus-switcher-pulsate-radio-off');
295
+ elem.classList.add('wpglobus-switcher-pulsate-radio');
296
+ } else {
297
+ elems.forEach(function(elem) {
298
+ elem.classList.remove('wpglobus-switcher-pulsate-radio');
299
+ elem.classList.remove('wpglobus-switcher-pulsate-radio-off');
300
+ elem.classList.add('wpglobus-switcher-pulsate-radio-on');
301
+ });
302
+ }
303
+ }
304
+ function notice(el, mess) {
305
+ if ( 'undefined' === typeof el || api.noticeOn ) {
306
+ return;
307
+ }
308
+ api.noticeOn = true;
309
+ el.innerText = mess;
310
+ el.classList.remove('hidden');
311
+ setTimeout(function() {
312
+ el.classList.add('hidden');
313
+ api.noticeOn = false;
314
+ }, 3000);
315
+ }
316
+
317
+ function setOption(option, value) {
318
+ option = option || '';
319
+ value = value || '';
320
+ if ( optionSwitcherButtonType == option ) {
321
+ rbAnimate(true);
322
+ saveOptions(option, value).then(function(response){
323
+ if ('success' == response.result) {
324
+ setSwitcherButtonType(value);
325
+ WPGlobusGutenberg.options[optionSwitcherButtonType] = value;
326
+ setSwitcherPluginButton(value);
327
+ }
328
+ })
329
+ .fail( function(response) {
330
+ var el = document.getElementsByClassName('wpglobus-switcher-error-message');
331
+ if ('undefined' !== typeof el[0]) {
332
+ if ('error' == response.result) {
333
+ notice(el[0], response.message);
334
+ } else if (response.status == 400) {
335
+ notice(el[0], 'Error: '+response.status + ' (' + response.statusText + ')' );
336
+ }
337
+ promisedPluginButtonType = getSwitcherButtonType();
338
+ }
339
+ var tab = document.getElementsByClassName('wpglobus-panel-tab-options');
340
+ if ('undefined' !== typeof tab[0]) {
341
+ if ( -1 != tab[0].classList.value.indexOf('is-active') ) {
342
+ tab[0].click();
343
+ }
344
+ }
345
+ })
346
+ .always(function() {
347
+ rbAnimate(false);
348
+ });
349
+ }
350
+ }
351
+
352
+ function saveOptions(option, value) {
353
+ option = option || '';
354
+ if ( option == '' ) {
355
+ return;
356
+ }
357
+ var data = {};
358
+ data['sender'] = 'WPGlobusGutenberg';
359
+ data['_action'] = 'saveOption';
360
+ data['is_admin'] = 1;
361
+ data['counter'] = api.counter++;
362
+ data['options'] = {};
363
+ data['options'][option] = value;
364
+ return wp.ajax.post(WPGlobusGutenberg.wpglobusAjax, {data:data});
365
+ }
366
+
367
+ function getSwitcherButton(type) {
368
+ if ( 'undefined' === typeof switcherButtonHTML[type] ) {
369
+ type = switcherPluginButtonType;
370
+ }
371
+ return switcherButtonHTML[type];
372
+ }
373
+
374
+ function setSwitcherPluginButton(type) {
375
+ if ( 'undefined' === typeof type || 'undefined' === typeof switcherButtonHTML[type] ) {
376
+ type = switcherPluginButtonType;
377
+ }
378
+
379
+ setTimeout(function() {
380
+ var button = document.querySelector('[aria-label="'+getSwitcherButtonTitle()+'"]');
381
+ if ( 'undefined' === typeof button || null === button ) {
382
+ return;
383
+ }
384
+ var status = button.dataset.status;
385
+ if ( 'undefined' === typeof status ) {
386
+ var content = button.innerHTML;
387
+ button.innerHTML = content + getSwitcherButton(type);
388
+ button.dataset.status = 'init';
389
+ } else {
390
+ button.innerHTML = getSwitcherButton(type);
391
+ button.dataset.status = 'changed';
392
+ }
393
+ }, 300);
394
+ }
395
+
396
+ function languageList() {
397
+
398
+ if ( WPGlobusGutenberg.pagenow == WPGlobusGutenberg.postNewPage ) {
399
+ return el(
400
+ 'div',
401
+ {style:{marginBottom:'20px'},className: "wpglobus-switcher-panel__switcher-notice"},
402
+ WPGlobusGutenberg.i18n.save_post
403
+ );
404
+ }
405
+
406
+ return el(
407
+ 'ul',
408
+ {className: 'language-list'},
409
+ enabledLanguages.map(
410
+ function(lang){
411
+ return el( 'li', {key:lang, className:'language-item'},
412
+ el('img', {style:{marginRight:'7px'},className:'wpglobus-switcher-panel__flag', height:'20px', width:'20px', src:flagsUrl[lang]}),
413
+ el(Button, {href:refs[lang], isSmall:true, isPrimary:true}, languageNames[lang])
414
+ );
415
+ }
416
+ )
417
+ );
418
+ }
419
+
420
+ function onTabSelect(tab) {
421
+ if ( tab.name == 'switcher' ) {
422
+ return SwitcherTabContent();
423
+ } else if ( tab.name == 'options' ) {
424
+ return OptionsTabContent();
425
+ }
426
+ }
427
+
428
+ function TabLayout() {
429
+
430
+ var tabs = [
431
+ {
432
+ name: 'switcher',
433
+ title: 'Languages',
434
+ className: 'wpglobus-panel-tab wpglobus-panel-tab-selector edit-post-sidebar__panel-tab'
435
+ }
436
+ ];
437
+
438
+ if ( WPGlobusGutenberg.isEnabledTab('options') ) {
439
+ tabs.push(
440
+ {
441
+ name: 'options',
442
+ title: 'Options',
443
+ className: 'wpglobus-panel-tab wpglobus-panel-tab-options edit-post-sidebar__panel-tab'
444
+ }
445
+ );
446
+ }
447
+
448
+ return el(
449
+ TabPanel,
450
+ {
451
+ name: 'WPGlobusSwitcherTabPanel',
452
+ className: 'wpglobus-tab-panel',
453
+ activeClass: 'is-active',
454
+ tabs: tabs
455
+ },
456
+ onTabSelect
457
+ );
458
+ }
459
+
460
+ function SwitcherTabContent() {
461
+ return el(
462
+ 'div',
463
+ {
464
+ className: 'wpglobus-tab-content wpglobus-selector-tab-content',
465
+ },
466
+ el(
467
+ Notice,
468
+ {
469
+ className: 'wpglobus-switcher-panel__notice',
470
+ status: 'informational',
471
+ isDismissible: false
472
+ },
473
+ __( 'Select language' )
474
+ ),
475
+ el(
476
+ 'div',
477
+ {
478
+ className: 'wpglobus-switcher-panel__switcher-box'
479
+ },
480
+ languageList()
481
+ ),
482
+ el(
483
+ Button,
484
+ {
485
+ className: 'wpglobus-switcher-panel__button-link wpglobus-switcher-panel__info',
486
+ href: WPGlobusGutenberg.store_link,
487
+ isLink: true,
488
+ target: "_blank"
489
+ },
490
+ __( 'WPGlobus Premium Add-ons' )
491
+ ),
492
+ el(
493
+ Button,
494
+ {
495
+ className: 'wpglobus-switcher-panel__button-link wpglobus-switcher-panel__settings-link',
496
+ href: WPGlobusGutenberg.block_editor_tab_url,
497
+ isLink: true
498
+ },
499
+ __( 'Settings' )
500
+ )
501
+ );
502
+ }
503
+
504
+ var SwitcherPluginButton = withState({
505
+ value: promisedPluginButtonType
506
+ })(({
507
+ value,
508
+ setState
509
+ }) => el(RadioControl, {
510
+ label: '',
511
+ help: 'Select type of switcher language button.',
512
+ selected: promisedPluginButtonType,
513
+ className: 'wpglobus-switcher-components-radio-control',
514
+ options: [
515
+ { label: 'Flag only', value: 'flagOnly' },
516
+ { label: 'Flag with language', value: 'flagLanguage' },
517
+ { label: 'Flag with language code', value: 'flagCode' },
518
+ { label: 'Language only', value: 'languageOnly' },
519
+ { label: 'Language code', value: 'languageCode' },
520
+ ],
521
+ onChange: value => {
522
+ promisedPluginButtonType = value;
523
+ setState({
524
+ value
525
+ });
526
+ // @see setOption function for setSwitcherButtonType(value) and setSwitcherPluginButton(value)
527
+ setOption(optionSwitcherButtonType, value);
528
+ }
529
+ }));
530
+
531
+ function OptionsTabContent() {
532
+ return el(
533
+ 'div',
534
+ {
535
+ className: 'wpglobus-tab-content wpglobus-options-tab-content',
536
+ },
537
+ el(
538
+ Notice,
539
+ {
540
+ className: 'wpglobus-switcher-panel__notice',
541
+ status: 'informational',
542
+ isDismissible: false
543
+ },
544
+ __( 'Select type' )
545
+ ),
546
+ el(
547
+ SwitcherPluginButton,
548
+ null
549
+ )
550
+ );
551
+ }
552
+
553
+ function Component() {
554
+ setSwitcherPluginButton();
555
+ return el(
556
+ Fragment,
557
+ {},
558
+ el(
559
+ PluginSidebarMoreMenuItem,
560
+ {
561
+ target: 'wpglobus-switcher-sidebar',
562
+ icon: 'admin-site',
563
+ //onClick: @see wp-includes\js\dist\edit-post.js
564
+ },
565
+ __( 'WPGlobus' )
566
+ ),
567
+ el(
568
+ PluginSidebar,
569
+ {
570
+ name: 'wpglobus-switcher-sidebar',
571
+ title: getSwitcherButtonTitle(),
572
+ className: 'wpglobus-switcher-components-panel',
573
+ //togglePin: @see wp-includes\js\dist\edit-post.js
574
+ },
575
+ el(
576
+ 'div',
577
+ {
578
+ className: 'wpglobus-switcher-message wpglobus-switcher-error-message hidden',
579
+ style:{}
580
+ },
581
+ ''
582
+ ),
583
+ el(
584
+ PanelBody,
585
+ {
586
+ className: 'wpglobus-switcher-panel__body'
587
+ },
588
+ TabLayout()
589
+ )
590
+
591
+ )
592
+ );
593
+ }
594
+ registerPlugin( 'wpglobus-switcher', {
595
+ icon: '',
596
+ render: Component,
597
+ } );
598
+ }
599
+ }
600
+ WPGlobusGutenberg = $.extend({}, WPGlobusGutenberg, api);
601
+ WPGlobusGutenberg.init();
602
+ });
trunk/includes/builders/gutenberg/assets/js/wpglobus-gutenberg.min.js ADDED
@@ -0,0 +1 @@
 
1
+ "use strict";jQuery(document).ready(function(D){var I={counter:0,noticeOn:!1,initDone:!1,languageSelectorBoxDelta:0,oldLanguageSelector:!1,languageSelectorEnabled:!0,parseBool:function(e){return!/^(false|0)$/i.test(e)&&!!e},getCounter:function(){return I.counter},getOptionKey:function(e){return e=e||"",WPGlobusGutenberg.keyOption[e]},getOptions:function(){return WPGlobusGutenberg.options},isOldLanguageSelector:function(){return I.oldLanguageSelector},isPostDisabled:function(){return WPGlobusGutenberg.__post.disabled},isEnabledTab:function(e){void 0===e&&(e="options");var t=!1;return"options"==e&&I.parseBool(WPGlobusGutenberg.enabledOptionsTab)&&(t=!0),t},init:function(){WPGlobusGutenberg.yoastSeo=I.parseBool(WPGlobusGutenberg.yoastSeo),I.isPostDisabled()||(I.initListeners(),I.setTabs(),I.formHandler(),I.attachListeners())},initListeners:function(){WPGlobusGutenberg.yoastSeo&&1==D(".yoast.wpseo-metabox").length&&D(window).on("beforeunload",function(e){e.stopImmediatePropagation()})},formHandler:function(){var e=D(".metabox-base-form #referredby").attr("value");void 0!==e&&(e=-1==e.indexOf("language=en")?e+"&language="+WPGlobusGutenberg.language:e.replace("language=en","language="+WPGlobusGutenberg.language),D(".metabox-base-form #referredby").attr("value",e)),void 0!==(e=D('input[name="_wp_original_http_referer"]').attr("value"))&&(e=-1==e.indexOf("language=en")?e+"&language="+WPGlobusGutenberg.language:e.replace("language=en","language="+WPGlobusGutenberg.language),D('input[name="_wp_original_http_referer"]').attr("value",e))},setTabs:function(){if(0!=WPGlobusGutenberg.tabs.length){I.oldLanguageSelector=!0;var t=setInterval(function(){var e=D(".edit-post-header__settings");1==e.length&&(e.before(WPGlobusGutenberg.tabs),clearInterval(t))},200)}else I.WPGlobusSwitcherPlugin()},setSelectorStatus:function(){if(I.isOldLanguageSelector()){D(".wpglobus-gutenberg-selector-box").css({opacity:"0.2"}).attr("onclick","return false;"),I.languageSelectorEnabled=!1;var e=setInterval(function(){if(0==D(".is-saving").length){if(clearInterval(e),WPGlobusGutenberg.pagenow==WPGlobusGutenberg.postNewPage&&-1!=location.pathname.indexOf(WPGlobusGutenberg.postEditPage))return WPGlobusGutenberg.pagenow=WPGlobusGutenberg.postEditPage,D(".wpglobus-gutenberg-selector-box").css({opacity:"1"}).attr("onclick",""),void I.reloadPage();I.languageSelectorEnabled=!0,D(".wpglobus-gutenberg-selector-box").css({opacity:"1"}).attr("onclick","")}},400)}},reloadPage:function(){D(".wpglobus-selector-grid").css({"grid-template-columns":"10% 90%"}),D(".wpglobus-gutenberg-selector-text").text(WPGlobusGutenberg.i18n.reload),function e(){D(".wpglobus-gutenberg-selector").fadeOut(500).fadeIn(500,e)}(),setTimeout(function(){location.reload()},500)},attachListeners:function(){I.isOldLanguageSelector()&&(D(document).on("mouseenter",".wpglobus-gutenberg-selector",function(e){I.languageSelectorEnabled&&(D(".wpglobus-gutenberg-selector-dropdown").css({display:"block"}),I.languageSelectorBoxDelta=e.screenY,D(".edit-post-header").css({"z-index":"100000"}),D(".wpglobus-gutenberg-selector-box").css({"z-index":"100001"}))}),D(document).on("mouseleave",".wpglobus-gutenberg-selector",function(e){0!=I.languageSelectorBoxDelta&&e.screenY-I.languageSelectorBoxDelta<=0&&(D(".wpglobus-gutenberg-selector-dropdown").css({display:"none"}),D(".edit-post-header").css({"z-index":"9989"}),D(".wpglobus-gutenberg-selector-box").css({"z-index":"100"}))}),D(document).on("mouseleave",".wpglobus-gutenberg-selector-dropdown",function(e){D(".wpglobus-gutenberg-selector-dropdown").css({display:"none"}),D(".edit-post-header").css({"z-index":"9989"}),D(".wpglobus-gutenberg-selector-box").css({"z-index":"10000"})}),D(document).on("click",".editor-post-save-draft",function(){I.setSelectorStatus()}),D(document).on("click",".editor-post-publish-button",function(){I.setSelectorStatus()}))},WPGlobusSwitcherPlugin:function(){if(void 0!==wp.editPost&&void 0!==wp.plugins){var e=WPGlobusGutenberg.language,t=WPGlobusCoreData.enabled_languages,n=WPGlobusCoreData.en_language_name,o=WPGlobusGutenberg.flags_url,a="WPGlobus Switcher",s=location.href,l={};for(var u in t)-1==s.indexOf("language="+e)?l[t[u]]=s+"&language="+t[u]:l[t[u]]=s.replace("language="+e,"language="+t[u]);var i=wp.i18n.__,r=wp.element.createElement,g=wp.element.Fragment,c=wp.components.TabPanel,b=wp.compose.withState,p=wp.components.RadioControl,d=wp.components.Notice,w=wp.components.Button,m=wp.editPost.PluginSidebarMoreMenuItem,f=wp.components.PanelBody,G=wp.editPost.PluginSidebar,h=wp.plugins.registerPlugin,P=D(".components-panel__header.edit-post-sidebar-header button.components-icon-button").eq(0),v={flagOnly:'<img height="20px" width="20px" src="'+WPGlobusGutenberg.flags_url[WPGlobusGutenberg.language]+'" />',flagLanguage:'<img height="20px" width="20px" src="'+WPGlobusGutenberg.flags_url[WPGlobusGutenberg.language]+'" />&nbsp;'+WPGlobusAdmin.data.en_language_name[WPGlobusGutenberg.language],flagCode:'<img height="20px" width="20px" src="'+WPGlobusGutenberg.flags_url[WPGlobusGutenberg.language]+'" />&nbsp;'+WPGlobusGutenberg.language,languageOnly:"&nbsp;"+WPGlobusAdmin.data.en_language_name[WPGlobusGutenberg.language],languageCode:"&nbsp;"+WPGlobusGutenberg.language},_="",W="",x=I.getOptionKey("switcherButtonType");S(WPGlobusGutenberg.options[x]),W=L(),D(document).on("click",P,function(){B()});var y=b({value:W})(function(e){e.value;var t=e.setState;return r(p,{label:"",help:"Select type of switcher language button.",selected:W,className:"wpglobus-switcher-components-radio-control",options:[{label:"Flag only",value:"flagOnly"},{label:"Flag with language",value:"flagLanguage"},{label:"Flag with language code",value:"flagCode"},{label:"Language only",value:"languageOnly"},{label:"Language code",value:"languageCode"}],onChange:function(e){t({value:W=e}),T(x,e)}})});h("wpglobus-switcher",{icon:"",render:function(){return B(),r(g,{},r(m,{target:"wpglobus-switcher-sidebar",icon:"admin-site"},i("WPGlobus")),r(G,{name:"wpglobus-switcher-sidebar",title:O(),className:"wpglobus-switcher-components-panel"},r("div",{className:"wpglobus-switcher-message wpglobus-switcher-error-message hidden",style:{}},""),r(f,{className:"wpglobus-switcher-panel__body"},(e=[{name:"switcher",title:"Languages",className:"wpglobus-panel-tab wpglobus-panel-tab-selector edit-post-sidebar__panel-tab"}],WPGlobusGutenberg.isEnabledTab("options")&&e.push({name:"options",title:"Options",className:"wpglobus-panel-tab wpglobus-panel-tab-options edit-post-sidebar__panel-tab"}),r(c,{name:"WPGlobusSwitcherTabPanel",className:"wpglobus-tab-panel",activeClass:"is-active",tabs:e},C)))));var e}})}function S(e){_=e=e||"flagLanguage"}function L(){return _}function O(){return a}function N(e){void 0===e&&(e=!0);var t=document.querySelectorAll(".wpglobus-switcher-components-radio-control .components-radio-control__input");if(0!=t.length)if(e){t.forEach(function(e){e.classList.add(e.value),e.classList.remove("wpglobus-switcher-pulsate-radio"),e.classList.add("wpglobus-switcher-pulsate-radio-off")});var n=document.querySelector(".wpglobus-switcher-components-radio-control ."+W);n.classList.remove("wpglobus-switcher-pulsate-radio-off"),n.classList.add("wpglobus-switcher-pulsate-radio")}else t.forEach(function(e){e.classList.remove("wpglobus-switcher-pulsate-radio"),e.classList.remove("wpglobus-switcher-pulsate-radio-off"),e.classList.add("wpglobus-switcher-pulsate-radio-on")})}function k(e,t){void 0===e||I.noticeOn||(I.noticeOn=!0,e.innerText=t,e.classList.remove("hidden"),setTimeout(function(){e.classList.add("hidden"),I.noticeOn=!1},3e3))}function T(e,t){t=t||"",x==(e=e||"")&&(N(!0),function(e,t){if(""==(e=e||""))return;var n={sender:"WPGlobusGutenberg",_action:"saveOption",is_admin:1};return n.counter=I.counter++,n.options={},n.options[e]=t,wp.ajax.post(WPGlobusGutenberg.wpglobusAjax,{data:n})}(e,t).then(function(e){"success"==e.result&&(S(t),B(WPGlobusGutenberg.options[x]=t))}).fail(function(e){var t=document.getElementsByClassName("wpglobus-switcher-error-message");void 0!==t[0]&&("error"==e.result?k(t[0],e.message):400==e.status&&k(t[0],"Error: "+e.status+" ("+e.statusText+")"),W=L());var n=document.getElementsByClassName("wpglobus-panel-tab-options");void 0!==n[0]&&-1!=n[0].classList.value.indexOf("is-active")&&n[0].click()}).always(function(){N(!1)}))}function E(e){return void 0===v[e]&&(e=_),v[e]}function B(n){void 0!==n&&void 0!==v[n]||(n=_),setTimeout(function(){var e=document.querySelector('[aria-label="'+O()+'"]');if(null!=e)if(void 0===e.dataset.status){var t=e.innerHTML;e.innerHTML=t+E(n),e.dataset.status="init"}else e.innerHTML=E(n),e.dataset.status="changed"},300)}function C(e){return"switcher"==e.name?r("div",{className:"wpglobus-tab-content wpglobus-selector-tab-content"},r(d,{className:"wpglobus-switcher-panel__notice",status:"informational",isDismissible:!1},i("Select language")),r("div",{className:"wpglobus-switcher-panel__switcher-box"},WPGlobusGutenberg.pagenow==WPGlobusGutenberg.postNewPage?r("div",{style:{marginBottom:"20px"},className:"wpglobus-switcher-panel__switcher-notice"},WPGlobusGutenberg.i18n.save_post):r("ul",{className:"language-list"},t.map(function(e){return r("li",{key:e,className:"language-item"},r("img",{style:{marginRight:"7px"},className:"wpglobus-switcher-panel__flag",height:"20px",width:"20px",src:o[e]}),r(w,{href:l[e],isSmall:!0,isPrimary:!0},n[e]))}))),r(w,{className:"wpglobus-switcher-panel__button-link wpglobus-switcher-panel__info",href:WPGlobusGutenberg.store_link,isLink:!0,target:"_blank"},i("WPGlobus Premium Add-ons")),r(w,{className:"wpglobus-switcher-panel__button-link wpglobus-switcher-panel__settings-link",href:WPGlobusGutenberg.block_editor_tab_url,isLink:!0},i("Settings"))):"options"==e.name?r("div",{className:"wpglobus-tab-content wpglobus-options-tab-content"},r(d,{className:"wpglobus-switcher-panel__notice",status:"informational",isDismissible:!1},i("Select type")),r(y,null)):void 0}}};WPGlobusGutenberg=D.extend({},WPGlobusGutenberg,I),WPGlobusGutenberg.init()});
trunk/includes/builders/gutenberg/class-wpglobus-gutenberg-update-post.php ADDED
@@ -0,0 +1,304 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * File: class-wpglobus-gutenberg-update-post.php
4
+ *
5
+ * @package WPGlobus\Builders\Gutenberg
6
+ * @author Alex Gor(alexgff)
7
+ */
8
+
9
+ if ( ! class_exists( 'WPGlobus_Gutenberg_Update_Post' ) ) :
10
+
11
+ /**
12
+ * Class WPGlobus_Gutenberg_Update_Post.
13
+ */
14
+ class WPGlobus_Gutenberg_Update_Post extends WPGlobus_Builder_Update_Post {
15
+
16
+ /** @var string */
17
+ protected $language = null;
18
+
19
+ /** @var WP_Post */
20
+ protected $_prepared_post = null;
21
+
22
+ /**
23
+ * Constructor.
24
+ */
25
+ public function __construct() {
26
+
27
+ parent::__construct( 'gutenberg' );
28
+
29
+ /**
30
+ * @todo to save meta see request ($_REQUEST)
31
+ * post.php?post=259&action=edit&classic-editor=1&meta_box=1
32
+ */
33
+
34
+ //if ( defined('DOING_AJAX') && DOING_AJAX ) {
35
+ //}
36
+
37
+ /**
38
+ * Filter's order:
39
+ * 1. rest_pre_insert_post
40
+ * 2. wp_insert_post_data
41
+ * 3. rest_request_after_callbacks
42
+ */
43
+
44
+ /**
45
+ * @see \WP_REST_Posts_Controller::prepare_item_for_database
46
+ */
47
+ if ( 'core' === WPGlobus::Config()->builder->get( 'context' ) ) {
48
+
49
+ $post_type = WPGlobus::Config()->builder->get( 'post_type' );
50
+ if ( ! empty( $post_type ) ) {
51
+ add_filter( "rest_pre_insert_{$post_type}", array( $this, 'filter__pre_insert_post' ), 2, 2 );
52
+ }
53
+ } else {
54
+
55
+ add_filter( 'rest_pre_insert_post', array( $this, 'filter__pre_insert_post' ), 2, 2 );
56
+ add_filter( 'rest_pre_insert_page', array( $this, 'filter__pre_insert_post' ), 2, 2 );
57
+
58
+ }
59
+
60
+ /**
61
+ * @todo incorrect the saving post in extra languages with priority = 10
62
+ */
63
+ add_filter( 'wp_insert_post_data', array( $this, 'filter__wp_insert_post_data' ), 100, 2 );
64
+
65
+ /**
66
+ * @see \WP_REST_Server::dispatch in \wp-includes\rest-api\class-wp-rest-server.php
67
+ */
68
+ add_filter( 'rest_request_after_callbacks', array( $this, 'filter__rest_after_callbacks' ), 10, 3 );
69
+
70
+ }
71
+
72
+ /**
73
+ * Callback for 'rest_request_after_callbacks' will be fired after 'wp_insert_post_data' filter.
74
+ *
75
+ * @see 'filter__wp_insert_post_data'
76
+ *
77
+ * @param stdClass $response
78
+ * @param array $handler
79
+ * @param mixed $request Unused.
80
+ *
81
+ * @return mixed
82
+ */
83
+ public function filter__rest_after_callbacks(
84
+ $response, $handler, /** @noinspection PhpUnusedParameterInspection */
85
+ $request
86
+ ) {
87
+
88
+ if ( ! empty( $handler['methods']['POST'] ) && ! empty( $handler['methods']['PUT'] ) && ! empty( $handler['methods']['PATCH'] ) ) {
89
+ /**
90
+ * Update post.
91
+ */
92
+
93
+ /**
94
+ * This returns incorrect language
95
+ * $builder_language = get_post_meta($post_id, WPGlobus::Config()->builder->get_language_meta_key(), true);
96
+ *
97
+ * @todo check updating language meta after UPDATE post
98
+ */
99
+ $builder_language = $this->language;
100
+
101
+ // if ( empty( $builder_language ) ) {
102
+ // @todo incorrect case
103
+ // }
104
+
105
+ $fix_title = true;
106
+ if ( ! empty( $response->data['title']['raw'] ) && WPGlobus_Core::has_translations( $response->data['title']['raw'] ) ) {
107
+ $response->data['title']['raw'] = WPGlobus_Core::text_filter( $response->data['title']['raw'], $builder_language, WPGlobus::RETURN_EMPTY );
108
+ $response->data['title']['rendered'] = $response->data['title']['raw'];
109
+ $fix_title = false;
110
+ }
111
+
112
+ // $fix_excerpt = true;
113
+ if ( ! empty( $response->data['excerpt']['raw'] ) && WPGlobus_Core::has_translations( $response->data['excerpt']['raw'] ) ) {
114
+ $excerpt_in_default = WPGlobus_Core::text_filter( $response->data['excerpt']['raw'], WPGlobus::Config()->default_language );
115
+ //$excerpt = WPGlobus_Core::text_filter($response->data['excerpt']['raw'], $builder_language);
116
+ $excerpt = WPGlobus_Core::text_filter( $response->data['excerpt']['raw'], $builder_language, WPGlobus::RETURN_EMPTY );
117
+ $response->data['excerpt']['raw'] = $excerpt;
118
+ $response->data['excerpt']['rendered'] = str_replace( $excerpt_in_default, $excerpt, $response->data['excerpt']['rendered'] );
119
+ // $fix_excerpt = false;
120
+ }
121
+
122
+ if ( WPGlobus::Config()->default_language === $builder_language ) {
123
+ return $response;
124
+ }
125
+
126
+ if ( $fix_title ) :
127
+ /**
128
+ * Fix the title.
129
+ * When we have title with different value:
130
+ * $response->data[title][raw] => Русский заголовок
131
+ * $response->data[title][rendered] => English title
132
+ */
133
+ if ( empty( $response->data['title'] ) ) {
134
+ return $response;
135
+ }
136
+ if ( empty( $response->data['title']['rendered'] ) || empty( $response->data['title']['raw'] ) ) {
137
+ return $response;
138
+ }
139
+
140
+ if ( $response->data['title']['rendered'] !== $response->data['title']['raw'] ) {
141
+ $response->data['title']['rendered'] = $response->data['title']['raw'];
142
+ }
143
+
144
+ endif;
145
+
146
+ }
147
+
148
+ return $response;
149
+ }
150
+
151
+ /**
152
+ * Callback for 'rest_pre_insert_post'.
153
+ *
154
+ * @param WP_Post $prepared_post
155
+ * @param mixed $request Unused.
156
+ *
157
+ * @return mixed
158
+ */
159
+ public function filter__pre_insert_post(
160
+ $prepared_post, /** @noinspection PhpUnusedParameterInspection */
161
+ $request
162
+ ) {
163
+
164
+ global $wpdb;
165
+ $_post = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->posts WHERE ID = %d LIMIT 1", $prepared_post->ID ) );
166
+
167
+ $builder_language = WPGlobus::Config()->builder->get_language();
168
+
169
+ if ( empty( $builder_language ) ) {
170
+ /**
171
+ * @todo Probably we are working with WP Rest API here.
172
+ * Check superglobal variable $_SERVER or may be something other.
173
+ */
174
+ $builder_language = get_post_meta( $prepared_post->ID, WPGlobus::get_language_meta_key(), true );
175
+
176
+ if ( empty( $builder_language ) ) {
177
+ /**
178
+ * Case when post is draft and has post_status 'auto-draft'.
179
+ */
180
+ $builder_language = WPGlobus::Config()->default_language;
181
+ }
182
+ }
183
+
184
+ $this->language = $builder_language;
185
+
186
+ $fields = array();
187
+
188
+ /**
189
+ * Post title.
190
+ */
191
+ if ( ! empty( $prepared_post->post_title ) ) {
192
+ $fields['post_title'] = $prepared_post->post_title;
193
+ // } else {
194
+ //$fields['post_title'] = '';
195
+ }
196
+
197
+ /**
198
+ * Post content.
199
+ */
200
+ if ( ! empty( $prepared_post->post_content ) ) {
201
+ $fields['post_content'] = $prepared_post->post_content;
202
+ } else {
203
+ $fields['post_content'] = '';
204
+ }
205
+
206
+ /**
207
+ * Post excerpt.
208
+ */
209
+ if ( isset( $prepared_post->post_excerpt ) ) {
210
+ if ( empty( $prepared_post->post_excerpt ) ) {
211
+ /**
212
+ * Post excerpt was removed by user.
213
+ */
214
+ $fields['post_excerpt'] = '';
215
+ } else {
216
+ $fields['post_excerpt'] = $prepared_post->post_excerpt;
217
+ }
218
+ } else {
219
+ /**
220
+ * Post excerpt was not modified by user.
221
+ * so, we have unset '$prepared_post->post_excerpt' field.
222
+ */
223
+ $fields['post_excerpt'] = WPGlobus_Core::text_filter( $_post->post_excerpt, $builder_language, WPGlobus::RETURN_EMPTY );
224
+ }
225
+
226
+ foreach ( $fields as $field => $value ) {
227
+
228
+ $tr = array();
229
+
230
+ foreach ( WPGlobus::Config()->enabled_languages as $lang ) :
231
+
232
+ if ( $lang === $builder_language ) {
233
+
234
+ $text = $value;
235
+ if ( WPGlobus_Core::has_translations( $value ) ) {
236
+ $text = WPGlobus_Core::text_filter( $value, $lang, WPGlobus::RETURN_EMPTY );
237
+ }
238
+ if ( ! empty( $text ) ) {
239
+ $tr[ $lang ] = $text;
240
+ }
241
+ } else {
242
+
243
+ $text = WPGlobus_Core::text_filter( $_post->$field, $lang, WPGlobus::RETURN_EMPTY );
244
+ if ( ! empty( $text ) ) {
245
+ $tr[ $lang ] = $text;
246
+ }
247
+ }
248
+
249
+ endforeach;
250
+
251
+ /**
252
+ * @since 2.2.29 we are using `wp_slash` function.
253
+ * @see https://github.com/WPGlobus/WPGlobus/pull/83
254
+ */
255
+ $prepared_post->$field = wp_slash( WPGlobus_Utils::build_multilingual_string( $tr ) );
256
+
257
+ }
258
+
259
+ /**
260
+ * $this->_prepared_post contains 'post_title', 'post_content', 'post_excerpt' with language marks and ready to insert in DB.
261
+ */
262
+ $this->_prepared_post = clone $prepared_post;
263
+
264
+ return $prepared_post;
265
+
266
+ }
267
+
268
+ /**
269
+ * Callback for 'wp_insert_post_data'.
270
+ *
271
+ * @param array $data
272
+ * @param mixed $postarr Unused.
273
+ *
274
+ * @return array
275
+ */
276
+ public function filter__wp_insert_post_data(
277
+ $data, /** @noinspection PhpUnusedParameterInspection */
278
+ $postarr
279
+ ) {
280
+
281
+ /**
282
+ * Check $this->_prepared_post was loaded with first XMLHttpRequest.
283
+ *
284
+ * @see 'filter__pre_insert_post' filter.
285
+ * @see Network tab in browser console.
286
+ */
287
+ if ( ! is_object( $this->_prepared_post ) ) {
288
+ return $data;
289
+ }
290
+
291
+ $_fields = array( 'post_title', 'post_content', 'post_excerpt' );
292
+ foreach ( $_fields as $_field ) {
293
+
294
+ if ( ! empty( $data[ $_field ] ) && ! empty( $this->_prepared_post->$_field ) ) {
295
+ $data[ $_field ] = $this->_prepared_post->$_field;
296
+ }
297
+ }
298
+
299
+ return $data;
300
+ }
301
+
302
+ }
303
+
304
+ endif;
trunk/includes/builders/gutenberg/class-wpglobus-gutenberg.php ADDED
@@ -0,0 +1,554 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * File: class-wpglobus-gutenberg.php
4
+ *
5
+ * @package WPGlobus\Builders\Gutenberg
6
+ * @author Alex Gor(alexgff)
7
+ */
8
+
9
+ /**
10
+ * Class WPGlobus_Gutenberg.
11
+ */
12
+ class WPGlobus_Gutenberg extends WPGlobus_Builder {
13
+
14
+ /**
15
+ * Constructor.
16
+ */
17
+ public function __construct() {
18
+
19
+ parent::__construct( 'gutenberg' );
20
+
21
+ if ( is_admin() ) {
22
+
23
+ /**
24
+ * Filter the post for Gutenberg editor.
25
+ *
26
+ * @see wp-includes\class-wp-query.php
27
+ */
28
+ add_action( 'the_post', array( $this, 'translate_post' ), 5 );
29
+
30
+ /**
31
+ * Add 'wpglobus-language' hidden field.
32
+ */
33
+ add_action( 'add_meta_boxes', array( $this, 'on__add_meta_box' ) );
34
+
35
+ add_action( 'admin_enqueue_scripts', array( $this, 'on__enqueue_scripts' ), 1000 );
36
+
37
+ /**
38
+ * Action admin_print_styles.
39
+ *
40
+ * @since 1.9.29
41
+ */
42
+ add_action( 'admin_print_styles', array( $this, 'on__enqueue_styles' ) );
43
+
44
+ /**
45
+ * Action enqueue_block_assets.
46
+ *
47
+ * @see wp-includes\script-loader.php
48
+ * @since 2.2.3
49
+ */
50
+ add_action( 'enqueue_block_assets', array( $this, 'on__enqueue_block_assets' ) );
51
+
52
+ /**
53
+ * Filter wpglobus_seo_meta_box_title.
54
+ *
55
+ * @see wpglobus-seo\includes\class-wpglobus-seo.php
56
+ */
57
+ add_filter( 'wpglobus_seo_meta_box_title', array( $this, 'filter__seo_meta_box_title' ) );
58
+
59
+ }
60
+
61
+ }
62
+
63
+ /**
64
+ * Enqueue block assets.
65
+ *
66
+ * @since 2.2.3
67
+ */
68
+ public function on__enqueue_block_assets() {
69
+
70
+ if ( ! empty( WPGlobus::Config()->block_editor_old_fashioned_language_switcher ) && '1' === WPGlobus::Config()->block_editor_old_fashioned_language_switcher ) {
71
+ return;
72
+ }
73
+
74
+ /**
75
+ * @since 2.2.3 wpglobus-block-editor.css
76
+ * @since 2.2.14 wpglobus-switcher.css
77
+ */
78
+ $style_file = WPGlobus::plugin_dir_url() . 'includes/builders/gutenberg/assets/css/dist/wpglobus-switcher.css';
79
+
80
+ /**
81
+ * Enqueue frontend and editor block styles.
82
+ */
83
+ wp_enqueue_style(
84
+ 'wpglobus-switcher-css',
85
+ $style_file,
86
+ '',
87
+ WPGLOBUS_VERSION
88
+ );
89
+
90
+ /**
91
+ * Using ESNext syntax @W.I.P.
92
+ *
93
+ * @since 2.2.3 We are using ES5 syntax for WPGlobus plugin for Block Editor.
94
+ */
95
+ return;
96
+
97
+ // phpcs:disable
98
+
99
+ /**
100
+ * Temporarily.
101
+ *
102
+ * @noinspection PhpUnreachableStatementInspection
103
+ */
104
+ $script_file = WPGlobus::plugin_dir_url() . 'includes/builders/gutenberg/assets/js/dist/wpglobus-block-editor' . WPGlobus::SCRIPT_SUFFIX() . '.js';
105
+
106
+ /**
107
+ * Enqueue the bundled block JS file.
108
+ */
109
+ wp_enqueue_script(
110
+ 'wpglobus-block-editor-js',
111
+ $script_file,
112
+ array(
113
+ 'wp-i18n',
114
+ 'wp-blocks',
115
+ 'wp-edit-post',
116
+ 'wp-element',
117
+ 'wp-editor',
118
+ 'wp-components',
119
+ 'wp-data',
120
+ 'wp-plugins',
121
+ 'wp-edit-post',
122
+ 'wp-api',
123
+ ),
124
+ WPGLOBUS_VERSION,
125
+ false
126
+ );
127
+
128
+ /**
129
+ * Enqueue frontend and editor block styles.
130
+ */
131
+ wp_enqueue_style(
132
+ 'wpglobus-block-editor-css',
133
+ $style_file,
134
+ '',
135
+ WPGLOBUS_VERSION
136
+ );
137
+
138
+ // phpcs:enable
139
+
140
+ }
141
+
142
+ /**
143
+ * Translate post.
144
+ *
145
+ * @param WP_Post $object The Post object.
146
+ */
147
+ public function translate_post( $object ) {
148
+ if ( $object instanceof WP_Post ) {
149
+ WPGlobus_Core::translate_wp_post( $object, $this->language, WPGlobus::RETURN_EMPTY );
150
+ }
151
+ }
152
+
153
+ /**
154
+ * Generate box with language switcher.
155
+ *
156
+ * @param string $page The page.
157
+ *
158
+ * @return string
159
+ */
160
+ private function get_switcher_box( $page ) {
161
+
162
+ global $post;
163
+
164
+ // TODO check if $_SERVER['QUERY_STRING'] exists and sanitize it.
165
+ // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized: Detected usage of a non-sanitized input variable: $_SERVER['QUERY_STRING'].
166
+ // phpcs: WordPress.Security.ValidatedSanitizedInput.InputNotValidated: Detected usage of a possibly undefined superglobal array index: $_SERVER['QUERY_STRING']. Use isset() or empty() to check the index exists before using it.
167
+ // phpcs: WordPress.Security.ValidatedSanitizedInput.MissingUnslash: $_SERVER data not unslashed before sanitization. Use wp_unslash() or similar.
168
+ $query_string = explode( '&', $_SERVER['QUERY_STRING'] ); // phpcs:ignore
169
+
170
+ foreach ( $query_string as $key => $_q ) {
171
+ if ( false !== strpos( $_q, 'language=' ) ) {
172
+ unset( $query_string[ $key ] );
173
+ }
174
+ }
175
+ $query = implode( '&', $query_string );
176
+ $url = admin_url(
177
+ add_query_arg(
178
+ array(
179
+ 'language' => '{{language}}',
180
+ ),
181
+ 'post.php?' . $query
182
+ )
183
+ );
184
+
185
+ $_box_style = 'position:absolute;top:15px;left:10px;z-index:100;';
186
+ if ( file_exists( WPGlobus::Config()->flag_path['big'] . WPGlobus::Config()->flag[ $this->language ] ) ) {
187
+ $_flag_img = WPGlobus::Config()->flag_urls['big'] . WPGlobus::Config()->flag[ $this->language ];
188
+ $_height = 'height="25px"';
189
+ $_width = 'width="25px"';
190
+ $_flag_style = 'style="border: 1px solid #bfbfbf;border-radius: 25px;"';
191
+ } else {
192
+ $_flag_img = WPGlobus::Config()->flags_url . WPGlobus::Config()->flag[ $this->language ];
193
+ $_height = '';
194
+ $_width = '';
195
+ $_flag_style = 'style="margin-top:5px;"';
196
+
197
+ $_box_style .= 'margin-top:3px;';
198
+ }
199
+
200
+ $out = '';
201
+
202
+ if ( 'post-new.php' === $page ) {
203
+
204
+ ob_start();
205
+ ?>
206
+ <div style="<?php echo $_box_style; // phpcs:ignore WordPress.Security.EscapeOutput ?>"
207
+ class="wpglobus-gutenberg-selector-box">
208
+ <!--suppress CssInvalidPropertyValue -->
209
+ <div class="wpglobus-selector-grid"
210
+ style="">
211
+ <a style="text-decoration:none;cursor:text;" onclick="return false;"
212
+ href="#" class="wpglobus-gutenberg-selector wpglobus-gutenberg-selector-column-1"
213
+ data-language="<?php echo esc_attr( $this->language ); ?>">
214
+ <img <?php echo $_height . $_width; // phpcs:ignore WordPress.Security.EscapeOutput ?>
215
+ <?php echo $_flag_style; // phpcs:ignore WordPress.Security.EscapeOutput ?>
216
+ src="<?php echo esc_url( $_flag_img ); ?>" alt=""/>
217
+ </a>
218
+ <a style="text-decoration:none;cursor:text;" onclick="return false;"
219
+ href="#" class="wpglobus-gutenberg-selector wpglobus-gutenberg-selector-column-2"
220
+ data-language="<?php echo esc_attr( $this->language ); ?>">
221
+ &nbsp;<span
222
+ class="wpglobus-gutenberg-selector-text"><?php echo esc_html( WPGlobus::Config()->en_language_name[ $this->language ] ); ?></span>
223
+ </a>
224
+ </div>
225
+ <ul class="wpglobus-gutenberg-selector-dropdown"
226
+ style="display:none;position:fixed;margin:5px;list-style-type:none;">
227
+ <li class="item" style="border:1px solid #ddd;background-color:#eee;padding:4px;">
228
+ <?php esc_html_e( 'Before switching the language, please save draft or publish.', 'wpglobus' ); ?>
229
+ </li>
230
+ </ul>
231
+ </div>
232
+ <?php
233
+ $out = ob_get_clean();
234
+
235
+ } elseif ( 'post.php' === $page ) {
236
+
237
+ ob_start();
238
+ ?>
239
+ <div style="<?php echo $_box_style; // phpcs:ignore WordPress.Security.EscapeOutput ?>"
240
+ class="wpglobus-gutenberg-selector-box">
241
+ <!--suppress CssInvalidPropertyValue -->
242
+ <div class="wpglobus-selector-grid"
243
+ style="">
244
+ <a style="text-decoration: none;"
245
+ href="<?php echo esc_url( str_replace( '{{language}}', $this->language, $url ) ); ?>"
246
+ class="wpglobus-gutenberg-selector wpglobus-gutenberg-selector-column-1"
247
+ data-language="<?php echo esc_attr( $this->language ); ?>">
248
+ <img <?php echo $_height . $_width; // phpcs:ignore WordPress.Security.EscapeOutput ?>
249
+ <?php echo $_flag_style; // phpcs:ignore WordPress.Security.EscapeOutput ?>
250
+ src="<?php echo $_flag_img; // phpcs:ignore WordPress.Security.EscapeOutput ?>" alt=""/>
251
+ </a>
252
+ <a style="text-decoration: none;"
253
+ href="<?php echo esc_url( str_replace( '{{language}}', $this->language, $url ) ); ?>"
254
+ class="wpglobus-gutenberg-selector wpglobus-gutenberg-selector-column-2"
255
+ data-language="<?php echo esc_attr( $this->language ); ?>">
256
+ &nbsp;<span class="wpglobus-gutenberg-selector-text">
257
+ <?php
258
+ /**
259
+ * Filter the current language name.
260
+ *
261
+ * @since 2.1.0
262
+ *
263
+ * @param string $en_language_name English language name.
264
+ * @param string $language Current language.
265
+ * @param WP_Post $post The current post.
266
+ *
267
+ * @return string
268
+ */
269
+ $en_language_name = apply_filters(
270
+ 'wpglobus_gutenberg_selector_text',
271
+ WPGlobus::Config()->en_language_name[ $this->language ],
272
+ $this->language,
273
+ $post
274
+ );
275
+ echo esc_html( $en_language_name );
276
+ ?>
277
+ </span>
278
+ </a>
279
+ </div>
280
+ <ul class="wpglobus-gutenberg-selector-dropdown"
281
+ style="display:none;position:fixed;border-left:1px solid #ddd;border-right:1px solid #ddd;background-color:#eee;margin:5px 0 0;padding:0 5px 5px 0;list-style-type:none;">
282
+ <?php foreach ( WPGlobus::Config()->enabled_languages as $lang ) : ?>
283
+ <?php
284
+ if ( $lang === $this->language ) {
285
+ continue;
286
+ }
287
+ ?>
288
+ <li class="item"
289
+ style="text-align:left;cursor:pointer;border-bottom:1px solid #ddd;margin:0;height:25px;padding:5px 0 5px 5px;"
290
+ data-language="<?php echo esc_attr( $lang ); ?>">
291
+ <a href="<?php echo esc_url( str_replace( '{{language}}', $lang, $url ) ); ?>">
292
+ <img src="<?php echo esc_url( WPGlobus::Config()->flags_url . WPGlobus::Config()->flag[ $lang ] ); ?>"
293
+ alt=""/>&nbsp;<?php echo esc_html( WPGlobus::Config()->en_language_name[ $lang ] ); ?>
294
+ </a>
295
+ </li>
296
+ <?php endforeach; ?>
297
+ </ul>
298
+ </div>
299
+ <?php
300
+ $out = ob_get_clean();
301
+
302
+ }
303
+
304
+ return $out;
305
+
306
+ }
307
+
308
+ /**
309
+ * Callback for 'wpglobus_seo_meta_box_title'.
310
+ *
311
+ * @param string $meta_box_title Metabox title.
312
+ *
313
+ * @return string
314
+ */
315
+ public function filter__seo_meta_box_title( $meta_box_title ) {
316
+ return $meta_box_title . ' ' .
317
+ // Translators: Metabox title FOR language.
318
+ _x( 'for', 'filter__seo_meta_box_title', 'wpglobus' )
319
+ . ' ' . WPGlobus::Config()->en_language_name[ $this->get_current_language() ];
320
+ }
321
+
322
+ /**
323
+ * Enqueue styles.
324
+ *
325
+ * @since 1.9.29
326
+ * @return void
327
+ */
328
+ public function on__enqueue_styles() {
329
+ /**
330
+ * Pagenow global.
331
+ *
332
+ * @var string $pagenow
333
+ */
334
+ global $pagenow;
335
+
336
+ if ( ! in_array( $pagenow, array( 'post.php', 'post-new.php' ), true ) ) {
337
+ return;
338
+ }
339
+
340
+ // phpcs:ignore WordPress.Security.NonceVerification
341
+ if ( isset( $_GET['classic-editor'] ) ) {
342
+ return;
343
+ }
344
+
345
+ wp_register_style(
346
+ 'wpglobus-gutenberg',
347
+ WPGlobus::plugin_dir_url() . 'includes/builders/gutenberg/assets/css/wpglobus-gutenberg.css',
348
+ array(),
349
+ WPGLOBUS_VERSION,
350
+ 'all'
351
+ );
352
+ wp_enqueue_style( 'wpglobus-gutenberg' );
353
+
354
+ }
355
+
356
+ /**
357
+ * Enqueue scripts.
358
+ *
359
+ * @return void
360
+ */
361
+ public function on__enqueue_scripts() {
362
+
363
+ /**
364
+ * Globals.
365
+ *
366
+ * @var string $pagenow
367
+ * @var string $wp_version
368
+ * @var \WP_Post $post
369
+ */
370
+ global $pagenow, $wp_version, $post;
371
+
372
+ if ( ! in_array( $pagenow, array( 'post.php', 'post-new.php' ), true ) ) {
373
+ return;
374
+ }
375
+
376
+ // phpcs:ignore WordPress.Security.NonceVerification
377
+ if ( isset( $_GET['classic-editor'] ) ) {
378
+ return;
379
+ }
380
+
381
+ /**
382
+ * Old-style switcher.
383
+ *
384
+ * @since 2.2.3
385
+ */
386
+ $tabs = '';
387
+ if ( ! empty( WPGlobus::Config()->block_editor_old_fashioned_language_switcher ) && 1 === (int) WPGlobus::Config()->block_editor_old_fashioned_language_switcher ) {
388
+ $tabs = $this->get_switcher_box( $pagenow );
389
+ }
390
+
391
+ $i18n = array();
392
+ $i18n['reload'] = esc_html__( 'Page is being reloaded. Please wait...', 'wpglobus' );
393
+ $i18n['save_post'] = esc_html__( 'Before switching the language, please save draft or publish, then reload page.', 'wpglobus' );
394
+
395
+ /**
396
+ * We have Gutenberg in core since WP 5.0.
397
+ *
398
+ * @since 2.0
399
+ */
400
+ $version_gutenberg = '';
401
+ if ( version_compare( $wp_version, '4.9.99', '>' ) ) {
402
+ $version_gutenberg = $wp_version;
403
+ } elseif ( defined( 'GUTENBERG_VERSION' ) ) {
404
+ $version_gutenberg = GUTENBERG_VERSION;
405
+ }
406
+
407
+ /**
408
+ * Check for Yoast SEO.
409
+ */
410
+ $yoast_seo = false;
411
+ if ( defined( 'WPSEO_VERSION' ) ) {
412
+ $yoast_seo = true;
413
+ }
414
+
415
+ /**
416
+ * Block editor tab URL.
417
+ *
418
+ * @since 2.2.3
419
+ */
420
+ $block_editor_tab_url = admin_url(
421
+ add_query_arg(
422
+ array(
423
+ 'page' => WPGlobus::OPTIONS_PAGE_SLUG,
424
+ 'tab' => 'block-editor',
425
+ ),
426
+ 'admin.php'
427
+ )
428
+ );
429
+
430
+ /**
431
+ * Build the flags URL.
432
+ *
433
+ * @since 2.2.3
434
+ */
435
+ $flags_url = array();
436
+ foreach ( WPGlobus::Config()->enabled_languages as $language ) {
437
+ if ( file_exists( WPGlobus::Config()->flag_path['big'] . WPGlobus::Config()->flag[ $language ] ) ) {
438
+ $flags_url[ $language ] = WPGlobus::Config()->flag_urls['big'] . WPGlobus::Config()->flag[ $language ];
439
+ } else {
440
+ $flags_url[ $language ] = WPGlobus::Config()->flags_url . WPGlobus::Config()->flag[ $language ];
441
+ }
442
+ }
443
+
444
+ /**
445
+ * Pass the $post to JS.
446
+ *
447
+ * @since 2.2.4
448
+ */
449
+ $__post = array(
450
+ 'ID' => '',
451
+ 'type' => '',
452
+ 'disabled' => false,
453
+ );
454
+ if ( $post instanceof WP_Post ) {
455
+ $__post['ID'] = $post->ID;
456
+ $__post['type'] = $post->post_type;
457
+ if ( in_array( $post->post_type, WPGlobus::Config()->disabled_entities, true ) ) {
458
+ $__post['disabled'] = true;
459
+ }
460
+ }
461
+
462
+ /**
463
+ * @see includes\class-wpglobus-config.php for config options.
464
+ * @since 2.2.14
465
+ */
466
+ $key_option = array();
467
+ $key_option['switcherButtonType'] = 'block_editor_switcher_plugin_button_type';
468
+
469
+ $options = array();
470
+ foreach($key_option as $key=>$option) {
471
+ $options[ $option ] = '';
472
+ if ( ! empty( WPGlobus::Config()->$option ) ) {
473
+ $options[$option] = WPGlobus::Config()->$option;
474
+ }
475
+ }
476
+
477
+ $data = array(
478
+ 'version' => WPGLOBUS_VERSION,
479
+ 'versionGutenberg' => $version_gutenberg,
480
+ 'wpglobusAjax' => WPGLOBUS_AJAX,
481
+ 'context' => WPGlobus::Config()->builder->get( 'context' ),
482
+ 'tabs' => $tabs,
483
+ 'language' => $this->language,
484
+ 'pagenow' => $pagenow,
485
+ 'postEditPage' => 'post.php',
486
+ 'postNewPage' => 'post-new.php',
487
+ 'defaultLanguage' => WPGlobus::Config()->default_language,
488
+ 'i18n' => $i18n,
489
+ 'yoastSeo' => $yoast_seo,
490
+ 'flags_url' => $flags_url,
491
+ 'store_link' => WPGlobus::URL_WPGLOBUS_SHOP,
492
+ '__post' => $__post,
493
+ 'block_editor_tab_url' => $block_editor_tab_url,
494
+ 'disabled_entities' => WPGlobus::Config()->disabled_entities,
495
+ 'options' => $options,
496
+ 'enabledOptionsTab' => true,
497
+ 'keyOption' => $key_option
498
+ );
499
+
500
+ /**
501
+ * Filter for data to send to JS.
502
+ * Returning array.
503
+ *
504
+ * @since 2.2.14
505
+ *
506
+ * @param array $data An array with data.
507
+ */
508
+ $data = apply_filters( 'wpglobus_block_editor_localize_data', $data );
509
+
510
+ wp_register_script(
511
+ 'wpglobus-gutenberg',
512
+ WPGlobus::plugin_dir_url() . 'includes/builders/gutenberg/assets/js/wpglobus-gutenberg' . WPGlobus::SCRIPT_SUFFIX() . '.js',
513
+ array( 'jquery' ),
514
+ WPGLOBUS_VERSION,
515
+ true
516
+ );
517
+ wp_enqueue_script( 'wpglobus-gutenberg' );
518
+ wp_localize_script(
519
+ 'wpglobus-gutenberg',
520
+ 'WPGlobusGutenberg',
521
+ $data
522
+ );
523
+ }
524
+
525
+ /**
526
+ * Callback for 'add_meta_boxes'.
527
+ */
528
+ public function on__add_meta_box() {
529
+
530
+ global $post;
531
+
532
+ if ( in_array( $post->post_type, WPGlobus::Config()->disabled_entities, true ) ) {
533
+ return;
534
+ }
535
+
536
+ add_meta_box(
537
+ 'wpglobus',
538
+ __( 'WPGlobus', 'wpglobus' ),
539
+ array( $this, 'callback__meta_box' ),
540
+ null,
541
+ 'side',
542
+ 'core'
543
+ );
544
+ }
545
+
546
+ /**
547
+ * Callback for 'add_meta_box' function.
548
+ */
549
+ public function callback__meta_box() {
550
+ echo $this->get_language_field(); // phpcs:ignore WordPress.Security.EscapeOutput
551
+ do_action( 'wpglobus_gutenberg_metabox' );
552
+ }
553
+
554
+ }
trunk/includes/builders/js_composer/class-wpglobus-js_composer-update-post.php ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * File: class-wpglobus-js_composer-update-post.php
4
+ *
5
+ * @package WPGlobus\Builders\JS_Composer
6
+ * @author Alex Gor(alexgff)
7
+ */
8
+
9
+ /**
10
+ * Class WPGlobus_js_composer_Update_Post.
11
+ */
12
+
13
+ if ( ! class_exists( 'WPGlobus_js_composer_Update_Post' ) ) :
14
+
15
+ // phpcs:ignore PEAR.NamingConventions
16
+ class WPGlobus_js_composer_Update_Post extends WPGlobus_Builder_Update_Post {
17
+
18
+ /**
19
+ * Constructor.
20
+ */
21
+ public function __construct() {
22
+
23
+ parent::__construct( 'js_composer' );
24
+
25
+ /**
26
+ * @see_file wpglobus\includes\class-wpglobus.php
27
+ */
28
+ remove_action( 'wp_insert_post_data', array( 'WPGlobus', 'on_save_post_data' ), 10 );
29
+
30
+ /**
31
+ * @todo incorrect the saving post in extra languages with priority = 10
32
+ */
33
+ add_filter( 'wp_insert_post_data', array( $this, 'filter__wp_insert_post_data' ), 100, 2 );
34
+
35
+ }
36
+
37
+ /**
38
+ * Callback for 'wp_insert_post_data'.
39
+ *
40
+ * @param array $data
41
+ * @param array $postarr
42
+ *
43
+ * @return array mixed
44
+ */
45
+ public function filter__wp_insert_post_data( $data, $postarr ) {
46
+
47
+ /**
48
+ * Prevent to filter disabled post type.
49
+ *
50
+ * @since 2.1.4
51
+ */
52
+ if ( in_array( $data['post_type'], WPGlobus::Config()->disabled_entities, true ) ) {
53
+ return $data;
54
+ }
55
+
56
+ global $wpdb;
57
+ $_post = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->posts WHERE ID = %d AND post_type = %s LIMIT 1", $postarr['ID'], $postarr['post_type'] ) );
58
+
59
+ $fields = array();
60
+ if ( isset( $postarr['post_title'] ) ) {
61
+ $fields['post_title'] = $postarr['post_title'];
62
+ }
63
+
64
+ if ( isset( $postarr['post_content'] ) ) {
65
+ $fields['post_content'] = $postarr['post_content'];
66
+ }
67
+
68
+ if ( isset( $postarr['post_excerpt'] ) ) {
69
+ $fields['post_excerpt'] = $postarr['post_excerpt'];
70
+ }
71
+
72
+ $builder_language = WPGlobus::Config()->builder->get_language();
73
+
74
+ if ( empty( $builder_language ) ) {
75
+
76
+ if ( empty( $postarr[ WPGlobus::get_language_meta_key() ] ) ) {
77
+ $builder_language = WPGlobus::Config()->default_language;
78
+ } else {
79
+ $builder_language = $postarr[ WPGlobus::get_language_meta_key() ];
80
+ }
81
+ }
82
+
83
+ foreach ( $fields as $field => $value ) {
84
+
85
+ $tr = array();
86
+
87
+ foreach ( WPGlobus::Config()->enabled_languages as $lang ) :
88
+
89
+ if ( $lang === $builder_language ) {
90
+
91
+ $text = $value;
92
+ if ( WPGlobus_Core::has_translations( $value ) ) {
93
+ $text = WPGlobus_Core::text_filter( $value, $lang, WPGlobus::RETURN_EMPTY );
94
+ }
95
+ if ( ! empty( $text ) ) {
96
+ $tr[ $lang ] = $text;
97
+ }
98
+ } else {
99
+ if ( isset( $_post->$field ) ) {
100
+ $text = WPGlobus_Core::text_filter( $_post->$field, $lang, WPGlobus::RETURN_EMPTY );
101
+ if ( ! empty( $text ) ) {
102
+ $tr[ $lang ] = $text;
103
+ }
104
+ }
105
+ }
106
+
107
+ endforeach;
108
+
109
+ $data[ $field ] = WPGlobus_Utils::build_multilingual_string( $tr );
110
+
111
+ }
112
+
113
+ return $data;
114
+
115
+ }
116
+
117
+ }
118
+
119
+ endif;
trunk/includes/builders/js_composer/class-wpglobus-js_composer.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * File: class-wpglobus-js_composer.php
4
+ *
5
+ * @package WPGlobus\Builders\WPBakeryPageBuilder
6
+ * @author Alex Gor(alexgff)
7
+ */
8
+
9
+
10
+ if ( ! class_exists( 'WPGlobus_JS_Composer' ) ) :
11
+
12
+ /**
13
+ * Class WPGlobus_JS_Composer.
14
+ */
15
+ class WPGlobus_JS_Composer extends WPGlobus_Builder {
16
+
17
+ /**
18
+ * Constructor.
19
+ */
20
+ public function __construct() {
21
+ parent::__construct( 'js_composer' );
22
+ }
23
+
24
+ }
25
+
26
+ endif;
trunk/includes/builders/pods/class-wpglobus-builder-pods.php ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * File: class-wpglobus-builder-pods.php
4
+ *
5
+ * @since 2.3.0
6
+ *
7
+ * @package WPGlobus\Builders\Pods.
8
+ * @author Alex Gor(alexgff)
9
+ */
10
+
11
+ if ( ! class_exists( 'WPGlobus_Builder_Pods' ) ) :
12
+
13
+ /**
14
+ * Class WPGlobus_Builder_Pods.
15
+ */
16
+ class WPGlobus_Builder_Pods {
17
+
18
+ /**
19
+ * Default Pods post type.
20
+ */
21
+ protected static $post_type = '_pods_pod';
22
+
23
+ /**
24
+ * Type of Pods: `post_type` or `settings`.
25
+ */
26
+ protected static $pods_type = '';
27
+
28
+ /**
29
+ * Get attributes.
30
+ */
31
+ public static function get_attrs($attrs) {
32
+
33
+ if ( ! function_exists('pods_api') ) {
34
+ return false;
35
+ }
36
+
37
+ /** @global string $pagenow */
38
+ /** @global string $wpdb */
39
+ global $pagenow, $wpdb;
40
+
41
+ $result = true;
42
+
43
+ if ( 'post.php' === $pagenow ) {
44
+
45
+ /**
46
+ * @see pods\includes\classes.php
47
+ */
48
+ $pods = pods_api()->load_pods( array( 'type' => 'post_type', 'fields' => true ) );
49
+
50
+ self::$pods_type = 'post_type';
51
+
52
+ $post_id = $attrs['post_id'];
53
+
54
+ if ( $post_id > 0 ) {
55
+
56
+ $pods_pod = $wpdb->get_results( $wpdb->prepare(
57
+ "SELECT p.post_name AS name, p.ID, p.post_title AS title, p.post_parent AS parent, pm.meta_value AS type FROM $wpdb->posts as p
58
+ LEFT JOIN $wpdb->postmeta AS pm ON pm.post_id = p.ID WHERE p.post_type = %s AND p.post_status = 'publish'
59
+ AND pm.meta_key = 'type' AND pm.meta_value = %s",
60
+ self::$post_type,
61
+ self::$pods_type
62
+ ), OBJECT_K );
63
+
64
+ if ( ! empty($pods_pod) ) {
65
+
66
+ foreach ( $pods_pod as $_pod_key => $_pod ) :
67
+
68
+ if ( $attrs['post_type'] != $_pod_key ) {
69
+ continue;
70
+ }
71
+
72
+ if ( empty($pods[ $_pod->ID ]['fields']) ) {
73
+ /**
74
+ * Pods_pod is attached to post type (e.g. for post) but has no fields.
75
+ */
76
+ $result = false;
77
+ break;
78
+ }
79
+
80
+ endforeach;
81
+ }
82
+ }
83
+
84
+ if ( ! $result ) {
85
+ return false;
86
+ }
87
+
88
+ $attrs['builder_page'] = true;
89
+ return $attrs;
90
+
91
+ } else {
92
+ /**
93
+ * @todo W.I.P @since 2.3.0
94
+ */
95
+ //
96
+ //if ( ! empty($_GET['page']) && false !== strpos( $_GET['page'], 'pods-settings' ) ) {
97
+ // $attrs['builder_page'] = true;
98
+ // return $attrs;
99
+ //}
100
+ }
101
+
102
+
103
+
104
+ return false;
105
+ }
106
+ }
107
+
108
+ endif;
109
+
110
+ # --- EOF
trunk/includes/builders/pods/class-wpglobus-pods-update-post.php ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * File: class-wpglobus-pods-update-post.php
4
+ *
5
+ * @since 2.3.0
6
+ *
7
+ * @package WPGlobus\Builders\Pods.
8
+ * @author Alex Gor(alexgff)
9
+ */
10
+
11
+ /**
12
+ * Class WPGlobus_pods_Update_Post.
13
+ */
14
+ if ( ! class_exists( 'WPGlobus_pods_Update_Post' ) ) :
15
+
16
+ // phpcs:ignore PEAR.NamingConventions
17
+ class WPGlobus_pods_Update_Post extends WPGlobus_Builder_Update_Post {
18
+
19
+ /**
20
+ * Constructor.
21
+ */
22
+ public function __construct() {
23
+
24
+ parent::__construct( 'pods' );
25
+
26
+ /**
27
+ * @see_file wpglobus\includes\class-wpglobus.php
28
+ */
29
+ remove_action( 'wp_insert_post_data', array( 'WPGlobus', 'on_save_post_data' ), 10 );
30
+
31
+ /**
32
+ * @todo incorrect the saving post in extra languages with priority = 10
33
+ */
34
+ add_filter( 'wp_insert_post_data', array( $this, 'filter__wp_insert_post_data' ), 100, 2 );
35
+
36
+ }
37
+
38
+ /**
39
+ * Callback for 'wp_insert_post_data'.
40
+ *
41
+ * @param array $data
42
+ * @param array $postarr
43
+ *
44
+ * @return mixed
45
+ */
46
+ public function filter__wp_insert_post_data( $data, $postarr ) {
47
+
48
+ /**
49
+ * Prevent to filter disabled post type.
50
+ */
51
+ if ( in_array( $data['post_type'], WPGlobus::Config()->disabled_entities, true ) ) {
52
+ return $data;
53
+ }
54
+
55
+ global $wpdb;
56
+ $_post = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->posts WHERE ID = %d AND post_type = %s LIMIT 1", $postarr['ID'], $postarr['post_type'] ) );
57
+
58
+ $fields = array();
59
+ if ( isset( $postarr['post_title'] ) ) {
60
+ $fields['post_title'] = $postarr['post_title'];
61
+ }
62
+
63
+ if ( isset( $postarr['post_content'] ) ) {
64
+ $fields['post_content'] = $postarr['post_content'];
65
+ }
66
+
67
+ if ( isset( $postarr['post_excerpt'] ) ) {
68
+ $fields['post_excerpt'] = $postarr['post_excerpt'];
69
+ }
70
+
71
+ $builder_language = WPGlobus::Config()->builder->get_language();
72
+
73
+ if ( empty( $builder_language ) ) {
74
+
75
+ if ( empty( $postarr[ WPGlobus::get_language_meta_key() ] ) ) {
76
+ $builder_language = WPGlobus::Config()->default_language;
77
+ } else {
78
+ $builder_language = $postarr[ WPGlobus::get_language_meta_key() ];
79
+ }
80
+ }
81
+
82
+ foreach ( $fields as $field => $value ) {
83
+
84
+ $tr = array();
85
+
86
+ foreach ( WPGlobus::Config()->enabled_languages as $lang ) :
87
+
88
+ if ( $lang === $builder_language ) {
89
+
90
+ $text = $value;
91
+ if ( WPGlobus_Core::has_translations( $value ) ) {
92
+ $text = WPGlobus_Core::text_filter( $value, $lang, WPGlobus::RETURN_EMPTY );
93
+ }
94
+ if ( ! empty( $text ) ) {
95
+ $tr[ $lang ] = $text;
96
+ }
97
+ } else {
98
+ if ( isset( $_post->$field ) ) {
99
+ $text = WPGlobus_Core::text_filter( $_post->$field, $lang, WPGlobus::RETURN_EMPTY );
100
+ if ( ! empty( $text ) ) {
101
+ $tr[ $lang ] = $text;
102
+ }
103
+ }
104
+ }
105
+
106
+ endforeach;
107
+
108
+ $data[ $field ] = WPGlobus_Utils::build_multilingual_string( $tr );
109
+
110
+ }
111
+
112
+ return $data;
113
+
114
+ }
115
+
116
+ }
117
+
118
+ endif;
119
+
120
+ # --- EOF
trunk/includes/builders/pods/class-wpglobus-pods.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * File: class-wpglobus-pods.php
4
+ *
5
+ * @since 2.3.0
6
+ *
7
+ * @package WPGlobus\Builders\Pods.
8
+ * @author Alex Gor(alexgff)
9
+ */
10
+
11
+ if ( ! class_exists( 'WPGlobus_Pods' ) ) :
12
+
13
+ /**
14
+ * Class WPGlobus_Pods.
15
+ */
16
+ class WPGlobus_Pods extends WPGlobus_Builder {
17
+
18
+ /**
19
+ * Constructor.
20
+ */
21
+ public function __construct() {
22
+
23
+ parent::__construct( 'pods' );
24
+
25
+ }
26
+
27
+ }
28
+
29
+ endif;
30
+
31
+ # --- EOF
trunk/includes/builders/yoast_seo/class-wpglobus-yoast_seo-update-post.php ADDED
@@ -0,0 +1,259 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * File: class-wpglobus-yoast_seo-update-post.php
4
+ *
5
+ * @package WPGlobus\Builders\Yoast_SEO
6
+ * @author Alex Gor(alexgff)
7
+ */
8
+
9
+ /**
10
+ * Class WPGlobus_yoast_seo_Update_Post.
11
+ */
12
+
13
+ if ( ! class_exists( 'WPGlobus_yoast_seo_Update_Post' ) ) :
14
+
15
+ // phpcs:ignore PEAR.NamingConventions
16
+ class WPGlobus_yoast_seo_Update_Post extends WPGlobus_Builder_Update_Post {
17
+
18
+ /**
19
+ * Current taxonomy.
20
+ */
21
+ protected $taxonomy = '';
22
+
23
+ /**
24
+ * WP_Term object.
25
+ */
26
+ protected $tag;
27
+
28
+ /**
29
+ * Constructor.
30
+ */
31
+ public function __construct() {
32
+
33
+ parent::__construct( 'yoast_seo' );
34
+
35
+ global $pagenow;
36
+
37
+ if ( 'edit-tags.php' === $pagenow && 'editedtag' === $_POST['action'] ) { // phpcs:ignore WordPress.CSRF.NonceVerification
38
+ /**
39
+ * Update button was clicked.
40
+ */
41
+ $this->build_ml_description();
42
+ }
43
+
44
+ /**
45
+ * @see_file wpglobus\includes\class-wpglobus.php
46
+ */
47
+ remove_action( 'wp_insert_post_data', array( 'WPGlobus', 'on_save_post_data' ), 10 );
48
+
49
+ /**
50
+ * @todo incorrect the saving post in extra languages with priority = 10
51
+ */
52
+ add_filter( 'wp_insert_post_data', array( $this, 'filter__wp_insert_post_data' ), 100, 2 );
53
+
54
+ $this->taxonomy = WPGlobus::Config()->builder->get( 'taxonomy' );
55
+
56
+ if ( $this->taxonomy ) {
57
+
58
+ add_filter( 'wp_update_term_data', array( $this, 'filter__update_term_data' ), 10, 4 );
59
+
60
+ }
61
+ }
62
+
63
+ /**
64
+ * Build multilingual description.
65
+ * We don't have filter for description like filter for name @see 'wp_update_term_data' in wp-includes\taxonomy.php
66
+ */
67
+ public function build_ml_description() {
68
+
69
+ global $wpdb;
70
+
71
+ $current_language = WPGlobus::Config()->builder->get_language();
72
+
73
+ $tag_ID = (int) $_POST['tag_ID'];
74
+ $taxonomy = $_POST['taxonomy']; // phpcs:ignore WordPress.CSRF.NonceVerification
75
+
76
+ $this->tag = get_term( $tag_ID, $taxonomy );
77
+
78
+ if ( is_wp_error( $this->tag ) ) {
79
+
80
+ $terms = $wpdb->get_results( $wpdb->prepare( "SELECT t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE t.term_id = %d", $tag_ID ) );
81
+ if ( ! empty( $terms[0] ) && is_object( $terms[0] ) ) {
82
+ $this->tag = $terms[0];
83
+ }
84
+ }
85
+
86
+ if ( is_wp_error( $this->tag ) ) {
87
+ /**
88
+ * @todo Investigate.
89
+ */
90
+ return;
91
+ }
92
+
93
+ $new_desc = array();
94
+
95
+ foreach ( WPGlobus::Config()->enabled_languages as $lang ) :
96
+
97
+ if ( $lang === $current_language ) {
98
+
99
+ $text = trim( $_POST['description'] ); // phpcs:ignore WordPress.CSRF.NonceVerification
100
+ if ( ! empty( $text ) ) {
101
+ $new_desc[ $lang ] = $text;
102
+ }
103
+ } else {
104
+
105
+ $text = WPGlobus_Core::text_filter( $this->tag->description, $lang, WPGlobus::RETURN_EMPTY );
106
+ if ( ! empty( $text ) ) {
107
+ $new_desc[ $lang ] = $text;
108
+ }
109
+ }
110
+
111
+ endforeach;
112
+
113
+ $_POST['description'] = WPGlobus_Utils::build_multilingual_string( $new_desc );
114
+
115
+ }
116
+
117
+ /**
118
+ * Filters term data before it is updated in the database.
119
+ *
120
+ * @param array $data Term data to be updated.
121
+ * @param int $term_id Term ID.
122
+ * @param string $taxonomy Taxonomy slug.
123
+ * @param array $args Arguments passed to wp_update_term().
124
+ *
125
+ * @return array
126
+ */
127
+ public function filter__update_term_data(
128
+ $data,
129
+ /** @noinspection PhpUnusedParameterInspection */
130
+ $term_id,
131
+ /** @noinspection PhpUnusedParameterInspection */
132
+ $taxonomy,
133
+ /** @noinspection PhpUnusedParameterInspection */
134
+ $args
135
+ ) {
136
+
137
+ if ( is_wp_error( $this->tag ) ) {
138
+ /**
139
+ * @todo Investigate.
140
+ * may be to use $args.
141
+ */
142
+ return $data;
143
+ }
144
+
145
+ if ( WPGlobus::Config()->builder && ! WPGlobus::Config()->builder->is_builder_page() ) {
146
+ return $data;
147
+ }
148
+
149
+ $current_language = WPGlobus::Config()->builder->get_language();
150
+
151
+ $new_name = array();
152
+
153
+ foreach ( WPGlobus::Config()->enabled_languages as $lang ) :
154
+
155
+ if ( $lang === $current_language ) {
156
+
157
+ $text = trim( $data['name'] );
158
+ if ( ! empty( $text ) ) {
159
+ $new_name[ $lang ] = $text;
160
+ }
161
+ } else {
162
+
163
+ $text = WPGlobus_Core::text_filter( $this->tag->name, $lang, WPGlobus::RETURN_EMPTY );
164
+ if ( ! empty( $text ) ) {
165
+ $new_name[ $lang ] = $text;
166
+ }
167
+ }
168
+
169
+ endforeach;
170
+
171
+ $data['name'] = WPGlobus_Utils::build_multilingual_string( $new_name );
172
+
173
+ return $data;
174
+
175
+ }
176
+
177
+ /**
178
+ * Callback for 'wp_insert_post_data'.
179
+ *
180
+ * @param array $data
181
+ * @param array $postarr
182
+ *
183
+ * @return array mixed
184
+ */
185
+ public function filter__wp_insert_post_data( $data, $postarr ) {
186
+
187
+ /**
188
+ * Prevent to filter disabled post type.
189
+ *
190
+ * @since 2.1.4
191
+ */
192
+ if ( in_array( $data['post_type'], WPGlobus::Config()->disabled_entities, true ) ) {
193
+ return $data;
194
+ }
195
+
196
+ global $wpdb;
197
+ $_post = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->posts WHERE ID = %d AND post_type = %s LIMIT 1", $postarr['ID'], $postarr['post_type'] ) );
198
+
199
+ $fields = array();
200
+ if ( isset( $postarr['post_title'] ) ) {
201
+ $fields['post_title'] = $postarr['post_title'];
202
+ }
203
+
204
+ if ( isset( $postarr['post_content'] ) ) {
205
+ $fields['post_content'] = $postarr['post_content'];
206
+ }
207
+
208
+ if ( isset( $postarr['post_excerpt'] ) ) {
209
+ $fields['post_excerpt'] = $postarr['post_excerpt'];
210
+ }
211
+
212
+ $builder_language = WPGlobus::Config()->builder->get_language();
213
+
214
+ if ( empty( $builder_language ) ) {
215
+
216
+ if ( empty( $postarr[ WPGlobus::get_language_meta_key() ] ) ) {
217
+ $builder_language = WPGlobus::Config()->default_language;
218
+ } else {
219
+ $builder_language = $postarr[ WPGlobus::get_language_meta_key() ];
220
+ }
221
+ }
222
+
223
+ foreach ( $fields as $field => $value ) {
224
+
225
+ $tr = array();
226
+
227
+ foreach ( WPGlobus::Config()->enabled_languages as $lang ) :
228
+
229
+ if ( $lang === $builder_language ) {
230
+
231
+ $text = $value;
232
+ if ( WPGlobus_Core::has_translations( $value ) ) {
233
+ $text = WPGlobus_Core::text_filter( $value, $lang, WPGlobus::RETURN_EMPTY );
234
+ }
235
+ if ( ! empty( $text ) ) {
236
+ $tr[ $lang ] = $text;
237
+ }
238
+ } else {
239
+ if ( isset( $_post->$field ) ) {
240
+ $text = WPGlobus_Core::text_filter( $_post->$field, $lang, WPGlobus::RETURN_EMPTY );
241
+ if ( ! empty( $text ) ) {
242
+ $tr[ $lang ] = $text;
243
+ }
244
+ }
245
+ }
246
+
247
+ endforeach;
248
+
249
+ $data[ $field ] = WPGlobus_Utils::build_multilingual_string( $tr );
250
+
251
+ }
252
+
253
+ return $data;
254
+
255
+ }
256
+
257
+ }
258
+
259
+ endif;
trunk/includes/builders/yoast_seo/class-wpglobus-yoast_seo.php ADDED
@@ -0,0 +1,145 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * File: class-wpglobus-yoast_seo.php
4
+ *
5
+ * @package WPGlobus\Builders\Yoast_SEO
6
+ * @author Alex Gor(alexgff)
7
+ */
8
+
9
+
10
+ if ( ! class_exists( 'WPGlobus_Yoast_SEO' ) ) :
11
+
12
+ /**
13
+ * Class WPGlobus_Yoast_SEO.
14
+ */
15
+ class WPGlobus_Yoast_SEO extends WPGlobus_Builder {
16
+
17
+ /**
18
+ * Current taxonomy.
19
+ */
20
+ protected $taxonomy = '';
21
+
22
+ protected $wpseo_taxonomy_option_name = '';
23
+
24
+ /**
25
+ * Constructor.
26
+ */
27
+ public function __construct() {
28
+
29
+ /**
30
+ * @see 'WPSEO_PREMIUM_FILE' for premium add-on.
31
+ */
32
+
33
+ parent::__construct( 'yoast_seo' );
34
+
35
+ $this->taxonomy = WPGlobus::Config()->builder->get('taxonomy');
36
+
37
+ if ( $this->taxonomy ) {
38
+
39
+ add_action( "{$this->taxonomy}_pre_edit_form", array( $this, 'on__pre_edit_form' ), 10, 2 );
40
+
41
+ add_action( "{$this->taxonomy}_term_edit_form_top", array( $this, 'on__edit_form' ), 10, 2 );
42
+
43
+ if ( class_exists('WPSEO_Taxonomy_Meta') ) {
44
+ $wpseo_taxonomy_meta = WPSEO_Taxonomy_Meta::get_instance();
45
+ $this->wpseo_taxonomy_option_name = $wpseo_taxonomy_meta::$name;
46
+ } else {
47
+ $this->wpseo_taxonomy_option_name = 'wpseo_taxonomy_meta';
48
+ }
49
+
50
+ add_filter( "option_{$this->wpseo_taxonomy_option_name}", array( $this, 'filter__wpseo_taxonomy_meta' ), 5, 2 );
51
+
52
+ /**
53
+ * @see wordpress-seo\inc\class-wpseo-replace-vars.php
54
+ */
55
+ add_filter( 'wpseo_replacements', array( $this, 'filter__wpseo_replacements' ), 5, 2 );
56
+
57
+ }
58
+
59
+ }
60
+
61
+ /**
62
+ * Customization of the replacements before they are applied.
63
+ *
64
+ * @api array $replacements The replacements.
65
+ *
66
+ * @param array $args The object some of the replacement values might come from,
67
+ * could be a post, taxonomy or term.
68
+ */
69
+ public function filter__wpseo_replacements( $replacements, $args ) {
70
+
71
+ if ( ! is_array($replacements) || empty($replacements) ) {
72
+ return $replacements;
73
+ }
74
+
75
+ $key = key($replacements);
76
+
77
+ if ( WPGlobus_Core::has_translations( $replacements[$key] ) ) {
78
+ $replacements[$key] = WPGlobus_Core::text_filter( $replacements[$key], WPGlobus::Config()->builder->get_language(), WPGlobus::RETURN_EMPTY );
79
+ }
80
+
81
+ return $replacements;
82
+ }
83
+
84
+ /**
85
+ * Filters the value of a 'wpseo_taxonomy_meta' option.
86
+ *
87
+ * @param mixed $option_value Value of the option. If stored serialized, it will be
88
+ * unserialized prior to being returned.
89
+ * @param string $option_name Option name.
90
+ */
91
+ public function filter__wpseo_taxonomy_meta( $option_value, $option_name ) {
92
+
93
+ if ( empty( $option_value[$this->taxonomy] ) ) {
94
+ return $option_value;
95
+ }
96
+
97
+ $_enabled_keys = array('wpseo_title', 'wpseo_desc', 'wpseo_focuskw');
98
+
99
+ $language = WPGlobus::Config()->builder->get_language();
100
+
101
+ foreach( $option_value[$this->taxonomy] as $tag_ID=>$values ) {
102
+ foreach($values as $_key=>$_value) {
103
+ if ( in_array($_key, $_enabled_keys) ) {
104
+ if ( WPGlobus_Core::has_translations($_value) ) {
105
+ $option_value[$this->taxonomy][$tag_ID][$_key] = WPGlobus_Core::text_filter($_value, $language, WPGlobus::RETURN_EMPTY);
106
+ } else {
107
+ if ( $language != WPGlobus::Config()->default_language ) {
108
+ $option_value[$this->taxonomy][$tag_ID][$_key] = '';
109
+ }
110
+ }
111
+ }
112
+ }
113
+ }
114
+
115
+ return $option_value;
116
+ }
117
+
118
+ /**
119
+ * Fires before the Edit Term form for all taxonomies.
120
+ *
121
+ * @param object $tag Current taxonomy term object.
122
+ * @param string $taxonomy Current $taxonomy slug.
123
+ */
124
+ public function on__pre_edit_form( $tag, $taxonomy ) {
125
+
126
+ $language = WPGlobus::Config()->builder->get_language();
127
+ $tag->description = WPGlobus_Core::text_filter( $tag->description, $language, WPGlobus::RETURN_EMPTY );
128
+ $tag->name = WPGlobus_Core::text_filter( $tag->name, $language, WPGlobus::RETURN_EMPTY );
129
+
130
+ }
131
+
132
+ /**
133
+ * Fires at the beginning of the Edit Term form. Add language field to taxonomy edit form.
134
+ *
135
+ * @param object $tag Current taxonomy term object.
136
+ * @param string $taxonomy Current $taxonomy slug.
137
+ */
138
+ public function on__edit_form( $tag, $taxonomy ) {
139
+ echo '<input type="hidden" name="'.WPGlobus::get_language_meta_key().'" value="'.WPGlobus::Config()->builder->get_language().'">';
140
+
141
+ }
142
+
143
+ }
144
+
145
+ endif;
trunk/includes/class-wpglobus-config-vendor.php ADDED
@@ -0,0 +1,428 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class WPGlobus_Config_Vendor
4
+ *
5
+ * @package WPGlobus
6
+ * @author Alex Gor(alexgff)
7
+ */
8
+
9
+ if ( ! class_exists( 'WPGlobus_Config_Vendor' ) ) :
10
+
11
+ /**
12
+ * Vendor configuration.
13
+ */
14
+ class WPGlobus_Config_Vendor {
15
+
16
+ const PLUGIN_CONFIG_FILES = 'configs/*.json';
17
+
18
+ const PLUGIN_CONFIG_DIR = 'configs/';
19
+
20
+ /**
21
+ * Instance of this class.
22
+ *
23
+ * @var WPGlobus_Config_Vendor
24
+ */
25
+ protected static $instance;
26
+
27
+ /**
28
+ * @var array
29
+ */
30
+ protected static $config = array();
31
+
32
+ /**
33
+ * @var array|null
34
+ */
35
+ protected static $post_meta_fields = null;
36
+
37
+ /**
38
+ * @var array|null
39
+ */
40
+ protected static $post_ml_fields = null;
41
+
42
+ /**
43
+ * @var array|null
44
+ */
45
+ protected static $wp_options = null;
46
+
47
+ /**
48
+ * Builder.
49
+ *
50
+ * @var WPGlobus_Config_Builder
51
+ */
52
+ protected static $builder = null;
53
+
54
+ /**
55
+ * Array of registered vendors.
56
+ *
57
+ * @var string[]
58
+ */
59
+ protected static $vendors = array();
60
+
61
+ /**
62
+ * Constructor.
63
+ *
64
+ * @param WPGlobus_Config_Builder $builder
65
+ */
66
+ protected function __construct( $builder ) {
67
+
68
+ self::$builder = $builder;
69
+
70
+ self::get_config_files();
71
+ self::parse_config();
72
+
73
+ }
74
+
75
+ /**
76
+ * Get instance of this class.
77
+ *
78
+ * @param WPGlobus_Config_Builder $builder
79
+ *
80
+ * @return WPGlobus_Config_Vendor
81
+ */
82
+ public static function get_instance( $builder ) {
83
+ if ( ! ( self::$instance instanceof WPGlobus_Config_Vendor ) ) {
84
+ self::$instance = new self( $builder );
85
+ }
86
+
87
+ return self::$instance;
88
+ }
89
+
90
+ /**
91
+ * Get meta fields.
92
+ *
93
+ * @return array|false
94
+ */
95
+ public static function get_meta_fields() {
96
+ if ( is_null( self::$post_meta_fields ) ) {
97
+ return false;
98
+ }
99
+
100
+ return self::$post_meta_fields;
101
+ }
102
+
103
+ /**
104
+ * Get multilingual fields.
105
+ *
106
+ * @return array|false
107
+ */
108
+ public static function get_ml_fields() {
109
+ if ( is_null( self::$post_ml_fields ) ) {
110
+ return false;
111
+ }
112
+
113
+ return self::$post_ml_fields;
114
+ }
115
+
116
+ /**
117
+ * Get wp_options.
118
+ *
119
+ * @return array|false
120
+ */
121
+ public static function get_wp_options() {
122
+ if ( is_null( self::$wp_options ) ) {
123
+ return false;
124
+ }
125
+
126
+ return self::$wp_options;
127
+ }
128
+
129
+ /**
130
+ * Get config files.
131
+ */
132
+ public static function get_config_files() {
133
+
134
+ $config_plugin_dir = WPGlobus::$PLUGIN_DIR_PATH . self::PLUGIN_CONFIG_DIR;
135
+
136
+ /**
137
+ * WPGlobus SEO.
138
+ */
139
+ if ( function_exists( 'wpglobus_seo__init' ) ) {
140
+ self::$vendors[] = 'wpglobus-seo.json';
141
+ }
142
+
143
+ /**
144
+ * Yoast SEO.
145
+ * https://wordpress.org/plugins/wordpress-seo/
146
+ */
147
+ if ( defined( 'WPSEO_VERSION' ) ) {
148
+ /**
149
+ * check 'WPSEO_PREMIUM_PLUGIN_FILE' for premium add-on.
150
+ */
151
+ self::$vendors[] = 'yoast-seo.json';
152
+ }
153
+
154
+ /**
155
+ * All in One SEO Pack.
156
+ * https://wordpress.org/plugins/all-in-one-seo-pack/
157
+ */
158
+ if ( defined( 'AIOSEOP_VERSION' ) ) {
159
+ /**
160
+ * Load config file for builder page only.
161
+ */
162
+ if ( self::$builder->is_builder_page() ) {
163
+ self::$vendors[] = 'all-in-one-seo-pack.json';
164
+ }
165
+ }
166
+
167
+ /**
168
+ * Elementor.
169
+ * https://wordpress.org/plugins/elementor/
170
+ */
171
+ if ( defined( 'ELEMENTOR_VERSION' ) ) {
172
+ self::$vendors[] = 'elementor.json';
173
+ }
174
+
175
+ /**
176
+ * Advanced Custom Fields.
177
+ * https://wordpress.org/plugins/advanced-custom-fields/
178
+ */
179
+ if ( function_exists( 'acf' ) ) {
180
+ /**
181
+ * Check the existence of function to prevent getting fatal error in older version (checked with 4.4.12).
182
+ */
183
+ if ( function_exists( 'acf_maybe_get_field' ) ) {
184
+ self::$vendors[] = 'acf.json';
185
+ }
186
+ }
187
+
188
+ /**
189
+ * Pods – Custom Content Types and Fields.
190
+ * https://wordpress.org/plugins/pods/
191
+ * @since 2.3.0
192
+ */
193
+ if ( defined( 'PODS_VERSION' ) ) {
194
+ self::$vendors[] = 'pods.json';
195
+ }
196
+
197
+ /**
198
+ * Page Builder by SiteOrigin.
199
+ * https://wordpress.org/plugins/siteorigin-panels/
200
+ * // if ( defined('SITEORIGIN_PANELS_VERSION') ) {
201
+ * // self::$vendors[] = 'siteorigin-panels.json';
202
+ * // }
203
+ */
204
+
205
+ // TODO: builder ID can be a string or `false`. Need to refactor this condition or the `get_id` method.
206
+ // phpcs:ignore WordPress.PHP.StrictComparisons
207
+ if ( self::$builder->get_id() != '' && self::$builder->is_builder_page() ) {
208
+
209
+ $addons = WPGlobus_Builders::get_addons();
210
+
211
+ if ( ! empty( $addons ) ) {
212
+ foreach ( $addons as $id => $addon ) {
213
+ if ( 'add-on' === $addon['role'] ) {
214
+ if ( ! empty( $addon['const'] ) && defined( $addon['const'] ) ) {
215
+ self::$vendors[] = $addon['config_file'];
216
+ }
217
+ }
218
+ }
219
+ }
220
+ }
221
+
222
+ /**
223
+ * Now handle with config files.
224
+ */
225
+ foreach ( self::$vendors as $file ) {
226
+
227
+ if ( is_readable( $config_plugin_dir . $file ) ) {
228
+ $file_name = pathinfo( $file, PATHINFO_FILENAME );
229
+
230
+ self::$config[ $file_name ] = json_decode( file_get_contents( $config_plugin_dir . $file ), true );
231
+ }
232
+ }
233
+
234
+ /**
235
+ * Filter vendor's config.
236
+ *
237
+ * @since 2.1.10
238
+ *
239
+ * @param array $config Config.
240
+ * @param object $builder An object WPGlobus_Config_Builder.
241
+ *
242
+ * @return array
243
+ */
244
+ self::$config = apply_filters( 'wpglobus_config_vendors', self::$config, self::$builder );
245
+
246
+ }
247
+
248
+ /**
249
+ * Get multilingual fields for post.
250
+ *
251
+ * @param mixed $_meta Unused.
252
+ * @param array $_init
253
+ *
254
+ * @return array|false
255
+ */
256
+ public static function get_post_ml_fields(
257
+ /** @noinspection PhpUnusedParameterInspection */
258
+ $_meta, $_init
259
+ ) {
260
+
261
+ if ( ! self::$builder->is_builder_page() ) {
262
+ /**
263
+ * Prevent getting multilingual fields for no builder page.
264
+ *
265
+ * @since 2.1.11
266
+ */
267
+ return false;
268
+ }
269
+
270
+ $_post_ml_fields = array();
271
+
272
+ if ( empty( $_init ) ) {
273
+ return $_post_ml_fields;
274
+ }
275
+
276
+ // phpcs:ignore
277
+ // $file = empty( $_init['file'] ) ? '' : WPGlobus::$PLUGIN_DIR_PATH . 'includes/' . $_init['file']; // TODO remove
278
+
279
+ /** @var WPGlobus_Acf_2 $class */
280
+ $class = empty( $_init['class'] ) ? '' : $_init['class'];
281
+
282
+ if ( ! empty( $class ) && class_exists( $class ) ) {
283
+ $_post_ml_fields = $class::get_post_multilingual_fields();
284
+ }
285
+
286
+ return $_post_ml_fields;
287
+ }
288
+
289
+ /**
290
+ * Get meta fields for post.
291
+ *
292
+ * @param mixed $_meta Unused.
293
+ * @param array $_init
294
+ *
295
+ * @return array|false
296
+ */
297
+ public static function get_post_meta_fields(
298
+ /** @noinspection PhpUnusedParameterInspection */
299
+ $_meta, $_init
300
+ ) {
301
+
302
+ if ( ! self::$builder->is_builder_page() ) {
303
+ /**
304
+ * Prevent getting meta fields for no builder page.
305
+ *
306
+ * @since 2.1.11
307
+ */
308
+ return false;
309
+ }
310
+
311
+ $_post_meta_fields = array();
312
+
313
+ if ( empty( $_init ) ) {
314
+ return $_post_meta_fields;
315
+ }
316
+
317
+ $file = empty( $_init['file'] ) ? '' : WPGlobus::$PLUGIN_DIR_PATH . 'includes/' . $_init['file'];
318
+
319
+ /** @var WPGlobus_Acf_2 $class */
320
+ $class = empty( $_init['class'] ) ? '' : $_init['class'];
321
+
322
+ if ( ! empty( $file ) && file_exists( $file ) ) {
323
+ /** @noinspection PhpIncludeInspection */
324
+ include_once $file;
325
+ if ( ! empty( $class ) && class_exists( $class ) ) {
326
+ /**
327
+ * @since 2.1.3 Added post type parameter.
328
+ */
329
+ $_post_meta_fields = $class::get_post_meta_fields( self::$builder->get( 'post_id' ), self::$builder->get( 'post_type' ) );
330
+ } else {
331
+ /**
332
+ * Mark as being incorrectly called.
333
+ */
334
+ _doing_it_wrong( 'Class `' . $class . '` (in ' . __FILE__ . ')', 'Check out `configs\*.json` files.', '2.3.0' );
335
+ }
336
+ } else {
337
+ /**
338
+ * Mark as being incorrectly called.
339
+ */
340
+ _doing_it_wrong( 'File `' . $file . '` (in ' . __FILE__ . ')', 'Check out `configs\*.json` files.', '2.3.0' );
341
+ }
342
+
343
+ return $_post_meta_fields;
344
+ }
345
+
346
+ /**
347
+ * Parse config files.
348
+ */
349
+ public static function parse_config() {
350
+
351
+ /**
352
+ * Parse post meta fields.
353
+ */
354
+ if ( is_null( self::$post_meta_fields ) ) {
355
+
356
+ self::$post_meta_fields = array();
357
+ self::$post_ml_fields = array();
358
+
359
+ foreach ( self::$config as $vendor => $data ) {
360
+
361
+ if ( isset( $data['post_meta_fields'] ) && is_array( $data['post_meta_fields'] ) ) :
362
+
363
+ foreach ( $data['post_meta_fields'] as $_meta => $_init ) {
364
+
365
+ if ( isset( $data['post_meta_fields'][ $_meta ] ) ) {
366
+
367
+ if ( '*' === $_meta ) {
368
+ $_arr = self::get_post_meta_fields( $_meta, $_init );
369
+ if ( ! empty( $_arr ) ) {
370
+ self::$post_meta_fields = array_merge( self::$post_meta_fields, $_arr );
371
+ }
372
+ } else {
373
+ self::$post_meta_fields[] = $_meta;
374
+ }
375
+ }
376
+ }
377
+
378
+ endif;
379
+
380
+ if ( isset( $data['post_ml_fields'] ) && is_array( $data['post_ml_fields'] ) ) :
381
+ foreach ( $data['post_ml_fields'] as $_meta => $_init ) {
382
+ if ( isset( $data['post_ml_fields'][ $_meta ] ) ) {
383
+
384
+ if ( '*' === $_meta ) {
385
+ $_arr = self::get_post_ml_fields( $_meta, $_init );
386
+ if ( ! empty( $_arr ) ) {
387
+ self::$post_ml_fields = array_merge( self::$post_ml_fields, $_arr );
388
+ }
389
+ } else {
390
+ self::$post_ml_fields[] = $_meta;
391
+ }
392
+ }
393
+ }
394
+ endif;
395
+
396
+ }
397
+
398
+ }
399
+
400
+ /**
401
+ * Parse WP options.
402
+ */
403
+ if ( is_null( self::$wp_options ) ) {
404
+
405
+ foreach ( self::$config as $vendor => $data ) {
406
+
407
+ if ( isset( $data['wp_options'] ) && is_array( $data['wp_options'] ) ) :
408
+ foreach ( $data['wp_options'] as $_option => $_init ) {
409
+ if ( isset( $data['wp_options'][ $_option ] ) ) {
410
+ self::$wp_options[] = $_option;
411
+ }
412
+ }
413
+ endif;
414
+
415
+ }
416
+
417
+ if ( ! is_null( self::$wp_options ) ) {
418
+ self::$wp_options = array_unique( self::$wp_options );
419
+ }
420
+ }
421
+
422
+ }
423
+
424
+ }
425
+
426
+ endif;
427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+ */
9
+ class WPGlobus_Config {
10
+
11
+ /**
12
+ * Language by default
13
+ * @var string
14
+ */
15
+ public $default_language = 'en';
16
+
17
+ /**
18
+ * Current language. Should be set to default initially.
19
+ * @var string
20
+ */
21
+ public $language = 'en';
22
+
23
+ /**
24
+ * Enabled languages
25
+ * @var string[]
26
+ */
27
+ public $enabled_languages = array(
28
+ 'en',
29
+ 'es',
30
+ 'de',
31
+ 'fr',
32
+ 'ru',
33
+ );
34
+
35
+ /**
36
+ * Hide from URL language by default
37
+ * @var bool
38
+ */
39
+ public $hide_default_language = true;
40
+
41
+ /**
42
+ * Opened languages
43
+ * @var string[]
44
+ */
45
+ public $open_languages = array();
46
+
47
+ /**
48
+ * Flag images configuration
49
+ * Look in /flags/ directory for a huge list of flags for usage
50
+ * @var array
51
+ */
52
+ public $flag = array();
53
+
54
+ /**
55
+ * Location of flags (needs trailing slash!)
56
+ * @var string
57
+ */
58
+ public $flags_url = '';
59
+
60
+ /**
61
+ * Path to flags.
62
+ * @var array
63
+ * @since 1.9.17
64
+ */
65
+ public $flag_path = array();
66
+
67
+ /**
68
+ * Location of flags.
69
+ * @var array
70
+ * @since 1.9.17
71
+ */
72
+ public $flag_urls = array();
73
+
74
+ /**
75
+ * Stores languages in pairs code=>name
76
+ * @var array
77
+ */
78
+ public $language_name = array();
79
+
80
+ /**
81
+ * Stores languages names in English
82
+ * @var array
83
+ */
84
+ public $en_language_name = array();
85
+
86
+ /**
87
+ * Stores locales
88
+ * @var array
89
+ */
90
+ public $locale = array();
91
+
92
+ /**
93
+ * Stores enabled locales
94
+ * @since 1.0.10
95
+ * @var array
96
+ */
97
+ public $enabled_locale = array();
98
+
99
+ /**
100
+ * Stores version and update from WPGlobus Mini info
101
+ * @var array
102
+ */
103
+ public $version = array();
104
+
105
+ /**
106
+ * Use flag name for navigation menu : 'name' || 'code' || ''
107
+ * @var string
108
+ */
109
+ public $show_flag_name = 'code';
110
+
111
+ /**
112
+ * Use navigation menu by slug
113
+ * for use in all nav menu set value to 'all'
114
+ * @var string
115
+ */
116
+ public $nav_menu = '';
117
+
118
+ /**
119
+ * Add language selector to navigation menu which was created with wp_list_pages
120
+ * @since 1.0.7
121
+ * @var bool
122
+ */
123
+ public $selector_wp_list_pages = true;
124
+
125
+ /**
126
+ * Custom CSS
127
+ * @var string
128
+ */
129
+ public $custom_css = '';
130
+
131
+ /**
132
+ * WPGlobus option key
133
+ * @var string
134
+ */
135
+ public $option = 'wpglobus_option';
136
+
137
+ /**
138
+ * WPGlobus option versioning key
139
+ * @var string
140
+ */
141
+ public static $option_versioning = 'wpglobus_option_versioning';
142
+
143
+ /**
144
+ * WPGlobus option key for $language_name
145
+ * @var string
146
+ */
147
+ public $option_language_names = 'wpglobus_option_language_names';
148
+
149
+ /**
150
+ * WPGlobus option key for $en_language_name
151
+ * @var string
152
+ */
153
+ public $option_en_language_names = 'wpglobus_option_en_language_names';
154
+
155
+ /**
156
+ * WPGlobus option key for $locale
157
+ * @var string
158
+ */
159
+ public $option_locale = 'wpglobus_option_locale';
160
+
161
+ /**
162
+ * WPGlobus option key for $flag
163
+ * @var string
164
+ */
165
+ public $option_flags = 'wpglobus_option_flags';
166
+
167
+ /**
168
+ * WPGlobus option key for meta settings
169
+ * @var string
170
+ */
171
+ public $option_post_meta_settings = 'wpglobus_option_post_meta_settings';
172
+
173
+ /**
174
+ * WPGlobus option key for registered post types.
175
+ * @since 2.2.24
176
+ * @var string
177
+ */
178
+ public $option_register_post_types = 'wpglobus_option_register_post_types';
179
+
180
+ /**
181
+ * @var string
182
+ */
183
+ public $css_editor = '';
184
+
185
+ /**
186
+ * @var string
187
+ */
188
+ public $js_editor = '';
189
+
190
+ /**
191
+ * WPGlobus devmode.
192
+ * @var string
193
+ */
194
+ public $toggle = 'on';
195
+
196
+ /**
197
+ * @todo Refactor this
198
+ * Duplicate var @see WPGlobus
199
+ * @var array
200
+ */
201
+ public $disabled_entities = array();
202
+
203
+ /**
204
+ * WPGlobus extended options can be added via filter 'wpglobus_option_sections'
205
+ *
206
+ * @since 1.2.3
207
+ * @var array
208
+ */
209
+ public $extended_options = array();
210
+
211
+ /**
212
+ * @var array
213
+ * @since 1.8.0
214
+ */
215
+ public $browser_redirect;
216
+
217
+ /**
218
+ * Used to temporarily store the language detected from the URL processed by oembed.
219
+ * @var string
220
+ * @since 1.8.4
221
+ */
222
+ protected $language_for_oembed = '';
223
+
224
+ /**
225
+ * Builder.
226
+ *
227
+ * @var WPGlobus_Config_Builder
228
+ * @since 1.9.17
229
+ */
230
+ public $builder = null;
231
+
232
+ /**
233
+ * True if builder is disabled.
234
+ *
235
+ * @var boolean
236
+ * @since 1.9.17
237
+ */
238
+ public $builder_disabled = true;
239
+
240
+ /**
241
+ * If '1', use the old style language switcher in Gutenberg. Set through the Options Panel.
242
+ *
243
+ * @var string
244
+ * @since 2.2.3
245
+ */
246
+ public $block_editor_old_fashioned_language_switcher = '';
247
+
248
+ /**
249
+ * Type of switcher button for WPGlobusSwitcherPlugin.
250
+ *
251
+ * @var string
252
+ * @since 2.2.14
253
+ */
254
+ public $block_editor_switcher_plugin_button_type = '';
255
+
256
+ /**
257
+ * Language- and region-specific hreflang.
258
+ *
259
+ * @var string
260
+ * @since 2.3.4
261
+ */
262
+ public $seo_hreflang_type = 'zz-ZZ';
263
+
264
+ /**
265
+ * Language- and region-specific hreflang for default language.
266
+ *
267
+ * @var string
268
+ * @since 2.3.4
269
+ */
270
+ public $seo_hreflang_default_language_type = false;
271
+
272
+ /**
273
+ * Can get it only once.
274
+ *
275
+ * @since 1.8.4
276
+ * @return string
277
+ */
278
+ public function getAndResetLanguageForOembed() {
279
+ $to_return = $this->language_for_oembed;
280
+ $this->language_for_oembed = '';
281
+
282
+ return $to_return;
283
+ }
284
+
285
+ /**
286
+ * Setter.
287
+ * @param string $language_for_oembed
288
+ * @since 1.8.4
289
+ */
290
+ public function setLanguageForOembed( $language_for_oembed ) {
291
+ $this->language_for_oembed = $language_for_oembed;
292
+ }
293
+
294
+ /**
295
+ * Constructor
296
+ */
297
+ public function __construct() {
298
+
299
+ /**
300
+ * @since 1.0.9 Hooked to 'plugins_loaded'. The 'init' is too late, because it happens after all plugins already loaded their translations.
301
+ */
302
+ add_action( 'plugins_loaded', array(
303
+ $this,
304
+ 'init_current_language'
305
+ ), 0 );
306
+
307
+ add_action( 'plugins_loaded', array(
308
+ $this,
309
+ 'on_load_textdomain'
310
+ ), 1 );
311
+
312
+ /**
313
+ * Sets the current language and switches the translations according to the given locale.
314
+ *
315
+ * @param string $locale The locale to switch to.
316
+ *
317
+ * @since 1.9.14
318
+ */
319
+ add_action( 'switch_locale', array( $this, 'on_switch_locale' ), - PHP_INT_MAX );
320
+
321
+ /**
322
+ * Sets the current language and switches the translations according to the given locale.
323
+ *
324
+ * @param string $locale The locale to switch to.
325
+ *
326
+ * @since 1.9.14
327
+ */
328
+ add_action( 'restore_previous_locale', array( $this, 'on_switch_locale' ), - PHP_INT_MAX );
329
+
330
+ add_action( 'upgrader_process_complete', array( $this, 'on_activate' ), 10, 2 );
331
+
332
+
333
+ $this->_get_options();
334
+ }
335
+
336
+ /**
337
+ * Sets the current language and switches the translations according to the given locale.
338
+ *
339
+ * @param string $locale The locale to switch to.
340
+ *
341
+ * @since 1.9.14
342
+ */
343
+ public function on_switch_locale( $locale ) {
344
+ $this->set_language( $locale );
345
+ $this->on_load_textdomain();
346
+ }
347
+
348
+ /**
349
+ * Set the current language: if not found in the URL or REFERER, then keep the default
350
+ * @since 1.1.1
351
+ */
352
+ public function init_current_language() {
353
+
354
+ /**
355
+ * Keep the default language if any of the code before does not detect another one.
356
+ */
357
+ $this->language = $this->default_language;
358
+
359
+ /**
360
+ * Theoretically, we might not have any URL to get the language info from.
361
+ */
362
+ $url_to_check = '';
363
+
364
+ if ( WPGlobus_WP::is_doing_ajax() ) {
365
+ /**
366
+ * If DOING_AJAX, we cannot retrieve the language information from the URL,
367
+ * because it's always `admin-ajax`.
368
+ * Therefore, we'll rely on the HTTP_REFERER (if it exists).
369
+ */
370
+ if ( ! empty( $_SERVER['HTTP_REFERER'] ) ) { // WPCS: input var ok, sanitization ok.
371
+ $url_to_check = $_SERVER['HTTP_REFERER']; // WPCS: input var ok, sanitization ok.
372
+ }
373
+ } else {
374
+ /**
375
+ * If not AJAX and not ADMIN then we are at the front. Will use the current URL.
376
+ */
377
+ if ( ! is_admin() ) {
378
+ $url_to_check = WPGlobus_Utils::current_url();
379
+ }
380
+ }
381
+
382
+ /**
383
+ * If we have an URL, extract language from it.
384
+ * If extracted, set it as a current.
385
+ */
386
+ if ( $url_to_check ) {
387
+ $language_from_url = WPGlobus_Utils::extract_language_from_url( $url_to_check );
388
+ if ( $language_from_url ) {
389
+ $this->language = $language_from_url;
390
+ }
391
+ /**
392
+ * @since 1.9.17
393
+ * Set language for builder.
394
+ * For compatibility we set language here for front-end only.
395
+ * As for the setting in admin @see wpglobus\includes\builders\class-wpglobus-config-builder.php
396
+ */
397
+ if ( $this->builder && ! is_admin() ) {
398
+ /**
399
+ * We can work with Gutenberg that was defined as front-end but we should set 'language' for real front-end without builder.
400
+ * Any builder may have behavior like Gutenberg.
401
+ * @todo check each builder that WPGlobus will be support.
402
+ */
403
+ if ( ! $this->builder->is_builder_page() ) {
404
+ $this->builder->set_language($this->language);
405
+ }
406
+ }
407
+ }
408
+
409
+ }
410
+
411
+
412
+ /**
413
+ * Check plugin version and update versioning option
414
+ *
415
+ * @param stdClass $object Plugin_Upgrader
416
+ * @param array $options
417
+ *
418
+ * @return void
419
+ */
420
+ public function on_activate(
421
+ /** @noinspection PhpUnusedParameterInspection */
422
+ $object = null,
423
+ $options = array()
424
+ ) {
425
+
426
+ if (
427
+ empty( $options['plugin'] ) or $options['plugin'] !== WPGLOBUS_PLUGIN_BASENAME or
428
+ empty( $options['action'] ) or $options['action'] !== 'update'
429
+ ) {
430
+ /**
431
+ * Not our business
432
+ */
433
+ return;
434
+ }
435
+
436
+ /**
437
+ * Here we can read the previous version value and do some actions if necessary.
438
+ * For example, warn the users about breaking changes.
439
+ * $version = get_option( self::$option_versioning );
440
+ * ...
441
+ */
442
+
443
+ /**
444
+ * Store the current version
445
+ */
446
+ update_option( self::$option_versioning, array(
447
+ 'current_version' => WPGLOBUS_VERSION
448
+ ) );
449
+
450
+ }
451
+
452
+ /**
453
+ * Set the current language to match the given locale.
454
+ *
455
+ * @since 1.9.14 : If we do not know such locale, set to default.
456
+ *
457
+ * @param string $locale The locale ('en_US', 'fr_FR', etc.).
458
+ */
459
+ public function set_language( $locale ) {
460
+
461
+ $locale_to_language = array_flip( $this->locale );
462
+
463
+ $this->language = empty( $locale_to_language[ $locale ] )
464
+ ? $this->default_language
465
+ : $locale_to_language[ $locale ];
466
+ }
467
+
468
+ /**
469
+ * Check for enabled locale
470
+ * @since 1.0.10
471
+ *
472
+ * @param string $locale
473
+ *
474
+ * @return boolean
475
+ */
476
+ public function is_enabled_locale( $locale ) {
477
+ return in_array( $locale, $this->enabled_locale, true );
478
+ }
479
+
480
+ /**
481
+ * Load textdomain
482
+ * @since 1.0.0
483
+ * @return void
484
+ */
485
+ public function on_load_textdomain() {
486
+ self::load_mofile();
487
+
488
+ /**
489
+ * Can use this action to load additional translations.
490
+ *
491
+ * @since 1.9.14
492
+ */
493
+ do_action( 'wpglobus_after_load_textdomain' );
494
+ }
495
+
496
+ /**
497
+ * Load .MO file from the plugin's `languages` folder.
498
+ * Used instead of @see load_plugin_textdomain to ignore translation files from WordPress.org, which are outdated.
499
+ * To force loading from a different place, use the `load_textdomain_mofile` filter.
500
+ *
501
+ * @since 1.9.6
502
+ */
503
+ protected function load_mofile() {
504
+ $domain = 'wpglobus';
505
+
506
+ /**
507
+ * Delete translations that could be loaded already from the main /languages/ folder.
508
+ *
509
+ * @since 1.9.10
510
+ */
511
+ unload_textdomain( $domain );
512
+
513
+ /**
514
+ * Load our translations.
515
+ */
516
+ $locale = apply_filters( 'plugin_locale', is_admin() ? get_user_locale() : get_locale(), $domain );
517
+ $mofile = WPGlobus::languages_path() . '/' . $domain . '-' . $locale . '.mo';
518
+ load_textdomain( $domain, $mofile );
519
+ }
520
+
521
+ /**
522
+ * Set flags URL.
523
+ * @return void
524
+ */
525
+ public function _set_flags_url() {
526
+ $this->flags_url = WPGlobus::$PLUGIN_DIR_URL . 'flags/';
527
+ /**
528
+ * @since 1.9.17
529
+ */
530
+ $this->flag_urls['small'] = WPGlobus::$PLUGIN_DIR_URL . 'flags/';
531
+ $this->flag_urls['big'] = WPGlobus::$PLUGIN_DIR_URL . 'flags/big/';
532
+ }
533
+
534
+ /**
535
+ * Set flag PATH.
536
+ * @return void
537
+ */
538
+ public function _set_flag_path() {
539
+ $this->flag_path['small'] = WPGlobus::$PLUGIN_DIR_PATH . 'flags/';
540
+ $this->flag_path['big'] = WPGlobus::$PLUGIN_DIR_PATH . 'flags/big/';
541
+ }
542
+
543
+ /**
544
+ * Set languages by default.
545
+ */
546
+ public function _set_languages() {
547
+
548
+ /**
549
+ * Names, flags and locales
550
+ * Useful links
551
+ * - languages in ISO 639-1 format http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
552
+ * - regions http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
553
+ * - WordPress locales https://make.wordpress.org/polyglots/teams/
554
+ * - converter https://www.unicodetools.com/unicode/convert-to-html.php
555
+ */
556
+
557
+ /* @noinspection SpellCheckingInspection */
558
+ $language_table = array(
559
+ // Prefix => Name, Native name, locale, flag.
560
+ 'ar' => array( 'Arabic', '&#1575;&#1604;&#1593;&#1585;&#1576;&#1610;&#1577;', 'ar', 'arle.png' ),
561
+ 'en' => array( 'English', 'English', 'en_US', 'us.png' ),
562
+ 'au' => array( 'English (AU)', 'English (AU)', 'en_AU', 'au.png' ),
563
+ 'ca' => array( 'English (CA)', 'English (CA)', 'en_CA', 'ca.png' ),
564
+ 'gb' => array( 'English (UK)', 'English (UK)', 'en_GB', 'uk.png' ),
565
+ 'zh' => array( 'Chinese', '&#31616;&#20307;&#20013;&#25991;', 'zh_CN', 'cn.png' ),
566
+ 'tw' => array( 'Chinese (TW)', '&#32321;&#39636;&#20013;&#25991;', 'zh_TW', 'mm.png' ),
567
+ 'da' => array( 'Danish', 'Dansk', 'da_DK', 'dk.png' ),
568
+ 'nl' => array( 'Dutch', 'Nederlands', 'nl_NL', 'nl.png' ),
569
+ 'gl' => array( 'Galician', 'Galego', 'gl_ES', 'galego.png' ),
570
+ 'de' => array( 'German', 'Deutsch', 'de_DE', 'de.png' ),
571
+ 'fi' => array( 'Finnish', 'Suomi', 'fi', 'fi.png' ),
572
+ 'fr' => array( 'French', 'Français', 'fr_FR', 'fr.png' ),
573
+ 'qc' => array( 'French (CA)', 'Français (CA)', 'fr_CA', 'fr_CA.png' ),
574
+ 'he' => array( 'Hebrew', '&#1506;&#1489;&#1512;&#1497;&#1514;', 'he_IL', 'il.png' ),
575
+ 'hi' => array( 'Hindi', '&#2361;&#2367;&#2344;&#2381;&#2342;&#2368;', 'hi_IN', 'in.png' ),
576
+ 'hu' => array( 'Hungarian', 'Magyar', 'hu_HU', 'hu.png' ),
577
+ 'it' => array( 'Italian', 'Italiano', 'it_IT', 'it.png' ),
578
+ 'ja' => array( 'Japanese', '&#26085;&#26412;&#35486;', 'ja', 'jp.png' ),
579
+ 'ko' => array( 'Korean', '&#54620;&#44397;&#50612;', 'ko_KR', 'kr.png' ),
580
+ 'no' => array( 'Norwegian', 'Norsk', 'nb_NO', 'no.png' ),
581
+ 'fa' => array( 'Persian', '&#1601;&#1575;&#1585;&#1587;&#1740;', 'fa_IR', 'ir.png' ),
582
+ 'pl' => array( 'Polish', 'Polski', 'pl_PL', 'pl.png' ),
583
+ 'pt' => array( 'Portuguese', 'Português', 'pt_PT', 'pt.png' ),
584
+ 'br' => array( 'Portuguese (BR)', 'Português (BR)', 'pt_BR', 'br.png' ),
585
+ 'ro' => array( 'Romanian', 'Română', 'ro_RO', 'ro.png' ),
586
+ 'ru' => array( 'Russian', 'Русский', 'ru_RU', 'ru.png' ),
587
+ 'es' => array( 'Spanish', 'Español', 'es_ES', 'es.png' ),
588
+ 'mx' => array( 'Spanish (MX)', 'Español (MX)', 'es_MX', 'mx.png' ),
589
+ 'sv' => array( 'Swedish', 'Svenska', 'sv_SE', 'se.png' ),
590
+ 'tr' => array( 'Turkish', 'Türkçe', 'tr_TR', 'tr.png' ),
591
+ 'uk' => array( 'Ukrainian', 'Українська', 'uk', 'ua.png' ),
592
+ 'vi' => array( 'Vietnamese', 'Tiếng Việt', 'vi', 'vn.png' ),
593
+ 'cy' => array( 'Welsh', 'Cymraeg', 'cy', 'cy.png' ),
594
+ );
595
+
596
+ foreach ( $language_table as $language => $data ) {
597
+ list(
598
+ $this->en_language_name[ $language ],
599
+ $this->language_name[ $language ],
600
+ $this->locale[ $language ],
601
+ $this->flag[ $language ]
602
+ ) = $data;
603
+ }
604
+
605
+ }
606
+
607
+ /**
608
+ * Initialize the language table with the hard-coded names, locales and flags.
609
+ *
610
+ * @see _set_languages For the hard-coded table.
611
+ */
612
+ protected function _init_language_table() {
613
+
614
+ update_option( $this->option_language_names, $this->language_name );
615
+ update_option( $this->option_en_language_names, $this->en_language_name );
616
+ update_option( $this->option_locale, $this->locale );
617
+ update_option( $this->option_flags, $this->flag );
618
+
619
+ }
620
+
621
+ /**
622
+ * Get options from DB and wp-config.php
623
+ * @return void
624
+ */
625
+ protected function _get_options() {
626
+
627
+ /**
628
+ * For developers use only. Re-creates language table with no warning! Irreversible!
629
+ *
630
+ * @link wp-admin/?wpglobus-reset-language-table=1
631
+ */
632
+ if ( ! defined( 'DOING_AJAX' ) && ! empty( $_GET['wpglobus-reset-language-table'] ) && is_admin() ) { // WPCS: input var ok, sanitization ok.
633
+ delete_option( $this->option_language_names );
634
+ }
635
+
636
+
637
+ $wpglobus_option = get_option( $this->option );
638
+
639
+ /**
640
+ * Get enabled languages and default language ( just one main language )
641
+ */
642
+ if ( isset( $wpglobus_option['enabled_languages'] ) && ! empty( $wpglobus_option['enabled_languages'] ) ) {
643
+ $this->enabled_languages = array();
644
+ foreach ( $wpglobus_option['enabled_languages'] as $lang => $value ) {
645
+ if ( ! empty( $value ) ) {
646
+ $this->enabled_languages[] = $lang;
647
+ }
648
+ }
649
+
650
+ /**
651
+ * Set default language
652
+ */
653
+ $this->default_language = $this->enabled_languages[0];
654
+
655
+ unset( $wpglobus_option['enabled_languages'] );
656
+ }
657
+
658
+ /**
659
+ * Set available languages for editors
660
+ */
661
+ $this->open_languages = $this->enabled_languages;
662
+
663
+ /**
664
+ * Set flags URL
665
+ */
666
+ $this->_set_flags_url();
667
+
668
+ /**
669
+ * Set flags PATH.
670
+ */
671
+ $this->_set_flag_path();
672
+
673
+ /**
674
+ * Get languages name
675
+ * big array of used languages
676
+ */
677
+ $this->language_name = get_option( $this->option_language_names );
678
+
679
+ if ( empty( $this->language_name ) ) {
680
+
681
+ $this->_set_languages();
682
+ $this->_init_language_table();
683
+
684
+ }
685
+
686
+ /**
687
+ * Get locales
688
+ */
689
+ $this->locale = get_option( $this->option_locale );
690
+ if ( empty( $this->locale ) ) {
691
+
692
+ $this->_set_languages();
693
+ $this->_init_language_table();
694
+
695
+ }
696
+
697
+ /**
698
+ * Get enabled locales
699
+ */
700
+ foreach ( $this->enabled_languages as $language ) {
701
+ $this->enabled_locale[] = $this->locale[ $language ];
702
+ }
703
+
704
+ /**
705
+ * Get en_language_name
706
+ */
707
+ $this->en_language_name = get_option( $this->option_en_language_names );
708
+
709
+ /**
710
+ * Get option 'show_flag_name'
711
+ */
712
+ if ( isset( $wpglobus_option['show_flag_name'] ) ) {
713
+ $this->show_flag_name = $wpglobus_option['show_flag_name'];
714
+ unset( $wpglobus_option['show_flag_name'] );
715
+ }
716
+ if ( defined( 'WPGLOBUS_SHOW_FLAG_NAME' ) ) {
717
+ if ( 'name' === WPGLOBUS_SHOW_FLAG_NAME ) {
718
+ $this->show_flag_name = 'name';
719
+ } elseif ( false === WPGLOBUS_SHOW_FLAG_NAME || '' === WPGLOBUS_SHOW_FLAG_NAME ) {
720
+ $this->show_flag_name = '';
721
+ }
722
+ }
723
+
724
+ /**
725
+ * Get navigation menu slug for add flag in front-end 'use_nav_menu'.
726
+ */
727
+ $this->nav_menu = '';
728
+
729
+ if ( isset( $wpglobus_option['use_nav_menu'] ) ) {
730
+ if ( '--none--' != $wpglobus_option['use_nav_menu'] ) {
731
+ $this->nav_menu = $wpglobus_option['use_nav_menu'];
732
+ }
733
+ unset( $wpglobus_option['use_nav_menu'] );
734
+ }
735
+
736
+ // This can be used in `wp-config` to override the options settings.
737
+ if ( defined( 'WPGLOBUS_USE_NAV_MENU' ) ) {
738
+ $this->nav_menu = WPGLOBUS_USE_NAV_MENU;
739
+ }
740
+
741
+
742
+ /**
743
+ * Get selector_wp_list_pages option
744
+ * @since 1.0.7
745
+ */
746
+ if ( empty( $wpglobus_option['selector_wp_list_pages']['show_selector'] ) ||
747
+ (int) $wpglobus_option['selector_wp_list_pages']['show_selector'] === 0
748
+ ) {
749
+ $this->selector_wp_list_pages = false;
750
+ }
751
+ if ( isset( $wpglobus_option['selector_wp_list_pages'] ) ) {
752
+ unset( $wpglobus_option['selector_wp_list_pages'] );
753
+ }
754
+
755
+ /**
756
+ * Get custom CSS
757
+ */
758
+ if ( isset( $wpglobus_option['css_editor'] ) ) {
759
+ $this->css_editor = $wpglobus_option['css_editor'];
760
+ unset( $wpglobus_option['css_editor'] );
761
+ }
762
+
763
+ /**
764
+ * Get custom JS.
765
+ * @since 1.7.6
766
+ */
767
+ if ( isset( $wpglobus_option['js_editor'] ) ) {
768
+ $this->js_editor = $wpglobus_option['js_editor'];
769
+ unset( $wpglobus_option['js_editor'] );
770
+ }
771
+
772
+ /**
773
+ * Old fashioned language switcher for Block Editor (Gutenberg).
774
+ * @since 2.2.3
775
+ */
776
+ if ( isset( $wpglobus_option['block_editor_old_fashioned_language_switcher'] ) ) {
777
+ $this->block_editor_old_fashioned_language_switcher = $wpglobus_option['block_editor_old_fashioned_language_switcher'];
778
+ unset( $wpglobus_option['block_editor_old_fashioned_language_switcher'] );
779
+ }
780
+
781
+ /**
782
+ * Type of switcher button for WPGlobusSwitcherPlugin (Gutenberg).
783
+ * @since 2.2.14
784
+ */
785
+ if ( isset( $wpglobus_option['block_editor_switcher_plugin_button_type'] ) ) {
786
+ $this->block_editor_switcher_plugin_button_type = $wpglobus_option['block_editor_switcher_plugin_button_type'];
787
+ unset( $wpglobus_option['block_editor_switcher_plugin_button_type'] );
788
+ }
789
+
790
+ /**
791
+ * Type of hreflang tag. Language- and region-specific hreflang.
792
+ * @since 2.3.4
793
+ */
794
+ if ( isset( $wpglobus_option['seo_hreflang_type'] ) ) {
795
+ $this->seo_hreflang_type = $wpglobus_option['seo_hreflang_type'];
796
+ unset( $wpglobus_option['seo_hreflang_type'] );
797
+ }
798
+
799
+ /**
800
+ * Type of hreflang tag for default language. Language- and region-specific hreflang for default language.
801
+ * @since 2.3.4
802
+ */
803
+ if ( isset( $wpglobus_option['seo_hreflang_default_language_type'] ) ) {
804
+ $this->seo_hreflang_default_language_type = $wpglobus_option['seo_hreflang_default_language_type'];
805
+ unset( $wpglobus_option['seo_hreflang_default_language_type'] );
806
+ }
807
+
808
+ /**
809
+ * Get flag files without path
810
+ */
811
+ $option = get_option( $this->option_flags );
812
+ if ( ! empty( $option ) ) {
813
+ $this->flag = $option;
814
+ }
815
+
816
+ /**
817
+ * Get versioning info
818
+ */
819
+ $option = get_option( self::$option_versioning );
820
+ if ( empty( $option ) ) {
821
+ $this->version = array();
822
+ } else {
823
+ $this->version = $option;
824
+ }
825
+
826
+ /**
827
+ * WPGlobus devmode.
828
+ */
829
+ if ( isset( $_GET['wpglobus'] ) && 'off' === $_GET['wpglobus'] ) { // WPCS: input var ok, sanitization ok.
830
+ $this->toggle = 'off';
831
+ } else {
832
+ $this->toggle = 'on';
833
+ }
834
+
835
+ /**
836
+ * Need additional check for devmode (toggle=OFF)
837
+ * in case 'wpglobus' was not set to 'off' at /wp-admin/post.php
838
+ * and $_SERVER[QUERY_STRING] is empty at the time of `wp_insert_post_data` action
839
+ * @see WPGlobus::on_save_post_data
840
+ */
841
+ if (
842
+ empty( $_SERVER['QUERY_STRING'] ) // WPCS: input var ok, sanitization ok.
843
+ && isset( $_SERVER['HTTP_REFERER'] ) // WPCS: input var ok, sanitization ok.
844
+ && WPGlobus_WP::is_pagenow( 'post.php' )
845
+ && false !== strpos( $_SERVER['HTTP_REFERER'], 'wpglobus=off' ) // WPCS: input var ok, sanitization ok.
846
+ ) {
847
+ $this->toggle = 'off';
848
+ }
849
+
850
+ if ( isset( $wpglobus_option['last_tab'] ) ) {
851
+ unset( $wpglobus_option['last_tab'] );
852
+ }
853
+
854
+ /**
855
+ * Builders.
856
+ * @since 1.9.17
857
+ */
858
+ if ( isset( $wpglobus_option['builder_disabled'] ) && 1 === (int) $wpglobus_option['builder_disabled'] ) {
859
+
860
+ require_once dirname( __FILE__ ).'/builders/class-wpglobus-config-builder.php' ;
861
+ $this->builder = new WPGlobus_Config_Builder(false);
862
+
863
+ $this->builder_disabled = true;
864
+ unset( $wpglobus_option['builder_disabled'] );
865
+
866
+ } else {
867
+
868
+ $this->builder_disabled = false;
869
+
870
+ /**
871
+ * @since 2.2.11
872
+ */
873
+ if ( empty( $wpglobus_option['builder_post_types'] ) ) {
874
+ $builder_post_types = array();
875
+ } else {
876
+ $builder_post_types = $wpglobus_option['builder_post_types'];
877
+ unset( $wpglobus_option['builder_post_types'] );
878
+ }
879
+
880
+ /**
881
+ * Init post types settings.
882
+ *
883
+ * @since 2.2.11
884
+ */
885
+ $builder_default_post_types = array(
886
+ 'post' => true,
887
+ 'page' => true,
888
+ 'attachment' => false
889
+ );
890
+
891
+ /** $wpglobus_option['post_type'] contains disabled post types. */
892
+ if ( empty( $wpglobus_option['post_type'] ) ) {
893
+ $post_types_disabled = array();
894
+ } else {
895
+ $post_types_disabled = array_intersect_key($builder_default_post_types, $wpglobus_option['post_type']);
896
+ }
897
+
898
+ if ( ! empty( $post_types_disabled ) ) {
899
+ foreach( $post_types_disabled as $_post_type=>$status ) {
900
+ if ( array_key_exists($_post_type, $builder_default_post_types) ) {
901
+ $builder_default_post_types[$_post_type] = false;
902
+ }
903
+ }
904
+ }
905
+
906
+ if ( empty($builder_post_types) ) {
907
+ $builder_post_types = $builder_default_post_types;
908
+ } else {
909
+ $builder_post_types = array_merge( $builder_default_post_types, $builder_post_types );
910
+ }
911
+
912
+ require_once dirname( __FILE__ ).'/builders/class-wpglobus-config-builder.php' ;
913
+ $this->builder = new WPGlobus_Config_Builder(
914
+ true,
915
+ array(
916
+ 'default_language' => $this->default_language,
917
+ 'post_types' => $builder_post_types,
918
+ 'options' => array(
919
+ 'register_post_types' => $this->option_register_post_types, // @since 2.2.24
920
+ )
921
+ )
922
+ );
923
+
924
+ if ( is_admin() ) {
925
+
926
+ require_once dirname( __FILE__ ) . '/class-wpglobus-config-vendor.php';
927
+ $config_vendor = WPGlobus_Config_Vendor::get_instance( $this->builder );
928
+
929
+ require_once dirname( __FILE__ ).'/admin/meta/class-wpglobus-meta.php' ;
930
+ WPGlobus_Meta::get_instance( $config_vendor::get_meta_fields(), $this->builder );
931
+ $this->meta = $config_vendor::get_meta_fields();
932
+
933
+ require_once dirname( __FILE__ ).'/wp_options/class-wpglobus-wp_options.php' ;
934
+ WPGlobus_WP_Options::get_instance( $config_vendor::get_wp_options() );
935
+
936
+ $this->builder->set_multilingual_fields($config_vendor::get_ml_fields());
937
+ }
938
+ }
939
+
940
+ /**
941
+ * @since 2.2.11
942
+ */
943
+ if ( isset( $wpglobus_option['post_type'] ) ) {
944
+ unset( $wpglobus_option['post_type'] );
945
+ }
946
+
947
+ /**
948
+ * Remaining wpglobus options after unset() is extended options
949
+ * @since 1.2.3
950
+ */
951
+ $this->extended_options = $wpglobus_option;
952
+
953
+ /**
954
+ * Option browser_redirect.
955
+ * @since 1.8.0
956
+ */
957
+ if ( isset( $wpglobus_option['browser_redirect'] ) ) {
958
+ $this->browser_redirect = $wpglobus_option['browser_redirect'];
959
+ unset( $wpglobus_option['browser_redirect'] );
960
+ }
961
+ }
962
+
963
+ } //class
964
+
965
+ # --- EOF
trunk/includes/class-wpglobus-core.php ADDED
@@ -0,0 +1,338 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * File: class-wpglobus-core.php
4
+ *
5
+ * @package WPGlobus
6
+ */
7
+
8
+ /**
9
+ * Class WPGlobus_Core
10
+ */
11
+ class WPGlobus_Core {
12
+
13
+ /**
14
+ * The main filter function.
15
+ * Default behavior: extracts text in one language from multi-lingual strings.
16
+ *
17
+ * @param string $text Multilingual text, with special delimiters between languages
18
+ * @param string $language The code of the language to be extracted from the `$text`
19
+ * @param string $return What to do if the text in the `$language` was not found
20
+ * @param string $default_language Pass this if you want to return a non-default language content, when the content in `$language` is not available
21
+ *
22
+ * @return string
23
+ */
24
+ public static function text_filter(
25
+ $text = '',
26
+ $language = '',
27
+ $return = WPGlobus::RETURN_IN_DEFAULT_LANGUAGE,
28
+ $default_language = ''
29
+ ) {
30
+
31
+ if ( empty( $text ) ) {
32
+ // Nothing to do
33
+ return $text;
34
+ }
35
+
36
+ /**
37
+ * There are cases when numeric terms are passed here. We should not tamper with them.
38
+ * @since 1.0.8.1 Before, was returning empty string, which was incorrect.
39
+ */
40
+ if ( ! is_string( $text ) ) {
41
+ return $text;
42
+ }
43
+
44
+ /**
45
+ * `$default_language` not passed
46
+ */
47
+ if ( ! $default_language ) {
48
+ if ( class_exists( 'WPGlobus_Config' ) ) {
49
+ $default_language = WPGlobus::Config()->default_language;
50
+ } else {
51
+ // When in unit tests
52
+ $default_language = 'en';
53
+ }
54
+ }
55
+
56
+ /**
57
+ * `$language` not passed
58
+ */
59
+ if ( empty( $language ) ) {
60
+ $language = $default_language;
61
+ }
62
+
63
+ /**
64
+ * Fix for the case
65
+ * &lt;!--:en--&gt;ENG&lt;!--:--&gt;&lt;!--:ru--&gt;RUS&lt;!--:--&gt;
66
+ * @todo need careful investigation
67
+ */
68
+ $text = htmlspecialchars_decode( $text );
69
+
70
+ $possible_delimiters =
71
+ array(
72
+ /**
73
+ * Our delimiters
74
+ */
75
+ array(
76
+ 'start' => sprintf( WPGlobus::LOCALE_TAG_START, $language ),
77
+ 'end' => WPGlobus::LOCALE_TAG_END,
78
+ ),
79
+ /**
80
+ * qTranslate compatibility
81
+ * qTranslate uses these two types of delimiters
82
+ * @example
83
+ * <!--:en-->English<!--:--><!--:ru-->Russian<!--:-->
84
+ * [:en]English S[:ru]Russian S
85
+ * The [] delimiter does not have the closing tag, so we will look for the next opening [: or
86
+ * take the rest until end of end of the string
87
+ */
88
+ array(
89
+ 'start' => "<!--:{$language}-->",
90
+ 'end' => '<!--:-->',
91
+ ),
92
+ array(
93
+ 'start' => "[:{$language}]",
94
+ 'end' => '[:',
95
+ ),
96
+ );
97
+
98
+ /**
99
+ * We'll use this flag after the loop to see if the loop was successful. See the `break` clause in the loop.
100
+ */
101
+ $is_local_text_found = false;
102
+
103
+ /**
104
+ * We do not know which delimiter was used, so we'll try both, in a loop
105
+ */
106
+ /* @noinspection LoopWhichDoesNotLoopInspection */
107
+ foreach ( $possible_delimiters as $delimiters ) {
108
+
109
+ /**
110
+ * Try the starting position. If not found, continue the loop to the next set of delimiters.
111
+ */
112
+ $pos_start = strpos( $text, $delimiters['start'] );
113
+ if ( false === $pos_start ) {
114
+ continue;
115
+ }
116
+
117
+ /**
118
+ * The starting position found..adjust the pointer to the text start
119
+ * (Do not need mb_strlen here, because we expect delimiters to be Latin only)
120
+ */
121
+ $pos_start += strlen( $delimiters['start'] );
122
+
123
+ /**
124
+ * Try to find the ending position.
125
+ * If could not find, will extract the text until end of string.
126
+ */
127
+ $pos_end = strpos( $text, $delimiters['end'], $pos_start );
128
+ if ( false === $pos_end ) {
129
+ // - Until end of string
130
+ $text = substr( $text, $pos_start );
131
+ } else {
132
+ $text = substr( $text, $pos_start, $pos_end - $pos_start );
133
+ }
134
+
135
+ /**
136
+ * Set the "found" flag and end the loop.
137
+ */
138
+ $is_local_text_found = true;
139
+ break;
140
+
141
+ }
142
+
143
+ /**
144
+ * If we could not find anything in the current language...
145
+ */
146
+ if ( ! $is_local_text_found ) {
147
+ if ( WPGlobus::RETURN_EMPTY === $return ) {
148
+ // phpcs:ignore Generic.CodeAnalysis.EmptyStatement.DetectedIF
149
+ if ( $language === $default_language && ! self::has_translations( $text ) ) {
150
+ /**
151
+ * @todo Check the above condition. What if only one part is true?
152
+ * If text does not contain language delimiters nothing to do
153
+ */
154
+ } else {
155
+ /** We are forced to return empty string. */
156
+ $text = '';
157
+ }
158
+ } else {
159
+ /**
160
+ * Try RETURN_IN_DEFAULT_LANGUAGE
161
+ */
162
+ if ( $language === $default_language ) {
163
+ if ( self::has_translations( $text ) ) {
164
+ /**
165
+ * Rare case of text in default language doesn't exist
166
+ * @todo make option for return warning message or maybe another action
167
+ */
168
+ $text = '';
169
+ }
170
+ } else {
171
+ /**
172
+ * Try the default language (recursion)
173
+ * @qa covered by the 'one_tag' case
174
+ * @see WPGlobus_QA::_test_string_parsing()
175
+ */
176
+ $text = self::text_filter( $text, $default_language );
177
+ }
178
+ }
179
+ /** else - we do not change the input string, and it will be returned as-is */
180
+ }
181
+
182
+ return $text;
183
+
184
+ }
185
+
186
+ /**
187
+ * Extract text from a string which is either:
188
+ * - in the requested language (could be multiple blocks)
189
+ * - or does not have the language marks
190
+ * @todo May fail on large texts because regex are used.
191
+ *
192
+ * @example
193
+ * Input:
194
+ * '{:en}first_EN{:}{:ru}first_RU{:} blah-blah {:en}second_EN{:}{:ru}second_RU{:}'
195
+ * Language: en
196
+ * Output:
197
+ * 'first_EN blah-blah second_EN'
198
+ *
199
+ * @param string $text Input text.
200
+ * @param string $language Language to extract. Default is the current language.
201
+ *
202
+ * @return string
203
+ * @since 1.7.9
204
+ * @since 2.2.12 Fixed regex to support line breaks in strings.
205
+ */
206
+ public static function extract_text( $text = '', $language = '' ) {
207
+ if ( ! $text || ! is_string( $text ) ) {
208
+ return $text;
209
+ }
210
+
211
+ /**
212
+ * `$language` not passed
213
+ */
214
+ if ( ! $language ) {
215
+ // When in unit tests.
216
+ $language = 'en';
217
+ // Normally.
218
+ if ( class_exists( 'WPGlobus_Config', false ) ) {
219
+ $language = WPGlobus::Config()->language;
220
+ }
221
+ }
222
+
223
+ // Pass 1. Remove the language marks surrounding the language we need.
224
+ // Pass 2. Remove the texts surrounded with other language marks, together with the marks.
225
+ return preg_replace(
226
+ array( '/{:' . $language . '}([\S\s]+?){:}/m', '/{:.+?}[\S\s]+?{:}/m' ),
227
+ array( '\\1', '' ),
228
+ $text
229
+ );
230
+ }
231
+
232
+ /**
233
+ * Check if string has language delimiters
234
+ *
235
+ * @param string $string
236
+ *
237
+ * @return bool
238
+ */
239
+ public static function has_translations( $string ) {
240
+
241
+ /**
242
+ * This should detect majority of the strings with our delimiters without calling preg_match
243
+ * @var int $pos_start
244
+ */
245
+ $pos_start = strpos( $string, WPGlobus::LOCALE_TAG_OPEN );
246
+ if ( false !== $pos_start ) {
247
+ if ( ctype_lower( $string[ $pos_start + 2 ] ) && ctype_lower( $string[ $pos_start + 3 ] ) ) {
248
+ return true;
249
+ }
250
+ }
251
+
252
+ /**
253
+ * For compatibility, etc. - the universal procedure with regexp
254
+ */
255
+
256
+ return (bool) preg_match( '/(\{:|\[:|<!--:)[a-z]{2}/', $string );
257
+ }
258
+
259
+ /**
260
+ * Keeps only one language in all textual fields of the `$post` object.
261
+ *
262
+ * @see \WPGlobus_Core::text_filter for the parameters description
263
+ *
264
+ * @param WP_Post|mixed $post The Post object. Object always passed by reference.
265
+ * @param string $language
266
+ * @param string $return
267
+ * @param string $default_language
268
+ */
269
+ public static function translate_wp_post(
270
+ &$post,
271
+ $language = '',
272
+ $return = WPGlobus::RETURN_IN_DEFAULT_LANGUAGE,
273
+ $default_language = ''
274
+ ) {
275
+
276
+ /**
277
+ * `$default_language` not passed
278
+ */
279
+ if ( ! $default_language ) {
280
+ if ( class_exists( 'WPGlobus_Config' ) ) {
281
+ $default_language = WPGlobus::Config()->default_language;
282
+ } else {
283
+ // When in unit tests
284
+ $default_language = 'en';
285
+ }
286
+ }
287
+
288
+ /**
289
+ * `$language` not passed
290
+ */
291
+ if ( empty( $language ) ) {
292
+ $language = $default_language;
293
+ }
294
+
295
+ $fields = array(
296
+ 'post_title',
297
+ 'post_content',
298
+ 'post_excerpt',
299
+ 'title',
300
+ 'attr_title',
301
+ );
302
+
303
+ foreach ( $fields as $field ) {
304
+ if ( ! empty( $post->$field ) ) {
305
+ $post->$field = self::text_filter( $post->$field, $language, $return, $default_language );
306
+ }
307
+ }
308
+
309
+ }
310
+
311
+ /**
312
+ * Translate a term (category, post_tag, etc.)
313
+ * Term can be an object (default for the @see wp_get_object_terms() filter)
314
+ * or a string (for example, when wp_get_object_terms is called with the 'fields'=>'names' argument)
315
+ *
316
+ * @param string|object $term
317
+ * @param string $language
318
+ */
319
+ public static function translate_term( &$term, $language = '' ) {
320
+ if ( is_object( $term ) ) {
321
+ if ( ! empty( $term->name ) ) {
322
+ $term->name = self::text_filter( $term->name, $language );
323
+ }
324
+ if ( ! empty( $term->description ) ) {
325
+ $term->description = self::text_filter( $term->description, $language );
326
+ }
327
+ } else {
328
+ if ( ! empty( $term ) ) {
329
+ $term = self::text_filter( $term, $language );
330
+ }
331
+ }
332
+
333
+ }
334
+
335
+
336
+ } // class
337
+
338
+ # --- EOF
trunk/includes/class-wpglobus-filters.php ADDED
@@ -0,0 +1,1257 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Filters and actions
4
+ * Only methods here. The add_filter calls are in the Controller
5
+ *
6
+ * @package WPGlobus
7
+ */
8
+
9
+ /**
10
+ * Class WPGlobus_Filters
11
+ */
12
+ class WPGlobus_Filters {
13
+
14
+ /** @var string[] Meta keys where data can be multilingual */
15
+ protected static $multilingual_meta_keys = array();
16
+
17
+ /**
18
+ * This is the basic filter used to extract the text portion in the current language from a string.
19
+ * Applied to the main WP texts, such as post title, content and excerpt.
20
+ *
21
+ * @param string $text
22
+ *
23
+ * @return string
24
+ */
25
+ public static function filter__text( $text ) {
26
+
27
+ return WPGlobus_Core::text_filter(
28
+ $text,
29
+ WPGlobus::Config()->language,
30
+ null,
31
+ WPGlobus::Config()->default_language
32
+ );
33
+
34
+ }
35
+
36
+ /**
37
+ * This filter is needed to display correctly the posts with the '--- MORE ---' separator
38
+ * in archives.
39
+ * Without it, the post content is truncated at the beginning of <!--more-->, thus keeping
40
+ * only the first language.
41
+ * *
42
+ * 'the_posts' filter is used by @see get_posts(), which is commonly used in all sorts of places,
43
+ * including, for instance, @see wp_get_associated_nav_menu_items while deleting a post.
44
+ * So, to minimize potential side effects, we limit the scope to main queries, or
45
+ * when the 'wpglobus_force_filter__the_posts' is set
46
+ * (@see WPGlobus_QA::_test_get_posts for example).
47
+ *
48
+ * @param array $posts
49
+ * @param WP_Query $query
50
+ *
51
+ * @return array
52
+ * @since 1.0.14
53
+ */
54
+ public static function filter__the_posts( $posts, $query ) {
55
+
56
+ if ( $query->is_main_query() || $query->get( 'wpglobus_force_filter__the_posts' ) ) {
57
+ foreach ( $posts as $post ) {
58
+ WPGlobus_Core::translate_wp_post(
59
+ $post,
60
+ WPGlobus::Config()->language,
61
+ WPGlobus::RETURN_IN_DEFAULT_LANGUAGE
62
+ );
63
+ }
64
+ }
65
+
66
+ return $posts;
67
+
68
+ }
69
+
70
+ /**
71
+ * This is similar to the @see filter__text filter,
72
+ * but it returns text in the DEFAULT language.
73
+ *
74
+ * @param string $text
75
+ *
76
+ * @return string
77
+ * @since 1.0.8
78
+ */
79
+ public static function filter__text_default_language( $text ) {
80
+
81
+ return WPGlobus_Core::text_filter(
82
+ $text,
83
+ WPGlobus::Config()->default_language,
84
+ null,
85
+ WPGlobus::Config()->default_language
86
+ );
87
+
88
+ }
89
+
90
+
91
+ /**
92
+ * Filter @see get_terms
93
+ *
94
+ * @scope admin
95
+ * @scope front
96
+ *
97
+ * @param string[]|object[] $terms
98
+ *
99
+ * @return array
100
+ */
101
+ public static function filter__get_terms( array $terms ) {
102
+
103
+ /**
104
+ * @todo Example of a "stopper" filter
105
+ * if ( apply_filters( 'wpglobus_do_filter__get_terms', true ) ) {}
106
+ * Because it might affect the performance, this is a to-do for now.
107
+ */
108
+
109
+ foreach ( $terms as &$_term ) {
110
+ WPGlobus_Core::translate_term( $_term, WPGlobus::Config()->language );
111
+ }
112
+ unset( $_term );
113
+
114
+ reset( $terms );
115
+
116
+ return $terms;
117
+ }
118
+
119
+ /**
120
+ * Filter @see get_the_terms
121
+ *
122
+ * @scope admin
123
+ *
124
+ * @param stdClass[]|WP_Error $terms List of attached terms, or WP_Error on failure.
125
+ *
126
+ * @return array
127
+ */
128
+ public static function filter__get_the_terms( $terms ) {
129
+
130
+ /**
131
+ * @internal 15.01.31
132
+ * Theoretically, we should not have this filter because @see get_the_terms
133
+ * calls @see wp_get_object_terms, which is already filtered.
134
+ * However, there is a case when the terms are retrieved from @see get_object_term_cache,
135
+ * and when we do a Quick Edit / inline-save, we ourselves write raw terms to the cache.
136
+ * As of now, we know only one such case, so we activate this filter only in admin,
137
+ * and only on the 'single_row' call
138
+ * @todo Keep watching this
139
+ */
140
+
141
+ if ( ! is_wp_error( $terms ) && WPGlobus_WP::is_function_in_backtrace( 'single_row' ) ) {
142
+
143
+ // Casting $terms to (array) causes syntax error in PHP 5.3 and older.
144
+ /* @noinspection ForeachSourceInspection */
145
+ foreach ( $terms as &$_term ) {
146
+ WPGlobus_Core::translate_term( $_term, WPGlobus::Config()->language );
147
+ }
148
+ unset( $_term );
149
+
150
+ reset( $terms );
151
+ }
152
+
153
+ return $terms;
154
+ }
155
+
156
+ /**
157
+ * Filter @see wp_get_object_terms()
158
+ *
159
+ * @scope admin
160
+ * @scope front
161
+ *
162
+ * @param string[]|stdClass[] $terms An array of terms for the given object or objects.
163
+ *
164
+ * @return array
165
+ */
166
+ public static function filter__wp_get_object_terms( array $terms ) {
167
+
168
+ /**
169
+ * @internal
170
+ * Do not need to check for is_wp_error($terms),
171
+ * because the WP_Error is returned by wp_get_object_terms() before applying filter.
172
+ */
173
+
174
+ if ( ! count( $terms ) ) {
175
+ return $terms;
176
+ }
177
+
178
+ /**
179
+ * Don't filter term names when saving or publishing posts
180
+ *
181
+ * @todo Check this before add_filter and not here
182
+ * @todo Describe exactly how to check this visually, and is possible - write the acceptance test
183
+ */
184
+ if (
185
+ is_admin() &&
186
+ WPGlobus_WP::is_pagenow( 'post.php' ) &&
187
+ ( ! empty( $_POST['save'] ) || ! empty( $_POST['publish'] ) ) // phpcs:ignore WordPress.CSRF.NonceVerification
188
+ ) {
189
+ return $terms;
190
+ }
191
+
192
+ /**
193
+ * Don't filter term names for trash and un-trash single post
194
+ *
195
+ * @see we check post.php page instead of edit.php because redirect
196
+ */
197
+ if ( is_admin() && WPGlobus_WP::is_pagenow( 'post.php' ) && isset( $_GET['action'] ) && ( 'trash' === $_GET['action'] || 'untrash' === $_GET['action'] ) // phpcs:ignore WordPress.CSRF.NonceVerification
198
+ ) {
199
+ return $terms;
200
+ }
201
+
202
+ /**
203
+ * Don't filter term names bulk trash and untrash posts
204
+ */
205
+ if ( is_admin() && WPGlobus_WP::is_pagenow( 'edit.php' ) && isset( $_GET['action'] ) && ( 'trash' === $_GET['action'] || 'untrash' === $_GET['action'] ) // phpcs:ignore WordPress.CSRF.NonceVerification
206
+ ) {
207
+ return $terms;
208
+ }
209
+
210
+ /**
211
+ * Don't filter term names for bulk edit post from edit.php page
212
+ */
213
+ if ( is_admin() && WPGlobus_WP::is_function_in_backtrace( 'bulk_edit_posts' ) ) {
214
+ return $terms;
215
+ }
216
+
217
+ /**
218
+ * Don't filter term names for inline-save ajax action from edit.php page
219
+ *
220
+ * @see wp_ajax_inline_save
221
+ * ...except when the same AJAX refreshes the table row @see WP_Posts_List_Table::single_row
222
+ * -
223
+ * @qa At the "All posts" admin page, do Quick Edit on any post. After update, categories and tags
224
+ * must not show multilingual strings with delimiters.
225
+ * @qa At Quick Edit, enter an existing tag. After save, check if there is no additional tag
226
+ * on the "Tags" page. If a new tag is created then the "is tag exists" check was checking
227
+ * only a single language representation of the tag, while there is a multilingual tag in the DB.
228
+ */
229
+ if ( WPGlobus_WP::is_http_post_action( 'inline-save' ) &&
230
+ WPGlobus_WP::is_pagenow( 'admin-ajax.php' )
231
+ ) {
232
+ if ( ! WPGlobus_WP::is_function_in_backtrace( 'single_row' ) ) {
233
+ return $terms;
234
+ }
235
+ }
236
+
237
+ /**
238
+ * Don't filter term names for heartbeat autosave
239
+ */
240
+ if ( WPGlobus_WP::is_http_post_action( 'heartbeat' ) &&
241
+ WPGlobus_WP::is_pagenow( 'admin-ajax.php' ) &&
242
+ ! empty( $_POST['data']['wp_autosave'] ) // phpcs:ignore WordPress.CSRF
243
+ ) {
244
+ return $terms;
245
+ }
246
+
247
+ /**
248
+ * Don't filter term name at time generate checklist categories in metabox
249
+ */
250
+ if (
251
+ empty( $_POST ) && // phpcs:ignore WordPress.CSRF
252
+ is_admin() &&
253
+ WPGlobus_WP::is_pagenow( 'post.php' ) &&
254
+ WPGlobus_WP::is_function_in_backtrace( 'wp_terms_checklist' )
255
+ ) {
256
+ return $terms;
257
+ }
258
+
259
+ foreach ( $terms as &$_term ) {
260
+ WPGlobus_Core::translate_term( $_term, WPGlobus::Config()->language );
261
+ }
262
+ unset( $_term );
263
+
264
+ reset( $terms );
265
+
266
+ return $terms;
267
+ }
268
+
269
+ /**
270
+ * This filter is needed to build correct permalink (slug, post_name)
271
+ * using only the main part of the post title (in the default language).
272
+ * -
273
+ * Because 'sanitize_title' is a commonly used function, we have to apply our filter
274
+ * only on very specific calls. Therefore, there are (ugly) debug_backtrace checks.
275
+ * -
276
+ * Case 1
277
+ * When a draft post is created,
278
+ * the post title is converted to the slug in the @see get_sample_permalink function,
279
+ * using the 'sanitize_title' filter.
280
+ * -
281
+ * Case 2
282
+ * When the draft is published, @see wp_insert_post calls
283
+ *
284
+ * @see sanitize_title to set the slug
285
+ * -
286
+ * @see WPGLobus_QA::_test_post_name
287
+ * -
288
+ * @see WPSEO_Metabox::localize_script
289
+ * @todo Check what's going on in localize_script of WPSEO?
290
+ * @todo What if there is no EN language? Only ru and kz but - we cannot use 'en' for permalink
291
+ * @todo check guid
292
+ *
293
+ * @param string $title
294
+ *
295
+ * @return string
296
+ */
297
+ public static function filter__sanitize_title( $title ) {
298
+
299
+ if (
300
+ WPGlobus_WP::is_filter_called_by( 'get_sample_permalink' ) ||
301
+ WPGlobus_WP::is_filter_called_by( 'wp_insert_post' ) ||
302
+ WPGlobus_WP::is_filter_called_by( 'wp_update_term' )
303
+ ) {
304
+ /**
305
+ * @internal_note: the DEFAULT language, not the current one
306
+ */
307
+ $title = WPGlobus_Core::text_filter(
308
+ $title, WPGlobus::Config()->default_language
309
+ );
310
+ }
311
+
312
+ return $title;
313
+ }
314
+
315
+ /**
316
+ * Filter @see get_term()
317
+ *
318
+ * @param string|object $term
319
+ *
320
+ * @return string|object
321
+ */
322
+ public static function filter__get_term( $term ) {
323
+
324
+ if ( WPGlobus_WP::is_http_post_action( 'inline-save-tax' ) ) { // phpcs:ignore Generic
325
+ /**
326
+ * Don't filter ajax action 'inline-save-tax' from edit-tags.php page.
327
+ * See quick_edit() in includes/js/wpglobus.admin.js
328
+ * for and example of working with taxonomy name and description
329
+ * wp_current_filter contains
330
+ * 0=wp_ajax_inline-save-tax
331
+ * 1=get_term
332
+ *
333
+ * @see wp_ajax_inline_save_tax()
334
+ */
335
+ // do nothing
336
+ } else {
337
+ WPGlobus_Core::translate_term( $term, WPGlobus::Config()->language );
338
+ }
339
+
340
+ return $term;
341
+
342
+ }
343
+
344
+ /**
345
+ * Filter @see get_terms_to_edit()
346
+ *
347
+ * @since 1.6.4
348
+ *
349
+ * @param string
350
+ *
351
+ * @return string
352
+ */
353
+ public static function filter__terms_to_edit( $terms_to_edit ) {
354
+
355
+ if ( ! WPGlobus_Core::has_translations( $terms_to_edit ) ) {
356
+ return $terms_to_edit;
357
+ }
358
+
359
+ $terms = explode( ',', $terms_to_edit );
360
+
361
+ foreach ( $terms as $k => $term ) {
362
+ $terms[ $k ] = WPGlobus_Core::text_filter( $term, WPGlobus::Config()->language );
363
+ }
364
+
365
+ return implode( ',', $terms );
366
+ }
367
+
368
+ /**
369
+ * Filter @see wp_insert_term().
370
+ *
371
+ * @since 1.6.6
372
+ *
373
+ * @param string $term The term to add or update.
374
+ * @param string $taxonomy Taxonomy slug.
375
+ *
376
+ * @return string
377
+ */
378
+ public static function filter__pre_insert_term(
379
+ $term,
380
+ /** @noinspection PhpUnusedParameterInspection */
381
+ $taxonomy
382
+ ) {
383
+
384
+ $multilingual_term = esc_sql( $term );
385
+ if ( WPGlobus::Config()->language !== WPGlobus::Config()->default_language ) {
386
+ $multilingual_term = WPGlobus_Utils::build_multilingual_string( array( WPGlobus::Config()->language => $term ) );
387
+ }
388
+
389
+ global $wpdb;
390
+ // phpcs:ignore WordPress.WP.PreparedSQL
391
+ $data = $wpdb->get_results( "SELECT * FROM $wpdb->terms AS terms WHERE terms.name LIKE '%{$multilingual_term}%'" );
392
+
393
+ if ( count( $data ) > 0 ) {
394
+ /**
395
+ * Return empty to prevent creating duplicate term.
396
+ *
397
+ * @see wp_insert_term() in wp-includes\taxonomy.php
398
+ */
399
+ return '';
400
+ }
401
+
402
+ return $term;
403
+ }
404
+
405
+ /**
406
+ * Localize home_url
407
+ * Should be processed on:
408
+ * - front
409
+ * - AJAX, except for several specific actions
410
+ *
411
+ * @param string $url
412
+ *
413
+ * @return string
414
+ */
415
+ public static function filter__home_url( $url ) {
416
+
417
+ /**
418
+ * @internal note
419
+ * Example of URL in admin:
420
+ * When admin interface is not in default language, we still should not see
421
+ * any permalinks with language prefixes.
422
+ * For that, we could check if we are at the 'post.php' screen:
423
+ * if ( 'post.php' == $pagenow ) ....
424
+ * However, we do not need it, because we disallowed almost any processing in admin.
425
+ */
426
+
427
+ /**
428
+ * 1. Do not work in admin
429
+ */
430
+ $need_to_process = ( ! is_admin() );
431
+
432
+ if ( WPGlobus_WP::is_pagenow( 'admin-ajax.php' ) ) {
433
+ /**
434
+ * 2. But work in AJAX, which is also admin
435
+ */
436
+ $need_to_process = true;
437
+
438
+ /**
439
+ * 3. However, don't convert url for these AJAX actions:
440
+ */
441
+ if ( WPGlobus_WP::is_http_post_action(
442
+ array(
443
+ 'heartbeat',
444
+ 'sample-permalink',
445
+ 'add-menu-item',
446
+ )
447
+ )
448
+ ) {
449
+ $need_to_process = false;
450
+ }
451
+ }
452
+
453
+ if ( $need_to_process ) {
454
+ $url = WPGlobus_Utils::localize_url( $url );
455
+ }
456
+
457
+ return $url;
458
+ }
459
+
460
+ /**
461
+ * Filter @see get_pages
462
+ *
463
+ * @qa See a list of available pages in the "Parent Page" metabox when editing a page.
464
+ *
465
+ * @param WP_Post[] $pages
466
+ *
467
+ * @return WP_Post[]
468
+ */
469
+ public static function filter__get_pages( $pages ) {
470
+
471
+ foreach ( $pages as &$_page ) {
472
+ WPGlobus_Core::translate_wp_post( $_page, WPGlobus::Config()->language );
473
+ }
474
+ unset( $_page );
475
+
476
+ reset( $pages );
477
+
478
+ return $pages;
479
+ }
480
+
481
+ /**
482
+ * Filter for @see get_locale
483
+ *
484
+ * @param string $locale
485
+ *
486
+ * @return string
487
+ * @todo Do we need to do setlocale(LC_???, $locale)? (*** NOT HERE )
488
+ * @see setlocale
489
+ * @link http://php.net/manual/en/function.setlocale.php
490
+ * @example echo setlocale(LC_ALL, 'Russian'); => Russian_Russia.1251
491
+ */
492
+ public static function filter__get_locale(
493
+ /** @noinspection PhpUnusedParameterInspection */
494
+ $locale
495
+ ) {
496
+
497
+ /**
498
+ * @todo This caching breaks the admin language switcher.
499
+ */
500
+ /* static $cached_locale = null;
501
+ if ( null !== $cached_locale ) {
502
+ return $cached_locale;
503
+ }*/
504
+
505
+ /**
506
+ * Special case: in admin area, show everything in the language of admin interface.
507
+ * (set in the General Settings in WP 4.1)
508
+ */
509
+ /**
510
+ * @internal
511
+ * We need to exclude is_admin when it's a front-originated AJAX,
512
+ * so we are doing a "hack" checking @see WPGlobus_WP::is_admin_doing_ajax.
513
+ */
514
+ if (
515
+ is_admin() &&
516
+ ( ! WPGlobus_WP::is_doing_ajax() || WPGlobus_WP::is_admin_doing_ajax() )
517
+ && apply_filters( 'wpglobus_use_admin_wplang', true )
518
+ ) {
519
+ /**
520
+ * @todo is_multisite
521
+ * @todo Pre-WP4, WPLANG constant from wp-config
522
+ */
523
+ $WPLANG = get_option( 'WPLANG' );
524
+ if ( empty( $WPLANG ) ) {
525
+ $WPLANG = 'en_US';
526
+ }
527
+ WPGlobus::Config()->set_language( $WPLANG );
528
+
529
+ }
530
+
531
+ if ( is_admin() ) {
532
+ /**
533
+ * Checking case for set locale which does not set in WPGlobus
534
+ */
535
+ if ( WPGlobus::Config()->is_enabled_locale( $locale ) ) {
536
+ $locale = WPGlobus::Config()->locale[ WPGlobus::Config()->language ];
537
+ }
538
+ } else {
539
+ $locale = WPGlobus::Config()->locale[ WPGlobus::Config()->language ];
540
+ }
541
+
542
+ /* $cached_locale = $locale;*/
543
+
544
+ return $locale;
545
+
546
+ }
547
+
548
+ /**
549
+ * Filter @see wp_setup_nav_menu_item in wp-includes\nav-menu.php for more info
550
+ *
551
+ * @since 1.0.0
552
+ *
553
+ * @param WP_Post[] $object
554
+ *
555
+ * @return WP_Post[]
556
+ */
557
+ public static function filter__nav_menu_item( $object ) {
558
+ /**
559
+ * This filter is used at nav-menus.php page for .field-move elements
560
+ */
561
+ if ( is_object( $object ) && 'WP_Post' === get_class( $object ) ) {
562
+
563
+ if ( ! empty( $object->title ) ) {
564
+ $object->title = WPGlobus_Core::text_filter( $object->title, WPGlobus::Config()->language );
565
+ }
566
+ if ( ! empty( $object->description ) ) {
567
+ $object->description = WPGlobus_Core::text_filter( $object->description, WPGlobus::Config()->language );
568
+ }
569
+ }
570
+
571
+ return $object;
572
+ }
573
+
574
+ /**
575
+ * Filter @see nav_menu_description
576
+ *
577
+ * @since 1.0.0
578
+ *
579
+ * @param string $description
580
+ *
581
+ * @return string
582
+ */
583
+ public static function filter__nav_menu_description( $description ) {
584
+ /**
585
+ * This filter for translate menu item description
586
+ */
587
+ if ( ! empty( $description ) ) {
588
+ $description = WPGlobus_Core::text_filter( $description, WPGlobus::Config()->language );
589
+ }
590
+
591
+ return $description;
592
+ }
593
+
594
+ /**
595
+ * Filter @see heartbeat_received
596
+ *
597
+ * @since 1.0.1
598
+ *
599
+ * @param array $response
600
+ * @param array $data
601
+ * @param string $screen_id
602
+ *
603
+ * @return array
604
+ */
605
+ public static function filter__heartbeat_received(
606
+ $response, $data,
607
+ /** @noinspection PhpUnusedParameterInspection */
608
+ $screen_id
609
+ ) {
610
+
611
+ if ( false !== strpos( $_SERVER['HTTP_REFERER'], 'wpglobus=off' ) ) { // WPCS: input var ok, sanitization ok.
612
+ /**
613
+ * Check $_SERVER['HTTP_REFERER'] for wpglobus toggle is off because wpglobus-admin.js doesn't loaded in this mode
614
+ */
615
+ return $response;
616
+ }
617
+
618
+ if ( ! empty( $data['wp_autosave'] ) ) {
619
+
620
+ if ( empty( $data['wp_autosave']['post_id'] ) || 0 === (int) $data['wp_autosave']['post_id'] ) {
621
+ /**
622
+ * wp_autosave may come from edit.php page
623
+ */
624
+ return $response;
625
+ }
626
+
627
+ if ( empty( $data['wpglobus_heartbeat'] ) ) {
628
+ /**
629
+ * Check for wpglobus key
630
+ */
631
+ return $response;
632
+ }
633
+
634
+ $title_wrap = false;
635
+ $content_wrap = false;
636
+ $post_title_ext = '';
637
+ $content_ext = '';
638
+
639
+ foreach ( WPGlobus::Config()->enabled_languages as $language ) {
640
+ if ( WPGlobus::Config()->default_language === $language ) {
641
+
642
+ $post_title_ext .= WPGlobus::add_locale_marks( $data['wp_autosave']['post_title'], $language );
643
+ $content_ext .= WPGlobus::add_locale_marks( $data['wp_autosave']['content'], $language );
644
+
645
+ } else {
646
+
647
+ if ( ! empty( $data['wp_autosave'][ 'post_title_' . $language ] ) ) {
648
+ $title_wrap = true;
649
+
650
+ $post_title_ext .= WPGlobus::add_locale_marks( $data['wp_autosave'][ 'post_title_' . $language ], $language );
651
+ }
652
+
653
+ if ( ! empty( $data['wp_autosave'][ 'content_' . $language ] ) ) {
654
+ $content_wrap = true;
655
+
656
+ $content_ext .= WPGlobus::add_locale_marks( $data['wp_autosave'][ 'content_' . $language ], $language );
657
+ }
658
+ }
659
+ }
660
+
661
+ if ( $title_wrap ) {
662
+ $data['wp_autosave']['post_title'] = $post_title_ext;
663
+ }
664
+
665
+ if ( $content_wrap ) {
666
+ $data['wp_autosave']['content'] = $content_ext;
667
+ }
668
+
669
+ /**
670
+ * Filter before autosave
671
+ *
672
+ * @since 1.0.2
673
+ *
674
+ * @param array $data ['wp_autosave'] Array of post data.
675
+ */
676
+ $data['wp_autosave'] = apply_filters( 'wpglobus_autosave_post_data', $data['wp_autosave'] );
677
+
678
+ $saved = wp_autosave( $data['wp_autosave'] );
679
+
680
+ if ( is_wp_error( $saved ) ) {
681
+ $response['wp_autosave'] = array(
682
+ 'success' => false,
683
+ 'message' => $saved->get_error_message(),
684
+ );
685
+ } elseif ( empty( $saved ) ) {
686
+ $response['wp_autosave'] = array(
687
+ 'success' => false,
688
+ 'message' => __( 'Error while saving.' ),
689
+ );
690
+ } else {
691
+ $draft_saved_date_format = __( 'g:i:s a' );
692
+ $response['wp_autosave'] = array(
693
+ 'success' => true,
694
+ 'message' => sprintf(
695
+ __( 'Draft saved at %s.' ), date_i18n( $draft_saved_date_format )
696
+ ),
697
+ );
698
+ }
699
+ }
700
+
701
+ return $response;
702
+ }
703
+
704
+ /**
705
+ * Filter @see wp_nav_menu_objects
706
+ *
707
+ * @since 1.0.2
708
+ *
709
+ * @param array $object
710
+ *
711
+ * @return array
712
+ */
713
+ public static function filter__nav_menu_objects( $object ) {
714
+
715
+ if ( is_array( $object ) ) {
716
+ foreach ( $object as &$post ) {
717
+ if ( ! empty( $post->attr_title ) ) {
718
+ $post->attr_title = WPGlobus_Core::text_filter( $post->attr_title, WPGlobus::Config()->language );
719
+ }
720
+ }
721
+ }
722
+
723
+ return $object;
724
+
725
+ }
726
+
727
+ /**
728
+ * Translate widget strings (besides the title handled by the `widget_title` filter)
729
+ *
730
+ * @see WP_Widget::display_callback
731
+ * @scope front
732
+ *
733
+ * @param string[] $instance
734
+ *
735
+ * @return string[]
736
+ * @since 1.0.6
737
+ */
738
+ public static function filter__widget_display_callback( $instance ) {
739
+
740
+ foreach ( $instance as &$widget_setting ) {
741
+
742
+ /** @noinspection ReferenceMismatchInspection */
743
+ if ( ! empty( $widget_setting ) && is_string( $widget_setting ) ) {
744
+ $widget_setting =
745
+ WPGlobus_Core::text_filter( $widget_setting, WPGlobus::Config()->language );
746
+ }
747
+ }
748
+
749
+ return $instance;
750
+ }
751
+
752
+ /**
753
+ * Filter @see comment_moderation_text,
754
+ *
755
+ * @see comment_moderation_subject
756
+ * @since 1.0.6
757
+ *
758
+ * @param string $text
759
+ * @param int $comment_id
760
+ *
761
+ * @return string
762
+ */
763
+ public static function filter__comment_moderation( $text, $comment_id ) {
764
+
765
+ $comment = get_comment( $comment_id );
766
+ $post = get_post( $comment->comment_post_ID );
767
+ $title = WPGlobus_Core::text_filter( $post->post_title, WPGlobus::Config()->language );
768
+
769
+ return str_replace( $post->post_title, $title, $text );
770
+
771
+ }
772
+
773
+ /**
774
+ * Filter @see wp_trim_words
775
+ *
776
+ * @qa At the /wp-admin/index.php page is a Quick Draft metabox
777
+ * which shows 3 last post drafts. This filter lets post content in default language.
778
+ * @since 1.0.14
779
+ *
780
+ * @param string $text The trimmed text.
781
+ * @param int $num_words The number of words to trim the text to.
782
+ * @param string $more An optional string to append to the end of the trimmed text, e.g. &hellip;.
783
+ * @param string $original_text The text before it was trimmed.
784
+ *
785
+ * @return string
786
+ */
787
+ public static function filter__wp_trim_words(
788
+ /** @noinspection PhpUnusedParameterInspection */
789
+ $text, $num_words, $more, $original_text
790
+ ) {
791
+
792
+ // Method argument is ignored.
793
+ /* @noinspection SuspiciousAssignmentsInspection */
794
+ $text = WPGlobus_Core::text_filter( $original_text, WPGlobus::Config()->language );
795
+
796
+ if ( null === $more ) {
797
+ $more = __( '&hellip;' );
798
+ }
799
+
800
+ $text = wp_strip_all_tags( $text );
801
+ if ( 'characters' == _x( 'words', 'word count: words or characters?' ) && preg_match( '/^utf\-?8$/i', get_option( 'blog_charset' ) ) ) {//phpcs:ignore WordPress.PHP.StrictComparisons
802
+ $text = trim( preg_replace( "/[\n\r\t ]+/", ' ', $text ), ' ' );
803
+ preg_match_all( '/./u', $text, $words_array );
804
+ $words_array = array_slice( $words_array[0], 0, $num_words + 1 );
805
+ $sep = '';
806
+ } else {
807
+ $words_array = preg_split( "/[\n\r\t ]+/", $text, $num_words + 1, PREG_SPLIT_NO_EMPTY );
808
+ $sep = ' ';
809
+ }
810
+ if ( count( $words_array ) > $num_words ) {
811
+ array_pop( $words_array );
812
+ $text = implode( $sep, $words_array );
813
+ $text = $text . $more;
814
+ } else {
815
+ $text = implode( $sep, $words_array );
816
+ }
817
+
818
+ return $text;
819
+
820
+ }
821
+
822
+ /**
823
+ * Register the WPGlobus widgets
824
+ *
825
+ * @wp-hook widgets_init
826
+ * @since 1.0.7
827
+ */
828
+ public static function register_widgets() {
829
+ register_widget( 'WPGlobusWidget' );
830
+ }
831
+
832
+ /**
833
+ * Do something on admin_init hook.
834
+ *
835
+ * @todo Note: runs on admin-ajax and admin-post, too
836
+ */
837
+ public static function action__admin_init() {
838
+ /**
839
+ * Display blog name correctly on the WooThemes Helper page
840
+ * wp-admin/index.php?page=woothemes-helper
841
+ */
842
+ if ( WPGlobus_WP::is_plugin_page( 'woothemes-helper' ) ) {
843
+ add_filter( 'option_blogname', array( 'WPGlobus_Filters', 'filter__text' ), 0 );
844
+ }
845
+ }
846
+
847
+ /**
848
+ * Specify meta keys where the meta data can be multilingual.
849
+ *
850
+ * @example
851
+ * <code>
852
+ * add_filter( 'wpglobus_multilingual_meta_keys',
853
+ * function ( $multilingual_meta_keys ) {
854
+ * $multilingual_meta_keys['slides'] = true;
855
+ * return $multilingual_meta_keys;
856
+ * }
857
+ * );
858
+ * </code>
859
+ * @since 1.2.1
860
+ */
861
+ public static function set_multilingual_meta_keys() {
862
+
863
+ /**
864
+ * Add Alternative Text meta value for media.
865
+ * We need to use only one meta because Title, Caption and Description was stored in wp_posts table.
866
+ *
867
+ * @todo may be to use another class to store keys for $multilingual_meta_keys in future version.
868
+ *
869
+ * @since 1.9.11
870
+ */
871
+ self::$multilingual_meta_keys['_wp_attachment_image_alt'] = true;
872
+
873
+ self::$multilingual_meta_keys = apply_filters(
874
+ 'wpglobus_multilingual_meta_keys', self::$multilingual_meta_keys
875
+ );
876
+ }
877
+
878
+ /**
879
+ * Translate meta data
880
+ *
881
+ * @see \WPGlobus_Filters::set_multilingual_meta_keys
882
+ *
883
+ * @param string|array $value Null is passed. We set the value.
884
+ * @param int $object_id Post ID
885
+ * @param string $meta_key Passed by the filter. We need only one key.
886
+ * @param string|array $single Meta value, or an array of values.
887
+ *
888
+ * @return string|array
889
+ */
890
+ public static function filter__postmeta( $value, $object_id, $meta_key, $single ) {
891
+
892
+ /**
893
+ * @todo Currently, only single values are supported
894
+ */
895
+ if ( ! $single ) {
896
+ return $value;
897
+ }
898
+
899
+ /**
900
+ * Will process only if the `meta_key` is one of the explicitly set.
901
+ */
902
+ if ( ! isset( self::$multilingual_meta_keys[ $meta_key ] ) ) {
903
+ return $value;
904
+ }
905
+
906
+ /**
907
+ * May be called many times on one page. Let's cache.
908
+ */
909
+ static $_cache;
910
+ if ( isset( $_cache[ $meta_key ][ $object_id ] ) ) {
911
+ return $_cache[ $meta_key ][ $object_id ];
912
+ }
913
+
914
+ /** @global wpdb $wpdb */
915
+ global $wpdb;
916
+ $meta_value = $wpdb->get_var(
917
+ $wpdb->prepare(
918
+ "SELECT meta_value FROM $wpdb->postmeta WHERE meta_key = %s AND post_id = %d LIMIT 1;",
919
+ $meta_key, $object_id
920
+ )
921
+ );
922
+
923
+ if ( $meta_value ) {
924
+
925
+ if ( is_serialized( $meta_value ) ) {
926
+ /**
927
+ * @todo Refactor this. Write a `filter__array` method.
928
+ */
929
+ $_meta_array = unserialize( $meta_value ); //phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions
930
+ foreach ( $_meta_array as &$_value ) {
931
+ if ( is_array( $_value ) ) {
932
+ foreach ( $_value as &$_deep_value ) {
933
+ /**
934
+ * @todo Assuming that the array had max. two levels, which is wrong.
935
+ */
936
+ $_deep_value = self::filter__text( $_deep_value );
937
+ }
938
+ unset( $_deep_value );
939
+ } else {
940
+ $_value = self::filter__text( $_value );
941
+ }
942
+ }
943
+ unset( $_value );
944
+ $value = $_meta_array;
945
+
946
+ /**
947
+ * If single is requested, the following code is executed by
948
+ *
949
+ * @see get_metadata
950
+ * <code>
951
+ * if ( $single && is_array( $check ) )
952
+ * return $check[0];
953
+ * </code>
954
+ * Therefore, we need to return the entire `$value` as the first element of
955
+ * an array.
956
+ */
957
+ if ( $single ) {
958
+ $value = array( $value );
959
+ }
960
+ } else {
961
+ $value = self::filter__text( $meta_value );
962
+ }
963
+ }
964
+
965
+ /**
966
+ * Save to cache, even if we did not do anything
967
+ */
968
+ $_cache[ $meta_key ][ $object_id ] = $value;
969
+
970
+ return $value;
971
+ }
972
+
973
+ /**
974
+ * Localize feed url
975
+ *
976
+ * @since 1.5.3
977
+ *
978
+ * @scope both (RSS are shown in admin dashboard "News" widgets).
979
+ *
980
+ * @param SimplePie $obj
981
+ */
982
+ public static function fetch_feed_options( $obj ) {
983
+
984
+ $need_to_localize = true;
985
+ /**
986
+ * Filter to disable localize feed url.
987
+ *
988
+ * @since 1.5.3
989
+ *
990
+ * @param bool $need_to_localize True is value by default.
991
+ * @param SimplePie $obj The feed object.
992
+ *
993
+ * @return bool
994
+ */
995
+ $need_to_localize = apply_filters( 'wpglobus_localize_feed_url', $need_to_localize, $obj );
996
+
997
+ if ( ! empty( $obj->feed_url ) && $need_to_localize ) {
998
+ $obj->feed_url = WPGlobus_Utils::localize_url( $obj->feed_url );
999
+ }
1000
+
1001
+ }
1002
+
1003
+ /**
1004
+ * Filter CSS rules for frontend.
1005
+ *
1006
+ * @since 1.6.6
1007
+ *
1008
+ * @scope front
1009
+ *
1010
+ * @param string $css
1011
+ * @param string $css_editor
1012
+ *
1013
+ * @return string
1014
+ */
1015
+ public static function filter__front_styles( $css, $css_editor ) {
1016
+ if ( ! empty( $css_editor ) ) {
1017
+ $css .= strip_tags( $css_editor );
1018
+ }
1019
+
1020
+ return $css;
1021
+ }
1022
+
1023
+ /**
1024
+ * De-localize URL to the default language so that @see url_to_postid() can
1025
+ * determine the post ID.
1026
+ *
1027
+ * @since 1.8.4
1028
+ *
1029
+ * @param string $url The URL to derive the post ID from.
1030
+ *
1031
+ * @return string
1032
+ */
1033
+ public static function filter__url_to_postid( $url ) {
1034
+ $url = WPGlobus_Utils::localize_url( $url, WPGlobus::Config()->default_language );
1035
+
1036
+ return $url;
1037
+ }
1038
+
1039
+ /**
1040
+ * The post ID has been changed already by the @see filter__url_to_postid,
1041
+ * so we do not need to modify it here.
1042
+ * However, oembed does not know which language to use to fill in its $data
1043
+ * from the post.
1044
+ * Therefore, we use a workaround: extract the language from the URL and
1045
+ * store it in a special variable, to use later in
1046
+ *
1047
+ * @see filter__oembed_response_data.
1048
+ *
1049
+ * @since 1.8.4
1050
+ *
1051
+ * @param int $post_id The post ID.
1052
+ * @param string $url The requested URL.
1053
+ *
1054
+ * @return int The post ID, unchanged.
1055
+ */
1056
+ public static function filter__oembed_request_post_id( $post_id, $url ) {
1057
+ $language = WPGlobus_Utils::extract_language_from_url( $url );
1058
+ if ( WPGlobus::Config()->default_language !== $language ) {
1059
+ WPGlobus::Config()->setLanguageForOembed( $language );
1060
+ }
1061
+
1062
+ return $post_id;
1063
+ }
1064
+
1065
+ /**
1066
+ * Filter the oembed data returned by the /wp-json/oembed/... calls.
1067
+ *
1068
+ * @param array $data The response data.
1069
+ *
1070
+ * @return array
1071
+ * @since 1.8.4
1072
+ */
1073
+ public static function filter__oembed_response_data( $data ) {
1074
+ // If $language_for_oembed is empty, text_filter will use the default language.
1075
+ $language_for_oembed = WPGlobus::Config()->getAndResetLanguageForOembed();
1076
+ foreach ( array( 'author_name', 'title' ) as $field ) {
1077
+ if ( ! empty( $data[ $field ] ) ) {
1078
+ $data[ $field ] = WPGlobus_Core::text_filter( $data[ $field ], $language_for_oembed );
1079
+ }
1080
+ }
1081
+
1082
+ return $data;
1083
+ }
1084
+
1085
+ /**
1086
+ * Filters the wp_mail() arguments.
1087
+ *
1088
+ * @see wp-includes\pluggable.php
1089
+ *
1090
+ * @param array $atts A compacted array of wp_mail() arguments.
1091
+ *
1092
+ * @return array
1093
+ * @since 1.9.5
1094
+ */
1095
+ public static function filter__wp_mail( $atts ) {
1096
+
1097
+ /**
1098
+ * May be called many times. Let's cache.
1099
+ */
1100
+ /*
1101
+ static $_cache;
1102
+ if ( isset( $_cache ) ) {
1103
+ return $_cache;
1104
+ } // */
1105
+
1106
+ /**
1107
+ * Array of enabled attributes to translate.
1108
+ * Full array is 'to', 'subject', 'message', 'headers', 'attachments';
1109
+ */
1110
+ $keys = array( 'subject', 'message', 'headers' );
1111
+
1112
+ foreach ( $keys as $key ) :
1113
+
1114
+ if ( empty( $atts[ $key ] ) ) {
1115
+ continue;
1116
+ }
1117
+
1118
+ if ( 'message' === $key ) {
1119
+ $atts[ $key ] = str_replace( "\n", '[[wpg-newline]]', $atts[ $key ] );
1120
+ }
1121
+
1122
+ $atts[ $key ] = WPGlobus_Core::extract_text( $atts[ $key ], WPGlobus::Config()->default_language );
1123
+
1124
+ if ( 'message' === $key ) {
1125
+ $atts[ $key ] = str_replace( '[[wpg-newline]]', "\n", $atts[ $key ] );
1126
+ }
1127
+
1128
+ endforeach;
1129
+
1130
+ /**
1131
+ * Save to cache.
1132
+ */
1133
+ // $_cache = $atts;
1134
+
1135
+ return $atts;
1136
+ }
1137
+
1138
+ /**
1139
+ * Filters oEmbed HTML.
1140
+ *
1141
+ * @param mixed $cache The cached HTML result, stored in post meta.
1142
+ * @param string $url The attempted embed URL.
1143
+ * @param array $attr An array of shortcode attributes.
1144
+ * @param int $post_ID Post ID.
1145
+ *
1146
+ * @return string
1147
+ * @since 1.9.8
1148
+ */
1149
+ public static function filter__embed_oembed_html(
1150
+ $cache, $url,
1151
+ /** @noinspection PhpUnusedParameterInspection */
1152
+ $attr,
1153
+ /** @noinspection PhpUnusedParameterInspection */
1154
+ $post_ID
1155
+ ) {
1156
+
1157
+ if ( ! is_string( $cache ) ) {
1158
+ /**
1159
+ * @since 1.9.8. We are working with string.
1160
+ */
1161
+ return $cache;
1162
+ }
1163
+
1164
+ $language = WPGlobus_Utils::extract_language_from_url( $url );
1165
+
1166
+ if ( empty( $language ) ) {
1167
+ /**
1168
+ * URL has no language code. So this is default language.
1169
+ */
1170
+ return $cache;
1171
+ }
1172
+
1173
+ $cache = str_replace( WPGlobus_Utils::localize_url( $url, WPGlobus::Config()->default_language ), $url, $cache );
1174
+
1175
+ return $cache;
1176
+ }
1177
+
1178
+ /**
1179
+ * Filters a 'wpseo_taxonomy_meta' option before its value is updated.
1180
+ *
1181
+ * @since 2.0
1182
+ *
1183
+ * @param mixed $new_value The new, unserialized option value.
1184
+ * @param mixed $old_value The old option value.
1185
+ * @param string $option Option name.
1186
+ *
1187
+ * @return mixed
1188
+ */
1189
+ public static function filter__pre_update_wpseo_taxonomy_meta(
1190
+ $new_value,
1191
+ /** @noinspection PhpUnusedParameterInspection */
1192
+ $old_value,
1193
+ /** @noinspection PhpUnusedParameterInspection */
1194
+ $option
1195
+ ) {
1196
+
1197
+ global $pagenow;
1198
+
1199
+ if ( 'edit-tags.php' === $pagenow && 'editedtag' === $_POST['action'] ) { // phpcs:ignore WordPress.CSRF.NonceVerification
1200
+ /**
1201
+ * Update button was clicked on term.php page.
1202
+ */
1203
+ $current_language = WPGlobus::Config()->builder->get_language();
1204
+ $taxonomy = WPGlobus::Config()->builder->get( 'taxonomy' );
1205
+ $tag_ID = (int) $_POST['tag_ID'];
1206
+
1207
+ $_enabled_keys = array( 'wpseo_title', 'wpseo_desc', 'wpseo_focuskw' );
1208
+
1209
+ /**
1210
+ * Get option.
1211
+ */
1212
+ global $wpdb;
1213
+ $query = "SELECT option_value FROM $wpdb->options WHERE option_name = 'wpseo_taxonomy_meta'";
1214
+ $result = $wpdb->get_col( $query ); // phpcs:ignore WordPress.WP.PreparedSQL
1215
+
1216
+ if ( ! empty($result[0]) ) {
1217
+ $option_values = maybe_unserialize( $result[0] );
1218
+ } else {
1219
+ $option_values = array();
1220
+ }
1221
+
1222
+ foreach ( $_enabled_keys as $field ) {
1223
+
1224
+ $new = array();
1225
+
1226
+ foreach ( WPGlobus::Config()->enabled_languages as $lang ) :
1227
+
1228
+ if ( $lang === $current_language ) {
1229
+
1230
+ if ( empty( $new_value[ $taxonomy ][ $tag_ID ][ $field ] ) ) {//phpcs:ignore Generic.CodeAnalysis
1231
+ //$text = '';
1232
+ } else {
1233
+ $new[ $lang ] = $new_value[ $taxonomy ][ $tag_ID ][ $field ];
1234
+ }
1235
+ } else {
1236
+
1237
+ if ( ! empty( $option_values[ $taxonomy ][ $tag_ID ][ $field ] ) ) {
1238
+
1239
+ $_text = WPGlobus_Core::text_filter( $option_values[ $taxonomy ][ $tag_ID ][ $field ], $lang, WPGlobus::RETURN_EMPTY );
1240
+ if ( ! empty( $_text ) ) {
1241
+ $new[ $lang ] = $_text;
1242
+ }
1243
+ }
1244
+ }
1245
+
1246
+ endforeach;
1247
+
1248
+ $new_value[ $taxonomy ][ $tag_ID ][ $field ] = WPGlobus_Utils::build_multilingual_string( $new );
1249
+
1250
+ } // endforeach
1251
+ }
1252
+
1253
+ return $new_value;
1254
+
1255
+ }
1256
+
1257
+ }
trunk/includes/class-wpglobus-plugin.php ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * File: class-wpglobus-plugin.php
4
+ *
5
+ * @package WPGlobus
6
+ * @since 1.6.1
7
+ */
8
+
9
+ /**
10
+ * Class WPGlobus_Plugin
11
+ */
12
+ abstract class WPGlobus_Plugin {
13
+
14
+ /**
15
+ * `__FILE__` from the loader.
16
+ *
17
+ * @var string
18
+ */
19
+ public $plugin_file = '';
20
+
21
+ /**
22
+ * Basename from `__FILE__`.
23
+ *
24
+ * @var string
25
+ */
26
+ public $plugin_basename = '';
27
+
28
+ /**
29
+ * Plugin directory URL. Initialized by the constructor.
30
+ *
31
+ * @var string
32
+ */
33
+ public $plugin_dir_url = '';
34
+
35
+ /**
36
+ * Parameter for the updater: slug of the product URL.
37
+ *
38
+ * @var string
39
+ */
40
+ protected $product_slug = '';
41
+
42
+ /**
43
+ * Parameter for the updater: product ID (name).
44
+ *
45
+ * @var string
46
+ */
47
+ protected $product_id = '';
48
+
49
+ /**
50
+ * Used in the `load_textdomain` call.
51
+ *
52
+ * @var string
53
+ */
54
+ protected $textdomain = '';
55
+
56
+ /**
57
+ * Constructor.
58
+ *
59
+ * @param string $the__file__ Pass `__FILE__` from the loader.
60
+ */
61
+ public function __construct( $the__file__ ) {
62
+ $this->plugin_file = $the__file__;
63
+ $this->plugin_basename = plugin_basename( $this->plugin_file );
64
+ $this->plugin_dir_url = plugin_dir_url( $this->plugin_file );
65
+ }
66
+
67
+ /**
68
+ * Setup updater.
69
+ * All parameters must be set by the child class' constructor.
70
+ */
71
+ public function setup_updater() {
72
+ if ( $this->plugin_file && $this->product_id && $this->product_slug ) {
73
+ /* @noinspection PhpUndefinedClassInspection */
74
+ new TIVWP_Updater( array(
75
+ 'plugin_file' => $this->plugin_file,
76
+ 'product_id' => $this->product_id,
77
+ 'url_product' => WPGlobus::URL_WPGLOBUS_SITE . 'product/' .
78
+ $this->product_slug . '/',
79
+ ) );
80
+ }
81
+ }
82
+
83
+ /**
84
+ * Load PO/MO.
85
+ * The parameter must be set by the child class' constructor.
86
+ */
87
+ public function load_translations() {
88
+ if ( $this->textdomain ) {
89
+ load_plugin_textdomain( $this->textdomain, false,
90
+ dirname( $this->plugin_basename ) . '/languages'
91
+ );
92
+ }
93
+ }
94
+ }
95
+
96
+ /* EOF */
trunk/includes/class-wpglobus-post-types.php ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WPGlobus Post Types
4
+ *
5
+ * @package WPGlobus
6
+ * @since 1.9.10
7
+ */
8
+
9
+ /**
10
+ * Class WPGlobus_Post_Types
11
+ */
12
+ class WPGlobus_Post_Types {
13
+
14
+ /**
15
+ * Names of the CPTs that should not be visible in the WPGlobus options panel.
16
+ *
17
+ * @var string[]
18
+ */
19
+ protected static $hidden_types_main = array(
20
+ /**
21
+ * Built-in.
22
+ * @see create_initial_post_types() in wp-includes\post.php
23
+ */
24
+ 'attachment',
25
+ 'revision',
26
+ 'nav_menu_item',
27
+ 'custom_css',
28
+ 'customize_changeset',
29
+ 'oembed_cache',
30
+ 'user_request', // @since 1.9.17
31
+ // Custom types that do not need WPGlobus' tabbed interface or those that we cannot handle.
32
+ 'scheduled-action',
33
+ 'wp-types-group',
34
+ 'wp-types-user-group',
35
+ 'wp-types-term-group',
36
+ 'wpcf7_contact_form',
37
+ 'tablepress_table',
38
+ // ACF: free and pro.
39
+ 'acf',
40
+ 'acf-field',
41
+ 'acf-field-group',
42
+ // Gutenberg: @since 1.9.17
43
+ 'wp_block',
44
+ // Gutenberg: @since 2.2.20
45
+ 'wp_template',
46
+ 'wp_area',
47
+ // WPBakery PB: @since 1.9.17
48
+ 'vc4_templates',
49
+ 'vc_grid_item',
50
+ // Elementor: @since 2.2.7
51
+ 'elementor_library',
52
+ // NextGEN Gallery: @since 2.2.29
53
+ 'ngg_album',
54
+ 'ngg_gallery',
55
+ 'ngg_pictures',
56
+ 'lightbox_library',
57
+ 'displayed_gallery',
58
+ 'display_type',
59
+ 'gal_display_source',
60
+ // MC4WP: Mailchimp for WordPress(https://wordpress.org/plugins/mailchimp-for-wp/) : @since 2.2.32
61
+ 'mc4wp-form',
62
+ // Pods: https://wordpress.org/plugins/pods/ @since 2.2.34
63
+ '_pods_template',
64
+ '_pods_pod',
65
+ '_pods_field',
66
+ // Elementor Pro: @since 2.3.1
67
+ 'elementor_font',
68
+ 'elementor_icons',
69
+ // WPForms Lite: https://wordpress.org/plugins/wpforms-lite/ @since 2.3.6
70
+ 'wpforms',
71
+ 'wpforms_log',
72
+ // rtMedia for WordPress, BuddyPress and bbPress: https://wordpress.org/plugins/buddypress-media/ @since 2.3.12
73
+ 'rtmedia_album',
74
+ // Divi: https://www.elegantthemes.com/gallery/divi/ @since 2.3.12
75
+ 'et_theme_builder',
76
+ 'et_template',
77
+ 'et_header_layout',
78
+ 'et_body_layout',
79
+ 'et_footer_layout',
80
+ );
81
+
82
+ /**
83
+ * WooCommerce types: we either force-enable them in WPG-WC or we do not need to handle them.
84
+ * Will hide them only if WooCommerce is active, to prevent potential conflict with other plugins
85
+ * that may use the same ("product") type(s).
86
+ *
87
+ * @var string[]
88
+ */
89
+ protected static $hidden_types_wc = array(
90
+ 'product',
91
+ 'product_variation',
92
+ 'shop_subscription',
93
+ 'shop_coupon',
94
+ 'shop_order',
95
+ 'shop_order_refund',
96
+ );
97
+
98
+ /**
99
+ * Get hidden post types.
100
+ *
101
+ * @return string[]
102
+ */
103
+ public static function hidden_types() {
104
+
105
+ /**
106
+ * @since 2.3.6
107
+ * @see https://themeforest.net/item/bodega-a-stylish-theme-for-small-businesses/10276763
108
+ */
109
+ if ( defined('BODEGA_CORE_VERSION') ) {
110
+ self::$hidden_types_main[] = 'testimonials';
111
+ self::$hidden_types_main[] = 'slides';
112
+ self::$hidden_types_main[] = 'carousels';
113
+ }
114
+
115
+ $hidden_types = self::$hidden_types_main;
116
+
117
+ if ( class_exists( 'WooCommerce', false ) ) {
118
+ $hidden_types = array_merge( $hidden_types, self::$hidden_types_wc );
119
+ }
120
+
121
+ /**
122
+ * Filter for hidden post types.
123
+ * @see filter `wpglobus_disabled_entities` in includes\class-wpglobus.php for admin.
124
+ *
125
+ * @since 2.3.2
126
+ *
127
+ * @param array $hidden_types Array of hidden types.
128
+ */
129
+ $hidden_types = apply_filters( 'wpglobus_hidden_types', $hidden_types );
130
+
131
+ return $hidden_types;
132
+ }
133
+ }
trunk/includes/class-wpglobus-redirect.php ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package WPGlobus
4
+ * @since 1.8.0
5
+ */
6
+
7
+ /**
8
+ * Class WPGlobus_Redirect
9
+ */
10
+ class WPGlobus_Redirect {
11
+
12
+ /**
13
+ * Constructor.
14
+ */
15
+ public static function construct() {
16
+ add_action( 'wp', array( __CLASS__, 'on__init' ), 1 );
17
+ }
18
+
19
+ /**
20
+ * Init action.
21
+ */
22
+ public static function on__init() {
23
+
24
+ if ( empty( $_SERVER['HTTP_ACCEPT_LANGUAGE'] ) ) { // WPCS: input var ok, sanitization ok.
25
+ // No language information in browser.
26
+ return;
27
+ }
28
+
29
+ $cookie_name = WPGlobus::_COOKIE;
30
+
31
+ if ( ! isset( $_COOKIE[ $cookie_name ] ) ) { // WPCS: input var ok, sanitization ok.
32
+ /**
33
+ * First visit.
34
+ */
35
+ $browser_language = substr( $_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2 ); // WPCS: input var ok, sanitization ok.
36
+ /* @noinspection SummerTimeUnsafeTimeManipulationInspection */
37
+ setcookie( $cookie_name, $browser_language, time() + 3600 * 24 * 365, '/' );
38
+ self::redirect( $browser_language );
39
+
40
+ return;
41
+ }
42
+
43
+ }
44
+
45
+ /**
46
+ * Redirect to specified language.
47
+ *
48
+ * @param string $language
49
+ */
50
+ public static function redirect( $language ) {
51
+
52
+ if ( $language === WPGlobus::Config()->language ) {
53
+ // Already in that language.
54
+ return;
55
+ }
56
+
57
+ if ( ! in_array( $language, WPGlobus::Config()->enabled_languages, true ) ) {
58
+ // No such language.
59
+ return;
60
+ }
61
+
62
+ // Convert the current URL to the requested language and redirect.
63
+ $current_url = WPGlobus_Utils::current_url();
64
+ $redirect_to = WPGlobus_Utils::localize_url( $current_url, $language );
65
+
66
+ /**
67
+ * Filter the `$redirect_to` URL.
68
+ * Returning a false value cancels redirect.
69
+ *
70
+ * @param string $redirect_to URL redirect to.
71
+ * @param string $language Language redirect to.
72
+ *
73
+ * @return string|false
74
+ */
75
+ $redirect_to = apply_filters( 'wpglobus_first_visit_redirect', $redirect_to, $language );
76
+
77
+ if ( ! $redirect_to ) {
78
+ return;
79
+ }
80
+
81
+ /**
82
+ * @todo This is for the old versions of WPGlobus Plus that do not have the above filter.
83
+ */
84
+ if ( class_exists( 'WPGlobusPlus_Publish' )
85
+ && version_compare( WPGLOBUS_PLUS_VERSION, '1.1.31', '<' )
86
+ && is_singular()
87
+ ) {
88
+ $post_status = get_post_meta( get_the_ID(), WPGlobusPlus_Publish::LANGUAGE_POST_STATUS, true );
89
+ if ( isset( $post_status[ $language ] ) && 'draft' === $post_status[ $language ] ) {
90
+ // This language is set to draft by WPGlobus Plus.
91
+ return;
92
+ }
93
+ }
94
+
95
+ wp_redirect( $redirect_to );
96
+ exit;
97
+
98
+ }
99
+ }
trunk/includes/class-wpglobus-utils.php ADDED
@@ -0,0 +1,478 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * File: class-wpglobus-utils.php
4
+ *
5
+ * @package WPGlobus
6
+ */
7
+
8
+ /**
9
+ * Class WPGlobus_Utils
10
+ */
11
+ class WPGlobus_Utils {
12
+
13
+ /**
14
+ * Localize URL by inserting language prefix
15
+ *
16
+ * @param string $url URL to localize
17
+ * @param string $language Language code
18
+ * @param WPGlobus_Config $config Alternative configuration (i.e. Unit Test mock object)
19
+ *
20
+ * @return string
21
+ */
22
+ public static function localize_url( $url = '', $language = '', WPGlobus_Config $config = null ) {
23
+ /**
24
+ * Use the global configuration if alternative not passed
25
+ */
26
+ if ( null === $config ) {
27
+ // @codeCoverageIgnoreStart
28
+ $config = WPGlobus::Config();
29
+ }
30
+ // @codeCoverageIgnoreEnd
31
+
32
+ /**
33
+ * Use the current language if not passed
34
+ */
35
+ $language = empty( $language ) ? $config->language : $language;
36
+
37
+ /**
38
+ * Local cache to speed-up processing on pages with multiple links.
39
+ */
40
+ static $cache = array();
41
+ if ( isset( $cache[ $language ][ $url ] ) ) {
42
+ return $cache[ $language ][ $url ];
43
+ }
44
+ if ( ! isset( $cache[ $language ] ) ) {
45
+ $cache[ $language ] = array();
46
+ }
47
+
48
+ /**
49
+ * In Admin-Settings-General:
50
+ * WordPress Address (URL) is site_url()
51
+ * Site Address (URL) is home_url
52
+ * We need home_url, and we cannot use the @home_url function,
53
+ * because it will filter back here causing endless loop.
54
+ *
55
+ * @todo Multisite?
56
+ */
57
+ $home_url = get_option( 'home' );
58
+
59
+ /**
60
+ * `hide_default_language` means "Do not use language code in the default URL"
61
+ * So, no /en/page/, just /page/
62
+ */
63
+ if ( $language === $config->default_language && $config->hide_default_language ) {
64
+ $language_url_prefix = '';
65
+ } else {
66
+ /**
67
+ * Language prefix looks like '/ru'
68
+ */
69
+ $language_url_prefix = '/' . $language;
70
+ }
71
+
72
+ /**
73
+ * For the following regex, we need home_url without prefix
74
+ * http://www.example.com becomes example.com
75
+ */
76
+ $home_domain_tld = self::domain_tld( $home_url );
77
+
78
+ /**
79
+ * Regex to replace current language prefix with the requested one.
80
+ *
81
+ * @example ^(https?:\/\/(?:.+\.)?example\.com)(?:\/?(?:en|ru|pt))?($|\/$|[\/#\?].*$)
82
+ */
83
+
84
+ /**
85
+ * The "host+path" part of the URL (captured)
86
+ * We ignore http(s) and domain prefix, but we must match the domain-tld, so any external URLs
87
+ * are not localized.
88
+ */
89
+ $re_host_part = '(https?:\/\/(?:.+\.)?' .
90
+ str_replace( '.', '\.', $home_domain_tld ) .
91
+ str_replace( '/', '\/', parse_url( $home_url, PHP_URL_PATH ) )
92
+ . ')';
93
+
94
+ /**
95
+ * The "language" part (optional, not captured, will be thrown away)
96
+ */
97
+ $re_language_part = '(?:\/?(?:' . implode( '|', $config->enabled_languages ) . '))?';
98
+
99
+ /**
100
+ * The rest of the URL. Can be:
101
+ * - Nothing or trailing slash, or
102
+ * - Slash, hash or question and optionally anything after
103
+ * *
104
+ * Using 'or' regex to capture things like '/rush' or '/designer/' correctly,
105
+ * and not extract '/ru' or '/de' from them,
106
+ */
107
+ $re_trailer = '(\/?|[\/#\?].*)';
108
+
109
+ $re = '!^' . $re_host_part . $re_language_part . $re_trailer . '$!';
110
+
111
+ /**
112
+ * Replace the existing (or empty) language prefix with the requested one
113
+ */
114
+ $localized_url = preg_replace( $re, '\1' . $language_url_prefix . '\2', $url );
115
+
116
+ /**
117
+ * Cache it.
118
+ */
119
+ $cache[ $language ][ $url ] = $localized_url;
120
+
121
+ return $localized_url;
122
+ }
123
+
124
+ /**
125
+ * Extract language from URL
126
+ * http://example.com/ru/page/ returns 'ru'
127
+ *
128
+ * @param string $url
129
+ * @param WPGlobus_Config $config Alternative configuration (i.e. Unit Test mock object)
130
+ *
131
+ * @return string
132
+ */
133
+ public static function extract_language_from_url( $url = '', WPGlobus_Config $config = null ) {
134
+
135
+ $language = '';
136
+
137
+ if ( ! is_string( $url ) ) {
138
+ return $language;
139
+ }
140
+
141
+ /**
142
+ * Use the global configuration is alternative not passed
143
+ */
144
+ if ( null === $config ) {
145
+ // @codeCoverageIgnoreStart
146
+ $config = WPGlobus::Config();
147
+ }
148
+ // @codeCoverageIgnoreEnd
149
+
150
+ $path = parse_url( $url, PHP_URL_PATH );
151
+
152
+ $path_home = untrailingslashit( parse_url( get_option( 'home' ), PHP_URL_PATH ) );
153
+
154
+ /**
155
+ * Regex to find the language prefix.
156
+ *
157
+ * @example !^/(en|ru|pt)/!
158
+ */
159
+ $re = '!^' . $path_home .
160
+ '/(' . implode( '|', $config->enabled_languages ) . ')(?:/|$)' . '!';
161
+
162
+ if ( preg_match( $re, $path, $match ) ) {
163
+ // Found language information
164
+ $language = $match[1];
165
+ }
166
+
167
+ return $language;
168
+
169
+ }
170
+
171
+ /**
172
+ * Check if was called by a specific function (could be any levels deep).
173
+ * @deprecated 1.7.7 Use WPGlobus_WP::is_function_in_backtrace()
174
+ * @see WPGlobus_WP::is_function_in_backtrace()
175
+ *
176
+ * @param string|callable $function_name Function name or array(class,function).
177
+ *
178
+ * @return bool True if Function is in backtrace.
179
+ */
180
+ public static function is_function_in_backtrace( $function_name ) {
181
+ _deprecated_function( __METHOD__, 'WPGlobus 1.7.7', 'WPGlobus_WP::is_function_in_backtrace()' );
182
+
183
+ return WPGlobus_WP::is_function_in_backtrace( $function_name );
184
+ }
185
+
186
+ /**
187
+ * Strip the prefix from the host name
188
+ * http://www.example.com becomes example.com
189
+ *
190
+ * @param string $url
191
+ *
192
+ * @return string
193
+ * @since 1.0.12
194
+ */
195
+ public static function domain_tld( $url ) {
196
+
197
+ $pre = '';
198
+ /**
199
+ * Short-circuit processing to provide own return for the cases not covered by the algorithm.
200
+ * Ex. www.example.carrara-massa.it (carrara-massa.it is a TLD)
201
+ *
202
+ * @param string $pre Empty string. Return your domain_tld instead.
203
+ * @param string $url The URL to extract domain_tld from.
204
+ */
205
+ $pre = apply_filters( 'wpglobus_pre_domain_tld', $pre, $url );
206
+ if ( $pre ) {
207
+ return $pre;
208
+ }
209
+
210
+ // URL passed with no scheme. parse_url will think it's a path only. Let's add a scheme.
211
+ if ( ! preg_match( '!^(?:https?:)?//!', $url ) ) {
212
+ $url = '//' . $url;
213
+ }
214
+
215
+ $host = parse_url( $url, PHP_URL_HOST );
216
+
217
+ if ( ! $host ) {
218
+ // parse_url failed. We cannot do much. Let's return the original url.
219
+ return $url;
220
+ }
221
+
222
+ /**
223
+ * Extract domain-tld from the host.
224
+ * Note: this does not cover all possible public suffixes.
225
+ * Using the proper algorithm based PublicList might be resource-consuming.
226
+ * We'll provide a filter for special cases instead.
227
+ *
228
+ * @link https://publicsuffix.org/list/
229
+ */
230
+ $re = '/([a-z0-9][a-z0-9\-]+\.[a-z\.]{2,6})$/';
231
+ $domain_tld = $host;
232
+ if ( preg_match( $re, $host, $matches ) ) {
233
+ $domain_tld = $matches[1];
234
+ }
235
+
236
+ return $domain_tld;
237
+ }
238
+
239
+ /**
240
+ * Convert array of local texts to multilingual string (with WPGlobus delimiters)
241
+ *
242
+ * @param string[] $translations
243
+ *
244
+ * @return string
245
+ */
246
+ public static function build_multilingual_string( $translations ) {
247
+ $sz = '';
248
+ $single = ( 1 === count( $translations ) );
249
+ foreach ( $translations as $language => $text ) {
250
+ if ( $single && $language === WPGlobus::Config()->default_language ) {
251
+ $sz = $text;
252
+ } else {
253
+ $sz .= WPGlobus::add_locale_marks( $text, $language );
254
+ }
255
+ }
256
+
257
+ return $sz;
258
+ }
259
+
260
+ /**
261
+ * Returns the current URL.
262
+ * There is no method of getting the current URL in WordPress.
263
+ * Various snippets published on the Web use a combination of home_url and add_query_arg.
264
+ * However, none of them work when WordPress is installed in a subfolder.
265
+ * The method below looks valid. There is a theoretical chance of HTTP_HOST tampered, etc.
266
+ * However, the same line of code is used by the WordPress core,
267
+ * for example in @see wp_admin_canonical_url, so we are going to use it, too
268
+ * *
269
+ * Note that #hash is always lost because it's a client-side parameter.
270
+ * We might add it using a JavaScript call.
271
+ *
272
+ * @since 1.1.1
273
+ */
274
+ public static function current_url() {
275
+ return set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] ); // WPCS: input var ok, sanitization ok.
276
+ }
277
+
278
+ /**
279
+ * Build hreflang metas.
280
+ *
281
+ * @since 1.1.1
282
+ * @since 2.3.4 Revised code.
283
+ *
284
+ * @param WPGlobus_Config $config Alternative configuration (i.e. Unit Test mock object)
285
+ *
286
+ * @return string[] Array of rel-alternate link tags
287
+ */
288
+ public static function hreflangs( WPGlobus_Config $config = null ) {
289
+
290
+ /**
291
+ * Use the global configuration is alternative not passed
292
+ */
293
+ if ( null === $config ) {
294
+ // @codeCoverageIgnoreStart
295
+ $config = WPGlobus::Config();
296
+ }
297
+ // @codeCoverageIgnoreEnd
298
+
299
+ $hreflangs = array();
300
+
301
+ if ( is_404() ) {
302
+ return $hreflangs;
303
+ }
304
+
305
+ foreach ( $config->enabled_languages as $language ) {
306
+
307
+ switch ( $config->seo_hreflang_type ) {
308
+ case 'zz':
309
+ $_hreflang_type = $language;
310
+ break;
311
+ case 'zz-zz':
312
+ $_hreflang_type = str_replace( '_', '-', strtolower($config->locale[ $language ]) );
313
+ break;
314
+ default :
315
+ // 'zz-ZZ'
316
+ $_hreflang_type = str_replace( '_', '-', $config->locale[ $language ] );
317
+ break;
318
+ }
319
+
320
+ if ( $language == $config->default_language ) {
321
+ if ( ! empty($config->seo_hreflang_default_language_type) && $config->seo_hreflang_default_language_type ) {
322
+ $_hreflang_type = $config->seo_hreflang_default_language_type;
323
+
324
+ }
325
+ }
326
+
327
+ $hreflangs[ $language ] = sprintf( '<link rel="alternate" hreflang="%s" href="%s"/>',
328
+ $_hreflang_type,
329
+ esc_url( WPGlobus_Utils::localize_current_url( $language, $config ) )
330
+ );
331
+
332
+ }
333
+
334
+ return $hreflangs;
335
+ }
336
+
337
+ /**
338
+ * Localize the current URL.
339
+ * @since 1.2.3
340
+ *
341
+ * @param string $language Language to localize the URL to.
342
+ * @param WPGlobus_Config $config Alternative configuration (i.e. Unit Test mock object)
343
+ *
344
+ * @return string
345
+ */
346
+ public static function localize_current_url( $language = '', WPGlobus_Config $config = null ) {
347
+ /**
348
+ * Filter the current URL before it is localized (a short-circuit filter).
349
+ * If a non-empty string is returned by the filter, then the `localize_url()`
350
+ * won't be called.
351
+ *
352
+ * @param string $url Empty string is passed.
353
+ * @param string $language The language that the URL is going to be localized to.
354
+ *
355
+ * @return string
356
+ */
357
+ $url = apply_filters( 'wpglobus_pre_localize_current_url', '', $language );
358
+
359
+ if ( ! $url ) {
360
+ /**
361
+ * Use the global configuration if alternative not passed
362
+ */
363
+ if ( null === $config ) {
364
+ // @codeCoverageIgnoreStart
365
+ $config = WPGlobus::Config();
366
+ }
367
+ // @codeCoverageIgnoreEnd
368
+ $url = WPGlobus_Utils::localize_url( WPGlobus_Utils::current_url(), $language, $config );
369
+ }
370
+
371
+ /**
372
+ * Filter the current URL after it was localized.
373
+ *
374
+ * @since 1.8.1
375
+ *
376
+ * @param string $url The localized URL.
377
+ * @param string $language The language it was localized to.
378
+ *
379
+ * @return string
380
+ */
381
+ $url = apply_filters( 'wpglobus_after_localize_current_url', $url, $language );
382
+
383
+ return $url;
384
+ }
385
+
386
+ /**
387
+ * Localize wpglobus.com for use in outgoing links
388
+ *
389
+ * @param WPGlobus_Config $config
390
+ *
391
+ * @return string
392
+ * @since 1.2.6
393
+ */
394
+ public static function url_wpglobus_site( WPGlobus_Config $config = null ) {
395
+ if ( null === $config ) {
396
+ // @codeCoverageIgnoreStart
397
+ $config = WPGlobus::Config();
398
+ }
399
+ // @codeCoverageIgnoreEnd
400
+
401
+ $url = WPGlobus::URL_WPGLOBUS_SITE;
402
+ if ( 'ru' === $config->language ) {
403
+ $url .= 'ru' . '/';
404
+ }
405
+
406
+ return $url;
407
+ }
408
+
409
+ /**
410
+ * @codeCoverageIgnore
411
+ * Return true if language is in array of enabled languages, otherwise false
412
+ *
413
+ * @param string $language
414
+ *
415
+ * @return bool
416
+ */
417
+ public static function is_enabled( $language ) {
418
+ return in_array( $language, WPGlobus::Config()->enabled_languages, true );
419
+ }
420
+
421
+ /**
422
+ * Secure access to scalars in $_GET.
423
+ *
424
+ * @param string $key Index ($_GET[ $key ]).
425
+ *
426
+ * @return string The value or empty string if not exists or not scalar.
427
+ */
428
+ public static function safe_get( $key ) {
429
+ $value = '';
430
+
431
+ if ( isset( $_GET[ $key ] ) ) { // Input var okay.
432
+ $get_key = $_GET[ $key ]; // Input var okay; sanitization okay.
433
+
434
+ if ( is_scalar( $get_key ) ) {
435
+ $value = sanitize_text_field( $get_key );
436
+ }
437
+ }
438
+
439
+ return $value;
440
+ }
441
+
442
+ /**
443
+ * @todo The methods below are not used by the WPGlobus plugin.
444
+ * Need to check if they are used by any add-on.
445
+ * Marking them as deprecated so they will pop-up on code inspection.
446
+ */
447
+
448
+ /**
449
+ * @deprecated
450
+ * @codeCoverageIgnore
451
+ * Return true if language is in array of opened languages, otherwise false
452
+ *
453
+ * @param string $language
454
+ *
455
+ * @return bool
456
+ */
457
+ public static function is_open( $language ) {
458
+ return in_array( $language, WPGlobus::Config()->open_languages, true );
459
+ }
460
+
461
+ /**
462
+ * @deprecated
463
+ * @codeCoverageIgnore
464
+ *
465
+ * @param string $s
466
+ * @param string $n
467
+ *
468
+ * @return bool
469
+ */
470
+ public static function starts_with( $s, $n ) {
471
+ if ( strlen( $n ) > strlen( $s ) ) {
472
+ return false;
473
+ }
474
+
475
+ /* @noinspection SubStrUsedAsStrPosInspection */
476
+ return ( $n === substr( $s, 0, strlen( $n ) ) );
477
+ }
478
+ }
trunk/includes/class-wpglobus-widget.php ADDED
@@ -0,0 +1,302 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Widget
4
+ * @since 1.0.7
5
+ * @package WPGlobus
6
+ */
7
+
8
+ /**
9
+ * Class WPGlobusWidget
10
+ */
11
+ class WPGlobusWidget extends WP_Widget {
12
+
13
+ /**
14
+ * Array types of switcher
15
+ * @access private
16
+ * @since 1.0.7
17
+ * @var array
18
+ */
19
+ private $types = array();
20
+
21
+ /**
22
+ * Constructor
23
+ */
24
+ public function __construct() {
25
+ parent::__construct(
26
+ 'wpglobus',
27
+ esc_html__( 'WPGlobus widget', 'wpglobus' ),
28
+ array(
29
+ 'description' => esc_html__( 'Add language switcher', 'wpglobus' )
30
+ )
31
+ );
32
+ $this->types['flags'] = esc_html__( 'Flags', 'wpglobus' );
33
+ $this->types['list'] = esc_html__( 'List', 'wpglobus' );
34
+ $this->types['list_with_flags'] = esc_html__( 'List with flags', 'wpglobus' );
35
+ $this->types['select'] = esc_html__( 'Select', 'wpglobus' );
36
+ $this->types['select_with_code'] = esc_html__( 'Select with language code', 'wpglobus' );
37
+ $this->types['dropdown'] = esc_html__( 'Dropdown', 'wpglobus' );
38
+ $this->types['dropdown_with_flags'] = esc_html__( 'Dropdown with flags', 'wpglobus' );
39
+ }
40
+
41
+ /**
42
+ * Echo the widget content.
43
+ *
44
+ * @param array $args Display arguments including before_title, after_title, before_widget, and after_widget.
45
+ * @param array $instance The settings for the particular instance of the widget
46
+ */
47
+ public function widget( $args, $instance ) {
48
+
49
+ if ( ! empty( $instance['type'] ) ) {
50
+ $type = $instance['type'];
51
+ } else {
52
+ $type = 'flags';
53
+ }
54
+
55
+ $inside = '';
56
+
57
+ $enabled_languages = WPGlobus::Config()->enabled_languages;
58
+
59
+ switch ( $type ) :
60
+ case 'list' :
61
+ $code = '<div class="list">{{inside}}</div>';
62
+ break;
63
+ case 'list_with_flags' :
64
+ $code = '<div class="list flags">{{inside}}</div>';
65
+ break;
66
+ case 'select' :
67
+ case 'select_with_code' :
68
+ $code =
69
+ '<div class="select-styled"><select onchange="document.location.href = this.value;">{{inside}}</select></div>';
70
+ break;
71
+ case 'dropdown' :
72
+ case 'dropdown_with_flags' :
73
+ /**
74
+ * @todo remove after testing.
75
+ * @since 1.6.9
76
+ */
77
+ //$sorted[] = WPGlobus::Config()->language;
78
+ //foreach ( $enabled_languages as $language ) {
79
+ //if ( $language != WPGlobus::Config()->language ) {
80
+ //$sorted[] = $language;
81
+ //}
82
+ //}
83
+ //$enabled_languages = $sorted;
84
+
85
+ $code = '<div class="dropdown-styled"> <ul>
86
+ <li>
87
+ {{language}}
88
+ <ul>
89
+ {{inside}}
90
+ </ul>
91
+ </li>
92
+ </ul></div>';
93
+ break;
94
+ default:
95
+ // This is case 'flags'. Having it as default makes $code always set.
96
+ $code = '<div class="flags-styled">{{inside}}</div>';
97
+ break;
98
+ endswitch;
99
+
100
+ $extra_languages = array_diff( $enabled_languages, (array) WPGlobus::Config()->language );
101
+
102
+ /**
103
+ * Filter extra languages.
104
+ *
105
+ * Returning array.
106
+ *
107
+ * @since 1.0.13
108
+ * @since 1.6.9
109
+ *
110
+ * @param array $extra_languages An array with extra languages to show off in menu.
111
+ * @param string WPGlobus::Config()->language The current language.
112
+ */
113
+ $extra_languages = apply_filters( 'wpglobus_extra_languages', $extra_languages, WPGlobus::Config()->language );
114
+
115
+ /**
116
+ * Filter extra languages.
117
+ *
118
+ * Returning array.
119
+ *
120
+ * @since 1.9.17
121
+ *
122
+ * @param array $extra_languages An array with extra languages to show off in menu.
123
+ * @param string WPGlobus::Config()->language The current language.
124
+ */
125
+ $extra_languages = apply_filters( 'wpglobus/widget/extra_languages', $extra_languages, WPGlobus::Config()->language );
126
+
127
+ $enabled_languages = array_merge( (array)WPGlobus::Config()->language, $extra_languages );
128
+
129
+ /**
130
+ * Filter enabled languages.
131
+ *
132
+ * Returning array.
133
+ *
134
+ * @since 1.9.17
135
+ *
136
+ * @param array $enabled_languages An array with enabled languages to show off in menu.
137
+ * @param string WPGlobus::Config()->language The current language.
138
+ */
139
+ $enabled_languages = apply_filters( 'wpglobus/widget/enabled_languages', $enabled_languages, WPGlobus::Config()->language );
140
+
141
+ /**
142
+ * Class for link in a and option tags. Used for adding hash.
143
+ * @see class wpglobus-selector-link
144
+ * @since 1.2.0
145
+ */
146
+ $link_classes['selector_link'] = 'wpglobus-selector-link';
147
+
148
+ /**
149
+ * Class for flag box
150
+ * @since 1.4.0
151
+ */
152
+ $flag_classes = array();
153
+
154
+ echo $args['before_widget']; // WPCS: XSS ok.
155
+ if ( ! empty( $instance['title'] ) ) {
156
+ echo $args['before_title'] . $instance['title'] . $args['after_title']; // WPCS: XSS ok.
157
+ }
158
+ foreach ( $enabled_languages as $language ) :
159
+
160
+ $selected = '';
161
+
162
+ /**
163
+ * Init current language class
164
+ */
165
+ $link_classes['current_language'] = '';
166
+
167
+ /**
168
+ * Init current language class for flag box
169
+ */
170
+ $flag_classes['current_language'] = '';
171
+
172
+ if ( $language == WPGlobus::Config()->language ) {
173
+ $selected = ' selected';
174
+ switch ( $type ) :
175
+ case 'flags' :
176
+ $flag_classes['current_language'] = 'wpglobus-current-language';
177
+ break;
178
+ case 'list' :
179
+ case 'list_with_flags' :
180
+ case 'dropdown' :
181
+ case 'dropdown_with_flags' :
182
+ $link_classes['current_language'] = 'wpglobus-current-language';
183
+ break;
184
+ endswitch;
185
+ }
186
+
187
+ $url = WPGlobus_Utils::localize_current_url( $language );
188
+
189
+ $flag = WPGlobus::Config()->flags_url . WPGlobus::Config()->flag[ $language ];
190
+
191
+ switch ( $type ) :
192
+ case 'flags' :
193
+ $inside .= '<span class="flag ' . implode( ' ', $flag_classes ) . '">';
194
+ $inside .= '<a href="' . $url . '" class="' . implode( ' ', $link_classes ) . '"><img src="' . $flag . '"/></a>';
195
+ $inside .= '</span>';
196
+ break;
197
+ case 'list' :
198
+ case 'list_with_flags' :
199
+ $inside .= '<a href="' . $url . '" class="' . implode( ' ', $link_classes ) . '">' .
200
+ '<img src="' . $flag . '" alt=""/>' .
201
+ ' ' .
202
+ '<span class="name">' .
203
+ WPGlobus::Config()->language_name[ $language ] .
204
+ '</span>' .
205
+ ' ' .
206
+ '<span class="code">' . strtoupper( $language ) . '</span>' .
207
+ '</a>';
208
+ break;
209
+ case 'select' :
210
+ $inside .= '<option class="' . implode( ' ', $link_classes ) . '" ' . $selected . ' value="' . $url . '">' . WPGlobus::Config()->language_name[ $language ] . '</option>';
211
+ break;
212
+ case 'select_with_code' :
213
+ $inside .= '<option class="' . implode( ' ', $link_classes ) . '" ' . $selected . ' value="' . $url . '">' . WPGlobus::Config()->language_name[ $language ] . '&nbsp;(' . strtoupper( $language ) . ')</option>';
214
+ break;
215
+ case 'dropdown' :
216
+ if ( '' != $selected ) {
217
+ $code =
218
+ str_replace( '{{language}}', '<a class="' . implode( ' ', $link_classes ) . '" href="' . $url . '">' . WPGlobus::Config()->language_name[ $language ] . '&nbsp;(' . strtoupper( $language ) . ')</a>', $code );
219
+ } else {
220
+ $inside .= '<li><a class="' . implode( ' ', $link_classes ) . '" href="' . $url . '">' . WPGlobus::Config()->language_name[ $language ] . '&nbsp;(' . strtoupper( $language ) . ')</a></li>';
221
+ }
222
+ break;
223
+ case 'dropdown_with_flags' :
224
+ if ( '' != $selected ) {
225
+ $code =
226
+ str_replace( '{{language}}', '<a class="' . implode( ' ', $link_classes ) . '" href="' . $url . '"><img src="' . $flag . '"/>&nbsp;&nbsp;' . WPGlobus::Config()->language_name[ $language ] . '</a>', $code );
227
+ } else {
228
+ $inside .= '<li><a class="' . implode( ' ', $link_classes ) . '" href="' . $url . '"><img src="' . $flag . '"/>&nbsp;&nbsp;' . WPGlobus::Config()->language_name[ $language ] . '</a></li>';
229
+ }
230
+ break;
231
+ endswitch;
232
+
233
+ endforeach;
234
+
235
+ echo str_replace( '{{inside}}', $inside, $code ); // WPCS: XSS ok.
236
+
237
+ echo $args['after_widget']; // WPCS: XSS ok.
238
+
239
+ }
240
+
241
+ /**
242
+ * Echo the settings update form.
243
+ *
244
+ * @param array $instance Current settings
245
+ *
246
+ * @return string
247
+ */
248
+ public function form( $instance ) {
249
+
250
+ if ( isset( $instance['type'] ) ) {
251
+ $selected_type = $instance['type'];
252
+ } else {
253
+ $selected_type = 'flags';
254
+ }
255
+ if ( empty( $instance['title'] ) ) {
256
+ $instance['title'] = '';
257
+ }
258
+ ?>
259
+ <p>
260
+ <label for="<?php echo esc_attr( $this->get_field_name( 'type' ) ); ?>"><?php echo esc_html__( 'Title' ); ?></label>
261
+ <input type="text" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"
262
+ name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" value="<?php echo esc_html( $instance['title'] ); ?>"/>
263
+ </p>
264
+ <p><?php esc_html_e( 'Selector type', 'wpglobus' ); ?></p>
265
+ <p><?php
266
+ foreach ( $this->types as $type => $caption ) :
267
+ $checked = '';
268
+ if ( $selected_type == $type ) {
269
+ $checked = ' checked';
270
+ } ?>
271
+ <input type="radio"
272
+ id="<?php echo esc_attr( $this->get_field_id( 'type' ) ); ?>"
273
+ name="<?php echo esc_attr( $this->get_field_name( 'type' ) ); ?>" <?php echo $checked; // WPCS: XSS ok. ?>
274
+ value="<?php echo esc_attr( $type ); ?>"/> <?php echo $caption . '<br />'; // WPCS: XSS ok.
275
+ endforeach;
276
+ ?></p> <?php
277
+
278
+ return '';
279
+
280
+ }
281
+
282
+ /**
283
+ * Update a particular instance.
284
+ * This function should check that $new_instance is set correctly.
285
+ * The newly calculated value of $instance should be returned.
286
+ * If "false" is returned, the instance won't be saved/updated.
287
+ *
288
+ * @param array $new_instance New settings for this instance as input by the user via form()
289
+ * @param array $old_instance Old settings for this instance
290
+ *
291
+ * @return array Settings to save or bool false to cancel saving
292
+ */
293
+ public function update( $new_instance, $old_instance ) {
294
+ $instance = array();
295
+ $instance['type'] = ( ! empty( $new_instance['type'] ) ) ? $new_instance['type'] : '';
296
+ $instance['title'] = ( ! empty( $new_instance['title'] ) ) ? $new_instance['title'] : '';
297
+
298
+ return $instance;
299
+ }
300
+ }
301
+
302
+ # --- EOF
trunk/includes/class-wpglobus-wp.php ADDED
@@ -0,0 +1,267 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WordPress shortcuts
4
+ * @package WPGlobus
5
+ */
6
+
7
+ /**
8
+ * Class WPGlobus_WP
9
+ */
10
+ class WPGlobus_WP {
11
+
12
+ /**
13
+ * CSS classes for admin notices
14
+ * @example
15
+ * <code>
16
+ * echo '<div class="notice ' . WPGlobus_WP::ADMIN_NOTICE_WARNING . '">';
17
+ * </code>
18
+ */
19
+
20
+ const ADMIN_NOTICE_SUCCESS = 'notice-success';
21
+ const ADMIN_NOTICE_ERROR = 'notice-error';
22
+ const ADMIN_NOTICE_INFO = 'notice-info';
23
+ const ADMIN_NOTICE_WARNING = 'notice-warning';
24
+
25
+ /**
26
+ * Check if doing AJAX call.
27
+ *
28
+ * @return bool
29
+ * @since 1.9.13 - also checks for WC AJAX.
30
+ */
31
+ public static function is_doing_ajax() {
32
+ return ( defined( 'DOING_AJAX' ) && DOING_AJAX ) || self::is_doing_wc_ajax();
33
+ }
34
+
35
+ /**
36
+ * Check if doing WooCommerce AJAX call.
37
+ *
38
+ * @return bool
39
+ * @since 1.9.13
40
+ */
41
+ public static function is_doing_wc_ajax() {
42
+ return ( ! empty( $_GET['wc-ajax'] ) );
43
+ }
44
+
45
+ /**
46
+ * Attempt to check if an AJAX call was originated from admin screen.
47
+ * @todo There should be other actions. See $core_actions_get in admin-ajax.php
48
+ * Can also check $GLOBALS['_SERVER']['HTTP_REFERER']
49
+ * and $GLOBALS['current_screen']->in_admin()
50
+ *
51
+ * @todo add $action parameter for case to check for it only
52
+ * @return bool
53
+ */
54
+ public static function is_admin_doing_ajax() {
55
+ return (
56
+ self::is_doing_ajax() &&
57
+ (
58
+ self::is_http_post_action( 'inline-save' ) ||
59
+ self::is_http_post_action( 'save-widget' ) ||
60
+ self::is_http_post_action( 'customize_save' ) ||
61
+ self::is_http_get_action( 'ajax-tag-search' )
62
+ )
63
+ );
64
+ }
65
+
66
+
67
+ /**
68
+ * To get the current admin page
69
+ * (Set in wp-includes/vars.php)
70
+ * @return string $page
71
+ * @since 1.2.0
72
+ */
73
+ public static function pagenow() {
74
+ /**
75
+ * @global string $pagenow
76
+ */
77
+ global $pagenow;
78
+
79
+ return ( isset( $pagenow ) ? $pagenow : '' );
80
+ }
81
+
82
+ /**
83
+ * @param string|string[] $page
84
+ *
85
+ * @return bool
86
+ */
87
+ public static function is_pagenow( $page ) {
88
+ return in_array( self::pagenow(), (array) $page );
89
+ }
90
+
91
+ /**
92
+ * To get the plugin page ID
93
+ * @example On wp-admin/index.php?page=woothemes-helper, will return `woothemes-helper`.
94
+ * @return string
95
+ * @since 1.2.0
96
+ */
97
+ public static function plugin_page() {
98
+ /**
99
+ * Set in wp-admin/admin.php
100
+ * @global string $plugin_page
101
+ */
102
+ global $plugin_page;
103
+
104
+ return ( isset( $plugin_page ) ? $plugin_page : '' );
105
+ }
106
+
107
+ /**
108
+ * @param string|string[] $page
109
+ *
110
+ * @return bool
111
+ */
112
+ public static function is_plugin_page( $page ) {
113
+ return in_array( self::plugin_page(), (array) $page );
114
+ }
115
+
116
+ /**
117
+ * @param string|string[] $action
118
+ *
119
+ * @return bool
120
+ */
121
+ public static function is_http_post_action( $action ) {
122
+
123
+ $action = (array) $action;
124
+
125
+ return ( ! empty( $_POST['action'] ) && in_array( $_POST['action'], $action, true ) ); // WPCS: input var ok, sanitization ok.
126
+ }
127
+
128
+ /**
129
+ * @param string|string[] $action
130
+ *
131
+ * @return bool
132
+ */
133
+ public static function is_http_get_action( $action ) {
134
+
135
+ $action = (array) $action;
136
+
137
+ return ( ! empty( $_GET['action'] ) && in_array( $_GET['action'], $action, true ) ); // WPCS: input var ok, sanitization ok.
138
+ }
139
+
140
+ /**
141
+ * Check if a filter is called by a certain function / class
142
+ *
143
+ * @param string $function
144
+ * @param string $class
145
+ *
146
+ * @return bool
147
+ * @todo Unit test
148
+ * @todo What if we check class only?
149
+ * @todo Use the form class::method ?
150
+ * @todo Check multiple functions and classes (array)
151
+ */
152
+ public static function is_filter_called_by( $function, $class = '' ) {
153
+ if ( empty( $function ) ) {
154
+ return false;
155
+ }
156
+
157
+ /**
158
+ * WP calls filters at level 4. This function adds one more level.
159
+ */
160
+ $trace_level = 5;
161
+
162
+ if ( version_compare( $GLOBALS['wp_version'], '4.6.999', '>' ) ) {
163
+ /**
164
+ * Starting with WordPress 4.7, WP_Hook adds one more level.
165
+ * @since 1.7.0
166
+ */
167
+ $trace_level = 6;
168
+ }
169
+
170
+ if ( version_compare( PHP_VERSION, '7.0.0', '>=' ) ) {
171
+ /**
172
+ * In PHP 7, `call_user_func_array` no longer appears in the trace
173
+ * as a separate call.
174
+ * @since 1.5.4
175
+ */
176
+ $trace_level --;
177
+ }
178
+
179
+ $callers = debug_backtrace();
180
+ if ( empty( $callers[ $trace_level ] ) ) {
181
+ return false;
182
+ }
183
+
184
+ /**
185
+ * First check: if function name matches
186
+ */
187
+ $maybe = ( $callers[ $trace_level ]['function'] === $function );
188
+
189
+ if ( $maybe ) {
190
+ /**
191
+ * Now check if we also asked for a specific class, and it matches
192
+ */
193
+ if ( ! empty( $class ) &&
194
+ ! empty( $callers[ $trace_level ]['class'] ) &&
195
+ $callers[ $trace_level ]['class'] !== $class
196
+ ) {
197
+ $maybe = false;
198
+ }
199
+ }
200
+
201
+ return $maybe;
202
+ }
203
+
204
+ /**
205
+ * Check if was called by a specific function (could be any levels deep).
206
+ *
207
+ * @param callable|string $method Function name or array(class,function).
208
+ *
209
+ * @return bool True if Function is in backtrace.
210
+ */
211
+ public static function is_function_in_backtrace( $method ) {
212
+ $function_in_backtrace = false;
213
+
214
+ // Parse callable into class and function.
215
+ if ( is_string( $method ) ) {
216
+ $function_name = $method;
217
+ $class_name = '';
218
+ } elseif ( is_array( $method ) && isset( $method[0], $method[1] ) ) {
219
+ list( $class_name, $function_name ) = $method;
220
+ } else {
221
+ return false;
222
+ }
223
+
224
+ // Traverse backtrace and stop if the callable is found there.
225
+ foreach ( debug_backtrace() as $_ ) {
226
+ if ( isset( $_['function'] ) && $_['function'] === $function_name ) {
227
+ $function_in_backtrace = true;
228
+ if ( $class_name && isset( $_['class'] ) && $_['class'] !== $class_name ) {
229
+ $function_in_backtrace = false;
230
+ }
231
+ if ( $function_in_backtrace ) {
232
+ break;
233
+ }
234
+ }
235
+ }
236
+
237
+ return $function_in_backtrace;
238
+ }
239
+
240
+ /**
241
+ * To call @see is_function_in_backtrace with the array of parameters.
242
+ *
243
+ * @param callable[] $callables Array of callables.
244
+ *
245
+ * @return bool True if any of the pair is found in the backtrace.
246
+ */
247
+ public static function is_functions_in_backtrace( Array $callables ) {
248
+ foreach ( $callables as $callable ) {
249
+ if ( self::is_function_in_backtrace( $callable ) ) {
250
+ return true;
251
+ }
252
+ }
253
+
254
+ return false;
255
+ }
256
+
257
+ /**
258
+ * True if I am in the Admin Panel, not doing AJAX
259
+ * @return bool
260
+ */
261
+ public static function in_wp_admin() {
262
+ return ( is_admin() && ! self::is_doing_ajax() );
263
+ }
264
+
265
+ } // class
266
+
267
+ # --- EOF
trunk/includes/class-wpglobus.php ADDED
@@ -0,0 +1,4113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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PGlobus {
10
+
11
+ const LOCALE_TAG = '{:%s}%s{:}';
12
+
13
+ const LOCALE_TAG_START = '{:%s}';
14
+
15
+ const LOCALE_TAG_END = '{:}';
16
+
17
+ const LOCALE_TAG_OPEN = '{:';
18
+
19
+ const LOCALE_TAG_CLOSE = '}';
20
+
21
+ const URL_WPGLOBUS_SITE = 'https://wpglobus.com/';
22
+
23
+ /**
24
+ * WPGlobus store URL.
25
+ *
26
+ * @since 2.2.4
27
+ */
28
+ const URL_WPGLOBUS_SHOP = 'https://wpglobus.com/shop/';
29
+
30
+ /**
31
+ * Language meta key.
32
+ *
33
+ * @since 1.9.17
34
+ */
35
+ const LANGUAGE_META_KEY = 'wpglobus_language';
36
+
37
+ /**
38
+ * Cookie name.
39
+ *
40
+ * @since 1.8
41
+ */
42
+ const _COOKIE = 'wpglobus-language';
43
+
44
+ /**
45
+ * Options page slug needed to get access to settings page
46
+ */
47
+ const OPTIONS_PAGE_SLUG = 'wpglobus_options';
48
+
49
+ /**
50
+ * Language edit page
51
+ */
52
+ const LANGUAGE_EDIT_PAGE = 'wpglobus_language_edit';
53
+
54
+ /**
55
+ * WPGlobus about page
56
+ */
57
+ const PAGE_WPGLOBUS_ABOUT = 'wpglobus-about';
58
+
59
+ /**
60
+ * WPGlobus clean page
61
+ */
62
+ const PAGE_WPGLOBUS_CLEAN = 'wpglobus-clean';
63
+
64
+ /**
65
+ * WPGlobus HelpDesk page
66
+ *
67
+ * @var string
68
+ * @since 1.6.5
69
+ */
70
+ const PAGE_WPGLOBUS_HELPDESK = 'wpglobus-helpdesk';
71
+
72
+ /**
73
+ * WPGlobus Admin Central page
74
+ *
75
+ * @var string
76
+ * @since 1.6.6
77
+ */
78
+ const PAGE_WPGLOBUS_ADMIN_CENTRAL = 'wpglobus-admin-central';
79
+
80
+ /**
81
+ * List navigation menus
82
+ *
83
+ * @var array
84
+ */
85
+ public $menus = array();
86
+
87
+ /**
88
+ * Initialized at plugin loader
89
+ *
90
+ * @var string
91
+ */
92
+ public static $PLUGIN_DIR_PATH = '';
93
+
94
+ /**
95
+ * Getter.
96
+ *
97
+ * @return string
98
+ */
99
+ public static function plugin_dir_path() {
100
+ return self::$PLUGIN_DIR_PATH;
101
+ }
102
+
103
+ /**
104
+ * Initialized at plugin loader
105
+ *
106
+ * @var string
107
+ */
108
+ public static $PLUGIN_DIR_URL = '';
109
+
110
+ /**
111
+ * Getter.
112
+ *
113
+ * @return string
114
+ */
115
+ public static function plugin_dir_url() {
116
+ return self::$PLUGIN_DIR_URL;
117
+ }
118
+
119
+ /**
120
+ * URL for internal images.
121
+ *
122
+ * @return string
123
+ */
124
+ public static function internal_images_url() {
125
+ return self::$PLUGIN_DIR_URL . 'includes/css/images';
126
+ }
127
+
128
+ /**
129
+ * Path to data folder.
130
+ *
131
+ * @return string
132
+ */
133
+ public static function data_path() {
134
+ return self::$PLUGIN_DIR_PATH . 'data';
135
+ }
136
+
137
+ /**
138
+ * Path to languages folder.
139
+ *
140
+ * @return string
141
+ * @since 1.9.6
142
+ */
143
+ public static function languages_path() {
144
+ return self::$PLUGIN_DIR_PATH . 'languages';
145
+ }
146
+
147
+ /**
148
+ * Get language meta key.
149
+ *
150
+ * @return string
151
+ * @since 1.9.17
152
+ */
153
+ public static function get_language_meta_key() {
154
+ return self::LANGUAGE_META_KEY;
155
+ }
156
+
157
+ /**
158
+ * @var bool $_SCRIPT_DEBUG Internal representation of the define('SCRIPT_DEBUG')
159
+ */
160
+ protected static $_SCRIPT_DEBUG = false;
161
+
162
+ /**
163
+ * @var string $_SCRIPT_SUFFIX Whether to use minimized or full versions of JS.
164
+ */
165
+ protected static $_SCRIPT_SUFFIX = '.min';
166
+
167
+ /**
168
+ * @return string
169
+ */
170
+ public static function SCRIPT_SUFFIX() {
171
+ return self::$_SCRIPT_SUFFIX;
172
+ }
173
+
174
+ /**
175
+ * To use as the 'version' argument for JS/CSS enqueue.
176
+ *
177
+ * @since 1.2.2
178
+ * @return string
179
+ */
180
+ public static function SCRIPT_VER() {
181
+ return ( self::$_SCRIPT_DEBUG ? sprintf( 'debug-%d', time() ) : WPGLOBUS_VERSION );
182
+ }
183
+
184
+ /**
185
+ * Support third party plugin vendors
186
+ */
187
+ public $vendors_scripts = array();
188
+
189
+ const RETURN_IN_DEFAULT_LANGUAGE = 'in_default_language';
190
+
191
+ const RETURN_EMPTY = 'empty';
192
+
193
+ /**
194
+ * Don't make some updates at post screen and don't load scripts for this entities
195
+ */
196
+ public $disabled_entities = array();
197
+
198
+ /**
199
+ * Array of enabled pages for loading scripts, styles to achieve WPGlobusCore, WPGlobusDialogApp
200
+ *
201
+ * @since 1.2.0
202
+ */
203
+ public $enabled_pages = array();
204
+
205
+ /**
206
+ * Constructor
207
+ */
208
+ public function __construct() {
209
+
210
+ if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) {
211
+ self::$_SCRIPT_DEBUG = true;
212
+ self::$_SCRIPT_SUFFIX = '';
213
+ }
214
+
215
+ /** @todo maybe move this action to Class WPGlobus_Upgrade ? */
216
+ add_action( 'admin_init', array(
217
+ $this,
218
+ 'on_admin_init',
219
+ ) );
220
+
221
+ global $pagenow;
222
+
223
+ /**
224
+ * Init array of supported plugins
225
+ */
226
+ $this->vendors_scripts['ACF'] = false;
227
+ $this->vendors_scripts['ACFPRO'] = false;
228
+ /** Set to true in @see WPGlobus_WPSEO::controller or WPGlobus_YoastSEO::controller */
229
+ $this->vendors_scripts['WPSEO'] = false;
230
+ $this->vendors_scripts['WPSEO_PREMIUM'] = false;
231
+ $this->vendors_scripts['WOOCOMMERCE'] = false;
232
+ $this->vendors_scripts['AIOSEOP'] = false; // All In One SEO Pack
233
+ $this->vendors_scripts['WPCF7'] = false; // Contact Form 7
234
+
235
+ if ( function_exists( 'acf' ) ) {
236
+
237
+ /**
238
+ * @todo Work on the ACF compatibility is in progress
239
+ * Temporarily add CPT acf ( Advanced Custom Fields ) to the array of disabled_entities
240
+ * @see 'wpglobus_disabled_entities' filter for add/remove custom post types to array disabled_entities
241
+ * @since 1.0.4
242
+ */
243
+ global $acf;
244
+ if ( ! empty( $acf->settings['pro'] ) && $acf->settings['pro'] ) {
245
+ /**
246
+ * @since 1.2.6
247
+ */
248
+ $this->vendors_scripts['ACFPRO'] = true;
249
+ } else {
250
+ $this->vendors_scripts['ACF'] = true;
251
+ }
252
+ }
253
+
254
+ if ( defined( 'WC_VERSION' ) || defined( 'WOOCOMMERCE_VERSION' ) ) {
255
+
256
+ $this->vendors_scripts['WOOCOMMERCE'] = true;
257
+
258
+ /**
259
+ * @todo May be move to includes\class-wpglobus-post-types.php
260
+ */
261
+ $this->disabled_entities[] = 'product_tag';
262
+ $this->disabled_entities[] = 'product_cat';
263
+
264
+ }
265
+
266
+ if ( defined( 'AIOSEOP_VERSION' ) ) {
267
+ $this->vendors_scripts['AIOSEOP'] = true;
268
+ }
269
+
270
+ if ( defined( 'WPCF7_VERSION' ) ) {
271
+ $this->vendors_scripts['WPCF7'] = true;
272
+ }
273
+
274
+ /**
275
+ * If you need add new vendors script and disable cpt
276
+ * you must add it to customizer also
277
+ *
278
+ * @see includes\admin\class-wpglobus-customize-options.php
279
+ */
280
+
281
+ /**
282
+ * @since 2.2.23
283
+ */
284
+ $this->disabled_entities = array_merge( $this->disabled_entities, WPGlobus_Post_Types::hidden_types() );
285
+
286
+ /**
287
+ * Add disabled post types from option
288
+ */
289
+ $option = get_option( self::Config()->option );
290
+ $options_post_types = empty( $option['post_type'] ) ? array() : $option['post_type'];
291
+ foreach ( $options_post_types as $post_type => $value ) {
292
+ if ( '1' != $value ) {
293
+ $this->disabled_entities[] = $post_type;
294
+ }
295
+ }
296
+
297
+ $this->disabled_entities = array_unique( $this->disabled_entities );
298
+
299
+ /**
300
+ * Set disabled entities into config
301
+ *
302
+ * @todo maybe move code to Class WPGlobus_Config
303
+ */
304
+ self::Config()->disabled_entities = $this->disabled_entities;
305
+
306
+ add_filter( 'wp_redirect', array(
307
+ $this,
308
+ 'on_wp_redirect',
309
+ ) );
310
+
311
+ global $pagenow;
312
+
313
+ /**
314
+ * @since 1.9.17
315
+ */
316
+ if ( self::Config()->toggle == 'on' || ! $this->user_can( 'wpglobus_toggle' ) ) {
317
+
318
+ if ( 'gutenberg' === self::Config()->builder->get_id() ) {
319
+
320
+ /**
321
+ * @since 2.2.35
322
+ */
323
+ require_once dirname( __FILE__ ) . '/builders/class-wpglobus-builder-update-post.php';
324
+
325
+ require_once dirname( __FILE__ ) . '/builders/gutenberg/class-wpglobus-gutenberg-update-post.php';
326
+ new WPGlobus_Gutenberg_Update_Post();
327
+
328
+ } else {
329
+
330
+ if ( self::Config()->builder->is_builder_page() ) {
331
+
332
+ $id = self::Config()->builder->get_id();
333
+
334
+ $_file = dirname( __FILE__ ) . '/builders/' . $id . '/class-wpglobus-' . $id . '-update-post.php';
335
+ if ( file_exists( $_file ) ) {
336
+ /**
337
+ * @since 2.2.35
338
+ */
339
+ require_once dirname( __FILE__ ) . '/builders/class-wpglobus-builder-update-post.php';
340
+
341
+ /** @noinspection PhpIncludeInspection */
342
+ require_once $_file;
343
+ $class_update_post = "WPGlobus_${id}_Update_Post";
344
+ new $class_update_post();
345
+ // new WPGlobus_Update_Post();
346
+ }
347
+ }
348
+ }
349
+ }
350
+
351
+ /**
352
+ * NOTE: do not check for !DOING_AJAX here.
353
+ */
354
+ if ( is_admin() ) {
355
+
356
+ /**
357
+ * Set values
358
+ *
359
+ * @since 1.2.0
360
+ */
361
+ $this->enabled_pages[] = self::LANGUAGE_EDIT_PAGE;
362
+ $this->enabled_pages[] = self::OPTIONS_PAGE_SLUG;
363
+ $this->enabled_pages[] = 'post.php';
364
+ $this->enabled_pages[] = 'post-new.php';
365
+ $this->enabled_pages[] = 'nav-menus.php';
366
+
367
+ /**
368
+ * @since 1.5.0
369
+ * edit-tags.php obsolete in WP 4.5
370
+ * term.php new in WP 4.5
371
+ */
372
+ $this->enabled_pages[] = 'edit-tags.php';
373
+ $this->enabled_pages[] = 'term.php';
374
+
375
+ $this->enabled_pages[] = 'edit.php';
376
+ $this->enabled_pages[] = 'options-general.php';
377
+ $this->enabled_pages[] = 'widgets.php';
378
+ $this->enabled_pages[] = 'customize.php';
379
+
380
+ /**
381
+ * WPGlobus clean page
382
+ *
383
+ * @since 1.4.3
384
+ */
385
+ $this->enabled_pages[] = self::PAGE_WPGLOBUS_CLEAN;
386
+
387
+ /**
388
+ * WPGlobus Admin Central page.
389
+ *
390
+ * @since 1.6.6
391
+ */
392
+ $this->enabled_pages[] = self::PAGE_WPGLOBUS_ADMIN_CENTRAL;
393
+
394
+ add_action( 'admin_body_class', array( $this, 'on_add_admin_body_class' ) );
395
+
396
+ add_action( 'wp_ajax_' . __CLASS__ . '_process_ajax', array( $this, 'on_process_ajax' ) );
397
+
398
+ require_once 'options/class-wpglobus-options.php';
399
+ new WPGlobus_Options();
400
+
401
+ /**
402
+ * @since 1.9.17
403
+ * @see 'post_submitbox_misc_actions'
404
+ */
405
+ add_action( 'post_submitbox_misc_actions', array(
406
+ $this,
407
+ 'on_add_devmode_switcher',
408
+ ) );
409
+
410
+ if ( self::Config()->toggle == 'on' || ! $this->user_can( 'wpglobus_toggle' ) ) {
411
+
412
+ global $pagenow;
413
+
414
+ if ( in_array( $pagenow, array( 'edit-tags.php', 'term.php' ), true ) ) {
415
+ /**
416
+ * Need to get taxonomy to use the correct filter.
417
+ */
418
+ $taxonomy_slug = WPGlobus_Utils::safe_get( 'taxonomy' );
419
+ if ( $taxonomy_slug ) {
420
+ add_action( "{$taxonomy_slug}_pre_edit_form",
421
+ array( $this, 'on_add_language_tabs_edit_taxonomy' ),
422
+ 10, 2
423
+ );
424
+
425
+ add_action( "{$taxonomy_slug}_edit_form",
426
+ array( $this, 'on_add_taxonomy_form_wrapper' ),
427
+ 10, 2
428
+ );
429
+ }
430
+ }
431
+
432
+ /**
433
+ * @since 1.9.17
434
+ */
435
+ if ( self::Config()->builder->maybe_run( 'gutenberg', true ) ) {
436
+ require_once dirname( __FILE__ ) . '/builders/class-wpglobus-builder.php';
437
+ require_once dirname( __FILE__ ) . '/builders/gutenberg/class-wpglobus-gutenberg.php';
438
+ $builder = new WPGlobus_Gutenberg();
439
+ require_once dirname( __FILE__ ) . '/vendor/wpglobus-vendors.php';
440
+
441
+ /**
442
+ * @since 2.2.22
443
+ */
444
+ require_once 'admin/media/wpglobus-media.php';
445
+ }
446
+
447
+ /**
448
+ * @since 1.9.17
449
+ */
450
+ add_action( 'edit_form_after_editor', array(
451
+ $this,
452
+ 'on_add_language_tabs',
453
+ ) );
454
+
455
+ add_action( 'admin_print_styles', array(
456
+ $this,
457
+ 'on_admin_styles',
458
+ ) );
459
+
460
+ add_action( 'admin_print_scripts', array(
461
+ $this,
462
+ 'on_admin_scripts',
463
+ ) );
464
+
465
+ if ( 'core' === self::Config()->builder->get( 'context' ) && self::Config()->builder->is_builder_page() ) {
466
+ /**
467
+ * @since 2.0.0
468
+ */
469
+ add_action( 'block_editor_meta_box_hidden_fields', array(
470
+ $this,
471
+ 'on_add_title_fields',
472
+ ) );
473
+ } else {
474
+
475
+ add_action( 'edit_form_after_title', array(
476
+ $this,
477
+ 'on_add_title_fields',
478
+ ) );
479
+ }
480
+
481
+ add_action( 'admin_footer', array(
482
+ $this,
483
+ 'on__admin_footer',
484
+ ) );
485
+
486
+ /**
487
+ * @see browser tab on post.php page.
488
+ */
489
+ add_filter( 'admin_title', array(
490
+ $this,
491
+ 'on__admin_title',
492
+ ), 10, 2 );
493
+
494
+ /**
495
+ * @since 1.9.17
496
+ */
497
+ if ( self::Config()->builder->maybe_run( '', true ) ) {
498
+
499
+ $_file = dirname( __FILE__ ) . '/builders/' . self::Config()->builder->get_id() . '/class-wpglobus-' . self::Config()->builder->get_id() . '.php';
500
+
501
+ if ( file_exists( $_file ) ) {
502
+
503
+ require_once dirname( __FILE__ ) . '/builders/class-wpglobus-builder.php';
504
+ /** @noinspection PhpIncludeInspection */
505
+ require_once $_file;
506
+ /**
507
+ * @todo test with builders.
508
+ */
509
+ $builder_class = self::Config()->builder->get_class();
510
+ if ( class_exists( $builder_class ) ) {
511
+ $builder = new $builder_class();
512
+ }
513
+ require_once dirname( __FILE__ ) . '/vendor/wpglobus-vendors.php';
514
+
515
+ /**
516
+ * @since 2.2.22
517
+ */
518
+ require_once 'admin/media/wpglobus-media.php';
519
+
520
+ return;
521
+ }
522
+ }
523
+ }
524
+
525
+ if ( self::Config()->toggle == 'on' || ! $this->user_can( 'wpglobus_toggle' ) ) {
526
+
527
+ /**
528
+ * Filters for adding language column to edit.php page
529
+ */
530
+ if ( WPGlobus_WP::is_pagenow( 'edit.php' ) && ! $this->disabled_entity() ) {
531
+
532
+ $post_type_filter = WPGlobus_Utils::safe_get( 'post_type' );
533
+ if ( $post_type_filter ) {
534
+ // This is a CPT.
535
+ // Add underscore to form the
536
+ // "manage_{$post->post_type}_posts_custom_column" filter.
537
+ $post_type_filter = '_' . $post_type_filter;
538
+ }
539
+
540
+ add_filter( "manage{$post_type_filter}_posts_columns",
541
+ array( $this, 'on_add_language_column' )
542
+ );
543
+
544
+ add_filter( "manage{$post_type_filter}_posts_custom_column",
545
+ array( $this, 'on_manage_language_column' )
546
+ );
547
+
548
+ }
549
+
550
+ /**
551
+ * Join post content and post title for enabled languages in func wp_insert_post
552
+ *
553
+ * @see action in wp-includes\post.php:3326
554
+ */
555
+ add_action( 'wp_insert_post_data', array(
556
+ $this,
557
+ 'on_save_post_data',
558
+ ), 10, 2 );
559
+
560
+ add_action( 'edit_form_after_editor', array(
561
+ $this,
562
+ 'on_add_wp_editors',
563
+ ), 10 );
564
+
565
+ add_action( 'admin_print_scripts', array(
566
+ $this,
567
+ 'on_admin_enqueue_scripts',
568
+ ), 99 );
569
+
570
+ if (
571
+ $this->vendors_scripts['AIOSEOP'] && WPGlobus_WP::is_pagenow( array(
572
+ 'post.php',
573
+ 'post-new.php',
574
+ 'edit.php',
575
+ ) )
576
+ ) {
577
+
578
+ if ( self::Config()->builder->is_builder_page() ) {
579
+ /** Don't run in Builder mode. */
580
+ } else {
581
+ /**
582
+ * Support Standard/Classic mode.
583
+ */
584
+
585
+ /** @global WP_Post $post */
586
+ global $post;
587
+
588
+ $type = empty( $post ) ? '' : $post->post_type;
589
+ if ( ! $this->disabled_entity( $type ) ) {
590
+
591
+ require_once 'vendor/wpglobus-aioseop.php';
592
+ /**
593
+ * @since 2.3.9 remove after testing.
594
+ */
595
+ //require_once 'vendor/class-wpglobus-aioseop.php';
596
+ //if ( WPGlobus_WP::is_pagenow( array( 'post.php', 'post-new.php' ) ) ) {
597
+ /** @noinspection PhpUnusedLocalVariableInspection */
598
+ //$WPGlobus_aioseop = new WPGlobus_aioseop();
599
+ //}
600
+ }
601
+ }
602
+ }
603
+
604
+ /**
605
+ * @since 2.2.22
606
+ */
607
+ require_once 'admin/media/wpglobus-media.php';
608
+
609
+ } // endif $devmode
610
+
611
+ if (
612
+ ( $this->vendors_scripts['ACF'] || $this->vendors_scripts['ACFPRO'] )
613
+ && WPGlobus_WP::is_pagenow(
614
+ array(
615
+ 'post.php',
616
+ 'post-new.php',
617
+ )
618
+ )
619
+ ) {
620
+ require_once 'vendor/class-wpglobus-acf.php';
621
+ $WPGlobus_acf = new WPGlobus_Acf();
622
+ }
623
+
624
+ add_action( 'admin_menu', array(
625
+ $this,
626
+ 'on_admin_menu',
627
+ ), 10 );
628
+
629
+ add_action( 'admin_bar_menu', array(
630
+ $this,
631
+ 'on_admin_bar_menu',
632
+ ) );
633
+
634
+ /**
635
+ * @scope admin
636
+ * @since 1.7.11
637
+ */
638
+ add_action( 'admin_enqueue_scripts', array(
639
+ $this,
640
+ 'enqueue_wpglobus_js',
641
+ ), 1000 );
642
+
643
+ if ( WPGlobus_WP::is_pagenow( 'plugin-install.php' ) ) {
644
+ require_once 'admin/class-wpglobus-plugin-install.php';
645
+ WPGlobus_Plugin_Install::controller();
646
+ }
647
+ } else {
648
+
649
+ /**
650
+ * @scope front
651
+ */
652
+
653
+ /**
654
+ * @since 1.9.17
655
+ */
656
+ if ( self::Config()->builder->maybe_run( '', true ) ) {
657
+
658
+ $_file = dirname( __FILE__ ) . '/builders/' . self::Config()->builder->get_id() . '/class-wpglobus-' . self::Config()->builder->get_id() . '.php';
659
+ if ( file_exists( $_file ) ) {
660
+
661
+ require_once dirname( __FILE__ ) . '/builders/class-wpglobus-builder.php';
662
+ /** @noinspection PhpIncludeInspection */
663
+ require_once $_file;
664
+
665
+ $builder_class = self::Config()->builder->get_class();
666
+ if ( class_exists( $builder_class ) ) {
667
+ $builder = new $builder_class();
668
+ }
669
+ /**
670
+ * @todo check loading
671
+ */
672
+ //require_once dirname( __FILE__ ) . '/vendor/wpglobus-vendors.php';
673
+
674
+ }
675
+ }
676
+
677
+ $this->menus = self::_get_nav_menus();
678
+
679
+ /**
680
+ * @todo This filter is currently disabled. Need to check if we need it.
681
+ * The on_wp_list_pages is called directly from on_wp_page_menu
682
+ */
683
+ 0 && add_filter( 'wp_list_pages', array(
684
+ $this,
685
+ 'on_wp_list_pages',
686
+ ), 99, 2 );
687
+
688
+ add_filter( 'wp_page_menu', array(
689
+ $this,
690
+ 'on_wp_page_menu',
691
+ ), 99, 2 );
692
+
693
+ /**
694
+ * Add language switcher to navigation menu
695
+ *
696
+ * @see on_add_item
697
+ */
698
+ add_filter( 'wp_nav_menu_objects', array(
699
+ $this,
700
+ 'on_add_item',
701
+ ), 99, 2 );
702
+
703
+ /**
704
+ * Convert url for menu items
705
+ */
706
+ add_filter( 'wp_nav_menu_objects', array(
707
+ $this,
708
+ 'on_get_convert_url_menu_items',
709
+ ), 10, 2 );
710
+
711
+ add_action( 'wp_head', array(
712
+ $this,
713
+ 'on_wp_head',
714
+ ), 11 );
715
+
716
+ add_action( 'wp_footer', array(
717
+ $this,
718
+ 'on__wp_footer',
719
+ ), 99 );
720
+
721
+ add_action( 'wp_head', array(
722
+ $this,
723
+ 'on_add_hreflang',
724
+ ), 11 );
725
+
726
+ add_action( 'wp_print_styles', array(
727
+ $this,
728
+ 'on_wp_styles',
729
+ ) );
730
+
731
+ add_action( 'wp_enqueue_scripts',
732
+ array(
733
+ $this,
734
+ 'enqueue_wpglobus_js',
735
+ ),
736
+ /**
737
+ * Load this script as late as possible,
738
+ * because it triggers the `wpglobus_current_language_changed` event.
739
+ *
740
+ * @since 1.5.5
741
+ */
742
+ PHP_INT_MAX
743
+ );
744
+ }
745
+
746
+ }
747
+
748
+ /**
749
+ * Insert language title to edit.php page
750
+ *
751
+ * @param array $posts_columns
752
+ *
753
+ * @return array
754
+ */
755
+ public function on_add_language_column( $posts_columns ) {
756
+ /**
757
+ * Which column we insert after?
758
+ */
759
+ $insert_after = 'title';
760
+
761
+ $i = 0;
762
+ foreach ( $posts_columns as $key => $value ) {
763
+ if ( $key == $insert_after ) {
764
+ break;
765
+ }
766
+ $i ++;
767
+ }
768
+ $posts_columns =
769
+ array_slice( $posts_columns, 0, $i + 1 ) + array( 'wpglobus_languages' => 'Language' ) + array_slice( $posts_columns, $i + 1 );
770
+
771
+ /**
772
+ * Filter the columns displayed in the Posts list table.
773
+ * Returning array.
774
+ *
775
+ * @since 1.6.5
776
+ *
777
+ * @param array $posts_columns An array of column names.
778
+ */
779
+ return apply_filters( 'wpglobus_manage_posts_columns', $posts_columns );
780
+
781
+ }
782
+
783
+ /**
784
+ * Insert flags to every item at edit.php page
785
+ *
786
+ * @param string $column_name
787
+ */
788
+ public function on_manage_language_column( $column_name ) {
789
+
790
+ if ( 'wpglobus_languages' == $column_name ) {
791
+
792
+ /** @global WP_Post $post */
793
+ global $post;
794
+
795
+ $output = array();
796
+ $i = 0;
797
+ foreach ( self::Config()->enabled_languages as $l ) {
798
+ if ( 1 == preg_match( "/(\{:|\[:|<!--:)[$l]{2}/", $post->post_title . $post->post_content ) ) {
799
+ $output[ $i ] =
800
+ '<img title="' . self::Config()->en_language_name[ $l ] .
801
+ '" src="' . self::Config()->flags_url . self::Config()->flag[ $l ] . '" />';
802
+
803
+ /**
804
+ * Filter language item.
805
+ * Returning string.
806
+ *
807
+ * @since 1.0.14
808
+ *
809
+ * @param string $output Language item.
810
+ * @param array $post An object WP_Post.
811
+ * @param string $l The language.
812
+ */
813
+ $output[ $i ] = apply_filters( 'wpglobus_manage_language_item', $output[ $i ], $post, $l );
814
+ $i ++;
815
+ }
816
+ }
817
+
818
+ /**
819
+ * Filter language items before output.
820
+ * Returning array.
821
+ *
822
+ * @since 1.6.6
823
+ *
824
+ * @param string $output Array of language items.
825
+ * @param array $post An object WP_Post.
826
+ */
827
+ $output = apply_filters( 'wpglobus_manage_language_items', $output, $post );
828
+
829
+ if ( ! empty( $output ) ) {
830
+ echo implode( '<br />', $output ); // WPCS: XSS ok.
831
+ }
832
+ }
833
+
834
+ }
835
+
836
+
837
+ /**
838
+ * Handle ajax process
839
+ */
840
+ public function on_process_ajax() {
841
+
842
+ $ajax_return = array();
843
+
844
+ /**
845
+ * Sanitize
846
+ */
847
+
848
+ $order = wp_unslash( $_POST['order'] ); // phpcs:ignore WordPress.CSRF.NonceVerification
849
+
850
+ $action = '';
851
+ if ( isset( $order['action'] ) && is_string( $order['action'] ) ) {
852
+ $action = sanitize_text_field( $order['action'] );
853
+ }
854
+ $post_type = '';
855
+ if ( isset( $order['post_type'] ) && is_string( $order['post_type'] ) ) {
856
+ $post_type = sanitize_text_field( $order['post_type'] );
857
+ }
858
+ $meta_key = '';
859
+ if ( isset( $order['meta_key'] ) && is_string( $order['meta_key'] ) ) {
860
+ $meta_key = sanitize_text_field( $order['meta_key'] );
861
+ }
862
+ $checked = '';
863
+ if ( isset( $order['checked'] ) && is_string( $order['checked'] ) ) {
864
+ $checked = sanitize_text_field( $order['checked'] );
865
+ }
866
+ $id = '';
867
+ if ( isset( $order['id'] ) && is_string( $order['id'] ) ) {
868
+ $id = sanitize_text_field( $order['id'] );
869
+ }
870
+ $locale = '';
871
+ if ( isset( $order['locale'] ) && is_string( $order['locale'] ) ) {
872
+ $locale = sanitize_text_field( $order['locale'] );
873
+ }
874
+ $type = '';
875
+ if ( isset( $order['type'] ) && is_string( $order['type'] ) ) {
876
+ $type = sanitize_text_field( $order['type'] );
877
+ }
878
+ $taxonomy = '';
879
+ if ( isset( $order['taxonomy'] ) && is_string( $order['taxonomy'] ) ) {
880
+ $taxonomy = sanitize_text_field( $order['taxonomy'] );
881
+ }
882
+ $titles = array();
883
+ if ( isset( $order['title'] ) && is_array( $order['title'] ) ) {
884
+ $titles = $order['title'];
885
+ }
886
+
887
+ switch ( $action ) {
888
+ case 'clean':
889
+ case 'wpglobus-reset':
890
+ require_once 'admin/class-wpglobus-clean.php';
891
+ WPGlobus_Clean::process_ajax( $order );
892
+
893
+ break;
894
+ case 'save_post_meta_settings':
895
+ /**
896
+ * This is the WPGlobus icon, wrench and checkbox on custom post meta fields.
897
+ */
898
+
899
+ $settings = (array) get_option( self::Config()->option_post_meta_settings );
900
+
901
+ if ( empty( $settings[ $post_type ] ) ) {
902
+ $settings[ $post_type ] = array();
903
+ }
904
+ $settings[ $post_type ][ $meta_key ] = $checked;
905
+ if ( update_option( self::Config()->option_post_meta_settings, $settings ) ) {
906
+ $ajax_return['result'] = 'ok';
907
+ } else {
908
+ $ajax_return['result'] = 'error';
909
+ }
910
+ $ajax_return['checked'] = $checked;
911
+ $ajax_return['id'] = $id;
912
+ $ajax_return['meta_key'] = $meta_key;
913
+ break;
914
+ case 'wpglobus_select_lang':
915
+ if ( 'en_US' === $locale ) {
916
+ update_option( 'WPLANG', '' );
917
+ } else {
918
+ update_option( 'WPLANG', $locale );
919
+ }
920
+ break;
921
+ case 'get_titles':
922
+ /**
923
+ * Prepare multilingual titles for Quick Edit.
924
+ */
925
+
926
+ if ( 'taxonomy' === $type ) {
927
+ /**
928
+ * Remove filter to get raw term description
929
+ */
930
+ remove_filter( 'get_term', array( 'WPGlobus_Filters', 'filter__get_term' ), 0 );
931
+ }
932
+
933
+ $config = self::Config();
934
+
935
+ $result = array();
936
+ $bulkedit_post_titles = array();
937
+
938
+ /**
939
+ * Iterate through the Titles array.
940
+ *
941
+ * @var int $id Post or Term ID.
942
+ * @var string[] $data Post or Term Name is stored in the $data['source'].
943
+ */
944
+ foreach ( (array) $titles as $post_or_term_id => $data ) {
945
+ $title = '';
946
+ if ( ! empty( $data['source'] ) && is_string( $data['source'] ) ) {
947
+ $title = $data['source'];
948
+ }
949
+
950
+ if ( ! WPGlobus_Core::has_translations( $title ) ) {
951
+ /**
952
+ * In some cases, we've lost the raw data for post title on edit.php page
953
+ * for example product post type from Woo.
954
+ */
955
+ $_title_from_db = '';
956
+ if ( 'post' === $type ) {
957
+ $_title_from_db = get_post_field( 'post_title', $post_or_term_id );
958
+ } elseif ( 'taxonomy' === $type ) {
959
+ $_term_by_id = get_term_by( 'id', $post_or_term_id, $taxonomy );
960
+ if ( $_term_by_id ) {
961
+ $_title_from_db = $_term_by_id->name;
962
+ }
963
+ }
964
+
965
+ if ( $_title_from_db ) {
966
+ $title = $_title_from_db;
967
+ }
968
+
969
+ unset( $_term_by_id, $_title_from_db );
970
+ }
971
+
972
+ $result[ $post_or_term_id ]['source'] = $title;
973
+
974
+ $term = null; // Should initialize before if because used in the next foreach.
975
+
976
+ if ( 'taxonomy' === $type && $taxonomy ) {
977
+ $term = get_term( $post_or_term_id, $taxonomy );
978
+ if ( is_wp_error( $term ) ) {
979
+ $taxonomy = false;
980
+ }
981
+ }
982
+
983
+ foreach ( $config->enabled_languages as $language ) {
984
+ $return =
985
+ $language === $config->default_language ? self::RETURN_IN_DEFAULT_LANGUAGE : self::RETURN_EMPTY;
986
+
987
+ $result[ $post_or_term_id ][ $language ]['name'] =
988
+ WPGlobus_Core::text_filter( $title, $language, $return );
989
+ if ( $term && 'taxonomy' === $type && $taxonomy ) {
990
+ $result[ $post_or_term_id ][ $language ]['description'] =
991
+ WPGlobus_Core::text_filter( $term->description, $language, $return );
992
+ }
993
+
994
+ $bulkedit_post_titles[ $post_or_term_id ][ $language ]['name'] =
995
+ WPGlobus_Core::text_filter( $title, $language, self::RETURN_IN_DEFAULT_LANGUAGE );
996
+ }
997
+ }
998
+ $ajax_return['qedit_titles'] = $result;
999
+ $ajax_return['bulkedit_post_titles'] = $bulkedit_post_titles;
1000
+ break;
1001
+ case 'getNavMenuItemsDescription':
1002
+ /**
1003
+ * @since 1.9.16
1004
+ */
1005
+ $ids = array();
1006
+ if ( ! empty( $order['menuItems'] ) ) {
1007
+ foreach ( $order['menuItems'] as $item_id ) {
1008
+ $_id = str_replace( 'edit-menu-item-description-', '', $item_id );
1009
+ $_id = (int) $_id;
1010
+ if ( $_id > 0 ) {
1011
+ $ids[] = $_id;
1012
+ }
1013
+ }
1014
+ }
1015
+
1016
+ $_results = array();
1017
+ if ( ! empty( $ids ) ) {
1018
+ $query = new WP_Query(
1019
+ array(
1020
+ 'post_type' => 'nav_menu_item',
1021
+ 'post__in' => $ids,
1022
+ )
1023
+ );
1024
+ $_results = $query->posts;
1025
+ }
1026
+
1027
+ $ajax_return = array();
1028
+ if ( ! empty( $_results ) ) {
1029
+ foreach ( $_results as $_post ) {
1030
+ if ( ! empty( $_post->post_content ) ) {
1031
+ $ajax_return[ 'edit-menu-item-description-' . $_post->ID ] = $_post->post_content;
1032
+ }
1033
+ }
1034
+ }
1035
+ break;
1036
+ }
1037
+
1038
+ echo wp_json_encode( $ajax_return );
1039
+ die();
1040
+ }
1041
+
1042
+ /**
1043
+ * Ugly hack.
1044
+ *
1045
+ * @see wp_page_menu
1046
+ *
1047
+ * @param string $html
1048
+ *
1049
+ * @return string
1050
+ */
1051
+ public function on_wp_page_menu( $html ) {
1052
+ $switcher_html = $this->on_wp_list_pages( '' );
1053
+ $html = str_replace( '</ul></div>', $switcher_html . '</ul></div>', $html );
1054
+
1055
+ return $html;
1056
+ }
1057
+
1058
+ /**
1059
+ * Start WPGlobus on "init" hook.
1060
+ */
1061
+ public static function init() {
1062
+ /** @global WPGlobus WPGlobus */
1063
+ global $WPGlobus;
1064
+ $WPGlobus = new self();
1065
+ }
1066
+
1067
+ /**
1068
+ * Set transient wpglobus_activated after activated plugin @see on_admin_init()
1069
+ *
1070
+ * @todo use $WPGlobus_Config to determine running this function?
1071
+ *
1072
+ * @param string $plugin
1073
+ *
1074
+ * @return void
1075
+ */
1076
+ public static function activated( $plugin ) {
1077
+ if ( WPGLOBUS_PLUGIN_BASENAME == $plugin ) {
1078
+ /**
1079
+ * Run on_activate after plugin activated
1080
+ */
1081
+ $options['plugin'] = $plugin;
1082
+ $options['action'] = 'update';
1083
+ self::Config()->on_activate( null, $options );
1084
+
1085
+ /** @noinspection SummerTimeUnsafeTimeManipulationInspection */
1086
+ set_transient( 'wpglobus_activated', '', 60 * 60 * 24 );
1087
+ }
1088
+ }
1089
+
1090
+ /**
1091
+ * WP redirect hook
1092
+ *
1093
+ * @param string $location
1094
+ *
1095
+ * @return string
1096
+ */
1097
+ public function on_wp_redirect( $location ) {
1098
+ if ( is_admin() ) {
1099
+ $_wp_http_referer = '';
1100
+ if ( isset( $_POST['_wp_http_referer'] ) && is_string( $_POST['_wp_http_referer'] ) ) { // phpcs:ignore WordPress.CSRF.NonceVerification
1101
+ $_wp_http_referer = sanitize_text_field( wp_unslash( $_POST['_wp_http_referer'] ) ); // phpcs:ignore WordPress.CSRF.NonceVerification
1102
+ }
1103
+ if ( false !== strpos( $_wp_http_referer, 'wpglobus=off' ) ) {
1104
+ $location .= '&wpglobus=off';
1105
+ }
1106
+ } else {
1107
+ /**
1108
+ * Get language code from cookie. Example: redirect $_SERVER[REQUEST_URI] = /wp-comments-post.php
1109
+ */
1110
+ $request_uri = '';
1111
+ if ( isset( $_SERVER['REQUEST_URI'] ) && is_string( $_SERVER['REQUEST_URI'] ) ) { // WPCS: input var ok, sanitization ok.
1112
+ $request_uri = sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ); // WPCS: input var ok.
1113
+ }
1114
+ if ( false !== strpos( $request_uri, 'wp-comments-post.php' ) ) {
1115
+ if ( ! empty( $_COOKIE[ self::_COOKIE ] ) && is_string( $_COOKIE[ self::_COOKIE ] ) ) { // WPCS: input var ok, sanitization ok.
1116
+ $wpglobus_language_cookie = sanitize_text_field( wp_unslash( $_COOKIE[ self::_COOKIE ] ) ); // WPCS: input var ok.
1117
+ $location = WPGlobus_Utils::localize_url( $location, $wpglobus_language_cookie );
1118
+ }
1119
+ }
1120
+ }
1121
+
1122
+ return $location;
1123
+ }
1124
+
1125
+ /**
1126
+ * Check if the current user has the $cap capability
1127
+ *
1128
+ * @param string $cap
1129
+ *
1130
+ * @return bool
1131
+ */
1132
+ public function user_can( $cap = '' ) {
1133
+ global $current_user;
1134
+ if ( empty( $current_user ) ) {
1135
+ wp_get_current_user();
1136
+ }
1137
+ if ( 'wpglobus_toggle' == $cap ) {
1138
+ if ( $this->user_has_role( 'administrator' ) || current_user_can( $cap ) ) {
1139
+ return true;
1140
+ }
1141
+
1142
+ return false;
1143
+ }
1144
+
1145
+ return true;
1146
+ }
1147
+
1148
+ /**
1149
+ * Check current user has $role
1150
+ *
1151
+ * @param string $role
1152
+ *
1153
+ * @return boolean
1154
+ */
1155
+ public function user_has_role( $role = '' ) {
1156
+ global $current_user;
1157
+ if ( empty( $current_user ) ) {
1158
+ wp_get_current_user();
1159
+ }
1160
+
1161
+ return in_array( $role, $current_user->roles );
1162
+ }
1163
+
1164
+ /**
1165
+ * Add switcher to publish metabox.
1166
+ *
1167
+ * @return void
1168
+ */
1169
+ public function on_add_devmode_switcher() {
1170
+
1171
+ if ( ! $this->user_can( 'wpglobus_toggle' ) ) {
1172
+ return;
1173
+ }
1174
+
1175
+ global $post, $pagenow;
1176
+
1177
+ if ( 'post.php' != $pagenow ) {
1178
+ return;
1179
+ }
1180
+
1181
+ if ( $this->disabled_entity( $post->post_type ) ) {
1182
+ return;
1183
+ }
1184
+
1185
+ // "Reverse" logic here. It's the mode to turn to, not the current one.
1186
+ $mode = 'off';
1187
+ if ( isset( $_GET['wpglobus'] ) && 'off' === $_GET['wpglobus'] ) { // phpcs:ignore WordPress.CSRF.NonceVerification
1188
+ $mode = 'on';
1189
+ }
1190
+
1191
+ $query_string = explode( '&', $_SERVER['QUERY_STRING'] );
1192
+
1193
+ foreach ( $query_string as $key => $_q ) {
1194
+ if ( false !== strpos( $_q, 'wpglobus=' ) ) {
1195
+ unset( $query_string[ $key ] );
1196
+ }
1197
+ }
1198
+
1199
+ $query = implode( '&', $query_string );
1200
+ $url = admin_url(
1201
+ add_query_arg(
1202
+ array( 'wpglobus' => $mode ),
1203
+ 'post.php?' . $query
1204
+ )
1205
+ );
1206
+
1207
+ if ( 'on' === $mode ) {
1208
+ // Translators: ON/OFF status of WPGlobus on the edit pages.
1209
+ $status_text = __( 'OFF', 'wpglobus' );
1210
+ $toggle_text = __( 'Turn on', 'wpglobus' );
1211
+ $highlight_class = 'wp-ui-text-notification';
1212
+ } else {
1213
+ // Translators: ON/OFF status of WPGlobus on the edit pages.
1214
+ $status_text = __( 'ON', 'wpglobus' );
1215
+ $toggle_text = __( 'Turn off', 'wpglobus' );
1216
+ $highlight_class = 'wp-ui-text-highlight';
1217
+ }
1218
+
1219
+ /**
1220
+ * @since 1.9.17
1221
+ */
1222
+ $language = self::Config()->default_language;
1223
+ if ( ! empty( $_GET['language'] ) ) { // phpcs:ignore WordPress.CSRF.NonceVerification
1224
+ $language = sanitize_text_field( wp_unslash( $_GET['language'] ) ); // phpcs:ignore WordPress.CSRF.NonceVerification
1225
+ } else {
1226
+ $language = get_post_meta( $post->ID, self::LANGUAGE_META_KEY, true );
1227
+ }
1228
+ if ( empty( $language ) || ! in_array( $language, self::Config()->enabled_languages, true ) ) {
1229
+ $language = self::Config()->default_language;
1230
+ }
1231
+ ?>
1232
+ <div class="misc-pub-section wpglobus-switch">
1233
+ <span id="wpglobus-raw" style="margin-right: 2px;"
1234
+ class="dashicons dashicons-admin-site <?php echo esc_attr( $highlight_class ); ?>"></span>
1235
+ <?php esc_html_e( 'WPGlobus', 'wpglobus' ); ?>:
1236
+ <strong class="<?php echo esc_attr( $highlight_class ); ?>"><?php echo esc_html( $status_text ); ?></strong>
1237
+ <a class="button button-small" style="margin:-3px 0 0 3px;"
1238
+ href="<?php echo esc_url( $url ); ?>"><?php echo esc_html( $toggle_text ); ?></a>
1239
+
1240
+ <!-- @since 1.9.17 -->
1241
+ <?php // @todo add separate function ?>
1242
+ <input type="hidden" id="<?php echo esc_attr( self::LANGUAGE_META_KEY ); ?>"
1243
+ name="<?php echo esc_attr( self::LANGUAGE_META_KEY ); ?>"
1244
+ value="<?php echo esc_attr( $language ); ?>"/>
1245
+ </div>
1246
+ <?php
1247
+ }
1248
+
1249
+ public function on_admin_enqueue_scripts() {
1250
+ /**
1251
+ * @see on_admin_scripts()
1252
+ */
1253
+ if ( ! wp_script_is( 'autosave', 'enqueued' ) ) {
1254
+ wp_enqueue_script( 'autosave' );
1255
+ }
1256
+ }
1257
+
1258
+ /**
1259
+ * Enqueue admin scripts
1260
+ *
1261
+ * @return void
1262
+ */
1263
+ public function on_admin_scripts() {
1264
+
1265
+ $post = get_post();
1266
+ $type = empty( $post->post_type ) ? '' : $post->post_type;
1267
+
1268
+ if ( $this->disabled_entity( $type ) ) {
1269
+ return;
1270
+ }
1271
+
1272
+ /**
1273
+ * Dequeue autosave for prevent alert from wp.autosave.server.postChanged() after run post_edit in wpglobus.admin.js
1274
+ *
1275
+ * @see wp-includes\js\autosave.js
1276
+ */
1277
+ wp_dequeue_script( 'autosave' );
1278
+
1279
+ $pagenow = WPGlobus_WP::pagenow();
1280
+
1281
+ $config = self::Config();
1282
+
1283
+ /**
1284
+ * Get array of enabled pages for loading js
1285
+ */
1286
+ $enabled_pages = $this->enabled_pages;
1287
+
1288
+ /**
1289
+ * Init $post_content
1290
+ */
1291
+ $post_content = '';
1292
+
1293
+ /**
1294
+ * Init $post_title
1295
+ */
1296
+ $post_title = '';
1297
+
1298
+ /**
1299
+ * Init $post_excerpt
1300
+ */
1301
+ $post_excerpt = '';
1302
+
1303
+ /**
1304
+ * Init $page_action
1305
+ */
1306
+ $page_action = '';
1307
+
1308
+ /**
1309
+ * Init $page
1310
+ */
1311
+ $page = '';
1312
+
1313
+ /**
1314
+ * Init array data depending on the context for localize script
1315
+ */
1316
+ $data = array(
1317
+ 'default_language' => $config->default_language,
1318
+ 'language' => $config->language,
1319
+ 'enabled_languages' => $config->enabled_languages,
1320
+ 'open_languages' => $config->open_languages,
1321
+ 'en_language_name' => $config->en_language_name,
1322
+ 'locale_tag_start' => self::LOCALE_TAG_START,
1323
+ 'locale_tag_end' => self::LOCALE_TAG_END,
1324
+ );
1325
+
1326
+ if ( ! in_array( $pagenow, $enabled_pages ) ) {
1327
+ $page = WPGlobus_WP::plugin_page();
1328
+ }
1329
+
1330
+ if ( '' == $page ) {
1331
+ /**
1332
+ * Now get $pagenow
1333
+ */
1334
+ $page = isset( $pagenow ) ? $pagenow : '';
1335
+
1336
+ if ( 'post.php' == $page || 'post-new.php' == $page ) {
1337
+
1338
+ $page_action = 'post.php';
1339
+
1340
+ /**
1341
+ * We use $post_content, $post_title at edit post page
1342
+ */
1343
+
1344
+ /**
1345
+ * Set $post_content for default language
1346
+ * because we have text with all languages and delimiters in $post->post_content
1347
+ * next we send $post_content to js with localize script
1348
+ *
1349
+ * @see post_edit() in admin.globus.js
1350
+ */
1351
+ $post_content = WPGlobus_Core::text_filter( $post->post_content, $config->default_language );
1352
+
1353
+ /**
1354
+ * Set $post_title for default language
1355
+ */
1356
+ $post_title = WPGlobus_Core::text_filter( $post->post_title, $config->default_language );
1357
+
1358
+ }
1359
+ }
1360
+
1361
+ if ( in_array( $page, array( self::LANGUAGE_EDIT_PAGE, self::OPTIONS_PAGE_SLUG ) ) ) {
1362
+
1363
+ /**
1364
+ * Using the same 'select2-js' ID as Redux Plugin does, to avoid duplicate enqueueing
1365
+ */
1366
+ if ( ! wp_script_is( 'select2-js' ) ) {
1367
+ wp_enqueue_script(
1368
+ 'select2-js',
1369
+ self::$PLUGIN_DIR_URL . 'lib/select2.min.js',
1370
+ array( 'jquery' ),
1371
+ '3.5.2',
1372
+ true
1373
+ );
1374
+ }
1375
+ }
1376
+
1377
+ if ( in_array( $page, $enabled_pages ) ) {
1378
+
1379
+ /**
1380
+ * Init $tabs_suffix
1381
+ */
1382
+ $tabs_suffix = array();
1383
+
1384
+ if ( in_array( $page, array( 'post.php', 'post-new.php', 'edit-tags.php', 'term.php' ) ) ) {
1385
+
1386
+ /**
1387
+ * Make suffixes for tabs
1388
+ */
1389
+ foreach ( $config->enabled_languages as $language ) {
1390
+ if ( $language == $config->default_language ) {
1391
+ $tabs_suffix[] = 'default';
1392
+ } else {
1393
+ $tabs_suffix[] = $language;
1394
+ }
1395
+ }
1396
+ }
1397
+ $i18n = array();
1398
+ $i18n['cannot_disable_language'] = __( 'You cannot disable the main language.', 'wpglobus' );
1399
+
1400
+ if ( 'post.php' == $page || 'post-new.php' == $page ) {
1401
+
1402
+ /**
1403
+ * Add template for standard excerpt meta box
1404
+ */
1405
+ $data['template'] = '';
1406
+ foreach ( self::Config()->enabled_languages as $language ) {
1407
+
1408
+ $return =
1409
+ $language == self::Config()->default_language ? self::RETURN_IN_DEFAULT_LANGUAGE : self::RETURN_EMPTY;
1410
+
1411
+ $classes =
1412
+ in_array( $language, self::Config()->open_languages ) ? 'wpglobus-excerpt wpglobus-translatable' : 'wpglobus-excerpt wpglobus-translatable hidden';
1413
+
1414
+ $data['template'] .= '<textarea data-language="' . $language . '" placeholder="' . self::Config()->en_language_name[ $language ] . '" class="' . $classes . '" rows="1" cols="40" name="excerpt-' . $language . '" id="excerpt-' . $language . '">';
1415
+ $data['template'] .= WPGlobus_Core::text_filter( $post->post_excerpt, $language, $return );
1416
+ $data['template'] .= '</textarea>';
1417
+
1418
+ if ( defined( 'WPSEO_VERSION' ) ) {
1419
+ /**
1420
+ * @todo This is the only place with WPSEO not in its own class.
1421
+ */
1422
+ $blogname = get_option( 'blogname' );
1423
+ $blogdesc = get_option( 'blogdescription' );
1424
+ $data['blogname'][ $language ] =
1425
+ WPGlobus_Core::text_filter( $blogname, $language, self::RETURN_IN_DEFAULT_LANGUAGE );
1426
+ $data['blogdescription'][ $language ] =
1427
+ WPGlobus_Core::text_filter( $blogdesc, $language, self::RETURN_IN_DEFAULT_LANGUAGE );
1428
+ }
1429
+ }
1430
+
1431
+ $data['modify_excerpt'] = true;
1432
+ if ( isset( $this->vendors_scripts['WOOCOMMERCE'] ) && $this->vendors_scripts['WOOCOMMERCE'] && 'product' == $post->post_type ) {
1433
+ $data['modify_excerpt'] = false;
1434
+ }
1435
+
1436
+ $data['tagsdiv'] = array();
1437
+ $data['tag'] = array();
1438
+ $tags = $this->_get_taxonomies( $post->post_type, 'non-hierarchical' );
1439
+
1440
+ if ( ! empty( $tags ) ) {
1441
+ foreach ( $tags as $tag ) {
1442
+ $data['tagsdiv'][] = 'tagsdiv-' . $tag;
1443
+ $data['tag'][ $tag ] = self::_get_terms( $tag );
1444
+ }
1445
+ }
1446
+
1447
+ /**
1448
+ * Check for support 'title'
1449
+ */
1450
+ $data['support']['title'] = true;
1451
+ if ( ! post_type_supports( $post->post_type, 'title' ) ) {
1452
+ $data['support']['title'] = false;
1453
+ }
1454
+
1455
+ /**
1456
+ * Check for support 'editor'
1457
+ */
1458
+ $data['support']['editor'] = true;
1459
+ if ( ! post_type_supports( $post->post_type, 'editor' ) ) {
1460
+ $data['support']['editor'] = false;
1461
+ }
1462
+
1463
+ if ( ! empty( $post ) ) {
1464
+ $data['post_type'] = $post->post_type;
1465
+ $opts = (array) get_option( self::Config()->option_post_meta_settings );
1466
+ if ( empty( $opts ) ) {
1467
+ $data['post_meta_settings'] = '';
1468
+ } else {
1469
+ $data['post_meta_settings'] = $opts;
1470
+ }
1471
+ }
1472
+
1473
+ $data['customFieldsEnabled'] = true;
1474
+
1475
+ /**
1476
+ * Filter to enable/disable multilingual custom fields on post.php|post-new.php page.
1477
+ * Returning boolean.
1478
+ *
1479
+ * @since 1.6.5
1480
+ *
1481
+ * @param boolean $data [ 'customFieldsEnabled' ] Enabled by default.
1482
+ * @param WP_Post Object $post Current post.
1483
+ */
1484
+ $data['customFieldsEnabled'] = apply_filters( 'wpglobus_custom_fields_enabled', $data['customFieldsEnabled'], $post );
1485
+
1486
+ if ( $data['customFieldsEnabled'] ) {
1487
+ $data['customFieldsEnabled'] = 'true';
1488
+ } else {
1489
+ $data['customFieldsEnabled'] = 'false';
1490
+ }
1491
+
1492
+ /**
1493
+ * Exclude some meta from being multilingual.
1494
+ * @since 2.3.6
1495
+ */
1496
+ $data['excludeCustomFields'] = array( self::LANGUAGE_META_KEY, 'classic-editor-remember' );
1497
+
1498
+ } elseif ( 'nav-menus.php' === $page ) {
1499
+
1500
+ $page_action = 'menu-edit';
1501
+ $menu_items = array();
1502
+ $post_titles = array();
1503
+
1504
+ /** @global wpdb $wpdb */
1505
+ global $wpdb;
1506
+
1507
+ $_query = new WP_Query( array(
1508
+ 'post_type' => 'nav_menu_item',
1509
+ 'nopaging' => true,
1510
+ ) );
1511
+
1512
+ /**
1513
+ * Array of menu items.
1514
+ *
1515
+ * @var WP_Post[] $items
1516
+ */
1517
+ $items = $_query->posts;
1518
+ unset( $_query );
1519
+
1520
+ foreach ( $items as $item ) :
1521
+
1522
+ $item->post_title = trim( $item->post_title );
1523
+
1524
+ if ( empty( $item->post_title ) ) :
1525
+
1526
+ $item_type = get_post_meta( $item->ID, '_menu_item_type', true );
1527
+ $item_object = get_post_meta( $item->ID, '_menu_item_object', true );
1528
+ $item_object_id = get_post_meta( $item->ID, '_menu_item_object_id', true );
1529
+
1530
+ $_raw_title = '';
1531
+
1532
+ if ( 'post_type' === $item_type ) {
1533
+ $_raw_title = get_post_field( 'post_title', $item_object_id );
1534
+ } elseif ( 'taxonomy' === $item_type ) {
1535
+
1536
+ /**
1537
+ * Here we need the raw term. Temporary need to disable our filter.
1538
+ */
1539
+ remove_filter( 'get_term', array( 'WPGlobus_Filters', 'filter__get_term' ), 0 );
1540
+ $term = get_term_by( 'id', $item_object_id, $item_object );
1541
+ add_filter( 'get_term', array( 'WPGlobus_Filters', 'filter__get_term' ), 0 );
1542
+
1543
+ $_raw_title = $term->name;
1544
+ }
1545
+
1546
+ $_raw_title = trim( $_raw_title );
1547
+ if ( ! empty( $_raw_title ) ) {
1548
+ $item->post_title = $_raw_title;
1549
+ // Save the raw title in the menu.
1550
+ $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET post_title = %s WHERE ID = %d", $_raw_title, $item->ID ) );
1551
+ }
1552
+
1553
+ endif; // Empty post_title.
1554
+
1555
+ /**
1556
+ * Add raw data for Navigation Label
1557
+ */
1558
+ $menu_items[ $item->ID ]['input.edit-menu-item-title']['source'] = $item->post_title;
1559
+
1560
+ /**
1561
+ * Add raw data for Title Attribute
1562
+ */
1563
+ $menu_items[ $item->ID ]['input.edit-menu-item-attr-title']['source'] = $item->post_excerpt;
1564
+
1565
+ $menu_items[ $item->ID ]['item-title'] =
1566
+ WPGlobus_Core::text_filter( $item->post_title, $config->default_language );
1567
+
1568
+ $post_titles[ $item->post_title ] = $menu_items[ $item->ID ]['item-title'];
1569
+
1570
+ foreach ( self::Config()->enabled_languages as $language ) {
1571
+
1572
+ $return =
1573
+ $language == self::Config()->default_language ? self::RETURN_IN_DEFAULT_LANGUAGE : self::RETURN_EMPTY;
1574
+
1575
+ /**
1576
+ * Navigation Label
1577
+ */
1578
+ $menu_items[ $item->ID ][ $language ]['input.edit-menu-item-title']['caption'] =
1579
+ WPGlobus_Core::text_filter( $item->post_title, $language, $return );
1580
+
1581
+ /**
1582
+ * Title Attribute
1583
+ */
1584
+ $menu_items[ $item->ID ][ $language ]['input.edit-menu-item-attr-title']['caption'] =
1585
+ WPGlobus_Core::text_filter( $item->post_excerpt, $language, $return );
1586
+
1587
+ /**
1588
+ * Navigation Label classes
1589
+ */
1590
+ $menu_items[ $item->ID ][ $language ]['input.edit-menu-item-title']['class'] =
1591
+ 'widefat wpglobus-menu-item wpglobus-item-title wpglobus-translatable';
1592
+
1593
+ /**
1594
+ * Title Attribute classes
1595
+ */
1596
+ $menu_items[ $item->ID ][ $language ]['input.edit-menu-item-attr-title']['class'] =
1597
+ 'widefat wpglobus-menu-item wpglobus-item-attr wpglobus-translatable';
1598
+
1599
+ }
1600
+
1601
+ endforeach;
1602
+
1603
+ $data['items'] = $menu_items;
1604
+ $data['post_titles'] = $post_titles;
1605
+
1606
+ $i18n['save_nav_menu'] = __( '*) Available after the menu is saved.', 'wpglobus' );
1607
+
1608
+ } elseif ( 'edit-tags.php' == $page || 'term.php' == $page ) {
1609
+
1610
+ global $tag;
1611
+
1612
+ $data['taxonomy'] = empty( $_GET['taxonomy'] ) ? false : sanitize_text_field( wp_unslash( $_GET['taxonomy'] ) ); // phpcs:ignore WordPress.CSRF.NonceVerification
1613
+ $data['tag_id'] = empty( $_GET['tag_ID'] ) ? false : sanitize_text_field( wp_unslash( $_GET['tag_ID'] ) ); // phpcs:ignore WordPress.CSRF.NonceVerification
1614
+ $data['has_items'] = true;
1615
+ $data['multilingualSlug'] = array();
1616
+
1617
+ if ( $data['tag_id'] ) {
1618
+ /**
1619
+ * For example url: edit-tags.php?action=edit&taxonomy=category&tag_ID=4&post_type=post
1620
+ */
1621
+ $page_action = 'taxonomy-edit';
1622
+ $data['multilingualSlug']['title'] =
1623
+ '<div class=""><a href="' . WPGlobus_Utils::url_wpglobus_site() . 'product/wpglobus-plus/#taxonomies" target="_blank">' . esc_html__( 'Need a multilingual slug?', 'wpglobus' ) . '</a></div>';
1624
+ } else {
1625
+ /**
1626
+ * For example url: edit-tags.php?taxonomy=category
1627
+ * edit-tags.php?taxonomy=product_cat&post_type=product
1628
+ */
1629
+ if ( $data['taxonomy'] ) {
1630
+ $terms = get_terms( $data['taxonomy'], array( 'hide_empty' => false ) );
1631
+ if ( is_wp_error( $terms ) || empty( $terms ) ) {
1632
+ $data['has_items'] = false;
1633
+ }
1634
+ }
1635
+ $page_action = 'taxonomy-quick-edit';
1636
+ }
1637
+
1638
+ if ( $data['tag_id'] ) {
1639
+ foreach ( $config->enabled_languages as $language ) {
1640
+ $lang = $language == $config->default_language ? 'default' : $language;
1641
+ if ( 'default' == $lang ) {
1642
+ $data['i18n'][ $lang ]['name'] =
1643
+ WPGlobus_Core::text_filter( $tag->name, $language, self::RETURN_IN_DEFAULT_LANGUAGE );
1644
+ $data['i18n'][ $lang ]['description'] =
1645
+ WPGlobus_Core::text_filter( $tag->description, $language, self::RETURN_IN_DEFAULT_LANGUAGE );
1646
+ } else {
1647
+ $data['i18n'][ $lang ]['name'] =
1648
+ WPGlobus_Core::text_filter( $tag->name, $language, self::RETURN_EMPTY );
1649
+ $data['i18n'][ $lang ]['description'] =
1650
+ WPGlobus_Core::text_filter( $tag->description, $language, self::RETURN_EMPTY );
1651
+ }
1652
+ }
1653
+ } else {
1654
+ /**
1655
+ * Get template for quick edit taxonomy name at edit-tags.php page
1656
+ */
1657
+ $data['template'] = $this->_get_quickedit_template();
1658
+
1659
+ }
1660
+ } elseif ( $page == 'edit.php' ) {
1661
+
1662
+ $page_action = 'edit.php';
1663
+
1664
+ $post_type = empty( $_GET['post_type'] ) ? 'post' : sanitize_text_field( wp_unslash( $_GET['post_type'] ) ); // phpcs:ignore WordPress.CSRF.NonceVerification
1665
+
1666
+ global $posts;
1667
+ $data['has_items'] = empty( $posts ) ? false : true;
1668
+ /**
1669
+ * Get template for quick edit post title at edit.php page
1670
+ */
1671
+ $data['template'] = $this->_get_quickedit_template();
1672
+
1673
+ $tags = $this->_get_taxonomies( $post_type, 'non-hierarchical' );
1674
+ if ( ! empty( $tags ) ) {
1675
+ foreach ( $tags as $tag ) {
1676
+ $terms = self::_get_terms( $tag );
1677
+ if ( ! empty( $terms ) ) {
1678
+ $data['tags'][] = $tag;
1679
+ $data['names'][ $tag ] = 'tax_input[' . $tag . ']';
1680
+ $data['tag'][ $tag ] = $terms;
1681
+ $data['value'][ $tag ] = array( 'post_id' => '' ); // just init
1682
+ }
1683
+ }
1684
+ }
1685
+ } elseif ( 'options-general.php' === $page ) {
1686
+
1687
+ $page_action = 'options-general.php';
1688
+
1689
+ } elseif ( 'widgets.php' === $page ) {
1690
+
1691
+ $page_action = 'widgets.php';
1692
+
1693
+ } elseif ( 'customize.php' === $page ) {
1694
+
1695
+ if ( version_compare( WPGLOBUS_VERSION, '1.4.0-beta1', '<' ) ) {
1696
+ $html = sprintf( __( 'You are customizing %s' ), '<strong class="theme-name site-title"><span id="wpglobus-customize-info">' . esc_html( WPGlobus_Core::text_filter( get_option( 'blogname' ), self::Config()->default_language ) ) . '</span></strong>' );
1697
+ } else {
1698
+ // @since 1.4.0 class panel-title site-title
1699
+ $html = sprintf( __( 'You are customizing %s' ), '<strong class="panel-title site-title"><span id="wpglobus-customize-info">' . esc_html( WPGlobus_Core::text_filter( get_option( 'blogname' ), self::Config()->default_language ) ) . '</span></strong>' );
1700
+ }
1701
+
1702
+ $page_action = 'customize.php';
1703
+ $page_data_key = 'customize';
1704
+ $page_data_values = array(
1705
+ 'info' => array(
1706
+ 'element' => '#customize-info .preview-notice',
1707
+ 'html' => $html,
1708
+ ),
1709
+ 'addElements' => array(
1710
+ 'wpglobus_blogname' => array(
1711
+ 'origin' => 'blogname',
1712
+ 'origin_element' => '#customize-control-blogname input',
1713
+ 'origin_parent' => '#customize-control-blogname',
1714
+ 'element' => '#customize-control-wpglobus_blogname input',
1715
+ 'value' => WPGlobus_Core::text_filter( get_option( 'blogname' ), self::Config()->language, self::RETURN_EMPTY ),
1716
+ ),
1717
+ 'wpglobus_blogdescription' => array(
1718
+ 'origin' => 'blogdescription',
1719
+ 'origin_element' => '#customize-control-blogdescription input',
1720
+ 'origin_parent' => '#customize-control-blogdescription',
1721
+ 'element' => '#customize-control-wpglobus_blogdescription input',
1722
+ 'value' => WPGlobus_Core::text_filter( get_option( 'blogdescription' ), self::Config()->language, self::RETURN_EMPTY ),
1723
+ ),
1724
+ ),
1725
+ );
1726
+
1727
+ } elseif ( in_array( $page, array( 'wpglobus_options', self::LANGUAGE_EDIT_PAGE ), true ) ) {
1728
+
1729
+ $page_action = 'wpglobus_options';
1730
+
1731
+ } elseif ( self::PAGE_WPGLOBUS_CLEAN === $page ) {
1732
+
1733
+ $page_action = 'wpglobus_clean';
1734
+
1735
+ } elseif (
1736
+ ( 'admin.php' === $pagenow && ! empty( $_GET['page'] ) // phpcs:ignore WordPress.CSRF.NonceVerification
1737
+ && self::PAGE_WPGLOBUS_ADMIN_CENTRAL === $_GET['page'] ) // phpcs:ignore WordPress.CSRF.NonceVerification
1738
+ || self::PAGE_WPGLOBUS_ADMIN_CENTRAL === $page
1739
+ ) {
1740
+
1741
+ /**
1742
+ * @since 1.6.6
1743
+ */
1744
+ $page_action = 'wpglobusAdminCentral';
1745
+ /**
1746
+ * @since 1.8
1747
+ */
1748
+ $data['pagenow'] = $pagenow;
1749
+ $data['page'] = self::PAGE_WPGLOBUS_ADMIN_CENTRAL;
1750
+ $data['pageAction'] = $page_action;
1751
+
1752
+ } else {
1753
+
1754
+ $page_action = $page;
1755
+
1756
+ }
1757
+
1758
+ /**
1759
+ * WordPress 4.7+ needs a new version of our admin JS.
1760
+ *
1761
+ * @since 1.7.0
1762
+ */
1763
+ $version = '';
1764
+ if ( version_compare( $GLOBALS['wp_version'], '4.6.999', '>' ) ) {
1765
+ $version = '-47';
1766
+ }
1767
+
1768
+ /**
1769
+ * WordPress 4.9+ needs a new version of our admin JS.
1770
+ *
1771
+ * @since 1.9.2
1772
+ */
1773
+ if ( version_compare( $GLOBALS['wp_version'], '4.8.999', '>' ) ) {
1774
+ $version = '-49';
1775
+ }
1776
+
1777
+ /**
1778
+ * WordPress 5.1+ needs a new version of our admin JS.
1779
+ *
1780
+ * @since 2.1.10
1781
+ */
1782
+ if ( version_compare( $GLOBALS['wp_version'], '5.0.999', '>' ) ) {
1783
+ $version = '-51';
1784
+ }
1785
+
1786
+ /**
1787
+ * @since 1.9.17
1788
+ */
1789
+ if ( self::Config()->builder->is_running() ) {
1790
+
1791
+ wp_register_script(
1792
+ 'wpglobus-admin',
1793
+ self::$PLUGIN_DIR_URL . "includes/builders/assets/wpglobus-admin-builder$version" . self::$_SCRIPT_SUFFIX . '.js',
1794
+ array( 'jquery', 'underscore', 'jquery-ui-dialog', 'jquery-ui-tabs', 'jquery-ui-tooltip' ),
1795
+ WPGLOBUS_VERSION,
1796
+ true
1797
+ );
1798
+ wp_enqueue_script( 'wpglobus-admin' );
1799
+
1800
+ $current_tab = $config->default_language;
1801
+
1802
+ if ( 'post.php' == $page_action ) {
1803
+
1804
+ if ( isset( $_GET['post'] ) ) { // phpcs:ignore WordPress.CSRF.NonceVerification
1805
+ $_current_tab = get_post_meta( $_GET['post'], self::Config()->builder->get_language_meta_key(), 'true' ); // phpcs:ignore WordPress.CSRF.NonceVerification
1806
+ if ( $_current_tab ) {
1807
+ $current_tab = $_current_tab;
1808
+ }
1809
+ }
1810
+
1811
+ } else if ( 'taxonomy-edit' == $page_action ) {
1812
+
1813
+ $_current_tab = isset($_GET['language']) ? $_GET['language'] : false;
1814
+ if ( $_current_tab ) {
1815
+ $current_tab = $_current_tab;
1816
+ }
1817
+
1818
+ }
1819
+
1820
+ } else {
1821
+
1822
+ wp_register_script(
1823
+ 'wpglobus-admin',
1824
+ self::$PLUGIN_DIR_URL . "includes/js/wpglobus-admin$version" . self::$_SCRIPT_SUFFIX . '.js',
1825
+ array( 'jquery', 'underscore', 'jquery-ui-dialog', 'jquery-ui-tabs', 'jquery-ui-tooltip' ),
1826
+ WPGLOBUS_VERSION,
1827
+ true
1828
+ );
1829
+ wp_enqueue_script( 'wpglobus-admin' );
1830
+
1831
+ $current_tab = $config->default_language;
1832
+
1833
+ }
1834
+
1835
+ /**
1836
+ * We need to send the HTML breaks and not \r\n to the JS,
1837
+ * because we do element.text(...), and \r\n are being removed by TinyMCE
1838
+ * See other places with the same bookmark.
1839
+ *
1840
+ * @bookmark EDITOR_LINE_BREAKS
1841
+ * added 24.05.2015
1842
+ * @todo what's next with wpautop? @see 'wpautop()' in https://make.wordpress.org/core/2015/05/14/dev-chat-summary-may-13/
1843
+ */
1844
+ if ( has_filter( 'the_content', 'wpautop' ) ) {
1845
+ $post_content_autop = wpautop( $post_content );
1846
+ } else {
1847
+ $post_content_autop = $post_content;
1848
+ }
1849
+
1850
+ /**
1851
+ * Filter for data to send to JS.
1852
+ * Returning array.
1853
+ *
1854
+ * @since 1.5.5
1855
+ *
1856
+ * @param array $data An array with data.
1857
+ * @param string $page_action Page.
1858
+ */
1859
+ $data = apply_filters( 'wpglobus_localize_data', $data, $page_action );
1860
+
1861
+ /**
1862
+ * Added $_GET array to JS.
1863
+ *
1864
+ * @since 1.9.11
1865
+ */
1866
+ $__get = array();
1867
+ foreach ( $_GET as $_key => $_ ) { // phpcs:ignore WordPress.CSRF.NonceVerification
1868
+ $__get[ $_key ] = WPGlobus_Utils::safe_get( $_key );
1869
+ }
1870
+
1871
+ wp_localize_script(
1872
+ 'wpglobus-admin',
1873
+ 'WPGlobusAdmin',
1874
+ array(
1875
+ 'version' => WPGLOBUS_VERSION,
1876
+ 'page' => $page_action,
1877
+ '$_get' => $__get,
1878
+ 'content' => $post_content_autop,
1879
+ 'title' => $post_title,
1880
+ 'excerpt' => $post_excerpt,
1881
+ 'ajaxurl' => admin_url( 'admin-ajax.php' ),
1882
+ 'parentClass' => __CLASS__,
1883
+ 'process_ajax' => __CLASS__ . '_process_ajax',
1884
+ 'flag_url' => $config->flags_url,
1885
+ 'tabs' => $tabs_suffix,
1886
+ 'currentTab' => $current_tab,
1887
+ 'i18n' => $i18n,
1888
+ 'builder' => self::Config()->builder->is_running() ? self::Config()->builder->get_data() : 'false',
1889
+ # @since 1.9.17
1890
+ 'data' => $data,
1891
+ )
1892
+ );
1893
+
1894
+ if ( empty( $page_data_key ) ) {
1895
+ $page_data_key = 'page_custom_data';
1896
+ }
1897
+ if ( empty( $page_data_values ) ) {
1898
+ $page_data_values = null;
1899
+ }
1900
+
1901
+ /**
1902
+ * Add multisite property
1903
+ *
1904
+ * @since 1.6.0
1905
+ */
1906
+ $is_multisite = 'false';
1907
+ if ( is_multisite() ) {
1908
+ $is_multisite = 'true';
1909
+ }
1910
+
1911
+ /**
1912
+ * Filter for custom data to send to JS.
1913
+ * Returning array or null.
1914
+ *
1915
+ * @since 1.2.9
1916
+ *
1917
+ * @param array $page_data_values An array with custom data or null.
1918
+ * @param string $page_data_key Data key. @since 1.3.0
1919
+ * @param string $page_action Page. @since 1.5.0
1920
+ */
1921
+ $page_data_values = apply_filters( 'wpglobus_localize_custom_data', $page_data_values, $page_data_key, $page_action );
1922
+
1923
+ wp_localize_script(
1924
+ 'wpglobus-admin',
1925
+ 'WPGlobusCoreData',
1926
+ array_merge(
1927
+ array(
1928
+ 'version' => WPGLOBUS_VERSION,
1929
+ 'default_language' => $config->default_language,
1930
+ 'language' => $config->language,
1931
+ 'enabled_languages' => $config->enabled_languages,
1932
+ 'open_languages' => $config->open_languages,
1933
+ 'en_language_name' => $config->en_language_name,
1934
+ 'locale_tag_start' => self::LOCALE_TAG_START,
1935
+ 'locale_tag_end' => self::LOCALE_TAG_END,
1936
+ 'page' => $page_action,
1937
+ 'multisite' => $is_multisite,
1938
+ 'pluginInstallLocation' => array(
1939
+ 'single' => 'plugin-install.php?tab=search&s=WPGlobus&source=WPGlobus',
1940
+ 'multisite' => 'network/plugin-install.php?tab=search&s=WPGlobus&source=WPGlobus',
1941
+ ),
1942
+ ), array(
1943
+ $page_data_key => $page_data_values,
1944
+ )
1945
+ )
1946
+ );
1947
+
1948
+ /**
1949
+ * Enqueue js for ACF support
1950
+ */
1951
+ if (
1952
+ ( $this->vendors_scripts['ACF'] || $this->vendors_scripts['ACFPRO'] )
1953
+ && in_array( $page, array( 'post.php', 'post-new.php' )
1954
+ )
1955
+ ) {
1956
+
1957
+ /**
1958
+ * Filter to disable translation of selected ACF and ACF Pro fields.
1959
+ *
1960
+ * @since 1.5.0
1961
+ *
1962
+ * To exclude field in ACF plugin you need to use the field name from Field Group ( usually wp-admin/edit.php?post_type=acf ).
1963
+ * To exclude field in ACF Pro plugin you need to use id, see Wrapper Attributes section on field's edit page.
1964
+ *
1965
+ * @param array $disabled_fields Default is empty array.
1966
+ * @param boolean $is_acf_pro Type of ACF plugin.
1967
+ *
1968
+ * @return array
1969
+ */
1970
+ $disabled_fields = apply_filters( 'wpglobus_disabled_acf_fields', array(), $this->vendors_scripts['ACFPRO'] );
1971
+
1972
+ /**
1973
+ * @since 2.2.1
1974
+ * @todo may be add filter for $actions array.
1975
+ */
1976
+ $actions = array(
1977
+ 'fixTextFields' => false
1978
+ );
1979
+ if ( defined('ACF_VERSION') ) {
1980
+ if ( version_compare( ACF_VERSION, '5.8.0', '>=' ) ) {
1981
+ $actions['fixTextFields'] = true;
1982
+ }
1983
+ }
1984
+
1985
+ wp_register_script(
1986
+ 'wpglobus-acf',
1987
+ self::$PLUGIN_DIR_URL . 'includes/js/wpglobus-vendor-acf' . self::$_SCRIPT_SUFFIX . '.js',
1988
+ array( 'jquery', 'wpglobus-admin' ),
1989
+ WPGLOBUS_VERSION,
1990
+ true
1991
+ );
1992
+ wp_enqueue_script( 'wpglobus-acf' );
1993
+ wp_localize_script(
1994
+ 'wpglobus-acf',
1995
+ 'WPGlobusAcf',
1996
+ array(
1997
+ 'wpglobus_version' => WPGLOBUS_VERSION,
1998
+ 'pro' => $this->vendors_scripts['ACFPRO'] ? true : false,
1999
+ 'acf_version' => defined('ACF_VERSION') ? ACF_VERSION : false,
2000
+ 'actions' => $actions,
2001
+ 'fields' => array(),
2002
+ 'disabledFields' => $disabled_fields
2003
+ )
2004
+ );
2005
+
2006
+ }
2007
+
2008
+ if ( 'widgets.php' == $page ) {
2009
+
2010
+ $disabled_widgets_mask = array( 'rss-url' );
2011
+
2012
+ /**
2013
+ * Filter to disable making multilingual element on widgets.php page.
2014
+ *
2015
+ * @since 1.5.3
2016
+ *
2017
+ * @param array $disabled_widgets_mask Array of disabled masks.
2018
+ *
2019
+ * @return array
2020
+ */
2021
+ $disabled_widgets_mask = apply_filters( 'wpglobus_disabled_widgets_mask', $disabled_widgets_mask );
2022
+
2023
+ wp_register_script(
2024
+ 'wpglobus-widgets',
2025
+ self::$PLUGIN_DIR_URL . 'includes/js/wpglobus-widgets' . self::$_SCRIPT_SUFFIX . '.js',
2026
+ array( 'jquery', 'underscore', 'wpglobus-admin' ),
2027
+ WPGLOBUS_VERSION,
2028
+ true
2029
+ );
2030
+ wp_enqueue_script( 'wpglobus-widgets' );
2031
+ wp_localize_script(
2032
+ 'wpglobus-widgets',
2033
+ 'WPGlobusWidgets',
2034
+ array(
2035
+ 'wpglobus_version' => WPGLOBUS_VERSION,
2036
+ 'disabledMask' => $disabled_widgets_mask,
2037
+ )
2038
+ );
2039
+
2040
+ }
2041
+ } // endif $enabled_pages
2042
+ }
2043
+
2044
+ /**
2045
+ * Get taxonomies for post type
2046
+ *
2047
+ * @param string $post_type
2048
+ * @param string $type hierarchical, non-hierarchical or all taxonomies
2049
+ *
2050
+ * @return array
2051
+ */
2052
+ public function _get_taxonomies( $post_type, $type = 'all' ) {
2053
+ if ( empty( $post_type ) ) {
2054
+ return array();
2055
+ }
2056
+ $taxs = array();
2057
+ $taxonomies = get_object_taxonomies( $post_type );
2058
+ foreach ( $taxonomies as $taxonomy ) {
2059
+ $taxonomy_data = get_taxonomy( $taxonomy );
2060
+ if ( 'all' == $type ) {
2061
+ $taxs[] = $taxonomy_data->name;
2062
+ continue;
2063
+ }
2064
+ if ( 'non-hierarchical' == $type && ! $taxonomy_data->hierarchical ) {
2065
+ /**
2066
+ * This is tag
2067
+ *
2068
+ * @todo Theoretically, it's not "tag". Can be any custom taxonomy. Need to check.
2069
+ * @todo
2070
+ * Practically in WP: all non-hierarchical taxonomy is tags.
2071
+ * In this context I use term $tags for saving non-hierarchical taxonomies only
2072
+ * for further work with them when editing posts
2073
+ */
2074
+ $taxs[] = $taxonomy_data->name;
2075
+ } elseif ( 'hierarchical' == $type && $taxonomy_data->hierarchical ) {
2076
+ $taxs[] = $taxonomy_data->name;
2077
+ }
2078
+ }
2079
+
2080
+ return $taxs;
2081
+ }
2082
+
2083
+ /**
2084
+ * Get template for quick edit at edit-tags.php, edit.php screens
2085
+ *
2086
+ * @return string
2087
+ */
2088
+ public function _get_quickedit_template() {
2089
+ $t = '';
2090
+ foreach ( self::Config()->open_languages as $language ) {
2091
+ $t .= '<label>';
2092
+ $t .= '<span class="input-text-wrap">';
2093
+ $t .= '<input id="filled-in-js" data-language="' . $language . '" style="width:100%;" class="ptitle wpglobus-quick-edit-title wpglobus-translatable" type="text" value="" name="post_title-' . $language . '" placeholder="' . self::Config()->en_language_name[ $language ] . '">';
2094
+ $t .= '</span>';
2095
+ $t .= '</label>';
2096
+ }
2097
+
2098
+ return $t;
2099
+ }
2100
+
2101
+ /**
2102
+ * Enqueue admin styles
2103
+ *
2104
+ * @return void
2105
+ */
2106
+ public function on_admin_styles() {
2107
+
2108
+ $page = '';
2109
+ if ( isset( $_GET['page'] ) && is_string( $_GET['page'] ) ) { // phpcs:ignore WordPress.CSRF.NonceVerification
2110
+ $page = sanitize_text_field( wp_unslash( $_GET['page'] ) ); // phpcs:ignore WordPress.CSRF.NonceVerification
2111
+ }
2112
+
2113
+ wp_register_style(
2114
+ 'wpglobus-admin',
2115
+ self::$PLUGIN_DIR_URL . 'includes/css/wpglobus-admin.css',
2116
+ array(),
2117
+ WPGLOBUS_VERSION,
2118
+ 'all'
2119
+ );
2120
+ wp_enqueue_style( 'wpglobus-admin' );
2121
+
2122
+ if ( self::LANGUAGE_EDIT_PAGE === $page ) {
2123
+ /**
2124
+ * Using the same 'select2-css' ID as Redux Plugin does, to avoid duplicate enqueueing
2125
+ */
2126
+ if ( ! wp_style_is( 'select2-js' ) ) {
2127
+ wp_enqueue_style(
2128
+ 'select2-css',
2129
+ self::$PLUGIN_DIR_URL . 'lib/select2.min.css',
2130
+ array(),
2131
+ '3.5.2'
2132
+ );
2133
+ }
2134
+ }
2135
+
2136
+ $post = get_post();
2137
+ $type = empty( $post ) ? '' : $post->post_type;
2138
+
2139
+ if ( ! $this->disabled_entity( $type ) ) {
2140
+
2141
+ /**
2142
+ * Loading CSS for enabled pages as for js
2143
+ *
2144
+ * @since 1.2.0
2145
+ */
2146
+ /** @global string $pagenow */
2147
+ global $pagenow;
2148
+
2149
+ if ( in_array( $pagenow, $this->enabled_pages ) || in_array( $page, $this->enabled_pages ) ) {
2150
+
2151
+ wp_register_style(
2152
+ 'wpglobus-admin-tabs',
2153
+ self::$PLUGIN_DIR_URL . 'includes/css/wpglobus-admin-tabs.css',
2154
+ array(),
2155
+ WPGLOBUS_VERSION,
2156
+ 'all'
2157
+ );
2158
+ wp_enqueue_style( 'wpglobus-admin-tabs' );
2159
+
2160
+ wp_enqueue_style(
2161
+ 'dialog-ui',
2162
+ self::$PLUGIN_DIR_URL . 'includes/css/wpglobus-dialog-ui.css',
2163
+ array(),
2164
+ WPGLOBUS_VERSION,
2165
+ 'all'
2166
+ );
2167
+
2168
+ }
2169
+ }
2170
+
2171
+ if ( self::PAGE_WPGLOBUS_ABOUT === $page ) {
2172
+ wp_register_style(
2173
+ 'wpglobus-special-pages',
2174
+ self::$PLUGIN_DIR_URL . 'includes/css/wpglobus-special-pages.css',
2175
+ array(),
2176
+ WPGLOBUS_VERSION,
2177
+ 'all'
2178
+ );
2179
+ wp_enqueue_style( 'wpglobus-special-pages' );
2180
+ }
2181
+
2182
+ }
2183
+
2184
+ /**
2185
+ * Add hidden submenu for Language edit page
2186
+ *
2187
+ * @return void
2188
+ */
2189
+ public function on_admin_menu() {
2190
+
2191
+ /**
2192
+ * @todo Temporarily add main menu.
2193
+ */
2194
+ /**
2195
+ * add_menu_page(
2196
+ * 'WPGlobus',
2197
+ * 'WPGlobus',
2198
+ * 'administrator',
2199
+ * 'wpglobus-main',
2200
+ * array( $this, 'wpglobus_about' )
2201
+ * ); **/
2202
+
2203
+ add_submenu_page(
2204
+ null,
2205
+ '',
2206
+ '',
2207
+ 'administrator',
2208
+ self::LANGUAGE_EDIT_PAGE,
2209
+ array(
2210
+ $this,
2211
+ 'on_language_edit',
2212
+ )
2213
+ );
2214
+
2215
+ add_submenu_page(
2216
+ null,
2217
+ '',
2218
+ '',
2219
+ 'administrator',
2220
+ self::PAGE_WPGLOBUS_ABOUT,
2221
+ array(
2222
+ $this,
2223
+ 'wpglobus_about',
2224
+ )
2225
+ );
2226
+
2227
+ add_submenu_page(
2228
+ null,
2229
+ '',
2230
+ '',
2231
+ 'administrator',
2232
+ self::PAGE_WPGLOBUS_CLEAN,
2233
+ array(
2234
+ $this,
2235
+ 'wpglobus_clean',
2236
+ )
2237
+ );
2238
+ }
2239
+
2240
+ /**
2241
+ * Include file for WPGlobus clean page
2242
+ *
2243
+ * @since 1.4.3
2244
+ * @return void
2245
+ */
2246
+ public function wpglobus_clean() {
2247
+ require_once 'admin/class-wpglobus-clean.php';
2248
+ WPGlobus_Clean::controller();
2249
+ }
2250
+
2251
+ /**
2252
+ * Include file for WPGlobus about page
2253
+ *
2254
+ * @return void
2255
+ */
2256
+ public function wpglobus_about() {
2257
+ require_once 'admin/class-wpglobus-about.php';
2258
+ WPGlobus_About::about_screen();
2259
+ }
2260
+
2261
+ /**
2262
+ * Include file for language edit page
2263
+ *
2264
+ * @return void
2265
+ */
2266
+ public function on_language_edit() {
2267
+ require_once 'admin/class-wpglobus-language-edit.php';
2268
+ new WPGlobus_Language_Edit();
2269
+ }
2270
+
2271
+ /**
2272
+ * We must convert url for nav_menu_item with type == custom
2273
+ * For other types url has language shortcode already
2274
+ *
2275
+ * @param $sorted_menu_items
2276
+ *
2277
+ * @internal param $args
2278
+ * @return array
2279
+ */
2280
+ public function on_get_convert_url_menu_items( $sorted_menu_items ) {
2281
+
2282
+ foreach ( $sorted_menu_items as $key => $item ) {
2283
+
2284
+ /**
2285
+ * Ability to avoid the localize URL.
2286
+ *
2287
+ * @since 1.8.6
2288
+ */
2289
+ $localize = true;
2290
+ if ( ! empty( $item->classes ) && in_array( 'wpglobus-menu-item-url-nolocalize', $item->classes ) ) {
2291
+ $localize = false;
2292
+ }
2293
+
2294
+ if ( 'custom' == $item->type ) {
2295
+ if ( $localize ) {
2296
+ $sorted_menu_items[ $key ]->url = WPGlobus_Utils::localize_url( $sorted_menu_items[ $key ]->url );
2297
+ }
2298
+ } else {
2299
+ if ( ! $localize ) {
2300
+ /**
2301
+ * URL was localized already.
2302
+ *
2303
+ * @see wp_setup_nav_menu_item() in p-includes\nav-menu.php
2304
+ * @since 1.8.6
2305
+ */
2306
+ $sorted_menu_items[ $key ]->url = WPGlobus_Utils::localize_url( $sorted_menu_items[ $key ]->url, self::Config()->default_language );
2307
+ }
2308
+ }
2309
+ }
2310
+
2311
+ /**
2312
+ * Filter for menu objects
2313
+ *
2314
+ * @since 1.5.1
2315
+ *
2316
+ * @param array $sorted_menu_items An array of sorted menu items.
2317
+ *
2318
+ * @return array
2319
+ */
2320
+ return apply_filters( 'wpglobus_nav_menu_objects', $sorted_menu_items );
2321
+
2322
+ }
2323
+
2324
+ /**
2325
+ * Enqueue styles
2326
+ *
2327
+ * @return void
2328
+ */
2329
+ public function on_wp_styles() {
2330
+ wp_register_style(
2331
+ 'wpglobus',
2332
+ self::$PLUGIN_DIR_URL . 'includes/css/wpglobus.css',
2333
+ array(),
2334
+ WPGLOBUS_VERSION,
2335
+ 'all'
2336
+ );
2337
+ wp_enqueue_style( 'wpglobus' );
2338
+ }
2339
+
2340
+ /**
2341
+ * Enqueue the `wpglobus.js` script.
2342
+ *
2343
+ * @since 1.0
2344
+ * @since 1.7.11 Added self::Config()->enabled_languages.
2345
+ * @since 1.9.17 Added self::Config()->builder.
2346
+ */
2347
+ public function enqueue_wpglobus_js() {
2348
+
2349
+ $localize_data = array(
2350
+ 'version' => WPGLOBUS_VERSION,
2351
+ 'language' => self::Config()->language,
2352
+ 'enabledLanguages' => self::Config()->enabled_languages,
2353
+ );
2354
+
2355
+ if ( self::Config()->builder->is_run() ) {
2356
+ $localize_data['builder'] = self::Config()->builder->get_data();
2357
+ }
2358
+
2359
+ wp_enqueue_script(
2360
+ 'wpglobus',
2361
+ self::$PLUGIN_DIR_URL . 'includes/js/wpglobus' . self::$_SCRIPT_SUFFIX . '.js',
2362
+ array( 'jquery', 'utils' ),
2363
+ WPGLOBUS_VERSION,
2364
+ true
2365
+ );
2366
+
2367
+ wp_localize_script(
2368
+ 'wpglobus',
2369
+ 'WPGlobus',
2370
+ $localize_data
2371
+ );
2372
+ }
2373
+
2374
+ /**
2375
+ * Add rel="alternate" links to head section
2376
+ *
2377
+ * @return void
2378
+ */
2379
+ public function on_add_hreflang() {
2380
+
2381
+ $hreflangs = WPGlobus_Utils::hreflangs();
2382
+
2383
+ /**
2384
+ * Filter hreflang.
2385
+ * Returning array.
2386
+ *
2387
+ * @since 1.0.14
2388
+ *
2389
+ * @param string $hreflangs An array.
2390
+ */
2391
+ $hreflangs = apply_filters( 'wpglobus_hreflang_tag', $hreflangs );
2392
+
2393
+ if ( ! empty( $hreflangs ) ) {
2394
+ echo wp_kses( implode( '', $hreflangs ), array(
2395
+ 'link' => array(
2396
+ 'rel' => array(),
2397
+ 'hreflang' => array(),
2398
+ 'href' => array(),
2399
+ ),
2400
+ ) );
2401
+ }
2402
+
2403
+ }
2404
+
2405
+ /**
2406
+ * Add css styles to head section.
2407
+ *
2408
+ * @return void
2409
+ */
2410
+ public function on_wp_head() {
2411
+
2412
+ $config = self::Config();
2413
+
2414
+ $css = '';
2415
+
2416
+ /**
2417
+ * CSS rules for flags in the menu
2418
+ */
2419
+ foreach ( $config->enabled_languages as $language ) {
2420
+ $css .= '.wpglobus_flag_' . $language .
2421
+ '{background-image:url(' . $config->flags_url . $config->flag[ $language ] . ")}\n";
2422
+ }
2423
+
2424
+ /**
2425
+ * Swap flag and text for RTL
2426
+ * (See the LTR default rules in the wpglobus-flags.mixin.less)
2427
+ */
2428
+ if ( is_rtl() ) {
2429
+ $css .= '.wpglobus_flag{background-position:center right;}' .
2430
+ '.wpglobus_language_name{padding-right:22px;}';
2431
+ }
2432
+
2433
+ /**
2434
+ * Filter CSS rules for frontend.
2435
+ *
2436
+ * @since 1.6.6
2437
+ * @since 1.9.27
2438
+ *
2439
+ * @param string $css CSS rules for flags in the menu.
2440
+ * @param string $config ->css_editor Custom CSS rules @see WPGlobus options.
2441
+ *
2442
+ * @return string
2443
+ */
2444
+ $css = apply_filters( 'wpglobus_styles', $css, $config->css_editor );
2445
+
2446
+ if ( ! empty( $css ) ) {
2447
+ $css = wp_kses( $css, array() );
2448
+ $css = str_replace( array( '&gt;', '&lt;' ), array( '>', '<' ), $css );
2449
+ ?>
2450
+ <style type="text/css" media="screen">
2451
+ <?php
2452
+ echo $css; // phpcs:ignore WordPress.XSS.EscapeOutput
2453
+ ?>
2454
+ </style>
2455
+ <?php
2456
+ }
2457
+
2458
+ }
2459
+
2460
+ /**
2461
+ * Append language switcher dropdown or flat to a navigation menu, which was created with
2462
+ *
2463
+ * @see wp_list_pages
2464
+ *
2465
+ * @since 1.5.8
2466
+ *
2467
+ * @param string $output The menu HTML string
2468
+ *
2469
+ * @return string HTML with appended switcher
2470
+ */
2471
+ public function filter__wp_list_pages( $output ) {
2472
+
2473
+ /**
2474
+ * WPGlobus Configuration setting in admin. Must be "ON" to process.
2475
+ */
2476
+ if ( ! self::Config()->selector_wp_list_pages ) {
2477
+ return $output;
2478
+ }
2479
+
2480
+ $current_url = WPGlobus_Utils::current_url();
2481
+ $current_language = self::Config()->language;
2482
+
2483
+ /**
2484
+ * List of the languages to show in the drop-down.
2485
+ * These are all enabled languages, except for the current one.
2486
+ * The current one will be shown at the top.
2487
+ */
2488
+ $extra_languages = array_diff(
2489
+ self::Config()->enabled_languages, (array) $current_language
2490
+ );
2491
+
2492
+ /**
2493
+ * Filter extra languages.
2494
+ * Returning array.
2495
+ *
2496
+ * @since 1.0.13
2497
+ *
2498
+ * @param array $extra_languages An array with languages to show in the dropdown.
2499
+ * @param string $current_language The current language.
2500
+ */
2501
+ $extra_languages = apply_filters(
2502
+ 'wpglobus_extra_languages', $extra_languages, $current_language
2503
+ );
2504
+
2505
+ /**
2506
+ * Filter to show dropdown menu or not.
2507
+ * Returning boolean.
2508
+ *
2509
+ * @since 1.2.2
2510
+ *
2511
+ * @param bool
2512
+ * @param WPGlobus_Config
2513
+ */
2514
+ $dropdown_menu = apply_filters( 'wpglobus_dropdown_menu', true, self::Config() );
2515
+
2516
+ /**
2517
+ * Array of menu items
2518
+ */
2519
+ $wpglobus_menu_items = array();
2520
+
2521
+ /**
2522
+ * Build the top-level menu link
2523
+ */
2524
+ //$language = $current_language;
2525
+ $url = WPGlobus_Utils::localize_url( $current_url, $current_language );
2526
+ $flag_name = $this->_get_flag_name( $current_language );
2527
+ $span_classes_lang = $this->_get_language_classes( $current_language );
2528
+
2529
+ $link_text = '<span class="' . implode( ' ', $span_classes_lang ) . '">' .
2530
+ esc_html( $flag_name ) . '</span>';
2531
+ $a_tag = '<a class="wpglobus-selector-link" href="' . esc_url( $url ) . '">' . $link_text . '</a>';
2532
+
2533
+ /**
2534
+ * Current language menu item classes
2535
+ */
2536
+ $menu_item_classes = array(
2537
+ 'page_item' => 'page_item',
2538
+ 'page_item_wpglobus_menu_switch' => 'page_item_wpglobus_menu_switch',
2539
+ 'page_item_has_children' => 'page_item_has_children',
2540
+ 'wpglobus-current-language' => 'wpglobus-current-language',
2541
+ );
2542
+
2543
+ /**
2544
+ * Submenu item classes for extra languages
2545
+ */
2546
+ $submenu_item_classes = array(
2547
+ 'page_item' => 'page_item',
2548
+ 'page_item_wpglobus_menu_switch' => 'page_item_wpglobus_menu_switch',
2549
+ 'sub_menu_item_wpglobus_menu_switch' => 'sub_menu_item_wpglobus_menu_switch',
2550
+ );
2551
+
2552
+ $item = new stdClass();
2553
+ $item->item_has_parent = false;
2554
+ $item->title = $a_tag;
2555
+ $item->url = $url;
2556
+ $item->language = $current_language;
2557
+
2558
+ if ( $dropdown_menu ) {
2559
+
2560
+ /**
2561
+ * Dropdown menu
2562
+ */
2563
+ $item->classes = $menu_item_classes;
2564
+
2565
+ $item->classes[ 'page_item_wpglobus_menu_switch_' . $current_language ] = 'page_item_wpglobus_menu_switch_' . $current_language;
2566
+
2567
+ $wpglobus_menu_items[] = $item;
2568
+
2569
+ $template = '<li {{parent}}<ul class="children">{{children}}</ul></li>';
2570
+
2571
+ foreach ( $extra_languages as $language ) :
2572
+ /**
2573
+ * Build the drop-down menu links for extra language
2574
+ */
2575
+ $url = WPGlobus_Utils::localize_current_url( $language );
2576
+ $flag_name = $this->_get_flag_name( $language );
2577
+ $span_classes_lang = $this->_get_language_classes( $language );
2578
+
2579
+ $link_text = '<span class="' . implode( ' ', $span_classes_lang ) . '">' .
2580
+ esc_html( $flag_name ) . '</span>';
2581
+ $a_tag = '<a class="wpglobus-selector-link" href="' . esc_url( $url ) . '">' . $link_text . '</a>';
2582
+
2583
+ $item = new stdClass();
2584
+
2585
+ $item->item_has_parent = true;
2586
+
2587
+ $item->title = $a_tag;
2588
+
2589
+ $item->url = $url;
2590
+
2591
+ $item->classes = $submenu_item_classes;
2592
+
2593
+ $item->language = $language;
2594
+
2595
+ $item->classes[ 'page_item_wpglobus_menu_switch_' . $language ] = 'page_item_wpglobus_menu_switch_' . $language;
2596
+
2597
+ // $item->object_id = $item->ID;
2598
+ $item->object = 'custom';
2599
+
2600
+ $wpglobus_menu_items[] = new WP_Post( $item );
2601
+
2602
+ endforeach;
2603
+
2604
+ } else {
2605
+
2606
+ /**
2607
+ * Flat menu
2608
+ */
2609
+ unset( $submenu_item_classes['sub_menu_item_wpglobus_menu_switch'] );
2610
+
2611
+ $item->classes = $submenu_item_classes;
2612
+
2613
+ $item->classes['wpglobus-current-language'] = 'wpglobus-current-language';
2614
+
2615
+ $item->classes[ 'page_item_wpglobus_menu_switch_' . $item->language ] = 'page_item_wpglobus_menu_switch_' . $item->language;
2616
+
2617
+ $wpglobus_menu_items[] = $item;
2618
+
2619
+ $template = '{{parent}}{{children}}';
2620
+
2621
+ foreach ( $extra_languages as $language ) :
2622
+ /**
2623
+ * Build the top-level menu link for extra language
2624
+ */
2625
+ $url = WPGlobus_Utils::localize_current_url( $language );
2626
+ $flag_name = $this->_get_flag_name( $language );
2627
+ $span_classes_lang = $this->_get_language_classes( $language );
2628
+
2629
+ $link_text = '<span class="' . implode( ' ', $span_classes_lang ) . '">' .
2630
+ esc_html( $flag_name ) . '</span>';
2631
+ $a_tag = '<a class="wpglobus-selector-link" href="' . esc_url( $url ) . '">' . $link_text . '</a>';
2632
+
2633
+ $item = new stdClass();
2634
+ $item->item_has_parent = false;
2635
+ $item->title = $a_tag;
2636
+ $item->url = $url;
2637
+ $item->classes = $submenu_item_classes;
2638
+ $item->classes[] = 'page_item_wpglobus_menu_switch_' . $language;
2639
+ $item->language = $language;
2640
+
2641
+ $item->object = 'custom';
2642
+
2643
+ $wpglobus_menu_items[] = new WP_Post( $item );
2644
+
2645
+ endforeach;
2646
+
2647
+ } // $dropdown_menu
2648
+
2649
+ /**
2650
+ * Filter wpglobus selector items.
2651
+ * Returning array.
2652
+ *
2653
+ * @since 1.5.8
2654
+ *
2655
+ * @param array $wpglobus_menu_items An array of selector items.
2656
+ * @param array $extra_languages An array of extra languages.
2657
+ */
2658
+ $wpglobus_menu_items = apply_filters( 'wpglobus_page_menu_items', $wpglobus_menu_items, $extra_languages );
2659
+
2660
+ $parent = '';
2661
+ $children = '';
2662
+
2663
+ foreach ( $wpglobus_menu_items as $item ) :
2664
+
2665
+ if ( $dropdown_menu ) {
2666
+
2667
+ if ( ! $item->item_has_parent ) {
2668
+ $parent = 'class="' . implode( ' ', $item->classes ) . '">' . $item->title;
2669
+ continue;
2670
+ }
2671
+
2672
+ $children .= '<li class="' . implode( ' ', $item->classes ) . '">' . $item->title . '</li>';
2673
+
2674
+ } else {
2675
+
2676
+ $children .= '<li class="' . implode( ' ', $item->classes ) . '">' . $item->title . '</li>';
2677
+
2678
+ }
2679
+
2680
+ endforeach;
2681
+
2682
+ $selector_html = str_replace( '{{parent}}', $parent, $template );
2683
+ $selector_html = str_replace( '{{children}}', $children, $selector_html );
2684
+
2685
+ /**
2686
+ * Filter the HTML content for language selector.
2687
+ *
2688
+ * @param string $selector_html The HTML content for the navigation menu.
2689
+ * @param array $wpglobus_menu_items An array containing selector element.
2690
+ */
2691
+ return $output . apply_filters( 'wpglobus_page_menu_items_html', $selector_html, $wpglobus_menu_items );
2692
+
2693
+ }
2694
+
2695
+ /**
2696
+ * Append language switcher dropdown to a navigation menu, which was created with
2697
+ *
2698
+ * @see wp_list_pages
2699
+ *
2700
+ * @deprecated from 1.5.8
2701
+ *
2702
+ * @param string $output The menu HTML string
2703
+ *
2704
+ * @return string HTML with appended switcher
2705
+ */
2706
+ public function on_wp_list_pages( $output ) {
2707
+
2708
+ if (
2709
+ /**
2710
+ * Filter to use 'filter__wp_list_pages' instead of 'on_wp_list_pages'.
2711
+ *
2712
+ * @since 1.5.8
2713
+ *
2714
+ * @param bool true If to use filter
2715
+ *
2716
+ * @return bool
2717
+ */
2718
+ apply_filters( 'wpglobus_filter_wp_list_pages', true )
2719
+ ) {
2720
+ return $this->filter__wp_list_pages( $output );
2721
+ }
2722
+
2723
+ /**
2724
+ * WPGlobus Configuration setting in admin. Must be "ON" to process.
2725
+ */
2726
+ if ( ! self::Config()->selector_wp_list_pages ) {
2727
+ return $output;
2728
+ }
2729
+
2730
+ $current_url = WPGlobus_Utils::current_url();
2731
+ $current_language = self::Config()->language;
2732
+
2733
+ /**
2734
+ * List of the languages to show in the drop-down.
2735
+ * These are all enabled languages, except for the current one.
2736
+ * The current one will be shown at the top