1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55:
<?php
class Inbound_Shortcodes_Cookies {
public function __construct() {
self::load_hooks();
}
public function load_hooks() {
add_shortcode( 'inbound-cookie', array( __CLASS__, 'get_cookie' ), 1 );
}
public static function get_cookie( $atts ) {
$value = ( isset($_COOKIE[ $atts['name'] ]) ) ? $_COOKIE[ $atts['name'] ] : '';
return $value;
}
public static function generate_gravitar( $atts ) {
extract( shortcode_atts( array(
'email' => 'default@gravitar.com',
'size' => '60',
'default' => 'mm'
), $atts ) );
return "//www.gravatar.com/avatar/" . md5( strtolower( trim( $email ) ) ) . "?d=" . urlencode( $default ) . "&s=" . $size;
}
}
new Inbound_Shortcodes_Cookies();