SiteHealth/SiteHealth.php 0000666 00000006325 15214150527 0011355 0 ustar 00 =' ); } /** * Load an integration. * * @since 1.5.5 */ public function load() { $this->hooks(); } /** * Integration hooks. * * @since 1.5.5 */ protected function hooks() { add_filter( 'debug_information', array( $this, 'add_info_section' ) ); } /** * Add WPForms section to Info tab. * * @since 1.5.5 * * @param array $debug_info Array of all information. * * @return array Array with added WPForms info section. */ public function add_info_section( $debug_info ) { $wpforms = array( 'label' => 'WPForms', 'fields' => array( 'version' => array( 'label' => esc_html__( 'Version', 'wpforms-lite' ), 'value' => WPFORMS_VERSION, ), ), ); // License key type. $wpforms['fields']['license'] = array( 'label' => esc_html__( 'License key type', 'wpforms-lite' ), 'value' => wpforms_get_license_type(), ); // Install date. $activated = get_option( 'wpforms_activated', array() ); if ( ! empty( $activated['lite'] ) ) { $date = $activated['lite'] + ( get_option( 'gmt_offset' ) * 3600 ); $wpforms['fields']['lite'] = array( 'label' => esc_html__( 'Lite install date', 'wpforms-lite' ), 'value' => date_i18n( esc_html__( 'M j, Y @ g:ia' ), $date ), ); } if ( ! empty( $activated['pro'] ) ) { $date = $activated['pro'] + ( get_option( 'gmt_offset' ) * 3600 ); $wpforms['fields']['pro'] = array( 'label' => esc_html__( 'Pro install date', 'wpforms-lite' ), 'value' => date_i18n( esc_html__( 'M j, Y @ g:ia' ), $date ), ); } // DB tables. if ( wpforms()->pro ) { $db_tables = wpforms()->get( 'pro' )->get_existing_custom_tables(); $db_tables_str = empty( $db_tables ) ? esc_html__( 'Not found', 'wpforms-lite' ) : implode( ', ', $db_tables ); $wpforms['fields']['db_tables'] = array( 'label' => esc_html__( 'DB tables', 'wpforms-lite' ), 'value' => $db_tables_str, ); } // Total forms. $wpforms['fields']['total_forms'] = array( 'label' => esc_html__( 'Total forms', 'wpforms-lite' ), 'value' => wp_count_posts( 'wpforms' )->publish, ); // Total entries. if ( wpforms()->pro ) { $wpforms['fields']['total_entries'] = array( 'label' => esc_html__( 'Total entries', 'wpforms-lite' ), 'value' => wpforms()->entry->get_entries( array(), true ), ); } else { $forms = \wpforms()->form->get( '', array( 'fields' => 'ids' ) ); if ( empty( $forms ) || ! \is_array( $forms ) ) { $forms = array(); } $count = 0; foreach ( $forms as $form_id ) { $count += (int) \get_post_meta( $form_id, 'wpforms_entries_count', true ); } $wpforms['fields']['total_entries'] = array( 'label' => esc_html__( 'Total submissions (since v1.5.0)', 'wpforms-lite' ), 'value' => $count, ); } $debug_info['wpforms'] = $wpforms; return $debug_info; } } WPMailSMTP/Notifications.php 0000666 00000005145 15214150527 0011736 0 ustar 00 options = new \WPMailSMTP\Options(); $this->filters(); } /** * Integration filters. * * @since 1.4.8 */ protected function filters() { \add_filter( 'wpforms_builder_notifications_from_name_after', array( $this, 'from_name_after' ) ); \add_filter( 'wpforms_builder_notifications_from_email_after', array( $this, 'from_email_after' ) ); } /** * Display hint if WP Mail SMTP is forcing from name. * * @since 1.4.8 * * @param string $after Text displayed after setting. * * @return string */ public function from_name_after( $after ) { if ( ! $this->options->get( 'mail', 'from_name_force' ) ) { return $after; } return sprintf( \wp_kses( /* translators: %s - URL WP Mail SMTP settings. */ \__( 'This setting is disabled because you have the "Force From Name" setting enabled in WP Mail SMTP.', 'wpforms-lite' ), array( 'a' => array( 'href' => array(), 'rel' => array(), 'target' => array(), ), ) ), \esc_url( \admin_url( 'options-general.php?page=wp-mail-smtp#wp-mail-smtp-setting-row-from_name' ) ) ); } /** * Display hint if WP Mail SMTP is forcing from email. * * @since 1.4.8 * * @param string $after Text displayed after setting. * * @return string */ public function from_email_after( $after ) { if ( ! $this->options->get( 'mail', 'from_email_force' ) ) { return $after; } return sprintf( \wp_kses( /* translators: %s - URL WP Mail SMTP settings. */ \__( 'This setting is disabled because you have the "Force From Email" setting enabled in WP Mail SMTP.', 'wpforms-lite' ), array( 'a' => array( 'href' => array(), 'rel' => array(), 'target' => array(), ), ) ), \esc_url( \admin_url( 'options-general.php?page=wp-mail-smtp#wp-mail-smtp-setting-row-from_email' ) ) ); } } Gutenberg/FormSelector.php 0000666 00000014342 15214150527 0011615 0 ustar 00 hooks(); } /** * Integration hooks. * * @since 1.4.8 */ protected function hooks() { \add_action( 'init', array( $this, 'register_block' ) ); \add_action( 'enqueue_block_editor_assets', array( $this, 'enqueue_block_editor_assets' ) ); } /** * Register WPForms Gutenberg block on the backend. * * @since 1.4.8 */ public function register_block() { \wp_register_style( 'wpforms-gutenberg-form-selector', WPFORMS_PLUGIN_URL . 'assets/css/wpforms-full.css', array( 'wp-edit-blocks' ), WPFORMS_VERSION ); $attributes = array( 'formId' => array( 'type' => 'string', ), 'displayTitle' => array( 'type' => 'boolean', ), 'displayDesc' => array( 'type' => 'boolean', ), 'className' => array( 'type' => 'string', ), ); \register_block_type( 'wpforms/form-selector', array( 'attributes' => \apply_filters( 'wpforms_gutenberg_form_selector_attributes', $attributes ), 'editor_style' => 'wpforms-gutenberg-form-selector', 'render_callback' => array( $this, 'get_form_html' ), ) ); } /** * Load WPForms Gutenberg block scripts. * * @since 1.4.8 */ public function enqueue_block_editor_assets() { $i18n = array( 'title' => \esc_html__( 'WPForms', 'wpforms-lite' ), 'description' => \esc_html__( 'Select and display one of your forms.', 'wpforms-lite' ), 'form_keywords' => array( \esc_html__( 'form', 'wpforms-lite' ), \esc_html__( 'contact', 'wpforms-lite' ), \esc_html__( 'survey', 'wpforms-lite' ), ), 'form_select' => \esc_html__( 'Select a Form', 'wpforms-lite' ), 'form_settings' => \esc_html__( 'Form Settings', 'wpforms-lite' ), 'form_selected' => \esc_html__( 'Form', 'wpforms-lite' ), 'show_title' => \esc_html__( 'Show Title', 'wpforms-lite' ), 'show_description' => \esc_html__( 'Show Description', 'wpforms-lite' ), 'panel_notice_head' => \esc_html__( 'Heads up!', 'wpforms-lite' ), 'panel_notice_text' => \esc_html__( 'Do not forget to test your form.', 'wpforms-lite' ), 'panel_notice_link' => \esc_html__( 'Check out our complete guide!', 'wpforms-lite' ), ); \wp_enqueue_script( 'wpforms-gutenberg-form-selector', WPFORMS_PLUGIN_URL . 'assets/js/components/admin/gutenberg/formselector.min.js', array( 'wp-blocks', 'wp-i18n', 'wp-element' ), WPFORMS_VERSION, true ); $forms = \wpforms()->form->get( '', array( 'order' => 'DESC' ) ); $forms = ! empty( $forms ) ? $forms : array(); $forms = array_map( function( $form ) { $form->post_title = htmlspecialchars_decode( $form->post_title, ENT_QUOTES ); return $form; }, $forms ); \wp_localize_script( 'wpforms-gutenberg-form-selector', 'wpforms_gutenberg_form_selector', array( 'logo_url' => WPFORMS_PLUGIN_URL . 'assets/images/sullie-alt.png', 'wpnonce' => \wp_create_nonce( 'wpforms-gutenberg-form-selector' ), 'forms' => $forms, 'i18n' => $i18n, ) ); } /** * Get form HTML to display in a WPForms Gutenberg block. * * @param array $attr Attributes passed by WPForms Gutenberg block. * * @since 1.4.8 * * @return string */ public function get_form_html( $attr ) { $id = ! empty( $attr['formId'] ) ? \absint( $attr['formId'] ) : 0; if ( empty( $id ) ) { return ''; } $title = ! empty( $attr['displayTitle'] ) ? true : false; $desc = ! empty( $attr['displayDesc'] ) ? true : false; // Disable form fields if called from the Gutenberg editor. if ( $this->is_gb_editor() ) { \add_filter( 'wpforms_frontend_container_class', function ( $classes ) { $classes[] = 'wpforms-gutenberg-form-selector'; $classes[] = 'wpforms-container-full'; return $classes; } ); \add_action( 'wpforms_frontend_output', function () { echo '
'; }, 30 ); } if ( ! empty( $attr['className'] ) ) { \add_filter( 'wpforms_frontend_container_class', function ( $classes ) use ( $attr ) { $cls = array_map( 'esc_attr', explode( ' ', $attr['className'] ) ); return array_unique( array_merge( $classes, $cls ) ); } ); } \ob_start(); \do_action( 'wpforms_gutenberg_block_before' ); if ( $this->is_gb_editor() ) { wpforms_display( $id, apply_filters( 'wpforms_gutenberg_block_form_title', $title, $id ), apply_filters( 'wpforms_gutenberg_block_form_desc', $desc, $id ) ); } else { printf( '[wpforms id="%s" title="%d" description="%d"]', absint( $id ), // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped apply_filters( 'wpforms_gutenberg_block_form_title', $title, $id ), // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped apply_filters( 'wpforms_gutenberg_block_form_desc', $desc, $id ) // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ); } \do_action( 'wpforms_gutenberg_block_after' ); $content = \ob_get_clean(); if ( empty( $content ) ) { $content = '