@@ -21,413 +21,413 @@ |
||
| 21 | 21 | class LegacyShortcodesManager |
| 22 | 22 | { |
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * @var EE_Registry $registry |
|
| 26 | - */ |
|
| 27 | - private $registry; |
|
| 28 | - |
|
| 29 | - |
|
| 30 | - /** |
|
| 31 | - * LegacyShortcodesManager constructor. |
|
| 32 | - * |
|
| 33 | - * @param \EE_Registry $registry |
|
| 34 | - */ |
|
| 35 | - public function __construct(EE_Registry $registry) |
|
| 36 | - { |
|
| 37 | - $this->registry = $registry; |
|
| 38 | - } |
|
| 39 | - |
|
| 40 | - |
|
| 41 | - /** |
|
| 42 | - * @return EE_Registry |
|
| 43 | - */ |
|
| 44 | - public function registry() |
|
| 45 | - { |
|
| 46 | - return $this->registry; |
|
| 47 | - } |
|
| 48 | - |
|
| 49 | - |
|
| 50 | - /** |
|
| 51 | - * registerShortcodes |
|
| 52 | - * |
|
| 53 | - * @return void |
|
| 54 | - */ |
|
| 55 | - public function registerShortcodes() |
|
| 56 | - { |
|
| 57 | - $this->registry->shortcodes = $this->getShortcodes(); |
|
| 58 | - } |
|
| 59 | - |
|
| 60 | - |
|
| 61 | - /** |
|
| 62 | - * getShortcodes |
|
| 63 | - * |
|
| 64 | - * @return array |
|
| 65 | - */ |
|
| 66 | - public function getShortcodes() |
|
| 67 | - { |
|
| 68 | - // previously this method would glob the shortcodes directory |
|
| 69 | - // then filter that list of shortcodes to register, |
|
| 70 | - // but now we are going to just supply an empty array. |
|
| 71 | - // this allows any shortcodes that have not yet been converted to the new system |
|
| 72 | - // to still get loaded and processed, albeit using the same legacy logic as before |
|
| 73 | - $shortcodes_to_register = apply_filters( |
|
| 74 | - 'FHEE__EE_Config__register_shortcodes__shortcodes_to_register', |
|
| 75 | - array() |
|
| 76 | - ); |
|
| 77 | - if (! empty($shortcodes_to_register)) { |
|
| 78 | - // cycle thru shortcode folders |
|
| 79 | - foreach ($shortcodes_to_register as $shortcode_path) { |
|
| 80 | - // add to list of installed shortcode modules |
|
| 81 | - $this->registerShortcode($shortcode_path); |
|
| 82 | - } |
|
| 83 | - } |
|
| 84 | - // filter list of installed modules |
|
| 85 | - return apply_filters( |
|
| 86 | - 'FHEE__EE_Config___register_shortcodes__installed_shortcodes', |
|
| 87 | - ! empty($this->registry->shortcodes) |
|
| 88 | - ? $this->registry->shortcodes |
|
| 89 | - : array() |
|
| 90 | - ); |
|
| 91 | - } |
|
| 92 | - |
|
| 93 | - |
|
| 94 | - /** |
|
| 95 | - * register_shortcode - makes core aware of this shortcode |
|
| 96 | - * |
|
| 97 | - * @access public |
|
| 98 | - * @param string $shortcode_path - full path up to and including shortcode folder |
|
| 99 | - * @return bool |
|
| 100 | - */ |
|
| 101 | - public function registerShortcode($shortcode_path = null) |
|
| 102 | - { |
|
| 103 | - do_action('AHEE__EE_Config__register_shortcode__begin', $shortcode_path); |
|
| 104 | - $shortcode_ext = '.shortcode.php'; |
|
| 105 | - // make all separators match |
|
| 106 | - $shortcode_path = str_replace(array('\\', '/'), '/', $shortcode_path); |
|
| 107 | - // does the file path INCLUDE the actual file name as part of the path ? |
|
| 108 | - if (strpos($shortcode_path, $shortcode_ext) !== false) { |
|
| 109 | - // grab shortcode file name from directory name and break apart at dots |
|
| 110 | - $shortcode_file = explode('.', basename($shortcode_path)); |
|
| 111 | - // take first segment from file name pieces and remove class prefix if it exists |
|
| 112 | - $shortcode = strpos($shortcode_file[0], 'EES_') === 0 |
|
| 113 | - ? substr($shortcode_file[0], 4) |
|
| 114 | - : $shortcode_file[0]; |
|
| 115 | - // sanitize shortcode directory name |
|
| 116 | - $shortcode = sanitize_key($shortcode); |
|
| 117 | - // now we need to rebuild the shortcode path |
|
| 118 | - $shortcode_path = explode('/', $shortcode_path); |
|
| 119 | - // remove last segment |
|
| 120 | - array_pop($shortcode_path); |
|
| 121 | - // glue it back together |
|
| 122 | - $shortcode_path = implode('/', $shortcode_path) . '/'; |
|
| 123 | - } else { |
|
| 124 | - // we need to generate the filename based off of the folder name |
|
| 125 | - // grab and sanitize shortcode directory name |
|
| 126 | - $shortcode = sanitize_key(basename($shortcode_path)); |
|
| 127 | - $shortcode_path = rtrim($shortcode_path, '/') . '/'; |
|
| 128 | - } |
|
| 129 | - // create classname from shortcode directory or file name |
|
| 130 | - $shortcode = str_replace(' ', '_', ucwords(str_replace('_', ' ', $shortcode))); |
|
| 131 | - // add class prefix |
|
| 132 | - $shortcode_class = 'EES_' . $shortcode; |
|
| 133 | - // does the shortcode exist ? |
|
| 134 | - if (! is_readable($shortcode_path . '/' . $shortcode_class . $shortcode_ext)) { |
|
| 135 | - $msg = sprintf( |
|
| 136 | - esc_html__( |
|
| 137 | - 'The requested %1$s shortcode file could not be found or is not readable due to file permissions. It should be in %2$s', |
|
| 138 | - 'event_espresso' |
|
| 139 | - ), |
|
| 140 | - $shortcode_class, |
|
| 141 | - $shortcode_path . '/' . $shortcode_class . $shortcode_ext |
|
| 142 | - ); |
|
| 143 | - EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 144 | - return false; |
|
| 145 | - } |
|
| 146 | - // load the shortcode class file |
|
| 147 | - require_once($shortcode_path . $shortcode_class . $shortcode_ext); |
|
| 148 | - // verify that class exists |
|
| 149 | - if (! class_exists($shortcode_class)) { |
|
| 150 | - $msg = sprintf( |
|
| 151 | - esc_html__('The requested %s shortcode class does not exist.', 'event_espresso'), |
|
| 152 | - $shortcode_class |
|
| 153 | - ); |
|
| 154 | - EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 155 | - return false; |
|
| 156 | - } |
|
| 157 | - $shortcode = strtoupper($shortcode); |
|
| 158 | - // add to array of registered shortcodes |
|
| 159 | - $this->registry->shortcodes->{$shortcode} = $shortcode_path . $shortcode_class . $shortcode_ext; |
|
| 160 | - return true; |
|
| 161 | - } |
|
| 162 | - |
|
| 163 | - |
|
| 164 | - /** |
|
| 165 | - * _initialize_shortcodes |
|
| 166 | - * allow shortcodes to set hooks for the rest of the system |
|
| 167 | - * |
|
| 168 | - * @access private |
|
| 169 | - * @return void |
|
| 170 | - */ |
|
| 171 | - public function addShortcodes() |
|
| 172 | - { |
|
| 173 | - // cycle thru shortcode folders |
|
| 174 | - foreach ($this->registry->shortcodes as $shortcode => $shortcode_path) { |
|
| 175 | - // add class prefix |
|
| 176 | - $shortcode_class = 'EES_' . $shortcode; |
|
| 177 | - // fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system |
|
| 178 | - // which set hooks ? |
|
| 179 | - if (is_admin()) { |
|
| 180 | - // fire immediately |
|
| 181 | - call_user_func(array($shortcode_class, 'set_hooks_admin')); |
|
| 182 | - } else { |
|
| 183 | - // delay until other systems are online |
|
| 184 | - add_action( |
|
| 185 | - 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', |
|
| 186 | - array($shortcode_class, 'set_hooks') |
|
| 187 | - ); |
|
| 188 | - // convert classname to UPPERCASE and create WP shortcode. |
|
| 189 | - $shortcode_tag = strtoupper($shortcode); |
|
| 190 | - // but first check if the shortcode has already |
|
| 191 | - // been added before assigning 'fallback_shortcode_processor' |
|
| 192 | - if (! shortcode_exists($shortcode_tag)) { |
|
| 193 | - // NOTE: this shortcode declaration will get overridden if the shortcode |
|
| 194 | - // is successfully detected in the post content in initializeShortcode() |
|
| 195 | - add_shortcode($shortcode_tag, array($shortcode_class, 'fallback_shortcode_processor')); |
|
| 196 | - } |
|
| 197 | - } |
|
| 198 | - } |
|
| 199 | - } |
|
| 200 | - |
|
| 201 | - |
|
| 202 | - /** |
|
| 203 | - * callback for the WP "get_header" hook point |
|
| 204 | - * checks posts for EE shortcodes, and initializes them, |
|
| 205 | - * then toggles filter switch that loads core default assets |
|
| 206 | - * |
|
| 207 | - * @param \WP_Query $wp_query |
|
| 208 | - * @return void |
|
| 209 | - */ |
|
| 210 | - public function initializeShortcodes(WP_Query $wp_query) |
|
| 211 | - { |
|
| 212 | - if (empty($this->registry->shortcodes) |
|
| 213 | - || defined('EE_TESTS_DIR') |
|
| 214 | - || ! $wp_query->is_main_query() |
|
| 215 | - || is_admin() |
|
| 216 | - ) { |
|
| 217 | - return; |
|
| 218 | - } |
|
| 219 | - global $wp; |
|
| 220 | - /** @var EE_Front_controller $Front_Controller */ |
|
| 221 | - $Front_Controller = $this->registry->load_core('Front_Controller', array(), false); |
|
| 222 | - do_action('AHEE__EE_Front_Controller__initialize_shortcodes__begin', $wp, $Front_Controller); |
|
| 223 | - $Front_Controller->Request_Handler()->set_request_vars(); |
|
| 224 | - // grab post_name from request |
|
| 225 | - $current_post = apply_filters( |
|
| 226 | - 'FHEE__EE_Front_Controller__initialize_shortcodes__current_post_name', |
|
| 227 | - $Front_Controller->Request_Handler()->get('post_name') |
|
| 228 | - ); |
|
| 229 | - $show_on_front = get_option('show_on_front'); |
|
| 230 | - // if it's not set, then check if frontpage is blog |
|
| 231 | - if (empty($current_post)) { |
|
| 232 | - // yup.. this is the posts page, prepare to load all shortcode modules |
|
| 233 | - $current_post = 'posts'; |
|
| 234 | - // unless.. |
|
| 235 | - if ($show_on_front === 'page') { |
|
| 236 | - // some other page is set as the homepage |
|
| 237 | - $page_on_front = get_option('page_on_front'); |
|
| 238 | - if ($page_on_front) { |
|
| 239 | - // k now we need to find the post_name for this page |
|
| 240 | - global $wpdb; |
|
| 241 | - $page_on_front = $wpdb->get_var( |
|
| 242 | - $wpdb->prepare( |
|
| 243 | - "SELECT post_name from {$wpdb->posts} WHERE post_type='page' AND post_status NOT IN ('auto-draft', 'inherit', 'trash') AND ID=%d", |
|
| 244 | - $page_on_front |
|
| 245 | - ) |
|
| 246 | - ); |
|
| 247 | - // set the current post slug to what it actually is |
|
| 248 | - $current_post = $page_on_front ? $page_on_front : $current_post; |
|
| 249 | - } |
|
| 250 | - } |
|
| 251 | - } |
|
| 252 | - // in case $current_post is hierarchical like: /parent-page/current-page |
|
| 253 | - $current_post = basename($current_post); |
|
| 254 | - if (// is current page/post the "blog" page ? |
|
| 255 | - $current_post === EE_Config::get_page_for_posts() |
|
| 256 | - // or are we on a category page? |
|
| 257 | - || ( |
|
| 258 | - is_array(term_exists($current_post, 'category')) |
|
| 259 | - || array_key_exists('category_name', $wp->query_vars) |
|
| 260 | - ) |
|
| 261 | - ) { |
|
| 262 | - // initialize all legacy shortcodes |
|
| 263 | - $load_assets = $this->parseContentForShortcodes('', true); |
|
| 264 | - } else { |
|
| 265 | - global $wpdb; |
|
| 266 | - $post_content = $wpdb->get_var( |
|
| 267 | - $wpdb->prepare( |
|
| 268 | - "SELECT post_content from {$wpdb->posts} WHERE post_status NOT IN ('auto-draft', 'inherit', 'trash') AND post_name=%s", |
|
| 269 | - $current_post |
|
| 270 | - ) |
|
| 271 | - ); |
|
| 272 | - $load_assets = $this->parseContentForShortcodes($post_content); |
|
| 273 | - } |
|
| 274 | - if ($load_assets) { |
|
| 275 | - $this->registry->REQ->set_espresso_page(true); |
|
| 276 | - add_filter('FHEE_load_css', '__return_true'); |
|
| 277 | - add_filter('FHEE_load_js', '__return_true'); |
|
| 278 | - } |
|
| 279 | - do_action('AHEE__EE_Front_Controller__initialize_shortcodes__end', $Front_Controller); |
|
| 280 | - } |
|
| 281 | - |
|
| 282 | - |
|
| 283 | - /** |
|
| 284 | - * checks supplied content against list of legacy shortcodes, |
|
| 285 | - * then initializes any found shortcodes, and returns true. |
|
| 286 | - * returns false if no shortcodes found. |
|
| 287 | - * |
|
| 288 | - * @param string $content |
|
| 289 | - * @param bool $load_all if true, then ALL active legacy shortcodes will be initialized |
|
| 290 | - * @return bool |
|
| 291 | - */ |
|
| 292 | - public function parseContentForShortcodes($content = '', $load_all = false) |
|
| 293 | - { |
|
| 294 | - $has_shortcode = false; |
|
| 295 | - foreach ($this->registry->shortcodes as $shortcode_class => $shortcode) { |
|
| 296 | - if ($load_all || has_shortcode($content, $shortcode_class)) { |
|
| 297 | - // load up the shortcode |
|
| 298 | - $this->initializeShortcode($shortcode_class); |
|
| 299 | - $has_shortcode = true; |
|
| 300 | - } |
|
| 301 | - } |
|
| 302 | - return $has_shortcode; |
|
| 303 | - } |
|
| 304 | - |
|
| 305 | - |
|
| 306 | - /** |
|
| 307 | - * given a shortcode name, will instantiate the shortcode and call it's run() method |
|
| 308 | - * |
|
| 309 | - * @param string $shortcode_class |
|
| 310 | - * @param WP $wp |
|
| 311 | - */ |
|
| 312 | - public function initializeShortcode($shortcode_class = '', WP $wp = null) |
|
| 313 | - { |
|
| 314 | - // don't do anything if shortcode is already initialized |
|
| 315 | - if (empty($this->registry->shortcodes->{$shortcode_class}) |
|
| 316 | - || ! is_string($this->registry->shortcodes->{$shortcode_class}) |
|
| 317 | - ) { |
|
| 318 | - return; |
|
| 319 | - } |
|
| 320 | - // let's pause to reflect on this... |
|
| 321 | - $sc_reflector = new ReflectionClass(LegacyShortcodesManager::addShortcodeClassPrefix($shortcode_class)); |
|
| 322 | - // ensure that class is actually a shortcode |
|
| 323 | - if (defined('WP_DEBUG') |
|
| 324 | - && WP_DEBUG === true |
|
| 325 | - && ! $sc_reflector->isSubclassOf('EES_Shortcode') |
|
| 326 | - ) { |
|
| 327 | - EE_Error::add_error( |
|
| 328 | - sprintf( |
|
| 329 | - esc_html__( |
|
| 330 | - 'The requested %s shortcode is not of the class "EES_Shortcode". Please check your files.', |
|
| 331 | - 'event_espresso' |
|
| 332 | - ), |
|
| 333 | - $shortcode_class |
|
| 334 | - ), |
|
| 335 | - __FILE__, |
|
| 336 | - __FUNCTION__, |
|
| 337 | - __LINE__ |
|
| 338 | - ); |
|
| 339 | - add_filter('FHEE_run_EE_the_content', '__return_true'); |
|
| 340 | - return; |
|
| 341 | - } |
|
| 342 | - global $wp; |
|
| 343 | - // and pass the request object to the run method |
|
| 344 | - $this->registry->shortcodes->{$shortcode_class} = $sc_reflector->newInstance(); |
|
| 345 | - // fire the shortcode class's run method, so that it can activate resources |
|
| 346 | - $this->registry->shortcodes->{$shortcode_class}->run($wp); |
|
| 347 | - } |
|
| 348 | - |
|
| 349 | - |
|
| 350 | - /** |
|
| 351 | - * get classname, remove EES_prefix, and convert to UPPERCASE |
|
| 352 | - * |
|
| 353 | - * @param string $class_name |
|
| 354 | - * @return string |
|
| 355 | - */ |
|
| 356 | - public static function generateShortcodeTagFromClassName($class_name) |
|
| 357 | - { |
|
| 358 | - return strtoupper(str_replace('EES_', '', $class_name)); |
|
| 359 | - } |
|
| 360 | - |
|
| 361 | - |
|
| 362 | - /** |
|
| 363 | - * add EES_prefix and Capitalize words |
|
| 364 | - * |
|
| 365 | - * @param string $tag |
|
| 366 | - * @return string |
|
| 367 | - */ |
|
| 368 | - public static function generateShortcodeClassNameFromTag($tag) |
|
| 369 | - { |
|
| 370 | - // order of operation runs from inside to out |
|
| 371 | - // 5) maybe add prefix |
|
| 372 | - return LegacyShortcodesManager::addShortcodeClassPrefix( |
|
| 373 | - // 4) find spaces, replace with underscores |
|
| 374 | - str_replace( |
|
| 375 | - ' ', |
|
| 376 | - '_', |
|
| 377 | - // 3) capitalize first letter of each word |
|
| 378 | - ucwords( |
|
| 379 | - // 2) also change to lowercase so ucwords() will work |
|
| 380 | - strtolower( |
|
| 381 | - // 1) find underscores, replace with spaces so ucwords() will work |
|
| 382 | - str_replace( |
|
| 383 | - '_', |
|
| 384 | - ' ', |
|
| 385 | - $tag |
|
| 386 | - ) |
|
| 387 | - ) |
|
| 388 | - ) |
|
| 389 | - ) |
|
| 390 | - ); |
|
| 391 | - } |
|
| 392 | - |
|
| 393 | - |
|
| 394 | - /** |
|
| 395 | - * maybe add EES_prefix |
|
| 396 | - * |
|
| 397 | - * @param string $class_name |
|
| 398 | - * @return string |
|
| 399 | - */ |
|
| 400 | - public static function addShortcodeClassPrefix($class_name) |
|
| 401 | - { |
|
| 402 | - return strpos($class_name, 'EES_') === 0 ? $class_name : 'EES_' . $class_name; |
|
| 403 | - } |
|
| 404 | - |
|
| 405 | - |
|
| 406 | - /** |
|
| 407 | - * @return array |
|
| 408 | - */ |
|
| 409 | - public function getEspressoShortcodeTags() |
|
| 410 | - { |
|
| 411 | - static $shortcode_tags = array(); |
|
| 412 | - if (empty($shortcode_tags)) { |
|
| 413 | - $shortcode_tags = array_keys((array) $this->registry->shortcodes); |
|
| 414 | - } |
|
| 415 | - return $shortcode_tags; |
|
| 416 | - } |
|
| 417 | - |
|
| 418 | - |
|
| 419 | - /** |
|
| 420 | - * @param string $content |
|
| 421 | - * @return string |
|
| 422 | - */ |
|
| 423 | - public function doShortcode($content) |
|
| 424 | - { |
|
| 425 | - foreach ($this->getEspressoShortcodeTags() as $shortcode_tag) { |
|
| 426 | - if (strpos($content, $shortcode_tag) !== false) { |
|
| 427 | - $shortcode_class = LegacyShortcodesManager::generateShortcodeClassNameFromTag($shortcode_tag); |
|
| 428 | - $this->initializeShortcode($shortcode_class); |
|
| 429 | - } |
|
| 430 | - } |
|
| 431 | - return do_shortcode($content); |
|
| 432 | - } |
|
| 24 | + /** |
|
| 25 | + * @var EE_Registry $registry |
|
| 26 | + */ |
|
| 27 | + private $registry; |
|
| 28 | + |
|
| 29 | + |
|
| 30 | + /** |
|
| 31 | + * LegacyShortcodesManager constructor. |
|
| 32 | + * |
|
| 33 | + * @param \EE_Registry $registry |
|
| 34 | + */ |
|
| 35 | + public function __construct(EE_Registry $registry) |
|
| 36 | + { |
|
| 37 | + $this->registry = $registry; |
|
| 38 | + } |
|
| 39 | + |
|
| 40 | + |
|
| 41 | + /** |
|
| 42 | + * @return EE_Registry |
|
| 43 | + */ |
|
| 44 | + public function registry() |
|
| 45 | + { |
|
| 46 | + return $this->registry; |
|
| 47 | + } |
|
| 48 | + |
|
| 49 | + |
|
| 50 | + /** |
|
| 51 | + * registerShortcodes |
|
| 52 | + * |
|
| 53 | + * @return void |
|
| 54 | + */ |
|
| 55 | + public function registerShortcodes() |
|
| 56 | + { |
|
| 57 | + $this->registry->shortcodes = $this->getShortcodes(); |
|
| 58 | + } |
|
| 59 | + |
|
| 60 | + |
|
| 61 | + /** |
|
| 62 | + * getShortcodes |
|
| 63 | + * |
|
| 64 | + * @return array |
|
| 65 | + */ |
|
| 66 | + public function getShortcodes() |
|
| 67 | + { |
|
| 68 | + // previously this method would glob the shortcodes directory |
|
| 69 | + // then filter that list of shortcodes to register, |
|
| 70 | + // but now we are going to just supply an empty array. |
|
| 71 | + // this allows any shortcodes that have not yet been converted to the new system |
|
| 72 | + // to still get loaded and processed, albeit using the same legacy logic as before |
|
| 73 | + $shortcodes_to_register = apply_filters( |
|
| 74 | + 'FHEE__EE_Config__register_shortcodes__shortcodes_to_register', |
|
| 75 | + array() |
|
| 76 | + ); |
|
| 77 | + if (! empty($shortcodes_to_register)) { |
|
| 78 | + // cycle thru shortcode folders |
|
| 79 | + foreach ($shortcodes_to_register as $shortcode_path) { |
|
| 80 | + // add to list of installed shortcode modules |
|
| 81 | + $this->registerShortcode($shortcode_path); |
|
| 82 | + } |
|
| 83 | + } |
|
| 84 | + // filter list of installed modules |
|
| 85 | + return apply_filters( |
|
| 86 | + 'FHEE__EE_Config___register_shortcodes__installed_shortcodes', |
|
| 87 | + ! empty($this->registry->shortcodes) |
|
| 88 | + ? $this->registry->shortcodes |
|
| 89 | + : array() |
|
| 90 | + ); |
|
| 91 | + } |
|
| 92 | + |
|
| 93 | + |
|
| 94 | + /** |
|
| 95 | + * register_shortcode - makes core aware of this shortcode |
|
| 96 | + * |
|
| 97 | + * @access public |
|
| 98 | + * @param string $shortcode_path - full path up to and including shortcode folder |
|
| 99 | + * @return bool |
|
| 100 | + */ |
|
| 101 | + public function registerShortcode($shortcode_path = null) |
|
| 102 | + { |
|
| 103 | + do_action('AHEE__EE_Config__register_shortcode__begin', $shortcode_path); |
|
| 104 | + $shortcode_ext = '.shortcode.php'; |
|
| 105 | + // make all separators match |
|
| 106 | + $shortcode_path = str_replace(array('\\', '/'), '/', $shortcode_path); |
|
| 107 | + // does the file path INCLUDE the actual file name as part of the path ? |
|
| 108 | + if (strpos($shortcode_path, $shortcode_ext) !== false) { |
|
| 109 | + // grab shortcode file name from directory name and break apart at dots |
|
| 110 | + $shortcode_file = explode('.', basename($shortcode_path)); |
|
| 111 | + // take first segment from file name pieces and remove class prefix if it exists |
|
| 112 | + $shortcode = strpos($shortcode_file[0], 'EES_') === 0 |
|
| 113 | + ? substr($shortcode_file[0], 4) |
|
| 114 | + : $shortcode_file[0]; |
|
| 115 | + // sanitize shortcode directory name |
|
| 116 | + $shortcode = sanitize_key($shortcode); |
|
| 117 | + // now we need to rebuild the shortcode path |
|
| 118 | + $shortcode_path = explode('/', $shortcode_path); |
|
| 119 | + // remove last segment |
|
| 120 | + array_pop($shortcode_path); |
|
| 121 | + // glue it back together |
|
| 122 | + $shortcode_path = implode('/', $shortcode_path) . '/'; |
|
| 123 | + } else { |
|
| 124 | + // we need to generate the filename based off of the folder name |
|
| 125 | + // grab and sanitize shortcode directory name |
|
| 126 | + $shortcode = sanitize_key(basename($shortcode_path)); |
|
| 127 | + $shortcode_path = rtrim($shortcode_path, '/') . '/'; |
|
| 128 | + } |
|
| 129 | + // create classname from shortcode directory or file name |
|
| 130 | + $shortcode = str_replace(' ', '_', ucwords(str_replace('_', ' ', $shortcode))); |
|
| 131 | + // add class prefix |
|
| 132 | + $shortcode_class = 'EES_' . $shortcode; |
|
| 133 | + // does the shortcode exist ? |
|
| 134 | + if (! is_readable($shortcode_path . '/' . $shortcode_class . $shortcode_ext)) { |
|
| 135 | + $msg = sprintf( |
|
| 136 | + esc_html__( |
|
| 137 | + 'The requested %1$s shortcode file could not be found or is not readable due to file permissions. It should be in %2$s', |
|
| 138 | + 'event_espresso' |
|
| 139 | + ), |
|
| 140 | + $shortcode_class, |
|
| 141 | + $shortcode_path . '/' . $shortcode_class . $shortcode_ext |
|
| 142 | + ); |
|
| 143 | + EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 144 | + return false; |
|
| 145 | + } |
|
| 146 | + // load the shortcode class file |
|
| 147 | + require_once($shortcode_path . $shortcode_class . $shortcode_ext); |
|
| 148 | + // verify that class exists |
|
| 149 | + if (! class_exists($shortcode_class)) { |
|
| 150 | + $msg = sprintf( |
|
| 151 | + esc_html__('The requested %s shortcode class does not exist.', 'event_espresso'), |
|
| 152 | + $shortcode_class |
|
| 153 | + ); |
|
| 154 | + EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 155 | + return false; |
|
| 156 | + } |
|
| 157 | + $shortcode = strtoupper($shortcode); |
|
| 158 | + // add to array of registered shortcodes |
|
| 159 | + $this->registry->shortcodes->{$shortcode} = $shortcode_path . $shortcode_class . $shortcode_ext; |
|
| 160 | + return true; |
|
| 161 | + } |
|
| 162 | + |
|
| 163 | + |
|
| 164 | + /** |
|
| 165 | + * _initialize_shortcodes |
|
| 166 | + * allow shortcodes to set hooks for the rest of the system |
|
| 167 | + * |
|
| 168 | + * @access private |
|
| 169 | + * @return void |
|
| 170 | + */ |
|
| 171 | + public function addShortcodes() |
|
| 172 | + { |
|
| 173 | + // cycle thru shortcode folders |
|
| 174 | + foreach ($this->registry->shortcodes as $shortcode => $shortcode_path) { |
|
| 175 | + // add class prefix |
|
| 176 | + $shortcode_class = 'EES_' . $shortcode; |
|
| 177 | + // fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system |
|
| 178 | + // which set hooks ? |
|
| 179 | + if (is_admin()) { |
|
| 180 | + // fire immediately |
|
| 181 | + call_user_func(array($shortcode_class, 'set_hooks_admin')); |
|
| 182 | + } else { |
|
| 183 | + // delay until other systems are online |
|
| 184 | + add_action( |
|
| 185 | + 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', |
|
| 186 | + array($shortcode_class, 'set_hooks') |
|
| 187 | + ); |
|
| 188 | + // convert classname to UPPERCASE and create WP shortcode. |
|
| 189 | + $shortcode_tag = strtoupper($shortcode); |
|
| 190 | + // but first check if the shortcode has already |
|
| 191 | + // been added before assigning 'fallback_shortcode_processor' |
|
| 192 | + if (! shortcode_exists($shortcode_tag)) { |
|
| 193 | + // NOTE: this shortcode declaration will get overridden if the shortcode |
|
| 194 | + // is successfully detected in the post content in initializeShortcode() |
|
| 195 | + add_shortcode($shortcode_tag, array($shortcode_class, 'fallback_shortcode_processor')); |
|
| 196 | + } |
|
| 197 | + } |
|
| 198 | + } |
|
| 199 | + } |
|
| 200 | + |
|
| 201 | + |
|
| 202 | + /** |
|
| 203 | + * callback for the WP "get_header" hook point |
|
| 204 | + * checks posts for EE shortcodes, and initializes them, |
|
| 205 | + * then toggles filter switch that loads core default assets |
|
| 206 | + * |
|
| 207 | + * @param \WP_Query $wp_query |
|
| 208 | + * @return void |
|
| 209 | + */ |
|
| 210 | + public function initializeShortcodes(WP_Query $wp_query) |
|
| 211 | + { |
|
| 212 | + if (empty($this->registry->shortcodes) |
|
| 213 | + || defined('EE_TESTS_DIR') |
|
| 214 | + || ! $wp_query->is_main_query() |
|
| 215 | + || is_admin() |
|
| 216 | + ) { |
|
| 217 | + return; |
|
| 218 | + } |
|
| 219 | + global $wp; |
|
| 220 | + /** @var EE_Front_controller $Front_Controller */ |
|
| 221 | + $Front_Controller = $this->registry->load_core('Front_Controller', array(), false); |
|
| 222 | + do_action('AHEE__EE_Front_Controller__initialize_shortcodes__begin', $wp, $Front_Controller); |
|
| 223 | + $Front_Controller->Request_Handler()->set_request_vars(); |
|
| 224 | + // grab post_name from request |
|
| 225 | + $current_post = apply_filters( |
|
| 226 | + 'FHEE__EE_Front_Controller__initialize_shortcodes__current_post_name', |
|
| 227 | + $Front_Controller->Request_Handler()->get('post_name') |
|
| 228 | + ); |
|
| 229 | + $show_on_front = get_option('show_on_front'); |
|
| 230 | + // if it's not set, then check if frontpage is blog |
|
| 231 | + if (empty($current_post)) { |
|
| 232 | + // yup.. this is the posts page, prepare to load all shortcode modules |
|
| 233 | + $current_post = 'posts'; |
|
| 234 | + // unless.. |
|
| 235 | + if ($show_on_front === 'page') { |
|
| 236 | + // some other page is set as the homepage |
|
| 237 | + $page_on_front = get_option('page_on_front'); |
|
| 238 | + if ($page_on_front) { |
|
| 239 | + // k now we need to find the post_name for this page |
|
| 240 | + global $wpdb; |
|
| 241 | + $page_on_front = $wpdb->get_var( |
|
| 242 | + $wpdb->prepare( |
|
| 243 | + "SELECT post_name from {$wpdb->posts} WHERE post_type='page' AND post_status NOT IN ('auto-draft', 'inherit', 'trash') AND ID=%d", |
|
| 244 | + $page_on_front |
|
| 245 | + ) |
|
| 246 | + ); |
|
| 247 | + // set the current post slug to what it actually is |
|
| 248 | + $current_post = $page_on_front ? $page_on_front : $current_post; |
|
| 249 | + } |
|
| 250 | + } |
|
| 251 | + } |
|
| 252 | + // in case $current_post is hierarchical like: /parent-page/current-page |
|
| 253 | + $current_post = basename($current_post); |
|
| 254 | + if (// is current page/post the "blog" page ? |
|
| 255 | + $current_post === EE_Config::get_page_for_posts() |
|
| 256 | + // or are we on a category page? |
|
| 257 | + || ( |
|
| 258 | + is_array(term_exists($current_post, 'category')) |
|
| 259 | + || array_key_exists('category_name', $wp->query_vars) |
|
| 260 | + ) |
|
| 261 | + ) { |
|
| 262 | + // initialize all legacy shortcodes |
|
| 263 | + $load_assets = $this->parseContentForShortcodes('', true); |
|
| 264 | + } else { |
|
| 265 | + global $wpdb; |
|
| 266 | + $post_content = $wpdb->get_var( |
|
| 267 | + $wpdb->prepare( |
|
| 268 | + "SELECT post_content from {$wpdb->posts} WHERE post_status NOT IN ('auto-draft', 'inherit', 'trash') AND post_name=%s", |
|
| 269 | + $current_post |
|
| 270 | + ) |
|
| 271 | + ); |
|
| 272 | + $load_assets = $this->parseContentForShortcodes($post_content); |
|
| 273 | + } |
|
| 274 | + if ($load_assets) { |
|
| 275 | + $this->registry->REQ->set_espresso_page(true); |
|
| 276 | + add_filter('FHEE_load_css', '__return_true'); |
|
| 277 | + add_filter('FHEE_load_js', '__return_true'); |
|
| 278 | + } |
|
| 279 | + do_action('AHEE__EE_Front_Controller__initialize_shortcodes__end', $Front_Controller); |
|
| 280 | + } |
|
| 281 | + |
|
| 282 | + |
|
| 283 | + /** |
|
| 284 | + * checks supplied content against list of legacy shortcodes, |
|
| 285 | + * then initializes any found shortcodes, and returns true. |
|
| 286 | + * returns false if no shortcodes found. |
|
| 287 | + * |
|
| 288 | + * @param string $content |
|
| 289 | + * @param bool $load_all if true, then ALL active legacy shortcodes will be initialized |
|
| 290 | + * @return bool |
|
| 291 | + */ |
|
| 292 | + public function parseContentForShortcodes($content = '', $load_all = false) |
|
| 293 | + { |
|
| 294 | + $has_shortcode = false; |
|
| 295 | + foreach ($this->registry->shortcodes as $shortcode_class => $shortcode) { |
|
| 296 | + if ($load_all || has_shortcode($content, $shortcode_class)) { |
|
| 297 | + // load up the shortcode |
|
| 298 | + $this->initializeShortcode($shortcode_class); |
|
| 299 | + $has_shortcode = true; |
|
| 300 | + } |
|
| 301 | + } |
|
| 302 | + return $has_shortcode; |
|
| 303 | + } |
|
| 304 | + |
|
| 305 | + |
|
| 306 | + /** |
|
| 307 | + * given a shortcode name, will instantiate the shortcode and call it's run() method |
|
| 308 | + * |
|
| 309 | + * @param string $shortcode_class |
|
| 310 | + * @param WP $wp |
|
| 311 | + */ |
|
| 312 | + public function initializeShortcode($shortcode_class = '', WP $wp = null) |
|
| 313 | + { |
|
| 314 | + // don't do anything if shortcode is already initialized |
|
| 315 | + if (empty($this->registry->shortcodes->{$shortcode_class}) |
|
| 316 | + || ! is_string($this->registry->shortcodes->{$shortcode_class}) |
|
| 317 | + ) { |
|
| 318 | + return; |
|
| 319 | + } |
|
| 320 | + // let's pause to reflect on this... |
|
| 321 | + $sc_reflector = new ReflectionClass(LegacyShortcodesManager::addShortcodeClassPrefix($shortcode_class)); |
|
| 322 | + // ensure that class is actually a shortcode |
|
| 323 | + if (defined('WP_DEBUG') |
|
| 324 | + && WP_DEBUG === true |
|
| 325 | + && ! $sc_reflector->isSubclassOf('EES_Shortcode') |
|
| 326 | + ) { |
|
| 327 | + EE_Error::add_error( |
|
| 328 | + sprintf( |
|
| 329 | + esc_html__( |
|
| 330 | + 'The requested %s shortcode is not of the class "EES_Shortcode". Please check your files.', |
|
| 331 | + 'event_espresso' |
|
| 332 | + ), |
|
| 333 | + $shortcode_class |
|
| 334 | + ), |
|
| 335 | + __FILE__, |
|
| 336 | + __FUNCTION__, |
|
| 337 | + __LINE__ |
|
| 338 | + ); |
|
| 339 | + add_filter('FHEE_run_EE_the_content', '__return_true'); |
|
| 340 | + return; |
|
| 341 | + } |
|
| 342 | + global $wp; |
|
| 343 | + // and pass the request object to the run method |
|
| 344 | + $this->registry->shortcodes->{$shortcode_class} = $sc_reflector->newInstance(); |
|
| 345 | + // fire the shortcode class's run method, so that it can activate resources |
|
| 346 | + $this->registry->shortcodes->{$shortcode_class}->run($wp); |
|
| 347 | + } |
|
| 348 | + |
|
| 349 | + |
|
| 350 | + /** |
|
| 351 | + * get classname, remove EES_prefix, and convert to UPPERCASE |
|
| 352 | + * |
|
| 353 | + * @param string $class_name |
|
| 354 | + * @return string |
|
| 355 | + */ |
|
| 356 | + public static function generateShortcodeTagFromClassName($class_name) |
|
| 357 | + { |
|
| 358 | + return strtoupper(str_replace('EES_', '', $class_name)); |
|
| 359 | + } |
|
| 360 | + |
|
| 361 | + |
|
| 362 | + /** |
|
| 363 | + * add EES_prefix and Capitalize words |
|
| 364 | + * |
|
| 365 | + * @param string $tag |
|
| 366 | + * @return string |
|
| 367 | + */ |
|
| 368 | + public static function generateShortcodeClassNameFromTag($tag) |
|
| 369 | + { |
|
| 370 | + // order of operation runs from inside to out |
|
| 371 | + // 5) maybe add prefix |
|
| 372 | + return LegacyShortcodesManager::addShortcodeClassPrefix( |
|
| 373 | + // 4) find spaces, replace with underscores |
|
| 374 | + str_replace( |
|
| 375 | + ' ', |
|
| 376 | + '_', |
|
| 377 | + // 3) capitalize first letter of each word |
|
| 378 | + ucwords( |
|
| 379 | + // 2) also change to lowercase so ucwords() will work |
|
| 380 | + strtolower( |
|
| 381 | + // 1) find underscores, replace with spaces so ucwords() will work |
|
| 382 | + str_replace( |
|
| 383 | + '_', |
|
| 384 | + ' ', |
|
| 385 | + $tag |
|
| 386 | + ) |
|
| 387 | + ) |
|
| 388 | + ) |
|
| 389 | + ) |
|
| 390 | + ); |
|
| 391 | + } |
|
| 392 | + |
|
| 393 | + |
|
| 394 | + /** |
|
| 395 | + * maybe add EES_prefix |
|
| 396 | + * |
|
| 397 | + * @param string $class_name |
|
| 398 | + * @return string |
|
| 399 | + */ |
|
| 400 | + public static function addShortcodeClassPrefix($class_name) |
|
| 401 | + { |
|
| 402 | + return strpos($class_name, 'EES_') === 0 ? $class_name : 'EES_' . $class_name; |
|
| 403 | + } |
|
| 404 | + |
|
| 405 | + |
|
| 406 | + /** |
|
| 407 | + * @return array |
|
| 408 | + */ |
|
| 409 | + public function getEspressoShortcodeTags() |
|
| 410 | + { |
|
| 411 | + static $shortcode_tags = array(); |
|
| 412 | + if (empty($shortcode_tags)) { |
|
| 413 | + $shortcode_tags = array_keys((array) $this->registry->shortcodes); |
|
| 414 | + } |
|
| 415 | + return $shortcode_tags; |
|
| 416 | + } |
|
| 417 | + |
|
| 418 | + |
|
| 419 | + /** |
|
| 420 | + * @param string $content |
|
| 421 | + * @return string |
|
| 422 | + */ |
|
| 423 | + public function doShortcode($content) |
|
| 424 | + { |
|
| 425 | + foreach ($this->getEspressoShortcodeTags() as $shortcode_tag) { |
|
| 426 | + if (strpos($content, $shortcode_tag) !== false) { |
|
| 427 | + $shortcode_class = LegacyShortcodesManager::generateShortcodeClassNameFromTag($shortcode_tag); |
|
| 428 | + $this->initializeShortcode($shortcode_class); |
|
| 429 | + } |
|
| 430 | + } |
|
| 431 | + return do_shortcode($content); |
|
| 432 | + } |
|
| 433 | 433 | } |
@@ -16,73 +16,73 @@ |
||
| 16 | 16 | class RoutingRequests extends Route |
| 17 | 17 | { |
| 18 | 18 | |
| 19 | - /** |
|
| 20 | - * returns true if the current request matches this route |
|
| 21 | - * |
|
| 22 | - * @return bool |
|
| 23 | - * @since $VID:$ |
|
| 24 | - */ |
|
| 25 | - public function matchesCurrentRequest() |
|
| 26 | - { |
|
| 27 | - return ! $this->request->isActivation() || $this->request->isUnitTesting(); |
|
| 28 | - } |
|
| 19 | + /** |
|
| 20 | + * returns true if the current request matches this route |
|
| 21 | + * |
|
| 22 | + * @return bool |
|
| 23 | + * @since $VID:$ |
|
| 24 | + */ |
|
| 25 | + public function matchesCurrentRequest() |
|
| 26 | + { |
|
| 27 | + return ! $this->request->isActivation() || $this->request->isUnitTesting(); |
|
| 28 | + } |
|
| 29 | 29 | |
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * @since $VID:$ |
|
| 33 | - */ |
|
| 34 | - protected function registerDependencies() |
|
| 35 | - { |
|
| 36 | - $default = [ |
|
| 37 | - 'EE_Dependency_Map' => EE_Dependency_Map::load_from_cache, |
|
| 38 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
| 39 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 40 | - ]; |
|
| 41 | - $admin = [ |
|
| 42 | - 'EE_Admin_Config' => EE_Dependency_Map::load_from_cache, |
|
| 43 | - 'EE_Dependency_Map' => EE_Dependency_Map::load_from_cache, |
|
| 44 | - 'EE_Maintenance_Mode' => EE_Dependency_Map::load_from_cache, |
|
| 45 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
| 46 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 47 | - ]; |
|
| 48 | - $frontend = [ |
|
| 49 | - 'EE_Dependency_Map' => EE_Dependency_Map::load_from_cache, |
|
| 50 | - 'EE_Maintenance_Mode' => EE_Dependency_Map::load_from_cache, |
|
| 51 | - 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
| 52 | - 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 53 | - ]; |
|
| 54 | - $default_routes = [ |
|
| 55 | - // admin dependencies |
|
| 56 | - 'EventEspresso\core\domain\entities\routing\handlers\admin\EspressoEventsAdmin' => $admin, |
|
| 57 | - 'EventEspresso\core\domain\entities\routing\handlers\admin\EspressoEventEditor' => $admin, |
|
| 58 | - 'EventEspresso\core\domain\entities\routing\handlers\admin\EspressoLegacyAdmin' => $admin, |
|
| 59 | - // default dependencies |
|
| 60 | - 'EventEspresso\core\domain\entities\routing\handlers\admin\PueRequests' => $default, |
|
| 61 | - 'EventEspresso\core\domain\entities\routing\handlers\admin\WordPressPluginsPage' => $default, |
|
| 62 | - 'EventEspresso\core\domain\entities\routing\handlers\frontend\ShortcodeRequests' => $default, |
|
| 63 | - 'EventEspresso\core\domain\entities\routing\handlers\shared\AssetRequests' => $default, |
|
| 64 | - 'EventEspresso\core\domain\entities\routing\handlers\shared\GQLRequests' => $default, |
|
| 65 | - 'EventEspresso\core\domain\entities\routing\handlers\shared\RestApiRequests' => $default, |
|
| 66 | - 'EventEspresso\core\domain\entities\routing\handlers\shared\SessionRequests' => $default, |
|
| 67 | - 'EventEspresso\core\domain\entities\routing\handlers\shared\WordPressHeartbeat' => $default, |
|
| 68 | - // frontend dependencies |
|
| 69 | - 'EventEspresso\core\domain\entities\routing\handlers\admin\PersonalDataRequests' => $frontend, |
|
| 70 | - 'EventEspresso\core\domain\entities\routing\handlers\frontend\FrontendRequests' => $frontend, |
|
| 71 | - ]; |
|
| 72 | - foreach ($default_routes as $route => $dependencies) { |
|
| 73 | - $this->dependency_map->registerDependencies($route, $dependencies); |
|
| 74 | - } |
|
| 75 | - } |
|
| 31 | + /** |
|
| 32 | + * @since $VID:$ |
|
| 33 | + */ |
|
| 34 | + protected function registerDependencies() |
|
| 35 | + { |
|
| 36 | + $default = [ |
|
| 37 | + 'EE_Dependency_Map' => EE_Dependency_Map::load_from_cache, |
|
| 38 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
| 39 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 40 | + ]; |
|
| 41 | + $admin = [ |
|
| 42 | + 'EE_Admin_Config' => EE_Dependency_Map::load_from_cache, |
|
| 43 | + 'EE_Dependency_Map' => EE_Dependency_Map::load_from_cache, |
|
| 44 | + 'EE_Maintenance_Mode' => EE_Dependency_Map::load_from_cache, |
|
| 45 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
| 46 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 47 | + ]; |
|
| 48 | + $frontend = [ |
|
| 49 | + 'EE_Dependency_Map' => EE_Dependency_Map::load_from_cache, |
|
| 50 | + 'EE_Maintenance_Mode' => EE_Dependency_Map::load_from_cache, |
|
| 51 | + 'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache, |
|
| 52 | + 'EventEspresso\core\services\request\Request' => EE_Dependency_Map::load_from_cache, |
|
| 53 | + ]; |
|
| 54 | + $default_routes = [ |
|
| 55 | + // admin dependencies |
|
| 56 | + 'EventEspresso\core\domain\entities\routing\handlers\admin\EspressoEventsAdmin' => $admin, |
|
| 57 | + 'EventEspresso\core\domain\entities\routing\handlers\admin\EspressoEventEditor' => $admin, |
|
| 58 | + 'EventEspresso\core\domain\entities\routing\handlers\admin\EspressoLegacyAdmin' => $admin, |
|
| 59 | + // default dependencies |
|
| 60 | + 'EventEspresso\core\domain\entities\routing\handlers\admin\PueRequests' => $default, |
|
| 61 | + 'EventEspresso\core\domain\entities\routing\handlers\admin\WordPressPluginsPage' => $default, |
|
| 62 | + 'EventEspresso\core\domain\entities\routing\handlers\frontend\ShortcodeRequests' => $default, |
|
| 63 | + 'EventEspresso\core\domain\entities\routing\handlers\shared\AssetRequests' => $default, |
|
| 64 | + 'EventEspresso\core\domain\entities\routing\handlers\shared\GQLRequests' => $default, |
|
| 65 | + 'EventEspresso\core\domain\entities\routing\handlers\shared\RestApiRequests' => $default, |
|
| 66 | + 'EventEspresso\core\domain\entities\routing\handlers\shared\SessionRequests' => $default, |
|
| 67 | + 'EventEspresso\core\domain\entities\routing\handlers\shared\WordPressHeartbeat' => $default, |
|
| 68 | + // frontend dependencies |
|
| 69 | + 'EventEspresso\core\domain\entities\routing\handlers\admin\PersonalDataRequests' => $frontend, |
|
| 70 | + 'EventEspresso\core\domain\entities\routing\handlers\frontend\FrontendRequests' => $frontend, |
|
| 71 | + ]; |
|
| 72 | + foreach ($default_routes as $route => $dependencies) { |
|
| 73 | + $this->dependency_map->registerDependencies($route, $dependencies); |
|
| 74 | + } |
|
| 75 | + } |
|
| 76 | 76 | |
| 77 | 77 | |
| 78 | - /** |
|
| 79 | - * implements logic required to run during request |
|
| 80 | - * |
|
| 81 | - * @return bool |
|
| 82 | - * @since $VID:$ |
|
| 83 | - */ |
|
| 84 | - protected function requestHandler() |
|
| 85 | - { |
|
| 86 | - return true; |
|
| 87 | - } |
|
| 78 | + /** |
|
| 79 | + * implements logic required to run during request |
|
| 80 | + * |
|
| 81 | + * @return bool |
|
| 82 | + * @since $VID:$ |
|
| 83 | + */ |
|
| 84 | + protected function requestHandler() |
|
| 85 | + { |
|
| 86 | + return true; |
|
| 87 | + } |
|
| 88 | 88 | } |