PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.4.9
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.4.9
4.4.9 4.4.8 4.4.7 4.4.6 4.4.5 4.4.4 4.4.3 4.4.2 4.4.1 4.4.0 4.3.9.1 4.3.9 4.3.8 4.3.7 4.1.6.9 4.1.6.9.1 4.1.6.9.2 4.1.6.9.3 4.1.6.9.4 4.1.7 4.1.7.1 4.1.7.2 4.1.7.3 4.1.7.3.1 4.1.7.3.2 All 140 releases
← All changes | learnpress.php +29 -15 4.4.6 → 4.4.9 View file →
@@ -3,9 +3,9 @@
3 3 * Plugin Name: LearnPress
4 4 * Plugin URI: https://thimpress.com/learnpress
5 5 * Description: LearnPress is a WordPress complete solution for creating a Learning Management System (LMS). It can help you to create courses, lessons and quizzes.
6 6 * Author: ThimPress
7 - * Version: 4.4.6
7 + * Version: 4.4.9
8 8 * Author URI: http://thimpress.com
9 9 * Requires at least: 6.0
10 10 * Requires PHP: 7.4
11 11 * Text Domain: learnpress
@@ -21,8 +21,10 @@
21 21 use LearnPress\Ajax\BuilderDashboardAjax;
22 22 use LearnPress\Ajax\CourseToolsAjax;
23 23 use LearnPress\Ajax\CourseBuilder\CourseBuilderAjax;
24 24 use LearnPress\Ajax\EditCurriculumAjax;
25 +use LearnPress\Ajax\AddonsAjax;
26 +use LearnPress\Services\AddonService;
25 27 use LearnPress\Ajax\EditQuestionAjax;
26 28 use LearnPress\Ajax\EditQuizAjax;
27 29 use LearnPress\Ajax\Order\ExportOrderCSVAjax;
28 30 use LearnPress\Ajax\LessonAjax;
@@ -27,8 +29,9 @@
27 29 use LearnPress\Ajax\Order\ExportOrderCSVAjax;
28 30 use LearnPress\Ajax\LessonAjax;
29 31 use LearnPress\Ajax\LoadContentViaAjax;
30 32 use LearnPress\Ajax\SampleDataAJAX;
33 +use LearnPress\Ajax\SetupWizardAjax;
31 34 use LearnPress\Ajax\AI\AIAssistantAjax;
32 35 use LearnPress\Ajax\MCP\McpApiKeysAjax;
33 36 use LearnPress\Ajax\Webhook\WebhooksAjax;
34 37 use LearnPress\Ajax\CourseBuilder\CBEditCourseAjax;
@@ -48,12 +51,14 @@
48 51 use LearnPress\Shortcodes\CourseMaterialShortcode;
49 52 use LearnPress\Shortcodes\Courses\ListCoursesShortcode;
50 53 use LearnPress\Shortcodes\ListInstructorsShortcode;
51 54 use LearnPress\Shortcodes\SingleInstructorShortcode;
55 +use LearnPress\TemplateHooks\Admin\AdminAddonsPage;
52 56 use LearnPress\TemplateHooks\Admin\AdminEditQizTemplate;
53 57 use LearnPress\TemplateHooks\Admin\AdminEditQuestionTemplate;
54 58 use LearnPress\TemplateHooks\Admin\AdminListStudentsEnrolled;
55 59 use LearnPress\TemplateHooks\Admin\AdminStatisticsReportTable;
60 +use LearnPress\TemplateHooks\Admin\Notices\AdminNotesTemplate;
56 61 use LearnPress\TemplateHooks\Admin\Tools\AdminCourseTools;
57 62 use LearnPress\Statistics\FilterOptionsProvider;
58 63 use LearnPress\TemplateHooks\Admin\AI\AdminCreateCourseAITemplate;
59 64 use LearnPress\TemplateHooks\Admin\AI\AdminEditCourseCurriculumWithAITemplate;
@@ -180,8 +185,15 @@
180 185 public static $doc_link = 'https://learnpresslms.com/docs/';
181 186
182 187 /**
183 188 * LearnPress constructor.
189 + *
190 + * Runs on every WordPress bootstrap. Order of operations:
191 + * 1. prepare_before_handle() - define constants, autoload, include global files and create the LP_Install instance.
192 + * 2. Register activation/deactivation hooks unconditionally so on_activate() fires when the plugin is activated.
193 + * 3. Stop here if tables are not installed yet; the activation hook will create them.
194 + * 4. On normal requests with tables installed, register the init hook to load CPTs, APIs, settings and integrations.
195 + * 5. Register remaining plugin hooks.
184 196 */
185 197 private function __construct() {
186 198 /*if ( isset( $_POST['action'] ) && 'heartbeat' === $_POST['action'] ) {
187 199 return;
@@ -189,19 +201,22 @@
189 201
190 202 try {
191 203 $this->prepare_before_handle();
192 204
205 + register_activation_hook( LP_PLUGIN_FILE, array( $this, 'on_activate' ) );
206 + register_deactivation_hook( LP_PLUGIN_FILE, array( $this, 'on_deactivate' ) );
207 +
193 208 if ( ! LP_Install::instance()->tables_install_done() ) {
194 209 return;
195 210 }
196 211
197 - // Must handle in hook init of WordPress, when loaded plugins, theme, user.
212 + // init runs after WordPress core, plugins, theme and user are loaded.
198 213 add_action( 'init', [ $this, 'lp_main_handle' ], - 1000 );
199 214
200 - // hooks .
215 + // Register remaining plugin hooks.
201 216 $this->hooks();
202 217 } catch ( Throwable $e ) {
203 - error_log( __METHOD__ . ': ' . $e->getMessage() );
218 + LP_Debug::error_log( $e );
204 219 }
205 220 }
206 221
207 222 /**
@@ -397,8 +412,9 @@
397 412 AdminEditCurriculumTemplate::instance();
398 413 AdminEditSettingTemplate::instance();
399 414 AdminEditQizTemplate::instance();
400 415 AdminEditQuestionTemplate::instance();
416 + AdminNotesTemplate::instance();
401 417 AdminCourseTools::instance();
402 418 CourseMaterialTemplate::instance();
403 419 CourseAIAssistantTemplate::instance();
404 420 AdminOrderItemsTemplate::instance();
@@ -408,8 +424,9 @@
408 424 AdminEditCourseCurriculumWithAITemplate::instance();
409 425 AdminListStudentsEnrolled::instance();
410 426 AdminStatisticsReportTable::instance();
411 427 FilterOptionsProvider::register_flush_hooks();
428 + AdminAddonsPage::instance();
412 429 // WP GDPR
413 430 ErasePersonalData::instance();
414 431 ExportPersonalData::instance();
415 432
@@ -490,10 +507,8 @@
490 507
491 508 include_once 'inc/lp-webhooks.php'; // Addon learnpress-2checkout-payment v4.0.1 is using, when update v4.0.2 don't need load it.
492 509 include_once 'inc/class-lp-request-handler.php';
493 510
494 - include_once 'inc/admin/helpers/class-lp-plugins-helper.php';
495 -
496 511 // Todo: tungnx check those files.
497 512 include_once 'inc/abstracts/abstract-object-query.php';
498 513 include_once 'inc/class-lp-course-query.php';
499 514 include_once 'inc/abstracts/abstract-addon.php';
@@ -580,10 +595,8 @@
580 595 }
581 596
582 597 include_once 'inc/admin/class-lp-admin-ajax.php';
583 598
584 - include_once 'inc/admin/class-lp-admin-notice.php';
585 -
586 599 // File handle install LP
587 600 include_once 'inc/class-lp-install.php';
588 601
589 602 // Meta box helper
@@ -762,8 +775,10 @@
762 775 function () {
763 776 LoadContentViaAjax::catch_lp_ajax();
764 777 LessonAjax::catch_lp_ajax();
765 778 SampleDataAJAX::catch_lp_ajax();
779 + SetupWizardAjax::catch_lp_ajax();
780 + AddonsAjax::catch_lp_ajax();
766 781 EditCurriculumAjax::catch_lp_ajax();
767 782 EditQuizAjax::catch_lp_ajax();
768 783 EditQuestionAjax::catch_lp_ajax();
769 784 SendEmailAjax::catch_lp_ajax();
@@ -784,12 +799,9 @@
784 799
785 800 // Add links setting|document|addon on plugins page.
786 801 add_filter( 'plugin_action_links_' . LP_PLUGIN_BASENAME, array( $this, 'plugin_links' ) );
787 802
788 - register_activation_hook( LP_PLUGIN_FILE, array( $this, 'on_activate' ) );
789 - register_deactivation_hook( LP_PLUGIN_FILE, array( $this, 'on_deactivate' ) );
790 -
791 - add_action(
803 + /*add_action(
792 804 'plugin_loaded',
793 805 function ( $plugin ) {
794 806 // For check wp_remote call normally of WP
795 807 if ( ! empty( LP_Request::get_param( 'lp_test_wp_remote' ) ) ) {
@@ -796,9 +808,9 @@
796 808 echo '[TEST_REMOTE]';
797 809 die;
798 810 }
799 811 }
800 - );
812 + );*/
801 813
802 814 // Check require version thim-core on Backend.
803 815 if ( is_admin() ) {
804 816 add_action( 'before_thim_core_init', array( $this, 'check_thim_core_version_require' ) );
@@ -827,9 +839,9 @@
827 839 return;
828 840 }
829 841
830 842 // Call active purchase code for site.
831 - LP_Manager_Addons::instance()->active_site( $addon_slug, $purchase_code_content );
843 + AddonService::instance()->active_site( $addon_slug, $purchase_code_content );
832 844 }
833 845 }
834 846 }
835 847 );
@@ -896,9 +908,11 @@
896 908 return $links;
897 909 }
898 910
899 911 /**
900 - * Trigger this function while activating Learnpress.
912 + * Activation hook callback.
913 + *
914 + * Including creating database tables, default pages, registering CPTs and flushing rewrite rules.
901 915 *
902 916 * @since 3.0.0
903 917 * @version 4.1.4.1
904 918 */