| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin Name: Interlinks Manager |
| 4 |
* Description: Manages the internal links of your WordPress website. (Lite Version) |
| 5 |
* Version: 1.19 |
| 6 |
* Author: DAEXT |
| 7 |
* Author URI: https://daext.com |
| 8 |
* Text Domain: daext-interlinks-manager |
| 9 |
* License: GPLv3 |
| 10 |
* |
| 11 |
* @package daext-interlinks-manager |
| 12 |
*/ |
| 13 |
|
| 14 |
use Daext\Daextinma\NoticesManager\DAEXT_Notices_Manager; |
| 15 |
|
| 16 |
// Prevent direct access to this file. |
| 17 |
if ( ! defined( 'WPINC' ) ) { |
| 18 |
die(); } |
| 19 |
|
| 20 |
// Set constants. |
| 21 |
define( 'DAEXTINMA_EDITION', 'FREE' ); |
| 22 |
|
| 23 |
// Class shared across public and admin. |
| 24 |
require_once plugin_dir_path( __FILE__ ) . 'shared/class-daextinma-shared.php'; |
| 25 |
|
| 26 |
// Rest API. |
| 27 |
require_once plugin_dir_path( __FILE__ ) . 'inc/class-daextinma-rest.php'; |
| 28 |
add_action( 'plugins_loaded', array( 'Daextinma_Rest', 'get_instance' ) ); |
| 29 |
|
| 30 |
// Perform the Gutenberg related activities only if Gutenberg is present. |
| 31 |
if ( function_exists( 'register_block_type' ) ) { |
| 32 |
require_once plugin_dir_path( __FILE__ ) . 'blocks/src/init.php'; |
| 33 |
} |
| 34 |
|
| 35 |
/** |
| 36 |
* Initialize the plugin notices manager used to display documentation and review notices for this plugin. |
| 37 |
*/ |
| 38 |
require_once __DIR__ . '/inc/daext-notices-manager/class-daext-notices-manager.php'; |
| 39 |
DAEXT_Notices_Manager::get_instance( [ |
| 40 |
'plugin_slug' => 'daext-interlinks-manager', |
| 41 |
'plugin_file' => __FILE__, |
| 42 |
'docs_url' => 'https://daext.com/kb/link-manager/quick-start-guide/', |
| 43 |
'review_url' => 'https://wordpress.org/support/plugin/daext-interlinks-manager/reviews/#new-post', |
| 44 |
'plugin_prefix' => 'daextinma', |
| 45 |
'settings_screen_id' => 'interlinks_page_daextinma-options', |
| 46 |
'feature_used' => get_option( 'daextinma_analysis_runs', 0 ) >= 5, |
| 47 |
] ); |
| 48 |
|
| 49 |
// Admin. |
| 50 |
if ( is_admin() ) { |
| 51 |
|
| 52 |
require_once plugin_dir_path( __FILE__ ) . 'admin/class-daextinma-admin.php'; |
| 53 |
|
| 54 |
// If this is not an AJAX request, create a new singleton instance of the admin class. |
| 55 |
if ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) { |
| 56 |
add_action( 'plugins_loaded', array( 'Daextinma_Admin', 'get_instance' ) ); |
| 57 |
} |
| 58 |
|
| 59 |
// Activate the plugin using only the class static methods. |
| 60 |
register_activation_hook( __FILE__, array( 'Daextinma_Admin', 'ac_activate' ) ); |
| 61 |
|
| 62 |
} |
| 63 |
// Ajax. |
| 64 |
if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { |
| 65 |
|
| 66 |
// Admin. |
| 67 |
require_once plugin_dir_path( __FILE__ ) . 'class-daextinma-ajax.php'; |
| 68 |
add_action( 'plugins_loaded', array( 'Daextinma_Ajax', 'get_instance' ) ); |
| 69 |
|
| 70 |
} |
| 71 |
|
| 72 |
/** |
| 73 |
* Customize the action links in the "Plugins" menu. |
| 74 |
* |
| 75 |
* @param array $actions An array of plugin action links. |
| 76 |
* |
| 77 |
* @return mixed |
| 78 |
*/ |
| 79 |
function daextinma_customize_action_links( $actions ) { |
| 80 |
$actions[] = '<a href="https://daext.com/interlinks-manager/" target="_blank">' . esc_html__( 'Buy the Pro Version', 'daext-interlinks-manager' ) . '</a>'; |
| 81 |
return $actions; |
| 82 |
} |
| 83 |
|
| 84 |
add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), 'daextinma_customize_action_links' ); |
| 85 |
|
| 86 |
if ( is_admin() ) { |
| 87 |
|
| 88 |
require_once plugin_dir_path( __FILE__ ) . 'admin/class-daextinma-admin.php'; |
| 89 |
|
| 90 |
// If needed, create or update the database tables. |
| 91 |
Daextinma_Admin::ac_create_database_tables(); |
| 92 |
|
| 93 |
// If needed, create or update the plugin options. |
| 94 |
Daextinma_Admin::ac_initialize_options(); |
| 95 |
|
| 96 |
} |
| 97 |
|