PluginProbe
My WP Customize Admin/Frontend / 1.16
My WP Customize Admin/Frontend v1.16
1.27.4 1.27.3 trunk 1.0 1.1 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.10 1.10.1 1.10.2 1.11 1.12 1.12.1 1.12.2 1.13 1.13.1 1.13.2 1.14 1.15.0 1.16 1.17.0 All 76 releases
my-wp / shortcode / abstract.shortcode.module.php

abstract.shortcode.module.php in My WP Customize Admin/Frontend 1.16, at shortcode/abstract.shortcode.module.php

72 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 if ( ! defined( 'ABSPATH' ) ) {
4 exit;
5 }
6
7 if ( ! class_exists( 'MywpShortcodeAbstractModule' ) ) :
8
9 abstract class MywpShortcodeAbstractModule {
10
11 private static $instance;
12
13 protected static $id;
14
15 private function __construct() {}
16
17 public static function get_instance() {
18
19 $class = get_called_class();
20
21 if ( !isset( self::$instance[ $class ] ) ) {
22
23 self::$instance[ $class ] = new static();
24
25 }
26
27 return self::$instance[ $class ];
28
29 }
30
31 private function __clone() {}
32
33 private function __wakeup() {}
34
35 public static function init() {
36
37 $class = get_called_class();
38
39 if( empty( static::$id ) ) {
40
41 $called_text = sprintf( 'class %s' , $class );
42
43 MywpHelper::error_require_message( '"static protected $id"' , $called_text );
44
45 return false;
46
47 }
48
49 add_filter( 'mywp_shortcode' , array( $class , 'mywp_shortcode' ) );
50
51 }
52
53 public static function mywp_shortcode( $shortcodes ) {
54
55 $class = get_called_class();
56
57 $shortcodes[ static::$id ] = array( $class , 'do_shortcode' );
58
59 return $shortcodes;
60
61 }
62
63 public static function do_shortcode( $atts , $content = false , $tag ) {
64
65 return $content;
66
67 }
68
69 }
70
71 endif;
72