: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
'wpmudev-recommended-plugins-register-notice',
__( 'Smush', 'wp-smushit' ),
\Smush\App\Admin::$plugin_pages,
array( 'before', '.sui-wrap .sui-floating-notices, .sui-wrap .sui-upgrade-page' )
public function enable_free_tips_opt_in( $is_disabled, $type, $plugin ) {
if ( 'smush' === $plugin && 'email' === $type ) {
* Only for WPMU DEV Members.
public function register_pro_modules() {
if ( ! file_exists( WP_SMUSH_DIR . 'core/external/dash-notice/wpmudev-dash-notification.php' ) ) {
// Register items for the dashboard plugin.
$wpmudev_notices[] = array(
'name' => 'WP Smush Pro',
/* @noinspection PhpIncludeInspection */
require_once WP_SMUSH_DIR . 'core/external/dash-notice/wpmudev-dash-notification.php';
* Check if user is premium member, check for API key.
* @param bool $manual Is it a manual check? Default: false.
public function validate_install( $manual = false ) {
if ( isset( self::$is_pro ) && ! $manual ) {
// No API key set, always false.
$api_key = Smush\Core\Helper::get_wpmudev_apikey();
if ( empty( $api_key ) ) {
// Flag to check if we need to revalidate the key.
$api_auth = get_site_option( 'wp_smush_api_auth' );
// Check if we need to revalidate.
if ( empty( $api_auth[ $api_key ] ) ) {
$last_checked = $api_auth[ $api_key ]['timestamp'];
$valid = $api_auth[ $api_key ]['validity'];
$diff = ( time() - $last_checked ) / HOUR_IN_SECONDS;
// If we are supposed to validate API, update the results in options table.
if ( $revalidate || $manual ) {
if ( empty( $api_auth[ $api_key ] ) ) {
$api_auth[ $api_key ] = array();
// Storing it as valid, unless we really get to know from API call.
$api_auth[ $api_key ]['validity'] = 'valid';
// This is the first check.
if ( ! isset( $api_auth[ $api_key ]['timestamp'] ) ) {
$api_auth[ $api_key ]['timestamp'] = time();
$request = $this->api()->check( $manual );
if ( ! is_wp_error( $request ) && 200 === wp_remote_retrieve_response_code( $request ) ) {
// Update the timestamp only on successful attempts.
$api_auth[ $api_key ]['timestamp'] = time();
update_site_option( 'wp_smush_api_auth', $api_auth );
$result = json_decode( wp_remote_retrieve_body( $request ) );
if ( ! empty( $result->success ) && $result->success ) {
update_site_option( 'wp-smush-cdn_status', $result->data );
} elseif ( ! isset( $valid ) || 'valid' !== $valid ) {
// Invalidate only in case when it was not valid before.
$api_auth[ $api_key ]['validity'] = $valid;
update_site_option( 'wp_smush_api_auth', $api_auth );
self::$is_pro = isset( $valid ) && 'valid' === $valid;