Example #1
0
 /**
  * Build page from database
  * @param array $data
  */
 public static function build(array $data)
 {
     if (!isset($data['title'], $data['body'])) {
         return;
     }
     $content = new Page($data['title'], $data['body']);
     if (isset($data['stylesheets'])) {
         foreach ($data['stylesheets'] as $source) {
             $content->addStylesheet($source);
         }
     }
     if (isset($data['javascripts'])) {
         foreach ($data['javascripts'] as $source) {
             $content->addJavascript($source);
         }
     }
     $content->render('system.header');
     if (isset($data['header'])) {
         $content->setHeader($data['header']);
     }
     $content->render('system.footer');
     if (isset($data['footer'])) {
         $content->setFooter($data['footer']);
     }
     return $content->publish();
 }
Example #2
0
 function deploy($xml)
 {
     $Page = new Page();
     $blcks = $xml->blocks->block;
     $locals = (array) $xml->vars;
     $locals['catalogue'] = $Page->catalogue();
     $locals['blocks'] = $Page->render_blocks($blcks, $locals);
     $locals['modals'] = $Page->render('modals', $locals);
     $content = $Page->render('layout', $locals);
     file_put_contents(ROOTPATH . '/app/data/result.html', $content);
 }
Example #3
0
 function render()
 {
     $this->api->template->appendHTML('js_include', '<link type="text/css" href="elfinder/css/elfinder.min.css" rel="stylesheet" />' . "\n");
     $this->api->template->appendHTML('js_include', '<link type="text/css" href="elfinder/css/theme.css" rel="stylesheet" />' . "\n");
     $this->api->template->appendHTML('js_include', '<script src="elfinder/js/elfinder.min.js"></script>' . "\n");
     parent::render();
 }
 /**
  * Most important function: Render page and cache the output
  *
  * @param  Page   $page     $page we are rendering
  * @param  string $filename template file name we use
  * @param  array  $options  options we pass through to $page->render()
  * @return string           output
  */
 private function render_cache(Page $page, $filename, $options)
 {
     $cache = $this->modules->get('MarkupCache');
     $lang = $this->user->language ? $this->user->language->name : '';
     $id = str_replace('/', '.', implode('.', array_filter([$page->id, $lang, $filename])));
     if ($this->config->bypassPageRenderCache) {
         $data = $page->render("{$filename}.php", $options);
     } else {
         $data = $cache->get($id);
         if (!$data) {
             $data = $page->render("{$filename}.php", $options);
             $cache->save($data);
         }
     }
     return $data;
 }
Example #5
0
 function index($urlParts)
 {
     $page = new Page();
     $content = Content::getAll('post');
     $page->addRenderable('content', $content);
     $page->render();
 }
Example #6
0
 /**
  * @throws \Error
  */
 public function render()
 {
     $h = $this->_config['header_func'] ?? 'header';
     if (is_callable($h) == false) {
         throw new \Error("Header function injected to Error is not callable");
     }
     $errorPage = null;
     switch ($this->code) {
         case 404:
             $h("HTTP/1.0 404 Not Found");
             $errorPage = new Page(new Request(['url' => '404']), $this->_config);
             break;
         case 400:
             $h("HTTP/1.0 400 {$this->message}");
             break;
         default:
             $h("HTTP/1.0 {$this->code} Bad request");
             $errorPage = new Page(new Request(['url' => '500']), $this->_config);
             break;
     }
     if ($errorPage) {
         // TODO only do this if request accepts html?
         try {
             $errorPage->setData('message', $this->message);
             echo $errorPage->render();
         } catch (\alkemann\h2l\exceptions\InvalidUrl $e) {
             if (defined('DEBUG') && DEBUG) {
                 echo "No error page made at " . $e->getMessage();
             }
         }
     }
 }
Example #7
0
 function render()
 {
     $this->api->template->del("Menu");
     $this->api->template->del("logo");
     $this->api->template->trySet("Content", "");
     $this->api->template->trySet("Footer", "");
     parent::render();
 }
Example #8
0
 function render()
 {
     // $this->api->template->del('header');
     // $this->api->template->del('logo');
     $this->api->template->del('Menu');
     // $this->api->template->del('date');
     $this->api->template->del('welcome');
     // $this->api->template->del('footer_text');
     parent::render();
 }
Example #9
0
 public function testRenderingSimple()
 {
     try {
         $config = $this->_setupFolder();
         $this->_setupViewFiles($config);
     } catch (\Throwable $t) {
         //
         $this->markTestSkipped("Skipping File test: " . $t->getMessage());
     }
     // $request = new Request(); // @TODO use a mock instead
     $request = $this->getMock('alkemann\\h2l\\Request', ['type', 'route', 'method'], [], 'Request', false);
     $request->expects($this->once())->method('type')->willReturn('html');
     $request->expects($this->once())->method('route')->willReturn(new Route('place'));
     $config['content_path'] = substr($config['content_path'], 0, -6);
     $page = new Page($request, $config);
     $expected = '<html><body><div><h1>Win!</h1></div></body></html>';
     $result = $page->render();
     $this->assertEquals($expected, $result);
     $page->layout = 'spicy';
     $expected = '<html><title>Spice</title><body><h1>Win!</h1></body></html>';
     $result = $page->render();
     $this->assertEquals($expected, $result);
     $page->layout = 'doesntexist';
     $expected = '<h1>Win!</h1>';
     $result = $page->render();
     $this->assertEquals($expected, $result);
     $this->_cleanupViewFiles();
     $caught = false;
     // invalid url;
     try {
         $result = $page->render();
     } catch (\alkemann\h2l\exceptions\InvalidUrl $e) {
         $caught = true;
     }
     $this->assertTrue($caught, 'Exception was not thrown for missing page');
 }
Example #10
0
 function render($region = "")
 {
     if ($region == "project") {
         $page = find($this, "Page", "path", $this->path);
         if ($page == null) {
             if (strpos($this->path, "/") !== false) {
                 $parts = explode("/", $this->path);
                 $page = find($this, "Page", "path", $parts[0]);
                 if ($page == null) {
                     $page = new Page($this, '{ "name":"404", "file":"threephp/inc/404.php" }');
                 }
             }
         }
         echo $page->render("page");
     }
 }
Example #11
0
 function render()
 {
     $this->api->template->appendHTML('js_include', '<script src="templates/js/jquery.sharrre.js"></script>' . "\n");
     if ($this->api->getConfig('css_mode') == 'less') {
         $this->api->template->appendHTML('js_include', '<link type="text/css" href="templates/default/css/epan.less" rel="stylesheet/less" />' . "\n");
         $this->api->template->appendHTML('js_include', '<script src="templates/default/js/less.min.js"></script>' . "\n");
     } else {
         // Moved to FrontEnd
         // $this->api->template->appendHTML('js_include','<link type="text/css" href="templates/default/css/epan.css" rel="stylesheet" />'."\n");
     }
     if ($this->api->edit_mode) {
         /**
          * Main Live Editor JavaScript File handling All Editor based working
          */
         $this->js()->_load('epan_live_edit');
         // Add Div to stop being accessed before fully loaded
         // $this->api->template->appendHTML('Content','<div id="overlay-dark"><H3 id="overlay-dark-message">Wait, Loading ...</h3> </div>');
         $this->api->template->appendHTML('js_include', '<link type="text/css" href="templates/default/css/epan_live.css" rel="stylesheet" />' . "\n");
         // $this->api->template->appendHTML('js_include','<link type="text/css" href="templates/js/jquery.jscrollpane.css" rel="stylesheet" />'."\n");
         // $this->api->template->appendHTML('js_include','<script src="templates/js/jquery.jscrollpane.min.js"></script>'."\n");
         // SHORTCUTS
         $this->api->template->appendHTML('js_include', '<script src="templates/js/shortcut.js"></script>' . "\n");
         // POPLINE EDITING
         $this->api->template->appendHTML('js_include', '<link type="text/css" href="templates/js/popline/css/normalize.css" rel="stylesheet" />' . "\n");
         $this->api->template->appendHTML('js_include', '<link type="text/css" href="templates/js/popline/themes/default.css" rel="stylesheet" />' . "\n");
         $this->api->template->appendHTML('js_include', '<script src="templates/js/popline/build/jquery.popline.min.js"></script>' . "\n");
         $this->api->template->appendHTML('js_include', '<link type="text/css" href="templates/js/popline/font-awesome/css/font-awesome.min.css" rel="stylesheet" />' . "\n");
         // Font Awsome
         $this->api->template->appendHTML('js_include', '<link type="text/css" href="templates/default/font-awesome/css/font-awesome.min.css" rel="stylesheet" />' . "\n");
         // Google font selector
         $this->api->template->appendHTML('js_include', '<link type="text/css" href="templates/js/fontselect.css" rel="stylesheet" />' . "\n");
         $this->api->template->appendHTML('js_include', '<script src="templates/js/jquery.fontselect.js"></script>' . "\n");
         $this->api->template->appendHTML('js_include', '<link type="text/css" href="elfinder/css/elfinder.min.css" rel="stylesheet" />' . "\n");
         $this->api->template->appendHTML('js_include', '<link type="text/css" href="elfinder/css/theme.css" rel="stylesheet" />' . "\n");
         $this->api->template->appendHTML('js_include', '<script src="elfinder/js/elfinder.min.js"></script>' . "\n");
     }
     $theme_css = 'epans/' . $this->api->current_website['name'] . '/theme.css';
     if (file_exists(getcwd() . DS . $theme_css)) {
         $this->api->template->appendHTML('js_include', '<link id="xepan-theme-css-link" type="text/css" href="' . $theme_css . '" rel="stylesheet" />' . "\n");
     }
     $user_css = 'epans/' . $this->api->current_website['name'] . '/mystyles.css';
     if (file_exists(getcwd() . DS . $user_css)) {
         $this->api->template->appendHTML('js_include', '<link id="xepan-mystyles-css-link" type="text/css" href="' . $user_css . '" rel="stylesheet" />' . "\n");
     }
     parent::render();
 }
Example #12
0
 public static function run($uri = '')
 {
     self::$dispatcher = new Dispatcher($uri);
     $controller_class = ucfirst(self::$dispatcher->getController()) . 'Controller';
     $controller_method = strtolower(self::$dispatcher->getAction()) . 'Action';
     $controller_object = new $controller_class();
     if (method_exists($controller_object, $controller_method)) {
         $controller_object->{$controller_method}();
         $layout = $controller_object->getLayout();
         if ($layout != '') {
             $page = new Page($layout, $controller_object->getData());
         } else {
             $page = new Page('default');
         }
         $page->render();
     } else {
         throw new Exception('Method ' . $controller_method . ' of ' . $controller_class . ' class in not found!');
     }
 }
Example #13
0
<?php

require 'Renderers.php';
class Page
{
    protected $renderers = [];
    public function add(Renderer $renderer)
    {
        $this->renderers[] = $renderer;
    }
    public function render()
    {
        $content = '';
        $content .= "--Start of Page--\n";
        $content .= array_reduce($this->renderers, function ($output, $r) {
            return $output .= $r->render() . "\n";
        }, '');
        $content .= "--End of Page--\n";
        return $content;
    }
}
$page = new Page();
$page->add(new BlogRenderer());
$page->add(new ArticleRenderer());
$page->add(new GraphRenderer());
// $page->add(new Page());
echo $page->render();
Example #14
0
 */
if (file_exists('bootstrap.php')) {
    require 'bootstrap.php';
}
/**
 * Initialize the built-in cache support. Provides a
 * consistent cache API (based on Memcache) so we can always
 * include caching in our handlers and in the front controller.
 */
if (!isset($memcache) || !is_object($memcache)) {
    $memcache = Cache::init(conf('Cache'));
}
/**
 * Route the request to the appropriate handler and get
 * the handler's response.
 */
if ($i18n->url_includes_lang) {
    $handler = $controller->route($i18n->new_request_uri);
} else {
    $handler = $controller->route($_SERVER['REQUEST_URI']);
}
$page->body = $controller->handle($handler, false);
/**
 * Render and send the output to the client, using gzip
 * compression if conf[General][compress_output] is true.
 */
$out = $page->render($tpl);
if (conf('General', 'compress_output') && extension_loaded('zlib')) {
    ob_start('ob_gzhandler');
}
echo $out;
Example #15
0
function echoPage(Page $obj)
{
    $obj->render();
}
Example #16
0
";
            var _update = "<?php 
    echo $update == null ? "" : $update;
    ?>
";
            var _delete = "<?php 
    echo $delete == null ? "" : $delete;
    ?>
";
            if (_insert || _update || _delete) {
                swal({
                    title: "Thành công!",
                    type: "success",
                    confirmButtonText: "OK"
                }, function () {
                    /*var token = location.search.split("&").pop();
                    var newURL = window.location.protocol + "//" + window.location.host + "/" + window.location.pathname;
                    window.location.href = newURL + "?" + token;*/
                    var url = "statuses.php?token=" + "<?php 
    echo $_GET["token"];
    ?>
" ;
                    window.location.href = url;
                });
            }
        });
    </script>
    <?php 
    $page->endBody();
    echo $page->render('./Teamplates/Template.php');
}
Example #17
0
 public function render()
 {
     return parent::render();
 }
Example #18
0
echo escape(Input::get('username'));
?>
" autocomplete="off">
  </div>
  <div class="field">
    <label for="password">Choose a password</label>
    <input type="password" name="password" id="password">
  </div>
  <div class="field">
    <label for="password_again">Please repeat your password</label>
    <input type="password" name="password_again" id="password_again">
  </div>
  <div class="field">
    <label for="name">Enter your full name</label>
    <input type="text" name="name" id="name" value="<?php 
echo escape(Input::get('name'));
?>
">
  </div>
  <input type="hidden" name="token" value="<?php 
echo Token::generate();
?>
">
  <input type="submit" value="Register">
</form>
<!-- END BODY CONTENT -->

<?php 
$page->endBody();
echo $page->render('../includes/templates/standardTemplate.php');
Example #19
0
 function render()
 {
     if ($_GET['delete_front']) {
         $this->template->del('marksheet_front');
     }
     $this->api->template->del('logo');
     $this->api->template->del('Menu');
     $this->api->template->del('date');
     $this->api->template->del('welcome');
     $this->api->template->del('footer_text');
     parent::render();
 }
Example #20
0
 public function render()
 {
     $this->template->ip = $this->ip;
     $this->template->reason = $this->reason;
     return parent::render();
 }
Example #21
0
 public function renderCurrentPage(Site $site)
 {
     if (isset($this->currentPage)) {
         $this->currentPage->render();
     }
 }
Example #22
0
    </td>
  </tr>
  <?php 
}
?>

</table>

	  </div>	</td>
  </tr>
</table>
<div id="pagediv">
<?php 
require 'class/page.php';
$p = new Page($page, $count, $_SERVER['PHP_SELF'], $pageSize, 'page-current');
$p->render();
?>
  <div>
<form action="appmanage.php" id="gomangeform" method="get">
	<input type="hidden" id="appid" name="appid" value="" />
</form>
<script src="js/jquery-1.6.2.min.js" type="text/javascript"></script>
	
<script type="text/javascript">
	$(function() {
		/*********Tab标签切换样式*********/
	//	$('.DivTab').bind('click',function(){
			//	$(this).addClass('hover').siblings().removeClass('hover');
	//	})
		
		$('.btn-pass').click(function() {
Example #23
0
 function render()
 {
     $this->api->template->appendHTML('js_include', '<link type="text/css" href="templates/default/css/epan.css" rel="stylesheet" />' . "\n");
     parent::render();
 }
<?php

include "functions/load_page.php";
$redirect = "index.php#meetings";
$page = new Page();
$page->set_title("Meeting times");
$page->set_redirect($redirect);
$page->set_text("\n   <h2>How to Join</h2>\n   <p>This page has been removed. See the <a href='{$redirect}'>about page</a>. </p>\n");
$page->render();
Example #25
0
    @session_regenerate_id(true);
    // Hook
    $HookManager->processEvent('LOGOUT', array('user' => &$currentUser));
    // Logout
    if (method_exists($currentUser, 'logout')) {
        $currentUser->logout();
    }
    // Unset session variables
    unset($currentUser, $_SESSION['FOG_USERNAME'], $_SESSION['FOG_USER'], $_SESSION['AllowAJAXTasks']);
    // Show login form
    $Page->setTitle($foglang['Login']);
    $Page->setSecTitle($foglang['ManagementLogin']);
    $Page->startBody();
    $FOGCore->getClass('ProcessLogin')->mainLoginForm();
    $Page->endBody();
    $Page->render();
}
$_SESSION['AllowAJAXTasks'] = true;
$content = $FOGPageManager->render();
$sectionTitle = $FOGPageManager->getFOGPageName();
$pageTitle = $FOGPageManager->getFOGPageTitle();
if ($FOGCore->isAJAXRequest()) {
    print $content;
    exit;
}
$Page->setTitle($pageTitle);
$Page->setSecTitle($sectionTitle);
$Page->startBody();
print $content;
$Page->endBody();
$Page->render();
Example #26
0
// CHECK PHP VERSION
if (phpversion() < "5.0") {
    die("This project is only supported in PHP 5 and above.");
}
require_once "classes/includes/paths.php";
require_once "classes/core/Page.php";
require_once "classes/helpers/UrlHelper.php";
if (!Page::isPage("/home")) {
    include "installer.php";
}
global $PAGE;
global $PAGE_HANDLE;
$PAGE_HANDLE = UrlHelper::getCurrentPage("/home");
$PAGE = new Page($PAGE_HANDLE);
$PAGE->render();
/*  ******* LICENSE ******* 
 *  
 *  Copyright 2009 Joel Cass 
 *  
 *  Licensed under the Apache License, Version 2.0 (the "License"); 
 *  you may not use this file except in compliance with the License. 
 *  You may obtain a copy of the License at 
 *  
 *  	http://www.apache.org/licenses/LICENSE-2.0 
 *  	
 *  Unless required by applicable law or agreed to in writing, software 
 *  distributed under the License is distributed on an "AS IS" BASIS, 
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
 *  See the License for the specific language governing permissions and 
 *  limitations under the License. 
Example #27
0
define('PLUGINS_PATH', BASE_PATH . DS . "plugins");
define('CLASSES_PATH', CORE_PATH . DS . "classes");
define('THEMES_PATH', BASE_PATH . DS . "themes");
require_once INCLUDES_PATH . DS . "functions.php";
require_once INCLUDES_PATH . DS . "config.php";
$registry = Registry::getInstance();
$page = new Page();
$page->setTitle('Magus v2.0: Electric Boogaloo');
$page->setTheme('default');
//Leave in for dependency injection. Get the theme
//var from registry when it's available
$page->setRegion('header', "Magus v2.0: Electric Boogaloo");
$page->setRegion('left_sidebar', "Tada!!!");
$page->setRegion('right_sidebar', "Wicked");
$page->setRegion('footer', "BAM!! Footer");
$left_sidebar = new Region();
$template = new Template();
$template->setPath(THEMES_PATH . DS . $registry->setting('theme') . DS . "templates");
$template->setTemplate('danfro');
$left_sidebar->addPlugin('Template', $template, 8);
$template = new Template();
$template->setPath(THEMES_PATH . DS . $registry->setting('theme') . DS . "templates");
$template->setTemplate('test_subject');
$left_sidebar->addPlugin('Template', $template, 6);
/*$left_sidebar->addPlugin('test', 0, 'Stuff', array('test', 'nothin'), 'relaxed', 1121);
$left_sidebar->addPlugin('newtest', 50, "other stuff");
$left_sidebar->addPlugin('third_test', 10, "more stuff");
$left_sidebar->addPlugin('forth_test', 5, "forth stuff");*/
$page->setRegion('left_sidebar', $left_sidebar->render());
print $page->render();
Example #28
0
File: events.php Project: qb90/www
<?php

require_once 'lib/page.php';
$page = new Page();
$page->setTitle('Events');
$page->setImage('cr-m.jpg');
$page->startBody();
?>

<blockquote>
Eleven events are included on the provisional calendar although it is the intention to increase to 12 once all agreements for a new season-opening round have been reached. 
Providing it goes ahead, that would mean 24 races, 12 DHL pole position shootouts and 12 MAC3 contests.
</blockquote>

François Ribeiro, Head of Eurosport Events, the WTCC promoter, said: 
<blockquote>
“The intention is for the calendar to have 12 events but the agreement with the potential new venue is not there yet. Providing all elements of the deal fall into place we hope to announce the final calendar with 12 weekends prior to the Christmas break. Otherwise, we have kept the same venues in a number of key markets that provide the challenge and prestige we crave, plus the variety.”
</blockquote>

<?php 
$page->endBody();
echo $page->render('templ/template.php');
 function render()
 {
     $this->api->template->del('header');
     $this->api->template->del('Footer');
     parent::render();
 }