PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.4.0
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.4.0
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 4.2.0 All 139 releases
learnpress / inc / admin / class-lp-admin-assets.php

class-lp-admin-assets.php in LearnPress – WordPress LMS Plugin for Create and Sell Online Courses 4.4.0, at inc/admin/class-lp-admin-assets.php

690 lines 20.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 use LearnPress\Helpers\Config;
4 use LearnPress\Helpers\Template;
5 use LearnPress\Models\CourseModel;
6
7 /**
8 * Class LP_Admin_Assets
9 *
10 * Manage admin assets
11 */
12 class LP_Admin_Assets extends LP_Abstract_Assets {
13 protected static $_instance;
14
15 /**
16 * LP_Admin_Assets constructor.
17 */
18 protected function __construct() {
19 add_action( 'admin_footer', array( $this, 'add_elements_global' ) );
20 add_action( 'admin_print_scripts', array( $this, 'load_scripts_styles_on_head' ), - 1 );
21 parent::__construct();
22 }
23
24 /**
25 * Add javascript to head
26 * Add style to head
27 *
28 * @return void
29 * @version 1.0.0
30 * @since 4.2.5.6
31 */
32 public function load_scripts_styles_on_head() {
33 LP_Helper::print_inline_script_tag( 'lpDataAdmin', $this->localize_data_global(), array( 'id' => 'lpDataAdmin' ) );
34 LP_Helper::print_inline_script_tag( 'lpData', $this->localize_data_global(), array( 'id' => 'lpData' ) );
35 }
36
37 /**
38 * Localize data for all page backend.
39 *
40 * @return array
41 * @since 4.2.5.6
42 * @version 1.0.2
43 */
44 public function localize_data_global(): array {
45 $screen = function_exists( 'get_current_screen' ) ? get_current_screen() : null;
46
47 ob_start();
48 Template::instance()->get_admin_template( 'search-author-field.php' );
49 $html_search_author_field = ob_get_clean();
50
51 return apply_filters(
52 'learn-press/admin/localize-data-global',
53 array(
54 'site_url' => site_url(),
55 'user_id' => get_current_user_id(),
56 'is_admin' => current_user_can( ADMIN_ROLE ),
57 'theme' => get_stylesheet(),
58 'lp_version' => LP()->version,
59 'lp_rest_url' => get_rest_url(),
60 'lp_rest_load_ajax' => get_rest_url( null, 'lp/v1/load_content_via_ajax/' ), // @deprecated 4.3.0
61 'lpAjaxUrl' => LP_Settings::url_handle_lp_ajax(),
62 'nonce' => wp_create_nonce( 'wp_rest' ),
63 'courses_url' => learn_press_get_page_link( 'courses' ),
64 'urlParams' => lp_archive_skeleton_get_args(),
65 'i18n' => array(
66 'select_page' => esc_html__( 'Select page', 'learnpress' ),
67 'yes' => esc_html__( 'Yes' ),
68 'cancel' => esc_html__( 'Cancel' ),
69 'generate_with_ai' => esc_html__( 'Generate with AI', 'learnpress' ),
70 'confirm_close_ai' => esc_html__( 'Are you sure you want to close? Generate data will stop.', 'learnpress' ),
71 ),
72 'current_screen' => $screen ? $screen->id : '',
73 'show_search_author_field' => empty( $html_search_author_field ) ? 0 : $html_search_author_field,
74 'toast' => array(
75 'gravity' => 'bottom',
76 'position' => 'center',
77 'duration' => 3000,
78 'close' => 1,
79 'stopOnFocus' => 1,
80 'classPrefix' => 'lp-toast',
81 ),
82 'single_instructor_id' => learn_press_get_page_id( 'single_instructor' ),
83 'lpAi' => array(
84 'config' => Config::instance()->get( 'open-ai-modal', 'settings' ),
85 'modelImage' => LP_Settings::get_option( 'open_ai_image_model_type', 'dall-e-3' ),
86 ),
87 'enable_open_ai' => LP_Settings::get_option( 'enable_open_ai', 'no' ) === 'yes'
88 && ! empty( LP_Settings::get_option( 'open_ai_secret_key', '' ) ),
89 )
90 );
91 }
92
93 /**
94 * Get localize script
95 *
96 * @return array
97 */
98 protected function _get_script_data(): array {
99 $current_screen = get_current_screen();
100
101 return array(
102 'learn-press-global' => learn_press_global_script_params(),
103 'learn-press-meta-box-order' => apply_filters(
104 'learn-press/meta-box-order/script-data',
105 array(
106 'i18n_error' => esc_html__( 'Oops! Error.', 'learnpress' ),
107 'i18n_guest' => esc_html__( 'Guest', 'learnpress' ),
108 )
109 ),
110 'learn-press-update' => apply_filters(
111 'learn-press/upgrade/script-data',
112 array(
113 'i18n_confirm' => esc_html__(
114 'Before taking this action, we strongly recommend you backup your site first before proceeding. If you encounter any problems, please do not hesitate to contact our support team. Are you sure to proceed with the update protocol?',
115 'learnpress'
116 ),
117 )
118 ),
119 'lp-admin' => apply_filters(
120 'learn-press/admin/script-data',
121 array(
122 'ajax' => admin_url( 'admin-ajax.php' ),
123 'questionTypes' => learn_press_question_types(),
124 'supportAnswerOptions' => learn_press_get_question_support_answer_options(),
125 'screen' => $current_screen,
126 )
127 ),
128 'learn-press-admin-course-editor' => $this->get_course_data_for_editor_vue(),
129 );
130 }
131
132 /**
133 * Get default scripts in admin.
134 *
135 * @return mixed
136 */
137 protected function _get_scripts(): array {
138 $lp_admin_js = new LP_Asset_Key(
139 $this->url( 'js/dist/admin/admin' . self::$_min_assets . '.js' ),
140 array( 'wp-i18n', 'lp-utils', 'select2' ),
141 array(),
142 0,
143 0,
144 '',
145 array( 'strategy' => 'async' )
146 );
147 $lp_admin_js->exclude_screen(
148 array(
149 'plugin-install',
150 'learnpress_page_learn-press-statistics',
151 'learnpress_page_learn-press-addons',
152 )
153 );
154
155 $scripts = apply_filters(
156 'learn-press/admin-default-scripts',
157 array(
158 'lp-load-ajax' => new LP_Asset_Key(
159 self::url( 'js/dist/loadAJAX' . self::$_min_assets . '.js' ),
160 array(),
161 array(),
162 0,
163 0,
164 '',
165 array( 'strategy' => 'async' )
166 ),
167 // need build if change source vue
168 'vue-libs' => new LP_Asset_Key( $this->url( 'js/vendor/vue/vue_libs.js' ) ),
169 'select2' => new LP_Asset_Key( $this->url( 'src/js/vendor/select2.full.min.js' ) ),
170 'jquery-tipsy' => new LP_Asset_Key( $this->url( 'src/js/vendor/jquery/jquery-tipsy.js' ) ),
171 'html2pdf' => new LP_Asset_Key( $this->url( 'src/js/vendor/html2pdf.bundle.min.js' ) ),
172 'lp-utils' => new LP_Asset_Key(
173 $this->url( 'js/dist/utils' . self::$_min_assets . '.js' ),
174 array(),
175 array(),
176 1
177 ),
178 'dropdown-pages' => new LP_Asset_Key(
179 $this->url( self::$_folder_source . 'js/admin/share/dropdown-pages' . self::$_min_assets . '.js' ),
180 array( 'lp-utils', 'select2' )
181 ),
182 /*
183 'jquery-ui-timepicker-addon' => new LP_Asset_Key(
184 $this->url( 'src/js/vendor/jquery/jquery-ui-timepicker-addon.js' ),
185 array( 'jquery-ui-datepicker' )
186 ),*/
187 'lp-addons' => new LP_Asset_Key(
188 $this->url( 'js/dist/admin/addons' . self::$_min_assets . '.js' ),
189 array(),
190 array( 'learnpress_page_learn-press-addons' ),
191 0,
192 0,
193 '',
194 array( 'strategy' => 'async' )
195 ),
196 // 'advanced-list' => new LP_Asset_Key( $this->url( self::$_folder_source . 'js/admin/share/advanced-list' . self::$_min_assets . '.js' ) ),
197 'learn-press-global' => new LP_Asset_Key(
198 $this->url( self::$_folder_source . 'js/global' . self::$_min_assets . '.js' ),
199 array( 'jquery', 'underscore', 'utils', 'jquery-ui-sortable' )
200 ),
201 'lp-admin' => $lp_admin_js,
202 'lp-admin-mcp-api-keys' => new LP_Asset_Key(
203 $this->url( 'src/js/admin/mcp-api-keys.js' ),
204 array( 'lp-load-ajax' ),
205 array( 'learnpress_page_learn-press-settings' ),
206 0,
207 1,
208 '',
209 array( 'strategy' => 'defer' )
210 ),
211 'lp-admin-learnpress' => new LP_Asset_Key(
212 $this->url( 'js/dist/admin/learnpress' . self::$_min_assets . '.js' ),
213 array(
214 'learn-press-global',
215 'wp-color-picker',
216 'jquery-tipsy',
217 'dropdown-pages',
218 'wp-api-fetch',
219 // 'jquery-ui-timepicker-addon',
220 // 'select2'
221 ),
222 array(
223 LP_LESSON_CPT,
224 LP_QUIZ_CPT,
225 LP_COURSE_CPT,
226 // LP_ORDER_CPT,
227 'learnpress_page_learn-press-settings',
228 ),
229 0,
230 1,
231 '',
232 array( 'strategy' => 'defer' )
233 ),
234 'lp-duplicate-post' => new LP_Asset_Key(
235 $this->url( self::$_folder_source . 'js/admin/lp-duplicate-post' . self::$_min_assets . '.js' ),
236 array( 'jquery' ),
237 array(
238 'edit-' . LP_COURSE_CPT,
239 'edit-' . LP_LESSON_CPT,
240 'edit-' . LP_QUESTION_CPT,
241 'edit-' . LP_QUIZ_CPT,
242 ),
243 0,
244 1
245 ),
246 /*
247 'learn-press-admin-course-editor' => new LP_Asset_Key(
248 $this->url( 'js/dist/admin/editor/course' . self::$_min_assets . '.js' ),
249 array( 'vue-libs', 'lp-utils' ),
250 array( LP_COURSE_CPT ),
251 0,
252 0
253 ),*/
254 'lp-admin-courses' => new LP_Asset_Key(
255 $this->url( 'dist/js/admin/admin-courses' . self::$_min_assets . '.js' ),
256 array( 'lp-load-ajax', 'wp-i18n' ),
257 array( 'edit-' . LP_COURSE_CPT ),
258 0,
259 0,
260 '',
261 array( 'strategy' => 'async' )
262 ),
263 'lp-edit-course' => new LP_Asset_Key(
264 $this->url( 'dist/js/admin/edit-course' . self::$_min_assets . '.js' ),
265 array( 'lp-load-ajax' ),
266 array(),
267 1,
268 0,
269 '',
270 array( 'strategy' => 'async' )
271 ),
272 'lp-edit-quiz' => new LP_Asset_Key(
273 $this->url( 'dist/js/admin/edit-quiz' . self::$_min_assets . '.js' ),
274 array( 'lp-load-ajax' ),
275 array(),
276 1,
277 0,
278 '',
279 array( 'strategy' => 'async' )
280 ),
281 'lp-edit-question' => new LP_Asset_Key(
282 $this->url( 'dist/js/admin/edit-question' . self::$_min_assets . '.js' ),
283 array( 'lp-load-ajax' ),
284 array(),
285 1,
286 0,
287 '',
288 array( 'strategy' => 'async' )
289 ),
290 /*
291 'learn-press-admin-quiz-editor' => new LP_Asset_Key(
292 $this->url( 'js/dist/admin/editor/quiz' . self::$_min_assets . '.js' ),
293 array( 'vue-libs', 'lp-utils' ),
294 array( LP_QUIZ_CPT ),
295 0,
296 0
297 ),*/
298 /*
299 'learn-press-admin-question-editor' => new LP_Asset_Key(
300 $this->url( 'js/dist/admin/editor/question' . self::$_min_assets . '.js' ),
301 array( 'vue-libs', 'lodash', 'lp-utils' ),
302 array( LP_QUESTION_CPT ),
303 0,
304 0
305 ),*/
306 /*
307 'learn-press-meta-box-order' => new LP_Asset_Key(
308 $this->url( self::$_folder_source . 'js/admin/partial/meta-box-order' . self::$_min_assets . '.js' ),
309 array(
310 'vue-libs',
311 'advanced-list',
312 //'lp-modal-search-courses',
313 //'lp-modal-search-users',
314 ),
315 array( LP_ORDER_CPT ),
316 0,
317 1
318 ),*/
319 'lp-admin-order' => new LP_Asset_Key(
320 $this->url( 'js/dist/admin/admin-order' . self::$_min_assets . '.js' ),
321 array( 'html2pdf', 'lp-load-ajax' ),
322 array( LP_ORDER_CPT ),
323 0,
324 0,
325 '',
326 array( 'strategy' => 'defer' )
327 ),
328 'lp-admin-orders' => new LP_Asset_Key(
329 $this->url( 'js/dist/admin/admin-orders' . self::$_min_assets . '.js' ),
330 array(),
331 array( 'edit-' . LP_ORDER_CPT ),
332 0,
333 0,
334 '',
335 array( 'strategy' => 'async' )
336 ),
337
338 /*
339 'learn-press-sync-data' => new LP_Asset_Key(
340 $this->url( 'js/dist/admin/pages/sync-data' . self::$_min_assets . '.js' ),
341 array(),
342 array( 'learnpress_page_learn-press-tools' ),
343 0,
344 1
345 ),*/
346 /*
347 'lp-setup' => new LP_Asset_Key(
348 $this->url( 'js/dist/admin/pages/setup' . self::$_min_assets . '.js' ),
349 array( 'jquery', 'dropdown-pages' ),
350 array( 'lp-page-setup' ),
351 0,
352 1
353 ),*/
354 /*
355 'learn-press-statistic' => new LP_Asset_Key(
356 $this->url( 'js/dist/admin/pages/statistic' . self::$_min_assets . '.js' ),
357 array( 'jquery', 'jquery-ui-datepicker', 'chart' ),
358 array( 'learnpress_page_learn-press-statistics' ),
359 0,
360 1
361 ),*/
362 /*
363 'lp-modal-search-courses' => new LP_Asset_Key(
364 $this->url( self::$_folder_source . 'js/admin/share/modal-search-courses' . self::$_min_assets . '.js' ),
365 array(
366 'vue-libs',
367 'jquery',
368 ),
369 array( LP_ORDER_CPT ),
370 1,
371 1
372 ),*/
373 /*
374 'lp-modal-search-users' => new LP_Asset_Key(
375 $this->url( self::$_folder_source . 'js/admin/share/modal-search-users' . self::$_min_assets . '.js' ),
376 array( 'jquery' ),
377 array( LP_ORDER_CPT ),
378 1,
379 1
380 ),*/
381 'lp-tools-course-tab' => new LP_Asset_Key(
382 $this->url( 'js/dist/admin/pages/tools' . self::$_min_assets . '.js' ),
383 array(
384 'jquery',
385 'wp-element',
386 'wp-compose',
387 'wp-components',
388 'wp-data',
389 'wp-hooks',
390 'wp-api-fetch',
391 'lodash',
392 'vue-libs',
393
394 ),
395 array( 'learnpress_page_learn-press-tools' ),
396 0,
397 1,
398 '',
399 array( 'strategy' => 'defer' )
400 ),
401 /*
402 'lp-dashboard' => new LP_Asset_Key(
403 self::url( 'js/dist/admin/pages/dashboard' . self::$_min_assets . '.js' ),
404 [],
405 array( 'dashboard' ),
406 0,
407 1
408 ),*/
409 'lp-widgets-admin' => new LP_Asset_Key(
410 self::url( 'js/dist/admin/pages/widgets' . self::$_min_assets . '.js' ),
411 array(
412 'wp-url',
413 'wp-api-fetch',
414 'lodash',
415 'select2',
416 ),
417 array( 'widgets', 'elementor' ),
418 0,
419 1
420 ),
421 'lp-admin-notices' => new LP_Asset_Key(
422 self::url( 'js/dist/admin/admin-notices' . self::$_min_assets . '.js' ),
423 array(),
424 array(),
425 1,
426 0,
427 '',
428 array( 'strategy' => 'async' )
429 ),
430 'lp-material' => new LP_Asset_Key(
431 $this->url( 'js/dist/admin/course-material' . self::$_min_assets . '.js' ),
432 array(),
433 array(
434 LP_COURSE_CPT,
435 LP_LESSON_CPT,
436 ),
437 0,
438 1
439 ),
440 'lp-list-students-enrolled' => new LP_Asset_Key(
441 $this->url( 'dist/js/admin/list-students-enrolled' . self::$_min_assets . '.js' ),
442 array( 'lp-load-ajax' ),
443 array( 'learnpress_page_learn-press-students-enrolled' ),
444 0,
445 0,
446 '',
447 array( 'strategy' => 'async' )
448 ),
449 'lp-admin-tools' => new LP_Asset_Key(
450 $this->url( 'js/dist/admin/admin-tools' . self::$_min_assets . '.js' ),
451 array(),
452 array( 'learnpress_page_learn-press-tools' ),
453 0,
454 1,
455 '',
456 array( 'strategy' => 'defer' )
457 ),
458 'lp-admin-statistic' => new LP_Asset_Key(
459 $this->url( 'js/dist/admin/admin-statistic' . self::$_min_assets . '.js' ),
460 array( 'wp-api-fetch' ),
461 array( 'learnpress_page_learn-press-statistics' ),
462 0,
463 0,
464 '',
465 array( 'strategy' => 'defer' )
466 ),
467 )
468 );
469
470 /*
471 $screen = function_exists( 'get_current_screen' ) ? get_current_screen() : null;
472 if ( $screen && $screen->id === 'site-editor' ) {
473 $scripts['editor-check'] = new LP_Asset_Key(
474 self::url( 'js/dist/gutenberg/editor-check' . self::$_min_assets . '.js' ),
475 array(
476 'wp-data',
477 'wp-edit-post',
478 'wp-editor',
479 ),
480 [],
481 0,
482 0,
483 '1.0.0',
484 [ 'strategy' => 'defer' ]
485 );
486 }*/
487
488 return $scripts;
489 }
490
491 /**
492 * Get default styles in admin.
493 *
494 * @return mixed
495 */
496 protected function _get_styles(): array {
497 $is_rtl = is_rtl() ? '-rtl' : '';
498
499 return apply_filters(
500 'learn-press/admin-default-styles',
501 array(
502 'select2' => new LP_Asset_Key(
503 $this->url( 'src/css/vendor/select2.min.css' )
504 ),
505 /*
506 'font-awesome' => new LP_Asset_Key(
507 $this->url( 'src/css/vendor/font-awesome-5.min.css' )
508 ),*/
509 /*
510 'jquery-ui' => new LP_Asset_Key(
511 $this->url( 'src/css/vendor/jquery-ui/jquery-ui.min.css' )
512 ),
513 'jquery-ui-timepicker' => new LP_Asset_Key(
514 $this->url( 'src/css/vendor/jquery-ui-timepicker-addon.css' )
515 ),*/
516 'jquery-tipsy' => new LP_Asset_Key(
517 $this->url( 'src/css/vendor/jquery.tipsy.css' )
518 ),
519 'learn-press-admin' => new LP_Asset_Key(
520 $this->url( 'css/admin/admin' . $is_rtl . self::$_min_assets . '.css' ),
521 array(
522 'wp-color-picker',
523 'wp-components',
524 // 'select2',
525 // 'jquery-ui',
526 // 'jquery-ui-timepicker',
527 // 'font-awesome',
528 'jquery-tipsy',
529 ),
530 array(),
531 0
532 ),
533 'lp-edit-curriculum' => new LP_Asset_Key(
534 $this->url( 'css/edit-curriculum' . $is_rtl . self::$_min_assets . '.css' ),
535 array(),
536 array(),
537 1
538 ),
539 'lp-edit-quiz' => new LP_Asset_Key(
540 $this->url( 'css/edit-quiz' . $is_rtl . self::$_min_assets . '.css' ),
541 array(),
542 array(),
543 1
544 ),
545 'lp-edit-question' => new LP_Asset_Key(
546 $this->url( 'css/edit-question' . $is_rtl . self::$_min_assets . '.css' ),
547 array(),
548 array(),
549 1
550 ),
551 'learn-press-statistic' => new LP_Asset_Key(
552 LP_CSS_URL . 'admin/statistic' . $is_rtl . self::$_min_assets . '.css',
553 array(),
554 array( 'learners_page_learn-press-statistics' ),
555 0
556 ),
557 'lp-tom-select' => new LP_Asset_Key(
558 $this->url( 'src/css/vendor/tom-select.min.css' ),
559 array(),
560 array(),
561 0
562 ),
563 )
564 );
565 }
566
567 /**
568 * Register and enqueue needed js and styles
569 */
570 public function load_scripts() {
571 $screen_id = LP_Admin::instance()->get_screen_id();
572
573 if ( empty( $screen_id ) ) {
574 return;
575 }
576
577 // wp_enqueue_media(); //Todo: tungnx need check why call for that using.
578 $this->handle_js( $screen_id );
579 $this->handle_style( $screen_id );
580
581 do_action( 'learn-press/admin/after-enqueue-scripts' );
582 }
583
584 /**
585 * Show overlay
586 */
587 public function add_elements_global() {
588 echo '<div class="lp-overlay">';
589 apply_filters( 'learnpress/admin/modal-dialog', learn_press_get_template( 'global/lp-modal-overlay' ) );
590 echo '</div>';
591
592 apply_filters( 'learnpress/admin/steps', learn_press_get_template( 'global/lp-group-step' ) );
593
594 // Added notify message when action done.
595 Template::instance()->get_admin_template( 'global/notify-action.php' );
596 }
597
598 /**
599 * Get course data for Vue Editor Course use.
600 *
601 * @return array|mixed|null
602 */
603 public function get_course_data_for_editor_vue() {
604 global $post, $pagenow;
605
606 if ( empty( $post ) || ( get_post_type() !== LP_COURSE_CPT ) || ! in_array(
607 $pagenow,
608 array(
609 'post.php',
610 'post-new.php',
611 )
612 ) ) {
613 return array();
614 }
615
616 $course = CourseModel::find( $post->ID, true );
617 if ( $course ) {
618 $course_section_items = $course->get_section_items();
619 } else { // Code old if not found course on the table learnpress_courses.
620 $course = learn_press_get_course( $post->ID );
621 $course_section_items = $course->get_curriculum_raw();
622 }
623 $hidden_sections = get_post_meta( $post->ID, '_admin_hidden_sections', true );
624
625 return apply_filters(
626 'learn-press/admin-localize-course-editor',
627 array(
628 'root' => array(
629 'course_id' => $post->ID,
630 'auto_draft' => get_post_status( $post->ID ) == 'auto-draft',
631 'ajax' => admin_url( 'index.php' ),
632 'disable_curriculum' => false,
633 'action' => 'admin_course_editor',
634 'nonce' => wp_create_nonce( 'learnpress_update_curriculum' ),
635 ),
636 'chooseItems' => array(
637 'types' => learn_press_course_get_support_item_types(),
638 'open' => false,
639 'addedItems' => array(),
640 'items' => array(),
641 ),
642 'i18n' => array(
643 'item' => __( 'item', 'learnpress' ),
644 'new_section_item' => __( 'Create a new', 'learnpress' ),
645 'back' => __( 'Back', 'learnpress' ),
646 'selected_items' => __( 'Selected items', 'learnpress' ),
647 'confirm_remove_item' => __( 'Do you want to remove the "{{ITEM_NAME}}" item from the course?', 'learnpress' ),
648 'confirm_trash_item' => __( 'Do you want to move the "{{ITEM_NAME}}" item to the trash?', 'learnpress' ),
649 'item_labels' => array(
650 'singular' => __( 'Item', 'learnpress' ),
651 'plural' => __( 'Items', 'learnpress' ),
652 ),
653 'notice_sale_price' => __( 'The course sale price must be less than the regular price', 'learnpress' ),
654 'notice_price' => __( 'The course price must be greater than the sale price', 'learnpress' ),
655 'notice_sale_start_date' => __( 'The sale start date must be before the sale end date', 'learnpress' ),
656 'notice_sale_end_date' => __( 'The sale end date must be after the sale start date', 'learnpress' ),
657 'notice_invalid_date' => __( 'Invalid date', 'learnpress' ),
658 ),
659 'sections' => array(
660 'sections' => $course_section_items,
661 'hidden_sections' => ! empty( $hidden_sections ) ? $hidden_sections : array(),
662 'urlEdit' => admin_url( 'post.php?action=edit&post=' ),
663 ),
664 )
665 );
666 }
667
668 public static function instance() {
669 if ( ! is_admin() ) {
670 return null;
671 }
672
673 if ( ! self::$_instance ) {
674 self::$_instance = new self();
675 }
676
677 return self::$_instance;
678 }
679 }
680
681 /**
682 * Shortcut function to get instance of LP_Admin_Assets
683 *
684 * @return LP_Admin_Assets|null
685 * Addon Certificate, Import/Export is using.
686 */
687 function learn_press_admin_assets() {
688 return LP_Admin_Assets::instance();
689 }
690