function sprite_class($sprite, $class, $prefix) { if (is_array($class)) { // Merge default classes; this creates, for example: "icon icon-sprite" if ($prefix) { $class = array_merge([$prefix, $prefix . '-' . $sprite], $class); } // Setup a class matching the icon set prefix (anything before the hyphen, if there is one) if (strpos($sprite, '-')) { $class[] = $prefix . '-' . current(explode('-', $sprite)); } // Generate the class string and provide an opportunity to filter the results (or even clear classes altogether) $class = (array) apply_filters('ubik_svg_sprite_class', $class); } return \Ubik\get_class_attribute($class); }
function edit_link($content = '', $class = '') { // Exit early if not logged in if (!is_user_logged_in()) { return; } // Fetch the current query object $term = get_queried_object(); // Bail if something went wrong if (!empty($term) && is_user_logged_in()) { // Fetch the taxonomy and test the current user's capabilities $tax = get_taxonomy($term->taxonomy); if (empty($tax) || !current_user_can($tax->cap->edit_terms)) { return; } // If we made it this far let's grab the raw edit term link; bail if nothing is returned if ($link = get_edit_term_link($term->term_id, $term->taxonomy)) { // Content if (empty($content) || !is_string($content)) { $content = esc_html__('Edit', 'ubik'); } // Put it all together return sprintf('<a href="%s"%s rel="nofollow">%s</a>', $link, \Ubik\get_class_attribute($class), $content); } } }