Skip to content

Commit d9c4c66

Browse files
committed
fix: prefix globals in welcome and mce strings
1 parent fd1ed58 commit d9c4c66

File tree

2 files changed

+46
-44
lines changed

2 files changed

+46
-44
lines changed

src/php/front-end/mce-strings.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
use _WP_Editors;
1111

12+
/* phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound */
1213
/**
1314
* Variable types.
1415
*
@@ -53,3 +54,4 @@
5354
$strings = [ _WP_Editors::$mce_locale => [ 'code_snippets' => $strings ] ];
5455
/** $strings is used by outer file. @noinspection PhpUnusedLocalVariableInspection */
5556
$strings = 'tinyMCE.addI18n(' . wp_json_encode( $strings ) . ');';
57+
/* phpcs:enable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound */

src/php/views/welcome.php

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
return;
1919
}
2020

21-
$hero = $this->api->get_hero_item();
21+
$code_snippets_hero = $this->api->get_hero_item();
2222

23-
$changelog_sections = [
23+
$code_snippets_changelog_sections = [
2424
'Added' => [
2525
'title' => __( 'New features', 'code-snippets' ),
2626
'icon' => 'lightbulb',
@@ -39,7 +39,7 @@
3939
],
4040
];
4141

42-
$plugin_types = [
42+
$code_snippets_plugin_types = [
4343
'core' => __( 'Core', 'code-snippets' ),
4444
'pro' => __( 'Pro', 'code-snippets' ),
4545
];
@@ -78,50 +78,50 @@ class="csp-link-<?php echo esc_attr( $link_name ); ?>">
7878
</nav>
7979
</div>
8080

81-
<section class="csp-section-changes">
82-
<h1>📰 <?php esc_html_e( 'Latest news', 'code-snippets' ); ?></h1>
83-
<div class="csp-cards">
84-
<a class="csp-card" href="<?php echo esc_url( $hero['follow_url'] ); ?>" target="_blank"
85-
title="<?php esc_attr_e( 'Read more', 'code-snippets' ); ?>">
86-
<header>
87-
<span class="dashicons dashicons-external"></span>
88-
<h2><?php echo esc_html( $hero['name'] ); ?></h2>
89-
</header>
90-
<figure>
91-
<div id="csp-loading-spinner" class="csp-loading-spinner"></div>
92-
<img id="csp-changes-img"
93-
onload="hideLoadingAnimation()"
94-
src="<?php echo esc_url( $hero['image_url'] ); ?>"
95-
alt="<?php esc_attr_e( 'Latest news image', 'code-snippets' ); ?>);">
96-
</figure>
97-
</a>
81+
<section class="csp-section-changes">
82+
<h1>📰 <?php esc_html_e( 'Latest news', 'code-snippets' ); ?></h1>
83+
<div class="csp-cards">
84+
<a class="csp-card" href="<?php echo esc_url( $code_snippets_hero['follow_url'] ); ?>" target="_blank"
85+
title="<?php esc_attr_e( 'Read more', 'code-snippets' ); ?>">
86+
<header>
87+
<span class="dashicons dashicons-external"></span>
88+
<h2><?php echo esc_html( $code_snippets_hero['name'] ); ?></h2>
89+
</header>
90+
<figure>
91+
<div id="csp-loading-spinner" class="csp-loading-spinner"></div>
92+
<img id="csp-changes-img"
93+
onload="hideLoadingAnimation()"
94+
src="<?php echo esc_url( $code_snippets_hero['image_url'] ); ?>"
95+
alt="<?php esc_attr_e( 'Latest news image', 'code-snippets' ); ?>);">
96+
</figure>
97+
</a>
9898

9999
<a class="csp-card csp-changelog-wrapper" href="https://wordpress.org/plugins/code-snippets/changelog" target="_blank"
100100
title="<?php esc_attr_e( 'Read the full changelog', 'code-snippets' ); ?>">
101-
<header>
102-
<span class="dashicons dashicons-external"></span>
103-
<h2><?php esc_html_e( 'Latest changes', 'code-snippets' ); ?></h2>
104-
</header>
105-
<div class="csp-section-changelog">
106-
<?php foreach ( $this->api->get_changelog() as $version => $version_changes ) { ?>
107-
<h3><?php echo esc_html( $version ); ?></h3>
108-
<article>
109-
<?php
110-
foreach ( $changelog_sections as $section_key => $section ) {
111-
if ( empty( $version_changes[ $section_key ] ) ) {
112-
continue;
113-
}
114-
?>
115-
<h4>
116-
<span class="dashicons dashicons-<?php echo esc_attr( $section['icon'] ); ?>"></span>
117-
<?php echo esc_html( $section['title'] ); ?>
118-
</h4>
119-
<ul>
120-
<?php
121-
foreach ( $plugin_types as $plugin_type => $type_label ) {
122-
if ( empty( $version_changes[ $section_key ][ $plugin_type ] ) ) {
123-
continue;
124-
}
101+
<header>
102+
<span class="dashicons dashicons-external"></span>
103+
<h2><?php esc_html_e( 'Latest changes', 'code-snippets' ); ?></h2>
104+
</header>
105+
<div class="csp-section-changelog">
106+
<?php foreach ( $this->api->get_changelog() as $version => $version_changes ) { ?>
107+
<h3><?php echo esc_html( $version ); ?></h3>
108+
<article>
109+
<?php
110+
foreach ( $code_snippets_changelog_sections as $section_key => $section ) {
111+
if ( empty( $version_changes[ $section_key ] ) ) {
112+
continue;
113+
}
114+
?>
115+
<h4>
116+
<span class="dashicons dashicons-<?php echo esc_attr( $section['icon'] ); ?>"></span>
117+
<?php echo esc_html( $section['title'] ); ?>
118+
</h4>
119+
<ul>
120+
<?php
121+
foreach ( $code_snippets_plugin_types as $plugin_type => $type_label ) {
122+
if ( empty( $version_changes[ $section_key ][ $plugin_type ] ) ) {
123+
continue;
124+
}
125125

126126
foreach ( $version_changes[ $section_key ][ $plugin_type ] as $change ) {
127127
?>

0 commit comments

Comments
 (0)