Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added qsm_question_description_before and qsm_question_title_before f… #2443

Merged
merged 2 commits into from
Jan 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions php/admin/options-page-text-tab.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,7 @@ function mlw_options_text_tab_content() {
wp_editor( htmlspecialchars_decode( $value_answer, ENT_QUOTES ), 'qsm_question_text_message', array(
'editor_height' => 250,
'textarea_rows' => 10,
'tinymce' => array(
'toolbar1' => 'formatselect,bold,italic,underline,bullist,numlist,blockquote,alignleft,aligncenter,alignright,alignjustify,link,wp_more,fullscreen,wp_adv',
'toolbar2' => 'strikethrough,hr,forecolor,pastetext,removeformat,charmap,outdent,indent,undo,redo,wp_help',
),
'tinymce' => true,
) );
?>
</div>
Expand Down Expand Up @@ -152,10 +149,7 @@ function mlw_options_text_tab_content() {
wp_editor( htmlspecialchars_decode( $value_answer, ENT_QUOTES ), 'qsm_question_text_message_variable', array(
'editor_height' => 250,
'textarea_rows' => 10,
'tinymce' => array(
'toolbar1' => 'formatselect,bold,italic,underline,bullist,numlist,blockquote,alignleft,aligncenter,alignright,alignjustify,link,wp_more,fullscreen,wp_adv',
'toolbar2' => 'strikethrough,hr,forecolor,pastetext,removeformat,charmap,outdent,indent,undo,redo,wp_help',
),
'tinymce' => true,
) );
?>
</div>
Expand Down
5 changes: 1 addition & 4 deletions php/admin/settings-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -484,10 +484,7 @@ public function results_details_template() {
}
wp_editor( $template, 'results_template', array(
'textarea_name' => 'qmn-settings[results_details_template]',
'tinymce' => array(
'toolbar1' => 'formatselect,bold,italic,underline,bullist,numlist,blockquote,alignleft,aligncenter,alignright,alignjustify,link,wp_more,fullscreen,wp_adv',
'toolbar2' => 'strikethrough,hr,forecolor,pastetext,removeformat,charmap,outdent,indent,undo,redo,wp_help',
),
'tinymce' => true,
)
);
}
Expand Down
11 changes: 5 additions & 6 deletions php/classes/class-qsm-fields.php
Original file line number Diff line number Diff line change
Expand Up @@ -598,12 +598,11 @@ public static function generate_editor_field( $field, $value ) {
</label>
</th>
<td>
<?php wp_editor( htmlspecialchars_decode( $value, ENT_QUOTES ), $field["id"], array(
'tinymce' => array(
'toolbar1' => 'formatselect,bold,italic,underline,bullist,numlist,blockquote,alignleft,aligncenter,alignright,alignjustify,link,wp_more,fullscreen,wp_adv',
'toolbar2' => 'strikethrough,hr,forecolor,pastetext,removeformat,charmap,outdent,indent,undo,redo,wp_help',
),
) ); ?>
<?php
wp_editor( htmlspecialchars_decode( $value, ENT_QUOTES ), $field["id"], array(
'tinymce' => true,
) );
?>
</td>
</tr>
<?php
Expand Down
8 changes: 5 additions & 3 deletions php/question-types/qsm-question-title.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ function qsm_question_title_func( $question, $question_type = '', $new_question_
do_action('qsm_question_title_func_before',$question, $question_type, $new_question_title, $question_id );
if ( '' !== $new_question_title ) {
$new_question_title = $mlwQuizMasterNext->pluginHelper->qsm_language_support( htmlspecialchars_decode( $new_question_title, ENT_QUOTES ), "Question-{$question_id}", "QSM Questions");
$new_question_title = apply_filters( 'qsm_question_title_before', $new_question_title, $question_type, $question_id );
?>
<div class='mlw_qmn_new_question'><?php echo esc_html( $new_question_title ); ?> </div>
<?php
Expand Down Expand Up @@ -52,12 +53,13 @@ function qsm_question_title_func( $question, $question_type = '', $new_question_
$allow_html['input']['maxlength'] = 1;
$allow_html = apply_filters( 'qsm_allow_html_question_title_after', $allow_html, $question_id );
$pattern = '/<code>(.*?)<\/code>/s';
$question_title_modified_html = preg_replace_callback($pattern, function ( $matches ) {
$question_description = preg_replace_callback($pattern, function ( $matches ) {
return preg_replace([ '/<(?!(\/?code|br)[ >])/', '/>(?!(\/?code|br)[ \/>])/' ], [ '&lt;', '&gt;' ], $matches[0]);
}, $question_title);
$question_title_modified_html = str_replace([ 'code&gt;', 'br /&gt;' ],[ 'code/>', 'br />' ], $question_title_modified_html );
$question_description = str_replace([ 'code&gt;', 'br /&gt;' ],[ 'code/>', 'br />' ], $question_description );
$question_description = apply_filters( 'qsm_question_description_before', $question_description, $question_type, $question_id );
?>
<p><?php echo do_shortcode( wp_kses( $question_title_modified_html . $deselect_answer, $allow_html ) ); ?></p>
<p><?php echo do_shortcode( wp_kses( $question_description . $deselect_answer, $allow_html ) ); ?></p>
</div>
<?php
do_action('qsm_question_title_func_after',$question, $question_type, $new_question_title, $question_id );
Expand Down