$head_tag = ! empty($head_tags) ? join("\n", $head_tags) ."\n" : ''; // 1.3.x compat // Last modification date (UNIX timestamp) of the page $fmt = $is_read ? get_filetime($_page) + LOCALZONE : 0; // Output nofollow / noindex regardless os skin file if (!$is_read || $nofollow) { if (!headers_sent()) { header("X-Robots-Tag: noindex,nofollow"); } } // Send Canonical URL for Search Engine Optimization if ($is_read && !headers_sent()) { header("Link: <$canonical_url>; rel=\"canonical\""); } // Search words if ($search_word_color && isset($vars['word'])) { $body = '
' . $_msg_word . htmlsc($vars['word']) . '
' . $hr . "\n" . $body; // BugTrack2/106: Only variables can be passed by reference from PHP 5.0.5 // with array_splice(), array_flip() $words = preg_split('/\s+/', $vars['word'], -1, PREG_SPLIT_NO_EMPTY); $words = array_splice($words, 0, 10); // Max: 10 words $words = array_flip($words); $keys = array(); foreach ($words as $word=>$id) $keys[$word] = strlen($word); arsort($keys, SORT_NUMERIC); $keys = get_search_words(array_keys($keys), TRUE); $id = 0; $patterns = ''; foreach ($keys as $key=>$pattern) { if (strlen($patterns) > 0) { $patterns .= '|'; } $patterns .= '(' . $pattern . ')'; } if ($pattern) { $whole_pattern = '/' . ']*>.*?<\/textarea>' . // Ignore textareas '|' . '<[^>]*>' . // Ignore tags '|' . '&[^;]+;' . // Ignore entities '|' . '(' . $patterns . ')' . // $matches[1]: Regex for a search word '/sS'; $body = preg_replace_callback($whole_pattern, '_decorate_Nth_word', $body); $notes = preg_replace_callback($whole_pattern, '_decorate_Nth_word', $notes); } } // Embed Scripting data $html_scripting_data = get_html_scripting_data($_page, $is_edit_preview); // Compat: 'HTML convert time' without time about MenuBar and skin $taketime = elapsedtime(); require(SKIN_FILE); } function _decorate_Nth_word($matches) { // $matches[0]: including both words to skip and to decorate // $matches[1]: word to decorate // $matches[2+]: indicates which keyword to decorate $index = -1; for ($i = 2; $i < count($matches); $i++) { if (isset($matches[$i]) && $matches[$i]) { $index = $i - 2; break; } } if (isset($matches[1])) { // wordN highlight class: N=0...n return '' . $matches[0] . ''; } return $matches[0]; } /** * Get data used by JavaScript modules * * @param $page page name * @param $in_editing true if preview in editing */ function get_html_scripting_data($page, $in_editing) { global $ticket_link_sites, $plugin; global $external_link_cushion_page, $external_link_cushion; global $topicpath_title; global $ticket_jira_default_site; global $show_passage; if (!isset($ticket_link_sites) || !is_array($ticket_link_sites)) { return ''; } $is_utf8 = (bool)defined('PKWK_UTF8_ENABLE'); // Require: PHP 5.4+ $json_enabled = defined('JSON_UNESCAPED_UNICODE'); if (!$json_enabled) { $empty_data = <<