function wpuxss_eml_print_settings() { if (!current_user_can('manage_options')) { wp_die(__('You do not have sufficient permissions to access this page.', 'eml')); } ?> <div id="wpuxss-eml-global-options-wrap" class="wrap"> <h2><?php _e('Enhanced Media Library Settings', 'eml'); ?> </h2> <?php //settings_errors( 'wpuxss_eml_pro_updates' ); ?> <div id="poststuff"> <div id="post-body" class="metabox-holder columns-2"> <div id="postbox-container-2" class="postbox-container"> <div class="postbox"> <h3 class="hndle"><?php _e('Export', 'eml'); ?> </h3> <div class="inside"> <p><?php _e('The plugin settings <strong>Media Settings > Taxonomies</strong> and <strong>Media Settings > MIME Types</strong> will be exported to a configuration file. It allows you to easily import the configuration into another website.', 'eml'); ?> </p> <form method="post"> <?php wp_nonce_field('eml_settings_export_nonce', 'eml-settings-export-nonce'); ?> <?php submit_button(__('Export Plugin Settings', 'eml'), 'primary', 'eml-settings-export'); ?> </form> </div> </div> <div class="postbox"> <h3 class="hndle"><?php _e('Import', 'eml'); ?> </h3> <div class="inside"> <p><?php _e('The plugin settings <strong>Media Settings > Taxonomies</strong> and <strong>Media Settings > MIME Types</strong> will be imported from a configuration file which can be obtained by exporting the settings on another website using the export button above.', 'eml'); ?> </p> <p><?php _e('All plugin settings will be overriden by the import. You will have a chance to restore current data from an automatic backup in case you are not satisfied with the result of the import.', 'eml'); ?> </p> <form method="post" enctype="multipart/form-data"> <p><input type="file" name="import_file"/></p> <?php wp_nonce_field('eml_settings_import_nonce', 'eml-settings-import-nonce'); ?> <?php submit_button(__('Import Plugin Settings', 'eml'), 'primary', 'eml-settings-import'); ?> </form> </div> </div> <?php $wpuxss_eml_backup = get_option('wpuxss_eml_backup'); ?> <div class="postbox"> <h3 class="hndle"><?php _e('Restore', 'eml'); ?> </h3> <div class="inside"> <?php if (empty($wpuxss_eml_backup)) { ?> <p><?php _e('No backup available at the moment.', 'eml'); ?> </p> <p><?php _e('Backup will be created automatically before any import operation.', 'eml'); ?> </p> <?php } else { ?> <p><?php _e('The backup had been automatically created before the latest import opetarion.', 'eml'); ?> </p> <form method="post"> <?php wp_nonce_field('eml_settings_restore_nonce', 'eml-settings-restore-nonce'); ?> <?php submit_button(__('Restore Settings from the Backup', 'eml'), 'primary', 'eml-settings-restore'); ?> </form> <?php } ?> </div> </div> <?php do_action('wpuxss_eml_extend_settings_page'); ?> </div> <div id="postbox-container-1" class="postbox-container"> <?php wpuxss_eml_print_credits(); ?> </div> </div> </div> </div> <?php }
function wpuxss_eml_print_mimetypes_options() { if (!current_user_can('manage_options')) { wp_die(__('You do not have sufficient permissions to access this page.', 'eml')); } $wpuxss_eml_mimes = get_option('wpuxss_eml_mimes'); $wpuxss_eml_mimes_backup = get_option('wpuxss_eml_mimes_backup'); ?> <div id="wpuxss-eml-global-options-wrap" class="wrap"> <?php screen_icon('options-general'); ?> <h2> <?php _e('MIME Types', 'eml'); ?> <a class="add-new-h2 wpuxss-eml-button-create-mime" href="javascript:;">+ <?php _e('Add New MIME Type', 'eml'); ?> </a> </h2> <?php settings_errors(); ?> <div id="poststuff"> <div id="post-body" class="metabox-holder columns-2"> <div id="postbox-container-2" class="postbox-container"> <form method="post" action="options.php" id="wpuxss-eml-form-mimetypes"> <?php settings_fields('wpuxss_eml_mimes'); ?> <table class="wpuxss-eml-mime-type-list wp-list-table widefat" cellspacing="0"> <thead> <tr> <th scope="col" class="manage-column wpuxss-eml-column-extension"><?php _e('Extension', 'eml'); ?> </th> <th scope="col" class="manage-column wpuxss-eml-column-mime"><?php _e('MIME Type', 'eml'); ?> </th> <th scope="col" class="manage-column wpuxss-eml-column-singular"><?php _e('Singular Label', 'eml'); ?> </th> <th scope="col" class="manage-column wpuxss-eml-column-plural"><?php _e('Plural Label', 'eml'); ?> </th> <th scope="col" class="manage-column wpuxss-eml-column-filter"><?php _e('Add Filter', 'eml'); ?> </th> <th scope="col" class="manage-column wpuxss-eml-column-upload"><?php _e('Allow Upload', 'eml'); ?> </th> <th scope="col" class="manage-column wpuxss-eml-column-delete"></th> </tr> </thead> <tbody> <?php $allowed_mimes = get_allowed_mime_types(); $all_mimes = wp_get_mime_types(); ksort($all_mimes, SORT_STRING); foreach ($all_mimes as $type => $mime) { if (isset($wpuxss_eml_mimes[$type])) { $label = '<code>' . str_replace('|', '</code>, <code>', $type) . '</code>'; $allowed = false; if (array_key_exists($type, $allowed_mimes)) { $allowed = true; } ?> <tr> <td id="<?php echo $type; ?> "><?php echo $label; ?> </td> <td><code><?php echo $mime; ?> </code><input type="hidden" class="wpuxss-eml-mime" name="wpuxss_eml_mimes[<?php echo $type; ?> ][mime]" value="<?php echo $wpuxss_eml_mimes[$type]['mime']; ?> " /></td> <td><input type="text" name="wpuxss_eml_mimes[<?php echo $type; ?> ][singular]" value="<?php echo esc_html($wpuxss_eml_mimes[$type]['singular']); ?> " /></td> <td><input type="text" name="wpuxss_eml_mimes[<?php echo $type; ?> ][plural]" value="<?php echo esc_html($wpuxss_eml_mimes[$type]['plural']); ?> " /></td> <td class="checkbox_td"><input type="checkbox" name="wpuxss_eml_mimes[<?php echo $type; ?> ][filter]" title="<?php _e('Add Filter', 'eml'); ?> " value="1" <?php checked(1, $wpuxss_eml_mimes[$type]['filter']); ?> /></td> <td class="checkbox_td"><input type="checkbox" name="wpuxss_eml_mimes[<?php echo $type; ?> ][upload]" title="<?php _e('Allow Upload', 'eml'); ?> " value="1" <?php checked(true, $allowed); ?> /></td> <td><a class="wpuxss-eml-button-remove" title="Delete MIME Type" href="javascript:;">–</a></td> </tr> <?php } } ?> <tr class="wpuxss-eml-clone" style="display:none;"> <td><input type="text" class="wpuxss-eml-type" placeholder="jpg|jpeg|jpe" /></td> <td><input type="text" class="wpuxss-eml-mime" placeholder="image/jpeg" /></td> <td><input type="text" class="wpuxss-eml-singular" placeholder="Image" /></td> <td><input type="text" class="wpuxss-eml-plural" placeholder="Images" /></td> <td class="checkbox_td"><input type="checkbox" class="wpuxss-eml-filter" title="<?php _e('Add Filter', 'eml'); ?> " value="1" /></td> <td class="checkbox_td"><input type="checkbox" class="wpuxss-eml-upload" title="<?php _e('Allow Upload', 'eml'); ?> " value="1" /></td> <td><a class="wpuxss-eml-button-remove" title="<?php _e('Delete MIME Type', 'eml'); ?> " href="javascript:;">–</a></td> </tr> </tbody> <tfoot> <tr> <th scope="col" class="manage-column wpuxss-eml-column-extension"><?php _e('Extension', 'eml'); ?> </th> <th scope="col" class="manage-column wpuxss-eml-column-mime"><?php _e('MIME Type', 'eml'); ?> </th> <th scope="col" class="manage-column wpuxss-eml-column-singular"><?php _e('Singular Label', 'eml'); ?> </th> <th scope="col" class="manage-column wpuxss-eml-column-plural"><?php _e('Plural Label', 'eml'); ?> </th> <th scope="col" class="manage-column wpuxss-eml-column-filter"><?php _e('Add Filter', 'eml'); ?> </th> <th scope="col" class="manage-column wpuxss-eml-column-upload"><?php _e('Allow Upload', 'eml'); ?> </th> <th scope="col" class="manage-column wpuxss-eml-column-delete"></th> </tr> </tfoot> </table> <?php submit_button(__('Restore default MIME Types', 'eml'), 'secondary', 'wpuxss_eml_restore_mimes_backup'); ?> <?php submit_button(); ?> </form> </div> <div id="postbox-container-1" class="postbox-container"> <?php wpuxss_eml_print_credits(); ?> </div> </div> </div> </div> <?php }
function wpuxss_eml_print_settings() { if (!current_user_can('manage_options')) { wp_die(__('You do not have sufficient permissions to access this page.', 'enhanced-media-library')); } ?> <div id="wpuxss-eml-global-options-wrap" class="wrap"> <h2><?php _e('Enhanced Media Library Settings', 'enhanced-media-library'); ?> </h2> <div id="poststuff"> <div id="post-body" class="metabox-holder columns-2"> <div id="postbox-container-2" class="postbox-container"> <div class="postbox"> <h3 class="hndle"><?php _e('Export', 'enhanced-media-library'); ?> </h3> <div class="inside"> <p><?php _e('Plugin settings tabs <strong>Media Library</strong>, <strong>Media Taxonomies</strong>, and <strong>MIME Types</strong> will be exported to a configuration file. It allows you to easily import the configuration into another website.', 'enhanced-media-library'); ?> </p> <form method="post"> <?php wp_nonce_field('eml_settings_export_nonce', 'eml-settings-export-nonce'); ?> <?php submit_button(__('Export Plugin Settings', 'enhanced-media-library'), 'primary', 'eml-settings-export'); ?> </form> </div> </div> <div class="postbox"> <h3 class="hndle"><?php _e('Import', 'enhanced-media-library'); ?> </h3> <div class="inside"> <p><?php _e('Plugin settings tabs <strong>Media Library</strong>, <strong>Media Taxonomies</strong>, and <strong>MIME Types</strong> will be imported from a configuration file which can be obtained by exporting the settings on another website using the export button above.', 'enhanced-media-library'); ?> </p> <p><?php _e('All plugin settings will be overridden by the import. You will have a chance to restore current data from an automatic backup in case you are not satisfied with the result of the import.', 'enhanced-media-library'); ?> </p> <form method="post" enctype="multipart/form-data"> <p><input type="file" name="import_file"/></p> <?php wp_nonce_field('eml_settings_import_nonce', 'eml-settings-import-nonce'); ?> <?php submit_button(__('Import Plugin Settings', 'enhanced-media-library'), 'primary', 'eml-settings-import'); ?> </form> </div> </div> <?php $wpuxss_eml_backup = get_option('wpuxss_eml_backup'); ?> <div class="postbox"> <h3 class="hndle"><?php _e('Restore', 'enhanced-media-library'); ?> </h3> <div class="inside"> <?php if (empty($wpuxss_eml_backup)) { ?> <p><?php _e('No backup available at the moment.', 'enhanced-media-library'); ?> </p> <p><?php _e('Backup will be created automatically before any import operation.', 'enhanced-media-library'); ?> </p> <?php } else { ?> <p><?php _e('The backup has been automatically created before the latest import operation.', 'enhanced-media-library'); ?> </p> <form method="post"> <?php wp_nonce_field('eml_settings_restore_nonce', 'eml-settings-restore-nonce'); ?> <?php submit_button(__('Restore Settings from the Backup', 'enhanced-media-library'), 'primary', 'eml-settings-restore'); ?> </form> <?php } ?> </div> </div> <div class="postbox"> <h3 class="hndle"><?php _e('Complete Cleanup', 'enhanced-media-library'); ?> </h3> <div class="inside"> <?php $wpuxss_eml_taxonomies = wpuxss_eml_get_eml_taxonomies(); ?> <ul> <li><strong><?php _e('What will be deleted:', 'enhanced-media-library'); ?> </strong></li> <?php foreach ((array) $wpuxss_eml_taxonomies as $taxonomy => $params) { ?> <li><?php _e('All', 'enhanced-media-library'); echo ' ' . $params['labels']['name']; ?> </li> <?php } ?> <li><?php _e('All plugin options', 'enhanced-media-library'); ?> </li> <li><?php _e('All plugin backups stored in database', 'enhanced-media-library'); ?> </li> </ul> <ul> <li><strong><?php _e('What will remain intact:', 'enhanced-media-library'); ?> </strong></li> <li><?php _e('All media items', 'enhanced-media-library'); ?> </li> <li><?php _e('All taxonomies not listed above', 'enhanced-media-library'); ?> </li> </ul> <p><?php _e('The plugin cannot delete itself because of security reason. Please delete it manually from plugin list after cleanup.', 'enhanced-media-library'); ?> </p> <p><strong style="color:red;"><?php _e('If you are not sure about this operation please create a backup of your database prior to cleanup!', 'enhanced-media-library'); ?> </strong></p> <form id="eml-form-cleanup" method="post"> <input type='hidden' name='eml-settings-cleanup' /> <?php wp_nonce_field('eml_settings_cleanup_nonce', 'eml-settings-cleanup-nonce'); ?> <?php submit_button(__('Delete All Data & Deactivate', 'enhanced-media-library'), 'primary', 'eml-settings-cleanup'); ?> </form> </div> </div> <?php do_action('wpuxss_eml_extend_settings_page'); ?> </div> <div id="postbox-container-1" class="postbox-container"> <?php wpuxss_eml_print_credits(); ?> </div> </div> </div> </div> <?php }