Making WordPress.org


Ignore:
Timestamp:
01/10/2017 10:13:25 PM (8 years ago)
Author:
dd32
Message:

Plugin Directory: Add default meta fallback values where needed to avoid PHP warnings.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-template.php

    r4514 r4622  
    2020    public static function active_installs( $full = true, $post = null ) {
    2121        $post  = get_post( $post );
    22         $count = get_post_meta( $post->ID, 'active_installs', true );
     22        $count = get_post_meta( $post->ID, 'active_installs', true ) ?: 0;
    2323
    2424        if ( $count <= 10 ) {
     
    131131        }
    132132
    133         $raw_sections = get_post_meta( $plugin->ID, 'sections', true );
     133        $raw_sections = get_post_meta( $plugin->ID, 'sections', true ) ?: array();
    134134        $raw_sections = array_unique( array_merge( $raw_sections, $default_sections ) );
    135135
     
    216216    public static function get_plugin_icon( $post = null, $output = 'raw' ) {
    217217        $plugin    = get_post( $post );
    218         $raw_icons = get_post_meta( $plugin->ID, 'assets_icons', true );
     218        $raw_icons = get_post_meta( $plugin->ID, 'assets_icons', true ) ?: array();
    219219
    220220        $icon = $icon_2x = $svg = $generated = false;
     
    295295
    296296        $banner      = $banner_2x = false;
    297         $raw_banners = get_post_meta( $plugin->ID, 'assets_banners', true );
     297        $raw_banners = get_post_meta( $plugin->ID, 'assets_banners', true ) ?: array();
    298298
    299299        // Split in rtl and non-rtl banners.
     
    449449
    450450        if ( 'latest' == $version || 'latest-stable' == $version ) {
    451             $version = get_post_meta( $post->ID, 'stable_tag', true );
     451            $version = get_post_meta( $post->ID, 'stable_tag', true ) ?: 'trunk';
    452452        }
    453453
Note: See TracChangeset for help on using the changeset viewer.