Skip to content

Commit

Permalink
Modify lattice to only contain the PHP code
Browse files Browse the repository at this point in the history
The JS and CSS code have been moved to independent projects, this is
being cleaned up to only contain the PHP framework.
  • Loading branch information
useername authored and moonbench committed Jan 11, 2018
1 parent 3214a79 commit 3a47599
Show file tree
Hide file tree
Showing 16 changed files with 8 additions and 2,841 deletions.
5 changes: 5 additions & 0 deletions demo.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php
require "src/app/main.php";

render("page", ["body" => "Hello world"]);
?>
23 changes: 0 additions & 23 deletions src/api/common.php

This file was deleted.

18 changes: 0 additions & 18 deletions src/app/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,35 +7,27 @@
* which provides access to all of the scripts, models, and controllers
* used within this framework.
*/


/**
* Identify where we are running from and configure the root values accordingly
*/
function determine_paths(){
// Where is the framework's root?
define('APP_ROOT', dirname(__FILE__));

// Get the site root from the default config
$site_root = parse_ini_file(APP_ROOT . "/config/site.default.ini")["site_root"];

// overwrite with local config if it exists
$local_config = APP_ROOT . "/config/site.ini";
if(file_exists($local_config)){
$site_root = parse_ini_file($local_config)["site_root"];
}
define('SITE_ROOT', $site_root);
}


/**
* Make PHP more comfortable with custom functions
*/
function add_common_functions(){
require_once APP_ROOT . "/common/fn.php";
}


/**
* Bind functions into the PHP environment to automatically handle things
*/
Expand All @@ -44,33 +36,24 @@ function add_support_classes(){
new \app\autoloader();
set_error_handler('\app\error::php_error');
}


/**
* Make PHP run within known constraints
*/
function adjust_the_environment(){
set_time_limit(45);
}


/**
* Make sure that we have a user session running prior to code execution
*/
function prepare_user_session(){
if( session_status() !== PHP_SESSION_ACTIVE ) session_start();
}


/**
* Start an output buffer to prevent writing to the client by mistake
*/
function start_output_buffer(){
ob_start("ob_gzhandler");
}



/**
* Start the framework
*/
Expand All @@ -80,6 +63,5 @@ function start_output_buffer(){
adjust_the_environment();
prepare_user_session();
start_output_buffer();

// Ready for work!
?>
26 changes: 3 additions & 23 deletions src/app/view/page.tpl.php
Original file line number Diff line number Diff line change
@@ -1,30 +1,10 @@
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<link rel="stylesheet" href="<?= SITE_ROOT ?>css/base.css" />
<link rel="stylesheet" href="<?= SITE_ROOT ?>css/site.css" />
<link rel="stylesheet" href="<?= SITE_ROOT ?>css/font-awesome.min.css" />

<script type="text/javascript" src="<?= SITE_ROOT ?>js/underscore-min.js"></script>
<script type="text/javascript" src="<?= SITE_ROOT ?>js/base.js"></script>
<script type="text/javascript" src="<?= SITE_ROOT ?>js/site.js"></script>
<title>Lattice</title>
</head>

<body>
<div id="page">
<div id="header">
</div>
<hr class="hidden">

<div id="body">
<?= $data->body ?>
</div>
</div>

<script type="text/javascript">
</script>
<?= $data->body ?>
</body>
</html>
</html>
8 changes: 0 additions & 8 deletions src/css/base.css

This file was deleted.

4 changes: 0 additions & 4 deletions src/css/font-awesome.min.css

This file was deleted.

Binary file removed src/css/font/FontAwesome.otf
Binary file not shown.
4 changes: 0 additions & 4 deletions src/css/font/font-awesome.min.css

This file was deleted.

Binary file removed src/css/font/fontawesome-webfont.eot
Binary file not shown.
2,671 changes: 0 additions & 2,671 deletions src/css/font/fontawesome-webfont.svg

This file was deleted.

Binary file removed src/css/font/fontawesome-webfont.ttf
Binary file not shown.
Binary file removed src/css/font/fontawesome-webfont.woff
Binary file not shown.
Binary file removed src/css/font/fontawesome-webfont.woff2
Binary file not shown.
5 changes: 0 additions & 5 deletions src/index.php

This file was deleted.

79 changes: 0 additions & 79 deletions src/js/base.js

This file was deleted.

6 changes: 0 additions & 6 deletions src/js/underscore-min.js

This file was deleted.

0 comments on commit 3a47599

Please sign in to comment.