Commit inicial powerservice
This commit is contained in:
+34
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace WP_Rocket\Engine\Media\Lazyload\CSS\Data;
|
||||
|
||||
class LazyloadCSSContentFactory {
|
||||
|
||||
/**
|
||||
* Make LazyloadedContent instance.
|
||||
*
|
||||
* @param array $formatted_urls Formatted URls.
|
||||
* @param string $content Content.
|
||||
* @return LazyloadedContent
|
||||
*/
|
||||
public function make_lazyloaded_content( array $formatted_urls, string $content ): LazyloadedContent {
|
||||
$lazyloaded_content = new LazyloadedContent();
|
||||
$lazyloaded_content->set_urls( $formatted_urls );
|
||||
$lazyloaded_content->set_content( $content );
|
||||
return $lazyloaded_content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Make ProtectedContent instance.
|
||||
*
|
||||
* @param array $protected_files Protected files.
|
||||
* @param string $content Content.
|
||||
* @return ProtectedContent
|
||||
*/
|
||||
public function make_protected_content( array $protected_files, string $content ): ProtectedContent {
|
||||
$protected_content = new ProtectedContent();
|
||||
$protected_content->set_content( $content );
|
||||
$protected_content->set_protected_files_mapping( $protected_files );
|
||||
return $protected_content;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace WP_Rocket\Engine\Media\Lazyload\CSS\Data;
|
||||
|
||||
class LazyloadedContent {
|
||||
|
||||
/**
|
||||
* URls extracted from the content.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $urls = [];
|
||||
|
||||
/**
|
||||
* Lazyloaded content.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $content = '';
|
||||
|
||||
/**
|
||||
* Get URls extracted from the content.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function get_urls(): array {
|
||||
return $this->urls;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set URls extracted from the content.
|
||||
*
|
||||
* @param array $urls URls extracted from the content.
|
||||
* @return void
|
||||
*/
|
||||
public function set_urls( array $urls ): void {
|
||||
$this->urls = $urls;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get lazyloaded content.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_content(): string {
|
||||
return $this->content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set lazyloaded content.
|
||||
*
|
||||
* @param string $content Lazyloaded content.
|
||||
* @return void
|
||||
*/
|
||||
public function set_content( string $content ): void {
|
||||
$this->content = $content;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace WP_Rocket\Engine\Media\Lazyload\CSS\Data;
|
||||
|
||||
class ProtectedContent {
|
||||
|
||||
/**
|
||||
* Protected content.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $content = '';
|
||||
|
||||
/**
|
||||
* Mapping between protected files and their placeholder.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $protected_files_mapping = [];
|
||||
|
||||
/**
|
||||
* Set protected content.
|
||||
*
|
||||
* @param string $content Protected content.
|
||||
* @return void
|
||||
*/
|
||||
public function set_content( string $content ): void {
|
||||
$this->content = $content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get protected content.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_content(): string {
|
||||
return $this->content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set mapping between protected files and their placeholder.
|
||||
*
|
||||
* @param array $protected_files_mapping Mapping between protected files and their placeholder.
|
||||
* @return void
|
||||
*/
|
||||
public function set_protected_files_mapping( array $protected_files_mapping ): void {
|
||||
$this->protected_files_mapping = $protected_files_mapping;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get mapping between protected files and their placeholder.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function get_protected_files_mapping(): array {
|
||||
return $this->protected_files_mapping;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user