WordPress.org

Plugin Directory

Changeset 1760115


Ignore:
Timestamp:
11/07/17 14:11:19 (13 days ago)
Author:
sormano
Message:

WPPP 1.2.4

Location:
woocommerce-products-per-page
Files:
1 deleted
5 edited
16 copied

Legend:

Unmodified
Added
Removed
  • woocommerce-products-per-page/tags/1.2.4/includes/class-wppp-front-end.php

    r1751256 r1760115  
    3333 
    3434        // Add filter for product columns 
    35         add_filter( 'loop_shop_columns', array( $this, 'loop_shop_columns' ), 100 ); 
     35        add_filter( 'loop_shop_columns', array( $this, 'loop_shop_columns' ) ); 
    3636 
    3737        // Custom number of products per page 
    38         add_filter( 'loop_shop_per_page', array( $this, 'loop_shop_per_page' ), 100 ); 
     38        add_filter( 'loop_shop_per_page', array( $this, 'loop_shop_per_page' ) ); 
    3939 
    4040        // Get the right amount of products from the DB 
    4141        add_action( 'woocommerce_product_query', array( $this, 'woocommerce_product_query' ), 2, 50 ); 
     42 
     43        // Set cookie so PPP will be saved 
     44        add_action( 'init', array( $this, 'set_customer_session' ), 10 ); 
    4245 
    4346        // Check if ppp form is fired 
     
    161164        elseif ( isset( $_REQUEST['ppp'] ) ) : 
    162165            return intval( $_REQUEST['ppp'] ); 
    163         elseif ( isset( $_COOKIE['woocommerce_products_per_page'] ) ) : 
    164             return $_COOKIE['woocommerce_products_per_page']; 
     166        elseif ( WC()->session->__isset( 'products_per_page' ) ) : 
     167            return intval( WC()->session->__get( 'products_per_page' ) ); 
    165168        else : 
    166169            return intval( get_option( 'wppp_default_ppp', '12' ) ); 
     
    191194 
    192195    /** 
     196     * Initialize session. 
     197     * 
     198     * Set an initial session for WC 2.1.X users. Cookies are set automatically prior 2.1.X. 
     199     * 
     200     * @since 1.2.0 
     201     */ 
     202    public function set_customer_session() { 
     203 
     204        if ( WC()->version > '2.1' && ( ! is_admin() || defined( 'DOING_AJAX' ) ) && ! defined( 'DOING_CRON' ) ) : 
     205            WC()->session->set_customer_session_cookie( true ); 
     206        endif; 
     207 
     208    } 
     209 
     210 
     211    /** 
    193212     * PPP action. 
    194213     * 
     
    201220 
    202221        if ( isset( $_REQUEST['wppp_ppp'] ) ) : 
    203             wc_setcookie( 'woocommerce_products_per_page', intval( $_REQUEST['wppp_ppp'] ), time() + DAY_IN_SECONDS * 2, apply_filters( 'wc_session_use_secure_cookie', false ) ); 
     222            WC()->session->set( 'products_per_page', intval( $_REQUEST['wppp_ppp'] ) ); 
    204223        elseif ( isset( $_REQUEST['ppp'] ) ) : 
    205             wc_setcookie( 'woocommerce_products_per_page', intval( $_REQUEST['ppp'] ), time() + DAY_IN_SECONDS * 2, apply_filters( 'wc_session_use_secure_cookie', false ) ); 
     224            WC()->session->set( 'products_per_page', intval( $_REQUEST['ppp'] ) ); 
    206225        endif; 
    207226 
  • woocommerce-products-per-page/tags/1.2.4/languages/woocommerce-products-per-page-de_DE.po

    r1751256 r1760115  
    66"Last-Translator: Michael Firnkes <info@blogprofis.de>\n" 
    77"Language-Team: Jeroen Sormani <jeroen.sormani@gmail.com>\n" 
    8 "Language: fr\n" 
     8"Language: French\n" 
    99"MIME-Version: 1.0\n" 
    1010"Content-Type: text/plain; charset=UTF-8\n" 
    1111"Content-Transfer-Encoding: 8bit\n" 
    12 "X-Generator: Poedit 1.7.1\n" 
     12"X-Generator: Poedit 1.5.5\n" 
    1313"X-Poedit-KeywordsList: __;_e\n" 
    1414"X-Poedit-Basepath: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/\n" 
     
    5959#: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/admin/options-page.php:107 
    6060msgid "Seperated by spaces <em>(-1 for all products)</em>" 
    61 msgstr "Mit Leerzeichen trennen <em>(-1 für alle Produkte)</em>" 
     61msgstr "Kommagetrennte Eingabe <em>(-1 für 'Alle Produkte anzeigen')</em>" 
    6262 
    6363#: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/admin/options-page.php:118 
     
    8181msgid "All" 
    8282msgstr "Alle" 
     83 
  • woocommerce-products-per-page/tags/1.2.4/readme.txt

    r1751256 r1760115  
    33Tags: woocommerce, products per page, woocommerce products, woocommerce products per page, products, per page 
    44Requires at least: 4.0.0 
    5 Tested up to: 4.8.2 
    6 Stable tag: 1.2.3 
     5Tested up to: 4.8.3 
     6Stable tag: 1.2.4 
    77License: GPLv3 or later 
    88License URI: http://www.gnu.org/licenses/gpl-3.0.html 
     
    7070== Changelog == 
    7171 
     72= 1.2.4 - 07/11/2017 = 
     73 
     74* [Fix] - Default 'list of dropdown options' setting is not properly set on the settings page. 
     75 
    7276= 1.2.3 - 23/10/2017 = 
    7377 
  • woocommerce-products-per-page/tags/1.2.4/woocommerce-products-per-page.php

    r1751256 r1760115  
    44 * Plugin URI: https://wordpress.org/plugins/woocommerce-products-per-page/ 
    55 * Description: Integrate a 'products per page' dropdown on your WooCommerce website! Set-up in <strong>seconds</strong>! 
    6  * Version: 1.2.3 
     6 * Version: 1.2.4 
    77 * Author: Jeroen Sormani 
    88 * Author URI: http://jeroensormani.com 
     
    4848     * @var string $version Plugin version number. 
    4949     */ 
    50     public $version = '1.2.3'; 
     50    public $version = '1.2.4'; 
    5151 
    5252 
     
    178178            // Updating to 1.2.0 
    179179            if ( version_compare( get_option( 'wppp_version', '0' ), '1.2.0', '<' ) ) : 
     180                $dropdown_options_default = 
     181                    ( apply_filters( 'loop_shop_columns', 4 ) * 3 ) . ' ' . 
     182                    ( apply_filters( 'loop_shop_columns', 4 ) * 6 ) . ' ' . 
     183                    ( apply_filters( 'loop_shop_columns', 4 ) * 9 ); 
    180184                $settings = get_option( 'wppp_settings', array() ); 
    181185                update_option( 'wppp_dropdown_location', isset( $settings['location'] ) ? $settings['location'] : 'topbottom'  ); 
    182                 update_option( 'wppp_dropdown_options', isset( $settings['productsPerPage'] ) ? $settings['productsPerPage'] : null  ); 
     186                update_option( 'wppp_dropdown_options', isset( $settings['productsPerPage'] ) ? $settings['productsPerPage'] : $dropdown_options_default  ); 
    183187                update_option( 'wppp_default_ppp', isset( $settings['default_ppp'] ) ? $settings['default_ppp'] : '12'  ); 
    184188                update_option( 'wppp_shop_columns', isset( $settings['shop_columns'] ) ? $settings['shop_columns'] : '4'  ); 
  • woocommerce-products-per-page/trunk/includes/class-wppp-front-end.php

    r1751256 r1760115  
    3333 
    3434        // Add filter for product columns 
    35         add_filter( 'loop_shop_columns', array( $this, 'loop_shop_columns' ), 100 ); 
     35        add_filter( 'loop_shop_columns', array( $this, 'loop_shop_columns' ) ); 
    3636 
    3737        // Custom number of products per page 
    38         add_filter( 'loop_shop_per_page', array( $this, 'loop_shop_per_page' ), 100 ); 
     38        add_filter( 'loop_shop_per_page', array( $this, 'loop_shop_per_page' ) ); 
    3939 
    4040        // Get the right amount of products from the DB 
    4141        add_action( 'woocommerce_product_query', array( $this, 'woocommerce_product_query' ), 2, 50 ); 
     42 
     43        // Set cookie so PPP will be saved 
     44        add_action( 'init', array( $this, 'set_customer_session' ), 10 ); 
    4245 
    4346        // Check if ppp form is fired 
     
    161164        elseif ( isset( $_REQUEST['ppp'] ) ) : 
    162165            return intval( $_REQUEST['ppp'] ); 
    163         elseif ( isset( $_COOKIE['woocommerce_products_per_page'] ) ) : 
    164             return $_COOKIE['woocommerce_products_per_page']; 
     166        elseif ( WC()->session->__isset( 'products_per_page' ) ) : 
     167            return intval( WC()->session->__get( 'products_per_page' ) ); 
    165168        else : 
    166169            return intval( get_option( 'wppp_default_ppp', '12' ) ); 
     
    191194 
    192195    /** 
     196     * Initialize session. 
     197     * 
     198     * Set an initial session for WC 2.1.X users. Cookies are set automatically prior 2.1.X. 
     199     * 
     200     * @since 1.2.0 
     201     */ 
     202    public function set_customer_session() { 
     203 
     204        if ( WC()->version > '2.1' && ( ! is_admin() || defined( 'DOING_AJAX' ) ) && ! defined( 'DOING_CRON' ) ) : 
     205            WC()->session->set_customer_session_cookie( true ); 
     206        endif; 
     207 
     208    } 
     209 
     210 
     211    /** 
    193212     * PPP action. 
    194213     * 
     
    201220 
    202221        if ( isset( $_REQUEST['wppp_ppp'] ) ) : 
    203             wc_setcookie( 'woocommerce_products_per_page', intval( $_REQUEST['wppp_ppp'] ), time() + DAY_IN_SECONDS * 2, apply_filters( 'wc_session_use_secure_cookie', false ) ); 
     222            WC()->session->set( 'products_per_page', intval( $_REQUEST['wppp_ppp'] ) ); 
    204223        elseif ( isset( $_REQUEST['ppp'] ) ) : 
    205             wc_setcookie( 'woocommerce_products_per_page', intval( $_REQUEST['ppp'] ), time() + DAY_IN_SECONDS * 2, apply_filters( 'wc_session_use_secure_cookie', false ) ); 
     224            WC()->session->set( 'products_per_page', intval( $_REQUEST['ppp'] ) ); 
    206225        endif; 
    207226 
  • woocommerce-products-per-page/trunk/languages/woocommerce-products-per-page-de_DE.po

    r1751256 r1760115  
    66"Last-Translator: Michael Firnkes <info@blogprofis.de>\n" 
    77"Language-Team: Jeroen Sormani <jeroen.sormani@gmail.com>\n" 
    8 "Language: fr\n" 
     8"Language: French\n" 
    99"MIME-Version: 1.0\n" 
    1010"Content-Type: text/plain; charset=UTF-8\n" 
    1111"Content-Transfer-Encoding: 8bit\n" 
    12 "X-Generator: Poedit 1.7.1\n" 
     12"X-Generator: Poedit 1.5.5\n" 
    1313"X-Poedit-KeywordsList: __;_e\n" 
    1414"X-Poedit-Basepath: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/\n" 
     
    5959#: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/admin/options-page.php:107 
    6060msgid "Seperated by spaces <em>(-1 for all products)</em>" 
    61 msgstr "Mit Leerzeichen trennen <em>(-1 für alle Produkte)</em>" 
     61msgstr "Kommagetrennte Eingabe <em>(-1 für 'Alle Produkte anzeigen')</em>" 
    6262 
    6363#: /Users/Jeroen/plugins/woocommerce-products-per-page/trunk/admin/options-page.php:118 
     
    8181msgid "All" 
    8282msgstr "Alle" 
     83 
  • woocommerce-products-per-page/trunk/readme.txt

    r1751256 r1760115  
    33Tags: woocommerce, products per page, woocommerce products, woocommerce products per page, products, per page 
    44Requires at least: 4.0.0 
    5 Tested up to: 4.8.2 
    6 Stable tag: 1.2.3 
     5Tested up to: 4.8.3 
     6Stable tag: 1.2.4 
    77License: GPLv3 or later 
    88License URI: http://www.gnu.org/licenses/gpl-3.0.html 
     
    7070== Changelog == 
    7171 
     72= 1.2.4 - 07/11/2017 = 
     73 
     74* [Fix] - Default 'list of dropdown options' setting is not properly set on the settings page. 
     75 
    7276= 1.2.3 - 23/10/2017 = 
    7377 
  • woocommerce-products-per-page/trunk/woocommerce-products-per-page.php

    r1751256 r1760115  
    44 * Plugin URI: https://wordpress.org/plugins/woocommerce-products-per-page/ 
    55 * Description: Integrate a 'products per page' dropdown on your WooCommerce website! Set-up in <strong>seconds</strong>! 
    6  * Version: 1.2.3 
     6 * Version: 1.2.4 
    77 * Author: Jeroen Sormani 
    88 * Author URI: http://jeroensormani.com 
     
    4848     * @var string $version Plugin version number. 
    4949     */ 
    50     public $version = '1.2.3'; 
     50    public $version = '1.2.4'; 
    5151 
    5252 
     
    178178            // Updating to 1.2.0 
    179179            if ( version_compare( get_option( 'wppp_version', '0' ), '1.2.0', '<' ) ) : 
     180                $dropdown_options_default = 
     181                    ( apply_filters( 'loop_shop_columns', 4 ) * 3 ) . ' ' . 
     182                    ( apply_filters( 'loop_shop_columns', 4 ) * 6 ) . ' ' . 
     183                    ( apply_filters( 'loop_shop_columns', 4 ) * 9 ); 
    180184                $settings = get_option( 'wppp_settings', array() ); 
    181185                update_option( 'wppp_dropdown_location', isset( $settings['location'] ) ? $settings['location'] : 'topbottom'  ); 
    182                 update_option( 'wppp_dropdown_options', isset( $settings['productsPerPage'] ) ? $settings['productsPerPage'] : null  ); 
     186                update_option( 'wppp_dropdown_options', isset( $settings['productsPerPage'] ) ? $settings['productsPerPage'] : $dropdown_options_default  ); 
    183187                update_option( 'wppp_default_ppp', isset( $settings['default_ppp'] ) ? $settings['default_ppp'] : '12'  ); 
    184188                update_option( 'wppp_shop_columns', isset( $settings['shop_columns'] ) ? $settings['shop_columns'] : '4'  ); 
Note: See TracChangeset for help on using the changeset viewer.