| 1 |
<?php |
| 2 |
|
| 3 |
if( ! class_exists( 'wp_mapit_shortcode' ) ) { |
| 4 |
/** |
| 5 |
* Class to manage the shortcodes of the plugins |
| 6 |
*/ |
| 7 |
class wp_mapit_shortcode |
| 8 |
{ |
| 9 |
/** |
| 10 |
* Add hooks and filters for shortcode |
| 11 |
* |
| 12 |
* @since 1.0 |
| 13 |
* @static |
| 14 |
* @access public |
| 15 |
*/ |
| 16 |
public static function init() |
| 17 |
{ |
| 18 |
/* Shortcode to display current page map */ |
| 19 |
add_shortcode( 'wp_mapit', __CLASS__ . '::wp_mapit' ); |
| 20 |
} |
| 21 |
|
| 22 |
/** |
| 23 |
* Hook to handle the shortcode wp_mapit |
| 24 |
* |
| 25 |
* @since 1.0 |
| 26 |
* @static |
| 27 |
* @access public |
| 28 |
* @return string Returns Map markup as string |
| 29 |
*/ |
| 30 |
public static function wp_mapit() { |
| 31 |
if ( wp_mapit_map::has_map() ){ |
| 32 |
return wp_mapit_map::generate_map(); |
| 33 |
} |
| 34 |
} |
| 35 |
} |
| 36 |
|
| 37 |
/** |
| 38 |
* Calling init function to activate hooks and filters. |
| 39 |
*/ |
| 40 |
wp_mapit_shortcode::init(); |
| 41 |
|
| 42 |
} |