delete-old-posts-programmatically
Last commit date
assets
2 years ago
freemius
1 year ago
inc
1 year ago
languages
3 years ago
README.md
2 years ago
composer.json
5 years ago
delete-old-posts-premium.php
3 years ago
delete-old-posts-programmatically.php
3 years ago
delete-old-posts.php
1 year ago
package-lock.json
2 years ago
package.json
2 years ago
postcss.config.js
5 years ago
readme.txt
1 year ago
styles.css
2 years ago
tailwind.config.js
2 years ago
delete-old-posts.php
89 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * Plugin Name: Delete old posts automatically |
| 5 | * Description: Keep your website clean by automatically deleting old posts and redirecting the deleted posts to similar ones. |
| 6 | * Author: WPMagic |
| 7 | * Author URI: https://wpmagic.cloud |
| 8 | * License: GPL3 |
| 9 | * License URI: https://www.gnu.org/licenses/gpl-3.0.html |
| 10 | * Version: 3.9.0 |
| 11 | * Text Domain: delete-old-posts |
| 12 | * |
| 13 | * @package headless-cms |
| 14 | */ |
| 15 | use DEL\OLD\Posts\Cls; |
| 16 | use DEL\OLD\Posts\Cls\Assets; |
| 17 | // If this file is accessed directory, then abort. |
| 18 | if ( !defined( 'WPINC' ) ) { |
| 19 | die; |
| 20 | } |
| 21 | if ( function_exists( 'dop_fs' ) ) { |
| 22 | dop_fs()->set_basename( false, __FILE__ ); |
| 23 | } else { |
| 24 | // DO NOT REMOVE THIS IF, IT IS ESSENTIAL FOR THE `function_exists` CALL ABOVE TO PROPERLY WORK. |
| 25 | // ... Freemius integration snippet ... |
| 26 | /******************* |
| 27 | * freemius |
| 28 | * *************** */ |
| 29 | if ( !function_exists( 'dop_fs' ) ) { |
| 30 | // Create a helper function for easy SDK access. |
| 31 | function dop_fs() { |
| 32 | global $dop_fs; |
| 33 | if ( !isset( $dop_fs ) ) { |
| 34 | // Include Freemius SDK. |
| 35 | require_once dirname( __FILE__ ) . '/freemius/start.php'; |
| 36 | $dop_fs = fs_dynamic_init( array( |
| 37 | 'id' => '8165', |
| 38 | 'slug' => 'delete-old-posts', |
| 39 | 'type' => 'plugin', |
| 40 | 'public_key' => 'pk_344033c43756e8fcfcd1e6a2c6b17', |
| 41 | 'is_premium' => false, |
| 42 | 'premium_suffix' => 'Professional', |
| 43 | 'has_addons' => false, |
| 44 | 'has_paid_plans' => true, |
| 45 | 'menu' => array( |
| 46 | 'slug' => 'delete-old-posts', |
| 47 | 'support' => false, |
| 48 | ), |
| 49 | 'is_live' => true, |
| 50 | ) ); |
| 51 | } |
| 52 | return $dop_fs; |
| 53 | } |
| 54 | |
| 55 | // Init Freemius. |
| 56 | dop_fs(); |
| 57 | // Signal that SDK was initiated. |
| 58 | do_action( 'dop_fs_loaded' ); |
| 59 | } |
| 60 | // ... Plugin's main file logic ... |
| 61 | /******************** |
| 62 | * Main Plugin Code |
| 63 | ********************/ |
| 64 | // register plugin classes |
| 65 | require_once plugin_dir_path( __FILE__ ) . 'inc/class-enqueue-assets.php'; |
| 66 | require_once plugin_dir_path( __FILE__ ) . 'inc/class-delete-old-posts.php'; |
| 67 | require_once plugin_dir_path( __FILE__ ) . 'inc/class-delete-old-posts-redirects.php'; |
| 68 | require_once plugin_dir_path( __FILE__ ) . 'inc/class-delete-old-posts-filters.php'; |
| 69 | /** |
| 70 | * Starts the plugin by initializing the class |
| 71 | * Set the plugin in motion. |
| 72 | */ |
| 73 | add_action( 'plugins_loaded', 'deloldp_class_load' ); |
| 74 | function deloldp_class_load() { |
| 75 | new Assets\Enqueue_Assets(); |
| 76 | new Cls\Delete_Old_Posts(); |
| 77 | new Cls\Delete_Old_Posts_Filters(); |
| 78 | new Cls\Delete_Old_Posts_Redirects(); |
| 79 | } |
| 80 | |
| 81 | /** |
| 82 | * add plugin translations |
| 83 | */ |
| 84 | add_action( 'init', 'delop_load_textdomain' ); |
| 85 | function delop_load_textdomain() { |
| 86 | load_plugin_textdomain( 'delete-old-posts', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' ); |
| 87 | } |
| 88 | |
| 89 | } |