Compare commits
17 Commits
Author | SHA1 | Date | |
---|---|---|---|
d9e61d3f8f | |||
8e377d0882 | |||
ea7ea1286c | |||
1d71b4fd13 | |||
de930d00c9 | |||
4d2ccfb1c5 | |||
eb0644feb5 | |||
9eca4c9e6a | |||
bb30be33b2 | |||
168a9ee805 | |||
42dbedf9ee | |||
65d61db539 | |||
cbaba96d5e | |||
34babdb2dc | |||
3de98733ac | |||
008d7d9023 | |||
f1703a1c7e |
64
.gitignore
vendored
Normal file
64
.gitignore
vendored
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
# Windows image file caches
|
||||||
|
Thumbs.db
|
||||||
|
ehthumbs.db
|
||||||
|
|
||||||
|
# Folder config file
|
||||||
|
Desktop.ini
|
||||||
|
|
||||||
|
# Recycle Bin used on file shares
|
||||||
|
$RECYCLE.BIN/
|
||||||
|
|
||||||
|
# Windows Installer files
|
||||||
|
*.cab
|
||||||
|
*.msi
|
||||||
|
*.msm
|
||||||
|
*.msp
|
||||||
|
|
||||||
|
# Windows shortcuts
|
||||||
|
*.lnk
|
||||||
|
|
||||||
|
# OSX
|
||||||
|
.DS_Store
|
||||||
|
.AppleDouble
|
||||||
|
.LSOverride
|
||||||
|
|
||||||
|
# Thumbnails
|
||||||
|
._*
|
||||||
|
|
||||||
|
# Files that might appear in the root of a volume
|
||||||
|
.DocumentRevisions-V100
|
||||||
|
.fseventsd
|
||||||
|
.Spotlight-V100
|
||||||
|
.TemporaryItems
|
||||||
|
.Trashes
|
||||||
|
.VolumeIcon.icns
|
||||||
|
|
||||||
|
# Directories potentially created on remote AFP share
|
||||||
|
.AppleDB
|
||||||
|
.AppleDesktop
|
||||||
|
Network Trash Folder
|
||||||
|
Temporary Items
|
||||||
|
.apdisk
|
||||||
|
|
||||||
|
# keep specific directories
|
||||||
|
!uploads/images/.gitignore
|
||||||
|
!bin/cli/.gitignore
|
||||||
|
|
||||||
|
# keep main directories
|
||||||
|
!css/.gitignore
|
||||||
|
!vendor/.gitignore
|
||||||
|
|
||||||
|
# SublimeText
|
||||||
|
*.sublime-project
|
||||||
|
*.sublime-workspace
|
||||||
|
|
||||||
|
# TheTempusProject Specific
|
||||||
|
.htaccess
|
||||||
|
app/config/*
|
||||||
|
!app/config/constants.php
|
||||||
|
uploads/images/*
|
||||||
|
logs/*
|
||||||
|
.vscode/
|
||||||
|
mail.log
|
||||||
|
vendor/canary/logs/*
|
||||||
|
docker/.env
|
49
.gitlab-ci.yml
Normal file
49
.gitlab-ci.yml
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
stages:
|
||||||
|
- update
|
||||||
|
|
||||||
|
variables:
|
||||||
|
TIMEZONE: "America/New_York" # For the system in general
|
||||||
|
DATE_TIMEZONE: ${TIMEZONE} # For PHP
|
||||||
|
|
||||||
|
GIT_DEPTH: 1
|
||||||
|
GITLAB_API_URL: ${CI_API_V4_URL}
|
||||||
|
TARGET_BRANCH: ${CI_COMMIT_REF_NAME} # This is the branch chosen in the `Pipeline Schedule`
|
||||||
|
TARGET_REMOTE: "https://${GITLAB_USERNAME}:${GITLAB_ACCESS_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME}.git"
|
||||||
|
|
||||||
|
# These could/should be overridden in an extending job:
|
||||||
|
UPDATE_BRANCH_PREFIX: "update_PHP_deps_" # Used for the update branch name, it will be followed by the datetime
|
||||||
|
GIT_USER: "DependBot" # Used for the update commit
|
||||||
|
GIT_EMAIL: "webmaster@thetempusproject.com" # Used for the update commit
|
||||||
|
GITLAB_USERNAME: "root" # Used for pushing the new branch and opening the MR
|
||||||
|
GITLAB_ACCESS_TOKEN: "glpat-PKEmivGtBfbz4DVPdhzk" # Used for pushing the new branch and opening the MR
|
||||||
|
MERGE_IF_SUCCESSFUL: "true" # Set to true, to merge automatically if the pipeline succeeds
|
||||||
|
SECONDS_BETWEEN_POOLING: 10 # Nbr of seconds between checking if the MR pipeline is successful, so then it will merge
|
||||||
|
JOB_GIT_FLAGS: ""
|
||||||
|
JOB_CURL_FLAGS: ""
|
||||||
|
JOB_COMPOSER_FLAGS: ""
|
||||||
|
|
||||||
|
composer_update:
|
||||||
|
stage: update
|
||||||
|
rules:
|
||||||
|
- if: '$CI_COMMIT_BRANCH == "main"'
|
||||||
|
image: composer:latest
|
||||||
|
interruptible: true # allows to stop the job if a newer pipeline starts, saving resources and allowing new jobs to start because job concurrency is limited
|
||||||
|
script:
|
||||||
|
- git ${JOB_GIT_FLAGS} fetch origin ${TARGET_BRANCH}
|
||||||
|
- git ${JOB_GIT_FLAGS} checkout ${TARGET_BRANCH}
|
||||||
|
- git reset --hard origin/main
|
||||||
|
- export DATE_TIME="$(date '+%Y%m%d%H%M%S')"
|
||||||
|
- export MR_BRANCH="${UPDATE_BRANCH_PREFIX}${DATE_TIME}"
|
||||||
|
- git ${JOB_GIT_FLAGS} checkout -b "${MR_BRANCH}"
|
||||||
|
- composer update ${JOB_COMPOSER_FLAGS}
|
||||||
|
- if [ "$(git diff)" == "" ]; then echo "No updates needed!"; exit 0; fi
|
||||||
|
- export TITLE="Update PHP dependencies [${DATE_TIME}]"
|
||||||
|
- git ${JOB_GIT_FLAGS} commit -a -m "${TITLE}"
|
||||||
|
- git ${JOB_GIT_FLAGS} push "${TARGET_REMOTE}" "${MR_BRANCH}"
|
||||||
|
artifacts:
|
||||||
|
paths:
|
||||||
|
- vendor/
|
||||||
|
cache:
|
||||||
|
key: ${CI_COMMIT_REF_SLUG}
|
||||||
|
paths:
|
||||||
|
- vendor/
|
@ -36,6 +36,16 @@ class Components {
|
|||||||
self::$components[ $name ] = $value;
|
self::$components[ $name ] = $value;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
public static function setIfNull( $name, $value = '' ) {
|
||||||
|
if ( ! empty( self::$components[ $name ] ) ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ( null == $value ) {
|
||||||
|
$value = '';
|
||||||
|
}
|
||||||
|
self::$components[ $name ] = $value;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
public static function unset( $name ) {
|
public static function unset( $name ) {
|
||||||
if ( isset( self::$components[ $name ] ) ) {
|
if ( isset( self::$components[ $name ] ) ) {
|
||||||
unset( self::$components[ $name ] );
|
unset( self::$components[ $name ] );
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
*/
|
*/
|
||||||
namespace TheTempusProject\Houdini\Classes;
|
namespace TheTempusProject\Houdini\Classes;
|
||||||
|
|
||||||
use TheTempusProject\Canary\Canary as Debug;
|
use TheTempusProject\Canary\Bin\Canary as Debug;
|
||||||
|
|
||||||
class Filters {
|
class Filters {
|
||||||
public static $filters = [
|
public static $filters = [
|
||||||
@ -48,7 +48,20 @@ class Filters {
|
|||||||
}
|
}
|
||||||
foreach ( self::$filters as $pattern ) {
|
foreach ( self::$filters as $pattern ) {
|
||||||
if ( $pattern['enabled'] || false !== $force ) {
|
if ( $pattern['enabled'] || false !== $force ) {
|
||||||
$data = trim( preg_replace( $pattern['match'], $pattern['replace'], $data ) );
|
if ( ! empty( $pattern['callback'] ) && is_array( $pattern['callback'] ) ) {
|
||||||
|
$result = preg_replace_callback(
|
||||||
|
$pattern['match'],
|
||||||
|
$pattern['callback'],
|
||||||
|
$data
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$result = preg_replace(
|
||||||
|
$pattern['match'],
|
||||||
|
$pattern['replace'],
|
||||||
|
$data
|
||||||
|
);
|
||||||
|
}
|
||||||
|
$data = trim( $result );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $data;
|
return $data;
|
||||||
@ -59,14 +72,21 @@ class Filters {
|
|||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
if ( self::$filters[$name]['enabled'] || false !== $force ) {
|
if ( self::$filters[$name]['enabled'] || false !== $force ) {
|
||||||
$data = trim(
|
if ( ! empty( self::$filters[$name]['callback'] ) && is_array( self::$filters[$name]['callback'] ) ) {
|
||||||
preg_replace(
|
$result = preg_replace_callback(
|
||||||
|
self::$filters[$name]['match'],
|
||||||
|
self::$filters[$name]['callback'],
|
||||||
|
$data
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$result = preg_replace(
|
||||||
self::$filters[$name]['match'],
|
self::$filters[$name]['match'],
|
||||||
self::$filters[$name]['replace'],
|
self::$filters[$name]['replace'],
|
||||||
$data
|
$data
|
||||||
)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
$data = trim( $result );
|
||||||
|
}
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,11 +98,20 @@ class Filters {
|
|||||||
* @param {string} [$replace]
|
* @param {string} [$replace]
|
||||||
* @param {bool} [$enabled] - Whether the filter should be enabled or disabled.
|
* @param {bool} [$enabled] - Whether the filter should be enabled or disabled.
|
||||||
*/
|
*/
|
||||||
public static function add( $filterName, $match, $replace, $enabled = false ) {
|
public static function add( $filterName, $match, $replace, $enabled = false, $callback = false ) {
|
||||||
if ( isset( self::$filters[$filterName] ) ) {
|
if ( isset( self::$filters[$filterName] ) ) {
|
||||||
Debug::error( "Filter already exists: $filterName" );
|
Debug::error( "Filter already exists: $filterName" );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if ( $callback === true ) {
|
||||||
|
self::$filters[ $filterName ] = [
|
||||||
|
'name' => $filterName,
|
||||||
|
'match' => $match,
|
||||||
|
'callback' => $replace,
|
||||||
|
'enabled' => $enabled,
|
||||||
|
];
|
||||||
|
return;
|
||||||
|
}
|
||||||
self::$filters[ $filterName ] = [
|
self::$filters[ $filterName ] = [
|
||||||
'name' => $filterName,
|
'name' => $filterName,
|
||||||
'match' => $match,
|
'match' => $match,
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
namespace TheTempusProject\Houdini\Classes;
|
namespace TheTempusProject\Houdini\Classes;
|
||||||
|
|
||||||
use TheTempusProject\Hermes\Functions\Route as Routes;
|
use TheTempusProject\Hermes\Functions\Route as Routes;
|
||||||
use TheTempusProject\Canary\Canary as Debug;
|
use TheTempusProject\Canary\Bin\Canary as Debug;
|
||||||
|
|
||||||
class Navigation extends Template {
|
class Navigation extends Template {
|
||||||
public static $menus_array = [];
|
public static $menus_array = [];
|
||||||
|
@ -14,10 +14,9 @@
|
|||||||
*/
|
*/
|
||||||
namespace TheTempusProject\Houdini\Classes;
|
namespace TheTempusProject\Houdini\Classes;
|
||||||
|
|
||||||
use TheTempusProject\Canary\Canary as Debug;
|
use TheTempusProject\Canary\Bin\Canary as Debug;
|
||||||
|
use TheTempusProject\Canary\Classes\CustomException;
|
||||||
use TheTempusProject\Hermes\Functions\Route as Routes;
|
use TheTempusProject\Hermes\Functions\Route as Routes;
|
||||||
// use TheTempusProject\Bedrock\Functions\Date;
|
|
||||||
// use TheTempusProject\Bedrock\Classes\CustomException;
|
|
||||||
use TheTempusProject\Houdini\Classes\Components;
|
use TheTempusProject\Houdini\Classes\Components;
|
||||||
use TheTempusProject\Houdini\Classes\Forms;
|
use TheTempusProject\Houdini\Classes\Forms;
|
||||||
use TheTempusProject\Houdini\Classes\Filters;
|
use TheTempusProject\Houdini\Classes\Filters;
|
||||||
@ -108,7 +107,7 @@ class Template {
|
|||||||
return self::loadTemplate( $location, $name );
|
return self::loadTemplate( $location, $name );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// new CustomException( 'template', $docLocation );
|
new CustomException( 'template', $docLocation );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -126,7 +125,7 @@ class Template {
|
|||||||
$fullPath = $path . $name . '.inc.php';
|
$fullPath = $path . $name . '.inc.php';
|
||||||
$className = APP_SPACE . '\\Templates\\' . ucfirst( $name ) . 'Loader';
|
$className = APP_SPACE . '\\Templates\\' . ucfirst( $name ) . 'Loader';
|
||||||
if ( !file_exists( $fullPath ) ) {
|
if ( !file_exists( $fullPath ) ) {
|
||||||
// new CustomException( 'templateLoader', $fullPath );
|
new CustomException( 'templateLoader', $fullPath );
|
||||||
} else {
|
} else {
|
||||||
Debug::log( 'Requiring template loader: ' . $name );
|
Debug::log( 'Requiring template loader: ' . $name );
|
||||||
require_once $fullPath;
|
require_once $fullPath;
|
||||||
@ -202,7 +201,7 @@ class Template {
|
|||||||
self::buildRobot();
|
self::buildRobot();
|
||||||
self::buildHeaders();
|
self::buildHeaders();
|
||||||
if ( empty( self::$templateLocation ) ) {
|
if ( empty( self::$templateLocation ) ) {
|
||||||
// throw an error here @todo
|
new CustomException( 'templateLocation', self::$templateLocation );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ( !Debug::status( 'render' ) ) {
|
if ( !Debug::status( 'render' ) ) {
|
||||||
@ -315,7 +314,6 @@ class Template {
|
|||||||
* be used as components for the provided html.
|
* be used as components for the provided html.
|
||||||
* @return string - The fully parsed html output.
|
* @return string - The fully parsed html output.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public static function parse( $template, $data = null, $flags = null ) {
|
public static function parse( $template, $data = null, $flags = null ) {
|
||||||
if ( empty( $template ) ) {
|
if ( empty( $template ) ) {
|
||||||
return $template;
|
return $template;
|
||||||
@ -330,22 +328,6 @@ class Template {
|
|||||||
$template = preg_replace( '#\{OPTION\=(.*?)\}#is', '', $template );
|
$template = preg_replace( '#\{OPTION\=(.*?)\}#is', '', $template );
|
||||||
}
|
}
|
||||||
|
|
||||||
//Convert any dates into preferred Date/Time format. User preference will be applied her in the future.
|
|
||||||
// @todo - there must be something to migrate this ability from the top to the bottom when a user has a pref
|
|
||||||
$dtc = '#{DTC(.*?)}(.*?){/DTC}#is';
|
|
||||||
|
|
||||||
$template = preg_replace_callback(
|
|
||||||
$dtc,
|
|
||||||
function ( $data ) {
|
|
||||||
if ( empty( $data[2] ) ) {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
return $data[2]; // @todo need a way to decouple this from houdini to bedrock
|
|
||||||
// return Date::formatTimestamp( $data[1], $data[2] );
|
|
||||||
},
|
|
||||||
$template
|
|
||||||
);
|
|
||||||
|
|
||||||
//Run through our full list of generated filters.
|
//Run through our full list of generated filters.
|
||||||
$template = Filters::apply( $template );
|
$template = Filters::apply( $template );
|
||||||
|
|
||||||
|
@ -11,7 +11,8 @@
|
|||||||
*/
|
*/
|
||||||
namespace TheTempusProject\Houdini\Classes;
|
namespace TheTempusProject\Houdini\Classes;
|
||||||
|
|
||||||
use TheTempusProject\Canary\Canary as Debug;
|
use TheTempusProject\Canary\Bin\Canary as Debug;
|
||||||
|
use TheTempusProject\Canary\Classes\CustomException;
|
||||||
|
|
||||||
class Views extends Template {
|
class Views extends Template {
|
||||||
public static $additionalLocations = [];
|
public static $additionalLocations = [];
|
||||||
@ -34,7 +35,7 @@ class Views extends Template {
|
|||||||
if ( !empty( $out ) ) {
|
if ( !empty( $out ) ) {
|
||||||
self::$content .= $out;
|
self::$content .= $out;
|
||||||
} else {
|
} else {
|
||||||
// new CustomException( 'view', $viewName );
|
new CustomException( 'view', $viewName );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,7 +97,7 @@ class Views extends Template {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// @todo - this would be awesome, if i actually caught the exception anywhere :/
|
// @todo - this would be awesome, if i actually caught the exception anywhere :/
|
||||||
// throw new CustomException('simpleView', $path);
|
new CustomException('simpleView', $path);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
20
composer.lock
generated
20
composer.lock
generated
@ -12,7 +12,7 @@
|
|||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://git.thetempusproject.com/the-tempus-project/canary",
|
"url": "https://git.thetempusproject.com/the-tempus-project/canary",
|
||||||
"reference": "be5589533f8c1d0b1c28bac8829333f0077c698d"
|
"reference": "35415fbf3c5888ccdb8a8695989176a120026c7f"
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"php": ">=8.1.0"
|
"php": ">=8.1.0"
|
||||||
@ -21,12 +21,12 @@
|
|||||||
"type": "library",
|
"type": "library",
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"files": [
|
"files": [
|
||||||
"config/constants.php",
|
"Config/constants.php",
|
||||||
"bin/canary.php"
|
"Bin/Canary.php"
|
||||||
],
|
],
|
||||||
"classmap": [
|
"psr-4": {
|
||||||
"classes"
|
"TheTempusProject\\Canary\\Classes\\": "Classes"
|
||||||
]
|
}
|
||||||
},
|
},
|
||||||
"notification-url": "https://packagist.org/downloads/",
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
"license": [
|
"license": [
|
||||||
@ -48,7 +48,7 @@
|
|||||||
"thetempusproject",
|
"thetempusproject",
|
||||||
"tools"
|
"tools"
|
||||||
],
|
],
|
||||||
"time": "2024-08-08T05:18:19+00:00"
|
"time": "2024-08-20T10:26:09+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "thetempusproject/hermes",
|
"name": "thetempusproject/hermes",
|
||||||
@ -56,7 +56,7 @@
|
|||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://git.thetempusproject.com/the-tempus-project/hermes",
|
"url": "https://git.thetempusproject.com/the-tempus-project/hermes",
|
||||||
"reference": "e38f8debefb7097b15cb479184dc869e3e3111c0"
|
"reference": "31c51c1a5bad2871df800c89f27ace0a49848583"
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"php": ">=8.1.0"
|
"php": ">=8.1.0"
|
||||||
@ -92,7 +92,7 @@
|
|||||||
"thetempusproject",
|
"thetempusproject",
|
||||||
"tools"
|
"tools"
|
||||||
],
|
],
|
||||||
"time": "2024-08-08T05:24:32+00:00"
|
"time": "2024-08-20T10:26:47+00:00"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"packages-dev": [],
|
"packages-dev": [],
|
||||||
@ -105,5 +105,5 @@
|
|||||||
"php": ">=8.1.0"
|
"php": ">=8.1.0"
|
||||||
},
|
},
|
||||||
"platform-dev": [],
|
"platform-dev": [],
|
||||||
"plugin-api-version": "2.3.0"
|
"plugin-api-version": "2.6.0"
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user