PluginProbe ʕ •ᴥ•ʔ
Custom Sidebars – Dynamic Sidebar Classic Widget Area Manager / 3.35
Custom Sidebars – Dynamic Sidebar Classic Widget Area Manager v3.35
trunk 2.1.2.0 3.0.0.0 3.0.0.1 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.7.1 3.0.8 3.0.8.1 3.0.9 3.1.0 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.2.0 3.2.1 3.2.2 3.2.3 3.2.4 3.3 3.31 3.32 3.35 3.36 3.37 3.38
custom-sidebars / views / col-sidebars.php
custom-sidebars / views Last commit date
bulk-edit.php 7 years ago col-sidebars.php 7 years ago import.php 7 years ago metabox.php 5 years ago quick-edit.php 9 years ago widgets-delete.php 8 years ago widgets-editor.php 8 years ago widgets-export.php 8 years ago widgets-location.php 7 years ago widgets.php 7 years ago
col-sidebars.php
81 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 * check is WooCommerce shop
17 */
18 $is_woo_shop = intval( $post_id ) === ( function_exists( 'wc_get_page_id' )? intval( wc_get_page_id( 'shop' ) ) : 0 );
19 /**
20 * helper function
21 */
22 if ( ! function_exists( 'custom_sidebars_col_sideber_not_available' ) ) {
23 /**
24 * local display helper
25 *
26 * @since 3.2.0
27 *
28 * @param string $page_name Page Name to display.
29 */
30 function custom_sidebars_col_sideber_not_available( $page_name ) {
31 $content = sprintf(
32 esc_attr__( 'Not available for %s', 'custom-sidebars' ),
33 $page_name
34 );
35 printf(
36 '<small>%s</small>',
37 esc_html( $content )
38 );
39 }
40 }
41 /**
42 * prepare
43 */
44 if ( $is_front ) {
45 custom_sidebars_col_sideber_not_available( __( 'Home Page', 'custom-sidebars' ) );
46 } elseif ( $is_blog ) {
47 custom_sidebars_col_sideber_not_available( __( 'Blog Page', 'custom-sidebars' ) );
48 } else if ( $is_woo_shop ) {
49 custom_sidebars_col_sideber_not_available( __( 'WooCommerce Shop', 'custom-sidebars' ) );
50 } else {
51 global $wp_registered_sidebars;
52 $available = CustomSidebars::sort_sidebars_by_name( $wp_registered_sidebars );
53 $content = '';
54 foreach ( $sidebars as $s ) {
55 $sb_name = $available[ $s ]['name'];
56 $replaced = ! empty( $available[ $selected[ $s ] ] );
57 $class = $replaced ? 'cust' : 'def';
58
59 if ( $replaced ) {
60 $content .= sprintf(
61 '<dt data-sidebar="%s" data-replaced="%s" class="cs-key %s">',
62 esc_attr( $s ),
63 isset( $selected[ $s ] )? esc_attr( $selected[ $s ] ):'',
64 esc_attr( $class, 'custom-sidebars' )
65 );
66 $content .= esc_html( $sb_name );
67 $content .= '</dt>';
68 $content .= '<dd class="cs-val">';
69 $content .= esc_html( $available[ $selected[ $s ] ]['name'] );
70 $content .= '</dd>';
71 }
72 }
73 if ( empty( $content ) ) {
74 echo '-';
75 } else {
76 echo '<dl>';
77 echo $content;
78 echo '</dl>';
79 }
80 }
81