-
Notifications
You must be signed in to change notification settings - Fork 0
/
cfs-markdown.php
61 lines (57 loc) · 1.81 KB
/
cfs-markdown.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
<?php
/**
* Plugin Name: CFS - Markdown Add-On
* Plugin URI: https://github.com/robneu/cfs-markdown
* Description: A markdown textarea field type add-on for Custom Field Suite.
* Version: 0.1.0
* Author: Robert Neu
* Author URI: https://flagshipwp.com
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: cfs-markdown
* Domain Path: /languages
*
* Git URI: https://github.com/robneu/cfs-markdown
* GitHub Plugin URI: https://github.com/robneu/cfs-markdown
* GitHub Branch: master
*/
// Prevent direct access.
defined( 'ABSPATH' ) or exit;
// Define the plugin version.
if ( ! defined( 'CFSMD_ADDON_VERSION' ) ) {
define( 'CFSMD_ADDON_VERSION', '0.1.0' );
}
// Define the plugin directory URL.
if ( ! defined( 'CFSMD_ADDON_URL' ) ) {
define( 'CFSMD_ADDON_URL', plugin_dir_url( __FILE__ ) );
}
// Define the plugin directory path.
if ( ! defined( 'CFSMD_ADDON_DIR' ) ) {
define( 'CFSMD_ADDON_DIR', plugin_dir_path( __FILE__ ) );
}
// Load the main plugin class.
require_once( CFSMD_ADDON_DIR . 'includes/class-plugin.php' );
add_action( 'plugins_loaded', array( cfs_markdown_addon(), 'run' ) );
/**
* Allow themes and plugins to access CFS_Markdown_Addon methods and properties.
*
* Because we aren't using a singleton pattern for our main plugin class, we
* need to make sure it's only instantiated once in our helper function.
* If you need to access methods inside the plugin classes, use this function.
*
* Example:
*
* <?php cfs_markdown_addon()->run; ?>
*
* @since 0.0.1
* @access public
* @uses CFS_Markdown_Addon
* @return object CFS_Markdown_Addon A single instance of the main plugin class.
*/
function cfs_markdown_addon() {
static $plugin;
if ( null === $plugin ) {
$plugin = new CFS_Markdown_Addon;
}
return $plugin;
}