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,139 @@
<?php
/**
* Responsive Ads Admin.
*
* @package Advanced_Ads_Pro\Module
* @subpackage Responsive_Ads
* @author Advanced Ads <info@wpadvancedads.com>
*/
namespace Advanced_Ads_Pro\Module\Responsive_Ads;
use Advanced_Ads_Pro;
defined( 'ABSPATH' ) || exit;
/**
* Class Admin
*/
class Admin {
/**
* Hook into WordPress.
*/
public function hooks(): void {
add_action( 'advanced-ads-settings-init', [ $this, 'add_settings' ] );
}
/**
* Add settings for module
*
* @return void
*/
public function add_settings() {
$section_id = 'advanced_ads_responsive_setting_section';
add_settings_section(
$section_id,
__( 'Responsive Ads', 'advanced-ads-pro' ),
null,
Advanced_Ads_Pro::OPTION_KEY . '-settings'
);
add_settings_field(
'responsive-images',
esc_html__( 'Responsive Image Ads', 'advanced-ads-pro' ),
[ $this, 'render_setting_responsive_image_ads' ],
Advanced_Ads_Pro::OPTION_KEY . '-settings',
$section_id
);
add_settings_field(
'reload-ads-on-resize',
esc_html__( 'Reload ads on resize', 'advanced-ads-pro' ),
[ $this, 'render_settings_reload_ads_on_resize' ],
Advanced_Ads_Pro::OPTION_KEY . '-settings',
$section_id
);
add_settings_field(
'fallback-width',
esc_html__( 'Fallback width', 'advanced-ads-pro' ),
[ $this, 'render_settings_fallback_width' ],
Advanced_Ads_Pro::OPTION_KEY . '-settings',
$section_id
);
}
/**
* Render responsive image settings field
*/
public function render_setting_responsive_image_ads() {
$options = Advanced_Ads_Pro::get_instance()->get_options();
$force_responsive = isset( $options['responsive-ads']['force-responsive-images'] );
require $this->get_view_path() . '/setting_responsive_images.php';
}
/**
* Render setting to reload ads when screen resizes.
*/
public function render_settings_reload_ads_on_resize() {
$options = Advanced_Ads_Pro::get_instance()->get_options();
$cache_busting_enabled = isset( $options['cache-busting']['enabled'] ) && boolval( $options['cache-busting']['enabled'] );
$reload_ads_option_enabled = ! empty( $options['responsive-ads']['reload-ads-on-resize'] );
require $this->get_view_path() . '/setting_reload_ads.php';
}
/**
* Render setting to set fallback width.
*/
public function render_settings_fallback_width() {
$options = Advanced_Ads_Pro::get_instance()->get_options();
$width = ! empty( $options['responsive-ads']['fallback-width'] ) ? absint( $options['responsive-ads']['fallback-width'] ) : 768;
require $this->get_view_path() . '/setting_fallback_width.php';
}
/**
* Get view path for module
*
* @return string View folder path.
*/
private function get_view_path() {
return AAP_BASE_PATH . 'modules/responsive-ads/views';
}
/**
* Returns true if the Responsive addon is active.
* If the loading order of the plugins is not default,
* AAR_BASE_PATH could be undefined, even though the Responsive add-on is still installed.
* This is an approximation to that issue. If a user has renamed the plugin file, this will also fail.
*
* @return bool
*/
public function is_responsive_active(): bool {
$plugins = array_filter(
apply_filters( 'active_plugins', get_option( 'active_plugins' ) ),
static function ( $plugin ) {
$needle = 'responsive-ads.php';
$len = strlen( $needle );
return substr_compare( $plugin, $needle, -$len, $len ) === 0;
}
);
$active_by_string = ! empty( $plugins );
return defined( 'AAR_BASE_PATH' ) || $active_by_string;
}
/**
* Returns true if the Responsive addon is deprecated.
*
* @return true
*/
public function is_responsive_outdated(): bool {
return $this->is_responsive_active() && ! defined( 'AAR_AMP_ADSENSE_ONLY' );
}
}

View File

@@ -0,0 +1,86 @@
<?php
/**
* Responsive Ads Common.
*
* @package Advanced_Ads_Pro\Module
* @subpackage Responsive_Ads
* @author Advanced Ads <info@wpadvancedads.com>
*/
namespace Advanced_Ads_Pro\Module\Responsive_Ads;
use Advanced_Ads_Pro;
use AdvancedAds\Framework\Utilities\Params;
defined( 'ABSPATH' ) || exit;
/**
* Class Common
*/
class Common {
/**
* Hook into WordPress.
*/
public function hooks(): void {
add_filter( 'advanced-ads-visitor-conditions', [ $this, 'visitor_conditions' ] );
}
/**
* Add visitor condition
*
* @param array $conditions Hold visitor conditions.
*
* @return array
*/
public function visitor_conditions( $conditions ) {
if ( ! defined( 'ADVANCED_ADS_RESPONSIVE_DISABLE_BROWSER_WIDTH' ) ) {
$conditions['device_width'] = [
'label' => esc_html__( 'browser width', 'advanced-ads-pro' ),
'description' => esc_html__( 'Display ads based on the browser width.', 'advanced-ads-pro' ),
'metabox' => [ 'Advanced_Ads_Visitor_Conditions', 'metabox_number' ],
'check' => [ $this, 'check_browser_width' ],
];
}
return $conditions;
}
/**
* Check browser width in frontend
*
* @param array $options Options of the condition.
*
* @return bool True if ad/group can be displayed.
*/
public function check_browser_width( $options = [] ) {
if ( defined( 'ADVANCED_ADS_RESPONSIVE_DISABLE_BROWSER_WIDTH' ) ) {
return true;
}
if ( ! isset( $options['operator'], $options['value'] ) ) {
return true;
}
$browser_width = 0;
$ads_visitor = Params::cookie( 'advanced_ads_visitor' );
if ( ! empty( $ads_visitor ) ) {
$browser_width = json_decode( stripslashes( $ads_visitor ), true ); // phpcs:ignore
$browser_width = $browser_width['browser_width'] ?? 0;
} else {
$responsive_options = Advanced_Ads_Pro::get_instance()->get_options();
$browser_width = ! empty( $responsive_options['responsive-ads']['fallback-width'] ) ? absint( $responsive_options['responsive-ads']['fallback-width'] ) : 768;
}
$value = absint( $options['value'] );
$operator = $options['operator'];
$operators = [
'is_equal' => $value === $browser_width,
'is_higher' => $value <= $browser_width,
'is_lower' => $value >= $browser_width,
];
return $operators[ $operator ] ?? true;
}
}

View File

@@ -0,0 +1,69 @@
<?php
/**
* Responsive Ads Frontend.
*
* @package Advanced_Ads_Pro\Module
* @subpackage Responsive_Ads
* @author Advanced Ads <info@wpadvancedads.com>
*/
namespace Advanced_Ads_Pro\Module\Responsive_Ads;
use Advanced_Ads_Pro;
defined( 'ABSPATH' ) || exit;
/**
* Class Frontend
*/
class Frontend {
/**
* Hook into WordPress.
*/
public function hooks(): void {
$options = Advanced_Ads_Pro::get_instance()->get_options();
if ( isset( $options['responsive-ads']['force-responsive-images'] ) && $options['responsive-ads']['force-responsive-images'] ) {
add_filter( 'advanced-ads-ad-image-tag-style', [ $this, 'force_responsive_images' ] );
}
add_action( 'wp_enqueue_scripts', [ $this, 'register_scripts' ], 15 );
}
/**
* Force responsive image by adding styles
*
* @param string $image_styles Existing image styles.
*
* @return string New image styles
*/
public function force_responsive_images( $image_styles ) {
return $image_styles . ' max-width: 100%; height: auto;';
}
/**
* Enqueue options.
*
* @return void
*/
public function register_scripts() {
if ( function_exists( 'advads_is_amp' ) && advads_is_amp() ) {
return;
}
if ( ! defined( 'ADVADS_SLUG' ) || defined( 'ADVANCED_ADS_RESPONSIVE_DISABLE_BROWSER_WIDTH' ) ) {
return;
}
$options = Advanced_Ads_Pro::get_instance()->get_options();
wp_localize_script(
'advanced-ads-pro/cache_busting',
'advanced_ads_responsive',
[
'reload_on_resize' => ! empty( $options['responsive-ads']['reload-ads-on-resize'] ) ? 1 : 0,
]
);
}
}