| 1 |
<?php |
| 2 |
/** |
| 3 |
* @wordpress-plugin |
| 4 |
* Plugin Name: Media Library Tools - AI-Powered Rename, Clean & CSV Import/Export |
| 5 |
* Plugin URI: https://www.wptinysolutions.com/tiny-products/media-library-tools/ |
| 6 |
* Description: AI-Powered Bulk Rename media file, Bulk Edit Title, ALT tags, captions, and descriptions of your media files can improve the organization and SEO score. |
| 7 |
* Version: 2.3.0 |
| 8 |
* Author: Tiny Solutions |
| 9 |
* Author URI: https://www.wptinysolutions.com/ |
| 10 |
* Text Domain: media-library-tools |
| 11 |
* Domain Path: /languages |
| 12 |
* License: GPLv3 |
| 13 |
* License URI: http://www.gnu.org/licenses/gpl-3.0.html |
| 14 |
* @package TinySolutions\mlt |
| 15 |
*/ |
| 16 |
|
| 17 |
// Do not allow directly accessing this file. |
| 18 |
if ( ! defined( 'ABSPATH' ) ) { |
| 19 |
exit( 'This script cannot be accessed directly.' ); |
| 20 |
} |
| 21 |
|
| 22 |
/** |
| 23 |
* Define media edit Constant. |
| 24 |
*/ |
| 25 |
|
| 26 |
define( 'TSMLT_VERSION', '2.3.0' ); |
| 27 |
|
| 28 |
define( 'TSMLT_FILE', __FILE__ ); |
| 29 |
|
| 30 |
define( 'TSMLT_BASENAME', plugin_basename( __FILE__ ) ); |
| 31 |
|
| 32 |
define( 'TSMLT_URL', plugins_url( '', TSMLT_FILE ) ); |
| 33 |
|
| 34 |
define( 'TSMLT_ABSPATH', dirname( TSMLT_FILE ) ); |
| 35 |
|
| 36 |
define( 'TSMLT_PATH', plugin_dir_path( __FILE__ ) ); |
| 37 |
|
| 38 |
require_once TSMLT_PATH . 'autoload.php'; |
| 39 |
|
| 40 |
use TinySolutions\mlt\Tsmlt; |
| 41 |
use TinySolutions\mlt\Controllers\Installation; |
| 42 |
|
| 43 |
// Register Plugin Active Hook. |
| 44 |
register_activation_hook( |
| 45 |
TSMLT_FILE, |
| 46 |
function () { |
| 47 |
Installation::activate(); |
| 48 |
set_transient( 'tsmlt_activation_redirect', 1, 30 ); |
| 49 |
} |
| 50 |
); |
| 51 |
// Register Plugin Deactivate Hook. |
| 52 |
register_deactivation_hook( TSMLT_FILE, [ Installation::class, 'deactivation' ] ); |
| 53 |
// Register Plugin Uninstall Hook — wipes data when `delete_data_on_uninstall` setting is enabled. |
| 54 |
register_uninstall_hook( TSMLT_FILE, [ Installation::class, 'uninstall' ] ); |
| 55 |
add_action( |
| 56 |
'admin_init', |
| 57 |
function () { |
| 58 |
// Create missing tables if they don't exist (activation hook doesn't fire on updates). |
| 59 |
Installation::maybe_create_tables(); |
| 60 |
|
| 61 |
if ( ! get_transient( 'tsmlt_activation_redirect' ) ) { |
| 62 |
return; |
| 63 |
} |
| 64 |
delete_transient( 'tsmlt_activation_redirect' ); |
| 65 |
if ( wp_doing_ajax() || is_network_admin() || isset( $_GET['activate-multi'] ) ) { // phpcs:ignore |
| 66 |
return; |
| 67 |
} |
| 68 |
wp_safe_redirect( admin_url( 'upload.php?page=media-library-tools' ) ); |
| 69 |
exit; |
| 70 |
} |
| 71 |
); |
| 72 |
|
| 73 |
/** |
| 74 |
* App Init. |
| 75 |
*/ |
| 76 |
|
| 77 |
/** |
| 78 |
* @return Tsmlt |
| 79 |
*/ |
| 80 |
function tsmlt() { |
| 81 |
return Tsmlt::instance(); |
| 82 |
} |
| 83 |
tsmlt(); |
| 84 |
|