本文整理汇总了PHP中get_edit_term_link函数的典型用法代码示例。如果您正苦于以下问题:PHP get_edit_term_link函数的具体用法?PHP get_edit_term_link怎么用?PHP get_edit_term_link使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_edit_term_link函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
public function init()
{
global $sitepress;
$tax_get = filter_input(INPUT_GET, 'taxonomy');
require ICL_PLUGIN_PATH . '/menu/term-taxonomy-menus/wpml-term-language-filter.class.php';
if (($trid = filter_input(INPUT_GET, 'trid')) && ($source_lang = filter_input(INPUT_GET, 'source_lang')) && get_taxonomy($tax_get) !== false) {
$translations = $sitepress->get_element_translations($trid, 'tax_' . $this->taxonomy);
if (isset($translations[$_GET['lang']]) && !empty($translations[$_GET['lang']]->term_id)) {
wp_redirect(get_edit_term_link($translations[$_GET['lang']]->term_id, $tax_get));
exit;
} else {
add_action('admin_notices', array($this, '_tax_adding'));
}
}
$term_lang_filter = new WPML_Term_Language_Filter(icl_get_setting('default_language'));
if ($this->taxonomy === 'category') {
add_action('edit_category_form', array($this, 'wpml_edit_term_form'));
} else {
add_action('add_tag_form', array($this, 'wpml_edit_term_form'));
add_action('edit_tag_form', array($this, 'wpml_edit_term_form'));
}
add_action('admin_print_scripts-edit-tags.php', array($this, 'js_scripts_tags'));
add_filter('wp_dropdown_cats', array($this, 'wp_dropdown_cats_select_parent'), 10, 2);
add_action('admin_footer', array($term_lang_filter, 'terms_language_filter'));
}
示例2: ubik_terms_edit_link
function ubik_terms_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
$link = get_edit_term_link($term->term_id, $term->taxonomy);
// Content
if (empty($content) || !is_string($content)) {
$content = __('Edit', 'ubik');
}
// Class
if (!empty($class)) {
$class = ' class="' . $class . '"';
}
// Put it all together
if (!empty($link)) {
return '<a href="' . $link . '"' . $class . ' rel="nofollow">' . $content . '</a>';
}
}
}
示例3: uploaded_icon
public static function uploaded_icon($id)
{
$post_type = isset($GLOBALS['post_type']) ? $GLOBALS['post_type'] : $_REQUEST['post_type'];
// 2nd case for quick edit
$taxonomy = isset($GLOBALS['taxonomy']) ? $GLOBALS['taxonomy'] : $_REQUEST['taxonomy'];
$link = get_edit_term_link($id, $taxonomy, $post_type);
return self::display_icon('uploaded', $link);
}
示例4: get_admin_translation
/**
* Get term in backend
*
* @param array $term
* @param string $taxonomy
* @return array|bool
*/
private function get_admin_translation(array $term, $taxonomy)
{
if (!current_user_can('edit_terms', $taxonomy)) {
return FALSE;
}
$url = get_edit_term_link((int) $term['term_id'], $taxonomy);
return array('target_url' => new Mlp_Url($url), 'target_title' => $term['name']);
}
示例5: column_name
function column_name($item)
{
$term_id = (int) $item->term_id;
$delete_url = add_query_arg('action', 'delete', get_edit_term_link($term_id, 'event-venue', 'event'));
//Build row actions
$actions = array('edit' => sprintf('<a href="%s">' . __('Edit') . '</a>', get_edit_term_link($term_id, 'event-venue', 'event')), 'delete' => sprintf('<a href="%s">' . __('Delete') . '</a>', wp_nonce_url($delete_url, 'eventorganiser_delete_venue_' . $item->slug)), 'view' => sprintf('<a href="%s">' . __('View') . '</a>', eo_get_venue_link($term_id)));
//Return the title contents
return sprintf('<a href="%1$s" class="row-title">%2$s</a>%3$s', get_edit_term_link($term_id, 'event-venue', 'event'), esc_html($item->name), $this->row_actions($actions));
}
示例6: test_cap_check_should_use_correct_taxonomy_when_taxonomy_is_not_specified
/**
* @ticket 35922
*/
public function test_cap_check_should_use_correct_taxonomy_when_taxonomy_is_not_specified()
{
register_taxonomy('wptests_tax_subscriber', 'post', array('manage_terms' => 'read'));
$t = self::factory()->term->create(array('taxonomy' => 'wptests_tax', 'name' => 'foo'));
$u = self::factory()->user->create(array('role' => 'subscriber'));
wp_set_current_user($u);
$actual = get_edit_term_link($t);
$this->assertNull($actual);
}
示例7: get_edit_link
protected function get_edit_link($term_id)
{
if (empty($term_id)) {
return null;
}
$url = get_edit_term_link($term_id, $this->config['args']['taxonomy']);
$result = \Cibulka::Base('HTML', 'a', array('target' => '_blank', 'href' => $url, 'class' => 'edit-link'), false, 'Upravit rubriku');
return $result;
}
示例8: action_links
/**
* Add action links to Stream drop row in admin list screen
*
* @filter wp_stream_action_links_{connector}
* @param array $links Previous links registered
* @param int $record Stream record
* @return array Action links
*/
public static function action_links($links, $record)
{
if ($record->object_id && 'deleted' !== $record->action && ($term = get_term_by('term_taxonomy_id', $record->object_id, $record->context))) {
if (!is_wp_error($term)) {
$tax_obj = get_taxonomy($term->taxonomy);
$tax_label = isset($tax_obj->labels->singular_name) ? $tax_obj->labels->singular_name : null;
$links[sprintf(_x('Edit %s', 'Term singular name', 'stream'), $tax_label)] = get_edit_term_link($term->term_id, $term->taxonomy);
$links[__('View', 'stream')] = get_term_link($term->term_id, $term->taxonomy);
}
}
return $links;
}
示例9: action_links
/**
* Add action links to Stream drop row in admin list screen
*
* @filter wp_stream_action_links_{connector}
*
* @param array $links Previous links registered
* @param Record $record Stream record
*
* @return array Action links
*/
public function action_links($links, $record)
{
if ($record->object_id && 'deleted' !== $record->action && ($term = get_term_by('term_taxonomy_id', $record->object_id, $record->context))) {
if (!is_wp_error($term)) {
$tax_obj = get_taxonomy($term->taxonomy);
$tax_label = isset($tax_obj->labels->singular_name) ? $tax_obj->labels->singular_name : null;
if (function_exists('wp_get_split_term')) {
$term_id = wp_get_split_term($term->term_id, $term->taxonomy);
}
$term_id = empty($term_id) ? $term->term_id : $term_id;
$links[sprintf(_x('Edit %s', 'Term singular name', 'stream'), $tax_label)] = get_edit_term_link($term_id, $term->taxonomy);
$links[esc_html__('View', 'stream')] = wp_stream_is_vip() ? \wpcom_vip_get_term_link($term_id, $term->taxonomy) : get_term_link($term_id, $term->taxonomy);
}
}
return $links;
}
示例10: column_default
/**
* Print the columns information
*
* @param $rec \YITH_Commission
* @param $column_name
*
* @return string
*/
public function column_default($rec, $column_name)
{
switch ($column_name) {
case 'user':
if (empty($rec->display_name)) {
return "<em>" . __('User deleted', 'yith_wc_product_vendors') . "</em>";
}
$user_url = get_edit_user_link($rec->ID);
$user_name = $rec->display_name;
return !empty($user_url) ? "<a href='{$user_url}' target='_blank'>{$user_name}</a>" : $user_name;
break;
case 'vendor':
$vendor = yith_get_vendor($rec->ID, 'user');
if (!$vendor->is_valid()) {
return "<em>" . __('Vendor deleted', 'yith_wc_product_vendors') . "</em>";
}
$vendor_url = get_edit_term_link($vendor->id, $vendor->taxonomy);
$vendor_name = $vendor->name;
return !empty($vendor_url) ? "<a href='{$vendor_url}' target='_blank'>{$vendor_name}</a>" : $vendor_name;
break;
case 'amount':
$amount = get_user_meta($rec->ID, '_vendor_commission_credit', true);
return wc_price($amount);
break;
case 'user_actions':
if ($this->_vendor->is_super_user()) {
printf('<a class="button tips pay" href="%1$s" data-tip="%2$s">%2$s</a>', esc_url(wp_nonce_url(add_query_arg(array('action' => 'pay_commission', 'commission_id' => $rec->ID), admin_url('admin.php')), 'yith-vendors-pay-commission')), __('Pay', 'yith_wc_product_vendors'));
}
break;
case 'oldest_commission':
$commissions = YITH_Commissions()->get_commissions(array('user_id' => $rec->ID, 'fields' => 'last_edit', 'order' => 'ASC'));
$oldest_commission_date = array_shift($commissions);
$t_time = date_i18n(__('Y/m/d g:i:s A'), mysql2date('U', $oldest_commission_date));
$m_time = $oldest_commission_date;
$time = mysql2date('G', $oldest_commission_date);
$time_diff = time() - $time;
if ($time_diff > 0 && $time_diff < DAY_IN_SECONDS) {
$h_time = sprintf(__('%s ago'), human_time_diff($time));
} else {
$h_time = mysql2date(__('Y/m/d'), $m_time);
}
return $h_time ? '<abbr title="' . $t_time . '">' . $h_time . '</abbr>' : '<small class="meta">-</small>';
break;
}
return null;
}
开发者ID:kanhaiyasharma,项目名称:Bestswiss,代码行数:54,代码来源:class.yith-commissions-earnings-by-vendor-table.php
示例11: add_query_arg
}
if ($referer && false !== strpos($referer, 'edit-tags.php')) {
$location = $referer;
}
$location = add_query_arg('message', 6, $location);
break;
case 'edit':
if (!isset($_REQUEST['tag_ID'])) {
break;
}
$term_id = (int) $_REQUEST['tag_ID'];
$term = get_term($term_id);
if (!$term instanceof WP_Term) {
wp_die(__('You attempted to edit an item that doesn’t exist. Perhaps it was deleted?'));
}
wp_redirect(esc_url_raw(get_edit_term_link($term_id, $taxonomy, $post_type)));
exit;
case 'editedtag':
$tag_ID = (int) $_POST['tag_ID'];
check_admin_referer('update-tag_' . $tag_ID);
if (!current_user_can('edit_term', $tag_ID)) {
wp_die('<h1>' . __('Cheatin’ uh?') . '</h1>' . '<p>' . __('Sorry, you are not allowed to edit this item.') . '</p>', 403);
}
$tag = get_term($tag_ID, $taxonomy);
if (!$tag) {
wp_die(__('You attempted to edit an item that doesn’t exist. Perhaps it was deleted?'));
}
$ret = wp_update_term($tag_ID, $taxonomy, $_POST);
$location = 'edit-tags.php?taxonomy=' . $taxonomy;
if ('post' != $post_type) {
$location .= '&post_type=' . $post_type;
示例12: _eventorganiser_add_venue_admin_bar_edit_menu
function _eventorganiser_add_venue_admin_bar_edit_menu()
{
global $wp_admin_bar;
if (is_admin()) {
$current_screen = get_current_screen();
if ('event_page_venues' == $current_screen->base && isset($_GET['action']) && 'edit' == $_GET['action'] && ($tax = get_taxonomy('event-venue')) && $tax->public) {
$wp_admin_bar->add_menu(array('id' => 'view', 'title' => $tax->labels->view_item, 'href' => eo_get_venue_link($_GET['event-venue'])));
}
} else {
$current_object = get_queried_object();
if (!eo_is_venue()) {
return;
}
if (($tax = get_taxonomy($current_object->taxonomy)) && current_user_can($tax->cap->edit_terms)) {
$wp_admin_bar->add_menu(array('id' => 'edit', 'title' => $tax->labels->edit_item, 'href' => get_edit_term_link($current_object->term_id, $current_object->taxonomy)));
}
}
}
示例13: get_edit_link
/**
* Get link to edit a term
* @param int $value term id
* @return string
*/
public function get_edit_link($value)
{
$term = $this->get_term($value);
return sprintf('<a target="_new" class="fm-autocomplete-edit-link %s" href="%s">%s</a>', empty($value) ? 'fm-hidden' : '', empty($value) ? '#' : esc_url(get_edit_term_link($term->term_id, $term->taxonomy)), esc_html__('Edit', 'fieldmanager'));
}
示例14: wp_admin_bar_edit_menu
/**
* Provide an edit link for posts and terms.
*
* @since 3.1.0
*/
function wp_admin_bar_edit_menu($wp_admin_bar)
{
global $tag, $wp_the_query;
if (is_admin()) {
$current_screen = get_current_screen();
$post = get_post();
if ('post' == $current_screen->base && 'add' != $current_screen->action && ($post_type_object = get_post_type_object($post->post_type)) && current_user_can($post_type_object->cap->read_post, $post->ID) && $post_type_object->public && $post_type_object->show_in_admin_bar) {
$wp_admin_bar->add_menu(array('id' => 'view', 'title' => $post_type_object->labels->view_item, 'href' => get_permalink($post->ID)));
} elseif ('edit-tags' == $current_screen->base && isset($tag) && is_object($tag) && ($tax = get_taxonomy($tag->taxonomy)) && $tax->public) {
$wp_admin_bar->add_menu(array('id' => 'view', 'title' => $tax->labels->view_item, 'href' => get_term_link($tag)));
}
} else {
$current_object = $wp_the_query->get_queried_object();
if (empty($current_object)) {
return;
}
if (!empty($current_object->post_type) && ($post_type_object = get_post_type_object($current_object->post_type)) && current_user_can($post_type_object->cap->edit_post, $current_object->ID) && $post_type_object->show_ui && $post_type_object->show_in_admin_bar) {
$wp_admin_bar->add_menu(array('id' => 'edit', 'title' => $post_type_object->labels->edit_item, 'href' => get_edit_post_link($current_object->ID)));
} elseif (!empty($current_object->taxonomy) && ($tax = get_taxonomy($current_object->taxonomy)) && current_user_can($tax->cap->edit_terms) && $tax->show_ui) {
$wp_admin_bar->add_menu(array('id' => 'edit', 'title' => $tax->labels->edit_item, 'href' => get_edit_term_link($current_object->term_id, $current_object->taxonomy)));
}
}
}
示例15: column_name
function column_name($tag)
{
global $taxonomy, $tax, $post_type;
$default_term = get_option('default_' . $taxonomy);
$pad = str_repeat('— ', max(0, $this->level));
$name = apply_filters('term_name', $pad . ' ' . $tag->name, $tag);
$qe_data = get_term($tag->term_id, $taxonomy, OBJECT, 'edit');
$edit_link = get_edit_term_link($tag->term_id, $taxonomy, $post_type);
$out = '<strong><a class="row-title" href="' . $edit_link . '" title="' . esc_attr(sprintf(__('Edit “%s”'), $name)) . '">' . $name . '</a></strong><br />';
$actions = array();
if (current_user_can($tax->cap->edit_terms)) {
$actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>';
$actions['inline hide-if-no-js'] = '<a href="#" class="editinline">' . __('Quick Edit') . '</a>';
}
if (current_user_can($tax->cap->delete_terms) && $tag->term_id != $default_term) {
$actions['delete'] = "<a class='delete-tag' href='" . wp_nonce_url("edit-tags.php?action=delete&taxonomy={$taxonomy}&tag_ID={$tag->term_id}", 'delete-tag_' . $tag->term_id) . "'>" . __('Delete') . "</a>";
}
$actions = apply_filters('tag_row_actions', $actions, $tag);
$actions = apply_filters("{$taxonomy}_row_actions", $actions, $tag);
$out .= $this->row_actions($actions);
$out .= '<div class="hidden" id="inline_' . $qe_data->term_id . '">';
$out .= '<div class="name">' . $qe_data->name . '</div>';
$out .= '<div class="slug">' . apply_filters('editable_slug', $qe_data->slug) . '</div>';
$out .= '<div class="parent">' . $qe_data->parent . '</div></div></td>';
return $out;
}
开发者ID:Esleelkartea,项目名称:herramienta_para_autodiagnostico_ADEADA,代码行数:26,代码来源:class-wp-terms-list-table.php