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,53 @@
|
||||
<?php declare( strict_types=1 );
|
||||
|
||||
namespace KadenceWP\KadenceBlocks\Optimizer\Response;
|
||||
|
||||
/**
|
||||
* Data Transfer Object representing CSS computed style properties for an element.
|
||||
*
|
||||
* Contains the computed CSS values for width, height, object-fit, and object-position
|
||||
* properties as extracted from the browser's computed styles.
|
||||
*/
|
||||
final class ComputedStyle {
|
||||
|
||||
public string $width;
|
||||
public string $height;
|
||||
public string $objectFit;
|
||||
public string $objectPosition;
|
||||
|
||||
private function __construct(
|
||||
string $width,
|
||||
string $height,
|
||||
string $objectFit,
|
||||
string $objectPosition
|
||||
) {
|
||||
$this->width = $width;
|
||||
$this->height = $height;
|
||||
$this->objectFit = $objectFit;
|
||||
$this->objectPosition = $objectPosition;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array{width: string, height: string, objectFit: string, objectPosition: string} $attributes
|
||||
*/
|
||||
public static function from( array $attributes ): self {
|
||||
return new self(
|
||||
$attributes['width'],
|
||||
$attributes['height'],
|
||||
$attributes['objectFit'],
|
||||
$attributes['objectPosition']
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array{width: string, height: string, objectFit: string, objectPosition: string}
|
||||
*/
|
||||
public function toArray(): array {
|
||||
return [
|
||||
'width' => $this->width,
|
||||
'height' => $this->height,
|
||||
'objectFit' => $this->objectFit,
|
||||
'objectPosition' => $this->objectPosition,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
<?php declare( strict_types=1 );
|
||||
|
||||
namespace KadenceWP\KadenceBlocks\Optimizer\Response;
|
||||
|
||||
/**
|
||||
* Data Transfer Object representing analysis data for a specific device viewport.
|
||||
*
|
||||
* Contains device-specific optimization data including critical image counts,
|
||||
* background images, and page sections with their layout information.
|
||||
*/
|
||||
final class DeviceAnalysis {
|
||||
|
||||
/**
|
||||
* A list of image src URLs found above the fold.
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
public array $criticalImages;
|
||||
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
public array $backgroundImages;
|
||||
|
||||
/**
|
||||
* @var Section[]
|
||||
*/
|
||||
public array $sections;
|
||||
|
||||
/**
|
||||
* @param string[] $criticalImages A list of image src URLs found above the fold.
|
||||
* @param string[] $backgroundImages The list of URLs of background images found.
|
||||
* @param Section[] $sections The collection of sections.
|
||||
*/
|
||||
private function __construct(
|
||||
array $criticalImages = [],
|
||||
array $backgroundImages = [],
|
||||
array $sections = []
|
||||
) {
|
||||
$this->criticalImages = $criticalImages;
|
||||
$this->backgroundImages = $backgroundImages;
|
||||
$this->sections = $sections;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array{criticalImages: string[], backgroundImages?: string[], sections?: array} $attributes
|
||||
*/
|
||||
public static function from( array $attributes ): self {
|
||||
$sections = array_map(
|
||||
static function ( array $result ): Section {
|
||||
return Section::from( $result );
|
||||
},
|
||||
$attributes['sections'] ?? []
|
||||
);
|
||||
|
||||
return new self(
|
||||
$attributes['criticalImages'],
|
||||
$attributes['backgroundImages'] ?? [],
|
||||
$sections
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array{criticalImages: string[], backgroundImages?: string[], sections?: array}
|
||||
*/
|
||||
public function toArray(): array {
|
||||
return [
|
||||
'criticalImages' => $this->criticalImages,
|
||||
'backgroundImages' => $this->backgroundImages,
|
||||
'sections' => array_map(
|
||||
static function ( Section $section ): array {
|
||||
return $section->toArray();
|
||||
},
|
||||
$this->sections
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all the sections that are below the fold.
|
||||
*
|
||||
* @return Section[]
|
||||
*/
|
||||
public function getBelowTheFoldSections(): array {
|
||||
return array_filter( $this->sections, static fn( Section $section ): bool => ! $section->isAboveFold );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
<?php declare( strict_types=1 );
|
||||
|
||||
namespace KadenceWP\KadenceBlocks\Optimizer\Response;
|
||||
|
||||
/**
|
||||
* Data Transfer Object representing comprehensive analysis data for an image element.
|
||||
*
|
||||
* Contains detailed information about an image including dimensions, loading attributes,
|
||||
* computed styles, srcset entries, and optimization recommendations such as optimal sizes.
|
||||
*/
|
||||
final class ImageAnalysis {
|
||||
|
||||
public string $path;
|
||||
public string $src;
|
||||
|
||||
/**
|
||||
* @var SrcsetEntry[]
|
||||
*/
|
||||
public array $srcset;
|
||||
public int $width;
|
||||
public int $height;
|
||||
public string $widthAttr;
|
||||
public string $heightAttr;
|
||||
public int $naturalWidth;
|
||||
public int $naturalHeight;
|
||||
public ?float $aspectRatio;
|
||||
public ?string $alt;
|
||||
public string $className;
|
||||
public string $loading;
|
||||
public string $decoding;
|
||||
public ?string $sizes;
|
||||
public ComputedStyle $computedStyle;
|
||||
public string $optimalSizes;
|
||||
|
||||
/**
|
||||
* @param SrcsetEntry[] $srcset The srcset entry.
|
||||
*/
|
||||
private function __construct(
|
||||
string $path,
|
||||
string $src,
|
||||
array $srcset,
|
||||
int $width,
|
||||
int $height,
|
||||
string $widthAttr,
|
||||
string $heightAttr,
|
||||
int $naturalWidth,
|
||||
int $naturalHeight,
|
||||
?float $aspectRatio,
|
||||
?string $alt,
|
||||
string $className,
|
||||
string $loading,
|
||||
string $decoding,
|
||||
?string $sizes,
|
||||
ComputedStyle $computedStyle,
|
||||
string $optimalSizes
|
||||
) {
|
||||
$this->path = $path;
|
||||
$this->src = $src;
|
||||
$this->srcset = $srcset;
|
||||
$this->width = $width;
|
||||
$this->height = $height;
|
||||
$this->widthAttr = $widthAttr;
|
||||
$this->heightAttr = $heightAttr;
|
||||
$this->naturalWidth = $naturalWidth;
|
||||
$this->naturalHeight = $naturalHeight;
|
||||
$this->aspectRatio = $aspectRatio;
|
||||
$this->alt = $alt;
|
||||
$this->className = $className;
|
||||
$this->loading = $loading;
|
||||
$this->decoding = $decoding;
|
||||
$this->sizes = $sizes;
|
||||
$this->computedStyle = $computedStyle;
|
||||
$this->optimalSizes = $optimalSizes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array{path: string, src: string, srcset: array, width: int, height: int, widthAttr: string, heightAttr: string, naturalWidth: int, naturalHeight: int, aspectRatio: float, alt: ?string, class: ?string, loading: string, decoding: string, sizes: ?string, computedStyle: array, optimalSizes: string} $attributes
|
||||
*/
|
||||
public static function from( array $attributes ): self {
|
||||
$srcset = array_map(
|
||||
static function ( array $entry ): SrcsetEntry {
|
||||
return SrcsetEntry::from( $entry );
|
||||
},
|
||||
$attributes['srcset'] ?? []
|
||||
);
|
||||
|
||||
return new self(
|
||||
$attributes['path'] ?? '',
|
||||
$attributes['src'] ?? '',
|
||||
$srcset,
|
||||
$attributes['width'] ?? 0,
|
||||
$attributes['height'] ?? 0,
|
||||
$attributes['widthAttr'] ?? '',
|
||||
$attributes['heightAttr'] ?? '',
|
||||
$attributes['naturalWidth'] ?? 0,
|
||||
$attributes['naturalHeight'] ?? 0,
|
||||
$attributes['aspectRatio'] ?? null,
|
||||
$attributes['alt'],
|
||||
$attributes['class'] ?? '',
|
||||
$attributes['loading'],
|
||||
$attributes['decoding'],
|
||||
$attributes['sizes'],
|
||||
ComputedStyle::from( $attributes['computedStyle'] ),
|
||||
$attributes['optimalSizes']
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array{path: string, src: string, srcset: array, width: int, height: int, widthAttr: string, heightAttr: string, naturalWidth: int, naturalHeight: int, aspectRatio: float, alt: ?string, class: string, loading: string, decoding: string, sizes: ?string, computedStyle: array, optimalSizes: string}
|
||||
*/
|
||||
public function toArray(): array {
|
||||
return [
|
||||
'path' => $this->path,
|
||||
'src' => $this->src,
|
||||
'srcset' => array_map(
|
||||
static function ( SrcsetEntry $entry ): array {
|
||||
return $entry->toArray();
|
||||
},
|
||||
$this->srcset
|
||||
),
|
||||
'width' => $this->width,
|
||||
'height' => $this->height,
|
||||
'widthAttr' => $this->widthAttr,
|
||||
'heightAttr' => $this->heightAttr,
|
||||
'naturalWidth' => $this->naturalWidth,
|
||||
'naturalHeight' => $this->naturalHeight,
|
||||
'aspectRatio' => $this->aspectRatio,
|
||||
'alt' => $this->alt,
|
||||
'class' => $this->className,
|
||||
'loading' => $this->loading,
|
||||
'decoding' => $this->decoding,
|
||||
'sizes' => $this->sizes,
|
||||
'computedStyle' => $this->computedStyle->toArray(),
|
||||
'optimalSizes' => $this->optimalSizes,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
<?php declare( strict_types=1 );
|
||||
|
||||
namespace KadenceWP\KadenceBlocks\Optimizer\Response;
|
||||
|
||||
/**
|
||||
* Data Transfer Object representing a page section or element with layout information.
|
||||
*
|
||||
* Contains section metadata including dimensions, DOM path, fold position,
|
||||
* and content flags for images and background elements.
|
||||
*/
|
||||
final class Section {
|
||||
|
||||
public string $id;
|
||||
public float $height;
|
||||
public string $tagName;
|
||||
public string $className;
|
||||
public string $path;
|
||||
public bool $isAboveFold;
|
||||
public bool $hasImages;
|
||||
public bool $hasBackground;
|
||||
|
||||
private function __construct(
|
||||
string $id,
|
||||
float $height,
|
||||
string $tagName,
|
||||
string $className,
|
||||
string $path,
|
||||
bool $isAboveFold,
|
||||
bool $hasImages,
|
||||
bool $hasBackground
|
||||
) {
|
||||
$this->id = $id;
|
||||
$this->height = $height;
|
||||
$this->tagName = $tagName;
|
||||
$this->className = $className;
|
||||
$this->path = $path;
|
||||
$this->isAboveFold = $isAboveFold;
|
||||
$this->hasImages = $hasImages;
|
||||
$this->hasBackground = $hasBackground;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array{id: string, height: float, tagName: string, className: string, path: string, isAboveFold: bool, hasImages: bool, hasBackground: bool} $attributes
|
||||
*/
|
||||
public static function from( array $attributes ): self {
|
||||
return new self(
|
||||
$attributes['id'],
|
||||
$attributes['height'],
|
||||
$attributes['tagName'],
|
||||
$attributes['className'],
|
||||
$attributes['path'],
|
||||
$attributes['isAboveFold'],
|
||||
$attributes['hasImages'],
|
||||
$attributes['hasBackground']
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array{id: string, height: float, tagName: string, className: string, path: string, isAboveFold: bool, hasImages: bool, hasBackground: bool}
|
||||
*/
|
||||
public function toArray(): array {
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'height' => $this->height,
|
||||
'tagName' => $this->tagName,
|
||||
'className' => $this->className,
|
||||
'path' => $this->path,
|
||||
'isAboveFold' => $this->isAboveFold,
|
||||
'hasImages' => $this->hasImages,
|
||||
'hasBackground' => $this->hasBackground,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php declare( strict_types=1 );
|
||||
|
||||
namespace KadenceWP\KadenceBlocks\Optimizer\Response;
|
||||
|
||||
/**
|
||||
* Data Transfer Object representing a single entry in an image srcset attribute.
|
||||
*
|
||||
* Contains the URL and width descriptor for a responsive image source,
|
||||
* used to build complete srcset attributes for optimized image delivery.
|
||||
*/
|
||||
final class SrcsetEntry {
|
||||
|
||||
public string $url;
|
||||
public int $width;
|
||||
|
||||
private function __construct( string $url, int $width ) {
|
||||
$this->url = $url;
|
||||
$this->width = $width;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array{url: string, width: int} $attributes
|
||||
*/
|
||||
public static function from( array $attributes ): self {
|
||||
return new self(
|
||||
$attributes['url'],
|
||||
$attributes['width']
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array{url: string, width: int}
|
||||
*/
|
||||
public function toArray(): array {
|
||||
return [
|
||||
'url' => $this->url,
|
||||
'width' => $this->width,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
<?php declare( strict_types=1 );
|
||||
|
||||
namespace KadenceWP\KadenceBlocks\Optimizer\Response;
|
||||
|
||||
use KadenceWP\KadenceBlocks\Optimizer\Enums\Viewport;
|
||||
|
||||
/**
|
||||
* Data Transfer Object representing comprehensive website performance analysis.
|
||||
*
|
||||
* Contains the complete optimization analysis including device-specific data
|
||||
* for desktop and mobile viewports, plus detailed analysis for all images found.
|
||||
*/
|
||||
final class WebsiteAnalysis {
|
||||
|
||||
public bool $isStale;
|
||||
public DeviceAnalysis $desktop;
|
||||
public DeviceAnalysis $mobile;
|
||||
|
||||
/**
|
||||
* @var ImageAnalysis[]
|
||||
*/
|
||||
public array $images;
|
||||
|
||||
/**
|
||||
* @param ImageAnalysis[] $images The image analysis collection.
|
||||
*/
|
||||
private function __construct(
|
||||
bool $isStale,
|
||||
DeviceAnalysis $desktop,
|
||||
DeviceAnalysis $mobile,
|
||||
array $images = []
|
||||
) {
|
||||
$this->isStale = $isStale;
|
||||
$this->desktop = $desktop;
|
||||
$this->mobile = $mobile;
|
||||
$this->images = $images;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array{isStale?: bool, desktop: array, mobile: array, images: array} $attributes
|
||||
*
|
||||
* @throws \Exception If we fail to create a DateTimeImmutable object.
|
||||
*/
|
||||
public static function from( array $attributes ): self {
|
||||
$images = array_map(
|
||||
static function ( array $result ): ImageAnalysis {
|
||||
return ImageAnalysis::from( $result );
|
||||
},
|
||||
$attributes['images'] ?? []
|
||||
);
|
||||
|
||||
$isStale = (bool) ( $attributes['isStale'] ?? false );
|
||||
|
||||
return new self(
|
||||
$isStale,
|
||||
DeviceAnalysis::from( $attributes['desktop'] ),
|
||||
DeviceAnalysis::from( $attributes['mobile'] ),
|
||||
$images
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array{isStale: bool, desktop: array, mobile: array, images: array}
|
||||
*/
|
||||
public function toArray(): array {
|
||||
return [
|
||||
'isStale' => $this->isStale,
|
||||
'desktop' => $this->desktop->toArray(),
|
||||
'mobile' => $this->mobile->toArray(),
|
||||
'images' => array_map(
|
||||
static function ( ImageAnalysis $image ): array {
|
||||
return $image->toArray();
|
||||
},
|
||||
$this->images
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the device analysis for a specific viewport.
|
||||
*
|
||||
* @param Viewport $vp The viewport to fetch data for.
|
||||
*
|
||||
* @return DeviceAnalysis|null
|
||||
*/
|
||||
public function getDevice( Viewport $vp ): ?DeviceAnalysis {
|
||||
return $this->{$vp} ?? null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user