PluginProbe
Autoremove Attachments / trunk
Autoremove Attachments vtrunk
trunk 1.3.0 1.3.1
autoremove-attachments / autoremove-attachments.php

autoremove-attachments.php in Autoremove Attachments trunk, at autoremove-attachments.php

104 lines 3.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Plugin Name: Autoremove Attachments
4 * Plugin URI: https://wordpress.org/plugins/autoremove-attachments
5 * Author: Polygon Themes
6 * Author URI: https://polygonthemes.com
7 * Description: Autoremove Attachments helps you keep your media library clean by deleting all media files attached to a post when that post is permanently removed from your system.
8 * Version: 1.3.1
9 * Requires PHP: 7.4
10 * Requires at least: 5.8
11 *
12 * Text Domain: autoremove-attachments
13 * Domain Path: /languages/
14 *
15 * License: GPLv3 or later
16 * License URI: https://choosealicense.com/licenses/gpl-3.0
17 *
18 * This program is free software.
19 * You can redistribute it and/or modify it under the terms of GNU General Public License,
20 * as published by the Free Software Foundation, either version 3 of the License, or any later version.
21 *
22 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY.
23 * Without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
24 * For more details, see the GNU General Public License.
25 *
26 * @since 1.0.0
27 * @package Autoremove_Attachments
28 */
29
30 defined( 'ABSPATH' ) || exit;
31
32
33
34
35
36 define( 'AUTOREMOVE_ATTACHMENTS_VERSION', '1.3.1' );
37 define( 'AUTOREMOVE_ATTACHMENTS_SLUG', 'autoremove-attachments' );
38
39 define( 'AUTOREMOVE_ATTACHMENTS_FILE', __FILE__ );
40 define( 'AUTOREMOVE_ATTACHMENTS_DIR_URL', plugin_dir_url( __FILE__ ) );
41 define( 'AUTOREMOVE_ATTACHMENTS_DIR_PATH', plugin_dir_path( __FILE__ ) );
42
43 define( 'AUTOREMOVE_ATTACHMENTS_MIN_PHP_VERSION', '7.4' );
44 define( 'AUTOREMOVE_ATTACHMENTS_REC_PHP_VERSION', '8.4' );
45
46
47
48
49
50 /**
51 * Code that runs during the plugin activation.
52 *
53 * @since 1.0.0
54 * @param bool $network_wide Boolean value with the network-wide activation status.
55 */
56 function activate_autoremove_attachments( $network_wide ) {
57 require_once AUTOREMOVE_ATTACHMENTS_DIR_PATH . 'includes/class-autoremove-attachments-activator.php';
58 Autoremove_Attachments_Activator::activate( $network_wide );
59 }
60 register_activation_hook( AUTOREMOVE_ATTACHMENTS_FILE, 'activate_autoremove_attachments' );
61
62
63
64
65
66 /**
67 * Code that runs during the plugin deactivation.
68 *
69 * @since 1.0.0
70 * @param bool $network_wide Boolean value with the network-wide activation status.
71 */
72 function deactivate_autoremove_attachments( $network_wide ) {
73 require_once AUTOREMOVE_ATTACHMENTS_DIR_PATH . 'includes/class-autoremove-attachments-deactivator.php';
74 Autoremove_Attachments_Deactivator::deactivate( $network_wide );
75 }
76 register_deactivation_hook( AUTOREMOVE_ATTACHMENTS_FILE, 'deactivate_autoremove_attachments' );
77
78
79
80
81
82 /**
83 * Load and execute if all requirements are met.
84 *
85 * @since 1.0.0
86 */
87 function run_autoremove_attachments() {
88 require_once AUTOREMOVE_ATTACHMENTS_DIR_PATH . 'includes/class-autoremove-attachments.php';
89 require_once AUTOREMOVE_ATTACHMENTS_DIR_PATH . 'includes/class-autoremove-attachments-textdomain.php';
90 require_once AUTOREMOVE_ATTACHMENTS_DIR_PATH . 'includes/class-autoremove-attachments-requirements.php';
91
92 $textdomain = new Autoremove_Attachments_Textdomain();
93 $textdomain->init();
94
95 $requirements = new Autoremove_Attachments_Requirements();
96 $requirements->init();
97
98 if ( $requirements->check() ) {
99 $plugin = new Autoremove_Attachments();
100 $plugin->run();
101 }
102 }
103 add_action( 'plugins_loaded', 'run_autoremove_attachments' );
104