WordPress.org

Plugin Directory

Changeset 1603045


Ignore:
Timestamp:
02/24/17 18:39:07 (10 months ago)
Author:
versusbassz
Message:

v2.0.0

Location:
hh-sortable/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • hh-sortable/trunk/hh_admin_id_columns.php

    r706108 r1603045  
    11<?php 
    2     /* 
    3     Plugin Name: HH sortable ID columns 
    4     Plugin URI: http://studio.hamburg-hram.de 
    5     Description: Sortable ID columns for all standard data types in wordpress admin panel. 
    6     Version: 1.0.0 
    7     Author: Vladimir Sklyar 
    8     Author URI: http://studio.hamburg-hram.de 
     2/* 
     3Plugin Name: HH sortable ID columns 
     4Plugin URI: https://github.com/versusbassz/hh_sortable_id_columns/ 
     5Description: Sortable ID columns for all standard data types in WordPress admin panel. 
     6Version: 1.0.0 
     7Author: Vladimir Sklyar 
     8Author URI: http://imgf.ru/ 
    99 
    10     Minimalistic fork of "Reveal IDs" plugin. 
    11     */ 
     10Minimalistic fork of "Reveal IDs" plugin. 
     11*/ 
     12 
     13if (is_admin()) { 
     14    add_action('admin_init', 'hh_add_custom_columns'); 
     15    add_action('admin_head', 'hh_add_custom_columns_css'); 
     16} 
    1217 
    1318 
    14     if (   is_admin() 
    15         && function_exists( 'add_action' ) 
    16         && function_exists( 'add_filter' ) 
    17         && function_exists( 'get_taxonomies' ) 
    18         && function_exists( 'get_post_types' ) 
    19         && function_exists( 'version_compare' ) 
    20     ) { 
    21         add_action( 'admin_init' , 'hh_add_custom_columns' ); 
    22         add_action( 'admin_head' , 'hh_add_custom_columns_css' ); 
    23     } 
     19function hh_add_custom_columns() 
     20{ 
     21    add_filter('manage_media_columns', 'hh_custom_column_add'); 
     22    add_action('manage_media_custom_column', 'hh_custom_column_value', 10, 2); 
     23 
     24    add_filter('manage_link-manager_columns', 'hh_custom_column_add'); 
     25    add_action('manage_link_custom_column', 'column_value', 10, 2); 
     26 
     27    add_action('manage_edit-link-categories_columns', 'hh_custom_column_add'); 
     28    add_filter('manage_link_categories_custom_column', 'column_return_value', 10, 3); 
     29 
     30    foreach (get_taxonomies() as $taxonomy) { 
     31        add_action("manage_edit-{$taxonomy}_columns", 'hh_custom_column_add'); 
     32        add_filter("manage_{$taxonomy}_custom_column", 'hh_custom_column_return_value', 10, 3); 
     33        add_filter("manage_edit-{$taxonomy}_sortable_columns", 'hh_custom_column_add'); 
     34    } 
     35 
     36    foreach (get_post_types() as $ptype) { 
     37        add_action("manage_edit-{$ptype}_columns", 'hh_custom_column_add'); 
     38        add_filter("manage_{$ptype}_posts_custom_column", 'hh_custom_column_value', 10, 3); 
     39        add_filter("manage_edit-{$ptype}_sortable_columns", 'hh_custom_column_add'); 
     40    } 
     41 
     42    add_action('manage_users_columns', 'hh_custom_column_add'); 
     43    add_filter('manage_users_custom_column', 'hh_custom_column_return_value', 10, 3); 
     44    add_filter('manage_users_sortable_columns', 'hh_custom_column_add'); 
     45 
     46    add_action('manage_edit-comments_columns', 'hh_custom_column_add'); 
     47    add_action('manage_comments_custom_column', 'hh_custom_column_value', 10, 2); 
     48    add_filter('manage_edit-comments_sortable_columns', 'hh_custom_column_add'); 
     49} 
    2450 
    2551 
    26     function hh_add_custom_columns () { 
     52function hh_custom_column_add($columns) 
     53{ 
     54    $column_id = ['hh_id' => __('ID')]; 
    2755 
    28         global $wp_version; 
    29         $is_wp_v3_1 = version_compare( $wp_version , '3.0.999' , '>' ); 
     56    $columns   = array_merge( 
     57        (array) array_slice($columns, 0, 1, true), 
     58        $column_id, 
     59        (array) array_slice($columns, 1, null, true) 
     60    ); 
    3061 
    31         add_filter( 'manage_media_columns' ,       'hh_custom_column_add' ); 
    32         add_action( 'manage_media_custom_column' , 'hh_custom_column_value' , 10 , 2 ); 
    33  
    34         add_filter( 'manage_link-manager_columns' , 'hh_custom_column_add' ); 
    35         add_action( 'manage_link_custom_column' , 'column_value' , 10 , 2 ); 
    36  
    37         add_action( 'manage_edit-link-categories_columns' , 'hh_custom_column_add' ); 
    38         add_filter( 'manage_link_categories_custom_column' , 'column_return_value' , 10 , 3 ); 
     62    return $columns; 
     63} 
    3964 
    4065 
    41         foreach( get_taxonomies() as $taxonomy ) { 
    42             add_action( "manage_edit-${taxonomy}_columns" ,  'hh_custom_column_add' ); 
    43             add_filter( "manage_${taxonomy}_custom_column" , 'hh_custom_column_return_value' , 10 , 3 ); 
    44             if( $is_wp_v3_1 ) { 
    45                 add_filter( "manage_edit-${taxonomy}_sortable_columns" , 'hh_custom_column_add' ); 
    46             } 
    47         } 
     66function hh_custom_column_value($column_name, $id) 
     67{ 
     68    if ($column_name === 'hh_id') { 
     69        echo $id; 
     70    } 
     71} 
    4872 
    4973 
    50         foreach( get_post_types() as $ptype ) { 
    51             add_action( "manage_edit-${ptype}_columns" ,        'hh_custom_column_add' ); 
    52             add_filter( "manage_${ptype}_posts_custom_column" , 'hh_custom_column_value' , 10 , 3 ); 
    53             if( $is_wp_v3_1 ) { 
    54                 add_filter( "manage_edit-${ptype}_sortable_columns" , 'hh_custom_column_add' ); 
    55             } 
    56         } 
     74function hh_custom_column_return_value($value, $column_name, $id) 
     75{ 
     76    if ($column_name === 'hh_id') { 
     77        $value .= $id; 
     78    } 
     79 
     80    return $value; 
     81} 
    5782 
    5883 
    59         add_action( 'manage_users_columns' ,       'hh_custom_column_add' ); 
    60         add_filter( 'manage_users_custom_column' , 'hh_custom_column_return_value' , 10 , 3 ); 
    61         if( $is_wp_v3_1 ) { 
    62             add_filter( "manage_users_sortable_columns" , 'hh_custom_column_add' ); 
    63         } 
    64  
    65  
    66         add_action( 'manage_edit-comments_columns' ,  'hh_custom_column_add' ); 
    67         add_action( 'manage_comments_custom_column' , 'hh_custom_column_value' , 10 , 2 ); 
    68         if( $is_wp_v3_1 ) { 
    69             add_filter( "manage_edit-comments_sortable_columns" , 'hh_custom_column_add' ); 
    70         } 
    71  
    72     } 
    73  
    74  
    75     function hh_custom_column_add ( $columns ) { 
    76         $column_id = array( 'hh_id' => __( 'ID' ) ); 
    77         $columns = array_slice( $columns, 0, 1, true ) + $column_id + array_slice( $columns, 1, NULL, true ); 
    78         return $columns; 
    79     } 
    80  
    81  
    82     function hh_custom_column_value ( $column_name , $id ) { 
    83         if ( $column_name === 'hh_id' ) { 
    84             echo $id; 
    85         } 
    86     } 
    87  
    88  
    89     function hh_custom_column_return_value ( $value , $column_name , $id ) { 
    90  
    91         if ( $column_name === 'hh_id' ) { 
    92             $value .= $id; 
    93         } 
    94         return $value; 
    95  
    96     } 
    97  
    98  
    99     function hh_add_custom_columns_css() { 
    100         echo PHP_EOL . '<style type="text/css"> table.widefat th.column-hh_id { width: 50px; } </style>' . PHP_EOL; 
    101     } 
     84function hh_add_custom_columns_css() 
     85{ 
     86    echo PHP_EOL . '<style type="text/css"> table.widefat th.column-hh_id { width: 50px; } </style>' . PHP_EOL; 
     87} 
  • hh-sortable/trunk/readme.txt

    r706619 r1603045  
    22Contributors: versusbassz 
    33Tags: sortable, id, column, admin, panel 
    4 Requires at least: 3.5 
    5 Tested up to: 3.5.1 
    6 Stable tag: 1.0.0 
     4Requires at least: 4.6 
     5Tested up to: 4.7.2 
     6Stable tag: 2.0.0 
    77License: GPLv2 or later 
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html 
     
    3030== Changelog == 
    3131 
    32 = 1.0.0 = 
     32= 2.0.0 --- 2017.02.24 = 
     33* Code style changes 
     34* Change "Tested up to" meta-field to "4.7.2" 
     35* Change "Requires at least" meta-field to "4.6" 
     36* Change "Plugin URI" meta-field 
     37* Change "Author URI" meta-field 
     38* Remove unnecessary code 
     39* Change column insert algorithm 
     40* Add "Differences from "Reveal IDs" plugin" section in readme.txt 
     41* Add "Plugins with same functionality" section in readme.txt 
     42 
     43= 1.0.0 --- 2013.04.30 = 
    3344* Initial release. 
    34  
Note: See TracChangeset for help on using the changeset viewer.