| @@ -1,92 +1,97 @@ | ||
| 1 | 1 | <?php |
| 2 | - $email_feedback = betterdocs()->settings->get( 'email_feedback' ); | |
| 2 | +// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- view template receives variables via extract(); prefixing is impractical. | |
| 3 | + | |
| 4 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 5 | + exit; | |
| 6 | +} | |
| 7 | +$email_feedback = betterdocs()->settings->get( 'email_feedback' ); | |
| 3 | 8 | |
| 4 | - if ( ! $email_feedback ) { | |
| 5 | - return; | |
| 6 | - } | |
| 9 | +if ( ! $email_feedback ) { | |
| 10 | + return; | |
| 11 | +} | |
| 7 | 12 | |
| 8 | - // for archives | |
| 9 | - $feedback_icon = betterdocs()->customizer->defaults->get( 'betterdocs_single_doc_feedback_icon' ); | |
| 10 | - $feedback_title_tag = betterdocs()->customizer->defaults->get( 'betterdocs_feedback_form_title_tag' ); | |
| 11 | - $feedback_title_tag = betterdocs()->template_helper->is_valid_tag( $feedback_title_tag ); | |
| 13 | + // for archives | |
| 14 | + $feedback_icon = betterdocs()->customizer->defaults->get( 'betterdocs_single_doc_feedback_icon' ); | |
| 15 | + $feedback_title_tag = betterdocs()->customizer->defaults->get( 'betterdocs_feedback_form_title_tag' ); | |
| 16 | + $feedback_title_tag = betterdocs()->template_helper->is_valid_tag( $feedback_title_tag ); | |
| 12 | 17 | |
| 13 | - $feedback_title = betterdocs()->settings->get( 'feedback_form_title' ); | |
| 14 | - $flink_text = betterdocs()->settings->get( 'feedback_link_text' ); | |
| 15 | - $flink_url = betterdocs()->settings->get( 'feedback_url' ); | |
| 16 | - $flink_url_href = $flink_url ? esc_url( $flink_url ) : '#betterdocs-form-modal'; | |
| 18 | + $feedback_title = betterdocs()->settings->get( 'feedback_form_title' ); | |
| 19 | + $flink_text = betterdocs()->settings->get( 'feedback_link_text' ); | |
| 20 | + $flink_url = betterdocs()->settings->get( 'feedback_url' ); | |
| 21 | + $flink_url_href = $flink_url ? esc_url( $flink_url ) : '#betterdocs-form-modal'; | |
| 17 | 22 | |
| 18 | - $shortcode_attributes = ['button_text' => $button_text]; | |
| 23 | + $shortcode_attributes = [ 'button_text' => $button_text, 'feedback_form_name_label_text' => $feedbackFormNameLabelText, 'feedback_form_email_label_text' => $feedbackFormEmailLabelText, 'feedback_form_message_label_text' => $feedbackFormMessageLabelText ]; | |
| 19 | 24 | |
| 20 | - $flink_attribute = [ | |
| 21 | - 'class' => ['feedback-form-link'], | |
| 22 | - 'href' => $flink_url_href | |
| 23 | - ]; | |
| 25 | + $flink_attribute = [ | |
| 26 | + 'class' => [ 'feedback-form-link' ], | |
| 27 | + 'href' => $flink_url_href | |
| 28 | + ]; | |
| 24 | 29 | |
| 25 | - if ( ! $flink_url ) { | |
| 26 | - $flink_attribute['name'] = 'betterdocs-form-modal'; | |
| 27 | - } | |
| 30 | + if ( ! $flink_url ) { | |
| 31 | + $flink_attribute['name'] = 'betterdocs-form-modal'; | |
| 32 | + } | |
| 28 | 33 | |
| 29 | - $flink_attribute = betterdocs()->template_helper->get_html_attributes( $flink_attribute ); | |
| 30 | - $shortcode_attributes = betterdocs()->template_helper->get_html_attributes( $shortcode_attributes ); | |
| 34 | + $flink_attribute = betterdocs()->template_helper->get_html_attributes( $flink_attribute ); | |
| 35 | + $shortcode_attributes = betterdocs()->template_helper->get_html_attributes( $shortcode_attributes ); | |
| 31 | 36 | |
| 32 | -?> | |
| 33 | -<div <?php echo $wrapper_attr; ?>> | |
| 34 | - <a | |
| 35 | - <?php echo $flink_attribute; ?>> | |
| 37 | + ?> | |
| 38 | +<div <?php echo $wrapper_attr; //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>> | |
| 39 | + <a | |
| 40 | + <?php echo $flink_attribute; //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>> | |
| 36 | 41 | <span class="feedback-form-icon"> |
| 37 | - <?php if ( $feedback_icon != '' ): ?> | |
| 38 | - <img src="<?php esc_attr_e( esc_url( $feedback_icon ) );?>" /> | |
| 39 | - <?php else: ?> | |
| 40 | - <svg xmlns="http://www.w3.org/2000/svg" width="32px" viewBox="0 0 64 64"> | |
| 41 | - <linearGradient id="zWPy7gPuySZ8fg4Y3QF24a" x1="26" x2="26" y1="630.833" y2="619.332" | |
| 42 | - gradientTransform="matrix(1 0 0 -1 0 654)" gradientUnits="userSpaceOnUse" | |
| 43 | - spreadMethod="reflect"> | |
| 44 | - <stop offset="0" stop-color="#6dc7ff"></stop> | |
| 45 | - <stop offset="1" stop-color="#e6abff"></stop> | |
| 46 | - </linearGradient> | |
| 47 | - <path fill="url(#zWPy7gPuySZ8fg4Y3QF24a)" | |
| 48 | - d="M15.082,25.762l9.625,8.141c0.746,0.633,1.84,0.633,2.59,0l9.621-8.141 C37.629,25.16,37.203,24,36.27,24H15.73C14.797,24,14.371,25.16,15.082,25.762z"> | |
| 49 | - </path> | |
| 50 | - <linearGradient id="zWPy7gPuySZ8fg4Y3QF24b" x1="26" x2="26" y1="647.5" y2="596.439" | |
| 51 | - gradientTransform="matrix(1 0 0 -1 0 654)" gradientUnits="userSpaceOnUse" | |
| 52 | - spreadMethod="reflect"> | |
| 53 | - <stop offset="0" stop-color="#1a6dff"></stop> | |
| 54 | - <stop offset="1" stop-color="#c822ff"></stop> | |
| 55 | - </linearGradient> | |
| 56 | - <path fill="url(#zWPy7gPuySZ8fg4Y3QF24b)" d="M18,49h16v2H18V49z"></path> | |
| 57 | - <linearGradient id="zWPy7gPuySZ8fg4Y3QF24c" x1="32" x2="32" y1="8.915" y2="55.387" | |
| 58 | - gradientUnits="userSpaceOnUse" spreadMethod="reflect"> | |
| 59 | - <stop offset="0" stop-color="#1a6dff"></stop> | |
| 60 | - <stop offset="1" stop-color="#c822ff"></stop> | |
| 61 | - </linearGradient> | |
| 62 | - <path fill="url(#zWPy7gPuySZ8fg4Y3QF24c)" | |
| 63 | - d="M48,9c-6.134,0-11.277,4.276-12.637,10H8c-2.758,0-5,2.242-5,5v26c0,2.758,2.242,5,5,5h36 c2.758,0,5-2.242,5-5V35h2v-2h-3c-6.066,0-11-4.934-11-11s4.934-11,11-11s11,4.934,11,11v3c0,1.102-0.898,2-2,2s-2-0.898-2-2v-3 c0-3.859-3.141-7-7-7s-7,3.141-7,7s3.141,7,7,7c2.125,0,4.027-0.953,5.312-2.453C53.918,27.984,55.344,29,57,29c2.207,0,4-1.793,4-4 v-3C61,14.832,55.168,9,48,9z M5,24.109L17.086,34L5,43.891V24.109z M47,50c0,1.652-1.348,3-3,3H8c-1.652,0-3-1.348-3-3v-3.527 l13.668-11.18l4.168,3.41c0.914,0.75,2.039,1.125,3.164,1.125s2.25-0.375,3.164-1.125l4.172-3.41L47,46.473V50z M47,34.949v8.941 L34.914,34l3.618-3.12C40.691,33.18,43.668,34.694,47,34.949z M37.264,29.317l-9.365,7.835c-1.102,0.902-2.699,0.902-3.801,0 L5.699,22.098C6.25,21.434,7.07,21,8,21h27.051C35.025,21.331,35,21.662,35,22C35,24.712,35.837,27.231,37.264,29.317z M48,27 c-2.758,0-5-2.242-5-5s2.242-5,5-5s5,2.242,5,5S50.758,27,48,27z"> | |
| 64 | - </path> | |
| 65 | - </svg> | |
| 66 | - <?php endif;?> | |
| 42 | + <?php if ( $feedback_icon != '' ) : ?> | |
| 43 | + <img src="<?php echo esc_attr( esc_url( $feedback_icon ) ); ?>" /> | |
| 44 | + <?php else : ?> | |
| 45 | + <svg xmlns="http://www.w3.org/2000/svg" width="32px" viewBox="0 0 64 64"> | |
| 46 | + <linearGradient id="zWPy7gPuySZ8fg4Y3QF24a" x1="26" x2="26" y1="630.833" y2="619.332" | |
| 47 | + gradientTransform="matrix(1 0 0 -1 0 654)" gradientUnits="userSpaceOnUse" | |
| 48 | + spreadMethod="reflect"> | |
| 49 | + <stop offset="0" stop-color="#6dc7ff"></stop> | |
| 50 | + <stop offset="1" stop-color="#e6abff"></stop> | |
| 51 | + </linearGradient> | |
| 52 | + <path fill="url(#zWPy7gPuySZ8fg4Y3QF24a)" | |
| 53 | + d="M15.082,25.762l9.625,8.141c0.746,0.633,1.84,0.633,2.59,0l9.621-8.141 C37.629,25.16,37.203,24,36.27,24H15.73C14.797,24,14.371,25.16,15.082,25.762z"> | |
| 54 | + </path> | |
| 55 | + <linearGradient id="zWPy7gPuySZ8fg4Y3QF24b" x1="26" x2="26" y1="647.5" y2="596.439" | |
| 56 | + gradientTransform="matrix(1 0 0 -1 0 654)" gradientUnits="userSpaceOnUse" | |
| 57 | + spreadMethod="reflect"> | |
| 58 | + <stop offset="0" stop-color="#1a6dff"></stop> | |
| 59 | + <stop offset="1" stop-color="#c822ff"></stop> | |
| 60 | + </linearGradient> | |
| 61 | + <path fill="url(#zWPy7gPuySZ8fg4Y3QF24b)" d="M18,49h16v2H18V49z"></path> | |
| 62 | + <linearGradient id="zWPy7gPuySZ8fg4Y3QF24c" x1="32" x2="32" y1="8.915" y2="55.387" | |
| 63 | + gradientUnits="userSpaceOnUse" spreadMethod="reflect"> | |
| 64 | + <stop offset="0" stop-color="#1a6dff"></stop> | |
| 65 | + <stop offset="1" stop-color="#c822ff"></stop> | |
| 66 | + </linearGradient> | |
| 67 | + <path fill="url(#zWPy7gPuySZ8fg4Y3QF24c)" | |
| 68 | + d="M48,9c-6.134,0-11.277,4.276-12.637,10H8c-2.758,0-5,2.242-5,5v26c0,2.758,2.242,5,5,5h36 c2.758,0,5-2.242,5-5V35h2v-2h-3c-6.066,0-11-4.934-11-11s4.934-11,11-11s11,4.934,11,11v3c0,1.102-0.898,2-2,2s-2-0.898-2-2v-3 c0-3.859-3.141-7-7-7s-7,3.141-7,7s3.141,7,7,7c2.125,0,4.027-0.953,5.312-2.453C53.918,27.984,55.344,29,57,29c2.207,0,4-1.793,4-4 v-3C61,14.832,55.168,9,48,9z M5,24.109L17.086,34L5,43.891V24.109z M47,50c0,1.652-1.348,3-3,3H8c-1.652,0-3-1.348-3-3v-3.527 l13.668-11.18l4.168,3.41c0.914,0.75,2.039,1.125,3.164,1.125s2.25-0.375,3.164-1.125l4.172-3.41L47,46.473V50z M47,34.949v8.941 L34.914,34l3.618-3.12C40.691,33.18,43.668,34.694,47,34.949z M37.264,29.317l-9.365,7.835c-1.102,0.902-2.699,0.902-3.801,0 L5.699,22.098C6.25,21.434,7.07,21,8,21h27.051C35.025,21.331,35,21.662,35,22C35,24.712,35.837,27.231,37.264,29.317z M48,27 c-2.758,0-5-2.242-5-5s2.242-5,5-5s5,2.242,5,5S50.758,27,48,27z"> | |
| 69 | + </path> | |
| 70 | + </svg> | |
| 71 | + <?php endif; ?> | |
| 67 | 72 | </span> |
| 68 | - <?php echo $formContent; ?> | |
| 73 | + <?php echo $formContent; //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> | |
| 69 | 74 | </a> |
| 70 | 75 | |
| 71 | - <div id="betterdocs-form-modal" class="betterdocs-modalwindow <?php echo $blockId; ?>"> | |
| 72 | - <div class="modal-inner"> | |
| 73 | - <div class="modal-content"> | |
| 74 | - <a href="#" class="close"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16px" viewBox="0 0 50 50" version="1.1"><g id="surface1"><path style=" " d="M 9.15625 6.3125 L 6.3125 9.15625 L 22.15625 25 L 6.21875 40.96875 L 9.03125 43.78125 L 25 27.84375 L 40.9375 43.78125 L 43.78125 40.9375 L 27.84375 25 L 43.6875 9.15625 L 40.84375 6.3125 L 25 22.15625 Z "></path></g></svg></a> | |
| 75 | - <?php | |
| 76 | - echo wp_sprintf( | |
| 77 | - '<%1$s class="feedback-form-title">%2$s</%1$s>', | |
| 78 | - $feedback_title_tag, | |
| 79 | - ( $formTitle ) ? stripslashes( $formTitle ) : esc_html__( 'How can we help?', 'betterdocs' ) | |
| 80 | - ); | |
| 76 | + <div id="betterdocs-form-modal" class="betterdocs-modalwindow <?php echo esc_attr( $blockId ); ?>"> | |
| 77 | + <div class="modal-inner"> | |
| 78 | + <div class="modal-content"> | |
| 79 | + <a href="#" class="close"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16px" viewBox="0 0 50 50" version="1.1"><g id="surface1"><path style=" " d="M 9.15625 6.3125 L 6.3125 9.15625 L 22.15625 25 L 6.21875 40.96875 L 9.03125 43.78125 L 25 27.84375 L 40.9375 43.78125 L 43.78125 40.9375 L 27.84375 25 L 43.6875 9.15625 L 40.84375 6.3125 L 25 22.15625 Z "></path></g></svg></a> | |
| 80 | + <?php | |
| 81 | + echo wp_sprintf( | |
| 82 | + '<%1$s class="feedback-form-title">%2$s</%1$s>', | |
| 83 | + $feedback_title_tag, //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 84 | + ( $formTitle ) ? stripslashes( $formTitle ) : esc_html__( 'How can we help?', 'betterdocs' ) //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 85 | + ); | |
| 81 | 86 | |
| 82 | - echo wp_sprintf( | |
| 83 | - '<div class="modal-content-inner"><!-- shortcode -->%s<!-- shortcode end --></div>', | |
| 84 | - do_shortcode( '[betterdocs_feedback_form ' . $shortcode_attributes . ']' ) | |
| 85 | - ); | |
| 86 | - ?> | |
| 87 | - </div> | |
| 87 | + echo wp_sprintf( | |
| 88 | + '<div class="modal-content-inner"><!-- shortcode -->%s<!-- shortcode end --></div>', | |
| 89 | + do_shortcode( '[betterdocs_feedback_form ' . $shortcode_attributes . ']' ) | |
| 90 | + ); | |
| 91 | + ?> | |
| 92 | + </div> | |
| 88 | 93 | |
| 89 | 94 | |
| 90 | - </div> | |
| 91 | - </div> | |
| 95 | + </div> | |
| 96 | + </div> | |
| 92 | 97 | </div> |