<?php require_once "../../../../../wp-load.php"; require_once ABSPATH . 'wp-content/plugins/UiGEN-Core/class/Spyc.php'; require_once ABSPATH . 'wp-content/plugins/UiGEN-Core/core-files/uigen-debuger.php'; require_once ABSPATH . 'wp-content/plugins/UiGEN-Core/core-files/defines-const.php'; $formList = Spyc::YAMLLoad(GLOBALDATA_PATH . 'template-hierarchy/schemas/form-list.yaml'); foreach ($formList as $key => $value) { global $SPD; $SPD->type = $key; $SPD->name = $key; $SPD->label = $value['debug_label']; decorate_form('start', '', 'theme-template-parts/forms/form/' . $key); get_template_part('theme-template-parts/forms/form', $key); decorate_form('end', '', ''); } ?> <script> jQuery(document).on('click', "button.back-slots-mode", function() { jQuery('#debug-manager').children().remove(); jQuery(this).parent().parent().removeClass('slot-fade'); jQuery(this).parent().parent().find('.btn-group').css('display','block'); jQuery(this).remove(); }); </script>
public function addSendForm($edit_id = false) { /* create form to send Get data */ //echo '#### ADD SEND FORM PAYPAL TEST####'; //echo '<pre>'; //var_dump($_POST); //echo '</pre>'; //echo '<pre>'; //var_dump($_GET); //echo '</pre>'; // check is form is simple chart global $FC; $first_steps_group_key = @key($FC->flow_arg); $current_step = $this->data_arg['data']['flow_steps']['input_current_step']['value']; $output = ' <form class="flow_form" action="' . $this->data_arg['prop']['source'] . '" method="post" enctype="multipart/form-data">'; if ($this->data_arg['prop']['nonce'] == true) { $output .= '<input type="hidden" name="_nonce" value="g3r23hr63df4s24g6f4vw4s445dgg4">'; } if ($FC->flow_arg[$first_steps_group_key][$current_step]['action'] == 'cart') { $output .= '<div class="___simpleCart_shelfItem">'; } echo $output; $output = ''; foreach ($this->data_arg['data'] as $groupName => $groupValue) { // check Flow acces echo '<fieldset class="flow_set" id="' . $groupName . '" style="border:0px">'; foreach ($groupValue as $formElementName => $formElement) { @($this->blockPost = $formElement['blockPost']); // przesyła dane bez POST @($this->nameHash = $formElement['nameHash']); // hashuje atrybut name na fronice @($this->cryptoValue = $formElement['cryptoValue']); // szyfruje atrybut value na fronice @($this->args = $formElement['args']); // atrybut obiektu forma @($this->id = $formElement['id']); // atrybut obiektu forma @($this->type = $formElement['type']); // atrybut obiektu forma @($this->request = $formElement['request']); // metoda wypełnienia pola przy reedycji @($this->label = $formElement['label']); // nazwa obiektu @($this->labels = $formElement['labels']); // nazwy obiektów radio checkbox ... @($this->values = $formElement['values']); // wartości obiektów radio checkbox ... @($this->desc = $formElement['desc']); // opis za polem @($this->checked = $formElement['checked']); // który zaznaczony @($this->required = $formElement['required']); // czy wymagane @($this->pattern = $formElement['pattern']); // wyrażenie regularne dla walidacji @($this->readonly = $formElement['readonly']); // wyrażenie regularne dla walidacji @($this->disabled = $formElement['disabled']); // wyrażenie regularne dla walidacji @($this->name = $formElement['name']); // atrybut obiektu forma @($this->value = $formElement['value']); // atrybut obiektu forma if ($this->cryptoValue == true) { // --------------------------------------- // CRYPTO VALUE TO DISPLAY // --------------------------------------- $this->value = $this->crypto($this->crypto, $this->value); } // ------------------------------------ // check edition id - to set edit mode // ------------------------------------ if ($edit_id != '') { $post = get_post($edit_id); // ------------------------------------ // user edit if ($this->request == 'profile') { $user_info = get_userdata($edit_id); $this->value = $user_info->{$formElementName}; } // ------------------------------------ // meta edit if ($this->request == 'meta') { $this->value = get_post_meta($edit_id, $formElementName, true); } // ------------------------------------ // post edit if ($this->request == 'posttype') { $this->value = $post->{$formElementName}; } // ------------------------------------ if ($this->request == 'taxonomy') { $terms = wp_get_post_terms($edit_id, $this->args['taxonomy'], $args); $this->value = $terms[0]->term_id; } // ------------------------------------ if ($this->request == 'thumbnail') { $thumb = wp_get_attachment_image_src(get_post_thumbnail_id($edit_id), 'thumbnail'); $url = $thumb['0']; //$terms = wp_get_post_terms( $edit_id, $this -> args['taxonomy'], $args ); $this->value = $url; } // ------------------------------------ } if ($this->blockPost == true) { // dont display input field } else { // debug excerption // Decorate form element if ($_GET['debug'] == 'true') { decorate_form('start', '', $this->data_arg['prop']['tpl_path'] . '-' . $this->type); } // ------------------------------------------------------------------ // CREATE FORM ELEMENT get_template_part($this->data_arg['prop']['tpl_path'], $this->type); // ------------------------------------------------------------------ // debug excerption if ($_GET['debug'] == 'true') { echo '</div>'; } } } echo '</fieldset>'; } // ------------------------------------------------------------------------------------ // SUBMIT // ------------------------------------------------------------------------------------ //echo '<pre>'; //var_dump($FC->flow_arg[$first_steps_group_key][$current_step]['action']); //echo '</pre>'; if ($this->data_arg['prop']['submit'] == 'false') { //$output = 'false'; $output .= '<div class="submitBtn"><input style="display:none" class="' . $this->data_arg['prop']['submit_class'] . '" type="submit" value="' . $this->data_arg['prop']['submit'] . '"></div>'; } else { //$output = 'true'; if ($FC->flow_arg[$first_steps_group_key][$current_step]['action'] == null || $FC->flow_arg[$first_steps_group_key][$current_step]['action'] == 'post') { $output .= '<div class="submitBtn"><input class="' . $this->data_arg['prop']['submit_class'] . '" type="submit" value="' . $this->data_arg['prop']['submit'] . '"></div>'; } if ($FC->flow_arg[$first_steps_group_key][$current_step]['action'] == 'cart') { $output .= '<div class="submitBtn"><a id="ui_add_to_chart_submit" href="javascript:;" data-toggle="modal" data-target="#simpleCart" class="item_add ' . $this->data_arg['prop']['submit_class'] . '" >' . $this->data_arg['prop']['submit'] . '</a></div>'; $output .= '<script> jQuery(".flow_form").submit(function(e){ e.preventDefault(); }); jQuery("#ui_add_to_chart_submit").click(function(){ add_to_chart_callback(); }); </script>'; } } /* create extra submit */ //var_dump($this->data_arg['prop']['extra_submit']); if ($FC->flow_arg[$first_steps_group_key][$current_step]['action'] == 'cart') { $output .= '</div>'; // catd schelf item end } $output .= '</form>'; echo $output; }