PageRenderTime 38ms CodeModel.GetById 12ms RepoModel.GetById 0ms app.codeStats 0ms

/Wordpress/warp/systems/wordpress/layouts/head.php

https://github.com/dominikkucharski/Warp-Framework
PHP | 83 lines | 61 code | 13 blank | 9 comment | 23 complexity | f24ba03ccfec880ee8aa229e7fa5b696 MD5 | raw file
  1. <meta charset="<?php bloginfo('charset'); ?>" />
  2. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  3. <?php if($this['config']->get('responsive', false)): ?>
  4. <meta name="viewport" content="width=device-width, initial-scale=1">
  5. <?php endif; ?>
  6. <title><?php bloginfo('name'); ?> <?php wp_title(); ?></title>
  7. <link rel="shortcut icon" href="<?php echo $this['path']->url('template:favicon.ico');?>" />
  8. <link rel="apple-touch-icon-precomposed" href="<?php echo $this['path']->url('template:apple_touch_icon.png'); ?>" />
  9. <?php
  10. wp_enqueue_script('jquery');
  11. wp_head();
  12. // get styles and scripts
  13. $styles = $this['asset']->get('css');
  14. $scripts = $this['asset']->get('js');
  15. // compress styles and scripts
  16. if ($compression = $this['config']->get('compression')) {
  17. $options = array();
  18. $filters = array('CSSImportResolver', 'CSSRewriteURL', 'CSSCompressor');
  19. // set options
  20. if ($compression == 3) {
  21. $options['Gzip'] = true;
  22. }
  23. // set filter
  24. if ($compression >= 2 && ($this['useragent']->browser() != 'msie' || version_compare($this['useragent']->version(), '8.0', '>='))) {
  25. $filters[] = 'CSSImageBase64';
  26. }
  27. if ($styles) {
  28. // cache styles and check for remote styles
  29. $styles = array($this['asset']->cache('template.css', $styles, $filters, $options));
  30. foreach ($styles[0] as $style) {
  31. if ($style->getType() == 'File' && !$style->getPath()) {
  32. $styles[] = $style;
  33. }
  34. }
  35. }
  36. if ($scripts) {
  37. // cache scripts and check for remote scripts
  38. $scripts = array($this['asset']->cache('template.js', $scripts, array('JSCompressor'), $options));
  39. foreach ($scripts[0] as $script) {
  40. if ($script->getType() == 'File' && !$script->getPath()) {
  41. $scripts[] = $script;
  42. }
  43. }
  44. }
  45. }
  46. // add styles
  47. if ($styles) {
  48. foreach ($styles as $style) {
  49. if ($url = $style->getUrl()) {
  50. printf("<link rel=\"stylesheet\" href=\"%s\" />\n", $url);
  51. } else {
  52. printf("<style>%s</style>\n", $style->getContent());
  53. }
  54. }
  55. }
  56. // add scripts
  57. if ($scripts) {
  58. foreach ($scripts as $script) {
  59. if ($url = $script->getUrl()) {
  60. printf("<script src=\"%s\"></script>\n", $url);
  61. } else {
  62. printf("<script>%s</script>\n", $script->getContent());
  63. }
  64. }
  65. }
  66. // add feed link
  67. if (strlen($this['config']->get('rss_url',''))) {
  68. printf("<link href=\"%s\" rel=\"alternate\" type=\"application/rss+xml\" title=\"RSS 2.0\" />\n", $this['config']->get('rss_url'));
  69. }
  70. $this->output('head');