Plugin Directory

Changeset 961977


Ignore:
Timestamp:
08/07/2014 07:54:25 PM (12 years ago)
Author:
Shellbot
Message:
  • Added option to specify range of image IDs
  • Added custom sorting option
Location:
easy-image-display/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • easy-image-display/trunk/readme.txt

    r854693 r961977  
    33Tags: image, gallery, latest image, random image
    44Requires at least: 3.5
    5 Tested up to: 3.8.1
     5Tested up to: 3.9.2
    66Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=T3XBQZNXBEHPC
    77Stable tag: trunk
     
    2020Current features include:
    2121
     22* Newest, oldest, random and custom sorting options
    2223* Include/exclude images based on ID
    2324* Widget, shortcode and template tag for maximum flexibility
     
    115116}`
    116117
     118= How does the custom sorting option work? =
     119
     120This option will only take effect when filter is set to "only", as that is the only time when every image ID is specified
     121and can therefore be ordered correctly.
     122
    117123
    118124== Changelog ==
     125
     126= 1.2.0 =
     127* Added option to specify range of image IDs
     128* Added custom sorting option
     129* Various performance fixes
    119130
    120131= 1.1.1 =
     
    138149== Upgrade Notice ==
    139150
     151= 1.2.0 =
     152* New feature! Specify a range of image IDs.
     153* New feature! Custom sorting option.
     154
    140155= 1.1.1 =
    141156* New feature! Link images to static URL.
  • easy-image-display/trunk/sb-easy-image-display.php

    r854693 r961977  
    44Plugin URI: http://shellbotics.com/wordpress-plugins/easy-image-display/
    55Description: An easy way to display random or latest images on your site.
    6 Version: 1.1.1
     6Version: 1.2.0
    77Author: Shellbot
    88Author URI: http://shellbotics.com
     
    5757    }
    5858
    59     function public_js() {
     59    function public_js( $gallery_id = '' ) {
    6060        echo '<script type="text/javascript">
    6161                jQuery(document).ready(function() {
    62                   jQuery(".gallery a").colorbox({
     62                  jQuery("#' . $gallery_id . ' a").colorbox({
    6363                    maxWidth: "80%",
    6464                    maxHeight: "80%",
     
    187187                $query['order'] = 'ASC';
    188188            break;
     189            case 'custom':
     190                $query['orderby'] = 'post__in';
     191                $query['order'] = 'ASC';
     192            break;
    189193        };
    190194       
    191195        if( $args['ids'] && strtolower( $args['filter'] ) == 'include' ) {
     196           
    192197            $attachments = $this->include_action( $args, $query );
     198           
    193199        } elseif( $args['ids'] ) {
    194             $ids = explode( ',', $args['ids'] );
     200           
     201            if( false != strpos( $args['ids'], '-' ) ) { //IDs include a range
     202               
     203                $temp_ids = explode( ',', $args['ids'] );
     204                $ids = array();
     205               
     206                foreach ($temp_ids as $k => $v) {
     207
     208                    // Is there a dash?
     209                    $dash = strpos($v, '-');
     210                    if ($dash) {
     211                        $from = intval(substr($v, 0, $dash));
     212                        $to = intval(substr($v, $dash + 1));
     213
     214                        for ($i = $from; $i <= $to; $i ++) {
     215                            $ids[] = "$i";
     216                        }
     217                    }
     218                    else { // No, just insert next in the array
     219                        $ids[] = "$v";
     220                    }
     221                }
     222
     223            } else { //no ranges, straighforward explode
     224                $ids = explode( ',', $args['ids'] );
     225            }
    195226           
    196227            if( strtolower( $args['filter'] ) == 'exclude' ) {
     
    200231                $query['post__in'] = $ids;
    201232            }
    202            
     233
    203234            $attachments = get_posts( $query );
    204235        } else {
     
    303334
    304335        $output = gallery_shortcode($attr);
     336       
     337        //find gallery ID
     338        $pattern = '/gallery-[0-9]/';
     339        preg_match($pattern, $output, $matches);
     340        $gallery_id = $matches[0];
    305341
    306342        // no link
     
    316352       
    317353        if( isset( $lightbox ) && 1 == $lightbox ) {
    318             $this->public_js();
     354            $this->public_js( $gallery_id );
    319355        }
    320356
  • easy-image-display/trunk/sb-easy-image-widget.php

    r854693 r961977  
    22/**
    33 * Widget Name: Easy Image Display
    4  * Version: 1.1.1
     4 * Version: 1.2.0
    55 */
    66
     
    7070                'Oldest',
    7171                'Random',
     72                'Custom',
    7273            ),
    7374            'sizes' => array(
Note: See TracChangeset for help on using the changeset viewer.