| Server IP : 188.114.96.2 / Your IP : 104.23.197.230 Web Server : Apache/2.4.59 (Debian) System : Linux EDL-STRETCH 4.19.0-27-amd64 #1 SMP Debian 4.19.316-1 (2024-06-25) x86_64 User : edlftp ( 1002) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/nicolasj/temp/fusion-core/shortcodes/ |
Upload File : |
<?php
/**
* Fusion-Builder Shortcode Element.
*
* @package Fusion-Core
* @since 3.9.2
*/
/**
* Shortcode class.
*
* @package Fusion-Core
* @since 3.9.2
*/
class FusionSC_Contact_Form {
/**
* Constructor.
*
* @access public
* @since 3.9.2
*/
public function __construct() {
add_shortcode( 'fusion_contact_form', [ $this, 'render' ] );
// Add the contact form to Avada's contact page template.
add_action( 'avada_add_contact_template_contents', [ $this, 'echo_contact_form' ] );
}
/**
* Echos the element.
*
* @access public
* @since 3.9.2
* @return void
*/
public function echo_contact_form() {
$this->render( [ 'echo' => 1 ] );
}
/**
* Render the element.
*
* @access public
* @since 3.9.2
* @param array $args Shortcode parameters.
* @param string $content Content between shortcode.
* @return void|string HTML output.
*/
public function render( $args, $content = '' ) {
$fusion_settings = FusionCore_Plugin::get_fusion_settings();
$args = shortcode_atts(
[
'email_address' => $fusion_settings ? $fusion_settings->get( 'email_address' ) : '',
'recaptcha_version' => $fusion_settings ? $fusion_settings->get( 'recaptcha_version' ) : 'v3',
'recaptcha_color_scheme' => $fusion_settings ? $fusion_settings->get( 'recaptcha_color_scheme' ) : 'light',
'public_key' => $fusion_settings ? $fusion_settings->get( 'recaptcha_public' ) : '',
'private_key' => $fusion_settings ? $fusion_settings->get( 'recaptcha_private' ) : '',
'badge_position' => $fusion_settings ? $fusion_settings->get( 'recaptcha_badge_position' ) : 'inline',
'comment_position' => $fusion_settings ? $fusion_settings->get( 'contact_comment_position' ) : 'below',
'privacy_checkbox' => $fusion_settings ? $fusion_settings->get( 'contact_form_privacy_checkbox' ) : 0,
'privacy_label' => $fusion_settings ? $fusion_settings->get( 'contact_form_privacy_label' ) : '',
'echo' => 0,
],
$args,
'fusion_contact_form'
);
/**
* Instantiate the Fusion_Contact class.
*/
$fusion_contact = new Fusion_Contact( $args );
if ( $args['echo'] ) {
$fusion_contact->get_recaptcha_script();
$fusion_contact->get_error_messages();
$fusion_contact->get_contact_form();
} else {
ob_start();
$fusion_contact->get_recaptcha_script();
$fusion_contact->get_error_messages();
$fusion_contact->get_contact_form();
$html = ob_get_clean();
return $html;
}
}
}
new FusionSC_Contact_Form();