Making WordPress.org


Ignore:
Timestamp:
02/28/2017 12:35:50 AM (8 years ago)
Author:
iandunn
Message:

WordPress.tv: Add extra stats and define bump_stats_extras() stub

The stub is cleaner than always adding function_exists() checks when calling the function.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.tv/public_html/wp-content/themes/wptv2/functions.php

    r4220 r5015  
    682682        }
    683683
    684         // Make it easier to contribute to this theme by not assuming WP.com context.
    685         if ( function_exists( 'bump_stats_extras' ) ) {
    686             bump_stats_extras( 'wptv-activity', 'publish-video' );
    687         }
     684        bump_stats_extras( 'wptv-activity', 'publish-video' );
    688685    }
    689686}
     
    853850    return $username_exists;
    854851}
     852
     853if ( ! function_exists( 'bump_stats_extras' ) ) {
     854    /**
     855     * Define a stub for `bump_stats_extras()`
     856     *
     857     * This function only exists on WordPress.com, so we need a stub to prevent fatal `undefined function` errors
     858     * in the Meta Environment and other local dev environments.
     859     *
     860     * @param string $name
     861     * @param string $value
     862     * @param int    $num
     863     * @param bool   $today
     864     * @param bool   $hour
     865     */
     866    function bump_stats_extras( $name, $value, $num = 1, $today = false, $hour = false ) {
     867        // This is intentionally empty
     868    }
     869}
Note: See TracChangeset for help on using the changeset viewer.