Skip to content

Commit 1c2c0ab

Browse files
committed
Update integration test plugins and theme
1 parent d335ba8 commit 1c2c0ab

File tree

9 files changed

+53
-88
lines changed

9 files changed

+53
-88
lines changed

integrations/plugins/plugin-beta/plugin-beta.php

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/**
44
* Plugin Name: Plugin Beta
55
* Plugin URI: https://fontawesome.com/
6-
* Description: Registered Client with preferences version: webfont, 5.1.0, v4shim: on. Prepends a block before each blog post that displays (1) "fab fa-font-awesome", (2) "fa fa-arrows", which is a v4 icon declaration that the v4 shim should translate to "fas fa-arrows-alt", and (3) "fas fa-angry", which was a new icon in v5.1.0.
6+
* Description: Registered Client with preferences version: webfont, 5.1.0, v4shim: on. Adds content to the page footer that displays (1) "fab fa-font-awesome", (2) "fa fa-arrows", which is a v4 icon declaration that the v4 shim should translate to "fas fa-arrows-alt", and (3) "fas fa-angry", which was a new icon in v5.1.0.
77
* Version: 0.0.1
88
* Author: Font Awesome
99
* Author URI: https://fontawesome.com/
@@ -30,19 +30,13 @@ function() {
3030
}
3131
);
3232

33-
add_filter(
34-
'the_content',
35-
function( $content ) {
36-
$pre_content = <<<EOT
37-
<div class="plugin-beta-pre-content" style="border: 1px solid grey;">
33+
add_action('wp_print_footer_scripts', function() use($pre_content) {
34+
?>
35+
<div class="plugin-beta-content" style="border: 1px solid grey;">
3836
<h2>Plugin Beta</h2>
3937
<p>Expected by plugin-beta: "fab fa-font-awesome": <i class="fab fa-font-awesome"></i></p>
4038
<p>Shim icon (using the v4 class name): "fa fa-arrows": <i class="fa fa-arrows"></i></p>
4139
<p>Icon introduced in 5.1.0: "fas fa-angry": <i class="fas fa-angry"></i></p>
4240
</div>
43-
EOT;
44-
return $pre_content . $content;
45-
},
46-
10,
47-
1
48-
);
41+
<?php
42+
});

integrations/plugins/plugin-delta/plugin-delta.php

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/**
44
* Plugin Name: Plugin Delta
55
* Plugin URI: https://fontawesome.com/
6-
* Description: Unregistered Client: tries to enqueue its own v5.0.11 SVG/JS from use.fontawesome.com. For display, prepends a block before every blog post that displays an icon with classes "fas fa-cloud-download". This icon appeared in v5.0.11 and is only available in Pro. It adds the same output on the login page, and in the footer of admin pages.
6+
* Description: Unregistered Client: tries to enqueue its own v5.0.11 SVG/JS from use.fontawesome.com. For display, adds content to the page footer that displays an icon with classes "fas fa-cloud-download". This icon appeared in v5.0.11 and is only available in Pro. It adds the same output on the login page, and in the footer of admin pages.
77
* Version: 0.0.1
88
* Author: Font Awesome
99
* Author URI: https://fontawesome.com/
@@ -30,24 +30,20 @@ function() {
3030
);
3131
}
3232

33-
$pre_content = <<<EOT
34-
<div class="plugin-delta-pre-content" style="border: 1px solid grey;">
33+
$extra_content = <<<EOT
34+
<div class="plugin-delta-content" style="border: 1px solid grey;">
3535
<h2>Plugin Delta</h2>
3636
<p>Expected by plugin-delta (introduced v5.0.11): "fas fa-cloud-download": <i class="fas fa-cloud-download"></i></p>
3737
</div>
3838
EOT;
3939

40-
add_filter('the_content', function($content) use($pre_content) {
41-
return $pre_content . $content;
42-
}, 10, 1);
43-
44-
add_filter('login_message', function($content) use($pre_content) {
45-
return $pre_content . $content;
40+
add_action('wp_print_footer_scripts', function() use($extra_content) {
41+
echo $extra_content;
4642
});
4743

48-
add_action('admin_footer', function() use($pre_content) {
44+
add_action('admin_footer', function() use($extra_content) {
4945
?>
50-
<style>.plugin-delta-pre-content{position:absolute; margin-left: 20rem;}</style>
46+
<style>.plugin-delta-content{position:absolute; margin-left: 20rem;}</style>
5147
<?php
52-
echo $pre_content;
48+
echo $extra_content;
5349
});

integrations/plugins/plugin-eta/plugin-eta.php

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/**
44
* Plugin Name: Plugin Eta
55
* Plugin URI: https://fontawesome.com/
6-
* Description: Registered Client with preferences: technology: svg, pseudoElements: true. Prepends a block to each blog post that displays the "fa-bed" icon as a :before pseudo-element.
6+
* Description: Registered Client with preferences: technology: svg, pseudoElements: true. Adds content to the page footer that displays the "fa-bed" icon as a :before pseudo-element.
77
* Version: 0.0.1
88
* Author: Font Awesome
99
* Author URI: https://fontawesome.com/
@@ -43,16 +43,14 @@ function() {
4343
}
4444
);
4545

46-
add_filter('the_content', function($content){
47-
$classes = plugin_eta_fa_classes();
48-
$pre_content = <<<EOT
49-
<div class="$classes" style="border: 1px solid grey;">
46+
add_action('wp_print_footer_scripts', function() use($pre_content) {
47+
?>
48+
<div class="<?php echo esc_html__(plugin_eta_fa_classes(), 'font-awesome'); ?>" style="border: 1px solid grey;">
5049
<h2>Plugin Eta</h2>
5150
<p>Expected by plugin-eta: "fas fa-bed" icon as :before pseudo-element. <span class="bed"><- bed?</span></p>
52-
</uiv>
53-
EOT;
54-
return $pre_content . $content;
55-
}, 10, 1);
51+
</div>
52+
<?php
53+
});
5654

5755
function plugin_eta_fa_classes(){
5856
$fa = fa();

integrations/plugins/plugin-gamma/plugin-gamma.php

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/**
44
* Plugin Name: Plugin Gamma
55
* Plugin URI: https://fontawesome.com/
6-
* Description: Unregistered Client: tries to enqueue its own v4.7.0 webfont version from cdn.jsdelivr.net. On the front end, it prepends a block before each blog post that displays an icon with "fa fa-bathtub", which is a version 4 specification that the v4shim should translate to "fas fa-bath". It adds the same output on the login page, and in the footer of admin pages. It also emits rogue output that might break our REST API responses, like a buggy plugin might do.
6+
* Description: Unregistered Client: tries to enqueue its own v4.7.0 webfont version from cdn.jsdelivr.net. On the front end, it adds content to the footer of the template that displays an icon with "fa fa-bathtub", which is a version 4 specification that the v4shim should translate to "fas fa-bath". It adds the same output on the login page, and in the footer of admin pages.
77
* Version: 0.0.1
88
* Author: Font Awesome
99
* Author URI: https://fontawesome.com/
@@ -14,8 +14,6 @@
1414
define( 'GAMMA_PLUGIN_VERSION', '0.0.1' );
1515
define( 'GAMMA_PLUGIN_LOG_PREFIX', 'gamma-plugin' );
1616

17-
print "This rogue output from " . GAMMA_PLUGIN_LOG_PREFIX . " should not break our handling of REST API responses from our controllers.";
18-
1917
foreach( ['wp_enqueue_scripts', 'admin_enqueue_scripts', 'login_enqueue_scripts'] as $action ) {
2018
add_action( $action, function () {
2119
wp_enqueue_style(
@@ -30,8 +28,8 @@
3028
}, 99 );
3129
}
3230

33-
$pre_content = <<<EOT
34-
<div class="plugin-gamma-pre-content" style="border: 1px solid grey;">
31+
$extra_content = <<<EOT
32+
<div class="plugin-gamma-content" style="border: 1px solid grey;">
3533
<h2>Plugin Gamma</h2>
3634
<p>v4.7.0 icon name: "fa fa-bathtub": <i class="fa fa-bathtub"></i></p>
3735
<p class="group-icon"><code>:before</code> pseudo-element should match <code>fas fa-users</code>: <i class="fas fa-users"></i></p>
@@ -40,17 +38,13 @@
4038
</div>
4139
EOT;
4240

43-
add_filter('the_content', function($content) use($pre_content){
44-
return $pre_content . $content;
45-
});
46-
47-
add_filter('login_message', function($content) use($pre_content) {
48-
return $pre_content . $content;
41+
add_action('wp_print_footer_scripts', function() use($extra_content) {
42+
echo $extra_content;
4943
});
5044

51-
add_action('admin_footer', function() use($pre_content) {
45+
add_action('admin_footer', function() use($extra_content) {
5246
?>
53-
<style>.plugin-gamma-pre-content{position:absolute; margin-left: 20rem;}</style>
47+
<style>.plugin-gamma-content{position:absolute; margin-left: 20rem;}</style>
5448
<?php
55-
echo $pre_content;
49+
echo $extra_content;
5650
}, 10, 1);

integrations/plugins/plugin-kappa/plugin-kappa.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/**
44
* Plugin Name: Plugin Kappa
55
* Plugin URI: https://fontawesome.com/
6-
* Description: Unregistered Client: tries to enqueue its own self-hosted v4.7.0 webfont version. It prepends a block before each blog post that displays an icon with "fa fa-bathtub", which is a version 4 specification that the v4shim should translate to "fas fa-bath". It also uses some pseudo-elements with a hardcoded version 4 font-family.
6+
* Description: Unregistered Client: tries to enqueue its own self-hosted v4.7.0 webfont version. It adds content to the template footer that displays an icon with "fa fa-bathtub", which is a version 4 specification that the v4shim should translate to "fas fa-bath". It also uses some pseudo-elements with a hardcoded version 4 font-family.
77
* Version: 0.0.1
88
* Author: Font Awesome
99
* Author URI: https://fontawesome.com/
@@ -32,15 +32,14 @@ function() {
3232
);
3333
}
3434

35-
add_filter('the_content', function($content){
36-
$pre_content = <<<EOT
37-
<div class="plugin-kappa-pre-content" style="border: 1px solid grey;">
35+
add_action('wp_print_footer_scripts', function() use($pre_content) {
36+
?>
37+
<div class="plugin-kappa-content" style="border: 1px solid grey;">
3838
<h2>Plugin Kappa</h2>
3939
<p>v4.7.0 icon name: "fa fa-bathtub": <i class="fa fa-bathtub"></i></p>
4040
<p class="group-icon"><code>:before</code> pseudo-element should match <code>fas fa-users</code>: <i class="fas fa-users"></i></p>
4141
<p class="facebook-icon"><code>:before</code> pseudo-element should match <code>fab fa-facebook</code>: <i class="fab fa-facebook"></i></p>
4242
<p class="hand-scissors-icon"><code>:before</code> pseudo-element should match <code>far fa-hand-scissors</code>: <i class="far fa-hand-scissors"></i></p>
4343
</div>
44-
EOT;
45-
return $pre_content . $content;
46-
}, 10, 1);
44+
<?php
45+
});

integrations/plugins/plugin-lambda/plugin-lambda.php

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
}, 99 );
2424
}
2525

26-
$pre_content = <<<EOT
27-
<div class="plugin-lambda-pre-content" style="border: 1px solid grey;">
26+
$extra_content = <<<EOT
27+
<div class="plugin-lambda-content" style="border: 1px solid grey;">
2828
<h2>Plugin Lambda</h2>
2929
<p>v4.7.0 icon name: "fa fa-bathtub": <i class="fa fa-bathtub"></i></p>
3030
<p class="group-icon"><code>:before</code> pseudo-element should match <code>fas fa-users</code>: <i class="fas fa-users"></i></p>
@@ -33,17 +33,13 @@
3333
</div>
3434
EOT;
3535

36-
add_filter('the_content', function($content) use($pre_content){
37-
return $pre_content . $content;
36+
add_action('wp_print_footer_scripts', function() use($extra_content) {
37+
echo $extra_content;
3838
});
3939

40-
add_filter('login_message', function($content) use($pre_content) {
41-
return $pre_content . $content;
42-
});
43-
44-
add_action('admin_footer', function() use($pre_content) {
40+
add_action('admin_footer', function() use($extra_content) {
4541
?>
46-
<style>.plugin-lambda-pre-content{position:absolute; margin-left: 20rem;}</style>
42+
<style>.plugin-lambda-content{position:absolute; margin-left: 20rem;}</style>
4743
<?php
48-
echo $pre_content;
44+
echo $extra_content;
4945
}, 10, 1);

integrations/plugins/plugin-sigma/plugin-sigma.php

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,17 +60,11 @@ function() {
6060
}
6161
);
6262

63-
add_filter(
64-
'the_content',
65-
function( $content ) {
66-
$pre_content = <<<EOT
63+
add_action('wp_print_footer_scripts', function() use($pre_content) {
64+
?>
6765
<div class="plugin-sigma-pre-content" style="border: 1px solid grey;">
6866
<h2>Plugin Sigma</h2>
6967
<p>Expected by plugin-sigma: "fab fa-fort-awesome": <i class="fab fa-fort-awesome"></i></p>
7068
</div>
71-
EOT;
72-
return $pre_content . $content;
73-
},
74-
10,
75-
1
76-
);
69+
<?php
70+
});

integrations/plugins/plugin-zeta/plugin-zeta.php

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/**
44
* Plugin Name: Plugin Zeta
55
* Plugin URI: https://fontawesome.com/
6-
* Description: Registered Client preferring technology: svg (but not pseudo-elements). Prepends a block before each blog post that displays a magic icon with a rotate-90 power transform.
6+
* Description: Registered Client preferring technology: svg (but not pseudo-elements). Adds content to the template footer that displays a magic icon with a rotate-90 power transform.
77
* Version: 0.0.1
88
* Author: Font Awesome
99
* Author URI: https://fontawesome.com/
@@ -28,10 +28,8 @@ function() {
2828
}
2929
);
3030

31-
add_filter(
32-
'the_content',
33-
function( $content ) {
34-
$pre_content = <<<EOT
31+
add_action('wp_print_footer_scripts', function() use($pre_content) {
32+
?>
3533
<div class="plugin-zeta-pre-content" style="border: 1px solid grey;">
3634
<h2>Plugin Zeta</h2>
3735
<p>Expected by plugin-zeta: magic icon with rotate-90 power transform:
@@ -40,9 +38,5 @@ function( $content ) {
4038
</span>
4139
</p>
4240
</div>
43-
EOT;
44-
return $pre_content . $content;
45-
},
46-
10,
47-
1
48-
);
41+
<?php
42+
});

integrations/themes/theme-alpha/style.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/*
22
Theme Name: Theme Alpha
33
Theme URI: http://example.com/theme-alpha/
4-
Description: Twenty Seventeen Child Theme
4+
Description: Twenty Nineteen Child Theme
55
Author: John Doe
66
Author URI: http://example.com
7-
Template: twentyseventeen
7+
Template: twentynineteen
88
Version: 0.0.1
99
License: GNU General Public License v2 or later
1010
License URI: http://www.gnu.org/licenses/gpl-2.0.html

0 commit comments

Comments
 (0)