IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
43 | 43 | add_filter( 'single_term_title', array( $this, 'filter_single_term_title' ) ); |
44 | 44 | add_filter( 'the_content', array( $this, 'filter_rel_nofollow' ) ); |
45 | 45 | add_action( 'wp_head', array( Template::class, 'json_ld_schema' ), 1 ); |
| 46 | add_action( 'wp_head', array( Template::class, 'output_meta' ), 1 ); |
46 | 47 | |
47 | 48 | // Cron tasks. |
48 | 49 | new Jobs\Manager(); |
… |
… |
|
298 | 299 | ) ); |
299 | 300 | register_post_status( 'disabled', array( |
300 | 301 | 'label' => _x( 'Disabled', 'plugin status', 'wporg-plugins' ), |
301 | | 'public' => false, |
| 302 | 'public' => true, |
302 | 303 | 'show_in_admin_status_list' => current_user_can( 'plugin_disable' ), |
303 | 304 | 'label_count' => _n_noop( 'Disabled <span class="count">(%s)</span>', 'Disabled <span class="count">(%s)</span>', 'wporg-plugins' ), |
304 | 305 | ) ); |
… |
… |
|
786 | 787 | }, 10, 2 ); |
787 | 788 | } |
788 | 789 | |
| 790 | // Allow anyone to view a disabled plugin directly from its page. It won't show in search results or lists. |
| 791 | if ( !empty( $wp_query->query_vars['name'] ) ) { |
| 792 | $wp_query->query_vars['post_status'][] = 'disabled'; |
| 793 | $wp_query->query_vars['post_status'] = array_unique( $wp_query->query_vars['post_status'] ); |
| 794 | } |
| 795 | |
789 | 796 | // By default, all archives are sorted by active installs |
790 | 797 | if ( $wp_query->is_archive() && empty( $wp_query->query_vars['orderby'] ) ) { |
791 | 798 | $wp_query->query_vars['orderby'] = 'meta_value_num'; |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
95 | 95 | </div> |
96 | 96 | <?php endif; ?> |
97 | 97 | |
| 98 | <?php if ( get_post_status() !== 'disabled' || current_user_can( 'plugin_admin_view', get_post() ) ) : ?> |
98 | 99 | <a class="plugin-download button download-button button-large" href="<?php echo esc_url( Template::download_link() ); ?>"><?php _e( 'Download', 'wporg-plugins' ); ?></a> |
| 100 | <?php endif; ?> |
99 | 101 | </div> |
100 | 102 | |
101 | 103 | <?php the_title( '<h1 class="plugin-title"><a href="' . esc_url( get_permalink() ) . '">', '</a></h1>' ); ?> |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
45 | 45 | endif; |
46 | 46 | |
47 | 47 | // Schema for plugin pages. |
48 | | if ( is_singular( 'plugin' ) ) : |
49 | | $plugin = get_queried_object(); |
| 48 | if ( is_singular( 'plugin' ) && get_post_status( get_queried_object_id() ) !== 'disabled' ) { |
| 49 | self::plugin_json_jd_schema( get_queried_object() ); |
| 50 | } |
| 51 | } |
50 | 52 | |
51 | | $rating = get_post_meta( $plugin->ID, 'rating', true ) ?: 0; |
52 | | $ratings = get_post_meta( $plugin->ID, 'ratings', true ) ?: []; |
53 | | $num_ratings = array_sum( $ratings ); |
| 53 | /** |
| 54 | * Prints JSON LD schema for a specific plugin |
| 55 | * |
| 56 | * @param \WP_Post $plugin Plugin to output JSON LD Schema for. |
| 57 | */ |
| 58 | protected static function plugin_json_jd_schema( $plugin ) { |
| 59 | $rating = get_post_meta( $plugin->ID, 'rating', true ) ?: 0; |
| 60 | $ratings = get_post_meta( $plugin->ID, 'ratings', true ) ?: []; |
| 61 | $num_ratings = array_sum( $ratings ); |
54 | 62 | |
55 | | echo PHP_EOL; |
56 | | ?> |
57 | | <script type="application/ld+json"> |
| 63 | echo PHP_EOL; |
| 64 | ?> |
| 65 | <script type="application/ld+json"> |
58 | 66 | [ |
59 | 67 | { |
60 | 68 | "@context": "http://schema.org", |
… |
… |
|
114 | 122 | } |
115 | 123 | ] |
116 | 124 | </script> |
117 | | <?php |
118 | | endif; |
| 125 | <?php |
| 126 | } |
| 127 | |
| 128 | /** |
| 129 | * Prints meta tags on a page. |
| 130 | */ |
| 131 | public static function output_meta() { |
| 132 | $metas = []; |
| 133 | |
| 134 | // Add noindex on disabled plugin page. |
| 135 | if ( is_singular( 'plugin' ) && get_post_status( get_queried_object_id() ) === 'disabled' ) { |
| 136 | $metas[] = '<meta name="robots" content="noindex" />'; |
| 137 | } |
| 138 | |
| 139 | echo implode( PHP_EOL, $metas ); |
119 | 140 | } |
120 | 141 | |
121 | 142 | /** |