%s', esc_url( self::help_url() ), esc_html__( 'Help articles', 'accessnow-lms' ) ); $links[] = sprintf( '%s', esc_url( self::support_url() ), esc_html__( 'Get support', 'accessnow-lms' ) ); if ( '' !== ACCESSNOW_SLMS_WPORG_SLUG ) { $links[] = sprintf( '%s', esc_url( 'https://wordpress.org/support/plugin/' . ACCESSNOW_SLMS_WPORG_SLUG . '/reviews/#new-post' ), esc_html__( 'Rate it', 'accessnow-lms' ) ); } return $links; } /** * Filter: plugin_action_links_. Settings, beside Deactivate. * * @param string[] $links Action links. * @return string[] */ public static function action_links( $links ) { if ( current_user_can( 'manage_options' ) ) { array_unshift( $links, sprintf( '%s', esc_url( admin_url( 'admin.php?page=slms-settings' ) ), esc_html__( 'Settings', 'accessnow-lms' ) ) ); } return $links; } /** * Each screen (a page slug, or a post type's editor): what it is for, and the articles that cover it. * * @return array}> */ private static function screens() { $first = array( self::help_url( 'accessnow-lms-first-course' ), __( 'Build your first course: units, lessons and quizzes', 'accessnow-lms' ) ); $quizzes = array( self::help_url( 'accessnow-lms-quizzes' ), __( 'Quizzes: questions, pass marks, retries, time limits and answers', 'accessnow-lms' ) ); $changes = array( self::help_url( 'accessnow-lms-content-changes' ), __( 'When you change a lesson: asking students to redo it', 'accessnow-lms' ) ); $enrol = array( self::help_url( 'accessnow-lms-enrolling-students' ), __( 'Enrolling students, and letting people register', 'accessnow-lms' ) ); $reports = array( self::help_url( 'accessnow-lms-reports' ), __( 'Track progress and export reports', 'accessnow-lms' ) ); $rewards = array( self::help_url( 'accessnow-lms-certificates-points-badges' ), __( 'Certificates, points and badges', 'accessnow-lms' ) ); $pages = array( self::help_url( 'accessnow-lms-pages' ), __( 'Put your courses on a page: blocks and shortcodes', 'accessnow-lms' ) ); $copy = array( self::help_url( 'accessnow-lms-export-import' ), __( 'Copy a course to another site: export, import and clone', 'accessnow-lms' ) ); $moving = array( self::help_url( 'accessnow-lms-moving-from-simple-lms' ), __( 'Moving from Simple LMS 4.x to AccessNow LMS', 'accessnow-lms' ) ); return array( 'slms-main' => array( __( 'Your courses, lessons and students at a glance.', 'accessnow-lms' ), array( $first, $pages, $moving ) ), 'slms-enrollments' => array( __( 'Who is enrolled in which course. Find students by name to enrol several at once, and export the list.', 'accessnow-lms' ), array( $enrol ) ), 'slms-reports' => array( __( 'Progress and quiz results for every course and student, with CSV export.', 'accessnow-lms' ), array( $reports ) ), 'slms-settings' => array( __( 'Registration, header images, points and emails for the whole site.', 'accessnow-lms' ), array( $enrol, $first, $rewards ) ), 'slms-export-import' => array( __( 'Download a course as a ZIP file, or bring one in from another site.', 'accessnow-lms' ), array( $copy ) ), 'slms_course' => array( __( 'A course: its settings, header image and style, and its units and lessons in order.', 'accessnow-lms' ), array( $first, $changes, $copy ) ), 'slms_unit' => array( __( 'A unit groups lessons. Its header image and style apply to its lessons unless they have their own.', 'accessnow-lms' ), array( $first ) ), 'slms_lesson' => array( __( 'A lesson: text or a video, downloads, and its header image and style.', 'accessnow-lms' ), array( $first, $changes ) ), 'slms_quiz' => array( __( 'A quiz: its questions, pass mark, retries, time limit and when answers are shown.', 'accessnow-lms' ), array( $quizzes, $changes ) ), ); } /** * Action: current_screen. On the plugin's own screens only, a Help tab and the support sidebar. * * @param \WP_Screen $screen Current screen. */ public static function tabs( $screen ) { if ( ! is_object( $screen ) ) { return; } $page = isset( $_GET['page'] ) ? sanitize_key( wp_unslash( $_GET['page'] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Only picks which help text to show. $map = self::screens(); if ( '' !== $page && isset( $map[ $page ] ) && false !== strpos( (string) $screen->id, $page ) ) { $key = $page; } elseif ( 'post' === $screen->base && isset( $map[ (string) $screen->post_type ] ) ) { $key = (string) $screen->post_type; } else { return; } $content = '

' . esc_html( $map[ $key ][0] ) . '

'; $screen->add_help_tab( array( 'id' => 'accessnow-slms-help', 'title' => __( 'About this screen', 'accessnow-lms' ), 'content' => $content, ) ); $screen->set_help_sidebar( '

' . esc_html__( 'AccessNow LMS', 'accessnow-lms' ) . '

' . '

' . esc_html__( 'Help articles', 'accessnow-lms' ) . '

' . '

' . esc_html__( 'Get support', 'accessnow-lms' ) . '

' . '

' . esc_html__( 'Project page', 'accessnow-lms' ) . '

' ); } }