Shortlinks by Pretty Links – Best WordPress Link Tracking Plugin - Version 3.2.3

Version Description

  • Removing vestigial files
Download this release

Release Info

Developer cartpauj
Plugin Icon 128x128 Shortlinks by Pretty Links – Best WordPress Link Tracking Plugin
Version 3.2.3
Comparing to
See all releases

Code changes from version 3.2.2 to 3.2.3

Files changed (541) hide show
  1. .distignore +0 -18
  2. .github/workflows/main.yml +0 -17
  3. .gitignore +0 -2
  4. .phpcs.xml.dist +0 -49
  5. .travis.yml +0 -67
  6. .wordpress-org/banner-1544x500.png +0 -0
  7. .wordpress-org/banner-772x250.png +0 -0
  8. .wordpress-org/icon-128x128.png +0 -0
  9. .wordpress-org/icon-256x256.png +0 -0
  10. README +0 -5
  11. i18n/pretty-link.pot +2 -2
  12. images/not_tracking.png +0 -0
  13. package.json +0 -37
  14. phpunit.xml.dist +0 -15
  15. pretty-link.php +1 -1
  16. pro/README +0 -0
  17. pro/app/controllers/PlpAppController.php +0 -179
  18. pro/app/controllers/PlpDbController.php +0 -282
  19. pro/app/controllers/PlpImportExportController.php +0 -378
  20. pro/app/controllers/PlpKeywordsController.php +0 -513
  21. pro/app/controllers/PlpLinkCategoriesController.php +0 -43
  22. pro/app/controllers/PlpLinkTagsController.php +0 -50
  23. pro/app/controllers/PlpLinksController.php +0 -892
  24. pro/app/controllers/PlpOptionsController.php +0 -249
  25. pro/app/controllers/PlpPostsController.php +0 -259
  26. pro/app/controllers/PlpPrettyBarController.php +0 -127
  27. pro/app/controllers/PlpPublicLinksController.php +0 -154
  28. pro/app/controllers/PlpReportsController.php +0 -344
  29. pro/app/controllers/PlpSocialButtonsController.php +0 -71
  30. pro/app/controllers/PlpToolsController.php +0 -18
  31. pro/app/controllers/PlpTwitterController.php +0 -22
  32. pro/app/controllers/index.php +0 -2
  33. pro/app/helpers/PlpLinksHelper.php +0 -36
  34. pro/app/helpers/PlpOptionsHelper.php +0 -36
  35. pro/app/helpers/PlpPostsHelper.php +0 -84
  36. pro/app/helpers/PlpPrettyBarHelper.php +0 -65
  37. pro/app/helpers/PlpPublicLinksHelper.php +0 -19
  38. pro/app/helpers/PlpSocialButtonsHelper.php +0 -65
  39. pro/app/helpers/PlpTwitterHelper.php +0 -26
  40. pro/app/helpers/index.php +0 -2
  41. pro/app/index.php +0 -2
  42. pro/app/models/PlpKeyword.php +0 -724
  43. pro/app/models/PlpLinkRotation.php +0 -186
  44. pro/app/models/PlpOptions.php +0 -407
  45. pro/app/models/PlpPostOptions.php +0 -79
  46. pro/app/models/PlpReport.php +0 -497
  47. pro/app/models/PlpUrlReplacement.php +0 -409
  48. pro/app/models/PlpUtils.php +0 -276
  49. pro/app/models/index.php +0 -2
  50. pro/app/views/import-export/form.php +0 -52
  51. pro/app/views/import-export/import-error.php +0 -11
  52. pro/app/views/import-export/import.php +0 -51
  53. pro/app/views/import-export/index.php +0 -2
  54. pro/app/views/index.php +0 -2
  55. pro/app/views/links/bulk-edit.php +0 -31
  56. pro/app/views/links/cloaked-redirect.php +0 -22
  57. pro/app/views/links/form.php +0 -338
  58. pro/app/views/links/geo_row.php +0 -41
  59. pro/app/views/links/index.php +0 -2
  60. pro/app/views/links/javascript-redirect.php +0 -25
  61. pro/app/views/links/link-has-expired.php +0 -31
  62. pro/app/views/links/link-options.php +0 -84
  63. pro/app/views/links/metarefresh-redirect.php +0 -23
  64. pro/app/views/links/prettybar-redirect.php +0 -24
  65. pro/app/views/links/prettybar.php +0 -85
  66. pro/app/views/links/tech_row.php +0 -102
  67. pro/app/views/links/time_row.php +0 -54
  68. pro/app/views/options/autocreate.php +0 -73
  69. pro/app/views/options/form.php +0 -934
  70. pro/app/views/options/general.php +0 -66
  71. pro/app/views/options/index.php +0 -2
  72. pro/app/views/public/form.php +0 -48
  73. pro/app/views/public/index.php +0 -2
  74. pro/app/views/reports/custom-report.php +0 -74
  75. pro/app/views/reports/edit.php +0 -69
  76. pro/app/views/reports/index.php +0 -2
  77. pro/app/views/reports/list.php +0 -94
  78. pro/app/views/reports/new.php +0 -70
  79. pro/app/views/reports/reports.php +0 -9
  80. pro/app/views/reports/split-test-report.php +0 -69
  81. pro/app/views/tools/generator.php +0 -44
  82. pro/app/views/tools/index.php +0 -2
  83. pro/app/views/tools/nav.php +0 -4
  84. pro/app/widgets/PlpPublicLinksWidget.php +0 -105
  85. pro/app/widgets/index.php +0 -2
  86. pro/css/admin_bookmarklet.css +0 -11
  87. pro/css/admin_options.css +0 -26
  88. pro/css/admin_post.css +0 -1
  89. pro/css/admin_reports.css +0 -35
  90. pro/css/index.php +0 -2
  91. pro/css/jquery-ui-timepicker-addon.css +0 -30
  92. pro/css/prettybar.css +0 -96
  93. pro/css/prlipro-post.css +0 -5
  94. pro/i18n/countries.php +0 -249
  95. pro/images/dark_add_twitter_account.png +0 -0
  96. pro/images/download_qr_code_icon.gif +0 -0
  97. pro/images/index.php +0 -2
  98. pro/index.php +0 -2
  99. pro/js/admin_bookmarklet.js +0 -14
  100. pro/js/admin_draw_report.js +0 -25
  101. pro/js/admin_links.js +0 -110
  102. pro/js/admin_options.js +0 -7
  103. pro/js/admin_post.js +0 -24
  104. pro/js/admin_reports.js +0 -12
  105. pro/js/date_picker.js +0 -57
  106. pro/js/index.php +0 -2
  107. pro/js/javascript-redirect.js +0 -3
  108. pro/js/jquery-ui-timepicker-addon.js +0 -2291
  109. pro/pretty-link-pro.php +0 -99
  110. pro/vendor/index.php +0 -2
  111. pro/vendor/phpqrcode/.gitignore +0 -2
  112. pro/vendor/phpqrcode/CHANGELOG +0 -38
  113. pro/vendor/phpqrcode/INSTALL +0 -67
  114. pro/vendor/phpqrcode/LICENSE +0 -165
  115. pro/vendor/phpqrcode/README +0 -61
  116. pro/vendor/phpqrcode/VERSION +0 -2
  117. pro/vendor/phpqrcode/bindings/index.php +0 -2
  118. pro/vendor/phpqrcode/bindings/tcpdf/index.php +0 -2
  119. pro/vendor/phpqrcode/bindings/tcpdf/qrcode.php +0 -2875
  120. pro/vendor/phpqrcode/cache/frame_1.dat +0 -2
  121. pro/vendor/phpqrcode/cache/frame_1.png +0 -0
  122. pro/vendor/phpqrcode/cache/frame_10.dat +0 -0
  123. pro/vendor/phpqrcode/cache/frame_10.png +0 -0
  124. pro/vendor/phpqrcode/cache/frame_11.dat +0 -0
  125. pro/vendor/phpqrcode/cache/frame_11.png +0 -0
  126. pro/vendor/phpqrcode/cache/frame_12.dat +0 -0
  127. pro/vendor/phpqrcode/cache/frame_12.png +0 -0
  128. pro/vendor/phpqrcode/cache/frame_13.dat +0 -0
  129. pro/vendor/phpqrcode/cache/frame_13.png +0 -0
  130. pro/vendor/phpqrcode/cache/frame_14.dat +0 -0
  131. pro/vendor/phpqrcode/cache/frame_14.png +0 -0
  132. pro/vendor/phpqrcode/cache/frame_15.dat +0 -0
  133. pro/vendor/phpqrcode/cache/frame_15.png +0 -0
  134. pro/vendor/phpqrcode/cache/frame_16.dat +0 -1
  135. pro/vendor/phpqrcode/cache/frame_16.png +0 -0
  136. pro/vendor/phpqrcode/cache/frame_17.dat +0 -0
  137. pro/vendor/phpqrcode/cache/frame_17.png +0 -0
  138. pro/vendor/phpqrcode/cache/frame_18.dat +0 -2
  139. pro/vendor/phpqrcode/cache/frame_18.png +0 -0
  140. pro/vendor/phpqrcode/cache/frame_19.dat +0 -3
  141. pro/vendor/phpqrcode/cache/frame_19.png +0 -0
  142. pro/vendor/phpqrcode/cache/frame_2.dat +0 -1
  143. pro/vendor/phpqrcode/cache/frame_2.png +0 -0
  144. pro/vendor/phpqrcode/cache/frame_20.dat +0 -0
  145. pro/vendor/phpqrcode/cache/frame_20.png +0 -0
  146. pro/vendor/phpqrcode/cache/frame_21.dat +0 -1
  147. pro/vendor/phpqrcode/cache/frame_21.png +0 -0
  148. pro/vendor/phpqrcode/cache/frame_22.dat +0 -3
  149. pro/vendor/phpqrcode/cache/frame_22.png +0 -0
  150. pro/vendor/phpqrcode/cache/frame_23.dat +0 -3
  151. pro/vendor/phpqrcode/cache/frame_23.png +0 -0
  152. pro/vendor/phpqrcode/cache/frame_24.dat +0 -1
  153. pro/vendor/phpqrcode/cache/frame_24.png +0 -0
  154. pro/vendor/phpqrcode/cache/frame_25.dat +0 -3
  155. pro/vendor/phpqrcode/cache/frame_25.png +0 -0
  156. pro/vendor/phpqrcode/cache/frame_26.dat +0 -2
  157. pro/vendor/phpqrcode/cache/frame_26.png +0 -0
  158. pro/vendor/phpqrcode/cache/frame_27.dat +0 -0
  159. pro/vendor/phpqrcode/cache/frame_27.png +0 -0
  160. pro/vendor/phpqrcode/cache/frame_28.dat +0 -0
  161. pro/vendor/phpqrcode/cache/frame_28.png +0 -0
  162. pro/vendor/phpqrcode/cache/frame_29.dat +0 -2
  163. pro/vendor/phpqrcode/cache/frame_29.png +0 -0
  164. pro/vendor/phpqrcode/cache/frame_3.dat +0 -1
  165. pro/vendor/phpqrcode/cache/frame_3.png +0 -0
  166. pro/vendor/phpqrcode/cache/frame_30.dat +0 -0
  167. pro/vendor/phpqrcode/cache/frame_30.png +0 -0
  168. pro/vendor/phpqrcode/cache/frame_31.dat +0 -1
  169. pro/vendor/phpqrcode/cache/frame_31.png +0 -0
  170. pro/vendor/phpqrcode/cache/frame_32.dat +0 -2
  171. pro/vendor/phpqrcode/cache/frame_32.png +0 -0
  172. pro/vendor/phpqrcode/cache/frame_33.dat +0 -14
  173. pro/vendor/phpqrcode/cache/frame_33.png +0 -0
  174. pro/vendor/phpqrcode/cache/frame_34.dat +0 -0
  175. pro/vendor/phpqrcode/cache/frame_34.png +0 -0
  176. pro/vendor/phpqrcode/cache/frame_35.dat +0 -0
  177. pro/vendor/phpqrcode/cache/frame_35.png +0 -0
  178. pro/vendor/phpqrcode/cache/frame_36.dat +0 -0
  179. pro/vendor/phpqrcode/cache/frame_36.png +0 -0
  180. pro/vendor/phpqrcode/cache/frame_37.dat +0 -0
  181. pro/vendor/phpqrcode/cache/frame_37.png +0 -0
  182. pro/vendor/phpqrcode/cache/frame_38.dat +0 -1
  183. pro/vendor/phpqrcode/cache/frame_38.png +0 -0
  184. pro/vendor/phpqrcode/cache/frame_39.dat +0 -0
  185. pro/vendor/phpqrcode/cache/frame_39.png +0 -0
  186. pro/vendor/phpqrcode/cache/frame_4.dat +0 -1
  187. pro/vendor/phpqrcode/cache/frame_4.png +0 -0
  188. pro/vendor/phpqrcode/cache/frame_40.dat +0 -2
  189. pro/vendor/phpqrcode/cache/frame_40.png +0 -0
  190. pro/vendor/phpqrcode/cache/frame_5.dat +0 -1
  191. pro/vendor/phpqrcode/cache/frame_5.png +0 -0
  192. pro/vendor/phpqrcode/cache/frame_6.dat +0 -0
  193. pro/vendor/phpqrcode/cache/frame_6.png +0 -0
  194. pro/vendor/phpqrcode/cache/frame_7.dat +0 -0
  195. pro/vendor/phpqrcode/cache/frame_7.png +0 -0
  196. pro/vendor/phpqrcode/cache/frame_8.dat +0 -0
  197. pro/vendor/phpqrcode/cache/frame_8.png +0 -0
  198. pro/vendor/phpqrcode/cache/frame_9.dat +0 -0
  199. pro/vendor/phpqrcode/cache/frame_9.png +0 -0
  200. pro/vendor/phpqrcode/cache/index.php +0 -2
  201. pro/vendor/phpqrcode/cache/mask_0/index.php +0 -2
  202. pro/vendor/phpqrcode/cache/mask_0/mask_101_0.dat +0 -0
  203. pro/vendor/phpqrcode/cache/mask_0/mask_105_0.dat +0 -0
  204. pro/vendor/phpqrcode/cache/mask_0/mask_109_0.dat +0 -2
  205. pro/vendor/phpqrcode/cache/mask_0/mask_113_0.dat +0 -2
  206. pro/vendor/phpqrcode/cache/mask_0/mask_117_0.dat +0 -2
  207. pro/vendor/phpqrcode/cache/mask_0/mask_121_0.dat +0 -1
  208. pro/vendor/phpqrcode/cache/mask_0/mask_125_0.dat +0 -2
  209. pro/vendor/phpqrcode/cache/mask_0/mask_129_0.dat +0 -2
  210. pro/vendor/phpqrcode/cache/mask_0/mask_133_0.dat +0 -2
  211. pro/vendor/phpqrcode/cache/mask_0/mask_137_0.dat +0 -1
  212. pro/vendor/phpqrcode/cache/mask_0/mask_141_0.dat +0 -2
  213. pro/vendor/phpqrcode/cache/mask_0/mask_145_0.dat +0 -2
  214. pro/vendor/phpqrcode/cache/mask_0/mask_149_0.dat +0 -3
  215. pro/vendor/phpqrcode/cache/mask_0/mask_153_0.dat +0 -1
  216. pro/vendor/phpqrcode/cache/mask_0/mask_157_0.dat +0 -2
  217. pro/vendor/phpqrcode/cache/mask_0/mask_161_0.dat +0 -0
  218. pro/vendor/phpqrcode/cache/mask_0/mask_165_0.dat +0 -2
  219. pro/vendor/phpqrcode/cache/mask_0/mask_169_0.dat +0 -2
  220. pro/vendor/phpqrcode/cache/mask_0/mask_173_0.dat +0 -1
  221. pro/vendor/phpqrcode/cache/mask_0/mask_177_0.dat +0 -2
  222. pro/vendor/phpqrcode/cache/mask_0/mask_21_0.dat +0 -0
  223. pro/vendor/phpqrcode/cache/mask_0/mask_25_0.dat +0 -0
  224. pro/vendor/phpqrcode/cache/mask_0/mask_29_0.dat +0 -0
  225. pro/vendor/phpqrcode/cache/mask_0/mask_33_0.dat +0 -0
  226. pro/vendor/phpqrcode/cache/mask_0/mask_37_0.dat +0 -0
  227. pro/vendor/phpqrcode/cache/mask_0/mask_41_0.dat +0 -0
  228. pro/vendor/phpqrcode/cache/mask_0/mask_45_0.dat +0 -0
  229. pro/vendor/phpqrcode/cache/mask_0/mask_49_0.dat +0 -2
  230. pro/vendor/phpqrcode/cache/mask_0/mask_53_0.dat +0 -2
  231. pro/vendor/phpqrcode/cache/mask_0/mask_57_0.dat +0 -4
  232. pro/vendor/phpqrcode/cache/mask_0/mask_61_0.dat +0 -0
  233. pro/vendor/phpqrcode/cache/mask_0/mask_65_0.dat +0 -0
  234. pro/vendor/phpqrcode/cache/mask_0/mask_69_0.dat +0 -1
  235. pro/vendor/phpqrcode/cache/mask_0/mask_73_0.dat +0 -1
  236. pro/vendor/phpqrcode/cache/mask_0/mask_77_0.dat +0 -2
  237. pro/vendor/phpqrcode/cache/mask_0/mask_81_0.dat +0 -2
  238. pro/vendor/phpqrcode/cache/mask_0/mask_85_0.dat +0 -2
  239. pro/vendor/phpqrcode/cache/mask_0/mask_89_0.dat +0 -1
  240. pro/vendor/phpqrcode/cache/mask_0/mask_93_0.dat +0 -3
  241. pro/vendor/phpqrcode/cache/mask_0/mask_97_0.dat +0 -0
  242. pro/vendor/phpqrcode/cache/mask_1/index.php +0 -2
  243. pro/vendor/phpqrcode/cache/mask_1/mask_101_1.dat +0 -2
  244. pro/vendor/phpqrcode/cache/mask_1/mask_105_1.dat +0 -1
  245. pro/vendor/phpqrcode/cache/mask_1/mask_109_1.dat +0 -1
  246. pro/vendor/phpqrcode/cache/mask_1/mask_113_1.dat +0 -1
  247. pro/vendor/phpqrcode/cache/mask_1/mask_117_1.dat +0 -2
  248. pro/vendor/phpqrcode/cache/mask_1/mask_121_1.dat +0 -2
  249. pro/vendor/phpqrcode/cache/mask_1/mask_125_1.dat +0 -2
  250. pro/vendor/phpqrcode/cache/mask_1/mask_129_1.dat +0 -0
  251. pro/vendor/phpqrcode/cache/mask_1/mask_133_1.dat +0 -1
  252. pro/vendor/phpqrcode/cache/mask_1/mask_137_1.dat +0 -3
  253. pro/vendor/phpqrcode/cache/mask_1/mask_141_1.dat +0 -2
  254. pro/vendor/phpqrcode/cache/mask_1/mask_145_1.dat +0 -1
  255. pro/vendor/phpqrcode/cache/mask_1/mask_149_1.dat +0 -1
  256. pro/vendor/phpqrcode/cache/mask_1/mask_153_1.dat +0 -2
  257. pro/vendor/phpqrcode/cache/mask_1/mask_157_1.dat +0 -2
  258. pro/vendor/phpqrcode/cache/mask_1/mask_161_1.dat +0 -1
  259. pro/vendor/phpqrcode/cache/mask_1/mask_165_1.dat +0 -1
  260. pro/vendor/phpqrcode/cache/mask_1/mask_169_1.dat +0 -1
  261. pro/vendor/phpqrcode/cache/mask_1/mask_173_1.dat +0 -1
  262. pro/vendor/phpqrcode/cache/mask_1/mask_177_1.dat +0 -1
  263. pro/vendor/phpqrcode/cache/mask_1/mask_21_1.dat +0 -0
  264. pro/vendor/phpqrcode/cache/mask_1/mask_25_1.dat +0 -0
  265. pro/vendor/phpqrcode/cache/mask_1/mask_29_1.dat +0 -0
  266. pro/vendor/phpqrcode/cache/mask_1/mask_33_1.dat +0 -0
  267. pro/vendor/phpqrcode/cache/mask_1/mask_37_1.dat +0 -0
  268. pro/vendor/phpqrcode/cache/mask_1/mask_41_1.dat +0 -0
  269. pro/vendor/phpqrcode/cache/mask_1/mask_45_1.dat +0 -0
  270. pro/vendor/phpqrcode/cache/mask_1/mask_49_1.dat +0 -0
  271. pro/vendor/phpqrcode/cache/mask_1/mask_53_1.dat +0 -0
  272. pro/vendor/phpqrcode/cache/mask_1/mask_57_1.dat +0 -0
  273. pro/vendor/phpqrcode/cache/mask_1/mask_61_1.dat +0 -1
  274. pro/vendor/phpqrcode/cache/mask_1/mask_65_1.dat +0 -0
  275. pro/vendor/phpqrcode/cache/mask_1/mask_69_1.dat +0 -0
  276. pro/vendor/phpqrcode/cache/mask_1/mask_73_1.dat +0 -0
  277. pro/vendor/phpqrcode/cache/mask_1/mask_77_1.dat +0 -0
  278. pro/vendor/phpqrcode/cache/mask_1/mask_81_1.dat +0 -0
  279. pro/vendor/phpqrcode/cache/mask_1/mask_85_1.dat +0 -2
  280. pro/vendor/phpqrcode/cache/mask_1/mask_89_1.dat +0 -1
  281. pro/vendor/phpqrcode/cache/mask_1/mask_93_1.dat +0 -2
  282. pro/vendor/phpqrcode/cache/mask_1/mask_97_1.dat +0 -2
  283. pro/vendor/phpqrcode/cache/mask_2/index.php +0 -2
  284. pro/vendor/phpqrcode/cache/mask_2/mask_101_2.dat +0 -3
  285. pro/vendor/phpqrcode/cache/mask_2/mask_105_2.dat +0 -1
  286. pro/vendor/phpqrcode/cache/mask_2/mask_109_2.dat +0 -2
  287. pro/vendor/phpqrcode/cache/mask_2/mask_113_2.dat +0 -1
  288. pro/vendor/phpqrcode/cache/mask_2/mask_117_2.dat +0 -2
  289. pro/vendor/phpqrcode/cache/mask_2/mask_121_2.dat +0 -0
  290. pro/vendor/phpqrcode/cache/mask_2/mask_125_2.dat +0 -1
  291. pro/vendor/phpqrcode/cache/mask_2/mask_129_2.dat +0 -2
  292. pro/vendor/phpqrcode/cache/mask_2/mask_133_2.dat +0 -10
  293. pro/vendor/phpqrcode/cache/mask_2/mask_137_2.dat +0 -2
  294. pro/vendor/phpqrcode/cache/mask_2/mask_141_2.dat +0 -2
  295. pro/vendor/phpqrcode/cache/mask_2/mask_145_2.dat +0 -4
  296. pro/vendor/phpqrcode/cache/mask_2/mask_149_2.dat +0 -1
  297. pro/vendor/phpqrcode/cache/mask_2/mask_153_2.dat +0 -2
  298. pro/vendor/phpqrcode/cache/mask_2/mask_157_2.dat +0 -3
  299. pro/vendor/phpqrcode/cache/mask_2/mask_161_2.dat +0 -0
  300. pro/vendor/phpqrcode/cache/mask_2/mask_165_2.dat +0 -2
  301. pro/vendor/phpqrcode/cache/mask_2/mask_169_2.dat +0 -0
  302. pro/vendor/phpqrcode/cache/mask_2/mask_173_2.dat +0 -1
  303. pro/vendor/phpqrcode/cache/mask_2/mask_177_2.dat +0 -2
  304. pro/vendor/phpqrcode/cache/mask_2/mask_21_2.dat +0 -0
  305. pro/vendor/phpqrcode/cache/mask_2/mask_25_2.dat +0 -0
  306. pro/vendor/phpqrcode/cache/mask_2/mask_29_2.dat +0 -0
  307. pro/vendor/phpqrcode/cache/mask_2/mask_33_2.dat +0 -0
  308. pro/vendor/phpqrcode/cache/mask_2/mask_37_2.dat +0 -0
  309. pro/vendor/phpqrcode/cache/mask_2/mask_41_2.dat +0 -1
  310. pro/vendor/phpqrcode/cache/mask_2/mask_45_2.dat +0 -0
  311. pro/vendor/phpqrcode/cache/mask_2/mask_49_2.dat +0 -0
  312. pro/vendor/phpqrcode/cache/mask_2/mask_53_2.dat +0 -0
  313. pro/vendor/phpqrcode/cache/mask_2/mask_57_2.dat +0 -0
  314. pro/vendor/phpqrcode/cache/mask_2/mask_61_2.dat +0 -0
  315. pro/vendor/phpqrcode/cache/mask_2/mask_65_2.dat +0 -0
  316. pro/vendor/phpqrcode/cache/mask_2/mask_69_2.dat +0 -0
  317. pro/vendor/phpqrcode/cache/mask_2/mask_73_2.dat +0 -0
  318. pro/vendor/phpqrcode/cache/mask_2/mask_77_2.dat +0 -1
  319. pro/vendor/phpqrcode/cache/mask_2/mask_81_2.dat +0 -2
  320. pro/vendor/phpqrcode/cache/mask_2/mask_85_2.dat +0 -2
  321. pro/vendor/phpqrcode/cache/mask_2/mask_89_2.dat +0 -1
  322. pro/vendor/phpqrcode/cache/mask_2/mask_93_2.dat +0 -0
  323. pro/vendor/phpqrcode/cache/mask_2/mask_97_2.dat +0 -2
  324. pro/vendor/phpqrcode/cache/mask_3/index.php +0 -2
  325. pro/vendor/phpqrcode/cache/mask_3/mask_101_3.dat +0 -1
  326. pro/vendor/phpqrcode/cache/mask_3/mask_105_3.dat +0 -1
  327. pro/vendor/phpqrcode/cache/mask_3/mask_109_3.dat +0 -1
  328. pro/vendor/phpqrcode/cache/mask_3/mask_113_3.dat +0 -2
  329. pro/vendor/phpqrcode/cache/mask_3/mask_117_3.dat +0 -4
  330. pro/vendor/phpqrcode/cache/mask_3/mask_121_3.dat +0 -0
  331. pro/vendor/phpqrcode/cache/mask_3/mask_125_3.dat +0 -2
  332. pro/vendor/phpqrcode/cache/mask_3/mask_129_3.dat +0 -8
  333. pro/vendor/phpqrcode/cache/mask_3/mask_133_3.dat +0 -0
  334. pro/vendor/phpqrcode/cache/mask_3/mask_137_3.dat +0 -2
  335. pro/vendor/phpqrcode/cache/mask_3/mask_141_3.dat +0 -2
  336. pro/vendor/phpqrcode/cache/mask_3/mask_145_3.dat +0 -3
  337. pro/vendor/phpqrcode/cache/mask_3/mask_149_3.dat +0 -1
  338. pro/vendor/phpqrcode/cache/mask_3/mask_153_3.dat +0 -2
  339. pro/vendor/phpqrcode/cache/mask_3/mask_157_3.dat +0 -0
  340. pro/vendor/phpqrcode/cache/mask_3/mask_161_3.dat +0 -3
  341. pro/vendor/phpqrcode/cache/mask_3/mask_165_3.dat +0 -2
  342. pro/vendor/phpqrcode/cache/mask_3/mask_169_3.dat +0 -1
  343. pro/vendor/phpqrcode/cache/mask_3/mask_173_3.dat +0 -1
  344. pro/vendor/phpqrcode/cache/mask_3/mask_177_3.dat +0 -0
  345. pro/vendor/phpqrcode/cache/mask_3/mask_21_3.dat +0 -0
  346. pro/vendor/phpqrcode/cache/mask_3/mask_25_3.dat +0 -0
  347. pro/vendor/phpqrcode/cache/mask_3/mask_29_3.dat +0 -0
  348. pro/vendor/phpqrcode/cache/mask_3/mask_33_3.dat +0 -0
  349. pro/vendor/phpqrcode/cache/mask_3/mask_37_3.dat +0 -0
  350. pro/vendor/phpqrcode/cache/mask_3/mask_41_3.dat +0 -0
  351. pro/vendor/phpqrcode/cache/mask_3/mask_45_3.dat +0 -2
  352. pro/vendor/phpqrcode/cache/mask_3/mask_49_3.dat +0 -0
  353. pro/vendor/phpqrcode/cache/mask_3/mask_53_3.dat +0 -3
  354. pro/vendor/phpqrcode/cache/mask_3/mask_57_3.dat +0 -0
  355. pro/vendor/phpqrcode/cache/mask_3/mask_61_3.dat +0 -2
  356. pro/vendor/phpqrcode/cache/mask_3/mask_65_3.dat +0 -2
  357. pro/vendor/phpqrcode/cache/mask_3/mask_69_3.dat +0 -2
  358. pro/vendor/phpqrcode/cache/mask_3/mask_73_3.dat +0 -2
  359. pro/vendor/phpqrcode/cache/mask_3/mask_77_3.dat +0 -2
  360. pro/vendor/phpqrcode/cache/mask_3/mask_81_3.dat +0 -2
  361. pro/vendor/phpqrcode/cache/mask_3/mask_85_3.dat +0 -0
  362. pro/vendor/phpqrcode/cache/mask_3/mask_89_3.dat +0 -2
  363. pro/vendor/phpqrcode/cache/mask_3/mask_93_3.dat +0 -2
  364. pro/vendor/phpqrcode/cache/mask_3/mask_97_3.dat +0 -0
  365. pro/vendor/phpqrcode/cache/mask_4/index.php +0 -2
  366. pro/vendor/phpqrcode/cache/mask_4/mask_101_4.dat +0 -2
  367. pro/vendor/phpqrcode/cache/mask_4/mask_105_4.dat +0 -2
  368. pro/vendor/phpqrcode/cache/mask_4/mask_109_4.dat +0 -0
  369. pro/vendor/phpqrcode/cache/mask_4/mask_113_4.dat +0 -2
  370. pro/vendor/phpqrcode/cache/mask_4/mask_117_4.dat +0 -2
  371. pro/vendor/phpqrcode/cache/mask_4/mask_121_4.dat +0 -0
  372. pro/vendor/phpqrcode/cache/mask_4/mask_125_4.dat +0 -0
  373. pro/vendor/phpqrcode/cache/mask_4/mask_129_4.dat +0 -0
  374. pro/vendor/phpqrcode/cache/mask_4/mask_133_4.dat +0 -3
  375. pro/vendor/phpqrcode/cache/mask_4/mask_137_4.dat +0 -0
  376. pro/vendor/phpqrcode/cache/mask_4/mask_141_4.dat +0 -0
  377. pro/vendor/phpqrcode/cache/mask_4/mask_145_4.dat +0 -0
  378. pro/vendor/phpqrcode/cache/mask_4/mask_149_4.dat +0 -2
  379. pro/vendor/phpqrcode/cache/mask_4/mask_153_4.dat +0 -2
  380. pro/vendor/phpqrcode/cache/mask_4/mask_157_4.dat +0 -1
  381. pro/vendor/phpqrcode/cache/mask_4/mask_161_4.dat +0 -1
  382. pro/vendor/phpqrcode/cache/mask_4/mask_165_4.dat +0 -3
  383. pro/vendor/phpqrcode/cache/mask_4/mask_169_4.dat +0 -0
  384. pro/vendor/phpqrcode/cache/mask_4/mask_173_4.dat +0 -2
  385. pro/vendor/phpqrcode/cache/mask_4/mask_177_4.dat +0 -2
  386. pro/vendor/phpqrcode/cache/mask_4/mask_21_4.dat +0 -0
  387. pro/vendor/phpqrcode/cache/mask_4/mask_25_4.dat +0 -0
  388. pro/vendor/phpqrcode/cache/mask_4/mask_29_4.dat +0 -0
  389. pro/vendor/phpqrcode/cache/mask_4/mask_33_4.dat +0 -0
  390. pro/vendor/phpqrcode/cache/mask_4/mask_37_4.dat +0 -0
  391. pro/vendor/phpqrcode/cache/mask_4/mask_41_4.dat +0 -0
  392. pro/vendor/phpqrcode/cache/mask_4/mask_45_4.dat +0 -0
  393. pro/vendor/phpqrcode/cache/mask_4/mask_49_4.dat +0 -0
  394. pro/vendor/phpqrcode/cache/mask_4/mask_53_4.dat +0 -0
  395. pro/vendor/phpqrcode/cache/mask_4/mask_57_4.dat +0 -0
  396. pro/vendor/phpqrcode/cache/mask_4/mask_61_4.dat +0 -0
  397. pro/vendor/phpqrcode/cache/mask_4/mask_65_4.dat +0 -2
  398. pro/vendor/phpqrcode/cache/mask_4/mask_69_4.dat +0 -1
  399. pro/vendor/phpqrcode/cache/mask_4/mask_73_4.dat +0 -3
  400. pro/vendor/phpqrcode/cache/mask_4/mask_77_4.dat +0 -2
  401. pro/vendor/phpqrcode/cache/mask_4/mask_81_4.dat +0 -3
  402. pro/vendor/phpqrcode/cache/mask_4/mask_85_4.dat +0 -0
  403. pro/vendor/phpqrcode/cache/mask_4/mask_89_4.dat +0 -2
  404. pro/vendor/phpqrcode/cache/mask_4/mask_93_4.dat +0 -2
  405. pro/vendor/phpqrcode/cache/mask_4/mask_97_4.dat +0 -0
  406. pro/vendor/phpqrcode/cache/mask_5/index.php +0 -2
  407. pro/vendor/phpqrcode/cache/mask_5/mask_101_5.dat +0 -2
  408. pro/vendor/phpqrcode/cache/mask_5/mask_105_5.dat +0 -0
  409. pro/vendor/phpqrcode/cache/mask_5/mask_109_5.dat +0 -0
  410. pro/vendor/phpqrcode/cache/mask_5/mask_113_5.dat +0 -9
  411. pro/vendor/phpqrcode/cache/mask_5/mask_117_5.dat +0 -1
  412. pro/vendor/phpqrcode/cache/mask_5/mask_121_5.dat +0 -0
  413. pro/vendor/phpqrcode/cache/mask_5/mask_125_5.dat +0 -2
  414. pro/vendor/phpqrcode/cache/mask_5/mask_129_5.dat +0 -0
  415. pro/vendor/phpqrcode/cache/mask_5/mask_133_5.dat +0 -2
  416. pro/vendor/phpqrcode/cache/mask_5/mask_137_5.dat +0 -3
  417. pro/vendor/phpqrcode/cache/mask_5/mask_141_5.dat +0 -0
  418. pro/vendor/phpqrcode/cache/mask_5/mask_145_5.dat +0 -0
  419. pro/vendor/phpqrcode/cache/mask_5/mask_149_5.dat +0 -3
  420. pro/vendor/phpqrcode/cache/mask_5/mask_153_5.dat +0 -2
  421. pro/vendor/phpqrcode/cache/mask_5/mask_157_5.dat +0 -1
  422. pro/vendor/phpqrcode/cache/mask_5/mask_161_5.dat +0 -2
  423. pro/vendor/phpqrcode/cache/mask_5/mask_165_5.dat +0 -0
  424. pro/vendor/phpqrcode/cache/mask_5/mask_169_5.dat +0 -1
  425. pro/vendor/phpqrcode/cache/mask_5/mask_173_5.dat +0 -4
  426. pro/vendor/phpqrcode/cache/mask_5/mask_177_5.dat +0 -11
  427. pro/vendor/phpqrcode/cache/mask_5/mask_21_5.dat +0 -0
  428. pro/vendor/phpqrcode/cache/mask_5/mask_25_5.dat +0 -2
  429. pro/vendor/phpqrcode/cache/mask_5/mask_29_5.dat +0 -2
  430. pro/vendor/phpqrcode/cache/mask_5/mask_33_5.dat +0 -0
  431. pro/vendor/phpqrcode/cache/mask_5/mask_37_5.dat +0 -0
  432. pro/vendor/phpqrcode/cache/mask_5/mask_41_5.dat +0 -2
  433. pro/vendor/phpqrcode/cache/mask_5/mask_45_5.dat +0 -1
  434. pro/vendor/phpqrcode/cache/mask_5/mask_49_5.dat +0 -0
  435. pro/vendor/phpqrcode/cache/mask_5/mask_53_5.dat +0 -1
  436. pro/vendor/phpqrcode/cache/mask_5/mask_57_5.dat +0 -2
  437. pro/vendor/phpqrcode/cache/mask_5/mask_61_5.dat +0 -1
  438. pro/vendor/phpqrcode/cache/mask_5/mask_65_5.dat +0 -0
  439. pro/vendor/phpqrcode/cache/mask_5/mask_69_5.dat +0 -0
  440. pro/vendor/phpqrcode/cache/mask_5/mask_73_5.dat +0 -0
  441. pro/vendor/phpqrcode/cache/mask_5/mask_77_5.dat +0 -1
  442. pro/vendor/phpqrcode/cache/mask_5/mask_81_5.dat +0 -3
  443. pro/vendor/phpqrcode/cache/mask_5/mask_85_5.dat +0 -0
  444. pro/vendor/phpqrcode/cache/mask_5/mask_89_5.dat +0 -2
  445. pro/vendor/phpqrcode/cache/mask_5/mask_93_5.dat +0 -2
  446. pro/vendor/phpqrcode/cache/mask_5/mask_97_5.dat +0 -1
  447. pro/vendor/phpqrcode/cache/mask_6/index.php +0 -2
  448. pro/vendor/phpqrcode/cache/mask_6/mask_101_6.dat +0 -2
  449. pro/vendor/phpqrcode/cache/mask_6/mask_105_6.dat +0 -3
  450. pro/vendor/phpqrcode/cache/mask_6/mask_109_6.dat +0 -1
  451. pro/vendor/phpqrcode/cache/mask_6/mask_113_6.dat +0 -3
  452. pro/vendor/phpqrcode/cache/mask_6/mask_117_6.dat +0 -1
  453. pro/vendor/phpqrcode/cache/mask_6/mask_121_6.dat +0 -0
  454. pro/vendor/phpqrcode/cache/mask_6/mask_125_6.dat +0 -1
  455. pro/vendor/phpqrcode/cache/mask_6/mask_129_6.dat +0 -0
  456. pro/vendor/phpqrcode/cache/mask_6/mask_133_6.dat +0 -0
  457. pro/vendor/phpqrcode/cache/mask_6/mask_137_6.dat +0 -2
  458. pro/vendor/phpqrcode/cache/mask_6/mask_141_6.dat +0 -10
  459. pro/vendor/phpqrcode/cache/mask_6/mask_145_6.dat +0 -0
  460. pro/vendor/phpqrcode/cache/mask_6/mask_149_6.dat +0 -2
  461. pro/vendor/phpqrcode/cache/mask_6/mask_153_6.dat +0 -0
  462. pro/vendor/phpqrcode/cache/mask_6/mask_157_6.dat +0 -1
  463. pro/vendor/phpqrcode/cache/mask_6/mask_161_6.dat +0 -0
  464. pro/vendor/phpqrcode/cache/mask_6/mask_165_6.dat +0 -0
  465. pro/vendor/phpqrcode/cache/mask_6/mask_169_6.dat +0 -1
  466. pro/vendor/phpqrcode/cache/mask_6/mask_173_6.dat +0 -1
  467. pro/vendor/phpqrcode/cache/mask_6/mask_177_6.dat +0 -14
  468. pro/vendor/phpqrcode/cache/mask_6/mask_21_6.dat +0 -1
  469. pro/vendor/phpqrcode/cache/mask_6/mask_25_6.dat +0 -1
  470. pro/vendor/phpqrcode/cache/mask_6/mask_29_6.dat +0 -3
  471. pro/vendor/phpqrcode/cache/mask_6/mask_33_6.dat +0 -0
  472. pro/vendor/phpqrcode/cache/mask_6/mask_37_6.dat +0 -1
  473. pro/vendor/phpqrcode/cache/mask_6/mask_41_6.dat +0 -0
  474. pro/vendor/phpqrcode/cache/mask_6/mask_45_6.dat +0 -0
  475. pro/vendor/phpqrcode/cache/mask_6/mask_49_6.dat +0 -2
  476. pro/vendor/phpqrcode/cache/mask_6/mask_53_6.dat +0 -0
  477. pro/vendor/phpqrcode/cache/mask_6/mask_57_6.dat +0 -2
  478. pro/vendor/phpqrcode/cache/mask_6/mask_61_6.dat +0 -2
  479. pro/vendor/phpqrcode/cache/mask_6/mask_65_6.dat +0 -1
  480. pro/vendor/phpqrcode/cache/mask_6/mask_69_6.dat +0 -1
  481. pro/vendor/phpqrcode/cache/mask_6/mask_73_6.dat +0 -0
  482. pro/vendor/phpqrcode/cache/mask_6/mask_77_6.dat +0 -1
  483. pro/vendor/phpqrcode/cache/mask_6/mask_81_6.dat +0 -3
  484. pro/vendor/phpqrcode/cache/mask_6/mask_85_6.dat +0 -0
  485. pro/vendor/phpqrcode/cache/mask_6/mask_89_6.dat +0 -0
  486. pro/vendor/phpqrcode/cache/mask_6/mask_93_6.dat +0 -0
  487. pro/vendor/phpqrcode/cache/mask_6/mask_97_6.dat +0 -2
  488. pro/vendor/phpqrcode/cache/mask_7/index.php +0 -2
  489. pro/vendor/phpqrcode/cache/mask_7/mask_101_7.dat +0 -1
  490. pro/vendor/phpqrcode/cache/mask_7/mask_105_7.dat +0 -2
  491. pro/vendor/phpqrcode/cache/mask_7/mask_109_7.dat +0 -2
  492. pro/vendor/phpqrcode/cache/mask_7/mask_113_7.dat +0 -11
  493. pro/vendor/phpqrcode/cache/mask_7/mask_117_7.dat +0 -2
  494. pro/vendor/phpqrcode/cache/mask_7/mask_121_7.dat +0 -2
  495. pro/vendor/phpqrcode/cache/mask_7/mask_125_7.dat +0 -0
  496. pro/vendor/phpqrcode/cache/mask_7/mask_129_7.dat +0 -0
  497. pro/vendor/phpqrcode/cache/mask_7/mask_133_7.dat +0 -0
  498. pro/vendor/phpqrcode/cache/mask_7/mask_137_7.dat +0 -5
  499. pro/vendor/phpqrcode/cache/mask_7/mask_141_7.dat +0 -1
  500. pro/vendor/phpqrcode/cache/mask_7/mask_145_7.dat +0 -2
  501. pro/vendor/phpqrcode/cache/mask_7/mask_149_7.dat +0 -1
  502. pro/vendor/phpqrcode/cache/mask_7/mask_153_7.dat +0 -2
  503. pro/vendor/phpqrcode/cache/mask_7/mask_157_7.dat +0 -2
  504. pro/vendor/phpqrcode/cache/mask_7/mask_161_7.dat +0 -1
  505. pro/vendor/phpqrcode/cache/mask_7/mask_165_7.dat +0 -1
  506. pro/vendor/phpqrcode/cache/mask_7/mask_169_7.dat +0 -0
  507. pro/vendor/phpqrcode/cache/mask_7/mask_173_7.dat +0 -1
  508. pro/vendor/phpqrcode/cache/mask_7/mask_177_7.dat +0 -0
  509. pro/vendor/phpqrcode/cache/mask_7/mask_21_7.dat +0 -4
  510. pro/vendor/phpqrcode/cache/mask_7/mask_25_7.dat +0 -1
  511. pro/vendor/phpqrcode/cache/mask_7/mask_29_7.dat +0 -2
  512. pro/vendor/phpqrcode/cache/mask_7/mask_33_7.dat +0 -1
  513. pro/vendor/phpqrcode/cache/mask_7/mask_37_7.dat +0 -0
  514. pro/vendor/phpqrcode/cache/mask_7/mask_41_7.dat +0 -1
  515. pro/vendor/phpqrcode/cache/mask_7/mask_45_7.dat +0 -0
  516. pro/vendor/phpqrcode/cache/mask_7/mask_49_7.dat +0 -1
  517. pro/vendor/phpqrcode/cache/mask_7/mask_53_7.dat +0 -1
  518. pro/vendor/phpqrcode/cache/mask_7/mask_57_7.dat +0 -1
  519. pro/vendor/phpqrcode/cache/mask_7/mask_61_7.dat +0 -2
  520. pro/vendor/phpqrcode/cache/mask_7/mask_65_7.dat +0 -1
  521. pro/vendor/phpqrcode/cache/mask_7/mask_69_7.dat +0 -0
  522. pro/vendor/phpqrcode/cache/mask_7/mask_73_7.dat +0 -0
  523. pro/vendor/phpqrcode/cache/mask_7/mask_77_7.dat +0 -0
  524. pro/vendor/phpqrcode/cache/mask_7/mask_81_7.dat +0 -1
  525. pro/vendor/phpqrcode/cache/mask_7/mask_85_7.dat +0 -0
  526. pro/vendor/phpqrcode/cache/mask_7/mask_89_7.dat +0 -0
  527. pro/vendor/phpqrcode/cache/mask_7/mask_93_7.dat +0 -0
  528. pro/vendor/phpqrcode/cache/mask_7/mask_97_7.dat +0 -2
  529. pro/vendor/phpqrcode/index.php +0 -94
  530. pro/vendor/phpqrcode/phpqrcode.php +0 -3609
  531. pro/vendor/phpqrcode/qrbitstream.php +0 -180
  532. pro/vendor/phpqrcode/qrconfig.php +0 -17
  533. pro/vendor/phpqrcode/qrconst.php +0 -54
  534. pro/vendor/phpqrcode/qrencode.php +0 -569
  535. pro/vendor/phpqrcode/qrimage.php +0 -107
  536. pro/vendor/phpqrcode/qrinput.php +0 -729
  537. pro/vendor/phpqrcode/qrlib.php +0 -44
  538. pro/vendor/phpqrcode/qrmask.php +0 -328
  539. pro/vendor/phpqrcode/qrrscode.php +0 -210
  540. pro/vendor/phpqrcode/qrspec.php +0 -592
  541. pro/vendor/phpqrcode/qrsplit.php +0 -213
.distignore DELETED
@@ -1,18 +0,0 @@
1
- .gitignore
2
- .distignore
3
- /pro
4
- /assets
5
- /tests
6
- /node_modules
7
- ^test.*
8
- ^phpunit.*
9
- ^README
10
- ^script/.*
11
- ^script
12
- ^composer.json
13
- ^phpcs.ruleset.xml
14
- ^\.travis.yml
15
- ^\.phpcs.xml.dist
16
- ^webpack.config.js
17
- ^package.*
18
- ^phpunit.*
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
.github/workflows/main.yml DELETED
@@ -1,17 +0,0 @@
1
- name: Deploy to WordPress.org
2
- on:
3
- push:
4
- tags:
5
- - "*"
6
- jobs:
7
- tag:
8
- name: New tag
9
- runs-on: ubuntu-latest
10
- steps:
11
- - uses: actions/checkout@master
12
- - name: WordPress Plugin Deploy
13
- uses: 10up/action-wordpress-plugin-deploy@stable
14
- env:
15
- SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
16
- SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
17
- SLUG: pretty-link # optional, remove if GitHub repo name matches SVN slug, including capitalization
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
.gitignore DELETED
@@ -1,2 +0,0 @@
1
- script/
2
- node_modules/
 
 
.phpcs.xml.dist DELETED
@@ -1,49 +0,0 @@
1
- <?xml version="1.0"?>
2
- <ruleset name="WordPress Coding Standards based custom ruleset for your plugin">
3
- <description>Generally-applicable sniffs for WordPress plugins.</description>
4
-
5
- <!-- What to scan -->
6
- <file>.</file>
7
- <exclude-pattern>/vendor/</exclude-pattern>
8
- <exclude-pattern>/node_modules/</exclude-pattern>
9
-
10
- <!-- How to scan -->
11
- <!-- Usage instructions: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Usage -->
12
- <!-- Annotated ruleset: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-ruleset.xml -->
13
- <arg value="sp"/> <!-- Show sniff and progress -->
14
- <arg name="basepath" value="./"/><!-- Strip the file paths down to the relevant bit -->
15
- <arg name="colors"/>
16
- <arg name="extensions" value="php"/>
17
- <arg name="parallel" value="8"/><!-- Enables parallel processing when available for faster results. -->
18
-
19
- <!-- Rules: Check PHP version compatibility -->
20
- <!-- https://github.com/PHPCompatibility/PHPCompatibility#sniffing-your-code-for-compatibility-with-specific-php-versions -->
21
- <config name="testVersion" value="5.3-"/>
22
- <!-- https://github.com/PHPCompatibility/PHPCompatibilityWP -->
23
- <rule ref="PHPCompatibilityWP"/>
24
-
25
- <!-- Rules: WordPress Coding Standards -->
26
- <!-- https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards -->
27
- <!-- https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/wiki/Customizable-sniff-properties -->
28
- <config name="minimum_supported_wp_version" value="4.6"/>
29
- <rule ref="WordPress">
30
- <exclude name="WordPress.VIP"/>
31
- </rule>
32
- <rule ref="WordPress.NamingConventions.PrefixAllGlobals">
33
- <properties>
34
- <!-- Value: replace the function, class, and variable prefixes used. Separate multiple prefixes with a comma. -->
35
- <property name="prefixes" type="array" value="my-plugin"/>
36
- </properties>
37
- </rule>
38
- <rule ref="WordPress.WP.I18n">
39
- <properties>
40
- <!-- Value: replace the text domain used. -->
41
- <property name="text_domain" type="array" value="my-plugin"/>
42
- </properties>
43
- </rule>
44
- <rule ref="WordPress.WhiteSpace.ControlStructureSpacing">
45
- <properties>
46
- <property name="blank_line_check" value="true"/>
47
- </properties>
48
- </rule>
49
- </ruleset>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
.travis.yml DELETED
@@ -1,67 +0,0 @@
1
- sudo: false
2
- dist: trusty
3
-
4
- language: php
5
-
6
- notifications:
7
- email:
8
- on_success: never
9
- on_failure: change
10
-
11
- branches:
12
- only:
13
- - master
14
-
15
- cache:
16
- directories:
17
- - $HOME/.composer/cache
18
-
19
- matrix:
20
- include:
21
- - php: 7.2
22
- env: WP_VERSION=latest
23
- - php: 7.1
24
- env: WP_VERSION=latest
25
- - php: 7.0
26
- env: WP_VERSION=latest
27
- - php: 5.6
28
- env: WP_VERSION=4.9
29
- - php: 5.6
30
- env: WP_VERSION=latest
31
- - php: 5.6
32
- env: WP_VERSION=trunk
33
- - php: 5.6
34
- env: WP_TRAVISCI=phpcs
35
- - php: 5.3
36
- env: WP_VERSION=latest
37
- dist: precise
38
-
39
- before_script:
40
- - export PATH="$HOME/.composer/vendor/bin:$PATH"
41
- - |
42
- if [ -f ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini ]; then
43
- phpenv config-rm xdebug.ini
44
- else
45
- echo "xdebug.ini does not exist"
46
- fi
47
- - |
48
- if [[ ! -z "$WP_VERSION" ]] ; then
49
- bash bin/install-wp-tests.sh wordpress_test root '' localhost $WP_VERSION
50
- composer global require "phpunit/phpunit=4.8.*|5.7.*"
51
- fi
52
- - |
53
- if [[ "$WP_TRAVISCI" == "phpcs" ]] ; then
54
- composer global require wp-coding-standards/wpcs
55
- phpcs --config-set installed_paths $HOME/.composer/vendor/wp-coding-standards/wpcs
56
- fi
57
-
58
- script:
59
- - |
60
- if [[ ! -z "$WP_VERSION" ]] ; then
61
- phpunit
62
- WP_MULTISITE=1 phpunit
63
- fi
64
- - |
65
- if [[ "$WP_TRAVISCI" == "phpcs" ]] ; then
66
- phpcs
67
- fi
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
.wordpress-org/banner-1544x500.png DELETED
Binary file
.wordpress-org/banner-772x250.png DELETED
Binary file
.wordpress-org/icon-128x128.png DELETED
Binary file
.wordpress-org/icon-256x256.png DELETED
Binary file
README DELETED
@@ -1,5 +0,0 @@
1
- To install i18n pre-commit hook issue this command:
2
-
3
- ```
4
- ln -s ../../script/mki18n .git/hooks/pre-commit
5
- ```
 
 
 
 
 
i18n/pretty-link.pot CHANGED
@@ -2,14 +2,14 @@
2
  # This file is distributed under the same license as the Pretty Links plugin.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: Pretty Links 3.2.2\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/pretty-link\n"
7
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
8
  "Language-Team: LANGUAGE <LL@li.org>\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
- "POT-Creation-Date: 2021-03-25T16:54:09+00:00\n"
13
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14
  "X-Generator: WP-CLI 2.4.0\n"
15
  "X-Domain: pretty-link\n"
2
  # This file is distributed under the same license as the Pretty Links plugin.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: Pretty Links 3.2.3\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/pretty-link\n"
7
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
8
  "Language-Team: LANGUAGE <LL@li.org>\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
+ "POT-Creation-Date: 2021-03-25T17:28:19+00:00\n"
13
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14
  "X-Generator: WP-CLI 2.4.0\n"
15
  "X-Domain: pretty-link\n"
images/not_tracking.png CHANGED
File without changes
package.json DELETED
@@ -1,37 +0,0 @@
1
- {
2
- "name": "pretty-link",
3
- "version": "2.1.9",
4
- "description": "Shrink, track and share any URL on the Internet from your WordPress website!",
5
- "main": "index.js",
6
- "directories": {
7
- "test": "tests"
8
- },
9
- "scripts": {
10
- "build": "wp-scripts build",
11
- "start": "wp-scripts start"
12
- },
13
- "repository": {
14
- "type": "git",
15
- "url": "git+https://github.com/caseproof/pretty-link.git"
16
- },
17
- "keywords": [],
18
- "author": "Caseproof, LLC",
19
- "license": "GPLv2",
20
- "devDependencies": {
21
- "@wordpress/scripts": "^3.2.1",
22
- "classnames": "^2.2.6",
23
- "css-loader": "^2.1.1",
24
- "node-sass": "^4.12.0",
25
- "postcss-loader": "^3.0.0",
26
- "sass-loader": "^7.1.0",
27
- "style-loader": "^0.23.1"
28
- },
29
- "bugs": {
30
- "url": "https://github.com/caseproof/pretty-link/issues"
31
- },
32
- "homepage": "https://github.com/caseproof/pretty-link#readme",
33
- "dependencies": {
34
- "dom-scroll-into-view": "^1.2.1",
35
- "lodash": "^4.17.11"
36
- }
37
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
phpunit.xml.dist DELETED
@@ -1,15 +0,0 @@
1
- <?xml version="1.0"?>
2
- <phpunit
3
- bootstrap="tests/bootstrap.php"
4
- backupGlobals="false"
5
- colors="true"
6
- convertErrorsToExceptions="true"
7
- convertNoticesToExceptions="true"
8
- convertWarningsToExceptions="true"
9
- >
10
- <testsuites>
11
- <testsuite name="tests">
12
- <directory prefix="Test" suffix=".php">./tests/</directory>
13
- </testsuite>
14
- </testsuites>
15
- </phpunit>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pretty-link.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Pretty Links
4
  Plugin URI: https://prettylinks.com/pl/plugin-uri
5
  Description: Shrink, track and share any URL using your website and brand!
6
- Version: 3.2.2
7
  Author: Pretty Links
8
  Author URI: http://prettylinks.com
9
  Text Domain: pretty-link
3
  Plugin Name: Pretty Links
4
  Plugin URI: https://prettylinks.com/pl/plugin-uri
5
  Description: Shrink, track and share any URL using your website and brand!
6
+ Version: 3.2.3
7
  Author: Pretty Links
8
  Author URI: http://prettylinks.com
9
  Text Domain: pretty-link
pro/README DELETED
File without changes
pro/app/controllers/PlpAppController.php DELETED
@@ -1,179 +0,0 @@
1
- <?php if(!defined('ABSPATH')) { die('You are not allowed to call this page directly.'); }
2
-
3
- class PlpAppController extends PrliBaseController {
4
- public function load_hooks() {
5
- add_action('admin_menu', array($this, 'admin_menu'));
6
- add_action('prli_load_admin_scripts', array($this, 'enqueue_admin_scripts'), 10, 2);
7
- add_action('init', array($this,'route_standalone_request'));
8
- }
9
-
10
- public function admin_menu() {
11
- global $plp_options;
12
-
13
- $role = 'administrator';
14
-
15
- if(isset($plp_options->min_role)) {
16
- $role = $plp_options->min_role;
17
- }
18
-
19
- do_action('plp_admin_menu', $role);
20
- }
21
-
22
- public function enqueue_admin_scripts($hook, $page_vars) {
23
- global $prli_link, $prli_options, $prli_link_meta, $current_screen;
24
-
25
- extract($page_vars);
26
-
27
- if( preg_match('/_page_plp-reports$/', $hook) ) {
28
- wp_enqueue_style('plp-reports', PLP_CSS_URL.'/admin_reports.css', null, PRLI_VERSION);
29
- wp_register_script('plp-google-vis', 'https://www.gstatic.com/charts/loader.js', array(), PRLI_VERSION);
30
-
31
- // TODO: We actually want localize script for the data and separate js files for these
32
- if(isset($_GET['action']) && $_GET['action'] == 'display-custom-report') {
33
- global $plp_report;
34
- wp_enqueue_script('plp-draw-report', PLP_JS_URL.'/admin_draw_report.js', array('jquery','plp-google-vis'), PRLI_VERSION);
35
- wp_localize_script('plp-draw-report', 'PlpReport', $plp_report->custom_report_vars());
36
- }
37
- else if(isset($_GET['action']) && $_GET['action'] == 'display-split-test-report') {
38
- global $plp_report;
39
- wp_enqueue_script('plp-draw-report', PLP_JS_URL.'/admin_draw_report.js', array('jquery','plp-google-vis'), PRLI_VERSION);
40
- wp_localize_script('plp-draw-report', 'PlpReport', $plp_report->split_test_report_vars());
41
- }
42
- else {
43
- wp_enqueue_script('plp-reports', PLP_JS_URL.'/admin_reports.js', array('jquery'), PRLI_VERSION);
44
- }
45
- }
46
-
47
- if( preg_match('/_page_pretty-link-options$/', $hook) ) {
48
- wp_register_style('plp-spectrum', PLP_VENDOR_URL.'/spectrum/spectrum.min.css', array(), '1.8.0');
49
- wp_register_script('plp-spectrum', PLP_VENDOR_URL.'/spectrum/spectrum.min.js', array(), '1.8.0', true);
50
-
51
- wp_enqueue_style('plp-options', PLP_CSS_URL.'/admin_options.css', array('pl-options','plp-spectrum'), PRLI_VERSION);
52
- wp_enqueue_script('plp-options', PLP_JS_URL.'/admin_options.js', array('jquery','pl-options','plp-spectrum'), PRLI_VERSION);
53
- }
54
-
55
- if( preg_match('/_page_pretty-link-tools$/', $hook) ) {
56
- wp_enqueue_style('plp-bookmarklet', PLP_CSS_URL.'/admin_bookmarklet.css', null, PRLI_VERSION);
57
- wp_enqueue_script('plp-bookmarklet', PLP_JS_URL.'/admin_bookmarklet.js', array('jquery'), PRLI_VERSION);
58
- wp_localize_script('plp-bookmarklet', 'PlpBookmarklet', array( 'url' => site_url("index.php?action=prli_bookmarklet&k={$prli_options->bookmarklet_auth}") ));
59
- }
60
-
61
- if( in_array( $hook, array('post-new.php','post.php') ) ) {
62
- global $post;
63
- wp_enqueue_style('plp-post', PLP_CSS_URL.'/admin_post.css', null, PRLI_VERSION);
64
- wp_enqueue_script('plp-post', PLP_JS_URL.'/admin_post.js', array('jquery'), PRLI_VERSION);
65
- wp_localize_script('plp-post', 'PlpPost', array( 'post_id' => $post->ID ));
66
- }
67
-
68
- if( $is_link_edit_page || $is_link_new_page ) {
69
- global $post;
70
-
71
- wp_enqueue_style('jquery-ui-timepicker-addon', PLP_CSS_URL.'/jquery-ui-timepicker-addon.css', array('pl-ui-smoothness'), PRLI_VERSION);
72
-
73
- wp_register_script('plp-timepicker-js', PLP_JS_URL.'/jquery-ui-timepicker-addon.js', array('jquery-ui-datepicker'));
74
- wp_register_script('plp-datepicker', PLP_JS_URL.'/date_picker.js', array('plp-timepicker-js'), PRLI_VERSION);
75
-
76
- ob_start();
77
- PlpLinksHelper::rotation_row('',0);
78
- $rotation_row_html = ob_get_clean();
79
-
80
- ob_start();
81
- PlpLinksHelper::geo_row();
82
- $geo_row_html = ob_get_clean();
83
-
84
- ob_start();
85
- PlpLinksHelper::tech_row();
86
- $tech_row_html = ob_get_clean();
87
-
88
- ob_start();
89
- PlpLinksHelper::time_row();
90
- $time_row_html = ob_get_clean();
91
-
92
- $link_id = 0;
93
- if(isset($post) && isset($post->ID)) {
94
- $link_id = $prli_link->get_link_from_cpt($post->ID);
95
- }
96
-
97
- if(!empty($link_id) &&
98
- empty($_POST['prli_geo_url']) &&
99
- empty($_POST['prli_geo_countries'])) {
100
- $geo_url = $prli_link_meta->get_link_meta($link_id, 'geo_url');
101
- $geo_countries = $prli_link_meta->get_link_meta($link_id, 'geo_countries');
102
- }
103
- else {
104
- $geo_url = isset($_POST['prli_geo_url']) && is_array($_POST['prli_geo_url']) ? array_map('esc_url_raw', array_map('trim', wp_unslash($_POST['prli_geo_url']))) : array();
105
- $geo_countries = isset($_POST['prli_geo_countries']) && is_array($_POST['prli_geo_countries']) ? array_map('sanitize_text_field', wp_unslash($_POST['prli_geo_countries'])) : array();
106
- }
107
-
108
- if(!empty($link_id) && empty($_POST['prli_tech_url']) &&
109
- empty($_POST['prli_tech_device']) &&
110
- empty($_POST['prli_tech_os']) &&
111
- empty($_POST['prli_tech_browser'])) {
112
- $tech_url = $prli_link_meta->get_link_meta($link_id, 'tech_url');
113
- $tech_device = $prli_link_meta->get_link_meta($link_id, 'tech_device');
114
- $tech_os = $prli_link_meta->get_link_meta($link_id, 'tech_os');
115
- $tech_browser = $prli_link_meta->get_link_meta($link_id, 'tech_browser');
116
- }
117
- else {
118
- $tech_url = isset($_POST['prli_tech_url']) && is_array($_POST['prli_tech_url']) ? array_map('esc_url_raw', array_map('trim', wp_unslash($_POST['prli_tech_url']))) : array();
119
- $tech_device = isset($_POST['prli_tech_device']) && is_array($_POST['prli_tech_device']) ? array_map('sanitize_key', wp_unslash($_POST['prli_tech_device'])) : array();
120
- $tech_os = isset($_POST['prli_tech_os']) && is_array($_POST['prli_tech_os']) ? array_map('sanitize_key', wp_unslash($_POST['prli_tech_os'])) : array();
121
- $tech_browser = isset($_POST['prli_tech_browser']) && is_array($_POST['prli_tech_browser']) ? array_map('sanitize_key', wp_unslash($_POST['prli_tech_browser'])) : array();
122
- }
123
-
124
- if(!empty($link_id) && empty($_POST['prli_time_url']) &&
125
- empty($_POST['prli_time_start']) &&
126
- empty($_POST['prli_time_end'])) {
127
- $time_url = $prli_link_meta->get_link_meta($link_id, 'time_url');
128
- $time_start = $prli_link_meta->get_link_meta($link_id, 'time_start');
129
- $time_end = $prli_link_meta->get_link_meta($link_id, 'time_end');
130
- }
131
- else {
132
- $time_url = isset($_POST['prli_time_url']) && is_array($_POST['prli_time_url']) ? array_map('esc_url_raw', array_map('trim', wp_unslash($_POST['prli_time_url']))) : array();
133
- $time_start = isset($_POST['prli_time_start']) && is_array($_POST['prli_time_start']) ? array_map('sanitize_text_field', wp_unslash($_POST['prli_time_start'])) : array();
134
- $time_end = isset($_POST['prli_time_end']) && is_array($_POST['prli_time_end']) ? array_map('sanitize_text_field', wp_unslash($_POST['prli_time_end'])) : array();
135
- }
136
-
137
- wp_enqueue_script('plp-admin-links', PLP_JS_URL.'/admin_links.js', array('jquery','prli-admin-links','suggest','plp-datepicker'), PRLI_VERSION);
138
- wp_localize_script('plp-admin-links', 'PlpLink', array(
139
- 'l10n_print_after' => 'PlpLink = ' . wp_json_encode(compact('rotation_row_html','geo_row_html','geo_url','geo_countries','tech_row_html','tech_url','tech_device','tech_os','tech_browser','time_row_html','time_url','time_start','time_end'))
140
- ));
141
- }
142
- }
143
-
144
- public function route_standalone_request() {
145
- $plugin = (isset($_REQUEST['plugin'])?sanitize_key(stripslashes($_REQUEST['plugin'])):'');
146
- $controller = (isset($_REQUEST['controller'])?sanitize_key(stripslashes($_REQUEST['controller'])):'');
147
- $action = (isset($_REQUEST['action'])?sanitize_key(stripslashes($_REQUEST['action'])):'');
148
-
149
- if( $plugin && $plugin=='pretty-link-pro' && $controller && $action ) {
150
- if($controller && $controller=='links') {
151
- if($action && $action=='prettybar') {
152
- PlpPrettyBarHelper::render_prettybar(sanitize_text_field(stripslashes($_REQUEST['s'])));
153
- }
154
- }
155
- exit;
156
- }
157
- else if( $action == 'prli_endpoint_url' ) {
158
- global $prli_options;
159
-
160
- $key = sanitize_key(stripslashes($_REQUEST['k']));
161
- $url = esc_url_raw(trim(stripslashes($_REQUEST['url'])));
162
-
163
- if($key == $prli_options->bookmarklet_auth) {
164
- $pretty_link_id = prli_create_pretty_link( $url );
165
- if( $pretty_link = prli_get_pretty_link_url( $pretty_link_id ) ) {
166
- echo esc_url($pretty_link);
167
- }
168
- else {
169
- esc_html_e('ERROR: Your Pretty Link was unable to be created', 'pretty-link');
170
- }
171
- }
172
- else {
173
- esc_html_e('Unauthorized', 'pretty-link');
174
- }
175
-
176
- exit;
177
- }
178
- }
179
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/app/controllers/PlpDbController.php DELETED
@@ -1,282 +0,0 @@
1
- <?php if(!defined('ABSPATH')) { die('You are not allowed to call this page directly.'); }
2
-
3
- class PlpDbController extends PrliBaseController {
4
- public function load_hooks() {
5
- add_action('init', array($this,'install'), 11);
6
- }
7
-
8
- public function install() {
9
- if($this->should_install_pro_db()) {
10
- // For some reason, install gets called multiple times so we're basically
11
- // adding a mutex here (ala a transient) to ensure this only gets run once
12
- $is_installing = get_transient('plp_installing');
13
- if($is_installing) {
14
- return;
15
- }
16
- else {
17
- // 30 minutes
18
- set_transient('plp_installing', 1, 60*30);
19
- }
20
-
21
- @ignore_user_abort(true);
22
- @set_time_limit(0);
23
- $this->install_pro_db();
24
-
25
- delete_transient('plp_installing');
26
- }
27
- }
28
-
29
- public function should_install_pro_db() {
30
- global $plp_db_version;
31
- $old_pro_db_version = get_option('prlipro_db_version');
32
-
33
- if($plp_db_version != $old_pro_db_version) { return true; }
34
-
35
- return false;
36
- }
37
-
38
- public function install_pro_db() {
39
- global $wpdb, $plp_db_version;
40
-
41
- $upgrade_path = ABSPATH . 'wp-admin/includes/upgrade.php';
42
- require_once($upgrade_path);
43
-
44
- // Pretty Links Pro Tables
45
- $keywords_table = "{$wpdb->prefix}prli_keywords";
46
- $post_keywords_table = "{$wpdb->prefix}prli_post_keywords";
47
- $post_urls_table = "{$wpdb->prefix}prli_post_urls";
48
- $reports_table = "{$wpdb->prefix}prli_reports";
49
- $report_links_table = "{$wpdb->prefix}prli_report_links";
50
- $link_rotations_table = "{$wpdb->prefix}prli_link_rotations";
51
- $clicks_rotations_table = "{$wpdb->prefix}prli_clicks_rotations";
52
-
53
- // This was introduced in WordPress 3.5
54
- // $char_col = $wpdb->get_charset_collate(); //This doesn't work for most non english setups
55
- $char_col = "";
56
- $collation = $wpdb->get_row("SHOW FULL COLUMNS FROM {$wpdb->posts} WHERE field = 'post_content'");
57
-
58
- if(isset($collation->Collation)) {
59
- $charset = explode('_', $collation->Collation);
60
-
61
- if(is_array($charset) && count($charset) > 1) {
62
- $charset = $charset[0]; //Get the charset from the collation
63
- $char_col = "DEFAULT CHARACTER SET {$charset} COLLATE {$collation->Collation}";
64
- }
65
- }
66
-
67
- //Fine we'll try it your way this time
68
- if(empty($char_col)) { $char_col = $wpdb->get_charset_collate(); }
69
-
70
- //Fix for large indexes
71
- //$wpdb->query("SET GLOBAL innodb_large_prefix=1");
72
-
73
- /* Create/Upgrade Keywords Table */
74
- $sql = "
75
- CREATE TABLE {$keywords_table} (
76
- id int(11) NOT NULL auto_increment,
77
- text varchar(255) NOT NULL,
78
- link_id int(11) NOT NULL,
79
- created_at datetime NOT NULL,
80
- PRIMARY KEY (id),
81
- KEY link_id (link_id),
82
- KEY text (text(191))
83
- ) {$char_col};
84
- ";
85
-
86
- dbDelta($sql);
87
-
88
- /* Create/Upgrade Keywords Table */
89
- $sql = "
90
- CREATE TABLE {$post_keywords_table} (
91
- id int(11) NOT NULL auto_increment,
92
- keyword_id int(11) NOT NULL,
93
- post_id int(11) NOT NULL,
94
- PRIMARY KEY (id),
95
- KEY keyword_id (keyword_id),
96
- KEY post_id (post_id),
97
- UNIQUE KEY post_keyword_index (keyword_id,post_id)
98
- ) {$char_col};
99
- ";
100
-
101
- dbDelta($sql);
102
-
103
- /* Create/Upgrade URLs Table */
104
- $sql = "
105
- CREATE TABLE {$post_urls_table} (
106
- id int(11) NOT NULL auto_increment,
107
- url_id int(11) NOT NULL,
108
- post_id int(11) NOT NULL,
109
- PRIMARY KEY (id),
110
- KEY url_id (url_id),
111
- KEY post_id (post_id),
112
- UNIQUE KEY post_url_index (url_id,post_id)
113
- ) {$char_col};
114
- ";
115
-
116
- dbDelta($sql);
117
-
118
- /* Create/Upgrade Reports Table */
119
- $sql = "
120
- CREATE TABLE {$reports_table} (
121
- id int(11) NOT NULL auto_increment,
122
- name varchar(255) NOT NULL,
123
- goal_link_id int(11) default NULL,
124
- created_at datetime NOT NULL,
125
- PRIMARY KEY (id),
126
- KEY goal_link_id (goal_link_id),
127
- KEY name (name(191))
128
- ) {$char_col};
129
- ";
130
-
131
- dbDelta($sql);
132
-
133
- /* Create/Upgrade Reports Table */
134
- $sql = "
135
- CREATE TABLE {$report_links_table} (
136
- id int(11) NOT NULL auto_increment,
137
- report_id int(11) NOT NULL,
138
- link_id int(11) NOT NULL,
139
- created_at datetime NOT NULL,
140
- PRIMARY KEY (id),
141
- KEY report_id (report_id),
142
- KEY link_id (link_id)
143
- ) {$char_col};
144
- ";
145
-
146
- dbDelta($sql);
147
-
148
- /* Create/Upgrade Link Rotations Table */
149
- $sql = "
150
- CREATE TABLE {$link_rotations_table} (
151
- id int(11) NOT NULL auto_increment,
152
- url varchar(255) default NULL,
153
- weight int(11) default 0,
154
- r_index int(11) default 0,
155
- link_id int(11) NOT NULL,
156
- created_at datetime NOT NULL,
157
- PRIMARY KEY (id),
158
- KEY link_id (link_id),
159
- KEY url (url(191)),
160
- KEY weight (weight),
161
- KEY r_index (r_index)
162
- ) {$char_col};
163
- ";
164
-
165
- dbDelta($sql);
166
-
167
- /* Create/Upgrade Clicks / Rotations Table */
168
- $sql = "
169
- CREATE TABLE {$clicks_rotations_table} (
170
- id int(11) NOT NULL auto_increment,
171
- click_id int(11) NOT NULL,
172
- link_id int(11) NOT NULL,
173
- url text NOT NULL,
174
- PRIMARY KEY (id),
175
- KEY click_id (click_id),
176
- KEY link_id (link_id)
177
- ) {$char_col};
178
- ";
179
-
180
- dbDelta($sql);
181
-
182
- $this->migrate_after_db_upgrade($plp_db_version);
183
-
184
- /***** SAVE DB VERSION *****/
185
- update_option('prlipro_db_version', $plp_db_version);
186
- wp_cache_delete('alloptions', 'options');
187
- }
188
-
189
- public function migrate_after_db_upgrade($db_version) {
190
- global $wpdb;
191
-
192
- $prli_db = new PrliDb();
193
-
194
- $group_table = "{$wpdb->prefix}prli_groups";
195
- if(get_option('prlipro_db_version') <= 10 && $prli_db->table_exists($group_table)) {
196
- $ctax = PlpLinkCategoriesController::$ctax;
197
- $group_category_map = array();
198
-
199
- $q = "SELECT * FROM {$group_table}";
200
- $groups = $wpdb->get_results($q);
201
-
202
- // for each group
203
- foreach($groups as $group) {
204
-
205
- // Skip this group if term already exists
206
- if (term_exists($group->name, $ctax)) {
207
- continue;
208
- }
209
-
210
- // - Add group as category
211
- $term = wp_insert_term(
212
- $group->name,
213
- $ctax,
214
- array( 'description' => $group->description )
215
- );
216
-
217
- if(is_wp_error($term)) {
218
- continue;
219
- }
220
-
221
- // - Save the group to category mapping to migrate Auto-Create groups
222
- $group_category_map[$group->id] = $term['term_id'];
223
-
224
- $q = $wpdb->prepare("SELECT link_cpt_id FROM {$wpdb->prefix}prli_links WHERE group_id=%d", $group->id);
225
- $link_cpt_ids = $wpdb->get_col($q);
226
-
227
- // - Add links associated with group to new category
228
- foreach($link_cpt_ids as $link_cpt_id) {
229
- $wpdb->insert(
230
- $wpdb->term_relationships,
231
- array(
232
- 'object_id' => $link_cpt_id,
233
- 'term_taxonomy_id' => $term['term_taxonomy_id']
234
- ),
235
- array( '%d', '%d' )
236
- );
237
- }
238
-
239
- // Update the term_taxonomy count
240
- $q = $wpdb->prepare("
241
- UPDATE {$wpdb->term_taxonomy}
242
- SET `count`=%d
243
- WHERE `term_taxonomy_id`=%d
244
- ",
245
- count($link_cpt_ids),
246
- $term['term_taxonomy_id']
247
- );
248
-
249
- $wpdb->query($q);
250
- }
251
-
252
- // - Migrate Auto-Create groups to category
253
- global $plp_options;
254
-
255
- if (isset($plp_options->posts_group) && !empty($plp_options->posts_group) && isset($group_category_map[$plp_options->posts_group])) {
256
- $plp_options->posts_category = $group_category_map[$plp_options->posts_group];
257
- }
258
-
259
- if (isset($plp_options->pages_group) && !empty($plp_options->pages_group) && isset($group_category_map[$plp_options->pages_group])) {
260
- $plp_options->pages_category = $group_category_map[$plp_options->pages_group];
261
- }
262
-
263
- // - CPTs
264
- if (is_array($plp_options->autocreate)) {
265
- foreach ($plp_options->autocreate as $post_type => $options) {
266
- if (isset($options['group'])) {
267
- if (is_numeric($options['group']) && isset($group_category_map[$options['group']])) {
268
- $category = $group_category_map[$options['group']];
269
- } else {
270
- $category = '';
271
- }
272
-
273
- $plp_options->autocreate[$post_type]['category'] = $category;
274
- }
275
- }
276
- }
277
-
278
- $plp_options->store();
279
- }
280
- }
281
- }
282
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/app/controllers/PlpImportExportController.php DELETED
@@ -1,378 +0,0 @@
1
- <?php if(!defined('ABSPATH')) { die('You are not allowed to call this page directly.'); }
2
-
3
- class PlpImportExportController extends PrliBaseController {
4
- public function load_hooks() {
5
- add_action('wp_ajax_plp-export-links', array($this, 'export'));
6
- add_action('plp_admin_menu', array($this, 'admin_menu'), 10, 1);
7
- }
8
-
9
- public function admin_menu($role) {
10
- $pl_link_cpt = PrliLink::$cpt;
11
-
12
- add_submenu_page(
13
- "edit.php?post_type={$pl_link_cpt}",
14
- esc_html__('Pretty Links Pro | Import / Export', 'pretty-link'),
15
- esc_html__('Import / Export', 'pretty-link'),
16
- $role, 'plp-import-export',
17
- array($this, 'route')
18
- );
19
- }
20
-
21
- public function route() {
22
- if(isset($_REQUEST['action']) && $_REQUEST['action'] == 'import') {
23
- $this->import();
24
- }
25
- else {
26
- require_once(PLP_VIEWS_PATH.'/import-export/form.php');
27
- }
28
- }
29
-
30
- public function import() {
31
- global $prli_link, $prli_link_meta, $plp_keyword, $plp_options, $prli_error_messages;
32
-
33
- if(empty($_FILES['importedfile']['tmp_name']) || !is_string($_FILES['importedfile']['tmp_name'])) {
34
- $error = __('Import file not found.', 'pretty-link');
35
- require_once PLP_VIEWS_PATH . '/import-export/import-error.php';
36
- return;
37
- }
38
-
39
- // Helps with CSV's that don't use DOS style line endings
40
- @ini_set("auto_detect_line_endings", true);
41
-
42
- $filename = $_FILES['importedfile']['tmp_name'];
43
- $headers = array();
44
- $csvdata = array();
45
- $row = -1;
46
- $delimeter = $this->get_file_delimeter($filename);
47
- $handle = fopen($filename, 'r');
48
-
49
- if(!$handle) {
50
- $error = __('Import file could not be opened.', 'pretty-link');
51
- require_once PLP_VIEWS_PATH . '/import-export/import-error.php';
52
- return;
53
- }
54
-
55
- while(($data = fgetcsv($handle, 0, $delimeter)) !== FALSE) {
56
- $num = count($data);
57
- for ($c=0; $c < $num; $c++) {
58
- if($row < 0) {
59
- $headers[] = $data[$c];
60
- }
61
- else if($row >= 0) {
62
- $csvdata[$row][$headers[$c]] = $data[$c];
63
- }
64
- }
65
-
66
- $row++;
67
- }
68
-
69
- fclose($handle);
70
-
71
- $total_row_count = count($csvdata);
72
-
73
- $successful_update_count = 0;
74
- $successful_create_count = 0;
75
- $no_action_taken_count = 0;
76
-
77
- $creation_errors = array();
78
- $update_errors = array();
79
-
80
- foreach($csvdata as $csvrow) {
81
- if(!empty($csvrow['id'])) {
82
- $record = $prli_link->get_link_min($csvrow['id'], ARRAY_A);
83
-
84
- if($record) {
85
- $update_record = false; // assume there aren't any changes
86
- $update_keywords = false; // assume there aren't any changes
87
- foreach($csvrow as $csvkey => $csvval) {
88
- // We'll get to the keywords in a sec for now ignore them
89
- if($csvkey == 'keywords') { continue; }
90
-
91
- // If there's a change, flag for update
92
- if(isset($record[$csvkey]) && $csvval != $record[$csvkey]) {
93
- $update_record = true;
94
- break;
95
- }
96
- }
97
-
98
- // Add Keywords
99
- if( $plp_options->keyword_replacement_is_on ) {
100
- $keyword_str = $plp_keyword->getTextByLinkId( $csvrow['id'] );
101
- $keywords = explode( ",", $keyword_str );
102
- $new_keywords = explode(",",$csvrow['keywords']);
103
-
104
- if(count($keywords) == count($new_keywords)) {
105
- for($i=0;$i < count($keywords);$i++) {
106
- $keywords[$i] = trim($keywords[$i]);
107
- }
108
-
109
- sort($keywords);
110
-
111
- for($i=0;$i < count($new_keywords);$i++) {
112
- $new_keywords[$i] = trim($new_keywords[$i]);
113
- }
114
-
115
- sort($new_keywords);
116
-
117
- for($i=0; $i < count($new_keywords); $i++) {
118
- if($keywords[$i] != $new_keywords[$i]) {
119
- $update_keywords = true;
120
- break;
121
- }
122
- }
123
- }
124
- else {
125
- $update_keywords = true;
126
- }
127
- }
128
-
129
- $record_updated = false;
130
-
131
- if($update_record) {
132
- if( $record_updated =
133
- prli_update_pretty_link(
134
- $csvrow['id'],
135
- trim($csvrow['url']),
136
- $csvrow['slug'],
137
- $csvrow['name'],
138
- (isset($csvrow['description']))?$csvrow['description']:'',
139
- null,// group_id deprecated
140
- $csvrow['track_me'],
141
- $csvrow['nofollow'],
142
- $csvrow['sponsored'],
143
- $csvrow['redirect_type'],
144
- $csvrow['param_forwarding'],
145
- '' /*param_struct*/ ) ) {
146
- $successful_update_count++;
147
- $prli_link_meta->update_link_meta($csvrow['id'], 'delay', (isset($csvrow['delay']))?(int)$csvrow['delay']:0);
148
- $prli_link_meta->update_link_meta($csvrow['id'], 'google_tracking', (isset($csvrow['google_tracking']))?(bool)$csvrow['google_tracking']:false);
149
-
150
- if(isset($csvrow['link_categories'])) {
151
- $this->import_link_categories($csvrow['id'], $csvrow['link_categories']);
152
- }
153
-
154
- if(isset($csvrow['link_tags'])) {
155
- $this->import_link_tags($csvrow['id'], $csvrow['link_tags']);
156
- }
157
- }
158
- else {
159
- $update_errors[] = array('id' => $csvrow['id'], 'errors' => $prli_error_messages);
160
- }
161
- }
162
-
163
- if($update_keywords) {
164
- // We don't want to update the keywords if there was an error
165
- // in the record's update that is, if the record was updated
166
- if($record_updated || !$update_record) {
167
- $plp_keyword->updateLinkKeywords($csvrow['id'], stripslashes($csvrow['keywords']));
168
-
169
- // If the record was never updated then increment the count
170
- if(!$update_record) {
171
- $successful_update_count++;
172
- }
173
- }
174
- }
175
-
176
- if(!$update_record && !$update_keywords) {
177
- $no_action_taken_count++;
178
- }
179
- }
180
- }
181
- else {
182
- if( $newid =
183
- prli_create_pretty_link(
184
- trim($csvrow['url']),
185
- $csvrow['slug'],
186
- $csvrow['name'],
187
- (isset($csvrow['description']))?$csvrow['description']:'',
188
- null, // group_id is deprecated
189
- $csvrow['track_me'],
190
- $csvrow['nofollow'],
191
- $csvrow['sponsored'],
192
- $csvrow['redirect_type'],
193
- $csvrow['param_forwarding'],
194
- '' /*param_struct*/ ) ) {
195
- $successful_create_count++;
196
- $prli_link_meta->update_link_meta($newid, 'delay', (isset($csvrow['delay']))?(int)$csvrow['delay']:0);
197
- $prli_link_meta->update_link_meta($newid, 'google_tracking', (isset($csvrow['google_tracking']))?(bool)$csvrow['google_tracking']:false);
198
-
199
- if(isset($csvrow['link_categories'])) {
200
- $this->import_link_categories($newid, $csvrow['link_categories']);
201
- }
202
-
203
- if(isset($csvrow['link_tags'])) {
204
- $this->import_link_tags($newid, $csvrow['link_tags']);
205
- }
206
-
207
- if( $plp_options->keyword_replacement_is_on && !empty($csvrow['keywords']) ) {
208
- $plp_keyword->updateLinkKeywords($newid, stripslashes($csvrow['keywords']));
209
- }
210
- }
211
- else {
212
- $creation_errors[] = array('slug' => $csvrow['slug'], 'errors' => $prli_error_messages);
213
- }
214
- }
215
-
216
- $prli_error_messages = array();
217
- }
218
-
219
- require_once(PLP_VIEWS_PATH.'/import-export/import.php');
220
- }
221
-
222
- public function export() {
223
- global $wpdb, $prli_link, $prli_link_meta, $plp_options, $plp_keyword;
224
-
225
- if(!PrliUtils::is_authorized()) {
226
- echo "Why you creepin?";
227
- die();
228
- }
229
-
230
- $q = $wpdb->prepare("
231
- SELECT l.id, l.url, l.slug, l.name, l.redirect_type,
232
- l.track_me, l.nofollow, l.sponsored, l.param_forwarding,
233
- gt.meta_value AS google_tracking, d.meta_value AS delay,
234
- l.created_at AS created_at, l.updated_at AS last_updated_at ,
235
- (SELECT GROUP_CONCAT(DISTINCT t.slug ORDER BY t.slug ASC SEPARATOR ',')
236
- FROM {$wpdb->terms} AS t
237
- JOIN {$wpdb->term_taxonomy} AS tt
238
- ON t.term_id = tt.term_id
239
- AND tt.taxonomy = %s
240
- JOIN {$wpdb->term_relationships} AS tr
241
- ON tr.term_taxonomy_id = tt.term_taxonomy_id
242
- WHERE tr.object_id=p.ID) AS link_categories,
243
- (SELECT GROUP_CONCAT(DISTINCT t.slug ORDER BY t.slug ASC SEPARATOR ',')
244
- FROM {$wpdb->terms} AS t
245
- JOIN {$wpdb->term_taxonomy} AS tt
246
- ON t.term_id = tt.term_id
247
- AND tt.taxonomy = %s
248
- JOIN {$wpdb->term_relationships} AS tr
249
- ON tr.term_taxonomy_id = tt.term_taxonomy_id
250
- WHERE tr.object_id=p.ID) AS link_tags
251
- FROM {$prli_link->table_name} AS l
252
- LEFT JOIN {$prli_link_meta->table_name} AS gt
253
- ON l.id = gt.link_id AND gt.meta_key = 'google_tracking'
254
- LEFT JOIN {$prli_link_meta->table_name} AS d
255
- ON l.id = d.link_id AND d.meta_key = 'delay'
256
- JOIN {$wpdb->posts} AS p
257
- ON p.ID = l.link_cpt_id
258
- WHERE l.link_status='enabled'
259
- ",
260
- PlpLinkCategoriesController::$ctax,
261
- PlpLinkTagsController::$ctax
262
- );
263
-
264
- $links = $wpdb->get_results($q, ARRAY_A);
265
-
266
- // Maybe Add Keywords
267
- if( $plp_options->keyword_replacement_is_on ) {
268
- for($i=0; $i < count($links); $i++) {
269
- $link_id = $links[$i]['id'];
270
- $links[$i]['keywords'] = $plp_keyword->getTextByLinkId( $link_id );
271
- }
272
- }
273
-
274
- $filename = date('ymdHis',time()) . '_pretty_links.csv';
275
- header('Content-Type: text/x-csv');
276
- header("Content-Disposition: attachment; filename=\"{$filename}\"");
277
- header('Expires: '.gmdate('D, d M Y H:i:s', mktime(date('H')+2, date('i'), date('s'), date('m'), date('d'), date('Y'))).' GMT');
278
- header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
279
- header('Cache-Control: no-cache, must-revalidate');
280
- header('Pragma: no-cache');
281
-
282
- if($links[0]) {
283
- // print the header
284
- echo '"'.implode('","',array_keys($links[0]))."\"\n";
285
- }
286
-
287
- foreach($links as $link) {
288
- $first = true;
289
- foreach($link as $value) {
290
- if($first) {
291
- echo '"';
292
- $first = false;
293
- }
294
- else {
295
- echo '","';
296
- }
297
-
298
- echo preg_replace('/\"/', '""', PrliClicksHelper::esc_spreadsheet_cell( stripslashes($value) ));
299
- }
300
-
301
- echo "\"\n";
302
- }
303
-
304
- exit;
305
- }
306
-
307
- /** Import link categories into the link. NOTE: This will overwrite link categories so
308
- * whatever categories you have here will be the ONLY categories the link will belong
309
- * to after this runs
310
- *
311
- * @param $link_id The id of the link we want to associate categories with
312
- * @param $link_categories This should be either an array of category slugs or a
313
- * comma-separated values string of categories.
314
- *
315
- * @return Same as https://codex.wordpress.org/Function_Reference/wp_set_object_terms
316
- */
317
- private function import_link_categories($link_id, $link_categories) {
318
- global $prli_link;
319
-
320
- if(!is_array($link_categories)) {
321
- $link_categories = array_map('trim',explode(',',$link_categories));
322
- }
323
-
324
- $link = $prli_link->getOne($link_id);
325
- return wp_set_object_terms( $link->link_cpt_id, $link_categories, PlpLinkCategoriesController::$ctax );
326
- }
327
-
328
- /** Import link tags into the link. NOTE: This will overwrite link tags so
329
- * whatever tags you have here will be the ONLY tags the link will belong
330
- * to after this runs
331
- *
332
- * @param $link_id The id of the link we want to associate tags with
333
- * @param $link_tags This should be either an array of tag slugs or a
334
- * comma-separated values string of tags.
335
- *
336
- * @return Same as https://codex.wordpress.org/Function_Reference/wp_set_object_terms
337
- */
338
- private function import_link_tags($link_id, $link_tags) {
339
- global $prli_link;
340
-
341
- if(!is_array($link_tags)) {
342
- $link_tags = array_map('trim',explode(',',$link_tags));
343
- }
344
-
345
- $link = $prli_link->getOne($link_id);
346
- return wp_set_object_terms( $link->link_cpt_id, $link_tags, PlpLinkTagsController::$ctax );
347
- }
348
-
349
- private function get_file_delimeter($filepath) {
350
- $delimiters = apply_filters(
351
- 'plp-importer-delimiters',
352
- array(
353
- ';' => 0,
354
- ',' => 0,
355
- "\t" => 0,
356
- "|" => 0
357
- ),
358
- $filepath
359
- );
360
-
361
- $handle = fopen($filepath, "r");
362
-
363
- if($handle) {
364
- $first_line = fgets($handle);
365
- fclose($handle);
366
-
367
- foreach ($delimiters as $delimiter => &$count) {
368
- $count = count(str_getcsv($first_line, $delimiter));
369
- }
370
-
371
- if (max($delimiters) > 0) {
372
- return array_search(max($delimiters), $delimiters);
373
- }
374
- }
375
-
376
- return ','; // Default to comma
377
- }
378
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/app/controllers/PlpKeywordsController.php DELETED
@@ -1,513 +0,0 @@
1
- <?php if(!defined('ABSPATH')) { die('You are not allowed to call this page directly.'); }
2
-
3
- class PlpKeywordsController extends PrliBaseController {
4
- public function load_hooks() {
5
- global $plp_options;
6
-
7
- //Go no further if keywords are off
8
- if(!$plp_options->keyword_replacement_is_on) { return; }
9
-
10
- // add_filter('widget_text', array($this, 'replace_keywords'), 999999);
11
- // NOTE - This priority must be lower than social buttons bar
12
- $priority = apply_filters('prli_keywords_content_filter_priority', 999);
13
- add_filter('the_content', array($this, 'replace_keywords'), $priority);
14
-
15
- // BBPress integration
16
- add_filter('bbp_get_reply_content', array($this, 'replace_bbpress_keywords'), 11, 2);
17
-
18
- // WooCommerce short descriptions
19
- add_filter('woocommerce_short_description', array($this, 'replace_keywords'), 11);
20
-
21
- if($plp_options->replace_keywords_in_feeds) {
22
- add_filter('the_content_feed', array($this,'replace_keywords'), 1);
23
- }
24
-
25
- if($plp_options->replace_keywords_in_comments) {
26
- add_filter('comment_text', array($this,'replace_keywords_in_comments'), 1);
27
- }
28
-
29
- if($plp_options->replace_keywords_in_feeds && $plp_options->replace_keywords_in_comments) {
30
- add_filter('comment_text_rss', array($this,'replace_keywords_in_comments'), 1);
31
- }
32
-
33
- add_action('wp_enqueue_scripts', array($this,'keyword_link_style'));
34
-
35
- add_filter('prli_link_column_keywords', array($this,'keyword_link_column_row'), 10, 2);
36
-
37
- add_filter('get_the_excerpt', array($this, 'excerpt_remove_keyword_replacement'), 1);
38
-
39
- $index_keywords = get_option('plp_index_keywords', false);
40
- if($plp_options->keyword_replacement_is_on && $index_keywords) {
41
- add_filter('cron_schedules', array($this,'intervals'));
42
-
43
- $num_builders = 2;
44
- $separation_t = MINUTE_IN_SECONDS;
45
-
46
- for($i=0; $i<$num_builders; $i++) {
47
- if (!wp_next_scheduled("plp_post_build_index{$i}")) {
48
- wp_schedule_event( (time() + ($separation_t * $i)), 'plp_post_build_index_interval', "plp_post_build_index{$i}" );
49
- }
50
-
51
- add_action("plp_post_build_index{$i}", array($this,'post_index_builder'));
52
- }
53
-
54
- if($plp_options->replace_keywords_in_comments) {
55
- add_action('wp_insert_comment', array($this, 'comment_inserted'), 10, 2);
56
- add_action('wp_set_comment_status', array($this, 'set_comment_status'), 10, 2);
57
- }
58
- }
59
- }
60
-
61
- public function intervals ($schedules) {
62
- $interval = 1 * MINUTE_IN_SECONDS;
63
- return array_merge(
64
- $schedules,
65
- array(
66
- 'plp_post_build_index_interval' => array(
67
- 'interval' => $interval,
68
- 'display' => __('Pretty Link Post Build Index', 'pretty-link')
69
- ),
70
- )
71
- );
72
- }
73
-
74
- public function set_comment_status ($comment_id, $status) {
75
- if($status=='approve') {
76
- delete_comment_meta($comment_id, '_plp_comment_keywords_updated_at');
77
- delete_comment_meta($comment_id, '_plp_comment_urls_updated_at');
78
- }
79
- }
80
-
81
- public function comment_inserted ($comment_id, $c) {
82
- if($c->comment_approved) {
83
- delete_comment_meta($comment_id, '_plp_comment_keywords_updated_at');
84
- delete_comment_meta($comment_id, '_plp_comment_urls_updated_at');
85
- }
86
- }
87
-
88
- public function post_index_builder () {
89
- global $plp_options, $plp_keyword, $plp_url_replacement;
90
-
91
- $max_count = 2;
92
-
93
- $index_keywords = get_option('plp_index_keywords', false);
94
- if($plp_options->keyword_replacement_is_on && $index_keywords) {
95
-
96
- // Index Keywords for Posts
97
- $post_ids = $plp_keyword->get_indexable_posts($max_count);
98
- if(!empty($post_ids)) {
99
- for ($i=0; ($i < count($post_ids)); $i++) {
100
- $plp_keyword->index_post($post_ids[$i]);
101
- }
102
- return; // Short circuit
103
- }
104
-
105
- // Index URLs for Posts
106
- $post_ids = $plp_url_replacement->get_indexable_posts($max_count);
107
- if(!empty($post_ids)) {
108
- for ($i=0; ($i < count($post_ids)); $i++) {
109
- $plp_url_replacement->index_post($post_ids[$i]);
110
- }
111
- return; // Short circuit
112
- }
113
-
114
- if($plp_options->replace_keywords_in_comments) {
115
-
116
- // Index Kewords for Comments
117
- $comment_ids = $plp_keyword->get_indexable_comments($max_count);
118
- if(!empty($comment_ids)) {
119
- for ($i=0; ($i < count($comment_ids)); $i++) {
120
- $plp_keyword->index_comment($comment_ids[$i]);
121
- }
122
- return; // Short circuit
123
- }
124
-
125
- // Index URLs for Comments
126
- $comment_ids = $plp_url_replacement->get_indexable_comments($max_count);
127
- if(!empty($comment_ids)) {
128
- for ($i=0; ($i < count($comment_ids)); $i++) {
129
- $plp_url_replacement->index_comment($comment_ids[$i]);
130
- }
131
- return; // Short circuit
132
- }
133
-
134
- }
135
-
136
- }
137
- }
138
-
139
- // Removes keyword replacement from excerpts
140
- public function excerpt_remove_keyword_replacement($excerpt) {
141
- remove_filter('the_content', array($this, 'replace_keywords'));
142
- return $excerpt;
143
- }
144
-
145
- //Wrapper for replace_keywords() for bbPress
146
- public function replace_bbpress_keywords($content, $id) {
147
- return $this->replace_keywords($content,'',false);
148
- }
149
-
150
- public function replace_keywords($content, $request_uri = '', $allow_header_footer = true) {
151
- global $post, $prli_link, $prli_blogurl, $plp_keyword, $plp_url_replacement, $plp_options;
152
-
153
- if(!isset($post) || !isset($post->ID)) { return $content; }
154
-
155
- //*************************** the_content static caching ***************************//
156
- // the_content CAN be run more than once per page load
157
- // so this static var prevents stuff from happening twice
158
- // like cancelling a subscr or resuming etc...
159
- static $already_run = array();
160
- static $new_content = array();
161
- static $content_length = array();
162
-
163
- //Init this post's static values
164
- if(!isset($new_content[$post->ID]) || empty($new_content[$post->ID])) {
165
- $already_run[$post->ID] = false;
166
- $new_content[$post->ID] = '';
167
- $content_length[$post->ID] = -1;
168
- }
169
-
170
- //Have we been here before?
171
- if($already_run[$post->ID] && strlen($content) == $content_length[$post->ID]) {
172
- return $new_content[$post->ID];
173
- }
174
-
175
- $content_length[$post->ID] = strlen($content);
176
- $already_run[$post->ID] = true;
177
- //************************* end the_content static caching *************************//
178
-
179
- //Needed to get around an issue with some plugins and themes that add random &nbsp;'s all over the place
180
- if(apply_filters('plp_keywords_replace_nbsp', false)) {
181
- $content = str_replace('&nbsp;', ' ', $content);
182
- }
183
-
184
- //Revert WP apostrophe and ampersand formatting
185
- $content = str_replace(array('&#8217;'), array("'"), $content);
186
- $content = str_replace(array('&amp;'), array("&"), $content); //Keywords with & will finally work
187
-
188
- $replacements_happened = false;
189
-
190
- if($plp_options->keyword_replacement_is_on) {
191
- $plp_post_options = PlpPostOptions::get_options($post->ID);
192
-
193
- // Make sure keyword replacements haven't been disabled on this page / post
194
- if( !$plp_post_options->disable_replacements ) {
195
- // If post password required and it doesn't match the cookie.
196
- // Just return the content unaltered -- we don't want to cache the password form.
197
- if(post_password_required($post)) {
198
- $new_content[$post->ID] = $content;
199
- return $new_content[$post->ID];
200
- }
201
-
202
- // do a keyword replacement per post and per request_uri
203
- // so we can handle <!--more--> tags, feeds, etc.
204
- if($request_uri == '') {
205
- $request_uri = $_SERVER['REQUEST_URI'];
206
- }
207
-
208
- // URL Replacements go first
209
- if(($urls_to_links = $plp_url_replacement->getURLToLinksArray())) {
210
- foreach($urls_to_links as $url => $links) {
211
- $urlrep = $links[array_rand($links)];
212
-
213
- // if the url is blank then skip it
214
- if(preg_match("#^\s*$#",$url)) { continue; }
215
-
216
- $urlregex = '#'.preg_quote($url,'#').'#';
217
-
218
- // If any url matches then we know there were replacements
219
- if(!$replacements_happened && preg_match( $urlregex, $content )) {
220
- $replacements_happened = true;
221
- }
222
-
223
- $content = preg_replace($urlregex, $urlrep, $content);
224
- }
225
- }
226
-
227
- // Grab keywords to links list
228
- if(($keyword_to_links = apply_filters('plp_get_post_keywords_lookup', $plp_keyword->get_post_keywords_lookup($post->ID), $post))) {
229
- // Pull out issue prone html code that keywords could appear in
230
- $keyword_ignores = array();
231
- $shortcode_ignore = '#(\[.*?\])#';
232
- $html_tags_remove = '#(\<(a|h\d|pre|script|iframe|code|applet|audio|canvas|button|textarea).*?\>.*?\</(a|h\d|pre|script|iframe|code|applet|audio|canvas|button|textarea)\>)#';
233
- $self_close_ignore = '#(\<[^\>]*?/\>)#'; //Should capture img tags and the likes
234
- $gen_ignore = '#(\</?.*?/?\>)#'; //Clean up
235
-
236
- $i = 0;
237
-
238
- // Pull shortcodes
239
- preg_match_all($shortcode_ignore,$content,$shortcode_matches);
240
-
241
- foreach($shortcode_matches[1] as $shortcode_match) {
242
- $placeholder = "||!prliignore".$i++."||";
243
- $keyword_ignores[] = array('html' => $shortcode_match, 'placeholder' => $placeholder);
244
- $content = preg_replace($shortcode_ignore,$placeholder,$content,1);
245
- }
246
-
247
- // Pull certain html tags completely out
248
- // We need to make sure we pull full anchors out before we pull general and self closing tags
249
- preg_match_all($html_tags_remove,$content,$tags_matches);
250
-
251
- foreach($tags_matches[1] as $tag_match) {
252
- $placeholder = "||!prliignore".$i++."||";
253
- $keyword_ignores[] = array('html' => $tag_match, 'placeholder' => $placeholder);
254
- $content = preg_replace($html_tags_remove,$placeholder,$content,1);
255
- }
256
-
257
- // Pull self closing html tags
258
- preg_match_all($self_close_ignore,$content,$self_close_matches);
259
-
260
- foreach($self_close_matches[1] as $self_close) {
261
- $placeholder = "||!prliignore".$i++."||";
262
- $keyword_ignores[] = array('html' => $self_close, 'placeholder' => $placeholder);
263
- $content = preg_replace($self_close_ignore,$placeholder,$content,1);
264
- }
265
-
266
- // Pull other html tags
267
- preg_match_all($gen_ignore,$content,$gen_matches);
268
-
269
- foreach($gen_matches[1] as $gen_match) {
270
- $placeholder = "||!prliignore".$i++."||";
271
- $keyword_ignores[] = array('html' => $gen_match, 'placeholder' => $placeholder);
272
- $content = preg_replace($gen_ignore,$placeholder,$content,1);
273
- }
274
-
275
- // Now sort through keyword array and do the actual replacements
276
- $keywords = array_keys($keyword_to_links);
277
-
278
- // Sort by stringlength so larger words get replaced first and we get our counts right
279
- $keywords = PlpUtils::sort_by_stringlen($keywords,'DESC');
280
-
281
- // Set the keyword links per page to unlimited if we're not using thresholds
282
- $keyword_links_per_page = (($plp_options->set_keyword_thresholds)?$plp_options->keyword_links_per_page:-1);
283
- $keywords_per_page = (($plp_options->set_keyword_thresholds)?$plp_options->keywords_per_page:-1);
284
-
285
- $i = 0;
286
- $keyword_count = 0;
287
- $keyword_matches = array();
288
-
289
- // First, see what keywords match in the post
290
- foreach($keywords as $keyword) {
291
- // if the keyword is blank then skip it
292
- if(preg_match("#^\s*$#",$keyword)) { continue; }
293
-
294
- //Fix for UTF-8 characters
295
- if(function_exists('mb_detect_encoding') && mb_detect_encoding($keyword) != 'ASCII') {
296
- $regex = '/\b('.preg_quote($keyword,'/').')\b/iu'; // add u modifer for UTF-8 or other encodings
297
- }
298
- else {
299
- $regex = '/\b('.preg_quote($keyword,'/').')\b/i'; //For most people ASCII matching should be fine
300
- }
301
-
302
- $keyword_instances = array();
303
-
304
- if(preg_match_all($regex,$content,$keyword_instances)) {
305
- // If any keyword matches then we know there were replacements
306
- if(!$replacements_happened) {
307
- $replacements_happened = true;
308
- }
309
-
310
- $key_rep_count = $url_index = 0; // array_rand($keyword_to_links[$keyword]);
311
- $kw_obj = $keyword_to_links[$keyword][$url_index];
312
- $url = $kw_obj->url;
313
- $title = htmlentities($kw_obj->title, ENT_QUOTES);
314
-
315
- // Determine which keyword instances will be replaced
316
- $keyword_instance_count = count($keyword_instances[1]);
317
- $instance_indices = array();
318
- for($ind = 0; $ind < $keyword_instance_count; $ind++) {
319
- $instance_indices[] = $ind;
320
- }
321
-
322
- // Randomize the replacement indices if thresholds are set
323
- // This only works because in the instance_indices array
324
- // the keys are the same as the values (0=>0,1=>1,2=>2,etc.)
325
- if($keyword_links_per_page != -1 && ($keyword_instance_count > $keyword_links_per_page)) {
326
- $instance_indices = array_slice(array_keys($instance_indices), 0, $keyword_links_per_page); // array_rand($instance_indices, $keyword_links_per_page);
327
- }
328
-
329
- // Force this to be an array ... even though array_rand will sometimes return a scalar var
330
- if(!is_array($instance_indices)) {
331
- $instance_indices = array($instance_indices);
332
- }
333
-
334
- $index = 0;
335
- foreach($keyword_instances[1] as $keyword_instance) {
336
- $placeholder = "||!prlikeyword".$i++."||";
337
-
338
- // if we're replacing this index with a link then do it -- but
339
- // if not, then just replace it with itself later on. :)
340
- if(in_array($index,$instance_indices)) {
341
- $rel = 'rel="';
342
- if($plp_options->keyword_links_nofollow) { $rel .= 'nofollow '; }
343
- if($plp_options->keyword_links_sponsored) { $rel .= 'sponsored '; }
344
- $rel .= '"';
345
-
346
- $link_html = "<a href=\"{$url}\" title=\"{$title}\" class=\"pretty-link-keyword\"".$rel.(($plp_options->keyword_links_open_new_window)?" target=\"_blank\"":'').">{$keyword_instance}".($plp_options->enable_keyword_link_disclosures?" {$plp_options->keyword_link_disclosure}":'')."</a>";
347
- $keyword_matches[] = array('html' => $link_html, 'placeholder' => $placeholder);
348
- $content = preg_replace($regex, $placeholder, $content, 1, $key_rep_count);
349
- }
350
- else {
351
- $keyword_matches[] = array('html' => $keyword_instance, 'placeholder' => $placeholder);
352
- $content = preg_replace($regex, $placeholder, $content, 1, $key_rep_count);
353
- }
354
-
355
- $index++;
356
- }
357
-
358
- $keyword_count++;
359
- }
360
-
361
- // Short circuit once we've reached the keywords_per_page
362
- if($keywords_per_page != -1 && $keyword_count >= $keywords_per_page) {
363
- break;
364
- }
365
- }
366
-
367
- $regexes = array();
368
- // Put back the ignores putting the onion back together in reverse order
369
- foreach(array_reverse($keyword_ignores) as $keyword_ignore) {
370
- // Replace $'s so pcre doesn't think we've got back references
371
- $ignore_text = str_replace('$','\$',$keyword_ignore['html']);
372
- $ignores_regex = '#'. preg_quote($keyword_ignore['placeholder'], '#') . '#';
373
- $regexes[] = $ignores_regex;
374
- $content = preg_replace($ignores_regex,$ignore_text,$content);
375
- }
376
-
377
- // Put back the matches putting the onion back together in reverse order
378
- foreach(array_reverse($keyword_matches) as $keyword_match) {
379
- // Replace $'s so pcre doesn't think we've got back references
380
- $keyword_text = str_replace('$','\$',$keyword_match['html']);
381
- $matches_regex = '#'. preg_quote($keyword_match['placeholder'], '#') . '#';
382
- $regexes[] = $matches_regex;
383
- $content = preg_replace($matches_regex,$keyword_text,$content);
384
- }
385
- }
386
-
387
- // Any remaining non-pretty links will now be pretty linked if url/pretty link
388
- // replacement has been enabled on this blog
389
- if($plp_options->replace_urls_with_pretty_links) {
390
- if(apply_filters('prli_replace_urls_decode_content', true, $content)) {
391
- $content = html_entity_decode(rawurldecode($content));
392
- }
393
-
394
- preg_match_all('#<a.*?href\s*?=\s*?[\'"](https?://.*?)[\'"]#mi', $content, $matches);
395
-
396
- //Filter out our blacklist domains so they don't get replaced
397
- if(!empty($plp_options->replace_urls_with_pretty_links_blacklist) && !empty($matches[1])) {
398
- $blacklist = preg_split('/[\r\n]+/', $plp_options->replace_urls_with_pretty_links_blacklist, -1, PREG_SPLIT_NO_EMPTY);
399
-
400
- foreach($blacklist as $bl_url) {
401
- $bl_url_host = parse_url($bl_url, PHP_URL_HOST);
402
-
403
- foreach($matches[1] as $key => $rep_url) {
404
- $rep_url_host = parse_url($rep_url, PHP_URL_HOST);
405
-
406
- if($bl_url_host == $rep_url_host) {
407
- unset($matches[1][$key]);
408
- }
409
- }
410
- }
411
-
412
- //reindex the array
413
- $matches[1] = array_values($matches[1]);
414
- }
415
-
416
- $prli_lookup = $prli_link->get_target_to_pretty_urls( $matches[1], true );
417
-
418
- if($prli_lookup !== false && is_array($prli_lookup)) {
419
- //Using this one to prevent partial url replacements -- seems to be working but I'm not 100% sure about the # of escapes on the double quote's
420
- $url_patterns = array_map(
421
- function($target_url) {
422
- return '#["\']' . preg_quote($target_url, '#') . '["\']#';
423
- },
424
- array_keys($prli_lookup)
425
- );
426
-
427
- $url_replacements = array_values(array_map(
428
- function($pretty_urls) {
429
- return $pretty_urls[0];
430
- },
431
- $prli_lookup
432
- ));
433
-
434
- if($plp_options->keyword_links_open_new_window) {
435
- $url_patterns[] = "#<a\s#";
436
- $url_replacements[] = '<a target="_blank" ';
437
- }
438
-
439
- $content = preg_replace($url_patterns, $url_replacements, $content);
440
- }
441
- }
442
- }
443
- }
444
-
445
- if($allow_header_footer && $replacements_happened && $plp_options->enable_link_to_disclosures) {
446
- ob_start();
447
-
448
- ?>
449
- <div class="prli-link-to-disclosures">
450
- <a href="<?php echo esc_url($plp_options->disclosures_link_url); ?>"><?php echo esc_html($plp_options->disclosures_link_text); ?></a>
451
- </div>
452
- <?php
453
-
454
- $disclosure_link = ob_get_clean();
455
-
456
- if($plp_options->disclosures_link_position=='top') {
457
- $content = $disclosure_link.$content;
458
- }
459
- else if($plp_options->disclosures_link_position=='top_and_bottom') {
460
- $content = $disclosure_link.$content.$disclosure_link;
461
- }
462
- else {
463
- $content = $content.$disclosure_link;
464
- }
465
- }
466
-
467
- $new_content[$post->ID] = $content;
468
- return $new_content[$post->ID];
469
- }
470
-
471
- public function replace_keywords_in_comments( $content ) {
472
- //global $comment;
473
- // We don't care if it's a real uri -- it's used as an index
474
- //$request_uri = "#prli-comment-{$comment->comment_ID}";
475
- $request_uri = '#prli-comment-' . PlpUtils::base36_encode(mt_rand());
476
-
477
- return $this->replace_keywords( $content, $request_uri, false );
478
- }
479
-
480
- // TODO: There must be a cleaner way to do this -- Blair Williams 11/2014
481
- public function keyword_link_style() {
482
- global $plp_options;
483
-
484
- if ($plp_options->keyword_replacement_is_on) {
485
- $css = '';
486
-
487
- if (!empty($plp_options->keyword_link_custom_css)) {
488
- $css .= sprintf('a.pretty-link-keyword { %s }', esc_html($plp_options->keyword_link_custom_css));
489
- }
490
-
491
- if (!empty($plp_options->keyword_link_hover_custom_css)) {
492
- $css .= sprintf('a.pretty-link-keyword:hover { %s }', esc_html($plp_options->keyword_link_hover_custom_css));
493
- }
494
-
495
- if ($css) {
496
- wp_register_style('plp-keywords', false);
497
- wp_enqueue_style('plp-keywords');
498
- wp_add_inline_style('plp-keywords', $css);
499
- }
500
- }
501
- }
502
-
503
- public function keyword_link_column_row($content, $link_id) {
504
- global $plp_keyword, $plp_options;
505
-
506
- if( $plp_options->keyword_replacement_is_on ) {
507
- return $plp_keyword->getTextByLinkId( $link_id );
508
- }
509
-
510
- return '';
511
- }
512
- }
513
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/app/controllers/PlpLinkCategoriesController.php DELETED
@@ -1,43 +0,0 @@
1
- <?php if(!defined('ABSPATH')) { die('You are not allowed to call this page directly.'); }
2
-
3
- class PlpLinkCategoriesController extends PrliBaseController {
4
- public static $ctax = 'pretty-link-category';
5
-
6
- public function load_hooks() {
7
- add_action('init', array($this,'register_taxonomy'));
8
- }
9
-
10
- public function register_taxonomy() {
11
- $role = PrliUtils::get_minimum_role();
12
-
13
- $args = array(
14
- 'labels' => array(
15
- 'name' => esc_html_x( 'Link Categories', 'taxonomy general name', 'pretty-link' ),
16
- 'singular_name' => esc_html_x( 'Link Category', 'taxonomy singular name', 'pretty-link' ),
17
- 'search_items' => esc_html__( 'Search Link Categories', 'pretty-link' ),
18
- 'all_items' => esc_html__( 'All Link Categories', 'pretty-link' ),
19
- 'parent_item' => esc_html__( 'Parent Link Category', 'pretty-link' ),
20
- 'parent_item_colon' => esc_html__( 'Parent Link Category:', 'pretty-link' ),
21
- 'edit_item' => esc_html__( 'Edit Link Category', 'pretty-link' ),
22
- 'update_item' => esc_html__( 'Update Link Category', 'pretty-link' ),
23
- 'add_new_item' => esc_html__( 'Add New Link Category', 'pretty-link' ),
24
- 'new_item_name' => esc_html__( 'New Link Category Name', 'pretty-link' ),
25
- 'menu_name' => esc_html__( 'Categories', 'pretty-link' ),
26
- ),
27
- 'hierarchical' => true,
28
- 'show_ui' => true,
29
- 'show_admin_column' => true,
30
- 'query_var' => false,
31
- 'rewrite' => false,
32
- 'capabilities' => array(
33
- 'manage_terms' => $role,
34
- 'edit_terms' => $role,
35
- 'delete_terms' => $role,
36
- 'assign_terms' => $role
37
- )
38
- );
39
-
40
- register_taxonomy( self::$ctax, PrliLink::$cpt, $args );
41
- }
42
- }
43
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/app/controllers/PlpLinkTagsController.php DELETED
@@ -1,50 +0,0 @@
1
- <?php if(!defined('ABSPATH')) { die('You are not allowed to call this page directly.'); }
2
-
3
- class PlpLinkTagsController extends PrliBaseController {
4
- public static $ctax = 'pretty-link-tag';
5
-
6
- public function load_hooks() {
7
- add_action('init', array($this,'register_taxonomy'));
8
- }
9
-
10
- public function register_taxonomy() {
11
- $role = PrliUtils::get_minimum_role();
12
-
13
- $args = array(
14
- 'labels' => array(
15
- 'name' => esc_html_x( 'Link Tags', 'taxonomy general name', 'pretty-link' ),
16
- 'singular_name' => esc_html_x( 'Link Tag', 'taxonomy singular name', 'pretty-link' ),
17
- 'search_items' => esc_html__( 'Search Link Tags', 'pretty-link' ),
18
- 'all_items' => esc_html__( 'All Link Tags', 'pretty-link' ),
19
- 'parent_item' => null,
20
- 'parent_item_colon' => null,
21
- 'edit_item' => esc_html__( 'Edit Link Tag', 'pretty-link' ),
22
- 'update_item' => esc_html__( 'Update Link Tag', 'pretty-link' ),
23
- 'add_new_item' => esc_html__( 'Add New Link Tag', 'pretty-link' ),
24
- 'new_item_name' => esc_html__( 'New Link Tag Name', 'pretty-link' ),
25
- 'separate_items_with_commas' => esc_html__( 'Separate Link Tags with commas', 'pretty-link' ),
26
- 'add_or_remove_items' => esc_html__( 'Add or remove Link Tags', 'pretty-link' ),
27
- 'choose_from_most_used' => esc_html__( 'Choose from the most used Link Tags', 'pretty-link' ),
28
- 'not_found' => esc_html__( 'No Link Tags found.', 'pretty-link' ),
29
- 'menu_name' => esc_html__( 'Tags', 'pretty-link' ),
30
- ),
31
- 'hierarchical' => false,
32
- 'show_ui' => true,
33
- 'show_admin_column' => true,
34
- 'update_count_callback' => '_update_post_term_count',
35
- 'query_var' => false,
36
- 'rewrite' => false,
37
- 'capabilities' => array(
38
- 'manage_terms' => $role,
39
- 'edit_terms' => $role,
40
- 'delete_terms' => $role,
41
- 'assign_terms' => $role
42
- )
43
- );
44
-
45
-
46
- register_taxonomy( self::$ctax, PrliLink::$cpt, $args );
47
- }
48
- }
49
-
50
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/app/controllers/PlpLinksController.php DELETED
@@ -1,892 +0,0 @@
1
- <?php if(!defined('ABSPATH')) { die('You are not allowed to call this page directly.'); }
2
-
3
- class PlpLinksController extends PrliBaseController {
4
- public function load_hooks() {
5
- add_action('prli_link_fields', array($this,'display_link_options'));
6
- add_action('prli_record_click', array($this,'record_rotation_click'));
7
- add_action('prli_update_link', array($this,'update_link_options'));
8
- add_filter('prli_validate_link', array($this,'validate_link_options'));
9
- add_filter('prli_target_url', array($this,'customize_target_url'), 99);
10
- add_action('wp_head', array($this,'shorturl_autodiscover'));
11
-
12
- add_action('prli_redirection_types', array($this,'redirection_types'), 10, 2);
13
- add_action('prli_issue_cloaked_redirect', array($this,'issue_cloaked_redirect'), 10, 4);
14
- add_action('prli_default_redirection_types',array($this,'default_redirection_options'));
15
- add_action('prli_delete_link', array($this,'delete_link'));
16
- add_action('prli_custom_link_options', array($this,'custom_link_options'));
17
- add_action('prli-store-options', array($this,'store_link_options'));
18
- add_action('prli-create-link', array($this,'create_link'), 10, 2);
19
-
20
- add_filter('prli-check-if-slug', array($this,'generate_qr_code'),10,2);
21
-
22
- add_action('prli_list_end_icon', array($this,'link_list_end_icons'));
23
-
24
- add_action('prli-redirect-header', array($this, 'maybe_add_scripts_to_head'));
25
-
26
- add_action('wp_ajax_prli_search_countries', array($this, 'ajax_search_countries'));
27
- }
28
-
29
- public function maybe_add_scripts_to_head() {
30
- global $wpdb, $plp_options, $prli_link, $prli_link_meta;
31
-
32
- //Global scripts
33
- if(!empty($plp_options->global_head_scripts)) {
34
- echo stripslashes($plp_options->global_head_scripts) . "\n";
35
- }
36
-
37
- //Per link scripts
38
- $request_uri = preg_replace('#/(\?.*)?$#', '$1', rawurldecode($_SERVER['REQUEST_URI']));
39
-
40
- if($link_info = $prli_link->is_pretty_link($request_uri, false)) {
41
- $link_id = $link_info['pretty_link_found']->id;
42
- $head_scripts = stripslashes($prli_link_meta->get_link_meta($link_id, 'head_scripts', true));
43
-
44
- if(!empty($head_scripts)) {
45
- echo stripslashes($head_scripts);
46
- }
47
- }
48
- }
49
-
50
- /************ DISPLAY & UPDATE PRO LINK OPTIONS ************/
51
- public function display_link_options($link_id) {
52
- global $prli_link, $prli_link_meta, $plp_keyword, $plp_link_rotation, $plp_options;
53
-
54
- if( $plp_options->keyword_replacement_is_on ) {
55
- if(empty($_POST['keywords']) && $link_id) {
56
- $keywords = $plp_keyword->getTextByLinkId( $link_id );
57
- }
58
- else {
59
- $keywords = isset($_POST['keywords']) && is_string($_POST['keywords']) ? sanitize_text_field(stripslashes($_POST['keywords'])) : '';
60
- }
61
-
62
- if(empty($_POST['url_replacements']) && $link_id) {
63
- $url_replacements = $prli_link_meta->get_link_meta( $link_id, 'prli-url-replacements' );
64
-
65
- if(is_array($url_replacements)) {
66
- $url_replacements = implode(', ', $url_replacements);
67
- }
68
- else {
69
- $url_replacements = '';
70
- }
71
- }
72
- else {
73
- $url_replacements = isset($_POST['url_replacements']) && is_string($_POST['url_replacements']) ? sanitize_text_field(stripslashes($_POST['url_replacements'])) : '';
74
- }
75
- }
76
-
77
- if(empty($_POST['head-scripts']) && $link_id) {
78
- $head_scripts = stripslashes($prli_link_meta->get_link_meta($link_id, 'head_scripts', true));
79
- }
80
- else {
81
- $head_scripts = isset($_POST['head-scripts']) && is_string($_POST['head-scripts']) ? PrliUtils::sanitize_html(stripslashes($_POST['head-scripts'])) : '';
82
- }
83
-
84
- if(empty($_POST['dynamic_redirection']) && $link_id) {
85
- $dynamic_redirection = $prli_link_meta->get_link_meta($link_id, 'prli_dynamic_redirection', true);
86
-
87
- // Ensure reverse compatibility
88
- if(empty($dynamic_redirection) &&
89
- $plp_link_rotation->there_are_rotations_for_this_link($link_id)) {
90
- $dynamic_redirection = 'rotate';
91
- }
92
- }
93
- else {
94
- $dynamic_redirection = isset($_POST['dynamic_redirection']) && is_string($_POST['dynamic_redirection']) ? sanitize_key(stripslashes($_POST['dynamic_redirection'])) : 'none';
95
- }
96
-
97
- if(empty($_POST['url_rotations']) && $link_id) {
98
- $url_rotations = $plp_link_rotation->get_rotations( $link_id );
99
- $url_rotation_weights = $plp_link_rotation->get_weights( $link_id );
100
-
101
- if(!is_array($url_rotations)) {
102
- $url_rotations = array('','','','');
103
- }
104
-
105
- if(!is_array($url_rotation_weights)) {
106
- $url_rotation_weights = array('','','','');
107
- }
108
- }
109
- else {
110
- $url_rotations = isset($_POST['url_rotations']) && is_array($_POST['url_rotations']) ? array_map('esc_url_raw', array_map('trim', wp_unslash($_POST['url_rotations']))) : array();
111
- $url_rotation_weights = isset($_POST['url_rotation_weights']) && is_array($_POST['url_rotation_weights']) ? array_map(function ($value) { return PrliUtils::clamp((int) $value, 0, 100); }, wp_unslash($_POST['url_rotation_weights'])) : array();
112
- }
113
-
114
- if(empty($_POST['url']) && $link_id) {
115
- $link = $prli_link->getOne($link_id);
116
- $target_url = $link->url;
117
- }
118
- else {
119
- $target_url = isset($_POST['url']) && is_string($_POST['url']) ? esc_url_raw(trim(stripslashes($_POST['url']))) : '';
120
- }
121
-
122
- if(!$link_id || !($target_url_weight = $prli_link_meta->get_link_meta($link_id, 'prli-target-url-weight', true))) {
123
- $target_url_weight = 0;
124
- }
125
-
126
- if(!empty($_POST) && !isset($_POST['enable_split_test']) || (empty($link_id) || !$link_id)) {
127
- $enable_split_test = isset($_POST['enable_split_test']);
128
- }
129
- else {
130
- $enable_split_test = $prli_link_meta->get_link_meta($link_id, 'prli-enable-split-test', true);
131
- }
132
-
133
- if(isset($_POST['split_test_goal_link']) || (empty($link_id) || !$link_id)) {
134
- $split_test_goal_link = isset($_POST['split_test_goal_link']) && is_numeric($_POST['split_test_goal_link']) ? (int) $_POST['split_test_goal_link'] : '';
135
- }
136
- else {
137
- $split_test_goal_link = $prli_link_meta->get_link_meta($link_id, 'prli-split-test-goal-link', true);
138
- }
139
-
140
- $links = $prli_link->getAll('',' ORDER BY li.name');
141
-
142
- if(isset($_POST['enable_expire']) || (empty($link_id) || !$link_id)) {
143
- $enable_expire = isset($_POST['enable_expire']);
144
- }
145
- else {
146
- $enable_expire = $prli_link_meta->get_link_meta($link_id, 'enable_expire', true);
147
- }
148
-
149
- if(isset($_POST['expire_type']) || (empty($link_id) || !$link_id)) {
150
- $expire_type = isset($_POST['expire_type']) && is_string($_POST['expire_type']) ? sanitize_key(stripslashes($_POST['expire_type'])) : 'date';
151
- }
152
- else {
153
- $expire_type = $prli_link_meta->get_link_meta($link_id, 'expire_type', true);
154
- }
155
-
156
- if(isset($_POST['expire_date']) || (empty($link_id) || !$link_id)) {
157
- $expire_date = isset($_POST['expire_date']) && is_string($_POST['expire_date']) ? sanitize_text_field(stripslashes($_POST['expire_date'])) : '';
158
- }
159
- else {
160
- $expire_date = $prli_link_meta->get_link_meta($link_id, 'expire_date', true);
161
- }
162
-
163
- if(isset($_POST['expire_clicks']) || (empty($link_id) || !$link_id)) {
164
- $expire_clicks = isset($_POST['expire_clicks']) && is_numeric($_POST['expire_clicks']) ? (int) $_POST['expire_clicks'] : 0;
165
- }
166
- else {
167
- $expire_clicks = $prli_link_meta->get_link_meta($link_id, 'expire_clicks', true);
168
- }
169
-
170
- if(isset($_POST['enable_expired_url']) || (empty($link_id) || !$link_id)) {
171
- $enable_expired_url = isset($_POST['enable_expired_url']);
172
- }
173
- else {
174
- $enable_expired_url = $prli_link_meta->get_link_meta($link_id, 'enable_expired_url', true);
175
- }
176
-
177
- if(isset($_POST['expired_url']) || (empty($link_id) || !$link_id)) {
178
- $expired_url = isset($_POST['expired_url']) && is_string($_POST['expired_url']) ? esc_url_raw(trim(stripslashes($_POST['expired_url']))) : '';
179
- }
180
- else {
181
- $expired_url = $prli_link_meta->get_link_meta($link_id, 'expired_url', true);
182
- }
183
-
184
- require_once(PLP_VIEWS_PATH.'/links/form.php');
185
- }
186
-
187
- public function validate_link_options($errors) {
188
- global $prli_link_meta, $plp_options;
189
-
190
- if( $plp_options->keyword_replacement_is_on ) {
191
- if( !empty($_POST[ 'url_replacements' ]) ) {
192
- $replacements = explode(',', $_POST['url_replacements']);
193
- foreach($replacements as $replacement) {
194
- if(!PrliUtils::is_url(trim($replacement))) {
195
- $errors[] = __('Your URL Replacements must be formatted as a comma separated list of properly formatted URLs (http[s]://example.com/whatever)', 'pretty-link');
196
- break;
197
- }
198
- }
199
- }
200
- }
201
-
202
- if(isset($_POST['enable_expire'])) {
203
- if(isset($_POST['expire_type']) && $_POST['expire_type']=='date') {
204
- $_POST['expire_date'] = trim($_POST['expire_date']);
205
- if(!PrliUtils::is_date($_POST['expire_date'])) {
206
- $errors[] = __('Date must be valid and formatted YYYY-MM-DD.', 'pretty-link');
207
- }
208
- }
209
- else if(isset($_POST['expire_type']) && $_POST['expire_type']=='clicks') {
210
- $_POST['expire_clicks'] = trim($_POST['expire_clicks']);
211
-
212
- // If they have clicks set here then we force tracking on for the link
213
- // TODO: Is this the best way to do this?
214
- $_POST['track_me'] = 'on';
215
-
216
- if( !is_numeric($_POST['expire_clicks']) ||
217
- (int)$_POST['expire_clicks'] <= 0 ) {
218
- $errors[] = __('Expire Clicks must be a number greater than zero.', 'pretty-link');
219
- }
220
- }
221
-
222
- if(isset($_POST['enable_expired_url'])) {
223
- $_POST['expired_url'] = isset($_POST['expired_url']) && is_string($_POST['expired_url']) ? trim($_POST['expired_url']) : '';
224
- if(!PrliUtils::is_url($_POST['expired_url'])) {
225
- $errors[] = __('Expired URL must be a valid URL.', 'pretty-link');
226
- }
227
- }
228
- }
229
-
230
- if( !empty($_POST['dynamic_redirection']) && $_POST['dynamic_redirection']=='rotate' ) {
231
- if( !empty($_POST[ 'url_rotations' ]) ) {
232
- $num_active_links = 0;
233
- $weight_sum = (int)$_POST['target_url_weight'];
234
- foreach($_POST['url_rotations'] as $i => $rotation) {
235
- if(!empty($rotation)) {
236
- if(!PrliUtils::is_url($rotation)) {
237
- $errors[] = __('Your URL Rotations must all be properly formatted URLs.', 'pretty-link');
238
- }
239
-
240
- $num_active_links++;
241
- $weight_sum += (int)$_POST['url_rotation_weights'][$i];
242
- }
243
- }
244
-
245
- if($num_active_links > 0 && $weight_sum != 100) {
246
- $errors[] = __('Your Link Rotation Weights must add up to 100%.', 'pretty-link');
247
- }
248
- }
249
- }
250
-
251
- if( !empty($_POST['dynamic_redirection']) && $_POST['dynamic_redirection']=='geo' ) {
252
- if( !empty($_POST['prli_geo_url']) ) {
253
- foreach($_POST['prli_geo_url'] as $i => $geo_url) {
254
- if(!empty($geo_url)) {
255
- if(!PrliUtils::is_url($geo_url)) {
256
- $errors[] = __('Your Geographic Redirect URLs must all be properly formatted.', 'pretty-link');
257
- }
258
- }
259
- else {
260
- $errors[] = __('Your Geographic Redirects URLs must not be empty.', 'pretty-link');
261
- }
262
-
263
- if(empty($_POST['prli_geo_countries']) || empty($_POST['prli_geo_countries'][$i])) {
264
- $errors[] = __('Your Geographic Redirect Countries must not be empty.', 'pretty-link');
265
- }
266
- }
267
- }
268
- }
269
-
270
- if( !empty($_POST['dynamic_redirection']) && $_POST['dynamic_redirection']=='tech' ) {
271
- if( !empty($_POST['prli_tech_url']) ) {
272
- foreach($_POST['prli_tech_url'] as $i => $tech_url) {
273
- if(!empty($tech_url)) {
274
- if(!PrliUtils::is_url($tech_url)) {
275
- $errors[] = __('Your Technology Redirect URLs must all be properly formatted.', 'pretty-link');
276
- }
277
- }
278
- else {
279
- $errors[] = __('Your Technology Redirects URLs must not be empty.', 'pretty-link');
280
- }
281
- }
282
- }
283
- }
284
-
285
- if( !empty($_POST['dynamic_redirection']) && $_POST['dynamic_redirection']=='time' ) {
286
- if( !empty($_POST['prli_time_url']) ) {
287
- foreach($_POST['prli_time_url'] as $i => $time_url) {
288
- if(!empty($time_url)) {
289
- if(!PrliUtils::is_url($time_url)) {
290
- $errors[] = __('Your Time Period Redirect URLs must all be properly formatted.', 'pretty-link');
291
- }
292
- }
293
- else {
294
- $errors[] = __('Your Time Period Redirects URLs must not be empty.', 'pretty-link');
295
- }
296
-
297
- if(!empty($_POST['prli_time_start'])) {
298
- if(empty($_POST['prli_time_start'][$i])) {
299
- $errors[] = __('Your Time Period Redirect start time must not be empty.', 'pretty-link');
300
- }
301
- else if(!PrliUtils::is_date($_POST['prli_time_start'][$i])) {
302
- $errors[] = __('Your Time Period Redirect start time must be a properly formatted date.', 'pretty-link');
303
- }
304
- }
305
-
306
- if(!empty($_POST['prli_time_end'])) {
307
- if(empty($_POST['prli_time_end'][$i])) {
308
- $errors[] = __('Your Time Period Redirect end time must not be empty.', 'pretty-link');
309
- }
310
- else if(!PrliUtils::is_date($_POST['prli_time_end'][$i])) {
311
- $errors[] = __('Your Time Period Redirect end time must be a properly formatted date.', 'pretty-link');
312
- }
313
- }
314
-
315
- if(!empty($_POST['prli_time_start']) && !empty($_POST['prli_time_end']) &&
316
- PrliUtils::is_date($_POST['prli_time_start'][$i]) && PrliUtils::is_date($_POST['prli_time_end'][$i]) &&
317
- ($time_start = strtotime($_POST['prli_time_start'][$i])) && ($time_end = strtotime($_POST['prli_time_end'][$i])) &&
318
- $time_start > $time_end ) {
319
- $errors[] = __('Your Time Period Redirect start time must come before the end time.', 'pretty-link');
320
- }
321
- }
322
- }
323
- }
324
-
325
- if(isset($_POST['delay']) && !empty($_POST['delay'])) {
326
- if(!is_numeric($_POST['delay'])) {
327
- $errors[] = __('Delay Redirect must be a number', 'pretty-link');
328
- }
329
- }
330
-
331
- return $errors;
332
- }
333
-
334
- public function update_link_options($link_id) {
335
- global $prli_link_meta, $plp_link_rotation, $plp_keyword, $plp_options;
336
-
337
- if($plp_options->keyword_replacement_is_on) {
338
- if (isset($_POST['keywords']) && is_string($_POST['keywords'])) {
339
- //Keywords first
340
- $plp_keyword->updateLinkKeywords($link_id, sanitize_text_field(stripslashes($_POST['keywords'])));
341
- }
342
-
343
- if (isset($_POST['url_replacements']) && is_string($_POST['url_replacements'])) {
344
- //Now URL replacements
345
- $replacements = explode(',', sanitize_text_field(stripslashes($_POST['url_replacements'])));
346
-
347
- for ($i = 0; $i < count($replacements); $i++) {
348
- $replacements[$i] = esc_url_raw(trim($replacements[$i]));
349
- }
350
-
351
- //No point filling the meta table with a bunch of empty crap
352
- if (count($replacements) == 1 && empty($replacements[0])) {
353
- $prli_link_meta->delete_link_meta($link_id, 'prli-url-replacements');
354
- } else {
355
- $prli_link_meta->update_link_meta($link_id, 'prli-url-replacements', $replacements);
356
- }
357
- }
358
- }
359
-
360
- $dynamic_redirection = (isset($_POST['dynamic_redirection']) && is_string($_POST['dynamic_redirection']) ? sanitize_key(stripslashes($_POST['dynamic_redirection'])) : 'none');
361
- $prli_link_meta->update_link_meta($link_id, 'prli_dynamic_redirection', $dynamic_redirection);
362
-
363
- $target_url_weight = 100;
364
- $url_rotations = $url_rotation_weights = array();
365
- $enable_split_test = false;
366
- $split_test_goal_link = '';
367
-
368
- if($dynamic_redirection == 'rotate') {
369
- $target_url_weight = isset($_POST['target_url_weight']) && is_numeric($_POST['target_url_weight']) ? PrliUtils::clamp((int) $_POST['target_url_weight'], 0, 100) : 100;
370
- $url_rotations = isset($_POST['url_rotations']) && is_array($_POST['url_rotations']) ? array_map('esc_url_raw', array_map('trim', wp_unslash($_POST['url_rotations']))) : array();
371
- $url_rotation_weights = isset($_POST['url_rotation_weights']) && is_array($_POST['url_rotation_weights']) ? array_map(function ($value) { return PrliUtils::clamp((int) $value, 0, 100); }, wp_unslash($_POST['url_rotation_weights'])) : array();
372
- $enable_split_test = isset($_POST['enable_split_test']);
373
- $split_test_goal_link = isset($_POST['split_test_goal_link']) && is_numeric($_POST['split_test_goal_link']) ? (int) $_POST['split_test_goal_link'] : '';
374
- }
375
-
376
- $prli_link_meta->update_link_meta($link_id, 'prli-target-url-weight', $target_url_weight);
377
- $plp_link_rotation->updateLinkRotations($link_id, $url_rotations, $url_rotation_weights);
378
- $prli_link_meta->update_link_meta($link_id, 'prli-enable-split-test', $enable_split_test);
379
- $prli_link_meta->update_link_meta($link_id, 'prli-split-test-goal-link', $split_test_goal_link);
380
-
381
- $geo_url = $geo_countries = array();
382
-
383
- if($dynamic_redirection == 'geo') {
384
- $geo_url = isset($_POST['prli_geo_url']) && is_array($_POST['prli_geo_url']) ? array_map('esc_url_raw', array_map('trim', wp_unslash($_POST['prli_geo_url']))) : array();
385
- $geo_countries = isset($_POST['prli_geo_countries']) && is_array($_POST['prli_geo_countries']) ? array_map('sanitize_text_field', wp_unslash($_POST['prli_geo_countries'])) : array();
386
- }
387
-
388
- $prli_link_meta->update_link_meta($link_id, 'geo_url', $geo_url);
389
- $prli_link_meta->update_link_meta($link_id, 'geo_countries', $geo_countries);
390
-
391
- $tech_url = $tech_device = $tech_os = $tech_browser = array();
392
-
393
- if($dynamic_redirection == 'tech') {
394
- $tech_url = isset($_POST['prli_tech_url']) && is_array($_POST['prli_tech_url']) ? array_map('esc_url_raw', array_map('trim', wp_unslash($_POST['prli_tech_url']))) : array();
395
- $tech_device = isset($_POST['prli_tech_device']) && is_array($_POST['prli_tech_device']) ? array_map('sanitize_key', wp_unslash($_POST['prli_tech_device'])) : array();
396
- $tech_os = isset($_POST['prli_tech_os']) && is_array($_POST['prli_tech_os']) ? array_map('sanitize_key', wp_unslash($_POST['prli_tech_os'])) : array();
397
- $tech_browser = isset($_POST['prli_tech_browser']) && is_array($_POST['prli_tech_browser']) ? array_map('sanitize_key', wp_unslash($_POST['prli_tech_browser'])) : array();
398
- }
399
-
400
- $prli_link_meta->update_link_meta($link_id, 'tech_url', $tech_url);
401
- $prli_link_meta->update_link_meta($link_id, 'tech_device', $tech_device);
402
- $prli_link_meta->update_link_meta($link_id, 'tech_os', $tech_os);
403
- $prli_link_meta->update_link_meta($link_id, 'tech_browser', $tech_browser);
404
-
405
- $time_url = $time_start = $time_end = array();
406
-
407
- if($dynamic_redirection == 'time') {
408
- $time_url = isset($_POST['prli_time_url']) && is_array($_POST['prli_time_url']) ? array_map('esc_url_raw', array_map('trim', wp_unslash($_POST['prli_time_url']))) : array();
409
- $time_start = isset($_POST['prli_time_start']) && is_array($_POST['prli_time_start']) ? array_map('sanitize_text_field', wp_unslash($_POST['prli_time_start'])) : array();
410
- $time_end = isset($_POST['prli_time_end']) && is_array($_POST['prli_time_end']) ? array_map('sanitize_text_field', wp_unslash($_POST['prli_time_end'])) : array();
411
- }
412
-
413
- $prli_link_meta->update_link_meta($link_id, 'time_url', $time_url);
414
- $prli_link_meta->update_link_meta($link_id, 'time_start', $time_start);
415
- $prli_link_meta->update_link_meta($link_id, 'time_end', $time_end);
416
-
417
- $prli_link_meta->update_link_meta($link_id, 'google_tracking', isset($_POST['google_tracking']));
418
- $prli_link_meta->update_link_meta($link_id, 'delay', isset($_POST['delay']) && is_numeric($_POST['delay']) ? (int) $_POST['delay'] : 0);
419
- $prli_link_meta->update_link_meta($link_id, 'head_scripts', isset($_POST['head-scripts']) && is_string($_POST['head-scripts']) ? PrliUtils::sanitize_html(stripslashes($_POST['head-scripts'])) : '');
420
-
421
- $prli_link_meta->update_link_meta($link_id, 'enable_expire', isset($_POST['enable_expire']));
422
- $prli_link_meta->update_link_meta($link_id, 'expire_type', isset($_POST['expire_type']) && is_string($_POST['expire_type']) ? sanitize_key(stripslashes($_POST['expire_type'])) : 'date');
423
- $prli_link_meta->update_link_meta($link_id, 'expire_date', isset($_POST['expire_date']) && is_string($_POST['expire_date']) ? sanitize_text_field(stripslashes($_POST['expire_date'])) : '');
424
- $prli_link_meta->update_link_meta($link_id, 'expire_clicks', isset($_POST['expire_clicks']) && is_numeric($_POST['expire_clicks']) ? (int) $_POST['expire_clicks'] : 0);
425
- $prli_link_meta->update_link_meta($link_id, 'enable_expired_url', isset($_POST['enable_expired_url']));
426
- $prli_link_meta->update_link_meta($link_id, 'expired_url', isset($_POST['expired_url']) && is_string($_POST['expired_url']) ? esc_url_raw(trim(stripslashes($_POST['expired_url']))) : '');
427
- }
428
-
429
- /** This is where we do link rotation or geolocated redirects */
430
- public function customize_target_url($target) {
431
- global $plp_link_rotation, $prli_link_meta, $prli_utils, $prli_link;
432
-
433
- if(($expired_url = PlpUtils::is_link_expired($target['link_id']))) {
434
- if($expired_url==404) {
435
- // TODO: Not totally sure how to ensure this will use the WordPress 404 mechanism...figure it out
436
- // For now just throw a 404 and render our page here
437
- status_header(404);
438
-
439
- wp_register_style('prli-bootstrap', PRLI_VENDOR_LIB_URL . '/bootstrap/bootstrap.min.css', array(), '3.3.6');
440
- wp_register_style('prli-bootstrap-theme', PRLI_VENDOR_LIB_URL . '/bootstrap/bootstrap-theme.min.css', array('prli-bootstrap'), '3.3.6');
441
-
442
- wp_add_inline_style('prli-bootstrap-theme', 'body { background-color: #dedede; } p { font-size: 120%; }');
443
-
444
- require(PLP_VIEWS_PATH.'/links/link-has-expired.php');
445
- exit;
446
- }
447
- else {
448
- return array('url' => $expired_url, 'link_id' => $target['link_id']);
449
- }
450
- }
451
-
452
- $dynamic_redirection = $prli_link_meta->get_link_meta($target['link_id'], 'prli_dynamic_redirection', true);
453
-
454
- if((empty($dynamic_redirection) || $dynamic_redirection=='rotate') &&
455
- $plp_link_rotation->there_are_rotations_for_this_link($target['link_id'])) {
456
- return array('url' => $plp_link_rotation->get_target_url($target['link_id']), 'link_id' => $target['link_id']);
457
- }
458
- else if(!empty($dynamic_redirection) && $dynamic_redirection=='geo') {
459
- $lookup = $this->get_country_lookup($target['link_id']);
460
- $country = PlpUtils::country_by_ip($prli_utils->get_current_client_ip());
461
-
462
- if(!empty($country) && isset($lookup[$country]) && !empty($lookup[$country])) {
463
- return array('url' => $lookup[$country], 'link_id' => $target['link_id']);
464
- }
465
- }
466
- else if(!empty($dynamic_redirection) && $dynamic_redirection=='tech') {
467
- $binfo = $prli_utils->php_get_browser();
468
-
469
- $tech_urls = $prli_link_meta->get_link_meta($target['link_id'], 'tech_url');
470
- $tech_devices = $prli_link_meta->get_link_meta($target['link_id'], 'tech_device');
471
- $tech_oses = $prli_link_meta->get_link_meta($target['link_id'], 'tech_os');
472
- $tech_browsers = $prli_link_meta->get_link_meta($target['link_id'], 'tech_browser');
473
-
474
- if(is_array($tech_urls) && !empty($tech_urls)) {
475
- $ti = $this->get_tech_info($binfo);
476
- foreach($tech_urls as $i => $tech_url) {
477
- if(in_array($tech_devices[$i],$ti['devices']) &&
478
- in_array($tech_oses[$i],$ti['oses']) &&
479
- in_array($tech_browsers[$i],$ti['browsers'])) {
480
- return array('url' => $tech_url, 'link_id' => $target['link_id']);
481
- }
482
- }
483
- }
484
- }
485
- else if(!empty($dynamic_redirection) && $dynamic_redirection=='time') {
486
- if(($time_url = PlpUtils::is_link_time_redirect_active($target['link_id']))) {
487
- return array('url' => $time_url, 'link_id' => $target['link_id']);
488
- }
489
- }
490
-
491
- return $target;
492
- }
493
-
494
- /** Return a single array able to lookup a target url from a country code based
495
- * on the values entered with the geo-location specific redirects.
496
- */
497
- private function get_country_lookup($link_id) {
498
- global $prli_link_meta;
499
-
500
- $dynamic_redirection = $prli_link_meta->get_link_meta($link_id, 'prli_dynamic_redirection', true);
501
- if(!empty($dynamic_redirection) && $dynamic_redirection=='geo') {
502
- $geo_url = $prli_link_meta->get_link_meta($link_id, 'geo_url');
503
- $geo_countries = $prli_link_meta->get_link_meta($link_id, 'geo_countries');
504
-
505
- $lookup = array();
506
- foreach($geo_countries as $i => $cstr) {
507
- $cs = explode(',', $cstr);
508
- foreach($cs as $ci => $country) {
509
- if(!empty($country) &&
510
- preg_match('/\[([a-zA-Z]+)\]/i', $country, $m) &&
511
- !empty($m[1]) &&
512
- !isset($lookup[$m[1]])) { // First country set wins
513
- $lookup[strtoupper($m[1])] = $geo_url[$i];
514
- }
515
- }
516
- }
517
-
518
- return $lookup;
519
- }
520
-
521
- return false;
522
- }
523
-
524
- private function get_tech_info($info) {
525
- // Devices
526
- $devices=array('any');
527
-
528
- if($info['ismobiledevice']===true ||
529
- $info['ismobiledevice']==='true') {
530
- $devices[]='mobile';
531
- }
532
-
533
- if($info['istablet']===true ||
534
- $info['istablet']==='true') {
535
- $devices[]='tablet';
536
- }
537
- if(($info['istablet']===false ||
538
- $info['istablet']==='false') &&
539
- ($info['ismobiledevice']===true ||
540
- $info['ismobiledevice']==='true')) {
541
- $devices[]='phone';
542
- }
543
-
544
- if(($info['istablet']===false ||
545
- $info['istablet']==='false') &&
546
- ($info['ismobiledevice']===false ||
547
- $info['ismobiledevice']==='false')) {
548
- $devices[]='desktop';
549
- }
550
-
551
- // Operating Systems
552
- $oses = array('any');
553
- $info_os = strtolower($info['platform']);
554
- $windows_oses = array( 'win10', 'win32', 'win7', 'win8', 'win8.1', 'winnt', 'winvista' );
555
- $other_oses = array('android', 'linux', 'ios', 'macosx');
556
-
557
- // map macos to macosx for now
558
- $info_os = (($info_os=='macos') ? 'macosx' : $info_os);
559
-
560
- if(in_array($info_os, $other_oses)) {
561
- $oses[] = $info_os;
562
- }
563
- else if(in_array($info_os, $windows_oses)) {
564
- $oses[] = 'win';
565
- }
566
-
567
- $browsers = array('any');
568
- $info_browser = strtolower($info['browser']);
569
- $android_browsers = array('android', 'android webview');
570
- $ie_browsers = array('fake ie', 'ie');
571
- $other_browsers = array('chrome', 'chromium', 'coast', 'edge', 'firefox', 'opera', 'safari', 'silk', 'kindle');
572
-
573
- if(in_array($info_browser, $other_browsers)) {
574
- $browsers[] = $info_browser;
575
- }
576
- else if(in_array($info_browser, $ie_browsers)) {
577
- $browsers[] = 'ie';
578
- }
579
- else if(in_array($info_browser, $android_browsers)) {
580
- $browsers[] = 'android';
581
- }
582
-
583
- return compact('devices','oses','browsers');
584
- }
585
-
586
- public function record_rotation_click($args) {
587
- $link_id = $args['link_id'];
588
- $click_id = $args['click_id'];
589
- $target_url = $args['url'];
590
-
591
- global $plp_link_rotation;
592
- if($plp_link_rotation->there_are_rotations_for_this_link($link_id)) {
593
- $plp_link_rotation->record_click($click_id,$link_id,$target_url);
594
- }
595
- }
596
-
597
- /***** ADD SHORTLINK AUTO-DISCOVERY *****/
598
- public function shorturl_autodiscover() {
599
- global $post;
600
-
601
- if(!is_object($post)) { return; }
602
-
603
- $pretty_link_id = PrliUtils::get_prli_post_meta($post->ID,"_pretty-link",true);
604
-
605
- if($pretty_link_id && (is_single() || is_page())) {
606
- $shorturl = prli_get_pretty_link_url($pretty_link_id);
607
-
608
- if($shorturl && !empty($shorturl)) {
609
- ?><link rel="shorturl" href="<?php echo esc_url($shorturl); ?>" /><?php
610
- }
611
- }
612
- }
613
-
614
- /***************** ADD PRETTY BAR, PIXEL and CLOAKED REDIRECTION *********************/
615
- public function redirection_types($v, $selected = false) {
616
- $prettybar = isset($v['redirect_type']['prettybar']) ? $v['redirect_type']['prettybar'] : '';
617
- $cloak = isset($v['redirect_type']['cloak']) ? $v['redirect_type']['cloak'] : '';
618
- $pixel = isset($v['redirect_type']['pixel']) ? $v['redirect_type']['pixel'] : '';
619
- $metarefresh = isset($v['redirect_type']['metarefresh']) ? $v['redirect_type']['metarefresh'] : '';
620
- $javascript = isset($v['redirect_type']['javascript']) ? $v['redirect_type']['javascript'] : '';
621
-
622
- ?>
623
- <option value="prettybar"<?php echo $prettybar; ?> <?php if($selected) { selected('prettybar', $selected); } ?>><?php esc_html_e('Pretty Bar', 'pretty-link'); ?>&nbsp;</option>
624
- <option value="cloak"<?php echo $cloak; ?> <?php if($selected) { selected('cloak', $selected); } ?>><?php esc_html_e('Cloaked', 'pretty-link'); ?>&nbsp;</option>
625
- <option value="pixel"<?php echo $pixel; ?> <?php if($selected) { selected('pixel', $selected); } ?>><?php esc_html_e('Pixel', 'pretty-link'); ?>&nbsp;</option>
626
- <option value="metarefresh"<?php echo $metarefresh; ?> <?php if($selected) { selected('metarefresh', $selected); } ?>><?php esc_html_e('Meta Refresh', 'pretty-link'); ?>&nbsp;</option>
627
- <option value="javascript"<?php echo $javascript; ?> <?php if($selected) { selected('javascript', $selected); } ?>><?php esc_html_e('Javascript', 'pretty-link'); ?>&nbsp;</option>
628
- <?php
629
- }
630
-
631
- public function issue_cloaked_redirect($redirect_type, $pretty_link, $pretty_link_url, $param_string) {
632
- global $prli_blogurl, $prli_link_meta, $prli_blogname;
633
-
634
- $google_tracking = (($prli_link_meta->get_link_meta($pretty_link->id, 'google_tracking', true) == 1)?true:false);
635
- $delay = $prli_link_meta->get_link_meta($pretty_link->id, 'delay', true);
636
-
637
- header("Content-Type: text/html", true);
638
- header("HTTP/1.1 200 OK", true);
639
-
640
- switch($redirect_type) {
641
- case 'pixel':
642
- break;
643
- case 'prettybar':
644
- require_once(PLP_VIEWS_PATH . '/links/prettybar-redirect.php');
645
- break;
646
- case 'cloak':
647
- wp_register_style('prli-cloaked-redirect', PRLI_CSS_URL . '/cloaked-redirect.css', array(), PRLI_VERSION);
648
- require_once(PLP_VIEWS_PATH . '/links/cloaked-redirect.php');
649
- break;
650
- case 'metarefresh':
651
- require_once(PLP_VIEWS_PATH . '/links/metarefresh-redirect.php');
652
- break;
653
- case 'javascript':
654
- wp_register_script('plp-javascript-redirect', PLP_JS_URL . '/javascript-redirect.js', array(), PRLI_VERSION);
655
- wp_localize_script('plp-javascript-redirect', 'plpJsRedirectL10n', array(
656
- 'url' => esc_url_raw($pretty_link_url . $param_string),
657
- 'delay' => ((int) $delay) * 1000
658
- ));
659
- require_once(PLP_VIEWS_PATH . '/links/javascript-redirect.php');
660
- break;
661
- default:
662
- wp_redirect("{$pretty_link_url}{$param_string}", 302);
663
- exit;
664
- }
665
- }
666
-
667
- public function default_redirection_options($link_redirect_type) {
668
- ?>
669
- <option value="prettybar" <?php echo (($link_redirect_type == 'prettybar')?' selected="selected"':''); ?>><?php esc_html_e('Pretty Bar', 'pretty-link'); ?></option>
670
- <option value="cloak" <?php echo (($link_redirect_type == 'cloak')?' selected="selected"':''); ?>><?php esc_html_e('Cloak', 'pretty-link'); ?></option>
671
- <option value="pixel" <?php echo (($link_redirect_type == 'pixel')?' selected="selected"':''); ?>><?php esc_html_e('Pixel', 'pretty-link'); ?></option>
672
- <option value="metarefresh" <?php echo (($link_redirect_type == 'metarefresh')?' selected="selected"':''); ?>><?php esc_html_e('Meta Refresh', 'pretty-link'); ?></option>
673
- <option value="javascript" <?php echo (($link_redirect_type == 'javascript')?' selected="selected"':''); ?>><?php esc_html_e('Javascript', 'pretty-link'); ?></option>
674
- <?php
675
- }
676
-
677
- /** Deletes all the pro-specific meta about a link right before the link is deleted.
678
- * TODO: Relocate most of this to a model asap
679
- */
680
- public function delete_link($id) {
681
- global $wpdb, $plp_keyword, $plp_report, $plp_link_rotation;
682
- $query = $wpdb->prepare("DELETE FROM {$plp_keyword->table_name} WHERE link_id=%d", $id);
683
- $wpdb->query($query);
684
-
685
- $query = $wpdb->prepare("UPDATE {$plp_report->table_name} SET goal_link_id=NULL WHERE goal_link_id=%d", $id);
686
- $wpdb->query($query);
687
-
688
- $query = $wpdb->prepare("DELETE FROM {$plp_report->links_table_name} WHERE link_id=%d", $id);
689
- $wpdb->query($query);
690
-
691
- $query = $wpdb->prepare("DELETE FROM {$plp_link_rotation->table_name} WHERE link_id=%d", $id);
692
- $wpdb->query($query);
693
-
694
- $query = $wpdb->prepare("DELETE FROM {$plp_link_rotation->cr_table_name} WHERE link_id=%d", $id);
695
- $wpdb->query($query);
696
-
697
- $query = $wpdb->prepare("DELETE FROM {$wpdb->postmeta} WHERE meta_key=%s AND meta_value=%s", '_pretty-link', $id);
698
- $wpdb->query($query);
699
- }
700
-
701
- public function custom_link_options() {
702
- global $plp_options;
703
- require( PLP_VIEWS_PATH . '/links/link-options.php');
704
- }
705
-
706
- public function store_link_options() {
707
- global $plp_options;
708
-
709
- $plp_options->google_tracking = (int)isset($_REQUEST[ $plp_options->google_tracking_str ]);
710
- $plp_options->generate_qr_codes = (int)isset($_REQUEST[ $plp_options->generate_qr_codes_str ]);
711
- $plp_options->qr_code_links = (int)isset($_REQUEST[ $plp_options->qr_code_links_str ]);
712
- $plp_options->global_head_scripts = isset($_REQUEST[$plp_options->global_head_scripts_str]) && is_string($_REQUEST[$plp_options->global_head_scripts_str]) ? PrliUtils::sanitize_html(stripslashes($_REQUEST[$plp_options->global_head_scripts_str])) : '';
713
- $plp_options->base_slug_prefix = isset($_REQUEST[$plp_options->base_slug_prefix_str]) && is_string($_REQUEST[$plp_options->base_slug_prefix_str]) ? sanitize_title(stripslashes($_REQUEST[$plp_options->base_slug_prefix_str]), '') : '';
714
- $plp_options->num_slug_chars = isset($_REQUEST[$plp_options->num_slug_chars_str]) && is_numeric($_REQUEST[$plp_options->num_slug_chars_str]) ? PrliUtils::clamp((int) $_REQUEST[$plp_options->num_slug_chars_str], 0, 500) : 4;
715
-
716
- // Save the posted value in the database
717
- $plp_options->store();
718
- }
719
-
720
- public function create_link($link_id, $values) {
721
- global $plp_options, $prli_link_meta;
722
-
723
- if(!isset($values['google_tracking'])) {
724
- $prli_link_meta->update_link_meta($link_id, 'google_tracking', $plp_options->google_tracking);
725
- }
726
- }
727
-
728
- public function qr_code_link($pretty_link_id) {
729
- global $plp_options;
730
- $pretty_link_url = prli_get_pretty_link_url($pretty_link_id);
731
-
732
- ob_start();
733
-
734
- if($plp_options->qr_code_links):
735
- ?><a href="<?php echo esc_url($pretty_link_url . '/qr.png'); ?>" title="<?php echo esc_attr(sprintf(__('View QR Code for this link: %s', 'pretty-link'), $pretty_link_url)); ?>" target="_blank"><?php esc_html_e('QR Code', 'pretty-link'); ?></a><?php
736
- endif;
737
-
738
- if($plp_options->generate_qr_codes):
739
- ?><a href="<?php echo esc_url($pretty_link_url . '/qr.png?download=' . wp_create_nonce('prli-generate-qr-code')); ?>" title="<?php echo esc_attr(sprintf(__('Download QR Code for this link: %s', 'pretty-link'), $pretty_link_url)); ?>"><?php esc_html_e('QR Code', 'pretty-link'); ?></a><?php
740
- endif;
741
-
742
- return ob_get_clean();
743
- }
744
-
745
- public function generate_qr_code($pretty_link_id, $slug) {
746
- global $prli_link, $plp_options;
747
-
748
- if( $plp_options->qr_code_links or
749
- ( $plp_options->generate_qr_codes and
750
- isset($_REQUEST['download']) and
751
- wp_verify_nonce($_REQUEST['download'], 'prli-generate-qr-code') ) ) {
752
-
753
- $qr_regexp = '#/qr\.png$#';
754
-
755
- if(!$pretty_link_id and preg_match($qr_regexp, $slug)) {
756
- $slug_sans_qr = preg_replace($qr_regexp, '', $slug);
757
-
758
- if($pretty_link = $prli_link->getOneFromSlug( $slug_sans_qr )) {
759
- $pretty_link_url = prli_get_pretty_link_url($pretty_link->id);
760
-
761
- header("Content-Type: image/png");
762
-
763
- if(isset($_REQUEST['download']) and wp_verify_nonce($_REQUEST['download'], 'prli-generate-qr-code')) {
764
- header("HTTP/1.1 200 OK"); // Have to hard code this for some reason?
765
- header("Content-Disposition: attachment;filename=\"" . $slug_sans_qr . "_qr.png\"");
766
- header("Content-Transfer-Encoding: binary");
767
- //header("Pragma: public");
768
- }
769
-
770
- @include PLP_VENDOR_PATH."/phpqrcode/qrlib.php";
771
-
772
- QRcode::png($pretty_link_url, false, QR_ECLEVEL_L, 20, 2);
773
-
774
- exit;
775
- }
776
- }
777
- }
778
-
779
- return $pretty_link_id;
780
- }
781
-
782
- public function link_list_end_icons($link) {
783
- global $prli_link_meta, $plp_link_rotation;
784
-
785
- $dynamic_redirection = $prli_link_meta->get_link_meta($link->id, 'prli_dynamic_redirection', true);
786
- $enable_expire = $prli_link_meta->get_link_meta($link->id, 'enable_expire', true);
787
- $expire_type = $prli_link_meta->get_link_meta($link->id, 'expire_type', true);
788
-
789
- // Ensure reverse compatibility
790
- if(empty($dynamic_redirection)) {
791
- $dynamic_redirection = 'none';
792
-
793
- if($plp_link_rotation->there_are_rotations_for_this_link($link->id)) {
794
- $dynamic_redirection = 'rotate';
795
- }
796
- }
797
-
798
- if(empty($enable_expire) || empty($expire_type)) {
799
- $enable_expire = false;
800
- $expire_type = 'none';
801
- }
802
-
803
- if($enable_expire) {
804
- if($expire_type=='date') {
805
- $expire_date = $prli_link_meta->get_link_meta($link->id, 'expire_date', true);
806
- $expire_icon = 'history';
807
- $expire_class = '';
808
-
809
- if(($expired_url = PlpUtils::is_link_expired($link->id))) {
810
- $expire_class = 'prli-red';
811
- if($expired_url==404) {
812
- $expire_message = sprintf(__('This link expired on %1$s and will now cause a 404 error when visited', 'pretty-link'), $expire_date);
813
- }
814
- else {
815
- $expire_message = sprintf(__('This link expired on %1$s and now redirects to %2$s', 'pretty-link'), $expire_date, $expired_url);
816
- }
817
- }
818
- else {
819
- $expire_message = sprintf(__('This link is set to expire after the date %s', 'pretty-link'), $expire_date);
820
- }
821
- }
822
- else if($expire_type=='clicks') {
823
- $expire_clicks = $prli_link_meta->get_link_meta($link->id, 'expire_clicks', true);
824
- $expire_icon = 'ccw';
825
- $expire_class = '';
826
-
827
- if(($expired_url = PlpUtils::is_link_expired($link->id))) {
828
- $expire_class = 'prli-red';
829
- if($expired_url==404) {
830
- $expire_message = sprintf(__('This link expired after %d clicks and will now cause a 404 error when visited', 'pretty-link'), $expire_clicks);
831
- }
832
- else {
833
- $expire_message = sprintf(__('This link expired after %1$d clicks and now redirects to %2$s', 'pretty-link'), $expire_clicks, $expired_url);
834
- }
835
- }
836
- else {
837
- $expire_message = sprintf(__('This link is set to expire after %d clicks', 'pretty-link'), $expire_clicks);
838
- }
839
- }
840
-
841
- ?><i class="pl-list-icon pl-icon-<?php echo $expire_icon; ?> <?php echo $expire_class; ?>" title="<?php echo esc_attr($expire_message); ?>"></i><?php
842
- }
843
-
844
- if($dynamic_redirection=='rotate') {
845
- ?><i class="pl-list-icon pl-icon-shuffle" title="<?php esc_attr_e('This link has additional Target URL rotations', 'pretty-link'); ?>"></i><?php
846
- }
847
- else if($dynamic_redirection=='geo') {
848
- ?><i class="pl-list-icon pl-icon-globe" title="<?php esc_attr_e('This link has additional Geographic Target URLs', 'pretty-link'); ?>"></i><?php
849
- }
850
- else if($dynamic_redirection=='tech') {
851
- ?><i class="pl-list-icon pl-icon-mobile" title="<?php esc_attr_e('This link has additional Technology Dependent Conditional Target URLs', 'pretty-link'); ?>"></i><?php
852
- }
853
- else if($dynamic_redirection=='time') {
854
- $time_class = '';
855
- if(($time_url = PlpUtils::is_link_time_redirect_active($link->id))) {
856
- $time_message = sprintf(__('A Time Period Redirect is currently active for this link. When visited it will currently redirect to %s rather than the Target URL unless the link is expired.', 'pretty-link'), $time_url);
857
- $time_class = 'prli-green';
858
- }
859
- else {
860
- $time_message = __('Time Period Redirects have been setup for this link but the current time is not within any of them currently.', 'pretty-link');
861
- }
862
-
863
- ?><i class="pl-list-icon pl-icon-clock <?php echo $time_class; ?>" title="<?php echo esc_attr($time_message); ?>"></i><?php
864
- }
865
- }
866
-
867
- public function ajax_search_countries() {
868
- if(!PrliUtils::is_authorized()) {
869
- echo "Why you creepin?";
870
- die();
871
- }
872
-
873
- if(isset($_REQUEST['q']) && !empty($_REQUEST['q']) && is_string($_REQUEST['q'])) {
874
- $res = '';
875
- $countries = require(PLP_I18N_PATH.'/countries.php');
876
-
877
- $q = sanitize_text_field(stripslashes($_REQUEST['q']));
878
-
879
- foreach($countries as $code => $name) {
880
- if(preg_match('/'.preg_quote($q).'/i', $code) ||
881
- preg_match('/'.preg_quote($q).'/i', $name)) {
882
- $res .= "{$name} [{$code}]\n";
883
- }
884
- }
885
-
886
- echo $res;
887
- }
888
-
889
- exit;
890
- }
891
- }
892
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/app/controllers/PlpOptionsController.php DELETED
@@ -1,249 +0,0 @@
1
- <?php
2
- if(!defined('ABSPATH')) { die('You are not allowed to call this page directly.'); }
3
-
4
- class PlpOptionsController extends PrliBaseController {
5
- public $opt_fields;
6
-
7
- public function load_hooks() {
8
- add_action('prli_admin_general_options', array($this, 'general'));
9
- add_action('prli_admin_options_pages', array($this, 'display'));
10
-
11
- add_filter( 'prli-validate-options', array($this, 'validate') );
12
- add_filter( 'prli-update-options', array($this, 'update') );
13
- add_filter( 'prli-store-options', array($this, 'store') );
14
-
15
- $this->opt_fields = array(
16
- 'hidden_field_name' => 'prlipro_update_options',
17
- 'pages_auto' => 'prli_pages_auto',
18
- 'posts_auto' => 'prli_posts_auto',
19
- 'pages_category' => 'prli_pages_category',
20
- 'posts_category' => 'prli_posts_category',
21
- 'autocreate' => 'prli_autocreate',
22
- 'social_buttons' => 'prli_social_buttons',
23
- 'social_buttons_placement' => 'prli_social_buttons_placement',
24
- 'social_buttons_padding' => 'prli_social_buttons_padding',
25
- 'social_buttons_show_in_feed' => 'prli_social_buttons_show_in_feed',
26
- 'social_posts_buttons' => 'prli_social_posts_buttons',
27
- 'social_pages_buttons' => 'prli_social_pages_buttons',
28
- 'keyword_replacement_is_on' => 'prli_keyword_replacement_is_on',
29
- 'keywords_per_page' => 'prli_keywords_per_page',
30
- 'keyword_links_per_page' => 'prli_keyword_links_per_page',
31
- 'keyword_links_open_new_window' => 'prli_keyword_links_open_new_window',
32
- 'keyword_links_nofollow' => 'prli_keyword_links_nofollow',
33
- 'keyword_links_sponsored' => 'prli_keyword_links_sponsored',
34
- 'keyword_link_custom_css' => 'prli_keyword_link_custom_css',
35
- 'keyword_link_hover_custom_css' => 'prli_keyword_link_hover_custom_css',
36
- 'set_keyword_thresholds' => 'prli_set_keyword_thresholds',
37
- 'replace_urls_with_pretty_links' => 'prli_replace_urls_with_pretty_links',
38
- 'replace_urls_with_pretty_links_blacklist' => 'prli_replace_urls_with_pretty_links_blacklist',
39
- 'replace_keywords_in_comments' => 'prli_replace_keywords_in_comments',
40
- 'replace_keywords_in_feeds' => 'prli_replace_keywords_in_feeds',
41
- 'enable_link_to_disclosures' => 'prli_enable_link_to_disclosures',
42
- 'disclosures_link_url' => 'prli_disclosures_link_url',
43
- 'disclosures_link_text' => 'prli_disclosures_link_text',
44
- 'disclosures_link_position' => 'prli_disclosures_link_position',
45
- 'enable_keyword_link_disclosures' => 'prli_enable_keyword_link_disclosures',
46
- 'keyword_link_disclosure' => 'prli_keyword_link_disclosure',
47
- 'use_prettylink_url' => 'prli_use_prettylink_url',
48
- 'prettylink_url' => 'prli_prettylink_url',
49
- 'minimum_access_role' => 'prli_min_role',
50
- 'allow_public_link_creation' => 'prli_allow_public_link_creation',
51
- 'use_public_link_display_page' => 'prli_use_public_link_display_page',
52
- 'public_link_display_page' => 'prli_public_link_display_page',
53
- 'prettybar_image_url' => 'prli_prettybar_image_url',
54
- 'prettybar_background_image_url' => 'prli_prettybar_background_image_url',
55
- 'prettybar_color' => 'prli_prettybar_color',
56
- 'prettybar_text_color' => 'prli_prettybar_text_color',
57
- 'prettybar_link_color' => 'prli_prettybar_link_color',
58
- 'prettybar_hover_color' => 'prli_prettybar_hover_color',
59
- 'prettybar_visited_color' => 'prli_prettybar_visited_color',
60
- 'prettybar_show_title' => 'prli_prettybar_show_title',
61
- 'prettybar_show_description' => 'prli_prettybar_show_description',
62
- 'prettybar_show_share_links' => 'prli_prettybar_show_share_links',
63
- 'prettybar_show_target_url_link' => 'prli_prettybar_show_target_url_link',
64
- 'prettybar_title_limit' => 'prli_prettybar_title_limit',
65
- 'prettybar_desc_limit' => 'prli_prettybar_desc_limit',
66
- 'prettybar_link_limit' => 'prli_prettybar_link_limit',
67
- 'prettybar_hide_attrib_link' => 'prettybar_hide_attrib_link',
68
- 'prettybar_attrib_url' => 'prettybar_attrib_url'
69
- );
70
- }
71
-
72
- public function display() {
73
- global $prli_options, $plp_options;
74
-
75
- extract($this->opt_fields);
76
-
77
- $index_keywords = get_option('plp_index_keywords', false);
78
-
79
- require_once(PLP_VIEWS_PATH.'/options/form.php');
80
- }
81
-
82
- public function general() {
83
- global $plp_options;
84
-
85
- extract($this->opt_fields);
86
-
87
- require_once(PLP_VIEWS_PATH.'/options/general.php');
88
- }
89
-
90
- public function validate($errors=array()) {
91
- extract( $this->opt_fields );
92
-
93
- // Validate This
94
- //if( !empty($params[ $prettybar_link_limit ]) && !preg_match( "#^[0-9]*$#", $params[ $prettybar_link_limit ] ) )
95
- // $errors[] = __("PrettyBar Link Character Limit must be a number", 'pretty-link');
96
-
97
- if( isset($_POST[$set_keyword_thresholds]) && empty($_POST[ $keywords_per_page ]) ) {
98
- $errors[] = __('Keywords Per Page is required', 'pretty-link');
99
- }
100
-
101
- if( isset($_POST[$set_keyword_thresholds]) && empty($_POST[ $keyword_links_per_page ]) ) {
102
- $errors[] = __('Keyword Links Per Page is required', 'pretty-link');
103
- }
104
-
105
- if( isset($_POST[ $use_prettylink_url ]) &&
106
- !preg_match('/^http.?:\/\/.*\..*[^\/]$/', $_POST[ $prettylink_url ] )) {
107
- $errors[] = __('You need to enter a valid Pretty Link Base URL now that you have selected "Use an alternate base url for your Pretty Links"', 'pretty-link');
108
- }
109
-
110
- if( isset($_POST[ $use_public_link_display_page ]) &&
111
- !preg_match('/^http.?:\/\/.*\..*[^\/]$/', $_POST[ $public_link_display_page ] ) ) {
112
- $errors[] = __('You need to enter a valid Public Link Display URL now that you have selected "Use a custom public link display page"', 'pretty-link');
113
- }
114
-
115
- if( !isset($_POST['prettybar_hide_attrib_link']) &&
116
- !empty($_POST['prlipro-attrib-url']) &&
117
- !preg_match('/^http.?:\/\/.*\..*$/', $_POST['prlipro-attrib-url'] ) ) {
118
- $errors[] = __("Pretty Bar Attribution URL must be a correctly formatted URL", 'pretty-link');
119
- }
120
-
121
- return $errors;
122
- }
123
-
124
- public function update($params) {
125
- global $prli_options, $plp_options;
126
-
127
- extract( $this->opt_fields );
128
-
129
- // Read their posted value
130
- $plp_options->pages_auto = (int)isset($params[ $pages_auto ]);
131
- $plp_options->posts_auto = (int)isset($params[ $posts_auto ]);
132
- $plp_options->pages_category = isset($params[ $pages_category ]) && is_numeric($params[ $pages_category ]) ? (int) $params[ $pages_category ] : '';
133
- $plp_options->posts_category = isset($params[ $posts_category ]) && is_numeric($params[ $posts_category ]) ? (int) $params[ $posts_category ] : '';
134
-
135
- // This won't be set if the user has no public CPTs in place
136
- $plp_options->autocreate = array();
137
-
138
- if (isset($params[$autocreate]) && is_array($params[$autocreate])) {
139
- foreach ($params[$autocreate] as $post_type => $fields) {
140
- $post_type = sanitize_key($post_type);
141
-
142
- if ($post_type) {
143
- $plp_options->autocreate[$post_type] = array(
144
- 'enabled' => isset($fields['enabled']),
145
- 'category' => isset($fields['category']) && is_numeric($fields['category']) ? (int) $fields['category'] : '',
146
- 'socbtns' => isset($fields['socbtns'])
147
- );
148
- }
149
- }
150
- }
151
-
152
- //$plp_options->social_buttons = $params[ $social_buttons ];
153
- $new_social_buttons = $plp_options->default_social_buttons;
154
- foreach( $new_social_buttons as $btn_name => $btn ) {
155
- $new_social_buttons[$btn_name]['checked']=false;
156
- }
157
-
158
- if(isset($params[$social_buttons]) && is_array($params[$social_buttons])) {
159
- foreach( array_reverse( $params[ $social_buttons ] ) as $btn_name => $btn_checked ) {
160
- if (isset($new_social_buttons[$btn_name])) {
161
- $btn = $new_social_buttons[$btn_name];
162
- $btn['checked'] = true;
163
- unset($new_social_buttons[$btn_name]);
164
- array_unshift($new_social_buttons, $btn);
165
- }
166
- }
167
- }
168
-
169
- $plp_options->social_buttons = array_values($new_social_buttons);
170
- $plp_options->social_buttons_placement = isset($params[ $social_buttons_placement ]) && is_string($params[ $social_buttons_placement ]) ? sanitize_key(stripslashes($params[ $social_buttons_placement ])) : '';
171
- $plp_options->social_buttons_show_in_feed = (int)isset($params[ $social_buttons_show_in_feed ]);
172
- //$plp_options->social_buttons_padding = $params[ $social_buttons_padding ];
173
- $plp_options->social_posts_buttons = (int)isset($params[ $social_posts_buttons ]);
174
- $plp_options->social_pages_buttons = (int)isset($params[ $social_pages_buttons ]);
175
- $plp_options->keyword_replacement_is_on = (int)isset($params[ $keyword_replacement_is_on ]);
176
- $plp_options->keyword_links_open_new_window = (int)isset($params[ $keyword_links_open_new_window ]);
177
- $plp_options->keyword_links_nofollow = (int)isset($params[ $keyword_links_nofollow ]);
178
- $plp_options->keyword_links_sponsored = (int)isset($params[ $keyword_links_sponsored ]);
179
- $plp_options->keyword_link_custom_css = isset($params[ $keyword_link_custom_css ]) && is_string($params[ $keyword_link_custom_css ]) ? wp_strip_all_tags(stripslashes($params[ $keyword_link_custom_css ])) : '';
180
- $plp_options->keyword_link_hover_custom_css = isset($params[ $keyword_link_hover_custom_css ]) && is_string($params[ $keyword_link_hover_custom_css ]) ? wp_strip_all_tags(stripslashes($params[ $keyword_link_hover_custom_css ])) : '';
181
- $plp_options->replace_urls_with_pretty_links = (int)isset($params[ $replace_urls_with_pretty_links ]);
182
-
183
- $plp_options->replace_urls_with_pretty_links_blacklist = isset($params[ $replace_urls_with_pretty_links_blacklist ]) && is_string($params[ $replace_urls_with_pretty_links_blacklist ]) ? sanitize_textarea_field(stripslashes($params[ $replace_urls_with_pretty_links_blacklist ])) : '';
184
- $this->filter_domain_blacklist(); //Get rid of user entered garbage to make sure out input is valid
185
-
186
- $plp_options->replace_keywords_in_comments = (int)isset($params[ $replace_keywords_in_comments ]);
187
- $plp_options->replace_keywords_in_feeds = (int)isset($params[ $replace_keywords_in_feeds ]);
188
- $plp_options->enable_link_to_disclosures = (int)isset($params[ $enable_link_to_disclosures ]);
189
- $plp_options->disclosures_link_url = isset($params[ $disclosures_link_url ]) && is_string($params[ $disclosures_link_url ]) ? esc_url_raw(trim(stripslashes($params[ $disclosures_link_url ]))) : '';
190
- $plp_options->disclosures_link_text = isset($params[ $disclosures_link_text ]) && is_string($params[ $disclosures_link_text ]) ? sanitize_text_field(stripslashes($params[ $disclosures_link_text ])) : '';
191
- $plp_options->disclosures_link_position = isset($params[ $disclosures_link_position ]) && is_string($params[ $disclosures_link_position ]) ? sanitize_key(stripslashes($params[ $disclosures_link_position ])) : '';
192
- $plp_options->enable_keyword_link_disclosures = (int)isset($params[$enable_keyword_link_disclosures]);
193
- $plp_options->keyword_link_disclosure = isset($params[$keyword_link_disclosure]) && is_string($params[$keyword_link_disclosure]) ? sanitize_text_field(stripslashes($params[$keyword_link_disclosure])): '';
194
- $plp_options->set_keyword_thresholds = (int)isset($params[ $set_keyword_thresholds ]);
195
- $plp_options->keywords_per_page = isset($params[ $keywords_per_page ]) && is_numeric($params[ $keywords_per_page ]) ? max((int) $params[ $keywords_per_page ], 0) : 3;
196
- $plp_options->keyword_links_per_page = isset($params[ $keyword_links_per_page ]) && is_numeric($params[ $keyword_links_per_page ]) ? max((int) $params[ $keyword_links_per_page ], 0) : 2;
197
- $plp_options->use_prettylink_url = (int)isset($params[ $use_prettylink_url ]);
198
- $plp_options->prettylink_url = isset($params[ $prettylink_url ]) && is_string($params[ $prettylink_url ]) ? esc_url_raw(trim(stripslashes($params[ $prettylink_url ]))) : '';
199
- $plp_options->min_role = isset($params[ $minimum_access_role ]) && is_string($params[ $minimum_access_role ]) ? sanitize_key(stripslashes($params[ $minimum_access_role ])) : 'manage_options';
200
- $plp_options->allow_public_link_creation = (int)isset($params[ $allow_public_link_creation ]);
201
- $plp_options->use_public_link_display_page = (int)isset($params[ $use_public_link_display_page ]);
202
- $plp_options->public_link_display_page = isset($params[ $public_link_display_page ]) && is_string($params[ $public_link_display_page ]) ? esc_url_raw(trim(stripslashes($params[ $public_link_display_page ]))) : '';
203
- $prli_options->prettybar_image_url = isset($_POST[ $prettybar_image_url ]) && is_string($_POST[ $prettybar_image_url ]) ? esc_url_raw(trim(stripslashes($_POST[ $prettybar_image_url ]))) : '';
204
- $prli_options->prettybar_background_image_url = isset($_POST[ $prettybar_background_image_url ]) && is_string($_POST[ $prettybar_background_image_url ]) ? esc_url_raw(trim(stripslashes($_POST[ $prettybar_background_image_url ]))) : '';
205
- $prli_options->prettybar_color = isset($_POST[ $prettybar_color ]) && is_string($_POST[ $prettybar_color ]) ? sanitize_hex_color(stripslashes($_POST[ $prettybar_color ])) : '';
206
- $prli_options->prettybar_text_color = isset($_POST[ $prettybar_text_color ]) && is_string($_POST[ $prettybar_text_color ]) ? sanitize_hex_color(stripslashes($_POST[ $prettybar_text_color ])) : '';
207
- $prli_options->prettybar_link_color = isset($_POST[ $prettybar_link_color ]) && is_string($_POST[ $prettybar_link_color ]) ? sanitize_hex_color(stripslashes($_POST[ $prettybar_link_color ])) : '';
208
- $prli_options->prettybar_hover_color = isset($_POST[ $prettybar_hover_color ]) && is_string($_POST[ $prettybar_hover_color ]) ? sanitize_hex_color(stripslashes($_POST[ $prettybar_hover_color ])) : '';
209
- $prli_options->prettybar_visited_color = isset($_POST[ $prettybar_visited_color ]) && is_string($_POST[ $prettybar_visited_color ]) ? sanitize_hex_color(stripslashes($_POST[ $prettybar_visited_color ])) : '';
210
- $prli_options->prettybar_show_title = (int)isset($_POST[ $prettybar_show_title ]);
211
- $prli_options->prettybar_show_description = (int)isset($_POST[ $prettybar_show_description ]);
212
- $prli_options->prettybar_show_share_links = (int)isset($_POST[ $prettybar_show_share_links ]);
213
- $prli_options->prettybar_show_target_url_link = (int)isset($_POST[ $prettybar_show_target_url_link ]);
214
- $prli_options->prettybar_title_limit = isset($_POST[ $prettybar_title_limit ]) && is_numeric($_POST[ $prettybar_title_limit ]) ? (int) $_POST[ $prettybar_title_limit ] : 25;
215
- $prli_options->prettybar_desc_limit = isset($_POST[ $prettybar_desc_limit ]) && is_numeric($_POST[ $prettybar_desc_limit ]) ? (int) $_POST[ $prettybar_desc_limit ] : 30;
216
- $prli_options->prettybar_link_limit = isset($_POST[ $prettybar_link_limit ]) && is_numeric($_POST[ $prettybar_link_limit ]) ? (int) $_POST[ $prettybar_link_limit ] : 30;
217
- $plp_options->prettybar_hide_attrib_link = (int)isset($params[ $prettybar_hide_attrib_link ]);
218
- $plp_options->prettybar_attrib_url = isset($params[ $prettybar_attrib_url ]) && is_string($params[ $prettybar_attrib_url ]) ? esc_url_raw(trim(stripslashes($params[ $prettybar_attrib_url ]))) : '';
219
-
220
- update_option('plp_index_keywords', isset($params['plp_index_keywords']));
221
- wp_cache_delete('alloptions', 'options');
222
- }
223
-
224
- //Filters the user entered garbage to make sure these are valid domains
225
- public function filter_domain_blacklist() {
226
- global $plp_options;
227
-
228
- $new_ops = '';
229
- $lines = preg_split('/[\r\n]+/', $plp_options->replace_urls_with_pretty_links_blacklist, -1, PREG_SPLIT_NO_EMPTY);
230
-
231
- if(!empty($lines)) {
232
- foreach($lines as $line) {
233
- if($domain = parse_url($line, PHP_URL_HOST)) {
234
- $scheme = parse_url($line, PHP_URL_SCHEME) . "://";
235
- $new_ops .= $scheme.$domain."\n";
236
- }
237
- }
238
- }
239
-
240
- $plp_options->replace_urls_with_pretty_links_blacklist = $new_ops;
241
- }
242
-
243
- public function store() {
244
- global $plp_options;
245
-
246
- // Save the posted value in the database
247
- $plp_options->store();
248
- }
249
- } //End class
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/app/controllers/PlpPostsController.php DELETED
@@ -1,259 +0,0 @@
1
- <?php if(!defined('ABSPATH')) { die('You are not allowed to call this page directly.'); }
2
-
3
- class PlpPostsController extends PrliBaseController {
4
- public function load_hooks() {
5
- add_filter('the_content', array($this, 'run_autocreate'), 9); //This priority should be lower than social button bars
6
- add_action('save_post', array($this,'save_postdata'), 10, 3); // Manual update post
7
- add_action('transition_post_status', array($this,'transition_post_status'), 10, 3); // Publishing Scheduled content, etc.
8
- add_action('xmlrpc_publish_post', array($this,'xmlrpc_publish_post'), 10, 1); // Publishing Via XML-RPC
9
- add_action('wp_enqueue_scripts', array($this,'enqueue_scripts'));
10
- add_shortcode('post-pretty-link', array($this,'get_pretty_link'));
11
-
12
- //This trim_empty_replacement_rows can go at some point in the future after we think everyone has upgraded to 2.0.0+
13
- //This is an attempt to boost some query performance on keyword/url replacements
14
- add_action('admin_init', array($this, 'trim_empty_replacement_rows'));
15
-
16
- add_action('plp_admin_menu', array($this, 'admin_menu'), 10, 1);
17
- }
18
-
19
- public function enqueue_scripts() {
20
- global $post, $plp_options;
21
-
22
- if(!isset($post)) { return; }
23
-
24
- $post_types = $plp_options->get_post_types();
25
-
26
- $ac = $plp_options->autocreate_option($post->post_type);
27
-
28
- if($ac->enabled && $ac->socbtns) {
29
- wp_enqueue_style('prli-fontello-animation',
30
- PRLI_VENDOR_LIB_URL.'/fontello/css/animation.css',
31
- array(), PRLI_VERSION);
32
- wp_enqueue_style('prli-fontello-pretty-link',
33
- PRLI_VENDOR_LIB_URL.'/fontello/css/pretty-link.css',
34
- array('prli-fontello-animation'), PRLI_VERSION);
35
- wp_enqueue_style('prlipro-post', PLP_CSS_URL . '/prlipro-post.css');
36
- wp_enqueue_style('prlipro-social', PRLI_CSS_URL . '/social_buttons.css', array('prli-fontello-animation','prli-fontello-pretty-link'));
37
- }
38
- }
39
-
40
- public function admin_menu($role) {
41
- global $plp_options;
42
-
43
- $post_types = $plp_options->get_post_types();
44
-
45
- foreach($post_types as $post_type) {
46
- $ac = $plp_options->autocreate_option($post_type);
47
-
48
- // Show the meta box on post edit pages for auto generated pretty links
49
- if($ac->enabled) {
50
- add_meta_box('prlipro', esc_html__('Pretty Links Pro', 'pretty-link'), 'PlpPostsHelper::post_sidebar', $post_type, 'side', 'high');
51
- }
52
-
53
- if(($ac->enabled && $ac->socbtns) || $plp_options->keyword_replacement_is_on) {
54
- add_meta_box('prlipro_options', esc_html__('Pretty Links Pro Options', 'pretty-link'), 'PlpPostsHelper::post_options', $post_type, 'normal');
55
- }
56
- }
57
- }
58
-
59
- public function transition_post_status($new_status, $old_status, $post) {
60
- if($old_status != $new_status && $new_status == 'publish') {
61
- $this->publish_post($post->ID, 'auto');
62
- }
63
- }
64
-
65
- public function xmlrpc_publish_post($post_id) {
66
- $this->publish_post($post_id, 'auto');
67
- }
68
-
69
- public function publish_post($post_id, $type = 'manual') {
70
- $post = get_post($post_id);
71
- $this->save_postdata($post_id, $post, false, $type);
72
- $permalink = get_permalink($post_id); //Not sure what this is for?
73
- }
74
-
75
- public function save_postdata($post_id, $post, $update, $type = 'manual') {
76
- global $plp_options, $plp_keyword;
77
-
78
- if(defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
79
- return $post_id;
80
- }
81
-
82
- if(defined('DOING_AJAX')) {
83
- $type = 'auto';
84
- }
85
-
86
- if(!$post_id || !isset($post->ID) || !$post->ID) { return $post_id; }
87
-
88
- if(!current_user_can('edit_post', $post_id) && $type != 'auto') { return $post_id; }
89
-
90
- // Make sure a nonce is set so we don't wipe these options out when the post is being bulk edited
91
- if(!wp_verify_nonce((isset($_POST['plp_nonce']))?$_POST['plp_nonce']:'', 'plp_nonce'.wp_salt())) { return $post_id; }
92
-
93
- $ac = $plp_options->autocreate_option($post->post_type);
94
- $plp_post_options = PlpPostOptions::get_options($post_id);
95
- $plp_post_options->requested_slug = isset($_REQUEST['prli_req_slug']) && is_string($_REQUEST['prli_req_slug'])?sanitize_text_field(stripslashes($_REQUEST['prli_req_slug'])):$plp_post_options->requested_slug;
96
-
97
- $plp_post_options->hide_social_buttons = isset($_REQUEST['hide_social_buttons']);
98
- $plp_post_options->disable_replacements = isset($_REQUEST['disable_replacements']);
99
-
100
- $plp_post_options->store($post_id);
101
-
102
- $this->auto_create_pretty_link($post_id, $post);
103
-
104
- // Delete all the post keywords for this link to be rebuilt by our wp-cron task
105
- $plp_keyword->delete_post_keywords_by_post_id($post_id);
106
-
107
- delete_post_meta($post_id, '_plp_post_keywords_updated_at');
108
- delete_post_meta($post_id, '_plp_post_urls_updated_at');
109
- }
110
-
111
- public function auto_create_pretty_link($post_id, $post) {
112
- global $plp_options, $prli_link, $prli_utils, $plp_options, $prli_link_meta;
113
-
114
- $ac = $plp_options->autocreate_option($post->post_type);
115
-
116
- if(!$ac->enabled) { return; }
117
-
118
- if($post && $post->post_status == "publish") {
119
- $plp_post_options = PlpPostOptions::get_options($post_id);
120
-
121
- $pretty_link_id = PrliUtils::get_prli_post_meta($post_id,"_pretty-link",true);
122
-
123
- $new_link = false;
124
- // Try to find a pretty link that is using this link already
125
- if(!$pretty_link_id) {
126
- $new_link = true;
127
- $pretty_link_id = $prli_link->find_first_target_url(get_permalink($post_id));
128
- }
129
-
130
- $pretty_link = $prli_link->getOne($pretty_link_id);
131
-
132
- if(empty($pretty_link) || !$pretty_link) {
133
- $slug_available = $prli_utils->is_slug_available($plp_post_options->requested_slug);
134
-
135
- $slug = (is_wp_error($slug_available) ? '' : $plp_post_options->requested_slug);
136
-
137
- $pl_insert_id = prli_create_pretty_link( get_permalink($post_id),
138
- $slug, // slug should be default?
139
- !empty($post->post_title) ? addslashes($post->post_title) : __('Untitled', 'pretty-link'),
140
- addslashes($post->post_excerpt)
141
- );
142
-
143
- $new_pretty_link = $prli_link->getOne($pl_insert_id);
144
-
145
- if(isset($post->ID) && !empty($post->ID) && $post->ID) {
146
- PrliUtils::update_prli_post_meta($post->ID,'_pretty-link',$new_pretty_link->id,true);
147
- }
148
-
149
- $link_cpt_id = $new_pretty_link->link_cpt_id;
150
- }
151
- else {
152
- prli_update_pretty_link( $pretty_link_id,
153
- get_permalink($post_id),
154
- $pretty_link->slug,
155
- !empty($post->post_title) ? addslashes($post->post_title) : __('Untitled', 'pretty-link'),
156
- addslashes($post->post_excerpt)
157
- );
158
-
159
- // Still update the post meta
160
- if(isset($post_id) && !empty($post_id) && $post_id) {
161
- PrliUtils::update_prli_post_meta($post_id,'_pretty-link',$pretty_link_id,true);
162
- }
163
-
164
- $link_cpt_id = $pretty_link->link_cpt_id;
165
- }
166
-
167
- if ($ac->category) {
168
- wp_set_object_terms($link_cpt_id, $ac->category, PlpLinkCategoriesController::$ctax);
169
- }
170
- }
171
- }
172
-
173
- // shortcode for displaying the pretty link for the post/page
174
- public function get_pretty_link() {
175
- global $post, $plp_options, $prli_blogurl, $prli_link, $wp_query, $prli_link_meta;
176
-
177
- $ac = $plp_options->autocreate_option($post->post_type);
178
-
179
- // Don't show until published
180
- if($post->post_status != 'publish' ||
181
- // only show button if enabled and links are being generated
182
- ((is_single() || is_archive() || $wp_query->is_posts_page) && !$ac->enabled)) {
183
- return '';
184
- }
185
-
186
- $pretty_link_id = PrliUtils::get_prli_post_meta($post->ID,"_pretty-link",true);
187
- $pretty_link = $prli_link->getOne($pretty_link_id);
188
- $shorturl = $prli_blogurl.PrliUtils::get_permalink_pre_slug_uri().$pretty_link->slug;
189
-
190
- return $shorturl;
191
- }
192
-
193
- //This trim_empty_replacement_rows can go at some point in the future after we think everyone has upgraded to 2.0.0+
194
- //This is an attempt to boost some query performance on keyword/url replacements
195
- public function trim_empty_replacement_rows() {
196
- global $wpdb, $prli_link_meta, $plp_keyword;
197
-
198
- //This only ever needs to be run once, since I fixed the code that was causing the blank rows in the first place
199
- if(!get_option('prli_empty_replacement_rows_cleanup', false)) {
200
- $wpdb->query("DELETE FROM {$plp_keyword->table_name} WHERE text IS NULL OR text = ''");
201
- $wpdb->query("DELETE FROM {$prli_link_meta->table_name} WHERE meta_key = 'prli-url-replacements' AND (meta_value IS NULL OR meta_value = '')");
202
- update_option('prli_empty_replacement_rows_cleanup', true);
203
- wp_cache_delete('alloptions', 'options');
204
- }
205
- }
206
-
207
- //Should move this to WP CRON at some point and have this done in batches, instead of one at a time via the_content like it is currently happening
208
- public function run_autocreate($content = '') {
209
- global $post, $prli_utils, $prli_link, $prli_link_meta, $plp_options;
210
-
211
- //No post object or type or published status?
212
- if(!isset($post) || !$post instanceof WP_Post || (int)$post->ID <= 0 || !isset($post->post_type) || $post->post_status != "publish" || defined('REST_REQUEST')) {
213
- return $content;
214
- }
215
-
216
- $ac = $plp_options->autocreate_option($post->post_type);
217
-
218
- if($ac->enabled) {
219
- $plp_post_options = PlpPostOptions::get_options($post->ID);
220
- $pretty_link_id = PrliUtils::get_prli_post_meta($post->ID, '_pretty-link', true);
221
-
222
- // Try to find a pretty link that is using this link already
223
- if(!$pretty_link_id) {
224
- $pretty_link_id = $prli_link->find_first_target_url(get_permalink($post->ID));
225
- }
226
-
227
- $pretty_link = $prli_link->getOne($pretty_link_id);
228
-
229
- if(empty($pretty_link) or !$pretty_link) {
230
- $slug_available = $prli_utils->is_slug_available($plp_post_options->requested_slug);
231
-
232
- $slug = (is_wp_error($slug_available) ? '' : $plp_post_options->requested_slug);
233
-
234
- $pl_insert_id = prli_create_pretty_link(
235
- get_permalink($post->ID),
236
- $slug,
237
- !empty($post->post_title) ? addslashes($post->post_title) : __('Untitled', 'pretty-link'),
238
- addslashes($post->post_excerpt)
239
- );
240
- $new_pretty_link = $prli_link->getOne($pl_insert_id);
241
-
242
- PrliUtils::update_prli_post_meta($post->ID, '_pretty-link', $new_pretty_link->id, true);
243
- $link_cpt_id = $new_pretty_link->link_cpt_id;
244
-
245
- if ($ac->category) {
246
- wp_set_object_terms($link_cpt_id, $ac->category, PlpLinkCategoriesController::$ctax);
247
- }
248
- }
249
- }
250
-
251
- return $content;
252
- }
253
- } //End Class
254
-
255
- // Template Tag for displaying the pretty link for the post/page
256
- function the_prettylink() {
257
- $ctrl = new PlpPostsController();
258
- echo $ctrl->get_pretty_link();
259
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/app/controllers/PlpPrettyBarController.php DELETED
@@ -1,127 +0,0 @@
1
- <?php if(!defined('ABSPATH')) { die('You are not allowed to call this page directly.'); }
2
-
3
- // PrettyBar stuff here of course
4
- class PlpPrettyBarController extends PrliBaseController {
5
- public $field_names;
6
-
7
- public function __construct() {
8
- $this->field_names = array(
9
- 'prettybar_image_url' => 'prli_prettybar_image_url',
10
- 'prettybar_background_image_url' => 'prli_prettybar_background_image_url',
11
- 'prettybar_color' => 'prli_prettybar_color',
12
- 'prettybar_text_color' => 'prli_prettybar_text_color',
13
- 'prettybar_link_color' => 'prli_prettybar_link_color',
14
- 'prettybar_hover_color' => 'prli_prettybar_hover_color',
15
- 'prettybar_visited_color' => 'prli_prettybar_visited_color',
16
- 'prettybar_show_title' => 'prli_prettybar_show_title',
17
- 'prettybar_show_description' => 'prli_prettybar_show_description',
18
- 'prettybar_show_share_links' => 'prli_prettybar_show_share_links',
19
- 'prettybar_show_target_url_link' => 'prli_prettybar_show_target_url_link',
20
- 'prettybar_title_limit' => 'prli_prettybar_title_limit',
21
- 'prettybar_desc_limit' => 'prli_prettybar_desc_limit',
22
- 'prettybar_link_limit' => 'prli_prettybar_link_limit'
23
- );
24
- }
25
-
26
- public function load_hooks() {
27
- add_filter('prli-display-attrib-link', array($this,'display_attrib_link'));
28
- add_filter('prli-validate-options', array($this,'validate'));
29
- add_action('prli-store-options', array($this,'update'));
30
- }
31
-
32
- public function display_attrib_link($link_html) {
33
- global $plp_options;
34
-
35
- if( $plp_options->prettybar_hide_attrib_link == 1 ) { return ''; }
36
-
37
- if( !empty($plp_options->prettybar_attrib_url) ) {
38
- $link_html = preg_replace("#https://prettylinks.com/plp/pretty-bar/powered-by#",$plp_options->prettybar_attrib_url,$link_html);
39
- }
40
-
41
- return $link_html;
42
- }
43
-
44
- public function validate($errors) {
45
- global $prli_options;
46
-
47
- extract($this->field_names);
48
-
49
- if( !empty($_POST[$prettybar_image_url]) && !preg_match('/^http.?:\/\/.*\..*$/', $_POST[$prettybar_image_url] ) ) {
50
- $errors[] = __("Logo Image URL must be a correctly formatted URL", 'pretty-link');
51
- }
52
-
53
- if( !empty($_POST[$prettybar_background_image_url]) && !preg_match('/^http.?:\/\/.*\..*$/', $_POST[$prettybar_background_image_url] ) ) {
54
- $errors[] = __("Background Image URL must be a correctly formatted URL", 'pretty-link');
55
- }
56
-
57
- $color_pattern = "/^#?[0-9a-fA-F]{6}$/";
58
-
59
- if( !empty($_POST[ $prettybar_color ]) && !preg_match( $color_pattern, $_POST[ $prettybar_color ] ) ) {
60
- $errors[] = __("PrettyBar Background Color must be an actual RGB Value", 'pretty-link');
61
- }
62
-
63
- if( !empty($_POST[ $prettybar_text_color ]) && !preg_match( $color_pattern, $_POST[ $prettybar_text_color ] ) ) {
64
- $errors[] = __("PrettyBar Text Color must be an actual RGB Value", 'pretty-link');
65
- }
66
-
67
- if( !empty($_POST[ $prettybar_link_color ]) && !preg_match( $color_pattern, $_POST[ $prettybar_link_color ] ) ) {
68
- $errors[] = __("PrettyBar Link Color must be an actual RGB Value", 'pretty-link');
69
- }
70
-
71
- if( !empty($_POST[ $prettybar_hover_color ]) && !preg_match( $color_pattern, $_POST[ $prettybar_hover_color ] ) ) {
72
- $errors[] = __("PrettyBar Hover Color must be an actual RGB Value", 'pretty-link');
73
- }
74
-
75
- if( !empty($_POST[ $prettybar_visited_color ]) && !preg_match( $color_pattern, $_POST[ $prettybar_visited_color ] ) ) {
76
- $errors[] = __("PrettyBar Hover Color must be an actual RGB Value", 'pretty-link');
77
- }
78
-
79
- if( empty($_POST[ $prettybar_title_limit ]) ) {
80
- $errors[] = __("PrettyBar Title Character Limit must not be blank", 'pretty-link');
81
- }
82
-
83
- if( empty($_POST[ $prettybar_desc_limit ]) ) {
84
- $errors[] = __("PrettyBar Description Character Limit must not be blank", 'pretty-link');
85
- }
86
-
87
- if( empty($_POST[ $prettybar_link_limit ]) ) {
88
- $errors[] = __("PrettyBar Link Character Limit must not be blank", 'pretty-link');
89
- }
90
-
91
- if( !empty($_POST[ $prettybar_title_limit ]) && !preg_match( "#^[0-9]*$#", $_POST[ $prettybar_title_limit ] ) ) {
92
- $errors[] = __("PrettyBar Title Character Limit must be a number", 'pretty-link');
93
- }
94
-
95
- if( !empty($_POST[ $prettybar_desc_limit ]) && !preg_match( "#^[0-9]*$#", $_POST[ $prettybar_desc_limit ] ) ) {
96
- $errors[] = __("PrettyBar Description Character Limit must be a number", 'pretty-link');
97
- }
98
-
99
- if( !empty($_POST[ $prettybar_link_limit ]) && !preg_match( "#^[0-9]*$#", $_POST[ $prettybar_link_limit ] ) ) {
100
- $errors[] = __("PrettyBar Link Character Limit must be a number", 'pretty-link');
101
- }
102
-
103
- return $errors;
104
- }
105
-
106
- public function update($errors) {
107
- global $prli_options;
108
-
109
- extract($this->field_names);
110
-
111
- $prli_options->prettybar_image_url = isset($_POST[ $prettybar_image_url ]) && is_string($_POST[ $prettybar_image_url ]) ? esc_url_raw(trim(stripslashes($_POST[ $prettybar_image_url ]))) : '';
112
- $prli_options->prettybar_background_image_url = isset($_POST[ $prettybar_background_image_url ]) && is_string($_POST[ $prettybar_background_image_url ]) ? esc_url_raw(trim(stripslashes($_POST[ $prettybar_background_image_url ]))) : '';
113
- $prli_options->prettybar_color = isset($_POST[ $prettybar_color ]) && is_string($_POST[ $prettybar_color ]) ? sanitize_hex_color(stripslashes($_POST[ $prettybar_color ])) : '';
114
- $prli_options->prettybar_text_color = isset($_POST[ $prettybar_text_color ]) && is_string($_POST[ $prettybar_text_color ]) ? sanitize_hex_color(stripslashes($_POST[ $prettybar_text_color ])) : '';
115
- $prli_options->prettybar_link_color = isset($_POST[ $prettybar_link_color ]) && is_string($_POST[ $prettybar_link_color ]) ? sanitize_hex_color(stripslashes($_POST[ $prettybar_link_color ])) : '';
116
- $prli_options->prettybar_hover_color = isset($_POST[ $prettybar_hover_color ]) && is_string($_POST[ $prettybar_hover_color ]) ? sanitize_hex_color(stripslashes($_POST[ $prettybar_hover_color ])) : '';
117
- $prli_options->prettybar_visited_color = isset($_POST[ $prettybar_visited_color ]) && is_string($_POST[ $prettybar_visited_color ]) ? sanitize_hex_color(stripslashes($_POST[ $prettybar_visited_color ])) : '';
118
- $prli_options->prettybar_show_title = (int)isset($_POST[ $prettybar_show_title ]);
119
- $prli_options->prettybar_show_description = (int)isset($_POST[ $prettybar_show_description ]);
120
- $prli_options->prettybar_show_share_links = (int)isset($_POST[ $prettybar_show_share_links ]);
121
- $prli_options->prettybar_show_target_url_link = (int)isset($_POST[ $prettybar_show_target_url_link ]);
122
- $prli_options->prettybar_title_limit = isset($_POST[ $prettybar_title_limit ]) && is_numeric($_POST[ $prettybar_title_limit ]) ? (int) $_POST[ $prettybar_title_limit ] : 25;
123
- $prli_options->prettybar_desc_limit = isset($_POST[ $prettybar_desc_limit ]) && is_numeric($_POST[ $prettybar_desc_limit ]) ? (int) $_POST[ $prettybar_desc_limit ] : 30;
124
- $prli_options->prettybar_link_limit = isset($_POST[ $prettybar_link_limit ]) && is_numeric($_POST[ $prettybar_link_limit ]) ? (int) $_POST[ $prettybar_link_limit ] : 30;
125
- }
126
- }
127
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/app/controllers/PlpPublicLinksController.php DELETED
@@ -1,154 +0,0 @@
1
- <?php if(!defined('ABSPATH')) { die('You are not allowed to call this page directly.'); }
2
-
3
- class PlpPublicLinksController extends PrliBaseController {
4
- public function load_hooks() {
5
- global $plp_options;
6
-
7
- if($plp_options->allow_public_link_creation) {
8
- add_action( 'widgets_init', array($this, 'register_widget') );
9
-
10
- // Current, actual endpoint
11
- add_action( 'wp_ajax_plp-create-public-link', array( $this, 'create' ) );
12
- add_action( 'wp_ajax_nopriv_plp-create-public-link', array( $this, 'create' ) );
13
-
14
- }
15
-
16
- add_shortcode('prli_create_form', array($this,'public_create_form'));
17
- add_shortcode('prli_create_display', array($this,'public_link_display'));
18
- add_shortcode('prli_public_link_url', array($this,'public_link_display'));
19
- add_shortcode('prli_public_link_title', array($this,'public_link_title_display'));
20
- add_shortcode('prli_public_link_target_url', array($this,'public_link_target_url_display'));
21
- add_shortcode('prli_public_link_social_buttons', array($this,'public_link_social_buttons_display'));
22
- }
23
-
24
- public function register_widget() {
25
- return register_widget('PlpPublicLinksWidget');
26
- }
27
-
28
- public function create() {
29
- global $plp_options, $prli_options, $prli_link, $prli_blogurl;
30
-
31
- if($plp_options->allow_public_link_creation) {
32
- $_POST['slug'] = (isset($_POST['slug']) && is_string($_POST['slug']) && !empty($_POST['slug'])) ? sanitize_text_field(stripslashes($_POST['slug'])) : $prli_link->generateValidSlug();
33
-
34
- $errors = array();
35
-
36
- if (!isset($_POST['_wpnonce']) || !is_string($_POST['_wpnonce']) || !wp_verify_nonce($_POST['_wpnonce'], 'plp-create-public-link')) {
37
- $errors = array(__('Security check failed', 'pretty-link'));
38
- }
39
-
40
- $errors = array_merge($errors, $prli_link->validate($_POST));
41
-
42
- if( count($errors) > 0 ) {
43
- $url_param = ((!empty($url))?'&url='.urlencode(esc_url_raw(trim(stripslashes($_POST['url'])))):'');
44
- $referral_url = isset($_POST['referral-url']) && is_string($_POST['referral-url']) ? esc_url_raw(trim(stripslashes($_POST['referral-url']))) : home_url();
45
- header("Location: {$referral_url}?errors=" . urlencode(serialize($errors)).$url_param);
46
- }
47
- else {
48
- $redirect_type = isset($_POST['redirect_type']) && is_string($_POST['redirect_type']) ? sanitize_key($_POST['redirect_type']) : '307';
49
- $track = isset($_POST['track']) && is_numeric($_POST['track']) ? (int) $_POST['track'] : -1;
50
-
51
-
52
- unset($_POST['param_forwarding']);
53
- $_POST['param_struct'] = '';
54
- $_POST['name'] = '';
55
- $_POST['description'] = '';
56
-
57
- if($redirect_type == '-1') {
58
- $_POST['redirect_type'] = $prli_options->link_redirect_type;
59
- }
60
-
61
- if($track == '-1') {
62
- if( $prli_options->link_track_me ) {
63
- $_POST['track_me'] = 'on';
64
- }
65
- }
66
- else if( $track == '1' ) {
67
- $_POST['track_me'] = 'on';
68
- }
69
-
70
- if( $prli_options->link_nofollow ) {
71
- $_POST['nofollow'] = 'on';
72
- }
73
-
74
- if( $prli_options->link_sponsored ) {
75
- $_POST['sponsored'] = 'on';
76
- }
77
-
78
- $record = $prli_link->create( $_POST );
79
- $link = $prli_link->getOne($record);
80
-
81
- $category = isset($_POST['category']) && is_numeric($_POST['category']) ? (int) $_POST['category'] : -1;
82
-
83
- if ($category != -1) {
84
- wp_set_object_terms($link->link_cpt_id, $category, PlpLinkCategoriesController::$ctax);
85
- }
86
-
87
- if($plp_options->use_public_link_display_page) {
88
- header("Location: {$plp_options->public_link_display_page}?slug=".urlencode($link->slug));
89
- }
90
- else {
91
- $pretty_link = prli_get_pretty_link_url($link->id);
92
- $target_url = $link->url;
93
- $target_url_title = $link->name;
94
- $pretty_link_id = $link->id;
95
-
96
- require_once(PRLI_VIEWS_PATH . '/shared/public_link.php');
97
- }
98
- }
99
- }
100
- else {
101
- wp_redirect($prli_blogurl);
102
- }
103
-
104
- exit;
105
- }
106
-
107
- /**************** PUBLIC FACING URL CREATION SHORTCODES **********************/
108
- public function public_create_form($atts) {
109
- extract(shortcode_atts(array(
110
- 'label' => __('Enter a URL:', 'pretty-link'),
111
- 'button' => __('Shrink', 'pretty-link'),
112
- 'redirect_type' => '-1',
113
- 'track' => '-1',
114
- 'category' => '-1',
115
- ), $atts));
116
-
117
- return PlpPublicLinksHelper::display_form($label,$button,$redirect_type,$track,$category);
118
- }
119
-
120
- public function public_link_display()
121
- {
122
- if(isset($_GET['slug']) && is_string($_GET['slug'])) {
123
- $slug = sanitize_text_field(stripslashes($_GET['slug']));
124
- $link = prli_get_link_from_slug($slug);
125
- $url = prli_get_pretty_link_url($link->id);
126
- return sprintf('<a href="%1$s">%2$s</a>', esc_url($url), esc_html($url));
127
- }
128
- }
129
-
130
- public function public_link_title_display() {
131
- if(isset($_GET['slug']) && is_string($_GET['slug'])) {
132
- $slug = sanitize_text_field(stripslashes($_GET['slug']));
133
- $link = prli_get_link_from_slug($slug);
134
- return esc_html($link->name);
135
- }
136
- }
137
-
138
- public function public_link_target_url_display() {
139
- if(isset($_GET['slug']) && is_string($_GET['slug'])) {
140
- $slug = sanitize_text_field(stripslashes($_GET['slug']));
141
- $link = prli_get_link_from_slug($slug);
142
- return esc_url($link->url);
143
- }
144
- }
145
-
146
- public function public_link_social_buttons_display() {
147
- if(isset($_GET['slug']) && is_string($_GET['slug'])) {
148
- $slug = sanitize_text_field(stripslashes($_GET['slug']));
149
- $link = prli_get_link_from_slug($slug);
150
- return PlpSocialButtonsHelper::get_social_buttons_bar($link->id);
151
- }
152
- }
153
- }
154
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/app/controllers/PlpReportsController.php DELETED
@@ -1,344 +0,0 @@
1
- <?php if(!defined('ABSPATH')) { die('You are not allowed to call this page directly.'); }
2
-
3
- class PlpReportsController extends PrliBaseController {
4
- public function load_hooks() {
5
- add_action('prli-link-action', array($this, 'split_test_link'), 10, 1);
6
- add_action('plp_admin_menu', array($this, 'admin_menu'), 10, 1);
7
- }
8
-
9
- public function admin_menu($role) {
10
- $pl_link_cpt = PrliLink::$cpt;
11
-
12
- add_submenu_page(
13
- "edit.php?post_type={$pl_link_cpt}",
14
- esc_html__('Pretty Links Pro | Reports', 'pretty-link'),
15
- esc_html__('Reports', 'pretty-link'),
16
- $role, 'plp-reports',
17
- array( $this, 'route' )
18
- );
19
- }
20
-
21
- public function route() {
22
- global $plp_report;
23
- $params = $plp_report->get_params_array();
24
-
25
- $action = isset($params['action']) ? $params['action'] : null;
26
-
27
- switch($action) {
28
- case 'new':
29
- $this->new_report($params);
30
- break;
31
- case 'create':
32
- $this->create($params);
33
- break;
34
- case 'edit':
35
- $this->edit($params);
36
- break;
37
- case 'update':
38
- $this->update($params);
39
- break;
40
- case 'destroy':
41
- $this->destroy($params);
42
- break;
43
- case 'display-custom-report':
44
- $this->display_custom_report($params);
45
- break;
46
- case 'display-split-test-report':
47
- $this->display_split_test_report($params);
48
- break;
49
- case 'list':
50
- default:
51
- $prli_message = esc_html__('Create a custom link report and analyze your data.', 'pretty-link');
52
- $this->display_reports_list($params, $prli_message);
53
- }
54
- }
55
-
56
- public function split_test_link($link_id) {
57
- global $prli_link, $prli_link_meta;
58
-
59
- $link = $prli_link->getOne($link_id);
60
-
61
- if( $prli_link_meta->get_link_meta($link_id, 'prli-enable-split-test', true) ) {
62
- ?><a href="<?php echo esc_url(admin_url("admin.php?page=plp-reports&action=display-split-test-report&id={$link->id}")); ?>" title="<?php echo esc_attr(sprintf( __('View the Split Test Report for %s'), stripslashes($link->name) )); ?>"><i class="pl-list-icon pl-icon-chart-pie"></i></a><?php
63
- }
64
- }
65
-
66
- private function new_report($params) {
67
- global $prli_link;
68
-
69
- $links = $prli_link->getAll('',' ORDER BY li.name');
70
- $report_links = array();
71
-
72
- require_once(PLP_VIEWS_PATH.'/reports/new.php');
73
- }
74
-
75
- private function create($params) {
76
- global $prli_link, $plp_report;
77
-
78
- $values = array(
79
- 'name' => isset($_POST['name']) && is_string($_POST['name']) ? sanitize_text_field(stripslashes($_POST['name'])) : '',
80
- 'link' => isset($_POST['link']) && is_array($_POST['link']) ? array_map('intval', array_keys($_POST['link'])) : array(),
81
- 'goal_link_id' => isset($_POST['goal_link_id']) && is_numeric($_POST['goal_link_id']) ? (int) $_POST['goal_link_id'] : 0
82
- );
83
-
84
- $errors = $plp_report->validate($values);
85
-
86
- if( count($errors) > 0 ) {
87
- $links = $prli_link->getAll('',' ORDER BY li.name');
88
- $report_links = array();
89
- require_once(PLP_VIEWS_PATH.'/reports/new.php');
90
- }
91
- else {
92
- $insert_id = $plp_report->create( $values );
93
- $plp_report->update_report_links($insert_id, $values['link']);
94
- $prli_message = esc_html__("Your Pretty Link Report was Successfully Created", 'pretty-link');
95
- $this->display_reports_list($params, $prli_message, '', 1);
96
- }
97
- }
98
-
99
- private function edit($params) {
100
- global $prli_link, $plp_report;
101
-
102
- $record = $plp_report->getOne( $params['id'] );
103
- $id = $params['id'];
104
- $links = $prli_link->getAll('',' ORDER BY li.name');
105
- $report_links = $plp_report->get_report_links_array($id);
106
-
107
- require_once(PLP_VIEWS_PATH.'/reports/edit.php');
108
- }
109
-
110
- private function update($params) {
111
- global $prli_link, $plp_report;
112
-
113
- $values = array(
114
- 'name' => isset($_POST['name']) && is_string($_POST['name']) ? sanitize_text_field(stripslashes($_POST['name'])) : '',
115
- 'link' => isset($_POST['link']) && is_array($_POST['link']) ? array_map('intval', array_keys($_POST['link'])) : array(),
116
- 'goal_link_id' => isset($_POST['goal_link_id']) && is_numeric($_POST['goal_link_id']) ? (int) $_POST['goal_link_id'] : 0
117
- );
118
-
119
- $errors = $plp_report->validate($values);
120
- $id = isset($_POST['id']) ? (int) $_POST['id'] : 0;
121
-
122
- if( count($errors) > 0 ) {
123
- $links = $prli_link->getAll('',' ORDER BY li.name');
124
- $report_links = $plp_report->get_report_links_array($id);
125
- require_once(PLP_VIEWS_PATH.'/reports/edit.php');
126
- }
127
- else {
128
- $record = $plp_report->update( $id, $values );
129
- $plp_report->update_report_links($id, $values['link']);
130
- $prli_message = esc_html__("Your Pretty Link Report was Successfully Updated", 'pretty-link');
131
- $this->display_reports_list($params, $prli_message, '', 1);
132
- }
133
- }
134
-
135
- private function destroy($params) {
136
- global $plp_report;
137
-
138
- $plp_report->destroy( $params['id'] );
139
- $prli_message = esc_html__('Your Pretty Link Report was Successfully Deleted', 'pretty-link');
140
-
141
- $this->display_reports_list($params, $prli_message, '', 1);
142
- }
143
-
144
- private function display_custom_report($params) {
145
- global $prli_utils, $plp_report, $prli_link;
146
-
147
- $id = $params['id'];
148
-
149
- $start_timestamp = $prli_utils->get_start_date($params);
150
- $end_timestamp = $prli_utils->get_end_date($params);
151
-
152
- $start_timestamp = mktime(0, 0, 0, date('n', $start_timestamp), date('j', $start_timestamp), date('Y', $start_timestamp));
153
- $end_timestamp = mktime(0, 0, 0, date('n', $end_timestamp), date('j', $end_timestamp), date('Y', $end_timestamp) );
154
-
155
- $report = $plp_report->getOne($id);
156
-
157
- $links = $plp_report->get_report_links_array($id);
158
- $labels = $plp_report->get_labels_by_links($start_timestamp, $end_timestamp, $links);
159
- $hits = $plp_report->get_clicks_by_links($start_timestamp, $end_timestamp, $links);
160
- $uniques = $plp_report->get_clicks_by_links($start_timestamp, $end_timestamp, $links, true);
161
-
162
- $top_hits = $prli_utils->getTopValue($hits);
163
- $top_uniques = $prli_utils->getTopValue($uniques);
164
-
165
- if( !empty($report->goal_link_id) ) {
166
- $goal_link = $prli_link->getOne($report->goal_link_id);
167
- $conversions = $plp_report->get_conversions_by_links($start_timestamp,$end_timestamp,$links,$report->goal_link_id);
168
-
169
- $conv_rates = array();
170
- for($i=0; $i<count($links); $i++) {
171
- $conv_rates[] = (($hits[$i] > 0)?sprintf( "%0.2f", (float)($conversions[$i] / $hits[$i] * 100.0) ):'0.00');
172
- }
173
-
174
- $top_conversions = $prli_utils->getTopValue(array_values($conversions));
175
- $top_conv_rate = $prli_utils->getTopValue(array_values($conv_rates));
176
- }
177
- else {
178
- $goal_link = false;
179
- $conversions = $conv_rates = array();
180
- $top_conversions = $top_conv_rate = 0;
181
- }
182
-
183
- require_once(PLP_VIEWS_PATH.'/reports/custom-report.php');
184
- }
185
-
186
- private function display_split_test_report($params) {
187
- global $prli_utils, $plp_report, $prli_link, $prli_link_meta;
188
-
189
- $link_id = $params['id'];
190
-
191
- $goal_link_id = $prli_link_meta->get_link_meta($link_id, 'prli-split-test-goal-link', true);
192
-
193
- $link = $prli_link->getOne($link_id);
194
-
195
- $start_timestamp = $prli_utils->get_start_date($params);
196
- $end_timestamp = $prli_utils->get_end_date($params);
197
-
198
- $start_timestamp = mktime(0, 0, 0, date('n', $start_timestamp), date('j', $start_timestamp), date('Y', $start_timestamp));
199
- $end_timestamp = mktime(0, 0, 0, date('n', $end_timestamp), date('j', $end_timestamp), date('Y', $end_timestamp) );
200
-
201
- $links = $plp_report->get_split_report_links_array($link_id);
202
- $labels = $links;
203
- $hits_array = $plp_report->get_split_clicks($start_timestamp,$end_timestamp,$link_id);
204
- $uniques_array = $plp_report->get_split_clicks($start_timestamp,$end_timestamp,$link_id,true);
205
-
206
- $hits = array();
207
- $uniques = array();
208
-
209
- for($i=0;$i<count($links);$i++) {
210
- $hits[$i] = ((is_array($hits_array) && isset($hits_array[$links[$i]]) && !empty($hits_array[$links[$i]]))?$hits_array[$links[$i]]:0);
211
- $uniques[$i] = ((is_array($uniques_array) && isset($uniques_array[$links[$i]]) && !empty($uniques_array[$links[$i]]))?$uniques_array[$links[$i]]:0);
212
- }
213
-
214
- $top_hits = (($hits && is_array($hits))?$prli_utils->getTopValue($hits):0);
215
- $top_uniques = (($uniques && is_array($uniques))?$prli_utils->getTopValue($uniques):0);
216
-
217
- if( !empty($goal_link_id) && $goal_link_id ) {
218
- $goal_link = $prli_link->getOne($goal_link_id);
219
- $conversions_array = $plp_report->get_split_conversions($start_timestamp,$end_timestamp,$link_id,$goal_link_id);
220
-
221
- $conversions = array();
222
- for($i=0;$i<count($links);$i++) {
223
- $conversions[$i] = ((is_array($conversions_array) && isset($conversions_array[$links[$i]]) && !empty($conversions_array[$links[$i]]))?$conversions_array[$links[$i]]:0);
224
- }
225
-
226
- $conv_rates = array();
227
- for($i=0; $i<count($links); $i++) {
228
- $conv_rates[] = (($uniques[$i] > 0)?sprintf( "%0.2f", (float)($conversions[$i] / $uniques[$i] * 100.0) ):'0.00');
229
- }
230
-
231
- $top_conversions = $prli_utils->getTopValue(array_values($conversions));
232
- $top_conv_rate = $prli_utils->getTopValue(array_values($conv_rates));
233
- }
234
-
235
- require_once(PLP_VIEWS_PATH . '/reports/split-test-report.php');
236
- }
237
-
238
- private function display_reports_list( $params,
239
- $prli_message,
240
- $page_params_ov=false,
241
- $current_page_ov=false ) {
242
- global $wpdb, $prli_utils, $plp_report, $page_size;
243
-
244
- $report_vars = $this->get_report_sort_vars($params);
245
-
246
- if($current_page_ov) {
247
- $current_page = $current_page_ov;
248
- }
249
- else {
250
- $current_page = $params['paged'];
251
- }
252
-
253
- $page_params = '&action=list';
254
-
255
- if($page_params_ov) {
256
- $page_params .= $page_params_ov;
257
- }
258
- else {
259
- $page_params .= $report_vars['page_params'];
260
- }
261
-
262
- $sort_str = $report_vars['sort_str'];
263
- $sdir_str = $report_vars['sdir_str'];
264
- $search_str = $report_vars['search_str'];
265
-
266
- $record_count = $plp_report->getRecordCount($report_vars['where_clause']);
267
- $page_count = $plp_report->getPageCount($page_size,$report_vars['where_clause']);
268
- $reports = $plp_report->getPage($current_page,$page_size,$report_vars['where_clause'],$report_vars['order_by']);
269
- $page_last_record = $prli_utils->getLastRecordNum($record_count,$current_page,$page_size);
270
- $page_first_record = $prli_utils->getFirstRecordNum($record_count,$current_page,$page_size);
271
-
272
- require_once(PLP_VIEWS_PATH . '/reports/list.php');
273
- }
274
-
275
- private function get_report_sort_vars($params,$where_clause = '') {
276
- $order_by = '';
277
- $page_params = '';
278
-
279
- // These will have to work with both get and post
280
- $sort_str = $params['sort'];
281
- $sdir_str = $params['sdir'];
282
- $search_str = $params['search'];
283
-
284
- // Insert search string
285
- if(!empty($search_str)) {
286
- global $wpdb;
287
- $search_params = explode(" ", $search_str);
288
-
289
- foreach($search_params as $search_param) {
290
- if(!empty($where_clause)) {
291
- $where_clause .= " AND";
292
- }
293
-
294
- $search_param = '%' . $wpdb->esc_like($search_param) . '%';
295
-
296
- //goal_link_name doesn't exist any longer
297
- $where_clause .= $wpdb->prepare(
298
- " (rp.name like %s OR rp.created_at like %s)",
299
- $search_param,
300
- $search_param
301
- );
302
- }
303
-
304
- $page_params .="&search=$search_str";
305
- }
306
-
307
- // make sure page params stay correct
308
- if(!empty($sort_str)) {
309
- $page_params .="&sort=$sort_str";
310
- }
311
-
312
- if(!empty($sdir_str)) {
313
- $page_params .= "&sdir=$sdir_str";
314
- }
315
-
316
- // Add order by clause
317
- switch($sort_str) {
318
- case 'name':
319
- case 'goal_link_name':
320
- case 'link_count':
321
- $order_by .= " ORDER BY {$sort_str}";
322
- break;
323
- default:
324
- $order_by .= ' ORDER BY created_at';
325
- }
326
-
327
- // Toggle ascending / descending
328
- if((empty($sort_str) and empty($sdir_str)) or $sdir_str == 'desc') {
329
- $order_by .= ' DESC';
330
- $sdir_str = 'desc';
331
- }
332
- else {
333
- $sdir_str = 'asc';
334
- }
335
-
336
- return array( 'order_by' => $order_by,
337
- 'sort_str' => $sort_str,
338
- 'sdir_str' => $sdir_str,
339
- 'search_str' => $search_str,
340
- 'where_clause' => $where_clause,
341
- 'page_params' => $page_params );
342
- }
343
- }
344
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/app/controllers/PlpSocialButtonsController.php DELETED
@@ -1,71 +0,0 @@
1
- <?php if(!defined('ABSPATH')) { die('You are not allowed to call this page directly.'); }
2
-
3
- class PlpSocialButtonsController extends PrliBaseController {
4
- public function load_hooks() {
5
- add_filter('the_content', array($this, 'add_social_buttons_to_content'), 1000); //WARNING - This priority must be higher than keyword replacements
6
- add_filter('get_the_excerpt', array($this, 'excerpt_remove_social_buttons'), 1);
7
- add_shortcode('social_buttons_bar', array($this,'social_buttons_bar'));
8
- }
9
-
10
- public function social_buttons_bar() {
11
- global $post, $plp_options, $wp_query;
12
-
13
- if(!isset($post) || !isset($post->ID)) { return ''; }
14
-
15
- $plp_post_options = PlpPostOptions::get_options($post->ID);
16
- $ac = $plp_options->autocreate_option($post->post_type);
17
-
18
- if(get_post_status($post->ID) != 'publish' || // Don't show until published
19
- $plp_post_options->hide_social_buttons || // Don't show if post is hidden
20
- (is_feed() && !$plp_options->social_buttons_show_in_feed) || // Only show in feed if option checked
21
- !$ac->enabled || !$ac->socbtns) // Only show if links enabled and social button
22
- { return ''; }
23
-
24
- $pretty_link_id = PrliUtils::get_prli_post_meta($post->ID,"_pretty-link",true);
25
-
26
- return PlpSocialButtonsHelper::get_social_buttons_bar($pretty_link_id);
27
- }
28
-
29
- // Puts a tweet this button on each post
30
- public function add_social_buttons_to_content($content) {
31
- global $plp_options;
32
-
33
- //Don't run this more than once
34
- static $here;
35
- if(isset($here) && $here === true) { return $content; }
36
- $here = true;
37
-
38
- if($plp_options->social_buttons_placement == 'none') {
39
- return $content;
40
- }
41
-
42
- $social_buttons = $this->social_buttons_bar();
43
-
44
- if(!empty($social_buttons)) {
45
- if($plp_options->social_buttons_placement == 'bottom') {
46
- return "{$content}{$social_buttons}";
47
- }
48
- else if($plp_options->social_buttons_placement == 'top') {
49
- return "{$social_buttons}{$content}";
50
- }
51
- else if($plp_options->social_buttons_placement == 'top-and-bottom') {
52
- return "{$social_buttons}{$content}{$social_buttons}";
53
- }
54
- }
55
- else {
56
- return $content;
57
- }
58
- }
59
-
60
- public function excerpt_remove_social_buttons($excerpt) {
61
- if(!is_feed()) { remove_filter('the_content', array($this,'add_social_buttons_to_content')); }
62
- return $excerpt;
63
- }
64
- }
65
-
66
- // The template tag for social buttons
67
- function the_social_buttons_bar() {
68
- $ctrl = new PlpSocialButtonsController();
69
- echo $ctrl->social_buttons_bar();
70
- }
71
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/app/controllers/PlpToolsController.php DELETED
@@ -1,18 +0,0 @@
1
- <?php if(!defined('ABSPATH')) { die('You are not allowed to call this page directly.'); }
2
-
3
- class PlpToolsController extends PrliBaseController {
4
- public function load_hooks() {
5
- add_action( 'prli_admin_tools_nav', array( $this, 'bookmarklet_nav' ) );
6
- add_action( 'prli_admin_tools_pages', array( $this, 'bookmarklet_generator' ) );
7
- }
8
-
9
- public function bookmarklet_generator() {
10
- global $prli_blogurl, $prli_options;
11
- require( PLP_VIEWS_PATH . '/tools/generator.php' );
12
- }
13
-
14
- public function bookmarklet_nav() {
15
- require( PLP_VIEWS_PATH . '/tools/nav.php' );
16
- }
17
- }
18
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/app/controllers/PlpTwitterController.php DELETED
@@ -1,22 +0,0 @@
1
- <?php
2
- if(!defined('ABSPATH')) { die('You are not allowed to call this page directly.'); }
3
-
4
- // DEPRECATED
5
- class PlpTwitterController extends PrliBaseController {
6
- public function load_hooks() {
7
- // Gracefully deprecated shortcode
8
- add_shortcode('tweetbadge', array($this,'the_tweetbadge'));
9
- }
10
- }
11
-
12
- // Template Tag for Tweet Badge
13
- function the_tweetbadge() {
14
- // No longer supported
15
- }
16
-
17
- // Template Tag for Tweet Comments
18
- // Gracefully ignore comments if this tag is in use
19
- function the_tweet_comments() {
20
- // No longer supported
21
- }
22
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/app/controllers/index.php DELETED
@@ -1,2 +0,0 @@
1
- <?php /* Silence will fall */ ?>
2
-
 
 
pro/app/helpers/PlpLinksHelper.php DELETED
@@ -1,36 +0,0 @@
1
- <?php if(!defined('ABSPATH')) { die('You are not allowed to call this page directly.'); }
2
-
3
- class PlpLinksHelper {
4
- public static function rotation_weight_dropdown($rotation_weight, $select_name="url_rotation_weights[]") {
5
- ?>
6
- <select name="<?php echo esc_attr($select_name); ?>">
7
- <?php for($p=0; $p<=100; $p+=1) { ?>
8
- <option value="<?php echo esc_attr($p); ?>"<?php selected((int)$p, (int)$rotation_weight); ?>><?php echo esc_html($p); ?>%&nbsp;</option>
9
- <?php } ?>
10
- </select>
11
- <?php
12
- }
13
-
14
- public static function rotation_row($rotation, $weight, $select_name="url_rotations[]", $weight_select_name="url_rotation_weights[]") {
15
- ?>
16
- <li>
17
- <input type="text" class="regular-text" name="<?php echo esc_attr($select_name); ?>" value="<?php echo esc_attr($rotation); ?>" />
18
- <?php esc_html_e('weight:', 'pretty-link'); ?>
19
- <?php self::rotation_weight_dropdown($weight); ?>
20
- </li>
21
- <?php
22
- }
23
-
24
- public static function geo_row($geo_url='', $geo_countries='') {
25
- require(PLP_VIEWS_PATH.'/links/geo_row.php');
26
- }
27
-
28
- public static function tech_row($tech_url='', $tech_device='', $tech_os='', $tech_browser='') {
29
- require(PLP_VIEWS_PATH.'/links/tech_row.php');
30
- }
31
-
32
- public static function time_row($time_url='', $time_start='', $time_end='') {
33
- require(PLP_VIEWS_PATH.'/links/time_row.php');
34
- }
35
- }
36
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/app/helpers/PlpOptionsHelper.php DELETED
@@ -1,36 +0,0 @@
1
- <?php if(!defined('ABSPATH')) die('You are not allowed to call this page directly.');
2
-
3
- class PlpOptionsHelper {
4
- public static function autocreate_post_options($post_type, $option, $category, $socbtns) {
5
- // For reverse-compatibility
6
- if($post_type=='post' || $post_type=='page') {
7
- $option_name = "prli_{$post_type}s_auto";
8
- $category_name = "prli_{$post_type}s_category";
9
- $socbtns_name = "prli_social_{$post_type}s_buttons";
10
- }
11
- else {
12
- $option_name = "prli_autocreate[{$post_type}][enabled]";
13
- $category_name = "prli_autocreate[{$post_type}][category]";
14
- $socbtns_name = "prli_autocreate[{$post_type}][socbtns]";
15
- }
16
-
17
- $p = get_post_type_object($post_type);
18
-
19
- require(PLP_VIEWS_PATH . '/options/autocreate.php');
20
- }
21
-
22
- public static function autocreate_all_cpt_options() {
23
- global $plp_options;
24
-
25
- $post_types = $plp_options->get_post_types(false);
26
-
27
- foreach($post_types as $post_type) {
28
- $option = !empty($plp_options->autocreate[$post_type]['enabled']);
29
- $category = !empty($plp_options->autocreate[$post_type]['category']) ? $plp_options->autocreate[$post_type]['category'] : '';
30
- $socbtns = !empty($plp_options->autocreate[$post_type]['socbtns']);
31
-
32
- self::autocreate_post_options($post_type, $option, $category, $socbtns);
33
- }
34
- }
35
- }
36
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/app/helpers/PlpPostsHelper.php DELETED
@@ -1,84 +0,0 @@
1
- <?php if(!defined('ABSPATH')) { die('You are not allowed to call this page directly.'); }
2
-
3
- class PlpPostsHelper {
4
- public static function post_options($post) {
5
- global $plp_options;
6
-
7
- $plp_post_options = PlpPostOptions::get_options($post->ID);
8
- $ac = $plp_options->autocreate_option($post->post_type);
9
- $post_types = $plp_options->get_post_types();
10
-
11
- ?>
12
- <!-- The NONCE below prevents post meta from being blanked on move to trash -->
13
- <input type="hidden" name="plp_nonce" value="<?php echo wp_create_nonce('plp_nonce'.wp_salt()); ?>" />
14
- <?php
15
-
16
- if( $ac->socbtns ) {
17
- $checked = $plp_post_options->hide_social_buttons;
18
- ?>
19
- <span><input type="checkbox" name="hide_social_buttons" id="hide_social_buttons"<?php checked($checked); ?> />&nbsp;<?php esc_html_e('Hide Social Buttons on this post.', 'pretty-link'); ?></span><br/>
20
- <?php
21
- }
22
-
23
- if(in_array($post->post_type, $post_types) && $plp_options->keyword_replacement_is_on ) {
24
- $checked = $plp_post_options->disable_replacements;
25
- ?>
26
- <span><input type="checkbox" name="disable_replacements" id="disable_replacements"<?php checked($checked); ?> />&nbsp;<?php esc_html_e('Disable Keyword Replacements on this post.', 'pretty-link'); ?></span><br/>
27
- <?php
28
- }
29
- }
30
-
31
- public static function post_sidebar($post) {
32
- global $prli_blogurl, $plp_options, $prli_link, $prli_link_meta;
33
-
34
- $plp_post_options = PlpPostOptions::get_options($post->ID);
35
- $ac = $plp_options->autocreate_option($post->post_type);
36
-
37
- do_action('prlipro_sidebar_top');
38
-
39
- // Make sure the prli process routines are called on submit
40
- ?><input type="hidden" name="prli_process_tweet_form" id="prli_process_tweet_form" value="Y" /><?php
41
-
42
- if($post->post_status != 'publish') {
43
- ?>
44
- <div><?php esc_html_e('A Pretty Link will be created on Publish', 'pretty-link'); ?></div>
45
- <div>
46
- <strong><?php echo esc_url($prli_blogurl . PrliUtils::get_permalink_pre_slug_uri()); ?></strong>
47
- <input type="text" style="width: 100px;" name="prli_req_slug" id="prli_req_slug" value="<?php echo esc_attr((!empty($plp_post_options->requested_slug))?$plp_post_options->requested_slug:$prli_link->generateValidSlug()); ?>" />
48
- </div>
49
- <?php
50
- }
51
- else {
52
- $pretty_link_id = PrliUtils::get_prli_post_meta($post->ID,"_pretty-link",true);
53
- $pretty_link = $prli_link->getOne($pretty_link_id, OBJECT, true);
54
-
55
- if(!empty($pretty_link) && $pretty_link) {
56
- $pretty_link_url = $prli_blogurl.PrliUtils::get_permalink_pre_slug_uri().$pretty_link->slug;
57
-
58
- ?>
59
- <p>
60
- <span style="font-size: 24px;"><?php echo esc_html((empty($pretty_link->clicks) || $pretty_link->clicks===false)?0:$pretty_link->clicks); ?></span>
61
- <?php esc_html_e('Clicks', 'pretty-link'); ?>&nbsp;&nbsp;
62
- <span style="font-size: 24px;"><?php echo esc_html((empty($pretty_link->uniques) || $pretty_link->uniques===false)?0:$pretty_link->uniques); ?></span>
63
- <?php esc_html_e('Uniques', 'pretty-link'); ?>
64
- </p>
65
- <p>
66
- <?php esc_html_e('Pretty Link:', 'pretty-link'); ?><br/>
67
- <strong><?php echo esc_url($pretty_link_url); ?></strong><br/>
68
- <a href="<?php echo esc_url(admin_url("post.php?post={$pretty_link->link_cpt_id}&action=edit")); ?>"><?php esc_html_e('edit', 'pretty-link'); ?></a>
69
- |
70
- <a href="<?php echo esc_url($pretty_link_url); ?>" target="_blank" title="<?php esc_attr_e('Visit Pretty Link:', 'pretty-link'); echo esc_html($pretty_link_url); esc_html_e('in a New Window', 'pretty-link'); ?>"><?php esc_html_e('visit', 'pretty-link'); ?></a>
71
- </p>
72
- <?php
73
- }
74
- else {
75
- ?>
76
- <p><?php esc_html_e('A Pretty Link hasn\'t been generated for this entry yet. Click "Update Post" to generate.', 'pretty-link'); ?></p>
77
- <p><strong><?php echo esc_url($prli_blogurl . PrliUtils::get_permalink_pre_slug_uri()); ?></strong><input type="text" style="width: 100px;" name="prli_req_slug" id="prli_req_slug" value="<?php echo esc_attr((!empty($plp_post_options->requested_slug))?$plp_post_options->requested_slug:$prli_link->generateValidSlug()); ?>" />
78
- </p>
79
- <?php
80
- }
81
- }
82
- }
83
- }
84
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/app/helpers/PlpPrettyBarHelper.php DELETED
@@ -1,65 +0,0 @@
1
- <?php if(!defined('ABSPATH')) { die('You are not allowed to call this page directly.'); }
2
-
3
- // PrettyBar stuff here of course
4
- class PlpPrettyBarHelper {
5
- public static function render_prettybar($slug) {
6
- global $prli_blogurl, $prli_link, $prli_options, $prli_blogname, $prli_blogdescription, $target_url;
7
-
8
- if($link = $prli_link->getOneFromSlug( $slug )) {
9
- $bar_image = $prli_options->prettybar_image_url;
10
- $bar_background_image = $prli_options->prettybar_background_image_url;
11
- $bar_color = $prli_options->prettybar_color;
12
- $bar_text_color = $prli_options->prettybar_text_color;
13
- $bar_link_color = $prli_options->prettybar_link_color;
14
- $bar_visited_color = $prli_options->prettybar_visited_color;
15
- $bar_hover_color = $prli_options->prettybar_hover_color;
16
- $bar_show_title = $prli_options->prettybar_show_title;
17
- $bar_show_description = $prli_options->prettybar_show_description;
18
- $bar_show_share_links = $prli_options->prettybar_show_share_links;
19
- $bar_show_target_url_link = $prli_options->prettybar_show_target_url_link;
20
- $bar_title_limit = (int)$prli_options->prettybar_title_limit;
21
- $bar_desc_limit = (int)$prli_options->prettybar_desc_limit;
22
- $bar_link_limit = (int)$prli_options->prettybar_link_limit;
23
-
24
- $target_url = $link->url;
25
-
26
- $shortened_title = stripslashes(substr($prli_blogname,0,$bar_title_limit));
27
- $shortened_desc = stripslashes(substr($prli_blogdescription,0,$bar_desc_limit));
28
- $shortened_link = stripslashes(substr($target_url,0,$bar_link_limit));
29
-
30
- if(strlen($prli_blogname) > $bar_title_limit) {
31
- $shortened_title .= "...";
32
- }
33
-
34
- if(strlen($prli_blogdescription) > $bar_desc_limit) {
35
- $shortened_desc .= "...";
36
- }
37
-
38
- if(strlen($target_url) > $bar_link_limit) {
39
- $shortened_link .= "...";
40
- }
41
-
42
- wp_register_style('fontello-animation', PRLI_VENDOR_LIB_URL.'/fontello/css/animation.css', array(), PRLI_VERSION);
43
- wp_register_style('fontello-pretty-link', PRLI_VENDOR_LIB_URL.'/fontello/css/pretty-link.css', array(), PRLI_VERSION);
44
- wp_register_style('prli-prettybar', PLP_CSS_URL.'/prettybar.css', array(), PRLI_VERSION);
45
-
46
- $css = '';
47
-
48
- if(!empty($bar_background_image) && $bar_background_image) {
49
- $css .= sprintf('html, body { background-image: url(%s); background-repeat: repeat-x; }', esc_url($bar_background_image));
50
- } else {
51
- $css .= sprintf('html, body { background-color: %s; }', esc_html($bar_color));
52
- }
53
-
54
- $css .= sprintf('html, body { color: %s; }', esc_html($bar_text_color));
55
- $css .= sprintf('a { color: %s; }', esc_html($bar_link_color));
56
- $css .= sprintf('a:visited { color: %s; }', esc_html($bar_visited_color));
57
- $css .= sprintf('a:hover { color: %s; }', esc_html($bar_hover_color));
58
-
59
- wp_add_inline_style('prli-prettybar', $css);
60
-
61
- require(PLP_VIEWS_PATH . '/links/prettybar.php');
62
- }
63
- }
64
- }
65
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/app/helpers/PlpPublicLinksHelper.php DELETED
@@ -1,19 +0,0 @@
1
- <?php
2
- if(!defined('ABSPATH')) { die('You are not allowed to call this page directly.'); }
3
-
4
- class PlpPublicLinksHelper {
5
- public static function display_form($label=null, $button=null, $redirect_type=null, $track=null, $category=null) {
6
- $label = is_null($label)?__('Enter a URL:', 'pretty-link'):$label;
7
- $button = is_null($button)?__('Shrink', 'pretty-link'):$button;
8
- $track = is_null($track)?'-1':$track;
9
- $category = is_null($category)?'-1':$category;
10
- $redirect_type = is_null($redirect_type)?'-1':$redirect_type;
11
-
12
- ob_start();
13
- require(PLP_VIEWS_PATH . '/public/form.php');
14
- $formhtml = ob_get_clean();
15
-
16
- return $formhtml;
17
- }
18
- }
19
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/app/helpers/PlpSocialButtonsHelper.php DELETED
@@ -1,65 +0,0 @@
1
- <?php
2
- if(!defined('ABSPATH')) { die('You are not allowed to call this page directly.'); }
3
-
4
- class PlpSocialButtonsHelper {
5
- public static function get_social_buttons_bar($pretty_link_id) {
6
- global $prli_blogurl, $plp_options, $prli_link, $prli_link_meta;
7
-
8
- $pretty_link = $prli_link->getOne($pretty_link_id);
9
-
10
- if(is_object($pretty_link)) {
11
- $shorturl = apply_filters(
12
- 'prli_social_bar_url',
13
- $prli_blogurl.PrliUtils::get_permalink_pre_slug_uri().$pretty_link->slug,
14
- $pretty_link_id
15
- );
16
- }
17
- else {
18
- return '';
19
- }
20
-
21
- // If there's no short url then don't show the badge
22
- if(empty($shorturl)) { return ''; }
23
-
24
- $tweet_message = PlpTwitterHelper::get_twitter_status_message($shorturl,$pretty_link->name);
25
- $tweet_message = urlencode(trim(strip_tags($tweet_message)));
26
-
27
- $encoded_url = urlencode($shorturl);
28
- $encoded_title = urlencode($pretty_link->name);
29
-
30
- $patterns = array( '/\{\{encoded_url\}\}/', '/\{\{encoded_title\}\}/', '/\{\{tweet_message\}\}/' );
31
- $replacements = compact( 'encoded_url', 'encoded_title', 'tweet_message' );
32
-
33
- $show_bar = false;
34
-
35
- $social_buttons = apply_filters('prli_social_bar_obj', $plp_options->social_buttons, $pretty_link, $shorturl, $replacements);
36
-
37
- ob_start();
38
- ?>
39
- <ul class="prli-social-buttons">
40
- <?php
41
-
42
- foreach($social_buttons as $b) {
43
- if( $b['checked'] ) {
44
- $show_bar = true; // if we have even one button, we show the social bar
45
- $button_url = preg_replace( $patterns, $replacements, $b['url'] );
46
- ?>
47
- <li>
48
- <a class="pl-social-<?php echo esc_attr($b['slug']); ?>-button" href="<?php echo esc_url($button_url); ?>" rel="nofollow" target="_blank" onclick="javascript:window.open(this.href, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600');return false;">
49
- <i class="<?php echo esc_attr($b['icon']); ?>"> </i>
50
- </a>
51
- </li>
52
- <?php
53
- }
54
- }
55
-
56
- ?>
57
- </ul>
58
- <?php
59
-
60
- $social_buttons = $show_bar ? ob_get_clean() : '';
61
-
62
- return apply_filters('prli_social_bar_html', $social_buttons, $pretty_link, $shorturl, $replacements);
63
- }
64
- }
65
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/app/helpers/PlpTwitterHelper.php DELETED
@@ -1,26 +0,0 @@
1
- <?php
2
- if(!defined('ABSPATH')) { die('You are not allowed to call this page directly.'); }
3
-
4
- class PlpTwitterHelper {
5
- public static function get_twitter_status_message($pretty_link_url, $pretty_link_name, $tweet_format="{%title%} {%url%}") {
6
- global $plp_options;
7
-
8
- //ADDED BY PAUL 1.5.5 - fix for $29.99 being in post title
9
- $pretty_link_name = str_replace("$", "%24", $pretty_link_name);
10
-
11
- $tweet_message = preg_replace("#\{\%title\%\}#", stripslashes($pretty_link_name), $tweet_format);
12
- $tweet_message = preg_replace("#\{\%url\%\}#", $pretty_link_url, $tweet_message);
13
-
14
- // 120 to leave room for retweeting a 140 char tweet
15
- if(strlen($tweet_message) > 120) {
16
- $non_title_size = strlen($tweet_message) - strlen($pretty_link_name);
17
- $title_size = 120 - $non_title_size;
18
- $link_title = substr($pretty_link_name, 0, $title_size);
19
- $tweet_message = preg_replace("#\{\%title\%\}#", stripslashes($link_title), $tweet_format);
20
- $tweet_message = preg_replace("#\{\%url\%\}#", $pretty_link_url, $tweet_message);
21
- }
22
-
23
- return $tweet_message;
24
- }
25
- }
26
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/app/helpers/index.php DELETED
@@ -1,2 +0,0 @@
1
- <?php /* Silence will fall */ ?>
2
-
 
 
pro/app/index.php DELETED
@@ -1,2 +0,0 @@
1
- <?php /* Silence will fall */ ?>
2
-
 
 
pro/app/models/PlpKeyword.php DELETED
@@ -1,724 +0,0 @@
1
- <?php
2
- if(!defined('ABSPATH')) { die('You are not allowed to call this page directly.'); }
3
-
4
- class PlpKeyword {
5
- public $table_name, $post_keywords_table_name;
6
-
7
- public function __construct() {
8
- global $wpdb;
9
- $this->table_name = "{$wpdb->prefix}prli_keywords";
10
- $this->post_keywords_table_name = "{$wpdb->prefix}prli_post_keywords";
11
- }
12
-
13
- public function create($keyword,$link_id) {
14
- global $wpdb;
15
-
16
- $query_str = "
17
- INSERT INTO {$this->table_name}
18
- (text, link_id, created_at)
19
- VALUES
20
- (%s,%d,NOW())
21
- ";
22
-
23
- $query = $wpdb->prepare(
24
- $query_str,
25
- $keyword,
26
- $link_id
27
- );
28
-
29
- $query_results = $wpdb->query($query);
30
-
31
- if($query_results) {
32
- return $wpdb->insert_id;
33
- }
34
- else {
35
- return false;
36
- }
37
- }
38
-
39
- public function get_removed_keywords($link_id, $keywords) {
40
- global $wpdb;
41
-
42
- $keywords = array_map(
43
- function($kw) {
44
- return trim($kw);
45
- },
46
- $keywords
47
-
48
- );
49
-
50
- $q = $wpdb->prepare("
51
- SELECT kw.*
52
- FROM {$this->table_name} AS kw
53
- WHERE kw.link_id=%d
54
- ",
55
- $link_id
56
- );
57
- $kws = $wpdb->get_results($q);
58
-
59
- $removed_ids = array();
60
- if(is_array($kws) && !empty($kws)) {
61
- foreach($kws as $kw) {
62
- if(!in_array($kw->text, $keywords)) {
63
- $removed_ids[] = $kw->id;
64
- }
65
- }
66
- }
67
-
68
- return $removed_ids;
69
- }
70
-
71
- public function delete_removed_keywords($link_id, $keywords) {
72
- global $wpdb;
73
-
74
- $keywords = explode(',',$keywords);
75
-
76
- $removed_ids = $this->get_removed_keywords($link_id, $keywords);
77
-
78
- if(!empty($removed_ids)) {
79
- $idstr = implode(',', $removed_ids);
80
-
81
- // Clear the index of these keywords
82
- $q = "
83
- DELETE FROM {$this->post_keywords_table_name}
84
- WHERE keyword_id IN ({$idstr})
85
- ";
86
- $wpdb->query($q);
87
-
88
- // Clear the keywords themselves
89
- $q = "
90
- DELETE FROM {$this->table_name}
91
- WHERE id IN ({$idstr})
92
- ";
93
- $wpdb->query($q);
94
- }
95
- }
96
-
97
- public function get_added_keywords($link_id, $keywords) {
98
- global $wpdb;
99
-
100
- $keywords = array_map(
101
- function($kw) {
102
- return trim($kw);
103
- },
104
- $keywords
105
- );
106
-
107
- $q = $wpdb->prepare("
108
- SELECT text
109
- FROM {$this->table_name} AS kw
110
- WHERE kw.link_id=%d
111
- ",
112
- $link_id
113
- );
114
- $kws = $wpdb->get_col($q);
115
-
116
- return array_diff($keywords, $kws);
117
- }
118
-
119
- public function create_added_keywords($link_id, $keywords) {
120
- $keywords = explode(',',$keywords);
121
-
122
- $added_keywords = $this->get_added_keywords($link_id, $keywords);
123
-
124
- // Create the new keywords
125
- foreach($added_keywords as $added_keyword) {
126
- if(!empty($added_keyword)) { //Don't save an empty keyword
127
- $this->create(trim($added_keyword), $link_id);
128
- }
129
- }
130
- }
131
-
132
- public function updateLinkKeywords($link_id,$keywords) {
133
- // Get rid of the old keywords
134
- //$this->destroyByLinkId($link_id);
135
-
136
- $this->delete_removed_keywords($link_id, $keywords);
137
- $this->create_added_keywords($link_id, $keywords);
138
- }
139
-
140
- public function destroy( $id ) {
141
- global $wpdb;
142
- $query_str = "DELETE FROM {$this->table_name} WHERE id=%d";
143
- $query = $wpdb->prepare($query_str,$id);
144
- return $wpdb->query($query);
145
- }
146
-
147
- public function destroyByLinkId( $link_id ) {
148
- global $wpdb;
149
- $query_str = "DELETE FROM {$this->table_name} WHERE link_id=%d";
150
- $query = $wpdb->prepare($query_str,$link_id);
151
- return $wpdb->query($query);
152
- }
153
-
154
- public function getOne( $id, $return_type = OBJECT ) {
155
- global $wpdb;
156
- $query_str = "SELECT * FROM {$this->table_name} WHERE id=%d";
157
- $query = $wpdb->prepare($query_str,$id);
158
- return $wpdb->get_row($query, $return_type);
159
- }
160
-
161
- public function getAllByLinkId( $link_id, $return_type = OBJECT ) {
162
- global $wpdb;
163
- $query_str = "SELECT * FROM {$this->table_name} WHERE link_id=%d ORDER BY text";
164
- $query = $wpdb->prepare($query_str,$link_id);
165
- return $wpdb->get_results($query, $return_type);
166
- }
167
-
168
- public function getTextByLinkId( $link_id ) {
169
- $keywords = $this->getAllByLinkId( $link_id );
170
-
171
- $keywords_array = array();
172
- foreach($keywords as $keyword)
173
- $keywords_array[] = stripslashes(htmlspecialchars($keyword->text));
174
-
175
- return implode( ', ', $keywords_array );
176
- }
177
-
178
- public function getAllUniqueKeywordsText() {
179
- global $wpdb;
180
- $query = "SELECT DISTINCT text FROM {$this->table_name}";
181
- return $wpdb->get_col($query, 0);
182
- }
183
-
184
- public function getAll($where = '', $return_type = OBJECT) {
185
- global $wpdb, $prli_utils;
186
- $query_str = "SELECT * FROM {$this->table_name}" . $prli_utils->prepend_and_or_where(' WHERE', $where) . " ORDER BY text";
187
- return $wpdb->get_results($query_str, $return_type);
188
- }
189
-
190
- // Returns an array of links that have this keyword
191
- public function getLinksByKeyword($keyword) {
192
- global $wpdb;
193
- $query_str = "SELECT link_id FROM {$this->table_name} WHERE text=%s";
194
- $query = $wpdb->prepare($query_str,$keyword);
195
- return $wpdb->get_col($query,0);
196
- }
197
-
198
- public function request_url_matches_url($url) {
199
- $url_pattern = $url;
200
- $url_pattern = preg_replace('!^https?!','^https?',$url_pattern); // http / https
201
- $url_pattern = preg_replace('!\/\\?!','/?\\?',$url_pattern); // optional trailing slash
202
- $url_pattern = preg_replace('!\/$!','/?',$url_pattern); // optional trailing slash
203
-
204
- $request_url = PrliUtils::full_request_url();
205
-
206
- return preg_match('!' . preg_quote($url_pattern, '!') . '!', $request_url);
207
- }
208
-
209
- private function format_keywords_array($keywords) {
210
- $links_array = array();
211
-
212
- if(!is_null($keywords)) {
213
- foreach($keywords as $keyword) {
214
- // Filter out keywords that have a url matching the current uri
215
- if(!$this->request_url_matches_url($keyword->link_url)) {
216
- if(!isset($links_array[$keyword->keyword])) {
217
- $links_array[$keyword->keyword] = array();
218
- }
219
-
220
- $links_array[$keyword->keyword][] = (object)array('url' => $keyword->url, 'title' => stripslashes($keyword->title));
221
- }
222
- }
223
- }
224
-
225
- return $links_array;
226
- }
227
-
228
- /** This will get all of the keywords to urls for the given post.
229
- * This is also where our smart-caching will come into play.
230
- */
231
- public function get_post_keywords_lookup($post_id) {
232
- static $kws;
233
-
234
- if(!isset($kws)) {
235
- $kws = array();
236
- }
237
-
238
- if(!isset($kws[$post_id])) {
239
- $index_keywords = get_option('plp_index_keywords', false);
240
- if(empty($index_keywords)) { return $this->getKeywordToLinksArray($post_id); }
241
-
242
- global $wpdb, $prli_link, $prli_blogurl;
243
-
244
- $q = "
245
- SELECT kw.text as keyword,
246
- li.name as title,
247
- li.url as link_url,
248
- li.id as link_id,
249
- CONCAT(%s,li.slug) AS url
250
- FROM {$prli_link->table_name} li
251
- JOIN {$this->table_name} kw
252
- ON li.id=kw.link_id
253
- JOIN {$this->post_keywords_table_name} AS pkw
254
- ON kw.id = pkw.keyword_id
255
- WHERE pkw.post_id=%d
256
- AND kw.text <> %s
257
- AND li.link_status='enabled'
258
- ORDER BY CHAR_LENGTH(kw.text) DESC,
259
- kw.text ASC
260
- ";
261
-
262
- $struct = PrliUtils::get_permalink_pre_slug_uri();
263
- $q = $wpdb->prepare($q, $prli_blogurl.$struct, $post_id, '');
264
-
265
- $keywords = $wpdb->get_results($q);
266
-
267
- $kws[$post_id] = $this->format_keywords_array($keywords);
268
- }
269
-
270
- return $kws[$post_id];
271
- }
272
-
273
- public function getKeywordToLinksArray($post_id = false) {
274
- static $kws;
275
-
276
- if(!isset($kws)) {
277
- global $wpdb, $prli_link, $plp_keyword, $prli_blogurl;
278
-
279
- //Don't return keywords that link back to the current post
280
- if($post_id) {
281
- $post_url_path = parse_url(get_permalink($post_id), PHP_URL_PATH);
282
- $post_url_path = '%' . $wpdb->esc_like($post_url_path);
283
- $and_str = $wpdb->prepare("AND li.url NOT LIKE %s", $post_url_path);
284
- } else {
285
- $and_str = '';
286
- }
287
-
288
- $struct = PrliUtils::get_permalink_pre_slug_uri();
289
- $query = "
290
- SELECT kw.text as keyword,
291
- li.name as title,
292
- li.url as link_url,
293
- li.id as link_id,
294
- CONCAT(%s,li.slug) AS url
295
- FROM {$prli_link->table_name} li
296
- JOIN {$plp_keyword->table_name} kw
297
- ON li.id=kw.link_id
298
- WHERE kw.text <> %s
299
- AND li.link_status='enabled'
300
- {$and_str}
301
- ORDER BY CHAR_LENGTH(kw.text) DESC,
302
- kw.text ASC
303
- ";
304
-
305
- $query = $wpdb->prepare($query, $prli_blogurl.$struct, '');
306
- $keywords = $wpdb->get_results($query);
307
-
308
- $kws = $this->format_keywords_array($keywords);
309
- }
310
-
311
- return $kws;
312
- }
313
-
314
- public function post_has_post_keywords($post_id) {
315
- global $wpdb;
316
-
317
- $q = "
318
- SELECT COUNT(*)
319
- FROM {$this->post_keywords_table_name}
320
- WHERE post_id=%d
321
- ";
322
- $q = $wpdb->prepare($q, $post_id);
323
- $count = (int)$wpdb->get_var($q);
324
-
325
- return ($count > 0);
326
- }
327
-
328
- public function link_has_post_keywords($link_id) {
329
- global $wpdb;
330
-
331
- $q = "
332
- SELECT COUNT(*)
333
- FROM {$this->post_keywords_table_name} AS pkw
334
- WHERE pkw.keyword_id IN (
335
- SELECT kw.id
336
- FROM {$this->table_name} AS kw
337
- WHERE kw.link_id=%d
338
- )
339
- ";
340
- $q = $wpdb->prepare($q, $link_id);
341
- $count = (int)$wpdb->get_var($q);
342
-
343
- return ($count > 0);
344
- }
345
-
346
- public function delete_post_keywords_by_post_id($post_id) {
347
- global $wpdb;
348
-
349
- $q = "
350
- DELETE FROM {$this->post_keywords_table_name}
351
- WHERE post_id=%d
352
- ";
353
- $q = $wpdb->prepare($q, $post_id);
354
-
355
- return $wpdb->query($q);
356
- }
357
-
358
- public function delete_post_keywords_by_link_id($link_id) {
359
- global $wpdb, $prli_link_meta;
360
-
361
- // Delete ALL postmeta so we can start updating for this link
362
- //delete_post_meta($post_id, '_plp_post_keywords_updated_at');
363
-
364
- $q = "
365
- DELETE FROM {$this->post_keywords_table_name} AS pkw
366
- WHERE pkw.keyword_id IN (
367
- SELECT kw.id
368
- FROM {$this->table_name} AS kw
369
- WHERE kw.link_id=%d
370
- )
371
- ";
372
- $q = $wpdb->prepare($q, $link_id);
373
-
374
- return $wpdb->query($q);
375
- }
376
-
377
- // ENSURE NO LINKS WITH NULL updated_at
378
- // SET any links with null as updated_at to current time
379
- public function update_links_with_null_updated_at () {
380
- global $wpdb, $prli_link;
381
-
382
- $now = date('Y-m-d H:i:s');
383
-
384
- $q = "
385
- UPDATE {$prli_link->table_name}
386
- SET updated_at=%s
387
- WHERE updated_at IS NULL
388
- ";
389
- $q = $wpdb->prepare($q, $now);
390
-
391
- return $wpdb->query($q);
392
- }
393
-
394
- // SELECT posts where updated_at < than max link updated_at
395
- public function get_indexable_posts ($max_count=100) {
396
- global $wpdb, $plp_options, $prli_link;
397
-
398
- $this->update_links_with_null_updated_at();
399
-
400
- $valid_types = $plp_options->autocreate_valid_types();
401
- $valid_types = "'".implode("', '", $valid_types)."'";
402
-
403
- $q = "
404
- SELECT max(kw.created_at)
405
- FROM {$this->table_name} AS kw
406
- ";
407
- $max_updated_at = $wpdb->get_var($q);
408
-
409
- // Order to get oldest / null entries updated first
410
- $q = $wpdb->prepare("
411
- SELECT ID
412
- FROM {$wpdb->posts} AS p
413
- LEFT JOIN {$wpdb->postmeta} AS pm
414
- ON p.ID=pm.post_id
415
- AND pm.meta_key='_plp_post_keywords_updated_at'
416
- WHERE p.post_status = 'publish'
417
- AND p.post_type IN ({$valid_types})
418
- AND (
419
- pm.meta_value IS NULL
420
- OR pm.meta_value < %s
421
- )
422
- ORDER BY pm.meta_value ASC,p.post_date DESC
423
- LIMIT %d
424
- ",
425
- $max_updated_at,
426
- $max_count
427
- );
428
- $posts = $wpdb->get_col($q);
429
-
430
- return $posts;
431
- }
432
-
433
- // SELECT posts where updated_at < than max link updated_at
434
- public function get_indexable_comments ($max_count=100) {
435
- global $wpdb, $plp_options, $prli_link;
436
-
437
- $this->update_links_with_null_updated_at();
438
-
439
- $valid_types = $plp_options->autocreate_valid_types();
440
- $valid_types = "'".implode("', '", $valid_types)."'";
441
-
442
- $q = "
443
- SELECT max(kw.created_at)
444
- FROM {$this->table_name} AS kw
445
- ";
446
- $max_updated_at = $wpdb->get_var($q);
447
-
448
- // Order to get oldest / null entries updated first
449
- $q = $wpdb->prepare("
450
- SELECT c.comment_ID
451
- FROM {$wpdb->comments} AS c
452
- INNER JOIN {$wpdb->posts} AS p
453
- ON c.comment_post_ID=p.ID
454
- AND p.post_status = 'publish'
455
- AND p.post_type IN ({$valid_types})
456
- LEFT JOIN {$wpdb->commentmeta} AS cm
457
- ON c.comment_ID=cm.comment_id
458
- AND cm.meta_key='_plp_comment_keywords_updated_at'
459
- WHERE c.comment_approved=1
460
- AND (
461
- cm.meta_value IS NULL
462
- OR cm.meta_value < %s
463
- )
464
- ORDER BY cm.meta_value ASC,c.comment_date DESC
465
- LIMIT 100
466
- ",
467
- $max_updated_at
468
- );
469
- $comments = $wpdb->get_col($q);
470
-
471
- return $comments;
472
- }
473
-
474
- private function get_post_grouped_keywords ($post_id) {
475
- static $kws;
476
-
477
- if(!isset($kws)) {
478
- $kws = array();
479
- }
480
-
481
- if(!isset($kws[$post_id])) {
482
- global $wpdb, $prli_link, $plp_options;
483
-
484
- $valid_types = $plp_options->autocreate_valid_types();
485
- $valid_types = "'".implode("', '", $valid_types)."'";
486
-
487
- $q = "
488
- SELECT * FROM (
489
- SELECT kw.text, MIN(kw.id) AS id
490
- FROM {$this->table_name} AS kw
491
- JOIN {$wpdb->posts} AS p
492
- ON p.ID=%d
493
- LEFT JOIN {$wpdb->postmeta} AS pm
494
- ON pm.post_id=p.ID
495
- AND pm.meta_key='_plp_post_keywords_updated_at'
496
- WHERE p.post_status='publish'
497
- AND p.post_type IN ({$valid_types})
498
- AND (
499
- pm.meta_value IS NULL
500
- OR pm.meta_value < kw.created_at
501
- )
502
- GROUP BY kw.text
503
- ) as k
504
- ORDER BY CHAR_LENGTH(k.text) DESC, k.text ASC
505
- ";
506
- $q = $wpdb->prepare($q, $post_id);
507
-
508
- $kws[$post_id] = $wpdb->get_results($q);
509
- }
510
-
511
- return $kws[$post_id];
512
- }
513
-
514
- private function get_comment_grouped_keywords ($comment_id) {
515
- static $kws;
516
-
517
- if(!isset($kws)) {
518
- $kws = array();
519
- }
520
-
521
- if(!isset($kws[$comment_id])) {
522
- global $wpdb, $prli_link, $plp_options;
523
-
524
- $valid_types = $plp_options->autocreate_valid_types();
525
- $valid_types = "'".implode("', '", $valid_types)."'";
526
-
527
- $q = "
528
- SELECT * FROM (
529
- SELECT kw.text, MIN(kw.id) AS id
530
- FROM {$this->table_name} AS kw
531
- JOIN {$wpdb->comments} AS c
532
- ON c.comment_ID=%d
533
- JOIN {$wpdb->posts} AS p
534
- ON p.ID=c.comment_post_ID
535
- LEFT JOIN {$wpdb->commentmeta} AS cm
536
- ON cm.comment_id=c.comment_ID
537
- AND cm.meta_key='_plp_comment_keywords_updated_at'
538
- WHERE c.comment_approved=1
539
- AND p.post_status='publish'
540
- AND p.post_type IN ({$valid_types})
541
- AND (
542
- cm.meta_value IS NULL
543
- OR cm.meta_value < kw.created_at
544
- )
545
- GROUP BY kw.text
546
- ) as k
547
- ORDER BY CHAR_LENGTH(k.text) DESC, k.text ASC
548
- ";
549
- $q = $wpdb->prepare($q, $comment_id);
550
-
551
- $kws[$comment_id] = $wpdb->get_results($q);
552
- }
553
-
554
- return $kws[$comment_id];
555
- }
556
-
557
- // Figure out keywords applicable to this post and index them appropriately
558
- public function index_post ($post_id) {
559
- global $plp_options;
560
- $kws = $this->get_post_grouped_keywords($post_id);
561
- $post_content = strip_tags(PrliUtils::get_post_content($post_id));
562
- $this->index_content($post_id, $kws, $post_content);
563
- update_post_meta($post_id, '_plp_post_keywords_updated_at', PrliUtils::now());
564
- }
565
-
566
- public function index_comment ($comment_id) {
567
- global $plp_options;
568
- $kws = $this->get_comment_grouped_keywords($comment_id);
569
- $comment_content = strip_tags(get_comment_text($comment_id));
570
- $comment = get_comment($comment_id);
571
- $this->index_content($comment->comment_post_ID, $kws, $comment_content);
572
- update_comment_meta($comment_id, '_plp_comment_keywords_updated_at', PrliUtils::now());
573
- }
574
-
575
- private function index_content ($post_id, &$kws, &$content) {
576
- $kw_ids = array();
577
- foreach($kws as $kw) {
578
- if(preg_match('/\b'.preg_quote($kw->text).'\b/i', $content)) {
579
- $kw_ids[] = $kw->id;
580
- }
581
- }
582
-
583
- // Add all keywords in one swath
584
- return $this->add_post_keywords($post_id, $kw_ids);
585
- }
586
-
587
- public function get_post_keywords_by_post_id ($post_id) {
588
- global $wpdb;
589
-
590
- $q = "
591
- SELECT pkw.keyword_id
592
- FROM {$this->post_keywords_table_name} AS pkw
593
- WHERE pkw.post_id=%d
594
- ";
595
- $q = $wpdb->prepare($q, $post_id);
596
-
597
- return $wpdb->get_col($q);
598
- }
599
-
600
- public function add_post_keywords ($post_id, $keyword_ids) {
601
- global $wpdb;
602
-
603
- if(empty($keyword_ids)) { return false; }
604
-
605
- // We got a unique index folks so we just ignore dups yo
606
- // But we just want to grab one random keyword to insert here
607
- $q = "
608
- INSERT IGNORE INTO {$this->post_keywords_table_name}
609
- (post_id, keyword_id)
610
- VALUES
611
- ";
612
-
613
- $vals = array();
614
- foreach($keyword_ids as $keyword_id) {
615
- // Not sure how this would ever be un-true but let's make sure it doesn't happen
616
- if($keyword_id > 0 && $post_id > 0) {
617
- $vals[] = $wpdb->prepare("(%d, %d)", $post_id, $keyword_id);
618
- }
619
- }
620
-
621
- // No values to insert? Let's bail.
622
- if(empty($vals)) { return false; }
623
-
624
- $q .= implode(',',$vals);
625
-
626
- return $wpdb->query($q);
627
- }
628
-
629
- // How many posts out of all are indexed
630
- public function posts_indexed () {
631
- global $wpdb, $prli_link, $plp_options;
632
-
633
- $valid_types = $plp_options->autocreate_valid_types();
634
- $valid_types = "'".implode("', '", $valid_types)."'";
635
-
636
- $q = "
637
- SELECT max(kw.created_at)
638
- FROM {$this->table_name} AS kw
639
- ";
640
- $max_updated_at = $wpdb->get_var($q);
641
-
642
- // Num un-indexed posts
643
- $q = $wpdb->prepare("
644
- SELECT COUNT(*)
645
- FROM {$wpdb->posts} AS p
646
- LEFT JOIN {$wpdb->postmeta} AS pm
647
- ON p.ID=pm.post_id
648
- AND pm.meta_key='_plp_post_keywords_updated_at'
649
- WHERE p.post_status = 'publish'
650
- AND p.post_type IN ({$valid_types})
651
- AND (
652
- pm.meta_value IS NULL
653
- OR pm.meta_value < %s
654
- )
655
- ORDER BY pm.meta_value
656
- ",
657
- $max_updated_at
658
- );
659
- $unindexed = $wpdb->get_var($q);
660
-
661
- $q = "
662
- SELECT COUNT(*)
663
- FROM {$wpdb->posts} AS p
664
- WHERE p.post_status = 'publish'
665
- AND p.post_type IN ({$valid_types})
666
- ";
667
- $total = $wpdb->get_var($q);
668
-
669
- $indexed = ($total - $unindexed);
670
-
671
- return (object)compact('total', 'indexed', 'unindexed');
672
- }
673
-
674
- // How many comments out of all are indexed
675
- public function comments_indexed () {
676
- global $wpdb, $prli_link, $plp_options;
677
-
678
- $valid_types = $plp_options->autocreate_valid_types();
679
- $valid_types = "'".implode("', '", $valid_types)."'";
680
-
681
- $q = "
682
- SELECT max(kw.created_at)
683
- FROM {$this->table_name} AS kw
684
- ";
685
- $max_updated_at = $wpdb->get_var($q);
686
-
687
- // Num un-indexed posts
688
- $q = $wpdb->prepare("
689
- SELECT COUNT(*)
690
- FROM {$wpdb->comments} AS c
691
- INNER JOIN {$wpdb->posts} AS p
692
- ON c.comment_post_ID=p.ID
693
- AND p.post_status = 'publish'
694
- AND p.post_type IN ({$valid_types})
695
- LEFT JOIN {$wpdb->commentmeta} AS cm
696
- ON c.comment_ID=cm.comment_id
697
- AND cm.meta_key='_plp_comment_keywords_updated_at'
698
- WHERE c.comment_approved=1
699
- AND (
700
- cm.meta_value IS NULL
701
- OR cm.meta_value < %s
702
- )
703
- ORDER BY cm.meta_value
704
- ",
705
- $max_updated_at
706
- );
707
- $unindexed = $wpdb->get_var($q);
708
-
709
- $q = "
710
- SELECT COUNT(*)
711
- FROM {$wpdb->comments} AS c
712
- INNER JOIN {$wpdb->posts} AS p
713
- ON c.comment_post_ID=p.ID
714
- AND p.post_status = 'publish'
715
- AND p.post_type IN ({$valid_types})
716
- WHERE c.comment_approved=1
717
- ";
718
- $total = $wpdb->get_var($q);
719
-
720
- $indexed = ($total - $unindexed);
721
-
722
- return (object)compact('total', 'indexed', 'unindexed');
723
- }
724
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/app/models/PlpLinkRotation.php DELETED
@@ -1,186 +0,0 @@
1
- <?php
2
- if(!defined('ABSPATH'))
3
- die('You are not allowed to call this page directly.');
4
-
5
- class PlpLinkRotation {
6
- public $table_name;
7
- public $cr_table_name;
8
-
9
- public function __construct() {
10
- global $wpdb;
11
- $this->table_name = "{$wpdb->prefix}prli_link_rotations";
12
- $this->cr_table_name = "{$wpdb->prefix}prli_clicks_rotations";
13
- }
14
-
15
- public function create( $url, $weight, $r_index, $link_id ) {
16
- global $wpdb;
17
-
18
- $query_str = "INSERT INTO {$this->table_name} " .
19
- '(url,' .
20
- 'weight,' .
21
- 'r_index,' .
22
- 'link_id,' .
23
- 'created_at) ' .
24
- 'VALUES ' .
25
- '(%s,%d,%d,%d,NOW())';
26
-
27
- $query = $wpdb->prepare( $query_str,
28
- $url,
29
- $weight,
30
- $r_index,
31
- $link_id );
32
-
33
- $query_results = $wpdb->query($query);
34
-
35
- if($query_results)
36
- return $wpdb->insert_id;
37
- else
38
- return false;
39
- }
40
-
41
- public function update( $url, $weight, $r_index, $link_id ) {
42
- global $wpdb;
43
-
44
- $query_str = "UPDATE {$this->table_name} SET " .
45
- 'url=%s, ' .
46
- 'weight=%d ' .
47
- 'WHERE ' .
48
- 'link_id=%d AND ' .
49
- 'r_index=%d';
50
-
51
- $query = $wpdb->prepare( $query_str,
52
- $url,
53
- $weight,
54
- $link_id,
55
- $r_index );
56
-
57
- $query_results = $wpdb->query($query);
58
-
59
- return $query_results;
60
- }
61
-
62
- public function record_click( $click_id, $link_id, $url ) {
63
- global $wpdb;
64
-
65
- $query_str = "INSERT INTO {$this->cr_table_name} " .
66
- '(click_id,' .
67
- 'link_id,' .
68
- 'url) ' .
69
- 'VALUES ' .
70
- '(%d,%d,%s)';
71
-
72
- $query = $wpdb->prepare( $query_str,
73
- $click_id,
74
- $link_id,
75
- $url );
76
-
77
- $query_results = $wpdb->query($query);
78
-
79
- if($query_results)
80
- return $wpdb->insert_id;
81
- else
82
- return false;
83
- }
84
-
85
- public function updateLinkRotations($link_id,$link_rotations,$link_weights) {
86
- $existing_rotations = $this->getAllByLinkId( $link_id );
87
-
88
- $max_count = ((count($existing_rotations) > count($link_rotations))?count($existing_rotations):count($link_rotations));
89
- for($i=0;$i<$max_count;$i++)
90
- {
91
- if(isset($existing_rotations[$i]) and isset($link_rotations[$i]))
92
- {
93
- if(empty($link_rotations[$i]) or preg_match("#^\s*$#",$link_rotations[$i]))
94
- $this->destroy($link_id,$i);
95
- else
96
- $this->update(trim($link_rotations[$i]), trim($link_weights[$i]), $i, $link_id);
97
- }
98
- else if(isset($link_rotations[$i]) and !preg_match("#^\s*$#",$link_rotations[$i]))
99
- $this->create(trim($link_rotations[$i]), trim($link_weights[$i]), $i, $link_id);
100
- else if(isset($existing_rotations[$i]))
101
- $this->destroy($link_id,$i);
102
- }
103
- }
104
-
105
- public function destroy( $link_id, $r_index ) {
106
- global $wpdb;
107
- $query_str = "DELETE FROM {$this->table_name} WHERE link_id=%d AND r_index=%d";
108
- $query = $wpdb->prepare($query_str,$link_id,$r_index);
109
- return $wpdb->query($query);
110
- }
111
-
112
- public function destroyByLinkId( $link_id ) {
113
- global $wpdb;
114
- $query_str = "DELETE FROM {$this->table_name} WHERE link_id=%d";
115
- $query = $wpdb->prepare($query_str,$link_id);
116
- return $wpdb->query($query);
117
- }
118
-
119
- public function getOne( $id, $return_type = OBJECT ) {
120
- global $wpdb;
121
- $query_str = "SELECT * FROM {$this->table_name} WHERE id=%d";
122
- $query = $wpdb->prepare($query_str,$id);
123
- return $wpdb->get_row($query, $return_type);
124
- }
125
-
126
- public function getAllByLinkId( $link_id, $return_type = OBJECT ) {
127
- global $wpdb;
128
- $query_str = "SELECT * FROM {$this->table_name} WHERE link_id=%d ORDER BY r_index";
129
- $query = $wpdb->prepare($query_str,$link_id);
130
- return $wpdb->get_results($query, $return_type);
131
- }
132
-
133
- public function getAll($where = '', $return_type = OBJECT) {
134
- global $wpdb, $prli_utils;
135
- $query_str = "SELECT * FROM {$this->table_name}" . $prli_utils->prepend_and_or_where(' WHERE', $where) . " ORDER BY link_id,r_index";
136
- return $wpdb->get_results($query_str, $return_type);
137
- }
138
-
139
- public function get_rotations($link_id) {
140
- global $wpdb;
141
- $query_str = "SELECT url FROM {$this->table_name} WHERE link_id=%d ORDER BY r_index";
142
- $query = $wpdb->prepare($query_str,$link_id);
143
- return $wpdb->get_col($query, 0);
144
- }
145
-
146
- public function get_weights($link_id) {
147
- global $wpdb;
148
- $query_str = "SELECT weight FROM {$this->table_name} WHERE link_id=%d ORDER BY r_index";
149
- $query = $wpdb->prepare($query_str,$link_id);
150
- return $wpdb->get_col($query, 0);
151
- }
152
-
153
- public function get_target_url($link_id) {
154
- global $prli_link, $prli_link_meta;
155
-
156
- $link = $prli_link->getOne($link_id);
157
-
158
- $rotation_urls = $this->get_rotations($link_id);
159
- $rotation_urls[] = $link->url;
160
-
161
- $weights = $this->get_weights($link_id);
162
- $weights[] = $prli_link_meta->get_link_meta($link_id,'prli-target-url-weight',true);
163
-
164
- $index = PlpUtils::w_rand($weights);
165
-
166
- // Just double check that we aren't returning an empty URL ...
167
- // At the very least we can return the target url.
168
- $target_url = (empty($rotation_urls[$index])?$link->url:$rotation_urls[$index]);
169
-
170
- return $target_url;
171
- }
172
-
173
- public function there_are_rotations_for_this_link($link_id) {
174
- global $wpdb;
175
- $query_str = "SELECT * FROM {$this->table_name} WHERE link_id=%d";
176
- $query = $wpdb->prepare($query_str,$link_id);
177
- $url_rotations = $wpdb->get_results($query);
178
-
179
- foreach($url_rotations as $rot) {
180
- if(!preg_match('#^/s*?#',$rot->url))
181
- return true; // short circuit when we find the first rotation
182
- }
183
-
184
- return false;
185
- }
186
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/app/models/PlpOptions.php DELETED
@@ -1,407 +0,0 @@
1
- <?php
2
- if(!defined('ABSPATH')) die('You are not allowed to call this page directly.');
3
-
4
- class PlpOptions {
5
- public $pages_auto;
6
- public $posts_auto;
7
- public $pages_category;
8
- public $posts_category;
9
- public $autocreate;
10
-
11
- public $default_social_buttons;
12
- public $social_buttons;
13
- public $social_buttons_placement;
14
- public $social_buttons_show_in_feed;
15
- public $social_buttons_padding;
16
- public $social_posts_buttons;
17
- public $social_pages_buttons;
18
-
19
- public $keyword_replacement_is_on;
20
- public $keywords_per_page;
21
- public $keyword_links_per_page;
22
- public $keyword_links_open_new_window;
23
- public $keyword_links_nofollow;
24
- public $keyword_links_sponsored;
25
- public $keyword_link_custom_css;
26
- public $keyword_link_hover_custom_css;
27
- public $set_keyword_thresholds;
28
- public $keyword_enable_content_cache; // DEPRECATED
29
- public $replace_urls_with_pretty_links;
30
- public $replace_urls_with_pretty_links_blacklist;
31
- public $replace_keywords_in_comments;
32
- public $replace_keywords_in_feeds;
33
- public $enable_link_to_disclosures;
34
- public $disclosures_link_url;
35
- public $disclosures_link_text;
36
- public $disclosures_link_position;
37
- public $enable_keyword_link_disclosures;
38
- public $keyword_link_disclosure;
39
-
40
- public $use_prettylink_url;
41
- public $prettylink_url;
42
-
43
- public $min_role;
44
-
45
- public $allow_public_link_creation;
46
- public $use_public_link_display_page;
47
- public $public_link_display_page;
48
-
49
- public $prettybar_hide_attrib_link;
50
- public $prettybar_attrib_url;
51
-
52
- public $google_tracking;
53
- public $google_tracking_str;
54
-
55
- public $generate_qr_codes_str;
56
- public $generate_qr_codes;
57
-
58
- public $qr_code_links_str;
59
- public $qr_code_links;
60
-
61
- public $global_head_scripts_str;
62
- public $global_head_scripts;
63
-
64
- //Use a base slug prefix on all new links like out/ or go/ etc.
65
- public $base_slug_prefix_str;
66
- public $base_slug_prefix;
67
-
68
- //The number of characters to use in random slug generation.
69
- public $num_slug_chars_str;
70
- public $num_slug_chars;
71
-
72
- public function __construct($options_array=array()) {
73
- // Set values from array
74
- foreach($options_array as $key => $value) {
75
- $this->{$key} = $value;
76
- }
77
-
78
- $this->set_default_options();
79
- }
80
-
81
- public function set_default_options() {
82
- if(!isset($this->pages_auto))
83
- $this->pages_auto = 0;
84
-
85
- if(!isset($this->posts_auto))
86
- $this->posts_auto = 0;
87
-
88
- if(!isset($this->pages_category))
89
- $this->pages_category= '';
90
-
91
- if(!isset($this->posts_category))
92
- $this->posts_category = '';
93
-
94
- if(!isset($this->autocreate)) {
95
- $this->autocreate = array();
96
- }
97
-
98
- $this->default_social_buttons = array(
99
- 'facebook' => array(
100
- 'label' => __('Facebook', 'pretty-link'),
101
- 'checked' => false,
102
- 'slug' => 'facebook',
103
- 'icon' => 'pl-icon-facebook',
104
- 'url' => 'http://www.facebook.com/sharer.php?u={{encoded_url}}&t={{encoded_title}}'
105
- ),
106
- 'twitter' => array(
107
- 'label' => __('Twitter', 'pretty-link'),
108
- 'checked' => false,
109
- 'slug' => 'twitter',
110
- 'icon' => 'pl-icon-twitter',
111
- 'url' => 'https://twitter.com/intent/tweet?text={{tweet_message}}'
112
- ),
113
- 'gplus' => array(
114
- 'label' => __('Google+', 'pretty-link'),
115
- 'checked' => false,
116
- 'slug' => 'gplus',
117
- 'icon' => 'pl-icon-gplus',
118
- 'url' => 'https://plus.google.com/share?url={{encoded_url}}'
119
- ),
120
- 'pinterest' => array(
121
- 'label' => __('Pinterest', 'pretty-link'),
122
- 'checked' => false,
123
- 'slug' => 'pinterest',
124
- 'icon' => 'pl-icon-pinterest',
125
- 'url' => 'http://pinterest.com/pin/create/button/?url={{encoded_url}}&description={{encoded_title}}"'
126
- ),
127
- 'linkedin' => array(
128
- 'label' => __('LinkedIn', 'pretty-link'),
129
- 'checked' => false,
130
- 'slug' => 'linkedin',
131
- 'icon' => 'pl-icon-linkedin',
132
- 'url' => 'http://www.linkedin.com/shareArticle?mini=true&url={{encoded_url}}&title={{encoded_title}}'
133
- ),
134
- 'reddit' => array(
135
- 'label' => __('Reddit', 'pretty-link'),
136
- 'checked' => false,
137
- 'slug' => 'reddit',
138
- 'icon' => 'pl-icon-reddit',
139
- 'url' => 'http://reddit.com/submit?url={{encoded_url}}&title={{encoded_title}}'
140
- ),
141
- 'stumbleupon' => array(
142
- 'label' => __('StumbleUpon', 'pretty-link'),
143
- 'checked' => false,
144
- 'slug' => 'stumbleupon',
145
- 'icon' => 'pl-icon-stumbleupon',
146
- 'url' => 'http://www.stumbleupon.com/submit?url={{encoded_url}}&title={{encoded_title}}'
147
- ),
148
- 'digg' => array(
149
- 'label' => __('Digg', 'pretty-link'),
150
- 'checked' => false,
151
- 'slug' => 'digg',
152
- 'icon' => 'pl-icon-digg',
153
- 'url' => 'http://digg.com/submit?phase=2&url={{encoded_url}}&title={{encoded_title}}'
154
- ),
155
- 'email' => array(
156
- 'label' => __('Email', 'pretty-link'),
157
- 'checked' => false,
158
- 'slug' => 'email',
159
- 'icon' => 'pl-icon-email',
160
- 'url' => 'mailto:?subject={{encoded_title}}&body={{encoded_title}}%20{{encoded_url}}'
161
- )
162
- );
163
-
164
- if(!isset($this->social_buttons)) {
165
- $this->social_buttons = array_values( $this->default_social_buttons );
166
- }
167
- else {
168
- // If it's the old-style array then refactor it
169
- if( isset($this->social_buttons['facebook']) ) {
170
- $new_social_buttons = array_values( $this->default_social_buttons );
171
-
172
- foreach( $new_social_buttons as $i => $values ) {
173
- if( isset( $this->social_buttons[$values['slug']] ) ) {
174
- $new_social_buttons[$i]['checked'] = ($values==='on');
175
- }
176
- }
177
-
178
- $this->social_buttons = $new_social_buttons;
179
- }
180
- }
181
-
182
- if(!isset($this->social_buttons_placement))
183
- $this->social_buttons_placement = 'bottom';
184
-
185
- if(!isset($this->social_buttons_show_in_feed))
186
- $this->social_buttons_show_in_feed = 0;
187
-
188
- if(!isset($this->social_buttons_padding))
189
- $this->social_buttons_padding = '10';
190
-
191
- if(!isset($this->social_posts_buttons))
192
- $this->social_posts_buttons = 0;
193
-
194
- if(!isset($this->social_pages_buttons))
195
- $this->social_pages_buttons = 0;
196
-
197
- if(!isset($this->keyword_replacement_is_on))
198
- $this->keyword_replacement_is_on = 1;
199
-
200
- if(!isset($this->keywords_per_page))
201
- $this->keywords_per_page = 3;
202
-
203
- if(!isset($this->keyword_links_per_page))
204
- $this->keyword_links_per_page = 2;
205
-
206
- if(!isset($this->keyword_links_open_new_window))
207
- $this->keyword_links_open_new_window = 0;
208
-
209
- if(!isset($this->keyword_links_nofollow))
210
- $this->keyword_links_nofollow = 0;
211
-
212
- if(!isset($this->keyword_links_sponsored))
213
- $this->keyword_links_sponsored = 0;
214
-
215
- if(!isset($this->keyword_link_custom_css))
216
- $this->keyword_link_custom_css = '';
217
-
218
- if(!isset($this->keyword_link_hover_custom_css))
219
- $this->keyword_link_hover_custom_css = '';
220
-
221
- if(!isset($this->set_keyword_thresholds))
222
- $this->set_keyword_thresholds = 0;
223
-
224
- // DEPRECATED
225
- $this->keyword_enable_content_cache = 0;
226
-
227
- if(!isset($this->replace_urls_with_pretty_links))
228
- $this->replace_urls_with_pretty_links = 0;
229
- if(!isset($this->replace_urls_with_pretty_links_blacklist))
230
- $this->replace_urls_with_pretty_links_blacklist = '';
231
- if(!isset($this->replace_keywords_in_comments))
232
- $this->replace_keywords_in_comments = 0;
233
- if(!isset($this->replace_keywords_in_feeds))
234
- $this->replace_keywords_in_feeds = 0;
235
- if(!isset($this->enable_link_to_disclosures)) {
236
- $this->enable_link_to_disclosures = 0;
237
- }
238
- if(!isset($this->disclosures_link_url)) {
239
- $this->disclosures_link_url = '';
240
- }
241
- if(!isset($this->disclosures_link_text)) {
242
- $this->disclosures_link_text = __('Affiliate Link Disclosures','pretty-link');
243
- }
244
- if(!isset($this->disclosures_link_position)) {
245
- $this->disclosures_link_position = 'bottom';
246
- }
247
- if(!isset($this->enable_keyword_link_disclosures)) {
248
- $this->enable_keyword_link_disclosures = 0;
249
- }
250
- if(!isset($this->keyword_link_disclosure)) {
251
- $this->keyword_link_disclosure = __('(aff)', 'pretty-link');
252
- }
253
-
254
- if(!isset($this->use_prettylink_url))
255
- $this->use_prettylink_url = 0;
256
-
257
- if(!isset($this->prettylink_url))
258
- $this->prettylink_url = '';
259
-
260
- //manage_options = ADMIN
261
- //delete_pages = EDITOR
262
- //publish_posts = AUTHOR
263
- //edit_posts = CONTRIBUTOR
264
- //read = SUBSCRIBER
265
- if(!isset($this->min_role) || $this->min_role == 'add_users') {
266
- $this->min_role = 'manage_options';
267
- }
268
-
269
- if(!isset($this->allow_public_link_creation))
270
- $this->allow_public_link_creation = 0;
271
-
272
- if(!isset($this->use_public_link_display_page))
273
- $this->use_public_link_display_page = 0;
274
-
275
- if(!isset($this->public_link_display_page))
276
- $this->public_link_display_page = '';
277
-
278
- if(!isset($this->prettybar_hide_attrib_link))
279
- $this->prettybar_hide_attrib_link = 0;
280
-
281
- if(!isset($this->prettybar_attrib_url))
282
- $this->prettybar_attrib_url = '';
283
-
284
- $this->google_tracking_str = 'prlipro-google-tracking';
285
- if(!isset($this->google_tracking))
286
- $this->google_tracking = 0;
287
-
288
- $this->generate_qr_codes_str = 'prlipro-generate-qr-codes';
289
- if(!isset($this->generate_qr_codes))
290
- $this->generate_qr_codes = 0;
291
-
292
- $this->qr_code_links_str = 'prlipro-code-links';
293
- $this->qr_code_links = 0;
294
- /* TODO: We're going to just comment this out for now
295
- if(!isset($this->qr_code_links))
296
- $this->qr_code_links = 0;
297
- */
298
-
299
- $this->global_head_scripts_str = 'prlipro-global-head-scripts';
300
- if(!isset($this->global_head_scripts) || empty($this->global_head_scripts))
301
- $this->global_head_scripts = '';
302
-
303
- $this->base_slug_prefix_str = 'prlipro-base-slug-prefix';
304
- if(!isset($this->base_slug_prefix))
305
- $this->base_slug_prefix = '';
306
-
307
- $this->num_slug_chars_str = 'prlipro-num-slug-chars';
308
- if(!isset($this->num_slug_chars))
309
- $this->num_slug_chars = 4;
310
- }
311
-
312
- public function store() {
313
- $storage_array = (array)$this;
314
- update_option( 'prlipro_options', $storage_array );
315
- wp_cache_delete('alloptions', 'options');
316
- }
317
-
318
- public function autocreate_option($post_type='post') {
319
- $opt = array(
320
- 'enabled' => false,
321
- 'category' => '',
322
- 'socbtns' => false
323
- );
324
-
325
- if($post_type=='post') {
326
- $opt['enabled'] = !empty($this->posts_auto);
327
- $opt['category'] = $this->posts_category;
328
- $opt['socbtns'] = !empty($this->social_posts_buttons);
329
- }
330
- else if($post_type=='page') {
331
- $opt['enabled'] = !empty($this->pages_auto);
332
- $opt['category'] = $this->pages_category;
333
- $opt['socbtns'] = !empty($this->social_pages_buttons);
334
- }
335
- else {
336
- if(isset($this->autocreate[$post_type])) {
337
- $ac = $this->autocreate[$post_type];
338
- $opt['enabled'] = isset($ac['enabled']) && !empty($ac['enabled']);
339
- $opt['category'] = isset($ac['category']) ? $ac['category'] : '';
340
- $opt['socbtns'] = isset($ac['socbtns']) && !empty($ac['socbtns']);
341
- }
342
- }
343
-
344
- return (object)$opt;
345
- }
346
-
347
- public function autocreate_options() {
348
- $opts = array();
349
- $post_types = $this->get_post_types();
350
-
351
- foreach($post_types as $post_type) {
352
- $opts[$post_type] = $this->autocreate_option($post_type);
353
- }
354
-
355
- return (object)$opts;
356
- }
357
-
358
- public function autocreate_valid_types() {
359
- $valid_opts = array();
360
- $opts = $this->autocreate_options();
361
-
362
- foreach($opts as $post_type => $opt) {
363
- if($opt->enabled) {
364
- $valid_opts[] = $post_type;
365
- }
366
- }
367
-
368
- return $valid_opts;
369
- }
370
-
371
- public function get_post_types($include_page_and_post=true) {
372
- $post_types = get_post_types(array('_builtin'=>false,'public'=>true),'names','and');
373
-
374
- if($include_page_and_post) {
375
- $post_types['post'] = 'post';
376
- $post_types['page'] = 'page';
377
- }
378
-
379
- return $post_types;
380
- }
381
-
382
- public static function get_options() {
383
- $plp_options = get_option('prlipro_options');
384
-
385
- if($plp_options) {
386
- if(is_string($plp_options)) {
387
- $plp_options = unserialize($plp_options);
388
- }
389
-
390
- if(is_object($plp_options) && is_a($plp_options,'PlpOptions')) {
391
- $plp_options->set_default_options();
392
- $plp_options->store(); // store will convert this back into an array
393
- }
394
- else if(is_array($plp_options)) {
395
- $plp_options = new PlpOptions($plp_options);
396
- }
397
- else {
398
- $plp_options = new PlpOptions();
399
- }
400
- }
401
- else {
402
- $plp_options = new PlpOptions();
403
- }
404
-
405
- return $plp_options;
406
- }
407
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/app/models/PlpPostOptions.php DELETED
@@ -1,79 +0,0 @@
1
- <?php if(!defined('ABSPATH')) { die('You are not allowed to call this page directly.'); }
2
-
3
- class PlpPostOptions {
4
- public $requested_slug;
5
-
6
- public $hide_social_buttons;
7
- public $disable_replacements;
8
-
9
- public function __construct($options_array = array()) {
10
- // Set values from array
11
- foreach($options_array as $key => $value)
12
- $this->{$key} = $value;
13
-
14
- $this->set_default_options();
15
- }
16
-
17
- public function set_default_options() {
18
- if(!isset($this->requested_slug))
19
- $this->requested_slug = '';
20
-
21
- if(!isset($this->hide_social_buttons))
22
- $this->hide_social_buttons = 0;
23
-
24
- if(!isset($this->disable_replacements))
25
- $this->disable_replacements = 0;
26
- }
27
-
28
- public function validate() {
29
- global $prli_utils;
30
- $errors = array();
31
-
32
- if(!empty($this->requested_slug)) {
33
- $slug_available = $prli_utils->is_slug_available($this->requested_slug);
34
- if(is_wp_error($slug_available)) {
35
- $errors[] = $slug_available->get_error_message();
36
- }
37
- }
38
-
39
- return $errors;
40
- }
41
-
42
- // Just here as an alias for reverse compatibility
43
- public function get_stored_object($post_id) {
44
- return PlpOptions::get_options($post_id);
45
- }
46
-
47
- public function store($post_id) {
48
- if(!empty($post_id) and $post_id) {
49
- $storage_array = (array)$this;
50
- PrliUtils::update_prli_post_meta($post_id, '_prlipro-post-options', $storage_array);
51
- }
52
- }
53
-
54
- public static function get_options($post_id) {
55
- if(!empty($post_id) and $post_id) {
56
- $plp_post_options = PrliUtils::get_prli_post_meta($post_id,"_prlipro-post-options",true);
57
-
58
- if($plp_post_options) {
59
- if(is_string($plp_post_options))
60
- $plp_post_options = unserialize($plp_post_options);
61
-
62
- if(is_a($plp_post_options,'PlpPostOptions')) {
63
- $plp_post_options->set_default_options();
64
- $plp_post_options->store($post_id); // store will convert this back into an array
65
- }
66
- else if(is_array($plp_post_options))
67
- $plp_post_options = new PlpPostOptions($plp_post_options);
68
- else
69
- $plp_post_options = new PlpPostOptions();
70
- }
71
- else
72
- $plp_post_options = new PlpPostOptions();
73
- }
74
- else
75
- $plp_post_options = new PlpPostOptions();
76
-
77
- return $plp_post_options;
78
- }
79
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/app/models/PlpReport.php DELETED
@@ -1,497 +0,0 @@
1
- <?php
2
- if(!defined('ABSPATH')) { die('You are not allowed to call this page directly.'); }
3
-
4
- class PlpReport
5
- {
6
- public $table_name;
7
- public $links_table_name;
8
-
9
- public function __construct() {
10
- global $wpdb;
11
- $this->table_name = "{$wpdb->prefix}prli_reports";
12
- $this->links_table_name = "{$wpdb->prefix}prli_report_links";
13
- }
14
-
15
- public function create( $values ) {
16
- global $wpdb;
17
-
18
- $goal_link_id = isset($values['goal_link_id']) ? $values['goal_link_id'] : 0;
19
- $query_str = "INSERT INTO {$this->table_name} ".
20
- '(name,goal_link_id,created_at) ' .
21
- 'VALUES (%s,%d,NOW())';
22
- $query = $wpdb->prepare( $query_str, $values['name'], $goal_link_id );
23
- $query_results = $wpdb->query($query);
24
- return $wpdb->insert_id;
25
- }
26
-
27
- public function update( $id, $values ) {
28
- global $wpdb;
29
-
30
- $goal_link_id = isset($values['goal_link_id']) ? $values['goal_link_id'] : 0;
31
- $query_str = "UPDATE {$this->table_name} " .
32
- 'SET name=%s, goal_link_id=%d ' .
33
- 'WHERE id=%d';
34
- $query = $wpdb->prepare($query_str,$values['name'],$goal_link_id,$id);
35
- $query_results = $wpdb->query($query);
36
- return $query_results;
37
- }
38
-
39
- public function get_report_links($report_id, $return_type = OBJECT) {
40
- global $wpdb;
41
- $query_str = "SELECT * FROM {$this->links_table_name} WHERE report_id=%d";
42
- $query = $wpdb->prepare($query_str, $report_id);
43
- return $wpdb->get_results($query, $return_type);
44
- }
45
-
46
- public function get_report_links_array($report_id) {
47
- global $wpdb;
48
- $links_table = $wpdb->prefix . 'prli_links';
49
- $query_str = "SELECT link_id FROM {$this->links_table_name} LEFT JOIN {$links_table} links ON link_id = links.id WHERE report_id=%d AND link_status='enabled'";
50
- $query = $wpdb->prepare($query_str, $report_id);
51
- return $wpdb->get_col($query,0);
52
- }
53
-
54
- public function update_report_links($report_id, $link_ids) {
55
- global $wpdb;
56
-
57
- // Delete all records associated with this report
58
- $query_str = "DELETE FROM {$this->links_table_name} WHERE report_id=%d";
59
- $query = $wpdb->prepare($query_str, $report_id);
60
- $wpdb->query($query);
61
-
62
- // Rebuild link IDs from the array of link_ids
63
- foreach($link_ids as $link_id) {
64
- $query_str = "INSERT INTO {$this->links_table_name} ".
65
- '(report_id,'.
66
- 'link_id,'.
67
- 'created_at) ' .
68
- 'VALUES (%d,%d,NOW())';
69
- $query = $wpdb->prepare( $query_str, $report_id, $link_id );
70
- $query_results = $wpdb->query($query);
71
- }
72
- }
73
-
74
- public function destroy( $id ) {
75
- global $wpdb;
76
- $query_str = "DELETE FROM {$this->table_name} WHERE id=%d";
77
- $query = $wpdb->prepare($query_str, $id);
78
- return $wpdb->query($query);
79
- }
80
-
81
- public function getOne( $id ) {
82
- global $wpdb;
83
- $query_str = "SELECT * FROM {$this->table_name} WHERE id=%d";
84
- $query = $wpdb->prepare($query_str, $id);
85
- return $wpdb->get_row($query);
86
- }
87
-
88
- public function getAll( $where = '', $order_by = '', $return_type = OBJECT ) {
89
- global $wpdb, $prli_utils;
90
- $query = "SELECT rp.*, " .
91
- "li.name as goal_link_name, " .
92
- "(SELECT COUNT(*) " .
93
- "FROM {$this->links_table_name} rpl " .
94
- "WHERE rpl.report_id = rp.id) as link_count " .
95
- "FROM {$this->table_name} rp " .
96
- "LEFT OUTER JOIN {$prli_link->table_name} li ON li.id = rp.goal_link_id AND li.link_status='enabled'" .
97
- $prli_utils->prepend_and_or_where(' WHERE', $where) . $order_by;
98
- return $wpdb->get_results($query, $return_type);
99
- }
100
-
101
- // Pagination Methods
102
- public function getRecordCount($where='') {
103
- global $wpdb, $prli_utils;
104
- $query = "SELECT COUNT(*) FROM {$this->table_name} rp" . $prli_utils->prepend_and_or_where(' WHERE', $where);
105
- return $wpdb->get_var($query);
106
- }
107
-
108
- public function getPageCount($p_size, $where="") {
109
- return ceil((int)$this->getRecordCount($where) / (int)$p_size);
110
- }
111
-
112
- public function getPage($current_p,$p_size, $where = "", $order_by = '') {
113
- global $wpdb, $prli_link, $prli_utils, $prli_link;
114
- $end_index = $current_p * $p_size;
115
- $start_index = $end_index - $p_size;
116
- $query = "SELECT rp.*, " .
117
- "li.name as goal_link_name, " .
118
- "(SELECT COUNT(*) " .
119
- "FROM {$this->links_table_name} rpl " .
120
- "WHERE rpl.report_id = rp.id) as link_count " .
121
- "FROM {$this->table_name} rp " .
122
- "LEFT OUTER JOIN {$prli_link->table_name} li ON li.id = rp.goal_link_id AND li.link_status='enabled'" .
123
- $prli_utils->prepend_and_or_where(' WHERE', $where) . "{$order_by} " .
124
- "LIMIT {$start_index},{$p_size}";
125
- $results = $wpdb->get_results($query);
126
- return $results;
127
- }
128
-
129
- // Set defaults and grab get or post of each possible param
130
- public function get_params_array() {
131
- $values = array(
132
- 'action' => sanitize_key(stripslashes(isset($_GET['action'])?$_GET['action']:(isset($_POST['action'])?$_POST['action']:''))),
133
- 'id' => (isset($_GET['id'])?(int)$_GET['id']:(isset($_POST['id'])?(int)$_POST['id']:'')),
134
- 'sdate' => sanitize_text_field(stripslashes(isset($_GET['sdate'])?$_GET['sdate']:(isset($_POST['sdate'])?$_POST['sdate']:''))),
135
- 'edate' => sanitize_text_field(stripslashes(isset($_GET['edate'])?$_GET['edate']:(isset($_POST['edate'])?$_POST['edate']:''))),
136
- 'paged' => (isset($_GET['paged'])?(int)$_GET['paged']:(isset($_POST['paged'])?(int)$_POST['paged']:1)),
137
- 'search' => sanitize_text_field(stripslashes(isset($_GET['search'])?$_GET['search']:(isset($_POST['search'])?$_POST['search']:''))),
138
- 'sort' => sanitize_key(stripslashes(isset($_GET['sort'])?$_GET['sort']:(isset($_POST['sort'])?$_POST['sort']:''))),
139
- 'sdir' => sanitize_key(stripslashes(isset($_GET['sdir'])?$_GET['sdir']:(isset($_POST['sdir'])?$_POST['sdir']:'')))
140
- );
141
-
142
- return $values;
143
- }
144
-
145
- public function validate( $values ) {
146
- global $wpdb, $prli_utils;
147
-
148
- $errors = array();
149
- if( empty($values['name']) ) {
150
- $errors[] = __("Report must have a name.", 'pretty-link');
151
- }
152
-
153
- if( empty($values['link']) ) {
154
- $errors[] = __("At least one link must be selected for analysis.", 'pretty-link');
155
- }
156
-
157
- return $errors;
158
- }
159
-
160
- public function get_labels_by_links($start_timestamp,$end_timestamp,$links,$uniques = false) {
161
- global $wpdb, $prli_click, $prli_blogurl, $prli_link, $prli_utils;
162
-
163
- if (!count($links)) {
164
- return array();
165
- }
166
-
167
- $query_str = "
168
- SELECT li.name as label
169
- FROM {$prli_link->table_name} AS li
170
- WHERE li.id IN (".implode(',',$links).")
171
- AND li.link_status='enabled'
172
- ORDER BY li.name
173
- ";
174
- $records = $wpdb->get_results($query_str);
175
-
176
- $link_labels = array();
177
- foreach($records as $record) {
178
- $link_labels[] = $record->label;
179
- }
180
-
181
- return $link_labels;
182
- }
183
-
184
- public function get_clicks_by_links($start_timestamp,$end_timestamp,$links,$uniques = false) {
185
- global $wpdb, $prli_click, $prli_blogurl, $prli_link, $prli_utils;
186
-
187
- if (!count($links)) {
188
- return array();
189
- }
190
-
191
- $query_str = "SELECT li.id as id, " .
192
- "(SELECT COUNT(*) FROM {$prli_click->table_name} cl " .
193
- "WHERE cl.link_id = li.id" . $prli_click->get_exclude_where_clause( ' AND' ) . " " .
194
- (($uniques)?'AND cl.first_click=1 ':'') .
195
- "AND cl.created_at BETWEEN %s AND %s) as clicks " .
196
- "FROM {$prli_link->table_name} li " .
197
- "WHERE li.id IN (".implode(',',$links).") " .
198
- "AND li.link_status='enabled' " .
199
- "ORDER BY li.name";
200
- $query = $wpdb->prepare( $query_str, date("Y-n-j 00:00:00",$start_timestamp), date("Y-n-j 23:59:59",$end_timestamp) );
201
- $records = $wpdb->get_results($query);
202
-
203
- $link_clicks = array();
204
- foreach($records as $record) {
205
- $link_clicks[] = $record->clicks;
206
- }
207
-
208
- return $link_clicks;
209
- }
210
-
211
- public function get_conversions_by_links($start_timestamp,$end_timestamp,$links,$goal_link_id) {
212
- global $wpdb, $prli_click, $prli_blogurl, $prli_link, $prli_utils;
213
-
214
- $sdate = date("Y-n-j 00:00:00",$start_timestamp);
215
- $edate = date("Y-n-j 23:59:59",$end_timestamp);
216
-
217
- $query_str = "SELECT li.id as id, " .
218
- "(SELECT COUNT(DISTINCT cl.vuid) FROM {$prli_click->table_name} cl " .
219
- "WHERE cl.link_id = li.id" . $prli_click->get_exclude_where_clause( ' AND' ) . " " .
220
- "AND cl.vuid IN (SELECT DISTINCT cl2.vuid " .
221
- "FROM {$prli_click->table_name} cl2 " .
222
- "WHERE cl2.link_id=%d " .
223
- "AND cl.created_at < cl2.created_at " .
224
- "AND cl2.created_at BETWEEN %s AND %s" .
225
- $prli_click->get_exclude_where_clause( ' AND' ) . ") " .
226
- "AND cl.created_at BETWEEN %s AND %s" .
227
- ") as conversions " .
228
- "FROM {$prli_link->table_name} li " .
229
- "WHERE li.id IN (".implode(',',$links).") " .
230
- "AND li.link_status='enabled' " .
231
- "ORDER BY li.name";
232
-
233
- $query = $wpdb->prepare( $query_str, $goal_link_id, $sdate, $edate, $sdate, $edate );
234
- $records = $wpdb->get_results($query);
235
-
236
- $link_conversions = array();
237
- foreach($records as $record) {
238
- $link_conversions[] = $record->conversions;
239
- }
240
-
241
- return $link_conversions;
242
- }
243
-
244
- public function get_chart_height($report_id,$line_height = 30) {
245
- $links = $this->get_report_links_array($report_id);
246
- return $line_height * count($links);
247
- }
248
-
249
- public function setupClicksByLinkBarGraph($start_timestamp, $end_timestamp, $report_id, $title_only = false) {
250
- global $wpdb, $prli_utils, $prli_link, $prli_click;
251
-
252
- $report = $this->getOne($report_id);
253
- $links = $this->get_report_links_array($report_id);
254
- $labels_array = $this->get_labels_by_links($start_timestamp, $end_timestamp, $links);
255
- $clicks_array = $this->get_clicks_by_links($start_timestamp, $end_timestamp, $links);
256
- $uniques_array = $this->get_clicks_by_links($start_timestamp, $end_timestamp, $links, true);
257
-
258
- if($title_only) {
259
- return __("Pretty Links Pro: Clicks for", 'pretty-link').' '.stripslashes($report->name).' '.__('report between', 'pretty-link').' '.date("Y-n-j",$start_timestamp).' '.__('and', 'pretty-link').' '.date("Y-n-j", $end_timestamp);
260
- }
261
-
262
- //Setup conversions
263
- if(!empty($report->goal_link_id)) {
264
- $conversions_array = $this->get_conversions_by_links($start_timestamp, $end_timestamp, $links, $report->goal_link_id);
265
-
266
- $chart_data = array('cols' => array(array("label" => __('Link', 'pretty-link'), 'type' => 'string'), array("label" => __('All Clicks', 'pretty-link'), 'type' => 'number'), array("label" => __('Unique Clicks', 'pretty-link'), 'type' => 'number'), array("label" => __('Conversions', 'pretty-link'), 'type' => 'number')));
267
-
268
- foreach($labels_array as $key => $value) {
269
- $label = substr(addslashes($value),0,40);
270
-
271
- $chart_data['rows'][] = array('c' => array(array('v' => $label, 'f' => null), array('v' => (int)$clicks_array[$key], 'f' => null), array('v' => (int)$uniques_array[$key], 'f' => null), array('v' => (int)$conversions_array[$key], 'f' => null)));
272
- }
273
- }
274
- else { //Setup the clicks w/out conversions
275
- $chart_data = array('cols' => array(array("label" => __('Link', 'pretty-link'), 'type' => 'string'), array("label" => __('All Clicks', 'pretty-link'), 'type' => 'number'), array("label" => __('Unique Clicks', 'pretty-link'), 'type' => 'number')));
276
-
277
- foreach($labels_array as $key => $value) {
278
- $label = substr(addslashes($value),0,40);
279
-
280
- $chart_data['rows'][] = array('c' => array(array('v' => $label, 'f' => null), array('v' => (int)$clicks_array[$key], 'f' => null), array('v' => (int)$uniques_array[$key], 'f' => null)));
281
- }
282
- }
283
-
284
- return $chart_data;
285
- }
286
-
287
- // SPLIT TEST REPORT FUNCTIONS
288
- public function get_split_report_links_array($link_id) {
289
- global $prli_link,$plp_link_rotation;
290
-
291
- $link = $prli_link->getOne($link_id);
292
-
293
- $rotation_urls = $plp_link_rotation->get_rotations($link_id);
294
-
295
- if($rotation_urls and is_array($rotation_urls)) {
296
- array_unshift($rotation_urls,$link->url);
297
- }
298
- else {
299
- $rotation_urls = array($link->url);
300
- }
301
-
302
- $new_rotation_urls = array();
303
- foreach($rotation_urls as $rotation_url) {
304
- if(!empty($rotation_url)) {
305
- $new_rotation_urls[] = $rotation_url;
306
- }
307
- }
308
-
309
- return $new_rotation_urls;
310
- }
311
-
312
- public function get_split_labels($link_id) {
313
- $urls = $this->get_split_report_links_array($link_id);
314
-
315
- $new_urls = array();
316
- foreach($urls as $url) {
317
- $new_urls[] = substr($url,0,40);
318
- }
319
-
320
- return $new_urls;
321
- }
322
-
323
- public function get_split_clicks($start_timestamp,$end_timestamp,$link_id,$uniques=false) {
324
- global $wpdb, $prli_click, $plp_link_rotation;
325
- $query_str = "SELECT cr.url as url, COUNT(".(($uniques)?'DISTINCT cl.vuid':'cl.id').") as clicks FROM {$prli_click->table_name} cl " .
326
- "JOIN {$plp_link_rotation->cr_table_name} cr ON cl.id=cr.click_id " .
327
- "WHERE cl.link_id=%d" .
328
- $prli_click->get_exclude_where_clause( ' AND' ) . " " .
329
- "AND cl.created_at BETWEEN %s AND %s " .
330
- "GROUP BY cr.url";
331
- $query = $wpdb->prepare( $query_str, $link_id, date("Y-n-j 00:00:00",$start_timestamp), date("Y-n-j 23:59:59",$end_timestamp) );
332
- $records = $wpdb->get_results($query, ARRAY_A);
333
-
334
- if($records and is_array($records)) {
335
- $link_records = array();
336
- foreach($records as $record) {
337
- $link_records[$record['url']] = $record['clicks'];
338
- }
339
-
340
- return $link_records;
341
- }
342
- else {
343
- return false;
344
- }
345
- }
346
-
347
- public function get_split_conversions($start_timestamp,$end_timestamp,$link_id,$goal_link_id) {
348
- global $wpdb, $prli_click, $plp_link_rotation;
349
-
350
- $sdate = date("Y-n-j 00:00:00",$start_timestamp);
351
- $edate = date("Y-n-j 23:59:59",$end_timestamp);
352
-
353
- $query_str = "SELECT cr.url as url, COUNT(DISTINCT cl.vuid) as conversions " .
354
- "FROM {$prli_click->table_name} cl " .
355
- "JOIN {$plp_link_rotation->cr_table_name} cr ON cl.id=cr.click_id " .
356
- "WHERE cl.link_id=%d" . $prli_click->get_exclude_where_clause( ' AND' ) . " " .
357
- "AND cl.vuid IN (SELECT DISTINCT cl2.vuid " .
358
- "FROM {$prli_click->table_name} cl2 " .
359
- "WHERE cl2.link_id=%d " .
360
- "AND cl.created_at < cl2.created_at " .
361
- $prli_click->get_exclude_where_clause( ' AND','cl2' ) . ") " .
362
- "AND cl.created_at BETWEEN %s AND %s " .
363
- "GROUP BY cr.url";
364
-
365
- $query = $wpdb->prepare( $query_str, $link_id, $goal_link_id, $sdate, $edate );
366
- $records = $wpdb->get_results($query, ARRAY_A);
367
-
368
- if($records and is_array($records)) {
369
- $link_records = array();
370
- foreach($records as $record) {
371
- $link_records[$record['url']] = $record['conversions'];
372
- }
373
-
374
- return $link_records;
375
- }
376
- else {
377
- return false;
378
- }
379
- }
380
-
381
- public function split_test_chart_data($start_timestamp, $end_timestamp, $link_id, $title_only = false) {
382
- global $wpdb, $prli_utils, $prli_link, $prli_link_meta, $prli_click;
383
-
384
- $link = $prli_link->getOne($link_id);
385
- $links = $this->get_split_report_links_array($link_id);
386
- $goal_link_id = $prli_link_meta->get_link_meta($link_id, 'prli-split-test-goal-link', true);
387
-
388
- $labels_array = $links;
389
- $hits_array = $this->get_split_clicks($start_timestamp, $end_timestamp, $link_id);
390
- $uniques_array = $this->get_split_clicks($start_timestamp, $end_timestamp, $link_id, true);
391
-
392
- $hits = array();
393
- $uniques = array();
394
- for($i=0;$i<count($links);$i++) {
395
- $hits[$i] = ((is_array($hits_array) and isset($hits_array[$links[$i]]) and !empty($hits_array[$links[$i]]))?$hits_array[$links[$i]]:0);
396
- $uniques[$i] = ((is_array($uniques_array) and isset($uniques_array[$links[$i]]) and !empty($uniques_array[$links[$i]]))?$uniques_array[$links[$i]]:0);
397
- }
398
-
399
- if($title_only) {
400
- return __("Pretty Links Pro: Split Report for", 'pretty-link')." ".stripslashes($link->name)." ".__("between", 'pretty-link')." ".date("Y-n-j",$start_timestamp).' '.__('and', 'pretty-link').' '.date("Y-n-j", $end_timestamp);
401
- }
402
-
403
- //Setup conversions
404
- if(!empty($goal_link_id) and $goal_link_id) {
405
- $conversions_array = $this->get_split_conversions($start_timestamp, $end_timestamp, $link_id, $goal_link_id);
406
- $conversions = array();
407
-
408
- for($i = 0; $i < count($links); $i++) {
409
- $conversions[$i] = ((is_array($conversions_array) and isset($conversions_array[$links[$i]]) and !empty($conversions_array[$links[$i]]))?$conversions_array[$links[$i]]:0);
410
- }
411
-
412
- $chart_data = array('cols' => array(array("label" => __('Rotation', 'pretty-link'), 'type' => 'string'), array("label" => __('All Clicks', 'pretty-link'), 'type' => 'number'), array("label" => __('Unique Clicks', 'pretty-link'), 'type' => 'number'), array("label" => __('Conversions', 'pretty-link'), 'type' => 'number')));
413
-
414
- foreach($labels_array as $key => $value) {
415
- $chart_data['rows'][] = array('c' => array(array('v' => $value, 'f' => null), array('v' => (int)$hits[$key], 'f' => null), array('v' => (int)$uniques[$key], 'f' => null), array('v' => (int)$conversions[$key], 'f' => null)));
416
- }
417
- }
418
- else { //Setup the clicks w/out conversions
419
- $chart_data = array('cols' => array(array("label" => __('Rotation', 'pretty-link'), 'type' => 'string'), array("label" => __('All Clicks', 'pretty-link'), 'type' => 'number'), array("label" => __('Unique Clicks', 'pretty-link'), 'type' => 'number')));
420
-
421
- foreach($labels_array as $key => $value) {
422
- $chart_data['rows'][] = array('c' => array(array('v' => $value, 'f' => null), array('v' => (int)$hits[$key], 'f' => null), array('v' => (int)$uniques[$key], 'f' => null)));
423
- }
424
- }
425
-
426
- return $chart_data;
427
- }
428
-
429
- private function common_report_vars() {
430
- global $prli_siteurl, $prli_utils;
431
-
432
- $params = $this->get_params_array();
433
- $first_click = $prli_utils->getFirstClickDate();
434
-
435
- // Adjust for the first click
436
- if(isset($first_click)) {
437
- $min_date = (int)((time()-$first_click)/60/60/24);
438
-
439
- if($min_date < 30) {
440
- $start_timestamp = $prli_utils->get_start_date($params,$min_date);
441
- }
442
- else {
443
- $start_timestamp = $prli_utils->get_start_date($params,30);
444
- }
445
-
446
- $end_timestamp = $prli_utils->get_end_date($params);
447
- }
448
- else {
449
- $min_date = 0;
450
- $start_timestamp = time();
451
- $end_timestamp = time();
452
- }
453
-
454
- return array(
455
- 'id' => $params['id'],
456
- 'first_click' => $first_click,
457
- 'min_date' => ($min_date * -1),
458
- 'start_timestamp' => $start_timestamp,
459
- 'end_timestamp' => $end_timestamp
460
- );
461
- }
462
-
463
- /* Add header to prli-custom-report page */
464
- public function custom_report_vars() {
465
- $vars = $this->common_report_vars();
466
-
467
- extract($vars);
468
-
469
- $report = $this->getOne($id);
470
- $data = $this->setupClicksByLinkBarGraph($start_timestamp, $end_timestamp, $id);
471
- $title = $this->setupClicksByLinkBarGraph($start_timestamp, $end_timestamp, $id, true);
472
-
473
- return array_merge(
474
- compact( 'title', 'data', 'report' ),
475
- $vars
476
- );
477
- }
478
-
479
- /* Add header to prli-split-test-report page */
480
- public function split_test_report_vars() {
481
- global $prli_link;
482
-
483
- $vars = $this->common_report_vars();
484
-
485
- extract($vars);
486
-
487
- $link = $prli_link->getOne($id);
488
- $data = $this->split_test_chart_data($start_timestamp, $end_timestamp, $id);
489
- $title = $this->split_test_chart_data($start_timestamp, $end_timestamp, $id, true);
490
-
491
- return array_merge(
492
- compact( 'title', 'data', 'link' ),
493
- $vars
494
- );
495
- }
496
- }
497
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/app/models/PlpUrlReplacement.php DELETED
@@ -1,409 +0,0 @@
1
- <?php
2
- if(!defined('ABSPATH')) { die('You are not allowed to call this page directly.'); }
3
-
4
- class PlpUrlReplacement {
5
- public $post_urls_table_name;
6
-
7
- public function __construct() {
8
- global $wpdb;
9
- $this->post_urls_table_name = "{$wpdb->prefix}prli_post_urls";
10
- }
11
-
12
- /** This will get all of the keywords to urls for the given post.
13
- * This is also where our smart-caching will come into play.
14
- */
15
- public function get_post_urls_lookup($post_id) {
16
- static $urls;
17
-
18
- if(!isset($urls)) {
19
- $urls = array();
20
- }
21
-
22
- if(!isset($urls[$post_id])) {
23
- $index_keywords = get_option('plp_index_keywords', false);
24
- if(empty($index_keywords)) { return $this->getURLToLinksArray(); }
25
-
26
- global $wpdb, $prli_blogurl, $prli_link, $prli_link_meta;
27
-
28
- $q = "
29
- SELECT plm.meta_value AS replacement_url,
30
- CONCAT(%s,li.slug) AS url
31
- FROM {$prli_link->table_name} AS li
32
- JOIN {$prli_link_meta->table_name} AS plm
33
- ON li.id=plm.link_id
34
- AND plm.meta_key='prli-url-replacements'
35
- JOIN {$this->post_urls_table_name} AS pu
36
- ON plm.id = pu.url_id
37
- WHERE pu.post_id=%d
38
- AND plm.meta_value <> %s
39
- AND li.link_status='enabled'
40
- ";
41
-
42
- $struct = PrliUtils::get_permalink_pre_slug_uri();
43
- $q = $wpdb->prepare($q, $prli_blogurl.$struct, $post_id, '');
44
-
45
- $replacement_urls = $wpdb->get_results($q);
46
-
47
- $urls[$post_id] = $this->format_urls_array($replacement_urls);
48
- }
49
-
50
- return $urls[$post_id];
51
- }
52
-
53
- public function getURLToLinksArray() {
54
- static $urls;
55
-
56
- if(!isset($urls)) {
57
- global $wpdb, $prli_blogurl, $prli_link, $prli_link_meta;
58
-
59
- $struct = PrliUtils::get_permalink_pre_slug_uri();
60
- $query = "
61
- SELECT plm.meta_value as replacement_url,
62
- CONCAT(%s,li.slug) AS url
63
- FROM {$prli_link->table_name} li
64
- JOIN {$prli_link_meta->table_name} plm
65
- ON li.id = plm.link_id
66
- WHERE plm.meta_key='prli-url-replacements'
67
- AND plm.meta_value <> %s
68
- AND li.link_status='enabled'
69
- ";
70
-
71
- $query = $wpdb->prepare($query, $prli_blogurl . $struct, '');
72
- $replacement_urls = $wpdb->get_results($query);
73
-
74
- $urls = $this->format_urls_array($replacement_urls);
75
- }
76
-
77
- return $urls;
78
- }
79
-
80
- private function format_urls_array($replacement_urls) {
81
- if(!is_array($replacement_urls) || empty($replacement_urls)) { return array(); }
82
-
83
- $links_array = array();
84
-
85
- foreach($replacement_urls as $replacement_url) {
86
- if(isset($links_array[$replacement_url->replacement_url])) {
87
- $links_array[$replacement_url->replacement_url][] = $replacement_url->url;
88
- }
89
- else {
90
- $links_array[$replacement_url->replacement_url] = array($replacement_url->url);
91
- }
92
- }
93
-
94
- return $links_array;
95
- }
96
-
97
- private function get_post_grouped_urls ($post_id) {
98
- global $wpdb, $plp_options, $prli_link, $prli_link_meta;
99
-
100
- $valid_types = $plp_options->autocreate_valid_types();
101
- $valid_types = "'".implode("', '", $valid_types)."'";
102
-
103
- $q = "
104
- SELECT * FROM (
105
- SELECT plm.meta_value AS url,
106
- MIN(plm.id) AS id
107
- FROM {$prli_link_meta->table_name} AS plm
108
- JOIN {$wpdb->posts} AS p
109
- ON p.ID=%d
110
- LEFT JOIN {$wpdb->postmeta} AS pm
111
- ON pm.post_id=p.ID
112
- AND pm.meta_key='_plp_post_urls_updated_at'
113
- WHERE plm.meta_key='prli-url-replacements'
114
- AND p.post_status='publish'
115
- AND p.post_type IN ({$valid_types})
116
- AND (
117
- pm.meta_value IS NULL
118
- OR pm.meta_value < plm.created_at
119
- )
120
- GROUP BY plm.meta_value
121
- ) AS u
122
- ORDER BY CHAR_LENGTH(u.url) DESC, u.url ASC
123
- ";
124
- $q = $wpdb->prepare($q, $post_id);
125
-
126
- $urls = $wpdb->get_results($q);
127
-
128
- return $urls;
129
- }
130
-
131
- private function get_comment_grouped_urls ($comment_id) {
132
- global $wpdb, $plp_options, $prli_link, $prli_link_meta;
133
-
134
- $valid_types = $plp_options->autocreate_valid_types();
135
- $valid_types = "'".implode("', '", $valid_types)."'";
136
-
137
- $q = "
138
- SELECT * FROM (
139
- SELECT plm.meta_value AS url,
140
- MIN(plm.id) AS id
141
- FROM {$prli_link_meta->table_name} AS plm
142
- JOIN {$wpdb->comments} AS c
143
- ON c.comment_ID=%d
144
- JOIN {$wpdb->posts} AS p
145
- ON p.ID=c.comment_post_ID
146
- LEFT JOIN {$wpdb->commentmeta} AS cm
147
- ON cm.comment_id=c.comment_ID
148
- AND cm.meta_key='_plp_comment_urls_updated_at'
149
- WHERE plm.meta_key='prli-url-replacements'
150
- AND c.comment_approved=1
151
- AND p.post_status='publish'
152
- AND p.post_type IN ({$valid_types})
153
- AND (
154
- cm.meta_value IS NULL
155
- OR cm.meta_value < plm.created_at
156
- )
157
- GROUP BY plm.meta_value
158
- ) AS u
159
- ORDER BY CHAR_LENGTH(u.url) DESC, u.url ASC
160
- ";
161
- $q = $wpdb->prepare($q, $comment_id);
162
-
163
- $urls = $wpdb->get_results($q);
164
-
165
- return $urls;
166
- }
167
-
168
- public function index_post ($post_id) {
169
- global $plp_options;
170
- $urls = $this->get_post_grouped_urls($post_id);
171
- $post_content = PrliUtils::get_post_content($post_id);
172
- $this->index_content($post_id, $urls, $post_content);
173
- update_post_meta($post_id, '_plp_post_urls_updated_at', PrliUtils::now());
174
- }
175
-
176
- public function index_comment ($comment_id) {
177
- global $plp_options;
178
- $urls = $this->get_comment_grouped_urls($comment_id);
179
- $comment_content = get_comment_text($comment_id);
180
- $comment = get_comment($comment_id);
181
- $this->index_content($comment->comment_post_ID, $urls, $comment_content);
182
- update_comment_meta($comment_id, '_plp_comment_urls_updated_at', PrliUtils::now());
183
- }
184
-
185
- private function index_content ($post_id, &$urls, &$content) {
186
- $url_ids = array();
187
-
188
- foreach($urls as $url) {
189
- if(preg_match('!\b'.preg_quote($url->url,'!').'\b!i', $content)) {
190
- $url_ids[] = $url->id;
191
- }
192
- }
193
-
194
- // Add all keywords in one swath
195
- return $this->add_post_urls($post_id, $url_ids);
196
- }
197
-
198
- private function add_post_urls ($post_id, $url_ids) {
199
- global $wpdb;
200
-
201
- if(empty($url_ids)) { return false; }
202
-
203
- // We got a unique index folks so we just ignore dups yo
204
- // But we just want to grab one random url to insert here
205
- $q = "
206
- INSERT IGNORE INTO {$this->post_urls_table_name}
207
- (post_id, url_id)
208
- VALUES
209
- ";
210
-
211
- $vals = array();
212
- foreach($url_ids as $url_id) {
213
- // Not sure how this would ever be un-true but let's make sure it doesn't happen
214
- if($url_id > 0 && $post_id > 0) {
215
- $vals[] = $wpdb->prepare("(%d, %d)", $post_id, $url_id);
216
- }
217
- }
218
-
219
- // No values to insert? Let's bail.
220
- if(empty($vals)) { return false; }
221
-
222
- $q .= implode(',',$vals);
223
-
224
- return $wpdb->query($q);
225
- }
226
-
227
- // SELECT posts where updated_at < than max link updated_at
228
- public function get_indexable_posts ($max_count=100) {
229
- global $wpdb, $plp_options, $prli_link, $prli_link_meta, $plp_keyword;
230
-
231
- $plp_keyword->update_links_with_null_updated_at();
232
-
233
- $valid_types = $plp_options->autocreate_valid_types();
234
- $valid_types = "'".implode("', '", $valid_types)."'";
235
-
236
- $q = "
237
- SELECT max(plm.created_at)
238
- FROM {$prli_link_meta->table_name} AS plm
239
- WHERE plm.meta_key='prli-url-replacements'
240
- ";
241
- $max_updated_at = $wpdb->get_var($q);
242
-
243
- // Order to get oldest / null entries updated first
244
- $q = $wpdb->prepare("
245
- SELECT ID
246
- FROM {$wpdb->posts} AS p
247
- LEFT JOIN {$wpdb->postmeta} AS pm
248
- ON p.ID=pm.post_id
249
- AND pm.meta_key='_plp_post_urls_updated_at'
250
- WHERE p.post_status = 'publish'
251
- AND p.post_type IN ({$valid_types})
252
- AND (
253
- pm.meta_value IS NULL
254
- OR pm.meta_value < %s
255
- )
256
- ORDER BY pm.meta_value ASC,
257
- p.post_date DESC
258
- LIMIT %d
259
- ",
260
- $max_updated_at,
261
- $max_count
262
- );
263
- $posts = $wpdb->get_col($q);
264
-
265
- return $posts;
266
- }
267
-
268
- // SELECT posts where updated_at < than max link updated_at
269
- public function get_indexable_comments ($max_count=100) {
270
- global $wpdb, $plp_options, $prli_link, $prli_link_meta, $plp_keyword;
271
-
272
- $plp_keyword->update_links_with_null_updated_at();
273
-
274
- $valid_types = $plp_options->autocreate_valid_types();
275
- $valid_types = "'".implode("', '", $valid_types)."'";
276
-
277
- $q = "
278
- SELECT max(plm.created_at)
279
- FROM {$prli_link_meta->table_name} AS plm
280
- WHERE plm.meta_key='prli-url-replacements'
281
- ";
282
- $max_updated_at = $wpdb->get_var($q);
283
-
284
- // Order to get oldest / null entries updated first
285
- $q = $wpdb->prepare("
286
- SELECT c.comment_ID
287
- FROM {$wpdb->comments} AS c
288
- INNER JOIN {$wpdb->posts} AS p
289
- ON c.comment_post_ID=p.ID
290
- AND p.post_status = 'publish'
291
- AND p.post_type IN ({$valid_types})
292
- LEFT JOIN {$wpdb->commentmeta} AS cm
293
- ON c.comment_ID=cm.comment_id
294
- AND cm.meta_key='_plp_comment_urls_updated_at'
295
- WHERE c.comment_approved=1
296
- AND (
297
- cm.meta_value IS NULL
298
- OR cm.meta_value < %s
299
- )
300
- ORDER BY cm.meta_value ASC,c.comment_date DESC
301
- LIMIT %d
302
- ",
303
- $max_updated_at,
304
- $max_count
305
- );
306
- $comments = $wpdb->get_col($q);
307
-
308
- return $comments;
309
- }
310
-
311
- // How many posts out of all are indexed
312
- public function posts_indexed () {
313
- global $wpdb, $prli_link, $plp_options, $prli_link_meta;
314
-
315
- $valid_types = $plp_options->autocreate_valid_types();
316
- $valid_types = "'".implode("', '", $valid_types)."'";
317
-
318
- $q = "
319
- SELECT max(plm.created_at)
320
- FROM {$prli_link_meta->table_name} AS plm
321
- WHERE plm.meta_key='prli-url-replacements'
322
- ";
323
- $max_updated_at = $wpdb->get_var($q);
324
-
325
- // Num un-indexed posts
326
- $q = $wpdb->prepare("
327
- SELECT COUNT(*)
328
- FROM {$wpdb->posts} AS p
329
- LEFT JOIN {$wpdb->postmeta} AS pm
330
- ON p.ID=pm.post_id
331
- AND pm.meta_key='_plp_post_urls_updated_at'
332
- WHERE p.post_status = 'publish'
333
- AND p.post_type IN ({$valid_types})
334
- AND (
335
- pm.meta_value IS NULL
336
- OR pm.meta_value < %s
337
- )
338
- ORDER BY pm.meta_value
339
- ",
340
- $max_updated_at
341
- );
342
- $unindexed = $wpdb->get_var($q);
343
-
344
- $q = "
345
- SELECT COUNT(*)
346
- FROM {$wpdb->posts} AS p
347
- WHERE p.post_status = 'publish'
348
- AND p.post_type IN ({$valid_types})
349
- ";
350
- $total = $wpdb->get_var($q);
351
-
352
- $indexed = ($total - $unindexed);
353
-
354
- return (object)compact('total', 'indexed', 'unindexed');
355
- }
356
-
357
- // How many comments out of all are indexed
358
- public function comments_indexed () {
359
- global $wpdb, $prli_link, $plp_options, $prli_link_meta;
360
-
361
- $valid_types = $plp_options->autocreate_valid_types();
362
- $valid_types = "'".implode("', '", $valid_types)."'";
363
-
364
- $q = "
365
- SELECT max(plm.created_at)
366
- FROM {$prli_link_meta->table_name} AS plm
367
- WHERE plm.meta_key='prli-url-replacements'
368
- ";
369
- $max_updated_at = $wpdb->get_var($q);
370
-
371
- // Num un-indexed posts
372
- $q = $wpdb->prepare("
373
- SELECT COUNT(*)
374
- FROM {$wpdb->comments} AS c
375
- INNER JOIN {$wpdb->posts} AS p
376
- ON c.comment_post_ID=p.ID
377
- AND p.post_status = 'publish'
378
- AND p.post_type IN ({$valid_types})
379
- LEFT JOIN {$wpdb->commentmeta} AS cm
380
- ON c.comment_ID=cm.comment_id
381
- AND cm.meta_key='_plp_comment_urls_updated_at'
382
- WHERE c.comment_approved=1
383
- AND (
384
- cm.meta_value IS NULL
385
- OR cm.meta_value < %s
386
- )
387
- ORDER BY cm.meta_value
388
- ",
389
- $max_updated_at
390
- );
391
- $unindexed = $wpdb->get_var($q);
392
-
393
- $q = "
394
- SELECT COUNT(*)
395
- FROM {$wpdb->comments} AS c
396
- INNER JOIN {$wpdb->posts} AS p
397
- ON c.comment_post_ID=p.ID
398
- AND p.post_status = 'publish'
399
- AND p.post_type IN ({$valid_types})
400
- WHERE c.comment_approved=1
401
- ";
402
- $total = $wpdb->get_var($q);
403
-
404
- $indexed = ($total - $unindexed);
405
-
406
- return (object)compact('total', 'indexed', 'unindexed');
407
- }
408
- }
409
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/app/models/PlpUtils.php DELETED
@@ -1,276 +0,0 @@
1
- <?php
2
- if(!defined('ABSPATH')) { die('You are not allowed to call this page directly.'); }
3
-
4
- class PlpUtils {
5
- public static function sort_by_stringlen($word_array,$dir = 'ASC')
6
- {
7
- if( $dir == "ASC" ) {
8
- uasort($word_array, 'PlpUtils::compare_stringlen_asc');
9
- }
10
- else if( $dir == "DESC" ) {
11
- uasort($word_array, 'PlpUtils::compare_stringlen_desc');
12
- }
13
-
14
- return $word_array;
15
- }
16
-
17
- /**
18
- * This function expects an array of weights in integer
19
- * form [ 35, 25, 15, 50 ] that add up to 100.
20
- */
21
- public static function w_rand($weights) {
22
- $r = mt_rand(1,1000);
23
- $offset = 0;
24
- foreach ($weights as $k => $w) {
25
- $offset += $w*10;
26
- if ($r <= $offset) { return $k; }
27
- }
28
- }
29
-
30
- public static function ga_installed() {
31
- if(!function_exists('is_plugin_active')) {
32
- require(ABSPATH . '/wp-admin/includes/plugin.php');
33
- }
34
-
35
- if(is_plugin_active('google-analyticator/google-analyticator.php')) {
36
- return array('name' => __('Google Analyticator', 'pretty-link'), 'slug' => 'google-analyticator');
37
- }
38
- // DEPRECATED support on Jan 2020
39
- // else if(is_plugin_active('google-analytics-for-wordpress/googleanalytics.php')) {
40
- // return array('name' => __('Google Analytics by MonsterInsights', 'pretty-link'), 'slug' => 'google-analytics-for-wordpress');
41
- // }
42
- // else if(is_plugin_active('googleanalytics/googleanalytics.php')) {
43
- // return array('name' => __('Google Analytics', 'pretty-link'), 'slug' => 'google-analytics');
44
- // }
45
- else {
46
- return false;
47
- }
48
- }
49
-
50
- public static function ga_tracking_code($ga_plugin_slug) {
51
- ob_start();
52
-
53
- if($ga_plugin_slug == 'google-analyticator' && function_exists('add_google_analytics')) {
54
- add_google_analytics();
55
- }
56
- // DEPRECATED support on Jan 2020
57
- // elseif($ga_plugin_slug == 'google-analytics-for-wordpress' && class_exists('Yoast_GA_JS') && class_exists('Yoast_GA_Options') && class_exists('Yoast_GA_Universal')) {
58
- // //Working as of vs 5.4.9 of the GA plugin by MonsterInsights -- they keep changing this though :(
59
- // $yoast_ops = Yoast_GA_Options::instance()->options;
60
-
61
- // if(isset($yoast_ops->options['enable_universal']) && $yoast_ops->options['enable_universal'] == 1) {
62
- // $tracking = new Yoast_GA_Universal;
63
- // } else {
64
- // $tracking = new Yoast_GA_JS;
65
- // }
66
-
67
- // $tracking->tracking();
68
- // }
69
- // elseif($ga_plugin_slug == 'google-analytics' && class_exists('Ga_Frontend')) {
70
- // Ga_Frontend::googleanalytics();
71
- // }
72
-
73
- return ob_get_clean();
74
- }
75
-
76
- // Utility functions not part of this class //
77
- public static function compare_stringlen_asc($val_1, $val_2) {
78
- // initialize the return value to zero
79
- $retVal = 0;
80
-
81
- // compare lengths
82
- $firstVal = strlen($val_1);
83
- $secondVal = strlen($val_2);
84
-
85
- if($firstVal > $secondVal) {
86
- $retVal = 1;
87
- }
88
- else if($firstVal < $secondVal) {
89
- $retVal = -1;
90
- }
91
-
92
- return $retVal;
93
- }
94
-
95
- public static function compare_stringlen_desc($val_1, $val_2) {
96
- // initialize the return value to zero
97
- $retVal = 0;
98
-
99
- // compare lengths
100
- $firstVal = strlen($val_1);
101
- $secondVal = strlen($val_2);
102
-
103
- if($firstVal > $secondVal) {
104
- $retVal = -1;
105
- }
106
- else if($firstVal < $secondVal) {
107
- $retVal = 1;
108
- }
109
-
110
- return $retVal;
111
- }
112
-
113
- public static function locate_by_ip($ip=null, $source='caseproof') {
114
- global $prli_utils;
115
- $ip = (is_null($ip)?$prli_utils->get_current_client_ip():$ip);
116
-
117
- if(!self::is_ip($ip)) { return false; }
118
-
119
- $lockey = 'pl_locate_by_ip_' . md5($ip.$source);
120
- $loc = get_transient($lockey);
121
-
122
- if(false===$loc) {
123
- if($source=='caseproof') {
124
- $url = "https://cspf-locate.herokuapp.com?ip={$ip}";
125
- $cindex = 'country_code';
126
- }
127
- elseif($source=='freegeoip') {
128
- $url = "https://freegeoip.net/json/{$ip}";
129
- $cindex = 'country_code';
130
- }
131
- else { // geoplugin
132
- $url = "http://www.geoplugin.net/json.gp?ip={$ip}";
133
- $cindex = 'geoplugin_countryCode';
134
- }
135
-
136
- $res = wp_remote_get($url);
137
- if(is_wp_error($res)) { return ''; }
138
- $obj = json_decode($res['body']);
139
- $country = (isset($obj->{$cindex})?$obj->{$cindex}:'');
140
-
141
- $loc = (object)compact('country');
142
- set_transient($lockey,$loc,DAY_IN_SECONDS);
143
- }
144
-
145
- return $loc;
146
- }
147
-
148
- public static function is_ip($ip, $version='any') {
149
- $ipv4_pattern = '#^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$#i';
150
- $ipv6_pattern = '/^(((?=.*(::))(?!.*\3.+\3))\3?|([\dA-F]{1,4}(\3|:\b|$)|\2))(?4){5}((?4){2}|(((2[0-4]|1\d|[1-9])?\d|25[0-5])\.?\b){4})\z/i';
151
-
152
- return (
153
- ($version==4 && preg_match($ipv4_pattern,$ip)) ||
154
- ($version==6 && preg_match($ipv6_pattern,$ip)) ||
155
- ($version=='any' && (preg_match($ipv4_pattern,$ip) || preg_match($ipv6_pattern,$ip)))
156
- );
157
- }
158
-
159
- public static function country_by_ip($ip=null, $source='geoplugin') {
160
- return (($loc = self::locate_by_ip()) ? $loc->country : '' );
161
- }
162
-
163
- public static function base36_encode($base10) {
164
- return base_convert($base10, 10, 36);
165
- }
166
-
167
- public static function base36_decode($base36) {
168
- return base_convert($base36, 36, 10);
169
- }
170
-
171
- public static function is_link_expired($link_id) {
172
- global $prli_link, $prli_link_meta;
173
-
174
- $expire_enabled = $prli_link_meta->get_link_meta($link_id, 'enable_expire', true);
175
-
176
- if(!empty($expire_enabled)) {
177
- $expire_type = $prli_link_meta->get_link_meta($link_id, 'expire_type', true);
178
- $expired = false;
179
-
180
- if($expire_type=='date') {
181
- $expire_date = $prli_link_meta->get_link_meta($link_id, 'expire_date', true);
182
- $now_ts = strtotime(gmdate('c')); //Make sure it's UTC
183
- $expire_ts = strtotime($expire_date); // Expire AFTER the date
184
- $expired = ($now_ts > $expire_ts);
185
- }
186
- else if($expire_type=='clicks') {
187
- $expire_clicks = $prli_link_meta->get_link_meta($link_id, 'expire_clicks', true);
188
- $link = $prli_link->getOne($link_id, OBJECT, true);
189
- $num_clicks = $link->uniques;
190
- //echo "Num Clicks: {$num_clicks} / Expire Clicks: {$expire_clicks}"; exit;
191
- $expired = ($num_clicks >= $expire_clicks);
192
- }
193
-
194
- if($expired) {
195
- $enable_expired_url = $prli_link_meta->get_link_meta($link_id, 'enable_expired_url', true);
196
- $expired_url = $prli_link_meta->get_link_meta($link_id, 'expired_url', true);
197
-
198
- if(!empty($enable_expired_url)) {
199
- return $expired_url;
200
- }
201
- else {
202
- return 404;
203
- }
204
- }
205
- }
206
-
207
- return false;
208
- }
209
-
210
- public static function is_link_time_redirect_active($link_id) {
211
- global $prli_link_meta;
212
-
213
- $time_urls = $prli_link_meta->get_link_meta($link_id, 'time_url');
214
- $time_starts = $prli_link_meta->get_link_meta($link_id, 'time_start');
215
- $time_ends = $prli_link_meta->get_link_meta($link_id, 'time_end');
216
-
217
- $now = time();
218
- foreach($time_urls as $i => $time_url) {
219
- $time_start = strtotime($time_starts[$i]);
220
- $time_end = strtotime($time_ends[$i]);
221
- if($time_start <= $now && $time_end >= $now) {
222
- return $time_url;
223
- }
224
- }
225
-
226
- return false;
227
- }
228
-
229
- /** Get link categories
230
- *
231
- * @param $link_id The id of the link we want to get categories for
232
- *
233
- * @return Array of strings -- category slugs
234
- */
235
- public static function get_link_categories($link_id) {
236
- return self::get_link_terms($link_id, PlpLinkCategoriesController::$ctax);
237
- }
238
-
239
- /** Get link tags
240
- *
241
- * @param $link_id The id of the link we want to get tags for
242
- *
243
- * @return Array of strings -- tag slugs
244
- */
245
- public static function get_link_tags($link_id) {
246
- return self::get_link_terms($link_id, PlpLinkTagsController::$ctax);
247
- }
248
-
249
- /** Get link terms
250
- *
251
- * @param $link_id The id of the link we want to get terms for
252
- * @param $taxonomy The name of the taxonomy
253
- *
254
- * @return Array of strings -- term slugs
255
- */
256
- private static function get_link_terms($link_id, $taxonomy) {
257
- global $prli_link;
258
-
259
- $link = $prli_link->getOne($link_id);
260
- $terms = wp_get_object_terms(array($link->link_cpt_id), array($taxonomy));
261
-
262
- if(is_wp_error($terms)) {
263
- error_log('** Error in PlpUtils::get_link_terms: '. $terms->get_error_message());
264
- $terms = array();
265
- }
266
-
267
- return array_map(
268
- function ($term) {
269
- return $term->slug;
270
- },
271
- $terms
272
- );
273
- }
274
-
275
- } //End class
276
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/app/models/index.php DELETED
@@ -1,2 +0,0 @@
1
- <?php /* Silence will fall */ ?>
2
-
 
 
pro/app/views/import-export/form.php DELETED
@@ -1,52 +0,0 @@
1
- <?php if(!defined('ABSPATH')) { die('You are not allowed to call this page directly.'); } ?>
2
-
3
- <div class="wrap">
4
- <?php PrliAppHelper::page_title(__('Import / Export Links', 'pretty-link')); ?>
5
- <table class="form-table">
6
- <tbody>
7
- <tr>
8
- <th scope="row">
9
- <?php esc_html_e('Export Pretty Links', 'pretty-link'); ?>
10
- <?php PrliAppHelper::info_tooltip(
11
- 'plp-export-links',
12
- esc_html__('Export Pretty Links', 'pretty-link'),
13
- esc_html__('Export Links to a CSV File', 'pretty-link')
14
- ); ?>
15
- </th>
16
- <td>
17
- <a href="<?php echo esc_url(admin_url('admin-ajax.php?action=plp-export-links')); ?>" class="button button-primary"><?php esc_html_e('Export', 'pretty-link'); ?></a>
18
- </td>
19
- </tr>
20
- <tr>
21
- <th scope="row">
22
- <?php esc_html_e('Import Pretty Links', 'pretty-link'); ?>
23
- <?php PrliAppHelper::info_tooltip(
24
- 'plp-import-links',
25
- esc_html__('Import Pretty Links', 'pretty-link'),
26
- sprintf(
27
- esc_html__('There are two ways to import a file.%1$s%1$s1) Importing to update existing links and%1$s%1$s2) Importing to generate new links. When Importing to generate new links, you must delete the "id" column from the CSV before importing. If the "id" column is present, Pretty Links Pro will attempt to update existing links.', 'pretty-link'),
28
- '<br>'
29
- )
30
- ); ?>
31
- </th>
32
- <td>
33
- <form enctype="multipart/form-data" action="<?php echo esc_url(str_replace( '%7E', '~', $_SERVER['REQUEST_URI'])); ?>" method="POST">
34
- <?php wp_nonce_field('update-options'); ?>
35
- <input type="hidden" name="action" value="import">
36
- <input type="hidden" name="MAX_FILE_SIZE" value="1000000" />
37
- <input name="importedfile" type="file" />
38
- <br/>
39
- <input type="submit" class="button button-primary" value="<?php esc_attr_e('Import', 'pretty-link'); ?>" />
40
- <?php PrliAppHelper::info_tooltip(
41
- 'plp-import-links-select-file',
42
- esc_html__('Links Import File', 'pretty-link'),
43
- esc_html__('Select a file that has been formatted as a Pretty Link CSV import file and click "Import"', 'pretty-link')
44
- ); ?>
45
- </form>
46
- </td>
47
- </tr>
48
- </tbody>
49
- </table>
50
-
51
- <p><a href="https://prettylinks.com/plp/import-export/um/importing-and-exporting-your-links" class="button button-primary"><?php esc_html_e('Import/Export Help', 'pretty-link'); ?></a></p>
52
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/app/views/import-export/import-error.php DELETED
@@ -1,11 +0,0 @@
1
- <?php if(!defined('ABSPATH')) { die('You are not allowed to call this page directly.'); } ?>
2
-
3
- <div class="wrap">
4
- <?php PrliAppHelper::page_title(__('Import Error', 'pretty-link')); ?>
5
- <div class="error inline">
6
- <p>
7
- <?php echo esc_html($error); ?>
8
- <a href="<?php echo esc_url(admin_url('edit.php?post_type=' . PrliLink::$cpt . '&page=plp-import-export')); ?>"><?php esc_html_e('&larr; Go back', 'pretty-link'); ?></a>
9
- </p>
10
- </div>
11
- </div>
 
 
 
 
 
 
 
 
 
 
 
pro/app/views/import-export/import.php DELETED
@@ -1,51 +0,0 @@
1
- <?php if(!defined('ABSPATH')) { die('You are not allowed to call this page directly.'); } ?>
2
-
3
- <div class="wrap">
4
- <?php PrliAppHelper::page_title(__('Import Results', 'pretty-link')); ?>
5
- <p><?php echo esc_html(sprintf(__('Total Rows: %s', 'pretty-link'), number_format_i18n($total_row_count))); ?></p>
6
-
7
- <p><?php echo esc_html(sprintf(__('%s Pretty Links were Successfully Created', 'pretty-link'), number_format_i18n($successful_create_count))); ?></p>
8
- <p><?php echo esc_html(sprintf(__('%s Pretty Links were Successfully Updated', 'pretty-link'), number_format_i18n($successful_update_count))); ?></p>
9
-
10
- <?php
11
- if(count($creation_errors) > 0) {
12
- ?>
13
- <p><?php echo esc_html(sprintf(__('Pretty Links were unable to be Created: %s', 'pretty-link'), number_format_i18n(count($creation_errors)))); ?></p>
14
- <?php
15
- foreach($creation_errors as $creation_error) {
16
- ?>
17
- <p class="wp-error"><?php echo esc_html(sprintf(__('Error(s) for Pretty Link with Slug: %s', 'pretty-link'), $creation_error['slug'])); ?><br/>
18
- <?php
19
- foreach( $creation_error['errors'] as $error ) {
20
- ?>
21
- &nbsp;&nbsp;&nbsp;&nbsp;<?php echo esc_html($error); ?><br/>
22
- <?php
23
- }
24
- ?>
25
- </p>
26
- <?php
27
- }
28
- }
29
-
30
- if(count($update_errors) > 0) {
31
- ?>
32
- <p><?php echo esc_html(sprintf(__('Pretty Links were unable to be Updated: %s', 'pretty-link'), number_format_i18n(count($update_errors)))); ?></p>
33
- <?php
34
- foreach($update_errors as $update_error) {
35
- ?>
36
- <p class="wp-error"><?php echo esc_html(sprintf(__('Error(s) for Pretty Link with id: %s', 'pretty-link'), $update_error['id'])); ?><br/>
37
- <?php
38
- foreach( $update_error['errors'] as $error ) {
39
- ?>
40
- &nbsp;&nbsp;&nbsp;&nbsp;<?php echo esc_html($error); ?><br/>
41
- <?php
42
- }
43
- ?>
44
- </p>
45
- <?php
46
- }
47
- }
48
- ?>
49
-
50
- </div>
51
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/app/views/import-export/index.php DELETED
@@ -1,2 +0,0 @@
1
- <?php /* Silence will fall */ ?>
2
-
 
 
pro/app/views/index.php DELETED
@@ -1,2 +0,0 @@
1
- <?php /* Silence will fall */ ?>
2
-
 
 
pro/app/views/links/bulk-edit.php DELETED
@@ -1,31 +0,0 @@
1
- <?php
2
- if(!defined('ABSPATH'))
3
- die('You are not allowed to call this page directly.');
4
- ?>
5
- <div class="inline-edit-group advanced-link-options">
6
- <h4><?php esc_html_e('Advanced Link Options', 'pretty-link'); ?></h4>
7
- <div id="prli_google_analytics" style="display: none;">
8
- <?php
9
- if($ga_info = PlpUtils::ga_installed()):
10
- PrliLinksHelper::bulk_action_checkbox_dropdown('bu[google_tracking]', __('Google Analytics', 'pretty-link'), 'bulk-edit-select'); ?>
11
- <?php endif; ?>
12
- </div>
13
- </div>
14
- <?php /*
15
- <div class="inline-edit-group keyword-replacements">
16
- <?php global $plp_options; ?>
17
- <?php if( $plp_options->keyword_replacement_is_on ): ?>
18
- <h4><?php esc_html_e('Keyword Replacements', 'pretty-link'); ?></h4>
19
- <?php global $plp_options; ?>
20
- <input type="text" name="bu[keywords]" class="bulk-edit-text" />
21
- <br/>
22
- <h4><?php esc_html_e('URL Replacements', 'pretty-link'); ?></h4>
23
- <input type="text" name="bu[url_replacements]" class="bulk-edit-text" />
24
- <br/>
25
- <?php endif; ?>
26
- <div id="prli_time_delay" style="display: none;">
27
- <h4><?php esc_html_e('Redirect Delay', 'pretty-link'); ?></h4>
28
- <input type="text" name="delay" value="0" />
29
- </div>
30
- </div>
31
- */ ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/app/views/links/cloaked-redirect.php DELETED
@@ -1,22 +0,0 @@
1
- <?php if(!defined('ABSPATH')) { die('You are not allowed to call this page directly.'); } ?>
2
- <!DOCTYPE html>
3
- <html>
4
- <head>
5
- <title><?php echo esc_html(stripslashes($pretty_link->name)); ?></title>
6
-
7
- <meta http-equiv="content-type" content="text/html; charset=UTF-8">
8
- <meta name="description" content="<?php echo esc_attr(stripslashes($pretty_link->description)); ?>" />
9
- <meta name="robots" content="noindex" />
10
-
11
- <?php wp_print_styles('prli-cloaked-redirect'); ?>
12
-
13
- <?php if(!empty($google_tracking) && $google_tracking && ($ga_info = PlpUtils::ga_installed())) { echo PlpUtils::ga_tracking_code($ga_info['slug']); } ?>
14
-
15
- <?php do_action('prli-redirect-header'); ?>
16
- </head>
17
- <body>
18
- <iframe src="<?php echo esc_url($pretty_link_url.$param_string); ?>">
19
- <?php esc_html_e('Your browser does not support frames.', 'pretty-link'); ?> Click <a href="<?php echo esc_url($pretty_link_url.$param_string); ?>">here</a> to view the page.
20
- </iframe>
21
- </body>
22
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/app/views/links/form.php DELETED
@@ -1,338 +0,0 @@
1
- <?php if(!defined('ABSPATH')) { die('You are not allowed to call this page directly.'); } ?>
2
-
3
- <table class="form-table">
4
- <tr>
5
- <th scope="row">
6
- <?php esc_html_e('Expire', 'pretty-link'); ?>
7
- <?php PrliAppHelper::info_tooltip(
8
- 'plp-expire',
9
- esc_html__('Expire Link', 'pretty-link'),
10
- esc_html__('Set this link to expire after a specific date or number of clicks.', 'pretty-link')
11
- ); ?>
12
- </th>
13
- <td>
14
- <input class="prli-toggle-checkbox" data-box="plp-expire" type="checkbox" name="enable_expire" <?php checked($enable_expire != 0); ?> />
15
- </td>
16
- </tr>
17
- </table>
18
- <div class="prli-sub-box plp-expire">
19
- <div class="prli-arrow prli-gray prli-up prli-sub-box-arrow"> </div>
20
- <table class="form-table">
21
- <tr>
22
- <th scope="row">
23
- <?php esc_html_e('Expire After', 'pretty-link'); ?>
24
- <?php PrliAppHelper::info_tooltip(
25
- 'plp-expire-type',
26
- esc_html__('Expiration Type', 'pretty-link'),
27
- sprintf(
28
- // translators: %1$s: br tag, %2$s: open b tag, %3$s close b tag
29
- esc_html__('Select the type of expiration you want for this link.%1$s%1$s%2$sDate%3$s Select this option if you\'d like to expire your link after a certain date.%1%s%1$s%2$sClicks%3$s: Select this option to expire this link after it has been clicked a specific number of times.', 'pretty-link'),
30
- '<br>',
31
- '<b>',
32
- '</b>'
33
- )
34
- ); ?>
35
- </th>
36
- <td>
37
- <select id="plp_expire_type" name="expire_type" class="prli-toggle-select" data-date-box="plp-date-expire" data-clicks-box="plp-clicks-expire">
38
- <option value="date" <?php selected($expire_type, 'date'); ?>><?php esc_html_e('Date', 'pretty-link'); ?></option>
39
- <option value="clicks" <?php selected($expire_type, 'clicks'); ?>><?php esc_html_e('Clicks', 'pretty-link'); ?></option>
40
- </select>
41
- </td>
42
- </tr>
43
- </table>
44
- <div class="prli-sub-box-white plp-clicks-expire">
45
- <div class="prli-arrow prli-white prli-up prli-sub-box-arrow"> </div>
46
- <table class="form-table">
47
- <tr>
48
- <th scope="row">
49
- <?php esc_html_e('Clicks', 'pretty-link'); ?>
50
- <?php PrliAppHelper::info_tooltip(
51
- 'plp-clicks-expire',
52
- esc_html__('Number of Clicks', 'pretty-link'),
53
- sprintf(
54
- // translators: %1$s: br tag, %2$s: open b tag, %3$s close b tag
55
- esc_html__('Enter the number of times this link can be clicked before it expires.%1$s%1$s%2$sNote: Expirations based on clicks wouldn\'t work properly if you had tracking turned off for this link so as long as this is set to Clicks, Pretty Link will ensure tracking is turned on for this link as well.%3$s', 'pretty-link'),
56
- '<br>',
57
- '<b>',
58
- '</b>'
59
- )
60
- ); ?>
61
- </th>
62
- <td>
63
- <input type="number" name="expire_clicks" class="small-text" value="<?php echo esc_attr($expire_clicks); ?>" />
64
- </td>
65
- </tr>
66
- </table>
67
- </div>
68
- <div class="prli-sub-box-white plp-date-expire">
69
- <div class="prli-arrow prli-white prli-up prli-sub-box-arrow"> </div>
70
- <table class="form-table">
71
- <tr>
72
- <th scope="row">
73
- <?php esc_html_e('Date', 'pretty-link'); ?>
74
- <?php PrliAppHelper::info_tooltip(
75
- 'plp-expire-date',
76
- esc_html__('Expiration Date', 'pretty-link'),
77
- esc_html__('Enter a date here in the format YYYY-MM-DD to set when this link should expire.', 'pretty-link')
78
- ); ?>
79
- </th>
80
- <td>
81
- <input type="text" class="prli-date-picker regular-text" name="expire_date" value="<?php echo esc_attr($expire_date); ?>" />
82
- </td>
83
- </tr>
84
- </table>
85
- </div>
86
-
87
-
88
- <table class="form-table">
89
- <tr>
90
- <th scope="row">
91
- <?php esc_html_e('Expired Redirect', 'pretty-link'); ?>
92
- <?php PrliAppHelper::info_tooltip(
93
- 'plp-enable-expired-url',
94
- esc_html__('Redirect to URL when Expired', 'pretty-link'),
95
- sprintf(
96
- // translators: %1$s: br tag, %2$s: open b tag, %3$s close b tag
97
- esc_html__('When this link expires, do you want to redirect to a specific URL. You can use this to redirect to a page you\'ve setup to indicate that the link is expired.%1$s%1$s%2$sNote: If this is not set the link will throw a 404 error when expired%3$s.', 'pretty-link'),
98
- '<br>',
99
- '<b>',
100
- '</b>'
101
- )
102
- ); ?>
103
- </th>
104
- <td>
105
- <input class="prli-toggle-checkbox" data-box="plp-expired-url" type="checkbox" name="enable_expired_url" <?php checked($enable_expired_url != 0); ?> />
106
- </td>
107
- </tr>
108
- </table>
109
- <div class="prli-sub-box-white plp-expired-url">
110
- <div class="prli-arrow prli-white prli-up prli-sub-box-arrow"> </div>
111
- <table class="form-table">
112
- <tr>
113
- <th scope="row">
114
- <?php esc_html_e('URL', 'pretty-link'); ?>
115
- <?php PrliAppHelper::info_tooltip(
116
- 'plp-expired-url',
117
- esc_html__('Expired URL', 'pretty-link'),
118
- esc_html__('This is the URL that this link will redirect to after the expiration date above.', 'pretty-link')
119
- ); ?>
120
- </th>
121
- <td>
122
- <input type="text" name="expired_url" class="large-text" value="<?php echo esc_attr($expired_url); ?>" />
123
- </td>
124
- </tr>
125
- </table>
126
- </div>
127
- </div>
128
-
129
- <?php if( $plp_options->keyword_replacement_is_on ): ?>
130
- <table class="form-table">
131
- <tr>
132
- <th scope="row">
133
- <?php esc_html_e('Keywords', 'pretty-link'); ?>
134
- <?php PrliAppHelper::info_tooltip(
135
- 'prli-link-pro-options-keywords',
136
- esc_html__('Auto-Replace Keywords', 'pretty-link'),
137
- esc_html__('Enter a comma separated list of keywords / keyword phrases that you\'d like to replace with this link in your Posts &amp; Pages.', 'pretty-link')); ?>
138
- </th>
139
- <td>
140
- <input type="text" name="keywords" class="large-text" value="<?php echo esc_attr($keywords); ?>" />
141
- </td>
142
- </tr>
143
- <tr>
144
- <th scope="row">
145
- <?php esc_html_e('URL Replacements', 'pretty-link'); ?>
146
- <?php PrliAppHelper::info_tooltip(
147
- 'prli-link-pro-options-url-replacements',
148
- esc_html__('Auto-Replace URLs', 'pretty-link'),
149
- sprintf(
150
- // translators: %1$s: open code tag, %2$s: close code tag
151
- esc_html__('Enter a comma separated list of the URLs that you\'d like to replace with this Pretty Link in your Posts &amp; Pages. These must be formatted as URLs for example: %1$shttp://example.com%2$s or %1$shttp://example.com?product_id=53%2$s', 'pretty-link'),
152
- '<code>',
153
- '</code>'
154
- )
155
- ); ?>
156
- </th>
157
- <td>
158
- <input type="text" name="url_replacements" class="large-text" value="<?php echo esc_attr($url_replacements); ?>" />
159
- </td>
160
- </tr>
161
- </table>
162
- <?php endif; ?>
163
-
164
- <table class="form-table">
165
- <tr>
166
- <th scope="row">
167
- <?php esc_html_e('Head Scripts', 'pretty-link'); ?>
168
- <?php PrliAppHelper::info_tooltip(
169
- 'prli-link-pro-options-head-scripts',
170
- esc_html__('Head Scripts', 'pretty-link'),
171
- sprintf(
172
- // translators: %1$s: br tag, %2$s: open b tag, %3$s close b tag
173
- esc_html__('Useful for adding Google Analytics tracking, Facebook retargeting pixels, or any other kind of tracking script to the HTML head for this pretty link.%1$s%1$sThese scripts will be in addition to any global one\'s you\'ve defined in the options.%1$s%1$s%2$sNOTE:%3$s This does NOT work with 301, 302 and 307 type redirects.', 'pretty-link'),
174
- '<br>',
175
- '<b>',
176
- '</b>'
177
- )
178
- ); ?>
179
- </th>
180
- <td>
181
- <textarea name="head-scripts" class="large-text"><?php echo esc_textarea($head_scripts); ?></textarea>
182
- </td>
183
- </tr>
184
- </table>
185
-
186
- <table class="form-table">
187
- <tr>
188
- <th scope="row">
189
- <?php esc_html_e('Dynamic Redirection', 'pretty-link'); ?>
190
- <?php PrliAppHelper::info_tooltip(
191
- 'prli-link-pro-options-dynamic-redirection-options',
192
- esc_html__('Dynamic Redirection Options', 'pretty-link'),
193
- esc_html__('These powerful options are available to give you dynamic control over redirection for this pretty link.', 'pretty-link')
194
- ); ?>
195
- </th>
196
- <td>
197
- <select id="plp_dynamic_redirection" name="dynamic_redirection" class="prli-toggle-select" data-rotate-box="prli-link-rotate" data-geo-box="prli-link-geo" data-tech-box="prli-link-tech" data-time-box="prli-link-time">
198
- <option value="none" <?php selected($dynamic_redirection, 'none'); ?>><?php esc_html_e('None', 'pretty-link'); ?></option>
199
- <option value="rotate" <?php selected($dynamic_redirection, 'rotate'); ?>><?php esc_html_e('Rotation', 'pretty-link'); ?></option>
200
- <option value="geo" <?php selected($dynamic_redirection, 'geo'); ?>><?php esc_html_e('Geographic', 'pretty-link'); ?></option>
201
- <option value="tech" <?php selected($dynamic_redirection, 'tech'); ?>><?php esc_html_e('Technology', 'pretty-link'); ?></option>
202
- <option value="time" <?php selected($dynamic_redirection, 'time'); ?>><?php esc_html_e('Time', 'pretty-link'); ?></option>
203
- </select>
204
- </td>
205
- </tr>
206
- </table>
207
-
208
- <div class="prli-sub-box prli-link-rotate">
209
- <div class="prli-arrow prli-gray prli-up prli-sub-box-arrow"> </div>
210
- <h3>
211
- <?php esc_html_e('Target URL Rotations', 'pretty-link'); ?>
212
- <?php PrliAppHelper::info_tooltip(
213
- 'prli-link-pro-target-url-rotations',
214
- esc_html__('Target URL Rotations', 'pretty-link'),
215
- sprintf(
216
- // translators: %1$s: open code tag, %2$s: close code tag
217
- esc_html__('Enter the Target URLs that you\'d like to rotate through when this Pretty Link is Clicked. These must be formatted as URLs example: %1$shttp://example.com%2$s or %1$shttp://example.com?product_id=53%2$s', 'pretty-link'),
218
- '<code>',
219
- '</code>'
220
- )
221
- ); ?>
222
- </h3>
223
- <ol id="prli_link_rotations">
224
- <li>
225
- <input readonly="true" type="text" class="regular-text" value="<?php echo (!empty($target_url)?esc_attr($target_url):esc_attr__('Target URL (above)', 'pretty-link')); ?>" />
226
- <?php esc_html_e('weight:', 'pretty-link'); ?>
227
- <?php PlpLinksHelper::rotation_weight_dropdown((($target_url_weight == 0 || !empty($target_url_weight))?$target_url_weight:'100'),'target_url_weight'); ?>
228
- </li>
229
- <?php
230
- for($i=0;$i<count($url_rotations);$i++) {
231
- $rotation = ((isset($url_rotations[$i]) && !empty($url_rotations[$i]))?$url_rotations[$i]:'');
232
- $weight = (isset($url_rotation_weights[$i])?$url_rotation_weights[$i]:0);
233
- PlpLinksHelper::rotation_row($rotation, $weight, 'url_rotations[]', 'url_rotation_weights[]');
234
- }
235
- ?>
236
- </ol>
237
- <div><a id="prli_add_link_rotation" href=""><?php esc_html_e('Add Link Rotation', 'pretty-link'); ?></a></div>
238
-
239
- <table class="form-table">
240
- <tr>
241
- <th scope="row">
242
- <?php esc_html_e('Split Test', 'pretty-link'); ?>
243
- <?php PrliAppHelper::info_tooltip(
244
- 'prli-link-pro-split-test',
245
- esc_html__('Split Test This Link', 'pretty-link'),
246
- esc_html__('Split testing will enable you to track the effectiveness of several links against each other. This works best when you have multiple link rotation URLs entered.', 'pretty-link')
247
- ); ?>
248
- </th>
249
- <td>
250
- <input class="prli-toggle-checkbox" data-box="prlipro-split-test-goal-link" type="checkbox" name="enable_split_test" <?php checked($enable_split_test != 0); ?> />
251
- </td>
252
- </tr>
253
- </table>
254
-
255
- <div class="prli-sub-box-white prlipro-split-test-goal-link">
256
- <div class="prli-arrow prli-white prli-up prli-sub-box-arrow"> </div>
257
- <table class="form-table">
258
- <tr>
259
- <th scope="row">
260
- <?php esc_html_e('Goal Link', 'pretty-link'); ?>
261
- <?php PrliAppHelper::info_tooltip(
262
- 'prli-link-pro-split-test-goal-link',
263
- esc_html__('Goal Link for Split Test', 'pretty-link'),
264
- esc_html__('This is the goal link for your split test.', 'pretty-link')
265
- ); ?>
266
- </th>
267
- <td>
268
- <select name="split_test_goal_link">
269
- <?php
270
- for($i = 0; $i < count($links); $i++) {
271
- $link = $links[$i];
272
- ?>
273
- <option value="<?php echo esc_attr($link->id); ?>" <?php selected($split_test_goal_link == $link->id); ?>>
274
- <?php echo esc_html(sprintf(
275
- __('id: %1$s | slug: %3$s | name: %2$s', 'pretty-link'),
276
- $link->id,
277
- substr(stripslashes($link->name),0,25),
278
- $link->slug
279
- )); ?>
280
- </option>
281
- <?php
282
- }
283
- ?>
284
- </select>
285
- </td>
286
- </tr>
287
- </table>
288
- </div>
289
- </div>
290
- <div class="prli-sub-box prli-link-geo">
291
- <div class="prli-arrow prli-gray prli-up prli-sub-box-arrow"> </div>
292
- <h3>
293
- <?php esc_html_e('Geographic Redirects', 'pretty-link'); ?>
294
- <?php PrliAppHelper::info_tooltip(
295
- 'prli-link-pro-geo-redirects',
296
- esc_html__('Geographic Redirects', 'pretty-link'),
297
- esc_html__('This will enable you to setup specific target urls that this pretty link will redirect to based on the country of the person visiting the url.', 'pretty-link')
298
- ); ?>
299
- </h3>
300
- <ul class="prli_geo_rows">
301
- </ul>
302
- <div><a href="" class="prli_geo_row_add"><?php esc_html_e('Add', 'pretty-link'); ?></a></div>
303
- </div>
304
- <div class="prli-sub-box prli-link-tech">
305
- <div class="prli-arrow prli-gray prli-up prli-sub-box-arrow"> </div>
306
- <h3>
307
- <?php esc_html_e('Technology Redirects', 'pretty-link'); ?>
308
- <?php PrliAppHelper::info_tooltip(
309
- 'prli-link-pro-tech-redirects',
310
- esc_html__('Technology Redirects', 'pretty-link'),
311
- esc_html__('This will allow you to redirect based on your visitor\'s device, operating system and/or browser', 'pretty-link')
312
- ); ?>
313
- </h3>
314
- <ul class="prli_tech_rows">
315
- </ul>
316
- <div><a href="" class="prli_tech_row_add"><?php esc_html_e('Add', 'pretty-link'); ?></a></div>
317
- </div>
318
- <div class="prli-sub-box prli-link-time">
319
- <div class="prli-arrow prli-gray prli-up prli-sub-box-arrow"> </div>
320
- <h3>
321
- <?php esc_html_e('Time Period Redirects', 'pretty-link'); ?>
322
- <?php PrliAppHelper::info_tooltip(
323
- 'prli-link-pro-time-redirects',
324
- esc_html__('Time Period Redirects', 'pretty-link'),
325
- sprintf(
326
- // translators: %1$s: br tag, %2$s: open b tag, %3$s close b tag
327
- esc_html__('This will allow you to redirect based on the time period in which your visitor visits this link.%1$s%1$s%2$sNote: If your visitor doesn\'t visit the link during any of the specified time periods set here, they\'ll simply be redirected to the main target url.%3$s', 'pretty-link'),
328
- '<br>',
329
- '<b>',
330
- '</b>'
331
- )
332
- ); ?>
333
- </h3>
334
- <ul class="prli_time_rows">
335
- </ul>
336
- <div><a href="" class="prli_time_row_add"><?php esc_html_e('Add', 'pretty-link'); ?></a></div>
337
- </div>
338
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/app/views/links/geo_row.php DELETED
@@ -1,41 +0,0 @@
1
- <?php if(!defined('ABSPATH')) { die('You are not allowed to call this page directly.'); } ?>
2
- <?php
3
- $geo_url = empty($geo_url)?'{{geo_url}}':$geo_url;
4
- $geo_countries = empty($geo_countries)?'{{geo_countries}}':$geo_countries;
5
- ?>
6
- <li>
7
- <div class="prli-sub-box-white prli-geo-row">
8
- <table class="form-table">
9
- <tbody>
10
- <tr>
11
- <th scope="row">
12
- <?php esc_html_e('Countries:', 'pretty-link'); ?>
13
- <?php PrliAppHelper::info_tooltip(
14
- 'prli-link-pro-geo-redirects-countries',
15
- esc_html__('Technology Redirection Countries', 'pretty-link'),
16
- esc_html__('This is a comma-separated list of countries that this redirect will match on. Just start typing a country\'s name and an autocomplete dropdown will appear to select from. Once a country is selected, feel free to start typing the name of another country. You can add as many as you\'d like this redirect to match on', 'pretty-link')
17
- ); ?>
18
- </th>
19
- <td>
20
- <input type="text" name="prli_geo_countries[]" class="prli_geo_countries large-text" value="<?php echo esc_attr($geo_countries); ?>" autocomplete="off"/>
21
- </td>
22
- </tr>
23
- <tr>
24
- <th scope="row">
25
- <?php esc_html_e('URL:', 'pretty-link'); ?>
26
- <?php PrliAppHelper::info_tooltip(
27
- 'prli-link-pro-geo-redirects-url',
28
- esc_html__('Geographic Redirection URL', 'pretty-link'),
29
- esc_html__('This is the URL that this Pretty Link will redirect to if the visitor\'s country match the settings here.', 'pretty-link')
30
- ); ?>
31
- </th>
32
- <td>
33
- <input type="text" name="prli_geo_url[]" class="prli_geo_url large-text" value="<?php echo esc_attr($geo_url); ?>" />
34
- </td>
35
- </tr>
36
- </tbody>
37
- </table>
38
- <div><a href="" class="prli_geo_row_remove"><?php esc_html_e('Remove', 'pretty-link'); ?></a></div>
39
- </div>
40
- </li>
41
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/app/views/links/index.php DELETED
@@ -1,2 +0,0 @@
1
- <?php /* Silence will fall */ ?>
2
-
 
 
pro/app/views/links/javascript-redirect.php DELETED
@@ -1,25 +0,0 @@
1
- <?php
2
- if(!defined('ABSPATH'))
3
- die('You are not allowed to call this page directly.');
4
- ?>
5
- <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
6
- "http://www.w3.org/TR/html4/loose.dtd">
7
-
8
- <html lang="en">
9
- <head>
10
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
11
- <meta name="robots" content="noindex" />
12
- <title><?php echo esc_html($prli_blogname) ?></title>
13
- <?php
14
- if(!empty($google_tracking) && $google_tracking && ($ga_info = PlpUtils::ga_installed())) {
15
- echo PlpUtils::ga_tracking_code($ga_info['slug']);
16
- }
17
-
18
- do_action('prli-redirect-header');
19
- wp_print_scripts('plp-javascript-redirect');
20
- ?>
21
- </head>
22
- <body>
23
-
24
- </body>
25
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/app/views/links/link-has-expired.php DELETED
@@ -1,31 +0,0 @@
1
- <?php if(!defined('ABSPATH')) {die('You are not allowed to call this page directly.');} ?>
2
-
3
- <!DOCTYPE html>
4
- <html lang="en">
5
- <head>
6
- <meta name="viewport" content="width=device-width, initial-scale=1">
7
- <meta http-equiv="Content-Type" content="<?php bloginfo( 'html_type' ); ?>; charset=<?php echo get_option( 'blog_charset' ); ?>" />
8
- <meta name="robots" content="noindex,nofollow" />
9
- <title><?php esc_html_e('Link Not Found', 'pretty-link'); ?></title>
10
- <?php wp_print_styles(array('prli-bootstrap', 'prli-bootstrap-theme')); ?>
11
- </head>
12
- <body>
13
- <div class="container">
14
- <div class="row">
15
- <div class="col-xs-10 col-xs-offset-1 col-sm-10 col-sm-offset-1 col-md-10 col-md-offset-1 col-lg-10 col-lg-offset-1">
16
- <div>&nbsp;</div>
17
- <div>&nbsp;</div>
18
- <div>&nbsp;</div>
19
- <div class="panel panel-default">
20
- <div class="panel-body">
21
- <center><img src="<?php echo esc_url(PRLI_IMAGES_URL . "/pl-logo-horiz-RGB.svg"); ?>" width="60%" /></center>
22
- <div>&nbsp;</div>
23
- <center><h1><?php esc_html_e('Sorry, this link has expired', 'pretty-link'); ?></h1></center>
24
- </div>
25
- </div>
26
- </div>
27
- </div>
28
- </div>
29
- </body>
30
- </html>
31
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/app/views/links/link-options.php DELETED
@@ -1,84 +0,0 @@
1
- <tr valign="top">
2
- <th scope="row">
3
- <label for="<?php echo esc_attr($plp_options->base_slug_prefix_str); ?>"><?php esc_html_e('Base Slug Prefix', 'pretty-link'); ?></label>
4
- <?php PrliAppHelper::info_tooltip('prli-base-slug-prefix',
5
- esc_html__('Base Slug Prefix', 'pretty-link'),
6
- sprintf(
7
- // translators: %1$s: open b tag, %2$s close b tag
8
- esc_html__('Use this to prefix all newly generated pretty links with a directory of your choice. For example set to %1$sout%2$s to make your pretty links look like http://site.com/%1$sout%2$s/xyz. Changing this option will NOT affect existing pretty links. If you do not wish to use a directory prefix, leave this text field blank. Whatever you type here will be sanitized and modified to ensure it is URL-safe. So %1$sHello World%2$s might get changed to something like %1$shello-world%2$s instead. Lowercase letters, numbers, dashes, and underscores are allowed.', 'pretty-link'),
9
- '<b>',
10
- '</b>'
11
- ));
12
- ?>
13
- </th>
14
- <td>
15
- <input type="text" name="<?php echo esc_attr($plp_options->base_slug_prefix_str); ?>" class="regular-text" value="<?php echo esc_attr(stripslashes($plp_options->base_slug_prefix)); ?>" />
16
- </td>
17
- </tr>
18
-
19
- <tr valign="top">
20
- <th scope="row">
21
- <label for="<?php echo esc_attr($plp_options->num_slug_chars_str); ?>"><?php esc_html_e('Slug Character Count', 'pretty-link'); ?></label>
22
- <?php PrliAppHelper::info_tooltip('prli-num-slug-chars',
23
- esc_html__('Slug Character Count', 'pretty-link'),
24
- esc_html__("The number of characters to use when auto-generating a random slug for pretty links. The default is 4. You cannot use less than 2.", 'pretty-link'));
25
- ?>
26
- </th>
27
- <td>
28
- <input type="number" min="2" name="<?php echo esc_attr($plp_options->num_slug_chars_str); ?>" value="<?php echo esc_attr(stripslashes($plp_options->num_slug_chars)); ?>" />
29
- </td>
30
- </tr>
31
-
32
- <tr valign="top">
33
- <th scope="row">
34
- <label for="<?php echo esc_attr($plp_options->google_tracking_str); ?>"><?php esc_html_e('Enable Google Analytics', 'pretty-link') ?></label>
35
- <?php PrliAppHelper::info_tooltip('prli-options-use-ga', esc_html__('Enable Google Analytics', 'pretty-link'),
36
- esc_html__("Requires Google Analyticator, Google Analytics by MonsterInsights (formerly Yoast), or the Google Analytics Plugin to be installed and configured on your site.", 'pretty-link'));
37
- ?>
38
- </th>
39
- <td>
40
- <input type="checkbox" name="<?php echo esc_attr($plp_options->google_tracking_str); ?>" id="<?php echo esc_attr($plp_options->google_tracking_str); ?>" <?php checked($plp_options->google_tracking); ?>/>
41
- </td>
42
- </tr>
43
-
44
- <tr valign="top">
45
- <th scope="row">
46
- <label for="<?php echo esc_attr($plp_options->generate_qr_codes_str); ?>">
47
- <?php
48
- printf(
49
- // translators: %1s: open link tag, %2$s: close link tag
50
- esc_html__('Enable %1sQR Codes%2$s', 'pretty-link'),
51
- '<a href="http://en.wikipedia.org/wiki/QR_code">',
52
- '</a>'
53
- );
54
- ?>
55
- </label>
56
- <?php PrliAppHelper::info_tooltip('prli-options-generate-qr-codes',
57
- esc_html__('Generate QR Codes', 'pretty-link'),
58
- esc_html__("This will enable a link in your pretty link admin that will allow you to automatically download a QR Code for each individual Pretty Link.", 'pretty-link'));
59
- ?>
60
- </th>
61
- <td>
62
- <input type="checkbox" name="<?php echo esc_attr($plp_options->generate_qr_codes_str); ?>" id="<?php echo esc_attr($plp_options->generate_qr_codes_str); ?>" <?php checked($plp_options->generate_qr_codes); ?>/>
63
- </td>
64
- </tr>
65
-
66
- <tr valign="top">
67
- <th scope="row">
68
- <label for="<?php echo esc_attr($plp_options->global_head_scripts_str); ?>"><?php esc_html_e('Global Head Scripts', 'pretty-link'); ?></label>
69
- <?php PrliAppHelper::info_tooltip('prli-options-global-head-scripts',
70
- esc_html__('Global Head Scripts', 'pretty-link'),
71
- sprintf(
72
- // translators: %1$s: br tag, %2$s: open b tag, %3$s close b tag
73
- esc_html__('Useful for adding Google Analytics tracking, Facebook retargeting pixels, or any other kind of tracking script to the HTML head.%1$s%1$sWhat you enter in this box will be applied to all supported pretty links.%1$s%1$s%2$sNOTE:%3$s This does NOT work with 301, 302 and 307 type redirects.', 'pretty-link'),
74
- '<br>',
75
- '<b>',
76
- '</b>'
77
- ));
78
- ?>
79
- </th>
80
- <td>
81
- <textarea name="<?php echo esc_attr($plp_options->global_head_scripts_str); ?>" id="<?php echo esc_attr($plp_options->global_head_scripts_str); ?>" class="large-text"><?php echo esc_textarea(stripslashes($plp_options->global_head_scripts)); ?></textarea>
82
- </td>
83
- </tr>
84
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/app/views/links/metarefresh-redirect.php DELETED
@@ -1,23 +0,0 @@
1
- <?php
2
- if(!defined('ABSPATH')) { die('You are not allowed to call this page directly.'); }
3
- ?>
4
- <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
5
- "http://www.w3.org/TR/html4/loose.dtd">
6
-
7
- <html lang="en">
8
- <head>
9
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
10
- <meta name="robots" content="noindex" />
11
- <title><?php echo esc_html($prli_blogname) ?></title>
12
- <?php
13
- if(!empty($google_tracking) && $google_tracking && ($ga_info = PlpUtils::ga_installed()))
14
- echo PlpUtils::ga_tracking_code($ga_info['slug']);
15
-
16
- do_action('prli-redirect-header');
17
- ?>
18
- <meta http-equiv="refresh" content="<?php echo esc_html($delay); ?>; URL=<?php echo esc_html($pretty_link_url.$param_string) ?>">
19
- </head>
20
- <body>
21
-
22
- </body>
23
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/app/views/links/prettybar-redirect.php DELETED
@@ -1,24 +0,0 @@
1
- <?php
2
- if(!defined('ABSPATH'))
3
- die('You are not allowed to call this page directly.');
4
- ?>
5
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
6
- <html>
7
- <head>
8
- <meta http-equiv="content-type" content="text/html; charset=UTF-8">
9
- <meta name="description" content="<?php echo esc_attr(stripslashes($pretty_link->description)); ?>" />
10
- <meta name="robots" content="noindex" />
11
- <title><?php echo esc_html(stripslashes($pretty_link->name)); ?></title>
12
- <?php
13
- if(!empty($google_tracking) && $google_tracking && ($ga_info = PlpUtils::ga_installed()))
14
- echo PlpUtils::ga_tracking_code($ga_info['slug']);
15
-
16
- do_action('prli-redirect-header');
17
- ?>
18
- </head>
19
- <frameset rows="66,*" framespacing=0 frameborder=0>
20
- <frame src="<?php echo esc_url(site_url("/index.php?plugin=pretty-link-pro&controller=links&action=prettybar&s={$pretty_link->slug}")); ?>" noresize frameborder=0 scrolling=no marginwidth=0 marginheight=0 style="">
21
- <frame src="<?php echo esc_url($pretty_link_url.$param_string); ?>" frameborder=0 marginwidth=0 marginheight=0>
22
- <noframes>Your browser does not support frames. Click <a href="<?php echo esc_url($pretty_link_url.$param_string); ?>">here</a> to view the page.</noframes>
23
- </frameset>
24
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/app/views/links/prettybar.php DELETED
@@ -1,85 +0,0 @@
1
- <?php
2
- if(!defined('ABSPATH'))
3
- die('You are not allowed to call this page directly.');
4
- ?>
5
- <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
6
- "http://www.w3.org/TR/html4/loose.dtd">
7
- <html>
8
- <head>
9
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
10
- <meta name="description" content="<?php echo esc_attr(stripslashes($link->description)); ?>" />
11
- <title><?php echo esc_html(stripslashes($link->name)); ?></title>
12
- <meta name="robots" content="noindex" />
13
-
14
- <?php wp_print_styles(array('fontello-animation', 'fontello-pretty-link', 'prli-prettybar')); ?>
15
-
16
- <?php do_action('prli-pretty-bar-head'); ?>
17
-
18
- </head>
19
- <body>
20
-
21
- <?php do_action('prli-pretty-bar-header'); ?>
22
-
23
- <div id="prettybar">
24
- <table width="100%" height="65px">
25
- <tr>
26
- <td class="blog-image" valign="top">
27
- <div class="pb-cell">
28
- <a href="<?php echo esc_url($prli_blogurl); ?>" target="_top"><img src="<?php echo esc_url($bar_image); ?>" width="48px" height="48px" border="0"/></a></div>
29
- </td>
30
- <td class="blog-title" valign="top">
31
- <div class="pb-cell">
32
- <h2>
33
- <?php if( $bar_show_title ) { ?>
34
- <a href="<?php echo esc_url($prli_blogurl); ?>" title="<?php echo esc_attr($shortened_title); ?>" target="_top"><?php echo esc_html($shortened_title); ?></a>
35
- <?php } else echo "&nbsp;"; ?>
36
- </h2>
37
- <?php if( $bar_show_description ) { ?>
38
- <p title="<?php echo esc_attr($prli_blogdescription); ?>"><?php echo esc_html($shortened_desc); ?></p>
39
- <?php } else echo "&nbsp;"; ?>
40
- </div>
41
- </td>
42
- <td class="retweet" valign="top">
43
- <div class="pb-cell">
44
- <h4>
45
- <?php if( $bar_show_target_url_link ) { ?>
46
- <a href="<?php echo esc_url($target_url); ?>" title="<?php echo esc_attr(sprintf(__('You\'re viewing: %s', 'pretty-link'), $target_url)); ?>" target="_top"><?php printf(esc_html__('Viewing: %s', 'pretty-link'), esc_url($shortened_link)); ?></a>
47
- <?php } else echo "&nbsp;"; ?>
48
- </h4>
49
- <h4>
50
- <?php if( $bar_show_share_links ) { ?>
51
- <a href="<?php echo esc_url('https://twitter.com/intent/tweet?url=' . urlencode($prli_blogurl . PrliUtils::get_permalink_pre_slug_uri() . $slug));?>" target="_top"><?php esc_html_e('Share on Twitter', 'pretty-link'); ?></a>
52
- <?php } else echo "&nbsp;"; ?>
53
- </h4>
54
- </div>
55
- </td>
56
- <td valign="top">
57
- <div class="pb-cell right_container">
58
- <table width="100%" cellpadding="0" cellspacing="0" style="padding: 0px; margin: 0px;">
59
- <tr>
60
- <td>
61
- <p class="closebutton"><a href="<?php echo esc_url($target_url); ?>" target="_top"><i class="pl-icon pl-icon-cancel-circled pl-16"> </i></a></p>
62
- </td>
63
- </tr>
64
- <tr>
65
- <td>
66
- <?php ob_start(); ?>
67
-
68
- <p class="powered-by small-text"><?php esc_html_e('Powered by', 'pretty-link'); ?> <a href="https://prettylinks.com/plp/pretty-bar/powered-by" target="_top"><img src="<?php echo PRLI_IMAGES_URL; ?>/pretty-link-small.png" width="12px" height="12px" border="0"/> <?php esc_html_e('Pretty Links', 'pretty-link'); ?></a></p>
69
- <?php
70
-
71
- echo apply_filters('prli-display-attrib-link',ob_get_clean());
72
- ?>
73
- </td>
74
- </tr>
75
- </table>
76
- </div>
77
- </td>
78
- </tr>
79
- </table>
80
- </div>
81
-
82
- <?php do_action('prli-pretty-bar-footer'); ?>
83
-
84
- </body>
85
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/app/views/links/tech_row.php DELETED
@@ -1,102 +0,0 @@
1
- <?php if(!defined('ABSPATH')) { die('You are not allowed to call this page directly.'); } ?>
2
- <?php
3
- $tech_url = empty($tech_url)?'{{tech_url}}':$tech_url;
4
- $tech_device = empty($tech_device)?'{{tech_device}}':$tech_device;
5
- $tech_os = empty($tech_os)?'{{tech_os}}':$tech_os;
6
- $tech_browser = empty($tech_browser)?'{{tech_browser}}':$tech_browser;
7
- ?>
8
- <li>
9
- <div class="prli-sub-box-white prli-tech-row">
10
- <table class="form-table">
11
- <tbody>
12
- <tr>
13
- <th scope="row">
14
- <?php esc_html_e('Device:', 'pretty-link'); ?>
15
- <?php PrliAppHelper::info_tooltip(
16
- 'prli-link-pro-tech-redirects-device',
17
- esc_html__('Technology Redirection Device', 'pretty-link'),
18
- sprintf(
19
- // translators: %1$s: open b tag, %2$s: close b tag, %3$s: br tag
20
- esc_html__('%1$sDesktop%2$s will match on any conventional laptop or desktop computer.%3$s%3$s%1$sMobile%2$s will match on any phone, tablet or other portable device.%3$s%3$s%1$sPhone%2$s will match on any phone or similarly small device.%3$s%3$s%1$sTablet%2$s will match on any tablet sized device.', 'pretty-link'),
21
- '<b>',
22
- '</b>',
23
- '<br>'
24
- )
25
- ); ?>
26
- </th>
27
- <td>
28
- <select name="prli_tech_device[]" class="prli_tech_device">
29
- <option value="any" <?php selected($tech_device,'any'); ?>><?php esc_html_e('Any', 'pretty-link'); ?></option>
30
- <option value="desktop" <?php selected($tech_device,'desktop'); ?>><?php esc_html_e('Desktop', 'pretty-link'); ?></option>
31
- <option value="mobile" <?php selected($tech_device,'mobile'); ?>><?php esc_html_e('Mobile', 'pretty-link'); ?></option>
32
- <option value="phone" <?php selected($tech_device,'phone'); ?>><?php esc_html_e('Phone', 'pretty-link'); ?></option>
33
- <option value="tablet" <?php selected($tech_device,'tablet'); ?>><?php esc_html_e('Tablet', 'pretty-link'); ?></option>
34
- </select>
35
- </td>
36
- </tr>
37
- <tr>
38
- <th scope="row">
39
- <?php esc_html_e('Operating System:', 'pretty-link'); ?>
40
- <?php PrliAppHelper::info_tooltip(
41
- 'prli-link-pro-tech-redirects-os',
42
- esc_html__('Technology Redirection OS', 'pretty-link'),
43
- esc_html__('Use this dropdown to select which Operating System this redirect will match on.', 'pretty-link')
44
- ); ?>
45
- </th>
46
- <td>
47
- <select name="prli_tech_os[]" class="prli_tech_os">
48
- <option value="any" <?php selected($tech_os,'any'); ?>><?php esc_html_e('Any', 'pretty-link'); ?></option>
49
- <option value="android" <?php selected($tech_os,'android'); ?>><?php esc_html_e('Android', 'pretty-link'); ?></option>
50
- <option value="ios" <?php selected($tech_os,'ios'); ?>><?php esc_html_e('iOS', 'pretty-link'); ?></option>
51
- <option value="linux" <?php selected($tech_os,'linux'); ?>><?php esc_html_e('Linux', 'pretty-link'); ?></option>
52
- <option value="macosx" <?php selected($tech_os,'macosx'); ?>><?php esc_html_e('Mac', 'pretty-link'); ?></option>
53
- <option value="win" <?php selected($tech_os,'win'); ?>><?php esc_html_e('Windows', 'pretty-link'); ?></option>
54
- </select>
55
- </td>
56
- </tr>
57
- <tr>
58
- <th scope="row">
59
- <?php esc_html_e('Browser:', 'pretty-link'); ?>
60
- <?php PrliAppHelper::info_tooltip(
61
- 'prli-link-pro-tech-redirects-browser',
62
- esc_html__('Technology Redirection Browser', 'pretty-link'),
63
- esc_html__('Use this dropdown to select which Browser this redirect will match on.', 'pretty-link')
64
- ); ?>
65
- </th>
66
- <td>
67
- <select name="prli_tech_browser[]" class="prli_tech_browser">
68
- <option value="any" <?php selected($tech_browser,'any'); ?>><?php esc_html_e('Any', 'pretty-link'); ?></option>
69
- <option value="silk" <?php selected($tech_browser,'silk'); ?>><?php esc_html_e('Amazon Silk', 'pretty-link'); ?></option>
70
- <option value="android" <?php selected($tech_browser,'android'); ?>><?php esc_html_e('Android', 'pretty-link'); ?></option>
71
- <option value="chrome" <?php selected($tech_browser,'chrome'); ?>><?php esc_html_e('Chrome', 'pretty-link'); ?></option>
72
- <option value="chromium" <?php selected($tech_browser,'chromium'); ?>><?php esc_html_e('Chromium', 'pretty-link'); ?></option>
73
- <option value="edge" <?php selected($tech_browser,'edge'); ?>><?php esc_html_e('Edge', 'pretty-link'); ?></option>
74
- <option value="firefox" <?php selected($tech_browser,'firefox'); ?>><?php esc_html_e('Firefox', 'pretty-link'); ?></option>
75
- <option value="ie" <?php selected($tech_browser,'ie'); ?>><?php esc_html_e('Internet Explorer', 'pretty-link'); ?></option>
76
- <option value="kindle" <?php selected($tech_browser,'kindle'); ?>><?php esc_html_e('Kindle', 'pretty-link'); ?></option>
77
- <option value="opera" <?php selected($tech_browser,'opera'); ?>><?php esc_html_e('Opera', 'pretty-link'); ?></option>
78
- <option value="coast" <?php selected($tech_browser,'coast'); ?>><?php esc_html_e('Opera Coast', 'pretty-link'); ?></option>
79
- <option value="safari" <?php selected($tech_browser,'safari'); ?>><?php esc_html_e('Safari', 'pretty-link'); ?></option>
80
- </select>
81
- </td>
82
- </tr>
83
- <tr>
84
- <th scope="row">
85
- <?php esc_html_e('URL:', 'pretty-link'); ?>
86
- <?php PrliAppHelper::info_tooltip(
87
- 'prli-link-pro-tech-redirects-url',
88
- esc_html__('Technology Redirection URL', 'pretty-link'),
89
- esc_html__('This is the URL that this Pretty Link will redirect to if the visitor\'s device, os and browser match the settings here.', 'pretty-link')
90
- ); ?>
91
- </th>
92
- <td>
93
- <input type="text" name="prli_tech_url[]" class="prli_tech_url large-text" value="<?php echo esc_attr($tech_url); ?>" />
94
- </td>
95
- </tr>
96
- </tbody>
97
- </table>
98
- <div><a href="" class="prli_tech_row_remove"><?php esc_html_e('Remove', 'pretty-link'); ?></a></div>
99
- </div>
100
- </li>
101
-
102
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/app/views/links/time_row.php DELETED
@@ -1,54 +0,0 @@
1
- <?php if(!defined('ABSPATH')) { die('You are not allowed to call this page directly.'); } ?>
2
- <?php
3
- $time_url = empty($time_url)?'{{time_url}}':$time_url;
4
- $time_start = empty($time_start)?'{{time_start}}':$time_start;
5
- $time_end = empty($time_end)?'{{time_end}}':$time_end;
6
- ?>
7
- <li>
8
- <div class="prli-sub-box-white prli-time-row">
9
- <table class="form-table">
10
- <tbody>
11
- <tr>
12
- <th scope="row">
13
- <?php esc_html_e('Start Time:', 'pretty-link'); ?>
14
- <?php PrliAppHelper::info_tooltip(
15
- 'prli-link-pro-start-time-redirects-period',
16
- esc_html__('Start of Time Period', 'pretty-link'),
17
- esc_html__('This is where you\'ll enter the beginning of the time period for this redirect', 'pretty-link')
18
- ); ?>
19
- </th>
20
- <td>
21
- <input type="text" name="prli_time_start[]" class="prli_time_start prli-date-picker regular-text" value="<?php echo esc_attr($time_start); ?>" />
22
- </td>
23
- </tr>
24
- <tr>
25
- <th scope="row">
26
- <?php esc_html_e('End Time:', 'pretty-link'); ?>
27
- <?php PrliAppHelper::info_tooltip(
28
- 'prli-link-pro-end-time-redirects-period',
29
- esc_html__('End of Time Period', 'pretty-link'),
30
- esc_html__('This is where you\'ll enter the end of the time period for this redirect', 'pretty-link')
31
- ); ?>
32
- </th>
33
- <td>
34
- <input type="text" name="prli_time_end[]" class="prli_time_end prli-date-picker regular-text" value="<?php echo esc_attr($time_end); ?>" />
35
- </td>
36
- </tr>
37
- <tr>
38
- <th scope="row">
39
- <?php esc_html_e('URL:', 'pretty-link'); ?>
40
- <?php PrliAppHelper::info_tooltip(
41
- 'prli-link-pro-time-redirects-url',
42
- esc_html__('Time Period Redirect URL', 'pretty-link'),
43
- esc_html__('This is the URL that this Pretty Link will redirect to when the visitor visits the link in the associated time period.', 'pretty-link')
44
- ); ?>
45
- </th>
46
- <td>
47
- <input type="text" name="prli_time_url[]" class="prli_time_url large-text" value="<?php echo esc_attr($time_url); ?>" />
48
- </td>
49
- </tr>
50
- </tbody>
51
- </table>
52
- <div><a href="" class="prli_time_row_remove"><?php esc_html_e('Remove', 'pretty-link'); ?></a></div>
53
- </div>
54
- </li>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/app/views/options/autocreate.php DELETED
@@ -1,73 +0,0 @@
1
- <?php if(!defined('ABSPATH')) die('You are not allowed to call this page directly.'); ?>
2
- <table class="form-table">
3
- <tbody>
4
- <tr valign="top">
5
- <th scope="row">
6
- <label for="<?php echo esc_attr($option_name); ?>">
7
- <?php echo esc_html(sprintf(__('%s Shortlinks', 'pretty-link'), $p->labels->singular_name)); ?>
8
- <?php
9
- PrliAppHelper::info_tooltip("prli-{$post_type}-auto",
10
- esc_html(sprintf(__('Create Pretty Links for %s', 'pretty-link'), $p->labels->name)),
11
- esc_html(sprintf(__('Automatically Create a Pretty Link for each of your published %s', 'pretty-link'), $p->labels->name))
12
- );
13
- ?>
14
- </label>
15
- </th>
16
- <td>
17
- <input class="prli-toggle-checkbox" data-box="prli-<?php echo esc_attr($post_type); ?>-option-box" type="checkbox" name="<?php echo esc_attr($option_name); ?>" <?php checked(!empty($option)); ?>/>
18
- </td>
19
- </tr>
20
- </tbody>
21
- </table>
22
-
23
- <div class="prli-sub-box prli-<?php echo esc_attr($post_type); ?>-option-box">
24
- <div class="prli-arrow prli-gray prli-up prli-sub-box-arrow"> </div>
25
- <table class="form-table">
26
- <tbody>
27
- <tr valign="top">
28
- <th scope="row">
29
- <label for="<?php echo esc_attr($category_name); ?>">
30
- <?php esc_html_e('Category', 'pretty-link'); ?>
31
- <?php
32
- PrliAppHelper::info_tooltip("prli-{$post_type}s-category",
33
- esc_html(sprintf(__('%s Auto Link Category', 'pretty-link'), $p->labels->singular_name)),
34
- esc_html(sprintf(__('Category that Pretty Links for %s will be automatically added to.', 'pretty-link'), $p->labels->name))
35
- );
36
- ?>
37
- </label>
38
- </th>
39
- <td>
40
- <?php
41
- wp_dropdown_categories(array(
42
- 'id' => $category_name,
43
- 'name' => $category_name,
44
- 'show_option_none' => esc_html__('None', 'pretty-link'),
45
- 'option_none_value' => '',
46
- 'selected' => $category,
47
- 'taxonomy' => PlpLinkCategoriesController::$ctax,
48
- 'hide_empty' => false
49
- ));
50
- ?>
51
- <a href="<?php echo esc_url(admin_url(sprintf('edit-tags.php?taxonomy=%s&post_type=%s', PlpLinkCategoriesController::$ctax, PrliLink::$cpt))); ?>" class="button"><?php esc_html_e('Add a New Category', 'pretty-link'); ?></a>
52
- </td>
53
- </tr>
54
- <tr valign="top">
55
- <th scope="row">
56
- <label for="<?php echo esc_attr($socbtns_name); ?>">
57
- <?php esc_html_e('Show Social Buttons', 'pretty-link'); ?>
58
- <?php
59
- PrliAppHelper::info_tooltip("prli-social-{$post_type}s-buttons",
60
- esc_html(sprintf(__('Show Social Buttons on %s', 'pretty-link'), $p->labels->name)),
61
- esc_html(sprintf(__('If this button is checked then you\'ll have the ability to include a social buttons bar on your %s.', 'pretty-link'), $p->labels->name))
62
- );
63
- ?>
64
- </label>
65
- </th>
66
- <td>
67
- <input type="checkbox" name="<?php echo esc_attr($socbtns_name); ?>" <?php checked(!empty($socbtns)); ?>/>
68
- </td>
69
- </tr>
70
- </tbody>
71
- </table>
72
- </div>
73
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/app/views/options/form.php DELETED
@@ -1,934 +0,0 @@
1
- <?php if(!defined('ABSPATH')) { die('You are not allowed to call this page directly.'); } ?>
2
-
3
- <div class="prli-page" id="replacements">
4
- <div class="prli-page-title"><?php esc_html_e('Keyword &amp; URL Auto Replacements Options', 'pretty-link'); ?></div>
5
-
6
- <input type="hidden" name="<?php echo esc_attr($hidden_field_name); ?>" value="Y" />
7
-
8
- <table class="form-table">
9
- <tbody>
10
- <tr valign="top">
11
- <th scope="row">
12
- <label for="<?php echo esc_attr($keyword_replacement_is_on); ?>">
13
- <?php esc_html_e('Enable Replacements', 'pretty-link'); ?>
14
- <?php PrliAppHelper::info_tooltip('prli-keyword-replacement',
15
- esc_html__('Enable Keyword and URL Auto Replacement', 'pretty-link'),
16
- esc_html__('If checked, this will enable you to automatically replace keywords and/or URLs on your blog with pretty links. You will specify the specific keywords and urls from your Pretty Link edit page.', 'pretty-link'));
17
- ?>
18
- </label>
19
- </th>
20
- <td>
21
- <input class="prli-toggle-checkbox" data-box="pretty-link-keyword-replacement-options" type="checkbox" name="<?php echo esc_attr($keyword_replacement_is_on); ?>" <?php checked($plp_options->keyword_replacement_is_on != 0); ?>/>
22
- </td>
23
- </tr>
24
- </tbody>
25
- </table>
26
-
27
- <div class="prli-sub-box pretty-link-keyword-replacement-options">
28
- <div class="prli-arrow prli-gray prli-up prli-sub-box-arrow"> </div>
29
- <table class="form-table">
30
- <tbody>
31
- <tr valign="top">
32
- <th scope="row">
33
- <label for="<?php echo esc_attr($set_keyword_thresholds); ?>">
34
- <?php esc_html_e('Thresholds', 'pretty-link'); ?>
35
- <?php PrliAppHelper::info_tooltip('prli-keyword-replacement-thresholds',
36
- esc_html__('Set Keyword Replacement Thresholds', 'pretty-link'),
37
- esc_html__('Don\'t want to have too many keyword replacements per page? Select to set some reasonable keyword replacement thresholds.', 'pretty-link'));
38
- ?>
39
- </label>
40
- </th>
41
- <td>
42
- <input class="prli-toggle-checkbox" data-box="prli-set-replacement-thresholds" type="checkbox" name="<?php echo esc_attr($set_keyword_thresholds); ?>" <?php checked($plp_options->set_keyword_thresholds != 0); ?>/>
43
- </td>
44
- </tr>
45
- </tbody>
46
- </table>
47
- <div class="prli-sub-box-white prli-set-replacement-thresholds">
48
- <div class="prli-arrow prli-white prli-up prli-sub-box-arrow"> </div>
49
- <table class="form-table">
50
- <tbody>
51
- <tr valign="top">
52
- <th scope="row">
53
- <label for="<?php echo esc_attr($keywords_per_page); ?>">
54
- <?php esc_html_e('Max Keywords', 'pretty-link'); ?>
55
- <?php PrliAppHelper::info_tooltip('prli-max-keywords',
56
- esc_html__('Set Maximum Keywords per Page', 'pretty-link'),
57
- esc_html__('Maximum number of unique keyword / keyphrases you can replace with Pretty Links per page.', 'pretty-link'));
58
- ?>
59
- </label>
60
- </th>
61
- <td>
62
- <input type="number" min="0" name="<?php echo esc_attr($keywords_per_page); ?>" value="<?php echo esc_attr($plp_options->keywords_per_page); ?>" />
63
- </td>
64
- </tr>
65
- <tr valign="top">
66
- <th scope="row">
67
- <label for="<?php echo esc_attr($keyword_links_per_page); ?>">
68
- <?php esc_html_e('Max Replacements', 'pretty-link'); ?>
69
- <?php PrliAppHelper::info_tooltip('prli-max-replacements',
70
- esc_html__('Set Maximum Replacements per Keyword', 'pretty-link'),
71
- esc_html__('Maximum number of Pretty Link replacements per Keyword / Keyphrase.', 'pretty-link'));
72
- ?>
73
- </label>
74
- </th>
75
- <td>
76
- <input type="number" min="0" name="<?php echo esc_attr($keyword_links_per_page); ?>" value="<?php echo esc_attr($plp_options->keyword_links_per_page); ?>" />
77
- </td>
78
- </tr>
79
- </tbody>
80
- </table>
81
- </div>
82
- <table class="form-table">
83
- <tbody>
84
- <tr valign="top">
85
- <th scope="row">
86
- <label for="<?php echo esc_attr($keyword_links_open_new_window); ?>">
87
- <?php esc_html_e('Open in New Window', 'pretty-link'); ?>
88
- <?php PrliAppHelper::info_tooltip('prli-keyword-replacement-thresholds',
89
- esc_html__('Open Keyword Replacement Links in New Window', 'pretty-link'),
90
- sprintf(
91
- // translators: %1$s: open strong tag, %2$s: close strong tag
92
- esc_html__('Ensure that these keyword replacement links are opened in a separate window. %1$sNote:%2$s This does not apply to url replacements--only keyword replacements.', 'pretty-link'),
93
- '<strong>',
94
- '</strong>'
95
- ));
96
- ?>
97
- </label>
98
- </th>
99
- <td>
100
- <input type="checkbox" name="<?php echo esc_attr($keyword_links_open_new_window); ?>" <?php checked($plp_options->keyword_links_open_new_window != 0); ?>/>
101
- </td>
102
- </tr>
103
- <tr valign="top">
104
- <th scope="row">
105
- <label for="<?php echo esc_attr($keyword_links_nofollow); ?>">
106
- <?php esc_html_e('Add No Follows', 'pretty-link'); ?>
107
- <?php PrliAppHelper::info_tooltip('prli-keyword-links-nofollow',
108
- esc_html__('Add \'nofollow\' attribute to all Keyword Pretty Links', 'pretty-link'),
109
- sprintf(
110
- // translators: %1$s: open code tag, %2$s: close code tag, %3$s: open strong tag, %4$s close strong tag
111
- esc_html__('This adds the html %1$sNOFOLLOW%2$s attribute to all keyword replacement links. %3$sNote:%4$s This does not apply to url replacements--only keyword replacements.', 'pretty-link'),
112
- '<code>',
113
- '</code>',
114
- '<strong>',
115
- '</strong>'
116
- ));
117
- ?>
118
- </label>
119
- </th>
120
- <td>
121
- <input type="checkbox" name="<?php echo esc_attr($keyword_links_nofollow); ?>" <?php checked($plp_options->keyword_links_nofollow != 0); ?>/>
122
- </td>
123
- </tr>
124
- <tr valign="top">
125
- <th scope="row">
126
- <label for="<?php echo esc_attr($keyword_links_sponsored); ?>">
127
- <?php esc_html_e('Add Sponsored', 'pretty-link'); ?>
128
- <?php PrliAppHelper::info_tooltip('prli-keyword-links-sponsored',
129
- esc_html__('Add \'sponsored\' attribute to all Keyword Pretty Links', 'pretty-link'),
130
- sprintf(
131
- // translators: %1$s: open code tag, %2$s: close code tag, %3$s: open strong tag, %4$s close strong tag
132
- esc_html__('This adds the html %1$sSPONSORED%2$s attribute to all keyword replacement links. %3$sNote:%4$s This does not apply to url replacements--only keyword replacements.', 'pretty-link'),
133
- '<code>',
134
- '</code>',
135
- '<strong>',
136
- '</strong>'
137
- ));
138
- ?>
139
- </label>
140
- </th>
141
- <td>
142
- <input type="checkbox" name="<?php echo esc_attr($keyword_links_sponsored); ?>" <?php checked($plp_options->keyword_links_sponsored != 0); ?>/>
143
- </td>
144
- </tr>
145
- <tr valign="top">
146
- <th scope="row">
147
- <label for="<?php echo esc_attr($keyword_link_custom_css); ?>">
148
- <?php esc_html_e('Custom CSS', 'pretty-link'); ?>
149
- <?php PrliAppHelper::info_tooltip('prli-keyword-custom-css',
150
- esc_html__('Add custom CSS to your keyword replacement links', 'pretty-link'),
151
- sprintf(
152
- // translators: %1$s: open strong tag, %2$s: close strong tag
153
- esc_html__('Add some custom formatting to your keyword pretty link replacements. %1$sNote:%2$s This does not apply to url replacements--only keyword replacements.', 'pretty-link'),
154
- '<strong>',
155
- '</strong>'
156
- ));
157
- ?>
158
- </label>
159
- </th>
160
- <td>
161
- <input type="text" class="regular-text" name="<?php echo esc_attr($keyword_link_custom_css); ?>" value="<?php echo esc_attr($plp_options->keyword_link_custom_css); ?>" />
162
- </td>
163
- </tr>
164
- <tr valign="top">
165
- <th valign="row">
166
- <label for="<?php echo esc_attr($keyword_link_hover_custom_css); ?>">
167
- <?php esc_html_e('Custom Hover CSS', 'pretty-link'); ?>
168
- <?php PrliAppHelper::info_tooltip('prli-keyword-custom-hover-css',
169
- esc_html__('Add custom hover CSS to your keyword replacement links', 'pretty-link'),
170
- sprintf(
171
- // translators: %1$s: open strong tag, %2$s: close strong tag
172
- esc_html__('Add some custom formatting to the hover attribute of your keyword pretty links. %1$sNote%2$s: This does not apply to url replacements--only keyword replacements.', 'pretty-link'),
173
- '<strong>',
174
- '</strong>'
175
- ));
176
- ?>
177
- </label>
178
- </th>
179
- <td>
180
- <input type="text" class="regular-text" name="<?php echo esc_attr($keyword_link_hover_custom_css); ?>" value="<?php echo esc_attr($plp_options->keyword_link_hover_custom_css); ?>" />
181
- </td>
182
- </tr>
183
- <tr valign="top">
184
- <th valign="row">
185
- <label for="<?php echo esc_attr($enable_link_to_disclosures); ?>">
186
- <?php esc_html_e('Link to Disclosures', 'pretty-link'); ?>
187
- <?php PrliAppHelper::info_tooltip(
188
- 'prlipro-link-to-disclosures',
189
- esc_html__('Automatically Add a Link to Disclosures', 'pretty-link'),
190
- esc_html__('When enabled, this will add a link to your official affiliate link disclosure page to any page, post or custom post type that have any keyword or URL replacements. You\'ll also be able to customize the URL and position of the disclosure link.', 'pretty-link')
191
- );
192
- ?>
193
- </label>
194
- </th>
195
- <td>
196
- <input type="checkbox" class="prli-toggle-checkbox" data-box="prlipro-link-to-disclosures-page" name="<?php echo esc_attr($enable_link_to_disclosures); ?>" <?php checked($plp_options->enable_link_to_disclosures != 0); ?> />
197
- </td>
198
- </tr>
199
- <tr valign="top" class="prlipro-link-to-disclosures-page">
200
- <td colspan="2">
201
- <div class="prli-sub-box-white" style="display: block;">
202
- <div class="prli-arrow prli-white prli-up prli-sub-box-arrow"> </div>
203
- <table class="form-table">
204
- <tbody>
205
- <tr valign="top">
206
- <th scope="row">
207
- <label for="<?php echo esc_attr($disclosures_link_url); ?>">
208
- <?php esc_html_e('URL', 'pretty-link'); ?>
209
- <?php PrliAppHelper::info_tooltip(
210
- 'prlipro-disclosures-url',
211
- esc_html__('Disclosures Link URL', 'pretty-link'),
212
- esc_html__('This is the URL of the page that contains your official affiliate link disclosures. This URL will be used in the link that will be generated.', 'pretty-link'));
213
- ?>
214
- </label>
215
- </th>
216
- <td>
217
- <input type="text" name="<?php echo esc_attr($disclosures_link_url); ?>" class="regular-text" value="<?php echo esc_attr(stripslashes($plp_options->disclosures_link_url)); ?>" />
218
- </td>
219
- </tr>
220
- <tr valign="top">
221
- <th scope="row">
222
- <label for="<?php echo esc_attr($disclosures_link_text); ?>">
223
- <?php esc_html_e('Text', 'pretty-link'); ?>
224
- <?php PrliAppHelper::info_tooltip(
225
- 'prlipro-disclosures-link-text',
226
- esc_html__('Disclosures Link Text', 'pretty-link'),
227
- esc_html__('This is the text of the link to your disclosures. This text will be visible to your visitors when the link is displayed.', 'pretty-link'));
228
- ?>
229
- </label>
230
- </th>
231
- <td>
232
- <input type="text" name="<?php echo esc_attr($disclosures_link_text); ?>" class="regular-text" value="<?php echo esc_attr(stripslashes($plp_options->disclosures_link_text)); ?>" />
233
- </td>
234
- </tr>
235
- <tr valign="top">
236
- <th scope="row">
237
- <label for="<?php echo esc_attr($disclosures_link_position); ?>">
238
- <?php esc_html_e('Position', 'pretty-link'); ?>
239
- <?php PrliAppHelper::info_tooltip(
240
- 'prlipro-disclosures-link-position',
241
- esc_html__('Disclosures Link Position', 'pretty-link'),
242
- esc_html__('This is the position of the link to your disclosures in relation to your post content.', 'pretty-link'));
243
- ?>
244
- </label>
245
- </th>
246
- <td>
247
- <select name="<?php echo esc_attr($disclosures_link_position); ?>">
248
- <option value="bottom" <?php selected('bottom',$plp_options->disclosures_link_position); ?>><?php esc_html_e('Bottom', 'pretty-link'); ?></option>
249
- <option value="top" <?php selected('top',$plp_options->disclosures_link_position); ?>><?php esc_html_e('Top', 'pretty-link'); ?></option>
250
- <option value="top_and_bottom" <?php selected('top_and_bottom',$plp_options->disclosures_link_position); ?>><?php esc_html_e('Top and Bottom', 'pretty-link'); ?></option>
251
- </select>
252
- </td>
253
- </tr>
254
- </tbody>
255
- </table>
256
- </div>
257
- </td>
258
- </tr>
259
- <tr valign="top">
260
- <th valign="row">
261
- <label for="<?php echo esc_attr($enable_keyword_link_disclosures); ?>">
262
- <?php esc_html_e('Keyword Disclosures', 'pretty-link'); ?>
263
- <?php PrliAppHelper::info_tooltip(
264
- 'prlipro-enable-keyword-link-disclosures',
265
- esc_html__('Automatically Add Affiliate Link Disclosures to Keyword Replacements', 'pretty-link'),
266
- sprintf(
267
- // translators: %1$s: open b tag, %2$s close b tag
268
- esc_html__('When enabled, this will add an affiliate link disclosure next to each one of your keyword replacements. %1$sNote:%2$s This does not apply to url replacements--only keyword replacements.', 'pretty-link'),
269
- '<b>',
270
- '</b>'
271
- )
272
- );
273
- ?>
274
- </label>
275
- </th>
276
- <td>
277
- <input type="checkbox" class="prli-toggle-checkbox" data-box="prlipro-keyword-link-disclosure-page" name="<?php echo esc_attr($enable_keyword_link_disclosures); ?>" <?php checked($plp_options->enable_keyword_link_disclosures != 0); ?> />
278
- </td>
279
- </tr>
280
- <tr valign="top" class="prlipro-keyword-link-disclosure-page">
281
- <td colspan="2">
282
- <div class="prli-sub-box-white" style="display: block;">
283
- <div class="prli-arrow prli-white prli-up prli-sub-box-arrow"> </div>
284
- <table class="form-table">
285
- <tbody>
286
- <tr valign="top">
287
- <th scope="row">
288
- <label for="<?php echo esc_attr($keyword_link_disclosure); ?>">
289
- <?php esc_html_e('Disclosure Text', 'pretty-link'); ?>
290
- <?php PrliAppHelper::info_tooltip(
291
- 'prlipro-keyword-link-disclosure',
292
- esc_html__('Keyword Link Disclosure Text', 'pretty-link'),
293
- esc_html__('This is the text that will be added after each keyword replacement to indicate that the link is an affiliate link.', 'pretty-link'));
294
- ?>
295
- </label>
296
- </th>
297
- <td>
298
- <input type="text" name="<?php echo esc_attr($keyword_link_disclosure); ?>" class="regular-text" value="<?php echo esc_attr(stripslashes($plp_options->keyword_link_disclosure)); ?>" />
299
- </td>
300
- </tr>
301
- </tbody>
302
- </table>
303
- </div>
304
- </td>
305
- </tr>
306
- <tr valign="top">
307
- <th valign="row">
308
- <label for="<?php echo esc_attr($replace_urls_with_pretty_links); ?>">
309
- <?php esc_html_e('Replace All URLs', 'pretty-link'); ?>
310
- <?php PrliAppHelper::info_tooltip('prli-replace-urls',
311
- esc_html__('Replace All non-Pretty Link URLs With Pretty Link URLs', 'pretty-link'),
312
- esc_html__('This feature will take each url it finds and create or use an existing pretty link pointing to the url and replace it with the pretty link.', 'pretty-link'));
313
- ?>
314
- </label>
315
- </th>
316
- <td>
317
- <input type="checkbox" class="prli-toggle-checkbox" data-box="prlipro-replace-all-urls-blacklist-page" name="<?php echo esc_attr($replace_urls_with_pretty_links); ?>" <?php checked($plp_options->replace_urls_with_pretty_links != 0); ?> />
318
- </td>
319
- </tr>
320
- <tr valign="top" class="prlipro-replace-all-urls-blacklist-page">
321
- <td colspan="2">
322
- <div class="prli-sub-box-white" style="display: block;">
323
- <div class="prli-arrow prli-white prli-up prli-sub-box-arrow"> </div>
324
- <table class="form-table">
325
- <tbody>
326
- <tr valign="top">
327
- <th scope="row">
328
- <label for="<?php echo esc_attr($replace_urls_with_pretty_links_blacklist); ?>">
329
- <?php esc_html_e('Domain Blacklist', 'pretty-link'); ?>
330
- <?php PrliAppHelper::info_tooltip('prli-replace-urls-blacklist',
331
- esc_html__('Do not replace links from these domains', 'pretty-link'),
332
- sprintf(
333
- // translators: %1$s: br tag, %2$s: open b tag, %3$s: close b tag
334
- esc_html__('Any links on your site which point to domains you define here will not be replaced automatically with Pretty Links. Place one domain per line.%1$s%1$sYou MUST enter http:// or https:// in front of the domain names and do NOT include any /\'s or other text after the domain name.%1$s%1$sProper entry example:%1$s%2$shttps://www.google.com%3$s%1$s%2$shttp://mysite.org%3$s%1$s%1$sImproperly entered domains will be removed upon saving the Options.', 'pretty-link'),
335
- '<br>',
336
- '<b>',
337
- '</b>'
338
- ));
339
- ?>
340
- </label>
341
- </th>
342
- <td>
343
- <textarea name="<?php echo esc_attr($replace_urls_with_pretty_links_blacklist); ?>" class="large-text" rows="5"><?php echo esc_textarea(stripslashes($plp_options->replace_urls_with_pretty_links_blacklist)); ?></textarea>
344
- </td>
345
- </tr>
346
- </tbody>
347
- </table>
348
- </div>
349
- </td>
350
- </tr>
351
- <tr valign="top">
352
- <th valign="row">
353
- <label for="<?php echo esc_attr($replace_keywords_in_comments); ?>">
354
- <?php esc_html_e('Replace in Comments', 'pretty-link'); ?>
355
- <?php PrliAppHelper::info_tooltip('prli-replace-in-comments',
356
- esc_html__('Replace Keywords and URLs in Comments', 'pretty-link'),
357
- esc_html__('This option will enable the keyword / URL replacement routine to run in Comments.', 'pretty-link'));
358
- ?>
359
- </label>
360
- </th>
361
- <td>
362
- <input type="checkbox" name="<?php echo esc_attr($replace_keywords_in_comments); ?>" <?php checked($plp_options->replace_keywords_in_comments != 0); ?>/>
363
- </td>
364
- </tr>
365
- <tr valign="top">
366
- <th valign="row">
367
- <label for="<?php echo esc_attr($replace_keywords_in_feeds); ?>">
368
- <?php esc_html_e('Replace in Feeds', 'pretty-link'); ?>
369
- <?php PrliAppHelper::info_tooltip('prli-replace-in-feeds',
370
- esc_html__('Replace Keywords and URLs in Feeds', 'pretty-link'),
371
- sprintf(
372
- // translators: %1$s: br tag, %2$s open strong tag, %3$s: close strong tag
373
- esc_html__('This option will enable the keyword / URL replacement routine to run in RSS Feeds.%1$s%2$sNote:%3$s This option can slow the load speed of your RSS feed -- unless used in conjunction with a caching plugin like W3 Total Cache or WP Super Cache.%1$s%2$sNote #2%3$s This option will only work if you have "Full Text" selected in your General WordPress Reading settings.%1$s%2$sNote #3:%3$s If this option is used along with "Replace Keywords and URLs in Comments" then your post comment feeds will have keywords replaced in them as well.', 'pretty-link'),
374
- '<br>',
375
- '<strong>',
376
- '</strong>'
377
- ));
378
- ?>
379
- </label>
380
- </th>
381
- <td>
382
- <input type="checkbox" name="<?php echo esc_attr($replace_keywords_in_feeds); ?>" <?php checked($plp_options->replace_keywords_in_feeds != 0); ?>/>
383
- </td>
384
- </tr>
385
- <tr valign="top">
386
- <th valign="row">
387
- <label for="plp_index_keywords">
388
- <?php esc_html_e('Index Replacements', 'pretty-link'); ?>
389
- <?php PrliAppHelper::info_tooltip('plp-index-keywords',
390
- esc_html__('Index Replacements', 'pretty-link'),
391
- sprintf(
392
- // translators: %1$s: br tag, %2$s open strong tag, %3$s: close strong tag
393
- esc_html__('This feature will index all of your keyword & URL replacements to dramatically improve performance.%1$s%1$sIf your site has a large number of replacements and/or posts then this feature may increase the load on your server temporarily and your replacements may not show up on your posts for a day or two initially (until all posts are indexed).%1$s%1$s%2$sNote:%3$s this feature requires the use of wp-cron.', 'pretty-link'),
394
- '<br>',
395
- '<strong>',
396
- '</strong>'
397
- ));
398
- ?>
399
- </label>
400
- </th>
401
- <td>
402
- <input type="checkbox" class="prli-toggle-checkbox" data-box="plp-index-keywords" name="plp_index_keywords" <?php checked($index_keywords); ?> />
403
- </td>
404
- </tr>
405
- <tr valign="top" class="plp-index-keywords">
406
- <td colspan="2">
407
- <div class="prli-sub-box-white" style="display: block;">
408
- <div class="prli-arrow prli-white prli-up prli-sub-box-arrow"> </div>
409
- <table class="form-table">
410
- <tbody>
411
- <tr valign="top">
412
- <th scope="row">
413
- <label>
414
- <?php esc_html_e('Keyword Index Status', 'pretty-link'); ?>
415
- <?php PrliAppHelper::info_tooltip('prli-kw-index-status',
416
- esc_html__('Keyword Index Status', 'pretty-link'),
417
- esc_html__('This shows how many posts have keywords indexed for and are ready for replacement.', 'pretty-link'));
418
- ?>
419
- </label>
420
- </th>
421
- <td>
422
- <?php
423
- global $plp_keyword;
424
- $kwind = $plp_keyword->posts_indexed();
425
- echo esc_html(sprintf(__('%1$s out of %2$s Posts Indexed', 'pretty-link'), $kwind->indexed, $kwind->total));
426
- if($plp_options->replace_keywords_in_comments) {
427
- echo "<br/>";
428
- $kwind = $plp_keyword->comments_indexed();
429
- echo esc_html(sprintf(__('%1$s out of %2$s Comments Indexed', 'pretty-link'), $kwind->indexed, $kwind->total));
430
- }
431
- ?>
432
- </td>
433
- </tr>
434
- <tr valign="top">
435
- <th scope="row">
436
- <label>
437
- <?php esc_html_e('URL Index Status', 'pretty-link'); ?>
438
- <?php PrliAppHelper::info_tooltip('prli-url-index-status',
439
- esc_html__('URL Replacements Index Status', 'pretty-link'),
440
- esc_html__('This shows how many posts have url replacements indexed for and are ready for replacement.', 'pretty-link'));
441
- ?>
442
- </label>
443
- </th>
444
- <td>
445
- <?php
446
- global $plp_url_replacement;
447
- $kwind = $plp_url_replacement->posts_indexed();
448
- echo esc_html(sprintf(__('%1$s out of %2$s Posts Indexed', 'pretty-link'), $kwind->indexed, $kwind->total));
449
- if($plp_options->replace_keywords_in_comments) {
450
- echo "<br/>";
451
- $kwind = $plp_url_replacement->comments_indexed();
452
- echo esc_html(sprintf(__('%1$s out of %2$s Comments Indexed', 'pretty-link'), $kwind->indexed, $kwind->total));
453
- }
454
- ?>
455
- </td>
456
- </tr>
457
- </tbody>
458
- </table>
459
- </div>
460
- </td>
461
- </tr>
462
- </tbody>
463
- </table>
464
- </div>
465
- </div>
466
-
467
- <div class="prli-page" id="auto-create">
468
- <div class="prli-page-title"><?php esc_html_e('Auto-Create Shortlink Options', 'pretty-link'); ?></div>
469
-
470
- <?php
471
- PlpOptionsHelper::autocreate_post_options('post',
472
- $plp_options->posts_auto,
473
- $plp_options->posts_category,
474
- $plp_options->social_posts_buttons
475
- );
476
-
477
- PlpOptionsHelper::autocreate_post_options('page',
478
- $plp_options->pages_auto,
479
- $plp_options->pages_category,
480
- $plp_options->social_pages_buttons
481
- );
482
-
483
- PlpOptionsHelper::autocreate_all_cpt_options();
484
- ?>
485
-
486
- </div>
487
-
488
- <div class="prli-page" id="prettybar">
489
- <div class="prli-page-title"><?php esc_html_e('Pretty Bar Options', 'pretty-link'); ?></div>
490
- <table class="form-table">
491
- <tbody>
492
- <tr valign="top">
493
- <th scope="row">
494
- <label for="<?php echo esc_attr($prettybar_image_url); ?>">
495
- <?php esc_html_e('Image URL', 'pretty-link'); ?>
496
- <?php PrliAppHelper::info_tooltip('prli-prettybar-image-url',
497
- esc_html__('Pretty Bar Image URL', 'pretty-link'),
498
- esc_html__('If set, this will replace the logo image on the Pretty Bar. The image that this URL references should be 48x48 Pixels to fit.', 'pretty-link'));
499
- ?>
500
- </label>
501
- </th>
502
- <td>
503
- <input type="text" class="large-text" name="<?php echo esc_attr($prettybar_image_url); ?>" value="<?php echo esc_attr($prli_options->prettybar_image_url); ?>"/>
504
- </td>
505
- </tr>
506
- <tr valign="top">
507
- <th scope="row">
508
- <label for="<?php echo esc_attr($prettybar_background_image_url); ?>">
509
- <?php esc_html_e('Background Image URL', 'pretty-link'); ?>
510
- <?php PrliAppHelper::info_tooltip('prli-prettybar-background-image-url',
511
- esc_html__('Pretty Bar Background Image URL', 'pretty-link'),
512
- esc_html__('If set, this will replace the background image on Pretty Bar. The image that this URL references should be 65px tall - this image will be repeated horizontally across the bar.', 'pretty-link'));
513
- ?>
514
- </label>
515
- </th>
516
- <td>
517
- <input type="text" class="large-text" name="<?php echo esc_attr($prettybar_background_image_url); ?>" value="<?php echo esc_attr($prli_options->prettybar_background_image_url); ?>"/>
518
- </td>
519
- </tr>
520
- <tr valign="top">
521
- <th scope="row">
522
- <label for="<?php echo esc_attr($prettybar_color); ?>">
523
- <?php esc_html_e('Background Color', 'pretty-link'); ?>
524
- <?php PrliAppHelper::info_tooltip('prli-prettybar-color',
525
- esc_html__('Pretty Bar Background Color', 'pretty-link'),
526
- esc_html__('This will alter the background color of the Pretty Bar if you haven\'t specified a Pretty Bar background image.', 'pretty-link'));
527
- ?>
528
- </label>
529
- </th>
530
- <td>
531
- <input type="text" class="plp-colorpicker" name="<?php echo esc_attr($prettybar_color); ?>" value="<?php echo esc_attr($prli_options->prettybar_color); ?>" size="8"/>
532
- </td>
533
- </tr>
534
- <tr valign="top">
535
- <th scope="row">
536
- <label for="<?php echo esc_attr($prettybar_text_color); ?>">
537
- <?php esc_html_e('Text Color', 'pretty-link'); ?>
538
- <?php PrliAppHelper::info_tooltip('prli-prettybar-text-color',
539
- esc_html__('Pretty Bar Text Color', 'pretty-link'),
540
- sprintf(
541
- // translators: %1$s: open code tag, %2$s: close code tag
542
- esc_html__('If not set, this defaults to black (RGB value %1$s#000000%2$s) but you can change it to whatever color you like.', 'pretty-link'),
543
- '<code>',
544
- '</code>'
545
- ));
546
- ?>
547
- </label>
548
- </th>
549
- <td>
550
- <input type="text" class="plp-colorpicker" name="<?php echo esc_attr($prettybar_text_color); ?>" value="<?php echo esc_attr($prli_options->prettybar_text_color); ?>" size="8"/>
551
- </td>
552
- </tr>
553
- <tr valign="top">
554
- <th scope="row">
555
- <label for="<?php echo esc_attr($prettybar_link_color); ?>">
556
- <?php esc_html_e('Link Color', 'pretty-link'); ?>
557
- <?php PrliAppHelper::info_tooltip('prli-prettybar-link-color',
558
- esc_html__('Pretty Bar Link Color', 'pretty-link'),
559
- sprintf(
560
- // translators: %1$s: open code tag, %2$s: close code tag
561
- esc_html__('If not set, this defaults to blue (RGB value %1$s#0000ee%2$s) but you can change it to whatever color you like.', 'pretty-link'),
562
- '<code>',
563
- '</code>'
564
- ));
565
- ?>
566
- </label>
567
- </th>
568
- <td>
569
- <input type="text" class="plp-colorpicker" name="<?php echo esc_attr($prettybar_link_color); ?>" value="<?php echo esc_attr($prli_options->prettybar_link_color); ?>" size="8"/>
570
- </td>
571
- </tr>
572
- <tr valign="top">
573
- <th scope="row">
574
- <label for="<?php echo esc_attr($prettybar_hover_color); ?>">
575
- <?php esc_html_e('Link Hover Color', 'pretty-link'); ?>
576
- <?php PrliAppHelper::info_tooltip('prli-prettybar-link-hover-color',
577
- esc_html__('Pretty Bar Link Hover Color', 'pretty-link'),
578
- sprintf(
579
- // translators: %1$s: open code tag, %2$s: close code tag
580
- esc_html__('If not set, this defaults to RGB value %1$s#ababab%2$s but you can change it to whatever color you like.', 'pretty-link'),
581
- '<code>',
582
- '</code>'
583
- ));
584
- ?>
585
- </label>
586
- </th>
587
- <td>
588
- <input type="text" class="plp-colorpicker" name="<?php echo esc_attr($prettybar_hover_color); ?>" value="<?php echo esc_attr($prli_options->prettybar_hover_color); ?>" size="8"/>
589
- </td>
590
- </tr>
591
- <tr valign="top">
592
- <th scope="row">
593
- <label for="<?php echo esc_attr($prettybar_visited_color); ?>">
594
- <?php esc_html_e('Visited Link Color', 'pretty-link'); ?>
595
- <?php PrliAppHelper::info_tooltip('prli-prettybar-visited-link-color',
596
- esc_html__('Pretty Bar Visited Link Color', 'pretty-link'),
597
- sprintf(
598
- // translators: %1$s: open code tag, %2$s: close code tag
599
- esc_html__('If not set, this defaults to RGB value %1$s#551a8b%2$s but you can change it to whatever color you like.', 'pretty-link'),
600
- '<code>',
601
- '</code>'
602
- ));
603
- ?>
604
- </label>
605
- </th>
606
- <td>
607
- <input type="text" class="plp-colorpicker" name="<?php echo esc_attr($prettybar_visited_color); ?>" value="<?php echo esc_attr($prli_options->prettybar_visited_color); ?>" size="8"/>
608
- </td>
609
- </tr>
610
- <tr valign="top">
611
- <th scope="row">
612
- <label for="<?php echo esc_attr($prettybar_title_limit); ?>">
613
- <?php esc_html_e('Title Char Limit', 'pretty-link'); ?>
614
- <?php PrliAppHelper::info_tooltip('prli-prettybar-title-char-limit',
615
- esc_html__('Pretty Bar Title Char Limit', 'pretty-link'),
616
- sprintf(
617
- // translators: %1$s: open code tag, %2$s: close code tag
618
- esc_html__('If your Website has a long title then you may need to adjust this value so that it will all fit on the Pretty Bar. It is recommended that you keep this value to %1$s30%2$s characters or less so the Pretty Bar\'s format looks good across different browsers and screen resolutions.', 'pretty-link'),
619
- '<code>',
620
- '</code>'
621
- ));
622
- ?>
623
- </label>
624
- </th>
625
- <td>
626
- <input type="text" name="<?php echo esc_attr($prettybar_title_limit); ?>" value="<?php echo esc_attr($prli_options->prettybar_title_limit); ?>" size="4"/>
627
- </td>
628
- </tr>
629
- <tr valign="top">
630
- <th scope="row">
631
- <label for="<?php echo esc_attr($prettybar_desc_limit); ?>">
632
- <?php esc_html_e('Description Char Limit', 'pretty-link'); ?>
633
- <?php PrliAppHelper::info_tooltip('prli-prettybar-desc-char-limit',
634
- esc_html__('Pretty Bar Description Char Limit', 'pretty-link'),
635
- sprintf(
636
- // translators: %1$s: open code tag, %2$s: close code tag
637
- esc_html__('If your Website has a long Description (tagline) then you may need to adjust this value so that it will all fit on the Pretty Bar. It is recommended that you keep this value to %1$s40%2$s characters or less so the Pretty Bar\'s format looks good across different browsers and screen resolutions.', 'pretty-link'),
638
- '<code>',
639
- '</code>'
640
- ));
641
- ?>
642
- </label>
643
- </th>
644
- <td>
645
- <input type="text" name="<?php echo esc_attr($prettybar_desc_limit); ?>" value="<?php echo esc_attr($prli_options->prettybar_desc_limit); ?>" size="4"/>
646
- </td>
647
- </tr>
648
- <tr valign="top">
649
- <th scope="row">
650
- <label for="<?php echo esc_attr($prettybar_link_limit); ?>">
651
- <?php esc_html_e('Target URL Char Limit', 'pretty-link'); ?>
652
- <?php PrliAppHelper::info_tooltip('prli-prettybar-target-url-char-limit',
653
- esc_html__('Pretty Bar Target URL Char Limit', 'pretty-link'),
654
- sprintf(
655
- // translators: %1$s: open code tag, %2$s: close code tag
656
- esc_html__('If you link to a lot of large Target URLs you may want to adjust this value. It is recommended that you keep this value to %1$s40%2$s or below so the Pretty Bar\'s format looks good across different browsers and URL sizes', 'pretty-link'),
657
- '<code>',
658
- '</code>'
659
- ));
660
- ?>
661
- </label>
662
- </th>
663
- <td>
664
- <input type="text" name="<?php echo esc_attr($prettybar_link_limit); ?>" value="<?php echo esc_attr($prli_options->prettybar_link_limit); ?>" size="4"/>
665
- </td>
666
- </tr>
667
- <tr valign="top">
668
- <th scope="row">
669
- <label for="<?php echo esc_attr($prettybar_show_title); ?>">
670
- <?php esc_html_e('Show Title', 'pretty-link'); ?>
671
- <?php PrliAppHelper::info_tooltip('prli-prettybar-show-title',
672
- esc_html__('Pretty Bar Show Title', 'pretty-link'),
673
- esc_html__('Make sure this is checked if you want the title of your blog (and link) to show up on the Pretty Bar.', 'pretty-link'));
674
- ?>
675
- </label>
676
- </th>
677
- <td>
678
- <input type="checkbox" name="<?php echo esc_attr($prettybar_show_title); ?>" <?php checked($prli_options->prettybar_show_title != 0); ?>/>
679
- </td>
680
- </tr>
681
- <tr valign="top">
682
- <th scope="row">
683
- <label for="<?php echo esc_attr($prettybar_show_description); ?>">
684
- <?php esc_html_e('Show Description', 'pretty-link'); ?>
685
- <?php PrliAppHelper::info_tooltip('prli-prettybar-show-description',
686
- esc_html__('Pretty Bar Show Description', 'pretty-link'),
687
- esc_html__('Make sure this is checked if you want your site description to show up on the Pretty Bar.', 'pretty-link'));
688
- ?>
689
- </label>
690
- </th>
691
- <td>
692
- <input type="checkbox" name="<?php echo esc_attr($prettybar_show_description); ?>" <?php checked($prli_options->prettybar_show_description != 0); ?>/>
693
- </td>
694
- </tr>
695
- <tr valign="top">
696
- <th scope="row">
697
- <label for="<?php echo esc_attr($prettybar_show_share_links); ?>">
698
- <?php esc_html_e('Show Share Links', 'pretty-link'); ?>
699
- <?php PrliAppHelper::info_tooltip('prli-prettybar-show-share-links',
700
- esc_html__('Pretty Bar Show Share Links', 'pretty-link'),
701
- esc_html__('Make sure this is checked if you want "share links" to show up on the Pretty Bar.', 'pretty-link'));
702
- ?>
703
- </label>
704
- </th>
705
- <td>
706
- <input type="checkbox" name="<?php echo esc_attr($prettybar_show_share_links); ?>" <?php checked($prli_options->prettybar_show_share_links != 0); ?>/>
707
- </td>
708
- </tr>
709
- <tr valign="top">
710
- <th scope="row">
711
- <label for="<?php echo esc_attr($prettybar_show_target_url_link); ?>">
712
- <?php esc_html_e('Show Target URL', 'pretty-link'); ?>
713
- <?php PrliAppHelper::info_tooltip('prli-prettybar-show-target-url-links',
714
- esc_html__('Pretty Bar Show Target URL Links', 'pretty-link'),
715
- esc_html__('Make sure this is checked if you want a link displaying the Target URL to show up on the Pretty Bar.', 'pretty-link'));
716
- ?>
717
- </label>
718
- </th>
719
- <td>
720
- <input type="checkbox" name="<?php echo esc_attr($prettybar_show_target_url_link); ?>" <?php checked($prli_options->prettybar_show_target_url_link != 0); ?>/>
721
- </td>
722
- </tr>
723
- <tr valign="top">
724
- <th scope="row">
725
- <label for="<?php echo esc_attr($prettybar_hide_attrib_link); ?>">
726
- <?php esc_html_e('Hide Attribution Link', 'pretty-link'); ?>
727
- <?php PrliAppHelper::info_tooltip('prli-prettybar-hide-attrib-link',
728
- esc_html__('Hide Attribution Link', 'pretty-link'),
729
- sprintf(
730
- // translators: %1$s: br tag, %2$s: open strong tag, %3$s close strong tag, %4$s open em tag, %5$s close em tag, %6$s open link tag, %7$s close link tag
731
- esc_html__('Check this to hide the pretty link attribution link on the pretty bar.%1$s%1$s%2$sWait, before you do this, you might want to leave this un-checked and set the alternate URL of this link to your %4$sPretty Links Pro%5$s %6$sAffiliate URL%7$s to earn a few bucks while you are at it.%3$s', 'pretty-link'),
732
- '<br>',
733
- '<strong>',
734
- '</strong>',
735
- '<em>',
736
- '</em>',
737
- '<a href="https://prettylinks.com/plp/options/aff-attribution">',
738
- '</a>'
739
- ));
740
- ?>
741
- </label>
742
- </th>
743
- <td>
744
- <input type="checkbox" name="<?php echo esc_attr($prettybar_hide_attrib_link); ?>" class="prli-toggle-checkbox" data-box="prettybar-attrib-url" data-reverse="true" <?php checked($plp_options->prettybar_hide_attrib_link != 0); ?>/>
745
- </td>
746
- </tr>
747
- </tbody>
748
- </table>
749
-
750
- <div class="prli-sub-box prettybar-attrib-url">
751
- <div class="prli-arrow prli-gray prli-up prli-sub-box-arrow"> </div>
752
- <table class="form-table">
753
- <tbody>
754
- <tr valign="top">
755
- <th scope="row">
756
- <label for="<?php echo esc_attr($prettybar_attrib_url); ?>">
757
- <?php esc_html_e('Attribution URL', 'pretty-link'); ?>
758
- <?php PrliAppHelper::info_tooltip('prli-prettybar-attribution-url',
759
- esc_html__('Alternate Pretty Bar Attribution URL', 'pretty-link'),
760
- sprintf(
761
- // translators: %1$s open em tag, %2$s close em tag, %3$s open link tag, %4$s close link tag
762
- esc_html__('If set, this will replace the Pretty Bars attribution URL. This is a very good place to put your %1$sPretty Links Pro%2$s %3$sAffiliate Link%4$s.', 'pretty-link'),
763
- '<em>',
764
- '</em>',
765
- '<a href="https://prettylinks.com/plp/options/aff-attribution-2">',
766
- '</a>'
767
- ));
768
- ?>
769
- </label>
770
- </th>
771
- <td>
772
- <input type="text" class="regular-text" name="<?php echo esc_attr($prettybar_attrib_url); ?>" value="<?php echo esc_attr($plp_options->prettybar_attrib_url); ?>"/>
773
- </td>
774
- </tr>
775
- </tbody>
776
- </table>
777
- </div>
778
- </div>
779
-
780
- <div class="prli-page" id="social">
781
- <div class="prli-page-title"><?php esc_html_e('Social Buttons Options', 'pretty-link'); ?></div>
782
- <div>
783
- <label class="prli-label" for="<?php echo esc_attr($social_buttons); ?>">
784
- <?php esc_html_e('Buttons', 'pretty-link'); ?>
785
- <?php PrliAppHelper::info_tooltip('prli-social-buttons',
786
- esc_html__('Social Buttons', 'pretty-link'),
787
- sprintf(
788
- // translators: %1$s: br tag, %2$s open code tag, %3$s close code tag
789
- esc_html__('Select which buttons you want to be visible on the Social Buttons Bar.%1$s%1$s%2$sNote:%3$s In order for the Social Buttons Bar to be visible on Pages and or Posts, you must first enable it in the "Page &amp; Post Options" section above.', 'pretty-link'),
790
- '<br>',
791
- '<code>',
792
- '</code>'
793
- ));
794
- ?>
795
- </label>
796
-
797
- <ul class="prli-social-button-checkboxes">
798
- <?php
799
- foreach( $plp_options->social_buttons as $b ) {
800
- ?>
801
- <li class="pl-social-<?php echo esc_attr($b['slug']); ?>-button">
802
- <input type="checkbox" name="<?php echo esc_attr("{$social_buttons}[{$b['slug']}]"); ?>" <?php checked($b['checked']); ?>/>
803
- <i class="<?php echo esc_attr($b['icon']); ?>"> </i>
804
- </li>
805
- <?php
806
- }
807
- ?>
808
- </ul>
809
- </div>
810
- <br/>
811
- <table class="form-table">
812
- <tbody>
813
- <tr valign="top">
814
- <th scope="row">
815
- <label for="<?php echo esc_attr($social_buttons_placement); ?>">
816
- <?php esc_html_e('Buttons Placement', 'pretty-link'); ?>
817
- <?php PrliAppHelper::info_tooltip('prli-social-buttons-placement',
818
- esc_html__('Social Buttons Placement', 'pretty-link'),
819
- sprintf(
820
- // translators: %1$s: br tag, %2$s open code tag, %3$s close code tag
821
- esc_html__('This determines where your Social Buttons Placement should appear in relation to content on Pages and/or Posts.%1$s%1$s%2$sNote:%3$s If you want this bar to appear then you must enable it in the "Auto-Create Links" section above.', 'pretty-link'),
822
- '<br>',
823
- '<code>',
824
- '</code>'
825
- ));
826
- ?>
827
- </label>
828
- </th>
829
- <td>
830
- <input type="radio" name="<?php echo esc_attr($social_buttons_placement); ?>" value="top" <?php checked($plp_options->social_buttons_placement, 'top'); ?>/><span class="prli-radio-text"><?php esc_html_e('Top', 'pretty-link'); ?></span><br/><br/>
831
- <input type="radio" name="<?php echo esc_attr($social_buttons_placement); ?>" value="bottom" <?php checked($plp_options->social_buttons_placement, 'bottom'); ?>/><span class="prli-radio-text"><?php esc_html_e('Bottom', 'pretty-link'); ?></span><br/><br/>
832
- <input type="radio" name="<?php echo esc_attr($social_buttons_placement); ?>" value="top-and-bottom" <?php checked($plp_options->social_buttons_placement, 'top-and-bottom'); ?>/><span class="prli-radio-text"><?php esc_html_e('Top and Bottom', 'pretty-link'); ?></span><br/><br/>
833
- <input type="radio" name="<?php echo esc_attr($social_buttons_placement); ?>" value="none" <?php checked($plp_options->social_buttons_placement, 'none'); ?>/><span class="prli-radio-text"><?php esc_html_e('None', 'pretty-link'); ?></span>
834
- <?php PrliAppHelper::info_tooltip('prli-social-buttons-placement-none',
835
- esc_html__('Social Buttons Manual Placement', 'pretty-link'),
836
- sprintf(
837
- // translators: %1$s: example shortcode, %2$s: example template tag
838
- esc_html__('If you select none, you can still show your Social Buttons by manually adding the %1$s shortcode to your blog posts or %2$s template tag to your WordPress Theme.', 'pretty-link'),
839
- '<code>[social_buttons_bar]</code>',
840
- '<code>&lt;?php the_social_buttons_bar(); ?&gt;</code>'
841
- ));
842
- ?>
843
- </td>
844
- </tr>
845
- </tbody>
846
- </table>
847
-
848
- <?php /*
849
- <table class="form-table prli-social-buttons-options">
850
- <tr class="form-field">
851
- <td valign="top" width="15%"><?php esc_html_e("Social Buttons Display Spacing:", 'pretty-link'); ?> </td>
852
- <td width="85%" class="pretty-link-social-buttons-padding-input">
853
- <input type="text" class="regular-text" name="<?php echo esc_attr($social_buttons_padding); ?>" value="<?php echo esc_attr($plp_options->social_buttons_padding); ?>" />px&nbsp; &nbsp;<span class="description"><?php esc_html_e('Determines the spacing (in pixels) between the buttons on the social buttons bar.', 'pretty-link'); ?></span>
854
- </td>
855
- </tr>
856
- </table>
857
-
858
- <h4><?php esc_html_e('Display Social Buttons in Feed:', 'pretty-link'); ?></h4>
859
- <div id="option-pane">
860
- <input type="checkbox" name="<?php echo esc_attr($social_buttons_show_in_feed); ?>" <?php checked($plp_options->social_buttons_show_in_feed != 0); ?>/>&nbsp;<?php esc_html_e('Show Social Buttons in your RSS Feed', 'pretty-link'); ?>
861
- </div>
862
- */ ?>
863
- </div>
864
-
865
- <div class="prli-page" id="public-links">
866
- <div class="prli-page-title"><?php esc_html_e('Public Links Creation Options', 'pretty-link'); ?></div>
867
- <table class="form-table">
868
- <tbody>
869
- <tr valign="top">
870
- <th scope="row">
871
- <label for="<?php echo esc_attr($allow_public_link_creation); ?>">
872
- <?php esc_html_e('Enable Public Links', 'pretty-link'); ?>
873
- <?php PrliAppHelper::info_tooltip('prli-enable-public-link-creation',
874
- esc_html__('Enable Public Link Creation on this Site', 'pretty-link'),
875
- sprintf(
876
- esc_html__('This option will give you the ability to turn your website into a link shortening service for your users. Once selected, you can enable the Pretty Links Pro Sidebar Widget or just display the link creation form with the %s shortcode in any post or page on your website.', 'pretty-link'),
877
- '<code>[prli_create_form]</code>'
878
- ));
879
- ?>
880
- </label>
881
- </th>
882
- <td>
883
- <input class="prli-toggle-checkbox" data-box="use-public-link-display-page" type="checkbox" name="<?php echo esc_attr($allow_public_link_creation); ?>" <?php checked($plp_options->allow_public_link_creation != 0); ?>/>
884
- </td>
885
- </tr>
886
- </tbody>
887
- </table>
888
- <div class="prli-sub-box use-public-link-display-page">
889
- <div class="prli-arrow prli-gray prli-up prli-sub-box-arrow"> </div>
890
- <table class="form-table">
891
- <tbody>
892
- <tr valign="top">
893
- <th scope="row">
894
- <label for="<?php echo esc_attr($use_public_link_display_page); ?>">
895
- <?php esc_html_e('Use Display Page', 'pretty-link'); ?>
896
- <?php PrliAppHelper::info_tooltip('prli-use-public-link-display-page-info',
897
- esc_html__('Use Public Link Display Page', 'pretty-link'),
898
- esc_html__('When a link is created using the public form, the user is typically redirected to a simple page displaying their new pretty link. But, you can specify a page that you want them to be redirected to on your website, using your branding instead by selecting this box and entering the url of the page you want them to go to.', 'pretty-link'));
899
- ?>
900
- </label>
901
- </th>
902
- <td>
903
- <input class="prli-toggle-checkbox" data-box="prli-public-link-display-page" type="checkbox" name="<?php echo esc_attr($use_public_link_display_page); ?>" <?php checked($plp_options->use_public_link_display_page != 0); ?>/>
904
- </td>
905
- </tr>
906
- </tbody>
907
- </table>
908
- <div class="prli-sub-box-white prli-public-link-display-page">
909
- <div class="prli-arrow prli-white prli-up prli-sub-box-arrow"> </div>
910
- <table class="form-table">
911
- <tbody>
912
- <tr valign="top">
913
- <th scope="row">
914
- <label for="<?php echo esc_attr($public_link_display_page); ?>">
915
- <?php esc_html_e('Display Page', 'pretty-link'); ?>
916
- <?php PrliAppHelper::info_tooltip('prli-public-link-display-page-info',
917
- esc_html__('Public Pretty Link Creation Display URL', 'pretty-link'),
918
- sprintf(
919
- esc_html__('To set this up, create a new page on your WordPress site and make sure the %s appears somewhere on this page -- otherwise the link will never get created. Once this page is created, just enter the full URL to it here. Make sure this URL does not end with a slash (/).', 'pretty-link'),
920
- '<code>[prli_create_display]</code>'
921
- ));
922
- ?>
923
- </label>
924
- </th>
925
- <td>
926
- <input type="text" class="regular-text" name="<?php echo esc_attr($public_link_display_page); ?>" value="<?php echo esc_attr($plp_options->public_link_display_page); ?>" />
927
- </td>
928
- </tr>
929
- </tbody>
930
- </table>
931
- </div>
932
- </div>
933
- </div>
934
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/app/views/options/general.php DELETED
@@ -1,66 +0,0 @@
1
- <?php if(!defined('ABSPATH')) { die('You are not allowed to call this page directly.'); } ?>
2
-
3
- <table class="form-table">
4
- <tbody>
5
- <tr valign="top">
6
- <th scope="row">
7
- <label for="<?php echo esc_attr($use_prettylink_url); ?>">
8
- <a href="https://prettylinks.com/plp/options/um/shortlink-url"><?php esc_html_e('Use Shortlink URL', 'pretty-link'); ?></a>
9
- <?php PrliAppHelper::info_tooltip('prli-use-shortlink-url',
10
- esc_html__('Use an Alternate Shortlink URL', 'pretty-link'),
11
- esc_html__('Use this option if you want to substitute your actual blog\'s url with another URL. You must have another valid domain name pointing to this WordPress install before you enable this option. If you are using this option to just get rid of the www in the beginning of your url that is fine -- just make sure your domain works without the www before enabling this option.', 'pretty-link'));
12
- ?>
13
- </label>
14
- </th>
15
- <td>
16
- <input class="prli-toggle-checkbox" data-box="prettylink-url" type="checkbox" name="<?php echo esc_attr($use_prettylink_url); ?>" <?php checked($plp_options->use_prettylink_url != 0); ?>/>
17
- </td>
18
- </tr>
19
- </tbody>
20
- </table>
21
-
22
- <div class="prli-sub-box prettylink-url">
23
- <div class="prli-arrow prli-gray prli-up prli-sub-box-arrow"> </div>
24
- <table class="form-table">
25
- <tbody>
26
- <tr valign="top">
27
- <th scope="row">
28
- <label for="<?php echo esc_attr($prettylink_url); ?>"><?php esc_html_e('Shortlink URL', 'pretty-link'); ?>
29
- <?php PrliAppHelper::info_tooltip('prli-shortlink-url',
30
- esc_html__('Shortlink URL', 'pretty-link'),
31
- esc_html__('Enter a valid base url that points at this WordPress install. Make sure this URL does not end with a slash (/).', 'pretty-link'));
32
- ?>
33
- </th>
34
- <td>
35
- <input type="text" class="regular-text" name="<?php echo esc_attr($prettylink_url); ?>" value="<?php echo esc_attr($plp_options->prettylink_url); ?>" />
36
- </td>
37
- </tr>
38
- </tbody>
39
- </table>
40
- </div>
41
-
42
- <table class="form-table">
43
- <tbody>
44
- <tr valign="top">
45
- <th scope="row">
46
- <label for="<?php echo esc_attr($minimum_access_role); ?>">
47
- <?php esc_html_e('Minimum Admin Role', 'pretty-link'); ?>
48
- <?php PrliAppHelper::info_tooltip('prli-use-shortlink-url',
49
- esc_html__('Set Minimum Role Required To Access Pretty Link', 'pretty-link'),
50
- esc_html__('Use this option to set the minimum role of users who can access the Admin interface for Pretty Link.', 'pretty-link'));
51
- ?>
52
- </label>
53
- </th>
54
- <td>
55
- <select name="<?php echo esc_attr($minimum_access_role); ?>">
56
- <option value="manage_options" <?php selected($plp_options->min_role, 'manage_options'); ?>><?php esc_html_e('Administrator', 'pretty-link'); ?></option>
57
- <option value="delete_pages" <?php selected($plp_options->min_role, 'delete_pages'); ?>><?php esc_html_e('Editor', 'pretty-link'); ?></option>
58
- <option value="publish_posts" <?php selected($plp_options->min_role, 'publish_posts'); ?>><?php esc_html_e('Author', 'pretty-link'); ?></option>
59
- <option value="edit_posts" <?php selected($plp_options->min_role, 'edit_posts'); ?>><?php esc_html_e('Contributor', 'pretty-link'); ?></option>
60
- <option value="read" <?php selected($plp_options->min_role, 'read'); ?>><?php esc_html_e('Subscriber', 'pretty-link'); ?></option>
61
- </select>
62
- </td>
63
- </tr>
64
- </tbody>
65
- </table>
66
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/app/views/options/index.php DELETED
@@ -1,2 +0,0 @@
1
- <?php /* Silence will fall */ ?>
2
-
 
 
pro/app/views/public/form.php DELETED
@@ -1,48 +0,0 @@
1
- <?php
2
- if(!defined('ABSPATH')) { die('You are not allowed to call this page directly.'); }
3
-
4
- global $post;
5
-
6
- $target_url = (isset($_GET['url'])) && is_string($_GET['url']) ? esc_url_raw(trim(stripslashes($_GET['url']))) : '';
7
-
8
- ?>
9
- <div id="prli_create_public_link">
10
- <form name="prli_public_form" class="prli_public_form" method="post" action="<?php echo esc_url(admin_url('admin-ajax.php')); ?>">
11
- <input type="hidden" name="action" value="plp-create-public-link" />
12
- <input type="hidden" name="referral-url" value="<?php echo esc_attr(PrliUtils::current_page_url()); ?>"/>
13
- <input type="hidden" name="redirect_type" value="<?php echo esc_attr($redirect_type); ?>"/>
14
- <input type="hidden" name="track" value="<?php echo esc_attr($track); ?>"/>
15
- <input type="hidden" name="category" value="<?php echo esc_attr($category); ?>"/>
16
-
17
- <?php
18
- wp_nonce_field('plp-create-public-link', '_wpnonce', false);
19
-
20
- if(isset($_GET['errors'])):
21
- $errors = unserialize(stripslashes($_GET['errors']));
22
-
23
- if( is_array($errors) && count($errors) > 0 ):
24
- ?>
25
- <div class="error">
26
- <ul>
27
- <?php foreach( $errors as $error ): ?>
28
- <li><strong><?php esc_html_e('ERROR:', 'pretty-link'); ?></strong> <?php echo esc_html($error); ?></li>
29
- <?php endforeach; ?>
30
- </ul>
31
- </div>
32
- <?php
33
- endif;
34
-
35
- endif;
36
- ?>
37
-
38
- <p class="prli_create_link_fields">
39
- <div class="plp-create-link-label"><?php echo esc_html($label); ?></div>
40
- <div class="plp-create-link-input"><input type="text" name="url" value="<?php echo esc_attr($target_url); ?>" /></div>
41
-
42
- <?php if(!empty($button)): ?>
43
- <div class="plp-create-link-submit"><input type="submit" name="Submit" value="<?php echo esc_attr($button); ?>" /></div>
44
- <?php endif; ?>
45
- </p>
46
- </form>
47
- </div>
48
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/app/views/public/index.php DELETED
@@ -1,2 +0,0 @@
1
- <?php /* Silence will fall */ ?>
2
-
 
 
pro/app/views/reports/custom-report.php DELETED
@@ -1,74 +0,0 @@
1
- <?php
2
- if(!defined('ABSPATH'))
3
- die('You are not allowed to call this page directly.');
4
- ?>
5
-
6
- <div class="wrap">
7
- <?php PrliAppHelper::page_title(__('Link Report', 'pretty-link')); ?>
8
- <h3><?php esc_html_e('Report:', 'pretty-link'); ?> "<?php echo esc_html(stripslashes($report->name)); ?>"</h3>
9
- <?php if( !empty($report->goal_link_id) ): ?>
10
- <h4><?php esc_html_e('For Goal Link:', 'pretty-link'); ?> "<?php echo esc_html(stripslashes($goal_link->name)); ?>"</h4>
11
- <?php endif; ?>
12
- <a href="#" style="display:inline;" class="filter_toggle"><?php esc_html_e('Customize Report', 'pretty-link'); ?></a>
13
- <div class="filter_pane">
14
- <form class="form-fields" name="form2" method="post" action="">
15
- <?php wp_nonce_field('prli-reports'); ?>
16
- <span><?php esc_html_e('Date Range:', 'pretty-link'); ?></span>
17
- <div id="dateselectors" style="display: inline;">
18
- <input type="text" name="sdate" id="sdate" value="<?php echo esc_attr($params['sdate']); ?>" style="display:inline;"/>&nbsp;to&nbsp;<input type="text" name="edate" id="edate" value="<?php echo esc_attr($params['edate']); ?>" style="display:inline;"/>
19
- </div>
20
- <br/>
21
- <br/>
22
- <div class="submit" style="display: inline;"><input type="submit" name="Submit" value="<?php esc_attr_e('Customize', 'pretty-link'); ?>" class="button button-primary" /> &nbsp; <a href="#" class="filter_toggle button"><?php esc_html_e('Cancel', 'pretty-link'); ?></a></div>
23
- </form>
24
- </div>
25
- <div id="clicks_chart" style="margin-top:15px;"></div>
26
- <br/><br/>
27
- <table class="widefat post fixed" cellspacing="0">
28
- <thead>
29
- <tr>
30
- <th class="manage-column" width="40%"><?php esc_html_e('Link Name', 'pretty-link'); ?></th>
31
- <th class="manage-column" width="15%"><?php esc_html_e('Clicks', 'pretty-link'); ?></th>
32
- <th class="manage-column" width="15%"><?php esc_html_e('Uniques', 'pretty-link'); ?></th>
33
- <?php if( !empty($report->goal_link_id) ) { ?>
34
- <th class="manage-column" width="15%"><?php esc_html_e('Conversions', 'pretty-link'); ?></th>
35
- <th class="manage-column" width="15%"><?php esc_html_e('Conv Rate', 'pretty-link'); ?></th>
36
- <?php } ?>
37
- </tr>
38
- </thead>
39
- <?php
40
-
41
- for($i=0;$i<count($links);$i++)
42
- {
43
- $label = stripslashes($labels[$i]);
44
- $hit_count = $hits[$i];
45
- $unique_count = $uniques[$i];
46
- $conv_count = isset($conversions[$i]) ? $conversions[$i] : 0;
47
- $conv_rate = isset($conv_rates[$i]) ? $conv_rates[$i] : 0;
48
- ?>
49
- <tr>
50
- <td><strong><?php echo esc_html($label); ?></strong></td>
51
- <td<?php echo (((float)$hit_count == (float)$top_hits)?' style="font-weight: bold;"':'') ?>><?php echo esc_html($hit_count); ?></td>
52
- <td<?php echo (((float)$unique_count == (float)$top_uniques)?' style="font-weight: bold;"':'') ?>><?php echo esc_html($unique_count); ?></td>
53
- <?php if( !empty($report->goal_link_id) ) { ?>
54
- <td<?php echo (((float)$conv_count == (float)$top_conversions)?' style="font-weight: bold;"':'') ?>><?php echo esc_html($conv_count); ?></td>
55
- <td<?php echo (((float)$conv_rate == (float)$top_conv_rate)?' style="font-weight: bold;"':'') ?>><?php echo esc_html($conv_rate); ?>%</td>
56
- <?php } ?>
57
- </tr>
58
- <?php
59
- }
60
- ?>
61
- <tfoot>
62
- <tr>
63
- <th class="manage-column"><?php esc_html_e('Link Name', 'pretty-link'); ?></th>
64
- <th class="manage-column"><?php esc_html_e('Clicks', 'pretty-link'); ?></th>
65
- <th class="manage-column"><?php esc_html_e('Uniques', 'pretty-link'); ?></th>
66
- <?php if( !empty($report->goal_link_id) ) { ?>
67
- <th class="manage-column"><?php esc_html_e('Conversions', 'pretty-link'); ?></th>
68
- <th class="manage-column"><?php esc_html_e('Conv Rate', 'pretty-link'); ?></th>
69
- <?php } ?>
70
- </tr>
71
- </tfoot>
72
- </table>
73
- </div>
74
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/app/views/reports/edit.php DELETED
@@ -1,69 +0,0 @@
1
- <?php if(!defined('ABSPATH')) { die('You are not allowed to call this page directly.'); }
2
-
3
- $name = isset($_POST['name']) && empty($record) ? sanitize_text_field(stripslashes($_POST['name'])) : stripslashes($record->name);
4
- ?>
5
-
6
- <div class="wrap">
7
- <?php PrliAppHelper::page_title(__('Edit Link Report', 'pretty-link')); ?>
8
-
9
- <?php require(PRLI_VIEWS_PATH.'/shared/errors.php'); ?>
10
-
11
- <form name="form1" method="post" action="<?php echo esc_url(admin_url( 'admin.php?page=plp-reports' )); ?>">
12
- <input type="hidden" name="action" value="update">
13
- <input type="hidden" name="id" value="<?php echo esc_attr($id); ?>">
14
- <?php wp_nonce_field('update-options'); ?>
15
-
16
- <table class="form-table">
17
- <tr class="form-field">
18
- <td width="75px" valign="top"><?php esc_html_e('Name:', 'pretty-link'); ?> </td>
19
- <td><input type="text" name="name" value="<?php echo esc_attr($name); ?>" size="75">
20
- <br/><span class="description"><?php esc_html_e("This is how you'll identify your Report.", 'pretty-link'); ?></span></td>
21
- </tr>
22
- </table>
23
- <table class="form-table">
24
- <tr class="form-field" valign="top">
25
- <td width="50%" valign="top">
26
- <h3><?php esc_html_e('Select Links to Analyze in this Report:', 'pretty-link'); ?></h3>
27
- <div style="height: 400px; width: 95%; border: 1px solid #8cbdd5; overflow: auto;">
28
- <ul width="100%">
29
- <?php for ($i = 0; $i < count($links); $i++) :
30
- $link = $links[$i];
31
- ?>
32
- <li class="link-list-item" style="<?php echo (($i%2)?'background-color: #efefef; ':'background-color: #dedede; '); ?>padding: 5px; margin: 0px; "><input type="checkbox" style="width: 15px;" name="link[<?php echo esc_attr($link->id); ?>]" <?php echo (((isset($_POST['link'][$link->id]) and $_POST['link'][$link->id] == 'on') or (empty($_POST) and in_array($link->id,$report_links)))?'checked="true"':''); ?>/>&nbsp;<?php echo esc_html(substr(stripslashes($link->name),0,50)) . " <strong>(" . esc_html(stripslashes($link->slug)) . ")</strong>"; ?></li>
33
- <?php endfor; ?>
34
- </ul>
35
- </div>
36
- <span class="description"><?php esc_html_e('Select some links to be analyzed in this report.', 'pretty-link'); ?></span>
37
- </td>
38
- <td valign="top" width="50%">
39
- <h3><?php esc_html_e('Select Your Goal Link (optional):', 'pretty-link'); ?> </h3>
40
- <div style="height: 400px; width: 95%; border: 1px solid #8cbdd5; overflow: auto;">
41
- <table width="100%" cellspacing="0">
42
- <thead style="background-color: #dedede; padding: 0px; margin: 0px; line-height: 8px; font-size: 14px;">
43
- <tr>
44
- <th width="75%" style="padding-left: 5px; margin: 0px;"><strong><?php esc_html_e('Name', 'pretty-link'); ?></strong></th>
45
- </tr>
46
- </thead>
47
- <?php
48
- for($i = 0; $i < count($links); $i++) {
49
- $link = $links[$i];
50
- ?>
51
- <tr <?php echo (($i%2)?' style="background-color: #efefef;"':''); ?>>
52
- <td style="padding: 5px; margin: 0px;" width="100%"><input type="radio" style="width: 15px;" name="goal_link_id" value="<?php echo esc_attr($link->id); ?>" <?php echo (((isset($_POST['goal_link_id']) and $_POST['goal_link_id'] == $link->id) or (empty($_POST) and $link->id == $record->goal_link_id))?'checked="true"':''); ?>/>&nbsp;<?php echo esc_html(substr(stripslashes($link->name),0,25)) . " <strong>(" . esc_html(stripslashes($link->slug)) . ")</strong>"; ?></td>
53
- </tr>
54
- <?php
55
-
56
- }
57
- ?>
58
- </table>
59
- </div>
60
- <span class="description"><?php esc_html_e('If you want to enable conversion tracking in this report then select a goal link.', 'pretty-link'); ?></span>
61
- </td>
62
- </tr>
63
- </table>
64
-
65
- <p class="submit">
66
- <input type="submit" name="Submit" value="<?php esc_html_e('Update', 'pretty-link'); ?>" class="button button-primary" /> &nbsp; <a href="<?php echo esc_url(admin_url('admin.php?page=plp-reports&action=list')); ?>" class="button"><?php esc_html_e('Cancel', 'pretty-link'); ?></a>
67
- </p>
68
- </form>
69
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/app/views/reports/index.php DELETED
@@ -1,2 +0,0 @@
1
- <?php /* Silence will fall */ ?>
2
-
 
 
pro/app/views/reports/list.php DELETED
@@ -1,94 +0,0 @@
1
- <?php if(!defined('ABSPATH')) { die('You are not allowed to call this page directly.'); } ?>
2
-
3
- <div class="wrap">
4
- <?php PrliAppHelper::page_title(__('Link Reports', 'pretty-link')); ?>
5
- <a href="<?php echo esc_url(admin_url('admin.php?page=plp-reports&action=new')); ?>" class="page-title-action"><?php esc_html_e('Add Report', 'pretty-link'); ?></a>
6
- <hr class="wp-header-end">
7
-
8
- <?php if($record_count <= 0): ?>
9
- <div class="updated notice notice-success is-dismissible"><p><?php echo $prli_message; ?></p></div>
10
- <?php endif; ?>
11
-
12
- <div id="search_pane" style="float: right;">
13
- <form class="form-fields" name="report_form" method="post" action="">
14
- <?php wp_nonce_field('prlipro-reports'); ?>
15
- <input type="hidden" name="sort" id="sort" value="<?php echo esc_attr($sort_str); ?>" />
16
- <input type="hidden" name="sdir" id="sort" value="<?php echo esc_attr($sdir_str); ?>" />
17
- <input type="text" name="search" id="search" value="<?php echo esc_attr($search_str); ?>" style="display:inline;"/>
18
- <div class="submit" style="display: inline;padding-bottom: 0;"><input class="button button-primary" type="submit" name="Submit" value="<?php esc_attr_e('Search', 'pretty-link'); ?>"/>
19
- <?php if(!empty($search_str)): ?>
20
- &nbsp; <a href="<?php echo esc_url(admin_url('admin.php?page=plp-reports&action=list')); ?>" class="button"><?php esc_html_e('Reset', 'pretty-link'); ?></a>
21
- <?php endif; ?>
22
- </div>
23
- </form>
24
- </div>
25
-
26
- <?php require(PRLI_VIEWS_PATH.'/shared/table-nav.php'); ?>
27
- <table class="widefat post fixed" cellspacing="0">
28
- <thead>
29
- <tr>
30
- <th class="manage-column" width="35%">
31
- <a href="<?php echo esc_url(admin_url('admin.php?page=plp-reports&action=list&sort=name') . (($sort_str == 'name' && $sdir_str == 'asc')?'&sdir=desc':'')); ?>">
32
- <?php esc_html_e('Name', 'pretty-link'); ?><?php echo (($sort_str == 'name')?'&nbsp;&nbsp;&nbsp;<img src="'.esc_url(PRLI_IMAGES_URL.'/'.(($sdir_str == 'desc')?'arrow_down.png':'arrow_up.png')).'"/>':'') ?>
33
- </a>
34
- </th>
35
- <th class="manage-column" width="35%">
36
- <a href="<?php echo esc_url(admin_url('admin.php?page=plp-reports&action=list&sort=goal_link_name') . (($sort_str == 'goal_link_name' and $sdir_str == 'asc')?'&sdir=desc':'')); ?>">
37
- <?php esc_html_e('Goal Link', 'pretty-link'); ?><?php echo (($sort_str == 'goal_link_name')?'&nbsp;&nbsp;&nbsp;<img src="'.esc_url(PRLI_IMAGES_URL.'/'.(($sdir_str == 'desc')?'arrow_down.png':'arrow_up.png')).'"/>':'') ?>
38
- </a>
39
- </th>
40
- <th class="manage-column" width="10%">
41
- <a href="<?php echo esc_url(admin_url('admin.php?page=plp-reports&action=list&sort=link_count') . (($sort_str == 'link_count' and $sdir_str == 'asc')?'&sdir=desc':'')); ?>">
42
- <?php esc_html_e('Links', 'pretty-link'); ?><?php echo (($sort_str == 'link_count')?'&nbsp;&nbsp;&nbsp;<img src="'.esc_url(PRLI_IMAGES_URL.'/'.(($sdir_str == 'desc')?'arrow_down.png':'arrow_up.png')).'"/>':'') ?>
43
- </a>
44
- </th>
45
- <th class="manage-column" width="20%">
46
- <a href="<?php echo esc_url(admin_url('admin.php?page=plp-reports&action=list&sort=created_at') . (($sort_str == 'created_at' and $sdir_str == 'asc')?'&sdir=desc':'')); ?>">
47
- <?php esc_html_e('Created', 'pretty-link'); ?><?php echo ((empty($sort_str) or $sort_str == 'created_at')?'&nbsp;&nbsp;&nbsp;<img src="'.esc_url(PRLI_IMAGES_URL.'/'.((empty($sort_str) or $sdir_str == 'desc')?'arrow_down.png':'arrow_up.png')).'"/>':'') ?>
48
- </a>
49
- </th>
50
- </tr>
51
- </thead>
52
- <?php
53
-
54
- if($record_count <= 0) {
55
- ?>
56
- <tr>
57
- <td colspan="4"><?php esc_html_e('No Pretty Link Reports were found', 'pretty-link'); ?></td>
58
- </tr>
59
- <?php
60
- }
61
- else {
62
- $row_index=0;
63
- foreach($reports as $report) {
64
- $alternate = ( $row_index++ % 2 ? '' : 'alternate' );
65
- ?>
66
- <tr id="record_<?php echo esc_attr($report->id); ?>" class="<?php echo esc_attr($alternate); ?>">
67
- <td class="edit_report">
68
- <a class="report_name" href="<?php echo esc_url(admin_url("admin.php?page=plp-reports&action=edit&id={$report->id}")); ?>" title="<?php echo esc_attr(sprintf(__('Edit %s', 'pretty-link'), stripslashes($report->name))); ?>"><?php echo esc_html(stripslashes($report->name)); ?></a>
69
- <br/>
70
- <div class="report_actions">
71
- <a href="<?php echo esc_url(admin_url("admin.php?page=plp-reports&action=edit&id={$report->id}")); ?>" title="<?php echo esc_attr(sprintf(__('Edit %s', 'pretty-link'), stripslashes($report->name))); ?>"><?php esc_html_e('Edit', 'pretty-link'); ?></a>&nbsp;|
72
- <a href="<?php echo esc_url(admin_url("admin.php?page=plp-reports&action=destroy&id={$report->id}")); ?>" onclick="return confirm('<?php echo esc_attr(sprintf(__('Are you sure you want to delete your %s Pretty Link Report?', 'pretty-link'), stripslashes($report->name))); ?>');" title="<?php echo esc_attr(sprintf(__('Delete %s', 'pretty-link'), stripslashes($report->name))); ?>"><?php esc_html_e('Delete', 'pretty-link'); ?></a>&nbsp;|
73
- <a href="<?php echo esc_url(admin_url("admin.php?page=plp-reports&action=display-custom-report&id={$report->id}")); ?>" title="<?php echo esc_attr(sprintf(__('View report for %s', 'pretty-link'), stripslashes($report->name))); ?>"><?php esc_html_e('View', 'pretty-link'); ?></a>
74
- </div>
75
- </td>
76
- <td><?php echo esc_html(stripslashes($report->goal_link_name)); ?></td>
77
- <td><?php echo esc_html($report->link_count); ?></td>
78
- <td><?php echo esc_html($report->created_at); ?></td>
79
- </tr>
80
- <?php
81
- }
82
- }
83
- ?>
84
- <tfoot>
85
- <tr>
86
- <th class="manage-column"><?php esc_html_e('Name', 'pretty-link'); ?></th>
87
- <th class="manage-column"><?php esc_html_e('Goal Link', 'pretty-link'); ?></th>
88
- <th class="manage-column"><?php esc_html_e('Links', 'pretty-link'); ?></th>
89
- <th class="manage-column"><?php esc_html_e('Created', 'pretty-link'); ?></th>
90
- </tr>
91
- </tfoot>
92
- </table>
93
- <?php require(PRLI_VIEWS_PATH.'/shared/table-nav.php'); ?>
94
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/app/views/reports/new.php DELETED
@@ -1,70 +0,0 @@
1
- <?php if(!defined('ABSPATH')) { die('You are not allowed to call this page directly.'); }
2
-
3
- $name = isset($_POST['name']) ? sanitize_text_field(stripslashes($_POST['name'])) : '';
4
- ?>
5
-
6
- <div class="wrap">
7
- <?php PrliAppHelper::page_title(__('Add Link Report', 'pretty-link')); ?>
8
-
9
- <?php require(PRLI_VIEWS_PATH.'/shared/errors.php'); ?>
10
-
11
- <form name="form1" method="post" action="<?php echo esc_url(admin_url('admin.php?page=plp-reports')); ?>">
12
- <input type="hidden" name="action" value="create">
13
- <?php wp_nonce_field('update-options'); ?>
14
-
15
- <table class="form-table">
16
- <tr class="form-field">
17
- <td width="75px" valign="top"><?php esc_html_e('Name*:', 'pretty-link'); ?> </td>
18
- <td><input type="text" name="name" value="<?php echo esc_attr($name); ?>" size="75">
19
- <br/><span class="description"><?php esc_html_e("This is how you'll identify your Report.", 'pretty-link'); ?></span>
20
- </td>
21
- </tr>
22
- </table>
23
- <table class="form-table">
24
- <tr class="form-field" valign="top">
25
- <td width="50%" valign="top">
26
- <h3><?php esc_html_e('Select Links to Analyze in this Report:', 'pretty-link'); ?></h3>
27
- <div style="height: 400px; width: 95%; border: 1px solid #8cbdd5; overflow: auto;">
28
- <ul width="100%">
29
- <?php for ($i = 0; $i < count($links); $i++) :
30
- $link = $links[$i];
31
- ?>
32
- <li class="link-list-item" style="<?php echo (($i%2)?'background-color: #efefef; ':'background-color: #dedede; '); ?>padding: 5px; margin: 0px; "><input type="checkbox" style="width: 15px;" name="link[<?php echo esc_attr($link->id); ?>]" <?php echo (((isset($_POST['link'][$link->id]) and $_POST['link'][$link->id] == 'on'))?'checked="true"':''); ?>/>&nbsp;<?php echo esc_html(substr(stripslashes($link->name),0,50)) . " <strong>(" . esc_html(stripslashes($link->slug)) . ")</strong>"; ?></li>
33
- <?php endfor; ?>
34
- </ul>
35
- </div>
36
- <span class="description"><?php esc_html_e('Select some links to be analyzed in this report.', 'pretty-link'); ?></span>
37
- </td>
38
- <td valign="top" width="50%">
39
- <h3><?php esc_html_e('Select Your Goal Link (optional):', 'pretty-link'); ?> </h3>
40
- <div style="height: 400px; width: 95%; border: 1px solid #8cbdd5; overflow: auto;">
41
- <table width="100%" cellspacing="0">
42
- <thead style="background-color: #dedede; padding: 0px; margin: 0px; line-height: 8px; font-size: 14px;">
43
- <tr>
44
- <th width="100%" style="padding-left: 5px; margin: 0px;"><strong><?php esc_html_e('Name', 'pretty-link'); ?></strong></th>
45
- </tr>
46
- </thead>
47
- <?php
48
- for($i = 0; $i < count($links); $i++) {
49
- $link = $links[$i];
50
- ?>
51
- <tr <?php echo (($i%2)?' style="background-color: #efefef;"':''); ?>>
52
- <td style="padding: 5px; margin: 0px;" width="50%"><input type="radio" style="width: 15px;" name="goal_link_id" value="<?php echo esc_attr($link->id); ?>" <?php echo (((isset($_POST['goal_link_id']) and $_POST['goal_link_id'] == $link->id))?'checked="true"':''); ?>/>&nbsp;<?php echo esc_html(substr(stripslashes($link->name),0,25)) . " <strong>(" . esc_html(stripslashes($link->slug)) . ")</strong>"; ?></td>
53
- </tr>
54
- <?php
55
-
56
- }
57
- ?>
58
- </table>
59
- </div>
60
- <span class="description"><?php esc_html_e('If you want to enable conversion tracking in this report then select a goal link.', 'pretty-link'); ?></span>
61
- </td>
62
- </tr>
63
- </table>
64
-
65
- <p class="submit">
66
- <input type="submit" name="Submit" value="<?php esc_attr_e('Create', 'pretty-link'); ?>" class="button button-primary" /> &nbsp; <a href="<?php echo esc_url(admin_url('admin.php?page=plp-reports&action=list')); ?>" class="button"><?php esc_html_e('Cancel', 'pretty-link'); ?></a>
67
- </p>
68
-
69
- </form>
70
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/app/views/reports/reports.php DELETED
@@ -1,9 +0,0 @@
1
- <?php if(!defined('ABSPATH')) { die('You are not allowed to call this page directly.'); } ?>
2
-
3
- <div class="wrap">
4
- <?php PrliAppHelper::page_title(__('Reports', 'pretty-link')); ?>
5
-
6
- <ul style="list-style-type: none;">
7
- <li><a href="<?php echo esc_url(str_replace( '%7E', '~', $_SERVER['REQUEST_URI']) . '&action=list'); ?>"><?php esc_html_e('Link Reports', 'pretty-link'); ?></a></li>
8
- </ul>
9
- </div>
 
 
 
 
 
 
 
 
 
pro/app/views/reports/split-test-report.php DELETED
@@ -1,69 +0,0 @@
1
- <?php if(!defined('ABSPATH')) { die('You are not allowed to call this page directly.'); } ?>
2
-
3
- <div class="wrap">
4
- <?php PrliAppHelper::page_title(__('Link Split-Test Report', 'pretty-link')); ?>
5
- <h3><?php esc_html_e('For Link:', 'pretty-link'); ?> "<?php echo esc_html(stripslashes($link->name)); ?>"</h3>
6
- <?php if( !empty($goal_link_id) and $goal_link_id ) { ?>
7
- <h4><?php esc_html_e('Goal Link:', 'pretty-link'); ?> "<?php echo esc_html(stripslashes($goal_link->name)); ?>"</h4>
8
- <?php } ?>
9
- <a href="<?php echo esc_url(admin_url('edit.php?post_type=pretty-link')); ?>" style="font-size:16px;">&laquo <?php esc_html_e('Back to Links', 'pretty-link'); ?></a>&nbsp;|&nbsp;<a href="#" style="display:inline;" class="filter_toggle"><?php esc_html_e('Customize Report', 'pretty-link'); ?></a>
10
- <div class="filter_pane">
11
- <form class="form-fields" name="form2" method="post" action="">
12
- <?php wp_nonce_field('prli-reports'); ?>
13
- <span><?php esc_html_e('Date Range:', 'pretty-link'); ?></span>
14
- <div id="dateselectors" style="display: inline;">
15
- <input type="text" name="sdate" id="sdate" value="<?php echo esc_attr($params['sdate']); ?>" style="display:inline;"/>&nbsp;to&nbsp;<input type="text" name="edate" id="edate" value="<?php echo esc_attr($params['edate']); ?>" style="display:inline;"/>
16
- </div>
17
- <br/>
18
- <br/>
19
- <div class="submit" style="display: inline;"><input type="submit" name="Submit" value="<?php esc_attr_e('Customize', 'pretty-link'); ?>" class="button button-primary" /> &nbsp; <a href="#" class="filter_toggle button"><?php esc_html_e('Cancel', 'pretty-link'); ?></a></div>
20
- </form>
21
- </div>
22
- <div id="clicks_chart" style="margin-top:15px;"></div>
23
- <br/><br/>
24
- <table class="widefat post fixed" cellspacing="0">
25
- <thead>
26
- <tr>
27
- <th class="manage-column" width="40%"><?php esc_html_e('Link Rotation URL', 'pretty-link'); ?></th>
28
- <th class="manage-column" width="15%"><?php esc_html_e('Clicks', 'pretty-link'); ?></th>
29
- <th class="manage-column" width="15%"><?php esc_html_e('Uniques', 'pretty-link'); ?></th>
30
- <?php if( !empty($goal_link_id) and $goal_link_id ) { ?>
31
- <th class="manage-column" width="15%"><?php esc_html_e('Conversions', 'pretty-link'); ?></th>
32
- <th class="manage-column" width="15%"><?php esc_html_e('Conv Rate', 'pretty-link'); ?></th>
33
- <?php } ?>
34
- </tr>
35
- </thead>
36
- <?php
37
-
38
- for($i=0;$i<count($links);$i++) {
39
- $label = stripslashes($labels[$i]);
40
- $hit_count = $hits[$i];
41
- $unique_count = $uniques[$i];
42
- $conv_count = $conversions[$i];
43
- $conv_rate = $conv_rates[$i];
44
- ?>
45
- <tr>
46
- <td><strong><?php echo esc_html($label); ?></strong></td>
47
- <td<?php echo (((float)$hit_count == (float)$top_hits)?' style="font-weight: bold;"':'') ?>><?php echo esc_html($hit_count); ?></td>
48
- <td<?php echo (((float)$unique_count == (float)$top_uniques)?' style="font-weight: bold;"':'') ?>><?php echo esc_html($unique_count); ?></td>
49
- <?php if( !empty($goal_link_id) and $goal_link_id ) { ?>
50
- <td<?php echo (((float)$conv_count == (float)$top_conversions)?' style="font-weight: bold;"':'') ?>><?php echo esc_html($conv_count); ?></td>
51
- <td<?php echo (((float)$conv_rate == (float)$top_conv_rate)?' style="font-weight: bold;"':'') ?>><?php echo esc_html($conv_rate); ?>%</td>
52
- <?php } ?>
53
- </tr>
54
- <?php
55
- }
56
- ?>
57
- <tfoot>
58
- <tr>
59
- <th class="manage-column"><?php esc_html_e('Rotation URL', 'pretty-link'); ?></th>
60
- <th class="manage-column"><?php esc_html_e('Clicks', 'pretty-link'); ?></th>
61
- <th class="manage-column"><?php esc_html_e('Uniques', 'pretty-link'); ?></th>
62
- <?php if( !empty($goal_link_id) and $goal_link_id ) { ?>
63
- <th class="manage-column"><?php esc_html_e('Conversions', 'pretty-link'); ?></th>
64
- <th class="manage-column"><?php esc_html_e('Conv Rate', 'pretty-link'); ?></th>
65
- <?php } ?>
66
- </tr>
67
- </tfoot>
68
- </table>
69
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/app/views/tools/generator.php DELETED
@@ -1,44 +0,0 @@
1
- <?php if(!defined('ABSPATH')) { die('You are not allowed to call this page directly.'); } ?>
2
-
3
- <?php $prli_blogurl = esc_html($prli_blogurl); ?>
4
-
5
- <div class="prli-page" id="custom-bookmarklet">
6
- <div class="prli-page-title"><?php esc_html_e('Custom Bookmarklet:', 'pretty-link'); ?></div>
7
- <strong><span id="prlipro-custom-bookmarklet-link"><a class="button button-primary" href="<?php echo esc_url(PrliLink::bookmarklet_link()); ?>" style="vertical-align:middle;"><?php esc_html_e('Get Pretty Link', 'pretty-link'); ?></a></span></strong>&nbsp;&nbsp;
8
- <?php PrliAppHelper::info_tooltip( 'prli-custom-bookmarklet-instructions',
9
- esc_html__('Customize Pretty Link Bookmarklet', 'pretty-link'),
10
- esc_html__('Alter the options below to customize this Bookmarklet. As you modify the label, redirect type, tracking and category, you will see this bookmarklet update -- when the settings are how you want them, drag the bookmarklet into your toolbar. You can create as many bookmarklets as you want each with different settings.', 'pretty-link'));
11
- ?>
12
- <div>&nbsp;</div>
13
- <p><strong><?php esc_html_e('Pretty Link Options', 'pretty-link'); ?></strong></p>
14
- <form id="prlipro-custom-bookmarklet-form">
15
- <p>
16
- <label for="prlipro-bookmarklet-label" class="plp-bookmarklet-col-1"><?php esc_html_e('Label:', 'pretty-link'); ?></label>
17
- <input id="prlipro-bookmarklet-label" type="text" size="25" value="<?php esc_attr_e('Get Pretty Link', 'pretty-link'); ?>" />
18
- </p>
19
- <p>
20
- <label for="prlipro-bookmarklet-redirect-type" class="plp-bookmarklet-col-1"><?php esc_html_e('Redirection:', 'pretty-link'); ?></label>
21
- <?php PrliLinksHelper::redirect_type_dropdown('prlipro-bookmarklet-redirect-type','',array(__('Default', 'pretty-link') => -1)); ?>
22
- </p>
23
- <p>
24
- <label for="prlipro-bookmarklet-track" class="plp-bookmarklet-col-1"><?php esc_html_e('Tracking:', 'pretty-link'); ?></label>
25
- <select id="prlipro-bookmarklet-track" name="prlipro-bookmarklet-track?>">
26
- <option value="-1"><?php esc_html_e('Default', 'pretty-link'); ?>&nbsp;</option>
27
- <option value="1"><?php esc_html_e('Yes', 'pretty-link'); ?>&nbsp;</option>
28
- <option value="0"><?php esc_html_e('No', 'pretty-link'); ?>&nbsp;</option>
29
- </select>
30
- </p>
31
- <p>
32
- <label for="prlipro-bookmarklet-category" class="plp-bookmarklet-col-1"><?php esc_html_e('Category:', 'pretty-link'); ?></label>
33
- <?php
34
- wp_dropdown_categories(array(
35
- 'id' => 'prlipro-bookmarklet-category',
36
- 'name' => 'prlipro-bookmarklet-category',
37
- 'show_option_none' => esc_html__('None', 'pretty-link'),
38
- 'taxonomy' => PlpLinkCategoriesController::$ctax,
39
- 'hide_empty' => false
40
- ));
41
- ?>
42
- </p>
43
- </form>
44
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/app/views/tools/index.php DELETED
@@ -1,2 +0,0 @@
1
- <?php /* Silence will fall */ ?>
2
-
 
 
pro/app/views/tools/nav.php DELETED
@@ -1,4 +0,0 @@
1
- <?php if(!defined('ABSPATH')) { die('You are not allowed to call this page directly.'); } ?>
2
-
3
- <li><a data-id="custom-bookmarklet"><?php esc_html_e('Custom Bookmarklet', 'pretty-link'); ?></a></li>
4
-
 
 
 
 
pro/app/widgets/PlpPublicLinksWidget.php DELETED
@@ -1,105 +0,0 @@
1
- <?php
2
- if(!defined('ABSPATH')) { die('You are not allowed to call this page directly.'); }
3
-
4
- class PlpPublicLinksWidget extends WP_Widget {
5
- protected $defaults;
6
-
7
- // widget actual processes
8
- public function __construct() {
9
- parent::__construct(
10
- false,
11
- __('Create a Short URL', 'pretty-link'),
12
- array(
13
- 'description' => __('Displays a form to create a Pretty Link.', 'pretty-link')
14
- )
15
- );
16
-
17
- $this->defaults = array(
18
- 'label' => '',
19
- 'button' => '',
20
- 'redirect_type' => '',
21
- 'track' => '',
22
- 'category' => '',
23
- 'saved_before' => ''
24
- );
25
- }
26
-
27
- // outputs the content of the widget
28
- public function widget($args, $instance) {
29
- extract( $args );
30
-
31
- $instance = wp_parse_args($instance, $this->defaults);
32
-
33
- echo $before_widget . $before_title . $after_title .
34
- PlpPublicLinksHelper::display_form(
35
- $instance['label'],
36
- $instance['button'],
37
- $instance['redirect_type'],
38
- $instance['track'],
39
- $instance['category']
40
- ) . $after_widget;
41
- }
42
-
43
- // processes widget options to be saved
44
- public function update($new_instance, $old_instance) {
45
- $instance = $old_instance;
46
- $instance['label'] = sanitize_text_field($new_instance['label']);
47
- $instance['button'] = sanitize_text_field($new_instance['button']);
48
- $instance['redirect_type'] = sanitize_text_field($new_instance['redirect_type']);
49
- $instance['track'] = is_numeric($new_instance['track']) ? (int) $new_instance['track'] : '-1';
50
- $instance['category'] = is_numeric($new_instance['category']) ? (int) $new_instance['category'] : '-1';
51
-
52
- return $instance;
53
- }
54
-
55
- // outputs the options form on admin
56
- public function form($instance) {
57
- $selected = ' selected="selected"';
58
- $instance = wp_parse_args($instance, $this->defaults);
59
-
60
- $label = $instance['saved_before'] != '1' ? __('Enter a URL:&nbsp;', 'pretty-link') : $instance['label'];
61
- $button = $instance['saved_before'] != '1' ? __('Shrink', 'pretty-link') : $instance['button'];
62
- ?>
63
- <input type="hidden" id="<?php echo esc_attr($this->get_field_id('saved_before')); ?>" name="<?php echo esc_attr($this->get_field_name('saved_before')); ?>" value="1" />
64
- <p><label for="<?php echo esc_attr($this->get_field_id('label')); ?>"><?php esc_html_e('Label Text:', 'pretty-link'); ?> <input class="widefat" id="<?php echo esc_attr($this->get_field_id('label')); ?>" name="<?php echo esc_attr($this->get_field_name('label')); ?>" type="text" value="<?php echo esc_attr($label); ?>" /></label></p>
65
- <p><label for="<?php echo esc_attr($this->get_field_id('button')); ?>"><?php esc_html_e('Button Text:', 'pretty-link'); ?> <input class="widefat" id="<?php echo esc_attr($this->get_field_id('button')); ?>" name="<?php echo esc_attr($this->get_field_name('button')); ?>" type="text" value="<?php echo esc_attr($button); ?>" /></label><br/><small>(<?php esc_html_e('if left blank, no button will display', 'pretty-link'); ?>)</small></p>
66
- <p><strong><?php esc_html_e('Pretty Link Options', 'pretty-link'); ?></strong></p>
67
- <p>
68
- <label for="<?php echo esc_attr($this->get_field_id('redirect_type')); ?>"><?php esc_html_e('Redirection:', 'pretty-link'); ?>
69
- <select id="<?php echo esc_attr($this->get_field_id('redirect_type')); ?>" name="<?php echo esc_attr($this->get_field_name('redirect_type')); ?>">
70
- <option value="-1"><?php esc_html_e('Default', 'pretty-link'); ?>&nbsp;</option>
71
- <option value="301"<?php echo (($instance['redirect_type'] == '301')?$selected:''); ?>><?php esc_html_e('Permanent/301', 'pretty-link'); ?>&nbsp;</option>
72
- <option value="302"<?php echo (($instance['redirect_type'] == '302')?$selected:''); ?>><?php esc_html_e('Temporary/302', 'pretty-link'); ?>&nbsp;</option>
73
- <option value="307"<?php echo (($instance['redirect_type'] == '307')?$selected:''); ?>><?php esc_html_e('Temporary/307', 'pretty-link'); ?>&nbsp;</option>
74
- <option value="prettybar"<?php echo (($instance['redirect_type'] == 'prettybar')?$selected:''); ?>><?php esc_html_e('PrettyBar', 'pretty-link'); ?>&nbsp;</option>
75
- <option value="cloak"<?php echo (($instance['redirect_type'] == 'cloak')?$selected:''); ?>><?php esc_html_e('Cloak', 'pretty-link'); ?>&nbsp;</option>
76
- </select>
77
- </label>
78
- </p>
79
- <p>
80
- <label for="<?php echo esc_attr($this->get_field_id('track')); ?>"><?php esc_html_e('Tracking Enabled:', 'pretty-link'); ?>
81
- <select id="<?php echo esc_attr($this->get_field_id('track')); ?>" name="<?php echo esc_attr($this->get_field_name('track')); ?>">
82
- <option value="-1"><?php esc_html_e('Default', 'pretty-link'); ?>&nbsp;</option>
83
- <option value="1"<?php echo (($instance['track'] == '1')?$selected:''); ?>><?php esc_html_e('Yes', 'pretty-link'); ?>&nbsp;</option>
84
- <option value="0"<?php echo (($instance['track'] == '0')?$selected:''); ?>><?php esc_html_e('No', 'pretty-link'); ?>&nbsp;</option>
85
- </select>
86
- </label>
87
- </p>
88
- <p>
89
- <label for="<?php echo esc_attr($this->get_field_id('category')); ?>"><?php esc_html_e('Category:', 'pretty-link'); ?>
90
- <?php
91
- wp_dropdown_categories(array(
92
- 'id' => $this->get_field_id('category'),
93
- 'name' => $this->get_field_name('category'),
94
- 'show_option_none' => esc_html__('None', 'pretty-link'),
95
- 'selected' => $instance['category'],
96
- 'taxonomy' => PlpLinkCategoriesController::$ctax,
97
- 'hide_empty' => false
98
- ));
99
- ?>
100
- </label>
101
- </p>
102
- <?php
103
- }
104
- }
105
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/app/widgets/index.php DELETED
@@ -1,2 +0,0 @@
1
- <?php /* Silence will fall */ ?>
2
-
 
 
pro/css/admin_bookmarklet.css DELETED
@@ -1,11 +0,0 @@
1
- .bookmarklet-updated {
2
- background-color: #ffffa0;
3
- }
4
-
5
- label.plp-bookmarklet-col-1 {
6
- display: inline-block !important;
7
- width: 100px !important;
8
- min-width: 100px !important;
9
- max-width: 100px !important;
10
- }
11
-
 
 
 
 
 
 
 
 
 
 
 
pro/css/admin_options.css DELETED
@@ -1,26 +0,0 @@
1
- .toggle {
2
- cursor: pointer;
3
- }
4
-
5
- #option-pane {
6
- padding-left: 15px;
7
- }
8
-
9
- td.social-button-checkbox {
10
- padding: 0px;
11
- margin: 0px;
12
- padding-right: 3px;
13
- }
14
-
15
- td.social-button-image {
16
- padding: 0px;
17
- margin: 0px;
18
- padding-right: 10px;
19
- }
20
-
21
- ul.twit-creds-list {
22
- margin-top: 0 !important;
23
- margin-bottom: 0 !important;
24
- padding-top: 0 !important;
25
- padding-bottom: 0 !important;
26
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/css/admin_post.css DELETED
@@ -1 +0,0 @@
1
- /* */
 
pro/css/admin_reports.css DELETED
@@ -1,35 +0,0 @@
1
- .advanced_toggle {
2
- line-height: 34px;
3
- font-size: 12px;
4
- font-weight: bold;
5
- padding-bottom: 10px;
6
- }
7
-
8
- .edit_report {
9
- height: 50px;
10
- }
11
-
12
- .report_name {
13
- font-size: 12px;
14
- font-weight: bold;
15
- }
16
-
17
- .report_actions {
18
- padding-top: 5px;
19
- }
20
-
21
- .filter_toggle {
22
- line-height: 34px;
23
- font-size: 16px;
24
- padding-bottom: 10px;
25
- }
26
-
27
- .filter_pane {
28
- background-color: white;
29
- border: 2px solid #777777;
30
- height: 275px;
31
- width: 600px;
32
- padding-left: 20px;
33
- padding-top: 10px;
34
- }
35
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/css/index.php DELETED
@@ -1,2 +0,0 @@
1
- <?php /* Silence will fall */ ?>
2
-
 
 
pro/css/jquery-ui-timepicker-addon.css DELETED
@@ -1,30 +0,0 @@
1
- .ui-timepicker-div .ui-widget-header { margin-bottom: 8px; }
2
- .ui-timepicker-div dl { text-align: left; }
3
- .ui-timepicker-div dl dt { float: left; clear:left; padding: 0 0 0 5px; }
4
- .ui-timepicker-div dl dd { margin: 0 10px 10px 40%; }
5
- .ui-timepicker-div td { font-size: 90%; }
6
- .ui-tpicker-grid-label { background: none; border: none; margin: 0; padding: 0; }
7
- .ui-timepicker-div .ui_tpicker_unit_hide{ display: none; }
8
-
9
- .ui-timepicker-div .ui_tpicker_time .ui_tpicker_time_input { background: none; color: inherit; border: none; outline: none; border-bottom: solid 1px #555; width: 95%; }
10
- .ui-timepicker-div .ui_tpicker_time .ui_tpicker_time_input:focus { border-bottom-color: #aaa; }
11
-
12
- .ui-timepicker-rtl{ direction: rtl; }
13
- .ui-timepicker-rtl dl { text-align: right; padding: 0 5px 0 0; }
14
- .ui-timepicker-rtl dl dt{ float: right; clear: right; }
15
- .ui-timepicker-rtl dl dd { margin: 0 40% 10px 10px; }
16
-
17
- /* Shortened version style */
18
- .ui-timepicker-div.ui-timepicker-oneLine { padding-right: 2px; }
19
- .ui-timepicker-div.ui-timepicker-oneLine .ui_tpicker_time,
20
- .ui-timepicker-div.ui-timepicker-oneLine dt { display: none; }
21
- .ui-timepicker-div.ui-timepicker-oneLine .ui_tpicker_time_label { display: block; padding-top: 2px; }
22
- .ui-timepicker-div.ui-timepicker-oneLine dl { text-align: right; }
23
- .ui-timepicker-div.ui-timepicker-oneLine dl dd,
24
- .ui-timepicker-div.ui-timepicker-oneLine dl dd > div { display:inline-block; margin:0; }
25
- .ui-timepicker-div.ui-timepicker-oneLine dl dd.ui_tpicker_minute:before,
26
- .ui-timepicker-div.ui-timepicker-oneLine dl dd.ui_tpicker_second:before { content:':'; display:inline-block; }
27
- .ui-timepicker-div.ui-timepicker-oneLine dl dd.ui_tpicker_millisec:before,
28
- .ui-timepicker-div.ui-timepicker-oneLine dl dd.ui_tpicker_microsec:before { content:'.'; display:inline-block; }
29
- .ui-timepicker-div.ui-timepicker-oneLine .ui_tpicker_unit_hide,
30
- .ui-timepicker-div.ui-timepicker-oneLine .ui_tpicker_unit_hide:before{ display: none; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/css/prettybar.css DELETED
@@ -1,96 +0,0 @@
1
- html, body {
2
- margin: 0;
3
- padding: 0;
4
- }
5
-
6
- #prettybar {
7
- position: fixed;
8
- top: 0;
9
- padding: 0;
10
- margin: 0;
11
- width: 100%;
12
- height: 65px;
13
- border-bottom: 2px solid black;
14
- }
15
-
16
- .baritems {
17
- margin-top: 0;
18
- padding: 0;
19
- }
20
-
21
- .blog-title {
22
- padding-top: 5px;
23
- margin: 0;
24
- width: 200px;
25
- }
26
-
27
- h1,h2,h3,h4,p {
28
- font-family: Arial, sans-serif;
29
- padding: 0;
30
- margin: 0;
31
- }
32
-
33
- a {
34
- text-decoration: none;
35
- }
36
-
37
- .map {
38
- background-image: url(../../images/bar_map.png);
39
- background-repeat: no-repeat;
40
- }
41
-
42
- .closebutton {
43
- height: 20px;
44
- width: 20px;
45
- overflow: hidden;
46
- cursor: pointer;
47
- text-align: right;
48
- float: right;
49
- }
50
-
51
- .pb-cell {
52
- white-space: nowrap;
53
- overflow: hidden;
54
- }
55
-
56
- .right_container {
57
- float: right;
58
- margin-top: 8px;
59
- margin-right: 8px;
60
- text-align: right;
61
- }
62
-
63
- .closebutton:hover {
64
- background-position: -200px -30px;
65
- }
66
-
67
- .closebutton:active {
68
- background-position: -200px -60px;
69
- }
70
-
71
- ul.baritems li {
72
- display: inline;
73
- }
74
-
75
- .retweet {
76
- padding-top: 5px;
77
- padding-left: 15px;
78
- line-height: 26px;
79
- width: 200px;
80
- }
81
-
82
- .blog-image {
83
- padding-top: 7px;
84
- padding-left: 5px;
85
- padding-right: 5px;
86
- width: 50px;
87
- }
88
-
89
- .small-text {
90
- font-size: 10px;
91
- }
92
-
93
- .powered-by {
94
- padding-top: 15px;
95
- text-align: right;
96
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/css/prlipro-post.css DELETED
@@ -1,5 +0,0 @@
1
- .prli-social-buttons-bar { padding: 10px 0 10px 0; }
2
- .prli-social-buttons-bar a { border: 0px; width: 32px; height: 32px; }
3
- .prli-first-tweet { border-top: 1px dashed #999999; }
4
- .prli-tweet { padding: 8px 5px 8px 5px; margin: 0 10px 0 10px; font-size: 12px; line-height: 18px; font-family: Arial; border-bottom: 1px dashed #999999; }
5
- .prli-tweet-image { padding-right: 10px; }
 
 
 
 
 
pro/i18n/countries.php DELETED
@@ -1,249 +0,0 @@
1
- <?php
2
- if(!defined('ABSPATH')) {die('You are not allowed to call this page directly.');}
3
-
4
- return array(
5
- 'AF' => __( 'Afghanistan', 'pretty-link' ),
6
- 'AX' => __( '&#197;land Islands', 'pretty-link' ),
7
- 'AL' => __( 'Albania', 'pretty-link' ),
8
- 'DZ' => __( 'Algeria', 'pretty-link' ),
9
- 'AD' => __( 'Andorra', 'pretty-link' ),
10
- 'AO' => __( 'Angola', 'pretty-link' ),
11
- 'AI' => __( 'Anguilla', 'pretty-link' ),
12
- 'AQ' => __( 'Antarctica', 'pretty-link' ),
13
- 'AG' => __( 'Antigua and Barbuda', 'pretty-link' ),
14
- 'AR' => __( 'Argentina', 'pretty-link' ),
15
- 'AM' => __( 'Armenia', 'pretty-link' ),
16
- 'AW' => __( 'Aruba', 'pretty-link' ),
17
- 'AU' => __( 'Australia', 'pretty-link' ),
18
- 'AT' => __( 'Austria', 'pretty-link' ),
19
- 'AZ' => __( 'Azerbaijan', 'pretty-link' ),
20
- 'BS' => __( 'Bahamas', 'pretty-link' ),
21
- 'BH' => __( 'Bahrain', 'pretty-link' ),
22
- 'BD' => __( 'Bangladesh', 'pretty-link' ),
23
- 'BB' => __( 'Barbados', 'pretty-link' ),
24
- 'BY' => __( 'Belarus', 'pretty-link' ),
25
- 'BE' => __( 'Belgium', 'pretty-link' ),
26
- 'PW' => __( 'Belau', 'pretty-link' ),
27
- 'BZ' => __( 'Belize', 'pretty-link' ),
28
- 'BJ' => __( 'Benin', 'pretty-link' ),
29
- 'BM' => __( 'Bermuda', 'pretty-link' ),
30
- 'BT' => __( 'Bhutan', 'pretty-link' ),
31
- 'BO' => __( 'Bolivia', 'pretty-link' ),
32
- 'BQ' => __( 'Bonaire, Saint Eustatius and Saba', 'pretty-link' ),
33
- 'BA' => __( 'Bosnia and Herzegovina', 'pretty-link' ),
34
- 'BW' => __( 'Botswana', 'pretty-link' ),
35
- 'BV' => __( 'Bouvet Island', 'pretty-link' ),
36
- 'BR' => __( 'Brazil', 'pretty-link' ),
37
- 'IO' => __( 'British Indian Ocean Territory', 'pretty-link' ),
38
- 'VG' => __( 'British Virgin Islands', 'pretty-link' ),
39
- 'BN' => __( 'Brunei', 'pretty-link' ),
40
- 'BG' => __( 'Bulgaria', 'pretty-link' ),
41
- 'BF' => __( 'Burkina Faso', 'pretty-link' ),
42
- 'BI' => __( 'Burundi', 'pretty-link' ),
43
- 'KH' => __( 'Cambodia', 'pretty-link' ),
44
- 'CM' => __( 'Cameroon', 'pretty-link' ),
45
- 'CA' => __( 'Canada', 'pretty-link' ),
46
- 'CV' => __( 'Cape Verde', 'pretty-link' ),
47
- 'KY' => __( 'Cayman Islands', 'pretty-link' ),
48
- 'CF' => __( 'Central African Republic', 'pretty-link' ),
49
- 'TD' => __( 'Chad', 'pretty-link' ),
50
- 'CL' => __( 'Chile', 'pretty-link' ),
51
- 'CN' => __( 'China', 'pretty-link' ),
52
- 'CX' => __( 'Christmas Island', 'pretty-link' ),
53
- 'CC' => __( 'Cocos/Keeling Islands', 'pretty-link' ),
54
- 'CO' => __( 'Colombia', 'pretty-link' ),
55
- 'KM' => __( 'Comoros', 'pretty-link' ),
56
- 'CG' => __( 'Congo (Brazzaville)', 'pretty-link' ),
57
- 'CD' => __( 'Congo (Kinshasa)', 'pretty-link' ),
58
- 'CK' => __( 'Cook Islands', 'pretty-link' ),
59
- 'CR' => __( 'Costa Rica', 'pretty-link' ),
60
- 'HR' => __( 'Croatia', 'pretty-link' ),
61
- 'CU' => __( 'Cuba', 'pretty-link' ),
62
- 'CW' => __( 'Cura&Ccedil;ao', 'pretty-link' ),
63
- 'CY' => __( 'Cyprus', 'pretty-link' ),
64
- 'CZ' => __( 'Czech Republic', 'pretty-link' ),
65
- 'DK' => __( 'Denmark', 'pretty-link' ),
66
- 'DJ' => __( 'Djibouti', 'pretty-link' ),
67
- 'DM' => __( 'Dominica', 'pretty-link' ),
68
- 'DO' => __( 'Dominican Republic', 'pretty-link' ),
69
- 'EC' => __( 'Ecuador', 'pretty-link' ),
70
- 'EG' => __( 'Egypt', 'pretty-link' ),
71
- 'SV' => __( 'El Salvador', 'pretty-link' ),
72
- 'GQ' => __( 'Equatorial Guinea', 'pretty-link' ),
73
- 'ER' => __( 'Eritrea', 'pretty-link' ),
74
- 'EE' => __( 'Estonia', 'pretty-link' ),
75
- 'ET' => __( 'Ethiopia', 'pretty-link' ),
76
- 'FK' => __( 'Falkland Islands', 'pretty-link' ),
77
- 'FO' => __( 'Faroe Islands', 'pretty-link' ),
78
- 'FJ' => __( 'Fiji', 'pretty-link' ),
79
- 'FI' => __( 'Finland', 'pretty-link' ),
80
- 'FR' => __( 'France', 'pretty-link' ),
81
- 'GF' => __( 'French Guiana', 'pretty-link' ),
82
- 'PF' => __( 'French Polynesia', 'pretty-link' ),
83
- 'TF' => __( 'French Southern Territories', 'pretty-link' ),
84
- 'GA' => __( 'Gabon', 'pretty-link' ),
85
- 'GM' => __( 'Gambia', 'pretty-link' ),
86
- 'GE' => __( 'Georgia', 'pretty-link' ),
87
- 'DE' => __( 'Germany', 'pretty-link' ),
88
- 'GH' => __( 'Ghana', 'pretty-link' ),
89
- 'GI' => __( 'Gibraltar', 'pretty-link' ),
90
- 'GR' => __( 'Greece', 'pretty-link' ),
91
- 'GL' => __( 'Greenland', 'pretty-link' ),
92
- 'GD' => __( 'Grenada', 'pretty-link' ),
93
- 'GP' => __( 'Guadeloupe', 'pretty-link' ),
94
- 'GT' => __( 'Guatemala', 'pretty-link' ),
95
- 'GG' => __( 'Guernsey', 'pretty-link' ),
96
- 'GN' => __( 'Guinea', 'pretty-link' ),
97
- 'GW' => __( 'Guinea-Bissau', 'pretty-link' ),
98
- 'GY' => __( 'Guyana', 'pretty-link' ),
99
- 'HT' => __( 'Haiti', 'pretty-link' ),
100
- 'HM' => __( 'Heard Island and McDonald Islands', 'pretty-link' ),
101
- 'HN' => __( 'Honduras', 'pretty-link' ),
102
- 'HK' => __( 'Hong Kong', 'pretty-link' ),
103
- 'HU' => __( 'Hungary', 'pretty-link' ),
104
- 'IS' => __( 'Iceland', 'pretty-link' ),
105
- 'IN' => __( 'India', 'pretty-link' ),
106
- 'ID' => __( 'Indonesia', 'pretty-link' ),
107
- 'IR' => __( 'Iran', 'pretty-link' ),
108
- 'IQ' => __( 'Iraq', 'pretty-link' ),
109
- 'IE' => __( 'Republic of Ireland', 'pretty-link' ),
110
- 'IM' => __( 'Isle of Man', 'pretty-link' ),
111
- 'IL' => __( 'Israel', 'pretty-link' ),
112
- 'IT' => __( 'Italy', 'pretty-link' ),
113
- 'CI' => __( 'Ivory Coast', 'pretty-link' ),
114
- 'JM' => __( 'Jamaica', 'pretty-link' ),
115
- 'JP' => __( 'Japan', 'pretty-link' ),
116
- 'JE' => __( 'Jersey', 'pretty-link' ),
117
- 'JO' => __( 'Jordan', 'pretty-link' ),
118
- 'KZ' => __( 'Kazakhstan', 'pretty-link' ),
119
- 'KE' => __( 'Kenya', 'pretty-link' ),
120
- 'KI' => __( 'Kiribati', 'pretty-link' ),
121
- 'KW' => __( 'Kuwait', 'pretty-link' ),
122
- 'KG' => __( 'Kyrgyzstan', 'pretty-link' ),
123
- 'LA' => __( 'Laos', 'pretty-link' ),
124
- 'LV' => __( 'Latvia', 'pretty-link' ),
125
- 'LB' => __( 'Lebanon', 'pretty-link' ),
126
- 'LS' => __( 'Lesotho', 'pretty-link' ),
127
- 'LR' => __( 'Liberia', 'pretty-link' ),
128
- 'LY' => __( 'Libya', 'pretty-link' ),
129
- 'LI' => __( 'Liechtenstein', 'pretty-link' ),
130
- 'LT' => __( 'Lithuania', 'pretty-link' ),
131
- 'LU' => __( 'Luxembourg', 'pretty-link' ),
132
- 'MO' => __( 'Macao S.A.R., China', 'pretty-link' ),
133
- 'MK' => __( 'Macedonia', 'pretty-link' ),
134
- 'MG' => __( 'Madagascar', 'pretty-link' ),
135
- 'MW' => __( 'Malawi', 'pretty-link' ),
136
- 'MY' => __( 'Malaysia', 'pretty-link' ),
137
- 'MV' => __( 'Maldives', 'pretty-link' ),
138
- 'ML' => __( 'Mali', 'pretty-link' ),
139
- 'MT' => __( 'Malta', 'pretty-link' ),
140
- 'MH' => __( 'Marshall Islands', 'pretty-link' ),
141
- 'MQ' => __( 'Martinique', 'pretty-link' ),
142
- 'MR' => __( 'Mauritania', 'pretty-link' ),
143
- 'MU' => __( 'Mauritius', 'pretty-link' ),
144
- 'YT' => __( 'Mayotte', 'pretty-link' ),
145
- 'MX' => __( 'Mexico', 'pretty-link' ),
146
- 'FM' => __( 'Micronesia', 'pretty-link' ),
147
- 'MD' => __( 'Moldova', 'pretty-link' ),
148
- 'MC' => __( 'Monaco', 'pretty-link' ),
149
- 'MN' => __( 'Mongolia', 'pretty-link' ),
150
- 'ME' => __( 'Montenegro', 'pretty-link' ),
151
- 'MS' => __( 'Montserrat', 'pretty-link' ),
152
- 'MA' => __( 'Morocco', 'pretty-link' ),
153
- 'MZ' => __( 'Mozambique', 'pretty-link' ),
154
- 'MM' => __( 'Myanmar', 'pretty-link' ),
155
- 'NA' => __( 'Namibia', 'pretty-link' ),
156
- 'NR' => __( 'Nauru', 'pretty-link' ),
157
- 'NP' => __( 'Nepal', 'pretty-link' ),
158
- 'NL' => __( 'Netherlands', 'pretty-link' ),
159
- 'AN' => __( 'Netherlands Antilles', 'pretty-link' ),
160
- 'NC' => __( 'New Caledonia', 'pretty-link' ),
161
- 'NZ' => __( 'New Zealand', 'pretty-link' ),
162
- 'NI' => __( 'Nicaragua', 'pretty-link' ),
163
- 'NE' => __( 'Niger', 'pretty-link' ),
164
- 'NG' => __( 'Nigeria', 'pretty-link' ),
165
- 'NU' => __( 'Niue', 'pretty-link' ),
166
- 'NF' => __( 'Norfolk Island', 'pretty-link' ),
167
- 'KP' => __( 'North Korea', 'pretty-link' ),
168
- 'NO' => __( 'Norway', 'pretty-link' ),
169
- 'OM' => __( 'Oman', 'pretty-link' ),
170
- 'PK' => __( 'Pakistan', 'pretty-link' ),
171
- 'PS' => __( 'Palestinian Territory', 'pretty-link' ),
172
- 'PA' => __( 'Panama', 'pretty-link' ),
173
- 'PG' => __( 'Papua New Guinea', 'pretty-link' ),
174
- 'PY' => __( 'Paraguay', 'pretty-link' ),
175
- 'PE' => __( 'Peru', 'pretty-link' ),
176
- 'PH' => __( 'Philippines', 'pretty-link' ),
177
- 'PN' => __( 'Pitcairn', 'pretty-link' ),
178
- 'PL' => __( 'Poland', 'pretty-link' ),
179
- 'PT' => __( 'Portugal', 'pretty-link' ),
180
- 'QA' => __( 'Qatar', 'pretty-link' ),
181
- 'RE' => __( 'Reunion', 'pretty-link' ),
182
- 'RO' => __( 'Romania', 'pretty-link' ),
183
- 'RU' => __( 'Russia', 'pretty-link' ),
184
- 'RW' => __( 'Rwanda', 'pretty-link' ),
185
- 'BL' => __( 'Saint Barth&eacute;lemy', 'pretty-link' ),
186
- 'SH' => __( 'Saint Helena', 'pretty-link' ),
187
- 'KN' => __( 'Saint Kitts and Nevis', 'pretty-link' ),
188
- 'LC' => __( 'Saint Lucia', 'pretty-link' ),
189
- 'MF' => __( 'Saint Martin (French part)', 'pretty-link' ),
190
- 'SX' => __( 'Saint Martin (Dutch part)', 'pretty-link' ),
191
- 'PM' => __( 'Saint Pierre and Miquelon', 'pretty-link' ),
192
- 'VC' => __( 'Saint Vincent and the Grenadines', 'pretty-link' ),
193
- 'SM' => __( 'San Marino', 'pretty-link' ),
194
- 'ST' => __( 'S&atilde;o Tom&eacute; and Pr&iacute;ncipe', 'pretty-link' ),
195
- 'SA' => __( 'Saudi Arabia', 'pretty-link' ),
196
- 'SN' => __( 'Senegal', 'pretty-link' ),
197
- 'RS' => __( 'Serbia', 'pretty-link' ),
198
- 'SC' => __( 'Seychelles', 'pretty-link' ),
199
- 'SL' => __( 'Sierra Leone', 'pretty-link' ),
200
- 'SG' => __( 'Singapore', 'pretty-link' ),
201
- 'SK' => __( 'Slovakia', 'pretty-link' ),
202
- 'SI' => __( 'Slovenia', 'pretty-link' ),
203
- 'SB' => __( 'Solomon Islands', 'pretty-link' ),
204
- 'SO' => __( 'Somalia', 'pretty-link' ),
205
- 'ZA' => __( 'South Africa', 'pretty-link' ),
206
- 'GS' => __( 'South Georgia/Sandwich Islands', 'pretty-link' ),
207
- 'KR' => __( 'South Korea', 'pretty-link' ),
208
- 'SS' => __( 'South Sudan', 'pretty-link' ),
209
- 'ES' => __( 'Spain', 'pretty-link' ),
210
- 'LK' => __( 'Sri Lanka', 'pretty-link' ),
211
- 'SD' => __( 'Sudan', 'pretty-link' ),
212
- 'SR' => __( 'Suriname', 'pretty-link' ),
213
- 'SJ' => __( 'Svalbard and Jan Mayen', 'pretty-link' ),
214
- 'SZ' => __( 'Swaziland', 'pretty-link' ),
215
- 'SE' => __( 'Sweden', 'pretty-link' ),
216
- 'CH' => __( 'Switzerland', 'pretty-link' ),
217
- 'SY' => __( 'Syria', 'pretty-link' ),
218
- 'TW' => __( 'Taiwan', 'pretty-link' ),
219
- 'TJ' => __( 'Tajikistan', 'pretty-link' ),
220
- 'TZ' => __( 'Tanzania', 'pretty-link' ),
221
- 'TH' => __( 'Thailand', 'pretty-link' ),
222
- 'TL' => __( 'Timor-Leste', 'pretty-link' ),
223
- 'TG' => __( 'Togo', 'pretty-link' ),
224
- 'TK' => __( 'Tokelau', 'pretty-link' ),
225
- 'TO' => __( 'Tonga', 'pretty-link' ),
226
- 'TT' => __( 'Trinidad and Tobago', 'pretty-link' ),
227
- 'TN' => __( 'Tunisia', 'pretty-link' ),
228
- 'TR' => __( 'Turkey', 'pretty-link' ),
229
- 'TM' => __( 'Turkmenistan', 'pretty-link' ),
230
- 'TC' => __( 'Turks and Caicos Islands', 'pretty-link' ),
231
- 'TV' => __( 'Tuvalu', 'pretty-link' ),
232
- 'UG' => __( 'Uganda', 'pretty-link' ),
233
- 'UA' => __( 'Ukraine', 'pretty-link' ),
234
- 'AE' => __( 'United Arab Emirates', 'pretty-link' ),
235
- 'GB' => __( 'United Kingdom (UK)', 'pretty-link' ),
236
- 'US' => __( 'United States', 'pretty-link' ),
237
- 'UY' => __( 'Uruguay', 'pretty-link' ),
238
- 'UZ' => __( 'Uzbekistan', 'pretty-link' ),
239
- 'VU' => __( 'Vanuatu', 'pretty-link' ),
240
- 'VA' => __( 'Vatican', 'pretty-link' ),
241
- 'VE' => __( 'Venezuela', 'pretty-link' ),
242
- 'VN' => __( 'Vietnam', 'pretty-link' ),
243
- 'WF' => __( 'Wallis and Futuna', 'pretty-link' ),
244
- 'EH' => __( 'Western Sahara', 'pretty-link' ),
245
- 'WS' => __( 'Western Samoa', 'pretty-link' ),
246
- 'YE' => __( 'Yemen', 'pretty-link' ),
247
- 'ZM' => __( 'Zambia', 'pretty-link' ),
248
- 'ZW' => __( 'Zimbabwe', 'pretty-link' )
249
- );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/images/dark_add_twitter_account.png DELETED
Binary file
pro/images/download_qr_code_icon.gif DELETED
Binary file
pro/images/index.php DELETED
@@ -1,2 +0,0 @@
1
- <?php /* Silence will fall */ ?>
2
-
 
 
pro/index.php DELETED
@@ -1,2 +0,0 @@
1
- <?php /* Silence will fall */ ?>
2
-
 
 
pro/js/admin_bookmarklet.js DELETED
@@ -1,14 +0,0 @@
1
- jQuery(document).ready(function($) {
2
- $('#prlipro-custom-bookmarklet-form').change(function() {
3
- var redirect_type = $('#prlipro-bookmarklet-redirect-type').val();
4
- var track = $('#prlipro-bookmarklet-track').val();
5
- var category = $('#prlipro-bookmarklet-category').val();
6
- var label = $('#prlipro-bookmarklet-label').val();
7
-
8
- var link = '<span class="bookmarklet-updated"><a class="button button-primary" href="javascript:location.href=\'' + PlpBookmarklet.url + '&rt=' + redirect_type + '&trk=' + track + '&ct=' + category + '&target_url=\'+escape(location.href);">' + label + '</a></span>';
9
- $('#prlipro-custom-bookmarklet-link').html(link);
10
- $('#prlipro-custom-bookmarklet-link').hide();
11
- $('#prlipro-custom-bookmarklet-link').fadeIn('slow');
12
- });
13
- });
14
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/js/admin_draw_report.js DELETED
@@ -1,25 +0,0 @@
1
- jQuery(document).ready( function($) {
2
- $('#sdate').datepicker({ dateFormat: 'yy-mm-dd', defaultDate: -30, minDate: PlpReport.min_date, maxDate: 0 });
3
- $('#edate').datepicker({ dateFormat: 'yy-mm-dd', minDate: PlpReport.min_date, maxDate: 0 });
4
- $('.filter_pane').hide();
5
- $('.filter_toggle').click( function () {
6
- $('.filter_pane').slideToggle('slow');
7
- });
8
- });
9
-
10
- google.charts.load('current', { packages: ['corechart'] });
11
- google.charts.setOnLoadCallback(drawPlpReport);
12
-
13
- function drawPlpReport() {
14
- //Rotations Chart
15
- var rotationsChartJsonData = PlpReport.data;
16
- var rotationsChartData = new google.visualization.DataTable(rotationsChartJsonData);
17
- var rotationsChart = new google.visualization.ColumnChart(document.getElementById('clicks_chart'));
18
-
19
- var options = {
20
- title: PlpReport.title,
21
- height: 300
22
- };
23
-
24
- rotationsChart.draw(rotationsChartData, options);
25
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/js/admin_links.js DELETED
@@ -1,110 +0,0 @@
1
- jQuery(document).ready(function($) {
2
-
3
- var prli_geo_countries_dropdown = function() {
4
- $('.prli_geo_countries').suggest(
5
- ajaxurl+'?action=prli_search_countries',
6
- {
7
- delay: 500,
8
- minchars: 2,
9
- multiple: true
10
- }
11
- );
12
- }
13
-
14
- $('.prli_geo_row_add').on('click', function(e) {
15
- e.preventDefault();
16
- $('.prli_geo_rows').append(PlpLink.geo_row_html.replace(/{{geo_url}}/m, '').replace(/{{geo_countries}}/m, ''));
17
- prli_geo_countries_dropdown();
18
- });
19
-
20
- $('.prli_geo_rows').on('click', '.prli_geo_row_remove', function(e) {
21
- e.preventDefault();
22
- $(this).parent().parent().remove();
23
- });
24
-
25
- $.each(PlpLink.geo_url, function(i, v) {
26
- $('.prli_geo_rows').append(PlpLink.geo_row_html.replace(/{{geo_url}}/m, v).replace(/{{geo_countries}}/m, PlpLink.geo_countries[i]));
27
- prli_geo_countries_dropdown();
28
- });
29
-
30
- // Basic URL validation
31
- $('.prli_geo_rows').on('blur', '.prli_geo_url', function(e) {
32
- if($(this).val().match(/https?:\/\/[\w-]+(\.[\w-]{2,})*(:\d{1,5})?/)) {
33
- $(this).removeClass('prli_invalid');
34
- }
35
- else {
36
- $(this).addClass('prli_invalid');
37
- }
38
- });
39
-
40
- // Basic Countries validation
41
- $('.prli_geo_rows').on('blur', '.prli_geo_countries', function(e) {
42
- if($(this).val().match(/^([^,\[\]]+\[[a-zA-Z]+\])(,[^,\[\]]+\[[a-zA-Z]+\])+,? ?$/)) {
43
- $(this).removeClass('prli_invalid');
44
- }
45
- else {
46
- $(this).addClass('prli_invalid');
47
- }
48
- });
49
-
50
- // Technology redirects
51
- $('.prli_tech_row_add').on('click', function(e) {
52
- e.preventDefault();
53
- $('.prli_tech_rows').append(PlpLink.tech_row_html.replace(/{{tech_url}}/m, ''));
54
- });
55
-
56
- $('.prli_tech_rows').on('click', '.prli_tech_row_remove', function(e) {
57
- e.preventDefault();
58
- $(this).parent().parent().remove();
59
- });
60
-
61
- $.each(PlpLink.tech_url, function(i, v) {
62
- $('.prli_tech_rows').append(PlpLink.tech_row_html.replace(/{{tech_url}}/m, v));
63
- });
64
-
65
- $.each($('.prli_tech_rows .prli-tech-row'), function(i, r) {
66
- $(r).find('.prli_tech_device').val(PlpLink.tech_device[i]);
67
- $(r).find('.prli_tech_os').val(PlpLink.tech_os[i]);
68
- $(r).find('.prli_tech_browser').val(PlpLink.tech_browser[i]);
69
- });
70
-
71
- // Basic URL validation
72
- $('.prli_tech_rows').on('blur', '.prli_tech_url', function(e) {
73
- if($(this).val().match(/https?:\/\/[\w-]+(\.[\w-]{2,})*(:\d{1,5})?/)) {
74
- $(this).removeClass('prli_invalid');
75
- }
76
- else {
77
- $(this).addClass('prli_invalid');
78
- }
79
- });
80
-
81
- // Time Period redirects
82
- $('.prli_time_row_add').on('click', function(e) {
83
- e.preventDefault();
84
- $('.prli_time_rows').append(PlpLink.time_row_html.replace(/{{time_url}}/m, '').replace(/{{time_start}}/m, '').replace(/{{time_end}}/m, ''));
85
- plp_load_datepicker();
86
- });
87
-
88
- $('.prli_time_rows').on('click', '.prli_time_row_remove', function(e) {
89
- e.preventDefault();
90
- $(this).parent().parent().remove();
91
- });
92
-
93
- $.each(PlpLink.time_url, function(i, v) {
94
- $('.prli_time_rows').append(PlpLink.time_row_html.replace(/{{time_url}}/m, v).replace(/{{time_start}}/m, PlpLink.time_start[i]).replace(/{{time_end}}/m, PlpLink.time_end[i]));
95
- });
96
-
97
- plp_load_datepicker();
98
-
99
- // Basic URL validation
100
- $('.prli_time_rows').on('blur', '.prli_time_url', function(e) {
101
- if($(this).val().match(/https?:\/\/[\w-]+(\.[\w-]{2,})*(:\d{1,5})?/)) {
102
- $(this).removeClass('prli_invalid');
103
- }
104
- else {
105
- $(this).addClass('prli_invalid');
106
- }
107
- });
108
-
109
- });
110
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/js/admin_options.js DELETED
@@ -1,7 +0,0 @@
1
- jQuery(document).ready(function($) {
2
- $('.plp-colorpicker').spectrum({
3
- showInput: true,
4
- preferredFormat: "hex"
5
- });
6
- });
7
-
 
 
 
 
 
 
 
pro/js/admin_post.js DELETED
@@ -1,24 +0,0 @@
1
- jQuery(document).ready(function($) {
2
- $('.tweet-toggle-pane').hide();
3
-
4
- $('.tweet-toggle-button').click(function() {
5
- $('.tweet-toggle-pane').toggle();
6
- });
7
-
8
- $('.tweet-button').click(function() {
9
- $.ajax( {
10
- type: "POST",
11
- url: ajaxurl,
12
- data: {
13
- 'action': 'plp-auto-tweet',
14
- 'post': PlpPost.post_id,
15
- 'message': document.getElementById('tweet-message').value
16
- },
17
- success: function(msg) {
18
- $('.tweet-response').replaceWith('Tweet Successful:');
19
- $('.tweet-status').replaceWith('Has already been tweeted');
20
- $('.tweet-message-display').replaceWith('<blockquote>'+msg+'</blockquote>');
21
- }
22
- });
23
- });
24
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/js/admin_reports.js DELETED
@@ -1,12 +0,0 @@
1
- jQuery(document).ready(function($) {
2
- $('.report_actions').hide();
3
- $('.edit_report').hover(
4
- function() {
5
- $(this).children('.report_actions').show();
6
- },
7
- function() {
8
- $(this).children('.report_actions').hide();
9
- }
10
- );
11
- });
12
-
 
 
 
 
 
 
 
 
 
 
 
 
pro/js/date_picker.js DELETED
@@ -1,57 +0,0 @@
1
- var plp_load_datepicker = function() {
2
- //I guess these can be tweaked as time goes, but for now these seem like reasonable targets
3
- var currentYear = new Date().getFullYear();
4
- var pastYears = currentYear - 100;
5
- var futureYears = currentYear + 50;
6
-
7
- var timeFormat = 'HH:mm:00Z';
8
- var showTime = true;
9
- var showHours = true;
10
- var showMinutes = true;
11
- var showSeconds = false;
12
- var showMillisec = false;
13
- var showMicrosec = false;
14
- var showTimezone = true;
15
-
16
- //Front End needs to display cleaner
17
- if(typeof PrliDatePicker != "undefined") {
18
- timeFormat = PrliDatePicker.timeFormat;
19
- showTime = Boolean(PrliDatePicker.showTime);
20
- showHours = Boolean(PrliDatePicker.showHours);
21
- showMinutes = Boolean(PrliDatePicker.showMinutes);
22
- showSeconds = Boolean(PrliDatePicker.showSeconds);
23
- showMillisec = Boolean(PrliDatePicker.showMillisec);
24
- showMicrosec = Boolean(PrliDatePicker.showMicrosec);
25
- showTimezone = Boolean(PrliDatePicker.showTimezone);
26
- }
27
-
28
- jQuery('.prli-date-picker').datetimepicker( {
29
- dateFormat : 'yy-mm-dd',
30
- timeFormat: timeFormat,
31
- yearRange : pastYears + ":" + futureYears,
32
- changeMonth : true,
33
- changeYear : true,
34
- showTime : showTime,
35
- showHours : showHours,
36
- showMinutes : showMinutes,
37
- showSeconds : showSeconds,
38
- showMillisec : showMillisec,
39
- showMicrosec : showMicrosec,
40
- showTimezone : showTimezone,
41
- onSelect : function (date, inst) {
42
- jQuery(this).trigger('prli-date-picker-selected', [date, inst]);
43
- },
44
- onChangeMonthYear : function (month, year, inst) {
45
- jQuery(this).trigger('prli-date-picker-changed', [month, year, inst]);
46
- },
47
- onClose : function (date, inst) {
48
- jQuery(this).val(date.trim()); //Trim off white-space if any
49
- jQuery(this).trigger('prli-date-picker-closed', [date, inst]);
50
- }
51
- });
52
- };
53
-
54
- jQuery(document).ready(function($) {
55
- plp_load_datepicker();
56
- });
57
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/js/index.php DELETED
@@ -1,2 +0,0 @@
1
- <?php /* Silence will fall */ ?>
2
-
 
 
pro/js/javascript-redirect.js DELETED
@@ -1,3 +0,0 @@
1
- setTimeout(function () {
2
- window.location = plpJsRedirectL10n.url;
3
- }, plpJsRedirectL10n.delay);
 
 
 
pro/js/jquery-ui-timepicker-addon.js DELETED
@@ -1,2291 +0,0 @@
1
- /*! jQuery Timepicker Addon - v1.6.3 - 2016-04-20
2
- * http://trentrichardson.com/examples/timepicker
3
- * Copyright (c) 2016 Trent Richardson; Licensed MIT */
4
- (function (factory) {
5
- if (typeof define === 'function' && define.amd) {
6
- define(['jquery', 'jquery-ui'], factory);
7
- } else {
8
- factory(jQuery);
9
- }
10
- }(function ($) {
11
-
12
- /*
13
- * Lets not redefine timepicker, Prevent "Uncaught RangeError: Maximum call stack size exceeded"
14
- */
15
- $.ui.timepicker = $.ui.timepicker || {};
16
- if ($.ui.timepicker.version) {
17
- return;
18
- }
19
-
20
- /*
21
- * Extend jQueryUI, get it started with our version number
22
- */
23
- $.extend($.ui, {
24
- timepicker: {
25
- version: "1.6.3"
26
- }
27
- });
28
-
29
- /*
30
- * Timepicker manager.
31
- * Use the singleton instance of this class, $.timepicker, to interact with the time picker.
32
- * Settings for (groups of) time pickers are maintained in an instance object,
33
- * allowing multiple different settings on the same page.
34
- */
35
- var Timepicker = function () {
36
- this.regional = []; // Available regional settings, indexed by language code
37
- this.regional[''] = { // Default regional settings
38
- currentText: 'Now',
39
- closeText: 'Done',
40
- amNames: ['AM', 'A'],
41
- pmNames: ['PM', 'P'],
42
- timeFormat: 'HH:mm',
43
- timeSuffix: '',
44
- timeOnlyTitle: 'Choose Time',
45
- timeText: 'Time',
46
- hourText: 'Hour',
47
- minuteText: 'Minute',
48
- secondText: 'Second',
49
- millisecText: 'Millisecond',
50
- microsecText: 'Microsecond',
51
- timezoneText: 'Time Zone',
52
- isRTL: false
53
- };
54
- this._defaults = { // Global defaults for all the datetime picker instances
55
- showButtonPanel: true,
56
- timeOnly: false,
57
- timeOnlyShowDate: false,
58
- showHour: null,
59
- showMinute: null,
60
- showSecond: null,
61
- showMillisec: null,
62
- showMicrosec: null,
63
- showTimezone: null,
64
- showTime: true,
65
- stepHour: 1,
66
- stepMinute: 1,
67
- stepSecond: 1,
68
- stepMillisec: 1,
69
- stepMicrosec: 1,
70
- hour: 0,
71
- minute: 0,
72
- second: 0,
73
- millisec: 0,
74
- microsec: 0,
75
- timezone: null,
76
- hourMin: 0,
77
- minuteMin: 0,
78
- secondMin: 0,
79
- millisecMin: 0,
80
- microsecMin: 0,
81
- hourMax: 23,
82
- minuteMax: 59,
83
- secondMax: 59,
84
- millisecMax: 999,
85
- microsecMax: 999,
86
- minDateTime: null,
87
- maxDateTime: null,
88
- maxTime: null,
89
- minTime: null,
90
- onSelect: null,
91
- hourGrid: 0,
92
- minuteGrid: 0,
93
- secondGrid: 0,
94
- millisecGrid: 0,
95
- microsecGrid: 0,
96
- alwaysSetTime: true,
97
- separator: ' ',
98
- altFieldTimeOnly: true,
99
- altTimeFormat: null,
100
- altSeparator: null,
101
- altTimeSuffix: null,
102
- altRedirectFocus: true,
103
- pickerTimeFormat: null,
104
- pickerTimeSuffix: null,
105
- showTimepicker: true,
106
- timezoneList: null,
107
- addSliderAccess: false,
108
- sliderAccessArgs: null,
109
- controlType: 'slider',
110
- oneLine: false,
111
- defaultValue: null,
112
- parse: 'strict',
113
- afterInject: null
114
- };
115
- $.extend(this._defaults, this.regional['']);
116
- };
117
-
118
- $.extend(Timepicker.prototype, {
119
- $input: null,
120
- $altInput: null,
121
- $timeObj: null,
122
- inst: null,
123
- hour_slider: null,
124
- minute_slider: null,
125
- second_slider: null,
126
- millisec_slider: null,
127
- microsec_slider: null,
128
- timezone_select: null,
129
- maxTime: null,
130
- minTime: null,
131
- hour: 0,
132
- minute: 0,
133
- second: 0,
134
- millisec: 0,
135
- microsec: 0,
136
- timezone: null,
137
- hourMinOriginal: null,
138
- minuteMinOriginal: null,
139
- secondMinOriginal: null,
140
- millisecMinOriginal: null,
141
- microsecMinOriginal: null,
142
- hourMaxOriginal: null,
143
- minuteMaxOriginal: null,
144
- secondMaxOriginal: null,
145
- millisecMaxOriginal: null,
146
- microsecMaxOriginal: null,
147
- ampm: '',
148
- formattedDate: '',
149
- formattedTime: '',
150
- formattedDateTime: '',
151
- timezoneList: null,
152
- units: ['hour', 'minute', 'second', 'millisec', 'microsec'],
153
- support: {},
154
- control: null,
155
-
156
- /*
157
- * Override the default settings for all instances of the time picker.
158
- * @param {Object} settings object - the new settings to use as defaults (anonymous object)
159
- * @return {Object} the manager object
160
- */
161
- setDefaults: function (settings) {
162
- extendRemove(this._defaults, settings || {});
163
- return this;
164
- },
165
-
166
- /*
167
- * Create a new Timepicker instance
168
- */
169
- _newInst: function ($input, opts) {
170
- var tp_inst = new Timepicker(),
171
- inlineSettings = {},
172
- fns = {},
173
- overrides, i;
174
-
175
- for (var attrName in this._defaults) {
176
- if (this._defaults.hasOwnProperty(attrName)) {
177
- var attrValue = $input.attr('time:' + attrName);
178
- if (attrValue) {
179
- try {
180
- inlineSettings[attrName] = eval(attrValue);
181
- } catch (err) {
182
- inlineSettings[attrName] = attrValue;
183
- }
184
- }
185
- }
186
- }
187
-
188
- overrides = {
189
- beforeShow: function (input, dp_inst) {
190
- if ($.isFunction(tp_inst._defaults.evnts.beforeShow)) {
191
- return tp_inst._defaults.evnts.beforeShow.call($input[0], input, dp_inst, tp_inst);
192
- }
193
- },
194
- onChangeMonthYear: function (year, month, dp_inst) {
195
- // Update the time as well : this prevents the time from disappearing from the $input field.
196
- // tp_inst._updateDateTime(dp_inst);
197
- if ($.isFunction(tp_inst._defaults.evnts.onChangeMonthYear)) {
198
- tp_inst._defaults.evnts.onChangeMonthYear.call($input[0], year, month, dp_inst, tp_inst);
199
- }
200
- },
201
- onClose: function (dateText, dp_inst) {
202
- if (tp_inst.timeDefined === true && $input.val() !== '') {
203
- tp_inst._updateDateTime(dp_inst);
204
- }
205
- if ($.isFunction(tp_inst._defaults.evnts.onClose)) {
206
- tp_inst._defaults.evnts.onClose.call($input[0], dateText, dp_inst, tp_inst);
207
- }
208
- }
209
- };
210
- for (i in overrides) {
211
- if (overrides.hasOwnProperty(i)) {
212
- fns[i] = opts[i] || this._defaults[i] || null;
213
- }
214
- }
215
-
216
- tp_inst._defaults = $.extend({}, this._defaults, inlineSettings, opts, overrides, {
217
- evnts: fns,
218
- timepicker: tp_inst // add timepicker as a property of datepicker: $.datepicker._get(dp_inst, 'timepicker');
219
- });
220
- tp_inst.amNames = $.map(tp_inst._defaults.amNames, function (val) {
221
- return val.toUpperCase();
222
- });
223
- tp_inst.pmNames = $.map(tp_inst._defaults.pmNames, function (val) {
224
- return val.toUpperCase();
225
- });
226
-
227
- // detect which units are supported
228
- tp_inst.support = detectSupport(
229
- tp_inst._defaults.timeFormat +
230
- (tp_inst._defaults.pickerTimeFormat ? tp_inst._defaults.pickerTimeFormat : '') +
231
- (tp_inst._defaults.altTimeFormat ? tp_inst._defaults.altTimeFormat : ''));
232
-
233
- // controlType is string - key to our this._controls
234
- if (typeof(tp_inst._defaults.controlType) === 'string') {
235
- if (tp_inst._defaults.controlType === 'slider' && typeof($.ui.slider) === 'undefined') {
236
- tp_inst._defaults.controlType = 'select';
237
- }
238
- tp_inst.control = tp_inst._controls[tp_inst._defaults.controlType];
239
- }
240
- // controlType is an object and must implement create, options, value methods
241
- else {
242
- tp_inst.control = tp_inst._defaults.controlType;
243
- }
244
-
245
- // prep the timezone options
246
- var timezoneList = [-720, -660, -600, -570, -540, -480, -420, -360, -300, -270, -240, -210, -180, -120, -60,
247
- 0, 60, 120, 180, 210, 240, 270, 300, 330, 345, 360, 390, 420, 480, 525, 540, 570, 600, 630, 660, 690, 720, 765, 780, 840];
248
- if (tp_inst._defaults.timezoneList !== null) {
249
- timezoneList = tp_inst._defaults.timezoneList;
250
- }
251
- var tzl = timezoneList.length, tzi = 0, tzv = null;
252
- if (tzl > 0 && typeof timezoneList[0] !== 'object') {
253
- for (; tzi < tzl; tzi++) {
254
- tzv = timezoneList[tzi];
255
- timezoneList[tzi] = { value: tzv, label: $.timepicker.timezoneOffsetString(tzv, tp_inst.support.iso8601) };
256
- }
257
- }
258
- tp_inst._defaults.timezoneList = timezoneList;
259
-
260
- // set the default units
261
- tp_inst.timezone = tp_inst._defaults.timezone !== null ? $.timepicker.timezoneOffsetNumber(tp_inst._defaults.timezone) :
262
- ((new Date()).getTimezoneOffset() * -1);
263
- tp_inst.hour = tp_inst._defaults.hour < tp_inst._defaults.hourMin ? tp_inst._defaults.hourMin :
264
- tp_inst._defaults.hour > tp_inst._defaults.hourMax ? tp_inst._defaults.hourMax : tp_inst._defaults.hour;
265
- tp_inst.minute = tp_inst._defaults.minute < tp_inst._defaults.minuteMin ? tp_inst._defaults.minuteMin :
266
- tp_inst._defaults.minute > tp_inst._defaults.minuteMax ? tp_inst._defaults.minuteMax : tp_inst._defaults.minute;
267
- tp_inst.second = tp_inst._defaults.second < tp_inst._defaults.secondMin ? tp_inst._defaults.secondMin :
268
- tp_inst._defaults.second > tp_inst._defaults.secondMax ? tp_inst._defaults.secondMax : tp_inst._defaults.second;
269
- tp_inst.millisec = tp_inst._defaults.millisec < tp_inst._defaults.millisecMin ? tp_inst._defaults.millisecMin :
270
- tp_inst._defaults.millisec > tp_inst._defaults.millisecMax ? tp_inst._defaults.millisecMax : tp_inst._defaults.millisec;
271
- tp_inst.microsec = tp_inst._defaults.microsec < tp_inst._defaults.microsecMin ? tp_inst._defaults.microsecMin :
272
- tp_inst._defaults.microsec > tp_inst._defaults.microsecMax ? tp_inst._defaults.microsecMax : tp_inst._defaults.microsec;
273
- tp_inst.ampm = '';
274
- tp_inst.$input = $input;
275
-
276
- if (tp_inst._defaults.altField) {
277
- tp_inst.$altInput = $(tp_inst._defaults.altField);
278
- if (tp_inst._defaults.altRedirectFocus === true) {
279
- tp_inst.$altInput.css({
280
- cursor: 'pointer'
281
- }).focus(function () {
282
- $input.trigger("focus");
283
- });
284
- }
285
- }
286
-
287
- if (tp_inst._defaults.minDate === 0 || tp_inst._defaults.minDateTime === 0) {
288
- tp_inst._defaults.minDate = new Date();
289
- }
290
- if (tp_inst._defaults.maxDate === 0 || tp_inst._defaults.maxDateTime === 0) {
291
- tp_inst._defaults.maxDate = new Date();
292
- }
293
-
294
- // datepicker needs minDate/maxDate, timepicker needs minDateTime/maxDateTime..
295
- if (tp_inst._defaults.minDate !== undefined && tp_inst._defaults.minDate instanceof Date) {
296
- tp_inst._defaults.minDateTime = new Date(tp_inst._defaults.minDate.getTime());
297
- }
298
- if (tp_inst._defaults.minDateTime !== undefined && tp_inst._defaults.minDateTime instanceof Date) {
299
- tp_inst._defaults.minDate = new Date(tp_inst._defaults.minDateTime.getTime());
300
- }
301
- if (tp_inst._defaults.maxDate !== undefined && tp_inst._defaults.maxDate instanceof Date) {
302
- tp_inst._defaults.maxDateTime = new Date(tp_inst._defaults.maxDate.getTime());
303
- }
304
- if (tp_inst._defaults.maxDateTime !== undefined && tp_inst._defaults.maxDateTime instanceof Date) {
305
- tp_inst._defaults.maxDate = new Date(tp_inst._defaults.maxDateTime.getTime());
306
- }
307
- tp_inst.$input.bind('focus', function () {
308
- tp_inst._onFocus();
309
- });
310
-
311
- return tp_inst;
312
- },
313
-
314
- /*
315
- * add our sliders to the calendar
316
- */
317
- _addTimePicker: function (dp_inst) {
318
- var currDT = $.trim((this.$altInput && this._defaults.altFieldTimeOnly) ? this.$input.val() + ' ' + this.$altInput.val() : this.$input.val());
319
-
320
- this.timeDefined = this._parseTime(currDT);
321
- this._limitMinMaxDateTime(dp_inst, false);
322
- this._injectTimePicker();
323
- this._afterInject();
324
- },
325
-
326
- /*
327
- * parse the time string from input value or _setTime
328
- */
329
- _parseTime: function (timeString, withDate) {
330
- if (!this.inst) {
331
- this.inst = $.datepicker._getInst(this.$input[0]);
332
- }
333
-
334
- if (withDate || !this._defaults.timeOnly) {
335
- var dp_dateFormat = $.datepicker._get(this.inst, 'dateFormat');
336
- try {
337
- var parseRes = parseDateTimeInternal(dp_dateFormat, this._defaults.timeFormat, timeString, $.datepicker._getFormatConfig(this.inst), this._defaults);
338
- if (!parseRes.timeObj) {
339
- return false;
340
- }
341
- $.extend(this, parseRes.timeObj);
342
- } catch (err) {
343
- $.timepicker.log("Error parsing the date/time string: " + err +
344
- "\ndate/time string = " + timeString +
345
- "\ntimeFormat = " + this._defaults.timeFormat +
346
- "\ndateFormat = " + dp_dateFormat);
347
- return false;
348
- }
349
- return true;
350
- } else {
351
- var timeObj = $.datepicker.parseTime(this._defaults.timeFormat, timeString, this._defaults);
352
- if (!timeObj) {
353
- return false;
354
- }
355
- $.extend(this, timeObj);
356
- return true;
357
- }
358
- },
359
-
360
- /*
361
- * Handle callback option after injecting timepicker
362
- */
363
- _afterInject: function() {
364
- var o = this.inst.settings;
365
- if ($.isFunction(o.afterInject)) {
366
- o.afterInject.call(this);
367
- }
368
- },
369
-
370
- /*
371
- * generate and inject html for timepicker into ui datepicker
372
- */
373
- _injectTimePicker: function () {
374
- var $dp = this.inst.dpDiv,
375
- o = this.inst.settings,
376
- tp_inst = this,
377
- litem = '',
378
- uitem = '',
379
- show = null,
380
- max = {},
381
- gridSize = {},
382
- size = null,
383
- i = 0,
384
- l = 0;
385
-
386
- // Prevent displaying twice
387
- if ($dp.find("div.ui-timepicker-div").length === 0 && o.showTimepicker) {
388
- var noDisplay = ' ui_tpicker_unit_hide',
389
- html = '<div class="ui-timepicker-div' + (o.isRTL ? ' ui-timepicker-rtl' : '') + (o.oneLine && o.controlType === 'select' ? ' ui-timepicker-oneLine' : '') + '"><dl>' + '<dt class="ui_tpicker_time_label' + ((o.showTime) ? '' : noDisplay) + '">' + o.timeText + '</dt>' +
390
- '<dd class="ui_tpicker_time '+ ((o.showTime) ? '' : noDisplay) + '"><input class="ui_tpicker_time_input" ' + (o.timeInput ? '' : 'disabled') + '/></dd>';
391
-
392
- // Create the markup
393
- for (i = 0, l = this.units.length; i < l; i++) {
394
- litem = this.units[i];
395
- uitem = litem.substr(0, 1).toUpperCase() + litem.substr(1);
396
- show = o['show' + uitem] !== null ? o['show' + uitem] : this.support[litem];
397
-
398
- // Added by Peter Medeiros:
399
- // - Figure out what the hour/minute/second max should be based on the step values.
400
- // - Example: if stepMinute is 15, then minMax is 45.
401
- max[litem] = parseInt((o[litem + 'Max'] - ((o[litem + 'Max'] - o[litem + 'Min']) % o['step' + uitem])), 10);
402
- gridSize[litem] = 0;
403
-
404
- html += '<dt class="ui_tpicker_' + litem + '_label' + (show ? '' : noDisplay) + '">' + o[litem + 'Text'] + '</dt>' +
405
- '<dd class="ui_tpicker_' + litem + (show ? '' : noDisplay) + '"><div class="ui_tpicker_' + litem + '_slider' + (show ? '' : noDisplay) + '"></div>';
406
-
407
- if (show && o[litem + 'Grid'] > 0) {
408
- html += '<div style="padding-left: 1px"><table class="ui-tpicker-grid-label"><tr>';
409
-
410
- if (litem === 'hour') {
411
- for (var h = o[litem + 'Min']; h <= max[litem]; h += parseInt(o[litem + 'Grid'], 10)) {
412
- gridSize[litem]++;
413
- var tmph = $.datepicker.formatTime(this.support.ampm ? 'hht' : 'HH', {hour: h}, o);
414
- html += '<td data-for="' + litem + '">' + tmph + '</td>';
415
- }
416
- }
417
- else {
418
- for (var m = o[litem + 'Min']; m <= max[litem]; m += parseInt(o[litem + 'Grid'], 10)) {
419
- gridSize[litem]++;
420
- html += '<td data-for="' + litem + '">' + ((m < 10) ? '0' : '') + m + '</td>';
421
- }
422
- }
423
-
424
- html += '</tr></table></div>';
425
- }
426
- html += '</dd>';
427
- }
428
-
429
- // Timezone
430
- var showTz = o.showTimezone !== null ? o.showTimezone : this.support.timezone;
431
- html += '<dt class="ui_tpicker_timezone_label' + (showTz ? '' : noDisplay) + '">' + o.timezoneText + '</dt>';
432
- html += '<dd class="ui_tpicker_timezone' + (showTz ? '' : noDisplay) + '"></dd>';
433
-
434
- // Create the elements from string
435
- html += '</dl></div>';
436
- var $tp = $(html);
437
-
438
- // if we only want time picker...
439
- if (o.timeOnly === true) {
440
- $tp.prepend('<div class="ui-widget-header ui-helper-clearfix ui-corner-all">' + '<div class="ui-datepicker-title">' + o.timeOnlyTitle + '</div>' + '</div>');
441
- $dp.find('.ui-datepicker-header, .ui-datepicker-calendar').hide();
442
- }
443
-
444
- // add sliders, adjust grids, add events
445
- for (i = 0, l = tp_inst.units.length; i < l; i++) {
446
- litem = tp_inst.units[i];
447
- uitem = litem.substr(0, 1).toUpperCase() + litem.substr(1);
448
- show = o['show' + uitem] !== null ? o['show' + uitem] : this.support[litem];
449
-
450
- // add the slider
451
- tp_inst[litem + '_slider'] = tp_inst.control.create(tp_inst, $tp.find('.ui_tpicker_' + litem + '_slider'), litem, tp_inst[litem], o[litem + 'Min'], max[litem], o['step' + uitem]);
452
-
453
- // adjust the grid and add click event
454
- if (show && o[litem + 'Grid'] > 0) {
455
- size = 100 * gridSize[litem] * o[litem + 'Grid'] / (max[litem] - o[litem + 'Min']);
456
- $tp.find('.ui_tpicker_' + litem + ' table').css({
457
- width: size + "%",
458
- marginLeft: o.isRTL ? '0' : ((size / (-2 * gridSize[litem])) + "%"),
459
- marginRight: o.isRTL ? ((size / (-2 * gridSize[litem])) + "%") : '0',
460
- borderCollapse: 'collapse'
461
- }).find("td").click(function (e) {
462
- var $t = $(this),
463
- h = $t.html(),
464
- n = parseInt(h.replace(/[^0-9]/g), 10),
465
- ap = h.replace(/[^apm]/ig),
466
- f = $t.data('for'); // loses scope, so we use data-for
467
-
468
- if (f === 'hour') {
469
- if (ap.indexOf('p') !== -1 && n < 12) {
470
- n += 12;
471
- }
472
- else {
473
- if (ap.indexOf('a') !== -1 && n === 12) {
474
- n = 0;
475
- }
476
- }
477
- }
478
-
479
- tp_inst.control.value(tp_inst, tp_inst[f + '_slider'], litem, n);
480
-
481
- tp_inst._onTimeChange();
482
- tp_inst._onSelectHandler();
483
- }).css({
484
- cursor: 'pointer',
485
- width: (100 / gridSize[litem]) + '%',
486
- textAlign: 'center',
487
- overflow: 'hidden'
488
- });
489
- } // end if grid > 0
490
- } // end for loop
491
-
492
- // Add timezone options
493
- this.timezone_select = $tp.find('.ui_tpicker_timezone').append('<select></select>').find("select");
494
- $.fn.append.apply(this.timezone_select,
495
- $.map(o.timezoneList, function (val, idx) {
496
- return $("<option />").val(typeof val === "object" ? val.value : val).text(typeof val === "object" ? val.label : val);
497
- }));
498
- if (typeof(this.timezone) !== "undefined" && this.timezone !== null && this.timezone !== "") {
499
- var local_timezone = (new Date(this.inst.selectedYear, this.inst.selectedMonth, this.inst.selectedDay, 12)).getTimezoneOffset() * -1;
500
- if (local_timezone === this.timezone) {
501
- selectLocalTimezone(tp_inst);
502
- } else {
503
- this.timezone_select.val(this.timezone);
504
- }
505
- } else {
506
- if (typeof(this.hour) !== "undefined" && this.hour !== null && this.hour !== "") {
507
- this.timezone_select.val(o.timezone);
508
- } else {
509
- selectLocalTimezone(tp_inst);
510
- }
511
- }
512
- this.timezone_select.change(function () {
513
- tp_inst._onTimeChange();
514
- tp_inst._onSelectHandler();
515
- tp_inst._afterInject();
516
- });
517
- // End timezone options
518
-
519
- // inject timepicker into datepicker
520
- var $buttonPanel = $dp.find('.ui-datepicker-buttonpane');
521
- if ($buttonPanel.length) {
522
- $buttonPanel.before($tp);
523
- } else {
524
- $dp.append($tp);
525
- }
526
-
527
- this.$timeObj = $tp.find('.ui_tpicker_time_input');
528
- this.$timeObj.change(function () {
529
- var timeFormat = tp_inst.inst.settings.timeFormat;
530
- var parsedTime = $.datepicker.parseTime(timeFormat, this.value);
531
- var update = new Date();
532
- if (parsedTime) {
533
- update.setHours(parsedTime.hour);
534
- update.setMinutes(parsedTime.minute);
535
- update.setSeconds(parsedTime.second);
536
- $.datepicker._setTime(tp_inst.inst, update);
537
- } else {
538
- this.value = tp_inst.formattedTime;
539
- this.blur();
540
- }
541
- });
542
-
543
- if (this.inst !== null) {
544
- var timeDefined = this.timeDefined;
545
- this._onTimeChange();
546
- this.timeDefined = timeDefined;
547
- }
548
-
549
- // slideAccess integration: http://trentrichardson.com/2011/11/11/jquery-ui-sliders-and-touch-accessibility/
550
- if (this._defaults.addSliderAccess) {
551
- var sliderAccessArgs = this._defaults.sliderAccessArgs,
552
- rtl = this._defaults.isRTL;
553
- sliderAccessArgs.isRTL = rtl;
554
-
555
- setTimeout(function () { // fix for inline mode
556
- if ($tp.find('.ui-slider-access').length === 0) {
557
- $tp.find('.ui-slider:visible').sliderAccess(sliderAccessArgs);
558
-
559
- // fix any grids since sliders are shorter
560
- var sliderAccessWidth = $tp.find('.ui-slider-access:eq(0)').outerWidth(true);
561
- if (sliderAccessWidth) {
562
- $tp.find('table:visible').each(function () {
563
- var $g = $(this),
564
- oldWidth = $g.outerWidth(),
565
- oldMarginLeft = $g.css(rtl ? 'marginRight' : 'marginLeft').toString().replace('%', ''),
566
- newWidth = oldWidth - sliderAccessWidth,
567
- newMarginLeft = ((oldMarginLeft * newWidth) / oldWidth) + '%',
568
- css = { width: newWidth, marginRight: 0, marginLeft: 0 };
569
- css[rtl ? 'marginRight' : 'marginLeft'] = newMarginLeft;
570
- $g.css(css);
571
- });
572
- }
573
- }
574
- }, 10);
575
- }
576
- // end slideAccess integration
577
-
578
- tp_inst._limitMinMaxDateTime(this.inst, true);
579
- }
580
- },
581
-
582
- /*
583
- * This function tries to limit the ability to go outside the
584
- * min/max date range
585
- */
586
- _limitMinMaxDateTime: function (dp_inst, adjustSliders) {
587
- var o = this._defaults,
588
- dp_date = new Date(dp_inst.selectedYear, dp_inst.selectedMonth, dp_inst.selectedDay);
589
-
590
- if (!this._defaults.showTimepicker) {
591
- return;
592
- } // No time so nothing to check here
593
-
594
- if ($.datepicker._get(dp_inst, 'minDateTime') !== null && $.datepicker._get(dp_inst, 'minDateTime') !== undefined && dp_date) {
595
- var minDateTime = $.datepicker._get(dp_inst, 'minDateTime'),
596
- minDateTimeDate = new Date(minDateTime.getFullYear(), minDateTime.getMonth(), minDateTime.getDate(), 0, 0, 0, 0);
597
-
598
- if (this.hourMinOriginal === null || this.minuteMinOriginal === null || this.secondMinOriginal === null || this.millisecMinOriginal === null || this.microsecMinOriginal === null) {
599
- this.hourMinOriginal = o.hourMin;
600
- this.minuteMinOriginal = o.minuteMin;
601
- this.secondMinOriginal = o.secondMin;
602
- this.millisecMinOriginal = o.millisecMin;
603
- this.microsecMinOriginal = o.microsecMin;
604
- }
605
-
606
- if (dp_inst.settings.timeOnly || minDateTimeDate.getTime() === dp_date.getTime()) {
607
- this._defaults.hourMin = minDateTime.getHours();
608
- if (this.hour <= this._defaults.hourMin) {
609
- this.hour = this._defaults.hourMin;
610
- this._defaults.minuteMin = minDateTime.getMinutes();
611
- if (this.minute <= this._defaults.minuteMin) {
612
- this.minute = this._defaults.minuteMin;
613
- this._defaults.secondMin = minDateTime.getSeconds();
614
- if (this.second <= this._defaults.secondMin) {
615
- this.second = this._defaults.secondMin;
616
- this._defaults.millisecMin = minDateTime.getMilliseconds();
617
- if (this.millisec <= this._defaults.millisecMin) {
618
- this.millisec = this._defaults.millisecMin;
619
- this._defaults.microsecMin = minDateTime.getMicroseconds();
620
- } else {
621
- if (this.microsec < this._defaults.microsecMin) {
622
- this.microsec = this._defaults.microsecMin;
623
- }
624
- this._defaults.microsecMin = this.microsecMinOriginal;
625
- }
626
- } else {
627
- this._defaults.millisecMin = this.millisecMinOriginal;
628
- this._defaults.microsecMin = this.microsecMinOriginal;
629
- }
630
- } else {
631
- this._defaults.secondMin = this.secondMinOriginal;
632
- this._defaults.millisecMin = this.millisecMinOriginal;
633
- this._defaults.microsecMin = this.microsecMinOriginal;
634
- }
635
- } else {
636
- this._defaults.minuteMin = this.minuteMinOriginal;
637
- this._defaults.secondMin = this.secondMinOriginal;
638
- this._defaults.millisecMin = this.millisecMinOriginal;
639
- this._defaults.microsecMin = this.microsecMinOriginal;
640
- }
641
- } else {
642
- this._defaults.hourMin = this.hourMinOriginal;
643
- this._defaults.minuteMin = this.minuteMinOriginal;
644
- this._defaults.secondMin = this.secondMinOriginal;
645
- this._defaults.millisecMin = this.millisecMinOriginal;
646
- this._defaults.microsecMin = this.microsecMinOriginal;
647
- }
648
- }
649
-
650
- if ($.datepicker._get(dp_inst, 'maxDateTime') !== null && $.datepicker._get(dp_inst, 'maxDateTime') !== undefined && dp_date) {
651
- var maxDateTime = $.datepicker._get(dp_inst, 'maxDateTime'),
652
- maxDateTimeDate = new Date(maxDateTime.getFullYear(), maxDateTime.getMonth(), maxDateTime.getDate(), 0, 0, 0, 0);
653
-
654
- if (this.hourMaxOriginal === null || this.minuteMaxOriginal === null || this.secondMaxOriginal === null || this.millisecMaxOriginal === null) {
655
- this.hourMaxOriginal = o.hourMax;
656
- this.minuteMaxOriginal = o.minuteMax;
657
- this.secondMaxOriginal = o.secondMax;
658
- this.millisecMaxOriginal = o.millisecMax;
659
- this.microsecMaxOriginal = o.microsecMax;
660
- }
661
-
662
- if (dp_inst.settings.timeOnly || maxDateTimeDate.getTime() === dp_date.getTime()) {
663
- this._defaults.hourMax = maxDateTime.getHours();
664
- if (this.hour >= this._defaults.hourMax) {
665
- this.hour = this._defaults.hourMax;
666
- this._defaults.minuteMax = maxDateTime.getMinutes();
667
- if (this.minute >= this._defaults.minuteMax) {
668
- this.minute = this._defaults.minuteMax;
669
- this._defaults.secondMax = maxDateTime.getSeconds();
670
- if (this.second >= this._defaults.secondMax) {
671
- this.second = this._defaults.secondMax;
672
- this._defaults.millisecMax = maxDateTime.getMilliseconds();
673
- if (this.millisec >= this._defaults.millisecMax) {
674
- this.millisec = this._defaults.millisecMax;
675
- this._defaults.microsecMax = maxDateTime.getMicroseconds();
676
- } else {
677
- if (this.microsec > this._defaults.microsecMax) {
678
- this.microsec = this._defaults.microsecMax;
679
- }
680
- this._defaults.microsecMax = this.microsecMaxOriginal;
681
- }
682
- } else {
683
- this._defaults.millisecMax = this.millisecMaxOriginal;
684
- this._defaults.microsecMax = this.microsecMaxOriginal;
685
- }
686
- } else {
687
- this._defaults.secondMax = this.secondMaxOriginal;
688
- this._defaults.millisecMax = this.millisecMaxOriginal;
689
- this._defaults.microsecMax = this.microsecMaxOriginal;
690
- }
691
- } else {
692
- this._defaults.minuteMax = this.minuteMaxOriginal;
693
- this._defaults.secondMax = this.secondMaxOriginal;
694
- this._defaults.millisecMax = this.millisecMaxOriginal;
695
- this._defaults.microsecMax = this.microsecMaxOriginal;
696
- }
697
- } else {
698
- this._defaults.hourMax = this.hourMaxOriginal;
699
- this._defaults.minuteMax = this.minuteMaxOriginal;
700
- this._defaults.secondMax = this.secondMaxOriginal;
701
- this._defaults.millisecMax = this.millisecMaxOriginal;
702
- this._defaults.microsecMax = this.microsecMaxOriginal;
703
- }
704
- }
705
-
706
- if (dp_inst.settings.minTime!==null) {
707
- var tempMinTime=new Date("01/01/1970 " + dp_inst.settings.minTime);
708
- if (this.hour<tempMinTime.getHours()) {
709
- this.hour=this._defaults.hourMin=tempMinTime.getHours();
710
- this.minute=this._defaults.minuteMin=tempMinTime.getMinutes();
711
- } else if (this.hour===tempMinTime.getHours() && this.minute<tempMinTime.getMinutes()) {
712
- this.minute=this._defaults.minuteMin=tempMinTime.getMinutes();
713
- } else {
714
- if (this._defaults.hourMin<tempMinTime.getHours()) {
715
- this._defaults.hourMin=tempMinTime.getHours();
716
- this._defaults.minuteMin=tempMinTime.getMinutes();
717
- } else if (this._defaults.hourMin===tempMinTime.getHours()===this.hour && this._defaults.minuteMin<tempMinTime.getMinutes()) {
718
- this._defaults.minuteMin=tempMinTime.getMinutes();
719
- } else {
720
- this._defaults.minuteMin=0;
721
- }
722
- }
723
- }
724
-
725
- if (dp_inst.settings.maxTime!==null) {
726
- var tempMaxTime=new Date("01/01/1970 " + dp_inst.settings.maxTime);
727
- if (this.hour>tempMaxTime.getHours()) {
728
- this.hour=this._defaults.hourMax=tempMaxTime.getHours();
729
- this.minute=this._defaults.minuteMax=tempMaxTime.getMinutes();
730
- } else if (this.hour===tempMaxTime.getHours() && this.minute>tempMaxTime.getMinutes()) {
731
- this.minute=this._defaults.minuteMax=tempMaxTime.getMinutes();
732
- } else {
733
- if (this._defaults.hourMax>tempMaxTime.getHours()) {
734
- this._defaults.hourMax=tempMaxTime.getHours();
735
- this._defaults.minuteMax=tempMaxTime.getMinutes();
736
- } else if (this._defaults.hourMax===tempMaxTime.getHours()===this.hour && this._defaults.minuteMax>tempMaxTime.getMinutes()) {
737
- this._defaults.minuteMax=tempMaxTime.getMinutes();
738
- } else {
739
- this._defaults.minuteMax=59;
740
- }
741
- }
742
- }
743
-
744
- if (adjustSliders !== undefined && adjustSliders === true) {
745
- var hourMax = parseInt((this._defaults.hourMax - ((this._defaults.hourMax - this._defaults.hourMin) % this._defaults.stepHour)), 10),
746
- minMax = parseInt((this._defaults.minuteMax - ((this._defaults.minuteMax - this._defaults.minuteMin) % this._defaults.stepMinute)), 10),
747
- secMax = parseInt((this._defaults.secondMax - ((this._defaults.secondMax - this._defaults.secondMin) % this._defaults.stepSecond)), 10),
748
- millisecMax = parseInt((this._defaults.millisecMax - ((this._defaults.millisecMax - this._defaults.millisecMin) % this._defaults.stepMillisec)), 10),
749
- microsecMax = parseInt((this._defaults.microsecMax - ((this._defaults.microsecMax - this._defaults.microsecMin) % this._defaults.stepMicrosec)), 10);
750
-
751
- if (this.hour_slider) {
752
- this.control.options(this, this.hour_slider, 'hour', { min: this._defaults.hourMin, max: hourMax, step: this._defaults.stepHour });
753
- this.control.value(this, this.hour_slider, 'hour', this.hour - (this.hour % this._defaults.stepHour));
754
- }
755
- if (this.minute_slider) {
756
- this.control.options(this, this.minute_slider, 'minute', { min: this._defaults.minuteMin, max: minMax, step: this._defaults.stepMinute });
757
- this.control.value(this, this.minute_slider, 'minute', this.minute - (this.minute % this._defaults.stepMinute));
758
- }
759
- if (this.second_slider) {
760
- this.control.options(this, this.second_slider, 'second', { min: this._defaults.secondMin, max: secMax, step: this._defaults.stepSecond });
761
- this.control.value(this, this.second_slider, 'second', this.second - (this.second % this._defaults.stepSecond));
762
- }
763
- if (this.millisec_slider) {
764
- this.control.options(this, this.millisec_slider, 'millisec', { min: this._defaults.millisecMin, max: millisecMax, step: this._defaults.stepMillisec });
765
- this.control.value(this, this.millisec_slider, 'millisec', this.millisec - (this.millisec % this._defaults.stepMillisec));
766
- }
767
- if (this.microsec_slider) {
768
- this.control.options(this, this.microsec_slider, 'microsec', { min: this._defaults.microsecMin, max: microsecMax, step: this._defaults.stepMicrosec });
769
- this.control.value(this, this.microsec_slider, 'microsec', this.microsec - (this.microsec % this._defaults.stepMicrosec));
770
- }
771
- }
772
-
773
- },
774
-
775
- /*
776
- * when a slider moves, set the internal time...
777
- * on time change is also called when the time is updated in the text field
778
- */
779
- _onTimeChange: function () {
780
- if (!this._defaults.showTimepicker) {
781
- return;
782
- }
783
- var hour = (this.hour_slider) ? this.control.value(this, this.hour_slider, 'hour') : false,
784
- minute = (this.minute_slider) ? this.control.value(this, this.minute_slider, 'minute') : false,
785
- second = (this.second_slider) ? this.control.value(this, this.second_slider, 'second') : false,
786
- millisec = (this.millisec_slider) ? this.control.value(this, this.millisec_slider, 'millisec') : false,
787
- microsec = (this.microsec_slider) ? this.control.value(this, this.microsec_slider, 'microsec') : false,
788
- timezone = (this.timezone_select) ? this.timezone_select.val() : false,
789
- o = this._defaults,
790
- pickerTimeFormat = o.pickerTimeFormat || o.timeFormat,
791
- pickerTimeSuffix = o.pickerTimeSuffix || o.timeSuffix;
792
-
793
- if (typeof(hour) === 'object') {
794
- hour = false;
795
- }
796
- if (typeof(minute) === 'object') {
797
- minute = false;
798
- }
799
- if (typeof(second) === 'object') {
800
- second = false;
801
- }
802
- if (typeof(millisec) === 'object') {
803
- millisec = false;
804
- }
805
- if (typeof(microsec) === 'object') {
806
- microsec = false;
807
- }
808
- if (typeof(timezone) === 'object') {
809
- timezone = false;
810
- }
811
-
812
- if (hour !== false) {
813
- hour = parseInt(hour, 10);
814
- }
815
- if (minute !== false) {
816
- minute = parseInt(minute, 10);
817
- }
818
- if (second !== false) {
819
- second = parseInt(second, 10);
820
- }
821
- if (millisec !== false) {
822
- millisec = parseInt(millisec, 10);
823
- }
824
- if (microsec !== false) {
825
- microsec = parseInt(microsec, 10);
826
- }
827
- if (timezone !== false) {
828
- timezone = timezone.toString();
829
- }
830
-
831
- var ampm = o[hour < 12 ? 'amNames' : 'pmNames'][0];
832
-
833
- // If the update was done in the input field, the input field should not be updated.
834
- // If the update was done using the sliders, update the input field.
835
- var hasChanged = (
836
- hour !== parseInt(this.hour,10) || // sliders should all be numeric
837
- minute !== parseInt(this.minute,10) ||
838
- second !== parseInt(this.second,10) ||
839
- millisec !== parseInt(this.millisec,10) ||
840
- microsec !== parseInt(this.microsec,10) ||
841
- (this.ampm.length > 0 && (hour < 12) !== ($.inArray(this.ampm.toUpperCase(), this.amNames) !== -1)) ||
842
- (this.timezone !== null && timezone !== this.timezone.toString()) // could be numeric or "EST" format, so use toString()
843
- );
844
-
845
- if (hasChanged) {
846
-
847
- if (hour !== false) {
848
- this.hour = hour;
849
- }
850
- if (minute !== false) {
851
- this.minute = minute;
852
- }
853
- if (second !== false) {
854
- this.second = second;
855
- }
856
- if (millisec !== false) {
857
- this.millisec = millisec;
858
- }
859
- if (microsec !== false) {
860
- this.microsec = microsec;
861
- }
862
- if (timezone !== false) {
863
- this.timezone = timezone;
864
- }
865
-
866
- if (!this.inst) {
867
- this.inst = $.datepicker._getInst(this.$input[0]);
868
- }
869
-
870
- this._limitMinMaxDateTime(this.inst, true);
871
- }
872
- if (this.support.ampm) {
873
- this.ampm = ampm;
874
- }
875
-
876
- // Updates the time within the timepicker
877
- this.formattedTime = $.datepicker.formatTime(o.timeFormat, this, o);
878
- if (this.$timeObj) {
879
- if (pickerTimeFormat === o.timeFormat) {
880
- this.$timeObj.val(this.formattedTime + pickerTimeSuffix);
881
- }
882
- else {
883
- this.$timeObj.val($.datepicker.formatTime(pickerTimeFormat, this, o) + pickerTimeSuffix);
884
- }
885
- if (this.$timeObj[0].setSelectionRange) {
886
- var sPos = this.$timeObj[0].selectionStart;
887
- var ePos = this.$timeObj[0].selectionEnd;
888
- this.$timeObj[0].setSelectionRange(sPos, ePos);
889
- }
890
- }
891
-
892
- this.timeDefined = true;
893
- if (hasChanged) {
894
- this._updateDateTime();
895
- //this.$input.focus(); // may automatically open the picker on setDate
896
- }
897
- },
898
-
899
- /*
900
- * call custom onSelect.
901
- * bind to sliders slidestop, and grid click.
902
- */
903
- _onSelectHandler: function () {
904
- var onSelect = this._defaults.onSelect || this.inst.settings.onSelect;
905
- var inputEl = this.$input ? this.$input[0] : null;
906
- if (onSelect && inputEl) {
907
- onSelect.apply(inputEl, [this.formattedDateTime, this]);
908
- }
909
- },
910
-
911
- /*
912
- * update our input with the new date time..
913
- */
914
- _updateDateTime: function (dp_inst) {
915
- dp_inst = this.inst || dp_inst;
916
- var dtTmp = (dp_inst.currentYear > 0?
917
- new Date(dp_inst.currentYear, dp_inst.currentMonth, dp_inst.currentDay) :
918
- new Date(dp_inst.selectedYear, dp_inst.selectedMonth, dp_inst.selectedDay)),
919
- dt = $.datepicker._daylightSavingAdjust(dtTmp),
920
- //dt = $.datepicker._daylightSavingAdjust(new Date(dp_inst.selectedYear, dp_inst.selectedMonth, dp_inst.selectedDay)),
921
- //dt = $.datepicker._daylightSavingAdjust(new Date(dp_inst.currentYear, dp_inst.currentMonth, dp_inst.currentDay)),
922
- dateFmt = $.datepicker._get(dp_inst, 'dateFormat'),
923
- formatCfg = $.datepicker._getFormatConfig(dp_inst),
924
- timeAvailable = dt !== null && this.timeDefined;
925
- this.formattedDate = $.datepicker.formatDate(dateFmt, (dt === null ? new Date() : dt), formatCfg);
926
- var formattedDateTime = this.formattedDate;
927
-
928
- // if a slider was changed but datepicker doesn't have a value yet, set it
929
- if (dp_inst.lastVal === "") {
930
- dp_inst.currentYear = dp_inst.selectedYear;
931
- dp_inst.currentMonth = dp_inst.selectedMonth;
932
- dp_inst.currentDay = dp_inst.selectedDay;
933
- }
934
-
935
- /*
936
- * remove following lines to force every changes in date picker to change the input value
937
- * Bug descriptions: when an input field has a default value, and click on the field to pop up the date picker.
938
- * If the user manually empty the value in the input field, the date picker will never change selected value.
939
- */
940
- //if (dp_inst.lastVal !== undefined && (dp_inst.lastVal.length > 0 && this.$input.val().length === 0)) {
941
- // return;
942
- //}
943
-
944
- if (this._defaults.timeOnly === true && this._defaults.timeOnlyShowDate === false) {
945
- formattedDateTime = this.formattedTime;
946
- } else if ((this._defaults.timeOnly !== true && (this._defaults.alwaysSetTime || timeAvailable)) || (this._defaults.timeOnly === true && this._defaults.timeOnlyShowDate === true)) {
947
- formattedDateTime += this._defaults.separator + this.formattedTime + this._defaults.timeSuffix;
948
- }
949
-
950
- this.formattedDateTime = formattedDateTime;
951
-
952
- if (!this._defaults.showTimepicker) {
953
- this.$input.val(this.formattedDate);
954
- } else if (this.$altInput && this._defaults.timeOnly === false && this._defaults.altFieldTimeOnly === true) {
955
- this.$altInput.val(this.formattedTime);
956
- this.$input.val(this.formattedDate);
957
- } else if (this.$altInput) {
958
- this.$input.val(formattedDateTime);
959
- var altFormattedDateTime = '',
960
- altSeparator = this._defaults.altSeparator !== null ? this._defaults.altSeparator : this._defaults.separator,
961
- altTimeSuffix = this._defaults.altTimeSuffix !== null ? this._defaults.altTimeSuffix : this._defaults.timeSuffix;
962
-
963
- if (!this._defaults.timeOnly) {
964
- if (this._defaults.altFormat) {
965
- altFormattedDateTime = $.datepicker.formatDate(this._defaults.altFormat, (dt === null ? new Date() : dt), formatCfg);
966
- }
967
- else {
968
- altFormattedDateTime = this.formattedDate;
969
- }
970
-
971
- if (altFormattedDateTime) {
972
- altFormattedDateTime += altSeparator;
973
- }
974
- }
975
-
976
- if (this._defaults.altTimeFormat !== null) {
977
- altFormattedDateTime += $.datepicker.formatTime(this._defaults.altTimeFormat, this, this._defaults) + altTimeSuffix;
978
- }
979
- else {
980
- altFormattedDateTime += this.formattedTime + altTimeSuffix;
981
- }
982
- this.$altInput.val(altFormattedDateTime);
983
- } else {
984
- this.$input.val(formattedDateTime);
985
- }
986
-
987
- this.$input.trigger("change");
988
- },
989
-
990
- _onFocus: function () {
991
- if (!this.$input.val() && this._defaults.defaultValue) {
992
- this.$input.val(this._defaults.defaultValue);
993
- var inst = $.datepicker._getInst(this.$input.get(0)),
994
- tp_inst = $.datepicker._get(inst, 'timepicker');
995
- if (tp_inst) {
996
- if (tp_inst._defaults.timeOnly && (inst.input.val() !== inst.lastVal)) {
997
- try {
998
- $.datepicker._updateDatepicker(inst);
999
- } catch (err) {
1000
- $.timepicker.log(err);
1001
- }
1002
- }
1003
- }
1004
- }
1005
- },
1006
-
1007
- /*
1008
- * Small abstraction to control types
1009
- * We can add more, just be sure to follow the pattern: create, options, value
1010
- */
1011
- _controls: {
1012
- // slider methods
1013
- slider: {
1014
- create: function (tp_inst, obj, unit, val, min, max, step) {
1015
- var rtl = tp_inst._defaults.isRTL; // if rtl go -60->0 instead of 0->60
1016
- return obj.prop('slide', null).slider({
1017
- orientation: "horizontal",
1018
- value: rtl ? val * -1 : val,
1019
- min: rtl ? max * -1 : min,
1020
- max: rtl ? min * -1 : max,
1021
- step: step,
1022
- slide: function (event, ui) {
1023
- tp_inst.control.value(tp_inst, $(this), unit, rtl ? ui.value * -1 : ui.value);
1024
- tp_inst._onTimeChange();
1025
- },
1026
- stop: function (event, ui) {
1027
- tp_inst._onSelectHandler();
1028
- }
1029
- });
1030
- },
1031
- options: function (tp_inst, obj, unit, opts, val) {
1032
- if (tp_inst._defaults.isRTL) {
1033
- if (typeof(opts) === 'string') {
1034
- if (opts === 'min' || opts === 'max') {
1035
- if (val !== undefined) {
1036
- return obj.slider(opts, val * -1);
1037
- }
1038
- return Math.abs(obj.slider(opts));
1039
- }
1040
- return obj.slider(opts);
1041
- }
1042
- var min = opts.min,
1043
- max = opts.max;
1044
- opts.min = opts.max = null;
1045
- if (min !== undefined) {
1046
- opts.max = min * -1;
1047
- }
1048
- if (max !== undefined) {
1049
- opts.min = max * -1;
1050
- }
1051
- return obj.slider(opts);
1052
- }
1053
- if (typeof(opts) === 'string' && val !== undefined) {
1054
- return obj.slider(opts, val);
1055
- }
1056
- return obj.slider(opts);
1057
- },
1058
- value: function (tp_inst, obj, unit, val) {
1059
- if (tp_inst._defaults.isRTL) {
1060
- if (val !== undefined) {
1061
- return obj.slider('value', val * -1);
1062
- }
1063
- return Math.abs(obj.slider('value'));
1064
- }
1065
- if (val !== undefined) {
1066
- return obj.slider('value', val);
1067
- }
1068
- return obj.slider('value');
1069
- }
1070
- },
1071
- // select methods
1072
- select: {
1073
- create: function (tp_inst, obj, unit, val, min, max, step) {
1074
- var sel = '<select class="ui-timepicker-select ui-state-default ui-corner-all" data-unit="' + unit + '" data-min="' + min + '" data-max="' + max + '" data-step="' + step + '">',
1075
- format = tp_inst._defaults.pickerTimeFormat || tp_inst._defaults.timeFormat;
1076
-
1077
- for (var i = min; i <= max; i += step) {
1078
- sel += '<option value="' + i + '"' + (i === val ? ' selected' : '') + '>';
1079
- if (unit === 'hour') {
1080
- sel += $.datepicker.formatTime($.trim(format.replace(/[^ht ]/ig, '')), {hour: i}, tp_inst._defaults);
1081
- }
1082
- else if (unit === 'millisec' || unit === 'microsec' || i >= 10) { sel += i; }
1083
- else {sel += '0' + i.toString(); }
1084
- sel += '</option>';
1085
- }
1086
- sel += '</select>';
1087
-
1088
- obj.children('select').remove();
1089
-
1090
- $(sel).appendTo(obj).change(function (e) {
1091
- tp_inst._onTimeChange();
1092
- tp_inst._onSelectHandler();
1093
- tp_inst._afterInject();
1094
- });
1095
-
1096
- return obj;
1097
- },
1098
- options: function (tp_inst, obj, unit, opts, val) {
1099
- var o = {},
1100
- $t = obj.children('select');
1101
- if (typeof(opts) === 'string') {
1102
- if (val === undefined) {
1103
- return $t.data(opts);
1104
- }
1105
- o[opts] = val;
1106
- }
1107
- else { o = opts; }
1108
- return tp_inst.control.create(tp_inst, obj, $t.data('unit'), $t.val(), o.min>=0 ? o.min : $t.data('min'), o.max || $t.data('max'), o.step || $t.data('step'));
1109
- },
1110
- value: function (tp_inst, obj, unit, val) {
1111
- var $t = obj.children('select');
1112
- if (val !== undefined) {
1113
- return $t.val(val);
1114
- }
1115
- return $t.val();
1116
- }
1117
- }
1118
- } // end _controls
1119
-
1120
- });
1121
-
1122
- $.fn.extend({
1123
- /*
1124
- * shorthand just to use timepicker.
1125
- */
1126
- timepicker: function (o) {
1127
- o = o || {};
1128
- var tmp_args = Array.prototype.slice.call(arguments);
1129
-
1130
- if (typeof o === 'object') {
1131
- tmp_args[0] = $.extend(o, {
1132
- timeOnly: true
1133
- });
1134
- }
1135
-
1136
- return $(this).each(function () {
1137
- $.fn.datetimepicker.apply($(this), tmp_args);
1138
- });
1139
- },
1140
-
1141
- /*
1142
- * extend timepicker to datepicker
1143
- */
1144
- datetimepicker: function (o) {
1145
- o = o || {};
1146
- var tmp_args = arguments;
1147
-
1148
- if (typeof(o) === 'string') {
1149
- if (o === 'getDate' || (o === 'option' && tmp_args.length === 2 && typeof (tmp_args[1]) === 'string')) {
1150
- return $.fn.datepicker.apply($(this[0]), tmp_args);
1151
- } else {
1152
- return this.each(function () {
1153
- var $t = $(this);
1154
- $t.datepicker.apply($t, tmp_args);
1155
- });
1156
- }
1157
- } else {
1158
- return this.each(function () {
1159
- var $t = $(this);
1160
- $t.datepicker($.timepicker._newInst($t, o)._defaults);
1161
- });
1162
- }
1163
- }
1164
- });
1165
-
1166
- /*
1167
- * Public Utility to parse date and time
1168
- */
1169
- $.datepicker.parseDateTime = function (dateFormat, timeFormat, dateTimeString, dateSettings, timeSettings) {
1170
- var parseRes = parseDateTimeInternal(dateFormat, timeFormat, dateTimeString, dateSettings, timeSettings);
1171
- if (parseRes.timeObj) {
1172
- var t = parseRes.timeObj;
1173
- parseRes.date.setHours(t.hour, t.minute, t.second, t.millisec);
1174
- parseRes.date.setMicroseconds(t.microsec);
1175
- }
1176
-
1177
- return parseRes.date;
1178
- };
1179
-
1180
- /*
1181
- * Public utility to parse time
1182
- */
1183
- $.datepicker.parseTime = function (timeFormat, timeString, options) {
1184
- var o = extendRemove(extendRemove({}, $.timepicker._defaults), options || {}),
1185
- iso8601 = (timeFormat.replace(/\'.*?\'/g, '').indexOf('Z') !== -1);
1186
-
1187
- // Strict parse requires the timeString to match the timeFormat exactly
1188
- var strictParse = function (f, s, o) {
1189
-
1190
- // pattern for standard and localized AM/PM markers
1191
- var getPatternAmpm = function (amNames, pmNames) {
1192
- var markers = [];
1193
- if (amNames) {
1194
- $.merge(markers, amNames);
1195
- }
1196
- if (pmNames) {
1197
- $.merge(markers, pmNames);
1198
- }
1199
- markers = $.map(markers, function (val) {
1200
- return val.replace(/[.*+?|()\[\]{}\\]/g, '\\$&');
1201
- });
1202
- return '(' + markers.join('|') + ')?';
1203
- };
1204
-
1205
- // figure out position of time elements.. cause js cant do named captures
1206
- var getFormatPositions = function (timeFormat) {
1207
- var finds = timeFormat.toLowerCase().match(/(h{1,2}|m{1,2}|s{1,2}|l{1}|c{1}|t{1,2}|z|'.*?')/g),
1208
- orders = {
1209
- h: -1,
1210
- m: -1,
1211
- s: -1,
1212
- l: -1,
1213
- c: -1,
1214
- t: -1,
1215
- z: -1
1216
- };
1217
-
1218
- if (finds) {
1219
- for (var i = 0; i < finds.length; i++) {
1220
- if (orders[finds[i].toString().charAt(0)] === -1) {
1221
- orders[finds[i].toString().charAt(0)] = i + 1;
1222
- }
1223
- }
1224
- }
1225
- return orders;
1226
- };
1227
-
1228
- var regstr = '^' + f.toString()
1229
- .replace(/([hH]{1,2}|mm?|ss?|[tT]{1,2}|[zZ]|[lc]|'.*?')/g, function (match) {
1230
- var ml = match.length;
1231
- switch (match.charAt(0).toLowerCase()) {
1232
- case 'h':
1233
- return ml === 1 ? '(\\d?\\d)' : '(\\d{' + ml + '})';
1234
- case 'm':
1235
- return ml === 1 ? '(\\d?\\d)' : '(\\d{' + ml + '})';
1236
- case 's':
1237
- return ml === 1 ? '(\\d?\\d)' : '(\\d{' + ml + '})';
1238
- case 'l':
1239
- return '(\\d?\\d?\\d)';
1240
- case 'c':
1241
- return '(\\d?\\d?\\d)';
1242
- case 'z':
1243
- return '(z|[-+]\\d\\d:?\\d\\d|\\S+)?';
1244
- case 't':
1245
- return getPatternAmpm(o.amNames, o.pmNames);
1246
- default: // literal escaped in quotes
1247
- return '(' + match.replace(/\'/g, "").replace(/(\.|\$|\^|\\|\/|\(|\)|\[|\]|\?|\+|\*)/g, function (m) { return "\\" + m; }) + ')?';
1248
- }
1249
- })
1250
- .replace(/\s/g, '\\s?') +
1251
- o.timeSuffix + '$',
1252
- order = getFormatPositions(f),
1253
- ampm = '',
1254
- treg;
1255
-
1256
- treg = s.match(new RegExp(regstr, 'i'));
1257
-
1258
- var resTime = {
1259
- hour: 0,
1260
- minute: 0,
1261
- second: 0,
1262
- millisec: 0,
1263
- microsec: 0
1264
- };
1265
-
1266
- if (treg) {
1267
- if (order.t !== -1) {
1268
- if (treg[order.t] === undefined || treg[order.t].length === 0) {
1269
- ampm = '';
1270
- resTime.ampm = '';
1271
- } else {
1272
- ampm = $.inArray(treg[order.t].toUpperCase(), $.map(o.amNames, function (x,i) { return x.toUpperCase(); })) !== -1 ? 'AM' : 'PM';
1273
- resTime.ampm = o[ampm === 'AM' ? 'amNames' : 'pmNames'][0];
1274
- }
1275
- }
1276
-
1277
- if (order.h !== -1) {
1278
- if (ampm === 'AM' && treg[order.h] === '12') {
1279
- resTime.hour = 0; // 12am = 0 hour
1280
- } else {
1281
- if (ampm === 'PM' && treg[order.h] !== '12') {
1282
- resTime.hour = parseInt(treg[order.h], 10) + 12; // 12pm = 12 hour, any other pm = hour + 12
1283
- } else {
1284
- resTime.hour = Number(treg[order.h]);
1285
- }
1286
- }
1287
- }
1288
-
1289
- if (order.m !== -1) {
1290
- resTime.minute = Number(treg[order.m]);
1291
- }
1292
- if (order.s !== -1) {
1293
- resTime.second = Number(treg[order.s]);
1294
- }
1295
- if (order.l !== -1) {
1296
- resTime.millisec = Number(treg[order.l]);
1297
- }
1298
- if (order.c !== -1) {
1299
- resTime.microsec = Number(treg[order.c]);
1300
- }
1301
- if (order.z !== -1 && treg[order.z] !== undefined) {
1302
- resTime.timezone = $.timepicker.timezoneOffsetNumber(treg[order.z]);
1303
- }
1304
-
1305
-
1306
- return resTime;
1307
- }
1308
- return false;
1309
- };// end strictParse
1310
-
1311
- // First try JS Date, if that fails, use strictParse
1312
- var looseParse = function (f, s, o) {
1313
- try {
1314
- var d = new Date('2012-01-01 ' + s);
1315
- if (isNaN(d.getTime())) {
1316
- d = new Date('2012-01-01T' + s);
1317
- if (isNaN(d.getTime())) {
1318
- d = new Date('01/01/2012 ' + s);
1319
- if (isNaN(d.getTime())) {
1320
- throw "Unable to parse time with native Date: " + s;
1321
- }
1322
- }
1323
- }
1324
-
1325
- return {
1326
- hour: d.getHours(),
1327
- minute: d.getMinutes(),
1328
- second: d.getSeconds(),
1329
- millisec: d.getMilliseconds(),
1330
- microsec: d.getMicroseconds(),
1331
- timezone: d.getTimezoneOffset() * -1
1332
- };
1333
- }
1334
- catch (err) {
1335
- try {
1336
- return strictParse(f, s, o);
1337
- }
1338
- catch (err2) {
1339
- $.timepicker.log("Unable to parse \ntimeString: " + s + "\ntimeFormat: " + f);
1340
- }
1341
- }
1342
- return false;
1343
- }; // end looseParse
1344
-
1345
- if (typeof o.parse === "function") {
1346
- return o.parse(timeFormat, timeString, o);
1347
- }
1348
- if (o.parse === 'loose') {
1349
- return looseParse(timeFormat, timeString, o);
1350
- }
1351
- return strictParse(timeFormat, timeString, o);
1352
- };
1353
-
1354
- /**
1355
- * Public utility to format the time
1356
- * @param {string} format format of the time
1357
- * @param {Object} time Object not a Date for timezones
1358
- * @param {Object} [options] essentially the regional[].. amNames, pmNames, ampm
1359
- * @returns {string} the formatted time
1360
- */
1361
- $.datepicker.formatTime = function (format, time, options) {
1362
- options = options || {};
1363
- options = $.extend({}, $.timepicker._defaults, options);
1364
- time = $.extend({
1365
- hour: 0,
1366
- minute: 0,
1367
- second: 0,
1368
- millisec: 0,
1369
- microsec: 0,
1370
- timezone: null
1371
- }, time);
1372
-
1373
- var tmptime = format,
1374
- ampmName = options.amNames[0],
1375
- hour = parseInt(time.hour, 10);
1376
-
1377
- if (hour > 11) {
1378
- ampmName = options.pmNames[0];
1379
- }
1380
-
1381
- tmptime = tmptime.replace(/(?:HH?|hh?|mm?|ss?|[tT]{1,2}|[zZ]|[lc]|'.*?')/g, function (match) {
1382
- switch (match) {
1383
- case 'HH':
1384
- return ('0' + hour).slice(-2);
1385
- case 'H':
1386
- return hour;
1387
- case 'hh':
1388
- return ('0' + convert24to12(hour)).slice(-2);
1389
- case 'h':
1390
- return convert24to12(hour);
1391
- case 'mm':
1392
- return ('0' + time.minute).slice(-2);
1393
- case 'm':
1394
- return time.minute;
1395
- case 'ss':
1396
- return ('0' + time.second).slice(-2);
1397
- case 's':
1398
- return time.second;
1399
- case 'l':
1400
- return ('00' + time.millisec).slice(-3);
1401
- case 'c':
1402
- return ('00' + time.microsec).slice(-3);
1403
- case 'z':
1404
- return $.timepicker.timezoneOffsetString(time.timezone === null ? options.timezone : time.timezone, false);
1405
- case 'Z':
1406
- return $.timepicker.timezoneOffsetString(time.timezone === null ? options.timezone : time.timezone, true);
1407
- case 'T':
1408
- return ampmName.charAt(0).toUpperCase();
1409
- case 'TT':
1410
- return ampmName.toUpperCase();
1411
- case 't':
1412
- return ampmName.charAt(0).toLowerCase();
1413
- case 'tt':
1414
- return ampmName.toLowerCase();
1415
- default:
1416
- return match.replace(/'/g, "");
1417
- }
1418
- });
1419
-
1420
- return tmptime;
1421
- };
1422
-
1423
- /*
1424
- * the bad hack :/ override datepicker so it doesn't close on select
1425
- // inspired: http://stackoverflow.com/questions/1252512/jquery-datepicker-prevent-closing-picker-when-clicking-a-date/1762378#1762378
1426
- */
1427
- $.datepicker._base_selectDate = $.datepicker._selectDate;
1428
- $.datepicker._selectDate = function (id, dateStr) {
1429
- var inst = this._getInst($(id)[0]),
1430
- tp_inst = this._get(inst, 'timepicker'),
1431
- was_inline;
1432
-
1433
- if (tp_inst && inst.settings.showTimepicker) {
1434
- tp_inst._limitMinMaxDateTime(inst, true);
1435
- was_inline = inst.inline;
1436
- inst.inline = inst.stay_open = true;
1437
- //This way the onSelect handler called from calendarpicker get the full dateTime
1438
- this._base_selectDate(id, dateStr);
1439
- inst.inline = was_inline;
1440
- inst.stay_open = false;
1441
- this._notifyChange(inst);
1442
- this._updateDatepicker(inst);
1443
- } else {
1444
- this._base_selectDate(id, dateStr);
1445
- }
1446
- };
1447
-
1448
- /*
1449
- * second bad hack :/ override datepicker so it triggers an event when changing the input field
1450
- * and does not redraw the datepicker on every selectDate event
1451
- */
1452
- $.datepicker._base_updateDatepicker = $.datepicker._updateDatepicker;
1453
- $.datepicker._updateDatepicker = function (inst) {
1454
-
1455
- // don't popup the datepicker if there is another instance already opened
1456
- var input = inst.input[0];
1457
- if ($.datepicker._curInst && $.datepicker._curInst !== inst && $.datepicker._datepickerShowing && $.datepicker._lastInput !== input) {
1458
- return;
1459
- }
1460
-
1461
- if (typeof(inst.stay_open) !== 'boolean' || inst.stay_open === false) {
1462
-
1463
- this._base_updateDatepicker(inst);
1464
-
1465
- // Reload the time control when changing something in the input text field.
1466
- var tp_inst = this._get(inst, 'timepicker');
1467
- if (tp_inst) {
1468
- tp_inst._addTimePicker(inst);
1469
- }
1470
- }
1471
- };
1472
-
1473
- /*
1474
- * third bad hack :/ override datepicker so it allows spaces and colon in the input field
1475
- */
1476
- $.datepicker._base_doKeyPress = $.datepicker._doKeyPress;
1477
- $.datepicker._doKeyPress = function (event) {
1478
- var inst = $.datepicker._getInst(event.target),
1479
- tp_inst = $.datepicker._get(inst, 'timepicker');
1480
-
1481
- if (tp_inst) {
1482
- if ($.datepicker._get(inst, 'constrainInput')) {
1483
- var ampm = tp_inst.support.ampm,
1484
- tz = tp_inst._defaults.showTimezone !== null ? tp_inst._defaults.showTimezone : tp_inst.support.timezone,
1485
- dateChars = $.datepicker._possibleChars($.datepicker._get(inst, 'dateFormat')),
1486
- datetimeChars = tp_inst._defaults.timeFormat.toString()
1487
- .replace(/[hms]/g, '')
1488
- .replace(/TT/g, ampm ? 'APM' : '')
1489
- .replace(/Tt/g, ampm ? 'AaPpMm' : '')
1490
- .replace(/tT/g, ampm ? 'AaPpMm' : '')
1491
- .replace(/T/g, ampm ? 'AP' : '')
1492
- .replace(/tt/g, ampm ? 'apm' : '')
1493
- .replace(/t/g, ampm ? 'ap' : '') +
1494
- " " + tp_inst._defaults.separator +
1495
- tp_inst._defaults.timeSuffix +
1496
- (tz ? tp_inst._defaults.timezoneList.join('') : '') +
1497
- (tp_inst._defaults.amNames.join('')) + (tp_inst._defaults.pmNames.join('')) +
1498
- dateChars,
1499
- chr = String.fromCharCode(event.charCode === undefined ? event.keyCode : event.charCode);
1500
- return event.ctrlKey || (chr < ' ' || !dateChars || datetimeChars.indexOf(chr) > -1);
1501
- }
1502
- }
1503
-
1504
- return $.datepicker._base_doKeyPress(event);
1505
- };
1506
-
1507
- /*
1508
- * Fourth bad hack :/ override _updateAlternate function used in inline mode to init altField
1509
- * Update any alternate field to synchronise with the main field.
1510
- */
1511
- $.datepicker._base_updateAlternate = $.datepicker._updateAlternate;
1512
- $.datepicker._updateAlternate = function (inst) {
1513
- var tp_inst = this._get(inst, 'timepicker');
1514
- if (tp_inst) {
1515
- var altField = tp_inst._defaults.altField;
1516
- if (altField) { // update alternate field too
1517
- var altFormat = tp_inst._defaults.altFormat || tp_inst._defaults.dateFormat,
1518
- date = this._getDate(inst),
1519
- formatCfg = $.datepicker._getFormatConfig(inst),
1520
- altFormattedDateTime = '',
1521
- altSeparator = tp_inst._defaults.altSeparator ? tp_inst._defaults.altSeparator : tp_inst._defaults.separator,
1522
- altTimeSuffix = tp_inst._defaults.altTimeSuffix ? tp_inst._defaults.altTimeSuffix : tp_inst._defaults.timeSuffix,
1523
- altTimeFormat = tp_inst._defaults.altTimeFormat !== null ? tp_inst._defaults.altTimeFormat : tp_inst._defaults.timeFormat;
1524
-
1525
- altFormattedDateTime += $.datepicker.formatTime(altTimeFormat, tp_inst, tp_inst._defaults) + altTimeSuffix;
1526
- if (!tp_inst._defaults.timeOnly && !tp_inst._defaults.altFieldTimeOnly && date !== null) {
1527
- if (tp_inst._defaults.altFormat) {
1528
- altFormattedDateTime = $.datepicker.formatDate(tp_inst._defaults.altFormat, date, formatCfg) + altSeparator + altFormattedDateTime;
1529
- }
1530
- else {
1531
- altFormattedDateTime = tp_inst.formattedDate + altSeparator + altFormattedDateTime;
1532
- }
1533
- }
1534
- $(altField).val( inst.input.val() ? altFormattedDateTime : "");
1535
- }
1536
- }
1537
- else {
1538
- $.datepicker._base_updateAlternate(inst);
1539
- }
1540
- };
1541
-
1542
- /*
1543
- * Override key up event to sync manual input changes.
1544
- */
1545
- $.datepicker._base_doKeyUp = $.datepicker._doKeyUp;
1546
- $.datepicker._doKeyUp = function (event) {
1547
- var inst = $.datepicker._getInst(event.target),
1548
- tp_inst = $.datepicker._get(inst, 'timepicker');
1549
-
1550
- if (tp_inst) {
1551
- if (tp_inst._defaults.timeOnly && (inst.input.val() !== inst.lastVal)) {
1552
- try {
1553
- $.datepicker._updateDatepicker(inst);
1554
- } catch (err) {
1555
- $.timepicker.log(err);
1556
- }
1557
- }
1558
- }
1559
-
1560
- return $.datepicker._base_doKeyUp(event);
1561
- };
1562
-
1563
- /*
1564
- * override "Today" button to also grab the time and set it to input field.
1565
- */
1566
- $.datepicker._base_gotoToday = $.datepicker._gotoToday;
1567
- $.datepicker._gotoToday = function (id) {
1568
- var inst = this._getInst($(id)[0]);
1569
- this._base_gotoToday(id);
1570
- var tp_inst = this._get(inst, 'timepicker');
1571
- if (!tp_inst) {
1572
- return;
1573
- }
1574
-
1575
- var tzoffset = $.timepicker.timezoneOffsetNumber(tp_inst.timezone);
1576
- var now = new Date();
1577
- now.setMinutes(now.getMinutes() + now.getTimezoneOffset() + parseInt(tzoffset, 10));
1578
- this._setTime(inst, now);
1579
- this._setDate(inst, now);
1580
- tp_inst._onSelectHandler();
1581
- };
1582
-
1583
- /*
1584
- * Disable & enable the Time in the datetimepicker
1585
- */
1586
- $.datepicker._disableTimepickerDatepicker = function (target) {
1587
- var inst = this._getInst(target);
1588
- if (!inst) {
1589
- return;
1590
- }
1591
-
1592
- var tp_inst = this._get(inst, 'timepicker');
1593
- $(target).datepicker('getDate'); // Init selected[Year|Month|Day]
1594
- if (tp_inst) {
1595
- inst.settings.showTimepicker = false;
1596
- tp_inst._defaults.showTimepicker = false;
1597
- tp_inst._updateDateTime(inst);
1598
- }
1599
- };
1600
-
1601
- $.datepicker._enableTimepickerDatepicker = function (target) {
1602
- var inst = this._getInst(target);
1603
- if (!inst) {
1604
- return;
1605
- }
1606
-
1607
- var tp_inst = this._get(inst, 'timepicker');
1608
- $(target).datepicker('getDate'); // Init selected[Year|Month|Day]
1609
- if (tp_inst) {
1610
- inst.settings.showTimepicker = true;
1611
- tp_inst._defaults.showTimepicker = true;
1612
- tp_inst._addTimePicker(inst); // Could be disabled on page load
1613
- tp_inst._updateDateTime(inst);
1614
- }
1615
- };
1616
-
1617
- /*
1618
- * Create our own set time function
1619
- */
1620
- $.datepicker._setTime = function (inst, date) {
1621
- var tp_inst = this._get(inst, 'timepicker');
1622
- if (tp_inst) {
1623
- var defaults = tp_inst._defaults;
1624
-
1625
- // calling _setTime with no date sets time to defaults
1626
- tp_inst.hour = date ? date.getHours() : defaults.hour;
1627
- tp_inst.minute = date ? date.getMinutes() : defaults.minute;
1628
- tp_inst.second = date ? date.getSeconds() : defaults.second;
1629
- tp_inst.millisec = date ? date.getMilliseconds() : defaults.millisec;
1630
- tp_inst.microsec = date ? date.getMicroseconds() : defaults.microsec;
1631
-
1632
- //check if within min/max times..
1633
- tp_inst._limitMinMaxDateTime(inst, true);
1634
-
1635
- tp_inst._onTimeChange();
1636
- tp_inst._updateDateTime(inst);
1637
- }
1638
- };
1639
-
1640
- /*
1641
- * Create new public method to set only time, callable as $().datepicker('setTime', date)
1642
- */
1643
- $.datepicker._setTimeDatepicker = function (target, date, withDate) {
1644
- var inst = this._getInst(target);
1645
- if (!inst) {
1646
- return;
1647
- }
1648
-
1649
- var tp_inst = this._get(inst, 'timepicker');
1650
-
1651
- if (tp_inst) {
1652
- this._setDateFromField(inst);
1653
- var tp_date;
1654
- if (date) {
1655
- if (typeof date === "string") {
1656
- tp_inst._parseTime(date, withDate);
1657
- tp_date = new Date();
1658
- tp_date.setHours(tp_inst.hour, tp_inst.minute, tp_inst.second, tp_inst.millisec);
1659
- tp_date.setMicroseconds(tp_inst.microsec);
1660
- } else {
1661
- tp_date = new Date(date.getTime());
1662
- tp_date.setMicroseconds(date.getMicroseconds());
1663
- }
1664
- if (tp_date.toString() === 'Invalid Date') {
1665
- tp_date = undefined;
1666
- }
1667
- this._setTime(inst, tp_date);
1668
- }
1669
- }
1670
-
1671
- };
1672
-
1673
- /*
1674
- * override setDate() to allow setting time too within Date object
1675
- */
1676
- $.datepicker._base_setDateDatepicker = $.datepicker._setDateDatepicker;
1677
- $.datepicker._setDateDatepicker = function (target, _date) {
1678
- var inst = this._getInst(target);
1679
- var date = _date;
1680
- if (!inst) {
1681
- return;
1682
- }
1683
-
1684
- if (typeof(_date) === 'string') {
1685
- date = new Date(_date);
1686
- if (!date.getTime()) {
1687
- this._base_setDateDatepicker.apply(this, arguments);
1688
- date = $(target).datepicker('getDate');
1689
- }
1690
- }
1691
-
1692
- var tp_inst = this._get(inst, 'timepicker');
1693
- var tp_date;
1694
- if (date instanceof Date) {
1695
- tp_date = new Date(date.getTime());
1696
- tp_date.setMicroseconds(date.getMicroseconds());
1697
- } else {
1698
- tp_date = date;
1699
- }
1700
-
1701
- // This is important if you are using the timezone option, javascript's Date
1702
- // object will only return the timezone offset for the current locale, so we
1703
- // adjust it accordingly. If not using timezone option this won't matter..
1704
- // If a timezone is different in tp, keep the timezone as is
1705
- if (tp_inst && tp_date) {
1706
- // look out for DST if tz wasn't specified
1707
- if (!tp_inst.support.timezone && tp_inst._defaults.timezone === null) {
1708
- tp_inst.timezone = tp_date.getTimezoneOffset() * -1;
1709
- }
1710
- date = $.timepicker.timezoneAdjust(date, $.timepicker.timezoneOffsetString(-date.getTimezoneOffset()), tp_inst.timezone);
1711
- tp_date = $.timepicker.timezoneAdjust(tp_date, $.timepicker.timezoneOffsetString(-tp_date.getTimezoneOffset()), tp_inst.timezone);
1712
- }
1713
-
1714
- this._updateDatepicker(inst);
1715
- this._base_setDateDatepicker.apply(this, arguments);
1716
- this._setTimeDatepicker(target, tp_date, true);
1717
- };
1718
-
1719
- /*
1720
- * override getDate() to allow getting time too within Date object
1721
- */
1722
- $.datepicker._base_getDateDatepicker = $.datepicker._getDateDatepicker;
1723
- $.datepicker._getDateDatepicker = function (target, noDefault) {
1724
- var inst = this._getInst(target);
1725
- if (!inst) {
1726
- return;
1727
- }
1728
-
1729
- var tp_inst = this._get(inst, 'timepicker');
1730
-
1731
- if (tp_inst) {
1732
- // if it hasn't yet been defined, grab from field
1733
- if (inst.lastVal === undefined) {
1734
- this._setDateFromField(inst, noDefault);
1735
- }
1736
-
1737
- var date = this._getDate(inst);
1738
-
1739
- var currDT = null;
1740
-
1741
- if (tp_inst.$altInput && tp_inst._defaults.altFieldTimeOnly) {
1742
- currDT = tp_inst.$input.val() + ' ' + tp_inst.$altInput.val();
1743
- }
1744
- else if (tp_inst.$input.get(0).tagName !== 'INPUT' && tp_inst.$altInput) {
1745
- /**
1746
- * in case the datetimepicker has been applied to a non-input tag for inline UI,
1747
- * and the user has not configured the plugin to display only time in altInput,
1748
- * pick current date time from the altInput (and hope for the best, for now, until "ER1" is applied)
1749
- *
1750
- * @todo ER1. Since altInput can have a totally difference format, convert it to standard format by reading input format from "altFormat" and "altTimeFormat" option values
1751
- */
1752
- currDT = tp_inst.$altInput.val();
1753
- }
1754
- else {
1755
- currDT = tp_inst.$input.val();
1756
- }
1757
-
1758
- if (date && tp_inst._parseTime(currDT, !inst.settings.timeOnly)) {
1759
- date.setHours(tp_inst.hour, tp_inst.minute, tp_inst.second, tp_inst.millisec);
1760
- date.setMicroseconds(tp_inst.microsec);
1761
-
1762
- // This is important if you are using the timezone option, javascript's Date
1763
- // object will only return the timezone offset for the current locale, so we
1764
- // adjust it accordingly. If not using timezone option this won't matter..
1765
- if (tp_inst.timezone != null) {
1766
- // look out for DST if tz wasn't specified
1767
- if (!tp_inst.support.timezone && tp_inst._defaults.timezone === null) {
1768
- tp_inst.timezone = date.getTimezoneOffset() * -1;
1769
- }
1770
- date = $.timepicker.timezoneAdjust(date, tp_inst.timezone, $.timepicker.timezoneOffsetString(-date.getTimezoneOffset()));
1771
- }
1772
- }
1773
- return date;
1774
- }
1775
- return this._base_getDateDatepicker(target, noDefault);
1776
- };
1777
-
1778
- /*
1779
- * override parseDate() because UI 1.8.14 throws an error about "Extra characters"
1780
- * An option in datapicker to ignore extra format characters would be nicer.
1781
- */
1782
- $.datepicker._base_parseDate = $.datepicker.parseDate;
1783
- $.datepicker.parseDate = function (format, value, settings) {
1784
- var date;
1785
- try {
1786
- date = this._base_parseDate(format, value, settings);
1787
- } catch (err) {
1788
- // Hack! The error message ends with a colon, a space, and
1789
- // the "extra" characters. We rely on that instead of
1790
- // attempting to perfectly reproduce the parsing algorithm.
1791
- if (err.indexOf(":") >= 0) {
1792
- date = this._base_parseDate(format, value.substring(0, value.length - (err.length - err.indexOf(':') - 2)), settings);
1793
- $.timepicker.log("Error parsing the date string: " + err + "\ndate string = " + value + "\ndate format = " + format);
1794
- } else {
1795
- throw err;
1796
- }
1797
- }
1798
- return date;
1799
- };
1800
-
1801
- /*
1802
- * override formatDate to set date with time to the input
1803
- */
1804
- $.datepicker._base_formatDate = $.datepicker._formatDate;
1805
- $.datepicker._formatDate = function (inst, day, month, year) {
1806
- var tp_inst = this._get(inst, 'timepicker');
1807
- if (tp_inst) {
1808
- tp_inst._updateDateTime(inst);
1809
- return tp_inst.$input.val();
1810
- }
1811
- return this._base_formatDate(inst);
1812
- };
1813
-
1814
- /*
1815
- * override options setter to add time to maxDate(Time) and minDate(Time). MaxDate
1816
- */
1817
- $.datepicker._base_optionDatepicker = $.datepicker._optionDatepicker;
1818
- $.datepicker._optionDatepicker = function (target, name, value) {
1819
- var inst = this._getInst(target),
1820
- name_clone;
1821
- if (!inst) {
1822
- return null;
1823
- }
1824
-
1825
- var tp_inst = this._get(inst, 'timepicker');
1826
- if (tp_inst) {
1827
- var min = null,
1828
- max = null,
1829
- onselect = null,
1830
- overrides = tp_inst._defaults.evnts,
1831
- fns = {},
1832
- prop,
1833
- ret,
1834
- oldVal,
1835
- $target;
1836
- if (typeof name === 'string') { // if min/max was set with the string
1837
- if (name === 'minDate' || name === 'minDateTime') {
1838
- min = value;
1839
- } else if (name === 'maxDate' || name === 'maxDateTime') {
1840
- max = value;
1841
- } else if (name === 'onSelect') {
1842
- onselect = value;
1843
- } else if (overrides.hasOwnProperty(name)) {
1844
- if (typeof (value) === 'undefined') {
1845
- return overrides[name];
1846
- }
1847
- fns[name] = value;
1848
- name_clone = {}; //empty results in exiting function after overrides updated
1849
- }
1850
- } else if (typeof name === 'object') { //if min/max was set with the JSON
1851
- if (name.minDate) {
1852
- min = name.minDate;
1853
- } else if (name.minDateTime) {
1854
- min = name.minDateTime;
1855
- } else if (name.maxDate) {
1856
- max = name.maxDate;
1857
- } else if (name.maxDateTime) {
1858
- max = name.maxDateTime;
1859
- }
1860
- for (prop in overrides) {
1861
- if (overrides.hasOwnProperty(prop) && name[prop]) {
1862
- fns[prop] = name[prop];
1863
- }
1864
- }
1865
- }
1866
- for (prop in fns) {
1867
- if (fns.hasOwnProperty(prop)) {
1868
- overrides[prop] = fns[prop];
1869
- if (!name_clone) { name_clone = $.extend({}, name); }
1870
- delete name_clone[prop];
1871
- }
1872
- }
1873
- if (name_clone && isEmptyObject(name_clone)) { return; }
1874
- if (min) { //if min was set
1875
- if (min === 0) {
1876
- min = new Date();
1877
- } else {
1878
- min = new Date(min);
1879
- }
1880
- tp_inst._defaults.minDate = min;
1881
- tp_inst._defaults.minDateTime = min;
1882
- } else if (max) { //if max was set
1883
- if (max === 0) {
1884
- max = new Date();
1885
- } else {
1886
- max = new Date(max);
1887
- }
1888
- tp_inst._defaults.maxDate = max;
1889
- tp_inst._defaults.maxDateTime = max;
1890
- } else if (onselect) {
1891
- tp_inst._defaults.onSelect = onselect;
1892
- }
1893
-
1894
- // Datepicker will override our date when we call _base_optionDatepicker when
1895
- // calling minDate/maxDate, so we will first grab the value, call
1896
- // _base_optionDatepicker, then set our value back.
1897
- if(min || max){
1898
- $target = $(target);
1899
- oldVal = $target.datetimepicker('getDate');
1900
- ret = this._base_optionDatepicker.call($.datepicker, target, name_clone || name, value);
1901
- $target.datetimepicker('setDate', oldVal);
1902
- return ret;
1903
- }
1904
- }
1905
- if (value === undefined) {
1906
- return this._base_optionDatepicker.call($.datepicker, target, name);
1907
- }
1908
- return this._base_optionDatepicker.call($.datepicker, target, name_clone || name, value);
1909
- };
1910
-
1911
- /*
1912
- * jQuery isEmptyObject does not check hasOwnProperty - if someone has added to the object prototype,
1913
- * it will return false for all objects
1914
- */
1915
- var isEmptyObject = function (obj) {
1916
- var prop;
1917
- for (prop in obj) {
1918
- if (obj.hasOwnProperty(prop)) {
1919
- return false;
1920
- }
1921
- }
1922
- return true;
1923
- };
1924
-
1925
- /*
1926
- * jQuery extend now ignores nulls!
1927
- */
1928
- var extendRemove = function (target, props) {
1929
- $.extend(target, props);
1930
- for (var name in props) {
1931
- if (props[name] === null || props[name] === undefined) {
1932
- target[name] = props[name];
1933
- }
1934
- }
1935
- return target;
1936
- };
1937
-
1938
- /*
1939
- * Determine by the time format which units are supported
1940
- * Returns an object of booleans for each unit
1941
- */
1942
- var detectSupport = function (timeFormat) {
1943
- var tf = timeFormat.replace(/'.*?'/g, '').toLowerCase(), // removes literals
1944
- isIn = function (f, t) { // does the format contain the token?
1945
- return f.indexOf(t) !== -1 ? true : false;
1946
- };
1947
- return {
1948
- hour: isIn(tf, 'h'),
1949
- minute: isIn(tf, 'm'),
1950
- second: isIn(tf, 's'),
1951
- millisec: isIn(tf, 'l'),
1952
- microsec: isIn(tf, 'c'),
1953
- timezone: isIn(tf, 'z'),
1954
- ampm: isIn(tf, 't') && isIn(timeFormat, 'h'),
1955
- iso8601: isIn(timeFormat, 'Z')
1956
- };
1957
- };
1958
-
1959
- /*
1960
- * Converts 24 hour format into 12 hour
1961
- * Returns 12 hour without leading 0
1962
- */
1963
- var convert24to12 = function (hour) {
1964
- hour %= 12;
1965
-
1966
- if (hour === 0) {
1967
- hour = 12;
1968
- }
1969
-
1970
- return String(hour);
1971
- };
1972
-
1973
- var computeEffectiveSetting = function (settings, property) {
1974
- return settings && settings[property] ? settings[property] : $.timepicker._defaults[property];
1975
- };
1976
-
1977
- /*
1978
- * Splits datetime string into date and time substrings.
1979
- * Throws exception when date can't be parsed
1980
- * Returns {dateString: dateString, timeString: timeString}
1981
- */
1982
- var splitDateTime = function (dateTimeString, timeSettings) {
1983
- // The idea is to get the number separator occurrences in datetime and the time format requested (since time has
1984
- // fewer unknowns, mostly numbers and am/pm). We will use the time pattern to split.
1985
- var separator = computeEffectiveSetting(timeSettings, 'separator'),
1986
- format = computeEffectiveSetting(timeSettings, 'timeFormat'),
1987
- timeParts = format.split(separator), // how many occurrences of separator may be in our format?
1988
- timePartsLen = timeParts.length,
1989
- allParts = dateTimeString.split(separator),
1990
- allPartsLen = allParts.length;
1991
-
1992
- if (allPartsLen > 1) {
1993
- return {
1994
- dateString: allParts.splice(0, allPartsLen - timePartsLen).join(separator),
1995
- timeString: allParts.splice(0, timePartsLen).join(separator)
1996
- };
1997
- }
1998
-
1999
- return {
2000
- dateString: dateTimeString,
2001
- timeString: ''
2002
- };
2003
- };
2004
-
2005
- /*
2006
- * Internal function to parse datetime interval
2007
- * Returns: {date: Date, timeObj: Object}, where
2008
- * date - parsed date without time (type Date)
2009
- * timeObj = {hour: , minute: , second: , millisec: , microsec: } - parsed time. Optional
2010
- */
2011
- var parseDateTimeInternal = function (dateFormat, timeFormat, dateTimeString, dateSettings, timeSettings) {
2012
- var date,
2013
- parts,
2014
- parsedTime;
2015
-
2016
- parts = splitDateTime(dateTimeString, timeSettings);
2017
- date = $.datepicker._base_parseDate(dateFormat, parts.dateString, dateSettings);
2018
-
2019
- if (parts.timeString === '') {
2020
- return {
2021
- date: date
2022
- };
2023
- }
2024
-
2025
- parsedTime = $.datepicker.parseTime(timeFormat, parts.timeString, timeSettings);
2026
-
2027
- if (!parsedTime) {
2028
- throw 'Wrong time format';
2029
- }
2030
-
2031
- return {
2032
- date: date,
2033
- timeObj: parsedTime
2034
- };
2035
- };
2036
-
2037
- /*
2038
- * Internal function to set timezone_select to the local timezone
2039
- */
2040
- var selectLocalTimezone = function (tp_inst, date) {
2041
- if (tp_inst && tp_inst.timezone_select) {
2042
- var now = date || new Date();
2043
- tp_inst.timezone_select.val(-now.getTimezoneOffset());
2044
- }
2045
- };
2046
-
2047
- /*
2048
- * Create a Singleton Instance
2049
- */
2050
- $.timepicker = new Timepicker();
2051
-
2052
- /**
2053
- * Get the timezone offset as string from a date object (eg '+0530' for UTC+5.5)
2054
- * @param {number} tzMinutes if not a number, less than -720 (-1200), or greater than 840 (+1400) this value is returned
2055
- * @param {boolean} iso8601 if true formats in accordance to iso8601 "+12:45"
2056
- * @return {string}
2057
- */
2058
- $.timepicker.timezoneOffsetString = function (tzMinutes, iso8601) {
2059
- if (isNaN(tzMinutes) || tzMinutes > 840 || tzMinutes < -720) {
2060
- return tzMinutes;
2061
- }
2062
-
2063
- var off = tzMinutes,
2064
- minutes = off % 60,
2065
- hours = (off - minutes) / 60,
2066
- iso = iso8601 ? ':' : '',
2067
- tz = (off >= 0 ? '+' : '-') + ('0' + Math.abs(hours)).slice(-2) + iso + ('0' + Math.abs(minutes)).slice(-2);
2068
-
2069
- if (tz === '+00:00') {
2070
- return 'Z';
2071
- }
2072
- return tz;
2073
- };
2074
-
2075
- /**
2076
- * Get the number in minutes that represents a timezone string
2077
- * @param {string} tzString formatted like "+0500", "-1245", "Z"
2078
- * @return {number} the offset minutes or the original string if it doesn't match expectations
2079
- */
2080
- $.timepicker.timezoneOffsetNumber = function (tzString) {
2081
- var normalized = tzString.toString().replace(':', ''); // excuse any iso8601, end up with "+1245"
2082
-
2083
- if (normalized.toUpperCase() === 'Z') { // if iso8601 with Z, its 0 minute offset
2084
- return 0;
2085
- }
2086
-
2087
- if (!/^(\-|\+)\d{4}$/.test(normalized)) { // possibly a user defined tz, so just give it back
2088
- return parseInt(tzString, 10);
2089
- }
2090
-
2091
- return ((normalized.substr(0, 1) === '-' ? -1 : 1) * // plus or minus
2092
- ((parseInt(normalized.substr(1, 2), 10) * 60) + // hours (converted to minutes)
2093
- parseInt(normalized.substr(3, 2), 10))); // minutes
2094
- };
2095
-
2096
- /**
2097
- * No way to set timezone in js Date, so we must adjust the minutes to compensate. (think setDate, getDate)
2098
- * @param {Date} date
2099
- * @param {string} fromTimezone formatted like "+0500", "-1245"
2100
- * @param {string} toTimezone formatted like "+0500", "-1245"
2101
- * @return {Date}
2102
- */
2103
- $.timepicker.timezoneAdjust = function (date, fromTimezone, toTimezone) {
2104
- var fromTz = $.timepicker.timezoneOffsetNumber(fromTimezone);
2105
- var toTz = $.timepicker.timezoneOffsetNumber(toTimezone);
2106
- if (!isNaN(toTz)) {
2107
- date.setMinutes(date.getMinutes() + (-fromTz) - (-toTz));
2108
- }
2109
- return date;
2110
- };
2111
-
2112
- /**
2113
- * Calls `timepicker()` on the `startTime` and `endTime` elements, and configures them to
2114
- * enforce date range limits.
2115
- * n.b. The input value must be correctly formatted (reformatting is not supported)
2116
- * @param {Element} startTime
2117
- * @param {Element} endTime
2118
- * @param {Object} options Options for the timepicker() call
2119
- * @return {jQuery}
2120
- */
2121
- $.timepicker.timeRange = function (startTime, endTime, options) {
2122
- return $.timepicker.handleRange('timepicker', startTime, endTime, options);
2123
- };
2124
-
2125
- /**
2126
- * Calls `datetimepicker` on the `startTime` and `endTime` elements, and configures them to
2127
- * enforce date range limits.
2128
- * @param {Element} startTime
2129
- * @param {Element} endTime
2130
- * @param {Object} options Options for the `timepicker()` call. Also supports `reformat`,
2131
- * a boolean value that can be used to reformat the input values to the `dateFormat`.
2132
- * @param {string} method Can be used to specify the type of picker to be added
2133
- * @return {jQuery}
2134
- */
2135
- $.timepicker.datetimeRange = function (startTime, endTime, options) {
2136
- $.timepicker.handleRange('datetimepicker', startTime, endTime, options);
2137
- };
2138
-
2139
- /**
2140
- * Calls `datepicker` on the `startTime` and `endTime` elements, and configures them to
2141
- * enforce date range limits.
2142
- * @param {Element} startTime
2143
- * @param {Element} endTime
2144
- * @param {Object} options Options for the `timepicker()` call. Also supports `reformat`,
2145
- * a boolean value that can be used to reformat the input values to the `dateFormat`.
2146
- * @return {jQuery}
2147
- */
2148
- $.timepicker.dateRange = function (startTime, endTime, options) {
2149
- $.timepicker.handleRange('datepicker', startTime, endTime, options);
2150
- };
2151
-
2152
- /**
2153
- * Calls `method` on the `startTime` and `endTime` elements, and configures them to
2154
- * enforce date range limits.
2155
- * @param {string} method Can be used to specify the type of picker to be added
2156
- * @param {Element} startTime
2157
- * @param {Element} endTime
2158
- * @param {Object} options Options for the `timepicker()` call. Also supports `reformat`,
2159
- * a boolean value that can be used to reformat the input values to the `dateFormat`.
2160
- * @return {jQuery}
2161
- */
2162
- $.timepicker.handleRange = function (method, startTime, endTime, options) {
2163
- options = $.extend({}, {
2164
- minInterval: 0, // min allowed interval in milliseconds
2165
- maxInterval: 0, // max allowed interval in milliseconds
2166
- start: {}, // options for start picker
2167
- end: {} // options for end picker
2168
- }, options);
2169
-
2170
- // for the mean time this fixes an issue with calling getDate with timepicker()
2171
- var timeOnly = false;
2172
- if(method === 'timepicker'){
2173
- timeOnly = true;
2174
- method = 'datetimepicker';
2175
- }
2176
-
2177
- function checkDates(changed, other) {
2178
- var startdt = startTime[method]('getDate'),
2179
- enddt = endTime[method]('getDate'),
2180
- changeddt = changed[method]('getDate');
2181
-
2182
- if (startdt !== null) {
2183
- var minDate = new Date(startdt.getTime()),
2184
- maxDate = new Date(startdt.getTime());
2185
-
2186
- minDate.setMilliseconds(minDate.getMilliseconds() + options.minInterval);
2187
- maxDate.setMilliseconds(maxDate.getMilliseconds() + options.maxInterval);
2188
-
2189
- if (options.minInterval > 0 && minDate > enddt) { // minInterval check
2190
- endTime[method]('setDate', minDate);
2191
- }
2192
- else if (options.maxInterval > 0 && maxDate < enddt) { // max interval check
2193
- endTime[method]('setDate', maxDate);
2194
- }
2195
- else if (startdt > enddt) {
2196
- other[method]('setDate', changeddt);
2197
- }
2198
- }
2199
- }
2200
-
2201
- function selected(changed, other, option) {
2202
- if (!changed.val()) {
2203
- return;
2204
- }
2205
- var date = changed[method].call(changed, 'getDate');
2206
- if (date !== null && options.minInterval > 0) {
2207
- if (option === 'minDate') {
2208
- date.setMilliseconds(date.getMilliseconds() + options.minInterval);
2209
- }
2210
- if (option === 'maxDate') {
2211
- date.setMilliseconds(date.getMilliseconds() - options.minInterval);
2212
- }
2213
- }
2214
-
2215
- if (date.getTime) {
2216
- other[method].call(other, 'option', option, date);
2217
- }
2218
- }
2219
-
2220
- $.fn[method].call(startTime, $.extend({
2221
- timeOnly: timeOnly,
2222
- onClose: function (dateText, inst) {
2223
- checkDates($(this), endTime);
2224
- },
2225
- onSelect: function (selectedDateTime) {
2226
- selected($(this), endTime, 'minDate');
2227
- }
2228
- }, options, options.start));
2229
- $.fn[method].call(endTime, $.extend({
2230
- timeOnly: timeOnly,
2231
- onClose: function (dateText, inst) {
2232
- checkDates($(this), startTime);
2233
- },
2234
- onSelect: function (selectedDateTime) {
2235
- selected($(this), startTime, 'maxDate');
2236
- }
2237
- }, options, options.end));
2238
-
2239
- checkDates(startTime, endTime);
2240
-
2241
- selected(startTime, endTime, 'minDate');
2242
- selected(endTime, startTime, 'maxDate');
2243
-
2244
- return $([startTime.get(0), endTime.get(0)]);
2245
- };
2246
-
2247
- /**
2248
- * Log error or data to the console during error or debugging
2249
- * @param {Object} err pass any type object to log to the console during error or debugging
2250
- * @return {void}
2251
- */
2252
- $.timepicker.log = function () {
2253
- // Older IE (9, maybe 10) throw error on accessing `window.console.log.apply`, so check first.
2254
- if (window.console && window.console.log && window.console.log.apply) {
2255
- window.console.log.apply(window.console, Array.prototype.slice.call(arguments));
2256
- }
2257
- };
2258
-
2259
- /*
2260
- * Add util object to allow access to private methods for testability.
2261
- */
2262
- $.timepicker._util = {
2263
- _extendRemove: extendRemove,
2264
- _isEmptyObject: isEmptyObject,
2265
- _convert24to12: convert24to12,
2266
- _detectSupport: detectSupport,
2267
- _selectLocalTimezone: selectLocalTimezone,
2268
- _computeEffectiveSetting: computeEffectiveSetting,
2269
- _splitDateTime: splitDateTime,
2270
- _parseDateTimeInternal: parseDateTimeInternal
2271
- };
2272
-
2273
- /*
2274
- * Microsecond support
2275
- */
2276
- if (!Date.prototype.getMicroseconds) {
2277
- Date.prototype.microseconds = 0;
2278
- Date.prototype.getMicroseconds = function () { return this.microseconds; };
2279
- Date.prototype.setMicroseconds = function (m) {
2280
- this.setMilliseconds(this.getMilliseconds() + Math.floor(m / 1000));
2281
- this.microseconds = m % 1000;
2282
- return this;
2283
- };
2284
- }
2285
-
2286
- /*
2287
- * Keep up with the version
2288
- */
2289
- $.timepicker.version = "1.6.3";
2290
-
2291
- }));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/pretty-link-pro.php DELETED
@@ -1,99 +0,0 @@
1
- <?php
2
- if(!defined('ABSPATH')) { die('You are not allowed to call this page directly.'); }
3
-
4
- define('PLP_PATH', PRLI_PATH.'/pro');
5
- define('PLP_CONTROLLERS_PATH', PLP_PATH.'/app/controllers');
6
- define('PLP_MODELS_PATH', PLP_PATH.'/app/models');
7
- define('PLP_VIEWS_PATH', PLP_PATH.'/app/views');
8
- define('PLP_HELPERS_PATH', PLP_PATH.'/app/helpers');
9
- define('PLP_WIDGETS_PATH', PLP_PATH.'/app/widgets');
10
- define('PLP_LIB_PATH', PLP_PATH.'/app/lib');
11
- define('PLP_I18N_PATH', PLP_PATH.'/i18n');
12
- define('PLP_CSS_PATH', PLP_PATH.'/css');
13
- define('PLP_IMAGES_PATH', PLP_PATH.'/images');
14
- define('PLP_JS_PATH', PLP_PATH.'/js');
15
- define('PLP_INCLUDES_PATH', PLP_PATH.'/includes');
16
- define('PLP_VENDOR_PATH', PLP_PATH.'/vendor');
17
-
18
- define('PLP_URL', PRLI_URL.'/pro');
19
- define('PLP_CONTROLLERS_URL', PLP_URL.'/app/controllers');
20
- define('PLP_MODELS_URL', PLP_URL.'/app/models');
21
- define('PLP_VIEWS_URL', PLP_URL.'/app/views');
22
- define('PLP_HELPERS_URL', PLP_URL.'/app/helpers');
23
- define('PLP_WIDGETS_URL', PLP_URL.'/app/widgets');
24
- define('PLP_LIB_URL', PLP_URL.'/app/lib');
25
- define('PLP_I18N_URL', PLP_URL.'/i18n');
26
- define('PLP_CSS_URL', PLP_URL.'/css');
27
- define('PLP_IMAGES_URL', PLP_URL.'/images');
28
- define('PLP_JS_URL', PLP_URL.'/js');
29
- define('PLP_INCLUDES_URL', PLP_URL.'/includes');
30
- define('PLP_VENDOR_URL', PLP_URL.'/vendor');
31
-
32
- // Autoload all the requisite classes
33
- function plp_autoloader($class) {
34
- // Only load Pretty Link classes here
35
- if(preg_match('/^Plp.+$/', $class)) {
36
- if(preg_match('/^.+Controller$/', $class)) {
37
- $filepath = PLP_CONTROLLERS_PATH."/{$class}.php";
38
- }
39
- else if(preg_match('/^.+Helper$/', $class)) {
40
- $filepath = PLP_HELPERS_PATH."/{$class}.php";
41
- }
42
- else if(preg_match('/^.+Widget$/', $class)) {
43
- $filepath = PLP_WIDGETS_PATH."/{$class}.php";
44
- }
45
- else {
46
- $filepath = PLP_MODELS_PATH."/{$class}.php";
47
-
48
- // Now let's try the lib dir if its not a model
49
- if(!file_exists($filepath)) {
50
- $filepath = PLP_LIB_PATH."/{$class}.php";
51
- }
52
- }
53
-
54
- if(file_exists($filepath)) {
55
- require_once($filepath);
56
- }
57
- }
58
- }
59
-
60
- // if __autoload is active, put it on the spl_autoload stack
61
- if(is_array(spl_autoload_functions()) && in_array('__autoload', spl_autoload_functions())) {
62
- spl_autoload_register('__autoload');
63
- }
64
-
65
- // Add the autoloader
66
- spl_autoload_register('plp_autoloader');
67
-
68
- global $plp_keyword, $plp_report, $plp_url_replacement, $plp_link_rotation;
69
-
70
- $plp_keyword = new PlpKeyword();
71
- $plp_report = new PlpReport();
72
- $plp_url_replacement = new PlpUrlReplacement();
73
- $plp_link_rotation = new PlpLinkRotation();
74
-
75
- global $plp_options;
76
- $plp_options = PlpOptions::get_options();
77
-
78
- // Modify for blogurl customization
79
- $prli_blogurl = (($plp_options->use_prettylink_url)?$plp_options->prettylink_url:$prli_blogurl);
80
-
81
- global $plp_app_controller, $plp_keywords_controller;
82
-
83
- // Load our controllers
84
- $controllers = apply_filters( 'plp_controllers', @glob( PLP_CONTROLLERS_PATH . '/*', GLOB_NOSORT ) );
85
- foreach( $controllers as $controller ) {
86
- $class = preg_replace( '#\.php#', '', basename($controller) );
87
- if( preg_match( '#Plp.*Controller#', $class ) ) {
88
- $obj = new $class;
89
- $obj->load_hooks();
90
-
91
- if( $class==='PlpAppController' ) {
92
- $plp_app_controller = $obj;
93
- }
94
-
95
- if( $class==='PlpKeywordsController' ) {
96
- $plp_keywords_controller = $obj;
97
- }
98
- }
99
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/vendor/index.php DELETED
@@ -1,2 +0,0 @@
1
- <?php /* Silence will fall */ ?>
2
-
 
 
pro/vendor/phpqrcode/.gitignore DELETED
@@ -1,2 +0,0 @@
1
- .idea/
2
- temp/*.png
 
 
pro/vendor/phpqrcode/CHANGELOG DELETED
@@ -1,38 +0,0 @@
1
- * 1.0.0 build 2010031920
2
-
3
- - first public release
4
- - help in readme, install
5
- - cleanup ans separation of QRtools and QRspec
6
- - now TCPDF binding requires minimal changes in TCPDF, having most of job
7
- done in QRtools tcpdfBarcodeArray
8
- - nicer QRtools::timeBenchmark output
9
- - license and copyright notices in files
10
- - indent cleanup - from tab to 4spc, keep it that way please :)
11
- - sf project, repository, wiki
12
- - simple code generator in index.php
13
-
14
- * 1.1.0 build 2010032113
15
-
16
- - added merge tool wich generate merged version of code
17
- located in phpqrcode.php
18
- - splited qrconst.php from qrlib.php
19
-
20
- * 1.1.1 build 2010032405
21
-
22
- - patch by Rick Seymour allowing saving PNG and displaying it at the same time
23
- - added version info in VERSION file
24
- - modified merge tool to include version info into generated file
25
- - fixed e-mail in almost all head comments
26
-
27
- * 1.1.2 build 2010032722
28
-
29
- - full integration with TCPDF thanks to Nicola Asuni, it's author
30
- - fixed bug with alphanumeric encoding detection
31
-
32
- * 1.1.3 build 2010081807
33
-
34
- - short opening tags replaced with standard ones
35
-
36
- * 1.1.4 build 2010100721
37
-
38
- - added missing static keyword QRinput::check (found by Luke Brookhart, Onjax LLC)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/vendor/phpqrcode/INSTALL DELETED
@@ -1,67 +0,0 @@
1
- == REQUIREMENTS ==
2
-
3
- * PHP5
4
- * PHP GD2 extension with JPEG and PNG support
5
-
6
- == INSTALLATION ==
7
-
8
- If you want to recreate cache by yourself make sure cache directory is
9
- writable and you have permisions to write into it. Also make sure you are
10
- able to read files in it if you have cache option enabled
11
-
12
- == CONFIGURATION ==
13
-
14
- Feel free to modify config constants in qrconfig.php file. Read about it in
15
- provided comments and project wiki page (links in README file)
16
-
17
- == QUICK START ==
18
-
19
- Notice: probably you should'nt use all of this in same script :)
20
-
21
- <?php
22
-
23
- //include only that one, rest required files will be included from it
24
- include "qrlib.php"
25
-
26
- //write code into file, Error corection lecer is lowest, L (one form: L,M,Q,H)
27
- //each code square will be 4x4 pixels (4x zoom)
28
- //code will have 2 code squares white boundary around
29
-
30
- QRcode::png('PHP QR Code :)', 'test.png', 'L', 4, 2);
31
-
32
- //same as above but outputs file directly into browser (with appr. header etc.)
33
- //all other settings are default
34
- //WARNING! it should be FIRST and ONLY output generated by script, otherwise
35
- //rest of output will land inside PNG binary, breaking it for sure
36
- QRcode::png('PHP QR Code :)');
37
-
38
- //show benchmark
39
- QRtools::timeBenchmark();
40
-
41
- //rebuild cache
42
- QRtools::buildCache();
43
-
44
- //code generated in text mode - as a binary table
45
- //then displayed out as HTML using Unicode block building chars :)
46
- $tab = $qr->encode('PHP QR Code :)');
47
- QRspec::debug($tab, true);
48
-
49
- == TCPDF INTEGRATION ==
50
-
51
- Inside bindings/tcpdf you will find slightly modified 2dbarcodes.php.
52
- Instal phpqrcode liblaty inside tcpdf folder, then overwrite (or merge)
53
- 2dbarcodes.php
54
-
55
- Then use similar as example #50 from TCPDF examples:
56
-
57
- <?php
58
-
59
- $style = array(
60
- 'border' => true,
61
- 'padding' => 4,
62
- 'fgcolor' => array(0,0,0),
63
- 'bgcolor' => false, //array(255,255,255)
64
- );
65
-
66
- //code name: QR, specify error correction level after semicolon (L,M,Q,H)
67
- $pdf->write2DBarcode('PHP QR Code :)', 'QR,L', '', '', 30, 30, $style, 'N');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/vendor/phpqrcode/LICENSE DELETED
@@ -1,165 +0,0 @@
1
- GNU LESSER GENERAL PUBLIC LICENSE
2
- Version 3, 29 June 2007
3
-
4
- Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
5
- Everyone is permitted to copy and distribute verbatim copies
6
- of this license document, but changing it is not allowed.
7
-
8
-
9
- This version of the GNU Lesser General Public License incorporates
10
- the terms and conditions of version 3 of the GNU General Public
11
- License, supplemented by the additional permissions listed below.
12
-
13
- 0. Additional Definitions.
14
-
15
- As used herein, "this License" refers to version 3 of the GNU Lesser
16
- General Public License, and the "GNU GPL" refers to version 3 of the GNU
17
- General Public License.
18
-
19
- "The Library" refers to a covered work governed by this License,
20
- other than an Application or a Combined Work as defined below.
21
-
22
- An "Application" is any work that makes use of an interface provided
23
- by the Library, but which is not otherwise based on the Library.
24
- Defining a subclass of a class defined by the Library is deemed a mode
25
- of using an interface provided by the Library.
26
-
27
- A "Combined Work" is a work produced by combining or linking an
28
- Application with the Library. The particular version of the Library
29
- with which the Combined Work was made is also called the "Linked
30
- Version".
31
-
32
- The "Minimal Corresponding Source" for a Combined Work means the
33
- Corresponding Source for the Combined Work, excluding any source code
34
- for portions of the Combined Work that, considered in isolation, are
35
- based on the Application, and not on the Linked Version.
36
-
37
- The "Corresponding Application Code" for a Combined Work means the
38
- object code and/or source code for the Application, including any data
39
- and utility programs needed for reproducing the Combined Work from the
40
- Application, but excluding the System Libraries of the Combined Work.
41
-
42
- 1. Exception to Section 3 of the GNU GPL.
43
-
44
- You may convey a covered work under sections 3 and 4 of this License
45
- without being bound by section 3 of the GNU GPL.
46
-
47
- 2. Conveying Modified Versions.
48
-
49
- If you modify a copy of the Library, and, in your modifications, a
50
- facility refers to a function or data to be supplied by an Application
51
- that uses the facility (other than as an argument passed when the
52
- facility is invoked), then you may convey a copy of the modified
53
- version:
54
-
55
- a) under this License, provided that you make a good faith effort to
56
- ensure that, in the event an Application does not supply the
57
- function or data, the facility still operates, and performs
58
- whatever part of its purpose remains meaningful, or
59
-
60
- b) under the GNU GPL, with none of the additional permissions of
61
- this License applicable to that copy.
62
-
63
- 3. Object Code Incorporating Material from Library Header Files.
64
-
65
- The object code form of an Application may incorporate material from
66
- a header file that is part of the Library. You may convey such object
67
- code under terms of your choice, provided that, if the incorporated
68
- material is not limited to numerical parameters, data structure
69
- layouts and accessors, or small macros, inline functions and templates
70
- (ten or fewer lines in length), you do both of the following:
71
-
72
- a) Give prominent notice with each copy of the object code that the
73
- Library is used in it and that the Library and its use are
74
- covered by this License.
75
-
76
- b) Accompany the object code with a copy of the GNU GPL and this license
77
- document.
78
-
79
- 4. Combined Works.
80
-
81
- You may convey a Combined Work under terms of your choice that,
82
- taken together, effectively do not restrict modification of the
83
- portions of the Library contained in the Combined Work and reverse
84
- engineering for debugging such modifications, if you also do each of
85
- the following:
86
-
87
- a) Give prominent notice with each copy of the Combined Work that
88
- the Library is used in it and that the Library and its use are
89
- covered by this License.
90
-
91
- b) Accompany the Combined Work with a copy of the GNU GPL and this license
92
- document.
93
-
94
- c) For a Combined Work that displays copyright notices during
95
- execution, include the copyright notice for the Library among
96
- these notices, as well as a reference directing the user to the
97
- copies of the GNU GPL and this license document.
98
-
99
- d) Do one of the following:
100
-
101
- 0) Convey the Minimal Corresponding Source under the terms of this
102
- License, and the Corresponding Application Code in a form
103
- suitable for, and under terms that permit, the user to
104
- recombine or relink the Application with a modified version of
105
- the Linked Version to produce a modified Combined Work, in the
106
- manner specified by section 6 of the GNU GPL for conveying
107
- Corresponding Source.
108
-
109
- 1) Use a suitable shared library mechanism for linking with the
110
- Library. A suitable mechanism is one that (a) uses at run time
111
- a copy of the Library already present on the user's computer
112
- system, and (b) will operate properly with a modified version
113
- of the Library that is interface-compatible with the Linked
114
- Version.
115
-
116
- e) Provide Installation Information, but only if you would otherwise
117
- be required to provide such information under section 6 of the
118
- GNU GPL, and only to the extent that such information is
119
- necessary to install and execute a modified version of the
120
- Combined Work produced by recombining or relinking the
121
- Application with a modified version of the Linked Version. (If
122
- you use option 4d0, the Installation Information must accompany
123
- the Minimal Corresponding Source and Corresponding Application
124
- Code. If you use option 4d1, you must provide the Installation
125
- Information in the manner specified by section 6 of the GNU GPL
126
- for conveying Corresponding Source.)
127
-
128
- 5. Combined Libraries.
129
-
130
- You may place library facilities that are a work based on the
131
- Library side by side in a single library together with other library
132
- facilities that are not Applications and are not covered by this
133
- License, and convey such a combined library under terms of your
134
- choice, if you do both of the following:
135
-
136
- a) Accompany the combined library with a copy of the same work based
137
- on the Library, uncombined with any other library facilities,
138
- conveyed under the terms of this License.
139
-
140
- b) Give prominent notice with the combined library that part of it
141
- is a work based on the Library, and explaining where to find the
142
- accompanying uncombined form of the same work.
143
-
144
- 6. Revised Versions of the GNU Lesser General Public License.
145
-
146
- The Free Software Foundation may publish revised and/or new versions
147
- of the GNU Lesser General Public License from time to time. Such new
148
- versions will be similar in spirit to the present version, but may
149
- differ in detail to address new problems or concerns.
150
-
151
- Each version is given a distinguishing version number. If the
152
- Library as you received it specifies that a certain numbered version
153
- of the GNU Lesser General Public License "or any later version"
154
- applies to it, you have the option of following the terms and
155
- conditions either of that published version or of any later version
156
- published by the Free Software Foundation. If the Library as you
157
- received it does not specify a version number of the GNU Lesser
158
- General Public License, you may choose any version of the GNU Lesser
159
- General Public License ever published by the Free Software Foundation.
160
-
161
- If the Library as you received it specifies that a proxy can decide
162
- whether future versions of the GNU Lesser General Public License shall
163
- apply, that proxy's public statement of acceptance of any version is
164
- permanent authorization for you to choose that version for the
165
- Library.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/vendor/phpqrcode/README DELETED
@@ -1,61 +0,0 @@
1
- This is PHP implementation of QR Code 2-D barcode generator. It is pure-php
2
- LGPL-licensed implementation based on C libqrencode by Kentaro Fukuchi.
3
-
4
- == UPDATE ==
5
- Added support for eps export
6
- Usage : QRcode::eps('arguments');
7
-
8
- Added support for SVG export
9
- Usage : QRcode::svg('arguments');
10
-
11
- Added support for color export :
12
- example :
13
- $back_color = 0xFFFF00;
14
- $fore_color = 0xFF00FF;
15
- QRcode::png('some othertext 1234', false, 'h', 20, 1, false, $back_color, $fore_color);
16
-
17
-
18
- Copyright (C) 2012 by Alexandre Assouad
19
-
20
- == LICENSING ==
21
-
22
- Copyright (C) 2010 by Dominik Dzienia
23
-
24
- This library is free software; you can redistribute it and/or modify it under
25
- the terms of the GNU Lesser General Public License as published by the Free
26
- Software Foundation; either version 3 of the License, or any later version.
27
-
28
- This library is distributed in the hope that it will be useful, but WITHOUT ANY
29
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
30
- PARTICULAR PURPOSE. See the GNU Lesser General Public License (LICENSE file)
31
- for more details.
32
-
33
- You should have received a copy of the GNU Lesser General Public License along
34
- with this library; if not, write to the Free Software Foundation, Inc., 51
35
- Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
36
-
37
- == INSTALATION AND USAGE ==
38
-
39
- * INSTALL file
40
- * http://sourceforge.net/apps/mediawiki/phpqrcode/index.php?title=Main_Page
41
-
42
- == CONTACT ==
43
-
44
- Fell free to contact me via e-mail (deltalab at poczta dot fm) or using
45
- folowing project pages:
46
-
47
- * http://sourceforge.net/projects/phpqrcode/
48
- * http://phpqrcode.sourceforge.net/
49
-
50
- == ACKNOWLEDGMENTS ==
51
-
52
- Based on C libqrencode library (ver. 3.1.1)
53
- Copyright (C) 2006-2010 by Kentaro Fukuchi
54
- http://megaui.net/fukuchi/works/qrencode/index.en.html
55
-
56
- QR Code is registered trademarks of DENSO WAVE INCORPORATED in JAPAN and other
57
- countries.
58
-
59
- Reed-Solomon code encoder is written by Phil Karn, KA9Q.
60
- Copyright (C) 2002, 2003, 2004, 2006 Phil Karn, KA9Q
61
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/vendor/phpqrcode/VERSION DELETED
@@ -1,2 +0,0 @@
1
- 1.1.4
2
- 2010100721
 
 
pro/vendor/phpqrcode/bindings/index.php DELETED
@@ -1,2 +0,0 @@
1
- <?php /* Silence will fall */ ?>
2
-
 
 
pro/vendor/phpqrcode/bindings/tcpdf/index.php DELETED
@@ -1,2 +0,0 @@
1
- <?php /* Silence will fall */ ?>
2
-
 
 
pro/vendor/phpqrcode/bindings/tcpdf/qrcode.php DELETED
@@ -1,2875 +0,0 @@
1
- <?php
2
- //============================================================+
3
- // File name : qrcode.php
4
- // Begin : 2010-03-22
5
- // Last Update : 2010-03-29
6
- // Version : 1.0.002
7
- // License : GNU LGPL v.3 (http://www.gnu.org/copyleft/lesser.html)
8
- // ----------------------------------------------------------------------------
9
- //
10
- // This library is free software; you can redistribute it and/or
11
- // modify it under the terms of the GNU Lesser General Public
12
- // License as published by the Free Software Foundation; either
13
- // version 3 of the License, or any later version.
14
- //
15
- // This library 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 GNU
18
- // Lesser General Public License for more details.
19
- //
20
- // You should have received a copy of the GNU Lesser General Public
21
- // License along with this library; if not, write to the Free Software
22
- // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23
- // or browse http://www.gnu.org/copyleft/lesser.html
24
- //
25
- // ----------------------------------------------------------------------------
26
- //
27
- // DESCRIPTION :
28
- //
29
- // Class to create QR-code arrays for TCPDF class.
30
- // QR Code symbol is a 2D barcode that can be scanned by
31
- // handy terminals such as a mobile phone with CCD.
32
- // The capacity of QR Code is up to 7000 digits or 4000
33
- // characters, and has high robustness.
34
- // This class supports QR Code model 2, described in
35
- // JIS (Japanese Industrial Standards) X0510:2004
36
- // or ISO/IEC 18004.
37
- // Currently the following features are not supported:
38
- // ECI and FNC1 mode, Micro QR Code, QR Code model 1,
39
- // Structured mode.
40
- //
41
- // This class is derived from the following projects:
42
- // ---------------------------------------------------------
43
- // "PHP QR Code encoder"
44
- // License: GNU-LGPLv3
45
- // Copyright (C) 2010 by Dominik Dzienia <deltalab at poczta dot fm>
46
- // http://phpqrcode.sourceforge.net/
47
- // https://sourceforge.net/projects/phpqrcode/
48
- //
49
- // The "PHP QR Code encoder" is based on
50
- // "C libqrencode library" (ver. 3.1.1)
51
- // License: GNU-LGPL 2.1
52
- // Copyright (C) 2006-2010 by Kentaro Fukuchi
53
- // http://megaui.net/fukuchi/works/qrencode/index.en.html
54
- //
55
- // Reed-Solomon code encoder is written by Phil Karn, KA9Q.
56
- // Copyright (C) 2002-2006 Phil Karn, KA9Q
57
- //
58
- // QR Code is registered trademark of DENSO WAVE INCORPORATED
59
- // http://www.denso-wave.com/qrcode/index-e.html
60
- // ---------------------------------------------------------
61
- //
62
- // Author: Nicola Asuni
63
- //
64
- // (c) Copyright 2010:
65
- // Nicola Asuni
66
- // Tecnick.com S.r.l.
67
- // Via della Pace, 11
68
- // 09044 Quartucciu (CA)
69
- // ITALY
70
- // www.tecnick.com
71
- // info@tecnick.com
72
- //============================================================+
73
-
74
- /**
75
- * Class to create QR-code arrays for TCPDF class.
76
- * QR Code symbol is a 2D barcode that can be scanned by handy terminals such as a mobile phone with CCD.
77
- * The capacity of QR Code is up to 7000 digits or 4000 characters, and has high robustness.
78
- * This class supports QR Code model 2, described in JIS (Japanese Industrial Standards) X0510:2004 or ISO/IEC 18004.
79
- * Currently the following features are not supported: ECI and FNC1 mode, Micro QR Code, QR Code model 1, Structured mode.
80
- *
81
- * This class is derived from "PHP QR Code encoder" by Dominik Dzienia (http://phpqrcode.sourceforge.net/) based on "libqrencode C library 3.1.1." by Kentaro Fukuchi (http://megaui.net/fukuchi/works/qrencode/index.en.html), contains Reed-Solomon code written by Phil Karn, KA9Q. QR Code is registered trademark of DENSO WAVE INCORPORATED (http://www.denso-wave.com/qrcode/index-e.html).
82
- * Please read comments on this class source file for full copyright and license information.
83
- *
84
- * @package com.tecnick.tcpdf
85
- * @abstract Class for generating QR-code array for TCPDF.
86
- * @author Nicola Asuni
87
- * @copyright 2010 Nicola Asuni - Tecnick.com S.r.l (www.tecnick.com) Via Della Pace, 11 - 09044 - Quartucciu (CA) - ITALY - www.tecnick.com - info@tecnick.com
88
- * @link http://www.tcpdf.org
89
- * @license http://www.gnu.org/copyleft/lesser.html LGPL
90
- * @version 1.0.002
91
- */
92
-
93
- // definitions
94
- if (!defined('QRCODEDEFS')) {
95
-
96
- /**
97
- * Indicate that definitions for this class are set
98
- */
99
- define('QRCODEDEFS', true);
100
-
101
- // -----------------------------------------------------
102
-
103
- // Encoding modes (characters which can be encoded in QRcode)
104
-
105
- /**
106
- * Encoding mode
107
- */
108
- define('QR_MODE_NL', -1);
109
-
110
- /**
111
- * Encoding mode numeric (0-9). 3 characters are encoded to 10bit length. In theory, 7089 characters or less can be stored in a QRcode.
112
- */
113
- define('QR_MODE_NM', 0);
114
-
115
- /**
116
- * Encoding mode alphanumeric (0-9A-Z $%*+-./:) 45characters. 2 characters are encoded to 11bit length. In theory, 4296 characters or less can be stored in a QRcode.
117
- */
118
- define('QR_MODE_AN', 1);
119
-
120
- /**
121
- * Encoding mode 8bit byte data. In theory, 2953 characters or less can be stored in a QRcode.
122
- */
123
- define('QR_MODE_8B', 2);
124
-
125
- /**
126
- * Encoding mode KANJI. A KANJI character (multibyte character) is encoded to 13bit length. In theory, 1817 characters or less can be stored in a QRcode.
127
- */
128
- define('QR_MODE_KJ', 3);
129
-
130
- /**
131
- * Encoding mode STRUCTURED (currently unsupported)
132
- */
133
- define('QR_MODE_ST', 4);
134
-
135
- // -----------------------------------------------------
136
-
137
- // Levels of error correction.
138
- // QRcode has a function of an error correcting for miss reading that white is black.
139
- // Error correcting is defined in 4 level as below.
140
-
141
- /**
142
- * Error correction level L : About 7% or less errors can be corrected.
143
- */
144
- define('QR_ECLEVEL_L', 0);
145
-
146
- /**
147
- * Error correction level M : About 15% or less errors can be corrected.
148
- */
149
- define('QR_ECLEVEL_M', 1);
150
-
151
- /**
152
- * Error correction level Q : About 25% or less errors can be corrected.
153
- */
154
- define('QR_ECLEVEL_Q', 2);
155
-
156
- /**
157
- * Error correction level H : About 30% or less errors can be corrected.
158
- */
159
- define('QR_ECLEVEL_H', 3);
160
-
161
- // -----------------------------------------------------
162
-
163
- // Version. Size of QRcode is defined as version.
164
- // Version is from 1 to 40.
165
- // Version 1 is 21*21 matrix. And 4 modules increases whenever 1 version increases.
166
- // So version 40 is 177*177 matrix.
167
-
168
- /**
169
- * Maximum QR Code version.
170
- */
171
- define('QRSPEC_VERSION_MAX', 40);
172
-
173
- /**
174
- * Maximum matrix size for maximum version (version 40 is 177*177 matrix).
175
- */
176
- define('QRSPEC_WIDTH_MAX', 177);
177
-
178
- // -----------------------------------------------------
179
-
180
- /**
181
- * Matrix index to get width from $capacity array.
182
- */
183
- define('QRCAP_WIDTH', 0);
184
-
185
- /**
186
- * Matrix index to get number of words from $capacity array.
187
- */
188
- define('QRCAP_WORDS', 1);
189
-
190
- /**
191
- * Matrix index to get remainder from $capacity array.
192
- */
193
- define('QRCAP_REMINDER', 2);
194
-
195
- /**
196
- * Matrix index to get error correction level from $capacity array.
197
- */
198
- define('QRCAP_EC', 3);
199
-
200
- // -----------------------------------------------------
201
-
202
- // Structure (currently usupported)
203
-
204
- /**
205
- * Number of header bits for structured mode
206
- */
207
- define('STRUCTURE_HEADER_BITS', 20);
208
-
209
- /**
210
- * Max number of symbols for structured mode
211
- */
212
- define('MAX_STRUCTURED_SYMBOLS', 16);
213
-
214
- // -----------------------------------------------------
215
-
216
- // Masks
217
-
218
- /**
219
- * Down point base value for case 1 mask pattern (concatenation of same color in a line or a column)
220
- */
221
- define('N1', 3);
222
-
223
- /**
224
- * Down point base value for case 2 mask pattern (module block of same color)
225
- */
226
- define('N2', 3);
227
-
228
- /**
229
- * Down point base value for case 3 mask pattern (1:1:3:1:1(dark:bright:dark:bright:dark)pattern in a line or a column)
230
- */
231
- define('N3', 40);
232
-
233
- /**
234
- * Down point base value for case 4 mask pattern (ration of dark modules in whole)
235
- */
236
- define('N4', 10);
237
-
238
- // -----------------------------------------------------
239
-
240
- // Optimization settings
241
-
242
- /**
243
- * if true, estimates best mask (spec. default, but extremally slow; set to false to significant performance boost but (propably) worst quality code
244
- */
245
- define('QR_FIND_BEST_MASK', true);
246
-
247
- /**
248
- * if false, checks all masks available, otherwise value tells count of masks need to be checked, mask id are got randomly
249
- */
250
- define('QR_FIND_FROM_RANDOM', 2);
251
-
252
- /**
253
- * when QR_FIND_BEST_MASK === false
254
- */
255
- define('QR_DEFAULT_MASK', 2);
256
-
257
- // -----------------------------------------------------
258
-
259
- } // end of definitions
260
-
261
- // #*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#
262
-
263
- if (!class_exists('QRcode', false)) {
264
-
265
- // for compaibility with PHP4
266
- if (!function_exists('str_split')) {
267
- /**
268
- * Convert a string to an array (needed for PHP4 compatibility)
269
- * @param string $string The input string.
270
- * @param int $split_length Maximum length of the chunk.
271
- * @return If the optional split_length parameter is specified, the returned array will be broken down into chunks with each being split_length in length, otherwise each chunk will be one character in length. FALSE is returned if split_length is less than 1. If the split_length length exceeds the length of string , the entire string is returned as the first (and only) array element.
272
- */
273
- function str_split($string, $split_length=1) {
274
- if ((strlen($string) > $split_length) OR (!$split_length)) {
275
- do {
276
- $c = strlen($string);
277
- $parts[] = substr($string, 0, $split_length);
278
- $string = substr($string, $split_length);
279
- } while ($string !== false);
280
- } else {
281
- $parts = array($string);
282
- }
283
- return $parts;
284
- }
285
- }
286
-
287
- // #####################################################
288
-
289
- /**
290
- * Class to create QR-code arrays for TCPDF class.
291
- * QR Code symbol is a 2D barcode that can be scanned by handy terminals such as a mobile phone with CCD.
292
- * The capacity of QR Code is up to 7000 digits or 4000 characters, and has high robustness.
293
- * This class supports QR Code model 2, described in JIS (Japanese Industrial Standards) X0510:2004 or ISO/IEC 18004.
294
- * Currently the following features are not supported: ECI and FNC1 mode, Micro QR Code, QR Code model 1, Structured mode.
295
- *
296
- * This class is derived from "PHP QR Code encoder" by Dominik Dzienia (http://phpqrcode.sourceforge.net/) based on "libqrencode C library 3.1.1." by Kentaro Fukuchi (http://megaui.net/fukuchi/works/qrencode/index.en.html), contains Reed-Solomon code written by Phil Karn, KA9Q. QR Code is registered trademark of DENSO WAVE INCORPORATED (http://www.denso-wave.com/qrcode/index-e.html).
297
- * Please read comments on this class source file for full copyright and license information.
298
- *
299
- * @name QRcode
300
- * @package com.tecnick.tcpdf
301
- * @abstract Class for generating QR-code array for TCPDF.
302
- * @author Nicola Asuni
303
- * @copyright 2010 Nicola Asuni - Tecnick.com S.r.l (www.tecnick.com) Via Della Pace, 11 - 09044 - Quartucciu (CA) - ITALY - www.tecnick.com - info@tecnick.com
304
- * @link http://www.tcpdf.org
305
- * @license http://www.gnu.org/copyleft/lesser.html LGPL
306
- * @version 1.0.002
307
- */
308
- class QRcode {
309
-
310
- /**
311
- * @var barcode array to be returned which is readable by TCPDF
312
- * @access protected
313
- */
314
- protected $barcode_array = array();
315
-
316
- /**
317
- * @var QR code version. Size of QRcode is defined as version. Version is from 1 to 40. Version 1 is 21*21 matrix. And 4 modules increases whenever 1 version increases. So version 40 is 177*177 matrix.
318
- * @access protected
319
- */
320
- protected $version = 0;
321
-
322
- /**
323
- * @var Levels of error correction. See definitions for possible values.
324
- * @access protected
325
- */
326
- protected $level = QR_ECLEVEL_L;
327
-
328
- /**
329
- * @var Encoding mode
330
- * @access protected
331
- */
332
- protected $hint = QR_MODE_8B;
333
-
334
- /**
335
- * @var if true the input string will be converted to uppercase
336
- * @access protected
337
- */
338
- protected $casesensitive = true;
339
-
340
- /**
341
- * @var structured QR code (not supported yet)
342
- * @access protected
343
- */
344
- protected $structured = 0;
345
-
346
- /**
347
- * @var mask data
348
- * @access protected
349
- */
350
- protected $data;
351
-
352
- // FrameFiller
353
-
354
- /**
355
- * @var width
356
- * @access protected
357
- */
358
- protected $width;
359
-
360
- /**
361
- * @var frame
362
- * @access protected
363
- */
364
- protected $frame;
365
-
366
- /**
367
- * @var X position of bit
368
- * @access protected
369
- */
370
- protected $x;
371
-
372
- /**
373
- * @var Y position of bit
374
- * @access protected
375
- */
376
- protected $y;
377
-
378
- /**
379
- * @var direction
380
- * @access protected
381
- */
382
- protected $dir;
383
-
384
- /**
385
- * @var single bit
386
- * @access protected
387
- */
388
- protected $bit;
389
-
390
- // ---- QRrawcode ----
391
-
392
- /**
393
- * @var data code
394
- * @access protected
395
- */
396
- protected $datacode = array();
397
-
398
- /**
399
- * @var error correction code
400
- * @access protected
401
- */
402
- protected $ecccode = array();
403
-
404
- /**
405
- * @var blocks
406
- * @access protected
407
- */
408
- protected $blocks;
409
-
410
- /**
411
- * @var Reed-Solomon blocks
412
- * @access protected
413
- */
414
- protected $rsblocks = array(); //of RSblock
415
-
416
- /**
417
- * @var counter
418
- * @access protected
419
- */
420
- protected $count;
421
-
422
- /**
423
- * @var data length
424
- * @access protected
425
- */
426
- protected $dataLength;
427
-
428
- /**
429
- * @var error correction length
430
- * @access protected
431
- */
432
- protected $eccLength;
433
-
434
- /**
435
- * @var b1
436
- * @access protected
437
- */
438
- protected $b1;
439
-
440
- // ---- QRmask ----
441
-
442
- /**
443
- * @var run length
444
- * @access protected
445
- */
446
- protected $runLength = array();
447
-
448
- // ---- QRsplit ----
449
-
450
- /**
451
- * @var input data string
452
- * @access protected
453
- */
454
- protected $dataStr = '';
455
-
456
- /**
457
- * @var input items
458
- * @access protected
459
- */
460
- protected $items;
461
-
462
- // Reed-Solomon items
463
-
464
- /**
465
- * @var Reed-Solomon items
466
- * @access protected
467
- */
468
- protected $rsitems = array();
469
-
470
- /**
471
- * @var array of frames
472
- * @access protected
473
- */
474
- protected $frames = array();
475
-
476
- /**
477
- * @var alphabet-numeric convesion table
478
- * @access protected
479
- */
480
- protected $anTable = array(
481
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, //
482
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, //
483
- 36, -1, -1, -1, 37, 38, -1, -1, -1, -1, 39, 40, -1, 41, 42, 43, //
484
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 44, -1, -1, -1, -1, -1, //
485
- -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, //
486
- 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, -1, -1, -1, -1, -1, //
487
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, //
488
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 //
489
- );
490
-
491
- /**
492
- * @var array Table of the capacity of symbols
493
- * See Table 1 (pp.13) and Table 12-16 (pp.30-36), JIS X0510:2004.
494
- * @access protected
495
- */
496
- protected $capacity = array(
497
- array( 0, 0, 0, array( 0, 0, 0, 0)), //
498
- array( 21, 26, 0, array( 7, 10, 13, 17)), // 1
499
- array( 25, 44, 7, array( 10, 16, 22, 28)), //
500
- array( 29, 70, 7, array( 15, 26, 36, 44)), //
501
- array( 33, 100, 7, array( 20, 36, 52, 64)), //
502
- array( 37, 134, 7, array( 26, 48, 72, 88)), // 5
503
- array( 41, 172, 7, array( 36, 64, 96, 112)), //
504
- array( 45, 196, 0, array( 40, 72, 108, 130)), //
505
- array( 49, 242, 0, array( 48, 88, 132, 156)), //
506
- array( 53, 292, 0, array( 60, 110, 160, 192)), //
507
- array( 57, 346, 0, array( 72, 130, 192, 224)), // 10
508
- array( 61, 404, 0, array( 80, 150, 224, 264)), //
509
- array( 65, 466, 0, array( 96, 176, 260, 308)), //
510
- array( 69, 532, 0, array( 104, 198, 288, 352)), //
511
- array( 73, 581, 3, array( 120, 216, 320, 384)), //
512
- array( 77, 655, 3, array( 132, 240, 360, 432)), // 15
513
- array( 81, 733, 3, array( 144, 280, 408, 480)), //
514
- array( 85, 815, 3, array( 168, 308, 448, 532)), //
515
- array( 89, 901, 3, array( 180, 338, 504, 588)), //
516
- array( 93, 991, 3, array( 196, 364, 546, 650)), //
517
- array( 97, 1085, 3, array( 224, 416, 600, 700)), // 20
518
- array(101, 1156, 4, array( 224, 442, 644, 750)), //
519
- array(105, 1258, 4, array( 252, 476, 690, 816)), //
520
- array(109, 1364, 4, array( 270, 504, 750, 900)), //
521
- array(113, 1474, 4, array( 300, 560, 810, 960)), //
522
- array(117, 1588, 4, array( 312, 588, 870, 1050)), // 25
523
- array(121, 1706, 4, array( 336, 644, 952, 1110)), //
524
- array(125, 1828, 4, array( 360, 700, 1020, 1200)), //
525
- array(129, 1921, 3, array( 390, 728, 1050, 1260)), //
526
- array(133, 2051, 3, array( 420, 784, 1140, 1350)), //
527
- array(137, 2185, 3, array( 450, 812, 1200, 1440)), // 30
528
- array(141, 2323, 3, array( 480, 868, 1290, 1530)), //
529
- array(145, 2465, 3, array( 510, 924, 1350, 1620)), //
530
- array(149, 2611, 3, array( 540, 980, 1440, 1710)), //
531
- array(153, 2761, 3, array( 570, 1036, 1530, 1800)), //
532
- array(157, 2876, 0, array( 570, 1064, 1590, 1890)), // 35
533
- array(161, 3034, 0, array( 600, 1120, 1680, 1980)), //
534
- array(165, 3196, 0, array( 630, 1204, 1770, 2100)), //
535
- array(169, 3362, 0, array( 660, 1260, 1860, 2220)), //
536
- array(173, 3532, 0, array( 720, 1316, 1950, 2310)), //
537
- array(177, 3706, 0, array( 750, 1372, 2040, 2430)) // 40
538
- );
539
-
540
- /**
541
- * @var array Length indicator
542
- * @access protected
543
- */
544
- protected $lengthTableBits = array(
545
- array(10, 12, 14),
546
- array( 9, 11, 13),
547
- array( 8, 16, 16),
548
- array( 8, 10, 12)
549
- );
550
-
551
- /**
552
- * @var array Table of the error correction code (Reed-Solomon block)
553
- * See Table 12-16 (pp.30-36), JIS X0510:2004.
554
- * @access protected
555
- */
556
- protected $eccTable = array(
557
- array(array( 0, 0), array( 0, 0), array( 0, 0), array( 0, 0)), //
558
- array(array( 1, 0), array( 1, 0), array( 1, 0), array( 1, 0)), // 1
559
- array(array( 1, 0), array( 1, 0), array( 1, 0), array( 1, 0)), //
560
- array(array( 1, 0), array( 1, 0), array( 2, 0), array( 2, 0)), //
561
- array(array( 1, 0), array( 2, 0), array( 2, 0), array( 4, 0)), //
562
- array(array( 1, 0), array( 2, 0), array( 2, 2), array( 2, 2)), // 5
563
- array(array( 2, 0), array( 4, 0), array( 4, 0), array( 4, 0)), //
564
- array(array( 2, 0), array( 4, 0), array( 2, 4), array( 4, 1)), //
565
- array(array( 2, 0), array( 2, 2), array( 4, 2), array( 4, 2)), //
566
- array(array( 2, 0), array( 3, 2), array( 4, 4), array( 4, 4)), //
567
- array(array( 2, 2), array( 4, 1), array( 6, 2), array( 6, 2)), // 10
568
- array(array( 4, 0), array( 1, 4), array( 4, 4), array( 3, 8)), //
569
- array(array( 2, 2), array( 6, 2), array( 4, 6), array( 7, 4)), //
570
- array(array( 4, 0), array( 8, 1), array( 8, 4), array(12, 4)), //
571
- array(array( 3, 1), array( 4, 5), array(11, 5), array(11, 5)), //
572
- array(array( 5, 1), array( 5, 5), array( 5, 7), array(11, 7)), // 15
573
- array(array( 5, 1), array( 7, 3), array(15, 2), array( 3, 13)), //
574
- array(array( 1, 5), array(10, 1), array( 1, 15), array( 2, 17)), //
575
- array(array( 5, 1), array( 9, 4), array(17, 1), array( 2, 19)), //
576
- array(array( 3, 4), array( 3, 11), array(17, 4), array( 9, 16)), //
577
- array(array( 3, 5), array( 3, 13), array(15, 5), array(15, 10)), // 20
578
- array(array( 4, 4), array(17, 0), array(17, 6), array(19, 6)), //
579
- array(array( 2, 7), array(17, 0), array( 7, 16), array(34, 0)), //
580
- array(array( 4, 5), array( 4, 14), array(11, 14), array(16, 14)), //
581
- array(array( 6, 4), array( 6, 14), array(11, 16), array(30, 2)), //
582
- array(array( 8, 4), array( 8, 13), array( 7, 22), array(22, 13)), // 25
583
- array(array(10, 2), array(19, 4), array(28, 6), array(33, 4)), //
584
- array(array( 8, 4), array(22, 3), array( 8, 26), array(12, 28)), //
585
- array(array( 3, 10), array( 3, 23), array( 4, 31), array(11, 31)), //
586
- array(array( 7, 7), array(21, 7), array( 1, 37), array(19, 26)), //
587
- array(array( 5, 10), array(19, 10), array(15, 25), array(23, 25)), // 30
588
- array(array(13, 3), array( 2, 29), array(42, 1), array(23, 28)), //
589
- array(array(17, 0), array(10, 23), array(10, 35), array(19, 35)), //
590
- array(array(17, 1), array(14, 21), array(29, 19), array(11, 46)), //
591
- array(array(13, 6), array(14, 23), array(44, 7), array(59, 1)), //
592
- array(array(12, 7), array(12, 26), array(39, 14), array(22, 41)), // 35
593
- array(array( 6, 14), array( 6, 34), array(46, 10), array( 2, 64)), //
594
- array(array(17, 4), array(29, 14), array(49, 10), array(24, 46)), //
595
- array(array( 4, 18), array(13, 32), array(48, 14), array(42, 32)), //
596
- array(array(20, 4), array(40, 7), array(43, 22), array(10, 67)), //
597
- array(array(19, 6), array(18, 31), array(34, 34), array(20, 61)) // 40
598
- );
599
-
600
- /**
601
- * @var array Positions of alignment patterns.
602
- * This array includes only the second and the third position of the alignment patterns. Rest of them can be calculated from the distance between them.
603
- * See Table 1 in Appendix E (pp.71) of JIS X0510:2004.
604
- * @access protected
605
- */
606
- protected $alignmentPattern = array(
607
- array( 0, 0),
608
- array( 0, 0), array(18, 0), array(22, 0), array(26, 0), array(30, 0), // 1- 5
609
- array(34, 0), array(22, 38), array(24, 42), array(26, 46), array(28, 50), // 6-10
610
- array(30, 54), array(32, 58), array(34, 62), array(26, 46), array(26, 48), // 11-15
611
- array(26, 50), array(30, 54), array(30, 56), array(30, 58), array(34, 62), // 16-20
612
- array(28, 50), array(26, 50), array(30, 54), array(28, 54), array(32, 58), // 21-25
613
- array(30, 58), array(34, 62), array(26, 50), array(30, 54), array(26, 52), // 26-30
614
- array(30, 56), array(34, 60), array(30, 58), array(34, 62), array(30, 54), // 31-35
615
- array(24, 50), array(28, 54), array(32, 58), array(26, 54), array(30, 58) // 35-40
616
- );
617
-
618
- /**
619
- * @var array Version information pattern (BCH coded).
620
- * See Table 1 in Appendix D (pp.68) of JIS X0510:2004.
621
- * size: [QRSPEC_VERSION_MAX - 6]
622
- * @access protected
623
- */
624
- protected $versionPattern = array(
625
- 0x07c94, 0x085bc, 0x09a99, 0x0a4d3, 0x0bbf6, 0x0c762, 0x0d847, 0x0e60d, //
626
- 0x0f928, 0x10b78, 0x1145d, 0x12a17, 0x13532, 0x149a6, 0x15683, 0x168c9, //
627
- 0x177ec, 0x18ec4, 0x191e1, 0x1afab, 0x1b08e, 0x1cc1a, 0x1d33f, 0x1ed75, //
628
- 0x1f250, 0x209d5, 0x216f0, 0x228ba, 0x2379f, 0x24b0b, 0x2542e, 0x26a64, //
629
- 0x27541, 0x28c69
630
- );
631
-
632
- /**
633
- * @var array Format information
634
- * @access protected
635
- */
636
- protected $formatInfo = array(
637
- array(0x77c4, 0x72f3, 0x7daa, 0x789d, 0x662f, 0x6318, 0x6c41, 0x6976), //
638
- array(0x5412, 0x5125, 0x5e7c, 0x5b4b, 0x45f9, 0x40ce, 0x4f97, 0x4aa0), //
639
- array(0x355f, 0x3068, 0x3f31, 0x3a06, 0x24b4, 0x2183, 0x2eda, 0x2bed), //
640
- array(0x1689, 0x13be, 0x1ce7, 0x19d0, 0x0762, 0x0255, 0x0d0c, 0x083b) //
641
- );
642
-
643
-
644
- // -------------------------------------------------
645
- // -------------------------------------------------
646
-
647
-
648
- /**
649
- * This is the class constructor.
650
- * Creates a QRcode object
651
- * @param string $code code to represent using QRcode
652
- * @param string $eclevel error level: <ul><li>L : About 7% or less errors can be corrected.</li><li>M : About 15% or less errors can be corrected.</li><li>Q : About 25% or less errors can be corrected.</li><li>H : About 30% or less errors can be corrected.</li></ul>
653
- * @access public
654
- * @since 1.0.000
655
- */
656
- public function __construct($code, $eclevel = 'L') {
657
- $barcode_array = array();
658
- if ((is_null($code)) OR ($code == '\0') OR ($code == '')) {
659
- return false;
660
- }
661
- // set error correction level
662
- $this->level = array_search($eclevel, array('L', 'M', 'Q', 'H'));
663
- if ($this->level === false) {
664
- $this->level = QR_ECLEVEL_L;
665
- }
666
- if (($this->hint != QR_MODE_8B) AND ($this->hint != QR_MODE_KJ)) {
667
- return false;
668
- }
669
- if (($this->version < 0) OR ($this->version > QRSPEC_VERSION_MAX)) {
670
- return false;
671
- }
672
- $this->items = array();
673
- $this->encodeString($code);
674
- $qrTab = $this->binarize($this->data);
675
- $size = count($qrTab);
676
- $barcode_array['num_rows'] = $size;
677
- $barcode_array['num_cols'] = $size;
678
- $barcode_array['bcode'] = array();
679
- foreach ($qrTab as $line) {
680
- $arrAdd = array();
681
- foreach (str_split($line) as $char) {
682
- $arrAdd[] = ($char=='1')?1:0;
683
- }
684
- $barcode_array['bcode'][] = $arrAdd;
685
- }
686
- $this->barcode_array = $barcode_array;
687
- }
688
-
689
- /**
690
- * Returns a barcode array which is readable by TCPDF
691
- * @return array barcode array readable by TCPDF;
692
- * @access public
693
- */
694
- public function getBarcodeArray() {
695
- return $this->barcode_array;
696
- }
697
-
698
- /**
699
- * Convert the frame in binary form
700
- * @param array $frame array to binarize
701
- * @return array frame in binary form
702
- */
703
- protected function binarize($frame) {
704
- $len = count($frame);
705
- // the frame is square (width = height)
706
- foreach ($frame as &$frameLine) {
707
- for ($i=0; $i<$len; $i++) {
708
- $frameLine[$i] = (ord($frameLine[$i])&1)?'1':'0';
709
- }
710
- }
711
- return $frame;
712
- }
713
-
714
- /**
715
- * Encode the input string to QR code
716
- * @param string $string input string to encode
717
- */
718
- protected function encodeString($string) {
719
- $this->dataStr = $string;
720
- if (!$this->casesensitive) {
721
- $this->toUpper();
722
- }
723
- $ret = $this->splitString();
724
- if ($ret < 0) {
725
- return NULL;
726
- }
727
- $this->encodeMask(-1);
728
- }
729
-
730
- /**
731
- * Encode mask
732
- * @param int $mask masking mode
733
- */
734
- protected function encodeMask($mask) {
735
- $spec = array(0, 0, 0, 0, 0);
736
- $this->datacode = $this->getByteStream($this->items);
737
- if (is_null($this->datacode)) {
738
- return NULL;
739
- }
740
- $spec = $this->getEccSpec($this->version, $this->level, $spec);
741
- $this->b1 = $this->rsBlockNum1($spec);
742
- $this->dataLength = $this->rsDataLength($spec);
743
- $this->eccLength = $this->rsEccLength($spec);
744
- $this->ecccode = array_fill(0, $this->eccLength, 0);
745
- $this->blocks = $this->rsBlockNum($spec);
746
- $ret = $this->init($spec);
747
- if ($ret < 0) {
748
- return NULL;
749
- }
750
- $this->count = 0;
751
- $this->width = $this->getWidth($this->version);
752
- $this->frame = $this->newFrame($this->version);
753
- $this->x = $this->width - 1;
754
- $this->y = $this->width - 1;
755
- $this->dir = -1;
756
- $this->bit = -1;
757
- // inteleaved data and ecc codes
758
- for ($i=0; $i < ($this->dataLength + $this->eccLength); $i++) {
759
- $code = $this->getCode();
760
- $bit = 0x80;
761
- for ($j=0; $j<8; $j++) {
762
- $addr = $this->getNextPosition();
763
- $this->setFrameAt($addr, 0x02 | (($bit & $code) != 0));
764
- $bit = $bit >> 1;
765
- }
766
- }
767
- // remainder bits
768
- $j = $this->getRemainder($this->version);
769
- for ($i=0; $i<$j; $i++) {
770
- $addr = $this->getNextPosition();
771
- $this->setFrameAt($addr, 0x02);
772
- }
773
- // masking
774
- $this->runLength = array_fill(0, QRSPEC_WIDTH_MAX + 1, 0);
775
- if ($mask < 0) {
776
- if (QR_FIND_BEST_MASK) {
777
- $masked = $this->mask($this->width, $this->frame, $this->level);
778
- } else {
779
- $masked = $this->makeMask($this->width, $this->frame, (intval(QR_DEFAULT_MASK) % 8), $this->level);
780
- }
781
- } else {
782
- $masked = $this->makeMask($this->width, $this->frame, $mask, $this->level);
783
- }
784
- if ($masked == NULL) {
785
- return NULL;
786
- }
787
- $this->data = $masked;
788
- }
789
-
790
- // - - - - - - - - - - - - - - - - - - - - - - - - -
791
-
792
- // FrameFiller
793
-
794
- /**
795
- * Set frame value at specified position
796
- * @param array $at x,y position
797
- * @param int $val value of the character to set
798
- */
799
- protected function setFrameAt($at, $val) {
800
- $this->frame[$at['y']][$at['x']] = chr($val);
801
- }
802
-
803
- /**
804
- * Get frame value at specified position
805
- * @param array $at x,y position
806
- * @return value at specified position
807
- */
808
- protected function getFrameAt($at) {
809
- return ord($this->frame[$at['y']][$at['x']]);
810
- }
811
-
812
- /**
813
- * Return the next frame position
814
- * @return array of x,y coordinates
815
- */
816
- protected function getNextPosition() {
817
- do {
818
- if ($this->bit == -1) {
819
- $this->bit = 0;
820
- return array('x'=>$this->x, 'y'=>$this->y);
821
- }
822
- $x = $this->x;
823
- $y = $this->y;
824
- $w = $this->width;
825
- if ($this->bit == 0) {
826
- $x--;
827
- $this->bit++;
828
- } else {
829
- $x++;
830
- $y += $this->dir;
831
- $this->bit--;
832
- }
833
- if ($this->dir < 0) {
834
- if ($y < 0) {
835
- $y = 0;
836
- $x -= 2;
837
- $this->dir = 1;
838
- if ($x == 6) {
839
- $x--;
840
- $y = 9;
841
- }
842
- }
843
- } else {
844
- if ($y == $w) {
845
- $y = $w - 1;
846
- $x -= 2;
847
- $this->dir = -1;
848
- if ($x == 6) {
849
- $x--;
850
- $y -= 8;
851
- }
852
- }
853
- }
854
- if (($x < 0) OR ($y < 0)) {
855
- return NULL;
856
- }
857
- $this->x = $x;
858
- $this->y = $y;
859
- } while(ord($this->frame[$y][$x]) & 0x80);
860
- return array('x'=>$x, 'y'=>$y);
861
- }
862
-
863
- // - - - - - - - - - - - - - - - - - - - - - - - - -
864
-
865
- // QRrawcode
866
-
867
- /**
868
- * Initialize code.
869
- * @param array $spec array of ECC specification
870
- * @return 0 in case of success, -1 in case of error
871
- */
872
- protected function init($spec) {
873
- $dl = $this->rsDataCodes1($spec);
874
- $el = $this->rsEccCodes1($spec);
875
- $rs = $this->init_rs(8, 0x11d, 0, 1, $el, 255 - $dl - $el);
876
- $blockNo = 0;
877
- $dataPos = 0;
878
- $eccPos = 0;
879
- $endfor = $this->rsBlockNum1($spec);
880
- for ($i=0; $i < $endfor; ++$i) {
881
- $ecc = array_slice($this->ecccode, $eccPos);
882
- $this->rsblocks[$blockNo] = array();
883
- $this->rsblocks[$blockNo]['dataLength'] = $dl;
884
- $this->rsblocks[$blockNo]['data'] = array_slice($this->datacode, $dataPos);
885
- $this->rsblocks[$blockNo]['eccLength'] = $el;
886
- $ecc = $this->encode_rs_char($rs, $this->rsblocks[$blockNo]['data'], $ecc);
887
- $this->rsblocks[$blockNo]['ecc'] = $ecc;
888
- $this->ecccode = array_merge(array_slice($this->ecccode,0, $eccPos), $ecc);
889
- $dataPos += $dl;
890
- $eccPos += $el;
891
- $blockNo++;
892
- }
893
- if ($this->rsBlockNum2($spec) == 0) {
894
- return 0;
895
- }
896
- $dl = $this->rsDataCodes2($spec);
897
- $el = $this->rsEccCodes2($spec);
898
- $rs = $this->init_rs(8, 0x11d, 0, 1, $el, 255 - $dl - $el);
899
- if ($rs == NULL) {
900
- return -1;
901
- }
902
- $endfor = $this->rsBlockNum2($spec);
903
- for ($i=0; $i < $endfor; ++$i) {
904
- $ecc = array_slice($this->ecccode, $eccPos);
905
- $this->rsblocks[$blockNo] = array();
906
- $this->rsblocks[$blockNo]['dataLength'] = $dl;
907
- $this->rsblocks[$blockNo]['data'] = array_slice($this->datacode, $dataPos);
908
- $this->rsblocks[$blockNo]['eccLength'] = $el;
909
- $ecc = $this->encode_rs_char($rs, $this->rsblocks[$blockNo]['data'], $ecc);
910
- $this->rsblocks[$blockNo]['ecc'] = $ecc;
911
- $this->ecccode = array_merge(array_slice($this->ecccode, 0, $eccPos), $ecc);
912
- $dataPos += $dl;
913
- $eccPos += $el;
914
- $blockNo++;
915
- }
916
- return 0;
917
- }
918
-
919
- /**
920
- * Return Reed-Solomon block code.
921
- * @return array rsblocks
922
- */
923
- protected function getCode() {
924
- if ($this->count < $this->dataLength) {
925
- $row = $this->count % $this->blocks;
926
- $col = $this->count / $this->blocks;
927
- if ($col >= $this->rsblocks[0]['dataLength']) {
928
- $row += $this->b1;
929
- }
930
- $ret = $this->rsblocks[$row]['data'][$col];
931
- } elseif ($this->count < $this->dataLength + $this->eccLength) {
932
- $row = ($this->count - $this->dataLength) % $this->blocks;
933
- $col = ($this->count - $this->dataLength) / $this->blocks;
934
- $ret = $this->rsblocks[$row]['ecc'][$col];
935
- } else {
936
- return 0;
937
- }
938
- $this->count++;
939
- return $ret;
940
- }
941
-
942
- // - - - - - - - - - - - - - - - - - - - - - - - - -
943
-
944
- // QRmask
945
-
946
- /**
947
- * Write Format Information on frame and returns the number of black bits
948
- * @param int $width frame width
949
- * @param array $frame frame
950
- * @param array $mask masking mode
951
- * @param int $level error correction level
952
- * @return int blacks
953
- */
954
- protected function writeFormatInformation($width, &$frame, $mask, $level) {
955
- $blacks = 0;
956
- $format = $this->getFormatInfo($mask, $level);
957
- for ($i=0; $i<8; ++$i) {
958
- if ($format & 1) {
959
- $blacks += 2;
960
- $v = 0x85;
961
- } else {
962
- $v = 0x84;
963
- }
964
- $frame[8][$width - 1 - $i] = chr($v);
965
- if ($i < 6) {
966
- $frame[$i][8] = chr($v);
967
- } else {
968
- $frame[$i + 1][8] = chr($v);
969
- }
970
- $format = $format >> 1;
971
- }
972
- for ($i=0; $i<7; ++$i) {
973
- if ($format & 1) {
974
- $blacks += 2;
975
- $v = 0x85;
976
- } else {
977
- $v = 0x84;
978
- }
979
- $frame[$width - 7 + $i][8] = chr($v);
980
- if ($i == 0) {
981
- $frame[8][7] = chr($v);
982
- } else {
983
- $frame[8][6 - $i] = chr($v);
984
- }
985
- $format = $format >> 1;
986
- }
987
- return $blacks;
988
- }
989
-
990
- /**
991
- * mask0
992
- * @param int $x X position
993
- * @param int $y Y position
994
- * @return int mask
995
- */
996
- protected function mask0($x, $y) {
997
- return ($x + $y) & 1;
998
- }
999
-
1000
- /**
1001
- * mask1
1002
- * @param int $x X position
1003
- * @param int $y Y position
1004
- * @return int mask
1005
- */
1006
- protected function mask1($x, $y) {
1007
- return ($y & 1);
1008
- }
1009
-
1010
- /**
1011
- * mask2
1012
- * @param int $x X position
1013
- * @param int $y Y position
1014
- * @return int mask
1015
- */
1016
- protected function mask2($x, $y) {
1017
- return ($x % 3);
1018
- }
1019
-
1020
- /**
1021
- * mask3
1022
- * @param int $x X position
1023
- * @param int $y Y position
1024
- * @return int mask
1025
- */
1026
- protected function mask3($x, $y) {
1027
- return ($x + $y) % 3;
1028
- }
1029
-
1030
- /**
1031
- * mask4
1032
- * @param int $x X position
1033
- * @param int $y Y position
1034
- * @return int mask
1035
- */
1036
- protected function mask4($x, $y) {
1037
- return (((int)($y / 2)) + ((int)($x / 3))) & 1;
1038
- }
1039
-
1040
- /**
1041
- * mask5
1042
- * @param int $x X position
1043
- * @param int $y Y position
1044
- * @return int mask
1045
- */
1046
- protected function mask5($x, $y) {
1047
- return (($x * $y) & 1) + ($x * $y) % 3;
1048
- }
1049
-
1050
- /**
1051
- * mask6
1052
- * @param int $x X position
1053
- * @param int $y Y position
1054
- * @return int mask
1055
- */
1056
- protected function mask6($x, $y) {
1057
- return ((($x * $y) & 1) + ($x * $y) % 3) & 1;
1058
- }
1059
-
1060
- /**
1061
- * mask7
1062
- * @param int $x X position
1063
- * @param int $y Y position
1064
- * @return int mask
1065
- */
1066
- protected function mask7($x, $y) {
1067
- return ((($x * $y) % 3) + (($x + $y) & 1)) & 1;
1068
- }
1069
-
1070
- /**
1071
- * Return bitmask
1072
- * @param int $maskNo mask number
1073
- * @param int $width width
1074
- * @param array $frame frame
1075
- * @return array bitmask
1076
- */
1077
- protected function generateMaskNo($maskNo, $width, $frame) {
1078
- $bitMask = array_fill(0, $width, array_fill(0, $width, 0));
1079
- for ($y=0; $y<$width; ++$y) {
1080
- for ($x=0; $x<$width; ++$x) {
1081
- if (ord($frame[$y][$x]) & 0x80) {
1082
- $bitMask[$y][$x] = 0;
1083
- } else {
1084
- $maskFunc = call_user_func(array($this, 'mask'.$maskNo), $x, $y);
1085
- $bitMask[$y][$x] = ($maskFunc == 0)?1:0;
1086
- }
1087
- }
1088
- }
1089
- return $bitMask;
1090
- }
1091
-
1092
- /**
1093
- * makeMaskNo
1094
- * @param int $maskNo
1095
- * @param int $width
1096
- * @param int $s
1097
- * @param int $d
1098
- * @param boolean $maskGenOnly
1099
- * @return int b
1100
- */
1101
- protected function makeMaskNo($maskNo, $width, $s, &$d, $maskGenOnly=false) {
1102
- $b = 0;
1103
- $bitMask = array();
1104
- $bitMask = $this->generateMaskNo($maskNo, $width, $s, $d);
1105
- if ($maskGenOnly) {
1106
- return;
1107
- }
1108
- $d = $s;
1109
- for ($y=0; $y<$width; ++$y) {
1110
- for ($x=0; $x<$width; ++$x) {
1111
- if ($bitMask[$y][$x] == 1) {
1112
- $d[$y][$x] = chr(ord($s[$y][$x]) ^ (int)$bitMask[$y][$x]);
1113
- }
1114
- $b += (int)(ord($d[$y][$x]) & 1);
1115
- }
1116
- }
1117
- return $b;
1118
- }
1119
-
1120
- /**
1121
- * makeMask
1122
- * @param int $width
1123
- * @param array $frame
1124
- * @param int $maskNo
1125
- * @param int $level
1126
- * @return array mask
1127
- */
1128
- protected function makeMask($width, $frame, $maskNo, $level) {
1129
- $masked = array_fill(0, $width, str_repeat("\0", $width));
1130
- $this->makeMaskNo($maskNo, $width, $frame, $masked);
1131
- $this->writeFormatInformation($width, $masked, $maskNo, $level);
1132
- return $masked;
1133
- }
1134
-
1135
- /**
1136
- * calcN1N3
1137
- * @param int $length
1138
- * @return int demerit
1139
- */
1140
- protected function calcN1N3($length) {
1141
- $demerit = 0;
1142
- for ($i=0; $i<$length; ++$i) {
1143
- if ($this->runLength[$i] >= 5) {
1144
- $demerit += (N1 + ($this->runLength[$i] - 5));
1145
- }
1146
- if ($i & 1) {
1147
- if (($i >= 3) AND ($i < ($length-2)) AND ($this->runLength[$i] % 3 == 0)) {
1148
- $fact = (int)($this->runLength[$i] / 3);
1149
- if (($this->runLength[$i-2] == $fact)
1150
- AND ($this->runLength[$i-1] == $fact)
1151
- AND ($this->runLength[$i+1] == $fact)
1152
- AND ($this->runLength[$i+2] == $fact)) {
1153
- if (($this->runLength[$i-3] < 0) OR ($this->runLength[$i-3] >= (4 * $fact))) {
1154
- $demerit += N3;
1155
- } elseif ((($i+3) >= $length) OR ($this->runLength[$i+3] >= (4 * $fact))) {
1156
- $demerit += N3;
1157
- }
1158
- }
1159
- }
1160
- }
1161
- }
1162
- return $demerit;
1163
- }
1164
-
1165
- /**
1166
- * evaluateSymbol
1167
- * @param int $width
1168
- * @param array $frame
1169
- * @return int demerit
1170
- */
1171
- protected function evaluateSymbol($width, $frame) {
1172
- $head = 0;
1173
- $demerit = 0;
1174
- for ($y=0; $y<$width; ++$y) {
1175
- $head = 0;
1176
- $this->runLength[0] = 1;
1177
- $frameY = $frame[$y];
1178
- if ($y > 0) {
1179
- $frameYM = $frame[$y-1];
1180
- }
1181
- for ($x=0; $x<$width; ++$x) {
1182
- if (($x > 0) AND ($y > 0)) {
1183
- $b22 = ord($frameY[$x]) & ord($frameY[$x-1]) & ord($frameYM[$x]) & ord($frameYM[$x-1]);
1184
- $w22 = ord($frameY[$x]) | ord($frameY[$x-1]) | ord($frameYM[$x]) | ord($frameYM[$x-1]);
1185
- if (($b22 | ($w22 ^ 1)) & 1) {
1186
- $demerit += N2;
1187
- }
1188
- }
1189
- if (($x == 0) AND (ord($frameY[$x]) & 1)) {
1190
- $this->runLength[0] = -1;
1191
- $head = 1;
1192
- $this->runLength[$head] = 1;
1193
- } elseif ($x > 0) {
1194
- if ((ord($frameY[$x]) ^ ord($frameY[$x-1])) & 1) {
1195
- $head++;
1196
- $this->runLength[$head] = 1;
1197
- } else {
1198
- $this->runLength[$head]++;
1199
- }
1200
- }
1201
- }
1202
- $demerit += $this->calcN1N3($head+1);
1203
- }
1204
- for ($x=0; $x<$width; ++$x) {
1205
- $head = 0;
1206
- $this->runLength[0] = 1;
1207
- for ($y=0; $y<$width; ++$y) {
1208
- if (($y == 0) AND (ord($frame[$y][$x]) & 1)) {
1209
- $this->runLength[0] = -1;
1210
- $head = 1;
1211
- $this->runLength[$head] = 1;
1212
- } elseif ($y > 0) {
1213
- if ((ord($frame[$y][$x]) ^ ord($frame[$y-1][$x])) & 1) {
1214
- $head++;
1215
- $this->runLength[$head] = 1;
1216
- } else {
1217
- $this->runLength[$head]++;
1218
- }
1219
- }
1220
- }
1221
- $demerit += $this->calcN1N3($head+1);
1222
- }
1223
- return $demerit;
1224
- }
1225
-
1226
- /**
1227
- * mask
1228
- * @param int $width
1229
- * @param array $frame
1230
- * @param int $level
1231
- * @return array best mask
1232
- */
1233
- protected function mask($width, $frame, $level) {
1234
- $minDemerit = PHP_INT_MAX;
1235
- $bestMaskNum = 0;
1236
- $bestMask = array();
1237
- $checked_masks = array(0, 1, 2, 3, 4, 5, 6, 7);
1238
- if (QR_FIND_FROM_RANDOM !== false) {
1239
- $howManuOut = 8 - (QR_FIND_FROM_RANDOM % 9);
1240
- for ($i = 0; $i < $howManuOut; ++$i) {
1241
- $remPos = rand (0, count($checked_masks)-1);
1242
- unset($checked_masks[$remPos]);
1243
- $checked_masks = array_values($checked_masks);
1244
- }
1245
- }
1246
- $bestMask = $frame;
1247
- foreach ($checked_masks as $i) {
1248
- $mask = array_fill(0, $width, str_repeat("\0", $width));
1249
- $demerit = 0;
1250
- $blacks = 0;
1251
- $blacks = $this->makeMaskNo($i, $width, $frame, $mask);
1252
- $blacks += $this->writeFormatInformation($width, $mask, $i, $level);
1253
- $blacks = (int)(100 * $blacks / ($width * $width));
1254
- $demerit = (int)((int)(abs($blacks - 50) / 5) * N4);
1255
- $demerit += $this->evaluateSymbol($width, $mask);
1256
- if ($demerit < $minDemerit) {
1257
- $minDemerit = $demerit;
1258
- $bestMask = $mask;
1259
- $bestMaskNum = $i;
1260
- }
1261
- }
1262
- return $bestMask;
1263
- }
1264
-
1265
- // - - - - - - - - - - - - - - - - - - - - - - - - -
1266
-
1267
- // QRsplit
1268
-
1269
- /**
1270
- * Return true if the character at specified position is a number
1271
- * @param string $str string
1272
- * @param int $pos characted position
1273
- * @return boolean true of false
1274
- */
1275
- protected function isdigitat($str, $pos) {
1276
- if ($pos >= strlen($str)) {
1277
- return false;
1278
- }
1279
- return ((ord($str[$pos]) >= ord('0'))&&(ord($str[$pos]) <= ord('9')));
1280
- }
1281
-
1282
- /**
1283
- * Return true if the character at specified position is an alphanumeric character
1284
- * @param string $str string
1285
- * @param int $pos characted position
1286
- * @return boolean true of false
1287
- */
1288
- protected function isalnumat($str, $pos) {
1289
- if ($pos >= strlen($str)) {
1290
- return false;
1291
- }
1292
- return ($this->lookAnTable(ord($str[$pos])) >= 0);
1293
- }
1294
-
1295
- /**
1296
- * identifyMode
1297
- * @param int $pos
1298
- * @return int mode
1299
- */
1300
- protected function identifyMode($pos) {
1301
- if ($pos >= strlen($this->dataStr)) {
1302
- return QR_MODE_NL;
1303
- }
1304
- $c = $this->dataStr[$pos];
1305
- if ($this->isdigitat($this->dataStr, $pos)) {
1306
- return QR_MODE_NM;
1307
- } elseif ($this->isalnumat($this->dataStr, $pos)) {
1308
- return QR_MODE_AN;
1309
- } elseif ($this->hint == QR_MODE_KJ) {
1310
- if ($pos+1 < strlen($this->dataStr)) {
1311
- $d = $this->dataStr[$pos+1];
1312
- $word = (ord($c) << 8) | ord($d);
1313
- if (($word >= 0x8140 && $word <= 0x9ffc) OR ($word >= 0xe040 && $word <= 0xebbf)) {
1314
- return QR_MODE_KJ;
1315
- }
1316
- }
1317
- }
1318
- return QR_MODE_8B;
1319
- }
1320
-
1321
- /**
1322
- * eatNum
1323
- * @return int run
1324
- */
1325
- protected function eatNum() {
1326
- $ln = $this->lengthIndicator(QR_MODE_NM, $this->version);
1327
- $p = 0;
1328
- while($this->isdigitat($this->dataStr, $p)) {
1329
- $p++;
1330
- }
1331
- $run = $p;
1332
- $mode = $this->identifyMode($p);
1333
- if ($mode == QR_MODE_8B) {
1334
- $dif = $this->estimateBitsModeNum($run) + 4 + $ln
1335
- + $this->estimateBitsMode8(1) // + 4 + l8
1336
- - $this->estimateBitsMode8($run + 1); // - 4 - l8
1337
- if ($dif > 0) {
1338
- return $this->eat8();
1339
- }
1340
- }
1341
- if ($mode == QR_MODE_AN) {
1342
- $dif = $this->estimateBitsModeNum($run) + 4 + $ln
1343
- + $this->estimateBitsModeAn(1) // + 4 + la
1344
- - $this->estimateBitsModeAn($run + 1);// - 4 - la
1345
- if ($dif > 0) {
1346
- return $this->eatAn();
1347
- }
1348
- }
1349
- $this->items = $this->appendNewInputItem($this->items, QR_MODE_NM, $run, str_split($this->dataStr));
1350
- return $run;
1351
- }
1352
-
1353
- /**
1354
- * eatAn
1355
- * @return int run
1356
- */
1357
- protected function eatAn() {
1358
- $la = $this->lengthIndicator(QR_MODE_AN, $this->version);
1359
- $ln = $this->lengthIndicator(QR_MODE_NM, $this->version);
1360
- $p = 0;
1361
- while($this->isalnumat($this->dataStr, $p)) {
1362
- if ($this->isdigitat($this->dataStr, $p)) {
1363
- $q = $p;
1364
- while($this->isdigitat($this->dataStr, $q)) {
1365
- $q++;
1366
- }
1367
- $dif = $this->estimateBitsModeAn($p) // + 4 + la
1368
- + $this->estimateBitsModeNum($q - $p) + 4 + $ln
1369
- - $this->estimateBitsModeAn($q); // - 4 - la
1370
- if ($dif < 0) {
1371
- break;
1372
- } else {
1373
- $p = $q;
1374
- }
1375
- } else {
1376
- $p++;
1377
- }
1378
- }
1379
- $run = $p;
1380
- if (!$this->isalnumat($this->dataStr, $p)) {
1381
- $dif = $this->estimateBitsModeAn($run) + 4 + $la
1382
- + $this->estimateBitsMode8(1) // + 4 + l8
1383
- - $this->estimateBitsMode8($run + 1); // - 4 - l8
1384
- if ($dif > 0) {
1385
- return $this->eat8();
1386
- }
1387
- }
1388
- $this->items = $this->appendNewInputItem($this->items, QR_MODE_AN, $run, str_split($this->dataStr));
1389
- return $run;
1390
- }
1391
-
1392
- /**
1393
- * eatKanji
1394
- * @return int run
1395
- */
1396
- protected function eatKanji() {
1397
- $p = 0;
1398
- while($this->identifyMode($p) == QR_MODE_KJ) {
1399
- $p += 2;
1400
- }
1401
- $this->items = $this->appendNewInputItem($this->items, QR_MODE_KJ, $p, str_split($this->dataStr));
1402
- return $run;
1403
- }
1404
-
1405
- /**
1406
- * eat8
1407
- * @return int run
1408
- */
1409
- protected function eat8() {
1410
- $la = $this->lengthIndicator(QR_MODE_AN, $this->version);
1411
- $ln = $this->lengthIndicator(QR_MODE_NM, $this->version);
1412
- $p = 1;
1413
- $dataStrLen = strlen($this->dataStr);
1414
- while($p < $dataStrLen) {
1415
- $mode = $this->identifyMode($p);
1416
- if ($mode == QR_MODE_KJ) {
1417
- break;
1418
- }
1419
- if ($mode == QR_MODE_NM) {
1420
- $q = $p;
1421
- while($this->isdigitat($this->dataStr, $q)) {
1422
- $q++;
1423
- }
1424
- $dif = $this->estimateBitsMode8($p) // + 4 + l8
1425
- + $this->estimateBitsModeNum($q - $p) + 4 + $ln
1426
- - $this->estimateBitsMode8($q); // - 4 - l8
1427
- if ($dif < 0) {
1428
- break;
1429
- } else {
1430
- $p = $q;
1431
- }
1432
- } elseif ($mode == QR_MODE_AN) {
1433
- $q = $p;
1434
- while($this->isalnumat($this->dataStr, $q)) {
1435
- $q++;
1436
- }
1437
- $dif = $this->estimateBitsMode8($p) // + 4 + l8
1438
- + $this->estimateBitsModeAn($q - $p) + 4 + $la
1439
- - $this->estimateBitsMode8($q); // - 4 - l8
1440
- if ($dif < 0) {
1441
- break;
1442
- } else {
1443
- $p = $q;
1444
- }
1445
- } else {
1446
- $p++;
1447
- }
1448
- }
1449
- $run = $p;
1450
- $this->items = $this->appendNewInputItem($this->items, QR_MODE_8B, $run, str_split($this->dataStr));
1451
- return $run;
1452
- }
1453
-
1454
- /**
1455
- * splitString
1456
- */
1457
- protected function splitString() {
1458
- while (strlen($this->dataStr) > 0) {
1459
- if ($this->dataStr == '') {
1460
- return 0;
1461
- }
1462
- $mode = $this->identifyMode(0);
1463
- switch ($mode) {
1464
- case QR_MODE_NM: {
1465
- $length = $this->eatNum();
1466
- break;
1467
- }
1468
- case QR_MODE_AN: {
1469
- $length = $this->eatAn();
1470
- break;
1471
- }
1472
- case QR_MODE_KJ: {
1473
- if ($hint == QR_MODE_KJ) {
1474
- $length = $this->eatKanji();
1475
- } else {
1476
- $length = $this->eat8();
1477
- }
1478
- break;
1479
- }
1480
- default: {
1481
- $length = $this->eat8();
1482
- break;
1483
- }
1484
- }
1485
- if ($length == 0) {
1486
- return 0;
1487
- }
1488
- if ($length < 0) {
1489
- return -1;
1490
- }
1491
- $this->dataStr = substr($this->dataStr, $length);
1492
- }
1493
- }
1494
-
1495
- /**
1496
- * toUpper
1497
- */
1498
- protected function toUpper() {
1499
- $stringLen = strlen($this->dataStr);
1500
- $p = 0;
1501
- while ($p < $stringLen) {
1502
- $mode = $this->identifyMode(substr($this->dataStr, $p), $this->hint);
1503
- if ($mode == QR_MODE_KJ) {
1504
- $p += 2;
1505
- } else {
1506
- if ((ord($this->dataStr[$p]) >= ord('a')) AND (ord($this->dataStr[$p]) <= ord('z'))) {
1507
- $this->dataStr[$p] = chr(ord($this->dataStr[$p]) - 32);
1508
- }
1509
- $p++;
1510
- }
1511
- }
1512
- return $this->dataStr;
1513
- }
1514
-
1515
- // - - - - - - - - - - - - - - - - - - - - - - - - -
1516
-
1517
- // QRinputItem
1518
-
1519
- /**
1520
- * newInputItem
1521
- * @param int $mode
1522
- * @param int $size
1523
- * @param array $data
1524
- * @param array $bstream
1525
- * @return array input item
1526
- */
1527
- protected function newInputItem($mode, $size, $data, $bstream=null) {
1528
- $setData = array_slice($data, 0, $size);
1529
- if (count($setData) < $size) {
1530
- $setData = array_merge($setData, array_fill(0, ($size - count($setData)), 0));
1531
- }
1532
- if (!$this->check($mode, $size, $setData)) {
1533
- return NULL;
1534
- }
1535
- $inputitem = array();
1536
- $inputitem['mode'] = $mode;
1537
- $inputitem['size'] = $size;
1538
- $inputitem['data'] = $setData;
1539
- $inputitem['bstream'] = $bstream;
1540
- return $inputitem;
1541
- }
1542
-
1543
- /**
1544
- * encodeModeNum
1545
- * @param array $inputitem
1546
- * @param int $version
1547
- * @return array input item
1548
- */
1549
- protected function encodeModeNum($inputitem, $version) {
1550
- $words = (int)($inputitem['size'] / 3);
1551
- $inputitem['bstream'] = array();
1552
- $val = 0x1;
1553
- $inputitem['bstream'] = $this->appendNum($inputitem['bstream'], 4, $val);
1554
- $inputitem['bstream'] = $this->appendNum($inputitem['bstream'], $this->lengthIndicator(QR_MODE_NM, $version), $inputitem['size']);
1555
- for ($i=0; $i < $words; ++$i) {
1556
- $val = (ord($inputitem['data'][$i*3 ]) - ord('0')) * 100;
1557
- $val += (ord($inputitem['data'][$i*3+1]) - ord('0')) * 10;
1558
- $val += (ord($inputitem['data'][$i*3+2]) - ord('0'));
1559
- $inputitem['bstream'] = $this->appendNum($inputitem['bstream'], 10, $val);
1560
- }
1561
- if ($inputitem['size'] - $words * 3 == 1) {
1562
- $val = ord($inputitem['data'][$words*3]) - ord('0');
1563
- $inputitem['bstream'] = $this->appendNum($inputitem['bstream'], 4, $val);
1564
- } elseif (($inputitem['size'] - ($words * 3)) == 2) {
1565
- $val = (ord($inputitem['data'][$words*3 ]) - ord('0')) * 10;
1566
- $val += (ord($inputitem['data'][$words*3+1]) - ord('0'));
1567
- $inputitem['bstream'] = $this->appendNum($inputitem['bstream'], 7, $val);
1568
- }
1569
- return $inputitem;
1570
- }
1571
-
1572
- /**
1573
- * encodeModeAn
1574
- * @param array $inputitem
1575
- * @param int $version
1576
- * @return array input item
1577
- */
1578
- protected function encodeModeAn($inputitem, $version) {
1579
- $words = (int)($inputitem['size'] / 2);
1580
- $inputitem['bstream'] = array();
1581
- $inputitem['bstream'] = $this->appendNum($inputitem['bstream'], 4, 0x02);
1582
- $inputitem['bstream'] = $this->appendNum(v, $this->lengthIndicator(QR_MODE_AN, $version), $inputitem['size']);
1583
- for ($i=0; $i < $words; ++$i) {
1584
- $val = (int)$this->lookAnTable(ord($inputitem['data'][$i*2 ])) * 45;
1585
- $val += (int)$this->lookAnTable(ord($inputitem['data'][$i*2+1]));
1586
- $inputitem['bstream'] = $this->appendNum($inputitem['bstream'], 11, $val);
1587
- }
1588
- if ($inputitem['size'] & 1) {
1589
- $val = $this->lookAnTable(ord($inputitem['data'][($words * 2)]));
1590
- $inputitem['bstream'] = $this->appendNum($inputitem['bstream'], 6, $val);
1591
- }
1592
- return $inputitem;
1593
- }
1594
-
1595
- /**
1596
- * encodeMode8
1597
- * @param array $inputitem
1598
- * @param int $version
1599
- * @return array input item
1600
- */
1601
- protected function encodeMode8($inputitem, $version) {
1602
- $inputitem['bstream'] = array();
1603
- $inputitem['bstream'] = $this->appendNum($inputitem['bstream'], 4, 0x4);
1604
- $inputitem['bstream'] = $this->appendNum($inputitem['bstream'], $this->lengthIndicator(QR_MODE_8B, $version), $inputitem['size']);
1605
- for ($i=0; $i < $inputitem['size']; ++$i) {
1606
- $inputitem['bstream'] = $this->appendNum($inputitem['bstream'], 8, ord($inputitem['data'][$i]));
1607
- }
1608
- return $inputitem;
1609
- }
1610
-
1611
- /**
1612
- * encodeModeKanji
1613
- * @param array $inputitem
1614
- * @param int $version
1615
- * @return array input item
1616
- */
1617
- protected function encodeModeKanji($inputitem, $version) {
1618
- $inputitem['bstream'] = array();
1619
- $inputitem['bstream'] = $this->appendNum($inputitem['bstream'], 4, 0x8);
1620
- $inputitem['bstream'] = $this->appendNum($inputitem['bstream'], $this->lengthIndicator(QR_MODE_KJ, $version), (int)($inputitem['size'] / 2));
1621
- for ($i=0; $i<$inputitem['size']; $i+=2) {
1622
- $val = (ord($inputitem['data'][$i]) << 8) | ord($inputitem['data'][$i+1]);
1623
- if ($val <= 0x9ffc) {
1624
- $val -= 0x8140;
1625
- } else {
1626
- $val -= 0xc140;
1627
- }
1628
- $h = ($val >> 8) * 0xc0;
1629
- $val = ($val & 0xff) + $h;
1630
- $inputitem['bstream'] = $this->appendNum($inputitem['bstream'], 13, $val);
1631
- }
1632
- return $inputitem;
1633
- }
1634
-
1635
- /**
1636
- * encodeModeStructure
1637
- * @param array $inputitem
1638
- * @return array input item
1639
- */
1640
- protected function encodeModeStructure($inputitem) {
1641
- $inputitem['bstream'] = array();
1642
- $inputitem['bstream'] = $this->appendNum($inputitem['bstream'], 4, 0x03);
1643
- $inputitem['bstream'] = $this->appendNum($inputitem['bstream'], 4, ord($inputitem['data'][1]) - 1);
1644
- $inputitem['bstream'] = $this->appendNum($inputitem['bstream'], 4, ord($inputitem['data'][0]) - 1);
1645
- $inputitem['bstream'] = $this->appendNum($inputitem['bstream'], 8, ord($inputitem['data'][2]));
1646
- return $inputitem;
1647
- }
1648
-
1649
- /**
1650
- * encodeBitStream
1651
- * @param array $inputitem
1652
- * @param int $version
1653
- * @return array input item
1654
- */
1655
- protected function encodeBitStream($inputitem, $version) {
1656
- $inputitem['bstream'] = array();
1657
- $words = $this->maximumWords($inputitem['mode'], $version);
1658
- if ($inputitem['size'] > $words) {
1659
- $st1 = $this->newInputItem($inputitem['mode'], $words, $inputitem['data']);
1660
- $st2 = $this->newInputItem($inputitem['mode'], $inputitem['size'] - $words, array_slice($inputitem['data'], $words));
1661
- $st1 = $this->encodeBitStream($st1, $version);
1662
- $st2 = $this->encodeBitStream($st2, $version);
1663
- $inputitem['bstream'] = array();
1664
- $inputitem['bstream'] = $this->appendBitstream($inputitem['bstream'], $st1['bstream']);
1665
- $inputitem['bstream'] = $this->appendBitstream($inputitem['bstream'], $st2['bstream']);
1666
- } else {
1667
- switch($inputitem['mode']) {
1668
- case QR_MODE_NM: {
1669
- $inputitem = $this->encodeModeNum($inputitem, $version);
1670
- break;
1671
- }
1672
- case QR_MODE_AN: {
1673
- $inputitem = $this->encodeModeAn($inputitem, $version);
1674
- break;
1675
- }
1676
- case QR_MODE_8B: {
1677
- $inputitem = $this->encodeMode8($inputitem, $version);
1678
- break;
1679
- }
1680
- case QR_MODE_KJ: {
1681
- $inputitem = $this->encodeModeKanji($inputitem, $version);
1682
- break;
1683
- }
1684
- case QR_MODE_ST: {
1685
- $inputitem = $this->encodeModeStructure($inputitem);
1686
- break;
1687
- }
1688
- default: {
1689
- break;
1690
- }
1691
- }
1692
- }
1693
- return $inputitem;
1694
- }
1695
-
1696
- // - - - - - - - - - - - - - - - - - - - - - - - - -
1697
-
1698
- // QRinput
1699
-
1700
- /**
1701
- * Append data to an input object.
1702
- * The data is copied and appended to the input object.
1703
- * @param array items input items
1704
- * @param int $mode encoding mode.
1705
- * @param int $size size of data (byte).
1706
- * @param array $data array of input data.
1707
- * @return items
1708
- *
1709
- */
1710
- protected function appendNewInputItem($items, $mode, $size, $data) {
1711
- $items[] = $this->newInputItem($mode, $size, $data);
1712
- return $items;
1713
- }
1714
-
1715
- /**
1716
- * insertStructuredAppendHeader
1717
- * @param array $items
1718
- * @param int $size
1719
- * @param int $index
1720
- * @param int $parity
1721
- * @return array items
1722
- */
1723
- protected function insertStructuredAppendHeader($items, $size, $index, $parity) {
1724
- if ($size > MAX_STRUCTURED_SYMBOLS) {
1725
- return -1;
1726
- }
1727
- if (($index <= 0) OR ($index > MAX_STRUCTURED_SYMBOLS)) {
1728
- return -1;
1729
- }
1730
- $buf = array($size, $index, $parity);
1731
- $entry = $this->newInputItem(QR_MODE_ST, 3, buf);
1732
- array_unshift($items, $entry);
1733
- return $items;
1734
- }
1735
-
1736
- /**
1737
- * calcParity
1738
- * @param array $items
1739
- * @return int parity
1740
- */
1741
- protected function calcParity($items) {
1742
- $parity = 0;
1743
- foreach ($items as $item) {
1744
- if ($item['mode'] != QR_MODE_ST) {
1745
- for ($i=$item['size']-1; $i>=0; --$i) {
1746
- $parity ^= $item['data'][$i];
1747
- }
1748
- }
1749
- }
1750
- return $parity;
1751
- }
1752
-
1753
- /**
1754
- * checkModeNum
1755
- * @param int $size
1756
- * @param array $data
1757
- * @return boolean true or false
1758
- */
1759
- protected function checkModeNum($size, $data) {
1760
- for ($i=0; $i<$size; ++$i) {
1761
- if ((ord($data[$i]) < ord('0')) OR (ord($data[$i]) > ord('9'))){
1762
- return false;
1763
- }
1764
- }
1765
- return true;
1766
- }
1767
-
1768
- /**
1769
- * estimateBitsModeNum
1770
- * @param int $size
1771
- * @return int number of bits
1772
- */
1773
- protected function estimateBitsModeNum($size) {
1774
- $w = (int)$size / 3;
1775
- $bits = $w * 10;
1776
- switch($size - $w * 3) {
1777
- case 1: {
1778
- $bits += 4;
1779
- break;
1780
- }
1781
- case 2: {
1782
- $bits += 7;
1783
- break;
1784
- }
1785
- default: {
1786
- break;
1787
- }
1788
- }
1789
- return $bits;
1790
- }
1791
-
1792
- /**
1793
- * Look up the alphabet-numeric convesion table (see JIS X0510:2004, pp.19).
1794
- * @param int $c character value
1795
- * @return value
1796
- */
1797
- protected function lookAnTable($c) {
1798
- return (($c > 127)?-1:$this->anTable[$c]);
1799
- }
1800
-
1801
- /**
1802
- * checkModeAn
1803
- * @param int $size
1804
- * @param array $data
1805
- * @return boolean true or false
1806
- */
1807
- protected function checkModeAn($size, $data) {
1808
- for ($i=0; $i<$size; ++$i) {
1809
- if ($this->lookAnTable(ord($data[$i])) == -1) {
1810
- return false;
1811
- }
1812
- }
1813
- return true;
1814
- }
1815
-
1816
- /**
1817
- * estimateBitsModeAn
1818
- * @param int $size
1819
- * @return int number of bits
1820
- */
1821
- protected function estimateBitsModeAn($size) {
1822
- $w = (int)($size / 2);
1823
- $bits = $w * 11;
1824
- if ($size & 1) {
1825
- $bits += 6;
1826
- }
1827
- return $bits;
1828
- }
1829
-
1830
- /**
1831
- * estimateBitsMode8
1832
- * @param int $size
1833
- * @return int number of bits
1834
- */
1835
- protected function estimateBitsMode8($size) {
1836
- return $size * 8;
1837
- }
1838
-
1839
- /**
1840
- * estimateBitsModeKanji
1841
- * @param int $size
1842
- * @return int number of bits
1843
- */
1844
- protected function estimateBitsModeKanji($size) {
1845
- return (int)(($size / 2) * 13);
1846
- }
1847
-
1848
- /**
1849
- * checkModeKanji
1850
- * @param int $size
1851
- * @param array $data
1852
- * @return boolean true or false
1853
- */
1854
- protected function checkModeKanji($size, $data) {
1855
- if ($size & 1) {
1856
- return false;
1857
- }
1858
- for ($i=0; $i<$size; $i+=2) {
1859
- $val = (ord($data[$i]) << 8) | ord($data[$i+1]);
1860
- if (($val < 0x8140) OR (($val > 0x9ffc) AND ($val < 0xe040)) OR ($val > 0xebbf)) {
1861
- return false;
1862
- }
1863
- }
1864
- return true;
1865
- }
1866
-
1867
- /**
1868
- * Validate the input data.
1869
- * @param int $mode encoding mode.
1870
- * @param int $size size of data (byte).
1871
- * @param array data data to validate
1872
- * @return boolean true in case of valid data, false otherwise
1873
- */
1874
- protected function check($mode, $size, $data) {
1875
- if ($size <= 0) {
1876
- return false;
1877
- }
1878
- switch($mode) {
1879
- case QR_MODE_NM: {
1880
- return $this->checkModeNum($size, $data);
1881
- }
1882
- case QR_MODE_AN: {
1883
- return $this->checkModeAn($size, $data);
1884
- }
1885
- case QR_MODE_KJ: {
1886
- return $this->checkModeKanji($size, $data);
1887
- }
1888
- case QR_MODE_8B: {
1889
- return true;
1890
- }
1891
- case QR_MODE_ST: {
1892
- return true;
1893
- }
1894
- default: {
1895
- break;
1896
- }
1897
- }
1898
- return false;
1899
- }
1900
-
1901
- /**
1902
- * estimateBitStreamSize
1903
- * @param array $items
1904
- * @param int $version
1905
- * @return int bits
1906
- */
1907
- protected function estimateBitStreamSize($items, $version) {
1908
- $bits = 0;
1909
- if ($version == 0) {
1910
- $version = 1;
1911
- }
1912
- foreach ($items as $item) {
1913
- switch($item['mode']) {
1914
- case QR_MODE_NM: {
1915
- $bits = $this->estimateBitsModeNum($item['size']);
1916
- break;
1917
- }
1918
- case QR_MODE_AN: {
1919
- $bits = $this->estimateBitsModeAn($item['size']);
1920
- break;
1921
- }
1922
- case QR_MODE_8B: {
1923
- $bits = $this->estimateBitsMode8($item['size']);
1924
- break;
1925
- }
1926
- case QR_MODE_KJ: {
1927
- $bits = $this->estimateBitsModeKanji($item['size']);
1928
- break;
1929
- }
1930
- case QR_MODE_ST: {
1931
- return STRUCTURE_HEADER_BITS;
1932
- }
1933
- default: {
1934
- return 0;
1935
- }
1936
- }
1937
- $l = $this->lengthIndicator($item['mode'], $version);
1938
- $m = 1 << $l;
1939
- $num = (int)(($item['size'] + $m - 1) / $m);
1940
- $bits += $num * (4 + $l);
1941
- }
1942
- return $bits;
1943
- }
1944
-
1945
- /**
1946
- * estimateVersion
1947
- * @param array $items
1948
- * @return int version
1949
- */
1950
- protected function estimateVersion($items) {
1951
- $version = 0;
1952
- $prev = 0;
1953
- do {
1954
- $prev = $version;
1955
- $bits = $this->estimateBitStreamSize($items, $prev);
1956
- $version = $this->getMinimumVersion((int)(($bits + 7) / 8), $this->level);
1957
- if ($version < 0) {
1958
- return -1;
1959
- }
1960
- } while ($version > $prev);
1961
- return $version;
1962
- }
1963
-
1964
- /**
1965
- * lengthOfCode
1966
- * @param int $mode
1967
- * @param int $version
1968
- * @param int $bits
1969
- * @return int size
1970
- */
1971
- protected function lengthOfCode($mode, $version, $bits) {
1972
- $payload = $bits - 4 - $this->lengthIndicator($mode, $version);
1973
- switch($mode) {
1974
- case QR_MODE_NM: {
1975
- $chunks = (int)($payload / 10);
1976
- $remain = $payload - $chunks * 10;
1977
- $size = $chunks * 3;
1978
- if ($remain >= 7) {
1979
- $size += 2;
1980
- } elseif ($remain >= 4) {
1981
- $size += 1;
1982
- }
1983
- break;
1984
- }
1985
- case QR_MODE_AN: {
1986
- $chunks = (int)($payload / 11);
1987
- $remain = $payload - $chunks * 11;
1988
- $size = $chunks * 2;
1989
- if ($remain >= 6) {
1990
- ++$size;
1991
- }
1992
- break;
1993
- }
1994
- case QR_MODE_8B: {
1995
- $size = (int)($payload / 8);
1996
- break;
1997
- }
1998
- case QR_MODE_KJ: {
1999
- $size = (int)(($payload / 13) * 2);
2000
- break;
2001
- }
2002
- case QR_MODE_ST: {
2003
- $size = (int)($payload / 8);
2004
- break;
2005
- }
2006
- default: {
2007
- $size = 0;
2008
- break;
2009
- }
2010
- }
2011
- $maxsize = $this->maximumWords($mode, $version);
2012
- if ($size < 0) {
2013
- $size = 0;
2014
- }
2015
- if ($size > $maxsize) {
2016
- $size = $maxsize;
2017
- }
2018
- return $size;
2019
- }
2020
-
2021
- /**
2022
- * createBitStream
2023
- * @param array $items
2024
- * @return array of items and total bits
2025
- */
2026
- protected function createBitStream($items) {
2027
- $total = 0;
2028
- foreach ($items as $key => $item) {
2029
- $items[$key] = $this->encodeBitStream($item, $this->version);
2030
- $bits = count($items[$key]['bstream']);
2031
- $total += $bits;
2032
- }
2033
- return array($items, $total);
2034
- }
2035
-
2036
- /**
2037
- * convertData
2038
- * @param array $items
2039
- * @return array items
2040
- */
2041
- protected function convertData($items) {
2042
- $ver = $this->estimateVersion($items);
2043
- if ($ver > $this->version) {
2044
- $this->version = $ver;
2045
- }
2046
- for (;;) {
2047
- $cbs = $this->createBitStream($items);
2048
- $items = $cbs[0];
2049
- $bits = $cbs[1];
2050
- if ($bits < 0) {
2051
- return -1;
2052
- }
2053
- $ver = $this->getMinimumVersion((int)(($bits + 7) / 8), $this->level);
2054
- if ($ver < 0) {
2055
- return -1;
2056
- } elseif ($ver > $this->version) {
2057
- $this->version = $ver;
2058
- } else {
2059
- break;
2060
- }
2061
- }
2062
- return $items;
2063
- }
2064
-
2065
- /**
2066
- * Append Padding Bit to bitstream
2067
- * @param array $bstream
2068
- * @return array bitstream
2069
- */
2070
- protected function appendPaddingBit($bstream) {
2071
- $bits = count($bstream);
2072
- $maxwords = $this->getDataLength($this->version, $this->level);
2073
- $maxbits = $maxwords * 8;
2074
- if ($maxbits == $bits) {
2075
- return 0;
2076
- }
2077
- if ($maxbits - $bits < 5) {
2078
- return $this->appendNum($bstream, $maxbits - $bits, 0);
2079
- }
2080
- $bits += 4;
2081
- $words = (int)(($bits + 7) / 8);
2082
- $padding = array();
2083
- $padding = $this->appendNum($padding, $words * 8 - $bits + 4, 0);
2084
- $padlen = $maxwords - $words;
2085
- if ($padlen > 0) {
2086
- $padbuf = array();
2087
- for ($i=0; $i<$padlen; ++$i) {
2088
- $padbuf[$i] = ($i&1)?0x11:0xec;
2089
- }
2090
- $padding = $this->appendBytes($padding, $padlen, $padbuf);
2091
- }
2092
- return $this->appendBitstream($bstream, $padding);
2093
- }
2094
-
2095
- /**
2096
- * mergeBitStream
2097
- * @param array $bstream
2098
- * @return array bitstream
2099
- */
2100
- protected function mergeBitStream($items) {
2101
- $items = $this->convertData($items);
2102
- $bstream = array();
2103
- foreach ($items as $item) {
2104
- $bstream = $this->appendBitstream($bstream, $item['bstream']);
2105
- }
2106
- return $bstream;
2107
- }
2108
-
2109
- /**
2110
- * Returns a stream of bits.
2111
- * @param int $items
2112
- * @return array padded merged byte stream
2113
- */
2114
- protected function getBitStream($items) {
2115
- $bstream = $this->mergeBitStream($items);
2116
- return $this->appendPaddingBit($bstream);
2117
- }
2118
-
2119
- /**
2120
- * Pack all bit streams padding bits into a byte array.
2121
- * @param int $items
2122
- * @return array padded merged byte stream
2123
- */
2124
- protected function getByteStream($items) {
2125
- $bstream = $this->getBitStream($items);
2126
- return $this->bitstreamToByte($bstream);
2127
- }
2128
-
2129
- // - - - - - - - - - - - - - - - - - - - - - - - - -
2130
-
2131
- // QRbitstream
2132
-
2133
- /**
2134
- * Return an array with zeros
2135
- * @param int $setLength array size
2136
- * @return array
2137
- */
2138
- protected function allocate($setLength) {
2139
- return array_fill(0, $setLength, 0);
2140
- }
2141
-
2142
- /**
2143
- * Return new bitstream from number
2144
- * @param int $bits number of bits
2145
- * @param int $num number
2146
- * @return array bitstream
2147
- */
2148
- protected function newFromNum($bits, $num) {
2149
- $bstream = $this->allocate($bits);
2150
- $mask = 1 << ($bits - 1);
2151
- for ($i=0; $i<$bits; ++$i) {
2152
- if ($num & $mask) {
2153
- $bstream[$i] = 1;
2154
- } else {
2155
- $bstream[$i] = 0;
2156
- }
2157
- $mask = $mask >> 1;
2158
- }
2159
- return $bstream;
2160
- }
2161
-
2162
- /**
2163
- * Return new bitstream from bytes
2164
- * @param int $size size
2165
- * @param array $data bytes
2166
- * @return array bitstream
2167
- */
2168
- protected function newFromBytes($size, $data) {
2169
- $bstream = $this->allocate($size * 8);
2170
- $p=0;
2171
- for ($i=0; $i<$size; ++$i) {
2172
- $mask = 0x80;
2173
- for ($j=0; $j<8; ++$j) {
2174
- if ($data[$i] & $mask) {
2175
- $bstream[$p] = 1;
2176
- } else {
2177
- $bstream[$p] = 0;
2178
- }
2179
- $p++;
2180
- $mask = $mask >> 1;
2181
- }
2182
- }
2183
- return $bstream;
2184
- }
2185
-
2186
- /**
2187
- * Append one bitstream to another
2188
- * @param array $bitstream original bitstream
2189
- * @param array $append bitstream to append
2190
- * @return array bitstream
2191
- */
2192
- protected function appendBitstream($bitstream, $append) {
2193
- if ((!is_array($append)) OR (count($append) == 0)) {
2194
- return $bitstream;
2195
- }
2196
- if (count($bitstream) == 0) {
2197
- return $append;
2198
- }
2199
- return array_values(array_merge($bitstream, $append));
2200
- }
2201
-
2202
- /**
2203
- * Append one bitstream created from number to another
2204
- * @param array $bitstream original bitstream
2205
- * @param int $bits number of bits
2206
- * @param int $num number
2207
- * @return array bitstream
2208
- */
2209
- protected function appendNum($bitstream, $bits, $num) {
2210
- if ($bits == 0) {
2211
- return 0;
2212
- }
2213
- $b = $this->newFromNum($bits, $num);
2214
- return $this->appendBitstream($bitstream, $b);
2215
- }
2216
-
2217
- /**
2218
- * Append one bitstream created from bytes to another
2219
- * @param array $bitstream original bitstream
2220
- * @param int $size size
2221
- * @param array $data bytes
2222
- * @return array bitstream
2223
- */
2224
- protected function appendBytes($bitstream, $size, $data) {
2225
- if ($size == 0) {
2226
- return 0;
2227
- }
2228
- $b = $this->newFromBytes($size, $data);
2229
- return $this->appendBitstream($bitstream, $b);
2230
- }
2231
-
2232
- /**
2233
- * Convert bitstream to bytes
2234
- * @param array $bitstream original bitstream
2235
- * @return array of bytes
2236
- */
2237
- protected function bitstreamToByte($bstream) {
2238
- $size = count($bstream);
2239
- if ($size == 0) {
2240
- return array();
2241
- }
2242
- $data = array_fill(0, (int)(($size + 7) / 8), 0);
2243
- $bytes = (int)($size / 8);
2244
- $p = 0;
2245
- for ($i=0; $i<$bytes; $i++) {
2246
- $v = 0;
2247
- for ($j=0; $j<8; $j++) {
2248
- $v = $v << 1;
2249
- $v |= $bstream[$p];
2250
- $p++;
2251
- }
2252
- $data[$i] = $v;
2253
- }
2254
- if ($size & 7) {
2255
- $v = 0;
2256
- for ($j=0; $j<($size & 7); $j++) {
2257
- $v = $v << 1;
2258
- $v |= $bstream[$p];
2259
- $p++;
2260
- }
2261
- $data[$bytes] = $v;
2262
- }
2263
- return $data;
2264
- }
2265
-
2266
- // - - - - - - - - - - - - - - - - - - - - - - - - -
2267
-
2268
- // QRspec
2269
-
2270
- /**
2271
- * Replace a value on the array at the specified position
2272
- * @param array $srctab
2273
- * @param int $x X position
2274
- * @param int $y Y position
2275
- * @param string $repl value to replace
2276
- * @param int $replLen length of the repl string
2277
- * @return array srctab
2278
- */
2279
- protected function qrstrset($srctab, $x, $y, $repl, $replLen=false) {
2280
- $srctab[$y] = substr_replace($srctab[$y], ($replLen !== false)?substr($repl,0,$replLen):$repl, $x, ($replLen !== false)?$replLen:strlen($repl));
2281
- return $srctab;
2282
- }
2283
-
2284
- /**
2285
- * Return maximum data code length (bytes) for the version.
2286
- * @param int $version version
2287
- * @param int $level error correction level
2288
- * @return int maximum size (bytes)
2289
- */
2290
- protected function getDataLength($version, $level) {
2291
- return $this->capacity[$version][QRCAP_WORDS] - $this->capacity[$version][QRCAP_EC][$level];
2292
- }
2293
-
2294
- /**
2295
- * Return maximum error correction code length (bytes) for the version.
2296
- * @param int $version version
2297
- * @param int $level error correction level
2298
- * @return int ECC size (bytes)
2299
- */
2300
- protected function getECCLength($version, $level){
2301
- return $this->capacity[$version][QRCAP_EC][$level];
2302
- }
2303
-
2304
- /**
2305
- * Return the width of the symbol for the version.
2306
- * @param int $version version
2307
- * @return int width
2308
- */
2309
- protected function getWidth($version) {
2310
- return $this->capacity[$version][QRCAP_WIDTH];
2311
- }
2312
-
2313
- /**
2314
- * Return the numer of remainder bits.
2315
- * @param int $version version
2316
- * @return int number of remainder bits
2317
- */
2318
- protected function getRemainder($version) {
2319
- return $this->capacity[$version][QRCAP_REMINDER];
2320
- }
2321
-
2322
- /**
2323
- * Return a version number that satisfies the input code length.
2324
- * @param int $size input code length (byte)
2325
- * @param int $level error correction level
2326
- * @return int version number
2327
- */
2328
- protected function getMinimumVersion($size, $level) {
2329
- for ($i=1; $i <= QRSPEC_VERSION_MAX; ++$i) {
2330
- $words = $this->capacity[$i][QRCAP_WORDS] - $this->capacity[$i][QRCAP_EC][$level];
2331
- if ($words >= $size) {
2332
- return $i;
2333
- }
2334
- }
2335
- return -1;
2336
- }
2337
-
2338
- /**
2339
- * Return the size of length indicator for the mode and version.
2340
- * @param int $mode encoding mode
2341
- * @param int $version version
2342
- * @return int the size of the appropriate length indicator (bits).
2343
- */
2344
- protected function lengthIndicator($mode, $version) {
2345
- if ($mode == QR_MODE_ST) {
2346
- return 0;
2347
- }
2348
- if ($version <= 9) {
2349
- $l = 0;
2350
- } elseif ($version <= 26) {
2351
- $l = 1;
2352
- } else {
2353
- $l = 2;
2354
- }
2355
- return $this->lengthTableBits[$mode][$l];
2356
- }
2357
-
2358
- /**
2359
- * Return the maximum length for the mode and version.
2360
- * @param int $mode encoding mode
2361
- * @param int $version version
2362
- * @return int the maximum length (bytes)
2363
- */
2364
- protected function maximumWords($mode, $version) {
2365
- if ($mode == QR_MODE_ST) {
2366
- return 3;
2367
- }
2368
- if ($version <= 9) {
2369
- $l = 0;
2370
- } else if ($version <= 26) {
2371
- $l = 1;
2372
- } else {
2373
- $l = 2;
2374
- }
2375
- $bits = $this->lengthTableBits[$mode][$l];
2376
- $words = (1 << $bits) - 1;
2377
- if ($mode == QR_MODE_KJ) {
2378
- $words *= 2; // the number of bytes is required
2379
- }
2380
- return $words;
2381
- }
2382
-
2383
- /**
2384
- * Return an array of ECC specification.
2385
- * @param int $version version
2386
- * @param int $level error correction level
2387
- * @param array $spec an array of ECC specification contains as following: {# of type1 blocks, # of data code, # of ecc code, # of type2 blocks, # of data code}
2388
- * @return array spec
2389
- */
2390
- protected function getEccSpec($version, $level, $spec) {
2391
- if (count($spec) < 5) {
2392
- $spec = array(0, 0, 0, 0, 0);
2393
- }
2394
- $b1 = $this->eccTable[$version][$level][0];
2395
- $b2 = $this->eccTable[$version][$level][1];
2396
- $data = $this->getDataLength($version, $level);
2397
- $ecc = $this->getECCLength($version, $level);
2398
- if ($b2 == 0) {
2399
- $spec[0] = $b1;
2400
- $spec[1] = (int)($data / $b1);
2401
- $spec[2] = (int)($ecc / $b1);
2402
- $spec[3] = 0;
2403
- $spec[4] = 0;
2404
- } else {
2405
- $spec[0] = $b1;
2406
- $spec[1] = (int)($data / ($b1 + $b2));
2407
- $spec[2] = (int)($ecc / ($b1 + $b2));
2408
- $spec[3] = $b2;
2409
- $spec[4] = $spec[1] + 1;
2410
- }
2411
- return $spec;
2412
- }
2413
-
2414
- /**
2415
- * Put an alignment marker.
2416
- * @param array $frame frame
2417
- * @param int $width width
2418
- * @param int $ox X center coordinate of the pattern
2419
- * @param int $oy Y center coordinate of the pattern
2420
- * @return array frame
2421
- */
2422
- protected function putAlignmentMarker($frame, $ox, $oy) {
2423
- $finder = array(
2424
- "\xa1\xa1\xa1\xa1\xa1",
2425
- "\xa1\xa0\xa0\xa0\xa1",
2426
- "\xa1\xa0\xa1\xa0\xa1",
2427
- "\xa1\xa0\xa0\xa0\xa1",
2428
- "\xa1\xa1\xa1\xa1\xa1"
2429
- );
2430
- $yStart = $oy - 2;
2431
- $xStart = $ox - 2;
2432
- for ($y=0; $y < 5; $y++) {
2433
- $frame = $this->qrstrset($frame, $xStart, $yStart+$y, $finder[$y]);
2434
- }
2435
- return $frame;
2436
- }
2437
-
2438
- /**
2439
- * Put an alignment pattern.
2440
- * @param int $version version
2441
- * @param array $fram frame
2442
- * @param int $width width
2443
- * @return array frame
2444
- */
2445
- protected function putAlignmentPattern($version, $frame, $width) {
2446
- if ($version < 2) {
2447
- return $frame;
2448
- }
2449
- $d = $this->alignmentPattern[$version][1] - $this->alignmentPattern[$version][0];
2450
- if ($d < 0) {
2451
- $w = 2;
2452
- } else {
2453
- $w = (int)(($width - $this->alignmentPattern[$version][0]) / $d + 2);
2454
- }
2455
- if ($w * $w - 3 == 1) {
2456
- $x = $this->alignmentPattern[$version][0];
2457
- $y = $this->alignmentPattern[$version][0];
2458
- $frame = $this->putAlignmentMarker($frame, $x, $y);
2459
- return $frame;
2460
- }
2461
- $cx = $this->alignmentPattern[$version][0];
2462
- $wo = $w - 1;
2463
- for ($x=1; $x < $wo; ++$x) {
2464
- $frame = $this->putAlignmentMarker($frame, 6, $cx);
2465
- $frame = $this->putAlignmentMarker($frame, $cx, 6);
2466
- $cx += $d;
2467
- }
2468
- $cy = $this->alignmentPattern[$version][0];
2469
- for ($y=0; $y < $wo; ++$y) {
2470
- $cx = $this->alignmentPattern[$version][0];
2471
- for ($x=0; $x < $wo; ++$x) {
2472
- $frame = $this->putAlignmentMarker($frame, $cx, $cy);
2473
- $cx += $d;
2474
- }
2475
- $cy += $d;
2476
- }
2477
- return $frame;
2478
- }
2479
-
2480
- /**
2481
- * Return BCH encoded version information pattern that is used for the symbol of version 7 or greater. Use lower 18 bits.
2482
- * @param int $version version
2483
- * @return BCH encoded version information pattern
2484
- */
2485
- protected function getVersionPattern($version) {
2486
- if (($version < 7) OR ($version > QRSPEC_VERSION_MAX)) {
2487
- return 0;
2488
- }
2489
- return $this->versionPattern[($version - 7)];
2490
- }
2491
-
2492
- /**
2493
- * Return BCH encoded format information pattern.
2494
- * @param array $mask
2495
- * @param int $level error correction level
2496
- * @return BCH encoded format information pattern
2497
- */
2498
- protected function getFormatInfo($mask, $level) {
2499
- if (($mask < 0) OR ($mask > 7)) {
2500
- return 0;
2501
- }
2502
- if (($level < 0) OR ($level > 3)) {
2503
- return 0;
2504
- }
2505
- return $this->formatInfo[$level][$mask];
2506
- }
2507
-
2508
- /**
2509
- * Put a finder pattern.
2510
- * @param array $frame frame
2511
- * @param int $width width
2512
- * @param int $ox X center coordinate of the pattern
2513
- * @param int $oy Y center coordinate of the pattern
2514
- * @return array frame
2515
- */
2516
- protected function putFinderPattern($frame, $ox, $oy) {
2517
- $finder = array(
2518
- "\xc1\xc1\xc1\xc1\xc1\xc1\xc1",
2519
- "\xc1\xc0\xc0\xc0\xc0\xc0\xc1",
2520
- "\xc1\xc0\xc1\xc1\xc1\xc0\xc1",
2521
- "\xc1\xc0\xc1\xc1\xc1\xc0\xc1",
2522
- "\xc1\xc0\xc1\xc1\xc1\xc0\xc1",
2523
- "\xc1\xc0\xc0\xc0\xc0\xc0\xc1",
2524
- "\xc1\xc1\xc1\xc1\xc1\xc1\xc1"
2525
- );
2526
- for ($y=0; $y < 7; $y++) {
2527
- $frame = $this->qrstrset($frame, $ox, ($oy + $y), $finder[$y]);
2528
- }
2529
- return $frame;
2530
- }
2531
-
2532
- /**
2533
- * Return a copy of initialized frame.
2534
- * @param int $version version
2535
- * @return Array of unsigned char.
2536
- */
2537
- protected function createFrame($version) {
2538
- $width = $this->capacity[$version][QRCAP_WIDTH];
2539
- $frameLine = str_repeat ("\0", $width);
2540
- $frame = array_fill(0, $width, $frameLine);
2541
- // Finder pattern
2542
- $frame = $this->putFinderPattern($frame, 0, 0);
2543
- $frame = $this->putFinderPattern($frame, $width - 7, 0);
2544
- $frame = $this->putFinderPattern($frame, 0, $width - 7);
2545
- // Separator
2546
- $yOffset = $width - 7;
2547
- for ($y=0; $y < 7; ++$y) {
2548
- $frame[$y][7] = "\xc0";
2549
- $frame[$y][$width - 8] = "\xc0";
2550
- $frame[$yOffset][7] = "\xc0";
2551
- ++$yOffset;
2552
- }
2553
- $setPattern = str_repeat("\xc0", 8);
2554
- $frame = $this->qrstrset($frame, 0, 7, $setPattern);
2555
- $frame = $this->qrstrset($frame, $width-8, 7, $setPattern);
2556
- $frame = $this->qrstrset($frame, 0, $width - 8, $setPattern);
2557
- // Format info
2558
- $setPattern = str_repeat("\x84", 9);
2559
- $frame = $this->qrstrset($frame, 0, 8, $setPattern);
2560
- $frame = $this->qrstrset($frame, $width - 8, 8, $setPattern, 8);
2561
- $yOffset = $width - 8;
2562
- for ($y=0; $y < 8; ++$y,++$yOffset) {
2563
- $frame[$y][8] = "\x84";
2564
- $frame[$yOffset][8] = "\x84";
2565
- }
2566
- // Timing pattern
2567
- $wo = $width - 15;
2568
- for ($i=1; $i < $wo; ++$i) {
2569
- $frame[6][7+$i] = chr(0x90 | ($i & 1));
2570
- $frame[7+$i][6] = chr(0x90 | ($i & 1));
2571
- }
2572
- // Alignment pattern
2573
- $frame = $this->putAlignmentPattern($version, $frame, $width);
2574
- // Version information
2575
- if ($version >= 7) {
2576
- $vinf = $this->getVersionPattern($version);
2577
- $v = $vinf;
2578
- for ($x=0; $x<6; ++$x) {
2579
- for ($y=0; $y<3; ++$y) {
2580
- $frame[($width - 11)+$y][$x] = chr(0x88 | ($v & 1));
2581
- $v = $v >> 1;
2582
- }
2583
- }
2584
- $v = $vinf;
2585
- for ($y=0; $y<6; ++$y) {
2586
- for ($x=0; $x<3; ++$x) {
2587
- $frame[$y][$x+($width - 11)] = chr(0x88 | ($v & 1));
2588
- $v = $v >> 1;
2589
- }
2590
- }
2591
- }
2592
- // and a little bit...
2593
- $frame[$width - 8][8] = "\x81";
2594
- return $frame;
2595
- }
2596
-
2597
- /**
2598
- * Set new frame for the specified version.
2599
- * @param int $version version
2600
- * @return Array of unsigned char.
2601
- */
2602
- protected function newFrame($version) {
2603
- if (($version < 1) OR ($version > QRSPEC_VERSION_MAX)) {
2604
- return NULL;
2605
- }
2606
- if (!isset($this->frames[$version])) {
2607
- $this->frames[$version] = $this->createFrame($version);
2608
- }
2609
- if (is_null($this->frames[$version])) {
2610
- return NULL;
2611
- }
2612
- return $this->frames[$version];
2613
- }
2614
-
2615
- /**
2616
- * Return block number 0
2617
- * @param array $spec
2618
- * @return int value
2619
- */
2620
- protected function rsBlockNum($spec) {
2621
- return ($spec[0] + $spec[3]);
2622
- }
2623
-
2624
- /**
2625
- * Return block number 1
2626
- * @param array $spec
2627
- * @return int value
2628
- */
2629
- protected function rsBlockNum1($spec) {
2630
- return $spec[0];
2631
- }
2632
-
2633
- /**
2634
- * Return data codes 1
2635
- * @param array $spec
2636
- * @return int value
2637
- */
2638
- protected function rsDataCodes1($spec) {
2639
- return $spec[1];
2640
- }
2641
-
2642
- /**
2643
- * Return ecc codes 1
2644
- * @param array $spec
2645
- * @return int value
2646
- */
2647
- protected function rsEccCodes1($spec) {
2648
- return $spec[2];
2649
- }
2650
-
2651
- /**
2652
- * Return block number 2
2653
- * @param array $spec
2654
- * @return int value
2655
- */
2656
- protected function rsBlockNum2($spec) {
2657
- return $spec[3];
2658
- }
2659
-
2660
- /**
2661
- * Return data codes 2
2662
- * @param array $spec
2663
- * @return int value
2664
- */
2665
- protected function rsDataCodes2($spec) {
2666
- return $spec[4];
2667
- }
2668
-
2669
- /**
2670
- * Return ecc codes 2
2671
- * @param array $spec
2672
- * @return int value
2673
- */
2674
- protected function rsEccCodes2($spec) {
2675
- return $spec[2];
2676
- }
2677
-
2678
- /**
2679
- * Return data length
2680
- * @param array $spec
2681
- * @return int value
2682
- */
2683
- protected function rsDataLength($spec) {
2684
- return ($spec[0] * $spec[1]) + ($spec[3] * $spec[4]);
2685
- }
2686
-
2687
- /**
2688
- * Return ecc length
2689
- * @param array $spec
2690
- * @return int value
2691
- */
2692
- protected function rsEccLength($spec) {
2693
- return ($spec[0] + $spec[3]) * $spec[2];
2694
- }
2695
-
2696
- // - - - - - - - - - - - - - - - - - - - - - - - - -
2697
-
2698
- // QRrs
2699
-
2700
- /**
2701
- * Initialize a Reed-Solomon codec and add it to existing rsitems
2702
- * @param int $symsize symbol size, bits
2703
- * @param int $gfpoly Field generator polynomial coefficients
2704
- * @param int $fcr first root of RS code generator polynomial, index form
2705
- * @param int $prim primitive element to generate polynomial roots
2706
- * @param int $nroots RS code generator polynomial degree (number of roots)
2707
- * @param int $pad padding bytes at front of shortened block
2708
- * @return array Array of RS values:<ul><li>mm = Bits per symbol;</li><li>nn = Symbols per block;</li><li>alpha_to = log lookup table array;</li><li>index_of = Antilog lookup table array;</li><li>genpoly = Generator polynomial array;</li><li>nroots = Number of generator;</li><li>roots = number of parity symbols;</li><li>fcr = First consecutive root, index form;</li><li>prim = Primitive element, index form;</li><li>iprim = prim-th root of 1, index form;</li><li>pad = Padding bytes in shortened block;</li><li>gfpoly</ul>.
2709
- */
2710
- protected function init_rs($symsize, $gfpoly, $fcr, $prim, $nroots, $pad) {
2711
- foreach ($this->rsitems as $rs) {
2712
- if (($rs['pad'] != $pad) OR ($rs['nroots'] != $nroots) OR ($rs['mm'] != $symsize)
2713
- OR ($rs['gfpoly'] != $gfpoly) OR ($rs['fcr'] != $fcr) OR ($rs['prim'] != $prim)) {
2714
- continue;
2715
- }
2716
- return $rs;
2717
- }
2718
- $rs = $this->init_rs_char($symsize, $gfpoly, $fcr, $prim, $nroots, $pad);
2719
- array_unshift($this->rsitems, $rs);
2720
- return $rs;
2721
- }
2722
-
2723
- // - - - - - - - - - - - - - - - - - - - - - - - - -
2724
-
2725
- // QRrsItem
2726
-
2727
- /**
2728
- * modnn
2729
- * @param array RS values
2730
- * @param int $x X position
2731
- * @return int X osition
2732
- */
2733
- protected function modnn($rs, $x) {
2734
- while ($x >= $rs['nn']) {
2735
- $x -= $rs['nn'];
2736
- $x = ($x >> $rs['mm']) + ($x & $rs['nn']);
2737
- }
2738
- return $x;
2739
- }
2740
-
2741
- /**
2742
- * Initialize a Reed-Solomon codec and returns an array of values.
2743
- * @param int $symsize symbol size, bits
2744
- * @param int $gfpoly Field generator polynomial coefficients
2745
- * @param int $fcr first root of RS code generator polynomial, index form
2746
- * @param int $prim primitive element to generate polynomial roots
2747
- * @param int $nroots RS code generator polynomial degree (number of roots)
2748
- * @param int $pad padding bytes at front of shortened block
2749
- * @return array Array of RS values:<ul><li>mm = Bits per symbol;</li><li>nn = Symbols per block;</li><li>alpha_to = log lookup table array;</li><li>index_of = Antilog lookup table array;</li><li>genpoly = Generator polynomial array;</li><li>nroots = Number of generator;</li><li>roots = number of parity symbols;</li><li>fcr = First consecutive root, index form;</li><li>prim = Primitive element, index form;</li><li>iprim = prim-th root of 1, index form;</li><li>pad = Padding bytes in shortened block;</li><li>gfpoly</ul>.
2750
- */
2751
- protected function init_rs_char($symsize, $gfpoly, $fcr, $prim, $nroots, $pad) {
2752
- // Based on Reed solomon encoder by Phil Karn, KA9Q (GNU-LGPLv2)
2753
- $rs = null;
2754
- // Check parameter ranges
2755
- if (($symsize < 0) OR ($symsize > 8)) {
2756
- return $rs;
2757
- }
2758
- if (($fcr < 0) OR ($fcr >= (1<<$symsize))) {
2759
- return $rs;
2760
- }
2761
- if (($prim <= 0) OR ($prim >= (1<<$symsize))) {
2762
- return $rs;
2763
- }
2764
- if (($nroots < 0) OR ($nroots >= (1<<$symsize))) {
2765
- return $rs;
2766
- }
2767
- if (($pad < 0) OR ($pad >= ((1<<$symsize) -1 - $nroots))) {
2768
- return $rs;
2769
- }
2770
- $rs = array();
2771
- $rs['mm'] = $symsize;
2772
- $rs['nn'] = (1 << $symsize) - 1;
2773
- $rs['pad'] = $pad;
2774
- $rs['alpha_to'] = array_fill(0, ($rs['nn'] + 1), 0);
2775
- $rs['index_of'] = array_fill(0, ($rs['nn'] + 1), 0);
2776
- // PHP style macro replacement ;)
2777
- $NN =& $rs['nn'];
2778
- $A0 =& $NN;
2779
- // Generate Galois field lookup tables
2780
- $rs['index_of'][0] = $A0; // log(zero) = -inf
2781
- $rs['alpha_to'][$A0] = 0; // alpha**-inf = 0
2782
- $sr = 1;
2783
- for ($i=0; $i<$rs['nn']; ++$i) {
2784
- $rs['index_of'][$sr] = $i;
2785
- $rs['alpha_to'][$i] = $sr;
2786
- $sr <<= 1;
2787
- if ($sr & (1 << $symsize)) {
2788
- $sr ^= $gfpoly;
2789
- }
2790
- $sr &= $rs['nn'];
2791
- }
2792
- if ($sr != 1) {
2793
- // field generator polynomial is not primitive!
2794
- return NULL;
2795
- }
2796
- // Form RS code generator polynomial from its roots
2797
- $rs['genpoly'] = array_fill(0, ($nroots + 1), 0);
2798
- $rs['fcr'] = $fcr;
2799
- $rs['prim'] = $prim;
2800
- $rs['nroots'] = $nroots;
2801
- $rs['gfpoly'] = $gfpoly;
2802
- // Find prim-th root of 1, used in decoding
2803
- for ($iprim=1; ($iprim % $prim) != 0; $iprim += $rs['nn']) {
2804
- ; // intentional empty-body loop!
2805
- }
2806
- $rs['iprim'] = (int)($iprim / $prim);
2807
- $rs['genpoly'][0] = 1;
2808
-
2809
-
2810
- for ($i = 0,$root=$fcr*$prim; $i < $nroots; $i++, $root += $prim) {
2811
- $rs['genpoly'][$i+1] = 1;
2812
- // Multiply rs->genpoly[] by @**(root + x)
2813
- for ($j = $i; $j > 0; --$j) {
2814
- if ($rs['genpoly'][$j] != 0) {
2815
- $rs['genpoly'][$j] = $rs['genpoly'][$j-1] ^ $rs['alpha_to'][$this->modnn($rs, $rs['index_of'][$rs['genpoly'][$j]] + $root)];
2816
- } else {
2817
- $rs['genpoly'][$j] = $rs['genpoly'][$j-1];
2818
- }
2819
- }
2820
- // rs->genpoly[0] can never be zero
2821
- $rs['genpoly'][0] = $rs['alpha_to'][$this->modnn($rs, $rs['index_of'][$rs['genpoly'][0]] + $root)];
2822
- }
2823
- // convert rs->genpoly[] to index form for quicker encoding
2824
- for ($i = 0; $i <= $nroots; ++$i) {
2825
- $rs['genpoly'][$i] = $rs['index_of'][$rs['genpoly'][$i]];
2826
- }
2827
- return $rs;
2828
- }
2829
-
2830
- /**
2831
- * Encode a Reed-Solomon codec and returns the parity array
2832
- * @param array $rs RS values
2833
- * @param array $data data
2834
- * @param array $parity parity
2835
- * @return parity array
2836
- */
2837
- protected function encode_rs_char($rs, $data, $parity) {
2838
- $MM =& $rs['mm']; // bits per symbol
2839
- $NN =& $rs['nn']; // the total number of symbols in a RS block
2840
- $ALPHA_TO =& $rs['alpha_to']; // the address of an array of NN elements to convert Galois field elements in index (log) form to polynomial form
2841
- $INDEX_OF =& $rs['index_of']; // the address of an array of NN elements to convert Galois field elements in polynomial form to index (log) form
2842
- $GENPOLY =& $rs['genpoly']; // an array of NROOTS+1 elements containing the generator polynomial in index form
2843
- $NROOTS =& $rs['nroots']; // the number of roots in the RS code generator polynomial, which is the same as the number of parity symbols in a block
2844
- $FCR =& $rs['fcr']; // first consecutive root, index form
2845
- $PRIM =& $rs['prim']; // primitive element, index form
2846
- $IPRIM =& $rs['iprim']; // prim-th root of 1, index form
2847
- $PAD =& $rs['pad']; // the number of pad symbols in a block
2848
- $A0 =& $NN;
2849
- $parity = array_fill(0, $NROOTS, 0);
2850
- for ($i=0; $i < ($NN - $NROOTS - $PAD); $i++) {
2851
- $feedback = $INDEX_OF[$data[$i] ^ $parity[0]];
2852
- if ($feedback != $A0) {
2853
- // feedback term is non-zero
2854
- // This line is unnecessary when GENPOLY[NROOTS] is unity, as it must
2855
- // always be for the polynomials constructed by init_rs()
2856
- $feedback = $this->modnn($rs, $NN - $GENPOLY[$NROOTS] + $feedback);
2857
- for ($j=1; $j < $NROOTS; ++$j) {
2858
- $parity[$j] ^= $ALPHA_TO[$this->modnn($rs, $feedback + $GENPOLY[($NROOTS - $j)])];
2859
- }
2860
- }
2861
- // Shift
2862
- array_shift($parity);
2863
- if ($feedback != $A0) {
2864
- array_push($parity, $ALPHA_TO[$this->modnn($rs, $feedback + $GENPOLY[0])]);
2865
- } else {
2866
- array_push($parity, 0);
2867
- }
2868
- }
2869
- return $parity;
2870
- }
2871
-
2872
- } // end QRcode class
2873
-
2874
- } // END OF "class_exists QRcode"
2875
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/vendor/phpqrcode/cache/frame_1.dat DELETED
@@ -1,2 +0,0 @@
1
- xڝ��
2
- E�ɲQ���m��h۾9{kI"� 9Ln)Ap��־�>�^��z�m�nŖ;��m�n����
 
 
pro/vendor/phpqrcode/cache/frame_1.png DELETED
Binary file
pro/vendor/phpqrcode/cache/frame_10.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/frame_10.png DELETED
Binary file
pro/vendor/phpqrcode/cache/frame_11.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/frame_11.png DELETED
Binary file
pro/vendor/phpqrcode/cache/frame_12.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/frame_12.png DELETED
Binary file
pro/vendor/phpqrcode/cache/frame_13.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/frame_13.png DELETED
Binary file
pro/vendor/phpqrcode/cache/frame_14.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/frame_14.png DELETED
Binary file
pro/vendor/phpqrcode/cache/frame_15.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/frame_15.png DELETED
Binary file
pro/vendor/phpqrcode/cache/frame_16.dat DELETED
@@ -1 +0,0 @@
1
- x��A� E]s�IX�;��n6��`�q���W6���`�%A/3!�����!g��̡�1N)�E��|;��>6⸏�97$����c]kk��w�1��[�m�C͜c�R���>�����E,�hʼnp�#�xF�yW��VWG���3��+����˓�S��}Ğ�#�G8b^c^c���p�c&3YQ"�����v������������k�9�܇�}������ �Ŀ�Q��L�/����
 
pro/vendor/phpqrcode/cache/frame_16.png DELETED
Binary file
pro/vendor/phpqrcode/cache/frame_17.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/frame_17.png DELETED
Binary file
pro/vendor/phpqrcode/cache/frame_18.dat DELETED
@@ -1,2 +0,0 @@
1
- x��A
2
- �0E]�օ,2;s��&�͚h���O������1&09OIv@DD��&�ىK�X��Fv�<�dq�9�<%h��Y�s!(d���s;~||b(��Yůg#�`�K��S����Ķ��s�idߍLg:ә�t�/gm����k�M�3�{�4rT�Q��e��s�>�<ә�t�3���;�H�#љ�t�3��Y�+og�h���ٽ�ln��F>�i^�#awm;g�~p�g�Ns{6z��������p��'
 
 
pro/vendor/phpqrcode/cache/frame_18.png DELETED
Binary file
pro/vendor/phpqrcode/cache/frame_19.dat DELETED
@@ -1,3 +0,0 @@
1
- x��A
2
- � E���.�No�7ћ��iiR�N2��W%�x�@�ڜ�'�
3
- u�6��.�*S;}���à�T���zr�t��%�,�����}�;���)�����Z��L����P��$����q�g�L��dJ�;��w���.]z#���[͝��Og����"�� �B��}�}�;��w���#1Gb��;��w���_�C+w�@Df����u��2����N��9R7|pW�k�������k���������
 
 
 
pro/vendor/phpqrcode/cache/frame_19.png DELETED
Binary file
pro/vendor/phpqrcode/cache/frame_2.dat DELETED
@@ -1 +0,0 @@
1
- x�͒�
 
pro/vendor/phpqrcode/cache/frame_2.png DELETED
Binary file
pro/vendor/phpqrcode/cache/frame_20.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/frame_20.png DELETED
Binary file
pro/vendor/phpqrcode/cache/frame_21.dat DELETED
@@ -1 +0,0 @@
1
- x��A� E]s�IX�;��n6Up���в��]٘�<i-eW����)��ŕ��…H\jvq�HL\6���ЅrI��Lܹ��%��@���V�v�����(�P4|�Xn�gɝ��~]D����u1Us S\���,��2��N��?D�K��F-:�eJ]p_���,�a0�`���X��`���w,`X�]��������5��Y4{���2���v�Js����9���)�u�۹���,�]����^_�7$�_�
 
pro/vendor/phpqrcode/cache/frame_21.png DELETED
Binary file
pro/vendor/phpqrcode/cache/frame_22.dat DELETED
@@ -1,3 +0,0 @@
1
- x��A
2
- �0E]{�.�]{{{��Z�Bep��we@�V�ERZ3��"*2o�4�y�)i#d�bdF҅��I"���4��W�I�u��45�x�.Z�S�{���8���k={o.�q���[��:帒q���y
3
- )t#�N8�dCj�-O�OG}�:/�:s�z!�)^<�e��S�u�{� '�p� '�=�=�=�'�p� '�p�ߣߣ���N8���9����pQQ�]H�pz���G�^�Q��I|�߳�u;9�����d;�X~$����t����dy
 
 
 
pro/vendor/phpqrcode/cache/frame_22.png DELETED
Binary file
pro/vendor/phpqrcode/cache/frame_23.dat DELETED
@@ -1,3 +0,0 @@
1
- x��A
2
- � E���fo�7ћU�) %M!Δ��Yu(<���sK��T���
3
- �&�I�\i+�Ъ�(m��FQ���h�����v~n1�o�]s����_ޟ�3`�_w2�ȹ�lc[��;��c֟ˤ�N�4�p�
 
 
 
pro/vendor/phpqrcode/cache/frame_23.png DELETED
Binary file
pro/vendor/phpqrcode/cache/frame_24.dat DELETED
@@ -1 +0,0 @@
1
- x��A� E���MX0;���nVP4�HSS�x�U3�/O��LiJ4���V�JC�%��6VR&��D�B�HjD��J�??���Bl�cDZ�'�U��X�U�ޏ0��yw�į�j��똳�3ś��cj���{���:Gq�G��������N�v;��笓J���<���]�����#�8�#�8�H'�������Gq�G��tr:9�#�8�#�8�ؓh���N�t����_��>t�e��S�����^�\g���Qe?�vu��o��;��>�*�wl��m�
 
pro/vendor/phpqrcode/cache/frame_24.png DELETED
Binary file
pro/vendor/phpqrcode/cache/frame_25.dat DELETED
@@ -1,3 +0,0 @@
1
- x���A
2
- � ��s낋�]r�x�Y51mM�BG
3
- ��*Sx|Ua5Ƶ�Z���-,�1�H�P�Rj��X5��i����G�>W���R���/��+uT廯��ӯ嗴�u����[S�a�[kv��5�+5n���J��%+V�X�bŊ�߬u'�������SR����tzZ��+�+V�X�bŊ�ٟٟٟ��+V�X�b��������}Ŋ+V�X�������VI�����+k�q�[��t��oVZ��voNV�w�}�{�r<ýR��"�R��]�
 
 
 
pro/vendor/phpqrcode/cache/frame_25.png DELETED
Binary file
pro/vendor/phpqrcode/cache/frame_26.dat DELETED
@@ -1,2 +0,0 @@
1
- x��A
2
- � E��օ,t�7�7ћU� E)i7�*~c����X�EB��FC���6�:&�L,�Mv.����Kg�ո�YM�>���>�mۚ�?��v���mg?��ұ����η�d��C��U��Ik���E\��Ms�f�a�f�a>�[sӈ9쬩ެ8b�<k��7�}�k������3�0�3�0�3��*r��\�7f�a�f�a�fr��\�7f�a�f�a�Y�����d�4�9k�����y�X y�g���)��dw�n̢�U�>��]��Lg�������Eo� w1
 
 
pro/vendor/phpqrcode/cache/frame_26.png DELETED
Binary file
pro/vendor/phpqrcode/cache/frame_27.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/frame_27.png DELETED
Binary file
pro/vendor/phpqrcode/cache/frame_28.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/frame_28.png DELETED
Binary file
pro/vendor/phpqrcode/cache/frame_29.dat DELETED
@@ -1,2 +0,0 @@
1
- x���A� �a�޺ ����@n7+*����4�!�?�J��� ���抮�]���S��Tf)��s�I�"�Ȕb��0��|�"Luٸ�,��E�1\6�*�uQ�?�>a�υ����R�-r���n.�ꯋ\�T��:�*)|)��,��,�������x_�}:^R��Uoɢ�u�~�މX`�XЏЏЏЏ�_`�X`�XЏЏЏ�_`�X`�XЏЏЏЏ�wb�X`���PU��)D��"c�{�z���3��<}��^?b�m���잃�����a������.�]
2
- �{Q6u�T,9
 
 
pro/vendor/phpqrcode/cache/frame_29.png DELETED
Binary file
pro/vendor/phpqrcode/cache/frame_3.dat DELETED
@@ -1 +0,0 @@
1
- x���
 
pro/vendor/phpqrcode/cache/frame_3.png DELETED
Binary file
pro/vendor/phpqrcode/cache/frame_30.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/frame_30.png DELETED
Binary file
pro/vendor/phpqrcode/cache/frame_31.dat DELETED
@@ -1 +0,0 @@
1
- x���A� �a�޺ ��
 
pro/vendor/phpqrcode/cache/frame_31.png DELETED
Binary file
pro/vendor/phpqrcode/cache/frame_32.dat DELETED
@@ -1,2 +0,0 @@
1
- x����
2
- � ��־����.� �D�l�,��Mz��6��Ç gcJ�D;�'.�A�Iq�މ�I,Ir�Y����Fk%�D�O�y|ED�D��(L�_Y��>*ߚ?a�O��k�L_�<[c���>�c˘�u�LI��%�#�0�#�0�#��otѢ���}��4�f�v_)��E�p���h5R��8�8�1�#�0�#�0���i�tZ�#�0�#�0�#�0���i�tZ�#�0�#�0�#�0���i�tZ�l�0�#�0���9q"��HܜH�Q����"��L5}-��Y׾��k�`��>�z鸳���4&�p��!���!��`�:5
 
 
pro/vendor/phpqrcode/cache/frame_32.png DELETED
Binary file
pro/vendor/phpqrcode/cache/frame_33.dat DELETED
@@ -1,14 +0,0 @@
1
- x���A� �a�޺�����@n7+*L++�柮����bb�*LC�����ck�H�r��j���J5Y�i~0�_����T�T�}�e�>��5�b_�w�͟?���������\��Ra�i+7��W��\��wLUN�L��
2
- +���
3
- +������j��O��kc�����\˩|%�o<�k��L�+�+�v���
4
- +���
5
- +��Š>}��8���
6
- +���
7
- +���
8
- +���3�g��
9
- +���
10
- +���
11
- +��3�g��@���
12
- +���
13
- +���
14
- +��:R���X��B�9��I�=�k���o/Sw�ؘ�ٯ�`g������r_ٙ�Y��VSY��zIefnmQoz
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/vendor/phpqrcode/cache/frame_33.png DELETED
Binary file
pro/vendor/phpqrcode/cache/frame_34.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/frame_34.png DELETED
Binary file
pro/vendor/phpqrcode/cache/frame_35.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/frame_35.png DELETED
Binary file
pro/vendor/phpqrcode/cache/frame_36.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/frame_36.png DELETED
Binary file
pro/vendor/phpqrcode/cache/frame_37.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/frame_37.png DELETED
Binary file
pro/vendor/phpqrcode/cache/frame_38.dat DELETED
@@ -1 +0,0 @@
1
- x���A��0Ў�u�A2�;Н��k�(�g��y�tp9��$��D���\�e^'t�-aI��FM�S�k��I�Ť�:7��|L�k�N�8N7���i}����i,�[W��g�Ӵ���?3�1�i��N�}}=�OM:4��)S�L�2eʔ)S�L#$��
 
pro/vendor/phpqrcode/cache/frame_38.png DELETED
Binary file
pro/vendor/phpqrcode/cache/frame_39.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/frame_39.png DELETED
Binary file
pro/vendor/phpqrcode/cache/frame_4.dat DELETED
@@ -1 +0,0 @@
1
- x���
 
pro/vendor/phpqrcode/cache/frame_4.png DELETED
Binary file
pro/vendor/phpqrcode/cache/frame_40.dat DELETED
@@ -1,2 +0,0 @@
1
- x���A��@Ь������@o�7��`�Qfe�䕫PA>�����<?jjo5WNiz��y�W���&]߅C?�I�r�W��^;�8��
2
- ��s<ð��S{�9^gE�}>�<]����߳bZ�n�^A��Q}[�9^�]�y��najM܇K̘1cƌ3f̘1��{�W5}�{��7lM���ޚx�I<��K����αyl3f̘1cƌ3f̘1�ۻٻ={��αyl3f̘1cƌ3f̘1�ۻٻ={��αyl3f̘1cƌ3f̘1�ۻٻ={��αyl3f̘1cƌ3f̘1�ۻٻ={��αyl3f̘1cƌ3f̘���Sʑ�Ӓ7�H�K޼g\��u���_��r'4�[��-�]��q��L��8Ɲ��Y1q�����!���/(%�
 
 
pro/vendor/phpqrcode/cache/frame_40.png DELETED
Binary file
pro/vendor/phpqrcode/cache/frame_5.dat DELETED
@@ -1 +0,0 @@
1
- x��1� E��u�7Л��Z��|N���DB0@R$l,-�>VKZ[<���z�qƎ��YJ&�i�嚂�Zy�:Y'�Y��V�&�e�R�"�sj��r��+���.�MƎ���9��z�s���,
 
pro/vendor/phpqrcode/cache/frame_5.png DELETED
Binary file
pro/vendor/phpqrcode/cache/frame_6.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/frame_6.png DELETED
Binary file
pro/vendor/phpqrcode/cache/frame_7.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/frame_7.png DELETED
Binary file
pro/vendor/phpqrcode/cache/frame_8.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/frame_8.png DELETED
Binary file
pro/vendor/phpqrcode/cache/frame_9.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/frame_9.png DELETED
Binary file
pro/vendor/phpqrcode/cache/index.php DELETED
@@ -1,2 +0,0 @@
1
- <?php /* Silence will fall */ ?>
2
-
 
 
pro/vendor/phpqrcode/cache/mask_0/index.php DELETED
@@ -1,2 +0,0 @@
1
- <?php /* Silence will fall */ ?>
2
-
 
 
pro/vendor/phpqrcode/cache/mask_0/mask_101_0.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_0/mask_105_0.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_0/mask_109_0.dat DELETED
@@ -1,2 +0,0 @@
1
- x���=
2
- �0н�i�9'�b�$��t�����^#i����i?����b�K[AU�F徝Ƶijx]m�]2�������-Ė�K�~�Vw}�X���������&O�ɓ�666666yR��'�%lllll/��h�l���m ����d�l���3�+��mͫ
 
 
pro/vendor/phpqrcode/cache/mask_0/mask_113_0.dat DELETED
@@ -1,2 +0,0 @@
1
- x���;
2
- �0�>�I��9+E�s�=ϤL1̄[���F�ZU�4�?i<���;7����;��P��#�W-[�ݯ6���dddddd�c",;�"���sk�摑������Q&��erw######�L.���摑������Иy�1�^˲\����3�������� ��v
 
 
pro/vendor/phpqrcode/cache/mask_0/mask_117_0.dat DELETED
@@ -1,2 +0,0 @@
1
- x���A
2
- �0�}O���r�R,#3���,�����o5�C���q:���;;�wvN��JZG�=�m���}��
 
 
pro/vendor/phpqrcode/cache/mask_0/mask_121_0.dat DELETED
@@ -1 +0,0 @@
1
- x���1� ���/��w
 
pro/vendor/phpqrcode/cache/mask_0/mask_125_0.dat DELETED
@@ -1,2 +0,0 @@
1
- x���A
2
- � н���_���TH`3AO�L�4�k����(���ew��GW����.� #��2���} \��Y����gggggggggg_d�>���j^���s��;;;;;;;;;;�'��q�;;;;;;;;;�'˰�q�u����������_P�������Yw�{e��=d�����G�/���
 
 
pro/vendor/phpqrcode/cache/mask_0/mask_129_0.dat DELETED
@@ -1,2 +0,0 @@
1
- x���1
2
- � �����/�*��D�E�'�hg�t�-�}_�pV�� \"�b=s������[��J��=8Dh�o�۞'�0X� ���۴����e�0`������j"0`����Wf`^P0`����2�Ȁ�� ���d07(��<O����o�����
 
 
pro/vendor/phpqrcode/cache/mask_0/mask_133_0.dat DELETED
@@ -1,2 +0,0 @@
1
- x���1
2
- �0н�I�9����Ty�)<4��h�N��SҚ��]��Z��?�[��H<�u����FI�7����R�`��,X���E�޹�˴]�Wg���y��,X�`!���Y�#�,X�`���<"��#�,X�`���<bg!���,X�`���Wy�O4ѷ��wf��>Y�/XL�Gb�y�"�pT�
 
 
pro/vendor/phpqrcode/cache/mask_0/mask_137_0.dat DELETED
@@ -1 +0,0 @@
1
- x���1� О���/��+F�Z?�J��L�7Ժ���*�B�a%L~��˻�����ʓC��J��Y�IWJ ���.K]�R�0a„ ��$��INTw�lL�a���L�0a„ &Ld@P�O�0a„ &L�0�e@P?a„ &L�0a�D�e@�� &L�0a���M��IlL&)dl��g��acR�<�$�v�,��ɺ?U2�]
 
pro/vendor/phpqrcode/cache/mask_0/mask_141_0.dat DELETED
@@ -1,2 +0,0 @@
1
- x���=
2
- �0н�i�9'E���Dx͘%<l�[Z�|ZP�N �N��M�7;�m�fovm�6-�w��ޥ}�y��aÆ
 
 
pro/vendor/phpqrcode/cache/mask_0/mask_145_0.dat DELETED
@@ -1,2 +0,0 @@
1
- x���;
2
- �0�>�I��9+E��{��$�m��^�&���u��S"��D��6ڟ]9���8�U�M���b�Ҿ�Y���[�2拉Ĉ#F�1bĈ��%��iRN�潝�ѳ��#;�#F�1bĈ�N��1�i�#F�1bĈ#F�tZ}��Nk1bĈ#F�1b���k�tZ;�#F�1b���F�V-���u�"IoD-�*�7u��j�>b�MV�+
 
 
pro/vendor/phpqrcode/cache/mask_0/mask_149_0.dat DELETED
@@ -1,3 +0,0 @@
1
- x���A
2
- � н���_�MEQXP৞.�|94���e��{�JL�v���#�^���n[��?;�
3
- ZIV-���*w�˒1*+V�X�bŊ��X����g��w��qX}�J�R�Y�bŊ+V�X�beΠwfeΠ^�bŊ+V�X�b�ʜA��ʜA�bŊ+V�X�bŊ�9��ٜ��A�bŊ+V�X�bŊ�l��0��*0T�j`?���Ϊ�����;X���=zZr*
 
 
 
pro/vendor/phpqrcode/cache/mask_0/mask_153_0.dat DELETED
@@ -1 +0,0 @@
1
- x���1� Н���/礑h�&F��`�Ҽ@I;P�Z�^��X�͌�mf��.�=�5[if-���R+!wr�˜g\j̘1cƌ3f̘1cf��o.�2�?�1���z�
 
pro/vendor/phpqrcode/cache/mask_0/mask_157_0.dat DELETED
@@ -1,2 +0,0 @@
1
- x���A
2
- � ��_��QR����Y
 
 
pro/vendor/phpqrcode/cache/mask_0/mask_161_0.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_0/mask_165_0.dat DELETED
@@ -1,2 +0,0 @@
1
- x���;
2
- �0�>�I�9+��Dy�I�4ˠ�5�:��W���v�d���q�ߜܴ<��d�2x%[���U�%����2�]&K�,Y�dɒ%ˡ,S�՗�r2yd�=,�k�_�{X�dɒ%K�,Y�d)�0���m�,Y�dɒ%K�,Y�d)�0���m�,Y�dɒ%K�,Y��m��e,e�%K�,Y�dɒ%K�,e�q��
 
 
pro/vendor/phpqrcode/cache/mask_0/mask_169_0.dat DELETED
@@ -1,2 +0,0 @@
1
- x���1
2
- �0�>�I��9EQ�=��Ls��I���{�Zt��R���}����S��n:�|��R[�?��_*S�L�2eʔ)S�L��&Ϧ�I��O�2�O���2eʔ)S�L�2e*C1��P��P�S�L�2eʔ)S�L��P��2�2��)S�L�2eʔ)S�Le(�}�2��)S�L�2eʔ)S�Le(�}�2��)S�L�2eʔ)S��i�c7;�"�ޙFͦސٙv�L��^��2}oO��'r
 
 
pro/vendor/phpqrcode/cache/mask_0/mask_173_0.dat DELETED
@@ -1 +0,0 @@
1
- x���1�0�ޯ����T ���[4v��2��ƽok݇��;�Ӳ]f��֞�d���lj�lG���0n+�߻m�G�˖-[�lٲe�"����Y�}o�������V��[�lٲe˖-[�lٲe��հՃ�[�2�lٲe˖-[�lٲe��հՃ�[�2�lٲe˖-[�lٲe��հՃ�[�lٲe˖-[�lٲe�V��a���lٲe˖-[�lٲef[�B��mа��E���;�N��-ۜT�/r��l��?��*�
 
pro/vendor/phpqrcode/cache/mask_0/mask_177_0.dat DELETED
@@ -1,2 +0,0 @@
1
- x���1
2
- �0�>�I�9+?����߁��iևd�̹��xֈx�N��/�է|{�ظ�����8d�����0�h��=��cFf̘1cƌ3f̘q�q�=�w6�;l��4cƕ�<�nj3f̘1cƌ3f�X�һ1ֻ�cƌ3f̘1cƌ3f�X�b�w�nj3f̘1cƌ3f̘��M'�X�&��1cƌ3f̘1cƌ3ֻ��n��n�1cƌ3f̘1cƌÍ3U<�
 
 
pro/vendor/phpqrcode/cache/mask_0/mask_21_0.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_0/mask_25_0.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_0/mask_29_0.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_0/mask_33_0.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_0/mask_37_0.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_0/mask_41_0.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_0/mask_45_0.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_0/mask_49_0.dat DELETED
@@ -1,2 +0,0 @@
1
- x���K� E�9���o�#?H/�6g$�-���,X]
2
- ��xݘ;��X԰�9��<�Ѻ��q��2�Af��H�7��/5We�{�#���fި��?�4�=N >��
 
 
pro/vendor/phpqrcode/cache/mask_0/mask_53_0.dat DELETED
@@ -1,2 +0,0 @@
1
- x���K
2
- @!й���o�Q�Ϻ:(m&���s-����6��Z{��m4Y��X���.F�٭���XZi���j=:έ֋b忑VH8�#�[������Y���^X��e
 
 
pro/vendor/phpqrcode/cache/mask_0/mask_57_0.dat DELETED
@@ -1,4 +0,0 @@
1
- x���A
2
- � �{^���s=YL՚
3
- o�u���j)��
4
- Z7y�����v,Դ�wVQ �i���GiҤ��Df�ە��wo4�Ѥ���o�L���Lȼ���������}�4�
 
 
 
 
pro/vendor/phpqrcode/cache/mask_0/mask_61_0.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_0/mask_65_0.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_0/mask_69_0.dat DELETED
@@ -1 +0,0 @@
1
- x���K� �=���_�+�m��B���d|Q"s+1���"�),�=�E��a T�"���n�E-3,��KY�w�=Z�Z�T�.,��K1��#<XBt��<��a��b�#�x/;X.���
 
pro/vendor/phpqrcode/cache/mask_0/mask_73_0.dat DELETED
@@ -1 +0,0 @@
1
- x���1� �����/��FSM(���7��/JTme�ӕ��l�����s�|��)YY�U�S%�7{i��(L�0mo�짻'���w��DŽ {�=Όc��)�2���֦�~���Lz�)�vZ5O2]=��?
 
pro/vendor/phpqrcode/cache/mask_0/mask_77_0.dat DELETED
@@ -1,2 +0,0 @@
1
- x���A� D�}O���r�0����B�/;b�Hp/��*K�E7�G���/_l}�x��MP
2
- [(筊��Zޛ�lI6lض�eϷ��O������^��
 
 
pro/vendor/phpqrcode/cache/mask_0/mask_81_0.dat DELETED
@@ -1,2 +0,0 @@
1
- x���1� �ὧi�9'�Bߠ���E�Mpo#
2
- �& �a���6��)c�~��b
 
 
pro/vendor/phpqrcode/cache/mask_0/mask_85_0.dat DELETED
@@ -1,2 +0,0 @@
1
- x���1
2
- � ��=�I��NE�Z_����m E�Vqy�2Yh,S�[����g��UXJkd��.��~>֞!�Ŋ+V�嬪�����.���2�X�bŊ����+V�X����.�kB��z���w��ձ�̀g�k��YZ�
 
 
pro/vendor/phpqrcode/cache/mask_0/mask_89_0.dat DELETED
@@ -1 +0,0 @@
1
- x���1� �ὧi�9'�������Hl?L��^"�&M��?b�q��?˸��,�9���!��z�]V��Scƌ3�_����c��!�`n��3f̘1c�̌�� 3f̘1/f�>.U��c�˻;�
 
pro/vendor/phpqrcode/cache/mask_0/mask_93_0.dat DELETED
@@ -1,3 +0,0 @@
1
- x���K
2
- � E�yV����,�O�mޠr�PH�0�{��������2�b�����c{t�Q�]
3
- {Q�{��{弬֒�ǎ;v��_ڳ��}�����L�}l�߱cǎ;v�̑̑̑رcǎ������.L���egw�3���qe��Ѿ@�i
 
 
 
pro/vendor/phpqrcode/cache/mask_0/mask_97_0.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_1/index.php DELETED
@@ -1,2 +0,0 @@
1
- <?php /* Silence will fall */ ?>
2
-
 
 
pro/vendor/phpqrcode/cache/mask_1/mask_101_1.dat DELETED
@@ -1,2 +0,0 @@
1
- x���1
2
- � н����\Q��E���d 1���N�<�#��Ֆ��-7u��.��l�ԦeiXXXXXRZV��VeIo1�,,,,,v%�?��gaaaa��Y�K&K=/���+ۍ�˱����ގ�
 
 
pro/vendor/phpqrcode/cache/mask_1/mask_105_1.dat DELETED
@@ -1 +0,0 @@
1
- x���1� ��Ӕ�_Υ�b��
 
pro/vendor/phpqrcode/cache/mask_1/mask_109_1.dat DELETED
@@ -1 +0,0 @@
1
- x��ֱ
 
pro/vendor/phpqrcode/cache/mask_1/mask_113_1.dat DELETED
@@ -1 +0,0 @@
1
- x���1� ������
 
pro/vendor/phpqrcode/cache/mask_1/mask_117_1.dat DELETED
@@ -1,2 +0,0 @@
1
- x��ֻ
2
- +�yeeeeeeee�#���WVVVVVVVV;"+�yeeeeeee�l�'�e;b��&�^9�{�/�J$p
 
 
pro/vendor/phpqrcode/cache/mask_1/mask_121_1.dat DELETED
@@ -1,2 +0,0 @@
1
- x���1
2
- � н����\���C�PbїE��<D�Gd���QG̪�3�����k?3�s�9_�z�9i���������|3W���3�����������,W��r�7���������Y�`���a���������sd^���g�ۚ����4��
 
 
pro/vendor/phpqrcode/cache/mask_1/mask_125_1.dat DELETED
@@ -1,2 +0,0 @@
1
- x���1
2
- � н����\��:���҂�>$�DdƩ���Y����t�څ�λ������0�$���������������ή���������������ꝝ��������g�a7�y��������ٯ�痽Y??���{�{���D��
 
 
pro/vendor/phpqrcode/cache/mask_1/mask_129_1.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_1/mask_133_1.dat DELETED
@@ -1 +0,0 @@
1
- x���1� ��Ӕ�_΅���h���h���|"z�ۉ�-*dN��������H���QĢ�RÂ,X�`�c���9�Y�(na_�`��,X�,X�,X�`���#:8���,X�`�B�d�¾`��,X|ϢY\X��;�7-��;�`
 
pro/vendor/phpqrcode/cache/mask_1/mask_137_1.dat DELETED
@@ -1,3 +0,0 @@
1
- x���1
2
- �0��Ӥ���Kh]D���,-t ��#�ڌ�Q[T�� �K�s�7_����?9|�B&�X�^L�0a„��&3���„�M�&L�0a„ &2���D4c�0a„ &L�Ȁ�Ќe„ &L�0ab��w�Ȁf,&L�0a„�7&y2�a��n�oL�<01O
3
- ����
 
 
 
pro/vendor/phpqrcode/cache/mask_1/mask_141_1.dat DELETED
@@ -1,2 +0,0 @@
1
- x���1
2
- � �>�9���4�6)�3�$`s��uʮ�>Wd��
 
 
pro/vendor/phpqrcode/cache/mask_1/mask_145_1.dat DELETED
@@ -1 +0,0 @@
1
- x���!�0@�k�����4a)�q�2i.YCUO{35�UZ�F�n]�fN>bd��wtzJ�F}�F�1bĈ#F���(��F�6r�1bĈ#F�1�E1�i�lF�1bĈ#F�tF��#F�1bĈ#F�tZ}�#��#F�1bĈ�l��e��H��G���ܣ@�ٝ��
 
pro/vendor/phpqrcode/cache/mask_1/mask_149_1.dat DELETED
@@ -1 +0,0 @@
1
- x���1� ��Ӕ�_΅��q�H�_X��c��i�#Gd̘�Ք՛��g��LU�^ݮVR�>dKV�X�bŊ+V�Xe�o��X���J_�bŊ+V�X�b��;�ݙ+}Ŋ+V�X�bŊ+V�AV���ngŊ+V�X�bŊ�}�+���+V�X�bŊ�V��j��>�hewf����*`uTq�
 
pro/vendor/phpqrcode/cache/mask_1/mask_153_1.dat DELETED
@@ -1,2 +0,0 @@
1
- x���1
2
- �0���\��9��bt��E�c'���HH���9�efߞmff�M�������#.̘1cƌ3f̘1cf��7�3f̘�g̘1cƌ3f̘1c�o2c�]�?�3f̘1cƌ3f�5�Mf��3f̘1cƌ3f̘1�7utf��3f̘1cƌ3f̘=���l����j��3���>�����V�
 
 
pro/vendor/phpqrcode/cache/mask_1/mask_157_1.dat DELETED
@@ -1,2 +0,0 @@
1
- x���1
2
- � �>�9���4S��d/�5��1��V�)Sk�J����v��7���������eG�cǎ;v�رc��]Z���ٱc'�رcǎ;v�ر�+ر�g�;v�رcǎ;}V�`�N��+رcǎ;v���:;v�;v�رcǎ;��;}Vޱcǎ;v�ص��'��vz�#;��]���klw�oA`
 
 
pro/vendor/phpqrcode/cache/mask_1/mask_161_1.dat DELETED
@@ -1 +0,0 @@
1
- x���1�0�����_΅X���šyi~���Q�b��kv�p���7'M
 
pro/vendor/phpqrcode/cache/mask_1/mask_165_1.dat DELETED
@@ -1 +0,0 @@
1
- x���1� ��Ӕ�_ΥLK^��#�F��YWt��%ˍ�����4�����r��M,��Q�X�dɒ%K�,Y��������d�Ҽdɒ%K�,Y�dɒ%K�%K�
 
pro/vendor/phpqrcode/cache/mask_1/mask_169_1.dat DELETED
@@ -1 +0,0 @@
1
- x���1� н���_���M,����B^��5*V���K�N�n2�����N�NO��i6>�S�L�2eʔ)S�L�2��M�
 
pro/vendor/phpqrcode/cache/mask_1/mask_173_1.dat DELETED
@@ -1 +0,0 @@
1
- x���1� ��Ӕ�_Υ''�@y]X��1?"g�:1犝fn˶��˻����m������m.?��lٲe˖-�F����>glٲ���2�lٲe˖-[�lٲe�O`˖��e˖-[�lٲe˖-[�l� lٲ��lٲe˖-[�lٲe�V�O`˖��e˖-[�lٲe˖-[�z0}[�z0y˖-[�lٲe˖-[�E��e[h�O��VWö���=��t�*|
 
pro/vendor/phpqrcode/cache/mask_1/mask_177_1.dat DELETED
@@ -1 +0,0 @@
1
- x���1� �������E���p0�X���,a#r��}��6}nj��������~���\�8��ƌ3f̘1cƌ�7���{�3f,��y�3f̘1cƌ3f�X_��`�X�&�3f̘1cƌ3f̘��M_��1cy̘1cƌ3f̘1cƌ�+3f,��y�3f̘1cƌ3f�X_�b�X�&�3f̘1cƌ3f�x��2�d����X'�x[cy|��
 
pro/vendor/phpqrcode/cache/mask_1/mask_21_1.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_1/mask_25_1.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_1/mask_29_1.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_1/mask_33_1.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_1/mask_37_1.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_1/mask_41_1.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_1/mask_45_1.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_1/mask_49_1.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_1/mask_53_1.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_1/mask_57_1.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_1/mask_61_1.dat DELETED
@@ -1 +0,0 @@
1
- x�30�Cb�pP�����i`�@�&��H^��n�a�d�Q�G��{�n<v�Z���G�Mk�v��=j7��⠳���9m��n7��<����h
 
pro/vendor/phpqrcode/cache/mask_1/mask_65_1.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_1/mask_69_1.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_1/mask_73_1.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_1/mask_77_1.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_1/mask_81_1.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_1/mask_85_1.dat DELETED
@@ -1,2 +0,0 @@
1
- x���1
2
- � н����\�]��4���AA h���M�\Q��js��Ak�U���jm�un2R������Κ5��:k;�������jƲ�[����eo����[�o��[��k����Z�
 
 
pro/vendor/phpqrcode/cache/mask_1/mask_89_1.dat DELETED
@@ -1 +0,0 @@
1
- x���1� ��Ӕ�_΅�N�h}%��@ iDO�H��*c�"���<��g���)�<m�Bs������������w�ja.av��������7��Affff極�2淾��5 �uح�9�|���
 
pro/vendor/phpqrcode/cache/mask_1/mask_93_1.dat DELETED
@@ -1,2 +0,0 @@
1
- x���;
2
- � �>���_.��4I���y킎��`)-5*��(��of[�sm�}���������6YM ;;;;;�G{��z�ط����������z1vw������}�=�wu���L�%�?�"�=�~e�i
 
 
pro/vendor/phpqrcode/cache/mask_1/mask_97_1.dat DELETED
@@ -1,2 +0,0 @@
1
- x���1
2
- �0н�1��\��tncK����<D��i3#Gdgt(lxV��P���9�F�7lia``````�ސq/]5��v�����������ne``````x��-mX�^���3�5,�y�-��#
 
 
pro/vendor/phpqrcode/cache/mask_2/index.php DELETED
@@ -1,2 +0,0 @@
1
- <?php /* Silence will fall */ ?>
2
-
 
 
pro/vendor/phpqrcode/cache/mask_2/mask_101_2.dat DELETED
@@ -1,3 +0,0 @@
1
- x���1
2
- � н������C�� �Ux!��?1�e�����)���s��*�KۮLf�B�P(��J֮�ܨx/
3
- �B�a(2�B�P(2E��P(ʲR�S�(%qWR�S����iY�
 
 
 
pro/vendor/phpqrcode/cache/mask_2/mask_105_2.dat DELETED
@@ -1 +0,0 @@
1
- x���!� @����\M��i�p4s��� 6��ꙑYs�"�7���&)=�;�
 
pro/vendor/phpqrcode/cache/mask_2/mask_109_2.dat DELETED
@@ -1,2 +0,0 @@
1
- x���1
2
- �0н�1��\�@�Nֈ<q��#��#v�����-e~_�����[�����h4�6JK��Fj��F��h4��E�'i4�F�ɓ4y�F��h��Z�EcS-;��&j��������
 
 
pro/vendor/phpqrcode/cache/mask_2/mask_113_2.dat DELETED
@@ -1 +0,0 @@
1
- x���1�0�����_�š��Ъ�0�ځ�D\5*{�#��b�H'o+vU��R1�P�D"�H$����>�D"�H$��D��H$�D"Q&�Wer�H$�D"���*x[�(�?/����'��nd
 
pro/vendor/phpqrcode/cache/mask_2/mask_117_2.dat DELETED
@@ -1,2 +0,0 @@
1
- x���1
2
- � �>�9���4!m dO�s\�0X,la�5#��E���>Z[�ַ�����R�T*�J�R?Q-���*�T*�J�R��?U��W*�J�R�Tݟ���+�J�R�Ԥ���~m5��;���S�&+
 
 
pro/vendor/phpqrcode/cache/mask_2/mask_121_2.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_2/mask_125_2.dat DELETED
@@ -1 +0,0 @@
1
- x���!� P�Ӕ�_�@
 
pro/vendor/phpqrcode/cache/mask_2/mask_129_2.dat DELETED
@@ -1,2 +0,0 @@
1
- x���1
2
- �0н���_�K�Vڡ��'.���!���w]A0X����~����� �!��������࣠fK# x�Fy���4�vey��������@^�+���~�� �� L#��veI�
 
 
pro/vendor/phpqrcode/cache/mask_2/mask_133_2.dat DELETED
@@ -1,10 +0,0 @@
1
- x���1
2
- � н�������&�`��L������Q-�g=Aq�b����ʪ<�v�b�+�)((((((((�I�n*�<b��G(((((((((�
3
- y�{AAAAAAAA!���)�
4
-
5
-
6
-
7
-
8
-
9
-
10
- ����'�e�������M���fv{
 
 
 
 
 
 
 
 
 
 
pro/vendor/phpqrcode/cache/mask_2/mask_137_2.dat DELETED
@@ -1,2 +0,0 @@
1
- x���1
2
- � н����\�N�I,/d+ʣ`�/F|5*z�'H.�,x�O[K�K���������MBBBBBB�T�|?!!9�8�$$$$$$$$$$2 �h�����������Ȁ$2�yBBBBBBBBBB"e�Ȁ� ɟ$��I�%ɿۓ��H�b��_x���
 
 
pro/vendor/phpqrcode/cache/mask_2/mask_141_2.dat DELETED
@@ -1,2 +0,0 @@
1
- x���=
2
- � �����t*-�?���M���[�hU��]W��B��;���d�wS�j>��l�
 
 
pro/vendor/phpqrcode/cache/mask_2/mask_145_2.dat DELETED
@@ -1,4 +0,0 @@
1
- x���1
2
- � ���r]
3
- �,t�Q^�&�C������~�
4
- щ��j~mɾ�.��Fg���MDDDDDDDDDDD�ST�׈��D�����������H����dZ��L+�ɴDDDDDDDDDDD2-��'"""""""":B��ת�E�Y���Dd�������
 
 
 
 
pro/vendor/phpqrcode/cache/mask_2/mask_149_2.dat DELETED
@@ -1 +0,0 @@
1
- x���;�@�����/gcaG�BXB�'�-��ˆ���ouէUQ�d�RVOm��T��*ǫ�;;����������j��廝��Ee2PQQQQQQQQQQQ����TTTTTTTTTTTTr�3����������������3�R��&��Ts�����k��z_e2P=���d�
 
pro/vendor/phpqrcode/cache/mask_2/mask_153_2.dat DELETED
@@ -1,2 +0,0 @@
1
- x���1
2
- �0��Ӥ����8ZP!��B�����Zu��賶"���bu�������*�����)]MFFFFFFFFFFFF���%= #���ddddddddddddr
 
 
pro/vendor/phpqrcode/cache/mask_2/mask_157_2.dat DELETED
@@ -1,3 +0,0 @@
1
- x���1
2
- �0�>����s6�M���qUH1�X�&U�̘�f�/u-���'���.��[�KGGGGGGGGGG�H�|NG��(tttttttttt��NF���;::::::::::}��N�������������z��$
3
- �>�������������n��A�#��^AG���(t�� =3{
 
 
 
pro/vendor/phpqrcode/cache/mask_2/mask_161_2.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_2/mask_165_2.dat DELETED
@@ -1,2 +0,0 @@
1
- x���1
2
- �0��Ӥ������?�B�V���UG����%���������*�+�_�f��s MIIIIIIIII��2d;��l�4�()))))))))))e�qJنIDIIIIIIIIIII)۠��mPRRRRRRRRRRR�6l����
 
 
pro/vendor/phpqrcode/cache/mask_2/mask_169_2.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_2/mask_173_2.dat DELETED
@@ -1 +0,0 @@
1
- x���+�@P�i�����f�t�:>y &dU߬���S��[�������]5Z;a��5V۞�����������A���[Z�˴��������������V���ՃI0ZZZZZZZZZZZZZZ=-�L�����������������hi�`��������������VFK������������������?�ݧ��hio�J0��}��o
 
pro/vendor/phpqrcode/cache/mask_2/mask_177_2.dat DELETED
@@ -1,2 +0,0 @@
1
- x���1
2
- � E�>�Y��4�V$�~�,C���&U���;Oo�k5b��ϙ���G�x9��%&&&&&&&&&&&n$���OL|��v#&&&&&&&&&&&&&��bbݍ��������������Xw#&��l7bbbbbbbbbbbbbb�M"��l7bbbbbbbbbbbbbb�Ma!&�݈������������3�)U<WܱW�/�݈#�n �
 
 
pro/vendor/phpqrcode/cache/mask_2/mask_21_2.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_2/mask_25_2.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_2/mask_29_2.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_2/mask_33_2.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_2/mask_37_2.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_2/mask_41_2.dat DELETED
@@ -1 +0,0 @@
1
- x�30�C���JB�&�ù�Ш�Q��*��JXi@l�0�U��>�*F�>�
 
pro/vendor/phpqrcode/cache/mask_2/mask_45_2.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_2/mask_49_2.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_2/mask_53_2.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_2/mask_57_2.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_2/mask_61_2.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_2/mask_65_2.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_2/mask_69_2.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_2/mask_73_2.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_2/mask_77_2.dat DELETED
@@ -1 +0,0 @@
1
- x���1� н���_��CM��>�G�t �ѫe�+��FW�ZE��m�&gއF�Ѷh��F+�t/�F��Yv�F���������j��[*7��a�
 
pro/vendor/phpqrcode/cache/mask_2/mask_81_2.dat DELETED
@@ -1,2 +0,0 @@
1
- x���1
2
- �0н���_�K�ҩVi!O\"�A�����]�:�x����bW��1�uȦ&��_��T ΋6�H$��U^�D�~bׯ�b=g����X����
 
 
pro/vendor/phpqrcode/cache/mask_2/mask_85_2.dat DELETED
@@ -1,2 +0,0 @@
1
- x���1
2
- �0�=�1��\�B7���O�$�A0$��8W�����wjgu�u��槊�R�T*u��S֧���J�R��T�J�R��R����ޢN�浘�V�
 
 
pro/vendor/phpqrcode/cache/mask_2/mask_89_2.dat DELETED
@@ -1 +0,0 @@
1
- x��ٱ �0�>���/�&E*c��Qq���Ń�zf$���rM�����<��sa#d2�L&�?�ArY��d2�L�G"�3�L&�{���Rygw�;���
 
pro/vendor/phpqrcode/cache/mask_2/mask_93_2.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_2/mask_97_2.dat DELETED
@@ -1,2 +0,0 @@
1
- x���1
2
- �0��_�Ki�vH4
 
 
pro/vendor/phpqrcode/cache/mask_3/index.php DELETED
@@ -1,2 +0,0 @@
1
- <?php /* Silence will fall */ ?>
2
-
 
 
pro/vendor/phpqrcode/cache/mask_3/mask_101_3.dat DELETED
@@ -1 +0,0 @@
1
- x���K� E�yWS��9'D1񟾪p �/9�Ё�u���,k�u9�Ҥ�$���%�ݭwAL��b%ClA��zq۴�붌��b�!���Ĥw�X�4`���_�'FWr�!�b��&�t1�<FWr�!�b��X��y���C1Ć����Ӈ�)E{W�ٯAӅgL�1]�-&�Ƽ����Lqn�
 
pro/vendor/phpqrcode/cache/mask_3/mask_105_3.dat DELETED
@@ -1 +0,0 @@
1
- x���1� D�~O3��r6��@(�1�'������J}4���gk�9�7��A=������i��p}��w��ZJo����8���JB=��C�s=
 
pro/vendor/phpqrcode/cache/mask_3/mask_109_3.dat DELETED
@@ -1 +0,0 @@
1
- x���1� D�~O3��r6��� �O(�;���V6��sy������>�)�_%s�_���d3K�O1^�a��L��,�$�H"�$�KzRP�t[I&��X���9�$�H"�$��I�$y�sI$�DI$ɓ�I�$�I$�Dɍ%e��s�!��=����LAZ5��'�̓IV��r�n��/2oƅ
 
pro/vendor/phpqrcode/cache/mask_3/mask_113_3.dat DELETED
@@ -1,2 +0,0 @@
1
- x���A
2
- �0D�}N���rnD��Fj2�K���C�t?W��ݲ�Z�i��.q����o�P�����%Smj���7�ަ�:������*��N��:@�:����������*���*����*��f��W9d�2�����*����j�*}�S@��`���*����j���৪6�Jl���ѿ�}��}�է��T��U�a�24hnt
 
 
pro/vendor/phpqrcode/cache/mask_3/mask_117_3.dat DELETED
@@ -1,4 +0,0 @@
1
- x���1
2
- �0�]�Q��.�xI�B$�����?~!�<�Q?�#���5�/tI�J8ow�i�{����}�S��^��~���q猉P„ &L�0�J��1��ϻݢ�D�K'�J�Ä &L�0ᝅ��n
3
- ��0a„ &Lxga��G��*�&L�0a�{
4
- g{����2��s�Ή~���7\]%r�J��9nZ
 
 
 
 
pro/vendor/phpqrcode/cache/mask_3/mask_121_3.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_3/mask_125_3.dat DELETED
@@ -1,2 +0,0 @@
1
- x���1
2
- � �~N3��rۄ]��BБ�'�?<��/̼V۵�������ҏ�����<��0-_�J�[��?� +w��^;*�y��ɓ'O�<��/9��ɯ�9�<��y�Ɯ'O�<y��ɓ'�J^��a�ț6�
 
 
pro/vendor/phpqrcode/cache/mask_3/mask_129_3.dat DELETED
@@ -1,8 +0,0 @@
1
- x���A
2
- � ��6!n� �G<q�4�h�/��G?;�h�s����LST�����Oj�����2#���
3
- D��y`�ܫ���P�@�
4
- ��\�B�4*yt$�
5
- (P� /�򂼠#Q�@�
6
- �yA^�t$
7
- (P�@��� /��D�
8
- (�\����.`���ɛj�o��C��S��;R�;R�.��I�
 
 
 
 
 
 
 
 
pro/vendor/phpqrcode/cache/mask_3/mask_133_3.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_3/mask_137_3.dat DELETED
@@ -1,2 +0,0 @@
1
- x���A
2
- �0�}N���rn�F�HS���YQ|���Z��E�f��u�,%� �$�uj��G�:��z���o��u�,:O��s�Y�ď��e��:t��I�s��j��|��+�N�5���d�lt�СC�:t���;��b:�M�ѡC�:t��9���h���H6�F�:t�СCǽ�ڨ{A%�d�C�:t���N��$^ur�dV�����'\�wj��S���t��;U��'[�,7��
 
 
pro/vendor/phpqrcode/cache/mask_3/mask_141_3.dat DELETED
@@ -1,2 +0,0 @@
1
- x���A
2
- �0�}N�{�˹)%]�j�f/d!�u��O�U����c����0}��a�4�R9���_���T�~�`����_ R[�T�ծ���n1�ݒ"E�)R�H-*�p�~H�ܥ�J����԰��g��"E�)R�H�J�ҧ4��2�L?R�H�"E�)RiR��滀��g��"E�)R�H���>��z���#E�)R�H�Z@�b�l-)�ݿ�<ߧ*�OUR�"5&����5�*i�e�J]�+
 
 
pro/vendor/phpqrcode/cache/mask_3/mask_145_3.dat DELETED
@@ -1,3 +0,0 @@
1
- x����
2
- �@��|�������:�^��Jy̡��yM���j��-'
3
- 9�V�S��֦K��9��e��)P�yU����w�e�-m jԨQ�F�5jԨ�R�i٫�F4�_wk}�0+��jRBR�F�5jԨQ�����e�OMBJHjԨQ�F�5jwP�״�˪IH I�5jԨQ�Fͳ������c �w�5jԨQ�F���:����zS��*2��UZ_��C��*�e_O���Z�%dIȯ��b
 
 
 
pro/vendor/phpqrcode/cache/mask_3/mask_149_3.dat DELETED
@@ -1 +0,0 @@
1
- x���A�0�}O���ܠ⦐H頯���'�Z�2{oV�|Ι�%���>��y��R{�!8��ÂI+JpI|#��f�5κ[�PA� $H� ��Q}�)�&<��E�� JQ)J� A� $H� �s5z�����%H� A� $H��4A�^��5A)*E $H� A� $� ��3�MHQ� $H� A�� ��3ާ`�P���o��>X{ט��+��Wb������`I��)5��%d�
 
pro/vendor/phpqrcode/cache/mask_3/mask_153_3.dat DELETED
@@ -1,2 +0,0 @@
1
- x���A
2
- �0�}N�s�˹)7mJ���,�}8���X=c�W^G�e��N�<v]]b��Iͯ_����gY+M��j���vˋt��&M�4iҤI�&M���xޜ��u~o[�~��4W55���I�&M�4iҤI��S5ML��i5-M�4iҤI�&M�4o�iz`z@S�jZ�4iҤI�&M�4iz�����s(�V�ҤI�&M�4iҤ��Y��zK
 
 
pro/vendor/phpqrcode/cache/mask_3/mask_157_3.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_3/mask_161_3.dat DELETED
@@ -1,3 +0,0 @@
1
- x���A
2
- �0�}N���rn�F��Tk�,��N��� �Z�ђf7J�:�ƒ^`W�ٔU��nXڤ�ǧM-����#V��+ߡ��+9z��ҖY�l�)S�L��o�c���ʱO_C�?ߩ�%�;*Kl�M�2eʔ)S�L�2�Ye��]���[bS�L�2eʔ)S�LyVY�lW��G�[bS�L�2eʔ)S�L��
3
- ��]g+$��eʔ)S�L�2eʔ���/�q�BbKlʔ)S�L�2e�qʙ�����]�£{�A�����/��~��V9�\%���[�P�#'
 
 
 
pro/vendor/phpqrcode/cache/mask_3/mask_165_3.dat DELETED
@@ -1,2 +0,0 @@
1
- x���A
2
- �0�}N3����T�#�Z��Y�u�Ï�:�̛�1�ϱE�U��T�T|S����� ��q�)�m-sG��� ����B��.C�ĉ'N�8q�ğ������wv7�[��'�tg��!.ե:q�ĉ'N�8q�����v`�_+.ե:q�ĉ'N�8q�����v`���R�8q�ĉ'N�8q�Τ����8�"ե:q�ĉ'N�8q�ĝIяہq&E�Ku�ĉ'N�8q��+��9:�}kFT?^���Џ�G��o<0իC�g/�_�
 
 
pro/vendor/phpqrcode/cache/mask_3/mask_169_3.dat DELETED
@@ -1 +0,0 @@
1
- x���A�0�}O3��rn���񷾦�)}�'3��1E��h���]�4�P[
 
pro/vendor/phpqrcode/cache/mask_3/mask_173_3.dat DELETED
@@ -1 +0,0 @@
1
- x���A�0�}O3��rnPk�TT�yM$&e/|�"ֵd��j�u�y[�a�i�K��{���M S&z[B�UB�RI�C�!�n5�\w�4�B $�@ $��[”���3��c��E^%�xw � �A:�@ $�@ $�@ $��B�fI�D� �A:�@ $�@ $�@ $�p�͒f���%H�@ $�@ $�@ $�@BR �%� �� � $�@ $�@ $�@ )$h�4K$L� � $�@ $�@ $�@³��_{�Pg�۴y��>჏VMm��R����������t(1���|
 
pro/vendor/phpqrcode/cache/mask_3/mask_177_3.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_3/mask_21_3.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_3/mask_25_3.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_3/mask_29_3.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_3/mask_33_3.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_3/mask_37_3.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_3/mask_41_3.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_3/mask_45_3.dat DELETED
@@ -1,2 +0,0 @@
1
- x��K
2
- � D�s�����FJ(&�)��0d��Ї��F�g!�[8�=��&�ia��D)�d8&A�լ�a�����1'�I�I��׳�7�9�� ex���߾� ���I��&֝��C�u��Jy�
 
 
pro/vendor/phpqrcode/cache/mask_3/mask_49_3.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_3/mask_53_3.dat DELETED
@@ -1,2 +0,0 @@
1
- x��K
2
- �0D�s��� ����!
3
- (.Bp&�|�"-t�&`�q�Q-"��9�_+)Be/H8��D��%�a~��}spKFN������=,��;�;a^t�4����\��F�������SN����
 
 
 
pro/vendor/phpqrcode/cache/mask_3/mask_57_3.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_3/mask_61_3.dat DELETED
@@ -1,2 +0,0 @@
1
- x��A
2
- �0�f���z�4-%����*��d��p�!�yZܫ��u��(��~�=�&�ۓ��)��R2�"/�"�<9�FΊ=r��b��"/�������rw�"2��������B��#3-�0-K��W
 
 
pro/vendor/phpqrcode/cache/mask_3/mask_65_3.dat DELETED
@@ -1,2 +0,0 @@
1
- x��Q
2
- � D��4���\?R����,�!�O��-�Nv���1�:�c�Z�u��"U�MÕF ~jK����-la�[^q^�Q\�=��o�-la��ZpU��B�����@I��K�Jzɢ|1Í����
 
 
pro/vendor/phpqrcode/cache/mask_3/mask_69_3.dat DELETED
@@ -1,2 +0,0 @@
1
- x����
2
- �0�{�&����2�'��d� l�=,��F���y;$�쇤�WE�-R����:��%T,O2��g�"�"�,�Ȣ/D�yĈ���ɧ{�O䮳�"�,:N�v�E�WN�#(&,�,�������]�x؅
 
 
pro/vendor/phpqrcode/cache/mask_3/mask_73_3.dat DELETED
@@ -1,2 +0,0 @@
1
- x��Q
2
- �0C�{�����g�;��JJ?dԬK�=�Ra�sJhTJ6ex��ka�����\$��n��IE,-/��XB���*х=������wee�4����t��̒t�Lщ�t�t�߫���b� �gF�f� ��q��o�d��dn-�?
 
 
pro/vendor/phpqrcode/cache/mask_3/mask_77_3.dat DELETED
@@ -1,2 +0,0 @@
1
- x���A
2
- �0���&����B�i�RaK"t�`I@��|���fX�����yi���l�E�:Sza18G���if�K*��?�:Y�C1쌞졘(ቷ���J*�����j�l*��TRI�K���R^ؙ��ks��)c�)c�)�JZ��������a�
 
 
pro/vendor/phpqrcode/cache/mask_3/mask_81_3.dat DELETED
@@ -1,2 +0,0 @@
1
- x���1
2
- � F�=����\�,J�GA�ġ��hj��>��#�3X�����:�k�Թ\�FM
 
 
pro/vendor/phpqrcode/cache/mask_3/mask_85_3.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_3/mask_89_3.dat DELETED
@@ -1,2 +0,0 @@
1
- x���1� �ὧ)���*.@�U��
2
-
 
 
pro/vendor/phpqrcode/cache/mask_3/mask_93_3.dat DELETED
@@ -1,2 +0,0 @@
1
- x���A
2
- �0D�}N���rnJɪQ�~�B���06���n�a�<<�ׇ���e6�M�R��C��P��L���̓i��9M�2� �LkŮ�dD�v*�"a��X�jBd�Ad�d��Z��T�d�Ad��qY�0ex�����qe���N�������&WV���Qvc�
 
 
pro/vendor/phpqrcode/cache/mask_3/mask_97_3.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_4/index.php DELETED
@@ -1,2 +0,0 @@
1
- <?php /* Silence will fall */ ?>
2
-
 
 
pro/vendor/phpqrcode/cache/mask_4/mask_101_4.dat DELETED
@@ -1,2 +0,0 @@
1
- x��A� F��s^1�b�����]���4�m+�8�+�Ve��^H�R]�\�c����
2
- �o�WN#��X����+l���HE�cp�\��^.�9q�W9����"�:��.��B�����B�\��0�a��PǨcp�\����O���N�qjpG��}��}��$.�˅�����
 
 
pro/vendor/phpqrcode/cache/mask_4/mask_105_4.dat DELETED
@@ -1,2 +0,0 @@
1
- x��K
2
- �0D�=Mr�˹��A��T�e�EF�L2#���鹢�_I!��������딤Ѻ����-իkm�O��]sST6*��'8� N��$��'N�Z���^�<JvN�sNp����������'���'8� �����1��{p����?N¿�n��J��Bυ��^���[i'�iHI-��m+W
 
 
pro/vendor/phpqrcode/cache/mask_4/mask_109_4.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_4/mask_113_4.dat DELETED
@@ -1,2 +0,0 @@
1
- x���A
2
- � н���_��Jb)t&��BB��K_���ֳ��6�C+5/q_�ghf����������CbH+�p�����;WK?��G�t� ��*G�9r|�c`��c���9FKH�q4��9r�ȑ#Dž��U���G�*G�9r���>�}r���U�*G�9r|�c�[��cN��[_=�׫5�^�J����� 1*�q�v
 
 
pro/vendor/phpqrcode/cache/mask_4/mask_117_4.dat DELETED
@@ -1,2 +0,0 @@
1
- x����
2
- � н_���s]4���Dg�n���2Jj}���Ҿ�RsSWG��R��ɧ���)5����E���m�#ܯ����k_"�z���3�\�r�ʕ+�r
 
 
pro/vendor/phpqrcode/cache/mask_4/mask_121_4.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_4/mask_125_4.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_4/mask_129_4.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_4/mask_133_4.dat DELETED
@@ -1,3 +0,0 @@
1
- x���A
2
- � н���_��Қ��B���B�2��f��{��
3
- ���cf����g�Kq��=��)ڮ����W��lK2޿���8:o�CRd�\p�\p�@��+$E�����Q.���\p�\�#��>���/�#\p�\p��>���#��\p�\p���#��>�q�p�\p��.��$���Iq�� d���G�R��_4�����
 
 
 
pro/vendor/phpqrcode/cache/mask_4/mask_137_4.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_4/mask_141_4.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_4/mask_145_4.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_4/mask_149_4.dat DELETED
@@ -1,2 +0,0 @@
1
- x����
2
- !н_���sm�� ���+XӋ9=�.��=Zk�a��]�ޒ>K�j�o����|�S��SWK�Zm�׌���j����\����Ъ2� W\q�W\q���"~����jv�t���v�_��\q�W\q�W\q%g�3����}�+���+���+��r9��A��r�W\q�W\qŕ�A� g�3�W�A� W\q�W\q�W����]�V�~v{�D��3�Ȝ!���\�W�����^<�r/
 
 
pro/vendor/phpqrcode/cache/mask_4/mask_153_4.dat DELETED
@@ -1,2 +0,0 @@
1
- x���1�0�ޯ���si,')p!�4.���;���WUm��j=������.NO��>����T�ڍ[��S7v�ۜg�q��?����
2
- �{pe�o�3�8�3�8�3�8{�YXz��,���_�O��Yfe���3s���3�8�3�8�3��\C�!����Ms�3�8�3�8�3��r
 
 
pro/vendor/phpqrcode/cache/mask_4/mask_157_4.dat DELETED
@@ -1 +0,0 @@
1
- x���1�0�ޯ���s4�"FP�=iRX¢X��0�멪�u 4f�t��l}�m������➭�S�|��ю�S�����P�5<]��r�w�q�w�q����^Q��N6Ï���Z�sߙ��,w�q�w�qǝ>������Μ5g��;��;��Y}V��g�w�,w�q�w�q�w��>����9�w�q�w�q�����>�3g�Y��;���[ww?P3������Ƙ�ggt�퐮�;�]��.3�w4A�
 
pro/vendor/phpqrcode/cache/mask_4/mask_161_4.dat DELETED
@@ -1 +0,0 @@
1
- x���A�@���f���s!AL���_|,��4�l)i�m���l�׉0'�� +E������]N\���x�#���2��/��_�{�7g��9쏼ٷ���}���2�r�!��?}-�#<Z��χ�j"��P>T��e9�C9�C9���~�����6Sʇ겺�!�r�!�r�!�����ۘs��e9�C9�C94�_��Ɯ�|�.��r�!�r�!��s�/�s0� ���2�r�!�r��8�}D�����w���r�DXΡ|x�|��!�2�
 
pro/vendor/phpqrcode/cache/mask_4/mask_165_4.dat DELETED
@@ -1,3 +0,0 @@
1
- x���A
2
- 1�}O���r.�"�*?�f���P��LHI�k���ZQ��8
3
- Gy��qk�-����n5����+?���������|֎����kKn�E���Ź�K.��K.?�2���.�|�EJ�{�2<�:.�Ku\�K.��K.�������ǝmu)_���8�\r�%�\r�%�\��Џ;'2�!_���8�\r�%�\r�%�\��Џ;'2�!_��\r�%�\r�%�\rinC?nn�9��
 
 
 
pro/vendor/phpqrcode/cache/mask_4/mask_169_4.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_4/mask_173_4.dat DELETED
@@ -1,2 +0,0 @@
1
- x���K
2
- 1�}N���rn�a��~ZY!��J�t^��5�(�/���jk�z[pj��_�?~v:|jw�Ֆ_m���Xz�o����6?n���<��j�$p�-��r�-�_p[z�=�V��Q��3��T�V��o� �r�-��r�-��r�-�r09�L�ߚ� �r�-��r�-��r�-�r09�L�ߚ� �r�-��r�-��r�-�r09�L�ߚ� �r�-��r�-��r�-�r09�L�ߚ� �r�-��r�-��r��v��6�����?�,e�`=*K�6ڭ~���6����*�
 
 
pro/vendor/phpqrcode/cache/mask_4/mask_177_4.dat DELETED
@@ -1,2 +0,0 @@
1
- x���A
2
- !�����.1B��My��![c��\c���Z��V\��q��7���E�O�zg~�k��˿j�;pg��u��[*7�׽������Tp�1�s�1�s��q�!���㠊w/�r���8��X���~l���c�9�c�9�c�9�����nr7��~l�0Wp�1�s�1�s�1����nr7��~l�0Wp�1�s�1�s�1����nr7��~��+8�c�9�c�9�c��nr7���M��+8�c�9�c�9��t���oEǙ��N�Xy�[���R+��c����qN�\,4J
 
 
pro/vendor/phpqrcode/cache/mask_4/mask_21_4.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_4/mask_25_4.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_4/mask_29_4.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_4/mask_33_4.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_4/mask_37_4.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_4/mask_41_4.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_4/mask_45_4.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_4/mask_49_4.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_4/mask_53_4.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_4/mask_57_4.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_4/mask_61_4.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_4/mask_65_4.dat DELETED
@@ -1,2 +0,0 @@
1
- x��K� D������t�X�Й.4�E1^���hv��O��x���W��0�JHŻ����z[�^܈�[v���
2
- y�y��Z�k�=`���v�c�ǃ�<ȃ<��C�/)z�ܑ��������C���""
 
 
pro/vendor/phpqrcode/cache/mask_4/mask_69_4.dat DELETED
@@ -1 +0,0 @@
1
- x��;�0CwN��\��~��;C$3�$<)/m�����eΥT��2��:�]�^VV�%��zA�n�pv�s"y�y�y)z���d�u6����G��ȋ���i^��/<�t�r�rr�)9ͤl�r��.���
 
pro/vendor/phpqrcode/cache/mask_4/mask_73_4.dat DELETED
@@ -1,3 +0,0 @@
1
- x��A
2
- �0�yM���顴)1�-�lE3�=�}��(���9�T�d���E/eO ZO����ŻK�Y;��pS5�+���N��I����|
3
- "�e�v��+Dݓ�Ns'O�W�k��I�����̞��F��r�i9�&���� �]?��A
 
 
 
pro/vendor/phpqrcode/cache/mask_4/mask_77_4.dat DELETED
@@ -1,2 +0,0 @@
1
- x���
2
- �0E����?��jFe8�0�� u�N�0����lB��6�:�h�<�����C�e\,����ܗ~���&rd0
 
 
pro/vendor/phpqrcode/cache/mask_4/mask_81_4.dat DELETED
@@ -1,3 +0,0 @@
1
- x��A
2
- �0�yM���y�XEm7"89�2�Ѹ��Q1ݳ��+�x�x;��t35DIY��1x\:u�����}�e/ ��#����Th<
3
- ���U�Bz��<���5�G<���5{�G<������5��<饫>�]��U�r��xu�
 
 
 
pro/vendor/phpqrcode/cache/mask_4/mask_85_4.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_4/mask_89_4.dat DELETED
@@ -1,2 +0,0 @@
1
- x���1
2
- �0�ὧI�9��% ��� V��ڀf�r���0}�z�=�#9������ҕ:���~�s��1BՁg&�4p�g�q.p.���&g���T0�5�rg��sg�q��rg捯�u�3��8���k�.Egm��b*��&�7����?����
 
 
pro/vendor/phpqrcode/cache/mask_4/mask_93_4.dat DELETED
@@ -1,2 +0,0 @@
1
- x���K
2
- � �ὧI��n$}P�ŌB�]��N��@����%s�fkҫ�}Cz�oA}aʽ2�|���~���D&�l=������Y����w�q�}���q\�E�Y��j�K_��y��w�q�wz$=��=�;���_݋��>���+�p���H�����9�D�i
 
 
pro/vendor/phpqrcode/cache/mask_4/mask_97_4.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_5/index.php DELETED
@@ -1,2 +0,0 @@
1
- <?php /* Silence will fall */ ?>
2
-
 
 
pro/vendor/phpqrcode/cache/mask_5/mask_101_5.dat DELETED
@@ -1,2 +0,0 @@
1
- x���
2
- � E������+�%=�M�3Cbv�
 
 
pro/vendor/phpqrcode/cache/mask_5/mask_105_5.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_5/mask_109_5.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_5/mask_113_5.dat DELETED
@@ -1,9 +0,0 @@
1
- x���
2
- �0D�������^�6�I�63[�[EDq�c���+��j�y��81��\c
3
- ��7�c�����?u�}DK�4�}��,�kk�g�--�3[���U�Ƃy�UX�UX�SV��:ϫ��՝��,��|��кS�����⫰
4
- ��
5
- ��
6
- �Vɫ��*�X�[��*�
7
- ��
8
- ��
9
- ��z�U�*�N�V�*�J�UX�UX��S��Xi��jTi4f��ZkU^���_���~�U��x�}ծ�Z/r
 
 
 
 
 
 
 
 
 
pro/vendor/phpqrcode/cache/mask_5/mask_117_5.dat DELETED
@@ -1 +0,0 @@
1
- x���� D�|M��n/*{�M���+��p�I_&m��-��Ѿ�C�����3�2�u�?o-kgB7wc=����U%y�o��R�hӯșDo:ֶy�R�JkQ^a�a�a����qOg�iJ���;����qOg�)ӊ���0�0�0��[�v�ö>�=>���0�0�0�Of�z�3��=>���0�0�0�.�3���Z�$�׷8\�p����w4���:��Z�p�:q�����X 7
 
pro/vendor/phpqrcode/cache/mask_5/mask_121_5.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_5/mask_125_5.dat DELETED
@@ -1,2 +0,0 @@
1
- x��A
2
- � E��&���fc;S��$?����؏��Q4��Ya�hûyJ}9�g=��=�li��.;nh_����wz����.��q�CW����ȧy��
 
 
pro/vendor/phpqrcode/cache/mask_5/mask_129_5.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_5/mask_133_5.dat DELETED
@@ -1,2 +0,0 @@
1
- x���A
2
- �0DѽOc��r]4%1mCT�������xΜ[Dv�=��{F���E�Ϗ���q�?ݿ�9�keѭ�}�'2^��c��4G����:�3=J�K-��F0��`#��H���w�'#�<{�~�Z4�:BG舻F0��`��G�~���:��`#�?�#t���w-�`#�?�#��#t#�F0r����}Q��}e����R��;�<��C��V�}ї�����Y-H�
 
 
pro/vendor/phpqrcode/cache/mask_5/mask_137_5.dat DELETED
@@ -1,3 +0,0 @@
1
- x����
2
- �0���>M��/��k�1m����X���=������h����s����H"�k �M�:���3q�O��W}�9�Ԗ�I����H�1�G;�-��s��ڶ�?�[%M
3
- � v����#;�zg^��3�d}�6���9��Ψޙ�@7��҄���#g�v���`;׳�ީ\�$������w�l��v���`�v�;ލ�}7�w�ߑ�a;��v��kA������#g�v���`�=N2w�xg�WӤ@n?��c}�SQ�:�Zd?+����9v��z�)�����P
 
 
 
pro/vendor/phpqrcode/cache/mask_5/mask_141_5.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_5/mask_145_5.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_5/mask_149_5.dat DELETED
@@ -1,3 +0,0 @@
1
- x���[
2
- �0���&����c��}-s+'���^;A�x���=���Q��_gUݏﵪ��x���G��T���ȺV¹���U��UE�����_IǴ;���T1�����̠���
3
- ]W2� �2����|o�5�u��ꆬuI�:(W�K�U躒�rP�Ad�Ad�A;
 
 
 
pro/vendor/phpqrcode/cache/mask_5/mask_153_5.dat DELETED
@@ -1,2 +0,0 @@
1
- x����
2
- �@�w�f������Ь`���D"I���e��<:a�u,7��Of�۳�u��P�6��~��s�z������s��,j�լc����V��Zvߨm���s^u�H�Y�u�&�l��&�l��&�_�9������
 
 
pro/vendor/phpqrcode/cache/mask_5/mask_157_5.dat DELETED
@@ -1 +0,0 @@
1
- x���1�0D�ާ���ri��( r*��� �\��~>C�*���v��s��]Ŝ_{W!�zﶬ/��������)�˙������v���V���6�V��޻��,f1�Y�b�����n^o��>���\O�]���,��,�b���,f1�YyV��g�Y��Y��Y�b���,f1+�ʳ�<˳<˳��1�Y�b��Ŭ<+�ʳ�,��,�b���,f1�YyV��g�Y��Y��Y�b���,f���ukys77���}�v����mb�=�w�sw�)�tW���:�
 
pro/vendor/phpqrcode/cache/mask_5/mask_161_5.dat DELETED
@@ -1,2 +0,0 @@
1
- x���I
2
- �@����Dp@
 
 
pro/vendor/phpqrcode/cache/mask_5/mask_165_5.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_5/mask_169_5.dat DELETED
@@ -1 +0,0 @@
1
- x����j�0��|����/�ni��K��'���.r�:�T-m&�Z�x9�y�q�3r��Og�v�OO_zׯ�u`]��ȷ��it�ا��t���il�oc���1�3j9�%_g|�ԧ��)���>���>�ϰ�=�te�&��_�4�����=�t�U��}�/��>���>���>�O���r�5/u��>�/���g�}��g�}��g�����O����sv�O��}�/��g�}��g�}�ٷ�G�o-�w{���r_�{�g�}��g�}��g_����n��<r_��}����>����=��n]�4Nk��β_������M���������8�m?���SF��<�
 
pro/vendor/phpqrcode/cache/mask_5/mask_173_5.dat DELETED
@@ -1,4 +0,0 @@
1
- x���[
2
- �0���&����G1���g�D)[�Cz���eD�ѷц�=R�N�6����F��Jm���Jq�P�}�x��s���_��}��G��F�y;�����
3
- [;�]���e�k[��QbT�m�y�&0� L`�̄Y?���ر���w؛� �f����c���VN��9����&0� L`��ׄZ���}0=F=F9AN���L`��&0� L`Bz�Y�fI���=F9AN��&0� L`��&0� ���fI��s�r�� '� L`��&0� L`<i͒��"�9AN���&0� L`��V��aB�X�"������,U�m�>���
4
- =�w���Z�gBΜP���!8
 
 
 
 
pro/vendor/phpqrcode/cache/mask_5/mask_177_5.dat DELETED
@@ -1,11 +0,0 @@
1
- x���ъ�0��~����ܾح����uO,"%
2
- V�� �������j��j�;�8Ɓ�X��+�
3
- ��oV���`+X�
4
- V��?[1�^�h-ֳ5Z;�����rmS��+�
5
- ��oV���`+X�
6
- V��;���Z,��Y�M�B��+�
7
- V���`+X�
8
- V����Z�e��ڦ}�r�\!W��`+X�
9
- V���`+�3�Km�>S�B��+�
10
- V���`+X�
11
- V��c��㊛�{g;�^Qq5�ZU���ݮ��Q�L�0+*&YD�q����*6
 
 
 
 
 
 
 
 
 
 
 
pro/vendor/phpqrcode/cache/mask_5/mask_21_5.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_5/mask_25_5.dat DELETED
@@ -1,2 +0,0 @@
1
- xڝ�a
2
- @!���4���޳ʢ��
 
 
pro/vendor/phpqrcode/cache/mask_5/mask_29_5.dat DELETED
@@ -1,2 +0,0 @@
1
- x�Ւ]
2
- � ��=M��_n0W .��=-��4�m�y�B���+����R���􈋆$��ƃ.=s/,+�B�7�󳝍q�z�~�q>=G���Z�y�:��DR��
 
 
pro/vendor/phpqrcode/cache/mask_5/mask_33_5.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_5/mask_37_5.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_5/mask_41_5.dat DELETED
@@ -1,2 +0,0 @@
1
- x��TA
2
- � ��5��?7���XMtxҴx�� ��?@���7@�~"�N$��S�ɰ�{�+C���A'��r\P�p�<ޏ�-� ͺ:S3s�ԉ�ۻ�ީ�z#��qw��� >�
 
 
pro/vendor/phpqrcode/cache/mask_5/mask_45_5.dat DELETED
@@ -1 +0,0 @@
1
- x��UA� ��5��?���U:N&Z"��:;4P1=�bNvSG�M1��˛�n<�v`q��{���Mg��4��=G�-T���?����='k��u�ۭ����>���'�����(�κ�� J�{E�ѵs�]� ,�sq�
 
pro/vendor/phpqrcode/cache/mask_5/mask_49_5.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_5/mask_53_5.dat DELETED
@@ -1 +0,0 @@
1
- x��VA� �������"�zYf5Ɛ�JC �
 
pro/vendor/phpqrcode/cache/mask_5/mask_57_5.dat DELETED
@@ -1,2 +0,0 @@
1
- x��VA
2
- � ��5��?��N�l��Z�HAbB�Z0a���M���d`1�z�'"<Ր1��9nvͨ.��)�bݻ�~�;�<K����ھx_����Eu3�][�/[T�o�J�ϵU羁�4���v� H�Pn���|����Im!w�L1/8,g�
 
 
pro/vendor/phpqrcode/cache/mask_5/mask_61_5.dat DELETED
@@ -1 +0,0 @@
1
- x��Q� C�w�����C�Ֆ�B���.ݛ�w�p�����Kv�g;���|3:��}�ؓc0þɴ�j���j7(�l�we^�W�J�ɾ��S��w��t_e���Ϋ�T���M���O�s��9ubs=�?���~~���>�9���Z#t�B�~
 
pro/vendor/phpqrcode/cache/mask_5/mask_65_5.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_5/mask_69_5.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_5/mask_73_5.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_5/mask_77_5.dat DELETED
@@ -1 +0,0 @@
1
- x��Q� C�w�����#&C`T����6��ƹ�B��(���9�
 
pro/vendor/phpqrcode/cache/mask_5/mask_81_5.dat DELETED
@@ -1,3 +0,0 @@
1
- x���
2
- � C�~M��?��tz�U4���"� }t����MX�2|.�ɋ�˙F\�������~m��4������X�u
3
- ٔ, ��w�:��E�Ƅ>��X���̯=_�]�g>�>���z�מ�/�)5ךk�k�k���Zs��X��X��Y{ܮ��}����~mt�������:S#���&;U#)���
 
 
 
pro/vendor/phpqrcode/cache/mask_5/mask_85_5.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_5/mask_89_5.dat DELETED
@@ -1,2 +0,0 @@
1
- x���
2
- � ���4������5e���npQ�� G��c��f���l^^�;;b�5;`�k���U͹߮��j`�N�s���O=�\[a6�����~�nL�D?�
 
 
pro/vendor/phpqrcode/cache/mask_5/mask_93_5.dat DELETED
@@ -1,2 +0,0 @@
1
- x��K
2
- �0D�>�����&���&
 
 
pro/vendor/phpqrcode/cache/mask_5/mask_97_5.dat DELETED
@@ -1 +0,0 @@
1
- x��A� E������f!3bf5��ƼB����|#f=<3l�6<���_+xj����)
 
pro/vendor/phpqrcode/cache/mask_6/index.php DELETED
@@ -1,2 +0,0 @@
1
- <?php /* Silence will fall */ ?>
2
-
 
 
pro/vendor/phpqrcode/cache/mask_6/mask_101_6.dat DELETED
@@ -1,2 +0,0 @@
1
- x��k
2
- �0���4��/��n_.��2#�S�H�6�_�P��Z���f˳_���,�7؞��+�%��W���d�–��n�}��_&�Ok;����P��f�>�t�yY��]�ns
 
 
pro/vendor/phpqrcode/cache/mask_6/mask_105_6.dat DELETED
@@ -1,3 +0,0 @@
1
- x��Q
2
- �@D�s����k���B�Z�#o)Sd�}��Gܷ��l�쯯�^�������)G]S�4�S������?�#B�Z�:��+{����s��H�K�N�iI��!��m��e1
3
- RWe9!��`�`��Uy�ˀ�u�:檞����U=w�-�o�ԺwB�}cM�K���蹰{�{�=�y���蹰{�{�=�y���蹰{�wS��cao�i'�f����yO=C�yO=C�y���[����{S޻�=�;�|v4}ϯ2���0�
 
 
 
pro/vendor/phpqrcode/cache/mask_6/mask_109_6.dat DELETED
@@ -1 +0,0 @@
1
- x��A�0�~���ρDBH�C�H�V2��0�n�uo��l�쯯��˻=ۢs9[���l'���?���7��R"�&���2����:7QqX_�n�
 
pro/vendor/phpqrcode/cache/mask_6/mask_113_6.dat DELETED
@@ -1,3 +0,0 @@
1
- x���� E��5��N���Չ�����bF6�on���,m�>�gS�9���RW����c�Ǖ9�&�%�1���_��cx= GR^���w-z?��dz�v�=�,��}ԥ?ǹژ�:�9�m�=��=@U���䲉�UX�UX�Ve������~�by4W���i��:�e=��<SZmAW�UtVaVaVa�ZV�5~�������V�*����*��*��*�^�*~�wk�������
2
- ��
3
- ��ZϪb����ayT�f����j�ֺʯj�Z�~����t_@Un����Ѿ�YWsV��
 
 
 
pro/vendor/phpqrcode/cache/mask_6/mask_117_6.dat DELETED
@@ -1 +0,0 @@
1
- x��a� F��4��/��#E��v3�nŸ���/m���Y���T���wm<�~?�l�j�G�����C�qS�/��6f�tݟ�o�Ӕf^�l'��7`��Z���C� �?����he���i���Xq4�[ـ�ԉ�a�a�a���9]P�����Y����M<6��a�[��g�:���0�0�0×g�x8:�Y�z;7�C��at�a�a�a���Ʊ,�C��at�a�a�����O�U6���8����=�g��xx\��ƑX�Q�t�2��J�Z��:�g��
 
pro/vendor/phpqrcode/cache/mask_6/mask_121_6.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_6/mask_125_6.dat DELETED
@@ -1 +0,0 @@
1
- x��A�0E�����r3���&H�
 
pro/vendor/phpqrcode/cache/mask_6/mask_129_6.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_6/mask_133_6.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_6/mask_137_6.dat DELETED
@@ -1,2 +0,0 @@
1
- x���� E��5��?�e�����^�4f�H�p[1-e)UQ�V��]�U�W�N�5��o�*8|���۩�W����6�bk?����{�f����|>�s֪���r6����6����6�rҟ�=��v�ڲ�Wy�����-��'
2
- ����Ο���;qtQ�E>U�϶�f���곭�x�N]Tc�(s❮7t�Aw��`v`v`v`�kv�wf�wt�;]����;����;�;�;�;��!ޙ;�ao��]���;�l�;�;�;�÷�|ʷ�������������(3}��l.��?��"މr}��;�\}�S��-A���w�<9;�EV�'�ם������
 
 
pro/vendor/phpqrcode/cache/mask_6/mask_141_6.dat DELETED
@@ -1,10 +0,0 @@
1
- x��a� F��4��/��c����]�زȐ���[���=��[E럓���s�m,��f�n/�|kj\��j�?g�����[q��(NO�Zc5���SGGP[oM�V�ָ��f���v�L<<e�
2
- +�Ěa*XG6����)��)��)���cL��S�6�tj�M�]o���W8�D~�O��D�`�?�׆N�S�k?��)��)��)�*���U�)���?�SI�=
3
- t
4
- �B�X��L�L�L�T5���Oq��Q�S�:���`
5
- �`
6
- �`
7
- ����3_��E��)t
8
- �`
9
- �`
10
- �`��L���yb*?2��T5i�?U!�K��*�x��T7i��o��I�EI���R��E�uJ+M�7��'
 
 
 
 
 
 
 
 
 
 
pro/vendor/phpqrcode/cache/mask_6/mask_145_6.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_6/mask_149_6.dat DELETED
@@ -1,2 +0,0 @@
1
- x���
2
- �0E��5�����f��47��8UD�6����2�z�m�pߞ��k8�����}��G���ӕ��N}?}��W�:����gu�WA�ˌ7~�;�)����Ø{̪ǿ+�WP��Oۢ����r�E�\j�wG)y˖�w���A�A�A�AM%����2��`��2��d��l����|p}�eqP���� :�� � � � ��ej想=�l��T5��ɠ�� :�� � � � ���G��{��d��d�AtDaaaaa��&أ�&�w� :�� � � � �1�����-MRb0��W�f�
 
 
pro/vendor/phpqrcode/cache/mask_6/mask_153_6.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_6/mask_157_6.dat DELETED
@@ -1 +0,0 @@
1
- x���A�@D�}�f����D�N%���n�ç�,�֖�SV�V�>��W��ó��C�a�z�6���U��~һ�{`n��������ݻdvV�y~�r��Z�"�q��k{>g$��XK���U}m\b�ja�G�x��,f1�Y�b������]�z���̞���^��.��5�[?�嬜��r���,f1�Y��Y>�g�����rV�b���,f1�Y>�g�,���rV��m�Y�b���,f�,��|V��Y9�Y�b���,f�,��|V��Y9+g1�Y�b����ً �̦M7>2{9z�϶h�m3���l�|�9�x�ټ��#f#�x�6 ���-�v�%�N'
 
pro/vendor/phpqrcode/cache/mask_6/mask_161_6.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_6/mask_165_6.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_6/mask_169_6.dat DELETED
@@ -1 +0,0 @@
1
- x����J�0���i��9[�J�ɘ�k{�1�b�!g�nhHkS뉭-�V?��KI�����ׁ��1큏�1���ƣݎ/��������`���/z�)*�=��3ڏ�g6���^k6��5�C����Y�<�K��kM���[�y@�G�&_=~���>���>���㵾�+����'{��է_�Vˊ�x�-�J���<ӛܗ�r_��>���>��i���;������r�O��}�/��g�}��g�}�ٿ�}����}���x�O��}�/��g�}��g�}�ٷ�G�o/�{{���r_����>���>��o/�z�^����#������}��g�}�ٿ���d��'�ʳ�|�QR��NS��3�����������Y�����ڳ��Z�'�ms�E�Ƿj�5�
 
pro/vendor/phpqrcode/cache/mask_6/mask_173_6.dat DELETED
@@ -1 +0,0 @@
1
- x���a��0��9Mr�����M S�*:a_-��5hh_�)�u�Z֭[�����l��o�ےs��mK������N�{���H�?x��`l�#f�9>�ڟ[���e�Єώߓ�� �?�^���m���*�/K�m���h�y%��v-nKl�������kK�L`��&&�� g5����(�g�wx�Y�ܞ���a¬�pVc�Z[��#O=��SN��9����&0� L`��DŽ�� ��'t�j�j�]�QN��9����&0� L`���s��YRc�@�QN��9� L`��&0� L`��"�YRc�\�� '� r��&0� L`���E�����H9AN��&0� L`��&���7�p�6�`�|�����hm��s��
 
pro/vendor/phpqrcode/cache/mask_6/mask_177_6.dat DELETED
@@ -1,14 +0,0 @@
1
- x����n� ��{����ڤ*4v۴u���1����{<�L�Gi�K����GU������]�m�/�6���j��?mZ�m�z�y/�ξg�j��\�Փ��<`�_��>f{�����_��,�,K9o 4�ǵ���7l���niJiggi�r<�-MG�
2
- ��
3
- ��
4
- ��
5
- �xuV��+z��R�C�r9�+Gq�6�QW��b"��Qe��"�WL����+�
6
- � X�X�X�X�X�/��|~�j,�n��mu�M���ۤ+�
7
- ����
8
- � X�X�X�X�X���e�)o�<S����+�
9
- ��
10
- ��
11
- ��
12
- ��
13
- ��
14
- �0��X,ަy�t]AW�X�X�X�X�X�;V�H��92m���e3��Wd�Q��be�Qؽ�]>Ә�f�|�����5��H���늚���7/D
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/vendor/phpqrcode/cache/mask_6/mask_21_6.dat DELETED
@@ -1 +0,0 @@
1
- xڝ�Q� C�9M{��i]���X�1����-�C!����D��7
 
pro/vendor/phpqrcode/cache/mask_6/mask_25_6.dat DELETED
@@ -1 +0,0 @@
1
- xڝQA� ��5����2)�e+�(Xm�Zt�*(�ڹ�;���tJ�<峂�_ڤ�3�o���ڴ"̢a�zh}�&qv��SG�֙,�-���J��4}���oS[��}w
 
pro/vendor/phpqrcode/cache/mask_6/mask_29_6.dat DELETED
@@ -1,3 +0,0 @@
1
- x��RA
2
- �0�������Xc�����L(4E�ԈB
3
- 8C�ܾ޳n�M��+lǝ��ՆO��1]�&�ڍ�4U�D-6-�$:6�dZ�?y��l��f�?�
 
 
 
pro/vendor/phpqrcode/cache/mask_6/mask_33_6.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_6/mask_37_6.dat DELETED
@@ -1 +0,0 @@
1
- x��A� &����T `���j<P�0��jB#�&����,Yo���fU��j�*U�Տ���Y���[��oY5�~�5T7bnb,��]�˘����������-�������qF:s��t�Dc��h�
 
pro/vendor/phpqrcode/cache/mask_6/mask_41_6.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_6/mask_45_6.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_6/mask_49_6.dat DELETED
@@ -1,2 +0,0 @@
1
- x��VQ� ��i���{K&������YX��؁�0�̦!=����t��n&��fp�WL
2
- �`�/�<ϓKVrU�\1�bGp��@��ӑ&fN�/+ƽq����`���AW���S���RGp��_5|�|z��xν:����J��+WE�m4h�4�3tܭ�.���A�g`\������ʤ�*��F��
 
 
pro/vendor/phpqrcode/cache/mask_6/mask_53_6.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_6/mask_57_6.dat DELETED
@@ -1,2 +0,0 @@
1
- x��W�� |�k���K���Q�-�^@c�"Wr^U�Y��M³>_ݏ`���8����G�1��`�B��`;��+���}����&s���]<�J�QF=mb3 U�F'��6�Ɩ�E ����5�Ja�wZ���60��
2
- �[���9���9���{��S��\ݞ8��`k&���os}{�[R���[�+��w��O��d^jW
 
 
pro/vendor/phpqrcode/cache/mask_6/mask_61_6.dat DELETED
@@ -1,2 +0,0 @@
1
- x��K� D�s���ڤ�E~݂�ih��'�
2
- �����N�'oVW���jsp��Cz����ο���a��g!��#WD%~�˃Y?�J�f���R�E�����Ko�ͼ�ǘ��|Ƀˎ*�O�P7�������n�뼽��7�s�`���������s���d�D�����s�~>�<�i�K'�l'��9���%.���7
 
 
pro/vendor/phpqrcode/cache/mask_6/mask_65_6.dat DELETED
@@ -1 +0,0 @@
1
- x��WQ� ��i���{K�NLk?��e$�Q�ik����4���1{����`+�!�ڮ�M
 
pro/vendor/phpqrcode/cache/mask_6/mask_69_6.dat DELETED
@@ -1 +0,0 @@
1
- x��K� @�����dTh���� hLSSE�q eY@<�+�*�|�窮%���>������z�*7��e����6�Q���S`��.��>�sE�'�%@[��6�@P�0�h
 
pro/vendor/phpqrcode/cache/mask_6/mask_73_6.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_6/mask_77_6.dat DELETED
@@ -1 +0,0 @@
1
- x���� E�����۲i���V�a�.���F��pST�Y��4q��~�z��=��:�͒
 
pro/vendor/phpqrcode/cache/mask_6/mask_81_6.dat DELETED
@@ -1,3 +0,0 @@
1
- x��Q�0D�9
2
- ְ���q/K�;3�v�e�̢Ȋ��A�H��?`]�5��K������w�!}{Zû߲�W
3
- ��yⷾ��^�_y��k�k��^K��ת�b-�b�YSڸ'֜N��u�����#M�f�HS�Q?|]�I��A���i�M���y��yuW�
 
 
 
pro/vendor/phpqrcode/cache/mask_6/mask_85_6.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_6/mask_89_6.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_6/mask_93_6.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_6/mask_97_6.dat DELETED
@@ -1,2 +0,0 @@
1
- x��a�0��s���d����Fx[�=4�H���o�j3�4�&�s}�*�����aV��c�&3���5�arW�^a���LCl��z�q�,���1�x�
2
- �]W�t�+sF/)�]�.zN���'`�>���1='#�`+b��l]Z�������
 
 
pro/vendor/phpqrcode/cache/mask_7/index.php DELETED
@@ -1,2 +0,0 @@
1
- <?php /* Silence will fall */ ?>
2
-
 
 
pro/vendor/phpqrcode/cache/mask_7/mask_101_7.dat DELETED
@@ -1 +0,0 @@
1
- x��Q� C�}r��m��`���f�j��T�#�����54't���f�a�Їo��$�c<��������Hݠ�h8�l������o=�Ą�ŧ�Hv��;�z��!�|/�F�Ѝ3cf̌�S�ʅ��㍂���8�K�)4�9��Q�1�1�J3f�����S+�w�c�����k�3cf캌���z�y�y̵Ҍ��1�{��bL����X�S+��.to{>���mO��J2��3c�<6�Xn0F�
 
pro/vendor/phpqrcode/cache/mask_7/mask_105_7.dat DELETED
@@ -1,2 +0,0 @@
1
- x��A
2
- �0E��F��a�Mҙ�N�Px)�pQ���_�~�|ñ(b��F����$.��a�o���W�GN�P�Uǖ��M�%{��o�HQ��U�l�ִ���L^>+��m��#{�{�eo&Y2s�oM�)gncO9s��Z���3w�o���+��{�=f.����z��ޣ������{�{�=�z��G�c�����s�kCQϞp���^��&�{^���N�ʷU����
 
 
pro/vendor/phpqrcode/cache/mask_7/mask_109_7.dat DELETED
@@ -1,2 +0,0 @@
1
- x��A
2
- �0D�9Mr��}��*�_x-d���:�"�NJ��-k�"�⨚���d�{��ջ��������גɬ|<b2+�U������%Z}�.�q%Gi���h
 
 
pro/vendor/phpqrcode/cache/mask_7/mask_113_7.dat DELETED
@@ -1,11 +0,0 @@
1
- x��Q� D��4p�˵M�PeQ��6��d?Ը�>'����r�Q5+ s����)�c���7��-���1nn햺q�ɔ���Jtg��^�ʉw�̘Ň-��?�*�&Mm�@ee5��^�
2
- c���
3
- ��
4
- ����,�����b�\1��3�j�4��T�Z�f���o�����*�
5
- ��
6
- ��
7
- ��:�U��t�*�����������
8
- ��
9
- ��
10
- ��Xů�0<�BW�UtVaVaV�Y�l
11
- ް��k�f5���_� ���k��W5{�����5pn�C��Z:�� bv
 
 
 
 
 
 
 
 
 
 
 
pro/vendor/phpqrcode/cache/mask_7/mask_117_7.dat DELETED
@@ -1,2 +0,0 @@
1
- x��Y� D��4p��U�����I�>"�%6�ed��8r�S�Ns��U��n�k5�Xe��j��ު�u�������V�Xg��,l`���u������!�h�XZ�\V�lM���|[ͬ��0�0�0���#hF'��c]������i��>�����H�at�a�a�a~<��Æz�y�qkO����0�0�0�����㪞F��a�a�a�)��2�˰�fÒ��%��z8���tO=���3�=�����3��:��c�w�
2
- ��V$�
 
 
pro/vendor/phpqrcode/cache/mask_7/mask_121_7.dat DELETED
@@ -1,2 +0,0 @@
1
- x��[
2
- � E���d������i;^az,�#6ƞ^r����h�������&����^am����Y�9�_�غ�5C�r�6��t^�^�Wl���E��ز~ɿ|�M��m����mS�}���(
 
 
pro/vendor/phpqrcode/cache/mask_7/mask_125_7.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_7/mask_129_7.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_7/mask_133_7.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_7/mask_137_7.dat DELETED
@@ -1,5 +0,0 @@
1
- x���
2
- � F��4��/�
3
- ������
4
- ��0��7։�V�l;b�������7��fM�S���;�1�������L�C�<�Q�[+@w�t��
5
- ��#Н(S�����q��d
 
 
 
 
 
pro/vendor/phpqrcode/cache/mask_7/mask_141_7.dat DELETED
@@ -1 +0,0 @@
1
- x��A� E�=
 
pro/vendor/phpqrcode/cache/mask_7/mask_145_7.dat DELETED
@@ -1,2 +0,0 @@
1
- x���
2
- � E��5��?W6Z���-�^���2�q���bG���X6(Ɖu�"�Lb�b�Gu���μ���Gk��:HwA[�j��m��H���ݞ�3�������O�kQ{l�|��T��Em�Jf�L�?��2"&�����������)�k��Rf����c���̉��F��,��z���=�������5X�5X�5X��7�F��\��p���Us#�������5X�5X�5X���F��d��Y�������k�!a
 
 
pro/vendor/phpqrcode/cache/mask_7/mask_149_7.dat DELETED
@@ -1 +0,0 @@
1
- x����n� ��{?
 
pro/vendor/phpqrcode/cache/mask_7/mask_153_7.dat DELETED
@@ -1,2 +0,0 @@
1
- x���Q�0���=
2
- ю惤/�Ͳ���I�i�^-��Zkm|�YDh�9����\{�K����{��y���3�v��̻�E]u`R��r�"��}�Y��e�2{�VV8][�.n:+2_���B�&6��Mlb���&6�`3i�9�Y���Ό諡y��U}ԟ82f-vږ�6��n�M�I7��Mlb���&6���l��7��������t�n�Mlb���&6��Ml�2�����^�/�n�M�I7��Mlb���&6��;gxA�C��t�n�O�Mlb���&6�y��y��fP��[6�4��̫��k`v^�+�9�ʬO۱��}�攨��+ZX��=:iWE
 
 
pro/vendor/phpqrcode/cache/mask_7/mask_157_7.dat DELETED
@@ -1,2 +0,0 @@
1
- x���M
2
- �0E��[M��͕����s�_������ �}F��Qks���{�%�Wq�����.��������]�8evV��bvV}�_��E̻n3W^K�\�`��V캽�Zl���,f1�Y��;�af��k��ި��i����z����z?urV��Y9�Y�b���,f�,��|V��Y9+g1�Y�b���,��|���Y9+g�7�,f1�Y�b�|���Y>+g嬜�,f1�Y�b�|���Y>+g嬜����,f1�Y���l����i�o��.\��Ɲo<�l;9�:�g[�϶l�m��^�I>=gϙ���-yk_TA�
 
 
pro/vendor/phpqrcode/cache/mask_7/mask_161_7.dat DELETED
@@ -1 +0,0 @@
1
- x���ю� ���y���/皨E)Ʈ��1~4����93,˵���+��ZT=Ze�C���.�<s����v���>~iߏ������&>�,����6e�����~,l�W]�
 
pro/vendor/phpqrcode/cache/mask_7/mask_165_7.dat DELETED
@@ -1 +0,0 @@
1
- x���Q��0�������M&A,N�̨!�x0�&XZׇZ�-Kث[���e�j�����x,����.�g}�`;���+k{��~1���}�+k{�إ���SG�W�g�}�ݬ@�?_��8퐾o+�k][�h��W�8~�u��M�g�q�g|j<������*�q=<������ۓR�wƓ�����������q9.��8�3�8�3�8�I���U�G�?~�snr\��q9�8�3�8�3�x�q����㮁y�979.��g�q�g�q�g�=)�q���'E��q9.�g�q�g�q�wO�z�50�I��r\����8�3�8�_��Vvd}������a�x˯��5���)�&�9)����f���x�3�YH]�S^*/
 
pro/vendor/phpqrcode/cache/mask_7/mask_169_7.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_7/mask_173_7.dat DELETED
@@ -1 +0,0 @@
1
- x����j�0�{=M��/�
 
pro/vendor/phpqrcode/cache/mask_7/mask_177_7.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_7/mask_21_7.dat DELETED
@@ -1,4 +0,0 @@
1
- xڝ�Q
2
- �0B�=���r]��-?]Rl�����2���nc
3
- �[����n��A�".�j+�i
4
- ~�x3<�aX�{H��C1x��)����S�
 
 
 
 
pro/vendor/phpqrcode/cache/mask_7/mask_25_7.dat DELETED
@@ -1 +0,0 @@
1
- xڝQA� ��5���[F@��a�����Z̲�
 
pro/vendor/phpqrcode/cache/mask_7/mask_29_7.dat DELETED
@@ -1,2 +0,0 @@
1
- x��R9� ���������QpX�$l�Ųf!I2pg�S��MZj������<K.�ط
2
- �Ǘ���^D�/�_y�/�gcxV�0�Bf#���]B�Ͻʳ�h�9޹����^��
 
 
pro/vendor/phpqrcode/cache/mask_7/mask_33_7.dat DELETED
@@ -1 +0,0 @@
1
- x��SA�@��k���6���ǒ8��07-n��ZbE0�"���t]���3Ztq��>"�t���e0��#ԛ`�_�1-����c�����ha�~/�Eh�4���"��~�
 
pro/vendor/phpqrcode/cache/mask_7/mask_37_7.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_7/mask_41_7.dat DELETED
@@ -1 +0,0 @@
1
- x��TA� ��5���[fDY�(O�^��bR3/~t/L"��7SQQ5�j�\S��i���b��#Նȏ��+ǣ�w#�z�x?�㽧A-�w�u曑Y7$b.%A��;�w�R���oxG}?�
 
pro/vendor/phpqrcode/cache/mask_7/mask_45_7.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_7/mask_49_7.dat DELETED
@@ -1 +0,0 @@
1
- x��V��0��k���h�C-X.���<�h6̋3���,B
 
pro/vendor/phpqrcode/cache/mask_7/mask_53_7.dat DELETED
@@ -1 +0,0 @@
1
- x��K� D�s���&�R�k�i�&,H)�tD�j�=����Qa���P"d�s1ZyC�|hey��Cv�aH��7��+�O��u��Q�sZtb����7�v�����h�V���~���1#�~�[�f�����fHkZ�Jt���mZ��6���s����w�r�&C�߶f
 
pro/vendor/phpqrcode/cache/mask_7/mask_57_7.dat DELETED
@@ -1 +0,0 @@
1
- x��A�0������3&��H)Kb��&�q�֞�[-����֌��9�r��Ys�.��i�Ӿ`�����~���G��{c�i�Ղ�\Y<�.�|���2��۟�2� �QQ[[�^N��88�l����[}[�Pl?g+o*ϖ�4W���1� � �33��[�\Gos�bk�m�m��m��^��h�
 
pro/vendor/phpqrcode/cache/mask_7/mask_61_7.dat DELETED
@@ -1,2 +0,0 @@
1
- x��K
2
- � D�s����+-�*5�m��c�aT�1�9��Y�쌧�L9�糶����s�//i���\��b�����ī���-"^�D�H-i�;bnA���7�f�et�7ٷỵE:r�<4�6�(�u�y{K3o�"���|a��o�?ᜟ��竟��p�9���j~N�ƛ��s����TY���u
 
 
pro/vendor/phpqrcode/cache/mask_7/mask_65_7.dat DELETED
@@ -1 +0,0 @@
1
- x��A� �����I�*�6^L!酰��i)mT�T]�VW\�9�e@�4Ku^�#N%:�,��mY��JN��9���ඩ�vA�2���Ϝ�H�"Y�����+?`�BXD�BX̽{���.��w���d�,~΂k�,�^�bQ�~�.��\�w����^�ρ��OY��E�JmX���"%
 
pro/vendor/phpqrcode/cache/mask_7/mask_69_7.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_7/mask_73_7.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_7/mask_77_7.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_7/mask_81_7.dat DELETED
@@ -1 +0,0 @@
1
- x���� D��5��?�l�"͊ݕ�u4��a�>ukv
 
pro/vendor/phpqrcode/cache/mask_7/mask_85_7.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_7/mask_89_7.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_7/mask_93_7.dat DELETED
Binary file
pro/vendor/phpqrcode/cache/mask_7/mask_97_7.dat DELETED
@@ -1,2 +0,0 @@
1
- x����0�������ܲD[���V.K��I�`��'��sx����y���$�x�x�"���=O^&p�b���Yʬ�$�K�ݣ����8K����eÌ��� ���3:$bI,�%�$���Yb襶
2
- M)�T�
 
 
pro/vendor/phpqrcode/index.php DELETED
@@ -1,94 +0,0 @@
1
- <?php
2
- /*
3
- * PHP QR Code encoder
4
- *
5
- * Exemplatory usage
6
- *
7
- * PHP QR Code is distributed under LGPL 3
8
- * Copyright (C) 2010 Dominik Dzienia <deltalab at poczta dot fm>
9
- *
10
- * This library is free software; you can redistribute it and/or
11
- * modify it under the terms of the GNU Lesser General Public
12
- * License as published by the Free Software Foundation; either
13
- * version 3 of the License, or any later version.
14
- *
15
- * This library 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 GNU
18
- * Lesser General Public License for more details.
19
- *
20
- * You should have received a copy of the GNU Lesser General Public
21
- * License along with this library; if not, write to the Free Software
22
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23
- */
24
-
25
- echo "<h1>PHP QR Code</h1><hr/>";
26
-
27
- //set it to writable location, a place for temp generated PNG files
28
- $PNG_TEMP_DIR = dirname(__FILE__).DIRECTORY_SEPARATOR.'temp'.DIRECTORY_SEPARATOR;
29
-
30
- //html PNG location prefix
31
- $PNG_WEB_DIR = 'temp/';
32
-
33
- include "qrlib.php";
34
-
35
- //ofcourse we need rights to create temp dir
36
- if (!file_exists($PNG_TEMP_DIR))
37
- mkdir($PNG_TEMP_DIR);
38
-
39
-
40
- $filename = $PNG_TEMP_DIR.'test.png';
41
-
42
- //processing form input
43
- //remember to sanitize user input in real-life solution !!!
44
- $errorCorrectionLevel = 'L';
45
- if (isset($_REQUEST['level']) && in_array($_REQUEST['level'], array('L','M','Q','H')))
46
- $errorCorrectionLevel = $_REQUEST['level'];
47
-
48
- $matrixPointSize = 4;
49
- if (isset($_REQUEST['size']))
50
- $matrixPointSize = min(max((int)$_REQUEST['size'], 1), 10);
51
-
52
-
53
- if (isset($_REQUEST['data'])) {
54
-
55
- //it's very important!
56
- if (trim($_REQUEST['data']) == '')
57
- die('data cannot be empty! <a href="?">back</a>');
58
-
59
- // user data
60
- $filename = $PNG_TEMP_DIR.'test'.md5($_REQUEST['data'].'|'.$errorCorrectionLevel.'|'.$matrixPointSize).'.png';
61
- QRcode::png($_REQUEST['data'], $filename, $errorCorrectionLevel, $matrixPointSize, 2);
62
-
63
- } else {
64
-
65
- //default data
66
- echo 'You can provide data in GET parameter: <a href="?data=like_that">like that</a><hr/>';
67
- QRcode::png('PHP QR Code :)', $filename, $errorCorrectionLevel, $matrixPointSize, 2);
68
-
69
- }
70
-
71
- //display generated file
72
- echo '<img src="'.$PNG_WEB_DIR.basename($filename).'" /><hr/>';
73
-
74
- //config form
75
- echo '<form action="index.php" method="post">
76
- Data:&nbsp;<input name="data" value="'.(isset($_REQUEST['data'])?htmlspecialchars($_REQUEST['data']):'PHP QR Code :)').'" />&nbsp;
77
- ECC:&nbsp;<select name="level">
78
- <option value="L"'.(($errorCorrectionLevel=='L')?' selected':'').'>L - smallest</option>
79
- <option value="M"'.(($errorCorrectionLevel=='M')?' selected':'').'>M</option>
80
- <option value="Q"'.(($errorCorrectionLevel=='Q')?' selected':'').'>Q</option>
81
- <option value="H"'.(($errorCorrectionLevel=='H')?' selected':'').'>H - best</option>
82
- </select>&nbsp;
83
- Size:&nbsp;<select name="size">';
84
-
85
- for($i=1;$i<=10;$i++)
86
- echo '<option value="'.$i.'"'.(($matrixPointSize==$i)?' selected':'').'>'.$i.'</option>';
87
-
88
- echo '</select>&nbsp;
89
- <input type="submit" value="GENERATE"></form><hr/>';
90
-
91
- // benchmark
92
- QRtools::timeBenchmark();
93
-
94
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/vendor/phpqrcode/phpqrcode.php DELETED
@@ -1,3609 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * PHP QR Code encoder
5
- *
6
- * This file contains MERGED version of PHP QR Code library.
7
- * It was auto-generated from full version for your convenience.
8
- *
9
- * This merged version was configured to not require any external files,
10
- * with disabled cache, error logging and weaker but faster mask matching.
11
- * If you need tune it up please use non-merged version.
12
- *
13
- * For full version, documentation, examples of use please visit:
14
- *
15
- * http://phpqrcode.sourceforge.net/
16
- * https://sourceforge.net/projects/phpqrcode/
17
- * https://github.com/t0k4rt/phpqrcode
18
- *
19
- * PHP QR Code is distributed under LGPL 3
20
- * Copyright (C) 2010 Dominik Dzienia <deltalab at poczta dot fm>
21
- *
22
- * This library is free software; you can redistribute it and/or
23
- * modify it under the terms of the GNU Lesser General Public
24
- * License as published by the Free Software Foundation; either
25
- * version 3 of the License, or any later version.
26
- *
27
- * This library is distributed in the hope that it will be useful,
28
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
29
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
30
- * Lesser General Public License for more details.
31
- *
32
- * You should have received a copy of the GNU Lesser General Public
33
- * License along with this library; if not, write to the Free Software
34
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
35
- */
36
-
37
-
38
-
39
- /*
40
- * Version: 1.1.4
41
- * Build: 2010100721
42
- */
43
-
44
-
45
-
46
- //---- qrconst.php -----------------------------
47
-
48
-
49
-
50
-
51
-
52
- /*
53
- * PHP QR Code encoder
54
- *
55
- * Common constants
56
- *
57
- * Based on libqrencode C library distributed under LGPL 2.1
58
- * Copyright (C) 2006, 2007, 2008, 2009 Kentaro Fukuchi <fukuchi@megaui.net>
59
- *
60
- * PHP QR Code is distributed under LGPL 3
61
- * Copyright (C) 2010 Dominik Dzienia <deltalab at poczta dot fm>
62
- *
63
- * This library is free software; you can redistribute it and/or
64
- * modify it under the terms of the GNU Lesser General Public
65
- * License as published by the Free Software Foundation; either
66
- * version 3 of the License, or any later version.
67
- *
68
- * This library is distributed in the hope that it will be useful,
69
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
70
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
71
- * Lesser General Public License for more details.
72
- *
73
- * You should have received a copy of the GNU Lesser General Public
74
- * License along with this library; if not, write to the Free Software
75
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
76
- */
77
-
78
- // Encoding modes
79
-
80
- define('QR_MODE_NUL', -1);
81
- define('QR_MODE_NUM', 0);
82
- define('QR_MODE_AN', 1);
83
- define('QR_MODE_8', 2);
84
- define('QR_MODE_KANJI', 3);
85
- define('QR_MODE_STRUCTURE', 4);
86
-
87
- // Levels of error correction.
88
-
89
- define('QR_ECLEVEL_L', 0);
90
- define('QR_ECLEVEL_M', 1);
91
- define('QR_ECLEVEL_Q', 2);
92
- define('QR_ECLEVEL_H', 3);
93
-
94
- // Supported output formats
95
-
96
- define('QR_FORMAT_TEXT', 0);
97
- define('QR_FORMAT_PNG', 1);
98
-
99
- class qrstr {
100
- public static function set(&$srctab, $x, $y, $repl, $replLen = false) {
101
- $srctab[$y] = substr_replace($srctab[$y], ($replLen !== false)?substr($repl,0,$replLen):$repl, $x, ($replLen !== false)?$replLen:strlen($repl));
102
- }
103
- }
104
-
105
-
106
-
107
- //---- merged_config.php -----------------------------
108
-
109
-
110
-
111
-
112
- /*
113
- * PHP QR Code encoder
114
- *
115
- * Config file, tuned-up for merged verion
116
- */
117
-
118
- define('QR_CACHEABLE', false); // use cache - more disk reads but less CPU power, masks and format templates are stored there
119
- define('QR_CACHE_DIR', false); // used when QR_CACHEABLE === true
120
- define('QR_LOG_DIR', false); // default error logs dir
121
-
122
- define('QR_FIND_BEST_MASK', true); // if true, estimates best mask (spec. default, but extremally slow; set to false to significant performance boost but (propably) worst quality code
123
- define('QR_FIND_FROM_RANDOM', 2); // if false, checks all masks available, otherwise value tells count of masks need to be checked, mask id are got randomly
124
- define('QR_DEFAULT_MASK', 2); // when QR_FIND_BEST_MASK === false
125
-
126
- define('QR_PNG_MAXIMUM_SIZE', 1024); // maximum allowed png image width (in pixels), tune to make sure GD and PHP can handle such big images
127
-
128
-
129
-
130
-
131
- //---- qrtools.php -----------------------------
132
-
133
-
134
-
135
-
136
- /*
137
- * PHP QR Code encoder
138
- *
139
- * Toolset, handy and debug utilites.
140
- *
141
- * PHP QR Code is distributed under LGPL 3
142
- * Copyright (C) 2010 Dominik Dzienia <deltalab at poczta dot fm>
143
- *
144
- * This library is free software; you can redistribute it and/or
145
- * modify it under the terms of the GNU Lesser General Public
146
- * License as published by the Free Software Foundation; either
147
- * version 3 of the License, or any later version.
148
- *
149
- * This library is distributed in the hope that it will be useful,
150
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
151
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
152
- * Lesser General Public License for more details.
153
- *
154
- * You should have received a copy of the GNU Lesser General Public
155
- * License along with this library; if not, write to the Free Software
156
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
157
- */
158
-
159
- class QRtools {
160
-
161
- //----------------------------------------------------------------------
162
- public static function binarize($frame)
163
- {
164
- $len = count($frame);
165
- foreach ($frame as &$frameLine) {
166
-
167
- for($i=0; $i<$len; $i++) {
168
- $frameLine[$i] = (ord($frameLine[$i])&1)?'1':'0';
169
- }
170
- }
171
-
172
- return $frame;
173
- }
174
-
175
- //----------------------------------------------------------------------
176
- public static function tcpdfBarcodeArray($code, $mode = 'QR,L', $tcPdfVersion = '4.5.037')
177
- {
178
- $barcode_array = array();
179
-
180
- if (!is_array($mode))
181
- $mode = explode(',', $mode);
182
-
183
- $eccLevel = 'L';
184
-
185
- if (count($mode) > 1) {
186
- $eccLevel = $mode[1];
187
- }
188
-
189
- $qrTab = QRcode::text($code, false, $eccLevel);
190
- $size = count($qrTab);
191
-
192
- $barcode_array['num_rows'] = $size;
193
- $barcode_array['num_cols'] = $size;
194
- $barcode_array['bcode'] = array();
195
-
196
- foreach ($qrTab as $line) {
197
- $arrAdd = array();
198
- foreach(str_split($line) as $char)
199
- $arrAdd[] = ($char=='1')?1:0;
200
- $barcode_array['bcode'][] = $arrAdd;
201
- }
202
-
203
- return $barcode_array;
204
- }
205
-
206
- //----------------------------------------------------------------------
207
- public static function clearCache()
208
- {
209
- self::$frames = array();
210
- }
211
-
212
- //----------------------------------------------------------------------
213
- public static function buildCache()
214
- {
215
- QRtools::markTime('before_build_cache');
216
-
217
- $mask = new QRmask();
218
- for ($a=1; $a <= QRSPEC_VERSION_MAX; $a++) {
219
- $frame = QRspec::newFrame($a);
220
- if (QR_IMAGE) {
221
- $fileName = QR_CACHE_DIR.'frame_'.$a.'.png';
222
- QRimage::png(self::binarize($frame), $fileName, 1, 0);
223
- }
224
-
225
- $width = count($frame);
226
- $bitMask = array_fill(0, $width, array_fill(0, $width, 0));
227
- for ($maskNo=0; $maskNo<8; $maskNo++)
228
- $mask->makeMaskNo($maskNo, $width, $frame, $bitMask, true);
229
- }
230
-
231
- QRtools::markTime('after_build_cache');
232
- }
233
-
234
- //----------------------------------------------------------------------
235
- public static function log($outfile, $err)
236
- {
237
- if (QR_LOG_DIR !== false) {
238
- if ($err != '') {
239
- if ($outfile !== false) {
240
- file_put_contents(QR_LOG_DIR.basename($outfile).'-errors.txt', date('Y-m-d H:i:s').': '.$err, FILE_APPEND);
241
- } else {
242
- file_put_contents(QR_LOG_DIR.'errors.txt', date('Y-m-d H:i:s').': '.$err, FILE_APPEND);
243
- }
244
- }
245
- }
246
- }
247
-
248
- //----------------------------------------------------------------------
249
- public static function dumpMask($frame)
250
- {
251
- $width = count($frame);
252
- for($y=0;$y<$width;$y++) {
253
- for($x=0;$x<$width;$x++) {
254
- echo ord($frame[$y][$x]).',';
255
- }
256
- }
257
- }
258
-
259
- //----------------------------------------------------------------------
260
- public static function markTime($markerId)
261
- {
262
- list($usec, $sec) = explode(" ", microtime());
263
- $time = ((float)$usec + (float)$sec);
264
-
265
- if (!isset($GLOBALS['qr_time_bench']))
266
- $GLOBALS['qr_time_bench'] = array();
267
-
268
- $GLOBALS['qr_time_bench'][$markerId] = $time;
269
- }
270
-
271
- //----------------------------------------------------------------------
272
- public static function timeBenchmark()
273
- {
274
- self::markTime('finish');
275
-
276
- $lastTime = 0;
277
- $startTime = 0;
278
- $p = 0;
279
-
280
- echo '<table cellpadding="3" cellspacing="1">
281
- <thead><tr style="border-bottom:1px solid silver"><td colspan="2" style="text-align:center">BENCHMARK</td></tr></thead>
282
- <tbody>';
283
-
284
- foreach($GLOBALS['qr_time_bench'] as $markerId=>$thisTime) {
285
- if ($p > 0) {
286
- echo '<tr><th style="text-align:right">till '.$markerId.': </th><td>'.number_format($thisTime-$lastTime, 6).'s</td></tr>';
287
- } else {
288
- $startTime = $thisTime;
289
- }
290
-
291
- $p++;
292
- $lastTime = $thisTime;
293
- }
294
-
295
- echo '</tbody><tfoot>
296
- <tr style="border-top:2px solid black"><th style="text-align:right">TOTAL: </th><td>'.number_format($lastTime-$startTime, 6).'s</td></tr>
297
- </tfoot>
298
- </table>';
299
- }
300
-
301
- public static function save($content, $filename_path)
302
- {
303
- try {
304
- $handle = fopen($filename_path, "w");
305
- fwrite($handle, $content);
306
- fclose($handle);
307
- return true;
308
- } catch (Exception $e) {
309
- echo 'Exception reçue : ', $e->getMessage(), "\n";
310
- }
311
-
312
- }
313
-
314
- }
315
-
316
- //##########################################################################
317
-
318
- QRtools::markTime('start');
319
-
320
-
321
-
322
-
323
- //---- qrspec.php -----------------------------
324
-
325
-
326
-
327
-
328
- /*
329
- * PHP QR Code encoder
330
- *
331
- * QR Code specifications
332
- *
333
- * Based on libqrencode C library distributed under LGPL 2.1
334
- * Copyright (C) 2006, 2007, 2008, 2009 Kentaro Fukuchi <fukuchi@megaui.net>
335
- *
336
- * PHP QR Code is distributed under LGPL 3
337
- * Copyright (C) 2010 Dominik Dzienia <deltalab at poczta dot fm>
338
- *
339
- * The following data / specifications are taken from
340
- * "Two dimensional symbol -- QR-code -- Basic Specification" (JIS X0510:2004)
341
- * or
342
- * "Automatic identification and data capture techniques --
343
- * QR Code 2005 bar code symbology specification" (ISO/IEC 18004:2006)
344
- *
345
- * This library is free software; you can redistribute it and/or
346
- * modify it under the terms of the GNU Lesser General Public
347
- * License as published by the Free Software Foundation; either
348
- * version 3 of the License, or any later version.
349
- *
350
- * This library is distributed in the hope that it will be useful,
351
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
352
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
353
- * Lesser General Public License for more details.
354
- *
355
- * You should have received a copy of the GNU Lesser General Public
356
- * License along with this library; if not, write to the Free Software
357
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
358
- */
359
-
360
- define('QRSPEC_VERSION_MAX', 40);
361
- define('QRSPEC_WIDTH_MAX', 177);
362
-
363
- define('QRCAP_WIDTH', 0);
364
- define('QRCAP_WORDS', 1);
365
- define('QRCAP_REMINDER', 2);
366
- define('QRCAP_EC', 3);
367
-
368
- class QRspec {
369
-
370
- public static $capacity = array(
371
- array( 0, 0, 0, array( 0, 0, 0, 0)),
372
- array( 21, 26, 0, array( 7, 10, 13, 17)), // 1
373
- array( 25, 44, 7, array( 10, 16, 22, 28)),
374
- array( 29, 70, 7, array( 15, 26, 36, 44)),
375
- array( 33, 100, 7, array( 20, 36, 52, 64)),
376
- array( 37, 134, 7, array( 26, 48, 72, 88)), // 5
377
- array( 41, 172, 7, array( 36, 64, 96, 112)),
378
- array( 45, 196, 0, array( 40, 72, 108, 130)),
379
- array( 49, 242, 0, array( 48, 88, 132, 156)),
380
- array( 53, 292, 0, array( 60, 110, 160, 192)),
381
- array( 57, 346, 0, array( 72, 130, 192, 224)), //10
382
- array( 61, 404, 0, array( 80, 150, 224, 264)),
383
- array( 65, 466, 0, array( 96, 176, 260, 308)),
384
- array( 69, 532, 0, array( 104, 198, 288, 352)),
385
- array( 73, 581, 3, array( 120, 216, 320, 384)),
386
- array( 77, 655, 3, array( 132, 240, 360, 432)), //15
387
- array( 81, 733, 3, array( 144, 280, 408, 480)),
388
- array( 85, 815, 3, array( 168, 308, 448, 532)),
389
- array( 89, 901, 3, array( 180, 338, 504, 588)),
390
- array( 93, 991, 3, array( 196, 364, 546, 650)),
391
- array( 97, 1085, 3, array( 224, 416, 600, 700)), //20
392
- array(101, 1156, 4, array( 224, 442, 644, 750)),
393
- array(105, 1258, 4, array( 252, 476, 690, 816)),
394
- array(109, 1364, 4, array( 270, 504, 750, 900)),
395
- array(113, 1474, 4, array( 300, 560, 810, 960)),
396
- array(117, 1588, 4, array( 312, 588, 870, 1050)), //25
397
- array(121, 1706, 4, array( 336, 644, 952, 1110)),
398
- array(125, 1828, 4, array( 360, 700, 1020, 1200)),
399
- array(129, 1921, 3, array( 390, 728, 1050, 1260)),
400
- array(133, 2051, 3, array( 420, 784, 1140, 1350)),
401
- array(137, 2185, 3, array( 450, 812, 1200, 1440)), //30
402
- array(141, 2323, 3, array( 480, 868, 1290, 1530)),
403
- array(145, 2465, 3, array( 510, 924, 1350, 1620)),
404
- array(149, 2611, 3, array( 540, 980, 1440, 1710)),
405
- array(153, 2761, 3, array( 570, 1036, 1530, 1800)),
406
- array(157, 2876, 0, array( 570, 1064, 1590, 1890)), //35
407
- array(161, 3034, 0, array( 600, 1120, 1680, 1980)),
408
- array(165, 3196, 0, array( 630, 1204, 1770, 2100)),
409
- array(169, 3362, 0, array( 660, 1260, 1860, 2220)),
410
- array(173, 3532, 0, array( 720, 1316, 1950, 2310)),
411
- array(177, 3706, 0, array( 750, 1372, 2040, 2430)) //40
412
- );
413
-
414
- //----------------------------------------------------------------------
415
- public static function getDataLength($version, $level)
416
- {
417
- return self::$capacity[$version][QRCAP_WORDS] - self::$capacity[$version][QRCAP_EC][$level];
418
- }
419
-
420
- //----------------------------------------------------------------------
421
- public static function getECCLength($version, $level)
422
- {
423
- return self::$capacity[$version][QRCAP_EC][$level];
424
- }
425
-
426
- //----------------------------------------------------------------------
427
- public static function getWidth($version)
428
- {
429
- return self::$capacity[$version][QRCAP_WIDTH];
430
- }
431
-
432
- //----------------------------------------------------------------------
433
- public static function getRemainder($version)
434
- {
435
- return self::$capacity[$version][QRCAP_REMINDER];
436
- }
437
-
438
- //----------------------------------------------------------------------
439
- public static function getMinimumVersion($size, $level)
440
- {
441
-
442
- for($i=1; $i<= QRSPEC_VERSION_MAX; $i++) {
443
- $words = self::$capacity[$i][QRCAP_WORDS] - self::$capacity[$i][QRCAP_EC][$level];
444
- if($words >= $size)
445
- return $i;
446
- }
447
-
448
- return -1;
449
- }
450
-
451
- //######################################################################
452
-
453
- public static $lengthTableBits = array(
454
- array(10, 12, 14),
455
- array( 9, 11, 13),
456
- array( 8, 16, 16),
457
- array( 8, 10, 12)
458
- );
459
-
460
- //----------------------------------------------------------------------
461
- public static function lengthIndicator($mode, $version)
462
- {
463
- if ($mode == QR_MODE_STRUCTURE)
464
- return 0;
465
-
466
- if ($version <= 9) {
467
- $l = 0;
468
- } else if ($version <= 26) {
469
- $l = 1;
470
- } else {
471
- $l = 2;
472
- }
473
-
474
- return self::$lengthTableBits[$mode][$l];
475
- }
476
-
477
- //----------------------------------------------------------------------
478
- public static function maximumWords($mode, $version)
479
- {
480
- if($mode == QR_MODE_STRUCTURE)
481
- return 3;
482
-
483
- if($version <= 9) {
484
- $l = 0;
485
- } else if($version <= 26) {
486
- $l = 1;
487
- } else {
488
- $l = 2;
489
- }
490
-
491
- $bits = self::$lengthTableBits[$mode][$l];
492
- $words = (1 << $bits) - 1;
493
-
494
- if($mode == QR_MODE_KANJI) {
495
- $words *= 2; // the number of bytes is required
496
- }
497
-
498
- return $words;
499
- }
500
-
501
- // Error correction code -----------------------------------------------
502
- // Table of the error correction code (Reed-Solomon block)
503
- // See Table 12-16 (pp.30-36), JIS X0510:2004.
504
-
505
- public static $eccTable = array(
506
- array(array( 0, 0), array( 0, 0), array( 0, 0), array( 0, 0)),
507
- array(array( 1, 0), array( 1, 0), array( 1, 0), array( 1, 0)), // 1
508
- array(array( 1, 0), array( 1, 0), array( 1, 0), array( 1, 0)),
509
- array(array( 1, 0), array( 1, 0), array( 2, 0), array( 2, 0)),
510
- array(array( 1, 0), array( 2, 0), array( 2, 0), array( 4, 0)),
511
- array(array( 1, 0), array( 2, 0), array( 2, 2), array( 2, 2)), // 5
512
- array(array( 2, 0), array( 4, 0), array( 4, 0), array( 4, 0)),
513
- array(array( 2, 0), array( 4, 0), array( 2, 4), array( 4, 1)),
514
- array(array( 2, 0), array( 2, 2), array( 4, 2), array( 4, 2)),
515
- array(array( 2, 0), array( 3, 2), array( 4, 4), array( 4, 4)),
516
- array(array( 2, 2), array( 4, 1), array( 6, 2), array( 6, 2)), //10
517
- array(array( 4, 0), array( 1, 4), array( 4, 4), array( 3, 8)),
518
- array(array( 2, 2), array( 6, 2), array( 4, 6), array( 7, 4)),
519
- array(array( 4, 0), array( 8, 1), array( 8, 4), array(12, 4)),
520
- array(array( 3, 1), array( 4, 5), array(11, 5), array(11, 5)),
521
- array(array( 5, 1), array( 5, 5), array( 5, 7), array(11, 7)), //15
522
- array(array( 5, 1), array( 7, 3), array(15, 2), array( 3, 13)),
523
- array(array( 1, 5), array(10, 1), array( 1, 15), array( 2, 17)),
524
- array(array( 5, 1), array( 9, 4), array(17, 1), array( 2, 19)),
525
- array(array( 3, 4), array( 3, 11), array(17, 4), array( 9, 16)),
526
- array(array( 3, 5), array( 3, 13), array(15, 5), array(15, 10)), //20
527
- array(array( 4, 4), array(17, 0), array(17, 6), array(19, 6)),
528
- array(array( 2, 7), array(17, 0), array( 7, 16), array(34, 0)),
529
- array(array( 4, 5), array( 4, 14), array(11, 14), array(16, 14)),
530
- array(array( 6, 4), array( 6, 14), array(11, 16), array(30, 2)),
531
- array(array( 8, 4), array( 8, 13), array( 7, 22), array(22, 13)), //25
532
- array(array(10, 2), array(19, 4), array(28, 6), array(33, 4)),
533
- array(array( 8, 4), array(22, 3), array( 8, 26), array(12, 28)),
534
- array(array( 3, 10), array( 3, 23), array( 4, 31), array(11, 31)),
535
- array(array( 7, 7), array(21, 7), array( 1, 37), array(19, 26)),
536
- array(array( 5, 10), array(19, 10), array(15, 25), array(23, 25)), //30
537
- array(array(13, 3), array( 2, 29), array(42, 1), array(23, 28)),
538
- array(array(17, 0), array(10, 23), array(10, 35), array(19, 35)),
539
- array(array(17, 1), array(14, 21), array(29, 19), array(11, 46)),
540
- array(array(13, 6), array(14, 23), array(44, 7), array(59, 1)),
541
- array(array(12, 7), array(12, 26), array(39, 14), array(22, 41)), //35
542
- array(array( 6, 14), array( 6, 34), array(46, 10), array( 2, 64)),
543
- array(array(17, 4), array(29, 14), array(49, 10), array(24, 46)),
544
- array(array( 4, 18), array(13, 32), array(48, 14), array(42, 32)),
545
- array(array(20, 4), array(40, 7), array(43, 22), array(10, 67)),
546
- array(array(19, 6), array(18, 31), array(34, 34), array(20, 61)),//40
547
- );
548
-
549
- //----------------------------------------------------------------------
550
- // CACHEABLE!!!
551
-
552
- public static function getEccSpec($version, $level, array &$spec)
553
- {
554
- if (count($spec) < 5) {
555
- $spec = array(0,0,0,0,0);
556
- }
557
-
558
- $b1 = self::$eccTable[$version][$level][0];
559
- $b2 = self::$eccTable[$version][$level][1];
560
- $data = self::getDataLength($version, $level);
561
- $ecc = self::getECCLength($version, $level);
562
-
563
- if($b2 == 0) {
564
- $spec[0] = $b1;
565
- $spec[1] = (int)($data / $b1);
566
- $spec[2] = (int)($ecc / $b1);
567
- $spec[3] = 0;
568
- $spec[4] = 0;
569
- } else {
570
- $spec[0] = $b1;
571
- $spec[1] = (int)($data / ($b1 + $b2));
572
- $spec[2] = (int)($ecc / ($b1 + $b2));
573
- $spec[3] = $b2;
574
- $spec[4] = $spec[1] + 1;
575
- }
576
- }
577
-
578
- // Alignment pattern ---------------------------------------------------
579
-
580
- // Positions of alignment patterns.
581
- // This array includes only the second and the third position of the
582
- // alignment patterns. Rest of them can be calculated from the distance
583
- // between them.
584
-
585
- // See Table 1 in Appendix E (pp.71) of JIS X0510:2004.
586
-
587
- public static $alignmentPattern = array(
588
- array( 0, 0),
589
- array( 0, 0), array(18, 0), array(22, 0), array(26, 0), array(30, 0), // 1- 5
590
- array(34, 0), array(22, 38), array(24, 42), array(26, 46), array(28, 50), // 6-10
591
- array(30, 54), array(32, 58), array(34, 62), array(26, 46), array(26, 48), //11-15
592
- array(26, 50), array(30, 54), array(30, 56), array(30, 58), array(34, 62), //16-20
593
- array(28, 50), array(26, 50), array(30, 54), array(28, 54), array(32, 58), //21-25
594
- array(30, 58), array(34, 62), array(26, 50), array(30, 54), array(26, 52), //26-30
595
- array(30, 56), array(34, 60), array(30, 58), array(34, 62), array(30, 54), //31-35
596
- array(24, 50), array(28, 54), array(32, 58), array(26, 54), array(30, 58), //35-40
597
- );
598
-
599
-
600
- /** --------------------------------------------------------------------
601
- * Put an alignment marker.
602
- * @param frame
603
- * @param width
604
- * @param ox,oy center coordinate of the pattern
605
- */
606
- public static function putAlignmentMarker(array &$frame, $ox, $oy)
607
- {
608
- $finder = array(
609
- "\xa1\xa1\xa1\xa1\xa1",
610
- "\xa1\xa0\xa0\xa0\xa1",
611
- "\xa1\xa0\xa1\xa0\xa1",
612
- "\xa1\xa0\xa0\xa0\xa1",
613
- "\xa1\xa1\xa1\xa1\xa1"
614
- );
615
-
616
- $yStart = $oy-2;
617
- $xStart = $ox-2;
618
-
619
- for($y=0; $y<5; $y++) {
620
- QRstr::set($frame, $xStart, $yStart+$y, $finder[$y]);
621
- }
622
- }
623
-
624
- //----------------------------------------------------------------------
625
- public static function putAlignmentPattern($version, &$frame, $width)
626
- {
627
- if($version < 2)
628
- return;
629
-
630
- $d = self::$alignmentPattern[$version][1] - self::$alignmentPattern[$version][0];
631
- if($d < 0) {
632
- $w = 2;
633
- } else {
634
- $w = (int)(($width - self::$alignmentPattern[$version][0]) / $d + 2);
635
- }
636
-
637
- if($w * $w - 3 == 1) {
638
- $x = self::$alignmentPattern[$version][0];
639
- $y = self::$alignmentPattern[$version][0];
640
- self::putAlignmentMarker($frame, $x, $y);
641
- return;
642
- }
643
-
644
- $cx = self::$alignmentPattern[$version][0];
645
- for($x=1; $x<$w - 1; $x++) {
646
- self::putAlignmentMarker($frame, 6, $cx);
647
- self::putAlignmentMarker($frame, $cx, 6);
648
- $cx += $d;
649
- }
650
-
651
- $cy = self::$alignmentPattern[$version][0];
652
- for($y=0; $y<$w-1; $y++) {
653
- $cx = self::$alignmentPattern[$version][0];
654
- for($x=0; $x<$w-1; $x++) {
655
- self::putAlignmentMarker($frame, $cx, $cy);
656
- $cx += $d;
657
- }
658
- $cy += $d;
659
- }
660
- }
661
-
662
- // Version information pattern -----------------------------------------
663
-
664
- // Version information pattern (BCH coded).
665
- // See Table 1 in Appendix D (pp.68) of JIS X0510:2004.
666
-
667
- // size: [QRSPEC_VERSION_MAX - 6]
668
-
669
- public static $versionPattern = array(
670
- 0x07c94, 0x085bc, 0x09a99, 0x0a4d3, 0x0bbf6, 0x0c762, 0x0d847, 0x0e60d,
671
- 0x0f928, 0x10b78, 0x1145d, 0x12a17, 0x13532, 0x149a6, 0x15683, 0x168c9,
672
- 0x177ec, 0x18ec4, 0x191e1, 0x1afab, 0x1b08e, 0x1cc1a, 0x1d33f, 0x1ed75,
673
- 0x1f250, 0x209d5, 0x216f0, 0x228ba, 0x2379f, 0x24b0b, 0x2542e, 0x26a64,
674
- 0x27541, 0x28c69
675
- );
676
-
677
- //----------------------------------------------------------------------
678
- public static function getVersionPattern($version)
679
- {
680
- if($version < 7 || $version > QRSPEC_VERSION_MAX)
681
- return 0;
682
-
683
- return self::$versionPattern[$version -7];
684
- }
685
-
686
- // Format information --------------------------------------------------
687
- // See calcFormatInfo in tests/test_qrspec.c (orginal qrencode c lib)
688
-
689
- public static $formatInfo = array(
690
- array(0x77c4, 0x72f3, 0x7daa, 0x789d, 0x662f, 0x6318, 0x6c41, 0x6976),
691
- array(0x5412, 0x5125, 0x5e7c, 0x5b4b, 0x45f9, 0x40ce, 0x4f97, 0x4aa0),
692
- array(0x355f, 0x3068, 0x3f31, 0x3a06, 0x24b4, 0x2183, 0x2eda, 0x2bed),
693
- array(0x1689, 0x13be, 0x1ce7, 0x19d0, 0x0762, 0x0255, 0x0d0c, 0x083b)
694
- );
695
-
696
- public static function getFormatInfo($mask, $level)
697
- {
698
- if($mask < 0 || $mask > 7)
699
- return 0;
700
-
701
- if($level < 0 || $level > 3)
702
- return 0;
703
-
704
- return self::$formatInfo[$level][$mask];
705
- }
706
-
707
- // Frame ---------------------------------------------------------------
708
- // Cache of initial frames.
709
-
710
- public static $frames = array();
711
-
712
- /** --------------------------------------------------------------------
713
- * Put a finder pattern.
714
- * @param frame
715
- * @param width
716
- * @param ox,oy upper-left coordinate of the pattern
717
- */
718
- public static function putFinderPattern(&$frame, $ox, $oy)
719
- {
720
- $finder = array(
721
- "\xc1\xc1\xc1\xc1\xc1\xc1\xc1",
722
- "\xc1\xc0\xc0\xc0\xc0\xc0\xc1",
723
- "\xc1\xc0\xc1\xc1\xc1\xc0\xc1",
724
- "\xc1\xc0\xc1\xc1\xc1\xc0\xc1",
725
- "\xc1\xc0\xc1\xc1\xc1\xc0\xc1",
726
- "\xc1\xc0\xc0\xc0\xc0\xc0\xc1",
727
- "\xc1\xc1\xc1\xc1\xc1\xc1\xc1"
728
- );
729
-
730
- for($y=0; $y<7; $y++) {
731
- QRstr::set($frame, $ox, $oy+$y, $finder[$y]);
732
- }
733
- }
734
-
735
- //----------------------------------------------------------------------
736
- public static function createFrame($version)
737
- {
738
- $width = self::$capacity[$version][QRCAP_WIDTH];
739
- $frameLine = str_repeat ("\0", $width);
740
- $frame = array_fill(0, $width, $frameLine);
741
-
742
- // Finder pattern
743
- self::putFinderPattern($frame, 0, 0);
744
- self::putFinderPattern($frame, $width - 7, 0);
745
- self::putFinderPattern($frame, 0, $width - 7);
746
-
747
- // Separator
748
- $yOffset = $width - 7;
749
-
750
- for($y=0; $y<7; $y++) {
751
- $frame[$y][7] = "\xc0";
752
- $frame[$y][$width - 8] = "\xc0";
753
- $frame[$yOffset][7] = "\xc0";
754
- $yOffset++;
755
- }
756
-
757
- $setPattern = str_repeat("\xc0", 8);
758
-
759
- QRstr::set($frame, 0, 7, $setPattern);
760
- QRstr::set($frame, $width-8, 7, $setPattern);
761
- QRstr::set($frame, 0, $width - 8, $setPattern);
762
-
763
- // Format info
764
- $setPattern = str_repeat("\x84", 9);
765
- QRstr::set($frame, 0, 8, $setPattern);
766
- QRstr::set($frame, $width - 8, 8, $setPattern, 8);
767
-
768
- $yOffset = $width - 8;
769
-
770
- for($y=0; $y<8; $y++,$yOffset++) {
771
- $frame[$y][8] = "\x84";
772
- $frame[$yOffset][8] = "\x84";
773
- }
774
-
775
- // Timing pattern
776
-
777
- for($i=1; $i<$width-15; $i++) {
778
- $frame[6][7+$i] = chr(0x90 | ($i & 1));
779
- $frame[7+$i][6] = chr(0x90 | ($i & 1));
780
- }
781
-
782
- // Alignment pattern
783
- self::putAlignmentPattern($version, $frame, $width);
784
-
785
- // Version information
786
- if($version >= 7) {
787
- $vinf = self::getVersionPattern($version);
788
-
789
- $v = $vinf;
790
-
791
- for($x=0; $x<6; $x++) {
792
- for($y=0; $y<3; $y++) {
793
- $frame[($width - 11)+$y][$x] = chr(0x88 | ($v & 1));
794
- $v = $v >> 1;
795
- }
796
- }
797
-
798
- $v = $vinf;
799
- for($y=0; $y<6; $y++) {
800
- for($x=0; $x<3; $x++) {
801
- $frame[$y][$x+($width - 11)] = chr(0x88 | ($v & 1));
802
- $v = $v >> 1;
803
- }
804
- }
805
- }
806
-
807
- // and a little bit...
808
- $frame[$width - 8][8] = "\x81";
809
-
810
- return $frame;
811
- }
812
-
813
- //----------------------------------------------------------------------
814
- public static function debug($frame, $binary_mode = false)
815
- {
816
- if ($binary_mode) {
817
-
818
- foreach ($frame as &$frameLine) {
819
- $frameLine = join('<span class="m">&nbsp;&nbsp;</span>', explode('0', $frameLine));
820
- $frameLine = join('&#9608;&#9608;', explode('1', $frameLine));
821
- }
822
-
823
- ?>
824
- <style>
825
- .m { background-color: white; }
826
- </style>
827
- <?php
828
- echo '<pre><tt><br/ ><br/ ><br/ >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
829
- echo join("<br/ >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", $frame);
830
- echo '</tt></pre><br/ ><br/ ><br/ ><br/ ><br/ ><br/ >';
831
-
832
- } else {
833
-
834
- foreach ($frame as &$frameLine) {
835
- $frameLine = join('<span class="m">&nbsp;</span>', explode("\xc0", $frameLine));
836
- $frameLine = join('<span class="m">&#9618;</span>', explode("\xc1", $frameLine));
837
- $frameLine = join('<span class="p">&nbsp;</span>', explode("\xa0", $frameLine));
838
- $frameLine = join('<span class="p">&#9618;</span>', explode("\xa1", $frameLine));
839
- $frameLine = join('<span class="s">&#9671;</span>', explode("\x84", $frameLine)); //format 0
840
- $frameLine = join('<span class="s">&#9670;</span>', explode("\x85", $frameLine)); //format 1
841
- $frameLine = join('<span class="x">&#9762;</span>', explode("\x81", $frameLine)); //special bit
842
- $frameLine = join('<span class="c">&nbsp;</span>', explode("\x90", $frameLine)); //clock 0
843
- $frameLine = join('<span class="c">&#9719;</span>', explode("\x91", $frameLine)); //clock 1
844
- $frameLine = join('<span class="f">&nbsp;</span>', explode("\x88", $frameLine)); //version
845
- $frameLine = join('<span class="f">&#9618;</span>', explode("\x89", $frameLine)); //version
846
- $frameLine = join('&#9830;', explode("\x01", $frameLine));
847
- $frameLine = join('&#8901;', explode("\0", $frameLine));
848
- }
849
-
850
- ?>
851
- <style>
852
- .p { background-color: yellow; }
853
- .m { background-color: #00FF00; }
854
- .s { background-color: #FF0000; }
855
- .c { background-color: aqua; }
856
- .x { background-color: pink; }
857
- .f { background-color: gold; }
858
- </style>
859
- <?php
860
- echo "<pre><tt>";
861
- echo join("<br/ >", $frame);
862
- echo "</tt></pre>";
863
-
864
- }
865
- }
866
-
867
- //----------------------------------------------------------------------
868
- public static function serial($frame)
869
- {
870
- return gzcompress(join("\n", $frame), 9);
871
- }
872
-
873
- //----------------------------------------------------------------------
874
- public static function unserial($code)
875
- {
876
- return explode("\n", gzuncompress($code));
877
- }
878
-
879
- //----------------------------------------------------------------------
880
- public static function newFrame($version)
881
- {
882
- if($version < 1 || $version > QRSPEC_VERSION_MAX)
883
- return null;
884
-
885
- if(!isset(self::$frames[$version])) {
886
-
887
- $fileName = QR_CACHE_DIR.'frame_'.$version.'.dat';
888
-
889
- if (QR_CACHEABLE) {
890
- if (file_exists($fileName)) {
891
- self::$frames[$version] = self::unserial(file_get_contents($fileName));
892
- } else {
893
- self::$frames[$version] = self::createFrame($version);
894
- file_put_contents($fileName, self::serial(self::$frames[$version]));
895
- }
896
- } else {
897
- self::$frames[$version] = self::createFrame($version);
898
- }
899
- }
900
-
901
- if(is_null(self::$frames[$version]))
902
- return null;
903
-
904
- return self::$frames[$version];
905
- }
906
-
907
- //----------------------------------------------------------------------
908
- public static function rsBlockNum($spec) { return $spec[0] + $spec[3]; }
909
- public static function rsBlockNum1($spec) { return $spec[0]; }
910
- public static function rsDataCodes1($spec) { return $spec[1]; }
911
- public static function rsEccCodes1($spec) { return $spec[2]; }
912
- public static function rsBlockNum2($spec) { return $spec[3]; }
913
- public static function rsDataCodes2($spec) { return $spec[4]; }
914
- public static function rsEccCodes2($spec) { return $spec[2]; }
915
- public static function rsDataLength($spec) { return ($spec[0] * $spec[1]) + ($spec[3] * $spec[4]); }
916
- public static function rsEccLength($spec) { return ($spec[0] + $spec[3]) * $spec[2]; }
917
-
918
- }
919
-
920
-
921
-
922
- //---- qrimage.php -----------------------------
923
-
924
-
925
-
926
-
927
- /*
928
- * PHP QR Code encoder
929
- *
930
- * Image output of code using GD2
931
- *
932
- * PHP QR Code is distributed under LGPL 3
933
- * Copyright (C) 2010 Dominik Dzienia <deltalab at poczta dot fm>
934
- *
935
- * This library is free software; you can redistribute it and/or
936
- * modify it under the terms of the GNU Lesser General Public
937
- * License as published by the Free Software Foundation; either
938
- * version 3 of the License, or any later version.
939
- *
940
- * This library is distributed in the hope that it will be useful,
941
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
942
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
943
- * Lesser General Public License for more details.
944
- *
945
- * You should have received a copy of the GNU Lesser General Public
946
- * License along with this library; if not, write to the Free Software
947
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
948
- */
949
-
950
- define('QR_IMAGE', true);
951
-
952
- class QRimage {
953
-
954
- //----------------------------------------------------------------------
955
- public static function png($frame, $filename = false, $pixelPerPoint = 4, $outerFrame = 4,$saveandprint=FALSE, $back_color, $fore_color)
956
- {
957
- $image = self::image($frame, $pixelPerPoint, $outerFrame, $back_color, $fore_color);
958
-
959
- if ($filename === false) {
960
- Header("Content-type: image/png");
961
- ImagePng($image);
962
- } else {
963
- if($saveandprint===TRUE){
964
- ImagePng($image, $filename);
965
- header("Content-type: image/png");
966
- ImagePng($image);
967
- }else{
968
- ImagePng($image, $filename);
969
- }
970
- }
971
-
972
- ImageDestroy($image);
973
- }
974
-
975
- //----------------------------------------------------------------------
976
- public static function jpg($frame, $filename = false, $pixelPerPoint = 8, $outerFrame = 4, $q = 85)
977
- {
978
- $image = self::image($frame, $pixelPerPoint, $outerFrame, $back_color, $fore_color);
979
-
980
- if ($filename === false) {
981
- Header("Content-type: image/jpeg");
982
- ImageJpeg($image, null, $q);
983
- } else {
984
- ImageJpeg($image, $filename, $q);
985
- }
986
-
987
- ImageDestroy($image);
988
- }
989
-
990
- //----------------------------------------------------------------------
991
- private static function image($frame, $pixelPerPoint = 4, $outerFrame = 4, $back_color = 0xFFFFFF, $fore_color = 0x000000)
992
- {
993
- $h = count($frame);
994
- $w = strlen($frame[0]);
995
-
996
- $imgW = $w + 2*$outerFrame;
997
- $imgH = $h + 2*$outerFrame;
998
-
999
- $base_image =ImageCreate($imgW, $imgH);
1000
-
1001
- // convert a hexadecimal color code into decimal eps format (green = 0 1 0, blue = 0 0 1, ...)
1002
- $r1 = round((($fore_color & 0xFF0000) >> 16), 5);
1003
- $b1 = round((($fore_color & 0x00FF00) >> 8), 5);
1004
- $g1 = round(($fore_color & 0x0000FF), 5);
1005
-
1006
- // convert a hexadecimal color code into decimal eps format (green = 0 1 0, blue = 0 0 1, ...)
1007
- $r2 = round((($back_color & 0xFF0000) >> 16), 5);
1008
- $b2 = round((($back_color & 0x00FF00) >> 8), 5);
1009
- $g2 = round(($back_color & 0x0000FF), 5);
1010
-
1011
-
1012
-
1013
- $col[0] = ImageColorAllocate($base_image,$r2,$b2,$g2);
1014
- $col[1] = ImageColorAllocate($base_image,$r1,$b1,$g1);
1015
-
1016
- imagefill($base_image, 0, 0, $col[0]);
1017
-
1018
- for($y=0; $y<$h; $y++) {
1019
- for($x=0; $x<$w; $x++) {
1020
- if ($frame[$y][$x] == '1') {
1021
- ImageSetPixel($base_image,$x+$outerFrame,$y+$outerFrame,$col[1]);
1022
- }
1023
- }
1024
- }
1025
-
1026
- $target_image =ImageCreate($imgW * $pixelPerPoint, $imgH * $pixelPerPoint);
1027
- ImageCopyResized($target_image, $base_image, 0, 0, 0, 0, $imgW * $pixelPerPoint, $imgH * $pixelPerPoint, $imgW, $imgH);
1028
- ImageDestroy($base_image);
1029
-
1030
- return $target_image;
1031
- }
1032
- }
1033
-
1034
-
1035
-
1036
- //---- qrinput.php -----------------------------
1037
-
1038
-
1039
-
1040
-
1041
- /*
1042
- * PHP QR Code encoder
1043
- *
1044
- * Input encoding class
1045
- *
1046
- * Based on libqrencode C library distributed under LGPL 2.1
1047
- * Copyright (C) 2006, 2007, 2008, 2009 Kentaro Fukuchi <fukuchi@megaui.net>
1048
- *
1049
- * PHP QR Code is distributed under LGPL 3
1050
- * Copyright (C) 2010 Dominik Dzienia <deltalab at poczta dot fm>
1051
- *
1052
- * This library is free software; you can redistribute it and/or
1053
- * modify it under the terms of the GNU Lesser General Public
1054
- * License as published by the Free Software Foundation; either
1055
- * version 3 of the License, or any later version.
1056
- *
1057
- * This library is distributed in the hope that it will be useful,
1058
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1059
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1060
- * Lesser General Public License for more details.
1061
- *
1062
- * You should have received a copy of the GNU Lesser General Public
1063
- * License along with this library; if not, write to the Free Software
1064
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
1065
- */
1066
-
1067
- define('STRUCTURE_HEADER_BITS', 20);
1068
- define('MAX_STRUCTURED_SYMBOLS', 16);
1069
-
1070
- class QRinputItem {
1071
-
1072
- public $mode;
1073
- public $size;
1074
- public $data;
1075
- public $bstream;
1076
-
1077
- public function __construct($mode, $size, $data, $bstream = null)
1078
- {
1079
- $setData = array_slice($data, 0, $size);
1080
-
1081
- if (count($setData) < $size) {
1082
- $setData = array_merge($setData, array_fill(0,$size-count($setData),0));
1083
- }
1084
-
1085
- if(!QRinput::check($mode, $size, $setData)) {
1086
- throw new Exception('Error m:'.$mode.',s:'.$size.',d:'.join(',',$setData));
1087
- return null;
1088
- }
1089
-
1090
- $this->mode = $mode;
1091
- $this->size = $size;
1092
- $this->data = $setData;
1093
- $this->bstream = $bstream;
1094
- }
1095
-
1096
- //----------------------------------------------------------------------
1097
- public function encodeModeNum($version)
1098
- {
1099
- try {
1100
-
1101
- $words = (int)($this->size / 3);
1102
- $bs = new QRbitstream();
1103
-
1104
- $val = 0x1;
1105
- $bs->appendNum(4, $val);
1106
- $bs->appendNum(QRspec::lengthIndicator(QR_MODE_NUM, $version), $this->size);
1107
-
1108
- for($i=0; $i<$words; $i++) {
1109
- $val = (ord($this->data[$i*3 ]) - ord('0')) * 100;
1110
- $val += (ord($this->data[$i*3+1]) - ord('0')) * 10;
1111
- $val += (ord($this->data[$i*3+2]) - ord('0'));
1112
- $bs->appendNum(10, $val);
1113
- }
1114
-
1115
- if($this->size - $words * 3 == 1) {
1116
- $val = ord($this->data[$words*3]) - ord('0');
1117
- $bs->appendNum(4, $val);
1118
- } else if($this->size - $words * 3 == 2) {
1119
- $val = (ord($this->data[$words*3 ]) - ord('0')) * 10;
1120
- $val += (ord($this->data[$words*3+1]) - ord('0'));
1121
- $bs->appendNum(7, $val);
1122
- }
1123
-
1124
- $this->bstream = $bs;
1125
- return 0;
1126
-
1127
- } catch (Exception $e) {
1128
- return -1;
1129
- }
1130
- }
1131
-
1132
- //----------------------------------------------------------------------
1133
- public function encodeModeAn($version)
1134
- {
1135
- try {
1136
- $words = (int)($this->size / 2);
1137
- $bs = new QRbitstream();
1138
-
1139
- $bs->appendNum(4, 0x02);
1140
- $bs->appendNum(QRspec::lengthIndicator(QR_MODE_AN, $version), $this->size);
1141
-
1142
- for($i=0; $i<$words; $i++) {
1143
- $val = (int)QRinput::lookAnTable(ord($this->data[$i*2 ])) * 45;
1144
- $val += (int)QRinput::lookAnTable(ord($this->data[$i*2+1]));
1145
-
1146
- $bs->appendNum(11, $val);
1147
- }
1148
-
1149
- if($this->size & 1) {
1150
- $val = QRinput::lookAnTable(ord($this->data[$words * 2]));
1151
- $bs->appendNum(6, $val);
1152
- }
1153
-
1154
- $this->bstream = $bs;
1155
- return 0;
1156
-
1157
- } catch (Exception $e) {
1158
- return -1;
1159
- }
1160
- }
1161
-
1162
- //----------------------------------------------------------------------
1163
- public function encodeMode8($version)
1164
- {
1165
- try {
1166
- $bs = new QRbitstream();
1167
-
1168
- $bs->appendNum(4, 0x4);
1169
- $bs->appendNum(QRspec::lengthIndicator(QR_MODE_8, $version), $this->size);
1170
-
1171
- for($i=0; $i<$this->size; $i++) {
1172
- $bs->appendNum(8, ord($this->data[$i]));
1173
- }
1174
-
1175
- $this->bstream = $bs;
1176
- return 0;
1177
-
1178
- } catch (Exception $e) {
1179
- return -1;
1180
- }
1181
- }
1182
-
1183
- //----------------------------------------------------------------------
1184
- public function encodeModeKanji($version)
1185
- {
1186
- try {
1187
-
1188
- $bs = new QRbitrtream();
1189
-
1190
- $bs->appendNum(4, 0x8);
1191
- $bs->appendNum(QRspec::lengthIndicator(QR_MODE_KANJI, $version), (int)($this->size / 2));
1192
-
1193
- for($i=0; $i<$this->size; $i+=2) {
1194
- $val = (ord($this->data[$i]) << 8) | ord($this->data[$i+1]);
1195
- if($val <= 0x9ffc) {
1196
- $val -= 0x8140;
1197
- } else {
1198
- $val -= 0xc140;
1199
- }
1200
-
1201
- $h = ($val >> 8) * 0xc0;
1202
- $val = ($val & 0xff) + $h;
1203
-
1204
- $bs->appendNum(13, $val);
1205
- }
1206
-
1207
- $this->bstream = $bs;
1208
- return 0;
1209
-
1210
- } catch (Exception $e) {
1211
- return -1;
1212
- }
1213
- }
1214
-
1215
- //----------------------------------------------------------------------
1216
- public function encodeModeStructure()
1217
- {
1218
- try {
1219
- $bs = new QRbitstream();
1220
-
1221
- $bs->appendNum(4, 0x03);
1222
- $bs->appendNum(4, ord($this->data[1]) - 1);
1223
- $bs->appendNum(4, ord($this->data[0]) - 1);
1224
- $bs->appendNum(8, ord($this->data[2]));
1225
-
1226
- $this->bstream = $bs;
1227
- return 0;
1228
-
1229
- } catch (Exception $e) {
1230
- return -1;
1231
- }
1232
- }
1233
-
1234
- //----------------------------------------------------------------------
1235
- public function estimateBitStreamSizeOfEntry($version)
1236
- {
1237
- $bits = 0;
1238
-
1239
- if($version == 0)
1240
- $version = 1;
1241
-
1242
- switch($this->mode) {
1243
- case QR_MODE_NUM: $bits = QRinput::estimateBitsModeNum($this->size); break;
1244
- case QR_MODE_AN: $bits = QRinput::estimateBitsModeAn($this->size); break;
1245
- case QR_MODE_8: $bits = QRinput::estimateBitsMode8($this->size); break;
1246
- case QR_MODE_KANJI: $bits = QRinput::estimateBitsModeKanji($this->size);break;
1247
- case QR_MODE_STRUCTURE: return STRUCTURE_HEADER_BITS;
1248
- default:
1249
- return 0;
1250
- }
1251
-
1252
- $l = QRspec::lengthIndicator($this->mode, $version);
1253
- $m = 1 << $l;
1254
- $num = (int)(($this->size + $m - 1) / $m);
1255
-
1256
- $bits += $num * (4 + $l);
1257
-
1258
- return $bits;
1259
- }
1260
-
1261
- //----------------------------------------------------------------------
1262
- public function encodeBitStream($version)
1263
- {
1264
- try {
1265
-
1266
- unset($this->bstream);
1267
- $words = QRspec::maximumWords($this->mode, $version);
1268
-
1269
- if($this->size > $words) {
1270
-
1271
- $st1 = new QRinputItem($this->mode, $words, $this->data);
1272
- $st2 = new QRinputItem($this->mode, $this->size - $words, array_slice($this->data, $words));
1273
-
1274
- $st1->encodeBitStream($version);
1275
- $st2->encodeBitStream($version);
1276
-
1277
- $this->bstream = new QRbitstream();
1278
- $this->bstream->append($st1->bstream);
1279
- $this->bstream->append($st2->bstream);
1280
-
1281
- unset($st1);
1282
- unset($st2);
1283
-
1284
- } else {
1285
-
1286
- $ret = 0;
1287
-
1288
- switch($this->mode) {
1289
- case QR_MODE_NUM: $ret = $this->encodeModeNum($version); break;
1290
- case QR_MODE_AN: $ret = $this->encodeModeAn($version); break;
1291
- case QR_MODE_8: $ret = $this->encodeMode8($version); break;
1292
- case QR_MODE_KANJI: $ret = $this->encodeModeKanji($version);break;
1293
- case QR_MODE_STRUCTURE: $ret = $this->encodeModeStructure(); break;
1294
-
1295
- default:
1296
- break;
1297
- }
1298
-
1299
- if($ret < 0)
1300
- return -1;
1301
- }
1302
-
1303
- return $this->bstream->size();
1304
-
1305
- } catch (Exception $e) {
1306
- return -1;
1307
- }
1308
- }
1309
- };
1310
-
1311
- //##########################################################################
1312
-
1313
- class QRinput {
1314
-
1315
- public $items;
1316
-
1317
- private $version;
1318
- private $level;
1319
-
1320
- //----------------------------------------------------------------------
1321
- public function __construct($version = 0, $level = QR_ECLEVEL_L)
1322
- {
1323
- if ($version < 0 || $version > QRSPEC_VERSION_MAX || $level > QR_ECLEVEL_H) {
1324
- throw new Exception('Invalid version no');
1325
- return NULL;
1326
- }
1327
-
1328
- $this->version = $version;
1329
- $this->level = $level;
1330
- }
1331
-
1332
- //----------------------------------------------------------------------
1333
- public function getVersion()
1334
- {
1335
- return $this->version;
1336
- }
1337
-
1338
- //----------------------------------------------------------------------
1339
- public function setVersion($version)
1340
- {
1341
- if($version < 0 || $version > QRSPEC_VERSION_MAX) {
1342
- throw new Exception('Invalid version no');
1343
- return -1;
1344
- }
1345
-
1346
- $this->version = $version;
1347
-
1348
- return 0;
1349
- }
1350
-
1351
- //----------------------------------------------------------------------
1352
- public function getErrorCorrectionLevel()
1353
- {
1354
- return $this->level;
1355
- }
1356
-
1357
- //----------------------------------------------------------------------
1358
- public function setErrorCorrectionLevel($level)
1359
- {
1360
- if($level > QR_ECLEVEL_H) {
1361
- throw new Exception('Invalid ECLEVEL');
1362
- return -1;
1363
- }
1364
-
1365
- $this->level = $level;
1366
-
1367
- return 0;
1368
- }
1369
-
1370
- //----------------------------------------------------------------------
1371
- public function appendEntry(QRinputItem $entry)
1372
- {
1373
- $this->items[] = $entry;
1374
- }
1375
-
1376
- //----------------------------------------------------------------------
1377
- public function append($mode, $size, $data)
1378
- {
1379
- try {
1380
- $entry = new QRinputItem($mode, $size, $data);
1381
- $this->items[] = $entry;
1382
- return 0;
1383
- } catch (Exception $e) {
1384
- return -1;
1385
- }
1386
- }
1387
-
1388
- //----------------------------------------------------------------------
1389
-
1390
- public function insertStructuredAppendHeader($size, $index, $parity)
1391
- {
1392
- if( $size > MAX_STRUCTURED_SYMBOLS ) {
1393
- throw new Exception('insertStructuredAppendHeader wrong size');
1394
- }
1395
-
1396
- if( $index <= 0 || $index > MAX_STRUCTURED_SYMBOLS ) {
1397
- throw new Exception('insertStructuredAppendHeader wrong index');
1398
- }
1399
-
1400
- $buf = array($size, $index, $parity);
1401
-
1402
- try {
1403
- $entry = new QRinputItem(QR_MODE_STRUCTURE, 3, buf);
1404
- array_unshift($this->items, $entry);
1405
- return 0;
1406
- } catch (Exception $e) {
1407
- return -1;
1408
- }
1409
- }
1410
-
1411
- //----------------------------------------------------------------------
1412
- public function calcParity()
1413
- {
1414
- $parity = 0;
1415
-
1416
- foreach($this->items as $item) {
1417
- if($item->mode != QR_MODE_STRUCTURE) {
1418
- for($i=$item->size-1; $i>=0; $i--) {
1419
- $parity ^= $item->data[$i];
1420
- }
1421
- }
1422
- }
1423
-
1424
- return $parity;
1425
- }
1426
-
1427
- //----------------------------------------------------------------------
1428
- public static function checkModeNum($size, $data)
1429
- {
1430
- for($i=0; $i<$size; $i++) {
1431
- if((ord($data[$i]) < ord('0')) || (ord($data[$i]) > ord('9'))){
1432
- return false;
1433
- }
1434
- }
1435
-
1436
- return true;
1437
- }
1438
-
1439
- //----------------------------------------------------------------------
1440
- public static function estimateBitsModeNum($size)
1441
- {
1442
- $w = (int)$size / 3;
1443
- $bits = $w * 10;
1444
-
1445
- switch($size - $w * 3) {
1446
- case 1:
1447
- $bits += 4;
1448
- break;
1449
- case 2:
1450
- $bits += 7;
1451
- break;
1452
- default:
1453
- break;
1454
- }
1455
-
1456
- return $bits;
1457
- }
1458
-
1459
- //----------------------------------------------------------------------
1460
- public static $anTable = array(
1461
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1462
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1463
- 36, -1, -1, -1, 37, 38, -1, -1, -1, -1, 39, 40, -1, 41, 42, 43,
1464
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 44, -1, -1, -1, -1, -1,
1465
- -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1466
- 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, -1, -1, -1, -1, -1,
1467
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1468
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
1469
- );
1470
-
1471
- //----------------------------------------------------------------------
1472
- public static function lookAnTable($c)
1473
- {
1474
- return (($c > 127)?-1:self::$anTable[$c]);
1475
- }
1476
-
1477
- //----------------------------------------------------------------------
1478
- public static function checkModeAn($size, $data)
1479
- {
1480
- for($i=0; $i<$size; $i++) {
1481
- if (self::lookAnTable(ord($data[$i])) == -1) {
1482
- return false;
1483
- }
1484
- }
1485
-
1486
- return true;
1487
- }
1488
-
1489
- //----------------------------------------------------------------------
1490
- public static function estimateBitsModeAn($size)
1491
- {
1492
- $w = (int)($size / 2);
1493
- $bits = $w * 11;
1494
-
1495
- if($size & 1) {
1496
- $bits += 6;
1497
- }
1498
-
1499
- return $bits;
1500
- }
1501
-
1502
- //----------------------------------------------------------------------
1503
- public static function estimateBitsMode8($size)
1504
- {
1505
- return $size * 8;
1506
- }
1507
-
1508
- //----------------------------------------------------------------------
1509
- public function estimateBitsModeKanji($size)
1510
- {
1511
- return (int)(($size / 2) * 13);
1512
- }
1513
-
1514
- //----------------------------------------------------------------------
1515
- public static function checkModeKanji($size, $data)
1516
- {
1517
- if($size & 1)
1518
- return false;
1519
-
1520
- for($i=0; $i<$size; $i+=2) {
1521
- $val = (ord($data[$i]) << 8) | ord($data[$i+1]);
1522
- if( $val < 0x8140
1523
- || ($val > 0x9ffc && $val < 0xe040)
1524
- || $val > 0xebbf) {
1525
- return false;
1526
- }
1527
- }
1528
-
1529
- return true;
1530
- }
1531
-
1532
- /***********************************************************************
1533
- * Validation
1534
- **********************************************************************/
1535
-
1536
- public static function check($mode, $size, $data)
1537
- {
1538
- if($size <= 0)
1539
- return false;
1540
-
1541
- switch($mode) {
1542
- case QR_MODE_NUM: return self::checkModeNum($size, $data); break;
1543
- case QR_MODE_AN: return self::checkModeAn($size, $data); break;
1544
- case QR_MODE_KANJI: return self::checkModeKanji($size, $data); break;
1545
- case QR_MODE_8: return true; break;
1546
- case QR_MODE_STRUCTURE: return true; break;
1547
-
1548
- default:
1549
- break;
1550
- }
1551
-
1552
- return false;
1553
- }
1554
-
1555
-
1556
- //----------------------------------------------------------------------
1557
- public function estimateBitStreamSize($version)
1558
- {
1559
- $bits = 0;
1560
-
1561
- foreach($this->items as $item) {
1562
- $bits += $item->estimateBitStreamSizeOfEntry($version);
1563
- }
1564
-
1565
- return $bits;
1566
- }
1567
-
1568
- //----------------------------------------------------------------------
1569
- public function estimateVersion()
1570
- {
1571
- $version = 0;
1572
- $prev = 0;
1573
- do {
1574
- $prev = $version;
1575
- $bits = $this->estimateBitStreamSize($prev);
1576
- $version = QRspec::getMinimumVersion((int)(($bits + 7) / 8), $this->level);
1577
- if ($version < 0) {
1578
- return -1;
1579
- }
1580
- } while ($version > $prev);
1581
-
1582
- return $version;
1583
- }
1584
-
1585
- //----------------------------------------------------------------------
1586
- public static function lengthOfCode($mode, $version, $bits)
1587
- {
1588
- $payload = $bits - 4 - QRspec::lengthIndicator($mode, $version);
1589
- switch($mode) {
1590
- case QR_MODE_NUM:
1591
- $chunks = (int)($payload / 10);
1592
- $remain = $payload - $chunks * 10;
1593
- $size = $chunks * 3;
1594
- if($remain >= 7) {
1595
- $size += 2;
1596
- } else if($remain >= 4) {
1597
- $size += 1;
1598
- }
1599
- break;
1600
- case QR_MODE_AN:
1601
- $chunks = (int)($payload / 11);
1602
- $remain = $payload - $chunks * 11;
1603
- $size = $chunks * 2;
1604
- if($remain >= 6)
1605
- $size++;
1606
- break;
1607
- case QR_MODE_8:
1608
- $size = (int)($payload / 8);
1609
- break;
1610
- case QR_MODE_KANJI:
1611
- $size = (int)(($payload / 13) * 2);
1612
- break;
1613
- case QR_MODE_STRUCTURE:
1614
- $size = (int)($payload / 8);
1615
- break;
1616
- default:
1617
- $size = 0;
1618
- break;
1619
- }
1620
-
1621
- $maxsize = QRspec::maximumWords($mode, $version);
1622
- if($size < 0) $size = 0;
1623
- if($size > $maxsize) $size = $maxsize;
1624
-
1625
- return $size;
1626
- }
1627
-
1628
- //----------------------------------------------------------------------
1629
- public function createBitStream()
1630
- {
1631
- $total = 0;
1632
-
1633
- foreach($this->items as $item) {
1634
- $bits = $item->encodeBitStream($this->version);
1635
-
1636
- if($bits < 0)
1637
- return -1;
1638
-
1639
- $total += $bits;
1640
- }
1641
-
1642
- return $total;
1643
- }
1644
-
1645
- //----------------------------------------------------------------------
1646
- public function convertData()
1647
- {
1648
- $ver = $this->estimateVersion();
1649
- if($ver > $this->getVersion()) {
1650
- $this->setVersion($ver);
1651
- }
1652
-
1653
- for(;;) {
1654
- $bits = $this->createBitStream();
1655
-
1656
- if($bits < 0)
1657
- return -1;
1658
-
1659
- $ver = QRspec::getMinimumVersion((int)(($bits + 7) / 8), $this->level);
1660
- if($ver < 0) {
1661
- throw new Exception('WRONG VERSION');
1662
- return -1;
1663
- } else if($ver > $this->getVersion()) {
1664
- $this->setVersion($ver);
1665
- } else {
1666
- break;
1667
- }
1668
- }
1669
-
1670
- return 0;
1671
- }
1672
-
1673
- //----------------------------------------------------------------------
1674
- public function appendPaddingBit(&$bstream)
1675
- {
1676
- $bits = $bstream->size();
1677
- $maxwords = QRspec::getDataLength($this->version, $this->level);
1678
- $maxbits = $maxwords * 8;
1679
-
1680
- if ($maxbits == $bits) {
1681
- return 0;
1682
- }
1683
-
1684
- if ($maxbits - $bits < 5) {
1685
- return $bstream->appendNum($maxbits - $bits, 0);
1686
- }
1687
-
1688
- $bits += 4;
1689
- $words = (int)(($bits + 7) / 8);
1690
-
1691
- $padding = new QRbitstream();
1692
- $ret = $padding->appendNum($words * 8 - $bits + 4, 0);
1693
-
1694
- if($ret < 0)
1695
- return $ret;
1696
-
1697
- $padlen = $maxwords - $words;
1698
-
1699
- if($padlen > 0) {
1700
-
1701
- $padbuf = array();
1702
- for($i=0; $i<$padlen; $i++) {
1703
- $padbuf[$i] = ($i&1)?0x11:0xec;
1704
- }
1705
-
1706
- $ret = $padding->appendBytes($padlen, $padbuf);
1707
-
1708
- if($ret < 0)
1709
- return $ret;
1710
-
1711
- }
1712
-
1713
- $ret = $bstream->append($padding);
1714
-
1715
- return $ret;
1716
- }
1717
-
1718
- //----------------------------------------------------------------------
1719
- public function mergeBitStream()
1720
- {
1721
- if($this->convertData() < 0) {
1722
- return null;
1723
- }
1724
-
1725
- $bstream = new QRbitstream();
1726
-
1727
- foreach($this->items as $item) {
1728
- $ret = $bstream->append($item->bstream);
1729
- if($ret < 0) {
1730
- return null;
1731
- }
1732
- }
1733
-
1734
- return $bstream;
1735
- }
1736
-
1737
- //----------------------------------------------------------------------
1738
- public function getBitStream()
1739
- {
1740
-
1741
- $bstream = $this->mergeBitStream();
1742
-
1743
- if($bstream == null) {
1744
- return null;
1745
- }
1746
-
1747
- $ret = $this->appendPaddingBit($bstream);
1748
- if($ret < 0) {
1749
- return null;
1750
- }
1751
-
1752
- return $bstream;
1753
- }
1754
-
1755
- //----------------------------------------------------------------------
1756
- public function getByteStream()
1757
- {
1758
- $bstream = $this->getBitStream();
1759
- if($bstream == null) {
1760
- return null;
1761
- }
1762
-
1763
- return $bstream->toByte();
1764
- }
1765
- }
1766
-
1767
-
1768
-
1769
-
1770
-
1771
-
1772
- //---- qrbitstream.php -----------------------------
1773
-
1774
-
1775
-
1776
-
1777
- /*
1778
- * PHP QR Code encoder
1779
- *
1780
- * Bitstream class
1781
- *
1782
- * Based on libqrencode C library distributed under LGPL 2.1
1783
- * Copyright (C) 2006, 2007, 2008, 2009 Kentaro Fukuchi <fukuchi@megaui.net>
1784
- *
1785
- * PHP QR Code is distributed under LGPL 3
1786
- * Copyright (C) 2010 Dominik Dzienia <deltalab at poczta dot fm>
1787
- *
1788
- * This library is free software; you can redistribute it and/or
1789
- * modify it under the terms of the GNU Lesser General Public
1790
- * License as published by the Free Software Foundation; either
1791
- * version 3 of the License, or any later version.
1792
- *
1793
- * This library is distributed in the hope that it will be useful,
1794
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1795
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1796
- * Lesser General Public License for more details.
1797
- *
1798
- * You should have received a copy of the GNU Lesser General Public
1799
- * License along with this library; if not, write to the Free Software
1800
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
1801
- */
1802
-
1803
- class QRbitstream {
1804
-
1805
- public $data = array();
1806
-
1807
- //----------------------------------------------------------------------
1808
- public function size()
1809
- {
1810
- return count($this->data);
1811
- }
1812
-
1813
- //----------------------------------------------------------------------
1814
- public function allocate($setLength)
1815
- {
1816
- $this->data = array_fill(0, $setLength, 0);
1817
- return 0;
1818
- }
1819
-
1820
- //----------------------------------------------------------------------
1821
- public static function newFromNum($bits, $num)
1822
- {
1823
- $bstream = new QRbitstream();
1824
- $bstream->allocate($bits);
1825
-
1826
- $mask = 1 << ($bits - 1);
1827
- for($i=0; $i<$bits; $i++) {
1828
- if($num & $mask) {
1829
- $bstream->data[$i] = 1;
1830
- } else {
1831
- $bstream->data[$i] = 0;
1832
- }
1833
- $mask = $mask >> 1;
1834
- }
1835
-
1836
- return $bstream;
1837
- }
1838
-
1839
- //----------------------------------------------------------------------
1840
- public static function newFromBytes($size, $data)
1841
- {
1842
- $bstream = new QRbitstream();
1843
- $bstream->allocate($size * 8);
1844
- $p=0;
1845
-
1846
- for($i=0; $i<$size; $i++) {
1847
- $mask = 0x80;
1848
- for($j=0; $j<8; $j++) {
1849
- if($data[$i] & $mask) {
1850
- $bstream->data[$p] = 1;
1851
- } else {
1852
- $bstream->data[$p] = 0;
1853
- }
1854
- $p++;
1855
- $mask = $mask >> 1;
1856
- }
1857
- }
1858
-
1859
- return $bstream;
1860
- }
1861
-
1862
- //----------------------------------------------------------------------
1863
- public function append(QRbitstream $arg)
1864
- {
1865
- if (is_null($arg)) {
1866
- return -1;
1867
- }
1868
-
1869
- if($arg->size() == 0) {
1870
- return 0;
1871
- }
1872
-
1873
- if($this->size() == 0) {
1874
- $this->data = $arg->data;
1875
- return 0;
1876
- }
1877
-
1878
- $this->data = array_values(array_merge($this->data, $arg->data));
1879
-
1880
- return 0;
1881
- }
1882
-
1883
- //----------------------------------------------------------------------
1884
- public function appendNum($bits, $num)
1885
- {
1886
- if ($bits == 0)
1887
- return 0;
1888
-
1889
- $b = QRbitstream::newFromNum($bits, $num);
1890
-
1891
- if(is_null($b))
1892
- return -1;
1893
-
1894
- $ret = $this->append($b);
1895
- unset($b);
1896
-
1897
- return $ret;
1898
- }
1899
-
1900
- //----------------------------------------------------------------------
1901
- public function appendBytes($size, $data)
1902
- {
1903
- if ($size == 0)
1904
- return 0;
1905
-
1906
- $b = QRbitstream::newFromBytes($size, $data);
1907
-
1908
- if(is_null($b))
1909
- return -1;
1910
-
1911
- $ret = $this->append($b);
1912
- unset($b);
1913
-
1914
- return $ret;
1915
- }
1916
-
1917
- //----------------------------------------------------------------------
1918
- public function toByte()
1919
- {
1920
-
1921
- $size = $this->size();
1922
-
1923
- if($size == 0) {
1924
- return array();
1925
- }
1926
-
1927
- $data = array_fill(0, (int)(($size + 7) / 8), 0);
1928
- $bytes = (int)($size / 8);
1929
-
1930
- $p = 0;
1931
-
1932
- for($i=0; $i<$bytes; $i++) {
1933
- $v = 0;
1934
- for($j=0; $j<8; $j++) {
1935
- $v = $v << 1;
1936
- $v |= $this->data[$p];
1937
- $p++;
1938
- }
1939
- $data[$i] = $v;
1940
- }
1941
-
1942
- if($size & 7) {
1943
- $v = 0;
1944
- for($j=0; $j<($size & 7); $j++) {
1945
- $v = $v << 1;
1946
- $v |= $this->data[$p];
1947
- $p++;
1948
- }
1949
- $data[$bytes] = $v;
1950
- }
1951
-
1952
- return $data;
1953
- }
1954
-
1955
- }
1956
-
1957
-
1958
-
1959
-
1960
- //---- qrsplit.php -----------------------------
1961
-
1962
-
1963
-
1964
-
1965
- /*
1966
- * PHP QR Code encoder
1967
- *
1968
- * Input splitting classes
1969
- *
1970
- * Based on libqrencode C library distributed under LGPL 2.1
1971
- * Copyright (C) 2006, 2007, 2008, 2009 Kentaro Fukuchi <fukuchi@megaui.net>
1972
- *
1973
- * PHP QR Code is distributed under LGPL 3
1974
- * Copyright (C) 2010 Dominik Dzienia <deltalab at poczta dot fm>
1975
- *
1976
- * The following data / specifications are taken from
1977
- * "Two dimensional symbol -- QR-code -- Basic Specification" (JIS X0510:2004)
1978
- * or
1979
- * "Automatic identification and data capture techniques --
1980
- * QR Code 2005 bar code symbology specification" (ISO/IEC 18004:2006)
1981
- *
1982
- * This library is free software; you can redistribute it and/or
1983
- * modify it under the terms of the GNU Lesser General Public
1984
- * License as published by the Free Software Foundation; either
1985
- * version 3 of the License, or any later version.
1986
- *
1987
- * This library is distributed in the hope that it will be useful,
1988
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1989
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1990
- * Lesser General Public License for more details.
1991
- *
1992
- * You should have received a copy of the GNU Lesser General Public
1993
- * License along with this library; if not, write to the Free Software
1994
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
1995
- */
1996
- class QRsplit {
1997
-
1998
- public $dataStr = '';
1999
- public $input;
2000
- public $modeHint;
2001
-
2002
- //----------------------------------------------------------------------
2003
- public function __construct($dataStr, $input, $modeHint)
2004
- {
2005
- $this->dataStr = $dataStr;
2006
- $this->input = $input;
2007
- $this->modeHint = $modeHint;
2008
- }
2009
-
2010
- //----------------------------------------------------------------------
2011
- public static function isdigitat($str, $pos)
2012
- {
2013
- if ($pos >= strlen($str))
2014
- return false;
2015
-
2016
- return ((ord($str[$pos]) >= ord('0'))&&(ord($str[$pos]) <= ord('9')));
2017
- }
2018
-
2019
- //----------------------------------------------------------------------
2020
- public static function isalnumat($str, $pos)
2021
- {
2022
- if ($pos >= strlen($str))
2023
- return false;
2024
-
2025
- return (QRinput::lookAnTable(ord($str[$pos])) >= 0);
2026
- }
2027
-
2028
- //----------------------------------------------------------------------
2029
- public function identifyMode($pos)
2030
- {
2031
- if ($pos >= strlen($this->dataStr))
2032
- return QR_MODE_NUL;
2033
-
2034
- $c = $this->dataStr[$pos];
2035
-
2036
- if(self::isdigitat($this->dataStr, $pos)) {
2037
- return QR_MODE_NUM;
2038
- } else if(self::isalnumat($this->dataStr, $pos)) {
2039
- return QR_MODE_AN;
2040
- } else if($this->modeHint == QR_MODE_KANJI) {
2041
-
2042
- if ($pos+1 < strlen($this->dataStr))
2043
- {
2044
- $d = $this->dataStr[$pos+1];
2045
- $word = (ord($c) << 8) | ord($d);
2046
- if(($word >= 0x8140 && $word <= 0x9ffc) || ($word >= 0xe040 && $word <= 0xebbf)) {
2047
- return QR_MODE_KANJI;
2048
- }
2049
- }
2050
- }
2051
-
2052
- return QR_MODE_8;
2053
- }
2054
-
2055
- //----------------------------------------------------------------------
2056
- public function eatNum()
2057
- {
2058
- $ln = QRspec::lengthIndicator(QR_MODE_NUM, $this->input->getVersion());
2059
-
2060
- $p = 0;
2061
- while(self::isdigitat($this->dataStr, $p)) {
2062
- $p++;
2063
- }
2064
-
2065
- $run = $p;
2066
- $mode = $this->identifyMode($p);
2067
-
2068
- if($mode == QR_MODE_8) {
2069
- $dif = QRinput::estimateBitsModeNum($run) + 4 + $ln
2070
- + QRinput::estimateBitsMode8(1) // + 4 + l8
2071
- - QRinput::estimateBitsMode8($run + 1); // - 4 - l8
2072
- if($dif > 0) {
2073
- return $this->eat8();
2074
- }
2075
- }
2076
- if($mode == QR_MODE_AN) {
2077
- $dif = QRinput::estimateBitsModeNum($run) + 4 + $ln
2078
- + QRinput::estimateBitsModeAn(1) // + 4 + la
2079
- - QRinput::estimateBitsModeAn($run + 1);// - 4 - la
2080
- if($dif > 0) {
2081
- return $this->eatAn();
2082
- }
2083
- }
2084
-
2085
- $ret = $this->input->append(QR_MODE_NUM, $run, str_split($this->dataStr));
2086
- if($ret < 0)
2087
- return -1;
2088
-
2089
- return $run;
2090
- }
2091
-
2092
- //----------------------------------------------------------------------
2093
- public function eatAn()
2094
- {
2095
- $la = QRspec::lengthIndicator(QR_MODE_AN, $this->input->getVersion());
2096
- $ln = QRspec::lengthIndicator(QR_MODE_NUM, $this->input->getVersion());
2097
-
2098
- $p = 0;
2099
-
2100
- while(self::isalnumat($this->dataStr, $p)) {
2101
- if(self::isdigitat($this->dataStr, $p)) {
2102
- $q = $p;
2103
- while(self::isdigitat($this->dataStr, $q)) {
2104
- $q++;
2105
- }
2106
-
2107
- $dif = QRinput::estimateBitsModeAn($p) // + 4 + la
2108
- + QRinput::estimateBitsModeNum($q - $p) + 4 + $ln
2109
- - QRinput::estimateBitsModeAn($q); // - 4 - la
2110
-
2111
- if($dif < 0) {
2112
- break;
2113
- } else {
2114
- $p = $q;
2115
- }
2116
- } else {
2117
- $p++;
2118
- }
2119
- }
2120
-
2121
- $run = $p;
2122
-
2123
- if(!self::isalnumat($this->dataStr, $p)) {
2124
- $dif = QRinput::estimateBitsModeAn($run) + 4 + $la
2125
- + QRinput::estimateBitsMode8(1) // + 4 + l8
2126
- - QRinput::estimateBitsMode8($run + 1); // - 4 - l8
2127
- if($dif > 0) {
2128
- return $this->eat8();
2129
- }
2130
- }
2131
-
2132
- $ret = $this->input->append(QR_MODE_AN, $run, str_split($this->dataStr));
2133
- if($ret < 0)
2134
- return -1;
2135
-
2136
- return $run;
2137
- }
2138
-
2139
- //----------------------------------------------------------------------
2140
- public function eatKanji()
2141
- {
2142
- $p = 0;
2143
-
2144
- while($this->identifyMode($p) == QR_MODE_KANJI) {
2145
- $p += 2;
2146
- }
2147
-
2148
- $ret = $this->input->append(QR_MODE_KANJI, $p, str_split($this->dataStr));
2149
- if($ret < 0)
2150
- return -1;
2151
-
2152
- return $run;
2153
- }
2154
-
2155
- //----------------------------------------------------------------------
2156
- public function eat8()
2157
- {
2158
- $la = QRspec::lengthIndicator(QR_MODE_AN, $this->input->getVersion());
2159
- $ln = QRspec::lengthIndicator(QR_MODE_NUM, $this->input->getVersion());
2160
-
2161
- $p = 1;
2162
- $dataStrLen = strlen($this->dataStr);
2163
-
2164
- while($p < $dataStrLen) {
2165
-
2166
- $mode = $this->identifyMode($p);
2167
- if($mode == QR_MODE_KANJI) {
2168
- break;
2169
- }
2170
- if($mode == QR_MODE_NUM) {
2171
- $q = $p;
2172
- while(self::isdigitat($this->dataStr, $q)) {
2173
- $q++;
2174
- }
2175
- $dif = QRinput::estimateBitsMode8($p) // + 4 + l8
2176
- + QRinput::estimateBitsModeNum($q - $p) + 4 + $ln
2177
- - QRinput::estimateBitsMode8($q); // - 4 - l8
2178
- if($dif < 0) {
2179
- break;
2180
- } else {
2181
- $p = $q;
2182
- }
2183
- } else if($mode == QR_MODE_AN) {
2184
- $q = $p;
2185
- while(self::isalnumat($this->dataStr, $q)) {
2186
- $q++;
2187
- }
2188
- $dif = QRinput::estimateBitsMode8($p) // + 4 + l8
2189
- + QRinput::estimateBitsModeAn($q - $p) + 4 + $la
2190
- - QRinput::estimateBitsMode8($q); // - 4 - l8
2191
- if($dif < 0) {
2192
- break;
2193
- } else {
2194
- $p = $q;
2195
- }
2196
- } else {
2197
- $p++;
2198
- }
2199
- }
2200
-
2201
- $run = $p;
2202
- $ret = $this->input->append(QR_MODE_8, $run, str_split($this->dataStr));
2203
-
2204
- if($ret < 0)
2205
- return -1;
2206
-
2207
- return $run;
2208
- }
2209
-
2210
- //----------------------------------------------------------------------
2211
- public function splitString()
2212
- {
2213
- while (strlen($this->dataStr) > 0)
2214
- {
2215
- if($this->dataStr == '')
2216
- return 0;
2217
-
2218
- $mode = $this->identifyMode(0);
2219
-
2220
- switch ($mode) {
2221
- case QR_MODE_NUM: $length = $this->eatNum(); break;
2222
- case QR_MODE_AN: $length = $this->eatAn(); break;
2223
- case QR_MODE_KANJI:
2224
- if ($hint == QR_MODE_KANJI)
2225
- $length = $this->eatKanji();
2226
- else $length = $this->eat8();
2227
- break;
2228
- default: $length = $this->eat8(); break;
2229
-
2230
- }
2231
-
2232
- if($length == 0) return 0;
2233
- if($length < 0) return -1;
2234
-
2235
- $this->dataStr = substr($this->dataStr, $length);
2236
- }
2237
- }
2238
-
2239
- //----------------------------------------------------------------------
2240
- public function toUpper()
2241
- {
2242
- $stringLen = strlen($this->dataStr);
2243
- $p = 0;
2244
-
2245
- while ($p<$stringLen) {
2246
- $mode = self::identifyMode(substr($this->dataStr, $p), $this->modeHint);
2247
- if($mode == QR_MODE_KANJI) {
2248
- $p += 2;
2249
- } else {
2250
- if (ord($this->dataStr[$p]) >= ord('a') && ord($this->dataStr[$p]) <= ord('z')) {
2251
- $this->dataStr[$p] = chr(ord($this->dataStr[$p]) - 32);
2252
- }
2253
- $p++;
2254
- }
2255
- }
2256
-
2257
- return $this->dataStr;
2258
- }
2259
-
2260
- //----------------------------------------------------------------------
2261
- public static function splitStringToQRinput($string, QRinput $input, $modeHint, $casesensitive = true)
2262
- {
2263
- if(is_null($string) || $string == '\0' || $string == '') {
2264
- throw new Exception('empty string!!!');
2265
- }
2266
-
2267
- $split = new QRsplit($string, $input, $modeHint);
2268
-
2269
- if(!$casesensitive)
2270
- $split->toUpper();
2271
-
2272
- return $split->splitString();
2273
- }
2274
- }
2275
-
2276
-
2277
-
2278
- //---- qrrscode.php -----------------------------
2279
-
2280
-
2281
-
2282
-
2283
- /*
2284
- * PHP QR Code encoder
2285
- *
2286
- * Reed-Solomon error correction support
2287
- *
2288
- * Copyright (C) 2002, 2003, 2004, 2006 Phil Karn, KA9Q
2289
- * (libfec is released under the GNU Lesser General Public License.)
2290
- *
2291
- * Based on libqrencode C library distributed under LGPL 2.1
2292
- * Copyright (C) 2006, 2007, 2008, 2009 Kentaro Fukuchi <fukuchi@megaui.net>
2293
- *
2294
- * PHP QR Code is distributed under LGPL 3
2295
- * Copyright (C) 2010 Dominik Dzienia <deltalab at poczta dot fm>
2296
- *
2297
- * This library is free software; you can redistribute it and/or
2298
- * modify it under the terms of the GNU Lesser General Public
2299
- * License as published by the Free Software Foundation; either
2300
- * version 3 of the License, or any later version.
2301
- *
2302
- * This library is distributed in the hope that it will be useful,
2303
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
2304
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2305
- * Lesser General Public License for more details.
2306
- *
2307
- * You should have received a copy of the GNU Lesser General Public
2308
- * License along with this library; if not, write to the Free Software
2309
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
2310
- */
2311
-
2312
- class QRrsItem {
2313
-
2314
- public $mm; // Bits per symbol
2315
- public $nn; // Symbols per block (= (1<<mm)-1)
2316
- public $alpha_to = array(); // log lookup table
2317
- public $index_of = array(); // Antilog lookup table
2318
- public $genpoly = array(); // Generator polynomial
2319
- public $nroots; // Number of generator roots = number of parity symbols
2320
- public $fcr; // First consecutive root, index form
2321
- public $prim; // Primitive element, index form
2322
- public $iprim; // prim-th root of 1, index form
2323
- public $pad; // Padding bytes in shortened block
2324
- public $gfpoly;
2325
-
2326
- //----------------------------------------------------------------------
2327
- public function modnn($x)
2328
- {
2329
- while ($x >= $this->nn) {
2330
- $x -= $this->nn;
2331
- $x = ($x >> $this->mm) + ($x & $this->nn);
2332
- }
2333
-
2334
- return $x;
2335
- }
2336
-
2337
- //----------------------------------------------------------------------
2338
- public static function init_rs_char($symsize, $gfpoly, $fcr, $prim, $nroots, $pad)
2339
- {
2340
- // Common code for intializing a Reed-Solomon control block (char or int symbols)
2341
- // Copyright 2004 Phil Karn, KA9Q
2342
- // May be used under the terms of the GNU Lesser General Public License (LGPL)
2343
-
2344
- $rs = null;
2345
-
2346
- // Check parameter ranges
2347
- if($symsize < 0 || $symsize > 8) return $rs;
2348
- if($fcr < 0 || $fcr >= (1<<$symsize)) return $rs;
2349
- if($prim <= 0 || $prim >= (1<<$symsize)) return $rs;
2350
- if($nroots < 0 || $nroots >= (1<<$symsize)) return $rs; // Can't have more roots than symbol values!
2351
- if($pad < 0 || $pad >= ((1<<$symsize) -1 - $nroots)) return $rs; // Too much padding
2352
-
2353
- $rs = new QRrsItem();
2354
- $rs->mm = $symsize;
2355
- $rs->nn = (1<<$symsize)-1;
2356
- $rs->pad = $pad;
2357
-
2358
- $rs->alpha_to = array_fill(0, $rs->nn+1, 0);
2359
- $rs->index_of = array_fill(0, $rs->nn+1, 0);
2360
-
2361
- // PHP style macro replacement ;)
2362
- $NN =& $rs->nn;
2363
- $A0 =& $NN;
2364
-
2365
- // Generate Galois field lookup tables
2366
- $rs->index_of[0] = $A0; // log(zero) = -inf
2367
- $rs->alpha_to[$A0] = 0; // alpha**-inf = 0
2368
- $sr = 1;
2369
-
2370
- for($i=0; $i<$rs->nn; $i++) {
2371
- $rs->index_of[$sr] = $i;
2372
- $rs->alpha_to[$i] = $sr;
2373
- $sr <<= 1;
2374
- if($sr & (1<<$symsize)) {
2375
- $sr ^= $gfpoly;
2376
- }
2377
- $sr &= $rs->nn;
2378
- }
2379
-
2380
- if($sr != 1){
2381
- // field generator polynomial is not primitive!
2382
- $rs = NULL;
2383
- return $rs;
2384
- }
2385
-
2386
- /* Form RS code generator polynomial from its roots */
2387
- $rs->genpoly = array_fill(0, $nroots+1, 0);
2388
-
2389
- $rs->fcr = $fcr;
2390
- $rs->prim = $prim;
2391
- $rs->nroots = $nroots;
2392
- $rs->gfpoly = $gfpoly;
2393
-
2394
- /* Find prim-th root of 1, used in decoding */
2395
- for($iprim=1;($iprim % $prim) != 0;$iprim += $rs->nn)
2396
- ; // intentional empty-body loop!
2397
-
2398
- $rs->iprim = (int)($iprim / $prim);
2399
- $rs->genpoly[0] = 1;
2400
-
2401
- for ($i = 0,$root=$fcr*$prim; $i < $nroots; $i++, $root += $prim) {
2402
- $rs->genpoly[$i+1] = 1;
2403
-
2404
- // Multiply rs->genpoly[] by @**(root + x)
2405
- for ($j = $i; $j > 0; $j--) {
2406
- if ($rs->genpoly[$j] != 0) {
2407
- $rs->genpoly[$j] = $rs->genpoly[$j-1] ^ $rs->alpha_to[$rs->modnn($rs->index_of[$rs->genpoly[$j]] + $root)];
2408
- } else {
2409
- $rs->genpoly[$j] = $rs->genpoly[$j-1];
2410
- }
2411
- }
2412
- // rs->genpoly[0] can never be zero
2413
- $rs->genpoly[0] = $rs->alpha_to[$rs->modnn($rs->index_of[$rs->genpoly[0]] + $root)];
2414
- }
2415
-
2416
- // convert rs->genpoly[] to index form for quicker encoding
2417
- for ($i = 0; $i <= $nroots; $i++)
2418
- $rs->genpoly[$i] = $rs->index_of[$rs->genpoly[$i]];
2419
-
2420
- return $rs;
2421
- }
2422
-
2423
- //----------------------------------------------------------------------
2424
- public function encode_rs_char($data, &$parity)
2425
- {
2426
- $MM =& $this->mm;
2427
- $NN =& $this->nn;
2428
- $ALPHA_TO =& $this->alpha_to;
2429
- $INDEX_OF =& $this->index_of;
2430
- $GENPOLY =& $this->genpoly;
2431
- $NROOTS =& $this->nroots;
2432
- $FCR =& $this->fcr;
2433
- $PRIM =& $this->prim;
2434
- $IPRIM =& $this->iprim;
2435
- $PAD =& $this->pad;
2436
- $A0 =& $NN;
2437
-
2438
- $parity = array_fill(0, $NROOTS, 0);
2439
-
2440
- for($i=0; $i< ($NN-$NROOTS-$PAD); $i++) {
2441
-
2442
- $feedback = $INDEX_OF[$data[$i] ^ $parity[0]];
2443
- if($feedback != $A0) {
2444
- // feedback term is non-zero
2445
-
2446
- // This line is unnecessary when GENPOLY[NROOTS] is unity, as it must
2447
- // always be for the polynomials constructed by init_rs()
2448
- $feedback = $this->modnn($NN - $GENPOLY[$NROOTS] + $feedback);
2449
-
2450
- for($j=1;$j<$NROOTS;$j++) {
2451
- $parity[$j] ^= $ALPHA_TO[$this->modnn($feedback + $GENPOLY[$NROOTS-$j])];
2452
- }
2453
- }
2454
-
2455
- // Shift
2456
- array_shift($parity);
2457
- if($feedback != $A0) {
2458
- array_push($parity, $ALPHA_TO[$this->modnn($feedback + $GENPOLY[0])]);
2459
- } else {
2460
- array_push($parity, 0);
2461
- }
2462
- }
2463
- }
2464
- }
2465
-
2466
- //##########################################################################
2467
-
2468
- class QRrs {
2469
-
2470
- public static $items = array();
2471
-
2472
- //----------------------------------------------------------------------
2473
- public static function init_rs($symsize, $gfpoly, $fcr, $prim, $nroots, $pad)
2474
- {
2475
- foreach(self::$items as $rs) {
2476
- if($rs->pad != $pad) continue;
2477
- if($rs->nroots != $nroots) continue;
2478
- if($rs->mm != $symsize) continue;
2479
- if($rs->gfpoly != $gfpoly) continue;
2480
- if($rs->fcr != $fcr) continue;
2481
- if($rs->prim != $prim) continue;
2482
-
2483
- return $rs;
2484
- }
2485
-
2486
- $rs = QRrsItem::init_rs_char($symsize, $gfpoly, $fcr, $prim, $nroots, $pad);
2487
- array_unshift(self::$items, $rs);
2488
-
2489
- return $rs;
2490
- }
2491
- }
2492
-
2493
-
2494
-
2495
- //---- qrmask.php -----------------------------
2496
-
2497
-
2498
-
2499
-
2500
- /*
2501
- * PHP QR Code encoder
2502
- *
2503
- * Masking
2504
- *
2505
- * Based on libqrencode C library distributed under LGPL 2.1
2506
- * Copyright (C) 2006, 2007, 2008, 2009 Kentaro Fukuchi <fukuchi@megaui.net>
2507
- *
2508
- * PHP QR Code is distributed under LGPL 3
2509
- * Copyright (C) 2010 Dominik Dzienia <deltalab at poczta dot fm>
2510
- *
2511
- * This library is free software; you can redistribute it and/or
2512
- * modify it under the terms of the GNU Lesser General Public
2513
- * License as published by the Free Software Foundation; either
2514
- * version 3 of the License, or any later version.
2515
- *
2516
- * This library is distributed in the hope that it will be useful,
2517
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
2518
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2519
- * Lesser General Public License for more details.
2520
- *
2521
- * You should have received a copy of the GNU Lesser General Public
2522
- * License along with this library; if not, write to the Free Software
2523
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
2524
- */
2525
-
2526
- define('N1', 3);
2527
- define('N2', 3);
2528
- define('N3', 40);
2529
- define('N4', 10);
2530
-
2531
- class QRmask {
2532
-
2533
- public $runLength = array();
2534
-
2535
- //----------------------------------------------------------------------
2536
- public function __construct()
2537
- {
2538
- $this->runLength = array_fill(0, QRSPEC_WIDTH_MAX + 1, 0);
2539
- }
2540
-
2541
- //----------------------------------------------------------------------
2542
- public function writeFormatInformation($width, &$frame, $mask, $level)
2543
- {
2544
- $blacks = 0;
2545
- $format = QRspec::getFormatInfo($mask, $level);
2546
-
2547
- for($i=0; $i<8; $i++) {
2548
- if($format & 1) {
2549
- $blacks += 2;
2550
- $v = 0x85;
2551
- } else {
2552
- $v = 0x84;
2553
- }
2554
-
2555
- $frame[8][$width - 1 - $i] = chr($v);
2556
- if($i < 6) {
2557
- $frame[$i][8] = chr($v);
2558
- } else {
2559
- $frame[$i + 1][8] = chr($v);
2560
- }
2561
- $format = $format >> 1;
2562
- }
2563
-
2564
- for($i=0; $i<7; $i++) {
2565
- if($format & 1) {
2566
- $blacks += 2;
2567
- $v = 0x85;
2568
- } else {
2569
- $v = 0x84;
2570
- }
2571
-
2572
- $frame[$width - 7 + $i][8] = chr($v);
2573
- if($i == 0) {
2574
- $frame[8][7] = chr($v);
2575
- } else {
2576
- $frame[8][6 - $i] = chr($v);
2577
- }
2578
-
2579
- $format = $format >> 1;
2580
- }
2581
-
2582
- return $blacks;
2583
- }
2584
-
2585
- //----------------------------------------------------------------------
2586
- public function mask0($x, $y) { return ($x+$y)&1; }
2587
- public function mask1($x, $y) { return ($y&1); }
2588
- public function mask2($x, $y) { return ($x%3); }
2589
- public function mask3($x, $y) { return ($x+$y)%3; }
2590
- public function mask4($x, $y) { return (((int)($y/2))+((int)($x/3)))&1; }
2591
- public function mask5($x, $y) { return (($x*$y)&1)+($x*$y)%3; }
2592
- public function mask6($x, $y) { return ((($x*$y)&1)+($x*$y)%3)&1; }
2593
- public function mask7($x, $y) { return ((($x*$y)%3)+(($x+$y)&1))&1; }
2594
-
2595
- //----------------------------------------------------------------------
2596
- private function generateMaskNo($maskNo, $width, $frame)
2597
- {
2598
- $bitMask = array_fill(0, $width, array_fill(0, $width, 0));
2599
-
2600
- for($y=0; $y<$width; $y++) {
2601
- for($x=0; $x<$width; $x++) {
2602
- if(ord($frame[$y][$x]) & 0x80) {
2603
- $bitMask[$y][$x] = 0;
2604
- } else {
2605
- $maskFunc = call_user_func(array($this, 'mask'.$maskNo), $x, $y);
2606
- $bitMask[$y][$x] = ($maskFunc == 0)?1:0;
2607
- }
2608
-
2609
- }
2610
- }
2611
-
2612
- return $bitMask;
2613
- }
2614
-
2615
- //----------------------------------------------------------------------
2616
- public static function serial($bitFrame)
2617
- {
2618
- $codeArr = array();
2619
-
2620
- foreach ($bitFrame as $line)
2621
- $codeArr[] = join('', $line);
2622
-
2623
- return gzcompress(join("\n", $codeArr), 9);
2624
- }
2625
-
2626
- //----------------------------------------------------------------------
2627
- public static function unserial($code)
2628
- {
2629
- $codeArr = array();
2630
-
2631
- $codeLines = explode("\n", gzuncompress($code));
2632
- foreach ($codeLines as $line)
2633
- $codeArr[] = str_split($line);
2634
-
2635
- return $codeArr;
2636
- }
2637
-
2638
- //----------------------------------------------------------------------
2639
- public function makeMaskNo($maskNo, $width, $s, &$d, $maskGenOnly = false)
2640
- {
2641
- $b = 0;
2642
- $bitMask = array();
2643
-
2644
- $fileName = QR_CACHE_DIR.'mask_'.$maskNo.DIRECTORY_SEPARATOR.'mask_'.$width.'_'.$maskNo.'.dat';
2645
-
2646
- if (QR_CACHEABLE) {
2647
- if (file_exists($fileName)) {
2648
- $bitMask = self::unserial(file_get_contents($fileName));
2649
- } else {
2650
- $bitMask = $this->generateMaskNo($maskNo, $width, $s, $d);
2651
- if (!file_exists(QR_CACHE_DIR.'mask_'.$maskNo))
2652
- mkdir(QR_CACHE_DIR.'mask_'.$maskNo);
2653
- file_put_contents($fileName, self::serial($bitMask));
2654
- }
2655
- } else {
2656
- $bitMask = $this->generateMaskNo($maskNo, $width, $s, $d);
2657
- }
2658
-
2659
- if ($maskGenOnly)
2660
- return;
2661
-
2662
- $d = $s;
2663
-
2664
- for($y=0; $y<$width; $y++) {
2665
- for($x=0; $x<$width; $x++) {
2666
- if($bitMask[$y][$x] == 1) {
2667
- $d[$y][$x] = chr(ord($s[$y][$x]) ^ (int)$bitMask[$y][$x]);
2668
- }
2669
- $b += (int)(ord($d[$y][$x]) & 1);
2670
- }
2671
- }
2672
-
2673
- return $b;
2674
- }
2675
-
2676
- //----------------------------------------------------------------------
2677
- public function makeMask($width, $frame, $maskNo, $level)
2678
- {
2679
- $masked = array_fill(0, $width, str_repeat("\0", $width));
2680
- $this->makeMaskNo($maskNo, $width, $frame, $masked);
2681
- $this->writeFormatInformation($width, $masked, $maskNo, $level);
2682
-
2683
- return $masked;
2684
- }
2685
-
2686
- //----------------------------------------------------------------------
2687
- public function calcN1N3($length)
2688
- {
2689
- $demerit = 0;
2690
-
2691
- for($i=0; $i<$length; $i++) {
2692
-
2693
- if($this->runLength[$i] >= 5) {
2694
- $demerit += (N1 + ($this->runLength[$i] - 5));
2695
- }
2696
- if($i & 1) {
2697
- if(($i >= 3) && ($i < ($length-2)) && ($this->runLength[$i] % 3 == 0)) {
2698
- $fact = (int)($this->runLength[$i] / 3);
2699
- if(($this->runLength[$i-2] == $fact) &&
2700
- ($this->runLength[$i-1] == $fact) &&
2701
- ($this->runLength[$i+1] == $fact) &&
2702
- ($this->runLength[$i+2] == $fact)) {
2703
- if(($this->runLength[$i-3] < 0) || ($this->runLength[$i-3] >= (4 * $fact))) {
2704
- $demerit += N3;
2705
- } else if((($i+3) >= $length) || ($this->runLength[$i+3] >= (4 * $fact))) {
2706
- $demerit += N3;
2707
- }
2708
- }
2709
- }
2710
- }
2711
- }
2712
- return $demerit;
2713
- }
2714
-
2715
- //----------------------------------------------------------------------
2716
- public function evaluateSymbol($width, $frame)
2717
- {
2718
- $head = 0;
2719
- $demerit = 0;
2720
-
2721
- for($y=0; $y<$width; $y++) {
2722
- $head = 0;
2723
- $this->runLength[0] = 1;
2724
-
2725
- $frameY = $frame[$y];
2726
-
2727
- if ($y>0)
2728
- $frameYM = $frame[$y-1];
2729
-
2730
- for($x=0; $x<$width; $x++) {
2731
- if(($x > 0) && ($y > 0)) {
2732
- $b22 = ord($frameY[$x]) & ord($frameY[$x-1]) & ord($frameYM[$x]) & ord($frameYM[$x-1]);
2733
- $w22 = ord($frameY[$x]) | ord($frameY[$x-1]) | ord($frameYM[$x]) | ord($frameYM[$x-1]);
2734
-
2735
- if(($b22 | ($w22 ^ 1))&1) {
2736
- $demerit += N2;
2737
- }
2738
- }
2739
- if(($x == 0) && (ord($frameY[$x]) & 1)) {
2740
- $this->runLength[0] = -1;
2741
- $head = 1;
2742
- $this->runLength[$head] = 1;
2743
- } else if($x > 0) {
2744
- if((ord($frameY[$x]) ^ ord($frameY[$x-1])) & 1) {
2745
- $head++;
2746
- $this->runLength[$head] = 1;
2747
- } else {
2748
- $this->runLength[$head]++;
2749
- }
2750
- }
2751
- }
2752
-
2753
- $demerit += $this->calcN1N3($head+1);
2754
- }
2755
-
2756
- for($x=0; $x<$width; $x++) {
2757
- $head = 0;
2758
- $this->runLength[0] = 1;
2759
-
2760
- for($y=0; $y<$width; $y++) {
2761
- if($y == 0 && (ord($frame[$y][$x]) & 1)) {
2762
- $this->runLength[0] = -1;
2763
- $head = 1;
2764
- $this->runLength[$head] = 1;
2765
- } else if($y > 0) {
2766
- if((ord($frame[$y][$x]) ^ ord($frame[$y-1][$x])) & 1) {
2767
- $head++;
2768
- $this->runLength[$head] = 1;
2769
- } else {
2770
- $this->runLength[$head]++;
2771
- }
2772
- }
2773
- }
2774
-
2775
- $demerit += $this->calcN1N3($head+1);
2776
- }
2777
-
2778
- return $demerit;
2779
- }
2780
-
2781
-
2782
- //----------------------------------------------------------------------
2783
- public function mask($width, $frame, $level)
2784
- {
2785
- $minDemerit = PHP_INT_MAX;
2786
- $bestMaskNum = 0;
2787
- $bestMask = array();
2788
-
2789
- $checked_masks = array(0,1,2,3,4,5,6,7);
2790
-
2791
- if (QR_FIND_FROM_RANDOM !== false) {
2792
-
2793
- $howManuOut = 8-(QR_FIND_FROM_RANDOM % 9);
2794
- for ($i = 0; $i < $howManuOut; $i++) {
2795
- $remPos = rand (0, count($checked_masks)-1);
2796
- unset($checked_masks[$remPos]);
2797
- $checked_masks = array_values($checked_masks);
2798
- }
2799
-
2800
- }
2801
-
2802
- $bestMask = $frame;
2803
-
2804
- foreach($checked_masks as $i) {
2805
- $mask = array_fill(0, $width, str_repeat("\0", $width));
2806
-
2807
- $demerit = 0;
2808
- $blacks = 0;
2809
- $blacks = $this->makeMaskNo($i, $width, $frame, $mask);
2810
- $blacks += $this->writeFormatInformation($width, $mask, $i, $level);
2811
- $blacks = (int)(100 * $blacks / ($width * $width));
2812
- $demerit = (int)((int)(abs($blacks - 50) / 5) * N4);
2813
- $demerit += $this->evaluateSymbol($width, $mask);
2814
-
2815
- if($demerit < $minDemerit) {
2816
- $minDemerit = $demerit;
2817
- $bestMask = $mask;
2818
- $bestMaskNum = $i;
2819
- }
2820
- }
2821
-
2822
- return $bestMask;
2823
- }
2824
-
2825
- //----------------------------------------------------------------------
2826
- }
2827
-
2828
-
2829
-
2830
-
2831
- //---- qrencode.php -----------------------------
2832
-
2833
-
2834
-
2835
-
2836
- /*
2837
- * PHP QR Code encoder
2838
- *
2839
- * Main encoder classes.
2840
- *
2841
- * Based on libqrencode C library distributed under LGPL 2.1
2842
- * Copyright (C) 2006, 2007, 2008, 2009 Kentaro Fukuchi <fukuchi@megaui.net>
2843
- *
2844
- * PHP QR Code is distributed under LGPL 3
2845
- * Copyright (C) 2010 Dominik Dzienia <deltalab at poczta dot fm>
2846
- *
2847
- * This library is free software; you can redistribute it and/or
2848
- * modify it under the terms of the GNU Lesser General Public
2849
- * License as published by the Free Software Foundation; either
2850
- * version 3 of the License, or any later version.
2851
- *
2852
- * This library is distributed in the hope that it will be useful,
2853
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
2854
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2855
- * Lesser General Public License for more details.
2856
- *
2857
- * You should have received a copy of the GNU Lesser General Public
2858
- * License along with this library; if not, write to the Free Software
2859
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
2860
- */
2861
-
2862
- class QRrsblock {
2863
- public $dataLength;
2864
- public $data = array();
2865
- public $eccLength;
2866
- public $ecc = array();
2867
-
2868
- public function __construct($dl, $data, $el, &$ecc, QRrsItem $rs)
2869
- {
2870
- $rs->encode_rs_char($data, $ecc);
2871
-
2872
- $this->dataLength = $dl;
2873
- $this->data = $data;
2874
- $this->eccLength = $el;
2875
- $this->ecc = $ecc;
2876
- }
2877
- };
2878
-
2879
- //##########################################################################
2880
-
2881
- class QRrawcode {
2882
- public $version;
2883
- public $datacode = array();
2884
- public $ecccode = array();
2885
- public $blocks;
2886
- public $rsblocks = array(); //of RSblock
2887
- public $count;
2888
- public $dataLength;
2889
- public $eccLength;
2890
- public $b1;
2891
-
2892
- //----------------------------------------------------------------------
2893
- public function __construct(QRinput $input)
2894
- {
2895
- $spec = array(0,0,0,0,0);
2896
-
2897
- $this->datacode = $input->getByteStream();
2898
- if(is_null($this->datacode)) {
2899
- throw new Exception('null imput string');
2900
- }
2901
-
2902
- QRspec::getEccSpec($input->getVersion(), $input->getErrorCorrectionLevel(), $spec);
2903
-
2904
- $this->version = $input->getVersion();
2905
- $this->b1 = QRspec::rsBlockNum1($spec);
2906
- $this->dataLength = QRspec::rsDataLength($spec);
2907
- $this->eccLength = QRspec::rsEccLength($spec);
2908
- $this->ecccode = array_fill(0, $this->eccLength, 0);
2909
- $this->blocks = QRspec::rsBlockNum($spec);
2910
-
2911
- $ret = $this->init($spec);
2912
- if($ret < 0) {
2913
- throw new Exception('block alloc error');
2914
- return null;
2915
- }
2916
-
2917
- $this->count = 0;
2918
- }
2919
-
2920
- //----------------------------------------------------------------------
2921
- public function init(array $spec)
2922
- {
2923
- $dl = QRspec::rsDataCodes1($spec);
2924
- $el = QRspec::rsEccCodes1($spec);
2925
- $rs = QRrs::init_rs(8, 0x11d, 0, 1, $el, 255 - $dl - $el);
2926
-
2927
-
2928
- $blockNo = 0;
2929
- $dataPos = 0;
2930
- $eccPos = 0;
2931
- for($i=0; $i<QRspec::rsBlockNum1($spec); $i++) {
2932
- $ecc = array_slice($this->ecccode,$eccPos);
2933
- $this->rsblocks[$blockNo] = new QRrsblock($dl, array_slice($this->datacode, $dataPos), $el, $ecc, $rs);
2934
- $this->ecccode = array_merge(array_slice($this->ecccode,0, $eccPos), $ecc);
2935
-
2936
- $dataPos += $dl;
2937
- $eccPos += $el;
2938
- $blockNo++;
2939
- }
2940
-
2941
- if(QRspec::rsBlockNum2($spec) == 0)
2942
- return 0;
2943
-
2944
- $dl = QRspec::rsDataCodes2($spec);
2945
- $el = QRspec::rsEccCodes2($spec);
2946
- $rs = QRrs::init_rs(8, 0x11d, 0, 1, $el, 255 - $dl - $el);
2947
-
2948
- if($rs == NULL) return -1;
2949
-
2950
- for($i=0; $i<QRspec::rsBlockNum2($spec); $i++) {
2951
- $ecc = array_slice($this->ecccode,$eccPos);
2952
- $this->rsblocks[$blockNo] = new QRrsblock($dl, array_slice($this->datacode, $dataPos), $el, $ecc, $rs);
2953
- $this->ecccode = array_merge(array_slice($this->ecccode,0, $eccPos), $ecc);
2954
-
2955
- $dataPos += $dl;
2956
- $eccPos += $el;
2957
- $blockNo++;
2958
- }
2959
-
2960
- return 0;
2961
- }
2962
-
2963
- //----------------------------------------------------------------------
2964
- public function getCode()
2965
- {
2966
- $ret;
2967
-
2968
- if($this->count < $this->dataLength) {
2969
- $row = $this->count % $this->blocks;
2970
- $col = $this->count / $this->blocks;
2971
- if($col >= $this->rsblocks[0]->dataLength) {
2972
- $row += $this->b1;
2973
- }
2974
- $ret = $this->rsblocks[$row]->data[$col];
2975
- } else if($this->count < $this->dataLength + $this->eccLength) {
2976
- $row = ($this->count - $this->dataLength) % $this->blocks;
2977
- $col = ($this->count - $this->dataLength) / $this->blocks;
2978
- $ret = $this->rsblocks[$row]->ecc[$col];
2979
- } else {
2980
- return 0;
2981
- }
2982
- $this->count++;
2983
-
2984
- return $ret;
2985
- }
2986
- }
2987
-
2988
- //##########################################################################
2989
-
2990
- class QRcode {
2991
-
2992
- public $version;
2993
- public $width;
2994
- public $data;
2995
-
2996
- //----------------------------------------------------------------------
2997
- public function encodeMask(QRinput $input, $mask)
2998
- {
2999
- if($input->getVersion() < 0 || $input->getVersion() > QRSPEC_VERSION_MAX) {
3000
- throw new Exception('wrong version');
3001
- }
3002
- if($input->getErrorCorrectionLevel() > QR_ECLEVEL_H) {
3003
- throw new Exception('wrong level');
3004
- }
3005
-
3006
- $raw = new QRrawcode($input);
3007
-
3008
- QRtools::markTime('after_raw');
3009
-
3010
- $version = $raw->version;
3011
- $width = QRspec::getWidth($version);
3012
- $frame = QRspec::newFrame($version);
3013
-
3014
- $filler = new FrameFiller($width, $frame);
3015
- if(is_null($filler)) {
3016
- return NULL;
3017
- }
3018
-
3019
- // inteleaved data and ecc codes
3020
- for($i=0; $i<$raw->dataLength + $raw->eccLength; $i++) {
3021
- $code = $raw->getCode();
3022
- $bit = 0x80;
3023
- for($j=0; $j<8; $j++) {
3024
- $addr = $filler->next();
3025
- $filler->setFrameAt($addr, 0x02 | (($bit & $code) != 0));
3026
- $bit = $bit >> 1;
3027
- }
3028
- }
3029
-
3030
- QRtools::markTime('after_filler');
3031
-
3032
- unset($raw);
3033
-
3034
- // remainder bits
3035
- $j = QRspec::getRemainder($version);
3036
- for($i=0; $i<$j; $i++) {
3037
- $addr = $filler->next();
3038
- $filler->setFrameAt($addr, 0x02);
3039
- }
3040
-
3041
- $frame = $filler->frame;
3042
- unset($filler);
3043
-
3044
-
3045
- // masking
3046
- $maskObj = new QRmask();
3047
- if($mask < 0) {
3048
-
3049
- if (QR_FIND_BEST_MASK) {
3050
- $masked = $maskObj->mask($width, $frame, $input->getErrorCorrectionLevel());
3051
- } else {
3052
- $masked = $maskObj->makeMask($width, $frame, (intval(QR_DEFAULT_MASK) % 8), $input->getErrorCorrectionLevel());
3053
- }
3054
- } else {
3055
- $masked = $maskObj->makeMask($width, $frame, $mask, $input->getErrorCorrectionLevel());
3056
- }
3057
-
3058
- if($masked == NULL) {
3059
- return NULL;
3060
- }
3061
-
3062
- QRtools::markTime('after_mask');
3063
-
3064
- $this->version = $version;
3065
- $this->width = $width;
3066
- $this->data = $masked;
3067
-
3068
- return $this;
3069
- }
3070
-
3071
- //----------------------------------------------------------------------
3072
- public function encodeInput(QRinput $input)
3073
- {
3074
- return $this->encodeMask($input, -1);
3075
- }
3076
-
3077
- //----------------------------------------------------------------------
3078
- public function encodeString8bit($string, $version, $level)
3079
- {
3080
- if(string == NULL) {
3081
- throw new Exception('empty string!');
3082
- return NULL;
3083
- }
3084
-
3085
- $input = new QRinput($version, $level);
3086
- if($input == NULL) return NULL;
3087
-
3088
- $ret = $input->append($input, QR_MODE_8, strlen($string), str_split($string));
3089
- if($ret < 0) {
3090
- unset($input);
3091
- return NULL;
3092
- }
3093
- return $this->encodeInput($input);
3094
- }
3095
-
3096
- //----------------------------------------------------------------------
3097
- public function encodeString($string, $version, $level, $hint, $casesensitive)
3098
- {
3099
-
3100
- if($hint != QR_MODE_8 && $hint != QR_MODE_KANJI) {
3101
- throw new Exception('bad hint');
3102
- return NULL;
3103
- }
3104
-
3105
- $input = new QRinput($version, $level);
3106
- if($input == NULL) return NULL;
3107
-
3108
- $ret = QRsplit::splitStringToQRinput($string, $input, $hint, $casesensitive);
3109
- if($ret < 0) {
3110
- return NULL;
3111
- }
3112
-
3113
- return $this->encodeInput($input);
3114
- }
3115
-
3116
- //----------------------------------------------------------------------
3117
- public static function png($text, $outfile = false, $level = QR_ECLEVEL_L, $size = 3, $margin = 4, $saveandprint=false, $back_color = 0xFFFFFF, $fore_color = 0x000000)
3118
- {
3119
- $enc = QRencode::factory($level, $size, $margin, $back_color, $fore_color);
3120
- return $enc->encodePNG($text, $outfile, $saveandprint=false);
3121
- }
3122
-
3123
- //----------------------------------------------------------------------
3124
- public static function text($text, $outfile = false, $level = QR_ECLEVEL_L, $size = 3, $margin = 4)
3125
- {
3126
- $enc = QRencode::factory($level, $size, $margin);
3127
- return $enc->encode($text, $outfile);
3128
- }
3129
-
3130
- //----------------------------------------------------------------------
3131
- public static function eps($text, $outfile = false, $level = QR_ECLEVEL_L, $size = 3, $margin = 4, $saveandprint=false, $back_color = 0xFFFFFF, $fore_color = 0x000000)
3132
- {
3133
- $enc = QRencode::factory($level, $size, $margin, $back_color, $fore_color);
3134
- return $enc->encodeEPS($text, $outfile, $saveandprint=false);
3135
- }
3136
-
3137
- //----------------------------------------------------------------------
3138
- public static function svg($text, $outfile = false, $level = QR_ECLEVEL_L, $size = 3, $margin = 4, $saveandprint=false, $back_color = 0xFFFFFF, $fore_color = 0x000000)
3139
- {
3140
- $enc = QRencode::factory($level, $size, $margin, $back_color, $fore_color);
3141
- return $enc->encodeSVG($text, $outfile, $saveandprint=false);
3142
- }
3143
-
3144
- //----------------------------------------------------------------------
3145
- public static function raw($text, $outfile = false, $level = QR_ECLEVEL_L, $size = 3, $margin = 4)
3146
- {
3147
- $enc = QRencode::factory($level, $size, $margin);
3148
- return $enc->encodeRAW($text, $outfile);
3149
- }
3150
- }
3151
-
3152
- //##########################################################################
3153
-
3154
- class FrameFiller {
3155
-
3156
- public $width;
3157
- public $frame;
3158
- public $x;
3159
- public $y;
3160
- public $dir;
3161
- public $bit;
3162
-
3163
- //----------------------------------------------------------------------
3164
- public function __construct($width, &$frame)
3165
- {
3166
- $this->width = $width;
3167
- $this->frame = $frame;
3168
- $this->x = $width - 1;
3169
- $this->y = $width - 1;
3170
- $this->dir = -1;
3171
- $this->bit = -1;
3172
- }
3173
-
3174
- //----------------------------------------------------------------------
3175
- public function setFrameAt($at, $val)
3176
- {
3177
- $this->frame[$at['y']][$at['x']] = chr($val);
3178
- }
3179
-
3180
- //----------------------------------------------------------------------
3181
- public function getFrameAt($at)
3182
- {
3183
- return ord($this->frame[$at['y']][$at['x']]);
3184
- }
3185
-
3186
- //----------------------------------------------------------------------
3187
- public function next()
3188
- {
3189
- do {
3190
-
3191
- if($this->bit == -1) {
3192
- $this->bit = 0;
3193
- return array('x'=>$this->x, 'y'=>$this->y);
3194
- }
3195
-
3196
- $x = $this->x;
3197
- $y = $this->y;
3198
- $w = $this->width;
3199
-
3200
- if($this->bit == 0) {
3201
- $x--;
3202
- $this->bit++;
3203
- } else {
3204
- $x++;
3205
- $y += $this->dir;
3206
- $this->bit--;
3207
- }
3208
-
3209
- if($this->dir < 0) {
3210
- if($y < 0) {
3211
- $y = 0;
3212
- $x -= 2;
3213
- $this->dir = 1;
3214
- if($x == 6) {
3215
- $x--;
3216
- $y = 9;
3217
- }
3218
- }
3219
- } else {
3220
- if($y == $w) {
3221
- $y = $w - 1;
3222
- $x -= 2;
3223
- $this->dir = -1;
3224
- if($x == 6) {
3225
- $x--;
3226
- $y -= 8;
3227
- }
3228
- }
3229
- }
3230
- if($x < 0 || $y < 0) return null;
3231
-
3232
- $this->x = $x;
3233
- $this->y = $y;
3234
-
3235
- } while(ord($this->frame[$y][$x]) & 0x80);
3236
-
3237
- return array('x'=>$x, 'y'=>$y);
3238
- }
3239
-
3240
- } ;
3241
-
3242
- //##########################################################################
3243
-
3244
- class QRencode {
3245
-
3246
- public $casesensitive = true;
3247
- public $eightbit = false;
3248
-
3249
- public $version = 0;
3250
- public $size = 3;
3251
- public $margin = 4;
3252
- public $back_color = 0xFFFFFF;
3253
- public $fore_color = 0x000000;
3254
-
3255
- public $structured = 0; // not supported yet
3256
-
3257
- public $level = QR_ECLEVEL_L;
3258
- public $hint = QR_MODE_8;
3259
-
3260
- //----------------------------------------------------------------------
3261
- public static function factory($level = QR_ECLEVEL_L, $size = 3, $margin = 4, $back_color = 0xFFFFFF, $fore_color = 0x000000)
3262
- {
3263
- $enc = new QRencode();
3264
- $enc->size = $size;
3265
- $enc->margin = $margin;
3266
- $enc->fore_color = $fore_color;
3267
- $enc->back_color = $back_color;
3268
-
3269
- switch ($level.'') {
3270
- case '0':
3271
- case '1':
3272
- case '2':
3273
- case '3':
3274
- $enc->level = $level;
3275
- break;
3276
- case 'l':
3277
- case 'L':
3278
- $enc->level = QR_ECLEVEL_L;
3279
- break;
3280
- case 'm':
3281
- case 'M':
3282
- $enc->level = QR_ECLEVEL_M;
3283
- break;
3284
- case 'q':
3285
- case 'Q':
3286
- $enc->level = QR_ECLEVEL_Q;
3287
- break;
3288
- case 'h':
3289
- case 'H':
3290
- $enc->level = QR_ECLEVEL_H;
3291
- break;
3292
- }
3293
-
3294
- return $enc;
3295
- }
3296
-
3297
- //----------------------------------------------------------------------
3298
- public function encodeRAW($intext, $outfile = false)
3299
- {
3300
- $code = new QRcode();
3301
-
3302
- if($this->eightbit) {
3303
- $code->encodeString8bit($intext, $this->version, $this->level);
3304
- } else {
3305
- $code->encodeString($intext, $this->version, $this->level, $this->hint, $this->casesensitive);
3306
- }
3307
-
3308
- return $code->data;
3309
- }
3310
-
3311
- //----------------------------------------------------------------------
3312
- public function encode($intext, $outfile = false)
3313
- {
3314
- $code = new QRcode();
3315
-
3316
- if($this->eightbit) {
3317
- $code->encodeString8bit($intext, $this->version, $this->level);
3318
- } else {
3319
- $code->encodeString($intext, $this->version, $this->level, $this->hint, $this->casesensitive);
3320
- }
3321
-
3322
- QRtools::markTime('after_encode');
3323
-
3324
- if ($outfile!== false) {
3325
- file_put_contents($outfile, join("\n", QRtools::binarize($code->data)));
3326
- } else {
3327
- return QRtools::binarize($code->data);
3328
- }
3329
- }
3330
-
3331
- //----------------------------------------------------------------------
3332
- public function encodePNG($intext, $outfile = false,$saveandprint=false)
3333
- {
3334
- try {
3335
-
3336
- ob_start();
3337
- $tab = $this->encode($intext);
3338
- $err = ob_get_contents();
3339
- ob_end_clean();
3340
-
3341
- if ($err != '')
3342
- QRtools::log($outfile, $err);
3343
-
3344
- $maxSize = (int)(QR_PNG_MAXIMUM_SIZE / (count($tab)+2*$this->margin));
3345
-
3346
- QRimage::png($tab, $outfile, min(max(1, $this->size), $maxSize), $this->margin,$saveandprint, $this->back_color, $this->fore_color);
3347
-
3348
- } catch (Exception $e) {
3349
-
3350
- QRtools::log($outfile, $e->getMessage());
3351
-
3352
- }
3353
- }
3354
-
3355
- //----------------------------------------------------------------------
3356
- public function encodeEPS($intext, $outfile = false,$saveandprint=false)
3357
- {
3358
- try {
3359
-
3360
- ob_start();
3361
- $tab = $this->encode($intext);
3362
- $err = ob_get_contents();
3363
- ob_end_clean();
3364
-
3365
- if ($err != '')
3366
- QRtools::log($outfile, $err);
3367
-
3368
- $maxSize = (int)(QR_PNG_MAXIMUM_SIZE / (count($tab)+2*$this->margin));
3369
-
3370
- return QRvect::eps($tab, $outfile, min(max(1, $this->size), $maxSize), $this->margin,$saveandprint, $this->back_color, $this->fore_color);
3371
-
3372
- } catch (Exception $e) {
3373
-
3374
- QRtools::log($outfile, $e->getMessage());
3375
-
3376
- }
3377
- }
3378
-
3379
- //----------------------------------------------------------------------
3380
- public function encodeSVG($intext, $outfile = false,$saveandprint=false)
3381
- {
3382
- try {
3383
-
3384
- ob_start();
3385
- $tab = $this->encode($intext);
3386
- $err = ob_get_contents();
3387
- ob_end_clean();
3388
-
3389
- if ($err != '')
3390
- QRtools::log($outfile, $err);
3391
-
3392
- $maxSize = (int)(QR_PNG_MAXIMUM_SIZE / (count($tab)+2*$this->margin));
3393
-
3394
- return QRvect::svg($tab, $outfile, min(max(1, $this->size), $maxSize), $this->margin,$saveandprint, $this->back_color, $this->fore_color);
3395
-
3396
- } catch (Exception $e) {
3397
-
3398
- QRtools::log($outfile, $e->getMessage());
3399
-
3400
- }
3401
- }
3402
- }
3403
-
3404
-
3405
-
3406
-
3407
- //---- qrvect.php -----------------------------
3408
-
3409
-
3410
-
3411
-
3412
- /*
3413
- * PHP QR Code encoder
3414
- *
3415
- * Image output of code using GD2
3416
- *
3417
- * PHP QR Code is distributed under LGPL 3
3418
- * Copyright (C) 2010 Dominik Dzienia <deltalab at poczta dot fm>
3419
- *
3420
- * This library is free software; you can redistribute it and/or
3421
- * modify it under the terms of the GNU Lesser General Public
3422
- * License as published by the Free Software Foundation; either
3423
- * version 3 of the License, or any later version.
3424
- *
3425
- * This library is distributed in the hope that it will be useful,
3426
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
3427
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3428
- * Lesser General Public License for more details.
3429
- *
3430
- * You should have received a copy of the GNU Lesser General Public
3431
- * License along with this library; if not, write to the Free Software
3432
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
3433
- */
3434
-
3435
- define('QR_VECT', true);
3436
-
3437
- class QRvect {
3438
-
3439
- //----------------------------------------------------------------------
3440
- public static function eps($frame, $filename = false, $pixelPerPoint = 4, $outerFrame = 4,$saveandprint=FALSE, $back_color = 0xFFFFFF, $fore_color = 0x000000)
3441
- {
3442
- $vect = self::vectEPS($frame, $pixelPerPoint, $outerFrame, $back_color, $fore_color);
3443
-
3444
- if ($filename === false) {
3445
- header("Content-Type: application/postscript");
3446
- header('Content-Disposition: filename="qrcode.eps"');
3447
- return $vect;
3448
- } else {
3449
- if($saveandprint===TRUE){
3450
- QRtools::save($vect, $filename);
3451
- header("Content-Type: application/postscript");
3452
- header('Content-Disposition: filename="'.$filename.'"');
3453
- return $vect;
3454
- }else{
3455
- QRtools::save($vect, $filename);
3456
- }
3457
- }
3458
- }
3459
-
3460
-
3461
- //----------------------------------------------------------------------
3462
- private static function vectEPS($frame, $pixelPerPoint = 4, $outerFrame = 4, $back_color = 0xFFFFFF, $fore_color = 0x000000)
3463
- {
3464
- $h = count($frame);
3465
- $w = strlen($frame[0]);
3466
-
3467
- $imgW = $w + 2*$outerFrame;
3468
- $imgH = $h + 2*$outerFrame;
3469
-
3470
-
3471
-
3472
-
3473
- // convert a hexadecimal color code into decimal eps format (green = 0 1 0, blue = 0 0 1, ...)
3474
- $r = round((($fore_color & 0xFF0000) >> 16) / 255, 5);
3475
- $b = round((($fore_color & 0x00FF00) >> 8) / 255, 5);
3476
- $g = round(($fore_color & 0x0000FF) / 255, 5);
3477
- $fore_color = $r.' '.$b.' '.$g;
3478
-
3479
- // convert a hexadecimal color code into decimal eps format (green = 0 1 0, blue = 0 0 1, ...)
3480
- $r = round((($back_color & 0xFF0000) >> 16) / 255, 5);
3481
- $b = round((($back_color & 0x00FF00) >> 8) / 255, 5);
3482
- $g = round(($back_color & 0x0000FF) / 255, 5);
3483
- $back_color = $r.' '.$b.' '.$g;
3484
-
3485
- $output =
3486
- '%!PS-Adobe EPSF-3.0'."\n".
3487
- '%%Creator: Zend_Matrixcode_Qrcode'."\n".
3488
- '%%Title: QRcode'."\n".
3489
- '%%CreationDate: '.date('Y-m-d')."\n".
3490
- '%%DocumentData: Clean7Bit'."\n".
3491
- '%%LanguageLevel: 2'."\n".
3492
- '%%Pages: 1'."\n".
3493
- '%%BoundingBox: 0 0 '.$imgW * $pixelPerPoint.' '.$imgH * $pixelPerPoint."\n";
3494
-
3495
- // set the scale
3496
- $output .= $pixelPerPoint.' '.$pixelPerPoint.' scale'."\n";
3497
- // position the center of the coordinate system
3498
-
3499
- $output .= $outerFrame.' '.$outerFrame.' translate'."\n";
3500
-
3501
-
3502
-
3503
-
3504
- // redefine the 'rectfill' operator to shorten the syntax
3505
- $output .= '/F { rectfill } def'."\n";
3506
-
3507
- // set the symbol color
3508
- $output .= $back_color.' setrgbcolor'."\n";
3509
- $output .= '-'.$outerFrame.' -'.$outerFrame.' '.($w + 2*$outerFrame).' '.($h + 2*$outerFrame).' F'."\n";
3510
-
3511
-
3512
- // set the symbol color
3513
- $output .= $fore_color.' setrgbcolor'."\n";
3514
-
3515
- // Convert the matrix into pixels
3516
-
3517
- for($i=0; $i<$h; $i++) {
3518
- for($j=0; $j<$w; $j++) {
3519
- if( $frame[$i][$j] == '1') {
3520
- $y = $h - 1 - $i;
3521
- $x = $j;
3522
- $output .= $x.' '.$y.' 1 1 F'."\n";
3523
- }
3524
- }
3525
- }
3526
-
3527
-
3528
- $output .='%%EOF';
3529
-
3530
- return $output;
3531
- }
3532
-
3533
- //----------------------------------------------------------------------
3534
- public static function svg($frame, $filename = false, $pixelPerPoint = 4, $outerFrame = 4,$saveandprint=FALSE, $back_color, $fore_color)
3535
- {
3536
- $vect = self::vectSVG($frame, $pixelPerPoint, $outerFrame, $back_color, $fore_color);
3537
-
3538
- if ($filename === false) {
3539
- header("Content-Type: image/svg+xml");
3540
- header('Content-Disposition: filename="qrcode.svg"');
3541
- return $vect;
3542
- } else {
3543
- if($saveandprint===TRUE){
3544
- QRtools::save($vect, $filename);
3545
- header("Content-Type: image/svg+xml");
3546
- header('Content-Disposition: filename="'.$filename.'"');
3547
- return $vect;
3548
- }else{
3549
- QRtools::save($vect, $filename);
3550
- }
3551
- }
3552
- }
3553
-
3554
-
3555
- //----------------------------------------------------------------------
3556
- private static function vectSVG($frame, $pixelPerPoint = 4, $outerFrame = 4, $back_color = 0xFFFFFF, $fore_color = 0x000000)
3557
- {
3558
- $h = count($frame);
3559
- $w = strlen($frame[0]);
3560
-
3561
- $imgW = $w + 2*$outerFrame;
3562
- $imgH = $h + 2*$outerFrame;
3563
-
3564
-
3565
- $output =
3566
- '<?xml version="1.0" encoding="utf-8"?>'."\n".
3567
- '<svg version="1.1" baseProfile="full" width="'.$imgW * $pixelPerPoint.'" height="'.$imgH * $pixelPerPoint.'" viewBox="0 0 '.$imgW * $pixelPerPoint.' '.$imgH * $pixelPerPoint.'"
3568
- xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ev="http://www.w3.org/2001/xml-events">'."\n".
3569
- '<desc></desc>'."\n";
3570
-
3571
- $output =
3572
- '<?xml version="1.0" encoding="utf-8"?>'."\n".
3573
- '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">'."\n".
3574
- '<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" xmlns:xlink="http://www.w3.org/1999/xlink" width="'.$imgW * $pixelPerPoint.'" height="'.$imgH * $pixelPerPoint.'" viewBox="0 0 '.$imgW * $pixelPerPoint.' '.$imgH * $pixelPerPoint.'">'."\n".
3575
- '<desc></desc>'."\n";
3576
-
3577
- if(!empty($back_color)) {
3578
- $backgroundcolor = str_pad(dechex($back_color), 6, "0");
3579
- $output .= '<rect width="'.$imgW * $pixelPerPoint.'" height="'.$imgH * $pixelPerPoint.'" fill="#'.$backgroundcolor.'" cx="0" cy="0" />'."\n";
3580
- }
3581
-
3582
- $output .=
3583
- '<defs>'."\n".
3584
- '<rect id="p" width="'.$pixelPerPoint.'" height="'.$pixelPerPoint.'" />'."\n".
3585
- '</defs>'."\n".
3586
- '<g fill="#'.str_pad(dechex($fore_color), 6, "0").'">'."\n";
3587
-
3588
-
3589
- // Convert the matrix into pixels
3590
-
3591
- for($i=0; $i<$h; $i++) {
3592
- for($j=0; $j<$w; $j++) {
3593
- if( $frame[$i][$j] == '1') {
3594
- $y = ($i + $outerFrame) * $pixelPerPoint;
3595
- $x = ($j + $outerFrame) * $pixelPerPoint;
3596
- $output .= '<use x="'.$x.'" y="'.$y.'" xlink:href="#p" />'."\n";
3597
- }
3598
- }
3599
- }
3600
- $output .=
3601
- '</g>'."\n".
3602
- '</svg>';
3603
-
3604
- return $output;
3605
- }
3606
- }
3607
-
3608
-
3609
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/vendor/phpqrcode/qrbitstream.php DELETED
@@ -1,180 +0,0 @@
1
- <?php
2
- /*
3
- * PHP QR Code encoder
4
- *
5
- * Bitstream class
6
- *
7
- * Based on libqrencode C library distributed under LGPL 2.1
8
- * Copyright (C) 2006, 2007, 2008, 2009 Kentaro Fukuchi <fukuchi@megaui.net>
9
- *
10
- * PHP QR Code is distributed under LGPL 3
11
- * Copyright (C) 2010 Dominik Dzienia <deltalab at poczta dot fm>
12
- *
13
- * This library is free software; you can redistribute it and/or
14
- * modify it under the terms of the GNU Lesser General Public
15
- * License as published by the Free Software Foundation; either
16
- * version 3 of the License, or any later version.
17
- *
18
- * This library is distributed in the hope that it will be useful,
19
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21
- * Lesser General Public License for more details.
22
- *
23
- * You should have received a copy of the GNU Lesser General Public
24
- * License along with this library; if not, write to the Free Software
25
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26
- */
27
-
28
- class QRbitstream {
29
-
30
- public $data = array();
31
-
32
- //----------------------------------------------------------------------
33
- public function size()
34
- {
35
- return count($this->data);
36
- }
37
-
38
- //----------------------------------------------------------------------
39
- public function allocate($setLength)
40
- {
41
- $this->data = array_fill(0, $setLength, 0);
42
- return 0;
43
- }
44
-
45
- //----------------------------------------------------------------------
46
- public static function newFromNum($bits, $num)
47
- {
48
- $bstream = new QRbitstream();
49
- $bstream->allocate($bits);
50
-
51
- $mask = 1 << ($bits - 1);
52
- for($i=0; $i<$bits; $i++) {
53
- if($num & $mask) {
54
- $bstream->data[$i] = 1;
55
- } else {
56
- $bstream->data[$i] = 0;
57
- }
58
- $mask = $mask >> 1;
59
- }
60
-
61
- return $bstream;
62
- }
63
-
64
- //----------------------------------------------------------------------
65
- public static function newFromBytes($size, $data)
66
- {
67
- $bstream = new QRbitstream();
68
- $bstream->allocate($size * 8);
69
- $p=0;
70
-
71
- for($i=0; $i<$size; $i++) {
72
- $mask = 0x80;
73
- for($j=0; $j<8; $j++) {
74
- if($data[$i] & $mask) {
75
- $bstream->data[$p] = 1;
76
- } else {
77
- $bstream->data[$p] = 0;
78
- }
79
- $p++;
80
- $mask = $mask >> 1;
81
- }
82
- }
83
-
84
- return $bstream;
85
- }
86
-
87
- //----------------------------------------------------------------------
88
- public function append(QRbitstream $arg)
89
- {
90
- if (is_null($arg)) {
91
- return -1;
92
- }
93
-
94
- if($arg->size() == 0) {
95
- return 0;
96
- }
97
-
98
- if($this->size() == 0) {
99
- $this->data = $arg->data;
100
- return 0;
101
- }
102
-
103
- $this->data = array_values(array_merge($this->data, $arg->data));
104
-
105
- return 0;
106
- }
107
-
108
- //----------------------------------------------------------------------
109
- public function appendNum($bits, $num)
110
- {
111
- if ($bits == 0)
112
- return 0;
113
-
114
- $b = QRbitstream::newFromNum($bits, $num);
115
-
116
- if(is_null($b))
117
- return -1;
118
-
119
- $ret = $this->append($b);
120
- unset($b);
121
-
122
- return $ret;
123
- }
124
-
125
- //----------------------------------------------------------------------
126
- public function appendBytes($size, $data)
127
- {
128
- if ($size == 0)
129
- return 0;
130
-
131
- $b = QRbitstream::newFromBytes($size, $data);
132
-
133
- if(is_null($b))
134
- return -1;
135
-
136
- $ret = $this->append($b);
137
- unset($b);
138
-
139
- return $ret;
140
- }
141
-
142
- //----------------------------------------------------------------------
143
- public function toByte()
144
- {
145
-
146
- $size = $this->size();
147
-
148
- if($size == 0) {
149
- return array();
150
- }
151
-
152
- $data = array_fill(0, (int)(($size + 7) / 8), 0);
153
- $bytes = (int)($size / 8);
154
-
155
- $p = 0;
156
-
157
- for($i=0; $i<$bytes; $i++) {
158
- $v = 0;
159
- for($j=0; $j<8; $j++) {
160
- $v = $v << 1;
161
- $v |= $this->data[$p];
162
- $p++;
163
- }
164
- $data[$i] = $v;
165
- }
166
-
167
- if($size & 7) {
168
- $v = 0;
169
- for($j=0; $j<($size & 7); $j++) {
170
- $v = $v << 1;
171
- $v |= $this->data[$p];
172
- $p++;
173
- }
174
- $data[$bytes] = $v;
175
- }
176
-
177
- return $data;
178
- }
179
-
180
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/vendor/phpqrcode/qrconfig.php DELETED
@@ -1,17 +0,0 @@
1
- <?php
2
- /*
3
- * PHP QR Code encoder
4
- *
5
- * Config file, feel free to modify
6
- */
7
-
8
- define('QR_CACHEABLE', true); // use cache - more disk reads but less CPU power, masks and format templates are stored there
9
- define('QR_CACHE_DIR', dirname(__FILE__).DIRECTORY_SEPARATOR.'cache'.DIRECTORY_SEPARATOR); // used when QR_CACHEABLE === true
10
- define('QR_LOG_DIR', dirname(__FILE__).DIRECTORY_SEPARATOR); // default error logs dir
11
-
12
- define('QR_FIND_BEST_MASK', true); // if true, estimates best mask (spec. default, but extremally slow; set to false to significant performance boost but (propably) worst quality code
13
- define('QR_FIND_FROM_RANDOM', false); // if false, checks all masks available, otherwise value tells count of masks need to be checked, mask id are got randomly
14
- define('QR_DEFAULT_MASK', 2); // when QR_FIND_BEST_MASK === false
15
-
16
- define('QR_PNG_MAXIMUM_SIZE', 1024); // maximum allowed png image width (in pixels), tune to make sure GD and PHP can handle such big images
17
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/vendor/phpqrcode/qrconst.php DELETED
@@ -1,54 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * PHP QR Code encoder
5
- *
6
- * Common constants
7
- *
8
- * Based on libqrencode C library distributed under LGPL 2.1
9
- * Copyright (C) 2006, 2007, 2008, 2009 Kentaro Fukuchi <fukuchi@megaui.net>
10
- *
11
- * PHP QR Code is distributed under LGPL 3
12
- * Copyright (C) 2010 Dominik Dzienia <deltalab at poczta dot fm>
13
- *
14
- * This library is free software; you can redistribute it and/or
15
- * modify it under the terms of the GNU Lesser General Public
16
- * License as published by the Free Software Foundation; either
17
- * version 3 of the License, or any later version.
18
- *
19
- * This library is distributed in the hope that it will be useful,
20
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
21
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22
- * Lesser General Public License for more details.
23
- *
24
- * You should have received a copy of the GNU Lesser General Public
25
- * License along with this library; if not, write to the Free Software
26
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
27
- */
28
-
29
- // Encoding modes
30
-
31
- define('QR_MODE_NUL', -1);
32
- define('QR_MODE_NUM', 0);
33
- define('QR_MODE_AN', 1);
34
- define('QR_MODE_8', 2);
35
- define('QR_MODE_KANJI', 3);
36
- define('QR_MODE_STRUCTURE', 4);
37
-
38
- // Levels of error correction.
39
-
40
- define('QR_ECLEVEL_L', 0);
41
- define('QR_ECLEVEL_M', 1);
42
- define('QR_ECLEVEL_Q', 2);
43
- define('QR_ECLEVEL_H', 3);
44
-
45
- // Supported output formats
46
-
47
- define('QR_FORMAT_TEXT', 0);
48
- define('QR_FORMAT_PNG', 1);
49
-
50
- class qrstr {
51
- public static function set(&$srctab, $x, $y, $repl, $replLen = false) {
52
- $srctab[$y] = substr_replace($srctab[$y], ($replLen !== false)?substr($repl,0,$replLen):$repl, $x, ($replLen !== false)?$replLen:strlen($repl));
53
- }
54
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/vendor/phpqrcode/qrencode.php DELETED
@@ -1,569 +0,0 @@
1
- <?php
2
- /*
3
- * PHP QR Code encoder
4
- *
5
- * Main encoder classes.
6
- *
7
- * Based on libqrencode C library distributed under LGPL 2.1
8
- * Copyright (C) 2006, 2007, 2008, 2009 Kentaro Fukuchi <fukuchi@megaui.net>
9
- *
10
- * PHP QR Code is distributed under LGPL 3
11
- * Copyright (C) 2010 Dominik Dzienia <deltalab at poczta dot fm>
12
- *
13
- * This library is free software; you can redistribute it and/or
14
- * modify it under the terms of the GNU Lesser General Public
15
- * License as published by the Free Software Foundation; either
16
- * version 3 of the License, or any later version.
17
- *
18
- * This library is distributed in the hope that it will be useful,
19
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21
- * Lesser General Public License for more details.
22
- *
23
- * You should have received a copy of the GNU Lesser General Public
24
- * License along with this library; if not, write to the Free Software
25
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26
- */
27
-
28
- class QRrsblock {
29
- public $dataLength;
30
- public $data = array();
31
- public $eccLength;
32
- public $ecc = array();
33
-
34
- public function __construct($dl, $data, $el, &$ecc, QRrsItem $rs)
35
- {
36
- $rs->encode_rs_char($data, $ecc);
37
-
38
- $this->dataLength = $dl;
39
- $this->data = $data;
40
- $this->eccLength = $el;
41
- $this->ecc = $ecc;
42
- }
43
- };
44
-
45
- //##########################################################################
46
-
47
- class QRrawcode {
48
- public $version;
49
- public $datacode = array();
50
- public $ecccode = array();
51
- public $blocks;
52
- public $rsblocks = array(); //of RSblock
53
- public $count;
54
- public $dataLength;
55
- public $eccLength;
56
- public $b1;
57
-
58
- //----------------------------------------------------------------------
59
- public function __construct(QRinput $input)
60
- {
61
- $spec = array(0,0,0,0,0);
62
-
63
- $this->datacode = $input->getByteStream();
64
- if(is_null($this->datacode)) {
65
- throw new Exception('null imput string');
66
- }
67
-
68
- QRspec::getEccSpec($input->getVersion(), $input->getErrorCorrectionLevel(), $spec);
69
-
70
- $this->version = $input->getVersion();
71
- $this->b1 = QRspec::rsBlockNum1($spec);
72
- $this->dataLength = QRspec::rsDataLength($spec);
73
- $this->eccLength = QRspec::rsEccLength($spec);
74
- $this->ecccode = array_fill(0, $this->eccLength, 0);
75
- $this->blocks = QRspec::rsBlockNum($spec);
76
-
77
- $ret = $this->init($spec);
78
- if($ret < 0) {
79
- throw new Exception('block alloc error');
80
- return null;
81
- }
82
-
83
- $this->count = 0;
84
- }
85
-
86
- //----------------------------------------------------------------------
87
- public function init(array $spec)
88
- {
89
- $dl = QRspec::rsDataCodes1($spec);
90
- $el = QRspec::rsEccCodes1($spec);
91
- $rs = QRrs::init_rs(8, 0x11d, 0, 1, $el, 255 - $dl - $el);
92
-
93
-
94
- $blockNo = 0;
95
- $dataPos = 0;
96
- $eccPos = 0;
97
- for($i=0; $i<QRspec::rsBlockNum1($spec); $i++) {
98
- $ecc = array_slice($this->ecccode,$eccPos);
99
- $this->rsblocks[$blockNo] = new QRrsblock($dl, array_slice($this->datacode, $dataPos), $el, $ecc, $rs);
100
- $this->ecccode = array_merge(array_slice($this->ecccode,0, $eccPos), $ecc);
101
-
102
- $dataPos += $dl;
103
- $eccPos += $el;
104
- $blockNo++;
105
- }
106
-
107
- if(QRspec::rsBlockNum2($spec) == 0)
108
- return 0;
109
-
110
- $dl = QRspec::rsDataCodes2($spec);
111
- $el = QRspec::rsEccCodes2($spec);
112
- $rs = QRrs::init_rs(8, 0x11d, 0, 1, $el, 255 - $dl - $el);
113
-
114
- if($rs == NULL) return -1;
115
-
116
- for($i=0; $i<QRspec::rsBlockNum2($spec); $i++) {
117
- $ecc = array_slice($this->ecccode,$eccPos);
118
- $this->rsblocks[$blockNo] = new QRrsblock($dl, array_slice($this->datacode, $dataPos), $el, $ecc, $rs);
119
- $this->ecccode = array_merge(array_slice($this->ecccode,0, $eccPos), $ecc);
120
-
121
- $dataPos += $dl;
122
- $eccPos += $el;
123
- $blockNo++;
124
- }
125
-
126
- return 0;
127
- }
128
-
129
- //----------------------------------------------------------------------
130
- public function getCode()
131
- {
132
- $ret;
133
-
134
- if($this->count < $this->dataLength) {
135
- $row = $this->count % $this->blocks;
136
- $col = $this->count / $this->blocks;
137
- if($col >= $this->rsblocks[0]->dataLength) {
138
- $row += $this->b1;
139
- }
140
- $ret = $this->rsblocks[$row]->data[$col];
141
- } else if($this->count < $this->dataLength + $this->eccLength) {
142
- $row = ($this->count - $this->dataLength) % $this->blocks;
143
- $col = ($this->count - $this->dataLength) / $this->blocks;
144
- $ret = $this->rsblocks[$row]->ecc[$col];
145
- } else {
146
- return 0;
147
- }
148
- $this->count++;
149
-
150
- return $ret;
151
- }
152
- }
153
-
154
- //##########################################################################
155
-
156
- class QRcode {
157
-
158
- public $version;
159
- public $width;
160
- public $data;
161
-
162
- //----------------------------------------------------------------------
163
- public function encodeMask(QRinput $input, $mask)
164
- {
165
- if($input->getVersion() < 0 || $input->getVersion() > QRSPEC_VERSION_MAX) {
166
- throw new Exception('wrong version');
167
- }
168
- if($input->getErrorCorrectionLevel() > QR_ECLEVEL_H) {
169
- throw new Exception('wrong level');
170
- }
171
-
172
- $raw = new QRrawcode($input);
173
-
174
- QRtools::markTime('after_raw');
175
-
176
- $version = $raw->version;
177
- $width = QRspec::getWidth($version);
178
- $frame = QRspec::newFrame($version);
179
-
180
- $filler = new FrameFiller($width, $frame);
181
- if(is_null($filler)) {
182
- return NULL;
183
- }
184
-
185
- // inteleaved data and ecc codes
186
- for($i=0; $i<$raw->dataLength + $raw->eccLength; $i++) {
187
- $code = $raw->getCode();
188
- $bit = 0x80;
189
- for($j=0; $j<8; $j++) {
190
- $addr = $filler->next();
191
- $filler->setFrameAt($addr, 0x02 | (($bit & $code) != 0));
192
- $bit = $bit >> 1;
193
- }
194
- }
195
-
196
- QRtools::markTime('after_filler');
197
-
198
- unset($raw);
199
-
200
- // remainder bits
201
- $j = QRspec::getRemainder($version);
202
- for($i=0; $i<$j; $i++) {
203
- $addr = $filler->next();
204
- $filler->setFrameAt($addr, 0x02);
205
- }
206
-
207
- $frame = $filler->frame;
208
- unset($filler);
209
-
210
-
211
- // masking
212
- $maskObj = new QRmask();
213
- if($mask < 0) {
214
-
215
- if (QR_FIND_BEST_MASK) {
216
- $masked = $maskObj->mask($width, $frame, $input->getErrorCorrectionLevel());
217
- } else {
218
- $masked = $maskObj->makeMask($width, $frame, (intval(QR_DEFAULT_MASK) % 8), $input->getErrorCorrectionLevel());
219
- }
220
- } else {
221
- $masked = $maskObj->makeMask($width, $frame, $mask, $input->getErrorCorrectionLevel());
222
- }
223
-
224
- if($masked == NULL) {
225
- return NULL;
226
- }
227
-
228
- QRtools::markTime('after_mask');
229
-
230
- $this->version = $version;
231
- $this->width = $width;
232
- $this->data = $masked;
233
-
234
- return $this;
235
- }
236
-
237
- //----------------------------------------------------------------------
238
- public function encodeInput(QRinput $input)
239
- {
240
- return $this->encodeMask($input, -1);
241
- }
242
-
243
- //----------------------------------------------------------------------
244
- public function encodeString8bit($string, $version, $level)
245
- {
246
- if(string == NULL) {
247
- throw new Exception('empty string!');
248
- return NULL;
249
- }
250
-
251
- $input = new QRinput($version, $level);
252
- if($input == NULL) return NULL;
253
-
254
- $ret = $input->append($input, QR_MODE_8, strlen($string), str_split($string));
255
- if($ret < 0) {
256
- unset($input);
257
- return NULL;
258
- }
259
- return $this->encodeInput($input);
260
- }
261
-
262
- //----------------------------------------------------------------------
263
- public function encodeString($string, $version, $level, $hint, $casesensitive)
264
- {
265
-
266
- if($hint != QR_MODE_8 && $hint != QR_MODE_KANJI) {
267
- throw new Exception('bad hint');
268
- return NULL;
269
- }
270
-
271
- $input = new QRinput($version, $level);
272
- if($input == NULL) return NULL;
273
-
274
- $ret = QRsplit::splitStringToQRinput($string, $input, $hint, $casesensitive);
275
- if($ret < 0) {
276
- return NULL;
277
- }
278
-
279
- return $this->encodeInput($input);
280
- }
281
-
282
- //----------------------------------------------------------------------
283
- public static function png($text, $outfile = false, $level = QR_ECLEVEL_L, $size = 3, $margin = 4, $saveandprint=false, $back_color = 0xFFFFFF, $fore_color = 0x000000)
284
- {
285
- $enc = QRencode::factory($level, $size, $margin, $back_color, $fore_color);
286
- return $enc->encodePNG($text, $outfile, $saveandprint=false);
287
- }
288
-
289
- //----------------------------------------------------------------------
290
- public static function text($text, $outfile = false, $level = QR_ECLEVEL_L, $size = 3, $margin = 4)
291
- {
292
- $enc = QRencode::factory($level, $size, $margin);
293
- return $enc->encode($text, $outfile);
294
- }
295
-
296
- //----------------------------------------------------------------------
297
- public static function eps($text, $outfile = false, $level = QR_ECLEVEL_L, $size = 3, $margin = 4, $saveandprint=false, $back_color = 0xFFFFFF, $fore_color = 0x000000, $cmyk = false)
298
- {
299
- $enc = QRencode::factory($level, $size, $margin, $back_color, $fore_color, $cmyk);
300
- return $enc->encodeEPS($text, $outfile, $saveandprint=false);
301
- }
302
-
303
- //----------------------------------------------------------------------
304
- public static function svg($text, $outfile = false, $level = QR_ECLEVEL_L, $size = 3, $margin = 4, $saveandprint=false, $back_color = 0xFFFFFF, $fore_color = 0x000000)
305
- {
306
- $enc = QRencode::factory($level, $size, $margin, $back_color, $fore_color);
307
- return $enc->encodeSVG($text, $outfile, $saveandprint=false);
308
- }
309
-
310
- //----------------------------------------------------------------------
311
- public static function raw($text, $outfile = false, $level = QR_ECLEVEL_L, $size = 3, $margin = 4)
312
- {
313
- $enc = QRencode::factory($level, $size, $margin);
314
- return $enc->encodeRAW($text, $outfile);
315
- }
316
- }
317
-
318
- //##########################################################################
319
-
320
- class FrameFiller {
321
-
322
- public $width;
323
- public $frame;
324
- public $x;
325
- public $y;
326
- public $dir;
327
- public $bit;
328
-
329
- //----------------------------------------------------------------------
330
- public function __construct($width, &$frame)
331
- {
332
- $this->width = $width;
333
- $this->frame = $frame;
334
- $this->x = $width - 1;
335
- $this->y = $width - 1;
336
- $this->dir = -1;
337
- $this->bit = -1;
338
- }
339
-
340
- //----------------------------------------------------------------------
341
- public function setFrameAt($at, $val)
342
- {
343
- $this->frame[$at['y']][$at['x']] = chr($val);
344
- }
345
-
346
- //----------------------------------------------------------------------
347
- public function getFrameAt($at)
348
- {
349
- return ord($this->frame[$at['y']][$at['x']]);
350
- }
351
-
352
- //----------------------------------------------------------------------
353
- public function next()
354
- {
355
- do {
356
-
357
- if($this->bit == -1) {
358
- $this->bit = 0;
359
- return array('x'=>$this->x, 'y'=>$this->y);
360
- }
361
-
362
- $x = $this->x;
363
- $y = $this->y;
364
- $w = $this->width;
365
-
366
- if($this->bit == 0) {
367
- $x--;
368
- $this->bit++;
369
- } else {
370
- $x++;
371
- $y += $this->dir;
372
- $this->bit--;
373
- }
374
-
375
- if($this->dir < 0) {
376
- if($y < 0) {
377
- $y = 0;
378
- $x -= 2;
379
- $this->dir = 1;
380
- if($x == 6) {
381
- $x--;
382
- $y = 9;
383
- }
384
- }
385
- } else {
386
- if($y == $w) {
387
- $y = $w - 1;
388
- $x -= 2;
389
- $this->dir = -1;
390
- if($x == 6) {
391
- $x--;
392
- $y -= 8;
393
- }
394
- }
395
- }
396
- if($x < 0 || $y < 0) return null;
397
-
398
- $this->x = $x;
399
- $this->y = $y;
400
-
401
- } while(ord($this->frame[$y][$x]) & 0x80);
402
-
403
- return array('x'=>$x, 'y'=>$y);
404
- }
405
-
406
- } ;
407
-
408
- //##########################################################################
409
-
410
- class QRencode {
411
-
412
- public $casesensitive = true;
413
- public $eightbit = false;
414
-
415
- public $version = 0;
416
- public $size = 3;
417
- public $margin = 4;
418
- public $back_color = 0xFFFFFF;
419
- public $fore_color = 0x000000;
420
-
421
- public $structured = 0; // not supported yet
422
-
423
- public $level = QR_ECLEVEL_L;
424
- public $hint = QR_MODE_8;
425
-
426
- //----------------------------------------------------------------------
427
- public static function factory($level = QR_ECLEVEL_L, $size = 3, $margin = 4, $back_color = 0xFFFFFF, $fore_color = 0x000000, $cmyk = false)
428
- {
429
- $enc = new QRencode();
430
- $enc->size = $size;
431
- $enc->margin = $margin;
432
- $enc->fore_color = $fore_color;
433
- $enc->back_color = $back_color;
434
- $enc->cmyk = $cmyk;
435
-
436
- switch ($level.'') {
437
- case '0':
438
- case '1':
439
- case '2':
440
- case '3':
441
- $enc->level = $level;
442
- break;
443
- case 'l':
444
- case 'L':
445
- $enc->level = QR_ECLEVEL_L;
446
- break;
447
- case 'm':
448
- case 'M':
449
- $enc->level = QR_ECLEVEL_M;
450
- break;
451
- case 'q':
452
- case 'Q':
453
- $enc->level = QR_ECLEVEL_Q;
454
- break;
455
- case 'h':
456
- case 'H':
457
- $enc->level = QR_ECLEVEL_H;
458
- break;
459
- }
460
-
461
- return $enc;
462
- }
463
-
464
- //----------------------------------------------------------------------
465
- public function encodeRAW($intext, $outfile = false)
466
- {
467
- $code = new QRcode();
468
-
469
- if($this->eightbit) {
470
- $code->encodeString8bit($intext, $this->version, $this->level);
471
- } else {
472
- $code->encodeString($intext, $this->version, $this->level, $this->hint, $this->casesensitive);
473
- }
474
-
475
- return $code->data;
476
- }
477
-
478
- //----------------------------------------------------------------------
479
- public function encode($intext, $outfile = false)
480
- {
481
- $code = new QRcode();
482
-
483
- if($this->eightbit) {
484
- $code->encodeString8bit($intext, $this->version, $this->level);
485
- } else {
486
- $code->encodeString($intext, $this->version, $this->level, $this->hint, $this->casesensitive);
487
- }
488
-
489
- QRtools::markTime('after_encode');
490
-
491
- if ($outfile!== false) {
492
- file_put_contents($outfile, join("\n", QRtools::binarize($code->data)));
493
- } else {
494
- return QRtools::binarize($code->data);
495
- }
496
- }
497
-
498
- //----------------------------------------------------------------------
499
- public function encodePNG($intext, $outfile = false,$saveandprint=false)
500
- {
501
- try {
502
-
503
- ob_start();
504
- $tab = $this->encode($intext);
505
- $err = ob_get_contents();
506
- ob_end_clean();
507
-
508
- if ($err != '')
509
- QRtools::log($outfile, $err);
510
-
511
- $maxSize = (int)(QR_PNG_MAXIMUM_SIZE / (count($tab)+2*$this->margin));
512
-
513
- QRimage::png($tab, $outfile, min(max(1, $this->size), $maxSize), $this->margin,$saveandprint, $this->back_color, $this->fore_color);
514
-
515
- } catch (Exception $e) {
516
-
517
- QRtools::log($outfile, $e->getMessage());
518
-
519
- }
520
- }
521
-
522
- //----------------------------------------------------------------------
523
- public function encodeEPS($intext, $outfile = false,$saveandprint=false)
524
- {
525
- try {
526
-
527
- ob_start();
528
- $tab = $this->encode($intext);
529
- $err = ob_get_contents();
530
- ob_end_clean();
531
-
532
- if ($err != '')
533
- QRtools::log($outfile, $err);
534
-
535
- $maxSize = (int)(QR_PNG_MAXIMUM_SIZE / (count($tab)+2*$this->margin));
536
-
537
- return QRvect::eps($tab, $outfile, min(max(1, $this->size), $maxSize), $this->margin,$saveandprint, $this->back_color, $this->fore_color, $this->cmyk);
538
-
539
- } catch (Exception $e) {
540
-
541
- QRtools::log($outfile, $e->getMessage());
542
-
543
- }
544
- }
545
-
546
- //----------------------------------------------------------------------
547
- public function encodeSVG($intext, $outfile = false,$saveandprint=false)
548
- {
549
- try {
550
-
551
- ob_start();
552
- $tab = $this->encode($intext);
553
- $err = ob_get_contents();
554
- ob_end_clean();
555
-
556
- if ($err != '')
557
- QRtools::log($outfile, $err);
558
-
559
- $maxSize = (int)(QR_PNG_MAXIMUM_SIZE / (count($tab)+2*$this->margin));
560
-
561
- return QRvect::svg($tab, $outfile, min(max(1, $this->size), $maxSize), $this->margin,$saveandprint, $this->back_color, $this->fore_color);
562
-
563
- } catch (Exception $e) {
564
-
565
- QRtools::log($outfile, $e->getMessage());
566
-
567
- }
568
- }
569
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/vendor/phpqrcode/qrimage.php DELETED
@@ -1,107 +0,0 @@
1
- <?php
2
- /*
3
- * PHP QR Code encoder
4
- *
5
- * Image output of code using GD2
6
- *
7
- * PHP QR Code is distributed under LGPL 3
8
- * Copyright (C) 2010 Dominik Dzienia <deltalab at poczta dot fm>
9
- *
10
- * This library is free software; you can redistribute it and/or
11
- * modify it under the terms of the GNU Lesser General Public
12
- * License as published by the Free Software Foundation; either
13
- * version 3 of the License, or any later version.
14
- *
15
- * This library 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 GNU
18
- * Lesser General Public License for more details.
19
- *
20
- * You should have received a copy of the GNU Lesser General Public
21
- * License along with this library; if not, write to the Free Software
22
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23
- */
24
-
25
- define('QR_IMAGE', true);
26
-
27
- class QRimage {
28
-
29
- //----------------------------------------------------------------------
30
- public static function png($frame, $filename = false, $pixelPerPoint = 4, $outerFrame = 4,$saveandprint=FALSE, $back_color, $fore_color)
31
- {
32
- $image = self::image($frame, $pixelPerPoint, $outerFrame, $back_color, $fore_color);
33
-
34
- if ($filename === false) {
35
- Header("Content-type: image/png");
36
- ImagePng($image);
37
- } else {
38
- if($saveandprint===TRUE){
39
- ImagePng($image, $filename);
40
- header("Content-type: image/png");
41
- ImagePng($image);
42
- }else{
43
- ImagePng($image, $filename);
44
- }
45
- }
46
-
47
- ImageDestroy($image);
48
- }
49
-
50
- //----------------------------------------------------------------------
51
- public static function jpg($frame, $filename = false, $pixelPerPoint = 8, $outerFrame = 4, $q = 85)
52
- {
53
- $image = self::image($frame, $pixelPerPoint, $outerFrame);
54
-
55
- if ($filename === false) {
56
- Header("Content-type: image/jpeg");
57
- ImageJpeg($image, null, $q);
58
- } else {
59
- ImageJpeg($image, $filename, $q);
60
- }
61
-
62
- ImageDestroy($image);
63
- }
64
-
65
- //----------------------------------------------------------------------
66
- private static function image($frame, $pixelPerPoint = 4, $outerFrame = 4, $back_color = 0xFFFFFF, $fore_color = 0x000000)
67
- {
68
- $h = count($frame);
69
- $w = strlen($frame[0]);
70
-
71
- $imgW = $w + 2*$outerFrame;
72
- $imgH = $h + 2*$outerFrame;
73
-
74
- $base_image =ImageCreate($imgW, $imgH);
75
-
76
- // convert a hexadecimal color code into decimal eps format (green = 0 1 0, blue = 0 0 1, ...)
77
- $r1 = round((($fore_color & 0xFF0000) >> 16), 5);
78
- $b1 = round((($fore_color & 0x00FF00) >> 8), 5);
79
- $g1 = round(($fore_color & 0x0000FF), 5);
80
-
81
- // convert a hexadecimal color code into decimal eps format (green = 0 1 0, blue = 0 0 1, ...)
82
- $r2 = round((($back_color & 0xFF0000) >> 16), 5);
83
- $b2 = round((($back_color & 0x00FF00) >> 8), 5);
84
- $g2 = round(($back_color & 0x0000FF), 5);
85
-
86
-
87
-
88
- $col[0] = ImageColorAllocate($base_image,$r2,$b2,$g2);
89
- $col[1] = ImageColorAllocate($base_image,$r1,$b1,$g1);
90
-
91
- imagefill($base_image, 0, 0, $col[0]);
92
-
93
- for($y=0; $y<$h; $y++) {
94
- for($x=0; $x<$w; $x++) {
95
- if ($frame[$y][$x] == '1') {
96
- ImageSetPixel($base_image,$x+$outerFrame,$y+$outerFrame,$col[1]);
97
- }
98
- }
99
- }
100
-
101
- $target_image =ImageCreate($imgW * $pixelPerPoint, $imgH * $pixelPerPoint);
102
- ImageCopyResized($target_image, $base_image, 0, 0, 0, 0, $imgW * $pixelPerPoint, $imgH * $pixelPerPoint, $imgW, $imgH);
103
- ImageDestroy($base_image);
104
-
105
- return $target_image;
106
- }
107
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/vendor/phpqrcode/qrinput.php DELETED
@@ -1,729 +0,0 @@
1
- <?php
2
- /*
3
- * PHP QR Code encoder
4
- *
5
- * Input encoding class
6
- *
7
- * Based on libqrencode C library distributed under LGPL 2.1
8
- * Copyright (C) 2006, 2007, 2008, 2009 Kentaro Fukuchi <fukuchi@megaui.net>
9
- *
10
- * PHP QR Code is distributed under LGPL 3
11
- * Copyright (C) 2010 Dominik Dzienia <deltalab at poczta dot fm>
12
- *
13
- * This library is free software; you can redistribute it and/or
14
- * modify it under the terms of the GNU Lesser General Public
15
- * License as published by the Free Software Foundation; either
16
- * version 3 of the License, or any later version.
17
- *
18
- * This library is distributed in the hope that it will be useful,
19
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21
- * Lesser General Public License for more details.
22
- *
23
- * You should have received a copy of the GNU Lesser General Public
24
- * License along with this library; if not, write to the Free Software
25
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26
- */
27
-
28
- define('STRUCTURE_HEADER_BITS', 20);
29
- define('MAX_STRUCTURED_SYMBOLS', 16);
30
-
31
- class QRinputItem {
32
-
33
- public $mode;
34
- public $size;
35
- public $data;
36
- public $bstream;
37
-
38
- public function __construct($mode, $size, $data, $bstream = null)
39
- {
40
- $setData = array_slice($data, 0, $size);
41
-
42
- if (count($setData) < $size) {
43
- $setData = array_merge($setData, array_fill(0,$size-count($setData),0));
44
- }
45
-
46
- if(!QRinput::check($mode, $size, $setData)) {
47
- throw new Exception('Error m:'.$mode.',s:'.$size.',d:'.join(',',$setData));
48
- return null;
49
- }
50
-
51
- $this->mode = $mode;
52
- $this->size = $size;
53
- $this->data = $setData;
54
- $this->bstream = $bstream;
55
- }
56
-
57
- //----------------------------------------------------------------------
58
- public function encodeModeNum($version)
59
- {
60
- try {
61
-
62
- $words = (int)($this->size / 3);
63
- $bs = new QRbitstream();
64
-
65
- $val = 0x1;
66
- $bs->appendNum(4, $val);
67
- $bs->appendNum(QRspec::lengthIndicator(QR_MODE_NUM, $version), $this->size);
68
-
69
- for($i=0; $i<$words; $i++) {
70
- $val = (ord($this->data[$i*3 ]) - ord('0')) * 100;
71
- $val += (ord($this->data[$i*3+1]) - ord('0')) * 10;
72
- $val += (ord($this->data[$i*3+2]) - ord('0'));
73
- $bs->appendNum(10, $val);
74
- }
75
-
76
- if($this->size - $words * 3 == 1) {
77
- $val = ord($this->data[$words*3]) - ord('0');
78
- $bs->appendNum(4, $val);
79
- } else if($this->size - $words * 3 == 2) {
80
- $val = (ord($this->data[$words*3 ]) - ord('0')) * 10;
81
- $val += (ord($this->data[$words*3+1]) - ord('0'));
82
- $bs->appendNum(7, $val);
83
- }
84
-
85
- $this->bstream = $bs;
86
- return 0;
87
-
88
- } catch (Exception $e) {
89
- return -1;
90
- }
91
- }
92
-
93
- //----------------------------------------------------------------------
94
- public function encodeModeAn($version)
95
- {
96
- try {
97
- $words = (int)($this->size / 2);
98
- $bs = new QRbitstream();
99
-
100
- $bs->appendNum(4, 0x02);
101
- $bs->appendNum(QRspec::lengthIndicator(QR_MODE_AN, $version), $this->size);
102
-
103
- for($i=0; $i<$words; $i++) {
104
- $val = (int)QRinput::lookAnTable(ord($this->data[$i*2 ])) * 45;
105
- $val += (int)QRinput::lookAnTable(ord($this->data[$i*2+1]));
106
-
107
- $bs->appendNum(11, $val);
108
- }
109
-
110
- if($this->size & 1) {
111
- $val = QRinput::lookAnTable(ord($this->data[$words * 2]));
112
- $bs->appendNum(6, $val);
113
- }
114
-
115
- $this->bstream = $bs;
116
- return 0;
117
-
118
- } catch (Exception $e) {
119
- return -1;
120
- }
121
- }
122
-
123
- //----------------------------------------------------------------------
124
- public function encodeMode8($version)
125
- {
126
- try {
127
- $bs = new QRbitstream();
128
-
129
- $bs->appendNum(4, 0x4);
130
- $bs->appendNum(QRspec::lengthIndicator(QR_MODE_8, $version), $this->size);
131
-
132
- for($i=0; $i<$this->size; $i++) {
133
- $bs->appendNum(8, ord($this->data[$i]));
134
- }
135
-
136
- $this->bstream = $bs;
137
- return 0;
138
-
139
- } catch (Exception $e) {
140
- return -1;
141
- }
142
- }
143
-
144
- //----------------------------------------------------------------------
145
- public function encodeModeKanji($version)
146
- {
147
- try {
148
-
149
- $bs = new QRbitrtream();
150
-
151
- $bs->appendNum(4, 0x8);
152
- $bs->appendNum(QRspec::lengthIndicator(QR_MODE_KANJI, $version), (int)($this->size / 2));
153
-
154
- for($i=0; $i<$this->size; $i+=2) {
155
- $val = (ord($this->data[$i]) << 8) | ord($this->data[$i+1]);
156
- if($val <= 0x9ffc) {
157
- $val -= 0x8140;
158
- } else {
159
- $val -= 0xc140;
160
- }
161
-
162
- $h = ($val >> 8) * 0xc0;
163
- $val = ($val & 0xff) + $h;
164
-
165
- $bs->appendNum(13, $val);
166
- }
167
-
168
- $this->bstream = $bs;
169
- return 0;
170
-
171
- } catch (Exception $e) {
172
- return -1;
173
- }
174
- }
175
-
176
- //----------------------------------------------------------------------
177
- public function encodeModeStructure()
178
- {
179
- try {
180
- $bs = new QRbitstream();
181
-
182
- $bs->appendNum(4, 0x03);
183
- $bs->appendNum(4, ord($this->data[1]) - 1);
184
- $bs->appendNum(4, ord($this->data[0]) - 1);
185
- $bs->appendNum(8, ord($this->data[2]));
186
-
187
- $this->bstream = $bs;
188
- return 0;
189
-
190
- } catch (Exception $e) {
191
- return -1;
192
- }
193
- }
194
-
195
- //----------------------------------------------------------------------
196
- public function estimateBitStreamSizeOfEntry($version)
197
- {
198
- $bits = 0;
199
-
200
- if($version == 0)
201
- $version = 1;
202
-
203
- switch($this->mode) {
204
- case QR_MODE_NUM: $bits = QRinput::estimateBitsModeNum($this->size); break;
205
- case QR_MODE_AN: $bits = QRinput::estimateBitsModeAn($this->size); break;
206
- case QR_MODE_8: $bits = QRinput::estimateBitsMode8($this->size); break;
207
- case QR_MODE_KANJI: $bits = QRinput::estimateBitsModeKanji($this->size);break;
208
- case QR_MODE_STRUCTURE: return STRUCTURE_HEADER_BITS;
209
- default:
210
- return 0;
211
- }
212
-
213
- $l = QRspec::lengthIndicator($this->mode, $version);
214
- $m = 1 << $l;
215
- $num = (int)(($this->size + $m - 1) / $m);
216
-
217
- $bits += $num * (4 + $l);
218
-
219
- return $bits;
220
- }
221
-
222
- //----------------------------------------------------------------------
223
- public function encodeBitStream($version)
224
- {
225
- try {
226
-
227
- unset($this->bstream);
228
- $words = QRspec::maximumWords($this->mode, $version);
229
-
230
- if($this->size > $words) {
231
-
232
- $st1 = new QRinputItem($this->mode, $words, $this->data);
233
- $st2 = new QRinputItem($this->mode, $this->size - $words, array_slice($this->data, $words));
234
-
235
- $st1->encodeBitStream($version);
236
- $st2->encodeBitStream($version);
237
-
238
- $this->bstream = new QRbitstream();
239
- $this->bstream->append($st1->bstream);
240
- $this->bstream->append($st2->bstream);
241
-
242
- unset($st1);
243
- unset($st2);
244
-
245
- } else {
246
-
247
- $ret = 0;
248
-
249
- switch($this->mode) {
250
- case QR_MODE_NUM: $ret = $this->encodeModeNum($version); break;
251
- case QR_MODE_AN: $ret = $this->encodeModeAn($version); break;
252
- case QR_MODE_8: $ret = $this->encodeMode8($version); break;
253
- case QR_MODE_KANJI: $ret = $this->encodeModeKanji($version);break;
254
- case QR_MODE_STRUCTURE: $ret = $this->encodeModeStructure(); break;
255
-
256
- default:
257
- break;
258
- }
259
-
260
- if($ret < 0)
261
- return -1;
262
- }
263
-
264
- return $this->bstream->size();
265
-
266
- } catch (Exception $e) {
267
- return -1;
268
- }
269
- }
270
- };
271
-
272
- //##########################################################################
273
-
274
- class QRinput {
275
-
276
- public $items;
277
-
278
- private $version;
279
- private $level;
280
-
281
- //----------------------------------------------------------------------
282
- public function __construct($version = 0, $level = QR_ECLEVEL_L)
283
- {
284
- if ($version < 0 || $version > QRSPEC_VERSION_MAX || $level > QR_ECLEVEL_H) {
285
- throw new Exception('Invalid version no');
286
- return NULL;
287
- }
288
-
289
- $this->version = $version;
290
- $this->level = $level;
291
- }
292
-
293
- //----------------------------------------------------------------------
294
- public function getVersion()
295
- {
296
- return $this->version;
297
- }
298
-
299
- //----------------------------------------------------------------------
300
- public function setVersion($version)
301
- {
302
- if($version < 0 || $version > QRSPEC_VERSION_MAX) {
303
- throw new Exception('Invalid version no');
304
- return -1;
305
- }
306
-
307
- $this->version = $version;
308
-
309
- return 0;
310
- }
311
-
312
- //----------------------------------------------------------------------
313
- public function getErrorCorrectionLevel()
314
- {
315
- return $this->level;
316
- }
317
-
318
- //----------------------------------------------------------------------
319
- public function setErrorCorrectionLevel($level)
320
- {
321
- if($level > QR_ECLEVEL_H) {
322
- throw new Exception('Invalid ECLEVEL');
323
- return -1;
324
- }
325
-
326
- $this->level = $level;
327
-
328
- return 0;
329
- }
330
-
331
- //----------------------------------------------------------------------
332
- public function appendEntry(QRinputItem $entry)
333
- {
334
- $this->items[] = $entry;
335
- }
336
-
337
- //----------------------------------------------------------------------
338
- public function append($mode, $size, $data)
339
- {
340
- try {
341
- $entry = new QRinputItem($mode, $size, $data);
342
- $this->items[] = $entry;
343
- return 0;
344
- } catch (Exception $e) {
345
- return -1;
346
- }
347
- }
348
-
349
- //----------------------------------------------------------------------
350
-
351
- public function insertStructuredAppendHeader($size, $index, $parity)
352
- {
353
- if( $size > MAX_STRUCTURED_SYMBOLS ) {
354
- throw new Exception('insertStructuredAppendHeader wrong size');
355
- }
356
-
357
- if( $index <= 0 || $index > MAX_STRUCTURED_SYMBOLS ) {
358
- throw new Exception('insertStructuredAppendHeader wrong index');
359
- }
360
-
361
- $buf = array($size, $index, $parity);
362
-
363
- try {
364
- $entry = new QRinputItem(QR_MODE_STRUCTURE, 3, buf);
365
- array_unshift($this->items, $entry);
366
- return 0;
367
- } catch (Exception $e) {
368
- return -1;
369
- }
370
- }
371
-
372
- //----------------------------------------------------------------------
373
- public function calcParity()
374
- {
375
- $parity = 0;
376
-
377
- foreach($this->items as $item) {
378
- if($item->mode != QR_MODE_STRUCTURE) {
379
- for($i=$item->size-1; $i>=0; $i--) {
380
- $parity ^= $item->data[$i];
381
- }
382
- }
383
- }
384
-
385
- return $parity;
386
- }
387
-
388
- //----------------------------------------------------------------------
389
- public static function checkModeNum($size, $data)
390
- {
391
- for($i=0; $i<$size; $i++) {
392
- if((ord($data[$i]) < ord('0')) || (ord($data[$i]) > ord('9'))){
393
- return false;
394
- }
395
- }
396
-
397
- return true;
398
- }
399
-
400
- //----------------------------------------------------------------------
401
- public static function estimateBitsModeNum($size)
402
- {
403
- $w = (int)$size / 3;
404
- $bits = $w * 10;
405
-
406
- switch($size - $w * 3) {
407
- case 1:
408
- $bits += 4;
409
- break;
410
- case 2:
411
- $bits += 7;
412
- break;
413
- default:
414
- break;
415
- }
416
-
417
- return $bits;
418
- }
419
-
420
- //----------------------------------------------------------------------
421
- public static $anTable = array(
422
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
423
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
424
- 36, -1, -1, -1, 37, 38, -1, -1, -1, -1, 39, 40, -1, 41, 42, 43,
425
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 44, -1, -1, -1, -1, -1,
426
- -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
427
- 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, -1, -1, -1, -1, -1,
428
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
429
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
430
- );
431
-
432
- //----------------------------------------------------------------------
433
- public static function lookAnTable($c)
434
- {
435
- return (($c > 127)?-1:self::$anTable[$c]);
436
- }
437
-
438
- //----------------------------------------------------------------------
439
- public static function checkModeAn($size, $data)
440
- {
441
- for($i=0; $i<$size; $i++) {
442
- if (self::lookAnTable(ord($data[$i])) == -1) {
443
- return false;
444
- }
445
- }
446
-
447
- return true;
448
- }
449
-
450
- //----------------------------------------------------------------------
451
- public static function estimateBitsModeAn($size)
452
- {
453
- $w = (int)($size / 2);
454
- $bits = $w * 11;
455
-
456
- if($size & 1) {
457
- $bits += 6;
458
- }
459
-
460
- return $bits;
461
- }
462
-
463
- //----------------------------------------------------------------------
464
- public static function estimateBitsMode8($size)
465
- {
466
- return $size * 8;
467
- }
468
-
469
- //----------------------------------------------------------------------
470
- public function estimateBitsModeKanji($size)
471
- {
472
- return (int)(($size / 2) * 13);
473
- }
474
-
475
- //----------------------------------------------------------------------
476
- public static function checkModeKanji($size, $data)
477
- {
478
- if($size & 1)
479
- return false;
480
-
481
- for($i=0; $i<$size; $i+=2) {
482
- $val = (ord($data[$i]) << 8) | ord($data[$i+1]);
483
- if( $val < 0x8140
484
- || ($val > 0x9ffc && $val < 0xe040)
485
- || $val > 0xebbf) {
486
- return false;
487
- }
488
- }
489
-
490
- return true;
491
- }
492
-
493
- /***********************************************************************
494
- * Validation
495
- **********************************************************************/
496
-
497
- public static function check($mode, $size, $data)
498
- {
499
- if($size <= 0)
500
- return false;
501
-
502
- switch($mode) {
503
- case QR_MODE_NUM: return self::checkModeNum($size, $data); break;
504
- case QR_MODE_AN: return self::checkModeAn($size, $data); break;
505
- case QR_MODE_KANJI: return self::checkModeKanji($size, $data); break;
506
- case QR_MODE_8: return true; break;
507
- case QR_MODE_STRUCTURE: return true; break;
508
-
509
- default:
510
- break;
511
- }
512
-
513
- return false;
514
- }
515
-
516
-
517
- //----------------------------------------------------------------------
518
- public function estimateBitStreamSize($version)
519
- {
520
- $bits = 0;
521
-
522
- foreach($this->items as $item) {
523
- $bits += $item->estimateBitStreamSizeOfEntry($version);
524
- }
525
-
526
- return $bits;
527
- }
528
-
529
- //----------------------------------------------------------------------
530
- public function estimateVersion()
531
- {
532
- $version = 0;
533
- $prev = 0;
534
- do {
535
- $prev = $version;
536
- $bits = $this->estimateBitStreamSize($prev);
537
- $version = QRspec::getMinimumVersion((int)(($bits + 7) / 8), $this->level);
538
- if ($version < 0) {
539
- return -1;
540
- }
541
- } while ($version > $prev);
542
-
543
- return $version;
544
- }
545
-
546
- //----------------------------------------------------------------------
547
- public static function lengthOfCode($mode, $version, $bits)
548
- {
549
- $payload = $bits - 4 - QRspec::lengthIndicator($mode, $version);
550
- switch($mode) {
551
- case QR_MODE_NUM:
552
- $chunks = (int)($payload / 10);
553
- $remain = $payload - $chunks * 10;
554
- $size = $chunks * 3;
555
- if($remain >= 7) {
556
- $size += 2;
557
- } else if($remain >= 4) {
558
- $size += 1;
559
- }
560
- break;
561
- case QR_MODE_AN:
562
- $chunks = (int)($payload / 11);
563
- $remain = $payload - $chunks * 11;
564
- $size = $chunks * 2;
565
- if($remain >= 6)
566
- $size++;
567
- break;
568
- case QR_MODE_8:
569
- $size = (int)($payload / 8);
570
- break;
571
- case QR_MODE_KANJI:
572
- $size = (int)(($payload / 13) * 2);
573
- break;
574
- case QR_MODE_STRUCTURE:
575
- $size = (int)($payload / 8);
576
- break;
577
- default:
578
- $size = 0;
579
- break;
580
- }
581
-
582
- $maxsize = QRspec::maximumWords($mode, $version);
583
- if($size < 0) $size = 0;
584
- if($size > $maxsize) $size = $maxsize;
585
-
586
- return $size;
587
- }
588
-
589
- //----------------------------------------------------------------------
590
- public function createBitStream()
591
- {
592
- $total = 0;
593
-
594
- foreach($this->items as $item) {
595
- $bits = $item->encodeBitStream($this->version);
596
-
597
- if($bits < 0)
598
- return -1;
599
-
600
- $total += $bits;
601
- }
602
-
603
- return $total;
604
- }
605
-
606
- //----------------------------------------------------------------------
607
- public function convertData()
608
- {
609
- $ver = $this->estimateVersion();
610
- if($ver > $this->getVersion()) {
611
- $this->setVersion($ver);
612
- }
613
-
614
- for(;;) {
615
- $bits = $this->createBitStream();
616
-
617
- if($bits < 0)
618
- return -1;
619
-
620
- $ver = QRspec::getMinimumVersion((int)(($bits + 7) / 8), $this->level);
621
- if($ver < 0) {
622
- throw new Exception('WRONG VERSION');
623
- return -1;
624
- } else if($ver > $this->getVersion()) {
625
- $this->setVersion($ver);
626
- } else {
627
- break;
628
- }
629
- }
630
-
631
- return 0;
632
- }
633
-
634
- //----------------------------------------------------------------------
635
- public function appendPaddingBit(&$bstream)
636
- {
637
- $bits = $bstream->size();
638
- $maxwords = QRspec::getDataLength($this->version, $this->level);
639
- $maxbits = $maxwords * 8;
640
-
641
- if ($maxbits == $bits) {
642
- return 0;
643
- }
644
-
645
- if ($maxbits - $bits < 5) {
646
- return $bstream->appendNum($maxbits - $bits, 0);
647
- }
648
-
649
- $bits += 4;
650
- $words = (int)(($bits + 7) / 8);
651
-
652
- $padding = new QRbitstream();
653
- $ret = $padding->appendNum($words * 8 - $bits + 4, 0);
654
-
655
- if($ret < 0)
656
- return $ret;
657
-
658
- $padlen = $maxwords - $words;
659
-
660
- if($padlen > 0) {
661
-
662
- $padbuf = array();
663
- for($i=0; $i<$padlen; $i++) {
664
- $padbuf[$i] = ($i&1)?0x11:0xec;
665
- }
666
-
667
- $ret = $padding->appendBytes($padlen, $padbuf);
668
-
669
- if($ret < 0)
670
- return $ret;
671
-
672
- }
673
-
674
- $ret = $bstream->append($padding);
675
-
676
- return $ret;
677
- }
678
-
679
- //----------------------------------------------------------------------
680
- public function mergeBitStream()
681
- {
682
- if($this->convertData() < 0) {
683
- return null;
684
- }
685
-
686
- $bstream = new QRbitstream();
687
-
688
- foreach($this->items as $item) {
689
- $ret = $bstream->append($item->bstream);
690
- if($ret < 0) {
691
- return null;
692
- }
693
- }
694
-
695
- return $bstream;
696
- }
697
-
698
- //----------------------------------------------------------------------
699
- public function getBitStream()
700
- {
701
-
702
- $bstream = $this->mergeBitStream();
703
-
704
- if($bstream == null) {
705
- return null;
706
- }
707
-
708
- $ret = $this->appendPaddingBit($bstream);
709
- if($ret < 0) {
710
- return null;
711
- }
712
-
713
- return $bstream;
714
- }
715
-
716
- //----------------------------------------------------------------------
717
- public function getByteStream()
718
- {
719
- $bstream = $this->getBitStream();
720
- if($bstream == null) {
721
- return null;
722
- }
723
-
724
- return $bstream->toByte();
725
- }
726
- }
727
-
728
-
729
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/vendor/phpqrcode/qrlib.php DELETED
@@ -1,44 +0,0 @@
1
- <?php
2
- /*
3
- * PHP QR Code encoder
4
- *
5
- * Root library file, prepares environment and includes dependencies
6
- *
7
- * Based on libqrencode C library distributed under LGPL 2.1
8
- * Copyright (C) 2006, 2007, 2008, 2009 Kentaro Fukuchi <fukuchi@megaui.net>
9
- *
10
- * PHP QR Code is distributed under LGPL 3
11
- * Copyright (C) 2010 Dominik Dzienia <deltalab at poczta dot fm>
12
- *
13
- * This library is free software; you can redistribute it and/or
14
- * modify it under the terms of the GNU Lesser General Public
15
- * License as published by the Free Software Foundation; either
16
- * version 3 of the License, or any later version.
17
- *
18
- * This library is distributed in the hope that it will be useful,
19
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21
- * Lesser General Public License for more details.
22
- *
23
- * You should have received a copy of the GNU Lesser General Public
24
- * License along with this library; if not, write to the Free Software
25
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26
- */
27
-
28
- $QR_BASEDIR = dirname(__FILE__).DIRECTORY_SEPARATOR;
29
-
30
- // Required libs
31
-
32
- include $QR_BASEDIR."qrconst.php";
33
- include $QR_BASEDIR."qrconfig.php";
34
- include $QR_BASEDIR."qrtools.php";
35
- include $QR_BASEDIR."qrspec.php";
36
- include $QR_BASEDIR."qrimage.php";
37
- include $QR_BASEDIR."qrvect.php";
38
- include $QR_BASEDIR."qrinput.php";
39
- include $QR_BASEDIR."qrbitstream.php";
40
- include $QR_BASEDIR."qrsplit.php";
41
- include $QR_BASEDIR."qrrscode.php";
42
- include $QR_BASEDIR."qrmask.php";
43
- include $QR_BASEDIR."qrencode.php";
44
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/vendor/phpqrcode/qrmask.php DELETED
@@ -1,328 +0,0 @@
1
- <?php
2
- /*
3
- * PHP QR Code encoder
4
- *
5
- * Masking
6
- *
7
- * Based on libqrencode C library distributed under LGPL 2.1
8
- * Copyright (C) 2006, 2007, 2008, 2009 Kentaro Fukuchi <fukuchi@megaui.net>
9
- *
10
- * PHP QR Code is distributed under LGPL 3
11
- * Copyright (C) 2010 Dominik Dzienia <deltalab at poczta dot fm>
12
- *
13
- * This library is free software; you can redistribute it and/or
14
- * modify it under the terms of the GNU Lesser General Public
15
- * License as published by the Free Software Foundation; either
16
- * version 3 of the License, or any later version.
17
- *
18
- * This library is distributed in the hope that it will be useful,
19
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21
- * Lesser General Public License for more details.
22
- *
23
- * You should have received a copy of the GNU Lesser General Public
24
- * License along with this library; if not, write to the Free Software
25
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26
- */
27
-
28
- define('N1', 3);
29
- define('N2', 3);
30
- define('N3', 40);
31
- define('N4', 10);
32
-
33
- class QRmask {
34
-
35
- public $runLength = array();
36
-
37
- //----------------------------------------------------------------------
38
- public function __construct()
39
- {
40
- $this->runLength = array_fill(0, QRSPEC_WIDTH_MAX + 1, 0);
41
- }
42
-
43
- //----------------------------------------------------------------------
44
- public function writeFormatInformation($width, &$frame, $mask, $level)
45
- {
46
- $blacks = 0;
47
- $format = QRspec::getFormatInfo($mask, $level);
48
-
49
- for($i=0; $i<8; $i++) {
50
- if($format & 1) {
51
- $blacks += 2;
52
- $v = 0x85;
53
- } else {
54
- $v = 0x84;
55
- }
56
-
57
- $frame[8][$width - 1 - $i] = chr($v);
58
- if($i < 6) {
59
- $frame[$i][8] = chr($v);
60
- } else {
61
- $frame[$i + 1][8] = chr($v);
62
- }
63
- $format = $format >> 1;
64
- }
65
-
66
- for($i=0; $i<7; $i++) {
67
- if($format & 1) {
68
- $blacks += 2;
69
- $v = 0x85;
70
- } else {
71
- $v = 0x84;
72
- }
73
-
74
- $frame[$width - 7 + $i][8] = chr($v);
75
- if($i == 0) {
76
- $frame[8][7] = chr($v);
77
- } else {
78
- $frame[8][6 - $i] = chr($v);
79
- }
80
-
81
- $format = $format >> 1;
82
- }
83
-
84
- return $blacks;
85
- }
86
-
87
- //----------------------------------------------------------------------
88
- public function mask0($x, $y) { return ($x+$y)&1; }
89
- public function mask1($x, $y) { return ($y&1); }
90
- public function mask2($x, $y) { return ($x%3); }
91
- public function mask3($x, $y) { return ($x+$y)%3; }
92
- public function mask4($x, $y) { return (((int)($y/2))+((int)($x/3)))&1; }
93
- public function mask5($x, $y) { return (($x*$y)&1)+($x*$y)%3; }
94
- public function mask6($x, $y) { return ((($x*$y)&1)+($x*$y)%3)&1; }
95
- public function mask7($x, $y) { return ((($x*$y)%3)+(($x+$y)&1))&1; }
96
-
97
- //----------------------------------------------------------------------
98
- private function generateMaskNo($maskNo, $width, $frame)
99
- {
100
- $bitMask = array_fill(0, $width, array_fill(0, $width, 0));
101
-
102
- for($y=0; $y<$width; $y++) {
103
- for($x=0; $x<$width; $x++) {
104
- if(ord($frame[$y][$x]) & 0x80) {
105
- $bitMask[$y][$x] = 0;
106
- } else {
107
- $maskFunc = call_user_func(array($this, 'mask'.$maskNo), $x, $y);
108
- $bitMask[$y][$x] = ($maskFunc == 0)?1:0;
109
- }
110
-
111
- }
112
- }
113
-
114
- return $bitMask;
115
- }
116
-
117
- //----------------------------------------------------------------------
118
- public static function serial($bitFrame)
119
- {
120
- $codeArr = array();
121
-
122
- foreach ($bitFrame as $line)
123
- $codeArr[] = join('', $line);
124
-
125
- return gzcompress(join("\n", $codeArr), 9);
126
- }
127
-
128
- //----------------------------------------------------------------------
129
- public static function unserial($code)
130
- {
131
- $codeArr = array();
132
-
133
- $codeLines = explode("\n", gzuncompress($code));
134
- foreach ($codeLines as $line)
135
- $codeArr[] = str_split($line);
136
-
137
- return $codeArr;
138
- }
139
-
140
- //----------------------------------------------------------------------
141
- public function makeMaskNo($maskNo, $width, $s, &$d, $maskGenOnly = false)
142
- {
143
- $b = 0;
144
- $bitMask = array();
145
-
146
- $fileName = QR_CACHE_DIR.'mask_'.$maskNo.DIRECTORY_SEPARATOR.'mask_'.$width.'_'.$maskNo.'.dat';
147
-
148
- if (QR_CACHEABLE) {
149
- if (file_exists($fileName)) {
150
- $bitMask = self::unserial(file_get_contents($fileName));
151
- } else {
152
- $bitMask = $this->generateMaskNo($maskNo, $width, $s, $d);
153
- if (!file_exists(QR_CACHE_DIR.'mask_'.$maskNo))
154
- mkdir(QR_CACHE_DIR.'mask_'.$maskNo);
155
- file_put_contents($fileName, self::serial($bitMask));
156
- }
157
- } else {
158
- $bitMask = $this->generateMaskNo($maskNo, $width, $s, $d);
159
- }
160
-
161
- if ($maskGenOnly)
162
- return;
163
-
164
- $d = $s;
165
-
166
- for($y=0; $y<$width; $y++) {
167
- for($x=0; $x<$width; $x++) {
168
- if($bitMask[$y][$x] == 1) {
169
- $d[$y][$x] = chr(ord($s[$y][$x]) ^ (int)$bitMask[$y][$x]);
170
- }
171
- $b += (int)(ord($d[$y][$x]) & 1);
172
- }
173
- }
174
-
175
- return $b;
176
- }
177
-
178
- //----------------------------------------------------------------------
179
- public function makeMask($width, $frame, $maskNo, $level)
180
- {
181
- $masked = array_fill(0, $width, str_repeat("\0", $width));
182
- $this->makeMaskNo($maskNo, $width, $frame, $masked);
183
- $this->writeFormatInformation($width, $masked, $maskNo, $level);
184
-
185
- return $masked;
186
- }
187
-
188
- //----------------------------------------------------------------------
189
- public function calcN1N3($length)
190
- {
191
- $demerit = 0;
192
-
193
- for($i=0; $i<$length; $i++) {
194
-
195
- if($this->runLength[$i] >= 5) {
196
- $demerit += (N1 + ($this->runLength[$i] - 5));
197
- }
198
- if($i & 1) {
199
- if(($i >= 3) && ($i < ($length-2)) && ($this->runLength[$i] % 3 == 0)) {
200
- $fact = (int)($this->runLength[$i] / 3);
201
- if(($this->runLength[$i-2] == $fact) &&
202
- ($this->runLength[$i-1] == $fact) &&
203
- ($this->runLength[$i+1] == $fact) &&
204
- ($this->runLength[$i+2] == $fact)) {
205
- if(($this->runLength[$i-3] < 0) || ($this->runLength[$i-3] >= (4 * $fact))) {
206
- $demerit += N3;
207
- } else if((($i+3) >= $length) || ($this->runLength[$i+3] >= (4 * $fact))) {
208
- $demerit += N3;
209
- }
210
- }
211
- }
212
- }
213
- }
214
- return $demerit;
215
- }
216
-
217
- //----------------------------------------------------------------------
218
- public function evaluateSymbol($width, $frame)
219
- {
220
- $head = 0;
221
- $demerit = 0;
222
-
223
- for($y=0; $y<$width; $y++) {
224
- $head = 0;
225
- $this->runLength[0] = 1;
226
-
227
- $frameY = $frame[$y];
228
-
229
- if ($y>0)
230
- $frameYM = $frame[$y-1];
231
-
232
- for($x=0; $x<$width; $x++) {
233
- if(($x > 0) && ($y > 0)) {
234
- $b22 = ord($frameY[$x]) & ord($frameY[$x-1]) & ord($frameYM[$x]) & ord($frameYM[$x-1]);
235
- $w22 = ord($frameY[$x]) | ord($frameY[$x-1]) | ord($frameYM[$x]) | ord($frameYM[$x-1]);
236
-
237
- if(($b22 | ($w22 ^ 1))&1) {
238
- $demerit += N2;
239
- }
240
- }
241
- if(($x == 0) && (ord($frameY[$x]) & 1)) {
242
- $this->runLength[0] = -1;
243
- $head = 1;
244
- $this->runLength[$head] = 1;
245
- } else if($x > 0) {
246
- if((ord($frameY[$x]) ^ ord($frameY[$x-1])) & 1) {
247
- $head++;
248
- $this->runLength[$head] = 1;
249
- } else {
250
- $this->runLength[$head]++;
251
- }
252
- }
253
- }
254
-
255
- $demerit += $this->calcN1N3($head+1);
256
- }
257
-
258
- for($x=0; $x<$width; $x++) {
259
- $head = 0;
260
- $this->runLength[0] = 1;
261
-
262
- for($y=0; $y<$width; $y++) {
263
- if($y == 0 && (ord($frame[$y][$x]) & 1)) {
264
- $this->runLength[0] = -1;
265
- $head = 1;
266
- $this->runLength[$head] = 1;
267
- } else if($y > 0) {
268
- if((ord($frame[$y][$x]) ^ ord($frame[$y-1][$x])) & 1) {
269
- $head++;
270
- $this->runLength[$head] = 1;
271
- } else {
272
- $this->runLength[$head]++;
273
- }
274
- }
275
- }
276
-
277
- $demerit += $this->calcN1N3($head+1);
278
- }
279
-
280
- return $demerit;
281
- }
282
-
283
-
284
- //----------------------------------------------------------------------
285
- public function mask($width, $frame, $level)
286
- {
287
- $minDemerit = PHP_INT_MAX;
288
- $bestMaskNum = 0;
289
- $bestMask = array();
290
-
291
- $checked_masks = array(0,1,2,3,4,5,6,7);
292
-
293
- if (QR_FIND_FROM_RANDOM !== false) {
294
-
295
- $howManuOut = 8-(QR_FIND_FROM_RANDOM % 9);
296
- for ($i = 0; $i < $howManuOut; $i++) {
297
- $remPos = rand (0, count($checked_masks)-1);
298
- unset($checked_masks[$remPos]);
299
- $checked_masks = array_values($checked_masks);
300
- }
301
-
302
- }
303
-
304
- $bestMask = $frame;
305
-
306
- foreach($checked_masks as $i) {
307
- $mask = array_fill(0, $width, str_repeat("\0", $width));
308
-
309
- $demerit = 0;
310
- $blacks = 0;
311
- $blacks = $this->makeMaskNo($i, $width, $frame, $mask);
312
- $blacks += $this->writeFormatInformation($width, $mask, $i, $level);
313
- $blacks = (int)(100 * $blacks / ($width * $width));
314
- $demerit = (int)((int)(abs($blacks - 50) / 5) * N4);
315
- $demerit += $this->evaluateSymbol($width, $mask);
316
-
317
- if($demerit < $minDemerit) {
318
- $minDemerit = $demerit;
319
- $bestMask = $mask;
320
- $bestMaskNum = $i;
321
- }
322
- }
323
-
324
- return $bestMask;
325
- }
326
-
327
- //----------------------------------------------------------------------
328
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/vendor/phpqrcode/qrrscode.php DELETED
@@ -1,210 +0,0 @@
1
- <?php
2
- /*
3
- * PHP QR Code encoder
4
- *
5
- * Reed-Solomon error correction support
6
- *
7
- * Copyright (C) 2002, 2003, 2004, 2006 Phil Karn, KA9Q
8
- * (libfec is released under the GNU Lesser General Public License.)
9
- *
10
- * Based on libqrencode C library distributed under LGPL 2.1
11
- * Copyright (C) 2006, 2007, 2008, 2009 Kentaro Fukuchi <fukuchi@megaui.net>
12
- *
13
- * PHP QR Code is distributed under LGPL 3
14
- * Copyright (C) 2010 Dominik Dzienia <deltalab at poczta dot fm>
15
- *
16
- * This library is free software; you can redistribute it and/or
17
- * modify it under the terms of the GNU Lesser General Public
18
- * License as published by the Free Software Foundation; either
19
- * version 3 of the License, or any later version.
20
- *
21
- * This library is distributed in the hope that it will be useful,
22
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
23
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24
- * Lesser General Public License for more details.
25
- *
26
- * You should have received a copy of the GNU Lesser General Public
27
- * License along with this library; if not, write to the Free Software
28
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29
- */
30
-
31
- class QRrsItem {
32
-
33
- public $mm; // Bits per symbol
34
- public $nn; // Symbols per block (= (1<<mm)-1)
35
- public $alpha_to = array(); // log lookup table
36
- public $index_of = array(); // Antilog lookup table
37
- public $genpoly = array(); // Generator polynomial
38
- public $nroots; // Number of generator roots = number of parity symbols
39
- public $fcr; // First consecutive root, index form
40
- public $prim; // Primitive element, index form
41
- public $iprim; // prim-th root of 1, index form
42
- public $pad; // Padding bytes in shortened block
43
- public $gfpoly;
44
-
45
- //----------------------------------------------------------------------
46
- public function modnn($x)
47
- {
48
- while ($x >= $this->nn) {
49
- $x -= $this->nn;
50
- $x = ($x >> $this->mm) + ($x & $this->nn);
51
- }
52
-
53
- return $x;
54
- }
55
-
56
- //----------------------------------------------------------------------
57
- public static function init_rs_char($symsize, $gfpoly, $fcr, $prim, $nroots, $pad)
58
- {
59
- // Common code for intializing a Reed-Solomon control block (char or int symbols)
60
- // Copyright 2004 Phil Karn, KA9Q
61
- // May be used under the terms of the GNU Lesser General Public License (LGPL)
62
-
63
- $rs = null;
64
-
65
- // Check parameter ranges
66
- if($symsize < 0 || $symsize > 8) return $rs;
67
- if($fcr < 0 || $fcr >= (1<<$symsize)) return $rs;
68
- if($prim <= 0 || $prim >= (1<<$symsize)) return $rs;
69
- if($nroots < 0 || $nroots >= (1<<$symsize)) return $rs; // Can't have more roots than symbol values!
70
- if($pad < 0 || $pad >= ((1<<$symsize) -1 - $nroots)) return $rs; // Too much padding
71
-
72
- $rs = new QRrsItem();
73
- $rs->mm = $symsize;
74
- $rs->nn = (1<<$symsize)-1;
75
- $rs->pad = $pad;
76
-
77
- $rs->alpha_to = array_fill(0, $rs->nn+1, 0);
78
- $rs->index_of = array_fill(0, $rs->nn+1, 0);
79
-
80
- // PHP style macro replacement ;)
81
- $NN =& $rs->nn;
82
- $A0 =& $NN;
83
-
84
- // Generate Galois field lookup tables
85
- $rs->index_of[0] = $A0; // log(zero) = -inf
86
- $rs->alpha_to[$A0] = 0; // alpha**-inf = 0
87
- $sr = 1;
88
-
89
- for($i=0; $i<$rs->nn; $i++) {
90
- $rs->index_of[$sr] = $i;
91
- $rs->alpha_to[$i] = $sr;
92
- $sr <<= 1;
93
- if($sr & (1<<$symsize)) {
94
- $sr ^= $gfpoly;
95
- }
96
- $sr &= $rs->nn;
97
- }
98
-
99
- if($sr != 1){
100
- // field generator polynomial is not primitive!
101
- $rs = NULL;
102
- return $rs;
103
- }
104
-
105
- /* Form RS code generator polynomial from its roots */
106
- $rs->genpoly = array_fill(0, $nroots+1, 0);
107
-
108
- $rs->fcr = $fcr;
109
- $rs->prim = $prim;
110
- $rs->nroots = $nroots;
111
- $rs->gfpoly = $gfpoly;
112
-
113
- /* Find prim-th root of 1, used in decoding */
114
- for($iprim=1;($iprim % $prim) != 0;$iprim += $rs->nn)
115
- ; // intentional empty-body loop!
116
-
117
- $rs->iprim = (int)($iprim / $prim);
118
- $rs->genpoly[0] = 1;
119
-
120
- for ($i = 0,$root=$fcr*$prim; $i < $nroots; $i++, $root += $prim) {
121
- $rs->genpoly[$i+1] = 1;
122
-
123
- // Multiply rs->genpoly[] by @**(root + x)
124
- for ($j = $i; $j > 0; $j--) {
125
- if ($rs->genpoly[$j] != 0) {
126
- $rs->genpoly[$j] = $rs->genpoly[$j-1] ^ $rs->alpha_to[$rs->modnn($rs->index_of[$rs->genpoly[$j]] + $root)];
127
- } else {
128
- $rs->genpoly[$j] = $rs->genpoly[$j-1];
129
- }
130
- }
131
- // rs->genpoly[0] can never be zero
132
- $rs->genpoly[0] = $rs->alpha_to[$rs->modnn($rs->index_of[$rs->genpoly[0]] + $root)];
133
- }
134
-
135
- // convert rs->genpoly[] to index form for quicker encoding
136
- for ($i = 0; $i <= $nroots; $i++)
137
- $rs->genpoly[$i] = $rs->index_of[$rs->genpoly[$i]];
138
-
139
- return $rs;
140
- }
141
-
142
- //----------------------------------------------------------------------
143
- public function encode_rs_char($data, &$parity)
144
- {
145
- $MM =& $this->mm;
146
- $NN =& $this->nn;
147
- $ALPHA_TO =& $this->alpha_to;
148
- $INDEX_OF =& $this->index_of;
149
- $GENPOLY =& $this->genpoly;
150
- $NROOTS =& $this->nroots;
151
- $FCR =& $this->fcr;
152
- $PRIM =& $this->prim;
153
- $IPRIM =& $this->iprim;
154
- $PAD =& $this->pad;
155
- $A0 =& $NN;
156
-
157
- $parity = array_fill(0, $NROOTS, 0);
158
-
159
- for($i=0; $i< ($NN-$NROOTS-$PAD); $i++) {
160
-
161
- $feedback = $INDEX_OF[$data[$i] ^ $parity[0]];
162
- if($feedback != $A0) {
163
- // feedback term is non-zero
164
-
165
- // This line is unnecessary when GENPOLY[NROOTS] is unity, as it must
166
- // always be for the polynomials constructed by init_rs()
167
- $feedback = $this->modnn($NN - $GENPOLY[$NROOTS] + $feedback);
168
-
169
- for($j=1;$j<$NROOTS;$j++) {
170
- $parity[$j] ^= $ALPHA_TO[$this->modnn($feedback + $GENPOLY[$NROOTS-$j])];
171
- }
172
- }
173
-
174
- // Shift
175
- array_shift($parity);
176
- if($feedback != $A0) {
177
- array_push($parity, $ALPHA_TO[$this->modnn($feedback + $GENPOLY[0])]);
178
- } else {
179
- array_push($parity, 0);
180
- }
181
- }
182
- }
183
- }
184
-
185
- //##########################################################################
186
-
187
- class QRrs {
188
-
189
- public static $items = array();
190
-
191
- //----------------------------------------------------------------------
192
- public static function init_rs($symsize, $gfpoly, $fcr, $prim, $nroots, $pad)
193
- {
194
- foreach(self::$items as $rs) {
195
- if($rs->pad != $pad) continue;
196
- if($rs->nroots != $nroots) continue;
197
- if($rs->mm != $symsize) continue;
198
- if($rs->gfpoly != $gfpoly) continue;
199
- if($rs->fcr != $fcr) continue;
200
- if($rs->prim != $prim) continue;
201
-
202
- return $rs;
203
- }
204
-
205
- $rs = QRrsItem::init_rs_char($symsize, $gfpoly, $fcr, $prim, $nroots, $pad);
206
- array_unshift(self::$items, $rs);
207
-
208
- return $rs;
209
- }
210
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/vendor/phpqrcode/qrspec.php DELETED
@@ -1,592 +0,0 @@
1
- <?php
2
- /*
3
- * PHP QR Code encoder
4
- *
5
- * QR Code specifications
6
- *
7
- * Based on libqrencode C library distributed under LGPL 2.1
8
- * Copyright (C) 2006, 2007, 2008, 2009 Kentaro Fukuchi <fukuchi@megaui.net>
9
- *
10
- * PHP QR Code is distributed under LGPL 3
11
- * Copyright (C) 2010 Dominik Dzienia <deltalab at poczta dot fm>
12
- *
13
- * The following data / specifications are taken from
14
- * "Two dimensional symbol -- QR-code -- Basic Specification" (JIS X0510:2004)
15
- * or
16
- * "Automatic identification and data capture techniques --
17
- * QR Code 2005 bar code symbology specification" (ISO/IEC 18004:2006)
18
- *
19
- * This library is free software; you can redistribute it and/or
20
- * modify it under the terms of the GNU Lesser General Public
21
- * License as published by the Free Software Foundation; either
22
- * version 3 of the License, or any later version.
23
- *
24
- * This library is distributed in the hope that it will be useful,
25
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
26
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
27
- * Lesser General Public License for more details.
28
- *
29
- * You should have received a copy of the GNU Lesser General Public
30
- * License along with this library; if not, write to the Free Software
31
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
32
- */
33
-
34
- define('QRSPEC_VERSION_MAX', 40);
35
- define('QRSPEC_WIDTH_MAX', 177);
36
-
37
- define('QRCAP_WIDTH', 0);
38
- define('QRCAP_WORDS', 1);
39
- define('QRCAP_REMINDER', 2);
40
- define('QRCAP_EC', 3);
41
-
42
- class QRspec {
43
-
44
- public static $capacity = array(
45
- array( 0, 0, 0, array( 0, 0, 0, 0)),
46
- array( 21, 26, 0, array( 7, 10, 13, 17)), // 1
47
- array( 25, 44, 7, array( 10, 16, 22, 28)),
48
- array( 29, 70, 7, array( 15, 26, 36, 44)),
49
- array( 33, 100, 7, array( 20, 36, 52, 64)),
50
- array( 37, 134, 7, array( 26, 48, 72, 88)), // 5
51
- array( 41, 172, 7, array( 36, 64, 96, 112)),
52
- array( 45, 196, 0, array( 40, 72, 108, 130)),
53
- array( 49, 242, 0, array( 48, 88, 132, 156)),
54
- array( 53, 292, 0, array( 60, 110, 160, 192)),
55
- array( 57, 346, 0, array( 72, 130, 192, 224)), //10
56
- array( 61, 404, 0, array( 80, 150, 224, 264)),
57
- array( 65, 466, 0, array( 96, 176, 260, 308)),
58
- array( 69, 532, 0, array( 104, 198, 288, 352)),
59
- array( 73, 581, 3, array( 120, 216, 320, 384)),
60
- array( 77, 655, 3, array( 132, 240, 360, 432)), //15
61
- array( 81, 733, 3, array( 144, 280, 408, 480)),
62
- array( 85, 815, 3, array( 168, 308, 448, 532)),
63
- array( 89, 901, 3, array( 180, 338, 504, 588)),
64
- array( 93, 991, 3, array( 196, 364, 546, 650)),
65
- array( 97, 1085, 3, array( 224, 416, 600, 700)), //20
66
- array(101, 1156, 4, array( 224, 442, 644, 750)),
67
- array(105, 1258, 4, array( 252, 476, 690, 816)),
68
- array(109, 1364, 4, array( 270, 504, 750, 900)),
69
- array(113, 1474, 4, array( 300, 560, 810, 960)),
70
- array(117, 1588, 4, array( 312, 588, 870, 1050)), //25
71
- array(121, 1706, 4, array( 336, 644, 952, 1110)),
72
- array(125, 1828, 4, array( 360, 700, 1020, 1200)),
73
- array(129, 1921, 3, array( 390, 728, 1050, 1260)),
74
- array(133, 2051, 3, array( 420, 784, 1140, 1350)),
75
- array(137, 2185, 3, array( 450, 812, 1200, 1440)), //30
76
- array(141, 2323, 3, array( 480, 868, 1290, 1530)),
77
- array(145, 2465, 3, array( 510, 924, 1350, 1620)),
78
- array(149, 2611, 3, array( 540, 980, 1440, 1710)),
79
- array(153, 2761, 3, array( 570, 1036, 1530, 1800)),
80
- array(157, 2876, 0, array( 570, 1064, 1590, 1890)), //35
81
- array(161, 3034, 0, array( 600, 1120, 1680, 1980)),
82
- array(165, 3196, 0, array( 630, 1204, 1770, 2100)),
83
- array(169, 3362, 0, array( 660, 1260, 1860, 2220)),
84
- array(173, 3532, 0, array( 720, 1316, 1950, 2310)),
85
- array(177, 3706, 0, array( 750, 1372, 2040, 2430)) //40
86
- );
87
-
88
- //----------------------------------------------------------------------
89
- public static function getDataLength($version, $level)
90
- {
91
- return self::$capacity[$version][QRCAP_WORDS] - self::$capacity[$version][QRCAP_EC][$level];
92
- }
93
-
94
- //----------------------------------------------------------------------
95
- public static function getECCLength($version, $level)
96
- {
97
- return self::$capacity[$version][QRCAP_EC][$level];
98
- }
99
-
100
- //----------------------------------------------------------------------
101
- public static function getWidth($version)
102
- {
103
- return self::$capacity[$version][QRCAP_WIDTH];
104
- }
105
-
106
- //----------------------------------------------------------------------
107
- public static function getRemainder($version)
108
- {
109
- return self::$capacity[$version][QRCAP_REMINDER];
110
- }
111
-
112
- //----------------------------------------------------------------------
113
- public static function getMinimumVersion($size, $level)
114
- {
115
-
116
- for($i=1; $i<= QRSPEC_VERSION_MAX; $i++) {
117
- $words = self::$capacity[$i][QRCAP_WORDS] - self::$capacity[$i][QRCAP_EC][$level];
118
- if($words >= $size)
119
- return $i;
120
- }
121
-
122
- return -1;
123
- }
124
-
125
- //######################################################################
126
-
127
- public static $lengthTableBits = array(
128
- array(10, 12, 14),
129
- array( 9, 11, 13),
130
- array( 8, 16, 16),
131
- array( 8, 10, 12)
132
- );
133
-
134
- //----------------------------------------------------------------------
135
- public static function lengthIndicator($mode, $version)
136
- {
137
- if ($mode == QR_MODE_STRUCTURE)
138
- return 0;
139
-
140
- if ($version <= 9) {
141
- $l = 0;
142
- } else if ($version <= 26) {
143
- $l = 1;
144
- } else {
145
- $l = 2;
146
- }
147
-
148
- return self::$lengthTableBits[$mode][$l];
149
- }
150
-
151
- //----------------------------------------------------------------------
152
- public static function maximumWords($mode, $version)
153
- {
154
- if($mode == QR_MODE_STRUCTURE)
155
- return 3;
156
-
157
- if($version <= 9) {
158
- $l = 0;
159
- } else if($version <= 26) {
160
- $l = 1;
161
- } else {
162
- $l = 2;
163
- }
164
-
165
- $bits = self::$lengthTableBits[$mode][$l];
166
- $words = (1 << $bits) - 1;
167
-
168
- if($mode == QR_MODE_KANJI) {
169
- $words *= 2; // the number of bytes is required
170
- }
171
-
172
- return $words;
173
- }
174
-
175
- // Error correction code -----------------------------------------------
176
- // Table of the error correction code (Reed-Solomon block)
177
- // See Table 12-16 (pp.30-36), JIS X0510:2004.
178
-
179
- public static $eccTable = array(
180
- array(array( 0, 0), array( 0, 0), array( 0, 0), array( 0, 0)),
181
- array(array( 1, 0), array( 1, 0), array( 1, 0), array( 1, 0)), // 1
182
- array(array( 1, 0), array( 1, 0), array( 1, 0), array( 1, 0)),
183
- array(array( 1, 0), array( 1, 0), array( 2, 0), array( 2, 0)),
184
- array(array( 1, 0), array( 2, 0), array( 2, 0), array( 4, 0)),
185
- array(array( 1, 0), array( 2, 0), array( 2, 2), array( 2, 2)), // 5
186
- array(array( 2, 0), array( 4, 0), array( 4, 0), array( 4, 0)),
187
- array(array( 2, 0), array( 4, 0), array( 2, 4), array( 4, 1)),
188
- array(array( 2, 0), array( 2, 2), array( 4, 2), array( 4, 2)),
189
- array(array( 2, 0), array( 3, 2), array( 4, 4), array( 4, 4)),
190
- array(array( 2, 2), array( 4, 1), array( 6, 2), array( 6, 2)), //10
191
- array(array( 4, 0), array( 1, 4), array( 4, 4), array( 3, 8)),
192
- array(array( 2, 2), array( 6, 2), array( 4, 6), array( 7, 4)),
193
- array(array( 4, 0), array( 8, 1), array( 8, 4), array(12, 4)),
194
- array(array( 3, 1), array( 4, 5), array(11, 5), array(11, 5)),
195
- array(array( 5, 1), array( 5, 5), array( 5, 7), array(11, 7)), //15
196
- array(array( 5, 1), array( 7, 3), array(15, 2), array( 3, 13)),
197
- array(array( 1, 5), array(10, 1), array( 1, 15), array( 2, 17)),
198
- array(array( 5, 1), array( 9, 4), array(17, 1), array( 2, 19)),
199
- array(array( 3, 4), array( 3, 11), array(17, 4), array( 9, 16)),
200
- array(array( 3, 5), array( 3, 13), array(15, 5), array(15, 10)), //20
201
- array(array( 4, 4), array(17, 0), array(17, 6), array(19, 6)),
202
- array(array( 2, 7), array(17, 0), array( 7, 16), array(34, 0)),
203
- array(array( 4, 5), array( 4, 14), array(11, 14), array(16, 14)),
204
- array(array( 6, 4), array( 6, 14), array(11, 16), array(30, 2)),
205
- array(array( 8, 4), array( 8, 13), array( 7, 22), array(22, 13)), //25
206
- array(array(10, 2), array(19, 4), array(28, 6), array(33, 4)),
207
- array(array( 8, 4), array(22, 3), array( 8, 26), array(12, 28)),
208
- array(array( 3, 10), array( 3, 23), array( 4, 31), array(11, 31)),
209
- array(array( 7, 7), array(21, 7), array( 1, 37), array(19, 26)),
210
- array(array( 5, 10), array(19, 10), array(15, 25), array(23, 25)), //30
211
- array(array(13, 3), array( 2, 29), array(42, 1), array(23, 28)),
212
- array(array(17, 0), array(10, 23), array(10, 35), array(19, 35)),
213
- array(array(17, 1), array(14, 21), array(29, 19), array(11, 46)),
214
- array(array(13, 6), array(14, 23), array(44, 7), array(59, 1)),
215
- array(array(12, 7), array(12, 26), array(39, 14), array(22, 41)), //35
216
- array(array( 6, 14), array( 6, 34), array(46, 10), array( 2, 64)),
217
- array(array(17, 4), array(29, 14), array(49, 10), array(24, 46)),
218
- array(array( 4, 18), array(13, 32), array(48, 14), array(42, 32)),
219
- array(array(20, 4), array(40, 7), array(43, 22), array(10, 67)),
220
- array(array(19, 6), array(18, 31), array(34, 34), array(20, 61)),//40
221
- );
222
-
223
- //----------------------------------------------------------------------
224
- // CACHEABLE!!!
225
-
226
- public static function getEccSpec($version, $level, array &$spec)
227
- {
228
- if (count($spec) < 5) {
229
- $spec = array(0,0,0,0,0);
230
- }
231
-
232
- $b1 = self::$eccTable[$version][$level][0];
233
- $b2 = self::$eccTable[$version][$level][1];
234
- $data = self::getDataLength($version, $level);
235
- $ecc = self::getECCLength($version, $level);
236
-
237
- if($b2 == 0) {
238
- $spec[0] = $b1;
239
- $spec[1] = (int)($data / $b1);
240
- $spec[2] = (int)($ecc / $b1);
241
- $spec[3] = 0;
242
- $spec[4] = 0;
243
- } else {
244
- $spec[0] = $b1;
245
- $spec[1] = (int)($data / ($b1 + $b2));
246
- $spec[2] = (int)($ecc / ($b1 + $b2));
247
- $spec[3] = $b2;
248
- $spec[4] = $spec[1] + 1;
249
- }
250
- }
251
-
252
- // Alignment pattern ---------------------------------------------------
253
-
254
- // Positions of alignment patterns.
255
- // This array includes only the second and the third position of the
256
- // alignment patterns. Rest of them can be calculated from the distance
257
- // between them.
258
-
259
- // See Table 1 in Appendix E (pp.71) of JIS X0510:2004.
260
-
261
- public static $alignmentPattern = array(
262
- array( 0, 0),
263
- array( 0, 0), array(18, 0), array(22, 0), array(26, 0), array(30, 0), // 1- 5
264
- array(34, 0), array(22, 38), array(24, 42), array(26, 46), array(28, 50), // 6-10
265
- array(30, 54), array(32, 58), array(34, 62), array(26, 46), array(26, 48), //11-15
266
- array(26, 50), array(30, 54), array(30, 56), array(30, 58), array(34, 62), //16-20
267
- array(28, 50), array(26, 50), array(30, 54), array(28, 54), array(32, 58), //21-25
268
- array(30, 58), array(34, 62), array(26, 50), array(30, 54), array(26, 52), //26-30
269
- array(30, 56), array(34, 60), array(30, 58), array(34, 62), array(30, 54), //31-35
270
- array(24, 50), array(28, 54), array(32, 58), array(26, 54), array(30, 58), //35-40
271
- );
272
-
273
-
274
- /** --------------------------------------------------------------------
275
- * Put an alignment marker.
276
- * @param frame
277
- * @param width
278
- * @param ox,oy center coordinate of the pattern
279
- */
280
- public static function putAlignmentMarker(array &$frame, $ox, $oy)
281
- {
282
- $finder = array(
283
- "\xa1\xa1\xa1\xa1\xa1",
284
- "\xa1\xa0\xa0\xa0\xa1",
285
- "\xa1\xa0\xa1\xa0\xa1",
286
- "\xa1\xa0\xa0\xa0\xa1",
287
- "\xa1\xa1\xa1\xa1\xa1"
288
- );
289
-
290
- $yStart = $oy-2;
291
- $xStart = $ox-2;
292
-
293
- for($y=0; $y<5; $y++) {
294
- QRstr::set($frame, $xStart, $yStart+$y, $finder[$y]);
295
- }
296
- }
297
-
298
- //----------------------------------------------------------------------
299
- public static function putAlignmentPattern($version, &$frame, $width)
300
- {
301
- if($version < 2)
302
- return;
303
-
304
- $d = self::$alignmentPattern[$version][1] - self::$alignmentPattern[$version][0];
305
- if($d < 0) {
306
- $w = 2;
307
- } else {
308
- $w = (int)(($width - self::$alignmentPattern[$version][0]) / $d + 2);
309
- }
310
-
311
- if($w * $w - 3 == 1) {
312
- $x = self::$alignmentPattern[$version][0];
313
- $y = self::$alignmentPattern[$version][0];
314
- self::putAlignmentMarker($frame, $x, $y);
315
- return;
316
- }
317
-
318
- $cx = self::$alignmentPattern[$version][0];
319
- for($x=1; $x<$w - 1; $x++) {
320
- self::putAlignmentMarker($frame, 6, $cx);
321
- self::putAlignmentMarker($frame, $cx, 6);
322
- $cx += $d;
323
- }
324
-
325
- $cy = self::$alignmentPattern[$version][0];
326
- for($y=0; $y<$w-1; $y++) {
327
- $cx = self::$alignmentPattern[$version][0];
328
- for($x=0; $x<$w-1; $x++) {
329
- self::putAlignmentMarker($frame, $cx, $cy);
330
- $cx += $d;
331
- }
332
- $cy += $d;
333
- }
334
- }
335
-
336
- // Version information pattern -----------------------------------------
337
-
338
- // Version information pattern (BCH coded).
339
- // See Table 1 in Appendix D (pp.68) of JIS X0510:2004.
340
-
341
- // size: [QRSPEC_VERSION_MAX - 6]
342
-
343
- public static $versionPattern = array(
344
- 0x07c94, 0x085bc, 0x09a99, 0x0a4d3, 0x0bbf6, 0x0c762, 0x0d847, 0x0e60d,
345
- 0x0f928, 0x10b78, 0x1145d, 0x12a17, 0x13532, 0x149a6, 0x15683, 0x168c9,
346
- 0x177ec, 0x18ec4, 0x191e1, 0x1afab, 0x1b08e, 0x1cc1a, 0x1d33f, 0x1ed75,
347
- 0x1f250, 0x209d5, 0x216f0, 0x228ba, 0x2379f, 0x24b0b, 0x2542e, 0x26a64,
348
- 0x27541, 0x28c69
349
- );
350
-
351
- //----------------------------------------------------------------------
352
- public static function getVersionPattern($version)
353
- {
354
- if($version < 7 || $version > QRSPEC_VERSION_MAX)
355
- return 0;
356
-
357
- return self::$versionPattern[$version -7];
358
- }
359
-
360
- // Format information --------------------------------------------------
361
- // See calcFormatInfo in tests/test_qrspec.c (orginal qrencode c lib)
362
-
363
- public static $formatInfo = array(
364
- array(0x77c4, 0x72f3, 0x7daa, 0x789d, 0x662f, 0x6318, 0x6c41, 0x6976),
365
- array(0x5412, 0x5125, 0x5e7c, 0x5b4b, 0x45f9, 0x40ce, 0x4f97, 0x4aa0),
366
- array(0x355f, 0x3068, 0x3f31, 0x3a06, 0x24b4, 0x2183, 0x2eda, 0x2bed),
367
- array(0x1689, 0x13be, 0x1ce7, 0x19d0, 0x0762, 0x0255, 0x0d0c, 0x083b)
368
- );
369
-
370
- public static function getFormatInfo($mask, $level)
371
- {
372
- if($mask < 0 || $mask > 7)
373
- return 0;
374
-
375
- if($level < 0 || $level > 3)
376
- return 0;
377
-
378
- return self::$formatInfo[$level][$mask];
379
- }
380
-
381
- // Frame ---------------------------------------------------------------
382
- // Cache of initial frames.
383
-
384
- public static $frames = array();
385
-
386
- /** --------------------------------------------------------------------
387
- * Put a finder pattern.
388
- * @param frame
389
- * @param width
390
- * @param ox,oy upper-left coordinate of the pattern
391
- */
392
- public static function putFinderPattern(&$frame, $ox, $oy)
393
- {
394
- $finder = array(
395
- "\xc1\xc1\xc1\xc1\xc1\xc1\xc1",
396
- "\xc1\xc0\xc0\xc0\xc0\xc0\xc1",
397
- "\xc1\xc0\xc1\xc1\xc1\xc0\xc1",
398
- "\xc1\xc0\xc1\xc1\xc1\xc0\xc1",
399
- "\xc1\xc0\xc1\xc1\xc1\xc0\xc1",
400
- "\xc1\xc0\xc0\xc0\xc0\xc0\xc1",
401
- "\xc1\xc1\xc1\xc1\xc1\xc1\xc1"
402
- );
403
-
404
- for($y=0; $y<7; $y++) {
405
- QRstr::set($frame, $ox, $oy+$y, $finder[$y]);
406
- }
407
- }
408
-
409
- //----------------------------------------------------------------------
410
- public static function createFrame($version)
411
- {
412
- $width = self::$capacity[$version][QRCAP_WIDTH];
413
- $frameLine = str_repeat ("\0", $width);
414
- $frame = array_fill(0, $width, $frameLine);
415
-
416
- // Finder pattern
417
- self::putFinderPattern($frame, 0, 0);
418
- self::putFinderPattern($frame, $width - 7, 0);
419
- self::putFinderPattern($frame, 0, $width - 7);
420
-
421
- // Separator
422
- $yOffset = $width - 7;
423
-
424
- for($y=0; $y<7; $y++) {
425
- $frame[$y][7] = "\xc0";
426
- $frame[$y][$width - 8] = "\xc0";
427
- $frame[$yOffset][7] = "\xc0";
428
- $yOffset++;
429
- }
430
-
431
- $setPattern = str_repeat("\xc0", 8);
432
-
433
- QRstr::set($frame, 0, 7, $setPattern);
434
- QRstr::set($frame, $width-8, 7, $setPattern);
435
- QRstr::set($frame, 0, $width - 8, $setPattern);
436
-
437
- // Format info
438
- $setPattern = str_repeat("\x84", 9);
439
- QRstr::set($frame, 0, 8, $setPattern);
440
- QRstr::set($frame, $width - 8, 8, $setPattern, 8);
441
-
442
- $yOffset = $width - 8;
443
-
444
- for($y=0; $y<8; $y++,$yOffset++) {
445
- $frame[$y][8] = "\x84";
446
- $frame[$yOffset][8] = "\x84";
447
- }
448
-
449
- // Timing pattern
450
-
451
- for($i=1; $i<$width-15; $i++) {
452
- $frame[6][7+$i] = chr(0x90 | ($i & 1));
453
- $frame[7+$i][6] = chr(0x90 | ($i & 1));
454
- }
455
-
456
- // Alignment pattern
457
- self::putAlignmentPattern($version, $frame, $width);
458
-
459
- // Version information
460
- if($version >= 7) {
461
- $vinf = self::getVersionPattern($version);
462
-
463
- $v = $vinf;
464
-
465
- for($x=0; $x<6; $x++) {
466
- for($y=0; $y<3; $y++) {
467
- $frame[($width - 11)+$y][$x] = chr(0x88 | ($v & 1));
468
- $v = $v >> 1;
469
- }
470
- }
471
-
472
- $v = $vinf;
473
- for($y=0; $y<6; $y++) {
474
- for($x=0; $x<3; $x++) {
475
- $frame[$y][$x+($width - 11)] = chr(0x88 | ($v & 1));
476
- $v = $v >> 1;
477
- }
478
- }
479
- }
480
-
481
- // and a little bit...
482
- $frame[$width - 8][8] = "\x81";
483
-
484
- return $frame;
485
- }
486
-
487
- //----------------------------------------------------------------------
488
- public static function debug($frame, $binary_mode = false)
489
- {
490
- if ($binary_mode) {
491
-
492
- foreach ($frame as &$frameLine) {
493
- $frameLine = join('<span class="m">&nbsp;&nbsp;</span>', explode('0', $frameLine));
494
- $frameLine = join('&#9608;&#9608;', explode('1', $frameLine));
495
- }
496
-
497
- ?>
498
- <style>
499
- .m { background-color: white; }
500
- </style>
501
- <?php
502
- echo '<pre><tt><br/ ><br/ ><br/ >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
503
- echo join("<br/ >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", $frame);
504
- echo '</tt></pre><br/ ><br/ ><br/ ><br/ ><br/ ><br/ >';
505
-
506
- } else {
507
-
508
- foreach ($frame as &$frameLine) {
509
- $frameLine = join('<span class="m">&nbsp;</span>', explode("\xc0", $frameLine));
510
- $frameLine = join('<span class="m">&#9618;</span>', explode("\xc1", $frameLine));
511
- $frameLine = join('<span class="p">&nbsp;</span>', explode("\xa0", $frameLine));
512
- $frameLine = join('<span class="p">&#9618;</span>', explode("\xa1", $frameLine));
513
- $frameLine = join('<span class="s">&#9671;</span>', explode("\x84", $frameLine)); //format 0
514
- $frameLine = join('<span class="s">&#9670;</span>', explode("\x85", $frameLine)); //format 1
515
- $frameLine = join('<span class="x">&#9762;</span>', explode("\x81", $frameLine)); //special bit
516
- $frameLine = join('<span class="c">&nbsp;</span>', explode("\x90", $frameLine)); //clock 0
517
- $frameLine = join('<span class="c">&#9719;</span>', explode("\x91", $frameLine)); //clock 1
518
- $frameLine = join('<span class="f">&nbsp;</span>', explode("\x88", $frameLine)); //version
519
- $frameLine = join('<span class="f">&#9618;</span>', explode("\x89", $frameLine)); //version
520
- $frameLine = join('&#9830;', explode("\x01", $frameLine));
521
- $frameLine = join('&#8901;', explode("\0", $frameLine));
522
- }
523
-
524
- ?>
525
- <style>
526
- .p { background-color: yellow; }
527
- .m { background-color: #00FF00; }
528
- .s { background-color: #FF0000; }
529
- .c { background-color: aqua; }
530
- .x { background-color: pink; }
531
- .f { background-color: gold; }
532
- </style>
533
- <?php
534
- echo "<pre><tt>";
535
- echo join("<br/ >", $frame);
536
- echo "</tt></pre>";
537
-
538
- }
539
- }
540
-
541
- //----------------------------------------------------------------------
542
- public static function serial($frame)
543
- {
544
- return gzcompress(join("\n", $frame), 9);
545
- }
546
-
547
- //----------------------------------------------------------------------
548
- public static function unserial($code)
549
- {
550
- return explode("\n", gzuncompress($code));
551
- }
552
-
553
- //----------------------------------------------------------------------
554
- public static function newFrame($version)
555
- {
556
- if($version < 1 || $version > QRSPEC_VERSION_MAX)
557
- return null;
558
-
559
- if(!isset(self::$frames[$version])) {
560
-
561
- $fileName = QR_CACHE_DIR.'frame_'.$version.'.dat';
562
-
563
- if (QR_CACHEABLE) {
564
- if (file_exists($fileName)) {
565
- self::$frames[$version] = self::unserial(file_get_contents($fileName));
566
- } else {
567
- self::$frames[$version] = self::createFrame($version);
568
- file_put_contents($fileName, self::serial(self::$frames[$version]));
569
- }
570
- } else {
571
- self::$frames[$version] = self::createFrame($version);
572
- }
573
- }
574
-
575
- if(is_null(self::$frames[$version]))
576
- return null;
577
-
578
- return self::$frames[$version];
579
- }
580
-
581
- //----------------------------------------------------------------------
582
- public static function rsBlockNum($spec) { return $spec[0] + $spec[3]; }
583
- public static function rsBlockNum1($spec) { return $spec[0]; }
584
- public static function rsDataCodes1($spec) { return $spec[1]; }
585
- public static function rsEccCodes1($spec) { return $spec[2]; }
586
- public static function rsBlockNum2($spec) { return $spec[3]; }
587
- public static function rsDataCodes2($spec) { return $spec[4]; }
588
- public static function rsEccCodes2($spec) { return $spec[2]; }
589
- public static function rsDataLength($spec) { return ($spec[0] * $spec[1]) + ($spec[3] * $spec[4]); }
590
- public static function rsEccLength($spec) { return ($spec[0] + $spec[3]) * $spec[2]; }
591
-
592
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pro/vendor/phpqrcode/qrsplit.php DELETED
@@ -1,311 +0,0 @@
1
- <?php
2
- /*
3
- * PHP QR Code encoder
4
- *
5
- * Input splitting classes
6
- *
7
- * Based on libqrencode C library distributed under LGPL 2.1
8
- * Copyright (C) 2006, 2007, 2008, 2009 Kentaro Fukuchi <fukuchi@megaui.net>
9
- *
10
- * PHP QR Code is distributed under LGPL 3
11
- * Copyright (C) 2010 Dominik Dzienia <deltalab at poczta dot fm>
12
- *
13
- * The following data / specifications are taken from
14
- * "Two dimensional symbol -- QR-code -- Basic Specification" (JIS X0510:2004)
15
- * or
16
- * "Automatic identification and data capture techniques --
17
- * QR Code 2005 bar code symbology specification" (ISO/IEC 18004:2006)
18
- *
19
- * This library is free software; you can redistribute it and/or
20
- * modify it under the terms of the GNU Lesser General Public
21
- * License as published by the Free Software Foundation; either
22
- * version 3 of the License, or any later version.
23
- *
24
- * This library is distributed in the hope that it will be useful,
25
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
26
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
27
- * Lesser General Public License for more details.
28
- *
29
- * You should have received a copy of the GNU Lesser General Public
30
- * License along with this library; if not, write to the Free Software
31
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
32
- */
33
- class QRsplit {
34
-
35
- public $dataStr = '';
36
- public $input;
37
- public $modeHint;
38
-
39
- //----------------------------------------------------------------------
40
- public function __construct($dataStr, $input, $modeHint)
41
- {
42
- $this->dataStr = $dataStr;
43
- $this->input = $input;
44
- $this->modeHint = $modeHint;
45
- }
46
-
47
- //----------------------------------------------------------------------
48
- public static function isdigitat($str, $pos)
49
- {
50
- if ($pos >= strlen($str))
51
- return false;
52
-
53
- return ((ord($str[$pos]) >= ord('0'))&&(ord($str[$pos]) <= ord('9')));
54
- }
55
-
56
- //----------------------------------------------------------------------
57
- public static function isalnumat($str, $pos)
58
- {
59
- if ($pos >= strlen($str))
60
- return false;
61
-
62
- return (QRinput::lookAnTable(ord($str[$pos])) >= 0);
63
- }
64
-
65
- //----------------------------------------------------------------------
66
- public function identifyMode($pos)
67
- {
68
- if ($pos >= strlen($this->dataStr))
69
- return QR_MODE_NUL;
70
-
71
- $c = $this->dataStr[$pos];
72
-
73
- if(self::isdigitat($this->dataStr, $pos)) {
74
- return QR_MODE_NUM;
75
- } else if(self::isalnumat($this->dataStr, $pos)) {
76
- return QR_MODE_AN;
77
- } else if($this->modeHint == QR_MODE_KANJI) {
78
-
79
- if ($pos+1 < strlen($this->dataStr))
80
- {
81
- $d = $this->dataStr[$pos+1];
82
- $word = (ord($c) << 8) | ord($d);
83
- if(($word >= 0x8140 && $word <= 0x9ffc) || ($word >= 0xe040 && $word <= 0xebbf)) {
84
- return QR_MODE_KANJI;
85
- }
86
- }
87
- }
88
-
89
- return QR_MODE_8;
90
- }
91
-
92
- //----------------------------------------------------------------------
93
- public function eatNum()
94
- {
95
- $ln = QRspec::lengthIndicator(QR_MODE_NUM, $this->input->getVersion());
96
-
97
- $p = 0;
98
- while(self::isdigitat($this->dataStr, $p)) {
99
- $p++;
100
- }
101
-
102
- $run = $p;
103
- $mode = $this->identifyMode($p);
104
-
105
- if($mode == QR_MODE_8) {
106
- $dif = QRinput::estimateBitsModeNum($run) + 4 + $ln
107
- + QRinput::estimateBitsMode8(1) // + 4 + l8
108
- - QRinput::estimateBitsMode8($run + 1); // - 4 - l8
109
- if($dif > 0) {
110
- return $this->eat8();
111
- }
112
- }
113
- if($mode == QR_MODE_AN) {
114
- $dif = QRinput::estimateBitsModeNum($run) + 4 + $ln
115
- + QRinput::estimateBitsModeAn(1) // + 4 + la
116
- - QRinput::estimateBitsModeAn($run + 1);// - 4 - la
117
- if($dif > 0) {
118
- return $this->eatAn();
119
- }
120
- }
121
-
122
- $ret = $this->input->append(QR_MODE_NUM, $run, str_split($this->dataStr));
123
- if($ret < 0)
124
- return -1;
125
-
126
- return $run;
127
- }
128
-
129
- //----------------------------------------------------------------------
130
- public function eatAn()
131
- {
132
- $la = QRspec::lengthIndicator(QR_MODE_AN, $this->input->getVersion());
133
- $ln = QRspec::lengthIndicator(QR_MODE_NUM, $this->input->getVersion());
134
-
135
- $p = 0;
136
-
137
- while(self::isalnumat($this->dataStr, $p)) {
138
- if(self::isdigitat($this->dataStr, $p)) {
139
- $q = $p;
140
- while(self::isdigitat($this->dataStr, $q)) {
141
- $q++;
142
- }
143
-
144
- $dif = QRinput::estimateBitsModeAn($p) // + 4 + la
145
- + QRinput::estimateBitsModeNum($q - $p) + 4 + $ln
146
- - QRinput::estimateBitsModeAn($q); // - 4 - la
147
-
148
- if($dif < 0) {
149
- break;
150
- } else {
151
- $p = $q;
152
- }
153
- } else {
154
- $p++;
155
- }
156
- }
157
-
158
- $run = $p;
159
-
160
- if(!self::isalnumat($this->dataStr, $p)) {
161
- $dif = QRinput::estimateBitsModeAn($run) + 4 + $la
162
- + QRinput::estimateBitsMode8(1) // + 4 + l8
163
- - QRinput::estimateBitsMode8($run + 1); // - 4 - l8
164
- if($dif > 0) {
165
- return $this->eat8();
166
- }
167
- }
168
-
169
- $ret = $this->input->append(QR_MODE_AN, $run, str_split($this->dataStr));
170
- if($ret < 0)
171
- return -1;
172
-
173
- return $run;
174
- }
175
-
176
- //----------------------------------------------------------------------
177
- public function eatKanji()
178
- {
179
- $p = 0;
180
-
181
- while($this->identifyMode($p) == QR_MODE_KANJI) {
182
- $p += 2;
183
- }
184
-
185
- $ret = $this->input->append(QR_MODE_KANJI, $p, str_split($this->dataStr));
186
- if($ret < 0)
187
- return -1;
188
-
189
- return $ret;
190
- }
191
-
192
- //----------------------------------------------------------------------
193
- public function eat8()
194
- {
195
- $la = QRspec::lengthIndicator(QR_MODE_AN, $this->input->getVersion());
196
- $ln = QRspec::lengthIndicator(QR_MODE_NUM, $this->input->getVersion());
197
-
198
- $p = 1;
199
- $dataStrLen = strlen($this->dataStr);
200
-
201
- while($p < $dataStrLen) {
202
-
203
- $mode = $this->identifyMode($p);
204
- if($mode == QR_MODE_KANJI) {
205
- break;
206
- }
207
- if($mode == QR_MODE_NUM) {
208
- $q = $p;
209
- while(self::isdigitat($this->dataStr, $q)) {
210
- $q++;
211
- }
212
- $dif = QRinput::estimateBitsMode8($p) // + 4 + l8
213
- + QRinp