Plugin Directory

Changeset 2309886


Ignore:
Timestamp:
05/22/2020 02:02:34 AM (6 years ago)
Author:
timmcdaniels
Message:

version 2.7

Location:
media-category-library
Files:
31 added
3 edited

Legend:

Unmodified
Added
Removed
  • media-category-library/trunk/classes/media-category-library.php

    r2308264 r2309886  
    99    const pname = 'Media Category Library';
    1010    const term = 'mediacategory';
    11     const version = 2.6;
     11    const version = 2.7;
    1212
    1313    /**
     
    7474
    7575            $this->settings_fields = array(
    76                                 'legend_1' => array(
    77                                     'label' => 'General Settings',
    78                                     'type' => 'legend'
    79                                 ),
    80                                 'taxonomy_name' => array(
    81                                     'label' => 'Taxonomy Name (should be all lowercase)',
    82                                     'type' => 'text',
    83                                     'default' => 'media-category'
    84                                 ),
    85                                 'rewrite_url' => array(
    86                                     'label' => 'Media Category Library Rewrite URL',
    87                                     'type' => 'text',
    88                                     'default' => 'mediacat-library'
    89                                 ),
    90                                 'title' => array(
    91                                     'label' => 'Media Category Library Title',
    92                                     'type' => 'text',
    93                                     'default' => 'Media Category Library'
    94                                 ),
    95                                 'include_css' => array(
    96                                     'label' => 'Include CSS',
    97                                     'type' => 'select',
    98                                     'values' => array( 'yes' => 'Yes', 'no' => 'No' ),
    99                                     'default' => 'yes'
    100                                 ),
    101                                 'posts_per_page' => array(
    102                                     'label' => 'Posts per page (for frontend Media Category Library)',
    103                                     'type' => 'text',
    104                                     'default' => '20'
    105                                 )
    106                             );
     76                'legend_1' => array(
     77                    'label' => 'General Settings',
     78                    'type' => 'legend'
     79                ),
     80                'taxonomy_name' => array(
     81                    'label' => 'Taxonomy Name (should be all lowercase)',
     82                    'type' => 'text',
     83                    'default' => 'media-category'
     84                ),
     85                'rewrite_url' => array(
     86                    'label' => 'Media Category Library Rewrite URL',
     87                    'type' => 'text',
     88                    'default' => 'mediacat-library'
     89                ),
     90                'title' => array(
     91                    'label' => 'Media Category Library Title',
     92                    'type' => 'text',
     93                    'default' => 'Media Category Library'
     94                ),
     95                'include_css' => array(
     96                    'label' => 'Include CSS',
     97                    'type' => 'select',
     98                    'values' => array( 'yes' => 'Yes', 'no' => 'No' ),
     99                    'default' => 'yes'
     100                ),
     101                'posts_per_page' => array(
     102                    'label' => 'Posts per page (for frontend Media Category Library)',
     103                    'type' => 'text',
     104                    'default' => '20'
     105                )
     106            );
    107107
    108108            // add category column to media library
     
    139139        add_shortcode( 'mediacat', array( &$this, 'get_mediacategory_shortcode' ) );
    140140        add_shortcode( 'mediacatform', array( &$this, 'get_mediacategoryform_shortcode' ) );
     141
     142        // update counts when images updated
     143
     144        add_action( 'edit_attachment', array( &$this, 'edit_attachment' ) );
     145    }
     146
     147    /**
     148    *edit attachment hook
     149    *
     150    *@return void
     151    *@since 1.8
     152    */
     153    function edit_attachment( $post_id ) {
     154        global $wpdb;
     155        $terms = get_terms( $this->settings_data['taxonomy_name'], array( 'hide_empty' => false ) );
     156        foreach ( $terms as $t ) {
     157            $sql = "SELECT COUNT(*) FROM " . $wpdb->term_relationships . " WHERE term_taxonomy_id = " . $t->term_id;
     158            $count = $wpdb->get_var( $wpdb->prepare( $sql ) );
     159            $wpdb->update( $wpdb->term_taxonomy, array( 'count' => $count ), array( 'term_taxonomy_id' => $t->term_id ) );
     160        }
    141161    }
    142162
  • media-category-library/trunk/media-category-library.php

    r2308264 r2309886  
    55Description: WordPress plugin that allows items in the Media Library to be assigned to a category.
    66Author: Convoy
    7 Version: 2.6
     7Version: 2.7
    88Author: Tim McDaniels
    99Author URI: http://WeAreConvoy.com
  • media-category-library/trunk/readme.txt

    r2308264 r2309886  
    55Requires at least: 3.0.1
    66Tested up to: 5.4.1
    7 Stable tag: 2.6
     7Stable tag: 2.7
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    5252
    5353== Changelog ==
     54
     55= 2.7 =
     56* Fix taxonomy counts
    5457
    5558= 2.6 =
Note: See TracChangeset for help on using the changeset viewer.