format( 'Y-m-d\TH:i:s.' ), floor( $date->format( 'u' ) / 1000 ), $date->format( 'O' ) ); } /** * Encode to JSON in a way that is also backwards compatible * * @param mixed $data * @param int $options (optional) * @param int $depth (optional) * * @return string */ function wp_stream_json_encode( $data, $options = 0, $depth = 512 ) { if ( function_exists( 'wp_json_encode' ) ) { $json = wp_json_encode( $data, $options, $depth ); } else { // @codingStandardsIgnoreStart if ( version_compare( PHP_VERSION, '5.5', '<' ) ) { $json = json_encode( $data, $options ); } else { $json = json_encode( $data, $options, $depth ); } // @codingStandardsIgnoreEnd } return $json; } /** * Check if Stream is running on WordPress.com VIP * * @return bool */ function wp_stream_is_vip() { return function_exists( 'wpcom_vip_load_plugin' ); } /** * True if native WP Cron is enabled, otherwise false * * @return bool */ function wp_stream_is_cron_enabled() { return ( defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON ) ? false : true; }