Initial commit

This commit is contained in:
Joey Kimsey
2024-08-04 21:15:59 -04:00
parent c9d1fb983f
commit 0d469501ee
695 changed files with 70184 additions and 71 deletions

46
vendor/canary/CODE_OF_CONDUCT.md vendored Normal file
View File

@ -0,0 +1,46 @@
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at webmaster@thetempusproject.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/

88
vendor/canary/CONTRIBUTING.md vendored Normal file
View File

@ -0,0 +1,88 @@
# Contribution Guidelines for TempusDebugger
Contributing to TempusDebugger is completely voluntary and should follow all of the guidelines listed here in order to ensure the highest probability of acceptance. It is highly recommended to use a php linter to automate more of this process. The project is maintained on github and all contributions need to be submitted via pull request to their specific repository under the `dev` branch. In order to contribute, simply follow the instructions for [creating a pull request](#creating-a-pull-request) below.
## Pull Request Requirements
- All revisions must follow TTP naming conventions (see [Naming Conventions](#naming-conventions) Section)
- Include a clear and concise explanation of the features or changes included in your revision listed by file.
- All code must follow [PSR 2](http://www.php-fig.org/psr/psr-2/) standards
- prefer the use of [] for arrays over array()
- All functions must be documented with the exception of controller methods (see [Documentation](#documentation) Section)
- Controller methods may be doc-blocked when necessary for clarity (see [Documentation](#documentation) Section)
- All new Classes must include a class level doc-block (see [Documentation](#documentation) Section)
- Any new dependencies will have a longer validation process and should be accompanied by the required information (see [Dependencies](#dependencies) Section)
## Naming Conventions
- File names are to be lower case
- All class names must be upper case
- Any data being stored as a file must be saved in the `app/` directory, preferably the `app/config/` directory.
- Controllers must have a constructor and destructor incorporating the constructor and destructor in the Resources Controller
- (This will be an interface requirement soon)
- Views must be named using underscores for separation and must be prefixed with view_
## Dependencies
Whenever a dependency is updated or added, pull requests must include a section that answers the following questions.
- Why is this dependency required
- Could this be reasonably accomplished within the app by implementing new features in a later version? explain.
- What is the latest stable version that can be used
- What features are absolutely necessary for your feature or modification to work
## Documentation
### Classes
New classes must be prefaced with a doc-block following this style:
```
/**
* controllers/admin.php
*
* This is the admin controller.
*
* @version 3.0
* @author Joey Kimsey <Joey@thetempusproject.com>
* @link https://TheTempusProject.com/TempusDebugger
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
*/
```
From top to bottom:
- Filename on the second line
- A description for the file
- The TTP version this file was built for
`@version 1.0`
- The Authors name or alias and email
`@author first last <email@link.com>`
- A copy of the MIT license
`@license https://opensource.org/licenses/MIT [MIT LICENSE]`
- May include a link for more information
`@link http://link.com`
### Functions
Functions must be prefaced with a doc-block following this style:
```
/**
* Intended as a self-destruct session. If the specified session does not
* exist, it is created. If the specified session does exist, it will be
* destroyed and returned.
*
* @param string $name - Session name to be created or checked
* @param string $string - The string to be used if session needs to be
* created. (optional)
*
* @return bool|string - Returns bool if creating, and a string if the
* check is successful.
*/
```
From top to bottom:
- There must be a description of the functions intended usage on the second line
- All parameters should be documented like this
`@param [type] $name - description`
- Any function with a return statement must also be documented as such
`@return [type] - description`
## Creating a Pull Request
This is a simple explanation of how to create a pull request for changes to TempusDebugger. You can find a detailed walk-through on how to [create a pull request](https://help.github.com/articles/creating-a-pull-request/) on github.
1. First ensure you have followed all the contributing guidelines
2. Squash your merge into a single revision. This will make it easier to view the changes as a whole.
3. You can submit a pull request [here](https://github.com/TheTempusProject/TempusDebugger/compare)
4. Please submit all pull requests to the dev branch or they will be ignored.

21
vendor/canary/README.md vendored Normal file
View File

@ -0,0 +1,21 @@
# TempusDebugger
#### PHP Library for sending debug messages to Chrome
###### Developer(s): Joey Kimsey
TempusDebugger is a php library that will enable real time debugging messages to be sent to the TempusTools chrome extension.
**Notice: This code is in _still_ not production ready. This framework is provided as is, use at your own risk.**
## Installation
To install simply use the composer command:
`php composer.phar require TheTempusProject/TempusDebugger:1.*`
REALLLLLY need to update the contributing document for this one.

41
vendor/canary/bin/autoload.php vendored Normal file
View File

@ -0,0 +1,41 @@
<?php
/**
* autoload.php
*
* Uses the Hermes autoloader if it has been defined.
*
* @version 3.0
* @author Joey Kimsey <Joey@thetempusproject.com>
* @link https://TheTempusProject.com/TempusDebugger
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
*/
namespace TheTempusProject\Canary;
use TheTempusProject\Hermes\Classes\Autoloader;
if ( !defined( 'CANARY_ROOT_DIRECTORY' ) ) {
define( 'CANARY_ROOT_DIRECTORY', dirname( __DIR__ ) . DIRECTORY_SEPARATOR );
}
if ( ! defined('CANARY_CONFIG_DIRECTORY' ) ) {
define('CANARY_CONFIG_DIRECTORY', CANARY_ROOT_DIRECTORY . 'config' . DIRECTORY_SEPARATOR);
}
if ( ! defined('CANARY_CONSTANTS_LOADED' ) ) {
require_once CANARY_CONFIG_DIRECTORY . 'constants.php';
}
if ( class_exists( 'TheTempusProject\Hermes\Classes\Autoloader' ) ) {
$Autoloader = new Autoloader;
$autoloader->setRootFolder( CANARY_ROOT_DIRECTORY );
$autoloader->addNamespace(
'TheTempusProject\Canary\Classes',
'classes'
);
$autoloader->addNamespace(
'TheTempusProject\Canary',
'bin'
);
$Autoloader->register();
define( 'CANARY_AUTOLOADED', true );
}

449
vendor/canary/bin/canary.php vendored Normal file
View File

@ -0,0 +1,449 @@
<?php
/**
* bin/canary.php
*
* The Canary class is responsible for providing a log of relevant debugging information.
* It has functionality to generate a log file as it goes allowing you to print it at any
* given point in the script. It can also interface directly with the browser via the
* Overwatch browser extension.
*
* @version 3.0
* @author Joey Kimsey <Joey@thetempusproject.com>
* @link https://TheTempusProject.com/Core
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
*/
namespace TheTempusProject\Canary;
use TheTempusProject\Canary\Classes\TempusDebugger;
use TheTempusProject\Canary\Classes\Logger;
use Exception;
class Canary {
private static $lastCall = '';
private static $group = 0;
private static $tempusDebugger;
private static $tempusLogger;
private static $debugLog = '';
/**
* @param {object} [$exception]
*/
public static function handle_exception( $exception ) {
echo '<div style="margin-top: 80px;margin-bottom: 80px;margin-left: 275px;">';
echo '<hr><h3>Exception Handler:</h3>';
echo '<b>Class: </b><code>' . get_class( $exception ) . '</code><br>';
// echo "<b>Message: </b><code>{ $exception->message }" . '</code><br>';
// echo "<b>File: </b><code>{ $exception->getFile() }" . '</code><br>';
// echo "<b>Line: </b><code>{ $exception->getLine() }" . '</code><br>';
echo '<b>Exception:</b><pre>' . print_r( $exception, true ) . '</pre><br><hr>';
echo '</div>';
}
/**
* @param {object} [$exception]
*/
public static function handle_error( $error_code, $error_description, $file = null, $error_line_number = null ) {
$displayErrors = ini_get( 'display_errors' );
$displayErrors = strtolower( $displayErrors );
echo '<div style="margin-top: 80px;margin-bottom: 80px;margin-left: 275px;">';
if ( 0 === $error_code || 0 === error_reporting() || $displayErrors === 'on' ) {
echo '<h1>fail</h1></div>';
return false;
}
// wtf? remove this or find an alternative
// if ( isset( $GLOBALS['error_fatal'] ) ) {
// if ( $GLOBALS['error_fatal'] && $error_code ) {
// die('fatal');
// }
// }
$errstr = htmlspecialchars( $error_description );
switch( $error_code ) {
case E_ERROR:
$errorType = 'E_ERROR';
$errorReadable = 'Fatal Error';
// throw new ErrorException($error_description, 0, $error_code, $file, $err_line);
// $log = LOG_ERR;
break;
case E_WARNING:
$errorType = 'E_WARNING';
$errorReadable = 'Warning';
// throw new WarningException($error_description, 0, $error_code, $file, $err_line);
// $log = LOG_WARNING;
break;
case E_PARSE:
$errorType = 'E_PARSE';
$errorReadable = 'Parse Error';
// throw new ParseException($error_description, 0, $error_code, $file, $err_line);
// $log = LOG_ERR;
break;
case E_NOTICE:
$errorType = 'E_NOTICE';
$errorReadable = 'Notice';
// throw new NoticeException($error_description, 0, $error_code, $file, $err_line);
// $log = LOG_NOTICE;
break;
case E_CORE_ERROR:
$errorType = 'E_CORE_ERROR';
$errorReadable = 'Core Error';
// throw new CoreErrorException($error_description, 0, $error_code, $file, $err_line);
// $log = LOG_ERR;
break;
case E_CORE_WARNING:
$errorType = 'E_CORE_WARNING';
$errorReadable = 'Core Warning';
// throw new CoreWarningException($error_description, 0, $error_code, $file, $err_line);
// $log = LOG_WARNING;
break;
case E_COMPILE_ERROR:
$errorType = 'E_COMPILE_ERROR';
$errorReadable = 'Compile Error';
// throw new CompileErrorException($error_description, 0, $error_code, $file, $err_line);
// $log = LOG_ERR;
break;
case E_COMPILE_WARNING:
$errorType = 'E_COMPILE_WARNING';
$errorReadable = 'Compile Warning';
// throw new CoreWarningException($error_description, 0, $error_code, $file, $err_line);
// $log = LOG_WARNING;
break;
case E_USER_ERROR:
$errorType = 'E_USER_ERROR';
$errorReadable = 'User Error';
// handling an sql error
if ( $error_description == '(SQL)' ) {
echo '<b>SQL Query: </b><code>' . SQLQUERY . '</code><br>';
echo '<b>SQL Line: </b><code>' . SQLERRORLINE . '</code><br>';
echo '<b>SQL File: </b><code>' . SQLERRORFILE . '</code><br>';
}
// throw new UserErrorException($error_description, 0, $error_code, $file, $err_line);
// $log = LOG_ERR;
break;
case E_USER_NOTICE:
$errorType = 'E_USER_NOTICE';
$errorReadable = 'User Notice';
// $log = LOG_NOTICE;
break;
case E_STRICT:
$errorType = 'E_STRICT';
$errorReadable = 'Strict';
// $log = LOG_NOTICE;
break;
case E_RECOVERABLE_ERROR:
$errorType = 'E_RECOVERABLE_ERROR';
$errorReadable = 'Recoverable Error';
// $log = LOG_WARNING;
break;
case E_USER_WARNING:
$errorType = 'E_USER_WARNING';
$errorReadable = 'User Warning';
// $log = LOG_WARNING;
break;
case E_DEPRECATED:
$errorType = 'E_DEPRECATED';
$errorReadable = 'Deprecated';
// $log = LOG_NOTICE;
// no break
case E_USER_DEPRECATED:
$errorType = 'E_USER_DEPRECATED';
$errorReadable = 'User Deprecated';
// $log = LOG_NOTICE;
break;
default:
$errorType = 'UNKNOWN';
$errorReadable = 'Unknown Error';
break;
}
echo '<h3>' . $errorReadable . ':</h3>';
echo "<b>Error Description: </b><code>{$error_description}" . '</code><br>';
echo "<b>File: </b><code>{$file}" . '</code><br>';
echo "<b>Line Number: </b><code>{$error_line_number}" . '</code><br>';
echo "<b>Error Case: </b><code>{$errorType}" . '</code><br>';
echo "<b>Error Code: </b><code>{$error_code}" . '</code><br>';
echo "<b>Error Description (fancy): </b><code>{$errstr}" . '</code><br>';
echo '<b>PHP Version: </b><code>' . PHP_VERSION . '</code><br>';
echo '<b>PHP OS: </b><code>' . PHP_OS . '</code><br>';
// $data = [
// // 'level' => $log,
// 'code' => $error_line_number,
// // 'error' => $error,
// 'description' => $error_description,
// 'file' => $file,
// 'line' => $error_line_number,
// 'path' => $file,
// 'message' => $error . ' (' . $error_line_number . '): ' . $error_description . ' in [' . $file . ', line ' . $error_line_number . ']'
// ];
echo '</div>';
}
/**
* Acts as a constructor.
*/
private static function startDebug() {
if ( self::status( 'file' ) ) {
self::$tempusLogger = new Logger;
}
if ( self::status( 'console' ) ) {
ob_start();
self::$tempusDebugger = TempusDebugger::getInstance( true );
self::$tempusDebugger->setOption( 'includeLineNumbers', CANARY_SHOW_LINES );
// self::$tempusDebugger->setHash( CANARY_SECURE_HASH );
}
}
/**
* Returns the current Debug Status.
*
* @return bool
*/
public static function status( $flag = null ) {
switch ( $flag ) {
case 'console':
return CANARY_DEBUG_TO_CONSOLE;
case 'file':
return CANARY_DEBUG_TO_FILE;
case 'trace':
return CANARY_TRACE_ENABLED;
case 'render':
return RENDERING_ENABLED;
case 'debug':
default:
return CANARY_ENABLED;
}
}
/**
* This is the interface that writes to our log file/console depending on input type.
*
* @param string $type - Debugging type.
* @param string $data - Debugging data.
*
* @todo make a case statement
*/
private static function put( $type, $data = null, $params = null ) {
if ( ! CANARY_ENABLED ) {
return;
}
if ( strlen( self::$debugLog ) > 50000 ) {
self::$tempusDebugger->log( 'Error log too large, possible loop.' );
return;
}
if ( is_object( $data ) ) {
$data = 'cannot save objects';
}
if ( !is_string( $data ) ) {
$data = var_export( $data, true );
}
if ( !empty( self::$lastCall ) ) {
$highlight = '';
$trimmed_class = trim(self::$lastCall, '\\');
$trimmed_class = trim($trimmed_class, '"');
$trimmed_class = trim($trimmed_class, "'");
$exploded_classname = explode( '\\\\', $trimmed_class );
$exploded_classname[1] = '<b>'.$exploded_classname[1].'</b>';
$bolded_line = implode( ' \\ ', $exploded_classname );
$shortened_name = str_ireplace( 'TheTempusProject', 'TTP', $bolded_line );
if ( in_array( $type, ['error','info','warn'])) {
$highlight = 'debug-log-' . $type;
}
$full_line = "<span class='debug-log {$highlight}'>&lt;{$shortened_name}&gt;:{$data}</span><br>";
self::$debugLog .= $full_line;
self::$lastCall = '';
}
if ( self::status( 'file' ) ) {
if ( ! self::$tempusLogger ) {
self::startDebug();
}
switch ( $type ) {
case 'error':
case 'warn':
case 'info':
case 'log':
case 'debug':
self::$tempusLogger->addLog( $type, $data );
break;
default:
break;
}
}
if ( ! self::status( 'console' ) ) {
return;
}
if ( ! self::$tempusDebugger ) {
self::startDebug();
}
switch ( $type ) {
case 'variable':
self::$tempusDebugger->info( $data, $params );
break;
case 'groupEnd':
self::$tempusDebugger->groupEnd();
break;
case 'trace':
self::$tempusDebugger->trace( $data );
break;
case 'group':
if ( $params ) {
self::$tempusDebugger->group( $data, $params );
} else {
self::$tempusDebugger->group( $data );
}
break;
case 'info':
self::$tempusDebugger->$type( 'color: #1452ff', '%c' . $data );
break;
default:
self::$tempusDebugger->$type( $data );
break;
}
}
/**
* Ends a group.
*/
public static function gend() {
if ( self::$group > 0 ) {
self::$group--;
self::put( 'groupEnd' );
}
}
/**
* Creates a group divider into the console output.
*
* @param string $data name of the group
* @param wild $collapsed if anything is present the group will be collapsed by default
*/
public static function closeAllGroups() {
list($childClass, $caller) = debug_backtrace(false, 2);
self::$lastCall = var_export($caller['class'],true);
if ( self::$group > 0 ) {
while ( self::$group > 0 ) {
self::$group--;
self::put( 'groupEnd' );
}
// self::put('log', 'closed all groups.');
}
}
/**
* Creates a group divider into the console output.
*
* @param string $data name of the group
* @param wild $collapsed if anything is present the group will be collapsed by default
*/
public static function group( $data, $collapsed = null ) {
list($childClass, $caller) = debug_backtrace(false, 2);
self::$lastCall = var_export($caller['class'],true);
if ( !empty( $collapsed ) ) {
$params = ['Collapsed' => true];
self::put( 'group', $data, $params );
} else {
self::put( 'group', $data );
}
self::$group++;
}
/**
* Allows you to print the contents of any variable into the console.
*
* @param WILD $var - The variable you wish to read.
* @param string $data - Optional name for the variable output.
*/
public static function v( $var, $data = null ) {
list($childClass, $caller) = debug_backtrace(false, 2);
self::$lastCall = var_export($caller['class'],true);
if ( !isset( $data ) ) {
$data = 'Default Variable label';
}
self::put( 'variable', $var, $data );
}
/**
* Socket function for a basic debugging log.
*
* @param string $data - The debug data.
*/
public static function log( $data, $params = null ) {
list($childClass, $caller) = debug_backtrace(false, 2);
self::$lastCall = var_export($caller['class'],true);
self::put( 'log', $data );
if ( !empty( $params ) ) {
self::gend();
}
}
/**
* Provides a stack trace from the current calling spot.
*
* @param string $data the name of the trace
*/
public static function trace( $data = 'Default Trace' ) {
list( $childClass, $caller ) = debug_backtrace(false, 2);
self::$lastCall = var_export( $caller['class'], true );
self::group( 'Debug Trace', 1 );
self::put( 'trace' );
self::gend();
}
/**
* Socket function for debugging info.
*
* @param string $data - The debug data.
*/
public static function info( $data, $params = null ) {
list($childClass, $caller) = debug_backtrace(false, 2);
self::$lastCall = var_export($caller['class'],true);
self::put( 'info', $data );
if ( !empty( $params ) ) {
self::gend();
}
}
/**
* Socket function for a debugging warning.
*
* @param string $data - The debug data.
*/
public static function warn( $data, $params = null ) {
list($childClass, $caller) = debug_backtrace(false, 2);
self::$lastCall = var_export($caller['class'],true);
self::put( 'warn', $data );
if ( !empty( $params ) ) {
self::gend();
}
}
public static function debug( $data, $params = null ) {
list($childClass, $caller) = debug_backtrace(false, 2);
self::$lastCall = var_export($caller['class'],true);
self::put( 'debug', $data );
if ( !empty( $params ) ) {
self::gend();
}
}
/**
* Socket function for a debugging error.
*
* @param string $data - The debug data.
*/
public static function error( $data, $params = null ) {
list($childClass, $caller) = debug_backtrace(false, 2);
self::$lastCall = var_export($caller['class'],true);
self::put( 'error', $data );
if ( CANARY_TRACE_ENABLED ) {
self::trace();
}
if ( !empty( $params ) ) {
self::gend();
}
}
/**
* This returns the contents of the debug log.
*/
public static function dump() {
return self::$debugLog;
}
}

213
vendor/canary/classes/TempusTools.php vendored Normal file
View File

@ -0,0 +1,213 @@
<?php
/**
* tempus_tools.php
*
* This is an interface for the Tempus Debugger to interact with TempusTools
*
* @version 3.0
* @author Joey Kimsey <Joey@thetempusproject.com>
* @link https://TheTempusProject.com/TempusDebugger
* @license https://opensource.org/licenses/MIT [MIT LICENSE]
*/
namespace TheTempusProject\Canary\Classes;
if ( !class_exists( 'TempusDebugger', false ) ) {
require_once 'tempus_debugger.php';
}
/**
* Sends the given data to the TempusTools Chrome Extension.
* The data can be displayed in devtools.
*
* @param mixed $Object
* @return true
* @throws Exception
*/
function tt() {
$instance = TempusDebugger::getInstance( true );
$args = func_get_args();
return call_user_func_array( [ $instance, 'tt' ], $args );
}
class TempusTools {
/**
* Set an Insight console to direct all logging calls to
*
* @param object $console The console object to log to
* @return void
*/
public static function setLogToInsightConsole( $console ) {
TempusDebugger::getInstance( true )->setLogToInsightConsole( $console );
}
/**
* Enable and disable logging to TempusTools
*
* @param boolean $enabled TRUE to enable, FALSE to disable
* @return void
*/
public static function setEnabled( $enabled ) {
TempusDebugger::getInstance( true )->setEnabled( $enabled );
}
/**
* Check if logging is enabled
*
* @return boolean TRUE if enabled
*/
public static function getEnabled() {
return TempusDebugger::getInstance( true )->getEnabled();
}
/**
* Specify a filter to be used when encoding an object
*
* Filters are used to exclude object members.
*
* @param string $class The class name of the object
* @param array $filter An array or members to exclude
* @return void
*/
public static function setObjectFilter( $class, $filter ) {
TempusDebugger::getInstance( true )->setObjectFilter( $class, $filter );
}
/**
* Set some options for the library
*
* @param array $options The options to be set
* @return void
*/
public static function setOptions( $options ) {
TempusDebugger::getInstance( true )->setOptions( $options );
}
/**
* Get options for the library
*
* @return array The options
*/
public static function getOptions() {
return TempusDebugger::getInstance( true )->getOptions();
}
/**
* Log object to console
*
* @param mixed $object
* @return true
* @throws Exception
*/
public static function send() {
$args = func_get_args();
return call_user_func_array( [ TempusDebugger::getInstance( true ), 'tt' ], $args );
}
/**
* Start a group for following messages
*
* Options:
* Collapsed: [true|false]
* Color: [#RRGGBB|ColorName]
*
* @param string $name
* @param array $options OPTIONAL Instructions on how to log the group
* @return true
*/
public static function group( $name, $options = null ) {
return TempusDebugger::getInstance( true )->group( $name, $options );
}
/**
* Ends a group you have started before
*
* @return true
* @throws Exception
*/
public static function groupEnd() {
return self::send( null, null, TempusDebugger::GROUP_END );
}
/**
* Log object with label to the console
*
* @param mixes $object
* @param string $label
* @return true
* @throws Exception
*/
public static function log( $object, $label = null ) {
return self::send( $object, $label, TempusDebugger::LOG );
}
/**
* Log object with label to the console
*
* @param mixes $object
* @param string $label
* @return true
* @throws Exception
*/
public static function info( $object, $label = null ) {
return self::send( $object, $label, TempusDebugger::INFO );
}
/**
* Log object with label to the console
*
* @param mixes $object
* @param string $label
* @return true
* @throws Exception
*/
public static function warn( $object, $label = null ) {
return self::send( $object, $label, TempusDebugger::WARN );
}
/**
* Log object with label to the console
*
* @param mixes $object
* @param string $label
* @return true
* @throws Exception
*/
public static function error( $object, $label = null ) {
return self::send( $object, $label, TempusDebugger::ERROR );
}
/**
* Dumps key and variable to console
*
* @param string $key
* @param mixed $variable
* @return true
* @throws Exception
*/
public static function dump( $key, $variable ) {
return self::send( $variable, $key, TempusDebugger::DUMP );
}
/**
* Log a trace in the console
*
* @param string $label
* @return true
* @throws Exception
*/
public static function trace( $label ) {
return self::send( $label, TempusDebugger::TRACE );
}
/**
* Log a table in the console
*
* @param string $label
* @param string $table
* @return true
* @throws Exception
*/
public static function table( $label, $table ) {
return self::send( $table, $label, TempusDebugger::TABLE );
}
}

108
vendor/canary/classes/logger.php vendored Normal file
View File

@ -0,0 +1,108 @@
<?php
/**
* logger.php
*
* @version 3.0
* @author Joey Kimsey <Joey@thetempusproject.com>
*/
namespace TheTempusProject\Canary\Classes;
use TheTempusProject\Bedrock\Functions\Date;
class Logger {
public $file;
public $logDirectory;
public $logFilePath;
public function __construct() {
$this->setupLogFile();
$this->file = fopen( $this->logFilePath, 'a' );
fwrite( $this->file, '===================------++++++++++------===================' . PHP_EOL );
}
public function setupLogFile() {
$this->logDirectory = rtrim( CANARY_DEBUG_DIRECTORY, DIRECTORY_SEPARATOR );
if ( ! is_dir( $this->logDirectory ) ) {
mkdir( $this->logDirectory, 0777, true );
}
$currentFile = date('m-d-Y') . '.log';
$this->logFilePath = $this->logDirectory . DIRECTORY_SEPARATOR . $currentFile;
if ( ! file_exists( $this->logFilePath ) ) {
touch( $this->logFilePath );
chmod( $this->logFilePath, 0777 );
}
}
public function __destruct() {
fwrite( $this->file, '============================================================' . PHP_EOL );
fclose( $this->file );
}
public function addLog( $type = 'log', $log ) {
switch ( CANARY_DEBUG_TO_FILE_LEVEL ) {
case CANARY_DEBUG_LEVEL_ERROR:
$acceptableLoggingLevels = [
CANARY_DEBUG_LEVEL_ERROR,
];
if (! in_array( $type, $acceptableLoggingLevels )) {
return;
}
break;
case CANARY_DEBUG_LEVEL_WARN:
$acceptableLoggingLevels = [
CANARY_DEBUG_LEVEL_ERROR,
CANARY_DEBUG_LEVEL_WARN,
];
if (! in_array( $type, $acceptableLoggingLevels )) {
return;
}
break;
case CANARY_DEBUG_LEVEL_INFO:
$acceptableLoggingLevels = [
CANARY_DEBUG_LEVEL_ERROR,
CANARY_DEBUG_LEVEL_WARN,
CANARY_DEBUG_LEVEL_INFO,
];
if (! in_array( $type, $acceptableLoggingLevels )) {
return;
}
break;
case CANARY_DEBUG_LEVEL_LOG:
$acceptableLoggingLevels = [
CANARY_DEBUG_LEVEL_ERROR,
CANARY_DEBUG_LEVEL_WARN,
CANARY_DEBUG_LEVEL_INFO,
CANARY_DEBUG_LEVEL_LOG,
];
if (! in_array( $type, $acceptableLoggingLevels )) {
return;
}
break;
case CANARY_DEBUG_LEVEL_DEBUG:
$acceptableLoggingLevels = [
CANARY_DEBUG_LEVEL_ERROR,
CANARY_DEBUG_LEVEL_WARN,
CANARY_DEBUG_LEVEL_INFO,
CANARY_DEBUG_LEVEL_LOG,
CANARY_DEBUG_LEVEL_DEBUG,
];
if (! in_array( $type, $acceptableLoggingLevels )) {
return;
}
break;
default:
return;
}
$formattedMessage = $this->timestamp() . $this->typestamp( $type ) . $log . PHP_EOL;
fwrite( $this->file, $formattedMessage );
}
private function timestamp() {
$dateString = Date::getReadableDate( time() );
return '['.$dateString.'] - ';
}
private function typestamp( $type ) {
$dateString = Date::getReadableDate( time() );
return '[' . strtoupper( $type ) . '] - ';
}
}

1130
vendor/canary/classes/tempus_debugger.php vendored Normal file

File diff suppressed because it is too large Load Diff

27
vendor/canary/composer.json vendored Normal file
View File

@ -0,0 +1,27 @@
{
"name": "thetempusproject/tempusdebugger",
"type": "library",
"description": "Framework for sending php messages to chrome for in-browser debugging.",
"license": "MIT",
"minimum-stability": "dev",
"keywords": ["php","tools","debugging","thetempusproject"],
"homepage": "https://github.com/TheTempusProject/TempusDebugger",
"authors": [
{
"name": "Joey Kimsey",
"email": "Joey@thetempusproject.com",
"homepage": "https://TheTempusProject.com",
"role": "Lead Developer"
}
],
"require": {
"php": ">=5.4.0"
},
"autoload": {
"classmap": [
"TempusDebugger.php",
"TempusTools.php"
]
}
}

53
vendor/canary/config/constants.php vendored Normal file
View File

@ -0,0 +1,53 @@
<?php
if ( ! defined('CANARY_ENABLED' ) ) {
define( 'CANARY_ENABLED', false );
}
// Directories
if ( ! defined( 'CANARY_ROOT_DIRECTORY' ) ) {
define( 'CANARY_ROOT_DIRECTORY', dirname( __DIR__ ) . DIRECTORY_SEPARATOR );
}
if ( ! defined( 'CANARY_CONFIG_DIRECTORY' ) ) {
define( 'CANARY_CONFIG_DIRECTORY', CANARY_ROOT_DIRECTORY . 'config' . DIRECTORY_SEPARATOR );
}
// Log Levels
if ( ! defined('CANARY_DEBUG_LEVEL_ERROR' ) ) {
define( 'CANARY_DEBUG_LEVEL_ERROR', 'error' );
}
if ( ! defined('CANARY_DEBUG_LEVEL_WARN' ) ) {
define( 'CANARY_DEBUG_LEVEL_WARN', 'warn' );
}
if ( ! defined('CANARY_DEBUG_LEVEL_INFO' ) ) {
define( 'CANARY_DEBUG_LEVEL_INFO', 'info' );
}
if ( ! defined('CANARY_DEBUG_LEVEL_LOG' ) ) {
define( 'CANARY_DEBUG_LEVEL_LOG', 'log' );
}
if ( ! defined('CANARY_DEBUG_LEVEL_DEBUG' ) ) {
define( 'CANARY_DEBUG_LEVEL_DEBUG', 'debug' );
}
// File Logging
if ( ! defined('CANARY_DEBUG_TO_FILE' ) ) {
define( 'CANARY_DEBUG_TO_FILE', false );
}
if ( ! defined( 'CANARY_DEBUG_DIRECTORY' ) ) {
define( 'CANARY_DEBUG_DIRECTORY', CANARY_ROOT_DIRECTORY . 'logs' . DIRECTORY_SEPARATOR );
}
if ( ! defined( 'CANARY_DEBUG_TO_FILE_LEVEL' ) ) {
define( 'CANARY_DEBUG_TO_FILE_LEVEL', CANARY_DEBUG_LEVEL_ERROR );
}
if ( ! defined( 'CANARY_SECURE_HASH' ) ) {
define( 'CANARY_SECURE_HASH', '' );
}
if ( ! defined( 'CANARY_SHOW_LINES' ) ) {
define( 'CANARY_SHOW_LINES', false );
}
if ( ! defined('CANARY_DEBUG_TO_CONSOLE' ) ) {
define( 'CANARY_DEBUG_TO_CONSOLE', false );
}
# Tell the app all constants have been loaded.
define( 'CANARY_CONSTANTS_LOADED', true );