/** * check if a component is enabled * @since 3.4 * @param str $id component id * @return bool true if not disabled */ function componentIsEnabled($id) { $item = get_component_xml($id); if (!$item) { return false; } return !(bool) (string) $item[0]->disabled; }
/** * See if a component exists * @since 3.4 * @param str $id component id * @param bool disabled include disabled snippets * @return bool */ function component_exists($id, $disabled = false) { if (!$disabled) { return componentIsEnabled($id); } return (bool) get_component_xml($id); }
/** * See if a component exists * @since 3.4.0 * @param str $id component id * @return bool */ function component_exists($id) { return !get_component_xml($id); }