function gp_link_project_delete_get($project, $text = false, $attrs = array()) { if (!GP::$user->current()->can('write', 'project', $project->id)) { return ''; } $text = $text ? $text : __('Delete'); return gp_link_get(gp_url_project($project, '_delete'), $text, gp_attrs_add_class($attrs, 'action delete')); }
function gp_link_glossary_edit_get($glossary, $set, $text = false, $attrs = array()) { if (!GP::$user->current()->can('approve', 'translation_set', $set->id)) { return ''; } $text = $text ? $text : __('Edit'); return gp_link_get(gp_url(gp_url_join('/glossaries', $glossary->id, '-edit')), $text, gp_attrs_add_class($attrs, 'action edit')); }
/** * Creates a HTML link to the delete page for translations sets. * * Does the heavy lifting for gp_link_glossary_delete. * * @since 2.0.0 * * @param GP_Glossary $glossary The glossary to link to. * @param GP_Translation_Set $set The translation set the glossary is for. * @param string $text The text to use for the link. * @param array $attrs Additional attributes to use to determine the classes for the link. * @return string The HTML link. */ function gp_link_glossary_delete_get($glossary, $set, $text = false, $attrs = array()) { if (!GP::$permission->current_user_can('delete', 'translation-set', $set->id)) { return ''; } $text = $text ? $text : __('Delete', 'glotpress'); return gp_link_get(gp_url(gp_url_join('/glossaries', $glossary->id, '-delete')), $text, gp_attrs_add_class($attrs, 'action edit')); }