Plugin Directory

Changeset 2047525


Ignore:
Timestamp:
03/10/2019 10:59:40 AM (7 years ago)
Author:
retokuhn
Message:

Fixed issues with parameters "thumbnail", "width", "height".

Location:
embed-simplex-player/trunk
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • embed-simplex-player/trunk/embed-simplex-player.php

    r2047135 r2047525  
    22/**
    33 * @package embed-simplex-player
    4  * @version 1.0.2
     4 * @version 1.0.3
    55 */
    66/*
     
    88Plugin URI:     https://wordpress.org/plugins/embed-simplex-player/
    99Description:    Integrate the xtendx simplex player with a shortcode. Generates an embed code and displays the simplex player in a responsive iframe.
    10 Version:        1.0.2
     10Version:        1.0.3
    1111Author:         Reto Kuhn
    1212Author URI:     https://retokuhn.ch
     
    4040            'pid' => '',
    4141            'embed' => '1',
    42             'width' => '1280',
    43             'height' => '720',
     42            'width' => '',
     43            'height' => '',
    4444            'get' => '',
    4545            'style_wrapper' => '',
    4646            'style_iframe' => '',
    4747            'thumbnail' => '',
     48            'style_thumbnail' => '',
    4849        ), $atts, $tag );
    4950
     
    6061    $width = sanitize_key( $atts['width'] );
    6162    $height = sanitize_key( $atts['height'] );
    62     $ratio = ($height / $width) * 100;
    6363    $get = $atts['get'];
    6464    if ( !empty($get) ) {
     
    6969    $style_iframe = sanitize_text_field( $atts['style_iframe'] );
    7070    $thumbnail = sanitize_text_field( $atts['thumbnail'] );
     71    $style_thumbnail = sanitize_text_field( $atts['style_thumbnail'] );
    7172
    7273    // create iframe url
     
    7677
    7778        // iframe
    78         $iframe_code = '<iframe style="position:absolute;top:0;left:0;width:100%;height:100%;' . $style_iframe . '" width="' . $width . '" height="' . $height . '" ';
     79        $iframe_code = '<iframe style="position:absolute;top:0;left:0;width:100%;height:100%;' . $style_iframe . '"';
    7980        $iframe_code .= 'src="' . $iframe_url . '" ';
    8081        $iframe_code .= 'frameborder="0" allowfullscreen="true" webkitallowfullscreen="true" mozallowfullscreen="true" scrolling="no">';
     
    8283
    8384        // output start
    84         $output = '<div style="position:relative;padding-bottom:' . $ratio . '%;height:0;overflow:hidden;margin:0;max-width:none;' . $style_wrapper . '">';
     85        if ( !empty($height) ) {
     86            $style_size = "height:" . $height . "px;";
     87            if ( !empty($width) ) {
     88                $style_size .= "width:" . $width . "px;";
     89            }
     90        }else{
     91            $width = 1280;
     92            $height = 720;
     93            $ratio = ($height / $width) * 100;
     94            $style_size = "padding-bottom:" . $ratio . "%;";
     95        }
     96       
     97        $output = '<div style="position:relative;overflow:hidden;' . $style_size . $style_wrapper . '">';
    8598
    8699        // thumbnail
    87100        if ($thumbnail == 1) {
    88101            $thumbnail_url = $url . 'content/' . $cid . '/' . $aid . '/' . $pid . '/simvid_1.jpg';
    89             $thumbnail_code = '<script>function loadIframe(el) { el.parentNode.innerHTML="'.addslashes($iframe_code).'"; }</script>';
    90             $thumbnail_code .= '<img src="'.$thumbnail_url.'" onclick="loadIframe(this);">';
     102            $thumbnail_code = '<img src="'.$thumbnail_url.'" data-iframe-code="'.str_replace('"', "'", $iframe_code).'" onclick="loadIframe(this);">';
    91103            $output .= $thumbnail_code;
    92104        }else{
     
    104116}
    105117
     118function embed_simplex_player_script() {
     119    wp_register_script('embed-simplex-player', plugins_url('embed-simplex-player/js/script.js'));
     120    wp_enqueue_script('embed-simplex-player');
     121}
     122add_action( 'wp_enqueue_scripts', 'embed_simplex_player_script' );
     123
    106124function embed_simplex_player_init() {
    107125    add_shortcode('embed-simplex-player', 'embed_simplex_player');
  • embed-simplex-player/trunk/readme.txt

    r2047135 r2047525  
    33Tags: xtendx, simplex, player, embed
    44Requires at least: 4.0
    5 Tested up to: 5.1.0
     5Tested up to: 5.2.0
    66Requires PHP: 5.6
    7 Stable tag: 1.0.2
     7Stable tag: 1.0.3
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    6565= 1.0.2 =
    6666* Additional parameter "thumbnail" loads video iframe after a click on the thumbnail image.
     67= 1.0.3 =
     68* Fixed issues with parameters "thumbnail", "width", "height".
Note: See TracChangeset for help on using the changeset viewer.