本文整理汇总了PHP中_get_list_table函数的典型用法代码示例。如果您正苦于以下问题:PHP _get_list_table函数的具体用法?PHP _get_list_table怎么用?PHP _get_list_table使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_get_list_table函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: wpduact_users_bulk_action
function wpduact_users_bulk_action()
{
if (!current_user_can('activate_plugins')) {
return;
}
$wp_list_table = _get_list_table('WP_Users_List_Table');
$action = $wp_list_table->current_action();
switch ($action) {
case 'wpduact_deactivate_account':
$user_ids = $_GET['users'];
$deactivated = 0;
foreach ($user_ids as $user_id) {
if (get_current_user_id() != $user_id) {
update_user_meta($user_id, 'wpduact_status', 'inactive');
$deactivated++;
}
}
$sendback = add_query_arg(array('deactivated' => $deactivated), $sendback);
break;
case 'wpduact_activate_account':
$user_ids = $_GET['users'];
$activated = 0;
foreach ($user_ids as $user_id) {
update_user_meta($user_id, 'wpduact_status', 'active');
$activated++;
}
$sendback = add_query_arg(array('activated' => $activated), $sendback);
break;
default:
return;
}
wp_redirect($sendback);
exit;
}
示例2: github_theme_update_row
function github_theme_update_row($theme_key, $theme)
{
$current = get_site_transient('update_themes');
if (!isset($current->response[$theme_key]) and !isset($current->up_to_date[$theme_key])) {
return false;
}
$r = $current->response[$theme_key];
$wp_list_table = _get_list_table('WP_MS_Themes_List_Table');
// custom additions
if (isset($r['error'])) {
echo '<tr class="plugin-update-tr"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange"><div class="update-message-gtu update-error">';
printf('Error with Github Theme Updater. %1$s', $r['error']);
} else {
if (isset($current->up_to_date[$theme_key])) {
} else {
$themes_allowedtags = array('a' => array('href' => array(), 'title' => array()), 'abbr' => array('title' => array()), 'acronym' => array('title' => array()), 'code' => array(), 'em' => array(), 'strong' => array());
$theme_name = wp_kses($theme['Name'], $themes_allowedtags);
$github_url = esc_url($r['url']);
$diff_url = esc_url($r['url'] . '/compare/' . $theme['Version'] . '...' . $r['new_version']);
echo '<tr class="plugin-update-tr"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange"><div class="update-message-gtu">';
printf('Github has as a new version of <a href="%s" target="blank">%s</a>. ', $github_url, $theme_name);
printf('View <a href="%s" target="blank">version diff</a> with %s. ', $diff_url, $r['new_version']);
if (current_user_can('update_themes')) {
if (empty($r['package'])) {
echo '<em>Automatic update is unavailable for this plugin.</em>';
} else {
printf('<a href="%s">Update automatically</a>.', wp_nonce_url(self_admin_url('update.php?action=upgrade-github-theme&theme=') . $theme_key, 'upgrade-theme_' . $theme_key));
}
}
}
}
do_action("in_theme_update_message-{$theme_key}", $theme, $r);
echo '</div></td></tr>';
}
示例3: setUp
function setUp()
{
parent::setUp();
set_current_screen('edit-page');
$GLOBALS['hook_suffix'] = '';
$this->table = _get_list_table('WP_Posts_List_Table');
}
示例4: runCallbacks
/**
* Runs the appropriate callback handler
*
* @return void
*/
private static function runCallbacks()
{
// 0. get the action
$wp_list_table = _get_list_table('WP_Posts_List_Table');
$action = $wp_list_table->current_action();
// 1. Get the custom action object
$bulkAction = self::getCustomBulkAction($action);
if ($bulkAction === null) {
return;
}
// 2. security check
check_admin_referer('bulk-posts');
// Get the post ids
if (isset($_REQUEST['post'])) {
$post_ids = array_map('intval', $_REQUEST['post']);
}
if (empty($post_ids)) {
return;
}
// Run the callback
$callback = $bulkAction->getCallback();
$callback($post_ids);
// Build the redirect url. Add all id's to the query args
$sendback = remove_query_arg(array('untrashed', 'deleted', 'ids'), wp_get_referer());
$sendback = add_query_arg(array('ids' => join(',', $post_ids)), $sendback);
// 4. Redirect client
wp_redirect($sendback);
exit;
}
示例5: pl_custom_bulk_action
function pl_custom_bulk_action()
{
$wp_list_table = _get_list_table('WP_Posts_List_Table');
$action = $wp_list_table->current_action();
switch ($action) {
case 'pl-template':
$done = 0;
$post_ids = $_REQUEST['post'];
$post_type = $_REQUEST['pl-post-type'];
$template = $_REQUEST['selected-template'];
if (!$post_ids || !$template) {
return false;
}
foreach ($post_ids as $post_id) {
$set = pl_meta($post_id, PL_SETTINGS);
$set['live']['custom-map']['template']['ctemplate'] = $template;
$set['draft']['custom-map']['template']['ctemplate'] = $template;
update_post_meta($post_id, PL_SETTINGS, $set);
if ('post' == $post_type) {
update_post_meta($post_id, 'pl_template_mode', 'local');
}
$done++;
}
$sendback = add_query_arg(array('pl-template' => $done, 'selected-template-name' => $_REQUEST['selected-template-name'], 'ids' => join(',', $post_ids)), admin_url('edit.php?post_type=' . $post_type));
break;
default:
return;
}
wp_redirect($sendback);
exit;
}
示例6: get_comments_async
public function get_comments_async()
{
global $wp_list_table;
$wp_list_table = _get_list_table('WP_Comments_List_Table', array('screen' => 'edit-comments'));
$wp_list_table->prepare_items();
ob_start();
$wp_list_table->views();
$views = ob_get_clean();
ob_start();
$wp_list_table->display_tablenav('top');
$top = ob_get_clean();
ob_start();
$wp_list_table->display_tablenav('bottom');
$bottom = ob_get_clean();
ob_start();
foreach ($wp_list_table->items as $comment) {
if (!current_user_can('edit_comment', $comment->comment_ID)) {
continue;
}
get_comment($comment);
$wp_list_table->single_row($comment);
}
$rows = ob_get_clean();
return compact('views', 'rows', 'top', 'bottom');
}
示例7: ds_npr_bulk_action_update_action
function ds_npr_bulk_action_update_action()
{
// 1. get the action
$wp_list_table = _get_list_table('WP_Posts_List_Table');
$action = $wp_list_table->current_action();
switch ($action) {
// 3. Perform the action
case 'updateNprStory':
// make sure ids are submitted. depending on the resource type, this may be 'media' or 'ids'
if (isset($_REQUEST['post'])) {
$post_ids = array_map('intval', $_REQUEST['post']);
}
$exported = 0;
foreach ($post_ids as $post_id) {
$api_id = get_post_meta($post_id, NPR_STORY_ID_META_KEY, TRUE);
$api = new NPRAPIWordpress();
$params = array('id' => $api_id, 'apiKey' => get_option('ds_npr_api_key'));
$api->request($params, 'query', get_option('ds_npr_api_pull_url'));
$api->parse();
if (empty($api->message) || $api->message->level != 'warning') {
error_log('updating story for API ID=' . $api_id);
$story = $api->update_posts_from_stories();
}
}
// build the redirect url
//$sendback = add_query_arg( array('exported' => $exported, 'ids' => join(',', $post_ids) ), $sendback );
break;
default:
return;
}
// ...
// 4. Redirect client
//wp_redirect($sendback);
//exit();
}
示例8: prepare_jitms
/**
* Prepare actions according to screen and post type.
*
* @since 3.8.2
*
* @uses Jetpack_Autoupdate::get_possible_failures()
*
* @param object $screen
*/
function prepare_jitms($screen)
{
if (!current_user_can('jetpack_manage_modules')) {
return;
}
global $pagenow;
// Only show auto update JITM if auto updates are allowed in this installation
$possible_reasons_for_failure = Jetpack_Autoupdate::get_possible_failures();
self::$auto_updates_allowed = empty($possible_reasons_for_failure);
if ('media-new.php' == $pagenow && !Jetpack::is_module_active('photon')) {
add_action('admin_enqueue_scripts', array($this, 'jitm_enqueue_files'));
add_action('post-plupload-upload-ui', array($this, 'photon_msg'));
} elseif ('post-new.php' == $pagenow && in_array($screen->post_type, array('post', 'page'))) {
add_action('admin_enqueue_scripts', array($this, 'jitm_enqueue_files'));
add_action('admin_notices', array($this, 'editor_msg'));
} elseif (self::$auto_updates_allowed) {
if ('update-core.php' == $pagenow && !Jetpack::is_module_active('manage')) {
add_action('admin_enqueue_scripts', array($this, 'jitm_enqueue_files'));
add_action('admin_notices', array($this, 'manage_msg'));
} elseif ('plugins.php' == $pagenow) {
if (isset($_GET['activate']) && 'true' === $_GET['activate'] || isset($_GET['activate-multi']) && 'true' === $_GET['activate-multi']) {
add_action('admin_enqueue_scripts', array($this, 'jitm_enqueue_files'));
add_action('pre_current_active_plugins', array($this, 'manage_pi_msg'));
} else {
// Save plugins that are activated. This is used when one or more plugins are activated to know
// what was activated and use it in Jetpack_JITM::manage_pi_msg() before deleting the option.
$wp_list_table = _get_list_table('WP_Plugins_List_Table');
$action = $wp_list_table->current_action();
if ($action && ('activate' == $action || 'activate-selected' == $action)) {
update_option('jetpack_temp_active_plugins_before', get_option('active_plugins', array()));
}
}
}
}
}
示例9: show_license_message
public function show_license_message($file, $plugin)
{
$wp_list_table = _get_list_table('WP_Plugins_List_Table');
echo '<tr class="plugin-update-tr active"><td colspan="' . esc_attr($wp_list_table->get_column_count()) . '" class="plugin-update colspanchange"><div class="update-message">';
echo sprintf(__('Your %1$s license key is missing. Please add it on the %2$slicenses page%3$s.', 'formidable'), $this->plugin_name, '<a href="' . esc_url(admin_url('admin.php?page=formidable-settings&t=licenses_settings')) . '">', '</a>');
$id = sanitize_title($plugin['Name']);
echo '<script type="text/javascript">var d = document.getElementById("' . esc_attr($id) . '");if ( d !== null ){ d.className = d.className + " update"; }</script>';
echo '</div></td></tr>';
}
示例10: DisplayInstallPlugins
static function DisplayInstallPlugins()
{
if (!current_user_can('install_plugins')) {
wp_die(__('You do not have sufficient permissions to install plugins on this site.'));
}
global $tab;
$tab = $_GET['tab'] = 'new';
// required for list table (in 3.5.1)
$wp_list_table = _get_list_table('WP_Plugin_Install_List_Table');
$pagenum = $wp_list_table->get_pagenum();
$wp_list_table->orderby = 'order';
$wp_list_table->prepare_items();
$total_pages = $wp_list_table->get_pagination_arg('total_pages');
if ($pagenum > $total_pages && $total_pages > 0) {
WPFB_AdminLite::JsRedirect(add_query_arg('paged', $total_pages));
exit;
}
$title = __('Extensions', 'wp-filebase');
wp_print_scripts('plugin-install');
?>
<style type="text/css" media="screen">
.vers.column-rating, .column-downloaded { display: none; }
#TB_ajaxWindowTitle { display: none; }
</style>
<div class="wrap">
<h3><?php
echo esc_html($title);
?>
</h3>
<p>Each extensions is an additional plugin. You can test all extensions in the <a href="http://demo.wpfilebase.com/wp-admin/admin.php?page=wpfilebase_manage" target="_blank">Live Demo Sandbox</a>.</p>
<?php
//$wp_list_table->views();
//echo '<br class="clear" />';
?>
<form id="plugin-filter" action="" method="post">
<?php
$wp_list_table->display();
?>
</form>
</div>
<script>
jQuery('a.buy-now').click(function (e) {
if (jQuery(this).text() === 'Refresh') {
if(window.location.search.indexOf('&no_api_cache=1') > 0)
window.location.reload();
else
window.location.search += '&no_api_cache=1';
return false;
}
jQuery(this).text('Refresh');
return true;
});
</script>
<?php
}
示例11: vp_php_version_inline_error
function vp_php_version_inline_error($file, $plugin_data)
{
global $phpVersionMessage;
$wp_list_table = _get_list_table('WP_Plugins_List_Table');
echo '<tr class="active plugin-update-tr">';
echo '<td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange">';
echo '<div class="update-message">';
echo $phpVersionMessage;
echo '</div></td></tr>';
}
示例12: get_table
private function get_table()
{
if (is_null($this->table)) {
if (!get_current_screen()) {
set_current_screen(self::USERS_SCREEN);
}
$this->table = _get_list_table('WP_Users_List_Table', array('screen' => self::USERS_SCREEN));
}
return $this->table;
}
示例13: wpmem_posts_page_load
/**
* Function to handle bulk actions at page load.
*
* @since 2.9.2
*
* @global object $wpmem The WP_Members object.
*/
function wpmem_posts_page_load()
{
global $wpmem;
$wp_list_table = _get_list_table('WP_Posts_List_Table');
$action = $wp_list_table->current_action();
$sendback = '';
switch ($action) {
case 'block':
case 'unblock':
// Validate nonce.
check_admin_referer('bulk-posts');
// Get the posts.
$posts = isset($_REQUEST['post']) ? $_REQUEST['post'] : '';
// Update posts.
$x = '';
if ($posts) {
foreach ($posts as $post_id) {
$x++;
$post = get_post($post_id);
$type = $post->post_type;
// Update accordingly.
if ($wpmem->block[$type] == 0) {
if ($action == 'block') {
update_post_meta($post_id, '_wpmem_block', 1);
} else {
delete_post_meta($post_id, '_wpmem_block');
}
}
if ($wpmem->block[$type] == 1) {
if ($action == 'unblock') {
update_post_meta($post_id, '_wpmem_block', 0);
} else {
delete_post_meta($post_id, '_wpmem_block');
}
}
}
// Set the return message.
$arr = array('a' => $action, 'n' => $x, 'post_type' => $type);
if (isset($_GET['post_status']) && 'all' != $_GET['post_status']) {
$arr['post_status'] = $_GET['post_status'];
}
$sendback = add_query_arg(array($arr), '', $sendback);
} else {
// Set the return message.
$sendback = add_query_arg(array('a' => 'none'), '', $sendback);
}
break;
default:
return;
}
// If we did not return already, we need to wp_redirect.
wp_redirect($sendback);
exit;
}
示例14: custom_bulk_action
/**
* Step 2: handle the custom Bulk Action
*
* Based on the post http://wordpress.stackexchange.com/questions/29822/custom-bulk-action
*/
function custom_bulk_action()
{
global $typenow;
$post_type = $typenow;
if ($post_type == 'post' or $post_type == 'page') {
// if($post_type == 'post') {
// get the action
$wp_list_table = _get_list_table('WP_Posts_List_Table');
// depending on your resource type this could be WP_Users_List_Table, WP_Comments_List_Table, etc
$action = $wp_list_table->current_action();
$allowed_actions = array("export");
if (!in_array($action, $allowed_actions)) {
return;
}
// security check
check_admin_referer('bulk-posts');
// make sure ids are submitted. depending on the resource type, this may be 'media' or 'ids'
if (isset($_REQUEST['post'])) {
$post_ids = array_map('intval', $_REQUEST['post']);
//проверка что входные величины - числа.
}
if (empty($post_ids)) {
return;
}
// this is based on wp-admin/edit.php
$sendback = remove_query_arg(array('exported', 'untrashed', 'deleted', 'ids'), wp_get_referer());
if (!$sendback) {
$sendback = admin_url("edit.php?post_type={$post_type}");
}
$pagenum = $wp_list_table->get_pagenum();
$sendback = add_query_arg('paged', $pagenum, $sendback);
switch ($action) {
case 'export':
// if we set up user permissions/capabilities, the code might look like:
//if ( !current_user_can($post_type_object->cap->export_post, $post_id) )
// wp_die( __('You are not allowed to export this post.') );
// $exported = 10;
// foreach( $post_ids as $post_id ) {
$exported = perform_export($post_ids);
if (!$exported) {
wp_die(__('Error exporting post.'));
}
// $exported++;
// }
$sendback = add_query_arg(array('exported' => $exported, 'ids' => join(',', $post_ids)), $sendback);
break;
default:
return;
}
$sendback = remove_query_arg(array('action', 'action2', 'tags_input', 'post_author', 'comment_status', 'ping_status', '_status', 'post', 'bulk_edit', 'post_view'), $sendback);
wp_redirect($sendback);
exit;
}
}
示例15: wpmem_posts_page_load
/**
* Function to handle bulk actions at page load
*
* @since 2.9.2
*
* @uses WP_Users_List_Table
*/
function wpmem_posts_page_load()
{
$wp_list_table = _get_list_table('WP_Posts_List_Table');
$action = $wp_list_table->current_action();
$sendback = '';
switch ($action) {
case 'block':
case 'unblock':
/** validate nonce **/
check_admin_referer('bulk-posts');
/** get the posts **/
$posts = isset($_REQUEST['post']) ? $_REQUEST['post'] : '';
/** update posts **/
$x = '';
if ($posts) {
foreach ($posts as $post_id) {
$x++;
$post = get_post($post_id);
$type = $post->post_type;
// update accordingly
if ($type == 'post' && WPMEM_BLOCK_POSTS == 0 || $type == 'page' && WPMEM_BLOCK_PAGES == 0) {
if ($action == 'block') {
update_post_meta($post_id, '_wpmem_block', 1);
} else {
delete_post_meta($post_id, '_wpmem_block');
}
}
if ($type == 'post' && WPMEM_BLOCK_POSTS == 1 || $type == 'page' && WPMEM_BLOCK_PAGES == 1) {
if ($action == 'unblock') {
update_post_meta($post_id, '_wpmem_block', 0);
} else {
delete_post_meta($post_id, '_wpmem_block');
}
}
}
/** set the return message */
$arr = array('a' => $action, 'n' => $x);
if ($type == 'page') {
$arr['post_type'] = 'page';
}
$sendback = add_query_arg(array($arr), '', $sendback);
} else {
/** set the return message */
$sendback = add_query_arg(array('a' => 'none'), '', $sendback);
}
break;
default:
return;
}
/** if we did not return already, we need to wp_redirect */
wp_redirect($sendback);
exit;
}