/**
     * Show the search field
     *
     * @since 1.5
     * @access public
     *
     * @param string $text Label for the search box
     * @param string $input_id ID of the search box
     *
     * @return void
     */
    public function search_box($text, $input_id)
    {
        $input_id = $input_id . '-search-input';
        if (!empty($_REQUEST['orderby'])) {
            echo '<input type="hidden" name="orderby" value="' . esc_attr($_REQUEST['orderby']) . '" />';
        }
        if (!empty($_REQUEST['order'])) {
            echo '<input type="hidden" name="order" value="' . esc_attr($_REQUEST['order']) . '" />';
        }
        ?>
		<p class="search-box">
			<label class="screen-reader-text" for="<?php 
        echo $input_id;
        ?>
"><?php 
        echo $text;
        ?>
:</label>
			<input type="search" id="<?php 
        echo $input_id;
        ?>
" name="s" value="<?php 
        _admin_search_query();
        ?>
" />
			<?php 
        submit_button($text, 'button', false, false, array('ID' => 'search-submit'));
        ?>
		</p>
		<?php 
    }
    function search_box($text, $input_id)
    {
        if (empty($_REQUEST['s']) && !$this->has_items()) {
            return;
        }
        $input_id = $input_id . '-search-input';
        if (!empty($_REQUEST['orderby'])) {
            echo '<input type="hidden" name="orderby" value="' . esc_attr($_REQUEST['orderby']) . '" />';
        }
        if (!empty($_REQUEST['order'])) {
            echo '<input type="hidden" name="order" value="' . esc_attr($_REQUEST['order']) . '" />';
        }
        ?>
        <p class="search-box">
            <span class="description"><?php 
        _e('Repository search:', 'installer');
        ?>
</span> 
            <input type="search" id="<?php 
        echo $input_id;
        ?>
" name="s" value="<?php 
        _admin_search_query();
        ?>
" />
            <select name="search_type">

                <option <?php 
        echo isset($_POST['search_type']) && $_POST['search_type'] == '0' ? 'selected' : '';
        ?>
 value="0"><?php 
        _e('All repository types', 'installer');
        ?>
</option>
                <option <?php 
        echo isset($_POST['search_type']) && $_POST['search_type'] == '1' ? 'selected' : '';
        ?>
 value="1"><?php 
        _e('Plugins repositories', 'installer');
        ?>
</option>
                <option <?php 
        echo isset($_POST['search_type']) && $_POST['search_type'] == '2' ? 'selected' : '';
        ?>
 value="2"><?php 
        _e('Themes repositories', 'installer');
        ?>
</option>
            </select>
            <?php 
        submit_button($text, 'button', false, false, array('id' => 'search-submit'));
        ?>
        </p>
        <?php 
    }
 /**
  * Display the search box.
  *
  * @since 3.1.0
  * @access public
  *
  * @param string $text The search button text
  * @param string $input_id The search input id
  */
 function search_box( $text, $input_id ) {
   if ( empty( $_REQUEST['s'] ) && !$this->has_items() ) {
     return;
   }
   
   $input_id = $input_id . '-search-input'; 
   ?>
   <p class="search-box">
     <label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label>
     <input type="text" id="<?php echo $input_id ?>" name="wpi_search[s]" value="<?php _admin_search_query(); ?>" />
     <?php /* submit_button( $text, 'button', false, false, array('id' => 'search-submit') ); */ ?>
   </p>
   <?php
 }
    public function search_box($text, $wrap_attr = '')
    {
        if (empty($_REQUEST['s']) && !$this->has_items()) {
            return;
        }
        $query = parse_url($_SERVER['REQUEST_URI'], PHP_URL_QUERY);
        parse_str($query, $arr);
        $inputs = '';
        foreach ($arr as $k => $v) {
            $inputs .= '<input type="hidden" name="' . esc_attr($k) . '" value="' . esc_attr($v) . '">';
        }
        ?>
		<form action="" method="get" class="search-form">
			<?php 
        echo $inputs;
        ?>
			<p class="polls-search-box" <?php 
        echo $wrap_attr;
        ?>
>
				<label class="screen-reader-text"><?php 
        echo $text;
        ?>
:</label>
				<input type="search" name="s" value="<?php 
        _admin_search_query();
        ?>
" />
				<?php 
        submit_button($text, 'button', '', false, array('id' => 'search-submit'));
        ?>
			</p>
		</form>
		<?php 
    }
Example #5
0
    public function search_box($text, $input_id)
    {
        $input_id = $input_id . '-search-input';
        $total_items = $this->count_subscribers();
        if (empty($total_items)) {
            return;
        }
        ?>
    	<p class="search-box">
    		<label class="screen-reader-text" for="<?php 
        echo $input_id;
        ?>
"><?php 
        echo $text;
        ?>
:</label>
    		<input type="search" id="<?php 
        echo $input_id;
        ?>
" name="s" value="<?php 
        _admin_search_query();
        ?>
" />
    		<?php 
        submit_button($text, 'button', '', false, array('id' => 'search-submit'));
        ?>
    	</p>
    	<?php 
    }
 /**
  * Handle activate & cancel actions for both individual items and bulk edit. 
  *
  * @since 1.0
  */
 public function process_actions()
 {
     if ($this->current_action() === false) {
         return;
     }
     $messages = array();
     $error_messages = array();
     // Single subscription action
     if (isset($_GET['subscription'])) {
         if (!wp_verify_nonce($_REQUEST['_wpnonce'], $_GET['subscription'])) {
             wp_die(__('Action failed. Invalid Nonce.', WC_Subscriptions::$text_domain));
         }
         if (!WC_Subscriptions_Manager::can_subscription_be_changed_to($_GET['new_status'], $_GET['subscription'], $_GET['user'])) {
             $error_messages[] = sprintf(__('Error: Subscription status can not be changed to "%s".', WC_Subscriptions::$text_domain), esc_html($_GET['new_status']));
         } else {
             switch ($_GET['new_status']) {
                 case 'active':
                     WC_Subscriptions_Manager::reactivate_subscription($_GET['user'], $_GET['subscription']);
                     $messages[] = __('Subscription activated.', WC_Subscriptions::$text_domain);
                     break;
                 case 'on-hold':
                     WC_Subscriptions_Manager::put_subscription_on_hold($_GET['user'], $_GET['subscription']);
                     $messages[] = __('Subscription put on-hold.', WC_Subscriptions::$text_domain);
                     break;
                 case 'cancelled':
                     WC_Subscriptions_Manager::cancel_subscription($_GET['user'], $_GET['subscription']);
                     $messages[] = __('Subscription cancelled.', WC_Subscriptions::$text_domain);
                     break;
                 case 'trash':
                     WC_Subscriptions_Manager::trash_subscription($_GET['user'], $_GET['subscription']);
                     $messages[] = __('Subscription trashed.', WC_Subscriptions::$text_domain);
                     break;
                 case 'deleted':
                     WC_Subscriptions_Manager::delete_subscription($_GET['user'], $_GET['subscription']);
                     $messages[] = __('Subscription deleted.', WC_Subscriptions::$text_domain);
                     break;
                 default:
                     $error_messages[] = __('Error: Unknown subscription status.', WC_Subscriptions::$text_domain);
                     break;
             }
         }
     } else {
         if (isset($_GET['subscription_keys'])) {
             // Bulk actions
             if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'bulk-' . $this->_args['plural'])) {
                 wp_die(__('Bulk edit failed. Invalid Nonce.', WC_Subscriptions::$text_domain));
             }
             $subscriptions = $_GET['subscription_keys'];
             $subscription_count = 0;
             $error_count = 0;
             if (in_array($this->current_action(), array('trash', 'deleted'))) {
                 foreach ($subscriptions as $user_id => $subscription_keys) {
                     foreach ($subscription_keys as $subscription_key) {
                         if (!WC_Subscriptions_Manager::can_subscription_be_changed_to($this->current_action(), $subscription_key, $user_id)) {
                             $error_count++;
                         } else {
                             $subscription_count++;
                             if ('trash' == $this->current_action()) {
                                 WC_Subscriptions_Manager::trash_subscription($user_id, $subscription_key);
                             } else {
                                 WC_Subscriptions_Manager::delete_subscription($user_id, $subscription_key);
                             }
                         }
                     }
                 }
                 if ($subscription_count > 0) {
                     if ('trash' == $this->current_action()) {
                         $messages[] = sprintf(_n('%d subscription moved to trash.', '%s subscriptions moved to trash.', $subscription_count, WC_Subscriptions::$text_domain), $subscription_count);
                     } else {
                         $messages[] = sprintf(_n('%d subscription deleted.', '%s subscriptions deleted.', $subscription_count, WC_Subscriptions::$text_domain), $subscription_count);
                     }
                 }
                 if ($error_count > 0) {
                     if ('trash' == $this->current_action()) {
                         $error_messages[] = sprintf(_n('%d subscription could not be trashed - is it active or on-hold? Try cancelling it before trashing it.', '%s subscriptions could not be trashed - are they active or on-hold? Try cancelling them before trashing.', $error_count, WC_Subscriptions::$text_domain), $error_count);
                     } else {
                         $error_messages[] = sprintf(_n('%d subscription could not deleted - is it active or on-hold? Try cancelling it before deleting.', '%s subscriptions could not deleted - are they active or on-hold? Try cancelling them before deleting.', $error_count, WC_Subscriptions::$text_domain), $error_count);
                     }
                 }
             }
         }
     }
     $status = isset($_GET['status']) ? $_GET['status'] : 'all';
     $message_nonce = wp_create_nonce(__FILE__);
     set_transient($this->message_transient_prefix . $message_nonce, array('messages' => $messages, 'error_messages' => $error_messages), 60 * 60);
     $query_args = array('status' => $status, 'message' => $message_nonce);
     $search_query = _admin_search_query();
     if (!empty($search_query)) {
         $query_args['s'] = $search_query;
     }
     $redirect_to = add_query_arg($query_args, admin_url('admin.php?page=subscriptions'));
     // Redirect to avoid performning actions on a page refresh
     wp_safe_redirect($redirect_to);
     exit;
 }
Example #7
0
?>
</h3>

<?php 
if (!empty($_REQUEST['s']) || !empty($_REQUEST['filter']) || $wp_list_table->has_items()) {
    ?>

<form class="search-form filter-form" action="" method="get">

<p class="search-box">
	<label class="screen-reader-text" for="theme-search-input"><?php 
    _e('Search Installed Themes');
    ?>
:</label>
	<input type="text" id="theme-search-input" name="s" value="<?php 
    _admin_search_query();
    ?>
" />
	<?php 
    submit_button(__('Search Installed Themes'), 'button', false, false, array('id' => 'search-submit'));
    ?>
	<a id="filter-click" href="?filter=1"><?php 
    _e('Feature Filter');
    ?>
</a>
</p>

<br class="clear"/>

<div id="filter-box" style="<?php 
    if (empty($_REQUEST['filter'])) {
Example #8
0
/**
 * Output the repair list search form
 *
 * @since 2.6.0 bbPress (r5885)
 */
function bbp_admin_repair_list_search_form()
{
    ?>

	<p class="search-box">
		<label class="screen-reader-text" for="bbp-repair-search-input"><?php 
    esc_html_e('Search Tools:', 'bbpress');
    ?>
</label>
		<input type="search" id="bbp-repair-search-input" name="s" value="<?php 
    _admin_search_query();
    ?>
">
		<input type="submit" id="search-submit" class="button" value="<?php 
    esc_html_e('Search Tools', 'bbpress');
    ?>
">
	</p>

	<?php 
}
 /**
  * Handle activate & cancel actions for both individual items and bulk edit. 
  *
  * @since 1.0
  */
 public function process_actions()
 {
     $custom_actions = apply_filters('woocommerce_subscriptions_list_table_pre_process_actions', array('custom_action' => false, 'messages' => array(), 'error_messages' => array()));
     if ($this->current_action() === false && $custom_actions['custom_action'] === false) {
         return;
     }
     $messages = array();
     $error_messages = array();
     $query_args = array();
     // Check if custom actions were taken by the filter - if so, it has handled the action and we only need to set the message/error messages
     if ($custom_actions['custom_action'] !== false) {
         $messages = $custom_actions['messages'];
         $error_messages = $custom_actions['error_messages'];
     } else {
         if (isset($_GET['subscription'])) {
             // Single subscription action
             if (!wp_verify_nonce($_REQUEST['_wpnonce'], $_GET['subscription'])) {
                 wp_die(__('Action failed. Invalid Nonce.', WC_Subscriptions::$text_domain));
             }
             if (!WC_Subscriptions_Manager::can_subscription_be_changed_to($_GET['new_status'], $_GET['subscription'], $_GET['user'])) {
                 $error_messages[] = sprintf(__('Error: Subscription status can not be changed to "%s".', WC_Subscriptions::$text_domain), esc_html($_GET['new_status']));
             } else {
                 switch ($_GET['new_status']) {
                     case 'active':
                         WC_Subscriptions_Manager::reactivate_subscription($_GET['user'], $_GET['subscription']);
                         $messages[] = __('Subscription activated.', WC_Subscriptions::$text_domain);
                         break;
                     case 'on-hold':
                         WC_Subscriptions_Manager::put_subscription_on_hold($_GET['user'], $_GET['subscription']);
                         $messages[] = __('Subscription put on-hold.', WC_Subscriptions::$text_domain);
                         break;
                     case 'cancelled':
                         WC_Subscriptions_Manager::cancel_subscription($_GET['user'], $_GET['subscription']);
                         $messages[] = __('Subscription cancelled.', WC_Subscriptions::$text_domain);
                         break;
                     case 'trash':
                         WC_Subscriptions_Manager::trash_subscription($_GET['user'], $_GET['subscription']);
                         $messages[] = __('Subscription trashed.', WC_Subscriptions::$text_domain);
                         break;
                     case 'deleted':
                         WC_Subscriptions_Manager::delete_subscription($_GET['user'], $_GET['subscription']);
                         $messages[] = __('Subscription deleted.', WC_Subscriptions::$text_domain);
                         break;
                     default:
                         $error_messages[] = __('Error: Unknown subscription status.', WC_Subscriptions::$text_domain);
                         break;
                 }
             }
         } else {
             if (isset($_GET['subscription_keys'])) {
                 // Bulk actions
                 if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'bulk-' . $this->_args['plural'])) {
                     wp_die(__('Bulk edit failed. Invalid Nonce.', WC_Subscriptions::$text_domain));
                 }
                 $subscriptions = $_GET['subscription_keys'];
                 $subscription_count = 0;
                 $error_count = 0;
                 if (in_array($this->current_action(), array('trash', 'deleted'))) {
                     foreach ($subscriptions as $user_id => $subscription_keys) {
                         foreach ($subscription_keys as $subscription_key) {
                             if (!WC_Subscriptions_Manager::can_subscription_be_changed_to($this->current_action(), $subscription_key, $user_id)) {
                                 $error_count++;
                             } else {
                                 $subscription_count++;
                                 if ('trash' == $this->current_action()) {
                                     WC_Subscriptions_Manager::trash_subscription($user_id, $subscription_key);
                                 } else {
                                     WC_Subscriptions_Manager::delete_subscription($user_id, $subscription_key);
                                 }
                             }
                         }
                     }
                     if ($subscription_count > 0) {
                         if ('trash' == $this->current_action()) {
                             $messages[] = sprintf(_n('%d subscription moved to trash.', '%s subscriptions moved to trash.', $subscription_count, WC_Subscriptions::$text_domain), $subscription_count);
                         } else {
                             $messages[] = sprintf(_n('%d subscription deleted.', '%s subscriptions deleted.', $subscription_count, WC_Subscriptions::$text_domain), $subscription_count);
                         }
                     }
                     if ($error_count > 0) {
                         if ('trash' == $this->current_action()) {
                             $error_messages[] = sprintf(_n('%d subscription could not be trashed - is it active or on-hold? Try cancelling it before trashing it.', '%s subscriptions could not be trashed - are they active or on-hold? Try cancelling them before trashing.', $error_count, WC_Subscriptions::$text_domain), $error_count);
                         } else {
                             $error_messages[] = sprintf(_n('%d subscription could not deleted - is it active or on-hold? Try cancelling it before deleting.', '%s subscriptions could not deleted - are they active or on-hold? Try cancelling them before deleting.', $error_count, WC_Subscriptions::$text_domain), $error_count);
                         }
                     }
                 }
             }
         }
     }
     $message_nonce = wp_create_nonce(__FILE__);
     set_transient($this->message_transient_prefix . $message_nonce, array('messages' => $messages, 'error_messages' => $error_messages), 60 * 60);
     // Filter by a given customer or product?
     if (isset($_GET['_customer_user']) || isset($_GET['_product_id'])) {
         if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'bulk-subscriptions')) {
             wp_die(__('Action failed. Invalid Nonce.', WC_Subscriptions::$text_domain));
         }
         if (!empty($_GET['_customer_user'])) {
             $user_id = intval($_GET['_customer_user']);
             $user = get_user_by('id', absint($_GET['_customer_user']));
             if (false === $user) {
                 wp_die(__('Action failed. Invalid user ID.', WC_Subscriptions::$text_domain));
             }
             $query_args['_customer_user'] = $user_id;
         }
         if (!empty($_GET['_product_id'])) {
             $product_id = intval($_GET['_product_id']);
             $product = get_product($product_id);
             if (false === $product) {
                 wp_die(__('Action failed. Invalid product ID.', WC_Subscriptions::$text_domain));
             }
             $query_args['_product_id'] = $product_id;
         }
     }
     $status = isset($_GET['status']) ? $_GET['status'] : 'all';
     $query_args = array_merge($query_args, array('status' => $status, 'message' => $message_nonce));
     $search_query = _admin_search_query();
     if (!empty($search_query)) {
         $query_args['s'] = $search_query;
     }
     $redirect_to = add_query_arg($query_args, admin_url('admin.php?page=subscriptions'));
     // Redirect to avoid performning actions on a page refresh
     wp_safe_redirect($redirect_to);
     exit;
 }
</h2>

<?php
if ( isset($_GET['deleted']) ) {
	echo '<div id="message" class="updated fade"><p>';
	$deleted = (int) $_GET['deleted'];
	printf(__ngettext('%s link deleted.', '%s links deleted', $deleted), $deleted);
	echo '</p></div>';
	$_SERVER['REQUEST_URI'] = remove_query_arg(array('deleted'), $_SERVER['REQUEST_URI']);
}
?>

<form class="search-form" action="" method="get">
<p class="search-box">
	<label class="hidden" for="link-search-input"><?php _e( 'Search Links' ); ?>:</label>
	<input type="text" class="search-input" id="link-search-input" name="s" value="<?php _admin_search_query(); ?>" />
	<input type="submit" value="<?php _e( 'Search Links' ); ?>" class="button" />
</p>
</form>
<br class="clear" />

<form id="posts-filter" action="" method="get">
<div class="tablenav">

<div class="alignleft actions">
<select name="action">
<option value="" selected="selected"><?php _e('Bulk Actions'); ?></option>
<option value="delete"><?php _e('Delete'); ?></option>
</select>
<input type="submit" value="<?php _e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" />
function pp_admin_projects()
{
    global $user_identity;
    $title = __('Edit Projects', 'prologue-projects');
    if (!($project_category_id = pp_get_category_id('projects'))) {
        ?>
<div class="wrap nosubsub">
<?php 
        screen_icon();
        ?>
	<h2>
<?php 
        echo wp_specialchars($title);
        ?>
	</h2>
	<div id="message" class="updated"><p><?php 
        _e('You must <a href="admin.php?page=prologue-projects-settings">assign an existing category</a> as the container for all projects.', 'prologue-projects');
        ?>
</p></div>
</div>
<?php 
        return;
    }
    global $action;
    wp_reset_vars(array('action'));
    if (isset($_GET['action']) && isset($_GET['delete']) && ('delete' == $_GET['action'] || 'delete' == $_GET['action2'])) {
        $action = 'bulk-delete';
    }
    switch ($action) {
        case 'addproject':
            check_admin_referer('add-project');
            if (!current_user_can('manage_categories')) {
                wp_die(__('Cheatin&#8217; uh?', 'prologue-projects'));
            }
            if (pp_insert_project($_POST)) {
                wp_redirect('admin.php?page=prologue-projects&message=1#addproject');
            } else {
                wp_redirect('admin.php?page=prologue-projects&message=4#addproject');
            }
            exit;
            break;
        case 'delete':
            $project_ID = (int) $_GET['project_ID'];
            check_admin_referer('delete-project_' . $project_ID);
            if (!current_user_can('manage_categories')) {
                wp_die(__('Cheatin&#8217; uh?', 'prologue-projects'));
            }
            $project_name = get_catname($project_ID);
            // Don't delete the default cats.
            if ($project_ID == get_option('default_category')) {
                wp_die(sprintf(__("Can&#8217;t delete the <strong>%s</strong> category: this is the default one", 'prologue-projects'), $cat_name));
            }
            pp_delete_project($project_ID);
            wp_redirect('admin.php?page=prologue-projects&message=2');
            exit;
            break;
        case 'bulk-delete':
            check_admin_referer('bulk-projects');
            echo 1;
            if (!current_user_can('manage_categories')) {
                wp_die(__('You are not allowed to delete projects.', 'prologue-projects'));
            }
            foreach ((array) $_GET['delete'] as $project_ID) {
                $project_name = get_catname($project_ID);
                // Don't delete the default cats.
                if ($project_ID == get_option('default_category')) {
                    wp_die(sprintf(__("Can&#8217;t delete the <strong>%s</strong> category: this is the default one", 'prologue-projects'), $cat_name));
                }
                pp_delete_project($project_ID);
            }
            $sendback = wp_get_referer();
            wp_redirect($sendback);
            exit;
            break;
        case 'edit':
            if (!current_user_can('manage_categories')) {
                wp_die(__('You are not allowed to edit projects.', 'prologue-projects'));
            }
            $title = __('Edit Project', 'prologue-projects');
            require_once 'admin-header.php';
            $project_ID = (int) $_GET['project_ID'];
            $project = pp_get_project_data($project_ID, 'all', 'editing');
            ?>

<div class="wrap nosubsub">
<?php 
            screen_icon();
            ?>

	<h2><?php 
            echo wp_specialchars($title);
            ?>
</h2>

<?php 
            if (isset($_GET['message']) && ($msg = (int) $_GET['message'])) {
                ?>

	<div id="message" class="updated fade"><p><?php 
                echo $messages[$msg];
                ?>
</p></div>

<?php 
                $_SERVER['REQUEST_URI'] = remove_query_arg(array('message'), $_SERVER['REQUEST_URI']);
            }
            ?>

			<div class="wrap">
				<div id="ajax-response"></div>
				<form name="addproject" id="editproject" method="post" action="admin.php?page=prologue-projects" class="validate">
					<input type="hidden" name="action" value="editedproject" />
					<input type="hidden" name="project_ID" value="<?php 
            echo $project['id'];
            ?>
" />
					<?php 
            wp_original_referer_field(true, 'previous');
            ?>
					<?php 
            wp_nonce_field('update-project_' . $project['id']);
            ?>

					<table class="form-table">
						<tr class="form-field form-required">
							<th scope="row" valign="top"><label for="project_name"><?php 
            _e('Project Name', 'prologue-projects');
            ?>
</label></th>
							<td><input name="project_name" id="project_name" type="text" value="<?php 
            echo attribute_escape($project['name']);
            ?>
" size="40" aria-required="true" /><br />
							<span class="setting-description"><?php 
            _e('The name is used to identify the project almost everywhere, for example under the post or in the project widgets.', 'prologue-projects');
            ?>
</span></td>
						</tr>

						<tr class="form-field">
							<th scope="row" valign="top"><label for="project_nicename"><?php 
            _e('Project Slug', 'prologue-projects');
            ?>
</label></th>
							<td><input name="project_nicename" id="project_nicename" type="text" value="<?php 
            echo attribute_escape($project['slug']);
            ?>
" size="40" /><br />
							<span class="setting-description"><?php 
            _e('The &#8220;slug&#8221; is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.', 'prologue-projects');
            ?>
</span></td>
						</tr>

						<tr class="form-field">
							<th scope="row" valign="top"><label for="project_parent"><?php 
            _e('Project Parent', 'prologue-projects');
            ?>
</label></th>
							<td><?php 
            wp_dropdown_categories(array('child_of' => $project_category_id, 'hide_empty' => 0, 'name' => 'project_parent', 'orderby' => 'name', 'selected' => $project['parent_id'], 'hierarchical' => true, 'show_option_none' => __('None', 'prologue-projects')));
            ?>
<br />
							<span class="setting-description"><?php 
            _e('Projects, can have a hierarchy. You might have an event project, and under that have sub-projects for catering and merchandise. Totally optional.', 'prologue-projects');
            ?>
</span></td>
						</tr>

						<tr class="form-field">
							<th scope="row" valign="top"><label for="project_description"><?php 
            _e('Description', 'prologue-projects');
            ?>
</label></th>
							<td><textarea name="project_description" id="project_description" rows="5" cols="40"><?php 
            echo wp_specialchars($project['description']);
            ?>
</textarea><br />
							<span class="setting-description"><?php 
            _e('The description is displayed on each project page.', 'prologue-projects');
            ?>
</span></td>
						</tr>

						<tr class="form-field">
							<th scope="row" valign="top"><label for="project_logo"><?php 
            _e('Project Logo', 'prologue-projects');
            ?>
</label></th>
							<td><input name="project_logo" id="project_logo" type="text" value="<?php 
            echo attribute_escape($project['logo']);
            ?>
" size="255" /><br />
							<span class="setting-description"><?php 
            _e('The project\'s logo. Must be a full URL of an image. Maximum size of 64px x 64px is recommended.', 'prologue-projects');
            ?>
</span></td>
						</tr>

						<tr class="form-field">
							<th scope="row" valign="top"><label for="project_website"><?php 
            _e('Project Website', 'prologue-projects');
            ?>
</label></th>
							<td><input name="project_website" id="project_website" type="text" value="<?php 
            echo attribute_escape($project['website']);
            ?>
" size="255" /><br />
							<span class="setting-description"><?php 
            _e('The project\'s external website. Must be a full URL.', 'prologue-projects');
            ?>
</span></td>
						</tr>

						<tr class="form-field">
							<th scope="row" valign="top"><label for="project_blog"><?php 
            _e('Project Blog', 'prologue-projects');
            ?>
</label></th>
							<td><input name="project_blog" id="project_blog" type="text" value="<?php 
            echo attribute_escape($project['blog']);
            ?>
" size="255" /><br />
							<span class="setting-description"><?php 
            _e('The project\'s external blog. Must be a full URL.', 'prologue-projects');
            ?>
</span></td>
						</tr>

						<tr class="form-field">
							<th scope="row" valign="top"><label for="project_svn"><?php 
            _e('Project Subversion Repository', 'prologue-projects');
            ?>
</label></th>
							<td><input name="project_svn" id="project_svn" type="text" value="<?php 
            echo attribute_escape($project['svn']);
            ?>
" size="255" /><br />
							<span class="setting-description"><?php 
            _e('The location of the project\'s Subversion repository. This is only common in software projects.', 'prologue-projects');
            ?>
</span></td>
						</tr>

						<tr class="form-field">
							<th scope="row" valign="top"><label for="project_trac"><?php 
            _e('Project Trac Installation', 'prologue-projects');
            ?>
</label></th>
							<td><input name="project_trac" id="project_trac" type="text" value="<?php 
            echo attribute_escape($project['trac']);
            ?>
" size="255" /><br />
							<span class="setting-description"><?php 
            _e('The location of the project\'s Trac ticketing website. This is only common in software projects.', 'prologue-projects');
            ?>
</span></td>
						</tr>

						<tr class="form-field">
							<th scope="row" valign="top"><label for="project_intertrac"><?php 
            _e('Project InterTrac Code', 'prologue-projects');
            ?>
</label></th>
							<td><input name="project_intertrac" id="project_intertrac" type="text" value="<?php 
            echo attribute_escape($project['intertrac']);
            ?>
" size="255" /><br />
							<span class="setting-description"><?php 
            _e('This code allows users to distinguish between different Trac installations in the same update. This is only common in software projects.', 'prologue-projects');
            ?>
</span></td>
						</tr>

						<tr class="form-field">
							<th scope="row" valign="top"><label for="project_activity"><?php 
            _e('Project Activity Feeds', 'prologue-projects');
            ?>
</label></th>
							<td><textarea name="project_activity" id="project_activity" rows="5" cols="40"><?php 
            echo wp_specialchars(join("\n", stripslashes_deep($project['activity'])));
            ?>
</textarea><br />
							<span class="setting-description"><?php 
            _e('Specify a list of feeds you wish to aggregate into the projects "activity" sidebar. One feed per line. Activity reported by Trac is automatically included here.', 'prologue-projects');
            ?>
</span></td>
						</tr>

						<tr class="form-field">
							<th scope="row" valign="top"><label for="project_overheard"><?php 
            _e('Project Overheard Feeds', 'prologue-projects');
            ?>
</label></th>
							<td><textarea name="project_overheard" id="project_overheard" rows="5" cols="40"><?php 
            echo wp_specialchars(join("\n", stripslashes_deep($project['overheard'])));
            ?>
</textarea><br />
							<span class="setting-description"><?php 
            _e('Specify a list of feeds you wish to aggregate into the projects "overheard" sidebar. One feed per line.', 'prologue-projects');
            ?>
</span></td>
						</tr>
					</table>

					<p class="submit"><input type="submit" class="button" name="submit" value="<?php 
            _e('Update Project', 'prologue-projects');
            ?>
" /></p>
				</form>
			</div><!-- /wrap -->



<?php 
            break;
        case 'editedproject':
            $project_ID = (int) $_POST['project_ID'];
            check_admin_referer('update-project_' . $project_ID);
            if (!current_user_can('manage_categories')) {
                wp_die(__('Cheatin&#8217; uh?', 'prologue-projects'));
            }
            $location = 'admin.php?page=prologue-projects';
            if ($referer = wp_get_original_referer()) {
                if (false !== strpos($referer, 'admin.php')) {
                    $location = $referer;
                }
            }
            if (pp_update_project($_POST)) {
                $location = add_query_arg('message', 3, $location);
            } else {
                $location = add_query_arg('message', 5, $location);
            }
            wp_redirect($location);
            exit;
            break;
        default:
            if (isset($_GET['_wp_http_referer']) && !empty($_GET['_wp_http_referer'])) {
                wp_redirect(remove_query_arg(array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI'])));
                exit;
            }
            require_once 'admin-header.php';
            $messages[1] = __('Project added.', 'prologue-projects');
            $messages[2] = __('Project deleted.', 'prologue-projects');
            $messages[3] = __('Project updated.', 'prologue-projects');
            $messages[4] = __('Project not added.', 'prologue-projects');
            $messages[5] = __('Project not updated.', 'prologue-projects');
            ?>

<div class="wrap nosubsub">
<?php 
            screen_icon();
            ?>
	<h2>
<?php 
            echo wp_specialchars($title);
            if (isset($_GET['s']) && $_GET['s']) {
                printf('<span class="subtitle">' . __('Search results for &#8220;%s&#8221;', 'prologue-projects') . '</span>', wp_specialchars(stripslashes($_GET['s'])));
            }
            ?>
	</h2>

<?php 
            if (isset($_GET['message']) && ($msg = (int) $_GET['message'])) {
                ?>
	<div id="message" class="updated fade"><p><?php 
                echo $messages[$msg];
                ?>
</p></div>
<?php 
                $_SERVER['REQUEST_URI'] = remove_query_arg(array('message'), $_SERVER['REQUEST_URI']);
            }
            ?>

	<form class="search-form topmargin" action="" method="get">
		<p class="search-box">
			<label class="hidden" for="project-search-input"><?php 
            _e('Search Projects', 'prologue-projects');
            ?>
:</label>
			<input type="text" class="search-input" id="project-search-input" name="s" value="<?php 
            _admin_search_query();
            ?>
" />
			<input type="hidden" name="page" value="prologue-projects" />
			<input type="submit" value="<?php 
            _e('Search Projects', 'prologue-projects');
            ?>
" class="button" />
		</p>
	</form><br class="clear" />

	<div id="col-container">
		<div id="col-right">
			<div class="col-wrap">
				<form id="posts-filter" action="" method="get">
					<input type="hidden" name="page" value="prologue-projects" />
					<div class="tablenav">

<?php 
            $pagenum = isset($_GET['pagenum']) ? absint($_GET['pagenum']) : 0;
            if (empty($pagenum)) {
                $pagenum = 1;
            }
            if (!isset($projectsperpage) || $projectsperpage < 0) {
                $projectsperpage = 20;
            }
            $projectstotal = count(pp_get_projects());
            $page_links = paginate_links(array('base' => add_query_arg('pagenum', '%#%'), 'format' => '', 'prev_text' => __('&laquo;', 'prologue-projects'), 'next_text' => __('&raquo;', 'prologue-projects'), 'total' => ceil($projectstotal / $projectsperpage), 'current' => $pagenum));
            if ($page_links) {
                ?>

						<div class="tablenav-pages"><?php 
                echo $page_links;
                ?>
</div>

<?php 
            }
            ?>

						<div class="alignleft actions">
							<select name="action">
								<option value="" selected="selected"><?php 
            _e('Bulk Actions', 'prologue-projects');
            ?>
</option>
								<option value="delete"><?php 
            _e('Delete', 'prologue-projects');
            ?>
</option>
							</select>
							<input type="submit" value="<?php 
            _e('Apply', 'prologue-projects');
            ?>
" name="doaction" id="doaction" class="button-secondary action" />
							<?php 
            wp_nonce_field('bulk-projects');
            ?>
						</div>

						<br class="clear" />
					</div>

					<div class="clear"></div>

					<table class="widefat fixed" cellspacing="0">
						<thead>
							<tr>

<?php 
            print_column_headers('projects');
            ?>

							</tr>
						</thead>

						<tfoot>
							<tr>

<?php 
            print_column_headers('projects', false);
            ?>

							</tr>
						</tfoot>

						<tbody id="the-list" class="list:projects">

<?php 
            pp_project_rows($project_category_id, 0, 0, $pagenum, $projectsperpage);
            ?>

						</tbody>
					</table>

					<div class="tablenav">

<?php 
            if ($page_links) {
                ?>

						<div class="tablenav-pages"><?php 
                echo $page_links;
                ?>
</div>

<?php 
            }
            ?>

						<div class="alignleft actions">
							<select name="action2">
								<option value="" selected="selected"><?php 
            _e('Bulk Actions', 'prologue-projects');
            ?>
</option>
								<option value="delete"><?php 
            _e('Delete', 'prologue-projects');
            ?>
</option>
							</select>
							<input type="submit" value="<?php 
            _e('Apply', 'prologue-projects');
            ?>
" name="doaction2" id="doaction2" class="button-secondary action" />
							<?php 
            wp_nonce_field('bulk-projects');
            ?>
						</div>

						<br class="clear" />
					</div>
				</form>

				<div class="form-wrap">
					<p><?php 
            _e('<strong>Note:</strong><br />Deleting a project does not delete the posts in that project.', 'prologue-projects');
            ?>
</p>
				</div>
			</div>
		</div><!-- /col-right -->

		<div id="col-left">
			<div class="col-wrap">

<?php 
            if (current_user_can('manage_categories')) {
                ?>

				<div class="form-wrap">
					<h3><?php 
                _e('Add Project', 'prologue-projects');
                ?>
</h3>
					<div id="ajax-response"></div>
					<form name="addproject" id="addproject" method="post" action="admin.php?page=prologue-projects" class="add:the-list: validate">
						<input type="hidden" name="action" value="addproject" />
						<?php 
                wp_original_referer_field(true, 'previous');
                ?>
						<?php 
                wp_nonce_field('add-project');
                ?>

						<div class="form-field form-required">
							<label for="project_name"><?php 
                _e('Project Name', 'prologue-projects');
                ?>
</label>
							<input name="project_name" id="project_name" type="text" value="" size="40" aria-required="true" />
							<p><?php 
                _e('The name is used to identify the project almost everywhere, for example under the post or in the project widgets.', 'prologue-projects');
                ?>
</p>
						</div>

						<div class="form-field">
							<label for="project_nicename"><?php 
                _e('Project Slug', 'prologue-projects');
                ?>
</label>
							<input name="project_nicename" id="project_nicename" type="text" value="" size="40" />
							<p><?php 
                _e('The &#8220;slug&#8221; is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.', 'prologue-projects');
                ?>
</p>
						</div>

						<div class="form-field">
							<label for="project_parent"><?php 
                _e('Project Parent', 'prologue-projects');
                ?>
</label>
							<?php 
                wp_dropdown_categories(array('child_of' => $project_category_id, 'hide_empty' => 0, 'name' => 'project_parent', 'orderby' => 'name', 'selected' => 0, 'hierarchical' => true, 'show_option_none' => __('None', 'prologue-projects')));
                ?>
							<p><?php 
                _e('Projects, can have a hierarchy. You might have an event project, and under that have sub-projects for catering and merchandise. Totally optional.', 'prologue-projects');
                ?>
</p>
						</div>

						<div class="form-field">
							<label for="project_description"><?php 
                _e('Description', 'prologue-projects');
                ?>
</label>
							<textarea name="project_description" id="project_description" rows="5" cols="40"></textarea>
							<p><?php 
                _e('The description is displayed on each project page.', 'prologue-projects');
                ?>
</p>
						</div>

						<div class="form-field">
							<label for="project_logo"><?php 
                _e('Project Logo', 'prologue-projects');
                ?>
</label>
							<input name="project_logo" id="project_logo" type="text" value="" size="255" />
							<p><?php 
                _e('The project\'s logo. Must be a full URL of an image. Maximum size of 64px x 64px is recommended.', 'prologue-projects');
                ?>
</p>
						</div>

						<div class="form-field">
							<label for="project_website"><?php 
                _e('Project Website', 'prologue-projects');
                ?>
</label>
							<input name="project_website" id="project_website" type="text" value="" size="255" />
							<p><?php 
                _e('The project\'s external website. Must be a full URL.', 'prologue-projects');
                ?>
</p>
						</div>

						<div class="form-field">
							<label for="project_blog"><?php 
                _e('Project Blog', 'prologue-projects');
                ?>
</label>
							<input name="project_blog" id="project_blog" type="text" value="" size="255" />
							<p><?php 
                _e('The project\'s external blog. Must be a full URL.', 'prologue-projects');
                ?>
</p>
						</div>

						<div class="form-field">
							<label for="project_svn"><?php 
                _e('Project Subversion Repository', 'prologue-projects');
                ?>
</label>
							<input name="project_svn" id="project_svn" type="text" value="" size="255" />
							<p><?php 
                _e('The location of the project\'s Subversion repository. This is only common in software projects.', 'prologue-projects');
                ?>
</p>
						</div>

						<div class="form-field">
							<label for="project_trac"><?php 
                _e('Project Trac Installation', 'prologue-projects');
                ?>
</label>
							<input name="project_trac" id="project_trac" type="text" value="" size="255" />
							<p><?php 
                _e('The location of the project\'s Trac ticketing website. This is only common in software projects.', 'prologue-projects');
                ?>
</p>
						</div>

						<div class="form-field">
							<label for="project_intertrac"><?php 
                _e('Project InterTrac Code', 'prologue-projects');
                ?>
</label>
							<input name="project_intertrac" id="project_intertrac" type="text" value="" size="255" />
							<p><?php 
                _e('This code allows users to distinguish between different Trac installations in the same update. This is only common in software projects.', 'prologue-projects');
                ?>
</p>
						</div>

						<div class="form-field">
							<label for="project_activity"><?php 
                _e('Project Activity Feeds', 'prologue-projects');
                ?>
</label>
							<textarea name="project_activity" id="project_activity" rows="5" cols="40"></textarea>
							<p><?php 
                _e('Specify a list of feeds you wish to aggregate into the projects "activity" sidebar. One feed per line. Activity reported by Trac is automatically included here.', 'prologue-projects');
                ?>
</p>
						</div>

						<div class="form-field">
							<label for="project_overheard"><?php 
                _e('Project Overheard Feeds', 'prologue-projects');
                ?>
</label>
							<textarea name="project_overheard" id="project_overheard" rows="5" cols="40"></textarea>
							<p><?php 
                _e('Specify a list of feeds you wish to aggregate into the projects "overheard" sidebar. One feed per line.', 'prologue-projects');
                ?>
</p>
						</div>

						<p class="submit"><input type="submit" class="button" name="submit" value="<?php 
                _e('Add Project', 'prologue-projects');
                ?>
" /></p>
					</form>
				</div>

<?php 
            }
            ?>

			</div>
		</div><!-- /col-left -->
	</div><!-- /col-container -->
</div><!-- /wrap -->

<script type="text/javascript">
/* <![CDATA[ */
(function($){
	$(document).ready(function(){
		$('#doaction, #doaction2').click(function(){
			if ( $('select[name^="action"]').val() == 'delete' ) {
				var m = '<?php 
            echo js_escape(__("You are about to delete the selected projects.\n  'Cancel' to stop, 'OK' to delete.", 'prologue-projects'));
            ?>
';
				return showNotice.warn(m);
			}
		});
	});
})(jQuery);
/* ]]> */
</script>

<?php 
            break;
    }
}
Example #12
0
 /**
  * Display the search box.
  *
  * @since 3.1.0
  * @access public
  *
  * @param string $text The search button text
  * @param string $input_id The search input id
  */
 public function search_box($text, $input_id)
 {
     if (empty($_REQUEST['s']) && !$this->has_items()) {
         return;
     }
     $input_id = $input_id . '-search-input';
     if (!empty($_REQUEST['orderby'])) {
         echo '<input type="hidden" name="orderby" value="' . esc_attr($_REQUEST['orderby']) . '" />';
     }
     if (!empty($_REQUEST['order'])) {
         echo '<input type="hidden" name="order" value="' . esc_attr($_REQUEST['order']) . '" />';
     }
     if (!empty($_REQUEST['post_mime_type'])) {
         echo '<input type="hidden" name="post_mime_type" value="' . esc_attr($_REQUEST['post_mime_type']) . '" />';
     }
     if (!empty($_REQUEST['detached'])) {
         echo '<input type="hidden" name="detached" value="' . esc_attr($_REQUEST['detached']) . '" />';
     }
     echo '<p class="search-box">' . '	<label class="screen-reader-text" for="' . esc_attr($input_id) . '>' . $text . ':</label>' . '	<input type="search" id="' . $input_id . '" name="s" value="' . _admin_search_query() . '" />' . submit_button($text, 'button', false, false, array('id' => 'search-submit')) . '</p>';
 }
    public function search_box($text, $input_id)
    {
        ?>
	<p class="search-box">
		<input type="search" id="<?php 
        echo $input_id;
        ?>
" name="s" value="<?php 
        _admin_search_query();
        ?>
">
		<?php 
        submit_button($text, 'button', false, false, array('id' => 'search-submit'));
        ?>
	</p>
	<?php 
    }
Example #14
0
function baweic_list_codes()
{
    $baweic_options = get_option('baweic_options');
    $admin_notices = array('updated' => array(), 'error' => array());
    if (isset($_GET['action'], $_GET['_wpnonce'])) {
        // do this in admin-post next time
        switch ($_GET['action']) {
            case 'delete':
                $code = isset($_GET['code']) ? sanitize_key($_GET['code']) : false;
                if ($code && isset($baweic_options['codes'][$code]) && wp_verify_nonce($_GET['_wpnonce'], 'baweic-' . $_GET['action'] . '-' . $code)) {
                    unset($baweic_options['codes'][$code]);
                    update_option('baweic_options', $baweic_options);
                    $admin_notices['updated'][] = sprintf(__('The code <b>%s</b> have been successfully deleted.', 'baweic'), esc_html($code));
                } else {
                    $admin_notices['error'][] = sprintf(__('The code <b>%s</b> have not been deleted.', 'baweic'), esc_html($code));
                }
                break;
            case 'reset':
                if (wp_verify_nonce($_GET['_wpnonce'], 'baweic-' . $_GET['action'])) {
                    $baweic_options['codes'] = array();
                    update_option('baweic_options', $baweic_options);
                    $admin_notices['updated'][] = __('All codes are gone, nobody can register now.', 'baweic');
                }
                break;
        }
    }
    // actions
    $counts['all'] = count($baweic_options['codes']);
    $counts['used'] = 0;
    $counts['not_used'] = 0;
    if ($counts['all'] > 0) {
        foreach ($baweic_options['codes'] as $c) {
            if (!$c['users']) {
                ++$counts['not_used'];
            } else {
                ++$counts['used'];
            }
        }
    }
    ?>
	<div class="wrap">
		<h1><?php 
    _e('Invitation Codes List', 'baweic');
    ?>
			<a class="add-new-h2" href="<?php 
    echo admin_url('admin.php?page=baweic_add_code');
    ?>
"><?php 
    _e('Add new code', 'baweic');
    ?>
</a>
			<a class="add-new-h2" href="<?php 
    echo admin_url('admin.php?page=baweic_rand_code');
    ?>
"><?php 
    _e('Generate codes', 'baweic');
    ?>
</a>
		<?php 
    if (!empty($_GET['s'])) {
        printf('<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', esc_html($_GET['s']));
    }
    ?>
		</h1>
		<p>
		<?php 
    foreach ($admin_notices['updated'] as $an) {
        echo '<div class="updated"><p>' . $an . '</p></div>';
    }
    foreach ($admin_notices['error'] as $an) {
        echo '<div class="error"><p>' . $an . '</p></div>';
    }
    unset($an);
    ?>
		</p>
		<ul class="subsubsub">
			<li class=""><a class="<?php 
    echo empty($_GET['status']) && empty($_GET['s']) ? 'current' : '';
    ?>
" href="<?php 
    echo admin_url('admin.php?page=baweic_list_codes');
    ?>
"><?php 
    _e('All', 'baweic');
    ?>
 <span class="count">(<?php 
    echo $counts['all'];
    ?>
)</span></a> |</li>
			<li class=""><a class="<?php 
    echo !empty($_GET['status']) && $_GET['status'] == 'used' ? 'current' : '';
    ?>
" href="<?php 
    echo admin_url('admin.php?page=baweic_list_codes&status=used');
    ?>
"><?php 
    _e('Used', 'baweic');
    ?>
 <span class="count">(<?php 
    echo $counts['used'];
    ?>
)</span></a> |</li>
			<li class=""><a class="<?php 
    echo !empty($_GET['status']) && $_GET['status'] == 'not_used' ? 'current' : '';
    ?>
" href="<?php 
    echo admin_url('admin.php?page=baweic_list_codes&status=not_used');
    ?>
"><?php 
    _e('Not used', 'baweic');
    ?>
 <span class="count">(<?php 
    echo $counts['not_used'];
    ?>
)</span></a></li>
		</ul>
		<form action="<?php 
    echo admin_url('admin.php');
    ?>
">
		<p class="search-box">
			<label class="screen-reader-text" for="<?php 
    echo $input_id;
    ?>
"><?php 
    _e('Search by keyword');
    ?>
:</label>
			<input type="search" id="search-text" name="s" value="<?php 
    _admin_search_query();
    ?>
" />
			<input type="hidden" id="page" name="page" value="baweic_list_codes" />
			<?php 
    submit_button(__('Search codes', 'baweic'), 'button', false, false, array('id' => 'search-submit'));
    ?>
		</p>
		</form>
		<table id="codes_table" class="widefat plugins datatables">
			<thead>
				<tr>
					<th scope="col" width="350"><?php 
    _e('Code', 'baweic');
    ?>
</th>
					<th scope="col" width="350"><?php 
    _e('Counter', 'baweic');
    ?>
</th>
					<th scope="col" width="350"><?php 
    _e('User(s)', 'baweic');
    ?>
</th>
					<th scope="col"><?php 
    _e('Action', 'baweic');
    ?>
</th>
				</tr>
			</thead>
			<tfoot>
				<tr>
					<th scope="col"><?php 
    _e('Code', 'baweic');
    ?>
</th>
					<th scope="col"><?php 
    _e('Counter', 'baweic');
    ?>
</th>
					<th scope="col"><?php 
    _e('User(s)', 'baweic');
    ?>
</th>
					<th scope="col"><?php 
    _e('Action', 'baweic');
    ?>
</th>
				</tr>
			</tfoot>
			<tbody class="codes_table">
			<?php 
    $empty = true;
    if (isset($baweic_options['codes']) && count($baweic_options['codes']) > 0) {
        foreach ($baweic_options['codes'] as $code => $infos) {
            if (!empty($_GET['status']) && ('used' == $_GET['status'] && !$infos['users'] || 'not_used' == $_GET['status'] && $infos['users'])) {
                continue;
            }
            if (!empty($_GET['s']) && strstr($code, strtoupper($_GET['s'])) === false) {
                continue;
            }
            $empty = false;
            ?>
					<tr class="token">
						<td>
							<div class="activation">
								<pre><b><?php 
            echo esc_html($code);
            ?>
</b></pre>
							</div>
						</td>
						<td>
							<div class="activation">
								<?php 
            echo '<b>' . $infos['leftcount'] . '</b> / ' . (int) $infos['maxcount'];
            ?>
							</div>
						</td>
						<td>
							<div class="activation">
								<?php 
            echo !empty($infos['users']) ? implode(', ', array_map('esc_html', $infos['users'])) : '-';
            ?>
							</div>
						</td>					
						<td>
							<div class="activation">
								<span class="trash"><a href="<?php 
            echo wp_nonce_url(admin_url('admin.php?page=baweic_list_codes&action=delete&code=' . esc_attr($code)), 'baweic-delete-' . $code);
            ?>
"><?php 
            _e('Delete');
            ?>
</a></span>
							</div>
						</td>
					</tr>
				<?php 
        }
    } else {
        echo '<tr><td colspan="4">' . sprintf(__('No codes yet, <a href="%s">add one</a>!', 'baweic'), admin_url('admin.php?page=baweic_add_code')) . '</td></tr>';
        $empty = false;
    }
    if ($empty) {
        echo '<tr><td colspan="4">' . sprintf(__('No codes yet, <a href="%s">add one</a>!', 'baweic'), admin_url('admin.php?page=baweic_add_code')) . '</td></tr>';
    }
    ?>
			</tbody>
		</table>
		<p><a href="<?php 
    echo wp_nonce_url(admin_url('admin.php?page=baweic_list_codes&action=reset'), 'baweic-reset');
    ?>
" class="button-secondary"><?php 
    _e('Clear all codes', 'baweic');
    ?>
</a></p>
	</div>
<?php 
}
    /**
     * Display the search box.
     *
     * @since 2.0.18
     * @access public
     *
     * @param string $text The search button text
     * @param string $input_id The search input id
     */
    public function search_box($text, $input_id)
    {
        if (empty($_REQUEST['s']) && !$this->has_items()) {
            return;
        }
        $input_id = $input_id . '-search-input';
        foreach (array('orderby', 'order') as $search_params) {
            $this->hidden_search_inputs($search_params);
        }
        ?>
<p class="search-box">
	<label class="screen-reader-text" for="<?php 
        echo esc_attr($input_id);
        ?>
"><?php 
        echo wp_kses($text, array());
        ?>
:</label>
	<input type="search" id="<?php 
        echo esc_attr($input_id);
        ?>
" name="s" value="<?php 
        _admin_search_query();
        ?>
" />
	<?php 
        submit_button($text, 'button', '', false, array('id' => 'search-submit'));
        ?>
</p>
<?php 
    }
Example #16
0
if ( ! current_user_can( 'switch_themes' ) ) {
	echo '</div>';
	require( './admin-footer.php' );
	exit;
}
?>

<form class="search-form filter-form" action="" method="get">

<h3 class="available-themes"><?php _e('Available Themes'); ?></h3>

<?php if ( !empty( $_REQUEST['s'] ) || !empty( $_REQUEST['features'] ) || $wp_list_table->has_items() ) : ?>

<p class="search-box">
	<label class="screen-reader-text" for="theme-search-input"><?php _e('Search Installed Themes'); ?>:</label>
	<input type="search" id="theme-search-input" name="s" value="<?php _admin_search_query(); ?>" />
	<?php submit_button( __( 'Search Installed Themes' ), 'button', false, false, array( 'id' => 'search-submit' ) ); ?>
	<a id="filter-click" href="?filter=1"><?php _e( 'Feature Filter' ); ?></a>
</p>

<div id="filter-box" style="<?php if ( empty($_REQUEST['filter']) ) echo 'display: none;'; ?>">
<?php $feature_list = get_theme_feature_list(); ?>
	<div class="feature-filter">
		<p class="install-help"><?php _e('Theme filters') ?></p>
	<?php if ( !empty( $_REQUEST['filter'] ) ) : ?>
		<input type="hidden" name="filter" value="1" />
	<?php endif; ?>
	<?php foreach ( $feature_list as $feature_name => $features ) :
			$feature_name = esc_html( $feature_name ); ?>

		<div class="feature-container">
/**
 * 'Manage location' page search form.
 *
 * @since 1.0.0
 * @package GeoDirectory_Location_Manager
 *
 * @param string $text Submit button text.
 * @param string $text_input_id HTML id for input box.
 * @return string search form HTML.
 */
function geodir_location_admin_search_box($text, $text_input_id)
{
    $input_id = $text_input_id . '-search-input';
    $current_url = set_url_scheme('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
    $current_url = remove_query_arg(array('hotkeys_highlight_last', 'hotkeys_highlight_first'), $current_url);
    $current_url_search = esc_url(remove_query_arg(array('s', 'country', 'paged'), $current_url), '', '');
    $current_url = esc_url($current_url);
    $countries = geodir_post_location_countries(true);
    $country = isset($_REQUEST['country']) ? wp_unslash(trim($_REQUEST['country'])) : '';
    ob_start();
    ?>
	<label class="screen-reader-text" for="geodir_country"><?php 
    echo __('Select Country', GEODIRLOCATION_TEXTDOMAIN);
    ?>
</label>
	<select id="geodir_country" name="geodir_country">
		<option style="color:#888888" value=""><?php 
    echo __('Country', GEODIRLOCATION_TEXTDOMAIN);
    ?>
</option>
		<?php 
    if (!empty($countries)) {
        ?>
			<?php 
        foreach ($countries as $country_slug => $country_text) {
            ?>
				<option value="<?php 
            echo $country_slug;
            ?>
" <?php 
            echo $country_slug == $country ? 'selected="selected"' : '';
            ?>
><?php 
            echo $country_text;
            ?>
</option>
			<?php 
        }
        ?>
		<?php 
    }
    ?>
	</select>
	<input type="search" onkeypress="return geodir_filter_location(event)" id="<?php 
    echo $input_id;
    ?>
" placeholder="<?php 
    echo esc_attr__('City or Region', GEODIRLOCATION_TEXTDOMAIN);
    ?>
" name="s" value="<?php 
    _admin_search_query();
    ?>
" />&nbsp;&nbsp;<input type="button" value="<?php 
    echo $text;
    ?>
" class="button" id="<?php 
    echo $text_input_id . '-search-submit';
    ?>
" name="<?php 
    echo $text_input_id . '_search_submit';
    ?>
" onclick="return geodir_filter_location()" />&nbsp;&nbsp;<input type="button" value="<?php 
    _e('Reset', GEODIRLOCATION_TEXTDOMAIN);
    ?>
" class="button" id="<?php 
    echo $text_input_id . '-search-reset';
    ?>
" name="<?php 
    echo $text_input_id . '_search_reset';
    ?>
" onclick="jQuery('#geodir_country').val('');jQuery('#location-search-input').val('');return geodir_filter_location();" /><input type="hidden" id="gd_location_page_url" value="<?php 
    echo $current_url;
    ?>
" /><input type="hidden" id="gd_location_bulk_url" value="<?php 
    echo esc_url(admin_url() . 'admin-ajax.php?action=geodir_locationajax_action&location_ajax_action=delete&_wpnonce=' . wp_create_nonce('location_action_bulk_delete'));
    ?>
" />
	<script type="text/javascript"> function geodir_filter_location(e) { 
	if( typeof e=='undefined' || ( typeof e!='undefined' && e.keyCode == '13' ) ) { if( typeof e!='undefined' ) { e.preventDefault(); } window.location.href = '<?php 
    echo $current_url_search;
    ?>
&s='+jQuery('#location-search-input').val()+'&country='+jQuery('#geodir_country').val(); } } </script>
	<?php 
    $content = ob_get_clean();
    return $content;
}
    /**
     * Display the search box.
     *
     * @since  1.0.0
     * @access public
     *
     * @param string $text The search button text
     * @param string $input_id The search input id
     */
    public function search_box($text = null, $input_id = 'search')
    {
        if (empty($_REQUEST['s']) && !$this->has_items()) {
            return;
        }
        if ($this->need_pagination() || $this->is_search()) {
            if (empty($text)) {
                $text = __('Search', 'membership2');
            } else {
                $text = sprintf(__('Search %1$s', 'membership2'), $text);
            }
            $input_id = $input_id . '-search-input';
            $fields = array('orderby', 'order', 'post_mime_type', 'detached');
            $search_fields = array_merge(array('action', 'search_options', 's'), $fields);
            if ($this->is_search()) {
                ?>
				<span class="ms-search-info">
					<?php 
                printf(__('Search results for &#8220;%s&#8221;'), sprintf('<span class="ms-search-term" title="%1$s">%2$s</span>', esc_attr($this->search_string), $this->display_search()));
                printf(' <a href="%1$s" title="%3$s" class="ms-clear-search">%2$s</a>', esc_url_raw(remove_query_arg($search_fields)), '<span class="dashicons dashicons-dismiss"></span>', __('Clear search results', 'membership2'));
                ?>
				</span>
				<?php 
            }
            ?>
			<form class="search-box" action="" method="get">
				<?php 
            // Keep current URL params during the search
            foreach ($_GET as $name => $value) {
                if ('' == $value) {
                    continue;
                }
                printf('<input type="hidden" name="%1$s" value="%2$s">', esc_attr($name), esc_attr($value));
            }
            // Add the search fields to the form.
            foreach ($fields as $field) {
                if (!empty($_REQUEST[$field])) {
                    $value = $_REQUEST[$field];
                } else {
                    $value = '';
                }
                printf('<input type="hidden" name="%1$s" value="%2$s" />', esc_attr($field), esc_attr($value));
            }
            ?>
				<label class="screen-reader-text" for="<?php 
            echo esc_attr($input_id);
            ?>
">
					<?php 
            echo esc_html($text);
            ?>
:
				</label>
				<?php 
            do_action('ms_helper_listtable_searchbox_start', $this);
            ?>
				<input
					type="search"
					id="<?php 
            echo esc_attr($input_id);
            ?>
"
					name="s"
					value="<?php 
            echo esc_attr(_admin_search_query());
            ?>
"
					/>
				<?php 
            submit_button($text, 'button', false, false, array('id' => 'search-submit'));
            ?>
			</form>
			<?php 
        }
    }
    /**
     * Display the search box.
     *
     * @since 4.6.0
     * @access public
     *
     * @param string $text The search button text
     * @param string $input_id The search input id
     */
    public function search_box($text, $input_id)
    {
        if (empty($_REQUEST['s']) && !$this->has_items()) {
            return;
        }
        $input_id = $input_id . '-search-input';
        if (!empty($_REQUEST['orderby'])) {
            echo '<input type="hidden" name="orderby" value="' . esc_attr($_REQUEST['orderby']) . '" />';
        }
        if (!empty($_REQUEST['order'])) {
            echo '<input type="hidden" name="order" value="' . esc_attr($_REQUEST['order']) . '" />';
        }
        ?>
		<p class="search-box">
			<label class="screen-reader-text" for="<?php 
        echo $input_id;
        ?>
"><?php 
        echo $text;
        ?>
:</label>
			<input type="search" id="<?php 
        echo $input_id;
        ?>
" class="wp-filter-search" name="s" value="<?php 
        _admin_search_query();
        ?>
" placeholder="<?php 
        echo esc_attr('Search installed plugins...');
        ?>
"/>
			<input type="submit" id="search-submit" class="button hide-if-js" value="<?php 
        echo esc_attr($text);
        ?>
">
		</p>
		<?php 
    }
Example #20
0
        /**
         * Display the search box.
         *
         * @since 3.1.0
         * @access public
         *
         * @param string $text The search button text
         * @param string $input_id The search input id
         */
        function search_box($text, $input_id)
        {
            if (empty($_REQUEST['s']) && !$this->has_items()) {
                return;
            }
            $input_id = $input_id . '-search-input';
            if (!empty($_REQUEST['orderby'])) {
                echo '<input type="hidden" name="orderby" value="' . esc_attr($_REQUEST['orderby']) . '" />';
            }
            if (!empty($_REQUEST['order'])) {
                echo '<input type="hidden" name="order" value="' . esc_attr($_REQUEST['order']) . '" />';
            }
            if (!empty($_REQUEST['page'])) {
                echo '<input type="hidden" name="page" value="' . esc_attr($_REQUEST['page']) . '" />';
            }
            if (!empty($_REQUEST['post_mime_type'])) {
                echo '<input type="hidden" name="post_mime_type" value="' . esc_attr($_REQUEST['post_mime_type']) . '" />';
            }
            if (!empty($_REQUEST['detached'])) {
                echo '<input type="hidden" name="detached" value="' . esc_attr($_REQUEST['detached']) . '" />';
            }
            ?>
<p class="search-box">
	<label class="screen-reader-text" for="<?php 
            echo $input_id;
            ?>
"><?php 
            echo $text;
            ?>
:</label>
	<input type="search" id="<?php 
            echo $input_id;
            ?>
" name="s" value="<?php 
            _admin_search_query();
            ?>
" />
	<?php 
            submit_button($text, 'button', false, false, array('id' => 'search-submit'));
            ?>
</p>
<?php 
        }
	$status_links[] = "<li class='$status'><a href='$link'$class>" . sprintf(
		_n( $label[0], $label[1], $num_comments->$status ),
		number_format_i18n( $num_comments->$status )
	) . '</a>';
}

$status_links = apply_filters( 'comment_status_links', $status_links );

echo implode( " |</li>\n", $status_links) . '</li>';
unset($status_links);
?>
</ul>

<p class="search-box">
	<label class="screen-reader-text" for="comment-search-input"><?php _e( 'Search Comments' ); ?>:</label>
	<input type="text" id="comment-search-input" name="s" value="<?php _admin_search_query(); ?>" />
	<input type="submit" value="<?php esc_attr_e( 'Search Comments' ); ?>" class="button" />
</p>

<?php
$comments_per_page = get_user_option('edit_comments_per_page');
if ( empty($comments_per_page) )
	$comments_per_page = 20;
$comments_per_page = apply_filters('comments_per_page', $comments_per_page, $comment_status);

if ( isset( $_GET['apage'] ) )
	$page = abs( (int) $_GET['apage'] );
else
	$page = 1;

$start = $offset = ( $page - 1 ) * $comments_per_page;
    /**
     * Override parent views so we can use the filter bar display.
     */
    public function views()
    {
        global $mode;
        $views = $this->get_views();
        ?>
        <div class="wp-filter">
            <div class="filter-items">
                <?php 
        $this->view_switcher($mode);
        ?>

                <label for="attachment-filter" class="screen-reader-text"><?php 
        _e('Filter by type');
        ?>
</label>
                <select class="attachment-filters" name="attachment-filter" id="attachment-filter">
                    <?php 
        if (!empty($views)) {
            foreach ($views as $class => $view) {
                echo "\t{$view}\n";
            }
        }
        ?>
                </select>

                <?php 
        $this->extra_tablenav('bar');
        /** This filter is documented in wp-admin/inclues/class-wp-list-table.php */
        $views = apply_filters("views_{$this->screen->id}", array());
        // Back compat for pre-4.0 view links.
        if (!empty($views)) {
            echo '<ul class="filter-links">';
            foreach ($views as $class => $view) {
                echo "<li class='{$class}'>{$view}</li>";
            }
            echo '</ul>';
        }
        ?>
            </div>

            <div class="search-form">
                <label for="media-search-input" class="screen-reader-text"><?php 
        esc_html_e('Search Media');
        ?>
</label>
                <input type="search" placeholder="<?php 
        esc_attr_e('Search');
        ?>
" id="media-search-input" class="search"
                       name="s" value="<?php 
        _admin_search_query();
        ?>
"></div>
        </div>
        <?php 
    }
 /**
  * Process queue updates and removal of bulk items from Queue List Table
  */
 public static function process_queue_bulk_action()
 {
     $current_action = false;
     if (isset($_REQUEST['action2']) && -1 != $_REQUEST['action2']) {
         $current_action = $_REQUEST['action2'];
     }
     if (isset($_REQUEST['action']) && -1 != $_REQUEST['action']) {
         $current_action = $_REQUEST['action'];
     }
     if ($current_action === false || !isset($_GET['_wpnonce'])) {
         return;
     }
     if (empty($_GET['queue'])) {
         return;
     }
     if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'bulk-items')) {
         wp_die(__('Bulk edit failed. Invalid Nonce.', 'follow_up_emails'));
     }
     $scheduler = Follow_Up_Emails::instance()->scheduler;
     $items = $_GET['queue'];
     $messages = array();
     $error_messages = array();
     $query_args = array();
     if (in_array($current_action, array('send', 'activate', 'suspend', 'delete'))) {
         $item_count = count($items);
         $error_count = 0;
         $scheduler = Follow_Up_Emails::instance()->scheduler;
         foreach ($items as $idx => $queue_id) {
             $item = new FUE_Sending_Queue_Item($queue_id);
             switch ($current_action) {
                 case 'send':
                     $sent = Follow_Up_Emails::instance()->mailer->send_queue_item($item);
                     if (is_wp_error($sent)) {
                         $error_messages[] = sprintf(__('Queue #%d: %s', 'follow_up_emails'), $item->id, $sent->get_error_message());
                     } else {
                         $messages[] = sprintf(__('Queue #%d: Scheduled email sent manually', 'follow_up_emails'), $item->id);
                     }
                     break;
                 case 'activate':
                     $item->status = 1;
                     $item->save();
                     $scheduler->schedule_email($queue_id, $item->send_on);
                     break;
                 case 'suspend':
                     $item->status = 0;
                     $item->save();
                     $scheduler->unschedule_email($queue_id);
                     break;
                 case 'delete':
                     $scheduler->delete_item($queue_id);
                     break;
                 default:
                     $error_messages[] = __('Error: Unknown action.', 'follow_up_emails');
                     break;
             }
         }
         if ($item_count > 0) {
             switch ($current_action) {
                 case 'activate':
                     $messages[] = sprintf(_n('%d email has been activated', '%s emails have been activated', $item_count, 'follow_up_emails'), $item_count);
                     break;
                 case 'suspend':
                     $messages[] = sprintf(_n('%d email has been suspended', '%s emails have been suspended', $item_count, 'follow_up_emails'), $item_count);
                     break;
                 case 'deleted':
                     $messages[] = sprintf(_n('%d email has been deleted', '%s emails have been deleted', $item_count, 'follow_up_emails'), $item_count);
                     break;
             }
         }
         if (!empty($messages) || !empty($error_messages)) {
             $message_nonce = wp_create_nonce(__FILE__);
             set_transient('_fue_messages_' . $message_nonce, array('messages' => $messages, 'error_messages' => $error_messages), 60 * 60);
         }
         // Filter by a given customer or product?
         if (isset($_GET['_customer_user']) || isset($_GET['_product_id'])) {
             if (!empty($_GET['_customer_user'])) {
                 $user_id = intval($_GET['_customer_user']);
                 $user = get_user_by('id', absint($_GET['_customer_user']));
                 if (false === $user) {
                     wp_die(__('Action failed. Invalid user ID.', 'follow_up_emails'));
                 }
                 $query_args['_customer_user'] = $user_id;
             }
             if (!empty($_GET['_product_id'])) {
                 $product_id = intval($_GET['_product_id']);
                 $product = get_product($product_id);
                 if (false === $product) {
                     wp_die(__('Action failed. Invalid product ID.', 'follow_up_emails'));
                 }
                 $query_args['_product_id'] = $product_id;
             }
         }
         $query_args['status'] = isset($_GET['status']) ? $_GET['status'] : 'all';
         if (!empty($messages) || !empty($error_messages)) {
             $query_args['message'] = $message_nonce;
         }
         if (isset($_GET['paged'])) {
             $query_args['paged'] = $_GET['paged'];
         }
         $search_query = _admin_search_query();
         if (!empty($search_query)) {
             $query_args['s'] = $search_query;
         }
         $redirect_to = add_query_arg($query_args, admin_url('admin.php?page=followup-emails-queue'));
         // Redirect to avoid performning actions on a page refresh
         wp_safe_redirect($redirect_to);
         exit;
     }
 }
    /**
     * Show the search field
     *
     * @since 1.4
     * @access public
     *
     * @param string $text Label for the search box
     * @param string $input_id ID of the search box
     *
     * @return void
     */
    public function search_box($text, $input_id)
    {
        if (empty($_REQUEST['s']) && !$this->has_items()) {
            return;
        }
        $input_id = $input_id . '-search-input';
        if (!empty($_REQUEST['orderby'])) {
            echo '<input type="hidden" name="orderby" value="' . esc_attr($_REQUEST['orderby']) . '" />';
        }
        if (!empty($_REQUEST['order'])) {
            echo '<input type="hidden" name="order" value="' . esc_attr($_REQUEST['order']) . '" />';
        }
        ?>
		<p class="search-box">
			<?php 
        do_action('edd_payment_history_search');
        ?>
			<label class="screen-reader-text" for="<?php 
        echo $input_id;
        ?>
"><?php 
        echo $text;
        ?>
:</label>
			<input type="search" id="<?php 
        echo $input_id;
        ?>
" name="s" value="<?php 
        _admin_search_query();
        ?>
" />
			<?php 
        submit_button($text, 'button', false, false, array('ID' => 'search-submit'));
        ?>
<br/>
		</p>
<?php 
    }
    /**
     * Search form for lsit table
     *
     * @since 1.0
     *
     * @param  string $text
     * @param  string $input_id
     *
     * @return void
     */
    public function search_box($text, $input_id)
    {
        if (empty($_REQUEST['s']) && !$this->has_items()) {
            return;
        }
        $input_id = $input_id . '-search-input';
        if (!empty($_REQUEST['orderby'])) {
            echo '<input type="hidden" name="orderby" value="' . esc_attr($_REQUEST['orderby']) . '" />';
        }
        if (!empty($_REQUEST['order'])) {
            echo '<input type="hidden" name="order" value="' . esc_attr($_REQUEST['order']) . '" />';
        }
        if (!empty($_REQUEST['status'])) {
            echo '<input type="hidden" name="status" value="' . esc_attr($_REQUEST['status']) . '" />';
        }
        ?>
        <p class="search-box">
            <label class="screen-reader-text" for="<?php 
        echo $input_id;
        ?>
"><?php 
        echo $text;
        ?>
:</label>
            <input type="search" id="<?php 
        echo $input_id;
        ?>
" name="s" value="<?php 
        _admin_search_query();
        ?>
" />
            <?php 
        submit_button($text, 'button', 'customer_search', false, array('id' => 'search-submit'));
        ?>
            <?php 
        //submit_button( __( 'Advance Search', 'wp-erp' ) , 'button', 'advance_customer_search', false, array( 'id' => 'advance-search-submit' ) );
        ?>
        </p>
        <?php 
    }