Plugin Directory

Changeset 1391425


Ignore:
Timestamp:
04/10/2016 03:44:21 PM (10 years ago)
Author:
dbmartin
Message:

1.1.2: compatibility fix for WP 4.5 when rendering ::widget() in the Customizer

Location:
advanced-comments-widget
Files:
17 added
4 edited

Legend:

Unmodified
Added
Removed
  • advanced-comments-widget/trunk/advanced-comments-widget.php

    r1379963 r1391425  
    66 *
    77 * @license     http://www.gnu.org/licenses/gpl-2.0.txt GPL-2.0+
    8  * @version     1.1.1
     8 * @version     1.1.2
    99 *
    1010 * Plugin Name: Advanced Comments Widget
    1111 * Plugin URI:  http://darrinb.com/plugins/advanced-comments-widget
    1212 * Description: A highly customizable recent comments widget.
    13  * Version:     1.1.1
     13 * Version:     1.1.2
    1414 * Author:      Darrin Boutote
    1515 * Author URI:  http://darrinb.com
  • advanced-comments-widget/trunk/inc/class-acw-recent-comments-utilities.php

    r1379053 r1391425  
    2929class ACW_Recent_Comments_Utilities
    3030{
     31
     32    /**
     33     * Sets default parameters
     34     *
     35     * Use 'acw_instance_defaults' filter to modify accepted defaults.
     36     *
     37     * @uses WordPress current_theme_supports()
     38     *
     39     * @access public
     40     *
     41     * @since 1.0
     42     *
     43     * @return array $defaults The default values for the widget.
     44     */
     45    public static function instance_defaults()
     46    {
     47        $_comment_format = current_theme_supports( 'html5', 'comment-list' ) ? 'html5' : 'xhtml';
     48        $_list_style = ( 'html5' == $_comment_format ) ? 'div' : 'ul' ;
     49
     50        $_defaults = array(
     51            'title'          => __('Recent Comments'),
     52            'post_type'      => 'post',
     53            'exclude_pings'  => 1,
     54            'number'         => 5,
     55            'order'          => 'desc',
     56            'show_thumbs'    => 1,
     57            'thumb_size'     => 55,
     58            'show_excerpt'   => 1,
     59            'excerpt_length' => 50,
     60            'comment_format' => $_comment_format,
     61            'list_style'     => $_list_style,
     62        );
     63
     64        $defaults = apply_filters( 'acw_instance_defaults', $_defaults );
     65
     66        return $defaults;
     67    }
    3168
    3269
  • advanced-comments-widget/trunk/inc/class-widget-acw-recent-comments.php

    r1379963 r1391425  
    2323 * Core class used to implement a Recent Comments widget.
    2424 *
     25 * @version 1.1.2 Added method to build $defaults
    2526 * @version 1.1.1 Updated "acw_form_field_{$name}" filter
    2627 * @version 1.1 Added support for Selective Refresh
     
    8182            $args['widget_id'] = $this->id;
    8283        }
     84
     85        $defaults = ACW_Recent_Comments_Utilities::instance_defaults();
     86        $instance = wp_parse_args( (array) $instance, $defaults );
    8387
    8488        // build out the instance for plugin devs
     
    223227    {
    224228
    225         $_comment_format = current_theme_supports( 'html5', 'comment-list' ) ? 'html5' : 'xhtml';
    226         $_list_style = ( 'html5' == $_comment_format ) ? 'div' : 'ul' ;
    227 
    228         $_defaults = array(
    229             'title'          => __('Recent Comments'),
    230             'post_type'      => 'post',
    231             'exclude_pings'  => 1,
    232             'number'         => 5,
    233             'order'          => 'desc',
    234             'show_thumbs'    => 1,
    235             'thumb_size'     => 55,
    236             'show_excerpt'   => 1,
    237             'excerpt_length' => 50,
    238             'comment_format' => $_comment_format,
    239             'list_style'     => $_list_style,
    240         );
    241 
    242         $_defaults = apply_filters( 'acw_instance_defaults', $_defaults );
    243         $instance = wp_parse_args( (array) $instance, $_defaults );
     229        $defaults = ACW_Recent_Comments_Utilities::instance_defaults();
     230        $instance = wp_parse_args( (array) $instance, $defaults );
    244231
    245232        $_fields   =  array(
  • advanced-comments-widget/trunk/readme.txt

    r1379963 r1391425  
    44Requires at least: 4.4
    55Tested up to: 4.5
    6 Stable tag: 1.1.1
     6Stable tag: 1.1.2
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    7373== Changelog ==
    7474
     75= 1.1.2 =
     76* compatibility fix for WP 4.5 when rendering ::widget() in the Customizer
     77
    7578= 1.1.1 =
    7679* added field reference to `"acw_form_field_{$name}"` filter
Note: See TracChangeset for help on using the changeset viewer.