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,154 @@
<?php
namespace FluentMail\Includes\Core;
use ArrayAccess;
use FluentMail\Includes\View\View;
use FluentMail\Includes\Core\CoreTrait;
use FluentMail\Includes\Core\Container;
use FluentMail\Includes\Request\Request;
use FluentMail\Includes\Response\Response;
final class Application extends Container
{
use CoreTrait;
private $policyNamespace = 'FluentMail\App\Http\Policies';
private $handlerNamespace = 'FluentMail\App\Hooks\Handlers';
private $controllerNamespace = 'FluentMail\App\Http\Controllers';
public function __construct()
{
$this->setApplicationInstance();
$this->registerPluginPathsAndUrls();
$this->registerFrameworkComponents();
$this->requireCommonFilesForRequest($this);
load_plugin_textdomain('fluent-smtp', false, 'fluent-smtp/language/');
/*
* We are adding fluent-smtp/fluent-smtp.php at the top to load the wp_mail at the very first
* There has no other way to load a specific plugin at the first.
*/
add_filter('pre_update_option_active_plugins', function ($plugins) {
$index = array_search('fluent-smtp/fluent-smtp.php', $plugins);
if ($index !== false) {
if ($index === 0) {
return $plugins;
}
unset($plugins[$index]);
array_unshift($plugins, 'fluent-smtp/fluent-smtp.php');
}
return $plugins;
});
add_action('admin_notices', function () {
if (!current_user_can('manage_options')) {
return;
}
$settings = get_option('fluentmail-settings');
if (!$settings || empty($settings['use_encrypt']) || empty($settings['test'])) {
return;
}
$testData = fluentMailEncryptDecrypt($settings['test'], 'd');
if ($testData == 'test') {
return;
}
?>
<div class="notice notice-warning fluentsmtp_urgent is-dismissible">
<p>
FluentSMTP Plugin may not work properly. Looks like your Authentication unique keys and salts are changed. <a href="<?php echo esc_url(admin_url('options-general.php?page=fluent-mail#/connections')); ?>"><b>Reconfigure SMTP Settings</b></a>
</p>
</div>
<?php
});
}
private function setApplicationInstance()
{
static::setInstance($this);
$this->instance('app', $this);
$this->instance(__CLASS__, $this);
}
private function registerPluginPathsAndUrls()
{
// Paths
$this['path'] = FLUENTMAIL_PLUGIN_PATH;
$this['path.app'] = FLUENTMAIL_PLUGIN_PATH . 'app/';
$this['path.hooks'] = FLUENTMAIL_PLUGIN_PATH . 'app/Hooks/';
$this['path.models'] = FLUENTMAIL_PLUGIN_PATH . 'app/models/';
$this['path.includes'] = FLUENTMAIL_PLUGIN_PATH . 'includes/';
$this['path.controllers'] = FLUENTMAIL_PLUGIN_PATH . 'app/Http/controllers/';
$this['path.views'] = FLUENTMAIL_PLUGIN_PATH . 'app/views/';
$this['path.admin.css'] = FLUENTMAIL_PLUGIN_PATH . 'assets/admin/css/';
$this['path.admin.js'] = FLUENTMAIL_PLUGIN_PATH . 'assets/admin/js/';
$this['path.public.css'] = FLUENTMAIL_PLUGIN_PATH . 'assets/public/css/';
$this['path.public.js'] = FLUENTMAIL_PLUGIN_PATH . 'assets/public/js/';
$this['path.assets'] = FLUENTMAIL_PLUGIN_PATH . 'assets/';
// Urls
$this['url'] = FLUENTMAIL_PLUGIN_URL;
$this['url.app'] = FLUENTMAIL_PLUGIN_URL . 'app/';
$this['url.assets'] = FLUENTMAIL_PLUGIN_URL . 'assets/';
$this['url.public.css'] = FLUENTMAIL_PLUGIN_URL . 'assets/public/css/';
$this['url.admin.css'] = FLUENTMAIL_PLUGIN_URL . 'assets/admin/css/';
$this['url.public.js'] = FLUENTMAIL_PLUGIN_URL . 'assets/public/js/';
$this['url.admin.js'] = FLUENTMAIL_PLUGIN_URL . 'assets/admin/js/';
$this['url.assets.images'] = FLUENTMAIL_PLUGIN_URL . 'assets/images/';
}
private function registerFrameworkComponents()
{
$this->bind('FluentMail\Includes\View\View', function ($app) {
return new View($app);
});
$this->alias('FluentMail\Includes\View\View', 'view');
$this->singleton('FluentMail\Includes\Request\Request', function ($app) {
return new Request($app, $_GET, $_POST, $_FILES);
});
$this->alias('FluentMail\Includes\Request\Request', 'request');
$this->singleton('FluentMail\Includes\Response\Response', function ($app) {
return new Response($app);
});
$this->alias('FluentMail\Includes\Response\Response', 'response');
}
/**
* Require all the common files that needs to be loaded on each request
*
* @param Application $app [$app is being used inside required files]
* @return void
*/
private function requireCommonFilesForRequest($app)
{
// Require Application Bindings
require_once($app['path.app'] . '/Bindings.php');
// Require Global Functions
require_once($app['path.app'] . '/Functions/helpers.php');
// Require Action Hooks
require_once($app['path.app'] . '/Hooks/actions.php');
// Require Filter Hooks
require_once($app['path.app'] . '/Hooks/filters.php');
// Require Routes
if (is_admin()) {
require_once($app['path.app'] . '/Http/routes.php');
}
}
}

View File

@@ -0,0 +1,5 @@
<?php
namespace FluentMail\Includes\Core;
class BindingResolutionException extends \Exception {}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,143 @@
<?php
namespace FluentMail\Includes\Core;
use Closure;
interface ContainerContract
{
/**
* Determine if the given abstract type has been bound.
*
* @param string $abstract
* @return bool
*/
public function bound($abstract);
/**
* Alias a type to a different name.
*
* @param string $abstract
* @param string $alias
* @return void
*/
public function alias($abstract, $alias);
/**
* Assign a set of tags to a given binding.
*
* @param array|string $abstracts
* @param array|mixed ...$tags
* @return void
*/
public function tag($abstracts, $tags);
/**
* Resolve all of the bindings for a given tag.
*
* @param array $tag
* @return array
*/
public function tagged($tag);
/**
* Register a binding with the container.
*
* @param string|array $abstract
* @param Closure|string|null $concrete
* @param bool $shared
* @return void
*/
public function bind($abstract, $concrete = null, $shared = false);
/**
* Register a binding if it hasn't already been registered.
*
* @param string $abstract
* @param Closure|string|null $concrete
* @param bool $shared
* @return void
*/
public function bindIf($abstract, $concrete = null, $shared = false);
/**
* Register a shared binding in the container.
*
* @param string $abstract
* @param Closure|string|null $concrete
* @return void
*/
public function singleton($abstract, $concrete = null);
/**
* "Extend" an abstract type in the container.
*
* @param string $abstract
* @param Closure $closure
* @return void
*
* @throws \InvalidArgumentException
*/
public function extend($abstract, Closure $closure);
/**
* Register an existing instance as shared in the container.
*
* @param string $abstract
* @param mixed $instance
* @return void
*/
public function instance($abstract, $instance);
/**
* Define a contextual binding.
*
* @param string $concrete
* @return ContextualBindingBuilder
*/
public function when($concrete);
/**
* Resolve the given type from the container.
*
* @param string $abstract
* @param array $parameters
* @return mixed
*/
public function make($abstract, $parameters = array());
/**
* Call the given Closure / class@method and inject its dependencies.
*
* @param callable|string $callback
* @param array $parameters
* @param string|null $defaultMethod
* @return mixed
*/
public function call($callback, array $parameters = array(), $defaultMethod = null);
/**
* Determine if the given abstract type has been resolved.
*
* @param string $abstract
* @return bool
*/
public function resolved($abstract);
/**
* Register a new resolving callback.
*
* @param string $abstract
* @param Closure $callback
* @return void
*/
public function resolving($abstract, ?Closure $callback = null);
/**
* Register a new after resolving callback.
*
* @param string $abstract
* @param Closure $callback
* @return void
*/
public function afterResolving($abstract, ?Closure $callback = null);
}

View File

@@ -0,0 +1,60 @@
<?php
namespace FluentMail\Includes\Core;
use FluentMail\Includes\Support\Contracts\ContextualBindingBuilderContract;
class ContextualBindingBuilder implements ContextualBindingBuilderContract
{
/**
* The underlying container instance.
*
* @var FluentMail\Includes\Core\Container
*/
protected $container;
/**
* The concrete instance.
*
* @var string
*/
protected $concrete;
/**
* Create a new contextual binding builder.
*
* @param FluentMail\Includes\Core\Container $container
* @param string $concrete
* @return void
*/
public function __construct(Container $container, $concrete)
{
$this->concrete = $concrete;
$this->container = $container;
}
/**
* Define the abstract target that depends on the context.
*
* @param string $abstract
* @return $this
*/
public function needs($abstract)
{
$this->needs = $abstract;
return $this;
}
/**
* Define the implementation for the contextual binding.
*
* @param Closure|string $implementation
* @return void
*/
public function give($implementation)
{
$this->container->addContextualBinding(
$this->concrete, $this->needs, $implementation
);
}
}

View File

@@ -0,0 +1,164 @@
<?php
namespace FluentMail\Includes\Core;
use FluentMail\Includes\Support\ForbiddenException;
trait CoreTrait
{
public function get($action, $handler, $isAdmin = true)
{
$action = $this->getAjaxAction($action, 'get', $isAdmin);
return add_action($action, $this->parseAjaxHandler($handler));
}
public function getPublic($action, $handler)
{
$this->get($action, $handler, false);
}
public function post($action, $handler, $isAdmin = true)
{
$action = $this->getAjaxAction($action, 'post', $isAdmin);
return add_action($action, function() use ($handler) {
try {
$slug = FLUENTMAIL;
if (check_ajax_referer($slug, 'nonce', false)) {
$method = $this->parseAjaxHandler($handler);
return $method();
}
throw new ForbiddenException('Forbidden!', 401);
} catch (ForbiddenException $e) {
return $this->docustomAction('handle_exception', $e);
}
});
}
public function postPublic($action, $handler)
{
$this->post($action, $handler, false);
}
public function getAjaxAction($action, $method, $isAdmin)
{
$context = $isAdmin ? 'wp_ajax_' : 'wp_ajax_nopriv_';
$action = $action == '/' ? $action : ltrim($action, '/');
return $context.$this->hook($method.'-'.$action);
}
public function hook($hook)
{
return FLUENTMAIL . '-' . $hook;
}
public function parseAjaxHandler($handler)
{
if (!$handler) return;
if (is_string($handler)) {
$handler = $this->controllerNamespace . '\\' . $handler;
} else if (is_array($handler)) {
list($class, $method) = $handler;
if (is_string($class)) {
$handler = $this->controllerNamespace . '\\' . $class . '::' . $method;
}
}
return function() use ($handler) {
return $this->call($handler);
};
}
public function addAction($action, $handler, $priority = 10, $numOfArgs = 1)
{
return add_action(
$action,
$this->parseHookHandler($handler),
$priority,
$numOfArgs
);
}
public function addCustomAction($action, $handler, $priority = 10, $numOfArgs = 1)
{
return $this->addAction($this->hook($action), $handler, $priority, $numOfArgs);
}
public function doAction()
{
return call_user_func_array('do_action', func_get_args());
}
public function doCustomAction()
{
$args = func_get_args();
$args[0] = $this->hook($args[0]);
return call_user_func_array('do_action', $args);
}
public function addFilter($action, $handler, $priority = 10, $numOfArgs = 1)
{
return add_filter(
$action,
$this->parseHookHandler($handler),
$priority,
$numOfArgs
);
}
public function addCustomFilter($action, $handler, $priority = 10, $numOfArgs = 1)
{
return $this->addFilter($this->hook($action), $handler, $priority, $numOfArgs);
}
public function applyFilters()
{
return call_user_func_array('apply_filters', func_get_args());
}
public function applyCustomFilters()
{
$args = func_get_args();
$args[0] = $this->hook($args[0]);
return call_user_func_array('apply_filters', $args);
}
public function parseHookHandler($handler)
{
if (is_string($handler)) {
list($class, $method) = preg_split('/::|@/', $handler);
if ($this->hasNamespace($handler)) {
$class = $this->make($class);
} else {
$class = $this->make($this->handlerNamespace . '\\' . $class);
}
return [$class, $method];
} else if (is_array($handler)) {
list($class, $method) = $handler;
if (is_string($class)) {
if ($this->hasNamespace($handler)) {
$class = $this->make($class);
} else {
$class = $this->make($this->handlerNamespace . '\\' . $class);
}
}
return [$class, $method];
}
return $handler;
}
public function hasNamespace($handler)
{
$parts = explode('\\', $handler);
return count($parts) > 1;
}
}

View File

@@ -0,0 +1,32 @@
<?php
namespace FluentMail\Includes\Core;
use ReflectionParameter;
use ReflectionNamedType;
class Reflection
{
private static function isPhp8OrHigher()
{
return PHP_VERSION_ID >= 80000;
}
public static function getClassName(ReflectionParameter $parameter)
{
if (static::isPhp8OrHigher()) {
$type = $parameter->getType();
if ($type instanceof ReflectionNamedType && !$type->isBuiltin()) {
return $type->getName();
}
return null;
}
$class = $parameter->getClass();
return $class ? $class->getName() : null;
}
}