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