JFIF $ d d 7 * Z qn )ZP 0 !1 A "#a$2Qr D8 a Ri [f \m I ykI w0 c u F c Rı?lO7 к _f˓ [C $殷WF< _W ԣ s Kc ëI zyQy /_LK ℂ ;C",p F A : /] =H ~ , l s / 9 ć: [=/#f ; ) x { ٛE Q )~ = 𘙲r*2~ a _V = ' ku m F D } KYYC )( { * g& f `툪 r y ` = ^ c J. I ]( * `wq 1dđ #̩ ͑ 0 ; H ] u 搂 @:~ ו K L N s h } O I R* 8 :2 ! lD JV o ( 3 = M ( z Ȱ+i *N A r6K n S l ) ! J J Ӂ* % ݉?|D } d5: eP0 R; {$X' x F @ .ÊB {,WJ uQ ɲRI ;9 Q E琯 6 2fT .DU J ;*c P A\IL Nj! J ۱+ O\ ͔ ] ޒ S J ȧ c%A N ol ՎprU L Zԛe r E2= X D Xg VQeӓ k y P7 U* o m Q I s ,K `) 6\G3t?pgjr m ۛجw luGt f h 9uyP 0D;Uڽ"OXl i f $ ) &|ML 0 Z rm1 [ H XP l P R0 'G=i 2N +0 e 2 ]] 9 VT P O 7 h(F * 癈 ' = Q VZD F,d ߬ ~ T X G[ `le 69C R(!S2! P < 0 x < !1AQ "Raq 02Br #S CTb ? Ζ "]mH5WR 7 k.ۛ ! } Q~ + yԏ z |@ T20 S~ K e k *zF f^2X *( @ 8 r ? C I uI|֓>^Ex LgNU Y+{.R Ѫ τV YT D I 6 2 '8Y2 7'\T P.6 d &˦ @V q i |8 -O Ε ] ʔ U= T L 8= ;6c | !qfF3 a ů& ~$ l} 'NW U s$U k^S V : U#6w + +s &r+n ڐ { @ 29gL u " T Ù M=6 (^ "7 r}=6Yݾ lC u hquymp Ǧ G jhs ǜNl ɻ} o 7 #S6 a w 4 ! OS r D 5 7 % | ?x> L | / nD 6?/8 w # [ ) L 7 +6〼T A T g ! %5 Mm Z /c -{1_Je "| ^$ 'O & ޱմ < H vNqϡQ$ < 6 &Nݛ ֨tǻN (9 n ru~'όN sMG& ,uH Kw *Ī 5@ u6 BԒ i YN * f 0 _ GhKW u lT <nj- 0{ M L~ | /a v\ E = ?1 \ɟuq Ђ Y O a K ޡP q $ H8o Q˼EV ~ k 0 h' L Pp M -M" m^ !6l nմ 쮝C U T . ! :vMǨb h ډ Vc r @~p # !1QAa q ? AL0L x LU 4 d ; x " 16ad0 7.\ߋ 0 = P l v/ " c A Ay A|2pO8"d MV #1] = \ " ˡ ] k v I9 d ۓ & q ) ǐq E ꞅ v "P )q X &Q З non]я u ג./ ; gZ$ M QР 2M ]h ni 0 P $ێ 3CɏGjώy : m c # S_ l@ '_ \m|C 2`K _ 1 cIvGc $? PCQ S+D ? K aײ k Fr b 8 ύ NEدg ĝ U 3 6 #Ik+ v { v i ( ވ ? a e) X xy/*@Q Ǽ Ծ ) $ IWO l c G; !i k{ gOŀ L ('x T rb $ w) R $ & N1E td U3Uȉ1p M"N* (DNy d96.(jQ) X 5 c QɎMy W ? Q *!R > 6=7)Xj 5`J ] e 8%t ! + ' ! 1Q 5 !1 AQaq ё #2 "0BRb ? G t^ ## .l lQ T $ v , ,m 㵜5u bV =sY+ @d { N ! dn O < .- B; _w J t 6;Q Jd. Q c%p{ 1 ,sND dF H I0 Гo X ш e黅X ۢ F :)[ F G X ƹ / w _c MeD ,ʡc c . W D tA $ j@ : ) - #u c1< @ۗ9F ) KJ- hpP] _ x [ q B lb p ʖ w q " LFGd ƶ * s +ډ_Zc " ? % t[I P 6 J ]# =ɺ V v v CGs Gh1 > )6 |e y ? L ӣ m,4 G W Ui ` ] uJVo VDG< SB 6ϏQ @ TiU l y O U 0 kfV ~ ~}S Z @ *WU Ui ## ; s /[ = ! 7}" W N ] ' (L ! ~ y5 g9T̅J kbM' +s :S +B) v @ M j e C f j E 0 Y\Qn z G 1 д~ W o{T 9?` Rm yhsy3 !HAD ] m c1 ~ 2 L S u7x T ;j$ `} 4-> L# vzŏ I L S ֭ T { r jGK C ; b pU= - ` Bs K. S F w4 M q] Z dH S 0 ) tLg
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Functionality related to the admin TinyMCE editor.
*
* @since 1.0.0
*/
class WPForms_Admin_Editor {
/**
* Primary class constructor.
*
* @since 1.0.0
*/
public function __construct() {
add_action( 'media_buttons', [ $this, 'media_button' ], 15 );
}
/**
* Allow easy shortcode insertion via a custom media button.
*
* @since 1.0.0
*
* @param string $editor_id Editor Id.
*/
public function media_button( $editor_id ) {
if ( ! \wpforms_current_user_can( 'view_forms' ) ) {
return;
}
// Provide the ability to conditionally disable the button, so it can be
// disabled for custom fields or front-end use such as bbPress. We default
// to only showing within the post editor page.
if ( ! apply_filters( 'wpforms_display_media_button', $this->is_post_editor_page(), $editor_id ) ) {
return;
}
// Setup the icon - currently using a dashicon.
$icon = '<span class="wp-media-buttons-icon wpforms-menu-icon" style="font-size:16px;margin-top:-2px;"><svg width="18" height="18" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg"><path d="M643 911v128h-252v-128h252zm0-255v127h-252v-127h252zm758 511v128h-341v-128h341zm0-256v128h-672v-128h672zm0-255v127h-672v-127h672zm135 860v-1240q0-8-6-14t-14-6h-32l-378 256-210-171-210 171-378-256h-32q-8 0-14 6t-6 14v1240q0 8 6 14t14 6h1240q8 0 14-6t6-14zm-855-1110l185-150h-406zm430 0l221-150h-406zm553-130v1240q0 62-43 105t-105 43h-1240q-62 0-105-43t-43-105v-1240q0-62 43-105t105-43h1240q62 0 105 43t43 105z" fill="#82878c"/></svg></span>';
printf(
'<button type="button" class="button wpforms-insert-form-button" data-editor="%s">%s %s</button>',
esc_attr( $editor_id ),
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
$icon,
esc_html__( 'Add Form', 'wpforms-lite' )
);
$min = wpforms_get_min_suffix();
// If we have made it this far then load the JS.
wp_enqueue_script(
'wpforms-editor',
WPFORMS_PLUGIN_URL . "assets/js/admin/admin-editor{$min}.js",
[ 'jquery' ],
WPFORMS_VERSION,
true
);
add_action( 'admin_footer', [ $this, 'shortcode_modal' ] );
}
/**
* Check if we are on the post editor admin page.
*
* @since 1.6.2
*
* @returns boolean True if it is post editor admin page.
*/
public function is_post_editor_page() {
if ( ! is_admin() ) {
return false;
}
// get_current_screen() is loaded after 'admin_init' hook and may not exist yet.
if ( ! function_exists( 'get_current_screen' ) ) {
return false;
}
$screen = get_current_screen();
return $screen !== null && $screen->parent_base === 'edit';
}
/**
* Modal window for inserting the form shortcode into TinyMCE.
*
* Thickbox is old and busted so we don't use that. Creating a custom view in
* Backbone would make me pull my hair out. So instead we offer a small clean
* modal that is based off of the WordPress insert link modal.
*
* @since 1.0.0
*/
public function shortcode_modal() {
?>
<div id="wpforms-modal-backdrop" style="display: none"></div>
<div id="wpforms-modal-wrap" style="display: none">
<form id="wpforms-modal" tabindex="-1">
<div id="wpforms-modal-title">
<?php esc_html_e( 'Insert Form', 'wpforms-lite' ); ?>
<button type="button" id="wpforms-modal-close"><span class="screen-reader-text"><?php esc_html_e( 'Close', 'wpforms-lite' ); ?></span></button>
</div>
<div id="wpforms-modal-inner">
<div id="wpforms-modal-options">
<?php
echo '<p id="wpforms-modal-notice">';
printf(
wp_kses( /* translators: %s - WPForms documentation URL. */
__( 'Heads up! Don\'t forget to test your form. <a href="%s" target="_blank" rel="noopener noreferrer">Check out our complete guide</a>!', 'wpforms-lite' ),
[
'a' => [
'href' => [],
'rel' => [],
'target' => [],
],
]
),
'https://wpforms.com/docs/how-to-properly-test-your-wordpress-forms-before-launching-checklist/'
);
echo '</p>';
$args = apply_filters( 'wpforms_modal_select', [] );
$forms = wpforms()->obj( 'form' )->get( '', $args );
if ( ! empty( $forms ) ) {
printf( '<p><label for="wpforms-modal-select-form">%s</label></p>', esc_html__( 'Select a form below to insert', 'wpforms-lite' ) );
echo '<select id="wpforms-modal-select-form">';
foreach ( $forms as $form ) {
printf( '<option value="%d">%s</option>', esc_html( $form->ID ), esc_html( $form->post_title ) );
}
echo '</select><br>';
printf( '<p class="wpforms-modal-inline"><input type="checkbox" id="wpforms-modal-checkbox-title"><label for="wpforms-modal-checkbox-title">%s</label></p>', esc_html__( 'Show form name', 'wpforms-lite' ) );
printf( '<p class="wpforms-modal-inline"><input type="checkbox" id="wpforms-modal-checkbox-description"><label for="wpforms-modal-checkbox-description">%s</label></p>', esc_html__( 'Show form description', 'wpforms-lite' ) );
} else {
echo '<p>';
printf(
wp_kses(
/* translators: %s - WPForms Builder page. */
__( 'Whoops, you haven\'t created a form yet. Want to <a href="%s">give it a go</a>?', 'wpforms-lite' ),
[
'a' => [
'href' => [],
],
]
),
esc_url( admin_url( 'admin.php?page=wpforms-builder' ) )
);
echo '</p>';
}
?>
</div>
</div>
<div class="submitbox">
<div id="wpforms-modal-cancel">
<a class="submitdelete deletion" href="#"><?php esc_html_e( 'Cancel', 'wpforms-lite' ); ?></a>
</div>
<?php if ( ! empty( $forms ) ) : ?>
<div id="wpforms-modal-update">
<button class="button button-primary" id="wpforms-modal-submit"><?php esc_html_e( 'Add Form', 'wpforms-lite' ); ?></button>
</div>
<?php endif; ?>
</div>
</form>
</div>
<style type="text/css">
.wpforms-insert-form-button svg path {
fill: #0071a1;
}
.wpforms-insert-form-button:hover svg path {
fill: #016087;
}
#wpforms-modal-wrap {
display: none;
background-color: #fff;
-webkit-box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
width: 500px;
height: 285px;
overflow: hidden;
margin-left: -250px;
margin-top: -125px;
position: fixed;
top: 50%;
left: 50%;
z-index: 100205;
-webkit-transition: height 0.2s, margin-top 0.2s;
transition: height 0.2s, margin-top 0.2s;
}
#wpforms-modal-backdrop {
display: none;
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
min-height: 360px;
background: #000;
opacity: 0.7;
filter: alpha(opacity=70);
z-index: 100200;
}
#wpforms-modal {
position: relative;
height: 100%;
}
#wpforms-modal-title {
background: #fcfcfc;
border-bottom: 1px solid #dfdfdf;
height: 36px;
font-size: 18px;
font-weight: 600;
line-height: 36px;
padding: 0 36px 0 16px;
top: 0;
right: 0;
left: 0;
}
#wpforms-modal-close {
color: #666;
padding: 0;
position: absolute;
top: 0;
right: 0;
width: 36px;
height: 36px;
text-align: center;
background: none;
border: none;
cursor: pointer;
}
#wpforms-modal-close:before {
font: normal 20px/36px 'dashicons';
vertical-align: top;
speak: none;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
width: 36px;
height: 36px;
content: '\f158';
}
#wpforms-modal-close:hover,
#wpforms-modal-close:focus {
color: #2ea2cc;
}
#wpforms-modal-close:focus {
outline: none;
-webkit-box-shadow: 0 0 0 1px #5b9dd9,
0 0 2px 1px rgba(30, 140, 190, .8);
box-shadow: 0 0 0 1px #5b9dd9,
0 0 2px 1px rgba(30, 140, 190, .8);
}
#wpforms-modal-inner {
padding: 0 16px 50px;
}
#wpforms-modal-search-toggle:after {
display: inline-block;
font: normal 20px/1 'dashicons';
vertical-align: top;
speak: none;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
content: '\f140';
}
#wpforms-modal-notice {
background-color: #d9edf7;
border: 1px solid #bce8f1;
color: #31708f;
padding: 10px;
}
#wpforms-modal #wpforms-modal-options {
padding: 8px 0 12px;
}
#wpforms-modal #wpforms-modal-options .wpforms-modal-inline {
display: inline-block;
margin: 0;
padding: 0 20px 0 0;
}
#wpforms-modal-select-form {
margin-bottom: 1em;
max-width: 100%;
}
#wpforms-modal .submitbox {
padding: 8px 16px;
background: #fcfcfc;
border-top: 1px solid #dfdfdf;
position: absolute;
bottom: 0;
left: 0;
right: 0;
}
#wpforms-modal-cancel {
line-height: 25px;
float: left;
}
#wpforms-modal-update {
line-height: 23px;
float: right;
}
#wpforms-modal-submit {
float: right;
margin-bottom: 0;
}
@media screen and ( max-width: 782px ) {
#wpforms-modal-wrap {
height: 280px;
margin-top: -140px;
}
#wpforms-modal-inner {
padding: 0 16px 60px;
}
#wpforms-modal-cancel {
line-height: 32px;
}
}
@media screen and ( max-width: 520px ) {
#wpforms-modal-wrap {
width: auto;
margin-left: 0;
left: 10px;
right: 10px;
max-width: 500px;
}
}
@media screen and ( max-height: 520px ) {
#wpforms-modal-wrap {
-webkit-transition: none;
transition: none;
}
}
@media screen and ( max-height: 290px ) {
#wpforms-modal-wrap {
height: auto;
margin-top: 0;
top: 10px;
bottom: 10px;
}
#wpforms-modal-inner {
overflow: auto;
height: -webkit-calc(100% - 92px);
height: calc(100% - 92px);
padding-bottom: 2px;
}
}
</style>
<?php
}
}
new WPForms_Admin_Editor();