Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions wpuf.php
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@
public function process_wpuf_pro_version() {
// check whether the version of wpuf pro is prior to the code restructure
if ( defined( 'WPUF_PRO_VERSION' ) && version_compare( WPUF_PRO_VERSION, '4', '<' ) ) {
// deactivate_plugins( WPUF_PRO_FILE );

Check warning on line 246 in wpuf.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

This comment is 43% valid code; is this commented out code?

add_action( 'admin_notices', [ $this, 'wpuf_upgrade_notice' ] );
}
Expand All @@ -260,8 +260,13 @@
<h2><?php esc_html_e( 'Your WP User Frontend Pro is almost ready!', 'wp-user-frontend' ); ?></h2>
<p>
<?php
/* translators: 1: opening anchor tag, 2: closing anchor tag. */
echo sprintf( wp_kses_post( __( 'We\'ve pushed a major update on both <b>WP User Frontend Free</b> and <b>WP User Frontend Pro</b> that requires you to use latest version of both. Please update the WPUF pro to the latest version. <br><strong>Please make sure to take a complete backup of your site before updating.</strong>', 'wp-user-frontend' ), '<a target="_blank" href="https://wordpress.org/plugins/wp-user-frontend/">', '</a>' ) );
echo wp_kses_post(

Check failure on line 263 in wpuf.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Whitespace found at end of line
sprintf(

Check failure on line 264 in wpuf.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Whitespace found at end of line
__( 'We\'ve pushed a major update on both <b>WP User Frontend Free</b> and <b>%1$sWP User Frontend Pro%2$s</b> that requires you to use latest version of both. Please update the WPUF pro to the latest version. <br><strong>Please make sure to take a complete backup of your site before updating.</strong>', 'wp-user-frontend' ),

Check failure on line 265 in wpuf.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

A function call to __() with texts containing placeholders was found, but was not accompanied by a "translators:" comment on the line above to clarify the meaning of the placeholders.
'<a target="_blank" href="https://wordpress.org/plugins/wp-user-frontend/">',
'</a>'
)
);
Comment on lines +263 to +269
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Core fix is correct — sprintf() now properly wraps the translation.

The restructuring correctly ensures sprintf() processes the placeholders before the result is passed to wp_kses_post(). This resolves the original issue.

However, there are a few items to address:

  1. Trailing whitespace (lines 263-264): PHPCS is failing due to trailing whitespace.

  2. Missing translators comment: WordPress coding standards require a // translators: comment above __() calls containing placeholders to help translators understand their meaning.

  3. Link URL mismatch: The anchor wraps "WP User Frontend Pro" but links to wordpress.org/plugins/wp-user-frontend/ which is the free plugin page. Should this link to the Pro product page (e.g., wedevs.com/wp-user-frontend-pro/) instead?

Proposed fix addressing whitespace and translators comment
 <?php
-                    echo wp_kses_post( 
-                        sprintf( 
-                            __( 'We\'ve pushed a major update on both <b>WP User Frontend Free</b> and <b>%1$sWP User Frontend Pro%2$s</b> that requires you to use latest version of both. Please update the WPUF pro to the latest version. <br><strong>Please make sure to take a complete backup of your site before updating.</strong>', 'wp-user-frontend' ),
-                            '<a target="_blank" href="https://wordpress.org/plugins/wp-user-frontend/">',
+                    // translators: %1$s and %2$s are opening and closing anchor tags for the WP User Frontend Pro link.
+                    echo wp_kses_post(
+                        sprintf(
+                            __( 'We\'ve pushed a major update on both <b>WP User Frontend Free</b> and <b>%1$sWP User Frontend Pro%2$s</b> that requires you to use latest version of both. Please update the WPUF pro to the latest version. <br><strong>Please make sure to take a complete backup of your site before updating.</strong>', 'wp-user-frontend' ),
+                            '<a target="_blank" href="https://wedevs.com/wp-user-frontend-pro/">',
                             '</a>'
                         )
                     );
🧰 Tools
🪛 GitHub Check: Run PHPCS inspection

[failure] 265-265:
A function call to __() with texts containing placeholders was found, but was not accompanied by a "translators:" comment on the line above to clarify the meaning of the placeholders.


[failure] 264-264:
Whitespace found at end of line


[failure] 263-263:
Whitespace found at end of line

🤖 Prompt for AI Agents
In `@wpuf.php` around lines 263 - 269, Remove the trailing whitespace on the
sprintf block lines and add a translators comment immediately above the __()
call to explain the two HTML placeholder arguments (e.g., // translators: %1$s
opening anchor tag for free/pro link, %2$s closing anchor tag), and update the
anchor href used in the sprintf placeholders so the anchor wrapping "WP User
Frontend Pro" points to the Pro product URL instead of the free plugin URL; keep
the current call structure using sprintf(...) passed into wp_kses_post(...) and
ensure no extra spaces remain.

?>
</p>
</div>
Expand Down Expand Up @@ -351,11 +356,11 @@
*/
public function plugin_action_links( $links ) {
$links[] = '<a href="' . admin_url( 'admin.php?page=wpuf-settings' ) . '">' . esc_html( 'Settings' ) . '</a>';
$links[] = '<a href="https://wedevs.com/docs/wp-user-frontend-pro/getting-started/how-to-install/" target="_blank"> '. esc_html( 'Docs' ) . '</a>';

Check failure on line 359 in wpuf.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Concat operator must be surrounded by a single space

if ( ! $this->is_pro() ) {
$links[] = '<a href="https://wedevs.com/wp-user-frontend-pro/pricing/?utm_source=installed_plugins" target="_blank" style="color: #64C273;"> '. esc_html( 'Upgrade to Pro' ) . '</a>';

Check failure on line 362 in wpuf.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Concat operator must be surrounded by a single space
$links[] = '<a href="https://wedevs.com/coupons/?utm_source=installed_plugins" target="_blank" style="color: #5368FF;">'. esc_html( 'Check Discounts' ) . '</a>';

Check failure on line 363 in wpuf.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Concat operator must be surrounded by a single space
}

return $links;
Expand Down Expand Up @@ -420,7 +425,7 @@
*
* @return WP_User_Frontend
*/
function wpuf() {

Check failure on line 428 in wpuf.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

A file should either contain function declarations or OO structure declarations, but not both. Found 1 function declaration(s) and 1 OO structure declaration(s). The first function declaration was found on line 428; the first OO declaration was found on line 38
return WP_User_Frontend::instance();
}

Expand Down
Loading