Plugin Directory

Changeset 2461813


Ignore:
Timestamp:
01/24/2021 03:25:43 PM (5 years ago)
Author:
Appizy
Message:

Version 2.1.0 of Appizy App Embed

Location:
appizy-app-embed
Files:
16 added
8 edited

Legend:

Unmodified
Added
Removed
  • appizy-app-embed/trunk/appizy-app-embed.php

    r1975563 r2461813  
    99Author: Appizy
    1010Author URI: http://www.appizy.com
    11 Version: 2.0.1
     11Version: 2.1.0
    1212Text Domain: appizy
    1313*/
    1414
    1515/*
    16 Copyright (C) 2017 Appizy
     16Copyright (C) 2017-2021 Appizy
    1717
    1818This program is free software: you can redistribute it and/or modify
  • appizy-app-embed/trunk/class/class-appizy-app-embed.php

    r1964229 r2461813  
    2626        add_action( 'wp_loaded', array( $this, 'enqueue_appizy_scripts' ) );
    2727        add_action( 'wp_loaded', array( $this, 'enqueue_appizy_styles' ) );
     28
     29        add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_appizy_admin_script' ) );
     30    }
     31
     32    public function enqueue_appizy_admin_script() {
     33        wp_register_script( 'appizy-admin-script', plugins_url( '/../js/admin-tools-screen.js', __FILE__ ), array( 'jquery' ), null, true );
     34
     35        wp_enqueue_script( 'appizy-admin-script' );
    2836    }
    2937
     
    3341    public function enqueue_appizy_scripts() {
    3442        wp_register_script( 'appizy-script', plugins_url( '/../js/embed.js', __FILE__ ), array( 'jquery' ), null, true );
    35         wp_register_script( 'appizy-admin-script', plugins_url( '/../js/admin-tools-screen.js', __FILE__ ), array( 'jquery' ), null, true );
    36         wp_register_style( 'appizy-styles', plugins_url( '/../css/appizy-styles.css', __FILE__ ) );
    3743
    3844        wp_enqueue_script( 'appizy-script' );
    39         wp_enqueue_script( 'appizy-admin-script' );
    4045
    4146        wp_localize_script(
     
    5156     */
    5257    public function enqueue_appizy_styles() {
     58        wp_register_style( 'appizy-styles', plugins_url( '/../css/appizy-styles.css', __FILE__ ) );
     59
    5360        wp_enqueue_style( 'appizy-styles' );
    5461    }
  • appizy-app-embed/trunk/css/appizy-styles.css

    r1964229 r2461813  
    1 .appizy-app {
    2 
    3 }
    41
    52.appizy-app-iframe {
     
    96
    107.appizy-app-toolbar {
    11     border-bottom: 1px solid #eee;
    128    border-top: 1px solid #eee;
    139    margin: 0.4em 0 1em 0;
  • appizy-app-embed/trunk/includes/admin-tools-screen.php

    r1964229 r2461813  
    5959                </tr>
    6060                <tr>
     61                    <th><?php _e( 'Manual height' ); ?></th>
     62                    <td>
     63                        <input name="height" type="number" value="" placeholder="" size="4"> px
     64                        <p class="description"><?php _e( 'Leave empty for auto height.' ); ?></p>
     65                    </td>
     66                </tr>
     67                <tr>
    6168                    <th><?php _e( 'Shortcode' ); ?></th>
    6269                    <td>
  • appizy-app-embed/trunk/includes/app-embed.php

    r1964229 r2461813  
    1717    $attributes = shortcode_atts(
    1818        [
    19             'id'   => null,
    20             'save' => 'disabled',
     19            'id'     => null,
     20            'save'   => 'disabled',
     21            'height' => null
    2122        ],
    2223        $attributes,
     
    2728
    2829    $atts_id = $attributes['id'];
     30    $height_attribute = $attributes['height'] ? 'height="' . $attributes['height'] . '" ' : '';
    2931
    30     $content = "<div class='appizy-app'><iframe class='appizy-app-iframe' " .
    31         "data-app-id='$atts_id' frameborder='0' width='100%' src='$attachment_url'></iframe>";
     32    $content = "<div class='appizy-app'><iframe class='appizy-app-iframe' " . $height_attribute .
     33               "data-app-id='$atts_id' frameborder='0' width='100%' src='$attachment_url'></iframe>";
    3234
    3335    if ( is_user_logged_in() ) {
     
    3537        if ( 'enabled' === $attributes['save'] ) {
    3638            $content .= '<div class="appizy-app-toolbar">';
    37             $content .= '<button type="submit">Save</button>';
     39            $content .= '<button class="button" type="submit">Save</button>';
    3840            $content .= '</div>';
    3941        }
  • appizy-app-embed/trunk/js/admin-tools-screen.js

    r1964229 r2461813  
    1313        var appIdSelector = appizyGeneratorForm.querySelector('select[name="app-id"]');
    1414        var enableSaveDataCheckbox = appizyGeneratorForm.querySelector('input[name="enable-save"]');
     15        var appContainerHeight = appizyGeneratorForm.querySelector('input[name="height"]');
    1516
    1617        appizyGeneratorForm.addEventListener('change', function () {
    1718            var appId = appIdSelector.value;
    1819            var enableSave = enableSaveDataCheckbox.checked;
     20            var height = appContainerHeight.value;
    1921
    20             shortCodeOutput.value = generateShortCode(appId, enableSave);
     22            shortCodeOutput.value = generateShortCode(appId, enableSave, height);
    2123        });
    2224    }
    2325
    2426    /**
    25      * @param {string} appId
    26      * @param {boolean} enableSave
    27      * @return {string}
    28      */
    29     function generateShortCode(appId, enableSave) {
     27     * @param {string} appId
     28     * @param {boolean} enableSave
     29     * @param {string} appContainerHeight
     30     * @return {string}
     31     */
     32    function generateShortCode(appId, enableSave, appContainerHeight) {
    3033        var shortCode = '';
    3134
     
    3639                shortCode += ' save="enabled"';
    3740            }
     41
     42            if (appContainerHeight > 0) {
     43                shortCode += ' height="' + appContainerHeight + '"';
     44            }
    3845
    3946            shortCode += ']';
  • appizy-app-embed/trunk/js/embed.js

    r1964229 r2461813  
    22
    33(function ($) {
    4     var default_margin = 16;
    54    var apps = document.getElementsByClassName('appizy-app');
    65
     
    1211        var isSaveEnabled = !!saveButton;
    1312
    14         frame.addEventListener('load', _resizeFrame);
     13                if (!frame.height) {
     14                        frame.addEventListener('load', _resizeFrame);
     15                }
    1516
    1617        if (isSaveEnabled) {
     
    2122
    2223    function _resizeFrame() {
    23         this.style.height = this.contentWindow.document.body.offsetHeight + default_margin + 'px';
     24        this.style.height = this.contentWindow.document.body.scrollHeight + 'px';
    2425    }
    2526
  • appizy-app-embed/trunk/readme.txt

    r2202901 r2461813  
    33Tags: appizy, spreadsheet, embed, calculator, web-calculator
    44Requires at least: 4.9
    5 Tested up to: 5.3
     5Tested up to: 5.6
    66Requires PHP: 5.6
    77Stable tag:2.0.1
     
    8585== Changelog ==
    8686
     87= 2.1.0 =
     88
     89* Add new "height" option in shortcode configuration to skip auto-height calculation on load.
     90* Remove default margin in auto-height calculation.
     91
    8792= 2.0.1 =
    8893* Fix the version number inside plugin files
Note: See TracChangeset for help on using the changeset viewer.