function column_title($item) { $editHref = home_url() . '/wp-admin/post.php?post=' . $item->ID . '&action=edit'; //Build row actions $actions = array('edit' => '<a href="' . $editHref . '">' . __('Edit') . '</a>', 'delete' => "<a class='submitdelete' title='" . esc_attr(__('Move this item to the Trash')) . "' href='" . get_delete_post_link($item->ID) . "'>" . __('Trash') . "</a>"); return '<a class="row-title" href="' . home_url() . '/wp-admin/post.php?post=' . $item->ID . '&action=edit">' . $item->post_title . '</a>' . $this->row_actions($actions); }
/** * Add additional data to the response object */ private function addData() { $this->data['delete_link'] = get_delete_post_link($this->data['id'], '', true); $this->data['nav_status'] = isset($this->data['nav_status']) ? 'hide' : 'show'; $this->data['np_status'] = isset($this->data['nested_pages_status']) ? 'hide' : 'show'; $this->data['link_target'] = isset($this->data['link_target']) ? '_blank' : 'none'; }
public function column_post_title($item) { $actions = array('edit' => '<a class="" title="Edit Form" href="' . get_edit_post_link($item->ID) . '">Edit</a>', 'delete' => '<a class="submitdelete" title="Delete Form" href="' . get_delete_post_link($item->ID, '', true) . '">Delete</a>'); $form_title = empty($item->post_title) ? "(no title)" : $item->post_title; $title = '<strong><a class="row-title" title="Edit Form" href="' . get_edit_post_link($item->ID) . '">' . $form_title . '</a></strong>'; return sprintf('%1$s %2$s', $title, $this->row_actions($actions)); }
/** * Render Meta Box content. */ public function answers_meta_box_content() { $ans_args = array('post_type' => 'answer', 'post_status' => 'publish', 'post_parent' => get_the_ID(), 'showposts' => 10, 'orderby' => 'date', 'order' => 'DESC'); $ans_args = apply_filters('ap_meta_box_answers_query_args', $ans_args); $answers = get_posts($ans_args); if (!empty($answers)) { foreach ($answers as $ans) { ?> <div class="answer clearfix"> <div class="author"> <span><?php echo get_avatar($ans->post_author, 30); ?> </span> <strong><?php echo ap_user_display_name($ans->post_author); ?> </strong> </div> <div class="answer-content"> <div class="submitted-on"> <?php printf(__('%sAnswered about %s ago%s', 'ap'), '<span class="when">', '</span>', ap_human_time(get_the_time('U', $ans))); ?> </div> <p><?php echo $ans->post_content; ?> </p> <div class="row-actions"> <span><a href="<?php echo get_edit_post_link($ans->ID); ?> "><?php _e('Edit', 'ap'); ?> </a></span> <span> | <a href="#"><?php _e('Hide', 'ap'); ?> </a></span> <span class="delete vim-d vim-destructive"> | <a href="<?php echo get_delete_post_link($ans->ID); ?> "><?php _e('Trash', 'ap'); ?> </a></span> </div> </div> </div> <?php } } else { _e('No answers yet', 'ap'); } wp_reset_postdata(); }
function custom_publish_meta_box($post) { $slider_id = $post->ID; $post_status = get_post_status($slider_id); $delete_link = get_delete_post_link($slider_id); $nonce = wp_create_nonce('ssp_slider_nonce'); include muneeb_ssp_view_path(__FUNCTION__); }
function column_post_title($post) { $actions = array(); if (current_user_can($this->post_type_obj->cap->edit_post, $post)) { $actions['edit'] = sprintf('<a href="%s">%s</a>', esc_url(get_edit_post_link($post->ID)), esc_html($this->post_type_obj->labels->edit_item)); } if (current_user_can($this->post_type_obj->cap->delete_post, $post)) { $actions['delete'] = sprintf('<a href="%s">%s</a>', esc_url(get_delete_post_link($post->ID)), esc_html__('Trash', 'jetpack')); } $actions['view'] = sprintf('<a href="%s">%s</a>', esc_url(get_permalink($post->ID)), esc_html($this->post_type_obj->labels->view_item)); return wptexturize($post->post_title) . $this->row_actions($actions); }
/** * Save the item as a redirect post type */ private function saveRedirect() { $new_link = $this->post_update_repo->saveRedirect($this->data); if (!$new_link) { $this->sendErrorResponse(); } $this->data['post'] = $_POST; $this->data['post']['id'] = $new_link; $this->data['post']['content'] = esc_url($_POST['url']); $this->data['post']['delete_link'] = get_delete_post_link($new_link, '', true); $this->addExtras($new_link); $this->response = array('status' => 'success', 'message' => __('Link successfully updated', 'nestedpages'), 'post_data' => $this->data['post']); }
/** * Display the product tab actions meta box. * * Displays the product actions meta box - buttons for creating and deleting the tab * * @access public * @param object $post product post object */ function wc_tab_manager_product_tab_actions_meta_box($post) { ?> <style type="text/css"> #edit-slug-box, #major-publishing-actions, #minor-publishing-actions, #visibility, #submitdiv { display:none } .wc_product_tab_actions li { border-bottom: 1px solid #DDDDDD; border-top: 1px solid #FFFFFF; line-height: 1.6em; margin: 0; padding: 6px 0; } .wc_product_tab_actions li:last-child { border-bottom: 0 none; } </style> <ul class="wc_product_tab_actions"> <li class="wide"><input type="submit" class="button button-primary tips" name="publish" value="<?php _e('Save Tab', WC_Tab_Manager::TEXT_DOMAIN); ?> " data-tip="<?php _e('Save/update the tab', WC_Tab_Manager::TEXT_DOMAIN); ?> " /></li> <?php do_action('woocommerce_tab_manager_product_tab_actions', $post->ID); ?> <li class="wide"> <?php if (current_user_can("delete_post", $post->ID)) { if (!EMPTY_TRASH_DAYS) { $delete_text = __('Delete Permanently', WC_Tab_Manager::TEXT_DOMAIN); } else { $delete_text = __('Move to Trash', WC_Tab_Manager::TEXT_DOMAIN); } ?> <a class="submitdelete deletion" href="<?php echo esc_url(get_delete_post_link($post->ID)); ?> "><?php echo esc_attr($delete_text); ?> </a><?php } ?> </li> </ul> <?php }
/** * Get action links for this post. * * @param string $container_field Ignored. * @return array of action link HTML. */ function ui_get_action_links($container_field = '') { $actions = array(); if (current_user_can('edit_post', $this->container_id)) { $actions['edit'] = '<span class="edit"><a href="' . $this->get_edit_url() . '" title="' . esc_attr(__('Edit this post')) . '">' . __('Edit') . '</a>'; if (constant('EMPTY_TRASH_DAYS')) { $actions['trash'] = "<a class='submitdelete' title='" . esc_attr(__('Move this post to the Trash')) . "' href='" . get_delete_post_link($this->container_id) . "'>" . __('Trash') . "</a>"; } else { $actions['delete'] = "<a class='submitdelete' title='" . esc_attr(__('Delete this post permanently')) . "' href='" . wp_nonce_url(admin_url("post.php?action=delete&post=" . $this->container_id), 'delete-post_' . $this->container_id) . "' onclick=\"if ( confirm('" . esc_js(sprintf(__("You are about to delete this post '%s'\n 'Cancel' to stop, 'OK' to delete."), get_the_title($this->container_id))) . "') ) { return true;}return false;\">" . __('Delete') . "</a>"; } } $actions['view'] = '<span class="view"><a href="' . get_permalink($this->container_id) . '" title="' . esc_attr(sprintf(__('View "%s"', 'broken-link-checker'), get_the_title($this->container_id))) . '" rel="permalink">' . __('View') . '</a>'; return $actions; }
function _icl_trash_restore_prompt() { global $sitepress; if (isset($_GET['lang'])) { $post = get_post(intval($_GET['post'])); if ($post->post_status == 'trash') { $post_type_object = get_post_type_object($post->post_type); $ret = '<p>'; $ret .= sprintf(__('This translation is currently in the trash. You need to either <a href="%s">delete it permanently</a> or <a href="%s">restore</a> it in order to continue.'), get_delete_post_link($post->ID, '', true), wp_nonce_url(admin_url(sprintf($post_type_object->_edit_link . '&action=untrash', $post->ID)), 'untrash-' . $post->post_type . '_' . $post->ID)); $ret .= '</p>'; wp_die($ret); } } }
/** * Display edit post link for post. * * @since 1.0.0 * * @param string $link Optional. Anchor text. * @param string $before Optional. Display before edit link. * @param string $after Optional. Display after edit link. * @param int $id Optional. Post ID. */ function delete_post_link($link = null, $before = '', $after = '', $id = 0) { if (!($post = get_post($id))) { return; } if (!($url = get_delete_post_link($post->ID))) { return; } if (null === $link) { $link = __('Delete This', 'pronamic_framework'); } $post_type_obj = get_post_type_object($post->post_type); $link = '<a class="post-delete-link" href="' . $url . '">' . $link . '</a>'; echo $before . apply_filters('delete_post_link', $link, $post->ID) . $after; }
/** * Add action links below question/answer content in wp post list. * @param string $column Current column name. * @param integer $post_id Current post id. */ public function answer_row_actions($column, $post_id) { global $post, $mode; if ('answer_content' != $column) { return; } $question = get_post($post->post_parent); echo '<a href="' . get_permalink($post->post_parent) . '" class="row-title">' . $question->post_title . '</a>'; $content = get_the_excerpt(); // Get the first 80 words from the content and added to the $abstract variable. preg_match('/^([^.!?\\s]*[\\.!?\\s]+){0,40}/', strip_tags($content), $abstract); // Pregmatch will return an array and the first 80 chars will be in the first element echo $abstract[0] . '...'; // First set up some variables $actions = array(); $post_type_object = get_post_type_object($post->post_type); $can_edit_post = current_user_can($post_type_object->cap->edit_post, $post->ID); // Actions to delete/trash. if (current_user_can($post_type_object->cap->delete_post, $post->ID)) { if ('trash' == $post->post_status) { $_wpnonce = wp_create_nonce('untrash-post_' . $post_id); $url = admin_url('post.php?post=' . $post_id . '&action=untrash&_wpnonce=' . $_wpnonce); $actions['untrash'] = "<a title='" . esc_attr(__('Restore this item from the Trash', 'anspress-question-answer')) . "' href='" . $url . "'>" . __('Restore', 'anspress-question-answer') . '</a>'; } elseif (EMPTY_TRASH_DAYS) { $actions['trash'] = "<a class='submitdelete' title='" . esc_attr(__('Move this item to the Trash', 'anspress-question-answer')) . "' href='" . get_delete_post_link($post->ID) . "'>" . __('Trash', 'anspress-question-answer') . '</a>'; } if ('trash' == $post->post_status || !EMPTY_TRASH_DAYS) { $actions['delete'] = "<a class='submitdelete' title='" . esc_attr(__('Delete this item permanently', 'anspress-question-answer')) . "' href='" . get_delete_post_link($post->ID, '', true) . "'>" . __('Delete Permanently', 'anspress-question-answer') . '</a>'; } } if ($can_edit_post) { $actions['edit'] = '<a href="' . get_edit_post_link($post->ID, '', true) . '" title="' . esc_attr(sprintf(__('Edit “%s”', 'anspress-question-answer'), $post->title)) . '" rel="permalink">' . __('Edit', 'anspress-question-answer') . '</a>'; } // Actions to view/preview. if (in_array($post->post_status, array('pending', 'draft', 'future')) && $can_edit_post) { $actions['view'] = '<a href="' . esc_url(add_query_arg('preview', 'true', get_permalink($post->ID))) . '" title="' . esc_attr(sprintf(__('Preview “%s”', 'anspress-question-answer'), $post->title)) . '" rel="permalink">' . __('Preview', 'anspress-question-answer') . '</a>'; } elseif ('trash' != $post->post_status) { $actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . esc_attr(__('View “%s” question', 'anspress-question-answer')) . '" rel="permalink">' . __('View', 'anspress-question-answer') . '</a>'; } if (ap_flagged_post_meta($post->ID)) { $actions['flag'] = '<a href="#" data-query="ap_clear_flag::' . wp_create_nonce('clear_flag_' . $post->ID) . '::' . $post->ID . '" class="ap-ajax-btn flag-clear" data-cb="afterFlagClear">' . __('Clear flag', 'anspress-question-answer') . '</a>'; } // Echo the 'actions' HTML, let WP_List_Table do the hard work. $WP_List_Table = new WP_List_Table(); echo $WP_List_Table->row_actions($actions); }
/** * Publish meta box */ public function job_application_save($post) { $statuses = get_job_application_statuses(); ?> <div class="submitbox" id="submitpost"> <div id="minor-publishing"> <div id="misc-publishing-actions"> <div class="misc-pub-section misc-pub-post-status"> <div id="post-status-select"> <select name='post_status' id='post_status'> <?php foreach ($statuses as $key => $label) { $selected = selected($post->post_status, $key, false); echo "<option{$selected} value='" . esc_attr($key) . "'>" . esc_html($label) . "</option>"; } ?> </select> </div> </div> </div> </div> <div id="major-publishing-actions"> <div id="delete-action"> <a class="submitdelete deletion" href="<?php echo get_delete_post_link($post->ID); ?> "><?php _e('Move to Trash'); ?> </a> </div> <div id="publishing-action"> <span class="spinner"></span> <input name="save" class="button button-primary" type="submit" value="<?php _e('Save', 'wp-job-manager-applications'); ?> "> </div> <div class="clear"></div> </div> </div> <?php }
/** * @see CPAC_Column_Actions::get_actions() * @since 2.2.6 */ public function get_actions($item_id) { $actions = array(); $post = get_post($item_id); $title = _draft_or_post_title(); $post_type_object = get_post_type_object($post->post_type); $can_edit_post = current_user_can($post_type_object->cap->edit_post, $post->ID); $quickedit_enabled = false; $stored_columns = $this->get_storage_model()->get_stored_columns(); foreach ($stored_columns as $column) { if ($column['type'] == 'title') { $quickedit_enabled = true; } } // taken from Wordpress core if ($can_edit_post && 'trash' != $post->post_status) { $actions['edit'] = '<a href="' . get_edit_post_link($post->ID, true) . '" title="' . esc_attr(__('Edit this item')) . '">' . __('Edit') . '</a>'; if ($quickedit_enabled) { $actions['inline hide-if-no-js'] = '<a href="#" class="editinline" title="' . esc_attr(__('Edit this item inline')) . '">' . __('Quick Edit') . '</a>'; } } if (current_user_can($post_type_object->cap->delete_post, $post->ID)) { if ('trash' == $post->post_status) { $actions['untrash'] = "<a title='" . esc_attr(__('Restore this item from the Trash')) . "' href='" . wp_nonce_url(admin_url(sprintf($post_type_object->_edit_link . '&action=untrash', $post->ID)), 'untrash-post_' . $post->ID) . "'>" . __('Restore') . "</a>"; } elseif (EMPTY_TRASH_DAYS) { $actions['trash'] = "<a class='submitdelete' title='" . esc_attr(__('Move this item to the Trash')) . "' href='" . get_delete_post_link($post->ID) . "'>" . __('Trash') . "</a>"; } if ('trash' == $post->post_status || !EMPTY_TRASH_DAYS) { $actions['delete'] = "<a class='submitdelete' title='" . esc_attr(__('Delete this item permanently')) . "' href='" . get_delete_post_link($post->ID, '', true) . "'>" . __('Delete Permanently') . "</a>"; } } if ($post_type_object->public) { if (in_array($post->post_status, array('pending', 'draft', 'future'))) { if ($can_edit_post) { $actions['view'] = '<a href="' . esc_url(add_query_arg('preview', 'true', get_permalink($post->ID))) . '" title="' . esc_attr(sprintf(__('Preview “%s”'), $title)) . '" rel="permalink">' . __('Preview') . '</a>'; } } elseif ('trash' != $post->post_status) { $actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . esc_attr(sprintf(__('View “%s”'), $title)) . '" rel="permalink">' . __('View') . '</a>'; } } return $actions; }
/** * Draft state markup for major actions. */ function annowf_major_action_draft_markup() { global $anno_post_save; $post_id = anno_get_post_id(); if (anno_user_can('trash_post')) { $wrap_class = ''; ?> <div id="delete-action"> <a class="submitdelete deletion" href="<?php echo get_delete_post_link($post_id); ?> "><?php _ex('Move To Trash', 'Publishing box trash action link text', 'anno'); ?> </a> </div> <?php } else { $wrap_class = ' class="center-wrap"'; } ?> <div id="publishing-action"<?php echo $wrap_class; ?> > <img src="<?php echo esc_url(admin_url('images/wpspin_light.gif')); ?> " class="ajax-loading" id="ajax-loading" alt="" /> <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e($anno_post_save['review']); ?> " /> <?php submit_button($anno_post_save['review'], 'primary', 'publish', false, array('tabindex' => '5', 'accesskey' => 'p')); ?> </div> <div class="clear"></div> <?php }
function o2_get_default_post_actions($actions = false, $post_ID = false) { if (false === $actions) { $actions = array(); } // Reply $logged_in_requirement_satisfied = get_option('comment_registration') ? is_user_logged_in() : true; if (comments_open($post_ID) && !post_password_required($post_ID) && $logged_in_requirement_satisfied) { $actions[20] = array('action' => 'reply', 'href' => get_permalink($post_ID) . '#respond', 'classes' => array('o2-post-reply', 'o2-reply'), 'rel' => false, 'initialState' => 'default'); } // Scroll to Comments (Mobile) $actions[25] = array('action' => 'scrolltocomments', 'href' => get_permalink($post_ID), 'classes' => array('o2-scroll-to-comments'), 'rel' => false, 'initialState' => 'default'); // Edit if (current_user_can('edit_post', $post_ID)) { $actions[30] = array('action' => 'edit', 'href' => get_edit_post_link($post_ID), 'classes' => array('edit-post-link', 'o2-edit'), 'rel' => $post_ID, 'initialState' => 'default'); } // Trash if (current_user_can('edit_post', $post_ID)) { $actions[100] = array('action' => 'trash', 'href' => get_delete_post_link($post_ID), 'classes' => array('trash-post-link', 'o2-trash', 'o2-actions-border-top', 'o2-warning-hover'), 'rel' => $post_ID, 'initialState' => 'default'); } // Shortlink $actions[40] = array('action' => 'shortlink', 'href' => wp_get_shortlink($post_ID, 'post'), 'classes' => array('short-link', 'o2-short-link'), 'rel' => false, 'initialState' => 'default'); return $actions; }
/** * Custom columns content of visitors * * @access public * @return void */ function cx_visitors_cols_content($col, $post_ID) { switch ($col) { case '_title': echo '<strong><a class="row-title" href="' . get_permalink() . '">' . get_the_title() . '</a></strong>'; echo "<div class='row-actions'><span class='trash'><a class='submitdelete' title='" . esc_attr(__('Delete this item permanently')) . "' href='" . get_delete_post_link($post_ID, '', true) . "'>" . __('Delete Permanently', 'cx') . "</a></span></div>"; break; case 'email': $email = get_post_meta($post_ID, 'Email', 1); echo '<a href="mailto:' . $email . '">' . $email . '</a>'; break; case 'phone': echo get_post_meta($post_ID, 'Phone', 1); break; case 'details': echo get_post_meta($post_ID, 'OS', 1) . ', '; echo get_post_meta($post_ID, 'Browser', 1) . '<br>'; echo '<strong>IP:</strong> ' . get_post_meta($post_ID, 'IP Address', 1); break; case 'last_login': echo get_the_modified_date() . ' ' . get_the_modified_time(); break; } }
/** * Generates and displays row action links. * * @since 4.3.0 * @access protected * * @param object $post Post being acted upon. * @param string $column_name Current column name. * @param string $primary Primary column name. * @return string Row actions output for posts. */ protected function handle_row_actions($post, $column_name, $primary) { if ($primary !== $column_name) { return ''; } $post_type_object = get_post_type_object($post->post_type); $can_edit_post = current_user_can('edit_post', $post->ID); $actions = array(); $title = _draft_or_post_title(); if ($can_edit_post && 'trash' != $post->post_status) { $actions['edit'] = sprintf('<a href="%s" aria-label="%s">%s</a>', get_edit_post_link($post->ID), esc_attr(sprintf(__('Edit “%s”'), $title)), __('Edit')); $actions['inline hide-if-no-js'] = sprintf('<a href="#" class="editinline" aria-label="%s">%s</a>', esc_attr(sprintf(__('Quick edit “%s” inline'), $title)), __('Quick Edit')); } if (current_user_can('delete_post', $post->ID)) { if ('trash' === $post->post_status) { $actions['untrash'] = sprintf('<a href="%s" aria-label="%s">%s</a>', wp_nonce_url(admin_url(sprintf($post_type_object->_edit_link . '&action=untrash', $post->ID)), 'untrash-post_' . $post->ID), esc_attr(sprintf(__('Restore “%s” from the Trash'), $title)), __('Restore')); } elseif (EMPTY_TRASH_DAYS) { $actions['trash'] = sprintf('<a href="%s" class="submitdelete" aria-label="%s">%s</a>', get_delete_post_link($post->ID), esc_attr(sprintf(__('Move “%s” to the Trash'), $title)), _x('Trash', 'verb')); } if ('trash' === $post->post_status || !EMPTY_TRASH_DAYS) { $actions['delete'] = sprintf('<a href="%s" class="submitdelete" aria-label="%s">%s</a>', get_delete_post_link($post->ID, '', true), esc_attr(sprintf(__('Delete “%s” permanently'), $title)), __('Delete Permanently')); } } if (is_post_type_viewable($post_type_object)) { if (in_array($post->post_status, array('pending', 'draft', 'future'))) { if ($can_edit_post) { $unpublished_link = set_url_scheme(get_permalink($post)); $preview_link = get_preview_post_link($post, array(), $unpublished_link); $actions['view'] = sprintf('<a href="%s" rel="permalink" aria-label="%s">%s</a>', esc_url($preview_link), esc_attr(sprintf(__('Preview “%s”'), $title)), __('Preview')); } } elseif ('trash' != $post->post_status) { $actions['view'] = sprintf('<a href="%s" rel="permalink" aria-label="%s">%s</a>', get_permalink($post->ID), esc_attr(sprintf(__('View “%s”'), $title)), __('View')); } } if (is_post_type_hierarchical($post->post_type)) { /** * Filter the array of row action links on the Pages list table. * * The filter is evaluated only for hierarchical post types. * * @since 2.8.0 * * @param array $actions An array of row action links. Defaults are * 'Edit', 'Quick Edit', 'Restore, 'Trash', * 'Delete Permanently', 'Preview', and 'View'. * @param WP_Post $post The post object. */ $actions = apply_filters('page_row_actions', $actions, $post); } else { /** * Filter the array of row action links on the Posts list table. * * The filter is evaluated only for non-hierarchical post types. * * @since 2.8.0 * * @param array $actions An array of row action links. Defaults are * 'Edit', 'Quick Edit', 'Restore, 'Trash', * 'Delete Permanently', 'Preview', and 'View'. * @param WP_Post $post The post object. */ $actions = apply_filters('post_row_actions', $actions, $post); } return $this->row_actions($actions); }
/** * Return title column * @param object $webhook * @return string */ public function column_title($webhook) { $the_webhook = $this->get_webbook_object($webhook); $edit_link = admin_url('admin.php?page=wc-settings&tab=api&section=webhooks&edit-webhook=' . $the_webhook->id); $title = _draft_or_post_title($the_webhook->get_post_data()); $post_type_object = get_post_type_object($the_webhook->get_post_data()->post_type); $post_status = $the_webhook->get_post_data()->post_status; // Title $output = '<strong>'; if ('trash' == $post_status) { $output .= esc_html($title); } else { $output .= '<a href="' . esc_url($edit_link) . '" class="row-title">' . esc_html($title) . '</a>'; } $output .= '</strong>'; // Get actions $actions = array('id' => sprintf(__('ID: %d', 'woocommerce'), $the_webhook->id)); if (current_user_can($post_type_object->cap->edit_post, $the_webhook->id) && 'trash' !== $post_status) { $actions['edit'] = '<a href="' . esc_url($edit_link) . '">' . __('Edit', 'woocommerce') . '</a>'; } if (current_user_can($post_type_object->cap->delete_post, $the_webhook->id)) { if ('trash' == $post_status) { $actions['untrash'] = '<a title="' . esc_attr__('Restore this item from the Trash', 'woocommerce') . '" href="' . wp_nonce_url(admin_url(sprintf($post_type_object->_edit_link . '&action=untrash', $the_webhook->id)), 'untrash-post_' . $the_webhook->id) . '">' . __('Restore', 'woocommerce') . '</a>'; } elseif (EMPTY_TRASH_DAYS) { $actions['trash'] = '<a class="submitdelete" title="' . esc_attr(__('Move this item to the Trash', 'woocommerce')) . '" href="' . get_delete_post_link($the_webhook->id) . '">' . __('Trash', 'woocommerce') . '</a>'; } if ('trash' == $post_status || !EMPTY_TRASH_DAYS) { $actions['delete'] = '<a class="submitdelete" title="' . esc_attr(__('Delete this item permanently', 'woocommerce')) . '" href="' . get_delete_post_link($the_webhook->id, '', true) . '">' . __('Delete Permanently', 'woocommerce') . '</a>'; } } $actions = apply_filters('post_row_actions', $actions, $the_webhook->get_post_data()); $row_actions = array(); foreach ($actions as $action => $link) { $row_actions[] = '<span class="' . esc_attr($action) . '">' . $link . '</span>'; } $output .= '<div class="row-actions">' . implode(' | ', $row_actions) . '</div>'; return $output; }
/** * Custom Columns for Products page * * @access public * @param mixed $column * @return void */ function woocommerce_custom_product_columns($column) { global $post, $woocommerce, $the_product; if (empty($the_product) || $the_product->id != $post->ID) { $the_product = get_product($post); } switch ($column) { case "thumb": echo '<a href="' . get_edit_post_link($post->ID) . '">' . $the_product->get_image() . '</a>'; break; case "name": $edit_link = get_edit_post_link($post->ID); $title = _draft_or_post_title(); $post_type_object = get_post_type_object($post->post_type); $can_edit_post = current_user_can($post_type_object->cap->edit_post, $post->ID); echo '<strong><a class="row-title" href="' . $edit_link . '">' . $title . '</a>'; _post_states($post); echo '</strong>'; if ($post->post_parent > 0) { echo ' ← <a href="' . get_edit_post_link($post->post_parent) . '">' . get_the_title($post->post_parent) . '</a>'; } // Excerpt view if (isset($_GET['mode']) && $_GET['mode'] == 'excerpt') { echo apply_filters('the_excerpt', $post->post_excerpt); } // Get actions $actions = array(); $actions['id'] = 'ID: ' . $post->ID; if ($can_edit_post && 'trash' != $post->post_status) { $actions['edit'] = '<a href="' . get_edit_post_link($post->ID, true) . '" title="' . esc_attr(__('Edit this item')) . '">' . __('Edit') . '</a>'; $actions['inline hide-if-no-js'] = '<a href="#" class="editinline" title="' . esc_attr(__('Edit this item inline')) . '">' . __('Quick Edit') . '</a>'; } if (current_user_can($post_type_object->cap->delete_post, $post->ID)) { if ('trash' == $post->post_status) { $actions['untrash'] = "<a title='" . esc_attr(__('Restore this item from the Trash')) . "' href='" . wp_nonce_url(admin_url(sprintf($post_type_object->_edit_link . '&action=untrash', $post->ID)), 'untrash-post_' . $post->ID) . "'>" . __('Restore') . "</a>"; } elseif (EMPTY_TRASH_DAYS) { $actions['trash'] = "<a class='submitdelete' title='" . esc_attr(__('Move this item to the Trash')) . "' href='" . get_delete_post_link($post->ID) . "'>" . __('Trash') . "</a>"; } if ('trash' == $post->post_status || !EMPTY_TRASH_DAYS) { $actions['delete'] = "<a class='submitdelete' title='" . esc_attr(__('Delete this item permanently')) . "' href='" . get_delete_post_link($post->ID, '', true) . "'>" . __('Delete Permanently') . "</a>"; } } if ($post_type_object->public) { if (in_array($post->post_status, array('pending', 'draft', 'future'))) { if ($can_edit_post) { $actions['view'] = '<a href="' . esc_url(add_query_arg('preview', 'true', get_permalink($post->ID))) . '" title="' . esc_attr(sprintf(__('Preview “%s”'), $title)) . '" rel="permalink">' . __('Preview') . '</a>'; } } elseif ('trash' != $post->post_status) { $actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . esc_attr(sprintf(__('View “%s”'), $title)) . '" rel="permalink">' . __('View') . '</a>'; } } $actions = apply_filters('post_row_actions', $actions, $post); echo '<div class="row-actions">'; $i = 0; $action_count = sizeof($actions); foreach ($actions as $action => $link) { ++$i; $i == $action_count ? $sep = '' : ($sep = ' | '); echo "<span class='{$action}'>{$link}{$sep}</span>"; } echo '</div>'; get_inline_data($post); /* Custom inline data for woocommerce */ echo ' <div class="hidden" id="woocommerce_inline_' . $post->ID . '"> <div class="menu_order">' . $post->menu_order . '</div> <div class="sku">' . $the_product->sku . '</div> <div class="regular_price">' . $the_product->regular_price . '</div> <div class="sale_price">' . $the_product->sale_price . '</div> <div class="weight">' . $the_product->weight . '</div> <div class="length">' . $the_product->length . '</div> <div class="width">' . $the_product->width . '</div> <div class="height">' . $the_product->height . '</div> <div class="visibility">' . $the_product->visibility . '</div> <div class="stock_status">' . $the_product->stock_status . '</div> <div class="stock">' . $the_product->stock . '</div> <div class="manage_stock">' . $the_product->manage_stock . '</div> <div class="featured">' . $the_product->featured . '</div> <div class="product_type">' . $the_product->product_type . '</div> <div class="product_is_virtual">' . $the_product->virtual . '</div> </div> '; break; case "sku": if ($the_product->get_sku()) { echo $the_product->get_sku(); } else { echo '<span class="na">–</span>'; } break; case "product_type": if ($the_product->product_type == 'grouped') { echo '<span class="product-type tips ' . $the_product->product_type . '" data-tip="' . __('Grouped', 'woocommerce') . '"></span>'; } elseif ($the_product->product_type == 'external') { echo '<span class="product-type tips ' . $the_product->product_type . '" data-tip="' . __('External/Affiliate', 'woocommerce') . '"></span>'; } elseif ($the_product->product_type == 'simple') { if ($the_product->is_virtual()) { echo '<span class="product-type tips virtual" data-tip="' . __('Virtual', 'woocommerce') . '"></span>'; } elseif ($the_product->is_downloadable()) { echo '<span class="product-type tips downloadable" data-tip="' . __('Downloadable', 'woocommerce') . '"></span>'; } else { echo '<span class="product-type tips ' . $the_product->product_type . '" data-tip="' . __('Simple', 'woocommerce') . '"></span>'; } } elseif ($the_product->product_type == 'variable') { echo '<span class="product-type tips ' . $the_product->product_type . '" data-tip="' . __('Variable', 'woocommerce') . '"></span>'; } else { // Assuming that we have other types in future echo '<span class="product-type tips ' . $the_product->product_type . '" data-tip="' . ucwords($the_product->product_type) . '"></span>'; } break; case "price": if ($the_product->get_price_html()) { echo $the_product->get_price_html(); } else { echo '<span class="na">–</span>'; } break; case "product_cat": case "product_tag": if (!($terms = get_the_terms($post->ID, $column))) { echo '<span class="na">–</span>'; } else { foreach ($terms as $term) { $termlist[] = '<a href="' . admin_url('edit.php?' . $column . '=' . $term->slug . '&post_type=product') . ' ">' . $term->name . '</a>'; } echo implode(', ', $termlist); } break; case 'featured': $url = wp_nonce_url(admin_url('admin-ajax.php?action=woocommerce-feature-product&product_id=' . $post->ID), 'woocommerce-feature-product'); echo '<a href="' . $url . '" title="' . __('Toggle featured', 'woocommerce') . '">'; if ($the_product->is_featured()) { echo '<img src="' . $woocommerce->plugin_url() . '/assets/images/featured.png" alt="' . __('yes', 'woocommerce') . '" height="14" width="14" />'; } else { echo '<img src="' . $woocommerce->plugin_url() . '/assets/images/featured-off.png" alt="' . __('no', 'woocommerce') . '" height="14" width="14" />'; } echo '</a>'; break; case "is_in_stock": if ($the_product->is_in_stock()) { echo '<mark class="instock">' . __('In stock', 'woocommerce') . '</mark>'; } else { echo '<mark class="outofstock">' . __('Out of stock', 'woocommerce') . '</mark>'; } if ($the_product->managing_stock()) { echo ' × ' . $the_product->get_total_stock(); } break; } }
/** * Output the metabox. * * @param WP_Post $post */ public static function output($post) { global $theorder; // This is used by some callbacks attached to hooks such as woocommerce_order_actions which rely on the global to determine if actions should be displayed for certain orders. if (!is_object($theorder)) { $theorder = wc_get_order($post->ID); } $order_type_object = get_post_type_object($post->post_type); ?> <ul class="order_actions submitbox"> <?php do_action('woocommerce_order_actions_start', $post->ID); ?> <li class="wide" id="actions"> <select name="wc_order_action"> <option value=""><?php _e('Actions', 'woocommerce'); ?> </option> <?php $mailer = WC()->mailer(); $available_emails = apply_filters('woocommerce_resend_order_emails_available', array('new_order', 'cancelled_order', 'customer_processing_order', 'customer_completed_order', 'customer_invoice', 'customer_refunded_order')); $mails = $mailer->get_emails(); if (!empty($mails) && !empty($available_emails)) { ?> <optgroup label="<?php esc_attr_e('Resend order emails', 'woocommerce'); ?> "> <?php foreach ($mails as $mail) { if (in_array($mail->id, $available_emails) && 'no' !== $mail->enabled) { echo '<option value="send_email_' . esc_attr($mail->id) . '">' . sprintf(__('Resend %s', 'woocomerce'), esc_html($mail->title)) . '</option>'; } } ?> </optgroup> <?php } ?> <option value="regenerate_download_permissions"><?php _e('Regenerate download permissions', 'woocommerce'); ?> </option> <?php foreach (apply_filters('woocommerce_order_actions', array()) as $action => $title) { ?> <option value="<?php echo $action; ?> "><?php echo $title; ?> </option> <?php } ?> </select> <button class="button wc-reload"><span><?php _e('Apply', 'woocommerce'); ?> </span></button> </li> <li class="wide"> <div id="delete-action"><?php if (current_user_can('delete_post', $post->ID)) { if (!EMPTY_TRASH_DAYS) { $delete_text = __('Delete permanently', 'woocommerce'); } else { $delete_text = __('Move to trash', 'woocommerce'); } ?> <a class="submitdelete deletion" href="<?php echo esc_url(get_delete_post_link($post->ID)); ?> "><?php echo $delete_text; ?> </a><?php } ?> </div> <input type="submit" class="button save_order button-primary tips" name="save" value="<?php printf(__('Save %s', 'woocommerce'), strtolower($order_type_object->labels->singular_name)); ?> " data-tip="<?php printf(__('Save/update the %s', 'woocommerce'), strtolower($order_type_object->labels->singular_name)); ?> " /> </li> <?php do_action('woocommerce_order_actions_end', $post->ID); ?> </ul> <?php }
?> <?php } ?> <tr valign="top"> <td colspan="2" scope="row" style="padding-left: 0;"> <p class="submit"> <input type="submit" class="button button-primary button-large" name="save" id="publish" accesskey="p" value="<?php _e('Save Webhook', 'woocommerce'); ?> " /> <?php if (current_user_can('delete_post', $webhook->id)) { ?> <a style="color: #a00; text-decoration: none; margin-left: 10px;" href="<?php echo esc_url(get_delete_post_link($webhook->id)); ?> "><?php echo !EMPTY_TRASH_DAYS ? __('Delete Permanently', 'woocommerce') : __('Move to Trash', 'woocommerce'); ?> </a> <?php } ?> </p> </td> </tr> </tbody> </table> </div>
/** * Get column value of post actions * * This part is copied from the Posts List Table class * * @since 1.4.2 */ protected function get_column_value_actions($post_id) { $actions = array(); $post = get_post($post_id); $title = _draft_or_post_title(); $post_type_object = get_post_type_object($post->post_type); $can_edit_post = current_user_can($post_type_object->cap->edit_post, $post->ID); if ($can_edit_post && 'trash' != $post->post_status) { $actions['edit'] = '<a href="' . get_edit_post_link($post->ID, true) . '" title="' . esc_attr(__('Edit this item')) . '">' . __('Edit') . '</a>'; $actions['inline hide-if-no-js'] = '<a href="#" class="editinline" title="' . esc_attr(__('Edit this item inline')) . '">' . __('Quick Edit') . '</a>'; } if (current_user_can($post_type_object->cap->delete_post, $post->ID)) { if ('trash' == $post->post_status) { $actions['untrash'] = "<a title='" . esc_attr(__('Restore this item from the Trash')) . "' href='" . wp_nonce_url(admin_url(sprintf($post_type_object->_edit_link . '&action=untrash', $post->ID)), 'untrash-' . $post->post_type . '_' . $post->ID) . "'>" . __('Restore') . "</a>"; } elseif (EMPTY_TRASH_DAYS) { $actions['trash'] = "<a class='submitdelete' title='" . esc_attr(__('Move this item to the Trash')) . "' href='" . get_delete_post_link($post->ID) . "'>" . __('Trash') . "</a>"; } if ('trash' == $post->post_status || !EMPTY_TRASH_DAYS) { $actions['delete'] = "<a class='submitdelete' title='" . esc_attr(__('Delete this item permanently')) . "' href='" . get_delete_post_link($post->ID, '', true) . "'>" . __('Delete Permanently') . "</a>"; } } if ($post_type_object->public) { if (in_array($post->post_status, array('pending', 'draft', 'future'))) { if ($can_edit_post) { $actions['view'] = '<a href="' . esc_url(add_query_arg('preview', 'true', get_permalink($post->ID))) . '" title="' . esc_attr(sprintf(__('Preview “%s”'), $title)) . '" rel="permalink">' . __('Preview') . '</a>'; } } elseif ('trash' != $post->post_status) { $actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . esc_attr(sprintf(__('View “%s”'), $title)) . '" rel="permalink">' . __('View') . '</a>'; } } return implode(' | ', $actions); }
/** * Generates and displays row action links. * * @since 4.3.0 * @access protected * * @param object $post Post being acted upon. * @param string $column_name Current column name. * @param string $primary Primary column name. * @return string Row actions output for posts. */ protected function handle_row_actions($post, $column_name, $primary) { if ($primary !== $column_name) { return ''; } $post_type_object = get_post_type_object($post->post_type); $can_edit_post = current_user_can('edit_post', $post->ID); $actions = array(); if ($can_edit_post && 'trash' != $post->post_status) { $actions['edit'] = '<a href="' . get_edit_post_link($post->ID) . '" title="' . esc_attr__('Edit this item') . '">' . __('Edit') . '</a>'; $actions['inline hide-if-no-js'] = '<a href="#" class="editinline" title="' . esc_attr__('Edit this item inline') . '">' . __('Quick Edit') . '</a>'; } if (current_user_can('delete_post', $post->ID)) { if ('trash' == $post->post_status) { $actions['untrash'] = "<a title='" . esc_attr__('Restore this item from the Trash') . "' href='" . wp_nonce_url(admin_url(sprintf($post_type_object->_edit_link . '&action=untrash', $post->ID)), 'untrash-post_' . $post->ID) . "'>" . __('Restore') . "</a>"; } elseif (EMPTY_TRASH_DAYS) { $actions['trash'] = "<a class='submitdelete' title='" . esc_attr__('Move this item to the Trash') . "' href='" . get_delete_post_link($post->ID) . "'>" . __('Trash') . "</a>"; } if ('trash' == $post->post_status || !EMPTY_TRASH_DAYS) { $actions['delete'] = "<a class='submitdelete' title='" . esc_attr__('Delete this item permanently') . "' href='" . get_delete_post_link($post->ID, '', true) . "'>" . __('Delete Permanently') . "</a>"; } } if (is_post_type_viewable($post_type_object)) { $title = _draft_or_post_title(); if (in_array($post->post_status, array('pending', 'draft', 'future'))) { if ($can_edit_post) { $preview_link = set_url_scheme(get_permalink($post->ID)); /** This filter is documented in wp-admin/includes/meta-boxes.php */ $preview_link = apply_filters('preview_post_link', add_query_arg('preview', 'true', $preview_link), $post); $actions['view'] = '<a href="' . esc_url($preview_link) . '" title="' . esc_attr(sprintf(__('Preview “%s”'), $title)) . '" rel="permalink">' . __('Preview') . '</a>'; } } elseif ('trash' != $post->post_status) { $actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . esc_attr(sprintf(__('View “%s”'), $title)) . '" rel="permalink">' . __('View') . '</a>'; } } if (is_post_type_hierarchical($post->post_type)) { /** * Filter the array of row action links on the Pages list table. * * The filter is evaluated only for hierarchical post types. * * @since 2.8.0 * * @param array $actions An array of row action links. Defaults are * 'Edit', 'Quick Edit', 'Restore, 'Trash', * 'Delete Permanently', 'Preview', and 'View'. * @param WP_Post $post The post object. */ $actions = apply_filters('page_row_actions', $actions, $post); } else { /** * Filter the array of row action links on the Posts list table. * * The filter is evaluated only for non-hierarchical post types. * * @since 2.8.0 * * @param array $actions An array of row action links. Defaults are * 'Edit', 'Quick Edit', 'Restore, 'Trash', * 'Delete Permanently', 'Preview', and 'View'. * @param WP_Post $post The post object. */ $actions = apply_filters('post_row_actions', $actions, $post); } return $this->row_actions($actions); }
/** * Output our field editing metabox to the CPT editing page. * * @access public * @since 2.7 * @return void */ public function save_sub_metabox($post) { $date_submitted = apply_filters('nf_edit_sub_date_submitted', date('M j, Y @ h:i', strtotime($post->post_date)), $post->ID); $date_modified = apply_filters('nf_edit_sub_date_modified', date('M j, Y @ h:i', strtotime($post->post_modified)), $post->ID); if ($post->post_author != 0) { $user_data = get_userdata($post->post_author); $first_name = $user_data->first_name; $last_name = $user_data->last_name; if ($first_name != '' && $last_name != '') { $name = $first_name . ' ' . $last_name; } else { if ($user_data->display_name != '') { $name = $user_data->display_name; } else { $name = $user_data->user_login; } } $name = apply_filters('nf_edit_sub_username', $name, $post->post_author); } $form_id = Ninja_Forms()->sub($post->ID)->form_id; $form = ninja_forms_get_form_by_id($form_id); $form_title = $form['data']['form_title']; ?> <input type="hidden" name="nf_edit_sub" value="1"> <div class="submitbox" id="submitpost"> <div id="minor-publishing"> <div id="misc-publishing-actions"> <div class="misc-pub-section misc-pub-post-status"> <label for="post_status"><?php _e('#', 'ninja-forms'); ?> :</label> <span id="sub-seq-num-display"><?php echo Ninja_Forms()->sub($post->ID)->get_seq_num(); ?> </span> </div> <div class="misc-pub-section misc-pub-post-status"> <label for="post_status"><?php _e('Status', 'ninja-forms'); ?> :</label> <span id="sub-status-display"><?php echo apply_filters('nf_sub_edit_status', __('Submitted', 'ninja-forms'), $post->ID); ?> </span> <?php do_action('nf_sub_edit_after_status', $post); ?> </div> <div class="misc-pub-section misc-pub-post-status"> <label for="post_status"><?php _e('Form', 'ninja-forms'); ?> :</label> <span id="sub-form-title-display"><?php echo $form_title; ?> </span> </div> <div class="misc-pub-section curtime misc-pub-curtime"> <span id="timestamp"> <?php _e('Submitted on', 'ninja-forms'); ?> : <b><?php echo $date_submitted; ?> </b> </span> <?php do_action('nf_sub_edit_date_submitted', $post); ?> </div> <div class="misc-pub-section curtime misc-pub-curtime"> <span id="timestamp"> <?php _e('Modified on', 'ninja-forms', $post); ?> : <b><?php echo $date_modified; ?> </b> </span> <?php do_action('nf_sub_edit_date_modified', $post); ?> </div> <?php if ($post->post_author != 0) { ?> <div class="misc-pub-section misc-pub-visibility" id="visibility"> <?php _e('Submitted By', 'ninja-forms'); ?> : <span id="post-visibility-display"><?php echo $name; ?> </span> </div> <?php } ?> </div> </div> <div id="major-publishing-actions"> <div id="delete-action"> <!-- <a class="submitdelete deletion" href="<?php echo get_delete_post_link($post->ID); ?> ">Move to Trash</a>--></div> <div id="publishing-action"> <span class="spinner"></span> <input name="original_publish" type="hidden" id="original_publish" value="<?php _e('Update', 'ninja-forms'); ?> "> <input name="save" type="submit" class="button button-primary button-large" id="publish" accesskey="p" value="<?php _e('Update', 'ninja-forms'); ?> "> </div> <div class="clear"></div> </div> </div> <?php }
<?php } else { ?> <input name="submit" id="submit" class="button button-primary" value="<?php echo __('Update', $this->plugin_slug); ?> " type="submit"> <?php } ?> <div class="angelleye-clearfix"></div> </div> <div id="aeofwc-delete-action"> <a class="submitdelete deletion" href="<?php echo get_delete_post_link($post->ID); ?> "><?php echo __('Move to Trash', $this->plugin_slug); ?> </a> </div> <?php if (isset($current_status_value) && $current_status_value == 'completed-offer') { ?> <div class="offer-order-meta"> <h5><?php echo __('Related Orders', $this->plugin_slug); ?> </h5>
function single_row($post, $level = 0) { global $mode; static $alternate; $global_post = get_post(); $GLOBALS['post'] = $post; setup_postdata($post); $edit_link = get_edit_post_link($post->ID); $title = _draft_or_post_title(); $post_type_object = get_post_type_object($post->post_type); $can_edit_post = current_user_can('edit_post', $post->ID); $alternate = 'alternate' == $alternate ? '' : 'alternate'; $classes = $alternate . ' iedit author-' . (get_current_user_id() == $post->post_author ? 'self' : 'other'); $lock_holder = wp_check_post_lock($post->ID); if ($lock_holder) { $classes .= ' wp-locked'; $lock_holder = get_userdata($lock_holder); } ?> <tr id="post-<?php echo $post->ID; ?> " class="<?php echo implode(' ', get_post_class($classes, $post->ID)); ?> " valign="top"> <?php list($columns, $hidden) = $this->get_column_info(); foreach ($columns as $column_name => $column_display_name) { $class = "class=\"{$column_name} column-{$column_name}\""; $style = ''; if (in_array($column_name, $hidden)) { $style = ' style="display:none;"'; } $attributes = "{$class}{$style}"; switch ($column_name) { case 'cb': ?> <th scope="row" class="check-column"> <?php if ($can_edit_post) { ?> <label class="screen-reader-text" for="cb-select-<?php the_ID(); ?> "><?php printf(__('Select %s'), $title); ?> </label> <input id="cb-select-<?php the_ID(); ?> " type="checkbox" name="post[]" value="<?php the_ID(); ?> " /> <div class="locked-indicator"></div> <?php } ?> </th> <?php break; case 'title': $attributes = 'class="post-title page-title column-title"' . $style; if ($this->hierarchical_display) { if (0 == $level && (int) $post->post_parent > 0) { //sent level 0 by accident, by default, or because we don't know the actual level $find_main_page = (int) $post->post_parent; while ($find_main_page > 0) { $parent = get_post($find_main_page); if (is_null($parent)) { break; } $level++; $find_main_page = (int) $parent->post_parent; if (!isset($parent_name)) { /** This filter is documented in wp-includes/post-template.php */ $parent_name = apply_filters('the_title', $parent->post_title, $parent->ID); } } } } $pad = str_repeat('— ', $level); echo "<td {$attributes}><strong>"; if ($format = get_post_format($post->ID)) { $label = get_post_format_string($format); echo '<a href="' . esc_url(add_query_arg(array('post_format' => $format, 'post_type' => $post->post_type), 'edit.php')) . '" class="post-state-format post-format-icon post-format-' . $format . '" title="' . $label . '">' . $label . ":</a> "; } if ($can_edit_post && $post->post_status != 'trash') { echo '<a class="row-title" href="' . $edit_link . '" title="' . esc_attr(sprintf(__('Edit “%s”'), $title)) . '">' . $pad . $title . '</a>'; } else { echo $pad . $title; } _post_states($post); if (isset($parent_name)) { echo ' | ' . $post_type_object->labels->parent_item_colon . ' ' . esc_html($parent_name); } echo "</strong>\n"; if ($can_edit_post && $post->post_status != 'trash') { if ($lock_holder) { $locked_avatar = get_avatar($lock_holder->ID, 18); $locked_text = esc_html(sprintf(__('%s is currently editing'), $lock_holder->display_name)); } else { $locked_avatar = $locked_text = ''; } echo '<div class="locked-info"><span class="locked-avatar">' . $locked_avatar . '</span> <span class="locked-text">' . $locked_text . "</span></div>\n"; } if (!$this->hierarchical_display && 'excerpt' == $mode && current_user_can('read_post', $post->ID)) { the_excerpt(); } $actions = array(); if ($can_edit_post && 'trash' != $post->post_status) { $actions['edit'] = '<a href="' . get_edit_post_link($post->ID, true) . '" title="' . esc_attr(__('Edit this item')) . '">' . __('Edit') . '</a>'; $actions['inline hide-if-no-js'] = '<a href="#" class="editinline" title="' . esc_attr(__('Edit this item inline')) . '">' . __('Quick Edit') . '</a>'; } if (current_user_can('delete_post', $post->ID)) { if ('trash' == $post->post_status) { $actions['untrash'] = "<a title='" . esc_attr(__('Restore this item from the Trash')) . "' href='" . wp_nonce_url(admin_url(sprintf($post_type_object->_edit_link . '&action=untrash', $post->ID)), 'untrash-post_' . $post->ID) . "'>" . __('Restore') . "</a>"; } elseif (EMPTY_TRASH_DAYS) { $actions['trash'] = "<a class='submitdelete' title='" . esc_attr(__('Move this item to the Trash')) . "' href='" . get_delete_post_link($post->ID) . "'>" . __('Trash') . "</a>"; } if ('trash' == $post->post_status || !EMPTY_TRASH_DAYS) { $actions['delete'] = "<a class='submitdelete' title='" . esc_attr(__('Delete this item permanently')) . "' href='" . get_delete_post_link($post->ID, '', true) . "'>" . __('Delete Permanently') . "</a>"; } } if ($post_type_object->public) { if (in_array($post->post_status, array('pending', 'draft', 'future'))) { if ($can_edit_post) { $actions['view'] = '<a href="' . esc_url(apply_filters('preview_post_link', set_url_scheme(add_query_arg('preview', 'true', get_permalink($post->ID))))) . '" title="' . esc_attr(sprintf(__('Preview “%s”'), $title)) . '" rel="permalink">' . __('Preview') . '</a>'; } } elseif ('trash' != $post->post_status) { $actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . esc_attr(sprintf(__('View “%s”'), $title)) . '" rel="permalink">' . __('View') . '</a>'; } } $actions = apply_filters(is_post_type_hierarchical($post->post_type) ? 'page_row_actions' : 'post_row_actions', $actions, $post); echo $this->row_actions($actions); get_inline_data($post); echo '</td>'; break; case 'date': if ('0000-00-00 00:00:00' == $post->post_date) { $t_time = $h_time = __('Unpublished'); $time_diff = 0; } else { $t_time = get_the_time(__('Y/m/d g:i:s A')); $m_time = $post->post_date; $time = get_post_time('G', true, $post); $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); } } echo '<td ' . $attributes . '>'; if ('excerpt' == $mode) { echo apply_filters('post_date_column_time', $t_time, $post, $column_name, $mode); } else { echo '<abbr title="' . $t_time . '">' . apply_filters('post_date_column_time', $h_time, $post, $column_name, $mode) . '</abbr>'; } echo '<br />'; if ('publish' == $post->post_status) { _e('Published'); } elseif ('future' == $post->post_status) { if ($time_diff > 0) { echo '<strong class="attention">' . __('Missed schedule') . '</strong>'; } else { _e('Scheduled'); } } else { _e('Last Modified'); } echo '</td>'; break; case 'comments': ?> <td <?php echo $attributes; ?> ><div class="post-com-count-wrapper"> <?php $pending_comments = isset($this->comment_pending_count[$post->ID]) ? $this->comment_pending_count[$post->ID] : 0; $this->comments_bubble($post->ID, $pending_comments); ?> </div></td> <?php break; case 'author': ?> <td <?php echo $attributes; ?> ><?php printf('<a href="%s">%s</a>', esc_url(add_query_arg(array('post_type' => $post->post_type, 'author' => get_the_author_meta('ID')), 'edit.php')), get_the_author()); ?> </td> <?php break; default: if ('categories' == $column_name) { $taxonomy = 'category'; } elseif ('tags' == $column_name) { $taxonomy = 'post_tag'; } elseif (0 === strpos($column_name, 'taxonomy-')) { $taxonomy = substr($column_name, 9); } else { $taxonomy = false; } if ($taxonomy) { $taxonomy_object = get_taxonomy($taxonomy); echo '<td ' . $attributes . '>'; if ($terms = get_the_terms($post->ID, $taxonomy)) { $out = array(); foreach ($terms as $t) { $posts_in_term_qv = array(); if ('post' != $post->post_type) { $posts_in_term_qv['post_type'] = $post->post_type; } if ($taxonomy_object->query_var) { $posts_in_term_qv[$taxonomy_object->query_var] = $t->slug; } else { $posts_in_term_qv['taxonomy'] = $taxonomy; $posts_in_term_qv['term'] = $t->slug; } $out[] = sprintf('<a href="%s">%s</a>', esc_url(add_query_arg($posts_in_term_qv, 'edit.php')), esc_html(sanitize_term_field('name', $t->name, $t->term_id, $taxonomy, 'display'))); } /* translators: used between list items, there is a space after the comma */ echo join(__(', '), $out); } else { echo '—'; } echo '</td>'; break; } ?> <td <?php echo $attributes; ?> ><?php if (is_post_type_hierarchical($post->post_type)) { do_action('manage_pages_custom_column', $column_name, $post->ID); } else { do_action('manage_posts_custom_column', $column_name, $post->ID); } do_action("manage_{$post->post_type}_posts_custom_column", $column_name, $post->ID); ?> </td> <?php break; } } ?> </tr> <?php $GLOBALS['post'] = $global_post; }
function custom_hubpage_columns($column) { global $post; switch ($column) { case "hub_title": $edit_link = get_edit_post_link($post->ID); $title = _draft_or_post_title(); $post_type_object = get_post_type_object($post->post_type); $can_edit_post = current_user_can($post_type_object->cap->edit_post, $post->ID); echo '<strong><a class="row-title" href="' . $edit_link . '">' . $title . '</a>'; _post_states($post); echo '</strong>'; if ($post->post_parent > 0) { echo ' ← <a href="' . get_edit_post_link($post->post_parent) . '">' . get_the_title($post->post_parent) . '</a>'; } // Excerpt view if (isset($_GET['mode']) && $_GET['mode'] == 'excerpt') { echo apply_filters('the_excerpt', $post->post_excerpt); } // Get actions $actions = array(); $actions['edit'] = '<a href="' . get_edit_post_link($post->ID, true) . '" title="' . esc_attr(__('Edit this item')) . '">' . __('Edit') . '</a>'; if ($can_edit_post && 'trash' != $post->post_status) { $actions['inline hide-if-no-js'] = '<a href="#" class="editinline" title="' . esc_attr(__('Edit this item inline', WPC_CLIENT_TEXT_DOMAIN)) . '">' . __('Quick Edit', WPC_CLIENT_TEXT_DOMAIN) . '</a>'; } if (current_user_can($post_type_object->cap->delete_post, $post->ID)) { if ('trash' == $post->post_status) { $actions['untrash'] = "<a title='" . esc_attr(__('Restore this item from the Trash', WPC_CLIENT_TEXT_DOMAIN)) . "' href='" . wp_nonce_url(admin_url(sprintf($post_type_object->_edit_link . '&action=untrash', $post->ID)), 'untrash-' . $post->post_type . '_' . $post->ID) . "'>" . __('Restore', WPC_CLIENT_TEXT_DOMAIN) . "</a>"; } elseif (EMPTY_TRASH_DAYS) { $actions['trash'] = "<a class='submitdelete' title='" . esc_attr(__('Move this item to the Trash', WPC_CLIENT_TEXT_DOMAIN)) . "' href='" . get_delete_post_link($post->ID) . "'>" . __('Trash', WPC_CLIENT_TEXT_DOMAIN) . "</a>"; } if ('trash' == $post->post_status || !EMPTY_TRASH_DAYS) { $actions['delete'] = "<a class='submitdelete' title='" . esc_attr(__('Delete this item permanently', WPC_CLIENT_TEXT_DOMAIN)) . "' href='" . get_delete_post_link($post->ID, '', true) . "'>" . __('Delete Permanently', WPC_CLIENT_TEXT_DOMAIN) . "</a>"; } } if ($post_type_object->public) { if ('trash' != $post->post_status) { $actions['view'] = '<a href="' . wpc_client_get_slug('hub_page_id') . $post->ID . '" target="_blank" title="' . esc_attr(sprintf(__('Preview “%s”', WPC_CLIENT_TEXT_DOMAIN), $title)) . '" rel="permalink">' . __('Preview', WPC_CLIENT_TEXT_DOMAIN) . '</a>'; } } $actions = apply_filters('post_row_actions', $actions, $post); echo '<div class="row-actions">'; $i = 0; $action_count = sizeof($actions); foreach ($actions as $action => $link) { ++$i; $i == $action_count ? $sep = '' : ($sep = ' | '); echo "<span class='{$action}'>{$link}{$sep}</span>"; } echo '</div>'; get_inline_data($post); break; case "client": $client = get_users(array('role' => 'wpc_client', 'meta_key' => 'wpc_cl_hubpage_id', 'meta_value' => $post->ID)); if ($client) { echo $client[0]->user_login; } break; } }
function single_row($a_post, $level = 0) { global $post, $mode; static $alternate; $global_post = $post; $post = $a_post; setup_postdata($post); $edit_link = get_edit_post_link($post->ID); $title = _draft_or_post_title(); $post_type_object = get_post_type_object($post->post_type); $can_edit_post = current_user_can($post_type_object->cap->edit_post, $post->ID); $alternate = 'alternate' == $alternate ? '' : 'alternate'; $classes = $alternate . ' iedit author-' . (get_current_user_id() == $post->post_author ? 'self' : 'other'); ?> <tr id="post-<?php echo $post->ID; ?> " class="<?php echo implode(' ', get_post_class($classes, $post->ID)); ?> " valign="top"> <?php list($columns, $hidden) = $this->get_column_info(); foreach ($columns as $column_name => $column_display_name) { $class = "class=\"{$column_name} column-{$column_name}\""; $style = ''; if (in_array($column_name, $hidden)) { $style = ' style="display:none;"'; } $attributes = "{$class}{$style}"; switch ($column_name) { case 'cb': ?> <th scope="row" class="check-column"><?php if ($can_edit_post) { ?> <input type="checkbox" name="post[]" value="<?php the_ID(); ?> " /><?php } ?> </th> <?php break; case 'title': if ($this->hierarchical_display) { $attributes = 'class="post-title page-title column-title"' . $style; if (0 == $level && (int) $post->post_parent > 0) { //sent level 0 by accident, by default, or because we don't know the actual level $find_main_page = (int) $post->post_parent; while ($find_main_page > 0) { $parent = get_page($find_main_page); if (is_null($parent)) { break; } $level++; $find_main_page = (int) $parent->post_parent; if (!isset($parent_name)) { $parent_name = apply_filters('the_title', $parent->post_title, $parent->ID); } } } $pad = str_repeat('— ', $level); ?> <td <?php echo $attributes; ?> ><strong><?php if ($can_edit_post && $post->post_status != 'trash') { ?> <a class="row-title" href="<?php echo $edit_link; ?> " title="<?php echo esc_attr(sprintf(__('Edit “%s”'), $title)); ?> "><?php echo $pad; echo $title; ?> </a><?php } else { echo $pad; echo $title; } _post_states($post); echo isset($parent_name) ? ' | ' . $post_type_object->labels->parent_item_colon . ' ' . esc_html($parent_name) : ''; ?> </strong> <?php } else { $attributes = 'class="post-title page-title column-title"' . $style; ?> <td <?php echo $attributes; ?> ><strong><?php if ($can_edit_post && $post->post_status != 'trash') { ?> <a class="row-title" href="<?php echo $edit_link; ?> " title="<?php echo esc_attr(sprintf(__('Edit “%s”'), $title)); ?> "><?php echo $title; ?> </a><?php } else { echo $title; } _post_states($post); ?> </strong> <?php if ('excerpt' == $mode) { the_excerpt(); } } $actions = array(); if ($can_edit_post && 'trash' != $post->post_status) { $actions['edit'] = '<a href="' . get_edit_post_link($post->ID, true) . '" title="' . esc_attr(__('Edit this item')) . '">' . __('Edit') . '</a>'; $actions['inline hide-if-no-js'] = '<a href="#" class="editinline" title="' . esc_attr(__('Edit this item inline')) . '">' . __('Quick Edit') . '</a>'; } if (current_user_can($post_type_object->cap->delete_post, $post->ID)) { if ('trash' == $post->post_status) { $actions['untrash'] = "<a title='" . esc_attr(__('Restore this item from the Trash')) . "' href='" . wp_nonce_url(admin_url(sprintf($post_type_object->_edit_link . '&action=untrash', $post->ID)), 'untrash-' . $post->post_type . '_' . $post->ID) . "'>" . __('Restore') . "</a>"; } elseif (EMPTY_TRASH_DAYS) { $actions['trash'] = "<a class='submitdelete' title='" . esc_attr(__('Move this item to the Trash')) . "' href='" . get_delete_post_link($post->ID) . "'>" . __('Trash') . "</a>"; } if ('trash' == $post->post_status || !EMPTY_TRASH_DAYS) { $actions['delete'] = "<a class='submitdelete' title='" . esc_attr(__('Delete this item permanently')) . "' href='" . get_delete_post_link($post->ID, '', true) . "'>" . __('Delete Permanently') . "</a>"; } } if ($post_type_object->public) { if (in_array($post->post_status, array('pending', 'draft', 'future'))) { if ($can_edit_post) { $actions['view'] = '<a href="' . esc_url(add_query_arg('preview', 'true', get_permalink($post->ID))) . '" title="' . esc_attr(sprintf(__('Preview “%s”'), $title)) . '" rel="permalink">' . __('Preview') . '</a>'; } } elseif ('trash' != $post->post_status) { $actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . esc_attr(sprintf(__('View “%s”'), $title)) . '" rel="permalink">' . __('View') . '</a>'; } } $actions = apply_filters(is_post_type_hierarchical($post->post_type) ? 'page_row_actions' : 'post_row_actions', $actions, $post); echo $this->row_actions($actions); get_inline_data($post); echo '</td>'; break; case 'date': if ('0000-00-00 00:00:00' == $post->post_date && 'date' == $column_name) { $t_time = $h_time = __('Unpublished'); $time_diff = 0; } else { $t_time = get_the_time(__('Y/m/d g:i:s A')); $m_time = $post->post_date; $time = get_post_time('G', true, $post); $time_diff = time() - $time; if ($time_diff > 0 && $time_diff < 24 * 60 * 60) { $h_time = sprintf(__('%s ago'), human_time_diff($time)); } else { $h_time = mysql2date(__('Y/m/d'), $m_time); } } echo '<td ' . $attributes . '>'; if ('excerpt' == $mode) { echo apply_filters('post_date_column_time', $t_time, $post, $column_name, $mode); } else { echo '<abbr title="' . $t_time . '">' . apply_filters('post_date_column_time', $h_time, $post, $column_name, $mode) . '</abbr>'; } echo '<br />'; if ('publish' == $post->post_status) { _e('Published'); } elseif ('future' == $post->post_status) { if ($time_diff > 0) { echo '<strong class="attention">' . __('Missed schedule') . '</strong>'; } else { _e('Scheduled'); } } else { _e('Last Modified'); } echo '</td>'; break; case 'categories': ?> <td <?php echo $attributes; ?> ><?php $categories = get_the_category(); if (!empty($categories)) { $out = array(); foreach ($categories as $c) { $out[] = sprintf('<a href="%s">%s</a>', esc_url(add_query_arg(array('post_type' => $post->post_type, 'category_name' => $c->slug), 'edit.php')), esc_html(sanitize_term_field('name', $c->name, $c->term_id, 'category', 'display'))); } echo join(', ', $out); } else { _e('Uncategorized'); } ?> </td> <?php break; case 'tags': ?> <td <?php echo $attributes; ?> ><?php $tags = get_the_tags($post->ID); if (!empty($tags)) { $out = array(); foreach ($tags as $c) { $out[] = sprintf('<a href="%s">%s</a>', esc_url(add_query_arg(array('post_type' => $post->post_type, 'tag' => $c->slug), 'edit.php')), esc_html(sanitize_term_field('name', $c->name, $c->term_id, 'tag', 'display'))); } echo join(', ', $out); } else { _e('No Tags'); } ?> </td> <?php break; case 'comments': ?> <td <?php echo $attributes; ?> ><div class="post-com-count-wrapper"> <?php $pending_comments = isset($this->comment_pending_count[$post->ID]) ? $this->comment_pending_count[$post->ID] : 0; $this->comments_bubble($post->ID, $pending_comments); ?> </div></td> <?php break; case 'author': ?> <td <?php echo $attributes; ?> ><?php printf('<a href="%s">%s</a>', esc_url(add_query_arg(array('post_type' => $post->post_type, 'author' => get_the_author_meta('ID')), 'edit.php')), get_the_author()); ?> </td> <?php break; default: ?> <td <?php echo $attributes; ?> ><?php if (is_post_type_hierarchical($post->post_type)) { do_action('manage_pages_custom_column', $column_name, $post->ID); } else { do_action('manage_posts_custom_column', $column_name, $post->ID); } do_action("manage_{$post->post_type}_posts_custom_column", $column_name, $post->ID); ?> </td> <?php break; } } ?> </tr> <?php $post = $global_post; }
public function showCustomMetaBox() { global $post; if (!self::getInstance()->includes['main']->getUserId()) { self::getInstance()->includes['admin']->error_message = 'You haven\'t connected Instapage account yet. Please go to: <a href="' . INSTAPAGE_PLUGIN_SETTINGS_URI . '">Instapage Settings</a>'; self::getInstance()->includes['admin']->getErrorMessageHTML(); self::getInstance()->includes['admin']->removeEditPage(); return false; } // Field Array $field = array('label' => 'My Page', 'desc' => 'Select from your pages.', 'id' => 'instapage_my_selected_page', 'type' => 'select', 'options' => array()); try { $pages = self::getInstance()->includes['page']->loadMyPages(); } catch (Exception $e) { self::getInstance()->includes['admin']->error_message = $e->getMessage(); self::getInstance()->includes['admin']->getErrorMessageHTML(); self::getInstance()->includes['admin']->removeEditPage(); return false; } if (!$pages) { echo 'N1o pages pushed to your wordpress. Please go to your <a href="http://app.instapage.com/dashboard" target="_blank">Instapage</a> and push some pages.'; return; } if ($pages === false) { self::getInstance()->includes['admin']->error_message = 'You haven\'t published any Instapage page to Wordpress yet'; self::getInstance()->includes['admin']->getErrorMessageHTML(); self::getInstance()->includes['admin']->removeEditPage(); return false; } foreach ($pages as $key => $page) { $field['options'][$page->id] = array('label' => $page->title, 'value' => $page->id); } $isFrontPage = self::getInstance()->includes['page']->isFrontPage($post->ID); $is_not_found_page = self::getInstance()->includes['page']->is404Page(get_the_ID()); $meta = get_post_meta($post->ID, 'instapage_my_selected_page', true); $meta_slug = get_post_meta($post->ID, 'instapage_slug', true); $missing_slug = self::getInstance()->includes['main']->isPageModeActive('edit') && $meta_slug == '' && !$isFrontPage; $delete_link = get_delete_post_link($post->ID); $instapage_post_type = null; $redirect_method = 'http'; if ($isFrontPage) { $instapage_post_type = 'home'; } elseif ($is_not_found_page) { $instapage_post_type = '404'; } $form = self::getInstance()->includes['view']; $form->init(INSTAPAGE_PLUGIN_DIR . '/includes/templates/instapage/edit.php'); $form->instapage_post_type = $instapage_post_type; $form->user_id = self::getInstance()->includes['main']->getUserId(); $form->field = $field; $form->meta = $meta; $form->meta_slug = $meta_slug; $form->missing_slug = $missing_slug; $form->redirect_method = $redirect_method; $form->delete_link = $delete_link; $form->is_page_active_mode = self::getInstance()->includes['main']->isPageModeActive('edit'); $form->instapage_name = get_post_meta($post->ID, 'instapage_name', true); $form->plugin_file = plugin_basename(__FILE__); echo $form->fetch(); }