Changeset 886963
- Timestamp:
- 04/03/2014 06:41:26 PM (12 years ago)
- Location:
- custom-columns
- Files:
-
- 16 added
- 5 edited
-
tags/1.1 (added)
-
tags/1.1/CustomColumns.class.php (added)
-
tags/1.1/CustomColumns.php (added)
-
tags/1.1/CustomColumnsBase.class.php (added)
-
tags/1.1/CustomColumnsManager.class.php (added)
-
tags/1.1/CustomColumnsPage.class.php (added)
-
tags/1.1/functions.php (added)
-
tags/1.1/license.txt (added)
-
tags/1.1/readme.txt (added)
-
tags/1.1/screenshot-1.png (added)
-
tags/1.1/screenshot-2.png (added)
-
tags/1.1/src (added)
-
tags/1.1/src/css (added)
-
tags/1.1/src/css/style.css (added)
-
tags/1.1/src/js (added)
-
tags/1.1/src/js/main.js (added)
-
trunk/CustomColumns.php (modified) (1 diff)
-
trunk/CustomColumnsManager.class.php (modified) (7 diffs)
-
trunk/CustomColumnsPage.class.php (modified) (4 diffs)
-
trunk/functions.php (modified) (1 diff)
-
trunk/readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
custom-columns/trunk/CustomColumns.php
r884627 r886963 4 4 * Plugin URI: http://florian-palme.de 5 5 * Description: Create Custom Columns for your Post Types easily 6 * Version: 1. 06 * Version: 1.1 7 7 * Author: Florian Palme 8 8 * Author URI: http://florian-palme.de -
custom-columns/trunk/CustomColumnsManager.class.php
r884627 r886963 18 18 * 19 19 * @since 1.0 20 * @updated 1.1 20 21 */ 21 22 public function __construct() … … 25 26 if( ! count( $oOptions->aTabs ) ) continue; 26 27 27 // Register column header 28 add_filter( 'manage_' . $sPosttype . '_posts_columns', array( $this, 'addColumnHeader' ) ); 29 30 // Register column output 31 add_filter( 'manage_' . $sPosttype . '_posts_custom_column', array( $this, 'addColumnOutput' ), 10, 2 ); 32 33 // Register sortable 34 add_filter( 'manage_edit-' . $sPosttype . '_sortable_columns', array( $this, 'addSortableColumns' ) ); 28 // we need other action/filters for media 29 if( $sPosttype == 'media' ){ 30 add_filter( 'manage_media_columns', array( $this, 'addColumnHeader' ) ); 31 32 add_filter( 'manage_media_custom_column', array( $this, 'addColumnOutput' ), 10, 2 ); 33 34 // Register sortable 35 add_filter( 'manage_upload_sortable_columns', array( $this, 'addSortableColumns' ) ); 36 } else { 37 // Register column header 38 add_filter( 'manage_' . $sPosttype . '_posts_columns', array( $this, 'addColumnHeader' ) ); 39 40 // Register column output 41 add_filter( 'manage_' . $sPosttype . '_posts_custom_column', array( $this, 'addColumnOutput' ), 10, 2 ); 42 43 // Register sortable 44 add_filter( 'manage_edit-' . $sPosttype . '_sortable_columns', array( $this, 'addSortableColumns' ) ); 45 } 35 46 } 36 47 … … 57 68 58 69 global $wpdb; 59 60 $aTabs = $this->getPosttypeOptions( fpFunctions::getCurrentPosttype( ) )->aTabs;70 71 $aTabs = $this->getPosttypeOptions( fpFunctions::getCurrentPosttype(true) )->aTabs; 61 72 62 73 foreach( $aTabs as $sIdent => $aTab ){ … … 107 118 if( ! isset( $aVars[ 'orderby' ] ) ) return $aVars; 108 119 109 $aTabs = $this->getPosttypeOptions( fpFunctions::getCurrentPosttype( ) )->aTabs;120 $aTabs = $this->getPosttypeOptions( fpFunctions::getCurrentPosttype(true) )->aTabs; 110 121 111 122 foreach( $aTabs as $sIdent => $aTab ){ … … 137 148 { 138 149 // put all columns to the array and merge with default 139 $aTabs = $this->getPosttypeOptions( fpFunctions::getCurrentPosttype( ) )->aTabs;150 $aTabs = $this->getPosttypeOptions( fpFunctions::getCurrentPosttype(true) )->aTabs; 140 151 141 152 foreach( $aTabs as $sIdent => $aTab ){ … … 159 170 public function addColumnOutput( $sColumn, $iID ) 160 171 { 161 $aTabs = $this->getPosttypeOptions( fpFunctions::getCurrentPosttype( ) )->aTabs;162 172 $aTabs = $this->getPosttypeOptions( fpFunctions::getCurrentPosttype(true) )->aTabs; 173 163 174 if( isset( $aTabs[ $sColumn ] ) ){ 164 175 $aTab = $aTabs[ $sColumn ]; … … 259 270 260 271 // put all columns to the array and merge with default 261 $aTabs = $this->getPosttypeOptions( fpFunctions::getCurrentPosttype( ) )->aTabs;262 272 $aTabs = $this->getPosttypeOptions( fpFunctions::getCurrentPosttype(true) )->aTabs; 273 263 274 foreach( $aTabs as $sIdent => $aTab ){ 264 275 $aCustomColumns[ $sIdent ] = __( $aTab[ 'sTitle' ], 'custom-columns-user' ); -
custom-columns/trunk/CustomColumnsPage.class.php
r884627 r886963 111 111 * 112 112 * @since 1.0 113 * @updated 1.1 113 114 * 114 115 * @return array … … 125 126 unset( $aPosttypes[ 'attachment' ] ); 126 127 $aPosttypes[ 'media' ] = $aMedia; 127 128 // 1.0 media not supported yet... just unset it129 unset( $aPosttypes[ 'media' ] );130 128 131 129 $this->aAviablePosttypes = $aPosttypes; … … 335 333 * 336 334 * @since 1.0 335 * @updated 1.1 337 336 */ 338 337 protected function addTemplateTabContent() … … 360 359 <label for="tab-options-%%sIdent%%-options-sortable-type"><?php _e( 'Choose sort type', 'custom-columns' ); ?></label> 361 360 <select data-tab-group="%%sIdent%%" id="tab-options-%%sIdent%%-options-sortable-type" name="aTabs[%%sIdent%%][aOptions][sortable][sType]"> 362 <option value="posts_table"><?php _e( 'Posts-Table', 'custom-columns' ); ?></option> 363 <option value="post_meta"><?php _e( 'Post Meta', 'custom-columns' ); ?></option> 364 <option value="taxonomies"><?php _e( 'Taxonomy', 'custom-columns' ); ?></option> 361 <option value="posts_table"><?php _e( 'Posts-Table', 'custom-columns' ); ?></option> 362 363 <?php if( count( $aMetakeys ) ): ?> 364 <option value="post_meta"><?php _e( 'Post Meta', 'custom-columns' ); ?></option> 365 <?php endif; ?> 366 367 <?php if( count( $aTaxonomies ) ): ?> 368 <option value="taxonomies"><?php _e( 'Taxonomy', 'custom-columns' ); ?></option> 369 <?php endif; ?> 365 370 </select> 366 371 -
custom-columns/trunk/functions.php
r884627 r886963 102 102 * 103 103 * @since 1.0 104 * @updated 1.1 105 * 106 * @param boolean $blRewriteAttachment 104 107 * 105 108 * @return string 106 109 */ 107 public static function getCurrentPosttype() { 108 global $post, $typenow, $current_screen; 110 public static function getCurrentPosttype( $blRewriteAttachment = false ) 111 { 112 $sPosttype = self::_getCurrentPosttype(); 113 114 if( $blRewriteAttachment && $sPosttype !== null && $sPosttype == 'attachment' ){ 115 $sPosttype = 'media'; 116 } 117 118 return $sPosttype; 119 } 120 121 122 /** 123 * Gets the current post type 124 * 125 * @since 1.1 126 * 127 * @return string 128 */ 129 protected function _getCurrentPosttype() 130 { 131 global $post, $typenow, $current_screen; 109 132 110 133 //we have a post so we can just get the post type from that -
custom-columns/trunk/readme.txt
r884633 r886963 47 47 == Changelog == 48 48 49 = 1.1 = 50 * Medias can now also be personalized. 51 * Minor bugfixes 52 49 53 = 1.0 = 50 54 * Changed License
Note: See TracChangeset
for help on using the changeset viewer.