Initial commit
This commit is contained in:
179
app/resources/config/config.example.json
Normal file
179
app/resources/config/config.example.json
Normal file
@ -0,0 +1,179 @@
|
||||
{
|
||||
"main": {
|
||||
"name": {
|
||||
"type": "text",
|
||||
"pretty": "Site Name",
|
||||
"default": "TTP Example",
|
||||
"value": "TTP Example"
|
||||
},
|
||||
"loginLimit": {
|
||||
"type": "text",
|
||||
"pretty": "Maximum Login Attempts per hour",
|
||||
"default": 5,
|
||||
"value": 5
|
||||
},
|
||||
"logo": {
|
||||
"type": "file",
|
||||
"pretty": "Site Logo (Used mostly in emails)",
|
||||
"default": "images/logo.png",
|
||||
"value": "images/logo.png"
|
||||
},
|
||||
"template": {
|
||||
"type": "text",
|
||||
"pretty": "Default Site Template",
|
||||
"default": "default",
|
||||
"value": "default"
|
||||
},
|
||||
"tokenEnabled": {
|
||||
"type": "radio",
|
||||
"pretty": "Enable CSRF Token for all forms.",
|
||||
"default": true,
|
||||
"value": true
|
||||
}
|
||||
},
|
||||
"uploads": {
|
||||
"files": {
|
||||
"type": "radio",
|
||||
"pretty": "Enable File Uploads",
|
||||
"default": true,
|
||||
"value": true
|
||||
},
|
||||
"images": {
|
||||
"type": "radio",
|
||||
"pretty": "Enable Image Uploads",
|
||||
"default": true,
|
||||
"value": true
|
||||
},
|
||||
"maxFileSize": {
|
||||
"type": "text",
|
||||
"pretty": "Maximum File Size",
|
||||
"default": 5000000,
|
||||
"value": 5000000
|
||||
},
|
||||
"maxImageSize": {
|
||||
"type": "text",
|
||||
"pretty": "Maximum Image Size",
|
||||
"default": 500000,
|
||||
"value": 500000
|
||||
}
|
||||
},
|
||||
"database": {
|
||||
"dbHost": {
|
||||
"type": "text",
|
||||
"pretty": "Database Host (IE: http://localhost:3306)",
|
||||
"default": "127.0.0.1",
|
||||
"protected": true,
|
||||
"value": "127.0.0.1"
|
||||
},
|
||||
"dbUsername": {
|
||||
"type": "text",
|
||||
"pretty": "Database Username",
|
||||
"default": "root",
|
||||
"protected": true,
|
||||
"value": "root"
|
||||
},
|
||||
"dbPrefix": {
|
||||
"type": "text",
|
||||
"pretty": "Database table Prefix",
|
||||
"default": "TTP_",
|
||||
"protected": true,
|
||||
"value": "TTP_"
|
||||
},
|
||||
"dbPassword": {
|
||||
"type": "text",
|
||||
"pretty": "Database Password",
|
||||
"default": "",
|
||||
"protected": true,
|
||||
"value": ""
|
||||
},
|
||||
"dbName": {
|
||||
"type": "text",
|
||||
"pretty": "Database Name",
|
||||
"default": "ttp-example",
|
||||
"protected": true,
|
||||
"value": "ttp-example"
|
||||
},
|
||||
"dbEnabled": {
|
||||
"type": "radio",
|
||||
"pretty": "Database Enabled",
|
||||
"default": true,
|
||||
"protected": true,
|
||||
"value": true
|
||||
},
|
||||
"dbMaxQuery": {
|
||||
"type": "text",
|
||||
"pretty": "Maximum results per query",
|
||||
"default": 100,
|
||||
"protected": true,
|
||||
"value": 100
|
||||
}
|
||||
},
|
||||
"group": {
|
||||
"defaultGroup": {
|
||||
"type": "customSelect",
|
||||
"pretty": "The Default Group for new registrations.",
|
||||
"default": 5,
|
||||
"value": 5
|
||||
}
|
||||
},
|
||||
"logging": {
|
||||
"admin": {
|
||||
"type": "radio",
|
||||
"pretty": "Enable Admin Action Logging.",
|
||||
"default": true,
|
||||
"value": true
|
||||
},
|
||||
"errors": {
|
||||
"type": "radio",
|
||||
"pretty": "Enable Error Logging",
|
||||
"default": true,
|
||||
"value": true
|
||||
},
|
||||
"logins": {
|
||||
"type": "radio",
|
||||
"pretty": "Enable Login Logging",
|
||||
"default": true,
|
||||
"value": true
|
||||
}
|
||||
},
|
||||
"bugReports": {
|
||||
"enabled": {
|
||||
"type": "radio",
|
||||
"pretty": "Enable Bug reporting.",
|
||||
"default": true,
|
||||
"value": true
|
||||
},
|
||||
"sendEmail": {
|
||||
"type": "radio",
|
||||
"pretty": "Email the user after submiting.",
|
||||
"default": true,
|
||||
"value": true
|
||||
},
|
||||
"emailTemplate": {
|
||||
"type": "text",
|
||||
"pretty": "Email Template",
|
||||
"default": "BugReportEmail",
|
||||
"value": "BugReportEmail"
|
||||
}
|
||||
},
|
||||
"feedback": {
|
||||
"enabled": {
|
||||
"type": "radio",
|
||||
"pretty": "Enable User Feedback.",
|
||||
"default": true,
|
||||
"value": true
|
||||
},
|
||||
"sendEmail": {
|
||||
"type": "radio",
|
||||
"pretty": "Email the user after submiting.",
|
||||
"default": false,
|
||||
"value": false
|
||||
},
|
||||
"emailTemplate": {
|
||||
"type": "text",
|
||||
"pretty": "Email Template",
|
||||
"default": "feedbackEmail",
|
||||
"value": "feedbackEmail"
|
||||
}
|
||||
}
|
||||
}
|
162
app/resources/config/install.example.json
Normal file
162
app/resources/config/install.example.json
Normal file
@ -0,0 +1,162 @@
|
||||
{
|
||||
"installHash": "014c857a650bcb0e4b08b14e1924287c",
|
||||
"installStep": "complete",
|
||||
"modules": {
|
||||
"Group": {
|
||||
"name": "Group",
|
||||
"installDate": 1670000000,
|
||||
"lastUpdate": 1670000000,
|
||||
"installStatus": "Installed",
|
||||
"installedVersion": "3.0",
|
||||
"folder": "/var/www/app/models/",
|
||||
"installTable": "Success",
|
||||
"installPermissions": "Success",
|
||||
"installConfigs": "Success",
|
||||
"installResources": "Success",
|
||||
"installPreferences": "Not Required",
|
||||
"installedResources": ["1", "2", "3", "4", "5", "6"]
|
||||
},
|
||||
"Log": {
|
||||
"name": "Log",
|
||||
"installDate": 1670000000,
|
||||
"lastUpdate": 1670000000,
|
||||
"installStatus": "Installed",
|
||||
"installedVersion": "3.0",
|
||||
"folder": "/var/www/app/models/",
|
||||
"installTable": "Success",
|
||||
"installPermissions": "Not Required",
|
||||
"installConfigs": "Success",
|
||||
"installResources": "Not Required",
|
||||
"installPreferences": "Not Required"
|
||||
},
|
||||
"Message": {
|
||||
"name": "Message",
|
||||
"installDate": 1670000000,
|
||||
"lastUpdate": 1670000000,
|
||||
"installStatus": "Installed",
|
||||
"installedVersion": "3.0",
|
||||
"folder": "/var/www/app/models/",
|
||||
"installTable": "Success",
|
||||
"installPermissions": "Success",
|
||||
"installConfigs": "Not Required",
|
||||
"installResources": "Not Required",
|
||||
"installPreferences": "Not Required"
|
||||
},
|
||||
"Routes": {
|
||||
"name": "Routes",
|
||||
"installDate": 1670000000,
|
||||
"lastUpdate": 1670000000,
|
||||
"installStatus": "Installed",
|
||||
"installedVersion": "3.0",
|
||||
"folder": "/var/www/app/models/",
|
||||
"installTable": "Success",
|
||||
"installPermissions": "Success",
|
||||
"installConfigs": "Not Required",
|
||||
"installResources": "Success",
|
||||
"installPreferences": "Not Required",
|
||||
"installedResources": ["1", "2", "3", "4", "5"]
|
||||
},
|
||||
"Sessions": {
|
||||
"name": "Sessions",
|
||||
"installDate": 1670000000,
|
||||
"lastUpdate": 1670000000,
|
||||
"installStatus": "Installed",
|
||||
"installedVersion": "3.0",
|
||||
"folder": "/var/www/app/models/",
|
||||
"installTable": "Success",
|
||||
"installPermissions": "Not Required",
|
||||
"installConfigs": "Not Required",
|
||||
"installResources": "Not Required",
|
||||
"installPreferences": "Not Required"
|
||||
},
|
||||
"User": {
|
||||
"name": "User",
|
||||
"installDate": 1670000000,
|
||||
"lastUpdate": 1670000000,
|
||||
"installStatus": "Installed",
|
||||
"installedVersion": "3.0",
|
||||
"folder": "/var/www/app/models/",
|
||||
"installTable": "Success",
|
||||
"installPermissions": "Success",
|
||||
"installConfigs": "Not Required",
|
||||
"installResources": "Not Required",
|
||||
"installPreferences": "Success"
|
||||
},
|
||||
"Blog": {
|
||||
"name": "Blog",
|
||||
"enabled": true,
|
||||
"enabled_txt": "yes",
|
||||
"installDate": 1670000000,
|
||||
"lastUpdate": 1670000000,
|
||||
"installStatus": "Installed",
|
||||
"installedVersion": "3.0",
|
||||
"folder": "/var/www/app/plugins/",
|
||||
"installTable": "Success",
|
||||
"installPermissions": "Not Required",
|
||||
"installConfigs": "Not Required",
|
||||
"installResources": "Success",
|
||||
"installPreferences": "Not Required",
|
||||
"installedResources": ["1"]
|
||||
},
|
||||
"Bugreport": {
|
||||
"name": "Bugreport",
|
||||
"enabled": true,
|
||||
"enabled_txt": "yes",
|
||||
"installDate": 1670000000,
|
||||
"lastUpdate": 1670000000,
|
||||
"installStatus": "Installed",
|
||||
"installedVersion": "3.0",
|
||||
"folder": "/var/www/app/plugins/",
|
||||
"installTable": "Success",
|
||||
"installPermissions": "Success",
|
||||
"installConfigs": "Success",
|
||||
"installResources": "Not Required",
|
||||
"installPreferences": "Not Required"
|
||||
},
|
||||
"Comments": {
|
||||
"name": "Comments",
|
||||
"enabled": true,
|
||||
"enabled_txt": "yes",
|
||||
"installDate": 1670000000,
|
||||
"lastUpdate": 1670000000,
|
||||
"installStatus": "Installed",
|
||||
"installedVersion": "3.0",
|
||||
"folder": "/var/www/app/plugins/",
|
||||
"installTable": "Success",
|
||||
"installPermissions": "Not Required",
|
||||
"installConfigs": "Not Required",
|
||||
"installResources": "Not Required",
|
||||
"installPreferences": "Not Required"
|
||||
},
|
||||
"Feedback": {
|
||||
"name": "Feedback",
|
||||
"enabled": true,
|
||||
"enabled_txt": "yes",
|
||||
"installDate": 1670000000,
|
||||
"lastUpdate": 1670000000,
|
||||
"installStatus": "Installed",
|
||||
"installedVersion": "3.0",
|
||||
"folder": "/var/www/app/plugins/",
|
||||
"installTable": "Success",
|
||||
"installPermissions": "Success",
|
||||
"installConfigs": "Success",
|
||||
"installResources": "Not Required",
|
||||
"installPreferences": "Not Required"
|
||||
},
|
||||
"Subscribe": {
|
||||
"name": "Subscribe",
|
||||
"enabled": true,
|
||||
"enabled_txt": "yes",
|
||||
"installDate": 1670000000,
|
||||
"lastUpdate": 1670000000,
|
||||
"installStatus": "Installed",
|
||||
"installedVersion": "3.0",
|
||||
"folder": "/var/www/app/plugins/",
|
||||
"installTable": "Success",
|
||||
"installPermissions": "Not Required",
|
||||
"installConfigs": "Not Required",
|
||||
"installResources": "Not Required",
|
||||
"installPreferences": "Not Required"
|
||||
}
|
||||
}
|
||||
}
|
34
app/resources/config/permissions.example.json
Normal file
34
app/resources/config/permissions.example.json
Normal file
@ -0,0 +1,34 @@
|
||||
{
|
||||
"adminAccess": {
|
||||
"pretty": "Access Administrator Areas",
|
||||
"default": false
|
||||
},
|
||||
"modAccess": {
|
||||
"pretty": "Access Moderator Areas",
|
||||
"default": false
|
||||
},
|
||||
"memberAccess": {
|
||||
"pretty": "Access Member Areas",
|
||||
"default": false
|
||||
},
|
||||
"sendMessages": {
|
||||
"pretty": "Send messages to other users",
|
||||
"default": false
|
||||
},
|
||||
"addRoute": {
|
||||
"pretty": "Add Custom Routes",
|
||||
"default": false
|
||||
},
|
||||
"uploadImages": {
|
||||
"pretty": "Upload images (such as avatars)",
|
||||
"default": false
|
||||
},
|
||||
"bugReport": {
|
||||
"pretty": "Can Submit Bug Reports",
|
||||
"default": false
|
||||
},
|
||||
"feedback": {
|
||||
"pretty": "Can Submit Feedback",
|
||||
"default": false
|
||||
}
|
||||
}
|
78
app/resources/config/prefrences.example.json
Normal file
78
app/resources/config/prefrences.example.json
Normal file
@ -0,0 +1,78 @@
|
||||
{
|
||||
"gender": {
|
||||
"pretty": "Gender",
|
||||
"type": "select",
|
||||
"default": "unspecified",
|
||||
"options": ["male", "female", "other", "unspecified"],
|
||||
"avatar": "/var/www/apache/images/defaultAvatar.png"
|
||||
},
|
||||
"email": {
|
||||
"pretty": "IDK what this is for",
|
||||
"type": "checkbox",
|
||||
"default": "true",
|
||||
"avatar": "/var/www/apache/images/defaultAvatar.png",
|
||||
"options": null
|
||||
},
|
||||
"newsletter": {
|
||||
"pretty": "Receive our Newsletter?",
|
||||
"type": "checkbox",
|
||||
"default": "true",
|
||||
"avatar": "/var/www/apache/images/defaultAvatar.png",
|
||||
"options": null
|
||||
},
|
||||
"avatar": {
|
||||
"pretty": "Avatar",
|
||||
"type": "file",
|
||||
"default": "images/defaultAvatar.png",
|
||||
"avatar": "/var/www/apache/images/defaultAvatar.png",
|
||||
"options": null
|
||||
},
|
||||
"timezone": {
|
||||
"pretty": "Timezone",
|
||||
"type": "timezone",
|
||||
"default": "America/New_York",
|
||||
"avatar": "/var/www/apache/images/defaultAvatar.png",
|
||||
"options": null
|
||||
},
|
||||
"dateFormat": {
|
||||
"pretty": "Date Format",
|
||||
"type": "select",
|
||||
"default": "F j, Y",
|
||||
"options": {
|
||||
"1-8-1991": "n-j-Y",
|
||||
"8-1-1991": "j-n-Y",
|
||||
"01-08-1991": "m-d-Y",
|
||||
"08-01-1991": "d-m-Y",
|
||||
"January 8, 1991": "F-j-Y",
|
||||
"8 January, 1991": "j-F-Y",
|
||||
"January 08, 1991": "F-d-Y",
|
||||
"08 January, 1991": "d-F-Y",
|
||||
"Jan 8, 1991": "M-j-Y",
|
||||
"8 Jan 1991": "j-M-Y",
|
||||
"Jan 08, 1991": "M-d-Y",
|
||||
"08 Jan 1991": "d-M-Y"
|
||||
},
|
||||
"avatar": "/var/www/apache/images/defaultAvatar.png"
|
||||
},
|
||||
"timeFormat": {
|
||||
"pretty": "Time Format",
|
||||
"type": "select",
|
||||
"default": "g:i:s A",
|
||||
"options": {
|
||||
"3:33:33 AM": "g:i:s A",
|
||||
"03:33:33 AM": "h:i:s A",
|
||||
"3:33:33 am": "g:i:s a",
|
||||
"03:33:33 am": "h:i:s a",
|
||||
"3:33:33 (military)": "G:i:s",
|
||||
"03:33:33 (military)": "H:i:s"
|
||||
},
|
||||
"avatar": "/var/www/apache/images/defaultAvatar.png"
|
||||
},
|
||||
"pageLimit": {
|
||||
"pretty": "Items Displayed Per Page",
|
||||
"type": "select",
|
||||
"default": "10",
|
||||
"options": ["10", "15", "20", "25", "50"],
|
||||
"avatar": "/var/www/apache/images/defaultAvatar.png"
|
||||
}
|
||||
}
|
54
app/resources/controllers/example.php
Normal file
54
app/resources/controllers/example.php
Normal file
@ -0,0 +1,54 @@
|
||||
<?php
|
||||
/**
|
||||
* app/resources/controllers/example.php
|
||||
*
|
||||
* This is an example controller layout.
|
||||
*
|
||||
* @version 3.0
|
||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||
* @link https://TheTempusProject.com
|
||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||
*/
|
||||
namespace TheTempusProject\Controllers;
|
||||
|
||||
use TheTempusProject\Classes\Controller;
|
||||
use TheTempusProject\Houdini\Classes\Template;
|
||||
use TheTempusProject\Houdini\Classes\Views;
|
||||
use TheTempusProject\Canary\Canary as Debug;
|
||||
|
||||
// The new controller must extend the default controller class or some functionality will be lost.
|
||||
class Example extends Controller {
|
||||
/**
|
||||
* A constructor does not have to be defined.
|
||||
* If a constructor is used, it must call the parent constructor first.
|
||||
*/
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
Template::noFollow();
|
||||
Template::noIndex();
|
||||
Template::setTemplate( 'example' );
|
||||
}
|
||||
|
||||
/**
|
||||
* A destructor does not have to be defined.
|
||||
* If a destructor is used, it must call the parent destructor last.
|
||||
*/
|
||||
public function __destruct() {
|
||||
Debug::log( 'Something to log before the app ends execution.' );
|
||||
parent::__destruct();
|
||||
}
|
||||
|
||||
public function index() {
|
||||
self::$title = 'Example Controller';
|
||||
Issues::add( 'error', [ 'This is an error with multiple parts.' => [ 'Error 1', 'Error 2' ] ] );
|
||||
Issues::add( 'error', 'This is a single error.' );
|
||||
Issues::add( 'success', [ 'This is a success with multiple parts.' => [ 'Success 1', 'Success 2' ] ] );
|
||||
Issues::add( 'success', 'This is a single success.' );
|
||||
Issues::add( 'notice', 'This is a single notice.' );
|
||||
Issues::add( 'info', 'This is a single info.' );
|
||||
Components::set( 'simple', Views::simpleView( 'simple' ) );
|
||||
Components::set( 'complex', Views::simpleView( 'complex' ) );
|
||||
Views::view( 'example' );
|
||||
$example = Views::simpleView( 'example' );
|
||||
}
|
||||
}
|
44
app/resources/nginx-main.conf
Normal file
44
app/resources/nginx-main.conf
Normal file
@ -0,0 +1,44 @@
|
||||
server {
|
||||
listen 8080 default_server;
|
||||
listen [::]:8080 default_server;
|
||||
listen 8081 ssl default_server;
|
||||
listen [::]:8081 ssl default_server;
|
||||
|
||||
ssl_prefer_server_ciphers on;
|
||||
|
||||
include snippets/common.conf;
|
||||
|
||||
access_log /var/log/nginx/access.log;
|
||||
error_log /var/log/nginx/error.log;
|
||||
|
||||
location ~* \.(?:js|css|png|jpg|gif|ico)$ {
|
||||
access_log off;
|
||||
log_not_found off;
|
||||
}
|
||||
|
||||
location /js/ {
|
||||
access_log off;
|
||||
log_not_found off;
|
||||
try_files $uri /index.php?error=js404&file=$uri;
|
||||
}
|
||||
|
||||
location /css/ {
|
||||
access_log off;
|
||||
log_not_found off;
|
||||
try_files $uri /index.php?error=css404&file=$uri;
|
||||
}
|
||||
|
||||
location / {
|
||||
if (!-e $request_filename){
|
||||
rewrite ^/images/(.*)$ /index.php?error=image404&url=$1 break;
|
||||
rewrite ^/uploads/(.*)$ /index.php?error=upload404&url=$1 break;
|
||||
}
|
||||
rewrite ^/errors/(.*)$ /index.php?error=$1 break;
|
||||
rewrite ^/(.+)$ /index.php?url=$1&$args;
|
||||
}
|
||||
|
||||
location ~ \.php$ {
|
||||
fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;
|
||||
include snippets/fastcgi-php.conf;
|
||||
}
|
||||
}
|
20
app/resources/nodels/example.php
Normal file
20
app/resources/nodels/example.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
/**
|
||||
* app/resources/models/example.php
|
||||
*
|
||||
* This is an example model.
|
||||
*
|
||||
* @version 3.0
|
||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||
* @link https://TheTempusProject.com
|
||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||
*/
|
||||
namespace TheTempusProject\Models;
|
||||
|
||||
use TheTempusProject\Bedrock\Classes\Model;
|
||||
|
||||
class Example extends Model {
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
}
|
||||
}
|
96
app/resources/plugin.php
Normal file
96
app/resources/plugin.php
Normal file
@ -0,0 +1,96 @@
|
||||
<?php
|
||||
/**
|
||||
* app/plugins/XXXXXXXXXX/plugin.php
|
||||
*
|
||||
* This houses all of the main plugin info and functionality.
|
||||
*
|
||||
* @package TP XXXXXXXXXX
|
||||
* @version 3.0
|
||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||
* @link https://TheTempusProject.com
|
||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||
*/
|
||||
namespace TheTempusProject\Plugins;
|
||||
|
||||
use ReflectionClass;
|
||||
use TheTempusProject\Classes\Installer;
|
||||
use TheTempusProject\Houdini\Navigation;
|
||||
use TheTempusProject\Models\forealthough as forealthoughModel;
|
||||
use TheTempusProject\TheTempusProject as App;
|
||||
|
||||
class notrealplugin extends forealthoughModel {
|
||||
public static $initialized;
|
||||
public $pluginName = 'TP XXXXXXXXXX';
|
||||
public $pluginAuthor = 'JoeyK';
|
||||
public $pluginWebsite = 'https://TheTempusProject.com';
|
||||
public $modelVersion = '1.0';
|
||||
public $pluginVersion = '1.0';
|
||||
public $pluginDescription = 'A simple plugin which adds a site wide XXXXXXXXXX system.';
|
||||
public $configName = 'XXXXXXXXXX';
|
||||
public $databaseMatrix = [
|
||||
[ 'title', 'varchar', '86' ],
|
||||
[ 'suggestion', 'text', '' ],
|
||||
[ 'suggestedOn', 'int', '10' ],
|
||||
[ 'approved', 'varchar', '5' ],
|
||||
[ 'approvedOn', 'int', '10' ],
|
||||
[ 'approvedBy', 'int', '11' ],
|
||||
[ 'author', 'int', '11' ],
|
||||
];
|
||||
public $configMatrix = [
|
||||
'enabled' => [
|
||||
'type' => 'radio',
|
||||
'pretty' => 'Enable XXXXXXXXXX.',
|
||||
'default' => true,
|
||||
],
|
||||
];
|
||||
public $permissionMatrix = [
|
||||
'XXXXXXXXXX' => [
|
||||
'pretty' => 'Can create XXXXXXXXXX',
|
||||
'default' => false,
|
||||
],
|
||||
];
|
||||
public $admin_links = [
|
||||
[
|
||||
'text' => '<i class="fa fa-fw fa-copy"></i> Suggestions',
|
||||
'url' => '{ROOT_URL}admin/suggestions',
|
||||
],
|
||||
];
|
||||
public $main_links = [
|
||||
[
|
||||
'text' => 'Suggestions',
|
||||
'url' => '{ROOT_URL}suggestions/index',
|
||||
],
|
||||
];
|
||||
public $resourceMatrix = [
|
||||
[
|
||||
'title' => 'Welcome',
|
||||
'content' => '<p>This is just a simple message to say thank you for installing The Tempus Project. If you have any questions you can find everything through our website <a href="https://TheTempusProject.com">here</a>.</p>',
|
||||
'author' => 1,
|
||||
'created{time}' => 0,
|
||||
'edited{time}' => 0,
|
||||
'draft' => 0,
|
||||
],
|
||||
];
|
||||
public $footer_links = [
|
||||
[
|
||||
'text' => 'Bug Report',
|
||||
'url' => '{ROOT_URL}bugreport',
|
||||
],
|
||||
];
|
||||
public function __construct() {
|
||||
$reflect = new ReflectionClass( $this );
|
||||
if ( true === self::$initialized || !Installer::pluginEnabled( $reflect->getShortName() ) ) {
|
||||
return;
|
||||
}
|
||||
foreach ( $this->footer_links as $key => $link ) {
|
||||
Navigation::addLink( App::FOOTER_MENU_NAME, $link );
|
||||
}
|
||||
foreach ( $this->main_links as $key => $link ) {
|
||||
Navigation::addLink( App::MAIN_MENU_NAME, $link );
|
||||
}
|
||||
foreach ( $this->admin_links as $key => $link ) {
|
||||
Navigation::addLink( App::ADMIN_MENU_NAME, $link );
|
||||
}
|
||||
self::$initialized = true;
|
||||
}
|
||||
}
|
82
app/resources/templates/example.tpl
Normal file
82
app/resources/templates/example.tpl
Normal file
@ -0,0 +1,82 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<!--
|
||||
* app/resources/templates/example.tpl
|
||||
*
|
||||
* @version 3.0
|
||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||
* @link https://TheTempusProject.com
|
||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||
-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title>{TITLE}</title>
|
||||
<meta name="description" content="{PAGE_DESCRIPTION}">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="author" content="The Tempus Project">
|
||||
{ROBOT}
|
||||
<link rel="alternate" hreflang="en-us" href="alternateURL">
|
||||
<link rel="icon" href="{BASE}images/favicon.ico">
|
||||
<!-- Required CSS -->
|
||||
<link rel="stylesheet" href="{BASE}vendor/twbs/bootstrap/dist/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="{BASE}vendor/fortawesome/font-awesome/css/font-awesome.min.css">
|
||||
<!-- Custom styles for this template -->
|
||||
<link rel="stylesheet" href="{BASE}Templates/default/default.css">
|
||||
<!-- Required JS -->
|
||||
<script language="JavaScript" type="text/javascript" src="{BASE}JS/default.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
|
||||
<!--Brand and toggle should get grouped for better mobile display
|
||||
but I had to account for additional menus-->
|
||||
<div class="navbar-header">
|
||||
<a href="{BASE}" class="navbar-brand">{SITENAME}</a>
|
||||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse" style="">
|
||||
<span class="sr-only">Toggle navigation</span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="container-fluid">
|
||||
<div class="collapse navbar-collapse navbar-ex1-collapse">
|
||||
{topNavLeft}
|
||||
<div class="navbar-right">
|
||||
<ul class="nav navbar-nav">
|
||||
{topNavRight}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div class="container-fluid">
|
||||
<div class="foot-pad">
|
||||
{ISSUES}
|
||||
<div class="row">
|
||||
<div class="container">
|
||||
{ERROR}
|
||||
{NOTICE}
|
||||
{SUCCESS}
|
||||
{INFO}
|
||||
</div>
|
||||
</div>
|
||||
{/ISSUES}
|
||||
<div class="row">
|
||||
<div class="container">
|
||||
{CONTENT}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<footer>
|
||||
{FOOT}
|
||||
{COPY}
|
||||
</footer>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Bootstrap core JavaScript and jquery -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
|
||||
<script src="{BASE}vendor/twbs/bootstrap/dist/js/bootstrap.min.js"></script>
|
||||
</body>
|
||||
</html>
|
34
app/resources/templates/exanple.inc.php
Normal file
34
app/resources/templates/exanple.inc.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/**
|
||||
* app/resources/templates/example.inc.php
|
||||
*
|
||||
* This is an example loader for the example template.
|
||||
*
|
||||
* @version 3.0
|
||||
* @author Joey Kimsey <Joey@thetempusproject.com>
|
||||
* @link https://TheTempusProject.com
|
||||
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
|
||||
*/
|
||||
namespace TheTempusProject\Templates;
|
||||
|
||||
use TheTempusProject\Houdini\Classes\Views;
|
||||
use TheTempusProject\Houdini\Classes\Navigation;
|
||||
use TheTempusProject\Houdini\Classes\Components;
|
||||
use TheTempusProject\Bedrock\Classes\Config;
|
||||
use TheTempusProject\TheTempusProject as App;
|
||||
|
||||
class ExampleLoader {
|
||||
public function __construct() {
|
||||
Components::set( 'TEMPLATE_URL', Template::parse( '{ROOT_URL}app/templates/default/' ) );
|
||||
Components::set( 'LOGO', Config::get( 'main/logo' ) );
|
||||
Components::set( 'FOOT', Views::simpleView( 'foot' ) );
|
||||
Components::set( 'COPY', Views::simpleView( 'copy' ) );
|
||||
if ( App::$isLoggedIn ) {
|
||||
Components::set( 'STATUS', Views::simpleView( 'nav.statusLoggedIn' ) );
|
||||
Components::set( 'USERNAME', App::$activeUser->username );
|
||||
} else {
|
||||
Components::set( 'STATUS', Views::simpleView( 'nav.statusLoggedOut' ) );
|
||||
}
|
||||
Components::set( 'topNavLeft', Navigation::activePageSelect( 'nav.main' ) );
|
||||
}
|
||||
}
|
3
app/resources/views/complex.html
Normal file
3
app/resources/views/complex.html
Normal file
@ -0,0 +1,3 @@
|
||||
<p>This is a more complex component that includes another component...</p>
|
||||
{simple}
|
||||
<p>...right in the middle!</p>
|
141
app/resources/views/example.html
Normal file
141
app/resources/views/example.html
Normal file
@ -0,0 +1,141 @@
|
||||
|
||||
<p>It is comprised entirely of free form HTML</p>
|
||||
<p>If you are feeling extra bold you can use the templating engine to set variables to be replaced at runtime such as {variable} or even {variable2}, or maybe even just look through some data:</p>
|
||||
{loop}
|
||||
{value1} is the first value.<br />
|
||||
{value2} is the second value.<br />
|
||||
{value3} is the third value.<br />
|
||||
{/loop}
|
||||
{ALT}No Loop{/ALT}
|
||||
{footer}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h1>This is a default view </h1>
|
||||
|
||||
<p>The Tempus-Project template-processor works with the backend to render html for the end user. This process has several steps and components that can get pretty complex. For the moment let's just review a few that can be used to generate web pages. </p>
|
||||
|
||||
<h2>Views</h2>
|
||||
<p>Views are the most basic interaction between the front-end and back-end. Inside of a controler, you can call a view in two ways:</p>
|
||||
<h3>1. Normal - Views::view</h3>
|
||||
<pre></pre>
|
||||
<h3>2. Inline - Views::simpleView</h3>
|
||||
<pre></pre>
|
||||
|
||||
|
||||
<h2>Components</h2>
|
||||
<p>You can think of components as a sort of front-end variable that can be filled in by the back-end before being send to the end-user. You can include components in all template parsing with a simple command:</p>
|
||||
<pre></pre>
|
||||
Adding this to a controler will give access to that component's value in the rendering engine. For example:
|
||||
<pre></pre>
|
||||
|
||||
<h2>Pagination</h2>
|
||||
PAGINATION
|
||||
if (Pagination::totalPages() <= 1) {
|
||||
Components::set('PAGINATION', '<lb>');
|
||||
} else {
|
||||
Components::set('PAGINATION', Views::simpleView('nav.pagination', $pageData));
|
||||
}
|
||||
|
||||
|
||||
|
||||
<h2>Navigation</h2>
|
||||
|
||||
<h2>Filters</h2>
|
||||
<p>In some cases, you may want to hide or show text on a page conditionally. For example, you may have administrator controls on a commonly used page. Obviously you would like to hide those controls from regular users; even if you have safeguards to prevent them from performing any restricted actions.</p>
|
||||
<p>This is where filters come in. They do exactly that, conditionally hide or show part of a page based on back-end logic. The admin example is so common, its already built in. If a user has the isAdmin permission on thier group, they will be able to see anything within the "ADMIN" tag:</p>
|
||||
<pre>
|
||||
Filters::add('member', '#{MEMBER}(.*?){/MEMBER}#is', (self::$isMember ? '$1' : ''), true);
|
||||
Filters::add('mod', '#{MOD}(.*?){/MOD}#is', (self::$isMod ? '$1' : ''), true);
|
||||
Filters::add('admin', '#{ADMIN}(.*?){/ADMIN}#is', (self::$isAdmin ? '$1' : ''), true);
|
||||
</pre>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
'#\[b\](.*?)\[/b\]#is' => '<b>$1</b>',
|
||||
'#\[p\](.*?)\[/p\]#is' => '<p>$1</p>',
|
||||
'#\[i\](.*?)\[/i\]#is' => '<i>$1</i>',
|
||||
'#\[u\](.*?)\[/u\]#is' => '<u>$1</u>',
|
||||
'#\[s\](.*?)\[/s\]#is' => '<del>$1</del>',
|
||||
'#\[code\](.*?)\[/code\]#is' => '<code>$1</code>',
|
||||
'#\[color=(.*?)\](.*?)\[/color\]#is' => "<font color='$1'>$2</font>",
|
||||
'#\[img\](.*?)\[/img\]#is' => "<img src='$1'>",
|
||||
'#\[url=(.*?)\](.*?)\[/url\]#is' => "<a href='$1'>$2</a>",
|
||||
'#\[quote=(.*?)\](.*?)\[/quote\]#is' => "<blockquote cite='$1'>$2</blockquote>",
|
||||
'#\(c\)#is' => '✔',
|
||||
'#\(x\)#is' => '✖',
|
||||
'#\(!\)#is' => '❕',
|
||||
'#\(\?\)#is' => '❔',
|
||||
'#\[list\](.*?)\[/list\]#is' => '<ul>$1</ul>',
|
||||
'#\(\.\)(.*)$#m' => '<li>$1</li>',
|
||||
'/(^|\s)@(\w*[a-zA-Z_]+\w*)/' => ' <a href="http://twitter.com/search?q=%40\2">@\2</a>',
|
||||
'/(^|\s)#(\w*[a-zA-Z_]+\w*)/' => ' <a href="http://twitter.com/search?q=%23\2">#\2</a>',
|
||||
'#/\*.*?\*/#s' => null,
|
||||
'#(?<!:)//.*#' => null,
|
||||
"#{CHECKED:(.*?)=(.*?)}#s" => null,
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h2>Issues</h2>
|
||||
<p>One of the pre-existing filters happens to be Issues. In the controller for this file, you should see a block that includes several examples of Issues. These issues are automatically added as individual components and hidden with the issues filter.<p>
|
||||
<pre>
|
||||
Issues::add( 'error', [ 'This is an error with multiple parts.' => [ 'Error 1', 'Error 2' ] ] );
|
||||
Issues::add( 'error', 'This is a single error.' );
|
||||
Issues::add( 'success', [ 'This is a success with multiple parts.' => [ 'Success 1', 'Success 2' ] ] );
|
||||
Issues::add( 'success', 'This is a single success.' );
|
||||
Issues::add( 'notice', 'This is a single notice.' );
|
||||
Issues::add( 'info', 'This is a single info.' );
|
||||
Filters::add('issues', '#{ISSUES}(.*?){/ISSUES}#is', (Issues::hasIssues() ? '$1' : ''), true);
|
||||
Components::set( 'NOTICE', $test );
|
||||
Components::set( 'SUCCESS', $test );
|
||||
Components::set( 'ERROR', $test );
|
||||
Components::set( 'INFO', $test );
|
||||
</pre>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h2>Forms</h2>
|
||||
select Radio
|
||||
$selected = 'CHECKED:' . $fieldName . '=' . $value;
|
||||
Components::set($selected, 'checked="checked"');
|
||||
select Option
|
||||
$find = "#\<option (.*?)value=\'" . $value . "\'#s";
|
||||
$replace = "<option $1value='" . $value . "' selected";
|
||||
self::$options[$find] = $replace;
|
1
app/resources/views/simple.html
Normal file
1
app/resources/views/simple.html
Normal file
@ -0,0 +1 @@
|
||||
<p>This is a simple component.</p>
|
Reference in New Issue
Block a user