Elementor_Enhancer.php
5 years ago
EmbedPress_Core_Installer.php
6 years ago
EmbedPress_Notice.php
5 years ago
EmbedPress_Plugin_Usage_Tracker.php
5 years ago
Feature_Enhancer.php
5 years ago
Feature_Enhancer.php
996 lines
| 1 | <?php |
| 2 | namespace EmbedPress\Includes\Classes; |
| 3 | |
| 4 | class Feature_Enhancer { |
| 5 | |
| 6 | public function __construct() { |
| 7 | |
| 8 | //if ( !is_embedpress_pro_active() ) { |
| 9 | add_filter( 'embedpress:onAfterEmbed', [$this, 'enhance_youtube'], 90 ); |
| 10 | add_filter( 'embedpress:onAfterEmbed', [$this, 'enhance_vimeo'], 90 ); |
| 11 | add_filter( 'embedpress:onAfterEmbed', [$this, 'enhance_wistia'], 90 ); |
| 12 | add_filter( 'embedpress:onAfterEmbed', [$this, 'enhance_twitch'], 90 ); |
| 13 | add_filter( 'embedpress:onAfterEmbed', [$this, 'enhance_dailymotion'], 90 ); |
| 14 | add_filter( 'embedpress:onAfterEmbed', [$this, 'enhance_soundcloud'], 90 ); |
| 15 | add_filter( 'embedpress_gutenberg_youtube_params', |
| 16 | [$this, 'embedpress_gutenberg_register_block_youtube'] ); |
| 17 | add_action( 'init', array( $this, 'embedpress_gutenberg_register_block_vimeo' ) ); |
| 18 | add_action('embedpress_gutenberg_wistia_block_after_embed', array($this,'embedpress_wistia_block_after_embed')); |
| 19 | add_action( 'elementor/widget/embedpres_elementor/skins_init', [ $this, 'elementor_setting_init' ] ); |
| 20 | //} |
| 21 | |
| 22 | |
| 23 | } |
| 24 | |
| 25 | public function elementor_setting_init( ) { |
| 26 | $this->remove_classic_filters(); |
| 27 | add_filter( 'embedpress_elementor_embed', [Elementor_Enhancer::class, 'youtube'], 10, 2 ); |
| 28 | add_filter( 'embedpress_elementor_embed', [Elementor_Enhancer::class, 'wistia'], 10, 2 ); |
| 29 | add_filter( 'embedpress_elementor_embed', [Elementor_Enhancer::class, 'twitch'], 10, 2 ); |
| 30 | add_filter( 'embedpress_elementor_embed', [Elementor_Enhancer::class, 'soundcloud'], 10, 2 ); |
| 31 | add_filter( 'embedpress_elementor_embed', [Elementor_Enhancer::class, 'dailymotion'], 10, 2 ); |
| 32 | add_filter( 'embedpress_elementor_embed', [Elementor_Enhancer::class, 'spotify'], 10, 2 ); |
| 33 | add_filter( 'embedpress_elementor_embed', [Elementor_Enhancer::class, 'vimeo'], 10, 2 ); |
| 34 | } |
| 35 | |
| 36 | public function remove_classic_filters( ) { |
| 37 | remove_filter( 'embedpress:onAfterEmbed', [$this, 'enhance_youtube'], 90 ); |
| 38 | remove_filter( 'embedpress:onAfterEmbed', [$this, 'enhance_vimeo'], 90 ); |
| 39 | remove_filter( 'embedpress:onAfterEmbed', [$this, 'enhance_wistia'], 90 ); |
| 40 | remove_filter( 'embedpress:onAfterEmbed', [$this, 'enhance_twitch'], 90 ); |
| 41 | remove_filter( 'embedpress:onAfterEmbed', [$this, 'enhance_dailymotion'], 90 ); |
| 42 | remove_filter( 'embedpress:onAfterEmbed', [$this, 'enhance_soundcloud'], 90 ); |
| 43 | } |
| 44 | |
| 45 | public function getOptions($provider='', $schema=[]) |
| 46 | { |
| 47 | $options = (array)get_option(EMBEDPRESS_PLG_NAME . ':' . $provider, []); |
| 48 | if (empty($options) || (count($options) === 1 && empty($options[0]))) { |
| 49 | $options = []; |
| 50 | |
| 51 | foreach ($schema as $fieldSlug => $field) { |
| 52 | $value = isset($field['default']) ? $field['default'] : ""; |
| 53 | |
| 54 | settype($value, isset($field['type']) && in_array(strtolower($field['type']), |
| 55 | ['bool', 'boolean', 'int', 'integer', 'float', 'string']) ? $field['type'] : 'string'); |
| 56 | |
| 57 | if ($fieldSlug === "license_key") { |
| 58 | $options['license'] = [ |
| 59 | 'key' => true, |
| 60 | 'status' => "missing", |
| 61 | ]; |
| 62 | } else { |
| 63 | $options[$fieldSlug] = $value; |
| 64 | } |
| 65 | } |
| 66 | } |
| 67 | |
| 68 | $options['license'] = [ |
| 69 | 'key' => true, |
| 70 | 'status' => "missing", |
| 71 | ]; |
| 72 | return apply_filters( 'emebedpress_get_options', $options); |
| 73 | } |
| 74 | public function get_youtube_params( $options ) |
| 75 | { |
| 76 | $params = []; |
| 77 | |
| 78 | // Handle `autoplay` option. |
| 79 | if ( isset( $options[ 'autoplay' ] ) && (bool)$options[ 'autoplay' ] === true ) { |
| 80 | $params[ 'autoplay' ] = 1; |
| 81 | } else { |
| 82 | unset( $params[ 'autoplay' ] ); |
| 83 | } |
| 84 | |
| 85 | // Handle `controls` option. |
| 86 | if ( isset( $options[ 'controls' ] ) && in_array( (int)$options[ 'controls' ], [0, 1, 2] ) ) { |
| 87 | $params[ 'controls' ] = (int)$options[ 'controls' ]; |
| 88 | } else { |
| 89 | unset( $params[ 'controls' ] ); |
| 90 | } |
| 91 | |
| 92 | // Handle `fs` option. |
| 93 | if ( isset( $options[ 'fs' ] ) && in_array( (int)$options[ 'fs' ], [0, 1] ) ) { |
| 94 | $params[ 'fs' ] = (int)$options[ 'fs' ]; |
| 95 | } else { |
| 96 | unset( $params[ 'fs' ] ); |
| 97 | } |
| 98 | |
| 99 | // Handle `iv_load_policy` option. |
| 100 | if ( isset( $options[ 'iv_load_policy' ] ) && in_array( (int)$options[ 'iv_load_policy' ], [1, 3] ) ) { |
| 101 | $params[ 'iv_load_policy' ] = (int)$options[ 'iv_load_policy' ]; |
| 102 | } else { |
| 103 | unset( $params[ 'iv_load_policy' ] ); |
| 104 | } |
| 105 | |
| 106 | return apply_filters( 'embedpress_youtube_params', $params); |
| 107 | |
| 108 | } |
| 109 | public function get_vimeo_params($options) { |
| 110 | $params = []; |
| 111 | |
| 112 | // Handle `display_title` option. |
| 113 | if (isset($options['display_title']) && (bool)$options['display_title'] === true) { |
| 114 | $params['title'] = 1; |
| 115 | } else { |
| 116 | $params['title'] = 0; |
| 117 | } |
| 118 | |
| 119 | // Handle `autoplay` option. |
| 120 | if (!empty($options['autoplay'])) { |
| 121 | $params['autoplay'] = 1; |
| 122 | } else { |
| 123 | unset($params['autoplay']); |
| 124 | } |
| 125 | |
| 126 | // Handle `color` option. |
| 127 | if (!empty($options['color'])) { |
| 128 | $params['color'] = str_replace('#', '', $options['color']); |
| 129 | } else { |
| 130 | unset($params['color']); |
| 131 | } |
| 132 | return apply_filters( 'embedpress_vimeo_params', $params); |
| 133 | |
| 134 | } |
| 135 | //--- For CLASSIC AND BLOCK EDITOR |
| 136 | public function enhance_youtube( $embed ) |
| 137 | { |
| 138 | $isYoutube = ( isset($embed->provider_name) && strtoupper( $embed->provider_name ) === 'YOUTUBE' ) || (isset( $embed->url) && isset( $embed->{$embed->url}) && isset( $embed->{$embed->url}['provider_name']) && strtoupper($embed->{$embed->url}['provider_name'] ) === 'YOUTUBE'); |
| 139 | |
| 140 | if ( $isYoutube && isset( $embed->embed ) |
| 141 | && preg_match( '/src=\"(.+?)\"/', $embed->embed, $match ) ) { |
| 142 | // for compatibility only, @TODO; remove later after deep testing. |
| 143 | $options = $this->getOptions('youtube', $this->get_youtube_settings_schema()); |
| 144 | // Parse the url to retrieve all its info like variables etc. |
| 145 | $url_full = $match[ 1 ]; |
| 146 | $query = parse_url( $url_full, PHP_URL_QUERY ); |
| 147 | parse_str( $query, $params ); |
| 148 | |
| 149 | // Handle `autoplay` option. |
| 150 | if ( isset( $options[ 'autoplay' ] ) && (bool)$options[ 'autoplay' ] === true ) { |
| 151 | $params[ 'autoplay' ] = 1; |
| 152 | } else { |
| 153 | unset( $params[ 'autoplay' ] ); |
| 154 | } |
| 155 | |
| 156 | // Handle `controls` option. |
| 157 | if ( isset( $options[ 'controls' ] ) && in_array( (int)$options[ 'controls' ], [0, 1, 2] ) ) { |
| 158 | $params[ 'controls' ] = (int)$options[ 'controls' ]; |
| 159 | } else { |
| 160 | unset( $params[ 'controls' ] ); |
| 161 | } |
| 162 | |
| 163 | // Handle `fs` option. |
| 164 | if ( isset( $options[ 'fs' ] ) && in_array( (int)$options[ 'fs' ], [0, 1] ) ) { |
| 165 | $params[ 'fs' ] = (int)$options[ 'fs' ]; |
| 166 | } else { |
| 167 | unset( $params[ 'fs' ] ); |
| 168 | } |
| 169 | |
| 170 | // Handle `iv_load_policy` option. |
| 171 | if ( isset( $options[ 'iv_load_policy' ] ) && in_array( (int)$options[ 'iv_load_policy' ], [1, 3] ) ) { |
| 172 | $params[ 'iv_load_policy' ] = (int)$options[ 'iv_load_policy' ]; |
| 173 | } else { |
| 174 | unset( $params[ 'iv_load_policy' ] ); |
| 175 | } |
| 176 | |
| 177 | |
| 178 | // pro controls will be handled by the pro so remove it from the free. |
| 179 | $pro_controls = ['color', 'cc_load_policy', 'rel', 'modestbranding']; |
| 180 | foreach ( $pro_controls as $pro_control ) { |
| 181 | if ( isset( $params[ $pro_control ]) ) { |
| 182 | unset( $params[ $pro_control ]); |
| 183 | } |
| 184 | } |
| 185 | |
| 186 | |
| 187 | preg_match( '/(.+)?\?/', $url_full, $url ); |
| 188 | $url = $url[ 1 ]; |
| 189 | |
| 190 | // Reassemble the url with the new variables. |
| 191 | $url_modified = $url . '?'; |
| 192 | foreach ( $params as $paramName => $paramValue ) { |
| 193 | $url_modified .= $paramName . '=' . $paramValue . '&'; |
| 194 | } |
| 195 | |
| 196 | // Replaces the old url with the new one. |
| 197 | $embed->embed = str_replace( $url_full, rtrim( $url_modified, '&' ), $embed->embed ); |
| 198 | |
| 199 | } |
| 200 | |
| 201 | return $embed; |
| 202 | } |
| 203 | public function enhance_vimeo( $embed ) { |
| 204 | if ( isset( $embed->provider_name ) |
| 205 | && strtoupper( $embed->provider_name ) === 'VIMEO' |
| 206 | && isset( $embed->embed ) |
| 207 | && preg_match( '/src=\"(.+?)\"/', $embed->embed, $match ) ) { |
| 208 | // old schema is for backward compatibility only @todo; remove it in the next version after deep test |
| 209 | $options = $this->getOptions('vimeo', $this->get_vimeo_settings_schema()); |
| 210 | |
| 211 | $url_full = $match[1]; |
| 212 | $params = []; |
| 213 | |
| 214 | // Handle `display_title` option. |
| 215 | if ( isset( $options['display_title'] ) && (bool)$options['display_title'] === true ) { |
| 216 | $params['title'] = 1; |
| 217 | } else { |
| 218 | $params['title'] = 0; |
| 219 | } |
| 220 | |
| 221 | // Handle `autoplay` option. |
| 222 | if ( isset( $options['autoplay'] ) && (bool)$options['autoplay'] === true ) { |
| 223 | $params['autoplay'] = 1; |
| 224 | } else { |
| 225 | unset( $params['autoplay'] ); |
| 226 | } |
| 227 | |
| 228 | // Handle `color` option. |
| 229 | if ( !empty( $options['color'] ) ) { |
| 230 | $params['color'] = str_replace( '#', '', $options['color'] ); |
| 231 | } else { |
| 232 | unset( $params['color'] ); |
| 233 | } |
| 234 | // NOTE: 'vimeo_dnt' is actually only 'dnt' in the params, so unset 'dnt' only |
| 235 | //@todo; maybe extract unsetting pro vars to a function later |
| 236 | $pro_controls = ['loop', 'autopause', 'dnt', 'portrait', 'byline']; |
| 237 | foreach ( $pro_controls as $pro_control ) { |
| 238 | if ( isset( $params[ $pro_control ]) ) { |
| 239 | unset( $params[ $pro_control ]); |
| 240 | } |
| 241 | } |
| 242 | // Reassemble the url with the new variables. |
| 243 | $url_modified = $url_full; |
| 244 | foreach ( $params as $param => $value ) { |
| 245 | $url_modified = add_query_arg( $param, $value, $url_modified ); |
| 246 | } |
| 247 | do_action( 'embedpress_after_modified_url', $url_modified, $url_full, $params); |
| 248 | // Replaces the old url with the new one. |
| 249 | $embed->embed = str_replace( $url_full, $url_modified, $embed->embed ); |
| 250 | |
| 251 | } |
| 252 | |
| 253 | return $embed; |
| 254 | } |
| 255 | public function enhance_wistia( $embed ) { |
| 256 | if (isset($embed->provider_name) |
| 257 | && strtoupper($embed->provider_name) === 'WISTIA, INC.' |
| 258 | && isset($embed->embed) |
| 259 | && preg_match('/src=\"(.+?)\"/', $embed->embed, $match)) { |
| 260 | $options = $this->getOptions('wistia', $this->get_wistia_settings_schema()); |
| 261 | |
| 262 | $url_full = $match[1]; |
| 263 | |
| 264 | // Parse the url to retrieve all its info like variables etc. |
| 265 | $query = parse_url($embed->url, PHP_URL_QUERY); |
| 266 | $url = str_replace('?'.$query, '', $url_full); |
| 267 | |
| 268 | parse_str($query, $params); |
| 269 | |
| 270 | // Set the class in the attributes |
| 271 | $embed->attributes->class = str_replace('{provider_alias}', 'wistia', $embed->attributes->class); |
| 272 | $embed->embed = str_replace('ose-wistia, inc.', 'ose-wistia', $embed->embed); |
| 273 | |
| 274 | // Embed Options |
| 275 | $embedOptions = new \stdClass; |
| 276 | $embedOptions->videoFoam = true; |
| 277 | $embedOptions->fullscreenButton = (isset($options['display_fullscreen_button']) && (bool) $options['display_fullscreen_button'] === true); |
| 278 | $embedOptions->smallPlayButton = (isset($options['small_play_button']) && (bool) $options['small_play_button'] === true); |
| 279 | |
| 280 | $embedOptions->autoPlay = (isset($options['autoplay']) && (bool) $options['autoplay'] === true); |
| 281 | |
| 282 | |
| 283 | if (isset($options['player_color'])) { |
| 284 | $color = $options['player_color']; |
| 285 | if (null !== $color) { |
| 286 | $embedOptions->playerColor = $color; |
| 287 | } |
| 288 | } |
| 289 | |
| 290 | // Plugins |
| 291 | $pluginsBaseURL = plugins_url('assets/js/wistia/min', dirname(__DIR__).'/embedpress-Wistia.php'); |
| 292 | |
| 293 | $pluginList = array(); |
| 294 | |
| 295 | // Resumable |
| 296 | if (isset($options['plugin_resumable'])) { |
| 297 | $isResumableEnabled = $options['plugin_resumable']; |
| 298 | if ($isResumableEnabled) { |
| 299 | // Add the resumable plugin |
| 300 | $pluginList['resumable'] = array( |
| 301 | 'src' => $pluginsBaseURL.'/resumable.min.js', |
| 302 | 'async' => false |
| 303 | ); |
| 304 | } |
| 305 | } |
| 306 | |
| 307 | // Add a fix for the autoplay and resumable work better together |
| 308 | if (isset($options->autoPlay)) { |
| 309 | if ($isResumableEnabled) { |
| 310 | $pluginList['fixautoplayresumable'] = array( |
| 311 | 'src' => $pluginsBaseURL.'/fixautoplayresumable.min.js' |
| 312 | ); |
| 313 | } |
| 314 | } |
| 315 | |
| 316 | // Focus plugin |
| 317 | if (isset($options['plugin_focus'])) { |
| 318 | $isFocusEnabled = $options['plugin_focus']; |
| 319 | $pluginList['dimthelights'] = array( |
| 320 | 'src' => $pluginsBaseURL.'/dimthelights.min.js', |
| 321 | 'autoDim' => $isFocusEnabled |
| 322 | ); |
| 323 | $embedOptions->focus = $isFocusEnabled; |
| 324 | } |
| 325 | |
| 326 | |
| 327 | $embedOptions->plugin = $pluginList; |
| 328 | $embedOptions = json_encode($embedOptions); |
| 329 | |
| 330 | // Get the video ID |
| 331 | $videoId = $this->getVideoIDFromURL($embed->url); |
| 332 | $shortVideoId = substr($videoId, 0, 3); |
| 333 | |
| 334 | // Responsive? |
| 335 | |
| 336 | $class = array( |
| 337 | 'wistia_embed', |
| 338 | 'wistia_async_'.$videoId |
| 339 | ); |
| 340 | |
| 341 | $attribs = array( |
| 342 | sprintf('id="wistia_%s"', $videoId), |
| 343 | sprintf('class="%s"', join(' ', $class)), |
| 344 | sprintf('style="width:%spx; height:%spx;"', $embed->width, $embed->height) |
| 345 | ); |
| 346 | |
| 347 | $labels = array( |
| 348 | 'watch_from_beginning' => __('Watch from the beginning', 'embedpress-wistia'), |
| 349 | 'skip_to_where_you_left_off' => __('Skip to where you left off', 'embedpress-wistia'), |
| 350 | 'you_have_watched_it_before' => __('It looks like you\'ve watched<br />part of this video before!', |
| 351 | 'embedpress-wistia'), |
| 352 | ); |
| 353 | $labels = json_encode($labels); |
| 354 | |
| 355 | preg_match('/ose-uid-([a-z0-9]*)/', $embed->embed, $matches); |
| 356 | $uid = $matches[1]; |
| 357 | |
| 358 | $html = "<div class=\"embedpress-wrapper ose-wistia ose-uid-{$uid} responsive\">"; |
| 359 | $html .= '<script src="https://fast.wistia.com/assets/external/E-v1.js" async></script>'; |
| 360 | $html .= "<script>window.pp_embed_wistia_labels = {$labels};</script>\n"; |
| 361 | $html .= "<script>window._wq = window._wq || []; _wq.push({\"{$shortVideoId}\": {$embedOptions}});</script>\n"; |
| 362 | $html .= '<div '.join(' ', $attribs)."></div>\n"; |
| 363 | $html .= '</div>'; |
| 364 | $embed->embed = $html; |
| 365 | } |
| 366 | |
| 367 | return $embed; |
| 368 | } |
| 369 | public function enhance_twitch( $embed_content ) { |
| 370 | $e = isset( $embed_content->url) && isset( $embed_content->{$embed_content->url}) ? $embed_content->{$embed_content->url} : []; |
| 371 | if ( isset( $e['provider_name'] ) && strtoupper( $e['provider_name'] ) === 'TWITCH' && isset( $embed_content->embed ) ) { |
| 372 | $settings = $this->getOptions('twitch', $this->get_twitch_settings_schema()); |
| 373 | |
| 374 | $atts = isset( $embed_content->attributes) ? $embed_content->attributes : []; |
| 375 | $type = $e['type']; |
| 376 | $content_id = $e['content_id']; |
| 377 | $channel = 'channel' === $type ? $content_id : ''; |
| 378 | $video = 'video' === $type ? $content_id : ''; |
| 379 | $full_screen = ('yes' === $settings['embedpress_pro_fs']) ? 'true': 'false'; |
| 380 | $autoplay = ('yes' === $settings['embedpress_pro_twitch_autoplay']) ? 'true': 'false'; |
| 381 | $layout = 'video'; |
| 382 | $width = !empty( $atts->{'data-width'}) ? (int) $atts->{'data-width'} : 800; |
| 383 | $height = !empty( $atts->{'data-height'}) ? (int) $atts->{'data-height'} : 450; |
| 384 | |
| 385 | $url = "https://embed.twitch.tv?autoplay={$autoplay}&channel={$channel}&height={$height}&layout={$layout}&migration=true&video={$video}&width={$width}&allowfullscreen={$full_screen}"; |
| 386 | $pars_url = wp_parse_url(get_site_url()); |
| 387 | $url = !empty($pars_url['host'])?$url.'&parent='.$pars_url['host']:$url; |
| 388 | ob_start(); |
| 389 | ?> |
| 390 | <div class="embedpress_wrapper" data-url="<?php echo esc_attr(esc_url( $embed_content->url));?>"> |
| 391 | <iframe src="<?php echo esc_url( $url); ?>" allowfullscreen="" scrolling="no" frameborder="0" allow="autoplay; fullscreen" title="Twitch" sandbox="allow-modals allow-scripts allow-same-origin allow-popups allow-popups-to-escape-sandbox" width="<?php echo esc_attr($width); ?>" height="<?php echo esc_attr($height); ?>" style="max-width: 100%; max-height:<?php echo esc_attr($width); ?>px;"></iframe> |
| 392 | </div> |
| 393 | <?php |
| 394 | $c = ob_get_clean(); |
| 395 | $embed_content->embed = $c; |
| 396 | } |
| 397 | |
| 398 | return $embed_content; |
| 399 | } |
| 400 | |
| 401 | public function enhance_dailymotion( $embed ) { |
| 402 | $options = $this->getOptions('dailymotion', $this->get_dailymotion_settings_schema()); |
| 403 | $isDailymotion = ( isset($embed->provider_name) && strtoupper( $embed->provider_name ) === 'DAILYMOTION' ) || (isset( $embed->url) && isset( $embed->{$embed->url}) && isset( $embed->{$embed->url}['provider_name']) && strtoupper($embed->{$embed->url}['provider_name'] ) === 'DAILYMOTION'); |
| 404 | |
| 405 | if ( $isDailymotion && isset( $embed->embed ) |
| 406 | && preg_match( '/src=\"(.+?)\"/', $embed->embed, $match ) ) { |
| 407 | // Parse the url to retrieve all its info like variables etc. |
| 408 | $url_full = $match[ 1 ]; |
| 409 | $params = [ |
| 410 | 'ui-highlight' => str_replace( '#', '', $options[ 'color' ] ), |
| 411 | 'mute' => (int) $options[ 'mute' ], |
| 412 | 'autoplay' => (int) $options[ 'autoplay' ], |
| 413 | 'controls' => (int) $options[ 'controls' ], |
| 414 | 'ui-start-screen-info' => (int) $options[ 'video_info' ], |
| 415 | 'endscreen-enable' => 0, |
| 416 | ]; |
| 417 | |
| 418 | if ( $options[ 'play_on_mobile' ] == '1' ) { |
| 419 | $params[ 'playsinline' ] = 1; |
| 420 | } |
| 421 | if ( is_embedpress_pro_active() ) { |
| 422 | $params['start'] = (int) $options[ 'start_time' ]; |
| 423 | $params['ui-logo'] = (int) $options[ 'show_logo' ]; |
| 424 | } |
| 425 | |
| 426 | $url_modified = $url_full; |
| 427 | foreach ( $params as $param => $value ) { |
| 428 | $url_modified = add_query_arg( $param, $value, $url_modified ); |
| 429 | } |
| 430 | $embed->embed = str_replace( $url_full, $url_modified, $embed->embed ); |
| 431 | |
| 432 | } |
| 433 | |
| 434 | return $embed; |
| 435 | } |
| 436 | |
| 437 | public function enhance_soundcloud( $embed ) { |
| 438 | |
| 439 | $isSoundcloud = ( isset($embed->provider_name) && strtoupper( $embed->provider_name ) === 'SOUNDCLOUD' ) || (isset( $embed->url) && isset( $embed->{$embed->url}) && isset( $embed->{$embed->url}['provider_name']) && strtoupper($embed->{$embed->url}['provider_name'] ) === 'SOUNDCLOUD'); |
| 440 | |
| 441 | if ( $isSoundcloud && isset( $embed->embed ) |
| 442 | && preg_match( '/src=\"(.+?)\"/', $embed->embed, $match ) ) { |
| 443 | $options = $this->getOptions('soundcloud', $this->get_soundcloud_settings_schema()); |
| 444 | // Parse the url to retrieve all its info like variables etc. |
| 445 | $url_full = $match[ 1 ]; |
| 446 | $params = [ |
| 447 | 'color' => str_replace( '#', '', $options[ 'color' ] ), |
| 448 | 'visual' => isset($options[ 'visual' ] ) && $options['visual']== '1' ? 'true' : 'false', |
| 449 | 'auto_play' => isset($options[ 'autoplay' ] ) && $options['autoplay']== '1' ? 'true' : 'false', |
| 450 | 'sharing' => isset($options[ 'share_button' ] ) && $options['share_button']== '1' ? 'true' : 'false', |
| 451 | 'show_comments' => isset($options[ 'comments' ] ) && $options['comments']== '1' ? 'true' : 'false', |
| 452 | 'buying' => 'false', |
| 453 | 'download' => 'false', |
| 454 | 'show_artwork' => isset($options[ 'artwork' ] ) && $options['artwork']== '1' ? 'true' : 'false', |
| 455 | 'show_playcount' => isset($options[ 'play_count' ] ) && $options['play_count']== '1' ? 'true' : 'false', |
| 456 | 'show_user' => isset($options[ 'username' ] ) && $options['username']== '1' ? 'true' : 'false', |
| 457 | ]; |
| 458 | |
| 459 | if ( is_embedpress_pro_active() ) { |
| 460 | $params['buying'] = isset($options[ 'buy_button' ] ) && $options['buy_button']== '1' ? 'true' : 'false'; |
| 461 | $params['download'] = isset($options[ 'download_button' ] ) && $options['download_button']== '1' ? 'true' : 'false'; |
| 462 | } |
| 463 | |
| 464 | $url_modified = $url_full; |
| 465 | foreach ( $params as $param => $value ) { |
| 466 | $url_modified = add_query_arg( $param, $value, $url_modified ); |
| 467 | } |
| 468 | |
| 469 | // Replaces the old url with the new one. |
| 470 | $embed->embed = str_replace( $url_full, $url_modified, $embed->embed ); |
| 471 | if ( 'false' === $params[ 'visual' ] ) { |
| 472 | $embed->embed = str_replace( 'height="400"', 'height="200 !important"', $embed->embed ); |
| 473 | } |
| 474 | |
| 475 | } |
| 476 | |
| 477 | return $embed; |
| 478 | } |
| 479 | |
| 480 | public function embedpress_gutenberg_register_block_youtube( $youtube_params ) { |
| 481 | $youtube_options = $this->getOptions('youtube', $this->get_youtube_settings_schema()); |
| 482 | return $this->get_youtube_params( $youtube_options ); |
| 483 | } |
| 484 | public function embedpress_gutenberg_register_block_vimeo() { |
| 485 | if ( function_exists( 'register_block_type' ) ) : |
| 486 | register_block_type( 'embedpress/vimeo-block', array( |
| 487 | 'attributes' => array( |
| 488 | 'url' => array( |
| 489 | 'type' => 'string', |
| 490 | 'default' => '' |
| 491 | ), |
| 492 | 'iframeSrc' => array( |
| 493 | 'type' => 'string', |
| 494 | 'default' => '' |
| 495 | ), |
| 496 | ), |
| 497 | 'render_callback' => [ $this, 'embedpress_gutenberg_render_block_vimeo' ] |
| 498 | ) ); |
| 499 | endif; |
| 500 | } |
| 501 | public function embedpress_gutenberg_render_block_vimeo( $attributes ) { |
| 502 | ob_start(); |
| 503 | if ( !empty( $attributes ) && !empty( $attributes['iframeSrc'] ) ) : |
| 504 | $vimeo_options = $this->getOptions('vimeo', $this->get_vimeo_settings_schema()); |
| 505 | $vimeo_params = $this->get_vimeo_params( $vimeo_options ); |
| 506 | $iframeUrl = $attributes['iframeSrc']; |
| 507 | $align = 'align' . ( isset( $attributes[ 'align' ] ) ? $attributes[ 'align' ] : 'center' ); |
| 508 | foreach ( $vimeo_params as $param => $value ) { |
| 509 | $iframeUrl = add_query_arg( $param, $value, $iframeUrl ); |
| 510 | } |
| 511 | //@TODO; test responsive without static height width, keeping for now backward compatibility |
| 512 | ?> |
| 513 | <div class="ose-vimeo wp-block-embed-vimeo <?php echo $align; ?>"> |
| 514 | <iframe src="<?php echo $iframeUrl; ?>" allowtransparency="true" frameborder="0" width="640" height="360"> |
| 515 | </iframe> |
| 516 | </div> |
| 517 | <?php |
| 518 | endif; |
| 519 | |
| 520 | return apply_filters( 'embedpress_gutenberg_block_markup', ob_get_clean()); |
| 521 | } |
| 522 | public function get_youtube_settings_schema() { |
| 523 | return [ |
| 524 | 'autoplay' => [ |
| 525 | 'type' => 'bool', |
| 526 | 'label' => 'Auto Play', |
| 527 | 'description' => 'Automatically start to play the videos when the player loads.', |
| 528 | 'default' => false |
| 529 | ], |
| 530 | 'color' => [ |
| 531 | 'type' => 'string', |
| 532 | 'label' => 'Progress bar color', |
| 533 | 'description' => 'Specifies the color that will be used in the player\'s video progress bar to highlight the amount of the video that the viewer has already seen.<br/>Note: Setting the color to <strong>white</strong> will disable the <strong>Modest Branding</strong> option (causing a YouTube logo to be displayed in the control bar).', |
| 534 | 'options' => [ |
| 535 | 'red' => 'Red', |
| 536 | 'white' => 'White' |
| 537 | ], |
| 538 | 'default' => 'red' |
| 539 | ], |
| 540 | 'cc_load_policy' => [ |
| 541 | 'type' => 'bool', |
| 542 | 'label' => 'Force Closed Captions', |
| 543 | 'description' => 'Setting this option to <strong>Yes</strong> causes closed captions to be shown by default, even if the user has turned captions off. This will be based on user preference otherwise.', |
| 544 | 'default' => false |
| 545 | ], |
| 546 | 'controls' => [ |
| 547 | 'type' => 'string', |
| 548 | 'label' => 'Display Controls', |
| 549 | 'description' => 'Indicates whether the video player controls are displayed.', |
| 550 | 'options' => [ |
| 551 | '1' => 'Display immediately', |
| 552 | '2' => 'Display after user initiation', |
| 553 | '0' => 'Hide controls', |
| 554 | ], |
| 555 | 'default' => '1' |
| 556 | ], |
| 557 | 'fs' => [ |
| 558 | 'type' => 'bool', |
| 559 | 'label' => 'Enable Fullscreen button', |
| 560 | 'description' => 'Indicates whether the fullscreen button is enabled.', |
| 561 | 'default' => true |
| 562 | ], |
| 563 | 'iv_load_policy' => [ |
| 564 | 'type' => 'radio', |
| 565 | 'label' => 'Display video annotations', |
| 566 | 'description' => 'Indicates whether video annotations are displayed.', |
| 567 | 'options' => [ |
| 568 | '1' => 'Display', |
| 569 | '3' => 'Do not display' |
| 570 | ], |
| 571 | 'default' => '1' |
| 572 | ], |
| 573 | 'rel' => [ |
| 574 | 'type' => 'bool', |
| 575 | 'label' => 'Display related videos', |
| 576 | 'description' => 'Indicates whether the player should show related videos when playback of the initial video ends.', |
| 577 | 'default' => true |
| 578 | ], |
| 579 | 'modestbranding' => [ |
| 580 | 'type' => 'string', |
| 581 | 'label' => 'Modest Branding', |
| 582 | 'description' => 'Indicates whether the player should display a YouTube logo in the control bar.', |
| 583 | 'options' => [ |
| 584 | '0' => 'Display', |
| 585 | '1' => 'Do not display' |
| 586 | ], |
| 587 | 'default' => '0' |
| 588 | ], |
| 589 | 'logo_url' => [ |
| 590 | 'type' => 'url', |
| 591 | 'label' => __('Custom Logo URL', 'embedpress-pro'), |
| 592 | 'description' => __('You can show custom logo watermark on your video', 'embedpress-pro'), |
| 593 | ], |
| 594 | 'logo_xpos' => [ |
| 595 | 'type' => 'number', |
| 596 | 'label' => __( 'Logo X Position (%)', 'embedpress-pro' ), |
| 597 | 'description' => __( 'Change this number to move your logo in horizontal direction.', 'embedpress-pro' ), |
| 598 | 'default' => 10 |
| 599 | ], |
| 600 | 'logo_ypos' => [ |
| 601 | 'type' => 'number', |
| 602 | 'label' => __( 'Logo Y Position (%)', 'embedpress-pro' ), |
| 603 | 'description' => __( 'Change this number to move your logo in vertical direction.', 'embedpress-pro' ), |
| 604 | 'default' => 10 |
| 605 | ], |
| 606 | 'cta_url' => [ |
| 607 | 'type' => 'url', |
| 608 | 'label' => __( 'CTA link for Logo', 'embedpress-pro' ), |
| 609 | 'description' => __( 'You can show the logo inside a link. Leave it empty to hide it', 'embedpress-pro' ), |
| 610 | ], |
| 611 | ]; |
| 612 | } |
| 613 | public function get_vimeo_settings_schema() { |
| 614 | return array( |
| 615 | 'autoplay' => array( |
| 616 | 'type' => 'bool', |
| 617 | 'label' => 'Autoplay', |
| 618 | 'description' => 'Automatically start to play the videos when the player loads.', |
| 619 | 'default' => false |
| 620 | ), |
| 621 | 'loop' => array( |
| 622 | 'type' => 'bool', |
| 623 | 'label' => 'Loop', |
| 624 | 'description' => 'Play the video again automatically when it reaches the end.', |
| 625 | 'default' => false |
| 626 | ), |
| 627 | 'autopause' => array( |
| 628 | 'type' => 'bool', |
| 629 | 'label' => 'Autopause', |
| 630 | 'description' => 'Pause this video automatically when another one plays.', |
| 631 | 'default' => false |
| 632 | ), |
| 633 | 'vimeo_dnt' => array( |
| 634 | 'type' => 'bool', |
| 635 | 'label' => 'DNT', |
| 636 | 'description' => 'Setting this parameter to "yes" will block the player from tracking any session data, including all cookies', |
| 637 | 'default' => true, |
| 638 | ), |
| 639 | 'color' => array( |
| 640 | 'type' => 'text', |
| 641 | 'label' => 'Color', |
| 642 | 'description' => 'Specify the color of the video controls.', |
| 643 | 'default' => '#00adef', |
| 644 | 'classes' => 'color-field' |
| 645 | ), |
| 646 | 'display_title' => array( |
| 647 | 'type' => 'bool', |
| 648 | 'label' => 'Display Title', |
| 649 | 'description' => 'Indicates whether the title is displayed.', |
| 650 | 'default' => true |
| 651 | ), |
| 652 | 'display_author' => array( |
| 653 | 'type' => 'bool', |
| 654 | 'label' => 'Display Author', |
| 655 | 'description' => 'Indicates whether the author is displayed.', |
| 656 | 'default' => true |
| 657 | ), |
| 658 | 'display_avatar' => array( |
| 659 | 'type' => 'bool', |
| 660 | 'label' => 'Display Avatar', |
| 661 | 'description' => 'Indicates whether the avatar is displayed.', |
| 662 | 'default' => true |
| 663 | ) |
| 664 | ); |
| 665 | } |
| 666 | public function get_wistia_settings_schema() { |
| 667 | $schema = array( |
| 668 | 'display_fullscreen_button' => array( |
| 669 | 'type' => 'bool', |
| 670 | 'label' => __('Fullscreen Button', 'embedpress-wistia'), |
| 671 | 'description' => __('Indicates whether the fullscreen button is visible.', 'embedpress-wistia'), |
| 672 | 'default' => true |
| 673 | ), |
| 674 | 'display_playbar' => array( |
| 675 | 'type' => 'bool', |
| 676 | 'label' => __('Playbar', 'embedpress-wistia'), |
| 677 | 'description' => __('Indicates whether the playbar is visible.', 'embedpress-wistia'), |
| 678 | 'default' => true |
| 679 | ), |
| 680 | 'small_play_button' => array( |
| 681 | 'type' => 'bool', |
| 682 | 'label' => __('Small Play Button', 'embedpress-wistia'), |
| 683 | 'description' => __('Indicates whether the small play button is visible on the bottom left.', |
| 684 | 'embedpress-wistia'), |
| 685 | 'default' => true |
| 686 | ), |
| 687 | 'display_volume_control' => array( |
| 688 | 'type' => 'bool', |
| 689 | 'label' => __('Volume Control', 'embedpress-wistia'), |
| 690 | 'description' => __('Indicates whether the volume control is visible.', 'embedpress-wistia'), |
| 691 | 'default' => true |
| 692 | ), |
| 693 | 'autoplay' => array( |
| 694 | 'type' => 'bool', |
| 695 | 'label' => __('Auto Play', 'embedpress-wistia'), |
| 696 | 'description' => __('Automatically start to play the videos when the player loads.', |
| 697 | 'embedpress-wistia'), |
| 698 | 'default' => false |
| 699 | ), |
| 700 | 'volume' => array( |
| 701 | 'type' => 'text', |
| 702 | 'label' => __('Volume', 'embedpress-wistia'), |
| 703 | 'description' => __('Start the video with a custom volume level. Set values between 0 and 100.', |
| 704 | 'embedpress-wistia'), |
| 705 | 'default' => '100' |
| 706 | ), |
| 707 | 'player_color' => array( |
| 708 | 'type' => 'text', |
| 709 | 'label' => __('Color', 'embedpress-wistia'), |
| 710 | 'description' => __('Specify the color of the video controls.', 'embedpress-wistia'), |
| 711 | 'default' => '#00adef', |
| 712 | 'classes' => 'color-field' |
| 713 | ), |
| 714 | 'plugin_resumable' => array( |
| 715 | 'type' => 'bool', |
| 716 | 'label' => __('Plugin: Resumable', 'embedpress-wistia'), |
| 717 | 'description' => __('Indicates whether the Resumable plugin is active. Allow to resume the video or start from the begining.', |
| 718 | 'embedpress-wistia'), |
| 719 | 'default' => false |
| 720 | ), |
| 721 | 'plugin_captions' => array( |
| 722 | 'type' => 'bool', |
| 723 | 'label' => __('Plugin: Captions', 'embedpress-wistia'), |
| 724 | 'description' => __('Indicates whether the Captions plugin is active.', 'embedpress-wistia'), |
| 725 | 'default' => false |
| 726 | ), |
| 727 | 'plugin_captions_default' => array( |
| 728 | 'type' => 'bool', |
| 729 | 'label' => __('Captions Enabled By Default', 'embedpress-wistia'), |
| 730 | 'description' => __('Indicates whether the Captions are enabled by default.', 'embedpress-wistia'), |
| 731 | 'default' => false |
| 732 | ), |
| 733 | 'plugin_focus' => array( |
| 734 | 'type' => 'bool', |
| 735 | 'label' => __('Plugin: Focus', 'embedpress-wistia'), |
| 736 | 'description' => __('Indicates whether the Focus plugin is active.', 'embedpress-wistia'), |
| 737 | 'default' => false |
| 738 | ), |
| 739 | 'plugin_rewind' => array( |
| 740 | 'type' => 'bool', |
| 741 | 'label' => __('Plugin: Rewind', 'embedpress-wistia'), |
| 742 | 'description' => __('Indicates whether the Rewind plugin is active.', 'embedpress-wistia'), |
| 743 | 'default' => false |
| 744 | ), |
| 745 | 'plugin_rewind_time' => array( |
| 746 | 'type' => 'text', |
| 747 | 'label' => __('Rewind time (seconds)', 'embedpress-wistia'), |
| 748 | 'description' => __('The amount of time to rewind, in seconds.', 'embedpress-wistia'), |
| 749 | 'default' => '10' |
| 750 | ), |
| 751 | ); |
| 752 | |
| 753 | return $schema; |
| 754 | } |
| 755 | public function getVideoIDFromURL ($url) { |
| 756 | // https://fast.wistia.com/embed/medias/xf1edjzn92.jsonp |
| 757 | // https://ostraining-1.wistia.com/medias/xf1edjzn92 |
| 758 | preg_match('#\/medias\\\?\/([a-z0-9]+)\.?#i', $url, $matches); |
| 759 | |
| 760 | $id = false; |
| 761 | if (isset($matches[1])) { |
| 762 | $id = $matches[1]; |
| 763 | } |
| 764 | |
| 765 | return $id; |
| 766 | } |
| 767 | |
| 768 | public function embedpress_wistia_block_after_embed( $attributes ){ |
| 769 | $embedOptions= $this->embedpress_wistia_pro_get_options(); |
| 770 | // Get the video ID |
| 771 | $videoId = $this->getVideoIDFromURL($attributes['url']); |
| 772 | $shortVideoId = $videoId; |
| 773 | |
| 774 | $labels = array( |
| 775 | 'watch_from_beginning' => __('Watch from the beginning', 'embedpress-wistia'), |
| 776 | 'skip_to_where_you_left_off' => __('Skip to where you left off', 'embedpress-wistia'), |
| 777 | 'you_have_watched_it_before' => __('It looks like you\'ve watched<br />part of this video before!', 'embedpress-wistia'), |
| 778 | ); |
| 779 | $labels = json_encode($labels); |
| 780 | |
| 781 | |
| 782 | $html = '<script src="https://fast.wistia.com/assets/external/E-v1.js"></script>'; |
| 783 | $html .= "<script>window.pp_embed_wistia_labels = {$labels};</script>\n"; |
| 784 | $html .= "<script>wistiaEmbed = Wistia.embed( \"{$shortVideoId}\", {$embedOptions} );</script>\n"; |
| 785 | echo $html; |
| 786 | } |
| 787 | public function embedpress_wistia_pro_get_options() { |
| 788 | $options = $this->getOptions('wistia', $this->get_wistia_settings_schema()); |
| 789 | // Embed Options |
| 790 | $embedOptions = new \stdClass; |
| 791 | $embedOptions->videoFoam = true; |
| 792 | $embedOptions->fullscreenButton = (isset($options['display_fullscreen_button']) && (bool)$options['display_fullscreen_button'] === true); |
| 793 | $embedOptions->smallPlayButton = (isset($options['small_play_button']) && (bool)$options['small_play_button'] === true); |
| 794 | $embedOptions->autoPlay = (isset($options['autoplay']) && (bool)$options['autoplay'] === true); |
| 795 | |
| 796 | if (isset($options['player_color'])) { |
| 797 | $color = $options['player_color']; |
| 798 | if (null !== $color) { |
| 799 | $embedOptions->playerColor = $color; |
| 800 | } |
| 801 | } |
| 802 | |
| 803 | // Plugins |
| 804 | $pluginsBaseURL = plugins_url('assets/js/wistia/min', dirname(__DIR__) . '/embedpress-Wistia.php'); |
| 805 | |
| 806 | $pluginList = array(); |
| 807 | |
| 808 | // Resumable |
| 809 | if (isset($options['plugin_resumable'])) { |
| 810 | $isResumableEnabled = $options['plugin_resumable']; |
| 811 | if ($isResumableEnabled) { |
| 812 | // Add the resumable plugin |
| 813 | $pluginList['resumable'] = array( |
| 814 | 'src' => '//fast.wistia.com/labs/resumable/plugin.js', |
| 815 | 'async' => false |
| 816 | ); |
| 817 | } |
| 818 | } |
| 819 | // Add a fix for the autoplay and resumable work better together |
| 820 | //@TODO; check baseurl deeply, not looking good |
| 821 | if ($options['autoplay']) { |
| 822 | if ($isResumableEnabled) { |
| 823 | $pluginList['fixautoplayresumable'] = array( |
| 824 | 'src' => $pluginsBaseURL . '/fixautoplayresumable.min.js' |
| 825 | ); |
| 826 | } |
| 827 | } |
| 828 | |
| 829 | |
| 830 | // Focus plugin |
| 831 | if (isset($options['plugin_focus'])) { |
| 832 | $isFocusEnabled = $options['plugin_focus']; |
| 833 | $pluginList['dimthelights'] = array( |
| 834 | 'src' => '//fast.wistia.com/labs/dim-the-lights/plugin.js', |
| 835 | 'autoDim' => $isFocusEnabled |
| 836 | ); |
| 837 | $embedOptions->focus = $isFocusEnabled; |
| 838 | } |
| 839 | |
| 840 | $embedOptions->plugin = $pluginList; |
| 841 | $embedOptions = apply_filters( 'embedpress_wistia_params', $embedOptions); |
| 842 | $embedOptions = json_encode($embedOptions); |
| 843 | return apply_filters( 'embedpress_wistia_params_after_encode', $embedOptions); |
| 844 | } |
| 845 | |
| 846 | public function get_twitch_settings_schema() { |
| 847 | return [ |
| 848 | 'embedpress_pro_video_start_time' => [ |
| 849 | 'type' => 'number', |
| 850 | 'label' => __( 'Start Time (in Seconds)', 'embedpress-pro' ), |
| 851 | 'description' => __( 'You can put a custom time in seconds to start the video from. Example: 500', 'embedpress-pro' ), |
| 852 | 'default' => 0, |
| 853 | ], |
| 854 | 'embedpress_pro_twitch_autoplay' => [ |
| 855 | 'type' => 'string', |
| 856 | 'label' => __( 'Auto Play', 'embedpress-pro' ), |
| 857 | 'description' => __( 'Automatically start to play the videos when the player loads.', 'embedpress-pro' ), |
| 858 | 'options' => [ |
| 859 | 'yes' => __( 'Yes', 'embedpress-pro' ), |
| 860 | 'no' => __( 'No', 'embedpress-pro' ), |
| 861 | ], |
| 862 | 'default' => 'no', |
| 863 | ], |
| 864 | 'embedpress_pro_twitch_chat' => [ |
| 865 | 'type' => 'string', |
| 866 | 'label' => __( 'Show chat', 'embedpress-pro' ), |
| 867 | 'description' => __( 'You can show or hide chat using this settings' ), |
| 868 | 'options' => [ |
| 869 | 'yes' => __( 'Yes', 'embedpress-pro' ), |
| 870 | 'no' => __( 'No', 'embedpress-pro' ), |
| 871 | ], |
| 872 | 'default' => 'no', |
| 873 | ], |
| 874 | |
| 875 | 'embedpress_pro_twitch_theme' => [ |
| 876 | 'type' => 'string', |
| 877 | 'label' => __( 'Theme', 'embedpress-pro' ), |
| 878 | 'description' => __( 'Set dark or light theme for the twitch comment', 'embedpress-pro' ), |
| 879 | 'options' => [ |
| 880 | 'dark' => __( 'Dark', 'embedpress-pro' ), |
| 881 | 'light' => __( 'Light', 'embedpress-pro' ), |
| 882 | ], |
| 883 | 'default' => 'dark', |
| 884 | ], |
| 885 | 'embedpress_pro_fs' => [ |
| 886 | 'type' => 'string', |
| 887 | 'label' => 'Enable Fullscreen button', |
| 888 | 'description' => __( 'Indicates whether the fullscreen button is enabled.', 'embedpress-pro' ), |
| 889 | 'options' => [ |
| 890 | 'yes' => __( 'Yes', 'embedpress-pro' ), |
| 891 | 'no' => __( 'No', 'embedpress-pro' ), |
| 892 | ], |
| 893 | 'default' => 'yes', |
| 894 | ], |
| 895 | 'embedpress_pro_twitch_mute' => [ |
| 896 | 'type' => 'string', |
| 897 | 'label' => __( 'Mute on start', 'embedpress-pro' ), |
| 898 | 'description' => __( 'Set it to Yes to mute the video on start.', 'embedpress-pro' ), |
| 899 | 'options' => [ |
| 900 | 'yes' => __( 'Yes', 'embedpress-pro' ), |
| 901 | 'no' => __( 'No', 'embedpress-pro' ), |
| 902 | ], |
| 903 | 'default' => 'yes', |
| 904 | ], |
| 905 | |
| 906 | ]; |
| 907 | } |
| 908 | |
| 909 | public function get_dailymotion_settings_schema() { |
| 910 | return [ |
| 911 | 'autoplay' => [ |
| 912 | 'type' => 'string', |
| 913 | 'default' => '' |
| 914 | ], |
| 915 | 'play_on_mobile' => [ |
| 916 | 'type' => 'string', |
| 917 | 'default' => '' |
| 918 | ], |
| 919 | 'color' => [ |
| 920 | 'type' => 'string', |
| 921 | 'default' => '#dd3333' |
| 922 | ], |
| 923 | 'mute' => [ |
| 924 | 'type' => 'string', |
| 925 | 'default' => '' |
| 926 | ], |
| 927 | 'controls' => [ |
| 928 | 'type' => 'string', |
| 929 | 'default' => '1' |
| 930 | ], |
| 931 | 'video_info' => [ |
| 932 | 'type' => 'string', |
| 933 | 'default' => '1' |
| 934 | ], |
| 935 | 'show_logo' => [ |
| 936 | 'type' => 'string', |
| 937 | 'default' => '1' |
| 938 | ], |
| 939 | 'start_time' => [ |
| 940 | 'type' => 'string', |
| 941 | 'default' => '0' |
| 942 | ], |
| 943 | ]; |
| 944 | } |
| 945 | |
| 946 | public function get_soundcloud_settings_schema() { |
| 947 | return [ |
| 948 | 'visual' => [ |
| 949 | 'type' => 'string', |
| 950 | 'default' => '' |
| 951 | ], |
| 952 | 'autoplay' => [ |
| 953 | 'type' => 'string', |
| 954 | 'default' => '' |
| 955 | ], |
| 956 | 'play_on_mobile' => [ |
| 957 | 'type' => 'string', |
| 958 | 'default' => '' |
| 959 | ], |
| 960 | 'color' => [ |
| 961 | 'type' => 'string', |
| 962 | 'default' => '#dd3333' |
| 963 | ], |
| 964 | |
| 965 | 'share_button' => [ |
| 966 | 'type' => 'string', |
| 967 | 'default' => '' |
| 968 | ], |
| 969 | 'comments' => [ |
| 970 | 'type' => 'string', |
| 971 | 'default' => '1' |
| 972 | ], |
| 973 | 'artwork' => [ |
| 974 | 'type' => 'string', |
| 975 | 'default' => '' |
| 976 | ], |
| 977 | 'play_count' => [ |
| 978 | 'type' => 'string', |
| 979 | 'default' => '1' |
| 980 | ], |
| 981 | 'username' => [ |
| 982 | 'type' => 'string', |
| 983 | 'default' => '1' |
| 984 | ], |
| 985 | 'download_button' => [ |
| 986 | 'type' => 'string', |
| 987 | 'default' => '1' |
| 988 | ], |
| 989 | 'buy_button' => [ |
| 990 | 'type' => 'string', |
| 991 | 'default' => '1' |
| 992 | ], |
| 993 | ]; |
| 994 | } |
| 995 | |
| 996 | } |