PluginProbe ʕ •ᴥ•ʔ
Gallery : FooGallery / 2.2.44
Gallery : FooGallery v2.2.44
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
admin 3 years ago compatibility 3 years ago extensions 3 years ago foopluginbase 3 years ago public 3 years ago thumbs 3 years ago class-attachment-filters.php 3 years ago class-foogallery-animated-gif-support.php 3 years ago class-foogallery-attachment-custom-class.php 3 years ago class-foogallery-attachment.php 3 years ago class-foogallery-cache.php 3 years ago class-foogallery-common-fields.php 3 years ago class-foogallery-crop-position.php 3 years ago class-foogallery-datasource-media_library.php 3 years ago class-foogallery-debug.php 3 years ago class-foogallery-extensions-compatibility.php 3 years ago class-foogallery-force-https.php 3 years ago class-foogallery-lazyload.php 3 years ago class-foogallery-paging.php 3 years ago class-foogallery-sitemaps.php 3 years ago class-foogallery-widget.php 3 years ago class-foogallery.php 3 years ago class-gallery-advanced-settings.php 3 years ago class-il8n.php 3 years ago class-override-thumbnail.php 3 years ago class-posttypes.php 3 years ago class-retina.php 3 years ago class-thumbnail-dimensions.php 3 years ago class-thumbnails.php 3 years ago class-version-check.php 3 years ago constants.php 3 years ago functions.php 3 years ago includes.php 3 years ago index.php 3 years ago render-functions.php 3 years 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' => $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' => $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' => $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 }