| 1 |
<?php |
| 2 |
/** |
| 3 |
* Render Front End. |
| 4 |
* |
| 5 |
* @link https://codesupply.co |
| 6 |
* @since 1.0.0 |
| 7 |
* |
| 8 |
* @package Sight |
| 9 |
*/ |
| 10 |
|
| 11 |
/** |
| 12 |
* The initialize block. |
| 13 |
*/ |
| 14 |
class Sight_Frontend_Render { |
| 15 |
|
| 16 |
/** |
| 17 |
* Initialize |
| 18 |
*/ |
| 19 |
public function __construct() { |
| 20 |
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); |
| 21 |
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); |
| 22 |
add_filter( 'powerkit_pinit_exclude_selectors', array( $this, 'sight_pinit_exclude_selector' ) ); |
| 23 |
add_filter( 'powerkit_lightbox_exclude_selectors', array( $this, 'sight_lightbox_exclude_selector' ) ); |
| 24 |
add_filter( 'pk_toc_exclude', array( $this, 'sight_toc_exclude_selectors' ) ); |
| 25 |
} |
| 26 |
|
| 27 |
/** |
| 28 |
* Enqueue the block's assets for the editor. |
| 29 |
*/ |
| 30 |
public function enqueue_scripts() { |
| 31 |
|
| 32 |
// Scripts. |
| 33 |
wp_register_script( |
| 34 |
'magnific-popup', |
| 35 |
SIGHT_URL . 'render/js/jquery.magnific-popup.min.js', |
| 36 |
array( 'jquery', 'imagesloaded' ), |
| 37 |
filemtime( SIGHT_PATH . 'render/js/jquery.magnific-popup.min.js' ), |
| 38 |
true |
| 39 |
); |
| 40 |
|
| 41 |
wp_register_script( |
| 42 |
'sight-block-script', |
| 43 |
SIGHT_URL . 'render/js/sight.js', |
| 44 |
array( 'jquery', 'imagesloaded', 'magnific-popup' ), |
| 45 |
filemtime( SIGHT_PATH . 'render/js/sight.js' ), |
| 46 |
true |
| 47 |
); |
| 48 |
|
| 49 |
wp_enqueue_script( 'sight-block-script' ); |
| 50 |
|
| 51 |
wp_localize_script( 'sight-block-script', 'sight_lightbox_localize', array( |
| 52 |
'text_previous' => esc_html__( 'Previous', 'sight' ), |
| 53 |
'text_next' => esc_html__( 'Next', 'sight' ), |
| 54 |
'text_close' => esc_html__( 'Close', 'sight' ), |
| 55 |
'text_loading' => esc_html__( 'Loading', 'sight' ), |
| 56 |
'text_counter' => esc_html__( 'of', 'sight' ), |
| 57 |
) ); |
| 58 |
|
| 59 |
// Styles. |
| 60 |
wp_enqueue_style( |
| 61 |
'magnific-popup', |
| 62 |
SIGHT_URL . 'render/css/magnific-popup.css', |
| 63 |
array(), |
| 64 |
filemtime( SIGHT_PATH . 'render/css/magnific-popup.css' ) |
| 65 |
); |
| 66 |
|
| 67 |
wp_enqueue_style( |
| 68 |
'sight', |
| 69 |
SIGHT_URL . 'render/css/sight.css', |
| 70 |
array(), |
| 71 |
filemtime( SIGHT_PATH . 'render/css/sight.css' ) |
| 72 |
); |
| 73 |
|
| 74 |
wp_enqueue_style( |
| 75 |
'sight-common', |
| 76 |
SIGHT_URL . 'render/css/sight-common.css', |
| 77 |
array(), |
| 78 |
filemtime( SIGHT_PATH . 'render/css/sight-common.css' ) |
| 79 |
); |
| 80 |
|
| 81 |
wp_enqueue_style( |
| 82 |
'sight-lightbox', |
| 83 |
SIGHT_URL . 'render/css/sight-lightbox.css', |
| 84 |
array(), |
| 85 |
filemtime( SIGHT_PATH . 'render/css/sight-lightbox.css' ) |
| 86 |
); |
| 87 |
|
| 88 |
wp_enqueue_style( |
| 89 |
'sight-layout-standard', |
| 90 |
SIGHT_URL . 'render/css/sight-layout-standard.css', |
| 91 |
array(), |
| 92 |
filemtime( SIGHT_PATH . 'render/css/sight-layout-standard.css' ) |
| 93 |
); |
| 94 |
|
| 95 |
wp_style_add_data( 'sight', 'rtl', 'replace' ); |
| 96 |
wp_style_add_data( 'sight-common', 'rtl', 'replace' ); |
| 97 |
wp_style_add_data( 'sight-layout-standard', 'rtl', 'replace' ); |
| 98 |
} |
| 99 |
|
| 100 |
/** |
| 101 |
* PinIt exclude selectors |
| 102 |
* |
| 103 |
* @param string $selectors List selectors. |
| 104 |
*/ |
| 105 |
public function sight_pinit_exclude_selector( $selectors ) { |
| 106 |
$selectors[] = '.sight-portfolio-entry-link-page'; |
| 107 |
|
| 108 |
return $selectors; |
| 109 |
} |
| 110 |
|
| 111 |
/** |
| 112 |
* Powerkit Lightbox exclude selector |
| 113 |
* |
| 114 |
* @param string $selectors List selectors. |
| 115 |
*/ |
| 116 |
public function sight_lightbox_exclude_selector( $selectors ) { |
| 117 |
$selectors[] = '.sight-portfolio-area'; |
| 118 |
|
| 119 |
return $selectors; |
| 120 |
} |
| 121 |
|
| 122 |
/** |
| 123 |
* Add exclude selectors of TOC |
| 124 |
* |
| 125 |
* @param string $list List selectors. |
| 126 |
*/ |
| 127 |
public function sight_toc_exclude_selectors( $list ) { |
| 128 |
$list .= '|.sight-portfolio-entry__heading'; |
| 129 |
|
| 130 |
return $list; |
| 131 |
} |
| 132 |
|
| 133 |
} |
| 134 |
|
| 135 |
new Sight_Frontend_Render(); |
| 136 |
|