/** * Starting point for every page request. Loads required core modules, gets data from url and calls * necessary modules to make things happen. */ public static function init() { if (!self::$_inited) { self::$_inited = true; foreach (self::$_requiredCore as $module) { require_once ROOT . 'core/' . $module . '/' . $module . EXT; } // Set the Load::auto method to handle all class loading from now on spl_autoload_register('Load::auto'); Load::loadSetupFiles(); // If CLI mode, everything thats needed has been loaded if (IS_CLI) { return; } date_default_timezone_set(Config::get('system.timezone')); Event::trigger('caffeine.started'); // If maintenance mode has been set in the config, stop everything and load mainteance view if (Config::get('system.maintenance_mode')) { View::error(ERROR_MAINTENANCE); } else { list($route, $data) = Router::getRouteData(); if ($data) { if (self::_hasPermission($route, $data)) { list($module, $controller, $method) = $data['callback']; $params = Router::getParams(); // Make sure controller words are upper-case $conBits = explode('_', $controller); foreach ($conBits as &$bit) { $bit = ucfirst($bit); } $controller = implode('_', $conBits); $controller = sprintf('%s_%sController', ucfirst($module), ucwords($controller)); // Call the routes controller and method if (method_exists($controller, $method)) { $response = call_user_func_array(array($controller, $method), $params); if (!self::_isErrorResponse($response)) { Event::trigger('module.response', array($response)); View::load($module, $controller, $method); } else { View::error($response); } } else { Log::error($module, sprintf('The method %s::%s() called by route %s doesn\'t exist.', $controller, $method, $route)); View::error(ERROR_500); } } else { View::error(ERROR_ACCESSDENIED); } } else { if ($route !== '[index]' || !View::directLoad('index')) { View::error(ERROR_404); } } } View::output(); Event::trigger('caffeine.finished'); } else { die('Why are you trying to re-initialize Caffeine?'); } }
function statistic() { $stat = array('NAME' => 'Авторизация'); $stat['STATISTIC'] = 'Пользователей в системе: ' . Users::getUsersCount(); $stat['STATISTIC'] .= ' Администраторов в системе: ' . Users::getAdminUsersCount(); return View::load(array('engine', 'statisticNode'), $stat); }
/** * Метод отображения главной страницы контроллера * * @return mixed */ function index() { if (func_num_args()) { $nav = Navigation::loadMenu(func_get_args()[0]); $str = array(); foreach ($nav as $key => $val) { $val['alias'] = preg_replace('/[~^$\\/|]/', '', $val['alias']); if ($val['parentId']) { if (!array_key_exists($val['parentId'], $str)) { $str[$val['parentId']] = array('HREF' => $val['href'], 'NAME' => $val['alias'], 'SUBMENU' => ''); } $str[$val['parentId']]['SUBMENU'] = array('HREF' => $val['href'], 'NAME' => $val['alias']); continue; } if (array_key_exists($val['id'], $str)) { $str[$val['id']]['HREF'] = $val['href']; $str[$val['id']]['NAME'] = $val['alias']; } else { $str[$val['id']] = array('HREF' => $val['href'], 'NAME' => $val['alias']); } } $arr = array('NODES' => ''); foreach ($str as $val) { if (!empty($val['SUBMENU'])) { $tmp = array('NODES' => View::load(array(Settings::$ENGINE['template'], 'navigationNode'), $val['SUBMENU'])); $val['SUBMENU'] = View::load(array(Settings::$ENGINE['template'], 'navigation'), $tmp); } $arr['NODES'] .= View::load(array(Settings::$ENGINE['template'], 'navigationNode'), $val); } return View::load(array(Settings::$ENGINE['template'], 'navigation'), $arr); } return null; }
function index() { $posts = array(array('id' => 125923, 'slug' => 'the-most-awesome-post-ever', 'title' => 'The Most Awesome Post! Ever!', 'posted' => '2010-09-01 02:0:00', 'text' => '<p>This is the most awesome post. ever</p><p>And the second line of it.</p>'), array('id' => 125922, 'slug' => 'the-second-most-awesome-post-ever', 'title' => 'The Second Most Awesome Post! Ever!', 'posted' => '2010-09-01 01:00:00', 'text' => '<p>This is the second most awesome post. ever</p><p>And the second line of it.</p>')); $this->blogposts = $posts; $this->title = "Blog"; $this->sitename = "MySite"; View::load('blog/default.php', $this); }
function index() { $arr = array(); $arr["select"] = FeedBackModel::getSelect(); $arr["name"] = "Имя"; $arr["siti"] = "Город"; $arr["Email"] = "Email"; return View::load(array(Settings::$ENGINE['template'], 'FeedBackForm'), $arr); }
function loadView($route) { $layout = 'default'; if (isset($route->action['Layout'])) { $layout = $route->action['Layout']; } $view = new View(); $view->load($route->action['View'], $layout); }
public function __destruct() { if (defined('AUTO_HEADER')) { if (AUTO_HEADER) { $this->template = View::load('html_header') . $this->template . View::load('html_footer'); } } echo $this->template; }
function testView() { $view = new View(); $view->no_layout = true; $view->load("test_view"); $view->data("test", "World"); ob_start(); $view->dump(array("controller" => "testz", "action" => "test")); $output = ob_get_contents(); ob_end_clean(); $this->assertEqual($output, "Hello World"); }
function onAppExit($render = TRUE) { if (APP_USE_CART) { $this->_shoppingCart->save(); } $ltime = microtime() - MateApplication::$startTime; Logger::log("LogicTime", "{$ltime} segs"); Logger::log("RenderTime", "{PUT_RENDER_TIME_HERE} segs"); Logger::log("TotalTime", "{PUT_TOTAL_TIME_HERE} segs"); $renderStart = microtime(); import("view.Cache"); if ($render !== FALSE) { if (APP_USE_TEMPLATES) { if (APP_DEBUG_MODE) { $debugContent = Config::exists("APP_DEBUG_TEMPLATE") ? View::load(APP_DEBUG_TEMPLATE, array("debug" => Logger::render(console))) : "<div class=\"debug\">" . Logger::render(console) . "</div>"; $this->view->set("debug", $debugContent); } switch ($render) { case "referer": echo redirectToReferer(); return false; die(""); case "error404": header("HTTP/1.0 404 Not Found"); $this->setContent("error/404"); break; default: // $result = $this->view->render(); break; } $result = $this->view->render(); /*$cache = new Cache("cache"); $ca*/ if (VIEW_USE_TIDY) { if (function_exists(tidy)) { $config = array('indent' => true, 'output-xhtml' => true, 'wrap' => 200); $tidy = new tidy(); $tidy->parseString($result, $config, 'utf8'); $tidy->cleanRepair(); $result = $tidy; } } echo str_replace(array("{PUT_RENDER_TIME_HERE}", "{PUT_TOTAL_TIME_HERE}"), array(microtime() - $renderStart, microtime() - MateApplication::$startTime), $result); } else { if (APP_DEBUG_MODE) { echo "<div class=\"debug\">" . Logger::render("console") . "</div>"; } } } else { //if(APP_DEBUG_MODE) echo "<div class=\"debug\">".Logger::render()."</div>"; } //echo Logger::log("LogicTime",MateApplication::$endTime-MateApplication::$startTime); }
public function view() { Kit::$login->checkLogin(2); View::load("arquivos_view", ACCEPTING_PARAMS); }
<?php require 'vendor/autoload.php'; $modeloProducto = new Producto(); $productos = $modeloProducto->todosLosProductos(); View::load('index', ['productos' => $productos]);
} ?> </div><!-- /.navbar-collapse --> </nav> <div id="page-wrapper"> <?php // puedo cargar otras funciones iniciales // dentro de la funcion donde cargo la vista actual // como por ejemplo cargar el corte actual View::load("start"); ?> </div><!-- /#page-wrapper --> </div><!-- /#wrapper --> <!-- JavaScript --> <?php if (Session::getUID() != "") { $channels = ChannelData::getAllByUID(Session::getUID()); if (count($channels) > 0) { $channel = $channels[0]; ?>
function index() { View::load('boki/index.php'); }
<?php require 'vendor/autoload.php'; if (!is_int((int) $_GET['id']) || $_GET['id'] < 1) { header('Location:index.php'); } $modeloProducto = new Producto(); $producto = $modeloProducto->traerProducto($_GET['id'])[0]; View::load('producto', ['producto' => $producto]);
</div> <button type="submit" class="btn btn-default">Entrar</button> </form> </li> <?php } ?> </ul> </nav> </div> </header> <!-- - - - - - - - - - - - - - - --> <?php View::load("index"); ?> <!-- - - - - - - - - - - - - - - --> <br><br> <div class="container"> <div class="row"> <div class="col-md-12"> <hr/> </div> </div> <div class="row"> <div class="col-md-3"> <h4>ENLACES</h4> <ul> <li><a href="./?view=changelog">Log de Cambios</a></li> <li><a href="http://evilnapsis.com">Evilnapsis HomePage</a></li>
/** * Import nodes and connections from the given CIF url for the selected nodeids into the given map. * The node import limit is set by '$CFG->ImportLimit'. * @param url the url for the CIF data to load * @param mapid the id of the map to get alerts for * @param selectedids an array of the CIF node ides to import * @param poses an array of the positions of the nodes in the map each array item is in * the format 'x:y' and the position in the array should correspond ot the position of * its node in the selectednodeids array. * before it is considered out of date and should be refetched and recalculated. * Defaults to 60 seconds. * @param private true if the data should be created as private, else false. * @return View object of the map or Error. * */ function addNodesAndConnectionsFromJsonld($url, $mapid, $selectedids, $poses, $private) { global $USER, $HUB_FLM, $CFG, $ERROR; require_once $HUB_FLM->getCodeDirPath("core/io/catalyst/catalyst_jsonld_reader.class.php"); require_once $HUB_FLM->getCodeDirPath("core/lib/url-validation.class.php"); //error_log(print_r($selectedids, true)); if (count($selectedids) > $CFG->ImportLimit) { $ERROR = new error(); $ERROR->createAccessDeniedError(); return $ERROR; } //error_log(print_r($poses, true)); // Check if the map is in a group and if so get the group id. $groupid = ""; $v = new View($mapid); $view = $v->load(); if (!$view instanceof Error) { if (isset($view->viewnode->groups)) { $groups = $view->viewnode->groups; if (count($groups) > 0) { $groupid = $groups[0]->groupid; } } } else { return $view; } // make sure current user in group, if group set. if ($groupid != "") { $group = new Group($groupid); if (!$group instanceof Error) { if (!$group->ismember($USER->userid)) { $error = new Error(); return $error->createNotInGroup($group->name); } } } $withhistory = false; $withvotes = false; $reader = new catalyst_jsonld_reader(); $reader = $reader->load($url, $withhistory, $withvotes); if (!$reader instanceof Error) { $nodeset = $reader->nodeSet; $nodes = $nodeset->nodes; $count = count($nodes); $newnodeSet = new NodeSet(); $newNodeCheck = array(); for ($i = 0; $i < $count; $i++) { $node = $nodes[$i]; $position = array_search($node->nodeid, $selectedids); //error_log("position:".$position); if ($position !== FALSE) { $position = intval($position); $positem = $poses[$position]; $positemArray = explode(":", $positem); $xpos = ""; $ypos = ""; if (count($positemArray) == 2) { $xpos = $positemArray[0]; $ypos = $positemArray[1]; } //error_log("xpos:".$xpos.":ypos:".$ypos); $role = getRoleByName($node->rolename); $description = ""; if (isset($node->description)) { $description = $node->description; } $newnode = addNode($node->name, $description, $private, $role->roleid); //error_log(print_r($newnode, true)); if (!$newnode instanceof Error) { $newNodeCheck[$node->nodeid] = $newnode; //error_log($node->nodeid); // if we have positioning information add the node to the map. if ($xpos != "" && $ypos != "") { $viewnode = $view->addNode($newnode->nodeid, $xpos, $ypos); //if (!$viewnode instanceof Error) { } if (isset($node->homepage) && $node->homepage != "") { $URLValidator = new mrsnk_URL_validation($node->homepage, MRSNK_URL_DO_NOT_PRINT_ERRORS, MRSNK_URL_DO_NOT_CONNECT_2_URL); if ($URLValidator->isValid()) { $urlObj = addURL($node->homepage, $node->homepage, "", $private, "", "", "", "cohere", ""); $newnode->addURL($urlObj->urlid, ""); // Add url to group? - not done on forms at present } else { error_log('Invalid node homepage: ' . $node->homepage . ': for ' . $node->nodeid); } } if (isset($node->users[0])) { $user = $node->users[0]; if (isset($user->homepage) && $user->homepage != "") { $URLValidator = new mrsnk_URL_validation($user->homepage, MRSNK_URL_DO_NOT_PRINT_ERRORS, MRSNK_URL_DO_NOT_CONNECT_2_URL); if ($URLValidator->isValid()) { $urlObj = addURL($user->homepage, $user->homepage, "", $private, "", "", "", "cohere", ""); $newnode->addURL($urlObj->urlid, ""); // Add url to group? - not done on forms at present } else { error_log('Invalid user homepage: ' . $user->homepage . ': for ' . $user->userid); } } } //if ($groupid != "") { // $newnode->addGroup($groupid); //} $newnodeSet->add($newnode); } else { error_log(print_r($newnode, true)); } } } $connectionset = $reader->connectionSet; $connections = $connectionset->connections; $count = count($connections); for ($i = 0; $i < $count; $i++) { $conn = $connections[$i]; $from = $conn->from; $to = $conn->to; $fromrole = $conn->fromrole; $torole = $conn->torole; if (isset($newNodeCheck[$from->nodeid]) && isset($newNodeCheck[$to->nodeid])) { $newFromNode = $newNodeCheck[$from->nodeid]; $newToNode = $newNodeCheck[$to->nodeid]; // Might not need this as it might be done already //if ($newFromNode->role->name != $fromrole->name) { // updateNodeRole($newFromNode->nodeid,$fromrole->name); //} $linklabelname = $conn->linklabelname; //error_log($linklabelname); $lt = getLinkTypeByLabel($linklabelname); if (!$lt instanceof Error) { $linkType = $lt->linktypeid; //$frole = getRoleByName($fromrole->name); //$trole = getRoleByName($torole->name); $connection = addConnection($newFromNode->nodeid, $newFromNode->role->roleid, $linkType, $newToNode->nodeid, $newToNode->role->roleid, 'N', ""); //error_log(print_r($connection, true)); if (!$connection instanceof Error) { // add to group if (isset($groupid) && $groupid != "") { $connection->addGroup($groupid); } $viewcon = $view->addConnection($connection->connid); //error_log(print_r($viewcon,true)); } else { error_log(print_r($connection, true)); } } else { error_log("for label:" . $linklabelname . ":" . print_r($lt, true)); } } } } else { return $reader; } return $view; }
function smarty() { View::load('index.tpl'); }
function statistic() { $stat = array('NAME' => 'Главная', 'STATISTIC' => 'Тут типа главная страница и все такое'); // $stat['STATISTIC'] .= ' IP-адресов в списке: '.Engine::getIpCount(); // $stat['STATISTIC'] .= ' Софт в списке: '.Engine::getStuffCount(); // $stat['STATISTIC'] .= ' Подключено контроллеров: '.Engine::getControllersCount(); // $stat['STATISTIC'] .= ', из них активно: '.Engine::getActivedControllersCount(); return View::load(array('engine', 'statisticNode'), $stat); }
public function index() { $data['title'] = '404'; $data['error'] = $this->_error; View::load('error/view/404', $data); }
/** * This is the route engine * * @since 1.0.0 * @access private * * @return void */ private final function start_route_engine() { $url = $this->extract_route(); if (file_exists('../app/controllers/' . $url[0] . '.php')) { $this->controller = $url[0]; unset($url[0]); } else { if ($url) { $static = file_exists('../app/views/' . $url[0] . '.php') ? $url[0] : '404'; unset($url[0]); $this->params = $url ? array_values($url) : []; View::load($static, ['params', $this->params]); return; } } require_once '../app/controllers/' . $this->controller . '.php'; $this->controller .= 'controller'; if (isset($url[1]) && method_exists($this->controller, $url[1])) { $this->method = $url[1]; unset($url[1]); } $this->params = $url ? array_values($url) : []; $controllerInstance = new $this->controller(); call_user_func_array([$controllerInstance, $this->method], $this->params); }
<!-- /.sidebar --> </aside> <!-- Right side column. Contains the navbar and content of the page --> <aside class="right-side"> <?php // puedo cargar otras funciones iniciales // dentro de la funcion donde cargo la vista actual // como por ejemplo cargar el corte actual if (Session::getUID() == "") { View::load("login"); } else { if (Core::$user->is_admin) { View::load("home"); } else { View::load("sell"); } } ?> </aside><!-- /.right-side --> </div><!-- ./wrapper --> <!-- add new calendar event modal --> <!-- jQuery 2.0.2 --> <script src="res/jquery.min.js"></script> <!-- jQuery UI 1.10.3 --> <script src="js/jquery-ui-1.10.3.min.js" type="text/javascript"></script> <!-- Bootstrap --> <script src="js/bootstrap.min.js" type="text/javascript"></script>
} ?> </div><!-- /.navbar-collapse --> </nav> <div id="page-wrapper"> <?php // puedo cargar otras funciones iniciales // dentro de la funcion donde cargo la vista actual // como por ejemplo cargar el corte actual View::load("login"); ?> </div><!-- /#page-wrapper --> </div><!-- /#wrapper --> <!-- JavaScript --> <script src="res/bootstrap3/js/bootstrap.min.js"></script> </body> </html>
public static function loadPath($path, $evalPath = false, $show404 = true, $checkFileExist = false) { if ($evalPath) { if (defined('CMS_PATH')) { $path = file_exists(APP_PATH . $path) ? APP_PATH . $path : CMS_PATH . $path; } else { $path = APP_PATH . $path; } } Debug::log("View->loadPath: {$path}", __LINE__, __FUNCTION__, __CLASS__, __FILE__); if ($checkFileExist) { if (file_exists($path)) { require_once $path; return true; } else { Error::show(2, "View->loadPath: {$path} não encontrado."); if ($show404) { View::load("404"); } return false; //exit; } } else { try { require_once $path; } catch (Exception $e) { throw new Exception('View::loadPath - Arquivo não encontrado.' . $path); } } }
<?php include "../View.php"; ?> <!DOCTYPE html> <head> <title>Title</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> </head> <body> <div id="header"> <h1>Haj!</h1> </div> <div id="content"> <?php $content = View::load("testView"); echo $content; ?> </div> <div id="footer"> <h1>Footer</h1> </div> </body> </html>
/** * @param string $filename src or content * @param array $vars Data to pass to the View * @param int $status Set the response status code. * @param array $headers Set response headers. * @param int $asText Echo as text */ public function Response($filename = '', array $vars = array(), $status = 200, array $headers = array(), $asText = 0) { $this->setStatusCode($status); if (count($headers)) { //add extra headers $this->addCustomHeaders($headers); } //pass to the view if (!$asText) { $view = new View(VIEWS_ROUTE . $filename, $vars, $this); $view->load(); } else { echo $filename; } }
<a class="ui-tabs-anchor" href="<?php echo $url; ?> "><?php echo $label; ?> </a> </li> <?php } ?> </ul> </div> <div class="content-wrapper ui-widget"> <?php View::load('errors', compact('errors')); ?> <?php View::load('messages', compact('messages')); ?> <div class="content"> <?php View::load($content_view, $params); ?> </div> </div> </body> </html>
/** * Gets the action view HTML. * @param bool $print * @return bool|string */ public function getActionView($print = false) { $this->_returnActionView = true; // Load an action view to the View object $this->_viewAction->load(Router::$controller_view, Router::$method); // Parse action view $action_content = $this->_viewAction->parse($this->view, new View_Helper()); // Set parsed action view $this->view->setActionContent($action_content); if ($print) { print $this->view->getActionContent(); return true; } return $this->view->getActionContent(); }
<?php /*------------------------------------------------------------------------------ Execute ------------------------------------------------------------------------------*/ include_once 'libs/autoindex.php'; include_once 'libs/markdown.php'; $view = new View(); $view->load('standard'); /*----------------------------------------------------------------------------*/ // Allow anything: $view->allow('%.%'); // Ignore OSX meta data: $view->deny('%/\\.(Apple|DS_)%'); $view->deny('%/(Network Trash Folder|Temporary Items)$%'); // Ignore hidden files: $view->deny('%/\\.%'); // Allow itself: $view->allow('%/\\.?autoindex(/|$)%'); // Add readme files: $view->readme('%/readme(\\.txt)?$%i'); $view->readme('%/readme\\.md$%i', function ($text) { return Markdown($text); }); $view->readme('%/readme\\.html?$%i', function ($text) { return $text; }); $view->execute()->display(); /*----------------------------------------------------------------------------*/
$tidy->cleanRepair(); //html is now nicely indented $html = (string) $tidy; //count the tags and get the result in a $tag => $count array $tagCount = countTags($html); $response['tagCount'] = $tagCount; $response['html'] = htmlentities($html); } } else { $response['message'] = $_POST['url'] . " is not a valid URL"; } header('Content-Type: application/json'); echo json_encode($response); } else { //load the base view, located at ../views/base.php View::load("base"); } /** * Count html tags, ignore everything between script and style tags * * @param string $html The HTML page to check * @return array All the tags that were found, and the number of times that they were found. */ function countTags($html) { //what to search for $search = array('@<script[^>]*?>.*?</script>@si', '@<style[^>]*?>.*?</style>@si'); //replace the html tags with all js and css code removed $replace = array("<script></script>\n", "<style></style>\n"); //remove the code! $html = preg_replace($search, $replace, $html);
/** * Method to display the homepage * * @since 1.0.0 * @param array $params URL request paramethers * @return void */ public function index($params = []) { // $user = $this->model('User'); // var_dump( $user ); View::load('home/index'); }