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 +59 -19 4.4.0 → 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.0
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
@@ -18,17 +18,23 @@
18 18 use LearnPress\TemplateHooks\CourseBuilder\Course\BuilderCourseTemplate;
19 19 use LearnPress\TemplateHooks\CourseBuilder\Course\BuilderEditCourseTemplate;
20 20 use LearnPress\Ajax\AI\OpenAiAjax;
21 21 use LearnPress\Ajax\BuilderDashboardAjax;
22 +use LearnPress\Ajax\CourseToolsAjax;
22 23 use LearnPress\Ajax\CourseBuilder\CourseBuilderAjax;
23 24 use LearnPress\Ajax\EditCurriculumAjax;
25 +use LearnPress\Ajax\AddonsAjax;
26 +use LearnPress\Services\AddonService;
24 27 use LearnPress\Ajax\EditQuestionAjax;
25 28 use LearnPress\Ajax\EditQuizAjax;
26 29 use LearnPress\Ajax\Order\ExportOrderCSVAjax;
27 30 use LearnPress\Ajax\LessonAjax;
28 31 use LearnPress\Ajax\LoadContentViaAjax;
32 +use LearnPress\Ajax\SampleDataAJAX;
33 +use LearnPress\Ajax\SetupWizardAjax;
29 34 use LearnPress\Ajax\AI\AIAssistantAjax;
30 35 use LearnPress\Ajax\MCP\McpApiKeysAjax;
36 +use LearnPress\Ajax\Webhook\WebhooksAjax;
31 37 use LearnPress\Ajax\CourseBuilder\CBEditCourseAjax;
32 38 use LearnPress\Ajax\SendEmailAjax;
33 39 use LearnPress\Background\LPBackgroundTrigger;
34 40 use LearnPress\ExternalPlugin\Elementor\LPElementor;
@@ -45,11 +51,16 @@
45 51 use LearnPress\Shortcodes\CourseMaterialShortcode;
46 52 use LearnPress\Shortcodes\Courses\ListCoursesShortcode;
47 53 use LearnPress\Shortcodes\ListInstructorsShortcode;
48 54 use LearnPress\Shortcodes\SingleInstructorShortcode;
55 +use LearnPress\TemplateHooks\Admin\AdminAddonsPage;
49 56 use LearnPress\TemplateHooks\Admin\AdminEditQizTemplate;
50 57 use LearnPress\TemplateHooks\Admin\AdminEditQuestionTemplate;
51 58 use LearnPress\TemplateHooks\Admin\AdminListStudentsEnrolled;
59 +use LearnPress\TemplateHooks\Admin\AdminStatisticsReportTable;
60 +use LearnPress\TemplateHooks\Admin\Notices\AdminNotesTemplate;
61 +use LearnPress\TemplateHooks\Admin\Tools\AdminCourseTools;
62 +use LearnPress\Statistics\FilterOptionsProvider;
52 63 use LearnPress\TemplateHooks\Admin\AI\AdminCreateCourseAITemplate;
53 64 use LearnPress\TemplateHooks\Admin\AI\AdminEditCourseCurriculumWithAITemplate;
54 65 use LearnPress\TemplateHooks\Admin\AI\AdminEditWithAITemplate;
55 66 use LearnPress\TemplateHooks\Course\AdminEditCurriculumTemplate;
@@ -90,8 +101,9 @@
90 101 use LearnPress\TemplateHooks\Course\CourseAIAssistantTemplate;
91 102 use LearnPress\Widgets\LPRegisterWidget;
92 103 use LearnPress\WPGDPR\ErasePersonalData;
93 104 use LearnPress\WPGDPR\ExportPersonalData;
105 +use LearnPress\Webhook\WebhookDispatcher;
94 106
95 107 defined( 'ABSPATH' ) || exit();
96 108
97 109 if ( ! class_exists( 'LearnPress' ) ) {
@@ -173,8 +185,15 @@
173 185 public static $doc_link = 'https://learnpresslms.com/docs/';
174 186
175 187 /**
176 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.
177 196 */
178 197 private function __construct() {
179 198 /*if ( isset( $_POST['action'] ) && 'heartbeat' === $_POST['action'] ) {
180 199 return;
@@ -182,19 +201,22 @@
182 201
183 202 try {
184 203 $this->prepare_before_handle();
185 204
205 + register_activation_hook( LP_PLUGIN_FILE, array( $this, 'on_activate' ) );
206 + register_deactivation_hook( LP_PLUGIN_FILE, array( $this, 'on_deactivate' ) );
207 +
186 208 if ( ! LP_Install::instance()->tables_install_done() ) {
187 209 return;
188 210 }
189 211
190 - // Must handle in hook init of WordPress, when loaded plugins, theme, user.
212 + // init runs after WordPress core, plugins, theme and user are loaded.
191 213 add_action( 'init', [ $this, 'lp_main_handle' ], - 1000 );
192 214
193 - // hooks .
215 + // Register remaining plugin hooks.
194 216 $this->hooks();
195 217 } catch ( Throwable $e ) {
196 - error_log( __METHOD__ . ': ' . $e->getMessage() );
218 + LP_Debug::error_log( $e );
197 219 }
198 220 }
199 221
200 222 /**
@@ -390,8 +412,10 @@
390 412 AdminEditCurriculumTemplate::instance();
391 413 AdminEditSettingTemplate::instance();
392 414 AdminEditQizTemplate::instance();
393 415 AdminEditQuestionTemplate::instance();
416 + AdminNotesTemplate::instance();
417 + AdminCourseTools::instance();
394 418 CourseMaterialTemplate::instance();
395 419 CourseAIAssistantTemplate::instance();
396 420 AdminOrderItemsTemplate::instance();
397 421 AdminOrderListTemplate::instance();
@@ -398,8 +422,11 @@
398 422 AdminCreateCourseAITemplate::instance();
399 423 AdminEditWithAITemplate::instance();
400 424 AdminEditCourseCurriculumWithAITemplate::instance();
401 425 AdminListStudentsEnrolled::instance();
426 + AdminStatisticsReportTable::instance();
427 + FilterOptionsProvider::register_flush_hooks();
428 + AdminAddonsPage::instance();
402 429 // WP GDPR
403 430 ErasePersonalData::instance();
404 431 ExportPersonalData::instance();
405 432
@@ -480,10 +507,8 @@
480 507
481 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.
482 509 include_once 'inc/class-lp-request-handler.php';
483 510
484 - include_once 'inc/admin/helpers/class-lp-plugins-helper.php';
485 -
486 511 // Todo: tungnx check those files.
487 512 include_once 'inc/abstracts/abstract-object-query.php';
488 513 include_once 'inc/class-lp-course-query.php';
489 514 include_once 'inc/abstracts/abstract-addon.php';
@@ -503,8 +528,9 @@
503 528 include_once 'inc/order/class-lp-order.php';
504 529
505 530 include_once 'inc/user/lp-user-functions.php';
506 531 include_once 'inc/user/class-lp-user-factory.php';
532 + WebhookDispatcher::instance();
507 533 include_once 'inc/user/abstract-lp-user.php';
508 534 include_once 'inc/user/class-lp-user.php';
509 535 include_once 'inc/user/class-lp-profile.php';
510 536 include_once 'inc/user-item/class-lp-user-item.php';
@@ -569,10 +595,8 @@
569 595 }
570 596
571 597 include_once 'inc/admin/class-lp-admin-ajax.php';
572 598
573 - include_once 'inc/admin/class-lp-admin-notice.php';
574 -
575 599 // File handle install LP
576 600 include_once 'inc/class-lp-install.php';
577 601
578 602 // Meta box helper
@@ -750,8 +774,11 @@
750 774 'init',
751 775 function () {
752 776 LoadContentViaAjax::catch_lp_ajax();
753 777 LessonAjax::catch_lp_ajax();
778 + SampleDataAJAX::catch_lp_ajax();
779 + SetupWizardAjax::catch_lp_ajax();
780 + AddonsAjax::catch_lp_ajax();
754 781 EditCurriculumAjax::catch_lp_ajax();
755 782 EditQuizAjax::catch_lp_ajax();
756 783 EditQuestionAjax::catch_lp_ajax();
757 784 SendEmailAjax::catch_lp_ajax();
@@ -760,9 +787,11 @@
760 787 OpenAiAjax::catch_lp_ajax();
761 788 AIAssistantAjax::catch_lp_ajax();
762 789 ExportOrderCSVAjax::catch_lp_ajax();
763 790 McpApiKeysAjax::catch_lp_ajax();
791 + WebhooksAjax::catch_lp_ajax();
764 792 CBEditCourseAjax::catch_lp_ajax();
793 + CourseToolsAjax::catch_lp_ajax();
765 794
766 795 do_action( 'learn-press/register-ajax-handlers' );
767 796 },
768 797 11
@@ -770,12 +799,9 @@
770 799
771 800 // Add links setting|document|addon on plugins page.
772 801 add_filter( 'plugin_action_links_' . LP_PLUGIN_BASENAME, array( $this, 'plugin_links' ) );
773 802
774 - register_activation_hook( LP_PLUGIN_FILE, array( $this, 'on_activate' ) );
775 - register_deactivation_hook( LP_PLUGIN_FILE, array( $this, 'on_deactivate' ) );
776 -
777 - add_action(
803 + /*add_action(
778 804 'plugin_loaded',
779 805 function ( $plugin ) {
780 806 // For check wp_remote call normally of WP
781 807 if ( ! empty( LP_Request::get_param( 'lp_test_wp_remote' ) ) ) {
@@ -782,9 +808,9 @@
782 808 echo '[TEST_REMOTE]';
783 809 die;
784 810 }
785 811 }
786 - );
812 + );*/
787 813
788 814 // Check require version thim-core on Backend.
789 815 if ( is_admin() ) {
790 816 add_action( 'before_thim_core_init', array( $this, 'check_thim_core_version_require' ) );
@@ -813,9 +839,9 @@
813 839 return;
814 840 }
815 841
816 842 // Call active purchase code for site.
817 - LP_Manager_Addons::instance()->active_site( $addon_slug, $purchase_code_content );
843 + AddonService::instance()->active_site( $addon_slug, $purchase_code_content );
818 844 }
819 845 }
820 846 }
821 847 );
@@ -859,20 +885,34 @@
859 885 * @param array $links Array of action links
860 886 *
861 887 * @return array
862 888 * @since 4.3.11
863 - *
889 + * @version 1.0.1
864 890 */
865 891 public function plugin_links( array $links ): array {
866 - $links[] = sprintf( '<a href="%s">%s</a>', admin_url( 'admin.php?page=learn-press-settings' ), __( 'Settings', 'learnpress' ) );
867 - $links[] = sprintf( '<a href="%s" target="_blank">%s</a>', LearnPress::$doc_link, __( 'Documentation', 'learnpress' ) );
868 - $links[] = sprintf( '<a href="%s" target="_blank">%s</a>', get_admin_url() . '/admin.php?page=learn-press-addons', __( 'Add-ons', 'learnpress' ) );
892 + $links[] = sprintf(
893 + '<a href="%s">%s</a>',
894 + esc_url_raw( admin_url( 'admin.php?page=learn-press-settings' ) ),
895 + esc_html__( 'Settings', 'learnpress' )
896 + );
897 + $links[] = sprintf(
898 + '<a href="%s" target="_blank">%s</a>',
899 + esc_url_raw( LearnPress::$doc_link ),
900 + esc_html__( 'Documentation', 'learnpress' )
901 + );
902 + $links[] = sprintf(
903 + '<a href="%s" target="_blank">%s</a>',
904 + esc_url_raw( admin_url( 'admin.php?page=learn-press-addons' ) ),
905 + esc_html__( 'Add-ons', 'learnpress' )
906 + );
869 907
870 908 return $links;
871 909 }
872 910
873 911 /**
874 - * Trigger this function while activating Learnpress.
912 + * Activation hook callback.
913 + *
914 + * Including creating database tables, default pages, registering CPTs and flushing rewrite rules.
875 915 *
876 916 * @since 3.0.0
877 917 * @version 4.1.4.1
878 918 */