?> /images/icons/apple-touch-icon-57x57.png"> <link rel="apple-touch-icon" sizes="76x76" href="<?php assets_dir(); ?> /images/icons/apple-touch-icon-76x76.png"> <link rel="apple-touch-icon" sizes="120x120" href="<?php assets_dir(); ?> /images/icons/apple-touch-icon-120x120.png"> <link rel="apple-touch-icon" sizes="152x152" href="<?php assets_dir(); ?> /images/icons/apple-touch-icon-152x152.png"> <link rel="apple-touch-icon" sizes="180x180" href="<?php assets_dir(); ?> /images/icons/apple-touch-icon-180x180.png"> <link rel="icon" type="image/x-icon" href="<?php assets_dir(); ?> /images/icons/favicon.ico"> </head> <body class="page-<?php echo get('page.slug'); ?> " itemscope itemtype="http://schema.org/WebPage"> <?php get_partial('browser-update');
function module_css($uri, $tag = true) { $path_css = module_url(assets_dir('css') . '/' . $uri); return _css($path_css, $tag); }
/** * Assets loader */ function load_asset($asset, $append = false) { if (is_array($asset)) { foreach ($asset as $file) { $loaded[] = load_asset($file, $append); } } else { # Set new path $dir = $append ? assets_dir() . '/' . $append : assets_dir(); # Async false by default $loaded['async'] = false; # Check for local file if (substr($asset, 0, 1) == '|') { $loaded['src'] = $dir . '/' . ltrim($asset, '|'); } else { $loaded['src'] = $asset; } # Check for Async foreach ($loaded as $asset) { $asset = explode(':', $asset); if (count($asset) > 1) { $loaded['src'] = $asset[0]; $loaded['async'] = true; } } } return $loaded; }
/** * Get Assets Dir * * Replace ~ with assets directory location * when loading theme assets. * * @param $path (string) Path to replace */ protected function get_assets_dir($path) { if (substr($path, 0, 1) === '~') { return substr_replace($path, assets_dir(), 0, 1); } return $path; }
<?php use Theme\Variables; /** * Variables Object */ $variables = new Variables(); # Debug helpers $variables->add('dev', array('localhost' => is_localhost())); # Theme $variables->add('theme', array('supports' => array_key_exists('supports', $theme) ? $theme['supports'] : array())); # Global Site Variables $variables->add('site', array('name' => SITE_NAME, 'email' => SITE_EMAIL, 'domain' => SITE_DOMAIN, 'styles' => load_asset($theme_config['styles'], 'css'), 'scripts' => load_asset($theme_config['scripts'], 'js'), 'assets' => assets_dir(), 'ie' => array('min' => 9, 'strict' => false))); # Page variables $variables->add('page', array('is_home' => is_home(), 'path' => $path, 'slug' => get_page()), true); # User variables $variables->add('user', array('logged_in' => is_loggedin())); # Various useful variables $variables->add('this_year', this_year()); /** ----------------------------------- ** * Default page meta is set here but * * should be overridden in your * * model files. Access the array using * * $_['page']['meta'] from your model. * ** ----------------------------------- **/ # Page meta data $meta = array($variables->get('page|slug') => array('title' => SITE_NAME, 'description' => 'Description', 'keywords' => 'Keywords', 'canonical' => 'Canonical')); $variables->extend('page', 'meta', $meta[$variables->get('page|slug')]);