dvadf
File manager - Edit - /home/centroca/public_html/Admin.zip
Back
PK �D0]�A�: : Education/StringsTrait.phpnu �[��� <?php namespace WPForms\Admin\Education; /** * Strings trait. * * @since 1.8.8 */ trait StringsTrait { /** * Localize common strings. * * @since 1.6.6 * * @return array */ protected function get_js_strings(): array { $strings = []; $name = '%name%'; $strings['ok'] = esc_html__( 'Ok', 'wpforms-lite' ); $strings['cancel'] = esc_html__( 'Cancel', 'wpforms-lite' ); $strings['close'] = esc_html__( 'Close', 'wpforms-lite' ); $strings['view_demo'] = esc_html__( 'View Demo', 'wpforms-lite' ); $strings['ajax_url'] = admin_url( 'admin-ajax.php' ); $strings['nonce'] = wp_create_nonce( 'wpforms-education' ); $strings['activate_prompt'] = '<p>' . esc_html( sprintf( /* translators: %s - addon name. */ __( 'The %s is installed but not activated. Would you like to activate it?', 'wpforms-lite' ), $name ) ) . '</p>'; $strings['activate_confirm'] = esc_html__( 'Yes, Activate', 'wpforms-lite' ); $strings['addon_activated'] = esc_html__( 'Addon activated', 'wpforms-lite' ); $strings['plugin_activated'] = esc_html__( 'Plugin activated', 'wpforms-lite' ); $strings['activating'] = esc_html__( 'Activating', 'wpforms-lite' ); $strings['install_prompt'] = '<p>' . esc_html( sprintf( /* translators: %s - addon name. */ __( 'The %s is not installed. Would you like to install and activate it?', 'wpforms-lite' ), $name ) ) . '</p>'; $strings['install_confirm'] = esc_html__( 'Yes, Install and Activate', 'wpforms-lite' ); $strings['installing'] = esc_html__( 'Installing', 'wpforms-lite' ); $strings['save_prompt'] = esc_html__( 'Almost done! Would you like to save and refresh the form builder?', 'wpforms-lite' ); $strings['save_confirm'] = esc_html__( 'Yes, save and refresh', 'wpforms-lite' ); $strings['saving'] = esc_html__( 'Saving ...', 'wpforms-lite' ); // Check if the user can install addons. // Includes license check. $can_install_addons = wpforms_can_install( 'addon' ); // Check if the user can install plugins. // Only checks if the user has the capability. // Needed to display the correct message for non-admin users. $can_install_plugins = current_user_can( 'install_plugins' ); $strings['can_install_addons'] = $can_install_addons && $can_install_plugins; if ( ! $can_install_addons ) { $strings['install_prompt'] = '<p>' . esc_html( sprintf( /* translators: %s - addon name. */ __( 'The %s is not installed. Please install and activate it to use this feature.', 'wpforms-lite' ), $name ) ) . '</p>'; } if ( ! $can_install_plugins ) { /* translators: %s - addon name. */ $strings['install_prompt'] = '<p>' . esc_html( sprintf( /* translators: %s - addon name. */ __( 'The %s is not installed. Please contact the site administrator.', 'wpforms-lite' ), $name ) ) . '</p>'; } // Check if the user can activate plugins. $can_activate_plugins = current_user_can( 'activate_plugins' ); $strings['can_activate_addons'] = $can_activate_plugins; if ( ! $can_activate_plugins ) { /* translators: %s - addon name. */ $strings['activate_prompt'] = '<p>' . esc_html( sprintf( __( 'The %s is not activated. Please contact the site administrator.', 'wpforms-lite' ), $name ) ) . '</p>'; } $upgrade_utm_medium = wpforms_is_admin_page() ? 'Settings - Integration' : 'Builder - Settings'; if ( wpforms_is_block_editor() ) { $upgrade_utm_medium = 'gutenberg'; } $strings['upgrade'] = [ 'pro' => $this->get_upgrade_strings( 'Pro', $name, $upgrade_utm_medium ), 'elite' => $this->get_upgrade_strings( 'Elite', $name, $upgrade_utm_medium ), ]; // Shared bonus body — reused by `upgrade_bonus` and `upgrade_banner.bonus` // so translators see this sentence exactly once. $bonus_body = __( 'WPForms Lite users get <span>50% off</span> regular price, automatically applied at checkout.', 'wpforms-lite' ); $strings['upgrade_bonus'] = wpautop( wp_kses( '<strong>' . esc_html__( 'Bonus:', 'wpforms-lite' ) . '</strong> ' . $bonus_body, [ 'strong' => [], 'span' => [], ] ) ); $activate_license_link = sprintf( '<a href="%1$s" class="js-activate-license">%2$s</a>', esc_url( admin_url( 'admin.php?page=wpforms-settings' ) ), esc_html__( 'Activate your license', 'wpforms-lite' ) ); // Banner upgrade modal copy — activated when the trigger carries `data-banner-src`. // The activate anchor's `href="#"` is a placeholder; JS overwrites it at runtime. $strings['upgrade_banner'] = [ 'message' => esc_html__( 'Understand how your forms are performing with detailed analytics on views, conversions, and field-level activity, so you can identify friction and improve completion rates.', 'wpforms-lite' ), 'button' => esc_html__( 'Upgrade to WPForms Pro', 'wpforms-lite' ), 'bonus' => wp_kses( '<strong>' . esc_html__( 'Bonus!', 'wpforms-lite' ) . '</strong> ' . $bonus_body . '<span class="banner-activate">' . sprintf( /* translators: %s - "Activate your license" link HTML. */ __( 'Already purchased? %s to unlock this feature.', 'wpforms-lite' ), $activate_license_link ) . '</span>', [ 'strong' => [], 'span' => [ 'class' => [] ], 'a' => [ 'href' => [], 'class' => [], ], ] ), ]; $strings['thanks_for_interest'] = esc_html__( 'Thanks for your interest in WPForms Pro!', 'wpforms-lite' ); /** * Filters the education strings. * * @since 1.6.6 * * @param array $strings Education strings. * * @return array */ return (array) apply_filters( 'wpforms_admin_education_strings', $strings ); } /** * Get upgrade strings. * * @since 1.8.8 * * @param string $level Upgrade level. * @param string $name Addon name. * @param string $upgrade_utm_medium UTM medium for the upgrade link. * * @return array * @noinspection HtmlUnknownTarget */ private function get_upgrade_strings( string $level, string $name, string $upgrade_utm_medium ): array { // phpcs:ignore WPForms.Formatting.EmptyLineAfterFunctionDeclaration.AddEmptyLineAfterFunctionDeclaration return [ 'title' => esc_html( sprintf( /* translators: %s - level name, either Pro or Elite. */ __( 'is a %s Feature', 'wpforms-lite' ), $level ) ), 'title_plural' => esc_html( sprintf( /* translators: %s - level name, either Pro or Elite. */ __( 'are a %s Feature', 'wpforms-lite' ), $level ) ), 'message' => '<p>' . esc_html( sprintf( /* translators: %1$s - addon name, %2$s - level name, either Pro or Elite. */ __( 'We\'re sorry, the %1$s is not available on your plan. Please upgrade to the %2$s plan to unlock all these awesome features.', 'wpforms-lite' ), $name, $level ) ) . '</p>', 'message_plural' => '<p>' . esc_html( sprintf( /* translators: %1$s - addon name, %2$s - level name, either Pro or Elite. */ __( 'We\'re sorry, %1$s are not available on your plan. Please upgrade to the %2$s plan to unlock all these awesome features.', 'wpforms-lite' ), $name, $level ) ) . '</p>', 'doc' => sprintf( '<a href="%1$s" target="_blank" rel="noopener noreferrer" class="already-purchased">%2$s</a>', esc_url( wpforms_utm_link( 'https://wpforms.com/docs/upgrade-wpforms-lite-paid-license/#installing-wpforms', $upgrade_utm_medium, '%name%' ) ), esc_html__( 'Already purchased?', 'wpforms-lite' ) ), 'button' => esc_html( sprintf( /* translators: %s - level name, either Pro or Elite. */ __( 'Upgrade to %s', 'wpforms-lite' ), $level ) ), 'url' => wpforms_admin_upgrade_link( $upgrade_utm_medium ), 'url_template' => wpforms_is_admin_page( 'templates' ) ? wpforms_admin_upgrade_link( 'Form Templates Subpage' ) : wpforms_admin_upgrade_link( 'builder-modal-template' ), 'url_themes' => wpforms_admin_upgrade_link( 'Builder Themes' ), 'modal' => wpforms_get_upgrade_modal_text( strtolower( $level ) ), ]; } } PK �D0],�ŕ� � Education/AddonsItemBase.phpnu �[��� <?php namespace WPForms\Admin\Education; use WPForms\Admin\Addons\Addons; use WPForms\Requirements\Requirements; /** * Base class for all "addon item" type Education features. * * @since 1.6.6 */ abstract class AddonsItemBase implements EducationInterface { /** * Instance of the Education\Core class. * * @since 1.6.6 * * @var Core */ protected $education; /** * Instance of the Education\Addons class. * * @since 1.6.6 * * @var Addons */ protected $addons; /** * Template name for rendering single addon item. * * @since 1.6.6 * * @var string */ protected $single_addon_template; /** * Indicate if the current Education feature is allowed to load. * Should be called from the child feature class. * * @since 1.6.6 * * @return bool * * @noinspection PhpMissingReturnTypeInspection * @noinspection ReturnTypeCanBeDeclaredInspection */ abstract public function allow_load(); /** * Init. * * @since 1.6.6 * * @noinspection ReturnTypeCanBeDeclaredInspection */ public function init() { if ( ! $this->allow_load() ) { return; } // Store the instance of the Education core class. $this->education = wpforms()->obj( 'education' ); // Store the instance of the Education\Addons class. $this->addons = wpforms()->obj( 'addons' ); // Define hooks. $this->hooks(); } /** * Hooks. * * @since 1.6.6 */ abstract public function hooks(); /** * Display single addon item. * * @since 1.6.6 * * @param array $addon Addon data. * * @noinspection ReturnTypeCanBeDeclaredInspection * @noinspection PhpMissingParamTypeInspection */ protected function display_single_addon( $addon ) { /** * Filter to disallow addons to be displayed in the Education feature. * * @since 1.8.2 * * @param bool $display Whether to hide the addon. * @param array $slug Addon data. */ $is_disallowed = (bool) apply_filters( 'wpforms_admin_education_addons_item_base_display_single_addon_hide', false, $addon ); if ( empty( $addon ) || $is_disallowed ) { return; } echo wpforms_render( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped $this->single_addon_template, $addon, true ); } /** * Prepare field data-attributes for the education actions. * E.g., install, activate, incompatible. * * @since 1.9.4 * * @param array $addon Current addon information. * * @return array */ protected function prepare_field_action_data( array $addon ): array { if ( empty( $addon['plugin_allow'] ) ) { return []; } if ( $addon['action'] === 'install' ) { return [ 'data' => [ 'action' => 'install', 'name' => $addon['modal_name'], 'url' => $addon['url'], 'nonce' => wp_create_nonce( 'wpforms-admin' ), 'license' => $addon['license_level'], ], 'class' => 'education-modal', ]; } if ( $addon['action'] === 'activate' ) { return [ 'data' => [ 'action' => 'activate', 'name' => sprintf( /* translators: %s - addon name. */ esc_html__( '%s addon', 'wpforms-lite' ), $addon['name'] ), 'path' => $addon['path'], 'nonce' => wp_create_nonce( 'wpforms-admin' ), ], 'class' => 'education-modal', ]; } if ( $addon['action'] === 'incompatible' ) { return [ 'data' => [ 'action' => 'incompatible', 'message' => Requirements::get_instance()->get_notice( $addon['path'] ), ], 'class' => 'education-modal', ]; } return []; } } PK �D0]A*��o o Education/Builder/PDF.phpnu �[��� <?php namespace WPForms\Admin\Education\Builder; use WPForms\Admin\Education\Helpers; /** * PDF educational popup. * * @since 1.9.7.3 */ class PDF { /** * Addon slug. * * @since 1.9.7.3 * * @var string */ private $slug = 'wpforms-pdf'; /** * Addon data. * * @since 1.9.7.3 * * @var array */ private $addon_data; /** * Initialize. * * @since 1.9.7.3 */ public function init(): void { $this->addon_data = $this->get_addon_data(); if ( ! $this->should_show_popup() ) { return; } $this->hooks(); } /** * Should show popup. * * @since 1.9.7.3 * * @return bool */ private function should_show_popup(): bool { if ( ! wpforms_is_admin_page( 'builder' ) && ! wpforms_is_admin_ajax() ) { return false; } if ( ! current_user_can( wpforms_get_capability_manage_options() ) ) { return false; } $challenge = wpforms()->obj( 'challenge' ); if ( ! $challenge || $challenge->challenge_active() ) { return false; } return $this->is_popup_visible(); } /** * Is popup visible. * * @since 1.9.7.3 * * @return bool */ private function is_popup_visible(): bool { $action = $this->addon_data['action'] ?? 'install'; if ( empty( $this->addon_data ) || ( $action === 'install' && empty( $this->addon_data['url'] ) ) // The install action requires a valid URL. ) { return false; } $meta = get_user_meta( get_current_user_id(), 'wpforms_dismissed', true ); return empty( $meta['edu-builder-pdf'] ); } /** * Hooks. * * @since 1.9.7.3 */ private function hooks(): void { add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_scripts' ] ); add_filter( 'wpforms_builder_output_before_toolbar', [ $this, 'popup_html' ] ); } /** * Enqueue scripts. * * @since 1.9.7.3 */ public function enqueue_scripts(): void { $min = wpforms_get_min_suffix(); wp_enqueue_script( 'wpforms-pdf-popup', WPFORMS_PLUGIN_URL . "assets/js/admin/education/pdf$min.js", [], WPFORMS_VERSION, true ); } /** * Popup HTML. * * @since 1.9.7.3 * * @param string|mixed $html HTML. * * @return string * @noinspection HtmlUnknownTarget */ public function popup_html( $html ): string { $html = (string) $html; $popup = sprintf( '<div id="wpforms-pdf-popup" class="wpforms-pdf-popup wpforms-hidden wpforms-dismiss-container" role="dialog" aria-modal="true" aria-labelledby="wpforms-pdf-popup-title" aria-describedby="wpforms-pdf-popup-description"> <div class="wpforms-pdf-popup-content"> <div class="icon"> <img src="%1$s" alt="PDF Icon"> </div> <div class="close-popup wpforms-dismiss-button dashicons-no-alt" data-section="builder-pdf"></div> <div class="badge">%2$s</div> <h2 id="wpforms-pdf-popup-title">%3$s</h2> <p id="wpforms-pdf-popup-description">%4$s</p> %5$s </div> </div>', esc_url( WPFORMS_PLUGIN_URL . 'assets/images/pdf-education/pdf.svg' ), __( 'NEW FEATURE', 'wpforms-lite' ), __( 'PDF Addon', 'wpforms-lite' ), __( 'Easily turn form entry data into beautifully designed PDFs and attach them to notifications.', 'wpforms-lite' ), $this->get_button_html() ); return $popup . $html; } /** * Get button HTML. * * @since 1.9.7.3 * * @return string * @noinspection HtmlUnknownAttribute */ private function get_button_html(): string { $addon = $this->addon_data; $action = $addon['action'] ?? 'switch'; [ $button_label, $button_utm, $button_class, $button_attr ] = $this->get_button_data( $action, $addon ); return sprintf( '<button class="wpforms-btn wpforms-btn-sm wpforms-btn-orange %1$s" data-action="%2$s" %4$s data-license="%5$s" data-utm-content="%6$s">%3$s</button>', esc_attr( $button_class ), esc_attr( $action ), esc_html( $button_label ), $button_attr, esc_attr( $addon['license_level'] ?? 'pro' ), esc_attr( $button_utm ) ); } /** * Get addon data. * * @since 1.9.7.3 * * @return array */ private function get_addon_data(): array { /** * Filter the slug for the PDF educational popup. * * @since 1.9.7.3 * * @param string $slug The slug for the PDF educational popup. */ $slug = apply_filters( 'wpforms_admin_education_builder_pdf_get_addon_data_slug', $this->slug ); $addons = Helpers::get_edu_addons(); return $addons[ $slug ] ?? []; } /** * Get button data. * * @since 1.9.7.3 * * @param string $action Action type (switch, upgrade, etc.). * @param array $addon Addon data. * * @return array */ protected function get_button_data( string $action, array $addon ): array { $button_label = $action === 'upgrade' ? esc_html__( 'Upgrade to Pro', 'wpforms-lite' ) : esc_html__( 'Try it Out', 'wpforms-lite' ); $button_utm = 'PDF Addon Pop-up'; $button_class = 'education-action-button'; $button_attr = ''; if ( $action === 'switch' ) { $button_class = 'education-modal education-switch-button'; $button_attr = 'data-target="wpforms-pdf"'; } elseif ( $action !== 'upgrade' ) { $button_class = 'education-modal'; $button_attr = sprintf( 'data-nonce="%1$s" data-path="%2$s" data-url="%3$s" data-message="" data-name="%4$s"', esc_attr( wp_create_nonce( 'wpforms-admin' ) ), $addon['path'] ?? '', $addon['url'] ?? '', esc_html__( 'WPForms PDF Addon', 'wpforms-lite' ) ); } return [ $button_label, $button_utm, $button_class, $button_attr ]; } } PK �D0]�օ% Education/Builder/Panel.phpnu �[��� <?php namespace WPForms\Admin\Education\Builder; use \WPForms\Admin\Education\AddonsListBase; /** * Base class for Builder/Settings, Builder/Providers, Builder/Payments Education features. * * @since 1.6.6 */ abstract class Panel extends AddonsListBase { /** * Panel slug. Should be redefined in the real Builder/Panel class. * * @since 1.6.6 * * @return string **/ abstract protected function get_name(); /** * Indicate if current Education feature is allowed to load. * * @since 1.6.6 * * @return bool */ public function allow_load() { // Load only in the Form Builder. return wpforms_is_admin_page( 'builder' ) && ! empty( $this->get_name() ); } /** * Get addons for the current panel. * * @since 1.6.6 */ protected function get_addons() { return $this->addons->get_by_path( 'form_builder.category', $this->get_name() ); } /** * Template name for rendering single addon item. * * @since 1.6.6 * * @return string */ protected function get_single_addon_template() { return 'education/builder/' . $this->get_name() . '-item'; } /** * Display addons. * * @since 1.6.6 */ public function display_addons() { $this->single_addon_template = $this->get_single_addon_template(); parent::display_addons(); } } PK �D0]�+��� � Education/Builder/Providers.phpnu �[��� <?php namespace WPForms\Admin\Education\Builder; use \WPForms\Admin\Education; /** * Builder/Providers Education feature. * * @since 1.6.6 */ class Providers extends Education\Builder\Panel { /** * Panel slug. * * @since 1.6.6 * * @return string **/ protected function get_name() { return 'providers'; } /** * Hooks. * * @since 1.6.6 */ public function hooks() { add_action( 'wpforms_providers_panel_sidebar', [ $this, 'filter_addons' ], 1 ); add_action( 'wpforms_providers_panel_sidebar', [ $this, 'display_addons' ], 500 ); } /** * Ensure that we do not display activated addon items if those addons are not allowed according to the current license. * * @since 1.6.6 */ public function filter_addons() { $this->filter_not_allowed_addons( 'wpforms_providers_panel_sidebar' ); } /** * Get addons for the Marketing panel. * * @since 1.7.7.2 */ protected function get_addons() { $addons = parent::get_addons(); /** * Google Sheets uses Providers API. All providers are automatically * added to the Marketing tab in the builder. We don't need the addon * on the Marketing tab because the addon is already added to * the builder's Settings tab. */ foreach ( $addons as $key => $addon ) { if ( isset( $addon['slug'] ) && $addon['slug'] === 'wpforms-google-sheets' ) { unset( $addons[ $key ] ); break; } } return $addons; } } PK �D0]�Kx� � ! Education/Builder/Geolocation.phpnu �[��� <?php namespace WPForms\Admin\Education\Builder; use WPForms\Admin\Education\AddonsItemBase; use WPForms\Admin\Education\Helpers; /** * Builder/Geolocation Education feature for Lite and Pro. * * @since 1.6.6 */ class Geolocation extends AddonsItemBase { /** * Indicate if the current Education feature is allowed to load. * * @since 1.6.6 * * @return bool * * @noinspection ReturnTypeCanBeDeclaredInspection * @noinspection PhpMissingReturnTypeInspection */ public function allow_load() { return wpforms_is_admin_page( 'builder' ) || wp_doing_ajax(); } /** * Hooks. * * @since 1.6.6 * * @noinspection ReturnTypeCanBeDeclaredInspection */ public function hooks() { add_action( 'wpforms_field_options_bottom_advanced-options', [ $this, 'geolocation_options' ], 10, 2 ); } /** * Display geolocation options. * * @since 1.6.6 * * @param array $field Field data. * @param object $instance Builder instance. * * @noinspection ReturnTypeCanBeDeclaredInspection * @noinspection PhpMissingParamTypeInspection */ public function geolocation_options( $field, $instance ) { if ( ! in_array( $field['type'], [ 'text', 'address' ], true ) ) { return; } $addon = $this->addons->get_addon( 'geolocation' ); if ( empty( $addon ) || empty( $addon['action'] ) || empty( $addon['status'] ) || ( $addon['status'] === 'active' && $addon['action'] !== 'upgrade' ) ) { return; } $row_args = $this->get_address_autocomplete_row_attributes( $addon ); $row_args['content'] = $instance->field_element( 'toggle', $field, $this->get_address_autocomplete_field_attributes( $addon ), false ); $instance->field_element( 'row', $field, $row_args ); } /** * Get attributes for address autocomplete row. * * @since 1.6.6 * * @param array $addon Current addon information. * * @return array */ private function get_address_autocomplete_row_attributes( array $addon ): array { $data = $this->prepare_field_action_data( $addon ); $default = [ 'slug' => 'enable_address_autocomplete', ]; if ( ! empty( $data ) ) { return wp_parse_args( $data, $default ); } return wp_parse_args( [ 'data' => [ 'action' => 'upgrade', 'name' => esc_html__( 'Address Autocomplete', 'wpforms-lite' ), 'utm-content' => 'Address Autocomplete', 'licence' => 'pro', 'message' => esc_html__( 'We\'re sorry, Address Autocomplete is part of the Geolocation Addon and not available on your plan. Please upgrade to the PRO plan to unlock all these awesome features.', 'wpforms-lite' ), ], 'class' => 'education-modal', ], $default ); } /** * Get attributes for address autocomplete field. * * @since 1.6.6 * * @param array $addon Current addon information. * * @return array */ private function get_address_autocomplete_field_attributes( array $addon ): array { $default = [ 'slug' => 'enable_address_autocomplete', 'value' => '0', 'desc' => esc_html__( 'Enable Address Autocomplete', 'wpforms-lite' ), ]; if ( $addon['plugin_allow'] ) { return $default; } return wp_parse_args( [ 'desc' => sprintf( '%1$s%2$s', esc_html__( 'Enable Address Autocomplete', 'wpforms-lite' ), Helpers::get_badge( 'Pro', 'sm', 'inline', 'slate' ) ), 'attrs' => [ 'disabled' => 'disabled', ], ], $default ); } } PK �D0]��Ѫu u Education/Builder/Gdpr.phpnu �[��� <?php namespace WPForms\Admin\Education\Builder; use WPForms\Education\WPConsent\Helper as WPConsent; /** * WPConsent cross-promo notice inside the GDPR Agreement field options. * * @since 2.0.0 */ class Gdpr { /** * Init. * * @since 2.0.0 */ public function init() { $this->hooks(); } /** * Register hooks. * * @since 2.0.0 */ private function hooks() { add_action( 'wpforms_field_options_bottom_basic-options', [ $this, 'maybe_render_notice' ], 10, 1 ); add_action( 'wpforms_builder_enqueues', [ $this, 'enqueue_assets' ] ); } /** * Whether the WPConsent notice should render. * * @since 2.0.0 * * @return bool */ private function should_render(): bool { return ! WPConsent::is_activated() && wpforms_can_install( 'plugin' ); } /** * Render the "Set Up Privacy Compliance" notice below Description for the * GDPR Agreement field only. * * @since 2.0.0 * * @param array $field Field data. */ public function maybe_render_notice( $field ) { if ( ! isset( $field['type'] ) || $field['type'] !== 'gdpr-checkbox' || ! $this->should_render() ) { return; } $data = WPConsent::get_install_button_data(); $attrs_html = ''; foreach ( $data['attrs'] as $key => $value ) { $attrs_html .= sprintf( ' %s="%s"', esc_attr( $key ), esc_attr( $value ) ); } printf( '<div class="wpforms-alert wpforms-alert-info wpforms-gdpr-wpconsent-notice"> <h4 class="wpforms-alert-heading">%1$s</h4> <p>%2$s</p> <button type="button" class="wpforms-btn wpforms-btn-sm wpforms-btn-blue wpforms-wpconsent-install" data-setup-url="%3$s" data-setup-text="%4$s"%5$s>%6$s</button> </div>', esc_html__( 'Set Up Privacy Compliance', 'wpforms-lite' ), esc_html__( 'Improve GDPR, CCPA, and privacy compliance with cookie banner and consent records.', 'wpforms-lite' ), esc_url( WPConsent::get_setup_url() ), esc_attr__( 'Set Up WPConsent', 'wpforms-lite' ), $attrs_html, // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- each attr key/value escaped above. esc_html__( 'Install WPConsent', 'wpforms-lite' ) ); } /** * Enqueue the inline install handler in the builder. * * @since 2.0.0 */ public function enqueue_assets() { if ( ! $this->should_render() ) { return; } $min = wpforms_get_min_suffix(); wp_enqueue_script( 'wpforms-wpconsent-install', WPFORMS_PLUGIN_URL . "assets/js/admin/education/wpconsent-install{$min}.js", [ 'jquery' ], WPFORMS_VERSION, true ); wp_localize_script( 'wpforms-wpconsent-install', 'wpforms_wpconsent_install', [ 'ajax_url' => admin_url( 'admin-ajax.php' ) ] ); } } PK �D0]3��� � Education/Builder/Settings.phpnu �[��� <?php namespace WPForms\Admin\Education\Builder; use \WPForms\Admin\Education; /** * Builder/Settings Education feature. * * @since 1.6.6 */ class Settings extends Education\Builder\Panel { /** * Panel slug. * * @since 1.6.6 * * @return string **/ protected function get_name() { return 'settings'; } /** * Hooks. * * @since 1.6.6 */ public function hooks() { add_filter( 'wpforms_builder_settings_sections', [ $this, 'filter_addons' ], 1 ); add_action( 'wpforms_builder_after_panel_sidebar', [ $this, 'display' ], 100, 2 ); } /** * Display settings addons. * * @since 1.6.6 * * @param object $form Current form. * @param string $panel Panel slug. */ public function display( $form, $panel ) { if ( empty( $form ) || $this->get_name() !== $panel ) { return; } $this->display_addons(); } /** * Ensure that we do not display activated addon items if those addons are not allowed according to the current license. * * @since 1.6.6 * * @param array $sections Settings sections. * * @return array */ public function filter_addons( $sections ) { $this->filter_not_allowed_addons( 'wpforms_builder_settings_sections' ); return $sections; } } PK �D0]���` ` Education/Builder/Fields.phpnu �[��� <?php namespace WPForms\Admin\Education\Builder; use WPForms\Admin\Education\AddonsItemBase; use WPForms\Admin\Education\Fields as EducationFields; /** * Base class for Builder/Fields Education feature. * * @since 1.6.6 */ abstract class Fields extends AddonsItemBase { /** * Instance of the Education\Fields class. * * @since 1.6.6 * * @var EducationFields */ protected $fields; /** * Indicate if current Education feature is allowed to load. * * @since 1.6.6 * * @return bool */ public function allow_load(): bool { return wp_doing_ajax() || wpforms_is_admin_page( 'builder' ); } /** * Init. * * @since 1.6.6 */ public function init(): void { parent::init(); // Store the instance of the Education\Fields class. $this->fields = wpforms()->obj( 'education_fields' ); } /** * Print the form preview notice. * * @since 1.9.4 * * @param array $texts Notice texts. */ protected function print_form_preview_notice( $texts ): void { printf( '<div class="wpforms-alert %1$s wpforms-alert-dismissible wpforms-pro-fields-notice wpforms-dismiss-container"> <div class="wpforms-alert-message"> <h3>%2$s</h3> <p>%3$s</p> </div> <div class="wpforms-alert-buttons"> <button type="button" class="wpforms-dismiss-button" data-section="%4$s" title="%5$s" /> </div> </div>', esc_attr( $texts['class'] ), esc_html( $texts['title'] ), $texts['content'], // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped esc_html( $texts['dismiss_section'] ), esc_attr__( 'Dismiss this notice', 'wpforms-lite' ) ); } } PK �D0]w�ߪ � Education/Builder/Captcha.phpnu �[��� <?php namespace WPForms\Admin\Education\Builder; use WPForms\Admin\Education\EducationInterface; use WPForms\Education\ActiveLayer\Helper as ActiveLayer; /** * Builder/ReCaptcha Education feature. * * @since 1.6.6 */ class Captcha implements EducationInterface { /** * Indicate if current Education feature is allowed to load. * * @since 1.6.6 */ public function allow_load() { return wp_doing_ajax(); } /** * Init. * * @since 1.6.6 */ public function init() { if ( ! $this->allow_load() ) { return; } // Define hooks. $this->hooks(); } /** * Hooks. * * @since 1.6.6 */ public function hooks() { add_action( 'wp_ajax_wpforms_update_field_captcha', [ $this, 'captcha_field_callback' ] ); } /** * Targeting on hCaptcha/reCAPTCHA field button in the builder. * * @since 1.6.6 */ public function captcha_field_callback() { // Run a security check. check_ajax_referer( 'wpforms-builder', 'nonce' ); // Check for form ID. if ( empty( $_POST['id'] ) ) { wp_send_json_error( esc_html__( 'No form ID found.', 'wpforms-lite' ) ); } $form_id = absint( $_POST['id'] ); // Check for permissions. if ( ! wpforms_current_user_can( 'edit_form_single', $form_id ) ) { wp_send_json_error( esc_html__( 'You do not have permission.', 'wpforms-lite' ) ); } // Get an actual form data. $form_data = wpforms()->obj( 'form' )->get( $form_id, [ 'content_only' => true ] ); // Check that CAPTCHA is configured in the settings. $captcha_settings = wpforms_get_captcha_settings(); $captcha_name = $this->get_captcha_name( $captcha_settings ); if ( empty( $form_data ) || empty( $captcha_name ) ) { wp_send_json_error( esc_html__( 'Something wrong. Please try again later.', 'wpforms-lite' ) ); } // Prepare a result array. $data = $this->get_captcha_result_mockup( $captcha_settings ); if ( empty( $captcha_settings['site_key'] ) || empty( $captcha_settings['secret_key'] ) ) { // If CAPTCHA is not configured in the WPForms plugin settings. $data['current'] = 'not_configured'; } elseif ( ! isset( $form_data['settings']['recaptcha'] ) || $form_data['settings']['recaptcha'] !== '1' ) { // If CAPTCHA is configured in WPForms plugin settings, but wasn't set in form settings. $data['current'] = 'configured_not_enabled'; } else { // If CAPTCHA is configured in WPForms plugin and form settings. $data['current'] = 'configured_enabled'; } wp_send_json_success( $data ); } /** * Retrieve the CAPTCHA name. * * @since 1.6.6 * * @param array $settings The CAPTCHA settings. * * @return string */ private function get_captcha_name( $settings ) { if ( empty( $settings['provider'] ) ) { return ''; } if ( empty( $settings['site_key'] ) && empty( $settings['secret_key'] ) ) { return esc_html__( 'CAPTCHA', 'wpforms-lite' ); } if ( $settings['provider'] === 'hcaptcha' ) { return esc_html__( 'hCaptcha', 'wpforms-lite' ); } if ( $settings['provider'] === 'turnstile' ) { return esc_html__( 'Cloudflare Turnstile', 'wpforms-lite' ); } $recaptcha_names = [ 'v2' => esc_html__( 'Google Checkbox v2 reCAPTCHA', 'wpforms-lite' ), 'invisible' => esc_html__( 'Google Invisible v2 reCAPTCHA', 'wpforms-lite' ), 'v3' => esc_html__( 'Google v3 reCAPTCHA', 'wpforms-lite' ), ]; return isset( $recaptcha_names[ $settings['recaptcha_type'] ] ) ? $recaptcha_names[ $settings['recaptcha_type'] ] : ''; } /** * Get CAPTCHA callback result mockup. * * @since 1.6.6 * * @param array $settings The CAPTCHA settings. * * @return array */ private function get_captcha_result_mockup( $settings ) { $captcha_name = $this->get_captcha_name( $settings ); if ( empty( $captcha_name ) ) { wp_send_json_error( esc_html__( 'Something wrong. Please, try again later.', 'wpforms-lite' ) ); } $not_configured_content = sprintf( wp_kses( /* translators: %1$s - CAPTCHA settings page URL, %2$s - WPForms.com doc URL. */ __( 'Please complete the setup in your <a href="%1$s" target="_blank">WPForms Settings</a>, and check out <a href="%2$s" target="_blank" rel="noopener noreferrer">our guide</a> to learn about available CAPTCHA solutions.', 'wpforms-lite' ), [ 'a' => [ 'href' => true, 'rel' => true, 'target' => true, ], ] ), esc_url( admin_url( 'admin.php?page=wpforms-settings&view=captcha' ) ), esc_url( wpforms_utm_link( 'https://wpforms.com/docs/setup-captcha-wpforms/', 'builder-modal', 'Captcha Documentation' ) ) ); // The success modal is only reachable through the footer's install CTA, // so only ship its data when the footer actually renders. $footer = $this->get_activelayer_footer_html(); return [ 'current' => false, 'cases' => [ 'not_configured' => [ 'title' => esc_html__( 'Heads up!', 'wpforms-lite' ), 'content' => $not_configured_content, 'footer' => $footer, 'success_modal' => $footer === '' ? null : $this->get_activelayer_success_modal_data(), ], 'configured_not_enabled' => [ 'title' => false, /* translators: %s - CAPTCHA name. */ 'content' => sprintf( esc_html__( '%s has been enabled for this form. Don\'t forget to save your form!', 'wpforms-lite' ), $captcha_name ), ], 'configured_enabled' => [ 'title' => false, /* translators: %s - CAPTCHA name. */ 'content' => sprintf( esc_html__( 'Are you sure you want to disable %s for this form?', 'wpforms-lite' ), $captcha_name ), 'cancel' => true, ], ], 'provider' => $settings['provider'], ]; } /** * ActiveLayer cross-promo footer for the captcha not_configured modal. * Empty when ActiveLayer is already active or the user cannot install plugins. * * @since 2.0.0 * * @return string */ private function get_activelayer_footer_html(): string { if ( ActiveLayer::is_activated() || ! wpforms_can_install( 'plugin' ) ) { return ''; } $modal = ActiveLayer::get_modal_data(); $attrs_html = ''; foreach ( $modal['attrs'] as $key => $value ) { $attrs_html .= sprintf( ' %s="%s"', esc_attr( $key ), esc_attr( $value ) ); } // Body copy with "ActiveLayer" linking to the marketing site in a new tab. $body = sprintf( wp_kses( /* translators: %1$s - ActiveLayer marketing site URL. */ __( 'Captchas can reduce form completions by up to 40%%. <a href="%1$s" target="_blank" rel="noopener noreferrer">ActiveLayer</a> catches bots invisibly, without asking your visitors to prove they\'re human.', 'wpforms-lite' ), [ 'a' => [ 'href' => true, 'target' => true, 'rel' => true, ], ] ), esc_url( wpforms_utm_link( 'https://activelayer.com/', 'builder-modal', 'ActiveLayer Captcha Footer' ) ) ); // The install CTA drives the bespoke flow in captcha.js (direct install, // no confirm modal); it deliberately does NOT use the `education-modal` class. return sprintf( '<div class="wpforms-captcha-activelayer-footer"><p>%1$s <a href="#" class="wpforms-captcha-activelayer-install"%2$s>%3$s</a></p></div>', $body, // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- escaped via wp_kses and esc_url. $attrs_html, // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- attrs escaped above. esc_html__( 'Install Now', 'wpforms-lite' ) ); } /** * Copy and target for the "Installation Successful" confirmation modal * shown by captcha.js after ActiveLayer is installed from the footer CTA. * * @since 2.0.0 * * @return array */ private function get_activelayer_success_modal_data(): array { return [ 'title' => esc_html__( 'Installation Successful', 'wpforms-lite' ), 'content' => esc_html__( 'ActiveLayer has been installed and is ready to be configured. Would you like to set it up now?', 'wpforms-lite' ), 'setup_text' => esc_html__( 'Yes, Go to Setup', 'wpforms-lite' ), 'setup_url' => ActiveLayer::get_dashboard_url(), ]; } } PK �D0]�g� � Education/Builder/Quiz.phpnu �[��� <?php namespace WPForms\Admin\Education\Builder; use WPForms\Admin\Education\AddonsItemBase; use WPForms\Admin\Education\Helpers; /** * Builder/Quiz Education feature for Lite and Pro. * * @since 1.9.9 */ class Quiz extends AddonsItemBase { /** * Indicate if the current Education feature is allowed to load. * * @since 1.9.9 * * @return bool * * @noinspection ReturnTypeCanBeDeclaredInspection * @noinspection PhpMissingReturnTypeInspection */ public function allow_load() { return wpforms_is_admin_page( 'builder' ) || wp_doing_ajax(); } /** * Hooks. * * @since 1.9.9 * * @noinspection ReturnTypeCanBeDeclaredInspection */ public function hooks() { add_action( 'wpforms_field_options_before_description', [ $this, 'quiz_fields' ], 10, 2 ); } /** * Display the Enable Quiz option. * * @since 1.9.9 * * @param array $field Field data. * @param object $instance Builder instance. * * @noinspection ReturnTypeCanBeDeclaredInspection * @noinspection PhpMissingParamTypeInspection * @noinspection HtmlUnknownTarget */ public function quiz_fields( $field, $instance ) { if ( ! in_array( $field['type'], [ 'radio', 'checkbox', 'select' ], true ) ) { return; } $addon = $this->addons->get_addon( 'quiz' ); if ( empty( $addon ) || empty( $addon['action'] ) || empty( $addon['status'] ) || ( $addon['status'] === 'active' && $addon['action'] !== 'upgrade' ) ) { return; } $form_id = ! empty( $instance->form_id ) ? (int) $instance->form_id : 0; $row_args = $this->get_enable_quiz_row_attributes( $addon, $form_id ); $row_args['content'] = $instance->field_element( 'toggle', $field, $this->get_enable_quiz_field_attributes( $addon ), false ); $instance->field_element( 'row', $field, $row_args ); $dismissed = get_user_meta( get_current_user_id(), 'wpforms_dismissed', true ); $dismiss_section = "builder-form-$form_id-field-options-quiz-notice"; // Check whether it is dismissed. if ( ! empty( $dismissed[ 'edu-' . $dismiss_section ] ) ) { return; } $badge = esc_html__( 'NEW FEATURE', 'wpforms-lite' ); $notice_header = esc_html__( 'Turn Your Form Into a Quiz', 'wpforms-lite' ); $notice = sprintf( wp_kses( /* translators: %1$s - link to the WPForms.com doc article. */ __( 'Easily create interactive quizzes. Add true or false, multiple choice, or checkbox questions. Set correct answers and automatically score submissions. <a href="%1$s" target="_blank" rel="noopener noreferrer">Learn more about the Quiz Addon</a>', 'wpforms-lite' ), [ 'a' => [ 'href' => [], 'rel' => [], 'target' => [], ], ] ), esc_url( wpforms_utm_link( 'https://wpforms.com/docs/quiz-addon/', 'Quiz Education', 'Quiz Documentation' ) ) ); printf( '<div class="wpforms-alert wpforms-alert-info wpforms-educational-alert wpforms-field-educational-alert wpforms-dismiss-container"> <span class="wpforms-badge wpforms-badge-sm wpforms-badge-block wpforms-badge-green wpforms-badge-rounded"> %5$s </span> <button type="button" class="wpforms-dismiss-button" title="%1$s" data-section="%2$s"></button> <h3>%4$s</h3> <p>%3$s</p> </div>', esc_html__( 'Dismiss this notice.', 'wpforms-lite' ), esc_attr( $dismiss_section ), $notice, // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped $notice_header, // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped $badge // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ); } /** * Get attributes for the `Enable Quiz` field option row. * * @since 1.9.9 * * @param array $addon Current addon information. * @param int $form_id Form ID. * * @return array */ private function get_enable_quiz_row_attributes( array $addon, int $form_id ): array { $data = $this->prepare_field_action_data( $addon ); $default = [ 'slug' => 'enable_quiz', ]; if ( ! empty( $data ) ) { $data = wp_parse_args( $data, $default ); $data['data']['redirect-url'] = add_query_arg( [ 'page' => 'wpforms-builder', 'view' => 'settings', 'form_id' => $form_id, 'section' => 'quiz', ], admin_url( 'admin.php' ) ); return $data; } return wp_parse_args( [ 'data' => [ 'action' => 'upgrade', 'name' => esc_html__( 'Quiz Addon', 'wpforms-lite' ), 'utm-content' => 'Quiz Addon', 'licence' => 'pro', 'message' => esc_html__( 'We\'re sorry, Enable Quiz is part of the Quiz Addon and not available on your plan. Please upgrade to the PRO plan to unlock all these awesome features.', 'wpforms-lite' ), ], 'class' => 'education-modal', ], $default ); } /** * Get attributes for the `Enable Quiz` field option. * * @since 1.9.9 * * @param array $addon Current addon information. * * @return array */ private function get_enable_quiz_field_attributes( array $addon ): array { $default = [ 'slug' => 'enable_quiz', 'value' => '0', 'desc' => esc_html__( 'Include in Quiz Scoring', 'wpforms-lite' ), ]; if ( $addon['plugin_allow'] ) { return $default; } return wp_parse_args( [ 'desc' => sprintf( '%1$s%2$s', esc_html__( 'Include in Quiz Scoring', 'wpforms-lite' ), Helpers::get_badge( 'Pro', 'sm', 'inline', 'slate' ) ), 'attrs' => [ 'disabled' => 'disabled', ], ], $default ); } } PK �D0]c�O�8 8 "