Plugin Directory

Changeset 1751992


Ignore:
Timestamp:
10/24/2017 05:13:51 PM (8 years ago)
Author:
Zuige
Message:

Release v1.1.0

Location:
custom-availability-for-woocommerce
Files:
8 added
4 edited
1 copied

Legend:

Unmodified
Added
Removed
  • custom-availability-for-woocommerce/tags/1.0.1/readme.txt

    r1751984 r1751992  
    55Requires at least: 4.3.1
    66Tested up to: 4.7.1
    7 Stable tag: 1.0.1
     7Stable tag: 1.1.0
    88License: GPLv3
    99License URI: http://www.gnu.org/licenses/gpl-3.0.html
  • custom-availability-for-woocommerce/tags/1.0.1/woocommerce-custom-availability.php

    r1751984 r1751992  
    44 * Plugin URI: https://github.com/anttiviljami/woocommerce-custom-availability
    55 * Description: Set custom availability for products
    6  * Version: 1.0.1
     6 * Version: 1.1.0
    77 * Author: @anttiviljami
    88 * Author: https://github.com/anttiviljami
    99 * License: GPLv3
    1010 * Text Domain: woocommerce-custom-availability
     11 * Tested up to: 4.8
    1112 */
    1213
     
    2425*/
    2526
     27
     28if ( ! defined( 'ABSPATH' ) ) {
     29  exit; // Exit if accessed directly.
     30}
     31
    2632if ( ! class_exists( 'WooCommerce_Custom_Availability' ) ) :
    2733
     
    3743
    3844  private function __construct() {
     45
     46    $this->includes();
     47
    3948    // load textdomain for translations
    4049    add_action( 'plugins_loaded',  array( $this, 'load_our_textdomain' ) );
     
    5463    // use custom availability in the frontend
    5564    add_filter( 'woocommerce_get_availability', array( $this, 'custom_availability' ), 10, 2 );
     65  }
     66
     67  /**
     68   * Include required core files used in admin
     69   */
     70  public function includes() {
     71    require_once plugin_dir_path( __FILE__ ) . 'includes/class-woocommerce-custom-availability-list-table.php';
     72    require_once plugin_dir_path( __FILE__ ) . 'includes/class-woocommerce-custom-availability-page.php';
    5673  }
    5774
     
    98115    }
    99116
    100     if ( ! isset( $_REQUEST['_custom_availability_simple'] ) || empty( $_REQUEST['_custom_availability_simple'] ) ) {
    101       update_post_meta( $post->ID, '_custom_availability', '' );
    102     } else {
    103       update_post_meta( $post->ID, '_custom_availability', $_REQUEST['_custom_availability_simple'] );
    104     }
     117    $_custom_availability_simple = ( isset( $_POST['_custom_availability_simple'] ) && ! empty( $_POST['_custom_availability_simple'] ) ) ? sanitize_text_field( $_POST['_custom_availability_simple'] ) : '';
     118    update_post_meta( $post->ID, '_custom_availability', $_custom_availability_simple );
    105119  }
    106120
     
    132146   */
    133147  public function save_custom_availability_variation_field( $post_id ) {
    134     if ( ! isset( $_REQUEST['_custom_availability'][ $post_id ] ) || empty( $_REQUEST['_custom_availability'][ $post_id ] ) ) {
    135       update_post_meta( $post_id, '_custom_availability', '' );
    136     } else {
    137       update_post_meta( $post_id, '_custom_availability', esc_attr( $_REQUEST['_custom_availability'][ $post_id ] ) );
    138     }
     148    $_custom_availability = ( isset( $_POST['_custom_availability'][ $post_id ] ) && ! empty( $_POST['_custom_availability'][ $post_id ] ) ) ? sanitize_text_field( $_POST['_custom_availability'][ $post_id ] ) : '';
     149    update_post_meta( $post_id, '_custom_availability', $_custom_availability );
    139150  }
    140151
  • custom-availability-for-woocommerce/trunk/readme.txt

    r1751984 r1751992  
    55Requires at least: 4.3.1
    66Tested up to: 4.7.1
    7 Stable tag: 1.0.1
     7Stable tag: 1.1.0
    88License: GPLv3
    99License URI: http://www.gnu.org/licenses/gpl-3.0.html
  • custom-availability-for-woocommerce/trunk/woocommerce-custom-availability.php

    r1751984 r1751992  
    44 * Plugin URI: https://github.com/anttiviljami/woocommerce-custom-availability
    55 * Description: Set custom availability for products
    6  * Version: 1.0.1
     6 * Version: 1.1.0
    77 * Author: @anttiviljami
    88 * Author: https://github.com/anttiviljami
    99 * License: GPLv3
    1010 * Text Domain: woocommerce-custom-availability
     11 * Tested up to: 4.8
    1112 */
    1213
     
    2425*/
    2526
     27
     28if ( ! defined( 'ABSPATH' ) ) {
     29  exit; // Exit if accessed directly.
     30}
     31
    2632if ( ! class_exists( 'WooCommerce_Custom_Availability' ) ) :
    2733
     
    3743
    3844  private function __construct() {
     45
     46    $this->includes();
     47
    3948    // load textdomain for translations
    4049    add_action( 'plugins_loaded',  array( $this, 'load_our_textdomain' ) );
     
    5463    // use custom availability in the frontend
    5564    add_filter( 'woocommerce_get_availability', array( $this, 'custom_availability' ), 10, 2 );
     65  }
     66
     67  /**
     68   * Include required core files used in admin
     69   */
     70  public function includes() {
     71    require_once plugin_dir_path( __FILE__ ) . 'includes/class-woocommerce-custom-availability-list-table.php';
     72    require_once plugin_dir_path( __FILE__ ) . 'includes/class-woocommerce-custom-availability-page.php';
    5673  }
    5774
     
    98115    }
    99116
    100     if ( ! isset( $_REQUEST['_custom_availability_simple'] ) || empty( $_REQUEST['_custom_availability_simple'] ) ) {
    101       update_post_meta( $post->ID, '_custom_availability', '' );
    102     } else {
    103       update_post_meta( $post->ID, '_custom_availability', $_REQUEST['_custom_availability_simple'] );
    104     }
     117    $_custom_availability_simple = ( isset( $_POST['_custom_availability_simple'] ) && ! empty( $_POST['_custom_availability_simple'] ) ) ? sanitize_text_field( $_POST['_custom_availability_simple'] ) : '';
     118    update_post_meta( $post->ID, '_custom_availability', $_custom_availability_simple );
    105119  }
    106120
     
    132146   */
    133147  public function save_custom_availability_variation_field( $post_id ) {
    134     if ( ! isset( $_REQUEST['_custom_availability'][ $post_id ] ) || empty( $_REQUEST['_custom_availability'][ $post_id ] ) ) {
    135       update_post_meta( $post_id, '_custom_availability', '' );
    136     } else {
    137       update_post_meta( $post_id, '_custom_availability', esc_attr( $_REQUEST['_custom_availability'][ $post_id ] ) );
    138     }
     148    $_custom_availability = ( isset( $_POST['_custom_availability'][ $post_id ] ) && ! empty( $_POST['_custom_availability'][ $post_id ] ) ) ? sanitize_text_field( $_POST['_custom_availability'][ $post_id ] ) : '';
     149    update_post_meta( $post_id, '_custom_availability', $_custom_availability );
    139150  }
    140151
Note: See TracChangeset for help on using the changeset viewer.