| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin Name: MooWoodle |
| 4 |
* Plugin URI: https://dualcube.com/ |
| 5 |
* Description: The MooWoodle plugin is an extention of WooCommerce that acts as a bridge between WordPress/Woocommerce and Moodle. |
| 6 |
* Author: DualCube |
| 7 |
* Version: 3.0 |
| 8 |
* Author URI: https://dualcube.com/ |
| 9 |
* Requires at least: 5.0 |
| 10 |
* Tested up to: 5.6 |
| 11 |
* WC requires at least: 4.0 |
| 12 |
* WC tested up to: 4.9.0 |
| 13 |
* |
| 14 |
* Text Domain: moowoodle |
| 15 |
* Domain Path: /languages/ |
| 16 |
*/ |
| 17 |
|
| 18 |
if ( ! class_exists( 'MooWoodle_Dependencies' ) ) |
| 19 |
require_once trailingslashit( dirname( __FILE__ ) ) . 'includes/class-moowoodle-dependencies.php'; |
| 20 |
|
| 21 |
require_once trailingslashit( dirname( __FILE__ ) ) . 'includes/moowoodle-core-functions.php'; |
| 22 |
require_once trailingslashit( dirname( __FILE__ ) ) . 'moowoodle-config.php'; |
| 23 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
| 24 |
if ( ! defined( 'MOOWOODLE_PLUGIN_TOKEN' ) ) exit; |
| 25 |
if ( ! defined( 'MOOWOODLE_TEXT_DOMAIN' ) ) exit; |
| 26 |
|
| 27 |
if ( ! MooWoodle_Dependencies::woocommerce_active_check() ) |
| 28 |
add_action( 'admin_notices', 'moowoodle_alert_notice' ); |
| 29 |
|
| 30 |
/** |
| 31 |
* Plugin page links |
| 32 |
*/ |
| 33 |
function moowoodle_plugin_links( $links ) { |
| 34 |
$plugin_links = array( |
| 35 |
'<a href="' . admin_url( 'admin.php?page=moowoodle-settings' ) . '">' . __( 'Settings', 'moowoodle' ) . '</a>', |
| 36 |
'<a href="https://wordpress.org/support/plugin/moowoodle/">' . __( 'Support', 'moowoodle' ) . '</a>', |
| 37 |
); |
| 38 |
$links = array_merge( $plugin_links, $links ); |
| 39 |
if ( apply_filters( 'moowoodle_free_active', true ) ) { |
| 40 |
$links[] = '<a href="https://dualcube.com/shop/" target="_blank">' . __( 'Upgrade to Pro', 'moowoodle' ) . '</a>'; |
| 41 |
} |
| 42 |
return $links; |
| 43 |
} |
| 44 |
add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), 'moowoodle_plugin_links' ); |
| 45 |
|
| 46 |
// Migration at activation hook |
| 47 |
register_activation_hook( __FILE__, 'moowoodle_option_migration_2_to_3' ); |
| 48 |
// Update time migration |
| 49 |
add_action( 'upgrader_process_complete', 'moowoodle_option_migration_2_to_3' ); |
| 50 |
|
| 51 |
if ( ! defined( 'MOOWOODLE_PLUGIN_BASENAME' ) ) |
| 52 |
define( 'MOOWOODLE_PLUGIN_BASENAME', plugin_basename( __FILE__ ) ); |
| 53 |
|
| 54 |
require_once trailingslashit( dirname( __FILE__ ) ) . 'includes/class-moowoodle-install.php'; |
| 55 |
register_activation_hook( __FILE__, array( 'MooWoodle_Install', 'init' ) ); |
| 56 |
|
| 57 |
if ( session_status() == PHP_SESSION_NONE ) { |
| 58 |
session_start( |
| 59 |
array( 'read_and_close' => true ) |
| 60 |
); |
| 61 |
} |
| 62 |
|
| 63 |
if ( ! class_exists( 'MooWoodle' ) ) { |
| 64 |
require_once( 'classes/class-moowoodle.php' ); |
| 65 |
global $MooWoodle; |
| 66 |
|
| 67 |
$MooWoodle = new MooWoodle( __FILE__ ); |
| 68 |
$GLOBALS[ 'MooWoodle' ] = $MooWoodle; |
| 69 |
} |
| 70 |
|