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 +19 -8 4.3.54.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,18 +19,29 @@
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 + // set empty parameter noseconds to default
28 + if ( ! empty( $atts ) && in_array( 'noseconds', $atts, true ) && ! array_key_exists( 'noseconds', $atts ) ) {
29 + $atts['noseconds'] = true;
30 + }
31 + // set empty parameter showdigital to default
32 + if ( ! empty( $atts ) && in_array( 'showdigital', $atts, true ) && ! array_key_exists( 'showdigital', $atts ) ) {
33 + $atts['showdigital'] = 'digital12';
34 + }
35 +
27 36 // filter shortcode attributes
28 37 $defaults = array_merge( CoolClock::$defaults, CoolClock::$advanced_defaults );
29 38 $atts = shortcode_atts( $defaults, $atts, 'coolclock' );
30 39
31 40 // sanitize user input
32 - if ( $content )
41 + if ( $content ) {
33 42 $content = wp_strip_all_tags( $content );
43 + }
34 44
35 45 // backward compat fontcolor
36 46 if ( !empty( $atts['digitalcolor'] ) && empty($atts['fontcolor']) ) {
37 47 $atts['fontcolor'] = $atts['digitalcolor'];
@@ -37,12 +47,14 @@
37 47 $atts['fontcolor'] = $atts['digitalcolor'];
38 48 }
39 49
40 50 // pre-treat possible empty attributes
41 - if ( is_int( array_search( 'noseconds', $atts ) ) )
51 + if ( is_int( array_search( 'noseconds', $atts ) ) ) {
42 52 $atts['noseconds'] = true;
43 - if ( is_int( array_search( 'showdigital', $atts ) ) )
53 + }
54 + if ( is_int( array_search( 'showdigital', $atts ) ) ) {
44 55 $atts['showdigital'] = 'digital12';
56 + }
45 57
46 58 // parse skin
47 59 $atts['skin'] = CoolClock::parse_skin( $atts['skin'], $content );
48 60
@@ -106,10 +118,9 @@
106 118 // Return filtered output
107 119 return apply_filters( 'coolclock_shortcode', $output, $atts, $content );
108 120 }
109 121
110 - public static function no_wptexturize( $shortcodes )
111 - {
122 + public static function no_wptexturize( $shortcodes ) {
112 123 $shortcodes[] = 'coolclock';
113 124 return $shortcodes;
114 125 }
115 126