function parse_modules($body, $template) { // get web forms if (preg_match_all('/{webform:([A-Za-z0-9_\\-]+)}/i', $body, $matches)) { // filter matches $webformID = preg_replace('/{|}/', '', $matches[0][0]); $webform = $this->CI->core->get_web_form_by_ref($matches[1][0]); $template[$webformID] = ''; $required = array(); // get web form if ($webform) { // set fields if ($webform['fieldSet'] == 1) { $required[] = 'fullName'; $required[] = 'subject'; $required[] = 'message'; // populate template $template[$webformID] .= ' <div class="formrow field-fullName"> <label for="fullName">Full Name</label> <input type="text" id="fullName" name="fullName" value="' . $this->CI->input->post('fullName') . '" class="formelement" /> </div> <div class="formrow field-email"> <label for="email">Email</label> <input type="text" id="email" name="email" value="' . $this->CI->input->post('email') . '" class="formelement" /> </div> <div class="formrow field-subject"> <label for="subject">Subject</label> <input type="text" id="subject" name="subject" value="' . $this->CI->input->post('subject') . '" class="formelement" /> </div> <div class="formrow field-message"> <label for="message">Message</label> <textarea id="message" name="message" class="formelement small">' . $this->CI->input->post('message') . '</textarea> </div> '; } // set fields if ($webform['fieldSet'] == 2) { $required[] = 'fullName'; // populate template $template[$webformID] .= ' <div class="formrow field-fullName"> <label for="fullName">Full Name</label> <input type="text" id="fullName" name="fullName" value="' . $this->CI->input->post('fullName') . '" class="formelement" /> </div> <div class="formrow field-email"> <label for="email">Email</label> <input type="text" id="email" name="email" value="' . $this->CI->input->post('email') . '" class="formelement" /> </div> <input type="hidden" name="subject" value="' . $webform['formName'] . '" /> '; } // set fields if ($webform['fieldSet'] == 0) { // populate template $template[$webformID] .= ' <input type="hidden" name="subject" value="' . $webform['formName'] . '" /> '; } // set account if ($webform['account'] == 1) { // populate template $template[$webformID] .= ' <input type="hidden" name="subject" value="' . $webform['formName'] . '" /> <input type="hidden" name="message" value="' . $webform['outcomeMessage'] . '" /> <input type="hidden" name="groupID" value="' . $webform['groupID'] . '" /> '; } // set required if ($required) { $template[$webformID] .= ' <input type="hidden" name="required" value="' . implode('|', $required) . '" /> '; } // output encoded webform ID $template[$webformID] .= ' <input type="hidden" name="formID" value="' . $this->CI->core->encode($matches[1][0]) . '" /> '; } else { $template[$webformID] = ''; } } // get blog headlines if (preg_match_all('/{headlines:blog(:category(\\(([A-Za-z0-9_-]+)\\))?)?(:limit(\\(([0-9]+)\\))?)?}/i', $body, $matches)) { // load blog model $this->CI->load->model('blog/blog_model', 'blog'); // filter through matches for ($x = 0; $x < sizeof($matches[0]); $x++) { // filter matches $headlineID = preg_replace('/{|}/', '', $matches[0][$x]); $limit = $matches[6][$x] ? $matches[6][$x] : $this->CI->site->config['headlines']; $headlines = $matches[3][$x] ? $this->CI->blog->get_posts_by_category($matches[3][$x], $limit) : $this->CI->blog->get_posts($limit); // get latest posts if ($headlines) { // fill up template array $i = 0; foreach ($headlines as $headline) { // get rid of any template tags $headlineBody = $this->parse_body($headline['body'], TRUE, site_url('blog/' . dateFmt($headline['dateCreated'], 'Y/m') . '/' . $headline['uri'])); $headlineExcerpt = $this->parse_body($headline['excerpt'], TRUE, site_url('blog/' . dateFmt($headline['dateCreated'], 'Y/m') . '/' . $headline['uri'])); // populate loop $template[$headlineID][$i] = array('headline:link' => site_url('blog/' . dateFmt($headline['dateCreated'], 'Y/m') . '/' . $headline['uri']), 'headline:title' => $headline['postTitle'], 'headline:date' => dateFmt($headline['dateCreated'], $this->CI->site->config['dateOrder'] == 'MD' ? 'M jS Y' : 'jS M Y'), 'headline:day' => dateFmt($headline['dateCreated'], 'd'), 'headline:month' => dateFmt($headline['dateCreated'], 'M'), 'headline:year' => dateFmt($headline['dateCreated'], 'y'), 'headline:body' => $headlineBody, 'headline:excerpt' => $headlineExcerpt, 'headline:comments-count' => $headline['numComments'], 'headline:author' => $this->CI->blog->lookup_user($headline['userID'], TRUE), 'headline:author-id' => $headline['userID'], 'headline:class' => $i % 2 ? ' alt ' : ''); $i++; } } else { $template[$headlineID] = array(); } } } // get events headlines if (preg_match_all('/{headlines:events(:limit(\\(([0-9]+)\\))?)?}/i', $body, $matches)) { // load events model $this->CI->load->model('events/events_model', 'events'); // filter matches $headlineID = preg_replace('/{|}/', '', $matches[0][0]); $limit = $matches[3][0] ? $matches[3][0] : $this->CI->site->config['headlines']; // get latest posts if ($headlines = $this->CI->events->get_events($limit)) { // fill up template array $i = 0; foreach ($headlines as $headline) { $headlineBody = $this->parse_body($headline['description'], TRUE, site_url('events/viewevent/' . $headline['eventID'])); $headlineExcerpt = $this->parse_body($headline['excerpt'], TRUE, site_url('events/viewevent/' . $headline['eventID'])); $template[$headlineID][$i] = array('headline:link' => site_url('events/viewevent/' . $headline['eventID']), 'headline:title' => $headline['eventTitle'], 'headline:date' => dateFmt($headline['eventDate'], $this->CI->site->config['dateOrder'] == 'MD' ? 'M jS Y' : 'jS M Y'), 'headline:day' => dateFmt($headline['eventDate'], 'd'), 'headline:month' => dateFmt($headline['eventDate'], 'M'), 'headline:year' => dateFmt($headline['eventDate'], 'y'), 'headline:body' => $headlineBody, 'headline:excerpt' => $headlineExcerpt, 'headline:author' => $this->CI->events->lookup_user($headline['userID'], TRUE), 'headline:author-id' => $headline['userID'], 'headline:class' => $i % 2 ? ' alt ' : ''); $i++; } } else { $template[$headlineID] = array(); } } // get wiki headlines if (preg_match_all('/{headlines:wiki(:category(\\(([A-Za-z0-9_-]+)\\))?)?(:limit(\\(([0-9]+)\\))?)?}/i', $body, $matches)) { // load wiki model $this->CI->load->model('wiki/wiki_model', 'wiki'); // filter matches $headlineID = preg_replace('/{|}/', '', $matches[0][0]); $limit = $matches[3][0] ? $matches[3][0] : $this->CI->site->config['headlines']; // get latest posts if ($headlines = $this->CI->wiki->get_pages($limit)) { // fill up template array $i = 0; foreach ($headlines as $headline) { $template[$headlineID][$i] = array('headline:link' => site_url('wiki/' . $headline['uri']), 'headline:title' => $headline['pageName']); $i++; } } else { $template[$headlineID] = array(); } } // get gallery if (preg_match_all('/{gallery:([A-Za-z0-9_-]+)(:limit\\(([0-9]+)\\))?}/i', $body, $matches)) { // load libs etc $this->CI->load->model('images/images_model', 'images'); // filter through matches for ($x = 0; $x < sizeof($matches[0]); $x++) { // filter matches $headlineID = preg_replace('/{|}/', '', $matches[0][0]); $limit = $matches[3][$x] ? $matches[3][$x] : 9; // get latest posts if ($gallery = $this->CI->images->get_images_by_folder_ref($matches[1][$x], $limit)) { // fill up template array $i = 0; foreach ($gallery as $galleryimage) { if ($imageData = $this->get_image($galleryimage['imageRef'])) { $imageHTML = display_image($imageData['src'], $imageData['imageName']); $imageHTML = preg_replace('/src=("[^"]*")/i', 'src="' . site_url('/images/' . $imageData['imageRef'] . strtolower($imageData['ext'])) . '"', $imageHTML); $thumbHTML = display_image($imageData['src'], $imageData['imageName']); $thumbHTML = preg_replace('/src=("[^"]*")/i', 'src="' . site_url('/thumbs/' . $imageData['imageRef'] . strtolower($imageData['ext'])) . '" width="120px"', $imageHTML); $template[$headlineID][$i] = array('galleryimage:link' => site_url('images/' . $imageData['imageRef'] . $imageData['ext']), 'galleryimage:title' => $imageData['imageName'], 'galleryimage:image' => $imageHTML, 'galleryimage:thumb' => $thumbHTML, 'galleryimage:filename' => $imageData['imageRef'] . $imageData['ext'], 'galleryimage:date' => dateFmt($imageData['dateCreated'], $this->CI->site->config['dateOrder'] == 'MD' ? 'M jS Y' : 'jS M Y'), 'galleryimage:author' => $this->CI->images->lookup_user($imageData['userID'], TRUE), 'galleryimage:author-id' => $imageData['userID'], 'galleryimage:class' => $imageData['class']); $i++; } } } else { $template[$headlineID] = array(); } } } // get shop gateway if (preg_match('/{shop:(.+)}|{headlines:shop/i', $body)) { // load messages model $this->CI->load->model('shop/shop_model', 'shop'); // shop globals $template['shop:email'] = $this->CI->site->config['shopEmail']; $template['shop:paypal'] = $this->CI->shop->paypal_url; $template['shop:gateway'] = $this->CI->site->config['shopGateway'] == 'sagepay' || $this->CI->site->config['shopGateway'] == 'authorize' ? site_url('/shop/checkout') : $this->CI->shop->gateway_url; // get shop headlines if (preg_match_all('/{headlines:shop(:category\\(([A-Za-z0-9_-]+)\\))?(:limit\\(([0-9]+)\\))?}/i', $body, $matches)) { // filter matches $headlineID = preg_replace('/{|}/', '', $matches[0][0]); $limit = $matches[4][0] ? $matches[4][0] : $this->CI->site->config['headlines']; $catSafe = $matches[2][0]; // get latest posts if ($headlines = $this->CI->shop->get_latest_products($catSafe, $limit)) { // fill up template array $i = 0; foreach ($headlines as $headline) { // get body and excerpt $headlineBody = strlen($headline['description']) > 100 ? substr($headline['description'], 0, 100) . '...' : $headline['description']; $headlineExcerpt = nl2br($headline['excerpt']); // get images if (!($headlineImage = $this->CI->uploads->load_image($headline['productID'], false, true))) { $headlineImage['src'] = $this->CI->config->item('staticPath') . '/images/nopicture.jpg'; } // get images if (!($headlineThumb = $this->CI->uploads->load_image($headline['productID'], true, true))) { $headlineThumb['src'] = $this->CI->config->item('staticPath') . '/images/nopicture.jpg'; } // populate template $template[$headlineID][$i] = array('headline:id' => $headline['productID'], 'headline:link' => site_url('shop/' . $headline['productID'] . '/' . strtolower(url_title($headline['productName']))), 'headline:title' => $headline['productName'], 'headline:subtitle' => $headline['subtitle'], 'headline:date' => dateFmt($headline['dateCreated'], $this->CI->site->config['dateOrder'] == 'MD' ? 'M jS Y' : 'jS M Y'), 'headline:body' => $headlineBody, 'headline:excerpt' => $headlineExcerpt, 'headline:price' => currency_symbol() . number_format($headline['price'], 2), 'headline:image-path' => $headlineImage['src'], 'headline:thumb-path' => $headlineThumb['src'], 'headline:cell-width' => floor(1 / $limit * 100), 'headline:price' => currency_symbol() . number_format($headline['price'], 2), 'headline:stock' => $headline['stock'], 'headline:class' => $i % 2 ? ' alt ' : ''); $i++; } } else { $template[$headlineID] = array(); } } // get shop headlines if (preg_match_all('/{headlines:shop:featured(:limit(\\(([0-9]+)\\))?)?}/i', $body, $matches)) { // filter matches $headlineID = preg_replace('/{|}/', '', $matches[0][0]); $limit = $matches[3][0] ? $matches[3][0] : $this->CI->site->config['headlines']; // get latest posts if ($headlines = $this->CI->shop->get_latest_featured_products($limit)) { // fill up template array $i = 0; foreach ($headlines as $headline) { // get body and excerpt $headlineBody = strlen($headline['description']) > 100 ? substr($headline['description'], 0, 100) . '...' : $headline['description']; $headlineExcerpt = nl2br($headline['excerpt']); // get images if (!($headlineImage = $this->CI->uploads->load_image($headline['productID'], false, true))) { $headlineImage['src'] = $this->CI->config->item('staticPath') . '/images/nopicture.jpg'; } // get thumb if (!($headlineThumb = $this->CI->uploads->load_image($headline['productID'], true, true))) { $headlineThumb['src'] = $this->CI->config->item('staticPath') . '/images/nopicture.jpg'; } $template[$headlineID][$i] = array('headline:id' => $headline['productID'], 'headline:link' => site_url('shop/' . $headline['productID'] . '/' . strtolower(url_title($headline['productName']))), 'headline:title' => $headline['productName'], 'headline:subtitle' => $headline['subtitle'], 'headline:date' => dateFmt($headline['dateCreated'], $this->CI->site->config['dateOrder'] == 'MD' ? 'M jS Y' : 'jS M Y'), 'headline:body' => $headlineBody, 'headline:excerpt' => $headlineExcerpt, 'headline:price' => currency_symbol() . number_format($headline['price'], 2), 'headline:image-path' => $headlineImage['src'], 'headline:thumb-path' => $headlineThumb['src'], 'headline:cell-width' => floor(1 / $limit * 100), 'headline:price' => currency_symbol() . number_format($headline['price'], 2), 'headline:stock' => $headline['stock'], 'headline:class' => $i % 2 ? ' alt ' : ''); $i++; } } else { $template[$headlineID] = array(); } } // get shop cart headlines if (preg_match('/({headlines:shop:((.+)?)})+/i', $body)) { // get shopping cart $cart = $this->CI->shop->load_cart(); // get latest posts if ($headlines = $cart['cart']) { // fill up template array $i = 0; foreach ($headlines as $headline) { $template['headlines:shop:cartitems'][$i] = array('headline:link' => site_url('shop/' . $headline['productID'] . '/' . strtolower(url_title($headline['productName']))), 'headline:title' => $headline['productName'], 'headline:quantity' => $headline['quantity'], 'headline:price' => currency_symbol() . number_format($headline['price'] * $headline['quantity'], 2), 'headline:class' => $i % 2 ? ' alt ' : ''); $i++; } $template['headlines:shop:numitems'] = count($headlines); $template['headlines:shop:subtotal'] = currency_symbol() . number_format($cart['subtotal'], 2); } else { $template['headlines:shop:numitems'] = 0; $template['headlines:shop:subtotal'] = currency_symbol() . number_format(0, 2); $template['headlines:shop:cartitems'] = array(); } } // get shop navigation if (preg_match('/({shop:categories((.+)?)})+/i', $body)) { $template['shop:categories'] = ''; if ($categories = $this->CI->shop->get_category_parents()) { $i = 1; foreach ($categories as $nav) { // get subnav if ($children = $this->CI->shop->get_category_children($nav['catID'])) { $template['shop:categories'] .= '<li class="expanded '; if ($i == 1) { $template['shop:categories'] .= 'first '; } if ($i == sizeof($categories)) { $template['shop:categories'] .= 'last '; } $template['shop:categories'] .= '"><a href="/shop/' . $nav['catSafe'] . '">' . htmlentities($nav['catName'], NULL, 'UTF-8') . '</a><ul class="subnav">'; foreach ($children as $child) { $template['shop:categories'] .= '<li class="'; if ($child['catID'] == $this->CI->uri->segment(3) || $nav['catSafe'] == $this->CI->uri->segment(2)) { $template['shop:categories'] .= 'active selected'; } $template['shop:categories'] .= '"><a href="/shop/' . $nav['catSafe'] . '/' . $child['catSafe'] . '">' . htmlentities($child['catName'], NULL, 'UTF-8') . '</a></li>'; } $template['shop:categories'] .= '</ul>'; } else { $template['shop:categories'] .= '<li class="'; if ($nav['catID'] == $this->CI->uri->segment(3) || $nav['catSafe'] == $this->CI->uri->segment(2)) { $template['shop:categories'] .= 'active selected '; } if ($i == 1) { $template['shop:categories'] .= 'first '; } if ($i == sizeof($categories)) { $template['shop:categories'] .= 'last '; } $template['shop:categories'] .= '"><a href="/shop/' . $nav['catSafe'] . '">' . htmlentities($nav['catName'], NULL, 'UTF-8') . '</a>'; } $template['shop:categories'] .= '</li>'; $i++; } } } } // message centre stuff if (preg_match('/({((.+)?)messages:unread((.+)?)})+/i', $body)) { // load messages model $this->CI->load->model('community/messages_model', 'messages'); // get message count @($template['messages:unread'] = ($messageCount = $this->CI->messages->get_unread_message_count()) ? $messageCount : 0); } return $template; }
?> <tr class="shade"> <td colspan="2">Tax:</td> <td><?php echo currency_symbol(); echo number_format($order['tax'], 2); ?> </td> </tr> <?php } ?> <tr class="shade"> <td colspan="2"><strong>Total amount:</strong></td> <td><strong><?php echo currency_symbol(); echo number_format($order['amount'], 2); ?> </strong></td> </tr> </table> <?php } ?> </div> <div class="col2"> <h3 class="underline">Shipping Address</h3>
function _populate_products($products) { if ($products && is_array($products)) { $itemsPerRow = $this->shop->siteVars['shopItemsPerRow']; $i = 0; $x = 0; $t = 0; foreach ($products as $product) { // get body and excerpt $productBody = strlen($this->_strip_markdown($product['description'])) > 100 ? substr($this->_strip_markdown($product['description']), 0, 100) . '...' : nl2br($this->_strip_markdown($product['description'])); $productExcerpt = nl2br($this->_strip_markdown($product['excerpt'])); // get images if (!($image = $this->uploads->load_image($product['productID'], false, true))) { $image['src'] = base_url() . $this->config->item('staticPath') . '/images/nopicture.jpg'; } if (!($thumb = $this->uploads->load_image($product['productID'], true, true))) { $thumb['src'] = base_url() . $this->config->item('staticPath') . '/images/nopicture.jpg'; } // populate template array $data[$x] = array('product:id' => $product['productID'], 'product:link' => base_url() . 'shop/' . $product['productID'] . '/' . strtolower(url_title($product['productName'])), 'product:title' => $product['productName'], 'product:subtitle' => $product['subtitle'], 'product:body' => $productBody, 'product:excerpt' => $productExcerpt, 'product:image-path' => base_url() . $image['src'], 'product:thumb-path' => base_url() . $thumb['src'], 'product:cell-width' => floor(1 / $itemsPerRow * 100), 'product:price' => currency_symbol() . number_format($product['price'], 2), 'product:stock' => $product['stock']); // get tags if ($product['tags']) { $tags = explode(',', $product['tags']); $t = 0; foreach ($tags as $tag) { $data[$x]['product:tags'][$t]['tag:link'] = site_url('shop/tag/' . $this->tags->make_safe_tag($tag)); $data[$x]['product:tags'][$t]['tag'] = $tag; $t++; } } if ($i % $itemsPerRow == 0 && $i > 1) { $data[$x]['product:rowpad'] = '</tr><tr>' . "\n"; $i = 0; } else { $data[$x]['product:rowpad'] = ''; } $i++; $x++; } return $data; } else { return FALSE; } }
<?php if ($variation3) { ?> <label class="variationlabel" for="variation3"><?php echo $this->site->config['shopVariation3']; ?> :</label> <br class="clear" /> <select name="variation3" class="variation" id="variation3"> <?php foreach ($variation3 as $variation) { ?> <option value="<?php echo $variation['variationID']; ?> "><?php echo $variation['variation']; ?> <?php if ($variation['price'] > 0) { echo '+' . currency_symbol() . $variation['price']; } ?> </option> <?php } ?> </select> <br class="clear" /> <?php }
echo dateFmt($order['dateCreated'], '', '', TRUE); ?> </td> <td><?php echo $order['firstName']; ?> <?php echo $order['lastName']; ?> </td> <td><?php echo $order['numItems']; ?> </td> <td><?php echo currency_symbol() . number_format($order['amount'], 2); ?> </td> <td> <?php if ($order['trackingStatus'] == 'U' && $order['paid']) { echo 'Unprocessed'; } elseif ($order['trackingStatus'] == 'L') { echo 'Allocated'; } elseif ($order['trackingStatus'] == 'A') { echo 'Awaiting Goods'; } elseif ($order['trackingStatus'] == 'O') { echo 'Out of Stock'; } elseif ($order['trackingStatus'] == 'D') { echo 'Dispatched'; } else {
public function adamount() { return currency_symbol($this->currency) . ' ' . $this->amount; }
public function session_currency_amount() { $amount = in_session_currency($this->currency, $this->amount, 3, $this->exchange_rate); return currency_symbol(Session::get('currency')) . ' ' . $amount; }
<td><?php echo $this->site->config['siteName']; ?> Subscription Payment (#<?php echo $referenceID; ?> )</td> <td><?php echo currency_symbol(TRUE, $currency) . number_format($paymentAmount, 2); ?> </td> </tr> <tr> <td colspan="2"><hr /></td> </tr> <tr> <td><strong>Total Amount:</strong></td> <td><strong><?php echo currency_symbol(TRUE, $currency) . number_format($paymentAmount, 2); ?> </strong> PAID</td> </tr> <tr> <td colspan="2"><hr /></td> </tr> </table> </div> </body> </html>
<td><?php echo anchor('/admin/shop/edit_discount/' . $discount['discountID'], $discount['code'], 'class="showform"'); ?> </td> <td><?php if ($discount['type'] == 'P') { echo 'Product'; } elseif ($discount['type'] == 'C') { echo 'Category'; } else { echo 'Total'; } ?> </td> <td><?php echo $discount['modifier'] == 'A' ? currency_symbol() . number_format($discount['discount'], 2) : $discount['discount'] . '%'; ?> </td> <td><?php echo strtotime($discount['expiryDate']) < time() ? '<span style="color:red;">' . dateFmt($discount['expiryDate']) . '</span>' : '<span style="color:green;">' . dateFmt($discount['expiryDate']) . '</span>'; ?> </td> <td><?php echo anchor('/admin/shop/edit_discount/' . $discount['discountID'], 'Edit', 'class="showform"'); ?> </td> <td><?php echo anchor('/admin/shop/delete_discount/' . $discount['discountID'], 'Delete', 'onclick="return confirm(\'Are you sure you want to delete this?\')"'); ?> </td> </tr>
function currencyFormat($currency, $amount) { if (Config::get('app.currency_represent') == 'symbol') { return currency_symbol($currency) . ' ' . number_format($amount, Config::get('app.currency_decimal'), '.', ''); } else { return $currency . ' ' . number_format($amount, Config::get('app.currency_decimal'), '.', ''); } }