first commit without licensingg

This commit is contained in:
kbe
2025-08-21 14:40:43 +02:00
commit fa8d4e58a4
130 changed files with 82163 additions and 0 deletions

View File

@@ -0,0 +1,53 @@
<?php
/**
* Logger Class
*
* @package Revision
*/
/**
* Logger Class
*/
class CSCO_Logger extends CSCO_WPImporterLoggerCLI {
/**
* Variable for front-end error display.
*
* @var string
*/
public $error_output = '';
/**
* Overwritten log function from CSCO_WP_Importer_Logger_CLI.
*
* Logs with an arbitrary level.
*
* @param mixed $level level of reporting.
* @param string $message log message.
* @param array $context context to the log message.
*/
public function log( $level, $message, array $context = array() ) {
// Save error messages for front-end display.
$this->error_output( $level, $message, $context = array() );
if ( $this->level_to_numeric( $level ) < $this->level_to_numeric( $this->min_level ) ) {
return;
}
}
/**
* Save messages for error output.
* Only the messages greater then Error.
*
* @param mixed $level level of reporting.
* @param string $message log message.
* @param array $context context to the log message.
*/
public function error_output( $level, $message, array $context = array() ) {
if ( $this->level_to_numeric( $level ) < $this->level_to_numeric( 'error' ) ) {
return;
}
$this->error_output .= sprintf( '[%s] %s<br>', strtoupper( $level ), $message );
}
}

View File

@@ -0,0 +1,126 @@
<?php
/**
* Describes a logger instance
*
* Based on PSR-3: http://www.php-fig.org/psr/psr-3/
*
* The message MUST be a string or object implementing __toString().
*
* The message MAY contain placeholders in the form: {foo} where foo
* will be replaced by the context data in key "foo".
*
* The context array can contain arbitrary data, the only assumption that
* can be made by implementors is that if an Exception instance is given
* to produce a stack trace, it MUST be in a key named "exception".
*
* See https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md
* for the full interface specification.
*/
class CSCO_WPImporterLogger {
/**
* System is unusable.
*
* @param string $message The message.
* @param array $context The context.
*/
public function emergency( $message, array $context = array() ) {
return $this->log( 'emergency', $message, $context );
}
/**
* Action must be taken immediately.
*
* Example: Entire website down, database unavailable, etc. This should
* trigger the SMS alerts and wake you up.
*
* @param string $message The message.
* @param array $context The context.
*/
public function alert( $message, array $context = array() ) {
return $this->log( 'alert', $message, $context );
}
/**
* Critical conditions.
*
* Example: Application component unavailable, unexpected exception.
*
* @param string $message The message.
* @param array $context The context.
*/
public function critical( $message, array $context = array() ) {
return $this->log( 'critical', $message, $context );
}
/**
* Runtime errors that do not require immediate action but should typically
* be logged and monitored.
*
* @param string $message The message.
* @param array $context The context.
*/
public function error( $message, array $context = array() ) {
return $this->log( 'error', $message, $context );
}
/**
* Exceptional occurrences that are not errors.
*
* Example: Use of deprecated APIs, poor use of an API, undesirable things
* that are not necessarily wrong.
*
* @param string $message The message.
* @param array $context The context.
*/
public function warning( $message, array $context = array() ) {
return $this->log( 'warning', $message, $context );
}
/**
* Normal but significant events.
*
* @param string $message The message.
* @param array $context The context.
*/
public function notice( $message, array $context = array() ) {
return $this->log( 'notice', $message, $context );
}
/**
* Interesting events.
*
* Example: User logs in, SQL logs.
*
* @param string $message The message.
* @param array $context The context.
*/
public function info( $message, array $context = array() ) {
return $this->log( 'info', $message, $context );
}
/**
* Detailed debug information.
*
* @param string $message The message.
* @param array $context The context.
*/
public function debug( $message, array $context = array() ) {
return $this->log( 'debug', $message, $context );
}
/**
* Logs with an arbitrary level.
*
* @param mixed $level The level.
* @param string $message The message.
* @param array $context The context.
*/
public function log( $level, $message, array $context = array() ) {
$this->messages[] = array(
'timestamp' => time(),
'level' => $level,
'message' => $message,
'context' => $context,
);
}
}

View File

@@ -0,0 +1,47 @@
<?php
/**
* WP Importer Logger CLI Class
*
* @package Revision
*/
/**
* WP Importer Logger CLI Class
*/
class CSCO_WPImporterLoggerCLI extends CSCO_WPImporterLogger {
public $min_level = 'notice';
/**
* Logs with an arbitrary level.
*
* @param mixed $level
* @param string $message
* @param array $context
* @return null
*/
public function log( $level, $message, array $context = array() ) {
if ( $this->level_to_numeric( $level ) < $this->level_to_numeric( $this->min_level ) ) {
return;
}
call_user_func( 'printf', '[%s] %s' . PHP_EOL, strtoupper( $level ), $message );
}
public static function level_to_numeric( $level ) {
$levels = array(
'emergency' => 8,
'alert' => 7,
'critical' => 6,
'error' => 5,
'warning' => 4,
'notice' => 3,
'info' => 2,
'debug' => 1,
);
if ( ! isset( $levels[ $level ] ) ) {
return 0;
}
return $levels[ $level ];
}
}

View File

@@ -0,0 +1,20 @@
<?php
/**
* WP Importer Info Class
*/
/**
* WP Importer Info Class
*/
class CSCO_WXRImportInfo {
public $home;
public $siteurl;
public $title;
public $users = array();
public $post_count = 0;
public $media_count = 0;
public $comment_count = 0;
public $term_count = 0;
public $generator = '';
public $version;
}

File diff suppressed because it is too large Load Diff