Changeset 1812372
- Timestamp:
- 01/31/2018 03:58:58 AM (8 years ago)
- Location:
- wysiwyg-custom-products
- Files:
-
- 8 edited
-
tags/1.1/common/utilities.php (modified) (3 diffs)
-
tags/1.1/frontend/class-frontend.php (modified) (5 diffs)
-
tags/1.1/readme.txt (modified) (3 diffs)
-
tags/1.1/wysiwyg-custom-products.php (modified) (7 diffs)
-
trunk/common/utilities.php (modified) (3 diffs)
-
trunk/frontend/class-frontend.php (modified) (5 diffs)
-
trunk/readme.txt (modified) (3 diffs)
-
trunk/wysiwyg-custom-products.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wysiwyg-custom-products/tags/1.1/common/utilities.php
r1677949 r1812372 7 7 * 8 8 * @since 1.0.0 9 * @updated 1.1.3 9 10 */ 10 11 … … 51 52 * 52 53 * @since 1.0.0 54 * @updated 1.1.3 53 55 */ 54 56 function maybe_get( $array, $field, $default = false, $trim = true ) { … … 64 66 if ( is_string( $result ) && $trim ) { 65 67 return trim( $result ); 66 } else {67 return $result;68 68 } 69 70 return $result; 69 71 } 70 72 -
wysiwyg-custom-products/tags/1.1/frontend/class-frontend.php
r1677949 r1812372 19 19 * 20 20 * @since 1.0.0 21 * @updated 1.1. 221 * @updated 1.1.3 22 22 */ 23 23 class Frontend { 24 24 25 const HANDLED_SIZES = 'shop_single;shop_catalog;'; 25 const SINGLE_SIZES = 'shop_single;woocommerce_single;'; 26 27 const CATALOG_SIZES = 'shop_catalog;woocommerce_thumbnail;'; 26 28 27 29 /** … … 72 74 * 73 75 * @since 1.0.0 74 * @updated 1.1. 076 * @updated 1.1.3 75 77 */ 76 78 public function product_thumbnail( … … 82 84 ) { 83 85 84 if ( false === stripos( self::HANDLED_SIZES, $size . ';' ) ) { 86 if ( (false === stripos( self::SINGLE_SIZES, $size . ';' )) 87 && (false === stripos( self::CATALOG_SIZES, $size . ';' ))) { 85 88 return $html; 86 89 } … … 121 124 '1.1.0' ); // for catalog images, whether on product page or in catalog 122 125 123 if ( 'shop_single' === $size) {126 if ( false !== stripos( self::SINGLE_SIZES, $size . ';' )) { 124 127 /* Add live update javascript */ 125 128 register_script( 'attrchange', [ 'jquery' ], '1.0' ); … … 131 134 132 135 return apply_filters( 'frontend_shop_single', $newHtml, $post_id, $post_thumbnail_id, $size, $attr ); 133 } elseif ( 'shop_catalog' === $size ) { 136 } 137 138 if ( false !== stripos( self::CATALOG_SIZES, $size . ';' ) ) { 134 139 $newHtml = $this->product_shop_catalog( $html, $post_id ); 135 140 136 141 return apply_filters( 'frontend_shop_catalog', $newHtml, $post_id, $post_thumbnail_id, $size, $attr ); 137 } else {138 return $html; 139 }142 } 143 144 return $html; 140 145 } 141 146 -
wysiwyg-custom-products/tags/1.1/readme.txt
r1771891 r1812372 4 4 Tags: WYSIWYG, wysiwyg, custom, customised, customized, preview, live, update, view, woocommerce 5 5 Requires at least: 4.5.4 6 Tested up to: 4.9. 06 Tested up to: 4.9.2 7 7 Stable tag: 1.1 8 8 License: GPLv3 or later … … 123 123 * Premium - Select/Dropdown fields can now have option list overridden on a per product basis 124 124 125 = 1.1.3 = 126 * Added workaround for changes in woocommerce core functions and image size names. 127 125 128 == Upgrade Notice == 126 Layout data can now be saved when uninstalling to allow for easier upgrade.129 Fixed for WooCommerce 3.3.0 changes. 127 130 128 131 == Creating Layouts - Instructions == … … 160 163 apply_filters( 'wcp_frontend_shop_single', string $html, int $post_id, string $post_thumbnail_id, string|array $size, string $attr ) 161 164 apply_filters( 'wcp_frontend_shop_catalog', string $html, int $post_id, string $post_thumbnail_id, string|array $size, string $attr ) 162 These filter the generated product page and catalog images respectively. They hook into filter 'post_thumbnail_html'.165 These filter the generated product page and catalog/thumbnail images respectively. They hook into filter 'post_thumbnail_html'. 163 166 164 167 ###Source: common/class-layout.php### -
wysiwyg-custom-products/tags/1.1/wysiwyg-custom-products.php
r1677949 r1812372 4 4 * Plugin URI: https://tazziedave.com/wp-plugins/wysiwyg-custom-products 5 5 * Description: Enables a live WYSIWYG preview of custom products where text is edited in text area or text field in woo commerce. 6 * Version: 1.1. 26 * Version: 1.1.3 7 7 * Author: Tazziedave 8 8 * Author URI: https://tazziedave.com … … 62 62 * 63 63 * @since 1.0.0 64 * @updated 1. 0.764 * @updated 1.1.3 65 65 */ 66 66 class Wcp_Plugin { … … 74 74 * Plug in version 75 75 */ 76 const VER = '1.1. 2';76 const VER = '1.1.3'; 77 77 /** 78 78 * Database version. Used in class-plugin to run updates as necessary … … 147 147 * 148 148 * @since 1.0.0 149 * @updated 1.1.3 149 150 */ 150 151 public function __construct( $locale = null ) { … … 162 163 // Add callback for WP to get our locale 163 164 add_filter( 'plugin_locale', [ $this, 'get_plugin_locale_callback' ], $priority = 10, $accepted_args = 2 ); 165 add_filter( 'woocommerce_get_image_size_shop_single', [ $this, 'woocommerce_get_image_size' ], $priority = 166 10, $accepted_args = 1 ); 167 add_filter( 'woocommerce_get_image_size_shop_catalog', [ $this, 'woocommerce_get_image_size' ], $priority = 168 10, $accepted_args = 1 ); 169 add_filter( 'woocommerce_get_image_size_single', [ $this, 'woocommerce_get_image_size' ], $priority = 170 10, $accepted_args = 1 ); 171 add_filter( 'woocommerce_get_image_size_thumbnail', [ $this, 'woocommerce_get_image_size' ], $priority = 172 10, $accepted_args = 1 ); 164 173 165 174 // translators: Name of plugin - free version … … 310 319 $layout->save_defaults(); 311 320 $settings = get_option( 'settings', [] ); 312 if ( count( $settings ) === 0 ) {321 if ( \count( $settings ) === 0 ) { 313 322 $settings['CurrentLayout'] = $layout->getName(); 314 323 add_option( 'settings', $settings, false ); … … 344 353 return $locale; 345 354 } 355 356 /** 357 * Called when WooCommerce is processing wc_get_image_size 358 * Added to make height value sensible again after 3.3.0 update. 359 * 360 * @param array $size 361 * 362 * @return array 363 * 364 * @since 1.1.3 365 */ 366 public function woocommerce_get_image_size(array $size): array { 367 368 if ( \is_array($size) && (9999999999 === $size['height'])) { 369 $size['height'] = $size['width']; 370 } 371 372 return $size; 373 } 346 374 } 347 375 348 376 $wysiwygCP = new Wcp_Plugin(); 349 377 350 if ( ! defined( 'WP_UNINSTALL_PLUGIN ' ) ) { // Check to see if being instantiated for uninstall purposes378 if ( ! \defined( 'WP_UNINSTALL_PLUGIN ' ) ) { // Check to see if being instantiated for uninstall purposes 351 379 if ( is_admin() ) { 352 380 $wysiwygCP->admin(); -
wysiwyg-custom-products/trunk/common/utilities.php
r1677949 r1812372 7 7 * 8 8 * @since 1.0.0 9 * @updated 1.1.3 9 10 */ 10 11 … … 51 52 * 52 53 * @since 1.0.0 54 * @updated 1.1.3 53 55 */ 54 56 function maybe_get( $array, $field, $default = false, $trim = true ) { … … 64 66 if ( is_string( $result ) && $trim ) { 65 67 return trim( $result ); 66 } else {67 return $result;68 68 } 69 70 return $result; 69 71 } 70 72 -
wysiwyg-custom-products/trunk/frontend/class-frontend.php
r1677949 r1812372 19 19 * 20 20 * @since 1.0.0 21 * @updated 1.1. 221 * @updated 1.1.3 22 22 */ 23 23 class Frontend { 24 24 25 const HANDLED_SIZES = 'shop_single;shop_catalog;'; 25 const SINGLE_SIZES = 'shop_single;woocommerce_single;'; 26 27 const CATALOG_SIZES = 'shop_catalog;woocommerce_thumbnail;'; 26 28 27 29 /** … … 72 74 * 73 75 * @since 1.0.0 74 * @updated 1.1. 276 * @updated 1.1.3 75 77 */ 76 78 public function product_thumbnail( … … 82 84 ) { 83 85 84 if ( false === stripos( self::HANDLED_SIZES, $size . ';' ) ) { 86 if ( (false === stripos( self::SINGLE_SIZES, $size . ';' )) 87 && (false === stripos( self::CATALOG_SIZES, $size . ';' ))) { 85 88 return $html; 86 89 } … … 121 124 '1.1.0' ); // for catalog images, whether on product page or in catalog 122 125 123 if ( 'shop_single' === $size) {126 if ( false !== stripos( self::SINGLE_SIZES, $size . ';' )) { 124 127 /* Add live update javascript */ 125 128 register_script( 'attrchange', [ 'jquery' ], '1.0' ); … … 133 136 } 134 137 135 if ( 'shop_catalog' === $size) {138 if ( false !== stripos( self::CATALOG_SIZES, $size . ';' ) ) { 136 139 $newHtml = $this->product_shop_catalog( $html, $post_id ); 137 140 -
wysiwyg-custom-products/trunk/readme.txt
r1771891 r1812372 4 4 Tags: WYSIWYG, wysiwyg, custom, customised, customized, preview, live, update, view, woocommerce 5 5 Requires at least: 4.5.4 6 Tested up to: 4.9. 06 Tested up to: 4.9.2 7 7 Stable tag: 1.1 8 8 License: GPLv3 or later … … 123 123 * Premium - Select/Dropdown fields can now have option list overridden on a per product basis 124 124 125 = 1.1.3 = 126 * Added workaround for changes in woocommerce core functions and image size names. 127 125 128 == Upgrade Notice == 126 Layout data can now be saved when uninstalling to allow for easier upgrade.129 Fixed for WooCommerce 3.3.0 changes. 127 130 128 131 == Creating Layouts - Instructions == … … 160 163 apply_filters( 'wcp_frontend_shop_single', string $html, int $post_id, string $post_thumbnail_id, string|array $size, string $attr ) 161 164 apply_filters( 'wcp_frontend_shop_catalog', string $html, int $post_id, string $post_thumbnail_id, string|array $size, string $attr ) 162 These filter the generated product page and catalog images respectively. They hook into filter 'post_thumbnail_html'.165 These filter the generated product page and catalog/thumbnail images respectively. They hook into filter 'post_thumbnail_html'. 163 166 164 167 ###Source: common/class-layout.php### -
wysiwyg-custom-products/trunk/wysiwyg-custom-products.php
r1677949 r1812372 4 4 * Plugin URI: https://tazziedave.com/wp-plugins/wysiwyg-custom-products 5 5 * Description: Enables a live WYSIWYG preview of custom products where text is edited in text area or text field in woo commerce. 6 * Version: 1.1. 26 * Version: 1.1.3 7 7 * Author: Tazziedave 8 8 * Author URI: https://tazziedave.com … … 62 62 * 63 63 * @since 1.0.0 64 * @updated 1. 0.764 * @updated 1.1.3 65 65 */ 66 66 class Wcp_Plugin { … … 74 74 * Plug in version 75 75 */ 76 const VER = '1.1. 2';76 const VER = '1.1.3'; 77 77 /** 78 78 * Database version. Used in class-plugin to run updates as necessary … … 147 147 * 148 148 * @since 1.0.0 149 * @updated 1.1.3 149 150 */ 150 151 public function __construct( $locale = null ) { … … 162 163 // Add callback for WP to get our locale 163 164 add_filter( 'plugin_locale', [ $this, 'get_plugin_locale_callback' ], $priority = 10, $accepted_args = 2 ); 165 add_filter( 'woocommerce_get_image_size_shop_single', [ $this, 'woocommerce_get_image_size' ], $priority = 166 10, $accepted_args = 1 ); 167 add_filter( 'woocommerce_get_image_size_shop_catalog', [ $this, 'woocommerce_get_image_size' ], $priority = 168 10, $accepted_args = 1 ); 169 add_filter( 'woocommerce_get_image_size_single', [ $this, 'woocommerce_get_image_size' ], $priority = 170 10, $accepted_args = 1 ); 171 add_filter( 'woocommerce_get_image_size_thumbnail', [ $this, 'woocommerce_get_image_size' ], $priority = 172 10, $accepted_args = 1 ); 164 173 165 174 // translators: Name of plugin - free version … … 310 319 $layout->save_defaults(); 311 320 $settings = get_option( 'settings', [] ); 312 if ( count( $settings ) === 0 ) {321 if ( \count( $settings ) === 0 ) { 313 322 $settings['CurrentLayout'] = $layout->getName(); 314 323 add_option( 'settings', $settings, false ); … … 344 353 return $locale; 345 354 } 355 356 /** 357 * Called when WooCommerce is processing wc_get_image_size 358 * Added to make height value sensible again after 3.3.0 update. 359 * 360 * @param array $size 361 * 362 * @return array 363 * 364 * @since 1.1.3 365 */ 366 public function woocommerce_get_image_size(array $size): array { 367 368 if ( \is_array($size) && (9999999999 === $size['height'])) { 369 $size['height'] = $size['width']; 370 } 371 372 return $size; 373 } 346 374 } 347 375 348 376 $wysiwygCP = new Wcp_Plugin(); 349 377 350 if ( ! defined( 'WP_UNINSTALL_PLUGIN ' ) ) { // Check to see if being instantiated for uninstall purposes378 if ( ! \defined( 'WP_UNINSTALL_PLUGIN ' ) ) { // Check to see if being instantiated for uninstall purposes 351 379 if ( is_admin() ) { 352 380 $wysiwygCP->admin();
Note: See TracChangeset
for help on using the changeset viewer.