Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../public_h.../wp-conte.../plugins/wordpres.../src/conditio.../admin
File: estimated-reading-time-conditional.php
<?php
[0] Fix | Delete
[1] Fix | Delete
namespace Yoast\WP\SEO\Conditionals\Admin;
[2] Fix | Delete
[3] Fix | Delete
use Yoast\WP\SEO\Conditionals\Conditional;
[4] Fix | Delete
[5] Fix | Delete
/**
[6] Fix | Delete
* Conditional that is only when we want the Estimated Reading Time.
[7] Fix | Delete
*/
[8] Fix | Delete
class Estimated_Reading_Time_Conditional implements Conditional {
[9] Fix | Delete
[10] Fix | Delete
/**
[11] Fix | Delete
* The Post Conditional.
[12] Fix | Delete
*
[13] Fix | Delete
* @var Post_Conditional
[14] Fix | Delete
*/
[15] Fix | Delete
protected $post_conditional;
[16] Fix | Delete
[17] Fix | Delete
/**
[18] Fix | Delete
* Constructs the Estimated Reading Time Conditional.
[19] Fix | Delete
*
[20] Fix | Delete
* @param Post_Conditional $post_conditional The post conditional.
[21] Fix | Delete
*/
[22] Fix | Delete
public function __construct( Post_Conditional $post_conditional ) {
[23] Fix | Delete
$this->post_conditional = $post_conditional;
[24] Fix | Delete
}
[25] Fix | Delete
[26] Fix | Delete
/**
[27] Fix | Delete
* Returns whether this conditional is met.
[28] Fix | Delete
*
[29] Fix | Delete
* @return bool Whether the conditional is met.
[30] Fix | Delete
*/
[31] Fix | Delete
public function is_met() {
[32] Fix | Delete
// phpcs:disable WordPress.Security.NonceVerification.Recommended,WordPress.Security.NonceVerification.Missing -- Reason: Nonce verification should not be done in a conditional but rather in the classes using the conditional.
[33] Fix | Delete
// Check if we are in our Elementor ajax request (for saving).
[34] Fix | Delete
if ( \wp_doing_ajax() && isset( $_POST['action'] ) && \is_string( $_POST['action'] ) ) {
[35] Fix | Delete
// phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Reason: We are only strictly comparing the variable.
[36] Fix | Delete
$post_action = \wp_unslash( $_POST['action'] );
[37] Fix | Delete
if ( $post_action === 'wpseo_elementor_save' ) {
[38] Fix | Delete
return true;
[39] Fix | Delete
}
[40] Fix | Delete
}
[41] Fix | Delete
[42] Fix | Delete
if ( ! $this->post_conditional->is_met() ) {
[43] Fix | Delete
return false;
[44] Fix | Delete
}
[45] Fix | Delete
[46] Fix | Delete
// We don't support Estimated Reading Time on the attachment post type.
[47] Fix | Delete
if ( isset( $_GET['post'] ) && \is_string( $_GET['post'] ) ) {
[48] Fix | Delete
// phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Reason: We are casting to an integer.
[49] Fix | Delete
$post_id = (int) \wp_unslash( $_GET['post'] );
[50] Fix | Delete
if ( $post_id !== 0 && \get_post_type( $post_id ) === 'attachment' ) {
[51] Fix | Delete
return false;
[52] Fix | Delete
}
[53] Fix | Delete
}
[54] Fix | Delete
[55] Fix | Delete
return true;
[56] Fix | Delete
// phpcs:enable WordPress.Security.NonceVerification.Recommended,WordPress.Security.NonceVerification.Missing
[57] Fix | Delete
}
[58] Fix | Delete
}
[59] Fix | Delete
[60] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function