????
| Current Path : /home2/morganrand/www/wp-content/themes/wanderfuls-2/framework/classes/ |
| Current File : /home2/morganrand/www/wp-content/themes/wanderfuls-2/framework/classes/ilightbox.php |
<?php
/**
* iLightbox class
*
* @package Wanderfuls WordPress Theme
* @subpackage Framework
*/
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
// Start Class
if ( ! class_exists( 'TB_iLightbox' ) ) {
class TB_iLightbox {
/**
* Main constructor
*
* @since 2.1.0
*/
public function __construct() {
// Add actions
add_action( 'wp_enqueue_scripts', array( $this, 'register_style_sheets' ), 20 );
// Add filters
add_filter( 'tb_localize_array', array( $this, 'localize' ) );
}
/**
* Localize scripts
*
* @since 2.1.0
*/
public function localize( $array ) {
// Add lightbox settings to array
$array['iLightbox'] = array(
'skin' => tb_global_obj( 'lightbox_skin' ),
'path' => 'horizontal',
'controls' => array(
'arrows' => tb_get_mod( 'lightbox_arrows', true ),
'thumbnail' => tb_get_mod( 'lightbox_thumbnails', true ),
'fullscreen' => tb_get_mod( 'lightbox_fullscreen', true ),
'mousewheel' => tb_get_mod( 'lightbox_mousewheel', false ),
),
'effects' => array(
'loadedFadeSpeed' => 50,
'fadeSpeed' => 500,
),
'show' => array(
'title' => tb_get_mod( 'lightbox_titles', true ),
'speed' => 200,
),
'hide' => array(
'speed' => 200,
),
'overlay' => array(
'blur' => true,
'opacity' => 0.9,
),
'social' => array(
'start' => true,
'show' => 'mouseenter',
'hide' => 'mouseleave',
'buttons' => false,
),
/*'social' => array(
'buttons' => array(
'facebook' => array(
'text' => 'Facebook'
),
'twitter' => array(
'text' => 'Twitter'
),
'googleplus' => array(
'text' => 'Google Plus'
),
'pinterest' => array(
'text' => 'Pinterest',
'source' => 'https://www.pinterest.com/pin/create/button/?url={URL}',
),
),
),*/
);
// Return array
return $array;
}
/**
* Holds an array of lightbox skins
*
* @since 2.1.0
*/
public static function skins() {
return apply_filters( 'tb_ilightbox_skins', array(
'minimal' => __( 'Minimal', 'tb' ),
//'modern' => __( 'Modern', 'tb' ), // COMING SOON
'white' => __( 'White', 'tb' ),
'dark' => __( 'Dark', 'tb' ),
'light' => __( 'Light', 'tb' ),
'mac' => __( 'Mac', 'tb' ),
'metro-black' => __( 'Metro Black', 'tb' ),
'metro-white' => __( 'Metro White', 'tb' ),
'parade' => __( 'Parade', 'tb' ),
'smooth' => __( 'Smooth', 'tb' ),
) );
}
/**
* Returns active lightbox skin
*
* @since 2.1.0
*/
public static function active_skin() {
// Get skin from Customizer setting
$skin = tb_get_mod( 'lightbox_skin', 'minimal' );
// Sanitize
$skin = $skin ? $skin : 'minimal';
// Apply filters
$skin = apply_filters( 'tb_lightbox_skin', $skin );
// Return
return $skin;
}
/**
* Returns correct skin stylesheet
*
* @since 2.1.0
*/
public static function skin_style( $skin = null ) {
// Sanitize skin
if ( ! $skin ) {
$skin = self::active_skin();
}
// Loop through skins
$stylesheet = TB_CSS_DIR_URI .'ilightbox/'. $skin .'/ilightbox-'. $skin .'-skin.css';
// Apply filters
$stylesheet = apply_filters( 'tb_ilightbox_stylesheet', $stylesheet );
// Return directory uri
return $stylesheet;
}
/**
* Enqueues iLightbox skin stylesheet
*
* @since 2.1.0
*/
public static function enqueue_style( $skin = null ) {
// Get default skin if custom skin not defined
$skin = ( $skin && 'default' != $skin ) ? $skin : self::active_skin();
// Enqueue stylesheet
wp_enqueue_style( 'tb-ilightbox-'. $skin );
}
/**
* Registers all stylesheets for quick usage and enqueues default skin for the whole site
*
* @since 2.1.0
*/
public function register_style_sheets() {
// Register skins
foreach( self::skins() as $key => $val ) {
wp_register_style( 'tb-ilightbox-'. $key, $this->skin_style( $key ), false, TB_THEME_VERSION );
}
}
/**
* Loads the stylesheet
*
* @since 2.1.0
*/
public function load_css() {
self::enqueue_style();
}
}
}
new TB_iLightbox();
/* Helper functions
-------------------------------------------------------------------------------*/
/**
* Returns array of ilightbox Skins
*
* @since 2.0.0
*/
function tb_ilightbox_skins() {
return TB_iLightbox::skins();
}
/**
* Returns lightbox skin
*
* @since 1.3.3
*/
function tb_ilightbox_skin() {
return TB_iLightbox::active_skin();
}
/**
* Returns lightbox skin stylesheet
*
* @since 1.3.3
*/
function tb_ilightbox_stylesheet( $skin = null ) {
return TB_iLightbox::skin_style( $skin );
}
/**
* Enqueues lightbox stylesheet
*
* @since 1.3.3
*/
function tb_enqueue_ilightbox_skin( $skin = null ) {
return TB_iLightbox::enqueue_style( $skin );
}