Plugin Directory

Changeset 938111

Timestamp:
06/24/2014 11:18:44 PM (10 years ago)
Author:
wpsmith
Message:

Update 1.1.5

Location:
genesis-featured-content-widget/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • genesis-featured-content-widget/trunk/gs-featured-content-widget.php

    r897356 r938111  
    44 * Plugin URI: https://wpsmith.net/
    55 * Description: Based on the Genesis Featured Widget Amplified for additional functionality which allows support for custom post types, taxonomies, and extends the flexibility of the widget via action hooks to allow the elements to be re-positioned or other elements to be added.
    6  * Version: 1.1.4
     6 * Version: 1.1.
    77 * Author: Travis Smith
    88 * Author URI: http://wpsmith.net/
     
    8282function gsfc_widgets_init() {
    8383    $gfwa = genesis_get_option( 'gsfc_gfwa' );
    84     if ( class_exists( 'Genesis_Featured_Widget_Amplified' ) && $gfwa )
     84    if ( class_exists( 'Genesis_Featured_Widget_Amplified' ) && $gfwa )
    8585        unregister_widget( 'Genesis_Featured_Widget_Amplified' );
     86
    8687    register_widget( 'GS_Featured_Content' );
    8788}
     
    104105    return $links;
    105106}
     107
     108
     109
     110
     111
     112
     113
     114
     115
     116
     117
     118
     119
     120
     121
     122
     123
     124
     125
     126
     127
     128
  • genesis-featured-content-widget/trunk/widget.php

    r897356 r938111  
    389389    public static function do_post_image( $instance ) {
    390390        //* Bail if empty show param
    391         if ( empty( $instance['show_image'] ) ) return;
    392        
     391        if ( empty( $instance['show_image'] ) ) {
     392            return;
     393        }
     394
    393395        $align = $instance['image_alignment'] ? esc_attr( $instance['image_alignment'] ) : 'alignnone';
    394         $link  = $instance['link_image_field'] && genesis_get_custom_field( $instance['link_image_field'] ) ? genesis_get_custom_field( $instance['link_image_field'] ) : get_permalink();
     396        $link  = $instance['link_image_field'] ? $instance['link_image_field'] : get_permalink();
     397        $link  = genesis_get_custom_field( 'gsfc_link_image_field' ) ? genesis_get_custom_field( 'gsfc_link_image_field' ) : $instance['link_image_field'];
    395398       
    396399        $image = genesis_get_image( array(
     
    427430     */
    428431    public static function action( $name, $instance ) {
     432
     433
     434
    429435        do_action( $name, $instance );
    430436    }
     
    483489            $hclass = '';
    484490        }
    485        
    486         printf( '<h2%s>%s%s%s</h2>', $hclass, $wrap_open, $title, $wrap_close );
     491
     492        $pattern = apply_filters( 'gsfc_post_title_pattern', '<h2%s>%s%s%s</h2>' );
     493        printf( $pattern, $hclass, $wrap_open, $title, $wrap_close );
    487494    }
    488495   
     
    494501    public static function do_post_content( $instance ) {
    495502        //* Bail if empty show param
    496         if ( empty( $instance['show_content'] ) ) return;
    497        
    498         if ( $instance['show_content'] == 'excerpt' ) {
    499             add_filter( 'excerpt_more', array( 'GS_Featured_Content', 'excerpt_more' ) );
    500             the_excerpt();
    501             remove_filter( 'excerpt_more', array( 'GS_Featured_Content', 'excerpt_more' ) );
    502         } elseif ( $instance['show_content'] == 'content-limit' ) {
    503             the_content_limit( ( int ) $instance['content_limit'], esc_html( $instance['more_text'] ) );
    504         } elseif ( $instance['show_content'] == 'content' ) {
    505             the_content( esc_html( $instance['more_text'] ) );
    506         } else {
    507             do_action( 'gsfc_show_content' );
    508         }
     503        if ( empty( $instance['show_content'] ) ) {
     504            return;
     505        }
     506
     507        if ( '' !== $instance['show_content'] && ( $pre = apply_filters( 'gsfc_post_content_add_entry_content', false ) ) ) {
     508            echo '<div class="entry-content">';
     509        }
     510        switch ( $instance['show_content'] ) {
     511            case 'excerpt':
     512                add_filter( 'excerpt_more', array( 'GS_Featured_Content', 'excerpt_more' ) );
     513                the_excerpt();
     514                remove_filter( 'excerpt_more', array( 'GS_Featured_Content', 'excerpt_more' ) );
     515                break;
     516            case 'content-limit':
     517                the_content_limit( ( int ) $instance['content_limit'], esc_html( $instance['more_text'] ) );
     518                break;
     519            case 'content':
     520                the_content( esc_html( $instance['more_text'] ) );
     521                break;
     522            default:
     523                do_action( 'gsfc_show_content' );
     524                break;
     525        }
     526        if ( '' !== $instance['show_content'] && ( $pre = apply_filters( 'gsfc_post_content_add_entry_content', false ) ) ) {
     527            echo '</div>';
     528        }
     529       
    509530    }
    510531
     
    607628     */
    608629    protected static function get_transient( $name ) {
    609         if ( defined( 'WP_DEBUG' ) && WP_DEBUG && apply_filters( 'gsfc_debug', false ) ) {
     630        if ( defined( 'WP_DEBUG' ) && WP_DEBUG apply_filters( 'gsfc_debug', false ) ) {
    610631            GS_Featured_Content::delete_transient( $name );
    611632            return false;
     
    15631584     */
    15641585    protected static function get_taxonomies( $args = array(), $output = 'names', $operator = 'and' ) {
    1565         $cache_key  = 'gsfc_get_tax_' . md5( $value );
     1586       
     1587        $cache_key  = 'gsfc_get_tax_' . md5( GS_Featured_Content::$widget_instance['widget']->id );
    15661588        $taxonomies = wp_cache_get( $cache_key, 'get_taxonomies' );
    15671589
    1568         if ( false === $term_id ) {
     1590        if ( false === $t ) {
    15691591            $taxonomies = get_taxonomies( $args, $output, $operator );
    15701592            if ( $taxonomies && ! is_wp_error( $taxonomies ) ) {
     
    15751597            }
    15761598        } else {
    1577             $term = get_taxonomies( $args, $output, $operator );
     1599            $t = get_taxonomies( $args, $output, $operator );
    15781600        }
     1601
     1602
    15791603    }
    15801604   
     
    16601684                       
    16611685                        case 'select_taxonomy' :
     1686
     1687
     1688
     1689
    16621690                            printf( '<label for="%1$s">%2$s:</label><select id="%1$s" name="%3$s" onchange="gsfcSave(this)"><option value="" class="gs-pad-left-10" %4$s>%5$s</option>',
    16631691                                $obj->get_field_id( $field_id ),
     
    16671695                                __( 'All Taxonomies and Terms', 'gsfc' )
    16681696                            );
    1669                            
    1670                             $taxonomies = GS_Featured_Content::get_taxonomies( apply_filters( 'gsfc_get_taxonomies_args', array( 'public' => true ), $instance, $obj ), 'objects' );
    1671                             $taxonomies = array_filter( $taxonomies, array( __CLASS__, 'exclude_taxonomies' ) );
    16721697
    16731698                            foreach ( $taxonomies as $taxonomy ) {
     
    17731798     */
    17741799    public static function do_form_fields( $instance, $object ) {
    1775         GS_Featured_Content::$widget_instance = $instance;
    1776        
     1800        GS_Featured_Content::$widget_instance = ;
     1801
    17771802        //* Get Columns
    17781803        $columns = GS_Featured_Content::get_form_fields();
     
    17921817        //* Merge with defaults
    17931818        $instance = wp_parse_args( (array) $instance, $this->defaults );
    1794         GS_Featured_Content::$widget_instance = $instance;
     1819        // GS_Featured_Content::$widget_instance = $instance;
     1820        GS_Featured_Content::$widget_instance = array_merge( $instance, array( 'widget' => $this ) );
    17951821       
    17961822        //* Title Field
     
    18031829       
    18041830        do_action( 'gsfc_output_form_fields', $instance, $this );
    1805         // GS_Featured_Content::$widget_instance = $instance;
    18061831       
    18071832        echo '</div>';
     
    18951920    }
    18961921   
    1897    /**
    1898     * Linkify widget title
    1899     *
    1900     * @param string $widget_title
    1901     * @param array $instance The settings for the particular instance of the widget.
    1902     * @param string $id_base ID base of the widget.
    1903     * @return string Maybe modified widget title.
    1904     */
     1922   /**
     1923    * Linkify widget title
     1924    *
     1925    * @param string $widget_title
     1926    * @param array $instance The settings for the particular instance of the widget.
     1927    * @param string $id_base ID base of the widget.
     1928    * @return string Maybe modified widget title.
     1929    */
    19051930    public function widget_title( $widget_title, $instance, $id_base ) {
    19061931       
     
    19211946    public function widget( $args, $instance ) {
    19221947
    1923         GS_Featured_Content::$widget_instance &= $instance;
     1948        GS_Featured_Content::$widget_instance ;
    19241949        global $wp_query, $_genesis_displayed_ids, $gs_counter;
    19251950
     
    20162041       
    20172042        //* Before Loop Action
    2018         GS_Featured_Content::action( 'gs_before_loop', $instance );
     2043        if ( has_filter( 'gs_before_loop' ) ) {
     2044            GS_Featured_Content::action( 'gs_before_loop', $instance );
     2045        }
     2046        GS_Featured_Content::action( 'gsfc_before_loop', $instance );
    20192047       
    20202048        if ( 0 === $instance['posts_num'] ) return;
Note: See TracChangeset for help on using the changeset viewer.