* WaxPartial Class. Enables inline rendering of partials. * * @package default */ class PartialHelper extends Helper { /** * Partial Helper Function * Renders a partial from path $path into the current view * To inherit an existing view use this method: eg..... * * <?=partial("mypartial", $this);?> * * Alternate syntax allows standalone execution that runs the partialname() method * <?=partial("mypartial")?> * * @param string $path * @param array $extra_vals * @param string $format */ public function partial($path, $extra_vals = array(), $format = "html") { $partial = new WaxPartial($path, $extra_vals, $format); WaxEvent::run("wax.partial", $partial); $res = $partial->render(); WaxEvent::run("wax.partial_render", $partial); return $res; } } Wax::register_helper_methods("WaxPartialHelper", array("partial"));
<?php namespace Wax\Template\Helper; class RequestHelper extends Helper { public function get($name, $clean = false) { return Request::get($name, $clean); } public function post($name, $clean = false) { return Request::post($name, $clean); } public function param($name) { return Request::param($name); } public function filter($name) { return Request::filter(Request::param($name)); } public function url($options) { return WaxUrl::build_url($options); } } Wax::register_helper_methods("RequestHelper", array("get", "post", "param", "filter", "url"));
<?php /** * Wax Initialization Script * * Copyright 2008-2010 (c) Joe Chrzanowski * * * @author Joe Chrzanowski * @version 0.10 */ if (defined("WAX_LOADED")) { die("ERROR: Wax is being loaded again from " . getcwd() . ".<br />Previously loaded from: " . WAX_LOADED); } require_once dirname(__FILE__) . "/include/lib.php"; require_dir(dirname(__FILE__) . "/include"); require_dir(dirname(__FILE__) . "/managers"); require_dir(dirname(__FILE__) . "/lib"); ob_start(); error_reporting(E_ALL); Wax::Init(getcwd()); define("WAX_LOADED", getcwd());
} } if ($recordset->total_pages - $recordset->current_page - 1 > $window) { $links[] = "<span>….</span>"; } if (!$recordset->is_current($recordset->total_pages)) { $links[] = link_to($recordset->total_pages, $this->paginate_url($param, $recordset->total_pages)); } else { $links[] = $this->content_tag("span", $recordset->total_pages, array("class" => "disabled current")); } if ($next_content && !$recordset->is_last($recordset->current_page)) { $links[] = link_to($next_content, $this->paginate_url($param, $recordset->next_page())); } else { $links[] = $this->content_tag("span", $next_content_disabled, array("class" => "disabled")); } foreach ($links as $link) { $content .= $this->content_tag("li", $link, array("class" => "pagination_link")); } return $this->content_tag("ul", $content, array("class" => "pagination clearfix")); } public function paginate_url($param, $page) { $vals = $_GET; $url_base = "/" . $vals["route"]; unset($vals["route"], $vals['no-wax-cache'], $vals['preview']); $vals[$param] = $page; return $url_base . "?" . http_build_query($vals, false, "&"); } } Wax::register_helper_methods("OutputHelper", array("error_messages_for", "error_messages", "info_messages", "paginate_links", "paginate_url"));