Ticket #7437: 7437.diff
File 7437.diff, 2.8 KB (added by , 16 months ago) |
---|
-
class-theme-directory-compat.php
class Theme_Directory_Compat extends Dir 114 114 115 115 return true; 116 116 } 117 117 118 118 public function do_view_sidebar() { 119 119 120 120 $this->do_topic_sidebar(); 121 121 122 122 } 123 123 124 124 public function do_topic_sidebar() { 125 125 if ( ! $this->theme ) { 126 126 return; 127 127 } 128 128 129 $icon = ''; 129 130 $theme = sprintf( '<a href="//wordpress.org/themes/%s/">%s</a>', esc_attr( $this->slug() ), esc_html( $this->theme->post_title ) ); 130 131 $support = sprintf( '<a href="%s">%s</a>', home_url( '/theme/' . esc_attr( $this->slug() ) . '/' ), __( 'Support Threads', 'wporg-forums' ) ); 131 132 $active = sprintf( '<a href="%s">%s</a>', home_url( '/theme/' . esc_attr( $this->slug() ) . '/active/' ), __( 'Active Topics', 'wporg-forums' ) ); 132 133 $unresolved = sprintf( '<a href="%s">%s</a>', home_url( '/theme/' . esc_attr( $this->slug() ) . '/unresolved/' ), __( 'Unresolved Topics', 'wporg-forums' ) ); 133 134 $reviews = sprintf( '<a href="%s">%s</a>', home_url( '/theme/' . esc_attr( $this->slug() ) . '/reviews/' ), __( 'Reviews', 'wporg-forums' ) ); 134 135 $create = ''; 135 136 136 137 $create_label = ''; 137 138 if ( isset( $this->ratings ) && $this->ratings->is_rating_view() && bbp_current_user_can_access_create_topic_form() ) { 138 139 $create_label = $this->ratings->review_exists() ? 139 140 __( 'Edit Review', 'wporg-forums' ) : 140 141 __( 'Add Review', 'wporg-forums' ); 141 142 } elseif ( bbp_is_single_forum() && bbp_current_user_can_access_create_topic_form() ) { 142 143 $create_label = __( 'Create Topic', 'wporg-forums' ); 143 144 } 144 145 if ( $create_label ) { 145 146 $create = sprintf( '<a href="#new-post">%s</a>', $create_label ); 146 147 } 148 149 if ( file_exists( WPORGPATH . 'wp-content/plugins/theme-directory/class-wporg-themes-repo-package.php' ) ) { 150 include_once WPORGPATH . 'wp-content/plugins/theme-directory/class-wporg-themes-repo-package.php'; 151 152 if ( class_exists( 'WPORG_Themes_Repo_Package' ) ) { 153 switch_to_blog( WPORG_THEME_DIRECTORY_BLOGID ); 154 $repo_package = new \WPORG_Themes_Repo_Package( $this->theme->ID ); 155 $icon = $repo_package->screenshot_url(); 156 restore_current_blog(); 157 } 158 } 159 147 160 ?> 148 161 <div> 149 162 <ul> 163 <?php if ( ! empty( $icon ) ) : ?> 164 <li class="theme-meta-icon"><img src="<?php echo esc_url( $icon ); ?>"></li> 165 <?php endif; ?> 150 166 <li><?php echo $theme; ?></li> 151 167 <li><?php echo $support; ?></li> 152 168 <li><?php echo $active; ?></li> 153 169 <li><?php echo $unresolved; ?></li> 154 170 <li><?php echo $reviews; ?></li> 155 171 <?php if ( $create ) : ?> 156 172 <li class="create-topic"><?php echo $create; ?></li> 157 173 <?php endif; ?> 158 174 </ul> 159 175 </div> 160 176 <?php 161 177 } 162 178 163 179 public function do_view_header() { 164 180 }