| 1 |
<?php |
| 2 |
/** |
| 3 |
* The public-facing functionality of the module. |
| 4 |
* |
| 5 |
* @link https://codesupply.co |
| 6 |
* @since 1.0.0 |
| 7 |
* |
| 8 |
* @package Powerkit |
| 9 |
* @subpackage Modules/public |
| 10 |
*/ |
| 11 |
|
| 12 |
/** |
| 13 |
* The public-facing functionality of the module. |
| 14 |
*/ |
| 15 |
class Powerkit_Lightbox_Public extends Powerkit_Module_Public { |
| 16 |
|
| 17 |
/** |
| 18 |
* Register the stylesheets for the public-facing side of the site. |
| 19 |
*/ |
| 20 |
public function wp_enqueue_scripts() { |
| 21 |
// Styles. |
| 22 |
wp_enqueue_style( 'powerkit-lightbox', powerkit_style( plugin_dir_url( __FILE__ ) . 'css/public-powerkit-lightbox.css' ), array(), powerkit_get_setting( 'version' ), 'all' ); |
| 23 |
|
| 24 |
// Add RTL support. |
| 25 |
wp_style_add_data( 'powerkit-lightbox', 'rtl', 'replace' ); |
| 26 |
|
| 27 |
// Scripts. |
| 28 |
wp_enqueue_script( 'magnific-popup', plugin_dir_url( __FILE__ ) . 'js/jquery.magnific-popup.min.js', array( 'jquery', 'imagesloaded' ), powerkit_get_setting( 'version' ), true ); |
| 29 |
|
| 30 |
wp_enqueue_script( 'powerkit-lightbox', plugin_dir_url( __FILE__ ) . 'js/public-powerkit-lightbox.js', array( 'jquery', 'imagesloaded' ), powerkit_get_setting( 'version' ), true ); |
| 31 |
|
| 32 |
$single_image_selectors = get_option( 'powerkit_lightbox_single_image_selectors', array( '.entry-content img' ) ); |
| 33 |
$gallery_selectors = get_option( 'powerkit_lightbox_gallery_selectors', array( '.wp-block-gallery', '.gallery' ) ); |
| 34 |
$exclude_selectors = get_option( 'powerkit_lightbox_exclude_selectors', array() ); |
| 35 |
|
| 36 |
$single_image_selectors = powerkit_lightbox_process_selectors( $single_image_selectors ); |
| 37 |
$gallery_selectors = powerkit_lightbox_process_selectors( $gallery_selectors ); |
| 38 |
$exclude_selectors = powerkit_lightbox_process_selectors( $exclude_selectors ); |
| 39 |
|
| 40 |
$single_image_selectors = apply_filters( 'powerkit_lightbox_image_selectors', $single_image_selectors ); |
| 41 |
$gallery_selectors = apply_filters( 'powerkit_lightbox_gallery_selectors', $gallery_selectors ); |
| 42 |
$exclude_selectors = apply_filters( 'powerkit_lightbox_exclude_selectors', $exclude_selectors ); |
| 43 |
|
| 44 |
wp_localize_script( 'powerkit-lightbox', 'powerkit_lightbox_localize', array( |
| 45 |
'text_previous' => esc_html__( 'Previous', 'powerkit' ), |
| 46 |
'text_next' => esc_html__( 'Next', 'powerkit' ), |
| 47 |
'text_close' => esc_html__( 'Close', 'powerkit' ), |
| 48 |
'text_loading' => esc_html__( 'Loading', 'powerkit' ), |
| 49 |
'text_counter' => esc_html__( 'of', 'powerkit' ), |
| 50 |
'single_image_selectors' => implode( ',', $single_image_selectors ), |
| 51 |
'gallery_selectors' => implode( ',', $gallery_selectors ), |
| 52 |
'exclude_selectors' => implode( ',', $exclude_selectors ), |
| 53 |
'zoom_icon' => get_option( 'powerkit_lightbox_zoom_icon', true ), |
| 54 |
) ); |
| 55 |
} |
| 56 |
} |
| 57 |
|