feat: initial ACRIB WordPress deployment
- WordPress 6.9.4 (es_ES) with Kadence theme - Homepage: Hero, La Asociación, Pilares, Beneficios, Eventos, Miembros, Hazte Miembro, Contacto - Brand identity: #13294b navy, #a12932 burgundy, #c69c48 gold - Fonts: Raleway (headings) + Source Sans 3 (body) + Lato (UI) - Plugins: Kadence Blocks, Polylang, Contact Form 7 - Custom CSS with full brand styling and responsive layout - HTTPS enforced via wp-config.php proxy detection
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Polylang
|
||||
*/
|
||||
|
||||
/**
|
||||
* Common class for handling the core sitemaps.
|
||||
*
|
||||
* The child classes must called the init() method.
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
abstract class PLL_Abstract_Sitemaps {
|
||||
/**
|
||||
* Setups actions and filters.
|
||||
*
|
||||
* @since 2.8
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function init() {
|
||||
add_filter( 'pll_home_url_white_list', array( $this, 'home_url_white_list' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Whitelists the home url filter for the sitemaps.
|
||||
*
|
||||
* @since 2.8
|
||||
*
|
||||
* @param array $whitelist White list.
|
||||
* @return array
|
||||
*/
|
||||
public function home_url_white_list( $whitelist ) {
|
||||
$whitelist[] = array( 'file' => 'class-wp-sitemaps-posts' );
|
||||
return $whitelist;
|
||||
}
|
||||
}
|
||||
17
wp-content/plugins/polylang/src/modules/sitemaps/load.php
Normal file
17
wp-content/plugins/polylang/src/modules/sitemaps/load.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Polylang
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Don't access directly.
|
||||
}
|
||||
|
||||
if ( $polylang->model->has_languages() ) {
|
||||
if ( $polylang->links_model instanceof PLL_Links_Abstract_Domain ) {
|
||||
$polylang->sitemaps = new PLL_Sitemaps_Domain( $polylang );
|
||||
} else {
|
||||
$polylang->sitemaps = new PLL_Sitemaps( $polylang );
|
||||
}
|
||||
$polylang->sitemaps->init();
|
||||
}
|
||||
@@ -0,0 +1,218 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Polylang
|
||||
*/
|
||||
|
||||
/**
|
||||
* Decorator to add multilingual capability to sitemaps providers
|
||||
*
|
||||
* @since 2.8
|
||||
*/
|
||||
class PLL_Multilingual_Sitemaps_Provider extends WP_Sitemaps_Provider {
|
||||
/**
|
||||
* The decorated sitemaps provider.
|
||||
*
|
||||
* @since 2.8
|
||||
*
|
||||
* @var WP_Sitemaps_Provider
|
||||
*/
|
||||
protected $provider;
|
||||
|
||||
/**
|
||||
* The PLL_Links_Model instance.
|
||||
*
|
||||
* @since 2.8
|
||||
*
|
||||
* @var PLL_Links_Model
|
||||
*/
|
||||
protected $links_model;
|
||||
|
||||
/**
|
||||
* The PLL_Model instance.
|
||||
*
|
||||
* @since 2.8
|
||||
*
|
||||
* @var PLL_Model
|
||||
*/
|
||||
protected $model;
|
||||
|
||||
|
||||
/**
|
||||
* Language used to filter queries for the sitemap index.
|
||||
*
|
||||
* @since 2.8
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private static $filter_lang = '';
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @since 2.8
|
||||
*
|
||||
* @param WP_Sitemaps_Provider $provider An instance of a WP_Sitemaps_Provider child class.
|
||||
* @param PLL_Links_Model $links_model The PLL_Links_Model instance.
|
||||
*/
|
||||
public function __construct( $provider, &$links_model ) {
|
||||
$this->name = $provider->name;
|
||||
$this->object_type = $provider->object_type;
|
||||
|
||||
$this->provider = $provider;
|
||||
$this->links_model = &$links_model;
|
||||
$this->model = &$links_model->model;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a URL list for a sitemap.
|
||||
*
|
||||
* @since 2.8
|
||||
*
|
||||
* @param int $page_num Page of results.
|
||||
* @param string $object_subtype Optional. Object subtype name. Default empty.
|
||||
* @return array Array of URLs for a sitemap.
|
||||
*/
|
||||
public function get_url_list( $page_num, $object_subtype = '' ) {
|
||||
return $this->provider->get_url_list( $page_num, $object_subtype );
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the max number of pages available for the object type.
|
||||
*
|
||||
* @since 2.8
|
||||
*
|
||||
* @param string $object_subtype Optional. Object subtype. Default empty.
|
||||
* @return int Total number of pages.
|
||||
*/
|
||||
public function get_max_num_pages( $object_subtype = '' ) {
|
||||
return $this->provider->get_max_num_pages( $object_subtype );
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters the query arguments to add the language.
|
||||
*
|
||||
* @since 2.8
|
||||
*
|
||||
* @param array $args Sitemap provider WP_Query or WP_Term_Query arguments.
|
||||
* @return array
|
||||
*/
|
||||
public static function query_args( $args ) {
|
||||
if ( ! empty( self::$filter_lang ) ) {
|
||||
$args['lang'] = self::$filter_lang;
|
||||
}
|
||||
return $args;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets data for a given sitemap type.
|
||||
*
|
||||
* @since 2.8
|
||||
*
|
||||
* @param string $object_subtype_name Object subtype name if any.
|
||||
* @param string $lang Optional language name.
|
||||
* @return array
|
||||
*/
|
||||
protected function get_sitemap_data( $object_subtype_name, $lang = '' ) {
|
||||
$object_subtype_name = (string) $object_subtype_name;
|
||||
|
||||
if ( ! empty( $lang ) ) {
|
||||
self::$filter_lang = $lang;
|
||||
}
|
||||
|
||||
$return = array(
|
||||
'name' => implode( '-', array_filter( array( $object_subtype_name, $lang ) ) ),
|
||||
'pages' => $this->get_max_num_pages( $object_subtype_name ),
|
||||
);
|
||||
|
||||
self::$filter_lang = '';
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets data about each sitemap type.
|
||||
*
|
||||
* @since 2.8
|
||||
*
|
||||
* @return array[] Array of sitemap types including object subtype name and number of pages.
|
||||
*/
|
||||
public function get_sitemap_type_data() {
|
||||
$sitemap_data = array();
|
||||
|
||||
add_filter( 'wp_sitemaps_posts_query_args', array( self::class, 'query_args' ) );
|
||||
add_filter( 'wp_sitemaps_taxonomies_query_args', array( self::class, 'query_args' ) );
|
||||
|
||||
$object_subtypes = $this->get_object_subtypes();
|
||||
|
||||
if ( empty( $object_subtypes ) ) {
|
||||
foreach ( $this->model->get_languages_list( array( 'fields' => 'slug' ) ) as $language ) {
|
||||
$sitemap_data[] = $this->get_sitemap_data( '', $language );
|
||||
}
|
||||
}
|
||||
|
||||
switch ( $this->provider->name ) {
|
||||
case 'posts':
|
||||
$func = array( $this->model, 'is_translated_post_type' );
|
||||
break;
|
||||
case 'taxonomies':
|
||||
$func = array( $this->model, 'is_translated_taxonomy' );
|
||||
break;
|
||||
default:
|
||||
return $sitemap_data;
|
||||
}
|
||||
|
||||
foreach ( array_keys( $object_subtypes ) as $object_subtype_name ) {
|
||||
if ( call_user_func( $func, $object_subtype_name ) ) {
|
||||
foreach ( $this->model->get_languages_list( array( 'fields' => 'slug' ) ) as $language ) {
|
||||
$sitemap_data[] = $this->get_sitemap_data( $object_subtype_name, $language );
|
||||
}
|
||||
} else {
|
||||
$sitemap_data[] = $this->get_sitemap_data( $object_subtype_name );
|
||||
}
|
||||
}
|
||||
|
||||
return $sitemap_data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the URL of a sitemap entry.
|
||||
*
|
||||
* @since 2.8
|
||||
*
|
||||
* @param string $name The name of the sitemap.
|
||||
* @param int $page The page of the sitemap.
|
||||
* @return string The composed URL for a sitemap entry.
|
||||
*/
|
||||
public function get_sitemap_url( $name, $page ) {
|
||||
// Check if a language was added in $name.
|
||||
$pattern = '#(' . implode( '|', $this->model->get_languages_list( array( 'fields' => 'slug' ) ) ) . ')$#';
|
||||
if ( preg_match( $pattern, $name, $matches ) ) {
|
||||
$lang = $this->model->get_language( $matches[1] );
|
||||
|
||||
if ( ! empty( $lang ) ) {
|
||||
$name = preg_replace( '#(-?' . $lang->slug . ')$#', '', $name );
|
||||
$url = $this->provider->get_sitemap_url( $name, $page );
|
||||
return $this->links_model->add_language_to_link( $url, $lang );
|
||||
}
|
||||
}
|
||||
|
||||
// If no language is present in $name, we may attempt to get the current sitemap url (e.g. in redirect_canonical() ).
|
||||
if ( get_query_var( 'lang' ) ) {
|
||||
$lang = $this->model->get_language( get_query_var( 'lang' ) );
|
||||
$url = $this->provider->get_sitemap_url( $name, $page );
|
||||
return $this->links_model->add_language_to_link( $url, $lang );
|
||||
}
|
||||
|
||||
return $this->provider->get_sitemap_url( $name, $page );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of supported object subtypes exposed by the provider.
|
||||
*
|
||||
* @since 2.8
|
||||
*
|
||||
* @return array List of object subtypes objects keyed by their name.
|
||||
*/
|
||||
public function get_object_subtypes() {
|
||||
return $this->provider->get_object_subtypes();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Polylang
|
||||
*/
|
||||
|
||||
/**
|
||||
* Handles the core sitemaps for subdomains and multiple domains.
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
class PLL_Sitemaps_Domain extends PLL_Abstract_Sitemaps {
|
||||
/**
|
||||
* @var PLL_Links_Abstract_Domain
|
||||
*/
|
||||
protected $links_model;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @since 3.0
|
||||
*
|
||||
* @param object $polylang Main Polylang object.
|
||||
*/
|
||||
public function __construct( &$polylang ) {
|
||||
$this->links_model = &$polylang->links_model;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setups actions and filters.
|
||||
*
|
||||
* @since 3.0
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function init() {
|
||||
parent::init();
|
||||
|
||||
add_filter( 'wp_sitemaps_index_entry', array( $this, 'index_entry' ) );
|
||||
add_filter( 'wp_sitemaps_stylesheet_url', array( $this->links_model, 'site_url' ) );
|
||||
add_filter( 'wp_sitemaps_stylesheet_index_url', array( $this->links_model, 'site_url' ) );
|
||||
add_filter( 'home_url', array( $this, 'sitemap_url' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters the sitemap index entries for subdomains and multiple domains.
|
||||
*
|
||||
* @since 2.8
|
||||
*
|
||||
* @param array $sitemap_entry Sitemap entry for the post.
|
||||
* @return array
|
||||
*/
|
||||
public function index_entry( $sitemap_entry ) {
|
||||
$sitemap_entry['loc'] = $this->links_model->site_url( $sitemap_entry['loc'] );
|
||||
return $sitemap_entry;
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes sure that the sitemap urls are always evaluated on the current domain.
|
||||
*
|
||||
* @since 2.8.4
|
||||
*
|
||||
* @param string $url A sitemap url.
|
||||
* @return string
|
||||
*/
|
||||
public function sitemap_url( $url ) {
|
||||
if ( false !== strpos( $url, '/wp-sitemap' ) ) {
|
||||
$url = $this->links_model->site_url( $url );
|
||||
}
|
||||
return $url;
|
||||
}
|
||||
}
|
||||
126
wp-content/plugins/polylang/src/modules/sitemaps/sitemaps.php
Normal file
126
wp-content/plugins/polylang/src/modules/sitemaps/sitemaps.php
Normal file
@@ -0,0 +1,126 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Polylang
|
||||
*/
|
||||
|
||||
/**
|
||||
* Handles the core sitemaps for sites using a single domain.
|
||||
*
|
||||
* @since 2.8
|
||||
*/
|
||||
class PLL_Sitemaps extends PLL_Abstract_Sitemaps {
|
||||
/**
|
||||
* @var PLL_Links_Model
|
||||
*/
|
||||
protected $links_model;
|
||||
|
||||
/**
|
||||
* @var PLL_Model
|
||||
*/
|
||||
protected $model;
|
||||
|
||||
/**
|
||||
* Stores the plugin options.
|
||||
*
|
||||
* @var \WP_Syntex\Polylang\Options\Options
|
||||
*/
|
||||
protected $options;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @since 2.8
|
||||
*
|
||||
* @param PLL_Base $polylang Main Polylang object.
|
||||
*/
|
||||
public function __construct( PLL_Base &$polylang ) {
|
||||
$this->links_model = &$polylang->links_model;
|
||||
$this->model = &$polylang->model;
|
||||
$this->options = $polylang->options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setups actions and filters.
|
||||
*
|
||||
* @since 2.8
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function init() {
|
||||
parent::init();
|
||||
|
||||
add_filter( 'pll_set_language_from_query', array( $this, 'set_language_from_query' ), 10, 2 );
|
||||
add_filter( 'rewrite_rules_array', array( $this, 'rewrite_rules' ) );
|
||||
add_filter( 'wp_sitemaps_add_provider', array( $this, 'replace_provider' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Assigns the current language to the default language when the sitemap url
|
||||
* doesn't include any language.
|
||||
*
|
||||
* @since 2.8
|
||||
* @since 3.8 Returns a language object instead of a language slug.
|
||||
*
|
||||
* @param PLL_Language|false $lang Current language code, false if not set yet.
|
||||
* @param WP_Query $query Main WP query object.
|
||||
* @return PLL_Language|false
|
||||
*/
|
||||
public function set_language_from_query( $lang, $query ) {
|
||||
if ( isset( $query->query['sitemap'] ) && empty( $query->query['lang'] ) ) {
|
||||
return $this->model->languages->get_default();
|
||||
}
|
||||
return $lang;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters the sitemaps rewrite rules to take the languages into account.
|
||||
*
|
||||
* @since 2.8
|
||||
*
|
||||
* @param string[] $rules Rewrite rules.
|
||||
* @return string[] Modified rewrite rules.
|
||||
*/
|
||||
public function rewrite_rules( $rules ) {
|
||||
global $wp_rewrite;
|
||||
|
||||
$languages = $this->model->languages
|
||||
->filter( $this->options['hide_default'] ? 'hide_default' : '' )
|
||||
->get_list( array( 'fields' => 'slug' ) );
|
||||
|
||||
if ( empty( $languages ) ) {
|
||||
return $rules;
|
||||
}
|
||||
|
||||
$slug = $wp_rewrite->root . ( $this->options['rewrite'] ? '^' : '^language/' ) . '(' . implode( '|', $languages ) . ')/';
|
||||
|
||||
$newrules = array();
|
||||
|
||||
foreach ( $rules as $key => $rule ) {
|
||||
if ( false !== strpos( $rule, 'sitemap=$matches[1]' ) ) {
|
||||
$newrules[ str_replace( '^wp-sitemap', $slug . 'wp-sitemap', $key ) ] = str_replace(
|
||||
array( '[8]', '[7]', '[6]', '[5]', '[4]', '[3]', '[2]', '[1]', '?' ),
|
||||
array( '[9]', '[8]', '[7]', '[6]', '[5]', '[4]', '[3]', '[2]', '?lang=$matches[1]&' ),
|
||||
$rule
|
||||
); // Should be enough!
|
||||
}
|
||||
|
||||
$newrules[ $key ] = $rule;
|
||||
}
|
||||
return $newrules;
|
||||
}
|
||||
|
||||
/**
|
||||
* Replaces a sitemap provider by our decorator.
|
||||
*
|
||||
* @since 2.8
|
||||
*
|
||||
* @param WP_Sitemaps_Provider $provider Instance of a WP_Sitemaps_Provider.
|
||||
* @return WP_Sitemaps_Provider
|
||||
*/
|
||||
public function replace_provider( $provider ) {
|
||||
if ( $provider instanceof WP_Sitemaps_Provider ) {
|
||||
$provider = new PLL_Multilingual_Sitemaps_Provider( $provider, $this->links_model );
|
||||
}
|
||||
return $provider;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user