Fishpig_Wordpress_Integration - Version 4.2.0.21

Version Notes

For changes, please see http://fishpig.co.uk/magento/wordpress-integration/#changelog

Download this release

Release Info

Developer fishpig
Extension Fishpig_Wordpress_Integration
Version 4.2.0.21
Comparing to
See all releases


Version 4.2.0.21

Files changed (220) hide show
  1. app/code/community/Fishpig/Wordpress/Addon/WordPressSEO/Helper/Data.php +795 -0
  2. app/code/community/Fishpig/Wordpress/Addon/WordPressSEO/etc/config.xml +37 -0
  3. app/code/community/Fishpig/Wordpress/Addon/Yarpp/Block/Sidebar/Widget.php +263 -0
  4. app/code/community/Fishpig/Wordpress/Addon/Yarpp/etc/config.xml +48 -0
  5. app/code/community/Fishpig/Wordpress/Block/Abstract.php +22 -0
  6. app/code/community/Fishpig/Wordpress/Block/Adminhtml/Associations/Abstract.php +399 -0
  7. app/code/community/Fishpig/Wordpress/Block/Adminhtml/Associations/Category/Category.php +20 -0
  8. app/code/community/Fishpig/Wordpress/Block/Adminhtml/Associations/Category/Post.php +20 -0
  9. app/code/community/Fishpig/Wordpress/Block/Adminhtml/Associations/Cms/Page/Category.php +20 -0
  10. app/code/community/Fishpig/Wordpress/Block/Adminhtml/Associations/Cms/Page/Post.php +20 -0
  11. app/code/community/Fishpig/Wordpress/Block/Adminhtml/Associations/Product/Category.php +20 -0
  12. app/code/community/Fishpig/Wordpress/Block/Adminhtml/Associations/Product/Post.php +20 -0
  13. app/code/community/Fishpig/Wordpress/Block/Adminhtml/Extend.php +624 -0
  14. app/code/community/Fishpig/Wordpress/Block/Adminhtml/Frontend/Autologin.php +42 -0
  15. app/code/community/Fishpig/Wordpress/Block/Adminhtml/System/Config/Form/Field/Route.php +89 -0
  16. app/code/community/Fishpig/Wordpress/Block/Adminhtml/Update.php +59 -0
  17. app/code/community/Fishpig/Wordpress/Block/Ajax.php +117 -0
  18. app/code/community/Fishpig/Wordpress/Block/Archive/View.php +61 -0
  19. app/code/community/Fishpig/Wordpress/Block/Author/View.php +31 -0
  20. app/code/community/Fishpig/Wordpress/Block/Feed/Abstract.php +179 -0
  21. app/code/community/Fishpig/Wordpress/Block/Feed/Post.php +123 -0
  22. app/code/community/Fishpig/Wordpress/Block/Feed/Post/Comment.php +88 -0
  23. app/code/community/Fishpig/Wordpress/Block/Homepage.php +62 -0
  24. app/code/community/Fishpig/Wordpress/Block/Menu.php +175 -0
  25. app/code/community/Fishpig/Wordpress/Block/Page/View.php +12 -0
  26. app/code/community/Fishpig/Wordpress/Block/Post/Abstract.php +193 -0
  27. app/code/community/Fishpig/Wordpress/Block/Post/Associated.php +97 -0
  28. app/code/community/Fishpig/Wordpress/Block/Post/Associated/Products.php +48 -0
  29. app/code/community/Fishpig/Wordpress/Block/Post/List.php +172 -0
  30. app/code/community/Fishpig/Wordpress/Block/Post/List/Associated.php +81 -0
  31. app/code/community/Fishpig/Wordpress/Block/Post/List/Pager.php +65 -0
  32. app/code/community/Fishpig/Wordpress/Block/Post/List/Renderer.php +20 -0
  33. app/code/community/Fishpig/Wordpress/Block/Post/List/Wrapper/Abstract.php +86 -0
  34. app/code/community/Fishpig/Wordpress/Block/Post/Meta.php +105 -0
  35. app/code/community/Fishpig/Wordpress/Block/Post/View.php +60 -0
  36. app/code/community/Fishpig/Wordpress/Block/Post/View/Comment/Abstract.php +127 -0
  37. app/code/community/Fishpig/Wordpress/Block/Post/View/Comment/Form.php +85 -0
  38. app/code/community/Fishpig/Wordpress/Block/Post/View/Comment/Pager.php +92 -0
  39. app/code/community/Fishpig/Wordpress/Block/Post/View/Comment/Wrapper.php +46 -0
  40. app/code/community/Fishpig/Wordpress/Block/Post/View/Comments.php +47 -0
  41. app/code/community/Fishpig/Wordpress/Block/Search/Result.php +78 -0
  42. app/code/community/Fishpig/Wordpress/Block/Shortcode/Product.php +11 -0
  43. app/code/community/Fishpig/Wordpress/Block/Sidebar.php +324 -0
  44. app/code/community/Fishpig/Wordpress/Block/Sidebar/Widget/Abstract.php +225 -0
  45. app/code/community/Fishpig/Wordpress/Block/Sidebar/Widget/Archives.php +103 -0
  46. app/code/community/Fishpig/Wordpress/Block/Sidebar/Widget/Calendar.php +174 -0
  47. app/code/community/Fishpig/Wordpress/Block/Sidebar/Widget/Categories.php +99 -0
  48. app/code/community/Fishpig/Wordpress/Block/Sidebar/Widget/Comments.php +40 -0
  49. app/code/community/Fishpig/Wordpress/Block/Sidebar/Widget/Image.php +65 -0
  50. app/code/community/Fishpig/Wordpress/Block/Sidebar/Widget/Links.php +72 -0
  51. app/code/community/Fishpig/Wordpress/Block/Sidebar/Widget/Menu.php +40 -0
  52. app/code/community/Fishpig/Wordpress/Block/Sidebar/Widget/Meta.php +30 -0
  53. app/code/community/Fishpig/Wordpress/Block/Sidebar/Widget/Pages.php +82 -0
  54. app/code/community/Fishpig/Wordpress/Block/Sidebar/Widget/Posts.php +247 -0
  55. app/code/community/Fishpig/Wordpress/Block/Sidebar/Widget/Rss.php +43 -0
  56. app/code/community/Fishpig/Wordpress/Block/Sidebar/Widget/Rss/Abstract.php +152 -0
  57. app/code/community/Fishpig/Wordpress/Block/Sidebar/Widget/Search.php +56 -0
  58. app/code/community/Fishpig/Wordpress/Block/Sidebar/Widget/Tagcloud.php +100 -0
  59. app/code/community/Fishpig/Wordpress/Block/Sidebar/Widget/Taxonomy.php +161 -0
  60. app/code/community/Fishpig/Wordpress/Block/Sidebar/Widget/Text.php +28 -0
  61. app/code/community/Fishpig/Wordpress/Block/Sidebar/Widget/Yarpp.php +22 -0
  62. app/code/community/Fishpig/Wordpress/Block/System/Config/Form/Field/Post/Type.php +23 -0
  63. app/code/community/Fishpig/Wordpress/Block/Template.php +11 -0
  64. app/code/community/Fishpig/Wordpress/Block/Term/View.php +39 -0
  65. app/code/community/Fishpig/Wordpress/Controller/Abstract.php +476 -0
  66. app/code/community/Fishpig/Wordpress/Controller/Router.php +401 -0
  67. app/code/community/Fishpig/Wordpress/Controller/Router/Addon.php +22 -0
  68. app/code/community/Fishpig/Wordpress/Exception.php +96 -0
  69. app/code/community/Fishpig/Wordpress/Helper/Abstract.php +256 -0
  70. app/code/community/Fishpig/Wordpress/Helper/App.php +538 -0
  71. app/code/community/Fishpig/Wordpress/Helper/Associations.php +548 -0
  72. app/code/community/Fishpig/Wordpress/Helper/Catalog/Product.php +124 -0
  73. app/code/community/Fishpig/Wordpress/Helper/Data.php +408 -0
  74. app/code/community/Fishpig/Wordpress/Helper/Database.php +40 -0
  75. app/code/community/Fishpig/Wordpress/Helper/Filter.php +245 -0
  76. app/code/community/Fishpig/Wordpress/Helper/Plugin.php +115 -0
  77. app/code/community/Fishpig/Wordpress/Helper/Plugin/Abstract.php +71 -0
  78. app/code/community/Fishpig/Wordpress/Helper/Plugin/Seo/Abstract.php +223 -0
  79. app/code/community/Fishpig/Wordpress/Helper/Router.php +273 -0
  80. app/code/community/Fishpig/Wordpress/Helper/Shortcode/Abstract.php +324 -0
  81. app/code/community/Fishpig/Wordpress/Helper/Shortcode/AssociatedProducts.php +45 -0
  82. app/code/community/Fishpig/Wordpress/Helper/Shortcode/Caption.php +51 -0
  83. app/code/community/Fishpig/Wordpress/Helper/Shortcode/Code.php +47 -0
  84. app/code/community/Fishpig/Wordpress/Helper/Shortcode/Dailymotion.php +69 -0
  85. app/code/community/Fishpig/Wordpress/Helper/Shortcode/Gallery.php +82 -0
  86. app/code/community/Fishpig/Wordpress/Helper/Shortcode/Gist.php +82 -0
  87. app/code/community/Fishpig/Wordpress/Helper/Shortcode/Instagram.php +81 -0
  88. app/code/community/Fishpig/Wordpress/Helper/Shortcode/Product.php +124 -0
  89. app/code/community/Fishpig/Wordpress/Helper/Shortcode/Scribd.php +69 -0
  90. app/code/community/Fishpig/Wordpress/Helper/Shortcode/Spotify.php +62 -0
  91. app/code/community/Fishpig/Wordpress/Helper/Shortcode/Vimeo.php +88 -0
  92. app/code/community/Fishpig/Wordpress/Helper/Shortcode/Youtube.php +99 -0
  93. app/code/community/Fishpig/Wordpress/Helper/Social.php +154 -0
  94. app/code/community/Fishpig/Wordpress/Helper/System.php +533 -0
  95. app/code/community/Fishpig/Wordpress/Model/Abstract.php +324 -0
  96. app/code/community/Fishpig/Wordpress/Model/Archive.php +93 -0
  97. app/code/community/Fishpig/Wordpress/Model/Image.php +184 -0
  98. app/code/community/Fishpig/Wordpress/Model/Menu.php +120 -0
  99. app/code/community/Fishpig/Wordpress/Model/Menu/Item.php +201 -0
  100. app/code/community/Fishpig/Wordpress/Model/Observer.php +242 -0
  101. app/code/community/Fishpig/Wordpress/Model/Post.php +679 -0
  102. app/code/community/Fishpig/Wordpress/Model/Post/Attachment/Abstract.php +49 -0
  103. app/code/community/Fishpig/Wordpress/Model/Post/Comment.php +238 -0
  104. app/code/community/Fishpig/Wordpress/Model/Post/Type.php +335 -0
  105. app/code/community/Fishpig/Wordpress/Model/Resource/Abstract.php +110 -0
  106. app/code/community/Fishpig/Wordpress/Model/Resource/Collection/Abstract.php +145 -0
  107. app/code/community/Fishpig/Wordpress/Model/Resource/Image.php +27 -0
  108. app/code/community/Fishpig/Wordpress/Model/Resource/Image/Collection.php +30 -0
  109. app/code/community/Fishpig/Wordpress/Model/Resource/Menu.php +15 -0
  110. app/code/community/Fishpig/Wordpress/Model/Resource/Menu/Collection.php +30 -0
  111. app/code/community/Fishpig/Wordpress/Model/Resource/Menu/Item.php +15 -0
  112. app/code/community/Fishpig/Wordpress/Model/Resource/Menu/Item/Collection.php +61 -0
  113. app/code/community/Fishpig/Wordpress/Model/Resource/Post.php +444 -0
  114. app/code/community/Fishpig/Wordpress/Model/Resource/Post/Attachment/Abstract.php +12 -0
  115. app/code/community/Fishpig/Wordpress/Model/Resource/Post/Attachment/Collection/Abstract.php +55 -0
  116. app/code/community/Fishpig/Wordpress/Model/Resource/Post/Collection.php +443 -0
  117. app/code/community/Fishpig/Wordpress/Model/Resource/Post/Comment.php +15 -0
  118. app/code/community/Fishpig/Wordpress/Model/Resource/Post/Comment/Collection.php +101 -0
  119. app/code/community/Fishpig/Wordpress/Model/Resource/Setup.php +28 -0
  120. app/code/community/Fishpig/Wordpress/Model/Resource/Term.php +103 -0
  121. app/code/community/Fishpig/Wordpress/Model/Resource/Term/Collection.php +213 -0
  122. app/code/community/Fishpig/Wordpress/Model/Resource/User.php +112 -0
  123. app/code/community/Fishpig/Wordpress/Model/Resource/User/Collection.php +29 -0
  124. app/code/community/Fishpig/Wordpress/Model/Sitemap/Sitemap.php +23 -0
  125. app/code/community/Fishpig/Wordpress/Model/System/Config/Backend/Autologin.php +132 -0
  126. app/code/community/Fishpig/Wordpress/Model/System/Config/Backend/Encrypted.php +23 -0
  127. app/code/community/Fishpig/Wordpress/Model/System/Config/Source/Menu.php +32 -0
  128. app/code/community/Fishpig/Wordpress/Model/System/Config/Source/Social/Media/Service.php +31 -0
  129. app/code/community/Fishpig/Wordpress/Model/Term.php +222 -0
  130. app/code/community/Fishpig/Wordpress/Model/Term/Taxonomy.php +132 -0
  131. app/code/community/Fishpig/Wordpress/Model/User.php +267 -0
  132. app/code/community/Fishpig/Wordpress/change-log.txt +243 -0
  133. app/code/community/Fishpig/Wordpress/controllers/Adminhtml/Wordpress/AssociationsController.php +244 -0
  134. app/code/community/Fishpig/Wordpress/controllers/Adminhtml/WordpressController.php +108 -0
  135. app/code/community/Fishpig/Wordpress/controllers/AjaxController.php +56 -0
  136. app/code/community/Fishpig/Wordpress/controllers/ArchiveController.php +79 -0
  137. app/code/community/Fishpig/Wordpress/controllers/AuthorController.php +89 -0
  138. app/code/community/Fishpig/Wordpress/controllers/IndexController.php +156 -0
  139. app/code/community/Fishpig/Wordpress/controllers/PostController.php +273 -0
  140. app/code/community/Fishpig/Wordpress/controllers/SearchController.php +58 -0
  141. app/code/community/Fishpig/Wordpress/controllers/TermController.php +106 -0
  142. app/code/community/Fishpig/Wordpress/etc/adminhtml.xml +56 -0
  143. app/code/community/Fishpig/Wordpress/etc/config.xml +314 -0
  144. app/code/community/Fishpig/Wordpress/etc/fishpig.xml +2 -0
  145. app/code/community/Fishpig/Wordpress/etc/system.xml +367 -0
  146. app/code/community/Fishpig/Wordpress/etc/widget.xml +40 -0
  147. app/code/community/Fishpig/Wordpress/sql/wordpress_setup/mysql4-install-0.1.0.php +10 -0
  148. app/code/community/Fishpig/Wordpress/sql/wordpress_setup/mysql4-upgrade-2.5.9.0-2.5.9.1.php +117 -0
  149. app/code/community/Fishpig/Wordpress/sql/wordpress_setup/mysql4-upgrade-3.2.0.0-3.2.0.1.php +28 -0
  150. app/design/adminhtml/default/default/layout/wordpress.xml +264 -0
  151. app/design/adminhtml/default/default/template/wordpress/integration-tests.phtml +104 -0
  152. app/design/frontend/base/default/layout/wordpress.xml +253 -0
  153. app/design/frontend/base/default/template/wordpress-addons/yarpp/related.phtml +34 -0
  154. app/design/frontend/base/default/template/wordpress-addons/yarpp/sidebar/widget.phtml +28 -0
  155. app/design/frontend/base/default/template/wordpress/archive/view.phtml +20 -0
  156. app/design/frontend/base/default/template/wordpress/author/view.phtml +16 -0
  157. app/design/frontend/base/default/template/wordpress/homepage.phtml +17 -0
  158. app/design/frontend/base/default/template/wordpress/post/associated.phtml +26 -0
  159. app/design/frontend/base/default/template/wordpress/post/associated/products.phtml +34 -0
  160. app/design/frontend/base/default/template/wordpress/post/list.phtml +22 -0
  161. app/design/frontend/base/default/template/wordpress/post/list/renderer/default.phtml +38 -0
  162. app/design/frontend/base/default/template/wordpress/post/list/wrapper.phtml +16 -0
  163. app/design/frontend/base/default/template/wordpress/post/meta.phtml +30 -0
  164. app/design/frontend/base/default/template/wordpress/post/view.phtml +35 -0
  165. app/design/frontend/base/default/template/wordpress/post/view/comment/form.phtml +68 -0
  166. app/design/frontend/base/default/template/wordpress/post/view/comment/wrapper.phtml +22 -0
  167. app/design/frontend/base/default/template/wordpress/post/view/comments.phtml +42 -0
  168. app/design/frontend/base/default/template/wordpress/post/view/page.phtml +28 -0
  169. app/design/frontend/base/default/template/wordpress/protected.phtml +35 -0
  170. app/design/frontend/base/default/template/wordpress/search/result.phtml +16 -0
  171. app/design/frontend/base/default/template/wordpress/shortcode/gallery.phtml +31 -0
  172. app/design/frontend/base/default/template/wordpress/shortcode/product.phtml +28 -0
  173. app/design/frontend/base/default/template/wordpress/sidebar.phtml +8 -0
  174. app/design/frontend/base/default/template/wordpress/sidebar/widget/abstract.phtml +28 -0
  175. app/design/frontend/base/default/template/wordpress/sidebar/widget/archives.phtml +42 -0
  176. app/design/frontend/base/default/template/wordpress/sidebar/widget/calendar.phtml +67 -0
  177. app/design/frontend/base/default/template/wordpress/sidebar/widget/categories.phtml +62 -0
  178. app/design/frontend/base/default/template/wordpress/sidebar/widget/categoryposts.phtml +41 -0
  179. app/design/frontend/base/default/template/wordpress/sidebar/widget/comments.phtml +30 -0
  180. app/design/frontend/base/default/template/wordpress/sidebar/widget/image.phtml +25 -0
  181. app/design/frontend/base/default/template/wordpress/sidebar/widget/links.phtml +28 -0
  182. app/design/frontend/base/default/template/wordpress/sidebar/widget/menu.phtml +27 -0
  183. app/design/frontend/base/default/template/wordpress/sidebar/widget/meta.phtml +33 -0
  184. app/design/frontend/base/default/template/wordpress/sidebar/widget/pages.phtml +27 -0
  185. app/design/frontend/base/default/template/wordpress/sidebar/widget/posts.phtml +28 -0
  186. app/design/frontend/base/default/template/wordpress/sidebar/widget/rss.phtml +36 -0
  187. app/design/frontend/base/default/template/wordpress/sidebar/widget/search.phtml +29 -0
  188. app/design/frontend/base/default/template/wordpress/sidebar/widget/tagcloud.phtml +25 -0
  189. app/design/frontend/base/default/template/wordpress/sidebar/widget/taxonomy.phtml +26 -0
  190. app/design/frontend/base/default/template/wordpress/sidebar/widget/taxonomy/renderer.phtml +24 -0
  191. app/design/frontend/base/default/template/wordpress/sidebar/widget/text.phtml +18 -0
  192. app/design/frontend/base/default/template/wordpress/term/view.phtml +22 -0
  193. app/etc/modules/Fishpig_Wordpress.xml +17 -0
  194. app/locale/cs_CZ/Fishpig_Wordpress.csv +104 -0
  195. app/locale/da_DK/Fishpig_Wordpress.csv +99 -0
  196. app/locale/de_DE/Fishpig_Wordpress.csv +89 -0
  197. app/locale/en_GB/Fishpig_Wordpress.csv +102 -0
  198. app/locale/en_US/Fishpig_Wordpress.csv +102 -0
  199. app/locale/es_ES/Fishpig_Wordpress.csv +102 -0
  200. app/locale/fr_FR/Fishpig_Wordpress.csv +100 -0
  201. app/locale/it_IT/Fishpig_Wordpress.csv +98 -0
  202. app/locale/ja_JP/Fishpig_Wordpress.csv +100 -0
  203. app/locale/nb_NO/Fishpig_Wordpress.csv +103 -0
  204. app/locale/nl_NL/Fishpig_Wordpress.csv +98 -0
  205. app/locale/nn_NO/Fishpig_Wordpress.csv +103 -0
  206. app/locale/pl_PL/Fishpig_Wordpress.csv +103 -0
  207. app/locale/pt_BR/Fishpig_Wordpress.csv +99 -0
  208. app/locale/pt_PT/Fishpig_Wordpress.csv +99 -0
  209. app/locale/ru_RU/Fishpig_Wordpress.csv +104 -0
  210. app/locale/sl_SI/Fishpig_Wordpress.csv +99 -0
  211. app/locale/sv_SE/Fishpig_Wordpress.csv +102 -0
  212. app/locale/tr_TR/Fishpig_Wordpress.csv +103 -0
  213. app/locale/zh_CN/Fishpig_Wordpress.csv +102 -0
  214. js/fishpig/wordpress/comments.js +97 -0
  215. js/fishpig/wordpress/lightbox.js +91 -0
  216. js/fishpig/wordpress/search.js +58 -0
  217. js/fishpig/wordpress/update.js +83 -0
  218. package.xml +18 -0
  219. skin/frontend/base/default/wordpress/ajax-loader.gif +0 -0
  220. skin/frontend/base/default/wordpress/styles.css +306 -0
app/code/community/Fishpig/Wordpress/Addon/WordPressSEO/Helper/Data.php ADDED
@@ -0,0 +1,795 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Fishpig
4
+ * @package Fishpig_Wordpress
5
+ * @license http://fishpig.co.uk/license.txt
6
+ * @author Ben Tideswell <help@fishpig.co.uk>
7
+ */
8
+
9
+ class Fishpig_Wordpress_Addon_WordPressSEO_Helper_Data extends Fishpig_Wordpress_Helper_Plugin_Seo_Abstract
10
+ {
11
+ /**
12
+ * A list of option fields used by the extension
13
+ * All fields are prefixed with wpseo_
14
+ *
15
+ * @var array
16
+ */
17
+ protected $_optionFields = array('', 'titles', 'xml', 'social', 'rss', 'internallinks', 'permalinks');
18
+
19
+ /**
20
+ * The value used to separate token's in the title
21
+ *
22
+ * @var string
23
+ */
24
+ protected $_rewriteTitleToken = '%%';
25
+
26
+ /**
27
+ * Cache for OG tags
28
+ *
29
+ * @var array
30
+ */
31
+ protected $_openGraphTags = array();
32
+
33
+ protected $_separatorOptions = array(
34
+ 'sc-dash' => '-',
35
+ 'sc-ndash' => '&ndash;',
36
+ 'sc-mdash' => '&mdash;',
37
+ 'sc-middot' => '&middot;',
38
+ 'sc-bull' => '&bull;',
39
+ 'sc-star' => '*',
40
+ 'sc-smstar' => '&#8902;',
41
+ 'sc-pipe' => '|',
42
+ 'sc-tilde' => '~',
43
+ 'sc-laquo' => '&laquo;',
44
+ 'sc-raquo' => '&raquo;',
45
+ 'sc-lt' => '&lt;',
46
+ 'sc-gt' => '&gt;',
47
+ );
48
+
49
+ /**
50
+ * Automatically load the plugin options
51
+ *
52
+ */
53
+ protected function _construct()
54
+ {
55
+ parent::_construct();
56
+
57
+ $data = array();
58
+
59
+ foreach($this->_optionFields as $key) {
60
+ if ($key !== '') {
61
+ $key = '_' . $key;
62
+ }
63
+
64
+ $options = Mage::helper('wordpress')->getWpOption('wpseo' . $key);
65
+
66
+ if ($options) {
67
+ $options = unserialize($options);
68
+
69
+ foreach($options as $key => $value) {
70
+ if (strpos($key, '-') !== false) {
71
+ unset($options[$key]);
72
+ $options[str_replace('-', '_', $key)] = $value;
73
+ }
74
+ }
75
+
76
+ $data = array_merge($data, $options);
77
+ }
78
+ }
79
+
80
+ $this->setData($data);
81
+ }
82
+
83
+ /**
84
+ * Determine whether All In One SEO is enabled
85
+ *
86
+ * @return bool
87
+ */
88
+ public function isEnabled()
89
+ {
90
+ return Mage::helper('wordpress')->isPluginEnabled('wordpress-seo/wp-seo.php')
91
+ || Mage::helper('wordpress')->isPluginEnabled('wordpress-seo-premium/wp-seo-premium.php');
92
+ }
93
+
94
+ /**
95
+ * Perform global actions before the user_func has been called
96
+ *
97
+ * @return $this
98
+ */
99
+ protected function _beforeObserver()
100
+ {
101
+ $helper = Mage::helper('wordpress');
102
+
103
+ $this->_applyOpenGraph(array(
104
+ 'locale' => Mage::app()->getLocale()->getLocaleCode(),
105
+ 'type' => 'blog',
106
+ 'title' => $helper->getWpOption('blogname'),
107
+ 'description' => $helper->getWpOption('blogdescription'),
108
+ 'url' => $helper->getUrl(),
109
+ 'site_name' => $helper->getWpOption('blogname'),
110
+ 'article:publisher' => $this->getFacebookSite(),
111
+ 'image' => $this->getData('og_default_image'),
112
+ ));
113
+ $this->_addGooglePlusLinkRel();
114
+
115
+ return parent::_beforeObserver();
116
+ }
117
+
118
+ /**
119
+ * Perform global actions after the user_func has been called
120
+ *
121
+ * @return $this
122
+ */
123
+ protected function _afterObserver()
124
+ {
125
+ $headBlock = $this->_getHeadBlock();
126
+ $helper = Mage::helper('wordpress');
127
+ $robots = array();
128
+
129
+ if ($this->getNoodp()) {
130
+ $robots[] = 'noodp';
131
+ }
132
+
133
+ if ($this->getNoydir()) {
134
+ $robots[] = 'noydir';
135
+ }
136
+
137
+ if (count($robots) > 0) {
138
+ if ($headBlock->getRobots() === '*') {
139
+ $headBlock->setRobots('index,follow,' . implode(',', $robots));
140
+ }
141
+ else {
142
+ $robots = array_unique(array_merge(explode(',', $headBlock->getRobots()), $robots));
143
+
144
+ $headBlock->setRobots(implode(',', $robots));
145
+ }
146
+ }
147
+
148
+ # $this->_updateBreadcrumb('blog', $this->getBreadcrumbsHome());
149
+
150
+ /**
151
+ * Open Graph Tags
152
+ */
153
+ if ((int)$this->getData('opengraph') === 1) {
154
+ $tagString = '';
155
+
156
+ foreach($this->_openGraphTags as $key => $value) {
157
+ $tkey = strpos($key, ':') === false ? 'og:' . $key : $key;
158
+
159
+ if (!is_array($value)) {
160
+ $value = array($value);
161
+ }
162
+
163
+ foreach($value as $v) {
164
+ if (trim($v) !== '') {
165
+ $tagString .= sprintf('<meta property="%s" content="%s" />', $tkey, addslashes($helper->escapeHtml($v))) . "\n";
166
+ }
167
+ }
168
+ }
169
+
170
+ $headBlock->setChild('wp.openGraph',
171
+ Mage::getSingleton('core/layout')->createBlock('core/text')->setText($tagString . "\n")
172
+ );
173
+ }
174
+
175
+ return $this;
176
+ }
177
+
178
+ /**
179
+ * Process the SEO values for the homepage
180
+ *
181
+ * @param $action
182
+ * @param Varien_Object $object
183
+ */
184
+ public function processRouteWordPressIndexIndex($object = null)
185
+ {
186
+ $this->_applyMeta(array(
187
+ 'title' => $this->getTitleHomeWpseo(),
188
+ 'description' => trim($this->getMetadescHomeWpseo()),
189
+ 'keywords' => trim($this->getMetakeyHomeWpseo()),
190
+ ));
191
+
192
+ $this->_applyOpenGraph(array(
193
+ 'description' => $this->getData('og_frontpage_desc'),
194
+ 'image' => $this->getData('og_frontpage_image'),
195
+ ));
196
+
197
+ return $this;
198
+ }
199
+
200
+ /**
201
+ * Process the SEO values for the blog view page
202
+ *
203
+ * @param $action
204
+ * @param Varien_Object $post
205
+ */
206
+ public function processRouteWordPressPostView($post)
207
+ {
208
+ $this->_applyPostPageLogic($post);
209
+
210
+ return $this;
211
+ }
212
+
213
+ /**
214
+ * Process the SEO values for the blog view page
215
+ *
216
+ * @param $action
217
+ * @param Varien_Object $page
218
+ */
219
+ public function processRouteWordPressPageView($page)
220
+ {
221
+ $this->_applyPostPageLogic($page, 'page');
222
+
223
+ if ((Mage::helper('wordpress')->isAddonInstalled('Root') && Mage::getStoreConfig('wordpress/integration/at_root'))) {
224
+ $this->getAction()->removeCrumb('blog');
225
+ }
226
+
227
+ return $this;
228
+ }
229
+
230
+ /**
231
+ * Process the SEO values for the blog view page
232
+ *
233
+ * @param Varien_Object $object
234
+ * @param string $type
235
+ * @param Varien_Object $page
236
+ */
237
+ protected function _applyPostPageLogic($object, $type = 'post')
238
+ {
239
+ $meta = new Varien_Object(array(
240
+ 'title' => $this->_getTitleFormat($object->getPostType()),
241
+ 'description' => trim($this->getData('metadesc_' . $object->getPostType())),
242
+ 'keywords' => trim($this->getData('metakey_' . $object->getPostType())),
243
+ ));
244
+
245
+ if (($value = trim($object->getMetaValue('_yoast_wpseo_title'))) !== '') {
246
+ $data = $this->getRewriteData();
247
+ $data['title'] = $value;
248
+ $this->setRewriteData($data);
249
+ }
250
+
251
+ if (($value = trim($object->getMetaValue('_yoast_wpseo_metadesc'))) !== '') {
252
+ $meta->setDescription($value);
253
+ }
254
+
255
+ if (($value = trim($object->getMetaValue('_yoast_wpseo_metakeywords'))) !== '') {
256
+ $meta->setKeywords($value);
257
+ }
258
+
259
+ $robots = array();
260
+
261
+ $noIndex = (int)$object->getMetaValue('_yoast_wpseo_meta-robots-noindex');
262
+
263
+ if ($noIndex === 0) {
264
+ $robots['index'] = '';
265
+ }
266
+ else if ($noIndex === 1) {
267
+ $robots['noindex'] = '';
268
+ }
269
+ else if ($noIndex === 2) {
270
+ $robots['index'] = '';
271
+ }
272
+ else if ($this->getNoindexPost()) {
273
+ $robots['noindex'] = '';
274
+ }
275
+
276
+ if ($object->getMetaValue('_yoast_wpseo_meta-robots-nofollow')) {
277
+ $robots['nofollow'] = '';
278
+ }
279
+ else {
280
+ $robots['follow'] = '';
281
+ }
282
+
283
+ if (($advancedRobots = trim($object->getMetaValue('_yoast_wpseo_meta-robots-adv'))) !== '') {
284
+ if ($advancedRobots !== 'none') {
285
+ $robots = explode(',', $advancedRobots);
286
+ }
287
+ }
288
+
289
+ $robots = array_keys($robots);
290
+
291
+ if (count($robots) > 0) {
292
+ $meta->setRobots(implode(',', $robots));
293
+ }
294
+
295
+ $this->_applyMeta($meta->getData());
296
+
297
+ if ($canon = $object->getMetaValue('_yoast_wpseo_canonical')) {
298
+ $object->setCanonicalUrl($canon);
299
+ }
300
+
301
+ if (!$this->hasOpengraph() || (int)$this->getOpengraph() ===1) {
302
+ $this->_addPostOpenGraphTags($object, $object->getPostType());
303
+ }
304
+
305
+ if ($this->getTwitter()) {
306
+ $this->_addTwitterCard(array(
307
+ 'card' => $this->getTwitterCardType(),
308
+ 'site' => ($this->getTwitterSite() ? '@' . $this->getTwitterSite() : ''),
309
+ 'title' => $object->getPostTitle(),
310
+ 'creator' => ($creator = $object->getAuthor()->getMetaValue('twitter')) ? '@' . $creator : '',
311
+ 'image0' => $object->getFeaturedImage() ? $object->getFeaturedImage()->getFullSizeImage() : null,
312
+ ));
313
+ }
314
+
315
+ return $this;
316
+ }
317
+
318
+ /**
319
+ * Category page
320
+ *
321
+ * @param Varien_Object $category
322
+ */
323
+ public function processRouteWordpressTermView($term)
324
+ {
325
+ $this->_applyMeta(array(
326
+ 'title' => $this->getData('title_tax_' . $term->getTaxonomyType()),
327
+ 'description' => $this->getData('metadesc_tax_' . $term->getTaxonomyType()),
328
+ 'keywords' => $this->getData('metakey_tax_' . $term->getTaxonomyType()),
329
+ 'robots' => $this->getData('noindex_tax_' . $term->getTaxonomyType()) ? 'noindex,follow' : '',
330
+ ));
331
+
332
+ $this->_applyOpenGraph(array(
333
+ 'type' => 'object',
334
+ 'title' => $term->getName(),
335
+ 'url' => $term->getUrl(),
336
+ 'description' => $term->getDescription(),
337
+ ));
338
+
339
+ if ($meta = @unserialize(Mage::helper('wordpress')->getWpOption('wpseo_taxonomy_meta'))) {
340
+ if (isset($meta[$term->getTaxonomyType()]) && isset($meta[$term->getTaxonomyType()][$term->getId()])) {
341
+ $meta = new Varien_Object((array)$meta[$term->getTaxonomyType()][$term->getId()]);
342
+
343
+ $this->_applyMeta(array(
344
+ 'title' => $meta->getWpseoTitle(),
345
+ 'description' => $meta->getWpseoDesc(),
346
+ 'keywords' => $meta->getWpseoMetakey(),
347
+ ));
348
+
349
+ if ($meta->getWpseoCanonical()) {
350
+ $term->setCanonicalUrl($meta->getWpseoCanonical());
351
+ }
352
+
353
+ $this->_applyOpenGraph(array(
354
+ 'title' => $meta->getWpseoTitle(),
355
+ 'description' => $meta->getWpseoDesc(),
356
+ 'url' => $term->getCanonicalUrl(),
357
+ ));
358
+ }
359
+ }
360
+
361
+ return $this;
362
+ }
363
+
364
+ /**
365
+ * Archive page
366
+ *
367
+ * @param Varien_Object $archive
368
+ */
369
+ public function processRouteWordpressArchiveView($archive)
370
+ {
371
+ if ($this->getDisableDate()) {
372
+ $this->_redirect(Mage::helper('wordpress')->getBlogRoute());
373
+ }
374
+
375
+ $meta = new Varien_Object(array(
376
+ 'title' => $this->getTitleArchiveWpseo(),
377
+ 'description' => $this->getMetadescArchiveWpseo(),
378
+ 'keywords' => $this->getMetakeyArchiveWpseo(),
379
+ 'robots' => $this->getNoindexArchiveWpseo() ? 'noindex,follow' : '',
380
+ ));
381
+
382
+ $this->_applyMeta($meta->getData());
383
+
384
+ $this->_applyOpenGraph(array(
385
+ 'type' => 'object',
386
+ 'title' => $this->_rewriteString($this->getTitleArchiveWpseo()),
387
+ 'url' => $archive->getUrl(),
388
+ ));
389
+
390
+ $this->_updateBreadcrumb('archive_label', $this->getBreadcrumbsArchiveprefix());
391
+
392
+ return $this;
393
+ }
394
+
395
+ /**
396
+ * Author page
397
+ *
398
+ * @param Varien_Object $author
399
+ */
400
+ public function processRouteWordpressAuthorView($author)
401
+ {
402
+ if ($this->getDisableAuthor()) {
403
+ $this->_redirect(Mage::helper('wordpress')->getBlogRoute());
404
+ }
405
+
406
+ $meta = new Varien_Object(array(
407
+ 'title' => $this->getTitleAuthorWpseo(),
408
+ 'description' => $this->getMetadescAuthorWpseo(),
409
+ 'keywords' => $this->getMetakeyAuthorWpseo(),
410
+ 'robots' => $this->getNoindexAuthorWpseo() ? 'noindex,follow' : '',
411
+ ));
412
+
413
+ $this->_applyMeta($meta->getData());
414
+
415
+ $this->_applyOpenGraph(array(
416
+ 'type' => 'object',
417
+ 'title' => $this->_rewriteString($this->getTitleAuthorWpseo()),
418
+ 'url' => $author->getUrl(),
419
+ ));
420
+
421
+ return $this;
422
+ }
423
+
424
+ /**
425
+ * Process the search results page
426
+ *
427
+ * @param $object
428
+ */
429
+ public function processRouteWordpressSearchIndex($object = null)
430
+ {
431
+ $meta = new Varien_Object(array(
432
+ 'title' => $this->getTitleSearchWpseo(),
433
+ ));
434
+
435
+ $this->_applyMeta($meta->getData());
436
+
437
+ $this->_applyOpenGraph(array(
438
+ 'type' => 'object',
439
+ 'title' => $this->_rewriteString($this->getTitleSearchWpseo()),
440
+ 'url' => Mage::getUrl('*/*/*', array('_current' => true, '_use_rewrite' => true)),
441
+ ));
442
+
443
+ $this->_updateBreadcrumb('search_label', $this->getBreadcrumbsSearchprefix());
444
+
445
+ return $this;
446
+ }
447
+
448
+ /**
449
+ * Process the custom post type archive page
450
+ *
451
+ * @param $object
452
+ */
453
+ public function processRouteWpAddonCptIndexView($object)
454
+ {
455
+ $this->_applyMeta(array(
456
+ 'title' => $this->_getTitleFormat('ptarchive_' .$object->getPostType()),
457
+ 'description' => trim($this->getData('metadesc_ptarchive_' . $object->getPostType())),
458
+ ));
459
+
460
+ if (Mage::helper('wordpress')->isAddonInstalled('Root')) {
461
+ if (Mage::getStoreConfigFlag('wordpress/integration/at_root')) {
462
+ $this->getAction()->removeCrumb('blog');
463
+ }
464
+ }
465
+
466
+ return $this;
467
+ }
468
+
469
+ /**
470
+ * Add the Google Plus rel="author" tag
471
+ *
472
+ * @return $this
473
+ */
474
+ protected function _addGooglePlusLinkRel()
475
+ {
476
+ $user = Mage::registry('wordpress_author');
477
+ $post = Mage::registry('wordpress_post');
478
+
479
+ if (is_null($user) && !is_null($post)) {
480
+ $user = $post->getAuthor();
481
+ }
482
+
483
+ if (!is_null($user)) {
484
+ if ($user->getMetaValue('googleplus')) {
485
+ $this->_getHeadBlock()->addItem('link_rel', $user->getMetaValue('googleplus'), 'rel="author"');
486
+ }
487
+ }
488
+
489
+ if ($publisher = $this->getData('plus_publisher')) {
490
+ $this->_getHeadBlock()->addItem('link_rel', $publisher, 'rel="publisher"');
491
+ }
492
+
493
+ return $this;
494
+ }
495
+
496
+ /**
497
+ * Add a Twitter card to the head
498
+ *
499
+ * @param array $tafs
500
+ * @return $this
501
+ */
502
+ protected function _addTwitterCard(array $tags)
503
+ {
504
+ if (($head = Mage::getSingleton('core/layout')->getBlock('head')) !== false) {
505
+ $helper = Mage::helper('wordpress');
506
+
507
+ foreach($tags as $key => $value) {
508
+ if (trim($value) !== '') {
509
+ $tags[$key] = sprintf('<meta name="twitter:%s" content="%s" />', $key, addslashes($helper->escapeHtml($value)));
510
+ }
511
+ else {
512
+ unset($tags[$key]);
513
+ }
514
+ }
515
+
516
+ $head->setChild('wp.twitterCard',
517
+ Mage::getSingleton('core/layout')->createBlock('core/text')->setText(implode("\n", $tags) . "\n")
518
+ );
519
+ }
520
+
521
+ return $this;
522
+ }
523
+
524
+ /**
525
+ * Add the OG tags ready for applying
526
+ *
527
+ * @param array $tags
528
+ * @return $this
529
+ */
530
+ protected function _applyOpenGraph(array $tags)
531
+ {
532
+ foreach($tags as $tag => $value) {
533
+ if (!is_array($value) && trim($value) === '') {
534
+ continue;
535
+ }
536
+
537
+ $this->_openGraphTags[$tag] = $value;
538
+ }
539
+
540
+ return $this;
541
+ }
542
+
543
+ /**
544
+ * Add the open graph tags to the post/page
545
+ *
546
+ * @object
547
+ * @param string $type = 'post'
548
+ * @return
549
+ */
550
+ protected function _addPostOpenGraphTags($object, $type = 'post')
551
+ {
552
+ $tags = array(
553
+ 'type' => 'article',
554
+ 'title' => $object->getPostTitle(),
555
+ 'description' => $object->getMetaDescription(),
556
+ 'url' => $object->getPermalink(),
557
+ 'image' => $object->getFeaturedImage() ? $object->getFeaturedImage()->getFullSizeImage() : '',
558
+ 'updated_time' => $object->getPostModifiedDate('c'),
559
+ 'article:author' => $object->getAuthor()->getMetaValue('facebook'),
560
+ 'article:published_time' => $object->getPostDate('c'),
561
+ 'article:modified_time' => $object->getPostModifiedDate('c'),
562
+ );
563
+
564
+ if ($head = Mage::getSingleton('core/layout')->getBlock('head')) {
565
+ $tags['description'] = $head->getDescription();
566
+ }
567
+
568
+ if ($fbDesc = $object->getMetaValue('_yoast_wpseo_opengraph-description')) {
569
+ $tags['description'] = $fbDesc;
570
+ }
571
+
572
+ if ($fbImage = $object->getMetaValue('_yoast_wpseo_opengraph-image')) {
573
+ $tags['image'] = $fbImage;
574
+ }
575
+
576
+ if ($items = $object->getTags()) {
577
+ $tagValue = array();
578
+
579
+ foreach($items as $item) {
580
+ $tagValue[] = $item->getName();
581
+ }
582
+
583
+ $tags['article:tag'] = $tagValue;
584
+ }
585
+
586
+ if ($items = $object->getParentCategories()) {
587
+ $categoryValue = '';
588
+
589
+ foreach($items as $item) {
590
+ $categoryValue[] = $item->getName();
591
+ }
592
+
593
+ $tags['article:section'] = $categoryValue;
594
+ }
595
+
596
+ return $this->_applyOpenGraph($tags);
597
+ }
598
+
599
+ /**
600
+ * Retrieve the rewrite data
601
+ *
602
+ * @return array
603
+ */
604
+ public function getRewriteData()
605
+ {
606
+ if (!$this->hasRewriteData()) {
607
+ $data = array(
608
+ 'sitename' => Mage::helper('wordpress')->getWpOption('blogname'),
609
+ 'sitedesc' => Mage::helper('wordpress')->getWpOption('blogdescription'),
610
+ );
611
+
612
+ if (($object = Mage::registry('wordpress_post')) !== null || ($object = Mage::registry('wordpress_page')) !== null) {
613
+ $data['date'] = $object->getPostDate();
614
+ $data['title'] = $object->getPostTitle();
615
+ $data['excerpt'] = trim(strip_tags($object->getPostExcerpt()));
616
+ $data['excerpt_only'] = $data['excerpt'];
617
+
618
+ $categories = array();
619
+
620
+ if ($object instanceof Fishpig_Wordpress_Model_Post) {
621
+ foreach($object->getParentCategories()->load() as $category) {
622
+ $categories[] = $category->getName();
623
+ }
624
+ }
625
+
626
+ $data['category'] = implode(', ', $categories);
627
+ $data['modified'] = $object->getPostModified();
628
+ $data['id'] = $object->getId();
629
+ $data['name'] = $object->getAuthor()->getUserNicename();
630
+ $data['userid'] = $object->getAuthor()->getId();
631
+ }
632
+
633
+ if (($term = Mage::registry('wordpress_term')) !== null) {
634
+ $data['term_description'] = trim(strip_tags($term->getDescription()));
635
+ $data['term_title'] = $term->getName();
636
+ }
637
+
638
+ if (($archive = Mage::registry('wordpress_archive')) !== null) {
639
+ $data['date'] = $archive->getName();
640
+ }
641
+
642
+ if (($author = Mage::registry('wordpress_author')) !== null) {
643
+ $data['name'] = $author->getDisplayName();
644
+ }
645
+
646
+ $data['currenttime'] = Mage::helper('wordpress')->formatTime(date('Y-m-d H:i:s'));
647
+ $data['currentdate'] = Mage::helper('wordpress')->formatDate(date('Y-m-d H:i:s'));
648
+ $data['currentmonth'] = date('F');
649
+ $data['currentyear'] = date('Y');
650
+ $data['sep'] = '|';
651
+
652
+ if ($sep = $this->getData('separator')) {
653
+ if (isset($this->_separatorOptions[$sep])) {
654
+ $data['sep'] = $this->_separatorOptions[$sep];
655
+ }
656
+ }
657
+
658
+ if (($value = trim(Mage::helper('wordpress/router')->getSearchTerm(true))) !== '') {
659
+ $data['searchphrase'] = $value;
660
+ }
661
+
662
+ if (($page = (int)Mage::app()->getRequest()->getParam('page')) > 1) {
663
+ $data['page'] = $data['sep'] . ' Page ' . $page;
664
+ }
665
+
666
+ $this->setRewriteData($data);
667
+ }
668
+
669
+ return $this->_getData('rewrite_data');
670
+ }
671
+
672
+ /**
673
+ * Retrieve the title format for the given key
674
+ *
675
+ * @param string $key
676
+ * @return string
677
+ */
678
+ protected function _getTitleFormat($key)
679
+ {
680
+ return trim($this->getData('title_' . $key));
681
+ }
682
+
683
+ /**
684
+ * Given a key that determines which format to load
685
+ * and a data array, merge the 2 to create a valid title
686
+ *
687
+ * @param string $key
688
+ * @return string|false
689
+ */
690
+ protected function _rewriteStringg($format)
691
+ {
692
+ if (($value = parent::_rewriteString($format)) !== false) {
693
+ $data = $this->getRewriteData();
694
+
695
+ if (is_array($data) && isset($data['sep'])) {
696
+ $value = trim($value, $data['sep'] . ' -/\|,');
697
+ }
698
+ }
699
+
700
+ return $value;
701
+ }
702
+
703
+ /**
704
+ * Determine whether to remove the category base
705
+ *
706
+ * @return string
707
+ */
708
+ public function canRemoveCategoryBase()
709
+ {
710
+ return $this->isEnabled() && (int)$this->getData('stripcategorybase') === 1;
711
+ }
712
+
713
+ /**
714
+ * Process the SEO values for the Tribe Events homepage
715
+ *
716
+ * @param $action
717
+ * @param Varien_Object $post
718
+ */
719
+ public function processRouteWpAddonEventscalendarIndexIndex($object)
720
+ {
721
+ return $this;
722
+ }
723
+
724
+ /**
725
+ * Process the SEO values for the Tribe Events view page
726
+ *
727
+ * @param $action
728
+ * @param Varien_Object $post
729
+ */
730
+ public function processRouteWpAddonEventscalendarEventView($post)
731
+ {
732
+ $this->_applyPostPageLogic($post, $post->getPostType());
733
+
734
+ return $this;
735
+ }
736
+
737
+ /**
738
+ * Tribe Events category page
739
+ *
740
+ * @param Varien_Object $category
741
+ */
742
+ public function processRouteWpAddonEventscalendarEventCategoryView($term)
743
+ {
744
+ return $this->processRouteWordpressTermView($term);
745
+ }
746
+
747
+ /**
748
+ * Get the primary category for $post
749
+ *
750
+ * @param Fishpig_Wordpress_Model_Post $post
751
+ * @return false|Fishpig_Wordpress_Model_Term
752
+ **/
753
+ public function getPostPrimaryCategory(Fishpig_Wordpress_Model_Post $post)
754
+ {
755
+ if (!$this->isEnabled()) {
756
+ return false;
757
+ }
758
+
759
+ if ($categoryId = $post->getMetaValue('_yoast_wpseo_primary_category')) {
760
+ $category = Mage::getModel('wordpress/term')->setTaxonomy('category')->load($categoryId);
761
+
762
+ if ($category->getId()) {
763
+ return $category;
764
+ }
765
+ }
766
+
767
+ return false;
768
+ }
769
+
770
+ /**
771
+ * Add the primary category to the select object
772
+ *
773
+ * @param
774
+ * @param
775
+ * @return $this
776
+ **/
777
+ public function addPrimaryCategoryToSelect($select, $post)
778
+ {
779
+ if (!$this->isEnabled()) {
780
+ return $this;
781
+ }
782
+
783
+ if (is_object($post)) {
784
+ $post = $post->getId();
785
+ }
786
+
787
+ $tempPostModel = Mage::getModel('wordpress/post')->setId($post);
788
+
789
+ if ($categoryId = $tempPostModel->getMetaValue('_yoast_wpseo_primary_category')) {
790
+ $select->reset(Zend_Db_Select::ORDER)->where('_term.term_id=?', $categoryId);
791
+ }
792
+
793
+ return $this;
794
+ }
795
+ }
app/code/community/Fishpig/Wordpress/Addon/WordPressSEO/etc/config.xml ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Fishpig_Wordpress_Addon_WordPressSEO>
5
+ <version>1.3.1.1</version>
6
+ <fishpig>
7
+ <id>wordpress-seo</id>
8
+ <name>WordPress SEO</name>
9
+ <url />
10
+ <is_core>1</is_core>
11
+ </fishpig>
12
+ </Fishpig_Wordpress_Addon_WordPressSEO>
13
+ </modules>
14
+ <global>
15
+ <helpers>
16
+ <wp_addon_wordpressseo>
17
+ <class>Fishpig_Wordpress_Addon_WordPressSEO_Helper</class>
18
+ </wp_addon_wordpressseo>
19
+ <wp_addon_yoastseo>
20
+ <class>Fishpig_Wordpress_Addon_WordPressSEO_Helper</class>
21
+ </wp_addon_yoastseo>
22
+ </helpers>
23
+ </global>
24
+ <frontend>
25
+ <events>
26
+ <wordpress_render_layout_before>
27
+ <observers>
28
+ <wp_addon_wordpressSeo>
29
+ <type>singleton</type>
30
+ <class>Fishpig_Wordpress_Addon_WordPressSEO_Helper_Data</class>
31
+ <method>injectSeoObserver</method>
32
+ </wp_addon_wordpressSeo>
33
+ </observers>
34
+ </wordpress_render_layout_before>
35
+ </events>
36
+ </frontend>
37
+ </config>
app/code/community/Fishpig/Wordpress/Addon/Yarpp/Block/Sidebar/Widget.php ADDED
@@ -0,0 +1,263 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Fishpig
4
+ * @package Fishpig_Wordpress
5
+ * @license http://fishpig.co.uk/license.txt
6
+ * @author Ben Tideswell <help@fishpig.co.uk>
7
+ */
8
+
9
+ class Fishpig_Wordpress_Addon_Yarpp_Block_Sidebar_Widget extends Fishpig_Wordpress_Block_Sidebar_Widget_Abstract
10
+ {
11
+ /**
12
+ * Determine whether Yarpp is enabled
13
+ *
14
+ * @return bool
15
+ */
16
+ public function isEnabled()
17
+ {
18
+ return Mage::helper('wordpress')->isPluginEnabled('yet-another-related-posts-plugin/yarpp.php');
19
+ }
20
+
21
+ /**
22
+ * Load the options for the widget/block and set the posts
23
+ *
24
+ * @return $this
25
+ */
26
+ protected function _beforeToHtml()
27
+ {
28
+ if (!$this->isEnabled()) {
29
+ return $this;
30
+ }
31
+
32
+ $options = unserialize($this->helper('wordpress')->getWpOption('yarpp'));
33
+
34
+ if (is_array($options)) {
35
+ if (isset($options['template'])) {
36
+ $options['view'] = $options['template'];
37
+ unset($options['template']);
38
+ }
39
+
40
+ $this->addData($options);
41
+ }
42
+
43
+ parent::_beforeToHtml();
44
+
45
+ $this->setPosts($this->_getPostCollection());
46
+
47
+ return $this;
48
+ }
49
+
50
+ /**
51
+ * Control the number of posts displayed
52
+ *
53
+ * @param int $count
54
+ * @return $this
55
+ */
56
+ public function setPostCount($count)
57
+ {
58
+ return $this->setNumber($count);
59
+ }
60
+
61
+ /**
62
+ * Retrieve the current post object
63
+ *
64
+ * @return Fishpig_Wordpress_Model_Post|false
65
+ */
66
+ public function getPost()
67
+ {
68
+ return $this->hasPost() ? $this->_getData('post') : Mage::registry('wordpress_post');
69
+ }
70
+
71
+ /**
72
+ * Adds on cateogry/author ID filters
73
+ *
74
+ * @return Fishpig_Wordpress_Model_Mysql4_Post_Collection
75
+ */
76
+ protected function _getPostCollection()
77
+ {
78
+ if ($this->getPost()) {
79
+ $collection = $this->getRelatedPostCollection($this->getPost())
80
+ ->setCurPage(1);
81
+
82
+ if ($this->getNumber()) {
83
+ $collection->setPageSize($this->getNumber());
84
+ }
85
+
86
+ return $collection->load();
87
+ }
88
+
89
+ return array();
90
+ }
91
+
92
+ /**
93
+ * Retrieve the default title
94
+ *
95
+ * @return string
96
+ */
97
+ public function getDefaultTitle()
98
+ {
99
+ return $this->__('Related Posts');
100
+ }
101
+
102
+ /**
103
+ * Determine whether the thumbnail is
104
+ *
105
+ * @return bool
106
+ */
107
+ public function isThumbnailView()
108
+ {
109
+ return $this->_getData('view') === 'thumbnails';
110
+ }
111
+
112
+ /**
113
+ * Retrieve the thumbnail image for a post
114
+ *
115
+ * @param Fishpig_Wordpress_Model_Post $post
116
+ * @return string
117
+ */
118
+ public function getThumbnailImage(Fishpig_Wordpress_Model_Post $post)
119
+ {
120
+ if (($image = $post->getFeaturedImage()) !== false) {
121
+ return $image->getAvailableImage();
122
+ }
123
+
124
+ return $this->_getData('thumbnails_default');
125
+ }
126
+
127
+ /**
128
+ * Determine whether to show a post excerpt
129
+ *
130
+ * @return bool
131
+ */
132
+ public function canShowExcerpt()
133
+ {
134
+ return $this->_getData('show_excerpt') == '1';
135
+ }
136
+
137
+ /**
138
+ * Retrieve the post excerpt
139
+ *
140
+ * @param Fishpig_Wordpress_Model_Post $post
141
+ * @return string
142
+ */
143
+ public function getPostExcerpt(Fishpig_Wordpress_Model_Post $post)
144
+ {
145
+ if ($excerpt = trim(strip_tags($post->getPostExcerpt()))) {
146
+ $words = explode(' ', $excerpt);
147
+
148
+ if (count($words) > $this->getExcerptLength()) {
149
+ $words = array_slice($words, 0, $this->getExcerptLength());
150
+ }
151
+
152
+ return trim(implode(' ', $words), '.,!:-?"\'£$%') . '...';
153
+ }
154
+
155
+ return '';
156
+ }
157
+
158
+ /**
159
+ * Retrieve the HTML content that goes before the related post block
160
+ *
161
+ * @return string
162
+ */
163
+ public function getBeforeBlockHtml()
164
+ {
165
+ return $this->_getData('before_related');
166
+ }
167
+
168
+ /**
169
+ * Retrieve the HTML content that goes after the related post block
170
+ *
171
+ * @return string
172
+ */
173
+ public function getAfterBlockHtml()
174
+ {
175
+ return $this->_getData('after_related');
176
+ }
177
+
178
+ /**
179
+ * Retrieve the HTML content that goes before a related entry
180
+ *
181
+ * @return string
182
+ */
183
+ public function getBeforeEntryHtml()
184
+ {
185
+ return $this->_getData('before_title');
186
+ }
187
+
188
+ /**
189
+ * Retrieve the HTML content that goes after a related entry
190
+ *
191
+ * @return string
192
+ */
193
+
194
+ public function getAfterEntryHtml()
195
+ {
196
+ return $this->_getData('after_title');
197
+ }
198
+
199
+ /**
200
+ * Retrieve the HTML content that goes before a post excerpt
201
+ *
202
+ * @return string
203
+ */
204
+ public function getBeforeExcerptHtml()
205
+ {
206
+ return $this->_getData('before_post');
207
+ }
208
+
209
+ /**
210
+ * Retrieve the HTML content that goes after a post excerpt
211
+ *
212
+ * @return string
213
+ */
214
+ public function getAfterExcerptHtml()
215
+ {
216
+ return $this->_getData('after_post');
217
+ }
218
+
219
+ /**
220
+ * Retrieve a collection of related posts
221
+ *
222
+ * @param Fishpig_Wordpress_Model_Post $post
223
+ * @return Fishpig_Wordpress_Model_Mysql4_Post_Collection
224
+ */
225
+ public function getRelatedPostCollection(Fishpig_Wordpress_Model_Post $post)
226
+ {
227
+ return Mage::getResourceModel('wordpress/post_collection')
228
+ ->addIsViewableFilter()
229
+ ->addFieldToFilter('ID', array('in' => $this->getRelatedPostIds($post)));
230
+ }
231
+
232
+ /**
233
+ * Retrieve an array of related post ID's
234
+ *
235
+ * @param Fishpig_Wordpress_Model_Post $post
236
+ * @return array|false
237
+ */
238
+ public function getRelatedPostIds(Fishpig_Wordpress_Model_Post $post)
239
+ {
240
+ if (!$this->isEnabled()) {
241
+ return array();
242
+ }
243
+
244
+ $helper = Mage::helper('wordpress/app');
245
+
246
+ $select = $helper->getDbConnection()
247
+ ->select()
248
+ ->from($helper->getTableName('yarpp_related_cache'), 'ID')
249
+ ->where('reference_ID=?', $post->getId())
250
+ ->where('score > ?', 0)
251
+ ->order($this->getOrder() ? $this->getOrder() : 'score DESC')
252
+ ->limit($this->getLimit() ? $this->getLimit() : 5);
253
+
254
+ try {
255
+ return $helper->getDbConnection()->fetchCol($select);
256
+ }
257
+ catch (Exception $e) {
258
+ Mage::helper('wordpress')->log($e->getMessage());
259
+ }
260
+
261
+ return array();
262
+ }
263
+ }
app/code/community/Fishpig/Wordpress/Addon/Yarpp/etc/config.xml ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Fishpig_Wordpress_Addon_Yarpp>
5
+ <version>1.0.1.0</version>
6
+ <fishpig>
7
+ <id>yarpp</id>
8
+ <name>YARPP</name>
9
+ <url />
10
+ <is_core>1</is_core>
11
+ </fishpig>
12
+ </Fishpig_Wordpress_Addon_Yarpp>
13
+ </modules>
14
+ <global>
15
+ <blocks>
16
+ <wp_addon_yarpp>
17
+ <class>Fishpig_Wordpress_Addon_Yarpp_Block</class>
18
+ </wp_addon_yarpp>
19
+ </blocks>
20
+ <helpers>
21
+ <wp_addon_yarpp>
22
+ <class>Fishpig_Wordpress_Addon_Yarpp_Helper</class>
23
+ </wp_addon_yarpp>
24
+ </helpers>
25
+ </global>
26
+ <wordpress>
27
+ <database>
28
+ <before_connect>
29
+ <tables>
30
+ <yarpp_related><table>yarpp_related_cache</table></yarpp_related>
31
+ <yarpp_keyword><table>yarpp_keyword_cache</table></yarpp_keyword>
32
+ </tables>
33
+ <tables_mu>
34
+ <yarpp_related><table>yarpp_related_cache</table></yarpp_related>
35
+ <yarpp_keyword><table>yarpp_keyword_cache</table></yarpp_keyword>
36
+ </tables_mu>
37
+ </before_connect>
38
+ </database>
39
+ <sidebar>
40
+ <widgets>
41
+ <yarpp_widget>
42
+ <block>wp_addon_yarpp/sidebar_widget</block>
43
+ <template>wordpress-addons/yarpp/sidebar/widget.phtml</template>
44
+ </yarpp_widget>
45
+ </widgets>
46
+ </sidebar>
47
+ </wordpress>
48
+ </config>
app/code/community/Fishpig/Wordpress/Block/Abstract.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @category Fishpig
4
+ * @package Fishpig_Wordpress
5
+ * @license http://fishpig.co.uk/license.txt
6
+ * @author Ben Tideswell <help@fishpig.co.uk>
7
+ */
8
+
9
+ abstract class Fishpig_Wordpress_Block_Abstract extends Mage_Core_Block_Template
10
+ {
11
+ /**
12
+ * Allows for legacy Magento
13
+ *
14
+ * @param string $data
15
+ * @param array $allowedTags = null
16
+ * @return string
17
+ */
18
+ public function escapeHtml($data, $allowedTags = null)
19
+ {
20
+ return Mage::helper('wordpress')->escapeHtml($data, $allowedTags);
21
+ }
22
+ }
app/code/community/Fishpig/Wordpress/Block/Adminhtml/Associations/Abstract.php ADDED
@@ -0,0 +1,399 @@