本文整理汇总了PHP中get_column_headers函数的典型用法代码示例。如果您正苦于以下问题:PHP get_column_headers函数的具体用法?PHP get_column_headers怎么用?PHP get_column_headers使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_column_headers函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_column_info
function get_column_info()
{
$columns = get_column_headers($this->_screen);
$hidden = get_hidden_columns($this->_screen);
$sortable = array();
return array($columns, $hidden, $sortable);
}
示例2: get_column_info
/**
* @access protected
*
* @return array
*/
protected function get_column_info()
{
$columns = get_column_headers($this->_screen);
$hidden = get_hidden_columns($this->_screen);
$sortable = array();
$primary = $this->get_default_primary_column_name();
return array($columns, $hidden, $sortable, $primary);
}
示例3: get_primary_column_name
/**
* Gets the name of the primary column in the Entries screen
*
* @since 2.0.14
*
* @return string $primary_column
*/
protected function get_primary_column_name()
{
$columns = get_column_headers($this->screen);
$hidden = get_hidden_columns($this->screen);
$primary_column = '';
foreach ($columns as $column_key => $column_display_name) {
if ('cb' != $column_key && !in_array($column_key, $hidden)) {
$primary_column = $column_key;
break;
}
}
return $primary_column;
}
示例4: get_default_columns
/**
* @see CPAC_Type::get_default_columns()
*/
public function get_default_columns()
{
if (!function_exists('_get_list_table')) {
return array();
}
// You can use this filter to add third_party columns by hooking into this.
do_action("cac/columns/default/storage_key={$this->key}");
// get columns
$table = _get_list_table('WP_Users_List_Table', array('screen' => 'users'));
$columns = (array) $table->get_columns();
if ($this->is_settings_page()) {
$columns = array_merge(get_column_headers('users'), $columns);
}
return $columns;
}
示例5: get_default_columns
public function get_default_columns()
{
if (!function_exists('_get_list_table')) {
return array();
}
// You can use this filter to add thirdparty columns by hooking into this.
// See classes/third_party.php for an example.
do_action("cac/columns/default/storage_key={$this->key}");
$table = _get_list_table('WP_Media_List_Table', array('screen' => 'upload'));
$columns = (array) $table->get_columns();
if (cac_is_setting_screen()) {
$columns = array_merge(get_column_headers('upload'), $columns);
}
return $columns;
}
示例6: isset
}
?>
<?php
$this->notices();
?>
<?php
ShoppScreenOrders::navigation();
?>
<br class="clear" />
<?php
$totalsedit = isset($_GET['edit']) && 'totals' == $_GET['edit'];
$columns = get_column_headers($this->id);
$hidden = get_hidden_columns($this->id);
$colspan = count($columns);
?>
<div id="order">
<div class="title">
<div id="titlewrap">
<span class="date"><?php
$datetime = $Purchase->exists() ? $Purchase->created : current_time('timestamp');
echo Shopp::_d(get_option('date_format'), $datetime);
?>
<small><?php
echo date(get_option('time_format'), $datetime);
?>
</small>
示例7: array
<br class="clear" />
</div>
<div class="clear"></div>
<?php
if ('all' == $cat_id) {
$cat_id = '';
}
$args = array('category' => $cat_id, 'hide_invisible' => 0, 'orderby' => $sqlorderby, 'hide_empty' => 0);
if (!empty($_GET['s'])) {
$args['search'] = $_GET['s'];
}
$links = get_bookmarks($args);
if ($links) {
$link_columns = get_column_headers('link-manager');
$hidden = get_hidden_columns('link-manager');
?>
<?php
wp_nonce_field('bulk-bookmarks');
?>
<table class="widefat fixed" cellspacing="0">
<thead>
<tr>
<?php
print_column_headers('link-manager');
?>
</tr>
</thead>
示例8: get_column_info
/**
* 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;
}
$columns = get_column_headers($this->screen);
$hidden = get_hidden_columns($this->screen);
$sortable_columns = $this->get_sortable_columns();
/**
* Filter the list table sortable columns for a specific screen.
*
* The dynamic portion of the hook name, $this->screen->id, refers
* to the ID of the current screen, usually a string.
*
* @since 3.5.0
*
* @param array $sortable_columns An array of sortable columns.
*/
$_sortable = apply_filters("manage_{$this->screen->id}_sortable_columns", $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;
}
示例9: cms_tpv_print_childs
/**
* Output JSON for the children of a node
* $arrOpenChilds = array with id of pages to open children on
*/
function cms_tpv_print_childs($pageID, $view = "all", $arrOpenChilds = null, $post_type)
{
$arrPages = cms_tpv_get_pages("parent={$pageID}&view={$view}&post_type={$post_type}");
if ($arrPages) {
global $current_screen;
$screen = convert_to_screen("edit");
#return;
// If this is set to null then quick/bul edit stops working on posts (not pages)
// If did set it to null sometime. Can't remember why...
// $screen->post_type = null;
$post_type_object = get_post_type_object($post_type);
ob_start();
// some plugins, for example magic fields, return javascript and things here. we're not compatible with that, so just swallow any output
$posts_columns = get_column_headers($screen);
ob_get_clean();
unset($posts_columns["cb"], $posts_columns["title"], $posts_columns["author"], $posts_columns["categories"], $posts_columns["tags"], $posts_columns["date"]);
global $post;
// Translated post statuses
$post_statuses = get_post_statuses();
?>
[<?php
for ($i = 0, $pagesCount = sizeof($arrPages); $i < $pagesCount; $i++) {
$onePage = $arrPages[$i];
$tmpPost = $post;
$post = $onePage;
$page_id = $onePage->ID;
$arrChildPages = NULL;
$editLink = get_edit_post_link($onePage->ID, 'notDisplay');
$content = esc_html($onePage->post_content);
$content = str_replace(array("\n", "\r"), "", $content);
$hasChildren = false;
// if viewing trash, don't get children. we watch them "flat" instead
if ($view == "trash") {
} else {
$arrChildPages = cms_tpv_get_pages("parent={$onePage->ID}&view={$view}&post_type={$post_type}");
}
if (!empty($arrChildPages)) {
$hasChildren = true;
}
// if no children, output no state
$strState = '"state": "closed",';
if (!$hasChildren) {
$strState = '';
}
// type of node
$rel = $onePage->post_status;
if ($onePage->post_password) {
$rel = "password";
}
// modified time
$post_modified_time = strtotime($onePage->post_modified);
$post_modified_time = date_i18n(get_option('date_format'), $post_modified_time, false);
// last edited by
setup_postdata($post);
$post_author = cms_tpv_get_the_modified_author();
if (empty($post_author)) {
$post_author = __("Unknown user", 'cms-tree-page-view');
}
$title = get_the_title($onePage->ID);
// so hooks and stuff will do their work
$title = apply_filters("cms_tree_page_view_post_title", $title, $onePage);
if (empty($title)) {
$title = __("<Untitled page>", 'cms-tree-page-view');
}
$arr_page_css_styles = array();
$user_can_edit_page = apply_filters("cms_tree_page_view_post_can_edit", current_user_can($post_type_object->cap->edit_post, $page_id), $page_id);
$user_can_add_inside = apply_filters("cms_tree_page_view_post_user_can_add_inside", current_user_can($post_type_object->cap->create_posts, $page_id), $page_id);
$user_can_add_after = apply_filters("cms_tree_page_view_post_user_can_add_after", current_user_can($post_type_object->cap->create_posts, $page_id), $page_id);
if ($user_can_edit_page) {
$arr_page_css_styles[] = "cms_tpv_user_can_edit_page_yes";
} else {
$arr_page_css_styles[] = "cms_tpv_user_can_edit_page_no";
}
if ($user_can_add_inside) {
$arr_page_css_styles[] = "cms_tpv_user_can_add_page_inside_yes";
} else {
$arr_page_css_styles[] = "cms_tpv_user_can_add_page_inside_no";
}
if ($user_can_add_after) {
$arr_page_css_styles[] = "cms_tpv_user_can_add_page_after_yes";
} else {
$arr_page_css_styles[] = "cms_tpv_user_can_add_page_after_no";
}
$page_css = join(" ", $arr_page_css_styles);
// fetch columns
$str_columns = "";
foreach ($posts_columns as $column_name => $column_display_name) {
$col_name = $column_display_name;
if ($column_name == "comments") {
$col_name = __("Comments");
}
$str_columns .= "<dt>{$col_name}</dt>";
$str_columns .= "<dd>";
if ($column_name == "comments") {
$str_columns .= '<div class="post-com-count-wrapper">';
$left = get_pending_comments_num($onePage->ID);
//.........这里部分代码省略.........
示例10: get_column_info
function get_column_info()
{
$columns = get_column_headers($this->_screen);
$hidden = get_hidden_columns($this->_screen);
$_sortable = $this->get_sortable_columns();
foreach ($_sortable as $id => $data) {
if (empty($data)) {
continue;
}
$data = (array) $data;
if (!isset($data[1])) {
$data[1] = false;
}
$sortable[$id] = $data;
}
return array($columns, $hidden, $sortable);
}
示例11: table_cells
/**
* Outputs <td> tags based on an array of cell data.
*
* @since 2.1
*
* @param $headers Array of (CSS class => Cell data)
*/
function table_cells($cells)
{
if (count($this->get_admin_table_columns())) {
$columns = get_column_headers($this->plugin_page_hook);
$hidden = get_hidden_columns($this->plugin_page_hook);
foreach ($columns as $column_name => $column_display_name) {
$class = "class=\"{$column_name} column-{$column_name}\"";
$style = in_array($column_name, $hidden) ? ' style="display:none;"' : '';
echo "\t\t<td {$class}{$style}>" . $cells[$column_name] . "</td>\n";
}
} elseif (is_array($cells) && count($cells)) {
foreach ($cells as $class => $content) {
$class = is_numeric($class) ? '' : " class='su-{$class}'";
echo "\t\t<td{$class}>{$content}</td>\n";
}
}
}
示例12: _manage_row
/**
* prints the individual row
*
* @param object $post
* @param int $comment_pending_count
* @param string $mode
*/
protected function _manage_row($post, $comment_pending_count, $mode)
{
static $rowclass;
$global_post = $post;
setup_postdata($post);
$rowclass = 'alternate' == $rowclass ? '' : 'alternate';
$current_user = wp_get_current_user();
$post_owner = $current_user->ID == $post->post_author ? 'self' : 'other';
$edit_link = get_edit_post_link($post->ID);
$title = _draft_or_post_title($post->ID);
?>
<tr id='post-<?php
echo $post->ID;
?>
' class='<?php
echo trim($rowclass . ' author-' . $post_owner . ' status-' . $post->post_status);
?>
iedit' valign="top">
<?php
$posts_columns = get_column_headers($this->get_content_type());
$hidden = get_hidden_columns($this->get_content_type());
foreach ($posts_columns as $column_name => $column_display_name) {
$class = "class=\"{$column_name} column-{$column_name}\"";
$style = '';
if (in_array($column_name, $hidden)) {
$style = ' style="display:none;"';
}
$attributes = "{$class}{$style}";
switch ($column_name) {
case 'cb':
?>
<th scope="row" class="check-column"><?php
if (current_user_can('edit_post', $post->ID)) {
?>
<input type="checkbox" name="post[]" value="<?php
the_ID();
?>
" /><?php
}
?>
</th>
<?php
break;
//end case 'cb'
//end case 'cb'
case 'date':
if ('0000-00-00 00:00:00' == $post->post_date && 'date' == $column_name) {
$t_time = $h_time = __('Unpublished');
$time_diff = 0;
} else {
$t_time = get_the_time(__('Y/m/d g:i:s A'));
$m_time = $post->post_date;
$time = get_post_time('G', true, $post);
$time_diff = time() - $time;
if ($time_diff > 0 && $time_diff < 24 * 60 * 60) {
$h_time = sprintf(__('%s ago'), human_time_diff($time));
} else {
$h_time = mysql2date(__('Y/m/d'), $m_time);
}
}
echo '<td ' . $attributes . '>';
if ('excerpt' == $mode) {
echo apply_filters('post_date_column_time', $t_time, $post, $column_name, $mode);
} else {
echo '<abbr title="' . $t_time . '">' . apply_filters('post_date_column_time', $h_time, $post, $column_name, $mode) . '</abbr>';
}
echo '<br />';
if ('publish' == $post->post_status) {
_e('Published');
} elseif ('future' == $post->post_status) {
if ($time_diff > 0) {
echo '<strong class="attention">' . __('Missed schedule') . '</strong>';
} else {
_e('Scheduled');
}
} else {
_e('Last Modified');
}
echo '</td>';
break;
//end case 'date'
//end case 'date'
case 'title':
$attributes = 'class="post-title column-title"' . $style;
?>
<td <?php
echo $attributes;
?>
><strong><?php
if (current_user_can('edit_post', $post->ID) && $post->post_status != 'trash') {
?>
<a class="row-title" href="<?php
echo $edit_link;
//.........这里部分代码省略.........
示例13: screen_meta
function screen_meta($screen)
{
global $wp_meta_boxes, $_wp_contextual_help, $wp_list_table, $wp_current_screen_options;
if (is_string($screen)) {
$screen = convert_to_screen($screen);
}
$columns = get_column_headers($screen);
$hidden = get_hidden_columns($screen);
$meta_screens = array('index' => 'dashboard');
if (isset($meta_screens[$screen->id])) {
$screen->id = $meta_screens[$screen->id];
$screen->base = $screen->id;
}
$show_screen = false;
if (!empty($wp_meta_boxes[$screen->id]) || !empty($columns)) {
$show_screen = true;
}
$screen_options = screen_options($screen);
if ($screen_options) {
$show_screen = true;
}
if (!isset($_wp_contextual_help)) {
$_wp_contextual_help = array();
}
$settings = apply_filters('screen_settings', '', $screen);
switch ($screen->id) {
case 'widgets':
$settings = '<p><a id="access-on" href="widgets.php?widgets-access=on">' . __('Enable accessibility mode') . '</a><a id="access-off" href="widgets.php?widgets-access=off">' . __('Disable accessibility mode') . "</a></p>\n";
$show_screen = true;
break;
}
if (!empty($settings)) {
$show_screen = true;
}
if (!empty($wp_current_screen_options)) {
$show_screen = true;
}
$show_screen = apply_filters('screen_options_show_screen', $show_screen, $screen);
?>
<div id="screen-meta">
<?php
if ($show_screen) {
?>
<div id="screen-options-wrap" class="hidden">
<form id="adv-settings" action="" method="post">
<?php
if (isset($wp_meta_boxes[$screen->id])) {
?>
<h5><?php
_ex('Show on screen', 'Metaboxes');
?>
</h5>
<div class="metabox-prefs">
<?php
meta_box_prefs($screen);
?>
<br class="clear" />
</div>
<?php
}
if (!empty($columns)) {
?>
<h5><?php
echo isset($columns['_title']) ? $columns['_title'] : _x('Show on screen', 'Columns');
?>
</h5>
<div class="metabox-prefs">
<?php
$special = array('_title', 'cb', 'comment', 'media', 'name', 'title', 'username', 'blogname');
foreach ($columns as $column => $title) {
// Can't hide these for they are special
if (in_array($column, $special)) {
continue;
}
if (empty($title)) {
continue;
}
if ('comments' == $column) {
$title = __('Comments');
}
$id = "{$column}-hide";
echo '<label for="' . $id . '">';
echo '<input class="hide-column-tog" name="' . $id . '" type="checkbox" id="' . $id . '" value="' . $column . '"' . checked(!in_array($column, $hidden), true, false) . ' />';
echo "{$title}</label>\n";
}
?>
<br class="clear" />
</div>
<?php
}
echo screen_layout($screen);
if (!empty($screen_options)) {
?>
<h5><?php
_ex('Show on screen', 'Screen Options');
?>
</h5>
<?php
}
echo $screen_options;
//.........这里部分代码省略.........
示例14: prepare_items
function prepare_items()
{
global $wpdb, $sll;
//get number of successful and failed logins so we can display them in parentheces for each view
//building a WHERE SQL query for each view
$where = $sll->make_where_query();
//we only need the date filter, everything else need to be unset
if (is_array($where) && isset($where['datefilter'])) {
$where = array('datefilter' => $where['datefilter']);
} else {
$where = false;
}
$where3 = $where2 = $where1 = $where;
$where2['login_result'] = "login_result = '1'";
$where3['login_result'] = "login_result = '0'";
if (is_array($where1) && !empty($where1)) {
$where1 = 'WHERE ' . implode(' AND ', $where1);
}
$where2 = 'WHERE ' . implode(' AND ', $where2);
$where3 = 'WHERE ' . implode(' AND ', $where3);
$sql1 = "SELECT count(*) FROM {$sll->table} {$where1}";
$allTotal = $wpdb->get_var($sql1);
$sql2 = "SELECT count(*) FROM {$sll->table} {$where2}";
$successTotal = $wpdb->get_var($sql2);
$sql3 = "SELECT count(*) FROM {$sll->table} {$where3}";
$failedTotal = $wpdb->get_var($sql3);
$this->set('allTotal', $allTotal);
$this->set('successTotal', $successTotal);
$this->set('failedTotal', $failedTotal);
$screen = get_current_screen();
/**
* First, lets decide how many records per page to show
*/
$per_page_option = $screen->id . '_per_page';
$per_page = get_option($per_page_option, 20);
$per_page = $per_page != false ? $per_page : 20;
$offset = $per_page * ($this->get_pagenum() - 1);
$orderby = isset($_REQUEST['orderby']) && !empty($_REQUEST['orderby']) ? $_REQUEST['orderby'] : false;
$order = isset($_REQUEST['order']) && !empty($_REQUEST['order']) ? $_REQUEST['order'] : false;
$this->items = $sll->log_get_data($orderby, $order, $per_page, $offset);
/**
* REQUIRED. Now we need to define our column headers. This includes a complete
* array of columns to be displayed (slugs & titles), a list of columns
* to keep hidden, and a list of columns that are sortable. Each of these
* can be defined in another method (as we've done here) before being
* used to build the value for our _column_headers property.
*/
$columns = $this->get_columns();
$hidden_cols = get_user_option('manage' . $screen->id . 'columnshidden');
$hidden = $hidden_cols ? $hidden_cols : array();
$sortable = $this->get_sortable_columns();
/**
* REQUIRED. Finally, we build an array to be used by the class for column
* headers. The $this->_column_headers property takes an array which contains
* 3 other arrays. One for all columns, one for hidden columns, and one
* for sortable columns.
*/
$this->_column_headers = array($columns, $hidden, $sortable);
$columns = get_column_headers($screen);
/**
* Optional. You can handle your bulk actions however you see fit. In this
* case, we'll handle them within our package just to keep things clean.
*/
//$this->process_bulk_action();
/**
* Instead of querying a database, we're going to fetch the example data
* property we created for use in this plugin. This makes this example
* package slightly different than one you might build on your own. In
* this example, we'll be using array manipulation to sort and paginate
* our data. In a real-world implementation, you will probably want to
* use sort and pagination data to build a custom query instead, as you'll
* be able to use your precisely-queried data immediately.
*/
// $data = $this->items;
/**
* This checks for sorting input and sorts the data in our array accordingly.
*
* In a real-world situation involving a database, you would probably want
* to handle sorting by passing the 'orderby' and 'order' values directly
* to a custom query. The returned data will be pre-sorted, and this array
* sorting technique would be unnecessary.
*/
// function usort_reorder($a,$b)
// {
// $orderby = (!empty($_REQUEST['orderby'])) ? $_REQUEST['orderby'] : 'time'; //If no sort, default to title
// $order = (!empty($_REQUEST['order'])) ? $_REQUEST['order'] : 'desc'; //If no order, default to asc
// $result = strcmp($a[$orderby], $b[$orderby]); //Determine sort order
// return ($order==='asc') ? $result : -$result; //Send final sort direction to usort
// }
// usort($data, 'usort_reorder');
/***********************************************************************
* ---------------------------------------------------------------------
* vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
*
* In a real-world situation, this is where you would place your query.
*
* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
* ---------------------------------------------------------------------
**********************************************************************/
/**
//.........这里部分代码省略.........
示例15: table
/**
* Renders the report table to the WP admin screen
*
* @author Jonathan Davis
* @since 1.3
*
* @return void
**/
public function table()
{
extract($this->options, EXTR_SKIP);
// Get only the records for this page
$beginning = (int) ($paged - 1) * $per_page;
$report = array_values($this->data);
$report = array_slice($report, $beginning, $beginning + $per_page, true);
unset($this->data);
// Free memory
?>
<table class="widefat" cellspacing="0">
<thead>
<tr><?php
ShoppUI::print_column_headers($this->screen);
?>
</tr>
</thead>
<?php
if (false !== $report && count($report) > 0) {
?>
<tbody id="report" class="list stats">
<?php
$columns = get_column_headers($this->screen);
$hidden = get_hidden_columns($this->screen);
$even = false;
$records = 0;
while (list($id, $data) = each($report)) {
if ($records++ > $per_page) {
break;
}
?>
<tr<?php
if (!$even) {
echo " class='alternate'";
}
$even = !$even;
?>
>
<?php
foreach ($columns as $column => $column_title) {
$classes = array($column, "column-{$column}");
if (in_array($column, $hidden)) {
$classes[] = 'hidden';
}
if (method_exists(get_class($this), $column)) {
?>
<td class="<?php
echo esc_attr(join(' ', $classes));
?>
"><?php
echo call_user_func(array($this, $column), $data, $column, $column_title, $this->options);
?>
</td>
<?php
} else {
?>
<td class="<?php
echo esc_attr(join(' ', $classes));
?>
">
<?php
do_action('shopp_manage_report_custom_column', $column, $column_title, $data);
?>
</td>
<?php
}
}
/* $columns */
?>
</tr>
<?php
}
/* records */
?>
<tr class="summary average">
<?php
$averages = clone $this->totals;
$first = true;
foreach ($columns as $column => $column_title) {
if ($first) {
$averages->id = $averages->period = $averages->{$column} = __('Average', 'Shopp');
$first = false;
} else {
$value = isset($averages->{$column}) ? $averages->{$column} : null;
$total = isset($this->total) ? $this->total : 0;
if (null == $value) {
$averages->{$column} = '';
} elseif (0 === $total) {
$averages->{$column} = 0;
//.........这里部分代码省略.........