1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
||
24 | abstract class EES_Shortcode extends EE_Base { |
||
25 | |||
26 | /** |
||
27 | * @protected public |
||
28 | * @var array $_attributes |
||
29 | */ |
||
30 | protected $_attributes = array(); |
||
31 | |||
32 | /** |
||
33 | * run - initial shortcode module setup called during "parse_request" hook by |
||
34 | * \EE_Front_Controller::_initialize_shortcodes() IF this shortcode is going to execute during this request ! |
||
35 | * It may also get called by \EES_Shortcode::fallback_shortcode_processor() if the shortcode is being implemented |
||
36 | * by a theme or plugin in a non-standard way. |
||
37 | * Basically this method is primarily used for loading resources and assets like CSS or JS |
||
38 | * that will be required by the shortcode when it is actually processed. |
||
39 | * Please note that assets may not load if the fallback_shortcode_processor() is being used. |
||
40 | * |
||
41 | * @access public |
||
42 | * @param WP $WP |
||
43 | * @return void |
||
44 | */ |
||
45 | public abstract function run( WP $WP ); |
||
46 | |||
47 | |||
48 | |||
49 | /** |
||
50 | * process_shortcode |
||
51 | * this method is the callback function for the actual shortcode, and is what runs when WP encounters the shortcode within the_content |
||
52 | * |
||
53 | * @access public |
||
54 | * @param array $attributes |
||
55 | * @return mixed |
||
56 | */ |
||
57 | public abstract function process_shortcode( $attributes = array() ); |
||
58 | |||
59 | |||
60 | |||
61 | /** |
||
62 | * instance - returns instance of child class object |
||
63 | * |
||
64 | * @access public |
||
65 | * @param string $shortcode_class |
||
66 | * @return \EES_Shortcode |
||
67 | */ |
||
68 | final public static function instance( $shortcode_class = null ) { |
||
81 | |||
82 | |||
83 | |||
84 | |||
85 | /** |
||
86 | * fallback_shortcode_processor - create instance and call process_shortcode |
||
87 | * NOTE: shortcode may not function perfectly dues to missing assets, but it's better than not having things work at all |
||
88 | * |
||
89 | * @access public |
||
90 | * @param $attributes |
||
91 | * @return mixed |
||
92 | */ |
||
93 | final public static function fallback_shortcode_processor( $attributes ) { |
||
114 | |||
115 | |||
116 | |||
117 | |||
118 | /** |
||
119 | * invalid_shortcode_processor - used in cases where we know the shortcode is invalid, most likely due to a deactivated addon, and simply returns an empty string |
||
120 | * |
||
121 | * @access public |
||
122 | * @param $attributes |
||
123 | * @return string |
||
124 | */ |
||
125 | final public static function invalid_shortcode_processor( $attributes ) { |
||
128 | |||
129 | |||
130 | |||
131 | /** |
||
132 | * class constructor - should ONLY be instantiated by EE_Front_Controller |
||
133 | */ |
||
134 | final public function __construct() { |
||
142 | |||
143 | |||
144 | |||
145 | /** |
||
146 | * @param array $attributes |
||
147 | * @param array $custom_sanitization |
||
148 | * @return array |
||
149 | */ |
||
150 | public static function sanitize_attributes(array $attributes, $custom_sanitization = array()) |
||
187 | |||
188 | |||
189 | } |
||
190 | // End of file EES_Shortcode.shortcode.php |
||
191 | // Location: /shortcodes/EES_Shortcode.shortcode.php |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.