Exemplo n.º 1
0
 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));
 }
Exemplo n.º 2
0
 /**
  * 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;
 }
Exemplo n.º 3
0
    /**
     * 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' )
            );
        }
    }
Exemplo n.º 4
0
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);
}
Exemplo n.º 5
0
 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;
 }
 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'));
 }
/**
 * 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;
}
Exemplo n.º 8
0
 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);
     }
 }
 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);
     }
 }
Exemplo n.º 10
0
 /**
  * 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'));
 }
Exemplo n.º 11
0
 /**
  * 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);
     }
 }
Exemplo n.º 12
0
/**
 * 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;
}
 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);
     }
 }
Exemplo n.º 14
0
 /**
  * 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'));
     }
 }
Exemplo n.º 15
0
 /**
  * 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'));
     }
 }
Exemplo n.º 16
0
 /**
  * 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())
 {
     $this->navigation = new GuiForm_Module_Navigation();
     $this->navigation->init(GuiForm_Render_Forms::NAME);
     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));
     $this->process_bulk_action();
     add_action('admin_enqueue_scripts', array(&$this, 'enqueueScripts'));
 }
Exemplo n.º 17
0
/**
 * 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])) {
        foreach ((array) $core_classes[$class] as $required) {
            require_once ABSPATH . 'wp-admin/includes/class-wp-' . $required . '-list-table.php';
        }
        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;
}
Exemplo n.º 18
0
/**
 * Fetch an instance of a WP_List_Table class.
 *
 * @access private
 * @since 3.1.0
 *
 * @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 hw_get_list_table($class, $args = array())
{
    $core_classes = array('HW_Module_Install_List_Table' => 'module-install');
    if (isset($core_classes[$class])) {
        foreach ((array) $core_classes[$class] as $required) {
            require_once HW_HOANGWEB_UTILITIES . '/admin/class-hw-' . $required . '-list-table.php';
        }
        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;
}
Exemplo n.º 19
0
function wp_ajax_fetch_list()
{
    global $current_screen, $wp_list_table;
    $list_class = $_GET['list_args']['class'];
    check_ajax_referer("fetch-list-{$list_class}", '_ajax_fetch_list_nonce');
    $current_screen = convert_to_screen($_GET['list_args']['screen']['id']);
    define('WP_NETWORK_ADMIN', $current_screen->is_network);
    define('WP_USER_ADMIN', $current_screen->is_user);
    $wp_list_table = _get_list_table($list_class);
    if (!$wp_list_table) {
        wp_die(0);
    }
    if (!$wp_list_table->ajax_user_can()) {
        wp_die(-1);
    }
    $wp_list_table->ajax_response();
    wp_die(0);
}
Exemplo n.º 20
0
 /**
  * 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)
 {
     if (is_string($screen)) {
         $screen = convert_to_screen($screen);
     }
     $this->form = esc_sql($_REQUEST['form']);
     $this->id = esc_sql($_REQUEST['id']);
     $this->navigation = new GuiForm_Module_Navigation();
     $this->navigation->init(GuiForm_Render_Forms_Notification::NAME, $this->form);
     $this->_screen = $screen;
     if (!empty($columns)) {
         $this->_columns = $columns;
         add_filter('manage_' . $this->_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, 'scripts'));
     add_filter('mce_buttons_2', array(&$this, 'wpex_mce_buttons'));
     add_filter('tiny_mce_before_init', array(&$this, 'mytheme_tinymce_settings'));
 }
Exemplo n.º 21
0
 /**
  * Hook add_meta_boxes_page
  */
 function action_add_meta_boxes_page()
 {
     global $wp_meta_boxes;
     $screen = convert_to_screen($this->_targetScreen);
     if (!isset($wp_meta_boxes[$screen->id])) {
         return;
     }
     $metaboxes =& $wp_meta_boxes[$screen->id];
     foreach ($metaboxes as $context => &$_metaboxes) {
         foreach ($_metaboxes as $priority => &$__metaboxes) {
             foreach ($__metaboxes as $id => &$metabox) {
                 if ($id !== $this->_targetMetaBox) {
                     continue;
                 }
                 $metabox['callback'] = array(&$this, 'replace_' . $this->_targetMetaBox);
                 return;
             }
         }
     }
 }
Exemplo n.º 22
0
 /**
  * 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())
 {
     global $wpdb;
     $this->current_user = get_current_user_id();
     $this->current_filter_action();
     $this->id = isset($_REQUEST['form']) ? esc_sql($_REQUEST['form']) : get_user_meta(get_current_user_id(), 'guiform_form_selected', true);
     $this->id = !empty($this->id) ? $this->id : 1;
     $this->fields = $this->_fields();
     $this->table = $wpdb->guiform_form . $this->id;
     $this->navigation = new GuiForm_Module_Navigation();
     $this->navigation->init(GuiForm_Render_Entry::NAME, $this->id);
     if (is_string($screen)) {
         $screen = convert_to_screen($screen);
     }
     $screen->id = $screen->id . '_' . $this->id;
     $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));
     $this->process_bulk_action();
     add_action('admin_enqueue_scripts', array(&$this, 'scripts'));
 }
Exemplo n.º 23
0
/**
 * Add contextual help text for a page.
 *
 * Creates an 'Overview' help tab.
 *
 * @since 2.7.0
 * @deprecated 3.3.0
 * @deprecated Use get_current_screen()->add_help_tab()
 * @see WP_Screen
 *
 * @param string    $screen The handle for the screen to add help to. This is usually the hook name returned by the add_*_page() functions.
 * @param string    $help   The content of an 'Overview' help tab.
 */
function add_contextual_help($screen, $help)
{
    _deprecated_function(__FUNCTION__, '3.3', 'get_current_screen()->add_help_tab()');
    if (is_string($screen)) {
        $screen = convert_to_screen($screen);
    }
    WP_Screen::add_old_compat_help($screen, $help);
}
Exemplo n.º 24
0
/**
 * Meta Box Accordion Template Function
 *
 * Largely made up of abstracted code from do_meta_boxes(), this
 * function serves to build meta boxes as list items for display as
 * a collapsible accordion.
 *
 * @since 3.6.0
 *
 * @uses global $wp_meta_boxes Used to retrieve registered meta boxes.
 *
 * @param string|object $screen  The screen identifier.
 * @param string        $context The meta box context.
 * @param mixed         $object  gets passed to the section callback function as first parameter.
 * @return int number of meta boxes as accordion sections.
 */
function do_accordion_sections($screen, $context, $object)
{
    global $wp_meta_boxes;
    wp_enqueue_script('accordion');
    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);
    ?>
	<div id="side-sortables" class="accordion-container">
		<ul class="outer-border">
	<?php 
    $i = 0;
    $first_open = false;
    if (isset($wp_meta_boxes[$page][$context])) {
        foreach (array('high', 'core', 'default', 'low') as $priority) {
            if (isset($wp_meta_boxes[$page][$context][$priority])) {
                foreach ($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' : '';
                    $open_class = '';
                    if (!$first_open && empty($hidden_class)) {
                        $first_open = true;
                        $open_class = 'open';
                    }
                    ?>
					<li class="control-section accordion-section <?php 
                    echo $hidden_class;
                    ?>
 <?php 
                    echo $open_class;
                    ?>
 <?php 
                    echo esc_attr($box['id']);
                    ?>
" id="<?php 
                    echo esc_attr($box['id']);
                    ?>
">
						<h3 class="accordion-section-title hndle" tabindex="0">
							<?php 
                    echo esc_html($box['title']);
                    ?>
							<span class="screen-reader-text"><?php 
                    _e('Press return or enter to open this section');
                    ?>
</span>
						</h3>
						<div class="accordion-section-content <?php 
                    postbox_classes($box['id'], $page);
                    ?>
">
							<div class="inside">
								<?php 
                    call_user_func($box['callback'], $object, $box);
                    ?>
							</div><!-- .inside -->
						</div><!-- .accordion-section-content -->
					</li><!-- .accordion-section -->
					<?php 
                }
            }
        }
    }
    ?>
		</ul><!-- .outer-border -->
	</div><!-- .accordion-container -->
	<?php 
    return $i;
}
Exemplo n.º 25
0
 function _NGG_Galleries_List_Table($screen)
 {
     if (is_string($screen)) {
         $screen = convert_to_screen($screen);
     }
     $this->_screen = $screen;
     $this->_columns = array();
     add_filter('manage_' . $screen->id . '_columns', array(&$this, 'get_columns'), 0);
 }
Exemplo n.º 26
0
/**
 * Get Hidden Meta Boxes
 *
 * @since 2.7.0
 *
 * @param string|WP_Screen $screen Screen identifier
 * @return array Hidden Meta Boxes
 */
function get_hidden_meta_boxes($screen)
{
    if (is_string($screen)) {
        $screen = convert_to_screen($screen);
    }
    $hidden = get_user_option("metaboxhidden_{$screen->id}");
    $use_defaults = !is_array($hidden);
    // Hide slug boxes by default
    if ($use_defaults) {
        $hidden = array();
        if ('post' == $screen->base) {
            if ('post' == $screen->post_type || 'page' == $screen->post_type || 'attachment' == $screen->post_type) {
                $hidden = array('slugdiv', 'trackbacksdiv', 'postcustom', 'postexcerpt', 'commentstatusdiv', 'commentsdiv', 'authordiv', 'revisionsdiv');
            } else {
                $hidden = array('slugdiv');
            }
        }
        /**
         * Filter the default list of hidden meta boxes.
         *
         * @since 3.1.0
         *
         * @param array     $hidden An array of meta boxes hidden by default.
         * @param WP_Screen $screen WP_Screen object of the current screen.
         */
        $hidden = apply_filters('default_hidden_meta_boxes', $hidden, $screen);
    }
    /**
     * Filter the list of hidden meta boxes.
     *
     * @since 3.3.0
     *
     * @param array     $hidden       An array of hidden meta boxes.
     * @param WP_Screen $screen       WP_Screen object of the current screen.
     * @param bool      $use_defaults Whether to show the default meta boxes.
     *                                Default true.
     */
    return apply_filters('hidden_meta_boxes', $hidden, $screen, $use_defaults);
}
 /**
  * Get a list of all, hidden and sortable columns, with filter applied
  *
  * @since 3.1.0
  * @access protected
  *
  * @return array
  */
 function get_column_info()
 {
     if (isset($this->_column_headers)) {
         return $this->_column_headers;
     }
     $screen = convert_to_screen($this->_args['current_screen']);
     $columns = get_column_headers($screen);
     $hidden = get_hidden_columns($screen);
     $_sortable = apply_filters("manage_{$screen->id}_sortable_columns", $this->get_sortable_columns());
     $sortable = array();
     foreach ($_sortable as $id => $data) {
         if (empty($data)) {
             continue;
         }
         $data = (array) $data;
         if (!isset($data[1])) {
             $data[1] = false;
         }
         $sortable[$id] = $data;
     }
     $this->_column_headers = array($columns, $hidden, $sortable);
     return $this->_column_headers;
 }
Exemplo n.º 28
0
/**
 * Remove a meta box from an edit form.
 *
 * @since 2.6.0
 *
 * @param string $id String for use in the 'id' attribute of tags.
 * @param string|object $screen The screen on which to show the box (post, page, link).
 * @param string $context The context within the page where the boxes should show ('normal', 'advanced').
 */
function remove_meta_box($id, $screen, $context)
{
    global $wp_meta_boxes;
    if (empty($screen)) {
        $screen = get_current_screen();
    } elseif (is_string($screen)) {
        $screen = convert_to_screen($screen);
    }
    $page = $screen->id;
    if (!isset($wp_meta_boxes)) {
        $wp_meta_boxes = array();
    }
    if (!isset($wp_meta_boxes[$page])) {
        $wp_meta_boxes[$page] = array();
    }
    if (!isset($wp_meta_boxes[$page][$context])) {
        $wp_meta_boxes[$page][$context] = array();
    }
    foreach (array('high', 'core', 'default', 'low') as $priority) {
        $wp_meta_boxes[$page][$context][$priority][$id] = false;
    }
}
 function wck_get_meta_boxes($screen = null)
 {
     global $wp_meta_boxes, $wck_objects;
     if (empty($screen)) {
         $screen = get_current_screen();
     } elseif (is_string($screen)) {
         $screen = convert_to_screen($screen);
     }
     $page = $screen->id;
     $wck_meta_boxes = array();
     if (!empty($wck_objects) && !empty($wp_meta_boxes[$page]['normal']['low'])) {
         foreach ($wck_objects as $key => $wck_object) {
             if (array_key_exists($key, $wp_meta_boxes[$page]['normal']['low'])) {
                 $wck_meta_boxes[] = $key;
             }
         }
     }
     return $wck_meta_boxes;
 }
Exemplo n.º 30
0
 function hide_multilingual_content_setup_box()
 {
     remove_meta_box('icl_div_config', convert_to_screen('shop_order'), 'normal');
     remove_meta_box('icl_div_config', convert_to_screen('shop_coupon'), 'normal');
 }