Deprecate the function as a whole

This commit is contained in:
Boro Sitnikovski 2017-12-14 10:23:51 +01:00
parent e061cb122c
commit e1b753122e
4 changed files with 14 additions and 7 deletions

View File

@ -278,13 +278,20 @@ abstract class WC_Widget extends WP_Widget {
/**
* Get current page URL with various filtering props supported by WC.
*
* @param string $taxonomy Taxonomy.
* @return string
*/
protected function get_page_base_url( $deprecated ) {
if ( $deprecated ) {
wc_deprecated_argument( 'taxonomy', '3.3', 'get_page_base_url() does not require a taxonomy id anymore.' );
}
protected function get_page_base_url( $taxonomy ) {
wc_deprecated_function( 'WC_Widget::get_page_base_url', '3.3.0', 'WC_Widget::get_page_url' );
return $this->get_page_url();
}
/**
* Get current page URL with various filtering props supported by WC.
*
* @return string
*/
protected function get_page_url() {
if ( defined( 'SHOP_IS_ON_FRONT' ) ) {
$link = home_url();
} elseif ( is_shop() ) {

View File

@ -50,7 +50,7 @@ class WC_Widget_Layered_Nav_Filters extends WC_Widget {
$min_price = isset( $_GET['min_price'] ) ? wc_clean( $_GET['min_price'] ) : 0;
$max_price = isset( $_GET['max_price'] ) ? wc_clean( $_GET['max_price'] ) : 0;
$rating_filter = isset( $_GET['rating_filter'] ) ? array_filter( array_map( 'absint', explode( ',', $_GET['rating_filter'] ) ) ) : array();
$base_link = $this->get_page_base_url();
$base_link = $this->get_page_url();
if ( 0 < count( $_chosen_attributes ) || 0 < $min_price || 0 < $max_price || ! empty( $rating_filter ) ) {

View File

@ -424,7 +424,7 @@ class WC_Widget_Layered_Nav extends WC_Widget {
$current_filter[] = $term->slug;
}
$link = remove_query_arg( $filter_name, $this->get_page_base_url() );
$link = remove_query_arg( $filter_name, $this->get_page_url() );
// Add current filters to URL.
foreach ( $current_filter as $key => $value ) {

View File

@ -112,7 +112,7 @@ class WC_Widget_Rating_Filter extends WC_Widget {
continue;
}
$found = true;
$link = $this->get_page_base_url();
$link = $this->get_page_url();
if ( in_array( $rating, $rating_filter ) ) {
$link_ratings = implode( ',', array_diff( $rating_filter, array( $rating ) ) );