Ejemplo n.º 1
0
 /**
  * Form notification settings, supports multiple notifications.
  *
  * @since 1.2.3
  * @param object $settings
  */
 public function form_settings_notifications($settings)
 {
     // Fetch next ID and handle backwards compatibility
     if (empty($settings->form_data['settings']['notifications'])) {
         $settings->form_data['settings']['notifications'][1]['email'] = !empty($settings->form_data['settings']['notification_email']) ? $settings->form_data['settings']['notification_email'] : '{admin_email}';
         $settings->form_data['settings']['notifications'][1]['subject'] = !empty($settings->form_data['settings']['notification_subject']) ? $settings->form_data['settings']['notification_subject'] : sprintf(__('New %s Entry', 'wpforms '), $settings->form->post_title);
         $settings->form_data['settings']['notifications'][1]['sender_name'] = !empty($settings->form_data['settings']['notification_fromname']) ? $settings->form_data['settings']['notification_fromname'] : get_bloginfo('name');
         $settings->form_data['settings']['notifications'][1]['sender_address'] = !empty($settings->form_data['settings']['notification_fromaddress']) ? $settings->form_data['settings']['notification_fromaddress'] : '{admin_email}';
         $settings->form_data['settings']['notifications'][1]['replyto'] = !empty($settings->form_data['settings']['notification_replyto']) ? $settings->form_data['settings']['notification_replyto'] : '';
     }
     $id = 1;
     echo '<div class="wpforms-panel-content-section-title">';
     _e('Notifications', 'wpforms');
     echo '</div>';
     echo '<p class="wpforms-alert wpforms-alert-info">Want multiple notifications with smart conditional logic?<br><a href="' . $this->upgrade_link() . 'target="_blank"><strong>Upgrade to PRO</strong></a> to unlock it and more awesome features.</p>';
     wpforms_panel_field('select', 'settings', 'notification_enable', $settings->form_data, __('Notifications', 'wpforms'), array('default' => '1', 'options' => array('1' => __('On', 'wpforms'), '0' => __('Off', 'wpforms'))));
     echo '<div class="wpforms-notification">';
     echo '<div class="wpforms-notification-header">';
     echo '<span>' . __('Default Notification', 'wpforms') . '</span>';
     echo '</div>';
     wpforms_panel_field('text', 'notifications', 'email', $settings->form_data, __('Send To Email Address', 'wpforms'), array('default' => '{admin_email}', 'tooltip' => __('Enter the email address to receive form entry notifications. For multiple notifications, seperate email addresses with a comma.', 'wpforms'), 'smarttags' => array('type' => 'fields', 'fields' => 'name,email,text'), 'parent' => 'settings', 'subsection' => $id, 'class' => 'email-recipient'));
     wpforms_panel_field('text', 'notifications', 'subject', $settings->form_data, __('Email Subject', 'wpforms'), array('default' => __('New Entry: ', 'wpforms') . $settings->form->post_title, 'smarttags' => array('type' => 'fields', 'fields' => 'name,email,text'), 'parent' => 'settings', 'subsection' => $id));
     wpforms_panel_field('text', 'notifications', 'sender_name', $settings->form_data, __('From Name', 'wpforms'), array('default' => sanitize_text_field(get_option('blogname')), 'smarttags' => array('type' => 'fields', 'fields' => 'name,email,text'), 'parent' => 'settings', 'subsection' => $id));
     wpforms_panel_field('text', 'notifications', 'sender_address', $settings->form_data, __('From Email', 'wpforms'), array('default' => '{admin_email}', 'smarttags' => array('type' => 'fields', 'fields' => 'name,email,text'), 'parent' => 'settings', 'subsection' => $id));
     wpforms_panel_field('text', 'notifications', 'replyto', $settings->form_data, __('Reply-To', 'wpforms'), array('smarttags' => array('type' => 'fields', 'fields' => 'name,email,text'), 'parent' => 'settings', 'subsection' => $id));
     wpforms_panel_field('textarea', 'notifications', 'message', $settings->form_data, __('Message', 'wpforms'), array('rows' => 6, 'default' => '{all_fields}', 'smarttags' => array('type' => 'all'), 'parent' => 'settings', 'subsection' => $id, 'class' => 'email-msg', 'after' => '<p class="note">' . __('To display all form fields, use the <code>{all_fields}</code> Smart Tag.', 'wpforms') . '</p>'));
     echo '</div>';
 }
Ejemplo n.º 2
0
 /**
  * Outputs the Settings panel primary content.
  *
  * @since 1.0.0
  */
 public function panel_content()
 {
     // Check if there is a form created
     if (!$this->form) {
         echo '<div class="wpforms-alert wpforms-alert-info">';
         _e('You need to <a href="#" class="wpforms-panel-switch" data-panel="setup">setup your form</a> before you can manage the settings.', 'wpforms');
         echo '</div>';
         return;
     }
     //--------------------------------------------------------------------//
     // General
     //--------------------------------------------------------------------//
     echo '<div class="wpforms-panel-content-section wpforms-panel-content-section-general">';
     echo '<div class="wpforms-panel-content-section-title">';
     _e('General', 'wpforms');
     echo '</div>';
     wpforms_panel_field('text', 'settings', 'form_title', $this->form_data, __('Form Title', 'wpforms'), array('default' => $this->form->post_title));
     wpforms_panel_field('textarea', 'settings', 'form_desc', $this->form_data, __('Form Description', 'wpforms'));
     wpforms_panel_field('checkbox', 'settings', 'hide_title_desc', $this->form_data, __('Hide form title and description area', 'wpforms'));
     wpforms_panel_field('text', 'settings', 'form_class', $this->form_data, __('Form CSS Class', 'wpforms'), array('tooltip' => __('Enter CSS class names for the form wrapper. Multiple class names should be seperated with spaces.', 'wpforms')));
     wpforms_panel_field('text', 'settings', 'submit_text', $this->form_data, __('Submit Button Text', 'wpforms'), array('default' => __('Submit', 'wpforms')));
     wpforms_panel_field('text', 'settings', 'submit_text_processing', $this->form_data, __('Submit Button Processing Text', 'wpforms'), array('tooltip' => __('Enter the submit button text you would like the button display while the form submit is processing.', 'wpforms')));
     wpforms_panel_field('text', 'settings', 'submit_class', $this->form_data, __('Submit Button CSS Class', 'wpforms'), array('tooltip' => __('Enter CSS class names for the form submit button. Multiple names should be seperated with spaces.', 'wpforms')));
     wpforms_panel_field('checkbox', 'settings', 'honeypot', $this->form_data, __('Enable anti-spam honeypot', 'wpforms'));
     $recaptcha_key = wpforms_setting('recaptcha-site-key', false);
     $recaptcha_secret = wpforms_setting('recaptcha-secret-key', false);
     if (!empty($recaptcha_key) && !empty($recaptcha_secret)) {
         wpforms_panel_field('checkbox', 'settings', 'recaptcha', $this->form_data, __('Enable reCAPTCHA', 'wpforms'));
     }
     do_action('wpforms_form_settings_general', $this);
     echo '</div>';
     //--------------------------------------------------------------------//
     // Notifications
     //--------------------------------------------------------------------//
     echo '<div class="wpforms-panel-content-section wpforms-panel-content-section-notifications">';
     // echo '<div class="wpforms-panel-content-section-title">';
     // 	_e( 'Notifications', 'wpforms' );
     // echo '</div>';
     // wpforms_panel_field(
     // 	'select',
     // 	'settings',
     // 	'notification_enable',
     // 	$this->form_data,
     // 	__( 'Notifications', 'wpforms' ),
     // 	array(
     // 		'default' => '1',
     // 		'options' => array(
     // 			'1' => __( 'On', 'wpforms' ),
     // 			'0' => __( 'Off', 'wpforms' ),
     // 		),
     // 	)
     // );
     // wpforms_panel_field(
     // 	'text',
     // 	'settings',
     // 	'notification_email',
     // 	$this->form_data,
     // 	__( 'Send To Email Address', 'wpforms' ),
     // 	array(
     // 		'default' => '{admin_email}',
     // 		'tooltip' => __( 'Enter the email address to receive form entry notifications. For multiple notifications, seperate email addresses with a comma.', 'wpforms' ),
     // 		'smarttags' => array(
     // 			'type'   => 'fields',
     // 			'fields' => 'name,email,text',
     // 		),
     // 	)
     // );
     // wpforms_panel_field(
     // 	'text',
     // 	'settings',
     // 	'notification_subject',
     // 	$this->form_data,
     // 	__( 'Email Subject', 'wpforms' ),
     // 	array(
     // 		'default' => __( 'New Entry: ' , 'wpforms' ) . $this->form->post_title,
     // 		'smarttags' => array(
     // 			'type'   => 'fields',
     // 			'fields' => 'name,email,text',
     // 		),
     // 	)
     // );
     // wpforms_panel_field(
     // 	'text',
     // 	'settings',
     // 	'notification_fromname',
     // 	$this->form_data,
     // 	__( 'From Name', 'wpforms' ),
     // 	array(
     // 		'default' => sanitize_text_field( get_option( 'blogname' ) ),
     // 		'smarttags' => array(
     // 			'type'   => 'fields',
     // 			'fields' => 'name,email,text',
     // 		),
     // 	)
     // );
     // wpforms_panel_field(
     // 	'text',
     // 	'settings',
     // 	'notification_fromaddress',
     // 	$this->form_data,
     // 	__( 'From Email', 'wpforms' ),
     // 	array(
     // 		'default' => '{admin_email}',
     // 		'smarttags' => array(
     // 			'type'   => 'fields',
     // 			'fields' => 'name,email,text',
     // 		),
     // 	)
     // );
     // wpforms_panel_field(
     // 	'text',
     // 	'settings',
     // 	'notification_replyto',
     // 	$this->form_data,
     // 	__( 'Reply-To', 'wpforms' ),
     // 	array(
     // 		'smarttags' => array(
     // 			'type'   => 'fields',
     // 			'fields' => 'name,email,text',
     // 		),
     // 	)
     // );
     do_action('wpforms_form_settings_notifications', $this);
     echo '</div>';
     //--------------------------------------------------------------------//
     // Confirmation
     //--------------------------------------------------------------------//
     echo '<div class="wpforms-panel-content-section wpforms-panel-content-section-confirmation">';
     echo '<div class="wpforms-panel-content-section-title">';
     _e('Confirmation', 'wpforms');
     echo '</div>';
     wpforms_panel_field('select', 'settings', 'confirmation_type', $this->form_data, __('Confirmation Type', 'wpforms'), array('default' => 'message', 'options' => array('message' => __('Message', 'wpforms'), 'page' => __('Show Page', 'wpforms'), 'redirect' => __('Go to URL (Redirect)', 'wpforms'))));
     wpforms_panel_field('tinymce', 'settings', 'confirmation_message', $this->form_data, __('Confirmation Message', 'wpforms'), array('default' => __('Thanks for contacting us! We will be in touch with you shortly.', 'wpforms'), 'tinymce' => array('editor_height' => '200')));
     wpforms_panel_field('checkbox', 'settings', 'confirmation_message_scroll', $this->form_data, __('Automatically scroll to the confirmation message', 'wpforms'));
     $p = array();
     $pages = get_pages();
     foreach ($pages as $page) {
         $depth = sizeof($page->ancestors);
         $p[$page->ID] = str_repeat('-', $depth) . ' ' . $page->post_title;
     }
     wpforms_panel_field('select', 'settings', 'confirmation_page', $this->form_data, __('Confirmation Page', 'wpforms'), array('options' => $p));
     wpforms_panel_field('text', 'settings', 'confirmation_redirect', $this->form_data, __('Confirmation Redirect URL', 'wpforms'));
     do_action('wpforms_form_settings_confirmation', $this);
     echo '</div>';
     do_action('wpforms_form_settings_panel_content', $this);
 }