HEX
Server: Apache
System: Linux hp3-wp-1011494.hostingp3.local 3.10.0-1160.139.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Nov 3 13:30:41 UTC 2025 x86_64
User: csh2729955 (2121743)
PHP: 7.4.33
Disabled: shell_exec,exec,system,popen,set_time_limit
Upload Files
File: /home/storage/162/3480162/user/htdocs/wp-content/plugins/envo-magazine-pro/lib/update-notifier.php
<?php
// Constants for the theme name, folder and remote XML url
define( 'ENVOTHEME_NOTIFIER_THEME_NAME', 'Envo Magazine PRO' ); // The theme name
define( 'ENVOTHEME_NOTIFIER_THEME_FOLDER_NAME', 'envo-magazine-pro' ); // The theme folder name
define( 'ENVOTHEME_NOTIFIER_XML_FILE', 'http://envothemes.com/wp-content/uploads/updates/envo-magazine-pro.xml' ); // The remote notifier XML file containing the latest version of the theme and changelog
define( 'ENVOTHEME_NOTIFIER_CACHE_INTERVAL', 21600 ); // The time interval for the remote XML cache in the database (21600 seconds = 6 hours)
// Adds an update notification to the WordPress Dashboard menu
function update_notifier_menu() {
	if ( function_exists( 'simplexml_load_string' ) ) { // Stop if simplexml_load_string funtion isn't available
		$xml		 = get_latest_theme_version( ENVOTHEME_NOTIFIER_CACHE_INTERVAL ); // Get the latest remote XML file on our server
		

		if ( version_compare( $xml->latest, PLUGIN_CURRENT_VERSION, '>' ) ) { // Compare current theme version with the remote XML version
			//add_theme_page( ENVOTHEME_NOTIFIER_THEME_NAME . ' Theme Updates', ENVOTHEME_NOTIFIER_THEME_NAME . ' <span class="update-plugins count-1"><span class="update-count">1 Update</span></span>', 'administrator', 'envo-mag-pro-update-notifier', 'update_notifier');
			add_submenu_page( 'index.php', ENVOTHEME_NOTIFIER_THEME_NAME . ' Theme Updates', ENVOTHEME_NOTIFIER_THEME_NAME . ' <span class="update-plugins count-1"><span class="update-count">1 Update</span></span>', 'administrator', 'envo-mag-pro-update-notifier', 'update_notifier');
		}
	}
}

add_action( 'admin_menu', 'update_notifier_menu' );

// Adds an update notification to the WordPress 3.1+ Admin Bar
function update_notifier_bar_menu() {
	if ( function_exists( 'simplexml_load_string' ) ) { // Stop if simplexml_load_string funtion isn't available
		global $wp_admin_bar, $wpdb;

		if ( !is_super_admin() || !is_admin_bar_showing() ) // Don't display notification in admin bar if it's disabled or the current user isn't an administrator
			return;

		$xml		 = get_latest_theme_version( ENVOTHEME_NOTIFIER_CACHE_INTERVAL ); // Get the latest remote XML file on our server
		

		if ( version_compare( $xml->latest, PLUGIN_CURRENT_VERSION, '>' ) ) { // Compare current theme version with the remote XML version
			$wp_admin_bar->add_menu( array( 'id' => 'update_notifier', 'title' => '<span>' . ENVOTHEME_NOTIFIER_THEME_NAME . ' <span id="ab-updates">1 Update</span></span>', 'href' => get_admin_url() . 'admin.php?page=envo-mag-pro-update-notifier' ) );
		}
	}
}

add_action( 'admin_bar_menu', 'update_notifier_bar_menu', 1000 );

// The notifier page
function update_notifier() {
	$xml		 = get_latest_theme_version( ENVOTHEME_NOTIFIER_CACHE_INTERVAL ); // Get the latest remote XML file on our server
	
	?>

	<style>
		.update-nag { display: none; }
		#instructions {max-width: 800px;}
		h3.title {margin: 30px 0 0 0; padding: 30px 0 0 0; border-top: 1px solid #ddd;}
	</style>

	<div class="wrap">

		<div id="icon-tools" class="icon32"></div>
		<h2><?php echo ENVOTHEME_NOTIFIER_THEME_NAME ?> Plugin Updates</h2>
		<div id="message" class="updated below-h2"><p><strong>There is a new version of the <?php echo ENVOTHEME_NOTIFIER_THEME_NAME; ?> plugin available.</strong> You have version <?php echo PLUGIN_CURRENT_VERSION; ?> installed. Update to version <?php echo $xml->latest; ?>.</p></div>

		<img style="margin: 0 20px 20px 0; border: 1px solid #ddd; max-width: 350px; float: left;" src="<?php echo get_stylesheet_directory_uri() . '/screenshot.png'; ?>" />

		<div id="instructions">
			<h3>Update Download and Instructions</h3>
			<p><strong>Please note:</strong> make a <strong>backup</strong> of the plugin inside your WordPress installation folder <strong>/wp-content/plugins/<?php echo ENVOTHEME_NOTIFIER_THEME_FOLDER_NAME; ?>/</strong></p>
			<p>To update the plugin, login to <a href="https://envothemes.com/my-account/">EnvoThemes</a> account (account? - the one your created while purchasing or before), head over to your <strong>My Downloads</strong> section and re-download the plugin like you did when you bought it.</p>
			<p>Extract the zip's contents, look for the extracted theme folder, and after you have all the new files upload them using FTP to the <strong>/wp-content/plugins/<?php echo ENVOTHEME_NOTIFIER_THEME_FOLDER_NAME; ?>/</strong> folder overwriting the old ones (this is why it's important to backup any changes you've made to the theme files).</p>
			<p>If you didn't make any changes to the plugin files, you are free to overwrite them with the new ones without the risk of losing theme/plugin settings, pages, posts, etc, and backwards compatibility is guaranteed.</p>
		</div>
		<p>
		<h2 class="title">Changelog</h2>
	<?php echo nl2br( $xml->changelog ); ?>
	</p>
	</div>

	<?php
	}

// Get the remote XML file contents and return its data (Version and Changelog)
// Uses the cached version if available and inside the time interval defined
	function get_latest_theme_version( $interval ) {
		$notifier_file_url			 = ENVOTHEME_NOTIFIER_XML_FILE;
		$db_cache_field				 = 'envomag-notifier-cache';
		$db_cache_field_last_updated = 'envomag-notifier-cache-last-updated';
		$last						 = get_option( $db_cache_field_last_updated );
		$now						 = time();
		// check the cache
		if ( !$last || (( $now - $last ) > $interval) ) {
			// cache doesn't exist, or is old, so refresh it
			if ( function_exists( 'curl_init' ) ) { // if cURL is available, use it...
				$ch		 = @curl_init( $notifier_file_url );
				@curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
				@curl_setopt( $ch, CURLOPT_HEADER, 0 );
				@curl_setopt( $ch, CURLOPT_TIMEOUT, 10 );
				$cache	 = @curl_exec( $ch );
				@curl_close( $ch );
			} else {
				$cache = file_get_contents( $notifier_file_url ); // ...if not, use the common file_get_contents()
			}

			if ( $cache ) {
				// we got good results	
				update_option( $db_cache_field, $cache );
				update_option( $db_cache_field_last_updated, time() );
			}
			// read from the cache file
			$notifier_data = get_option( $db_cache_field );
		} else {
			// cache file is fresh enough, so read from it
			$notifier_data = get_option( $db_cache_field );
		}

		// Let's see if the $xml data was returned as we expected it to.
		// If it didn't, use the default 1.0.0 as the latest version so that we don't have problems when the remote server hosting the XML file is down
		if ( strpos( (string) $notifier_data, '<notifier>' ) === false ) {
			$notifier_data = '<?xml version="1.0" encoding="UTF-8"?><notifier><latest>1.0</latest><changelog></changelog></notifier>';
		}

		// Load the remote XML data into a variable and return it
		$xml = @simplexml_load_string( $notifier_data );

		return $xml;
	}