Changeset 636253
- Timestamp:
- 12/09/2012 07:33:52 PM (13 years ago)
- Location:
- shopp-seo-glue
- Files:
-
- 1 added
- 1 edited
- 4 moved
-
tags/1.4 (added)
-
tags/1.4/assets (moved) (moved from shopp-seo-glue/tags/1.3/assets)
-
tags/1.4/license.txt (moved) (moved from shopp-seo-glue/tags/1.3/license.txt)
-
tags/1.4/readme.txt (moved) (moved from shopp-seo-glue/tags/1.3/readme.txt) (4 diffs)
-
tags/1.4/shoppseoglue.php (moved) (moved from shopp-seo-glue/tags/1.3/shoppseoglue.php) (18 diffs)
-
trunk/readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
shopp-seo-glue/tags/1.4/readme.txt
r625773 r636253 5 5 Requires at least: 3.4.1 6 6 Tested up to: 3.4.2 7 Stable tag: 1. 37 Stable tag: 1.4 8 8 License: GPL3 or later 9 9 License URI: http://www.gnu.org/licenses/gpl.html … … 21 21 22 22 * WordPress 3.4.2 23 * Shopp 1.2. 3 (right now I also *expect* it to work on the planned 1.2.4 and 1.3 future releases)24 * WordPress SEO 1. 2.8.723 * Shopp 1.2.5 24 * WordPress SEO 1.3.1.1 25 25 26 No other configurations have been tested and this plugin will not work (and anyway should not be required) if you are using the old 1.1 branch27 of Shopp.26 No other configurations have been tested and this plugin will not work (and anyway should not be required) if you are using 27 the old 1.1 branch of Shopp. 28 28 29 This plugin was written by [Barry Hughes](http://freshlybakedwebsites.net/ "WordPress developer and designer, Vancouver Island") ... if you want to support this plugin or are in need of some positive karma then feel free to [buy Barry a beer](http://freshlybakedwebsites.net/say-thanks-with-a-beer/) - contributions also by [Lars Koudal](http://cleverwp.com/). 29 This plugin was written by [Barry Hughes](http://freshlybakedwebsites.net/ "WordPress developer and designer, Vancouver Island") 30 ... if you want to support this plugin or are in need of some positive karma then feel free to 31 [buy Barry a beer](http://freshlybakedwebsites.net/say-thanks-with-a-beer/) - contributions also by 32 [Lars Koudal](http://cleverwp.com/). 30 33 31 34 == Installation == … … 33 36 It's just like any other plugin! 34 37 35 Either upload the zipped plugin archive using the Add New Plugin screen in WordPress, or unzip and upload the _shoppseoglue_ directory so that36 it resides within your wp-content/plugins directory ... then activate!38 Either upload the zipped plugin archive using the Add New Plugin screen in WordPress, or unzip and upload the _shoppseoglue_ directory 39 so that it resides within your wp-content/plugins directory ... then activate! 37 40 38 This plugin does not generate any new admin screens or anything else - it simply mediates between Shopp and WordPress SEO - both of which must of39 course be installed and activated first of all. Otherwise Shopp SEO Glue will sit and do nothing at all.41 This plugin does not generate any new admin screens or anything else - it simply mediates between Shopp and WordPress SEO - both of 42 which must of course be installed and activated first of all. Otherwise Shopp SEO Glue will sit and do nothing at all. 40 43 41 44 == Frequently Asked Questions == 42 45 43 = Why can't I customize product categories? =46 = Why do I need this? = 44 47 45 You can! This has been available as of version 1.2. 48 Shopp uses custom post types and custom taxonomies, it's true, but it does not use the standard WordPress-generated post and 49 taxonomy editors. For that reason, WordPress SEO has a hard time integrating with Shopp. 46 50 47 = The snippet preview URL is wrong! = 48 49 This was a known issue that has been addressed in Shopp SEO Glue 1.1. So if you were one of the first people to test out Shopp SEO Glue then please 50 ensure you have updated to the latest stable version and try again. If it is still a problem then you may simply *need to save your product* to 51 refresh the Snippet Preview. 51 This plugin aims to solve that problem by doing the legwork needed to make these plugins play nicely with one another. 52 52 53 53 = How about All in One SEO Pack? = 54 54 55 55 To the best of my knowledge All in One SEO Pack works with Shopp 1.2 without any problems. Consequently, this plugin does not integrate with 56 AIOSEOP in any way whatsoever (there's no need !).56 AIOSEOP in any way whatsoever (there's no need). 57 57 58 58 = Is this actively maintained ... what's next on the roadmap? = 59 59 60 It's not really actively maintained insofar as the plugin author rarely uses it - that said, any solid contributions are gratefully received and may be incorporated for the benefit of those who still use it. If you desperately need some new feature then you could also consider sponsoring a solution. 61 62 With all that said, adding further controls to offer up WPSEO style functionality for Shopp's virtual pages (those which aren't "housed" in a regular page, post or custom post type - the checkout, storefront homepage etc are all examples of this) is one possible avenue we could follow, dependent on interest. 60 Don't depend upon it! That said, I'm happy to add in new features and make minor changes if they are supported by a solid argument and, 61 even better, if even a little bit of the code to make it happen is contributed. 63 62 64 63 == Screenshots == … … 71 70 == Changelog == 72 71 73 = 1.0 = 74 * Initial commit (targeting WP 3.4.1, Shopp 1.2.3, WPSEO 1.2.5) 72 = 1.4 = 73 * Cleans up more effectively after modifying WP Query (necessary to cause category meta descriptions to be output) - should 74 improve compatibilty across themes 75 * Shopp-generated description is now removed from category pages 76 (thanks: [dencreativeltd](http://wordpress.org/support/profile/dencreativeltd)) 77 so only the WPSEO description tag will be output by default 78 * Tested with WP 3.4.2, Shopp 1.2.5 and WPSEO 1.3.1.1 79 80 = 1.3 = 81 * Changes to improve compatibility with other plugins including Advanced Custom Fields 82 (thanks to [Lars](http://profiles.wordpress.org/lkoudal)) 83 * Tested with WP 3.4.2, Shopp 1.2.3 and WPSEO 1.2.8.7 - also tested concurrently with ACF 3.5.0 84 85 = 1.2 = 86 * Added product category support 75 87 76 88 = 1.1 = 77 89 * Fix put in place to address issue with the Snippet Preview URL 78 90 79 = 1.2 = 80 * Added product category support 81 82 = 1.3 = 83 * Changes to improve compatibility with other plugins including Advanced Custom Fields (thanks to [Lars](http://profiles.wordpress.org/lkoudal)) 84 * Tested with WP 3.4.2, Shopp 1.2.3 and WPSEO 1.2.8.7 - also tested concurrently with ACF 3.5.0 91 = 1.0 = 92 * Initial commit (targeting WP 3.4.1, Shopp 1.2.3, WPSEO 1.2.5) 85 93 86 94 == Upgrade Notice == -
shopp-seo-glue/tags/1.4/shoppseoglue.php
r625773 r636253 4 4 Plugin URI: http://freshlybakedwebsites.net/wordpress/shopp/wordpress-seo-compatibility/ 5 5 Description: Aims to reconcile the popular Shopp and WordPress SEO plugins so that Shopp products can benefit from WordPress SEO's feature set. Currently experimental, this plugin was built against Shopp 1.2.3 and WordPress SEO 1.2.8.7: it may not work with earlier or later versions of either plugin. 6 Version: 1. 36 Version: 1.4 7 7 Author: Barry Hughes 8 8 Author URI: http://freshlybakedwebsites.net/ … … 28 28 29 29 30 /** 31 * Facilitates integration of Shopp and WordPress SEO. 32 */ 30 33 class ShoppSEOGlueLayer { 31 public $wpseoMetabox; 34 /** 35 * Holds a reference to the WordPress SEO metabox object or is (bool) false 36 * if it has not been loaded. 37 * 38 * @var mixed 39 */ 40 public $wpseoMetabox = false; 41 42 /** 43 * Holds a reference to the WordPress SEO taxonomy object or is (bool) false 44 * if it has not been loaded. 45 * 46 * @var mixed 47 */ 32 48 public $wpseoTaxonomy; 33 49 34 50 /** 51 * Contains the original values for any WP Query properties that might be 52 * modified, so they can be restored again at a later point in the request. 53 * 54 * @var array 55 */ 56 protected $queryBackup = array(); 57 58 59 /** 60 * Safely creates a new ShoppSEOGlueLayer object (having first checked that 61 * Shopp and WPSEO are active. 62 */ 35 63 public static function init() { 36 64 if (defined('SHOPP_VERSION') and defined('WPSEO_VERSION')) … … 39 67 40 68 69 /** 70 * Glues Shopp and WordPress SEO together. Handled in 3 steps: 71 * 72 * - The WPSEO metaboxes are glued to the Shopp product editor 73 * - The same is done for the Shopp category editor 74 * - We make it so Shopp category pagesa are detectable by WPSEO 75 * 76 * @return ShoppSEOGlueLayer 77 */ 41 78 public function __construct() { 42 79 $this->glueProductEditor(); … … 46 83 47 84 85 /** 86 * If the Shopp product editor has been requested then pull in the WPSEO 87 * metaboxes and repair the URL preview feature. 88 */ 48 89 protected function glueProductEditor() { 49 90 if ($this->onShoppEditorPage('products')) { … … 55 96 56 97 98 /** 99 * If this is the Shopp category editor then pull in the WPSEO metaboxes 100 * (not the same as those used in the product editor/on posts generally). 101 */ 57 102 protected function glueCategoryEditor() { 58 103 if ($this->onShoppEditorPage('categories')) { … … 63 108 64 109 110 /** 111 * Detects if we are on the specified type of Shopp editor page (possible 112 * values for $slug could be "products" or "categories"). 113 * 114 * @param string $slug 115 * @return bool 116 */ 65 117 protected function onShoppEditorPage($slug) { 66 118 return ($this->pageAndIDQuerySet() and … … 69 121 70 122 123 /** 124 * Checks if the URL query contains "id" and "page" keys; this is intended 125 * as an additional check before making any changes within the editor 126 * environment. 127 * 128 * @return bool 129 */ 71 130 protected function pageAndIDQuerySet() { 72 131 return (array_key_exists('id', $_GET) and … … 75 134 76 135 136 /** 137 * Loads the WPSEO code responsible for generating the post editor metabox 138 * and ensures any scripts/styles it depends upon are enqueued. 139 */ 77 140 public function pullInWPSEOMetabox() { 78 141 $this->loadSEOMetaboxClass(); … … 82 145 83 146 147 /** 148 * Tries to load the WPSEO metabox code and sets the $this->wpseoMetabox 149 * flag if successful. 150 */ 84 151 public function loadSEOMetaboxClass() { 85 152 if (defined('WPSEO_PATH') and class_exists('WPSEO_Metabox') === false) { … … 91 158 92 159 160 /** 161 * Forces WPSEO to set up the scrips/styles it needs, and also hooks in a 162 * handler for when posts (products in this case) are saved. 163 */ 93 164 public function reattachWPSEOBehaviours() { 94 165 add_action('admin_print_styles', … … 100 171 101 172 173 /** 174 * Expects to be called when shopp_product_saved fires: ensures the WPSEO 175 * saves any data from its metabox along with any other changes that may 176 * have been made to the product. 177 */ 102 178 public function wpseoSavePostData() { 103 179 global $post_id; … … 110 186 111 187 188 /** 189 * The JS code that powers the neat URL preview will not work by itself in 190 * the Shopp product editor, so we'll replace it with a modified version 191 * that does work. 192 */ 112 193 protected function repairURLPreview() { 113 194 add_action('admin_print_footer_scripts', … … 117 198 118 199 200 /** 201 * Injects the replacement WPSEO URL preview code. 202 */ 119 203 public function insertURLPreviewScript() { 120 204 echo '<script type="text/javascript">'; … … 124 208 125 209 210 /** 211 * Tries to load the WPSEO taxomonomy code and sets $this->wpseoTaxonomy 212 * appropriately. 213 * 214 * @return bool 215 */ 126 216 public function loadSEOTaxonomyClass() { 127 217 if (defined('WPSEO_PATH') and class_exists('WPSEO_Metabox') === false) { … … 135 225 136 226 227 /** 228 * Adds the category metabox from WPSEO to the Shopp category editor. 229 * Positioning can be tweaked if necessary by filtering: 230 * 231 * - shoppseoglue_catmb_context 232 * - shoppseoglue_catmb_priority 233 * 234 * Which correspond to the context and priority params normally used when 235 * working with metaboxes. 236 */ 137 237 public function categoryMetabox() { 138 238 $context = apply_filters('shoppseoglue_catmb_context', 'advanced'); … … 146 246 147 247 248 /** 249 * Actually causes the WPSEO category metaboxes to be rendered. A Shopp 250 * category object is expected to be passed in here and will be used to 251 * get term data for WPSEO to use. 252 * 253 * @param $category 254 */ 148 255 public function drawCategoryMetabox($category) { 149 256 $term = get_term($category->term_taxonomy_id, ProductCategory::$taxon); … … 152 259 153 260 261 /** 262 * WPSEO does not know when Shopp category pages are being viewed so we need 263 * to listen out for them. 264 */ 154 265 protected function glueShoppCategories() { 155 266 if (is_admin() === false) … … 158 269 159 270 271 /** 272 * If the request is for a Shopp taxonomy page then lets alter some of the 273 * WP Query flags to "trick" WPSEO into doing it's thing. 274 * 275 * On the basis that if we are using WPSEO for category descriptions we have 276 * no need for Shopp's own descriptions we will also remove the default 277 * Shopp generated description tag ... this behaviour may not always be 278 * desirable however and so can be turned off by filtering: 279 * 280 * - shoppseoglue_remove_default_description 281 * 282 * And setting it to false. 283 */ 160 284 public function waitForCategories() { 161 285 if (is_shopp_taxonomy()) $this->modifyQueryFlags(); 162 } 163 164 286 if (apply_filters('shoppseoglue_remove_default_description', true)) 287 add_filter('shopp_meta_description', array($this, 'removeDefaultDescription')); 288 } 289 290 291 /** 292 * Changes a number of WP Query flags to make it clear to WPSEO that this is 293 * a category page and it should work its magic. 294 */ 165 295 protected function modifyQueryFlags() { 296 $this->safelyModifyQuery(array( 297 'is_archive' => true, 298 'is_category' => true, 299 'is_singular' => false )); 300 } 301 302 303 /** 304 * Takes an array of key:value pairs and changes the matching WP Query 305 * properties. A record of the original values is retained in order to 306 * restore them at a later point in the request. 307 * 308 * @param array $propertyValuesMap 309 */ 310 protected function safelyModifyQuery(array $propertyValuesMap) { 166 311 global $wp_query; 167 $wp_query->is_archive = true; 168 $wp_query->is_category = true; 169 $wp_query->is_singular = false; 312 313 foreach ($propertyValuesMap as $property => $value) 314 if (property_exists($wp_query, $property)) { 315 $this->queryBackup[$property] = $wp_query->$property; 316 $wp_query->$property = $value; 317 } 318 319 if (count($this->queryBackup) > 0) 320 add_action('wp_head', array($this, 'restoreQueryProperties'), 11); 321 } 322 323 324 /** 325 * Restores the original values of any WP Query properties which were 326 * altered by Shopp SEO Glue earlier in the request. 327 */ 328 protected function restoreQueryProperties() { 329 global $wp_query; 330 331 foreach ($this->queryBackup as $property => $value) 332 $wp_query->$property = $value; 333 } 334 335 336 /** 337 * Filter for shopp_meta_description: returns an empty string which should 338 * stop Shopp from generating its default description meta tag. 339 * 340 * Props to dencreativeltd on wordpress.org/support for suggesting this. 341 */ 342 public function removeDefaultDescription() { 343 return ''; 170 344 } 171 345 } 172 346 173 347 348 // Let the glueing commence 174 349 add_action('plugins_loaded', array('ShoppSEOGlueLayer', 'init'), 80); -
shopp-seo-glue/trunk/readme.txt
r621263 r636253 5 5 Requires at least: 3.4.1 6 6 Tested up to: 3.4.1 7 Stable tag: 1. 37 Stable tag: 1.4 8 8 License: GPL3 or later 9 9 License URI: http://www.gnu.org/licenses/gpl.html
Note: See TracChangeset
for help on using the changeset viewer.