function prepare_items()
 {
     $current_screen = get_current_screen();
     $per_page = $this->get_items_per_page('cfseven_contact_forms_per_page');
     $this->_column_headers = $this->get_column_info();
     $args = array('posts_per_page' => $per_page, 'orderby' => 'title', 'order' => 'ASC', 'offset' => ($this->get_pagenum() - 1) * $per_page);
     if (!empty($_REQUEST['s'])) {
         $args['s'] = $_REQUEST['s'];
     }
     if (!empty($_REQUEST['orderby'])) {
         if ('title' == $_REQUEST['orderby']) {
             $args['orderby'] = 'title';
         } elseif ('author' == $_REQUEST['orderby']) {
             $args['orderby'] = 'author';
         } elseif ('date' == $_REQUEST['orderby']) {
             $args['orderby'] = 'date';
         }
     }
     if (!empty($_REQUEST['order'])) {
         if ('asc' == strtolower($_REQUEST['order'])) {
             $args['order'] = 'ASC';
         } elseif ('desc' == strtolower($_REQUEST['order'])) {
             $args['order'] = 'DESC';
         }
     }
     $this->items = WPCF7_ContactForm::find($args);
     $total_items = WPCF7_ContactForm::count();
     $total_pages = ceil($total_items / $per_page);
     $this->set_pagination_args(array('total_items' => $total_items, 'total_pages' => $total_pages, 'per_page' => $per_page));
 }
Esempio n. 2
0
function wpcf7_admin_bulk_validate_page()
{
    $contact_forms = WPCF7_ContactForm::find();
    $count = WPCF7_ContactForm::count();
    $submit_text = sprintf(_n("Validate %s Contact Form Now", "Validate %s Contact Forms Now", $count, 'contact-form-7'), number_format_i18n($count));
    ?>
<div class="wrap">

<h1><?php 
    echo esc_html(__('Validate Configuration', 'contact-form-7'));
    ?>
</h1>

<form method="post" action="">
	<input type="hidden" name="action" value="validate" />
	<?php 
    wp_nonce_field('wpcf7-bulk-validate');
    ?>
	<p><input type="submit" class="button" value="<?php 
    echo esc_attr($submit_text);
    ?>
" /></p>
</form>

<?php 
    echo wpcf7_link(__('http://contactform7.com/configuration-validator-faq/', 'contact-form-7'), __('FAQ about Configuration Validator', 'contact-form-7'));
    ?>

</div>
<?php 
}