private function buildPageAuxHead() { $GLOBALS[SUBSITE]["head"] = array(); // --------------------------------------------------------------------------- // Mime-type and character set for html/xhtml // HTML5: encoding must be specified within the first 1024 bytes of the document // HTML5: <meta charset> is equivalent to <meta http-equiv='content-type'> // --------------------------------------------------------------------------- $GLOBALS[SUBSITE]["head"][] = " <meta http-equiv='Content-Type' " . "content='" . CONTENT_TYPE . "; charset=" . CHARSET . "'>\r\n" . "\r\n"; // --------------------------------------------------------------------------- // DNS Prefetching // --------------------------------------------------------------------------- /* Keep for reference */ $GLOBALS[SUBSITE]["head"][] = " <link rel='dns-prefetch' href='" . preg_replace("%^http?:%", "", PHPSELF_PREFIX) . "'>\r\n" . "\r\n"; // --------------------------------------------------------------------------- // <TITLE> // --------------------------------------------------------------------------- $GLOBALS[SUBSITE]["head"][] = " <title>" . strip_tags(str_replace(" ", " ", $this->getConfig("titletag"))) . "</title>\r\n\r\n"; // --------------------------------------------------------------------------- // <BASE> // --------------------------------------------------------------------------- //TODO: <base> is known to create problems for ulrs with #-references $GLOBALS[SUBSITE]["head"][] = " <base href='" . preg_replace("~/index.php.*\$~iU", "", URL_PREFIX) . "/index.php'><!--[if lte IE 6]></base><![endif]-->\r\n" . "\r\n"; // --------------------------------------------------------------------------- // Automatic reload of some pages // --------------------------------------------------------------------------- //TODO: trigger on pagetree mechanism instead if (IS_ENTRANCE) { $GLOBALS[SUBSITE]["head"][] = " <meta http-equiv='refresh' content='600'>\r\n" . "\r\n"; } // --------------------------------------------------------------------------- // Robot control // For Googlebot-specific values, see // http://www.google.com/support/webmasters/bin/answer.py?hl=en&answer=79812 // FOR NOODP and NOYDIR, see: // http://www.seoworkers.com/seo-articles-tutorials/using-noodp-and-noydir.html // --------------------------------------------------------------------------- if (IS_PRINT || $_SERVER["QUERY_STRING"] == "u=filippo.guarnieri") { $GLOBALS[SUBSITE]["head"][] = " <meta name='robots' content='noindex,nofollow,noodp,noydir'>\r\n" . " <meta name='norditabot' content='noindex,nofollow,noodp,noydir'>\r\n" . " <meta name='googlebot' content='noindex,nofollow,noarchive,noimageindex,noodp'>\r\n" . "\r\n"; } else { $GLOBALS[SUBSITE]["head"][] = " <meta name='robots' content='" . $this->getConfig("robots") . ",noodp,noydir'>\r\n" . " <meta name='norditabot' content='" . $this->getConfig("norditabot") . ",noodp,noydir'>\r\n" . " <meta name='googlebot' content='" . $this->getConfig("robots") . ",noarchive,noimageindex,noodp'>\r\n" . "\r\n"; } // --------------------------------------------------------------------------- // Mime-types for style sheets and javascript // (May be omitted: these are the default values in A-grade browsers; also the // 'type' attribute is optional in HTML5) // --------------------------------------------------------------------------- if (DOCTYPE_IS != "HTML5") { $GLOBALS[SUBSITE]["head"][] = " <meta http-equiv='content-style-type' content='text/css'>\r\n" . " <meta http-equiv='content-script-type' content='text/javascript'>\r\n" . "\r\n"; } // --------------------------------------------------------------------------- // Location of XRDS document for OpenId verification // http://blog.nerdbank.net/2008/06/why-yahoo-says-your-openid-site.html // --------------------------------------------------------------------------- $GLOBALS[SUBSITE]["head"][] = " <meta http-equiv='X-XRDS-Location' content='" . URL_PREFIX . "/openid.xml'>\r\n\r\n"; // --------------------------------------------------------------------------- // Cache control // HTML5: bad value http-equiv='pragma' value='no-cache' [seems to be obsolete anyway] // HTML5: bad value http-equiv='cache-control' // HTML5: bad value http-equiv='expires' [also: value '0'==now is illegal] // Don't use 'revisit-after': http://www.webmasterworld.com/forum5/4924.htm // --------------------------------------------------------------------------- // Values for cache-control: (http://www.mnot.net/cache_docs) // max-age=<seconds> // public // private // no-cache // no-store // must-revalidate $GLOBALS[SUBSITE]["head"][] = " <meta http-equiv='cache-control' content='" . ($this->getConfig("requirelogin") ? "private, " : "public, ") . "no-cache, must-revalidate'>\r\n" . " <meta http-equiv='expires' content='" . gmdate(RFC_TIME_FORMAT, time()) . "'>\r\n" . "\r\n"; // --------------------------------------------------------------------------- // Some security issues. // See: http://stopmalvertising.com/security/securing-your-website-with-.htaccess/.htaccess-http-headers.html // --------------------------------------------------------------------------- $GLOBALS[SUBSITE]["head"][] = " <meta http-equiv='X-Content-Type-Options' content='nosniff'>\r\n" . " <meta http-equiv='X-Frame-Options' content='SAMEORIGIN'>\r\n" . " <meta http-equiv='X-XSS-Protection' content='1;mode=block'>\r\n" . "\r\n"; // --------------------------------------------------------------------------- // -- profile attribute needed for microformats // The HTML 4.01 profile attribute on the head element is obsolete in HTML 5: // <head profile='http://www.w3.org/2006/03/hcard'> // --------------------------------------------------------------------------- if (!empty($_REQUEST["u"])) { $GLOBALS[SUBSITE]["head"][] = " <link rel='profile' href='http://microformats.org/profile/hcard'>\r\n" . "\r\n"; } // --------------------------------------------------------------------------- // Viewport meta tag sets the width and initial scale of the viewport. // Non-standard, mainly for the benefit of mobile-adapted sites // // A <meta> viewport element gives the browser instructions on how to control // the page's dimensions and scaling. The "width=device-width" part sets the width // of the page to follow the screen-width of the device (which will vary // depending on the device). The "initial-scale=1.0" part sets the initial zoom // level when the page is first loaded by the browser. // // HTML5: bad value ... // // http://www.w3schools.com/css/css_rwd_viewport.asp // http://www.html-5.com/metatags/index.html#viewport-meta-tag // https://developer.mozilla.org/en/Mobile/Viewport_meta_tag // http://www.quirksmode.org/mobile/viewports2.html // https://developer.apple.com/library/ios/DOCUMENTATION/AppleApplications/Reference/SafariWebContent/UsingtheViewport/UsingtheViewport.html // http://blog.javierusobiaga.com/stop-using-the-viewport-tag-until-you-know-ho // --------------------------------------------------------------------------- //TODO: bara lämpligt med storleksanpassad layout if (0) { $GLOBALS[SUBSITE]["head"][] = " <meta name='viewport' content='width=device-width, initial-scale=1.0'>\r\n" . "\r\n"; } // ------------------------------- // Metatags for HTML pages on Mobile / Handheld Devices // ------------------------------- /* <meta name="format-detection"> tag <meta name="HandheldFriendly" content="true"> tag <meta name="MobileOptimized" content="320"> */ // ------------------------------- // Metatags for Apps on Mobile / Handheld Devices // ------------------------------- /* https://developer.apple.com/library/ios/documentation/AppleApplications/Reference/SafariWebContent/ConfiguringWebApplications/ConfiguringWebApplications.html <meta name="apple-mobile-web-app-capable"> tag Hiding Safari User Interface Components: On iOS, as part of optimizing your web application, have it use the standalone mode to look more like a native application. When you use this standalone mode, Safari is not used to display the web content—specifically, there is no browser URL text field at the top of the screen or button bar at the bottom of the screen. Only a status bar appears at the top of the screen. Read “Changing the Status Bar Appearance” for how to minimize the status bar. Set the apple-mobile-web-app-capable meta tag to yes to turn on standalone mode. For example, the following HTML displays web content using standalone mode. <meta name="apple-mobile-web-app-capable" content="yes"> You can determine whether a webpage is displaying in standalone mode using the window.navigator.standalone read-only Boolean JavaScript property. <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"> tag Changing the Status Bar Appearance: If your web application displays in standalone mode like that of a native application, you can minimize the status bar that is displayed at the top of the screen on iOS. Do so using the status-bar-style meta tag. This meta tag has no effect unless you first specify standalone mode as described in “Hiding Safari User Interface Components.” Then use the status bar style meta tag, apple-mobile-web-app-status-bar-style, to change the appearance of the status bar depending on your application needs. For example, if you want to use the entire screen, set the status bar style to translucent black. For example, the following HTML sets the background color of the status bar to black: <meta name="apple-mobile-web-app-status-bar-style" content="black"> <link rel="apple-touch-startup-image" href="/startup.png"> tag Specifying a Startup Image: On iOS, similar to native applications, you can specify a startup image that is displayed while your web application launches. This is especially useful when your web application is offline. By default, a screenshot of the web application the last time it was launched is used. To set another startup image, add a link element to the webpage, as in: <link rel="apple-touch-startup-image" href="/startup.png"> In the above example, replace startup.png with your startup screen filename. On iPhone and iPod touch, the image must be 320 x 460 pixels and in portrait orientation. */ // --------------------------------------------------------------------------- // Contact information // HTML5: name='contact_addr' not registered // HTML5: name='version' not registered // HTML5: name='copyright' not registered // --------------------------------------------------------------------------- $GLOBALS[SUBSITE]["head"][] = " <meta name='author' content='" . DEVELOPERNAME . "'>\r\n" . " <!--meta name='contact_addr' content='" . META_CONTACT_ADDR . "'-->\r\n" . " <!--meta name='version' content='" . str_replace("<br>", ", ", $this->getConfig("appsVersion")) . "'" . "-->\r\n" . " <!--meta name='copyright' content='Copyright (c) " . "1995-" . date("Y") . " " . DEVELOPERNAME . "'-->\r\n" . "\r\n"; // --------------------------------------------------------------------------- // Creation and revision date // HTML5: name='date-revision-yyyymmdd' not registered // HTML5: bad value 'date' // --------------------------------------------------------------------------- //TODO: this revision date is not ok for generated content! $GLOBALS[SUBSITE]["head"][] = " <!--meta name='date-revision-yyyymmdd' content='" . $this->getConfig("revision") . "'-->\r\n" . "\r\n"; // --------------------------------------------------------------------------- // Prevent Internet Explorer from placing download icons over images // HTML5: bad value http-equiv='imagetoolbar' // --------------------------------------------------------------------------- $GLOBALS[SUBSITE]["head"][] = " <!--[if IE]>" . "<meta http-equiv='imagetoolbar' content='no'>" . "<![endif]-->\r\n" . "\r\n"; // --------------------------------------------------------------------------- // Always force Internet Explorer to use latest IE rendering engine, // and use Chrome Frame if installed // http://msdn.microsoft.com/library/cc817574.aspx // http://www.chromium.org/developers/how-tos/chrome-frame-getting-started // http://stackoverflow.com/questions/22059060/is-it-still-valid-to-use-ie-edge-chrome-1 // HTML5: bad value http-equiv='X-UA-Compatible' // --------------------------------------------------------------------------- $GLOBALS[SUBSITE]["head"][] = " <!--[if IE]>" . "<meta http-equiv='X-UA-Compatible' content='IE=edge'>" . "<![endif]-->\r\n" . "\r\n"; // --------------------------------------------------------------------------- // Open Graph properties (needed for Facebook integration) // http://... // HTML5: .... // --------------------------------------------------------------------------- if (IS_NEWS && !empty($_REQUEST["articleid"])) { if (!isset($GLOBALS["newsClass"])) { if (!class_exists("fromdb_nwnews", FALSE)) { require_once PATH_CLASSES . "/fromdb/nwnews.php"; } $GLOBALS["newsClass"] = new fromdb_nwnews(); } if (!class_exists("news", FALSE)) { require_once PATH_CLASSES . "/lib/news.php"; } $thearticle = $GLOBALS["newsClass"]->getArticle(NEWS_ANYARTICLE, $_REQUEST["articleid"]); $GLOBALS[SUBSITE]["head"][] = " <meta property='og:type' content='website'>\r\n" . (!empty($thearticle["title"]) ? " <meta property='og:title' content='" . $thearticle["title"] . "'>\r\n" : "") . " <meta property='og:url' content='" . REQUESTSCHEME . "://" . $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"] . "'>\r\n" . (!empty($thearticle["text"]) ? " <meta property='og:description' content='" . news::briefText($thearticle["text"], 225) . "'>\r\n" : "") . "\r\n"; } // --------------------------------------------------------------------------- // Windows Taskbar Pinning (from Windows 7 = IE 9). // Note that essentially every new version of IE has new backwards-incompatible // versions of these tags. IE 11 does not actually need the tags to be present // in the document, so you can save users who do not intend to pin your site the // bandwidth (thus gaining performance) by including a browserconfig.xml in your // root (eg. example.com/browserconfig.xml). So what you do is include the // two/three tags IE 10 needs, and put the new IE 11 tags in your browser config file. // Windows 8 requires no padding in their image, only a transparent background. // Windows 8.1 (IE 11), however, expect 1/5 of the tile images to be left // transparent for padding. You will stick out like a sore thumb amongst the // other applications if you do not pay attention to the padding. // http://msdn.microsoft.com/en-us/library/ie/gg491732%28v=vs.85%29.aspx // http://msdn.microsoft.com/en-us/library/ie/hh772707%28v=vs.85%29.aspx // http://davidwalsh.name/msapplication-task // http://stackoverflow.com/questions/17474389/windows-8-prepare-site-for-pinning // http://www.buildmypinnedsite.com/ [= Windows 8 Wizard] // http://www.buildmypinnedsite.com/windows7/en // http://msdn.microsoft.com/en-us/library/ie/dn320426%28v=vs.85%29.aspx // HTML5: .... // --------------------------------------------------------------------------- $GLOBALS[SUBSITE]["head"][] = " <!--[if IE 9]>\r\n" . " <meta name='application-name' content='Nordita Web'>\r\n" . " <meta name='msapplication-starturl' content='/'>\r\n" . " <meta name='msapplication-tooltip' content='Nordita Web'>\r\n" . " <meta name='msapplication-navbutton-color' content='#fff'>\r\n" . " <meta name='msapplication-window' content='width=1024;height=768'>\r\n" . " <meta name='msapplication-task' content='name=Nordita News;action-uri=" . REQUESTSCHEME . "://www.nordita.org/news/;icon-uri=" . REQUESTSCHEME . "://www.nordita.org/img/_theme/th-white/icon_fav.ico'>\r\n" . " <meta name='msapplication-task' content='name=Nordita on YouTube;action-uri=http://www.youtube.com/user/NorditaStockholm/videos?flow=grid&view=1;icon-uri=http://youtube.com/favicon.ico'>\r\n" . " <meta name='msapplication-task' content='name=Nordita on Twitter;action-uri=http://www.twitter.com/NorditaSweden;icon-uri=http://twitter.com/favicon.ico'>\r\n" . " <meta name='msapplication-task' content='name=Nordita on Facebook;action-uri=http://www.facebook.com/nordita.stockholm;icon-uri=https://s-static.ak.facebook.com/rsrc.php/yi/r/q9U99v3_saj.ico'>\r\n" . " <meta name='msapplication-task' content='name=Nordita on LinkedIn;action-uri=http://www.linkedin.com/company/nordita;icon-uri=http://linkedin.com/favicon.ico'>\r\n" . " <![endif]-->\r\n" . " <!--[if IE 10]><meta name='msapplication-TileImage' content='" . REQUESTSCHEME . "://www.nordita.org/img/_theme/default/logo_msapplication_144x144.png'><![endif]-->\r\n" . "\r\n"; // --------------------------------------------------------------------------- // Address icons // HTML5: bad value rel='apple-touch-icon' // --------------------------------------------------------------------------- // Favicons are 16x16 px // Default name and place (in MSIE): '/favicon.ico' // NB: for the benefit of MSIE, use (also) a file with the default name and place // Apple iPhone Touch Icons are 57x57 px (also used in Android) // Default name and place: '/apple-touch-icon.png' // Constants PATH_* are defined in 'config.php' // // Newer Apple icon sizes: // default: 60x60 // iPhone 6 Plus (@3x): 180x180 // iPhone 6 and iPhone 5 (@2x): 120x120 // iPhone 4s (@2x): 120x120 // iPad and iPad mini (@2x): 152x152 // iPad 2 and iPad mini (@1x): 76x76 // Can be placed in root as: // '/apple-touch-icon-76x76.png' etc. // // Android: http://developer.android.com/design/style/iconography.html $favicon = "icon_address.png"; $msieicon = "icon_fav.ico"; $appleicon = "icon_apple.png"; $GLOBALS[SUBSITE]["head"][] = " <!--[if !IE]>-->" . "<link rel='shortcut icon' href='" . (file_exists(INCLEVEL . PATH_IMG . "/_theme/" . $this->getConfig("theme") . "/" . $favicon) ? PATH_IMG . "/_theme/" . $this->getConfig("theme") . "/" . $favicon : PATH_IMG . "/_theme/default/" . $favicon) . "'>" . "<!--<![endif]-->\r\n" . " <!--[if IE]>" . "<link rel='shortcut icon' href='" . "/" . (file_exists(INCLEVEL . PATH_IMG . "/_theme/" . $this->getConfig("theme") . "/" . $msieicon) ? PATH_IMG . "/_theme/" . $this->getConfig("theme") . "/" . $msieicon : PATH_IMG . "/_theme/default/" . $msieicon) . "'>" . "<![endif]-->\r\n"; //if (SUBSITE!="main") { if (1) { $GLOBALS[SUBSITE]["head"][] .= " <!--[if !IE]>-->" . "<link rel='apple-touch-icon' " . (file_exists(INCLEVEL . PATH_IMG . "/_theme/" . $this->getConfig("theme") . "/" . $appleicon) ? "sizes='57x57' href='" . PATH_IMG . "/_theme/" . $this->getConfig("theme") . "/" . $appleicon : "sizes='60x60' href='" . PATH_IMG . "/_theme/default/" . $appleicon) . "'>" . "<!--<![endif]-->\r\n"; } $GLOBALS[SUBSITE]["head"][] .= "\r\n"; // --------------------------------------------------------------------------- // Syndication // --------------------------------------------------------------------------- // ----------------------------------- // Site Feed Autodiscovery // see eg. atomenabled.org, onlamp.com // ----------------------------------- if ($this->getConfig("feedurl")) { //$feed_mime = "application/atom+xml"; //$feed_mime = "application/rdf+xml"; $feed_mime = "application/rss+xml"; //$feed_file = "feed/index.xml"; $feed_file = $this->getConfig("feedurl"); //$feed_title = ""; $feed_title = $this->getConfig("title"); $GLOBALS[SUBSITE]["head"][] = " <link" . " rel='alternate'" . " type='" . $feed_mime . "'" . " href='" . $feed_file . "'" . " title='" . strip_tags($feed_title) . "'" . ">\r\n" . "\r\n"; } // --------------------------------------------------------------------------- // Assistance to search engine robots // --------------------------------------------------------------------------- $GLOBALS[SUBSITE]["head"][] = " <meta name='keywords' content='" . ($this->getConfig("keywords") ? $this->getConfig("keywords") . ", " : "") . META_KEYWORDS_DEFAULT . "'>\r\n" . ($this->getConfig("desc") ? " <meta name='description' content='" . $this->getConfig("desc") . "'>\r\n" : "") . "\r\n"; // --------------------------------------------------------------------------- // IE6 blocking workaround // http://webforscher.wordpress.com/2010/05/20/ie-6-slowing-down-ie-8/ // Must be issued before any css files are loaded // --------------------------------------------------------------------------- $GLOBALS[SUBSITE]["head"][] = " <!--[if IE]><![endif]-->\r\n"; }
public static function drawCover($issue_id = 0) { $stdout = ""; // ----------------------------------------------------------- // -- Obtain data // ----------------------------------------------------------- self::initiateNewsClass(); $dataCoverFeature = $dataCoverArticle = array(); if (!empty($issue_id)) { $dataCoverFeature = $GLOBALS["newsClass"]->getArticle(NEWS_ANYARTICLE, 0, NEWS_FEATURE, $issue_id); if (is_array($dataCoverFeature)) { $dataCoverFeature = array_shift($dataCoverFeature); } $dataCoverArticle = $GLOBALS["newsClass"]->getArticle(NEWS_ANYARTICLE, 0, 0, $issue_id, 'A.cover_order', 1); } if (empty($dataCoverFeature) && empty($dataCoverArticle)) { return NEWS_EMPTY_HOOK . $stdout . functions::boxMessage("error", "No cover can be put together for this issue of Nordita News.", 1) . ""; } $path_newsarticle = SUBSITE == PATH_NEWSTEST ? str_replace(PATH_NEWS . "/", PATH_NEWSTEST . "/", PATH_NEWSARTICLE) : PATH_NEWSARTICLE; //debug::rr($dataCoverFeature); //debug::rr($dataCoverArticle); // ----------------------------------------------------------- // -- Output // ----------------------------------------------------------- $stdout .= "<div class='col c1of2'>\r\n"; if (empty($dataCoverFeature)) { $stdout .= functions::boxMessage("error", "No feature has been written for this issue.", 1) . ""; } else { $url = isInPath("/archive/") ? $path_newsarticle . "/index.php?articleid=" . $dataCoverFeature["article_id"] : SUBSITE . "/feature/index.php"; $title = str_replace("&nbsp;", " ", $dataCoverFeature["title"]); $readmore = "<strong>Read more</strong>"; if (SUBSITE != PATH_NEWSEDIT && SUBSITE != PATH_NEWSEDITTEST) { $title = "<a href='" . $url . "'>" . $title . "</a>"; $readmore = "<a href='" . $url . "'>" . $readmore . "</a>"; } $text = htmlspecialchars_decode($dataCoverFeature["text"]); $text = preg_replace("#<p class='caption'>.*</p>#imU", "", $text); $text = news::briefText($text, 450); $stdout .= " <div class='box roundcorners grayborder shadow padding'>\r\n" . " <h3 style='font-size:1.6em;text-align:left'>" . $title . "</h3>\r\n" . " <p style='margin-top:1em;clear:both;text-align:center;margin-bottom:-1em'>" . "<a href='" . $url . "'>" . "<img src='" . $dataCoverFeature["cover_image"] . "' style='width:320px'>" . "</a>" . "</p>\r\n" . " <p>" . $text . "... [" . $readmore . "]</p>\r\n" . " </div>\r\n" . "\r\n"; } $stdout .= "</div>\r\n<div class='col c2of2'>\r\n"; if (empty($dataCoverArticle)) { $stdout .= functions::boxMessage("error", "No news articles have been written for this issue of Nordita News.", 1) . ""; } else { foreach ($dataCoverArticle as $key => $data) { $path = isset(self::$sectionPaths[$data["section_id"]]) ? self::$sectionPaths[$data["section_id"]] . "/" : ""; $url = isInPath("/archive/") ? $path_newsarticle . "/index.php?articleid=" . $data["article_id"] : SUBSITE . "/" . $path . "index.php#" . $data["article_id"]; $title = htmlspecialchars_decode(str_replace("&quot;", "\"", $data["title"])); //if (strlen($title)>45) $title = functions::truncateStringByWord($title,45); $title = news::briefText($title, 45); if (SUBSITE != PATH_NEWSEDIT && SUBSITE != PATH_NEWSEDITTEST) { $title = "<a href='" . $url . "'>" . $title . "</a>"; } $text = preg_replace("#<p class='caption'>.*</p>#imU", "", htmlspecialchars_decode($data["text"])); $text = news::briefText($text, 130); $stdout .= " <div class='coverlistitem'>\r\n" . " <h4>" . $title . "</h4>\r\n" . " <p><em>" . (!empty($data["cover_image"]) ? "<img src='" . $data["cover_image"] . "'> " : "") . $text . "</em></p>\r\n" . " </div>\r\n" . "\r\n"; } } $stdout .= "</div>\r\n<div style='clear:both'><br></div>\r\n"; // ----------------------------------------------------------- return $stdout; }