: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
$resource_data = apply_filters( 'et_core_page_resource_get_data', $this->data, $context, $this );
foreach ( $resource_data as $priority => $data_part ) {
foreach ( $data_part as $data ) {
* Whether or not a static resource exists on the filesystem for this instance.
public function has_file() {
if ( ! self::$wpfs || empty( $this->PATH ) || ! self::can_write_to_filesystem() ) {
return self::$wpfs->exists( $this->PATH );
* Set the resource's data.
public function set_data( $data, $priority = 10 ) {
if ( 'style' === $this->type ) {
$data = et_core_data_utils_minify_css( $data );
// Remove empty media queries
// @media only..and (feature:value) { }
$pattern = '/@media\s+([\w\s]+)?\([\w-]+:[\w\d-]+\)\{\s*\}/';
$data = preg_replace( $pattern, '', $data );
$this->data[ $priority ][] = trim( strip_tags( str_replace( '\n', '', $data ) ) );
public function set_output_location( $location ) {
if ( ! self::_validate_property( 'location', $location ) ) {
$current_location = $this->location;
self::_unassign_output_location( $current_location, $this );
self::_assign_output_location( $location, $this );
$this->location = $location;
public function unregister_resource() {
$scope = 'global' === $this->post_id ? 'global' : 'post';
unset( self::$_resources[ $this->slug ], self::$_resources_by_scope[ $scope ][ $this->slug ] );
self::_unassign_output_location( $this->location, $this );