Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Activate Scheduled Events
- *
- * This adds all scheduled events for the theme to run via WP Cron.
- *
- * @param void
- * @return void
- * @access private
- */
- function _browscap_activate_schedules()
- {
- if( !wp_next_scheduled('_browscap_check_browscap') )
- {
- wp_schedule_event(time(), 'daily', '_browscap_check_browscap');
- }
- }
- add_action('wp', '_browscap_activate_schedules');
- /**
- * Check for new Browscap version
- *
- * This theme uses {@link http://browsers.garykeith.com/ Browscap} to check for browser <br>
- * support and browser details. By having the latest version of Browscap, we can be <br>
- * sure we can detect the latest versions of browsers with up-to-date information.
- *
- * This function is added as a scheduled event to run every day and check for a new version.
- *
- * @param void
- * @return void
- * @access private
- */
- function _browscap_check_for_new_browscap()
- {
- // Only check remote version number if the browscap version is current
- if( get_option('_browscap_ver_is_current') )
- {
- // Retrieve the current version number from the browscap website
- $version = wp_remote_fopen('http://browsers.garykeith.com/versions/version-number.asp');
- // Get local browscap version
- if( version_compare(PHP_VERSION, '5.3.0') >= 0 )
- $brows = parse_ini_file(BROWSECAP_FILE, true, INI_SCANNER_RAW);
- else
- $brows = parse_ini_file(BROWSECAP_FILE, true);
- $local_version = $brows['GJK_Browscap_Version']['Version'];
- $rversion = get_option('browscap_remote_version');
- if($version != $local_version)
- {
- update_option('_browscap_ver_is_current', 0);
- update_option('browscap_remote_version', $version);
- }
- elseif( $rversion )
- update_option('browscap_remote_version', $version);
- }
- }
- add_action('_browscap_check_browscap', '_browscap_check_for_new_browscap');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement