function renderCommentForm($form) { $s = ''; $s .= "<div class=\"blog-comment-input\">\n"; $s .= "<h3>" . $this->view->getMessage('leave_a_comment') . "</h3>\n"; $proc = new Form_Processor(); $proc->form = $form; $s .= $proc->htmlRender(); $s .= "</div>\n"; return $s; }
static function getGeneralFields($fields, $post) { array_walk($fields, function (&$x) { $x['type'] = 'text'; $x['is_required'] = FALSE; }); $proc = new Form_Processor(); $proc->form = array('fields' => $fields); $request = array('post' => $post); $proc->fillForm($request); return $proc->form['fields']; }
function getCheckout($cart, $paypal, $is_sandbox, $fields = NULL) { $item_arr = array(); $item_total = 0; $i = 1; $weight_total = 0; foreach ($cart['items'] as $item) { if ($item['quantity']) { $item_arr["item_name_{$i}"] = $this->getItemTitle($item, FALSE, array(), NULL); $item_arr["amount_{$i}"] = $item['price']; $item_arr["quantity_{$i}"] = $item['quantity']; $weight_total += $item['weight']; $i++; } } $item_arr['weight_total'] = $weight_total; $total = $item_total; $shipping_fee = 0; if ($cart['shipping']) { $shipping_fee = $cart['shipping']; } $item_arr['shipping_1'] = $shipping_fee; $sandbox = ''; if ($is_sandbox) { $sandbox = 'sandbox.'; } $inputs = ''; if (isset($fields)) { $shipping_fields = ''; $proc = new Form_Processor(); foreach ($fields as $field) { $shipping_fields .= $proc->htmlRenderField($field); } $shipping_form = $this->xmlDiv($this->xmlTag('h4', 'Enter shipping information:') . $this->xmlTag('ul', $shipping_fields), array('class' => 'shopping-cart-shipping-form')); $inputs .= $shipping_form; } $inputs .= $this->xmlInputsHidden(array('cmd' => '_cart', 'upload' => '1', 'custom' => $cart['code']) + $paypal + $item_arr); $inputs .= $this->xmlEmptyTag('input', array('type' => 'image', 'src' => 'https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif')); $checkout_form = $this->xmlTag('form', $inputs, array('action' => "https://www.{$sandbox}paypal.com/cgi-bin/webscr", 'method' => 'post', 'novalidate' => 'novalidate')); $checkout = $this->xmlDiv($this->xmlTag('h3', 'Checkout') . $checkout_form, array('class' => 'shopping-cart-checkout')); return $checkout; }