Plugin Directory

Changeset 2149034


Ignore:
Timestamp:
08/31/2019 08:20:50 PM (7 years ago)
Author:
Somonator
Message:

update to 1.2

Location:
last-comments-vk-widget/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • last-comments-vk-widget/trunk/Readme.txt

    r2015675 r2149034  
    1212
    1313== Installation ==
    14 1. Install Vk comments in your site.
    15 2. Install this plugin.
    16 3. Add widget.
    17 4. Use.
     141. Install Vk comments in your site
     152. Install this plugin
     163. Add widget
    1817
    1918== Frequently Asked Questions ==
     
    27261.0 Release
    28271.1 Completely rewritten code
     281.2 Minification of the layout code, processing the required fields
  • last-comments-vk-widget/trunk/last-comments-vk-widget.php

    r2015675 r2149034  
    44    Plugin URI:
    55    Description: Widget last comments VK
    6     Version: 1.1
     6    Version: 1.2
    77    Author: Somonator
    88    Author URI:
     
    6565        <p>
    6666            <label><?php echo $translate; ?>
    67             <input type="text" name="<?php echo $this->get_field_name($name); ?>" value="<?php echo esc_attr($val); ?>" class="widefat" <?php echo !empty($required)?'required':null; ?>>
     67                <input type="text" name="<?php echo $this->get_field_name($name); ?>" value="<?php echo esc_attr($val); ?>" class="widefat" <?php echo !empty($required)?'required':null; ?>>
     68            </label>
    6869        </p>
    6970        <?php
     
    8687            add_action('wp_footer', array($this, 'inner_scripts'));
    8788        }
     89        add_action('admin_footer', array($this, 'add_scripts_to_admin'));
    8890        add_action('plugins_loaded', array($this, 'lang_load'));       
    8991    }
     
    9395            wp_enqueue_script('vk-api', '//vk.com/js/api/openapi.js');
    9496        }
    95         wp_add_inline_script('vk-api', '
    96             window.onload = function () {
    97                 VK.init({apiId: lcv.appid, onlyWidgets: false});
    98                 VK.Widgets.CommentsBrowse("last-comments-vk", {limit: lcv.limit, mini: 0});
    99             }
    100         ');
     97        wp_add_inline_script('vk-api', 'window.onload = function () {VK.init({apiId: lcv.appid, onlyWidgets: false}); VK.Widgets.CommentsBrowse("last-comments-vk", {limit: lcv.limit, mini: 0});}');
    10198    }
    10299   
    103100    public function inner_scripts() {
    104101        ?>
    105         <style>
    106             #last-comments-vk,
    107             #last-comments-vk iframe {
    108                 width: 100% !important;
    109                 max-width: 100% !important;         
    110                 display: table;
    111             }
    112         </style>
     102        <style>#last-comments-vk,#last-comments-vk iframe{width:100%!important;max-width:100%!important;display:table;}</style>
    113103        <?php
     104    }
     105   
     106    public function add_scripts_to_admin() {
     107        if (get_current_screen()->base == 'widgets') {
     108            ?>
     109            <script>jQuery(function($){$(document).delegate('[id*="lcv_widget"] input[name="savewidget"]', 'click', function() {var $form = $(this).parents().closest('form');$form.find('input[required]').each(function() {if (!$(this)[0].checkValidity()) {$(this)[0].reportValidity();}});});});</script>
     110            <?php
     111        }
    114112    }
    115113   
Note: See TracChangeset for help on using the changeset viewer.