| 1 |
<?php |
| 2 |
|
| 3 |
if ( ! defined( 'ABSPATH' ) ) { |
| 4 |
exit; |
| 5 |
} |
| 6 |
|
| 7 |
if ( ! class_exists( 'MywpShortcodeAbstractModule' ) ) : |
| 8 |
|
| 9 |
abstract class MywpShortcodeAbstractModule { |
| 10 |
|
| 11 |
protected static $id; |
| 12 |
|
| 13 |
public static function init() { |
| 14 |
|
| 15 |
$class = get_called_class(); |
| 16 |
|
| 17 |
if( empty( static::$id ) ) { |
| 18 |
|
| 19 |
$called_text = sprintf( 'class %s' , $class ); |
| 20 |
|
| 21 |
MywpHelper::error_require_message( '"static protected $id"' , $called_text ); |
| 22 |
|
| 23 |
return false; |
| 24 |
|
| 25 |
} |
| 26 |
|
| 27 |
add_filter( 'mywp_shortcode' , array( $class , 'mywp_shortcode' ) ); |
| 28 |
|
| 29 |
} |
| 30 |
|
| 31 |
public static function mywp_shortcode( $shortcodes ) { |
| 32 |
|
| 33 |
$class = get_called_class(); |
| 34 |
|
| 35 |
$shortcodes[ static::$id ] = array( $class , 'do_shortcode' ); |
| 36 |
|
| 37 |
return $shortcodes; |
| 38 |
|
| 39 |
} |
| 40 |
|
| 41 |
public static function do_shortcode( $atts = false , $content = false , $tag = false ) { |
| 42 |
|
| 43 |
return $content; |
| 44 |
|
| 45 |
} |
| 46 |
|
| 47 |
} |
| 48 |
|
| 49 |
endif; |
| 50 |
|