Ejemplo n.º 1
0
 /**
  * Initialization function, similar to __construct()
  *
  * @since 0.60
  *
  * @return	void
  */
 public static function initialize()
 {
     MLATest::$wp_3dot5 = version_compare(get_bloginfo('version'), '3.5.0', '>=') && version_compare(get_bloginfo('version'), '3.5.99', '<=');
     MLATest::$wp_4dot3_plus = version_compare(get_bloginfo('version'), '4.2.99', '>=');
     /*
      * This is the earliest effective place to change error_reporting
      */
     MLACore::$original_php_log = ini_get('error_log');
     MLACore::$original_php_reporting = sprintf('0x%1$04X', error_reporting());
     $php_reporting = trim(MLACore::mla_get_option(MLACoreOptions::MLA_DEBUG_REPLACE_PHP_REPORTING));
     if (!empty($php_reporting)) {
         @error_reporting(0 + $php_reporting);
     }
     /*
      * This is the earliest effective place to localize values in other plugin components
      */
     MLACoreOptions::mla_localize_option_definitions_array();
     if (class_exists('MLASettings')) {
         MLASettings::mla_localize_tablist();
     }
     if (class_exists('MLAQuery')) {
         MLAQuery::mla_localize_default_columns_array();
     }
     if (class_exists('MLA_Upload_List_Table')) {
         MLA_Upload_List_Table::mla_localize_default_columns_array();
     }
     if (class_exists('MLA_Upload_Optional_List_Table')) {
         MLA_Upload_Optional_List_Table::mla_localize_default_columns_array();
     }
     if (class_exists('MLA_View_List_Table')) {
         MLA_View_List_Table::mla_localize_default_columns_array();
     }
 }
Ejemplo n.º 2
0
 /**
  * Initialization function, similar to __construct()
  *
  * @since 0.60
  *
  * @return	void
  */
 public static function initialize()
 {
     MLATest::$wp_3dot5 = version_compare(get_bloginfo('version'), '3.5.0', '>=') && version_compare(get_bloginfo('version'), '3.5.99', '<=');
     MLATest::$wp_4dot3_plus = version_compare(get_bloginfo('version'), '4.2.99', '>=');
     /*
      * This is the earliest effective place to change error_reporting
      */
     //error_reporting( E_ALL | E_STRICT | E_DEPRECATED | E_USER_DEPRECATED | E_USER_ERROR | E_USER_WARNING );
     //error_reporting( E_ALL | E_STRICT );
     MLA::$original_php_reporting = sprintf('0x%1$04X', error_reporting());
     $php_reporting = trim(MLAOptions::mla_get_option(MLAOptions::MLA_DEBUG_REPLACE_PHP_REPORTING));
     if (!empty($php_reporting)) {
         @error_reporting(0 + $php_reporting);
     }
     /*
      * This is the earliest effective place to localize values in other plugin components
      */
     MLAOptions::mla_localize_option_definitions_array();
     MLASettings::mla_localize_tablist();
     MLA_List_Table::mla_localize_default_columns_array();
     MLA_Upload_List_Table::mla_localize_default_columns_array();
     MLA_Upload_Optional_List_Table::mla_localize_default_columns_array();
     MLA_View_List_Table::mla_localize_default_columns_array();
 }
Ejemplo n.º 3
0
 /**
  * Sanitize and expand Upload MIME Type query arguments from request variables
  *
  * @since 1.40
  *
  * @param	array	query parameters from web page, usually found in $_REQUEST
  * @param	int		Optional number of rows (default 0) to skip over to reach desired page
  * @param	int		Optional number of rows on each page (0 = all rows, default)
  *
  * @return	array	revised arguments suitable for query
  */
 private static function _prepare_upload_items_query($raw_request, $offset = 0, $count = 0)
 {
     /*
      * Go through the $raw_request, take only the arguments that are used in the query and
      * sanitize or validate them.
      */
     if (!is_array($raw_request)) {
         /* translators: 1: ERROR tag 2: function name 3: non-array value */
         error_log(sprintf(_x('%1$s: %2$s non-array "%3$s"', 'error_log', 'media-library-assistant'), __('ERROR', 'media-library-assistant'), 'MLAMime::_prepare_upload_items_query', var_export($raw_request, true)), 0);
         return NULL;
     }
     $clean_request = array('mla_upload_view' => 'all', 'orderby' => 'slug', 'order' => 'ASC', 's' => '');
     foreach ($raw_request as $key => $value) {
         switch ($key) {
             case 'mla_upload_view':
                 $clean_request[$key] = $value;
                 break;
             case 'orderby':
                 if ('none' == $value) {
                     $clean_request[$key] = $value;
                 } else {
                     $sortable_columns = MLA_Upload_List_Table::mla_get_sortable_columns();
                     foreach ($sortable_columns as $sort_key => $sort_value) {
                         if ($value == $sort_value[0]) {
                             $clean_request[$key] = $value;
                             break;
                         }
                     }
                     // foreach
                 }
                 break;
             case 'order':
                 switch ($value = strtoupper($value)) {
                     case 'ASC':
                     case 'DESC':
                         $clean_request[$key] = $value;
                         break;
                     default:
                         $clean_request[$key] = 'ASC';
                 }
                 break;
                 /*
                  * ['s'] - Search Media by one or more keywords
                  */
             /*
              * ['s'] - Search Media by one or more keywords
              */
             case 's':
                 $clean_request[$key] = stripslashes(trim($value));
                 break;
             default:
                 // ignore anything else in $_REQUEST
         }
         // switch $key
     }
     // foreach $raw_request
     /*
      * Ignore incoming paged value; use offset and count instead
      */
     if ((int) $count > 0) {
         $clean_request['offset'] = $offset;
         $clean_request['posts_per_page'] = $count;
     }
     return $clean_request;
 }
 /**
  * Builds the $default_columns array with translated source texts.
  *
  * Called from MLATest::initialize because the $default_columns information might be
  * accessed from "front end" posts/pages.
  *
  * @since 1.71
  *
  * @return	void
  */
 public static function mla_localize_default_columns_array()
 {
     /*
      * Build the default columns array at runtime to accomodate calls to the localization functions
      */
     self::$default_columns = array('cb' => '<input type="checkbox" />', 'icon' => '', 'name' => _x('Extension', 'list_table_column', 'media-library-assistant'), 'mime_type' => _x('MIME Type', 'list_table_column', 'media-library-assistant'), 'icon_type' => _x('Icon Type', 'list_table_column', 'media-library-assistant'), 'source' => _x('Source', 'list_table_column', 'media-library-assistant'), 'status' => _x('Status', 'list_table_column', 'media-library-assistant'), 'core_type' => _x('WordPress Type', 'list_table_column', 'media-library-assistant'), 'mla_type' => _x('MLA Type', 'list_table_column', 'media-library-assistant'), 'standard_source' => _x('Std. Source', 'list_table_column', 'media-library-assistant'), 'core_icon_type' => _x('Std. Icon Type', 'list_table_column', 'media-library-assistant'), 'description' => _x('Description', 'list_table_column', 'media-library-assistant'));
 }
 /**
  * Load a plugin text domain
  * 
  * The "add_action" for this function is in mla-plugin-loader.php, because the "initialize"
  * function above doesn't run in time.
  * Defined as public because it's an action.
  *
  * @since 1.60
  *
  * @return	void
  */
 public static function mla_plugins_loaded_action()
 {
     $text_domain = 'media-library-assistant';
     $locale = apply_filters('mla_plugin_locale', get_locale(), $text_domain);
     /*
      * To override the plugin's translation files for one, some or all strings,
      * create a sub-directory named 'media-library-assistant' in the WordPress
      * WP_LANG_DIR (e.g., /wp-content/languages) directory.
      */
     load_textdomain($text_domain, trailingslashit(WP_LANG_DIR) . $text_domain . '/' . $text_domain . '-' . $locale . '.mo');
     load_plugin_textdomain($text_domain, false, MLA_PLUGIN_BASENAME . '/languages/');
     /*
      * Now we can localize values in other plugin components
      */
     MLAOptions::mla_localize_option_definitions_array();
     MLASettings::mla_localize_tablist();
     MLA_List_Table::mla_localize_default_columns_array();
     MLA_Upload_List_Table::mla_localize_default_columns_array();
     MLA_Upload_Optional_List_Table::mla_localize_default_columns_array();
     MLA_View_List_Table::mla_localize_default_columns_array();
 }
Ejemplo n.º 6
0
 /**
  * Compose the File Upload MIME Types tab content for the Settings subpage
  *
  * @since 1.40
  *
  * @return	array	'message' => status/error messages, 'body' => tab content
  */
 private static function _compose_upload_tab()
 {
     $page_template_array = MLAData::mla_load_template('admin-display-settings-upload-tab.tpl');
     if (!is_array($page_template_array)) {
         /* translators: 1: ERROR tag 2: function name 3: non-array value */
         error_log(sprintf(_x('%1$s: %2$s non-array "%3$s"', 'error_log', 'media-library-assistant'), __('ERROR', 'media-library-assistant'), 'MLASettings::_compose_upload_tab', var_export($page_template_array, true)), 0);
         return '';
     }
     /*
      * Untangle confusion between searching, canceling and selecting on the Optional Uploads screen
      */
     $bulk_action = self::_current_bulk_action();
     if (isset($_REQUEST['mla-optional-uploads-cancel']) || $bulk_action && $bulk_action == 'select') {
         unset($_REQUEST['mla-optional-uploads-search']);
         unset($_REQUEST['s']);
     }
     /*
      * Convert checkbox values, if present
      */
     if (isset($_REQUEST['mla_upload_item'])) {
         $_REQUEST['mla_upload_item']['disabled'] = isset($_REQUEST['mla_upload_item']['disabled']);
     }
     /*
      * Set default values, check for Add New Upload MIME Type button
      */
     $add_form_values = array('slug' => '', 'mime_type' => '', 'icon_type' => '.none.', 'disabled' => '', 'description' => '');
     if (!empty($_REQUEST['mla-upload-options-save'])) {
         check_admin_referer(MLA::MLA_ADMIN_NONCE_ACTION, MLA::MLA_ADMIN_NONCE_NAME);
         $page_content = self::_save_upload_settings();
     } elseif (!empty($_REQUEST['mla-optional-uploads-search'])) {
         check_admin_referer(MLA::MLA_ADMIN_NONCE_ACTION, MLA::MLA_ADMIN_NONCE_NAME);
         $page_content = self::_compose_optional_upload_tab($page_template_array);
     } elseif (!empty($_REQUEST['mla-optional-uploads-cancel'])) {
         $page_content = array('message' => '', 'body' => '');
     } elseif (!empty($_REQUEST['mla-optional-uploads-display'])) {
         if ('true' != $_REQUEST['mla-optional-uploads-display']) {
             check_admin_referer(MLA::MLA_ADMIN_NONCE_ACTION, MLA::MLA_ADMIN_NONCE_NAME);
             unset($_REQUEST['s']);
         }
         $page_content = self::_compose_optional_upload_tab($page_template_array);
     } elseif (!empty($_REQUEST['mla-add-upload-submit'])) {
         check_admin_referer(MLA::MLA_ADMIN_NONCE_ACTION, MLA::MLA_ADMIN_NONCE_NAME);
         $page_content = MLAMime::mla_add_upload_mime($_REQUEST['mla_upload_item']);
         if (false !== strpos($page_content['message'], __('ERROR', 'media-library-assistant'))) {
             $add_form_values = $_REQUEST['mla_upload_item'];
             $add_form_values['disabled'] = $add_form_values['disabled'] ? 'checked="checked"' : '';
         }
     } else {
         $page_content = array('message' => '', 'body' => '');
     }
     /*
      * Process bulk actions that affect an array of items
      */
     if ($bulk_action && $bulk_action != 'none') {
         if (isset($_REQUEST['cb_mla_item_ID'])) {
             if ('select' == $bulk_action) {
                 foreach ($_REQUEST['cb_mla_item_ID'] as $ID) {
                     $item_content = MLASettings::_process_optional_upload_mime($ID);
                     $page_content['message'] .= $item_content['message'] . '<br>';
                 }
             } else {
                 /*
                  * Convert post-ID to slug; separate loop required because delete changes post_IDs
                  */
                 $slugs = array();
                 foreach ($_REQUEST['cb_mla_item_ID'] as $post_ID) {
                     $slugs[] = MLAMime::mla_get_upload_mime_slug($post_ID);
                 }
                 foreach ($slugs as $slug) {
                     switch ($bulk_action) {
                         case 'delete':
                             $item_content = MLAMime::mla_delete_upload_mime($slug);
                             break;
                         case 'edit':
                             $request = array('slug' => $slug);
                             if ('-1' != $_REQUEST['disabled']) {
                                 $request['disabled'] = '1' == $_REQUEST['disabled'];
                             }
                             if ('.none.' != $_REQUEST['icon_type']) {
                                 $request['icon_type'] = $_REQUEST['icon_type'];
                             }
                             $item_content = MLAMime::mla_update_upload_mime($request);
                             break;
                         default:
                             $item_content = array('message' => sprintf(__('Unknown bulk action %1$s', 'media-library-assistant'), $bulk_action), 'body' => '');
                     }
                     // switch $bulk_action
                     $page_content['message'] .= $item_content['message'] . '<br>';
                 }
                 // foreach cb_attachment
             }
             // != select
         } else {
             /* translators: 1: action name, e.g., edit */
             $page_content['message'] = sprintf(__('Bulk Action %1$s - no items selected.', 'media-library-assistant'), $bulk_action);
         }
     }
     // $bulk_action
     /*
      * Process row-level actions that affect a single item
      */
     if (!empty($_REQUEST['mla_admin_action'])) {
         check_admin_referer(MLA::MLA_ADMIN_NONCE_ACTION, MLA::MLA_ADMIN_NONCE_NAME);
         switch ($_REQUEST['mla_admin_action']) {
             case MLA::MLA_ADMIN_SINGLE_DELETE:
                 $page_content = MLAMime::mla_delete_upload_mime($_REQUEST['mla_item_slug']);
                 break;
             case MLA::MLA_ADMIN_SINGLE_EDIT_DISPLAY:
                 $view = MLAMime::mla_get_upload_mime($_REQUEST['mla_item_slug']);
                 $page_content = self::_compose_edit_upload_tab($view, $page_template_array);
                 break;
             case MLA::MLA_ADMIN_SINGLE_EDIT_UPDATE:
                 if (!empty($_REQUEST['update'])) {
                     $page_content = MLAMime::mla_update_upload_mime($_REQUEST['mla_upload_item']);
                     if (false !== strpos($page_content['message'], __('ERROR', 'media-library-assistant'))) {
                         $message = $page_content['message'];
                         $page_content = self::_compose_edit_upload_tab($_REQUEST['mla_upload_item'], $page_template_array);
                         $page_content['message'] = $message;
                     }
                 } elseif (!empty($_REQUEST['mla_item_ID'])) {
                     $page_content = self::_process_optional_upload_mime($_REQUEST['mla_item_ID']);
                 } else {
                     $page_content = array('message' => sprintf(__('Edit view "%1$s" cancelled.', 'media-library-assistant'), $_REQUEST['mla_upload_item']['original_slug']), 'body' => '');
                 }
                 break;
             default:
                 $page_content = array('message' => sprintf(__('Unknown mla_admin_action - "%1$s"', 'media-library-assistant'), $_REQUEST['mla_admin_action']), 'body' => '');
                 break;
         }
         // switch ($_REQUEST['mla_admin_action'])
     }
     // (!empty($_REQUEST['mla_admin_action'])
     if (!empty($page_content['body'])) {
         return $page_content;
     }
     /*
      * Check for disabled status
      */
     if ('checked' != MLAOptions::mla_get_option(MLAOptions::MLA_ENABLE_UPLOAD_MIMES)) {
         /*
          * Fill in with any page-level options
          */
         $options_list = '';
         foreach (MLAOptions::$mla_option_definitions as $key => $value) {
             if ('upload' == $value['tab']) {
                 $options_list .= self::mla_compose_option_row($key, $value);
             }
         }
         $page_values = array('Support is disabled' => __('Upload MIME Type Support is disabled', 'media-library-assistant'), 'form_url' => admin_url('options-general.php') . '?page=mla-settings-menu-upload&mla_tab=upload', 'options_list' => $options_list, 'Save Changes' => __('Save Changes', 'media-library-assistant'), '_wpnonce' => wp_nonce_field(MLA::MLA_ADMIN_NONCE_ACTION, MLA::MLA_ADMIN_NONCE_NAME, true, false));
         $page_content['body'] .= MLAData::mla_parse_template($page_template_array['upload-disabled'], $page_values);
         return $page_content;
     }
     /*
      * Display the Upload MIME Types Table
      */
     $_SERVER['REQUEST_URI'] = remove_query_arg(array('mla_admin_action', 'mla_item_slug', 'mla_item_ID', '_wpnonce', '_wp_http_referer', 'action', 'action2', 'cb_mla_item_ID', 'mla-optional-uploads-search'), $_SERVER['REQUEST_URI']);
     //	Create an instance of our package class
     $MLAListUploadTable = new MLA_Upload_List_Table();
     //	Fetch, prepare, sort, and filter our data
     $MLAListUploadTable->prepare_items();
     /*
      * Start with any page-level options
      */
     $options_list = '';
     foreach (MLAOptions::$mla_option_definitions as $key => $value) {
         if ('upload' == $value['tab']) {
             $options_list .= self::mla_compose_option_row($key, $value);
         }
     }
     $page_values = array('File Extension Processing' => __('File Extension and MIME Type Processing', 'media-library-assistant'), 'In this tab' => __('In this tab you can manage the list of file extension/MIME Type associations, which are used by WordPress to decide what kind of files can be uploaded to the Media Library and to fill in the <strong><em>post_mime_type</em></strong> value. To upload a file, the file extension must be in this list and be active.', 'media-library-assistant'), 'You can find' => sprintf(__('You can find more information about file extensions, MIME types and how WordPress uses them in the %1$s section of the Documentation or by clicking the <strong>"Help"</strong> tab in the upper-right corner of this screen.', 'media-library-assistant'), '<a href="[+settingsURL+]?page=mla-settings-menu-documentation&amp;mla_tab=documentation#mla_uploads" title="' . __('File Extension Processing documentation', 'media-library-assistant') . '">' . __('File Extension and MIME Type Processing', 'media-library-assistant') . '</a>'), 'settingsURL' => admin_url('options-general.php'), 'Search Uploads' => __('Search Uploads', 'media-library-assistant'), 'To search by' => __('To search by extension, use ".", e.g., ".doc"', 'media-library-assistant'), 'form_url' => admin_url('options-general.php') . '?page=mla-settings-menu-upload&mla_tab=upload', '_wpnonce' => wp_nonce_field(MLA::MLA_ADMIN_NONCE_ACTION, MLA::MLA_ADMIN_NONCE_NAME, true, false), 'options_list' => $options_list, 'Save Changes' => __('Save Changes', 'media-library-assistant'), 'Add New Upload' => sprintf(__('Add New %1$s', 'media-library-assistant'), __('Upload MIME Type', 'media-library-assistant')), 'To search database' => __('To search the database of over 1,500 known extension/type associations, click "Search Known Types" below the form.', 'media-library-assistant'), 'Extension' => __('Extension', 'media-library-assistant'), 'The extension is' => __('The &#8220;extension&#8221; is the file extension for this type, and unique key for the item. It must be all lowercase and contain only letters and numbers.', 'media-library-assistant'), 'MIME Type' => __('MIME Type', 'media-library-assistant'), 'The MIME Type' => __('The MIME Type must be all lowercase and contain only letters, numbers, periods (.), slashes (/) and hyphens (-). It <strong>must be a valid MIME</strong> type, e.g., &#8220;image&#8221; or &#8220;image/jpeg&#8221;.', 'media-library-assistant'), 'Icon Type' => __('Icon Type', 'media-library-assistant'), 'The Icon Type' => __('The Icon Type selects a thumbnail image displayed for non-image file types, such as PDF documents.', 'media-library-assistant'), 'Inactive' => __('Inactive', 'media-library-assistant'), 'Check this box' => __('Check this box if you want to remove this entry from the list of Upload MIME Types returned by get_allowed_mime_types().', 'media-library-assistant'), 'Description' => __('Description', 'media-library-assistant'), 'The description can' => __('The description can contain any documentation or notes you need to understand or use the item.', 'media-library-assistant'), 'Add Upload MIME' => __('Add Upload MIME Type', 'media-library-assistant'), 'search_url' => wp_nonce_url('?page=mla-settings-menu-upload&mla_tab=upload&mla-optional-uploads-search=Search', MLA::MLA_ADMIN_NONCE_ACTION, MLA::MLA_ADMIN_NONCE_NAME), 'Search Known Types' => __('Search Known Types', 'media-library-assistant'), 'colspan' => $MLAListUploadTable->get_column_count(), 'Quick Edit' => __('<strong>Quick Edit</strong>', 'media-library-assistant'), 'Cancel' => __('Cancel', 'media-library-assistant'), 'Update' => __('Update', 'media-library-assistant'), 'Bulk Edit' => __('Bulk Edit', 'media-library-assistant'), 'Status' => __('Status', 'media-library-assistant'), 'No Change' => __('No Change', 'media-library-assistant'), 'Active' => __('Active', 'media-library-assistant'), 'results' => !empty($_REQUEST['s']) ? '<h2 class="alignleft">' . __('Displaying search results for', 'media-library-assistant') . ': "' . $_REQUEST['s'] . '"</h2>' : '', 's' => isset($_REQUEST['s']) ? $_REQUEST['s'] : '', 'icon_types' => self::mla_get_icon_type_dropdown($page_template_array, 'mla_upload_item[icon_type]'), 'inline_icon_types' => self::mla_get_icon_type_dropdown($page_template_array, 'icon_type'), 'bulk_icon_types' => self::mla_get_icon_type_dropdown($page_template_array, 'icon_type', '.nochange.'));
     foreach ($add_form_values as $key => $value) {
         $page_values[$key] = $value;
     }
     $page_content['body'] = MLAData::mla_parse_template($page_template_array['before-table'], $page_values);
     //	 Now we can render the completed list table
     ob_start();
     $MLAListUploadTable->views();
     $MLAListUploadTable->display();
     $page_content['body'] .= ob_get_contents();
     ob_end_clean();
     $page_content['body'] .= MLAData::mla_parse_template($page_template_array['after-table'], $page_values);
     return $page_content;
 }
Ejemplo n.º 7
0
 /**
  * Compose the File Upload MIME Types tab content for the Settings subpage
  *
  * @since 1.40
  *
  * @return	array	'message' => status/error messages, 'body' => tab content
  */
 private static function _compose_upload_tab()
 {
     $page_template_array = MLAData::mla_load_template(MLA_PLUGIN_PATH . 'tpls/admin-display-settings-upload-tab.tpl');
     if (!array($page_template_array)) {
         error_log('ERROR: MLASettings::_compose_upload_tab $page_template_array = ' . var_export($page_template_array, true), 0);
         return '';
     }
     /*
      * Untangle confusion between searching, canceling and selecting on the Optional Uploads screen
      */
     $bulk_action = self::_current_bulk_action();
     if (isset($_REQUEST['mla-optional-uploads-cancel']) || $bulk_action && $bulk_action == 'select') {
         unset($_REQUEST['mla-optional-uploads-search']);
         unset($_REQUEST['s']);
     }
     /*
      * Convert checkbox values, if present
      */
     if (isset($_REQUEST['mla_upload_item'])) {
         $_REQUEST['mla_upload_item']['disabled'] = isset($_REQUEST['mla_upload_item']['disabled']);
     }
     /*
      * Set default values, check for Add New Post MIME Type View button
      */
     $add_form_values = array('slug' => '', 'mime_type' => '', 'icon_type' => '.none.', 'disabled' => '', 'description' => '');
     if (!empty($_REQUEST['mla-upload-options-save'])) {
         check_admin_referer(MLA::MLA_ADMIN_NONCE, '_wpnonce');
         $page_content = self::_save_upload_settings();
     } elseif (!empty($_REQUEST['mla-optional-uploads-search'])) {
         check_admin_referer(MLA::MLA_ADMIN_NONCE, '_wpnonce');
         $page_content = self::_compose_optional_upload_tab($page_template_array);
     } elseif (!empty($_REQUEST['mla-optional-uploads-cancel'])) {
         $page_content = array('message' => '', 'body' => '');
     } elseif (!empty($_REQUEST['mla-optional-uploads-display'])) {
         if ('true' != $_REQUEST['mla-optional-uploads-display']) {
             check_admin_referer(MLA::MLA_ADMIN_NONCE, '_wpnonce');
             unset($_REQUEST['s']);
         }
         $page_content = self::_compose_optional_upload_tab($page_template_array);
     } elseif (!empty($_REQUEST['mla-add-upload-submit'])) {
         check_admin_referer(MLA::MLA_ADMIN_NONCE, '_wpnonce');
         $page_content = MLAMime::mla_add_upload_mime($_REQUEST['mla_upload_item']);
         if (false !== strpos($page_content['message'], 'ERROR:')) {
             $add_form_values = $_REQUEST['mla_upload_item'];
             $add_form_values['disabled'] = $add_form_values['disabled'] ? 'checked="checked"' : '';
         }
     } else {
         $page_content = array('message' => '', 'body' => '');
     }
     /*
      * Process bulk actions that affect an array of items
      */
     if ($bulk_action && $bulk_action != 'none') {
         if (isset($_REQUEST['cb_mla_item_ID'])) {
             if ('select' == $bulk_action) {
                 foreach ($_REQUEST['cb_mla_item_ID'] as $ID) {
                     $item_content = MLASettings::_process_optional_upload_mime($ID);
                     $page_content['message'] .= $item_content['message'] . '<br>';
                 }
             } else {
                 /*
                  * Convert post-ID to slug; separate loop required because delete changes post_IDs
                  */
                 $slugs = array();
                 foreach ($_REQUEST['cb_mla_item_ID'] as $post_ID) {
                     $slugs[] = MLAMime::mla_get_upload_mime_slug($post_ID);
                 }
                 foreach ($slugs as $slug) {
                     switch ($bulk_action) {
                         case 'delete':
                             $item_content = MLAMime::mla_delete_upload_mime($slug);
                             break;
                         case 'edit':
                             $request = array('slug' => $slug);
                             if ('-1' != $_REQUEST['disabled']) {
                                 $request['disabled'] = '1' == $_REQUEST['disabled'];
                             }
                             if ('.none.' != $_REQUEST['icon_type']) {
                                 $request['icon_type'] = $_REQUEST['icon_type'];
                             }
                             $item_content = MLAMime::mla_update_upload_mime($request);
                             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
             }
             // != select
         } else {
             $page_content['message'] = 'Bulk Action ' . $bulk_action . ' - no items selected.';
         }
     }
     // $bulk_action
     /*
      * Process row-level actions that affect a single item
      */
     if (!empty($_REQUEST['mla_admin_action'])) {
         check_admin_referer(MLA::MLA_ADMIN_NONCE);
         switch ($_REQUEST['mla_admin_action']) {
             case MLA::MLA_ADMIN_SINGLE_DELETE:
                 $page_content = MLAMime::mla_delete_upload_mime($_REQUEST['mla_item_slug']);
                 break;
             case MLA::MLA_ADMIN_SINGLE_EDIT_DISPLAY:
                 $view = MLAMime::mla_get_upload_mime($_REQUEST['mla_item_slug']);
                 $page_content = self::_compose_edit_upload_tab($view, $page_template_array);
                 break;
             case MLA::MLA_ADMIN_SINGLE_EDIT_UPDATE:
                 if (!empty($_REQUEST['update'])) {
                     $page_content = MLAMime::mla_update_upload_mime($_REQUEST['mla_upload_item']);
                     if (false !== strpos($page_content['message'], 'ERROR:')) {
                         $message = $page_content['message'];
                         $page_content = self::_compose_edit_upload_tab($_REQUEST['mla_upload_item'], $page_template_array);
                         $page_content['message'] = $message;
                     }
                 } elseif (!empty($_REQUEST['mla_item_ID'])) {
                     $page_content = self::_process_optional_upload_mime($_REQUEST['mla_item_ID']);
                 } else {
                     $page_content = array('message' => 'Edit view "' . $_REQUEST['mla_upload_item']['original_slug'] . '" cancelled.', 'body' => '');
                 }
                 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'])) {
         return $page_content;
     }
     /*
      * Check for disabled status
      */
     if ('checked' != MLAOptions::mla_get_option(MLAOptions::MLA_ENABLE_UPLOAD_MIMES)) {
         /*
          * Fill in with any page-level options
          */
         $options_list = '';
         foreach (MLAOptions::$mla_option_definitions as $key => $value) {
             if ('upload' == $value['tab']) {
                 $options_list .= self::_compose_option_row($key, $value);
             }
         }
         $page_values = array('settingsURL' => admin_url('options-general.php'), 'options_list' => $options_list, '_wpnonce' => wp_nonce_field(MLA::MLA_ADMIN_NONCE, '_wpnonce', true, false), 'form_url' => admin_url('options-general.php') . '?page=mla-settings-menu-upload&mla_tab=upload');
         $page_content['body'] .= MLAData::mla_parse_template($page_template_array['upload-disabled'], $page_values);
         return $page_content;
     }
     /*
      * Display the Upload MIME Types Table
      */
     $_SERVER['REQUEST_URI'] = remove_query_arg(array('mla_admin_action', 'mla_item_slug', 'mla_item_ID', '_wpnonce', '_wp_http_referer', 'action', 'action2', 'cb_mla_item_ID', 'mla-optional-uploads-search'), $_SERVER['REQUEST_URI']);
     //	Create an instance of our package class
     $MLAListUploadTable = new MLA_Upload_List_Table();
     //	Fetch, prepare, sort, and filter our data
     $MLAListUploadTable->prepare_items();
     /*
      * Start with any page-level options
      */
     $options_list = '';
     foreach (MLAOptions::$mla_option_definitions as $key => $value) {
         if ('upload' == $value['tab']) {
             $options_list .= self::_compose_option_row($key, $value);
         }
     }
     $page_values = array('settingsURL' => admin_url('options-general.php'), 'options_list' => $options_list, 'colspan' => count($MLAListUploadTable->get_columns()), '_wpnonce' => wp_nonce_field(MLA::MLA_ADMIN_NONCE, '_wpnonce', true, false), 'form_url' => admin_url('options-general.php') . '?page=mla-settings-menu-upload&mla_tab=upload', 'results' => !empty($_REQUEST['s']) ? '<h3 style="float:left">Displaying search results for: "' . $_REQUEST['s'] . '"</h3>' : '', 's' => isset($_REQUEST['s']) ? $_REQUEST['s'] : '', 'icon_types' => self::mla_get_icon_type_dropdown($page_template_array, 'mla_upload_item[icon_type]'), 'inline_icon_types' => self::mla_get_icon_type_dropdown($page_template_array, 'icon_type'), 'bulk_icon_types' => self::mla_get_icon_type_dropdown($page_template_array, 'icon_type', '.nochange.'), 'search_url' => wp_nonce_url('?page=mla-settings-menu-upload&mla_tab=upload&mla-optional-uploads-search=Search', MLA::MLA_ADMIN_NONCE));
     foreach ($add_form_values as $key => $value) {
         $page_values[$key] = $value;
     }
     $page_content['body'] = MLAData::mla_parse_template($page_template_array['before-table'], $page_values);
     //	 Now we can render the completed list table
     ob_start();
     $MLAListUploadTable->views();
     $MLAListUploadTable->display();
     $page_content['body'] .= ob_get_contents();
     ob_end_clean();
     $page_content['body'] .= MLAData::mla_parse_template($page_template_array['after-table'], $page_values);
     return $page_content;
 }