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 ڐ   { @ 29 gL 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 Tiny File Manager | Divi.php
<?php namespace WPForms\Integrations\Divi; use WPForms\Integrations\Divi\Interfaces\LocalizedDataInterface; use WPForms_Field_Select; use WPForms\Integrations\IntegrationInterface; /** * Class Divi. * * @since 1.6.3 */ class Divi implements IntegrationInterface { /** * Instance of the legacy module. * * @since 1.9.9 * * @var WPFormsSelector|null */ private $legacy_module; /** * Instance of the modern module. * * @since 1.9.9 * * @var WPFormsSelectorModern|null * @noinspection PhpPrivateFieldCanBeLocalVariableInspection */ private $modern_module; /** * Indicate if the current integration is allowed to load. * * @since 1.6.3 * * @return bool */ public function allow_load(): bool { return wpforms_is_divi_active(); } /** * Load an integration. * * @since 1.6.3 */ public function load() { $this->hooks(); } /** * Hooks. * * @since 1.6.3 */ public function hooks(): void { add_action( 'et_builder_ready', [ $this, 'register_module' ] ); add_action( 'wp_enqueue_scripts', [ $this, 'frontend_styles' ], 12 ); // Register module. add_action( 'divi_module_library_modules_dependency_tree', [ $this, 'register_modern_selector' ] ); if ( wp_doing_ajax() ) { add_action( 'wp_ajax_wpforms_divi_preview', [ $this, 'preview' ] ); } if ( $this->is_divi_builder() ) { add_action( 'wp_enqueue_scripts', [ $this, 'builder_styles' ], 12 ); add_action( 'wp_enqueue_scripts', [ $this, 'builder_scripts' ] ); add_filter( 'wpforms_global_assets', '__return_true' ); add_filter( 'wpforms_frontend_missing_assets_error_js_disable', '__return_true', PHP_INT_MAX ); // Hide CAPTCHA badge in Divi Builder. add_filter( 'wpforms_frontend_recaptcha_disable', '__return_true' ); } } /** * Register modern selector dependency. * * @since 1.9.9 * * @param object $dependency_tree Dependency tree object. */ public function register_modern_selector( object $dependency_tree ): void { if ( ! $this->is_divi_5_or_higher() ) { return; } $this->modern_module = new WPFormsSelectorModern(); if ( $this->is_divi_builder() ) { $this->insert( $this->modern_module ); } $dependency_tree->add_dependency( $this->modern_module ); } /** * Check if Divi 5 or higher is active. * * @since 1.9.9 * * @return bool * @noinspection PhpUndefinedConstantInspection */ protected function is_divi_5_or_higher(): bool { if ( ! defined( 'ET_BUILDER_VERSION' ) ) { return false; } return version_compare( ET_BUILDER_VERSION, '5.0.0', '>=' ); } /** * Determine if a current page is opened in the Divi Builder. * * @since 1.6.3 * * @return bool */ private function is_divi_builder(): bool { return ! empty( $_GET['et_fb'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended } /** * Get the current style name. * * Overwrite styles for the Divi Builder. * * @since 1.6.3 * * @return string */ public function get_current_styles_name(): string { $disable_css = absint( wpforms_setting( 'disable-css', 1 ) ); if ( $disable_css === 3 ) { return ''; } $styles_name = wpforms_get_render_engine() . '-'; $styles_name .= $disable_css === 1 ? 'full' : 'base'; return $styles_name; } /** * Determine if the Divi Builder plugin is loaded. * * @since 1.6.3 * * @return bool */ protected function is_divi_plugin_loaded(): bool { return self::is_divi_loaded(); } /** * Helper method to check if the Divi plugin is loaded. * * @since 1.8.5 * * @return bool */ public static function is_divi_loaded(): bool { if ( ! is_singular() ) { return false; } return defined( 'ET_BUILDER_PLUGIN_ACTIVE' ) || defined( 'ET_BUILDER_THEME' ); } /** * WPForms frontend styles special for Divi. * * @since 1.8.1 */ protected function divi_frontend_styles() { $min = wpforms_get_min_suffix(); $styles_name = $this->get_current_styles_name(); wp_enqueue_style( 'wpforms-choicesjs', WPFORMS_PLUGIN_URL . "assets/css/integrations/divi/choices{$min}.css", [], WPForms_Field_Select::CHOICES_VERSION ); if ( empty( $styles_name ) ) { return; } // Load CSS per global setting. wp_register_style( "wpforms-divi-{$styles_name}", WPFORMS_PLUGIN_URL . "assets/css/integrations/divi/wpforms-{$styles_name}{$min}.css", [], WPFORMS_VERSION ); } /** * Register frontend styles. * Required for the plugin version of builder only. * * @since 1.6.3 */ public function frontend_styles() { if ( ! $this->is_divi_plugin_loaded() ) { return; } if ( $this->allow_frontend_styles() ) { $this->divi_frontend_styles(); } } /** * Load styles. * * @since 1.6.3 */ public function builder_styles() { $min = wpforms_get_min_suffix(); wp_enqueue_style( 'wpforms-integrations', WPFORMS_PLUGIN_URL . "assets/css/admin-integrations{$min}.css", null, WPFORMS_VERSION ); $this->divi_frontend_styles(); } /** * Load scripts. * * @since 1.6.3 */ public function builder_scripts(): void { if ( ! $this->legacy_module ) { return; } $min = wpforms_get_min_suffix(); wp_enqueue_script( 'wpforms-divi', WPFORMS_PLUGIN_URL . "assets/js/integrations/divi/formselector.es5{$min}.js", [ 'react', 'react-dom' ], WPFORMS_VERSION, true ); $this->insert( $this->legacy_module ); wp_localize_script( 'wpforms-divi', 'wpforms_divi_builder', $this->legacy_module->get_localized_data() ); } /** * Injects localized data into the provided form selector to be used in the frontend. * * @since 1.9.9 * * @param LocalizedDataInterface $form_selector Interface instance to set localized data for forms. */ private function insert( LocalizedDataInterface $form_selector ): void { $form_selector->set_localized_data( [ 'ajax_url' => admin_url( 'admin-ajax.php' ), 'nonce' => wp_create_nonce( 'wpforms_divi_builder' ), 'placeholder' => WPFORMS_PLUGIN_URL . 'assets/images/wpforms-logo.svg', 'block_empty_url' => WPFORMS_PLUGIN_URL . 'assets/images/empty-states/no-forms.svg', 'block_empty_text' => wp_kses( __( 'You can use <b>WPForms</b> to build contact forms, surveys, payment forms, and more with just a few clicks.', 'wpforms-lite' ), [ 'b' => [], ] ), 'get_started_url' => esc_url( admin_url( 'admin.php?page=wpforms-builder' ) ), 'get_started_text' => esc_html__( 'Get Started', 'wpforms-lite' ), 'guide_url' => esc_url( wpforms_utm_link( 'https://wpforms.com/docs/creating-first-form/', 'Divi', 'Create Your First Form Documentation' ) ), 'guide_text' => esc_html__( 'comprehensive guide', 'wpforms-lite' ), 'help_text' => esc_html__( 'Need some help? Check out our', 'wpforms-lite' ), ] ); } /** * Register module. * * @since 1.6.3 */ public function register_module(): void { if ( ! class_exists( 'ET_Builder_Module' ) || ( $this->is_divi_5_or_higher() && $this->is_divi_builder() ) ) { return; } $this->legacy_module = new WPFormsSelector(); } /** * Ajax handler for the form preview. * * @since 1.6.3 */ public function preview(): void { // phpcs:ignore WPForms.PHP.HooksMethod.InvalidPlaceForAddingHooks check_ajax_referer( 'wpforms_divi_builder', 'nonce' ); $form_id = absint( filter_input( INPUT_POST, 'form_id', FILTER_SANITIZE_NUMBER_INT ) ); if ( $form_id ) { $form_obj = wpforms()->obj( 'form' ); $form = $form_obj ? $form_obj->get( $form_id ) : null; $author = $form ? (int) $form->post_author : 0; $cap = $author === get_current_user_id() ? 'wpforms_view_own_forms' : 'wpforms_view_others_forms'; $has_permission = wpforms_current_user_can( $cap, $form_id ); } else { $has_permission = wpforms_current_user_can( [ 'wpforms_view_own_forms', 'wpforms_view_others_forms' ] ); } if ( ! $has_permission ) { wp_send_json_error( esc_html__( 'You do not have permission to preview form.', 'wpforms-lite' ) ); } // Disable Anti Spam v3 honeypot. add_filter( 'wpforms_forms_anti_spam_v3_is_honeypot_enabled', '__return_false' ); add_filter( 'wpforms_frontend_container_class', static function ( $classes ) { $classes[] = 'wpforms-gutenberg-form-selector'; $classes[] = 'wpforms-container-full'; return $classes; } ); add_action( 'wpforms_frontend_output', static function () { echo '<fieldset disabled>'; }, 3 ); add_action( 'wpforms_frontend_output', static function () { echo '</fieldset>'; // This empty image is needed to execute JS code that triggers the custom event. // Unfortunately, the < script > tag doesn't work in the Divi Builder. echo '<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==" alt="Empty" height="0" width="0" onLoad="jQuery( document ).trigger( \'wpformsDiviModuleDisplay\' );" />'; }, 30 ); /** * Allows showing/hiding form title and description. * * @since 1.6.3.1 * * @param bool $show_title Show form title. * @param int $form_id Form ID. */ $show_title = (bool) apply_filters( // phpcs:ignore WPForms.PHP.ValidateHooks.InvalidHookName 'wpforms_divi_builder_form_title', 'on' === filter_input( INPUT_POST, 'show_title', FILTER_SANITIZE_FULL_SPECIAL_CHARS ), $form_id ); /** * Allows showing/hiding form description. * * @since 1.6.3.1 * * @param bool $show_desc Show form description. * @param int $form_id Form ID. */ $show_desc = (bool) apply_filters( // phpcs:ignore WPForms.PHP.ValidateHooks.InvalidHookName 'wpforms_divi_builder_form_desc', 'on' === filter_input( INPUT_POST, 'show_desc', FILTER_SANITIZE_FULL_SPECIAL_CHARS ), $form_id ); wp_send_json_success( do_shortcode( sprintf( '[wpforms id="%1$d" title="%2$s" description="%3$s"]', $form_id, $show_title, $show_desc ) ) ); } /** * Allow frontend styles. * * @since 1.9.8.6 * * @return bool */ protected function allow_frontend_styles(): bool { $frontend_obj = wpforms()->obj( 'frontend' ); if ( ! $frontend_obj ) { return false; } global $post; $content = $post->post_content ?? ''; return ( $frontend_obj->assets_global() || has_shortcode( $content, 'wpforms' ) || has_shortcode( $content, 'wpforms_selector' ) || ( function_exists( 'has_block' ) && has_block( 'wpforms/form-selector' ) ) ); } }