latest) == -1) { add_submenu_page( 'themes.php', __('Theme Update','mythemeshop').''.__('1','mythemeshop').'', __('Theme Update','mythemeshop').''.__('1','mythemeshop').'', 'manage_options', 'mythemeshop-updates', 'mts_update_notifier'); } } add_action('admin_menu', 'mts_update_notifier_menu'); function mts_update_notifier() { $xml = get_latest_theme_version(43200); // Cache the remote call for 43200 seconds (12 hours) $theme_data = wp_get_theme(); // Get the current version from style.css ?>
$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 ); } $xml = simplexml_load_string($notifier_data); return $xml; } ?>