function nebula_body_classes($classes) { $spaces_and_dots = array(' ', '.'); $underscores_and_hyphens = array('_', '-'); //Device $classes[] = strtolower(nebula_get_device('full')); //Device make and model $classes[] = strtolower(str_replace($spaces_and_dots, $underscores_and_hyphens, nebula_get_os('full'))); //Operating System name with version $classes[] = strtolower(str_replace($spaces_and_dots, $underscores_and_hyphens, nebula_get_os('name'))); //Operating System name $classes[] = strtolower(str_replace($spaces_and_dots, $underscores_and_hyphens, nebula_get_browser('full'))); //Browser name and version $classes[] = strtolower(str_replace($spaces_and_dots, $underscores_and_hyphens, nebula_get_browser('name'))); //Browser name $classes[] = strtolower(str_replace($spaces_and_dots, $underscores_and_hyphens, nebula_get_browser('engine'))); //Rendering engine //User Information $current_user = wp_get_current_user(); if (is_user_logged_in()) { $classes[] = 'user-' . $current_user->user_login; $user_info = get_userdata(get_current_user_id()); $classes[] = 'user-role-' . $user_info->roles[0]; } //Post Information if (!is_search() && !is_archive() && !is_front_page()) { global $post; $segments = explode('/', trim(parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH), '/')); $parents = get_post_ancestors($post->ID); foreach ($parents as $parent) { if (!empty($parent)) { $classes[] = 'ancestor-id-' . $parent; } } foreach ($segments as $segment) { if (!empty($segment)) { $classes[] = 'ancestor-of-' . $segment; } } foreach (get_the_category($post->ID) as $category) { $classes[] = 'cat-' . $category->cat_ID . '-id'; } } $nebula_theme_info = wp_get_theme(); $classes[] = 'nebula'; $classes[] = 'nebula_' . str_replace('.', '-', $nebula_theme_info->get('Version')); //Time of Day $classes[] = business_open() ? 'business-open' : 'business-closed'; $relative_time = nebula_relative_time('description'); foreach ($relative_time as $relative_desc) { $classes[] = 'time-' . $relative_desc; } if (date('H') >= 12) { $classes[] = 'time-pm'; } else { $classes[] = 'time-am'; } if (get_option('nebula_latitude') && get_option('nebula_longitude')) { $lat = get_option('nebula_latitude'); $lng = get_option('nebula_longitude'); $gmt = intval(get_option('gmt_offset')); $zenith = 90 + 50 / 60; //Civil twilight = 96°, Nautical twilight = 102°, Astronomical twilight = 108° $sunrise = strtotime(date_sunrise(strtotime('today'), SUNFUNCS_RET_STRING, $lat, $lng, $zenith, $gmt)); $sunset = strtotime(date_sunset(strtotime('today'), SUNFUNCS_RET_STRING, $lat, $lng, $zenith, $gmt)); if (time() >= $sunrise && time() <= $sunset) { $classes[] = 'time-daylight'; } else { $classes[] = 'time-darkness'; } if (strtotime('now') >= $sunrise - 60 * 45 && strtotime('now') <= $sunrise + 60 * 45) { //45 minutes before and after true sunrise $classes[] = 'time-sunrise'; } if (strtotime('now') >= $sunset - 60 * 45 && strtotime('now') <= $sunset + 60 * 45) { //45 minutes before and after true sunset $classes[] = 'time-sunset'; } } $classes[] = 'date-day-' . strtolower(date('l')); $classes[] = 'date-ymd-' . strtolower(date('Y-m-d')); $classes[] = 'date-month-' . strtolower(date('F')); if ($GLOBALS['http'] && is_int($GLOBALS['http'])) { $classes[] = 'error' . $GLOBALS['http']; } return $classes; }
</strong> iOS, and it <strong><?php echo nebula_is_os('android') ? 'is' : 'is not'; ?> </strong> Android. For example, this <strong><?php echo nebula_is_os('mac', '10.10') ? 'is' : 'is not'; ?> </strong> Mac 10.10 (Yosemite), and it <strong><?php echo nebula_is_os('mac') ? 'is' : 'is not'; ?> </strong> Macintosh.</p> <p>You are using <strong><?php echo nebula_get_browser('full'); ?> </strong> which uses the <strong><?php echo nebula_get_browser('engine'); ?> </strong> rendering engine. For example, this <strong><?php echo nebula_is_browser('ie', 10) ? 'is' : 'is not'; ?> </strong> Internet Explorer 10, and it <strong><?php echo nebula_is_browser('ie') ? 'is' : 'is not'; ?> </strong> Internet Explorer.</p> <p> <?php if (nebula_is_browser('ie')) { ?> Is it less than IE10? <strong><?php echo nebula_is_browser('ie', 10, '<') ? 'Yes' : 'No';
function register_nebula_scripts() { //Use CDNJS to pull common libraries: http://cdnjs.com/ //nebula_register_script($handle, $src, $exec, $dependencies, $version, $in_footer); nebula_register_script('nebula-jquery_old', 'https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.min.js', null, array(), '1.11.3', true); nebula_register_script('nebula-modernizr_dev', get_template_directory_uri() . '/js/libs/modernizr.dev.js', 'defer', array(), '3.0.0a4', false); nebula_register_script('nebula-modernizr_local', get_template_directory_uri() . '/js/libs/modernizr.min.js', 'defer', array(), '2.8.3', false); nebula_register_script('nebula-modernizr', 'https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.8.3/modernizr.min.js', 'defer', array(), '2.8.3', false); nebula_register_script('nebula-jquery_ui', 'https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js', 'defer', array(), '1.11.4', true); nebula_register_script('nebula-mmenu', 'https://cdnjs.cloudflare.com/ajax/libs/jQuery.mmenu/5.3.4/js/jquery.mmenu.min.all.js', null, array(), '5.3.4', true); //nebula_register_script('nebula-mmenu_debugger', get_template_directory_uri() . '/js/libs/jquery.mmenu.debugger.js', null, array('nebula-mmenu'), '5.3.1', true); nebula_register_script('nebula-doubletaptogo', get_template_directory_uri() . '/js/libs/doubletaptogo.js', 'defer', array(), null, true); //nebula_register_script('nebula-bxslider', 'https://cdnjs.cloudflare.com/ajax/libs/bxslider/4.2.5/jquery.bxslider.min.js', 'defer', array(), '4.2.5', true); //bxSlider is conditionally loaded via main.js when needed. nebula_register_script('nebula-froogaloop', get_template_directory_uri() . '/js/libs/froogaloop.min.js', null, array(), null, true); nebula_register_script('nebula-skrollr', 'https://cdnjs.cloudflare.com/ajax/libs/skrollr/0.6.30/skrollr.min.js', 'gumby-debug', array(), '0.6.30', true); nebula_register_script('nebula-headroom', 'https://cdnjs.cloudflare.com/ajax/libs/headroom/0.7.0/headroom.min.js', null, array(), '0.7.0', true); nebula_register_script('nebula-performance_timing', get_template_directory_uri() . '/js/libs/performance-timing.js', 'async', array(), null, true); nebula_register_script('nebula-respond', 'https://cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.min.js', 'defer', array(), '1.4.2', true); nebula_register_script('nebula-html5shiv', 'https://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js', 'defer', array(), '3.7.3', true); nebula_register_script('nebula-gumby', get_template_directory_uri() . '/js/libs/gumby.min.js', null, array(), '2.6.0', true); //CDN: //cdnjs.cloudflare.com/ajax/libs/gumby/2.6.0/js/libs/gumby.min.js //Note: CDN version does not have the extensions installed. nebula_register_script('nebula-twitter', get_template_directory_uri() . '/js/libs/twitter.js', null, array(), null, true); nebula_register_script('nebula-datatables', 'https://cdnjs.cloudflare.com/ajax/libs/datatables/1.10.9/js/jquery.dataTables.min.js', null, array(), '1.10.9', true); nebula_register_script('nebula-chosen', 'https://cdnjs.cloudflare.com/ajax/libs/chosen/1.4.2/chosen.jquery.min.js', null, array(), '1.4.2', true); nebula_register_script('nebula-moment', 'https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.6/moment-with-locales.min.js', null, array(), '2.10.6', true); nebula_register_script('nebula-maskedinput', 'https://cdnjs.cloudflare.com/ajax/libs/jquery.maskedinput/1.4.1/jquery.maskedinput.min.js', null, array(), '1.4.1', true); nebula_register_script('nebula-adblockcheck', get_template_directory_uri() . '/js/libs/show_ads.js', null, array(), null, false); //Must be loaded in the head. nebula_register_script('nebula-main', get_template_directory_uri() . '/js/main.js', 'defer', array('nebula-gumby', 'jquery', 'nebula-jquery_ui'), null, true); nebula_register_script('nebula-login', get_template_directory_uri() . '/js/login.js', null, array('jquery'), null, true); nebula_register_script('nebula-wireframing', get_template_directory_uri() . '/js/wireframing.js', null, array('nebula-main'), null, true); nebula_register_script('nebula-admin', get_template_directory_uri() . '/js/admin.js', 'defer', array(), null, true); global $upload_dir, $localize_bloginfo, $localize_postinfo, $localize_clientinfo, $localize_nebula_options; $upload_dir = wp_upload_dir(); $localize_bloginfo = array('name' => get_bloginfo("name"), 'template_directory' => get_template_directory_uri(), 'stylesheet_directory' => get_stylesheet_directory_uri(), 'home_url' => home_url(), 'ajax_url' => admin_url('admin-ajax.php'), 'ajax_nonce' => wp_create_nonce('nebula_ajax_nonce'), 'upload_dir' => $upload_dir['baseurl']); $localize_postinfo = array('id' => get_the_id(), 'title' => get_the_title()); $localize_clientinfo = array('remote_addr' => $_SERVER['REMOTE_ADDR'], 'device' => array('full' => nebula_get_device('full'), 'formfactor' => nebula_get_device('formfactor'), 'brand' => nebula_get_device('brand'), 'model' => nebula_get_device('model'), 'type' => nebula_get_device('type')), 'os' => array('full' => nebula_get_os('full'), 'name' => nebula_get_os('name'), 'version' => nebula_get_os('version')), 'browser' => array('full' => nebula_get_browser('full'), 'name' => nebula_get_browser('name'), 'version' => nebula_get_browser('version'), 'engine' => nebula_get_browser('engine'), 'type' => nebula_get_browser('type'))); $localize_nebula_options = array('nebula_cse_id' => get_option('nebula_cse_id'), 'nebula_google_browser_api_key' => get_option('nebula_google_browser_api_key'), 'facebook_url' => get_option('nebula_facebook_url'), 'facebook_app_id' => get_option('nebula_facebook_app_id'), 'twitter_url' => get_option('nebula_twitter_url'), 'google_plus_url' => get_option('nebula_google_plus_url'), 'linkedin_url' => get_option('nebula_linkedin_url'), 'youtube_url' => get_option('nebula_youtube_url'), 'instagram_url' => get_option('nebula_instagram_url'), 'manage_options' => current_user_can('manage_options'), 'debug' => is_debug()); }