| @@ -37,21 +37,8 @@ | ||
| 37 | 37 | public function prepare($result) |
| 38 | 38 | { |
| 39 | 39 | $theme_name = strtolower($this->theme['name']); |
| 40 | 40 | |
| 41 | - $player_settings = apply_filters('vimeography.player.settings', array( | |
| 42 | - 'dnt' => apply_filters('vimeography.player.settings.dnt', false, $this->gallery_id, $this->gallery_settings), | |
| 43 | - 'playsinline' => apply_filters('vimeography.player.settings.playsinline', false, $this->gallery_id, $this->gallery_settings), | |
| 44 | - 'transparent' => apply_filters('vimeography.player.settings.transparent', true, $this->gallery_id, $this->gallery_settings), | |
| 45 | - 'responsive' => apply_filters('vimeography.player.settings.responsive', true, $this->gallery_id, $this->gallery_settings), | |
| 46 | - 'speed' => apply_filters('vimeography.player.settings.speed', true, $this->gallery_id, $this->gallery_settings), | |
| 47 | - 'autoplay' => apply_filters('vimeography.player.settings.autoplay', false, $this->gallery_id, $this->gallery_settings), | |
| 48 | - 'background' => apply_filters('vimeography.player.settings.background', false, $this->gallery_id, $this->gallery_settings), | |
| 49 | - 'muted' => apply_filters('vimeography.player.settings.muted', false, $this->gallery_id, $this->gallery_settings), | |
| 50 | - 'loop' => apply_filters('vimeography.player.settings.loop', false, $this->gallery_id, $this->gallery_settings), | |
| 51 | - 'pip' => apply_filters('vimeography.player.settings.pip', false, $this->gallery_id, $this->gallery_settings), | |
| 52 | - )); | |
| 53 | - | |
| 54 | 41 | // Set base data for every single gallery |
| 55 | 42 | $data = array( |
| 56 | 43 | 'id' => $this->gallery_id, |
| 57 | 44 | 'theme' => $theme_name, |
| @@ -62,9 +49,24 @@ | ||
| 62 | 49 | 'default' => array(), |
| 63 | 50 | 'filter' => array() |
| 64 | 51 | ), |
| 65 | 52 | 'settings' => array( |
| 66 | - 'player' => $player_settings | |
| 53 | + 'player' => array( | |
| 54 | + 'dnt' => apply_filters('vimeography.player.settings.dnt', false), | |
| 55 | + 'transparent' => apply_filters( | |
| 56 | + 'vimeography.player.settings.transparent', | |
| 57 | + true | |
| 58 | + ), | |
| 59 | + 'responsive' => apply_filters( | |
| 60 | + 'vimeography.player.settings.responsive', | |
| 61 | + true | |
| 62 | + ), | |
| 63 | + 'speed' => apply_filters('vimeography.player.settings.speed', true), | |
| 64 | + 'playsinline' => apply_filters( | |
| 65 | + 'vimeography.player.settings.playsinline', | |
| 66 | + false | |
| 67 | + ) | |
| 68 | + ) | |
| 67 | 69 | ) |
| 68 | 70 | ); |
| 69 | 71 | |
| 70 | 72 | // Merge the API response from Vimeo |
| @@ -139,43 +141,32 @@ | ||
| 139 | 141 | wp_register_style("vimeography-{$theme_name}", $this->theme['app_css']); |
| 140 | 142 | wp_enqueue_style("vimeography-{$theme_name}"); |
| 141 | 143 | } |
| 142 | 144 | |
| 143 | - wp_add_inline_script( | |
| 145 | + wp_localize_script( | |
| 144 | 146 | "vimeography-{$theme_name}", |
| 145 | - 'var vimeographyBuildPath = "' . $this->theme['app_path'] . '";', | |
| 146 | - 'before' | |
| 147 | + 'vimeographyBuildPath', | |
| 148 | + $this->theme['app_path'] | |
| 147 | 149 | ); |
| 148 | 150 | |
| 149 | 151 | $router_mode = apply_filters('vimeography.pro.router_mode', 'abstract'); |
| 150 | - | |
| 151 | - wp_add_inline_script( | |
| 152 | + wp_localize_script( | |
| 152 | 153 | "vimeography-{$theme_name}", |
| 153 | - 'var vimeographyRouterMode = "' . $router_mode . '";', | |
| 154 | - 'before' | |
| 154 | + 'vimeographyRouterMode', | |
| 155 | + $router_mode | |
| 155 | 156 | ); |
| 156 | 157 | |
| 157 | - wp_add_inline_script( | |
| 158 | + wp_localize_script( | |
| 158 | 159 | "vimeography-{$theme_name}", |
| 159 | - ' | |
| 160 | - window.vimeography2 = window.vimeography2 || {}; | |
| 161 | - window.vimeography2.galleries = window.vimeography2.galleries || {}; | |
| 162 | - window.vimeography2.galleries.' . | |
| 163 | - $theme_name . | |
| 164 | - ' = window.vimeography2.galleries.' . | |
| 165 | - $theme_name . | |
| 166 | - ' || {}; | |
| 167 | - | |
| 168 | - window.vimeography2.galleries.' . | |
| 169 | - $data['theme'] . | |
| 170 | - '["' . | |
| 171 | - $data['id'] . | |
| 172 | - '"] = ' . | |
| 173 | - json_encode($data), | |
| 174 | - 'before' | |
| 160 | + "vimeography2 = window.vimeography2 || {}; | |
| 161 | + window.vimeography2.galleries = window.vimeography2.galleries || {}; | |
| 162 | + window.vimeography2.galleries.{$theme_name} = window.vimeography2.galleries.{$theme_name} || {}; | |
| 163 | + vimeography2.unused", | |
| 164 | + $local_data | |
| 175 | 165 | ); |
| 176 | 166 | |
| 177 | 167 | wp_enqueue_script("vimeography-{$theme_name}"); |
| 168 | + | |
| 178 | 169 | return $this; |
| 179 | 170 | } |
| 180 | 171 | |
| 181 | 172 | /** |
| @@ -202,9 +193,9 @@ | ||
| 202 | 193 | </style> |
| 203 | 194 | <?php endif; ?> |
| 204 | 195 | <div id="vimeography-gallery-<?php esc_attr_e( |
| 205 | 196 | $data['id'] |
| 206 | - ); ?>" class="<?php echo wp_kses_post($wrapper_class); ?>" data-version="<?php esc_attr_e($data['version']); ?>" <?php if (!empty($this->gallery_settings['width'])): ?> style="max-width: <?php esc_attr_e($this->gallery_settings['width']); ?>; margin: 0 auto;" <?php endif; ?> itemscope itemtype="http://schema.org/VideoGallery"> | |
| 197 | + ); ?>" class="<?php echo $wrapper_class; ?>" data-version="<?php esc_attr_e($data['version']); ?>" <?php if (!empty($this->gallery_settings['width'])): ?> style="max-width: <?php esc_attr_e($this->gallery_settings['width']); ?>; margin: 0 auto;" <?php endif; ?> itemscope itemtype="http://schema.org/VideoGallery"> | |
| 207 | 198 | <div id="subbie"> |
| 208 | 199 | <gallery></gallery> |
| 209 | 200 | </div> |
| 210 | 201 | </div> |