Skip to content

Commit d41da3c

Browse files
committed
Move od_get_maximum_url_metric_size to storage/data.php
1 parent 746a410 commit d41da3c

File tree

2 files changed

+37
-37
lines changed

2 files changed

+37
-37
lines changed

plugins/optimization-detective/helper.php

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -122,40 +122,3 @@ function od_get_asset_path( string $src_path, ?string $min_path = null ): string
122122

123123
return $min_path;
124124
}
125-
126-
/**
127-
* Gets the maximum allowed size in bytes for a URL Metric serialized to JSON.
128-
*
129-
* @since n.e.x.t
130-
* @access private
131-
*
132-
* @return positive-int Maximum allowed byte size.
133-
*/
134-
function od_get_maximum_url_metric_size(): int {
135-
/**
136-
* Filters the maximum allowed size in bytes for a URL Metric serialized to JSON.
137-
*
138-
* The default value is 1 MB.
139-
*
140-
* @since n.e.x.t
141-
*
142-
* @param int $max_size Maximum allowed byte size.
143-
* @return int Filtered maximum allowed byte size.
144-
*/
145-
$size = (int) apply_filters( 'od_maximum_url_metric_size', MB_IN_BYTES );
146-
if ( $size <= 0 ) {
147-
_doing_it_wrong(
148-
esc_html( "Filter: 'od_maximum_url_metric_size'" ),
149-
esc_html(
150-
sprintf(
151-
/* translators: %s: size */
152-
__( 'Invalid size "%s". Must be greater than zero.', 'optimization-detective' ),
153-
$size
154-
)
155-
),
156-
'Optimization Detective 1.0.0'
157-
);
158-
$size = MB_IN_BYTES;
159-
}
160-
return $size;
161-
}

plugins/optimization-detective/storage/data.php

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,3 +462,40 @@ function od_get_url_metrics_breakpoint_sample_size(): int {
462462

463463
return $sample_size;
464464
}
465+
466+
/**
467+
* Gets the maximum allowed size in bytes for a URL Metric serialized to JSON.
468+
*
469+
* @since n.e.x.t
470+
* @access private
471+
*
472+
* @return positive-int Maximum allowed byte size.
473+
*/
474+
function od_get_maximum_url_metric_size(): int {
475+
/**
476+
* Filters the maximum allowed size in bytes for a URL Metric serialized to JSON.
477+
*
478+
* The default value is 1 MB.
479+
*
480+
* @since n.e.x.t
481+
*
482+
* @param int $max_size Maximum allowed byte size.
483+
* @return int Filtered maximum allowed byte size.
484+
*/
485+
$size = (int) apply_filters( 'od_maximum_url_metric_size', MB_IN_BYTES );
486+
if ( $size <= 0 ) {
487+
_doing_it_wrong(
488+
esc_html( "Filter: 'od_maximum_url_metric_size'" ),
489+
esc_html(
490+
sprintf(
491+
/* translators: %s: size */
492+
__( 'Invalid size "%s". Must be greater than zero.', 'optimization-detective' ),
493+
$size
494+
)
495+
),
496+
'Optimization Detective 1.0.0'
497+
);
498+
$size = MB_IN_BYTES;
499+
}
500+
return $size;
501+
}

0 commit comments

Comments
 (0)