| Conditions | 2 |
| Paths | 2 |
| Total Lines | 15 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 12 | public static function shortcode( $atts = array() ) { |
||
| 13 | jetpack_require_lib( 'icalendar-reader' ); |
||
| 14 | $atts = shortcode_atts( array( 'url' => '', 'number' => 0 ), $atts, 'upcomingevents' ); |
||
| 15 | $args = array( |
||
| 16 | 'context' => 'shortcode', |
||
| 17 | 'number' => absint( $atts['number'] ), |
||
| 18 | ); |
||
| 19 | $events = icalendar_render_events( $atts['url'], $args ); |
||
| 20 | |||
| 21 | if ( ! $events ) { |
||
|
|
|||
| 22 | $events = sprintf( '<p>%s</p>', __( 'No upcoming events', 'jetpack' ) ); |
||
| 23 | } |
||
| 24 | |||
| 25 | return $events; |
||
| 26 | } |
||
| 27 | } |
||
| 30 |
In PHP, under loose comparison (like
==, or!=, orswitchconditions), values of different types might be equal.For
stringvalues, the empty string''is a special case, in particular the following results might be unexpected: