PluginProbe
Edwiser Bridge – WordPress Moodle Integration / trunk
Edwiser Bridge – WordPress Moodle Integration vtrunk
trunk 1.0.0 1.0.1 1.0.2 1.1 1.1.1 1.1.2 1.2.1 1.2.2 1.2.3 1.2.4 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8 All 74 releases
edwiser-bridge / edwiser-bridge.php

edwiser-bridge.php in Edwiser Bridge – WordPress Moodle Integration trunk, at edwiser-bridge.php

225 lines 7.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * The plugin bootstrap file
5 *
6 * @link https://edwiser.org
7 * @since 1.0.0
8 * @package Edwiser Bridge
9 *
10 * @WordPress-plugin
11 * Plugin Name: Edwiser Bridge - WordPress Moodle LMS Integration
12 * Plugin URI: https://edwiser.org/bridge-wordpress-moodle-integration/
13 * Description: Edwiser Bridge integrates WordPress with the Moodle LMS. The plugin provides an easy option to import Moodle courses to WordPress and sell them using PayPal. The plugin also allows automatic registration of WordPress users on the Moodle website along with single login credentials for both the systems.
14 * Version: 4.3.4
15 * Author: WisdmLabs
16 * Author URI: https://edwiser.org
17 * License: GPL-2.0+
18 * License URI: http://www.gnu.org/licenses/gpl-2.0.txt
19 * Text Domain: edwiser-bridge
20 * Domain Path: /languages
21 */
22
23 namespace app\wisdmlabs\edwiserBridge;
24
25 // If this file is called directly, abort.
26 if (! defined('WPINC')) {
27 die;
28 }
29
30 // plugin data global variable.
31 global $eb_plugin_data;
32 $eb_plugin_data = array(
33 'name' => 'Edwiser Bridge - WordPress Moodle LMS Integration',
34 'slug' => 'edwiser-bridge',
35 'version' => '4.3.4',
36 'mdl_plugin_url' => 'https://edwiser.org/plugins/edwiserbridge.zip',
37 );
38
39 /**
40 * The code that runs during plugin activation.
41 * This action is documented in includes/class-eb-activator.php.
42 */
43
44 /**
45 * Activate.
46 *
47 * @param text $net_wide net_wide.
48 */
49 function activate_edwiser_bridge($net_wide)
50 {
51 require_once plugin_dir_path(__FILE__) . 'includes/class-eb-activator.php';
52 Eb_Activator::activate($net_wide);
53 }
54
55 register_activation_hook(__FILE__, '\app\wisdmlabs\edwiserBridge\activate_edwiser_bridge');
56
57 /**
58 * The code that runs during plugin deactivation.
59 * This action is documented in includes/class-eb-deactivator.php.
60 */
61 function deactivate_edwiser_bridge()
62 {
63 require_once plugin_dir_path(__FILE__) . 'includes/class-eb-deactivator.php';
64 Eb_Deactivator::deactivate();
65 }
66
67 register_deactivation_hook(__FILE__, '\app\wisdmlabs\edwiserBridge\deactivate_edwiser_bridge');
68
69 /*
70 * Applied to the list of links to display on the plugins page (beside the activate/deactivate links).
71 *
72 * A nes link is added that takes user to plugin settings.
73 */
74 add_filter('plugin_action_links_' . plugin_basename(__FILE__), '\app\wisdmlabs\edwiserBridge\wdm_add_settings_action_link');
75
76 /**
77 * Action link.
78 *
79 * @param text $links links.
80 */
81 function wdm_add_settings_action_link($links)
82 {
83 // add pro link.
84 $plugin_links = array(
85 '<a href="' . admin_url('/admin.php?page=eb-settings') . '">' . esc_html__('Settings', 'edwiser-bridge') . '</a>',
86 );
87 $license = get_option('edd_edwiser_bridge_pro_license_status');
88 if ('valid' !== $license) {
89 $plugin_links[] = '<a href="https://bit.ly/2NAJ7OW" target="_blank">' . esc_html__('Upgrade to Pro', 'edwiser-bridge') . '</a>';
90 }
91
92 return array_merge($links, $plugin_links);
93 }
94
95 /*
96 * Show row meta on the plugin screen, custom docs link added.
97 */
98 add_filter('plugin_row_meta', '\app\wisdmlabs\edwiserBridge\wdm_plugin_row_meta', 10, 2);
99
100 /**
101 * Row meta.
102 *
103 * @param text $links links.
104 * @param text $file file.
105 */
106 function wdm_plugin_row_meta($links, $file)
107 {
108 if (plugin_basename(__FILE__) === $file) {
109 $row_meta = array(
110 'docs' => '<a href="https://edwiser.org/bridge/documentation/" target="_blank"
111 title="' . esc_attr__('Edwiser Bridge Documentation', 'edwiser-bridge') . '">' .
112 esc_html__('Documentation', 'edwiser-bridge') .
113 '</a>',
114 );
115
116 return array_merge($links, $row_meta);
117 }
118
119 return (array) $links;
120 }
121
122 /**
123 * The core plugin class that is used to define internationalization,
124 * admin-specific hooks, and public-facing site hooks.
125 */
126 require_once plugin_dir_path(__FILE__) . 'includes/class-eb.php';
127
128 /*
129 * Executes on the plugin update.
130 */
131 add_action('admin_init', '\app\wisdmlabs\edwiserBridge\process_upgrade');
132
133 /**
134 * Upgrade.
135 */
136 function process_upgrade()
137 {
138 global $eb_plugin_data;
139 $current_version = get_option('eb_current_version');
140 if (false === $current_version || $current_version !== $eb_plugin_data['version']) {
141 require_once plugin_dir_path(__FILE__) . 'includes/class-eb-activator.php';
142 Eb_Activator::activate(false);
143 update_option('eb_current_version', $eb_plugin_data['version']);
144 update_option('eb_mdl_plugin_update_notice_dismissed', false);
145
146 if (version_compare($current_version, '4.3.0', '<')) {
147 update_option('eb_show_update_modal_4_3_0', 'yes');
148 }
149
150 // rename files.
151 require_once WP_PLUGIN_DIR . '/edwiser-bridge/includes/class-eb-i18n.php';
152 $plugin_i18n = new Eb_I18n();
153 $plugin_i18n->rename_langauge_files();
154 }
155 }
156
157 /**
158 * Begins execution of the plugin.
159 *
160 * Since everything within the plugin is registered via hooks,
161 * then kicking off the plugin from this point in the file does
162 * not affect the page life cycle.
163 *
164 * @since 1.0.0
165 */
166 function run_edwiser_bridge()
167 {
168 edwiser_bridge_instance()->run();
169 }
170
171 run_edwiser_bridge(); // start plugin execution.
172
173 require_once plugin_dir_path(__FILE__) . 'includes/api/class-eb-external-api-endpoint.php';
174
175 // if ( ! function_exists( 'eb_fs' ) ) {
176 // // Create a helper function for easy SDK access.
177 // function eb_fs() {
178 // global $eb_fs;
179
180 // if ( ! isset( $eb_fs ) ) {
181 // // Include Freemius SDK.
182 // require_once dirname(__FILE__) . '/freemius/start.php';
183
184 // $eb_fs = fs_dynamic_init( array(
185 // 'id' => '16802',
186 // 'slug' => 'edwiser-bridge',
187 // 'type' => 'plugin',
188 // 'public_key' => 'pk_81f44e942733db4d4ccf381ca4858',
189 // 'is_premium' => false,
190 // 'has_addons' => false,
191 // 'has_paid_plans' => false,
192 // 'menu' => array(
193 // 'slug' => 'edit.php?post_type=eb_course',
194 // 'account' => false,
195 // 'support' => false,
196 // 'contact' => false,
197 // ),
198 // ) );
199 // }
200
201 // return $eb_fs;
202 // }
203
204 // // Init Freemius.
205 // eb_fs();
206 // // Signal that SDK was initiated.
207 // do_action( 'eb_fs_loaded' );
208 // }
209 //Include the below code in the main plugin file to ensure that the Modular Analytics System is loaded when the plugin is activated.
210
211 // Include the Modular Analytics System class
212 require_once plugin_dir_path(__FILE__) . 'includes/analytics/class-modular-analytics.php';
213
214 // Initialize the analytics system when the plugin is loaded
215 add_action('plugins_loaded', function () {
216 Modular_Analytics_System::get_instance();
217 add_action('wp_ajax_modular_analytics_deactivation_feedback', [Modular_Analytics_System::get_instance(), 'handle_deactivation_feedback_ajax']);
218 add_action('wp_ajax_modular_analytics_dismiss_feedback', [Modular_Analytics_System::get_instance(), 'handle_dismiss_feedback']);
219 });
220
221 /**
222 * The classes responsible for Gutenberg blocks.
223 */
224 require_once plugin_dir_path(__FILE__) . 'includes/class-eb-blocks.php';
225