Commit inicial - WordPress Análisis de Precios Unitarios

- WordPress core y plugins
- Tema Twenty Twenty-Four configurado
- Plugin allow-unfiltered-html.php simplificado
- .gitignore configurado para excluir wp-config.php y uploads

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
root
2025-11-03 21:04:30 -06:00
commit a22573bf0b
24068 changed files with 4993111 additions and 0 deletions

View File

@@ -0,0 +1,64 @@
<?php
namespace bizpanda\includes\gates\exceptions;
use Throwable;
/**
* An exception which shows the error for public.
*/
class GateBridgeException extends GateException {
const UNEXPECTED_RESPONSE = 'gate.bridge.unexpected-response';
const ERROR_RESPONSE = 'gate.bridge.error-response';
const NOT_AUTHENTICATED = 'gate.bridge.not-supported';
const NOT_SUPPORTED = 'gate.bridge.not-supported';
public static function create( $code, $details = [] ) {
$baseData = [
'code' => $code,
'details' => $details
];
$exceptionData = [];
switch ( $code ) {
case self::UNEXPECTED_RESPONSE:
$exceptionData = [
'priority' => GateExceptionPriority::HIGH,
'message' => 'Unexpected response.'
];
break;
case self::ERROR_RESPONSE:
$exceptionData = [
'priority' => GateExceptionPriority::NORMAL,
'message' => 'Error occurred during the request.'
];
break;
case self::NOT_AUTHENTICATED:
$exceptionData = [
'priority' => GateExceptionPriority::HIGH,
'message' => 'Authentication failed.'
];
break;
case self::NOT_SUPPORTED:
$exceptionData = [
'priority' => GateExceptionPriority::HIGH,
'message' => 'The method is not supported.',
];
break;
}
$exceptionData = array_merge($baseData, $exceptionData);
return new GateBridgeException($exceptionData);
}
}

View File

@@ -0,0 +1,128 @@
<?php
namespace bizpanda\includes\gates\exceptions;
/**
* An exception that shows the error for public.
*/
class GateException extends \Exception {
const INVALID_INBOUND_REQUEST = 'gate.invalid-request';
const SCOPE_MISSED = 'gate.scope-missed';
const APP_NOT_CONFIGURED = 'gate.app-not-configured';
const AUTH_FLOW_BROKEN = 'gate.auth-flow-broken';
const INVALID_VISITOR_ID = 'gate.invalid-visitor-id';
public static function create( $code, $details = [] ) {
if ( is_string( $details ) ) {
$details = [
'clarification' => $details
];
}
$exceptionData = [];
$baseData = [
'code' => $code,
'details' => $details
];
switch ( $code ) {
case self::INVALID_INBOUND_REQUEST:
$exceptionData = [
'priority' => GateExceptionPriority::HIGH,
'message' => 'Invalid request type.'
];
break;
case self::SCOPE_MISSED:
$exceptionData = [
'priority' => GateExceptionPriority::HIGH,
'message' => 'The scope is not set.'
];
break;
case self::APP_NOT_CONFIGURED:
$exceptionData = [
'priority' => GateExceptionPriority::HIGH,
'message' => 'The app is not configured properly.',
];
break;
case self::AUTH_FLOW_BROKEN:
$exceptionData = [
'priority' => GateExceptionPriority::HIGH,
'message' => 'Authorization flow broken. Please try again.',
];
break;
case self::INVALID_VISITOR_ID:
$exceptionData = [
'priority' => GateExceptionPriority::HIGH,
'message' => 'Invalid Visitor ID.',
];
break;
}
$exceptionData = array_merge($baseData, $exceptionData);
throw new GateException($exceptionData);
}
protected $exceptionCode = null;
protected $exceptionDetails = null;
protected $exceptionPriority = null;
public function __construct( $data )
{
parent::__construct($data['message'], 0, null);
$this->exceptionPriority = isset( $data['priority'] ) ? $data['priority'] : GateExceptionPriority::NORMAL;
$this->exceptionCode = $data['code'];
$this->exceptionDetails = $data['details'];
}
public function getExceptionCode() {
return $this->exceptionCode;
}
public function getExceptionDetails() {
return $this->exceptionDetails;
}
public function getExceptionPriority() {
return !empty( $this->exceptionPriority ) ? $this->exceptionPriority : GateExceptionPriority::NORMAL;
}
public function getExceptionVisibleMessage() {
$error = $this->getMessage();
if ( isset( $this->exceptionDetails['clarification'] ) ) {
$error = trim($error, '.') . '. ' . trim( $this->exceptionDetails['clarification'], '.' ) . '.';
}
return $error;
}
/**
* Returns exception data to log.
* @return array
*/
public function getDataToLog() {
return [
'code' => $this->exceptionCode,
'message' => $this->getExceptionVisibleMessage(),
'details' => $this->getExceptionDetails(),
'priority' => $this->getExceptionPriority(),
'trace' => $this->getTraceAsString()
];
}
}

View File

@@ -0,0 +1,13 @@
<?php
namespace bizpanda\includes\gates\exceptions;
/**
* Priorities of Gate Exceptions
*/
class GateExceptionPriority extends \Exception {
const LOW = 'low';
const NORMAL = 'normal';
const HIGH = 'high';
}