Changeset 3892
- Timestamp:
- 08/31/2016 04:58:29 PM (10 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc
- Files:
-
- 3 edited
-
class-directory-compat.php (modified) (9 diffs)
-
class-plugin-directory-compat.php (modified) (3 diffs)
-
class-theme-directory-compat.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-directory-compat.php
r3846 r3892 6 6 7 7 abstract protected function compat(); 8 abstract protected function compat_title(); 8 9 abstract protected function slug(); 9 10 abstract protected function title(); … … 11 12 abstract protected function query_var(); 12 13 abstract protected function taxonomy(); 13 14 public function __construct() {} 14 abstract protected function parse_query(); 15 abstract protected function do_view_sidebar(); 16 abstract protected function do_topic_sidebar(); 17 abstract protected function get_view_header(); 18 19 var $authors = null; 20 var $contributors = null; 15 21 16 22 public function init() { 23 if ( defined( 'WPORG_SUPPORT_FORUMS_BLOGID' ) && get_current_blog_id() == WPORG_SUPPORT_FORUMS_BLOGID ) { 24 // Define the taxonomy and query vars for this view. 25 add_action( 'plugins_loaded', array( $this, 'always_load' ) ); 26 27 // We have to add the custom view before bbPress runs its own action 28 // on parse_query at priority 2. 29 add_action( 'parse_query', array( $this, 'parse_query' ), 0 ); 30 31 // And this still needs to happen before priority 2. 32 add_action( 'parse_query', array( $this, 'maybe_load' ), 1 ); 33 34 // Check to see if an individual topic is compat. 35 add_action( 'template_redirect', array( $this, 'check_topic_for_compat' ) ); 36 } 37 } 38 39 public function always_load() { 40 // Add filters necessary for determining which compat file to use. 17 41 add_action( 'bbp_init', array( $this, 'register_taxonomy' ) ); 18 42 add_filter( 'query_vars', array( $this, 'add_query_var' ) ); 19 43 add_action( 'bbp_add_rewrite_rules', array( $this, 'add_rewrite_rules' ) ); 20 44 21 add_filter( 'bbp_get_view_link', array( $this, 'get_view_link' ), 10, 2 ); 22 add_filter( 'bbp_breadcrumbs', array( $this, 'breadcrumbs' ) ); 45 } 46 47 public function maybe_load() { 48 if ( false !== $this->slug() ) { 49 // This must run before bbPress's parse_query at priority 2. 50 $this->register_views(); 51 52 // Add theme-specific filters and actions. 53 add_action( 'wporg_compat_view_sidebar', array( $this, 'do_view_sidebar' ) ); 54 55 // Add output filters and actions. 56 add_filter( 'bbp_get_view_link', array( $this, 'get_view_link' ), 10, 2 ); 57 add_filter( 'bbp_breadcrumbs', array( $this, 'breadcrumbs' ) ); 58 add_filter( 'bbp_get_breadcrumb', array( $this, 'get_breadcrumb' ), 10, 3 ); 59 } 60 } 61 62 public function check_topic_for_compat() { 63 if ( bbp_is_single_topic() ) { 64 $slug = wp_get_object_terms( bbp_get_topic_id(), $this->taxonomy(), array( 'fields' => 'slugs' ) ); 65 66 // Match found for this compat. 67 if ( ! empty( $slug ) ) { 68 $slug = $slug[0]; 69 70 // Basic setup. 71 $this->slug = $slug; 72 $this->{$this->compat()} = $this->get_object( $slug ); 73 $this->authors = $this->get_authors( $slug ); 74 $this->contributors = $this->get_contributors( $slug ); 75 76 // Add output filters and actions. 77 if ( ! empty( $this->authors ) || ! empty( $this->contributors ) ) { 78 add_filter( 'bbp_get_topic_author_link', array( $this, 'author_link' ), 10, 2 ); 79 add_filter( 'bbp_get_reply_author_link', array( $this, 'author_link' ), 10, 2 ); 80 } 81 add_action( 'wporg_compat_single_topic_sidebar_pre', array( $this, 'do_topic_sidebar' ) ); 82 } 83 } 23 84 } 24 85 … … 29 90 $root_var = $this->query_var(); 30 91 $review_id = 'reviews'; 92 $active_id = 'active'; 31 93 32 94 $support_rule = $this->compat() . '/([^/]+)/'; 33 95 $reviews_rule = $this->compat() . '/([^/]+)/' . $review_id . '/'; 96 $active_rule = $this->compat() . '/([^/]+)/' . $active_id . '/'; 34 97 35 98 $feed_id = 'feed'; … … 53 116 add_rewrite_rule( $support_rule . $paged_rule, 'index.php?' . $view_id . '=' . $root_id . '&' . $root_var . '=$matches[1]&' . $paged_id . '=$matches[2]', $priority ); 54 117 add_rewrite_rule( $support_rule . $feed_rule, 'index.php?' . $view_id . '=' . $root_id . '&' . $root_var . '=$matches[1]&' . $feed_id . '=$matches[2]', $priority ); 118 119 // Add active view rewrite rules. 120 add_rewrite_rule( $active_rule . $base_rule, 'index.php?' . $view_id . '=' . $active_id . '&' . $root_var . '=$matches[1]', $priority ); 121 add_rewrite_rule( $active_rule . $paged_rule, 'index.php?' . $view_id . '=' . $active_id . '&' . $root_var . '=$matches[1]&' . $paged_id . '=$matches[2]', $priority ); 122 add_rewrite_rule( $active_rule . $feed_rule, 'index.php?' . $view_id . '=' . $active_id . '&' . $root_var . '=$matches[1]&' . $feed_id . '=$matches[2]', $priority ); 55 123 } 56 124 … … 66 134 } 67 135 136 public function register_views() { 137 138 // Add support view. 139 bbp_register_view( 140 $this->compat(), 141 $this->compat_title(), 142 array( 143 'post_parent' => $this->forum_id(), 144 'tax_query' => array( array( 145 'taxonomy' => $this->taxonomy(), 146 'field' => 'slug', 147 'terms' => $this->slug(), 148 ) ), 149 'show_stickies' => false, 150 'orderby' => 'ID', 151 ) 152 ); 153 154 // Add reviews view. 155 bbp_register_view( 156 'reviews', 157 __( 'Reviews', 'wporg-forums' ), 158 array( 159 'post_parent' => Plugin::REVIEWS_FORUM_ID, 160 'meta_query' => array( array( 161 'key' => '_bbp_last_active_time', 162 'type' => 'DATETIME', 163 ) ), 164 'tax_query' => array( array( 165 'taxonomy' => $this->taxonomy(), 166 'field' => 'slug', 167 'terms' => $this->slug(), 168 ) ), 169 'show_stickies' => false, 170 'orderby' => 'meta_value', 171 ) 172 ); 173 174 // Add recent activity view. 175 bbp_register_view( 176 'active', 177 __( 'Recent Activity', 'wporg-forums' ), 178 array( 179 'post_parent' => $this->forum_id(), 180 'meta_query' => array( array( 181 'key' => '_bbp_last_active_time', 182 'type' => 'DATETIME', 183 ) ), 184 'tax_query' => array( array( 185 'taxonomy' => $this->taxonomy(), 186 'field' => 'slug', 187 'terms' => $this->slug(), 188 ) ), 189 'show_stickies' => false, 190 'orderby' => 'meta_value', 191 ) 192 ); 193 } 194 68 195 /** 69 196 * Filter view links to provide prettier links for these subforum views. … … 73 200 74 201 $view = bbp_get_view_id( $view ); 75 if ( $view != $this->compat() ) {202 if ( ! in_array( $view, array( 'active', 'reviews', $this->compat() ) ) ) { 76 203 return $url; 77 204 } … … 79 206 // Pretty permalinks. 80 207 if ( $wp_rewrite->using_permalinks() ) { 81 $url = $wp_rewrite->root . $this->compat() . '/' . $this->slug(); 208 switch ( $view ) { 209 case 'active' : 210 case 'reviews' : 211 $url = $wp_rewrite->root . $this->compat() . '/' . $this->slug() . '/' . $view; 212 break; 213 214 default : 215 $url = $wp_rewrite->root . $this->compat() . '/' . $this->slug(); 216 } 82 217 $url = home_url( user_trailingslashit( $url ) ); 83 218 … … 103 238 104 239 $view = bbp_get_view_id(); 105 if ( ! in_array( $view, array( $this->compat(), 'reviews' ) ) ) {240 if ( ! in_array( $view, array( $this->compat(), 'reviews', 'active' ) ) ) { 106 241 return $r; 107 242 } … … 115 250 return $r; 116 251 } 252 253 /** 254 * Prefix a single view-specific header using the breadcrumb filter. 255 */ 256 public function get_breadcrumb( $trail, $crumbs, $r ) { 257 if ( bbp_is_single_view() && in_array( bbp_get_view_id(), array( 'theme', 'plugin', 'reviews' ) ) ) { 258 $view_header = $this->get_view_header(); 259 $trail = $view_header . $trail; 260 } 261 return $trail; 262 } 263 264 /** 265 * @todo Add the author or contributor badge. 266 */ 267 public function author_link( $author_link, $args ) { 268 return $author_link; 269 } 270 271 /** 272 * Set up and cache the plugin or theme details. 273 * 274 * @param string $slug The object slug 275 */ 276 public function get_object( $slug ) { 277 global $wpdb; 278 279 if ( 'theme' == $this->compat() ) { 280 if ( ! is_null( $this->theme ) ) { 281 return $this->theme; 282 } 283 } else { 284 if ( ! is_null( $this->plugin ) ) { 285 return $this->plugin; 286 } 287 } 288 289 // Check the cache. 290 $cache_key = "{$slug}"; 291 $cache_group = $this->compat() . '-objects'; 292 $compat_object = wp_cache_get( $cache_key, $cache_group ); 293 if ( false === $compat_object ) { 294 295 // Get the object information from the correct table. 296 if ( $this->compat() == 'theme' ) { 297 $compat_object = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$wpdb->base_prefix}%d_posts WHERE post_name = %s AND post_type = 'repopackage' LIMIT 1", WPORG_THEME_DIRECTORY_BLOGID, $slug ) ); 298 } elseif ( $this->compat() == 'plugin' ) { 299 $compat_object = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$wpdb->base_prefix}%d_posts WHERE post_name = %s AND post_type = 'plugin' LIMIT 1", WPORG_PLUGIN_DIRECTORY_BLOGID, $slug ) ); 300 } 301 302 wp_cache_set( $cache_key, $compat_object, $cache_group, 86400); 303 } 304 return $compat_object; 305 } 306 307 public function get_authors( $slug ) { 308 global $wpdb; 309 310 if ( null !== $this->authors ) { 311 return $this->authors; 312 } 313 314 // Check the cache. 315 $cache_key = "{$slug}"; 316 $cache_group = $this->compat() . '-authors'; 317 $authors = wp_cache_get( $cache_key, $cache_group ); 318 if ( false === $authors ) { 319 320 if ( $this->compat() == 'theme' ) { 321 $theme = $this->theme; 322 $author = get_user_by( 'id', $this->theme->post_author ); 323 $authors = array( $author->user_login ); 324 } else { 325 $authors = $wpdb->get_col( $wpdb->prepare( " SELECT user FROM plugin_2_svn_access WHERE `path` = %s", '/' . $slug ) ); 326 } 327 328 wp_cache_set( $cache_key, $authors, $cache_group, 3600 ); 329 } 330 return $authors; 331 } 332 333 public function get_contributors( $slug ) { 334 global $wpdb; 335 336 if ( null !== $this->contributors ) { 337 return $this->contributors; 338 } 339 340 // Themes do not have contributors right now. 341 if ( $this->compat() == 'theme' ) { 342 $contributors = array(); 343 return $contributors; 344 } 345 346 // Check the cache. 347 $cache_key = "{$slug}"; 348 $cache_group = $this->compat() . '-contributors'; 349 $contributors = wp_cache_get( $cache_key, $cache_group ); 350 if ( false === $contributors ) { 351 $contributors = $wpdb->get_var( $wpdb->prepare( "SELECT meta_value FROM {$wpdb->base_prefix}%d_postmeta WHERE post_id = %d AND meta_key = %s LIMIT 1", WPORG_PLUGIN_DIRECTORY_BLOGID, $this->plugin->ID, 'contributors' ) ); 352 $contributors = maybe_unserialize( $contributors ); 353 354 wp_cache_set( $cache_key, $contributors, $cache_group, 3600 ); 355 } 356 return $contributors; 357 } 117 358 } -
sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-plugin-directory-compat.php
r3846 r3892 7 7 const COMPAT = 'plugin'; 8 8 9 var $slug = '';10 var $plugin = '';9 var $slug = false; 10 var $plugin = null; 11 11 12 12 function compat() { 13 13 return self::COMPAT; 14 } 15 16 function compat_title() { 17 return __( 'Plugin Support', 'wporg-forums' ); 14 18 } 15 19 … … 35 39 36 40 public function __construct() { 37 if ( defined( 'WPORG_SUPPORT_FORUMS_BLOGID' ) && get_current_blog_id() == WPORG_SUPPORT_FORUMS_BLOGID ) { 38 // We have to add the custom view before bbPress runs its own action 39 // on parse_query at priority 2. 40 add_action( 'parse_query', array( $this, 'parse_query' ), 1 ); 41 42 // Add parent class hooks. 43 add_action( 'plugins_loaded', array( $this, 'init' ) ); 44 } 41 $this->init(); 45 42 } 46 43 … … 54 51 } 55 52 56 $plugin = $this->get_ plugin_data( $slug );53 $plugin = $this->get_object( $slug ); 57 54 if ( ! $plugin ) { 58 55 return; 59 56 } else { 60 $this->slug = $slug; 61 $this->plugin = $plugin; 57 $this->slug = $slug; 58 $this->plugin = $plugin; 59 $this->authors = $this->get_authors( $slug ); 60 $this->contributors = $this->get_contributors( $slug ); 62 61 } 63 64 // Add plugin support view.65 bbp_register_view(66 self::COMPAT,67 __( 'Plugin Support', 'wporg-forums' ),68 array(69 'post_parent' => Plugin::PLUGINS_FORUM_ID,70 'tax_query' => array( array(71 'taxonomy' => $this->taxonomy(),72 'field' => 'slug',73 'terms' => $slug,74 ) ),75 'orderby' => '',76 'show_stickies' => false,77 )78 );79 80 // Add plugin review view.81 bbp_register_view(82 'reviews',83 __( 'Reviews', 'wporg-forums' ),84 array(85 'post_parent' => Plugin::REVIEWS_FORUM_ID,86 'tax_query' => array( array(87 'taxonomy' => $this->taxonomy(),88 'field' => 'slug',89 'terms' => $slug,90 ) ),91 'orderby' => '',92 'show_stickies' => false,93 )94 );95 62 } 96 63 97 public function get_plugin_data( $slug = '' ) { 98 global $wpdb; 64 public function do_view_sidebar() { 65 ?> 66 <div> 67 <h3><?php _e( 'Browse Plugins', 'wporg-forums' ); ?></h3> 99 68 100 if ( ! empty( $this->plugin ) ) { 101 return $this->plugin; 102 } 69 <ul class="plugin-submenu"> 70 <li class="view"><a href='//wordpress.org/plugins/'><?php _e( 'Featured', 'wporg' ); ?></a></li> 71 <li class="view"><a href='//wordpress.org/plugins/browse/popular/'><?php _e( 'Most Popular', 'wporg' ); ?></a></li> 72 <li class="view"><a href='//wordpress.org/plugins/browse/favorites/'><?php _e( 'Favorites', 'wporg' ); ?></a></li> 73 <li class="view"><a href='//wordpress.org/plugins/browse/beta/'><?php _e( 'Beta Testing', 'wporg' ); ?></a></li> 74 <li class="view"><a href='/plugins/about/'><?php _e( 'Developers', 'wporg' ); ?></a></li> 75 </ul> 76 </div> 103 77 104 $sql = $wpdb->prepare( "SELECT * FROM {$wpdb->base_prefix}%d_posts WHERE post_name = %s AND post_type = 'plugin' LIMIT 1", WPORG_PLUGIN_DIRECTORY_BLOGID, $slug ); 105 $row = $wpdb->get_row( $sql ); 106 if ( ! $row ) { 107 return false; 108 } else { 109 $plugin = $row; 110 $sql = $wpdb->prepare( "SELECT * FROM {$wpdb->base_prefix}%d_postmeta WHERE post_id = %d AND meta_key NOT LIKE %s", WPORG_PLUGIN_DIRECTORY_BLOGID, $row->ID, '_trac_ticket_%' ); 111 $results = $wpdb->get_results( $sql ); 112 if( $results ) { 113 foreach ( $results as $row ) { 114 if ( ! isset( $plugin->{$row->meta_key} ) ) { 115 $plugin->{$row->meta_key} = maybe_unserialize( $row->meta_value ); 116 } 117 } 118 } 119 } 120 return $plugin; 78 <div> 79 <h3><?php _e( 'Search Plugins', 'wporg-forums' ); ?></h3> 80 81 <form id="side-search" method="get" action="//wordpress.org/plugins/search.php"> 82 <div> 83 <input type="text" class="text" name="q" value="" /> 84 <input type="submit" class="button" value="<?php _e( 'Search', 'wporg-forums' ); ?>" /> 85 </div> 86 </form> 87 </div> 88 <?php 89 } 90 91 public function do_topic_sidebar() { 92 include_once WPORGPATH . 'extend/plugins-plugins/_plugin-icons.php'; 93 $plugin = sprintf( '<a href="//wordpress.org/plugins/%s/">%s</a>', esc_attr( $this->slug() ), esc_html( $this->plugin->post_title ) ); 94 $faq = sprintf( '<a href="//wordpress.org/plugins/%s/faq/">Frequently Asked Questions</a>', esc_attr( $this->slug() ) ); 95 $support = sprintf( '<a href="//wordpress.org/support/plugin/%s/">Support Threads</a>', esc_attr( $this->slug() ) ); 96 $reviews = sprintf( '<a href="//wordpress.org/support/plugin/%s/reviews/">Reviews</a>', esc_attr( $this->slug() ) ); 97 ?> 98 <div> 99 <h3>About this Plugin</h3> 100 <ul> 101 <li><?php echo wporg_get_plugin_icon( $this->slug, 128 ); ?></li> 102 <li style="clear:both;"><?php echo $plugin; ?></li> 103 <?php if ( ! empty( $this->plugin->post_content ) && false !== strpos( $this->plugin->post_content, '<!--section=faq-->' ) ) : ?> 104 <li><?php echo $faq; ?></li> 105 <?php endif; ?> 106 <li><?php echo $support; ?></li> 107 <li><?php echo $reviews; ?></li> 108 </ul> 109 </div> 110 <?php 111 } 112 113 /** 114 * Return a custom view header string so that get_breadcrumbs will display it. 115 */ 116 public function get_view_header() { 117 $slug = esc_attr( $this->slug ); 118 $description = esc_html__( 'Description', 'wporg-forums' ); 119 $support = esc_html__( 'Support', 'wporg-forums' ); 120 $reviews = esc_html__( 'Reviews', 'wporg-forums' ); 121 122 $header = <<<EOT 123 <ul id="sections"> 124 <li class="section-description"> 125 <a href="//wordpress.org/plugins/{$slug}/">{$description}</a> 126 </li> 127 <li class="section-support"> 128 <a href="//wordpress.org/support/plugin/{$slug}/">{$support}</a> 129 <li> 130 <li class="section-reviews"> 131 <a href="//wordpress.org/support/plugin/{$slug}/reviews/">{$reviews}</a> 132 </li> 133 </ul> 134 EOT; 135 return $header; 121 136 } 122 137 } -
sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-theme-directory-compat.php
r3846 r3892 7 7 const COMPAT = 'theme'; 8 8 9 var $slug = '';10 var $theme = '';9 var $slug = false; 10 var $theme = null; 11 11 12 12 function compat() { 13 13 return self::COMPAT; 14 } 15 16 function compat_title() { 17 return __( 'Theme Support', 'wporg-forums' ); 14 18 } 15 19 … … 35 39 36 40 public function __construct() { 37 if ( defined( 'WPORG_SUPPORT_FORUMS_BLOGID' ) && get_current_blog_id() == WPORG_SUPPORT_FORUMS_BLOGID ) { 38 // We have to add the custom view before bbPress runs its own action 39 // on parse_query at priority 2. 40 add_action( 'parse_query', array( $this, 'parse_query' ), 1 ); 41 42 // Add parent class hooks. 43 add_action( 'plugins_loaded', array( $this, 'init' ) ); 44 } 41 $this->init(); 45 42 } 46 43 … … 54 51 } 55 52 56 $theme = $this->get_ theme_data( $slug );53 $theme = $this->get_object( $slug ); 57 54 if ( ! $theme ) { 58 55 return; 59 56 } else { 60 $this->slug = $slug; 61 $this->theme = $theme; 57 $this->slug = $slug; 58 $this->theme = $theme; 59 $this->authors = $this->get_authors( $slug ); 60 $this->contributors = $this->get_contributors( $slug ); 62 61 } 63 64 // Add theme support view.65 bbp_register_view(66 self::COMPAT,67 __( 'Theme Support', 'wporg-forums' ),68 array(69 'post_parent' => Plugin::THEMES_FORUM_ID,70 'tax_query' => array( array(71 'taxonomy' => $this->taxonomy(),72 'field' => 'slug',73 'terms' => $slug,74 ) ),75 'orderby' => '',76 'show_stickies' => false,77 )78 );79 80 // Add theme review view.81 bbp_register_view(82 'reviews',83 __( 'Reviews', 'wporg-forums' ),84 array(85 'post_parent' => Plugin::REVIEWS_FORUM_ID,86 'tax_query' => array( array(87 'taxonomy' => $this->taxonomy(),88 'field' => 'slug',89 'terms' => $slug,90 ) ),91 'orderby' => '',92 'show_stickies' => false,93 )94 );95 62 } 96 63 97 public function get_theme_data( $slug = '' ) { 98 global $wpdb; 64 public function do_view_sidebar() { 65 ?> 66 <div> 67 <h3><?php _e( 'Browse Themes', 'wporg-forums' ); ?></h3> 99 68 100 if ( ! empty( $this->theme ) ) { 101 return $this->theme; 102 } 69 <ul class="theme-submenu"> 70 <li class="view"><a href="//wordpress.org/themes/"><?php _e( 'Featured', 'wporg-forums' ); ?></a></li> 71 <li class="view"><a href="//wordpress.org/themes/browse/popular/"><?php _e( 'Most Popular', 'wporg-forums' ); ?></a></li> 72 <li class="view"><a href="//wordpress.org/themes/browse/new/"><?php _e( 'Latest', 'wporg-forums' ); ?></a></li> 73 <li class="view"><a href="/themes/getting-started/"><?php _e( 'Theme Authors', 'wporg-forums' ); ?></a></li> 74 <li class="view"><a href="/themes/commercial/"><?php _e( 'Commercial', 'wporg-forums' ); ?></a></li> 75 </ul> 76 </div> 103 77 104 $sql = $wpdb->prepare( "SELECT * FROM {$wpdb->base_prefix}%d_posts WHERE post_name = %s AND post_type = 'repopackage' LIMIT 1", WPORG_THEME_DIRECTORY_BLOGID, $slug ); 105 $row = $wpdb->get_row( $sql ); 106 if ( ! $row ) { 107 return false; 108 } else { 109 $theme = $row; 110 $sql = $wpdb->prepare( "SELECT * FROM {$wpdb->base_prefix}%d_postmeta WHERE post_id = %d AND meta_key NOT LIKE %s", WPORG_THEME_DIRECTORY_BLOGID, $row->ID, '_trac_ticket_%' ); 111 $results = $wpdb->get_results( $sql ); 112 if( $results ) { 113 foreach ( $results as $row ) { 114 if ( ! isset( $theme->{$row->meta_key} ) ) { 115 $theme->{$row->meta_key} = maybe_unserialize( $row->meta_value ); 116 } 117 } 118 } 119 } 120 return $theme; 78 <div> 79 <h3><?php _e( 'Search Themes', 'wporg-forums' ); ?></h3> 80 81 <form id="side-search" method="get" action="//wordpress.org/themes/search.php"> 82 <div> 83 <input type="text" class="text" name="q" value="" /> 84 <input type="submit" class="button" value="<?php _e( 'Search', 'wporg-forums' ); ?>" /> 85 </div> 86 </form> 87 </div> 88 <?php 89 } 90 91 public function do_topic_sidebar() { 92 $theme = sprintf( '<a href="//wordpress.org/plugins/%s/">%s</a>', esc_attr( $this->slug() ), esc_html( $this->theme->post_title ) ); 93 $support = sprintf( '<a href="//wordpress.org/support/plugin/%s/">Support Threads</a>', esc_attr( $this->slug() ) ); 94 $reviews = sprintf( '<a href="//wordpress.org/support/plugin/%s/reviews/">Reviews</a>', esc_attr( $this->slug() ) ); 95 ?> 96 <div> 97 <h3>About this Theme</h3> 98 <ul> 99 <li><?php echo $theme; ?></li> 100 <li><?php echo $support; ?></li> 101 <li><?php echo $reviews; ?></li> 102 </ul> 103 </div> 104 <?php 105 } 106 107 108 /** 109 * Return a custom view header string so that get_breadcrumbs will display it. 110 */ 111 public function get_view_header() { 112 $slug = esc_attr( $this->slug ); 113 $description = esc_html__( 'Description', 'wporg-forums' ); 114 $support = esc_html__( 'Support', 'wporg-forums' ); 115 $reviews = esc_html__( 'Reviews', 'wporg-forums' ); 116 117 $header = <<<EOT 118 <ul id="sections"> 119 <li class="section-description"> 120 <a href="//wordpress.org/themes/{$slug}/">{$description}</a> 121 </li> 122 <li class="section-support"> 123 <a href="//wordpress.org/support/theme/{$slug}/">{$support}</a> 124 <li> 125 <li class="section-reviews"> 126 <a href="//wordpress.org/support/theme/{$slug}/reviews/">{$reviews}</a> 127 </li> 128 </ul> 129 EOT; 130 return $header; 121 131 } 122 132 }
Note: See TracChangeset
for help on using the changeset viewer.