Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 0 additions & 91 deletions admin/class-admin-upload.php

This file was deleted.

8 changes: 1 addition & 7 deletions exelearning.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,8 @@
require_once EXELEARNING_PLUGIN_DIR . 'includes/class-activator.php';
require_once EXELEARNING_PLUGIN_DIR . 'includes/class-deactivator.php';
require_once EXELEARNING_PLUGIN_DIR . 'includes/class-exelearning.php';
require_once EXELEARNING_PLUGIN_DIR . 'includes/class-hooks.php';
require_once EXELEARNING_PLUGIN_DIR . 'includes/class-i18n.php';
require_once EXELEARNING_PLUGIN_DIR . 'includes/class-filters.php';
require_once EXELEARNING_PLUGIN_DIR . 'includes/class-post-types.php';
require_once EXELEARNING_PLUGIN_DIR . 'includes/class-mime-types.php';
require_once EXELEARNING_PLUGIN_DIR . 'includes/class-elp-list-table.php';

// Load the eXeLearning file upload handler.
require_once EXELEARNING_PLUGIN_DIR . 'includes/class-elp-upload-handler.php';
Expand All @@ -63,7 +59,6 @@
// Admin classes.
require_once EXELEARNING_PLUGIN_DIR . 'admin/class-admin-settings.php';
require_once EXELEARNING_PLUGIN_DIR . 'admin/class-admin-styles.php';
require_once EXELEARNING_PLUGIN_DIR . 'admin/class-admin-upload.php';
// Public classes.
require_once EXELEARNING_PLUGIN_DIR . 'public/class-shortcodes.php';

Expand Down Expand Up @@ -103,8 +98,7 @@ function exelearning_run() {
$viewer_enhancements = new ExeLearning_Viewer_Enhancements();
$viewer_enhancements->register_hooks();

$plugin = new ExeLearning();
$plugin->run();
new ExeLearning();
}

exelearning_run();
132 changes: 0 additions & 132 deletions includes/class-elp-list-table.php

This file was deleted.

41 changes: 0 additions & 41 deletions includes/class-exelearning-rest-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -626,25 +626,6 @@ private function validate_elp_file_path( $attachment_id ) {
return $file_path;
}

/**
* Clean up old extracted folder for an attachment.
*
* @param int $attachment_id Attachment ID.
*/
private function cleanup_old_extraction( $attachment_id ) {
$old_extracted = get_post_meta( $attachment_id, '_exelearning_extracted', true );
if ( ! $old_extracted ) {
return;
}

$upload_dir = wp_upload_dir();
$old_folder = trailingslashit( $upload_dir['basedir'] ) . 'exelearning/' . $old_extracted . '/';

if ( is_dir( $old_folder ) ) {
$this->recursive_delete( $old_folder );
}
}

/**
* Clean up extraction directory by hash.
*
Expand Down Expand Up @@ -785,26 +766,4 @@ private function extract_elp_to_new_dir( $file_path ) {
private function apply_elp_metadata( $attachment_id, $elp_service, $hash, $has_preview ) {
$this->reprocessor->apply_metadata( $attachment_id, $elp_service, $hash, $has_preview );
}

/**
* Recursively delete a directory.
*
* @param string $dir Directory path.
*/
private function recursive_delete( $dir ) {
if ( ! file_exists( $dir ) ) {
return;
}

if ( is_file( $dir ) || is_link( $dir ) ) {
wp_delete_file( $dir );
} else {
$files = array_diff( scandir( $dir ), array( '.', '..' ) );
foreach ( $files as $file ) {
$this->recursive_delete( $dir . DIRECTORY_SEPARATOR . $file );
}
// phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_rmdir -- Direct filesystem access needed for cleanup.
rmdir( $dir );
}
}
}
24 changes: 0 additions & 24 deletions includes/class-exelearning.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,35 +41,21 @@ class ExeLearning {
*/
public function __construct() {
$this->version = EXELEARNING_VERSION;
$this->load_dependencies();
$this->init_components();
$this->setup_hooks();
$this->load_i18n();
}

/**
* Loads required dependencies.
*
* Additional dependencies can be loaded here if needed.
*/
private function load_dependencies() {
// All required files are loaded via require_once in the main plugin file.
}

/**
* Initializes all plugin components.
*/
private function init_components() {
$this->components = array(
'hooks' => new ExeLearning_Hooks(),
'filters' => new ExeLearning_Filters(),
'post_types' => new ExeLearning_Post_Types(),
'mime_types' => new ExeLearning_Mime_Types(),
'shortcodes' => new ExeLearning_Shortcodes(),
'media_library' => new ExeLearning_Media_Library(),
'i18n' => new ExeLearning_I18n(),
'admin_settings' => new ExeLearning_Admin_Settings(),
'admin_upload' => new ExeLearning_Admin_Upload(),
'elp_upload_handler' => new ExeLearning_Elp_Upload_Handler(),
'elp_upload_block' => new ExeLearning_Elp_Upload_Block(),
'editor' => new ExeLearning_Editor(),
Expand All @@ -89,10 +75,7 @@ private function setup_hooks() {
// Early so migrated options are in place before settings registration
// (priority 10) and any admin page render reads them.
add_action( 'admin_init', array( 'ExeLearning_Upgrader', 'maybe_upgrade' ), 5 );
add_action( 'init', array( $this->components['hooks'], 'register_hooks' ) );
add_action( 'init', array( $this->components['post_types'], 'register_post_types' ) );
add_action( 'init', array( $this->components['shortcodes'], 'register_shortcodes' ) );
$this->components['filters']->register_filters();
$this->components['mime_types']->register_mime_types();
$this->components['elp_upload_handler']->register();
}
Expand All @@ -106,11 +89,4 @@ private function setup_hooks() {
private function load_i18n() {
add_action( 'init', array( $this->components['i18n'], 'load_textdomain' ) );
}

/**
* Runs the plugin.
*/
public function run() {
// Additional execution code can be added here.
}
}
Loading
Loading