HEX
Server: LiteSpeed
System: Linux server902.web-hosting.com 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64
User: deshuvsd (2181)
PHP: 8.1.34
Disabled: NONE
Upload Files
File: //proc/thread-self/root/home/deshuvsd/www/wp-content/plugins/surerank/inc/modules/nudges/utils.php
<?php
/**
 * Utils class.
 *
 * @package SureRank\Inc\Modules\Nudges
 * @since 1.5.0
 */

namespace SureRank\Inc\Modules\Nudges;

use SureRank\Inc\Traits\Get_Instance;
use WP_Error;

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly.
}

/**
 * The Utils class.
 *
 * @package SureRank\Inc\Modules\Nudges
 * @since 1.5.0
 */
class Utils {



	use Get_Instance;


	/**
	 * Check if Pro version is active.
	 * 
	 * @return bool True if pro is active, false otherwise.
	 */
	public function is_pro_active() {
		return defined( 'SURERANK_PRO_VERSION' );
	}

	/**
	 * Get Pro Nudges.
	 *
	 * @return array<string, array<string, mixed>>
	 */
	public function get_nudges() {
		$nudges = get_option( SURERANK_NUDGES, [] );

		if ( empty( $nudges ) ) {
			return [];
		}

		foreach ( $nudges as $key => $nudge ) {

			if ( isset( $nudge['display'] ) && $nudge['display'] === false ) {
				continue;
			}

			if ( isset( $nudge['next_time_to_display'] ) && time() < $nudge['next_time_to_display'] ) {
				$nudges[ $key ]['display'] = false;
			}
		}
		return $nudges;
	}

}