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