WordPress.org

Plugin Directory

Changeset 483969


Ignore:
Timestamp:
01/03/12 17:48:07 (2 years ago)
Author:
jakemgold
Message:

Fixed a backwards compatibility glitch related to get_secondary_content failing when passing in an integer to identify the old secondary block number (e.g. get_secondary_content(2);)

Location:
secondary-html-content/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • secondary-html-content/trunk/readme.txt

    r481371 r483969  
    55Requires at least: 3.3 
    66Tested up to: 3.3 
    7 Stable tag: 3.0 
     7Stable tag: 3.0.1 
    88 
    99Add additional HTML blocks to any post type. Perfect for layouts with distinct content blocks, such as a sidebar or two column view. 
     
    5353== Changelog == 
    5454 
     55= 3.0.1 = 
     56* Fixed a backwards compatibility glitch related to `get_secondary_content` failing when passing in an integer to identify the old secondary block number (e.g. `get_secondary_content(2);`) 
     57 
    5558= 3.0 = 
    5659* Effectively a complete rewrite! 
     
    7780== Upgrade Notice == 
    7881 
     82= 3.0.1 = 
     83Version 3.0 onwards *REQUIRES* WordPress 3.3 or newer; settings have moved to Settings > Writing. 3.0.1 fixes a compatibility glitch related to the get_secondary_content function for users upgrading from 2.0. 
     84 
    7985= 3.0 = 
    8086Virtually a complete rewrite, 3.0 *REQUIRES* WordPress 3.3 or newer. The plug-in will stop working on older versions (you can manually downgrade). A seamless upgrade path from v2.0 of the plug-in is built it. Note that plug-in settings have been *moved to Settings > Writing*. 
  • secondary-html-content/trunk/secondary-html-content.php

    r481371 r483969  
    44 Plugin URI: http://get10up.com/plugins/secondary-html-content-wordpress/ 
    55 Description: Add additional HTML editor blocks to your post types. Perfect for layouts with multiple distinct blocks, such as sidebars or multi-column designs. 
    6  Version: 3.0 
     6 Version: 3.0.1 
    77 Author: Jake Goldman (10up LLC) 
    88 Author URI: http://www.get10up.com 
     
    2323    along with this program; if not, write to the Free Software 
    2424    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA 
    25      
    26     Note: Previous versions of this plug-in may have incidently been attributed 
    27     to employers of Mr. Goldman. The copyright belongs - and has always  
    28     belonged - to Mr. Goldman personally. 
     25 
     26    Note: Previous versions of this plug-in may have been incidently attributed 
     27    to employers of Mr. Goldman. The copyright belongs - and has always 
     28     belonged - to Mr. Goldman personally. 
    2929*/ 
    3030class Secondary_HTML_Content_Mgmt { 
    31      
     31 
    3232    private $post_types; 
    33      
     33 
    3434    public function __construct() { 
    3535        // check for 3.3 functions and fail semi-gracefully if not present 
    3636        if ( ! function_exists( 'wp_editor' ) ) 
    3737            return; 
    38          
     38 
    3939        add_action( 'init', array( $this, 'init' ) ); 
    4040        add_action( 'admin_init', array( $this, 'admin_init' ) ); 
    4141        add_action( 'wp_ajax_secondary_html_content', array( $this, 'ajax_save' ) ); 
    4242    } 
    43      
     43 
    4444    public function init() { 
    4545        // register hidden post type - used to manage blocks 
    46         register_post_type( 'secondary_html', array(  
     46        register_post_type( 'secondary_html', array( 
    4747            'label' => 'Secondary HTML Blocks', 
    4848            'supports' => array('title'), 
    4949        )); 
    50          
     50 
    5151        // register hidden taxonomy for properties of blocks 
    5252        register_taxonomy( 'secondary_html_features', 'secondary_html', array( 
     
    5757            'show_ui' => false, 
    5858        )); 
    59          
     59 
    6060        // upgrade stuff 
    6161        if ( get_option( 'secondary_html_content_version', 0 ) < 3.0 ) { 
    6262            // save version number first to prevent potential flooding 
    6363            update_option( 'secondary_html_content_version', 3.0 ); 
    64              
     64 
    6565            // add configuration options to taxonomy 
    6666            if ( ! term_exists( 'Media Buttons', 'secondary_html_features' ) ) 
    6767                 wp_insert_term( 'Media Buttons', 'secondary_html_features', array( 'description' => 'Show media buttons in the editor, i.e. the media uploader' ) ); 
    68              
     68 
    6969            if ( ! term_exists( 'Tiny Editor', 'secondary_html_features' ) ) 
    7070                wp_insert_term( 'Tiny Editor', 'secondary_html_features', array( 'description' => 'Show a simplified version of the editor, for more basic editing' ) ); 
    71              
     71 
    7272            if ( ! term_exists( 'Inherit from Ancestors', 'secondary_html_features' ) ) 
    7373                wp_insert_term( 'Inherit from Ancestors', 'secondary_html_features', array( 'description' => 'For hierarchical post types (e.g. pages), inherit secondary content from ancestors if empty' ) ); 
    74                  
     74 
    7575            if ( ! term_exists( 'Treat Home as Ancestor', 'secondary_html_features' ) ) 
    7676                wp_insert_term( 'Treat Home as Ancestor', 'secondary_html_features', array( 'description' => 'When inheritance is turned on, treat home page as a top level ancestor for pages' ) ); 
    77              
     77 
    7878            // upgrade old fields 
    7979            if ( ( $old_options = get_option( 'secondary_html_options' ) ) && isset( $old_options['pages'] ) && isset( $old_options['posts'] ) ) { 
     
    8181                $blocks = max( (int) $old_options['pages'], (int) $old_options['posts'] ); 
    8282                $post_options = array(); 
    83                  
     83 
    8484                if ( ! empty( $old_options['inherit'] ) ) { 
    8585                    $term = get_term_by( 'name', 'Inherit from Ancestors', 'secondary_html_features' ); 
     
    9494                    $post_options[] = $term->slug; 
    9595                } 
    96                  
     96 
    9797                for ( $i=1; $i<=$blocks; $i++ ) { 
    9898                    // create new versions of blocks 
    9999                    if ( ! $block_id = wp_insert_post(array( 'post_type' => 'secondary_html', 'post_status' => 'publish', 'post_title' => (string) $i )) ) 
    100100                        continue; 
    101                      
     101 
    102102                    if ( $old_options['pages'] >= $i ) 
    103103                        add_post_meta( $block_id, '_secondary_post_types', 'page' ); 
    104                          
     104 
    105105                    if ( $old_options['posts'] >= $i ) 
    106106                        add_post_meta( $block_id, '_secondary_post_types', 'post' ); 
    107                      
     107 
    108108                    wp_set_object_terms( $block_id, $post_options, 'secondary_html_features' ); // delete old ones 
    109                      
     109 
    110110                    set_transient( 'secondary_html_block_id_' . $i,  $block_id ); // cache title / ID relationship 
    111                      
    112                     // update post meta                  
     111 
     112                    // update post meta 
    113113                    $wpdb->query( "UPDATE $wpdb->postmeta SET meta_key = '_secondary_html_" . $block_id . "' WHERE meta_key = '_secondary_content_$i'" ); 
    114114                } 
    115                  
     115 
    116116                delete_option( 'secondary_html_options' ); 
    117117            } 
    118              
     118 
    119119            // attempt to upgrade widgets 
    120120            if ( $widget_options = get_option( 'widget_secondary-html-content' ) ) { 
     
    127127        } 
    128128    } 
    129      
     129 
    130130    public function admin_init() { 
    131131        add_settings_section( 'secondary_html_content', 'Secondary HTML Content', array( $this, 'settings_section' ), 'writing' ); 
    132         add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), array( $this, 'plugin_action_links' ) );  
    133     } 
    134      
     132        add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), array( $this, 'plugin_action_links' ) ); 
     133    } 
     134 
    135135    /** 
    136136     * used by ajax and sesttings section to display a row about the block 
     
    144144            $block = get_post( $block ); 
    145145        } 
    146          
     146 
    147147        if ( ! isset( $block->ID ) || ! isset( $block->post_title ) ) 
    148148            return; 
    149          
     149 
    150150        $block_id = (int) $block->ID; 
    151151?> 
     
    157157                $post_types = empty( $this->post_types ) ? get_post_types(array( 'show_ui' => true ), 'all' ) : $this->post_types; 
    158158                $block_post_types = ( $block_id ) ? get_post_meta( $block_id, '_secondary_post_types' ) : array(); 
    159                          
     159 
    160160                foreach ( $post_types as $post_type ) { 
    161161                    if ( ! post_type_supports( $post_type->name, 'editor' ) ) // maybe change... 
    162162                        continue; 
    163                          
     163 
    164164                    echo ' 
    165165                        <label class="selectit" style="white-space: nowrap;"> 
    166                             <input type="checkbox" name="secondary-html-types[' . $block_id . '][]" value="' . esc_attr( $post_type->name ) . '" ' . checked( in_array( $post_type->name, $block_post_types ), true, false ) . ' class="secondary-html-types" />  
     166                            <input type="checkbox" name="secondary-html-types[' . $block_id . '][]" value="' . esc_attr( $post_type->name ) . '" ' . checked( in_array( $post_type->name, $block_post_types ), true, false ) . ' class="secondary-html-types" /> 
    167167                            <span>' . $post_type->labels->name . '</span> &nbsp; 
    168168                        </label> 
     
    180180            <?php endif; ?> 
    181181            </td> 
    182         </tr>    
     182        </tr> 
    183183<?php 
    184184    } 
    185      
     185 
    186186    function settings_section() { 
    187187?> 
    188188        <p><?php _e( 'Manage additional HTML blocks for all of your content types. Added by <a href="http://www.get10up.com/plugins/secondary-html-content-wordpress/">Secondary HTML Content plug-in</a>.', 'secondary_html_content' ); ?></p> 
    189189        <p class="hide-if-js"><?php _e( 'Secondary HTML Content requires JavaScript to be enabled.', 'secondary_html_content' ); ?></p> 
    190          
     190 
    191191        <script type="text/javascript"> 
    192192        function SaveSecondary(block_id) { 
     
    206206                        jQuery('#secondary-block-'+block_id+' input').removeAttr('disabled'); 
    207207                        jQuery('#secondary-html-title-0').val(''); 
    208                         jQuery('#secondary-block-0 input:checked').attr('checked',false);    
     208                        jQuery('#secondary-block-0 input:checked').attr('checked',false); 
    209209                    } else { 
    210210                        jQuery('#secondary-block-'+block_id).replaceWith(response); 
     
    215215            } 
    216216        } 
    217          
    218         function RemoveSecondary(block_id) {             
     217 
     218        function RemoveSecondary(block_id) { 
    219219            if ( confirm('<?php _e( 'Are you certain you want to remove this block? Removing a secondary block will also delete all content stored in that blocks!', 'secondary_html_content' ); ?>') ) { 
    220220                block_id = parseInt( block_id ); 
     
    226226            } 
    227227        } 
    228          
     228 
    229229        jQuery(document).ready(function(){ 
    230230            jQuery('#secondary-html-blocks input').change(function(){ jQuery(this).closest('tr').find('.save-button').addClass('button-primary'); jQuery('#secondary-html-blocks input').unbind('change'); }); 
     
    237237        }); 
    238238        </script> 
    239          
     239 
    240240        <table class="wp-list-table widefat fixed hide-if-no-js" id="secondary-html-content-table"> 
    241241            <thead> 
     
    251251            </tfoot> 
    252252            <tbody id="secondary-html-blocks"> 
    253             <?php  
     253            <?php 
    254254                $secondary_blocks = get_posts(array( 'post_type' => 'secondary_html', 'numberposts' => 100, 'orderby' => 'menu_order' )); 
    255                  
     255 
    256256                foreach ( $secondary_blocks as $block ) 
    257                     $this->secondary_html_info_row( $block );  
     257                    $this->secondary_html_info_row( $block ); 
    258258            ?> 
    259             </tbody>             
     259            </tbody> 
    260260        </table> 
    261261<?php 
    262262    } 
    263      
     263 
    264264    private function options_checklist( $block_id = 0 ) { 
    265265        $block_id = (int) $block_id; 
    266266        $block_options = empty( $block_id ) ? array() : $block_options = wp_get_object_terms( (int) $block_id, 'secondary_html_features', array( 'fields' => 'slugs' ) ); 
    267          
     267 
    268268        $options = get_terms( 'secondary_html_features', array( 'orderby' => 'nothing', 'hide_empty' => false ) ); 
    269          
     269 
    270270        foreach( $options as $option ) { 
    271271        ?> 
     
    277277        } 
    278278    } 
    279      
     279 
    280280    public function ajax_save() { 
    281281        if ( ! current_user_can('manage_options') || empty( $_POST['subaction'] ) || empty( $_POST['actiondata'] ) ) 
    282282            die; 
    283          
     283 
    284284        extract( $_POST ); 
    285          
     285 
    286286        if ( $subaction == 'save' ) { 
    287287            $post_array = array( 'post_type' => 'secondary_html', 'post_status' => 'publish' ); 
    288288            $post_types = array(); 
    289289            $post_options = array(); 
    290              
     290 
    291291            foreach( $actiondata as $post_data ) { 
    292292                if ( strpos( $post_data['name'], 'secondary-html-title' ) !== false ) 
     
    299299                    $post_array['ID'] = (int) $post_data['value']; 
    300300            } 
    301              
     301 
    302302            if ( empty( $post_array['post_title'] ) || empty( $post_types ) ) 
    303303                die; 
    304              
     304 
    305305            if ( ! $block_id = wp_insert_post( $post_array ) ) 
    306306                die; 
    307              
     307 
    308308            if ( isset( $post_array['ID'] ) ) 
    309309                delete_post_meta( $block_id, '_secondary_post_types' ); 
    310                      
     310 
    311311            foreach ( $post_types as $post_type ) { 
    312312                add_post_meta( $block_id, '_secondary_post_types', $post_type ); 
    313313            } 
    314              
     314 
    315315            wp_set_object_terms( $block_id, $post_options, 'secondary_html_features' ); // delete old ones 
    316              
     316 
    317317            set_transient( 'secondary_html_block_id_' . sanitize_title_with_dashes( $post_array['post_title'] ),  $block_id ); // cache title / ID relationship 
    318                  
     318 
    319319            $this->secondary_html_info_row( $block_id ); 
    320              
     320 
    321321            die; 
    322322        } 
    323          
     323 
    324324        if ( $subaction == 'delete' ) { 
    325325            $actiondata = (int) $actiondata; 
    326326            delete_post_meta_by_key( '_secondary_html_' . $actiondata ); 
    327327            delete_transient( 'secondary_html_block_id_' . sanitize_title_with_dashes( get_the_title( $actiondata ) ) ); 
    328             $status = wp_delete_post( $actiondata, true ) ? '1' : '0';  
     328            $status = wp_delete_post( $actiondata, true ) ? '1' : '0'; 
    329329            die( $status ); 
    330330        } 
    331          
     331 
    332332        die; 
    333333    } 
    334      
     334 
    335335    function plugin_action_links( $links ) { 
    336         array_unshift( $links, '<a href="' . admin_url( 'options-writing.php#secondary-html-content-table' ) . '">' . __('Settings') . '</a>' );  
    337         return $links;  
    338     }    
     336        array_unshift( $links, '<a href="' . admin_url( 'options-writing.php#secondary-html-content-table' ) . '">' . __('Settings') . '</a>' ); 
     337        return $links; 
     338    } 
    339339} 
    340340 
     
    345345 */ 
    346346class Secondary_HTML_Content_Input { 
    347      
     347 
    348348    public function __construct() { 
    349349        // check for 3.3 functions and fail semi-gracefully if not present 
    350350        if ( ! function_exists( 'wp_editor' ) ) 
    351351            return; 
    352          
     352 
    353353        add_action( 'add_meta_boxes', array( $this, 'setup_editor' ), 10, 2 ); 
    354354        add_action( 'save_post', array( $this, 'save_post' ), 10, 2 ); 
    355355    } 
    356      
     356 
    357357    public function setup_editor( $post_type, $post ) { 
    358358        // fetch relevant featured blocks 
     
    360360        if ( empty( $secondary_blocks ) ) 
    361361            return; 
    362              
     362 
    363363        $secondary_blocks = apply_filters( 'secondary_html_blocks_pre_editor', $secondary_blocks ); // allows more specific control over which secondary editors to show (e.g. restrict based on terms) 
    364          
     364 
    365365        foreach ( $secondary_blocks as $block ) { 
    366366            add_meta_box( 'secondary_html_content_' . $block->ID, $block->post_title, array( $this, 'meta_box_inner' ), $post_type, 'normal', 'high', $block->ID ); 
    367367            add_filter( 'postbox_classes_' . $post_type . '_secondary_html_content_' . $block->ID, array( $this, 'meta_box_class' ) ); 
    368368        } 
    369          
     369 
    370370        add_action( 'admin_head', array( $this, 'editor_css' ) ); 
    371371    } 
    372      
     372 
    373373    public function meta_box_class( $classes ) { 
    374374        $classes[] = 'secondary_content_postbox'; 
    375375        return $classes; 
    376376    } 
    377      
     377 
    378378    public function meta_box_inner( $post, $info ) { 
    379379        if ( empty( $info['args'] ) ) 
    380380            return; 
    381              
     381 
    382382        $block_id = (int) $info['args']; 
    383383        $media_buttons = has_term( 'Media Buttons', 'secondary_html_features', $block_id ); 
    384384        $teeny = has_term( 'Tiny Editor', 'secondary_html_features', $block_id ); 
    385          
     385 
    386386        wp_nonce_field( 'secondary_html_nonce_' . $block_id, 'secondary_html_nonce_' . $block_id ); 
    387387        $secondary_content = get_post_meta( $post->ID, '_secondary_html_' . $block_id, true ); 
    388388        wp_editor( $secondary_content, '_secondary_html_' . $block_id, array( 'media_buttons' => $media_buttons, 'teeny' => $teeny ) ); 
    389389    } 
    390      
     390 
    391391    public function editor_css() { 
    392392?> 
     
    402402<?php 
    403403    } 
    404      
     404 
    405405    public function save_post( $post_id, $post ) { 
    406406        if ( ! current_user_can( 'edit_post', $post_id ) ) 
    407407            return; 
    408          
     408 
    409409        $post_type = ( $post->post_type == 'revision' ) ? get_post_type( wp_is_post_revision( $post_id ) ) : get_post_type( $post_id ); 
    410          
     410 
    411411        $secondary_blocks = get_posts(array( 'post_type' => 'secondary_html', 'numberposts' => 100, 'orderby' => 'menu_order', 'meta_key' => '_secondary_post_types', 'meta_value' => $post_type )); 
    412412        if ( empty( $secondary_blocks ) ) 
    413413            return; 
    414          
    415         foreach ( $secondary_blocks as $block ) {            
     414 
     415        foreach ( $secondary_blocks as $block ) { 
    416416            if ( isset( $_POST['secondary_html_nonce_' . $block->ID ] ) && wp_verify_nonce( $_POST['secondary_html_nonce_' . $block->ID], 'secondary_html_nonce_' . $block->ID ) ) 
    417417                empty( $_POST['_secondary_html_' . $block->ID] ) ? delete_post_meta( $post_id, '_secondary_html_' . $block->ID) : update_post_meta( $post_id, '_secondary_html_' . $block->ID, apply_filters( 'content_save_pre', $_POST['_secondary_html_' . $block->ID] ) ); 
     
    424424/** 
    425425 * Retrieve a secondary HTML content block 
    426  *  
     426 * 
    427427 * @since 2.0 
    428  *  
     428 * 
    429429 * @param string $block Title of the secondary block (post type); if empty, get the first one (really for backwards compatibility) 
    430  * @param int|null $post_id Post ID for post whose secondary content we want to retrieve (null to inherit from query)   
    431  * @return Formatted secondary HHTML content 
     430 * @param int|null $post_id Post ID for post whose secondary content we want to retrieve (null to inherit from query) 
     431 * @return Formatted secondary HTML content 
    432432 */ 
    433433function get_secondary_content( $block_id = '', $post_id = NULL ) { 
     
    437437    elseif ( empty( $post_id ) ) 
    438438        $post_id = get_the_ID(); 
    439          
     439 
    440440    $post_type = get_post_type( $post_id ); 
    441      
     441 
    442442    if ( empty( $block_id ) ) { 
    443443        // retrieve first created block for this post type 
     
    445445        if ( empty( $blocks ) ) 
    446446            return false; 
    447         $block_id = $blocks[0]->ID;  
     447        $block_id = $blocks[0]->ID; 
    448448    } elseif ( is_string( $block_id ) ) { 
    449449        // try caching in a transient 
    450450        $cache_name = 'secondary_html_block_id_' . sanitize_title_with_dashes( $block_id ); 
    451         if ( ! $id = get_transient( 'secondary_html_block_id_' . sanitize_title_with_dashes( $block_id ) ) ) { 
     451        if ( ! $id = get_transient( $cache_name ) ) { 
    452452            global $wpdb; 
    453453            $id = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_title = %s AND post_type = 'secondary_html'", $block_id ) ); 
    454             if ( empty( $id ) ) 
     454            if ( ! empty( $id ) ) 
     455                set_transient( $cache_name, $id ); 
     456            elseif ( is_int( $block_id ) ) 
     457                $id = $block_id; 
     458            else 
    455459                return false; 
    456             set_transient( $cache_name, $id ); 
    457460        } 
    458461        $block_id = $id; 
     
    460463        return false; 
    461464    } 
    462      
     465 
    463466    // does this post type even get this type of content? 
    464467    $post_types = get_post_meta( $block_id, '_secondary_post_types' ); 
    465468    if ( ! in_array( $post_type, $post_types ) ) 
    466469        return false; 
    467      
     470 
    468471    $secondary_content = get_post_meta( $post_id, '_secondary_html_' . $block_id, true ); 
    469      
     472 
    470473    if ( empty( $secondary_content ) && is_post_type_hierarchical( $post_type ) && has_term( 'Inherit from Ancestors', 'secondary_html_features', $block_id ) ) { 
    471474        // attempt to find in ancestors 
     
    473476        if ( is_page( $post_id ) && get_option( 'show_on_front' ) == 'page' && ( $front_page =  get_option( 'page_on_front' ) ) && has_term( 'Treat Home as Ancestor', 'secondary_html_features', $block_id ) ) 
    474477            $ancestors[] = $front_page; 
    475          
     478 
    476479        foreach ( $ancestors as $ancestor ) { 
    477480            if ( $secondary_content = get_post_meta( $ancestor, '_secondary_html_' . $block_id, true ) ) 
     
    479482        } 
    480483    } 
    481      
     484 
    482485    if ( empty( $secondary_content ) ) 
    483486        return false; 
    484      
     487 
    485488    $secondary_content = apply_filters( 'get_secondary_content', $secondary_content, get_the_title( $block_id ), $post_id ); 
    486489    return apply_filters( 'the_content', $secondary_content ); 
     
    489492/** 
    490493 * Output a secondary HTML content block 
    491  *  
     494 * 
    492495 * @since 2.0 
    493  *  
     496 * 
    494497 * @param string $block Title or ID of the secondary block 
    495  * @param int|null $post_id Post ID or null to inherit from query   
     498 * @param int|null $post_id Post ID or null to inherit from query 
    496499 * @return Output a secondary HTML content block onto page 
    497500 */ 
     
    503506/** 
    504507 * widget 
    505  */  
     508 */ 
    506509class Secondary_HTML_Content extends WP_Widget { 
    507      
     510 
    508511    public function __construct() { 
    509512        $widget_ops = array( 'classname' => 'content2_block', 'description' => __( 'Display a Secondary HTML Content block.', 'secondary_html_content' ) ); 
     
    514517        if ( ! is_singular() ) 
    515518            return; 
    516          
     519 
    517520        extract( $args ); 
    518          
     521 
    519522        if ( empty( $instance['block'] ) ) { 
    520523            $blocks = get_posts(array( 'post_type' => 'secondary_html', 'numberposts' => 1, 'orderby' => 'ID', 'order' => 'ASC', 'meta_key' => '_secondary_post_types', 'meta_value' => get_post_type() )); 
    521524            if ( empty( $blocks ) ) 
    522525                return false; 
    523                  
    524             $block = $blocks[0]->ID;     
     526 
     527            $block = $blocks[0]->ID; 
    525528        } else { 
    526529            $block = (int) $instance['block']; 
    527530        } 
    528          
     531 
    529532        if ( ! $secondary_content = get_secondary_content( $block ) ) 
    530533            return; 
    531          
     534 
    532535        echo $before_widget; 
    533          
    534         if ( ! empty( $instance['title'] ) )         
     536 
     537        if ( ! empty( $instance['title'] ) ) 
    535538            echo $before_title . apply_filters( 'the_title', get_the_title( $instance['block'] ) ) . $after_title; 
    536          
     539 
    537540        echo apply_filters( 'the_secondary_content_widget', $secondary_content  ) . $after_widget; 
    538541    } 
     
    547550        $instance = wp_parse_args( $instance, array( 'block' => '', 'title' => false ) ); 
    548551        $secondary_blocks = get_posts(array( 'post_type' => 'secondary_html', 'numberposts' => 100, 'orderby' => 'ID', 'order' => 'ASC' )); 
    549          
     552 
    550553        if ( empty( $secondary_blocks ) ) { 
    551554            echo '<p>' . __( 'No Secondary HTML Content blocks have been created. Visit the Writing settings page to create secondary HTML content blocks.', 'secondary_html_content' ) . '</p>'; 
     
    564567        <p> 
    565568            <input id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" class="checkbox" type="checkbox" <?php checked( $instance['title'] ); ?> /> 
    566             <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e( 'Display label as widget title', 'secondary_html_content' ); ?></label>           
     569            <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e( 'Display label as widget title', 'secondary_html_content' ); ?></label> 
    567570        </p> 
    568571    <?php 
     
    588591        } 
    589592    } 
    590      
     593 
    591594    $options = get_terms( 'secondary_html_features', array( 'hide_empty' => false ) ); 
    592595    foreach( $options as $option ) { 
    593596        wp_delete_term( $option->term_id, 'secondary_html_features' ); 
    594597    } 
    595      
     598 
    596599    delete_option( 'widget_secondary-html-content' ); 
    597600    delete_option( 'secondary_html_content_version' ); 
Note: See TracChangeset for help on using the changeset viewer.