Quick Adsense - Version 2.8

Version Description

  • Bug fixes and Security updates
Download this release

Release Info

Developer namith.jawahar
Plugin Icon 128x128 Quick Adsense
Version 2.8
Comparing to
See all releases

Code changes from version 2.7 to 2.8

Files changed (381) hide show
  1. {includes → assets}/css/admin.css +9 -333
  2. {includes → assets}/images/ajax-loader.gif +0 -0
  3. {includes → assets}/js/Chart.bundle.min.js +0 -0
  4. {includes → assets}/js/admin.js +210 -333
  5. includes/GeoIP/GeoIPCountry.php +0 -428
  6. includes/adsense.php +248 -254
  7. includes/class-filehandler.php +137 -0
  8. includes/content.php +691 -600
  9. includes/controls.php +181 -90
  10. includes/countries.php +1000 -0
  11. includes/defaults.php +299 -293
  12. includes/images/adpushup-970x250-red.png +0 -0
  13. includes/images/advertisement-preview.png +0 -0
  14. includes/images/ajax-loader-flat.gif +0 -0
  15. includes/images/jquery.minicolors.png +0 -0
  16. includes/images/privacy.png +0 -0
  17. includes/js/gdpr.js +0 -198
  18. includes/js/jquery.minicolors.js +0 -1108
  19. includes/js/vi-check.js +0 -62
  20. includes/loader.php +20 -0
  21. includes/quicktags.php +39 -33
  22. includes/settings.php +191 -729
  23. includes/templates/adunit-onpost.php +64 -0
  24. includes/templates/adunit-widget.php +23 -0
  25. includes/templates/block-adsense-adstxt-notice.php +16 -0
  26. includes/templates/block-adsense-adstxt-update-failed.php +7 -0
  27. includes/templates/block-adunit-advanced.php +202 -0
  28. includes/templates/block-general-adsense.php +30 -0
  29. includes/templates/block-general-appearance.php +167 -0
  30. includes/templates/block-general-assign-position.php +316 -0
  31. includes/templates/block-general-quicktag.php +91 -0
  32. includes/templates/block-stats-chart.php +6 -0
  33. includes/templates/js/script-admin-notice.php +7 -0
  34. includes/templates/js/script-frontend-stats.php +11 -0
  35. includes/templates/page-settings.php +32 -0
  36. includes/templates/section-general.php +25 -0
  37. includes/templates/section-header-footer.php +40 -0
  38. includes/templates/section-onpost-content.php +91 -0
  39. includes/templates/section-widgets.php +89 -0
  40. includes/vendor/GeoIP/GeoIPCountry.php +235 -0
  41. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/0.php +0 -0
  42. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/0000.php +0 -0
  43. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/0100.php +0 -0
  44. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/0200.php +0 -0
  45. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/0400.php +0 -0
  46. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/0800.php +0 -0
  47. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/1.php +0 -0
  48. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/10.php +0 -0
  49. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/100.php +0 -0
  50. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/1000.php +0 -0
  51. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/101.php +0 -0
  52. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/102.php +0 -0
  53. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/103.php +0 -0
  54. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/104.php +0 -0
  55. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/105.php +0 -0
  56. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/106.php +0 -0
  57. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/107.php +0 -0
  58. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/108.php +0 -0
  59. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/109.php +0 -0
  60. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/11.php +0 -0
  61. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/110.php +0 -0
  62. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/111.php +0 -0
  63. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/112.php +0 -0
  64. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/113.php +0 -0
  65. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/114.php +0 -0
  66. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/115.php +0 -0
  67. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/116.php +0 -0
  68. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/117.php +0 -0
  69. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/118.php +0 -0
  70. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/119.php +0 -0
  71. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/12.php +0 -0
  72. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/120.php +0 -0
  73. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/121.php +0 -0
  74. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/122.php +0 -0
  75. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/123.php +0 -0
  76. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/124.php +0 -0
  77. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/125.php +0 -0
  78. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/126.php +0 -0
  79. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/127.php +0 -0
  80. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/128.php +0 -0
  81. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/129.php +0 -0
  82. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/13.php +0 -0
  83. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/130.php +0 -0
  84. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/131.php +0 -0
  85. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/132.php +0 -0
  86. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/133.php +0 -0
  87. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/134.php +0 -0
  88. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/135.php +0 -0
  89. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/136.php +0 -0
  90. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/137.php +0 -0
  91. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/138.php +0 -0
  92. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/139.php +0 -0
  93. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/14.php +0 -0
  94. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/140.php +0 -0
  95. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/141.php +0 -0
  96. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/142.php +0 -0
  97. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/143.php +0 -0
  98. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/144.php +0 -0
  99. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/145.php +0 -0
  100. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/146.php +0 -0
  101. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/147.php +0 -0
  102. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/148.php +0 -0
  103. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/149.php +0 -0
  104. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/15.php +0 -0
  105. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/150.php +0 -0
  106. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/151.php +0 -0
  107. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/152.php +0 -0
  108. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/153.php +0 -0
  109. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/154.php +0 -0
  110. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/155.php +0 -0
  111. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/156.php +0 -0
  112. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/157.php +0 -0
  113. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/158.php +0 -0
  114. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/159.php +0 -0
  115. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/16.php +0 -0
  116. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/160.php +0 -0
  117. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/161.php +0 -0
  118. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/162.php +0 -0
  119. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/163.php +0 -0
  120. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/164.php +0 -0
  121. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/165.php +0 -0
  122. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/166.php +0 -0
  123. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/167.php +0 -0
  124. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/168.php +0 -0
  125. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/169.php +0 -0
  126. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/17.php +0 -0
  127. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/170.php +0 -0
  128. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/171.php +0 -0
  129. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/172.php +0 -0
  130. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/173.php +0 -0
  131. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/174.php +0 -0
  132. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/175.php +0 -0
  133. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/176.php +0 -0
  134. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/177.php +0 -0
  135. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/178.php +0 -0
  136. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/179.php +0 -0
  137. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/18.php +0 -0
  138. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/180.php +0 -0
  139. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/181.php +0 -0
  140. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/182.php +0 -0
  141. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/183.php +0 -0
  142. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/184.php +0 -0
  143. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/185.php +0 -0
  144. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/186.php +0 -0
  145. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/187.php +0 -0
  146. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/188.php +0 -0
  147. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/189.php +0 -0
  148. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/19.php +0 -0
  149. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/190.php +0 -0
  150. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/191.php +0 -0
  151. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/192.php +0 -0
  152. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/193.php +0 -0
  153. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/194.php +0 -0
  154. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/195.php +0 -0
  155. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/196.php +0 -0
  156. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/197.php +0 -0
  157. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/198.php +0 -0
  158. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/199.php +0 -0
  159. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2.php +0 -0
  160. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/20.php +0 -0
  161. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/200.php +0 -0
  162. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2000.php +0 -0
  163. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2001.php +0 -0
  164. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2002.php +0 -0
  165. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2003.php +0 -0
  166. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/201.php +0 -0
  167. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/202.php +0 -0
  168. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/203.php +0 -0
  169. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/204.php +0 -0
  170. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/205.php +0 -0
  171. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/206.php +0 -0
  172. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/207.php +0 -0
  173. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/208.php +0 -0
  174. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/209.php +0 -0
  175. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/21.php +0 -0
  176. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/210.php +0 -0
  177. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/211.php +0 -0
  178. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/212.php +0 -0
  179. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/213.php +0 -0
  180. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/214.php +0 -0
  181. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/215.php +0 -0
  182. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/216.php +0 -0
  183. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/217.php +0 -0
  184. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/218.php +0 -0
  185. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/219.php +0 -0
  186. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/22.php +0 -0
  187. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/220.php +0 -0
  188. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/221.php +0 -0
  189. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/222.php +0 -0
  190. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/223.php +0 -0
  191. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/224.php +0 -0
  192. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/225.php +0 -0
  193. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/226.php +0 -0
  194. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/227.php +0 -0
  195. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/228.php +0 -0
  196. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/229.php +0 -0
  197. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/23.php +0 -0
  198. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/230.php +0 -0
  199. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/231.php +0 -0
  200. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/232.php +0 -0
  201. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/233.php +0 -0
  202. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/234.php +0 -0
  203. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/235.php +0 -0
  204. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/236.php +0 -0
  205. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/237.php +0 -0
  206. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/238.php +0 -0
  207. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/239.php +0 -0
  208. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/24.php +0 -0
  209. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/240.php +0 -0
  210. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2400.php +0 -0
  211. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2401.php +0 -0
  212. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2402.php +0 -0
  213. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2403.php +0 -0
  214. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2404.php +0 -0
  215. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2405.php +0 -0
  216. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2406.php +0 -0
  217. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2407.php +0 -0
  218. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2408.php +0 -0
  219. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2409.php +0 -0
  220. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/240A.php +0 -0
  221. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/240B.php +0 -0
  222. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/240C.php +0 -0
  223. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/240D.php +0 -0
  224. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/240E.php +0 -0
  225. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/240F.php +0 -0
  226. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/241.php +0 -0
  227. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/242.php +0 -0
  228. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/243.php +0 -0
  229. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/244.php +0 -0
  230. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/245.php +0 -0
  231. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/246.php +0 -0
  232. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/247.php +0 -0
  233. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/248.php +0 -0
  234. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/249.php +0 -0
  235. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/25.php +0 -0
  236. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/250.php +0 -0
  237. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/251.php +0 -0
  238. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/252.php +0 -0
  239. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/253.php +0 -0
  240. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/254.php +0 -0
  241. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/255.php +0 -0
  242. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/26.php +0 -0
  243. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2600.php +0 -0
  244. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2601.php +0 -0
  245. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2602.php +0 -0
  246. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2603.php +0 -0
  247. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2604.php +0 -0
  248. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2605.php +0 -0
  249. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2606.php +0 -0
  250. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2607.php +0 -0
  251. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2608.php +0 -0
  252. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2609.php +0 -0
  253. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/260A.php +0 -0
  254. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/260C.php +0 -0
  255. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/260D.php +0 -0
  256. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/260E.php +0 -0
  257. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/260F.php +0 -0
  258. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2610.php +0 -0
  259. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2620.php +0 -0
  260. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/27.php +0 -0
  261. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/28.php +0 -0
  262. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2800.php +0 -0
  263. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2801.php +0 -0
  264. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2802.php +0 -0
  265. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2803.php +0 -0
  266. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2804.php +0 -0
  267. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2806.php +0 -0
  268. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/29.php +0 -0
  269. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2A00.php +0 -0
  270. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2A01.php +0 -0
  271. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2A02.php +0 -0
  272. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2A03.php +0 -0
  273. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2A04.php +0 -0
  274. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2A05.php +0 -0
  275. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2A06.php +0 -0
  276. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2A07.php +0 -0
  277. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2A08.php +0 -0
  278. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2A0A.php +0 -0
  279. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2A0B.php +0 -0
  280. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2C00.php +0 -0
  281. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2C0E.php +0 -0
  282. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2C0F.php +0 -0
  283. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/3.php +0 -0
  284. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/30.php +0 -0
  285. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/31.php +0 -0
  286. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/32.php +0 -0
  287. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/33.php +0 -0
  288. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/34.php +0 -0
  289. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/35.php +0 -0
  290. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/36.php +0 -0
  291. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/37.php +0 -0
  292. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/38.php +0 -0
  293. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/39.php +0 -0
  294. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/4.php +0 -0
  295. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/40.php +0 -0
  296. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/4000.php +0 -0
  297. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/41.php +0 -0
  298. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/42.php +0 -0
  299. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/43.php +0 -0
  300. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/44.php +0 -0
  301. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/45.php +0 -0
  302. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/46.php +0 -0
  303. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/47.php +0 -0
  304. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/48.php +0 -0
  305. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/49.php +0 -0
  306. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/5.php +0 -0
  307. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/50.php +0 -0
  308. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/51.php +0 -0
  309. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/52.php +0 -0
  310. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/53.php +0 -0
  311. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/54.php +0 -0
  312. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/55.php +0 -0
  313. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/56.php +0 -0
  314. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/57.php +0 -0
  315. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/58.php +0 -0
  316. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/59.php +0 -0
  317. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/6.php +0 -0
  318. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/60.php +0 -0
  319. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/6000.php +0 -0
  320. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/61.php +0 -0
  321. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/62.php +0 -0
  322. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/63.php +0 -0
  323. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/64.php +0 -0
  324. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/65.php +0 -0
  325. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/66.php +0 -0
  326. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/67.php +0 -0
  327. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/68.php +0 -0
  328. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/69.php +0 -0
  329. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/7.php +0 -0
  330. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/70.php +0 -0
  331. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/71.php +0 -0
  332. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/72.php +0 -0
  333. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/73.php +0 -0
  334. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/74.php +0 -0
  335. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/75.php +0 -0
  336. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/76.php +0 -0
  337. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/77.php +0 -0
  338. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/78.php +0 -0
  339. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/79.php +0 -0
  340. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/8.php +0 -0
  341. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/80.php +0 -0
  342. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/8000.php +0 -0
  343. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/81.php +0 -0
  344. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/82.php +0 -0
  345. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/83.php +0 -0
  346. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/84.php +0 -0
  347. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/85.php +0 -0
  348. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/86.php +0 -0
  349. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/87.php +0 -0
  350. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/88.php +0 -0
  351. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/89.php +0 -0
  352. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/9.php +0 -0
  353. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/90.php +0 -0
  354. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/91.php +0 -0
  355. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/92.php +0 -0
  356. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/93.php +0 -0
  357. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/94.php +0 -0
  358. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/95.php +0 -0
  359. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/96.php +0 -0
  360. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/97.php +0 -0
  361. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/98.php +0 -0
  362. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/99.php +0 -0
  363. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/A000.php +0 -0
  364. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/C000.php +0 -0
  365. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/E000.php +0 -0
  366. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/F000.php +0 -0
  367. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/F800.php +0 -0
  368. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/FC00.php +0 -0
  369. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/FE00.php +0 -0
  370. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/FE80.php +0 -0
  371. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/FEC0.php +0 -0
  372. includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/FF00.php +0 -0
  373. includes/{GeoIP → vendor/GeoIP}/LICENSE +0 -0
  374. includes/{MobileDetect → vendor/MobileDetect}/LICENSE.txt +0 -0
  375. includes/{MobileDetect → vendor/MobileDetect}/Mobile_Detect.php +0 -0
  376. includes/widgets.php +71 -38
  377. quick-adsense.php +25 -39
  378. readme.txt +8 -2
  379. screenshot-1.png +0 -0
  380. screenshot-2.png +0 -0
  381. screenshot-3.png +0 -0
{includes → assets}/css/admin.css RENAMED
@@ -153,6 +153,7 @@
153
  }
154
 
155
  #quick_adsense_onpost_content_controls_wrapper {
 
156
  }
157
 
158
  #quick_adsense_onpost_content_controls_wrapper #quick_adsense_onpost_content_global_controls_wrapper {
@@ -175,6 +176,7 @@
175
  }
176
 
177
  #quick_adsense_onpost_content_controls_wrapper #quick_adsense_onpost_content_adunits_wrapper {
 
178
  }
179
 
180
  #quick_adsense_onpost_content_controls_wrapper #quick_adsense_onpost_content_adunits_wrapper .quick_adsense_onpost_adunits_label {
@@ -271,340 +273,14 @@
271
  margin-left: -10px;
272
  }
273
 
274
-
275
- /* Begin Minicolors */
276
- .minicolors {
277
- position: relative;
278
- }
279
-
280
- .minicolors-sprite {
281
- background-image: url(../images/jquery.minicolors.png);
282
- }
283
-
284
- .minicolors-swatch {
285
- position: absolute;
286
- vertical-align: middle;
287
- background-position: -80px 0;
288
- border: solid 1px #ccc;
289
- cursor: text;
290
- padding: 0;
291
- margin: 0;
292
- display: inline-block;
293
- }
294
-
295
- .minicolors-swatch-color {
296
- position: absolute;
297
- top: 0;
298
- left: 0;
299
- right: 0;
300
- bottom: 0;
301
- }
302
-
303
- .minicolors input[type=hidden] + .minicolors-swatch {
304
- width: 28px;
305
- position: static;
306
- cursor: pointer;
307
- }
308
-
309
- .minicolors input[type=hidden][disabled] + .minicolors-swatch {
310
- cursor: default;
311
- }
312
-
313
- /* Panel */
314
- .minicolors-panel {
315
- position: absolute;
316
- width: 173px;
317
- background: white;
318
- border: solid 1px #CCC;
319
- box-shadow: 0 0 20px rgba(0, 0, 0, .2);
320
- z-index: 99999;
321
- box-sizing: content-box;
322
- display: none;
323
- }
324
-
325
- .minicolors-panel.minicolors-visible {
326
- display: block;
327
- }
328
-
329
- /* Panel positioning */
330
- .minicolors-position-top .minicolors-panel {
331
- top: -154px;
332
- }
333
-
334
- .minicolors-position-right .minicolors-panel {
335
- right: 0;
336
- }
337
-
338
- .minicolors-position-bottom .minicolors-panel {
339
- top: 30px;
340
- }
341
-
342
- .minicolors-position-left .minicolors-panel {
343
- left: 0;
344
- }
345
-
346
- .minicolors-with-opacity .minicolors-panel {
347
- width: 194px;
348
- }
349
-
350
- .minicolors .minicolors-grid {
351
- position: relative;
352
- top: 1px;
353
- left: 1px;
354
- width: 150px;
355
- height: 150px;
356
- background-position: -120px 0;
357
- cursor: crosshair;
358
- }
359
-
360
- .minicolors .minicolors-grid-inner {
361
- position: absolute;
362
- top: 0;
363
- left: 0;
364
- width: 150px;
365
- height: 150px;
366
- }
367
-
368
- .minicolors-slider-saturation .minicolors-grid {
369
- background-position: -420px 0;
370
- }
371
-
372
- .minicolors-slider-saturation .minicolors-grid-inner {
373
- background-position: -270px 0;
374
- background-image: inherit;
375
- }
376
-
377
- .minicolors-slider-brightness .minicolors-grid {
378
- background-position: -570px 0;
379
- }
380
-
381
- .minicolors-slider-brightness .minicolors-grid-inner {
382
- background-color: black;
383
- }
384
-
385
- .minicolors-slider-wheel .minicolors-grid {
386
- background-position: -720px 0;
387
- }
388
-
389
- .minicolors-slider,
390
- .minicolors-opacity-slider {
391
- position: absolute;
392
- top: 1px;
393
- left: 152px;
394
- width: 20px;
395
- height: 150px;
396
- background-color: white;
397
- background-position: 0 0;
398
- cursor: row-resize;
399
- }
400
-
401
- .minicolors-slider-saturation .minicolors-slider {
402
- background-position: -60px 0;
403
- }
404
-
405
- .minicolors-slider-brightness .minicolors-slider {
406
- background-position: -20px 0;
407
- }
408
-
409
- .minicolors-slider-wheel .minicolors-slider {
410
- background-position: -20px 0;
411
- }
412
-
413
- .minicolors-opacity-slider {
414
- left: 173px;
415
- background-position: -40px 0;
416
- display: none;
417
- }
418
-
419
- .minicolors-with-opacity .minicolors-opacity-slider {
420
- display: block;
421
- }
422
-
423
- /* Pickers */
424
- .minicolors-grid .minicolors-picker {
425
- position: absolute;
426
- top: 70px;
427
- left: 70px;
428
- width: 12px;
429
- height: 12px;
430
- border: solid 1px black;
431
- border-radius: 10px;
432
- margin-top: -6px;
433
- margin-left: -6px;
434
- background: none;
435
  }
436
 
437
- .minicolors-grid .minicolors-picker > div {
438
- position: absolute;
439
- top: 0;
440
- left: 0;
441
- width: 8px;
442
- height: 8px;
443
- border-radius: 8px;
444
- border: solid 2px white;
445
- box-sizing: content-box;
446
- }
447
-
448
- .minicolors-picker {
449
- position: absolute;
450
- top: 0;
451
- left: 0;
452
- width: 18px;
453
- height: 2px;
454
- background: white;
455
- border: solid 1px black;
456
- margin-top: -2px;
457
- box-sizing: content-box;
458
- }
459
-
460
- /* Swatches */
461
- .minicolors-swatches,
462
- .minicolors-swatches li {
463
- margin: 5px 0 3px 5px;
464
- padding: 0;
465
- list-style: none;
466
- overflow: hidden;
467
- }
468
-
469
- .minicolors-swatches .minicolors-swatch {
470
- position: relative;
471
- float: left;
472
- cursor: pointer;
473
- margin:0 4px 0 0;
474
- }
475
-
476
- .minicolors-with-opacity .minicolors-swatches .minicolors-swatch {
477
- margin-right: 7px;
478
- }
479
-
480
- .minicolors-swatch.selected {
481
- border-color: #000;
482
- }
483
-
484
- .minicolors-inline {
485
- display: inline-block;
486
- }
487
-
488
- .minicolors-inline .minicolors-input {
489
- display: none !important;
490
- }
491
-
492
- .minicolors-inline .minicolors-panel {
493
- position: relative;
494
- top: auto;
495
- left: auto;
496
- box-shadow: none;
497
- z-index: auto;
498
- display: inline-block;
499
- }
500
-
501
- .minicolors-theme-default .minicolors-swatch {
502
- top: 5px;
503
- left: 5px;
504
- width: 18px;
505
- height: 18px;
506
- }
507
-
508
- .minicolors-theme-default .minicolors-swatches .minicolors-swatch {
509
- margin-bottom: 2px;
510
- top: 0;
511
- left: 0;
512
- width: 18px;
513
- height: 18px;
514
- }
515
-
516
- .minicolors-theme-default.minicolors-position-right .minicolors-swatch {
517
- left: auto;
518
- right: 5px;
519
- }
520
-
521
- .minicolors-theme-default.minicolors {
522
- width: auto;
523
- display: inline-block;
524
- }
525
-
526
- .minicolors-theme-default .minicolors-input {
527
- height: 20px;
528
- width: auto;
529
- display: inline-block;
530
- padding-left: 26px;
531
- }
532
-
533
- .minicolors-theme-default.minicolors-position-right .minicolors-input {
534
- padding-right: 26px;
535
- padding-left: inherit;
536
- }
537
-
538
- .minicolors-theme-bootstrap .minicolors-swatch {
539
- z-index: 2;
540
- top: 3px;
541
- left: 3px;
542
- width: 28px;
543
- height: 28px;
544
- border-radius: 3px;
545
- }
546
-
547
- .minicolors-theme-bootstrap .minicolors-swatches .minicolors-swatch {
548
- margin-bottom: 2px;
549
- top: 0;
550
- left: 0;
551
- width: 20px;
552
- height: 20px;
553
- }
554
-
555
- .minicolors-theme-bootstrap .minicolors-swatch-color {
556
- border-radius: inherit;
557
- }
558
-
559
- .minicolors-theme-bootstrap.minicolors-position-right > .minicolors-swatch {
560
- left: auto;
561
- right: 3px;
562
- }
563
-
564
- .minicolors-theme-bootstrap .minicolors-input {
565
- float: none;
566
- padding-left: 44px;
567
- }
568
-
569
- .minicolors-theme-bootstrap.minicolors-position-right .minicolors-input {
570
- padding-right: 44px;
571
- padding-left: 12px;
572
- }
573
-
574
- .minicolors-theme-bootstrap .minicolors-input.input-lg + .minicolors-swatch {
575
- top: 4px;
576
- left: 4px;
577
- width: 37px;
578
- height: 37px;
579
- border-radius: 5px;
580
- }
581
-
582
- .minicolors-theme-bootstrap .minicolors-input.input-sm + .minicolors-swatch {
583
- width: 24px;
584
- height: 24px;
585
- }
586
-
587
- .minicolors-theme-bootstrap .minicolors-input.input-xs + .minicolors-swatch {
588
- width: 18px;
589
- height: 18px;
590
- }
591
-
592
- .input-group .minicolors-theme-bootstrap:not(:first-child) .minicolors-input {
593
- border-top-left-radius: 0;
594
- border-bottom-left-radius: 0;
595
- }
596
-
597
- .minicolors-theme-semanticui .minicolors-swatch {
598
- top: 0;
599
- left: 0;
600
- padding: 18px;
601
- }
602
-
603
- .minicolors-theme-semanticui input {
604
- text-indent: 30px;
605
- }
606
- /* End Minicolors */
607
-
608
  @media only screen and (max-width: 1200px) {
609
  #quick_adsense_bottom_left_section_wrapper {
610
  float: none;
@@ -647,4 +323,4 @@
647
  #quick_adsense_widget_adunits_wrapper a.button-secondary {
648
  margin-left: 0;
649
  }
650
- }
153
  }
154
 
155
  #quick_adsense_onpost_content_controls_wrapper {
156
+
157
  }
158
 
159
  #quick_adsense_onpost_content_controls_wrapper #quick_adsense_onpost_content_global_controls_wrapper {
176
  }
177
 
178
  #quick_adsense_onpost_content_controls_wrapper #quick_adsense_onpost_content_adunits_wrapper {
179
+
180
  }
181
 
182
  #quick_adsense_onpost_content_controls_wrapper #quick_adsense_onpost_content_adunits_wrapper .quick_adsense_onpost_adunits_label {
273
  margin-left: -10px;
274
  }
275
 
276
+ .quick_adsense_ajaxloader {
277
+ background: url(../images/ajax-loader.gif) no-repeat center center;
278
+ max-width: 320px;
279
+ min-width: 100px;
280
+ height: 100px;
281
+ margin: auto;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
282
  }
283
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
284
  @media only screen and (max-width: 1200px) {
285
  #quick_adsense_bottom_left_section_wrapper {
286
  float: none;
323
  #quick_adsense_widget_adunits_wrapper a.button-secondary {
324
  margin-left: 0;
325
  }
326
+ }
{includes → assets}/images/ajax-loader.gif RENAMED
File without changes
{includes → assets}/js/Chart.bundle.min.js RENAMED
File without changes
{includes → assets}/js/admin.js RENAMED
@@ -1,43 +1,34 @@
1
- jQuery(document).ready(function() {
2
- jQuery('#quick_adsense_settings_reset_to_default').click(quick_adsense_settings_reset_to_default);
3
-
 
4
  jQuery('#quick_adsense_settings_enable_position_beginning_of_post').click(quick_adsense_settings_enable_position_beginning_of_post);
5
  jQuery('#quick_adsense_settings_enable_position_middle_of_post').click(quick_adsense_settings_enable_position_middle_of_post);
6
- jQuery('#quick_adsense_settings_enable_position_end_of_post').click(quick_adsense_settings_enable_position_end_of_post);
7
- jQuery('#quick_adsense_settings_enable_position_after_more_tag').click(quick_adsense_settings_enable_position_after_more_tag);
8
- jQuery('#quick_adsense_settings_enable_position_before_last_para').click(quick_adsense_settings_enable_position_before_last_para);
9
- jQuery('#quick_adsense_settings_enable_position_after_para_option_1').click(quick_adsense_settings_enable_position_after_para_option_1);
10
- jQuery('#quick_adsense_settings_enable_position_after_para_option_2').click(quick_adsense_settings_enable_position_after_para_option_2);
11
- jQuery('#quick_adsense_settings_enable_position_after_para_option_3').click(quick_adsense_settings_enable_position_after_para_option_3);
12
- jQuery('#quick_adsense_settings_enable_position_after_image_option_1').click(quick_adsense_settings_enable_position_after_image_option_1);
13
  jQuery('#quick_adsense_settings_enable_on_posts').click(quick_adsense_settings_enable_on_posts);
14
- jQuery('#quick_adsense_settings_enable_on_pages').click(quick_adsense_settings_enable_on_pages);
15
  jQuery('#quick_adsense_settings_enable_on_homepage').click(quick_adsense_settings_enable_on_homepage);
16
  jQuery('#quick_adsense_settings_enable_on_categories').click(quick_adsense_settings_enable_on_categories);
17
  jQuery('#quick_adsense_settings_enable_on_archives').click(quick_adsense_settings_enable_on_archives);
18
  jQuery('#quick_adsense_settings_enable_on_tags').click(quick_adsense_settings_enable_on_tags);
19
- jQuery('#quick_adsense_settings_enable_all_possible_ads').click(quick_adsense_settings_enable_all_possible_ads);
20
- jQuery('#quick_adsense_settings_disable_widgets_on_homepage').click(quick_adsense_settings_disable_widgets_on_homepage);
21
- jQuery('#quick_adsense_settings_disable_for_loggedin_users').click(quick_adsense_settings_disable_for_loggedin_users);
22
- jQuery('#quick_adsense_settings_enable_quicktag_buttons').click(quick_adsense_settings_enable_quicktag_buttons);
23
- jQuery('#quick_adsense_settings_disable_randomads_quicktag_button').click(quick_adsense_settings_disable_randomads_quicktag_button);
24
- jQuery('#quick_adsense_settings_disable_disablead_quicktag_buttons').click(quick_adsense_settings_disable_disablead_quicktag_buttons);
25
  jQuery('#quick_adsense_settings_disable_positionad_quicktag_buttons').click(quick_adsense_settings_disable_positionad_quicktag_buttons);
26
-
27
- jQuery('#quick_adsense_settings_onpost_enable_global_style').click(quick_adsense_settings_onpost_enable_global_style);
28
  jQuery('#quick_adsense_settings_onpost_global_alignment').click(quick_adsense_settings_onpost_enable_global_style);
29
  jQuery('#quick_adsense_settings_onpost_global_margin').click(quick_adsense_settings_onpost_enable_global_style);
30
-
31
- jQuery('#quick_adsense_settings_ad_beginning_of_post').change(function() {
32
- quick_adsense_vi_check_status(this);
33
- quick_adsense_settings_handle_vi_single_selection();
34
- });
35
 
36
- jQuery('#quick_adsense_settings_ad_middle_of_post').change(function() {
37
- quick_adsense_vi_check_status(this);
38
- quick_adsense_settings_handle_vi_single_selection();
39
- });
40
-
41
  quick_adsense_settings_enable_position_beginning_of_post();
42
  quick_adsense_settings_enable_position_middle_of_post();
43
  quick_adsense_settings_enable_position_end_of_post();
@@ -61,10 +52,9 @@ jQuery(document).ready(function() {
61
  quick_adsense_settings_disable_disablead_quicktag_buttons();
62
  quick_adsense_settings_disable_positionad_quicktag_buttons();
63
  quick_adsense_settings_onpost_enable_global_style();
64
- quick_adsense_settings_handle_vi_single_selection();
65
-
66
- jQuery('#quick_adsense_onpost_content_adunits_showall_button').click(function() {
67
- if(jQuery('#quick_adsense_onpost_content_adunits_showall_button').text() == ' Show All') {
68
  jQuery('#quick_adsense_onpost_content_adunits_all_wrapper').slideDown();
69
  jQuery('#quick_adsense_onpost_content_adunits_showall_button').html('<span class="dashicons dashicons-arrow-up"></span> <b>Show Less</b>');
70
  } else {
@@ -72,9 +62,9 @@ jQuery(document).ready(function() {
72
  jQuery('#quick_adsense_onpost_content_adunits_showall_button').html('<span class="dashicons dashicons-arrow-down"></span> <b>Show All</b>');
73
  }
74
  });
75
-
76
- jQuery('#quick_adsense_widget_adunits_showall_button').click(function() {
77
- if(jQuery('#quick_adsense_widget_adunits_showall_button').text() == ' Show All') {
78
  jQuery('#quick_adsense_widget_adunits_all_wrapper').slideDown();
79
  jQuery('#quick_adsense_widget_adunits_showall_button').html('<span class="dashicons dashicons-arrow-up"></span> <b>Show Less</b>');
80
  } else {
@@ -83,133 +73,125 @@ jQuery(document).ready(function() {
83
  }
84
  });
85
 
86
- jQuery('#quick_adsense_settings_form').submit(function() {
87
- jQuery('#quick_adsense_settings_form select').each(function() {
88
- if(jQuery(this).prop('disabled') == true) {
89
  jQuery(this).prop('disabled', false);
90
  }
91
  });
92
  });
93
 
94
  jQuery('#quick_adsense_settings_form').fadeIn();
95
- if(window.location.href.indexOf('#quick_adsense_adstxt_adsense_auto_update') > -1) {
96
  quick_adsense_adstxt_adsense_auto_update();
97
  }
98
-
99
- jQuery('.quick_adsense_onpost_ad_reset_stats').click(function() {
100
  jQuery(this).prop('disabled', true);
101
- jQuery.post(
102
- jQuery('#quick_adsense_admin_ajax').val(), {
103
- 'action': 'quick_adsense_onpost_ad_reset_stats',
104
- 'index': jQuery(this).attr('data-index'),
105
- 'quick_adsense_nonce': jQuery('#quick_adsense_nonce').val()
106
- }, function(response) {
107
- if(response.indexOf('###SUCCESS###') !== -1) {
108
- jQuery('.quick_adsense_onpost_ad_reset_stats').each(function() {
109
- jQuery(this).prop('disabled', false);
110
- });
111
- }
112
- }
113
- );
114
  });
115
-
116
- jQuery('.quick_adsense_onpost_ad_show_stats').click(function() {
117
- jQuery('<div id="quick_adsense_onpost_ad_show_stats_dialog" data-index="'+jQuery(this).attr('data-index')+'"></div>').html('<div class="quick_adsense_ajaxloader"></div>').dialog({
118
  'modal': true,
119
  'resizable': false,
120
  'width': jQuery("body").width() * 0.5,
121
  'maxWidth': jQuery("body").width() * 0.5,
122
  'maxHeight': jQuery("body").height() * 0.9,
123
- 'title': 'Ad'+jQuery(this).attr('data-index')+' Performance Stats (30 Days)',
124
  position: { my: 'center', at: 'center', of: window },
125
  open: function (event, ui) {
126
- jQuery('.ui-dialog').css({'z-index': 999999, 'max-width': '90%'});
127
- jQuery('.ui-widget-overlay').css({'z-index': 999998, 'opacity': 0.8, 'background': '#000000'});
128
- jQuery.post(
129
- jQuery('#quick_adsense_admin_ajax').val(), {
130
- 'action': 'quick_adsense_onpost_ad_get_stats_chart',
131
- 'index': jQuery('#quick_adsense_onpost_ad_show_stats_dialog').attr('data-index'),
132
- 'quick_adsense_nonce': jQuery('#quick_adsense_nonce').val()
133
- }, function(response) {
134
- jQuery('.quick_adsense_ajaxloader').hide();
135
- jQuery('.ui-dialog-content').html(response.replace('###SUCCESS###', ''));
136
- jQuery('.ui-accordion .ui-accordion-content').css('max-height', (jQuery("body").height() * 0.45));
137
- jQuery('.ui-dialog').css({'position': 'fixed'});
138
- jQuery('#quick_adsense_onpost_ad_show_stats_dialog').delay(500).dialog({position: { my: 'center', at: 'center', of: window }});
139
-
140
- jQuery('#quick_adsense_ad_stats_chart_wrapper canvas').attr('width', jQuery('#quick_adsense_ad_stats_chart_wrapper').width()+'px');
141
- jQuery('#quick_adsense_ad_stats_chart_wrapper canvas').attr('height', jQuery('#quick_adsense_ad_stats_chart_wrapper').height()+'px');
142
- if(jQuery('#quick_adsense_ad_stats_chart_data').length) {
143
- var quick_adsense_ad_stats_chart = new Chart(jQuery('#quick_adsense_ad_stats_chart'), {
144
- type: 'line',
145
- responsive: false,
146
- data: {
147
- datasets: [{
148
- data: JSON.parse(jQuery('#quick_adsense_ad_stats_chart_data').val()),
149
- backgroundColor: '#EDF5FB',
150
- borderColor: '#186EAE',/*E8EBEF*/
151
- borderWidth: 1
152
- }]
 
 
 
153
  },
154
- options: {
155
- title: {
156
- display: false,
157
- backgroundColor: '#EDF5FB'
158
- },
159
- legend: {
160
- display: false,
161
- },
162
- scales: {
163
- xAxes: [{
164
- type: "time",
165
  display: true,
166
- scaleLabel: {
167
- display: true
168
- },
169
- gridLines: {
170
- display: true,
171
- drawTicks: true
172
- },
173
- ticks: {
174
- display: true
175
- }
176
- }],
177
- yAxes: [{
178
  display: true,
179
- scaleLabel: {
180
- display: true
181
- },
182
- gridLines: {
183
- display: true,
184
- drawTicks: true
185
- },
186
- ticks: {
187
- display: true
188
- }
189
- }]
190
- },
191
- tooltips: {
192
- displayColors: false,
193
- callbacks: {
194
- label: function(tooltipItem, data) {
195
- return ['Impressions: '+parseInt(data.datasets[tooltipItem.datasetIndex].data[tooltipItem.index]['y'], 10), 'Clicks: '+parseInt(data.datasets[tooltipItem.datasetIndex].data[tooltipItem.index]['y1'], 10)];
196
- },
197
- title: function(tooltipItem, data) {
198
- var monthNames = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
199
- var dateParts = tooltipItem[0].xLabel.split('/');
200
- var date = new Date(dateParts[2], dateParts[0]-1, dateParts[1]);
201
- return monthNames[date.getMonth()]+' '+date.getDate();
202
- }
203
  }
204
  }
205
  }
206
- });
207
- }
208
  }
209
- );
210
  },
211
- buttons: { },
212
- close: function() {
213
  jQuery(this).dialog('destroy');
214
  }
215
  })
@@ -217,99 +199,96 @@ jQuery(document).ready(function() {
217
  });
218
 
219
  function quick_adsense_adstxt_adsense_auto_update() {
220
- jQuery.post(
221
- jQuery('#quick_adsense_adstxt_adsense_admin_notice_ajax').val(), {
222
- 'action': 'quick_adsense_adstxt_adsense_auto_update',
223
- 'quick_adsense_adstxt_adsense_admin_notice_nonce': jQuery('#quick_adsense_adstxt_adsense_admin_notice_nonce').val(),
224
- }, function(response) {
225
- if(response != '###SUCCESS###') {
226
- jQuery(response).dialog({
227
- 'modal': true,
228
- 'resizable': false,
229
- 'title': 'Ads.txt Auto Updation Failed',
230
- 'width': jQuery("body").width() * 0.5,
231
- 'maxWidth': jQuery("body").width() * 0.5,
232
- 'maxHeight': jQuery("body").height() * 0.9,
233
- position: { my: 'center', at: 'center', of: window },
234
- open: function (event, ui) {
235
- jQuery('.ui-dialog').css({'z-index': 999999, 'max-width': '90%'});
236
- jQuery('.ui-widget-overlay').css({'z-index': 999998, 'opacity': 0.8, 'background': '#000000'});
237
- },
238
- buttons : {
239
- 'Cancel': function() {
240
- jQuery(this).dialog("close");
241
- }
242
- },
243
- close: function() {
244
- jQuery(this).dialog('destroy');
245
  }
246
- });
247
- } else {
248
- jQuery('.quick_adsense_adstxt_adsense_notice').hide();
249
- }
 
250
  }
251
- );
252
  }
253
 
254
  function quick_adsense_settings_reset_to_default() {
255
  jQuery('#quick_adsense_settings_max_ads_per_page').val('3');
256
-
257
- jQuery('#quick_adsense_settings_enable_position_beginning_of_post').prop('checked', true);
258
  jQuery('#quick_adsense_settings_ad_beginning_of_post').val('1');
259
  jQuery('#quick_adsense_settings_enable_position_middle_of_post').prop('checked', false);
260
  jQuery('#quick_adsense_settings_ad_middle_of_post').val('0');
261
  jQuery('#quick_adsense_settings_enable_position_end_of_post').prop('checked', true);
262
  jQuery('#quick_adsense_settings_ad_end_of_post').val('0');
263
-
264
  jQuery('#quick_adsense_settings_enable_position_after_more_tag').prop('checked', false);
265
  jQuery('#quick_adsense_settings_ad_after_more_tag').val('0');
266
  jQuery('#quick_adsense_settings_enable_position_before_last_para').prop('checked', false);
267
  jQuery('#quick_adsense_settings_ad_before_last_para').val('0');
268
-
269
- for(var i = 1; i <= 3; i++) {
270
- jQuery('#quick_adsense_settings_enable_position_after_para_option_'+i).prop('checked', false);
271
- jQuery('#quick_adsense_settings_ad_after_para_option_'+i).val('0');
272
- jQuery('#quick_adsense_settings_position_after_para_option_'+i).val('1');
273
- jQuery('#quick_adsense_settings_enable_jump_position_after_para_option_'+i).prop('checked', false);
274
  }
275
-
276
- for(var i = 1; i <= 1; i++) {
277
- jQuery('#quick_adsense_settings_enable_position_after_image_option_'+i).prop('checked', false);
278
- jQuery('#quick_adsense_settings_ad_after_image_option_'+i).val('0');
279
- jQuery('#quick_adsense_settings_position_after_image_option_'+i).val('1');
280
- jQuery('#quick_adsense_settings_enable_jump_position_after_image_option_'+i).prop('checked', false);
281
  }
282
-
283
  jQuery('#quick_adsense_settings_enable_on_posts').prop('checked', true);
284
  jQuery('#quick_adsense_settings_enable_on_pages').prop('checked', true);
285
-
286
  jQuery('#quick_adsense_settings_enable_on_homepage').prop('checked', false);
287
  jQuery('#quick_adsense_settings_enable_on_categories').prop('checked', false);
288
  jQuery('#quick_adsense_settings_enable_on_archives').prop('checked', false);
289
  jQuery('#quick_adsense_settings_enable_on_tags').prop('checked', false);
290
  jQuery('#quick_adsense_settings_enable_all_possible_ads').prop('checked', false);
291
-
292
  jQuery('#quick_adsense_settings_disable_widgets_on_homepage').prop('checked', false);
293
-
294
  jQuery('#quick_adsense_settings_disable_for_loggedin_users').prop('checked', false);
295
-
296
  jQuery('#quick_adsense_settings_enable_quicktag_buttons').prop('checked', true);
297
  jQuery('#quick_adsense_settings_disable_randomads_quicktag_button').prop('checked', false);
298
  jQuery('#quick_adsense_settings_disable_disablead_quicktag_buttons').prop('checked', false);
299
  jQuery('#quick_adsense_settings_disable_positionad_quicktag_buttons').prop('checked', false);
300
-
301
  jQuery('#quick_adsense_settings_onpost_enable_global_style').prop('checked', false);
302
  jQuery('#quick_adsense_settings_onpost_global_alignment').val('2');
303
  jQuery('#quick_adsense_settings_onpost_global_margin').val('10');
304
-
305
- for(var i = 1; i <= 10; i++) {
306
- jQuery('#quick_adsense_settings_onpost_ad_'+i+'_content').val('');
307
- jQuery('#quick_adsense_settings_onpost_ad_'+i+'_alignment').val('2');
308
- jQuery('#quick_adsense_settings_onpost_ad_'+i+'_margin').val('10');
309
-
310
- jQuery('#quick_adsense_settings_widget_ad_'+i+'_content').val('');
311
  }
312
-
313
  quick_adsense_settings_enable_position_beginning_of_post();
314
  quick_adsense_settings_enable_position_middle_of_post();
315
  quick_adsense_settings_enable_position_end_of_post();
@@ -333,33 +312,30 @@ function quick_adsense_settings_reset_to_default() {
333
  quick_adsense_settings_disable_disablead_quicktag_buttons();
334
  quick_adsense_settings_disable_positionad_quicktag_buttons();
335
  quick_adsense_settings_onpost_enable_global_style();
336
- quick_adsense_settings_handle_vi_single_selection();
337
  }
338
 
339
  function quick_adsense_settings_enable_position_beginning_of_post() {
340
- if(jQuery('#quick_adsense_settings_enable_position_beginning_of_post').prop('checked') == true) {
341
  jQuery('#quick_adsense_settings_ad_beginning_of_post').prop('disabled', false);
342
  jQuery('#quick_adsense_settings_ad_beginning_of_post').parent().removeClass('disabled');
343
  } else {
344
  jQuery('#quick_adsense_settings_ad_beginning_of_post').prop('disabled', true);
345
  jQuery('#quick_adsense_settings_ad_beginning_of_post').parent().addClass('disabled');
346
  }
347
- quick_adsense_settings_handle_vi_single_selection();
348
  }
349
 
350
  function quick_adsense_settings_enable_position_middle_of_post() {
351
- if(jQuery('#quick_adsense_settings_enable_position_middle_of_post').prop('checked') == true) {
352
  jQuery('#quick_adsense_settings_ad_middle_of_post').prop('disabled', false);
353
  jQuery('#quick_adsense_settings_ad_middle_of_post').parent().removeClass('disabled');
354
  } else {
355
  jQuery('#quick_adsense_settings_ad_middle_of_post').prop('disabled', true);
356
  jQuery('#quick_adsense_settings_ad_middle_of_post').parent().addClass('disabled');
357
  }
358
- quick_adsense_settings_handle_vi_single_selection();
359
  }
360
 
361
  function quick_adsense_settings_enable_position_end_of_post() {
362
- if(jQuery('#quick_adsense_settings_enable_position_end_of_post').prop('checked') == true) {
363
  jQuery('#quick_adsense_settings_ad_end_of_post').prop('disabled', false);
364
  jQuery('#quick_adsense_settings_ad_end_of_post').parent().removeClass('disabled');
365
  } else {
@@ -369,7 +345,7 @@ function quick_adsense_settings_enable_position_end_of_post() {
369
  }
370
 
371
  function quick_adsense_settings_enable_position_after_more_tag() {
372
- if(jQuery('#quick_adsense_settings_enable_position_after_more_tag').prop('checked') == true) {
373
  jQuery('#quick_adsense_settings_ad_after_more_tag').prop('disabled', false);
374
  jQuery('#quick_adsense_settings_ad_after_more_tag').parent().removeClass('disabled');
375
  } else {
@@ -377,9 +353,9 @@ function quick_adsense_settings_enable_position_after_more_tag() {
377
  jQuery('#quick_adsense_settings_ad_after_more_tag').parent().addClass('disabled');
378
  }
379
  }
380
-
381
  function quick_adsense_settings_enable_position_before_last_para() {
382
- if(jQuery('#quick_adsense_settings_enable_position_before_last_para').prop('checked') == true) {
383
  jQuery('#quick_adsense_settings_ad_before_last_para').prop('disabled', false);
384
  jQuery('#quick_adsense_settings_ad_before_last_para').parent().removeClass('disabled');
385
  } else {
@@ -389,7 +365,7 @@ function quick_adsense_settings_enable_position_before_last_para() {
389
  }
390
 
391
  function quick_adsense_settings_enable_position_after_para_option_1() {
392
- if(jQuery('#quick_adsense_settings_enable_position_after_para_option_1').prop('checked') == true) {
393
  jQuery('#quick_adsense_settings_ad_after_para_option_1').prop('disabled', false);
394
  jQuery('#quick_adsense_settings_position_after_para_option_1').prop('disabled', false);
395
  jQuery('#quick_adsense_settings_enable_jump_position_after_para_option_1').prop('disabled', false);
@@ -403,7 +379,7 @@ function quick_adsense_settings_enable_position_after_para_option_1() {
403
  }
404
 
405
  function quick_adsense_settings_enable_position_after_para_option_2() {
406
- if(jQuery('#quick_adsense_settings_enable_position_after_para_option_2').prop('checked') == true) {
407
  jQuery('#quick_adsense_settings_ad_after_para_option_2').prop('disabled', false);
408
  jQuery('#quick_adsense_settings_position_after_para_option_2').prop('disabled', false);
409
  jQuery('#quick_adsense_settings_enable_jump_position_after_para_option_2').prop('disabled', false);
@@ -417,7 +393,7 @@ function quick_adsense_settings_enable_position_after_para_option_2() {
417
  }
418
 
419
  function quick_adsense_settings_enable_position_after_para_option_3() {
420
- if(jQuery('#quick_adsense_settings_enable_position_after_para_option_3').prop('checked') == true) {
421
  jQuery('#quick_adsense_settings_ad_after_para_option_3').prop('disabled', false);
422
  jQuery('#quick_adsense_settings_position_after_para_option_3').prop('disabled', false);
423
  jQuery('#quick_adsense_settings_enable_jump_position_after_para_option_3').prop('disabled', false);
@@ -431,7 +407,7 @@ function quick_adsense_settings_enable_position_after_para_option_3() {
431
  }
432
 
433
  function quick_adsense_settings_enable_position_after_image_option_1() {
434
- if(jQuery('#quick_adsense_settings_enable_position_after_image_option_1').prop('checked') == true) {
435
  jQuery('#quick_adsense_settings_ad_after_image_option_1').prop('disabled', false);
436
  jQuery('#quick_adsense_settings_position_after_image_option_1').prop('disabled', false);
437
  jQuery('#quick_adsense_settings_enable_jump_position_after_image_option_1').prop('disabled', false);
@@ -445,7 +421,7 @@ function quick_adsense_settings_enable_position_after_image_option_1() {
445
  }
446
 
447
  function quick_adsense_settings_enable_on_posts() {
448
- if(jQuery('#quick_adsense_settings_enable_on_posts').prop('checked') == true) {
449
  jQuery('#quick_adsense_settings_enable_on_posts').parent().removeClass('disabled');
450
  } else {
451
  jQuery('#quick_adsense_settings_enable_on_posts').parent().addClass('disabled');
@@ -453,7 +429,7 @@ function quick_adsense_settings_enable_on_posts() {
453
  }
454
 
455
  function quick_adsense_settings_enable_on_pages() {
456
- if(jQuery('#quick_adsense_settings_enable_on_pages').prop('checked') == true) {
457
  jQuery('#quick_adsense_settings_enable_on_pages').parent().removeClass('disabled');
458
  } else {
459
  jQuery('#quick_adsense_settings_enable_on_pages').parent().addClass('disabled');
@@ -461,7 +437,7 @@ function quick_adsense_settings_enable_on_pages() {
461
  }
462
 
463
  function quick_adsense_settings_enable_on_homepage() {
464
- if(jQuery('#quick_adsense_settings_enable_on_homepage').prop('checked') == true) {
465
  jQuery('#quick_adsense_settings_enable_on_homepage').parent().removeClass('disabled');
466
  } else {
467
  jQuery('#quick_adsense_settings_enable_on_homepage').parent().addClass('disabled');
@@ -469,7 +445,7 @@ function quick_adsense_settings_enable_on_homepage() {
469
  }
470
 
471
  function quick_adsense_settings_enable_on_categories() {
472
- if(jQuery('#quick_adsense_settings_enable_on_categories').prop('checked') == true) {
473
  jQuery('#quick_adsense_settings_enable_on_categories').parent().removeClass('disabled');
474
  } else {
475
  jQuery('#quick_adsense_settings_enable_on_categories').parent().addClass('disabled');
@@ -477,7 +453,7 @@ function quick_adsense_settings_enable_on_categories() {
477
  }
478
 
479
  function quick_adsense_settings_enable_on_archives() {
480
- if(jQuery('#quick_adsense_settings_enable_on_archives').prop('checked') == true) {
481
  jQuery('#quick_adsense_settings_enable_on_archives').parent().removeClass('disabled');
482
  } else {
483
  jQuery('#quick_adsense_settings_enable_on_archives').parent().addClass('disabled');
@@ -485,7 +461,7 @@ function quick_adsense_settings_enable_on_archives() {
485
  }
486
 
487
  function quick_adsense_settings_enable_on_tags() {
488
- if(jQuery('#quick_adsense_settings_enable_on_tags').prop('checked') == true) {
489
  jQuery('#quick_adsense_settings_enable_on_tags').parent().removeClass('disabled');
490
  } else {
491
  jQuery('#quick_adsense_settings_enable_on_tags').parent().addClass('disabled');
@@ -493,7 +469,7 @@ function quick_adsense_settings_enable_on_tags() {
493
  }
494
 
495
  function quick_adsense_settings_enable_all_possible_ads() {
496
- if(jQuery('#quick_adsense_settings_enable_all_possible_ads').prop('checked') == true) {
497
  jQuery('#quick_adsense_settings_enable_all_possible_ads').parent().removeClass('disabled');
498
  } else {
499
  jQuery('#quick_adsense_settings_enable_all_possible_ads').parent().addClass('disabled');
@@ -501,7 +477,7 @@ function quick_adsense_settings_enable_all_possible_ads() {
501
  }
502
 
503
  function quick_adsense_settings_disable_widgets_on_homepage() {
504
- if(jQuery('#quick_adsense_settings_disable_widgets_on_homepage').prop('checked') == true) {
505
  jQuery('#quick_adsense_settings_disable_widgets_on_homepage').parent().removeClass('disabled');
506
  } else {
507
  jQuery('#quick_adsense_settings_disable_widgets_on_homepage').parent().addClass('disabled');
@@ -509,7 +485,7 @@ function quick_adsense_settings_disable_widgets_on_homepage() {
509
  }
510
 
511
  function quick_adsense_settings_disable_for_loggedin_users() {
512
- if(jQuery('#quick_adsense_settings_disable_for_loggedin_users').prop('checked') == true) {
513
  jQuery('#quick_adsense_settings_disable_for_loggedin_users').parent().removeClass('disabled');
514
  } else {
515
  jQuery('#quick_adsense_settings_disable_for_loggedin_users').parent().addClass('disabled');
@@ -517,7 +493,7 @@ function quick_adsense_settings_disable_for_loggedin_users() {
517
  }
518
 
519
  function quick_adsense_settings_enable_quicktag_buttons() {
520
- if(jQuery('#quick_adsense_settings_enable_quicktag_buttons').prop('checked') == true) {
521
  jQuery('#quick_adsense_settings_enable_quicktag_buttons').parent().removeClass('disabled');
522
  } else {
523
  jQuery('#quick_adsense_settings_enable_quicktag_buttons').parent().addClass('disabled');
@@ -525,7 +501,7 @@ function quick_adsense_settings_enable_quicktag_buttons() {
525
  }
526
 
527
  function quick_adsense_settings_disable_randomads_quicktag_button() {
528
- if(jQuery('#quick_adsense_settings_disable_randomads_quicktag_button').prop('checked') == true) {
529
  jQuery('#quick_adsense_settings_disable_randomads_quicktag_button').parent().removeClass('disabled');
530
  } else {
531
  jQuery('#quick_adsense_settings_disable_randomads_quicktag_button').parent().addClass('disabled');
@@ -533,7 +509,7 @@ function quick_adsense_settings_disable_randomads_quicktag_button() {
533
  }
534
 
535
  function quick_adsense_settings_disable_disablead_quicktag_buttons() {
536
- if(jQuery('#quick_adsense_settings_disable_disablead_quicktag_buttons').prop('checked') == true) {
537
  jQuery('#quick_adsense_settings_disable_disablead_quicktag_buttons').parent().removeClass('disabled');
538
  } else {
539
  jQuery('#quick_adsense_settings_disable_disablead_quicktag_buttons').parent().addClass('disabled');
@@ -541,7 +517,7 @@ function quick_adsense_settings_disable_disablead_quicktag_buttons() {
541
  }
542
 
543
  function quick_adsense_settings_disable_positionad_quicktag_buttons() {
544
- if(jQuery('#quick_adsense_settings_disable_positionad_quicktag_buttons').prop('checked') == true) {
545
  jQuery('#quick_adsense_settings_disable_positionad_quicktag_buttons').parent().removeClass('disabled');
546
  } else {
547
  jQuery('#quick_adsense_settings_disable_positionad_quicktag_buttons').parent().addClass('disabled');
@@ -549,124 +525,25 @@ function quick_adsense_settings_disable_positionad_quicktag_buttons() {
549
  }
550
 
551
  function quick_adsense_settings_onpost_enable_global_style() {
552
- if(jQuery('#quick_adsense_settings_onpost_enable_global_style').prop('checked') == true) {
553
  jQuery('#quick_adsense_settings_onpost_enable_global_style').parent().removeClass('disabled');
554
  jQuery('#quick_adsense_settings_onpost_global_alignment').prop('disabled', false);
555
  jQuery('#quick_adsense_settings_onpost_global_margin').prop('disabled', false);
556
- for(var i = 1; i <= 10; i++) {
557
- jQuery('#quick_adsense_settings_onpost_ad_'+i+'_alignment').val(jQuery('#quick_adsense_settings_onpost_global_alignment').val());
558
- jQuery('#quick_adsense_settings_onpost_ad_'+i+'_margin').val(jQuery('#quick_adsense_settings_onpost_global_margin').val());
559
- jQuery('#quick_adsense_settings_onpost_ad_'+i+'_alignment').prop('disabled', true);
560
- jQuery('#quick_adsense_settings_onpost_ad_'+i+'_margin').prop('disabled', true);
561
- jQuery('#quick_adsense_settings_onpost_ad_'+i+'_alignment').parent().addClass('disabled');
562
  }
563
  } else {
564
  jQuery('#quick_adsense_settings_onpost_enable_global_style').parent().addClass('disabled');
565
  jQuery('#quick_adsense_settings_onpost_global_alignment').prop('disabled', true);
566
  jQuery('#quick_adsense_settings_onpost_global_margin').prop('disabled', true);
567
- for(var i = 1; i <= 10; i++) {
568
- jQuery('#quick_adsense_settings_onpost_ad_'+i+'_alignment').prop('disabled', false);
569
- jQuery('#quick_adsense_settings_onpost_ad_'+i+'_margin').prop('disabled', false);
570
- jQuery('#quick_adsense_settings_onpost_ad_'+i+'_alignment').parent().removeClass('disabled');
571
  }
572
  }
573
  }
574
-
575
- function quick_adsense_settings_handle_vi_single_selection() {
576
- /*
577
- Logic Table for vi Single Selection
578
- Beginning Enabled, Other Beginning Enabled, vi Beginning Disabled, Other Beginning Disabled, vi
579
-
580
- Middle Enabled, Other B1, M1 B1, M0 B0, M1 B0, M1, Random - B
581
-
582
- Middle Enabled, vi B0, M1 ------ B0, M1 B0, M1, Random - B
583
-
584
- Middle Disabled, Other B1, M0 B1, M0 B0, M0 B0, M0, Random B
585
-
586
- Middle Disabled, vi B1, M0, Random - M B1, M0, Random - M B0, M0, Random M B0, M0, Random B, Random M
587
- */
588
- if(jQuery('#quick_adsense_settings_enable_position_middle_of_post').prop('checked') == true) {
589
- if(jQuery('#quick_adsense_settings_ad_middle_of_post').val() != '100') {
590
- if(jQuery('#quick_adsense_settings_enable_position_beginning_of_post').prop('checked') == true) {
591
- if(jQuery('#quick_adsense_settings_ad_beginning_of_post').val() != '100') { //Middle Enabled, Other + Beginning Enabled, Other = B1, M1
592
- jQuery('#quick_adsense_settings_ad_beginning_of_post').children('option[value="100"]').prop('disabled', false);
593
- jQuery('#quick_adsense_settings_ad_middle_of_post').children('option[value="100"]').prop('disabled', false);
594
- } else { //Middle Enabled, Other + Beginning Enabled, vi = B1, M0
595
- jQuery('#quick_adsense_settings_ad_beginning_of_post').children('option[value="100"]').prop('disabled', false);
596
- jQuery('#quick_adsense_settings_ad_middle_of_post').children('option[value="100"]').prop('disabled', true);
597
- }
598
- } else {
599
- if(jQuery('#quick_adsense_settings_ad_beginning_of_post').val() != '100') { //Middle Enabled, Other + Beginning Disabled, Other = B0, M1
600
- jQuery('#quick_adsense_settings_ad_beginning_of_post').children('option[value="100"]').prop('disabled', true);
601
- jQuery('#quick_adsense_settings_ad_middle_of_post').children('option[value="100"]').prop('disabled', false);
602
- } else { //Middle Enabled, Other + Beginning Disabled, vi = B0, M1, Random - B
603
- jQuery('#quick_adsense_settings_ad_beginning_of_post').children('option[value="100"]').prop('disabled', true);
604
- jQuery('#quick_adsense_settings_ad_middle_of_post').children('option[value="100"]').prop('disabled', false);
605
- jQuery('#quick_adsense_settings_ad_beginning_of_post').val('0');
606
- }
607
- }
608
- } else {
609
- if(jQuery('#quick_adsense_settings_enable_position_beginning_of_post').prop('checked') == true) {
610
- if(jQuery('#quick_adsense_settings_ad_beginning_of_post').val() != '100') { //Middle Enabled, vi + Beginning Enabled, Other = B0, M1
611
- jQuery('#quick_adsense_settings_ad_beginning_of_post').children('option[value="100"]').prop('disabled', true);
612
- jQuery('#quick_adsense_settings_ad_middle_of_post').children('option[value="100"]').prop('disabled', false);
613
- } else { //Middle Enabled, vi + Beginning Enabled, vi = ------
614
- // This state should never be reached - Error
615
- alert('Error');
616
- }
617
- } else {
618
- if(jQuery('#quick_adsense_settings_ad_beginning_of_post').val() != '100') { //Middle Enabled, vi + Beginning Disabled, Other = B0, M1
619
- jQuery('#quick_adsense_settings_ad_beginning_of_post').children('option[value="100"]').prop('disabled', true);
620
- jQuery('#quick_adsense_settings_ad_middle_of_post').children('option[value="100"]').prop('disabled', false);
621
- } else { //Middle Enabled, vi + Beginning Disabled, vi = B0, M1, Random - B
622
- jQuery('#quick_adsense_settings_ad_beginning_of_post').children('option[value="100"]').prop('disabled', true);
623
- jQuery('#quick_adsense_settings_ad_middle_of_post').children('option[value="100"]').prop('disabled', false);
624
- jQuery('#quick_adsense_settings_ad_beginning_of_post').val('0');
625
- }
626
- }
627
- }
628
- } else {
629
- if(jQuery('#quick_adsense_settings_ad_middle_of_post').val() != '100') {
630
- if(jQuery('#quick_adsense_settings_enable_position_beginning_of_post').prop('checked') == true) {
631
- if(jQuery('#quick_adsense_settings_ad_beginning_of_post').val() != '100') { //Middle Disabled, Other + Beginning Enabled, Other = B1, M0
632
- jQuery('#quick_adsense_settings_ad_beginning_of_post').children('option[value="100"]').prop('disabled', false);
633
- jQuery('#quick_adsense_settings_ad_middle_of_post').children('option[value="100"]').prop('disabled', true);
634
- } else { //Middle Disabled, Other + Beginning Enabled, vi = B1, M0
635
- jQuery('#quick_adsense_settings_ad_beginning_of_post').children('option[value="100"]').prop('disabled', false);
636
- jQuery('#quick_adsense_settings_ad_middle_of_post').children('option[value="100"]').prop('disabled', true);
637
- }
638
- } else {
639
- if(jQuery('#quick_adsense_settings_ad_beginning_of_post').val() != '100') { //Middle Disabled, Other + Beginning Disabled, Other = B0, M0
640
- jQuery('#quick_adsense_settings_ad_beginning_of_post').children('option[value="100"]').prop('disabled', true);
641
- jQuery('#quick_adsense_settings_ad_middle_of_post').children('option[value="100"]').prop('disabled', true);
642
- } else { //Middle Disabled, Other + Beginning Disabled, vi = B0, M0, Random B
643
- jQuery('#quick_adsense_settings_ad_beginning_of_post').children('option[value="100"]').prop('disabled', true);
644
- jQuery('#quick_adsense_settings_ad_middle_of_post').children('option[value="100"]').prop('disabled', true);
645
- jQuery('#quick_adsense_settings_ad_beginning_of_post').val('0');
646
- }
647
- }
648
- } else {
649
- if(jQuery('#quick_adsense_settings_enable_position_beginning_of_post').prop('checked') == true) {
650
- if(jQuery('#quick_adsense_settings_ad_beginning_of_post').val() != '100') { //Middle Enabled, vi + Beginning Enabled, Other = B1, M0, Random - M
651
- jQuery('#quick_adsense_settings_ad_beginning_of_post').children('option[value="100"]').prop('disabled', false);
652
- jQuery('#quick_adsense_settings_ad_middle_of_post').children('option[value="100"]').prop('disabled', true);
653
- jQuery('#quick_adsense_settings_ad_middle_of_post').val('0');
654
- } else { //Middle Enabled, vi + Beginning Enabled, vi = B1, M0, Random - M
655
- jQuery('#quick_adsense_settings_ad_beginning_of_post').children('option[value="100"]').prop('disabled', false);
656
- jQuery('#quick_adsense_settings_ad_middle_of_post').children('option[value="100"]').prop('disabled', true);
657
- jQuery('#quick_adsense_settings_ad_middle_of_post').val('0');
658
- }
659
- } else {
660
- if(jQuery('#quick_adsense_settings_ad_beginning_of_post').val() != '100') { //Middle Enabled, vi + Beginning Disabled, Other = B0, M0, Random M
661
- jQuery('#quick_adsense_settings_ad_beginning_of_post').children('option[value="100"]').prop('disabled', true);
662
- jQuery('#quick_adsense_settings_ad_middle_of_post').children('option[value="100"]').prop('disabled', true);
663
- jQuery('#quick_adsense_settings_ad_middle_of_post').val('0');
664
- } else { //Middle Enabled, vi + Beginning Disabled, vi = B0, M0, Random B, Random M
665
- jQuery('#quick_adsense_settings_ad_beginning_of_post').children('option[value="100"]').prop('disabled', true);
666
- jQuery('#quick_adsense_settings_ad_middle_of_post').children('option[value="100"]').prop('disabled', true);
667
- jQuery('#quick_adsense_settings_ad_middle_of_post').val('0');
668
- }
669
- }
670
- }
671
- }
672
- }
1
+ jQuery(document).ready(function () {
2
+ jQuery("#quick_adsense_settings_tabs").tabs();
3
+ jQuery('#quick_adsense_settings_reset_to_default').click(quick_adsense_settings_reset_to_default);
4
+
5
  jQuery('#quick_adsense_settings_enable_position_beginning_of_post').click(quick_adsense_settings_enable_position_beginning_of_post);
6
  jQuery('#quick_adsense_settings_enable_position_middle_of_post').click(quick_adsense_settings_enable_position_middle_of_post);
7
+ jQuery('#quick_adsense_settings_enable_position_end_of_post').click(quick_adsense_settings_enable_position_end_of_post);
8
+ jQuery('#quick_adsense_settings_enable_position_after_more_tag').click(quick_adsense_settings_enable_position_after_more_tag);
9
+ jQuery('#quick_adsense_settings_enable_position_before_last_para').click(quick_adsense_settings_enable_position_before_last_para);
10
+ jQuery('#quick_adsense_settings_enable_position_after_para_option_1').click(quick_adsense_settings_enable_position_after_para_option_1);
11
+ jQuery('#quick_adsense_settings_enable_position_after_para_option_2').click(quick_adsense_settings_enable_position_after_para_option_2);
12
+ jQuery('#quick_adsense_settings_enable_position_after_para_option_3').click(quick_adsense_settings_enable_position_after_para_option_3);
13
+ jQuery('#quick_adsense_settings_enable_position_after_image_option_1').click(quick_adsense_settings_enable_position_after_image_option_1);
14
  jQuery('#quick_adsense_settings_enable_on_posts').click(quick_adsense_settings_enable_on_posts);
15
+ jQuery('#quick_adsense_settings_enable_on_pages').click(quick_adsense_settings_enable_on_pages);
16
  jQuery('#quick_adsense_settings_enable_on_homepage').click(quick_adsense_settings_enable_on_homepage);
17
  jQuery('#quick_adsense_settings_enable_on_categories').click(quick_adsense_settings_enable_on_categories);
18
  jQuery('#quick_adsense_settings_enable_on_archives').click(quick_adsense_settings_enable_on_archives);
19
  jQuery('#quick_adsense_settings_enable_on_tags').click(quick_adsense_settings_enable_on_tags);
20
+ jQuery('#quick_adsense_settings_enable_all_possible_ads').click(quick_adsense_settings_enable_all_possible_ads);
21
+ jQuery('#quick_adsense_settings_disable_widgets_on_homepage').click(quick_adsense_settings_disable_widgets_on_homepage);
22
+ jQuery('#quick_adsense_settings_disable_for_loggedin_users').click(quick_adsense_settings_disable_for_loggedin_users);
23
+ jQuery('#quick_adsense_settings_enable_quicktag_buttons').click(quick_adsense_settings_enable_quicktag_buttons);
24
+ jQuery('#quick_adsense_settings_disable_randomads_quicktag_button').click(quick_adsense_settings_disable_randomads_quicktag_button);
25
+ jQuery('#quick_adsense_settings_disable_disablead_quicktag_buttons').click(quick_adsense_settings_disable_disablead_quicktag_buttons);
26
  jQuery('#quick_adsense_settings_disable_positionad_quicktag_buttons').click(quick_adsense_settings_disable_positionad_quicktag_buttons);
27
+
28
+ jQuery('#quick_adsense_settings_onpost_enable_global_style').click(quick_adsense_settings_onpost_enable_global_style);
29
  jQuery('#quick_adsense_settings_onpost_global_alignment').click(quick_adsense_settings_onpost_enable_global_style);
30
  jQuery('#quick_adsense_settings_onpost_global_margin').click(quick_adsense_settings_onpost_enable_global_style);
 
 
 
 
 
31
 
 
 
 
 
 
32
  quick_adsense_settings_enable_position_beginning_of_post();
33
  quick_adsense_settings_enable_position_middle_of_post();
34
  quick_adsense_settings_enable_position_end_of_post();
52
  quick_adsense_settings_disable_disablead_quicktag_buttons();
53
  quick_adsense_settings_disable_positionad_quicktag_buttons();
54
  quick_adsense_settings_onpost_enable_global_style();
55
+
56
+ jQuery('#quick_adsense_onpost_content_adunits_showall_button').click(function () {
57
+ if (jQuery('#quick_adsense_onpost_content_adunits_showall_button').text() == ' Show All') {
 
58
  jQuery('#quick_adsense_onpost_content_adunits_all_wrapper').slideDown();
59
  jQuery('#quick_adsense_onpost_content_adunits_showall_button').html('<span class="dashicons dashicons-arrow-up"></span> <b>Show Less</b>');
60
  } else {
62
  jQuery('#quick_adsense_onpost_content_adunits_showall_button').html('<span class="dashicons dashicons-arrow-down"></span> <b>Show All</b>');
63
  }
64
  });
65
+
66
+ jQuery('#quick_adsense_widget_adunits_showall_button').click(function () {
67
+ if (jQuery('#quick_adsense_widget_adunits_showall_button').text() == ' Show All') {
68
  jQuery('#quick_adsense_widget_adunits_all_wrapper').slideDown();
69
  jQuery('#quick_adsense_widget_adunits_showall_button').html('<span class="dashicons dashicons-arrow-up"></span> <b>Show Less</b>');
70
  } else {
73
  }
74
  });
75
 
76
+ jQuery('#quick_adsense_settings_form').submit(function () {
77
+ jQuery('#quick_adsense_settings_form select').each(function () {
78
+ if (jQuery(this).prop('disabled') == true) {
79
  jQuery(this).prop('disabled', false);
80
  }
81
  });
82
  });
83
 
84
  jQuery('#quick_adsense_settings_form').fadeIn();
85
+ if (window.location.href.indexOf('#quick_adsense_adstxt_adsense_auto_update') > -1) {
86
  quick_adsense_adstxt_adsense_auto_update();
87
  }
88
+
89
+ jQuery('.quick_adsense_onpost_ad_reset_stats').click(function () {
90
  jQuery(this).prop('disabled', true);
91
+ wp.ajax.post('quick_adsense_onpost_ad_reset_stats', {
92
+ nonce: quick_adsense.nonce,
93
+ index: jQuery(this).attr('data-index'),
94
+ }).done(function (result) {
95
+ jQuery('.quick_adsense_onpost_ad_reset_stats').each(function () {
96
+ jQuery(this).prop('disabled', false);
97
+ });
98
+ });
 
 
 
 
 
99
  });
100
+
101
+ jQuery('.quick_adsense_onpost_ad_show_stats').click(function () {
102
+ jQuery('<div id="quick_adsense_onpost_ad_show_stats_dialog" data-index="' + jQuery(this).attr('data-index') + '"></div>').html('<div class="quick_adsense_ajaxloader"></div>').dialog({
103
  'modal': true,
104
  'resizable': false,
105
  'width': jQuery("body").width() * 0.5,
106
  'maxWidth': jQuery("body").width() * 0.5,
107
  'maxHeight': jQuery("body").height() * 0.9,
108
+ 'title': 'Ad' + jQuery(this).attr('data-index') + ' Performance Stats (30 Days)',
109
  position: { my: 'center', at: 'center', of: window },
110
  open: function (event, ui) {
111
+ jQuery('.ui-dialog').css({ 'z-index': 999999, 'max-width': '90%' });
112
+ jQuery('.ui-widget-overlay').css({ 'z-index': 999998, 'opacity': 0.8, 'background': '#000000' });
113
+ wp.ajax.post('quick_adsense_onpost_ad_get_stats_chart', {
114
+ nonce: quick_adsense.nonce,
115
+ index: jQuery('#quick_adsense_onpost_ad_show_stats_dialog').attr('data-index'),
116
+ }).done(function (result) {
117
+ jQuery('.quick_adsense_ajaxloader').hide();
118
+ jQuery('#quick_adsense_onpost_ad_show_stats_dialog').html(result);
119
+ jQuery('.ui-accordion .ui-accordion-content').css('max-height', (jQuery("body").height() * 0.45));
120
+ jQuery('.ui-dialog').css({ 'position': 'fixed' });
121
+ jQuery('#quick_adsense_onpost_ad_show_stats_dialog').delay(500).dialog({ position: { my: 'center', at: 'center', of: window } });
122
+
123
+ jQuery('#quick_adsense_ad_stats_chart_wrapper canvas').attr('width', jQuery('#quick_adsense_ad_stats_chart_wrapper').width() + 'px');
124
+ jQuery('#quick_adsense_ad_stats_chart_wrapper canvas').attr('height', jQuery('#quick_adsense_ad_stats_chart_wrapper').height() + 'px');
125
+ if (jQuery('#quick_adsense_ad_stats_chart_data').length) {
126
+ var quick_adsense_ad_stats_chart = new Chart(jQuery('#quick_adsense_ad_stats_chart'), {
127
+ type: 'line',
128
+ responsive: false,
129
+ data: {
130
+ datasets: [{
131
+ data: JSON.parse(jQuery('#quick_adsense_ad_stats_chart_data').val()),
132
+ backgroundColor: '#EDF5FB',
133
+ borderColor: '#186EAE',/*E8EBEF*/
134
+ borderWidth: 1
135
+ }]
136
+ },
137
+ options: {
138
+ title: {
139
+ display: false,
140
+ backgroundColor: '#EDF5FB'
141
  },
142
+ legend: {
143
+ display: false,
144
+ },
145
+ scales: {
146
+ xAxes: [{
147
+ type: "time",
148
+ display: true,
149
+ scaleLabel: {
150
+ display: true
151
+ },
152
+ gridLines: {
153
  display: true,
154
+ drawTicks: true
155
+ },
156
+ ticks: {
157
+ display: true
158
+ }
159
+ }],
160
+ yAxes: [{
161
+ display: true,
162
+ scaleLabel: {
163
+ display: true
164
+ },
165
+ gridLines: {
166
  display: true,
167
+ drawTicks: true
168
+ },
169
+ ticks: {
170
+ display: true
171
+ }
172
+ }]
173
+ },
174
+ tooltips: {
175
+ displayColors: false,
176
+ callbacks: {
177
+ label: function (tooltipItem, data) {
178
+ return ['Impressions: ' + parseInt(data.datasets[tooltipItem.datasetIndex].data[tooltipItem.index]['y'], 10), 'Clicks: ' + parseInt(data.datasets[tooltipItem.datasetIndex].data[tooltipItem.index]['y1'], 10)];
179
+ },
180
+ title: function (tooltipItem, data) {
181
+ var monthNames = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
182
+ var dateParts = tooltipItem[0].xLabel.split('/');
183
+ var date = new Date(dateParts[2], dateParts[0] - 1, dateParts[1]);
184
+ return monthNames[date.getMonth()] + ' ' + date.getDate();
 
 
 
 
 
 
185
  }
186
  }
187
  }
188
+ }
189
+ });
190
  }
191
+ });
192
  },
193
+ buttons: {},
194
+ close: function () {
195
  jQuery(this).dialog('destroy');
196
  }
197
  })
199
  });
200
 
201
  function quick_adsense_adstxt_adsense_auto_update() {
202
+ wp.ajax.post('quick_adsense_adstxt_adsense_auto_update', {
203
+ nonce: quick_adsense_adstxt_adsense.nonce,
204
+ }).done(function (result) {
205
+ jQuery('.quick_adsense_adstxt_adsense_notice').hide();
206
+ }.fail(function(result) {
207
+ if ("undefined" !== typeof result) {
208
+ jQuery(result).dialog({
209
+ 'modal': true,
210
+ 'resizable': false,
211
+ 'title': 'Ads.txt Auto Updation Failed',
212
+ 'width': jQuery("body").width() * 0.5,
213
+ 'maxWidth': jQuery("body").width() * 0.5,
214
+ 'maxHeight': jQuery("body").height() * 0.9,
215
+ position: { my: 'center', at: 'center', of: window },
216
+ open: function (event, ui) {
217
+ jQuery('.ui-dialog').css({ 'z-index': 999999, 'max-width': '90%' });
218
+ jQuery('.ui-widget-overlay').css({ 'z-index': 999998, 'opacity': 0.8, 'background': '#000000' });
219
+ },
220
+ buttons: {
221
+ 'Cancel': function () {
222
+ jQuery(this).dialog("close");
 
 
 
 
223
  }
224
+ },
225
+ close: function () {
226
+ jQuery(this).dialog('destroy');
227
+ }
228
+ });
229
  }
230
+ }));
231
  }
232
 
233
  function quick_adsense_settings_reset_to_default() {
234
  jQuery('#quick_adsense_settings_max_ads_per_page').val('3');
235
+
236
+ jQuery('#quick_adsense_settings_enable_position_beginning_of_post').prop('checked', true);
237
  jQuery('#quick_adsense_settings_ad_beginning_of_post').val('1');
238
  jQuery('#quick_adsense_settings_enable_position_middle_of_post').prop('checked', false);
239
  jQuery('#quick_adsense_settings_ad_middle_of_post').val('0');
240
  jQuery('#quick_adsense_settings_enable_position_end_of_post').prop('checked', true);
241
  jQuery('#quick_adsense_settings_ad_end_of_post').val('0');
242
+
243
  jQuery('#quick_adsense_settings_enable_position_after_more_tag').prop('checked', false);
244
  jQuery('#quick_adsense_settings_ad_after_more_tag').val('0');
245
  jQuery('#quick_adsense_settings_enable_position_before_last_para').prop('checked', false);
246
  jQuery('#quick_adsense_settings_ad_before_last_para').val('0');
247
+
248
+ for (var i = 1; i <= 3; i++) {
249
+ jQuery('#quick_adsense_settings_enable_position_after_para_option_' + i).prop('checked', false);
250
+ jQuery('#quick_adsense_settings_ad_after_para_option_' + i).val('0');
251
+ jQuery('#quick_adsense_settings_position_after_para_option_' + i).val('1');
252
+ jQuery('#quick_adsense_settings_enable_jump_position_after_para_option_' + i).prop('checked', false);
253
  }
254
+
255
+ for (var i = 1; i <= 1; i++) {
256
+ jQuery('#quick_adsense_settings_enable_position_after_image_option_' + i).prop('checked', false);
257
+ jQuery('#quick_adsense_settings_ad_after_image_option_' + i).val('0');
258
+ jQuery('#quick_adsense_settings_position_after_image_option_' + i).val('1');
259
+ jQuery('#quick_adsense_settings_enable_jump_position_after_image_option_' + i).prop('checked', false);
260
  }
261
+
262
  jQuery('#quick_adsense_settings_enable_on_posts').prop('checked', true);
263
  jQuery('#quick_adsense_settings_enable_on_pages').prop('checked', true);
264
+
265
  jQuery('#quick_adsense_settings_enable_on_homepage').prop('checked', false);
266
  jQuery('#quick_adsense_settings_enable_on_categories').prop('checked', false);
267
  jQuery('#quick_adsense_settings_enable_on_archives').prop('checked', false);
268
  jQuery('#quick_adsense_settings_enable_on_tags').prop('checked', false);
269
  jQuery('#quick_adsense_settings_enable_all_possible_ads').prop('checked', false);
270
+
271
  jQuery('#quick_adsense_settings_disable_widgets_on_homepage').prop('checked', false);
272
+
273
  jQuery('#quick_adsense_settings_disable_for_loggedin_users').prop('checked', false);
274
+
275
  jQuery('#quick_adsense_settings_enable_quicktag_buttons').prop('checked', true);
276
  jQuery('#quick_adsense_settings_disable_randomads_quicktag_button').prop('checked', false);
277
  jQuery('#quick_adsense_settings_disable_disablead_quicktag_buttons').prop('checked', false);
278
  jQuery('#quick_adsense_settings_disable_positionad_quicktag_buttons').prop('checked', false);
279
+
280
  jQuery('#quick_adsense_settings_onpost_enable_global_style').prop('checked', false);
281
  jQuery('#quick_adsense_settings_onpost_global_alignment').val('2');
282
  jQuery('#quick_adsense_settings_onpost_global_margin').val('10');
283
+
284
+ for (var i = 1; i <= 10; i++) {
285
+ jQuery('#quick_adsense_settings_onpost_ad_' + i + '_content').val('');
286
+ jQuery('#quick_adsense_settings_onpost_ad_' + i + '_alignment').val('2');
287
+ jQuery('#quick_adsense_settings_onpost_ad_' + i + '_margin').val('10');
288
+
289
+ jQuery('#quick_adsense_settings_widget_ad_' + i + '_content').val('');
290
  }
291
+
292
  quick_adsense_settings_enable_position_beginning_of_post();
293
  quick_adsense_settings_enable_position_middle_of_post();
294
  quick_adsense_settings_enable_position_end_of_post();
312
  quick_adsense_settings_disable_disablead_quicktag_buttons();
313
  quick_adsense_settings_disable_positionad_quicktag_buttons();
314
  quick_adsense_settings_onpost_enable_global_style();
 
315
  }
316
 
317
  function quick_adsense_settings_enable_position_beginning_of_post() {
318
+ if (jQuery('#quick_adsense_settings_enable_position_beginning_of_post').prop('checked') == true) {
319
  jQuery('#quick_adsense_settings_ad_beginning_of_post').prop('disabled', false);
320
  jQuery('#quick_adsense_settings_ad_beginning_of_post').parent().removeClass('disabled');
321
  } else {
322
  jQuery('#quick_adsense_settings_ad_beginning_of_post').prop('disabled', true);
323
  jQuery('#quick_adsense_settings_ad_beginning_of_post').parent().addClass('disabled');
324
  }
 
325
  }
326
 
327
  function quick_adsense_settings_enable_position_middle_of_post() {
328
+ if (jQuery('#quick_adsense_settings_enable_position_middle_of_post').prop('checked') == true) {
329
  jQuery('#quick_adsense_settings_ad_middle_of_post').prop('disabled', false);
330
  jQuery('#quick_adsense_settings_ad_middle_of_post').parent().removeClass('disabled');
331
  } else {
332
  jQuery('#quick_adsense_settings_ad_middle_of_post').prop('disabled', true);
333
  jQuery('#quick_adsense_settings_ad_middle_of_post').parent().addClass('disabled');
334
  }
 
335
  }
336
 
337
  function quick_adsense_settings_enable_position_end_of_post() {
338
+ if (jQuery('#quick_adsense_settings_enable_position_end_of_post').prop('checked') == true) {
339
  jQuery('#quick_adsense_settings_ad_end_of_post').prop('disabled', false);
340
  jQuery('#quick_adsense_settings_ad_end_of_post').parent().removeClass('disabled');
341
  } else {
345
  }
346
 
347
  function quick_adsense_settings_enable_position_after_more_tag() {
348
+ if (jQuery('#quick_adsense_settings_enable_position_after_more_tag').prop('checked') == true) {
349
  jQuery('#quick_adsense_settings_ad_after_more_tag').prop('disabled', false);
350
  jQuery('#quick_adsense_settings_ad_after_more_tag').parent().removeClass('disabled');
351
  } else {
353
  jQuery('#quick_adsense_settings_ad_after_more_tag').parent().addClass('disabled');
354
  }
355
  }
356
+
357
  function quick_adsense_settings_enable_position_before_last_para() {
358
+ if (jQuery('#quick_adsense_settings_enable_position_before_last_para').prop('checked') == true) {
359
  jQuery('#quick_adsense_settings_ad_before_last_para').prop('disabled', false);
360
  jQuery('#quick_adsense_settings_ad_before_last_para').parent().removeClass('disabled');
361
  } else {
365
  }
366
 
367
  function quick_adsense_settings_enable_position_after_para_option_1() {
368
+ if (jQuery('#quick_adsense_settings_enable_position_after_para_option_1').prop('checked') == true) {
369
  jQuery('#quick_adsense_settings_ad_after_para_option_1').prop('disabled', false);
370
  jQuery('#quick_adsense_settings_position_after_para_option_1').prop('disabled', false);
371
  jQuery('#quick_adsense_settings_enable_jump_position_after_para_option_1').prop('disabled', false);
379
  }
380
 
381
  function quick_adsense_settings_enable_position_after_para_option_2() {
382
+ if (jQuery('#quick_adsense_settings_enable_position_after_para_option_2').prop('checked') == true) {
383
  jQuery('#quick_adsense_settings_ad_after_para_option_2').prop('disabled', false);
384
  jQuery('#quick_adsense_settings_position_after_para_option_2').prop('disabled', false);
385
  jQuery('#quick_adsense_settings_enable_jump_position_after_para_option_2').prop('disabled', false);
393
  }
394
 
395
  function quick_adsense_settings_enable_position_after_para_option_3() {
396
+ if (jQuery('#quick_adsense_settings_enable_position_after_para_option_3').prop('checked') == true) {
397
  jQuery('#quick_adsense_settings_ad_after_para_option_3').prop('disabled', false);
398
  jQuery('#quick_adsense_settings_position_after_para_option_3').prop('disabled', false);
399
  jQuery('#quick_adsense_settings_enable_jump_position_after_para_option_3').prop('disabled', false);
407
  }
408
 
409
  function quick_adsense_settings_enable_position_after_image_option_1() {
410
+ if (jQuery('#quick_adsense_settings_enable_position_after_image_option_1').prop('checked') == true) {
411
  jQuery('#quick_adsense_settings_ad_after_image_option_1').prop('disabled', false);
412
  jQuery('#quick_adsense_settings_position_after_image_option_1').prop('disabled', false);
413
  jQuery('#quick_adsense_settings_enable_jump_position_after_image_option_1').prop('disabled', false);
421
  }
422
 
423
  function quick_adsense_settings_enable_on_posts() {
424
+ if (jQuery('#quick_adsense_settings_enable_on_posts').prop('checked') == true) {
425
  jQuery('#quick_adsense_settings_enable_on_posts').parent().removeClass('disabled');
426
  } else {
427
  jQuery('#quick_adsense_settings_enable_on_posts').parent().addClass('disabled');
429
  }
430
 
431
  function quick_adsense_settings_enable_on_pages() {
432
+ if (jQuery('#quick_adsense_settings_enable_on_pages').prop('checked') == true) {
433
  jQuery('#quick_adsense_settings_enable_on_pages').parent().removeClass('disabled');
434
  } else {
435
  jQuery('#quick_adsense_settings_enable_on_pages').parent().addClass('disabled');
437
  }
438
 
439
  function quick_adsense_settings_enable_on_homepage() {
440
+ if (jQuery('#quick_adsense_settings_enable_on_homepage').prop('checked') == true) {
441
  jQuery('#quick_adsense_settings_enable_on_homepage').parent().removeClass('disabled');
442
  } else {
443
  jQuery('#quick_adsense_settings_enable_on_homepage').parent().addClass('disabled');
445
  }
446
 
447
  function quick_adsense_settings_enable_on_categories() {
448
+ if (jQuery('#quick_adsense_settings_enable_on_categories').prop('checked') == true) {
449
  jQuery('#quick_adsense_settings_enable_on_categories').parent().removeClass('disabled');
450
  } else {
451
  jQuery('#quick_adsense_settings_enable_on_categories').parent().addClass('disabled');
453
  }
454
 
455
  function quick_adsense_settings_enable_on_archives() {
456
+ if (jQuery('#quick_adsense_settings_enable_on_archives').prop('checked') == true) {
457
  jQuery('#quick_adsense_settings_enable_on_archives').parent().removeClass('disabled');
458
  } else {
459
  jQuery('#quick_adsense_settings_enable_on_archives').parent().addClass('disabled');
461
  }
462
 
463
  function quick_adsense_settings_enable_on_tags() {
464
+ if (jQuery('#quick_adsense_settings_enable_on_tags').prop('checked') == true) {
465
  jQuery('#quick_adsense_settings_enable_on_tags').parent().removeClass('disabled');
466
  } else {
467
  jQuery('#quick_adsense_settings_enable_on_tags').parent().addClass('disabled');
469
  }
470
 
471
  function quick_adsense_settings_enable_all_possible_ads() {
472
+ if (jQuery('#quick_adsense_settings_enable_all_possible_ads').prop('checked') == true) {
473
  jQuery('#quick_adsense_settings_enable_all_possible_ads').parent().removeClass('disabled');
474
  } else {
475
  jQuery('#quick_adsense_settings_enable_all_possible_ads').parent().addClass('disabled');
477
  }
478
 
479
  function quick_adsense_settings_disable_widgets_on_homepage() {
480
+ if (jQuery('#quick_adsense_settings_disable_widgets_on_homepage').prop('checked') == true) {
481
  jQuery('#quick_adsense_settings_disable_widgets_on_homepage').parent().removeClass('disabled');
482
  } else {
483
  jQuery('#quick_adsense_settings_disable_widgets_on_homepage').parent().addClass('disabled');
485
  }
486
 
487
  function quick_adsense_settings_disable_for_loggedin_users() {
488
+ if (jQuery('#quick_adsense_settings_disable_for_loggedin_users').prop('checked') == true) {
489
  jQuery('#quick_adsense_settings_disable_for_loggedin_users').parent().removeClass('disabled');
490
  } else {
491
  jQuery('#quick_adsense_settings_disable_for_loggedin_users').parent().addClass('disabled');
493
  }
494
 
495
  function quick_adsense_settings_enable_quicktag_buttons() {
496
+ if (jQuery('#quick_adsense_settings_enable_quicktag_buttons').prop('checked') == true) {
497
  jQuery('#quick_adsense_settings_enable_quicktag_buttons').parent().removeClass('disabled');
498
  } else {
499
  jQuery('#quick_adsense_settings_enable_quicktag_buttons').parent().addClass('disabled');
501
  }
502
 
503
  function quick_adsense_settings_disable_randomads_quicktag_button() {
504
+ if (jQuery('#quick_adsense_settings_disable_randomads_quicktag_button').prop('checked') == true) {
505
  jQuery('#quick_adsense_settings_disable_randomads_quicktag_button').parent().removeClass('disabled');
506
  } else {
507
  jQuery('#quick_adsense_settings_disable_randomads_quicktag_button').parent().addClass('disabled');
509
  }
510
 
511
  function quick_adsense_settings_disable_disablead_quicktag_buttons() {
512
+ if (jQuery('#quick_adsense_settings_disable_disablead_quicktag_buttons').prop('checked') == true) {
513
  jQuery('#quick_adsense_settings_disable_disablead_quicktag_buttons').parent().removeClass('disabled');
514
  } else {
515
  jQuery('#quick_adsense_settings_disable_disablead_quicktag_buttons').parent().addClass('disabled');
517
  }
518
 
519
  function quick_adsense_settings_disable_positionad_quicktag_buttons() {
520
+ if (jQuery('#quick_adsense_settings_disable_positionad_quicktag_buttons').prop('checked') == true) {
521
  jQuery('#quick_adsense_settings_disable_positionad_quicktag_buttons').parent().removeClass('disabled');
522
  } else {
523
  jQuery('#quick_adsense_settings_disable_positionad_quicktag_buttons').parent().addClass('disabled');
525
  }
526
 
527
  function quick_adsense_settings_onpost_enable_global_style() {
528
+ if (jQuery('#quick_adsense_settings_onpost_enable_global_style').prop('checked') == true) {
529
  jQuery('#quick_adsense_settings_onpost_enable_global_style').parent().removeClass('disabled');
530
  jQuery('#quick_adsense_settings_onpost_global_alignment').prop('disabled', false);
531
  jQuery('#quick_adsense_settings_onpost_global_margin').prop('disabled', false);
532
+ for (var i = 1; i <= 10; i++) {
533
+ jQuery('#quick_adsense_settings_onpost_ad_' + i + '_alignment').val(jQuery('#quick_adsense_settings_onpost_global_alignment').val());
534
+ jQuery('#quick_adsense_settings_onpost_ad_' + i + '_margin').val(jQuery('#quick_adsense_settings_onpost_global_margin').val());
535
+ jQuery('#quick_adsense_settings_onpost_ad_' + i + '_alignment').prop('disabled', true);
536
+ jQuery('#quick_adsense_settings_onpost_ad_' + i + '_margin').prop('disabled', true);
537
+ jQuery('#quick_adsense_settings_onpost_ad_' + i + '_alignment').parent().addClass('disabled');
538
  }
539
  } else {
540
  jQuery('#quick_adsense_settings_onpost_enable_global_style').parent().addClass('disabled');
541
  jQuery('#quick_adsense_settings_onpost_global_alignment').prop('disabled', true);
542
  jQuery('#quick_adsense_settings_onpost_global_margin').prop('disabled', true);
543
+ for (var i = 1; i <= 10; i++) {
544
+ jQuery('#quick_adsense_settings_onpost_ad_' + i + '_alignment').prop('disabled', false);
545
+ jQuery('#quick_adsense_settings_onpost_ad_' + i + '_margin').prop('disabled', false);
546
+ jQuery('#quick_adsense_settings_onpost_ad_' + i + '_alignment').parent().removeClass('disabled');
547
  }
548
  }
549
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/GeoIP/GeoIPCountry.php DELETED
@@ -1,428 +0,0 @@
1
- <?php
2
- /**
3
- * Created by PhpStorm.
4
- * User: sjhc1170
5
- * Date: 20/04/2017
6
- * Time: 08:55
7
- */
8
-
9
- namespace Iriven;
10
- use ZipArchive;
11
- use SplFileObject;
12
-
13
- /**
14
- * Class GeoIPCountry
15
- * @package Iriven\GeoIPCountry
16
- */
17
- class GeoIPCountry
18
- {
19
- const DOWNLOAD_LINK = 'http://software77.net/geo-ip/?DL=%s';
20
- const DOWNLOADED_FILE = 'GeoIP';
21
- const DS = DIRECTORY_SEPARATOR;
22
- private $DataLocation = null;
23
- private $EditModeEnabled = false;
24
- private $IsoCode = null;
25
- private $IpPackageID = ['ipv4'=>'1','ipv6'=>'7'];
26
- private $PackageLocation = null;
27
- private $PackageName = self::DOWNLOADED_FILE;
28
- private $UpdateUrl = self::DOWNLOAD_LINK;
29
-
30
- /**
31
- * GeoIPCountry constructor.
32
- */
33
- public function __construct()
34
- {
35
- $this->PackageLocation = realpath($this->getStoragePath());
36
- $this->DataLocation = realpath($this->getStoragePath(false));
37
- $this->prepareLookup();
38
- return $this;
39
- }
40
-
41
- /**
42
- * @return $this
43
- */
44
- public function Admin()
45
- {
46
- $this->EditModeEnabled = true;
47
- return $this;
48
- }
49
-
50
- /**
51
- * @return $this
52
- */
53
- private function DownloadPackage()
54
- {
55
- if($this->EditModeEnabled)
56
- {
57
- set_time_limit(0); //prevent timeout
58
- try
59
- {
60
- foreach ($this->IpPackageID AS $ipVersion=>$packageId)
61
- {
62
- $Archive = $this->PackageLocation.self::DS.$this->PackageName;
63
- $Archive .=($ipVersion==='ipv6')?'6R.csv.gz':'.csv.gz';
64
- if(!file_exists($Archive))
65
- {
66
- $url = sprintf($this->UpdateUrl,$packageId);
67
- $curl=curl_init();
68
- $Handler = fopen($Archive,'w+');
69
- curl_setopt($curl, CURLOPT_URL, str_replace(' ','%20',$url));
70
- curl_setopt($curl, CURLOPT_FILE, $Handler); //auto write to file
71
- curl_setopt($curl, CURLOPT_TIMEOUT, 5040);
72
- curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
73
- if(curl_exec($curl) === false)
74
- throw new \Exception(curl_error($curl));
75
- curl_close($curl);
76
- fclose($Handler);
77
- }
78
- }
79
- }
80
- catch (\Exception $e)
81
- {
82
- trigger_error($e->getMessage());
83
- }
84
- }
85
- return $this;
86
- }
87
-
88
- /**
89
- * If IPV6, Returns the IP in it's fullest format.
90
- * @example
91
- * ::1 => 0000:0000:0000:0000:0000:0000:0000:0001
92
- * 220F::127.0.0.1 => 220F:0000:0000:0000:0000:0000:7F00:0001
93
- * 2F:A1::1 => 002F:00A1:0000:0000:0000:0000:0000:0001
94
- * @param $Ip
95
- * @return mixed|string
96
- */
97
- private function ExpandIPAddress($Ip)
98
- {
99
- if (strpos($Ip, ':') !== false) // IPv6 address
100
- {
101
- $hex = unpack('H*hex', inet_pton($Ip));
102
- $Ip = substr(preg_replace('/([A-f0-9]{4})/', "$1:", $hex['hex']), 0, -1);
103
- $Ip = strtoupper($Ip);
104
- }
105
- return $Ip;
106
- }
107
- /**
108
- * @param $ip
109
- * @return null|string
110
- */
111
- private function getIPRangeProviderFile($ip)
112
- {
113
- try
114
- {
115
- if(!preg_match('/[.:]/', $ip)) $ip = $this->long2ip($ip, false);
116
- if(!filter_var($ip,FILTER_VALIDATE_IP,[FILTER_FLAG_IPV4|FILTER_FLAG_IPV6]))
117
- throw new \Exception('Invalid IP given');
118
- $delimiter = (strpos($ip,':')===false)? '.' : ':';
119
- $DBfile = current(explode($delimiter,$ip)).'.php';
120
- return $DBfile;
121
- }
122
- catch (\Exception $e)
123
- {
124
- trigger_error($e->getMessage());
125
- }
126
- return null;
127
- }
128
- /**
129
- * @param bool $isArchive
130
- * @return string
131
- */
132
- private function getStoragePath($isArchive=true)
133
- {
134
- $tmp = ini_get('upload_tmp_dir')?:sys_get_temp_dir ();
135
- $isArchive OR $tmp = rtrim(__DIR__, self::DS);
136
- try{
137
- if (!is_writeable($tmp))
138
- throw new \Exception(sprintf('The required destination path is not writable: %s', $tmp));
139
- }
140
- catch(\Exception $e)
141
- {
142
- trigger_error($e->getMessage(),E_USER_ERROR);
143
- }
144
- $tmp .= self::DS.($isArchive? 'GeoIPCountry' : 'GeoIPDatas');
145
- if(!is_dir($tmp)) mkdir($tmp,'0755', true);
146
- return $tmp;
147
- }
148
- /**
149
- * Convert both IPV4 and IPv6 address to an integer
150
- * @param $Ip
151
- * @return mixed|string
152
- */
153
- private function ip2long($Ip)
154
- {
155
- $decimal = null;
156
- $Ip = $this->ExpandIPAddress($Ip);
157
- try
158
- {
159
- switch ($Ip):
160
- case (strpos($Ip, '.') !== false):
161
- if(!filter_var($Ip,FILTER_VALIDATE_IP,[FILTER_FLAG_IPV4]))
162
- throw new \Exception('Invalid IPV4 given');
163
- $decimal .= ip2long($Ip);
164
- break;
165
- case (strpos($Ip, ':') !== false):
166
- if(!filter_var($Ip,FILTER_VALIDATE_IP,[FILTER_FLAG_IPV6]))
167
- throw new \Exception('Invalid IPV6 given');
168
- $network = inet_pton($Ip);
169
- $parts = unpack('C*', $network);
170
- foreach ($parts as &$byte)
171
- $decimal.= str_pad(decbin($byte), 8, '0', STR_PAD_LEFT);
172
- break;
173
- default:
174
- throw new \Exception($Ip.' is not a valid IP address');
175
- break;
176
- endswitch;
177
- }
178
- catch (\Exception $e)
179
- {
180
- trigger_error($e->getMessage(),E_USER_ERROR);
181
- }
182
- return $decimal;
183
- }
184
- /**
185
- * Convert an IP address from decimal format to presentation format
186
- *
187
- * @param $decimal
188
- * @param bool $compress
189
- * @return mixed|string
190
- */
191
- private function long2ip($decimal,$compress = true)
192
- {
193
- $Ip = null;
194
- if(preg_match('/[.:]/', $decimal))
195
- return strtoupper($decimal);
196
- switch ($decimal):
197
- case (strlen($decimal) <= 32):
198
- $Ip .= long2ip($decimal);
199
- break;
200
- default:
201
- $pad = 128 - strlen($decimal);
202
- for ($i = 1; $i <= $pad; $i++)
203
- $decimal = '0'.$decimal;
204
- for ($bits = 0; $bits <= 7; $bits++)
205
- {
206
- $binPart = substr($decimal,($bits*16),16);
207
- $Ip .= dechex(bindec($binPart)).':';
208
- }
209
- $Ip = inet_ntop(inet_pton(substr($Ip,0,-1)));
210
- break;
211
- endswitch;
212
- $Ip = strtoupper($Ip);
213
- return $compress? $Ip : $this->ExpandIPAddress($Ip);
214
- }
215
- /**
216
- * @param null $ip
217
- * @return bool
218
- */
219
- public function isReservedIP($ip=null)
220
- {
221
- if($ip) $this->resolve($ip);
222
- return !$this->IsoCode OR strcasecmp($this->IsoCode,'ZZ') == 0 ;
223
- }
224
- /**
225
- * @return $this
226
- */
227
- private function prepareLookup()
228
- {
229
- $totalRangeFiles = count(glob($this->DataLocation.'/*[0-9]*.php'));
230
- if($totalRangeFiles < 332)
231
- {
232
- $this->Admin()->updateDatabase();
233
- $this->EditModeEnabled = false;
234
- }
235
- return $this;
236
- }
237
- /**
238
- * @param null $ip
239
- * @return null|string
240
- */
241
- public function resolve($ip = null)
242
- {
243
- try
244
- {
245
- $ip OR $ip = $this->getRemoteIP();
246
- if(!preg_match('/[.:]/', $ip)) $ip = $this->long2ip($ip);
247
- $ip = $this->ExpandIPAddress($ip);
248
- if(!filter_var($ip,FILTER_VALIDATE_IP,[FILTER_FLAG_IPV4|FILTER_FLAG_IPV6]))
249
- throw new \Exception('Invalid IP given');
250
- $ipFilename = $this->getIPRangeProviderFile($ip);
251
- $ipLong = $this->ip2long($ip);
252
- $ipFilePath = realpath($this->DataLocation.self::DS.$ipFilename);
253
- if(!file_exists($ipFilePath))
254
- throw new \Exception('IP Ranges provider file not found');
255
- $IpRanges = include $ipFilePath;
256
- foreach($IpRanges as $Range):
257
- if(!is_array($Range) OR sizeof($Range) !== 3) continue;
258
- if(preg_match('/^[01]+$/', $ipLong))
259
- {
260
- $Range[0] = $this->ip2long($Range[0]);
261
- $Range[1] = $this->ip2long($Range[1]);
262
- }
263
- if($Range[1] < $ipLong) continue;
264
- if(($Range[0]<=$ipLong))
265
- {
266
- $this->IsoCode = $Range[2]?:'ZZ';
267
- break;
268
- }
269
- endforeach;
270
- }
271
- catch (\Exception $e)
272
- {
273
- trigger_error($e->getMessage());
274
- }
275
- return $this->IsoCode;
276
- }
277
-
278
- /**
279
- * Auto Get the current visitor IP Address
280
- * @return string
281
- */
282
- private function getRemoteIP()
283
- {
284
- $ip = null;
285
- $serverIPKeys =['HTTP_X_COMING_FROM', 'HTTP_FORWARDED', 'HTTP_FORWARDED_FOR', 'HTTP_X_CLUSTER_CLIENT_IP',
286
- 'HTTP_X_FORWARDED', 'HTTP_VIA', 'HTTP_CLIENT_IP','HTTP_X_FORWARDED_FOR','REMOTE_ADDR'];
287
- foreach ($serverIPKeys AS $IPKey):
288
- if(array_key_exists($IPKey,$_SERVER))
289
- {
290
- if (!strlen($_SERVER[$IPKey])) continue;
291
- $ip = $_SERVER[$IPKey];
292
- break;
293
- }
294
- endforeach;
295
- if (($CommaPos = strpos($ip, ',')) > 0)
296
- $ip = substr($ip, 0, ($CommaPos - 1));
297
- return $ip?:'0.0.0.0';
298
- }
299
- /**
300
- * @return $this
301
- */
302
- public function updateDatabase()
303
- {
304
- if($this->EditModeEnabled)
305
- {
306
- $this->DownloadPackage()->ExtractArchive();
307
- $ExtractedFileName = pathinfo($this->PackageName,PATHINFO_FILENAME);
308
- $ExtractedFiles = glob($this->PackageLocation.self::DS.$ExtractedFileName.'*.csv');
309
- if($ExtractedFiles)
310
- {
311
- set_time_limit(0); //prevent timeout
312
- foreach ($ExtractedFiles AS $ExtractedFile):
313
- $files = [];
314
- foreach (new SplFileObject($ExtractedFile) as $line)
315
- {
316
- if (substr($line, 0, 1) === '#') continue;
317
- $line = str_replace('"','',$line);
318
- $temp = explode(',', $line);
319
- if (count($temp)<4) continue;
320
- $filename = null;
321
- $ipMin = null;
322
- $ipMax = null;
323
- $Alpha2 = null;
324
- switch ($temp[0]):
325
- case (strpos($temp[0], '-') !== false):
326
- list($ipMin,$ipMax) = explode('-',$temp[0]);
327
- $Alpha2 = $temp[1];
328
- $filename = current(explode(':',$this->ExpandIPAddress($ipMin))).'.php';
329
- break;
330
- default:
331
- if (count($temp)<7) break;
332
- $ipMin = (int) $temp[0];
333
- $ipMax = (int) $temp[1];
334
- $Alpha2 = $temp[4];
335
- $filename = current(explode('.',$this->long2ip($ipMin))).'.php';
336
- break;
337
- endswitch;
338
- $dataFile = $this->PackageLocation.self::DS.$filename;
339
- $files[] = $filename;
340
- $fileContent = null;
341
- if(!file_exists($dataFile))
342
- {
343
- $fileContent .= '<?php'.PHP_EOL;
344
- $fileContent .= 'return ['.PHP_EOL;
345
- }
346
- $fileContent .= '[\''.$ipMin.'\', \''.$ipMax.'\', \''.$Alpha2.'\'],'.PHP_EOL;
347
- file_put_contents($dataFile, $fileContent,FILE_APPEND | LOCK_EX);
348
- }
349
- if($files):
350
- foreach ($files as $file)
351
- {
352
- $source = $this->PackageLocation.self::DS.$file;
353
- $destination = $this->DataLocation.self::DS.$file;
354
- if(!file_exists($source)) continue;
355
- $sourceContent = '];';
356
- file_put_contents($source, $sourceContent,FILE_APPEND | LOCK_EX);
357
- rename($source,$destination);
358
- @chmod($destination,0644);
359
- }
360
- endif;
361
- if(file_exists($ExtractedFile)) @unlink($ExtractedFile);
362
- endforeach;
363
- }
364
- $this->EditModeEnabled = false;
365
- }
366
- return $this;
367
- }
368
-
369
- /**
370
- * @param null $file
371
- * @return $this
372
- */
373
- private function ExtractArchive($file = null)
374
- {
375
- if($this->EditModeEnabled)
376
- {
377
- !$file OR $this->PackageName = pathinfo(realpath($file), PATHINFO_FILENAME);
378
- try{
379
- $Packages = array_filter(glob($this->PackageLocation.self::DS.$this->PackageName.'*.{gz,zip}',GLOB_BRACE), 'is_file');
380
- if($Packages)
381
- {
382
- $bufferSize = 4096;
383
- $Package = null;
384
- foreach($Packages AS $PackageFile):
385
- $PackageExt = pathinfo($PackageFile, PATHINFO_EXTENSION);
386
- if(!in_array(strtolower($PackageExt),['zip','gz'],true)) continue;
387
- $ExtractedFilename = pathinfo($PackageFile,PATHINFO_FILENAME).'.csv';
388
- $ExtractedFile = realpath($this->PackageLocation).self::DS.$ExtractedFilename;
389
- switch ($PackageExt):
390
- case (strcasecmp($PackageExt,'gz') == 0):
391
- $file = gzopen($PackageFile, 'rb');
392
- $Handler = fopen($ExtractedFile, 'wb');
393
- while (!gzeof($file))
394
- {
395
- fwrite($Handler, gzread($file, $bufferSize));
396
- }
397
- fclose($Handler);
398
- gzclose($file);
399
- break;
400
- case (strcasecmp($PackageExt,'zip') == 0):
401
- $zip = new ZipArchive;
402
- if ($zip->open($PackageFile) !== false)
403
- {
404
- for($i = 0; $i < $zip->numFiles; $i++)
405
- {
406
- $filename = $zip->getNameIndex($i);
407
- if(strcasecmp(pathinfo($filename,PATHINFO_EXTENSION),'csv') == 0)
408
- copy('zip://'.$PackageFile.'#'.$filename, $ExtractedFile);
409
- }
410
- $zip->close();
411
- }
412
- break;
413
- default:
414
- throw new \Exception('The Downloaded package must be a zip or gz file: "'.$PackageExt.'" file given');
415
- break;
416
- endswitch;
417
- if(file_exists($PackageFile)) @unlink($PackageFile);
418
- endforeach;
419
- }
420
- }
421
- catch (\Exception $e)
422
- {
423
- trigger_error($e->getMessage(),E_USER_ERROR);
424
- }
425
- }
426
- return $this;
427
- }
428
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/adsense.php CHANGED
@@ -1,254 +1,248 @@
1
- <?php
2
- /*Begin Scripts */
3
- add_action('admin_footer', 'quick_adsense_adstxt_adsense_admin_notice_admin_footer');
4
- function quick_adsense_adstxt_adsense_admin_notice_admin_footer() {
5
- echo '<script type="text/javascript">';
6
- echo "jQuery(document).ready(function() {";
7
- echo "jQuery('.quick_adsense_adstxt_adsense_notice').on('click', '.notice-dismiss', function() {";
8
- echo "jQuery.post(";
9
- echo "jQuery('#quick_adsense_adstxt_adsense_admin_notice_ajax').val(), {";
10
- echo "'action': 'quick_adsense_adstxt_adsense_admin_notice_dismiss',";
11
- echo "'quick_adsense_adstxt_adsense_admin_notice_nonce': jQuery('#quick_adsense_adstxt_adsense_admin_notice_nonce').val(),";
12
- echo "}, function(response) { }";
13
- echo ");";
14
- echo "});";
15
- echo "});";
16
- echo '</script>';
17
- }
18
- /*End Scripts */
19
-
20
- /* Begin Admin Notice */
21
- add_action('init', 'quick_adsense_adstxt_adsense_admin_notice_reactivate');
22
- function quick_adsense_adstxt_adsense_admin_notice_reactivate() {
23
- if(isset($_GET['quick_adsense_adstxt_adsense_reset'])) {
24
- delete_option('quick_adsense_adstxt_adsense_admin_notice_dismissed');
25
- delete_transient('quick_adsense_adstxt_adsense_autocheck_content');
26
- wp_redirect(esc_url(admin_url('/admin.php?page=quick-adsense')));
27
- }
28
- }
29
-
30
- add_action('admin_notices', 'quick_adsense_adstxt_adsense_admin_notice');
31
- function quick_adsense_adstxt_adsense_admin_notice($isAjax = false) {
32
- if(current_user_can('manage_options')) {
33
- if(!get_option('quick_adsense_adstxt_adsense_admin_notice_dismissed')) {
34
- $adstxtNewAdsenseEntries = get_transient('quick_adsense_adstxt_adsense_autocheck_content');
35
- if($adstxtNewAdsenseEntries == '###CHECKED###') {
36
- } else {
37
- if(!isset($adstxtNewAdsenseEntries) || ($adstxtNewAdsenseEntries === false)) {
38
- $adstxtNewAdsenseEntries = quick_adsense_adstxt_adsense_get_status();
39
- }
40
- if($adstxtNewAdsenseEntries !== false) {
41
- set_transient('quick_adsense_adstxt_adsense_autocheck_content', $adstxtNewAdsenseEntries, DAY_IN_SECONDS);
42
- echo '<div class="notice notice-error quick_adsense_adstxt_adsense_notice is-dismissible" style="padding: 15px;">';
43
- echo '<p><b>Quick Adsense</b> had detected that your ads.txt file does not have all your Google Adsense Publisher IDs.<br />This will severely impact your adsense earnings and your immediate attention is required.</p>';
44
- echo '<p>Your recommended google entries for ads.txt is as given below.<br />You can manually copy this to your ads.txt file or ';
45
- $screen = get_current_screen();
46
- if(!$isAjax && $screen->id != 'toplevel_page_quick-adsense') {
47
- echo '<a href="'.esc_url(admin_url('/admin.php?page=quick-adsense#quick_adsense_adstxt_adsense_auto_update')).'">CLICK HERE</a>';
48
- } else {
49
- echo '<a href="javascript:;" onclick="quick_adsense_adstxt_adsense_auto_update()">CLICK HERE</a>';
50
- }
51
- echo ' to instruct Quick Adsense to try and add the entries automatically.</p>';
52
- echo '<p><code style="display: block; padding: 2px 10px;">'.implode("<br />", $adstxtNewAdsenseEntries).'</code></p>';
53
- echo '<p><small><i><b>We recommend you not to dismiss this notice for continued daily ads.txt monitoring. This notice will stop appearing automatically once Quick Adsense detects correct entries in ads.txt (rechecked daily).</b></i></small></p>';
54
- echo '<div class="clear"></div>';
55
- echo '<input type="hidden" id="quick_adsense_adstxt_adsense_admin_notice_nonce" name="quick_adsense_adstxt_adsense_admin_notice_nonce" value="'.wp_create_nonce('quick-adsense-adstxt-adsense-admin-notice').'" />';
56
- echo '<input type="hidden" id="quick_adsense_adstxt_adsense_admin_notice_ajax" name="quick_adsense_adstxt_adsense_admin_notice_ajax" value="'.admin_url('admin-ajax.php').'" />';
57
- if($isAjax) {
58
- echo '<button type="button" class="notice-dismiss" onclick="javascript:jQuery(this).parent().remove()"><span class="screen-reader-text">Dismiss this notice.</span></button>';
59
- }
60
- echo '</div>';
61
- } else {
62
- set_transient('quick_adsense_adstxt_adsense_autocheck_content', '###CHECKED###', DAY_IN_SECONDS);
63
- }
64
- }
65
- }
66
- }
67
- }
68
-
69
- add_action('wp_ajax_quick_adsense_adstxt_adsense_admin_notice_check', 'quick_adsense_adstxt_adsense_admin_notice_check');
70
- function quick_adsense_adstxt_adsense_admin_notice_check() {
71
- check_ajax_referer('quick-adsense', 'quick_adsense_nonce');
72
- delete_transient('quick_adsense_adstxt_adsense_autocheck_content');
73
- $adminNotice = quick_adsense_adstxt_adsense_admin_notice(true);
74
- if(isset($adminNotice) && ($adminNotice != '')) {
75
- echo '###SUCCESS###';
76
- echo $adminNotice;
77
- }
78
- die();
79
- }
80
-
81
- add_action('wp_ajax_quick_adsense_adstxt_adsense_admin_notice_dismiss', 'quick_adsense_adstxt_adsense_admin_notice_dismiss');
82
- function quick_adsense_adstxt_adsense_admin_notice_dismiss() {
83
- check_ajax_referer('quick-adsense-adstxt-adsense-admin-notice', 'quick_adsense_adstxt_adsense_admin_notice_nonce');
84
- update_option('quick_adsense_adstxt_adsense_admin_notice_dismissed', 'true');
85
- die();
86
- }
87
- /* End Admin Notice */
88
-
89
- /* Begin Auto Update Ads.txt (Adsense) */
90
- add_action('wp_ajax_quick_adsense_adstxt_adsense_auto_update', 'quick_adsense_adstxt_adsense_auto_update');
91
- function quick_adsense_adstxt_adsense_auto_update() {
92
- check_ajax_referer('quick-adsense-adstxt-adsense-admin-notice', 'quick_adsense_adstxt_adsense_admin_notice_nonce');
93
- $adstxtNewAdsenseEntries = quick_adsense_adstxt_adsense_get_status();
94
- if($adstxtNewAdsenseEntries !== false) {
95
- $adstxtContent = quick_adsense_adstxt_get_content();
96
- $adstxtContentData = array_filter(explode("\n", trim($adstxtContent)), 'trim');
97
- $adstxtUpdatedContent = array_filter(array_merge($adstxtContentData, $adstxtNewAdsenseEntries), 'trim');
98
- }
99
-
100
- if(isset($adstxtUpdatedContent) && is_array($adstxtUpdatedContent) && (count($adstxtUpdatedContent) > 0)) {
101
- $adstxtUpdatedContent = implode("\n", $adstxtUpdatedContent);
102
- if(quick_adsense_adstxt_update_content($adstxtUpdatedContent)) {
103
- echo '###SUCCESS###';
104
- } else {
105
- echo quick_adsense_adstxt_updation_failed_message($adstxtUpdatedContent);
106
- }
107
- }
108
- die();
109
- }
110
- /* End Auto Update Ads.txt (Adsense) */
111
-
112
- /* Begin ads.txt Adsense Check */
113
- function quick_adsense_adstxt_adsense_get_status() {
114
- if(quick_adsense_adstxt_file_exists()) {
115
- $adsensePublisherIds = quick_adsense_adstxt_adsense_get_publisherids();
116
- $adstxtContent = quick_adsense_adstxt_get_content();
117
- $adstxtContentData = array_filter(explode("\n", trim($adstxtContent)), 'trim');
118
- $adstxtExistingAdsenseEntries = array();
119
- foreach($adstxtContentData as $line) {
120
- if(strpos($line, 'google.com') !== false) {
121
- $adstxtExistingAdsenseEntries[] = $line;
122
- }
123
- }
124
-
125
- $adstxtNewAdsenseEntries = array();
126
- if(count($adstxtExistingAdsenseEntries) == 0) {
127
- if(is_array($adsensePublisherIds) && (count($adsensePublisherIds) > 0)) {
128
- foreach($adsensePublisherIds as $adsensePublisherId) {
129
- $adstxtNewAdsenseEntries[] = 'google.com, '.$adsensePublisherId.', DIRECT, f08c47fec0942fa0';
130
- }
131
- }
132
- } else {
133
- if(is_array($adsensePublisherIds) && (count($adsensePublisherIds) > 0)) {
134
- foreach($adsensePublisherIds as $adsensePublisherId) {
135
- $entryExists = false;
136
- foreach($adstxtExistingAdsenseEntries as $adstxtExistingAdsenseEntry) {
137
- if(strpos($adstxtExistingAdsenseEntry, $adsensePublisherId) !== false) {
138
- $entryExists = true;
139
- }
140
- }
141
- if($entryExists == false) {
142
- $adstxtNewAdsenseEntries[] = 'google.com, '.$adsensePublisherId.', DIRECT, f08c47fec0942fa0';
143
- }
144
- }
145
- }
146
- }
147
- }
148
- if(isset($adstxtNewAdsenseEntries) && count($adstxtNewAdsenseEntries) > 0) {
149
- return $adstxtNewAdsenseEntries;
150
- }
151
- return false;
152
- }
153
- /* End ads.txt Adsense Check */
154
-
155
- /* Begin Extract Publisher Ids from Ads */
156
- function quick_adsense_adstxt_adsense_get_publisherids() {
157
- $adsensePublisherIds = array();
158
-
159
- $settings = get_option('quick_adsense_settings');
160
- if(isset($settings) && is_array($settings)) {
161
- for($i = 1; $i <= 10; $i++) {
162
- if(isset($settings['onpost_ad_'.$i.'_content']) && ($settings['onpost_ad_'.$i.'_content'] != '')) {
163
- $temp = quick_adsense_adstxt_adsense_extract_publisherids($settings['onpost_ad_'.$i.'_content']);
164
- if($temp !== false) {
165
- $adsensePublisherIds = array_merge($adsensePublisherIds, $temp);
166
- }
167
- }
168
-
169
- if(isset($settings['widget_ad_'.$i.'_content']) && ($settings['widget_ad_'.$i.'_content'] != '')) {
170
- $temp = quick_adsense_adstxt_adsense_extract_publisherids($settings['widget_ad_'.$i.'_content']);
171
- if($temp !== false) {
172
- $adsensePublisherIds = array_merge($adsensePublisherIds, $temp);
173
- }
174
- }
175
- }
176
- }
177
-
178
- $adsensePublisherIds = array_unique($adsensePublisherIds);
179
-
180
- if(count($adsensePublisherIds) > 0) {
181
- return $adsensePublisherIds;
182
- }
183
- return false;
184
- }
185
-
186
- function quick_adsense_adstxt_adsense_extract_publisherids($adCode) {
187
- $publisherIds = array();
188
- if(isset($adCode) && ($adCode != '')) {
189
- if(preg_match('/googlesyndication.com/', $adCode)) {
190
- if(preg_match('/data-ad-client=/', $adCode)) { //ASYNS AD CODE
191
- $adCodeParts = explode('data-ad-client', $adCode);
192
- } else {
193
- $adCodeParts = explode('google_ad_client', $adCode); //ORDINARY AD CODE
194
- }
195
- if(isset($adCodeParts[1]) && ($adCodeParts[1] != '')) {
196
- preg_match('#"([a-zA-Z0-9-\s]+)"#', stripslashes($adCodeParts[1]), $matches);
197
- if(isset($matches[1]) && ($matches[1] != '')) {
198
- $publisherIds[] = str_replace(array('"', ' ', 'ca-'), array(''), $matches[1]);
199
- }
200
- }
201
- }
202
- }
203
-
204
- if(count($publisherIds) > 0) {
205
- return $publisherIds;
206
- }
207
- return false;
208
- }
209
- /* End Extract Publisher Ids from Ads */
210
-
211
- /* Begin Common Functions */
212
- function quick_adsense_adstxt_file_exists() {
213
- if(file_exists(trailingslashit(get_home_path()).'ads.txt')) {
214
- return true;
215
- }
216
- return false;
217
- }
218
-
219
- function quick_adsense_adstxt_get_content() {
220
- if(quick_adsense_adstxt_file_exists()) {
221
- return @file_get_contents(trailingslashit(get_home_path()).'ads.txt');
222
- }
223
- return '';
224
- }
225
-
226
- function quick_adsense_adstxt_update_content($content) {
227
- delete_transient('quick_adsense_adstxt_adsense_autocheck_content');
228
- if(get_filesystem_method() === 'direct') {
229
- $creds = request_filesystem_credentials(site_url().'/wp-admin/', '', false, false, array());
230
- if(!WP_Filesystem($creds)) {
231
- return false;
232
- }
233
- global $wp_filesystem;
234
- if(!$wp_filesystem->put_contents(trailingslashit(get_home_path()).'ads.txt', $content, FS_CHMOD_FILE)) {
235
- return false;
236
- }
237
- } else {
238
- return false;
239
- }
240
- return true;
241
- }
242
-
243
- function quick_adsense_adstxt_updation_failed_message($content) {
244
- $output = '<div class="quick_adsense_popup_content_wrapper">';
245
- $output .= '<p>Auto Creation / Updation of ads.txt failed due to access permission restrictions on the server.</p>';
246
- $output .= '<p>You have to manually upload the file using your Host\'s File manager or your favourite FTP program</p>';
247
- $output .= '<p>ads.txt should be located in the root of your server. After manually uploading the file click <a href="'.site_url().'/ads.txt">here</a> to check if its accessible from the correct location</p>';
248
- $output .= '<textarea style="display: none;" id="quick_adsense_adstxt_content">'.$content.'</textarea>';
249
- $output .= '<p><a onclick="quick_adsense_adstxt_content_download()" class="button button-primary" href="javascript:;">Download ads.txt</a></p>';
250
- $output .= '</div>';
251
- return $output;
252
- }
253
- /* End Common Functions */
254
- ?>
1
+ <?php
2
+ /**
3
+ * Adsense specific features.
4
+ */
5
+
6
+ /**
7
+ * Add inline script to hide the notice on clicking dismiss button.
8
+ */
9
+ add_action(
10
+ 'admin_enqueue_scripts',
11
+ function() {
12
+ wp_localize_script(
13
+ 'jquery',
14
+ 'quick_adsense_adstxt_adsense',
15
+ [
16
+ 'ajax_url' => admin_url( 'admin-ajax.php' ),
17
+ 'nonce' => wp_create_nonce( 'quick-adsense-adstxt-adsense-nonce' ),
18
+ ]
19
+ );
20
+ wp_add_inline_script(
21
+ 'jquery',
22
+ quick_adsense_load_file( 'templates/js/script-admin-notice.php' )
23
+ );
24
+ }
25
+ );
26
+
27
+ /**
28
+ * This function checks for and displays the admin notice when needed.
29
+ *
30
+ * @param boolean $is_ajax Specific where the function is being called during an ajax call.
31
+ */
32
+ function quick_adsense_adstxt_adsense_admin_notice( $is_ajax = false ) {
33
+ if ( current_user_can( 'manage_options' ) ) {
34
+ if ( ! get_option( 'quick_adsense_adstxt_adsense_admin_notice_dismissed' ) ) {
35
+ $adstxt_new_adsense_entries = get_transient( 'quick_adsense_adstxt_adsense_autocheck_content' );
36
+ if ( 'CHECKED' !== $adstxt_new_adsense_entries ) {
37
+ if ( ! isset( $adstxt_new_adsense_entries ) || ( false === $adstxt_new_adsense_entries ) ) {
38
+ $adstxt_new_adsense_entries = quick_adsense_adstxt_adsense_get_status();
39
+ }
40
+ if ( false !== $adstxt_new_adsense_entries ) {
41
+ set_transient( 'quick_adsense_adstxt_adsense_autocheck_content', $adstxt_new_adsense_entries, DAY_IN_SECONDS );
42
+ $screen = get_current_screen();
43
+ echo wp_kses(
44
+ quick_adsense_load_file(
45
+ 'templates/block-adsense-adstxt-notice.php',
46
+ [
47
+ 'screen_id' => $screen->id,
48
+ 'is_ajax' => $is_ajax,
49
+ 'adstxt_new_adsense_entries' => implode( '<br />', $adstxt_new_adsense_entries ),
50
+ ]
51
+ ),
52
+ quick_adsense_get_allowed_html()
53
+ );
54
+ } else {
55
+ set_transient( 'quick_adsense_adstxt_adsense_autocheck_content', 'CHECKED', DAY_IN_SECONDS );
56
+ }
57
+ }
58
+ }
59
+ }
60
+ }
61
+ add_action( 'admin_notices', 'quick_adsense_adstxt_adsense_admin_notice' );
62
+
63
+ /**
64
+ * This function checks whether new entries need to be added to ads.txt based on the adcodes added.
65
+ *
66
+ * @return mixed False is no changes are needed, New ads.txt lines as an array if changes are required.
67
+ */
68
+ function quick_adsense_adstxt_adsense_get_status() {
69
+ $file_handler = new QuickAdsense\FileHandler( 'ads.txt' );
70
+ if ( $file_handler->exists() ) {
71
+ $adsense_publisher_ids = quick_adsense_adstxt_adsense_get_publisherids();
72
+ $adstxt_content = $file_handler->read();
73
+ if ( false !== $adstxt_content ) {
74
+ $adstxt_content_data = array_filter( explode( "\n", trim( $adstxt_content ) ), 'trim' );
75
+ if ( is_array( $adstxt_content_data ) ) {
76
+ $adstxt_existing_adsense_entries = [];
77
+ foreach ( $adstxt_content_data as $line ) {
78
+ if ( strpos( $line, 'google.com' ) !== false ) {
79
+ $adstxt_existing_adsense_entries[] = $line;
80
+ }
81
+ }
82
+
83
+ $adstxt_new_adsense_entries = [];
84
+ if ( count( $adstxt_existing_adsense_entries ) === 0 ) {
85
+ if ( is_array( $adsense_publisher_ids ) && ( count( $adsense_publisher_ids ) > 0 ) ) {
86
+ foreach ( $adsense_publisher_ids as $adsense_publisher_id ) {
87
+ $adstxt_new_adsense_entries[] = 'google.com, ' . $adsense_publisher_id . ', DIRECT, f08c47fec0942fa0';
88
+ }
89
+ }
90
+ } else {
91
+ if ( is_array( $adsense_publisher_ids ) && ( count( $adsense_publisher_ids ) > 0 ) ) {
92
+ foreach ( $adsense_publisher_ids as $adsense_publisher_id ) {
93
+ $entry_exists = false;
94
+ foreach ( $adstxt_existing_adsense_entries as $adstxt_existing_adsense_entry ) {
95
+ if ( strpos( $adstxt_existing_adsense_entry, $adsense_publisher_id ) !== false ) {
96
+ $entry_exists = true;
97
+ }
98
+ }
99
+ if ( false === $entry_exists ) {
100
+ $adstxt_new_adsense_entries[] = 'google.com, ' . $adsense_publisher_id . ', DIRECT, f08c47fec0942fa0';
101
+ }
102
+ }
103
+ }
104
+ }
105
+ }
106
+ }
107
+ }
108
+ if ( isset( $adstxt_new_adsense_entries ) && count( $adstxt_new_adsense_entries ) > 0 ) {
109
+ return $adstxt_new_adsense_entries;
110
+ }
111
+ return false;
112
+ }
113
+
114
+ /**
115
+ * Function to extract publisher Ids from settings.
116
+ *
117
+ * @return mixed False if no publisher ids found, Array of publisher ids if publisher ids found.
118
+ */
119
+ function quick_adsense_adstxt_adsense_get_publisherids() {
120
+ $adsense_publisher_ids = [];
121
+
122
+ $settings = get_option( 'quick_adsense_settings' );
123
+ if ( isset( $settings ) && is_array( $settings ) ) {
124
+ for ( $i = 1; $i <= 10; $i++ ) {
125
+ if ( isset( $settings[ 'onpost_ad_' . $i . '_content' ] ) && ( '' !== $settings[ 'onpost_ad_' . $i . '_content' ] ) ) {
126
+ $temp = quick_adsense_adstxt_adsense_extract_publisherids( $settings[ 'onpost_ad_' . $i . '_content' ] );
127
+ if ( false !== $temp ) {
128
+ $adsense_publisher_ids = array_merge( $adsense_publisher_ids, $temp );
129
+ }
130
+ }
131
+
132
+ if ( isset( $settings[ 'widget_ad_' . $i . '_content' ] ) && ( '' !== $settings[ 'widget_ad_' . $i . '_content' ] ) ) {
133
+ $temp = quick_adsense_adstxt_adsense_extract_publisherids( $settings[ 'widget_ad_' . $i . '_content' ] );
134
+ if ( false !== $temp ) {
135
+ $adsense_publisher_ids = array_merge( $adsense_publisher_ids, $temp );
136
+ }
137
+ }
138
+
139
+ if ( isset( $settings['header_embed_code'] ) && ( '' !== $settings['header_embed_code'] ) ) {
140
+ $temp = quick_adsense_adstxt_adsense_extract_publisherids( $settings['header_embed_code'] );
141
+ if ( false !== $temp ) {
142
+ $adsense_publisher_ids = array_merge( $adsense_publisher_ids, $temp );
143
+ }
144
+ }
145
+
146
+ if ( isset( $settings['footer_embed_code'] ) && ( '' !== $settings['footer_embed_code'] ) ) {
147
+ $temp = quick_adsense_adstxt_adsense_extract_publisherids( $settings['footer_embed_code'] );
148
+ if ( false !== $temp ) {
149
+ $adsense_publisher_ids = array_merge( $adsense_publisher_ids, $temp );
150
+ }
151
+ }
152
+ }
153
+ }
154
+ $adsense_publisher_ids = array_unique( $adsense_publisher_ids );
155
+
156
+ if ( count( $adsense_publisher_ids ) > 0 ) {
157
+ return $adsense_publisher_ids;
158
+ }
159
+ return false;
160
+ }
161
+
162
+ /**
163
+ * Function to extract publisher Ids from provided adcode.
164
+ *
165
+ * @param string $ad_code The ad code.
166
+ *
167
+ * @return mixed False if no publisher ids found, Array of publisher ids if publisher ids found.
168
+ */
169
+ function quick_adsense_adstxt_adsense_extract_publisherids( $ad_code ) {
170
+ $publisher_ids = [];
171
+ if ( isset( $ad_code ) && ( '' !== $ad_code ) ) {
172
+ if ( preg_match( '/googlesyndication.com/', $ad_code ) ) {
173
+ if ( preg_match( '/data-ad-client=/', $ad_code ) ) {
174
+ // ASYNC AD CODE.
175
+ $ad_code_parts = explode( 'data-ad-client', $ad_code );
176
+ } elseif ( preg_match( '/client=ca-pub-/', $ad_code ) ) {
177
+ // NEW ASYNC AD CODE.
178
+ $ad_code_parts = explode( 'ca-pub-', str_replace( 'ca-pub-', 'ca-pub-"', $ad_code ) );
179
+ } else {
180
+ // ORDINARY AD CODE.
181
+ $ad_code_parts = explode( 'google_ad_client', $ad_code );
182
+ }
183
+ if ( isset( $ad_code_parts[1] ) && ( '' !== $ad_code_parts[1] ) ) {
184
+ preg_match( '#"([a-zA-Z0-9-\s]+)"#', stripslashes( $ad_code_parts[1] ), $matches );
185
+ if ( isset( $matches[1] ) && ( '' !== $matches[1] ) ) {
186
+ $publisher_ids[] = str_replace( [ '"', ' ', 'ca-' ], [ '' ], $matches[1] );
187
+ }
188
+ }
189
+ }
190
+ }
191
+
192
+ if ( count( $publisher_ids ) > 0 ) {
193
+ return $publisher_ids;
194
+ }
195
+ return false;
196
+ }
197
+
198
+ /**
199
+ * This action dismisses the Ads.txt admin notice permanently.
200
+ */
201
+ add_action(
202
+ 'wp_ajax_quick_adsense_adstxt_adsense_admin_notice_dismiss',
203
+ function() {
204
+ if ( isset( $_POST['nonce'] ) && wp_verify_nonce( sanitize_key( $_POST['nonce'] ), 'quick-adsense-adstxt-adsense-nonce' ) ) {
205
+ update_option( 'quick_adsense_adstxt_adsense_admin_notice_dismissed', 'true' );
206
+ wp_send_json_success();
207
+ }
208
+ wp_send_json_error();
209
+ }
210
+ );
211
+
212
+ /**
213
+ * This action handles the Ajax trigerred Ads.txt update.
214
+ */
215
+ add_action(
216
+ 'wp_ajax_quick_adsense_adstxt_adsense_auto_update',
217
+ function() {
218
+ if ( isset( $_POST['nonce'] ) && wp_verify_nonce( sanitize_key( $_POST['nonce'] ), 'quick-adsense-adstxt-adsense-nonce' ) ) {
219
+ $adstxt_new_adsense_entries = quick_adsense_adstxt_adsense_get_status();
220
+ $file_handler = new QuickAdsense\FileHandler( 'ads.txt' );
221
+ if ( false !== $adstxt_new_adsense_entries ) {
222
+ $adstxt_content = $file_handler->read();
223
+ $adstxt_content_data = array_filter( explode( "\n", trim( $adstxt_content ) ), 'trim' );
224
+ $adstxt_updated_content = array_filter( array_merge( $adstxt_content_data, $adstxt_new_adsense_entries ), 'trim' );
225
+ }
226
+ if ( isset( $adstxt_updated_content ) && is_array( $adstxt_updated_content ) && ( count( $adstxt_updated_content ) > 0 ) ) {
227
+ $adstxt_updated_content = implode( "\n", $adstxt_updated_content );
228
+ if ( $file_handler->write( $adstxt_updated_content ) ) {
229
+ wp_send_json_success();
230
+ } else {
231
+ wp_send_json_error(
232
+ wp_kses(
233
+ quick_adsense_load_file(
234
+ 'templates/block-adsense-adstxt-update-failed.php',
235
+ [
236
+ 'content' => $adstxt_updated_content,
237
+ ]
238
+ ),
239
+ quick_adsense_get_allowed_html()
240
+ )
241
+ );
242
+ }
243
+ }
244
+ }
245
+ wp_send_json_error();
246
+ }
247
+ );
248
+
 
 
 
 
 
 
includes/class-filehandler.php ADDED
@@ -0,0 +1,137 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace QuickAdsense;
3
+
4
+ /**
5
+ * FileHandler acts as a wrapper for the WordPress Filesystem API
6
+ */
7
+ class FileHandler {
8
+ /**
9
+ * The full path to the file.
10
+ *
11
+ * @var array $file_path
12
+ */
13
+ private $file_path = '';
14
+
15
+ /**
16
+ * The content to be sent to the file.
17
+ *
18
+ * @var array $file_content
19
+ */
20
+ private $file_content = '';
21
+
22
+ /**
23
+ * Access credentials for the file.
24
+ *
25
+ * @var array $file_credentials
26
+ */
27
+ private $file_credentials = false;
28
+
29
+ /**
30
+ * Holds an instance of the builtin WordPress global $wp_filesystem.
31
+ *
32
+ * @var object $wp_filesystem
33
+ */
34
+ private $wp_filesystem = null;
35
+
36
+ /**
37
+ * Initialize the class
38
+ *
39
+ * @param string $file_path Complete path to the file to be loaded relative to the site root.
40
+ * @param string $file_content Content to write into the file.
41
+ */
42
+ public function __construct( $file_path = '', $file_content = '' ) {
43
+ global $wp_filesystem;
44
+ $this->file_content = $file_content;
45
+ $this->file_credentials = false;
46
+ if ( get_filesystem_method() === 'direct' ) {
47
+ $this->file_credentials = request_filesystem_credentials( '', '', false, false, [] );
48
+ if ( WP_Filesystem( $this->file_credentials ) ) {
49
+ $this->file_path = $wp_filesystem->abspath() . $file_path;
50
+ $this->wp_filesystem = $wp_filesystem;
51
+ }
52
+ }
53
+ }
54
+
55
+ /**
56
+ * Check if a file exist.
57
+ *
58
+ * @param string $file_path Complete path to the file to be loaded relative to the site root.
59
+ *
60
+ * @return boolean true on success, false on faliure.
61
+ */
62
+ public function exists( $file_path = '' ) {
63
+ if ( isset( $this->wp_filesystem ) ) {
64
+ if ( '' === $file_path ) {
65
+ $file_path = $this->file_path;
66
+ } else {
67
+ $file_path = $this->wp_filesystem->abspath() . $file_path;
68
+ }
69
+ if ( file_exists( $file_path ) ) {
70
+ return true;
71
+ }
72
+ }
73
+ return false;
74
+ }
75
+
76
+ /**
77
+ * Read a file.
78
+ *
79
+ * @param string $file_path Complete path to the file to be loaded relative to the site root.
80
+ *
81
+ * @return mixed The content of the file on success, false on faliure.
82
+ */
83
+ public function read( $file_path = '' ) {
84
+ if ( isset( $this->wp_filesystem ) ) {
85
+ if ( '' === $file_path ) {
86
+ $file_path = $this->file_path;
87
+ } else {
88
+ $file_path = $this->wp_filesystem->abspath() . $file_path;
89
+ }
90
+ return $this->wp_filesystem->get_contents( $file_path );
91
+ }
92
+ return false;
93
+ }
94
+
95
+ /**
96
+ * Create and write content to a file.
97
+ *
98
+ * @param string $file_content Content to write into the file.
99
+ * @param string $file_path Complete path to the file to be loaded relative to the site root.
100
+ *
101
+ * @return boolean true on success, false on faliure
102
+ */
103
+ public function write( $file_content = '', $file_path = '' ) {
104
+ if ( isset( $this->wp_filesystem ) ) {
105
+ if ( '' === $file_path ) {
106
+ $file_path = $this->file_path;
107
+ } else {
108
+ $file_path = $this->wp_filesystem->abspath() . $file_path;
109
+ }
110
+ if ( '' === $file_content ) {
111
+ $file_content = $this->file_content;
112
+ }
113
+ return $this->wp_filesystem->put_contents( $file_path, $file_content, FS_CHMOD_FILE );
114
+ }
115
+ return false;
116
+ }
117
+
118
+ /**
119
+ * Delete a file
120
+ *
121
+ * @param string $file_path Complete path to the file to be loaded relative to the site root.
122
+ *
123
+ * @return boolean true on success, false on faliure.
124
+ */
125
+ public function delete( $file_path = '' ) {
126
+ if ( isset( $this->wp_filesystem ) ) {
127
+ if ( '' === $file_path ) {
128
+ $file_path = $this->file_path;
129
+ } else {
130
+ $file_path = $this->wp_filesystem->abspath() . $file_path;
131
+ }
132
+ return $this->wp_filesystem->delete( $file_path, false, 'f' );
133
+ }
134
+ return false;
135
+ }
136
+ }
137
+
includes/content.php CHANGED
@@ -1,600 +1,691 @@
1
- <?php
2
- $quickAdsenseAdsDisplayed = 0;
3
- $quickAdsenseAdsId = array();
4
- $quickAdsenseBeginEnd = 0;
5
-
6
- add_action('wp_head', 'quick_adsense_embed_wp_head');
7
- function quick_adsense_embed_wp_head() {
8
- $settings = get_option('quick_adsense_settings');
9
- if(isset($settings['header_embed_code']) && ($settings['header_embed_code'] != '')) {
10
- echo $settings['header_embed_code'];
11
- }
12
- }
13
-
14
- add_action('wp_footer', 'quick_adsense_embed_wp_footer');
15
- function quick_adsense_embed_wp_footer() {
16
- $settings = get_option('quick_adsense_settings');
17
- if(isset($settings['footer_embed_code']) && ($settings['footer_embed_code'] != '')) {
18
- echo $settings['footer_embed_code'];
19
- }
20
- }
21
-
22
- add_filter('the_content', 'quick_adsense_the_content');
23
- function quick_adsense_the_content($content) {
24
- global $quickAdsenseAdsDisplayed;
25
- global $quickAdsenseAdsId;
26
- global $quickAdsenseBeginEnd;
27
- $settings = get_option('quick_adsense_settings');
28
-
29
- if(!quick_adsense_postads_isactive($settings, $content)) {
30
- $content = quick_adsense_content_clean_tags($content);
31
- return $content;
32
- }
33
-
34
- /* Begin Enforce Max Ads Per Page Rule */
35
- $quickAdsenseAdsToDisplay = $settings['max_ads_per_page'];
36
- if (strpos($content, '<!--OffWidget-->') === false) {
37
- for($i = 1; $i <= 10; $i++) {
38
- $widgetID = sanitize_title(str_replace(array('(', ')'), '', sprintf('AdsWidget%d (Quick Adsense)', $i)));
39
- $quickAdsenseAdsToDisplay -= (is_active_widget(true, $widgetID))?1:0;
40
- }
41
- }
42
- if($quickAdsenseAdsDisplayed >= $quickAdsenseAdsToDisplay) {
43
- $content = quick_adsense_content_clean_tags($content);
44
- return $content;
45
- };
46
- /* End Enforce Max Ads Per Page Rule */
47
-
48
- /* Begin Check for Available Ad Blocks */
49
- if(!count($quickAdsenseAdsId)) {
50
- for($i = 1; $i <= 10; $i++) {
51
- if(isset($settings['onpost_ad_'.$i.'_content']) && !empty($settings['onpost_ad_'.$i.'_content'])) {
52
- if(quick_adsense_advanced_postads_isactive($settings, $i)) {
53
- array_push($quickAdsenseAdsId, $i);
54
- }
55
- }
56
- }
57
- }
58
- array_push($quickAdsenseAdsId, 100);
59
-
60
- if(!count($quickAdsenseAdsId) ) {
61
- $content = quick_adsense_content_clean_tags($content);
62
- return $content;
63
- };
64
- /* End Check for Available Ad Blocks */
65
-
66
- /* Begin Insert StandIns for all Ad Blocks */
67
- $content = str_replace('<p></p>', '##QA-TP1##', $content);
68
- $content = str_replace('<p>&nbsp;</p>', '##QA-TP2##', $content);
69
- $offdef = (strpos($content, '<!--OffDef-->') !== false);
70
- if(!$offdef) {
71
- $quickAdsenseAdsIdCus = array();
72
- $cusads = 'CusAds';
73
- $cusrnd = 'CusRnd';
74
-
75
- $quickAdsenseEnablePositionAfterMoreTag = ((isset($settings['enable_position_after_more_tag']))?$settings['enable_position_after_more_tag']:'');
76
- $quickAdsenseAdAfterMoreTag = ((isset($settings['ad_after_more_tag']))?$settings['ad_after_more_tag']:'');
77
-
78
- $quickAdsenseEnablePositionBeforeLastPara = ((isset($settings['enable_position_before_last_para']))?$settings['enable_position_before_last_para']:'');
79
- $quickAdsenseAdBeforeLastPara = ((isset($settings['ad_before_last_para']))?$settings['ad_before_last_para']:'');
80
-
81
- $quickAdsenseEnablePositionBeginningOfPost = ((isset($settings['enable_position_beginning_of_post']))?$settings['enable_position_beginning_of_post']:'');
82
- $quickAdsenseAdBeginningOfPost = ((isset($settings['ad_beginning_of_post']))?$settings['ad_beginning_of_post']:'');
83
-
84
- $quickAdsenseEnablePositionMiddleOfPost = ((isset($settings['enable_position_middle_of_post']))?$settings['enable_position_middle_of_post']:'');
85
- $quickAdsenseAdMiddleOfPost = ((isset($settings['ad_middle_of_post']))?$settings['ad_middle_of_post']:'');
86
-
87
- $quickAdsenseEnablePositionEndOfPost = ((isset($settings['enable_position_end_of_post']))?$settings['enable_position_end_of_post']:'');
88
- $quickAdsenseAdEndOfPost = ((isset($settings['ad_end_of_post']))?$settings['ad_end_of_post']:'');
89
-
90
- for($i = 1; $i <= 3; $i++) {
91
- $quickAdsenseEnablePositionAfterPara[$i] = ((isset($settings['enable_position_after_para_option_'.$i]))?$settings['enable_position_after_para_option_'.$i]:'');
92
- $quickAdsenseAdAfterPara[$i] = ((isset($settings['ad_after_para_option_'.$i]))?$settings['ad_after_para_option_'.$i]:'');
93
- $quickAdsensePositionAfterPara[$i] = ((isset($settings['position_after_para_option_'.$i]))?$settings['position_after_para_option_'.$i]:'');
94
- $quickAdsenseEnableJumpPositionAfterPara[$i] = ((isset($settings['enable_jump_position_after_para_option_'.$i]))?$settings['enable_jump_position_after_para_option_'.$i]:'');
95
- }
96
-
97
- for($i = 1; $i <= 1; $i++) {
98
- $quickAdsenseEnablePositionAfterImage = ((isset($settings['enable_position_after_image_option_'.$i]))?$settings['enable_position_after_image_option_'.$i]:'');
99
- $quickAdsenseAdAfterImage = ((isset($settings['ad_after_image_option_'.$i]))?$settings['ad_after_image_option_'.$i]:'');
100
- $quickAdsensePositionAfterImage = ((isset($settings['position_after_image_option_'.$i]))?$settings['position_after_image_option_'.$i]:'');
101
- $quickAdsenseEnableJumpPositionAfterImage = ((isset($settings['enable_jump_position_after_image_option_'.$i]))?$settings['enable_jump_position_after_image_option_'.$i]:'');
102
- }
103
-
104
- if($quickAdsenseAdBeginningOfPost == 0) {
105
- $quickAdsenseAdBeginningOfPostStandIn = $cusrnd;
106
- } else {
107
- $quickAdsenseAdBeginningOfPostStandIn = $cusads.$quickAdsenseAdBeginningOfPost;
108
- array_push($quickAdsenseAdsIdCus, $quickAdsenseAdBeginningOfPost);
109
- };
110
- if($quickAdsenseAdAfterMoreTag == 0) {
111
- $quickAdsenseAdAfterMoreTagStandIn = $cusrnd;
112
- } else {
113
- $quickAdsenseAdAfterMoreTagStandIn = $cusads.$quickAdsenseAdAfterMoreTag;
114
- array_push($quickAdsenseAdsIdCus, $quickAdsenseAdAfterMoreTag);
115
- };
116
- if($quickAdsenseAdMiddleOfPost == 0) {
117
- $quickAdsenseAdMiddleOfPostStandIn = $cusrnd;
118
- } else {
119
- $quickAdsenseAdMiddleOfPostStandIn = $cusads.$quickAdsenseAdMiddleOfPost;
120
- array_push($quickAdsenseAdsIdCus, $quickAdsenseAdMiddleOfPost);
121
- };
122
- if($quickAdsenseAdBeforeLastPara == 0) {
123
- $quickAdsenseAdBeforeLastParaStandIn = $cusrnd;
124
- } else {
125
- $quickAdsenseAdBeforeLastParaStandIn = $cusads.$quickAdsenseAdBeforeLastPara;
126
- array_push($quickAdsenseAdsIdCus, $quickAdsenseAdBeforeLastPara);
127
- };
128
- if($quickAdsenseAdEndOfPost == 0) {
129
- $quickAdsenseAdEndOfPostStandIn = $cusrnd;
130
- } else {
131
- $quickAdsenseAdEndOfPostStandIn = $cusads.$quickAdsenseAdEndOfPost;
132
- array_push($quickAdsenseAdsIdCus, $quickAdsenseAdEndOfPost);
133
- };
134
- for($i = 1; $i <= 3; $i++) {
135
- if($quickAdsenseAdAfterPara[$i] == 0) {
136
- $quickAdsenseAdAfterParaStandIn[$i] = $cusrnd;
137
- } else {
138
- $quickAdsenseAdAfterParaStandIn[$i] = $cusads.$quickAdsenseAdAfterPara[$i];
139
- array_push($quickAdsenseAdsIdCus, $quickAdsenseAdAfterPara[$i]);
140
- };
141
- }
142
- if($quickAdsenseAdAfterImage == 0) {
143
- $quickAdsenseAdAfterImageStandIn = $cusrnd;
144
- } else {
145
- $quickAdsenseAdAfterImageStandIn = $cusads.$quickAdsenseAdAfterImage;
146
- array_push($quickAdsenseAdsIdCus, $quickAdsenseAdAfterImage);
147
- };
148
-
149
- if($quickAdsenseEnablePositionMiddleOfPost && (strpos($content, '<!--OffMiddle-->') === false)) {
150
- if(substr_count(strtolower($content), '</p>') >= 2) {
151
- $quickAdsenseSelectedTag = "</p>";
152
- $content = str_replace("</P>", $quickAdsenseSelectedTag, $content);
153
- $quickAdsenseTempArray = explode($quickAdsenseSelectedTag, $content);
154
- $j = 0;
155
- $k = strlen($content)/2;
156
- for($i = 0; $i < count($quickAdsenseTempArray); $i++) {
157
- $j += strlen($quickAdsenseTempArray[$i]) + 4;
158
- if($j > $k) {
159
- if(($k - ($j - strlen($quickAdsenseTempArray[$i]))) > ($j - $k) && $i+1 < count($quickAdsenseTempArray)) {
160
- $quickAdsenseTempArray[$i+1] = '<!--'.$quickAdsenseAdMiddleOfPostStandIn.'-->'.$quickAdsenseTempArray[$i+1];
161
- } else {
162
- $quickAdsenseTempArray[$i] = '<!--'.$quickAdsenseAdMiddleOfPostStandIn.'-->'.$quickAdsenseTempArray[$i];
163
- }
164
- break;
165
- }
166
- }
167
- $content = implode($quickAdsenseSelectedTag, $quickAdsenseTempArray);
168
- }
169
- }
170
- if($quickAdsenseEnablePositionAfterMoreTag && (strpos($content,'<!--OffAfMore-->') === false)) {
171
- $content = str_replace('<span id="more-'.get_the_ID().'"></span>', '<!--'.$quickAdsenseAdAfterMoreTagStandIn.'-->', $content);
172
- }
173
- if($quickAdsenseEnablePositionBeginningOfPost && (strpos($content,'<!--OffBegin-->') === false)) {
174
- $content = '<!--'.$quickAdsenseAdBeginningOfPostStandIn.'-->'.$content;
175
- }
176
- if($quickAdsenseEnablePositionEndOfPost && (strpos($content,'<!--OffEnd-->') === false)) {
177
- $content = $content.'<!--'.$quickAdsenseAdEndOfPostStandIn.'-->';
178
- }
179
- if($quickAdsenseEnablePositionBeforeLastPara && (strpos($content,'<!--OffBfLastPara-->') === false)){
180
- $quickAdsenseSelectedTag = "<p>";
181
- $content = str_replace("<P>", $quickAdsenseSelectedTag, $content);
182
- $quickAdsenseTempArray = explode($quickAdsenseSelectedTag, $content);
183
- if(count($quickAdsenseTempArray) > 2) {
184
- $content = implode($quickAdsenseSelectedTag, array_slice($quickAdsenseTempArray, 0, count($quickAdsenseTempArray)-1)).'<!--'.$quickAdsenseAdBeforeLastParaStandIn.'-->'.$quickAdsenseSelectedTag.$quickAdsenseTempArray[count($quickAdsenseTempArray)-1];
185
- }
186
- }
187
- for($i = 1; $i <= 3; $i++) {
188
- if($quickAdsenseEnablePositionAfterPara[$i]) {
189
- $quickAdsenseSelectedTag = "</p>";
190
- $content = str_replace("</P>", $quickAdsenseSelectedTag, $content);
191
- $quickAdsenseTempArray = explode($quickAdsenseSelectedTag, $content);
192
- if((int)$quickAdsensePositionAfterPara[$i] < count($quickAdsenseTempArray)) {
193
- $content = implode($quickAdsenseSelectedTag, array_slice($quickAdsenseTempArray, 0, $quickAdsensePositionAfterPara[$i])).$quickAdsenseSelectedTag.'<!--'.$quickAdsenseAdAfterParaStandIn[$i].'-->'.implode($quickAdsenseSelectedTag, array_slice($quickAdsenseTempArray, $quickAdsensePositionAfterPara[$i]));
194
- } elseif ($quickAdsenseEnableJumpPositionAfterPara[$i]) {
195
- $content = implode($quickAdsenseSelectedTag, $quickAdsenseTempArray).'<!--'.$quickAdsenseAdAfterParaStandIn[$i].'-->';
196
- }
197
- }
198
- }
199
- if($quickAdsenseEnablePositionAfterImage) {
200
- $quickAdsenseSelectedTag = "<img";
201
- $j = ">";
202
- $k = "[/caption]";
203
- $l = "</a>";
204
- $content = str_replace("<IMG", $quickAdsenseSelectedTag, $content);
205
- $content = str_replace("</A>", $l, $content);
206
- $quickAdsenseTempArray = explode($quickAdsenseSelectedTag, $content);
207
- if((int)$quickAdsensePositionAfterImage < count($quickAdsenseTempArray)) {
208
- $m = explode($j, $quickAdsenseTempArray[$quickAdsensePositionAfterImage]);
209
- if(count($m) > 1) {
210
- $n = explode($k, $quickAdsenseTempArray[$quickAdsensePositionAfterImage]);
211
- $o = (count($n) > 1)?(strpos(strtolower($n[0]), '[caption ') === false):false ;
212
- $p = explode($l, $quickAdsenseTempArray[$quickAdsensePositionAfterImage]);
213
- $q = (count($p) > 1 )?(strpos(strtolower($p[0]), '<a href') === false):false ;
214
- if($quickAdsenseEnableJumpPositionAfterImage && $o) {
215
- $quickAdsenseTempArray[$quickAdsensePositionAfterImage] = implode($k, array_slice($n, 0, 1)).$k."\r\n".'<!--'.$quickAdsenseAdAfterImageStandIn.'-->'."\r\n". implode($k, array_slice($n, 1));
216
- }else if ( $q ) {
217
- $quickAdsenseTempArray[$quickAdsensePositionAfterImage] = implode($l, array_slice($p, 0, 1)).$l."\r\n".'<!--'.$quickAdsenseAdAfterImageStandIn.'-->'."\r\n". implode($l, array_slice($p, 1));
218
- }else{
219
- $quickAdsenseTempArray[$quickAdsensePositionAfterImage] = implode($j, array_slice($m, 0, 1)).$j."\r\n".'<!--'.$quickAdsenseAdAfterImageStandIn.'-->'."\r\n". implode($j, array_slice($m, 1));
220
- }
221
- }
222
- $content = implode($quickAdsenseSelectedTag, $quickAdsenseTempArray);
223
- }
224
- }
225
- }
226
- /* End Insert StandIns for all Ad Blocks */
227
-
228
-
229
- /* Begin Replace StandIns for all Ad Blocks */
230
- $content = '<!--EmptyClear-->'.$content."\n".'<div style="font-size: 0px; height: 0px; line-height: 0px; margin: 0; padding: 0; clear: both;"></div>';
231
- $content = quick_adsense_content_clean_tags($content, true);
232
- $ismany = (!is_single() && !is_page());
233
- $showall = ((isset($settings['enable_all_possible_ads']))?$settings['enable_all_possible_ads']:'');
234
-
235
- if(!$offdef) {
236
- for($i = 1; $i <= count($quickAdsenseAdsIdCus); $i++) {
237
- if($showall || !$ismany || $quickAdsenseBeginEnd != $i) {
238
- if(((strpos($content, '<!--'.$cusads.$quickAdsenseAdsIdCus[$i-1].'-->') !== false) || (strpos($content, '<!--'.$cusads.$quickAdsenseAdsIdCus[$i-1].'-->') !== false)) && in_array($quickAdsenseAdsIdCus[$i-1], $quickAdsenseAdsId)) {
239
- $content = quick_adsense_content_replace_ads($content, $cusads.$quickAdsenseAdsIdCus[$i-1], $quickAdsenseAdsIdCus[$i-1]);
240
- $content = quick_adsense_content_replace_ads($content, $cusads.$quickAdsenseAdsIdCus[$i-1], $quickAdsenseAdsIdCus[$i-1]);
241
- $quickAdsenseAdsId = quick_adsense_content_del_element($quickAdsenseAdsId, array_search($quickAdsenseAdsIdCus[$i-1], $quickAdsenseAdsId)) ;
242
- $quickAdsenseAdsDisplayed += 1;
243
- if($quickAdsenseAdsDisplayed >= $quickAdsenseAdsToDisplay || !count($quickAdsenseAdsId)) {
244
- $content = quick_adsense_content_clean_tags($content);
245
- return $content;
246
- };
247
- $quickAdsenseBeginEnd = $i;
248
- if(!$showall && $ismany) {
249
- break;
250
- }
251
- }
252
- }
253
- }
254
- }
255
-
256
- if($showall || !$ismany) {
257
- $j = 0;
258
- for($i = 1; $i <= count($quickAdsenseAdsId); $i++ ) {
259
- if(strpos($content, '<!--Ads'.$quickAdsenseAdsId[$j].'-->')!==false) {
260
- $content = quick_adsense_content_replace_ads($content, 'Ads'.$quickAdsenseAdsId[$j], $quickAdsenseAdsId[$j]);
261
- $quickAdsenseAdsId = quick_adsense_content_del_element($quickAdsenseAdsId, $j);
262
- $quickAdsenseAdsDisplayed += 1;
263
- if(($quickAdsenseAdsDisplayed >= $quickAdsenseAdsToDisplay) || !count($quickAdsenseAdsId)) {
264
- $content = quick_adsense_content_clean_tags($content);
265
- return $content;
266
- };
267
- } else {
268
- $j += 1;
269
- }
270
- }
271
- }
272
-
273
- if((strpos($content, '<!--'.$cusrnd.'-->') !== false) && ($showall || !$ismany)) {
274
- $j = substr_count($content, '<!--'.$cusrnd.'-->');
275
- for($i = count($quickAdsenseAdsId); $i <= $j-1; $i++) {
276
- array_push($quickAdsenseAdsId, -1);
277
- }
278
- shuffle($quickAdsenseAdsId);
279
- for($i = 1; $i <= $j; $i++) {
280
- $content = quick_adsense_content_replace_ads($content, $cusrnd, $quickAdsenseAdsId[0]);
281
- $quickAdsenseAdsId = quick_adsense_content_del_element($quickAdsenseAdsId, 0) ;
282
- $quickAdsenseAdsDisplayed += 1;
283
- if(($quickAdsenseAdsDisplayed >= $quickAdsenseAdsToDisplay) || !count($quickAdsenseAdsId)) {
284
- $content = quick_adsense_content_clean_tags($content);
285
- return $content;
286
- };
287
- }
288
- }
289
- if((strpos($content, '<!--'.$cusrnd.'-->') !== false) && ($showall || !$ismany)) {
290
- $quickAdsenseAdsId = $quickAdsenseAdsId;
291
- if (($key = array_search('100', $quickAdsenseAdsId)) !== false) {
292
- unset($quickAdsenseAdsId[$key]);
293
- }
294
- $j = substr_count($content, '<!--'.$cusrnd.'-->');
295
- for($i = count($quickAdsenseAdsId); $i <= $j-1; $i++) {
296
- array_push($quickAdsenseAdsId, -1);
297
- }
298
- shuffle($quickAdsenseAdsId);
299
- for($i = 1; $i <= $j; $i++) {
300
- $content = quick_adsense_content_replace_ads($content, $cusrnd, $quickAdsenseAdsId[0]);
301
- $quickAdsenseAdsId = quick_adsense_content_del_element($quickAdsenseAdsId, 0) ;
302
- $quickAdsenseAdsDisplayed += 1;
303
- if(($quickAdsenseAdsDisplayed >= $quickAdsenseAdsToDisplay) || !count($quickAdsenseAdsId)) {
304
- $content = quick_adsense_content_clean_tags($content);
305
- return $content;
306
- };
307
- }
308
- }
309
-
310
- if(strpos($content, '<!--RndAds-->')!==false && ($showall || !$ismany)) {
311
- $quickAdsenseAdsIdTmp = array();
312
- shuffle($quickAdsenseAdsId);
313
- for($i = 1; $i <= ($quickAdsenseAdsToDisplay - $quickAdsenseAdsDisplayed); $i++) {
314
- if($i <= count($quickAdsenseAdsId)) {
315
- array_push($quickAdsenseAdsIdTmp, $quickAdsenseAdsId[$i-1]);
316
- }
317
- }
318
- $j = substr_count($content, '<!--RndAds-->');
319
- for($i = count($quickAdsenseAdsIdTmp); $i <= $j-1; $i++) {
320
- array_push($quickAdsenseAdsIdTmp, -1);
321
- }
322
- shuffle($quickAdsenseAdsIdTmp);
323
- for($i = 1; $i <= $j; $i++) {
324
- $tmp = $quickAdsenseAdsIdTmp[0];
325
- $content = quick_adsense_content_replace_ads($content, 'RndAds', $quickAdsenseAdsIdTmp[0]);
326
- $quickAdsenseAdsIdTmp = quick_adsense_content_del_element($quickAdsenseAdsIdTmp, 0) ;
327
- if($tmp != -1) {
328
- $quickAdsenseAdsDisplayed += 1;
329
- };
330
- if($quickAdsenseAdsDisplayed >= $quickAdsenseAdsToDisplay || !count($quickAdsenseAdsIdTmp)) {
331
- $content = quick_adsense_content_clean_tags($content);
332
- return $content;
333
- };
334
- }
335
- }
336
- /* End Replace StandIns for all Ad Blocks */
337
-
338
- $content = quick_adsense_content_clean_tags($content);
339
- return $content;
340
- }
341
-
342
- function quick_adsense_postads_isactive($settings, $content) {
343
- if(is_feed()) {
344
- return false;
345
- } else if(strpos($content, '<!--NoAds-->') !== false) {
346
- return false;
347
- } else if(strpos($content, '<!--OffAds-->') !== false) {
348
- return false;
349
- } else if(is_single() && !(isset($settings['enable_on_posts']))) {
350
- return false;
351
- } else if(is_page() && !(isset($settings['enable_on_pages']))) {
352
- return false;
353
- } else if(is_home() && !(isset($settings['enable_on_homepage']))) {
354
- return false;
355
- } else if(is_category() && !(isset($settings['enable_on_categories']))) {
356
- return false;
357
- } else if(is_archive() && !(isset($settings['enable_on_archives']))) {
358
- return false;
359
- } else if(is_tag() && !(isset($settings['enable_on_tags']))) {
360
- return false;
361
- } else if(is_user_logged_in() && (isset($settings['disable_for_loggedin_users']))) {
362
- return false;
363
- } else {
364
- return true;
365
- }
366
- }
367
-
368
- function quick_adsense_content_clean_tags($content, $trimonly = false) {
369
- global $quickAdsenseAdsDisplayed;
370
- global $quickAdsenseAdsId;
371
- global $quickAdsenseBeginEnd;
372
- $quicktags = array(
373
- 'EmptyClear',
374
- 'RndAds',
375
- 'NoAds',
376
- 'OffDef',
377
- 'OffAds',
378
- 'OffWidget',
379
- 'OffBegin',
380
- 'OffMiddle',
381
- 'OffEnd',
382
- 'OffBfMore',
383
- 'OffAfLastPara',
384
- 'CusRnd'
385
- );
386
- for($i = 1; $i <= 10; $i++) {
387
- array_push($quicktags, 'CusAds'.$i);
388
- array_push($quicktags, 'Ads'.$i);
389
- };
390
- foreach($quicktags as $quicktag) {
391
- if((strpos($content,'<!--'.$quicktag.'-->') !== false) || ($quicktag == 'EmptyClear')) {
392
- if($trimonly) {
393
- $content = str_replace('<p><!--'.$quicktag.'--></p>', '<!--'.$quicktag.'-->', $content);
394
- } else {
395
- $content = str_replace(array('<p><!--'.$quicktag.'--></p>', '<!--'.$quicktag.'-->'), '', $content);
396
- $content = str_replace("##QA-TP1##", "<p></p>", $content);
397
- $content = str_replace("##QA-TP2##", "<p>&nbsp;</p>", $content);
398
- }
399
- }
400
- }
401
- if(!$trimonly && (is_single() || is_page())) {
402
- $quickAdsenseAdsDisplayed = 0;
403
- $quickAdsenseAdsId = array();
404
- $quickAdsenseBeginEnd = 0;
405
- }
406
- return $content;
407
- }
408
-
409
- function quick_adsense_content_replace_ads($content, $quicktag, $adIndex) {
410
- if(strpos($content, '<!--'.$quicktag.'-->') === false ) {
411
- return $content;
412
- }
413
- $settings = get_option('quick_adsense_settings');
414
- $onpostAdStyles = array(
415
- '',
416
- 'float: left; margin: %1$dpx %1$dpx %1$dpx 0;',
417
- 'float: none; margin:%1$dpx 0 %1$dpx 0; text-align:center;',
418
- 'float: right; margin:%1$dpx 0 %1$dpx %1$dpx;',
419
- 'float: none; margin:0px;'
420
- );
421
-
422
- if(($adIndex != -1)) {
423
- $onpostAdAlignment = ((isset($settings['onpost_ad_'.$adIndex.'_alignment']))?$settings['onpost_ad_'.$adIndex.'_alignment']:'');
424
- $onpostAdMargin = ((isset($settings['onpost_ad_'.$adIndex.'_margin']))?$settings['onpost_ad_'.$adIndex.'_margin']:'');
425
- $onpostAdStyle = sprintf($onpostAdStyles[(int)$onpostAdAlignment], $onpostAdMargin);
426
- $onpostAdCode = ((isset($settings['onpost_ad_'.$adIndex.'_content']))?$settings['onpost_ad_'.$adIndex.'_content']:'');
427
- $onpostAdCode = "\n".'<!-- Quick Adsense Wordpress Plugin: http://quickadsense.com/ -->'."\n".'<div class="'.md5(get_bloginfo('url')).'" data-index="'.$adIndex.'" style="'.$onpostAdStyle.'">'."\n".$onpostAdCode."\n".'</div>'."\n";
428
- } else {
429
- $onpostAdCode = '';
430
- }
431
- $content = explode('<!--'.$quicktag.'-->', $content, 2);
432
- return $content[0].$onpostAdCode.$content[1];
433
- }
434
-
435
- function quick_adsense_content_del_element($quickAdsenseTempArray, $idx) {
436
- $copy = array();
437
- if(function_exists('quick_adsense_postads_update_impressions')) {
438
- quick_adsense_postads_update_impressions($quickAdsenseTempArray[$idx]);
439
- }
440
- for($i = 0; $i < count($quickAdsenseTempArray) ;$i++) {
441
- if($idx != $i) {
442
- array_push($copy, $quickAdsenseTempArray[$i]);
443
- }
444
- }
445
- return $copy;
446
- }
447
-
448
- function quick_adsense_advanced_postads_isactive($settings, $index) {
449
- $MobileDetect = new Mobile_Detect;
450
- /*Begin Device Type*/
451
- if(isset($settings['onpost_ad_'.$index.'_hide_device_mobile']) && $MobileDetect->isMobile()) {
452
- return false;
453
- }
454
- if(isset($settings['onpost_ad_'.$index.'_hide_device_tablet']) && $MobileDetect->isTablet()) {
455
- return false;
456
- }
457
- if(isset($settings['onpost_ad_'.$index.'_hide_device_desktop']) && !$MobileDetect->isMobile() && !$MobileDetect->isTablet()){
458
- return false;
459
- }
460
- /*End Device Type*/
461
- /*Begin Visitor Source*/
462
- $referer = ((isset($_SERVER['HTTP_REFERER']))?$_SERVER['HTTP_REFERER']:'');
463
- if($referer == '') {
464
- if(isset($settings['onpost_ad_'.$index.'_hide_visitor_direct'])) {
465
- return false;
466
- }
467
- } else {
468
- if(preg_match('/www\.google.*|search\.msn.*|search\.yahoo.*|www\.bing.*|msxml\.excite\.com|search.lycos\.com|www\.alltheweb\.com|search\.aol\.com|ask\.com|www\.hotbot\.com|www\.metacrawler\.com|search\.netscape\.com|go\.google\.com|dpxml\.webcrawler\.com|search\.earthlink\.net|www\.ask\.co\.uk/i', $referer)) {
469
- if(isset($settings['onpost_ad_'.$index.'_hide_visitor_searchengine'])) {
470
- return false;
471
- }
472
- } else {
473
- if(isset($settings['onpost_ad_'.$index.'_hide_visitor_indirect'])) {
474
- return false;
475
- }
476
- }
477
- }
478
- /*End Visitor Source*/
479
- /*Begin Visitor Type*/
480
- if(is_user_logged_in()) {
481
- if(isset($settings['onpost_ad_'.$index.'_hide_visitor_loggedin'])) {
482
- return false;
483
- }
484
- } else {
485
- if(isset($settings['onpost_ad_'.$index.'_hide_visitor_guest'])) {
486
- return false;
487
- }
488
- }
489
- if(isset($settings['onpost_ad_'.$index.'_hide_visitor_bot']) && $MobileDetect->is('Bot')) {
490
- return false;
491
- }
492
- if(
493
- isset($settings['onpost_ad_'.$index.'_hide_visitor_knownbrowser']) ||
494
- isset($settings['onpost_ad_'.$index.'_hide_visitor_unknownbrowser'])
495
- ) {
496
- if(
497
- $MobileDetect->match('/msie|firefox|safari|chrome|edge|opera|netscape|maxthon|konqueror|mobile/i')
498
- ) {
499
- if(isset($settings['onpost_ad_'.$index.'_hide_visitor_knownbrowser'])) {
500
- return false;
501
- }
502
- } else {
503
- if(isset($settings['onpost_ad_'.$index.'_hide_visitor_unknownbrowser'])) {
504
- return false;
505
- }
506
- }
507
- }
508
- /*End Visitor Type*/
509
- /*Begin Geotargeting*/
510
- if(isset($settings['onpost_ad_'.$index.'_limit_visitor_country']) && (is_array($settings['onpost_ad_'.$index.'_limit_visitor_country'])) && (count($settings['onpost_ad_'.$index.'_limit_visitor_country']) > 0)) {
511
- $userIp = ((isset($_SERVER['REMOTE_ADDR']))?$_SERVER['REMOTE_ADDR']:'');
512
- if($userIp != '') {
513
- $geoIp = new \iriven\GeoIPCountry();
514
- $countryCode = $geoIp->resolve($userIp);
515
- if(!in_array($countryCode, $settings['onpost_ad_'.$index.'_limit_visitor_country'])) {
516
- return false;
517
- }
518
- }
519
- }
520
- /*End Geotargeting*/
521
- return true;
522
- }
523
-
524
- function quick_adsense_postads_update_impressions($index) {
525
- $settings = get_option('quick_adsense_settings');
526
- if(isset($settings) && isset($settings['onpost_ad_'.$index.'_enable_stats'])) {
527
- $stats = get_option('quick_adsense_onpost_ad_'.$index.'_stats');
528
- if(isset($stats) && is_array($stats)) {
529
- if(isset($stats[date('dmY')])) {
530
- $stats[date('dmY')]['i'] += 1;
531
- } else {
532
- $stats[date('dmY')] = array('i' => 1, 'c' => 0);
533
- while(count($stats) > 30) {
534
- array_shift($stats);
535
- }
536
- }
537
- } else {
538
- $stats = array(date('dmY') => array('i' => 1, 'c' => 0));
539
- }
540
- update_option('quick_adsense_onpost_ad_'.$index.'_stats', $stats);
541
- }
542
- }
543
-
544
- add_action('wp_footer', function() {
545
- /* Conditionally Load JQuery */
546
- echo '<script type="text/javascript">';
547
- echo 'var jQueryScriptOutputted = false;';
548
- echo 'function initJQuery() {';
549
- echo 'if (typeof(jQuery) == "undefined") {';
550
- echo 'if (!jQueryScriptOutputted) {';
551
- echo 'jQueryScriptOutputted = true;';
552
- echo 'document.write("<scr" + "ipt type=\"text/javascript\" src=\"https://code.jquery.com/jquery-1.8.2.min.js\"></scr" + "ipt>");';
553
- echo '}';
554
- echo 'setTimeout("initJQuery()", 50);';
555
- echo '}';
556
- echo '}';
557
- echo 'initJQuery();';
558
- echo '</script>';
559
- echo '<script type="text/javascript">';
560
- echo 'jQuery(document).ready(function() {'.PHP_EOL;
561
- echo 'jQuery(".'.md5(get_bloginfo('url')).'").click(function() {'.PHP_EOL;
562
- echo 'jQuery.post('.PHP_EOL;
563
- echo '"'.admin_url('admin-ajax.php').'", {'.PHP_EOL;
564
- echo '"action": "quick_adsense_onpost_ad_click",'.PHP_EOL;
565
- echo '"quick_adsense_onpost_ad_index": jQuery(this).attr("data-index"),'.PHP_EOL;
566
- echo '"quick_adsense_nonce": "'.wp_create_nonce('quick-adsense-pro').'",'.PHP_EOL;
567
- echo '}, function(response) { }'.PHP_EOL;
568
- echo ');'.PHP_EOL;
569
- echo '});'.PHP_EOL;
570
- echo '});'.PHP_EOL;
571
- echo '</script>';
572
- });
573
-
574
- add_action('wp_ajax_quick_adsense_onpost_ad_click', 'quick_adsense_onpost_ad_click');
575
- add_action('wp_ajax_nopriv_quick_adsense_onpost_ad_click', 'quick_adsense_onpost_ad_click');
576
- function quick_adsense_onpost_ad_click() {
577
- check_ajax_referer('quick-adsense-pro', 'quick_adsense_nonce');
578
- if(isset($_POST['quick_adsense_onpost_ad_index'])) {
579
- $index = $_POST['quick_adsense_onpost_ad_index'];
580
- $settings = get_option('quick_adsense_settings');
581
- if(isset($settings) && isset($settings['onpost_ad_'.$index.'_enable_stats'])) {
582
- $stats = get_option('quick_adsense_onpost_ad_'.$index.'_stats');
583
- if(isset($stats) && is_array($stats)) {
584
- if(isset($stats[date('dmY')])) {
585
- $stats[date('dmY')]['c'] += 1;
586
- } else {
587
- $stats[date('dmY')] = array('i' => 0, 'c' => 1);
588
- while(count($stats) > 30) {
589
- array_shift($stats);
590
- }
591
- }
592
- } else {
593
- $stats = array(date('dmY') => array('i' => 0, 'c' => 1));
594
- }
595
- update_option('quick_adsense_onpost_ad_'.$index.'_stats', $stats);
596
- }
597
- }
598
- die();
599
- }
600
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $quick_adsense_ads_displayed = 0;
3
+ $quick_adsense_ads_id = [];
4
+ $quick_adsense_begin_end = 0;
5
+
6
+ /**
7
+ * Hook into the header to embed the Header tracking or ad code.
8
+ */
9
+ add_action(
10
+ 'wp_head',
11
+ function() {
12
+ $settings = get_option( 'quick_adsense_settings' );
13
+ if ( isset( $settings['header_embed_code'] ) && ( '' !== $settings['header_embed_code'] ) ) {
14
+ // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
15
+ // Need to allow output of scripts, iframes etc necessary to output ads and trackers.
16
+ echo $settings['header_embed_code'];
17
+ // phpcs:enable
18
+ }
19
+ }
20
+ );
21
+
22
+ /**
23
+ * Hook into the footer to embed the Footer tracking or ad code.
24
+ */
25
+ add_action(
26
+ 'wp_footer',
27
+ function() {
28
+ $settings = get_option( 'quick_adsense_settings' );
29
+ if ( isset( $settings['footer_embed_code'] ) && ( '' !== $settings['footer_embed_code'] ) ) {
30
+ // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
31
+ // Need to allow output of scripts, iframes etc necessary to output ads and trackers.
32
+ echo $settings['footer_embed_code'];
33
+ // phpcs:enable
34
+ }
35
+ }
36
+ );
37
+
38
+ /**
39
+ * Filter the post content to embed ads.
40
+ */
41
+ add_filter(
42
+ 'the_content',
43
+ function( $content ) {
44
+ global $quick_adsense_ads_displayed;
45
+ global $quick_adsense_ads_id;
46
+ global $quick_adsense_begin_end;
47
+ $settings = get_option( 'quick_adsense_settings' );
48
+
49
+ if ( ! quick_adsense_postads_isactive( $settings, $content ) ) {
50
+ $content = quick_adsense_content_clean_tags( $content );
51
+ return $content;
52
+ }
53
+ /* Begin Enforce Max Ads Per Page Rule */
54
+ $quick_adsense_ads_to_display = $settings['max_ads_per_page'];
55
+ if ( strpos( $content, '<!--OffWidget-->' ) === false ) {
56
+ for ( $i = 1; $i <= 10; $i++ ) {
57
+ $widget_id = sanitize_title( str_replace( [ '(', ')' ], '', sprintf( 'AdsWidget%d (Quick Adsense)', $i ) ) );
58
+ $quick_adsense_ads_to_display -= ( is_active_widget( true, $widget_id ) ) ? 1 : 0;
59
+ }
60
+ }
61
+ if ( $quick_adsense_ads_displayed >= $quick_adsense_ads_to_display ) {
62
+ $content = quick_adsense_content_clean_tags( $content );
63
+ return $content;
64
+ };
65
+ /* End Enforce Max Ads Per Page Rule */
66
+
67
+ /* Begin Check for Available Ad Blocks */
68
+ if ( ! count( $quick_adsense_ads_id ) ) {
69
+ for ( $i = 1; $i <= 10; $i++ ) {
70
+ if ( isset( $settings[ 'onpost_ad_' . $i . '_content' ] ) && ! empty( $settings[ 'onpost_ad_' . $i . '_content' ] ) ) {
71
+ if ( quick_adsense_advanced_postads_isactive( $settings, $i ) ) {
72
+ array_push( $quick_adsense_ads_id, (string) $i );
73
+ }
74
+ }
75
+ }
76
+ }
77
+ array_push( $quick_adsense_ads_id, 100 );
78
+
79
+ if ( ! count( $quick_adsense_ads_id ) ) {
80
+ $content = quick_adsense_content_clean_tags( $content );
81
+ return $content;
82
+ };
83
+ /* End Check for Available Ad Blocks */
84
+
85
+ /* Begin Insert StandIns for all Ad Blocks */
86
+ $content = str_replace( '<p></p>', '##QA-TP1##', $content );
87
+ $content = str_replace( '<p>&nbsp;</p>', '##QA-TP2##', $content );
88
+ $offdef = ( strpos( $content, '<!--OffDef-->' ) !== false );
89
+ if ( ! $offdef ) {
90
+ $quick_adsense_ads_id_cus = [];
91
+ $cusads = 'CusAds';
92
+ $cusrnd = 'CusRnd';
93
+
94
+ $quick_adsense_enable_position_after_more_tag = ( ( isset( $settings['enable_position_after_more_tag'] ) ) ? $settings['enable_position_after_more_tag'] : '' );
95
+ $quick_adsense_ad_after_more_tag = ( ( isset( $settings['ad_after_more_tag'] ) ) ? $settings['ad_after_more_tag'] : '' );
96
+
97
+ $quick_adsense_enable_position_before_last_para = ( ( isset( $settings['enable_position_before_last_para'] ) ) ? $settings['enable_position_before_last_para'] : '' );
98
+ $quick_adsense_ad_before_last_para = ( ( isset( $settings['ad_before_last_para'] ) ) ? $settings['ad_before_last_para'] : '' );
99
+
100
+ $quick_adsense_enable_position_beginning_of_post = ( ( isset( $settings['enable_position_beginning_of_post'] ) ) ? $settings['enable_position_beginning_of_post'] : '' );
101
+ $quick_adsense_ad_beginning_of_post = ( ( isset( $settings['ad_beginning_of_post'] ) ) ? $settings['ad_beginning_of_post'] : '' );
102
+
103
+ $quick_adsense_enable_position_middle_of_post = ( ( isset( $settings['enable_position_middle_of_post'] ) ) ? $settings['enable_position_middle_of_post'] : '' );
104
+ $quick_adsense_ad_middle_of_post = ( ( isset( $settings['ad_middle_of_post'] ) ) ? $settings['ad_middle_of_post'] : '' );
105
+
106
+ $quick_adsense_enable_position_end_of_post = ( ( isset( $settings['enable_position_end_of_post'] ) ) ? $settings['enable_position_end_of_post'] : '' );
107
+ $quick_adsense_ad_end_of_post = ( ( isset( $settings['ad_end_of_post'] ) ) ? $settings['ad_end_of_post'] : '' );
108
+
109
+ for ( $i = 1; $i <= 3; $i++ ) {
110
+ $quick_adsense_enable_position_after_para[ $i ] = ( ( isset( $settings[ 'enable_position_after_para_option_' . $i ] ) ) ? $settings[ 'enable_position_after_para_option_' . $i ] : '' );
111
+ $quick_adsense_ad_after_para[ $i ] = ( ( isset( $settings[ 'ad_after_para_option_' . $i ] ) ) ? $settings[ 'ad_after_para_option_' . $i ] : '' );
112
+ $quick_adsense_position_after_para[ $i ] = ( ( isset( $settings[ 'position_after_para_option_' . $i ] ) ) ? $settings[ 'position_after_para_option_' . $i ] : '' );
113
+ $quick_adsense_enable_jump_position_after_para[ $i ] = ( ( isset( $settings[ 'enable_jump_position_after_para_option_' . $i ] ) ) ? $settings[ 'enable_jump_position_after_para_option_' . $i ] : '' );
114
+ }
115
+
116
+ for ( $i = 1; $i <= 1; $i++ ) {
117
+ $quick_adsense_enable_position_after_image = ( ( isset( $settings[ 'enable_position_after_image_option_' . $i ] ) ) ? $settings[ 'enable_position_after_image_option_' . $i ] : '' );
118
+ $quick_adsense_ad_after_image = ( ( isset( $settings[ 'ad_after_image_option_' . $i ] ) ) ? $settings[ 'ad_after_image_option_' . $i ] : '' );
119
+ $quick_adsense_position_after_image = ( ( isset( $settings[ 'position_after_image_option_' . $i ] ) ) ? $settings[ 'position_after_image_option_' . $i ] : '' );
120
+ $quick_adsense_enable_jump_position_after_image = ( ( isset( $settings[ 'enable_jump_position_after_image_option_' . $i ] ) ) ? $settings[ 'enable_jump_position_after_image_option_' . $i ] : '' );
121
+ }
122
+
123
+ if ( 0 === $quick_adsense_ad_beginning_of_post ) {
124
+ $quick_adsense_ad_beginning_of_post_stand_in = $cusrnd;
125
+ } else {
126
+ $quick_adsense_ad_beginning_of_post_stand_in = $cusads . $quick_adsense_ad_beginning_of_post;
127
+ array_push( $quick_adsense_ads_id_cus, $quick_adsense_ad_beginning_of_post );
128
+ };
129
+ if ( 0 === $quick_adsense_ad_after_more_tag ) {
130
+ $quick_adsense_ad_after_more_tag_stand_in = $cusrnd;
131
+ } else {
132
+ $quick_adsense_ad_after_more_tag_stand_in = $cusads . $quick_adsense_ad_after_more_tag;
133
+ array_push( $quick_adsense_ads_id_cus, $quick_adsense_ad_after_more_tag );
134
+ };
135
+ if ( 0 === $quick_adsense_ad_middle_of_post ) {
136
+ $quick_adsense_ad_middle_of_post_stand_in = $cusrnd;
137
+ } else {
138
+ $quick_adsense_ad_middle_of_post_stand_in = $cusads . $quick_adsense_ad_middle_of_post;
139
+ array_push( $quick_adsense_ads_id_cus, $quick_adsense_ad_middle_of_post );
140
+ };
141
+ if ( 0 === $quick_adsense_ad_before_last_para ) {
142
+ $quick_adsense_ad_before_last_para_stand_in = $cusrnd;
143
+ } else {
144
+ $quick_adsense_ad_before_last_para_stand_in = $cusads . $quick_adsense_ad_before_last_para;
145
+ array_push( $quick_adsense_ads_id_cus, $quick_adsense_ad_before_last_para );
146
+ };
147
+ if ( 0 === $quick_adsense_ad_end_of_post ) {
148
+ $quick_adsense_ad_end_of_post_stand_in = $cusrnd;
149
+ } else {
150
+ $quick_adsense_ad_end_of_post_stand_in = $cusads . $quick_adsense_ad_end_of_post;
151
+ array_push( $quick_adsense_ads_id_cus, $quick_adsense_ad_end_of_post );
152
+ };
153
+ for ( $i = 1; $i <= 3; $i++ ) {
154
+ if ( 0 === $quick_adsense_ad_after_para[ $i ] ) {
155
+ $quick_adsense_ad_after_para_stand_in[ $i ] = $cusrnd;
156
+ } else {
157
+ $quick_adsense_ad_after_para_stand_in[ $i ] = $cusads . $quick_adsense_ad_after_para[ $i ];
158
+ array_push( $quick_adsense_ads_id_cus, $quick_adsense_ad_after_para[ $i ] );
159
+ };
160
+ }
161
+ if ( 0 === $quick_adsense_ad_after_image ) {
162
+ $quick_adsense_ad_after_image_stand_in = $cusrnd;
163
+ } else {
164
+ $quick_adsense_ad_after_image_stand_in = $cusads . $quick_adsense_ad_after_image;
165
+ array_push( $quick_adsense_ads_id_cus, $quick_adsense_ad_after_image );
166
+ };
167
+
168
+ if ( $quick_adsense_enable_position_middle_of_post && ( strpos( $content, '<!--OffMiddle-->' ) === false ) ) {
169
+ if ( substr_count( strtolower( $content ), '</p>' ) >= 2 ) {
170
+ $quick_adsense_selected_tag = '</p>';
171
+ $content = str_replace( '</P>', $quick_adsense_selected_tag, $content );
172
+ $quick_adsense_temp_array = explode( $quick_adsense_selected_tag, $content );
173
+ $j = 0;
174
+ $k = strlen( $content ) / 2;
175
+ $quick_adsense_temp_array_count = count( $quick_adsense_temp_array );
176
+ for ( $i = 0; $i < $quick_adsense_temp_array_count; $i++ ) {
177
+ $j += strlen( $quick_adsense_temp_array[ $i ] ) + 4;
178
+ if ( $j > $k ) {
179
+ if ( ( $k - ( $j - strlen( $quick_adsense_temp_array[ $i ] ) ) ) > ( $j - $k ) && $i + 1 < count( $quick_adsense_temp_array ) ) {
180
+ $quick_adsense_temp_array[ $i + 1 ] = '<!--' . $quick_adsense_ad_middle_of_post_stand_in . '-->' . $quick_adsense_temp_array[ $i + 1 ];
181
+ } else {
182
+ $quick_adsense_temp_array[ $i ] = '<!--' . $quick_adsense_ad_middle_of_post_stand_in . '-->' . $quick_adsense_temp_array[ $i ];
183
+ }
184
+ break;
185
+ }
186
+ $quick_adsense_temp_array_count = count( $quick_adsense_temp_array );
187
+ }
188
+ $content = implode( $quick_adsense_selected_tag, $quick_adsense_temp_array );
189
+ }
190
+ }
191
+ if ( $quick_adsense_enable_position_after_more_tag && ( strpos( $content, '<!--OffAfMore-->' ) === false ) ) {
192
+ $content = str_replace( '<span id="more-' . get_the_ID() . '"></span>', '<!--' . $quick_adsense_ad_after_more_tag_stand_in . '-->', $content );
193
+ }
194
+ if ( $quick_adsense_enable_position_beginning_of_post && ( strpos( $content, '<!--OffBegin-->' ) === false ) ) {
195
+ $content = '<!--' . $quick_adsense_ad_beginning_of_post_stand_in . '-->' . $content;
196
+ }
197
+ if ( $quick_adsense_enable_position_end_of_post && ( strpos( $content, '<!--OffEnd-->' ) === false ) ) {
198
+ $content = $content . '<!--' . $quick_adsense_ad_end_of_post_stand_in . '-->';
199
+ }
200
+ if ( $quick_adsense_enable_position_before_last_para && ( strpos( $content, '<!--OffBfLastPara-->' ) === false ) ) {
201
+ $quick_adsense_selected_tag = '<p>';
202
+ $content = str_replace( '<P>', $quick_adsense_selected_tag, $content );
203
+ $quick_adsense_temp_array = explode( $quick_adsense_selected_tag, $content );
204
+ if ( count( $quick_adsense_temp_array ) > 2 ) {
205
+ $content = implode( $quick_adsense_selected_tag, array_slice( $quick_adsense_temp_array, 0, count( $quick_adsense_temp_array ) - 1 ) ) . '<!--' . $quick_adsense_ad_before_last_para_stand_in . '-->' . $quick_adsense_selected_tag . $quick_adsense_temp_array[ count( $quick_adsense_temp_array ) - 1 ];
206
+ }
207
+ }
208
+ for ( $i = 1; $i <= 3; $i++ ) {
209
+ if ( $quick_adsense_enable_position_after_para[ $i ] ) {
210
+ $quick_adsense_selected_tag = '</p>';
211
+ $content = str_replace( '</P>', $quick_adsense_selected_tag, $content );
212
+ $quick_adsense_temp_array = explode( $quick_adsense_selected_tag, $content );
213
+ if ( (int) $quick_adsense_position_after_para[ $i ] < count( $quick_adsense_temp_array ) ) {
214
+ $content = implode( $quick_adsense_selected_tag, array_slice( $quick_adsense_temp_array, 0, $quick_adsense_position_after_para[ $i ] ) ) . $quick_adsense_selected_tag . '<!--' . $quick_adsense_ad_after_para_stand_in[ $i ] . '-->' . implode( $quick_adsense_selected_tag, array_slice( $quick_adsense_temp_array, $quick_adsense_position_after_para[ $i ] ) );
215
+ } elseif ( $quick_adsense_enable_jump_position_after_para[ $i ] ) {
216
+ $content = implode( $quick_adsense_selected_tag, $quick_adsense_temp_array ) . '<!--' . $quick_adsense_ad_after_para_stand_in[ $i ] . '-->';
217
+ }
218
+ }
219
+ }
220
+ if ( $quick_adsense_enable_position_after_image ) {
221
+ $quick_adsense_selected_tag = '<img';
222
+ $j = '>';
223
+ $k = '[/caption]';
224
+ $l = '</a>';
225
+ $content = str_replace( '<IMG', $quick_adsense_selected_tag, $content );
226
+ $content = str_replace( '</A>', $l, $content );
227
+ $quick_adsense_temp_array = explode( $quick_adsense_selected_tag, $content );
228
+ if ( (int) $quick_adsense_position_after_image < count( $quick_adsense_temp_array ) ) {
229
+ $m = explode( $j, $quick_adsense_temp_array[ $quick_adsense_position_after_image ] );
230
+ if ( count( $m ) > 1 ) {
231
+ $n = explode( $k, $quick_adsense_temp_array[ $quick_adsense_position_after_image ] );
232
+ $o = ( count( $n ) > 1 ) ? ( strpos( strtolower( $n[0] ), '[caption ' ) === false ) : false;
233
+ $p = explode( $l, $quick_adsense_temp_array[ $quick_adsense_position_after_image ] );
234
+ $q = ( count( $p ) > 1 ) ? ( strpos( strtolower( $p[0] ), '<a href' ) === false ) : false;
235
+ if ( $quick_adsense_enable_jump_position_after_image && $o ) {
236
+ $quick_adsense_temp_array[ $quick_adsense_position_after_image ] = implode( $k, array_slice( $n, 0, 1 ) ) . $k . "\r\n" . '<!--' . $quick_adsense_ad_after_image_stand_in . '-->' . "\r\n" . implode( $k, array_slice( $n, 1 ) );
237
+ } elseif ( $q ) {
238
+ $quick_adsense_temp_array[ $quick_adsense_position_after_image ] = implode( $l, array_slice( $p, 0, 1 ) ) . $l . "\r\n" . '<!--' . $quick_adsense_ad_after_image_stand_in . '-->' . "\r\n" . implode( $l, array_slice( $p, 1 ) );
239
+ } else {
240
+ $quick_adsense_temp_array[ $quick_adsense_position_after_image ] = implode( $j, array_slice( $m, 0, 1 ) ) . $j . "\r\n" . '<!--' . $quick_adsense_ad_after_image_stand_in . '-->' . "\r\n" . implode( $j, array_slice( $m, 1 ) );
241
+ }
242
+ }
243
+ $content = implode( $quick_adsense_selected_tag, $quick_adsense_temp_array );
244
+ }
245
+ }
246
+ }
247
+ /* End Insert StandIns for all Ad Blocks */
248
+
249
+ /* Begin Replace StandIns for all Ad Blocks */
250
+ $content = '<!--EmptyClear-->' . $content . "\n" . '<div style="font-size: 0px; height: 0px; line-height: 0px; margin: 0; padding: 0; clear: both;"></div>';
251
+ $content = quick_adsense_content_clean_tags( $content, true );
252
+ $ismany = ( ! is_single() && ! is_page() );
253
+ $showall = ( ( isset( $settings['enable_all_possible_ads'] ) ) ? $settings['enable_all_possible_ads'] : '' );
254
+
255
+ if ( ! $offdef ) {
256
+ $quick_adsense_ads_id_cus_count = count( $quick_adsense_ads_id_cus );
257
+ for ( $i = 1; $i <= $quick_adsense_ads_id_cus_count; $i++ ) {
258
+ if ( $showall || ! $ismany || $i !== $quick_adsense_begin_end ) {
259
+ if ( ( ( strpos( $content, '<!--' . $cusads . $quick_adsense_ads_id_cus[ $i - 1 ] . '-->' ) !== false ) || ( strpos( $content, '<!--' . $cusads . $quick_adsense_ads_id_cus[ $i - 1 ] . '-->' ) !== false ) ) && in_array( $quick_adsense_ads_id_cus[ $i - 1 ], $quick_adsense_ads_id, true ) ) {
260
+ $content = quick_adsense_content_replace_ads( $content, $cusads . $quick_adsense_ads_id_cus[ $i - 1 ], $quick_adsense_ads_id_cus[ $i - 1 ] );
261
+ $content = quick_adsense_content_replace_ads( $content, $cusads . $quick_adsense_ads_id_cus[ $i - 1 ], $quick_adsense_ads_id_cus[ $i - 1 ] );
262
+ $quick_adsense_ads_id = quick_adsense_content_del_element( $quick_adsense_ads_id, array_search( $quick_adsense_ads_id_cus[ $i - 1 ], $quick_adsense_ads_id, true ) );
263
+ $quick_adsense_ads_displayed++;
264
+ if ( $quick_adsense_ads_displayed >= $quick_adsense_ads_to_display || ! count( $quick_adsense_ads_id ) ) {
265
+ $content = quick_adsense_content_clean_tags( $content );
266
+ return $content;
267
+ };
268
+ $quick_adsense_begin_end = $i;
269
+ if ( ! $showall && $ismany ) {
270
+ break;
271
+ }
272
+ }
273
+ }
274
+ $quick_adsense_ads_id_cus_count = count( $quick_adsense_ads_id_cus );
275
+ }
276
+ }
277
+
278
+ if ( $showall || ! $ismany ) {
279
+ $j = 0;
280
+ $quick_adsense_ads_id_count = count( $quick_adsense_ads_id );
281
+ for ( $i = 1; $i <= $quick_adsense_ads_id_count; $i++ ) {
282
+ if ( strpos( $content, '<!--Ads' . $quick_adsense_ads_id[ $j ] . '-->' ) !== false ) {
283
+ $content = quick_adsense_content_replace_ads( $content, 'Ads' . $quick_adsense_ads_id[ $j ], $quick_adsense_ads_id[ $j ] );
284
+ $quick_adsense_ads_id = quick_adsense_content_del_element( $quick_adsense_ads_id, $j );
285
+ $quick_adsense_ads_displayed++;
286
+ if ( ( $quick_adsense_ads_displayed >= $quick_adsense_ads_to_display ) || ! count( $quick_adsense_ads_id ) ) {
287
+ $content = quick_adsense_content_clean_tags( $content );
288
+ return $content;
289
+ };
290
+ } else {
291
+ $j++;
292
+ }
293
+ $quick_adsense_ads_id_count = count( $quick_adsense_ads_id );
294
+ }
295
+ }
296
+
297
+ if ( ( strpos( $content, '<!--' . $cusrnd . '-->' ) !== false ) && ( $showall || ! $ismany ) ) {
298
+ $j = substr_count( $content, '<!--' . $cusrnd . '-->' );
299
+ for ( $i = count( $quick_adsense_ads_id ); $i <= $j - 1; $i++ ) {
300
+ array_push( $quick_adsense_ads_id, -1 );
301
+ }
302
+ shuffle( $quick_adsense_ads_id );
303
+ for ( $i = 1; $i <= $j; $i++ ) {
304
+ $content = quick_adsense_content_replace_ads( $content, $cusrnd, $quick_adsense_ads_id[0] );
305
+ $quick_adsense_ads_id = quick_adsense_content_del_element( $quick_adsense_ads_id, 0 );
306
+ $quick_adsense_ads_displayed++;
307
+ if ( ( $quick_adsense_ads_displayed >= $quick_adsense_ads_to_display ) || ! count( $quick_adsense_ads_id ) ) {
308
+ $content = quick_adsense_content_clean_tags( $content );
309
+ return $content;
310
+ };
311
+ }
312
+ }
313
+ if ( ( strpos( $content, '<!--' . $cusrnd . '-->' ) !== false ) && ( $showall || ! $ismany ) ) {
314
+ $quick_adsense_ads_id = $quick_adsense_ads_id;
315
+ $key = array_search( '100', $quick_adsense_ads_id, true );
316
+ if ( false !== $key ) {
317
+ unset( $quick_adsense_ads_id[ $key ] );
318
+ }
319
+ $j = substr_count( $content, '<!--' . $cusrnd . '-->' );
320
+ for ( $i = count( $quick_adsense_ads_id ); $i <= $j - 1; $i++ ) {
321
+ array_push( $quick_adsense_ads_id, -1 );
322
+ }
323
+ shuffle( $quick_adsense_ads_id );
324
+ for ( $i = 1; $i <= $j; $i++ ) {
325
+ $content = quick_adsense_content_replace_ads( $content, $cusrnd, $quick_adsense_ads_id[0] );
326
+ $quick_adsense_ads_id = quick_adsense_content_del_element( $quick_adsense_ads_id, 0 );
327
+ $quick_adsense_ads_displayed++;
328
+ if ( ( $quick_adsense_ads_displayed >= $quick_adsense_ads_to_display ) || ! count( $quick_adsense_ads_id ) ) {
329
+ $content = quick_adsense_content_clean_tags( $content );
330
+ return $content;
331
+ };
332
+ }
333
+ }
334
+
335
+ if ( strpos( $content, '<!--RndAds-->' ) !== false && ( $showall || ! $ismany ) ) {
336
+ $quick_adsense_ads_id_tmp = [];
337
+ shuffle( $quick_adsense_ads_id );
338
+ for ( $i = 1; $i <= ( $quick_adsense_ads_to_display - $quick_adsense_ads_displayed ); $i++ ) {
339
+ if ( $i <= count( $quick_adsense_ads_id ) ) {
340
+ array_push( $quick_adsense_ads_id_tmp, $quick_adsense_ads_id[ $i - 1 ] );
341
+ }
342
+ }
343
+ $j = substr_count( $content, '<!--RndAds-->' );
344
+ for ( $i = count( $quick_adsense_ads_id_tmp ); $i <= $j - 1; $i++ ) {
345
+ array_push( $quick_adsense_ads_id_tmp, -1 );
346
+ }
347
+ shuffle( $quick_adsense_ads_id_tmp );
348
+ for ( $i = 1; $i <= $j; $i++ ) {
349
+ $tmp = $quick_adsense_ads_id_tmp[0];
350
+ $content = quick_adsense_content_replace_ads( $content, 'RndAds', $quick_adsense_ads_id_tmp[0] );
351
+ $quick_adsense_ads_id_tmp = quick_adsense_content_del_element( $quick_adsense_ads_id_tmp, 0 );
352
+ if ( -1 !== $tmp ) {
353
+ $quick_adsense_ads_displayed++;
354
+ };
355
+ if ( $quick_adsense_ads_displayed >= $quick_adsense_ads_to_display || ! count( $quick_adsense_ads_id_tmp ) ) {
356
+ $content = quick_adsense_content_clean_tags( $content );
357
+ return $content;
358
+ };
359
+ }
360
+ }
361
+ /* End Replace StandIns for all Ad Blocks */
362
+
363
+ $content = quick_adsense_content_clean_tags( $content );
364
+ return $content;
365
+ }
366
+ );
367
+
368
+ /**
369
+ * This function checks whether the ads are active on a post.
370
+ *
371
+ * @param array $settings The user settings.
372
+ * @param string $content The content.
373
+ *
374
+ * @return boolean true on success, false on faliure.
375
+ */
376
+ function quick_adsense_postads_isactive( $settings, $content ) {
377
+ if ( is_feed() ) {
378
+ return false;
379
+ } elseif ( strpos( $content, '<!--NoAds-->' ) !== false ) {
380
+ return false;
381
+ } elseif ( strpos( $content, '<!--OffAds-->' ) !== false ) {
382
+ return false;
383
+ } elseif ( is_single() && ! ( isset( $settings['enable_on_posts'] ) ) ) {
384
+ return false;
385
+ } elseif ( is_page() && ! ( isset( $settings['enable_on_pages'] ) ) ) {
386
+ return false;
387
+ } elseif ( is_home() && ! ( isset( $settings['enable_on_homepage'] ) ) ) {
388
+ return false;
389
+ } elseif ( is_category() && ! ( isset( $settings['enable_on_categories'] ) ) ) {
390
+ return false;
391
+ } elseif ( is_archive() && ! ( isset( $settings['enable_on_archives'] ) ) ) {
392
+ return false;
393
+ } elseif ( is_tag() && ! ( isset( $settings['enable_on_tags'] ) ) ) {
394
+ return false;
395
+ } elseif ( is_user_logged_in() && ( isset( $settings['disable_for_loggedin_users'] ) ) ) {
396
+ return false;
397
+ } else {
398
+ return true;
399
+ }
400
+ }
401
+
402
+ /**
403
+ * This function removes the quicktags from the content.
404
+ *
405
+ * @param string $content The content.
406
+ * @param boolean $trimonly Just trim (remove p tags around the quicktag) or completly remove the quicktag.
407
+ *
408
+ * @return string The processed content.
409
+ */
410
+ function quick_adsense_content_clean_tags( $content, $trimonly = false ) {
411
+ global $quick_adsense_ads_displayed;
412
+ global $quick_adsense_ads_id;
413
+ global $quick_adsense_begin_end;
414
+ $quicktags = [
415
+ 'EmptyClear',
416
+ 'RndAds',
417
+ 'NoAds',
418
+ 'OffDef',
419
+ 'OffAds',
420
+ 'OffWidget',
421
+ 'OffBegin',
422
+ 'OffMiddle',
423
+ 'OffEnd',
424
+ 'OffBfMore',
425
+ 'OffAfLastPara',
426
+ 'CusRnd',
427
+ ];
428
+ for ( $i = 1; $i <= 10; $i++ ) {
429
+ array_push( $quicktags, 'CusAds' . $i );
430
+ array_push( $quicktags, 'Ads' . $i );
431
+ };
432
+ foreach ( $quicktags as $quicktag ) {
433
+ if ( ( strpos( $content, '<!--' . $quicktag . '-->' ) !== false ) || ( 'EmptyClear' === $quicktag ) ) {
434
+ if ( $trimonly ) {
435
+ $content = str_replace( '<p><!--' . $quicktag . '--></p>', '<!--' . $quicktag . '-->', $content );
436
+ } else {
437
+ $content = str_replace( [ '<p><!--' . $quicktag . '--></p>', '<!--' . $quicktag . '-->' ], '', $content );
438
+ $content = str_replace( '##QA-TP1##', '<p></p>', $content );
439
+ $content = str_replace( '##QA-TP2##', '<p>&nbsp;</p>', $content );
440
+ }
441
+ }
442
+ }
443
+ if ( ! $trimonly && ( is_single() || is_page() ) ) {
444
+ $quick_adsense_ads_displayed = 0;
445
+ $quick_adsense_ads_id = [];
446
+ $quick_adsense_begin_end = 0;
447
+ }
448
+ return $content;
449
+ }
450
+
451
+ /**
452
+ * This function replaces the quicktag with the actual ad.
453
+ *
454
+ * @param string $content The content.
455
+ * @param string $quicktag The quicktag.
456
+ * @param integer $ad_index The array index.
457
+ *
458
+ * @return string The processed content.
459
+ */
460
+ function quick_adsense_content_replace_ads( $content, $quicktag, $ad_index ) {
461
+ if ( strpos( $content, '<!--' . $quicktag . '-->' ) === false ) {
462
+ return $content;
463
+ }
464
+ $settings = get_option( 'quick_adsense_settings' );
465
+ $onpost_ad_styles = [
466
+ '',
467
+ 'float: left; margin: %1$dpx %1$dpx %1$dpx 0;',
468
+ 'float: none; margin:%1$dpx 0 %1$dpx 0; text-align:center;',
469
+ 'float: right; margin:%1$dpx 0 %1$dpx %1$dpx;',
470
+ 'float: none; margin:0px;',
471
+ ];
472
+
473
+ if ( ( -1 !== $ad_index ) ) {
474
+ $onpost_ad_alignment = ( ( isset( $settings[ 'onpost_ad_' . $ad_index . '_alignment' ] ) ) ? $settings[ 'onpost_ad_' . $ad_index . '_alignment' ] : '' );
475
+ $onpost_ad_margin = ( ( isset( $settings[ 'onpost_ad_' . $ad_index . '_margin' ] ) ) ? $settings[ 'onpost_ad_' . $ad_index . '_margin' ] : '' );
476
+ $onpost_ad_style = sprintf( $onpost_ad_styles[ (int) $onpost_ad_alignment ], $onpost_ad_margin );
477
+ $onpost_ad_code = ( ( isset( $settings[ 'onpost_ad_' . $ad_index . '_content' ] ) ) ? $settings[ 'onpost_ad_' . $ad_index . '_content' ] : '' );
478
+ $onpost_ad_code = '<div class="' . md5( get_bloginfo( 'url' ) ) . '" data-index="' . $ad_index . '" style="' . $onpost_ad_style . '">' . "\n" . $onpost_ad_code . "\n" . '</div>' . "\n";
479
+ } else {
480
+ $onpost_ad_code = '';
481
+ }
482
+ $content = explode( '<!--' . $quicktag . '-->', $content, 2 );
483
+ return $content[0] . $onpost_ad_code . $content[1];
484
+ }
485
+
486
+ /**
487
+ * Delete the selected item from the array by index.
488
+ *
489
+ * @param array $quick_adsense_temp_array The input array.
490
+ * @param integer $index The array index.
491
+ *
492
+ * @return array The processed array.
493
+ */
494
+ function quick_adsense_content_del_element( $quick_adsense_temp_array, $index ) {
495
+ $copy = [];
496
+ if ( function_exists( 'quick_adsense_postads_update_impressions' ) ) {
497
+ quick_adsense_postads_update_impressions( $quick_adsense_temp_array[ $index ] );
498
+ }
499
+ $quick_adsense_temp_array_count = count( $quick_adsense_temp_array );
500
+ for ( $i = 0; $i < $quick_adsense_temp_array_count; $i++ ) {
501
+ if ( $index !== $i ) {
502
+ array_push( $copy, $quick_adsense_temp_array[ $i ] );
503
+ $quick_adsense_temp_array_count = count( $quick_adsense_temp_array );
504
+ }
505
+ }
506
+ return $copy;
507
+ }
508
+
509
+ /**
510
+ * This function checks if the selected ad is active basedon the user settings.
511
+ *
512
+ * @param array $settings The user settings.
513
+ * @param integer $index The ad index.
514
+ *
515
+ * @return boolean true on success, false on faliure.
516
+ */
517
+ function quick_adsense_advanced_postads_isactive( $settings, $index ) {
518
+ $mobile_detect = new Mobile_Detect();
519
+ // Begin Device Type.
520
+ if ( isset( $settings[ 'onpost_ad_' . $index . '_hide_device_mobile' ] ) && $mobile_detect->isMobile() ) {
521
+ return false;
522
+ }
523
+ if ( isset( $settings[ 'onpost_ad_' . $index . '_hide_device_tablet' ] ) && $mobile_detect->isTablet() ) {
524
+ return false;
525
+ }
526
+ if ( isset( $settings[ 'onpost_ad_' . $index . '_hide_device_desktop' ] ) && ! $mobile_detect->isMobile() && ! $mobile_detect->isTablet() ) {
527
+ return false;
528
+ }
529
+ // End Device Type.
530
+ // Begin Visitor Source.
531
+ $referer = quick_adsense_get_value( $_SERVER, 'HTTP_REFERER' );
532
+ if ( '' === $referer ) {
533
+ if ( isset( $settings[ 'onpost_ad_' . $index . '_hide_visitor_direct' ] ) ) {
534
+ return false;
535
+ }
536
+ } else {
537
+ if ( preg_match( '/www\.google.*|search\.msn.*|search\.yahoo.*|www\.bing.*|msxml\.excite\.com|search.lycos\.com|www\.alltheweb\.com|search\.aol\.com|ask\.com|www\.hotbot\.com|www\.metacrawler\.com|search\.netscape\.com|go\.google\.com|dpxml\.webcrawler\.com|search\.earthlink\.net|www\.ask\.co\.uk/i', $referer ) ) {
538
+ if ( isset( $settings[ 'onpost_ad_' . $index . '_hide_visitor_searchengine' ] ) ) {
539
+ return false;
540
+ }
541
+ } else {
542
+ if ( isset( $settings[ 'onpost_ad_' . $index . '_hide_visitor_indirect' ] ) ) {
543
+ return false;
544
+ }
545
+ }
546
+ }
547
+ // End Visitor Source.
548
+ // Begin Visitor Type.
549
+ if ( is_user_logged_in() ) {
550
+ if ( isset( $settings[ 'onpost_ad_' . $index . '_hide_visitor_loggedin' ] ) ) {
551
+ return false;
552
+ }
553
+ } else {
554
+ if ( isset( $settings[ 'onpost_ad_' . $index . '_hide_visitor_guest' ] ) ) {
555
+ return false;
556
+ }
557
+ }
558
+ if ( isset( $settings[ 'onpost_ad_' . $index . '_hide_visitor_bot' ] ) && $mobile_detect->is( 'Bot' ) ) {
559
+ return false;
560
+ }
561
+ if (
562
+ isset( $settings[ 'onpost_ad_' . $index . '_hide_visitor_knownbrowser' ] ) ||
563
+ isset( $settings[ 'onpost_ad_' . $index . '_hide_visitor_unknownbrowser' ] )
564
+ ) {
565
+ if (
566
+ $mobile_detect->match( '/msie|firefox|safari|chrome|edge|opera|netscape|maxthon|konqueror|mobile/i' )
567
+ ) {
568
+ if ( isset( $settings[ 'onpost_ad_' . $index . '_hide_visitor_knownbrowser' ] ) ) {
569
+ return false;
570
+ }
571
+ } else {
572
+ if ( isset( $settings[ 'onpost_ad_' . $index . '_hide_visitor_unknownbrowser' ] ) ) {
573
+ return false;
574
+ }
575
+ }
576
+ }
577
+ // End Visitor Type.
578
+ // Begin Geotargeting.
579
+ if ( isset( $settings[ 'onpost_ad_' . $index . '_limit_visitor_country' ] ) && ( is_array( $settings[ 'onpost_ad_' . $index . '_limit_visitor_country' ] ) ) && ( count( $settings[ 'onpost_ad_' . $index . '_limit_visitor_country' ] ) > 0 ) ) {
580
+ $user_ip = quick_adsense_get_value( $_SERVER, 'REMOTE_ADDR' );
581
+ if ( '' !== $user_ip ) {
582
+ $geo_ip = new \iriven\GeoIPCountry();
583
+ $country_code = $geo_ip->resolve( $user_ip );
584
+ if ( ! in_array( $country_code, $settings[ 'onpost_ad_' . $index . '_limit_visitor_country' ], true ) ) {
585
+ return false;
586
+ }
587
+ }
588
+ }
589
+ // End Geotargeting.
590
+ return true;
591
+ }
592
+
593
+ /**
594
+ * This function increments the ad impressions for the ad at the selected index.
595
+ *
596
+ * @param integer $index The array index.
597
+ */
598
+ function quick_adsense_postads_update_impressions( $index ) {
599
+ $settings = get_option( 'quick_adsense_settings' );
600
+ if ( isset( $settings ) && isset( $settings[ 'onpost_ad_' . $index . '_enable_stats' ] ) ) {
601
+ $stats = get_option( 'quick_adsense_onpost_ad_' . $index . '_stats' );
602
+ if ( isset( $stats ) && is_array( $stats ) ) {
603
+ if ( isset( $stats[ gmdate( 'dmY' ) ] ) ) {
604
+ $stats[ gmdate( 'dmY' ) ]['i'] += 1;
605
+ } else {
606
+ $stats[ gmdate( 'dmY' ) ] = [
607
+ 'i' => 1,
608
+ 'c' => 0,
609
+ ];
610
+ $stats_count = count( $stats );
611
+ while ( $stats_count > 30 ) {
612
+ array_shift( $stats );
613
+ $stats_count = count( $stats );
614
+ }
615
+ }
616
+ } else {
617
+ $stats = [
618
+ gmdate( 'dmY' ) => [
619
+ 'i' => 1,
620
+ 'c' => 0,
621
+ ],
622
+ ];
623
+ }
624
+ update_option( 'quick_adsense_onpost_ad_' . $index . '_stats', $stats );
625
+ }
626
+ }
627
+
628
+ /**
629
+ * Add inline script to frontend to record ad stats.
630
+ */
631
+ add_action(
632
+ 'wp_enqueue_scripts',
633
+ function() {
634
+ wp_enqueue_script( 'jquery' );
635
+ wp_add_inline_script(
636
+ 'jquery',
637
+ quick_adsense_load_file(
638
+ 'templates/js/script-frontend-stats.php',
639
+ [
640
+ 'target' => md5( get_bloginfo( 'url' ) ),
641
+ 'ajax_url' => admin_url( 'admin-ajax.php' ),
642
+ 'nonce' => wp_create_nonce( 'quick-adsense-stats' ),
643
+ ]
644
+ )
645
+ );
646
+ }
647
+ );
648
+
649
+
650
+ add_action( 'wp_ajax_quick_adsense_onpost_ad_click', 'quick_adsense_onpost_ad_click' );
651
+ add_action( 'wp_ajax_nopriv_quick_adsense_onpost_ad_click', 'quick_adsense_onpost_ad_click' );
652
+ /**
653
+ * Ajax handler for "quick_adsense_onpost_ad_click" action which updates the ad click stats.
654
+ */
655
+ function quick_adsense_onpost_ad_click() {
656
+ if ( isset( $_POST['quick_adsense_nonce'] ) && wp_verify_nonce( sanitize_key( $_POST['quick_adsense_nonce'] ), 'quick-adsense-stats' ) ) {
657
+ if ( isset( $_POST['quick_adsense_onpost_ad_index'] ) ) {
658
+ $index = sanitize_key( $_POST['quick_adsense_onpost_ad_index'] );
659
+ $settings = get_option( 'quick_adsense_settings' );
660
+ if ( isset( $settings ) && isset( $settings[ 'onpost_ad_' . $index . '_enable_stats' ] ) ) {
661
+ $stats = get_option( 'quick_adsense_onpost_ad_' . $index . '_stats' );
662
+ if ( isset( $stats ) && is_array( $stats ) ) {
663
+ if ( isset( $stats[ gmdate( 'dmY' ) ] ) ) {
664
+ $stats[ gmdate( 'dmY' ) ]['c'] += 1;
665
+ } else {
666
+ $stats[ gmdate( 'dmY' ) ] = [
667
+ 'i' => 0,
668
+ 'c' => 1,
669
+ ];
670
+ $stats_count = count( $stats );
671
+ while ( $stats_count > 30 ) {
672
+ array_shift( $stats );
673
+ $stats_count = count( $stats );
674
+ }
675
+ }
676
+ } else {
677
+ $stats = [
678
+ gmdate( 'dmY' ) => [
679
+ 'i' => 0,
680
+ 'c' => 1,
681
+ ],
682
+ ];
683
+ }
684
+ update_option( 'quick_adsense_onpost_ad_' . $index . '_stats', $stats );
685
+ wp_send_json_success();
686
+ }
687
+ }
688
+ }
689
+ wp_send_json_error();
690
+ }
691
+
includes/controls.php CHANGED
@@ -1,90 +1,181 @@
1
- <?php
2
- if(!function_exists('quickadsense_get_control')) {
3
- function quickadsense_get_control($type, $label, $id, $name, $value = '', $data = null, $class = 'input widefat', $style = '', $placeholder = '') {
4
- $output = '';
5
- switch($type) {
6
- case 'hidden':
7
- $output .= '<input type="text" id="'.$id.'" name="'.$name.'" value="'.$value.'" style="display: none;" />';
8
- break;
9
- case 'text':
10
- if($label != '') {
11
- $output .= '<label for="'.$name.'">'.$label.'</label>';
12
- }
13
- $output .= '<input type="text" id="'.$id.'" name="'.$name.'" value="'.$value.'" class="multilanguage-input '.$class.'" style="'.$style.'" placeholder="'.$placeholder.'" />';
14
- break;
15
- case 'password':
16
- if($label != '') {
17
- $output .= '<label for="'.$name.'">'.$label.'</label>';
18
- }
19
- $output .= '<input type="password" id="'.$id.'" name="'.$name.'" value="'.$value.'" class="multilanguage-input '.$class.'" style="'.$style.'" placeholder="'.$placeholder.'" />';
20
- break;
21
- case 'number':
22
- if($label != '') {
23
- $output .= '<label for="'.$name.'">'.$label.'</label>';
24
- }
25
- $output .= '<input type="number" id="'.$id.'" name="'.$name.'" value="'.$value.'" class="multilanguage-input '.$class.'" style="'.$style.'" placeholder="'.$placeholder.'" />';
26
- break;
27
- case 'checkbox':
28
- $output .= '<input type="checkbox" id="'.$id.'" name="'.$name.'" value="1" class="input" '.checked($value, 1, false).' style="'.$style.'" />';
29
- if($label != '') {
30
- $output .= '<label for="'.$name.'">'.$label.'</label>';
31
- }
32
- break;
33
- case 'textarea':
34
- if($label != '') {
35
- $output .= '<label for="'.$name.'">'.$label.'</label><br />';
36
- }
37
- $output .= '<textarea id="'.$id.'" name="'.$name.'" class="multilanguage-input '.$class.'" class="multilanguage-input '.$class.'" style="height: 100px; '.$style.'" placeholder="'.$placeholder.'">'.$value.'</textarea>';
38
- break;
39
- case 'textarea-big':
40
- if($label != '') {
41
- $output .= '<label for="'.$name.'">'.$label.'</label><br />';
42
- }
43
- $output .= '<textarea id="'.$id.'" name="'.$name.'" class="multilanguage-input '.$class.'" class="multilanguage-input '.$class.'" style="height: 300px; '.$style.'" placeholder="'.$placeholder.'">'.$value.'</textarea>';
44
- break;
45
- case 'select':
46
- if($label != '') {
47
- $output .= '<label for="'.$name.'">'.$label.'</label>';
48
- }
49
- $output .= '<select id="'.$id.'" name="'.$name.'" class="'.$class.'" style="'.$style.'" >';
50
- if($data) {
51
- foreach($data as $option) {
52
- $metadata = '';
53
- if(isset($option['metadata']) && is_array($option['metadata'])) {
54
- foreach($option['metadata'] as $key => $metavalue) {
55
- $metadata .= 'data-'.$key.'="'.$metavalue.'"';
56
- }
57
- }
58
- $output .= '<option '.$metadata.' value="'.$option['value'].'" '.selected($value, $option['value'], false).'>'.$option['text'].'</option>';
59
- }
60
- }
61
- $output .= '</select>';
62
- break;
63
- case 'upload':
64
- if($label != '') {
65
- $output .= '<label for="'.$name.'">'.$label.'</label><br />';
66
- }
67
- $output .= '<input type="text" id="'.$id.'" name="'.$name.'" value="'.$value.'" class="'.$class.'" class="width: 74%;" style="'.$style.'" />';
68
- $output .= '<input type="button" value="Upload Image" class="boates_uploader_button" id="upload_image_button" class="width: 25%;" />';
69
- break;
70
- case 'multiselect':
71
- if($label != '') {
72
- $output .= '<label for="'.$name.'">'.$label.'</label><br />';
73
- }
74
- $output .= '<select id="'.$id.'" name="'.$name.'" class="'.$class.'" multiple="multiple" style="height: 120px; '.$style.'" >';
75
- if($data) {
76
- foreach($data as $option) {
77
- if(is_array($value) && in_array($option['value'], $value)) {
78
- $output .= '<option value="'.$option['value'].'" selected="selected">'.$option['text'].'</option>';
79
- } else {
80
- $output .= '<option value="'.$option['value'].'">'.$option['text'].'</option>';
81
- }
82
- }
83
- }
84
- $output .= '</select>';
85
- break;
86
- }
87
- return $output;
88
- }
89
- }
90
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Function to return the markup to display an HTML user input element.
4
+ *
5
+ * @param string $type The element type.
6
+ * @param string $label The element label.
7
+ * @param string $id The element id.
8
+ * @param string $name The element name.
9
+ * @param string $value The element value.
10
+ * @param array $data The element data. Eg for options in a select.
11
+ * @param string $class The element classes.
12
+ * @param string $style The element styles.
13
+ * @param string $placeholder The element placeholder.
14
+ *
15
+ * @return string the markup for the HTML element.
16
+ */
17
+ function quickadsense_get_control( $type, $label, $id, $name, $value = '', $data = null, $class = 'input widefat', $style = '', $placeholder = '' ) {
18
+ $output = '';
19
+ switch ( $type ) {
20
+ case 'hidden':
21
+ $output .= '<input type="text" id="' . $id . '" name="' . $name . '" value="' . $value . '" style="display: none;" />';
22
+ break;
23
+ case 'text':
24
+ if ( '' !== $label ) {
25
+ $output .= '<label for="' . $name . '">' . $label . '</label>';
26
+ }
27
+ $output .= '<input type="text" id="' . $id . '" name="' . $name . '" value="' . $value . '" class="multilanguage-input ' . $class . '" style="' . $style . '" placeholder="' . $placeholder . '" />';
28
+ break;
29
+ case 'password':
30
+ if ( '' !== $label ) {
31
+ $output .= '<label for="' . $name . '">' . $label . '</label>';
32
+ }
33
+ $output .= '<input type="password" id="' . $id . '" name="' . $name . '" value="' . $value . '" class="multilanguage-input ' . $class . '" style="' . $style . '" placeholder="' . $placeholder . '" />';
34
+ break;
35
+ case 'number':
36
+ if ( '' !== $label ) {
37
+ $output .= '<label for="' . $name . '">' . $label . '</label>';
38
+ }
39
+ $output .= '<input type="number" id="' . $id . '" name="' . $name . '" value="' . $value . '" class="multilanguage-input ' . $class . '" style="' . $style . '" placeholder="' . $placeholder . '" />';
40
+ break;
41
+ case 'checkbox':
42
+ $output .= '<input type="checkbox" id="' . $id . '" name="' . $name . '" value="1" class="input" ' . checked( $value, 1, false ) . ' style="' . $style . '" />';
43
+ if ( '' !== $label ) {
44
+ $output .= '<label for="' . $name . '">' . $label . '</label>';
45
+ }
46
+ break;
47
+ case 'textarea':
48
+ if ( '' !== $label ) {
49
+ $output .= '<label for="' . $name . '">' . $label . '</label><br />';
50
+ }
51
+ $output .= '<textarea id="' . $id . '" name="' . $name . '" class="multilanguage-input ' . $class . '" class="multilanguage-input ' . $class . '" style="height: 100px; ' . $style . '" placeholder="' . $placeholder . '">' . $value . '</textarea>';
52
+ break;
53
+ case 'textarea-big':
54
+ if ( '' !== $label ) {
55
+ $output .= '<label for="' . $name . '">' . $label . '</label><br />';
56
+ }
57
+ $output .= '<textarea id="' . $id . '" name="' . $name . '" class="multilanguage-input ' . $class . '" class="multilanguage-input ' . $class . '" style="height: 300px; ' . $style . '" placeholder="' . $placeholder . '">' . $value . '</textarea>';
58
+ break;
59
+ case 'select':
60
+ if ( '' !== $label ) {
61
+ $output .= '<label for="' . $name . '">' . $label . '</label>';
62
+ }
63
+ $output .= '<select id="' . $id . '" name="' . $name . '" class="' . $class . '" style="' . $style . '" >';
64
+ if ( $data ) {
65
+ foreach ( $data as $option ) {
66
+ $metadata = '';
67
+ if ( isset( $option['metadata'] ) && is_array( $option['metadata'] ) ) {
68
+ foreach ( $option['metadata'] as $key => $metavalue ) {
69
+ $metadata .= 'data-' . $key . '="' . $metavalue . '"';
70
+ }
71
+ }
72
+ $output .= '<option ' . $metadata . ' value="' . $option['value'] . '" ' . selected( $value, $option['value'], false ) . '>' . $option['text'] . '</option>';
73
+ }
74
+ }
75
+ $output .= '</select>';
76
+ break;
77
+ case 'upload':
78
+ if ( '' !== $label ) {
79
+ $output .= '<label for="' . $name . '">' . $label . '</label><br />';
80
+ }
81
+ $output .= '<input type="text" id="' . $id . '" name="' . $name . '" value="' . $value . '" class="' . $class . '" class="width: 74%;" style="' . $style . '" />';
82
+ $output .= '<input type="button" value="Upload Image" class="quick_adsense_uploader_button" id="upload_image_button" class="width: 25%;" />';
83
+ break;
84
+ case 'multiselect':
85
+ if ( '' !== $label ) {
86
+ $output .= '<label for="' . $name . '">' . $label . '</label><br />';
87
+ }
88
+ $output .= '<select id="' . $id . '" name="' . $name . '" class="' . $class . '" multiple="multiple" style="height: 120px; ' . $style . '" >';
89
+ if ( $data ) {
90
+ foreach ( $data as $option ) {
91
+ if ( is_array( $value ) && in_array( $option['value'], $value, true ) ) {
92
+ $output .= '<option value="' . $option['value'] . '" selected="selected">' . $option['text'] . '</option>';
93
+ } else {
94
+ $output .= '<option value="' . $option['value'] . '">' . $option['text'] . '</option>';
95
+ }
96
+ }
97
+ }
98
+ $output .= '</select>';
99
+ break;
100
+ }
101
+ return $output;
102
+ }
103
+
104
+ /**
105
+ * Check for null and empty and returns the value or the default
106
+ *
107
+ * @param array $data The data.
108
+ * @param string $field_name The name of field/key for data.
109
+ * @param string $default The default value to send if the selected data value if empty or not set.
110
+ */
111
+ function quick_adsense_get_value( $data, $field_name, $default = '' ) {
112
+ if ( isset( $data ) && is_array( $data ) && isset( $data[ $field_name ] ) && ( '' !== $data[ $field_name ] ) ) {
113
+ return $data[ $field_name ];
114
+ }
115
+ return $default;
116
+ }
117
+
118
+ /**
119
+ * Allowed HTML attributes and tags for the wp_kses function.
120
+ */
121
+ function quick_adsense_get_allowed_html() {
122
+ $common_html_attributes = [
123
+ 'id' => [],
124
+ 'name' => [],
125
+ 'class' => [],
126
+ 'for' => [],
127
+ 'href' => [],
128
+ 'rel' => [],
129
+ 'title' => [],
130
+ 'datetime' => [],
131
+ 'style' => [],
132
+ 'alt' => [],
133
+ 'height' => [],
134
+ 'src' => [],
135
+ 'width' => [],
136
+ 'type' => [],
137
+ 'value' => [],
138
+ 'checked' => [],
139
+ 'selected' => [],
140
+ 'multiple' => [],
141
+ 'data-index' => [],
142
+ 'onclick' => [],
143
+ ];
144
+ $common_html_tags = [
145
+ 'a' => $common_html_attributes,
146
+ 'abbr' => $common_html_attributes,
147
+ 'b' => $common_html_attributes,
148
+ 'br' => $common_html_attributes,
149
+ 'blockquote' => $common_html_attributes,
150
+ 'cite' => $common_html_attributes,
151
+ 'code' => $common_html_attributes,
152
+ 'del' => $common_html_attributes,
153
+ 'dd' => $common_html_attributes,
154
+ 'div' => $common_html_attributes,
155
+ 'dl' => $common_html_attributes,
156
+ 'dt' => $common_html_attributes,
157
+ 'em' => $common_html_attributes,
158
+ 'h1' => $common_html_attributes,
159
+ 'h2' => $common_html_attributes,
160
+ 'h3' => $common_html_attributes,
161
+ 'h4' => $common_html_attributes,
162
+ 'h5' => $common_html_attributes,
163
+ 'h6' => $common_html_attributes,
164
+ 'i' => $common_html_attributes,
165
+ 'img' => $common_html_attributes,
166
+ 'label' => $common_html_attributes,
167
+ 'li' => $common_html_attributes,
168
+ 'ol' => $common_html_attributes,
169
+ 'ul' => $common_html_attributes,
170
+ 'p' => $common_html_attributes,
171
+ 'q' => $common_html_attributes,
172
+ 'span' => $common_html_attributes,
173
+ 'strike' => $common_html_attributes,
174
+ 'strong' => $common_html_attributes,
175
+ 'input' => $common_html_attributes,
176
+ 'textarea' => $common_html_attributes,
177
+ 'select' => $common_html_attributes,
178
+ 'option' => $common_html_attributes,
179
+ ];
180
+ return $common_html_tags;
181
+ }
includes/countries.php ADDED
@@ -0,0 +1,1000 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This function returns an array of countries and their shortnames.
4
+ *
5
+ * @return array Array of country names and shortnames.
6
+ */
7
+ function quick_adsense_get_countries() {
8
+ $data = [
9
+ [
10
+ 'value' => 'AD',
11
+ 'text' => 'Andorra',
12
+ ],
13
+ [
14
+ 'value' => 'AE',
15
+ 'text' => 'United Arab Emirates',
16
+ ],
17
+ [
18
+ 'value' => 'AF',
19
+ 'text' => 'Afghanistan',
20
+ ],
21
+ [
22
+ 'value' => 'AG',
23
+ 'text' => 'Antigua and Barbuda',
24
+ ],
25
+ [
26
+ 'value' => 'AI',
27
+ 'text' => 'Anguilla',
28
+ ],
29
+ [
30
+ 'value' => 'AL',
31
+ 'text' => 'Albania',
32
+ ],
33
+ [
34
+ 'value' => 'AM',
35
+ 'text' => 'Armenia',
36
+ ],
37
+ [
38
+ 'value' => 'AN',
39
+ 'text' => 'Netherlands Antilles',
40
+ ],
41
+ [
42
+ 'value' => 'AO',
43
+ 'text' => 'Angola',
44
+ ],
45
+ [
46
+ 'value' => 'AQ',
47
+ 'text' => 'Antarctica',
48
+ ],
49
+ [
50
+ 'value' => 'AR',
51
+ 'text' => 'Argentina',
52
+ ],
53
+ [
54
+ 'value' => 'AS',
55
+ 'text' => 'American Samoa',
56
+ ],
57
+ [
58
+ 'value' => 'AT',
59
+ 'text' => 'Austria',
60
+ ],
61
+ [
62
+ 'value' => 'AU',
63
+ 'text' => 'Australia',
64
+ ],
65
+ [
66
+ 'value' => 'AW',
67
+ 'text' => 'Aruba',
68
+ ],
69
+ [
70
+ 'value' => 'AZ',
71
+ 'text' => 'Azerbaijan',
72
+ ],
73
+ [
74
+ 'value' => 'BA',
75
+ 'text' => 'Bosnia and Herzegovina',
76
+ ],
77
+ [
78
+ 'value' => 'BB',
79
+ 'text' => 'Barbados',
80
+ ],
81
+ [
82
+ 'value' => 'BD',
83
+ 'text' => 'Bangladesh',
84
+ ],
85
+ [
86
+ 'value' => 'BE',
87
+ 'text' => 'Belgium',
88
+ ],
89
+ [
90
+ 'value' => 'BF',
91
+ 'text' => 'Burkina Faso',
92
+ ],
93
+ [
94
+ 'value' => 'BG',
95
+ 'text' => 'Bulgaria',
96
+ ],
97
+ [
98
+ 'value' => 'BH',
99
+ 'text' => 'Bahrain',
100
+ ],
101
+ [
102
+ 'value' => 'BI',
103
+ 'text' => 'Burundi',
104
+ ],
105
+ [
106
+ 'value' => 'BJ',
107
+ 'text' => 'Benin',
108
+ ],
109
+ [
110
+ 'value' => 'BM',
111
+ 'text' => 'Bermuda',
112
+ ],
113
+ [
114
+ 'value' => 'BN',
115
+ 'text' => 'Brunei Darussalam',
116
+ ],
117
+ [
118
+ 'value' => 'BO',
119
+ 'text' => 'Bolivia',
120
+ ],
121
+ [
122
+ 'value' => 'BR',
123
+ 'text' => 'Brazil',
124
+ ],
125
+ [
126
+ 'value' => 'BS',
127
+ 'text' => 'Bahamas',
128
+ ],
129
+ [
130
+ 'value' => 'BT',
131
+ 'text' => 'Bhutan',
132
+ ],
133
+ [
134
+ 'value' => 'BV',
135
+ 'text' => 'Bouvet Island',
136
+ ],
137
+ [
138
+ 'value' => 'BW',
139
+ 'text' => 'Botswana',
140
+ ],
141
+ [
142
+ 'value' => 'BY',
143
+ 'text' => 'Belarus',
144
+ ],
145
+ [
146
+ 'value' => 'BZ',
147
+ 'text' => 'Belize',
148
+ ],
149
+ [
150
+ 'value' => 'CA',
151
+ 'text' => 'Canada',
152
+ ],
153
+ [
154
+ 'value' => 'CC',
155
+ 'text' => 'Cocos (Keeling) Islands',
156
+ ],
157
+ [
158
+ 'value' => 'CD',
159
+ 'text' => 'The Democratic Republic of the Congo',
160
+ ],
161
+ [
162
+ 'value' => 'CF',
163
+ 'text' => 'Central African Republic',
164
+ ],
165
+ [
166
+ 'value' => 'CG',
167
+ 'text' => 'Congo',
168
+ ],
169
+ [
170
+ 'value' => 'CH',
171
+ 'text' => 'Switzerland',
172
+ ],
173
+ [
174
+ 'value' => 'CI',
175
+ 'text' => 'Cote D\'Ivoire',
176
+ ],
177
+ [
178
+ 'value' => 'CK',
179
+ 'text' => 'Cook Islands',
180
+ ],
181
+ [
182
+ 'value' => 'CL',
183
+ 'text' => 'Chile',
184
+ ],
185
+ [
186
+ 'value' => 'CM',
187
+ 'text' => 'Cameroon',
188
+ ],
189
+ [
190
+ 'value' => 'CN',
191
+ 'text' => 'China',
192
+ ],
193
+ [
194
+ 'value' => 'CO',
195
+ 'text' => 'Colombia',
196
+ ],
197
+ [
198
+ 'value' => 'CR',
199
+ 'text' => 'Costa Rica',
200
+ ],
201
+ [
202
+ 'value' => 'CU',
203
+ 'text' => 'Cuba',
204
+ ],
205
+ [
206
+ 'value' => 'CV',
207
+ 'text' => 'Cape Verde',
208
+ ],
209
+ [
210
+ 'value' => 'CX',
211
+ 'text' => 'Christmas Island',
212
+ ],
213
+ [
214
+ 'value' => 'CY',
215
+ 'text' => 'Cyprus',
216
+ ],
217
+ [
218
+ 'value' => 'CZ',
219
+ 'text' => 'Czech Republic',
220
+ ],
221
+ [
222
+ 'value' => 'DE',
223
+ 'text' => 'Germany',
224
+ ],
225
+ [
226
+ 'value' => 'DJ',
227
+ 'text' => 'Djibouti',
228
+ ],
229
+ [
230
+ 'value' => 'DK',
231
+ 'text' => 'Denmark',
232
+ ],
233
+ [
234
+ 'value' => 'DM',
235
+ 'text' => 'Dominica',
236
+ ],
237
+ [
238
+ 'value' => 'DO',
239
+ 'text' => 'Dominican Republic',
240
+ ],
241
+ [
242
+ 'value' => 'DZ',
243
+ 'text' => 'Algeria',
244
+ ],
245
+ [
246
+ 'value' => 'EC',
247
+ 'text' => 'Ecuador',
248
+ ],
249
+ [
250
+ 'value' => 'EE',
251
+ 'text' => 'Estonia',
252
+ ],
253
+ [
254
+ 'value' => 'EG',
255
+ 'text' => 'Egypt',
256
+ ],
257
+ [
258
+ 'value' => 'EH',
259
+ 'text' => 'Western Sahara',
260
+ ],
261
+ [
262
+ 'value' => 'ER',
263
+ 'text' => 'Eritrea',
264
+ ],
265
+ [
266
+ 'value' => 'ES',
267
+ 'text' => 'Spain',
268
+ ],
269
+ [
270
+ 'value' => 'ET',
271
+ 'text' => 'Ethiopia',
272
+ ],
273
+ [
274
+ 'value' => 'FI',
275
+ 'text' => 'Finland',
276
+ ],
277
+ [
278
+ 'value' => 'FJ',
279
+ 'text' => 'Fiji',
280
+ ],
281
+ [
282
+ 'value' => 'FK',
283
+ 'text' => 'Falkland Islands (Malvinas)',
284
+ ],
285
+ [
286
+ 'value' => 'FM',
287
+ 'text' => 'Federated States of Micronesia',
288
+ ],
289
+ [
290
+ 'value' => 'FO',
291
+ 'text' => 'Faroe Islands',
292
+ ],
293
+ [
294
+ 'value' => 'FR',
295
+ 'text' => 'France',
296
+ ],
297
+ [
298
+ 'value' => 'FX',
299
+ 'text' => 'France Metropolitan',
300
+ ],
301
+ [
302
+ 'value' => 'GA',
303
+ 'text' => 'Gabon',
304
+ ],
305
+ [
306
+ 'value' => 'GB',
307
+ 'text' => 'United Kingdom',
308
+ ],
309
+ [
310
+ 'value' => 'GD',
311
+ 'text' => 'Grenada',
312
+ ],
313
+ [
314
+ 'value' => 'GE',
315
+ 'text' => 'Georgia',
316
+ ],
317
+ [
318
+ 'value' => 'GF',
319
+ 'text' => 'French Guiana',
320
+ ],
321
+ [
322
+ 'value' => 'GH',
323
+ 'text' => 'Ghana',
324
+ ],
325
+ [
326
+ 'value' => 'GI',
327
+ 'text' => 'Gibraltar',
328
+ ],
329
+ [
330
+ 'value' => 'GL',
331
+ 'text' => 'Greenland',
332
+ ],
333
+ [
334
+ 'value' => 'GM',
335
+ 'text' => 'Gambia',
336
+ ],
337
+ [
338
+ 'value' => 'GN',
339
+ 'text' => 'Guinea',
340
+ ],
341
+ [
342
+ 'value' => 'GP',
343
+ 'text' => 'Guadeloupe',
344
+ ],
345
+ [
346
+ 'value' => 'GQ',
347
+ 'text' => 'Equatorial Guinea',
348
+ ],
349
+ [
350
+ 'value' => 'GR',
351
+ 'text' => 'Greece',
352
+ ],
353
+ [
354
+ 'value' => 'GS',
355
+ 'text' => 'South Georgia and the South Sandwich Islands',
356
+ ],
357
+ [
358
+ 'value' => 'GT',
359
+ 'text' => 'Guatemala',
360
+ ],
361
+ [
362
+ 'value' => 'GU',
363
+ 'text' => 'Guam',
364
+ ],
365
+ [
366
+ 'value' => 'GW',
367
+ 'text' => 'Guinea-Bissau',
368
+ ],
369
+ [
370
+ 'value' => 'GY',
371
+ 'text' => 'Guyana',
372
+ ],
373
+ [
374
+ 'value' => 'HK',
375
+ 'text' => 'Hong Kong',
376
+ ],
377
+ [
378
+ 'value' => 'HM',
379
+ 'text' => 'Heard Island and McDonald Islands',
380
+ ],
381
+ [
382
+ 'value' => 'HN',
383
+ 'text' => 'Honduras',
384
+ ],
385
+ [
386
+ 'value' => 'HR',
387
+ 'text' => 'Croatia',
388
+ ],
389
+ [
390
+ 'value' => 'HT',
391
+ 'text' => 'Haiti',
392
+ ],
393
+ [
394
+ 'value' => 'HU',
395
+ 'text' => 'Hungary',
396
+ ],
397
+ [
398
+ 'value' => 'ID',
399
+ 'text' => 'Indonesia',
400
+ ],
401
+ [
402
+ 'value' => 'IE',
403
+ 'text' => 'Ireland',
404
+ ],
405
+ [
406
+ 'value' => 'IL',
407
+ 'text' => 'Israel',
408
+ ],
409
+ [
410
+ 'value' => 'IN',
411
+ 'text' => 'India',
412
+ ],
413
+ [
414
+ 'value' => 'IO',
415
+ 'text' => 'British Indian Ocean Territory',
416
+ ],
417
+ [
418
+ 'value' => 'IQ',
419
+ 'text' => 'Iraq',
420
+ ],
421
+ [
422
+ 'value' => 'IR',
423
+ 'text' => 'Islamic Republic of Iran',
424
+ ],
425
+ [
426
+ 'value' => 'IS',
427
+ 'text' => 'Iceland',
428
+ ],
429
+ [
430
+ 'value' => 'IT',
431
+ 'text' => 'Italy',
432
+ ],
433
+ [
434
+ 'value' => 'JM',
435
+ 'text' => 'Jamaica',
436
+ ],
437
+ [
438
+ 'value' => 'JO',
439
+ 'text' => 'Jordan',
440
+ ],
441
+ [
442
+ 'value' => 'JP',
443
+ 'text' => 'Japan',
444
+ ],
445
+ [
446
+ 'value' => 'KE',
447
+ 'text' => 'Kenya',
448
+ ],
449
+ [
450
+ 'value' => 'KG',
451
+ 'text' => 'Kyrgyzstan',
452
+ ],
453
+ [
454
+ 'value' => 'KH',
455
+ 'text' => 'Cambodia',
456
+ ],
457
+ [
458
+ 'value' => 'KI',
459
+ 'text' => 'Kiribati',
460
+ ],
461
+ [
462
+ 'value' => 'KM',
463
+ 'text' => 'Comoros',
464
+ ],
465
+ [
466
+ 'value' => 'KN',
467
+ 'text' => 'Saint Kitts and Nevis',
468
+ ],
469
+ [
470
+ 'value' => 'KP',
471
+ 'text' => 'Democratic People\'s Republic of Korea',
472
+ ],
473
+ [
474
+ 'value' => 'KR',
475
+ 'text' => 'Republic of Korea',
476
+ ],
477
+ [
478
+ 'value' => 'KW',
479
+ 'text' => 'Kuwait',
480
+ ],
481
+ [
482
+ 'value' => 'KY',
483
+ 'text' => 'Cayman Islands',
484
+ ],
485
+ [
486
+ 'value' => 'KZ',
487
+ 'text' => 'Kazakhstan',
488
+ ],
489
+ [
490
+ 'value' => 'LA',
491
+ 'text' => 'Lao People\'s Democratic Republic',
492
+ ],
493
+ [
494
+ 'value' => 'LB',
495
+ 'text' => 'Lebanon',
496
+ ],
497
+ [
498
+ 'value' => 'LC',
499
+ 'text' => 'Saint Lucia',
500
+ ],
501
+ [
502
+ 'value' => 'LI',
503
+ 'text' => 'Liechtenstein',
504
+ ],
505
+ [
506
+ 'value' => 'LK',
507
+ 'text' => 'Sri Lanka',
508
+ ],
509
+ [
510
+ 'value' => 'LR',
511
+ 'text' => 'Liberia',
512
+ ],
513
+ [
514
+ 'value' => 'LS',
515
+ 'text' => 'Lesotho',
516
+ ],
517
+ [
518
+ 'value' => 'LT',
519
+ 'text' => 'Lithuania',
520
+ ],
521
+ [
522
+ 'value' => 'LU',
523
+ 'text' => 'Luxembourg',
524
+ ],
525
+ [
526
+ 'value' => 'LV',
527
+ 'text' => 'Latvia',
528
+ ],
529
+ [
530
+ 'value' => 'LY',
531
+ 'text' => 'Libyan Arab Jamahiriya',
532
+ ],
533
+ [
534
+ 'value' => 'MA',
535
+ 'text' => 'Morocco',
536
+ ],
537
+ [
538
+ 'value' => 'MC',
539
+ 'text' => 'Monaco',
540
+ ],
541
+ [
542
+ 'value' => 'MD',
543
+ 'text' => 'Republic of Moldova',
544
+ ],
545
+ [
546
+ 'value' => 'MG',
547
+ 'text' => 'Madagascar',
548
+ ],
549
+ [
550
+ 'value' => 'MH',
551
+ 'text' => 'Marshall Islands',
552
+ ],
553
+ [
554
+ 'value' => 'MK',
555
+ 'text' => 'Macedonia',
556
+ ],
557
+ [
558
+ 'value' => 'ML',
559
+ 'text' => 'Mali',
560
+ ],
561
+ [
562
+ 'value' => 'MM',
563
+ 'text' => 'Myanmar',
564
+ ],
565
+ [
566
+ 'value' => 'MN',
567
+ 'text' => 'Mongolia',
568
+ ],
569
+ [
570
+ 'value' => 'MO',
571
+ 'text' => 'Macau',
572
+ ],
573
+ [
574
+ 'value' => 'MP',
575
+ 'text' => 'Northern Mariana Islands',
576
+ ],
577
+ [
578
+ 'value' => 'MQ',
579
+ 'text' => 'Martinique',
580
+ ],
581
+ [
582
+ 'value' => 'MR',
583
+ 'text' => 'Mauritania',
584
+ ],
585
+ [
586
+ 'value' => 'MS',
587
+ 'text' => 'Montserrat',
588
+ ],
589
+ [
590
+ 'value' => 'MT',
591
+ 'text' => 'Malta',
592
+ ],
593
+ [
594
+ 'value' => 'MU',
595
+ 'text' => 'Mauritius',
596
+ ],
597
+ [
598
+ 'value' => 'MV',
599
+ 'text' => 'Maldives',
600
+ ],
601
+ [
602
+ 'value' => 'MW',
603
+ 'text' => 'Malawi',
604
+ ],
605
+ [
606
+ 'value' => 'MX',
607
+ 'text' => 'Mexico',
608
+ ],
609
+ [
610
+ 'value' => 'MY',
611
+ 'text' => 'Malaysia',
612
+ ],
613
+ [
614
+ 'value' => 'MZ',
615
+ 'text' => 'Mozambique',
616
+ ],
617
+ [
618
+ 'value' => 'NA',
619
+ 'text' => 'Namibia',
620
+ ],
621
+ [
622
+ 'value' => 'NC',
623
+ 'text' => 'New Caledonia',
624
+ ],
625
+ [
626
+ 'value' => 'NE',
627
+ 'text' => 'Niger',
628
+ ],
629
+ [
630
+ 'value' => 'NF',
631
+ 'text' => 'Norfolk Island',
632
+ ],
633
+ [
634
+ 'value' => 'NG',
635
+ 'text' => 'Nigeria',
636
+ ],
637
+ [
638
+ 'value' => 'NI',
639
+ 'text' => 'Nicaragua',
640
+ ],
641
+ [
642
+ 'value' => 'NL',
643
+ 'text' => 'Netherlands',
644
+ ],
645
+ [
646
+ 'value' => 'NO',
647
+ 'text' => 'Norway',
648
+ ],
649
+ [
650
+ 'value' => 'NP',
651
+ 'text' => 'Nepal',
652
+ ],
653
+ [
654
+ 'value' => 'NR',
655
+ 'text' => 'Nauru',
656
+ ],
657
+ [
658
+ 'value' => 'NU',
659
+ 'text' => 'Niue',
660
+ ],
661
+ [
662
+ 'value' => 'NZ',
663
+ 'text' => 'New Zealand',
664
+ ],
665
+ [
666
+ 'value' => 'OM',
667
+ 'text' => 'Oman',
668
+ ],
669
+ [
670
+ 'value' => 'PA',
671
+ 'text' => 'Panama',
672
+ ],
673
+ [
674
+ 'value' => 'PE',
675
+ 'text' => 'Peru',
676
+ ],
677
+ [
678
+ 'value' => 'PF',
679
+ 'text' => 'French Polynesia',
680
+ ],
681
+ [
682
+ 'value' => 'PG',
683
+ 'text' => 'Papua New Guinea',
684
+ ],
685
+ [
686
+ 'value' => 'PH',
687
+ 'text' => 'Philippines',
688
+ ],
689
+ [
690
+ 'value' => 'PK',
691
+ 'text' => 'Pakistan',
692
+ ],
693
+ [
694
+ 'value' => 'PL',
695
+ 'text' => 'Poland',
696
+ ],
697
+ [
698
+ 'value' => 'PM',
699
+ 'text' => 'Saint Pierre and Miquelon',
700
+ ],
701
+ [
702
+ 'value' => 'PN',
703
+ 'text' => 'Pitcairn Islands',
704
+ ],
705
+ [
706
+ 'value' => 'PR',
707
+ 'text' => 'Puerto Rico',
708
+ ],
709
+ [
710
+ 'value' => 'PS',
711
+ 'text' => 'Palestinian Territory',
712
+ ],
713
+ [
714
+ 'value' => 'PT',
715
+ 'text' => 'Portugal',
716
+ ],
717
+ [
718
+ 'value' => 'PW',
719
+ 'text' => 'Palau',
720
+ ],
721
+ [
722
+ 'value' => 'PY',
723
+ 'text' => 'Paraguay',
724
+ ],
725
+ [
726
+ 'value' => 'QA',
727
+ 'text' => 'Qatar',
728
+ ],
729
+ [
730
+ 'value' => 'RE',
731
+ 'text' => 'Reunion',
732
+ ],
733
+ [
734
+ 'value' => 'RO',
735
+ 'text' => 'Romania',
736
+ ],
737
+ [
738
+ 'value' => 'RU',
739
+ 'text' => 'Russian Federation',
740
+ ],
741
+ [
742
+ 'value' => 'RW',
743
+ 'text' => 'Rwanda',
744
+ ],
745
+ [
746
+ 'value' => 'SA',
747
+ 'text' => 'Saudi Arabia',
748
+ ],
749
+ [
750
+ 'value' => 'SB',
751
+ 'text' => 'Solomon Islands',
752
+ ],
753
+ [
754
+ 'value' => 'SC',
755
+ 'text' => 'Seychelles',
756
+ ],
757
+ [
758
+ 'value' => 'SD',
759
+ 'text' => 'Sudan',
760
+ ],
761
+ [
762
+ 'value' => 'SE',
763
+ 'text' => 'Sweden',
764
+ ],
765
+ [
766
+ 'value' => 'SG',
767
+ 'text' => 'Singapore',
768
+ ],
769
+ [
770
+ 'value' => 'SH',
771
+ 'text' => 'Saint Helena',
772
+ ],
773
+ [
774
+ 'value' => 'SI',
775
+ 'text' => 'Slovenia',
776
+ ],
777
+ [
778
+ 'value' => 'SJ',
779
+ 'text' => 'Svalbard and Jan Mayen',
780
+ ],
781
+ [
782
+ 'value' => 'SK',
783
+ 'text' => 'Slovakia',
784
+ ],
785
+ [
786
+ 'value' => 'SL',
787
+ 'text' => 'Sierra Leone',
788
+ ],
789
+ [
790
+ 'value' => 'SM',
791
+ 'text' => 'San Marino',
792
+ ],
793
+ [
794
+ 'value' => 'SN',
795
+ 'text' => 'Senegal',
796
+ ],
797
+ [
798
+ 'value' => 'SO',
799
+ 'text' => 'Somalia',
800
+ ],
801
+ [
802
+ 'value' => 'SR',
803
+ 'text' => 'Suriname',
804
+ ],
805
+ [
806
+ 'value' => 'ST',
807
+ 'text' => 'Sao Tome and Principe',
808
+ ],
809
+ [
810
+ 'value' => 'SV',
811
+ 'text' => 'El Salvador',
812
+ ],
813
+ [
814
+ 'value' => 'SY',
815
+ 'text' => 'Syrian Arab Republic',
816
+ ],
817
+ [
818
+ 'value' => 'SZ',
819
+ 'text' => 'Swaziland',
820
+ ],
821
+ [
822
+ 'value' => 'TC',
823
+ 'text' => 'Turks and Caicos Islands',
824
+ ],
825
+ [
826
+ 'value' => 'TD',
827
+ 'text' => 'Chad',
828
+ ],
829
+ [
830
+ 'value' => 'TF',
831
+ 'text' => 'French Southern Territories',
832
+ ],
833
+ [
834
+ 'value' => 'TG',
835
+ 'text' => 'Togo',
836
+ ],
837
+ [
838
+ 'value' => 'TH',
839
+ 'text' => 'Thailand',
840
+ ],
841
+ [
842
+ 'value' => 'TJ',
843
+ 'text' => 'Tajikistan',
844
+ ],
845
+ [
846
+ 'value' => 'TK',
847
+ 'text' => 'Tokelau',
848
+ ],
849
+ [
850
+ 'value' => 'TM',
851
+ 'text' => 'Turkmenistan',
852
+ ],
853
+ [
854
+ 'value' => 'TN',
855
+ 'text' => 'Tunisia',
856
+ ],
857
+ [
858
+ 'value' => 'TO',
859
+ 'text' => 'Tonga',
860
+ ],
861
+ [
862
+ 'value' => 'TL',
863
+ 'text' => 'Timor-Leste',
864
+ ],
865
+ [
866
+ 'value' => 'TR',
867
+ 'text' => 'Turkey',
868
+ ],
869
+ [
870
+ 'value' => 'TT',
871
+ 'text' => 'Trinidad and Tobago',
872
+ ],
873
+ [
874
+ 'value' => 'TV',
875
+ 'text' => 'Tuvalu',
876
+ ],
877
+ [
878
+ 'value' => 'TW',
879
+ 'text' => 'Taiwan',
880
+ ],
881
+ [
882
+ 'value' => 'TZ',
883
+ 'text' => 'United Republic of Tanzania',
884
+ ],
885
+ [
886
+ 'value' => 'UA',
887
+ 'text' => 'Ukraine',
888
+ ],
889
+ [
890
+ 'value' => 'UG',
891
+ 'text' => 'Uganda',
892
+ ],
893
+ [
894
+ 'value' => 'UM',
895
+ 'text' => 'United States Minor Outlying Islands',
896
+ ],
897
+ [
898
+ 'value' => 'US',
899
+ 'text' => 'United States',
900
+ ],
901
+ [
902
+ 'value' => 'UY',
903
+ 'text' => 'Uruguay',
904
+ ],
905
+ [
906
+ 'value' => 'UZ',
907
+ 'text' => 'Uzbekistan',
908
+ ],
909
+ [
910
+ 'value' => 'VA',
911
+ 'text' => 'Holy See (Vatican City State)',
912
+ ],
913
+ [
914
+ 'value' => 'VC',
915
+ 'text' => 'Saint Vincent and the Grenadines',
916
+ ],
917
+ [
918
+ 'value' => 'VE',
919
+ 'text' => 'Venezuela',
920
+ ],
921
+ [
922
+ 'value' => 'VG',
923
+ 'text' => 'British Virgin Islands',
924
+ ],
925
+ [
926
+ 'value' => 'VI',
927
+ 'text' => 'U.S. Virgin Islands',
928
+ ],
929
+ [
930
+ 'value' => 'VN',
931
+ 'text' => 'Vietnam',
932
+ ],
933
+ [
934
+ 'value' => 'VU',
935
+ 'text' => 'Vanuatu',
936
+ ],
937
+ [
938
+ 'value' => 'WF',
939
+ 'text' => 'Wallis and Futuna',
940
+ ],
941
+ [
942
+ 'value' => 'WS',
943
+ 'text' => 'Samoa',
944
+ ],
945
+ [
946
+ 'value' => 'YE',
947
+ 'text' => 'Yemen',
948
+ ],
949
+ [
950
+ 'value' => 'YT',
951
+ 'text' => 'Mayotte',
952
+ ],
953
+ [
954
+ 'value' => 'RS',
955
+ 'text' => 'Serbia',
956
+ ],
957
+ [
958
+ 'value' => 'ZA',
959
+ 'text' => 'South Africa',
960
+ ],
961
+ [
962
+ 'value' => 'ZM',
963
+ 'text' => 'Zambia',
964
+ ],
965
+ [
966
+ 'value' => 'ME',
967
+ 'text' => 'Montenegro',
968
+ ],
969
+ [
970
+ 'value' => 'ZW',
971
+ 'text' => 'Zimbabwe',
972
+ ],
973
+ [
974
+ 'value' => 'AX',
975
+ 'text' => 'Aland Islands',
976
+ ],
977
+ [
978
+ 'value' => 'GG',
979
+ 'text' => 'Guernsey',
980
+ ],
981
+ [
982
+ 'value' => 'IM',
983
+ 'text' => 'Isle of Man',
984
+ ],
985
+ [
986
+ 'value' => 'JE',
987
+ 'text' => 'Jersey',
988
+ ],
989
+ [
990
+ 'value' => 'BL',
991
+ 'text' => 'Saint Barthelemy',
992
+ ],
993
+ [
994
+ 'value' => 'MF',
995
+ 'text' => 'Saint Martin',
996
+ ],
997
+ ];
998
+ array_multisort( array_column( $data, 'text' ), SORT_ASC, $data );
999
+ return $data;
1000
+ }
includes/defaults.php CHANGED
@@ -1,293 +1,299 @@
1
- <?php
2
- //add_action('init', 'quick_adsense_defaults_clear_data');
3
- function quick_adsense_defaults_clear_data() {
4
- if(isset($_GET['quick_adsense_1_X_clear_data'])) {
5
- delete_option('AdsDisp');
6
- delete_option('BegnAds');
7
- delete_option('BegnRnd');
8
- delete_option('MiddAds');
9
- delete_option('MiddRnd');
10
- delete_option('EndiAds');
11
- delete_option('EndiRnd');
12
- delete_option('MoreAds');
13
- delete_option('MoreRnd');
14
- delete_option('LapaAds');
15
- delete_option('LapaRnd');
16
- delete_option('Par1Ads');
17
- delete_option('Par1Rnd');
18
- delete_option('Par1Nup');
19
- delete_option('Par1Con');
20
- delete_option('Par2Ads');
21
- delete_option('Par2Rnd');
22
- delete_option('Par2Nup');
23
- delete_option('Par2Con');
24
- delete_option('Par3Ads');
25
- delete_option('Par3Rnd');
26
- delete_option('Par3Nup');
27
- delete_option('Par3Con');
28
- delete_option('Img1Ads');
29
- delete_option('Img1Rnd');
30
- delete_option('Img1Nup');
31
- delete_option('Img1Con');
32
- delete_option('AppPost');
33
- delete_option('AppPage');
34
- delete_option('AppHome');
35
- delete_option('AppCate');
36
- delete_option('AppArch');
37
- delete_option('AppTags');
38
- delete_option('AppMaxA');
39
- delete_option('AppSide');
40
- delete_option('AppLogg');
41
- delete_option('QckTags');
42
- delete_option('QckRnds');
43
- delete_option('QckOffs');
44
- delete_option('QckOfPs');
45
- delete_option('AdsCode1');
46
- delete_option('AdsAlign1');
47
- delete_option('AdsMargin1');
48
- delete_option('AdsCode2');
49
- delete_option('AdsAlign2');
50
- delete_option('AdsMargin2');
51
- delete_option('AdsCode3');
52
- delete_option('AdsAlign3');
53
- delete_option('AdsMargin3');
54
- delete_option('AdsCode4');
55
- delete_option('AdsAlign4');
56
- delete_option('AdsMargin4');
57
- delete_option('AdsCode5');
58
- delete_option('AdsAlign5');
59
- delete_option('AdsMargin5');
60
- delete_option('AdsCode6');
61
- delete_option('AdsAlign6');
62
- delete_option('AdsMargin6');
63
- delete_option('AdsCode7');
64
- delete_option('AdsAlign7');
65
- delete_option('AdsMargin7');
66
- delete_option('AdsCode8');
67
- delete_option('AdsAlign8');
68
- delete_option('AdsMargin8');
69
- delete_option('AdsCode9');
70
- delete_option('AdsAlign9');
71
- delete_option('AdsMargin9');
72
- delete_option('AdsCode10');
73
- delete_option('AdsAlign10');
74
- delete_option('AdsMargin10');
75
- delete_option('WidCode1');
76
- delete_option('WidCode2');
77
- delete_option('WidCode3');
78
- delete_option('WidCode4');
79
- delete_option('WidCode5');
80
- delete_option('WidCode6');
81
- delete_option('WidCode7');
82
- delete_option('WidCode8');
83
- delete_option('WidCode9');
84
- delete_option('WidCode10');
85
- wp_redirect(esc_url(admin_url('/admin.php?page=quick-adsense')));
86
- }
87
-
88
- if(isset($_GET['quick_adsense_2_0_clear_data'])) {
89
- delete_option('quick_adsense_2_options');
90
- wp_redirect(esc_url(admin_url('/admin.php?page=quick-adsense')));
91
- }
92
-
93
- if(isset($_GET['quick_adsense_2_1_clear_data'])) {
94
- delete_option('quick_adsense_settings');
95
- wp_redirect(esc_url(admin_url('/admin.php?page=quick-adsense')));
96
- }
97
- }
98
-
99
- add_action('init', 'quick_adsense_defaults_init');
100
- function quick_adsense_defaults_init() {
101
- $settings = get_option('quick_adsense_settings');
102
- if(isset($settings) && is_array($settings)) { // Existing 2.1+ User
103
- return;
104
- } else { // New User OR V2.0 User OR V1.X User
105
- $quickAdsense2 = get_option('quick_adsense_2_options');
106
- if(isset($quickAdsense2) && is_array($quickAdsense2) && (count($quickAdsense2) > 1)) { // V2.0 User
107
- $settings = quick_adsense_get_defaults();
108
- if(isset($quickAdsense2['AdsDisp']) && ($quickAdsense2['AdsDisp'] != '')) { $settings['max_ads_per_page'] = $quickAdsense2['AdsDisp']; }
109
-
110
- if(isset($quickAdsense2['BegnAds']) && ($quickAdsense2['BegnAds'] != '')) { $settings['enable_position_beginning_of_post'] = '1'; }
111
- if(isset($quickAdsense2['BegnRnd']) && ($quickAdsense2['BegnRnd'] != '')) { $settings['ad_beginning_of_post'] = $quickAdsense2['BegnRnd']; }
112
- if(isset($quickAdsense2['MiddAds']) && ($quickAdsense2['MiddAds'] != '')) { $settings['enable_position_middle_of_post'] = '1'; }
113
- if(isset($quickAdsense2['MiddRnd']) && ($quickAdsense2['MiddRnd'] != '')) { $settings['ad_middle_of_post'] = $quickAdsense2['MiddRnd']; }
114
- if(isset($quickAdsense2['EndiAds']) && ($quickAdsense2['EndiAds'] != '')) { $settings['enable_position_end_of_post'] = '1'; }
115
- if(isset($quickAdsense2['EndiRnd']) && ($quickAdsense2['EndiRnd'] != '')) { $settings['ad_end_of_post'] = $quickAdsense2['EndiRnd']; }
116
-
117
- if(isset($quickAdsense2['MoreAds']) && ($quickAdsense2['MoreAds'] != '')) { $settings['enable_position_after_more_tag'] = '1'; }
118
- if(isset($quickAdsense2['MoreRnd']) && ($quickAdsense2['MoreRnd'] != '')) { $settings['ad_after_more_tag'] = $quickAdsense2['MoreRnd']; }
119
- if(isset($quickAdsense2['LapaAds']) && ($quickAdsense2['LapaAds'] != '')) { $settings['enable_position_before_last_para'] = '1'; }
120
- if(isset($quickAdsense2['LapaRnd']) && ($quickAdsense2['LapaRnd'] != '')) { $settings['ad_before_last_para'] = $quickAdsense2['LapaRnd']; }
121
-
122
- for($i = 1; $i <= 3; $i++) {
123
- if(isset($quickAdsense2['Par'.$i.'Ads']) && ($quickAdsense2['Par'.$i.'Ads'] != '')) { $settings['enable_position_after_para_option_'.$i] = '1'; }
124
- if(isset($quickAdsense2['Par'.$i.'Rnd']) && ($quickAdsense2['Par'.$i.'Rnd'] != '')) { $settings['ad_after_para_option_'.$i] = $quickAdsense2['Par'.$i.'Rnd']; }
125
- if(isset($quickAdsense2['Par'.$i.'Nup']) && ($quickAdsense2['Par'.$i.'Nup'] != '')) { $settings['position_after_para_option_'.$i] = $quickAdsense2['Par'.$i.'Nup']; }
126
- if(isset($quickAdsense2['Par'.$i.'Con']) && ($quickAdsense2['Par'.$i.'Con'] != '')) { $settings['enable_jump_position_after_para_option_'.$i] = '1'; }
127
- }
128
-
129
- for($i = 1; $i <= 1; $i++) {
130
- if(isset($quickAdsense2['Img'.$i.'Ads']) && ($quickAdsense2['Img'.$i.'Ads'] != '')) { $settings['enable_position_after_image_option_'.$i] = '1'; }
131
- if(isset($quickAdsense2['Img'.$i.'Rnd']) && ($quickAdsense2['Img'.$i.'Rnd'] != '')) { $settings['ad_after_image_option_'.$i] = $quickAdsense2['Img'.$i.'Rnd']; }
132
- if(isset($quickAdsense2['Img'.$i.'Nup']) && ($quickAdsense2['Img'.$i.'Nup'] != '')) { $settings['position_after_image_option_'.$i] = $quickAdsense2['Img'.$i.'Nup']; }
133
- if(isset($quickAdsense2['Img'.$i.'Con']) && ($quickAdsense2['Img'.$i.'Con'] != '')) { $settings['enable_jump_position_after_image_option_'.$i] = '1'; }
134
- }
135
-
136
- if(isset($quickAdsense2['AppPost']) && ($quickAdsense2['AppPost'] != '')) { $settings['enable_on_posts'] = '1'; }
137
- if(isset($quickAdsense2['AppPage']) && ($quickAdsense2['AppPage'] != '')) { $settings['enable_on_pages'] = '1'; }
138
-
139
- if(isset($quickAdsense2['AppHome']) && ($quickAdsense2['AppHome'] != '')) { $settings['enable_on_homepage'] = '1'; }
140
- if(isset($quickAdsense2['AppCate']) && ($quickAdsense2['AppCate'] != '')) { $settings['enable_on_categories'] = '1'; }
141
- if(isset($quickAdsense2['AppArch']) && ($quickAdsense2['AppArch'] != '')) { $settings['enable_on_archives'] = '1'; }
142
- if(isset($quickAdsense2['AppTags']) && ($quickAdsense2['AppTags'] != '')) { $settings['enable_on_tags'] = '1'; }
143
- if(isset($quickAdsense2['AppMaxA']) && ($quickAdsense2['AppMaxA'] != '')) { $settings['enable_all_possible_ads'] = '1'; }
144
-
145
- if(isset($quickAdsense2['AppSide']) && ($quickAdsense2['AppSide'] != '')) { $settings['disable_widgets_on_homepage'] = '1'; }
146
-
147
- if(isset($quickAdsense2['AppLogg']) && ($quickAdsense2['AppLogg'] != '')) { $settings['disable_for_loggedin_users'] = '1'; }
148
-
149
- if(isset($quickAdsense2['QckTags']) && ($quickAdsense2['QckTags'] != '')) { $settings['enable_quicktag_buttons'] = '1'; }
150
- if(isset($quickAdsense2['QckRnds']) && ($quickAdsense2['QckRnds'] != '')) { $settings['disable_randomads_quicktag_button'] = '1'; }
151
- if(isset($quickAdsense2['QckOffs']) && ($quickAdsense2['QckOffs'] != '')) { $settings['disable_disablead_quicktag_buttons'] = '1'; }
152
- if(isset($quickAdsense2['QckOfPs']) && ($quickAdsense2['QckOfPs'] != '')) { $settings['disable_positionad_quicktag_buttons'] = '1'; }
153
-
154
- for($i = 1; $i <= 10; $i++) {
155
- if(isset($quickAdsense2['AdsCode'.$i]) && ($quickAdsense2['AdsCode'.$i] != '')) { $settings['onpost_ad_'.$i.'_content'] = $quickAdsense2['AdsCode'.$i]; }
156
- if(isset($quickAdsense2['AdsAlign'.$i]) && ($quickAdsense2['AdsAlign'.$i] != '')) { $settings['onpost_ad_'.$i.'_alignment'] = $quickAdsense2['AdsAlign'.$i]; }
157
- if(isset($quickAdsense2['AdsMargin'.$i]) && ($quickAdsense2['AdsMargin'.$i] != '')) { $settings['onpost_ad_'.$i.'_margin'] = $quickAdsense2['AdsMargin'.$i]; }
158
-
159
- if(isset($quickAdsense2['WidCode'.$i]) && ($quickAdsense2['WidCode'.$i] != '')) { $settings['widget_ad_'.$i.'_content'] = $quickAdsense2['WidCode'.$i]; }
160
- }
161
- update_option('quick_adsense_settings', $settings);
162
- update_option('quick_adsense_2_options_bak', $quickAdsense2);
163
- delete_option('quick_adsense_2_options');
164
- } else { // New User OR V1.X User
165
- $quickAdsense1AdsDisp = get_option('AdsDisp');
166
- if(isset($quickAdsense1AdsDisp) && in_array($quickAdsense1AdsDisp, array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10'))) { // V1.X User
167
- $settings = quick_adsense_get_defaults();
168
- $temp = get_option('AdsDisp'); if(isset($temp) && ($temp != '')) { $settings['max_ads_per_page'] = $temp; }
169
-
170
- $temp = get_option('BegnAds'); if(isset($temp) && ($temp != '')) { $settings['enable_position_beginning_of_post'] = '1'; }
171
- $temp = get_option('BegnRnd'); if(isset($temp) && ($temp != '')) { $settings['ad_beginning_of_post'] = $temp; }
172
- $temp = get_option('MiddAds'); if(isset($temp) && ($temp != '')) { $settings['enable_position_middle_of_post'] = '1'; }
173
- $temp = get_option('MiddRnd'); if(isset($temp) && ($temp != '')) { $settings['ad_middle_of_post'] = $temp; }
174
- $temp = get_option('EndiAds'); if(isset($temp) && ($temp != '')) { $settings['enable_position_end_of_post'] = '1'; }
175
- $temp = get_option('EndiRnd'); if(isset($temp) && ($temp != '')) { $settings['ad_end_of_post'] = $temp; }
176
-
177
- $temp = get_option('MoreAds'); if(isset($temp) && ($temp != '')) { $settings['enable_position_after_more_tag'] = '1'; }
178
- $temp = get_option('MoreRnd'); if(isset($temp) && ($temp != '')) { $settings['ad_after_more_tag'] = $temp; }
179
- $temp = get_option('LapaAds'); if(isset($temp) && ($temp != '')) { $settings['enable_position_before_last_para'] = '1'; }
180
- $temp = get_option('LapaRnd'); if(isset($temp) && ($temp != '')) { $settings['ad_before_last_para'] = $temp; }
181
-
182
- for($i = 1; $i <= 3; $i++) {
183
- $temp = get_option('Par'.$i.'Ads'); if(isset($temp) && ($temp != '')) { $settings['enable_position_after_para_option_'.$i] = '1'; }
184
- $temp = get_option('Par'.$i.'Rnd'); if(isset($temp) && ($temp != '')) { $settings['ad_after_para_option_'.$i] = $temp; }
185
- $temp = get_option('Par'.$i.'Nup'); if(isset($temp) && ($temp != '')) { $settings['position_after_para_option_'.$i] = $temp; }
186
- $temp = get_option('Par'.$i.'Con'); if(isset($temp) && ($temp != '')) { $settings['enable_jump_position_after_para_option_'.$i] = '1'; }
187
- }
188
-
189
- for($i = 1; $i <= 1; $i++) {
190
- $temp = get_option('Img'.$i.'Ads'); if(isset($temp) && ($temp != '')) { $settings['enable_position_after_image_option_'.$i] = '1'; }
191
- $temp = get_option('Img'.$i.'Rnd'); if(isset($temp) && ($temp != '')) { $settings['ad_after_image_option_'.$i] = $temp; }
192
- $temp = get_option('Img'.$i.'Nup'); if(isset($temp) && ($temp != '')) { $settings['position_after_image_option_'.$i] = $temp; }
193
- $temp = get_option('Img'.$i.'Con'); if(isset($temp) && ($temp != '')) { $settings['enable_jump_position_after_image_option_'.$i] = '1'; }
194
- }
195
-
196
- $temp = get_option('AppPost'); if(isset($temp) && ($temp != '')) { $settings['enable_on_posts'] = '1'; }
197
- $temp = get_option('AppPage'); if(isset($temp) && ($temp != '')) { $settings['enable_on_pages'] = '1'; }
198
-
199
- $temp = get_option('AppHome'); if(isset($temp) && ($temp != '')) { $settings['enable_on_homepage'] = '1'; }
200
- $temp = get_option('AppCate'); if(isset($temp) && ($temp != '')) { $settings['enable_on_categories'] = '1'; }
201
- $temp = get_option('AppArch'); if(isset($temp) && ($temp != '')) { $settings['enable_on_archives'] = '1'; }
202
- $temp = get_option('AppTags'); if(isset($temp) && ($temp != '')) { $settings['enable_on_tags'] = '1'; }
203
- $temp = get_option('AppMaxA'); if(isset($temp) && ($temp != '')) { $settings['enable_all_possible_ads'] = '1'; }
204
-
205
- $temp = get_option('AppSide'); if(isset($temp) && ($temp != '')) { $settings['disable_widgets_on_homepage'] = '1'; }
206
-
207
- $temp = get_option('AppLogg'); if(isset($temp) && ($temp != '')) { $settings['disable_for_loggedin_users'] = '1'; }
208
-
209
- $temp = get_option('QckTags'); if(isset($temp) && ($temp != '')) { $settings['enable_quicktag_buttons'] = '1'; }
210
- $temp = get_option('QckRnds'); if(isset($temp) && ($temp != '')) { $settings['disable_randomads_quicktag_button'] = '1'; }
211
- $temp = get_option('QckOffs'); if(isset($temp) && ($temp != '')) { $settings['disable_disablead_quicktag_buttons'] = '1'; }
212
- $temp = get_option('QckOfPs'); if(isset($temp) && ($temp != '')) { $settings['disable_positionad_quicktag_buttons'] = '1'; }
213
-
214
- for($i = 1; $i <= 10; $i++) {
215
- $temp = get_option('AdsCode'.$i); if(isset($temp)) { $settings['onpost_ad_'.$i.'_content'] = $temp; }
216
- $temp = get_option('AdsAlign'.$i); if(isset($temp) && ($temp != '')) { $settings['onpost_ad_'.$i.'_alignment'] = $temp; }
217
- $temp = get_option('AdsMargin'.$i); if(isset($temp) && ($temp != '')) { $settings['onpost_ad_'.$i.'_margin'] = $temp; }
218
-
219
- $temp = get_option('WidCode'.$i); if(isset($temp)) { $settings['widget_ad_'.$i.'_content'] = $temp; }
220
- }
221
-
222
- update_option('quick_adsense_settings', $settings);
223
- delete_option('AdsDisp');
224
- } else { // New User
225
- update_option('quick_adsense_settings', quick_adsense_get_defaults());
226
- }
227
- }
228
- }
229
- }
230
-
231
- function quick_adsense_get_defaults() {
232
- $settings = array();
233
-
234
- $settings['max_ads_per_page'] = '3';
235
-
236
- $settings['enable_position_beginning_of_post'] = '1';
237
- $settings['ad_beginning_of_post'] = '1';
238
- $settings['enable_position_middle_of_post'] = '0';
239
- $settings['ad_middle_of_post'] = '0';
240
- $settings['enable_position_end_of_post'] = '1';
241
- $settings['ad_end_of_post'] = '0';
242
-
243
- $settings['enable_position_after_more_tag'] = '0';
244
- $settings['ad_after_more_tag'] = '0';
245
- $settings['enable_position_before_last_para'] = '0';
246
- $settings['ad_before_last_para'] = '0';
247
-
248
- for($i = 1; $i <= 3; $i++) {
249
- $settings['enable_position_after_para_option_'.$i] = '0';
250
- $settings['ad_after_para_option_'.$i] = '0';
251
- $settings['position_after_para_option_'.$i] = '1';
252
- $settings['enable_jump_position_after_para_option_'.$i] = '0';
253
- }
254
-
255
- for($i = 1; $i <= 1; $i++) {
256
- $settings['enable_position_after_image_option_'.$i] = '0';
257
- $settings['ad_after_image_option_'.$i] = '0';
258
- $settings['position_after_image_option_'.$i] = '1';
259
- $settings['enable_jump_position_after_image_option_'.$i] = '0';
260
- }
261
-
262
- $settings['enable_on_posts'] = '1';
263
- $settings['enable_on_pages'] = '1';
264
-
265
- $settings['enable_on_homepage'] = '0';
266
- $settings['enable_on_categories'] = '0';
267
- $settings['enable_on_archives'] = '0';
268
- $settings['enable_on_tags'] = '0';
269
- $settings['enable_all_possible_ads'] = '0';
270
-
271
- $settings['disable_widgets_on_homepage'] = '0';
272
-
273
- $settings['disable_for_loggedin_users'] = '0';
274
-
275
- $settings['enable_quicktag_buttons'] = '1';
276
- $settings['disable_randomads_quicktag_button'] = '0';
277
- $settings['disable_disablead_quicktag_buttons'] = '0';
278
- $settings['disable_positionad_quicktag_buttons'] = '0';
279
-
280
- $settings['onpost_enable_global_style'] = '0';
281
- $settings['onpost_global_alignment'] = '2';
282
- $settings['onpost_global_margin'] = '10';
283
-
284
- for($i = 1; $i <= 10; $i++) {
285
- $settings['onpost_ad_'.$i.'_content'] = '';
286
- $settings['onpost_ad_'.$i.'_alignment'] = '2';
287
- $settings['onpost_ad_'.$i.'_margin'] = '10';
288
-
289
- $settings['widget_ad_'.$i.'_content'] = '';
290
- }
291
- return $settings;
292
- }
293
- ?>
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The default settings for the plugin.
4
+ */
5
+ function quick_adsense_get_defaults() {
6
+ $settings = [];
7
+
8
+ $settings['max_ads_per_page'] = '3';
9
+
10
+ $settings['enable_position_beginning_of_post'] = '1';
11
+ $settings['ad_beginning_of_post'] = '1';
12
+ $settings['enable_position_middle_of_post'] = '0';
13
+ $settings['ad_middle_of_post'] = '0';
14
+ $settings['enable_position_end_of_post'] = '1';
15
+ $settings['ad_end_of_post'] = '0';
16
+
17
+ $settings['enable_position_after_more_tag'] = '0';
18
+ $settings['ad_after_more_tag'] = '0';
19
+ $settings['enable_position_before_last_para'] = '0';
20
+ $settings['ad_before_last_para'] = '0';
21
+
22
+ for ( $i = 1; $i <= 3; $i++ ) {
23
+ $settings[ 'enable_position_after_para_option_' . $i ] = '0';
24
+ $settings[ 'ad_after_para_option_' . $i ] = '0';
25
+ $settings[ 'position_after_para_option_' . $i ] = '1';
26
+ $settings[ 'enable_jump_position_after_para_option_' . $i ] = '0';
27
+ }
28
+
29
+ for ( $i = 1; $i <= 1; $i++ ) {
30
+ $settings[ 'enable_position_after_image_option_' . $i ] = '0';
31
+ $settings[ 'ad_after_image_option_' . $i ] = '0';
32
+ $settings[ 'position_after_image_option_' . $i ] = '1';
33
+ $settings[ 'enable_jump_position_after_image_option_' . $i ] = '0';
34
+ }
35
+
36
+ $settings['enable_on_posts'] = '1';
37
+ $settings['enable_on_pages'] = '1';
38
+
39
+ $settings['enable_on_homepage'] = '0';
40
+ $settings['enable_on_categories'] = '0';
41
+ $settings['enable_on_archives'] = '0';
42
+ $settings['enable_on_tags'] = '0';
43
+ $settings['enable_all_possible_ads'] = '0';
44
+
45
+ $settings['disable_widgets_on_homepage'] = '0';
46
+
47
+ $settings['disable_for_loggedin_users'] = '0';
48
+
49
+ $settings['enable_quicktag_buttons'] = '1';
50
+ $settings['disable_randomads_quicktag_button'] = '0';
51
+ $settings['disable_disablead_quicktag_buttons'] = '0';
52
+ $settings['disable_positionad_quicktag_buttons'] = '0';
53
+
54
+ $settings['onpost_enable_global_style'] = '0';
55
+ $settings['onpost_global_alignment'] = '2';
56
+ $settings['onpost_global_margin'] = '10';
57
+
58
+ for ( $i = 1; $i <= 10; $i++ ) {
59
+ $settings[ 'onpost_ad_' . $i . '_content' ] = '';
60
+ $settings[ 'onpost_ad_' . $i . '_alignment' ] = '2';
61
+ $settings[ 'onpost_ad_' . $i . '_margin' ] = '10';
62
+
63
+ $settings[ 'widget_ad_' . $i . '_content' ] = '';
64
+ }
65
+ return $settings;
66
+ }
67
+
68
+ /**
69
+ * Action to update the settings storage for previous versions of the plugin.
70
+ */
71
+ add_action(
72
+ 'init',
73
+ function() {
74
+ $settings = get_option( 'quick_adsense_settings' );
75
+ if ( isset( $settings ) && is_array( $settings ) ) {
76
+ // Existing 2.1+ User.
77
+ return;
78
+ } else {
79
+ // New User OR V2.0 User OR V1.X User.
80
+ $quick_adsense_2_settings = get_option( 'quick_adsense_2_options' );
81
+ if ( isset( $quick_adsense_2_settings ) && is_array( $quick_adsense_2_settings ) && ( count( $quick_adsense_2_settings ) > 1 ) ) {
82
+ // V2.0 User.
83
+ $settings = quick_adsense_get_defaults();
84
+
85
+ $settings['max_ads_per_page'] = quick_adsense_get_value( $quick_adsense_2_settings, 'AdsDisp', $settings['max_ads_per_page'] );
86
+
87
+ if ( false !== quick_adsense_get_value( $quick_adsense_2_settings, 'BegnAds', false ) ) {
88
+ $settings['enable_position_beginning_of_post'] = '1';
89
+ }
90
+ $settings['ad_beginning_of_post'] = quick_adsense_get_value( $quick_adsense_2_settings, 'BegnRnd', $settings['ad_beginning_of_post'] );
91
+ if ( false !== quick_adsense_get_value( $quick_adsense_2_settings, 'MiddAds', false ) ) {
92
+ $settings['enable_position_middle_of_post'] = '1';
93
+ }
94
+ $settings['ad_middle_of_post'] = quick_adsense_get_value( $quick_adsense_2_settings, 'MiddRnd', $settings['ad_middle_of_post'] );
95
+ if ( false !== quick_adsense_get_value( $quick_adsense_2_settings, 'EndiAds', false ) ) {
96
+ $settings['enable_position_end_of_post'] = '1';
97
+ }
98
+ $settings['ad_end_of_post'] = quick_adsense_get_value( $quick_adsense_2_settings, 'EndiRnd', $settings['ad_end_of_post'] );
99
+
100
+ if ( false !== quick_adsense_get_value( $quick_adsense_2_settings, 'MoreAds', false ) ) {
101
+ $settings['enable_position_after_more_tag'] = '1';
102
+ }
103
+ $settings['ad_after_more_tag'] = quick_adsense_get_value( $quick_adsense_2_settings, 'MoreRnd', $settings['ad_after_more_tag'] );
104
+
105
+ if ( false !== quick_adsense_get_value( $quick_adsense_2_settings, 'LapaAds', false ) ) {
106
+ $settings['enable_position_before_last_para'] = '1';
107
+ }
108
+ $settings['ad_before_last_para'] = quick_adsense_get_value( $quick_adsense_2_settings, 'LapaRnd', $settings['ad_before_last_para'] );
109
+
110
+ for ( $i = 1; $i <= 3; $i++ ) {
111
+ if ( false !== quick_adsense_get_value( $quick_adsense_2_settings, 'Par' . $i . 'Ads', false ) ) {
112
+ $settings[ 'enable_position_after_para_option_' . $i ] = '1';
113
+ }
114
+ if ( false !== quick_adsense_get_value( $quick_adsense_2_settings, 'Par' . $i . 'Rnd', false ) ) {
115
+ $settings[ 'ad_after_para_option_' . $i ] = '1';
116
+ }
117
+ if ( false !== quick_adsense_get_value( $quick_adsense_2_settings, 'Par' . $i . 'Nup', false ) ) {
118
+ $settings[ 'position_after_para_option_' . $i ] = '1';
119
+ }
120
+ if ( false !== quick_adsense_get_value( $quick_adsense_2_settings, 'Par' . $i . 'Con', false ) ) {
121
+ $settings[ 'enable_jump_position_after_para_option_' . $i ] = '1';
122
+ }
123
+ }
124
+
125
+ for ( $i = 1; $i <= 1; $i++ ) {
126
+ if ( false !== quick_adsense_get_value( $quick_adsense_2_settings, 'Img' . $i . 'Ads', false ) ) {
127
+ $settings[ 'enable_position_after_image_option_' . $i ] = '1';
128
+ }
129
+ if ( false !== quick_adsense_get_value( $quick_adsense_2_settings, 'Img' . $i . 'Rnd', false ) ) {
130
+ $settings[ 'ad_after_image_option_' . $i ] = '1';
131
+ }
132
+ if ( false !== quick_adsense_get_value( $quick_adsense_2_settings, 'Img' . $i . 'Nup', false ) ) {
133
+ $settings[ 'position_after_image_option_' . $i ] = '1';
134
+ }
135
+ if ( false !== quick_adsense_get_value( $quick_adsense_2_settings, 'Img' . $i . 'Con', false ) ) {
136
+ $settings[ 'enable_jump_position_after_image_option_' . $i ] = '1';
137
+ }
138
+ }
139
+
140
+ if ( false !== quick_adsense_get_value( $quick_adsense_2_settings, 'AppPost', false ) ) {
141
+ $settings['enable_on_posts'] = '1';
142
+ }
143
+ if ( false !== quick_adsense_get_value( $quick_adsense_2_settings, 'AppPage', false ) ) {
144
+ $settings['enable_on_pages'] = '1';
145
+ }
146
+
147
+ if ( false !== quick_adsense_get_value( $quick_adsense_2_settings, 'AppHome', false ) ) {
148
+ $settings['enable_on_homepage'] = '1';
149
+ }
150
+ if ( false !== quick_adsense_get_value( $quick_adsense_2_settings, 'AppCate', false ) ) {
151
+ $settings['enable_on_categories'] = '1';
152
+ }
153
+ if ( false !== quick_adsense_get_value( $quick_adsense_2_settings, 'AppArch', false ) ) {
154
+ $settings['enable_on_archives'] = '1';
155
+ }
156
+ if ( false !== quick_adsense_get_value( $quick_adsense_2_settings, 'AppTags', false ) ) {
157
+ $settings['enable_on_tags'] = '1';
158
+ }
159
+ if ( false !== quick_adsense_get_value( $quick_adsense_2_settings, 'AppMaxA', false ) ) {
160
+ $settings['enable_all_possible_ads'] = '1';
161
+ }
162
+
163
+ if ( false !== quick_adsense_get_value( $quick_adsense_2_settings, 'AppSide', false ) ) {
164
+ $settings['disable_widgets_on_homepage'] = '1';
165
+ }
166
+
167
+ if ( false !== quick_adsense_get_value( $quick_adsense_2_settings, 'AppLogg', false ) ) {
168
+ $settings['disable_for_loggedin_users'] = '1';
169
+ }
170
+
171
+ if ( false !== quick_adsense_get_value( $quick_adsense_2_settings, 'QckTags', false ) ) {
172
+ $settings['enable_quicktag_buttons'] = '1';
173
+ }
174
+ if ( false !== quick_adsense_get_value( $quick_adsense_2_settings, 'QckRnds', false ) ) {
175
+ $settings['disable_randomads_quicktag_button'] = '1';
176
+ }
177
+ if ( false !== quick_adsense_get_value( $quick_adsense_2_settings, 'QckOffs', false ) ) {
178
+ $settings['disable_disablead_quicktag_buttons'] = '1';
179
+ }
180
+ if ( false !== quick_adsense_get_value( $quick_adsense_2_settings, 'QckOfPs', false ) ) {
181
+ $settings['disable_positionad_quicktag_buttons'] = '1';
182
+ }
183
+
184
+ for ( $i = 1; $i <= 10; $i++ ) {
185
+ $settings[ 'onpost_ad_' . $i . '_content' ] = quick_adsense_get_value( $quick_adsense_2_settings, 'AdsCode' . $i, $settings[ 'onpost_ad_' . $i . '_content' ] );
186
+ $settings[ 'onpost_ad_' . $i . '_alignment' ] = quick_adsense_get_value( $quick_adsense_2_settings, 'AdsAdsAlignMargin' . $i, $settings[ 'onpost_ad_' . $i . '_alignment' ] );
187
+ $settings[ 'onpost_ad_' . $i . '_margin' ] = quick_adsense_get_value( $quick_adsense_2_settings, 'AdsMargin' . $i, $settings[ 'onpost_ad_' . $i . '_margin' ] );
188
+
189
+ $settings[ 'widget_ad_' . $i . '_content' ] = quick_adsense_get_value( $quick_adsense_2_settings, 'WidCode' . $i, $settings[ 'widget_ad_' . $i . '_content' ] );
190
+ }
191
+ update_option( 'quick_adsense_settings', $settings );
192
+ update_option( 'quick_adsense_2_options_bak', $quick_adsense_2_settings );
193
+ delete_option( 'quick_adsense_2_options' );
194
+ } else {
195
+ // New User or V1.X User.
196
+ $quick_adsense_1_ads_disp = get_option( 'AdsDisp' );
197
+ if ( isset( $quick_adsense_1_ads_disp ) && in_array( $quick_adsense_1_ads_disp, [ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10' ], true ) ) {
198
+ // V1.X User.
199
+ $settings = quick_adsense_get_defaults();
200
+ $settings['max_ads_per_page'] = get_option( 'AdsDisp', $settings['max_ads_per_page'] );
201
+
202
+ if ( false !== get_option( 'BegnAds' ) ) {
203
+ $settings['enable_position_beginning_of_post'] = '1';
204
+ }
205
+ $settings['ad_beginning_of_post'] = get_option( 'BegnRnd', $settings['ad_beginning_of_post'] );
206
+ if ( false !== get_option( 'MiddAds' ) ) {
207
+ $settings['enable_position_middle_of_post'] = '1';
208
+ }
209
+ $settings['ad_middle_of_post'] = get_option( 'MiddRnd', $settings['ad_middle_of_post'] );
210
+ if ( false !== get_option( 'EndiAds' ) ) {
211
+ $settings['enable_position_end_of_post'] = '1';
212
+ }
213
+ $settings['ad_end_of_post'] = get_option( 'EndiRnd', $settings['ad_end_of_post'] );
214
+
215
+ if ( false !== get_option( 'MoreAds' ) ) {
216
+ $settings['enable_position_after_more_tag'] = '1';
217
+ }
218
+ $settings['ad_after_more_tag'] = get_option( 'MoreRnd', $settings['ad_after_more_tag'] );
219
+ if ( false !== get_option( 'LapaAds' ) ) {
220
+ $settings['enable_position_before_last_para'] = '1';
221
+ }
222
+ $settings['ad_before_last_para'] = get_option( 'LapaRnd', $settings['ad_before_last_para'] );
223
+
224
+ for ( $i = 1; $i <= 3; $i++ ) {
225
+ $settings[ 'enable_position_after_para_option_' . $i ] = get_option( 'Par' . $i . 'Ads', $settings[ 'enable_position_after_para_option_' . $i ] );
226
+ $settings[ 'ad_after_para_option_' . $i ] = get_option( 'Par' . $i . 'Rnd', $settings[ 'ad_after_para_option_' . $i ] );
227
+ $settings[ 'position_after_para_option_' . $i ] = get_option( 'Par' . $i . 'Nup', $settings[ 'position_after_para_option_' . $i ] );
228
+ $settings[ 'enable_jump_position_after_para_option_' . $i ] = get_option( 'Par' . $i . 'Con', $settings[ 'enable_jump_position_after_para_option_' . $i ] );
229
+ }
230
+
231
+ for ( $i = 1; $i <= 1; $i++ ) {
232
+ $settings[ 'enable_position_after_image_option_' . $i ] = get_option( 'Img' . $i . 'Ads', $settings[ 'enable_position_after_image_option_' . $i ] );
233
+ $settings[ 'ad_after_image_option_' . $i ] = get_option( 'Img' . $i . 'Rnd', $settings[ 'ad_after_image_option_' . $i ] );
234
+ $settings[ 'position_after_image_option_' . $i ] = get_option( 'Img' . $i . 'Nup', $settings[ 'position_after_image_option_' . $i ] );
235
+ $settings[ 'enable_jump_position_after_image_option_' . $i ] = get_option( 'Img' . $i . 'Con', $settings[ 'enable_jump_position_after_image_option_' . $i ] );
236
+ }
237
+
238
+ if ( false !== get_option( 'AppPost' ) ) {
239
+ $settings['enable_on_posts'] = '1';
240
+ }
241
+ if ( false !== get_option( 'AppPage' ) ) {
242
+ $settings['enable_on_pages'] = '1';
243
+ }
244
+
245
+ if ( false !== get_option( 'AppHome' ) ) {
246
+ $settings['enable_on_homepage'] = '1';
247
+ }
248
+ if ( false !== get_option( 'AppCate' ) ) {
249
+ $settings['enable_on_categories'] = '1';
250
+ }
251
+ if ( false !== get_option( 'AppArch' ) ) {
252
+ $settings['enable_on_archives'] = '1';
253
+ }
254
+ if ( false !== get_option( 'AppTags' ) ) {
255
+ $settings['enable_on_tags'] = '1';
256
+ }
257
+ if ( false !== get_option( 'AppMaxA' ) ) {
258
+ $settings['enable_all_possible_ads'] = '1';
259
+ }
260
+
261
+ if ( false !== get_option( 'AppSide' ) ) {
262
+ $settings['disable_widgets_on_homepage'] = '1';
263
+ }
264
+
265
+ if ( false !== get_option( 'AppLogg' ) ) {
266
+ $settings['disable_for_loggedin_users'] = '1';
267
+ }
268
+
269
+ if ( false !== get_option( 'QckTags' ) ) {
270
+ $settings['enable_quicktag_buttons'] = '1';
271
+ }
272
+ if ( false !== get_option( 'QckRnds' ) ) {
273
+ $settings['disable_randomads_quicktag_button'] = '1';
274
+ }
275
+ if ( false !== get_option( 'QckOffs' ) ) {
276
+ $settings['disable_disablead_quicktag_buttons'] = '1';
277
+ }
278
+ if ( false !== get_option( 'QckOfPs' ) ) {
279
+ $settings['disable_positionad_quicktag_buttons'] = '1';
280
+ }
281
+
282
+ for ( $i = 1; $i <= 10; $i++ ) {
283
+ $settings[ 'onpost_ad_' . $i . '_content' ] = get_option( 'AdsCode' . $i, $settings[ 'onpost_ad_' . $i . '_content' ] );
284
+ $settings[ 'onpost_ad_' . $i . '_alignment' ] = get_option( 'AdsAlign' . $i, $settings[ 'onpost_ad_' . $i . '_alignment' ] );
285
+ $settings[ 'onpost_ad_' . $i . '_margin' ] = get_option( 'AdsMargin' . $i, $settings[ 'onpost_ad_' . $i . '_margin' ] );
286
+
287
+ $settings[ 'widget_ad_' . $i . '_content' ] = get_option( 'WidCode' . $i, $settings[ 'widget_ad_' . $i . '_content' ] );
288
+ }
289
+
290
+ update_option( 'quick_adsense_settings', $settings );
291
+ delete_option( 'AdsDisp' );
292
+ } else {
293
+ // New User.
294
+ update_option( 'quick_adsense_settings', quick_adsense_get_defaults() );
295
+ }
296
+ }
297
+ }
298
+ }
299
+ );
includes/images/adpushup-970x250-red.png DELETED
Binary file
includes/images/advertisement-preview.png DELETED
Binary file
includes/images/ajax-loader-flat.gif DELETED
Binary file
includes/images/jquery.minicolors.png DELETED
Binary file
includes/images/privacy.png DELETED
Binary file
includes/js/gdpr.js DELETED
@@ -1,198 +0,0 @@
1
- /* Begin IAB API V 1.1 Implementation */
2
- var __vicmp = (function () {
3
- return typeof (__vicmp) == "function" ? __vicmp : function (c) {
4
- var b = arguments;
5
- if (!b.length) {
6
- return __vicmp.a;
7
- }
8
- else if (c == '__vicmp') {
9
- return false;
10
- } else {
11
- if (typeof __vicmp.a === 'undefined') {
12
- __vicmp.a = [];
13
- }
14
- __vicmp.a.push([].slice.apply(b));
15
- if(typeof __vicmp.execute != 'undefined') {
16
- __vicmp.execute(b);
17
- }
18
- }
19
- }
20
- })();
21
-
22
- function quick_adsense_vi_consent_onload_cmp() {
23
- if(typeof __vicmp.execute === 'undefined') {
24
- __vicmp.execute = function(b) {
25
- var data = {};
26
- if(typeof b != 'undefined') {
27
- if(b[0] == 'getUserConsentStatus') {
28
- var ViconsentCookie = quick_adsense_vi_consent_popup_get_cookie('Viconsent');
29
- var gdprStatus = false;
30
- if(document.getElementById('quick_adsense_vi_consent_popup_is_eu').value == '1') {
31
- gdprStatus = true;
32
- }
33
- if(ViconsentCookie != '') {
34
- var ViconsentCookieData = quick_adsense_vi_consent_popup_decode_cookie_content(ViconsentCookie);
35
- data = {
36
- gdprApplies: gdprStatus,
37
- hasGlobalScope: false,
38
- consent: ViconsentCookieData['PurposeAllowed'][1],
39
- }
40
- } else { // Cookie Missing / Corrupted
41
- data = {
42
- gdprApplies: gdprStatus,
43
- hasGlobalScope: false,
44
- consent: false,
45
- }
46
- }
47
- }
48
- b[2](data, true);
49
- }
50
- };
51
-
52
- if(__vicmp.a && typeof func === 'undefined') {
53
- for(var i=0; i<__vicmp.a.length;i++) {
54
- __vicmp.execute(__vicmp.a[i]);
55
- }
56
- }
57
- }
58
- }
59
-
60
- //setTimeout(quick_adsense_vi_consent_onload_cmp, 500);
61
- quick_adsense_vi_consent_onload_cmp();
62
- /* End IAB API V 1.1 Implementation */
63
-
64
- /* Begin Consent Cookie Implementation */
65
- function quick_adsense_vi_consent_popup_disagree() {
66
- var cookieData = quick_adsense_vi_consent_popup_create_cookie_content('000000000000000000000000');
67
- quick_adsense_vi_consent_popup_set_cookie('Viconsent', cookieData);
68
-
69
- var ajaxFrame = document.createElement('iframe');
70
- ajaxFrame.src = document.getElementById('quick_adsense_vi_consent_popup_url').value + '?quick_adsense_vi_consent=' + document.getElementById('quick_adsense_vi_consent_popup_auth').value;
71
- ajaxFrame.style.display = 'none';
72
- document.getElementById('quick_adsense_vi_consent_popup_wrapper').appendChild(ajaxFrame);
73
- document.getElementById('quick_adsense_vi_consent_popup_wrapper').style.display = 'none';
74
- document.getElementById('quick_adsense_vi_consent_popup_overlay').style.display = 'none';
75
- document.getElementById('quick_adsense_vi_consent_popup_settings_button').style.display = 'block';
76
- }
77
-
78
- function quick_adsense_vi_consent_popup_agree() {
79
- var quick_adsense_vi_consent_popup_vendor_list_purposes = document.getElementById('quick_adsense_vi_consent_popup_vendor_list_purposes').value;
80
- var cookieData = quick_adsense_vi_consent_popup_create_cookie_content(quick_adsense_vi_consent_popup_vendor_list_purposes);
81
- quick_adsense_vi_consent_popup_set_cookie('Viconsent', cookieData);
82
-
83
- var ajaxFrame = document.createElement('iframe');
84
- ajaxFrame.src = document.getElementById('quick_adsense_vi_consent_popup_url').value + '?quick_adsense_vi_consent=' + document.getElementById('quick_adsense_vi_consent_popup_auth').value;
85
- ajaxFrame.style.display = 'none';
86
- document.getElementById('quick_adsense_vi_consent_popup_wrapper').appendChild(ajaxFrame);
87
- document.getElementById('quick_adsense_vi_consent_popup_wrapper').style.display = 'none';
88
- document.getElementById('quick_adsense_vi_consent_popup_overlay').style.display = 'none';
89
- document.getElementById('quick_adsense_vi_consent_popup_settings_button').style.display = 'block';
90
- }
91
-
92
- function quick_adsense_vi_consent_popup_create_cookie_content(purposeAllowed) {
93
- cookieConsentTimeStamp = Math.round((new Date()).getTime()/100);
94
- var cookieConsent = new Object();
95
- cookieConsent['Version'] = quick_adsense_vi_consent_popup_create_binary_string(1, 6);
96
- cookieConsent['Created'] = quick_adsense_vi_consent_popup_create_binary_string(cookieConsentTimeStamp, 36);
97
- cookieConsent['LastUpdated'] = quick_adsense_vi_consent_popup_create_binary_string(cookieConsentTimeStamp, 36);
98
- cookieConsent['CMPId'] = quick_adsense_vi_consent_popup_create_binary_string(999, 12);
99
- cookieConsent['CMPVersion'] = quick_adsense_vi_consent_popup_create_binary_string(0, 6);
100
- cookieConsent['ConsentScreen'] = quick_adsense_vi_consent_popup_create_binary_string(0, 6);
101
- cookieConsent['ConsentLanguage'] = quick_adsense_vi_consent_popup_create_binary_string(4, 6)+quick_adsense_vi_consent_popup_create_binary_string(13, 6);
102
- var quick_adsense_vi_consent_popup_vendor_list_version = parseInt(document.getElementById('quick_adsense_vi_consent_popup_vendor_list_version').value);
103
- cookieConsent['VendorListVersion'] = quick_adsense_vi_consent_popup_create_binary_string(quick_adsense_vi_consent_popup_vendor_list_version, 12);
104
- cookieConsent['PurposeAllowed'] = purposeAllowed;
105
-
106
- return window.btoa(cookieConsent['Version'] + cookieConsent['Created'] + cookieConsent['LastUpdated'] + cookieConsent['CMPId'] + cookieConsent['CMPVersion'] + cookieConsent['ConsentScreen'] + cookieConsent['ConsentLanguage'] + cookieConsent['VendorListVersion'] + cookieConsent['PurposeAllowed']);
107
- }
108
-
109
- function quick_adsense_vi_consent_popup_decode_cookie_content(cookieData) {
110
- if(cookieData != '') {
111
- var binaryCookieData = atob(cookieData);
112
- var cookieConsent = new Object();
113
- cookieConsent['Version'] = parseInt(binaryCookieData.substring(0, 6), 2);
114
- cookieConsent['Created'] = parseInt(binaryCookieData.substring(6, 42), 2);
115
- cookieConsent['LastUpdated'] = parseInt(binaryCookieData.substring(42, 78), 2);
116
- cookieConsent['CMPId'] = parseInt(binaryCookieData.substring(78, 90), 2);
117
- cookieConsent['CMPVersion'] = parseInt(binaryCookieData.substring(90, 96), 2);
118
- cookieConsent['ConsentScreen'] = parseInt(binaryCookieData.substring(96, 102), 2);
119
- cookieConsent['ConsentLanguage'] = parseInt(binaryCookieData.substring(102, 108), 2)+''+parseInt(binaryCookieData.substring(106, 114), 2);
120
- cookieConsent['VendorListVersion'] = parseInt(binaryCookieData.substring(114,126), 2);
121
- cookieConsent['PurposeAllowed'] = binaryCookieData.substring(126, 150);
122
-
123
- var purposeConsents = new Object();
124
- for(var i = 24; i > 0; i--) {
125
- if(cookieConsent['PurposeAllowed'].substring(i - 1, i) == '1') {
126
- purposeConsents[(24 - i) + 1] = true;
127
- } else {
128
- purposeConsents[(24 - i) + 1] = false;
129
- }
130
- }
131
- cookieConsent['PurposeAllowed'] = purposeConsents;
132
- return cookieConsent;
133
- }
134
- return false;
135
- }
136
-
137
- function quick_adsense_vi_consent_popup_create_binary_string(dMask, dBitSize) {
138
- var bMask = "";
139
- if(dBitSize <= 32) {
140
- while(dBitSize--) {
141
- bMask += (dMask >> dBitSize) & 1;
142
- }
143
- } else {
144
- bMask = dMask.toString(2);
145
- while (bMask.length < dBitSize) {
146
- bMask = "0" + bMask;
147
- }
148
- }
149
- return bMask;
150
- }
151
-
152
- function quick_adsense_vi_consent_popup_set_cookie(name, value) {
153
- var date = new Date();
154
- date.setTime(date.getTime() + (365*24*60*60*1000));
155
- document.cookie = name + "=" + value + ";" + "expires=" + date.toUTCString() + ";path=/";
156
- }
157
-
158
- function quick_adsense_vi_consent_popup_get_cookie(cookieName) {
159
- var name = cookieName + "=";
160
- var decodedCookie = decodeURIComponent(document.cookie);
161
- var ca = decodedCookie.split(';');
162
- for(var i = 0; i <ca.length; i++) {
163
- var c = ca[i];
164
- while (c.charAt(0) == ' ') {
165
- c = c.substring(1);
166
- }
167
- if (c.indexOf(name) == 0) {
168
- return c.substring(name.length, c.length);
169
- }
170
- }
171
- return "";
172
- }
173
-
174
- function quick_adsense_vi_consent_popup_settings() {
175
- document.getElementById('quick_adsense_vi_consent_popup_wrapper').style.display = 'block';
176
- document.getElementById('quick_adsense_vi_consent_popup_overlay').style.display = 'block';
177
- document.getElementById('quick_adsense_vi_consent_popup_settings_button').style.display = 'none';
178
- }
179
-
180
- function quick_adsense_vi_consent_popup_load() {
181
- if(document.getElementById('quick_adsense_vi_consent_popup_is_eu').value == true) {
182
- if(quick_adsense_vi_consent_popup_get_cookie('Viconsent') == false) {
183
- document.getElementById('quick_adsense_vi_consent_popup_wrapper').style.display = 'block';
184
- document.getElementById('quick_adsense_vi_consent_popup_overlay').style.display = 'block';
185
- document.getElementById('quick_adsense_vi_consent_popup_settings_button').style.display = 'none';
186
- } else {
187
- document.getElementById('quick_adsense_vi_consent_popup_wrapper').style.display = 'none';
188
- document.getElementById('quick_adsense_vi_consent_popup_overlay').style.display = 'none';
189
- document.getElementById('quick_adsense_vi_consent_popup_settings_button').style.display = 'block';
190
- }
191
- } else {
192
- document.getElementById('quick_adsense_vi_consent_popup_wrapper').style.display = 'none';
193
- document.getElementById('quick_adsense_vi_consent_popup_overlay').style.display = 'none';
194
- document.getElementById('quick_adsense_vi_consent_popup_settings_button').style.display = 'none';
195
- }
196
- }
197
- setTimeout(quick_adsense_vi_consent_popup_load, 500);
198
- /* End Consent Cookie Implementation */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/js/jquery.minicolors.js DELETED
@@ -1,1108 +0,0 @@
1
- //
2
- // jQuery MiniColors: A tiny color picker built on jQuery
3
- //
4
- // Developed by Cory LaViska for A Beautiful Site, LLC
5
- //
6
- // Licensed under the MIT license: http://opensource.org/licenses/MIT
7
- //
8
- (function (factory) {
9
- if(typeof define === 'function' && define.amd) {
10
- // AMD. Register as an anonymous module.
11
- define(['jquery'], factory);
12
- } else if(typeof exports === 'object') {
13
- // Node/CommonJS
14
- module.exports = factory(require('jquery'));
15
- } else {
16
- // Browser globals
17
- factory(jQuery);
18
- }
19
- }(function ($) {
20
- 'use strict';
21
-
22
- // Defaults
23
- $.minicolors = {
24
- defaults: {
25
- animationSpeed: 50,
26
- animationEasing: 'swing',
27
- change: null,
28
- changeDelay: 0,
29
- control: 'hue',
30
- defaultValue: '',
31
- format: 'hex',
32
- hide: null,
33
- hideSpeed: 100,
34
- inline: false,
35
- keywords: '',
36
- letterCase: 'lowercase',
37
- opacity: false,
38
- position: 'bottom left',
39
- show: null,
40
- showSpeed: 100,
41
- theme: 'default',
42
- swatches: []
43
- }
44
- };
45
-
46
- // Public methods
47
- $.extend($.fn, {
48
- minicolors: function(method, data) {
49
-
50
- switch(method) {
51
- // Destroy the control
52
- case 'destroy':
53
- $(this).each(function() {
54
- destroy($(this));
55
- });
56
- return $(this);
57
-
58
- // Hide the color picker
59
- case 'hide':
60
- hide();
61
- return $(this);
62
-
63
- // Get/set opacity
64
- case 'opacity':
65
- // Getter
66
- if(data === undefined) {
67
- // Getter
68
- return $(this).attr('data-opacity');
69
- } else {
70
- // Setter
71
- $(this).each(function() {
72
- updateFromInput($(this).attr('data-opacity', data));
73
- });
74
- }
75
- return $(this);
76
-
77
- // Get an RGB(A) object based on the current color/opacity
78
- case 'rgbObject':
79
- return rgbObject($(this), method === 'rgbaObject');
80
-
81
- // Get an RGB(A) string based on the current color/opacity
82
- case 'rgbString':
83
- case 'rgbaString':
84
- return rgbString($(this), method === 'rgbaString');
85
-
86
- // Get/set settings on the fly
87
- case 'settings':
88
- if(data === undefined) {
89
- return $(this).data('minicolors-settings');
90
- } else {
91
- // Setter
92
- $(this).each(function() {
93
- var settings = $(this).data('minicolors-settings') || {};
94
- destroy($(this));
95
- $(this).minicolors($.extend(true, settings, data));
96
- });
97
- }
98
- return $(this);
99
-
100
- // Show the color picker
101
- case 'show':
102
- show($(this).eq(0));
103
- return $(this);
104
-
105
- // Get/set the hex color value
106
- case 'value':
107
- if(data === undefined) {
108
- // Getter
109
- return $(this).val();
110
- } else {
111
- // Setter
112
- $(this).each(function() {
113
- if(typeof(data) === 'object' && data !== null) {
114
- if(data.opacity) {
115
- $(this).attr('data-opacity', keepWithin(data.opacity, 0, 1));
116
- }
117
- if(data.color) {
118
- $(this).val(data.color);
119
- }
120
- } else {
121
- $(this).val(data);
122
- }
123
- updateFromInput($(this));
124
- });
125
- }
126
- return $(this);
127
-
128
- // Initializes the control
129
- default:
130
- if(method !== 'create') data = method;
131
- $(this).each(function() {
132
- init($(this), data);
133
- });
134
- return $(this);
135
-
136
- }
137
-
138
- }
139
- });
140
-
141
- // Initialize input elements
142
- function init(input, settings) {
143
- var minicolors = $('<div class="minicolors" />');
144
- var defaults = $.minicolors.defaults;
145
- var size;
146
- var swatches;
147
- var swatch;
148
- var panel;
149
- var i;
150
-
151
- // Do nothing if already initialized
152
- if(input.data('minicolors-initialized')) return;
153
-
154
- // Handle settings
155
- settings = $.extend(true, {}, defaults, settings);
156
-
157
- // The wrapper
158
- minicolors
159
- .addClass('minicolors-theme-' + settings.theme)
160
- .toggleClass('minicolors-with-opacity', settings.opacity);
161
-
162
- // Custom positioning
163
- if(settings.position !== undefined) {
164
- $.each(settings.position.split(' '), function() {
165
- minicolors.addClass('minicolors-position-' + this);
166
- });
167
- }
168
-
169
- // Input size
170
- if(settings.format === 'rgb') {
171
- size = settings.opacity ? '25' : '20';
172
- } else {
173
- size = settings.keywords ? '11' : '7';
174
- }
175
-
176
- // The input
177
- input
178
- .addClass('minicolors-input')
179
- .data('minicolors-initialized', false)
180
- .data('minicolors-settings', settings)
181
- .prop('size', size)
182
- .wrap(minicolors)
183
- .after(
184
- '<div class="minicolors-panel minicolors-slider-' + settings.control + '">' +
185
- '<div class="minicolors-slider minicolors-sprite">' +
186
- '<div class="minicolors-picker"></div>' +
187
- '</div>' +
188
- '<div class="minicolors-opacity-slider minicolors-sprite">' +
189
- '<div class="minicolors-picker"></div>' +
190
- '</div>' +
191
- '<div class="minicolors-grid minicolors-sprite">' +
192
- '<div class="minicolors-grid-inner"></div>' +
193
- '<div class="minicolors-picker"><div></div></div>' +
194
- '</div>' +
195
- '</div>'
196
- );
197
-
198
- // The swatch
199
- if(!settings.inline) {
200
- input.after('<span class="minicolors-swatch minicolors-sprite minicolors-input-swatch"><span class="minicolors-swatch-color"></span></span>');
201
- input.next('.minicolors-input-swatch').on('click', function(event) {
202
- event.preventDefault();
203
- input.focus();
204
- });
205
- }
206
-
207
- // Prevent text selection in IE
208
- panel = input.parent().find('.minicolors-panel');
209
- panel.on('selectstart', function() { return false; }).end();
210
-
211
- // Swatches
212
- if(settings.swatches && settings.swatches.length !== 0) {
213
- panel.addClass('minicolors-with-swatches');
214
- swatches = $('<ul class="minicolors-swatches"></ul>')
215
- .appendTo(panel);
216
- for(i = 0; i < settings.swatches.length; ++i) {
217
- swatch = settings.swatches[i];
218
- swatch = isRgb(swatch) ? parseRgb(swatch, true) : hex2rgb(parseHex(swatch, true));
219
- $('<li class="minicolors-swatch minicolors-sprite"><span class="minicolors-swatch-color"></span></li>')
220
- .appendTo(swatches)
221
- .data('swatch-color', settings.swatches[i])
222
- .find('.minicolors-swatch-color')
223
- .css({
224
- backgroundColor: rgb2hex(swatch),
225
- opacity: swatch.a
226
- });
227
- settings.swatches[i] = swatch;
228
- }
229
- }
230
-
231
- // Inline controls
232
- if(settings.inline) input.parent().addClass('minicolors-inline');
233
-
234
- updateFromInput(input, false);
235
-
236
- input.data('minicolors-initialized', true);
237
- }
238
-
239
- // Returns the input back to its original state
240
- function destroy(input) {
241
- var minicolors = input.parent();
242
-
243
- // Revert the input element
244
- input
245
- .removeData('minicolors-initialized')
246
- .removeData('minicolors-settings')
247
- .removeProp('size')
248
- .removeClass('minicolors-input');
249
-
250
- // Remove the wrap and destroy whatever remains
251
- minicolors.before(input).remove();
252
- }
253
-
254
- // Shows the specified dropdown panel
255
- function show(input) {
256
- var minicolors = input.parent();
257
- var panel = minicolors.find('.minicolors-panel');
258
- var settings = input.data('minicolors-settings');
259
-
260
- // Do nothing if uninitialized, disabled, inline, or already open
261
- if(
262
- !input.data('minicolors-initialized') ||
263
- input.prop('disabled') ||
264
- minicolors.hasClass('minicolors-inline') ||
265
- minicolors.hasClass('minicolors-focus')
266
- ) return;
267
-
268
- hide();
269
-
270
- minicolors.addClass('minicolors-focus');
271
- panel
272
- .stop(true, true)
273
- .fadeIn(settings.showSpeed, function() {
274
- if(settings.show) settings.show.call(input.get(0));
275
- });
276
- }
277
-
278
- // Hides all dropdown panels
279
- function hide() {
280
- $('.minicolors-focus').each(function() {
281
- var minicolors = $(this);
282
- var input = minicolors.find('.minicolors-input');
283
- var panel = minicolors.find('.minicolors-panel');
284
- var settings = input.data('minicolors-settings');
285
-
286
- panel.fadeOut(settings.hideSpeed, function() {
287
- if(settings.hide) settings.hide.call(input.get(0));
288
- minicolors.removeClass('minicolors-focus');
289
- });
290
-
291
- });
292
- }
293
-
294
- // Moves the selected picker
295
- function move(target, event, animate) {
296
- var input = target.parents('.minicolors').find('.minicolors-input');
297
- var settings = input.data('minicolors-settings');
298
- var picker = target.find('[class$=-picker]');
299
- var offsetX = target.offset().left;
300
- var offsetY = target.offset().top;
301
- var x = Math.round(event.pageX - offsetX);
302
- var y = Math.round(event.pageY - offsetY);
303
- var duration = animate ? settings.animationSpeed : 0;
304
- var wx, wy, r, phi;
305
-
306
- // Touch support
307
- if(event.originalEvent.changedTouches) {
308
- x = event.originalEvent.changedTouches[0].pageX - offsetX;
309
- y = event.originalEvent.changedTouches[0].pageY - offsetY;
310
- }
311
-
312
- // Constrain picker to its container
313
- if(x < 0) x = 0;
314
- if(y < 0) y = 0;
315
- if(x > target.width()) x = target.width();
316
- if(y > target.height()) y = target.height();
317
-
318
- // Constrain color wheel values to the wheel
319
- if(target.parent().is('.minicolors-slider-wheel') && picker.parent().is('.minicolors-grid')) {
320
- wx = 75 - x;
321
- wy = 75 - y;
322
- r = Math.sqrt(wx * wx + wy * wy);
323
- phi = Math.atan2(wy, wx);
324
- if(phi < 0) phi += Math.PI * 2;
325
- if(r > 75) {
326
- r = 75;
327
- x = 75 - (75 * Math.cos(phi));
328
- y = 75 - (75 * Math.sin(phi));
329
- }
330
- x = Math.round(x);
331
- y = Math.round(y);
332
- }
333
-
334
- // Move the picker
335
- if(target.is('.minicolors-grid')) {
336
- picker
337
- .stop(true)
338
- .animate({
339
- top: y + 'px',
340
- left: x + 'px'
341
- }, duration, settings.animationEasing, function() {
342
- updateFromControl(input, target);
343
- });
344
- } else {
345
- picker
346
- .stop(true)
347
- .animate({
348
- top: y + 'px'
349
- }, duration, settings.animationEasing, function() {
350
- updateFromControl(input, target);
351
- });
352
- }
353
- }
354
-
355
- // Sets the input based on the color picker values
356
- function updateFromControl(input, target) {
357
-
358
- function getCoords(picker, container) {
359
- var left, top;
360
- if(!picker.length || !container) return null;
361
- left = picker.offset().left;
362
- top = picker.offset().top;
363
-
364
- return {
365
- x: left - container.offset().left + (picker.outerWidth() / 2),
366
- y: top - container.offset().top + (picker.outerHeight() / 2)
367
- };
368
- }
369
-
370
- var hue, saturation, brightness, x, y, r, phi;
371
- var hex = input.val();
372
- var opacity = input.attr('data-opacity');
373
-
374
- // Helpful references
375
- var minicolors = input.parent();
376
- var settings = input.data('minicolors-settings');
377
- var swatch = minicolors.find('.minicolors-input-swatch');
378
-
379
- // Panel objects
380
- var grid = minicolors.find('.minicolors-grid');
381
- var slider = minicolors.find('.minicolors-slider');
382
- var opacitySlider = minicolors.find('.minicolors-opacity-slider');
383
-
384
- // Picker objects
385
- var gridPicker = grid.find('[class$=-picker]');
386
- var sliderPicker = slider.find('[class$=-picker]');
387
- var opacityPicker = opacitySlider.find('[class$=-picker]');
388
-
389
- // Picker positions
390
- var gridPos = getCoords(gridPicker, grid);
391
- var sliderPos = getCoords(sliderPicker, slider);
392
- var opacityPos = getCoords(opacityPicker, opacitySlider);
393
-
394
- // Handle colors
395
- if(target.is('.minicolors-grid, .minicolors-slider, .minicolors-opacity-slider')) {
396
-
397
- // Determine HSB values
398
- switch(settings.control) {
399
- case 'wheel':
400
- // Calculate hue, saturation, and brightness
401
- x = (grid.width() / 2) - gridPos.x;
402
- y = (grid.height() / 2) - gridPos.y;
403
- r = Math.sqrt(x * x + y * y);
404
- phi = Math.atan2(y, x);
405
- if(phi < 0) phi += Math.PI * 2;
406
- if(r > 75) {
407
- r = 75;
408
- gridPos.x = 69 - (75 * Math.cos(phi));
409
- gridPos.y = 69 - (75 * Math.sin(phi));
410
- }
411
- saturation = keepWithin(r / 0.75, 0, 100);
412
- hue = keepWithin(phi * 180 / Math.PI, 0, 360);
413
- brightness = keepWithin(100 - Math.floor(sliderPos.y * (100 / slider.height())), 0, 100);
414
- hex = hsb2hex({
415
- h: hue,
416
- s: saturation,
417
- b: brightness
418
- });
419
-
420
- // Update UI
421
- slider.css('backgroundColor', hsb2hex({ h: hue, s: saturation, b: 100 }));
422
- break;
423
-
424
- case 'saturation':
425
- // Calculate hue, saturation, and brightness
426
- hue = keepWithin(parseInt(gridPos.x * (360 / grid.width()), 10), 0, 360);
427
- saturation = keepWithin(100 - Math.floor(sliderPos.y * (100 / slider.height())), 0, 100);
428
- brightness = keepWithin(100 - Math.floor(gridPos.y * (100 / grid.height())), 0, 100);
429
- hex = hsb2hex({
430
- h: hue,
431
- s: saturation,
432
- b: brightness
433
- });
434
-
435
- // Update UI
436
- slider.css('backgroundColor', hsb2hex({ h: hue, s: 100, b: brightness }));
437
- minicolors.find('.minicolors-grid-inner').css('opacity', saturation / 100);
438
- break;
439
-
440
- case 'brightness':
441
- // Calculate hue, saturation, and brightness
442
- hue = keepWithin(parseInt(gridPos.x * (360 / grid.width()), 10), 0, 360);
443
- saturation = keepWithin(100 - Math.floor(gridPos.y * (100 / grid.height())), 0, 100);
444
- brightness = keepWithin(100 - Math.floor(sliderPos.y * (100 / slider.height())), 0, 100);
445
- hex = hsb2hex({
446
- h: hue,
447
- s: saturation,
448
- b: brightness
449
- });
450
-
451
- // Update UI
452
- slider.css('backgroundColor', hsb2hex({ h: hue, s: saturation, b: 100 }));
453
- minicolors.find('.minicolors-grid-inner').css('opacity', 1 - (brightness / 100));
454
- break;
455
-
456
- default:
457
- // Calculate hue, saturation, and brightness
458
- hue = keepWithin(360 - parseInt(sliderPos.y * (360 / slider.height()), 10), 0, 360);
459
- saturation = keepWithin(Math.floor(gridPos.x * (100 / grid.width())), 0, 100);
460
- brightness = keepWithin(100 - Math.floor(gridPos.y * (100 / grid.height())), 0, 100);
461
- hex = hsb2hex({
462
- h: hue,
463
- s: saturation,
464
- b: brightness
465
- });
466
-
467
- // Update UI
468
- grid.css('backgroundColor', hsb2hex({ h: hue, s: 100, b: 100 }));
469
- break;
470
- }
471
-
472
- // Handle opacity
473
- if(settings.opacity) {
474
- opacity = parseFloat(1 - (opacityPos.y / opacitySlider.height())).toFixed(2);
475
- } else {
476
- opacity = 1;
477
- }
478
-
479
- updateInput(input, hex, opacity);
480
- }
481
- else {
482
- // Set swatch color
483
- swatch.find('span').css({
484
- backgroundColor: hex,
485
- opacity: opacity
486
- });
487
-
488
- // Handle change event
489
- doChange(input, hex, opacity);
490
- }
491
- }
492
-
493
- // Sets the value of the input and does the appropriate conversions
494
- // to respect settings, also updates the swatch
495
- function updateInput(input, value, opacity) {
496
- var rgb;
497
-
498
- // Helpful references
499
- var minicolors = input.parent();
500
- var settings = input.data('minicolors-settings');
501
- var swatch = minicolors.find('.minicolors-input-swatch');
502
-
503
- if(settings.opacity) input.attr('data-opacity', opacity);
504
-
505
- // Set color string
506
- if(settings.format === 'rgb') {
507
- // Returns RGB(A) string
508
-
509
- // Checks for input format and does the conversion
510
- if(isRgb(value)) {
511
- rgb = parseRgb(value, true);
512
- }
513
- else {
514
- rgb = hex2rgb(parseHex(value, true));
515
- }
516
-
517
- opacity = input.attr('data-opacity') === '' ? 1 : keepWithin(parseFloat(input.attr('data-opacity')).toFixed(2), 0, 1);
518
- if(isNaN(opacity) || !settings.opacity) opacity = 1;
519
-
520
- if(input.minicolors('rgbObject').a <= 1 && rgb && settings.opacity) {
521
- // Set RGBA string if alpha
522
- value = 'rgba(' + rgb.r + ', ' + rgb.g + ', ' + rgb.b + ', ' + parseFloat(opacity) + ')';
523
- } else {
524
- // Set RGB string (alpha = 1)
525
- value = 'rgb(' + rgb.r + ', ' + rgb.g + ', ' + rgb.b + ')';
526
- }
527
- } else {
528
- // Returns hex color
529
-
530
- // Checks for input format and does the conversion
531
- if(isRgb(value)) {
532
- value = rgbString2hex(value);
533
- }
534
-
535
- value = convertCase(value, settings.letterCase);
536
- }
537
-
538
- // Update value from picker
539
- input.val(value);
540
-
541
- // Set swatch color
542
- swatch.find('span').css({
543
- backgroundColor: value,
544
- opacity: opacity
545
- });
546
-
547
- // Handle change event
548
- doChange(input, value, opacity);
549
- }
550
-
551
- // Sets the color picker values from the input
552
- function updateFromInput(input, preserveInputValue) {
553
- var hex, hsb, opacity, keywords, alpha, value, x, y, r, phi;
554
-
555
- // Helpful references
556
- var minicolors = input.parent();
557
- var settings = input.data('minicolors-settings');
558
- var swatch = minicolors.find('.minicolors-input-swatch');
559
-
560
- // Panel objects
561
- var grid = minicolors.find('.minicolors-grid');
562
- var slider = minicolors.find('.minicolors-slider');
563
- var opacitySlider = minicolors.find('.minicolors-opacity-slider');
564
-
565
- // Picker objects
566
- var gridPicker = grid.find('[class$=-picker]');
567
- var sliderPicker = slider.find('[class$=-picker]');
568
- var opacityPicker = opacitySlider.find('[class$=-picker]');
569
-
570
- // Determine hex/HSB values
571
- if(isRgb(input.val())) {
572
- // If input value is a rgb(a) string, convert it to hex color and update opacity
573
- hex = rgbString2hex(input.val());
574
- alpha = keepWithin(parseFloat(getAlpha(input.val())).toFixed(2), 0, 1);
575
- if(alpha) {
576
- input.attr('data-opacity', alpha);
577
- }
578
- } else {
579
- hex = convertCase(parseHex(input.val(), true), settings.letterCase);
580
- }
581
-
582
- if(!hex){
583
- hex = convertCase(parseInput(settings.defaultValue, true), settings.letterCase);
584
- }
585
- hsb = hex2hsb(hex);
586
-
587
- // Get array of lowercase keywords
588
- keywords = !settings.keywords ? [] : $.map(settings.keywords.split(','), function(a) {
589
- return $.trim(a.toLowerCase());
590
- });
591
-
592
- // Set color string
593
- if(input.val() !== '' && $.inArray(input.val().toLowerCase(), keywords) > -1) {
594
- value = convertCase(input.val());
595
- } else {
596
- value = isRgb(input.val()) ? parseRgb(input.val()) : hex;
597
- }
598
-
599
- // Update input value
600
- if(!preserveInputValue) input.val(value);
601
-
602
- // Determine opacity value
603
- if(settings.opacity) {
604
- // Get from data-opacity attribute and keep within 0-1 range
605
- opacity = input.attr('data-opacity') === '' ? 1 : keepWithin(parseFloat(input.attr('data-opacity')).toFixed(2), 0, 1);
606
- if(isNaN(opacity)) opacity = 1;
607
- input.attr('data-opacity', opacity);
608
- swatch.find('span').css('opacity', opacity);
609
-
610
- // Set opacity picker position
611
- y = keepWithin(opacitySlider.height() - (opacitySlider.height() * opacity), 0, opacitySlider.height());
612
- opacityPicker.css('top', y + 'px');
613
- }
614
-
615
- // Set opacity to zero if input value is transparent
616
- if(input.val().toLowerCase() === 'transparent') {
617
- swatch.find('span').css('opacity', 0);
618
- }
619
-
620
- // Update swatch
621
- swatch.find('span').css('backgroundColor', hex);
622
-
623
- // Determine picker locations
624
- switch(settings.control) {
625
- case 'wheel':
626
- // Set grid position
627
- r = keepWithin(Math.ceil(hsb.s * 0.75), 0, grid.height() / 2);
628
- phi = hsb.h * Math.PI / 180;
629
- x = keepWithin(75 - Math.cos(phi) * r, 0, grid.width());
630
- y = keepWithin(75 - Math.sin(phi) * r, 0, grid.height());
631
- gridPicker.css({
632
- top: y + 'px',
633
- left: x + 'px'
634
- });
635
-
636
- // Set slider position
637
- y = 150 - (hsb.b / (100 / grid.height()));
638
- if(hex === '') y = 0;
639
- sliderPicker.css('top', y + 'px');
640
-
641
- // Update panel color
642
- slider.css('backgroundColor', hsb2hex({ h: hsb.h, s: hsb.s, b: 100 }));
643
- break;
644
-
645
- case 'saturation':
646
- // Set grid position
647
- x = keepWithin((5 * hsb.h) / 12, 0, 150);
648
- y = keepWithin(grid.height() - Math.ceil(hsb.b / (100 / grid.height())), 0, grid.height());
649
- gridPicker.css({
650
- top: y + 'px',
651
- left: x + 'px'
652
- });
653
-
654
- // Set slider position
655
- y = keepWithin(slider.height() - (hsb.s * (slider.height() / 100)), 0, slider.height());
656
- sliderPicker.css('top', y + 'px');
657
-
658
- // Update UI
659
- slider.css('backgroundColor', hsb2hex({ h: hsb.h, s: 100, b: hsb.b }));
660
- minicolors.find('.minicolors-grid-inner').css('opacity', hsb.s / 100);
661
- break;
662
-
663
- case 'brightness':
664
- // Set grid position
665
- x = keepWithin((5 * hsb.h) / 12, 0, 150);
666
- y = keepWithin(grid.height() - Math.ceil(hsb.s / (100 / grid.height())), 0, grid.height());
667
- gridPicker.css({
668
- top: y + 'px',
669
- left: x + 'px'
670
- });
671
-
672
- // Set slider position
673
- y = keepWithin(slider.height() - (hsb.b * (slider.height() / 100)), 0, slider.height());
674
- sliderPicker.css('top', y + 'px');
675
-
676
- // Update UI
677
- slider.css('backgroundColor', hsb2hex({ h: hsb.h, s: hsb.s, b: 100 }));
678
- minicolors.find('.minicolors-grid-inner').css('opacity', 1 - (hsb.b / 100));
679
- break;
680
-
681
- default:
682
- // Set grid position
683
- x = keepWithin(Math.ceil(hsb.s / (100 / grid.width())), 0, grid.width());
684
- y = keepWithin(grid.height() - Math.ceil(hsb.b / (100 / grid.height())), 0, grid.height());
685
- gridPicker.css({
686
- top: y + 'px',
687
- left: x + 'px'
688
- });
689
-
690
- // Set slider position
691
- y = keepWithin(slider.height() - (hsb.h / (360 / slider.height())), 0, slider.height());
692
- sliderPicker.css('top', y + 'px');
693
-
694
- // Update panel color
695
- grid.css('backgroundColor', hsb2hex({ h: hsb.h, s: 100, b: 100 }));
696
- break;
697
- }
698
-
699
- // Fire change event, but only if minicolors is fully initialized
700
- if(input.data('minicolors-initialized')) {
701
- doChange(input, value, opacity);
702
- }
703
- }
704
-
705
- // Runs the change and changeDelay callbacks
706
- function doChange(input, value, opacity) {
707
- var settings = input.data('minicolors-settings');
708
- var lastChange = input.data('minicolors-lastChange');
709
- var obj, sel, i;
710
-
711
- // Only run if it actually changed
712
- if(!lastChange || lastChange.value !== value || lastChange.opacity !== opacity) {
713
-
714
- // Remember last-changed value
715
- input.data('minicolors-lastChange', {
716
- value: value,
717
- opacity: opacity
718
- });
719
-
720
- // Check and select applicable swatch
721
- if(settings.swatches && settings.swatches.length !== 0) {
722
- if(!isRgb(value)) {
723
- obj = hex2rgb(value);
724
- }
725
- else {
726
- obj = parseRgb(value, true);
727
- }
728
- sel = -1;
729
- for(i = 0; i < settings.swatches.length; ++i) {
730
- if(obj.r === settings.swatches[i].r && obj.g === settings.swatches[i].g && obj.b === settings.swatches[i].b && obj.a === settings.swatches[i].a) {
731
- sel = i;
732
- break;
733
- }
734
- }
735
-
736
- input.parent().find('.minicolors-swatches .minicolors-swatch').removeClass('selected');
737
- if(sel !== -1) {
738
- input.parent().find('.minicolors-swatches .minicolors-swatch').eq(i).addClass('selected');
739
- }
740
- }
741
-
742
- // Fire change event
743
- if(settings.change) {
744
- if(settings.changeDelay) {
745
- // Call after a delay
746
- clearTimeout(input.data('minicolors-changeTimeout'));
747
- input.data('minicolors-changeTimeout', setTimeout(function() {
748
- settings.change.call(input.get(0), value, opacity);
749
- }, settings.changeDelay));
750
- } else {
751
- // Call immediately
752
- settings.change.call(input.get(0), value, opacity);
753
- }
754
- }
755
- input.trigger('change').trigger('input');
756
- }
757
- }
758
-
759
- // Generates an RGB(A) object based on the input's value
760
- function rgbObject(input) {
761
- var rgb,
762
- opacity = $(input).attr('data-opacity');
763
- if( isRgb($(input).val()) ) {
764
- rgb = parseRgb($(input).val(), true);
765
- } else {
766
- var hex = parseHex($(input).val(), true);
767
- rgb = hex2rgb(hex);
768
- }
769
- if( !rgb ) return null;
770
- if( opacity !== undefined ) $.extend(rgb, { a: parseFloat(opacity) });
771
- return rgb;
772
- }
773
-
774
- // Generates an RGB(A) string based on the input's value
775
- function rgbString(input, alpha) {
776
- var rgb,
777
- opacity = $(input).attr('data-opacity');
778
- if( isRgb($(input).val()) ) {
779
- rgb = parseRgb($(input).val(), true);
780
- } else {
781
- var hex = parseHex($(input).val(), true);
782
- rgb = hex2rgb(hex);
783
- }
784
- if( !rgb ) return null;
785
- if( opacity === undefined ) opacity = 1;
786
- if( alpha ) {
787
- return 'rgba(' + rgb.r + ', ' + rgb.g + ', ' + rgb.b + ', ' + parseFloat(opacity) + ')';
788
- } else {
789
- return 'rgb(' + rgb.r + ', ' + rgb.g + ', ' + rgb.b + ')';
790
- }
791
- }
792
-
793
- // Converts to the letter case specified in settings
794
- function convertCase(string, letterCase) {
795
- return letterCase === 'uppercase' ? string.toUpperCase() : string.toLowerCase();
796
- }
797
-
798
- // Parses a string and returns a valid hex string when possible
799
- function parseHex(string, expand) {
800
- string = string.replace(/^#/g, '');
801
- if(!string.match(/^[A-F0-9]{3,6}/ig)) return '';
802
- if(string.length !== 3 && string.length !== 6) return '';
803
- if(string.length === 3 && expand) {
804
- string = string[0] + string[0] + string[1] + string[1] + string[2] + string[2];
805
- }
806
- return '#' + string;
807
- }
808
-
809
- // Parses a string and returns a valid RGB(A) string when possible
810
- function parseRgb(string, obj) {
811
- var values = string.replace(/[^\d,.]/g, '');
812
- var rgba = values.split(',');
813
-
814
- rgba[0] = keepWithin(parseInt(rgba[0], 10), 0, 255);
815
- rgba[1] = keepWithin(parseInt(rgba[1], 10), 0, 255);
816
- rgba[2] = keepWithin(parseInt(rgba[2], 10), 0, 255);
817
- if(rgba[3]) {
818
- rgba[3] = keepWithin(parseFloat(rgba[3], 10), 0, 1);
819
- }
820
-
821
- // Return RGBA object
822
- if( obj ) {
823
- if (rgba[3]) {
824
- return {
825
- r: rgba[0],
826
- g: rgba[1],
827
- b: rgba[2],
828
- a: rgba[3]
829
- };
830
- } else {
831
- return {
832
- r: rgba[0],
833
- g: rgba[1],
834
- b: rgba[2]
835
- };
836
- }
837
- }
838
-
839
- // Return RGBA string
840
- if(typeof(rgba[3]) !== 'undefined' && rgba[3] <= 1) {
841
- return 'rgba(' + rgba[0] + ', ' + rgba[1] + ', ' + rgba[2] + ', ' + rgba[3] + ')';
842
- } else {
843
- return 'rgb(' + rgba[0] + ', ' + rgba[1] + ', ' + rgba[2] + ')';
844
- }
845
-
846
- }
847
-
848
- // Parses a string and returns a valid color string when possible
849
- function parseInput(string, expand) {
850
- if(isRgb(string)) {
851
- // Returns a valid rgb(a) string
852
- return parseRgb(string);
853
- } else {
854
- return parseHex(string, expand);
855
- }
856
- }
857
-
858
- // Keeps value within min and max
859
- function keepWithin(value, min, max) {
860
- if(value < min) value = min;
861
- if(value > max) value = max;
862
- return value;
863
- }
864
-
865
- // Checks if a string is a valid RGB(A) string
866
- function isRgb(string) {
867
- var rgb = string.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i);
868
- return (rgb && rgb.length === 4) ? true : false;
869
- }
870
-
871
- // Function to get alpha from a RGB(A) string
872
- function getAlpha(rgba) {
873
- rgba = rgba.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+(\.\d{1,2})?|\.\d{1,2})[\s+]?/i);
874
- return (rgba && rgba.length === 6) ? rgba[4] : '1';
875
- }
876
-
877
- // Converts an HSB object to an RGB object
878
- function hsb2rgb(hsb) {
879
- var rgb = {};
880
- var h = Math.round(hsb.h);
881
- var s = Math.round(hsb.s * 255 / 100);
882
- var v = Math.round(hsb.b * 255 / 100);
883
- if(s === 0) {
884
- rgb.r = rgb.g = rgb.b = v;
885
- } else {
886
- var t1 = v;
887
- var t2 = (255 - s) * v / 255;
888
- var t3 = (t1 - t2) * (h % 60) / 60;
889
- if(h === 360) h = 0;
890
- if(h < 60) { rgb.r = t1; rgb.b = t2; rgb.g = t2 + t3; }
891
- else if(h < 120) {rgb.g = t1; rgb.b = t2; rgb.r = t1 - t3; }
892
- else if(h < 180) {rgb.g = t1; rgb.r = t2; rgb.b = t2 + t3; }
893
- else if(h < 240) {rgb.b = t1; rgb.r = t2; rgb.g = t1 - t3; }
894
- else if(h < 300) {rgb.b = t1; rgb.g = t2; rgb.r = t2 + t3; }
895
- else if(h < 360) {rgb.r = t1; rgb.g = t2; rgb.b = t1 - t3; }
896
- else { rgb.r = 0; rgb.g = 0; rgb.b = 0; }
897
- }
898
- return {
899
- r: Math.round(rgb.r),
900
- g: Math.round(rgb.g),
901
- b: Math.round(rgb.b)
902
- };
903
- }
904
-
905
- // Converts an RGB string to a hex string
906
- function rgbString2hex(rgb){
907
- rgb = rgb.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i);
908
- return (rgb && rgb.length === 4) ? '#' +
909
- ('0' + parseInt(rgb[1],10).toString(16)).slice(-2) +
910
- ('0' + parseInt(rgb[2],10).toString(16)).slice(-2) +
911
- ('0' + parseInt(rgb[3],10).toString(16)).slice(-2) : '';
912
- }
913
-
914
- // Converts an RGB object to a hex string
915
- function rgb2hex(rgb) {
916
- var hex = [
917
- rgb.r.toString(16),
918
- rgb.g.toString(16),
919
- rgb.b.toString(16)
920
- ];
921
- $.each(hex, function(nr, val) {
922
- if(val.length === 1) hex[nr] = '0' + val;
923
- });
924
- return '#' + hex.join('');
925
- }
926
-
927
- // Converts an HSB object to a hex string
928
- function hsb2hex(hsb) {
929
- return rgb2hex(hsb2rgb(hsb));
930
- }
931
-
932
- // Converts a hex string to an HSB object
933
- function hex2hsb(hex) {
934
- var hsb = rgb2hsb(hex2rgb(hex));
935
- if(hsb.s === 0) hsb.h = 360;
936
- return hsb;
937
- }
938
-
939
- // Converts an RGB object to an HSB object
940
- function rgb2hsb(rgb) {
941
- var hsb = { h: 0, s: 0, b: 0 };
942
- var min = Math.min(rgb.r, rgb.g, rgb.b);
943
- var max = Math.max(rgb.r, rgb.g, rgb.b);
944
- var delta = max - min;
945
- hsb.b = max;
946
- hsb.s = max !== 0 ? 255 * delta / max : 0;
947
- if(hsb.s !== 0) {
948
- if(rgb.r === max) {
949
- hsb.h = (rgb.g - rgb.b) / delta;
950
- } else if(rgb.g === max) {
951
- hsb.h = 2 + (rgb.b - rgb.r) / delta;
952
- } else {
953
- hsb.h = 4 + (rgb.r - rgb.g) / delta;
954
- }
955
- } else {
956
- hsb.h = -1;
957
- }
958
- hsb.h *= 60;
959
- if(hsb.h < 0) {
960
- hsb.h += 360;
961
- }
962
- hsb.s *= 100/255;
963
- hsb.b *= 100/255;
964
- return hsb;
965
- }
966
-
967
- // Converts a hex string to an RGB object
968
- function hex2rgb(hex) {
969
- hex = parseInt(((hex.indexOf('#') > -1) ? hex.substring(1) : hex), 16);
970
- return {
971
- r: hex >> 16,
972
- g: (hex & 0x00FF00) >> 8,
973
- b: (hex & 0x0000FF)
974
- };
975
- }
976
-
977
- // Handle events
978
- $([document])
979
- // Hide on clicks outside of the control
980
- .on('mousedown.minicolors touchstart.minicolors', function(event) {
981
- if(!$(event.target).parents().add(event.target).hasClass('minicolors')) {
982
- hide();
983
- }
984
- })
985
- // Start moving
986
- .on('mousedown.minicolors touchstart.minicolors', '.minicolors-grid, .minicolors-slider, .minicolors-opacity-slider', function(event) {
987
- var target = $(this);
988
- event.preventDefault();
989
- $(event.delegateTarget).data('minicolors-target', target);
990
- move(target, event, true);
991
- })
992
- // Move pickers
993
- .on('mousemove.minicolors touchmove.minicolors', function(event) {
994
- var target = $(event.delegateTarget).data('minicolors-target');
995
- if(target) move(target, event);
996
- })
997
- // Stop moving
998
- .on('mouseup.minicolors touchend.minicolors', function() {
999
- $(this).removeData('minicolors-target');
1000
- })
1001
- // Selected a swatch
1002
- .on('click.minicolors', '.minicolors-swatches li', function(event) {
1003
- event.preventDefault();
1004
- var target = $(this), input = target.parents('.minicolors').find('.minicolors-input'), color = target.data('swatch-color');
1005
- updateInput(input, color, getAlpha(color));
1006
- updateFromInput(input);
1007
- })
1008
- // Show panel when swatch is clicked
1009
- .on('mousedown.minicolors touchstart.minicolors', '.minicolors-input-swatch', function(event) {
1010
- var input = $(this).parent().find('.minicolors-input');
1011
- event.preventDefault();
1012
- show(input);
1013
- })
1014
- // Show on focus
1015
- .on('focus.minicolors', '.minicolors-input', function() {
1016
- var input = $(this);
1017
- if(!input.data('minicolors-initialized')) return;
1018
- show(input);
1019
- })
1020
- // Update value on blur
1021
- .on('blur.minicolors', '.minicolors-input', function() {
1022
- var input = $(this);
1023
- var settings = input.data('minicolors-settings');
1024
- var keywords;
1025
- var hex;
1026
- var rgba;
1027
- var swatchOpacity;
1028
- var value;
1029
-
1030
- if(!input.data('minicolors-initialized')) return;
1031
-
1032
- // Get array of lowercase keywords
1033
- keywords = !settings.keywords ? [] : $.map(settings.keywords.split(','), function(a) {
1034
- return $.trim(a.toLowerCase());
1035
- });
1036
-
1037
- // Set color string
1038
- if(input.val() !== '' && $.inArray(input.val().toLowerCase(), keywords) > -1) {
1039
- value = input.val();
1040
- } else {
1041
- // Get RGBA values for easy conversion
1042
- if(isRgb(input.val())) {
1043
- rgba = parseRgb(input.val(), true);
1044
- } else {
1045
- hex = parseHex(input.val(), true);
1046
- rgba = hex ? hex2rgb(hex) : null;
1047
- }
1048
-
1049
- // Convert to format
1050
- if(rgba === null) {
1051
- value = settings.defaultValue;
1052
- } else if(settings.format === 'rgb') {
1053
- value = settings.opacity ?
1054
- parseRgb('rgba(' + rgba.r + ',' + rgba.g + ',' + rgba.b + ',' + input.attr('data-opacity') + ')') :
1055
- parseRgb('rgb(' + rgba.r + ',' + rgba.g + ',' + rgba.b + ')');
1056
- } else {
1057
- value = rgb2hex(rgba);
1058
- }
1059
- }
1060
-
1061
- // Update swatch opacity
1062
- swatchOpacity = settings.opacity ? input.attr('data-opacity') : 1;
1063
- if(value.toLowerCase() === 'transparent') swatchOpacity = 0;
1064
- input
1065
- .closest('.minicolors')
1066
- .find('.minicolors-input-swatch > span')
1067
- .css('opacity', swatchOpacity);
1068
-
1069
- // Set input value
1070
- input.val(value);
1071
-
1072
- // Is it blank?
1073
- if(input.val() === '') input.val(parseInput(settings.defaultValue, true));
1074
-
1075
- // Adjust case
1076
- input.val(convertCase(input.val(), settings.letterCase));
1077
-
1078
- })
1079
- // Handle keypresses
1080
- .on('keydown.minicolors', '.minicolors-input', function(event) {
1081
- var input = $(this);
1082
- if(!input.data('minicolors-initialized')) return;
1083
- switch(event.keyCode) {
1084
- case 9: // tab
1085
- hide();
1086
- break;
1087
- case 13: // enter
1088
- case 27: // esc
1089
- hide();
1090
- input.blur();
1091
- break;
1092
- }
1093
- })
1094
- // Update on keyup
1095
- .on('keyup.minicolors', '.minicolors-input', function() {
1096
- var input = $(this);
1097
- if(!input.data('minicolors-initialized')) return;
1098
- updateFromInput(input, true);
1099
- })
1100
- // Update on paste
1101
- .on('paste.minicolors', '.minicolors-input', function() {
1102
- var input = $(this);
1103
- if(!input.data('minicolors-initialized')) return;
1104
- setTimeout(function() {
1105
- updateFromInput(input, true);
1106
- }, 1);
1107
- });
1108
- }));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/js/vi-check.js DELETED
@@ -1,62 +0,0 @@
1
- (function(funcName, baseObj) {
2
- "use strict";
3
- funcName = funcName || "docReady";
4
- baseObj = baseObj || window;
5
- var readyList = [];
6
- var readyFired = false;
7
- var readyEventHandlersInstalled = false;
8
-
9
- function ready() {
10
- if (!readyFired) {
11
- readyFired = true;
12
- for (var i = 0; i < readyList.length; i++) {
13
- readyList[i].fn.call(window, readyList[i].ctx);
14
- }
15
- readyList = [];
16
- }
17
- }
18
-
19
- function readyStateChange() {
20
- if ( document.readyState === "complete" ) {
21
- ready();
22
- }
23
- }
24
-
25
- baseObj[funcName] = function(callback, context) {
26
- if (typeof callback !== "function") {
27
- throw new TypeError("callback for docReady(fn) must be a function");
28
- }
29
- if (readyFired) {
30
- setTimeout(function() {callback(context);}, 1);
31
- return;
32
- } else {
33
- readyList.push({fn: callback, ctx: context});
34
- }
35
-
36
- if (document.readyState === "complete" || (!document.attachEvent && document.readyState === "interactive")) {
37
- setTimeout(ready, 1);
38
- } else if (!readyEventHandlersInstalled) {
39
- if (document.addEventListener) {
40
- document.addEventListener("DOMContentLoaded", ready, false);
41
- window.addEventListener("load", ready, false);
42
- } else {
43
- document.attachEvent("onreadystatechange", readyStateChange);
44
- window.attachEvent("onload", ready);
45
- }
46
- readyEventHandlersInstalled = true;
47
- }
48
- }
49
- })("docReady", window);
50
-
51
- docReady(function() {
52
- var viWrapper = document.getElementById("quick_adsense_vi_ad");
53
- if (typeof(viWrapper) != 'undefined' && viWrapper != null) {
54
- var viWrapperWidth = parseInt(viWrapper.clientWidth, 10);
55
- if(viWrapperWidth < 336) {
56
- var ajaxFrame = document.createElement('iframe');
57
- ajaxFrame.src = document.getElementById('quick_adsense_vi_width_check_url').value + '?quick_adsense_vi_width_check=' + document.getElementById('quick_adsense_vi_width_check_auth').value;
58
- ajaxFrame.style.display = 'none';
59
- document.getElementById('quick_adsense_vi_ad').appendChild(ajaxFrame);
60
- }
61
- }
62
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/loader.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Return the content of the File after processing.
4
+ *
5
+ * @param string $file File name.
6
+ * @param array $args Data to pass to the file.
7
+ */
8
+ function quick_adsense_load_file( $file, $args = [] ) {
9
+ if ( ( '' !== $file ) && file_exists( dirname( __FILE__ ) . '/' . $file ) ) {
10
+ //phpcs:disable
11
+ // Usage of extract() is necessary in this content to simulate templating functionality.
12
+ extract( $args );
13
+ //phpcs:enable
14
+ ob_start();
15
+ include dirname( __FILE__ ) . '/' . $file;
16
+ $content = ob_get_contents();
17
+ ob_end_clean();
18
+ return $content;
19
+ }
20
+ }
includes/quicktags.php CHANGED
@@ -1,33 +1,39 @@
1
- <?php
2
- add_action('admin_print_footer_scripts', 'quick_adsense_quicktag_admin_print_footer_scripts');
3
- function quick_adsense_quicktag_admin_print_footer_scripts() {
4
- if (wp_script_is('quicktags')) {
5
- $settings = get_option('quick_adsense_settings');
6
- echo '<script type="text/javascript">';
7
- if(isset($settings['enable_quicktag_buttons']) && ($settings['enable_quicktag_buttons'])) {
8
- for($i = 1; $i <= 10; $i++) {
9
- if(isset($settings['onpost_ad_'.$i.'_content']) && ($settings['onpost_ad_'.$i.'_content'] != '')) {
10
- echo 'QTags.addButton("quick_adsense_quicktag_onpost_ad_'.$i.'", "Ads'.$i.'", "\n<!--Ads'.$i.'-->\n", "", "", "Ads'.$i.'", 201);';
11
- }
12
- }
13
- if(!isset($settings['disable_randomads_quicktag_button']) || (!$settings['disable_randomads_quicktag_button'])) {
14
- echo 'QTags.addButton("quick_adsense_quicktag_randomads", "RndAds", "\n<!--RndAds-->\n", "", "", "Random Ads", 201);';
15
- }
16
- if(!isset($settings['disable_disablead_quicktag_buttons']) || (!$settings['disable_disablead_quicktag_buttons'])) {
17
- echo 'QTags.addButton("quick_adsense_quicktag_noads", "NoAds", "\n<!--NoAds-->\n", "", "", "No Ads", 201);';
18
- echo 'QTags.addButton("quick_adsense_quicktag_offdef", "OffDef", "\n<!--OffDef-->\n", "", "", "No Def", 201);';
19
- echo 'QTags.addButton("quick_adsense_quicktag_offwidget", "OffWidget", "\n<!--OffWidget-->\n", "", "", "No AdWidgets", 201);';
20
- }
21
- if(!isset($settings['disable_positionad_quicktag_buttons']) || (!$settings['disable_positionad_quicktag_buttons'])) {
22
- echo 'QTags.addButton("quick_adsense_quicktag_offbegin", "OffBegin", "\n<!--OffBegin-->\n", "", "", "Disable Beginning of Post Ads", 201);';
23
- echo 'QTags.addButton("quick_adsense_quicktag_offmiddle", "OffMiddle", "\n<!--OffMiddle-->\n", "", "", "Disable Middle of Post Ads", 201);';
24
- echo 'QTags.addButton("quick_adsense_quicktag_offend", "OffEnd", "\n<!--OffEnd-->\n", "", "", "Disable End of Post Ads", 201);';
25
- echo 'QTags.addButton("quick_adsense_quicktag_offafmore", "OffAfMore", "\n<!--OffAfMore-->\n", "", "", "OffAfMore", 201);';
26
- echo 'QTags.addButton("quick_adsense_quicktag_offbflastpara", "OffBfLastPara", "\n<!--OffBfLastPara-->\n", "", "", "OffBfLastPara", 201);';
27
- }
28
- }
29
-
30
- echo '</script>';
31
- }
32
- }
33
- ?>
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Quicktag Integration.
4
+ */
5
+
6
+ add_action(
7
+ 'admin_print_footer_scripts',
8
+ function() {
9
+ if ( wp_script_is( 'quicktags' ) ) {
10
+ $settings = get_option( 'quick_adsense_settings' );
11
+ echo '<script type="text/javascript">';
12
+ if ( isset( $settings['enable_quicktag_buttons'] ) && ( $settings['enable_quicktag_buttons'] ) ) {
13
+ for ( $i = 1; $i <= 10; $i++ ) {
14
+ if ( isset( $settings[ 'onpost_ad_' . $i . '_content' ] ) && ( '' !== $settings[ 'onpost_ad_' . $i . '_content' ] ) ) {
15
+ echo 'QTags.addButton("quick_adsense_quicktag_onpost_ad_' . esc_js( $i ) . '", "Ads' . esc_js( $i ) . '", "\n<!--Ads' . esc_js( $i ) . '-->\n", "", "", "Ads' . esc_js( $i ) . '", 201);';
16
+ }
17
+ }
18
+ if ( ! isset( $settings['disable_randomads_quicktag_button'] ) || ( ! $settings['disable_randomads_quicktag_button'] ) ) {
19
+ echo 'QTags.addButton("quick_adsense_quicktag_randomads", "RndAds", "\n<!--RndAds-->\n", "", "", "Random Ads", 201);';
20
+ }
21
+ if ( ! isset( $settings['disable_disablead_quicktag_buttons'] ) || ( ! $settings['disable_disablead_quicktag_buttons'] ) ) {
22
+ echo 'QTags.addButton("quick_adsense_quicktag_noads", "NoAds", "\n<!--NoAds-->\n", "", "", "No Ads", 201);';
23
+ echo 'QTags.addButton("quick_adsense_quicktag_offdef", "OffDef", "\n<!--OffDef-->\n", "", "", "No Def", 201);';
24
+ echo 'QTags.addButton("quick_adsense_quicktag_offwidget", "OffWidget", "\n<!--OffWidget-->\n", "", "", "No AdWidgets", 201);';
25
+ }
26
+ if ( ! isset( $settings['disable_positionad_quicktag_buttons'] ) || ( ! $settings['disable_positionad_quicktag_buttons'] ) ) {
27
+ echo 'QTags.addButton("quick_adsense_quicktag_offbegin", "OffBegin", "\n<!--OffBegin-->\n", "", "", "Disable Beginning of Post Ads", 201);';
28
+ echo 'QTags.addButton("quick_adsense_quicktag_offmiddle", "OffMiddle", "\n<!--OffMiddle-->\n", "", "", "Disable Middle of Post Ads", 201);';
29
+ echo 'QTags.addButton("quick_adsense_quicktag_offend", "OffEnd", "\n<!--OffEnd-->\n", "", "", "Disable End of Post Ads", 201);';
30
+ echo 'QTags.addButton("quick_adsense_quicktag_offafmore", "OffAfMore", "\n<!--OffAfMore-->\n", "", "", "OffAfMore", 201);';
31
+ echo 'QTags.addButton("quick_adsense_quicktag_offbflastpara", "OffBfLastPara", "\n<!--OffBfLastPara-->\n", "", "", "OffBfLastPara", 201);';
32
+ }
33
+ }
34
+
35
+ echo '</script>';
36
+ }
37
+ }
38
+ );
39
+
includes/settings.php CHANGED
@@ -1,729 +1,191 @@
1
- <?php
2
- add_action('plugin_action_links_quick-adsense/quick-adsense.php', function($links) {
3
- $links = array_merge(
4
- array('<a href="'.esc_url(admin_url('/admin.php?page=quick-adsense')).'">Settings</a>'),
5
- $links
6
- );
7
- return $links;
8
- });
9
-
10
- add_action('admin_menu', function() {
11
- add_menu_page('Quick Adsense Options', 'Quick Adsense', 'manage_options', 'quick-adsense', 'quick_adsense_settings_page');
12
- });
13
-
14
- add_action('admin_enqueue_scripts', function($hook) {
15
- if($hook != 'toplevel_page_quick-adsense') {
16
- return;
17
- }
18
- wp_register_script('quick-adsense-minicolors', plugins_url('/js/jquery.minicolors.js', __FILE__), array('jquery', 'jquery-ui-core'));
19
- wp_enqueue_script('quick-adsense-minicolors');
20
- wp_register_script('quick-adsense-chart-js', plugins_url('/js/Chart.bundle.min.js', __FILE__), array('jquery', 'jquery-ui-core', 'jquery-ui-accordion', 'jquery-ui-dialog'));
21
- wp_enqueue_script('quick-adsense-chart-js');
22
- wp_register_style('quick-adsense-jquery-ui', 'https://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css');
23
- wp_enqueue_style('quick-adsense-jquery-ui');
24
- wp_enqueue_style('quick_adsense_admin_css', plugins_url('/css/admin.css', __FILE__), array(), '2.7');
25
- wp_enqueue_script('quick_adsense_admin_js', plugins_url('/js/admin.js', __FILE__), array('jquery', 'jquery-ui-core', 'jquery-ui-tabs'), '2.7');
26
- });
27
-
28
- add_action('admin_init', function() {
29
- register_setting('quick_adsense_settings', 'quick_adsense_settings', 'quick_adsense_validate');
30
- add_settings_section('quick_adsense_general', '', 'quick_adsense_general_content', 'quick-adsense-general');
31
- add_settings_section('quick_adsense_onpost', '', 'quick_adsense_onpost_content', 'quick-adsense-onpost');
32
- add_settings_section('quick_adsense_widgets', '', 'quick_adsense_widgets_content', 'quick-adsense-widgets');
33
- add_settings_section('quick_adsense_header_footer_codes', '', 'quick_adsense_header_footer_codes_content', 'quick-adsense-header-footer-codes');
34
- });
35
-
36
- function quick_adsense_settings_page() { ?>
37
- <div class="wrap">
38
- <h2 id="quick_adsense_title">Quick Adsense Setting <span style="font-size: 14px;">(Version 2.7)</span></h2>
39
- <form id="quick_adsense_settings_form" method="post" action="options.php" name="wp_auto_commenter_form" style="display: none;">
40
- <?php settings_fields('quick_adsense_settings'); ?>
41
- <a style="display: inline-block; margin: 0 0 10px;" target="_blank" href="https://www.adpushup.com/lp/quick-adsense/"><img style="max-width: 100%;" src= "<?php echo plugins_url('/images/adpushup-970x250-red.png', __FILE__); ?>" /></a>
42
- <?php quick_adsense_settings_page_tabs(); ?>
43
- </form>
44
- <input type="hidden" id="quick_adsense_admin_ajax" name="quick_adsense_admin_ajax" value="<?php echo admin_url('admin-ajax.php'); ?>" />
45
- <input type="hidden" id="quick_adsense_nonce" name="quick_adsense_nonce" value="<?php echo wp_create_nonce('quick-adsense'); ?>" />
46
- <script type="text/javascript">
47
- jQuery(document).ready(function() {
48
- jQuery("#quick_adsense_settings_tabs").tabs();
49
- });
50
- </script>
51
- </div>
52
- <?php
53
- }
54
-
55
- function quick_adsense_settings_page_tabs() {
56
- echo '<div id="quick_adsense_settings_tabs">';
57
- echo '<ul>';
58
- echo '<li><a href="#tabs-settings">Settings</a></li>';
59
- echo '<li><a href="#tabs-post-body-ads">Ads on Post Body</a></li>';
60
- echo '<li><a href="#tabs-sidebar-widget-ads">Sidebar Widget</a></li>';
61
- echo '<li><a href="#tabs-header-footer-codes">Header / Footer Codes</a></li>';
62
- echo '</ul>';
63
- echo '<div id="tabs-settings">';
64
- echo '<div id="quick_adsense_top_sections_wrapper">';
65
- do_settings_sections('quick-adsense-general');
66
- echo '</div>';
67
- submit_button('Save Changes');
68
- echo '</div>';
69
- echo '<div id="tabs-post-body-ads">';
70
- do_settings_sections('quick-adsense-onpost');
71
- submit_button('Save Changes');
72
- echo '</div>';
73
- echo '<div id="tabs-sidebar-widget-ads">';
74
- do_settings_sections('quick-adsense-widgets');
75
- submit_button('Save Changes');
76
- echo '</div>';
77
- echo '<div id="tabs-header-footer-codes">';
78
- do_settings_sections('quick-adsense-header-footer-codes');
79
- submit_button('Save Changes');
80
- echo '</div>';
81
- echo '</div>';
82
- }
83
-
84
- function quick_adsense_header_footer_codes_content() {
85
- $settings = get_option('quick_adsense_settings');
86
- echo '<div id="quick_adsense_top_sections_wrapper">';
87
- echo '<div class="quick_adsense_block">';
88
- echo '<div class="quick_adsense_block_labels">';
89
- echo '<span>Header<br />Embed Code</span>';
90
- echo '</div>';
91
- echo '<div class="quick_adsense_block_controls">';
92
- echo quickadsense_get_control('textarea-big', '', 'quick_adsense_settings_header_embed_code', 'quick_adsense_settings[header_embed_code]', ((isset($settings['header_embed_code']))?$settings['header_embed_code']:''));
93
- echo '</div>';
94
- echo '<div class="clear"></div>';
95
- echo '<div class="quick_adsense_block_labels">';
96
- echo '<span>Footer<br />Embed Code</span>';
97
- echo '</div>';
98
- echo '<div class="quick_adsense_block_controls">';
99
- echo quickadsense_get_control('textarea-big', '', 'quick_adsense_settings_footer_embed_code', 'quick_adsense_settings[footer_embed_code]', ((isset($settings['footer_embed_code']))?$settings['footer_embed_code']:''));
100
- echo '</div>';
101
- echo '<div class="clear"></div>';
102
- echo '</div>';
103
- echo '</div>';
104
- }
105
-
106
- function quick_adsense_general_content() {
107
- $settings = get_option('quick_adsense_settings');
108
- echo '<div class="quick_adsense_block">';
109
- echo '<div class="quick_adsense_block_labels">';
110
- echo '<span>Options</span>';
111
- echo '</div>';
112
- echo '<div class="quick_adsense_block_controls">';
113
- echo '<a id="quick_adsense_settings_reset_to_default" href="javascript:;">Reset to Default Settings</a>';
114
- echo '</div>';
115
- echo '<div class="clear"></div>';
116
-
117
- echo '<div class="quick_adsense_block_labels">';
118
- echo 'Adsense';
119
- echo '</div>';
120
- echo '<div class="quick_adsense_block_controls">';
121
- echo 'Place up to';
122
- $maxAdsCount = array();
123
- for($i = 0; $i <= 10; $i++) {
124
- $maxAdsCount[] = array('text' => $i, 'value' => $i);
125
- }
126
- echo quickadsense_get_control('select', '', 'quick_adsense_settings_max_ads_per_page', 'quick_adsense_settings[max_ads_per_page]', ((isset($settings['max_ads_per_page']))?$settings['max_ads_per_page']:''), $maxAdsCount, 'input', 'margin: -2px 10px 0 40px;');
127
- echo 'Ads on a page';
128
- echo '</div>';
129
- echo '<div class="clear"></div>';
130
- echo '<div class="clear"></div>';
131
- echo '<div class="quick_adsense_block_labels">';
132
- echo 'Assign position<br />(Default)';
133
- echo '</div>';
134
- echo '<div class="quick_adsense_block_controls">';
135
- $adPositions = array(
136
- array('text' => 'Random Ads', 'value' => '0')
137
- );
138
- for($i = 1; $i <= 10; $i++) {
139
- $adPositions[] = array('text' => 'Ads'.$i, 'value' => $i);
140
- }
141
-
142
- $elementCount = array();
143
- for($i = 1; $i <= 50; $i++) {
144
- $elementCount[] = array('text' => $i, 'value' => $i);
145
- }
146
- echo '<p>';
147
- echo quickadsense_get_control('checkbox', '', 'quick_adsense_settings_enable_position_beginning_of_post', 'quick_adsense_settings[enable_position_beginning_of_post]', ((isset($settings['enable_position_beginning_of_post']))?$settings['enable_position_beginning_of_post']:''), null, 'input', '');
148
- echo quickadsense_get_control('select', '', 'quick_adsense_settings_ad_beginning_of_post', 'quick_adsense_settings[ad_beginning_of_post]', ((isset($settings['ad_beginning_of_post']))?$settings['ad_beginning_of_post']:''), $adPositions, 'input', 'margin: -2px 10px 0 20px;');
149
- echo '<b style="width: 120px; display: inline-block;">Beginning of Post</b>';
150
- echo '</p>';
151
- echo '<p>';
152
- echo quickadsense_get_control('checkbox', '', 'quick_adsense_settings_enable_position_middle_of_post', 'quick_adsense_settings[enable_position_middle_of_post]', ((isset($settings['enable_position_middle_of_post']))?$settings['enable_position_middle_of_post']:''), null, 'input', '');
153
- echo quickadsense_get_control('select', '', 'quick_adsense_settings_ad_middle_of_post', 'quick_adsense_settings[ad_middle_of_post]', ((isset($settings['ad_middle_of_post']))?$settings['ad_middle_of_post']:''), $adPositions, 'input', 'margin: -2px 10px 0 20px;');
154
- echo '<b style="width: 120px; display: inline-block;">Middle of Post</b>';
155
- echo '</p>';
156
- echo '<p>';
157
- echo quickadsense_get_control('checkbox', '', 'quick_adsense_settings_enable_position_end_of_post', 'quick_adsense_settings[enable_position_end_of_post]', ((isset($settings['enable_position_end_of_post']))?$settings['enable_position_end_of_post']:''), null, 'input', '');
158
- echo quickadsense_get_control('select', '', 'quick_adsense_settings_ad_end_of_post', 'quick_adsense_settings[ad_end_of_post]', ((isset($settings['ad_end_of_post']))?$settings['ad_end_of_post']:''), $adPositions, 'input', 'margin: -2px 10px 0 20px;');
159
- echo '<b>End of Post</b>';
160
- echo '</p>';
161
- echo '<div class="clear"></div>';
162
- echo '<p>';
163
- echo quickadsense_get_control('checkbox', '', 'quick_adsense_settings_enable_position_after_more_tag', 'quick_adsense_settings[enable_position_after_more_tag]', ((isset($settings['enable_position_after_more_tag']))?$settings['enable_position_after_more_tag']:''), null, 'input', '');
164
- echo quickadsense_get_control('select', '', 'quick_adsense_settings_ad_after_more_tag', 'quick_adsense_settings[ad_after_more_tag]', ((isset($settings['ad_after_more_tag']))?$settings['ad_after_more_tag']:''), $adPositions, 'input', 'margin: -2px 10px 0 20px;');
165
- echo 'right after <b>the &lt;!--more--&gt; tag</b>';
166
- echo '</p>';
167
- echo '<p>';
168
- echo quickadsense_get_control('checkbox', '', 'quick_adsense_settings_enable_position_before_last_para', 'quick_adsense_settings[enable_position_before_last_para]', ((isset($settings['enable_position_before_last_para']))?$settings['enable_position_before_last_para']:''), null, 'input', '');
169
- echo quickadsense_get_control('select', '', 'quick_adsense_settings_ad_before_last_para', 'quick_adsense_settings[ad_before_last_para]', ((isset($settings['ad_before_last_para']))?$settings['ad_before_last_para']:''), $adPositions, 'input', 'margin: -2px 10px 0 20px;');
170
- echo 'right before <b>the last Paragraph</b>';
171
- echo '</p>';
172
- echo '<div class="clear"></div>';
173
- for($i = 1; $i <= 3; $i++) {
174
- echo '<p>';
175
- echo quickadsense_get_control('checkbox', '', 'quick_adsense_settings_enable_position_after_para_option_'.$i, 'quick_adsense_settings[enable_position_after_para_option_'.$i.']', ((isset($settings['enable_position_after_para_option_'.$i]))?$settings['enable_position_after_para_option_'.$i]:''), null, 'input', '');
176
- echo quickadsense_get_control('select', '', 'quick_adsense_settings_ad_after_para_option_'.$i, 'quick_adsense_settings[ad_after_para_option_'.$i.']', ((isset($settings['ad_after_para_option_'.$i]))?$settings['ad_after_para_option_'.$i]:''), $adPositions, 'input', 'margin: -2px 10px 0 20px;');
177
- echo '<span style="width: 110px;display: inline-block;"><b>after Paragraph</b></span>';
178
- echo quickadsense_get_control('select', '', 'quick_adsense_settings_position_after_para_option_'.$i, 'quick_adsense_settings[position_after_para_option_'.$i.']', ((isset($settings['position_after_para_option_'.$i]))?$settings['position_after_para_option_'.$i]:''), $elementCount, 'input', 'margin: -2px 10px 0 10px;');
179
- echo 'repeat';
180
- echo quickadsense_get_control('checkbox', '', 'quick_adsense_settings_enable_jump_position_after_para_option_'.$i, 'quick_adsense_settings[enable_jump_position_after_para_option_'.$i.']', ((isset($settings['enable_jump_position_after_para_option_'.$i]))?$settings['enable_jump_position_after_para_option_'.$i]:''), null, 'input', 'margin: -1px 10px 0;');
181
- echo '<b>to End of Post</b> if fewer paragraphs are found';
182
- echo '</p>';
183
- }
184
- echo '<div class="clear"></div>';
185
- for($i = 1; $i <= 1; $i++) {
186
- echo '<p>';
187
- echo quickadsense_get_control('checkbox', '', 'quick_adsense_settings_enable_position_after_image_option_'.$i, 'quick_adsense_settings[enable_position_after_image_option_'.$i.']', ((isset($settings['enable_position_after_image_option_'.$i]))?$settings['enable_position_after_image_option_'.$i]:''), null, 'input', '');
188
- echo quickadsense_get_control('select', '', 'quick_adsense_settings_ad_after_image_option_'.$i, 'quick_adsense_settings[ad_after_image_option_'.$i.']', ((isset($settings['ad_after_image_option_'.$i]))?$settings['ad_after_image_option_'.$i]:''), $adPositions, 'input', 'margin: -2px 10px 0 20px;');
189
- echo '<span style="width: 110px;display: inline-block;">after Image</span>';
190
- echo quickadsense_get_control('select', '', 'quick_adsense_settings_position_after_image_option_'.$i, 'quick_adsense_settings[position_after_image_option_'.$i.']', ((isset($settings['position_after_image_option_'.$i]))?$settings['position_after_image_option_'.$i]:''), $elementCount, 'input', 'margin: -2px 10px 0 10px;');
191
- echo 'repeat';
192
- echo quickadsense_get_control('checkbox', '', 'quick_adsense_settings_enable_jump_position_after_image_option_'.$i, 'quick_adsense_settings[enable_jump_position_after_image_option_'.$i.']', ((isset($settings['enable_jump_position_after_image_option_'.$i]))?$settings['enable_jump_position_after_image_option_'.$i]:''), null, 'input', 'margin: -1px 10px 0;');
193
- echo 'after <b>Image\'s outer &lt;div&gt; wp-caption</b> if any';
194
- echo '</p>';
195
- }
196
- echo '</div>';
197
- echo '<div class="clear"></div>';
198
- echo '</div>';
199
-
200
- echo '<div class="quick_adsense_block">';
201
- echo '<div class="quick_adsense_block_labels">';
202
- echo 'Appearance';
203
- echo '</div>';
204
- echo '<div class="quick_adsense_block_controls">';
205
- echo '<p>';
206
- echo '<span>'.quickadsense_get_control('checkbox', '<b id="quick_adsense_settings_enable_on_posts_label">Posts</b>', 'quick_adsense_settings_enable_on_posts', 'quick_adsense_settings[enable_on_posts]', ((isset($settings['enable_on_posts']))?$settings['enable_on_posts']:''), null, 'input', 'margin: -1px 10px 0 0;').'</span>';
207
- echo '<span>'.quickadsense_get_control('checkbox', '<b id="quick_adsense_settings_enable_on_pages_label">Pages</b>', 'quick_adsense_settings_enable_on_pages', 'quick_adsense_settings[enable_on_pages]', ((isset($settings['enable_on_pages']))?$settings['enable_on_pages']:''), null, 'input', 'margin: -1px 10px 0 15px;').'</span>';
208
- echo '</p>';
209
- echo '<p>';
210
- echo '<span>'.quickadsense_get_control('checkbox', '<b id="quick_adsense_settings_enable_on_homepage_label">Homepage</b>', 'quick_adsense_settings_enable_on_homepage', 'quick_adsense_settings[enable_on_homepage]', ((isset($settings['enable_on_homepage']))?$settings['enable_on_homepage']:''), null, 'input', 'margin: -1px 10px 0 0;').'</span>';
211
- echo '<span>'.quickadsense_get_control('checkbox', '<b id="quick_adsense_settings_enable_on_categories_label">Categories</b>', 'quick_adsense_settings_enable_on_categories', 'quick_adsense_settings[enable_on_categories]', ((isset($settings['enable_on_categories']))?$settings['enable_on_categories']:''), null, 'input', 'margin: -1px 10px 0 15px;').'</span>';
212
- echo '<span>'.quickadsense_get_control('checkbox', '<b id="quick_adsense_settings_enable_on_archives_label">Archives</b>', 'quick_adsense_settings_enable_on_archives', 'quick_adsense_settings[enable_on_archives]', ((isset($settings['enable_on_archives']))?$settings['enable_on_archives']:''), null, 'input', 'margin: -1px 10px 0 15px;').'</span>';
213
- echo '<span>'.quickadsense_get_control('checkbox', '<b id="quick_adsense_settings_enable_on_tags_label">Tags</b>', 'quick_adsense_settings_enable_on_tags', 'quick_adsense_settings[enable_on_tags]', ((isset($settings['enable_on_tags']))?$settings['enable_on_tags']:''), null, 'input', 'margin: -1px 10px 0 15px;').'</span>';
214
- echo '<span>'.quickadsense_get_control('checkbox', '<b id="quick_adsense_settings_enable_all_possible_ads_label">Place all possible Ads on these pages</b>', 'quick_adsense_settings_enable_all_possible_ads', 'quick_adsense_settings[enable_all_possible_ads]', ((isset($settings['enable_all_possible_ads']))?$settings['enable_all_possible_ads']:''), null, 'input', 'margin: -1px 10px 0 35px;').'</span>';
215
- echo '</p>';
216
- echo '<p>';
217
- echo '<span>'.quickadsense_get_control('checkbox', '<b id="quick_adsense_settings_disable_widgets_on_homepage_label">Disable AdsWidget on Homepage</b>', 'quick_adsense_settings_disable_widgets_on_homepage', 'quick_adsense_settings[disable_widgets_on_homepage]', ((isset($settings['disable_widgets_on_homepage']))?$settings['disable_widgets_on_homepage']:''), null, 'input', 'margin: -1px 10px 0 0;').'</span>';
218
- echo '</p>';
219
- echo '<p>';
220
- echo '<span>'.quickadsense_get_control('checkbox', '<b id="quick_adsense_settings_disable_for_loggedin_users_label">Hide Ads when user is logged in to Wordpress</b>', 'quick_adsense_settings_disable_for_loggedin_users', 'quick_adsense_settings[disable_for_loggedin_users]', ((isset($settings['disable_for_loggedin_users']))?$settings['disable_for_loggedin_users']:''), null, 'input', 'margin: -1px 10px 0 0;').'</span>';
221
- echo '</p>';
222
- echo '</div>';
223
- echo '<div class="clear"></div>';
224
- echo '</div>';
225
-
226
- echo '<div class="quick_adsense_block">';
227
- echo '<div class="quick_adsense_block_labels">';
228
- echo 'Quicktag';
229
- echo '</div>';
230
- echo '<div class="quick_adsense_block_controls">';
231
- echo '<p>';
232
- echo quickadsense_get_control('checkbox', '<b>Show Quicktag Buttons on the HTML Edit Post SubPanel</b>', 'quick_adsense_settings_enable_quicktag_buttons', 'quick_adsense_settings[enable_quicktag_buttons]', ((isset($settings['enable_quicktag_buttons']))?$settings['enable_quicktag_buttons']:''), null, 'input', 'margin: -1px 10px 0 0;');
233
- echo '</p>';
234
- echo '<p>';
235
- echo quickadsense_get_control('checkbox', 'Hide <b>&lt;!--RndAds--&gt;</b> from Quicktag Buttons', 'quick_adsense_settings_disable_randomads_quicktag_button', 'quick_adsense_settings[disable_randomads_quicktag_button]', ((isset($settings['disable_randomads_quicktag_button']))?$settings['disable_randomads_quicktag_button']:''), null, 'input', 'margin: -1px 10px 0 0;');
236
- echo '</p>';
237
- echo '<p>';
238
- echo quickadsense_get_control('checkbox', 'Hide <b>&lt;!--NoAds--&gt;</b>, <b>&lt;!--OffDef--&gt;</b>, <b>&lt;!--OffWidget--&gt;</b> from Quicktag Buttons', 'quick_adsense_settings_disable_disablead_quicktag_buttons', 'quick_adsense_settings[disable_disablead_quicktag_buttons]', ((isset($settings['disable_disablead_quicktag_buttons']))?$settings['disable_disablead_quicktag_buttons']:''), null, 'input', 'margin: -1px 10px 0 0;');
239
- echo '</p>';
240
- echo '<p>';
241
- echo quickadsense_get_control('checkbox', 'Hide <b>&lt;!--OffBegin--&gt;</b>, <b>&lt;!--OffMiddle--&gt;</b>, <b>&lt;!--OffEnd--&gt;</b>, <b>&lt;!--OffAfMore--&gt;</b>, <b>&lt;!--OffBfLastPara--&gt;</b> from Quicktag Buttons', 'quick_adsense_settings_disable_positionad_quicktag_buttons', 'quick_adsense_settings[disable_positionad_quicktag_buttons]', ((isset($settings['disable_positionad_quicktag_buttons']))?$settings['disable_positionad_quicktag_buttons']:''), null, 'input', 'margin: -1px 10px 0 0;');
242
- echo '</p>';
243
- echo '<div class="clear"></div>';
244
- echo 'Insert Ads into a post, on-the-fly:';
245
- echo '<ol>';
246
- echo '<li>Insert <b>&lt;!--Ads1--&gt;</b>, <b>&lt;!--Ads2--&gt;</b> etc. into a post to show the <b>Particular Ads</b> at specific location.</li>';
247
- echo '<li>Insert <b>&lt;!--RndAds--&gt;</b> (or more) into a post to show the <b>Random Ads</b> at specific location.</li>';
248
- echo '</ol>';
249
- echo '<div class="clear"></div>';
250
- echo 'Disable Ads in a post, on-the-fly:';
251
- echo '<ol>';
252
- echo '<li>Insert <b>&lt;!--NoAds--&gt;</b> to disable all Ads in a post <i>(does not affect Ads on Sidebar)</i>.</li>';
253
- echo '<li>Insert <b>&lt;!--OffDef--&gt;</b> to disable the default positioned Ads, and use &lt;!--Ads1--&gt;, &lt;!--Ads2--&gt;, etc. to insert Ad <i>(does not affect Ads on Sidebar)</i>.</li>';
254
- echo '<li>Insert <b>&lt;!--OffWidget--&gt;</b> to disable all Ads on Sidebar.</li>';
255
- echo '<li>Insert <b>&lt;!--OffBegin--&gt;</b>, <b>&lt;!--OffMiddle--&gt;</b>, <b>&lt;!--OffEnd--&gt;</b> to <b>disable Ads at Beginning</b>, <b>Middle or End of Post</b>.</li>';
256
- echo '<li>Insert <b>&lt;!--OffAfMore--&gt;</b>, <b>&lt;!--OffBfLastPara--&gt;</b> to <b>disable Ads right after the &lt;!--more--&gt; tag</b>, or <b>right before the last Paragraph</b>.</li>';
257
- echo '</ol>';
258
- echo '<div class="clear"></div>';
259
- echo '<i>Tags can be inserted into a post via the additional Quicktag Buttons at the HTML Edit Post SubPanel.</i>';
260
- echo '</div>';
261
- echo '<div class="clear"></div>';
262
- echo '</div>';
263
- }
264
-
265
- function quick_adsense_onpost_content() {
266
- $settings = get_option('quick_adsense_settings');
267
- $alignmentOptions = array(
268
- array('text' => 'Left', 'value' => '1'),
269
- array('text' => 'Center', 'value' => '2'),
270
- array('text' => 'Right', 'value' => '3'),
271
- array('text' => 'None', 'value' => '4')
272
- );
273
- $marginOptions = array();
274
- for($i = 1; $i <= 50; $i++) {
275
- $marginOptions[] = array('text' => $i, 'value' => $i);
276
- }
277
- echo '<div id="quick_adsense_block_bottom" class="quick_adsense_block" style="margin: 30px 0 0;">';
278
- echo '<div class="quick_adsense_block_labels" style="width: auto;">';
279
- echo '<span>Adsense Codes - Ads on Post Body</span>';
280
- echo '</div>';
281
- echo '<div class="clear"></div>';
282
- echo '<p>Paste up to 10 Ads codes on Post Body as assigned above. Ads codes provided must not be identical, repeated codes may result the Ads not being display correctly. Ads will never displays more than once in a page.</p>';
283
- echo '</div>';
284
-
285
- echo '<div id="quick_adsense_onpost_content_controls_wrapper">';
286
- echo '<div id="quick_adsense_onpost_content_global_controls_wrapper">';
287
- echo '<p class="quick_adsense_onpost_adunits_styling_controls">';
288
- echo quickadsense_get_control('checkbox', '', 'quick_adsense_settings_onpost_enable_global_style', 'quick_adsense_settings[onpost_enable_global_style]', ((isset($settings['onpost_enable_global_style']))?$settings['onpost_enable_global_style']:''), null, 'input', 'margin: -3px 10px 0 0;');
289
- echo '<span>Use for all</span>';
290
- echo '<wbr />Alignment';
291
- echo quickadsense_get_control('select', '', 'quick_adsense_settings_onpost_global_alignment', 'quick_adsense_settings[onpost_global_alignment]', ((isset($settings['onpost_global_alignment']))?$settings['onpost_global_alignment']:''), $alignmentOptions, 'input', 'margin: -6px 20px 0 10px; width: 73px;');
292
- echo '<wbr />margin';
293
- echo quickadsense_get_control('number', '', 'quick_adsense_settings_onpost_global_margin', 'quick_adsense_settings[onpost_global_margin]', ((isset($settings['onpost_global_margin']))?$settings['onpost_global_margin']:''), $marginOptions, 'input', 'margin: -1px 10px 0 10px; width: 62px;');
294
- echo 'px';
295
- echo '</p>';
296
- echo '</div>';
297
-
298
- echo '<div id="quick_adsense_onpost_content_adunits_wrapper">';
299
- echo '<div id="quick_adsense_onpost_content_adunits_initial_wrapper">';
300
- for($i = 1; $i <= 3; $i++) {
301
- quick_adsense_onpost_adunits_controls($i, $settings, $alignmentOptions, $marginOptions);
302
- }
303
- echo '</div>';
304
- echo '<div id="quick_adsense_onpost_content_adunits_all_wrapper" style="display: none;">';
305
- for($i = 4; $i <= 10; $i++) {
306
- quick_adsense_onpost_adunits_controls($i, $settings, $alignmentOptions, $marginOptions);
307
- }
308
- echo '</div>';
309
- echo '<a id="quick_adsense_onpost_content_adunits_showall_button" class="input button-secondary"><span class="dashicons dashicons-arrow-down"></span> <b>Show All</b></a>';
310
- echo '</div>';
311
- echo '</div>';
312
- }
313
-
314
- function quick_adsense_onpost_adunits_controls($index, $settings, $alignmentOptions, $marginOptions) {
315
- echo '<div id="quick_adsense_onpost_adunits_control_'.$index.'" class="quick_adsense_onpost_adunits_control_wrapper">';
316
- echo '<div class="quick_adsense_onpost_adunits_label">Ads'.$index.'</div>';
317
- echo '<div class="quick_adsense_onpost_adunits_control">';
318
- echo quickadsense_get_control('textarea', '', 'quick_adsense_settings_onpost_ad_'.$index.'_content', 'quick_adsense_settings[onpost_ad_'.$index.'_content]', ((isset($settings['onpost_ad_'.$index.'_content']))?$settings['onpost_ad_'.$index.'_content']:''), null, 'input', 'display: block; margin: 0 0 10px 0', 'Enter Code');
319
- echo '<p class="quick_adsense_onpost_adunits_styling_controls">';
320
- echo 'Alignment';
321
- echo quickadsense_get_control('select', '', 'quick_adsense_settings_onpost_ad_'.$index.'_alignment', 'quick_adsense_settings[onpost_ad_'.$index.'_alignment]', ((isset($settings['onpost_ad_'.$index.'_alignment']))?$settings['onpost_ad_'.$index.'_alignment']:''), $alignmentOptions, 'input', 'margin: -2px 20px 0 10px;');
322
- echo '<wbr />margin';
323
- echo quickadsense_get_control('number', '', 'quick_adsense_settings_onpost_ad_'.$index.'_margin', 'quick_adsense_settings[onpost_ad_'.$index.'_margin]', ((isset($settings['onpost_ad_'.$index.'_margin']))?$settings['onpost_ad_'.$index.'_margin']:''), $marginOptions, 'input', 'margin: -2px 10px 0 10px; width: 52px;');
324
- echo 'px';
325
- echo '</p>';
326
- quick_adsense_advanced_controls($index, $settings, 'onpost');
327
- echo '</div>';
328
- echo '<div class="clear"></div>';
329
- echo '</div>';
330
- }
331
-
332
- function quick_adsense_widgets_content() {
333
- $settings = get_option('quick_adsense_settings');
334
- $alignmentOptions = array(
335
- array('text' => 'Left', 'value' => '1'),
336
- array('text' => 'Center', 'value' => '2'),
337
- array('text' => 'Right', 'value' => '3'),
338
- array('text' => 'None', 'value' => '4')
339
- );
340
- $marginOptions = array();
341
- for($i = 1; $i <= 50; $i++) {
342
- $marginOptions[] = array('text' => $i, 'value' => $i);
343
- }
344
- echo '<div id="quick_adsense_block_bottom" class="quick_adsense_block" style="margin: 30px 0 0;">';
345
- echo '<div class="quick_adsense_block_labels" style="width: auto;">';
346
- echo '<span>Adsense Codes - <a href="'.admin_url('widgets.php').'">Sidebar WIdget</a></span>';
347
- echo '</div>';
348
- echo '<div class="clear"></div>';
349
- echo '<p>Paste up to 10 Ads codes on Sidebar Widget. Ads codes provided must not be identical, repeated codes may result the Ads not being display correctly. Ads will never displays more than once in a page.</p>';
350
- echo '</div>';
351
-
352
- echo '<div id="quick_adsense_widget_controls_wrapper">';
353
- echo '<div id="quick_adsense_widget_global_controls_wrapper" style="visibility: hidden;">';
354
- echo '<p class="quick_adsense_widget_adunits_styling_controls">';
355
- echo quickadsense_get_control('checkbox', '', 'quick_adsense_settings_widget_enable_global_style', 'quick_adsense_settings[widget_enable_global_style]', ((isset($settings['widget_enable_global_style']))?$settings['widget_enable_global_style']:''), null, 'input', 'margin: -3px 10px 0 0;');
356
- echo '<span>Use for all</span>';
357
- echo '<wbr />Alignment';
358
- echo quickadsense_get_control('select', '', 'quick_adsense_settings_widget_global_alignment', 'quick_adsense_settings[widget_global_alignment]', ((isset($settings['widget_global_alignment']))?$settings['widget_global_alignment']:''), $alignmentOptions, 'input', 'margin: -6px 20px 0 10px; width: 73px;');
359
- echo '<wbr />margin';
360
- echo quickadsense_get_control('number', '', 'quick_adsense_settings_widget_global_margin', 'quick_adsense_settings[widget_global_margin]', ((isset($settings['widget_global_margin']))?$settings['widget_global_margin']:''), $marginOptions, 'input', 'margin: -1px 10px 0 10px; width: 62px;');
361
- echo 'px';
362
- echo '</p>';
363
- echo '</div>';
364
-
365
- echo '<div id="quick_adsense_widget_adunits_wrapper">';
366
- echo '<div id="quick_adsense_widget_adunits_initial_wrapper">';
367
- for($i = 1; $i <= 3; $i++) {
368
- quick_adsense_widgets_controls($i, $settings);
369
- }
370
- echo '</div>';
371
- echo '<div id="quick_adsense_widget_adunits_all_wrapper" style="display: none;">';
372
- for($i = 4; $i <= 10; $i++) {
373
- quick_adsense_widgets_controls($i, $settings);
374
- }
375
- echo '</div>';
376
- echo '<a id="quick_adsense_widget_adunits_showall_button" class="input button-secondary"><span class="dashicons dashicons-arrow-down"></span> <b>Show All</b></a>';
377
- echo '</div>';
378
- echo '</div>';
379
- }
380
-
381
- function quick_adsense_widgets_controls($index, $settings) {
382
- echo '<div id="quick_adsense_widget_adunits_control_'.$index.'" class="quick_adsense_widget_adunits_control_wrapper">';
383
- echo '<div class="quick_adsense_widget_adunits_label">AdsWidget'.$index.'</div>';
384
- echo '<div class="quick_adsense_widget_adunits_control">';
385
- echo quickadsense_get_control('textarea', '', 'quick_adsense_settings_widget_ad_'.$index.'_content', 'quick_adsense_settings[widget_ad_'.$index.'_content]', ((isset($settings['widget_ad_'.$index.'_content']))?$settings['widget_ad_'.$index.'_content']:''), null, 'input', 'display: block; margin: 0 0 10px 0', 'Enter Code');
386
- echo '</div>';
387
- echo '<div class="clear"></div>';
388
- echo '</div>';
389
- }
390
-
391
- function quick_adsense_advanced_controls($index, $settings, $location) {
392
- echo '<p class="quick_adsense_'.$location.'_adunits_device_controls">';
393
- echo '<b>Hide by Device Type:</b><br />';
394
- echo quickadsense_get_control('checkbox', 'Mobile', 'quick_adsense_settings_'.$location.'_ad_'.$index.'_hide_device_mobile', 'quick_adsense_settings['.$location.'_ad_'.$index.'_hide_device_mobile]', ((isset($settings[$location.'_ad_'.$index.'_hide_device_mobile']))?$settings[$location.'_ad_'.$index.'_hide_device_mobile']:''), null, 'input', 'margin: -1px 5px 0 0;');
395
- echo quickadsense_get_control('checkbox', 'Tablet', 'quick_adsense_settings_'.$location.'_ad_'.$index.'_hide_device_tablet', 'quick_adsense_settings['.$location.'_ad_'.$index.'_hide_device_tablet]', ((isset($settings[$location.'_ad_'.$index.'_hide_device_tablet']))?$settings[$location.'_ad_'.$index.'_hide_device_tablet']:''), null, 'input', 'margin: -1px 5px 0 15px;');
396
- echo quickadsense_get_control('checkbox', 'Desktop', 'quick_adsense_settings_'.$location.'_ad_'.$index.'_hide_device_desktop', 'quick_adsense_settings['.$location.'_ad_'.$index.'_hide_device_desktop]', ((isset($settings[$location.'_ad_'.$index.'_hide_device_desktop']))?$settings[$location.'_ad_'.$index.'_hide_device_desktop']:''), null, 'input', 'margin: -1px 5px 0 15px;');
397
- echo '</p>';
398
- echo '<p class="quick_adsense_'.$location.'_adunits_device_controls">';
399
- echo '<b>Hide by Visitor Source:</b><br />';
400
- echo quickadsense_get_control('checkbox', 'Search Engine', 'quick_adsense_settings_'.$location.'_ad_'.$index.'_hide_visitor_searchengine', 'quick_adsense_settings['.$location.'_ad_'.$index.'_hide_visitor_searchengine]', ((isset($settings[$location.'_ad_'.$index.'_hide_visitor_searchengine']))?$settings[$location.'_ad_'.$index.'_hide_visitor_searchengine']:''), null, 'input', 'margin: -1px 5px 0 0;');
401
- echo quickadsense_get_control('checkbox', 'Indirect', 'quick_adsense_settings_'.$location.'_ad_'.$index.'_hide_visitor_indirect', 'quick_adsense_settings['.$location.'_ad_'.$index.'_hide_visitor_indirect]', ((isset($settings[$location.'_ad_'.$index.'_hide_visitor_indirect']))?$settings[$location.'_ad_'.$index.'_hide_visitor_indirect']:''), null, 'input', 'margin: -1px 5px 0 15px;');
402
- echo quickadsense_get_control('checkbox', 'Direct', 'quick_adsense_settings_'.$location.'_ad_'.$index.'_hide_visitor_direct', 'quick_adsense_settings['.$location.'_ad_'.$index.'_hide_visitor_direct]', ((isset($settings[$location.'_ad_'.$index.'_hide_visitor_direct']))?$settings[$location.'_ad_'.$index.'_hide_visitor_direct']:''), null, 'input', 'margin: -1px 5px 0 15px;');
403
- echo '</p>';
404
- echo '<p class="quick_adsense_'.$location.'_adunits_device_controls">';
405
- echo '<b>Hide by Visitor Type:</b><br />';
406
- echo quickadsense_get_control('checkbox', 'Bots', 'quick_adsense_settings_'.$location.'_ad_'.$index.'_hide_visitor_bot', 'quick_adsense_settings['.$location.'_ad_'.$index.'_hide_visitor_bot]', ((isset($settings[$location.'_ad_'.$index.'_hide_visitor_bot']))?$settings[$location.'_ad_'.$index.'_hide_visitor_bot']:''), null, 'input', 'margin: -1px 5px 0 0;');
407
- echo quickadsense_get_control('checkbox', 'Known Browser', 'quick_adsense_settings_'.$location.'_ad_'.$index.'_hide_visitor_knownbrowser', 'quick_adsense_settings['.$location.'_ad_'.$index.'_hide_visitor_knownbrowser]', ((isset($settings[$location.'_ad_'.$index.'_hide_visitor_knownbrowser']))?$settings[$location.'_ad_'.$index.'_hide_visitor_knownbrowser']:''), null, 'input', 'margin: -1px 5px 0 15px;');
408
- echo quickadsense_get_control('checkbox', 'Unknown Browser', 'quick_adsense_settings_'.$location.'_ad_'.$index.'_hide_visitor_unknownbrowser', 'quick_adsense_settings['.$location.'_ad_'.$index.'_hide_visitor_unknownbrowser]', ((isset($settings[$location.'_ad_'.$index.'_hide_visitor_unknownbrowser']))?$settings[$location.'_ad_'.$index.'_hide_visitor_unknownbrowser']:''), null, 'input', 'margin: -1px 5px 0 15px;');
409
- echo '<br/ >';
410
- echo quickadsense_get_control('checkbox', 'Guest', 'quick_adsense_settings_'.$location.'_ad_'.$index.'_hide_visitor_guest', 'quick_adsense_settings['.$location.'_ad_'.$index.'_hide_visitor_guest]', ((isset($settings[$location.'_ad_'.$index.'_hide_visitor_guest']))?$settings[$location.'_ad_'.$index.'_hide_visitor_guest']:''), null, 'input', 'margin: -1px 5px 0 0;');
411
- echo quickadsense_get_control('checkbox', 'Logged-in', 'quick_adsense_settings_'.$location.'_ad_'.$index.'_hide_visitor_loggedin', 'quick_adsense_settings['.$location.'_ad_'.$index.'_hide_visitor_loggedin]', ((isset($settings[$location.'_ad_'.$index.'_hide_visitor_loggedin']))?$settings[$location.'_ad_'.$index.'_hide_visitor_loggedin']:''), null, 'input', 'margin: -1px 5px 0 15px;');
412
- echo '</p>';
413
- echo '<p class="quick_adsense_'.$location.'_adunits_device_controls">';
414
- echo '<b>Limit by Visitor Countries:</b><br />';
415
- echo quickadsense_get_control('multiselect', '', 'quick_adsense_settings_'.$location.'_ad_'.$index.'_limit_visitor_country', 'quick_adsense_settings['.$location.'_ad_'.$index.'_limit_visitor_country][]', ((isset($settings[$location.'_ad_'.$index.'_limit_visitor_country']))?$settings[$location.'_ad_'.$index.'_limit_visitor_country']:''), quick_adsense_get_countries());
416
- echo '</p>';
417
- echo '<p class="quick_adsense_'.$location.'_adunits_device_controls">';
418
- echo '<b>Ad Stats:</b><br />';
419
- echo quickadsense_get_control('checkbox', 'Enable Stats', 'quick_adsense_settings_'.$location.'_ad_'.$index.'_enable_stats', 'quick_adsense_settings['.$location.'_ad_'.$index.'_enable_stats]', ((isset($settings[$location.'_ad_'.$index.'_enable_stats']))?$settings[$location.'_ad_'.$index.'_enable_stats']:''), null, 'input', 'margin: -1px 5px 0 0;');
420
- echo '<br /><input class="quick_adsense_'.$location.'_ad_show_stats input button-secondary" data-index="'.$index.'" type="button" value="View Stats" />&nbsp;<input class="quick_adsense_'.$location.'_ad_reset_stats input button-secondary right" data-index="'.$index.'" type="button" value="Reset Stats" />';
421
- echo '</p>';
422
- }
423
-
424
- function quick_adsense_validate($input) {
425
- delete_transient('quick_adsense_adstxt_adsense_autocheck_content');
426
- return $input;
427
- }
428
-
429
- add_action('wp_ajax_quick_adsense_onpost_ad_reset_stats', 'quick_adsense_onpost_ad_reset_stats');
430
- function quick_adsense_onpost_ad_reset_stats() {
431
- if(isset($_POST['index'])) {
432
- delete_option('quick_adsense_onpost_ad_'.$_POST['index'].'_stats');
433
- echo '###SUCCESS###';
434
- }
435
- die();
436
- }
437
-
438
- add_action('wp_ajax_quick_adsense_onpost_ad_get_stats_chart', 'quick_adsense_onpost_ad_get_stats_chart');
439
- function quick_adsense_onpost_ad_get_stats_chart() {
440
- if(isset($_POST['index'])) {
441
- echo '###SUCCESS###';
442
- echo '<div id="quick_adsense_ad_stats_chart_wrapper">';
443
- echo '<p>&nbsp;</p>';
444
- echo '<canvas id="quick_adsense_ad_stats_chart" width="1377" height="360"></canvas>';
445
- echo '<textarea id="quick_adsense_ad_stats_chart_data" style="display: none;">[';
446
- $stats = get_option('quick_adsense_onpost_ad_'.$_POST['index'].'_stats');
447
- for($i = 0; $i < 30; $i++) {
448
- $clicks = 0;
449
- $impressions = 0;
450
- if(isset($stats) && is_array($stats) && isset($stats[date('dmY', strtotime('-'.$i.' day'))])) {
451
- $clicks = $stats[date('dmY', strtotime('-'.$i.' day'))]['c'];
452
- $impressions = $stats[date('dmY', strtotime('-'.$i.' day'))]['i'];
453
- }
454
- if($i != 0) {
455
- echo ',';
456
- }
457
- echo '{"x": "'.date('m/d/Y', strtotime('-'.$i.' day')).'", "y": "'.$impressions.'", "y1": "'.$clicks.'"}';
458
- }
459
- echo ']</textarea>';
460
- echo '<p><small>The Stats recorded by the plugin will be different than that recorded by your ad provider due to different factors like accidental clicks, fraud detection, spam clicks etc.<br />Use the stats provided by the ad provider in case of discrepancy.</small></p>';
461
- echo '</div>';
462
- }
463
- die();
464
- }
465
-
466
- add_action('admin_enqueue_scripts', function($hook) {
467
- if($hook != 'toplevel_page_quick-adsense') {
468
- return;
469
- }
470
- if(isset($_GET['deactivate'])) {
471
- delete_option('quick_adsense_validate');
472
- }
473
- wp_enqueue_script('quick_adsense_admin_js', plugins_url('/js/admin.js', __FILE__), array('jquery', 'jquery-ui-core', 'jquery-ui-tabs'));
474
- });
475
-
476
- function quick_adsense_get_countries() {
477
- $data = array(
478
- array('value' => 'AD', 'text' => 'Andorra'),
479
- array('value' => 'AE', 'text' => 'United Arab Emirates'),
480
- array('value' => 'AF', 'text' => 'Afghanistan'),
481
- array('value' => 'AG', 'text' => 'Antigua and Barbuda'),
482
- array('value' => 'AI', 'text' => 'Anguilla'),
483
- array('value' => 'AL', 'text' => 'Albania'),
484
- array('value' => 'AM', 'text' => 'Armenia'),
485
- array('value' => 'AN', 'text' => 'Netherlands Antilles'),
486
- array('value' => 'AO', 'text' => 'Angola'),
487
- array('value' => 'AQ', 'text' => 'Antarctica'),
488
- array('value' => 'AR', 'text' => 'Argentina'),
489
- array('value' => 'AS', 'text' => 'American Samoa'),
490
- array('value' => 'AT', 'text' => 'Austria'),
491
- array('value' => 'AU', 'text' => 'Australia'),
492
- array('value' => 'AW', 'text' => 'Aruba'),
493
- array('value' => 'AZ', 'text' => 'Azerbaijan'),
494
- array('value' => 'BA', 'text' => 'Bosnia and Herzegovina'),
495
- array('value' => 'BB', 'text' => 'Barbados'),
496
- array('value' => 'BD', 'text' => 'Bangladesh'),
497
- array('value' => 'BE', 'text' => 'Belgium'),
498
- array('value' => 'BF', 'text' => 'Burkina Faso'),
499
- array('value' => 'BG', 'text' => 'Bulgaria'),
500
- array('value' => 'BH', 'text' => 'Bahrain'),
501
- array('value' => 'BI', 'text' => 'Burundi'),
502
- array('value' => 'BJ', 'text' => 'Benin'),
503
- array('value' => 'BM', 'text' => 'Bermuda'),
504
- array('value' => 'BN', 'text' => 'Brunei Darussalam'),
505
- array('value' => 'BO', 'text' => 'Bolivia'),
506
- array('value' => 'BR', 'text' => 'Brazil'),
507
- array('value' => 'BS', 'text' => 'Bahamas'),
508
- array('value' => 'BT', 'text' => 'Bhutan'),
509
- array('value' => 'BV', 'text' => 'Bouvet Island'),
510
- array('value' => 'BW', 'text' => 'Botswana'),
511
- array('value' => 'BY', 'text' => 'Belarus'),
512
- array('value' => 'BZ', 'text' => 'Belize'),
513
- array('value' => 'CA', 'text' => 'Canada'),
514
- array('value' => 'CC', 'text' => 'Cocos (Keeling) Islands'),
515
- array('value' => 'CD', 'text' => 'The Democratic Republic of the Congo'),
516
- array('value' => 'CF', 'text' => 'Central African Republic'),
517
- array('value' => 'CG', 'text' => 'Congo'),
518
- array('value' => 'CH', 'text' => 'Switzerland'),
519
- array('value' => 'CI', 'text' => 'Cote D\'Ivoire'),
520
- array('value' => 'CK', 'text' => 'Cook Islands'),
521
- array('value' => 'CL', 'text' => 'Chile'),
522
- array('value' => 'CM', 'text' => 'Cameroon'),
523
- array('value' => 'CN', 'text' => 'China'),
524
- array('value' => 'CO', 'text' => 'Colombia'),
525
- array('value' => 'CR', 'text' => 'Costa Rica'),
526
- array('value' => 'CU', 'text' => 'Cuba'),
527
- array('value' => 'CV', 'text' => 'Cape Verde'),
528
- array('value' => 'CX', 'text' => 'Christmas Island'),
529
- array('value' => 'CY', 'text' => 'Cyprus'),
530
- array('value' => 'CZ', 'text' => 'Czech Republic'),
531
- array('value' => 'DE', 'text' => 'Germany'),
532
- array('value' => 'DJ', 'text' => 'Djibouti'),
533
- array('value' => 'DK', 'text' => 'Denmark'),
534
- array('value' => 'DM', 'text' => 'Dominica'),
535
- array('value' => 'DO', 'text' => 'Dominican Republic'),
536
- array('value' => 'DZ', 'text' => 'Algeria'),
537
- array('value' => 'EC', 'text' => 'Ecuador'),
538
- array('value' => 'EE', 'text' => 'Estonia'),
539
- array('value' => 'EG', 'text' => 'Egypt'),
540
- array('value' => 'EH', 'text' => 'Western Sahara'),
541
- array('value' => 'ER', 'text' => 'Eritrea'),
542
- array('value' => 'ES', 'text' => 'Spain'),
543
- array('value' => 'ET', 'text' => 'Ethiopia'),
544
- array('value' => 'FI', 'text' => 'Finland'),
545
- array('value' => 'FJ', 'text' => 'Fiji'),
546
- array('value' => 'FK', 'text' => 'Falkland Islands (Malvinas)'),
547
- array('value' => 'FM', 'text' => 'Federated States of Micronesia'),
548
- array('value' => 'FO', 'text' => 'Faroe Islands'),
549
- array('value' => 'FR', 'text' => 'France'),
550
- array('value' => 'FX', 'text' => 'France Metropolitan'),
551
- array('value' => 'GA', 'text' => 'Gabon'),
552
- array('value' => 'GB', 'text' => 'United Kingdom'),
553
- array('value' => 'GD', 'text' => 'Grenada'),
554
- array('value' => 'GE', 'text' => 'Georgia'),
555
- array('value' => 'GF', 'text' => 'French Guiana'),
556
- array('value' => 'GH', 'text' => 'Ghana'),
557
- array('value' => 'GI', 'text' => 'Gibraltar'),
558
- array('value' => 'GL', 'text' => 'Greenland'),
559
- array('value' => 'GM', 'text' => 'Gambia'),
560
- array('value' => 'GN', 'text' => 'Guinea'),
561
- array('value' => 'GP', 'text' => 'Guadeloupe'),
562
- array('value' => 'GQ', 'text' => 'Equatorial Guinea'),
563
- array('value' => 'GR', 'text' => 'Greece'),
564
- array('value' => 'GS', 'text' => 'South Georgia and the South Sandwich Islands'),
565
- array('value' => 'GT', 'text' => 'Guatemala'),
566
- array('value' => 'GU', 'text' => 'Guam'),
567
- array('value' => 'GW', 'text' => 'Guinea-Bissau'),
568
- array('value' => 'GY', 'text' => 'Guyana'),
569
- array('value' => 'HK', 'text' => 'Hong Kong'),
570
- array('value' => 'HM', 'text' => 'Heard Island and McDonald Islands'),
571
- array('value' => 'HN', 'text' => 'Honduras'),
572
- array('value' => 'HR', 'text' => 'Croatia'),
573
- array('value' => 'HT', 'text' => 'Haiti'),
574
- array('value' => 'HU', 'text' => 'Hungary'),
575
- array('value' => 'ID', 'text' => 'Indonesia'),
576
- array('value' => 'IE', 'text' => 'Ireland'),
577
- array('value' => 'IL', 'text' => 'Israel'),
578
- array('value' => 'IN', 'text' => 'India'),
579
- array('value' => 'IO', 'text' => 'British Indian Ocean Territory'),
580
- array('value' => 'IQ', 'text' => 'Iraq'),
581
- array('value' => 'IR', 'text' => 'Islamic Republic of Iran'),
582
- array('value' => 'IS', 'text' => 'Iceland'),
583
- array('value' => 'IT', 'text' => 'Italy'),
584
- array('value' => 'JM', 'text' => 'Jamaica'),
585
- array('value' => 'JO', 'text' => 'Jordan'),
586
- array('value' => 'JP', 'text' => 'Japan'),
587
- array('value' => 'KE', 'text' => 'Kenya'),
588
- array('value' => 'KG', 'text' => 'Kyrgyzstan'),
589
- array('value' => 'KH', 'text' => 'Cambodia'),
590
- array('value' => 'KI', 'text' => 'Kiribati'),
591
- array('value' => 'KM', 'text' => 'Comoros'),
592
- array('value' => 'KN', 'text' => 'Saint Kitts and Nevis'),
593
- array('value' => 'KP', 'text' => 'Democratic People\'s Republic of Korea'),
594
- array('value' => 'KR', 'text' => 'Republic of Korea'),
595
- array('value' => 'KW', 'text' => 'Kuwait'),
596
- array('value' => 'KY', 'text' => 'Cayman Islands'),
597
- array('value' => 'KZ', 'text' => 'Kazakhstan'),
598
- array('value' => 'LA', 'text' => 'Lao People\'s Democratic Republic'),
599
- array('value' => 'LB', 'text' => 'Lebanon'),
600
- array('value' => 'LC', 'text' => 'Saint Lucia'),
601
- array('value' => 'LI', 'text' => 'Liechtenstein'),
602
- array('value' => 'LK', 'text' => 'Sri Lanka'),
603
- array('value' => 'LR', 'text' => 'Liberia'),
604
- array('value' => 'LS', 'text' => 'Lesotho'),
605
- array('value' => 'LT', 'text' => 'Lithuania'),
606
- array('value' => 'LU', 'text' => 'Luxembourg'),
607
- array('value' => 'LV', 'text' => 'Latvia'),
608
- array('value' => 'LY', 'text' => 'Libyan Arab Jamahiriya'),
609
- array('value' => 'MA', 'text' => 'Morocco'),
610
- array('value' => 'MC', 'text' => 'Monaco'),
611
- array('value' => 'MD', 'text' => 'Republic of Moldova'),
612
- array('value' => 'MG', 'text' => 'Madagascar'),
613
- array('value' => 'MH', 'text' => 'Marshall Islands'),
614
- array('value' => 'MK', 'text' => 'Macedonia'),
615
- array('value' => 'ML', 'text' => 'Mali'),
616
- array('value' => 'MM', 'text' => 'Myanmar'),
617
- array('value' => 'MN', 'text' => 'Mongolia'),
618
- array('value' => 'MO', 'text' => 'Macau'),
619
- array('value' => 'MP', 'text' => 'Northern Mariana Islands'),
620
- array('value' => 'MQ', 'text' => 'Martinique'),
621
- array('value' => 'MR', 'text' => 'Mauritania'),
622
- array('value' => 'MS', 'text' => 'Montserrat'),
623
- array('value' => 'MT', 'text' => 'Malta'),
624
- array('value' => 'MU', 'text' => 'Mauritius'),
625
- array('value' => 'MV', 'text' => 'Maldives'),
626
- array('value' => 'MW', 'text' => 'Malawi'),
627
- array('value' => 'MX', 'text' => 'Mexico'),
628
- array('value' => 'MY', 'text' => 'Malaysia'),
629
- array('value' => 'MZ', 'text' => 'Mozambique'),
630
- array('value' => 'NA', 'text' => 'Namibia'),
631
- array('value' => 'NC', 'text' => 'New Caledonia'),
632
- array('value' => 'NE', 'text' => 'Niger'),
633
- array('value' => 'NF', 'text' => 'Norfolk Island'),
634
- array('value' => 'NG', 'text' => 'Nigeria'),
635
- array('value' => 'NI', 'text' => 'Nicaragua'),
636
- array('value' => 'NL', 'text' => 'Netherlands'),
637
- array('value' => 'NO', 'text' => 'Norway'),
638
- array('value' => 'NP', 'text' => 'Nepal'),
639
- array('value' => 'NR', 'text' => 'Nauru'),
640
- array('value' => 'NU', 'text' => 'Niue'),
641
- array('value' => 'NZ', 'text' => 'New Zealand'),
642
- array('value' => 'OM', 'text' => 'Oman'),
643
- array('value' => 'PA', 'text' => 'Panama'),
644
- array('value' => 'PE', 'text' => 'Peru'),
645
- array('value' => 'PF', 'text' => 'French Polynesia'),
646
- array('value' => 'PG', 'text' => 'Papua New Guinea'),
647
- array('value' => 'PH', 'text' => 'Philippines'),
648
- array('value' => 'PK', 'text' => 'Pakistan'),
649
- array('value' => 'PL', 'text' => 'Poland'),
650
- array('value' => 'PM', 'text' => 'Saint Pierre and Miquelon'),
651
- array('value' => 'PN', 'text' => 'Pitcairn Islands'),
652
- array('value' => 'PR', 'text' => 'Puerto Rico'),
653
- array('value' => 'PS', 'text' => 'Palestinian Territory'),
654
- array('value' => 'PT', 'text' => 'Portugal'),
655
- array('value' => 'PW', 'text' => 'Palau'),
656
- array('value' => 'PY', 'text' => 'Paraguay'),
657
- array('value' => 'QA', 'text' => 'Qatar'),
658
- array('value' => 'RE', 'text' => 'Reunion'),
659
- array('value' => 'RO', 'text' => 'Romania'),
660
- array('value' => 'RU', 'text' => 'Russian Federation'),
661
- array('value' => 'RW', 'text' => 'Rwanda'),
662
- array('value' => 'SA', 'text' => 'Saudi Arabia'),
663
- array('value' => 'SB', 'text' => 'Solomon Islands'),
664
- array('value' => 'SC', 'text' => 'Seychelles'),
665
- array('value' => 'SD', 'text' => 'Sudan'),
666
- array('value' => 'SE', 'text' => 'Sweden'),
667
- array('value' => 'SG', 'text' => 'Singapore'),
668
- array('value' => 'SH', 'text' => 'Saint Helena'),
669
- array('value' => 'SI', 'text' => 'Slovenia'),
670
- array('value' => 'SJ', 'text' => 'Svalbard and Jan Mayen'),
671
- array('value' => 'SK', 'text' => 'Slovakia'),
672
- array('value' => 'SL', 'text' => 'Sierra Leone'),
673
- array('value' => 'SM', 'text' => 'San Marino'),
674
- array('value' => 'SN', 'text' => 'Senegal'),
675
- array('value' => 'SO', 'text' => 'Somalia'),
676
- array('value' => 'SR', 'text' => 'Suriname'),
677
- array('value' => 'ST', 'text' => 'Sao Tome and Principe'),
678
- array('value' => 'SV', 'text' => 'El Salvador'),
679
- array('value' => 'SY', 'text' => 'Syrian Arab Republic'),
680
- array('value' => 'SZ', 'text' => 'Swaziland'),
681
- array('value' => 'TC', 'text' => 'Turks and Caicos Islands'),
682
- array('value' => 'TD', 'text' => 'Chad'),
683
- array('value' => 'TF', 'text' => 'French Southern Territories'),
684
- array('value' => 'TG', 'text' => 'Togo'),
685
- array('value' => 'TH', 'text' => 'Thailand'),
686
- array('value' => 'TJ', 'text' => 'Tajikistan'),
687
- array('value' => 'TK', 'text' => 'Tokelau'),
688
- array('value' => 'TM', 'text' => 'Turkmenistan'),
689
- array('value' => 'TN', 'text' => 'Tunisia'),
690
- array('value' => 'TO', 'text' => 'Tonga'),
691
- array('value' => 'TL', 'text' => 'Timor-Leste'),
692
- array('value' => 'TR', 'text' => 'Turkey'),
693
- array('value' => 'TT', 'text' => 'Trinidad and Tobago'),
694
- array('value' => 'TV', 'text' => 'Tuvalu'),
695
- array('value' => 'TW', 'text' => 'Taiwan'),
696
- array('value' => 'TZ', 'text' => 'United Republic of Tanzania'),
697
- array('value' => 'UA', 'text' => 'Ukraine'),
698
- array('value' => 'UG', 'text' => 'Uganda'),
699
- array('value' => 'UM', 'text' => 'United States Minor Outlying Islands'),
700
- array('value' => 'US', 'text' => 'United States'),
701
- array('value' => 'UY', 'text' => 'Uruguay'),
702
- array('value' => 'UZ', 'text' => 'Uzbekistan'),
703
- array('value' => 'VA', 'text' => 'Holy See (Vatican City State)'),
704
- array('value' => 'VC', 'text' => 'Saint Vincent and the Grenadines'),
705
- array('value' => 'VE', 'text' => 'Venezuela'),
706
- array('value' => 'VG', 'text' => 'British Virgin Islands'),
707
- array('value' => 'VI', 'text' => 'U.S. Virgin Islands'),
708
- array('value' => 'VN', 'text' => 'Vietnam'),
709
- array('value' => 'VU', 'text' => 'Vanuatu'),
710
- array('value' => 'WF', 'text' => 'Wallis and Futuna'),
711
- array('value' => 'WS', 'text' => 'Samoa'),
712
- array('value' => 'YE', 'text' => 'Yemen'),
713
- array('value' => 'YT', 'text' => 'Mayotte'),
714
- array('value' => 'RS', 'text' => 'Serbia'),
715
- array('value' => 'ZA', 'text' => 'South Africa'),
716
- array('value' => 'ZM', 'text' => 'Zambia'),
717
- array('value' => 'ME', 'text' => 'Montenegro'),
718
- array('value' => 'ZW', 'text' => 'Zimbabwe'),
719
- array('value' => 'AX', 'text' => 'Aland Islands'),
720
- array('value' => 'GG', 'text' => 'Guernsey'),
721
- array('value' => 'IM', 'text' => 'Isle of Man'),
722
- array('value' => 'JE', 'text' => 'Jersey'),
723
- array('value' => 'BL', 'text' => 'Saint Barthelemy'),
724
- array('value' => 'MF', 'text' => 'Saint Martin')
725
- );
726
- array_multisort(array_column($data, 'text'), SORT_ASC, $data);
727
- return $data;
728
- }
729
- ?>
1
+ <?php
2
+ /**
3
+ * The plugin settings page.
4
+ */
5
+
6
+ /**
7
+ * Add a settings page link to the plugin listing in the plugins admin page.
8
+ */
9
+ add_action(
10
+ 'plugin_action_links_quick-adsense/quick-adsense.php',
11
+ function( $links ) {
12
+ $links = array_merge(
13
+ [ '<a href="' . esc_url( admin_url( '/admin.php?page=quick-adsense' ) ) . '">Settings</a>' ],
14
+ $links
15
+ );
16
+ return $links;
17
+ }
18
+ );
19
+
20
+ /**
21
+ * Create the Admin menu entry for the settings page.
22
+ */
23
+ add_action(
24
+ 'admin_menu',
25
+ function() {
26
+ add_menu_page(
27
+ 'Quick Adsense Options',
28
+ 'Quick Adsense',
29
+ 'manage_options',
30
+ 'quick-adsense',
31
+ function() {
32
+ // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
33
+ // Contains textareas which need to allow output of scripts, iframes etc necessary to output ads and trackers.
34
+ echo quick_adsense_load_file( 'templates/page-settings.php' );
35
+ // phpcs:enable
36
+ }
37
+ );
38
+ }
39
+ );
40
+
41
+ /**
42
+ * Add scripts and styles for Settings page.
43
+ */
44
+ add_action(
45
+ 'admin_enqueue_scripts',
46
+ function( $hook ) {
47
+ global $wp_scripts;
48
+ if ( 'toplevel_page_quick-adsense' === $hook ) {
49
+ wp_enqueue_script( 'quick-adsense-chart-scripts', plugins_url( '../assets/js/Chart.bundle.min.js', __FILE__ ), [ 'jquery', 'jquery-ui-core', 'jquery-ui-accordion', 'jquery-ui-dialog' ], '2.7.0', false );
50
+ wp_enqueue_style( 'quick-adsense-jquery-ui', 'http://ajax.googleapis.com/ajax/libs/jqueryui/' . $wp_scripts->registered['jquery-ui-core']->ver . '/themes/smoothness/jquery-ui.css', [], $wp_scripts->registered['jquery-ui-core']->ver );
51
+ wp_enqueue_style( 'quick-adsense-admin-styles', plugins_url( '../assets/css/admin.css', __FILE__ ), [], '2.8.0' );
52
+ wp_enqueue_script( 'quick-adsense-admin-scripts', plugins_url( '../assets/js/admin.js', __FILE__ ), [ 'jquery', 'jquery-ui-core', 'jquery-ui-tabs', 'wp-util' ], '2.8.0', false );
53
+ wp_localize_script(
54
+ 'quick-adsense-admin-scripts',
55
+ 'quick_adsense',
56
+ [
57
+ 'ajax_url' => admin_url( 'admin-ajax.php' ),
58
+ 'nonce' => wp_create_nonce( 'quick-adsense-nonce' ),
59
+ ]
60
+ );
61
+ }
62
+ }
63
+ );
64
+
65
+ /**
66
+ * Register settings and sections.
67
+ */
68
+ add_action(
69
+ 'admin_init',
70
+ function() {
71
+ register_setting(
72
+ 'quick_adsense_settings',
73
+ 'quick_adsense_settings',
74
+ function( $input ) {
75
+ delete_transient( 'quick_adsense_adstxt_adsense_autocheck_content' );
76
+ return $input;
77
+ }
78
+ );
79
+ $settings = get_option( 'quick_adsense_settings' );
80
+ $settings['alignment_options'] = [
81
+ [
82
+ 'text' => 'Left',
83
+ 'value' => '1',
84
+ ],
85
+ [
86
+ 'text' => 'Center',
87
+ 'value' => '2',
88
+ ],
89
+ [
90
+ 'text' => 'Right',
91
+ 'value' => '3',
92
+ ],
93
+ [
94
+ 'text' => 'None',
95
+ 'value' => '4',
96
+ ],
97
+ ];
98
+ add_settings_section(
99
+ 'quick_adsense_general',
100
+ '',
101
+ function() use ( $settings ) {
102
+ echo wp_kses(
103
+ quick_adsense_load_file( 'templates/section-general.php', $settings ),
104
+ quick_adsense_get_allowed_html()
105
+ );
106
+ },
107
+ 'quick-adsense-general'
108
+ );
109
+ $settings['location'] = 'onpost';
110
+ add_settings_section(
111
+ 'quick_adsense_onpost',
112
+ '',
113
+ function() use ( $settings ) {
114
+ // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
115
+ // Contains textareas which need to allow output of scripts, iframes etc necessary to output ads and trackers.
116
+ echo quick_adsense_load_file( 'templates/section-onpost-content.php', $settings );
117
+ // phpcs:enable
118
+ },
119
+ 'quick-adsense-onpost'
120
+ );
121
+ $settings['location'] = 'widgets';
122
+ add_settings_section(
123
+ 'quick_adsense_widgets',
124
+ '',
125
+ function() use ( $settings ) {
126
+ // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
127
+ // Contains textareas which need to allow output of scripts, iframes etc necessary to output ads and trackers.
128
+ echo quick_adsense_load_file( 'templates/section-widgets.php', $settings );
129
+ // phpcs:enable
130
+ },
131
+ 'quick-adsense-widgets'
132
+ );
133
+ $settings['location'] = 'header_footer_codes';
134
+ add_settings_section(
135
+ 'quick_adsense_header_footer_codes',
136
+ '',
137
+ function() use ( $settings ) {
138
+ // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
139
+ // Contains textareas which need to allow output of scripts, iframes etc necessary to output ads and trackers.
140
+ echo quick_adsense_load_file( 'templates/section-header-footer.php', $settings );
141
+ // phpcs:enable
142
+ },
143
+ 'quick-adsense-header-footer-codes'
144
+ );
145
+ }
146
+ );
147
+
148
+ add_action(
149
+ 'wp_ajax_quick_adsense_onpost_ad_reset_stats',
150
+ function() {
151
+ if ( isset( $_POST['nonce'] ) && wp_verify_nonce( sanitize_key( $_POST['nonce'] ), 'quick-adsense-nonce' ) && ( isset( $_POST['index'] ) ) ) {
152
+ delete_option( 'quick_adsense_onpost_ad_' . sanitize_key( $_POST['index'] ) . '_stats' );
153
+ wp_send_json_success();
154
+ }
155
+ wp_send_json_error();
156
+ }
157
+ );
158
+
159
+
160
+ add_action(
161
+ 'wp_ajax_quick_adsense_onpost_ad_get_stats_chart',
162
+ function() {
163
+ if ( isset( $_POST['nonce'] ) && wp_verify_nonce( sanitize_key( $_POST['nonce'] ), 'quick-adsense-nonce' ) && ( isset( $_POST['index'] ) ) ) {
164
+ $stats = get_option( 'quick_adsense_onpost_ad_' . sanitize_key( $_POST['index'] ) . '_stats' );
165
+ $stats_data = [];
166
+ for ( $i = 0; $i < 30; $i++ ) {
167
+ $clicks = 0;
168
+ $impressions = 0;
169
+ if ( isset( $stats ) && is_array( $stats ) && isset( $stats[ gmdate( 'dmY', strtotime( '-' . $i . ' day' ) ) ] ) ) {
170
+ $clicks = $stats[ gmdate( 'dmY', strtotime( '-' . $i . ' day' ) ) ]['c'];
171
+ $impressions = $stats[ gmdate( 'dmY', strtotime( '-' . $i . ' day' ) ) ]['i'];
172
+ }
173
+ $stats_data[] = [
174
+ 'x' => gmdate( 'm/d/Y', strtotime( '-' . $i . ' day' ) ),
175
+ 'y' => $impressions,
176
+ 'y1' => $clicks,
177
+ ];
178
+ }
179
+ wp_send_json_success(
180
+ quick_adsense_load_file(
181
+ 'templates/block-stats-chart.php',
182
+ [
183
+ 'stats_data' => wp_json_encode( $stats_data ),
184
+ ]
185
+ )
186
+ );
187
+ }
188
+ wp_send_json_error();
189
+ }
190
+ );
191
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/templates/adunit-onpost.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $adunit_index = quick_adsense_get_value( $args, 'adunit_index' ); ?>
2
+ <div id="quick_adsense_onpost_adunits_control_<?php echo esc_attr( $adunit_index ); ?>" class="quick_adsense_onpost_adunits_control_wrapper">
3
+ <div class="quick_adsense_onpost_adunits_label">Ads<?php echo esc_attr( $adunit_index ); ?></div>
4
+ <div class="quick_adsense_onpost_adunits_control">
5
+ <?php
6
+ // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
7
+ // This textarea needs to allow output of scripts, iframes etc necessary to output ads and trackers.
8
+ echo quickadsense_get_control(
9
+ 'textarea',
10
+ '',
11
+ 'quick_adsense_settings_onpost_ad_' . $adunit_index . '_content',
12
+ 'quick_adsense_settings[onpost_ad_' . $adunit_index . '_content]',
13
+ quick_adsense_get_value( $args, 'onpost_ad_' . $adunit_index . '_content' ),
14
+ null,
15
+ 'input',
16
+ 'display: block; margin: 0 0 10px 0',
17
+ 'Enter Code'
18
+ );
19
+ // phpcs:enable
20
+ ?>
21
+ <p class="quick_adsense_onpost_adunits_styling_controls">
22
+ Alignment
23
+ <?php
24
+ echo wp_kses(
25
+ quickadsense_get_control(
26
+ 'select',
27
+ '',
28
+ 'quick_adsense_settings_onpost_ad_' . $adunit_index . '_alignment',
29
+ 'quick_adsense_settings[onpost_ad_' . $adunit_index . '_alignment]',
30
+ quick_adsense_get_value( $args, 'onpost_ad_' . $adunit_index . '_alignment' ),
31
+ quick_adsense_get_value( $args, 'alignment_options' ),
32
+ 'input',
33
+ 'margin: -2px 20px 0 10px;'
34
+ ),
35
+ quick_adsense_get_allowed_html()
36
+ );
37
+ ?>
38
+ <wbr />margin
39
+ <?php
40
+ echo wp_kses(
41
+ quickadsense_get_control(
42
+ 'number',
43
+ '',
44
+ 'quick_adsense_settings_onpost_ad_' . $adunit_index . '_margin',
45
+ 'quick_adsense_settings[onpost_ad_' . $adunit_index . '_margin]',
46
+ quick_adsense_get_value( $args, 'onpost_ad_' . $adunit_index . '_margin' ),
47
+ null,
48
+ 'input',
49
+ 'margin: -2px 10px 0 10px; width: 52px;'
50
+ ),
51
+ quick_adsense_get_allowed_html()
52
+ );
53
+ ?>
54
+ px
55
+ </p>
56
+ <?php
57
+ echo wp_kses(
58
+ quick_adsense_load_file( 'templates/block-adunit-advanced.php', $args ),
59
+ quick_adsense_get_allowed_html()
60
+ );
61
+ ?>
62
+ </div>
63
+ <div class="clear"></div>
64
+ </div>
includes/templates/adunit-widget.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $adunit_index = quick_adsense_get_value( $args, 'adunit_index' ); ?>
2
+ <div id="quick_adsense_widget_adunits_control_<?php echo esc_attr( $adunit_index ); ?>" class="quick_adsense_widget_adunits_control_wrapper">
3
+ <div class="quick_adsense_widget_adunits_label">AdsWidget<?php echo esc_attr( $adunit_index ); ?></div>
4
+ <div class="quick_adsense_widget_adunits_control">
5
+ <?php
6
+ // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
7
+ // This textarea needs to allow output of scripts, iframes etc necessary to output ads and trackers.
8
+ echo quickadsense_get_control(
9
+ 'textarea',
10
+ '',
11
+ 'quick_adsense_settings_widget_ad_' . $adunit_index . '_content',
12
+ 'quick_adsense_settings[widget_ad_' . $adunit_index . '_content]',
13
+ quick_adsense_get_value( $args, 'widget_ad_' . $adunit_index . '_content' ),
14
+ null,
15
+ 'input',
16
+ 'display: block; margin: 0 0 10px 0;',
17
+ 'Enter Code'
18
+ );
19
+ // phpcs:enable
20
+ ?>
21
+ </div>
22
+ <div class="clear"></div>
23
+ </div>
includes/templates/block-adsense-adstxt-notice.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="notice notice-error quick_adsense_adstxt_adsense_notice is-dismissible" style="padding: 15px;">
2
+ <p><b>Quick Adsense</b> had detected that your ads.txt file does not have all your Google Adsense Publisher IDs.<br />This will severely impact your adsense earnings and your immediate attention is required.</p>
3
+ <p>Your recommended google entries for ads.txt is as given below.<br />You can manually copy this to your ads.txt file or
4
+ <?php if ( ( ! quick_adsense_get_value( $args, 'is_ajax' ) ) && ( 'toplevel_page_quick-adsense' !== quick_adsense_get_value( $args, 'screen_id' ) ) ) { ?>
5
+ <a href="<?php echo esc_url( admin_url( '/admin.php?page=quick-adsense#quick_adsense_adstxt_adsense_auto_update' ) ); ?>">CLICK HERE</a>
6
+ <?php } else { ?>
7
+ <a href="#" onclick="quick_adsense_adstxt_adsense_auto_update()">CLICK HERE</a>
8
+ <?php } ?>
9
+ &nbsp;to instruct Quick Adsense to try and add the entries automatically.</p>
10
+ <p><code style="display: block; padding: 2px 10px;"><?php echo esc_html( quick_adsense_get_value( $args, 'adstxt_new_adsense_entries' ) ); ?></code></p>
11
+ <p><small><i><b>We recommend you not to dismiss this notice for continued daily ads.txt monitoring. This notice will stop appearing automatically once Quick Adsense detects correct entries in ads.txt (rechecked daily).</b></i></small></p>
12
+ <div class="clear"></div>
13
+ <?php if ( quick_adsense_get_value( $args, 'is_ajax' ) ) { ?>
14
+ <button type="button" class="notice-dismiss" onclick="javascript:jQuery(this).parent().remove()"><span class="screen-reader-text">Dismiss this notice.</span></button>
15
+ <?php } ?>
16
+ </div>
includes/templates/block-adsense-adstxt-update-failed.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <div class="quick_adsense_popup_content_wrapper">
2
+ <p>Auto Creation / Updation of ads.txt failed due to access permission restrictions on the server.</p>
3
+ <p>You have to manually upload the file using your Host\'s File manager or your favourite FTP program</p>
4
+ <p>ads.txt should be located in the root of your server. After manually uploading the file click <a href="<?php echo esc_url( site_url( '/ads.txt' ) ); ?>">here</a> to check if its accessible from the correct location</p>
5
+ <textarea style="display: none;" id="quick_adsense_adstxt_content"><?php echo wp_kses( quick_adsense_get_value( $args, 'content' ), quick_adsense_get_allowed_html() ); ?></textarea>
6
+ <p><a onclick="quick_adsense_adstxt_content_download()" class="button button-primary" href="javascript:;">Download ads.txt</a></p>
7
+ </div>
includes/templates/block-adunit-advanced.php ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $adunit_index = quick_adsense_get_value( $args, 'adunit_index' );
3
+ $location = quick_adsense_get_value( $args, 'location' );
4
+ ?>
5
+ <p class="quick_adsense_<?php echo esc_attr( $location ); ?>_adunits_device_controls">
6
+ <b>Hide by Device Type:</b><br />
7
+ <?php
8
+ echo wp_kses(
9
+ quickadsense_get_control(
10
+ 'checkbox',
11
+ 'Mobile',
12
+ 'quick_adsense_settings_' . $location . '_ad_' . $adunit_index . '_hide_device_mobile',
13
+ 'quick_adsense_settings[' . $location . '_ad_' . $adunit_index . '_hide_device_mobile]',
14
+ quick_adsense_get_value( $args, '_ad_' . $adunit_index . '_hide_device_mobile' ),
15
+ null,
16
+ 'input',
17
+ 'margin: -1px 5px 0 0;'
18
+ ),
19
+ quick_adsense_get_allowed_html()
20
+ );
21
+ echo wp_kses(
22
+ quickadsense_get_control(
23
+ 'checkbox',
24
+ 'Tablet',
25
+ 'quick_adsense_settings_' . $location . '_ad_' . $adunit_index . '_hide_device_tablet',
26
+ 'quick_adsense_settings[' . $location . '_ad_' . $adunit_index . '_hide_device_tablet]',
27
+ quick_adsense_get_value( $args, $location . '_ad_' . $adunit_index . '_hide_device_tablet' ),
28
+ null,
29
+ 'input',
30
+ 'margin: -1px 5px 0 15px;'
31
+ ),
32
+ quick_adsense_get_allowed_html()
33
+ );
34
+ echo wp_kses(
35
+ quickadsense_get_control(
36
+ 'checkbox',
37
+ 'Desktop',
38
+ 'quick_adsense_settings_' . $location . '_ad_' . $adunit_index . '_hide_device_desktop',
39
+ 'quick_adsense_settings[' . $location . '_ad_' . $adunit_index . '_hide_device_desktop]',
40
+ quick_adsense_get_value( $args, $location . '_ad_' . $adunit_index . '_hide_device_desktop' ),
41
+ null,
42
+ 'input',
43
+ 'margin: -1px 5px 0 15px;'
44
+ ),
45
+ quick_adsense_get_allowed_html()
46
+ );
47
+ ?>
48
+ </p>
49
+ <p class="quick_adsense_<?php echo esc_attr( $location ); ?>_adunits_device_controls">
50
+ <b>Hide by Visitor Source:</b><br />
51
+ <?php
52
+ echo wp_kses(
53
+ quickadsense_get_control(
54
+ 'checkbox',
55
+ 'Search Engine',
56
+ 'quick_adsense_settings_' . $location . '_ad_' . $adunit_index . '_hide_visitor_searchengine',
57
+ 'quick_adsense_settings[' . $location . '_ad_' . $adunit_index . '_hide_visitor_searchengine]',
58
+ quick_adsense_get_value( $args, $location . '_ad_' . $adunit_index . '_hide_visitor_searchengine' ),
59
+ null,
60
+ 'input',
61
+ 'margin: -1px 5px 0 0;'
62
+ ),
63
+ quick_adsense_get_allowed_html()
64
+ );
65
+ echo wp_kses(
66
+ quickadsense_get_control(
67
+ 'checkbox',
68
+ 'Indirect',
69
+ 'quick_adsense_settings_' . $location . '_ad_' . $adunit_index . '_hide_visitor_indirect',
70
+ 'quick_adsense_settings[' . $location . '_ad_' . $adunit_index . '_hide_visitor_indirect]',
71
+ quick_adsense_get_value( $args, $location . '_ad_' . $adunit_index . '_hide_visitor_indirect' ),
72
+ null,
73
+ 'input',
74
+ 'margin: -1px 5px 0 15px;'
75
+ ),
76
+ quick_adsense_get_allowed_html()
77
+ );
78
+ echo wp_kses(
79
+ quickadsense_get_control(
80
+ 'checkbox',
81
+ 'Direct',
82
+ 'quick_adsense_settings_' . $location . '_ad_' . $adunit_index . '_hide_visitor_direct',
83
+ 'quick_adsense_settings[' . $location . '_ad_' . $adunit_index . '_hide_visitor_direct]',
84
+ quick_adsense_get_value( $args, $location . '_ad_' . $adunit_index . '_hide_visitor_direct' ),
85
+ null,
86
+ 'input',
87
+ 'margin: -1px 5px 0 15px;'
88
+ ),
89
+ quick_adsense_get_allowed_html()
90
+ );
91
+ ?>
92
+ </p>
93
+ <p class="quick_adsense_<?php echo esc_attr( $location ); ?>_adunits_device_controls">
94
+ <b>Hide by Visitor Type:</b><br />
95
+ <?php
96
+ echo wp_kses(
97
+ quickadsense_get_control(
98
+ 'checkbox',
99
+ 'Bots',
100
+ 'quick_adsense_settings_' . $location . '_ad_' . $adunit_index . '_hide_visitor_bot',
101
+ 'quick_adsense_settings[' . $location . '_ad_' . $adunit_index . '_hide_visitor_bot]',
102
+ quick_adsense_get_value( $args, $location . '_ad_' . $adunit_index . '_hide_visitor_bot' ),
103
+ null,
104
+ 'input',
105
+ 'margin: -1px 5px 0 0;'
106
+ ),
107
+ quick_adsense_get_allowed_html()
108
+ );
109
+ echo wp_kses(
110
+ quickadsense_get_control(
111
+ 'checkbox',
112
+ 'Known Browser',
113
+ 'quick_adsense_settings_' . $location . '_ad_' . $adunit_index . '_hide_visitor_knownbrowser',
114
+ 'quick_adsense_settings[' . $location . '_ad_' . $adunit_index . '_hide_visitor_knownbrowser]',
115
+ quick_adsense_get_value( $args, $location . '_ad_' . $adunit_index . '_hide_visitor_knownbrowser' ),
116
+ null,
117
+ 'input',
118
+ 'margin: -1px 5px 0 15px;'
119
+ ),
120
+ quick_adsense_get_allowed_html()
121
+ );
122
+ echo wp_kses(
123
+ quickadsense_get_control(
124
+ 'checkbox',
125
+ 'Unknown Browser',
126
+ 'quick_adsense_settings_' . $location . '_ad_' . $adunit_index . '_hide_visitor_unknownbrowser',
127
+ 'quick_adsense_settings[' . $location . '_ad_' . $adunit_index . '_hide_visitor_unknownbrowser]',
128
+ quick_adsense_get_value( $args, $location . '_ad_' . $adunit_index . '_hide_visitor_unknownbrowser' ),
129
+ null,
130
+ 'input',
131
+ 'margin: -1px 5px 0 15px;'
132
+ ),
133
+ quick_adsense_get_allowed_html()
134
+ );
135
+ ?>
136
+ <br />
137
+ <?php
138
+ echo wp_kses(
139
+ quickadsense_get_control(
140
+ 'checkbox',
141
+ 'Guest',
142
+ 'quick_adsense_settings_' . $location . '_ad_' . $adunit_index . '_hide_visitor_guest',
143
+ 'quick_adsense_settings[' . $location . '_ad_' . $adunit_index . '_hide_visitor_guest]',
144
+ quick_adsense_get_value( $args, $location . '_ad_' . $adunit_index . '_hide_visitor_guest' ),
145
+ null,
146
+ 'input',
147
+ 'margin: -1px 5px 0 0;'
148
+ ),
149
+ quick_adsense_get_allowed_html()
150
+ );
151
+ echo wp_kses(
152
+ quickadsense_get_control(
153
+ 'checkbox',
154
+ 'Logged-in',
155
+ 'quick_adsense_settings_' . $location . '_ad_' . $adunit_index . '_hide_visitor_loggedin',
156
+ 'quick_adsense_settings[' . $location . '_ad_' . $adunit_index . '_hide_visitor_loggedin]',
157
+ quick_adsense_get_value( $args, $location . '_ad_' . $adunit_index . '_hide_visitor_loggedin' ),
158
+ null,
159
+ 'input',
160
+ 'margin: -1px 5px 0 15px;'
161
+ ),
162
+ quick_adsense_get_allowed_html()
163
+ );
164
+ ?>
165
+ </p>
166
+ <p class="quick_adsense_<?php echo esc_attr( $location ); ?>_adunits_device_controls">
167
+ <b>Limit by Visitor Countries:</b><br />
168
+ <?php
169
+ echo wp_kses(
170
+ quickadsense_get_control(
171
+ 'multiselect',
172
+ '',
173
+ 'quick_adsense_settings_' . $location . '_ad_' . $adunit_index . '_limit_visitor_country',
174
+ 'quick_adsense_settings[' . $location . '_ad_' . $adunit_index . '_limit_visitor_country][]',
175
+ quick_adsense_get_value( $args, $location . '_ad_' . $adunit_index . '_limit_visitor_country' ),
176
+ quick_adsense_get_countries()
177
+ ),
178
+ quick_adsense_get_allowed_html()
179
+ );
180
+ ?>
181
+ </p>
182
+ <p class="quick_adsense_<?php echo esc_attr( $location ); ?>_adunits_device_controls">
183
+ <b>Ad Stats:</b><br />
184
+ <?php
185
+ echo wp_kses(
186
+ quickadsense_get_control(
187
+ 'checkbox',
188
+ 'Enable Stats',
189
+ 'quick_adsense_settings_' . $location . '_ad_' . $adunit_index . '_enable_stats',
190
+ 'quick_adsense_settings[' . $location . '_ad_' . $adunit_index . '_enable_stats]',
191
+ quick_adsense_get_value( $args, $location . '_ad_' . $adunit_index . '_enable_stats' ),
192
+ null,
193
+ 'input',
194
+ 'margin: -1px 5px 0 0;'
195
+ ),
196
+ quick_adsense_get_allowed_html()
197
+ );
198
+ ?>
199
+ <br />
200
+ <input class="quick_adsense_<?php echo esc_attr( $location ); ?>_ad_show_stats input button-secondary" data-index="<?php echo esc_attr( $adunit_index ); ?>" type="button" value="View Stats" />&nbsp;
201
+ <input class="quick_adsense_<?php echo esc_attr( $location ); ?>_ad_reset_stats input button-secondary right" data-index="<?php echo esc_attr( $adunit_index ); ?>" type="button" value="Reset Stats" />
202
+ </p>
includes/templates/block-general-adsense.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="quick_adsense_block">
2
+ <div class="quick_adsense_block_labels">Adsense</div>
3
+ <div class="quick_adsense_block_controls">
4
+ Place up to
5
+ <?php
6
+ $max_ads_count = [];
7
+ for ( $i = 0; $i <= 10; $i++ ) {
8
+ $max_ads_count[] = [
9
+ 'text' => $i,
10
+ 'value' => $i,
11
+ ];
12
+ }
13
+ echo wp_kses(
14
+ quickadsense_get_control(
15
+ 'select',
16
+ '',
17
+ 'quick_adsense_settings_max_ads_per_page',
18
+ 'quick_adsense_settings[max_ads_per_page]',
19
+ quick_adsense_get_value( $args, 'max_ads_per_page' ),
20
+ $max_ads_count,
21
+ 'input',
22
+ 'margin: -2px 10px 0 40px;'
23
+ ),
24
+ quick_adsense_get_allowed_html()
25
+ );
26
+ ?>
27
+ Ads on a page
28
+ </div>
29
+ <div class="clear"></div>
30
+ </div>
includes/templates/block-general-appearance.php ADDED
@@ -0,0 +1,167 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="quick_adsense_block">
2
+ <div class="quick_adsense_block_labels">Appearance</div>
3
+ <div class="quick_adsense_block_controls">
4
+ <p>
5
+ <span>
6
+ <?php
7
+ echo wp_kses(
8
+ quickadsense_get_control(
9
+ 'checkbox',
10
+ '<b id="quick_adsense_settings_enable_on_posts_label">Posts</b>',
11
+ 'quick_adsense_settings_enable_on_posts',
12
+ 'quick_adsense_settings[enable_on_posts]',
13
+ quick_adsense_get_value( $args, 'enable_on_posts' ),
14
+ null,
15
+ 'input',
16
+ 'margin: -1px 10px 0 0;'
17
+ ),
18
+ quick_adsense_get_allowed_html()
19
+ );
20
+ ?>
21
+ </span>
22
+ <span>
23
+ <?php
24
+ echo wp_kses(
25
+ quickadsense_get_control(
26
+ 'checkbox',
27
+ '<b id="quick_adsense_settings_enable_on_pages_label">Pages</b>',
28
+ 'quick_adsense_settings_enable_on_pages',
29
+ 'quick_adsense_settings[enable_on_pages]',
30
+ quick_adsense_get_value( $args, 'enable_on_pages' ),
31
+ null,
32
+ 'input',
33
+ 'margin: -1px 10px 0 15px;'
34
+ ),
35
+ quick_adsense_get_allowed_html()
36
+ );
37
+ ?>
38
+ </span>
39
+ </p>
40
+ <p>
41
+ <span>
42
+ <?php
43
+ echo wp_kses(
44
+ quickadsense_get_control(
45
+ 'checkbox',
46
+ '<b id="quick_adsense_settings_enable_on_homepage_label">Homepage</b>',
47
+ 'quick_adsense_settings_enable_on_homepage',
48
+ 'quick_adsense_settings[enable_on_homepage]',
49
+ quick_adsense_get_value( $args, 'enable_on_homepage' ),
50
+ null,
51
+ 'input',
52
+ 'margin: -1px 10px 0 0;'
53
+ ),
54
+ quick_adsense_get_allowed_html()
55
+ );
56
+ ?>
57
+ </span>
58
+ <span>
59
+ <?php
60
+ echo wp_kses(
61
+ quickadsense_get_control(
62
+ 'checkbox',
63
+ '<b id="quick_adsense_settings_enable_on_categories_label">Categories</b>',
64
+ 'quick_adsense_settings_enable_on_categories',
65
+ 'quick_adsense_settings[enable_on_categories]',
66
+ quick_adsense_get_value( $args, 'enable_on_categories' ),
67
+ null,
68
+ 'input',
69
+ 'margin: -1px 10px 0 15px;'
70
+ ),
71
+ quick_adsense_get_allowed_html()
72
+ );
73
+ ?>
74
+ </span>
75
+ <span>
76
+ <?php
77
+ echo wp_kses(
78
+ quickadsense_get_control(
79
+ 'checkbox',
80
+ '<b id="quick_adsense_settings_enable_on_archives_label">Archives</b>',
81
+ 'quick_adsense_settings_enable_on_archives',
82
+ 'quick_adsense_settings[enable_on_archives]',
83
+ quick_adsense_get_value( $args, 'enable_on_archives' ),
84
+ null,
85
+ 'input',
86
+ 'margin: -1px 10px 0 15px;'
87
+ ),
88
+ quick_adsense_get_allowed_html()
89
+ );
90
+ ?>
91
+ </span>
92
+ <span>
93
+ <?php
94
+ echo wp_kses(
95
+ quickadsense_get_control(
96
+ 'checkbox',
97
+ '<b id="quick_adsense_settings_enable_on_tags_label">Tags</b>',
98
+ 'quick_adsense_settings_enable_on_tags',
99
+ 'quick_adsense_settings[enable_on_tags]',
100
+ quick_adsense_get_value( $args, 'enable_on_tags' ),
101
+ null,
102
+ 'input',
103
+ 'margin: -1px 10px 0 15px;'
104
+ ),
105
+ quick_adsense_get_allowed_html()
106
+ );
107
+ ?>
108
+ </span>
109
+ <span>
110
+ <?php
111
+ echo wp_kses(
112
+ quickadsense_get_control(
113
+ 'checkbox',
114
+ '<b id="quick_adsense_settings_enable_all_possible_ads_label">Place all possible Ads on these pages</b>',
115
+ 'quick_adsense_settings_enable_all_possible_ads',
116
+ 'quick_adsense_settings[enable_all_possible_ads]',
117
+ quick_adsense_get_value( $args, 'enable_all_possible_ads' ),
118
+ null,
119
+ 'input',
120
+ 'margin: -1px 10px 0 35px;'
121
+ ),
122
+ quick_adsense_get_allowed_html()
123
+ );
124
+ ?>
125
+ </span>
126
+ </p>
127
+ <p>
128
+ <span>
129
+ <?php
130
+ echo wp_kses(
131
+ quickadsense_get_control(
132
+ 'checkbox',
133
+ '<b id="quick_adsense_settings_disable_widgets_on_homepage_label">Disable AdsWidget on Homepage</b>',
134
+ 'quick_adsense_settings_disable_widgets_on_homepage',
135
+ 'quick_adsense_settings[disable_widgets_on_homepage]',
136
+ quick_adsense_get_value( $args, 'disable_widgets_on_homepage' ),
137
+ null,
138
+ 'input',
139
+ 'margin: -1px 10px 0 0;'
140
+ ),
141
+ quick_adsense_get_allowed_html()
142
+ );
143
+ ?>
144
+ </span>
145
+ </p>
146
+ <p>
147
+ <span>
148
+ <?php
149
+ echo wp_kses(
150
+ quickadsense_get_control(
151
+ 'checkbox',
152
+ '<b id="quick_adsense_settings_disable_for_loggedin_users_label">Hide Ads when user is logged in to WordPress</b>',
153
+ 'quick_adsense_settings_disable_for_loggedin_users',
154
+ 'quick_adsense_settings[disable_for_loggedin_users]',
155
+ quick_adsense_get_value( $args, 'disable_for_loggedin_users' ),
156
+ null,
157
+ 'input',
158
+ 'margin: -1px 10px 0 0;'
159
+ ),
160
+ quick_adsense_get_allowed_html()
161
+ );
162
+ ?>
163
+ </span>
164
+ </p>
165
+ </div>
166
+ <div class="clear"></div>
167
+ </div>
includes/templates/block-general-assign-position.php ADDED
@@ -0,0 +1,316 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="quick_adsense_block">
2
+ <div class="quick_adsense_block_labels">Assign position<br />(Default)</div>
3
+ <div class="quick_adsense_block_controls">
4
+ <?php
5
+ $ad_positions = [
6
+ [
7
+ 'text' => 'Random Ads',
8
+ 'value' => '0',
9
+ ],
10
+ ];
11
+ for ( $i = 1; $i <= 10; $i++ ) {
12
+ $ad_positions[] = [
13
+ 'text' => 'Ads' . $i,
14
+ 'value' => $i,
15
+ ];
16
+ }
17
+
18
+ $element_count = [];
19
+ for ( $i = 1; $i <= 50; $i++ ) {
20
+ $element_count[] = [
21
+ 'text' => $i,
22
+ 'value' => $i,
23
+ ];
24
+ }
25
+ ?>
26
+ <p>
27
+ <?php
28
+ echo wp_kses(
29
+ quickadsense_get_control(
30
+ 'checkbox',
31
+ '',
32
+ 'quick_adsense_settings_enable_position_beginning_of_post',
33
+ 'quick_adsense_settings[enable_position_beginning_of_post]',
34
+ quick_adsense_get_value( $args, 'enable_position_beginning_of_post' ),
35
+ null,
36
+ 'input',
37
+ ''
38
+ ),
39
+ quick_adsense_get_allowed_html()
40
+ );
41
+ echo wp_kses(
42
+ quickadsense_get_control(
43
+ 'select',
44
+ '',
45
+ 'quick_adsense_settings_ad_beginning_of_post',
46
+ 'quick_adsense_settings[ad_beginning_of_post]',
47
+ quick_adsense_get_value( $args, 'ad_beginning_of_post' ),
48
+ $ad_positions,
49
+ 'input',
50
+ 'margin: -2px 10px 0 20px;'
51
+ ),
52
+ quick_adsense_get_allowed_html()
53
+ );
54
+ ?>
55
+ <b style="width: 120px; display: inline-block;">Beginning of Post</b>
56
+ </p>
57
+ <p>
58
+ <?php
59
+ echo wp_kses(
60
+ quickadsense_get_control(
61
+ 'checkbox',
62
+ '',
63
+ 'quick_adsense_settings_enable_position_middle_of_post',
64
+ 'quick_adsense_settings[enable_position_middle_of_post]',
65
+ quick_adsense_get_value( $args, 'enable_position_middle_of_post' ),
66
+ null,
67
+ 'input',
68
+ ''
69
+ ),
70
+ quick_adsense_get_allowed_html()
71
+ );
72
+ echo wp_kses(
73
+ quickadsense_get_control(
74
+ 'select',
75
+ '',
76
+ 'quick_adsense_settings_ad_middle_of_post',
77
+ 'quick_adsense_settings[ad_middle_of_post]',
78
+ quick_adsense_get_value( $args, 'ad_middle_of_post' ),
79
+ $ad_positions,
80
+ 'input',
81
+ 'margin: -2px 10px 0 20px;'
82
+ ),
83
+ quick_adsense_get_allowed_html()
84
+ );
85
+ ?>
86
+ <b style="width: 120px; display: inline-block;">Middle of Post</b>
87
+ </p>
88
+ <p>
89
+ <?php
90
+ echo wp_kses(
91
+ quickadsense_get_control(
92
+ 'checkbox',
93
+ '',
94
+ 'quick_adsense_settings_enable_position_end_of_post',
95
+ 'quick_adsense_settings[enable_position_end_of_post]',
96
+ quick_adsense_get_value( $args, 'enable_position_end_of_post' ),
97
+ null,
98
+ 'input',
99
+ ''
100
+ ),
101
+ quick_adsense_get_allowed_html()
102
+ );
103
+ echo wp_kses(
104
+ quickadsense_get_control(
105
+ 'select',
106
+ '',
107
+ 'quick_adsense_settings_ad_end_of_post',
108
+ 'quick_adsense_settings[ad_end_of_post]',
109
+ quick_adsense_get_value( $args, 'ad_end_of_post' ),
110
+ $ad_positions,
111
+ 'input',
112
+ 'margin: -2px 10px 0 20px;'
113
+ ),
114
+ quick_adsense_get_allowed_html()
115
+ );
116
+ ?>
117
+ <b>End of Post</b>
118
+ </p>
119
+ <div class="clear"></div>
120
+ <p>
121
+ <?php
122
+ echo wp_kses(
123
+ quickadsense_get_control(
124
+ 'checkbox',
125
+ '',
126
+ 'quick_adsense_settings_enable_position_after_more_tag',
127
+ 'quick_adsense_settings[enable_position_after_more_tag]',
128
+ quick_adsense_get_value( $args, 'enable_position_after_more_tag' ),
129
+ null,
130
+ 'input',
131
+ ''
132
+ ),
133
+ quick_adsense_get_allowed_html()
134
+ );
135
+ echo wp_kses(
136
+ quickadsense_get_control(
137
+ 'select',
138
+ '',
139
+ 'quick_adsense_settings_ad_after_more_tag',
140
+ 'quick_adsense_settings[ad_after_more_tag]',
141
+ quick_adsense_get_value( $args, 'ad_after_more_tag' ),
142
+ $ad_positions,
143
+ 'input',
144
+ 'margin: -2px 10px 0 20px;'
145
+ ),
146
+ quick_adsense_get_allowed_html()
147
+ );
148
+ ?>
149
+ right after <b>the &lt;!--more--&gt; tag</b>
150
+ </p>
151
+ <p>
152
+ <?php
153
+ echo wp_kses(
154
+ quickadsense_get_control(
155
+ 'checkbox',
156
+ '',
157
+ 'quick_adsense_settings_enable_position_before_last_para',
158
+ 'quick_adsense_settings[enable_position_before_last_para]',
159
+ quick_adsense_get_value( $args, 'enable_position_before_last_para' ),
160
+ null,
161
+ 'input',
162
+ ''
163
+ ),
164
+ quick_adsense_get_allowed_html()
165
+ );
166
+ echo wp_kses(
167
+ quickadsense_get_control(
168
+ 'select',
169
+ '',
170
+ 'quick_adsense_settings_ad_before_last_para',
171
+ 'quick_adsense_settings[ad_before_last_para]',
172
+ quick_adsense_get_value( $args, 'ad_before_last_para' ),
173
+ $ad_positions,
174
+ 'input',
175
+ 'margin: -2px 10px 0 20px;'
176
+ ),
177
+ quick_adsense_get_allowed_html()
178
+ );
179
+ ?>
180
+ right before <b>the last Paragraph</b>
181
+ </p>
182
+ <div class="clear"></div>
183
+ <?php for ( $i = 1; $i <= 3; $i++ ) { ?>
184
+ <p>
185
+ <?php
186
+ echo wp_kses(
187
+ quickadsense_get_control(
188
+ 'checkbox',
189
+ '',
190
+ 'quick_adsense_settings_enable_position_after_para_option_' . $i,
191
+ 'quick_adsense_settings[enable_position_after_para_option_' . $i . ']',
192
+ quick_adsense_get_value( $args, 'enable_position_after_para_option_' . $i ),
193
+ null,
194
+ 'input',
195
+ ''
196
+ ),
197
+ quick_adsense_get_allowed_html()
198
+ );
199
+ echo wp_kses(
200
+ quickadsense_get_control(
201
+ 'select',
202
+ '',
203
+ 'quick_adsense_settings_ad_after_para_option_' . $i,
204
+ 'quick_adsense_settings[ad_after_para_option_' . $i . ']',
205
+ quick_adsense_get_value( $args, 'ad_after_para_option_' . $i ),
206
+ $ad_positions,
207
+ 'input',
208
+ 'margin: -2px 10px 0 20px;'
209
+ ),
210
+ quick_adsense_get_allowed_html()
211
+ );
212
+ ?>
213
+ <span style="width: 110px;display: inline-block;"><b>after Paragraph</b></span>
214
+ <?php
215
+ echo wp_kses(
216
+ quickadsense_get_control(
217
+ 'select',
218
+ '',
219
+ 'quick_adsense_settings_position_after_para_option_' . $i,
220
+ 'quick_adsense_settings[position_after_para_option_' . $i . ']',
221
+ quick_adsense_get_value( $args, 'position_after_para_option_' . $i ),
222
+ $element_count,
223
+ 'input',
224
+ 'margin: -2px 10px 0 10px;'
225
+ ),
226
+ quick_adsense_get_allowed_html()
227
+ );
228
+ ?>
229
+ repeat
230
+ <?php
231
+ echo wp_kses(
232
+ quickadsense_get_control(
233
+ 'checkbox',
234
+ '',
235
+ 'quick_adsense_settings_enable_jump_position_after_para_option_' . $i,
236
+ 'quick_adsense_settings[enable_jump_position_after_para_option_' . $i . ']',
237
+ quick_adsense_get_value( $args, 'enable_jump_position_after_para_option_' . $i ),
238
+ null,
239
+ 'input',
240
+ 'margin: -1px 10px 0;'
241
+ ),
242
+ quick_adsense_get_allowed_html()
243
+ );
244
+ ?>
245
+ <b>to End of Post</b> if fewer paragraphs are found
246
+ </p>
247
+ <?php } ?>
248
+ <div class="clear"></div>
249
+ <?php for ( $i = 1; $i <= 1; $i++ ) { ?>
250
+ <p>
251
+ <?php
252
+ echo wp_kses(
253
+ quickadsense_get_control(
254
+ 'checkbox',
255
+ '',
256
+ 'quick_adsense_settings_enable_position_after_image_option_' . $i,
257
+ 'quick_adsense_settings[enable_position_after_image_option_' . $i . ']',
258
+ quick_adsense_get_value( $args, 'enable_position_after_image_option_' . $i ),
259
+ null,
260
+ 'input',
261
+ ''
262
+ ),
263
+ quick_adsense_get_allowed_html()
264
+ );
265
+ echo wp_kses(
266
+ quickadsense_get_control(
267
+ 'select',
268
+ '',
269
+ 'quick_adsense_settings_ad_after_image_option_' . $i,
270
+ 'quick_adsense_settings[ad_after_image_option_' . $i . ']',
271
+ quick_adsense_get_value( $args, 'ad_after_image_option_' . $i ),
272
+ $ad_positions,
273
+ 'input',
274
+ 'margin: -2px 10px 0 20px;'
275
+ ),
276
+ quick_adsense_get_allowed_html()
277
+ );
278
+ ?>
279
+ <span style="width: 110px;display: inline-block;">after Image</span>
280
+ <?php
281
+ echo wp_kses(
282
+ quickadsense_get_control(
283
+ 'select',
284
+ '',
285
+ 'quick_adsense_settings_position_after_image_option_' . $i,
286
+ 'quick_adsense_settings[position_after_image_option_' . $i . ']',
287
+ quick_adsense_get_value( $args, 'position_after_image_option_' . $i ),
288
+ $element_count,
289
+ 'input',
290
+ 'margin: -2px 10px 0 10px;'
291
+ ),
292
+ quick_adsense_get_allowed_html()
293
+ );
294
+ ?>
295
+ repeat
296
+ <?php
297
+ echo wp_kses(
298
+ quickadsense_get_control(
299
+ 'checkbox',
300
+ '',
301
+ 'quick_adsense_settings_enable_jump_position_after_image_option_' . $i,
302
+ 'quick_adsense_settings[enable_jump_position_after_image_option_' . $i . ']',
303
+ quick_adsense_get_value( $args, 'enable_jump_position_after_image_option_' . $i ),
304
+ null,
305
+ 'input',
306
+ 'margin: -1px 10px 0;'
307
+ ),
308
+ quick_adsense_get_allowed_html()
309
+ );
310
+ ?>
311
+ after <b>Image\'s outer &lt;div&gt; wp-caption</b> if any
312
+ </p>
313
+ <?php } ?>
314
+ </div>
315
+ <div class="clear"></div>
316
+ </div>
includes/templates/block-general-quicktag.php ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="quick_adsense_block">
2
+ <div class="quick_adsense_block_labels">Quicktag</div>
3
+ <div class="quick_adsense_block_controls">
4
+ <p>
5
+ <?php
6
+ echo wp_kses(
7
+ quickadsense_get_control(
8
+ 'checkbox',
9
+ '<b>Show Quicktag Buttons on the HTML Edit Post SubPanel</b>',
10
+ 'quick_adsense_settings_enable_quicktag_buttons',
11
+ 'quick_adsense_settings[enable_quicktag_buttons]',
12
+ quick_adsense_get_value( $args, 'enable_quicktag_buttons' ),
13
+ null,
14
+ 'input',
15
+ 'margin: -1px 10px 0 0;'
16
+ ),
17
+ quick_adsense_get_allowed_html()
18
+ );
19
+ ?>
20
+ </p>
21
+ <p>
22
+ <?php
23
+ echo wp_kses(
24
+ quickadsense_get_control(
25
+ 'checkbox',
26
+ 'Hide <b>&lt;!--RndAds--&gt;</b> from Quicktag Buttons',
27
+ 'quick_adsense_settings_disable_randomads_quicktag_button',
28
+ 'quick_adsense_settings[disable_randomads_quicktag_button]',
29
+ quick_adsense_get_value( $args, 'disable_randomads_quicktag_button' ),
30
+ null,
31
+ 'input',
32
+ 'margin: -1px 10px 0 0;'
33
+ ),
34
+ quick_adsense_get_allowed_html()
35
+ );
36
+ ?>
37
+ </p>
38
+ <p>
39
+ <?php
40
+ echo wp_kses(
41
+ quickadsense_get_control(
42
+ 'checkbox',
43
+ 'Hide <b>&lt;!--NoAds--&gt;</b>, <b>&lt;!--OffDef--&gt;</b>, <b>&lt;!--OffWidget--&gt;</b> from Quicktag Buttons',
44
+ 'quick_adsense_settings_disable_disablead_quicktag_buttons',
45
+ 'quick_adsense_settings[disable_disablead_quicktag_buttons]',
46
+ quick_adsense_get_value( $args, 'disable_disablead_quicktag_buttons' ),
47
+ null,
48
+ 'input',
49
+ 'margin: -1px 10px 0 0;'
50
+ ),
51
+ quick_adsense_get_allowed_html()
52
+ );
53
+ ?>
54
+ </p>
55
+ <p>
56
+ <?php
57
+ echo wp_kses(
58
+ quickadsense_get_control(
59
+ 'checkbox',
60
+ 'Hide <b>&lt;!--OffBegin--&gt;</b>, <b>&lt;!--OffMiddle--&gt;</b>, <b>&lt;!--OffEnd--&gt;</b>, <b>&lt;!--OffAfMore--&gt;</b>, <b>&lt;!--OffBfLastPara--&gt;</b> from Quicktag Buttons',
61
+ 'quick_adsense_settings_disable_positionad_quicktag_buttons',
62
+ 'quick_adsense_settings[disable_positionad_quicktag_buttons]',
63
+ quick_adsense_get_value( $args, 'disable_positionad_quicktag_buttons' ),
64
+ null,
65
+ 'input',
66
+ 'margin: -1px 10px 0 0;'
67
+ ),
68
+ quick_adsense_get_allowed_html()
69
+ );
70
+ ?>
71
+ </p>
72
+ <div class="clear"></div>
73
+ Insert Ads into a post, on-the-fly:
74
+ <ol>
75
+ <li>Insert <b>&lt;!--Ads1--&gt;</b>, <b>&lt;!--Ads2--&gt;</b> etc. into a post to show the <b>Particular Ads</b> at specific location.</li>
76
+ <li>Insert <b>&lt;!--RndAds--&gt;</b> (or more) into a post to show the <b>Random Ads</b> at specific location.</li>
77
+ </ol>
78
+ <div class="clear"></div>
79
+ Disable Ads in a post, on-the-fly:
80
+ <ol>
81
+ <li>Insert <b>&lt;!--NoAds--&gt;</b> to disable all Ads in a post <i>(does not affect Ads on Sidebar)</i>.</li>
82
+ <li>Insert <b>&lt;!--OffDef--&gt;</b> to disable the default positioned Ads, and use &lt;!--Ads1--&gt;, &lt;!--Ads2--&gt;, etc. to insert Ad <i>(does not affect Ads on Sidebar)</i>.</li>
83
+ <li>Insert <b>&lt;!--OffWidget--&gt;</b> to disable all Ads on Sidebar.</li>
84
+ <li>Insert <b>&lt;!--OffBegin--&gt;</b>, <b>&lt;!--OffMiddle--&gt;</b>, <b>&lt;!--OffEnd--&gt;</b> to <b>disable Ads at Beginning</b>, <b>Middle or End of Post</b>.</li>
85
+ <li>Insert <b>&lt;!--OffAfMore--&gt;</b>, <b>&lt;!--OffBfLastPara--&gt;</b> to <b>disable Ads right after the &lt;!--more--&gt; tag</b>, or <b>right before the last Paragraph</b>.</li>
86
+ </ol>
87
+ <div class="clear"></div>
88
+ <i>Tags can be inserted into a post via the additional Quicktag Buttons at the HTML Edit Post SubPanel.</i>
89
+ </div>
90
+ <div class="clear"></div>
91
+ </div>
includes/templates/block-stats-chart.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <div id="quick_adsense_ad_stats_chart_wrapper">
2
+ <p>&nbsp;</p>
3
+ <canvas id="quick_adsense_ad_stats_chart" width="1377" height="360"></canvas>
4
+ <textarea id="quick_adsense_ad_stats_chart_data" style="display: none;"><?php echo esc_textarea( quick_adsense_get_value( $args, 'stats_data' ) ); ?></textarea>
5
+ <p><small>The Stats recorded by the plugin will be different than that recorded by your ad provider due to different factors like accidental clicks, fraud detection, spam clicks etc.<br />Use the stats provided by the ad provider in case of discrepancy.</small></p>
6
+ </div>
includes/templates/js/script-admin-notice.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function() {
2
+ jQuery('.quick_adsense_adstxt_adsense_notice').on('click', '.notice-dismiss', function() {
3
+ wp.ajax.post('quick_adsense_adstxt_adsense_admin_notice_dismiss', {
4
+ nonce: quick_adsense_adstxt_adsense.nonce,
5
+ });
6
+ });
7
+ });
includes/templates/js/script-frontend-stats.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function() {
2
+ jQuery(".<?php echo esc_js( quick_adsense_get_value( $args, 'target' ) ); ?>").click(function() {
3
+ jQuery.post(
4
+ "<?php echo esc_js( quick_adsense_get_value( $args, 'ajax_url' ) ); ?>", {
5
+ "action": "quick_adsense_onpost_ad_click",
6
+ "quick_adsense_onpost_ad_index": jQuery(this).attr("data-index"),
7
+ "quick_adsense_nonce": "<?php echo esc_js( quick_adsense_get_value( $args, 'nonce' ) ); ?>",
8
+ }, function(response) { }
9
+ );
10
+ });
11
+ });
includes/templates/page-settings.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="wrap">
2
+ <h2 id="quick_adsense_title">Quick Adsense Settings <span style="font-size: 14px;">(Version 2.8)</span></h2>
3
+ <form id="quick_adsense_settings_form" method="post" action="options.php" name="wp_auto_commenter_form" style="display: none;">
4
+ <?php settings_fields( 'quick_adsense_settings' ); ?>
5
+ <div id="quick_adsense_settings_tabs">
6
+ <ul>
7
+ <li><a href="#tabs-settings">Settings</a></li>
8
+ <li><a href="#tabs-post-body-ads">Ads on Post Body</a></li>
9
+ <li><a href="#tabs-sidebar-widget-ads">Sidebar Widget</a></li>
10
+ <li><a href="#tabs-header-footer-codes">Header / Footer Codes</a></li>
11
+ </ul>
12
+ <div id="tabs-settings">
13
+ <div id="quick_adsense_top_sections_wrapper">
14
+ <?php do_settings_sections( 'quick-adsense-general' ); ?>
15
+ </div>
16
+ <?php submit_button( 'Save Changes' ); ?>
17
+ </div>
18
+ <div id="tabs-post-body-ads">
19
+ <?php do_settings_sections( 'quick-adsense-onpost' ); ?>
20
+ <?php submit_button( 'Save Changes' ); ?>
21
+ </div>
22
+ <div id="tabs-sidebar-widget-ads">
23
+ <?php do_settings_sections( 'quick-adsense-widgets' ); ?>
24
+ <?php submit_button( 'Save Changes' ); ?>
25
+ </div>
26
+ <div id="tabs-header-footer-codes">
27
+ <?php do_settings_sections( 'quick-adsense-header-footer-codes' ); ?>
28
+ <?php submit_button( 'Save Changes' ); ?>
29
+ </div>
30
+ </div>
31
+ </form>
32
+ </div>
includes/templates/section-general.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="quick_adsense_block">
2
+ <div class="quick_adsense_block_labels"><span>Options</span></div>
3
+ <div class="quick_adsense_block_controls">
4
+ <a id="quick_adsense_settings_reset_to_default" href="javascript:;">Reset to Default Settings</a>
5
+ </div>
6
+ <div class="clear"></div>
7
+ </div>
8
+ <?php
9
+ echo wp_kses(
10
+ quick_adsense_load_file( 'templates/block-general-adsense.php', $args ),
11
+ quick_adsense_get_allowed_html()
12
+ );
13
+ echo wp_kses(
14
+ quick_adsense_load_file( 'templates/block-general-appearance.php', $args ),
15
+ quick_adsense_get_allowed_html()
16
+ );
17
+ echo wp_kses(
18
+ quick_adsense_load_file( 'templates/block-general-assign-position.php', $args ),
19
+ quick_adsense_get_allowed_html()
20
+ );
21
+ echo wp_kses(
22
+ quick_adsense_load_file( 'templates/block-general-quicktag.php', $args ),
23
+ quick_adsense_get_allowed_html()
24
+ );
25
+ ?>
includes/templates/section-header-footer.php ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div id="quick_adsense_top_sections_wrapper">
2
+ <div class="quick_adsense_block">
3
+ <div class="quick_adsense_block_labels">
4
+ <span>Header<br />Embed Code</span>
5
+ </div>
6
+ <div class="quick_adsense_block_controls">
7
+ <?php
8
+ // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
9
+ // This textarea needs to allow output of scripts, iframes etc necessary to output ads and trackers.
10
+ echo quickadsense_get_control(
11
+ 'textarea-big',
12
+ '',
13
+ 'quick_adsense_settings_header_embed_code',
14
+ 'quick_adsense_settings[header_embed_code]',
15
+ quick_adsense_get_value( $args, 'header_embed_code' )
16
+ );
17
+ // phpcs:enable
18
+ ?>
19
+ </div>
20
+ <div class="clear"></div>
21
+ <div class="quick_adsense_block_labels">
22
+ <span>Footer<br />Embed Code</span>
23
+ </div>
24
+ <div class="quick_adsense_block_controls">
25
+ <?php
26
+ // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
27
+ // This textarea needs to allow output of scripts, iframes etc necessary to output ads and trackers.
28
+ echo quickadsense_get_control(
29
+ 'textarea-big',
30
+ '',
31
+ 'quick_adsense_settings_footer_embed_code',
32
+ 'quick_adsense_settings[footer_embed_code]',
33
+ quick_adsense_get_value( $args, 'footer_embed_code' )
34
+ );
35
+ // phpcs:enable
36
+ ?>
37
+ </div>
38
+ <div class="clear"></div>
39
+ </div>
40
+ </div>
includes/templates/section-onpost-content.php ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div id="quick_adsense_block_bottom" class="quick_adsense_block" style="margin: 30px 0 0;">
2
+ <div class="quick_adsense_block_labels" style="width: auto;">
3
+ <span>Adsense Codes - Ads on Post Body</span>
4
+ </div>
5
+ <div class="clear"></div>
6
+ <p>Paste up to 10 Ads codes on Post Body as assigned above. Ads codes provided must not be identical, repeated codes may result the Ads not being display correctly. Ads will never displays more than once in a page.</p>
7
+ </div>
8
+
9
+ <div id="quick_adsense_onpost_content_controls_wrapper">
10
+ <div id="quick_adsense_onpost_content_global_controls_wrapper">
11
+ <p class="quick_adsense_onpost_adunits_styling_controls">
12
+ <?php
13
+ echo wp_kses(
14
+ quickadsense_get_control(
15
+ 'checkbox',
16
+ '',
17
+ 'quick_adsense_settings_onpost_enable_global_style',
18
+ 'quick_adsense_settings[onpost_enable_global_style]',
19
+ quick_adsense_get_value( $args, 'onpost_enable_global_style' ),
20
+ null,
21
+ 'input',
22
+ 'margin: -3px 10px 0 0;'
23
+ ),
24
+ quick_adsense_get_allowed_html()
25
+ );
26
+ ?>
27
+ <span>Use for all</span>
28
+ <wbr />Alignment
29
+ <?php
30
+ echo wp_kses(
31
+ quickadsense_get_control(
32
+ 'select',
33
+ '',
34
+ 'quick_adsense_settings_onpost_global_alignment',
35
+ 'quick_adsense_settings[onpost_global_alignment]',
36
+ quick_adsense_get_value( $args, 'onpost_global_alignment' ),
37
+ quick_adsense_get_value( $args, 'alignment_options' ),
38
+ 'input',
39
+ 'margin: -6px 20px 0 10px; width: 73px;'
40
+ ),
41
+ quick_adsense_get_allowed_html()
42
+ );
43
+ ?>
44
+ <wbr />margin
45
+ <?php
46
+ echo wp_kses(
47
+ quickadsense_get_control(
48
+ 'number',
49
+ '',
50
+ 'quick_adsense_settings_onpost_global_margin',
51
+ 'quick_adsense_settings[onpost_global_margin]',
52
+ quick_adsense_get_value( $args, 'onpost_global_margin' ),
53
+ null,
54
+ 'input',
55
+ 'margin: -1px 10px 0 10px; width: 62px;'
56
+ ),
57
+ quick_adsense_get_allowed_html()
58
+ );
59
+ ?>
60
+ px
61
+ </p>
62
+ </div>
63
+
64
+ <div id="quick_adsense_onpost_content_adunits_wrapper">
65
+ <div id="quick_adsense_onpost_content_adunits_initial_wrapper">
66
+ <?php
67
+ for ( $i = 1; $i <= 3; $i++ ) {
68
+ $args['adunit_index'] = $i;
69
+ // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
70
+ // Contains a textarea which need to allow output of scripts, iframes etc necessary to output ads and trackers.
71
+ echo quick_adsense_load_file( 'templates/adunit-onpost.php', $args );
72
+ // phpcs:enable
73
+ }
74
+ ?>
75
+ </div>
76
+ <div id="quick_adsense_onpost_content_adunits_all_wrapper" style="display: none;">
77
+ <?php
78
+ for ( $i = 4; $i <= 10; $i++ ) {
79
+ $args['adunit_index'] = $i;
80
+ // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
81
+ // Contains a textarea which need to allow output of scripts, iframes etc necessary to output ads and trackers.
82
+ echo quick_adsense_load_file( 'templates/adunit-onpost.php', $args );
83
+ // phpcs:enable
84
+ }
85
+ ?>
86
+ </div>
87
+ <a id="quick_adsense_onpost_content_adunits_showall_button" class="input button-secondary">
88
+ <span class="dashicons dashicons-arrow-down"></span> <b>Show All</b>
89
+ </a>
90
+ </div>
91
+ </div>
includes/templates/section-widgets.php ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div id="quick_adsense_block_bottom" class="quick_adsense_block" style="margin: 30px 0 0;">
2
+ <div class="quick_adsense_block_labels" style="width: auto;">
3
+ <span>Adsense Codes - <a href="<?php echo esc_url( admin_url( 'widgets.php' ) ); ?>">Sidebar WIdget</a></span>
4
+ </div>
5
+ <div class="clear"></div>
6
+ <p>Paste up to 10 Ads codes on Sidebar Widget. Ads codes provided must not be identical, repeated codes may result the Ads not being display correctly. Ads will never displays more than once in a page.</p>
7
+ </div>
8
+
9
+ <div id="quick_adsense_widget_controls_wrapper">
10
+ <div id="quick_adsense_widget_global_controls_wrapper" style="visibility: hidden;">
11
+ <p class="quick_adsense_widget_adunits_styling_controls">
12
+ <?php
13
+ echo wp_kses(
14
+ quickadsense_get_control(
15
+ 'checkbox',
16
+ '',
17
+ 'quick_adsense_settings_widget_enable_global_style',
18
+ 'quick_adsense_settings[widget_enable_global_style]',
19
+ quick_adsense_get_value( $args, 'widget_enable_global_style' ),
20
+ null,
21
+ 'input',
22
+ 'margin: -3px 10px 0 0;'
23
+ ),
24
+ quick_adsense_get_allowed_html()
25
+ );
26
+ ?>
27
+ <span>Use for all</span>
28
+ <wbr />Alignment
29
+ <?php
30
+ echo wp_kses(
31
+ quickadsense_get_control(
32
+ 'select',
33
+ '',
34
+ 'quick_adsense_settings_widget_global_alignment',
35
+ 'quick_adsense_settings[widget_global_alignment]',
36
+ quick_adsense_get_value( $args, 'widget_global_alignment' ),
37
+ quick_adsense_get_value( $args, 'alignment_options' ),
38
+ 'input',
39
+ 'margin: -6px 20px 0 10px; width: 73px;'
40
+ ),
41
+ quick_adsense_get_allowed_html()
42
+ );
43
+ ?>
44
+ <wbr />margin
45
+ <?php
46
+ echo wp_kses(
47
+ quickadsense_get_control(
48
+ 'number',
49
+ '',
50
+ 'quick_adsense_settings_widget_global_margin',
51
+ 'quick_adsense_settings[widget_global_margin]',
52
+ quick_adsense_get_value( $args, 'widget_global_margin' ),
53
+ null,
54
+ 'input',
55
+ 'margin: -1px 10px 0 10px; width: 62px;'
56
+ ),
57
+ quick_adsense_get_allowed_html()
58
+ );
59
+ ?>
60
+ px
61
+ </p>
62
+ </div>
63
+
64
+ <div id="quick_adsense_widget_adunits_wrapper">
65
+ <div id="quick_adsense_widget_adunits_initial_wrapper">
66
+ <?php
67
+ for ( $i = 1; $i <= 3; $i++ ) {
68
+ $args['adunit_index'] = $i;
69
+ // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
70
+ // Contains a textarea which need to allow output of scripts, iframes etc necessary to output ads and trackers.
71
+ echo quick_adsense_load_file( 'templates/adunit-widget.php', $args );
72
+ // phpcs:enable
73
+ }
74
+ ?>
75
+ </div>
76
+ <div id="quick_adsense_widget_adunits_all_wrapper" style="display: none;">
77
+ <?php
78
+ for ( $i = 4; $i <= 10; $i++ ) {
79
+ $args['adunit_index'] = $i;
80
+ // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
81
+ // Contains a textarea which need to allow output of scripts, iframes etc necessary to output ads and trackers.
82
+ echo quick_adsense_load_file( 'templates/adunit-widget.php', $args );
83
+ // phpcs:enable
84
+ }
85
+ ?>
86
+ </div>
87
+ <a id="quick_adsense_widget_adunits_showall_button" class="input button-secondary"><span class="dashicons dashicons-arrow-down"></span> <b>Show All</b></a>
88
+ </div>
89
+ </div>
includes/vendor/GeoIP/GeoIPCountry.php ADDED
@@ -0,0 +1,235 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Iriven;
3
+ use ZipArchive;
4
+ use SplFileObject;
5
+
6
+ /**
7
+ * Class GeoIPCountry
8
+ * @package Iriven\GeoIPCountry
9
+ */
10
+ class GeoIPCountry
11
+ {
12
+ const DS = DIRECTORY_SEPARATOR;
13
+ private $DataLocation = null;
14
+ private $IsoCode = null;
15
+
16
+ /**
17
+ * GeoIPCountry constructor.
18
+ */
19
+ public function __construct()
20
+ {
21
+ $this->PackageLocation = realpath($this->getStoragePath());
22
+ $this->DataLocation = realpath($this->getStoragePath(false));
23
+ return $this;
24
+ }
25
+
26
+ /**
27
+ * @return $this
28
+ */
29
+ public function Admin()
30
+ {
31
+ $this->EditModeEnabled = true;
32
+ return $this;
33
+ }
34
+
35
+ /**
36
+ * If IPV6, Returns the IP in it's fullest format.
37
+ * @example
38
+ * ::1 => 0000:0000:0000:0000:0000:0000:0000:0001
39
+ * 220F::127.0.0.1 => 220F:0000:0000:0000:0000:0000:7F00:0001
40
+ * 2F:A1::1 => 002F:00A1:0000:0000:0000:0000:0000:0001
41
+ * @param $Ip
42
+ * @return mixed|string
43
+ */
44
+ private function ExpandIPAddress($Ip)
45
+ {
46
+ if (strpos($Ip, ':') !== false) // IPv6 address
47
+ {
48
+ $hex = unpack('H*hex', inet_pton($Ip));
49
+ $Ip = substr(preg_replace('/([A-f0-9]{4})/', "$1:", $hex['hex']), 0, -1);
50
+ $Ip = strtoupper($Ip);
51
+ }
52
+ return $Ip;
53
+ }
54
+ /**
55
+ * @param $ip
56
+ * @return null|string
57
+ */
58
+ private function getIPRangeProviderFile($ip)
59
+ {
60
+ try
61
+ {
62
+ if(!preg_match('/[.:]/', $ip)) $ip = $this->long2ip($ip, false);
63
+ if(!filter_var($ip,FILTER_VALIDATE_IP,[FILTER_FLAG_IPV4|FILTER_FLAG_IPV6]))
64
+ throw new \Exception('Invalid IP given');
65
+ $delimiter = (strpos($ip,':')===false)? '.' : ':';
66
+ $DBfile = current(explode($delimiter,$ip)).'.php';
67
+ return $DBfile;
68
+ }
69
+ catch (\Exception $e)
70
+ {
71
+ trigger_error($e->getMessage());
72
+ }
73
+ return null;
74
+ }
75
+ /**
76
+ * @param bool $isArchive
77
+ * @return string
78
+ */
79
+ private function getStoragePath($isArchive=true)
80
+ {
81
+ $tmp = ini_get('upload_tmp_dir')?:sys_get_temp_dir ();
82
+ $isArchive OR $tmp = rtrim(__DIR__, self::DS);
83
+ try{
84
+ if (!is_writeable($tmp))
85
+ throw new \Exception(sprintf('The required destination path is not writable: %s', $tmp));
86
+ }
87
+ catch(\Exception $e)
88
+ {
89
+ trigger_error($e->getMessage(),E_USER_ERROR);
90
+ }
91
+ $tmp .= self::DS.($isArchive? 'GeoIPCountry' : 'GeoIPDatas');
92
+ if(!is_dir($tmp)) mkdir($tmp,'0755', true);
93
+ return $tmp;
94
+ }
95
+ /**
96
+ * Convert both IPV4 and IPv6 address to an integer
97
+ * @param $Ip
98
+ * @return mixed|string
99
+ */
100
+ private function ip2long($Ip)
101
+ {
102
+ $decimal = null;
103
+ $Ip = $this->ExpandIPAddress($Ip);
104
+ try
105
+ {
106
+ switch ($Ip):
107
+ case (strpos($Ip, '.') !== false):
108
+ if(!filter_var($Ip,FILTER_VALIDATE_IP,[FILTER_FLAG_IPV4]))
109
+ throw new \Exception('Invalid IPV4 given');
110
+ $decimal .= ip2long($Ip);
111
+ break;
112
+ case (strpos($Ip, ':') !== false):
113
+ if(!filter_var($Ip,FILTER_VALIDATE_IP,[FILTER_FLAG_IPV6]))
114
+ throw new \Exception('Invalid IPV6 given');
115
+ $network = inet_pton($Ip);
116
+ $parts = unpack('C*', $network);
117
+ foreach ($parts as &$byte)
118
+ $decimal.= str_pad(decbin($byte), 8, '0', STR_PAD_LEFT);
119
+ break;
120
+ default:
121
+ throw new \Exception($Ip.' is not a valid IP address');
122
+ break;
123
+ endswitch;
124
+ }
125
+ catch (\Exception $e)
126
+ {
127
+ trigger_error($e->getMessage(),E_USER_ERROR);
128
+ }
129
+ return $decimal;
130
+ }
131
+ /**
132
+ * Convert an IP address from decimal format to presentation format
133
+ *
134
+ * @param $decimal
135
+ * @param bool $compress
136
+ * @return mixed|string
137
+ */
138
+ private function long2ip($decimal,$compress = true)
139
+ {
140
+ $Ip = null;
141
+ if(preg_match('/[.:]/', $decimal))
142
+ return strtoupper($decimal);
143
+ switch ($decimal):
144
+ case (strlen($decimal) <= 32):
145
+ $Ip .= long2ip($decimal);
146
+ break;
147
+ default:
148
+ $pad = 128 - strlen($decimal);
149
+ for ($i = 1; $i <= $pad; $i++)
150
+ $decimal = '0'.$decimal;
151
+ for ($bits = 0; $bits <= 7; $bits++)
152
+ {
153
+ $binPart = substr($decimal,($bits*16),16);
154
+ $Ip .= dechex(bindec($binPart)).':';
155
+ }
156
+ $Ip = inet_ntop(inet_pton(substr($Ip,0,-1)));
157
+ break;
158
+ endswitch;
159
+ $Ip = strtoupper($Ip);
160
+ return $compress? $Ip : $this->ExpandIPAddress($Ip);
161
+ }
162
+ /**
163
+ * @param null $ip
164
+ * @return bool
165
+ */
166
+ public function isReservedIP($ip=null)
167
+ {
168
+ if($ip) $this->resolve($ip);
169
+ return !$this->IsoCode OR strcasecmp($this->IsoCode,'ZZ') == 0 ;
170
+ }
171
+
172
+ /**
173
+ * @param null $ip
174
+ * @return null|string
175
+ */
176
+ public function resolve($ip = null)
177
+ {
178
+ try
179
+ {
180
+ $ip OR $ip = $this->getRemoteIP();
181
+ if(!preg_match('/[.:]/', $ip)) $ip = $this->long2ip($ip);
182
+ $ip = $this->ExpandIPAddress($ip);
183
+ if(!filter_var($ip,FILTER_VALIDATE_IP,[FILTER_FLAG_IPV4|FILTER_FLAG_IPV6]))
184
+ throw new \Exception('Invalid IP given');
185
+ $ipFilename = $this->getIPRangeProviderFile($ip);
186
+ $ipLong = $this->ip2long($ip);
187
+ $ipFilePath = realpath($this->DataLocation.self::DS.$ipFilename);
188
+ if(!file_exists($ipFilePath))
189
+ throw new \Exception('IP Ranges provider file not found');
190
+ $IpRanges = include $ipFilePath;
191
+ foreach($IpRanges as $Range):
192
+ if(!is_array($Range) OR sizeof($Range) !== 3) continue;
193
+ if(preg_match('/^[01]+$/', $ipLong))
194
+ {
195
+ $Range[0] = $this->ip2long($Range[0]);
196
+ $Range[1] = $this->ip2long($Range[1]);
197
+ }
198
+ if($Range[1] < $ipLong) continue;
199
+ if(($Range[0]<=$ipLong))
200
+ {
201
+ $this->IsoCode = $Range[2]?:'ZZ';
202
+ break;
203
+ }
204
+ endforeach;
205
+ }
206
+ catch (\Exception $e)
207
+ {
208
+ trigger_error($e->getMessage());
209
+ }
210
+ return $this->IsoCode;
211
+ }
212
+
213
+ /**
214
+ * Auto Get the current visitor IP Address
215
+ * @return string
216
+ */
217
+ private function getRemoteIP()
218
+ {
219
+ $ip = '';
220
+ $serverIPKeys =['HTTP_X_COMING_FROM', 'HTTP_FORWARDED', 'HTTP_FORWARDED_FOR', 'HTTP_X_CLUSTER_CLIENT_IP',
221
+ 'HTTP_X_FORWARDED', 'HTTP_VIA', 'HTTP_CLIENT_IP','HTTP_X_FORWARDED_FOR','REMOTE_ADDR'];
222
+ foreach ($serverIPKeys AS $IPKey) {
223
+ if(array_key_exists($IPKey,$_SERVER))
224
+ {
225
+ if (!strlen($_SERVER[$IPKey])) continue;
226
+ $ip = $_SERVER[$IPKey];
227
+ break;
228
+ }
229
+ }
230
+ if (($CommaPos = strpos($ip, ',')) > 0) {
231
+ $ip = substr($ip, 0, ($CommaPos - 1));
232
+ }
233
+ return $ip?:'0.0.0.0';
234
+ }
235
+ }
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/0.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/0000.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/0100.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/0200.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/0400.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/0800.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/1.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/10.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/100.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/1000.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/101.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/102.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/103.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/104.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/105.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/106.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/107.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/108.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/109.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/11.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/110.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/111.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/112.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/113.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/114.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/115.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/116.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/117.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/118.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/119.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/12.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/120.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/121.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/122.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/123.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/124.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/125.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/126.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/127.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/128.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/129.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/13.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/130.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/131.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/132.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/133.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/134.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/135.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/136.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/137.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/138.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/139.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/14.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/140.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/141.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/142.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/143.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/144.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/145.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/146.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/147.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/148.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/149.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/15.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/150.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/151.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/152.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/153.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/154.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/155.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/156.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/157.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/158.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/159.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/16.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/160.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/161.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/162.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/163.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/164.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/165.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/166.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/167.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/168.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/169.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/17.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/170.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/171.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/172.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/173.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/174.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/175.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/176.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/177.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/178.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/179.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/18.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/180.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/181.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/182.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/183.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/184.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/185.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/186.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/187.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/188.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/189.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/19.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/190.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/191.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/192.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/193.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/194.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/195.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/196.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/197.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/198.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/199.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/20.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/200.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2000.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2001.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2002.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2003.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/201.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/202.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/203.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/204.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/205.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/206.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/207.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/208.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/209.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/21.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/210.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/211.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/212.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/213.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/214.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/215.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/216.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/217.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/218.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/219.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/22.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/220.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/221.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/222.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/223.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/224.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/225.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/226.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/227.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/228.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/229.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/23.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/230.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/231.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/232.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/233.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/234.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/235.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/236.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/237.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/238.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/239.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/24.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/240.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2400.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2401.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2402.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2403.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2404.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2405.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2406.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2407.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2408.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2409.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/240A.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/240B.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/240C.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/240D.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/240E.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/240F.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/241.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/242.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/243.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/244.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/245.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/246.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/247.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/248.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/249.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/25.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/250.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/251.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/252.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/253.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/254.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/255.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/26.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2600.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2601.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2602.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2603.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2604.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2605.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2606.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2607.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2608.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2609.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/260A.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/260C.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/260D.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/260E.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/260F.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2610.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2620.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/27.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/28.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2800.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2801.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2802.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2803.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2804.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2806.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/29.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2A00.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2A01.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2A02.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2A03.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2A04.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2A05.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2A06.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2A07.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2A08.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2A0A.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2A0B.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2C00.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2C0E.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/2C0F.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/3.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/30.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/31.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/32.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/33.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/34.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/35.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/36.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/37.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/38.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/39.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/4.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/40.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/4000.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/41.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/42.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/43.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/44.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/45.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/46.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/47.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/48.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/49.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/5.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/50.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/51.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/52.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/53.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/54.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/55.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/56.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/57.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/58.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/59.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/6.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/60.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/6000.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/61.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/62.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/63.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/64.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/65.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/66.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/67.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/68.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/69.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/7.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/70.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/71.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/72.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/73.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/74.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/75.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/76.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/77.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/78.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/79.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/8.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/80.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/8000.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/81.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/82.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/83.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/84.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/85.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/86.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/87.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/88.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/89.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/9.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/90.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/91.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/92.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/93.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/94.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/95.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/96.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/97.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/98.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/99.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/A000.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/C000.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/E000.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/F000.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/F800.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/FC00.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/FE00.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/FE80.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/FEC0.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/GeoIPDatas/FF00.php RENAMED
File without changes
includes/{GeoIP → vendor/GeoIP}/LICENSE RENAMED
File without changes
includes/{MobileDetect → vendor/MobileDetect}/LICENSE.txt RENAMED
File without changes
includes/{MobileDetect → vendor/MobileDetect}/Mobile_Detect.php RENAMED
File without changes
includes/widgets.php CHANGED
@@ -1,38 +1,71 @@
1
- <?php
2
- add_action('widgets_init', 'quick_adsense_widgets_init');
3
- function quick_adsense_widgets_init() {
4
- $settings = get_option('quick_adsense_settings');
5
- for($i = 1; $i <= 10; $i++) {
6
- if(isset($settings['widget_ad_'.$i.'_content']) && ($settings['widget_ad_'.$i.'_content'] != '')) {
7
- register_widget(new quickAdsenseAdWidget($i));
8
- }
9
- }
10
- }
11
-
12
- class quickAdsenseAdWidget extends WP_Widget {
13
- public function __construct($id) {
14
- parent::__construct(sanitize_title(str_replace(array('(',')'), '', 'AdsWidget'.$id.' (Quick Adsense)')), 'AdsWidget'.$id.' (Quick Adsense)', array('description' => 'Quick Adsense on Sidebar Widget'));
15
- }
16
-
17
- public function widget($args, $instance) {
18
- extract($args);
19
- $content = get_the_content();
20
- $settings = get_option('quick_adsense_settings');
21
- if((strpos($content, "<!--OffAds-->") === false) && (strpos($content, "<!--OffWidget-->") === false) && !(is_home() && $settings['disable_widgets_on_homepage'])) {
22
- $widgetIndex = str_replace(array('AdsWidget', ' (Quick Adsense)'), '', $args['widget_name']);
23
- echo "\n"."<!-- Quick Adsense Wordpress Plugin: http://quickadsense.com/ -->"."\n";
24
- echo $before_widget;
25
- echo ((isset($settings['widget_ad_'.$widgetIndex.'_content']))?$settings['widget_ad_'.$widgetIndex.'_content']:'');
26
- echo $after_widget;
27
- }
28
- }
29
-
30
- public function update($new_opts, $old_opts) {
31
- return $new_opts;
32
- }
33
-
34
- public function form($instance) {
35
- echo '<p>There are no options for this widget.</p>';
36
- }
37
- }
38
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The Quickadsense widgets.
4
+ */
5
+ class QuickAdsenseAdWidget extends WP_Widget {
6
+ /**
7
+ * The class constructor.
8
+ *
9
+ * @param mixed $id The widget id.
10
+ */
11
+ public function __construct( $id ) {
12
+ parent::__construct( sanitize_title( str_replace( [ '(', ')' ], '', 'AdsWidget' . $id . ' (Quick Adsense)' ) ), 'AdsWidget' . $id . ' (Quick Adsense)', [ 'description' => 'Quick Adsense on Sidebar Widget' ] );
13
+ }
14
+
15
+ /**
16
+ * The widget output.
17
+ *
18
+ * @param array $args Display arguments including 'before_title', 'after_title', 'before_widget', and 'after_widget'.
19
+ * @param array $instance The settings for the particular instance of the widget.
20
+ */
21
+ public function widget( $args, $instance ) {
22
+ $content = get_the_content();
23
+ $settings = get_option( 'quick_adsense_settings' );
24
+ if ( ( strpos( $content, '<!--OffAds-->' ) === false ) && ( strpos( $content, '<!--OffWidget-->' ) === false ) && ! ( is_home() && $settings['disable_widgets_on_homepage'] ) ) {
25
+ $widget_index = str_replace( [ 'AdsWidget', ' (Quick Adsense)' ], '', $args['widget_name'] );
26
+ if ( isset( $settings[ 'widget_ad_' . $widget_index . '_content' ] ) && ( '' !== $settings[ 'widget_ad_' . $widget_index . '_content' ] ) ) {
27
+ echo wp_kses( $args['before_widget'], quick_adsense_get_allowed_html() );
28
+ // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
29
+ // The widget content needs to allow output of scripts, iframes etc necessary to output ads and trackers.
30
+ echo $settings[ 'widget_ad_' . $widget_index . '_content' ];
31
+ // phpcs:enable
32
+ echo wp_kses( $args['after_widget'], quick_adsense_get_allowed_html() );
33
+ }
34
+ }
35
+ }
36
+
37
+ /**
38
+ * This function should check that $new_instance is set correctly. The newly-calculated value of $instance should be returned. If false is returned, the instance won't be saved/updated.
39
+ *
40
+ * @param array $new_instance New settings for this instance as input by the user via WP_Widget::form().
41
+ * @param array $old_instance — Old settings for this instance.
42
+ *
43
+ * @return array — Settings to save or bool false to cancel saving.
44
+ */
45
+ public function update( $new_instance, $old_instance ) {
46
+ return $new_instance;
47
+ }
48
+
49
+ /**
50
+ * Outputs the settings form.
51
+ *
52
+ * @param array $instance — Current settings.
53
+ *
54
+ * @return string — Default return is 'noform'.
55
+ */
56
+ public function form( $instance ) {
57
+ return '<p>There are no options for this widget.</p>';
58
+ }
59
+ }
60
+
61
+ add_action(
62
+ 'widgets_init',
63
+ function() {
64
+ $settings = get_option( 'quick_adsense_settings' );
65
+ for ( $i = 1; $i <= 10; $i++ ) {
66
+ if ( isset( $settings[ 'widget_ad_' . $i . '_content' ] ) && ( '' !== $settings[ 'widget_ad_' . $i . '_content' ] ) ) {
67
+ register_widget( new QuickAdsenseAdWidget( $i ) );
68
+ }
69
+ }
70
+ }
71
+ );
quick-adsense.php CHANGED
@@ -1,39 +1,25 @@
1
- <?php
2
- /*
3
- Plugin Name: Quick Adsense
4
- Plugin URI: http://quickadsense.com/
5
- Description: Quick Adsense offers a quicker & flexible way to insert Google Adsense or any Ads code into a blog post.
6
- Author: namithjawahar
7
- Version: 2.7
8
- */
9
- /*
10
- This program is free software; you can redistribute it and/or modify
11
- it under the terms of the GNU General Public License as published by
12
- the Free Software Foundation; either version 2 of the License, or
13
- (at your option) any later version.
14
-
15
- This program is distributed in the hope that it will be useful,
16
- but WITHOUT ANY WARRANTY; without even the implied warranty of
17
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
- GNU General Public License for more details.
19
-
20
- You should have received a copy of the GNU General Public License
21
- along with this program; if not, write to the Free Software
22
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23
- */
24
- /*Begin Include Files*/
25
- require_once(dirname(__FILE__).'/includes/defaults.php');
26
- require_once(dirname(__FILE__).'/includes/controls.php');
27
- require_once(dirname(__FILE__).'/includes/settings.php');
28
- require_once(dirname(__FILE__).'/includes/widgets.php');
29
- require_once(dirname(__FILE__).'/includes/quicktags.php');
30
- require_once(dirname(__FILE__).'/includes/content.php');
31
- require_once(dirname(__FILE__).'/includes/adsense.php');
32
- if(!class_exists('Mobile_Detect')) {
33
- require_once(dirname(__FILE__).'/includes/MobileDetect/Mobile_Detect.php');
34
- }
35
- if(!class_exists('iriven\\GeoIPCountry')) {
36
- require_once(dirname(__FILE__).'/includes/GeoIP/GeoIPCountry.php');
37
- }
38
- /*End Include Files*/
39
- ?>
1
+ <?php
2
+ /**
3
+ * Plugin Name: Quick Adsense
4
+ * Plugin URI: http://quickadsense.com/
5
+ * Description: Quick Adsense offers a quicker & flexible way to insert Google Adsense or any Ads code into a blog post.
6
+ * Author: namithjawahar
7
+ * Author URI: https://smartlogix.co.in/
8
+ * Version: 2.8
9
+ */
10
+ require_once dirname( __FILE__ ) . '/includes/loader.php';
11
+ require_once dirname( __FILE__ ) . '/includes/countries.php';
12
+ require_once dirname( __FILE__ ) . '/includes/defaults.php';
13
+ require_once dirname( __FILE__ ) . '/includes/controls.php';
14
+ require_once dirname( __FILE__ ) . '/includes/settings.php';
15
+ require_once dirname( __FILE__ ) . '/includes/widgets.php';
16
+ require_once dirname( __FILE__ ) . '/includes/quicktags.php';
17
+ require_once dirname( __FILE__ ) . '/includes/content.php';
18
+ require_once dirname( __FILE__ ) . '/includes/adsense.php';
19
+ require_once dirname( __FILE__ ) . '/includes/class-filehandler.php';
20
+ if ( ! class_exists( 'Mobile_Detect' ) ) {
21
+ require_once dirname( __FILE__ ) . '/includes/vendor/MobileDetect/Mobile_Detect.php';
22
+ }
23
+ if ( ! class_exists( 'iriven\\GeoIPCountry' ) ) {
24
+ require_once dirname( __FILE__ ) . '/includes/vendor/GeoIP/GeoIPCountry.php';
25
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: namithjawahar
3
  Tags: WordPress Plugin, adsense, google adsense, random adsense, random ads, advertising, adsense insertion, ad manager, ad, yahoo, google, ads, text insertion, widget, sidebar, admin, posts, plugin
4
  Requires at least: 5.0
5
- Tested up to: 5.7.2
6
- Stable tag: 2.7
7
 
8
  Quick Adsense offers a quicker & flexible way to insert Google Adsense or any Ads code into a blog post.
9
 
@@ -52,6 +52,12 @@ Sign up for a [Google Adsense Account](http://adsense.google.com/) to generate r
52
  Please feedback to [http://quickadsense.com/](http://quickadsense.com/) for any bug you might have found, or any suggestion you like to add.
53
 
54
  == Change Log ==
 
 
 
 
 
 
55
  = 2.6 =
56
  * Vi Integration Removed
57
  * Plugin Ownership Change
2
  Contributors: namithjawahar
3
  Tags: WordPress Plugin, adsense, google adsense, random adsense, random ads, advertising, adsense insertion, ad manager, ad, yahoo, google, ads, text insertion, widget, sidebar, admin, posts, plugin
4
  Requires at least: 5.0
5
+ Tested up to: 5.9.1
6
+ Stable tag: 2.8
7
 
8
  Quick Adsense offers a quicker & flexible way to insert Google Adsense or any Ads code into a blog post.
9
 
52
  Please feedback to [http://quickadsense.com/](http://quickadsense.com/) for any bug you might have found, or any suggestion you like to add.
53
 
54
  == Change Log ==
55
+ = 2.8 =
56
+ * Bug fixes and Security updates
57
+
58
+ = 2.7 =
59
+ * Bug fixes and Security updates
60
+
61
  = 2.6 =
62
  * Vi Integration Removed
63
  * Plugin Ownership Change
screenshot-1.png DELETED
Binary file
screenshot-2.png DELETED
Binary file
screenshot-3.png DELETED
Binary file