PluginProbe
Leaflet Map / 2.10.0
Leaflet Map v2.10.0
3.4.7 3.4.6 trunk 2.10.0 2.10.1 2.11.0 2.11.1 2.11.2 2.11.3 2.11.4 2.11.5 2.12.0 2.13.0 2.14.0 2.15.0 2.16.0 2.16.1 2.16.2 2.17.0 2.17.1 2.17.2 2.17.3 2.18.0 2.19.0 2.19.1 All 49 releases
leaflet-map / shortcodes / class.shortcode.php

class.shortcode.php in Leaflet Map 2.10.0, at shortcodes/class.shortcode.php

42 lines 956 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Abstract Shortcode Class
4 *
5 * Use with add_shortcode('leaflet-map', array('Leaflet_Shortcode', 'shortcode'))
6 * extend and manipulate __construct
7 *
8 * @var array $atts
9 * @var string $content
10 */
11 abstract class Leaflet_Shortcode {
12 protected $LM;
13
14 /**
15 * Generate HTML from the shortcode
16 * Maybe won't always be required
17 * @since 2.8.2
18 * @var array $atts
19 * @var string $content
20 * @return HTML
21 */
22 abstract protected function getHTML($atts='', $content=null);
23
24 public static function getClass () {
25 return function_exists( 'get_called_class' ) ? get_called_class() : __CLASS__;
26 }
27
28 /**
29 * Instantiate class and get HTML for shortcode
30 * @var array $atts
31 * @var string $content
32 */
33 public static function shortcode ($atts, $content = null) {
34 $class = self::getClass();
35 $instance = new $class($atts, $content);
36 return $instance->getHTML($atts, $content);
37 }
38
39 protected function __construct() {
40 $this->LM = Leaflet_Map::init();
41 }
42 }