1 | <?php |
||
16 | class Sensei_Shortcode_Loader{ |
||
17 | |||
18 | /** |
||
19 | * @var array { |
||
20 | * type string $shortcode |
||
21 | * type Sensei_Shortcode |
||
22 | * } all the shortcodes and which class to instantiate when they are called from |
||
23 | * WordPress's do_shortcode() function. |
||
24 | * |
||
25 | */ |
||
26 | protected $shortcode_classes; |
||
27 | |||
28 | /** |
||
29 | * Run all the functions that needs to be hooked into WordPress |
||
30 | * |
||
31 | * @since 1.9.0 |
||
32 | */ |
||
33 | public function __construct(){ |
||
47 | |||
48 | /** |
||
49 | * Array of shortcode classes that should be instantiated when WordPress loads |
||
50 | * a Sensei specific shortcode. |
||
51 | * This list contains: |
||
52 | * $shortcode => $class_name |
||
53 | * |
||
54 | * $shortcode is the actual shortcode the user will add to the editor |
||
55 | * $class_name is the name of the class that will be instantiated to handle |
||
56 | * the rendering of the shortcode. |
||
57 | * |
||
58 | * NOTE: When adding a new shortcode here be sure to load your shortcodes class |
||
59 | * in class-sensei-autoloader class_file_map function |
||
60 | */ |
||
61 | public function setup_shortcode_class_map(){ |
||
79 | |||
80 | /** |
||
81 | * Add all shortcodes here |
||
82 | * |
||
83 | * This function adds shortcodes to WP that links to other functionality. |
||
84 | * @since 1.9.0 |
||
85 | */ |
||
86 | public function initialize_shortcodes(){ |
||
109 | |||
110 | /** |
||
111 | * Respond to WordPress do_shortcode calls |
||
112 | * for shortcodes registered in the initialize_shortcodes function. |
||
113 | * |
||
114 | * @since 1.9.0 |
||
115 | * |
||
116 | * @param $attributes |
||
117 | * @param $content |
||
118 | * @param $code the shortcode that is being requested |
||
119 | * |
||
120 | * @return string |
||
121 | */ |
||
122 | public function render_shortcode( $attributes='', $content='', $code ){ |
||
145 | |||
146 | /** |
||
147 | * Add the Sensei body class if |
||
148 | * the current page has a Sensei shortcode. |
||
149 | * |
||
150 | * Note: legacy shortcodes not supported here. |
||
151 | * |
||
152 | * @since 1.9.0 |
||
153 | * |
||
154 | * @param array $classes |
||
155 | * @return array |
||
156 | */ |
||
157 | public function possibly_add_body_class ( $classes ) { |
||
184 | |||
185 | } // end class Sensei_Shortcodes |
||
186 | new Sensei_Shortcode_Loader(); |
||
187 |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.