本文整理汇总了PHP中add_screen_option函数的典型用法代码示例。如果您正苦于以下问题:PHP add_screen_option函数的具体用法?PHP add_screen_option怎么用?PHP add_screen_option使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了add_screen_option函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addAdminPageScreenOptions
/**
* Sets Admin page screen options
*/
public static function addAdminPageScreenOptions()
{
require_once 'AddActionsAndFilters_DataModelConfig.php';
$option = 'per_page';
$args = array('label' => 'Code Items', 'default' => AddActionsAndFilters_DataModelConfig::PER_PAGE_DEFAULT, 'option' => AddActionsAndFilters_DataModelConfig::PER_PAGE_OPTION);
add_screen_option($option, $args);
}
开发者ID:mdsimpson,项目名称:wordpress-plugin-shortcodes-actions-filters,代码行数:10,代码来源:AddActionsAndFilters_ViewAdminPage.php
示例2: screen_option
/**
* Screen options
*/
public function screen_option()
{
$option = 'per_page';
$args = ['label' => 'Purchase codes', 'default' => 30, 'option' => 'licenses_per_page'];
add_screen_option($option, $args);
$this->licenses_obj = new LicensesTable();
}
示例3: screen_option
public function screen_option()
{
$option = 'per_page';
$args = ['label' => __('Address', 'miklaj-notification'), 'default' => 5, 'option' => 'addressess_per_page'];
add_screen_option($option, $args);
$this->notification_list_obj = new Miklaj_Notification_List();
}
示例4: init
/**
* Initialise common elements for all pages of the admin screen.
* Add metaboxes and contextual help to admin screen.
* Add social media button javascript to page footer.
*
* @since 1.1
*/
public function init()
{
if (!empty($_GET['tab'])) {
if ('support' == $_GET['tab']) {
$tab = 'support';
}
} else {
$tab = 'settings';
}
add_screen_option('layout_columns', array('max' => 2));
// Support tab
if ('support' == $tab) {
add_meta_box('bpl-helpushelpyou', __('Help Me Help You', 'bpl'), array($this, 'helpushelpyou'), 'settings_page_bplabs', 'side', 'high');
} else {
add_meta_box('bpl-likethis', __('Love BP Labs?', 'bpl'), array($this, 'like_this_plugin'), 'settings_page_bplabs', 'side', 'default');
}
// All tabs
add_meta_box('bpl-paypal', __('Give Kudos', 'bpl'), array($this, '_paypal'), 'settings_page_bplabs', 'side', 'default');
add_meta_box('bpl-latest', __('Latest News', 'bpl'), array($this, 'metabox_latest_news'), 'settings_page_bplabs', 'side', 'default');
wp_enqueue_script('postbox');
wp_enqueue_script('dashboard');
?>
<script type="text/javascript" src="https://apis.google.com/js/plusone.js">
{parsetags: 'explicit'}
</script>
<script type="text/javascript">gapi.plusone.go();</script>
<?php
}
示例5: load
/**
* Construct the parent class.
* @access public
*/
public function load()
{
global $status, $page;
parent::__construct(array('singular' => 'activity', 'plural' => 'activity', 'ajax' => true));
add_screen_option('per_page', array('default' => 15, 'label' => __('Events per page', 'revisr'), 'option' => 'edit_revisr_events_per_page'));
set_screen_options();
}
示例6: __construct
public function __construct($args = array())
{
$current_screen = get_current_screen();
$args = wp_parse_args($args, array('screen' => $current_screen, 'columns' => array(), 'sortable_columns' => array(), 'actions_column' => '', 'bulk_actions' => array(), 'item_callback' => '', 'per_page' => array(), 'views' => '', 'style' => ''));
$this->columns = $args['columns'];
$this->sortable_columns = $args['sortable_columns'];
$this->bulk_actions = $args['bulk_actions'];
$this->actions_column = $args['actions_column'];
$this->style = $args['style'];
$this->set_columns();
if ($args['per_page']) {
if (is_array($args['per_page'])) {
add_screen_option('per_page', $args['per_page']);
// 选项
} elseif (is_numeric($args['per_page'])) {
$this->per_page = $args['per_page'];
// 直接设定了值
}
}
if ($args['item_callback']) {
add_filter($this->singular . '_item_callback', $args['item_callback']);
}
if ($args['views']) {
add_filter('views_' . $current_screen->id, $args['views']);
}
add_action('admin_head', array($this, 'admin_head'));
parent::__construct($args);
}
示例7: add_options
/**
*
*/
public static function add_options()
{
global $PV_Admin_Page;
$args = array('label' => 'Rows', 'default' => 10, 'option' => 'commission_per_page');
add_screen_option('per_page', $args);
$PV_Admin_Page = new WCV_Admin_Page();
}
示例8: load_page
public function load_page()
{
if (is_admin() && WP_Stream_Reports_Settings::is_first_visit()) {
$this->setup_user();
}
// Add screen option for chart height
add_filter('screen_settings', array($this, 'chart_height_display'), 10, 2);
// Enqueue all core scripts required for this page to work
add_screen_option('layout_columns', array('max' => 2, 'default' => 2));
// Add all metaboxes
foreach (self::$sections as $key => $section) {
$delete_url = add_query_arg(array_merge(array('action' => 'wp_stream_reports_delete_metabox', 'key' => $key), WP_Stream_Reports::$nonce), admin_url('admin-ajax.php'));
// Configure button
$configure = sprintf('<span class="postbox-title-action">
<a href="javascript:void(0);" class="edit-box open-box">%3$s</a>
</span>
<span class="postbox-title-action postbox-delete-action">
<a href="%1$s">
%2$s
</a>
</span>', esc_url($delete_url), esc_html__('Delete', 'stream-reports'), esc_html__('Configure', 'stream-reports'));
// Parse default argument
$section = $this->parse_section($section);
// Set the key for template use
$section['key'] = $key;
$section['generated_title'] = $this->get_generated_title($section);
// Generate the title automatically if not already set
$title = empty($section['title']) ? $section['generated_title'] : $section['title'];
// Add the actual metabox
add_meta_box(self::META_PREFIX . $key, sprintf('<span class="title">%s</span>%s', esc_html($title), $configure), array($this, 'metabox_content'), WP_Stream_Reports::$screen_id, $section['context'], $section['priority'], $section);
}
}
示例9: _add_options
/**
* @hook $page_hook
*/
public function _add_options()
{
$option = 'per_page';
//wordpress api
$args = array('label' => 'Kết quả hiển thị', 'default' => 10, 'option' => 'hw_items_per_page');
add_screen_option($option, $args);
}
示例10: __construct
/**
* The constructor function for our class.
* Adds hooks, initializes variables, setups class.
*/
function __construct()
{
global $status, $page;
$screen = get_current_screen();
/* Determine the status */
$status = 'all';
$statuses = array('active', 'inactive', 'recently_activated', 'admin', 'frontend');
if (isset($_REQUEST['status']) && in_array($_REQUEST['status'], $statuses)) {
$status = $_REQUEST['status'];
}
/* Add the search query to the URL */
if (isset($_REQUEST['s'])) {
$_SERVER['REQUEST_URI'] = add_query_arg('s', stripslashes($_REQUEST['s']));
}
/* Add a snippets per page screen option */
$page = $this->get_pagenum();
add_screen_option('per_page', array('label' => __('Snippets per page', 'code-snippets'), 'default' => 10, 'option' => 'snippets_per_page'));
/* Set the table columns hidden in Screen Options by default */
add_filter("get_user_option_manage{$screen->id}columnshidden", array($this, 'get_default_hidden_columns'), 15);
/* Strip once-off query args from the URL */
$_SERVER['REQUEST_URI'] = remove_query_arg(array('activate', 'activate-multi', 'deactivate', 'deactivate-multi', 'delete', 'delete-multi'));
/* Add filters to format the snippet description in the same way the post content is formatted */
$filters = array('wptexturize', 'convert_smilies', 'convert_chars', 'wpautop', 'shortcode_unautop', 'capital_P_dangit');
foreach ($filters as $filter) {
add_filter('code_snippets/list_table/print_snippet_description', $filter);
}
/* Setup the class */
parent::__construct(array('singular' => 'snippet', 'plural' => 'snippets', 'ajax' => true));
}
示例11: screen_options
function screen_options()
{
//execute only on login_log page, othewise return null
$page = isset($_GET['page']) ? esc_attr($_GET['page']) : false;
if ('login_log' != $page) {
return;
}
$current_screen = get_current_screen();
//define options
$per_page_field = 'per_page';
$per_page_option = $current_screen->id . '_' . $per_page_field;
//Save options that were applied
if (isset($_REQUEST['wp_screen_options']) && isset($_REQUEST['wp_screen_options']['value'])) {
update_option($per_page_option, esc_html($_REQUEST['wp_screen_options']['value']));
}
//prepare options for display
//if per page option is not set, use default
$per_page_val = get_option($per_page_option, 20);
$args = array('label' => __('Records', 'sll'), 'default' => $per_page_val);
//display options
add_screen_option($per_page_field, $args);
$_per_page = get_option('users_page_login_log_per_page');
//needs to be initialized early enough to pre-fill screen options section in the upper (hidden) area.
$this->log_table = new SLL_List_Table();
}
示例12: wc_customer_relationship_manager_add_options
function wc_customer_relationship_manager_add_options()
{
$option = 'per_page';
$args = array('label' => __('Customers', 'wc_customer_relationship_manager'), 'default' => 20, 'option' => 'customers_per_page');
add_screen_option($option, $args);
WC_CRM()->customers_table();
}
示例13: load
/**
* Construct the parent class.
* @access public
*/
public function load()
{
global $status, $page;
parent::__construct(array('singular' => 'repository', 'plural' => 'repositories'));
add_screen_option('per_page', array('default' => 10, 'label' => __('Repositories per page', 'revisr'), 'option' => 'edit_revisr_repositories_per_page'));
set_screen_options();
}
示例14: setup
/**
* Set up the view with data and do things that are specific for this view
*
* @since 1.0.0
*
* @param string $action Action for this view
* @param array $data Data for this view
*/
public function setup($action, $data)
{
parent::setup($action, $data);
add_thickbox();
$this->admin_page->enqueue_script('list', array('jquery'), array('list' => array('shortcode_popup' => __('To embed this table into a post or page, use this Shortcode:', 'tablepress'), 'donation-message-already-donated' => __('Thank you very much! Your donation is highly appreciated. You just contributed to the further development of TablePress!', 'tablepress'), 'donation-message-maybe-later' => sprintf(__('No problem! I still hope you enjoy the benefits that TablePress adds to your site. If you should change your mind, you\'ll always find the “Donate” button on the <a href="%s">TablePress website</a>.', 'tablepress'), 'http://tablepress.org/'))));
if ($data['messages']['first_visit']) {
$this->add_header_message('<strong><em>' . __('Welcome!', 'tablepress') . '</em></strong><br />' . __('Thank you for using TablePress for the first time!', 'tablepress') . ' ' . sprintf(__('If you encounter any questions or problems, please visit the <a href="%1$s">FAQ</a>, the <a href="%2$s">documentation</a>, and the <a href="%3$s">Support</a> section on the <a href="%4$s">plugin website</a>.', 'tablepress'), 'http://tablepress.org/faq/', 'http://tablepress.org/documentation/', 'http://tablepress.org/support/', 'http://tablepress.org/') . '<br /><br />' . $this->ajax_link(array('action' => 'hide_message', 'item' => 'first_visit', 'return' => 'list'), __('Hide this message', 'tablepress')));
}
if ($data['messages']['wp_table_reloaded_warning']) {
$this->add_header_message('<strong><em>' . __('Attention!', 'tablepress') . '</em></strong><br />' . __('You have activated the plugin WP-Table Reloaded, which can not be used together with TablePress.', 'tablepress') . '<br />' . __('It is strongly recommended that you switch from WP-Table Reloaded to TablePress, which not only fixes many problems, but also has more and better features than WP-Table Reloaded.', 'tablepress') . '<br />' . sprintf(__('Please follow the <a href="%s">migration guide</a> to move your tables and then deactivate WP-Table Reloaded!', 'tablepress'), 'http://tablepress.org/migration-from-wp-table-reloaded/') . '<br />' . '<a href="' . TablePress::url(array('action' => 'import')) . '" class="button button-primary button-large" title="' . __('Import your tables from WP-Table Reloaded', 'tablepress') . '" style="color:#ffffff;margin-top:5px;">' . __('Import your tables from WP-Table Reloaded', 'tablepress') . '</a>', 'error');
}
if ($data['messages']['donation_message']) {
$this->add_header_message('<img alt="' . __('Tobias Bäthge, developer of TablePress', 'tablepress') . '" src="https://secure.gravatar.com/avatar/50f1cff2e27a1f522b18ce229c057bc5?s=94" height="94" width="94" style="float:left;margin-right:10px;" />' . __('Hi, my name is Tobias, I\'m the developer of the TablePress plugin.', 'tablepress') . '<br /><br />' . __('Thanks for using it! You\'ve installed TablePress over a month ago.', 'tablepress') . ' ' . sprintf(_n('If everything works and you are satisfied with the results of managing your %s table, isn\'t that worth a coffee or two?', 'If everything works and you are satisfied with the results of managing your %s tables, isn\'t that worth a coffee or two?', $data['table_count'], 'tablepress'), $data['table_count']) . '<br/>' . sprintf(__('<a href="%s">Donations</a> help me to continue user support and development of this <em>free</em> software — things for which I spend countless hours of my free time! Thank you very much!', 'tablepress'), 'http://tablepress.org/donate/') . '<br/><br />' . __('Sincerly, Tobias', 'tablepress') . '<br /><br />' . sprintf('<a href="%s" target="_blank"><strong>%s</strong></a>', 'http://tablepress.org/donate/', __('Sure, I\'ll buy you a coffee and support TablePress!', 'tablepress')) . ' · ' . $this->ajax_link(array('action' => 'hide_message', 'item' => 'donation_nag', 'return' => 'list', 'target' => 'already-donated'), __('I already donated.', 'tablepress')) . ' · ' . $this->ajax_link(array('action' => 'hide_message', 'item' => 'donation_nag', 'return' => 'list', 'target' => 'maybe-later'), __('No, thanks. Don\'t ask again.', 'tablepress')));
}
if ($data['messages']['show_plugin_update']) {
$message = '<strong><em>' . sprintf(__('Thank you for updating to TablePress %s!', 'tablepress'), TablePress::version) . '</em></strong><br />';
if (!empty($data['messages']['plugin_update_message'])) {
$message .= $data['messages']['plugin_update_message'] . '<br />';
}
$message .= sprintf(__('Please read the <a href="%s">release announcement</a> for more information.', 'tablepress'), 'http://tablepress.org/news/') . ' ' . sprintf(__('If you like the new features and enhancements, <a href="%s">giving a donation</a> towards the further support and development of TablePress is recommended. Thank you!', 'tablepress'), 'http://tablepress.org/donate/') . '<br /><br />';
$message .= $this->ajax_link(array('action' => 'hide_message', 'item' => 'plugin_update', 'return' => 'list'), __('Hide this message', 'tablepress'));
$this->add_header_message($message);
}
$this->process_action_messages(array('success_delete' => _n('The table was deleted successfully.', 'The tables were deleted successfully.', 1, 'tablepress'), 'success_delete_plural' => _n('The table was deleted successfully.', 'The tables were deleted successfully.', 2, 'tablepress'), 'error_delete' => __('Error: The table could not be deleted.', 'tablepress'), 'error_save' => __('Error: The table could not be saved.', 'tablepress'), 'success_copy' => _n('The table was copied successfully.', 'The tables were copied successfully.', 1, 'tablepress'), 'success_copy_plural' => _n('The table was copied successfully.', 'The tables were copied successfully.', 2, 'tablepress'), 'error_copy' => __('Error: The table could not be copied.', 'tablepress'), 'error_no_table' => __('Error: You did not specify a valid table ID.', 'tablepress'), 'error_load_table' => __('Error: This table could not be loaded!', 'tablepress'), 'error_bulk_action_invalid' => __('Error: This bulk action is invalid!', 'tablepress'), 'error_no_selection' => __('Error: You did not select any tables!', 'tablepress'), 'error_delete_not_all_tables' => __('Notice: Not all selected tables could be deleted!', 'tablepress'), 'error_copy_not_all_tables' => __('Notice: Not all selected tables could be copied!', 'tablepress'), 'success_import' => __('The tables were imported successfully.', 'tablepress'), 'success_import_wp_table_reloaded' => __('The tables were imported successfully from WP-Table Reloaded.', 'tablepress')));
$this->add_text_box('head', array($this, 'textbox_head'), 'normal');
$this->add_text_box('tables-list', array($this, 'textbox_tables_list'), 'normal');
add_screen_option('per_page', array('label' => __('Tables', 'tablepress'), 'default' => 20));
// Admin_Controller contains function to allow changes to this in the Screen Options to be saved
$this->wp_list_table = new TablePress_All_Tables_List_Table();
$this->wp_list_table->set_items($this->data['tables']);
$this->wp_list_table->prepare_items();
// cleanup Request URI string, which WP_List_Table uses to generate the sort URLs
$_SERVER['REQUEST_URI'] = remove_query_arg(array('message', 'table_id'), $_SERVER['REQUEST_URI']);
}
示例15: wp_event_calendar_admin_add_screen_options
/**
* Admin screen options
*
* @since 0.1.0
*/
function wp_event_calendar_admin_add_screen_options()
{
// columns screen option
add_screen_option('layout_type', array('label' => _x('Layout', 'Month, Week, or Day (screen options)', 'wp-event-calendar'), 'default' => 'month', 'option' => 'calendar_layout'));
// Events per day
add_screen_option('per_page', array('label' => _x('Events per day', 'Events per day (screen options)', 'wp-event-calendar'), 'default' => 10, 'option' => 'edit_calendar_per_day'));
}