Skip to content

Commit dc0bc62

Browse files
committed
rm unused fn
1 parent 227c13a commit dc0bc62

File tree

2 files changed

+0
-122
lines changed

2 files changed

+0
-122
lines changed

src/HTMLProcessor.php

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -771,45 +771,6 @@ public function detectUnchangedPlaceholderURLs( string $processed_html ) : strin
771771
return $processed_html;
772772
}
773773

774-
// TODO: kill this fn, should not be needed anymore
775-
public function rewriteUnchangedPlaceholderURLs(
776-
string $processed_html,
777-
string $placeholder_url,
778-
string $destination_url,
779-
string $rewrite_rules
780-
) : string {
781-
// add base URL to rewrite_rules
782-
$rewrite_rules .=
783-
PHP_EOL .
784-
$placeholder_url . ',' .
785-
$destination_url;
786-
787-
$rewrite_from = [];
788-
$rewrite_to = [];
789-
790-
$rewrite_rules = explode(
791-
"\n",
792-
str_replace( "\r", '', $rewrite_rules )
793-
);
794-
795-
foreach ( $rewrite_rules as $rewrite_rule_line ) {
796-
if ( $rewrite_rule_line ) {
797-
list($from, $to) = explode( ',', $rewrite_rule_line );
798-
799-
$rewrite_from[] = $from;
800-
$rewrite_to[] = $to;
801-
}
802-
}
803-
804-
$rewritten_source = str_replace(
805-
$rewrite_from,
806-
$rewrite_to,
807-
$processed_html
808-
);
809-
810-
return $rewritten_source;
811-
}
812-
813774
public function rewriteEscapedURLs( string $processed_html ) : string {
814775
// NOTE: fix input HTML, which can have \ slashes modified to %5C
815776
$processed_html = str_replace(

tests/HTMLProcessorTest.php

Lines changed: 0 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -287,89 +287,6 @@ public function rewritePlaceholdersProvider() {
287287
];
288288
}
289289

290-
/**
291-
* @covers StaticHTMLOutput\HTMLProcessor::__construct
292-
* @covers StaticHTMLOutput\HTMLProcessor::rewriteUnchangedPlaceholderURLs
293-
* @dataProvider unchangedURLsProvider
294-
*/
295-
public function testRewritingRemainingPlaceholders(
296-
$placeholder_url,
297-
$destination_url,
298-
$rewrite_rules,
299-
$processed_html,
300-
$exp_result
301-
) {
302-
303-
$html_processor = new HTMLProcessor(
304-
false, // $remove_conditional_head_comments = false
305-
false, // $remove_html_comments = false
306-
false, // $remove_wp_links = false
307-
false, // $remove_wp_meta = false
308-
'', // $rewrite_rules = false
309-
'', // $base_url
310-
'', // $selected_deployment_option = 'folder'
311-
'', // $wp_site_url
312-
'' // $wp_uploads_path
313-
);
314-
315-
$this->assertEquals(
316-
$exp_result,
317-
$html_processor->rewriteUnchangedPlaceholderURLs(
318-
$processed_html,
319-
$placeholder_url,
320-
$destination_url,
321-
$rewrite_rules
322-
)
323-
);
324-
}
325-
326-
public function unchangedURLsProvider() {
327-
return [
328-
'http destination URL with trailing slash and trailing chars' => [
329-
'http://PLACEHOLDER.wpsho',
330-
'https://somedomain.com',
331-
'',
332-
'<a href="http://PLACEHOLDER.wpsho/banana.jpg">Link to some file</a>',
333-
'<a href="https://somedomain.com/banana.jpg">Link to some file</a>',
334-
],
335-
'http destination URL with trailing slash' => [
336-
'http://PLACEHOLDER.wpsho',
337-
'https://somedomain.com',
338-
'',
339-
'<a href="http://PLACEHOLDER.wpsho/">Link to some file</a>',
340-
'<a href="https://somedomain.com/">Link to some file</a>',
341-
],
342-
'http destination URL without trailing slash' => [
343-
'http://PLACEHOLDER.wpsho',
344-
'https://somedomain.com',
345-
'',
346-
'<a href="http://PLACEHOLDER.wpsho">Link to some file</a>',
347-
'<a href="https://somedomain.com">Link to some file</a>',
348-
],
349-
'https destination URL with trailing slash and trailing chars' => [
350-
'http://PLACEHOLDER.wpsho',
351-
'https://somedomain.com',
352-
'',
353-
'<a href="http://PLACEHOLDER.wpsho/banana.jpg">Link to some file</a>',
354-
'<a href="https://somedomain.com/banana.jpg">Link to some file</a>',
355-
],
356-
'https destination URL with trailing slash' => [
357-
'http://PLACEHOLDER.wpsho',
358-
'https://somedomain.com',
359-
'',
360-
'<a href="http://PLACEHOLDER.wpsho/">Link to some file</a>',
361-
'<a href="https://somedomain.com/">Link to some file</a>',
362-
],
363-
'https destination URL without trailing slash' => [
364-
'http://PLACEHOLDER.wpsho',
365-
'https://somedomain.com',
366-
'',
367-
'<a href="http://PLACEHOLDER.wpsho">Link to some file</a>',
368-
'<a href="https://somedomain.com">Link to some file</a>',
369-
],
370-
];
371-
}
372-
373290
/**
374291
* @covers StaticHTMLOutput\HTMLProcessor::__construct
375292
* @covers StaticHTMLOutput\HTMLProcessor::detectEscapedSiteURLs

0 commit comments

Comments
 (0)