-
Notifications
You must be signed in to change notification settings - Fork 146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: post description image for block theme #1490
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -33,8 +33,8 @@ public function __construct() { | |||||||||||||||||
* | ||||||||||||||||||
* @param array $atts | ||||||||||||||||||
* | ||||||||||||||||||
* @return | ||||||||||||||||||
**/ | ||||||||||||||||||
* @return false|string | ||||||||||||||||||
*/ | ||||||||||||||||||
public function edit_post_shortcode( $atts ) { | ||||||||||||||||||
add_filter( 'wpuf_form_fields', [ $this, 'add_field_settings' ] ); | ||||||||||||||||||
// @codingStandardsIgnoreStart | ||||||||||||||||||
|
@@ -52,7 +52,13 @@ public function edit_post_shortcode( $atts ) { | |||||||||||||||||
|
||||||||||||||||||
wp_login_form(); | ||||||||||||||||||
|
||||||||||||||||||
return; | ||||||||||||||||||
return ''; | ||||||||||||||||||
} | ||||||||||||||||||
|
||||||||||||||||||
$nonce = isset( $_GET['_wpnonce'] ) ? sanitize_key( wp_unslash( $_GET['_wpnonce'] ) ) : ''; | ||||||||||||||||||
|
||||||||||||||||||
if ( ! wp_verify_nonce( $nonce, 'wpuf_edit' ) ) { | ||||||||||||||||||
return '<div class="wpuf-info">' . __( 'Please re-open the post', 'wp-user-frontend' ) . '</div>'; | ||||||||||||||||||
Comment on lines
+58
to
+61
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use Using Apply this diff to fix the sanitization: $nonce = isset( $_GET['_wpnonce'] ) ?
- sanitize_key( wp_unslash( $_GET['_wpnonce'] ) ) : '';
+ sanitize_text_field( wp_unslash( $_GET['_wpnonce'] ) ) : ''; 📝 Committable suggestion
Suggested change
|
||||||||||||||||||
} | ||||||||||||||||||
|
||||||||||||||||||
$post_id = isset( $_GET['pid'] ) ? intval( wp_unslash( $_GET['pid'] ) ) : 0; | ||||||||||||||||||
|
@@ -110,7 +116,6 @@ public function edit_post_shortcode( $atts ) { | |||||||||||||||||
$form = new Form( $form_id ); | ||||||||||||||||||
|
||||||||||||||||||
$this->form_fields = $form->get_fields(); | ||||||||||||||||||
// $form_settings = wpuf_get_form_settings( $form_id ); | ||||||||||||||||||
$this->form_settings = $form->get_settings(); | ||||||||||||||||||
|
||||||||||||||||||
$disable_pending_edit = wpuf_get_option( 'disable_pending_edit', 'wpuf_dashboard', 'on' ); | ||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Consider adding a return type declaration to the method.
The docblock specifies
@return false|string
, but the method signature does not include the return type declaration. Adding the return type enhances type safety and keeps the code consistent with modern PHP practices.Apply this diff to include the return type declaration:
public function edit_post_shortcode( $atts ) + : false|string {