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,74 @@
|
||||
<?php declare( strict_types=1 );
|
||||
|
||||
namespace KadenceWP\KadenceBlocks\Traits;
|
||||
|
||||
use KadenceWP\KadenceBlocks\Image_Downloader\Image_Editor;
|
||||
use KadenceWP\KadenceBlocks\StellarWP\ProphecyMonorepo\ImageDownloader\FileNameProcessor;
|
||||
|
||||
/**
|
||||
* @mixin \Kadence_Blocks_Image_Picker
|
||||
* @mixin Image_Editor
|
||||
*/
|
||||
trait Image_Size_Trait {
|
||||
|
||||
/**
|
||||
* Memoization cache for image sizes.
|
||||
*
|
||||
* @var array<array{id: string, width: int, height: int, crop: bool}>
|
||||
*/
|
||||
protected $image_sizes_cache;
|
||||
|
||||
|
||||
/**
|
||||
* Get all available WordPress thumbnail sizes, format and sort them
|
||||
* by smallest to largest.
|
||||
*
|
||||
* @return array<array{id: string, width: int, height: int, crop: bool}>
|
||||
*/
|
||||
protected function get_image_sizes(): array {
|
||||
if ( isset( $this->image_sizes_cache ) ) {
|
||||
return $this->image_sizes_cache;
|
||||
}
|
||||
|
||||
$registered = wp_get_registered_image_subsizes();
|
||||
$formatted = [];
|
||||
|
||||
foreach ( $registered as $id => $data ) {
|
||||
// Add an id index.
|
||||
$formatted[] = array_merge( [
|
||||
'id' => $id,
|
||||
], $data );
|
||||
}
|
||||
|
||||
/**
|
||||
* We should have at least one scaled image to act as the main image, even if the user disabled
|
||||
* it as we don't store a super high resolution image.
|
||||
*
|
||||
* This filter is documented in wp-admin/includes/image.php
|
||||
*/
|
||||
$threshold = (int) apply_filters( 'big_image_size_threshold', 2560, [ 2561, 2561 ], '', 0 );
|
||||
|
||||
if ( ! $threshold ) {
|
||||
$threshold = 2560;
|
||||
}
|
||||
|
||||
$formatted[] = [
|
||||
'id' => FileNameProcessor::SCALED_SIZE,
|
||||
'width' => $threshold,
|
||||
'height' => $threshold,
|
||||
'crop' => false,
|
||||
];
|
||||
|
||||
// Sort by smallest to largest sizes.
|
||||
// Do not change this: It's important for Pexels image downloading, so we know the largest size.
|
||||
usort( $formatted, static function( array $a, array $b ) {
|
||||
$max_a = max( $a['width'], $a['height'] );
|
||||
$max_b = max( $b['width'], $b['height'] );
|
||||
|
||||
return $max_a <=> $max_b;
|
||||
} );
|
||||
|
||||
return $this->image_sizes_cache = $formatted;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php declare( strict_types=1 );
|
||||
|
||||
namespace KadenceWP\KadenceBlocks\Traits;
|
||||
|
||||
/**
|
||||
* Permalink related methods.
|
||||
*/
|
||||
trait Permalink_Trait {
|
||||
|
||||
/**
|
||||
* Get a post's path relative to the site root.
|
||||
*
|
||||
* @param int|\WP_Post $post The post object or ID.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function get_post_path( $post ): string {
|
||||
$permalink = get_permalink( $post );
|
||||
|
||||
if ( $permalink === false ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return trailingslashit( wp_parse_url( $permalink, PHP_URL_PATH ) ?? '/' );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php declare( strict_types=1 );
|
||||
|
||||
namespace KadenceWP\KadenceBlocks\Traits\Rest;
|
||||
|
||||
/**
|
||||
* Shared image related functionality for REST controllers.
|
||||
*
|
||||
* @mixin \WP_REST_Controller
|
||||
*/
|
||||
trait Image_Trait {
|
||||
|
||||
/**
|
||||
* Sanitizes an array of Pexels image sizes.
|
||||
*
|
||||
* @param mixed|array<int, array{id: int, width: int, height: int, crop: bool}> $sizes One or more size arrays.
|
||||
*
|
||||
* @return array|array<int, array{id: int, width: int, height: int, crop: bool}>
|
||||
*/
|
||||
public function sanitize_image_sizes_array( $sizes ): array {
|
||||
$new_sizes = [];
|
||||
|
||||
if ( ! empty( $sizes ) || ! is_array( $sizes ) ) {
|
||||
foreach ( $sizes as $value ) {
|
||||
$new_sizes[] = [
|
||||
'id' => sanitize_text_field( $value['id'] ),
|
||||
'width' => absint( $value['width'] ),
|
||||
'height' => absint( $value['height'] ),
|
||||
'crop' => filter_var( $value['crop'], FILTER_VALIDATE_BOOLEAN ),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
return $new_sizes;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php declare( strict_types=1 );
|
||||
|
||||
namespace KadenceWP\KadenceBlocks\Traits;
|
||||
|
||||
use KadenceWP\KadenceBlocks\Optimizer\Optimizer_Provider;
|
||||
|
||||
trait Viewport_Trait {
|
||||
|
||||
/**
|
||||
* Check if a mobile device is viewing this URL.
|
||||
*
|
||||
* @see Optimizer_Provider::register_mobile_override()
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private function is_mobile(): bool {
|
||||
// phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions.wp_is_mobile_wp_is_mobile
|
||||
return function_exists( 'jetpack_is_mobile' ) ? jetpack_is_mobile() : wp_is_mobile();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user