WordPress.org

Plugin Directory

Changeset 1603684


Ignore:
Timestamp:
02/26/17 02:14:36 (7 months ago)
Author:
celloexpressions
Message:

Multisite Site Index: Bump version 1.2, with a new option for number of sites available to networks with more than 100 sites.

Location:
multisite-site-index/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • multisite-site-index/trunk/multisite-site-index.php

    r1533062 r1603684  
    44 * Plugin URI: http://celloexpressions.com/plugins/multisite-site-index/ 
    55 * Description: Display an index of all sites on a multisite network with a widget or a shortcode. 
    6  * Version: 1.0 
     6 * Version: 1.1 
    77 * Author: Nick Halsey 
    88 * Author URI: http://nick.halsey.co/ 
     
    1212 
    1313===================================================================================== 
    14 Copyright (C) 2016 Nick Halsey 
     14Copyright (C) 2017 Nick Halsey 
    1515 
    1616This program is free software; you can redistribute it and/or 
     
    3939    extract( shortcode_atts( array( 
    4040        'excluded' => '', 
     41        'number' => 100, 
    4142        'recent' => 0, 
    4243    ), $atts ) ); 
    4344 
    44     return multisite_site_index_get_markup( $excluded, $recent ); 
     45    return multisite_site_index_get_markup( $excluded, $recent, $number ); 
    4546} 
    4647 
     
    7172        } 
    7273 
     74        if ( ! array_key_exists( 'number', $instance ) ) { 
     75            $instance['number'] = 100; 
     76        } 
     77 
    7378        if ( ! array_key_exists( 'title', $instance ) ) { 
    7479            $instance['title'] = ''; 
     
    7883        $title = apply_filters( 'widget_title', $instance['title'] ); // Title 
    7984        $excluded = $instance['excluded']; 
     85        $number = $instance['number']; 
    8086 
    8187        // Output 
     
    8692        } 
    8793 
    88         echo multisite_site_index_get_markup( $excluded, 0 ); 
     94        echo multisite_site_index_get_markup( $excluded, 0, $number ); 
    8995 
    9096        echo $after_widget; 
     
    95101        $instance = $old_instance; 
    96102        $instance['title'] = strip_tags( $new_instance['title'] ); 
     103        $instance['number'] = absint( $new_instance['number'] ); 
    97104        $instance['excluded'] = strip_tags( $new_instance['excluded'] ); 
    98105 
     
    104111        if ( $instance ) { 
    105112            $title = $instance['title']; 
     113            $number = $instance['number']; 
    106114            $excluded  = $instance['excluded']; 
    107115        } 
     
    110118            $title = ''; 
    111119            $excluded = ''; 
     120            $number = 100; 
    112121        } 
    113122 
     
    117126            <input id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" class="widefat" /> 
    118127        </p> 
     128        <?php if ( 100 < get_sites( array( 'count' => true ) ) ) : ?> 
     129        <p> 
     130            <label for="<?php echo $this->get_field_id('number'); ?>"><?php echo __( 'Number of Sites to Show:', 'multisite-site-index' ); ?></label> 
     131            <input id="<?php echo $this->get_field_id('number'); ?>" name="<?php echo $this->get_field_name('number'); ?>" type="number" value="<?php echo $number; ?>" class="widefat" /> 
     132        </p> 
     133        <?php endif; ?> 
    119134        <p> 
    120135            <label for="<?php echo $this->get_field_id('excluded'); ?>"><?php echo __( 'Excluded site IDs:', 'multisite-site-index' ); ?></label> 
    121136            <input id="<?php echo $this->get_field_id('excluded'); ?>" name="<?php echo $this->get_field_name('excluded'); ?>" type="text" value="<?php echo $excluded; ?>" class="widefat" /> 
    122137        </p> 
    123     <?php  
     138    <?php 
    124139    } 
    125140 
     
    127142 
    128143// Return the markup for the site index. 
    129 function multisite_site_index_get_markup( $excluded = '', $recent = 0 ) { 
     144function multisite_site_index_get_markup( $excluded = '', $recent = 0, $number = 100 ) { 
    130145    if ( ! is_multisite() ) { 
    131146        return ''; 
     
    143158        'order' => 'DESC', 
    144159        'fields' => 'ids', 
     160        'number' => $number, 
     161        'deleted' => 0, 
    145162    ) ); 
    146163 
     
    165182 
    166183        if ( 0 < $recent ) { 
    167             // @todo build out a recent option. 
     184            // @todo build out a recent posts option. 
    168185        } 
    169186 
  • multisite-site-index/trunk/readme.txt

    r1533067 r1603684  
    2020= Exclude sites = 
    2121Sites can be hidden from the list by adding an `excluded` argument to the shortcode, or with the option in the widget settings. Use a comma-separated list of site IDs. To find a site's ID, look at the url for editing a site in the network admin. For example, the shortcode would be `[site-index exluded="11,14,15,16"]`. 
     22 
     23= Showing more that 100 sites = 
     24On networks with more than 100 sites, a number of sites option is available. Keep in mind that showing more sites may cause issues with server/database resources on very large networks. Shortcode usage: `[site-index number="200"]`. 
    2225 
    2326= Layout looks broken = 
     
    7881 
    7982== Changelog == 
     83= 1.1 = 
     84* Added the number of sites option for large networks. 
     85* Hid deleted sites from the site index. 
     86 
    8087= 1.0 = 
    8188* First publicly available version of the plugin. 
    8289 
    8390== Upgrade Notice == 
     91= 1.1 = 
     92Adds a "number of sites" option for large networks. 
     93 
    8494= 1.0 = 
    8595Initial release. 
Note: See TracChangeset for help on using the changeset viewer.