plugin_name = $plugin_name; $this->version = $version; } /** * Register the stylesheets for the admin area. * * @since 1.0.0 */ public function enqueue_styles() { // Only load on plugin admin pages $screen = get_current_screen(); if (strpos($screen->id, 'qdr-temporary-shared-storage') === false) { return; } wp_enqueue_style( $this->plugin_name . '-admin', plugin_dir_url(dirname(__FILE__)) . 'admin/css/admin.css', array(), $this->version, 'all' ); // Add jQuery UI styles for datepicker wp_enqueue_style('jquery-ui-datepicker'); } /** * Register the JavaScript for the admin area. * * @since 1.0.0 */ public function enqueue_scripts() { // Only load on plugin admin pages $screen = get_current_screen(); if (strpos($screen->id, 'qdr-temporary-shared-storage') === false) { return; } wp_enqueue_script( $this->plugin_name . '-admin', plugin_dir_url(dirname(__FILE__)) . 'admin/js/admin.js', array('jquery', 'jquery-ui-datepicker'), $this->version, true ); // Localize script with translations and data wp_localize_script($this->plugin_name . '-admin', 'qdr_tss', array( 'ajaxurl' => admin_url('admin-ajax.php'), 'nonce' => wp_create_nonce('qdr_tss_nonce'), 'strings' => array( 'loading' => __('Loading...', 'qdr-temporary-shared-storage'), 'saving' => __('Saving...', 'qdr-temporary-shared-storage'), 'no_items' => __('No items', 'qdr-temporary-shared-storage'), 'no_items_found' => __('No items found.', 'qdr-temporary-shared-storage'), 'showing' => __('Showing', 'qdr-temporary-shared-storage'), 'of' => __('of', 'qdr-temporary-shared-storage'), 'first_page' => __('First Page', 'qdr-temporary-shared-storage'), 'previous_page' => __('Previous Page', 'qdr-temporary-shared-storage'), 'next_page' => __('Next Page', 'qdr-temporary-shared-storage'), 'last_page' => __('Last Page', 'qdr-temporary-shared-storage'), 'view_details' => __('View Details', 'qdr-temporary-shared-storage'), 'edit' => __('Edit', 'qdr-temporary-shared-storage'), 'delete' => __('Delete', 'qdr-temporary-shared-storage'), 'copy_permalink' => __('Copy Permalink', 'qdr-temporary-shared-storage'), 'force_activate' => __('Force Activate', 'qdr-temporary-shared-storage'), 'confirm_delete' => __('Are you sure you want to delete this file?', 'qdr-temporary-shared-storage'), 'confirm_purge' => __('Are you sure you want to purge all expired files?', 'qdr-temporary-shared-storage'), 'confirm_force_activate' => __('Are you sure you want to force activate this file? This will reset the active period starting from now.', 'qdr-temporary-shared-storage'), 'error_loading_items' => __('Error loading items.', 'qdr-temporary-shared-storage'), 'error_loading_items_try_again' => __('Error loading items. Please try again.', 'qdr-temporary-shared-storage'), 'error_loading_item_details' => __('Error loading item details.', 'qdr-temporary-shared-storage'), 'error_loading_item_details_try_again' => __('Error loading item details. Please try again.', 'qdr-temporary-shared-storage'), 'changes_saved' => __('Changes saved successfully.', 'qdr-temporary-shared-storage'), 'error_saving_changes' => __('Error saving changes.', 'qdr-temporary-shared-storage'), 'error_saving_changes_try_again' => __('Error saving changes. Please try again.', 'qdr-temporary-shared-storage'), 'file_deleted' => __('File deleted successfully.', 'qdr-temporary-shared-storage'), 'error_deleting_file' => __('Error deleting file.', 'qdr-temporary-shared-storage'), 'error_deleting_file_try_again' => __('Error deleting file. Please try again.', 'qdr-temporary-shared-storage'), 'shortcode_copied' => __('Shortcode copied to clipboard.', 'qdr-temporary-shared-storage'), 'permalink_copied' => __('Permalink copied to clipboard.', 'qdr-temporary-shared-storage'), 'permalink_copied_to_clipboard' => __('Permalink copied to clipboard successfully.', 'qdr-temporary-shared-storage'), 'error_getting_permalink' => __('Error getting permalink.', 'qdr-temporary-shared-storage'), 'error_getting_permalink_try_again' => __('Error getting permalink. Please try again.', 'qdr-temporary-shared-storage'), 'item_force_activated' => __('Item has been force activated successfully.', 'qdr-temporary-shared-storage'), 'error_force_activating' => __('Error force activating item.', 'qdr-temporary-shared-storage'), 'error_force_activating_try_again' => __('Error force activating item. Please try again.', 'qdr-temporary-shared-storage'), ) )); } /** * Add admin menu items. * * @since 1.0.0 */ public function add_admin_menu() { // Add Shared Storage page under Media menu add_submenu_page( 'upload.php', __('Shared Storage', 'qdr-temporary-shared-storage'), __('Shared Storage', 'qdr-temporary-shared-storage'), 'manage_options', 'qdr-temporary-shared-storage', array($this, 'render_media_page') ); // Add Settings page add_submenu_page( 'options-general.php', __('Shared Storage Settings', 'qdr-temporary-shared-storage'), __('Shared Storage', 'qdr-temporary-shared-storage'), 'manage_options', 'qdr-temporary-shared-storage-settings', array($this, 'render_settings_page') ); } /** * Render the Media Shared Storage admin page. * * @since 1.0.0 */ public function render_media_page() { require_once plugin_dir_path(dirname(__FILE__)) . 'admin/partials/media-page.php'; } /** * Render the Settings admin page. * * @since 1.0.0 */ public function render_settings_page() { require_once plugin_dir_path(dirname(__FILE__)) . 'admin/partials/settings-page.php'; } }