static function update_version_10() { $update = false; if (!self::_has_new_table()) { self::_create_tables(); $update = true; } if (!get_option('learnpress_version')) { self::_create_options(); $update = true; } $ask = get_transient('learn_press_upgrade_courses_ask_again'); if (version_compare(LEARNPRESS_VERSION, '1.0') === 0 && self::_need_to_update() || $update) { // Notify for administrator if (empty($ask) && learn_press_current_user_is('administrator')) { LP_Admin_Assets::enqueue_style('learn-press-upgrade', LP()->plugin_url('assets/css/admin/upgrade.css')); LP_Admin_Assets::enqueue_script('learn-press-upgrade', LP()->plugin_url('assets/js/admin/upgrade.js')); $upgrade_url = wp_nonce_url(admin_url('options-general.php?page=learn_press_upgrade_10'), 'learn-press-upgrade'); $message = sprintf('<p>%s</p>', __('It seem to be you have updated LearnPress from old version and there are some courses or data is out of date and need to upgrade.', 'learn_press')); $message .= sprintf('<div id="learn-press-confirm-abort-upgrade-course"><p><label><input type="checkbox" id="learn-press-ask-again-abort-upgrade" /> %s</label></p><p><button href="" class="button disabled" data-action="yes">%s</button> <button href="" class="button" data-action="no">%s</button> </p></div>', __('Do not ask again.', 'learn_press'), __('Ok', 'learn_press'), __('Cancel', 'learn_press')); $message .= sprintf('<p id="learn-press-upgrade-course-actions"><a href="%s" class="button" data-action="upgrade">%s</a> <button class="button disabled" data-action="abort">%s</button></p>', $upgrade_url, __('Upgrade now', 'learn_press'), __('No, thank!', 'learn_press')); LP_Admin_Notice::add($message, 'error'); } // Notify for instructor if (learn_press_current_user_is('instructor')) { LP_Admin_Notice::add(sprintf('<p>%s</p>', __('LearnPress has upgraded and need to upgrade the database before you can work with it. Please notify the site administrator.', 'learn_press')), 'error'); } } }
function enqueue_script() { if (LP()->lesson_post_type != get_post_type()) { return; } LP_Admin_Assets::enqueue_script('select2', LP_PLUGIN_URL . '/lib/meta-box/js/select2/select2.min.js'); LP_Admin_Assets::enqueue_style('select2', LP_PLUGIN_URL . '/lib/meta-box/css/select2/select2.css'); ob_start(); ?> <script> var form = $('#post'); form.submit(function (evt) { var $title = $('#title'), is_error = false; if (0 == $title.val().length) { alert('<?php _e('Please enter the title of the lesson', 'learn_press'); ?> '); $title.focus(); is_error = true; } if (is_error) { evt.preventDefault(); return false; } }); </script> <?php $script = ob_get_clean(); $script = preg_replace('!</?script>!', '', $script); learn_press_enqueue_script($script); }
static function admin_enqueue_scripts() { /*$q = new LP_Question(); $q->admin_script();*/ LP_Admin_Assets::enqueue_style('select2', RWMB_CSS_URL . 'select2/select2.css'); LP_Admin_Assets::enqueue_script('select2', RWMB_JS_URL . 'select2/select2.min.js'); LP_Admin_Assets::enqueue_script('lpr-quiz-question', LearnPress()->plugin_url('inc/admin/meta-boxes/js/quiz-question.js')); }
static function admin_enqueue_scripts() { /*$q = new LP_Question(); $q->admin_script();*/ LP_Admin_Assets::enqueue_style('select2', RWMB_CSS_URL . 'select2/select2.css'); LP_Admin_Assets::enqueue_script('select2', RWMB_JS_URL . 'select2/select2.min.js'); LP_Admin_Assets::enqueue_script('lpr-quiz-question', learn_press_plugin_url('assets/js/admin/meta-box-quiz.js')); wp_enqueue_script('modal-search-items'); }
/** * Enqueue scripts and styles * * @return void */ static function admin_enqueue_scripts() { LP_Admin_Assets::enqueue_style('meta-box-course', LP()->plugin_url('assets/css/admin/meta-box-course.css')); LP_Admin_Assets::enqueue_style('select2', RWMB_CSS_URL . 'select2/select2.css'); LP_Admin_Assets::enqueue_style('toastr', LP_CSS_URL . 'toastr.css'); //LP_Admin_Assets::enqueue_style( 'thim-course', LearnPress()->plugin_url( 'inc/admin/meta-boxes/css/course.css' ) ); LP_Admin_Assets::enqueue_script('select2', RWMB_JS_URL . 'select2/select2.min.js'); LP_Admin_Assets::enqueue_script('toastr', LP_JS_URL . 'toastr.js'); LP_Admin_Assets::enqueue_script('tojson', LP_JS_URL . 'toJSON.js'); LP_Admin_Assets::enqueue_script('meta-box-course', LearnPress()->plugin_url('assets/js/admin/meta-box-course.js'), array('jquery', 'toastr', 'tojson')); LP_Admin_Assets::add_localize(array('confirm_remove_section_lesson' => __('Do you want to remove this lesson permanently?', 'learn_press'), 'confirm_remove_section_quiz' => __('Do you want to remove this quiz permanently?', 'learn_press'), 'confirm_remove_section' => __('Do you want to remove this section permanently?', 'learn_press'), 'add_new_quiz' => __('New quiz added', 'learn_press'), 'add_new_lesson' => __('New lesson added', 'learn_press'), 'add_new_section' => __('New section added', 'learn_press'), 'remove_section_lesson' => __('The lesson removed', 'learn_press'), 'remove_section_quiz' => __('The quiz removed', 'learn_press'), 'remove_section' => __('The section removed', 'learn_press'), 'section_ordered' => __('The ordering completed', 'learn_press'), 'add_lesson_to_section' => __('Lesson added to section complete!', 'learn_press'), 'add_quiz_to_section' => __('Quiz added to section complete!', 'learn_press'), 'update_lesson_quiz' => __('%s updated', 'learn_press'), 'quick_edit_name' => __('Click to quick edit name', 'learn_press'), 'confirm_remove_section_assignment' => __('Do you want to remove this assignment permanently', 'learn_press'), 'add_new_assignment' => __('New assignment added', 'learn_press'), 'remove_section_assignment' => __('The assignment removed', 'learn_press'), 'add_assignment_to_section' => __('Assignment added to section complete!', 'learn_press')), null, 'meta-box-course'); }
/** * Enqueue admin scripts */ public function admin_scripts() { /** * Tipsy tooltip assets */ LP_Admin_Assets::enqueue_style('jquery-tipsy', LP_CSS_URL . 'tipsy.css'); LP_Admin_Assets::enqueue_script('jquery-tipsy', LP_JS_URL . 'jquery.tipsy.js'); }
static function admin_assets() { LP_Admin_Assets::enqueue_style('learnpress-question', learn_press_plugin_url('assets/css/admin/meta-box-question.css')); LP_Admin_Assets::enqueue_script('learnpress-question', learn_press_plugin_url('assets/js/admin/meta-box-question.js'), array('jquery', 'jquery-ui-sortable')); }