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 / includes / class-il8n.php
foogallery / includes Last commit date
admin 7 months ago compatibility 7 months ago extensions 7 months ago foopluginbase 7 months ago public 7 months ago thumbs 7 months ago .DS_Store 7 months ago class-attachment-filters.php 7 months ago class-foogallery-animated-gif-support.php 7 months ago class-foogallery-attachment-custom-class.php 7 months ago class-foogallery-attachment-type.php 7 months ago class-foogallery-attachment.php 7 months ago class-foogallery-cache.php 7 months ago class-foogallery-common-fields.php 7 months ago class-foogallery-crop-position.php 7 months ago class-foogallery-datasource-media_library.php 7 months ago class-foogallery-debug.php 7 months ago class-foogallery-extensions-compatibility.php 7 months ago class-foogallery-force-https.php 7 months ago class-foogallery-lazyload.php 7 months ago class-foogallery-lightbox.php 7 months ago class-foogallery-paging.php 7 months ago class-foogallery-password-protect.php 7 months ago class-foogallery-sitemaps.php 7 months ago class-foogallery-widget.php 7 months ago class-foogallery.php 7 months ago class-gallery-advanced-settings.php 7 months ago class-il8n.php 7 months ago class-override-thumbnail.php 7 months ago class-posttypes.php 7 months ago class-retina.php 7 months ago class-thumbnail-dimensions.php 7 months ago class-thumbnails.php 7 months ago class-version-check.php 7 months ago constants.php 7 months ago functions.php 7 months ago includes.php 7 months ago index.php 11 years ago render-functions.php 7 months ago
class-il8n.php
84 lines
1 <?php
2 /**
3 * Foogallery class for enqueuing the FooGallery_il8n variable into the page
4 */
5
6 if ( ! class_exists( 'FooGallery_il8n' ) ) {
7 class FooGallery_il8n {
8
9 function __construct() {
10 add_action( 'foogallery_enqueue_script-core', array( $this, 'enqueue_il8n' ), 10, 1 );
11 add_action( 'foogallery_dequeue_script-core', array( $this, 'dequeue_core' ) );
12 }
13
14 /**
15 * Enqueue the il8n script
16 *
17 * @param $js
18 *
19 * @return void
20 */
21 function enqueue_il8n( $js ) {
22 global $foogallery_enqueue_il8n;
23
24 if ( $foogallery_enqueue_il8n ) {
25 return;
26 }
27
28 $il8n = array();
29
30 $imageviewer_prev_entry = foogallery_get_language_array_value( 'language_imageviewer_prev_text', __( 'Prev', 'foogallery' ) );
31 if ( $imageviewer_prev_entry !== false ) {
32 $il8n = array_merge_recursive( $il8n, array(
33 'template' => array(
34 "image-viewer" => array(
35 'prev' => esc_html( $imageviewer_prev_entry )
36 )
37 )
38 ) );
39 }
40
41 $imageviewer_next_entry = foogallery_get_language_array_value( 'language_imageviewer_next_text', __( 'Next', 'foogallery' ) );
42 if ( $imageviewer_next_entry !== false ) {
43 $il8n = array_merge_recursive( $il8n, array(
44 'template' => array(
45 "image-viewer" => array(
46 'next' => esc_html( $imageviewer_next_entry )
47 )
48 )
49 ) );
50 }
51
52 $imageviewer_of_entry = foogallery_get_language_array_value( 'language_imageviewer_of_text', __( 'of', 'foogallery' ) );
53 if ( $imageviewer_of_entry !== false ) {
54 $il8n = array_merge_recursive( $il8n, array(
55 'template' => array(
56 "image-viewer" => array(
57 'of' => esc_html( $imageviewer_of_entry )
58 )
59 )
60 ) );
61 }
62
63 $il8n = apply_filters( 'foogallery_il8n', $il8n );
64
65 // Only add the script to the page if there is data to be added.
66 if ( count( $il8n ) > 0 ) {
67 $script = "var FooGallery_il8n = " . foogallery_json_encode( $il8n ) . ';';
68 wp_add_inline_script( 'foogallery-core', $script, 'before' );
69 }
70
71 $foogallery_enqueue_il8n = true; // To ensure we do not add multiple times on a page with more than 1 gallery.
72 }
73
74 /**
75 * Clears
76 *
77 * @return void
78 */
79 function dequeue_core() {
80 global $foogallery_enqueue_il8n;
81 $foogallery_enqueue_il8n = null; // To ensure we once again add the correct il8n script
82 }
83 }
84 }