本文整理汇总了PHP中get_hidden_columns函数的典型用法代码示例。如果您正苦于以下问题:PHP get_hidden_columns函数的具体用法?PHP get_hidden_columns怎么用?PHP get_hidden_columns使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_hidden_columns函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:snagga,项目名称:urbantac,代码行数:7,代码来源:list-table.php
示例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);
}
开发者ID:atimmer,项目名称:wordpress-develop-mirror,代码行数:13,代码来源:class-wp-list-table-compat.php
示例3: prepare_items
function prepare_items()
{
$columns = $this->get_columns();
$sortable = $this->get_sortable_columns();
$hidden = get_hidden_columns($this->screen);
$this->_column_headers = array($columns, $hidden, $sortable);
$this->items = $this->get_records();
$total_items = $this->get_total_found_rows();
$this->set_pagination_args(array('total_items' => $total_items, 'per_page' => $this->get_items_per_page('edit_stream_notifications_per_page', 20)));
}
开发者ID:xwp,项目名称:stream-legacy,代码行数:10,代码来源:list-table.php
示例4: 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;
}
开发者ID:hugocica,项目名称:locomotiva-2016,代码行数:20,代码来源:FrmEntriesListHelper.php
示例5: prepare_items
/**
* Prepares the list of venues for displaying.
*
* Modifies the query based on the current view and screen options and
* begins setting up columns.
*
* @since 1.0.0
*/
function prepare_items()
{
global $wp_query, $wpdb;
$screen = get_current_screen();
$per_page = get_user_option('gigs_page_audiotheme_venues_per_page');
$per_page = empty($per_page) ? 20 : $per_page;
// Set up column headers.
$columns = $this->get_columns();
$hidden = get_hidden_columns($screen->id);
$sortable = $this->get_sortable_columns();
$this->_column_headers = array($columns, $hidden, $sortable);
// Compile the WP_Query args based on the current view and user options.
$args = array('post_type' => 'audiotheme_venue', 'order' => isset($_REQUEST['order']) && 'desc' === strtolower($_REQUEST['order']) ? 'desc' : 'asc', 'orderby' => !isset($_REQUEST['orderby']) ? 'title' : $_REQUEST['orderby'], 'posts_per_page' => $per_page);
if (isset($_REQUEST['orderby'])) {
switch ($_REQUEST['orderby']) {
case 'gigs':
$args['meta_key'] = '_audiotheme_gig_count';
$args['orderby'] = 'meta_value_num';
break;
case 'city':
case 'contact_name':
case 'contact_phone':
case 'contact_email':
case 'country':
case 'phone':
case 'state':
case 'website':
$args['meta_key'] = '_audiotheme_' . $_REQUEST['orderby'];
$args['orderby'] = 'meta_value';
break;
}
}
if (isset($_REQUEST['s'])) {
$args['s'] = stripslashes($_REQUEST['s']);
}
$args['paged'] = $this->get_pagenum();
// Run the query.
$items = array();
$wp_query = new WP_Query($args);
if (isset($wp_query->posts) && count($wp_query->posts)) {
foreach ($wp_query->posts as $post) {
$items[$post->ID] = get_audiotheme_venue($post->ID);
}
}
$this->items = $items;
$this->set_pagination_args(array('total_items' => $wp_query->found_posts, 'per_page' => $per_page, 'total_pages' => $wp_query->max_num_pages));
}
开发者ID:sewmyheadon,项目名称:audiotheme,代码行数:55,代码来源:class-audiotheme-venues-list-table.php
示例6: array
</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>
<tfoot>
开发者ID:jinpingv,项目名称:website_wrapper,代码行数:31,代码来源:link-manager.php
示例7: flag_picturelist
function flag_picturelist()
{
// *** show picture list
global $wpdb, $flagdb, $user_ID, $flag;
// Look if its a search result
$is_search = isset($_GET['s']) ? true : false;
if ($is_search) {
// fetch the imagelist
$picturelist = $flag->manage_page->search_result;
// we didn't set a gallery or a pagination
$act_gid = 0;
$_GET['paged'] = 1;
$page_links = false;
} else {
// GET variables
$act_gid = $flag->manage_page->gid;
// Load the gallery metadata
$gallery = $flagdb->find_gallery($act_gid);
if (!$gallery) {
flagGallery::show_error(__('Gallery not found.', 'flash-album-gallery'));
return;
}
// Check if you have the correct capability
if (!flagAdmin::can_manage_this_gallery($gallery->author)) {
flagGallery::show_error(__('Sorry, you have no access here', 'flash-album-gallery'));
return;
}
// look for pagination
if (!isset($_GET['paged']) || intval($_GET['paged']) < 1) {
$_GET['paged'] = 1;
}
$_GET['paged'] = intval($_GET['paged']);
$start = ($_GET['paged'] - 1) * 50;
// get picture values
$picturelist = $flagdb->get_gallery($act_gid, $flag->options['galSort'], $flag->options['galSortDir'], false, 50, $start);
// build pagination
$page_links = paginate_links(array('base' => add_query_arg('paged', '%#%'), 'format' => '', 'prev_text' => __('«'), 'next_text' => __('»'), 'total' => $flagdb->paged['max_objects_per_page'], 'current' => $_GET['paged']));
// get the current author
$act_author_user = get_userdata((int) $gallery->author);
}
// list all galleries
$gallerylist = $flagdb->find_all_galleries();
//get the columns
$gallery_columns = flag_manage_gallery_columns();
$hidden_columns = get_hidden_columns('flag-manage-images');
$hidden_columns = array_filter($hidden_columns);
if ($picturelist) {
$a_hits = array();
foreach ($picturelist as $p) {
$a_hits[] = $p->hitcounter;
}
if (!array_sum($a_hits)) {
$hidden_columns[] = 'views_likes';
$hidden_columns[] = 'rating';
}
} else {
$hidden_columns[] = 'views_likes';
$hidden_columns[] = 'rating';
}
$num_columns = count($gallery_columns) - count($hidden_columns);
?>
<!--[if lt IE 8]>
<style type="text/css">
.custom_thumb {
display : none;
}
</style>
<![endif]-->
<script type="text/javascript">
//<![CDATA[
function showDialog( windowId, height ) {
var form = document.getElementById('updategallery');
var elementlist = "";
for (i = 0, n = form.elements.length; i < n; i++) {
if(form.elements[i].type == "checkbox") {
if(form.elements[i].name == "doaction[]")
if(form.elements[i].checked == true)
if (elementlist == "")
elementlist = form.elements[i].value;
else
elementlist += "," + form.elements[i].value ;
}
}
jQuery("#" + windowId + "_bulkaction").val(jQuery("#bulkaction").val());
jQuery("#" + windowId + "_imagelist").val(elementlist);
// console.log (jQuery("#TB_imagelist").val());
tb_show("", "#TB_inline?width=640&height=" + height + "&inlineId=" + windowId + "&modal=true", false);
}
function checkAll(form)
{
for (i = 0, n = form.elements.length; i < n; i++) {
if(form.elements[i].type == "checkbox") {
if(form.elements[i].name == "doaction[]") {
if(form.elements[i].checked == true)
form.elements[i].checked = false;
else
form.elements[i].checked = true;
}
//.........这里部分代码省略.........
开发者ID:jasonralph,项目名称:jasonralph.org,代码行数:101,代码来源:manage-images.php
示例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;
}
开发者ID:blogfor,项目名称:king,代码行数:41,代码来源:class-axiom-list-table.php
示例9: if
<?php if ($page_links) echo "<div class='tablenav-pages'>$page_links</div>"; ?>
<div class="clear"></div>
</div>
<div class="clear"></div>
<table class="widefat" cellspacing="0">
<thead>
<tr><?php print_column_headers('ecart_page_ecart-customers'); ?></tr>
</thead>
<tfoot>
<tr><?php print_column_headers('ecart_page_ecart-customers',false); ?></tr>
</tfoot>
<?php if (sizeof($Customers) > 0): ?>
<tbody id="customers-table" class="list orders">
<?php
$hidden = get_hidden_columns('ecart_page_ecart-customers');
$even = false;
foreach ($Customers as $Customer):
$CustomerName = (empty($Customer->firstname) && empty($Customer->lastname))?'('.__('no contact name','Ecart').')':"{$Customer->firstname} {$Customer->lastname}";
?>
<tr<?php if (!$even) echo " class='alternate'"; $even = !$even; ?>>
<th scope='row' class='check-column'><input type='checkbox' name='selected[]' value='<?php echo $Customer->id; ?>' /></th>
<td class="name column-name"><a class='row-title' href='<?php echo esc_url( add_query_arg(array('page'=>'ecart-customers','id'=>$Customer->id),admin_url('admin.php'))); ?>' title='<?php _e('Edit','Ecart'); ?> "<?php echo esc_attr($CustomerName); ?>"'><?php echo esc_html($CustomerName); ?></a><?php echo !empty($Customer->company)?"<br />".esc_html($Customer->company):""; ?></td>
<td class="login column-login<?php echo in_array('login',$hidden)?' hidden':''; ?>"><?php echo esc_html($Customer->user_login); ?></td>
<td class="email column-email<?php echo in_array('email',$hidden)?' hidden':''; ?>"><a href="mailto:<?php echo esc_attr($Customer->email); ?>"><?php echo esc_html($Customer->email); ?></a></td>
<td class="location column-location<?php echo in_array('location',$hidden)?' hidden':''; ?>"><?php
$location = '';
$location = $Customer->city;
if (!empty($location) && !empty($Customer->state)) $location .= ', ';
开发者ID:robbiespire,项目名称:paQui,代码行数:31,代码来源:customers.php
示例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);
}
开发者ID:popovdenis,项目名称:kmst,代码行数:17,代码来源:manage-galleries.php
示例11: render_screen_options
/**
* Render the screen options tab.
*
* @since 3.3.0
*/
public function render_screen_options()
{
global $wp_meta_boxes;
$columns = get_column_headers($this);
$hidden = get_hidden_columns($this);
?>
<div id="screen-options-wrap" class="hidden" tabindex="-1" aria-label="<?php
esc_attr_e('Screen Options Tab');
?>
">
<form id="adv-settings" action="" method="post">
<?php
if (isset($wp_meta_boxes[$this->id]) || $this->get_option('per_page') || $columns && empty($columns['_title'])) {
?>
<h5><?php
_e('Show on screen');
?>
</h5>
<?php
}
if (isset($wp_meta_boxes[$this->id])) {
?>
<div class="metabox-prefs">
<?php
meta_box_prefs($this);
if ('dashboard' === $this->id && has_action('welcome_panel') && current_user_can('edit_theme_options')) {
if (isset($_GET['welcome'])) {
$welcome_checked = empty($_GET['welcome']) ? 0 : 1;
update_user_meta(get_current_user_id(), 'show_welcome_panel', $welcome_checked);
} else {
$welcome_checked = get_user_meta(get_current_user_id(), 'show_welcome_panel', true);
if (2 == $welcome_checked && wp_get_current_user()->user_email != get_option('admin_email')) {
$welcome_checked = false;
}
}
echo '<label for="wp_welcome_panel-hide">';
echo '<input type="checkbox" id="wp_welcome_panel-hide"' . checked((bool) $welcome_checked, true, false) . ' />';
echo _x('Welcome', 'Welcome panel') . "</label>\n";
}
?>
<br class="clear" />
</div>
<?php
}
if ($columns) {
if (!empty($columns['_title'])) {
?>
<h5><?php
echo $columns['_title'];
?>
</h5>
<?php
}
?>
<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
}
$this->render_screen_layout();
$this->render_per_page_options();
echo $this->_screen_settings;
?>
<div><?php
wp_nonce_field('screen-options-nonce', 'screenoptionnonce', false);
?>
</div>
</form>
</div>
<?php
}
开发者ID:sb-xs,项目名称:que-pour-elle,代码行数:95,代码来源:screen.php
示例12: isset
Shopp::_e('New Order');
?>
</h2>
<?php
}
?>
<?php
$this->notices();
?>
<?php
$totalsedit = isset($_GET['edit']) && 'totals' == $_GET['edit'];
$columns = get_column_headers($this->screen);
$hidden = get_hidden_columns($this->screen);
$colspan = count($columns);
$timestamp = empty($Purchase->created) ? current_time('timestamp') : $Purchase->created;
?>
<div id="order">
<div class="title">
<div id="titlewrap">
<span class="date"><?php
echo Shopp::_d(get_option('date_format'), $timestamp);
?>
<small><?php
echo date(get_option('time_format'), $timestamp);
?>
</small>
<div class="alignright">
开发者ID:forthrobot,项目名称:inuvik,代码行数:31,代码来源:new.php
示例13: dynamic_taxonomy_row
/**
* Prints manage row for dynamic taxonomy
*
* @param Dynamic_Taxonomy_Handler $taxonomy_obj
* @param string $style
* @return unknown
*/
public function dynamic_taxonomy_row($taxonomy_obj, $style)
{
$checkbox = "<input type='checkbox' name='taxonomies[]' id='taxonomy_{$taxonomy_obj->get_taxonomy_name()}' value='{$taxonomy_obj->get_taxonomy_name()}' />";
$r = "<tr id='taxonomy-{$taxonomy_obj->get_taxonomy_name()}'{$style}>";
$columns = get_column_headers('dynamic_taxonomy');
$hidden = get_hidden_columns('dynamic_taxonomy');
foreach ($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':
$r .= "<th scope='row' class='check-column'>{$checkbox}</th>";
break;
case 'taxonomy':
$r .= sprintf('<td %s>%s<br /><div class="row-actions"><span class="edit"><a href="%s">Edit</a> | </span><span class="delete"><a href="%s" class="submitdelete">Delete</a></span></div></td>', $attributes, $taxonomy_obj->get_taxonomy_name(), $this->get_edit_taxonomy_url($taxonomy_obj->get_taxonomy_name()), wp_nonce_url($this->get_manage_taxonomies_url(array('action' => 'delete', 'taxonomy' => $taxonomy_obj->get_taxonomy_name())), 'delete_taxonomy'));
break;
case 'label':
$r .= "<td {$attributes}>{$taxonomy_obj->get_taxonomy_label()}</td>";
break;
case 'object_types':
$obect_types = count($taxonomy_obj->get_object_types()) > 0 ? join(', ', $taxonomy_obj->get_object_types()) : "none";
$r .= "<td {$attributes}>{$obect_types}</td>";
break;
default:
$r .= "<td {$attributes}>";
$r .= apply_filters('manage_users_custom_column', '', $column_name, $taxonomy_obj->get_taxonomy_name());
$r .= "</td>";
}
}
$r .= '</tr>';
return $r;
}
开发者ID:andru,项目名称:cms-press,代码行数:43,代码来源:dynamic-taxonomies.php
示例14: 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;
//.........这里部分代码省略.........
开发者ID:msigley,项目名称:shopp,代码行数:101,代码来源:Reports.php
示例15: manage_columns_prefs
/**
* {@internal Missing Short Description}}
*
* @since unknown
*
* @param unknown_type $page
*/
function manage_columns_prefs($page) {
$columns = get_column_headers($page);
$hidden = get_hidden_columns($page);
foreach ( $columns as $column => $title ) {
// Can't hide these
if ( 'cb' == $column || 'title' == $column || 'name' == $column || 'username' == $column || 'media' == $column || 'comment' == $column )
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 . '"' . (! in_array($column, $hidden) ? ' checked="checked"' : '') . ' />';
echo "$title</label>\n";
}
}
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:27,代码来源:template.php
示例16: prepare_items
/**
* Prepares the list of gigs for displaying.
*
* Modifies the query based on the current view and screen options and
* begins setting up columns.
*
* @since 1.0.0
*/
function prepare_items()
{
global $wp_query;
$screen = get_current_screen();
$per_page = get_user_option('toplevel_page_audiotheme_gigs_per_page');
$per_page = empty($per_page) ? 20 : $per_page;
// Set up column headers.
$columns = $this->get_columns();
$hidden = get_hidden_columns($screen->id);
$sortable = $this->get_sortable_columns();
$this->_column_headers = array($columns, $hidden, $sortable);
// Compile the WP_Query args based on the current view and user options.
$args = array('post_type' => 'audiotheme_gig', 'order' => isset($_REQUEST['order']) && 'asc' === strtolower($_REQUEST['order']) ? 'asc' : 'desc', 'post_status' => isset($_REQUEST['post_status']) ? $_REQUEST['post_status'] : 'publish,draft', 'posts_per_page' => $per_page);
if (empty($_REQUEST['m']) && ('upcoming' === $this->current_view || 'past' === $this->current_view)) {
$args['meta_query'][] = array('key' => '_audiotheme_gig_datetime', 'value' => isset($_REQUEST['gig_date']) ? urldecode($_REQUEST['gig_date']) : current_time('mysql'), 'compare' => isset($_REQUEST['compare']) ? urldecode($_REQUEST['compare']) : '>=', 'type' => 'DATETIME');
// Sort upcoming in ascending order by default.
$args['order'] = 'upcoming' === $this->current_view && !isset($_REQUEST['order']) ? 'asc' : $args['order'];
} elseif (!empty($_REQUEST['m'])) {
$m = absint(substr($_REQUEST['m'], 4));
$y = absint(substr($_REQUEST['m'], 0, 4));
$start = sprintf('%s-%s-01 00:00:00', $y, zeroise($m, 2));
$end = sprintf('%s 23:59:59', date('Y-m-t', mktime(0, 0, 0, $m, 1, $y)));
$args['meta_query'][] = array('key' => '_audiotheme_gig_datetime', 'value' => array($start, $end), 'compare' => 'BETWEEN', 'type' => 'DATETIME');
$args['order'] = isset($_REQUEST['order']) ? $args['order'] : 'asc';
}
if (!empty($_REQUEST['venue'])) {
$args['connected_type'] = 'audiotheme_venue_to_gig';
$args['connected_items'] = absint($_REQUEST['venue']);
}
if (isset($_REQUEST['orderby'])) {
switch ($_REQUEST['orderby']) {
case 'title':
$args['orderby'] = 'title';
break;
case 'venue':
// Handled after the query is run.
break;
default:
$args['meta_key'] = '_audiotheme_' . $_REQUEST['orderby'];
$args['orderby'] = 'meta_value';
break;
}
} else {
$args['meta_key'] = '_audiotheme_gig_datetime';
$args['orderby'] = 'meta_value';
}
if (isset($_REQUEST['s'])) {
$args['s'] = $_REQUEST['s'];
}
$args['paged'] = $this->get_pagenum();
// Run the query and fetch the connected venues.
$items = array();
$wp_query = new WP_Query($args);
p2p_type('audiotheme_venue_to_gig')->each_connected($wp_query);
if (isset($wp_query->posts) && count($wp_query->posts)) {
foreach ($wp_query->posts as $post) {
$items[$post->ID] = get_audiotheme_gig($post->ID);
}
// Sort by venue.
if (!empty($_GET['orderby']) && 'venue' === $_GET['orderby']) {
$items = audiotheme_sort_objects($items, array('venue', 'name'), $args['order'], true, 'gig_datetime');
}
}
$this->items = $items;
$this->set_pagination_args(array('total_items' => $wp_query->found_posts, 'per_page' => $per_page, 'total_pages' => $wp_query->max_num_pages));
}
开发者ID:TyRichards,项目名称:ty_the_band,代码行数:74,代码来源:class-audiotheme-gigs-list-table.php
示例17: prepare_items
/**
* Prepares our data for display
*
* @since 1.2
*/
function prepare_items()
{
global $wpdb;
// get the current user ID
$user = get_current_user_id();
// get the current admin screen
$screen = get_current_screen();
// retrieve the "per_page" option
$screen_option = $screen->get_option('per_page', 'option');
// retrieve the value of the option stored for the current user
$per_page = get_user_meta($user, $screen_option, true);
// get the default value if none is set
if (empty($per_page) || $per_page < 1) {
$per_page = $screen->get_option('per_page', 'default');
}
// Get the date/time format that is saved in the options table
$date_format = get_option('date_format');
$time_format = get_option('time_format');
// What page are we looking at?
$current_page = $this->get_pagenum();
// Use offset for pagination
$offset = ($current_page - 1) * $per_page;
// Get column headers
$columns = $this->get_columns();
$hidden = get_hidden_columns($this->screen);
// Get sortable columns
$sortable = $this->get_sortable_columns();
// Build the column headers
$this->_column_headers = array($columns, $hidden, $sortable);
// Get entries search terms
$search_terms = !empty($_POST['s']) ? explode(' ', $_POST['s']) : array();
$searchand = $search = '';
// Loop through search terms and build query
foreach ($search_terms as $term) {
$term = esc_sql($wpdb->esc_like($term));
$search .= "{$searchand}((entries.subject LIKE '%{$term}%') OR (entries.sender_name LIKE '%{$term}%') OR (entries.sender_email LIKE '%{$term}%') OR (entries.emails_to LIKE '%{$term}%') OR (entries.data LIKE '%{$term}%'))";
$searchand = ' AND ';
}
$search = !empty($search) ? " AND ({$search}) " : '';
// Set our ORDER BY and ASC/DESC to sort the entries
$orderby = !empty($_GET['orderby']) ? $_GET['orderby'] : 'date';
$order = !empty($_GET['order']) ? $_GET['order'] : 'desc';
// Get the sorted entries
$entries = $this->get_entries($orderby, $order, $per_page, $offset, $search);
$data = array();
// Loop trough the entries and setup the data to be displayed for each row
foreach ($entries as $entry) {
$data[] = array('entry_id' => $entry->entries_id, 'id' => $entry->entries_id, 'form' => stripslashes($entry->form_title), 'subject' => stripslashes($entry->subject), 'sender_name' => stripslashes($entry->sender_name), 'sender_email' => stripslashes($entry->sender_email), 'emails_to' => implode(',', unserialize(stripslashes($entry->emails_to))), 'date' => date("{$date_format} {$time_format}", strtotime($entry->date_submitted)), 'ip_address' => $entry->ip_address);
}
$where = '';
// If the form filter dropdown is used
if ($this->current_filter_action()) {
$where .= 'AND form_id = ' . $this->current_filter_action();
}
// Get the month/year from the dropdown
$m = isset($_POST['m']) ? (int) $_POST['m'] : 0;
// Parse month/year and build the clause
if ($m > 0) {
$year = substr($m, 0, 4);
$month = substr($m, -2);
$where .= " AND YEAR(date_submitted) = {$year} AND MONTH(date_submitted) = {$month}";
}
// Get the month/year from the dropdown
$today = isset($_GET['today']) ? (int) $_GET['today'] : 0;
// Parse month/year and build the clause
if ($today > 0) {
$where .= " AND entries.date_submitted >= curdate()";
}
// Entry type filter
$where .= $this->get_entry_status() && 'all' !== $this->get_entry_status() ? $wpdb->prepare(' AND entries.entry_approved = %s', $this->get_entry_status()) : '';
// Always display approved entries, unless an Entries Type filter is set
if (!$this->get_entry_status() || 'all' == $this->get_entry_status()) {
$where .= $wpdb->prepare(' AND entries.entry_approved = %d', 1);
}
// How many entries do we have?
$total_items = $wpdb->get_var("SELECT COUNT(*) FROM {$this->entries_table_name} AS entries WHERE 1=1 {$where}");
// Add sorted data to the items property
$this->items = $data;
// Register our pagination
$this->set_pagination_args(array('total_items' => $total_items, 'per_page' => $per_page, 'total_pages' => ceil($total_items / $per_page)));
}
开发者ID:adrianjonmiller,项目名称:animalhealth,代码行数:86,代码来源:class-entries-list.php
示例18: cwp_post_row
function cwp_post_row($a_post, $pending_comments, $mode, $page)
{
global $post;
static $rowclass;
$global_post = $post;
$post = $a_post;
setup_postdata($post);
$rowclass = 'alternate' == $rowclass ? '' : 'alternate';
$rowclass = apply_filters('cwp_post_row_class', $rowclass, $post, $page);
global $current_user;
$post_owner = $current_user->ID == $post->post_author ? 'self' : 'other';
$edit_link = $page->get_edit_link($post->ID);
$delete_link = add_query_arg('post', $post->ID, add_query_arg('action', 'delete', $page->get_page_url()));
$trash_link = wp_nonce_url(add_query_arg('post', $post->ID, add_query_arg('action', 'trash', $page->get_page_url())), "trash-post_" . $post->ID);
$untrash_link = wp_nonce_url(add_query_arg('post', $post->ID, add_query_arg('action', 'untrash', $page->get_page_url())), "untrash-post_" . $post->ID);
$title = _draft_or_post_title();
?>
<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('cwp_manage');
$hidden = get_hidden_columns('edit');
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;
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;
case 'title':
$attributes = 'class="post-title column-title"' . $style;
?>
<td <?php
echo $attributes;
?>
><strong><?php
if (current_user_can('edit_post', $post->ID)) {
?>
<a class="row-title" href="<?php
echo $edit_link;
?>
" title="<?php
echo esc_attr(sprintf(__('Edit “%s”'), $title));
?>
"><?php
//.........这里部分代码省略.........
开发者ID:adamcarlile,项目名称:Alex-Goy,代码行数:101,代码来源:cwp.page.manage.php
示例19: nggallery_picturelist
function nggallery_picturelist()
{
// *** show picture list
global $wpdb, $nggdb, $user_ID, $ngg;
// Look if its a search result
$is_search = isset($_GET['s']) ? true : false;
$counter = 0;
if ($is_search) {
// fetch the imagelist
$picturelist = $ngg->manage_page->search_result;
// we didn't
|
请发表评论