| @@ -27,9 +27,9 @@ | ||
| 27 | 27 | * @since 1.0.0 |
| 28 | 28 | */ |
| 29 | 29 | public function __construct() { |
| 30 | 30 | add_shortcode( 'automatic_youtube_gallery', array( $this, 'shortcode_automatic_youtube_gallery' ) ); |
| 31 | - } | |
| 31 | + } | |
| 32 | 32 | |
| 33 | 33 | /** |
| 34 | 34 | * Enqueue styles for the public-facing side of the site. |
| 35 | 35 | * |
| @@ -37,9 +37,9 @@ | ||
| 37 | 37 | */ |
| 38 | 38 | public function register_styles() { |
| 39 | 39 | wp_register_style( |
| 40 | 40 | AYG_SLUG . '-public', |
| 41 | - AYG_URL . 'public/assets/css/public.css', | |
| 41 | + AYG_URL . 'public/assets/css/public.min.css', | |
| 42 | 42 | array(), |
| 43 | 43 | AYG_VERSION, |
| 44 | 44 | 'all' |
| 45 | 45 | ); |
| @@ -50,11 +50,14 @@ | ||
| 50 | 50 | * |
| 51 | 51 | * @since 1.0.0 |
| 52 | 52 | */ |
| 53 | 53 | public function register_scripts() { |
| 54 | + $player_settings = get_option( 'ayg_player_settings' ); | |
| 55 | + $privacy_settings = get_option( 'ayg_privacy_settings' ); | |
| 56 | + | |
| 54 | 57 | wp_register_script( |
| 55 | 58 | AYG_SLUG . '-public', |
| 56 | - AYG_URL . 'public/assets/js/public.js', | |
| 59 | + AYG_URL . 'public/assets/js/public.min.js', | |
| 57 | 60 | array( 'jquery' ), |
| 58 | 61 | AYG_VERSION, |
| 59 | 62 | false |
| 60 | 63 | ); |
| @@ -59,21 +62,31 @@ | ||
| 59 | 62 | false |
| 60 | 63 | ); |
| 61 | 64 | |
| 62 | 65 | $script_args = array( |
| 63 | - 'ajax_url' => admin_url( 'admin-ajax.php' ), | |
| 64 | - 'ajax_nonce' => wp_create_nonce( 'ayg_ajax_nonce' ), | |
| 65 | - 'cookie_consent' => 0, | |
| 66 | - 'top_offset' => apply_filters( 'ayg_gallery_scrolltop_offset', 10 ), | |
| 67 | - 'i18n' => array( | |
| 66 | + 'current_url' => get_permalink(), | |
| 67 | + 'ajax_url' => admin_url( 'admin-ajax.php' ), | |
| 68 | + 'ajax_nonce' => wp_create_nonce( 'ayg_ajax_nonce' ), | |
| 69 | + 'gallery_index' => 0, | |
| 70 | + 'gallery_id' => get_query_var( 'ayg_gallery_id' ), | |
| 71 | + 'video_id' => get_query_var( 'ayg_video_id' ), | |
| 72 | + 'active_player_id' => '', | |
| 73 | + 'privacy_enhanced_mode' => isset( $player_settings['privacy_enhanced_mode'] ) ? (int) $player_settings['privacy_enhanced_mode'] : 0, | |
| 74 | + 'origin' => '', | |
| 75 | + 'cookie_consent' => 0, | |
| 76 | + 'top_offset' => apply_filters( 'ayg_gallery_scrolltop_offset', 10 ), | |
| 77 | + 'i18n' => array( | |
| 68 | 78 | 'show_more' => '[+] ' . __( 'Show More', 'automatic-youtube-gallery' ), |
| 69 | 79 | 'show_less' => '[-] ' . __( 'Show Less', 'automatic-youtube-gallery' ) |
| 70 | 80 | ) |
| 71 | 81 | ); |
| 72 | 82 | |
| 83 | + if ( isset( $player_settings['origin'] ) && ! empty( $player_settings['origin'] ) ) { | |
| 84 | + $url_parts = parse_url( site_url() ); | |
| 85 | + $script_args['origin'] = $url_parts['scheme'] . '://' . $url_parts['host']; | |
| 86 | + } | |
| 87 | + | |
| 73 | 88 | if ( ! isset( $_COOKIE['ayg_gdpr_consent'] ) ) { |
| 74 | - $privacy_settings = get_option( 'ayg_privacy_settings' ); | |
| 75 | - | |
| 76 | 89 | if ( ! empty( $privacy_settings['cookie_consent'] ) && ! empty( $privacy_settings['consent_message'] ) && ! empty( $privacy_settings['button_label'] ) ) { |
| 77 | 90 | $script_args['cookie_consent'] = 1; |
| 78 | 91 | $script_args['consent_message'] = wp_kses_post( trim( $privacy_settings['consent_message'] ) ); |
| 79 | 92 | $script_args['button_label'] = esc_html( $privacy_settings['button_label'] ); |
| @@ -148,9 +161,9 @@ | ||
| 148 | 161 | $videos = $response->videos; |
| 149 | 162 | |
| 150 | 163 | ob_start(); |
| 151 | 164 | foreach ( $videos as $index => $video ) { |
| 152 | - echo'<div class="ayg-item ayg-col ayg-col-' . (int) $attributes['columns'] . '">'; | |
| 165 | + echo'<div class="ayg-item ayg-item-' . $video->id . ' ayg-col ayg-col-' . (int) $attributes['columns'] . '">'; | |
| 153 | 166 | the_ayg_gallery_thumbnail( $video, $attributes ); |
| 154 | 167 | echo '</div>'; |
| 155 | 168 | } |
| 156 | 169 | $json['html'] = ob_get_clean(); |