col-sidebars.php
9 years ago
import.php
9 years ago
metabox.php
9 years ago
quick-edit.php
9 years ago
widgets-delete.php
10 years ago
widgets-editor.php
10 years ago
widgets-export.php
10 years ago
widgets-location.php
9 years ago
widgets.php
10 years ago
col-sidebars.php
56 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Custom column inside the post-list. |
| 4 | * |
| 5 | * Uses: |
| 6 | * $selected |
| 7 | * $wp_registered_sidebars |
| 8 | * $post_id |
| 9 | */ |
| 10 | |
| 11 | $sidebars = CustomSidebars::get_options( 'modifiable' ); |
| 12 | |
| 13 | $is_front = get_option( 'page_on_front' ) == $post_id; |
| 14 | $is_blog = get_option( 'page_for_posts' ) == $post_id; |
| 15 | |
| 16 | if ( $is_front || $is_blog ) { |
| 17 | if ( $is_front ) { |
| 18 | _e( '(Not available for Home-Page)', 'custom-sidebars' ); |
| 19 | } else { |
| 20 | _e( '(Not available for Blog-Page)', 'custom-sidebars' ); |
| 21 | } |
| 22 | foreach ( $sidebars as $s ) : ?> |
| 23 | <span data-sidebar="<?php echo esc_attr( $s ); ?>" data-replaced="<?php echo esc_attr( @$selected[ $s ] ); ?>" data-cshide="yes"> |
| 24 | <?php endforeach; |
| 25 | } else { |
| 26 | global $wp_registered_sidebars; |
| 27 | $available = CustomSidebars::sort_sidebars_by_name( $wp_registered_sidebars ); |
| 28 | $content = ''; |
| 29 | foreach ( $sidebars as $s ) { |
| 30 | $sb_name = $available[ $s ]['name']; |
| 31 | $replaced = ! empty( $available[ $selected[ $s ] ] ); |
| 32 | $class = $replaced ? 'cust' : 'def'; |
| 33 | |
| 34 | if ( $replaced ) { |
| 35 | $content .= sprintf( |
| 36 | '<dt data-sidebar="%s" data-replaced="%s" class="cs-key %s">', |
| 37 | esc_attr( $s ), |
| 38 | isset( $selected[ $s ] )? esc_attr( $selected[ $s ] ):'', |
| 39 | esc_attr( $class, 'custom-sidebars' ) |
| 40 | ); |
| 41 | $content .= esc_html( $sb_name ); |
| 42 | $content .= '</dt>'; |
| 43 | $content .= '<dd class="cs-val">'; |
| 44 | $content .= esc_html( $available[ $selected[ $s ] ]['name'] ); |
| 45 | $content .= '</dd>'; |
| 46 | } |
| 47 | } |
| 48 | if ( empty( $content ) ) { |
| 49 | echo '-'; |
| 50 | } else { |
| 51 | echo '<dl>'; |
| 52 | echo $content; |
| 53 | echo '</dl>'; |
| 54 | } |
| 55 | } |
| 56 |