public static function GoogleMaps(Staple_Layout $layout, $sensor = false) { $sensor = (bool) $sensor; $layout->addScript('http://maps.google.com/maps/api/js?sensor=' . $sensor); }
/** * * handleException catches Exceptions and displays an error page with the details. * @todo create and implement and error controller that can display custom errors * per application. * @param Exception $ex */ public function handleException(Exception $ex) { //handle the error $this->setLastException($ex); //Notify observers $this->notify(); //Clear the output buffer ob_clean(); //Get the Front Controller $main = Staple_Main::get(); //Process the Header $main->processHeader(true); //Echo the error message echo "<div class=\"section\"><div class=\"row\"><div class=\"small-12 columns\"><h1><i class=\"fi-alert\"></i> " . $ex->getMessage() . " Code: " . $ex->getCode() . "</h1></div></div></div>"; //Echo details if in dev mode if ($main->inDevMode()) { if (($p = $ex->getPrevious()) instanceof Exception) { echo "<p><b>Previous Error:</b> " . $p->getMessage . " Code: " . $p->getCode() . "</p>"; } echo "<pre>" . $ex->getTraceAsString() . "</pre>"; foreach ($ex->getTrace() as $traceln) { echo "<pre>"; var_dump($traceln); echo "</pre>"; } } //If the site uses layout, build the default layout and put the error message inside. if (Staple_Layout::layoutExists(Staple_Config::getValue('layout', 'default'))) { //Grab the current buffer contents to add to the layout $buffer = ob_get_contents(); ob_clean(); //Create the layout object and build the layout $layout = new Staple_Layout(Staple_Config::getValue('layout', 'default')); $layout->build($buffer); } }
/** * * Sets up a new layout object and associates the controllers view with the layout. Accepts a * string name for the layout to load. * @param string $layout */ public function _setLayout($layout) { $this->layout = new Staple_Layout($layout); $this->layout->setView($this->view); }