/** * Adds hidden fields to the start of the donation form. * * @param Charitable_Form $form * @return void * @access public * @since 1.0.0 */ public function add_hidden_fields($form) { if (!$form->is_current_form($this->id)) { return false; } $this->nonce_field(); ?> <input type="hidden" name="charitable_action" value="<?php echo esc_attr($this->form_action); ?> " /> <input type="hidden" name="login" value="<?php echo esc_attr($this->login); ?> " autocomplete="off" /> <input type="hidden" name="key" value="<?php echo esc_attr($this->key); ?> " /> <?php }
/** * Adds hidden fields to the start of the donation form. * * @param Charitable_Form $form * @return void * @access public * @since 1.0.0 */ public function add_hidden_fields($form) { $ret = parent::add_hidden_fields($form); if (false === $ret) { return; } ?> <input type="hidden" name="login" value="<?php echo esc_attr($this->login); ?> " autocomplete="off" /> <input type="hidden" name="key" value="<?php echo esc_attr($this->key); ?> " /> <?php }
/** * Render a form field. * * @param array $field * @param string $key * @param Charitable_Form $form * @param int $index * @return boolean False if the field was not rendered. True otherwise. * @access public * @since 1.0.0 */ public function render_field($field, $key, $form, $index = 0, $namespace = null) { if (!$form->is_current_form($this->id)) { return false; } if (!isset($field['type'])) { return false; } $input_name = is_null($namespace) ? $key : $namespace . '[' . $key . ']'; $field['key'] = apply_filters('charitable_form_field_key', $input_name, $key, $namespace, $form, $index); /* Allows extensions/themes to plug in their own template objects here. */ $template = apply_filters('charitable_form_field_template', false, $field, $form, $index); /* Fall back to default Charitable_Template if no template returned or if template was not object of 'Charitable_Template' class. */ if (!$this->is_valid_template($template)) { $template = new Charitable_Template($this->get_template_name($field), false); } if (!$template->template_file_exists()) { return false; } $template->set_view_args(array('form' => $this, 'field' => $field, 'classes' => $this->get_field_classes($field, $index))); $template->render(); return true; }
/** * Adds hidden fields to the start of the registration * * @param Charitable_Form $form * @return void * @access public * @since 1.0.0 */ public function add_hidden_fields($form) { $ret = parent::add_hidden_fields($form); if (false === $ret) { return; } $redirect = false; if (isset($_GET['redirect_to']) && strlen($_GET['redirect_to'])) { $redirect = $_GET['redirect_to']; } elseif (isset($this->shortcode_args['redirect']) && strlen($this->shortcode_args['redirect'])) { $redirect = $this->shortcode_args['redirect']; } if (!$redirect) { return; } ?> <input type="hidden" name="redirect_to" value="<?php echo esc_url($redirect); ?> " /> <?php }
/** * Adds hidden fields to the start of the donation form. * * @param Charitable_Donation_Form $form * @return void * @access public * @since 1.0.0 */ public function add_hidden_fields($form) { if (false === parent::add_hidden_fields($form)) { return false; } $hidden_fields = apply_filters('charitable_donation_form_hidden_fields', array('campaign_id' => $this->campaign->ID)); foreach ($hidden_fields as $name => $value) { printf('<input type="hidden" name="%s" value="%s" />', $name, $value); } }
/** * Adds hidden fields to the start of the donation form. * * @param Charitable_Donation_Form $form * @return void * @access public * @since 1.0.0 */ public function add_hidden_fields($form) { if (false === parent::add_hidden_fields($form)) { return false; } $hidden_fields = array('campaign_id' => $this->campaign->ID, 'description' => get_the_title($this->campaign->ID)); if (isset($_GET['donation_id'])) { $hidden_fields['ID'] = $_GET['donation_id']; } $hidden_fields = apply_filters('charitable_donation_form_hidden_fields', $hidden_fields, $this); foreach ($hidden_fields as $name => $value) { printf('<input type="hidden" name="%s" value="%s" />', $name, $value); } }
/** * Closes the hidden donor fields wrapper div if the user is logged in. * * @param Charitable_Form $form * @return void * @since 1.0.0 */ function charitable_template_donation_form_donor_fields_hidden_wrapper_end(Charitable_Form $form) { /* Verify that the user is logged in and has all required fields filled out */ if (!$form->get_user() || !$form->user_has_required_fields()) { return; } charitable_template('donation-form/donor-fields/hidden-fields-wrapper-end.php'); }