| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin Name: Post Type Transfer |
| 4 |
* Plugin URI: https://wordpress.org/plugins/post-type-transfer/ |
| 5 |
* Description: This plugin will allow user to change post type to other public post types or page. |
| 6 |
* Requires at least: 6.6 |
| 7 |
* Requires PHP: 8.1 |
| 8 |
* Author: KrishaWeb |
| 9 |
* Author URI: https://www.krishaweb.com/ |
| 10 |
* Text Domain: post-type-transfer |
| 11 |
* Domain Path: /languages |
| 12 |
* Version: 1.6 |
| 13 |
* License: GPLv3 or later |
| 14 |
* License URI: http://www.gnu.org/licenses/gpl-3.0.html |
| 15 |
* |
| 16 |
* @package Post_Type_Transfer |
| 17 |
*/ |
| 18 |
|
| 19 |
if ( ! defined( 'ABSPATH' ) ) { |
| 20 |
exit; |
| 21 |
} |
| 22 |
define( 'POST_TYPE_TRANSFER_VERSION', '1.6' ); |
| 23 |
require_once plugin_dir_path( __FILE__ ) . 'admin/class-post-type-transfer.php'; |
| 24 |
require_once plugin_dir_path( __FILE__ ) . 'admin/class-ptt-quick-edit.php'; |
| 25 |
require_once plugin_dir_path( __FILE__ ) . 'admin/class-ptt-review-notice.php'; |
| 26 |
require_once plugin_dir_path( __FILE__ ) . 'admin/class-ptt-csv-admin.php'; |
| 27 |
require_once plugin_dir_path( __FILE__ ) . 'admin/class-ptt-csv-exporter.php'; |
| 28 |
require_once plugin_dir_path( __FILE__ ) . 'admin/class-ptt-csv-importer.php'; |
| 29 |
require_once plugin_dir_path( __FILE__ ) . 'lib/block/class-ptt-gutenberg-metabox.php'; |
| 30 |
require_once plugin_dir_path( __FILE__ ) . 'admin/class-ptt-post-visibility.php'; |
| 31 |
|
| 32 |
/** |
| 33 |
* Load plugin textdomain. |
| 34 |
*/ |
| 35 |
function ptt_textdomain() { |
| 36 |
load_plugin_textdomain( 'post-type-transfer', false, basename( __DIR__ ) . '/languages' ); |
| 37 |
} |
| 38 |
add_action( 'plugins_loaded', 'ptt_textdomain' ); |
| 39 |
|
| 40 |
/** |
| 41 |
* Plugin activate hook. |
| 42 |
*/ |
| 43 |
function ptt_activate() { |
| 44 |
PTT_Review_Notice::activate(); |
| 45 |
} |
| 46 |
register_activation_hook( __FILE__, 'ptt_activate' ); |
| 47 |
|
| 48 |
/** |
| 49 |
* Plugin deactivate hook. |
| 50 |
*/ |
| 51 |
function ptt_deactivate() { |
| 52 |
// Deactivation code here... |
| 53 |
} |
| 54 |
register_deactivation_hook( __FILE__, 'ptt_deactivate' ); |
| 55 |
|
| 56 |
/** |
| 57 |
* Plugin class init. |
| 58 |
*/ |
| 59 |
function ptt_init() { |
| 60 |
// Generate the plugin instance. |
| 61 |
if ( ! class_exists( 'Post_Type_Transfer' ) ) { |
| 62 |
return; |
| 63 |
} |
| 64 |
// Only initialise the free transfer class when Pro is not taking over. |
| 65 |
$pro_active = defined( 'POST_TYPE_TRANSFER_PRO_VERSION' ) && function_exists( 'ptt_pro_is_licensed' ); |
| 66 |
$pro_licensed = $pro_active && ptt_pro_is_licensed(); |
| 67 |
if ( ! $pro_licensed ) { |
| 68 |
new Post_Type_Transfer(); |
| 69 |
} |
| 70 |
|
| 71 |
new PTT_Review_Notice(); |
| 72 |
new PTT_Post_Visibility(); |
| 73 |
|
| 74 |
// CSV Export / Import. |
| 75 |
if ( is_admin() ) { |
| 76 |
new PTT_CSV_Admin(); |
| 77 |
new PTT_CSV_Exporter(); |
| 78 |
new PTT_CSV_Importer(); |
| 79 |
} |
| 80 |
} |
| 81 |
add_action( 'plugins_loaded', 'ptt_init' ); |
| 82 |
|