WordPress.org

Plugin Directory

Changeset 556027


Ignore:
Timestamp:
06/11/12 08:33:19 (23 months ago)
Author:
joostdekeijzer
Message:
  • speed improvements
  • sorting sites alphabetically
  • tagging 0.9.1
Location:
network-shared-media
Files:
4 edited
11 copied

Legend:

Unmodified
Added
Removed
  • network-shared-media/tags/0.9.1/media-upload.php

    r553862 r556027  
    22/** 
    33 * @package Netword_Shared_Media 
    4  * @version 0.9 
     4 * @version 0.9.1 
    55 */ 
    66define('WP_ADMIN', FALSE); 
  • network-shared-media/tags/0.9.1/network_shared_media.php

    r553862 r556027  
    22/** 
    33 * @package Netword_Shared_Media 
    4  * @version 0.9 
     4 * @version 0.9.1 
    55 */ 
    66/* 
     
    1010Author: Joost de Keijzer 
    1111Author URI: http://dekeijzer.org/ 
    12 Version: 0.9 
     12Version: 0.9.1 
    1313Licence: GPLv2 or later 
    1414*/ 
     
    4949 
    5050        $this->blogs = array(); 
     51        $sort_array = array(); 
    5152 
    5253        foreach ( (array) $blogs as $details ) { 
    53             switch_to_blog( $details['blog_id'] ); 
    54             if ( !current_user_can('upload_files') || $details['blog_id'] == $this->current_blog_id ) continue; 
    55  
    56             $details['name'] = get_bloginfo('name'); 
     54            if ( !current_user_can_for_blog( $details['blog_id'], 'upload_files') || $details['blog_id'] == $this->current_blog_id ) continue; 
     55 
     56            $details['name'] = get_blog_option( $details['blog_id'], 'blogname' ); 
    5757            $this->blogs[] = $details; 
    58         } 
    59         switch_to_blog( $this->current_blog_id ); 
    60     } 
    61  
    62     function wp_edit_attachments_query( $q = false, $errors ) { 
    63         global $wp_query; 
    64         $post_mime_types = $avail_post_mime_types = array(); 
    65         $attachment_count = 0; 
    66         $list_string_output = ''; 
    67         foreach( $this->blogs as $blog ) { 
    68             switch_to_blog( $blog['blog_id'] ); 
    69             if ( !current_user_can('upload_files') ) continue; 
    70  
    71             list( $more_post, $more_avail ) = wp_edit_attachments_query( $q ); 
    72  
    73             if( count( $post_mime_types ) == 0 ) $post_mime_types = $more_post; 
    74  
    75             $avail_post_mime_types = array_merge( $more_avail, $avail_post_mime_types ); 
    76             $attachment_count += $wp_query->found_posts; 
    77             $list_string_output .= $this->get_media_items_current_blog(null, $errors); 
    78         } 
    79         switch_to_blog( $this->current_blog_id ); 
    80  
    81         $avail_post_mime_types = array_values( array_unique( $avail_post_mime_types ) ); 
    82         return array( $post_mime_types, $avail_post_mime_types, $attachment_count, $list_string_output ); 
    83     } 
    84  
    85     function wp_count_attachments( $mime_type = '' ) { 
    86         $stats = array(); 
    87         foreach( $this->blogs as $blog ) { 
    88             switch_to_blog( $blog['blog_id'] ); 
    89             if ( !current_user_can('upload_files') ) continue; 
    90  
    91             $more_stats = (array) wp_count_attachments( $mime_type ); 
    92             foreach( $more_stats as $k => $v ) { 
    93                 if( array_key_exists( $k, $stats ) ) { 
    94                     $stats[$k] += $v; 
    95                 } else { 
    96                     $stats[$k] = $v; 
    97                 } 
    98             } 
    99         } 
    100         switch_to_blog( $this->current_blog_id ); 
    101  
    102         return (object) $stats; 
    103     } 
    104  
    105     function get_media_items_all_blogs( $post_id, $errors ) { 
    106         $output = ''; 
    107         foreach( $this->blogs as $blog ) { 
    108             switch_to_blog( $blog['blog_id'] ); 
    109             if ( !current_user_can('upload_files') ) continue; 
    110  
    111             $output .= $this->get_media_items( $post_id, $errors ); 
    112         } 
    113         switch_to_blog( $this->current_blog_id ); 
    114         return $output; 
     58            $sort_array[] = strtolower ( $details['name'] ); 
     59        } 
     60        array_multisort( $sort_array, SORT_ASC, $this->blogs ); 
    11561    } 
    11662 
  • network-shared-media/tags/0.9.1/readme.txt

    r553862 r556027  
    55Requires at least: 3.3 
    66Tested up to:  3.4 
    7 Stable tag: 0.9 
     7Stable tag: 0.9.1 
    88License: GPLv2 or later 
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html 
     
    6060== Changelog == 
    6161 
     62= 0.9.1 = 
     63* some speed improvements 
     64* sorting of sites 
     65 
    6266= 0.9 = 
    6367* When many sites are available, the site-selection becomes a drop-down list (as suggested by SooBahkDo) 
  • network-shared-media/tags/0.9.1/todo-wishes.txt

    r553862 r556027  
    55- add "featured image" link (or don't remove it and make it work) 
    66- fix X-Frame-Options error when used in conjunction with WordPress MU Domain Mapping 
     7- improve performance on slow hosts 
  • network-shared-media/trunk/media-upload.php

    r553862 r556027  
    22/** 
    33 * @package Netword_Shared_Media 
    4  * @version 0.9 
     4 * @version 0.9.1 
    55 */ 
    66define('WP_ADMIN', FALSE); 
  • network-shared-media/trunk/network_shared_media.php

    r553862 r556027  
    22/** 
    33 * @package Netword_Shared_Media 
    4  * @version 0.9 
     4 * @version 0.9.1 
    55 */ 
    66/* 
     
    1010Author: Joost de Keijzer 
    1111Author URI: http://dekeijzer.org/ 
    12 Version: 0.9 
     12Version: 0.9.1 
    1313Licence: GPLv2 or later 
    1414*/ 
     
    4949 
    5050        $this->blogs = array(); 
     51        $sort_array = array(); 
    5152 
    5253        foreach ( (array) $blogs as $details ) { 
    53             switch_to_blog( $details['blog_id'] ); 
    54             if ( !current_user_can('upload_files') || $details['blog_id'] == $this->current_blog_id ) continue; 
    55  
    56             $details['name'] = get_bloginfo('name'); 
     54            if ( !current_user_can_for_blog( $details['blog_id'], 'upload_files') || $details['blog_id'] == $this->current_blog_id ) continue; 
     55 
     56            $details['name'] = get_blog_option( $details['blog_id'], 'blogname' ); 
    5757            $this->blogs[] = $details; 
    58         } 
    59         switch_to_blog( $this->current_blog_id ); 
    60     } 
    61  
    62     function wp_edit_attachments_query( $q = false, $errors ) { 
    63         global $wp_query; 
    64         $post_mime_types = $avail_post_mime_types = array(); 
    65         $attachment_count = 0; 
    66         $list_string_output = ''; 
    67         foreach( $this->blogs as $blog ) { 
    68             switch_to_blog( $blog['blog_id'] ); 
    69             if ( !current_user_can('upload_files') ) continue; 
    70  
    71             list( $more_post, $more_avail ) = wp_edit_attachments_query( $q ); 
    72  
    73             if( count( $post_mime_types ) == 0 ) $post_mime_types = $more_post; 
    74  
    75             $avail_post_mime_types = array_merge( $more_avail, $avail_post_mime_types ); 
    76             $attachment_count += $wp_query->found_posts; 
    77             $list_string_output .= $this->get_media_items_current_blog(null, $errors); 
    78         } 
    79         switch_to_blog( $this->current_blog_id ); 
    80  
    81         $avail_post_mime_types = array_values( array_unique( $avail_post_mime_types ) ); 
    82         return array( $post_mime_types, $avail_post_mime_types, $attachment_count, $list_string_output ); 
    83     } 
    84  
    85     function wp_count_attachments( $mime_type = '' ) { 
    86         $stats = array(); 
    87         foreach( $this->blogs as $blog ) { 
    88             switch_to_blog( $blog['blog_id'] ); 
    89             if ( !current_user_can('upload_files') ) continue; 
    90  
    91             $more_stats = (array) wp_count_attachments( $mime_type ); 
    92             foreach( $more_stats as $k => $v ) { 
    93                 if( array_key_exists( $k, $stats ) ) { 
    94                     $stats[$k] += $v; 
    95                 } else { 
    96                     $stats[$k] = $v; 
    97                 } 
    98             } 
    99         } 
    100         switch_to_blog( $this->current_blog_id ); 
    101  
    102         return (object) $stats; 
    103     } 
    104  
    105     function get_media_items_all_blogs( $post_id, $errors ) { 
    106         $output = ''; 
    107         foreach( $this->blogs as $blog ) { 
    108             switch_to_blog( $blog['blog_id'] ); 
    109             if ( !current_user_can('upload_files') ) continue; 
    110  
    111             $output .= $this->get_media_items( $post_id, $errors ); 
    112         } 
    113         switch_to_blog( $this->current_blog_id ); 
    114         return $output; 
     58            $sort_array[] = strtolower ( $details['name'] ); 
     59        } 
     60        array_multisort( $sort_array, SORT_ASC, $this->blogs ); 
    11561    } 
    11662 
  • network-shared-media/trunk/readme.txt

    r553862 r556027  
    55Requires at least: 3.3 
    66Tested up to:  3.4 
    7 Stable tag: 0.9 
     7Stable tag: 0.9.1 
    88License: GPLv2 or later 
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html 
     
    6060== Changelog == 
    6161 
     62= 0.9.1 = 
     63* some speed improvements 
     64* sorting of sites 
     65 
    6266= 0.9 = 
    6367* When many sites are available, the site-selection becomes a drop-down list (as suggested by SooBahkDo) 
  • network-shared-media/trunk/todo-wishes.txt

    r553862 r556027  
    55- add "featured image" link (or don't remove it and make it work) 
    66- fix X-Frame-Options error when used in conjunction with WordPress MU Domain Mapping 
     7- improve performance on slow hosts 
Note: See TracChangeset for help on using the changeset viewer.