当前位置: 首页>>代码示例>>PHP>>正文


PHP convert_to_screen函数代码示例

本文整理汇总了PHP中convert_to_screen函数的典型用法代码示例。如果您正苦于以下问题:PHP convert_to_screen函数的具体用法?PHP convert_to_screen怎么用?PHP convert_to_screen使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了convert_to_screen函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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

示例2: update_meta_box

 /**
  * update_meta_box
  * Check if a meta box exists and possible remove it.
  *
  * @param mixed $screen The current screen
  * @param string $id The id of the meta box
  * @param string $action Whether to search or remove the meta box
  *
  * @return mixed The position of the meta box if it was removed, otherwise the status of whether it was found.
  *
  * @access public
  * @static
  * @since 1.0
  */
 public static function update_meta_box($screen, $id, $action = 'search')
 {
     global $wp_meta_boxes;
     $check = false;
     if (empty($screen)) {
         $screen = get_current_screen();
     } elseif (is_string($screen)) {
         $screen = convert_to_screen($screen);
     }
     $page = $screen->id;
     foreach (array('normal', 'advanced', 'side') as $context) {
         foreach (array('high', 'sorted', 'core', 'default', 'low') as $priority) {
             if (isset($wp_meta_boxes[$page][$context][$priority])) {
                 foreach ($wp_meta_boxes[$page][$context][$priority] as $order => $meta_box) {
                     if ($meta_box['id'] == $id) {
                         if ($action == 'remove') {
                             unset($wp_meta_boxes[$page][$context][$priority][$order]);
                             return $order;
                         }
                         $check = true;
                     }
                 }
             }
         }
     }
     return $check;
 }
开发者ID:a42,项目名称:piklist,代码行数:41,代码来源:class-piklist-meta.php

示例3: __construct

    /**
     * Constructor.
     *
     * The child class should call this constructor from its own constructor to override
     * the default $args.
     *
     * @since 1.8
     * @access public
     *
     * @param array|string $args {
     *     Array or string of arguments.
     *
     *     @type string $plural   Plural value used for labels and the objects being listed.
     *                            This affects things such as CSS class-names and nonces used
     *                            in the list table, e.g. 'posts'. Default empty.
     *     @type string $singular Singular label for an object being listed, e.g. 'post'.
     *                            Default empty
     *     @type bool   $ajax     Whether the list table supports AJAX. This includes loading
     *                            and sorting data, for example. If true, the class will call
     *                            the {@see _js_vars()} method in the footer to provide variables
     *                            to any scripts handling AJAX events. Default false.
     *     @type string $screen   String containing the hook name used to determine the current
     *                            screen. If left null, the current screen will be automatically set.
     *                            Default null.
     * }
     */
    public function __construct( $args = array() ) {
        $args = wp_parse_args( $args, array(
            'plural' => '',
            'singular' => '',
            'ajax' => false,
            'screen' => null,
        ) );

        $this->screen = convert_to_screen( $args['screen'] );

        add_filter( "manage_{$this->screen->id}_columns", array( $this, 'get_columns' ), 0 );

        if ( !$args['plural'] )
            $args['plural'] = $this->screen->base;

        $args['plural'] = sanitize_key( $args['plural'] );
        $args['singular'] = sanitize_key( $args['singular'] );

        $this->_args = $args;

        if ( $args['ajax'] ) {
            // wp_enqueue_script( 'list-table' );
            add_action( 'admin_footer', array( $this, '_js_vars' ) );
        }

        if ( empty( $this->modes ) ) {
            $this->modes = array(
                'list' => __( 'List View' ),
                'excerpt' => __( 'Excerpt View' )
            );
        }
    }
开发者ID:rebeccayshen,项目名称:kitlist,代码行数:58,代码来源:wpv-list-table.php

示例4: calibrefx_do_meta_sections

function calibrefx_do_meta_sections($section, $screen, $context, $object)
{
    global $calibrefx_sections, $calibrefx_user_ability, $wp_meta_boxes;
    if (!isset($calibrefx_sections)) {
        return;
    }
    if (!isset($calibrefx_user_ability)) {
        $calibrefx_user_ability = 'basic';
    }
    if (empty($screen)) {
        $screen2 = get_current_screen();
    } elseif (is_string($screen)) {
        $screen2 = convert_to_screen($screen);
    }
    $page = $screen2->id;
    $sorted = get_user_option("meta-box-order_{$page}");
    if (empty($wp_meta_boxes[$page][$context]['sorted'])) {
        if (!empty($calibrefx_sections[$section]['basic'])) {
            foreach ($calibrefx_sections[$section]['basic'] as $metas) {
                add_meta_box($metas['id'], $metas['title'], $metas['callback'], $metas['screen'], $metas['context'], $metas['priority'], $metas['callback']);
            }
        }
        if (!empty($calibrefx_sections[$section]['professor']) and 'professor' === $calibrefx_user_ability) {
            foreach ($calibrefx_sections[$section]['professor'] as $metas) {
                add_meta_box($metas['id'], $metas['title'], $metas['callback'], $metas['screen'], $metas['context'], $metas['priority'], $metas['callback']);
            }
        }
    }
    do_meta_boxes($screen, $context, $object);
}
开发者ID:alispx,项目名称:calibrefx,代码行数:30,代码来源:metabox-helper.php

示例5: __construct

 function __construct($args = array())
 {
     $args = wp_parse_args($args, array('plural' => '', 'ajax' => false, 'screen' => null));
     $this->screen = convert_to_screen($args['screen']);
     add_filter("manage_{$this->screen->id}_columns", array(&$this, 'get_columns'), 0);
     $args['plural'] = sanitize_key($args['plural']);
     $this->_args = $args;
 }
开发者ID:gp6shc,项目名称:aok,代码行数:8,代码来源:userapprove_display-table.php

示例6: __construct

 public function __construct($admin_class)
 {
     $this->admin = $admin_class;
     $this->_args = ['singular' => sanitize_key(__('Post', 'sp')), 'plural' => sanitize_key(__('Posts', 'sp')), 'ajax' => false];
     $this->screen = convert_to_screen(null);
     add_filter("manage_{$this->screen->id}_columns", array($this, 'get_columns'), 0);
     $this->modes = array('list' => __('List View'), 'excerpt' => __('Excerpt View'));
 }
开发者ID:Cloudoki,项目名称:wordpress-smmp,代码行数:8,代码来源:class-smmp-post-list.php

示例7: cmb_do_meta_boxes

/**
 * Meta-Box template function
 *
 * @since 2.5.0
 *
 * @param string|object $screen Screen identifier
 * @param string $context box context
 * @param mixed $object gets passed to the box callback function as first parameter
 * @return int number of meta_boxes
 */
function cmb_do_meta_boxes($screen, $context, $object)
{
    global $wp_meta_boxes;
    static $already_sorted = false;
    if (empty($screen)) {
        $screen = get_current_screen();
    } elseif (is_string($screen)) {
        $screen = convert_to_screen($screen);
    }
    $page = $screen->id;
    $hidden = get_hidden_meta_boxes($screen);
    $i = 0;
    do {
        // Grab the ones the user has manually sorted. Pull them out of their previous context/priority and into the one the user chose
        if (!$already_sorted && ($sorted = get_user_option("meta-box-order_{$page}"))) {
            foreach ($sorted as $box_context => $ids) {
                foreach (explode(',', $ids) as $id) {
                    if ($id && 'dashboard_browser_nag' !== $id) {
                        add_meta_box($id, null, null, $screen, $box_context, 'sorted');
                    }
                }
            }
        }
        $already_sorted = true;
        if (!isset($wp_meta_boxes) || !isset($wp_meta_boxes[$page]) || !isset($wp_meta_boxes[$page][$context])) {
            break;
        }
        foreach (array('high', 'sorted', 'core', 'default', 'low') as $priority) {
            if (isset($wp_meta_boxes[$page][$context][$priority])) {
                foreach ((array) $wp_meta_boxes[$page][$context][$priority] as $box) {
                    if (false == $box || !$box['title']) {
                        continue;
                    }
                    $i++;
                    $hidden_class = in_array($box['id'], $hidden) ? ' hide-if-js' : '';
                    ?>

					<div id="<?php 
                    esc_attr_e($box['id']);
                    ?>
" class="<?php 
                    esc_attr_e(postbox_classes($box['id'], $page) . $hidden_class);
                    ?>
">

						<?php 
                    call_user_func($box['callback'], $object, $box);
                    ?>

					</div>

				<?php 
                }
            }
        }
    } while (0);
    return $i;
}
开发者ID:duncanjbrown,项目名称:Custom-Meta-Boxes,代码行数:68,代码来源:fields-anywhere.php

示例8: _WP_List_Table_Compat

 function _WP_List_Table_Compat($screen, $columns = array())
 {
     if (is_string($screen)) {
         $screen = convert_to_screen($screen);
     }
     $this->_screen = $screen;
     if (!empty($columns)) {
         $this->_columns = $columns;
         add_filter('manage_' . $screen->id . '_columns', array(&$this, 'get_columns'), 0);
     }
 }
开发者ID:snagga,项目名称:urbantac,代码行数:11,代码来源:list-table.php

示例9: __construct

 public function __construct($screen, $columns = array())
 {
     if (is_string($screen)) {
         $screen = convert_to_screen($screen);
     }
     $this->_screen = $screen;
     if (!empty($columns)) {
         $this->_columns = $columns;
         add_filter('manage_' . $screen->id . '_columns', array($this, 'get_columns'), 0);
     }
 }
开发者ID:AndreyLanko,项目名称:perevorot-prozorro-wp,代码行数:11,代码来源:list-table.php

示例10: __construct

 /**
  * Constructor, we override the parent to pass our own arguments
  * We usually focus on three parameters: singular and plural labels, as well as whether the class supports AJAX.
  */
 function __construct($screen, $columns = array())
 {
     if (is_string($screen)) {
         $screen = convert_to_screen($screen);
     }
     $this->_screen = $screen;
     if (!empty($columns)) {
         $this->_columns = $columns;
         add_filter('manage_' . $screen->id . '_columns', array(&$this, 'get_columns'), 0);
     }
     parent::__construct(array('singular' => 'wp_list_text_link', 'plural' => 'wp_list_test_links', 'ajax' => false));
     add_action('admin_enqueue_scripts', array(&$this, 'enqueueScripts'));
 }
开发者ID:nanookYs,项目名称:orientreizen,代码行数:17,代码来源:Mail.php

示例11: page_to_screen_id

 /**
  * Convert a page hook name to a screen ID.
  * 
  * @uses convert_to_screen()
  * @access private
  * 
  * @param string $page
  * @return string
  */
 function page_to_screen_id($page)
 {
     if (function_exists('convert_to_screen')) {
         $screen = convert_to_screen($page);
         if (isset($screen->id)) {
             return $screen->id;
         } else {
             return '';
         }
     } else {
         return str_replace(array('.php', '-new', '-add'), '', $page);
     }
 }
开发者ID:gumbysgoo,项目名称:bestilblomster,代码行数:22,代码来源:screen-options.php

示例12: _get_list_table

/**
 * Fetch an instance of a WP_List_Table class.
 *
 * @access private
 * @since 3.1.0
 *
 * @global string $hook_suffix
 *
 * @param string $class The type of the list table, which is the class name.
 * @param array $args Optional. Arguments to pass to the class. Accepts 'screen'.
 * @return object|bool Object on success, false if the class does not exist.
 */
function _get_list_table($class, $args = array())
{
    $core_classes = array('WP_Posts_List_Table' => 'posts', 'WP_Media_List_Table' => 'media', 'WP_Terms_List_Table' => 'terms', 'WP_Users_List_Table' => 'users', 'WP_Comments_List_Table' => 'comments', 'WP_Post_Comments_List_Table' => array('comments', 'post-comments'), 'WP_Links_List_Table' => 'links', 'WP_Plugin_Install_List_Table' => 'plugin-install', 'WP_Themes_List_Table' => 'themes', 'WP_Theme_Install_List_Table' => array('themes', 'theme-install'), 'WP_Plugins_List_Table' => 'plugins', 'WP_MS_Sites_List_Table' => 'ms-sites', 'WP_MS_Users_List_Table' => 'ms-users', 'WP_MS_Themes_List_Table' => 'ms-themes');
    if (isset($core_classes[$class])) {
        if (isset($args['screen'])) {
            $args['screen'] = convert_to_screen($args['screen']);
        } elseif (isset($GLOBALS['hook_suffix'])) {
            $args['screen'] = get_current_screen();
        } else {
            $args['screen'] = null;
        }
        return new $class($args);
    }
    return false;
}
开发者ID:inpsyde,项目名称:wordpress-dev,代码行数:27,代码来源:list-table.php

示例13: eshop_helptab

 function eshop_helptab($screen, $help)
 {
     $my_add_contextual_help_id = 0;
     if (is_string($screen)) {
         $screen = convert_to_screen($screen);
     }
     if (method_exists($screen, 'add_help_tab')) {
         // WordPress 3.3
         $my_add_contextual_help_id++;
         $screen->add_help_tab(array('title' => __('eShop Help', 'eshop'), 'id' => 'eshophelptab' . $my_add_contextual_help_id, 'content' => $help));
     } elseif (function_exists('add_contextual_help')) {
         // WordPress 3.2
         add_contextual_help($screen, $help);
     }
 }
开发者ID:par-orillonsoft,项目名称:creationOfSociety,代码行数:15,代码来源:eshop-settings-class.php

示例14: WP_List_Table

 /**
  * Constructor. The child class should call this constructor from it's own constructor
  *
  * @param array $args An associative array with information about the current table
  * @access protected
  */
 function WP_List_Table($args)
 {
     $args = wp_parse_args($args, array('screen' => '', 'plural' => '', 'singular' => '', 'ajax' => true));
     $this->_screen = $args['screen'];
     if (is_string($this->_screen)) {
         $this->_screen = convert_to_screen($this->_screen);
     }
     if (!$args['plural']) {
         $args['plural'] = $this->_screen->base;
     }
     $this->_args = $args;
     if ($args['ajax']) {
         wp_enqueue_script('admin-table');
         add_action('admin_footer', array($this, '_js_vars'));
     }
 }
开发者ID:junxuan,项目名称:wordpress,代码行数:22,代码来源:list-table.php

示例15: __construct

 /**
  * Constructor. The child class should call this constructor from its own constructor
  *
  * @param array $args
  */
 public function __construct(array $args = array())
 {
     $args = wp_parse_args($args, array('plural' => '', 'singular' => '', 'ajax' => false, 'screen' => null));
     $this->screen = convert_to_screen($args['screen']);
     add_filter("manage_{$this->screen->id}_columns", array(&$this, 'get_columns'), 0);
     if (!$args['plural']) {
         $args['plural'] = $this->screen->base;
     }
     $args['plural'] = sanitize_key($args['plural']);
     $args['singular'] = sanitize_key($args['singular']);
     $this->args = $args;
     if ($args['ajax']) {
         // wp_enqueue_script( 'list-table' );
         add_action('admin_footer', array(&$this, 'js_vars'));
     }
 }
开发者ID:brandonwamboldt,项目名称:wp-orm,代码行数:21,代码来源:ListTable.php


注:本文中的convert_to_screen函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。