本文整理汇总了PHP中set_current_screen函数的典型用法代码示例。如果您正苦于以下问题:PHP set_current_screen函数的具体用法?PHP set_current_screen怎么用?PHP set_current_screen使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了set_current_screen函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: test_output
function test_output()
{
// Create a post.
$post_id = $this->factory->post->create();
$meta = $this->utils->additional1;
// Add additional post meta to the post.
update_post_meta($post_id, '_ac_additional_content', array($meta));
$meta['additional_content'] = 'new_content';
// The following functions should not output anything.
ob_start();
$sort = sort_by_priority(array($meta));
$string = is_empty_string('string');
$defaults = get_defaults();
$update = update_additional_meta($post_id, array($meta));
// Uses the AC_Public class.
$content = get_content('content', $post_id);
// post-new screen
set_current_screen('post-new.php');
$this->utils->setup_post_screen();
$classes = metabox_classes();
$text = metabox_text();
$metabox = metabox_defaults();
$label = label_text(array($meta));
$out = ob_get_clean();
$this->assertEquals('', $out);
}
开发者ID:keesiemeijer,项目名称:additional-content,代码行数:26,代码来源:test-misc.php
示例2: wowslider_set_screen_id
function wowslider_set_screen_id()
{
$screen = get_current_screen();
if ('toplevel_page_wowslider/admin' == $screen->id) {
set_current_screen('wowslider_sliders');
}
}
开发者ID:owesome2015,项目名称:MOSES-S-WORK,代码行数:7,代码来源:admin.php
示例3: setUp
public function setUp()
{
parent::setUp();
// Create a new user then add 'edit_theme_options' capability
$user_id = $this->factory->user->create();
$user = wp_set_current_user($user_id);
$user->add_cap('edit_theme_options');
// Pretending in customize page.
if (!isset($_REQUEST['wp_customize'])) {
$_REQUEST['wp_customize'] = 'on';
}
if (!class_exists('WP_Customize_Manager')) {
require_once ABSPATH . WPINC . '/class-wp-customize-manager.php';
}
// Init Customize class.
if (!isset($GLOBALS['wp_customize'])) {
$GLOBALS['wp_customize'] = new WP_Customize_Manager();
}
// Removes any registered actions (in which some themes use) and re-register action
// from this plugin.
remove_all_actions('customize_register');
add_action('customize_register', array('Widget_Customizer', 'customize_register'));
set_current_screen('customize');
do_action('customize_register', $GLOBALS['wp_customize']);
}
开发者ID:niceit,项目名称:rockets,代码行数:25,代码来源:test-widget-customizer.php
示例4: setUp
function setUp()
{
parent::setUp();
set_current_screen('edit-page');
$GLOBALS['hook_suffix'] = '';
$this->table = _get_list_table('WP_Posts_List_Table');
}
开发者ID:atimmer,项目名称:wordpress-develop-mirror,代码行数:7,代码来源:includesListTable.php
示例5: setUp
function setUp()
{
global $wp_rewrite;
parent::setUp();
set_current_screen('front');
$GLOBALS['wp_the_query'] = new WP_Query();
$GLOBALS['wp_query'] = $GLOBALS['wp_the_query'];
$wp_rewrite->init();
$wp_rewrite->set_permalink_structure('/%year%/%monthnum%/%day%/%postname%/');
create_initial_taxonomies();
register_taxonomy('testtax', 'post', array('public' => true));
$wp_rewrite->flush_rules();
$this->tag_id = $this->factory->tag->create(array('slug' => 'tag-slug'));
$this->cat_id = $this->factory->category->create(array('slug' => 'cat-slug'));
$this->tax_id = $this->factory->term->create(array('taxonomy' => 'testtax', 'slug' => 'tax-slug'));
$this->tax_id2 = $this->factory->term->create(array('taxonomy' => 'testtax', 'slug' => 'tax-slug2'));
$this->post_id = $this->factory->post->create();
wp_set_object_terms($this->post_id, $this->cat_id, 'category');
wp_set_object_terms($this->post_id, array($this->tax_id, $this->tax_id2), 'testtax');
$this->cat = get_term($this->cat_id, 'category');
_make_cat_compat($this->cat);
$this->tag = get_term($this->tag_id, 'post_tag');
$this->uncat = get_term_by('slug', 'uncategorized', 'category');
_make_cat_compat($this->uncat);
add_action('pre_get_posts', array($this, 'pre_get_posts_tax_category_tax_query'));
}
开发者ID:boonebgorges,项目名称:wp,代码行数:26,代码来源:taxQuery.php
示例6: dialog
/**
* Sets up the move tickets dialog.
*/
public function dialog()
{
if (!$this->is_move_tickets_dialog()) {
return;
}
if (!wp_verify_nonce($_GET['check'], 'move_tickets')) {
return;
}
$event_id = isset($_GET['event_id']) ? absint($_GET['event_id']) : absint($_GET['post']);
$attendee_ids = array_map('intval', explode('|', @$_GET['ticket_ids']));
$this->build_attendee_list($attendee_ids, $event_id);
/**
* Provides an opportunity to modify the template variables used in the
* move tickets dialog.
*
* @param array $template_vars
*/
$template_vars = (array) apply_filters('tribe_tickets_move_tickets_template_vars', array('title' => __('Move Attendees', 'event-tickets'), 'mode' => 'move_tickets', 'check' => wp_create_nonce('move_tickets'), 'event_name' => get_the_title($event_id), 'attendees' => $this->attendees, 'multiple_providers' => $this->has_multiple_providers));
set_current_screen();
define('IFRAME_REQUEST', true);
$this->dialog_assets();
iframe_header($template_vars['title']);
extract($template_vars);
include EVENT_TICKETS_DIR . '/src/admin-views/move-tickets.php';
iframe_footer();
exit;
}
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:30,代码来源:Move_Tickets.php
示例7: test_submenu_contexts
/**
* Test context calculations for submenus.
*/
public function test_submenu_contexts()
{
$screen = get_current_screen();
$self = isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : null;
$page = isset($_GET['page']) ? $_GET['page'] : null;
$submenus = _fieldmanager_registry('submenus');
_fieldmanager_registry('submenus', array());
// Spoof is_admin().
set_current_screen('dashboard-user');
// Submenu of a default WordPress menu.
$options_submenu = rand_str();
fm_register_submenu_page($options_submenu, 'options-general.php', 'Options');
$_SERVER['PHP_SELF'] = '/options-general.php';
$_GET['page'] = $options_submenu;
$this->assertEquals(array('submenu', $options_submenu), fm_calculate_context());
// Submenu of a custom menu.
$custom_menu_submenu = rand_str();
fm_register_submenu_page($custom_menu_submenu, rand_str(), 'Custom');
$_SERVER['PHP_SELF'] = '/admin.php';
$_GET['page'] = $custom_menu_submenu;
$this->assertEquals(array('submenu', $custom_menu_submenu), fm_calculate_context());
// Submenu that Fieldmanager didn't register.
$_SERVER['PHP_SELF'] = '/themes.php';
$_GET['page'] = rand_str();
$this->assertEquals(array(null, null), fm_calculate_context());
$GLOBALS['current_screen'] = $screen;
$_SERVER['PHP_SELF'] = $self;
$_GET['page'] = $page;
_fieldmanager_registry('submenus', $submenus);
}
开发者ID:BurlesonBrad,项目名称:vip-mu-plugins-public,代码行数:33,代码来源:test-fieldmanager-calculate-context.php
示例8: setUp
public function setUp()
{
parent::setUp();
set_current_screen('dashboard');
//$this->factory = new EDD_UnitTest_Factory;
//require_once dirname(__FILE__) . '/../subclasses/test_shortcode.php';
}
开发者ID:raulmontejo,项目名称:vimeography,代码行数:7,代码来源:testcase.php
示例9: setUp
/**
* Performs WordPress setup and pre test cleanup. add to this method as needed.
*/
function setUp()
{
parent::setUp();
$GLOBALS['wp_tests_options'] = array('active_plugins' => array('wolfnet-idx-for-wordpress/wolfnet.php'));
// we need to be admin to test the admin views
wp_set_current_user($this->factory->user->create(array('role' => 'administrator')));
set_current_screen('index.php');
// a new instance with active admin user
$this->wolfnet = new Wolfnet();
$GLOBALS['wolfnet'] =& $this->wolfnet;
// // protected reflection class needed
// $key = $this->wolfnet->setJsonProductKey($GLOBALS['wnt_tests_options']['api_key_good1']);
// $option = $wolfnet_productKey->wolfnet->productKeyOptionKey;
// update_option($key);
// set a product key in the wordpress setting.
// there is a test for this in test-wolfnet.php
$this->wolfnet_reflection = new ReflectionClass("wolfnet");
$method = $this->wolfnet_reflection->getMethod("setJsonProductKey");
$method->setAccessible(true);
$productKeyOptionKey = $this->wolfnet_reflection->getProperty('productKeyOptionKey');
$productKeyOptionKey->setAccessible(true);
$key = $productKeyOptionKey->getValue($this->wolfnet);
$key_json = $method->invoke($this->wolfnet, $GLOBALS['wnt_tests_options']['api_key_good1']);
update_option($key, $key_json);
// this will match any <tag>.
$this->wnt_html_regex = '/<[^>]*>/';
$this->wnt_html_msg = "Method returned nothing that looks like an HTML tag";
}
开发者ID:TheNewCoke,项目名称:wordpressplugin,代码行数:31,代码来源:test-wolfnet-views.php
示例10: test_plugin_option_insert_and_delete
function test_plugin_option_insert_and_delete()
{
//setting up subscriber user with admin permission
$user = new WP_User($this->factory->user->create(array('role' => 'administrator')));
wp_set_current_user($user->ID);
$this->auxClass->set_up_post_data();
set_current_screen('edit-page');
$plugin_admin = wp_tutorial_maker_Admin::get_instance();
//define new term
$tid = $this->generate_tid();
//getting the number of current base decider
$base_decider_count = $this->auxClass->get_option_array_count();
//submitting data!
$plugin_admin->wp_tutorial_maker_option_update($tid);
//getting the current count
$wp_tutorial_maker_decider_options_count = $this->auxClass->get_option_array_count();
//should achieve successfull submission and increase the base data by 1, since we have permission
$this->assertEquals($wp_tutorial_maker_decider_options_count, $base_decider_count + 1);
//delete
$plugin_admin->wp_tutorial_maker_option_delete($tid);
//getting the current count
$wp_tutorial_maker_decider_options_count = $this->auxClass->get_option_array_count();
//should achieve successfull submission and increase the base data by 1, since we have permission
$this->assertEquals($wp_tutorial_maker_decider_options_count, $base_decider_count);
}
开发者ID:ilanzaro,项目名称:wp-tutorial-maker,代码行数:25,代码来源:test_wp_tutorial_maker_admin_tests.php
示例11: setUp
public function setUp()
{
parent::setUp();
// Spoof is_admin() for fm_add_script().
$this->screen = get_current_screen();
set_current_screen('dashboard-user');
// Re-init scripts. @see Tests_Dependencies_Scripts.
$this->old_wp_scripts = isset($GLOBALS['wp_scripts']) ? $GLOBALS['wp_scripts'] : null;
remove_action('wp_default_scripts', 'wp_default_scripts');
$GLOBALS['wp_scripts'] = new WP_Scripts();
$GLOBALS['wp_scripts']->default_version = get_bloginfo('version');
// Media will only try to register a script once, so hack around that.
Fieldmanager_Media::$has_registered_media = false;
// Instantiate field classes that register scripts.
new Fieldmanager_Autocomplete('Test', array('datasource' => new Fieldmanager_Datasource_Post()));
new Fieldmanager_Datepicker('Test');
new Fieldmanager_DraggablePost('Test');
new Fieldmanager_Grid('Test');
new Fieldmanager_Group('Test', array('tabbed' => 'horizontal'));
new Fieldmanager_Media('Test');
new Fieldmanager_Select('Test');
new Fieldmanager_RichTextArea('Test');
do_action('wp_enqueue_scripts');
do_action('admin_enqueue_scripts');
}
开发者ID:stevenslack,项目名称:wordpress-fieldmanager,代码行数:25,代码来源:test-fieldmanager-script-loading.php
示例12: gmedia_blank_page
/**
* Load gmedia pages in wpless interface
*/
function gmedia_blank_page()
{
set_current_screen('GrandMedia_Settings');
global $gmCore;
$gmediablank = $gmCore->_get('gmediablank', '');
/*
add_filter('admin_body_class', function(){
$gmediablank = isset($_GET['gmediablank'])? $_GET['gmediablank'] : '';
return "gmedia-blank $gmediablank"; });
*/
add_filter('admin_body_class', create_function('', '$gmediablank = isset($_GET["gmediablank"])? $_GET["gmediablank"] : ""; return "gmedia-blank $gmediablank";'));
define('IFRAME_REQUEST', true);
iframe_header('GmediaGallery');
switch ($gmediablank) {
case 'update_plugin':
require_once dirname(dirname(__FILE__)) . '/update.php';
gmedia_do_update();
break;
case 'image_editor':
require_once dirname(dirname(__FILE__)) . '/inc/image-editor.php';
gmedia_image_editor();
break;
}
iframe_footer();
exit;
}
开发者ID:HugoLS,项目名称:Variation,代码行数:29,代码来源:admin.php
示例13: test_post_type_metabox
function test_post_type_metabox()
{
$type = uix()->ui->post_type['employee'];
$_POST['uix-text-textuix-section-one_sectionuix-metabox-myboxuix-post-employee'] = 'saved';
$metabox = $type->metabox('mybox', array('name' => 'my box', 'description' => 'my meta box', 'template' => __DIR__ . '/ui/box/include_template.php', 'chromeless' => true, 'section' => array('one_section' => array('label' => 'test', 'control' => array('text' => array('type' => 'text', 'value' => 'demo'), 'no_update' => array('type' => 'text', 'value' => null))))));
$screen = set_current_screen('employee');
$this->assertTrue($metabox->is_active());
$screen = convert_to_screen('edit-employee');
//$_POST[ $metabox->id() ] = array
$data = $metabox->get_data();
$test_data = array('one_section' => array('text' => 'saved', 'no_update' => null));
//$this->assertSame( $data, $test_data );
$post_id = $this->factory->post->create_object(array('post_type' => 'employee'));
update_post_meta($post_id, 'no_update', 'remove me');
$update_post = $this->factory->post->update_object($post_id, array('post_title' => 'updated'));
$post = get_post($post_id);
do_action('add_meta_boxes', 'employee', $post);
ob_start();
$metabox->enqueue_core();
$html = ob_get_clean();
$this->assertTrue(is_string($html));
ob_start();
$metabox->create_metabox($post);
$html = ob_get_clean();
$this->assertTrue(is_string($html));
}
开发者ID:Desertsnowman,项目名称:UIX,代码行数:26,代码来源:tests-screens.php
示例14: _handle_action
function _handle_action($action, $params)
{
if (!current_user_can('update_plugins')) {
// Not allowed, skip...
return null;
}
$updater = $this->object->get_registry()->get_module('photocrati-auto_update');
if ($updater != null) {
$result = null;
switch ($action) {
case 'handle-item':
$item = $params['update-item'];
$command_action = $item['action'];
$command_info = $item['info'];
$command_stage = isset($command_info['-command-stage']) ? $command_info['-command-stage'] : null;
// XXX this is just to load a nice icon...but seems to be broken ('index' loads 'dashboard' which is missing)
if ($command_stage == 'install') {
$layout_screen = null;
if (function_exists('get_current_screen')) {
$layout_screen = get_current_screen();
} else {
global $current_screen;
$layout_screen = $current_screen;
}
if ($layout_screen == null && function_exists('set_current_screen')) {
set_current_screen('index');
}
}
if ($command_stage == 'cleanup') {
update_option('photocrati_auto_update_admin_update_list', null);
update_option('photocrati_auto_update_admin_check_date', '');
}
$result = $updater->execute_api_command($command_action, $command_info);
return array('action' => $command_action, 'info' => $result);
case 'handle-list':
$item_list = $params['update-list'];
$return_list = array();
$clear_cache = false;
foreach ($item_list as $item) {
$command_action = $item['action'];
$command_info = $item['info'];
$command_stage = isset($command_info['-command-stage']) ? $command_info['-command-stage'] : null;
// Atomic handling of entire command lists is only supported for activation stage
if ($command_stage == 'activate') {
$result = $updater->execute_api_command($command_action, $command_info);
$item['info'] = $result;
$clear_cache = true;
}
$return_list[] = $item;
}
if ($clear_cache) {
update_option('photocrati_auto_update_admin_update_list', null);
update_option('photocrati_auto_update_admin_check_date', '');
}
return $return_list;
}
}
return null;
}
开发者ID:CodeNoEvil,项目名称:mbp_web_infrastructure,代码行数:59,代码来源:class.autoupdate_admin_ajax.php
示例15: setUp
function setUp()
{
parent::setUp();
wp_set_current_user($this->factory->user->create(array('role' => 'administrator')));
set_current_screen('index.php');
// a new instance with active admin user
$this->wolfnet = new Wolfnet();
}
开发者ID:TheNewCoke,项目名称:wordpressplugin,代码行数:8,代码来源:test-wolfnet-admin.php
示例16: test_current_post_type_custom_post_type
function test_current_post_type_custom_post_type()
{
register_post_type('content');
set_current_screen('content');
$this->assertEquals('content', self::$EditFlowModule->get_current_post_type());
_unregister_post_type('content');
set_current_screen('front');
}
开发者ID:philoserf,项目名称:Edit-Flow,代码行数:8,代码来源:test-edit-flow-class-module.php
示例17: setUp
function setUp()
{
parent::setUp();
set_current_screen('front');
update_option('comments_per_page', 5);
update_option('posts_per_page', 5);
create_initial_taxonomies();
$this->set_permalink_structure('/%year%/%monthnum%/%day%/%postname%/');
}
开发者ID:pbearne,项目名称:contrib2core,代码行数:9,代码来源:conditionals.php
示例18: setUp
function setUp()
{
global $post;
parent::setUp();
$this->editor = new Editor(WP_Gistpen::$plugin_name, WP_Gistpen::$version);
$this->create_post_and_children();
set_current_screen('gistpen');
$post = $this->gistpen;
}
开发者ID:petermac-,项目名称:WP-Gistpen,代码行数:9,代码来源:test-editor.php
示例19: setUp
public function setUp()
{
$this->screen = get_current_screen();
$this->self = isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : null;
$this->get = $_GET;
$this->submenus = _fieldmanager_registry('submenus');
_fieldmanager_registry('submenus', array());
// Spoof is_admin().
set_current_screen('dashboard-user');
}
开发者ID:stevenslack,项目名称:wordpress-fieldmanager,代码行数:10,代码来源:test-fieldmanager-calculate-context.php
示例20: __construct
public function __construct()
{
require_once WPSC_FILE_PATH . '/wpsc-admin/includes/product-variation-list-table.class.php';
$GLOBALS['hook_suffix'] = 'wpsc-product-variations-iframe';
$this->parent_id = absint($_REQUEST['product_id']);
set_current_screen();
if (!empty($_REQUEST['tab'])) {
$this->current_tab = $_REQUEST['tab'];
}
}
开发者ID:pankajsinghjarial,项目名称:SYLC,代码行数:10,代码来源:product-variations-page.class.php
注:本文中的set_current_screen函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论