Exemplo n.º 1
0
 /**
  * Render the "Assistant" subpage in the Media section, using the list_table package
  *
  * @since 0.1
  *
  * @return	void
  */
 public static function mla_render_admin_page()
 {
     /*
      * WordPress class-wp-list-table.php doesn't look in hidden fields to set
      * the month filter dropdown or sorting parameters
      */
     if (isset($_REQUEST['m'])) {
         $_GET['m'] = $_REQUEST['m'];
     }
     if (isset($_REQUEST['order'])) {
         $_GET['order'] = $_REQUEST['order'];
     }
     if (isset($_REQUEST['orderby'])) {
         $_GET['orderby'] = $_REQUEST['orderby'];
     }
     // bulk_refresh simply refreshes the page, ignoring other bulk actions
     if (!empty($_REQUEST['bulk_refresh'])) {
         unset($_REQUEST['action']);
         unset($_POST['action']);
         unset($_REQUEST['action2']);
         unset($_POST['action2']);
     }
     $bulk_action = self::_current_bulk_action();
     $page_title = MLAOptions::mla_get_option(MLAOptions::MLA_SCREEN_PAGE_TITLE);
     if (empty($page_title)) {
         $page_title = MLAOptions::mla_get_option(MLAOptions::MLA_SCREEN_PAGE_TITLE, true);
     }
     echo "<div class=\"wrap\">\n";
     echo "<div id=\"icon-upload\" class=\"icon32\"><br/></div>\n";
     echo "<h2>{$page_title}";
     // trailing </h2> is action-specific
     if (!current_user_can('upload_files')) {
         echo ' - ' . __('ERROR', 'media-library-assistant') . "</h2>\n";
         wp_die(__('You do not have permission to manage attachments.', 'media-library-assistant'));
     }
     $page_content = array('message' => '', 'body' => '');
     if (!empty($_REQUEST['mla_admin_message'])) {
         $page_content['message'] = $_REQUEST['mla_admin_message'];
     }
     /*
      * The category taxonomy (edit screens) is a special case because 
      * post_categories_meta_box() changes the input name
      */
     if (!isset($_REQUEST['tax_input'])) {
         $_REQUEST['tax_input'] = array();
     }
     if (isset($_REQUEST['post_category'])) {
         $_REQUEST['tax_input']['category'] = $_REQUEST['post_category'];
         unset($_REQUEST['post_category']);
     }
     /*
      * Process bulk actions that affect an array of items
      */
     if ($bulk_action && $bulk_action != 'none') {
         // bulk_refresh simply refreshes the page, ignoring other bulk actions
         if (empty($_REQUEST['bulk_refresh'])) {
             $item_content = self::mla_process_bulk_action($bulk_action);
             $page_content['message'] .= $item_content['message'] . '<br>';
         }
     }
     // $bulk_action
     if (isset($_REQUEST['clear_filter_by'])) {
         self::mla_clear_filter_by();
     }
     /*
      * Empty the Trash?
      */
     if (isset($_REQUEST['delete_all'])) {
         global $wpdb;
         $ids = $wpdb->get_col($wpdb->prepare("SELECT ID FROM {$wpdb->posts} WHERE post_type=%s AND post_status = %s", 'attachment', 'trash'));
         $delete_count = 0;
         foreach ($ids as $post_id) {
             $item_content = self::_delete_single_item($post_id);
             if (false !== strpos($item_content['message'], __('ERROR', 'media-library-assistant'))) {
                 $page_content['message'] .= $item_content['message'] . '<br>';
             } else {
                 $delete_count++;
             }
         }
         if ($delete_count) {
             /* translators: 1: number of items */
             $page_content['message'] .= sprintf(_nx('%s item deleted.', '%s items deleted.', $delete_count, 'deleted items', 'media-library-assistant'), number_format_i18n($delete_count));
         } else {
             $page_content['message'] .= __('No items deleted.', 'media-library-assistant');
         }
     }
     /*
      * Process row-level actions that affect a single item
      */
     if (!empty($_REQUEST['mla_admin_action'])) {
         check_admin_referer(self::MLA_ADMIN_NONCE_ACTION, MLA::MLA_ADMIN_NONCE_NAME);
         $page_content = apply_filters('mla_list_table_single_action', NULL, $_REQUEST['mla_admin_action'], isset($_REQUEST['mla_item_ID']) ? $_REQUEST['mla_item_ID'] : 0);
         if (is_null($page_content)) {
             $prevent_default = false;
             $custom_message = '';
         } else {
             $prevent_default = isset($page_content['prevent_default']) ? $page_content['prevent_default'] : false;
             $custom_message = isset($page_content['message']) ? $page_content['message'] : '';
         }
         if (!$prevent_default) {
             switch ($_REQUEST['mla_admin_action']) {
                 case self::MLA_ADMIN_SINGLE_DELETE:
                     $page_content = self::_delete_single_item($_REQUEST['mla_item_ID']);
                     break;
                 case self::MLA_ADMIN_SINGLE_RESTORE:
                     $page_content = self::_restore_single_item($_REQUEST['mla_item_ID']);
                     break;
                 case self::MLA_ADMIN_SINGLE_TRASH:
                     $page_content = self::_trash_single_item($_REQUEST['mla_item_ID']);
                     break;
                 case self::MLA_ADMIN_SET_PARENT:
                     $new_data = array('post_parent' => $_REQUEST['found_post_id']);
                     foreach ($_REQUEST['children'] as $child) {
                         $item_content = MLAData::mla_update_single_item($child, $new_data);
                         $page_content['message'] .= $item_content['message'] . '<br>';
                     }
                     unset($_REQUEST['parent']);
                     unset($_REQUEST['children']);
                     unset($_REQUEST['mla-set-parent-ajax-nonce']);
                     unset($_REQUEST['mla_set_parent_search_text']);
                     unset($_REQUEST['found_post_id']);
                     unset($_REQUEST['mla-set-parent-submit']);
                     break;
                 case self::MLA_ADMIN_TERMS_SEARCH:
                     /*
                      * This will be handled as a database query argument,
                      * but validate the arguments here
                      */
                     $mla_terms_search = isset($_REQUEST['mla_terms_search']) ? $_REQUEST['mla_terms_search'] : array('phrases' => '', 'taxonomies' => array());
                     if (!is_array($mla_terms_search) || empty($mla_terms_search['phrases']) || empty($mla_terms_search['taxonomies'])) {
                         unset($_REQUEST['mla_terms_search']);
                         $page_content = array('message' => __('Empty Terms Search; ignored', 'media-library-assistant'), 'body' => '');
                     } else {
                         unset($_REQUEST['mla_terms_search']['submit']);
                     }
                     break;
                 default:
                     $page_content = apply_filters('mla_list_table_custom_single_action', NULL, $_REQUEST['mla_admin_action'], isset($_REQUEST['mla_item_ID']) ? $_REQUEST['mla_item_ID'] : 0);
                     if (is_null($page_content)) {
                         $page_content = array('message' => sprintf(__('Unknown mla_admin_action - "%1$s"', 'media-library-assistant'), $_REQUEST['mla_admin_action']), 'body' => '');
                     }
                     // Unknown mla_admin_action
             }
             // switch ($_REQUEST['mla_admin_action'])
         }
         // ! $prevent_default
         if (!empty($custom_message)) {
             $page_content['message'] = $custom_message . $page_content['message'];
         }
     }
     // (!empty($_REQUEST['mla_admin_action'])
     if (!empty($page_content['body'])) {
         if (!empty($page_content['message'])) {
             if (false !== strpos($page_content['message'], __('ERROR', 'media-library-assistant'))) {
                 $messages_class = 'mla_errors';
             } else {
                 $messages_class = 'mla_messages';
             }
             echo "  <div class=\"{$messages_class}\"><p>\n";
             echo '    ' . $page_content['message'] . "\n";
             echo "  </p></div>\n";
             // id="message"
         }
         echo $page_content['body'];
     } else {
         /*
          * Display Attachments list
          */
         if (!empty($_REQUEST['heading_suffix'])) {
             echo ' - ' . esc_html($_REQUEST['heading_suffix']) . "</h2>\n";
         } elseif (!empty($_REQUEST['mla_terms_search'])) {
             echo ' - ' . __('term search results for', 'media-library-assistant') . ' "' . esc_html(stripslashes(trim($_REQUEST['mla_terms_search']['phrases']))) . "\"</h2>\n";
         } elseif (!empty($_REQUEST['s'])) {
             if (empty($_REQUEST['mla_search_fields'])) {
                 echo ' - ' . __('post/parent results for', 'media-library-assistant') . ' "' . esc_html(stripslashes(trim($_REQUEST['s']))) . "\"</h2>\n";
             } else {
                 echo ' - ' . __('search results for', 'media-library-assistant') . ' "' . esc_html(stripslashes(trim($_REQUEST['s']))) . "\"</h2>\n";
             }
         } else {
             echo "</h2>\n";
         }
         if (!empty($page_content['message'])) {
             if (false !== strpos($page_content['message'], __('ERROR', 'media-library-assistant'))) {
                 $messages_class = 'mla_errors';
             } else {
                 $messages_class = 'mla_messages';
             }
             echo "  <div class=\"{$messages_class}\"><p>\n";
             echo '    ' . $page_content['message'] . "\n";
             echo "  </p></div>\n";
             // id="message"
         }
         //	Create an instance of our package class...
         $MLAListTable = apply_filters('mla_list_table_new_instance', NULL);
         if (is_null($MLAListTable)) {
             $MLAListTable = new MLA_List_Table();
         }
         //	Fetch, prepare, sort, and filter our data...
         $MLAListTable->prepare_items();
         $MLAListTable->views();
         $view_arguments = MLA_List_Table::mla_submenu_arguments();
         if (isset($view_arguments['lang'])) {
             $form_url = 'upload.php?page=' . self::ADMIN_PAGE_SLUG . '&lang=' . $view_arguments['lang'];
         } else {
             $form_url = 'upload.php?page=' . self::ADMIN_PAGE_SLUG;
         }
         //	 Forms are NOT created automatically, wrap the table in one to use features like bulk actions
         echo '<form action="' . admin_url($form_url) . '" method="post" id="mla-filter">' . "\n";
         /*
          * Include the Search Media box
          */
         require_once MLA_PLUGIN_PATH . 'includes/mla-main-search-box-template.php';
         /*
          * We also need to ensure that the form posts back to our current page and remember all the view arguments
          */
         echo sprintf('<input type="hidden" name="page" value="%1$s" />', $_REQUEST['page']) . "\n";
         foreach ($view_arguments as $key => $value) {
             if ('meta_query' == $key) {
                 $value = stripslashes($_REQUEST['meta_query']);
             }
             /*
              * Search box elements are already set up in the above "search-box"
              * 'lang' has already been added to the form action attribute
              */
             if (in_array($key, array('s', 'mla_search_connector', 'mla_search_fields', 'lang'))) {
                 continue;
             }
             if (is_array($value)) {
                 foreach ($value as $element_key => $element_value) {
                     echo sprintf('<input type="hidden" name="%1$s[%2$s]" value="%3$s" />', $key, $element_key, esc_attr($element_value)) . "\n";
                 }
             } else {
                 echo sprintf('<input type="hidden" name="%1$s" value="%2$s" />', $key, esc_attr($value)) . "\n";
             }
         }
         //	 Now we can render the completed list table
         $MLAListTable->display();
         echo "</form><!-- id=mla-filter -->\n";
         /*
          * Insert the hidden form and table for inline edits (quick & bulk)
          */
         echo self::_build_inline_edit_form($MLAListTable);
         echo "<div id=\"ajax-response\"></div>\n";
         echo "<br class=\"clear\" />\n";
         echo "</div><!-- class=wrap -->\n";
     }
     // display attachments list
 }
Exemplo n.º 2
0
 /**
  * Render the "Assistant" subpage in the Media section, using the list_table package
  *
  * @since 0.1
  *
  * @return	void
  */
 public static function mla_render_admin_page()
 {
     /*
      * WordPress class-wp-list-table.php doesn't look in hidden fields to set
      * the month filter dropdown or sorting parameters
      */
     if (isset($_REQUEST['m'])) {
         $_GET['m'] = $_REQUEST['m'];
     }
     if (isset($_REQUEST['order'])) {
         $_GET['order'] = $_REQUEST['order'];
     }
     if (isset($_REQUEST['orderby'])) {
         $_GET['orderby'] = $_REQUEST['orderby'];
     }
     $bulk_action = self::_current_bulk_action();
     $page_title = MLAOptions::mla_get_option(MLAOptions::MLA_SCREEN_PAGE_TITLE);
     echo "<div class=\"wrap\">\r\n";
     echo "<div id=\"icon-upload\" class=\"icon32\"><br/></div>\r\n";
     echo "<h2>{$page_title}";
     // trailing </h2> is action-specific
     if (!current_user_can('upload_files')) {
         echo " - Error</h2>\r\n";
         wp_die(__('You do not have permission to manage attachments.'));
     }
     $page_content = array('message' => '', 'body' => '');
     /*
      * The category taxonomy (edit screens) is a special case because 
      * post_categories_meta_box() changes the input name
      */
     if (!isset($_REQUEST['tax_input'])) {
         $_REQUEST['tax_input'] = array();
     }
     if (isset($_REQUEST['post_category'])) {
         $_REQUEST['tax_input']['category'] = $_REQUEST['post_category'];
         unset($_REQUEST['post_category']);
     }
     /*
      * Process bulk actions that affect an array of items
      */
     if ($bulk_action && $bulk_action != 'none') {
         if (isset($_REQUEST['cb_attachment'])) {
             foreach ($_REQUEST['cb_attachment'] as $index => $post_id) {
                 switch ($bulk_action) {
                     case 'delete':
                         $item_content = self::_delete_single_item($post_id);
                         break;
                     case 'edit':
                         if (!empty($_REQUEST['bulk_custom_field_map'])) {
                             $updates = MLAOptions::mla_evaluate_custom_field_mapping($post_id, 'single_attachment_mapping');
                             $item_content = MLAData::mla_update_single_item($post_id, $updates);
                             break;
                         }
                         if (!empty($_REQUEST['bulk_map'])) {
                             $item = get_post($post_id);
                             $updates = MLAOptions::mla_evaluate_iptc_exif_mapping($item, 'iptc_exif_mapping');
                             $item_content = MLAData::mla_update_single_item($post_id, $updates);
                             break;
                         }
                         /*
                          * Copy the edit form contents to $new_data
                          */
                         $new_data = array();
                         if (isset($_REQUEST['post_parent'])) {
                             if (is_numeric($_REQUEST['post_parent'])) {
                                 $new_data['post_parent'] = $_REQUEST['post_parent'];
                             }
                         }
                         if (isset($_REQUEST['post_author'])) {
                             if (-1 != $_REQUEST['post_author']) {
                                 $new_data['post_author'] = $_REQUEST['post_author'];
                             }
                         }
                         /*
                          * Custom field support
                          */
                         $custom_fields = array();
                         foreach (MLAOptions::mla_custom_field_support('bulk_edit') as $slug => $label) {
                             if (isset($_REQUEST[$slug])) {
                                 if (!empty($_REQUEST[$slug])) {
                                     $custom_fields[$label] = $_REQUEST[$slug];
                                 }
                             }
                         }
                         // foreach
                         if (!empty($custom_fields)) {
                             $new_data['custom_updates'] = $custom_fields;
                         }
                         $item_content = MLAData::mla_update_single_item($post_id, $new_data, $_REQUEST['tax_input'], $_REQUEST['tax_action']);
                         break;
                     case 'restore':
                         $item_content = self::_restore_single_item($post_id);
                         break;
                         //case 'tag':
                     //case 'tag':
                     case 'trash':
                         $item_content = self::_trash_single_item($post_id);
                         break;
                     default:
                         $item_content = array('message' => sprintf('Unknown bulk action %s', $bulk_action), 'body' => '');
                 }
                 // switch $bulk_action
                 $page_content['message'] .= $item_content['message'] . '<br>';
             }
             // foreach cb_attachment
             unset($_REQUEST['post_parent']);
             unset($_REQUEST['post_author']);
             unset($_REQUEST['tax_input']);
             unset($_REQUEST['tax_action']);
             foreach (MLAOptions::mla_custom_field_support('bulk_edit') as $slug => $label) {
                 unset($_REQUEST[$slug]);
             }
             unset($_REQUEST['cb_attachment']);
         } else {
             $page_content['message'] = 'Bulk Action ' . $bulk_action . ' - no items selected.';
         }
         unset($_REQUEST['action']);
         unset($_REQUEST['bulk_edit']);
         unset($_REQUEST['action2']);
     }
     // $bulk_action
     if (isset($_REQUEST['clear_filter_by'])) {
         unset($_REQUEST['heading_suffix']);
         unset($_REQUEST['parent']);
         unset($_REQUEST['author']);
         unset($_REQUEST['mla-tax']);
         unset($_REQUEST['mla-term']);
         unset($_REQUEST['mla-metakey']);
         unset($_REQUEST['mla-metavalue']);
     }
     if (isset($_REQUEST['delete_all'])) {
         global $wpdb;
         $ids = $wpdb->get_col($wpdb->prepare("SELECT ID FROM {$wpdb->posts} WHERE post_type=%s AND post_status = %s", 'attachment', 'trash'));
         $delete_count = 0;
         foreach ($ids as $post_id) {
             $item_content = self::_delete_single_item($post_id);
             if (false !== strpos($item_content['message'], 'ERROR:')) {
                 $page_content['message'] .= $item_content['message'] . '<br>';
             } else {
                 $delete_count++;
             }
         }
         if ($delete_count) {
             $page_content['message'] .= sprintf(_nx('%s item deleted.', '%s items deleted.', $delete_count, 'deleted items'), number_format_i18n($delete_count));
         } else {
             $page_content['message'] .= 'No items deleted.';
         }
     }
     /*
      * Process row-level actions that affect a single item
      */
     if (!empty($_REQUEST['mla_admin_action'])) {
         check_admin_referer(self::MLA_ADMIN_NONCE);
         switch ($_REQUEST['mla_admin_action']) {
             case self::MLA_ADMIN_SINGLE_DELETE:
                 $page_content = self::_delete_single_item($_REQUEST['mla_item_ID']);
                 break;
             case self::MLA_ADMIN_SINGLE_EDIT_DISPLAY:
                 echo " - Edit single item</h2>";
                 $page_content = self::_display_single_item($_REQUEST['mla_item_ID']);
                 break;
             case self::MLA_ADMIN_SINGLE_EDIT_UPDATE:
                 if (!empty($_REQUEST['update'])) {
                     $page_content = MLAData::mla_update_single_item($_REQUEST['mla_item_ID'], $_REQUEST['attachments'][$_REQUEST['mla_item_ID']], $_REQUEST['tax_input']);
                 } elseif (!empty($_REQUEST['map-iptc-exif'])) {
                     $item = get_post($_REQUEST['mla_item_ID']);
                     $updates = MLAOptions::mla_evaluate_iptc_exif_mapping($item, 'iptc_exif_mapping');
                     $page_content = MLAData::mla_update_single_item($_REQUEST['mla_item_ID'], $updates);
                 } else {
                     $page_content = array('message' => 'Item: ' . $_REQUEST['mla_item_ID'] . ' cancelled.', 'body' => '');
                 }
                 break;
             case self::MLA_ADMIN_SINGLE_RESTORE:
                 $page_content = self::_restore_single_item($_REQUEST['mla_item_ID']);
                 break;
             case self::MLA_ADMIN_SINGLE_TRASH:
                 $page_content = self::_trash_single_item($_REQUEST['mla_item_ID']);
                 break;
             default:
                 $page_content = array('message' => sprintf('Unknown mla_admin_action - "%1$s"', $_REQUEST['mla_admin_action']), 'body' => '');
                 break;
         }
         // switch ($_REQUEST['mla_admin_action'])
     }
     // (!empty($_REQUEST['mla_admin_action'])
     if (!empty($page_content['body'])) {
         if (!empty($page_content['message'])) {
             if (false !== strpos($page_content['message'], 'ERROR:')) {
                 $messages_class = 'mla_errors';
             } else {
                 $messages_class = 'mla_messages';
             }
             echo "  <div class=\"{$messages_class}\"><p>\r\n";
             echo '    ' . $page_content['message'] . "\r\n";
             echo "  </p></div>\r\n";
             // id="message"
         }
         echo $page_content['body'];
     } else {
         /*
          * Display Attachments list
          */
         if (!empty($_REQUEST['heading_suffix'])) {
             echo ' - ' . esc_html($_REQUEST['heading_suffix']) . "</h2>\r\n";
         } elseif (!empty($_REQUEST['s']) && !empty($_REQUEST['mla_search_fields'])) {
             echo ' - search results for "' . esc_html(stripslashes(trim($_REQUEST['s']))) . "\"</h2>\r\n";
         } else {
             echo "</h2>\r\n";
         }
         if (!empty($page_content['message'])) {
             if (false !== strpos($page_content['message'], 'ERROR:')) {
                 $messages_class = 'mla_errors';
             } else {
                 $messages_class = 'mla_messages';
             }
             echo "  <div class=\"{$messages_class}\"><p>\r\n";
             echo '    ' . $page_content['message'] . "\r\n";
             echo "  </p></div>\r\n";
             // id="message"
         }
         /*
          * Optional - limit width of the views list
          */
         $view_width = MLAOptions::mla_get_option(MLAOptions::MLA_TABLE_VIEWS_WIDTH);
         if (!empty($view_width)) {
             if (is_numeric($view_width)) {
                 $view_width .= 'px';
             }
             echo "  <style type='text/css'>\r\n";
             echo "    ul.subsubsub {\r\n";
             echo "      width: {$view_width};\r\n";
             echo "      max-width: {$view_width};\r\n";
             echo "    }\r\n";
             echo "  </style>\r\n";
         }
         //	Create an instance of our package class...
         $MLAListTable = new MLA_List_Table();
         //	Fetch, prepare, sort, and filter our data...
         $MLAListTable->prepare_items();
         $MLAListTable->views();
         //	 Forms are NOT created automatically, so you need to wrap the table in one to use features like bulk actions
         //			echo '<form action="' . admin_url( 'upload.php' ) . '" method="get" id="mla-filter">' . "\r\n";
         echo '<form action="' . admin_url('upload.php?page=' . self::ADMIN_PAGE_SLUG) . '" method="post" id="mla-filter">' . "\r\n";
         //			echo '<form action="' . admin_url( 'upload.php?page=' . self::ADMIN_PAGE_SLUG ) . '" method="get" id="mla-filter">' . "\r\n";
         /*
          * Compose the Search Media box
          */
         if (!empty($_REQUEST['s']) && !empty($_REQUEST['mla_search_fields'])) {
             $search_value = esc_attr(stripslashes(trim($_REQUEST['s'])));
             $search_fields = $_REQUEST['mla_search_fields'];
             $search_connector = $_REQUEST['mla_search_connector'];
         } else {
             $search_value = '';
             $search_fields = array('title', 'content');
             $search_connector = 'AND';
         }
         echo '<p class="search-box">' . "\r\n";
         echo '<label class="screen-reader-text" for="media-search-input">Search Media:</label>' . "\r\n";
         echo '<input type="text" size="45"  id="media-search-input" name="s" value="' . $search_value . '" />' . "\r\n";
         echo '<input type="submit" name="mla-search-submit" id="search-submit" class="button" value="Search Media"  /><br>' . "\r\n";
         if ('OR' == $search_connector) {
             echo '<input type="radio" name="mla_search_connector" value="AND" />&nbsp;and&nbsp;' . "\r\n";
             echo '<input type="radio" name="mla_search_connector" checked="checked" value="OR" />&nbsp;or&nbsp;' . "\r\n";
         } else {
             echo '<input type="radio" name="mla_search_connector" checked="checked" value="AND" />&nbsp;and&nbsp;' . "\r\n";
             echo '<input type="radio" name="mla_search_connector" value="OR" />&nbsp;or&nbsp;' . "\r\n";
         }
         if (in_array('title', $search_fields)) {
             echo '<input type="checkbox" name="mla_search_fields[]" id="search-title" checked="checked" value="title" />&nbsp;title&nbsp;' . "\r\n";
         } else {
             echo '<input type="checkbox" name="mla_search_fields[]" id="search-title" value="title" />&nbsp;title&nbsp;' . "\r\n";
         }
         if (in_array('name', $search_fields)) {
             echo '<input type="checkbox" name="mla_search_fields[]" id="search-name" checked="checked" value="name" />&nbsp;name&nbsp;' . "\r\n";
         } else {
             echo '<input type="checkbox" name="mla_search_fields[]" id="search-name" value="name" />&nbsp;name&nbsp;' . "\r\n";
         }
         if (in_array('alt-text', $search_fields)) {
             echo '<input type="checkbox" name="mla_search_fields[]" id="search-alt-text" checked="checked" value="alt-text" />&nbsp;ALT text&nbsp;' . "\r\n";
         } else {
             echo '<input type="checkbox" name="mla_search_fields[]" id="search-alt-text" value="alt-text" />&nbsp;ALT text&nbsp;' . "\r\n";
         }
         if (in_array('excerpt', $search_fields)) {
             echo '<input type="checkbox" name="mla_search_fields[]" id="search-excerpt" checked="checked" value="excerpt" />&nbsp;caption&nbsp;' . "\r\n";
         } else {
             echo '<input type="checkbox" name="mla_search_fields[]" id="search-excerpt" value="excerpt" />&nbsp;caption&nbsp;' . "\r\n";
         }
         if (in_array('content', $search_fields)) {
             echo '<input type="checkbox" name="mla_search_fields[]" id="search-content" checked="checked" value="content" />&nbsp;description&nbsp;' . "\r\n";
         } else {
             echo '<input type="checkbox" name="mla_search_fields[]" id="search-content" value="content" />&nbsp;description&nbsp;' . "\r\n";
         }
         echo '</p>' . "\r\n";
         /*
          * We also need to ensure that the form posts back to our current page and remember all the view arguments
          */
         echo sprintf('<input type="hidden" name="page" value="%1$s" />', $_REQUEST['page']) . "\r\n";
         $view_arguments = MLA_List_Table::mla_submenu_arguments();
         foreach ($view_arguments as $key => $value) {
             if ('meta_query' == $key) {
                 $value = stripslashes($_REQUEST['meta_query']);
             }
             /*
              * Search box elements are already set up in the above "search-box"
              */
             if (in_array($key, array('s', 'mla_search_connector', 'mla_search_fields'))) {
                 continue;
             }
             if (is_array($value)) {
                 foreach ($value as $element_key => $element_value) {
                     echo sprintf('<input type="hidden" name="%1$s[%2$s]" value="%3$s" />', $key, $element_key, esc_attr($element_value)) . "\r\n";
                 }
             } else {
                 echo sprintf('<input type="hidden" name="%1$s" value="%2$s" />', $key, esc_attr($value)) . "\r\n";
             }
         }
         //	 Now we can render the completed list table
         $MLAListTable->display();
         echo "</form><!-- id=mla-filter -->\r\n";
         /*
          * Insert the hidden form and table for inline edits (quick & bulk)
          */
         echo self::_build_inline_edit_form($MLAListTable);
         echo "<div id=\"ajax-response\"></div>\r\n";
         echo "<br class=\"clear\" />\r\n";
         echo "</div><!-- class=wrap -->\r\n";
     }
     // display attachments list
 }