-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwordpress-to-markdown-exporter.php
97 lines (86 loc) · 2.59 KB
/
wordpress-to-markdown-exporter.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<?php
/**
* Plugin Name: WordPress to Markdown Exporter
* Plugin URI: https://github.com/jonathanbossenger/wp-to-md-exporter
* Description: Export WordPress posts and custom post types to Markdown format
* Version: 1.0.0
* Author: Jonathan Bossenger
* Author URI: https://jonathanbossenger.com
* License: GPL v2 or later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: wp-to-md
* Domain Path: /languages
*
* @package WordPress_To_Markdown_Exporter
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
/**
* Main plugin class
*/
class WordPress_To_Markdown_Exporter {
/**
* Single instance of this class
*
* @var WordPress_To_Markdown_Exporter
*/
private static $instance = null;
/**
* Get single instance of this class
*
* @return WordPress_To_Markdown_Exporter
*/
public static function get_instance() {
if ( null === self::$instance ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Constructor
*/
private function __construct() {
$this->define_constants();
$this->init_hooks();
}
/**
* Define plugin constants
*/
private function define_constants() {
define( 'WP_TO_MD_VERSION', '1.0.0' );
define( 'WP_TO_MD_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
define( 'WP_TO_MD_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
}
/**
* Initialize WordPress hooks
*/
private function init_hooks() {
// Load required classes
require_once WP_TO_MD_PLUGIN_DIR . 'includes/class-wp-to-md-converter.php';
require_once WP_TO_MD_PLUGIN_DIR . 'includes/class-wp-to-md-file-handler.php';
require_once WP_TO_MD_PLUGIN_DIR . 'includes/class-wp-to-md-exporter.php';
// Load admin class
if ( is_admin() ) {
require_once WP_TO_MD_PLUGIN_DIR . 'admin/class-wp-to-md-admin-page.php';
new WP_To_MD_Admin_Page();
}
}
/**
* Activation hook callback
*/
public static function activate() {
// Future activation code will go here
}
/**
* Deactivation hook callback
*/
public static function deactivate() {
// Future cleanup code will go here
}
}
// Register activation and deactivation hooks
register_activation_hook( __FILE__, array( 'WordPress_To_Markdown_Exporter', 'activate' ) );
register_deactivation_hook( __FILE__, array( 'WordPress_To_Markdown_Exporter', 'deactivate' ) );
// Initialize the plugin
WordPress_To_Markdown_Exporter::get_instance();