Changeset 4297
- Timestamp:
- 10/26/2016 10:39:43 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-directory-compat.php
r4235 r4297 650 650 } 651 651 652 return self::get_object_by_slug_and_type( $slug, $this->compat() ); 653 } 654 655 /** 656 * Get and cache object based on slug and type (plugin or theme). 657 * 658 * Suitable for use outside of the class. 659 * 660 * @param string $slug The object slug. 661 * @param string $type The type of the object. Either 'plugin' or 'theme'. 662 * @return array 663 */ 664 public static function get_object_by_slug_and_type( $slug, $type ) { 665 global $wpdb; 666 652 667 // Check the cache. 653 668 $cache_key = $slug; 654 $cache_group = $t his->compat(). '-objects';669 $cache_group = $type . '-objects'; 655 670 $compat_object = wp_cache_get( $cache_key, $cache_group ); 656 671 if ( false === $compat_object ) { 657 672 658 673 // Get the object information from the correct table. 659 if ( $t his->compat()== 'theme' ) {674 if ( $type == 'theme' ) { 660 675 $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 ) ); 661 } elseif ( $t his->compat()== 'plugin' ) {676 } elseif ( $type == 'plugin' ) { 662 677 // @todo Update this when the Plugin Directory switches over to WordPress. 663 678 $_compat_topic = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM " . PLUGINS_TABLE_PREFIX . "topics WHERE topic_slug = %s", $slug ) );
Note: See TracChangeset
for help on using the changeset viewer.