Changeset 1751950
- Timestamp:
- 10/24/2017 03:49:14 PM (8 years ago)
- Location:
- custom-availability-for-woocommerce
- Files:
-
- 2 added
- 4 edited
- 1 copied
-
tags/1.0.1 (copied) (copied from custom-availability-for-woocommerce/trunk)
-
tags/1.0.1/phpcs.xml (added)
-
tags/1.0.1/readme.md (modified) (1 diff)
-
tags/1.0.1/woocommerce-custom-availability.php (modified) (7 diffs)
-
trunk/phpcs.xml (added)
-
trunk/readme.md (modified) (1 diff)
-
trunk/woocommerce-custom-availability.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
custom-availability-for-woocommerce/tags/1.0.1/readme.md
r1453766 r1751950 1 1 # WooCommerce Custom Availability 2 [](https://packagist.org/packages/anttiviljami/woocommerce-custom-availability) [](https://packagist.org/packages/anttiviljami/woocommerce-custom-availability) [](https://packagist.org/packages/anttiviljami/woocommerce-custom-availability) [](https://packagist.org/packages/anttiviljami/woocommerce-custom-availability)2 [](https://travis-ci.org/anttiviljami/woocommerce-custom-availability) [](https://packagist.org/packages/anttiviljami/woocommerce-custom-availability) [](https://packagist.org/packages/anttiviljami/woocommerce-custom-availability) [](https://packagist.org/packages/anttiviljami/woocommerce-custom-availability) [](https://packagist.org/packages/anttiviljami/woocommerce-custom-availability) 3 3 4 4 Custom availability strings for products. -
custom-availability-for-woocommerce/tags/1.0.1/woocommerce-custom-availability.php
r1708037 r1751950 24 24 */ 25 25 26 if ( ! class_exists( 'WooCommerce_Custom_Availability') ) :26 if ( ! class_exists( 'WooCommerce_Custom_Availability' ) ) : 27 27 28 28 class WooCommerce_Custom_Availability { … … 60 60 */ 61 61 function load_our_textdomain() { 62 load_plugin_textdomain( 'woocommerce-custom-availability', false, dirname( plugin_basename( __FILE__) ) . '/lang/' );62 load_plugin_textdomain( 'woocommerce-custom-availability', false, dirname( plugin_basename( __FILE__ ) ) . '/lang/' ); 63 63 } 64 64 … … 76 76 'desc_tip' => 'true', 77 77 'description' => __( 'Override the default availability text.', 'woocommerce-custom-availability' ), 78 'value' => get_post_meta( $post->ID, '_custom_availability', true )78 'value' => get_post_meta( $post->ID, '_custom_availability', true ), 79 79 ) 80 80 ); … … 96 96 if ( ! isset( $_REQUEST['_custom_availability_simple'] ) || empty( $_REQUEST['_custom_availability_simple'] ) ) { 97 97 update_post_meta( $post->ID, '_custom_availability', '' ); 98 } 99 else { 98 } else { 100 99 update_post_meta( $post->ID, '_custom_availability', $_REQUEST['_custom_availability_simple'] ); 101 100 } … … 118 117 'desc_tip' => 'true', 119 118 'description' => __( 'Override the default availability text.', 'woocommerce-custom-availability' ), 120 'value' => get_post_meta( $variation->ID, '_custom_availability', true ) 119 'value' => get_post_meta( $variation->ID, '_custom_availability', true ), 121 120 ) 122 121 ); … … 129 128 */ 130 129 public function save_custom_availability_variation_field( $post_id ) { 131 if ( ! isset( $_REQUEST['_custom_availability'][ $post_id ] ) || empty( $_REQUEST['_custom_availability'][ $post_id ] ) ) {130 if ( ! isset( $_REQUEST['_custom_availability'][ $post_id ] ) || empty( $_REQUEST['_custom_availability'][ $post_id ] ) ) { 132 131 update_post_meta( $post_id, '_custom_availability', '' ); 133 132 } else { … … 142 141 * @param WC_Product $product 143 142 */ 144 public function custom_availability( $availability, $product ) {143 public function custom_availability( $availability, $product ) { 145 144 $product_id = isset( $product->variation_id ) ? $product->variation_id : $product->id; 146 $custom_availability = get_post_meta( $product_id, '_custom_availability', true );145 $custom_availability = get_post_meta( $product_id, '_custom_availability', true ); 147 146 148 if ( !empty( $custom_availability ) ) {147 if ( ! empty( $custom_availability ) ) { 149 148 $availability['class'] = 'custom-availability'; 150 149 $availability['availability'] = esc_attr( $custom_availability ); -
custom-availability-for-woocommerce/trunk/readme.md
r1453766 r1751950 1 1 # WooCommerce Custom Availability 2 [](https://packagist.org/packages/anttiviljami/woocommerce-custom-availability) [](https://packagist.org/packages/anttiviljami/woocommerce-custom-availability) [](https://packagist.org/packages/anttiviljami/woocommerce-custom-availability) [](https://packagist.org/packages/anttiviljami/woocommerce-custom-availability)2 [](https://travis-ci.org/anttiviljami/woocommerce-custom-availability) [](https://packagist.org/packages/anttiviljami/woocommerce-custom-availability) [](https://packagist.org/packages/anttiviljami/woocommerce-custom-availability) [](https://packagist.org/packages/anttiviljami/woocommerce-custom-availability) [](https://packagist.org/packages/anttiviljami/woocommerce-custom-availability) 3 3 4 4 Custom availability strings for products. -
custom-availability-for-woocommerce/trunk/woocommerce-custom-availability.php
r1708037 r1751950 24 24 */ 25 25 26 if ( ! class_exists( 'WooCommerce_Custom_Availability') ) :26 if ( ! class_exists( 'WooCommerce_Custom_Availability' ) ) : 27 27 28 28 class WooCommerce_Custom_Availability { … … 60 60 */ 61 61 function load_our_textdomain() { 62 load_plugin_textdomain( 'woocommerce-custom-availability', false, dirname( plugin_basename( __FILE__) ) . '/lang/' );62 load_plugin_textdomain( 'woocommerce-custom-availability', false, dirname( plugin_basename( __FILE__ ) ) . '/lang/' ); 63 63 } 64 64 … … 76 76 'desc_tip' => 'true', 77 77 'description' => __( 'Override the default availability text.', 'woocommerce-custom-availability' ), 78 'value' => get_post_meta( $post->ID, '_custom_availability', true )78 'value' => get_post_meta( $post->ID, '_custom_availability', true ), 79 79 ) 80 80 ); … … 96 96 if ( ! isset( $_REQUEST['_custom_availability_simple'] ) || empty( $_REQUEST['_custom_availability_simple'] ) ) { 97 97 update_post_meta( $post->ID, '_custom_availability', '' ); 98 } 99 else { 98 } else { 100 99 update_post_meta( $post->ID, '_custom_availability', $_REQUEST['_custom_availability_simple'] ); 101 100 } … … 118 117 'desc_tip' => 'true', 119 118 'description' => __( 'Override the default availability text.', 'woocommerce-custom-availability' ), 120 'value' => get_post_meta( $variation->ID, '_custom_availability', true ) 119 'value' => get_post_meta( $variation->ID, '_custom_availability', true ), 121 120 ) 122 121 ); … … 129 128 */ 130 129 public function save_custom_availability_variation_field( $post_id ) { 131 if ( ! isset( $_REQUEST['_custom_availability'][ $post_id ] ) || empty( $_REQUEST['_custom_availability'][ $post_id ] ) ) {130 if ( ! isset( $_REQUEST['_custom_availability'][ $post_id ] ) || empty( $_REQUEST['_custom_availability'][ $post_id ] ) ) { 132 131 update_post_meta( $post_id, '_custom_availability', '' ); 133 132 } else { … … 142 141 * @param WC_Product $product 143 142 */ 144 public function custom_availability( $availability, $product ) {143 public function custom_availability( $availability, $product ) { 145 144 $product_id = isset( $product->variation_id ) ? $product->variation_id : $product->id; 146 $custom_availability = get_post_meta( $product_id, '_custom_availability', true );145 $custom_availability = get_post_meta( $product_id, '_custom_availability', true ); 147 146 148 if ( !empty( $custom_availability ) ) {147 if ( ! empty( $custom_availability ) ) { 149 148 $availability['class'] = 'custom-availability'; 150 149 $availability['availability'] = esc_attr( $custom_availability );
Note: See TracChangeset
for help on using the changeset viewer.