function duplicate_post_admin_bar_render() { global $wp_admin_bar; $current_object = 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)) && DuplicatePost::duplicate_post_is_current_user_allowed_to_copy() && ($post_type_object->show_ui || 'attachment' == $current_object->post_type)) { $wp_admin_bar->add_menu(array('parent' => '', 'id' => 'new_draft', 'title' => __("Duplicate & Edit this " . ucfirst($current_object->post_type), 'dem'), 'href' => DuplicatePost::duplicate_post_get_clone_post_link($current_object->ID))); } }
private static function includes() { $settings = get_option('dem_main_settings'); require_once 'admin/duplicate-post.php'; // Check if current user is allowed to submit review to current post // Message that is sent to Admins // add_filter("duplicate_post_notification_message", function($message, $post, $new_post, $current_user){ // return implode( array( // "An update has been posted for ", // "<a href='".get_permalink($post->ID)."'>'".$post->post_title."'</a>.", // "by ".$current_user->display_name, // "<br><br> To review the update follow the link ", // "<a href='".get_permalink($new_post->ID)."'>'".$new_post->post_title."'</a>. ", // "<a href='".admin_url("edit.php").'?page=show-diff&post='.$new_post->ID."'>Click here</a> to view changes side-by-side." // ) ); // },10,4); $emails = explode("\n", $settings['notify_emails']); // TODO move admin emails to class DuplicatePost::_init(array("duplicate_post_title_prefix" => "[Duplicated] ", "duplicate_post_show_adminbar" => true, "duplicate_post_show_row" => true, "duplicate_post_show_submitbox" => true, "duplicate_post_global_admins" => $emails)); switch (is_admin()) { case true: /* loads admin files */ require_once 'admin/settings.php'; break; case false: /* load front-end files */ //include_once('public/blah.php'); break; } }