PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.4.2
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.4.2
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.2, at inc/admin/class-lp-admin-assets.php

701 lines 20.9 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 // @deprecated tag 'learn-press-admin-course-editor' 4.4.2 - no any enqueue js for that.
129 //'learn-press-admin-course-editor' => $this->get_course_data_for_editor_vue(),
130 );
131 }
132
133 /**
134 * Get default scripts in admin.
135 *
136 * @return mixed
137 */
138 protected function _get_scripts(): array {
139 $lp_admin_js = new LP_Asset_Key(
140 $this->url( 'js/dist/admin/admin' . self::$_min_assets . '.js' ),
141 array( 'wp-i18n', 'lp-utils' ),
142 array(),
143 0,
144 0,
145 '',
146 array( 'strategy' => 'async' )
147 );
148 $lp_admin_js->exclude_screen(
149 array(
150 'plugin-install',
151 'learnpress_page_learn-press-statistics',
152 'learnpress_page_learn-press-addons',
153 )
154 );
155
156 $scripts = apply_filters(
157 'learn-press/admin-default-scripts',
158 array(
159 'lp-load-ajax' => new LP_Asset_Key(
160 self::url( 'js/dist/loadAJAX' . self::$_min_assets . '.js' ),
161 array(),
162 array(),
163 0,
164 0,
165 '',
166 array( 'strategy' => 'async' )
167 ),
168 // need build if change source vue
169 'vue-libs' => new LP_Asset_Key( $this->url( 'js/vendor/vue/vue_libs.js' ) ),
170 //'select2' => new LP_Asset_Key( $this->url( 'src/js/vendor/select2.full.min.js' ) ),
171 'jquery-tipsy' => new LP_Asset_Key( $this->url( 'src/js/vendor/jquery/jquery-tipsy.js' ) ),
172 'html2pdf' => new LP_Asset_Key( $this->url( 'src/js/vendor/html2pdf.bundle.min.js' ) ),
173 'lp-utils' => new LP_Asset_Key(
174 $this->url( 'js/dist/utils' . self::$_min_assets . '.js' ),
175 array(),
176 array(),
177 1
178 ),
179 /*'dropdown-pages' => new LP_Asset_Key(
180 $this->url( self::$_folder_source . 'js/admin/share/dropdown-pages' . self::$_min_assets . '.js' ),
181 array( 'lp-utils', 'select2' )
182 ),*/
183 /*
184 'jquery-ui-timepicker-addon' => new LP_Asset_Key(
185 $this->url( 'src/js/vendor/jquery/jquery-ui-timepicker-addon.js' ),
186 array( 'jquery-ui-datepicker' )
187 ),*/
188 'lp-addons' => new LP_Asset_Key(
189 $this->url( 'js/dist/admin/addons' . self::$_min_assets . '.js' ),
190 array(),
191 array( 'learnpress_page_learn-press-addons' ),
192 0,
193 0,
194 '',
195 array( 'strategy' => 'async' )
196 ),
197 // 'advanced-list' => new LP_Asset_Key( $this->url( self::$_folder_source . 'js/admin/share/advanced-list' . self::$_min_assets . '.js' ) ),
198 'learn-press-global' => new LP_Asset_Key(
199 $this->url( self::$_folder_source . 'js/global' . self::$_min_assets . '.js' ),
200 array( 'jquery', 'underscore', 'utils', 'jquery-ui-sortable' )
201 ),
202 'lp-admin' => $lp_admin_js,
203 'lp-admin-mcp-api-keys' => new LP_Asset_Key(
204 $this->url( 'js/dist/admin/mcp-api-keys.js' ),
205 [ 'lp-load-ajax' ],
206 [ 'learnpress_page_learn-press-settings' ],
207 0,
208 1,
209 '',
210 array( 'strategy' => 'defer' )
211 ),
212 'lp-admin-webhooks' => new LP_Asset_Key(
213 $this->url( 'js/dist/admin/webhooks.js' ),
214 [ 'lp-load-ajax', 'lp-admin' ],
215 [ 'learnpress_page_learn-press-settings' ],
216 0,
217 1,
218 '',
219 [ 'strategy' => 'defer' ]
220 ),
221 'lp-admin-learnpress' => new LP_Asset_Key(
222 $this->url( 'js/dist/admin/learnpress' . self::$_min_assets . '.js' ),
223 array(
224 'learn-press-global',
225 'wp-color-picker',
226 'jquery-tipsy',
227 //'dropdown-pages',
228 'wp-api-fetch',
229 // 'jquery-ui-timepicker-addon',
230 // 'select2'
231 ),
232 array(
233 LP_LESSON_CPT,
234 LP_QUIZ_CPT,
235 LP_COURSE_CPT,
236 // LP_ORDER_CPT,
237 'learnpress_page_learn-press-settings',
238 ),
239 0,
240 1,
241 '',
242 array( 'strategy' => 'defer' )
243 ),
244 'lp-duplicate-post' => new LP_Asset_Key(
245 $this->url( self::$_folder_source . 'js/admin/lp-duplicate-post' . self::$_min_assets . '.js' ),
246 array( 'jquery' ),
247 array(
248 'edit-' . LP_COURSE_CPT,
249 'edit-' . LP_LESSON_CPT,
250 'edit-' . LP_QUESTION_CPT,
251 'edit-' . LP_QUIZ_CPT,
252 ),
253 0,
254 1
255 ),
256 /*
257 'learn-press-admin-course-editor' => new LP_Asset_Key(
258 $this->url( 'js/dist/admin/editor/course' . self::$_min_assets . '.js' ),
259 array( 'vue-libs', 'lp-utils' ),
260 array( LP_COURSE_CPT ),
261 0,
262 0
263 ),*/
264 'lp-admin-courses' => new LP_Asset_Key(
265 $this->url( 'dist/js/admin/admin-courses' . self::$_min_assets . '.js' ),
266 array( 'lp-load-ajax', 'wp-i18n' ),
267 array( 'edit-' . LP_COURSE_CPT ),
268 0,
269 0,
270 '',
271 array( 'strategy' => 'async' )
272 ),
273 'lp-edit-course' => new LP_Asset_Key(
274 $this->url( 'dist/js/admin/edit-course' . self::$_min_assets . '.js' ),
275 array( 'lp-load-ajax' ),
276 array(),
277 1,
278 0,
279 '',
280 array( 'strategy' => 'async' )
281 ),
282 'lp-edit-quiz' => new LP_Asset_Key(
283 $this->url( 'dist/js/admin/edit-quiz' . self::$_min_assets . '.js' ),
284 array( 'lp-load-ajax' ),
285 array(),
286 1,
287 0,
288 '',
289 array( 'strategy' => 'async' )
290 ),
291 'lp-edit-question' => new LP_Asset_Key(
292 $this->url( 'dist/js/admin/edit-question' . self::$_min_assets . '.js' ),
293 array( 'lp-load-ajax' ),
294 array(),
295 1,
296 0,
297 '',
298 array( 'strategy' => 'async' )
299 ),
300 /*
301 'learn-press-admin-quiz-editor' => new LP_Asset_Key(
302 $this->url( 'js/dist/admin/editor/quiz' . self::$_min_assets . '.js' ),
303 array( 'vue-libs', 'lp-utils' ),
304 array( LP_QUIZ_CPT ),
305 0,
306 0
307 ),*/
308 /*
309 'learn-press-admin-question-editor' => new LP_Asset_Key(
310 $this->url( 'js/dist/admin/editor/question' . self::$_min_assets . '.js' ),
311 array( 'vue-libs', 'lodash', 'lp-utils' ),
312 array( LP_QUESTION_CPT ),
313 0,
314 0
315 ),*/
316 /*
317 'learn-press-meta-box-order' => new LP_Asset_Key(
318 $this->url( self::$_folder_source . 'js/admin/partial/meta-box-order' . self::$_min_assets . '.js' ),
319 array(
320 'vue-libs',
321 'advanced-list',
322 //'lp-modal-search-courses',
323 //'lp-modal-search-users',
324 ),
325 array( LP_ORDER_CPT ),
326 0,
327 1
328 ),*/
329 'lp-admin-order' => new LP_Asset_Key(
330 $this->url( 'js/dist/admin/admin-order' . self::$_min_assets . '.js' ),
331 array( 'html2pdf', 'lp-load-ajax' ),
332 array( LP_ORDER_CPT ),
333 0,
334 0,
335 '',
336 array( 'strategy' => 'defer' )
337 ),
338 'lp-admin-orders' => new LP_Asset_Key(
339 $this->url( 'js/dist/admin/admin-orders' . self::$_min_assets . '.js' ),
340 array(),
341 array( 'edit-' . LP_ORDER_CPT ),
342 0,
343 0,
344 '',
345 array( 'strategy' => 'async' )
346 ),
347
348 /*
349 'learn-press-sync-data' => new LP_Asset_Key(
350 $this->url( 'js/dist/admin/pages/sync-data' . self::$_min_assets . '.js' ),
351 array(),
352 array( 'learnpress_page_learn-press-tools' ),
353 0,
354 1
355 ),*/
356 /*
357 'lp-setup' => new LP_Asset_Key(
358 $this->url( 'js/dist/admin/pages/setup' . self::$_min_assets . '.js' ),
359 array( 'jquery', 'dropdown-pages' ),
360 array( 'lp-page-setup' ),
361 0,
362 1
363 ),*/
364 /*
365 'learn-press-statistic' => new LP_Asset_Key(
366 $this->url( 'js/dist/admin/pages/statistic' . self::$_min_assets . '.js' ),
367 array( 'jquery', 'jquery-ui-datepicker', 'chart' ),
368 array( 'learnpress_page_learn-press-statistics' ),
369 0,
370 1
371 ),*/
372 /*
373 'lp-modal-search-courses' => new LP_Asset_Key(
374 $this->url( self::$_folder_source . 'js/admin/share/modal-search-courses' . self::$_min_assets . '.js' ),
375 array(
376 'vue-libs',
377 'jquery',
378 ),
379 array( LP_ORDER_CPT ),
380 1,
381 1
382 ),*/
383 /*
384 'lp-modal-search-users' => new LP_Asset_Key(
385 $this->url( self::$_folder_source . 'js/admin/share/modal-search-users' . self::$_min_assets . '.js' ),
386 array( 'jquery' ),
387 array( LP_ORDER_CPT ),
388 1,
389 1
390 ),*/
391 'lp-tools-course-tab' => new LP_Asset_Key(
392 $this->url( 'js/dist/admin/pages/tools' . self::$_min_assets . '.js' ),
393 array(
394 'jquery',
395 'wp-element',
396 'wp-compose',
397 'wp-components',
398 'wp-data',
399 'wp-hooks',
400 'wp-api-fetch',
401 'lodash',
402 'vue-libs',
403
404 ),
405 array( 'learnpress_page_learn-press-tools' ),
406 0,
407 1,
408 '',
409 array( 'strategy' => 'defer' )
410 ),
411 /*
412 'lp-dashboard' => new LP_Asset_Key(
413 self::url( 'js/dist/admin/pages/dashboard' . self::$_min_assets . '.js' ),
414 [],
415 array( 'dashboard' ),
416 0,
417 1
418 ),*/
419 'lp-widgets-admin' => new LP_Asset_Key(
420 self::url( 'js/dist/admin/pages/widgets' . self::$_min_assets . '.js' ),
421 array(
422 'wp-url',
423 'wp-api-fetch',
424 'lodash',
425 'select2',
426 ),
427 array( 'widgets', 'elementor' ),
428 0,
429 1
430 ),
431 'lp-admin-notices' => new LP_Asset_Key(
432 self::url( 'js/dist/admin/admin-notices' . self::$_min_assets . '.js' ),
433 array(),
434 array(),
435 1,
436 0,
437 '',
438 array( 'strategy' => 'async' )
439 ),
440 'lp-material' => new LP_Asset_Key(
441 $this->url( 'js/dist/admin/course-material' . self::$_min_assets . '.js' ),
442 array(),
443 array(
444 LP_COURSE_CPT,
445 LP_LESSON_CPT,
446 ),
447 0,
448 1
449 ),
450 'lp-list-students-enrolled' => new LP_Asset_Key(
451 $this->url( 'dist/js/admin/list-students-enrolled' . self::$_min_assets . '.js' ),
452 array( 'lp-load-ajax' ),
453 array( 'learnpress_page_learn-press-students-enrolled' ),
454 0,
455 0,
456 '',
457 array( 'strategy' => 'async' )
458 ),
459 'lp-admin-tools' => new LP_Asset_Key(
460 $this->url( 'js/dist/admin/admin-tools' . self::$_min_assets . '.js' ),
461 array(),
462 array( 'learnpress_page_learn-press-tools' ),
463 0,
464 1,
465 '',
466 array( 'strategy' => 'defer' )
467 ),
468 'lp-admin-statistic' => new LP_Asset_Key(
469 $this->url( 'js/dist/admin/admin-statistic' . self::$_min_assets . '.js' ),
470 array( 'wp-api-fetch' ),
471 array( 'learnpress_page_learn-press-statistics' ),
472 0,
473 0,
474 '',
475 array( 'strategy' => 'defer' )
476 ),
477 )
478 );
479
480 /*
481 $screen = function_exists( 'get_current_screen' ) ? get_current_screen() : null;
482 if ( $screen && $screen->id === 'site-editor' ) {
483 $scripts['editor-check'] = new LP_Asset_Key(
484 self::url( 'js/dist/gutenberg/editor-check' . self::$_min_assets . '.js' ),
485 array(
486 'wp-data',
487 'wp-edit-post',
488 'wp-editor',
489 ),
490 [],
491 0,
492 0,
493 '1.0.0',
494 [ 'strategy' => 'defer' ]
495 );
496 }*/
497
498 return $scripts;
499 }
500
501 /**
502 * Get default styles in admin.
503 *
504 * @return mixed
505 */
506 protected function _get_styles(): array {
507 $is_rtl = is_rtl() ? '-rtl' : '';
508
509 return apply_filters(
510 'learn-press/admin-default-styles',
511 array(
512 /*'select2' => new LP_Asset_Key(
513 $this->url( 'src/css/vendor/select2.min.css' )
514 ),*/
515 /*
516 'font-awesome' => new LP_Asset_Key(
517 $this->url( 'src/css/vendor/font-awesome-5.min.css' )
518 ),*/
519 /*
520 'jquery-ui' => new LP_Asset_Key(
521 $this->url( 'src/css/vendor/jquery-ui/jquery-ui.min.css' )
522 ),
523 'jquery-ui-timepicker' => new LP_Asset_Key(
524 $this->url( 'src/css/vendor/jquery-ui-timepicker-addon.css' )
525 ),*/
526 'jquery-tipsy' => new LP_Asset_Key(
527 $this->url( 'src/css/vendor/jquery.tipsy.css' )
528 ),
529 'learn-press-admin' => new LP_Asset_Key(
530 $this->url( 'css/admin/admin' . $is_rtl . self::$_min_assets . '.css' ),
531 array(
532 'wp-color-picker',
533 'wp-components',
534 // 'select2',
535 // 'jquery-ui',
536 // 'jquery-ui-timepicker',
537 // 'font-awesome',
538 'jquery-tipsy',
539 ),
540 array(),
541 0
542 ),
543 'lp-edit-curriculum' => new LP_Asset_Key(
544 $this->url( 'css/edit-curriculum' . $is_rtl . self::$_min_assets . '.css' ),
545 array(),
546 array(),
547 1
548 ),
549 'lp-edit-quiz' => new LP_Asset_Key(
550 $this->url( 'css/edit-quiz' . $is_rtl . self::$_min_assets . '.css' ),
551 array(),
552 array(),
553 1
554 ),
555 'lp-edit-question' => new LP_Asset_Key(
556 $this->url( 'css/edit-question' . $is_rtl . self::$_min_assets . '.css' ),
557 array(),
558 array(),
559 1
560 ),
561 'learn-press-statistic' => new LP_Asset_Key(
562 LP_CSS_URL . 'admin/statistic' . $is_rtl . self::$_min_assets . '.css',
563 array(),
564 array( 'learners_page_learn-press-statistics' ),
565 0
566 ),
567 'lp-tom-select' => new LP_Asset_Key(
568 $this->url( 'src/css/vendor/tom-select.min.css' ),
569 array(),
570 array(),
571 0
572 ),
573 )
574 );
575 }
576
577 /**
578 * Register and enqueue needed js and styles
579 */
580 public function load_scripts() {
581 $screen_id = LP_Admin::instance()->get_screen_id();
582
583 if ( empty( $screen_id ) ) {
584 return;
585 }
586
587 // wp_enqueue_media(); //Todo: tungnx need check why call for that using.
588 $this->handle_js( $screen_id );
589 $this->handle_style( $screen_id );
590
591 do_action( 'learn-press/admin/after-enqueue-scripts' );
592 }
593
594 /**
595 * Show overlay
596 */
597 public function add_elements_global() {
598 echo '<div class="lp-overlay">';
599 apply_filters( 'learnpress/admin/modal-dialog', learn_press_get_template( 'global/lp-modal-overlay' ) );
600 echo '</div>';
601
602 apply_filters( 'learnpress/admin/steps', learn_press_get_template( 'global/lp-group-step' ) );
603
604 // Added notify message when action done.
605 Template::instance()->get_admin_template( 'global/notify-action.php' );
606 }
607
608 /**
609 * Get course data for Vue Editor Course use.
610 *
611 * @return array|mixed|null
612 * @deprecated 4.4.2 - no any enqueue js for that.
613 */
614 /*public function get_course_data_for_editor_vue() {
615 global $post, $pagenow;
616
617 if ( empty( $post ) || ( get_post_type() !== LP_COURSE_CPT ) || ! in_array(
618 $pagenow,
619 array(
620 'post.php',
621 'post-new.php',
622 )
623 ) ) {
624 return array();
625 }
626
627 $course = CourseModel::find( $post->ID, true );
628 if ( $course ) {
629 $course_section_items = $course->get_section_items();
630 } else { // Code old if not found course on the table learnpress_courses.
631 $course = learn_press_get_course( $post->ID );
632 $course_section_items = $course->get_curriculum_raw();
633 }
634 $hidden_sections = get_post_meta( $post->ID, '_admin_hidden_sections', true );
635
636 return apply_filters(
637 'learn-press/admin-localize-course-editor',
638 array(
639 'root' => array(
640 'course_id' => $post->ID,
641 'auto_draft' => get_post_status( $post->ID ) == 'auto-draft',
642 'ajax' => admin_url( 'index.php' ),
643 'disable_curriculum' => false,
644 'action' => 'admin_course_editor',
645 'nonce' => wp_create_nonce( 'learnpress_update_curriculum' ),
646 ),
647 'chooseItems' => array(
648 'types' => learn_press_course_get_support_item_types(),
649 'open' => false,
650 'addedItems' => array(),
651 'items' => array(),
652 ),
653 'i18n' => array(
654 'item' => __( 'item', 'learnpress' ),
655 'new_section_item' => __( 'Create a new', 'learnpress' ),
656 'back' => __( 'Back', 'learnpress' ),
657 'selected_items' => __( 'Selected items', 'learnpress' ),
658 'confirm_remove_item' => __( 'Do you want to remove the "{{ITEM_NAME}}" item from the course?', 'learnpress' ),
659 'confirm_trash_item' => __( 'Do you want to move the "{{ITEM_NAME}}" item to the trash?', 'learnpress' ),
660 'item_labels' => array(
661 'singular' => __( 'Item', 'learnpress' ),
662 'plural' => __( 'Items', 'learnpress' ),
663 ),
664 'notice_sale_price' => __( 'The course sale price must be less than the regular price', 'learnpress' ),
665 'notice_price' => __( 'The course price must be greater than the sale price', 'learnpress' ),
666 'notice_sale_start_date' => __( 'The sale start date must be before the sale end date', 'learnpress' ),
667 'notice_sale_end_date' => __( 'The sale end date must be after the sale start date', 'learnpress' ),
668 'notice_invalid_date' => __( 'Invalid date', 'learnpress' ),
669 ),
670 'sections' => array(
671 'sections' => $course_section_items,
672 'hidden_sections' => ! empty( $hidden_sections ) ? $hidden_sections : array(),
673 'urlEdit' => admin_url( 'post.php?action=edit&post=' ),
674 ),
675 )
676 );
677 }*/
678
679 public static function instance() {
680 if ( ! is_admin() ) {
681 return null;
682 }
683
684 if ( ! self::$_instance ) {
685 self::$_instance = new self();
686 }
687
688 return self::$_instance;
689 }
690 }
691
692 /**
693 * Shortcut function to get instance of LP_Admin_Assets
694 *
695 * @return LP_Admin_Assets|null
696 * Addon Certificate, Import/Export is using.
697 */
698 function learn_press_admin_assets() {
699 return LP_Admin_Assets::instance();
700 }
701