PluginProbe
Ultimate Markdown – Markdown Editor, Importer, & Exporter / 1.26
Ultimate Markdown – Markdown Editor, Importer, & Exporter v1.26
1.26 trunk 1.07 1.08 1.09 1.10 1.11 1.12 1.13 1.14 1.15 1.16 1.18 1.19 1.20 1.21 1.22 1.23 1.24 1.25
ultimate-markdown / init.php

init.php in Ultimate Markdown – Markdown Editor, Importer, & Exporter 1.26, at init.php

111 lines 3.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Plugin Name: Ultimate Markdown
4 * Description: A set of tools that helps you work with the Markdown language.
5 * Version: 1.26
6 * Author: DAEXT
7 * Author URI: https://daext.com
8 * Text Domain: ultimate-markdown
9 * License: GPLv3
10 *
11 * @package ultimate-markdown
12 */
13
14 use Daext\Daextulma\NoticesManager\DAEXT_Notices_Manager;
15
16 // Prevent direct access to this file.
17 if ( ! defined( 'WPINC' ) ) {
18 die();
19 }
20
21 // Set constants.
22 define( 'DAEXTULMA_EDITION', 'FREE' );
23
24 // Save the PHP version in a format that allows a numeric comparison.
25 if ( ! defined( 'DAEXTULMA_PHP_VERSION' ) ) {
26 $version = explode( '.', PHP_VERSION );
27 define( 'DAEXTULMA_PHP_VERSION', ( $version[0] * 10000 + $version[1] * 100 + $version[2] ) );
28 }
29
30 // Rest API.
31 require_once plugin_dir_path( __FILE__ ) . 'rest/class-daextulma-rest.php';
32 add_action( 'plugins_loaded', array( 'Daextulma_Rest', 'get_instance' ) );
33
34 // Class shared across public and admin.
35 require_once plugin_dir_path( __FILE__ ) . 'shared/class-daextulma-shared.php';
36
37 // Perform the Gutenberg related activities only if Gutenberg is present.
38 if ( function_exists( 'register_block_type' ) ) {
39 require_once plugin_dir_path( __FILE__ ) . 'blocks/src/init.php';
40 }
41
42 /**
43 * Initialize the plugin notices manager used to display documentation and review notices for this plugin.
44 */
45 require_once __DIR__ . '/inc/daext-notices-manager/class-daext-notices-manager.php';
46 DAEXT_Notices_Manager::get_instance( [
47 'plugin_slug' => 'ultimate-markdown',
48 'plugin_file' => __FILE__,
49 'docs_url' => 'https://daext.com/kb/ultimate-markdown/quick-start-guide/',
50 'review_url' => 'https://wordpress.org/support/plugin/ultimate-markdown/reviews/#new-post',
51 'plugin_prefix' => 'daextulma',
52 'settings_screen_id' => 'markdown_page_daextulma-options',
53 'feature_used' => true,
54 ] );
55
56 // Admin.
57 if ( is_admin() ) {
58
59 require_once plugin_dir_path( __FILE__ ) . 'admin/class-daextulma-admin.php';
60
61 // If this is not an AJAX request, create a new singleton instance of the admin class.
62 if ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) {
63 add_action( 'plugins_loaded', array( 'Daextulma_Admin', 'get_instance' ) );
64 }
65
66 // Load meta boxes.
67 require_once plugin_dir_path( __FILE__ ) . 'admin/inc/class-daextulma-meta-boxes.php';
68 add_action( 'plugins_loaded', array( 'Daextulma_Meta_Boxes', 'get_instance' ) );
69
70 // Activate the plugin using only the class static methods.
71 register_activation_hook( __FILE__, array( 'Daextulma_Admin', 'ac_activate' ) );
72
73 // Update the plugin db tables and options if they are not up-to-date.
74 Daextulma_Admin::ac_create_database_tables();
75 Daextulma_Admin::ac_initialize_options();
76
77 }
78
79 // Ajax.
80 if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
81
82 // Admin.
83 require_once plugin_dir_path( __FILE__ ) . 'class-daextulma-ajax.php';
84 add_action( 'plugins_loaded', array( 'Daextulma_Ajax', 'get_instance' ) );
85
86 }
87
88 /**
89 * Customize the action links in the "Plugins" menu.
90 *
91 * @param array $actions An array of plugin action links.
92 *
93 * @return mixed
94 */
95 function daextulma_customize_action_links( $actions ) {
96 $actions[] = '<a href="https://daext.com/ultimate-markdown/" target="_blank">' . esc_html__( 'Buy the Pro Version', 'daext-autolinks-manager' ) . '</a>';
97 return $actions;
98 }
99
100 add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), 'daextulma_customize_action_links' );
101
102 /**
103 * Load the plugin text domain for translation.
104 *
105 * @return void
106 */
107 function daextulma_load_plugin_textdomain() {
108 load_plugin_textdomain( 'ultimate-markdown', false, 'ultimate-markdown/lang/' );
109 }
110
111 add_action( 'init', 'daextulma_load_plugin_textdomain' );