Plugin Directory

Changeset 1577511


Ignore:
Timestamp:
01/18/2017 07:19:36 PM (9 years ago)
Author:
postpostmodern
Message:

update to 0.9.9.6

Location:
taxonomy-taxi/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • taxonomy-taxi/trunk/_plugin.php

    r1564588 r1577511  
    44*   Plugin URI:     http://wordpress.org/plugins/taxonomy-taxi/
    55*   Description:    Show custom taxonomies in /wp-admin/edit.php automatically
    6 *   Version:        .9.9.5
     6*   Version:        .9.9.6
    77*   Author:         postpostmodern, pinecone-dot-website
    88*   Author URI:     http://rack.and.pinecone.website
  • taxonomy-taxi/trunk/lib/Taxonomy_Taxi/Edit.php

    r1564588 r1577511  
    4545        $key = array_search( 'categories', $keys );
    4646
     47        // if that doesnt work put before post comments
     48        if( !$key )
     49            $key = array_search( 'comments', $keys );
     50
    4751        // if that doesnt work put before date
    4852        if( !$key )
    49             $key = array_search( 'date', $keys );
     53            $key = array_search( 'date', $keys ) ? array_search( 'date', $keys ) - 1 : FALSE;
    5054
    51         //  arbitary placement in table if it cant find date or category
     55        //  arbitary placement in table if it cant find category, comments, or date
    5256        if( !$key )
    5357            $key = max( 1, count($keys) );
     
    6569       
    6670        $headings = array_merge( $a, $b, $c );
    67    
     71       
    6872        return $headings;
    6973    }
     
    158162    /**
    159163    *
     164    *   @param string
    160165    *   @return array
    161166    */
    162     public static function get_taxonomies(){
    163         return self::$taxonomies;
     167    public static function get_taxonomies( $post_type ){
     168        if( !isset(self::$taxonomies[$post_type]) )
     169            self::set_taxonomies( $post_type );
     170
     171        return self::$taxonomies[$post_type];
    164172    }
    165173
     
    168176    */
    169177    protected static function set_taxonomies( $post_type ){
    170         self::$taxonomies = get_object_taxonomies( $post_type, 'objects' );
     178        self::$taxonomies[$post_type] = get_object_taxonomies( $post_type, 'objects' );
    171179    }
    172180}
  • taxonomy-taxi/trunk/lib/Taxonomy_Taxi/Settings.php

    r1564588 r1577511  
    44
    55class Settings{
    6     // @todo implement caching
     6    // save user settings to prevent multiple calls to get_option
    77    protected static $settings = array();   
    88
     
    2626    */
    2727    public static function get_all_for_post_type( $post_type = '' ){
    28         $taxonomies = get_object_taxonomies( $post_type, 'objects' );
    29         $saved = self::get_saved( $post_type );
     28        if( !isset(self::$settings[$post_type]) ){
     29            $taxonomies = get_object_taxonomies( $post_type, 'objects' );
     30            $saved = self::get_saved( $post_type );
    3031
    31         $checked = array_keys(array_diff_key($taxonomies, array_flip($saved)) );
     32            $checked = array_keys(array_diff_key($taxonomies, array_flip($saved)) );
    3233
    33         $settings = array();
    34         foreach( $taxonomies as $tax => $props ){
    35             $view_all = array_filter( array(
    36                 $props->labels->all_items,
    37                 $props->name
    38             ) );
     34            $settings = array();
     35            foreach( $taxonomies as $tax => $props ){
     36                $view_all = array_filter( array(
     37                    $props->labels->all_items,
     38                    $props->name
     39                ) );
     40           
     41                $settings[$tax] = (object) array(
     42                    'checked' => in_array( $tax, $checked ),
     43                    'label' => $props->label,
     44                    'query_var' => $props->query_var,
     45                    'name' => $tax,
     46                    'view_all' => reset( $view_all )
     47                );
     48            }
     49
     50            self::$settings[$post_type] = $settings;
     51        }
    3952       
    40             $settings[$tax] = (object) array(
    41                 'checked' => in_array( $tax, $checked ),
    42                 'label' => $props->label,
    43                 'query_var' => $props->query_var,
    44                 'name' => $tax,
    45                 'view_all' => reset( $view_all )
    46             );
    47         }
    48 
    49         return $settings;
     53        return self::$settings[$post_type];
    5054    }
    5155
  • taxonomy-taxi/trunk/lib/Taxonomy_Taxi/Settings_Page.php

    r1564588 r1577511  
    103103    */
    104104    public static function save( $form_data ){
    105         foreach( $form_data as $post_type => &$options ){
     105        $post_types = get_post_types( array(
     106            'show_ui' => TRUE
     107        ), 'objects' );
     108       
     109        $saved = array();
     110
     111        foreach( $post_types as $post_type => $object ){
    106112            $all = get_object_taxonomies( $post_type, 'names' );
     113            $user_input = isset($form_data[$post_type]) ? $form_data[$post_type] : array();
    107114
    108             $options = array_diff( $all, $options );
     115            $saved[$post_type] = array_diff( $all, $user_input );
    109116        }
    110117
    111         return $form_data;
     118        return $saved;
    112119    }
    113120}
  • taxonomy-taxi/trunk/lib/Taxonomy_Taxi/Sql.php

    r1564588 r1577511  
    2222    */
    2323    public static function posts_fields( $sql, &$wp_query ){
    24         foreach( Edit::get_taxonomies() as $tax ){
     24        foreach( Edit::get_taxonomies($wp_query->query_vars['post_type']) as $tax ){
    2525            $tax = esc_sql( $tax->name );
    2626           
     
    8383    public static function posts_orderby( $sql, &$wp_query ){
    8484        global $wpdb;
    85        
    86         if( isset($wp_query->query_vars['orderby']) && array_key_exists($wp_query->query_vars['orderby'], Edit::get_taxonomies()) )
     85
     86        if( isset($wp_query->query_vars['orderby']) && array_key_exists($wp_query->query_vars['orderby'], Edit::get_taxonomies($wp_query->query_vars['post_type'])) )
    8787            $sql = $wp_query->query_vars['orderby']."_slugs ".$wp_query->query_vars['order']." /* Taxonomy_Taxi posts_orderby */";
    8888       
     
    100100            $taxonomies = array();
    101101           
    102             foreach( Edit::get_taxonomies() as $tax ){
     102            foreach( Edit::get_taxonomies($post->post_type) as $tax ){
    103103                $tax_name = esc_sql( $tax->name );
    104104               
  • taxonomy-taxi/trunk/readme.txt

    r1564588 r1577511  
    22Contributors: postpostmodern, pinecone-dot-io
    33Donate link: https://cash.me/$EricEaglstun
    4 Tags: custom taxonomies, taxonomy
     4Tags: custom taxonomies, taxonomy, term
    55Requires at least: 3.9
    66Tested up to: 4.7
     
    99== Description ==
    1010Automatically display custom taxonomy information in wp-admin/edit.php
    11 Not tested with versions pre- 3.2 - requires PHP 5.3
     11- requires PHP 5.3
    1212
    1313== Installation ==
     
    1717
    1818== Changelog ==
     19= .9.9.6 =
     20* Fix saving options with all taxonomies deselected
     21
    1922= .9.9.2 =
    2023* Support media library list
Note: See TracChangeset for help on using the changeset viewer.