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

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,180 @@
<?php
/**
* The Capability Manager.
*
* @since 0.9.0
* @package RankMath
* @subpackage RankMath\Role_Manager
* @author Rank Math <support@rankmath.com>
*/
namespace RankMath\Role_Manager;
use RankMath\Helper;
use RankMath\Traits\Hooker;
defined( 'ABSPATH' ) || exit;
/**
* Capability_Manager class.
*/
class Capability_Manager {
use Hooker;
/**
* Registered capabilities.
*
* @var array
*/
protected $capabilities = [];
/**
* Main instance
*
* Ensure only one instance is loaded or can be loaded.
*
* @return Capability_Manager
*/
public static function get() {
static $instance;
if ( is_null( $instance ) && ! ( $instance instanceof Capability_Manager ) ) {
$instance = new Capability_Manager();
$instance->set_capabilities();
}
return $instance;
}
/**
* Set default capabilities.
*
* @codeCoverageIgnore
*/
public function set_capabilities() {
$this->register( 'rank_math_titles', esc_html__( 'Titles & Meta Settings', 'rank-math' ) );
$this->register( 'rank_math_general', esc_html__( 'General Settings', 'rank-math' ) );
$this->register( 'rank_math_sitemap', esc_html__( 'Sitemap Settings', 'rank-math' ) );
$this->register( 'rank_math_404_monitor', esc_html__( '404 Monitor Log', 'rank-math' ) );
$this->register( 'rank_math_link_builder', esc_html__( 'Link Builder', 'rank-math' ) );
$this->register( 'rank_math_redirections', esc_html__( 'Redirections', 'rank-math' ) );
$this->register( 'rank_math_role_manager', esc_html__( 'Role Manager', 'rank-math' ) );
$this->register( 'rank_math_analytics', esc_html__( 'Analytics', 'rank-math' ) );
$this->register( 'rank_math_site_analysis', esc_html__( 'Site-Wide Analysis', 'rank-math' ) );
$this->register( 'rank_math_onpage_analysis', esc_html__( 'On-Page Analysis', 'rank-math' ) );
$this->register( 'rank_math_onpage_general', esc_html__( 'On-Page General Settings', 'rank-math' ) );
$this->register( 'rank_math_onpage_advanced', esc_html__( 'On-Page Advanced Settings', 'rank-math' ) );
$this->register( 'rank_math_onpage_snippet', esc_html__( 'On-Page Schema Settings', 'rank-math' ) );
$this->register( 'rank_math_onpage_social', esc_html__( 'On-Page Social Settings', 'rank-math' ) );
$this->register( 'rank_math_content_ai', esc_html__( 'Content AI', 'rank-math' ) );
$this->register( 'rank_math_admin_bar', esc_html__( 'Top Admin Bar', 'rank-math' ) );
}
/**
* Registers a capability.
*
* @param string $capability Capability to register.
* @param string $title Capability human title.
*/
public function register( $capability, $title ) {
$this->capabilities[ $capability ] = $title;
}
/**
* Get all registered capabilitities.
*
* @param bool $caps Capabilities as keys.
*
* @return string[] Registered capabilities.
*/
public function get_capabilities( $caps = false ) {
return $caps ? array_keys( $this->capabilities ) : $this->capabilities;
}
/**
* Add capabilities on install.
*/
public function create_capabilities() {
foreach ( Helper::get_roles() as $slug => $role ) {
$role = get_role( $slug );
if ( ! $role ) {
continue;
}
$this->loop_capabilities( $this->get_default_capabilities_by_role( $slug ), 'add_cap', $role );
}
}
/**
* Remove capabilities on uninstall.
*/
public function remove_capabilities() {
$capabilities = $this->get_capabilities( true );
foreach ( Helper::get_roles() as $slug => $role ) {
$role = get_role( $slug );
if ( ! $role ) {
continue;
}
$this->loop_capabilities( $capabilities, 'remove_cap', $role );
}
}
/**
* Loop capabilities and perform action.
*
* @param array $caps Capabilities.
* @param string $perform Action to perform.
* @param object $role Role object.
*/
private function loop_capabilities( $caps, $perform, $role ) {
foreach ( $caps as $cap ) {
$role->$perform( $cap );
}
}
/**
* Get default capabilities by roles.
*
* @param string $role Capabilities for this role.
* @return array
*/
private function get_default_capabilities_by_role( $role ) {
if ( 'administrator' === $role ) {
return $this->get_capabilities( true );
}
if ( 'editor' === $role ) {
return [
'rank_math_site_analysis',
'rank_math_onpage_analysis',
'rank_math_onpage_general',
'rank_math_onpage_snippet',
'rank_math_onpage_social',
];
}
if ( 'author' === $role ) {
return [
'rank_math_onpage_analysis',
'rank_math_onpage_general',
'rank_math_onpage_snippet',
'rank_math_onpage_social',
];
}
return [];
}
/**
* Reset capabilities.
*
* @return void
*/
public function reset_capabilities() {
$this->remove_capabilities();
$this->create_capabilities();
}
}

View File

@@ -0,0 +1,76 @@
<?php
/**
* Members plugin integration.
*
* @since 0.9.0
* @package RankMath
* @subpackage RankMath\Role_Manager
* @author Rank Math <support@rankmath.com>
*/
namespace RankMath\Role_Manager;
use RankMath\Traits\Hooker;
use RankMath\Helpers\Param;
defined( 'ABSPATH' ) || exit;
/**
* Members class.
*/
class Members {
use Hooker;
/**
* Members cap group name.
*
* @var string
*/
const GROUP = 'rank_math';
/**
* Class Members constructor.
*/
public function __construct() {
$this->action( 'members_register_caps', 'register_caps' );
$this->action( 'members_register_cap_groups', 'register_cap_groups' );
}
/**
* Registers cap group.
*/
public function register_cap_groups() {
// @phpstan-ignore-next-line
\members_register_cap_group(
self::GROUP,
[
'label' => esc_html__( 'Rank Math', 'rank-math' ),
'caps' => [],
'icon' => 'dashicons-chart-area',
'priority' => 30,
]
);
}
/**
* Registers caps.
*/
public function register_caps() {
$caps = Capability_Manager::get()->get_capabilities();
if ( 'administrator' === Param::get( 'role' ) ) {
$caps['rank_math_edit_htaccess'] = esc_html__( 'Edit .htaccess', 'rank-math' );
}
foreach ( $caps as $key => $value ) {
// @phpstan-ignore-next-line
\members_register_cap(
$key,
[
'label' => html_entity_decode( $value ),
'group' => self::GROUP,
]
);
}
}
}

View File

@@ -0,0 +1,90 @@
<?php
/**
* The Role Manager Module.
*
* @since 0.9.0
* @package RankMath
* @subpackage RankMath\Role_Manager
* @author Rank Math <support@rankmath.com>
*/
namespace RankMath\Role_Manager;
use RankMath\Helper;
use RankMath\Helpers\Param;
use RankMath\Module\Base;
use RankMath\Admin\Page;
use RankMath\Traits\Hooker;
defined( 'ABSPATH' ) || exit;
/**
* Role_Manager class.
*/
class Role_Manager extends Base {
use Hooker;
/**
* The Constructor.
*/
public function __construct() {
$directory = __DIR__;
$this->config(
[
'id' => 'role-manager',
'directory' => $directory,
]
);
parent::__construct();
// Members plugin integration.
if ( \function_exists( 'members_plugin' ) ) {
new Members();
}
// User Role Editor plugin integration.
if ( defined( 'URE_PLUGIN_URL' ) ) {
new User_Role_Editor();
}
}
/**
* Register admin page.
*/
public function register_admin_page() {
$uri = untrailingslashit( plugin_dir_url( __FILE__ ) );
$this->page = new Page(
'rank-math-role-manager',
esc_html__( 'Role Manager', 'rank-math' ),
[
'position' => 20,
'parent' => 'rank-math',
'capability' => 'rank_math_role_manager',
'classes' => [ 'rank-math-page' ],
'render' => 'settings',
'assets' => [
'styles' => [
'rank-math-common' => '',
'wp-components' => '',
],
'scripts' => [
'lodash' => '',
'wp-element' => '',
'wp-data' => '',
'wp-components' => '',
'wp-api-fetch' => '',
'rank-math-components' => '',
'rank-math-role-manager' => $uri . '/assets/js/role-manager.js',
],
'json' => [
'roles' => Helper::get_roles(),
'data' => Helper::get_roles_capabilities(),
'capabilities' => Capability_Manager::get()->get_capabilities(),
],
],
]
);
}
}

View File

@@ -0,0 +1,81 @@
<?php
/**
* User Role Editor plugin integration.
*
* @since 0.9.0
* @package RankMath
* @subpackage RankMath\Role_Manager
* @author Rank Math <support@rankmath.com>
*/
namespace RankMath\Role_Manager;
use RankMath\Traits\Hooker;
defined( 'ABSPATH' ) || exit;
/**
* User_Role_Editor class.
*/
class User_Role_Editor {
use Hooker;
/**
* Members cap group name.
*
* @var string
*/
const GROUP = 'rank_math';
/**
* Hold caps.
*
* @var array
*/
private $caps = [];
/**
* Class constructor.
*/
public function __construct() {
$this->filter( 'ure_capabilities_groups_tree', 'register_group' );
$this->filter( 'ure_custom_capability_groups', 'register_capability_groups', 10, 2 );
$this->caps = Capability_Manager::get()->get_capabilities();
}
/**
* Adds Rank Math capability group in the User Role Editor plugin.
*
* @param array $groups Current groups.
* @return array Filtered list of capabilty groups.
*/
public function register_group( $groups = [] ) {
$groups = (array) $groups;
$groups[ self::GROUP ] = [
'caption' => esc_html__( 'Rank Math', 'rank-math' ),
'parent' => 'custom',
'level' => 3,
];
return $groups;
}
/**
* Adds capabilities to the Rank Math group in the User Role Editor plugin.
*
* @param array $groups Current capability groups.
* @param string $cap_id Capability identifier.
* @return array List of filtered groups.
*/
public function register_capability_groups( $groups = [], $cap_id = '' ) {
if ( array_key_exists( $cap_id, $this->caps ) ) {
$groups = (array) $groups;
$groups[] = self::GROUP;
}
return $groups;
}
}

View File

@@ -0,0 +1 @@
<?php // Silence is golden.