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 @@
<?php // Silence is golden.

View File

@@ -0,0 +1,91 @@
<?php
/**
* Membership Level settings
*
* @package RCP\Custom_Redirects\Admin\Subscription\Fields
* @since 1.0.0
*/
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Add per-level setting fields
*
* @since 1.0.0
* @return void
*/
function rcp_custom_redirects_add_redirect_settings() {
?>
<tr class="form-field">
<th scope="row" valign="top">
<label for="rcp-custom-redirects-subscription-url"><?php _e( 'Registration Redirect URL', 'rcp' ); ?></label>
</th>
<td>
<?php
$subscription_url = ( isset( $_GET['edit_subscription'] ) ? rcp_custom_redirects_get_url( 'subscription', $_GET['edit_subscription'] ) : '' );
echo '<input type="text" name="rcp-custom-redirects-subscription-url" id="rcp-custom-redirects-subscription-url" value="' . esc_attr( $subscription_url ) . '" style="width: 300px;" />';
echo '<p class="description">' . __( 'The URL to redirect customers to after registration.', 'rcp' ) . '</p>';
?>
</td>
</tr>
<tr class="form-field">
<th scope="row" valign="top">
<label for="rcp-custom-redirects-login-url"><?php _e( 'Login Redirect URL', 'rcp' ); ?></label>
</th>
<td>
<?php
$login_url = ( isset( $_GET['edit_subscription'] ) ? rcp_custom_redirects_get_url( 'login', $_GET['edit_subscription'] ) : '' );
echo '<input type="text" name="rcp-custom-redirects-login-url" id="rcp-custom-redirects-login-url" value="' . esc_attr( $login_url ) . '" style="width: 300px;" />';
echo '<p class="description">' . __( 'The URL to redirect customers to after login.', 'rcp' ) . '</p>';
?>
</td>
</tr>
<?php
}
add_action( 'rcp_add_subscription_form', 'rcp_custom_redirects_add_redirect_settings' );
add_action( 'rcp_edit_subscription_form', 'rcp_custom_redirects_add_redirect_settings' );
/**
* Store the redirect URL in subscription meta
*
* @since 1.0.0
* @param int $level_id The subscription ID
* @param array $args Arguements passed to the action
*/
function rcp_custom_redirects_save( $level_id = 0, $args = array() ) {
if ( isset( $_POST['rcp-custom-redirects-subscription-url'] ) ) {
$url = $_POST['rcp-custom-redirects-subscription-url'];
$subscription_urls = get_option( 'rcp_custom_redirects_subscription_urls', array() );
if ( ! empty( $url ) ) {
$subscription_urls[ $level_id ] = sanitize_text_field( $url );
} elseif ( is_array( $subscription_urls ) && array_key_exists( $level_id, $subscription_urls ) ) {
unset( $subscription_urls[ $level_id ] );
}
update_option( 'rcp_custom_redirects_subscription_urls', $subscription_urls );
}
if ( isset( $_POST['rcp-custom-redirects-login-url'] ) ) {
$url = $_POST['rcp-custom-redirects-login-url'];
$login_urls = get_option( 'rcp_custom_redirects_login_urls', array() );
if ( ! empty( $url ) ) {
$login_urls[ $level_id ] = sanitize_text_field( $url );
} elseif ( is_array( $login_urls ) && array_key_exists( $level_id, $login_urls ) ) {
unset( $login_urls[ $level_id ] );
}
update_option( 'rcp_custom_redirects_login_urls', $login_urls );
}
}
add_action( 'rcp_add_subscription', 'rcp_custom_redirects_save', 10, 2 );
add_action( 'rcp_edit_subscription_level', 'rcp_custom_redirects_save', 10, 2 );

View File

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

View File

@@ -0,0 +1,130 @@
<?PHP
if ( ! class_exists( 'RCP_Custom_Redirects' ) ) {
/**
* Main RCP_Custom_Redirects class
*
* @since 1.0.0
*/
class RCP_Custom_Redirects {
/**
* @var RCP_Custom_Redirects $instance The one true RCP_Custom_Redirects
* @since 1.0.0
*/
private static $instance;
/**
* Get active instance
*
* @access public
* @since 1.0.0
* @return object self::$instance The one true RCP_Custom_Redirects
*/
public static function instance() {
if ( ! self::$instance ) {
self::$instance = new RCP_Custom_Redirects();
self::$instance->setup_constants();
self::$instance->includes();
self::$instance->hooks();
}
return self::$instance;
}
/**
* Setup plugin constants
*
* @access private
* @since 1.0.0
* @return void
*/
public function setup_constants() {
// Plugin version
define( 'RCP_CUSTOM_REDIRECTS_VER', '1.0.6' );
// Plugin path
define( 'RCP_CUSTOM_REDIRECTS_DIR', plugin_dir_path( __FILE__ ) );
// Plugin URL
define( 'RCP_CUSTOM_REDIRECTS_URL', plugin_dir_url( __FILE__ ) );
}
/**
* Include necessary files
*
* @access private
* @since 1.0.0
* @return void
*/
private function includes() {
require_once RCP_CUSTOM_REDIRECTS_DIR . 'includes/functions.php';
require_once RCP_CUSTOM_REDIRECTS_DIR . 'includes/filters.php';
require_once RCP_CUSTOM_REDIRECTS_DIR . 'includes/actions.php';
if ( is_admin() ) {
require_once RCP_CUSTOM_REDIRECTS_DIR . 'admin/subscription/fields.php';
}
}
/**
* Run action and filter hooks
*
* @access private
* @since 1.0.0
* @return void
*/
private function hooks() {
if ( class_exists( 'RCP_Add_On_Updater' ) ) {
$updater = new RCP_Add_On_Updater( 449, __FILE__, RCP_CUSTOM_REDIRECTS_VER );
}
}
}
}
/**
* The main function responsible for returning the one true RCP_Custom_Redirects
* instance to functions everywhere
*
* @since 1.0.0
* @return RCP_Custom_Redirects The one true RCP_Custom_Redirects
*/
function rcp_check_and_deactivate_cr_plugin() {
// Check if Custom redirects plugin is activated and deactivates if it is
if ( is_plugin_active( 'rcp-custom-redirects/rcp-custom-redirects.php' ) ) {
deactivate_plugins( 'rcp-custom-redirects/rcp-custom-redirects.php' );
add_action( 'admin_notices', 'rcp_cr_plugin_deactivated_notice' );
}
}
function rcp_cr_plugin_deactivated_notice() {
?>
<div class="notice notice-warning is-dismissible">
<p><?php _e( 'The Custom Redirects addon has been deactivated since its functionality is now included in the RCP core plugin.', 'rcp' ); ?></p>
</div>
<?php
}
add_action( 'plugins_loaded', 'rcp_check_and_deactivate_cr_plugin' );
function rcp_custom_redirects_addon() {
if ( is_plugin_active( 'rcp-custom-redirects/rcp-custom-redirects.php' ) ) {
return;
}
return RCP_Custom_Redirects::instance();
}
add_action( 'plugins_loaded', 'rcp_custom_redirects_addon' );

View File

@@ -0,0 +1,98 @@
<?php
/**
* Filters
*
* @package RCP\Custom_Redirects\Actions
* @since 1.0.0
*/
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Override the RCP login form processing
*
* @since 1.0.0
* @return void
*/
function rcp_custom_redirects_process_login_form() {
if ( ! isset( $_POST['rcp_action'] ) || 'login' != $_POST['rcp_action'] ) {
return;
}
if ( ! isset( $_POST['rcp_login_nonce'] ) || ! wp_verify_nonce( $_POST['rcp_login_nonce'], 'rcp-login-nonce' ) ) {
return;
}
if ( is_email( $_POST['rcp_user_login'] ) && ! username_exists( $_POST['rcp_user_login'] ) ) {
$user = get_user_by( 'email', $_POST['rcp_user_login'] );
} else {
// This returns the user ID and other info from the user name
$user = get_user_by( 'login', $_POST['rcp_user_login'] );
}
do_action( 'rcp_before_form_errors', $_POST );
if ( ! $user ) {
// If the user name doesn't exist
rcp_errors()->add( 'empty_username', __( 'Invalid username or email', 'rcp' ), 'login' );
}
if ( ! isset( $_POST['rcp_user_pass'] ) || $_POST['rcp_user_pass'] == '' ) {
// If no password was entered
rcp_errors()->add( 'empty_password', __( 'Please enter a password', 'rcp' ), 'login' );
}
if ( $user ) {
// Check the user's login with their password
if ( ! wp_check_password( $_POST['rcp_user_pass'], $user->user_pass, $user->ID ) ) {
// If the password is incorrect for the specified user
rcp_errors()->add( 'empty_password', __( 'Incorrect password', 'rcp' ), 'login' );
}
}
if ( function_exists( 'is_limit_login_ok' ) && ! is_limit_login_ok() ) {
rcp_errors()->add( 'limit_login_failed', limit_login_error_msg(), 'login' );
}
do_action( 'rcp_login_form_errors', $_POST );
// Retrieve all error messages
$errors = rcp_errors()->get_error_messages();
// Only log the user in if there are no errors
if ( empty( $errors ) ) {
$remember = isset( $_POST['rcp_user_remember'] );
$redirect = ! empty( $_POST['rcp_redirect'] ) ? $_POST['rcp_redirect'] : home_url();
$level_id = rcp_get_subscription_id( $user->ID );
$redirect_urls = get_option( 'rcp_custom_redirects_login_urls' );
if ( is_array( $redirect_urls ) && array_key_exists( $level_id, $redirect_urls ) ) {
if ( $redirect_urls[ $level_id ] !== '' ) {
$redirect = $redirect_urls[ $level_id ];
}
}
rcp_login_user_in( $user->ID, $_POST['rcp_user_login'], $remember );
// Redirect the user back to the appropriate page
wp_redirect( $redirect );
exit;
} else {
if ( function_exists( 'limit_login_failed' ) ) {
limit_login_failed( $_POST['rcp_user_login'] );
}
}
}
// Only use our login override if not on version 2.8.2+.
if ( ! defined( 'RCP_PLUGIN_VERSION' ) || version_compare( RCP_PLUGIN_VERSION, '2.8.2', '<' ) ) {
remove_action( 'init', 'rcp_process_login_form' );
add_action( 'init', 'rcp_custom_redirects_process_login_form' );
}

View File

@@ -0,0 +1,162 @@
<?php
/**
* Filters
*
* @package RCP\Custom_Redirects\Filters
* @since 1.0.0
*/
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Filter registration return URLs
*
* @since 1.0.0
* @param string $redirect The current redirect URL
* @param int $user_id The ID for the logged in user
* @return string $redirect The redirect URL
*/
function rcp_custom_redirects_get_return_url( $redirect, $user_id ) {
$level_id = rcp_get_registration()->get_membership_level_id();
$redirect_urls = get_option( 'rcp_custom_redirects_subscription_urls' );
// Level ID won't be available via the registration class in PayPal Express due to the confirmation page.
if ( empty( $level_id ) ) {
if ( function_exists( 'rcp_get_customer_by_user_id' ) ) {
/**
* RCP 3.0 and higher
*/
$customer = rcp_get_customer_by_user_id( $user_id );
if ( empty( $customer ) ) {
return $redirect;
}
// Get most recently modified membership.
$memberships = $customer->get_memberships(
array(
'status__in' => array( 'pending', 'active' ),
'orderby' => 'date_modified',
'order' => 'DESC',
)
);
if ( empty( $memberships ) || empty( $memberships[0] ) ) {
return $redirect;
}
$level_id = $memberships[0]->get_object_id();
} else {
/**
* RCP 2.9 and lower
*/
$member = new RCP_Member( $user_id );
$level_id = $member->get_pending_subscription_id();
if ( empty( $level_id ) ) {
$level_id = $member->get_subscription_id();
}
}
}
if ( empty( $level_id ) ) {
return $redirect;
}
if ( is_array( $redirect_urls ) && array_key_exists( $level_id, $redirect_urls ) ) {
if ( $redirect_urls[ $level_id ] !== '' ) {
$redirect = $redirect_urls[ $level_id ];
}
}
return $redirect;
}
add_filter( 'rcp_return_url', 'rcp_custom_redirects_get_return_url', 10, 2 );
/**
* Filter login redirect URL
*
* @param string $redirect The current redirect URL.
* @param WP_User $user Object for the user logging in.
*
* @since 1.0.1
* @return string $redirect The new redirect URL.
*/
function rcp_custom_redirects_get_login_redirect_url( $redirect, $user ) {
if ( function_exists( 'rcp_get_customer_by_user_id' ) ) {
/**
* RCP 3.0+
*/
$customer = rcp_get_customer_by_user_id( $user->ID );
if ( empty( $customer ) ) {
return $redirect;
}
// Order by price so that the highest price one takes priority.
$memberships = $customer->get_memberships(
array(
'status__in' => array( 'active', 'cancelled' ),
)
);
if ( empty( $memberships ) || empty( $memberships[0] ) ) {
return $redirect;
}
/**
* @var RCP_Membership $membership
*/
$membership = false;
// Determine the highest priced membership.
foreach ( $memberships as $this_membership ) {
/**
* @var RCP_Membership $this_membership
*/
if ( empty( $membership ) ) {
$membership = $this_membership;
continue;
} else {
$high_value = max( $this_membership->get_initial_amount(), $this_membership->get_recurring_amount() );
if ( $high_value > max( $membership->get_initial_amount(), $membership->get_recurring_amount() ) ) {
$membership = $this_membership;
}
}
}
$level_id = $membership->get_object_id();
} else {
/**
* RCP 2.9 and lower
*/
$level_id = rcp_get_subscription_id( $user->ID );
}
$redirect_urls = get_option( 'rcp_custom_redirects_login_urls' );
if ( empty( $level_id ) ) {
return $redirect;
}
if ( is_array( $redirect_urls ) && array_key_exists( $level_id, $redirect_urls ) ) {
if ( ! empty( $redirect_urls[ $level_id ] ) ) {
$redirect = $redirect_urls[ $level_id ];
}
}
return $redirect;
}
add_filter( 'rcp_login_redirect_url', 'rcp_custom_redirects_get_login_redirect_url', 10, 2 );

View File

@@ -0,0 +1,46 @@
<?php
/**
* Helper functions
*
* @package RCP\Custom_Redirects\Functions
* @since 1.0.0
*/
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Retrieve the URL for a given level
*
* @since 1.0.0
* @param string $url_type Whether to retrieve a subscription or login URL
* @param int $level_id The ID of the level to retrieve the URL for
* @return string $url The URL for the given level
*/
function rcp_custom_redirects_get_url( $url_type = 'subscription', $level_id = false ) {
$url = '';
if ( $level_id ) {
switch ( $url_type ) {
case 'subscription':
$redirect_urls = get_option( 'rcp_custom_redirects_subscription_urls' );
break;
case 'login':
$redirect_urls = get_option( 'rcp_custom_redirects_login_urls' );
break;
default:
$redirect_urls = apply_filters( 'rcp_custom_redirects_urls', array(), $url_type, $level_id );
break;
}
if ( is_array( $redirect_urls ) && array_key_exists( $level_id, $redirect_urls ) ) {
$url = $redirect_urls[ $level_id ];
}
}
return $url;
}

View File

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

View File

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

View File

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