| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* CoolClock Shortcode Class |
| 5 |
*/ |
| 6 |
|
| 7 |
class CoolClock_Shortcode { |
| 8 |
|
| 9 |
public static function handle_shortcode( $atts, $content = null ) { |
| 10 |
if ( is_feed() ) |
| 11 |
return ''; |
| 12 |
|
| 13 |
$atts = shortcode_atts( array_merge( CoolClock::$defaults, CoolClock::$advanced_defaults ), $atts, 'coolclock' ); |
| 14 |
|
| 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 |
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 |
| 23 |
subtext -- optional text, centered below the clock |
| 24 |
align -- sets floating of the clock: 'left', 'right' or 'center' |
| 25 |
*/ |
| 26 |
|
| 27 |
// set footer script flags |
| 28 |
CoolClock::$add_script = true; |
| 29 |
|
| 30 |
if ( !isset( $atts['skin'] ) ) |
| 31 |
$atts['skin'] = CoolClock::$defaults['skin']; |
| 32 |
|
| 33 |
if ( in_array( $atts['skin'], CoolClock::$more_skins ) ) |
| 34 |
CoolClock::$add_moreskins = true; |
| 35 |
|
| 36 |
// get output |
| 37 |
$output = CoolClock::canvas( $atts ); |
| 38 |
|
| 39 |
return apply_filters( 'coolclock_shortcode_advanced', $output, $atts, $content ); |
| 40 |
} |
| 41 |
|
| 42 |
public static function no_wptexturize($shortcodes) { |
| 43 |
$shortcodes[] = 'coolclock'; |
| 44 |
return $shortcodes; |
| 45 |
} |
| 46 |
|
| 47 |
} |
| 48 |
|