%s', $type, $message ); } /** * Render contact form shortcode * * @param array $atts * @param string $contents * * @return string */ public function render_shortcode( $atts, $contents = '' ) { extract( shortcode_atts( array( 'id' => 0 ), $atts ) ); weforms()->scripts->enqueue_frontend(); ob_start(); $form = weforms()->form->get( $id ); if ( ! $form->id ) { return $this->show_error( __( 'The form couldn\'t be found.', 'weforms' ) ); } $is_open = $form->is_submission_open(); if ( is_wp_error( $is_open ) ) { return $this->show_error( $is_open->get_error_message() ); } $this->render_form( $form, $atts ); return ob_get_clean(); } /** * Render the form * * @param \WeForms_Form $form * * @return void */ function render_form( $form, $atts ) { $form_fields = $form->get_fields(); $form_settings = $form->get_settings(); $show_credit = weforms_get_settings( 'credit', false ); $formid = 'weforms-' . $form->id; $use_theme_css = isset( $form_settings['use_theme_css'] ) ? $form_settings['use_theme_css'] : 'wpuf-style'; if ( isset( $atts['modal'] ) && 'true' == $atts['modal'] ) { wp_enqueue_script( 'weforms-modal-js', WEFORMS_ASSET_URI . '/modal/jquery.modal.js', array( 'jquery', 'weforms-form' ), false, false ); wp_enqueue_style( 'weforms_modal_styles', WEFORMS_ASSET_URI . '/modal/jquery.modal.css' ); $modal_class = 'modal'; $modal_id = 'modal-form'; $modal_style = 'style="display:none"'; } else { $modal_class = $modal_id = $modal_style = ''; } ?>
id="">
%s

', $atts['link'] ); } else { if ( isset( $atts['button'] ) ) { $button_text = $atts['button']; } else { $button_text = __( 'Open Form', 'weforms' ); } printf('

', $button_text ); } } if ( $show_credit ) { printf( '' . __( 'Powered by weForms', 'weforms' ) . '', 'https://wordpress.org/plugins/weforms/' ); } weforms_track_form_view( $form->id ); } /** * Render submit button * * @param integer $form_id * @param array $form_settings * * @return void */ function submit_button( $form_id, $form_settings ) { ?>
  •