hello
Server : Apache System : Linux webm006.cluster103.gra.hosting.ovh.net 6.18.42-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Wed Aug 5 15:59:48 CEST 2026 x86_64 User : chryzalihi ( 621211) PHP Version : 8.3.31 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl Directory : /home/c/h/r/chryzalihi/www/wp-content/languages/themes/the/ |
PK ��]ʹ�j j % woocommerce/woocommerce-functions.phpnu �[��� <?php
/**
* Bloglo WooCommerce compatibility functions.
*
* @package Bloglo
* @author Peregrine Themes
* @since 1.0.0
*/
if ( ! function_exists( 'bloglo_get_wc_version' ) ) :
/**
* Get the version of the currently installed WooCommerce.
*
* @since 1.0.0
* @return woocommerce version number or null.
*/
function bloglo_get_wc_version() {
return defined( 'WC_VERSION' ) && WC_VERSION ? WC_VERSION : null;
}
endif;
if ( ! function_exists( 'bloglo_header_widget_cart' ) ) :
/**
* Outputs the header cart widget.
*
* @since 1.0.0
* @param array $options Array of widget options.
*/
function bloglo_header_widget_cart( $options ) {
// Cart widget.
bloglo_wc_cart_icon();
// Skip dropdown on checkout and cart.
if ( is_checkout() || is_cart() ) {
return;
}
// Cart dropdown contents.
bloglo_wc_cart_dropdown();
}
endif;
if ( ! function_exists( 'bloglo_wc_cart_icon' ) ) :
/**
* Outputs the WooCommerce cart widget icon.
*
* @since 1.0.0
* @param boolean $echo Return or print.
*/
function bloglo_wc_cart_icon( $echo = true ) {
ob_start();
wc_get_template_part( 'cart/header-widget/icon' );
$output = ob_get_clean();
if ( true === $echo ) {
echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
} else {
return $output;
}
}
endif;
if ( ! function_exists( 'bloglo_wc_cart_dropdown' ) ) :
/**
* Outputs the WooCommerce cart dropdown.
*
* @since 1.0.0
* @param bool $echo Print or return content.
*/
function bloglo_wc_cart_dropdown( $echo = true ) {
ob_start();
wc_get_template_part( 'cart/header-widget/dropdown' );
$output = ob_get_clean();
if ( true === $echo ) {
echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
} else {
return $output;
}
}
endif;
if ( ! function_exists( 'bloglo_wc_out_of_stock_badge' ) ) :
/**
* Outputs out of stock (sold out) badge for product.
*
* @since 1.0.0
*/
function bloglo_wc_out_of_stock_badge() {
global $product;
if ( ! $product->is_in_stock() ) {
esc_html( sprintf( apply_filters( 'bloglo_woocommerce_out_of_stock_badge', sprintf( '<span class="onsale sold-out">%s</span>', esc_html__( 'Sold Out', 'bloglo' ) ) ) ) );
}
}
endif;
if ( ! function_exists( 'bloglo_wc_add_percentage_to_sale_badge' ) ) :
/**
* Outputs badge with percentage discount for product.
*
* @since 1.0.0
* @param string $html Cart widget content.
* @param object $post Post object.
* @param object $product Product object.
*/
function bloglo_wc_add_percentage_to_sale_badge( $html, $post, $product ) {
$badge = bloglo_option( 'product_sale_badge' );
if ( 'hide' === $badge ) {
return '';
}
if ( ! $product->is_in_stock() && ! $product->backorders_allowed() ) {
return '';
}
$text = '';
if ( 'text' === $badge ) {
$text = bloglo_option( 'product_sale_badge_text' );
} elseif ( 'percentage' === $badge ) {
if ( $product->is_type( 'variable' ) ) {
$percentages = array();
// Get all variation prices.
$prices = $product->get_variation_prices();
// Loop through variation prices.
foreach ( $prices['price'] as $key => $price ) {
// Only on sale variations.
if ( $prices['regular_price'][ $key ] !== $price ) {
// Prevent dividing by 0.
if ( ! $prices['regular_price'][ $key ] ) {
return $html;
}
// Calculate and set in the array the percentage for each variation on sale.
$percentages[] = round( 100 - ( $prices['sale_price'][ $key ] / $prices['regular_price'][ $key ] * 100 ) );
}
}
// We keep the highest value.
$text = '-' . max( $percentages ) . '%';
} else {
$regular_price = (float) $product->get_regular_price();
$sale_price = (float) $product->get_sale_price();
// Prevent dividing by 0.
if ( ! $regular_price ) {
return $html;
}
$text = '-' . round( 100 - ( $sale_price / $regular_price * 100 ) ) . '%';
}
}
return $text || is_customize_preview() ? '<span class="onsale">' . esc_html( $text ) . '</span>' : '';
}
endif;
if ( ! function_exists( 'bloglo_wc_empty_cart_button' ) ) :
/**
* Add empty cart - button to return to cart page.
*
* @since 1.0.0
*/
function bloglo_wc_empty_cart_button() {
if ( ! wc_get_page_id( 'shop' ) ) {
return;
}
?>
<p class="return-to-shop bloglo-woo-return">
<a class="bloglo-btn btn-reveal btn-left-icon" href="<?php echo esc_url( apply_filters( 'woocommerce_return_to_shop_redirect', wc_get_page_permalink( 'shop' ) ) ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound ?>" role="button">
<span><?php esc_html_e( 'Return to Shop', 'bloglo' ); ?></span>
<?php echo bloglo()->icons->get_svg( 'arrow-left', array( 'aria-hidden' => 'true' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
</a>
</p>
<?php
}
endif;
if ( ! function_exists( 'bloglo_wc_widget_shopping_cart_buttons' ) ) :
/**
* Mini cart buttons for Shopping Cart Widget.
*
* @since 1.0.0
*/
function bloglo_wc_widget_shopping_cart_buttons() {
wc_get_template_part( 'cart/header-widget/buttons' );
}
endif;
if ( ! function_exists( 'bloglo_wc_layered_count_filter' ) ) :
/**
* Removes parentheses from WooCommerce layered filter count.
*
* @since 1.0.0
*
* @param string $output The count output.
* @param array $count The count.
* @param array $term The term.
* @return string
*/
function bloglo_wc_layered_count_filter( $output, $count, $term ) {
$output = str_replace( '(', ' ', $output );
$output = str_replace( ')', ' ', $output );
return $output;
}
endif;
if ( ! function_exists( 'bloglo_wc_rating_count_filter' ) ) :
/**
* Removes parentheses from WooCommerce rating filter count.
*
* @since 1.0.0
*
* @param string $output The count output.
* @param array $count The count.
* @param array $rating The term.
* @return string
*/
function bloglo_wc_rating_count_filter( $output, $count, $rating ) {
$output = str_replace( '(', '<em>', $output );
$output = str_replace( ')', '</em>', $output );
return $output;
}
endif;
if ( ! function_exists( 'bloglo_wc_cat_count_filter' ) ) :
/**
* Filters product category subtitle (count).
*
* @since 1.0.0
*
* @param string $output The count output.
* @param array $category The category.
* @return string
*/
function bloglo_wc_cat_count_filter( $output, $category ) {
$count = $category->count;
/* translators: %s is category count */
$text = sprintf( _n( '%s product', '%s products', $count, 'bloglo' ), $count );
return '<span class="count">' . esc_html( $text ) . '</span>';
}
endif;
PK ��]WM�|c; c; 3 woocommerce/class-bloglo-customizer-woocommerce.phpnu �[��� <?php
/**
* Bloglo WooCommerce section in Customizer.
*
* @package Bloglo
* @author Peregrine Themes
* @since 1.0.0
*/
/**
* Do not allow direct script access.
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Bloglo_Customizer_WooCommerce' ) ) :
/**
* Bloglo WooCommerce section in Customizer.
*/
class Bloglo_Customizer_WooCommerce {
/**
* Primary class constructor.
*
* @since 1.0.0
*/
public function __construct() {
// Registers our custom options in Customizer.
add_filter( 'bloglo_customizer_options', array( $this, 'register_options' ), 20 );
add_action( 'customize_register', array( $this, 'customizer_tweak' ), 20 );
// Add default values for WooCommerce options.
add_filter( 'bloglo_default_option_values', array( $this, 'default_customizer_values' ) );
// Add localized strings to script.
add_filter( 'bloglo_customizer_localized', array( $this, 'customizer_localized_strings' ) );
}
/**
* Add defaults for new WooCommerce customizer options.
*
* @param array $defaults Array of default values.
* @return array Array of default values.
*/
public function default_customizer_values( $defaults ) {
$defaults['bloglo_wc_product_gallery_lightbox'] = true;
$defaults['bloglo_wc_product_gallery_zoom'] = true;
$defaults['bloglo_shop_product_hover'] = 'none';
$defaults['bloglo_product_sale_badge'] = 'percentage';
$defaults['bloglo_product_sale_badge_text'] = esc_html__( 'Sale!', 'bloglo' );
$defaults['bloglo_wc_product_slider_arrows'] = true;
$defaults['bloglo_wc_product_gallery_style'] = 'default';
$defaults['bloglo_wc_product_sidebar_position'] = 'no-sidebar';
$defaults['bloglo_wc_sidebar_position'] = 'no-sidebar';
$defaults['bloglo_wc_upsell_products'] = true;
$defaults['bloglo_wc_upsells_columns'] = 4;
$defaults['bloglo_wc_upsells_rows'] = 1;
$defaults['bloglo_wc_related_products'] = true;
$defaults['bloglo_wc_related_columns'] = 4;
$defaults['bloglo_wc_related_rows'] = 1;
$defaults['bloglo_wc_cross_sell_products'] = true;
$defaults['bloglo_wc_cross_sell_rows'] = 1;
$defaults['bloglo_product_catalog_elements'] = array(
'category' => true,
'title' => true,
'ratings' => true,
'price' => true,
);
return $defaults;
}
/**
* Tweak Customizer.
*
* @since 1.0.0
* @param WP_Customize_Manager $customizer Instance of WP_Customize_Manager class.
*/
public function customizer_tweak( $customizer ) {
// Move WooCommerce panel.
$customizer->get_panel( 'woocommerce' )->priority = 10;
return $customizer;
}
/**
* Registers our custom options in Customizer.
*
* @since 1.0.0
* @param array $options Array of customizer options.
*/
public function register_options( $options ) {
// Shop image hover effect.
$options['setting']['bloglo_shop_product_hover'] = array(
'transport' => 'refresh',
'sanitize_callback' => 'bloglo_sanitize_select',
'control' => array(
'type' => 'bloglo-select',
'section' => 'woocommerce_product_catalog',
'label' => esc_html__( 'Product image hover', 'bloglo' ),
'description' => esc_html__( 'Effect for product image on hover', 'bloglo' ),
'choices' => array(
'none' => esc_html__( 'No Effect', 'bloglo' ),
'image-swap' => esc_html__( 'Image Swap', 'bloglo' ),
),
),
);
// Sale badge.
$options['setting']['bloglo_product_sale_badge'] = array(
'transport' => 'refresh',
'sanitize_callback' => 'bloglo_sanitize_select',
'control' => array(
'type' => 'bloglo-select',
'section' => 'woocommerce_product_catalog',
'label' => esc_html__( 'Product sale badge', 'bloglo' ),
'description' => esc_html__( 'Choose what to display on the product sale badge.', 'bloglo' ),
'choices' => array(
'hide' => esc_html__( 'Hide badge', 'bloglo' ),
'percentage' => esc_html__( 'Show percentage', 'bloglo' ),
'text' => esc_html__( 'Show text', 'bloglo' ),
),
),
);
// Sale badge text.
$options['setting']['bloglo_product_sale_badge_text'] = array(
'transport' => 'postMessage',
'sanitize_callback' => 'sanitize_text_field',
'control' => array(
'type' => 'bloglo-text',
'label' => esc_html__( 'Sale badge text', 'bloglo' ),
'description' => esc_html__( 'Add custom text for the product sale badge.', 'bloglo' ),
'placeholder' => esc_html__( 'Sale!', 'bloglo' ),
'section' => 'woocommerce_product_catalog',
'required' => array(
array(
'control' => 'bloglo_product_sale_badge',
'value' => 'text',
'operator' => '==',
),
),
),
);
// Catalog product elements.
$options['setting']['bloglo_product_catalog_elements'] = array(
'transport' => 'refresh',
'sanitize_callback' => 'bloglo_sanitize_sortable',
'control' => array(
'type' => 'bloglo-sortable',
'section' => 'woocommerce_product_catalog',
'label' => esc_html__( 'Product details', 'bloglo' ),
'description' => esc_html__( 'Set order and visibility for product details.', 'bloglo' ),
'choices' => array(
'title' => esc_html__( 'Title', 'bloglo' ),
'ratings' => esc_html__( 'Ratings', 'bloglo' ),
'price' => esc_html__( 'Price', 'bloglo' ),
'category' => esc_html__( 'Category', 'bloglo' ),
),
),
);
// Section.
$options['section']['bloglo_woocommerce_single_product'] = array(
'title' => esc_html__( 'Single Product', 'bloglo' ),
'priority' => 50,
'panel' => 'woocommerce',
);
// Product Gallery Zoom.
$options['setting']['bloglo_wc_product_gallery_zoom'] = array(
'transport' => 'refresh',
'sanitize_callback' => 'bloglo_sanitize_toggle',
'control' => array(
'type' => 'bloglo-toggle',
'label' => esc_html__( 'Gallery Zoom', 'bloglo' ),
'description' => esc_html__( 'Enable zoom effect when hovering product gallery.', 'bloglo' ),
'section' => 'bloglo_woocommerce_single_product',
'space' => true,
),
);
// Product Gallery Lightbox.
$options['setting']['bloglo_wc_product_gallery_lightbox'] = array(
'transport' => 'refresh',
'sanitize_callback' => 'bloglo_sanitize_toggle',
'control' => array(
'type' => 'bloglo-toggle',
'label' => esc_html__( 'Gallery Lightbox', 'bloglo' ),
'description' => esc_html__( 'Open product gallery images in lightbox.', 'bloglo' ),
'section' => 'bloglo_woocommerce_single_product',
'space' => true,
),
);
// Product slider arrows.
$options['setting']['bloglo_wc_product_slider_arrows'] = array(
'transport' => 'refresh',
'sanitize_callback' => 'bloglo_sanitize_toggle',
'control' => array(
'type' => 'bloglo-toggle',
'label' => esc_html__( 'Slider Arrows', 'bloglo' ),
'description' => esc_html__( 'Enable left and right arrows on product gallery slider.', 'bloglo' ),
'section' => 'bloglo_woocommerce_single_product',
'space' => true,
),
);
// Related Products.
$options['setting']['bloglo_wc_related_products'] = array(
'transport' => 'refresh',
'sanitize_callback' => 'bloglo_sanitize_toggle',
'control' => array(
'type' => 'bloglo-toggle',
'label' => esc_html__( 'Related Products', 'bloglo' ),
'description' => esc_html__( 'Display related products.', 'bloglo' ),
'section' => 'bloglo_woocommerce_single_product',
'space' => true,
),
);
// Related product column count.
$options['setting']['bloglo_wc_related_columns'] = array(
'transport' => 'refresh',
'sanitize_callback' => 'bloglo_sanitize_range',
'control' => array(
'type' => 'bloglo-range',
'label' => esc_html__( 'Related Products Columns', 'bloglo' ),
'description' => esc_html__( 'How many related products should be shown per row?', 'bloglo' ),
'section' => 'bloglo_woocommerce_single_product',
'min' => 1,
'max' => 6,
'step' => 1,
'required' => array(
array(
'control' => 'bloglo_wc_related_products',
'value' => true,
'operator' => '==',
),
),
),
);
// Related product row count.
$options['setting']['bloglo_wc_related_rows'] = array(
'transport' => 'refresh',
'sanitize_callback' => 'bloglo_sanitize_range',
'control' => array(
'type' => 'bloglo-range',
'label' => esc_html__( 'Related Products Rows', 'bloglo' ),
'description' => esc_html__( 'How many rows of related products should be shown?', 'bloglo' ),
'section' => 'bloglo_woocommerce_single_product',
'min' => 1,
'max' => 5,
'step' => 1,
'required' => array(
array(
'control' => 'bloglo_wc_related_products',
'value' => true,
'operator' => '==',
),
),
),
);
// Up-Sell Products.
$options['setting']['bloglo_wc_upsell_products'] = array(
'transport' => 'refresh',
'sanitize_callback' => 'bloglo_sanitize_toggle',
'control' => array(
'type' => 'bloglo-toggle',
'label' => esc_html__( 'Up-Sell Products', 'bloglo' ),
'description' => esc_html__( 'Display linked upsell products.', 'bloglo' ),
'section' => 'bloglo_woocommerce_single_product',
'space' => true,
),
);
// Up-Sells column count.
$options['setting']['bloglo_wc_upsells_columns'] = array(
'transport' => 'refresh',
'sanitize_callback' => 'bloglo_sanitize_range',
'control' => array(
'type' => 'bloglo-range',
'label' => esc_html__( 'Up-Sell Products Columns', 'bloglo' ),
'description' => esc_html__( 'How many up-sell products should be shown per row?', 'bloglo' ),
'section' => 'bloglo_woocommerce_single_product',
'min' => 1,
'max' => 6,
'step' => 1,
'required' => array(
array(
'control' => 'bloglo_wc_upsell_products',
'value' => true,
'operator' => '==',
),
),
),
);
// Up-Sells rows count.
$options['setting']['bloglo_wc_upsells_rows'] = array(
'transport' => 'refresh',
'sanitize_callback' => 'bloglo_sanitize_range',
'control' => array(
'type' => 'bloglo-range',
'label' => esc_html__( 'Up-Sell Products Rows', 'bloglo' ),
'description' => esc_html__( 'How many rows of up-sell products should be shown?', 'bloglo' ),
'section' => 'bloglo_woocommerce_single_product',
'min' => 1,
'max' => 6,
'step' => 1,
'required' => array(
array(
'control' => 'bloglo_wc_upsell_products',
'value' => true,
'operator' => '==',
),
),
),
);
// Cross-Sell Products.
$options['setting']['bloglo_wc_cross_sell_products'] = array(
'transport' => 'refresh',
'sanitize_callback' => 'bloglo_sanitize_toggle',
'control' => array(
'type' => 'bloglo-toggle',
'label' => esc_html__( 'Cross-Sell Products', 'bloglo' ),
'description' => esc_html__( 'Display linked cross-sell products on cart page.', 'bloglo' ),
'section' => 'bloglo_woocommerce_single_product',
'space' => true,
),
);
// Cross-Sells rows count.
$options['setting']['bloglo_wc_cross_sell_rows'] = array(
'transport' => 'refresh',
'sanitize_callback' => 'bloglo_sanitize_range',
'control' => array(
'type' => 'bloglo-range',
'label' => esc_html__( 'Cross-Sell Products Rows', 'bloglo' ),
'description' => esc_html__( 'How many rows of cross-sell products should be shown?', 'bloglo' ),
'section' => 'bloglo_woocommerce_single_product',
'min' => 1,
'max' => 6,
'step' => 1,
'required' => array(
array(
'control' => 'bloglo_wc_cross_sells_products',
'value' => true,
'operator' => '==',
),
),
),
);
$sidebar_options = array();
$sidebar_options['bloglo_wc_sidebar_position'] = array(
'transport' => 'refresh',
'sanitize_callback' => 'bloglo_sanitize_select',
'control' => array(
'type' => 'bloglo-select',
'label' => esc_html__( 'WooCommerce', 'bloglo' ),
'description' => esc_html__( 'Choose default sidebar position for cart, checkout and catalog pages. You can change this setting per page via metabox settings.', 'bloglo' ),
'section' => 'bloglo_section_sidebar',
'choices' => array(
'default' => esc_html__( 'Default', 'bloglo' ),
'no-sidebar' => esc_html__( 'No Sidebar', 'bloglo' ),
'left-sidebar' => esc_html__( 'Left Sidebar', 'bloglo' ),
'right-sidebar' => esc_html__( 'Right Sidebar', 'bloglo' ),
),
),
);
$sidebar_options['bloglo_wc_product_sidebar_position'] = array(
'transport' => 'refresh',
'sanitize_callback' => 'bloglo_sanitize_select',
'control' => array(
'type' => 'bloglo-select',
'label' => esc_html__( 'WooCommerce - Single Product', 'bloglo' ),
'description' => esc_html__( 'Choose default sidebar position layout for product pages. You can change this setting per product via metabox settings.', 'bloglo' ),
'section' => 'bloglo_section_sidebar',
'choices' => array(
'default' => esc_html__( 'Default', 'bloglo' ),
'no-sidebar' => esc_html__( 'No Sidebar', 'bloglo' ),
'left-sidebar' => esc_html__( 'Left Sidebar', 'bloglo' ),
'right-sidebar' => esc_html__( 'Right Sidebar', 'bloglo' ),
),
),
);
$options['setting'] = hester_array_insert( $options['setting'], $sidebar_options, 'bloglo_archive_sidebar_position' );
return $options;
}
/**
* Add localize strings.
*
* @param array $strings Array of strings to be localized.
* @return array Modified string array.
*/
public function customizer_localized_strings( $strings ) {
// Preview a random single product for WooCommerce > Single Product section.
$products = get_posts(
array(
'post_type' => 'product',
'posts_per_page' => 1,
'orderby' => 'rand',
)
);
if ( count( $products ) ) {
$strings['preview_url_for_section']['bloglo_woocommerce_single_product'] = get_permalink( $products[0] );
}
return $strings;
}
}
endif;
new Bloglo_Customizer_WooCommerce();
PK ��]�^�� � 3 woocommerce/class-bloglo-customizer-widget-cart.phpnu �[��� <?php
/**
* Bloglo Customizer widgets class.
*
* @package Bloglo
* @author Peregrine Themes
* @since 1.0.0
*/
/**
* Do not allow direct script access.
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Bloglo_Customizer_Widget_Cart' ) ) :
/**
* Bloglo Customizer widget class
*/
class Bloglo_Customizer_Widget_Cart extends Bloglo_Customizer_Widget {
/**
* Primary class constructor.
*
* @since 1.0.0
* @param array $args An array of the values for this widget.
*/
public function __construct( $args = array() ) {
parent::__construct( $args );
$this->name = esc_html__( 'Cart', 'bloglo' );
$this->description = esc_html__( 'Displays WooCommerce cart.', 'bloglo' );
$this->icon = 'dashicons dashicons-cart';
$this->type = 'cart';
}
/**
* Displays the form for this widget on the Widgets page of the WP Admin area.
*
* @since 1.0.0
* @return void
*/
public function form() {}
}
endif;
PK ��]{2�� �� ( woocommerce/class-bloglo-woocommerce.phpnu �[��� <?php
/**
* WooCommerce Compatibility File.
*
* @package Bloglo
* @author Peregrine Themes
* @since 1.0.0
*/
// If WooCommerce is not activated then return.
if ( ! bloglo_is_woocommerce_activated() ) {
add_action( 'activate_woocommerce/woocommerce.php', array( bloglo_dynamic_styles(), 'delete_dynamic_file' ) );
return;
}
/**
* Bloglo WooCommerce Compatibility.
*/
if ( ! class_exists( 'Bloglo_Woocommerce' ) ) :
/**
* Bloglo WooCommerce Compatibility
*
* @since 1.0.0
*/
class Bloglo_Woocommerce {
/**
* Singleton instance of the class.
*
* @since 1.0.0
* @var object
*/
private static $instance;
/**
* Main Instance.
*
* @since 1.0.0
* @return Bloglo_Woocommerce
*/
public static function instance() {
if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Bloglo_Woocommerce ) ) {
self::$instance = new Bloglo_Woocommerce();
self::$instance->includes();
self::$instance->actions();
}
return self::$instance;
}
/**
* Include files.
*
* @since 1.0.0
*/
private function includes() {
require BLOGLO_THEME_PATH . '/inc/compatibility/woocommerce/woocommerce-functions.php'; // phpcs:ignore
require BLOGLO_THEME_PATH . '/inc/compatibility/woocommerce/class-bloglo-customizer-woocommerce.php'; // phpcs:ignore
}
/**
* WooCommerce actions.
*
* @since 1.0.0
*/
private function actions() {
// Cart fragment.
if ( defined( 'WC_VERSION' ) && version_compare( WC_VERSION, '2.3', '>=' ) ) {
add_filter( 'woocommerce_add_to_cart_fragments', array( $this, 'cart_widget_count_fragment' ) );
add_filter( 'woocommerce_add_to_cart_fragments', array( $this, 'cart_widget_dropdown_fragment' ) );
} else {
add_filter( 'add_to_cart_fragments', array( $this, 'cart_widget_count_fragment' ) );
add_filter( 'add_to_cart_fragments', array( $this, 'cart_widget_dropdown_fragment' ) );
}
// Frontend actions only.
if ( ! is_admin() ) {
add_action( 'wp', array( $this, 'product_catalog_elements' ) );
// Disable WooCommerce shop title.
add_filter( 'woocommerce_show_page_title', '__return_false' );
// Disable Bloglo page description.
add_filter( 'bloglo_page_header_description', array( $this, 'shop_remove_page_description' ) );
// Remove WooCommerce content wrappers.
remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10 );
remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10 );
// Remove WooCommerce breadcrumbs.
remove_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20 );
// Extend Bloglo breadcrumb trail.
add_filter( 'bloglo_breadcrumb_trail_items', array( $this, 'breadcrumbs' ), 20, 2 );
add_filter( 'bloglo_post_type_archive_title', array( $this, 'breadcrumb_post_type_archive_title' ), 10, 2 );
// Remove WooCommerce sidebar.
remove_action( 'woocommerce_sidebar', 'woocommerce_get_sidebar' );
add_action( 'bloglo_woocommerce_sidebar', 'woocommerce_get_sidebar' );
// Add our content wrappers.
add_action( 'woocommerce_before_main_content', array( $this, 'content_wrapper_start' ), 10 );
add_action( 'woocommerce_after_main_content', array( $this, 'content_wrapper_end' ), 10 );
// Replace WooCommerce pagination with Bloglo pagination.
remove_action( 'woocommerce_after_shop_loop', 'woocommerce_pagination', 10 );
add_action( 'woocommerce_after_shop_loop', 'bloglo_pagination' );
// Add back to shop button to Empty Cart.
add_action( 'woocommerce_cart_is_empty', 'bloglo_wc_empty_cart_button' );
// Add wrapper to result count and catalog ordering.
add_action( 'woocommerce_before_shop_loop', array( $this, 'result_wrapper_start' ), 19 );
add_action( 'woocommerce_before_shop_loop', array( $this, 'result_wrapper_end' ), 31 );
// Remove opening link tag.
remove_action( 'woocommerce_before_shop_loop_item', 'woocommerce_template_loop_product_link_open', 10 );
// Add thumbnail wrapper.
add_action( 'woocommerce_before_shop_loop_item_title', array( $this, 'loop_product_thumb_wrap_start' ), 5 );
add_action( 'woocommerce_before_shop_loop_item_title', array( $this, 'loop_product_thumb_wrap_end' ), 15 );
// Add product link to thumnail.
add_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_link_open', 6 );
add_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_link_close', 13 );
// Add alternative image to display on hover.
add_action( 'woocommerce_before_shop_loop_item_title', array( $this, 'product_image_swap' ), 11 );
// Add to cart button to display on hover.
add_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_add_to_cart', 14 );
// Add wrapper to product meta details.
add_action( 'woocommerce_before_shop_loop_item_title', array( $this, 'loop_product_details_wrap_open' ), 19 );
add_action( 'woocommerce_after_shop_loop_item_title', array( $this, 'loop_product_details_wrap_end' ), 10 );
add_action( 'woocommerce_before_single_product_summary', array( $this, 'single_product_wrapper_start' ), 5 );
add_action( 'woocommerce_after_single_product_summary', array( $this, 'single_product_wrapper_end' ), 5 );
// Remove add to cart button from catalog pages.
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );
// Percentage sale badge.
add_filter( 'woocommerce_sale_flash', 'bloglo_wc_add_percentage_to_sale_badge', 20, 3 );
// Out of stock product badge.
add_action( 'woocommerce_before_shop_loop_item_title', 'bloglo_wc_out_of_stock_badge', 10 );
add_action( 'woocommerce_before_single_product_summary', 'bloglo_wc_out_of_stock_badge', 10 );
// Additional classes for add to cart button.
add_filter( 'woocommerce_loop_add_to_cart_args', array( $this, 'loop_add_to_cart_args' ) );
// Heading for checkout page order.
add_action( 'woocommerce_review_order_before_payment', array( $this, 'review_order_heading' ) );
// Remove mini cart buttons and replace with ours.
remove_action( 'woocommerce_widget_shopping_cart_buttons', 'woocommerce_widget_shopping_cart_button_view_cart', 10 );
remove_action( 'woocommerce_widget_shopping_cart_buttons', 'woocommerce_widget_shopping_cart_proceed_to_checkout', 20 );
add_action( 'woocommerce_widget_shopping_cart_buttons', 'bloglo_wc_widget_shopping_cart_buttons', 10 );
// Hide Yith wishlist - we show it in our page title anyway.
add_filter( 'yith_wcwl_wishlist_title', '__return_false', 20 );
// Remove checkout heading.
add_action( 'woocommerce_checkout_shipping', array( $this, 'checkout_shipping_heading' ), 9 );
add_filter( 'woocommerce_subcategory_count_html', 'bloglo_wc_cat_count_filter', 10, 2 );
add_filter( 'woocommerce_rating_filter_count', 'bloglo_wc_rating_count_filter', 10, 3 );
add_filter( 'woocommerce_layered_nav_count', 'bloglo_wc_layered_count_filter', 10, 3 );
// Upsell Products.
remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_upsell_display', 15 );
add_action( 'woocommerce_after_single_product_summary', array( $this, 'woocommerce_upsell_display' ), 15 );
// Related Products.
remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 20 );
add_action( 'woocommerce_after_single_product_summary', array( $this, 'woocommerce_related_products' ), 15 );
// Related products columns/count.
add_filter( 'woocommerce_output_related_products_args', array( $this, 'single_product_related_products_args' ) );
add_filter( 'woocommerce_single_product_carousel_options', array( $this, 'single_product_slider_options' ) );
// Cross-Sell products.
remove_action( 'woocommerce_cart_collaterals', 'woocommerce_cross_sell_display' );
add_action( 'woocommerce_cart_collaterals', array( $this, 'woocommerce_cross_sell_display' ) );
// Product gallery thumbnail columns.
add_filter( 'woocommerce_product_thumbnails_columns', array( $this, 'product_thumbnails_columns' ) );
}
// Enqueue styles.
add_action( 'bloglo_enqueue_scripts', array( $this, 'enqueue' ) );
// Single product actions.
add_action( 'wp_head', array( $this, 'product_actions' ), 9 );
// Register WooCommerce sidebars.
add_action( 'widgets_init', array( $this, 'register_wc_sidebars' ) );
// Add correct sidebar.
add_filter( 'bloglo_sidebar_name', array( $this, 'set_sidebar' ) );
// Set sidebar position.
add_filter( 'bloglo_default_sidebar_position', array( $this, 'set_default_sidebar_position' ) );
// Remove item from cart.
add_action( 'wp_ajax_bloglo_remove_wc_cart_item', array( $this, 'remove_item_from_cart' ) );
add_action( 'wp_ajax_nopriv_bloglo_remove_wc_cart_item', array( $this, 'remove_item_from_cart' ) );
// Add theme supports.
add_action( 'after_setup_theme', array( $this, 'theme_supports' ), 20 );
// Add customizer cart widget.
add_filter( 'bloglo_customizer_widgets', array( $this, 'add_customizer_cart_widget' ) );
add_filter( 'bloglo_main_header_widgets', array( $this, 'add_cart_to_main_header_widgets' ) );
// Loads Cart Customizer widgets class.
add_action( 'customize_register', array( $this, 'load_customizer_widget' ), 20 );
// Handle admin redirects.
add_action( 'admin_init', array( $this, 'admin_redirects' ), 9 );
// Add dynamic CSS.
add_filter( 'bloglo_dynamic_styles', array( $this, 'dynamic_css' ), 5 );
// Update dynamic styles on deactivation.
add_action( 'deactivate_woocommerce/woocommerce.php', array( bloglo_dynamic_styles(), 'delete_dynamic_file' ) );
// Return Shop page ID.
add_filter( 'bloglo_get_the_id', array( $this, 'get_the_id' ) );
add_filter( 'woocommerce_product_related_products_heading', array( $this, 'related_products_heading' ) );
}
/**
* Declare WooCommerce support.
*
* @since 1.0.0
*/
public function theme_supports() {
// Declare WooCommerce compatibility.
add_theme_support(
'woocommerce',
array(
'gallery_thumbnail_image_width' => 150,
)
);
// Product Gallery Slider.
add_theme_support( 'wc-product-gallery-slider' );
// Product Gallery Zoom.
if ( bloglo_option( 'wc_product_gallery_zoom' ) ) {
add_theme_support( 'wc-product-gallery-zoom' );
}
// Product Gallery Lightbox.
if ( bloglo_option( 'wc_product_gallery_lightbox' ) ) {
add_theme_support( 'wc-product-gallery-lightbox' );
}
}
/**
* Enqueue WooCommerce styles.
*
* @since 1.0.0
*/
public function enqueue() {
// Script debug.
$bloglo_dir = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? 'dev/' : '';
$bloglo_suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
// Enqueue WooCommerce compatibility stylesheet.
wp_enqueue_style(
'bloglo-woocommerce',
BLOGLO_THEME_URI . '/assets/css/compatibility/woocommerce' . $bloglo_suffix . '.css',
false,
BLOGLO_THEME_VERSION,
'all'
);
// Enqueue WooCommerce compatibility script.
wp_enqueue_script(
'bloglo-wc',
BLOGLO_THEME_URI . '/assets/js/' . $bloglo_dir . 'bloglo-wc' . $bloglo_suffix . '.js',
array( 'jquery' ),
BLOGLO_THEME_VERSION,
true
);
}
/**
* Add or remove actions depending on enabled product catalog elements.
*
* @return void
*/
public function product_catalog_elements() {
$elements = bloglo_option( 'product_catalog_elements' );
$hook = 'woocommerce_before_shop_loop_item_title';
$priority = 20;
if ( ! empty( $elements ) ) {
foreach ( $elements as $element => $enabled ) {
if ( 'title' === $element ) {
if ( ! $enabled ) {
remove_action( 'woocommerce_shop_loop_item_title', 'woocommerce_template_loop_product_title' );
} else {
remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_product_link_close' );
add_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_link_open', $priority );
add_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_product_link_close', 4 );
}
$hook = 'woocommerce_after_shop_loop_item_title';
$priority = 5;
} elseif ( 'ratings' === $element ) {
remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_rating', 5 );
if ( $enabled ) {
add_action( $hook, 'woocommerce_template_loop_rating', $priority );
$priority++;
}
} elseif ( 'price' === $element ) {
remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10 );
if ( $enabled ) {
add_action( $hook, 'woocommerce_template_loop_price', $priority );
$priority++;
}
} elseif ( 'category' === $element ) {
if ( $enabled ) {
add_action( $hook, array( $this, 'template_loop_category' ), $priority );
$priority++;
}
}
}
}
}
/**
* Print product categories in loop template.
*
* @return void
*/
public function template_loop_category() {
global $product;
$product_cats = wp_get_post_terms( $product->get_id(), 'product_cat' );
$cats = array();
if ( is_array( $product_cats ) && ! empty( $product_cats ) ) {
foreach ( $product_cats as $product_cat ) {
$cats[] = '<a class="bloglo-loop-product__category" href="' . esc_url( get_term_link( $product_cat, 'product_cat' ) ) . '">' . esc_html( $product_cat->name ) . '</a>';
}
}
echo '<span class="bloglo-loop-product__category-wrap">' . wp_kses_post( implode( ', ', $cats ) ) . '</span>';
}
/**
* Add start wrapper to result count and catalog ordering.
*
* @since 1.0.0
* @return void
*/
public function result_wrapper_start() {
if ( ! woocommerce_products_will_display() ) {
return;
}
echo '<div class="bloglo-woo-before-shop clearfix">';
}
/**
* Add end wrapper to result count and catalog ordering.
*
* @since 1.0.0
* @return void
*/
public function result_wrapper_end() {
if ( ! woocommerce_products_will_display() ) {
return;
}
echo '</div>';
}
/**
* Update cart count in Cart Widget via AJAX.
*
* @param array $fragments Fragments to refresh via AJAX.
* @return array Fragments to refresh via AJAX
* @since 1.0.0
*/
public function cart_widget_count_fragment( $fragments ) {
$fragments['.bloglo-header-widget__cart a.bloglo-cart'] = bloglo_wc_cart_icon( false );
return $fragments;
}
/**
* Update Cart Widget dropdown via AJAX.
*
* @param array $fragments Fragments to refresh via AJAX.
* @return array Fragments to refresh via AJAX
* @since 1.0.0
*/
public function cart_widget_dropdown_fragment( $fragments ) {
$fragments['.bloglo-header-widget__cart .dropdown-item'] = bloglo_wc_cart_dropdown( false );
return $fragments;
}
/**
* Add start of WooCommerce content wrapper.
*
* @since 1.0.0
* @return void
*/
public function content_wrapper_start() {
?>
<div class="bloglo-container">
<div id="primary" class="content-area">
<?php do_action( 'bloglo_before_content' ); ?>
<main id="content" class="site-content" role="main">
<?php
}
/**
* Add end of WooCommerce content wrapper.
*
* @since 1.0.0
* @return void
*/
public function content_wrapper_end() {
?>
</main><!-- #content .site-content -->
<?php do_action( 'bloglo_after_content' ); ?>
</div><!-- #primary .content-area -->
<?php do_action( 'bloglo_woocommerce_sidebar' ); ?>
</div><!-- END .bloglo-container -->
<?php
}
/**
* Add start of Single Product content wrapper.
*
* @since 1.0.0
* @return void
*/
public function single_product_wrapper_start() {
echo '<div class="bloglo-wc-product-wrap">';
}
/**
* Add end of Single Product content wrapper.
*
* @since 1.0.0
* @return void
*/
public function single_product_wrapper_end() {
echo '</div><!-- END .bloglo-wc-product-wrap -->';
}
/**
* Single product actions.
*
* @since 1.0.0
* @return void
*/
public function product_actions() {
if ( ! is_product() ) {
return;
}
// Remove Bloglo page title on WooCommerce product pages.
add_filter( 'bloglo_page_header_has_title', '__return_false' );
// Disable Comments toggle.
add_filter( 'bloglo_display_comments_toggle', '__return_false' );
}
/**
* Add support for Customizer cart widget.
*
* @since 1.0.0
* @param array $widgets Array of available customizer widgets.
* @return array
*/
public function add_customizer_cart_widget( $widgets ) {
$widgets['cart'] = 'Bloglo_Customizer_Widget_Cart';
return $widgets;
}
/**
* Add cart widget to Header widgets.
*
* @since 1.0.0
* @param array $widgets Array of available main header widgets.
* @return array
*/
public function add_cart_to_main_header_widgets( $widgets ) {
$widgets['cart'] = array(
'max_uses' => 1,
);
return $widgets;
}
/**
* Overwrite the items for the breadcrumb trail.
*
* @since 1.0.0
* @param array $items Array of items belonging to the current breadcrumb trail.
* @param array $args Arguments used to build the breadcrumb trail.
* @return array
*/
public function breadcrumbs( $items, $args ) {
if ( function_exists( 'is_shop' ) && is_shop() ) {
$items[ count( $items ) - 1 ] = get_the_title( wc_get_page_id( 'shop' ) );
}
return $items;
}
/**
* Overwrite the items for the breadcrumb trail.
*
* @since 1.0.0
* @param string $label Current archive label.
* @param string $post_type_name Post Type name.
* @return array
*/
public function breadcrumb_post_type_archive_title( $label, $post_type_name ) {
if ( 'product' === $post_type_name ) {
return get_the_title( wc_get_page_id( 'shop' ) );
}
return $label;
}
/**
* Register WooCommerce sidebars.
*
* @since 1.0.0
* @return void
*/
public function register_wc_sidebars() {
// Register WooCommerce Sidebar.
register_sidebar(
apply_filters(
'bloglo_woocommerce_sidebar_name',
array(
'name' => esc_html__( 'WooCommerce Sidebar', 'bloglo' ),
'id' => 'bloglo-wc-sidebar',
'description' => __( 'Widgets in this area are displayed on WooCommerce pages except Product pages.', 'bloglo' ),
'before_widget' => '<div id="%1$s" class="bloglo-sidebar-widget bloglo-widget widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h4 class="widget-title">',
'after_title' => '</h4>',
)
)
);
// Register Product Sidebar.
register_sidebar(
apply_filters(
'bloglo_woocommerce_product_sidebar_name',
array(
'name' => esc_html__( 'Product Sidebar', 'bloglo' ),
'id' => 'bloglo-wc-product-sidebar',
'description' => __( 'Widgets in this area are displayed on WooCommerce Product pages.', 'bloglo' ),
'before_widget' => '<div id="%1$s" class="bloglo-sidebar-widget bloglo-widget widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h4 class="widget-title">',
'after_title' => '</h4>',
)
)
);
}
/**
* Change sidebar name on WooCommerce pages.
*
* @since 1.0.0
* @param string $sidebar_name Sidebar name for woocmmerce pages.
* @return string
*/
public function set_sidebar( $sidebar_name ) {
if ( is_product() ) {
$sidebar_name = 'bloglo-wc-product-sidebar';
} elseif ( is_woocommerce() || is_cart() || is_checkout() ) {
$sidebar_name = 'bloglo-wc-sidebar';
}
return $sidebar_name;
}
/**
* Change default sidebar position on WooCommerce pages.
*
* @since 1.0.0
* @param string $position Sidebar position for woocmmerce pages.
* @return string
*/
public function set_default_sidebar_position( $position ) {
if ( is_product() ) {
$position = bloglo_option( 'wc_product_sidebar_position' );
} elseif ( is_woocommerce() || is_cart() || is_checkout() ) {
$position = bloglo_option( 'wc_sidebar_position' );
}
if ( is_product() || is_woocommerce() || is_cart() || is_checkout() ) {
if ( 'default' === $position ) {
return bloglo_option( 'sidebar_position' );
} else {
return $position;
}
}
return $position;
}
/**
* Remove Bloglo page description on WooCommerce pages.
*
* @since 1.0.0
* @param string $description Page description.
* @return boolean|string
*/
public function shop_remove_page_description( $description ) {
if ( is_woocommerce() ) {
return false;
}
return $description;
}
/**
* Remove item from cart.
*
* @since 1.0.0
* @return void
*/
public function remove_item_from_cart() {
check_ajax_referer( 'bloglo-nonce' );
if ( ! isset( $_POST['product_key'] ) ) {
wp_send_json_error();
}
$product_key = sanitize_text_field( wp_unslash( $_POST['product_key'] ) );
$cart = WC()->instance()->cart;
$cart_item_id = $cart->find_product_in_cart( $product_key );
if ( $cart_item_id ) {
$cart->set_quantity( $cart_item_id, 0 );
wp_send_json_success();
}
wp_send_json_error();
}
/**
* Display an alternative image (from product gallery) when hovering product image on catalog pages.
*
* @since 1.0.0
* @return void
*/
public function product_image_swap() {
global $product;
$hover_style = bloglo_option( 'shop_product_hover' );
if ( 'image-swap' === $hover_style ) {
$attachment_ids = $product->get_gallery_image_ids();
if ( $attachment_ids ) {
$image_size = apply_filters( 'single_product_archive_thumbnail_size', 'shop_catalog' ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound
$attachment_id = reset( $attachment_ids );
echo wp_kses_post( apply_filters( 'bloglo_woocommerce_product_image_swap', wp_get_attachment_image( $attachment_id, $image_size, false, array( 'class' => 'show-on-hover' ) ) ) );
}
}
}
/**
* Add start wrapper for loop product thumbnail.
*
* @since 1.0.0
* @return void
*/
public function loop_product_thumb_wrap_start() {
$class = 'bloglo-product-thumb';
if ( 'image-swap' === bloglo_option( 'shop_product_hover' ) ) {
global $product;
$attachment_ids = $product->get_gallery_image_ids();
if ( $attachment_ids ) {
$class .= ' swap-on-hover';
}
}
echo '<div class="' . esc_attr( $class ) . '">';
}
/**
* Add end wrapper for loop product thumbnail.
*
* @since 1.0.0
* @return void
*/
public function loop_product_thumb_wrap_end() {
echo '</div><!-- END .bloglo-product-thumb -->';
}
/**
* Add start wrapper for loop product details.
*
* @since 1.0.0
* @return void
*/
public function loop_product_details_wrap_open() {
echo '<div class="meta-wrap">';
}
/**
* Add end wrapper for loop product details.
*
* @since 1.0.0
* @return void
*/
public function loop_product_details_wrap_end() {
echo '</div>';
}
/**
* Additional classes for add to cart button on loop products.
*
* @since 1.0.0
* @param array $args Arguments for add to cart button in loop products.
* @return array
*/
public function loop_add_to_cart_args( $args ) {
$args['class'] .= ' bloglo-btn';
return $args;
}
/**
* Loads Customizer widgets classes.
*
* @since 1.0.0
* @return void
*/
public function load_customizer_widget() {
$path = BLOGLO_THEME_PATH . '/inc/compatibility/woocommerce/class-bloglo-customizer-widget-cart.php';
if ( file_exists( $path ) ) {
require $path; // phpcs:ignore
}
}
/**
* Review order heading.
*
* @since 1.0.0
* @return void
*/
public function review_order_heading() {
echo wp_kses_post( apply_filters( 'bloglo_review_order_heading', '<h3>' . __( 'Payment', 'bloglo' ) . '</h3>' ) );
}
/**
* Display a heading on Checkout / Shipping.
*
* @since 1.0.0
* @return void
*/
public function checkout_shipping_heading() {
if ( true !== WC()->cart->needs_shipping_address() ) {
return;
}
echo wp_kses_post( apply_filters( 'bloglo_checkout_shipping_heading', '<h3>' . __( 'Shipping', 'bloglo' ) . '</h3>' ) );
}
/**
* Related products column count.
*
* @since 1.0.0
* @param array $args Arguments for related products on single product page.
* @return array
*/
public function single_product_related_products_args( $args ) {
$columns = intval( bloglo_option( 'wc_related_columns' ) );
$rows = intval( bloglo_option( 'wc_related_rows' ) );
$args['posts_per_page'] = $columns * $rows;
$args['columns'] = $columns;
return $args;
}
/**
* Cross-Sell Products.
*
* @since 1.0.0
* @return void
*/
public function woocommerce_cross_sell_display() {
// Check if cross-sells are enabled.
if ( bloglo_option( 'wc_cross_sell_products' ) ) {
$rows = intval( bloglo_option( 'wc_cross_sell_rows' ) );
woocommerce_cross_sell_display( 2 * $rows, 2 );
}
}
/**
* Upsell Products.
*
* @since 1.0.0
* @return void
*/
public function woocommerce_upsell_display() {
// Check if upsells are enabled.
if ( bloglo_option( 'wc_upsell_products' ) ) {
$columns = intval( bloglo_option( 'wc_upsells_columns' ) );
$rows = intval( bloglo_option( 'wc_upsells_rows' ) );
woocommerce_upsell_display( $columns * $rows, $columns );
}
}
/**
* Related Products.
*
* @since 1.0.0
* @return void
*/
public function woocommerce_related_products() {
// Check if related products are enabled.
if ( bloglo_option( 'wc_related_products' ) ) {
woocommerce_output_related_products();
}
}
/**
* Add arrows to product slider on single product.
*
* @since 1.0.0
* @param array $options Array of options for product slider.
* @return array
*/
public function single_product_slider_options( $options ) {
if ( ! bloglo_option( 'wc_product_slider_arrows' ) ) {
return $options;
}
$options['directionNav'] = true;
$options['prevText'] = bloglo_animated_arrow( 'left', false );
$options['nextText'] = bloglo_animated_arrow( 'right', false );
return $options;
}
/**
* Product gallery thumbnail columns.
*
* @since 1.0.0
* @param integer $columns Number of product thumnail columns on single product page.
* @return integer
*/
public function product_thumbnails_columns( $columns ) {
return 5;
}
/**
* Related products heading on single product pages.
*
* @since 1.0.0
* @param string $heading Related products heading.
* @return string
*/
public function related_products_heading( $heading ) {
return __( 'Related Products', 'bloglo' );
}
/**
* Handle redirects to setup/welcome page after install and updates.
*
* @since 1.0.0
*
* @return void
*/
public function admin_redirects() {
$current_page = isset( $_GET['page'] ) ? wc_clean( wp_unslash( $_GET['page'] ) ) : false; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification
// Prevent WooCommerce automatic wizard redirect.
if ( false !== strpos( $current_page, 'bloglo' ) ) {
add_filter( 'woocommerce_prevent_automatic_wizard_redirect', '__return_true' );
}
}
/**
* Generates dynamic CSS code for woocommerce.
*
* @param string $css Dynamic CSS code generated by the theme.
* @return string Modified CSS code.
* @since 1.0.0
*/
public function dynamic_css( $css ) {
// Accent Color.
$accent_color = bloglo_option( 'accent_color' );
$css .= '';
// Content text color.
$content_text_color = bloglo_option( 'content_text_color' );
$css .= '
.bloglo-cart-item .bloglo-x,
.woocommerce form.login .lost_password a,
.woocommerce form.register .lost_password a,
.woocommerce a.remove,
#add_payment_method .cart-collaterals .cart_totals .woocommerce-shipping-destination,
.woocommerce-cart .cart-collaterals .cart_totals .woocommerce-shipping-destination,
.woocommerce-checkout .cart-collaterals .cart_totals .woocommerce-shipping-destination,
.woocommerce ul.products li.product .bloglo-loop-product__category-wrap a,
.woocommerce ul.products li.product .bloglo-loop-product__category-wrap,
.woocommerce .woocommerce-checkout-review-order table.shop_table thead th,
#add_payment_method #payment div.payment_box,
.woocommerce-cart #payment div.payment_box,
.woocommerce-checkout #payment div.payment_box,
#add_payment_method #payment ul.payment_methods .about_paypal,
.woocommerce-cart #payment ul.payment_methods .about_paypal,
.woocommerce-checkout #payment ul.payment_methods .about_paypal,
.woocommerce table dl,
.woocommerce table .wc-item-meta,
.widget.woocommerce .reviewer,
.woocommerce.widget_shopping_cart .cart_list li a.remove:before,
.woocommerce .widget_shopping_cart .cart_list li a.remove:before,
.woocommerce .widget_shopping_cart .cart_list li .quantity,
.woocommerce.widget_shopping_cart .cart_list li .quantity,
.woocommerce div.product .woocommerce-product-rating .woocommerce-review-link,
.woocommerce div.product .woocommerce-tabs table.shop_attributes td,
.woocommerce div.product .product_meta > span span:not(.bloglo-woo-meta-title),
.woocommerce div.product .product_meta > span a,
.woocommerce .star-rating::before,
.woocommerce div.product #reviews #comments ol.commentlist li .comment-text p.meta,
.ywar_review_count,
.woocommerce .add_to_cart_inline del,
.woocommerce div.product p.price del,
.woocommerce div.product span.price del,
.woocommerce #yith-wcwl-form table.shop_table thead,
.woocommerce .woocommerce-cart-form table.shop_table thead,
.woocommerce .woocommerce-checkout-review-order table.shop_table thead,
.woocommerce div.product .woocommerce-tabs ul.tabs li a {
color: ' . bloglo_hex2rgba( $content_text_color, 0.73 ) . ';
}
.woocommerce-message,
.woocommerce-error,
.woocommerce-info,
.woocommerce-message,
.woocommerce div.product .woocommerce-tabs ul.tabs li:not(.active) a:hover {
color: ' . $content_text_color . ';
}
.woocommerce div.product .woocommerce-product-gallery .flex-direction-nav svg path {
fill: ' . $content_text_color . ' !important;
}
';
// Background Color - generated from text color.
$background_color = bloglo_get_background_color();
$css .= '
.woocommerce div.product .woocommerce-product-gallery .flex-direction-nav .flex-prev,
.woocommerce div.product .woocommerce-product-gallery .flex-direction-nav .flex-next,
.woocommerce .quantity .bloglo-woo-minus,
.woocommerce .quantity .bloglo-woo-plus {
background-color: ' . $background_color . ';
}
';
$content_text_color_offset = bloglo_light_or_dark( $background_color, bloglo_luminance( $background_color, -0.045 ), bloglo_luminance( $background_color, 0.2 ) );
$css .= '
.woocommerce #yith-wcwl-form table.shop_table thead th,
.woocommerce .woocommerce-cart-form table.shop_table thead th,
.woocommerce .woocommerce-checkout-review-order table.shop_table thead th,
.woocommerce .cart_totals table.shop_table .order-total th,
.woocommerce .cart_totals table.shop_table .order-total td,
.woocommerce div.product .woocommerce-tabs .wc-tab,
#page .woocommerce-error,
#page .woocommerce-info,
#page .woocommerce-message,
.woocommerce div.product .woocommerce-tabs ul.tabs:before,
.woocommerce div.product .woocommerce-tabs ul.tabs:after {
background-color: ' . $content_text_color_offset . ';
}
';
// Border color.
$css .= '
.woocommerce #yith-wcwl-form table.shop_table th:first-child,
.woocommerce #yith-wcwl-form table.shop_table td:first-child,
.woocommerce .woocommerce-cart-form table.shop_table th:first-child,
.woocommerce .woocommerce-cart-form table.shop_table td:first-child,
.woocommerce .woocommerce-checkout-review-order table.shop_table th:first-child,
.woocommerce .woocommerce-checkout-review-order table.shop_table td:first-child,
.woocommerce #yith-wcwl-form table.shop_table td,
.woocommerce .woocommerce-cart-form table.shop_table td,
.woocommerce .woocommerce-checkout-review-order table.shop_table td,
.woocommerce #yith-wcwl-form table.shop_table tr:nth-last-child(2) td,
.woocommerce .woocommerce-cart-form table.shop_table tr:nth-last-child(2) td,
.woocommerce .cart_totals table.shop_table,
.woocommerce .cart_totals table.shop_table th,
.woocommerce .cart_totals table.shop_table td {
border-color: ' . $content_text_color_offset . ';
}
';
// Content link hover color.
$css .= '
#add_payment_method #payment ul.payment_methods .about_paypal:hover,
.bloglo-woo-before-shop select.custom-select-loaded:hover ~ #bloglo-orderby,
.woocommerce-cart #payment ul.payment_methods .about_paypal:hover,
.woocommerce-checkout #payment ul.payment_methods .about_paypal:hover,
.woocommerce div.product .woocommerce-product-rating .woocommerce-review-link:hover,
.woocommerce ul.products li.product .meta-wrap .woocommerce-loop-product__link:hover,
.woocommerce ul.products li.product .bloglo-loop-product__category-wrap a:hover {
color: ' . bloglo_option( 'content_link_hover_color' ) . ';
}
';
/**
* Header.
*/
// Background.
$header_background = bloglo_option( 'header_background' );
if ( 'color' === $header_background['background-type'] && $header_background['background-color'] ) {
$css .= '
.bloglo-header-widget__cart .bloglo-cart .bloglo-cart-count {
border: 2px solid ' . $header_background['background-color'] . ';
}
';
}
/**
* Typography.
*/
// Headings.
$css .= bloglo_dynamic_styles()->get_typography_field_css( '.woocommerce div.product h1.product_title, .woocommerce #reviews #comments h2, .woocommerce .cart_totals h2, .woocommerce .cross-sells > h4, .woocommerce #reviews #respond .comment-reply-title', 'headings_font' );
$css .= bloglo_dynamic_styles()->get_typography_field_css( '.woocommerce div.product h1.product_title', 'h2_font' );
$css .= bloglo_dynamic_styles()->get_typography_field_css( '.woocommerce #reviews #comments h2', 'h3_font' );
$css .= bloglo_dynamic_styles()->get_typography_field_css( '.woocommerce .cart_totals h2, .woocommerce .cross-sells > h4, .woocommerce #reviews #respond .comment-reply-title', 'h4_font' );
return $css;
}
/**
* Return post ID.
*
* @param int $post_id Post ID.
* @return int Modified post ID.
*/
public function get_the_id( $post_id ) {
if ( is_shop() ) {
$post_id = wc_get_page_id( 'shop' );
}
return $post_id;
}
}
endif;
if ( ! function_exists( 'bloglo_woocommerce' ) ) :
/**
* The function which returns the one Bloglo_Woocommerce instance.
*
* @since 1.0.0
* @return object
*/
function bloglo_woocommerce() {
return Bloglo_Woocommerce::instance();
}
endif;
bloglo_woocommerce();
PK ��]�-D D class-bloglo-beaver-themer.phpnu �[��� <?php
/**
* Bloglo compatibility class for Beaver Themer.
*
* @package Bloglo
* @author Peregrine Themes
* @since 1.0.0
*/
/**
* Do not allow direct script access.
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
// Return if Beaver Themer not active.
if ( ! class_exists( 'FLThemeBuilderLoader' ) || ! class_exists( 'FLThemeBuilderLayoutData' ) ) {
return;
}
// PHP 5.3+ is required.
if ( ! version_compare( PHP_VERSION, '5.3', '>=' ) ) {
return;
}
if ( ! class_exists( 'Bloglo_Beaver_Themer' ) ) :
/**
* Beaver Themer compatibility.
*/
class Bloglo_Beaver_Themer {
/**
* Singleton instance of the class.
*
* @var object
*/
private static $instance;
/**
* Instance.
*
* @since 1.0.0
* @return Bloglo_Beaver_Themer
*/
public static function instance() {
if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Bloglo_Beaver_Themer ) ) {
self::$instance = new Bloglo_Beaver_Themer();
}
return self::$instance;
}
/**
* Primary class constructor.
*
* @since 1.0.0
* @return void
*/
public function __construct() {
add_action( 'after_setup_theme', array( $this, 'add_theme_support' ) );
add_action( 'wp', array( $this, 'header_footer_render' ) );
add_action( 'wp', array( $this, 'page_header_render' ) );
add_filter( 'fl_theme_builder_part_hooks', array( $this, 'register_part_hooks' ) );
}
/**
* Add theme support
*
* @since 1.0.0
*/
public function add_theme_support() {
add_theme_support( 'fl-theme-builder-headers' );
add_theme_support( 'fl-theme-builder-footers' );
add_theme_support( 'fl-theme-builder-parts' );
}
/**
* Update header/footer with Beaver template
*
* @since 1.0.0
*/
public function header_footer_render() {
// Get the header ID.
$header_ids = FLThemeBuilderLayoutData::get_current_page_header_ids();
// If we have a header, remove the theme header and hook in Theme Builder's.
if ( ! empty( $header_ids ) ) {
// Remove Top Bar.
remove_action( 'bloglo_header', 'bloglo_topbar_output', 10 );
// Remove Main Header.
remove_action( 'bloglo_header', 'bloglo_header_output', 20 );
// Replacement header.
add_action( 'bloglo_header', 'FLThemeBuilderLayoutRenderer::render_header' );
}
// Get the footer ID.
$footer_ids = FLThemeBuilderLayoutData::get_current_page_footer_ids();
// If we have a footer, remove the theme footer and hook in Theme Builder's.
if ( ! empty( $footer_ids ) ) {
// Remove Main Footer.
remove_action( 'bloglo_footer', 'bloglo_footer_output', 20 );
// Remove Copyright Bar.
remove_action( 'bloglo_footer', 'bloglo_copyright_bar_output', 30 );
// Replacement footer.
add_action( 'bloglo_footer', 'FLThemeBuilderLayoutRenderer::render_footer' );
}
}
/**
* Remove page header if using Beaver Themer.
*
* @since 1.0.0
*/
public function page_header_render() {
// Get the page ID.
$page_ids = FLThemeBuilderLayoutData::get_current_page_content_ids();
// If we have a content layout, remove the theme page header.
if ( ! empty( $page_ids ) ) {
remove_action( 'bloglo_page_header', 'bloglo_page_header_template' );
}
}
/**
* Register hooks
*
* @since 1.0.0
*/
public function register_part_hooks() {
return array(
array(
'label' => 'Header',
'hooks' => array(
'bloglo_before_masthead' => esc_html__( 'Before Header', 'bloglo' ),
'bloglo_after_masthead' => esc_html__( 'After Header', 'bloglo' ),
),
),
array(
'label' => 'Main',
'hooks' => array(
'bloglo_before_main' => esc_html__( 'Before Main', 'bloglo' ),
'bloglo_after_main' => esc_html__( 'After Main', 'bloglo' ),
),
),
array(
'label' => 'Content',
'hooks' => array(
'bloglo_before_page_content' => esc_html__( 'Before Content', 'bloglo' ),
'bloglo_after_page_content' => esc_html__( 'After Content', 'bloglo' ),
),
),
array(
'label' => 'Footer',
'hooks' => array(
'bloglo_before_colophon' => esc_html__( 'Before Footer', 'bloglo' ),
'bloglo_after_colophon' => esc_html__( 'After Footer', 'bloglo' ),
),
),
array(
'label' => 'Sidebar',
'hooks' => array(
'bloglo_before_sidebar' => esc_html__( 'Before Sidebar', 'bloglo' ),
'bloglo_after_sidebar' => esc_html__( 'After Sidebar', 'bloglo' ),
),
),
array(
'label' => 'Singular',
'hooks' => array(
'bloglo_before_singular' => __( 'Before Singular', 'bloglo' ),
'bloglo_after_singular' => __( 'After Singular', 'bloglo' ),
'bloglo_before_comments' => __( 'Before Comments', 'bloglo' ),
'bloglo_after_comments' => __( 'After Comments', 'bloglo' ),
'bloglo_before_single_content' => __( 'Before Single Content', 'bloglo' ),
'bloglo_after_single_content' => __( 'After Single Content', 'bloglo' ),
),
),
);
}
}
endif;
/**
* Returns the one Bloglo_Beaver_Themer instance.
*/
function bloglo_beaver_themer() {
return Bloglo_Beaver_Themer::instance();
}
bloglo_beaver_themer();
PK ��]ן2?�
�
class-bloglo-jetpack.phpnu �[��� <?php
/**
* Jetpack compatibility class.
*
* @package Bloglo
* @author Peregrine Themes
* @since 1.0.0
*/
/**
* Do not allow direct script access.
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
// Check if Jetpack is installed & activated.
if ( ! class_exists( 'Jetpack' ) ) {
return;
}
if ( ! class_exists( 'Bloglo_Jetpack' ) ) :
/**
* Jetpack compatibility class.
*/
class Bloglo_Jetpack {
/**
* Primary class constructor.
*
* @since 1.0.0
*/
public function __construct() {
add_action( 'after_setup_theme', array( $this, 'jetpack_supports' ) );
add_filter( 'infinite_scroll_credit', array( $this, 'tweak_credits_link' ) );
add_filter( 'infinite_scroll_js_settings', array( $this, 'filter_infinite_scroll_js_settings' ) );
}
/**
* Add Jetpack theme supports.
*
* @since 1.0.0
*/
public function jetpack_supports() {
/**
* Add theme support for Infinite Scroll.
*/
add_theme_support(
'infinite-scroll',
array(
'container' => 'content',
'render' => array( $this, 'infinite_scroll_render' ),
'footer' => 'page',
'posts_per_page' => get_option( 'posts_per_page' ), // phpcs:ignore WordPress.WP.PostsPerPage.posts_per_page_posts_per_page
'type' => 'click',
)
);
/**
* Add theme support for Responsive Videos.
*/
add_theme_support( 'jetpack-responsive-videos' );
/**
* Add theme support for geo-location.
*/
add_theme_support( 'jetpack-geo-location' );
}
/**
* Custom render function for Infinite Scroll.
*
* @since 1.0.0
*/
public function infinite_scroll_render() {
// WooCommerce products.
if ( function_exists( 'is_shop' ) && is_shop() || function_exists( 'is_product_taxonomy' ) && is_product_taxonomy() ) {
// Shop & category pages handled by default.
return;
} else {
while ( have_posts() ) :
the_post();
get_template_part( 'template-parts/content/content', bloglo_get_article_feed_layout() );
endwhile;
}
}
/**
* Tweak footer credits bar link.
*
* @since 1.0.0
*/
public function tweak_credits_link() {
return '<a href="https://wordpress.org/" rel="noopener noreferrer" target="_blank">' . esc_html__( 'Proudly powered by WordPress', 'bloglo' ) . '</a> | <a href="https://peregrine-themes.com/" rel="noopener noreferrer" target="_blank">Peregrine Themes</a>';
}
/**
* Filter Jetpack infinite scroll JS settings.
*
* @since 1.0.0
* @param array $settings Infinite Scroll JS settings.
*/
public function filter_infinite_scroll_js_settings( $settings ) {
$settings['text'] = esc_html__( 'Load More', 'bloglo' );
return $settings;
}
}
endif;
new Bloglo_Jetpack();
PK ��]�^�6 6 # socialsnap/socialsnap-functions.phpnu �[��� <?php
/**
* Bloglo Social Snap compatibility functions.
*
* @package Bloglo
* @author Peregrine Themes
* @since 1.0.0
*/
if ( ! function_exists( 'bloglo_entry_meta_shares' ) ) :
/**
* Add share count information to entry meta.
*
* @since 1.0.0
*/
function bloglo_entry_meta_shares() {
$share_count = socialsnap_get_total_share_count();
// Icon.
$icon = bloglo()->icons->get_meta_icon( 'share', bloglo()->icons->get_svg( 'share-2', array( 'aria-hidden' => 'true' ) ) );
$output = sprintf(
'<span class="share-count">%3$s%1$s %2$s</span>',
socialsnap_format_number( $share_count ),
esc_html( _n( 'Share', 'Shares', $share_count, 'bloglo' ) ),
$icon
);
echo wp_kses( apply_filters( 'bloglo_entry_share_count', $output ), bloglo_get_allowed_html_tags() );
}
endif;
PK ��]J$�`�
�
&