PluginProbe ʕ •ᴥ•ʔ
Photo Gallery by FooGallery : Responsive Image Gallery, Masonry Gallery & Carousel / trunk
Photo Gallery by FooGallery : Responsive Image Gallery, Masonry Gallery & Carousel vtrunk
trunk 1.10.3 2.0.24 2.1.34 2.2.44 2.3.3 2.4.32 3.0.6 3.1.11 3.1.12 3.1.13 3.1.20 3.1.25 3.1.26 3.1.26.1 3.1.26.2
foogallery / extensions / default-templates / functions.php
foogallery / extensions / default-templates Last commit date
carousel 7 months ago default 7 months ago grid 7 months ago image-viewer 7 months ago justified 7 months ago masonry 7 months ago shared 7 months ago simple-portfolio 7 months ago thumbnail 7 months ago .DS_Store 7 months ago class-default-templates-extension.php 7 months ago class-default-templates.php 7 months ago functions.php 7 months ago
functions.php
78 lines
1 <?php
2 /**
3 * FooGallery default extensions common functions
4 */
5
6 /**
7 * Enqueue the core FooGallery stylesheet used by all default templates
8 */
9 function foogallery_enqueue_core_gallery_template_style() {
10 $filename = foogallery_is_debug() ? '' : '.min';
11 $css = apply_filters( 'foogallery_core_gallery_style', FOOGALLERY_DEFAULT_TEMPLATES_EXTENSION_SHARED_URL . 'css/foogallery' . $filename . '.css' );
12 foogallery_enqueue_style( 'foogallery-core', $css, array(), FOOGALLERY_VERSION );
13
14 $feature_deps = apply_filters( 'foogallery_feature_style_deps', array( 'foogallery-core' ) );
15
16 if ( foogallery_get_setting( 'custom_css', '' ) !== '' ) {
17 $custom_assets = get_option( FOOGALLERY_OPTION_CUSTOM_ASSETS );
18 if ( is_array( $custom_assets ) && array_key_exists( 'style', $custom_assets ) ) {
19 foogallery_enqueue_style( 'foogallery-custom', $custom_assets['style'], $feature_deps, FOOGALLERY_VERSION );
20 }
21 }
22 }
23
24 /**
25 * Enqueue the core FooGallery script used by all default templates
26 *
27 * @param string[] $deps
28 */
29 function foogallery_enqueue_core_gallery_template_script( $deps = null ) {
30 if ( isset( $deps ) ) {
31 //ensure we deregister the previous one
32 wp_deregister_script( 'foogallery-core' );
33 do_action( 'foogallery_dequeue_script-core' );
34 } else {
35 //set the default
36 $deps = array( 'jquery' );
37 }
38
39 //enqueue the core script
40 $filename_suffix = foogallery_is_debug() ? '' : '.min';
41 $js = apply_filters( 'foogallery_core_gallery_script', FOOGALLERY_DEFAULT_TEMPLATES_EXTENSION_SHARED_URL . 'js/foogallery' . $filename_suffix . '.js' );
42 $deps = apply_filters( 'foogallery_core_gallery_script_deps', $deps );
43
44 if ( foogallery_get_setting( 'enqueue_polyfills', false ) ) {
45 foogallery_enqueue_polyfills();
46 $deps[] = 'foogallery-polyfills';
47 }
48
49 wp_enqueue_script( 'foogallery-core', $js, $deps, FOOGALLERY_VERSION );
50 do_action( 'foogallery_enqueue_script-core', $js );
51 $feature_deps = array( 'foogallery-core' );
52
53 //apply filters to the custom deps, so scripts are loaded in correct order.
54 $feature_deps = apply_filters( 'foogallery_feature_script_deps', $feature_deps );
55
56 //enqueue the custom JS
57 if ( foogallery_get_setting( 'custom_js', '' ) !== '' ) {
58 $custom_assets = get_option( FOOGALLERY_OPTION_CUSTOM_ASSETS );
59 if ( is_array( $custom_assets ) && array_key_exists( 'script', $custom_assets ) ) {
60 wp_enqueue_script( 'foogallery-custom', $custom_assets['script'], $feature_deps, FOOGALLERY_VERSION );
61 $feature_deps[] = 'foogallery-custom';
62 }
63 }
64
65 //enqueue the ready script
66 wp_enqueue_script( 'foogallery-ready', FOOGALLERY_DEFAULT_TEMPLATES_EXTENSION_SHARED_URL . 'js/foogallery.ready' . $filename_suffix . '.js', $feature_deps, FOOGALLERY_VERSION );
67 }
68
69 /**
70 * @return void
71 *
72 */
73 function foogallery_enqueue_polyfills() {
74 $suffix = foogallery_is_debug() ? '' : '.min';
75 $src = apply_filters( 'foogallery_polyfills_src', FOOGALLERY_DEFAULT_TEMPLATES_EXTENSION_SHARED_URL . 'js/foogallery.polyfills' . $suffix . '.js', $suffix );
76 wp_enqueue_script( 'foogallery-polyfills', $src, array(), FOOGALLERY_VERSION );
77 }
78