/** * Check to see if this component is currently being accessed. We do this * manually because we want to know whether the component is in use before * WP would itself be able to tell us. This allows us to dispatch pages on * admin_init, which is early enough in the process that we can easily enqueue * other resources. Also, this gives us the chance to run code before WP has * rendered any output. * * * @return boolean */ protected function componentIsCurrentlyActive(ComponentAbstract $component) { return preg_match('/^' . $component->getSlug() . '($|\\/)/i', $component->getRequest()->getQuery('page')) || $component->getSlug() === $component->getRequest()->getPost('action'); }