Improving plugin code
-
There are suggestions to improve the code after line 115 in the file ../plugins/masterstudy-lms-learning-management-system/stm-lms-templates/lesson/curriculum.php
The problem with the current code is that when using the Russian language, the correct endings of words are not formed with a different number of questions. Moreover, the code, which I propose to replace, is already used in the theme on the course page in the “Curriculum” section and forms words well with different endings depending on the number of questions.
<div class="stm-curriculum-item__meta"> <?php if( !empty( $quiz_info[ 'progress' ] ) ): ?> <?php echo intval( $quiz_info[ 'progress' ] ) ?>% <?php else: $questions = get_post_meta($curriculum_item, 'questions', true); if(!empty($questions)){ //New correct code $meta = sprintf(_n( '%s question', '%s questions', count(explode(',', $questions)), 'masterstudy-lms-learning-management-system' ), count(explode(',', $questions))); if(!empty($meta)){ echo wp_kses_post($meta); } //Сurrent code //$questions_array = explode(',', $questions); //if(!empty($questions_array)){ // echo sprintf(esc_html__('%s questions', 'masterstudy-lms-learning-management-system'), count($questions_array)); //} } ?> <?php endif; ?> <?php if( $lesson_style === 'classic' && $lesson_type !== 'stream' && $lesson_type !== 'zoom_conference' && !empty( $meta ) ): ?> <?php echo esc_html( $meta ); ?> <?php endif; ?> </div>
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Improving plugin code’ is closed to new replies.