stump-cli 0.1.3 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1243) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +1 -0
  3. data/README.md +9 -5
  4. data/bin/stump-cli +77 -27
  5. data/lib/{wp/.gitignore → .gitignore.erb} +2 -2
  6. data/lib/stump-cli/version.rb +1 -1
  7. data/lib/style.erb +11 -0
  8. data/stump-cli.gemspec +2 -0
  9. metadata +56 -1268
  10. data/lib/wp/Movefile-example +0 -62
  11. data/lib/wp/README.md +0 -25
  12. data/lib/wp/index.php +0 -17
  13. data/lib/wp/license.txt +0 -385
  14. data/lib/wp/readme.html +0 -96
  15. data/lib/wp/wp-activate.php +0 -131
  16. data/lib/wp/wp-admin/about.php +0 -193
  17. data/lib/wp/wp-admin/admin-ajax.php +0 -98
  18. data/lib/wp/wp-admin/admin-footer.php +0 -99
  19. data/lib/wp/wp-admin/admin-functions.php +0 -15
  20. data/lib/wp/wp-admin/admin-header.php +0 -243
  21. data/lib/wp/wp-admin/admin-post.php +0 -71
  22. data/lib/wp/wp-admin/admin.php +0 -347
  23. data/lib/wp/wp-admin/async-upload.php +0 -114
  24. data/lib/wp/wp-admin/comment.php +0 -299
  25. data/lib/wp/wp-admin/credits.php +0 -192
  26. data/lib/wp/wp-admin/css/about-rtl.css +0 -446
  27. data/lib/wp/wp-admin/css/about.css +0 -446
  28. data/lib/wp/wp-admin/css/admin-menu-rtl.css +0 -917
  29. data/lib/wp/wp-admin/css/admin-menu.css +0 -917
  30. data/lib/wp/wp-admin/css/color-picker-rtl.css +0 -127
  31. data/lib/wp/wp-admin/css/color-picker-rtl.min.css +0 -1
  32. data/lib/wp/wp-admin/css/color-picker.css +0 -127
  33. data/lib/wp/wp-admin/css/color-picker.min.css +0 -1
  34. data/lib/wp/wp-admin/css/colors/_admin.scss +0 -525
  35. data/lib/wp/wp-admin/css/colors/_mixins.scss +0 -43
  36. data/lib/wp/wp-admin/css/colors/_variables.scss +0 -58
  37. data/lib/wp/wp-admin/css/colors/blue/colors-rtl.css +0 -341
  38. data/lib/wp/wp-admin/css/colors/blue/colors-rtl.min.css +0 -1
  39. data/lib/wp/wp-admin/css/colors/blue/colors.css +0 -341
  40. data/lib/wp/wp-admin/css/colors/blue/colors.min.css +0 -1
  41. data/lib/wp/wp-admin/css/colors/blue/colors.scss +0 -11
  42. data/lib/wp/wp-admin/css/colors/coffee/colors-rtl.css +0 -341
  43. data/lib/wp/wp-admin/css/colors/coffee/colors-rtl.min.css +0 -1
  44. data/lib/wp/wp-admin/css/colors/coffee/colors.css +0 -341
  45. data/lib/wp/wp-admin/css/colors/coffee/colors.min.css +0 -1
  46. data/lib/wp/wp-admin/css/colors/coffee/colors.scss +0 -7
  47. data/lib/wp/wp-admin/css/colors/ectoplasm/colors-rtl.css +0 -341
  48. data/lib/wp/wp-admin/css/colors/ectoplasm/colors-rtl.min.css +0 -1
  49. data/lib/wp/wp-admin/css/colors/ectoplasm/colors.css +0 -341
  50. data/lib/wp/wp-admin/css/colors/ectoplasm/colors.min.css +0 -1
  51. data/lib/wp/wp-admin/css/colors/ectoplasm/colors.scss +0 -8
  52. data/lib/wp/wp-admin/css/colors/light/colors-rtl.css +0 -349
  53. data/lib/wp/wp-admin/css/colors/light/colors-rtl.min.css +0 -1
  54. data/lib/wp/wp-admin/css/colors/light/colors.css +0 -349
  55. data/lib/wp/wp-admin/css/colors/light/colors.min.css +0 -1
  56. data/lib/wp/wp-admin/css/colors/light/colors.scss +0 -38
  57. data/lib/wp/wp-admin/css/colors/midnight/colors-rtl.css +0 -341
  58. data/lib/wp/wp-admin/css/colors/midnight/colors-rtl.min.css +0 -1
  59. data/lib/wp/wp-admin/css/colors/midnight/colors.css +0 -341
  60. data/lib/wp/wp-admin/css/colors/midnight/colors.min.css +0 -1
  61. data/lib/wp/wp-admin/css/colors/midnight/colors.scss +0 -5
  62. data/lib/wp/wp-admin/css/colors/ocean/colors-rtl.css +0 -341
  63. data/lib/wp/wp-admin/css/colors/ocean/colors-rtl.min.css +0 -1
  64. data/lib/wp/wp-admin/css/colors/ocean/colors.css +0 -341
  65. data/lib/wp/wp-admin/css/colors/ocean/colors.min.css +0 -1
  66. data/lib/wp/wp-admin/css/colors/ocean/colors.scss +0 -8
  67. data/lib/wp/wp-admin/css/colors/sunrise/colors-rtl.css +0 -341
  68. data/lib/wp/wp-admin/css/colors/sunrise/colors-rtl.min.css +0 -1
  69. data/lib/wp/wp-admin/css/colors/sunrise/colors.css +0 -341
  70. data/lib/wp/wp-admin/css/colors/sunrise/colors.min.css +0 -1
  71. data/lib/wp/wp-admin/css/colors/sunrise/colors.scss +0 -6
  72. data/lib/wp/wp-admin/css/common-rtl.css +0 -3212
  73. data/lib/wp/wp-admin/css/common.css +0 -3212
  74. data/lib/wp/wp-admin/css/customize-controls-rtl.css +0 -889
  75. data/lib/wp/wp-admin/css/customize-controls-rtl.min.css +0 -1
  76. data/lib/wp/wp-admin/css/customize-controls.css +0 -889
  77. data/lib/wp/wp-admin/css/customize-controls.min.css +0 -1
  78. data/lib/wp/wp-admin/css/customize-widgets-rtl.css +0 -603
  79. data/lib/wp/wp-admin/css/customize-widgets-rtl.min.css +0 -1
  80. data/lib/wp/wp-admin/css/customize-widgets.css +0 -603
  81. data/lib/wp/wp-admin/css/customize-widgets.min.css +0 -1
  82. data/lib/wp/wp-admin/css/dashboard-rtl.css +0 -1116
  83. data/lib/wp/wp-admin/css/dashboard.css +0 -1116
  84. data/lib/wp/wp-admin/css/deprecated-media-rtl.css +0 -371
  85. data/lib/wp/wp-admin/css/deprecated-media-rtl.min.css +0 -1
  86. data/lib/wp/wp-admin/css/deprecated-media.css +0 -371
  87. data/lib/wp/wp-admin/css/deprecated-media.min.css +0 -1
  88. data/lib/wp/wp-admin/css/edit-rtl.css +0 -1501
  89. data/lib/wp/wp-admin/css/edit.css +0 -1501
  90. data/lib/wp/wp-admin/css/farbtastic-rtl.css +0 -41
  91. data/lib/wp/wp-admin/css/farbtastic.css +0 -41
  92. data/lib/wp/wp-admin/css/forms-rtl.css +0 -992
  93. data/lib/wp/wp-admin/css/forms.css +0 -992
  94. data/lib/wp/wp-admin/css/ie-rtl.css +0 -785
  95. data/lib/wp/wp-admin/css/ie-rtl.min.css +0 -1
  96. data/lib/wp/wp-admin/css/ie.css +0 -785
  97. data/lib/wp/wp-admin/css/ie.min.css +0 -1
  98. data/lib/wp/wp-admin/css/install-rtl.css +0 -389
  99. data/lib/wp/wp-admin/css/install-rtl.min.css +0 -1
  100. data/lib/wp/wp-admin/css/install.css +0 -389
  101. data/lib/wp/wp-admin/css/install.min.css +0 -1
  102. data/lib/wp/wp-admin/css/l10n-rtl.css +0 -101
  103. data/lib/wp/wp-admin/css/l10n.css +0 -101
  104. data/lib/wp/wp-admin/css/list-tables-rtl.css +0 -1875
  105. data/lib/wp/wp-admin/css/list-tables.css +0 -1875
  106. data/lib/wp/wp-admin/css/login-rtl.css +0 -269
  107. data/lib/wp/wp-admin/css/login-rtl.min.css +0 -1
  108. data/lib/wp/wp-admin/css/login.css +0 -269
  109. data/lib/wp/wp-admin/css/login.min.css +0 -1
  110. data/lib/wp/wp-admin/css/media-rtl.css +0 -1196
  111. data/lib/wp/wp-admin/css/media.css +0 -1196
  112. data/lib/wp/wp-admin/css/nav-menus-rtl.css +0 -857
  113. data/lib/wp/wp-admin/css/nav-menus.css +0 -857
  114. data/lib/wp/wp-admin/css/press-this-rtl.css +0 -458
  115. data/lib/wp/wp-admin/css/press-this.css +0 -458
  116. data/lib/wp/wp-admin/css/revisions-rtl.css +0 -574
  117. data/lib/wp/wp-admin/css/revisions.css +0 -574
  118. data/lib/wp/wp-admin/css/themes-rtl.css +0 -1732
  119. data/lib/wp/wp-admin/css/themes.css +0 -1732
  120. data/lib/wp/wp-admin/css/widgets-rtl.css +0 -577
  121. data/lib/wp/wp-admin/css/widgets.css +0 -577
  122. data/lib/wp/wp-admin/css/wp-admin-rtl.css +0 -14
  123. data/lib/wp/wp-admin/css/wp-admin-rtl.min.css +0 -1
  124. data/lib/wp/wp-admin/css/wp-admin.css +0 -14
  125. data/lib/wp/wp-admin/css/wp-admin.min.css +0 -1
  126. data/lib/wp/wp-admin/custom-background.php +0 -482
  127. data/lib/wp/wp-admin/custom-header.php +0 -1366
  128. data/lib/wp/wp-admin/customize.php +0 -278
  129. data/lib/wp/wp-admin/edit-comments.php +0 -254
  130. data/lib/wp/wp-admin/edit-form-advanced.php +0 -636
  131. data/lib/wp/wp-admin/edit-form-comment.php +0 -160
  132. data/lib/wp/wp-admin/edit-link-form.php +0 -150
  133. data/lib/wp/wp-admin/edit-tag-form.php +0 -204
  134. data/lib/wp/wp-admin/edit-tags.php +0 -591
  135. data/lib/wp/wp-admin/edit.php +0 -330
  136. data/lib/wp/wp-admin/export.php +0 -243
  137. data/lib/wp/wp-admin/freedoms.php +0 -57
  138. data/lib/wp/wp-admin/images/align-center-2x.png +0 -0
  139. data/lib/wp/wp-admin/images/align-center.png +0 -0
  140. data/lib/wp/wp-admin/images/align-left-2x.png +0 -0
  141. data/lib/wp/wp-admin/images/align-left.png +0 -0
  142. data/lib/wp/wp-admin/images/align-none-2x.png +0 -0
  143. data/lib/wp/wp-admin/images/align-none.png +0 -0
  144. data/lib/wp/wp-admin/images/align-right-2x.png +0 -0
  145. data/lib/wp/wp-admin/images/align-right.png +0 -0
  146. data/lib/wp/wp-admin/images/arrows-2x.png +0 -0
  147. data/lib/wp/wp-admin/images/arrows.png +0 -0
  148. data/lib/wp/wp-admin/images/bubble_bg-2x.gif +0 -0
  149. data/lib/wp/wp-admin/images/bubble_bg.gif +0 -0
  150. data/lib/wp/wp-admin/images/comment-grey-bubble-2x.png +0 -0
  151. data/lib/wp/wp-admin/images/comment-grey-bubble.png +0 -0
  152. data/lib/wp/wp-admin/images/date-button-2x.gif +0 -0
  153. data/lib/wp/wp-admin/images/date-button.gif +0 -0
  154. data/lib/wp/wp-admin/images/generic.png +0 -0
  155. data/lib/wp/wp-admin/images/icons32-2x.png +0 -0
  156. data/lib/wp/wp-admin/images/icons32-vs-2x.png +0 -0
  157. data/lib/wp/wp-admin/images/icons32-vs.png +0 -0
  158. data/lib/wp/wp-admin/images/icons32.png +0 -0
  159. data/lib/wp/wp-admin/images/imgedit-icons-2x.png +0 -0
  160. data/lib/wp/wp-admin/images/imgedit-icons.png +0 -0
  161. data/lib/wp/wp-admin/images/list-2x.png +0 -0
  162. data/lib/wp/wp-admin/images/list.png +0 -0
  163. data/lib/wp/wp-admin/images/loading.gif +0 -0
  164. data/lib/wp/wp-admin/images/marker.png +0 -0
  165. data/lib/wp/wp-admin/images/mask.png +0 -0
  166. data/lib/wp/wp-admin/images/media-button-2x.png +0 -0
  167. data/lib/wp/wp-admin/images/media-button-image.gif +0 -0
  168. data/lib/wp/wp-admin/images/media-button-music.gif +0 -0
  169. data/lib/wp/wp-admin/images/media-button-other.gif +0 -0
  170. data/lib/wp/wp-admin/images/media-button-video.gif +0 -0
  171. data/lib/wp/wp-admin/images/media-button.png +0 -0
  172. data/lib/wp/wp-admin/images/menu-2x.png +0 -0
  173. data/lib/wp/wp-admin/images/menu-vs-2x.png +0 -0
  174. data/lib/wp/wp-admin/images/menu-vs.png +0 -0
  175. data/lib/wp/wp-admin/images/menu.png +0 -0
  176. data/lib/wp/wp-admin/images/no.png +0 -0
  177. data/lib/wp/wp-admin/images/post-formats-vs.png +0 -0
  178. data/lib/wp/wp-admin/images/post-formats.png +0 -0
  179. data/lib/wp/wp-admin/images/post-formats32-vs.png +0 -0
  180. data/lib/wp/wp-admin/images/post-formats32.png +0 -0
  181. data/lib/wp/wp-admin/images/resize-2x.gif +0 -0
  182. data/lib/wp/wp-admin/images/resize-rtl-2x.gif +0 -0
  183. data/lib/wp/wp-admin/images/resize-rtl.gif +0 -0
  184. data/lib/wp/wp-admin/images/resize.gif +0 -0
  185. data/lib/wp/wp-admin/images/se.png +0 -0
  186. data/lib/wp/wp-admin/images/sort-2x.gif +0 -0
  187. data/lib/wp/wp-admin/images/sort.gif +0 -0
  188. data/lib/wp/wp-admin/images/spinner-2x.gif +0 -0
  189. data/lib/wp/wp-admin/images/spinner.gif +0 -0
  190. data/lib/wp/wp-admin/images/stars-2x.png +0 -0
  191. data/lib/wp/wp-admin/images/stars.png +0 -0
  192. data/lib/wp/wp-admin/images/w-logo-blue.png +0 -0
  193. data/lib/wp/wp-admin/images/w-logo-white.png +0 -0
  194. data/lib/wp/wp-admin/images/wheel.png +0 -0
  195. data/lib/wp/wp-admin/images/wordpress-logo-white.svg +0 -1
  196. data/lib/wp/wp-admin/images/wordpress-logo.png +0 -0
  197. data/lib/wp/wp-admin/images/wordpress-logo.svg +0 -1
  198. data/lib/wp/wp-admin/images/wpspin_light-2x.gif +0 -0
  199. data/lib/wp/wp-admin/images/wpspin_light.gif +0 -0
  200. data/lib/wp/wp-admin/images/xit-2x.gif +0 -0
  201. data/lib/wp/wp-admin/images/xit.gif +0 -0
  202. data/lib/wp/wp-admin/images/yes.png +0 -0
  203. data/lib/wp/wp-admin/import.php +0 -132
  204. data/lib/wp/wp-admin/includes/admin.php +0 -74
  205. data/lib/wp/wp-admin/includes/ajax-actions.php +0 -2762
  206. data/lib/wp/wp-admin/includes/bookmark.php +0 -305
  207. data/lib/wp/wp-admin/includes/class-ftp-pure.php +0 -190
  208. data/lib/wp/wp-admin/includes/class-ftp-sockets.php +0 -250
  209. data/lib/wp/wp-admin/includes/class-ftp.php +0 -907
  210. data/lib/wp/wp-admin/includes/class-pclzip.php +0 -5687
  211. data/lib/wp/wp-admin/includes/class-wp-comments-list-table.php +0 -637
  212. data/lib/wp/wp-admin/includes/class-wp-filesystem-base.php +0 -815
  213. data/lib/wp/wp-admin/includes/class-wp-filesystem-direct.php +0 -384
  214. data/lib/wp/wp-admin/includes/class-wp-filesystem-ftpext.php +0 -415
  215. data/lib/wp/wp-admin/includes/class-wp-filesystem-ftpsockets.php +0 -352
  216. data/lib/wp/wp-admin/includes/class-wp-filesystem-ssh2.php +0 -392
  217. data/lib/wp/wp-admin/includes/class-wp-importer.php +0 -302
  218. data/lib/wp/wp-admin/includes/class-wp-links-list-table.php +0 -207
  219. data/lib/wp/wp-admin/includes/class-wp-list-table.php +0 -1080
  220. data/lib/wp/wp-admin/includes/class-wp-media-list-table.php +0 -574
  221. data/lib/wp/wp-admin/includes/class-wp-ms-sites-list-table.php +0 -402
  222. data/lib/wp/wp-admin/includes/class-wp-ms-themes-list-table.php +0 -459
  223. data/lib/wp/wp-admin/includes/class-wp-ms-users-list-table.php +0 -303
  224. data/lib/wp/wp-admin/includes/class-wp-plugin-install-list-table.php +0 -490
  225. data/lib/wp/wp-admin/includes/class-wp-plugins-list-table.php +0 -605
  226. data/lib/wp/wp-admin/includes/class-wp-posts-list-table.php +0 -1306
  227. data/lib/wp/wp-admin/includes/class-wp-terms-list-table.php +0 -466
  228. data/lib/wp/wp-admin/includes/class-wp-theme-install-list-table.php +0 -431
  229. data/lib/wp/wp-admin/includes/class-wp-themes-list-table.php +0 -279
  230. data/lib/wp/wp-admin/includes/class-wp-upgrader-skins.php +0 -767
  231. data/lib/wp/wp-admin/includes/class-wp-upgrader.php +0 -2676
  232. data/lib/wp/wp-admin/includes/class-wp-users-list-table.php +0 -459
  233. data/lib/wp/wp-admin/includes/comment.php +0 -171
  234. data/lib/wp/wp-admin/includes/continents-cities.php +0 -493
  235. data/lib/wp/wp-admin/includes/dashboard.php +0 -1333
  236. data/lib/wp/wp-admin/includes/deprecated.php +0 -1190
  237. data/lib/wp/wp-admin/includes/export.php +0 -508
  238. data/lib/wp/wp-admin/includes/file.php +0 -1152
  239. data/lib/wp/wp-admin/includes/image-edit.php +0 -828
  240. data/lib/wp/wp-admin/includes/image.php +0 -598
  241. data/lib/wp/wp-admin/includes/import.php +0 -206
  242. data/lib/wp/wp-admin/includes/list-table.php +0 -113
  243. data/lib/wp/wp-admin/includes/media.php +0 -3012
  244. data/lib/wp/wp-admin/includes/menu.php +0 -322
  245. data/lib/wp/wp-admin/includes/meta-boxes.php +0 -1119
  246. data/lib/wp/wp-admin/includes/misc.php +0 -845
  247. data/lib/wp/wp-admin/includes/ms-deprecated.php +0 -78
  248. data/lib/wp/wp-admin/includes/ms.php +0 -814
  249. data/lib/wp/wp-admin/includes/nav-menu.php +0 -1328
  250. data/lib/wp/wp-admin/includes/plugin-install.php +0 -550
  251. data/lib/wp/wp-admin/includes/plugin.php +0 -1899
  252. data/lib/wp/wp-admin/includes/post.php +0 -1661
  253. data/lib/wp/wp-admin/includes/revision.php +0 -228
  254. data/lib/wp/wp-admin/includes/schema.php +0 -1038
  255. data/lib/wp/wp-admin/includes/screen.php +0 -1179
  256. data/lib/wp/wp-admin/includes/taxonomy.php +0 -284
  257. data/lib/wp/wp-admin/includes/template.php +0 -2157
  258. data/lib/wp/wp-admin/includes/theme-install.php +0 -205
  259. data/lib/wp/wp-admin/includes/theme.php +0 -474
  260. data/lib/wp/wp-admin/includes/translation-install.php +0 -240
  261. data/lib/wp/wp-admin/includes/update-core.php +0 -1186
  262. data/lib/wp/wp-admin/includes/update.php +0 -432
  263. data/lib/wp/wp-admin/includes/upgrade.php +0 -2218
  264. data/lib/wp/wp-admin/includes/user.php +0 -442
  265. data/lib/wp/wp-admin/includes/widgets.php +0 -245
  266. data/lib/wp/wp-admin/index.php +0 -131
  267. data/lib/wp/wp-admin/install-helper.php +0 -199
  268. data/lib/wp/wp-admin/install.php +0 -305
  269. data/lib/wp/wp-admin/js/accordion.js +0 -143
  270. data/lib/wp/wp-admin/js/accordion.min.js +0 -1
  271. data/lib/wp/wp-admin/js/color-picker.js +0 -155
  272. data/lib/wp/wp-admin/js/color-picker.min.js +0 -1
  273. data/lib/wp/wp-admin/js/comment.js +0 -50
  274. data/lib/wp/wp-admin/js/comment.min.js +0 -1
  275. data/lib/wp/wp-admin/js/common.js +0 -804
  276. data/lib/wp/wp-admin/js/common.min.js +0 -1
  277. data/lib/wp/wp-admin/js/custom-background.js +0 -75
  278. data/lib/wp/wp-admin/js/custom-background.min.js +0 -1
  279. data/lib/wp/wp-admin/js/custom-header.js +0 -61
  280. data/lib/wp/wp-admin/js/customize-controls.js +0 -1305
  281. data/lib/wp/wp-admin/js/customize-controls.min.js +0 -1
  282. data/lib/wp/wp-admin/js/customize-widgets.js +0 -1882
  283. data/lib/wp/wp-admin/js/customize-widgets.min.js +0 -1
  284. data/lib/wp/wp-admin/js/dashboard.js +0 -190
  285. data/lib/wp/wp-admin/js/dashboard.min.js +0 -1
  286. data/lib/wp/wp-admin/js/edit-comments.js +0 -625
  287. data/lib/wp/wp-admin/js/edit-comments.min.js +0 -1
  288. data/lib/wp/wp-admin/js/editor-expand.js +0 -705
  289. data/lib/wp/wp-admin/js/editor-expand.min.js +0 -1
  290. data/lib/wp/wp-admin/js/editor.js +0 -324
  291. data/lib/wp/wp-admin/js/editor.min.js +0 -1
  292. data/lib/wp/wp-admin/js/farbtastic.js +0 -276
  293. data/lib/wp/wp-admin/js/gallery.js +0 -237
  294. data/lib/wp/wp-admin/js/gallery.min.js +0 -1
  295. data/lib/wp/wp-admin/js/image-edit.js +0 -633
  296. data/lib/wp/wp-admin/js/image-edit.min.js +0 -1
  297. data/lib/wp/wp-admin/js/inline-edit-post.js +0 -359
  298. data/lib/wp/wp-admin/js/inline-edit-post.min.js +0 -1
  299. data/lib/wp/wp-admin/js/inline-edit-tax.js +0 -142
  300. data/lib/wp/wp-admin/js/inline-edit-tax.min.js +0 -1
  301. data/lib/wp/wp-admin/js/iris.min.js +0 -4
  302. data/lib/wp/wp-admin/js/language-chooser.js +0 -26
  303. data/lib/wp/wp-admin/js/language-chooser.min.js +0 -1
  304. data/lib/wp/wp-admin/js/link.js +0 -69
  305. data/lib/wp/wp-admin/js/link.min.js +0 -1
  306. data/lib/wp/wp-admin/js/media-gallery.js +0 -26
  307. data/lib/wp/wp-admin/js/media-gallery.min.js +0 -1
  308. data/lib/wp/wp-admin/js/media-upload.js +0 -69
  309. data/lib/wp/wp-admin/js/media-upload.min.js +0 -1
  310. data/lib/wp/wp-admin/js/media.js +0 -111
  311. data/lib/wp/wp-admin/js/media.min.js +0 -1
  312. data/lib/wp/wp-admin/js/nav-menu.js +0 -1205
  313. data/lib/wp/wp-admin/js/nav-menu.min.js +0 -1
  314. data/lib/wp/wp-admin/js/password-strength-meter.js +0 -75
  315. data/lib/wp/wp-admin/js/password-strength-meter.min.js +0 -1
  316. data/lib/wp/wp-admin/js/plugin-install.js +0 -76
  317. data/lib/wp/wp-admin/js/plugin-install.min.js +0 -1
  318. data/lib/wp/wp-admin/js/post.js +0 -1094
  319. data/lib/wp/wp-admin/js/post.min.js +0 -1
  320. data/lib/wp/wp-admin/js/postbox.js +0 -199
  321. data/lib/wp/wp-admin/js/postbox.min.js +0 -1
  322. data/lib/wp/wp-admin/js/revisions.js +0 -1110
  323. data/lib/wp/wp-admin/js/revisions.min.js +0 -1
  324. data/lib/wp/wp-admin/js/set-post-thumbnail.js +0 -24
  325. data/lib/wp/wp-admin/js/set-post-thumbnail.min.js +0 -1
  326. data/lib/wp/wp-admin/js/svg-painter.js +0 -240
  327. data/lib/wp/wp-admin/js/svg-painter.min.js +0 -1
  328. data/lib/wp/wp-admin/js/tags.js +0 -72
  329. data/lib/wp/wp-admin/js/tags.min.js +0 -1
  330. data/lib/wp/wp-admin/js/theme.js +0 -1691
  331. data/lib/wp/wp-admin/js/theme.min.js +0 -1
  332. data/lib/wp/wp-admin/js/updates.js +0 -65
  333. data/lib/wp/wp-admin/js/updates.min.js +0 -1
  334. data/lib/wp/wp-admin/js/user-profile.js +0 -127
  335. data/lib/wp/wp-admin/js/user-profile.min.js +0 -1
  336. data/lib/wp/wp-admin/js/user-suggest.js +0 -30
  337. data/lib/wp/wp-admin/js/user-suggest.min.js +0 -1
  338. data/lib/wp/wp-admin/js/widgets.js +0 -494
  339. data/lib/wp/wp-admin/js/widgets.min.js +0 -1
  340. data/lib/wp/wp-admin/js/word-count.js +0 -44
  341. data/lib/wp/wp-admin/js/word-count.min.js +0 -1
  342. data/lib/wp/wp-admin/js/wp-fullscreen.js +0 -704
  343. data/lib/wp/wp-admin/js/wp-fullscreen.min.js +0 -1
  344. data/lib/wp/wp-admin/js/xfn.js +0 -17
  345. data/lib/wp/wp-admin/js/xfn.min.js +0 -1
  346. data/lib/wp/wp-admin/link-add.php +0 -29
  347. data/lib/wp/wp-admin/link-manager.php +0 -99
  348. data/lib/wp/wp-admin/link-parse-opml.php +0 -84
  349. data/lib/wp/wp-admin/link.php +0 -117
  350. data/lib/wp/wp-admin/load-scripts.php +0 -162
  351. data/lib/wp/wp-admin/load-styles.php +0 -153
  352. data/lib/wp/wp-admin/maint/repair.php +0 -124
  353. data/lib/wp/wp-admin/media-new.php +0 -84
  354. data/lib/wp/wp-admin/media-upload.php +0 -100
  355. data/lib/wp/wp-admin/media.php +0 -146
  356. data/lib/wp/wp-admin/menu-header.php +0 -227
  357. data/lib/wp/wp-admin/menu.php +0 -255
  358. data/lib/wp/wp-admin/moderation.php +0 -12
  359. data/lib/wp/wp-admin/ms-admin.php +0 -13
  360. data/lib/wp/wp-admin/ms-delete-site.php +0 -91
  361. data/lib/wp/wp-admin/ms-edit.php +0 -13
  362. data/lib/wp/wp-admin/ms-options.php +0 -12
  363. data/lib/wp/wp-admin/ms-sites.php +0 -13
  364. data/lib/wp/wp-admin/ms-themes.php +0 -13
  365. data/lib/wp/wp-admin/ms-upgrade-network.php +0 -13
  366. data/lib/wp/wp-admin/ms-users.php +0 -13
  367. data/lib/wp/wp-admin/my-sites.php +0 -145
  368. data/lib/wp/wp-admin/nav-menus.php +0 -798
  369. data/lib/wp/wp-admin/network.php +0 -561
  370. data/lib/wp/wp-admin/network/about.php +0 -16
  371. data/lib/wp/wp-admin/network/admin.php +0 -32
  372. data/lib/wp/wp-admin/network/credits.php +0 -16
  373. data/lib/wp/wp-admin/network/edit.php +0 -42
  374. data/lib/wp/wp-admin/network/freedoms.php +0 -16
  375. data/lib/wp/wp-admin/network/index.php +0 -79
  376. data/lib/wp/wp-admin/network/menu.php +0 -63
  377. data/lib/wp/wp-admin/network/plugin-editor.php +0 -16
  378. data/lib/wp/wp-admin/network/plugin-install.php +0 -19
  379. data/lib/wp/wp-admin/network/plugins.php +0 -16
  380. data/lib/wp/wp-admin/network/profile.php +0 -16
  381. data/lib/wp/wp-admin/network/settings.php +0 -347
  382. data/lib/wp/wp-admin/network/setup.php +0 -16
  383. data/lib/wp/wp-admin/network/site-info.php +0 -178
  384. data/lib/wp/wp-admin/network/site-new.php +0 -153
  385. data/lib/wp/wp-admin/network/site-settings.php +0 -173
  386. data/lib/wp/wp-admin/network/site-themes.php +0 -185
  387. data/lib/wp/wp-admin/network/site-users.php +0 -319
  388. data/lib/wp/wp-admin/network/sites.php +0 -275
  389. data/lib/wp/wp-admin/network/theme-editor.php +0 -16
  390. data/lib/wp/wp-admin/network/theme-install.php +0 -19
  391. data/lib/wp/wp-admin/network/themes.php +0 -291
  392. data/lib/wp/wp-admin/network/update-core.php +0 -16
  393. data/lib/wp/wp-admin/network/update.php +0 -19
  394. data/lib/wp/wp-admin/network/upgrade.php +0 -120
  395. data/lib/wp/wp-admin/network/user-edit.php +0 -16
  396. data/lib/wp/wp-admin/network/user-new.php +0 -106
  397. data/lib/wp/wp-admin/network/users.php +0 -296
  398. data/lib/wp/wp-admin/options-discussion.php +0 -273
  399. data/lib/wp/wp-admin/options-general.php +0 -355
  400. data/lib/wp/wp-admin/options-head.php +0 -18
  401. data/lib/wp/wp-admin/options-media.php +0 -136
  402. data/lib/wp/wp-admin/options-permalink.php +0 -289
  403. data/lib/wp/wp-admin/options-reading.php +0 -184
  404. data/lib/wp/wp-admin/options-writing.php +0 -194
  405. data/lib/wp/wp-admin/options.php +0 -265
  406. data/lib/wp/wp-admin/plugin-editor.php +0 -279
  407. data/lib/wp/wp-admin/plugin-install.php +0 -134
  408. data/lib/wp/wp-admin/plugins.php +0 -474
  409. data/lib/wp/wp-admin/post-new.php +0 -74
  410. data/lib/wp/wp-admin/post.php +0 -318
  411. data/lib/wp/wp-admin/press-this.php +0 -691
  412. data/lib/wp/wp-admin/profile.php +0 -18
  413. data/lib/wp/wp-admin/revision.php +0 -221
  414. data/lib/wp/wp-admin/setup-config.php +0 -345
  415. data/lib/wp/wp-admin/theme-editor.php +0 -243
  416. data/lib/wp/wp-admin/theme-install.php +0 -278
  417. data/lib/wp/wp-admin/themes.php +0 -374
  418. data/lib/wp/wp-admin/tools.php +0 -75
  419. data/lib/wp/wp-admin/update-core.php +0 -653
  420. data/lib/wp/wp-admin/update.php +0 -272
  421. data/lib/wp/wp-admin/upgrade-functions.php +0 -12
  422. data/lib/wp/wp-admin/upgrade.php +0 -116
  423. data/lib/wp/wp-admin/upload.php +0 -292
  424. data/lib/wp/wp-admin/user-edit.php +0 -557
  425. data/lib/wp/wp-admin/user-new.php +0 -439
  426. data/lib/wp/wp-admin/user/about.php +0 -13
  427. data/lib/wp/wp-admin/user/admin.php +0 -32
  428. data/lib/wp/wp-admin/user/credits.php +0 -13
  429. data/lib/wp/wp-admin/user/freedoms.php +0 -13
  430. data/lib/wp/wp-admin/user/index.php +0 -12
  431. data/lib/wp/wp-admin/user/menu.php +0 -22
  432. data/lib/wp/wp-admin/user/profile.php +0 -12
  433. data/lib/wp/wp-admin/user/user-edit.php +0 -12
  434. data/lib/wp/wp-admin/users.php +0 -460
  435. data/lib/wp/wp-admin/widgets.php +0 -442
  436. data/lib/wp/wp-blog-header.php +0 -18
  437. data/lib/wp/wp-comments-post.php +0 -164
  438. data/lib/wp/wp-config-sample.php +0 -80
  439. data/lib/wp/wp-content/index.php +0 -2
  440. data/lib/wp/wp-content/plugins/hello.php +0 -82
  441. data/lib/wp/wp-content/plugins/index.php +0 -2
  442. data/lib/wp/wp-content/themes/index.php +0 -2
  443. data/lib/wp/wp-content/themes/stump/.editorconfig +0 -11
  444. data/lib/wp/wp-content/themes/stump/.jshintrc +0 -16
  445. data/lib/wp/wp-content/themes/stump/404.php +0 -13
  446. data/lib/wp/wp-content/themes/stump/CHANGELOG.md +0 -333
  447. data/lib/wp/wp-content/themes/stump/CONTRIBUTING.md +0 -121
  448. data/lib/wp/wp-content/themes/stump/Gruntfile.js +0 -151
  449. data/lib/wp/wp-content/themes/stump/LICENSE.md +0 -19
  450. data/lib/wp/wp-content/themes/stump/assets/coffee/build/.gitkeep +0 -0
  451. data/lib/wp/wp-content/themes/stump/assets/css/editor-style.css +0 -548
  452. data/lib/wp/wp-content/themes/stump/assets/fonts/glyphicons-halflings-regular.eot +0 -0
  453. data/lib/wp/wp-content/themes/stump/assets/fonts/glyphicons-halflings-regular.svg +0 -229
  454. data/lib/wp/wp-content/themes/stump/assets/fonts/glyphicons-halflings-regular.ttf +0 -0
  455. data/lib/wp/wp-content/themes/stump/assets/fonts/glyphicons-halflings-regular.woff +0 -0
  456. data/lib/wp/wp-content/themes/stump/assets/img/.gitignore +0 -0
  457. data/lib/wp/wp-content/themes/stump/assets/js/_main.js +0 -63
  458. data/lib/wp/wp-content/themes/stump/assets/js/plugins/bootstrap/affix.js +0 -137
  459. data/lib/wp/wp-content/themes/stump/assets/js/plugins/bootstrap/alert.js +0 -88
  460. data/lib/wp/wp-content/themes/stump/assets/js/plugins/bootstrap/button.js +0 -107
  461. data/lib/wp/wp-content/themes/stump/assets/js/plugins/bootstrap/carousel.js +0 -205
  462. data/lib/wp/wp-content/themes/stump/assets/js/plugins/bootstrap/collapse.js +0 -170
  463. data/lib/wp/wp-content/themes/stump/assets/js/plugins/bootstrap/dropdown.js +0 -147
  464. data/lib/wp/wp-content/themes/stump/assets/js/plugins/bootstrap/modal.js +0 -243
  465. data/lib/wp/wp-content/themes/stump/assets/js/plugins/bootstrap/popover.js +0 -110
  466. data/lib/wp/wp-content/themes/stump/assets/js/plugins/bootstrap/scrollspy.js +0 -153
  467. data/lib/wp/wp-content/themes/stump/assets/js/plugins/bootstrap/tab.js +0 -125
  468. data/lib/wp/wp-content/themes/stump/assets/js/plugins/bootstrap/tooltip.js +0 -399
  469. data/lib/wp/wp-content/themes/stump/assets/js/plugins/bootstrap/transition.js +0 -48
  470. data/lib/wp/wp-content/themes/stump/assets/js/scripts.min.js +0 -1
  471. data/lib/wp/wp-content/themes/stump/assets/js/vendor/jquery-1.11.0.min.js +0 -4
  472. data/lib/wp/wp-content/themes/stump/assets/js/vendor/modernizr-2.7.0.min.js +0 -4
  473. data/lib/wp/wp-content/themes/stump/assets/sass/app.scss +0 -9
  474. data/lib/wp/wp-content/themes/stump/assets/sass/core/_variables.scss +0 -1
  475. data/lib/wp/wp-content/themes/stump/assets/vendor/bootstrap/_alerts.scss +0 -67
  476. data/lib/wp/wp-content/themes/stump/assets/vendor/bootstrap/_badges.scss +0 -55
  477. data/lib/wp/wp-content/themes/stump/assets/vendor/bootstrap/_bootstrap.scss +0 -49
  478. data/lib/wp/wp-content/themes/stump/assets/vendor/bootstrap/_breadcrumbs.scss +0 -26
  479. data/lib/wp/wp-content/themes/stump/assets/vendor/bootstrap/_button-groups.scss +0 -226
  480. data/lib/wp/wp-content/themes/stump/assets/vendor/bootstrap/_buttons.scss +0 -159
  481. data/lib/wp/wp-content/themes/stump/assets/vendor/bootstrap/_carousel.scss +0 -232
  482. data/lib/wp/wp-content/themes/stump/assets/vendor/bootstrap/_close.scss +0 -35
  483. data/lib/wp/wp-content/themes/stump/assets/vendor/bootstrap/_code.scss +0 -63
  484. data/lib/wp/wp-content/themes/stump/assets/vendor/bootstrap/_component-animations.scss +0 -29
  485. data/lib/wp/wp-content/themes/stump/assets/vendor/bootstrap/_dropdowns.scss +0 -213
  486. data/lib/wp/wp-content/themes/stump/assets/vendor/bootstrap/_forms.scss +0 -436
  487. data/lib/wp/wp-content/themes/stump/assets/vendor/bootstrap/_glyphicons.scss +0 -233
  488. data/lib/wp/wp-content/themes/stump/assets/vendor/bootstrap/_grid.scss +0 -84
  489. data/lib/wp/wp-content/themes/stump/assets/vendor/bootstrap/_input-groups.scss +0 -162
  490. data/lib/wp/wp-content/themes/stump/assets/vendor/bootstrap/_jumbotron.scss +0 -44
  491. data/lib/wp/wp-content/themes/stump/assets/vendor/bootstrap/_labels.scss +0 -64
  492. data/lib/wp/wp-content/themes/stump/assets/vendor/bootstrap/_list-group.scss +0 -110
  493. data/lib/wp/wp-content/themes/stump/assets/vendor/bootstrap/_media.scss +0 -56
  494. data/lib/wp/wp-content/themes/stump/assets/vendor/bootstrap/_mixins.scss +0 -947
  495. data/lib/wp/wp-content/themes/stump/assets/vendor/bootstrap/_modals.scss +0 -139
  496. data/lib/wp/wp-content/themes/stump/assets/vendor/bootstrap/_navbar.scss +0 -620
  497. data/lib/wp/wp-content/themes/stump/assets/vendor/bootstrap/_navs.scss +0 -242
  498. data/lib/wp/wp-content/themes/stump/assets/vendor/bootstrap/_normalize.scss +0 -423
  499. data/lib/wp/wp-content/themes/stump/assets/vendor/bootstrap/_pager.scss +0 -55
  500. data/lib/wp/wp-content/themes/stump/assets/vendor/bootstrap/_pagination.scss +0 -88
  501. data/lib/wp/wp-content/themes/stump/assets/vendor/bootstrap/_panels.scss +0 -241
  502. data/lib/wp/wp-content/themes/stump/assets/vendor/bootstrap/_popovers.scss +0 -133
  503. data/lib/wp/wp-content/themes/stump/assets/vendor/bootstrap/_print.scss +0 -101
  504. data/lib/wp/wp-content/themes/stump/assets/vendor/bootstrap/_progress-bars.scss +0 -80
  505. data/lib/wp/wp-content/themes/stump/assets/vendor/bootstrap/_responsive-utilities.scss +0 -74
  506. data/lib/wp/wp-content/themes/stump/assets/vendor/bootstrap/_scaffolding.scss +0 -134
  507. data/lib/wp/wp-content/themes/stump/assets/vendor/bootstrap/_tables.scss +0 -233
  508. data/lib/wp/wp-content/themes/stump/assets/vendor/bootstrap/_theme.scss +0 -247
  509. data/lib/wp/wp-content/themes/stump/assets/vendor/bootstrap/_thumbnails.scss +0 -38
  510. data/lib/wp/wp-content/themes/stump/assets/vendor/bootstrap/_tooltip.scss +0 -95
  511. data/lib/wp/wp-content/themes/stump/assets/vendor/bootstrap/_type.scss +0 -284
  512. data/lib/wp/wp-content/themes/stump/assets/vendor/bootstrap/_utilities.scss +0 -56
  513. data/lib/wp/wp-content/themes/stump/assets/vendor/bootstrap/_variables.scss +0 -833
  514. data/lib/wp/wp-content/themes/stump/assets/vendor/bootstrap/_wells.scss +0 -29
  515. data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/_bourbon-deprecated-upcoming.scss +0 -13
  516. data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/_bourbon.scss +0 -59
  517. data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/addons/_button.scss +0 -273
  518. data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/addons/_clearfix.scss +0 -29
  519. data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/addons/_font-family.scss +0 -5
  520. data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/addons/_hide-text.scss +0 -5
  521. data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/addons/_html5-input-types.scss +0 -56
  522. data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/addons/_position.scss +0 -42
  523. data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/addons/_prefixer.scss +0 -49
  524. data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/addons/_retina-image.scss +0 -32
  525. data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/addons/_size.scss +0 -44
  526. data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/addons/_timing-functions.scss +0 -32
  527. data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/addons/_triangle.scss +0 -45
  528. data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/css3/_animation.scss +0 -52
  529. data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/css3/_appearance.scss +0 -3
  530. data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/css3/_backface-visibility.scss +0 -6
  531. data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/css3/_background-image.scss +0 -48
  532. data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/css3/_background.scss +0 -103
  533. data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/css3/_border-image.scss +0 -55
  534. data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/css3/_border-radius.scss +0 -22
  535. data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/css3/_box-sizing.scss +0 -4
  536. data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/css3/_columns.scss +0 -47
  537. data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/css3/_flex-box.scss +0 -52
  538. data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/css3/_font-face.scss +0 -23
  539. data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/css3/_hidpi-media-query.scss +0 -10
  540. data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/css3/_image-rendering.scss +0 -13
  541. data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/css3/_inline-block.scss +0 -8
  542. data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/css3/_keyframes.scss +0 -43
  543. data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/css3/_linear-gradient.scss +0 -41
  544. data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/css3/_perspective.scss +0 -8
  545. data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/css3/_placeholder.scss +0 -29
  546. data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/css3/_radial-gradient.scss +0 -44
  547. data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/css3/_transform.scss +0 -15
  548. data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/css3/_transition.scss +0 -34
  549. data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/css3/_user-select.scss +0 -3
  550. data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/functions/_compact.scss +0 -11
  551. data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/functions/_flex-grid.scss +0 -39
  552. data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/functions/_grid-width.scss +0 -13
  553. data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/functions/_linear-gradient.scss +0 -13
  554. data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/functions/_modular-scale.scss +0 -40
  555. data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/functions/_px-to-em.scss +0 -8
  556. data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/functions/_radial-gradient.scss +0 -23
  557. data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/functions/_tint-shade.scss +0 -9
  558. data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/functions/_transition-property-name.scss +0 -22
  559. data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/helpers/_deprecated-webkit-gradient.scss +0 -39
  560. data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/helpers/_gradient-positions-parser.scss +0 -13
  561. data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/helpers/_linear-positions-parser.scss +0 -61
  562. data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/helpers/_radial-arg-parser.scss +0 -69
  563. data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/helpers/_radial-positions-parser.scss +0 -18
  564. data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/helpers/_render-gradients.scss +0 -26
  565. data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/bourbon/helpers/_shape-size-stripper.scss +0 -10
  566. data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/manhattan.sass +0 -11
  567. data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/manhattan/_grid.sass +0 -161
  568. data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/manhattan/_mixins.sass +0 -63
  569. data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/manhattan/_utilities.sass +0 -24
  570. data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/manhattan/_variables.sass +0 -42
  571. data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/neat/_neat-helpers.scss +0 -8
  572. data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/neat/_neat.scss +0 -21
  573. data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/neat/functions/_new-breakpoint.scss +0 -16
  574. data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/neat/functions/_private.scss +0 -107
  575. data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/neat/functions/_px-to-em.scss +0 -3
  576. data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/neat/grid/_fill-parent.scss +0 -7
  577. data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/neat/grid/_grid.scss +0 -5
  578. data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/neat/grid/_media.scss +0 -51
  579. data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/neat/grid/_omega.scss +0 -79
  580. data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/neat/grid/_outer-container.scss +0 -8
  581. data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/neat/grid/_pad.scss +0 -8
  582. data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/neat/grid/_private.scss +0 -50
  583. data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/neat/grid/_reset.scss +0 -12
  584. data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/neat/grid/_row.scss +0 -17
  585. data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/neat/grid/_shift.scss +0 -9
  586. data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/neat/grid/_span-columns.scss +0 -38
  587. data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/neat/grid/_to-deprecate.scss +0 -57
  588. data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/neat/grid/_visual-grid.scss +0 -41
  589. data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/neat/settings/_grid.scss +0 -7
  590. data/lib/wp/wp-content/themes/stump/assets/vendor/manhattan/neat/settings/_visual-grid.scss +0 -5
  591. data/lib/wp/wp-content/themes/stump/base.php +0 -36
  592. data/lib/wp/wp-content/themes/stump/functions.php +0 -19
  593. data/lib/wp/wp-content/themes/stump/index.php +0 -21
  594. data/lib/wp/wp-content/themes/stump/lang/ar.mo +0 -0
  595. data/lib/wp/wp-content/themes/stump/lang/ar.po +0 -270
  596. data/lib/wp/wp-content/themes/stump/lang/bg_BG.mo +0 -0
  597. data/lib/wp/wp-content/themes/stump/lang/bg_BG.po +0 -338
  598. data/lib/wp/wp-content/themes/stump/lang/ca.mo +0 -0
  599. data/lib/wp/wp-content/themes/stump/lang/ca.po +0 -517
  600. data/lib/wp/wp-content/themes/stump/lang/da_DK.mo +0 -0
  601. data/lib/wp/wp-content/themes/stump/lang/da_DK.po +0 -305
  602. data/lib/wp/wp-content/themes/stump/lang/de_DE.mo +0 -0
  603. data/lib/wp/wp-content/themes/stump/lang/de_DE.po +0 -271
  604. data/lib/wp/wp-content/themes/stump/lang/el.mo +0 -0
  605. data/lib/wp/wp-content/themes/stump/lang/el.po +0 -319
  606. data/lib/wp/wp-content/themes/stump/lang/es_ES.mo +0 -0
  607. data/lib/wp/wp-content/themes/stump/lang/es_ES.po +0 -270
  608. data/lib/wp/wp-content/themes/stump/lang/et.mo +0 -0
  609. data/lib/wp/wp-content/themes/stump/lang/et.po +0 -262
  610. data/lib/wp/wp-content/themes/stump/lang/fa_IR.mo +0 -0
  611. data/lib/wp/wp-content/themes/stump/lang/fa_IR.po +0 -273
  612. data/lib/wp/wp-content/themes/stump/lang/fi_FI.mo +0 -0
  613. data/lib/wp/wp-content/themes/stump/lang/fi_FI.po +0 -367
  614. data/lib/wp/wp-content/themes/stump/lang/fr_FR.mo +0 -0
  615. data/lib/wp/wp-content/themes/stump/lang/fr_FR.po +0 -336
  616. data/lib/wp/wp-content/themes/stump/lang/he_IL.mo +0 -0
  617. data/lib/wp/wp-content/themes/stump/lang/he_IL.po +0 -336
  618. data/lib/wp/wp-content/themes/stump/lang/hu_HU.mo +0 -0
  619. data/lib/wp/wp-content/themes/stump/lang/hu_HU.po +0 -271
  620. data/lib/wp/wp-content/themes/stump/lang/id_ID.mo +0 -0
  621. data/lib/wp/wp-content/themes/stump/lang/id_ID.po +0 -278
  622. data/lib/wp/wp-content/themes/stump/lang/it_IT.mo +0 -0
  623. data/lib/wp/wp-content/themes/stump/lang/it_IT.po +0 -269
  624. data/lib/wp/wp-content/themes/stump/lang/ja.mo +0 -0
  625. data/lib/wp/wp-content/themes/stump/lang/ja.po +0 -267
  626. data/lib/wp/wp-content/themes/stump/lang/ko_KR.mo +0 -0
  627. data/lib/wp/wp-content/themes/stump/lang/ko_KR.po +0 -282
  628. data/lib/wp/wp-content/themes/stump/lang/mk_MK.mo +0 -0
  629. data/lib/wp/wp-content/themes/stump/lang/mk_MK.po +0 -297
  630. data/lib/wp/wp-content/themes/stump/lang/ms_MY.mo +0 -0
  631. data/lib/wp/wp-content/themes/stump/lang/ms_MY.po +0 -342
  632. data/lib/wp/wp-content/themes/stump/lang/nb_NO.mo +0 -0
  633. data/lib/wp/wp-content/themes/stump/lang/nb_NO.po +0 -517
  634. data/lib/wp/wp-content/themes/stump/lang/nl_NL.mo +0 -0
  635. data/lib/wp/wp-content/themes/stump/lang/nl_NL.po +0 -261
  636. data/lib/wp/wp-content/themes/stump/lang/nn_NO.mo +0 -0
  637. data/lib/wp/wp-content/themes/stump/lang/nn_NO.po +0 -517
  638. data/lib/wp/wp-content/themes/stump/lang/pl_PL.mo +0 -0
  639. data/lib/wp/wp-content/themes/stump/lang/pl_PL.po +0 -283
  640. data/lib/wp/wp-content/themes/stump/lang/pt_BR.mo +0 -0
  641. data/lib/wp/wp-content/themes/stump/lang/pt_BR.po +0 -394
  642. data/lib/wp/wp-content/themes/stump/lang/ro_RO.mo +0 -0
  643. data/lib/wp/wp-content/themes/stump/lang/ro_RO.po +0 -271
  644. data/lib/wp/wp-content/themes/stump/lang/roots.pot +0 -244
  645. data/lib/wp/wp-content/themes/stump/lang/ru_RU.mo +0 -0
  646. data/lib/wp/wp-content/themes/stump/lang/ru_RU.po +0 -255
  647. data/lib/wp/wp-content/themes/stump/lang/sk_SK.mo +0 -0
  648. data/lib/wp/wp-content/themes/stump/lang/sk_SK.po +0 -267
  649. data/lib/wp/wp-content/themes/stump/lang/sr_RS.mo +0 -0
  650. data/lib/wp/wp-content/themes/stump/lang/sr_RS.pot +0 -261
  651. data/lib/wp/wp-content/themes/stump/lang/sv_SE.mo +0 -0
  652. data/lib/wp/wp-content/themes/stump/lang/sv_SE.po +0 -323
  653. data/lib/wp/wp-content/themes/stump/lang/tr_TR.mo +0 -0
  654. data/lib/wp/wp-content/themes/stump/lang/tr_TR.po +0 -405
  655. data/lib/wp/wp-content/themes/stump/lang/vi_VN.mo +0 -0
  656. data/lib/wp/wp-content/themes/stump/lang/vi_VN.po +0 -516
  657. data/lib/wp/wp-content/themes/stump/lang/zh_CN.mo +0 -0
  658. data/lib/wp/wp-content/themes/stump/lang/zh_CN.po +0 -329
  659. data/lib/wp/wp-content/themes/stump/lang/zh_TW.mo +0 -0
  660. data/lib/wp/wp-content/themes/stump/lang/zh_TW.po +0 -261
  661. data/lib/wp/wp-content/themes/stump/lib/activation.php +0 -215
  662. data/lib/wp/wp-content/themes/stump/lib/cleanup.php +0 -261
  663. data/lib/wp/wp-content/themes/stump/lib/comments.php +0 -52
  664. data/lib/wp/wp-content/themes/stump/lib/config.php +0 -79
  665. data/lib/wp/wp-content/themes/stump/lib/custom.php +0 -4
  666. data/lib/wp/wp-content/themes/stump/lib/gallery.php +0 -130
  667. data/lib/wp/wp-content/themes/stump/lib/init.php +0 -25
  668. data/lib/wp/wp-content/themes/stump/lib/nav.php +0 -93
  669. data/lib/wp/wp-content/themes/stump/lib/relative-urls.php +0 -50
  670. data/lib/wp/wp-content/themes/stump/lib/scripts.php +0 -67
  671. data/lib/wp/wp-content/themes/stump/lib/sidebar.php +0 -43
  672. data/lib/wp/wp-content/themes/stump/lib/titles.php +0 -37
  673. data/lib/wp/wp-content/themes/stump/lib/utils.php +0 -14
  674. data/lib/wp/wp-content/themes/stump/lib/widgets.php +0 -133
  675. data/lib/wp/wp-content/themes/stump/lib/wrapper.php +0 -49
  676. data/lib/wp/wp-content/themes/stump/package.json +0 -32
  677. data/lib/wp/wp-content/themes/stump/page.php +0 -2
  678. data/lib/wp/wp-content/themes/stump/screenshot.png +0 -0
  679. data/lib/wp/wp-content/themes/stump/single.php +0 -1
  680. data/lib/wp/wp-content/themes/stump/style.css +0 -11
  681. data/lib/wp/wp-content/themes/stump/template-custom.php +0 -8
  682. data/lib/wp/wp-content/themes/stump/templates/comment.php +0 -14
  683. data/lib/wp/wp-content/themes/stump/templates/comments.php +0 -80
  684. data/lib/wp/wp-content/themes/stump/templates/content-page.php +0 -4
  685. data/lib/wp/wp-content/themes/stump/templates/content-single.php +0 -15
  686. data/lib/wp/wp-content/themes/stump/templates/content.php +0 -9
  687. data/lib/wp/wp-content/themes/stump/templates/entry-meta.php +0 -2
  688. data/lib/wp/wp-content/themes/stump/templates/footer.php +0 -8
  689. data/lib/wp/wp-content/themes/stump/templates/head.php +0 -12
  690. data/lib/wp/wp-content/themes/stump/templates/header-top-navbar.php +0 -21
  691. data/lib/wp/wp-content/themes/stump/templates/header.php +0 -14
  692. data/lib/wp/wp-content/themes/stump/templates/page-header.php +0 -5
  693. data/lib/wp/wp-content/themes/stump/templates/searchform.php +0 -9
  694. data/lib/wp/wp-content/themes/stump/templates/sidebar.php +0 -1
  695. data/lib/wp/wp-cron.php +0 -115
  696. data/lib/wp/wp-includes/ID3/getid3.lib.php +0 -1376
  697. data/lib/wp/wp-includes/ID3/getid3.php +0 -1796
  698. data/lib/wp/wp-includes/ID3/license.commercial.txt +0 -27
  699. data/lib/wp/wp-includes/ID3/license.txt +0 -29
  700. data/lib/wp/wp-includes/ID3/module.audio-video.asf.php +0 -2013
  701. data/lib/wp/wp-includes/ID3/module.audio-video.flv.php +0 -745
  702. data/lib/wp/wp-includes/ID3/module.audio-video.matroska.php +0 -1751
  703. data/lib/wp/wp-includes/ID3/module.audio-video.quicktime.php +0 -2246
  704. data/lib/wp/wp-includes/ID3/module.audio-video.riff.php +0 -2586
  705. data/lib/wp/wp-includes/ID3/module.audio.ac3.php +0 -474
  706. data/lib/wp/wp-includes/ID3/module.audio.dts.php +0 -291
  707. data/lib/wp/wp-includes/ID3/module.audio.flac.php +0 -443
  708. data/lib/wp/wp-includes/ID3/module.audio.mp3.php +0 -2012
  709. data/lib/wp/wp-includes/ID3/module.audio.ogg.php +0 -756
  710. data/lib/wp/wp-includes/ID3/module.tag.apetag.php +0 -371
  711. data/lib/wp/wp-includes/ID3/module.tag.id3v1.php +0 -360
  712. data/lib/wp/wp-includes/ID3/module.tag.id3v2.php +0 -3424
  713. data/lib/wp/wp-includes/ID3/module.tag.lyrics3.php +0 -294
  714. data/lib/wp/wp-includes/ID3/readme.txt +0 -604
  715. data/lib/wp/wp-includes/SimplePie/Author.php +0 -157
  716. data/lib/wp/wp-includes/SimplePie/Cache.php +0 -133
  717. data/lib/wp/wp-includes/SimplePie/Cache/Base.php +0 -114
  718. data/lib/wp/wp-includes/SimplePie/Cache/DB.php +0 -137
  719. data/lib/wp/wp-includes/SimplePie/Cache/File.php +0 -173
  720. data/lib/wp/wp-includes/SimplePie/Cache/Memcache.php +0 -183
  721. data/lib/wp/wp-includes/SimplePie/Cache/MySQL.php +0 -438
  722. data/lib/wp/wp-includes/SimplePie/Caption.php +0 -210
  723. data/lib/wp/wp-includes/SimplePie/Category.php +0 -157
  724. data/lib/wp/wp-includes/SimplePie/Content/Type/Sniffer.php +0 -332
  725. data/lib/wp/wp-includes/SimplePie/Copyright.php +0 -130
  726. data/lib/wp/wp-includes/SimplePie/Core.php +0 -57
  727. data/lib/wp/wp-includes/SimplePie/Credit.php +0 -156
  728. data/lib/wp/wp-includes/SimplePie/Decode/HTML/Entities.php +0 -617
  729. data/lib/wp/wp-includes/SimplePie/Enclosure.php +0 -1380
  730. data/lib/wp/wp-includes/SimplePie/Exception.php +0 -52
  731. data/lib/wp/wp-includes/SimplePie/File.php +0 -292
  732. data/lib/wp/wp-includes/SimplePie/HTTP/Parser.php +0 -500
  733. data/lib/wp/wp-includes/SimplePie/IRI.php +0 -1238
  734. data/lib/wp/wp-includes/SimplePie/Item.php +0 -2964
  735. data/lib/wp/wp-includes/SimplePie/Locator.php +0 -372
  736. data/lib/wp/wp-includes/SimplePie/Misc.php +0 -2247
  737. data/lib/wp/wp-includes/SimplePie/Net/IPv6.php +0 -276
  738. data/lib/wp/wp-includes/SimplePie/Parse/Date.php +0 -983
  739. data/lib/wp/wp-includes/SimplePie/Parser.php +0 -407
  740. data/lib/wp/wp-includes/SimplePie/Rating.php +0 -129
  741. data/lib/wp/wp-includes/SimplePie/Registry.php +0 -225
  742. data/lib/wp/wp-includes/SimplePie/Restriction.php +0 -155
  743. data/lib/wp/wp-includes/SimplePie/Sanitize.php +0 -554
  744. data/lib/wp/wp-includes/SimplePie/Source.php +0 -611
  745. data/lib/wp/wp-includes/SimplePie/XML/Declaration/Parser.php +0 -362
  746. data/lib/wp/wp-includes/SimplePie/gzdecode.php +0 -371
  747. data/lib/wp/wp-includes/Text/Diff.php +0 -450
  748. data/lib/wp/wp-includes/Text/Diff/Engine/native.php +0 -436
  749. data/lib/wp/wp-includes/Text/Diff/Engine/shell.php +0 -162
  750. data/lib/wp/wp-includes/Text/Diff/Engine/string.php +0 -248
  751. data/lib/wp/wp-includes/Text/Diff/Engine/xdiff.php +0 -64
  752. data/lib/wp/wp-includes/Text/Diff/Renderer.php +0 -235
  753. data/lib/wp/wp-includes/Text/Diff/Renderer/inline.php +0 -206
  754. data/lib/wp/wp-includes/admin-bar.php +0 -870
  755. data/lib/wp/wp-includes/atomlib.php +0 -352
  756. data/lib/wp/wp-includes/author-template.php +0 -471
  757. data/lib/wp/wp-includes/bookmark-template.php +0 -298
  758. data/lib/wp/wp-includes/bookmark.php +0 -416
  759. data/lib/wp/wp-includes/cache.php +0 -704
  760. data/lib/wp/wp-includes/canonical.php +0 -586
  761. data/lib/wp/wp-includes/capabilities.php +0 -1539
  762. data/lib/wp/wp-includes/category-template.php +0 -1407
  763. data/lib/wp/wp-includes/category.php +0 -343
  764. data/lib/wp/wp-includes/certificates/ca-bundle.crt +0 -3785
  765. data/lib/wp/wp-includes/class-IXR.php +0 -1100
  766. data/lib/wp/wp-includes/class-feed.php +0 -140
  767. data/lib/wp/wp-includes/class-http.php +0 -2245
  768. data/lib/wp/wp-includes/class-json.php +0 -936
  769. data/lib/wp/wp-includes/class-oembed.php +0 -579
  770. data/lib/wp/wp-includes/class-phpass.php +0 -260
  771. data/lib/wp/wp-includes/class-phpmailer.php +0 -3265
  772. data/lib/wp/wp-includes/class-pop3.php +0 -652
  773. data/lib/wp/wp-includes/class-simplepie.php +0 -3119
  774. data/lib/wp/wp-includes/class-smtp.php +0 -943
  775. data/lib/wp/wp-includes/class-snoopy.php +0 -1256
  776. data/lib/wp/wp-includes/class-wp-admin-bar.php +0 -517
  777. data/lib/wp/wp-includes/class-wp-ajax-response.php +0 -199
  778. data/lib/wp/wp-includes/class-wp-customize-control.php +0 -1124
  779. data/lib/wp/wp-includes/class-wp-customize-manager.php +0 -1272
  780. data/lib/wp/wp-includes/class-wp-customize-panel.php +0 -200
  781. data/lib/wp/wp-includes/class-wp-customize-section.php +0 -196
  782. data/lib/wp/wp-includes/class-wp-customize-setting.php +0 -554
  783. data/lib/wp/wp-includes/class-wp-customize-widgets.php +0 -1556
  784. data/lib/wp/wp-includes/class-wp-editor.php +0 -1435
  785. data/lib/wp/wp-includes/class-wp-embed.php +0 -373
  786. data/lib/wp/wp-includes/class-wp-error.php +0 -276
  787. data/lib/wp/wp-includes/class-wp-http-ixr-client.php +0 -97
  788. data/lib/wp/wp-includes/class-wp-image-editor-gd.php +0 -459
  789. data/lib/wp/wp-includes/class-wp-image-editor-imagick.php +0 -512
  790. data/lib/wp/wp-includes/class-wp-image-editor.php +0 -475
  791. data/lib/wp/wp-includes/class-wp-theme.php +0 -1235
  792. data/lib/wp/wp-includes/class-wp-walker.php +0 -471
  793. data/lib/wp/wp-includes/class-wp-xmlrpc-server.php +0 -5984
  794. data/lib/wp/wp-includes/class-wp.php +0 -782
  795. data/lib/wp/wp-includes/class.wp-dependencies.php +0 -509
  796. data/lib/wp/wp-includes/class.wp-scripts.php +0 -247
  797. data/lib/wp/wp-includes/class.wp-styles.php +0 -210
  798. data/lib/wp/wp-includes/comment-template.php +0 -2286
  799. data/lib/wp/wp-includes/comment.php +0 -2606
  800. data/lib/wp/wp-includes/compat.php +0 -125
  801. data/lib/wp/wp-includes/cron.php +0 -469
  802. data/lib/wp/wp-includes/css/admin-bar-rtl.css +0 -1099
  803. data/lib/wp/wp-includes/css/admin-bar-rtl.min.css +0 -1
  804. data/lib/wp/wp-includes/css/admin-bar.css +0 -1099
  805. data/lib/wp/wp-includes/css/admin-bar.min.css +0 -1
  806. data/lib/wp/wp-includes/css/buttons-rtl.css +0 -364
  807. data/lib/wp/wp-includes/css/buttons-rtl.min.css +0 -1
  808. data/lib/wp/wp-includes/css/buttons.css +0 -364
  809. data/lib/wp/wp-includes/css/buttons.min.css +0 -1
  810. data/lib/wp/wp-includes/css/dashicons.css +0 -893
  811. data/lib/wp/wp-includes/css/dashicons.min.css +0 -1
  812. data/lib/wp/wp-includes/css/editor-rtl.css +0 -1993
  813. data/lib/wp/wp-includes/css/editor-rtl.min.css +0 -1
  814. data/lib/wp/wp-includes/css/editor.css +0 -1993
  815. data/lib/wp/wp-includes/css/editor.min.css +0 -1
  816. data/lib/wp/wp-includes/css/jquery-ui-dialog-rtl.css +0 -343
  817. data/lib/wp/wp-includes/css/jquery-ui-dialog-rtl.min.css +0 -19
  818. data/lib/wp/wp-includes/css/jquery-ui-dialog.css +0 -343
  819. data/lib/wp/wp-includes/css/jquery-ui-dialog.min.css +0 -19
  820. data/lib/wp/wp-includes/css/media-views-rtl.css +0 -2568
  821. data/lib/wp/wp-includes/css/media-views-rtl.min.css +0 -1
  822. data/lib/wp/wp-includes/css/media-views.css +0 -2568
  823. data/lib/wp/wp-includes/css/media-views.min.css +0 -1
  824. data/lib/wp/wp-includes/css/wp-auth-check-rtl.css +0 -100
  825. data/lib/wp/wp-includes/css/wp-auth-check-rtl.min.css +0 -1
  826. data/lib/wp/wp-includes/css/wp-auth-check.css +0 -100
  827. data/lib/wp/wp-includes/css/wp-auth-check.min.css +0 -1
  828. data/lib/wp/wp-includes/css/wp-pointer-rtl.css +0 -212
  829. data/lib/wp/wp-includes/css/wp-pointer-rtl.min.css +0 -1
  830. data/lib/wp/wp-includes/css/wp-pointer.css +0 -212
  831. data/lib/wp/wp-includes/css/wp-pointer.min.css +0 -1
  832. data/lib/wp/wp-includes/date.php +0 -475
  833. data/lib/wp/wp-includes/default-constants.php +0 -323
  834. data/lib/wp/wp-includes/default-filters.php +0 -307
  835. data/lib/wp/wp-includes/default-widgets.php +0 -1423
  836. data/lib/wp/wp-includes/deprecated.php +0 -3501
  837. data/lib/wp/wp-includes/feed-atom-comments.php +0 -115
  838. data/lib/wp/wp-includes/feed-atom.php +0 -87
  839. data/lib/wp/wp-includes/feed-rdf.php +0 -81
  840. data/lib/wp/wp-includes/feed-rss.php +0 -46
  841. data/lib/wp/wp-includes/feed-rss2-comments.php +0 -97
  842. data/lib/wp/wp-includes/feed-rss2.php +0 -115
  843. data/lib/wp/wp-includes/feed.php +0 -659
  844. data/lib/wp/wp-includes/fonts/dashicons.eot +0 -0
  845. data/lib/wp/wp-includes/fonts/dashicons.svg +0 -250
  846. data/lib/wp/wp-includes/fonts/dashicons.ttf +0 -0
  847. data/lib/wp/wp-includes/fonts/dashicons.woff +0 -0
  848. data/lib/wp/wp-includes/formatting.php +0 -4006
  849. data/lib/wp/wp-includes/functions.php +0 -4631
  850. data/lib/wp/wp-includes/functions.wp-scripts.php +0 -258
  851. data/lib/wp/wp-includes/functions.wp-styles.php +0 -245
  852. data/lib/wp/wp-includes/general-template.php +0 -2982
  853. data/lib/wp/wp-includes/http.php +0 -551
  854. data/lib/wp/wp-includes/images/admin-bar-sprite-2x.png +0 -0
  855. data/lib/wp/wp-includes/images/admin-bar-sprite.png +0 -0
  856. data/lib/wp/wp-includes/images/arrow-pointer-blue-2x.png +0 -0
  857. data/lib/wp/wp-includes/images/arrow-pointer-blue.png +0 -0
  858. data/lib/wp/wp-includes/images/blank.gif +0 -0
  859. data/lib/wp/wp-includes/images/crystal/archive.png +0 -0
  860. data/lib/wp/wp-includes/images/crystal/audio.png +0 -0
  861. data/lib/wp/wp-includes/images/crystal/code.png +0 -0
  862. data/lib/wp/wp-includes/images/crystal/default.png +0 -0
  863. data/lib/wp/wp-includes/images/crystal/document.png +0 -0
  864. data/lib/wp/wp-includes/images/crystal/interactive.png +0 -0
  865. data/lib/wp/wp-includes/images/crystal/license.txt +0 -9
  866. data/lib/wp/wp-includes/images/crystal/spreadsheet.png +0 -0
  867. data/lib/wp/wp-includes/images/crystal/text.png +0 -0
  868. data/lib/wp/wp-includes/images/crystal/video.png +0 -0
  869. data/lib/wp/wp-includes/images/down_arrow-2x.gif +0 -0
  870. data/lib/wp/wp-includes/images/down_arrow.gif +0 -0
  871. data/lib/wp/wp-includes/images/icon-pointer-flag-2x.png +0 -0
  872. data/lib/wp/wp-includes/images/icon-pointer-flag.png +0 -0
  873. data/lib/wp/wp-includes/images/media/archive.png +0 -0
  874. data/lib/wp/wp-includes/images/media/audio.png +0 -0
  875. data/lib/wp/wp-includes/images/media/code.png +0 -0
  876. data/lib/wp/wp-includes/images/media/default.png +0 -0
  877. data/lib/wp/wp-includes/images/media/document.png +0 -0
  878. data/lib/wp/wp-includes/images/media/interactive.png +0 -0
  879. data/lib/wp/wp-includes/images/media/spreadsheet.png +0 -0
  880. data/lib/wp/wp-includes/images/media/text.png +0 -0
  881. data/lib/wp/wp-includes/images/media/video.png +0 -0
  882. data/lib/wp/wp-includes/images/rss-2x.png +0 -0
  883. data/lib/wp/wp-includes/images/rss.png +0 -0
  884. data/lib/wp/wp-includes/images/smilies/icon_arrow.gif +0 -0
  885. data/lib/wp/wp-includes/images/smilies/icon_biggrin.gif +0 -0
  886. data/lib/wp/wp-includes/images/smilies/icon_confused.gif +0 -0
  887. data/lib/wp/wp-includes/images/smilies/icon_cool.gif +0 -0
  888. data/lib/wp/wp-includes/images/smilies/icon_cry.gif +0 -0
  889. data/lib/wp/wp-includes/images/smilies/icon_eek.gif +0 -0
  890. data/lib/wp/wp-includes/images/smilies/icon_evil.gif +0 -0
  891. data/lib/wp/wp-includes/images/smilies/icon_exclaim.gif +0 -0
  892. data/lib/wp/wp-includes/images/smilies/icon_idea.gif +0 -0
  893. data/lib/wp/wp-includes/images/smilies/icon_lol.gif +0 -0
  894. data/lib/wp/wp-includes/images/smilies/icon_mad.gif +0 -0
  895. data/lib/wp/wp-includes/images/smilies/icon_mrgreen.gif +0 -0
  896. data/lib/wp/wp-includes/images/smilies/icon_neutral.gif +0 -0
  897. data/lib/wp/wp-includes/images/smilies/icon_question.gif +0 -0
  898. data/lib/wp/wp-includes/images/smilies/icon_razz.gif +0 -0
  899. data/lib/wp/wp-includes/images/smilies/icon_redface.gif +0 -0
  900. data/lib/wp/wp-includes/images/smilies/icon_rolleyes.gif +0 -0
  901. data/lib/wp/wp-includes/images/smilies/icon_sad.gif +0 -0
  902. data/lib/wp/wp-includes/images/smilies/icon_smile.gif +0 -0
  903. data/lib/wp/wp-includes/images/smilies/icon_surprised.gif +0 -0
  904. data/lib/wp/wp-includes/images/smilies/icon_twisted.gif +0 -0
  905. data/lib/wp/wp-includes/images/smilies/icon_wink.gif +0 -0
  906. data/lib/wp/wp-includes/images/spinner-2x.gif +0 -0
  907. data/lib/wp/wp-includes/images/spinner.gif +0 -0
  908. data/lib/wp/wp-includes/images/toggle-arrow-2x.png +0 -0
  909. data/lib/wp/wp-includes/images/toggle-arrow.png +0 -0
  910. data/lib/wp/wp-includes/images/uploader-icons-2x.png +0 -0
  911. data/lib/wp/wp-includes/images/uploader-icons.png +0 -0
  912. data/lib/wp/wp-includes/images/wlw/wp-comments.png +0 -0
  913. data/lib/wp/wp-includes/images/wlw/wp-icon.png +0 -0
  914. data/lib/wp/wp-includes/images/wlw/wp-watermark.png +0 -0
  915. data/lib/wp/wp-includes/images/wpicons-2x.png +0 -0
  916. data/lib/wp/wp-includes/images/wpicons.png +0 -0
  917. data/lib/wp/wp-includes/images/wpspin-2x.gif +0 -0
  918. data/lib/wp/wp-includes/images/wpspin.gif +0 -0
  919. data/lib/wp/wp-includes/images/xit-2x.gif +0 -0
  920. data/lib/wp/wp-includes/images/xit.gif +0 -0
  921. data/lib/wp/wp-includes/js/admin-bar.js +0 -365
  922. data/lib/wp/wp-includes/js/admin-bar.min.js +0 -1
  923. data/lib/wp/wp-includes/js/autosave.js +0 -589
  924. data/lib/wp/wp-includes/js/autosave.min.js +0 -1
  925. data/lib/wp/wp-includes/js/backbone.min.js +0 -1
  926. data/lib/wp/wp-includes/js/colorpicker.js +0 -707
  927. data/lib/wp/wp-includes/js/colorpicker.min.js +0 -1
  928. data/lib/wp/wp-includes/js/comment-reply.js +0 -47
  929. data/lib/wp/wp-includes/js/comment-reply.min.js +0 -1
  930. data/lib/wp/wp-includes/js/crop/cropper.css +0 -165
  931. data/lib/wp/wp-includes/js/crop/cropper.js +0 -516
  932. data/lib/wp/wp-includes/js/crop/marqueeHoriz.gif +0 -0
  933. data/lib/wp/wp-includes/js/crop/marqueeVert.gif +0 -0
  934. data/lib/wp/wp-includes/js/customize-base.js +0 -617
  935. data/lib/wp/wp-includes/js/customize-base.min.js +0 -1
  936. data/lib/wp/wp-includes/js/customize-loader.js +0 -246
  937. data/lib/wp/wp-includes/js/customize-loader.min.js +0 -1
  938. data/lib/wp/wp-includes/js/customize-models.js +0 -247
  939. data/lib/wp/wp-includes/js/customize-models.min.js +0 -1
  940. data/lib/wp/wp-includes/js/customize-preview-widgets.js +0 -129
  941. data/lib/wp/wp-includes/js/customize-preview-widgets.min.js +0 -1
  942. data/lib/wp/wp-includes/js/customize-preview.js +0 -154
  943. data/lib/wp/wp-includes/js/customize-preview.min.js +0 -1
  944. data/lib/wp/wp-includes/js/customize-views.js +0 -231
  945. data/lib/wp/wp-includes/js/customize-views.min.js +0 -1
  946. data/lib/wp/wp-includes/js/heartbeat.js +0 -738
  947. data/lib/wp/wp-includes/js/heartbeat.min.js +0 -1
  948. data/lib/wp/wp-includes/js/hoverIntent.js +0 -115
  949. data/lib/wp/wp-includes/js/hoverIntent.min.js +0 -1
  950. data/lib/wp/wp-includes/js/imgareaselect/border-anim-h.gif +0 -0
  951. data/lib/wp/wp-includes/js/imgareaselect/border-anim-v.gif +0 -0
  952. data/lib/wp/wp-includes/js/imgareaselect/imgareaselect.css +0 -41
  953. data/lib/wp/wp-includes/js/imgareaselect/jquery.imgareaselect.js +0 -1205
  954. data/lib/wp/wp-includes/js/imgareaselect/jquery.imgareaselect.min.js +0 -1
  955. data/lib/wp/wp-includes/js/jcrop/Jcrop.gif +0 -0
  956. data/lib/wp/wp-includes/js/jcrop/jquery.Jcrop.min.css +0 -29
  957. data/lib/wp/wp-includes/js/jcrop/jquery.Jcrop.min.js +0 -22
  958. data/lib/wp/wp-includes/js/jquery/jquery-migrate.js +0 -521
  959. data/lib/wp/wp-includes/js/jquery/jquery-migrate.min.js +0 -2
  960. data/lib/wp/wp-includes/js/jquery/jquery.color.min.js +0 -2
  961. data/lib/wp/wp-includes/js/jquery/jquery.form.js +0 -1193
  962. data/lib/wp/wp-includes/js/jquery/jquery.form.min.js +0 -11
  963. data/lib/wp/wp-includes/js/jquery/jquery.hotkeys.js +0 -134
  964. data/lib/wp/wp-includes/js/jquery/jquery.hotkeys.min.js +0 -1
  965. data/lib/wp/wp-includes/js/jquery/jquery.js +0 -5
  966. data/lib/wp/wp-includes/js/jquery/jquery.masonry.min.js +0 -11
  967. data/lib/wp/wp-includes/js/jquery/jquery.query.js +0 -11
  968. data/lib/wp/wp-includes/js/jquery/jquery.schedule.js +0 -36
  969. data/lib/wp/wp-includes/js/jquery/jquery.serialize-object.js +0 -31
  970. data/lib/wp/wp-includes/js/jquery/jquery.table-hotkeys.js +0 -99
  971. data/lib/wp/wp-includes/js/jquery/jquery.table-hotkeys.min.js +0 -1
  972. data/lib/wp/wp-includes/js/jquery/jquery.ui.touch-punch.js +0 -11
  973. data/lib/wp/wp-includes/js/jquery/suggest.js +0 -316
  974. data/lib/wp/wp-includes/js/jquery/suggest.min.js +0 -1
  975. data/lib/wp/wp-includes/js/jquery/ui/accordion.min.js +0 -11
  976. data/lib/wp/wp-includes/js/jquery/ui/autocomplete.min.js +0 -11
  977. data/lib/wp/wp-includes/js/jquery/ui/button.min.js +0 -11
  978. data/lib/wp/wp-includes/js/jquery/ui/core.min.js +0 -11
  979. data/lib/wp/wp-includes/js/jquery/ui/datepicker.min.js +0 -12
  980. data/lib/wp/wp-includes/js/jquery/ui/dialog.min.js +0 -11
  981. data/lib/wp/wp-includes/js/jquery/ui/draggable.min.js +0 -11
  982. data/lib/wp/wp-includes/js/jquery/ui/droppable.min.js +0 -11
  983. data/lib/wp/wp-includes/js/jquery/ui/effect-blind.min.js +0 -11
  984. data/lib/wp/wp-includes/js/jquery/ui/effect-bounce.min.js +0 -11
  985. data/lib/wp/wp-includes/js/jquery/ui/effect-clip.min.js +0 -11
  986. data/lib/wp/wp-includes/js/jquery/ui/effect-drop.min.js +0 -11
  987. data/lib/wp/wp-includes/js/jquery/ui/effect-explode.min.js +0 -11
  988. data/lib/wp/wp-includes/js/jquery/ui/effect-fade.min.js +0 -11
  989. data/lib/wp/wp-includes/js/jquery/ui/effect-fold.min.js +0 -11
  990. data/lib/wp/wp-includes/js/jquery/ui/effect-highlight.min.js +0 -11
  991. data/lib/wp/wp-includes/js/jquery/ui/effect-puff.min.js +0 -11
  992. data/lib/wp/wp-includes/js/jquery/ui/effect-pulsate.min.js +0 -11
  993. data/lib/wp/wp-includes/js/jquery/ui/effect-scale.min.js +0 -11
  994. data/lib/wp/wp-includes/js/jquery/ui/effect-shake.min.js +0 -11
  995. data/lib/wp/wp-includes/js/jquery/ui/effect-size.min.js +0 -11
  996. data/lib/wp/wp-includes/js/jquery/ui/effect-slide.min.js +0 -11
  997. data/lib/wp/wp-includes/js/jquery/ui/effect-transfer.min.js +0 -11
  998. data/lib/wp/wp-includes/js/jquery/ui/effect.min.js +0 -21
  999. data/lib/wp/wp-includes/js/jquery/ui/menu.min.js +0 -11
  1000. data/lib/wp/wp-includes/js/jquery/ui/mouse.min.js +0 -11
  1001. data/lib/wp/wp-includes/js/jquery/ui/position.min.js +0 -11
  1002. data/lib/wp/wp-includes/js/jquery/ui/progressbar.min.js +0 -11
  1003. data/lib/wp/wp-includes/js/jquery/ui/resizable.min.js +0 -11
  1004. data/lib/wp/wp-includes/js/jquery/ui/selectable.min.js +0 -11
  1005. data/lib/wp/wp-includes/js/jquery/ui/selectmenu.min.js +0 -11
  1006. data/lib/wp/wp-includes/js/jquery/ui/slider.min.js +0 -11
  1007. data/lib/wp/wp-includes/js/jquery/ui/sortable.min.js +0 -11
  1008. data/lib/wp/wp-includes/js/jquery/ui/spinner.min.js +0 -11
  1009. data/lib/wp/wp-includes/js/jquery/ui/tabs.min.js +0 -11
  1010. data/lib/wp/wp-includes/js/jquery/ui/tooltip.min.js +0 -11
  1011. data/lib/wp/wp-includes/js/jquery/ui/widget.min.js +0 -11
  1012. data/lib/wp/wp-includes/js/json2.js +0 -480
  1013. data/lib/wp/wp-includes/js/json2.min.js +0 -1
  1014. data/lib/wp/wp-includes/js/masonry.min.js +0 -1
  1015. data/lib/wp/wp-includes/js/mce-view.js +0 -829
  1016. data/lib/wp/wp-includes/js/mce-view.min.js +0 -1
  1017. data/lib/wp/wp-includes/js/media-audiovideo.js +0 -831
  1018. data/lib/wp/wp-includes/js/media-audiovideo.min.js +0 -1
  1019. data/lib/wp/wp-includes/js/media-editor.js +0 -1114
  1020. data/lib/wp/wp-includes/js/media-editor.min.js +0 -1
  1021. data/lib/wp/wp-includes/js/media-grid.js +0 -732
  1022. data/lib/wp/wp-includes/js/media-grid.min.js +0 -1
  1023. data/lib/wp/wp-includes/js/media-models.js +0 -1362
  1024. data/lib/wp/wp-includes/js/media-models.min.js +0 -1
  1025. data/lib/wp/wp-includes/js/media-views.js +0 -7484
  1026. data/lib/wp/wp-includes/js/media-views.min.js +0 -3
  1027. data/lib/wp/wp-includes/js/mediaelement/background.png +0 -0
  1028. data/lib/wp/wp-includes/js/mediaelement/bigplay.png +0 -0
  1029. data/lib/wp/wp-includes/js/mediaelement/bigplay.svg +0 -1
  1030. data/lib/wp/wp-includes/js/mediaelement/controls.png +0 -0
  1031. data/lib/wp/wp-includes/js/mediaelement/controls.svg +0 -1
  1032. data/lib/wp/wp-includes/js/mediaelement/flashmediaelement.swf +0 -0
  1033. data/lib/wp/wp-includes/js/mediaelement/loading.gif +0 -0
  1034. data/lib/wp/wp-includes/js/mediaelement/mediaelement-and-player.min.js +0 -181
  1035. data/lib/wp/wp-includes/js/mediaelement/mediaelementplayer.min.css +0 -1
  1036. data/lib/wp/wp-includes/js/mediaelement/silverlightmediaelement.xap +0 -0
  1037. data/lib/wp/wp-includes/js/mediaelement/wp-mediaelement.css +0 -274
  1038. data/lib/wp/wp-includes/js/mediaelement/wp-mediaelement.js +0 -34
  1039. data/lib/wp/wp-includes/js/mediaelement/wp-playlist.js +0 -175
  1040. data/lib/wp/wp-includes/js/plupload/handlers.js +0 -488
  1041. data/lib/wp/wp-includes/js/plupload/handlers.min.js +0 -1
  1042. data/lib/wp/wp-includes/js/plupload/license.txt +0 -339
  1043. data/lib/wp/wp-includes/js/plupload/plupload.flash.swf +0 -0
  1044. data/lib/wp/wp-includes/js/plupload/plupload.full.min.js +0 -28
  1045. data/lib/wp/wp-includes/js/plupload/plupload.silverlight.xap +0 -0
  1046. data/lib/wp/wp-includes/js/plupload/wp-plupload.js +0 -376
  1047. data/lib/wp/wp-includes/js/plupload/wp-plupload.min.js +0 -1
  1048. data/lib/wp/wp-includes/js/quicktags.js +0 -652
  1049. data/lib/wp/wp-includes/js/quicktags.min.js +0 -1
  1050. data/lib/wp/wp-includes/js/shortcode.js +0 -356
  1051. data/lib/wp/wp-includes/js/shortcode.min.js +0 -1
  1052. data/lib/wp/wp-includes/js/swfobject.js +0 -4
  1053. data/lib/wp/wp-includes/js/swfupload/handlers.js +0 -376
  1054. data/lib/wp/wp-includes/js/swfupload/handlers.min.js +0 -1
  1055. data/lib/wp/wp-includes/js/swfupload/license.txt +0 -32
  1056. data/lib/wp/wp-includes/js/swfupload/plugins/swfupload.cookies.js +0 -53
  1057. data/lib/wp/wp-includes/js/swfupload/plugins/swfupload.queue.js +0 -98
  1058. data/lib/wp/wp-includes/js/swfupload/plugins/swfupload.speed.js +0 -342
  1059. data/lib/wp/wp-includes/js/swfupload/plugins/swfupload.swfobject.js +0 -105
  1060. data/lib/wp/wp-includes/js/swfupload/swfupload.js +0 -980
  1061. data/lib/wp/wp-includes/js/swfupload/swfupload.swf +0 -0
  1062. data/lib/wp/wp-includes/js/thickbox/loadingAnimation.gif +0 -0
  1063. data/lib/wp/wp-includes/js/thickbox/macFFBgHack.png +0 -0
  1064. data/lib/wp/wp-includes/js/thickbox/thickbox.css +0 -138
  1065. data/lib/wp/wp-includes/js/thickbox/thickbox.js +0 -314
  1066. data/lib/wp/wp-includes/js/tinymce/langs/wp-langs-en.js +0 -519
  1067. data/lib/wp/wp-includes/js/tinymce/license.txt +0 -504
  1068. data/lib/wp/wp-includes/js/tinymce/plugins/charmap/plugin.js +0 -370
  1069. data/lib/wp/wp-includes/js/tinymce/plugins/charmap/plugin.min.js +0 -1
  1070. data/lib/wp/wp-includes/js/tinymce/plugins/colorpicker/plugin.js +0 -112
  1071. data/lib/wp/wp-includes/js/tinymce/plugins/colorpicker/plugin.min.js +0 -1
  1072. data/lib/wp/wp-includes/js/tinymce/plugins/compat3x/css/dialog.css +0 -212
  1073. data/lib/wp/wp-includes/js/tinymce/plugins/compat3x/plugin.js +0 -304
  1074. data/lib/wp/wp-includes/js/tinymce/plugins/compat3x/plugin.min.js +0 -1
  1075. data/lib/wp/wp-includes/js/tinymce/plugins/directionality/plugin.js +0 -64
  1076. data/lib/wp/wp-includes/js/tinymce/plugins/directionality/plugin.min.js +0 -1
  1077. data/lib/wp/wp-includes/js/tinymce/plugins/fullscreen/plugin.js +0 -136
  1078. data/lib/wp/wp-includes/js/tinymce/plugins/fullscreen/plugin.min.js +0 -1
  1079. data/lib/wp/wp-includes/js/tinymce/plugins/hr/plugin.js +0 -30
  1080. data/lib/wp/wp-includes/js/tinymce/plugins/hr/plugin.min.js +0 -1
  1081. data/lib/wp/wp-includes/js/tinymce/plugins/image/plugin.js +0 -450
  1082. data/lib/wp/wp-includes/js/tinymce/plugins/image/plugin.min.js +0 -1
  1083. data/lib/wp/wp-includes/js/tinymce/plugins/lists/plugin.js +0 -786
  1084. data/lib/wp/wp-includes/js/tinymce/plugins/lists/plugin.min.js +0 -1
  1085. data/lib/wp/wp-includes/js/tinymce/plugins/media/moxieplayer.swf +0 -0
  1086. data/lib/wp/wp-includes/js/tinymce/plugins/media/plugin.js +0 -774
  1087. data/lib/wp/wp-includes/js/tinymce/plugins/media/plugin.min.js +0 -1
  1088. data/lib/wp/wp-includes/js/tinymce/plugins/paste/plugin.js +0 -1553
  1089. data/lib/wp/wp-includes/js/tinymce/plugins/paste/plugin.min.js +0 -1
  1090. data/lib/wp/wp-includes/js/tinymce/plugins/tabfocus/plugin.js +0 -125
  1091. data/lib/wp/wp-includes/js/tinymce/plugins/tabfocus/plugin.min.js +0 -1
  1092. data/lib/wp/wp-includes/js/tinymce/plugins/textcolor/plugin.js +0 -272
  1093. data/lib/wp/wp-includes/js/tinymce/plugins/textcolor/plugin.min.js +0 -1
  1094. data/lib/wp/wp-includes/js/tinymce/plugins/wordpress/plugin.js +0 -513
  1095. data/lib/wp/wp-includes/js/tinymce/plugins/wordpress/plugin.min.js +0 -1
  1096. data/lib/wp/wp-includes/js/tinymce/plugins/wpautoresize/plugin.js +0 -207
  1097. data/lib/wp/wp-includes/js/tinymce/plugins/wpautoresize/plugin.min.js +0 -1
  1098. data/lib/wp/wp-includes/js/tinymce/plugins/wpdialogs/plugin.js +0 -92
  1099. data/lib/wp/wp-includes/js/tinymce/plugins/wpdialogs/plugin.min.js +0 -1
  1100. data/lib/wp/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js +0 -1035
  1101. data/lib/wp/wp-includes/js/tinymce/plugins/wpeditimage/plugin.min.js +0 -1
  1102. data/lib/wp/wp-includes/js/tinymce/plugins/wpfullscreen/plugin.js +0 -78
  1103. data/lib/wp/wp-includes/js/tinymce/plugins/wpfullscreen/plugin.min.js +0 -1
  1104. data/lib/wp/wp-includes/js/tinymce/plugins/wpgallery/plugin.js +0 -130
  1105. data/lib/wp/wp-includes/js/tinymce/plugins/wpgallery/plugin.min.js +0 -1
  1106. data/lib/wp/wp-includes/js/tinymce/plugins/wplink/plugin.js +0 -63
  1107. data/lib/wp/wp-includes/js/tinymce/plugins/wplink/plugin.min.js +0 -1
  1108. data/lib/wp/wp-includes/js/tinymce/plugins/wpview/plugin.js +0 -694
  1109. data/lib/wp/wp-includes/js/tinymce/plugins/wpview/plugin.min.js +0 -1
  1110. data/lib/wp/wp-includes/js/tinymce/skins/lightgray/content.inline.min.css +0 -1
  1111. data/lib/wp/wp-includes/js/tinymce/skins/lightgray/content.min.css +0 -1
  1112. data/lib/wp/wp-includes/js/tinymce/skins/lightgray/fonts/readme.md +0 -1
  1113. data/lib/wp/wp-includes/js/tinymce/skins/lightgray/fonts/tinymce-small.eot +0 -0
  1114. data/lib/wp/wp-includes/js/tinymce/skins/lightgray/fonts/tinymce-small.svg +0 -62
  1115. data/lib/wp/wp-includes/js/tinymce/skins/lightgray/fonts/tinymce-small.ttf +0 -0
  1116. data/lib/wp/wp-includes/js/tinymce/skins/lightgray/fonts/tinymce-small.woff +0 -0
  1117. data/lib/wp/wp-includes/js/tinymce/skins/lightgray/fonts/tinymce.eot +0 -0
  1118. data/lib/wp/wp-includes/js/tinymce/skins/lightgray/fonts/tinymce.svg +0 -63
  1119. data/lib/wp/wp-includes/js/tinymce/skins/lightgray/fonts/tinymce.ttf +0 -0
  1120. data/lib/wp/wp-includes/js/tinymce/skins/lightgray/fonts/tinymce.woff +0 -0
  1121. data/lib/wp/wp-includes/js/tinymce/skins/lightgray/img/anchor.gif +0 -0
  1122. data/lib/wp/wp-includes/js/tinymce/skins/lightgray/img/loader.gif +0 -0
  1123. data/lib/wp/wp-includes/js/tinymce/skins/lightgray/img/object.gif +0 -0
  1124. data/lib/wp/wp-includes/js/tinymce/skins/lightgray/img/trans.gif +0 -0
  1125. data/lib/wp/wp-includes/js/tinymce/skins/lightgray/skin.ie7.min.css +0 -1
  1126. data/lib/wp/wp-includes/js/tinymce/skins/lightgray/skin.min.css +0 -1
  1127. data/lib/wp/wp-includes/js/tinymce/skins/wordpress/images/audio.png +0 -0
  1128. data/lib/wp/wp-includes/js/tinymce/skins/wordpress/images/dashicon-edit.png +0 -0
  1129. data/lib/wp/wp-includes/js/tinymce/skins/wordpress/images/dashicon-no-alt.png +0 -0
  1130. data/lib/wp/wp-includes/js/tinymce/skins/wordpress/images/embedded.png +0 -0
  1131. data/lib/wp/wp-includes/js/tinymce/skins/wordpress/images/gallery-2x.png +0 -0
  1132. data/lib/wp/wp-includes/js/tinymce/skins/wordpress/images/gallery.png +0 -0
  1133. data/lib/wp/wp-includes/js/tinymce/skins/wordpress/images/more-2x.png +0 -0
  1134. data/lib/wp/wp-includes/js/tinymce/skins/wordpress/images/more.png +0 -0
  1135. data/lib/wp/wp-includes/js/tinymce/skins/wordpress/images/pagebreak-2x.png +0 -0
  1136. data/lib/wp/wp-includes/js/tinymce/skins/wordpress/images/pagebreak.png +0 -0
  1137. data/lib/wp/wp-includes/js/tinymce/skins/wordpress/images/playlist-audio.png +0 -0
  1138. data/lib/wp/wp-includes/js/tinymce/skins/wordpress/images/playlist-video.png +0 -0
  1139. data/lib/wp/wp-includes/js/tinymce/skins/wordpress/images/video.png +0 -0
  1140. data/lib/wp/wp-includes/js/tinymce/skins/wordpress/wp-content.css +0 -618
  1141. data/lib/wp/wp-includes/js/tinymce/themes/modern/theme.js +0 -617
  1142. data/lib/wp/wp-includes/js/tinymce/themes/modern/theme.min.js +0 -1
  1143. data/lib/wp/wp-includes/js/tinymce/tiny_mce_popup.js +0 -539
  1144. data/lib/wp/wp-includes/js/tinymce/tinymce.min.js +0 -11
  1145. data/lib/wp/wp-includes/js/tinymce/utils/editable_selects.js +0 -70
  1146. data/lib/wp/wp-includes/js/tinymce/utils/form_utils.js +0 -210
  1147. data/lib/wp/wp-includes/js/tinymce/utils/mctabs.js +0 -164
  1148. data/lib/wp/wp-includes/js/tinymce/utils/validate.js +0 -252
  1149. data/lib/wp/wp-includes/js/tinymce/wp-mce-help.php +0 -145
  1150. data/lib/wp/wp-includes/js/tinymce/wp-tinymce.js.gz +0 -0
  1151. data/lib/wp/wp-includes/js/tinymce/wp-tinymce.php +0 -39
  1152. data/lib/wp/wp-includes/js/tw-sack.js +0 -193
  1153. data/lib/wp/wp-includes/js/tw-sack.min.js +0 -1
  1154. data/lib/wp/wp-includes/js/underscore.min.js +0 -1
  1155. data/lib/wp/wp-includes/js/utils.js +0 -197
  1156. data/lib/wp/wp-includes/js/utils.min.js +0 -1
  1157. data/lib/wp/wp-includes/js/wp-ajax-response.js +0 -64
  1158. data/lib/wp/wp-includes/js/wp-ajax-response.min.js +0 -1
  1159. data/lib/wp/wp-includes/js/wp-auth-check.js +0 -112
  1160. data/lib/wp/wp-includes/js/wp-auth-check.min.js +0 -1
  1161. data/lib/wp/wp-includes/js/wp-backbone.js +0 -386
  1162. data/lib/wp/wp-includes/js/wp-backbone.min.js +0 -1
  1163. data/lib/wp/wp-includes/js/wp-list-revisions.js +0 -24
  1164. data/lib/wp/wp-includes/js/wp-list-revisions.min.js +0 -1
  1165. data/lib/wp/wp-includes/js/wp-lists.js +0 -469
  1166. data/lib/wp/wp-includes/js/wp-lists.min.js +0 -1
  1167. data/lib/wp/wp-includes/js/wp-pointer.js +0 -282
  1168. data/lib/wp/wp-includes/js/wp-pointer.min.js +0 -1
  1169. data/lib/wp/wp-includes/js/wp-util.js +0 -106
  1170. data/lib/wp/wp-includes/js/wp-util.min.js +0 -1
  1171. data/lib/wp/wp-includes/js/wpdialog.js +0 -19
  1172. data/lib/wp/wp-includes/js/wpdialog.min.js +0 -1
  1173. data/lib/wp/wp-includes/js/wplink.js +0 -615
  1174. data/lib/wp/wp-includes/js/wplink.min.js +0 -1
  1175. data/lib/wp/wp-includes/js/zxcvbn-async.js +0 -18
  1176. data/lib/wp/wp-includes/js/zxcvbn-async.min.js +0 -1
  1177. data/lib/wp/wp-includes/js/zxcvbn.min.js +0 -47
  1178. data/lib/wp/wp-includes/kses.php +0 -1526
  1179. data/lib/wp/wp-includes/l10n.php +0 -908
  1180. data/lib/wp/wp-includes/link-template.php +0 -3141
  1181. data/lib/wp/wp-includes/load.php +0 -828
  1182. data/lib/wp/wp-includes/locale.php +0 -368
  1183. data/lib/wp/wp-includes/media-template.php +0 -1235
  1184. data/lib/wp/wp-includes/media.php +0 -3329
  1185. data/lib/wp/wp-includes/meta.php +0 -1221
  1186. data/lib/wp/wp-includes/ms-blogs.php +0 -939
  1187. data/lib/wp/wp-includes/ms-default-constants.php +0 -153
  1188. data/lib/wp/wp-includes/ms-default-filters.php +0 -82
  1189. data/lib/wp/wp-includes/ms-deprecated.php +0 -347
  1190. data/lib/wp/wp-includes/ms-files.php +0 -82
  1191. data/lib/wp/wp-includes/ms-functions.php +0 -2476
  1192. data/lib/wp/wp-includes/ms-load.php +0 -458
  1193. data/lib/wp/wp-includes/ms-settings.php +0 -213
  1194. data/lib/wp/wp-includes/nav-menu-template.php +0 -678
  1195. data/lib/wp/wp-includes/nav-menu.php +0 -895
  1196. data/lib/wp/wp-includes/option.php +0 -1440
  1197. data/lib/wp/wp-includes/pluggable-deprecated.php +0 -192
  1198. data/lib/wp/wp-includes/pluggable.php +0 -2283
  1199. data/lib/wp/wp-includes/plugin.php +0 -920
  1200. data/lib/wp/wp-includes/pomo/entry.php +0 -78
  1201. data/lib/wp/wp-includes/pomo/mo.php +0 -262
  1202. data/lib/wp/wp-includes/pomo/po.php +0 -384
  1203. data/lib/wp/wp-includes/pomo/streams.php +0 -209
  1204. data/lib/wp/wp-includes/pomo/translations.php +0 -275
  1205. data/lib/wp/wp-includes/post-formats.php +0 -243
  1206. data/lib/wp/wp-includes/post-template.php +0 -1766
  1207. data/lib/wp/wp-includes/post-thumbnail-template.php +0 -142
  1208. data/lib/wp/wp-includes/post.php +0 -5842
  1209. data/lib/wp/wp-includes/query.php +0 -4666
  1210. data/lib/wp/wp-includes/registration-functions.php +0 -7
  1211. data/lib/wp/wp-includes/registration.php +0 -7
  1212. data/lib/wp/wp-includes/revision.php +0 -657
  1213. data/lib/wp/wp-includes/rewrite.php +0 -2180
  1214. data/lib/wp/wp-includes/rss-functions.php +0 -9
  1215. data/lib/wp/wp-includes/rss.php +0 -936
  1216. data/lib/wp/wp-includes/script-loader.php +0 -1045
  1217. data/lib/wp/wp-includes/session.php +0 -430
  1218. data/lib/wp/wp-includes/shortcodes.php +0 -410
  1219. data/lib/wp/wp-includes/taxonomy.php +0 -4006
  1220. data/lib/wp/wp-includes/template-loader.php +0 -76
  1221. data/lib/wp/wp-includes/template.php +0 -505
  1222. data/lib/wp/wp-includes/theme-compat/comments-popup.php +0 -128
  1223. data/lib/wp/wp-includes/theme-compat/comments.php +0 -101
  1224. data/lib/wp/wp-includes/theme-compat/footer.php +0 -30
  1225. data/lib/wp/wp-includes/theme-compat/header.php +0 -49
  1226. data/lib/wp/wp-includes/theme-compat/sidebar.php +0 -83
  1227. data/lib/wp/wp-includes/theme.php +0 -2014
  1228. data/lib/wp/wp-includes/update.php +0 -674
  1229. data/lib/wp/wp-includes/user.php +0 -2292
  1230. data/lib/wp/wp-includes/vars.php +0 -144
  1231. data/lib/wp/wp-includes/version.php +0 -35
  1232. data/lib/wp/wp-includes/widgets.php +0 -1514
  1233. data/lib/wp/wp-includes/wlwmanifest.xml +0 -43
  1234. data/lib/wp/wp-includes/wp-db.php +0 -2190
  1235. data/lib/wp/wp-includes/wp-diff.php +0 -523
  1236. data/lib/wp/wp-links-opml.php +0 -80
  1237. data/lib/wp/wp-load.php +0 -73
  1238. data/lib/wp/wp-login.php +0 -952
  1239. data/lib/wp/wp-mail.php +0 -260
  1240. data/lib/wp/wp-settings.php +0 -374
  1241. data/lib/wp/wp-signup.php +0 -749
  1242. data/lib/wp/wp-trackback.php +0 -127
  1243. data/lib/wp/xmlrpc.php +0 -101
@@ -1,4006 +0,0 @@
1
- <?php
2
- /**
3
- * Taxonomy API
4
- *
5
- * @package WordPress
6
- * @subpackage Taxonomy
7
- * @since 2.3.0
8
- */
9
-
10
- //
11
- // Taxonomy Registration
12
- //
13
-
14
- /**
15
- * Creates the initial taxonomies.
16
- *
17
- * This function fires twice: in wp-settings.php before plugins are loaded (for
18
- * backwards compatibility reasons), and again on the 'init' action. We must avoid
19
- * registering rewrite rules before the 'init' action.
20
- */
21
- function create_initial_taxonomies() {
22
- global $wp_rewrite;
23
-
24
- if ( ! did_action( 'init' ) ) {
25
- $rewrite = array( 'category' => false, 'post_tag' => false, 'post_format' => false );
26
- } else {
27
-
28
- /**
29
- * Filter the post formats rewrite base.
30
- *
31
- * @since 3.1.0
32
- *
33
- * @param string $context Context of the rewrite base. Default 'type'.
34
- */
35
- $post_format_base = apply_filters( 'post_format_rewrite_base', 'type' );
36
- $rewrite = array(
37
- 'category' => array(
38
- 'hierarchical' => true,
39
- 'slug' => get_option('category_base') ? get_option('category_base') : 'category',
40
- 'with_front' => ! get_option('category_base') || $wp_rewrite->using_index_permalinks(),
41
- 'ep_mask' => EP_CATEGORIES,
42
- ),
43
- 'post_tag' => array(
44
- 'hierarchical' => false,
45
- 'slug' => get_option('tag_base') ? get_option('tag_base') : 'tag',
46
- 'with_front' => ! get_option('tag_base') || $wp_rewrite->using_index_permalinks(),
47
- 'ep_mask' => EP_TAGS,
48
- ),
49
- 'post_format' => $post_format_base ? array( 'slug' => $post_format_base ) : false,
50
- );
51
- }
52
-
53
- register_taxonomy( 'category', 'post', array(
54
- 'hierarchical' => true,
55
- 'query_var' => 'category_name',
56
- 'rewrite' => $rewrite['category'],
57
- 'public' => true,
58
- 'show_ui' => true,
59
- 'show_admin_column' => true,
60
- '_builtin' => true,
61
- ) );
62
-
63
- register_taxonomy( 'post_tag', 'post', array(
64
- 'hierarchical' => false,
65
- 'query_var' => 'tag',
66
- 'rewrite' => $rewrite['post_tag'],
67
- 'public' => true,
68
- 'show_ui' => true,
69
- 'show_admin_column' => true,
70
- '_builtin' => true,
71
- ) );
72
-
73
- register_taxonomy( 'nav_menu', 'nav_menu_item', array(
74
- 'public' => false,
75
- 'hierarchical' => false,
76
- 'labels' => array(
77
- 'name' => __( 'Navigation Menus' ),
78
- 'singular_name' => __( 'Navigation Menu' ),
79
- ),
80
- 'query_var' => false,
81
- 'rewrite' => false,
82
- 'show_ui' => false,
83
- '_builtin' => true,
84
- 'show_in_nav_menus' => false,
85
- ) );
86
-
87
- register_taxonomy( 'link_category', 'link', array(
88
- 'hierarchical' => false,
89
- 'labels' => array(
90
- 'name' => __( 'Link Categories' ),
91
- 'singular_name' => __( 'Link Category' ),
92
- 'search_items' => __( 'Search Link Categories' ),
93
- 'popular_items' => null,
94
- 'all_items' => __( 'All Link Categories' ),
95
- 'edit_item' => __( 'Edit Link Category' ),
96
- 'update_item' => __( 'Update Link Category' ),
97
- 'add_new_item' => __( 'Add New Link Category' ),
98
- 'new_item_name' => __( 'New Link Category Name' ),
99
- 'separate_items_with_commas' => null,
100
- 'add_or_remove_items' => null,
101
- 'choose_from_most_used' => null,
102
- ),
103
- 'capabilities' => array(
104
- 'manage_terms' => 'manage_links',
105
- 'edit_terms' => 'manage_links',
106
- 'delete_terms' => 'manage_links',
107
- 'assign_terms' => 'manage_links',
108
- ),
109
- 'query_var' => false,
110
- 'rewrite' => false,
111
- 'public' => false,
112
- 'show_ui' => false,
113
- '_builtin' => true,
114
- ) );
115
-
116
- register_taxonomy( 'post_format', 'post', array(
117
- 'public' => true,
118
- 'hierarchical' => false,
119
- 'labels' => array(
120
- 'name' => _x( 'Format', 'post format' ),
121
- 'singular_name' => _x( 'Format', 'post format' ),
122
- ),
123
- 'query_var' => true,
124
- 'rewrite' => $rewrite['post_format'],
125
- 'show_ui' => false,
126
- '_builtin' => true,
127
- 'show_in_nav_menus' => current_theme_supports( 'post-formats' ),
128
- ) );
129
- }
130
- add_action( 'init', 'create_initial_taxonomies', 0 ); // highest priority
131
-
132
- /**
133
- * Get a list of registered taxonomy objects.
134
- *
135
- * @since 3.0.0
136
- * @uses $wp_taxonomies
137
- * @see register_taxonomy
138
- *
139
- * @param array $args An array of key => value arguments to match against the taxonomy objects.
140
- * @param string $output The type of output to return, either taxonomy 'names' or 'objects'. 'names' is the default.
141
- * @param string $operator The logical operation to perform. 'or' means only one element
142
- * from the array needs to match; 'and' means all elements must match. The default is 'and'.
143
- * @return array A list of taxonomy names or objects
144
- */
145
- function get_taxonomies( $args = array(), $output = 'names', $operator = 'and' ) {
146
- global $wp_taxonomies;
147
-
148
- $field = ('names' == $output) ? 'name' : false;
149
-
150
- return wp_filter_object_list($wp_taxonomies, $args, $operator, $field);
151
- }
152
-
153
- /**
154
- * Return all of the taxonomy names that are of $object_type.
155
- *
156
- * It appears that this function can be used to find all of the names inside of
157
- * $wp_taxonomies global variable.
158
- *
159
- * <code><?php $taxonomies = get_object_taxonomies('post'); ?></code> Should
160
- * result in <code>Array('category', 'post_tag')</code>
161
- *
162
- * @since 2.3.0
163
- *
164
- * @uses $wp_taxonomies
165
- *
166
- * @param array|string|object $object Name of the type of taxonomy object, or an object (row from posts)
167
- * @param string $output The type of output to return, either taxonomy 'names' or 'objects'. 'names' is the default.
168
- * @return array The names of all taxonomy of $object_type.
169
- */
170
- function get_object_taxonomies($object, $output = 'names') {
171
- global $wp_taxonomies;
172
-
173
- if ( is_object($object) ) {
174
- if ( $object->post_type == 'attachment' )
175
- return get_attachment_taxonomies($object);
176
- $object = $object->post_type;
177
- }
178
-
179
- $object = (array) $object;
180
-
181
- $taxonomies = array();
182
- foreach ( (array) $wp_taxonomies as $tax_name => $tax_obj ) {
183
- if ( array_intersect($object, (array) $tax_obj->object_type) ) {
184
- if ( 'names' == $output )
185
- $taxonomies[] = $tax_name;
186
- else
187
- $taxonomies[ $tax_name ] = $tax_obj;
188
- }
189
- }
190
-
191
- return $taxonomies;
192
- }
193
-
194
- /**
195
- * Retrieves the taxonomy object of $taxonomy.
196
- *
197
- * The get_taxonomy function will first check that the parameter string given
198
- * is a taxonomy object and if it is, it will return it.
199
- *
200
- * @since 2.3.0
201
- *
202
- * @uses $wp_taxonomies
203
- * @uses taxonomy_exists() Checks whether taxonomy exists
204
- *
205
- * @param string $taxonomy Name of taxonomy object to return
206
- * @return object|bool The Taxonomy Object or false if $taxonomy doesn't exist
207
- */
208
- function get_taxonomy( $taxonomy ) {
209
- global $wp_taxonomies;
210
-
211
- if ( ! taxonomy_exists( $taxonomy ) )
212
- return false;
213
-
214
- return $wp_taxonomies[$taxonomy];
215
- }
216
-
217
- /**
218
- * Checks that the taxonomy name exists.
219
- *
220
- * Formerly is_taxonomy(), introduced in 2.3.0.
221
- *
222
- * @since 3.0.0
223
- *
224
- * @uses $wp_taxonomies
225
- *
226
- * @param string $taxonomy Name of taxonomy object
227
- * @return bool Whether the taxonomy exists.
228
- */
229
- function taxonomy_exists( $taxonomy ) {
230
- global $wp_taxonomies;
231
-
232
- return isset( $wp_taxonomies[$taxonomy] );
233
- }
234
-
235
- /**
236
- * Whether the taxonomy object is hierarchical.
237
- *
238
- * Checks to make sure that the taxonomy is an object first. Then Gets the
239
- * object, and finally returns the hierarchical value in the object.
240
- *
241
- * A false return value might also mean that the taxonomy does not exist.
242
- *
243
- * @since 2.3.0
244
- *
245
- * @uses taxonomy_exists() Checks whether taxonomy exists
246
- * @uses get_taxonomy() Used to get the taxonomy object
247
- *
248
- * @param string $taxonomy Name of taxonomy object
249
- * @return bool Whether the taxonomy is hierarchical
250
- */
251
- function is_taxonomy_hierarchical($taxonomy) {
252
- if ( ! taxonomy_exists($taxonomy) )
253
- return false;
254
-
255
- $taxonomy = get_taxonomy($taxonomy);
256
- return $taxonomy->hierarchical;
257
- }
258
-
259
- /**
260
- * Create or modify a taxonomy object. Do not use before init.
261
- *
262
- * A simple function for creating or modifying a taxonomy object based on the
263
- * parameters given. The function will accept an array (third optional
264
- * parameter), along with strings for the taxonomy name and another string for
265
- * the object type.
266
- *
267
- * Nothing is returned, so expect error maybe or use taxonomy_exists() to check
268
- * whether taxonomy exists.
269
- *
270
- * Optional $args contents:
271
- *
272
- * - label - Name of the taxonomy shown in the menu. Usually plural. If not set, labels['name'] will be used.
273
- * - labels - An array of labels for this taxonomy.
274
- * * By default tag labels are used for non-hierarchical types and category labels for hierarchical ones.
275
- * * You can see accepted values in {@link get_taxonomy_labels()}.
276
- * - description - A short descriptive summary of what the taxonomy is for. Defaults to blank.
277
- * - public - If the taxonomy should be publicly queryable; //@TODO not implemented.
278
- * * Defaults to true.
279
- * - hierarchical - Whether the taxonomy is hierarchical (e.g. category). Defaults to false.
280
- * - show_ui - Whether to generate a default UI for managing this taxonomy in the admin.
281
- * * If not set, the default is inherited from public.
282
- * - show_in_menu - Whether to show the taxonomy in the admin menu.
283
- * * If true, the taxonomy is shown as a submenu of the object type menu.
284
- * * If false, no menu is shown.
285
- * * show_ui must be true.
286
- * * If not set, the default is inherited from show_ui.
287
- * - show_in_nav_menus - Makes this taxonomy available for selection in navigation menus.
288
- * * If not set, the default is inherited from public.
289
- * - show_tagcloud - Whether to list the taxonomy in the Tag Cloud Widget.
290
- * * If not set, the default is inherited from show_ui.
291
- * - show_admin_column - Whether to display a column for the taxonomy on its post type listing screens.
292
- * * Defaults to false.
293
- * - meta_box_cb - Provide a callback function for the meta box display.
294
- * * If not set, defaults to post_categories_meta_box for hierarchical taxonomies
295
- * and post_tags_meta_box for non-hierarchical.
296
- * * If false, no meta box is shown.
297
- * - capabilities - Array of capabilities for this taxonomy.
298
- * * You can see accepted values in this function.
299
- * - rewrite - Triggers the handling of rewrites for this taxonomy. Defaults to true, using $taxonomy as slug.
300
- * * To prevent rewrite, set to false.
301
- * * To specify rewrite rules, an array can be passed with any of these keys
302
- * * 'slug' => string Customize the permastruct slug. Defaults to $taxonomy key
303
- * * 'with_front' => bool Should the permastruct be prepended with WP_Rewrite::$front. Defaults to true.
304
- * * 'hierarchical' => bool Either hierarchical rewrite tag or not. Defaults to false.
305
- * * 'ep_mask' => const Assign an endpoint mask.
306
- * * If not specified, defaults to EP_NONE.
307
- * - query_var - Sets the query_var key for this taxonomy. Defaults to $taxonomy key
308
- * * If false, a taxonomy cannot be loaded at ?{query_var}={term_slug}
309
- * * If specified as a string, the query ?{query_var_string}={term_slug} will be valid.
310
- * - update_count_callback - Works much like a hook, in that it will be called when the count is updated.
311
- * * Defaults to _update_post_term_count() for taxonomies attached to post types, which then confirms
312
- * that the objects are published before counting them.
313
- * * Defaults to _update_generic_term_count() for taxonomies attached to other object types, such as links.
314
- * - _builtin - true if this taxonomy is a native or "built-in" taxonomy. THIS IS FOR INTERNAL USE ONLY!
315
- *
316
- * @since 2.3.0
317
- * @uses $wp_taxonomies Inserts new taxonomy object into the list
318
- * @uses $wp Adds query vars
319
- *
320
- * @param string $taxonomy Taxonomy key, must not exceed 32 characters.
321
- * @param array|string $object_type Name of the object type for the taxonomy object.
322
- * @param array|string $args See optional args description above.
323
- * @return null|WP_Error WP_Error if errors, otherwise null.
324
- */
325
- function register_taxonomy( $taxonomy, $object_type, $args = array() ) {
326
- global $wp_taxonomies, $wp;
327
-
328
- if ( ! is_array( $wp_taxonomies ) )
329
- $wp_taxonomies = array();
330
-
331
- $defaults = array(
332
- 'labels' => array(),
333
- 'description' => '',
334
- 'public' => true,
335
- 'hierarchical' => false,
336
- 'show_ui' => null,
337
- 'show_in_menu' => null,
338
- 'show_in_nav_menus' => null,
339
- 'show_tagcloud' => null,
340
- 'show_admin_column' => false,
341
- 'meta_box_cb' => null,
342
- 'capabilities' => array(),
343
- 'rewrite' => true,
344
- 'query_var' => $taxonomy,
345
- 'update_count_callback' => '',
346
- '_builtin' => false,
347
- );
348
- $args = wp_parse_args( $args, $defaults );
349
-
350
- if ( strlen( $taxonomy ) > 32 ) {
351
- _doing_it_wrong( __FUNCTION__, __( 'Taxonomies cannot exceed 32 characters in length' ), '4.0' );
352
- return new WP_Error( 'taxonomy_too_long', __( 'Taxonomies cannot exceed 32 characters in length' ) );
353
- }
354
-
355
- if ( false !== $args['query_var'] && ! empty( $wp ) ) {
356
- if ( true === $args['query_var'] )
357
- $args['query_var'] = $taxonomy;
358
- else
359
- $args['query_var'] = sanitize_title_with_dashes( $args['query_var'] );
360
- $wp->add_query_var( $args['query_var'] );
361
- }
362
-
363
- if ( false !== $args['rewrite'] && ( is_admin() || '' != get_option( 'permalink_structure' ) ) ) {
364
- $args['rewrite'] = wp_parse_args( $args['rewrite'], array(
365
- 'with_front' => true,
366
- 'hierarchical' => false,
367
- 'ep_mask' => EP_NONE,
368
- ) );
369
-
370
- if ( empty( $args['rewrite']['slug'] ) )
371
- $args['rewrite']['slug'] = sanitize_title_with_dashes( $taxonomy );
372
-
373
- if ( $args['hierarchical'] && $args['rewrite']['hierarchical'] )
374
- $tag = '(.+?)';
375
- else
376
- $tag = '([^/]+)';
377
-
378
- add_rewrite_tag( "%$taxonomy%", $tag, $args['query_var'] ? "{$args['query_var']}=" : "taxonomy=$taxonomy&term=" );
379
- add_permastruct( $taxonomy, "{$args['rewrite']['slug']}/%$taxonomy%", $args['rewrite'] );
380
- }
381
-
382
- // If not set, default to the setting for public.
383
- if ( null === $args['show_ui'] )
384
- $args['show_ui'] = $args['public'];
385
-
386
- // If not set, default to the setting for show_ui.
387
- if ( null === $args['show_in_menu' ] || ! $args['show_ui'] )
388
- $args['show_in_menu' ] = $args['show_ui'];
389
-
390
- // If not set, default to the setting for public.
391
- if ( null === $args['show_in_nav_menus'] )
392
- $args['show_in_nav_menus'] = $args['public'];
393
-
394
- // If not set, default to the setting for show_ui.
395
- if ( null === $args['show_tagcloud'] )
396
- $args['show_tagcloud'] = $args['show_ui'];
397
-
398
- $default_caps = array(
399
- 'manage_terms' => 'manage_categories',
400
- 'edit_terms' => 'manage_categories',
401
- 'delete_terms' => 'manage_categories',
402
- 'assign_terms' => 'edit_posts',
403
- );
404
- $args['cap'] = (object) array_merge( $default_caps, $args['capabilities'] );
405
- unset( $args['capabilities'] );
406
-
407
- $args['name'] = $taxonomy;
408
- $args['object_type'] = array_unique( (array) $object_type );
409
-
410
- $args['labels'] = get_taxonomy_labels( (object) $args );
411
- $args['label'] = $args['labels']->name;
412
-
413
- // If not set, use the default meta box
414
- if ( null === $args['meta_box_cb'] ) {
415
- if ( $args['hierarchical'] )
416
- $args['meta_box_cb'] = 'post_categories_meta_box';
417
- else
418
- $args['meta_box_cb'] = 'post_tags_meta_box';
419
- }
420
-
421
- $wp_taxonomies[ $taxonomy ] = (object) $args;
422
-
423
- // register callback handling for metabox
424
- add_filter( 'wp_ajax_add-' . $taxonomy, '_wp_ajax_add_hierarchical_term' );
425
-
426
- /**
427
- * Fires after a taxonomy is registered.
428
- *
429
- * @since 3.3.0
430
- *
431
- * @param string $taxonomy Taxonomy slug.
432
- * @param array|string $object_type Object type or array of object types.
433
- * @param array $args Array of taxonomy registration arguments.
434
- */
435
- do_action( 'registered_taxonomy', $taxonomy, $object_type, $args );
436
- }
437
-
438
- /**
439
- * Builds an object with all taxonomy labels out of a taxonomy object
440
- *
441
- * Accepted keys of the label array in the taxonomy object:
442
- * - name - general name for the taxonomy, usually plural. The same as and overridden by $tax->label. Default is Tags/Categories
443
- * - singular_name - name for one object of this taxonomy. Default is Tag/Category
444
- * - search_items - Default is Search Tags/Search Categories
445
- * - popular_items - This string isn't used on hierarchical taxonomies. Default is Popular Tags
446
- * - all_items - Default is All Tags/All Categories
447
- * - parent_item - This string isn't used on non-hierarchical taxonomies. In hierarchical ones the default is Parent Category
448
- * - parent_item_colon - The same as <code>parent_item</code>, but with colon <code>:</code> in the end
449
- * - edit_item - Default is Edit Tag/Edit Category
450
- * - view_item - Default is View Tag/View Category
451
- * - update_item - Default is Update Tag/Update Category
452
- * - add_new_item - Default is Add New Tag/Add New Category
453
- * - new_item_name - Default is New Tag Name/New Category Name
454
- * - separate_items_with_commas - This string isn't used on hierarchical taxonomies. Default is "Separate tags with commas", used in the meta box.
455
- * - add_or_remove_items - This string isn't used on hierarchical taxonomies. Default is "Add or remove tags", used in the meta box when JavaScript is disabled.
456
- * - choose_from_most_used - This string isn't used on hierarchical taxonomies. Default is "Choose from the most used tags", used in the meta box.
457
- * - not_found - This string isn't used on hierarchical taxonomies. Default is "No tags found", used in the meta box.
458
- *
459
- * Above, the first default value is for non-hierarchical taxonomies (like tags) and the second one is for hierarchical taxonomies (like categories).
460
- *
461
- * @since 3.0.0
462
- * @param object $tax Taxonomy object
463
- * @return object object with all the labels as member variables
464
- */
465
-
466
- function get_taxonomy_labels( $tax ) {
467
- $tax->labels = (array) $tax->labels;
468
-
469
- if ( isset( $tax->helps ) && empty( $tax->labels['separate_items_with_commas'] ) )
470
- $tax->labels['separate_items_with_commas'] = $tax->helps;
471
-
472
- if ( isset( $tax->no_tagcloud ) && empty( $tax->labels['not_found'] ) )
473
- $tax->labels['not_found'] = $tax->no_tagcloud;
474
-
475
- $nohier_vs_hier_defaults = array(
476
- 'name' => array( _x( 'Tags', 'taxonomy general name' ), _x( 'Categories', 'taxonomy general name' ) ),
477
- 'singular_name' => array( _x( 'Tag', 'taxonomy singular name' ), _x( 'Category', 'taxonomy singular name' ) ),
478
- 'search_items' => array( __( 'Search Tags' ), __( 'Search Categories' ) ),
479
- 'popular_items' => array( __( 'Popular Tags' ), null ),
480
- 'all_items' => array( __( 'All Tags' ), __( 'All Categories' ) ),
481
- 'parent_item' => array( null, __( 'Parent Category' ) ),
482
- 'parent_item_colon' => array( null, __( 'Parent Category:' ) ),
483
- 'edit_item' => array( __( 'Edit Tag' ), __( 'Edit Category' ) ),
484
- 'view_item' => array( __( 'View Tag' ), __( 'View Category' ) ),
485
- 'update_item' => array( __( 'Update Tag' ), __( 'Update Category' ) ),
486
- 'add_new_item' => array( __( 'Add New Tag' ), __( 'Add New Category' ) ),
487
- 'new_item_name' => array( __( 'New Tag Name' ), __( 'New Category Name' ) ),
488
- 'separate_items_with_commas' => array( __( 'Separate tags with commas' ), null ),
489
- 'add_or_remove_items' => array( __( 'Add or remove tags' ), null ),
490
- 'choose_from_most_used' => array( __( 'Choose from the most used tags' ), null ),
491
- 'not_found' => array( __( 'No tags found.' ), null ),
492
- );
493
- $nohier_vs_hier_defaults['menu_name'] = $nohier_vs_hier_defaults['name'];
494
-
495
- return _get_custom_object_labels( $tax, $nohier_vs_hier_defaults );
496
- }
497
-
498
- /**
499
- * Add an already registered taxonomy to an object type.
500
- *
501
- * @since 3.0.0
502
- * @uses $wp_taxonomies Modifies taxonomy object
503
- *
504
- * @param string $taxonomy Name of taxonomy object
505
- * @param string $object_type Name of the object type
506
- * @return bool True if successful, false if not
507
- */
508
- function register_taxonomy_for_object_type( $taxonomy, $object_type) {
509
- global $wp_taxonomies;
510
-
511
- if ( !isset($wp_taxonomies[$taxonomy]) )
512
- return false;
513
-
514
- if ( ! get_post_type_object($object_type) )
515
- return false;
516
-
517
- if ( ! in_array( $object_type, $wp_taxonomies[$taxonomy]->object_type ) )
518
- $wp_taxonomies[$taxonomy]->object_type[] = $object_type;
519
-
520
- return true;
521
- }
522
-
523
- /**
524
- * Remove an already registered taxonomy from an object type.
525
- *
526
- * @since 3.7.0
527
- *
528
- * @param string $taxonomy Name of taxonomy object.
529
- * @param string $object_type Name of the object type.
530
- * @return bool True if successful, false if not.
531
- */
532
- function unregister_taxonomy_for_object_type( $taxonomy, $object_type ) {
533
- global $wp_taxonomies;
534
-
535
- if ( ! isset( $wp_taxonomies[ $taxonomy ] ) )
536
- return false;
537
-
538
- if ( ! get_post_type_object( $object_type ) )
539
- return false;
540
-
541
- $key = array_search( $object_type, $wp_taxonomies[ $taxonomy ]->object_type, true );
542
- if ( false === $key )
543
- return false;
544
-
545
- unset( $wp_taxonomies[ $taxonomy ]->object_type[ $key ] );
546
- return true;
547
- }
548
-
549
- //
550
- // Term API
551
- //
552
-
553
- /**
554
- * Retrieve object_ids of valid taxonomy and term.
555
- *
556
- * The strings of $taxonomies must exist before this function will continue. On
557
- * failure of finding a valid taxonomy, it will return an WP_Error class, kind
558
- * of like Exceptions in PHP 5, except you can't catch them. Even so, you can
559
- * still test for the WP_Error class and get the error message.
560
- *
561
- * The $terms aren't checked the same as $taxonomies, but still need to exist
562
- * for $object_ids to be returned.
563
- *
564
- * It is possible to change the order that object_ids is returned by either
565
- * using PHP sort family functions or using the database by using $args with
566
- * either ASC or DESC array. The value should be in the key named 'order'.
567
- *
568
- * @since 2.3.0
569
- *
570
- * @uses $wpdb
571
- * @uses wp_parse_args() Creates an array from string $args.
572
- *
573
- * @param int|array $term_ids Term id or array of term ids of terms that will be used
574
- * @param string|array $taxonomies String of taxonomy name or Array of string values of taxonomy names
575
- * @param array|string $args Change the order of the object_ids, either ASC or DESC
576
- * @return WP_Error|array If the taxonomy does not exist, then WP_Error will be returned. On success
577
- * the array can be empty meaning that there are no $object_ids found or it will return the $object_ids found.
578
- */
579
- function get_objects_in_term( $term_ids, $taxonomies, $args = array() ) {
580
- global $wpdb;
581
-
582
- if ( ! is_array( $term_ids ) ) {
583
- $term_ids = array( $term_ids );
584
- }
585
- if ( ! is_array( $taxonomies ) ) {
586
- $taxonomies = array( $taxonomies );
587
- }
588
- foreach ( (array) $taxonomies as $taxonomy ) {
589
- if ( ! taxonomy_exists( $taxonomy ) ) {
590
- return new WP_Error( 'invalid_taxonomy', __( 'Invalid taxonomy' ) );
591
- }
592
- }
593
-
594
- $defaults = array( 'order' => 'ASC' );
595
- $args = wp_parse_args( $args, $defaults );
596
-
597
- $order = ( 'desc' == strtolower( $args['order'] ) ) ? 'DESC' : 'ASC';
598
-
599
- $term_ids = array_map('intval', $term_ids );
600
-
601
- $taxonomies = "'" . implode( "', '", $taxonomies ) . "'";
602
- $term_ids = "'" . implode( "', '", $term_ids ) . "'";
603
-
604
- $object_ids = $wpdb->get_col("SELECT tr.object_id FROM $wpdb->term_relationships AS tr INNER JOIN $wpdb->term_taxonomy AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN ($taxonomies) AND tt.term_id IN ($term_ids) ORDER BY tr.object_id $order");
605
-
606
- if ( ! $object_ids ){
607
- return array();
608
- }
609
- return $object_ids;
610
- }
611
-
612
- /**
613
- * Given a taxonomy query, generates SQL to be appended to a main query.
614
- *
615
- * @since 3.1.0
616
- *
617
- * @see WP_Tax_Query
618
- *
619
- * @param array $tax_query A compact tax query
620
- * @param string $primary_table
621
- * @param string $primary_id_column
622
- * @return array
623
- */
624
- function get_tax_sql( $tax_query, $primary_table, $primary_id_column ) {
625
- $tax_query_obj = new WP_Tax_Query( $tax_query );
626
- return $tax_query_obj->get_sql( $primary_table, $primary_id_column );
627
- }
628
-
629
- /**
630
- * Container class for a multiple taxonomy query.
631
- *
632
- * @since 3.1.0
633
- */
634
- class WP_Tax_Query {
635
-
636
- /**
637
- * List of taxonomy queries. A single taxonomy query is an associative array:
638
- * - 'taxonomy' string The taxonomy being queried. Optional when using the term_taxonomy_id field.
639
- * - 'terms' string|array The list of terms
640
- * - 'field' string (optional) Which term field is being used.
641
- * Possible values: 'term_id', 'slug', 'name', or 'term_taxonomy_id'
642
- * Default: 'term_id'
643
- * - 'operator' string (optional)
644
- * Possible values: 'AND', 'IN' or 'NOT IN'.
645
- * Default: 'IN'
646
- * - 'include_children' bool (optional) Whether to include child terms. Requires that a taxonomy be specified.
647
- * Default: true
648
- *
649
- * @since 3.1.0
650
- * @access public
651
- * @var array
652
- */
653
- public $queries = array();
654
-
655
- /**
656
- * The relation between the queries. Can be one of 'AND' or 'OR'.
657
- *
658
- * @since 3.1.0
659
- * @access public
660
- * @var string
661
- */
662
- public $relation;
663
-
664
- /**
665
- * Standard response when the query should not return any rows.
666
- *
667
- * @since 3.2.0
668
- * @access private
669
- * @var string
670
- */
671
- private static $no_results = array( 'join' => '', 'where' => ' AND 0 = 1' );
672
-
673
- /**
674
- * Constructor.
675
- *
676
- * Parses a compact tax query and sets defaults.
677
- *
678
- * @since 3.1.0
679
- * @access public
680
- *
681
- * @param array $tax_query A compact tax query:
682
- * array(
683
- * 'relation' => 'OR',
684
- * array(
685
- * 'taxonomy' => 'tax1',
686
- * 'terms' => array( 'term1', 'term2' ),
687
- * 'field' => 'slug',
688
- * ),
689
- * array(
690
- * 'taxonomy' => 'tax2',
691
- * 'terms' => array( 'term-a', 'term-b' ),
692
- * 'field' => 'slug',
693
- * ),
694
- * )
695
- */
696
- public function __construct( $tax_query ) {
697
- if ( isset( $tax_query['relation'] ) && strtoupper( $tax_query['relation'] ) == 'OR' ) {
698
- $this->relation = 'OR';
699
- } else {
700
- $this->relation = 'AND';
701
- }
702
-
703
- $defaults = array(
704
- 'taxonomy' => '',
705
- 'terms' => array(),
706
- 'include_children' => true,
707
- 'field' => 'term_id',
708
- 'operator' => 'IN',
709
- );
710
-
711
- foreach ( $tax_query as $query ) {
712
- if ( ! is_array( $query ) )
713
- continue;
714
-
715
- $query = array_merge( $defaults, $query );
716
-
717
- $query['terms'] = (array) $query['terms'];
718
-
719
- $this->queries[] = $query;
720
- }
721
- }
722
-
723
- /**
724
- * Generates SQL clauses to be appended to a main query.
725
- *
726
- * @since 3.1.0
727
- * @access public
728
- *
729
- * @param string $primary_table
730
- * @param string $primary_id_column
731
- * @return array
732
- */
733
- public function get_sql( $primary_table, $primary_id_column ) {
734
- global $wpdb;
735
-
736
- $join = '';
737
- $where = array();
738
- $i = 0;
739
- $count = count( $this->queries );
740
-
741
- foreach ( $this->queries as $index => $query ) {
742
- $this->clean_query( $query );
743
-
744
- if ( is_wp_error( $query ) ) {
745
- return self::$no_results;
746
- }
747
-
748
- $terms = $query['terms'];
749
- $operator = strtoupper( $query['operator'] );
750
-
751
- if ( 'IN' == $operator ) {
752
-
753
- if ( empty( $terms ) ) {
754
- if ( 'OR' == $this->relation ) {
755
- if ( ( $index + 1 === $count ) && empty( $where ) ) {
756
- return self::$no_results;
757
- }
758
- continue;
759
- } else {
760
- return self::$no_results;
761
- }
762
- }
763
-
764
- $terms = implode( ',', $terms );
765
-
766
- $alias = $i ? 'tt' . $i : $wpdb->term_relationships;
767
-
768
- $join .= " INNER JOIN $wpdb->term_relationships";
769
- $join .= $i ? " AS $alias" : '';
770
- $join .= " ON ($primary_table.$primary_id_column = $alias.object_id)";
771
-
772
- $where[] = "$alias.term_taxonomy_id $operator ($terms)";
773
- } elseif ( 'NOT IN' == $operator ) {
774
-
775
- if ( empty( $terms ) ) {
776
- continue;
777
- }
778
-
779
- $terms = implode( ',', $terms );
780
-
781
- $where[] = "$primary_table.$primary_id_column NOT IN (
782
- SELECT object_id
783
- FROM $wpdb->term_relationships
784
- WHERE term_taxonomy_id IN ($terms)
785
- )";
786
- } elseif ( 'AND' == $operator ) {
787
-
788
- if ( empty( $terms ) ) {
789
- continue;
790
- }
791
-
792
- $num_terms = count( $terms );
793
-
794
- $terms = implode( ',', $terms );
795
-
796
- $where[] = "(
797
- SELECT COUNT(1)
798
- FROM $wpdb->term_relationships
799
- WHERE term_taxonomy_id IN ($terms)
800
- AND object_id = $primary_table.$primary_id_column
801
- ) = $num_terms";
802
- }
803
-
804
- $i++;
805
- }
806
-
807
- if ( ! empty( $where ) ) {
808
- $where = ' AND ( ' . implode( " $this->relation ", $where ) . ' )';
809
- } else {
810
- $where = '';
811
- }
812
- return compact( 'join', 'where' );
813
- }
814
-
815
- /**
816
- * Validates a single query.
817
- *
818
- * @since 3.2.0
819
- * @access private
820
- *
821
- * @param array &$query The single query
822
- */
823
- private function clean_query( &$query ) {
824
- if ( empty( $query['taxonomy'] ) ) {
825
- if ( 'term_taxonomy_id' !== $query['field'] ) {
826
- $query = new WP_Error( 'Invalid taxonomy' );
827
- return;
828
- }
829
-
830
- // so long as there are shared terms, include_children requires that a taxonomy is set
831
- $query['include_children'] = false;
832
- } elseif ( ! taxonomy_exists( $query['taxonomy'] ) ) {
833
- $query = new WP_Error( 'Invalid taxonomy' );
834
- return;
835
- }
836
-
837
- $query['terms'] = array_unique( (array) $query['terms'] );
838
-
839
- if ( is_taxonomy_hierarchical( $query['taxonomy'] ) && $query['include_children'] ) {
840
- $this->transform_query( $query, 'term_id' );
841
-
842
- if ( is_wp_error( $query ) )
843
- return;
844
-
845
- $children = array();
846
- foreach ( $query['terms'] as $term ) {
847
- $children = array_merge( $children, get_term_children( $term, $query['taxonomy'] ) );
848
- $children[] = $term;
849
- }
850
- $query['terms'] = $children;
851
- }
852
-
853
- $this->transform_query( $query, 'term_taxonomy_id' );
854
- }
855
-
856
- /**
857
- * Transforms a single query, from one field to another.
858
- *
859
- * @since 3.2.0
860
- *
861
- * @param array &$query The single query
862
- * @param string $resulting_field The resulting field
863
- */
864
- public function transform_query( &$query, $resulting_field ) {
865
- global $wpdb;
866
-
867
- if ( empty( $query['terms'] ) )
868
- return;
869
-
870
- if ( $query['field'] == $resulting_field )
871
- return;
872
-
873
- $resulting_field = sanitize_key( $resulting_field );
874
-
875
- switch ( $query['field'] ) {
876
- case 'slug':
877
- case 'name':
878
- $terms = "'" . implode( "','", array_map( 'sanitize_title_for_query', $query['terms'] ) ) . "'";
879
- $terms = $wpdb->get_col( "
880
- SELECT $wpdb->term_taxonomy.$resulting_field
881
- FROM $wpdb->term_taxonomy
882
- INNER JOIN $wpdb->terms USING (term_id)
883
- WHERE taxonomy = '{$query['taxonomy']}'
884
- AND $wpdb->terms.{$query['field']} IN ($terms)
885
- " );
886
- break;
887
- case 'term_taxonomy_id':
888
- $terms = implode( ',', array_map( 'intval', $query['terms'] ) );
889
- $terms = $wpdb->get_col( "
890
- SELECT $resulting_field
891
- FROM $wpdb->term_taxonomy
892
- WHERE term_taxonomy_id IN ($terms)
893
- " );
894
- break;
895
- default:
896
- $terms = implode( ',', array_map( 'intval', $query['terms'] ) );
897
- $terms = $wpdb->get_col( "
898
- SELECT $resulting_field
899
- FROM $wpdb->term_taxonomy
900
- WHERE taxonomy = '{$query['taxonomy']}'
901
- AND term_id IN ($terms)
902
- " );
903
- }
904
-
905
- if ( 'AND' == $query['operator'] && count( $terms ) < count( $query['terms'] ) ) {
906
- $query = new WP_Error( 'Inexistent terms' );
907
- return;
908
- }
909
-
910
- $query['terms'] = $terms;
911
- $query['field'] = $resulting_field;
912
- }
913
- }
914
-
915
- /**
916
- * Get all Term data from database by Term ID.
917
- *
918
- * The usage of the get_term function is to apply filters to a term object. It
919
- * is possible to get a term object from the database before applying the
920
- * filters.
921
- *
922
- * $term ID must be part of $taxonomy, to get from the database. Failure, might
923
- * be able to be captured by the hooks. Failure would be the same value as $wpdb
924
- * returns for the get_row method.
925
- *
926
- * There are two hooks, one is specifically for each term, named 'get_term', and
927
- * the second is for the taxonomy name, 'term_$taxonomy'. Both hooks gets the
928
- * term object, and the taxonomy name as parameters. Both hooks are expected to
929
- * return a Term object.
930
- *
931
- * 'get_term' hook - Takes two parameters the term Object and the taxonomy name.
932
- * Must return term object. Used in get_term() as a catch-all filter for every
933
- * $term.
934
- *
935
- * 'get_$taxonomy' hook - Takes two parameters the term Object and the taxonomy
936
- * name. Must return term object. $taxonomy will be the taxonomy name, so for
937
- * example, if 'category', it would be 'get_category' as the filter name. Useful
938
- * for custom taxonomies or plugging into default taxonomies.
939
- *
940
- * @since 2.3.0
941
- *
942
- * @uses $wpdb
943
- * @uses sanitize_term() Cleanses the term based on $filter context before returning.
944
- * @see sanitize_term_field() The $context param lists the available values for get_term_by() $filter param.
945
- *
946
- * @param int|object $term If integer, will get from database. If object will apply filters and return $term.
947
- * @param string $taxonomy Taxonomy name that $term is part of.
948
- * @param string $output Constant OBJECT, ARRAY_A, or ARRAY_N
949
- * @param string $filter Optional, default is raw or no WordPress defined filter will applied.
950
- * @return mixed|null|WP_Error Term Row from database. Will return null if $term is empty. If taxonomy does not
951
- * exist then WP_Error will be returned.
952
- */
953
- function get_term($term, $taxonomy, $output = OBJECT, $filter = 'raw') {
954
- global $wpdb;
955
-
956
- if ( empty($term) ) {
957
- $error = new WP_Error('invalid_term', __('Empty Term'));
958
- return $error;
959
- }
960
-
961
- if ( ! taxonomy_exists($taxonomy) ) {
962
- $error = new WP_Error('invalid_taxonomy', __('Invalid taxonomy'));
963
- return $error;
964
- }
965
-
966
- if ( is_object($term) && empty($term->filter) ) {
967
- wp_cache_add($term->term_id, $term, $taxonomy);
968
- $_term = $term;
969
- } else {
970
- if ( is_object($term) )
971
- $term = $term->term_id;
972
- if ( !$term = (int) $term )
973
- return null;
974
- if ( ! $_term = wp_cache_get($term, $taxonomy) ) {
975
- $_term = $wpdb->get_row( $wpdb->prepare( "SELECT t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy = %s AND t.term_id = %d LIMIT 1", $taxonomy, $term) );
976
- if ( ! $_term )
977
- return null;
978
- wp_cache_add($term, $_term, $taxonomy);
979
- }
980
- }
981
-
982
- /**
983
- * Filter a term.
984
- *
985
- * @since 2.3.0
986
- *
987
- * @param int|object $_term Term object or ID.
988
- * @param string $taxonomy The taxonomy slug.
989
- */
990
- $_term = apply_filters( 'get_term', $_term, $taxonomy );
991
-
992
- /**
993
- * Filter a taxonomy.
994
- *
995
- * The dynamic portion of the filter name, $taxonomy, refers
996
- * to the taxonomy slug.
997
- *
998
- * @since 2.3.0
999
- *
1000
- * @param int|object $_term Term object or ID.
1001
- * @param string $taxonomy The taxonomy slug.
1002
- */
1003
- $_term = apply_filters( "get_$taxonomy", $_term, $taxonomy );
1004
- $_term = sanitize_term($_term, $taxonomy, $filter);
1005
-
1006
- if ( $output == OBJECT ) {
1007
- return $_term;
1008
- } elseif ( $output == ARRAY_A ) {
1009
- $__term = get_object_vars($_term);
1010
- return $__term;
1011
- } elseif ( $output == ARRAY_N ) {
1012
- $__term = array_values(get_object_vars($_term));
1013
- return $__term;
1014
- } else {
1015
- return $_term;
1016
- }
1017
- }
1018
-
1019
- /**
1020
- * Get all Term data from database by Term field and data.
1021
- *
1022
- * Warning: $value is not escaped for 'name' $field. You must do it yourself, if
1023
- * required.
1024
- *
1025
- * The default $field is 'id', therefore it is possible to also use null for
1026
- * field, but not recommended that you do so.
1027
- *
1028
- * If $value does not exist, the return value will be false. If $taxonomy exists
1029
- * and $field and $value combinations exist, the Term will be returned.
1030
- *
1031
- * @since 2.3.0
1032
- *
1033
- * @uses $wpdb
1034
- * @uses sanitize_term() Cleanses the term based on $filter context before returning.
1035
- * @see sanitize_term_field() The $context param lists the available values for get_term_by() $filter param.
1036
- *
1037
- * @param string $field Either 'slug', 'name', 'id' (term_id), or 'term_taxonomy_id'
1038
- * @param string|int $value Search for this term value
1039
- * @param string $taxonomy Taxonomy Name
1040
- * @param string $output Constant OBJECT, ARRAY_A, or ARRAY_N
1041
- * @param string $filter Optional, default is raw or no WordPress defined filter will applied.
1042
- * @return mixed Term Row from database. Will return false if $taxonomy does not exist or $term was not found.
1043
- */
1044
- function get_term_by($field, $value, $taxonomy, $output = OBJECT, $filter = 'raw') {
1045
- global $wpdb;
1046
-
1047
- if ( ! taxonomy_exists($taxonomy) )
1048
- return false;
1049
-
1050
- if ( 'slug' == $field ) {
1051
- $field = 't.slug';
1052
- $value = sanitize_title($value);
1053
- if ( empty($value) )
1054
- return false;
1055
- } else if ( 'name' == $field ) {
1056
- // Assume already escaped
1057
- $value = wp_unslash($value);
1058
- $field = 't.name';
1059
- } else if ( 'term_taxonomy_id' == $field ) {
1060
- $value = (int) $value;
1061
- $field = 'tt.term_taxonomy_id';
1062
- } else {
1063
- $term = get_term( (int) $value, $taxonomy, $output, $filter);
1064
- if ( is_wp_error( $term ) )
1065
- $term = false;
1066
- return $term;
1067
- }
1068
-
1069
- $term = $wpdb->get_row( $wpdb->prepare( "SELECT t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy = %s AND $field = %s LIMIT 1", $taxonomy, $value) );
1070
- if ( !$term )
1071
- return false;
1072
-
1073
- wp_cache_add($term->term_id, $term, $taxonomy);
1074
-
1075
- /** This filter is documented in wp-includes/taxonomy.php */
1076
- $term = apply_filters( 'get_term', $term, $taxonomy );
1077
-
1078
- /** This filter is documented in wp-includes/taxonomy.php */
1079
- $term = apply_filters( "get_$taxonomy", $term, $taxonomy );
1080
-
1081
- $term = sanitize_term($term, $taxonomy, $filter);
1082
-
1083
- if ( $output == OBJECT ) {
1084
- return $term;
1085
- } elseif ( $output == ARRAY_A ) {
1086
- return get_object_vars($term);
1087
- } elseif ( $output == ARRAY_N ) {
1088
- return array_values(get_object_vars($term));
1089
- } else {
1090
- return $term;
1091
- }
1092
- }
1093
-
1094
- /**
1095
- * Merge all term children into a single array of their IDs.
1096
- *
1097
- * This recursive function will merge all of the children of $term into the same
1098
- * array of term IDs. Only useful for taxonomies which are hierarchical.
1099
- *
1100
- * Will return an empty array if $term does not exist in $taxonomy.
1101
- *
1102
- * @since 2.3.0
1103
- *
1104
- * @uses $wpdb
1105
- * @uses _get_term_hierarchy()
1106
- * @uses get_term_children() Used to get the children of both $taxonomy and the parent $term
1107
- *
1108
- * @param string $term_id ID of Term to get children
1109
- * @param string $taxonomy Taxonomy Name
1110
- * @return array|WP_Error List of Term IDs. WP_Error returned if $taxonomy does not exist
1111
- */
1112
- function get_term_children( $term_id, $taxonomy ) {
1113
- if ( ! taxonomy_exists($taxonomy) )
1114
- return new WP_Error('invalid_taxonomy', __('Invalid taxonomy'));
1115
-
1116
- $term_id = intval( $term_id );
1117
-
1118
- $terms = _get_term_hierarchy($taxonomy);
1119
-
1120
- if ( ! isset($terms[$term_id]) )
1121
- return array();
1122
-
1123
- $children = $terms[$term_id];
1124
-
1125
- foreach ( (array) $terms[$term_id] as $child ) {
1126
- if ( $term_id == $child ) {
1127
- continue;
1128
- }
1129
-
1130
- if ( isset($terms[$child]) )
1131
- $children = array_merge($children, get_term_children($child, $taxonomy));
1132
- }
1133
-
1134
- return $children;
1135
- }
1136
-
1137
- /**
1138
- * Get sanitized Term field.
1139
- *
1140
- * Does checks for $term, based on the $taxonomy. The function is for contextual
1141
- * reasons and for simplicity of usage. See sanitize_term_field() for more
1142
- * information.
1143
- *
1144
- * @since 2.3.0
1145
- *
1146
- * @uses sanitize_term_field() Passes the return value in sanitize_term_field on success.
1147
- *
1148
- * @param string $field Term field to fetch
1149
- * @param int $term Term ID
1150
- * @param string $taxonomy Taxonomy Name
1151
- * @param string $context Optional, default is display. Look at sanitize_term_field() for available options.
1152
- * @return mixed Will return an empty string if $term is not an object or if $field is not set in $term.
1153
- */
1154
- function get_term_field( $field, $term, $taxonomy, $context = 'display' ) {
1155
- $term = (int) $term;
1156
- $term = get_term( $term, $taxonomy );
1157
- if ( is_wp_error($term) )
1158
- return $term;
1159
-
1160
- if ( !is_object($term) )
1161
- return '';
1162
-
1163
- if ( !isset($term->$field) )
1164
- return '';
1165
-
1166
- return sanitize_term_field($field, $term->$field, $term->term_id, $taxonomy, $context);
1167
- }
1168
-
1169
- /**
1170
- * Sanitizes Term for editing.
1171
- *
1172
- * Return value is sanitize_term() and usage is for sanitizing the term for
1173
- * editing. Function is for contextual and simplicity.
1174
- *
1175
- * @since 2.3.0
1176
- *
1177
- * @uses sanitize_term() Passes the return value on success
1178
- *
1179
- * @param int|object $id Term ID or Object
1180
- * @param string $taxonomy Taxonomy Name
1181
- * @return mixed|null|WP_Error Will return empty string if $term is not an object.
1182
- */
1183
- function get_term_to_edit( $id, $taxonomy ) {
1184
- $term = get_term( $id, $taxonomy );
1185
-
1186
- if ( is_wp_error($term) )
1187
- return $term;
1188
-
1189
- if ( !is_object($term) )
1190
- return '';
1191
-
1192
- return sanitize_term($term, $taxonomy, 'edit');
1193
- }
1194
-
1195
- /**
1196
- * Retrieve the terms in a given taxonomy or list of taxonomies.
1197
- *
1198
- * You can fully inject any customizations to the query before it is sent, as
1199
- * well as control the output with a filter.
1200
- *
1201
- * The 'get_terms' filter will be called when the cache has the term and will
1202
- * pass the found term along with the array of $taxonomies and array of $args.
1203
- * This filter is also called before the array of terms is passed and will pass
1204
- * the array of terms, along with the $taxonomies and $args.
1205
- *
1206
- * The 'list_terms_exclusions' filter passes the compiled exclusions along with
1207
- * the $args.
1208
- *
1209
- * The 'get_terms_orderby' filter passes the ORDER BY clause for the query
1210
- * along with the $args array.
1211
- *
1212
- * The 'get_terms_fields' filter passes the fields for the SELECT query
1213
- * along with the $args array.
1214
- *
1215
- * @since 2.3.0
1216
- *
1217
- * @global wpdb $wpdb WordPress database access abstraction object.
1218
- *
1219
- * @param string|array $taxonomies Taxonomy name or list of Taxonomy names.
1220
- * @param array|string $args {
1221
- * Optional. Array or string of arguments to get terms.
1222
- *
1223
- * @type string $orderby Field(s) to order terms by. Accepts term fields, though
1224
- * empty defaults to 'term_id'. Default 'name'.
1225
- * @type string $order Whether to order terms in ascending or descending order.
1226
- * Accepts 'ASC' (ascending) or 'DESC' (descending).
1227
- * Default 'ASC'.
1228
- * @type bool|int $hide_empty Whether to hide terms not assigned to any posts. Accepts
1229
- * 1|true or 0|false. Default 1|true.
1230
- * @type array|string $include Array or comma/space-separated string of term ids to include.
1231
- * Default empty array.
1232
- * @type array|string $exclude Array or comma/space-separated string of term ids to exclude.
1233
- * If $include is non-empty, $exclude is ignored.
1234
- * Default empty array.
1235
- * @type array|string $exclude_tree Array or comma/space-separated string of term ids to exclude
1236
- * along with all of their descendant terms. If $include is
1237
- * non-empty, $exclude_tree is ignored. Default empty array.
1238
- * @type int $number Maximum number of terms to return. Accepts 1+ or -1 (all).
1239
- * Default -1.
1240
- * @type int $offset The number by which to offset the terms query. Default empty.
1241
- * @type string $fields Term fields to query for. Accepts 'all' (returns an array of
1242
- * term objects), 'ids' or 'names' (returns an array of integers
1243
- * or strings, respectively. Default 'all'.
1244
- * @type string $slug Slug to return term(s) for. Default empty.
1245
- * @type bool $hierarchical Whether to include terms that have non-empty descendants (even
1246
- * if $hide_empty is set to true). Default true.
1247
- * @type string $search Search criteria to match terms. Will be SQL-formatted with
1248
- * wildcards before and after. Default empty.
1249
- * @type string $name__like Retrieve terms with criteria by which a term is LIKE $name__like.
1250
- * Default empty.
1251
- * @type string $description__like Retrieve terms where the description is LIKE $description__like.
1252
- * Default empty.
1253
- * @type bool $pad_counts Whether to pad the quantity of a term's children in the quantity
1254
- * of each term's "count" object variable. Default false.
1255
- * @type string $get Whether to return terms regardless of ancestry or whether the terms
1256
- * are empty. Accepts 'all' or empty (disabled). Default empty.
1257
- * @type int $child_of Term ID to retrieve child terms of. If multiple taxonomies
1258
- * are passed, $child_of is ignored. Default 0.
1259
- * @type int|string $parent Parent term ID to retrieve direct-child terms of. Default empty.
1260
- * @type string $cache_domain Unique cache key to be produced when this query is stored in an
1261
- * object cache. Default is 'core'.
1262
- * }
1263
- * @return array|WP_Error List of Term Objects and their children. Will return WP_Error, if any of $taxonomies
1264
- * do not exist.
1265
- */
1266
- function get_terms( $taxonomies, $args = '' ) {
1267
- global $wpdb;
1268
- $empty_array = array();
1269
-
1270
- $single_taxonomy = ! is_array( $taxonomies ) || 1 === count( $taxonomies );
1271
- if ( ! is_array( $taxonomies ) ) {
1272
- $taxonomies = array( $taxonomies );
1273
- }
1274
-
1275
- foreach ( $taxonomies as $taxonomy ) {
1276
- if ( ! taxonomy_exists($taxonomy) ) {
1277
- $error = new WP_Error('invalid_taxonomy', __('Invalid taxonomy'));
1278
- return $error;
1279
- }
1280
- }
1281
-
1282
- $defaults = array('orderby' => 'name', 'order' => 'ASC',
1283
- 'hide_empty' => true, 'exclude' => array(), 'exclude_tree' => array(), 'include' => array(),
1284
- 'number' => '', 'fields' => 'all', 'slug' => '', 'parent' => '',
1285
- 'hierarchical' => true, 'child_of' => 0, 'get' => '', 'name__like' => '', 'description__like' => '',
1286
- 'pad_counts' => false, 'offset' => '', 'search' => '', 'cache_domain' => 'core' );
1287
- $args = wp_parse_args( $args, $defaults );
1288
- $args['number'] = absint( $args['number'] );
1289
- $args['offset'] = absint( $args['offset'] );
1290
- if ( !$single_taxonomy || ! is_taxonomy_hierarchical( reset( $taxonomies ) ) ||
1291
- ( '' !== $args['parent'] && 0 !== $args['parent'] ) ) {
1292
- $args['child_of'] = 0;
1293
- $args['hierarchical'] = false;
1294
- $args['pad_counts'] = false;
1295
- }
1296
-
1297
- if ( 'all' == $args['get'] ) {
1298
- $args['child_of'] = 0;
1299
- $args['hide_empty'] = 0;
1300
- $args['hierarchical'] = false;
1301
- $args['pad_counts'] = false;
1302
- }
1303
-
1304
- /**
1305
- * Filter the terms query arguments.
1306
- *
1307
- * @since 3.1.0
1308
- *
1309
- * @param array $args An array of arguments.
1310
- * @param string|array $taxonomies A taxonomy or array of taxonomies.
1311
- */
1312
- $args = apply_filters( 'get_terms_args', $args, $taxonomies );
1313
-
1314
- $child_of = $args['child_of'];
1315
- if ( $child_of ) {
1316
- $hierarchy = _get_term_hierarchy( reset( $taxonomies ) );
1317
- if ( ! isset( $hierarchy[ $child_of ] ) ) {
1318
- return $empty_array;
1319
- }
1320
- }
1321
-
1322
- $parent = $args['parent'];
1323
- if ( $parent ) {
1324
- $hierarchy = _get_term_hierarchy( reset( $taxonomies ) );
1325
- if ( ! isset( $hierarchy[ $parent ] ) ) {
1326
- return $empty_array;
1327
- }
1328
- }
1329
-
1330
- // $args can be whatever, only use the args defined in defaults to compute the key
1331
- $filter_key = ( has_filter('list_terms_exclusions') ) ? serialize($GLOBALS['wp_filter']['list_terms_exclusions']) : '';
1332
- $key = md5( serialize( wp_array_slice_assoc( $args, array_keys( $defaults ) ) ) . serialize( $taxonomies ) . $filter_key );
1333
- $last_changed = wp_cache_get( 'last_changed', 'terms' );
1334
- if ( ! $last_changed ) {
1335
- $last_changed = microtime();
1336
- wp_cache_set( 'last_changed', $last_changed, 'terms' );
1337
- }
1338
- $cache_key = "get_terms:$key:$last_changed";
1339
- $cache = wp_cache_get( $cache_key, 'terms' );
1340
- if ( false !== $cache ) {
1341
-
1342
- /**
1343
- * Filter the given taxonomy's terms cache.
1344
- *
1345
- * @since 2.3.0
1346
- *
1347
- * @param array $cache Cached array of terms for the given taxonomy.
1348
- * @param string|array $taxonomies A taxonomy or array of taxonomies.
1349
- * @param array $args An array of arguments to get terms.
1350
- */
1351
- $cache = apply_filters( 'get_terms', $cache, $taxonomies, $args );
1352
- return $cache;
1353
- }
1354
-
1355
- $_orderby = strtolower( $args['orderby'] );
1356
- if ( 'count' == $_orderby ) {
1357
- $orderby = 'tt.count';
1358
- } else if ( 'name' == $_orderby ) {
1359
- $orderby = 't.name';
1360
- } else if ( 'slug' == $_orderby ) {
1361
- $orderby = 't.slug';
1362
- } else if ( 'term_group' == $_orderby ) {
1363
- $orderby = 't.term_group';
1364
- } else if ( 'none' == $_orderby ) {
1365
- $orderby = '';
1366
- } elseif ( empty($_orderby) || 'id' == $_orderby ) {
1367
- $orderby = 't.term_id';
1368
- } else {
1369
- $orderby = 't.name';
1370
- }
1371
- /**
1372
- * Filter the ORDERBY clause of the terms query.
1373
- *
1374
- * @since 2.8.0
1375
- *
1376
- * @param string $orderby ORDERBY clause of the terms query.
1377
- * @param array $args An array of terms query arguments.
1378
- * @param string|array $taxonomies A taxonomy or array of taxonomies.
1379
- */
1380
- $orderby = apply_filters( 'get_terms_orderby', $orderby, $args, $taxonomies );
1381
-
1382
- $order = strtoupper( $args['order'] );
1383
- if ( ! empty( $orderby ) ) {
1384
- $orderby = "ORDER BY $orderby";
1385
- } else {
1386
- $order = '';
1387
- }
1388
-
1389
- if ( '' !== $order && ! in_array( $order, array( 'ASC', 'DESC' ) ) ) {
1390
- $order = 'ASC';
1391
- }
1392
-
1393
- $where = "tt.taxonomy IN ('" . implode("', '", $taxonomies) . "')";
1394
-
1395
- $exclude = $args['exclude'];
1396
- $exclude_tree = $args['exclude_tree'];
1397
- $include = $args['include'];
1398
-
1399
- $inclusions = '';
1400
- if ( ! empty( $include ) ) {
1401
- $exclude = '';
1402
- $exclude_tree = '';
1403
- $inclusions = implode( ',', wp_parse_id_list( $include ) );
1404
- }
1405
-
1406
- if ( ! empty( $inclusions ) ) {
1407
- $inclusions = ' AND t.term_id IN ( ' . $inclusions . ' )';
1408
- $where .= $inclusions;
1409
- }
1410
-
1411
- if ( ! empty( $exclude_tree ) ) {
1412
- $exclude_tree = wp_parse_id_list( $exclude_tree );
1413
- $excluded_children = $exclude_tree;
1414
- foreach ( $exclude_tree as $extrunk ) {
1415
- $excluded_children = array_merge(
1416
- $excluded_children,
1417
- (array) get_terms( $taxonomies[0], array( 'child_of' => intval( $extrunk ), 'fields' => 'ids', 'hide_empty' => 0 ) )
1418
- );
1419
- }
1420
- $exclusions = implode( ',', array_map( 'intval', $excluded_children ) );
1421
- } else {
1422
- $exclusions = '';
1423
- }
1424
-
1425
- if ( ! empty( $exclude ) ) {
1426
- $exterms = wp_parse_id_list( $exclude );
1427
- if ( empty( $exclusions ) ) {
1428
- $exclusions = implode( ',', $exterms );
1429
- } else {
1430
- $exclusions .= ', ' . implode( ',', $exterms );
1431
- }
1432
- }
1433
-
1434
- if ( ! empty( $exclusions ) ) {
1435
- $exclusions = ' AND t.term_id NOT IN (' . $exclusions . ')';
1436
- }
1437
-
1438
- /**
1439
- * Filter the terms to exclude from the terms query.
1440
- *
1441
- * @since 2.3.0
1442
- *
1443
- * @param string $exclusions NOT IN clause of the terms query.
1444
- * @param array $args An array of terms query arguments.
1445
- * @param string|array $taxonomies A taxonomy or array of taxonomies.
1446
- */
1447
- $exclusions = apply_filters( 'list_terms_exclusions', $exclusions, $args, $taxonomies );
1448
-
1449
- if ( ! empty( $exclusions ) ) {
1450
- $where .= $exclusions;
1451
- }
1452
-
1453
- if ( ! empty( $args['slug'] ) ) {
1454
- $slug = sanitize_title( $args['slug'] );
1455
- $where .= " AND t.slug = '$slug'";
1456
- }
1457
-
1458
- if ( ! empty( $args['name__like'] ) ) {
1459
- $where .= $wpdb->prepare( " AND t.name LIKE %s", '%' . $wpdb->esc_like( $args['name__like'] ) . '%' );
1460
- }
1461
-
1462
- if ( ! empty( $args['description__like'] ) ) {
1463
- $where .= $wpdb->prepare( " AND tt.description LIKE %s", '%' . $wpdb->esc_like( $args['description__like'] ) . '%' );
1464
- }
1465
-
1466
- if ( '' !== $parent ) {
1467
- $parent = (int) $parent;
1468
- $where .= " AND tt.parent = '$parent'";
1469
- }
1470
-
1471
- $hierarchical = $args['hierarchical'];
1472
- if ( 'count' == $args['fields'] ) {
1473
- $hierarchical = false;
1474
- }
1475
- if ( $args['hide_empty'] && !$hierarchical ) {
1476
- $where .= ' AND tt.count > 0';
1477
- }
1478
-
1479
- $number = $args['number'];
1480
- $offset = $args['offset'];
1481
-
1482
- // don't limit the query results when we have to descend the family tree
1483
- if ( $number && ! $hierarchical && ! $child_of && '' === $parent ) {
1484
- if ( $offset ) {
1485
- $limits = 'LIMIT ' . $offset . ',' . $number;
1486
- } else {
1487
- $limits = 'LIMIT ' . $number;
1488
- }
1489
- } else {
1490
- $limits = '';
1491
- }
1492
-
1493
- if ( ! empty( $args['search'] ) ) {
1494
- $like = '%' . $wpdb->esc_like( $args['search'] ) . '%';
1495
- $where .= $wpdb->prepare( ' AND ((t.name LIKE %s) OR (t.slug LIKE %s))', $like, $like );
1496
- }
1497
-
1498
- $selects = array();
1499
- switch ( $args['fields'] ) {
1500
- case 'all':
1501
- $selects = array( 't.*', 'tt.*' );
1502
- break;
1503
- case 'ids':
1504
- case 'id=>parent':
1505
- $selects = array( 't.term_id', 'tt.parent', 'tt.count' );
1506
- break;
1507
- case 'names':
1508
- $selects = array( 't.term_id', 'tt.parent', 'tt.count', 't.name' );
1509
- break;
1510
- case 'count':
1511
- $orderby = '';
1512
- $order = '';
1513
- $selects = array( 'COUNT(*)' );
1514
- break;
1515
- case 'id=>name':
1516
- $selects = array( 't.term_id', 't.name', 'tt.count' );
1517
- break;
1518
- case 'id=>slug':
1519
- $selects = array( 't.term_id', 't.slug', 'tt.count' );
1520
- break;
1521
- }
1522
-
1523
- $_fields = $args['fields'];
1524
-
1525
- /**
1526
- * Filter the fields to select in the terms query.
1527
- *
1528
- * @since 2.8.0
1529
- *
1530
- * @param array $selects An array of fields to select for the terms query.
1531
- * @param array $args An array of term query arguments.
1532
- * @param string|array $taxonomies A taxonomy or array of taxonomies.
1533
- */
1534
- $fields = implode( ', ', apply_filters( 'get_terms_fields', $selects, $args, $taxonomies ) );
1535
-
1536
- $join = "INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id";
1537
-
1538
- $pieces = array( 'fields', 'join', 'where', 'orderby', 'order', 'limits' );
1539
-
1540
- /**
1541
- * Filter the terms query SQL clauses.
1542
- *
1543
- * @since 3.1.0
1544
- *
1545
- * @param array $pieces Terms query SQL clauses.
1546
- * @param string|array $taxonomies A taxonomy or array of taxonomies.
1547
- * @param array $args An array of terms query arguments.
1548
- */
1549
- $clauses = apply_filters( 'terms_clauses', compact( $pieces ), $taxonomies, $args );
1550
- $fields = isset( $clauses[ 'fields' ] ) ? $clauses[ 'fields' ] : '';
1551
- $join = isset( $clauses[ 'join' ] ) ? $clauses[ 'join' ] : '';
1552
- $where = isset( $clauses[ 'where' ] ) ? $clauses[ 'where' ] : '';
1553
- $orderby = isset( $clauses[ 'orderby' ] ) ? $clauses[ 'orderby' ] : '';
1554
- $order = isset( $clauses[ 'order' ] ) ? $clauses[ 'order' ] : '';
1555
- $limits = isset( $clauses[ 'limits' ] ) ? $clauses[ 'limits' ] : '';
1556
-
1557
- $query = "SELECT $fields FROM $wpdb->terms AS t $join WHERE $where $orderby $order $limits";
1558
-
1559
- if ( 'count' == $_fields ) {
1560
- $term_count = $wpdb->get_var($query);
1561
- return $term_count;
1562
- }
1563
-
1564
- $terms = $wpdb->get_results($query);
1565
- if ( 'all' == $_fields ) {
1566
- update_term_cache($terms);
1567
- }
1568
-
1569
- if ( empty($terms) ) {
1570
- wp_cache_add( $cache_key, array(), 'terms', DAY_IN_SECONDS );
1571
-
1572
- /** This filter is documented in wp-includes/taxonomy.php */
1573
- $terms = apply_filters( 'get_terms', array(), $taxonomies, $args );
1574
- return $terms;
1575
- }
1576
-
1577
- if ( $child_of ) {
1578
- $children = _get_term_hierarchy( reset( $taxonomies ) );
1579
- if ( ! empty( $children ) ) {
1580
- $terms = _get_term_children( $child_of, $terms, reset( $taxonomies ) );
1581
- }
1582
- }
1583
-
1584
- // Update term counts to include children.
1585
- if ( $args['pad_counts'] && 'all' == $_fields ) {
1586
- _pad_term_counts( $terms, reset( $taxonomies ) );
1587
- }
1588
- // Make sure we show empty categories that have children.
1589
- if ( $hierarchical && $args['hide_empty'] && is_array( $terms ) ) {
1590
- foreach ( $terms as $k => $term ) {
1591
- if ( ! $term->count ) {
1592
- $children = get_term_children( $term->term_id, reset( $taxonomies ) );
1593
- if ( is_array( $children ) ) {
1594
- foreach ( $children as $child_id ) {
1595
- $child = get_term( $child_id, reset( $taxonomies ) );
1596
- if ( $child->count ) {
1597
- continue 2;
1598
- }
1599
- }
1600
- }
1601
-
1602
- // It really is empty
1603
- unset($terms[$k]);
1604
- }
1605
- }
1606
- }
1607
- reset( $terms );
1608
-
1609
- $_terms = array();
1610
- if ( 'id=>parent' == $_fields ) {
1611
- while ( $term = array_shift( $terms ) ) {
1612
- $_terms[$term->term_id] = $term->parent;
1613
- }
1614
- } elseif ( 'ids' == $_fields ) {
1615
- while ( $term = array_shift( $terms ) ) {
1616
- $_terms[] = $term->term_id;
1617
- }
1618
- } elseif ( 'names' == $_fields ) {
1619
- while ( $term = array_shift( $terms ) ) {
1620
- $_terms[] = $term->name;
1621
- }
1622
- } elseif ( 'id=>name' == $_fields ) {
1623
- while ( $term = array_shift( $terms ) ) {
1624
- $_terms[$term->term_id] = $term->name;
1625
- }
1626
- } elseif ( 'id=>slug' == $_fields ) {
1627
- while ( $term = array_shift( $terms ) ) {
1628
- $_terms[$term->term_id] = $term->slug;
1629
- }
1630
- }
1631
-
1632
- if ( ! empty( $_terms ) ) {
1633
- $terms = $_terms;
1634
- }
1635
-
1636
- if ( $number && is_array( $terms ) && count( $terms ) > $number ) {
1637
- $terms = array_slice( $terms, $offset, $number );
1638
- }
1639
-
1640
- wp_cache_add( $cache_key, $terms, 'terms', DAY_IN_SECONDS );
1641
-
1642
- /** This filter is documented in wp-includes/taxonomy */
1643
- $terms = apply_filters( 'get_terms', $terms, $taxonomies, $args );
1644
- return $terms;
1645
- }
1646
-
1647
- /**
1648
- * Check if Term exists.
1649
- *
1650
- * Formerly is_term(), introduced in 2.3.0.
1651
- *
1652
- * @since 3.0.0
1653
- *
1654
- * @uses $wpdb
1655
- *
1656
- * @param int|string $term The term to check
1657
- * @param string $taxonomy The taxonomy name to use
1658
- * @param int $parent Optional. ID of parent term under which to confine the exists search.
1659
- * @return mixed Returns null if the term does not exist. Returns the term ID
1660
- * if no taxonomy is specified and the term ID exists. Returns
1661
- * an array of the term ID and the term taxonomy ID the taxonomy
1662
- * is specified and the pairing exists.
1663
- */
1664
- function term_exists( $term, $taxonomy = '', $parent = null ) {
1665
- global $wpdb;
1666
-
1667
- $select = "SELECT term_id FROM $wpdb->terms as t WHERE ";
1668
- $tax_select = "SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE ";
1669
-
1670
- if ( is_int($term) ) {
1671
- if ( 0 == $term )
1672
- return 0;
1673
- $where = 't.term_id = %d';
1674
- if ( !empty($taxonomy) )
1675
- return $wpdb->get_row( $wpdb->prepare( $tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy ), ARRAY_A );
1676
- else
1677
- return $wpdb->get_var( $wpdb->prepare( $select . $where, $term ) );
1678
- }
1679
-
1680
- $term = trim( wp_unslash( $term ) );
1681
- $slug = sanitize_title( $term );
1682
-
1683
- $where = 't.slug = %s';
1684
- $else_where = 't.name = %s';
1685
- $where_fields = array($slug);
1686
- $else_where_fields = array($term);
1687
- if ( !empty($taxonomy) ) {
1688
- if ( is_numeric( $parent ) ) {
1689
- $parent = (int) $parent;
1690
- $where_fields[] = $parent;
1691
- $else_where_fields[] = $parent;
1692
- $where .= ' AND tt.parent = %d';
1693
- $else_where .= ' AND tt.parent = %d';
1694
- }
1695
-
1696
- $where_fields[] = $taxonomy;
1697
- $else_where_fields[] = $taxonomy;
1698
-
1699
- if ( $result = $wpdb->get_row( $wpdb->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $where AND tt.taxonomy = %s", $where_fields), ARRAY_A) )
1700
- return $result;
1701
-
1702
- return $wpdb->get_row( $wpdb->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $else_where AND tt.taxonomy = %s", $else_where_fields), ARRAY_A);
1703
- }
1704
-
1705
- if ( $result = $wpdb->get_var( $wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $where", $where_fields) ) )
1706
- return $result;
1707
-
1708
- return $wpdb->get_var( $wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $else_where", $else_where_fields) );
1709
- }
1710
-
1711
- /**
1712
- * Check if a term is an ancestor of another term.
1713
- *
1714
- * You can use either an id or the term object for both parameters.
1715
- *
1716
- * @since 3.4.0
1717
- *
1718
- * @param int|object $term1 ID or object to check if this is the parent term.
1719
- * @param int|object $term2 The child term.
1720
- * @param string $taxonomy Taxonomy name that $term1 and $term2 belong to.
1721
- * @return bool Whether $term2 is child of $term1
1722
- */
1723
- function term_is_ancestor_of( $term1, $term2, $taxonomy ) {
1724
- if ( ! isset( $term1->term_id ) )
1725
- $term1 = get_term( $term1, $taxonomy );
1726
- if ( ! isset( $term2->parent ) )
1727
- $term2 = get_term( $term2, $taxonomy );
1728
-
1729
- if ( empty( $term1->term_id ) || empty( $term2->parent ) )
1730
- return false;
1731
- if ( $term2->parent == $term1->term_id )
1732
- return true;
1733
-
1734
- return term_is_ancestor_of( $term1, get_term( $term2->parent, $taxonomy ), $taxonomy );
1735
- }
1736
-
1737
- /**
1738
- * Sanitize Term all fields.
1739
- *
1740
- * Relies on sanitize_term_field() to sanitize the term. The difference is that
1741
- * this function will sanitize <strong>all</strong> fields. The context is based
1742
- * on sanitize_term_field().
1743
- *
1744
- * The $term is expected to be either an array or an object.
1745
- *
1746
- * @since 2.3.0
1747
- *
1748
- * @uses sanitize_term_field Used to sanitize all fields in a term
1749
- *
1750
- * @param array|object $term The term to check
1751
- * @param string $taxonomy The taxonomy name to use
1752
- * @param string $context Default is 'display'.
1753
- * @return array|object Term with all fields sanitized
1754
- */
1755
- function sanitize_term($term, $taxonomy, $context = 'display') {
1756
-
1757
- $fields = array( 'term_id', 'name', 'description', 'slug', 'count', 'parent', 'term_group', 'term_taxonomy_id', 'object_id' );
1758
-
1759
- $do_object = is_object( $term );
1760
-
1761
- $term_id = $do_object ? $term->term_id : (isset($term['term_id']) ? $term['term_id'] : 0);
1762
-
1763
- foreach ( (array) $fields as $field ) {
1764
- if ( $do_object ) {
1765
- if ( isset($term->$field) )
1766
- $term->$field = sanitize_term_field($field, $term->$field, $term_id, $taxonomy, $context);
1767
- } else {
1768
- if ( isset($term[$field]) )
1769
- $term[$field] = sanitize_term_field($field, $term[$field], $term_id, $taxonomy, $context);
1770
- }
1771
- }
1772
-
1773
- if ( $do_object )
1774
- $term->filter = $context;
1775
- else
1776
- $term['filter'] = $context;
1777
-
1778
- return $term;
1779
- }
1780
-
1781
- /**
1782
- * Cleanse the field value in the term based on the context.
1783
- *
1784
- * Passing a term field value through the function should be assumed to have
1785
- * cleansed the value for whatever context the term field is going to be used.
1786
- *
1787
- * If no context or an unsupported context is given, then default filters will
1788
- * be applied.
1789
- *
1790
- * There are enough filters for each context to support a custom filtering
1791
- * without creating your own filter function. Simply create a function that
1792
- * hooks into the filter you need.
1793
- *
1794
- * @since 2.3.0
1795
- *
1796
- * @uses $wpdb
1797
- *
1798
- * @param string $field Term field to sanitize
1799
- * @param string $value Search for this term value
1800
- * @param int $term_id Term ID
1801
- * @param string $taxonomy Taxonomy Name
1802
- * @param string $context Either edit, db, display, attribute, or js.
1803
- * @return mixed sanitized field
1804
- */
1805
- function sanitize_term_field($field, $value, $term_id, $taxonomy, $context) {
1806
- $int_fields = array( 'parent', 'term_id', 'count', 'term_group', 'term_taxonomy_id', 'object_id' );
1807
- if ( in_array( $field, $int_fields ) ) {
1808
- $value = (int) $value;
1809
- if ( $value < 0 )
1810
- $value = 0;
1811
- }
1812
-
1813
- if ( 'raw' == $context )
1814
- return $value;
1815
-
1816
- if ( 'edit' == $context ) {
1817
-
1818
- /**
1819
- * Filter a term field to edit before it is sanitized.
1820
- *
1821
- * The dynamic portion of the filter name, $field, refers to the term field.
1822
- *
1823
- * @since 2.3.0
1824
- *
1825
- * @param mixed $value Value of the term field.
1826
- * @param int $term_id Term ID.
1827
- * @param string $taxonomy Taxonomy slug.
1828
- */
1829
- $value = apply_filters( "edit_term_{$field}", $value, $term_id, $taxonomy );
1830
-
1831
- /**
1832
- * Filter the taxonomy field to edit before it is sanitized.
1833
- *
1834
- * The dynamic portions of the filter name, $taxonomy, and $field, refer
1835
- * to the taxonomy slug and taxonomy field, respectively.
1836
- *
1837
- * @since 2.3.0
1838
- *
1839
- * @param mixed $value Value of the taxonomy field to edit.
1840
- * @param int $term_id Term ID.
1841
- */
1842
- $value = apply_filters( "edit_{$taxonomy}_{$field}", $value, $term_id );
1843
- if ( 'description' == $field )
1844
- $value = esc_html($value); // textarea_escaped
1845
- else
1846
- $value = esc_attr($value);
1847
- } else if ( 'db' == $context ) {
1848
-
1849
- /**
1850
- * Filter a term field value before it is sanitized.
1851
- *
1852
- * The dynamic portion of the filter name, $field, refers to the term field.
1853
- *
1854
- * @since 2.3.0
1855
- *
1856
- * @param mixed $value Value of the term field.
1857
- * @param string $taxonomy Taxonomy slug.
1858
- */
1859
- $value = apply_filters( "pre_term_{$field}", $value, $taxonomy );
1860
-
1861
- /**
1862
- * Filter a taxonomy field before it is sanitized.
1863
- *
1864
- * The dynamic portions of the filter name, $taxonomy, and $field, refer
1865
- * to the taxonomy slug and field name, respectively.
1866
- *
1867
- * @since 2.3.0
1868
- *
1869
- * @param mixed $value Value of the taxonomy field.
1870
- */
1871
- $value = apply_filters( "pre_{$taxonomy}_{$field}", $value );
1872
- // Back compat filters
1873
- if ( 'slug' == $field ) {
1874
- /**
1875
- * Filter the category nicename before it is sanitized.
1876
- *
1877
- * Use the pre_{$taxonomy}_{$field} hook instead.
1878
- *
1879
- * @since 2.0.3
1880
- *
1881
- * @param string $value The category nicename.
1882
- */
1883
- $value = apply_filters( 'pre_category_nicename', $value );
1884
- }
1885
-
1886
- } else if ( 'rss' == $context ) {
1887
-
1888
- /**
1889
- * Filter the term field for use in RSS.
1890
- *
1891
- * The dynamic portion of the filter name, $field, refers to the term field.
1892
- *
1893
- * @since 2.3.0
1894
- *
1895
- * @param mixed $value Value of the term field.
1896
- * @param string $taxonomy Taxonomy slug.
1897
- */
1898
- $value = apply_filters( "term_{$field}_rss", $value, $taxonomy );
1899
-
1900
- /**
1901
- * Filter the taxonomy field for use in RSS.
1902
- *
1903
- * The dynamic portions of the hook name, $taxonomy, and $field, refer
1904
- * to the taxonomy slug and field name, respectively.
1905
- *
1906
- * @since 2.3.0
1907
- *
1908
- * @param mixed $value Value of the taxonomy field.
1909
- */
1910
- $value = apply_filters( "{$taxonomy}_{$field}_rss", $value );
1911
- } else {
1912
- // Use display filters by default.
1913
-
1914
- /**
1915
- * Filter the term field sanitized for display.
1916
- *
1917
- * The dynamic portion of the filter name, $field, refers to the term field name.
1918
- *
1919
- * @since 2.3.0
1920
- *
1921
- * @param mixed $value Value of the term field.
1922
- * @param int $term_id Term ID.
1923
- * @param string $taxonomy Taxonomy slug.
1924
- * @param string $context Context to retrieve the term field value.
1925
- */
1926
- $value = apply_filters( "term_{$field}", $value, $term_id, $taxonomy, $context );
1927
-
1928
- /**
1929
- * Filter the taxonomy field sanitized for display.
1930
- *
1931
- * The dynamic portions of the filter name, $taxonomy, and $field, refer
1932
- * to the taxonomy slug and taxonomy field, respectively.
1933
- *
1934
- * @since 2.3.0
1935
- *
1936
- * @param mixed $value Value of the taxonomy field.
1937
- * @param int $term_id Term ID.
1938
- * @param string $context Context to retrieve the taxonomy field value.
1939
- */
1940
- $value = apply_filters( "{$taxonomy}_{$field}", $value, $term_id, $context );
1941
- }
1942
-
1943
- if ( 'attribute' == $context )
1944
- $value = esc_attr($value);
1945
- else if ( 'js' == $context )
1946
- $value = esc_js($value);
1947
-
1948
- return $value;
1949
- }
1950
-
1951
- /**
1952
- * Count how many terms are in Taxonomy.
1953
- *
1954
- * Default $args is 'hide_empty' which can be 'hide_empty=true' or array('hide_empty' => true).
1955
- *
1956
- * @since 2.3.0
1957
- *
1958
- * @uses get_terms()
1959
- * @uses wp_parse_args() Turns strings into arrays and merges defaults into an array.
1960
- *
1961
- * @param string $taxonomy Taxonomy name
1962
- * @param array|string $args Overwrite defaults. See get_terms()
1963
- * @return int|WP_Error How many terms are in $taxonomy. WP_Error if $taxonomy does not exist.
1964
- */
1965
- function wp_count_terms( $taxonomy, $args = array() ) {
1966
- $defaults = array('hide_empty' => false);
1967
- $args = wp_parse_args($args, $defaults);
1968
-
1969
- // backwards compatibility
1970
- if ( isset($args['ignore_empty']) ) {
1971
- $args['hide_empty'] = $args['ignore_empty'];
1972
- unset($args['ignore_empty']);
1973
- }
1974
-
1975
- $args['fields'] = 'count';
1976
-
1977
- return get_terms($taxonomy, $args);
1978
- }
1979
-
1980
- /**
1981
- * Will unlink the object from the taxonomy or taxonomies.
1982
- *
1983
- * Will remove all relationships between the object and any terms in
1984
- * a particular taxonomy or taxonomies. Does not remove the term or
1985
- * taxonomy itself.
1986
- *
1987
- * @since 2.3.0
1988
- * @uses wp_remove_object_terms()
1989
- *
1990
- * @param int $object_id The term Object Id that refers to the term
1991
- * @param string|array $taxonomies List of Taxonomy Names or single Taxonomy name.
1992
- */
1993
- function wp_delete_object_term_relationships( $object_id, $taxonomies ) {
1994
- $object_id = (int) $object_id;
1995
-
1996
- if ( !is_array($taxonomies) )
1997
- $taxonomies = array($taxonomies);
1998
-
1999
- foreach ( (array) $taxonomies as $taxonomy ) {
2000
- $term_ids = wp_get_object_terms( $object_id, $taxonomy, array( 'fields' => 'ids' ) );
2001
- $term_ids = array_map( 'intval', $term_ids );
2002
- wp_remove_object_terms( $object_id, $term_ids, $taxonomy );
2003
- }
2004
- }
2005
-
2006
- /**
2007
- * Removes a term from the database.
2008
- *
2009
- * If the term is a parent of other terms, then the children will be updated to
2010
- * that term's parent.
2011
- *
2012
- * The $args 'default' will only override the terms found, if there is only one
2013
- * term found. Any other and the found terms are used.
2014
- *
2015
- * The $args 'force_default' will force the term supplied as default to be
2016
- * assigned even if the object was not going to be termless
2017
- *
2018
- * @since 2.3.0
2019
- *
2020
- * @uses $wpdb
2021
- *
2022
- * @param int $term Term ID
2023
- * @param string $taxonomy Taxonomy Name
2024
- * @param array|string $args Optional. Change 'default' term id and override found term ids.
2025
- * @return bool|WP_Error Returns false if not term; true if completes delete action.
2026
- */
2027
- function wp_delete_term( $term, $taxonomy, $args = array() ) {
2028
- global $wpdb;
2029
-
2030
- $term = (int) $term;
2031
-
2032
- if ( ! $ids = term_exists($term, $taxonomy) )
2033
- return false;
2034
- if ( is_wp_error( $ids ) )
2035
- return $ids;
2036
-
2037
- $tt_id = $ids['term_taxonomy_id'];
2038
-
2039
- $defaults = array();
2040
-
2041
- if ( 'category' == $taxonomy ) {
2042
- $defaults['default'] = get_option( 'default_category' );
2043
- if ( $defaults['default'] == $term )
2044
- return 0; // Don't delete the default category
2045
- }
2046
-
2047
- $args = wp_parse_args($args, $defaults);
2048
-
2049
- if ( isset( $args['default'] ) ) {
2050
- $default = (int) $args['default'];
2051
- if ( ! term_exists( $default, $taxonomy ) ) {
2052
- unset( $default );
2053
- }
2054
- }
2055
-
2056
- if ( isset( $args['force_default'] ) ) {
2057
- $force_default = $args['force_default'];
2058
- }
2059
-
2060
- // Update children to point to new parent
2061
- if ( is_taxonomy_hierarchical($taxonomy) ) {
2062
- $term_obj = get_term($term, $taxonomy);
2063
- if ( is_wp_error( $term_obj ) )
2064
- return $term_obj;
2065
- $parent = $term_obj->parent;
2066
-
2067
- $edit_tt_ids = $wpdb->get_col( "SELECT `term_taxonomy_id` FROM $wpdb->term_taxonomy WHERE `parent` = " . (int)$term_obj->term_id );
2068
-
2069
- /**
2070
- * Fires immediately before a term to delete's children are reassigned a parent.
2071
- *
2072
- * @since 2.9.0
2073
- *
2074
- * @param array $edit_tt_ids An array of term taxonomy IDs for the given term.
2075
- */
2076
- do_action( 'edit_term_taxonomies', $edit_tt_ids );
2077
- $wpdb->update( $wpdb->term_taxonomy, compact( 'parent' ), array( 'parent' => $term_obj->term_id) + compact( 'taxonomy' ) );
2078
-
2079
- /**
2080
- * Fires immediately after a term to delete's children are reassigned a parent.
2081
- *
2082
- * @since 2.9.0
2083
- *
2084
- * @param array $edit_tt_ids An array of term taxonomy IDs for the given term.
2085
- */
2086
- do_action( 'edited_term_taxonomies', $edit_tt_ids );
2087
- }
2088
-
2089
- $objects = $wpdb->get_col( $wpdb->prepare( "SELECT object_id FROM $wpdb->term_relationships WHERE term_taxonomy_id = %d", $tt_id ) );
2090
-
2091
- foreach ( (array) $objects as $object ) {
2092
- $terms = wp_get_object_terms($object, $taxonomy, array('fields' => 'ids', 'orderby' => 'none'));
2093
- if ( 1 == count($terms) && isset($default) ) {
2094
- $terms = array($default);
2095
- } else {
2096
- $terms = array_diff($terms, array($term));
2097
- if (isset($default) && isset($force_default) && $force_default)
2098
- $terms = array_merge($terms, array($default));
2099
- }
2100
- $terms = array_map('intval', $terms);
2101
- wp_set_object_terms($object, $terms, $taxonomy);
2102
- }
2103
-
2104
- // Clean the relationship caches for all object types using this term
2105
- $tax_object = get_taxonomy( $taxonomy );
2106
- foreach ( $tax_object->object_type as $object_type )
2107
- clean_object_term_cache( $objects, $object_type );
2108
-
2109
- // Get the object before deletion so we can pass to actions below
2110
- $deleted_term = get_term( $term, $taxonomy );
2111
-
2112
- /**
2113
- * Fires immediately before a term taxonomy ID is deleted.
2114
- *
2115
- * @since 2.9.0
2116
- *
2117
- * @param int $tt_id Term taxonomy ID.
2118
- */
2119
- do_action( 'delete_term_taxonomy', $tt_id );
2120
- $wpdb->delete( $wpdb->term_taxonomy, array( 'term_taxonomy_id' => $tt_id ) );
2121
-
2122
- /**
2123
- * Fires immediately after a term taxonomy ID is deleted.
2124
- *
2125
- * @since 2.9.0
2126
- *
2127
- * @param int $tt_id Term taxonomy ID.
2128
- */
2129
- do_action( 'deleted_term_taxonomy', $tt_id );
2130
-
2131
- // Delete the term if no taxonomies use it.
2132
- if ( !$wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->term_taxonomy WHERE term_id = %d", $term) ) )
2133
- $wpdb->delete( $wpdb->terms, array( 'term_id' => $term ) );
2134
-
2135
- clean_term_cache($term, $taxonomy);
2136
-
2137
- /**
2138
- * Fires after a term is deleted from the database and the cache is cleaned.
2139
- *
2140
- * @since 2.5.0
2141
- *
2142
- * @param int $term Term ID.
2143
- * @param int $tt_id Term taxonomy ID.
2144
- * @param string $taxonomy Taxonomy slug.
2145
- * @param mixed $deleted_term Copy of the already-deleted term, in the form specified
2146
- * by the parent function. WP_Error otherwise.
2147
- */
2148
- do_action( 'delete_term', $term, $tt_id, $taxonomy, $deleted_term );
2149
-
2150
- /**
2151
- * Fires after a term in a specific taxonomy is deleted.
2152
- *
2153
- * The dynamic portion of the hook name, $taxonomy, refers to the specific
2154
- * taxonomy the term belonged to.
2155
- *
2156
- * @since 2.3.0
2157
- *
2158
- * @param int $term Term ID.
2159
- * @param int $tt_id Term taxonomy ID.
2160
- * @param mixed $deleted_term Copy of the already-deleted term, in the form specified
2161
- * by the parent function. WP_Error otherwise.
2162
- */
2163
- do_action( "delete_$taxonomy", $term, $tt_id, $deleted_term );
2164
-
2165
- return true;
2166
- }
2167
-
2168
- /**
2169
- * Deletes one existing category.
2170
- *
2171
- * @since 2.0.0
2172
- * @uses wp_delete_term()
2173
- *
2174
- * @param int $cat_ID
2175
- * @return mixed Returns true if completes delete action; false if term doesn't exist;
2176
- * Zero on attempted deletion of default Category; WP_Error object is also a possibility.
2177
- */
2178
- function wp_delete_category( $cat_ID ) {
2179
- return wp_delete_term( $cat_ID, 'category' );
2180
- }
2181
-
2182
- /**
2183
- * Retrieves the terms associated with the given object(s), in the supplied taxonomies.
2184
- *
2185
- * The following information has to do the $args parameter and for what can be
2186
- * contained in the string or array of that parameter, if it exists.
2187
- *
2188
- * The first argument is called, 'orderby' and has the default value of 'name'.
2189
- * The other value that is supported is 'count'.
2190
- *
2191
- * The second argument is called, 'order' and has the default value of 'ASC'.
2192
- * The only other value that will be acceptable is 'DESC'.
2193
- *
2194
- * The final argument supported is called, 'fields' and has the default value of
2195
- * 'all'. There are multiple other options that can be used instead. Supported
2196
- * values are as follows: 'all', 'ids', 'names', and finally
2197
- * 'all_with_object_id'.
2198
- *
2199
- * The fields argument also decides what will be returned. If 'all' or
2200
- * 'all_with_object_id' is chosen or the default kept intact, then all matching
2201
- * terms objects will be returned. If either 'ids' or 'names' is used, then an
2202
- * array of all matching term ids or term names will be returned respectively.
2203
- *
2204
- * @since 2.3.0
2205
- * @uses $wpdb
2206
- *
2207
- * @param int|array $object_ids The ID(s) of the object(s) to retrieve.
2208
- * @param string|array $taxonomies The taxonomies to retrieve terms from.
2209
- * @param array|string $args Change what is returned
2210
- * @return array|WP_Error The requested term data or empty array if no terms found. WP_Error if any of the $taxonomies don't exist.
2211
- */
2212
- function wp_get_object_terms($object_ids, $taxonomies, $args = array()) {
2213
- global $wpdb;
2214
-
2215
- if ( empty( $object_ids ) || empty( $taxonomies ) )
2216
- return array();
2217
-
2218
- if ( !is_array($taxonomies) )
2219
- $taxonomies = array($taxonomies);
2220
-
2221
- foreach ( $taxonomies as $taxonomy ) {
2222
- if ( ! taxonomy_exists($taxonomy) )
2223
- return new WP_Error('invalid_taxonomy', __('Invalid taxonomy'));
2224
- }
2225
-
2226
- if ( !is_array($object_ids) )
2227
- $object_ids = array($object_ids);
2228
- $object_ids = array_map('intval', $object_ids);
2229
-
2230
- $defaults = array('orderby' => 'name', 'order' => 'ASC', 'fields' => 'all');
2231
- $args = wp_parse_args( $args, $defaults );
2232
-
2233
- $terms = array();
2234
- if ( count($taxonomies) > 1 ) {
2235
- foreach ( $taxonomies as $index => $taxonomy ) {
2236
- $t = get_taxonomy($taxonomy);
2237
- if ( isset($t->args) && is_array($t->args) && $args != array_merge($args, $t->args) ) {
2238
- unset($taxonomies[$index]);
2239
- $terms = array_merge($terms, wp_get_object_terms($object_ids, $taxonomy, array_merge($args, $t->args)));
2240
- }
2241
- }
2242
- } else {
2243
- $t = get_taxonomy($taxonomies[0]);
2244
- if ( isset($t->args) && is_array($t->args) )
2245
- $args = array_merge($args, $t->args);
2246
- }
2247
-
2248
- $orderby = $args['orderby'];
2249
- $order = $args['order'];
2250
- $fields = $args['fields'];
2251
-
2252
- if ( 'count' == $orderby )
2253
- $orderby = 'tt.count';
2254
- else if ( 'name' == $orderby )
2255
- $orderby = 't.name';
2256
- else if ( 'slug' == $orderby )
2257
- $orderby = 't.slug';
2258
- else if ( 'term_group' == $orderby )
2259
- $orderby = 't.term_group';
2260
- else if ( 'term_order' == $orderby )
2261
- $orderby = 'tr.term_order';
2262
- else if ( 'none' == $orderby ) {
2263
- $orderby = '';
2264
- $order = '';
2265
- } else {
2266
- $orderby = 't.term_id';
2267
- }
2268
-
2269
- // tt_ids queries can only be none or tr.term_taxonomy_id
2270
- if ( ('tt_ids' == $fields) && !empty($orderby) )
2271
- $orderby = 'tr.term_taxonomy_id';
2272
-
2273
- if ( !empty($orderby) )
2274
- $orderby = "ORDER BY $orderby";
2275
-
2276
- $order = strtoupper( $order );
2277
- if ( '' !== $order && ! in_array( $order, array( 'ASC', 'DESC' ) ) )
2278
- $order = 'ASC';
2279
-
2280
- $taxonomies = "'" . implode("', '", $taxonomies) . "'";
2281
- $object_ids = implode(', ', $object_ids);
2282
-
2283
- $select_this = '';
2284
- if ( 'all' == $fields )
2285
- $select_this = 't.*, tt.*';
2286
- else if ( 'ids' == $fields )
2287
- $select_this = 't.term_id';
2288
- else if ( 'names' == $fields )
2289
- $select_this = 't.name';
2290
- else if ( 'slugs' == $fields )
2291
- $select_this = 't.slug';
2292
- else if ( 'all_with_object_id' == $fields )
2293
- $select_this = 't.*, tt.*, tr.object_id';
2294
-
2295
- $query = "SELECT $select_this FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON tt.term_id = t.term_id INNER JOIN $wpdb->term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN ($taxonomies) AND tr.object_id IN ($object_ids) $orderby $order";
2296
-
2297
- $objects = false;
2298
- if ( 'all' == $fields || 'all_with_object_id' == $fields ) {
2299
- $_terms = $wpdb->get_results( $query );
2300
- foreach ( $_terms as $key => $term ) {
2301
- $_terms[$key] = sanitize_term( $term, $taxonomy, 'raw' );
2302
- }
2303
- $terms = array_merge( $terms, $_terms );
2304
- update_term_cache( $terms );
2305
- $objects = true;
2306
- } else if ( 'ids' == $fields || 'names' == $fields || 'slugs' == $fields ) {
2307
- $_terms = $wpdb->get_col( $query );
2308
- $_field = ( 'ids' == $fields ) ? 'term_id' : 'name';
2309
- foreach ( $_terms as $key => $term ) {
2310
- $_terms[$key] = sanitize_term_field( $_field, $term, $term, $taxonomy, 'raw' );
2311
- }
2312
- $terms = array_merge( $terms, $_terms );
2313
- } else if ( 'tt_ids' == $fields ) {
2314
- $terms = $wpdb->get_col("SELECT tr.term_taxonomy_id FROM $wpdb->term_relationships AS tr INNER JOIN $wpdb->term_taxonomy AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tr.object_id IN ($object_ids) AND tt.taxonomy IN ($taxonomies) $orderby $order");
2315
- foreach ( $terms as $key => $tt_id ) {
2316
- $terms[$key] = sanitize_term_field( 'term_taxonomy_id', $tt_id, 0, $taxonomy, 'raw' ); // 0 should be the term id, however is not needed when using raw context.
2317
- }
2318
- }
2319
-
2320
- if ( ! $terms ) {
2321
- $terms = array();
2322
- } elseif ( $objects && 'all_with_object_id' !== $fields ) {
2323
- $_tt_ids = array();
2324
- $_terms = array();
2325
- foreach ( $terms as $term ) {
2326
- if ( in_array( $term->term_taxonomy_id, $_tt_ids ) ) {
2327
- continue;
2328
- }
2329
-
2330
- $_tt_ids[] = $term->term_taxonomy_id;
2331
- $_terms[] = $term;
2332
- }
2333
- $terms = $_terms;
2334
- } elseif ( ! $objects ) {
2335
- $terms = array_values( array_unique( $terms ) );
2336
- }
2337
- /**
2338
- * Filter the terms for a given object or objects.
2339
- *
2340
- * @since 2.8.0
2341
- *
2342
- * @param array $terms An array of terms for the given object or objects.
2343
- * @param array|int $object_ids Object ID or array of IDs.
2344
- * @param array|string $taxonomies A taxonomy or array of taxonomies.
2345
- * @param array $args An array of arguments for retrieving terms for
2346
- * the given object(s).
2347
- */
2348
- return apply_filters( 'wp_get_object_terms', $terms, $object_ids, $taxonomies, $args );
2349
- }
2350
-
2351
- /**
2352
- * Add a new term to the database.
2353
- *
2354
- * A non-existent term is inserted in the following sequence:
2355
- * 1. The term is added to the term table, then related to the taxonomy.
2356
- * 2. If everything is correct, several actions are fired.
2357
- * 3. The 'term_id_filter' is evaluated.
2358
- * 4. The term cache is cleaned.
2359
- * 5. Several more actions are fired.
2360
- * 6. An array is returned containing the term_id and term_taxonomy_id.
2361
- *
2362
- * If the 'slug' argument is not empty, then it is checked to see if the term
2363
- * is invalid. If it is not a valid, existing term, it is added and the term_id
2364
- * is given.
2365
- *
2366
- * If the taxonomy is hierarchical, and the 'parent' argument is not empty,
2367
- * the term is inserted and the term_id will be given.
2368
-
2369
- * Error handling:
2370
- * If $taxonomy does not exist or $term is empty,
2371
- * a WP_Error object will be returned.
2372
- *
2373
- * If the term already exists on the same hierarchical level,
2374
- * or the term slug and name are not unique, a WP_Error object will be returned.
2375
- *
2376
- * @global wpdb $wpdb The WordPress database object.
2377
-
2378
- * @since 2.3.0
2379
- *
2380
- * @param string $term The term to add or update.
2381
- * @param string $taxonomy The taxonomy to which to add the term
2382
- * @param array|string $args {
2383
- * Arguments to change values of the inserted term.
2384
- *
2385
- * @type string 'alias_of' Slug of the term to make this term an alias of.
2386
- * Default empty string. Accepts a term slug.
2387
- * @type string 'description' The term description.
2388
- * Default empty string.
2389
- * @type int 'parent' The id of the parent term.
2390
- * Default 0.
2391
- * @type string 'slug' The term slug to use.
2392
- * Default empty string.
2393
- * }
2394
- * @return array|WP_Error An array containing the term_id and term_taxonomy_id, WP_Error otherwise.
2395
- */
2396
- function wp_insert_term( $term, $taxonomy, $args = array() ) {
2397
- global $wpdb;
2398
-
2399
- if ( ! taxonomy_exists($taxonomy) ) {
2400
- return new WP_Error('invalid_taxonomy', __('Invalid taxonomy'));
2401
- }
2402
- /**
2403
- * Filter a term before it is sanitized and inserted into the database.
2404
- *
2405
- * @since 3.0.0
2406
- *
2407
- * @param string $term The term to add or update.
2408
- * @param string $taxonomy Taxonomy slug.
2409
- */
2410
- $term = apply_filters( 'pre_insert_term', $term, $taxonomy );
2411
- if ( is_wp_error( $term ) ) {
2412
- return $term;
2413
- }
2414
- if ( is_int($term) && 0 == $term ) {
2415
- return new WP_Error('invalid_term_id', __('Invalid term ID'));
2416
- }
2417
- if ( '' == trim($term) ) {
2418
- return new WP_Error('empty_term_name', __('A name is required for this term'));
2419
- }
2420
- $defaults = array( 'alias_of' => '', 'description' => '', 'parent' => 0, 'slug' => '');
2421
- $args = wp_parse_args( $args, $defaults );
2422
-
2423
- if ( $args['parent'] > 0 && ! term_exists( (int) $args['parent'] ) ) {
2424
- return new WP_Error( 'missing_parent', __( 'Parent term does not exist.' ) );
2425
- }
2426
- $args['name'] = $term;
2427
- $args['taxonomy'] = $taxonomy;
2428
- $args = sanitize_term($args, $taxonomy, 'db');
2429
-
2430
- // expected_slashed ($name)
2431
- $name = wp_unslash( $args['name'] );
2432
- $description = wp_unslash( $args['description'] );
2433
- $parent = (int) $args['parent'];
2434
-
2435
- $slug_provided = ! empty( $args['slug'] );
2436
- if ( ! $slug_provided ) {
2437
- $_name = trim( $name );
2438
- $existing_term = get_term_by( 'name', $_name, $taxonomy );
2439
- if ( $existing_term ) {
2440
- $slug = $existing_term->slug;
2441
- } else {
2442
- $slug = sanitize_title( $name );
2443
- }
2444
- } else {
2445
- $slug = $args['slug'];
2446
- }
2447
-
2448
- $term_group = 0;
2449
- if ( $args['alias_of'] ) {
2450
- $alias = get_term_by( 'slug', $args['alias_of'], $taxonomy );
2451
- if ( ! empty( $alias->term_group ) ) {
2452
- // The alias we want is already in a group, so let's use that one.
2453
- $term_group = $alias->term_group;
2454
- } else if ( ! empty( $alias->term_id ) ) {
2455
- /*
2456
- * The alias is not in a group, so we create a new one
2457
- * and add the alias to it.
2458
- */
2459
- $term_group = $wpdb->get_var("SELECT MAX(term_group) FROM $wpdb->terms") + 1;
2460
-
2461
- wp_update_term( $alias->term_id, $taxonomy, array(
2462
- 'term_group' => $term_group,
2463
- ) );
2464
- }
2465
- }
2466
-
2467
- if ( $term_id = term_exists($slug) ) {
2468
- $existing_term = $wpdb->get_row( $wpdb->prepare( "SELECT name FROM $wpdb->terms WHERE term_id = %d", $term_id), ARRAY_A );
2469
- // We've got an existing term in the same taxonomy, which matches the name of the new term:
2470
- if ( is_taxonomy_hierarchical($taxonomy) && $existing_term['name'] == $name && $exists = term_exists( (int) $term_id, $taxonomy ) ) {
2471
- // Hierarchical, and it matches an existing term, Do not allow same "name" in the same level.
2472
- $siblings = get_terms($taxonomy, array('fields' => 'names', 'get' => 'all', 'parent' => $parent ) );
2473
- if ( in_array($name, $siblings) ) {
2474
- if ( $slug_provided ) {
2475
- return new WP_Error( 'term_exists', __( 'A term with the name and slug provided already exists with this parent.' ), $exists['term_id'] );
2476
- } else {
2477
- return new WP_Error( 'term_exists', __( 'A term with the name provided already exists with this parent.' ), $exists['term_id'] );
2478
- }
2479
- } else {
2480
- $slug = wp_unique_term_slug($slug, (object) $args);
2481
- if ( false === $wpdb->insert( $wpdb->terms, compact( 'name', 'slug', 'term_group' ) ) ) {
2482
- return new WP_Error('db_insert_error', __('Could not insert term into the database'), $wpdb->last_error);
2483
- }
2484
- $term_id = (int) $wpdb->insert_id;
2485
- }
2486
- } elseif ( $existing_term['name'] != $name ) {
2487
- // We've got an existing term, with a different name, Create the new term.
2488
- $slug = wp_unique_term_slug($slug, (object) $args);
2489
- if ( false === $wpdb->insert( $wpdb->terms, compact( 'name', 'slug', 'term_group' ) ) ) {
2490
- return new WP_Error('db_insert_error', __('Could not insert term into the database'), $wpdb->last_error);
2491
- }
2492
- $term_id = (int) $wpdb->insert_id;
2493
- } elseif ( $exists = term_exists( (int) $term_id, $taxonomy ) ) {
2494
- // Same name, same slug.
2495
- return new WP_Error( 'term_exists', __( 'A term with the name and slug provided already exists.' ), $exists['term_id'] );
2496
- }
2497
- } else {
2498
- // This term does not exist at all in the database, Create it.
2499
- $slug = wp_unique_term_slug($slug, (object) $args);
2500
- if ( false === $wpdb->insert( $wpdb->terms, compact( 'name', 'slug', 'term_group' ) ) ) {
2501
- return new WP_Error('db_insert_error', __('Could not insert term into the database'), $wpdb->last_error);
2502
- }
2503
- $term_id = (int) $wpdb->insert_id;
2504
- }
2505
-
2506
- // Seems unreachable, However, Is used in the case that a term name is provided, which sanitizes to an empty string.
2507
- if ( empty($slug) ) {
2508
- $slug = sanitize_title($slug, $term_id);
2509
-
2510
- /** This action is documented in wp-includes/taxonomy.php */
2511
- do_action( 'edit_terms', $term_id, $taxonomy );
2512
- $wpdb->update( $wpdb->terms, compact( 'slug' ), compact( 'term_id' ) );
2513
-
2514
- /** This action is documented in wp-includes/taxonomy.php */
2515
- do_action( 'edited_terms', $term_id, $taxonomy );
2516
- }
2517
-
2518
- $tt_id = $wpdb->get_var( $wpdb->prepare( "SELECT tt.term_taxonomy_id FROM $wpdb->term_taxonomy AS tt INNER JOIN $wpdb->terms AS t ON tt.term_id = t.term_id WHERE tt.taxonomy = %s AND t.term_id = %d", $taxonomy, $term_id ) );
2519
-
2520
- if ( !empty($tt_id) ) {
2521
- return array('term_id' => $term_id, 'term_taxonomy_id' => $tt_id);
2522
- }
2523
- $wpdb->insert( $wpdb->term_taxonomy, compact( 'term_id', 'taxonomy', 'description', 'parent') + array( 'count' => 0 ) );
2524
- $tt_id = (int) $wpdb->insert_id;
2525
-
2526
- /**
2527
- * Fires immediately after a new term is created, before the term cache is cleaned.
2528
- *
2529
- * @since 2.3.0
2530
- *
2531
- * @param int $term_id Term ID.
2532
- * @param int $tt_id Term taxonomy ID.
2533
- * @param string $taxonomy Taxonomy slug.
2534
- */
2535
- do_action( "create_term", $term_id, $tt_id, $taxonomy );
2536
-
2537
- /**
2538
- * Fires after a new term is created for a specific taxonomy.
2539
- *
2540
- * The dynamic portion of the hook name, $taxonomy, refers
2541
- * to the slug of the taxonomy the term was created for.
2542
- *
2543
- * @since 2.3.0
2544
- *
2545
- * @param int $term_id Term ID.
2546
- * @param int $tt_id Term taxonomy ID.
2547
- */
2548
- do_action( "create_$taxonomy", $term_id, $tt_id );
2549
-
2550
- /**
2551
- * Filter the term ID after a new term is created.
2552
- *
2553
- * @since 2.3.0
2554
- *
2555
- * @param int $term_id Term ID.
2556
- * @param int $tt_id Taxonomy term ID.
2557
- */
2558
- $term_id = apply_filters( 'term_id_filter', $term_id, $tt_id );
2559
-
2560
- clean_term_cache($term_id, $taxonomy);
2561
-
2562
- /**
2563
- * Fires after a new term is created, and after the term cache has been cleaned.
2564
- *
2565
- * @since 2.3.0
2566
- */
2567
- do_action( "created_term", $term_id, $tt_id, $taxonomy );
2568
-
2569
- /**
2570
- * Fires after a new term in a specific taxonomy is created, and after the term
2571
- * cache has been cleaned.
2572
- *
2573
- * @since 2.3.0
2574
- *
2575
- * @param int $term_id Term ID.
2576
- * @param int $tt_id Term taxonomy ID.
2577
- */
2578
- do_action( "created_$taxonomy", $term_id, $tt_id );
2579
-
2580
- return array('term_id' => $term_id, 'term_taxonomy_id' => $tt_id);
2581
- }
2582
-
2583
- /**
2584
- * Create Term and Taxonomy Relationships.
2585
- *
2586
- * Relates an object (post, link etc) to a term and taxonomy type. Creates the
2587
- * term and taxonomy relationship if it doesn't already exist. Creates a term if
2588
- * it doesn't exist (using the slug).
2589
- *
2590
- * A relationship means that the term is grouped in or belongs to the taxonomy.
2591
- * A term has no meaning until it is given context by defining which taxonomy it
2592
- * exists under.
2593
- *
2594
- * @since 2.3.0
2595
- * @uses wp_remove_object_terms()
2596
- *
2597
- * @param int $object_id The object to relate to.
2598
- * @param array|int|string $terms A single term slug, single term id, or array of either term slugs or ids.
2599
- * Will replace all existing related terms in this taxonomy.
2600
- * @param array|string $taxonomy The context in which to relate the term to the object.
2601
- * @param bool $append Optional. If false will delete difference of terms. Default false.
2602
- * @return array|WP_Error Affected Term IDs.
2603
- */
2604
- function wp_set_object_terms( $object_id, $terms, $taxonomy, $append = false ) {
2605
- global $wpdb;
2606
-
2607
- $object_id = (int) $object_id;
2608
-
2609
- if ( ! taxonomy_exists($taxonomy) )
2610
- return new WP_Error('invalid_taxonomy', __('Invalid taxonomy'));
2611
-
2612
- if ( !is_array($terms) )
2613
- $terms = array($terms);
2614
-
2615
- if ( ! $append )
2616
- $old_tt_ids = wp_get_object_terms($object_id, $taxonomy, array('fields' => 'tt_ids', 'orderby' => 'none'));
2617
- else
2618
- $old_tt_ids = array();
2619
-
2620
- $tt_ids = array();
2621
- $term_ids = array();
2622
- $new_tt_ids = array();
2623
-
2624
- foreach ( (array) $terms as $term) {
2625
- if ( !strlen(trim($term)) )
2626
- continue;
2627
-
2628
- if ( !$term_info = term_exists($term, $taxonomy) ) {
2629
- // Skip if a non-existent term ID is passed.
2630
- if ( is_int($term) )
2631
- continue;
2632
- $term_info = wp_insert_term($term, $taxonomy);
2633
- }
2634
- if ( is_wp_error($term_info) )
2635
- return $term_info;
2636
- $term_ids[] = $term_info['term_id'];
2637
- $tt_id = $term_info['term_taxonomy_id'];
2638
- $tt_ids[] = $tt_id;
2639
-
2640
- if ( $wpdb->get_var( $wpdb->prepare( "SELECT term_taxonomy_id FROM $wpdb->term_relationships WHERE object_id = %d AND term_taxonomy_id = %d", $object_id, $tt_id ) ) )
2641
- continue;
2642
-
2643
- /**
2644
- * Fires immediately before an object-term relationship is added.
2645
- *
2646
- * @since 2.9.0
2647
- *
2648
- * @param int $object_id Object ID.
2649
- * @param int $tt_id Term taxonomy ID.
2650
- */
2651
- do_action( 'add_term_relationship', $object_id, $tt_id );
2652
- $wpdb->insert( $wpdb->term_relationships, array( 'object_id' => $object_id, 'term_taxonomy_id' => $tt_id ) );
2653
-
2654
- /**
2655
- * Fires immediately after an object-term relationship is added.
2656
- *
2657
- * @since 2.9.0
2658
- *
2659
- * @param int $object_id Object ID.
2660
- * @param int $tt_id Term taxonomy ID.
2661
- */
2662
- do_action( 'added_term_relationship', $object_id, $tt_id );
2663
- $new_tt_ids[] = $tt_id;
2664
- }
2665
-
2666
- if ( $new_tt_ids )
2667
- wp_update_term_count( $new_tt_ids, $taxonomy );
2668
-
2669
- if ( ! $append ) {
2670
- $delete_tt_ids = array_diff( $old_tt_ids, $tt_ids );
2671
-
2672
- if ( $delete_tt_ids ) {
2673
- $in_delete_tt_ids = "'" . implode( "', '", $delete_tt_ids ) . "'";
2674
- $delete_term_ids = $wpdb->get_col( $wpdb->prepare( "SELECT tt.term_id FROM $wpdb->term_taxonomy AS tt WHERE tt.taxonomy = %s AND tt.term_taxonomy_id IN ($in_delete_tt_ids)", $taxonomy ) );
2675
- $delete_term_ids = array_map( 'intval', $delete_term_ids );
2676
-
2677
- $remove = wp_remove_object_terms( $object_id, $delete_term_ids, $taxonomy );
2678
- if ( is_wp_error( $remove ) ) {
2679
- return $remove;
2680
- }
2681
- }
2682
- }
2683
-
2684
- $t = get_taxonomy($taxonomy);
2685
- if ( ! $append && isset($t->sort) && $t->sort ) {
2686
- $values = array();
2687
- $term_order = 0;
2688
- $final_tt_ids = wp_get_object_terms($object_id, $taxonomy, array('fields' => 'tt_ids'));
2689
- foreach ( $tt_ids as $tt_id )
2690
- if ( in_array($tt_id, $final_tt_ids) )
2691
- $values[] = $wpdb->prepare( "(%d, %d, %d)", $object_id, $tt_id, ++$term_order);
2692
- if ( $values )
2693
- if ( false === $wpdb->query( "INSERT INTO $wpdb->term_relationships (object_id, term_taxonomy_id, term_order) VALUES " . join( ',', $values ) . " ON DUPLICATE KEY UPDATE term_order = VALUES(term_order)" ) )
2694
- return new WP_Error( 'db_insert_error', __( 'Could not insert term relationship into the database' ), $wpdb->last_error );
2695
- }
2696
-
2697
- wp_cache_delete( $object_id, $taxonomy . '_relationships' );
2698
-
2699
- /**
2700
- * Fires after an object's terms have been set.
2701
- *
2702
- * @since 2.8.0
2703
- *
2704
- * @param int $object_id Object ID.
2705
- * @param array $terms An array of object terms.
2706
- * @param array $tt_ids An array of term taxonomy IDs.
2707
- * @param string $taxonomy Taxonomy slug.
2708
- * @param bool $append Whether to append new terms to the old terms.
2709
- * @param array $old_tt_ids Old array of term taxonomy IDs.
2710
- */
2711
- do_action( 'set_object_terms', $object_id, $terms, $tt_ids, $taxonomy, $append, $old_tt_ids );
2712
- return $tt_ids;
2713
- }
2714
-
2715
- /**
2716
- * Add term(s) associated with a given object.
2717
- *
2718
- * @since 3.6.0
2719
- * @uses wp_set_object_terms()
2720
- *
2721
- * @param int $object_id The ID of the object to which the terms will be added.
2722
- * @param array|int|string $terms The slug(s) or ID(s) of the term(s) to add.
2723
- * @param array|string $taxonomy Taxonomy name.
2724
- * @return array|WP_Error Affected Term IDs
2725
- */
2726
- function wp_add_object_terms( $object_id, $terms, $taxonomy ) {
2727
- return wp_set_object_terms( $object_id, $terms, $taxonomy, true );
2728
- }
2729
-
2730
- /**
2731
- * Remove term(s) associated with a given object.
2732
- *
2733
- * @since 3.6.0
2734
- * @uses $wpdb
2735
- *
2736
- * @param int $object_id The ID of the object from which the terms will be removed.
2737
- * @param array|int|string $terms The slug(s) or ID(s) of the term(s) to remove.
2738
- * @param array|string $taxonomy Taxonomy name.
2739
- * @return bool|WP_Error True on success, false or WP_Error on failure.
2740
- */
2741
- function wp_remove_object_terms( $object_id, $terms, $taxonomy ) {
2742
- global $wpdb;
2743
-
2744
- $object_id = (int) $object_id;
2745
-
2746
- if ( ! taxonomy_exists( $taxonomy ) ) {
2747
- return new WP_Error( 'invalid_taxonomy', __( 'Invalid Taxonomy' ) );
2748
- }
2749
-
2750
- if ( ! is_array( $terms ) ) {
2751
- $terms = array( $terms );
2752
- }
2753
-
2754
- $tt_ids = array();
2755
-
2756
- foreach ( (array) $terms as $term ) {
2757
- if ( ! strlen( trim( $term ) ) ) {
2758
- continue;
2759
- }
2760
-
2761
- if ( ! $term_info = term_exists( $term, $taxonomy ) ) {
2762
- // Skip if a non-existent term ID is passed.
2763
- if ( is_int( $term ) ) {
2764
- continue;
2765
- }
2766
- }
2767
-
2768
- if ( is_wp_error( $term_info ) ) {
2769
- return $term_info;
2770
- }
2771
-
2772
- $tt_ids[] = $term_info['term_taxonomy_id'];
2773
- }
2774
-
2775
- if ( $tt_ids ) {
2776
- $in_tt_ids = "'" . implode( "', '", $tt_ids ) . "'";
2777
-
2778
- /**
2779
- * Fires immediately before an object-term relationship is deleted.
2780
- *
2781
- * @since 2.9.0
2782
- *
2783
- * @param int $object_id Object ID.
2784
- * @param array $tt_ids An array of term taxonomy IDs.
2785
- */
2786
- do_action( 'delete_term_relationships', $object_id, $tt_ids );
2787
- $deleted = $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->term_relationships WHERE object_id = %d AND term_taxonomy_id IN ($in_tt_ids)", $object_id ) );
2788
-
2789
- /**
2790
- * Fires immediately after an object-term relationship is deleted.
2791
- *
2792
- * @since 2.9.0
2793
- *
2794
- * @param int $object_id Object ID.
2795
- * @param array $tt_ids An array of term taxonomy IDs.
2796
- */
2797
- do_action( 'deleted_term_relationships', $object_id, $tt_ids );
2798
- wp_update_term_count( $tt_ids, $taxonomy );
2799
-
2800
- return (bool) $deleted;
2801
- }
2802
-
2803
- return false;
2804
- }
2805
-
2806
- /**
2807
- * Will make slug unique, if it isn't already.
2808
- *
2809
- * The $slug has to be unique global to every taxonomy, meaning that one
2810
- * taxonomy term can't have a matching slug with another taxonomy term. Each
2811
- * slug has to be globally unique for every taxonomy.
2812
- *
2813
- * The way this works is that if the taxonomy that the term belongs to is
2814
- * hierarchical and has a parent, it will append that parent to the $slug.
2815
- *
2816
- * If that still doesn't return an unique slug, then it try to append a number
2817
- * until it finds a number that is truly unique.
2818
- *
2819
- * The only purpose for $term is for appending a parent, if one exists.
2820
- *
2821
- * @since 2.3.0
2822
- * @uses $wpdb
2823
- *
2824
- * @param string $slug The string that will be tried for a unique slug
2825
- * @param object $term The term object that the $slug will belong too
2826
- * @return string Will return a true unique slug.
2827
- */
2828
- function wp_unique_term_slug($slug, $term) {
2829
- global $wpdb;
2830
-
2831
- if ( ! term_exists( $slug ) )
2832
- return $slug;
2833
-
2834
- // If the taxonomy supports hierarchy and the term has a parent, make the slug unique
2835
- // by incorporating parent slugs.
2836
- if ( is_taxonomy_hierarchical($term->taxonomy) && !empty($term->parent) ) {
2837
- $the_parent = $term->parent;
2838
- while ( ! empty($the_parent) ) {
2839
- $parent_term = get_term($the_parent, $term->taxonomy);
2840
- if ( is_wp_error($parent_term) || empty($parent_term) )
2841
- break;
2842
- $slug .= '-' . $parent_term->slug;
2843
- if ( ! term_exists( $slug ) )
2844
- return $slug;
2845
-
2846
- if ( empty($parent_term->parent) )
2847
- break;
2848
- $the_parent = $parent_term->parent;
2849
- }
2850
- }
2851
-
2852
- // If we didn't get a unique slug, try appending a number to make it unique.
2853
- if ( ! empty( $term->term_id ) )
2854
- $query = $wpdb->prepare( "SELECT slug FROM $wpdb->terms WHERE slug = %s AND term_id != %d", $slug, $term->term_id );
2855
- else
2856
- $query = $wpdb->prepare( "SELECT slug FROM $wpdb->terms WHERE slug = %s", $slug );
2857
-
2858
- if ( $wpdb->get_var( $query ) ) {
2859
- $num = 2;
2860
- do {
2861
- $alt_slug = $slug . "-$num";
2862
- $num++;
2863
- $slug_check = $wpdb->get_var( $wpdb->prepare( "SELECT slug FROM $wpdb->terms WHERE slug = %s", $alt_slug ) );
2864
- } while ( $slug_check );
2865
- $slug = $alt_slug;
2866
- }
2867
-
2868
- return $slug;
2869
- }
2870
-
2871
- /**
2872
- * Update term based on arguments provided.
2873
- *
2874
- * The $args will indiscriminately override all values with the same field name.
2875
- * Care must be taken to not override important information need to update or
2876
- * update will fail (or perhaps create a new term, neither would be acceptable).
2877
- *
2878
- * Defaults will set 'alias_of', 'description', 'parent', and 'slug' if not
2879
- * defined in $args already.
2880
- *
2881
- * 'alias_of' will create a term group, if it doesn't already exist, and update
2882
- * it for the $term.
2883
- *
2884
- * If the 'slug' argument in $args is missing, then the 'name' in $args will be
2885
- * used. It should also be noted that if you set 'slug' and it isn't unique then
2886
- * a WP_Error will be passed back. If you don't pass any slug, then a unique one
2887
- * will be created for you.
2888
- *
2889
- * For what can be overrode in $args, check the term scheme can contain and stay
2890
- * away from the term keys.
2891
- *
2892
- * @since 2.3.0
2893
- *
2894
- * @uses $wpdb
2895
- *
2896
- * @param int $term_id The ID of the term
2897
- * @param string $taxonomy The context in which to relate the term to the object.
2898
- * @param array|string $args Overwrite term field values
2899
- * @return array|WP_Error Returns Term ID and Taxonomy Term ID
2900
- */
2901
- function wp_update_term( $term_id, $taxonomy, $args = array() ) {
2902
- global $wpdb;
2903
-
2904
- if ( ! taxonomy_exists($taxonomy) )
2905
- return new WP_Error('invalid_taxonomy', __('Invalid taxonomy'));
2906
-
2907
- $term_id = (int) $term_id;
2908
-
2909
- // First, get all of the original args
2910
- $term = get_term ($term_id, $taxonomy, ARRAY_A);
2911
-
2912
- if ( is_wp_error( $term ) )
2913
- return $term;
2914
-
2915
- // Escape data pulled from DB.
2916
- $term = wp_slash($term);
2917
-
2918
- // Merge old and new args with new args overwriting old ones.
2919
- $args = array_merge($term, $args);
2920
-
2921
- $defaults = array( 'alias_of' => '', 'description' => '', 'parent' => 0, 'slug' => '');
2922
- $args = wp_parse_args($args, $defaults);
2923
- $args = sanitize_term($args, $taxonomy, 'db');
2924
- $parsed_args = $args;
2925
-
2926
- // expected_slashed ($name)
2927
- $name = wp_unslash( $args['name'] );
2928
- $description = wp_unslash( $args['description'] );
2929
-
2930
- $parsed_args['name'] = $name;
2931
- $parsed_args['description'] = $description;
2932
-
2933
- if ( '' == trim($name) )
2934
- return new WP_Error('empty_term_name', __('A name is required for this term'));
2935
-
2936
- if ( $parsed_args['parent'] > 0 && ! term_exists( (int) $parsed_args['parent'] ) ) {
2937
- return new WP_Error( 'missing_parent', __( 'Parent term does not exist.' ) );
2938
- }
2939
-
2940
- $empty_slug = false;
2941
- if ( empty( $args['slug'] ) ) {
2942
- $empty_slug = true;
2943
- $slug = sanitize_title($name);
2944
- } else {
2945
- $slug = $args['slug'];
2946
- }
2947
-
2948
- $parsed_args['slug'] = $slug;
2949
-
2950
- $term_group = isset( $parsed_args['term_group'] ) ? $parsed_args['term_group'] : 0;
2951
- if ( $args['alias_of'] ) {
2952
- $alias = get_term_by( 'slug', $args['alias_of'], $taxonomy );
2953
- if ( ! empty( $alias->term_group ) ) {
2954
- // The alias we want is already in a group, so let's use that one.
2955
- $term_group = $alias->term_group;
2956
- } else if ( ! empty( $alias->term_id ) ) {
2957
- /*
2958
- * The alias is not in a group, so we create a new one
2959
- * and add the alias to it.
2960
- */
2961
- $term_group = $wpdb->get_var("SELECT MAX(term_group) FROM $wpdb->terms") + 1;
2962
-
2963
- wp_update_term( $alias->term_id, $taxonomy, array(
2964
- 'term_group' => $term_group,
2965
- ) );
2966
- }
2967
-
2968
- $parsed_args['term_group'] = $term_group;
2969
- }
2970
-
2971
- /**
2972
- * Filter the term parent.
2973
- *
2974
- * Hook to this filter to see if it will cause a hierarchy loop.
2975
- *
2976
- * @since 3.1.0
2977
- *
2978
- * @param int $parent ID of the parent term.
2979
- * @param int $term_id Term ID.
2980
- * @param string $taxonomy Taxonomy slug.
2981
- * @param array $parsed_args An array of potentially altered update arguments for the given term.
2982
- * @param array $args An array of update arguments for the given term.
2983
- */
2984
- $parent = apply_filters( 'wp_update_term_parent', $args['parent'], $term_id, $taxonomy, $parsed_args, $args );
2985
-
2986
- // Check for duplicate slug
2987
- $id = $wpdb->get_var( $wpdb->prepare( "SELECT term_id FROM $wpdb->terms WHERE slug = %s", $slug ) );
2988
- if ( $id && ($id != $term_id) ) {
2989
- // If an empty slug was passed or the parent changed, reset the slug to something unique.
2990
- // Otherwise, bail.
2991
- if ( $empty_slug || ( $parent != $term['parent']) )
2992
- $slug = wp_unique_term_slug($slug, (object) $args);
2993
- else
2994
- return new WP_Error('duplicate_term_slug', sprintf(__('The slug &#8220;%s&#8221; is already in use by another term'), $slug));
2995
- }
2996
-
2997
- /**
2998
- * Fires immediately before the given terms are edited.
2999
- *
3000
- * @since 2.9.0
3001
- *
3002
- * @param int $term_id Term ID.
3003
- * @param string $taxonomy Taxonomy slug.
3004
- */
3005
- do_action( 'edit_terms', $term_id, $taxonomy );
3006
- $wpdb->update($wpdb->terms, compact( 'name', 'slug', 'term_group' ), compact( 'term_id' ) );
3007
- if ( empty($slug) ) {
3008
- $slug = sanitize_title($name, $term_id);
3009
- $wpdb->update( $wpdb->terms, compact( 'slug' ), compact( 'term_id' ) );
3010
- }
3011
-
3012
- /**
3013
- * Fires immediately after the given terms are edited.
3014
- *
3015
- * @since 2.9.0
3016
- *
3017
- * @param int $term_id Term ID
3018
- * @param string $taxonomy Taxonomy slug.
3019
- */
3020
- do_action( 'edited_terms', $term_id, $taxonomy );
3021
-
3022
- $tt_id = $wpdb->get_var( $wpdb->prepare( "SELECT tt.term_taxonomy_id FROM $wpdb->term_taxonomy AS tt INNER JOIN $wpdb->terms AS t ON tt.term_id = t.term_id WHERE tt.taxonomy = %s AND t.term_id = %d", $taxonomy, $term_id) );
3023
-
3024
- /**
3025
- * Fires immediate before a term-taxonomy relationship is updated.
3026
- *
3027
- * @since 2.9.0
3028
- *
3029
- * @param int $tt_id Term taxonomy ID.
3030
- * @param string $taxonomy Taxonomy slug.
3031
- */
3032
- do_action( 'edit_term_taxonomy', $tt_id, $taxonomy );
3033
- $wpdb->update( $wpdb->term_taxonomy, compact( 'term_id', 'taxonomy', 'description', 'parent' ), array( 'term_taxonomy_id' => $tt_id ) );
3034
-
3035
- /**
3036
- * Fires immediately after a term-taxonomy relationship is updated.
3037
- *
3038
- * @since 2.9.0
3039
- *
3040
- * @param int $tt_id Term taxonomy ID.
3041
- * @param string $taxonomy Taxonomy slug.
3042
- */
3043
- do_action( 'edited_term_taxonomy', $tt_id, $taxonomy );
3044
-
3045
- // Clean the relationship caches for all object types using this term
3046
- $objects = $wpdb->get_col( $wpdb->prepare( "SELECT object_id FROM $wpdb->term_relationships WHERE term_taxonomy_id = %d", $tt_id ) );
3047
- $tax_object = get_taxonomy( $taxonomy );
3048
- foreach ( $tax_object->object_type as $object_type ) {
3049
- clean_object_term_cache( $objects, $object_type );
3050
- }
3051
-
3052
- /**
3053
- * Fires after a term has been updated, but before the term cache has been cleaned.
3054
- *
3055
- * @since 2.3.0
3056
- *
3057
- * @param int $term_id Term ID.
3058
- * @param int $tt_id Term taxonomy ID.
3059
- * @param string $taxonomy Taxonomy slug.
3060
- */
3061
- do_action( "edit_term", $term_id, $tt_id, $taxonomy );
3062
-
3063
- /**
3064
- * Fires after a term in a specific taxonomy has been updated, but before the term
3065
- * cache has been cleaned.
3066
- *
3067
- * The dynamic portion of the hook name, $taxonomy, refers to the taxonomy slug.
3068
- *
3069
- * @since 2.3.0
3070
- *
3071
- * @param int $term_id Term ID.
3072
- * @param int $tt_id Term taxonomy ID.
3073
- */
3074
- do_action( "edit_$taxonomy", $term_id, $tt_id );
3075
-
3076
- /** This filter is documented in wp-includes/taxonomy.php */
3077
- $term_id = apply_filters( 'term_id_filter', $term_id, $tt_id );
3078
-
3079
- clean_term_cache($term_id, $taxonomy);
3080
-
3081
- /**
3082
- * Fires after a term has been updated, and the term cache has been cleaned.
3083
- *
3084
- * @since 2.3.0
3085
- *
3086
- * @param int $term_id Term ID.
3087
- * @param int $tt_id Term taxonomy ID.
3088
- * @param string $taxonomy Taxonomy slug.
3089
- */
3090
- do_action( "edited_term", $term_id, $tt_id, $taxonomy );
3091
-
3092
- /**
3093
- * Fires after a term for a specific taxonomy has been updated, and the term
3094
- * cache has been cleaned.
3095
- *
3096
- * The dynamic portion of the hook name, $taxonomy, refers to the taxonomy slug.
3097
- *
3098
- * @since 2.3.0
3099
- *
3100
- * @param int $term_id Term ID.
3101
- * @param int $tt_id Term taxonomy ID.
3102
- */
3103
- do_action( "edited_$taxonomy", $term_id, $tt_id );
3104
-
3105
- return array('term_id' => $term_id, 'term_taxonomy_id' => $tt_id);
3106
- }
3107
-
3108
- /**
3109
- * Enable or disable term counting.
3110
- *
3111
- * @since 2.5.0
3112
- *
3113
- * @param bool $defer Optional. Enable if true, disable if false.
3114
- * @return bool Whether term counting is enabled or disabled.
3115
- */
3116
- function wp_defer_term_counting($defer=null) {
3117
- static $_defer = false;
3118
-
3119
- if ( is_bool($defer) ) {
3120
- $_defer = $defer;
3121
- // flush any deferred counts
3122
- if ( !$defer )
3123
- wp_update_term_count( null, null, true );
3124
- }
3125
-
3126
- return $_defer;
3127
- }
3128
-
3129
- /**
3130
- * Updates the amount of terms in taxonomy.
3131
- *
3132
- * If there is a taxonomy callback applied, then it will be called for updating
3133
- * the count.
3134
- *
3135
- * The default action is to count what the amount of terms have the relationship
3136
- * of term ID. Once that is done, then update the database.
3137
- *
3138
- * @since 2.3.0
3139
- * @uses $wpdb
3140
- *
3141
- * @param int|array $terms The term_taxonomy_id of the terms
3142
- * @param string $taxonomy The context of the term.
3143
- * @return bool If no terms will return false, and if successful will return true.
3144
- */
3145
- function wp_update_term_count( $terms, $taxonomy, $do_deferred=false ) {
3146
- static $_deferred = array();
3147
-
3148
- if ( $do_deferred ) {
3149
- foreach ( (array) array_keys($_deferred) as $tax ) {
3150
- wp_update_term_count_now( $_deferred[$tax], $tax );
3151
- unset( $_deferred[$tax] );
3152
- }
3153
- }
3154
-
3155
- if ( empty($terms) )
3156
- return false;
3157
-
3158
- if ( !is_array($terms) )
3159
- $terms = array($terms);
3160
-
3161
- if ( wp_defer_term_counting() ) {
3162
- if ( !isset($_deferred[$taxonomy]) )
3163
- $_deferred[$taxonomy] = array();
3164
- $_deferred[$taxonomy] = array_unique( array_merge($_deferred[$taxonomy], $terms) );
3165
- return true;
3166
- }
3167
-
3168
- return wp_update_term_count_now( $terms, $taxonomy );
3169
- }
3170
-
3171
- /**
3172
- * Perform term count update immediately.
3173
- *
3174
- * @since 2.5.0
3175
- *
3176
- * @param array $terms The term_taxonomy_id of terms to update.
3177
- * @param string $taxonomy The context of the term.
3178
- * @return bool Always true when complete.
3179
- */
3180
- function wp_update_term_count_now( $terms, $taxonomy ) {
3181
- $terms = array_map('intval', $terms);
3182
-
3183
- $taxonomy = get_taxonomy($taxonomy);
3184
- if ( !empty($taxonomy->update_count_callback) ) {
3185
- call_user_func($taxonomy->update_count_callback, $terms, $taxonomy);
3186
- } else {
3187
- $object_types = (array) $taxonomy->object_type;
3188
- foreach ( $object_types as &$object_type ) {
3189
- if ( 0 === strpos( $object_type, 'attachment:' ) )
3190
- list( $object_type ) = explode( ':', $object_type );
3191
- }
3192
-
3193
- if ( $object_types == array_filter( $object_types, 'post_type_exists' ) ) {
3194
- // Only post types are attached to this taxonomy
3195
- _update_post_term_count( $terms, $taxonomy );
3196
- } else {
3197
- // Default count updater
3198
- _update_generic_term_count( $terms, $taxonomy );
3199
- }
3200
- }
3201
-
3202
- clean_term_cache($terms, '', false);
3203
-
3204
- return true;
3205
- }
3206
-
3207
- //
3208
- // Cache
3209
- //
3210
-
3211
- /**
3212
- * Removes the taxonomy relationship to terms from the cache.
3213
- *
3214
- * Will remove the entire taxonomy relationship containing term $object_id. The
3215
- * term IDs have to exist within the taxonomy $object_type for the deletion to
3216
- * take place.
3217
- *
3218
- * @since 2.3.0
3219
- *
3220
- * @see get_object_taxonomies() for more on $object_type
3221
- *
3222
- * @param int|array $object_ids Single or list of term object ID(s)
3223
- * @param array|string $object_type The taxonomy object type
3224
- */
3225
- function clean_object_term_cache($object_ids, $object_type) {
3226
- if ( !is_array($object_ids) )
3227
- $object_ids = array($object_ids);
3228
-
3229
- $taxonomies = get_object_taxonomies( $object_type );
3230
-
3231
- foreach ( $object_ids as $id ) {
3232
- foreach ( $taxonomies as $taxonomy ) {
3233
- wp_cache_delete($id, "{$taxonomy}_relationships");
3234
- }
3235
- }
3236
-
3237
- /**
3238
- * Fires after the object term cache has been cleaned.
3239
- *
3240
- * @since 2.5.0
3241
- *
3242
- * @param array $object_ids An array of object IDs.
3243
- * @param string $objet_type Object type.
3244
- */
3245
- do_action( 'clean_object_term_cache', $object_ids, $object_type );
3246
- }
3247
-
3248
- /**
3249
- * Will remove all of the term ids from the cache.
3250
- *
3251
- * @since 2.3.0
3252
- * @uses $wpdb
3253
- *
3254
- * @param int|array $ids Single or list of Term IDs
3255
- * @param string $taxonomy Can be empty and will assume tt_ids, else will use for context.
3256
- * @param bool $clean_taxonomy Whether to clean taxonomy wide caches (true), or just individual term object caches (false). Default is true.
3257
- */
3258
- function clean_term_cache($ids, $taxonomy = '', $clean_taxonomy = true) {
3259
- global $wpdb;
3260
-
3261
- if ( !is_array($ids) )
3262
- $ids = array($ids);
3263
-
3264
- $taxonomies = array();
3265
- // If no taxonomy, assume tt_ids.
3266
- if ( empty($taxonomy) ) {
3267
- $tt_ids = array_map('intval', $ids);
3268
- $tt_ids = implode(', ', $tt_ids);
3269
- $terms = $wpdb->get_results("SELECT term_id, taxonomy FROM $wpdb->term_taxonomy WHERE term_taxonomy_id IN ($tt_ids)");
3270
- $ids = array();
3271
- foreach ( (array) $terms as $term ) {
3272
- $taxonomies[] = $term->taxonomy;
3273
- $ids[] = $term->term_id;
3274
- wp_cache_delete($term->term_id, $term->taxonomy);
3275
- }
3276
- $taxonomies = array_unique($taxonomies);
3277
- } else {
3278
- $taxonomies = array($taxonomy);
3279
- foreach ( $taxonomies as $taxonomy ) {
3280
- foreach ( $ids as $id ) {
3281
- wp_cache_delete($id, $taxonomy);
3282
- }
3283
- }
3284
- }
3285
-
3286
- foreach ( $taxonomies as $taxonomy ) {
3287
- if ( $clean_taxonomy ) {
3288
- wp_cache_delete('all_ids', $taxonomy);
3289
- wp_cache_delete('get', $taxonomy);
3290
- delete_option("{$taxonomy}_children");
3291
- // Regenerate {$taxonomy}_children
3292
- _get_term_hierarchy($taxonomy);
3293
- }
3294
-
3295
- /**
3296
- * Fires once after each taxonomy's term cache has been cleaned.
3297
- *
3298
- * @since 2.5.0
3299
- *
3300
- * @param array $ids An array of term IDs.
3301
- * @param string $taxonomy Taxonomy slug.
3302
- */
3303
- do_action( 'clean_term_cache', $ids, $taxonomy );
3304
- }
3305
-
3306
- wp_cache_set( 'last_changed', microtime(), 'terms' );
3307
- }
3308
-
3309
- /**
3310
- * Retrieves the taxonomy relationship to the term object id.
3311
- *
3312
- * @since 2.3.0
3313
- *
3314
- * @uses wp_cache_get() Retrieves taxonomy relationship from cache
3315
- *
3316
- * @param int|array $id Term object ID
3317
- * @param string $taxonomy Taxonomy Name
3318
- * @return bool|array Empty array if $terms found, but not $taxonomy. False if nothing is in cache for $taxonomy and $id.
3319
- */
3320
- function get_object_term_cache($id, $taxonomy) {
3321
- $cache = wp_cache_get($id, "{$taxonomy}_relationships");
3322
- return $cache;
3323
- }
3324
-
3325
- /**
3326
- * Updates the cache for Term ID(s).
3327
- *
3328
- * Will only update the cache for terms not already cached.
3329
- *
3330
- * The $object_ids expects that the ids be separated by commas, if it is a
3331
- * string.
3332
- *
3333
- * It should be noted that update_object_term_cache() is very time extensive. It
3334
- * is advised that the function is not called very often or at least not for a
3335
- * lot of terms that exist in a lot of taxonomies. The amount of time increases
3336
- * for each term and it also increases for each taxonomy the term belongs to.
3337
- *
3338
- * @since 2.3.0
3339
- * @uses wp_get_object_terms() Used to get terms from the database to update
3340
- *
3341
- * @param string|array $object_ids Single or list of term object ID(s)
3342
- * @param array|string $object_type The taxonomy object type
3343
- * @return null|bool Null value is given with empty $object_ids. False if
3344
- */
3345
- function update_object_term_cache($object_ids, $object_type) {
3346
- if ( empty($object_ids) )
3347
- return;
3348
-
3349
- if ( !is_array($object_ids) )
3350
- $object_ids = explode(',', $object_ids);
3351
-
3352
- $object_ids = array_map('intval', $object_ids);
3353
-
3354
- $taxonomies = get_object_taxonomies($object_type);
3355
-
3356
- $ids = array();
3357
- foreach ( (array) $object_ids as $id ) {
3358
- foreach ( $taxonomies as $taxonomy ) {
3359
- if ( false === wp_cache_get($id, "{$taxonomy}_relationships") ) {
3360
- $ids[] = $id;
3361
- break;
3362
- }
3363
- }
3364
- }
3365
-
3366
- if ( empty( $ids ) )
3367
- return false;
3368
-
3369
- $terms = wp_get_object_terms($ids, $taxonomies, array('fields' => 'all_with_object_id'));
3370
-
3371
- $object_terms = array();
3372
- foreach ( (array) $terms as $term )
3373
- $object_terms[$term->object_id][$term->taxonomy][$term->term_id] = $term;
3374
-
3375
- foreach ( $ids as $id ) {
3376
- foreach ( $taxonomies as $taxonomy ) {
3377
- if ( ! isset($object_terms[$id][$taxonomy]) ) {
3378
- if ( !isset($object_terms[$id]) )
3379
- $object_terms[$id] = array();
3380
- $object_terms[$id][$taxonomy] = array();
3381
- }
3382
- }
3383
- }
3384
-
3385
- foreach ( $object_terms as $id => $value ) {
3386
- foreach ( $value as $taxonomy => $terms ) {
3387
- wp_cache_add( $id, $terms, "{$taxonomy}_relationships" );
3388
- }
3389
- }
3390
- }
3391
-
3392
- /**
3393
- * Updates Terms to Taxonomy in cache.
3394
- *
3395
- * @since 2.3.0
3396
- *
3397
- * @param array $terms List of Term objects to change
3398
- * @param string $taxonomy Optional. Update Term to this taxonomy in cache
3399
- */
3400
- function update_term_cache($terms, $taxonomy = '') {
3401
- foreach ( (array) $terms as $term ) {
3402
- $term_taxonomy = $taxonomy;
3403
- if ( empty($term_taxonomy) )
3404
- $term_taxonomy = $term->taxonomy;
3405
-
3406
- wp_cache_add($term->term_id, $term, $term_taxonomy);
3407
- }
3408
- }
3409
-
3410
- //
3411
- // Private
3412
- //
3413
-
3414
- /**
3415
- * Retrieves children of taxonomy as Term IDs.
3416
- *
3417
- * @access private
3418
- * @since 2.3.0
3419
- *
3420
- * @uses update_option() Stores all of the children in "$taxonomy_children"
3421
- * option. That is the name of the taxonomy, immediately followed by '_children'.
3422
- *
3423
- * @param string $taxonomy Taxonomy Name
3424
- * @return array Empty if $taxonomy isn't hierarchical or returns children as Term IDs.
3425
- */
3426
- function _get_term_hierarchy($taxonomy) {
3427
- if ( !is_taxonomy_hierarchical($taxonomy) )
3428
- return array();
3429
- $children = get_option("{$taxonomy}_children");
3430
-
3431
- if ( is_array($children) )
3432
- return $children;
3433
- $children = array();
3434
- $terms = get_terms($taxonomy, array('get' => 'all', 'orderby' => 'id', 'fields' => 'id=>parent'));
3435
- foreach ( $terms as $term_id => $parent ) {
3436
- if ( $parent > 0 )
3437
- $children[$parent][] = $term_id;
3438
- }
3439
- update_option("{$taxonomy}_children", $children);
3440
-
3441
- return $children;
3442
- }
3443
-
3444
- /**
3445
- * Get the subset of $terms that are descendants of $term_id.
3446
- *
3447
- * If $terms is an array of objects, then _get_term_children returns an array of objects.
3448
- * If $terms is an array of IDs, then _get_term_children returns an array of IDs.
3449
- *
3450
- * @access private
3451
- * @since 2.3.0
3452
- *
3453
- * @param int $term_id The ancestor term: all returned terms should be descendants of $term_id.
3454
- * @param array $terms The set of terms---either an array of term objects or term IDs---from which those that are descendants of $term_id will be chosen.
3455
- * @param string $taxonomy The taxonomy which determines the hierarchy of the terms.
3456
- * @return array The subset of $terms that are descendants of $term_id.
3457
- */
3458
- function _get_term_children($term_id, $terms, $taxonomy) {
3459
- $empty_array = array();
3460
- if ( empty($terms) )
3461
- return $empty_array;
3462
-
3463
- $term_list = array();
3464
- $has_children = _get_term_hierarchy($taxonomy);
3465
-
3466
- if ( ( 0 != $term_id ) && ! isset($has_children[$term_id]) )
3467
- return $empty_array;
3468
-
3469
- foreach ( (array) $terms as $term ) {
3470
- $use_id = false;
3471
- if ( !is_object($term) ) {
3472
- $term = get_term($term, $taxonomy);
3473
- if ( is_wp_error( $term ) )
3474
- return $term;
3475
- $use_id = true;
3476
- }
3477
-
3478
- if ( $term->term_id == $term_id ) {
3479
- continue;
3480
- }
3481
-
3482
- if ( $term->parent == $term_id ) {
3483
- if ( $use_id )
3484
- $term_list[] = $term->term_id;
3485
- else
3486
- $term_list[] = $term;
3487
-
3488
- if ( !isset($has_children[$term->term_id]) )
3489
- continue;
3490
-
3491
- if ( $children = _get_term_children($term->term_id, $terms, $taxonomy) )
3492
- $term_list = array_merge($term_list, $children);
3493
- }
3494
- }
3495
-
3496
- return $term_list;
3497
- }
3498
-
3499
- /**
3500
- * Add count of children to parent count.
3501
- *
3502
- * Recalculates term counts by including items from child terms. Assumes all
3503
- * relevant children are already in the $terms argument.
3504
- *
3505
- * @access private
3506
- * @since 2.3.0
3507
- * @uses $wpdb
3508
- *
3509
- * @param array $terms List of Term IDs
3510
- * @param string $taxonomy Term Context
3511
- * @return null Will break from function if conditions are not met.
3512
- */
3513
- function _pad_term_counts(&$terms, $taxonomy) {
3514
- global $wpdb;
3515
-
3516
- // This function only works for hierarchical taxonomies like post categories.
3517
- if ( !is_taxonomy_hierarchical( $taxonomy ) )
3518
- return;
3519
-
3520
- $term_hier = _get_term_hierarchy($taxonomy);
3521
-
3522
- if ( empty($term_hier) )
3523
- return;
3524
-
3525
- $term_items = array();
3526
-
3527
- foreach ( (array) $terms as $key => $term ) {
3528
- $terms_by_id[$term->term_id] = & $terms[$key];
3529
- $term_ids[$term->term_taxonomy_id] = $term->term_id;
3530
- }
3531
-
3532
- // Get the object and term ids and stick them in a lookup table
3533
- $tax_obj = get_taxonomy($taxonomy);
3534
- $object_types = esc_sql($tax_obj->object_type);
3535
- $results = $wpdb->get_results("SELECT object_id, term_taxonomy_id FROM $wpdb->term_relationships INNER JOIN $wpdb->posts ON object_id = ID WHERE term_taxonomy_id IN (" . implode(',', array_keys($term_ids)) . ") AND post_type IN ('" . implode("', '", $object_types) . "') AND post_status = 'publish'");
3536
- foreach ( $results as $row ) {
3537
- $id = $term_ids[$row->term_taxonomy_id];
3538
- $term_items[$id][$row->object_id] = isset($term_items[$id][$row->object_id]) ? ++$term_items[$id][$row->object_id] : 1;
3539
- }
3540
-
3541
- // Touch every ancestor's lookup row for each post in each term
3542
- foreach ( $term_ids as $term_id ) {
3543
- $child = $term_id;
3544
- while ( !empty( $terms_by_id[$child] ) && $parent = $terms_by_id[$child]->parent ) {
3545
- if ( !empty( $term_items[$term_id] ) )
3546
- foreach ( $term_items[$term_id] as $item_id => $touches ) {
3547
- $term_items[$parent][$item_id] = isset($term_items[$parent][$item_id]) ? ++$term_items[$parent][$item_id]: 1;
3548
- }
3549
- $child = $parent;
3550
- }
3551
- }
3552
-
3553
- // Transfer the touched cells
3554
- foreach ( (array) $term_items as $id => $items )
3555
- if ( isset($terms_by_id[$id]) )
3556
- $terms_by_id[$id]->count = count($items);
3557
- }
3558
-
3559
- //
3560
- // Default callbacks
3561
- //
3562
-
3563
- /**
3564
- * Will update term count based on object types of the current taxonomy.
3565
- *
3566
- * Private function for the default callback for post_tag and category
3567
- * taxonomies.
3568
- *
3569
- * @access private
3570
- * @since 2.3.0
3571
- * @uses $wpdb
3572
- *
3573
- * @param array $terms List of Term taxonomy IDs
3574
- * @param object $taxonomy Current taxonomy object of terms
3575
- */
3576
- function _update_post_term_count( $terms, $taxonomy ) {
3577
- global $wpdb;
3578
-
3579
- $object_types = (array) $taxonomy->object_type;
3580
-
3581
- foreach ( $object_types as &$object_type )
3582
- list( $object_type ) = explode( ':', $object_type );
3583
-
3584
- $object_types = array_unique( $object_types );
3585
-
3586
- if ( false !== ( $check_attachments = array_search( 'attachment', $object_types ) ) ) {
3587
- unset( $object_types[ $check_attachments ] );
3588
- $check_attachments = true;
3589
- }
3590
-
3591
- if ( $object_types )
3592
- $object_types = esc_sql( array_filter( $object_types, 'post_type_exists' ) );
3593
-
3594
- foreach ( (array) $terms as $term ) {
3595
- $count = 0;
3596
-
3597
- // Attachments can be 'inherit' status, we need to base count off the parent's status if so
3598
- if ( $check_attachments )
3599
- $count += (int) $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->term_relationships, $wpdb->posts p1 WHERE p1.ID = $wpdb->term_relationships.object_id AND ( post_status = 'publish' OR ( post_status = 'inherit' AND post_parent > 0 AND ( SELECT post_status FROM $wpdb->posts WHERE ID = p1.post_parent ) = 'publish' ) ) AND post_type = 'attachment' AND term_taxonomy_id = %d", $term ) );
3600
-
3601
- if ( $object_types )
3602
- $count += (int) $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->term_relationships, $wpdb->posts WHERE $wpdb->posts.ID = $wpdb->term_relationships.object_id AND post_status = 'publish' AND post_type IN ('" . implode("', '", $object_types ) . "') AND term_taxonomy_id = %d", $term ) );
3603
-
3604
- /** This action is documented in wp-includes/taxonomy.php */
3605
- do_action( 'edit_term_taxonomy', $term, $taxonomy );
3606
- $wpdb->update( $wpdb->term_taxonomy, compact( 'count' ), array( 'term_taxonomy_id' => $term ) );
3607
-
3608
- /** This action is documented in wp-includes/taxonomy.php */
3609
- do_action( 'edited_term_taxonomy', $term, $taxonomy );
3610
- }
3611
- }
3612
-
3613
- /**
3614
- * Will update term count based on number of objects.
3615
- *
3616
- * Default callback for the link_category taxonomy.
3617
- *
3618
- * @since 3.3.0
3619
- * @uses $wpdb
3620
- *
3621
- * @param array $terms List of Term taxonomy IDs
3622
- * @param object $taxonomy Current taxonomy object of terms
3623
- */
3624
- function _update_generic_term_count( $terms, $taxonomy ) {
3625
- global $wpdb;
3626
-
3627
- foreach ( (array) $terms as $term ) {
3628
- $count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->term_relationships WHERE term_taxonomy_id = %d", $term ) );
3629
-
3630
- /** This action is documented in wp-includes/taxonomy.php */
3631
- do_action( 'edit_term_taxonomy', $term, $taxonomy );
3632
- $wpdb->update( $wpdb->term_taxonomy, compact( 'count' ), array( 'term_taxonomy_id' => $term ) );
3633
-
3634
- /** This action is documented in wp-includes/taxonomy.php */
3635
- do_action( 'edited_term_taxonomy', $term, $taxonomy );
3636
- }
3637
- }
3638
-
3639
- /**
3640
- * Generate a permalink for a taxonomy term archive.
3641
- *
3642
- * @since 2.5.0
3643
- *
3644
- * @param object|int|string $term The term object, ID, or slug whose link will be retrieved.
3645
- * @param string $taxonomy Optional. Taxonomy. Default empty.
3646
- * @return string|WP_Error HTML link to taxonomy term archive on success, WP_Error if term does not exist.
3647
- */
3648
- function get_term_link( $term, $taxonomy = '') {
3649
- global $wp_rewrite;
3650
-
3651
- if ( !is_object($term) ) {
3652
- if ( is_int($term) ) {
3653
- $term = get_term($term, $taxonomy);
3654
- } else {
3655
- $term = get_term_by('slug', $term, $taxonomy);
3656
- }
3657
- }
3658
-
3659
- if ( !is_object($term) )
3660
- $term = new WP_Error('invalid_term', __('Empty Term'));
3661
-
3662
- if ( is_wp_error( $term ) )
3663
- return $term;
3664
-
3665
- $taxonomy = $term->taxonomy;
3666
-
3667
- $termlink = $wp_rewrite->get_extra_permastruct($taxonomy);
3668
-
3669
- $slug = $term->slug;
3670
- $t = get_taxonomy($taxonomy);
3671
-
3672
- if ( empty($termlink) ) {
3673
- if ( 'category' == $taxonomy )
3674
- $termlink = '?cat=' . $term->term_id;
3675
- elseif ( $t->query_var )
3676
- $termlink = "?$t->query_var=$slug";
3677
- else
3678
- $termlink = "?taxonomy=$taxonomy&term=$slug";
3679
- $termlink = home_url($termlink);
3680
- } else {
3681
- if ( $t->rewrite['hierarchical'] ) {
3682
- $hierarchical_slugs = array();
3683
- $ancestors = get_ancestors($term->term_id, $taxonomy);
3684
- foreach ( (array)$ancestors as $ancestor ) {
3685
- $ancestor_term = get_term($ancestor, $taxonomy);
3686
- $hierarchical_slugs[] = $ancestor_term->slug;
3687
- }
3688
- $hierarchical_slugs = array_reverse($hierarchical_slugs);
3689
- $hierarchical_slugs[] = $slug;
3690
- $termlink = str_replace("%$taxonomy%", implode('/', $hierarchical_slugs), $termlink);
3691
- } else {
3692
- $termlink = str_replace("%$taxonomy%", $slug, $termlink);
3693
- }
3694
- $termlink = home_url( user_trailingslashit($termlink, 'category') );
3695
- }
3696
- // Back Compat filters.
3697
- if ( 'post_tag' == $taxonomy ) {
3698
-
3699
- /**
3700
- * Filter the tag link.
3701
- *
3702
- * @since 2.3.0
3703
- * @deprecated 2.5.0 Use 'term_link' instead.
3704
- *
3705
- * @param string $termlink Tag link URL.
3706
- * @param int $term_id Term ID.
3707
- */
3708
- $termlink = apply_filters( 'tag_link', $termlink, $term->term_id );
3709
- } elseif ( 'category' == $taxonomy ) {
3710
-
3711
- /**
3712
- * Filter the category link.
3713
- *
3714
- * @since 1.5.0
3715
- * @deprecated 2.5.0 Use 'term_link' instead.
3716
- *
3717
- * @param string $termlink Category link URL.
3718
- * @param int $term_id Term ID.
3719
- */
3720
- $termlink = apply_filters( 'category_link', $termlink, $term->term_id );
3721
- }
3722
-
3723
- /**
3724
- * Filter the term link.
3725
- *
3726
- * @since 2.5.0
3727
- *
3728
- * @param string $termlink Term link URL.
3729
- * @param object $term Term object.
3730
- * @param string $taxonomy Taxonomy slug.
3731
- */
3732
- return apply_filters( 'term_link', $termlink, $term, $taxonomy );
3733
- }
3734
-
3735
- /**
3736
- * Display the taxonomies of a post with available options.
3737
- *
3738
- * This function can be used within the loop to display the taxonomies for a
3739
- * post without specifying the Post ID. You can also use it outside the Loop to
3740
- * display the taxonomies for a specific post.
3741
- *
3742
- * The available defaults are:
3743
- * 'post' : default is 0. The post ID to get taxonomies of.
3744
- * 'before' : default is empty string. Display before taxonomies list.
3745
- * 'sep' : default is empty string. Separate every taxonomy with value in this.
3746
- * 'after' : default is empty string. Display this after the taxonomies list.
3747
- * 'template' : The template to use for displaying the taxonomy terms.
3748
- *
3749
- * @since 2.5.0
3750
- * @uses get_the_taxonomies()
3751
- *
3752
- * @param array $args Override the defaults.
3753
- */
3754
- function the_taxonomies( $args = array() ) {
3755
- $defaults = array(
3756
- 'post' => 0,
3757
- 'before' => '',
3758
- 'sep' => ' ',
3759
- 'after' => '',
3760
- /* translators: %s: taxonomy label, %l: list of term links */
3761
- 'template' => __( '%s: %l.' )
3762
- );
3763
-
3764
- $r = wp_parse_args( $args, $defaults );
3765
-
3766
- echo $r['before'] . join( $r['sep'], get_the_taxonomies( $r['post'], $r ) ) . $r['after'];
3767
- }
3768
-
3769
- /**
3770
- * Retrieve all taxonomies associated with a post.
3771
- *
3772
- * This function can be used within the loop. It will also return an array of
3773
- * the taxonomies with links to the taxonomy and name.
3774
- *
3775
- * @since 2.5.0
3776
- *
3777
- * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.
3778
- * @param array $args Override the defaults.
3779
- * @return array List of taxonomies.
3780
- */
3781
- function get_the_taxonomies( $post = 0, $args = array() ) {
3782
- $post = get_post( $post );
3783
-
3784
- $args = wp_parse_args( $args, array(
3785
- /* translators: %s: taxonomy label, %l: list of term links */
3786
- 'template' => __( '%s: %l.' ),
3787
- ) );
3788
-
3789
- $taxonomies = array();
3790
-
3791
- if ( ! $post ) {
3792
- return $taxonomies;
3793
- }
3794
-
3795
- foreach ( get_object_taxonomies( $post ) as $taxonomy ) {
3796
- $t = (array) get_taxonomy( $taxonomy );
3797
- if ( empty( $t['label'] ) ) {
3798
- $t['label'] = $taxonomy;
3799
- }
3800
- if ( empty( $t['args'] ) ) {
3801
- $t['args'] = array();
3802
- }
3803
- if ( empty( $t['template'] ) ) {
3804
- $t['template'] = $args['template'];
3805
- }
3806
-
3807
- $terms = get_object_term_cache( $post->ID, $taxonomy );
3808
- if ( false === $terms ) {
3809
- $terms = wp_get_object_terms( $post->ID, $taxonomy, $t['args'] );
3810
- }
3811
- $links = array();
3812
-
3813
- foreach ( $terms as $term ) {
3814
- $links[] = "<a href='" . esc_attr( get_term_link( $term ) ) . "'>$term->name</a>";
3815
- }
3816
- if ( $links ) {
3817
- $taxonomies[$taxonomy] = wp_sprintf( $t['template'], $t['label'], $links, $terms );
3818
- }
3819
- }
3820
- return $taxonomies;
3821
- }
3822
-
3823
- /**
3824
- * Retrieve all taxonomies of a post with just the names.
3825
- *
3826
- * @since 2.5.0
3827
- *
3828
- * @uses get_object_taxonomies()
3829
- *
3830
- * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.
3831
- * @return array
3832
- */
3833
- function get_post_taxonomies( $post = 0 ) {
3834
- $post = get_post( $post );
3835
-
3836
- return get_object_taxonomies($post);
3837
- }
3838
-
3839
- /**
3840
- * Determine if the given object is associated with any of the given terms.
3841
- *
3842
- * The given terms are checked against the object's terms' term_ids, names and slugs.
3843
- * Terms given as integers will only be checked against the object's terms' term_ids.
3844
- * If no terms are given, determines if object is associated with any terms in the given taxonomy.
3845
- *
3846
- * @since 2.7.0
3847
- * @uses get_object_term_cache()
3848
- * @uses wp_get_object_terms()
3849
- *
3850
- * @param int $object_id ID of the object (post ID, link ID, ...)
3851
- * @param string $taxonomy Single taxonomy name
3852
- * @param int|string|array $terms Optional. Term term_id, name, slug or array of said
3853
- * @return bool|WP_Error. WP_Error on input error.
3854
- */
3855
- function is_object_in_term( $object_id, $taxonomy, $terms = null ) {
3856
- if ( !$object_id = (int) $object_id )
3857
- return new WP_Error( 'invalid_object', __( 'Invalid object ID' ) );
3858
-
3859
- $object_terms = get_object_term_cache( $object_id, $taxonomy );
3860
- if ( false === $object_terms )
3861
- $object_terms = wp_get_object_terms( $object_id, $taxonomy );
3862
-
3863
- if ( is_wp_error( $object_terms ) )
3864
- return $object_terms;
3865
- if ( empty( $object_terms ) )
3866
- return false;
3867
- if ( empty( $terms ) )
3868
- return ( !empty( $object_terms ) );
3869
-
3870
- $terms = (array) $terms;
3871
-
3872
- if ( $ints = array_filter( $terms, 'is_int' ) )
3873
- $strs = array_diff( $terms, $ints );
3874
- else
3875
- $strs =& $terms;
3876
-
3877
- foreach ( $object_terms as $object_term ) {
3878
- if ( $ints && in_array( $object_term->term_id, $ints ) ) return true; // If int, check against term_id
3879
- if ( $strs ) {
3880
- if ( in_array( $object_term->term_id, $strs ) ) return true;
3881
- if ( in_array( $object_term->name, $strs ) ) return true;
3882
- if ( in_array( $object_term->slug, $strs ) ) return true;
3883
- }
3884
- }
3885
-
3886
- return false;
3887
- }
3888
-
3889
- /**
3890
- * Determine if the given object type is associated with the given taxonomy.
3891
- *
3892
- * @since 3.0.0
3893
- * @uses get_object_taxonomies()
3894
- *
3895
- * @param string $object_type Object type string
3896
- * @param string $taxonomy Single taxonomy name
3897
- * @return bool True if object is associated with the taxonomy, otherwise false.
3898
- */
3899
- function is_object_in_taxonomy($object_type, $taxonomy) {
3900
- $taxonomies = get_object_taxonomies($object_type);
3901
-
3902
- if ( empty($taxonomies) )
3903
- return false;
3904
-
3905
- if ( in_array($taxonomy, $taxonomies) )
3906
- return true;
3907
-
3908
- return false;
3909
- }
3910
-
3911
- /**
3912
- * Get an array of ancestor IDs for a given object.
3913
- *
3914
- * @param int $object_id The ID of the object
3915
- * @param string $object_type The type of object for which we'll be retrieving ancestors.
3916
- * @return array of ancestors from lowest to highest in the hierarchy.
3917
- */
3918
- function get_ancestors($object_id = 0, $object_type = '') {
3919
- $object_id = (int) $object_id;
3920
-
3921
- $ancestors = array();
3922
-
3923
- if ( empty( $object_id ) ) {
3924
-
3925
- /** This filter is documented in wp-includes/taxonomy.php */
3926
- return apply_filters( 'get_ancestors', $ancestors, $object_id, $object_type );
3927
- }
3928
-
3929
- if ( is_taxonomy_hierarchical( $object_type ) ) {
3930
- $term = get_term($object_id, $object_type);
3931
- while ( ! is_wp_error($term) && ! empty( $term->parent ) && ! in_array( $term->parent, $ancestors ) ) {
3932
- $ancestors[] = (int) $term->parent;
3933
- $term = get_term($term->parent, $object_type);
3934
- }
3935
- } elseif ( post_type_exists( $object_type ) ) {
3936
- $ancestors = get_post_ancestors($object_id);
3937
- }
3938
-
3939
- /**
3940
- * Filter a given object's ancestors.
3941
- *
3942
- * @since 3.1.0
3943
- *
3944
- * @param array $ancestors An array of object ancestors.
3945
- * @param int $object_id Object ID.
3946
- * @param string $object_type Type of object.
3947
- */
3948
- return apply_filters( 'get_ancestors', $ancestors, $object_id, $object_type );
3949
- }
3950
-
3951
- /**
3952
- * Returns the term's parent's term_ID
3953
- *
3954
- * @since 3.1.0
3955
- *
3956
- * @param int $term_id
3957
- * @param string $taxonomy
3958
- *
3959
- * @return int|bool false on error
3960
- */
3961
- function wp_get_term_taxonomy_parent_id( $term_id, $taxonomy ) {
3962
- $term = get_term( $term_id, $taxonomy );
3963
- if ( !$term || is_wp_error( $term ) )
3964
- return false;
3965
- return (int) $term->parent;
3966
- }
3967
-
3968
- /**
3969
- * Checks the given subset of the term hierarchy for hierarchy loops.
3970
- * Prevents loops from forming and breaks those that it finds.
3971
- *
3972
- * Attached to the wp_update_term_parent filter.
3973
- *
3974
- * @since 3.1.0
3975
- * @uses wp_find_hierarchy_loop()
3976
- *
3977
- * @param int $parent term_id of the parent for the term we're checking.
3978
- * @param int $term_id The term we're checking.
3979
- * @param string $taxonomy The taxonomy of the term we're checking.
3980
- *
3981
- * @return int The new parent for the term.
3982
- */
3983
- function wp_check_term_hierarchy_for_loops( $parent, $term_id, $taxonomy ) {
3984
- // Nothing fancy here - bail
3985
- if ( !$parent )
3986
- return 0;
3987
-
3988
- // Can't be its own parent
3989
- if ( $parent == $term_id )
3990
- return 0;
3991
-
3992
- // Now look for larger loops
3993
-
3994
- if ( !$loop = wp_find_hierarchy_loop( 'wp_get_term_taxonomy_parent_id', $term_id, $parent, array( $taxonomy ) ) )
3995
- return $parent; // No loop
3996
-
3997
- // Setting $parent to the given value causes a loop
3998
- if ( isset( $loop[$term_id] ) )
3999
- return 0;
4000
-
4001
- // There's a loop, but it doesn't contain $term_id. Break the loop.
4002
- foreach ( array_keys( $loop ) as $loop_member )
4003
- wp_update_term( $loop_member, $taxonomy, array( 'parent' => 0 ) );
4004
-
4005
- return $parent;
4006
- }