/**
  * Test the Prefixes list table.
  */
 function test_prefixes_list_table()
 {
     $GLOBALS['hook_suffix'] = 'test';
     $prefixes_list_table = new WL_Prefixes_List_Table();
     // Test the columns.
     $columns = $prefixes_list_table->get_columns();
     $this->assertTrue(is_array($columns));
     $this->assertCount(2, $columns);
     // Check that the prepare items returns the same number of items in the prefixes.
     $items = wl_prefixes_list();
     $this->assertGreaterThan(0, sizeof($items));
     $prefixes_list_table->prepare_items();
     $this->assertCount(sizeof($items), $prefixes_list_table->items);
     // Check that we get a return value for each column.
     foreach ($prefixes_list_table->items as $item) {
         foreach ($columns as $key => $value) {
             $this->assertEquals($item[$key], $prefixes_list_table->column_default($item, $key));
         }
     }
 }
/**
 * Displays the page content.
 *
 * @since 3.0.0
 *
 * @param boolean $display_page_title If true, prints out the page title.
 */
function wl_prefixes_admin_menu_callback($display_page_title = true)
{
    if (!current_user_can('manage_options')) {
        wp_die(__('You do not have sufficient permissions to access this page.'));
    }
    $page_title = __('Prefixes', 'wordlift');
    echo '<div class="wrap">';
    if ($display_page_title) {
        echo "<h2>{$page_title}</h2>";
    }
    echo <<<EOF
    <br class="clear">

    <div id="col-container">

        <div id="col-right">
            <div class="col-wrap">
EOF;
    // Create the List Table.
    $wl_prefixes_table = new WL_Prefixes_List_Table();
    // See if we have an action.
    switch ($wl_prefixes_table->current_action()) {
        // Add the prefix using the provided data.
        case 'add-prefix':
            check_admin_referer('add-prefix', '_wpnonce_add-prefix');
            if (!current_user_can('manage_options')) {
                wp_die(__('Cheatin&#8217; uh?'));
            }
            wl_prefixes_add($_POST['prefix'], $_POST['namespace']);
            break;
            // Delete a prefix.
        // Delete a prefix.
        case 'delete':
            if (!current_user_can('manage_options')) {
                wp_die(__('Cheatin&#8217; uh?'));
            }
            wl_prefixes_delete($_GET['prefix']);
            break;
        case 'bulk-delete':
            $prefixes = (array) $_REQUEST['prefix'];
            foreach ($prefixes as $prefix) {
                wl_prefixes_delete($prefix);
            }
            break;
    }
    $wl_prefixes_table->prepare_items();
    $wl_prefixes_table->display();
    ?>
	</div>
	</div><!-- /col-right -->

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

			<div class="form-wrap">
				<h3>Add New Prefix</h3>

				<form id="addprefix" method="post" class="validate">
					<input type="hidden" name="action" value="add-prefix">
					<?php 
    wp_nonce_field('add-prefix', '_wpnonce_add-prefix');
    ?>

					<div class="form-field form-required">
						<label for="prefix"><?php 
    _e('Prefix', 'wordlift');
    ?>
</label>
						<input name="prefix" id="prefix" type="text" value="" size="40" aria-required="true">

						<p><?php 
    __('The namespace prefix.', 'wordlift');
    ?>
</p>
					</div>
					<div class="form-field">
						<label for="namespace"><?php 
    _e('Namespace', 'wordlift');
    ?>
</label>
						<input name="namespace" id="namespace" type="text" value="" size="128">

						<p><?php 
    __('The namespace URL.', 'wordlift');
    ?>
</p>
					</div>

					<?php 
    submit_button(__('Add New Prefix', 'wordlift'));
    ?>

				</form>
			</div>
		</div>
	</div><!-- /col-left -->

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

<?php 
}