PluginProbe
CoolClock / 4.1
CoolClock v4.1
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 +18 -46 4.24.1 View file →
@@ -5,33 +5,36 @@
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 if ( is_feed() )
12 11 return '';
13 12
14 13 $atts = shortcode_atts( array_merge( CoolClock::$defaults, CoolClock::$advanced_defaults ), $atts, 'coolclock' );
15 14
16 - /**
17 - * 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'.
18 - * If the Advanced extension is activated, there is also 'minimal' available.
19 - * radius A number to define the clock radius. Do not add 'px' or any other measure descriptor.
20 - * noseconds Set to true (or 1) to hide the second hand
21 - * gmtoffset A number to define a timezone relative the Greenwhich Mean Time. Do not set this parameter to default to local time.
22 - * showdigital Set to 'digital12' to show the time in 12h digital format (with am/pm) too
23 - * digitalcolor Set to a color value to change the digital time color
24 - * scale Must be one of these: 'linear' (default scale), 'logClock' or 'logClockRev'. Linear is our normal clock scale, the other two show a logarithmic time scale
25 - * subtext Optional text, centered below the clock
26 - * align Sets floating of the clock: 'left', 'right' or 'center'
15 + // TODO user input (attributes) validation here !!
16 + /*
17 + 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'. If the Advanced extension is activated, there is also 'minimal' available. Please note that these names are case sensitive.
18 + radius -- a number to define the clock radius. Do not add 'px' or any other measure descriptor.
19 + noseconds -- set to true (or 1) to hide the second hand
20 + gmtoffset -- a number to define a timezone relative the Greenwhich Mean Time. Do not set this parameter to default to local time.
21 + showdigital -- set to 'digital12' to show the time in 12h digital format (with am/pm) too
22 + digitalcolor -- set to a color value to change the digital time color
23 + scale -- must be one of these: 'linear' (default scale), 'logClock' or 'logClockRev'. Linear is our normal clock scale, the other two show a logarithmic time scale
24 + subtext -- optional text, centered below the clock
25 + align -- sets floating of the clock: 'left', 'right' or 'center'
27 26 */
28 27
29 28 // set footer script flags
30 29 CoolClock::$add_script = true;
31 30
32 - $atts['skin'] = !empty($atts['skin']) ? self::parse_skin( $atts['skin'], $content ) : CoolClock::$defauls['skin'];
31 + if ( !isset( $atts['skin'] ) )
32 + $atts['skin'] = CoolClock::$defaults['skin'];
33 33
34 + if ( in_array( $atts['skin'], CoolClock::$more_skins ) )
35 + CoolClock::$add_moreskins = true;
36 +
34 37 // get output
35 38 $output = CoolClock::canvas( $atts );
36 39
37 40 return apply_filters( 'coolclock_shortcode_advanced', $output, $atts, $content );
@@ -36,40 +39,9 @@
36 39
37 40 return apply_filters( 'coolclock_shortcode_advanced', $output, $atts, $content );
38 41 }
39 42
40 - private static function parse_skin( $skin_name, $content )
41 - {
42 - // look trhough the default skins first
43 - foreach ( CoolClock::$default_skins as $skin ) {
44 - if ( strtolower($skin_name) == strtolower($skin) )
45 - // return the matching skin
46 - return $skin;
47 - }
48 -
49 - // still here? then search in the $more_skins array
50 - foreach ( CoolClock::$more_skins as $skin ) {
51 - if ( strtolower($skin_name) == strtolower($skin) ) {
52 - // set more_skins flag
53 - CoolClock::$add_moreskins = true;
54 - // return the matching skin
55 - return $skin;
56 - }
57 - }
58 -
59 - // still here? then skin is a custom skin
60 -
61 - // add custom skin parameters to the advanced skins array
62 - if ( !in_array( $skin_name, CoolClock::$advanced_skins ) && !empty( $content ) ) {
63 - CoolClock::$advanced_skins[] = $skin_name;
64 - CoolClock::$advanced_skins_config[$skin_name] = wp_strip_all_tags( $content, true );
65 - }
66 -
67 - return $skin_name;
68 - }
69 -
70 - public static function no_wptexturize( $shortcodes )
71 - {
43 + public static function no_wptexturize($shortcodes) {
72 44 $shortcodes[] = 'coolclock';
73 45 return $shortcodes;
74 46 }
75 47