PluginProbe
CoolClock / 4.3.9
CoolClock v4.3.9
4.3.9 4.3.8 trunk 0.1 2.0 2.9.8 3.0 3.1 3.2 3.3 4.0 4.1 4.2 4.3.3 4.3.4 4.3.5 4.3.6 4.3.7
← All changes | includes/class-coolclock-shortcode.php +12 -10 4.3.64.3.9 View file →
@@ -5,10 +5,9 @@
5 5 */
6 6
7 7 class CoolClock_Shortcode {
8 8
9 - public static function handle_shortcode( $atts, $content = null )
10 - {
9 + public static function handle_shortcode( $atts, $content = null ) {
11 10 /**
12 11 * skin Must be one of these: 'swissRail' (default skin), 'chunkySwiss', 'chunkySwissOnBlack', 'fancy', 'machine', 'simonbaird_com', 'classic', 'modern', 'simple', 'securephp', 'Tes2', 'Lev', 'Sand', 'Sun', 'Tor', 'Cold', 'Babosa', 'Tumb', 'Stone', 'Disc', 'watermelon' or 'mister'.
13 12 * If the Advanced extension is activated, there is also 'minimal' available.
14 13 * radius A number to define the clock radius. Do not add 'px' or any other measure descriptor.
@@ -20,17 +19,18 @@
20 19 * subtext Optional text, centered below the clock
21 20 * align Sets floating of the clock: 'left', 'right' or 'center'
22 21 */
23 22
24 - if ( is_feed() )
23 + if ( is_feed() ) {
25 24 return '';
25 + }
26 26
27 27 // set empty parameter noseconds to default
28 - if ( in_array( 'noseconds', $atts, true ) && ! array_key_exists( 'noseconds', $atts ) ) {
28 + if ( ! empty( $atts ) && in_array( 'noseconds', $atts, true ) && ! array_key_exists( 'noseconds', $atts ) ) {
29 29 $atts['noseconds'] = true;
30 30 }
31 31 // set empty parameter showdigital to default
32 - if ( in_array( 'showdigital', $atts, true ) && ! array_key_exists( 'showdigital', $atts ) ) {
32 + if ( ! empty( $atts ) && in_array( 'showdigital', $atts, true ) && ! array_key_exists( 'showdigital', $atts ) ) {
33 33 $atts['showdigital'] = 'digital12';
34 34 }
35 35
36 36 // filter shortcode attributes
@@ -37,10 +37,11 @@
37 37 $defaults = array_merge( CoolClock::$defaults, CoolClock::$advanced_defaults );
38 38 $atts = shortcode_atts( $defaults, $atts, 'coolclock' );
39 39
40 40 // sanitize user input
41 - if ( $content )
41 + if ( $content ) {
42 42 $content = wp_strip_all_tags( $content );
43 + }
43 44
44 45 // backward compat fontcolor
45 46 if ( !empty( $atts['digitalcolor'] ) && empty($atts['fontcolor']) ) {
46 47 $atts['fontcolor'] = $atts['digitalcolor'];
@@ -46,12 +47,14 @@
46 47 $atts['fontcolor'] = $atts['digitalcolor'];
47 48 }
48 49
49 50 // pre-treat possible empty attributes
50 - if ( is_int( array_search( 'noseconds', $atts ) ) )
51 + if ( is_int( array_search( 'noseconds', $atts ) ) ) {
51 52 $atts['noseconds'] = true;
52 - if ( is_int( array_search( 'showdigital', $atts ) ) )
53 + }
54 + if ( is_int( array_search( 'showdigital', $atts ) ) ) {
53 55 $atts['showdigital'] = 'digital12';
56 + }
54 57
55 58 // parse skin
56 59 $atts['skin'] = CoolClock::parse_skin( $atts['skin'], $content );
57 60
@@ -115,10 +118,9 @@
115 118 // Return filtered output
116 119 return apply_filters( 'coolclock_shortcode', $output, $atts, $content );
117 120 }
118 121
119 - public static function no_wptexturize( $shortcodes )
120 - {
122 + public static function no_wptexturize( $shortcodes ) {
121 123 $shortcodes[] = 'coolclock';
122 124 return $shortcodes;
123 125 }
124 126