From 056edaab3e21a5c2d9874c13ab3c93300fffc5cb Mon Sep 17 00:00:00 2001 From: garvinhicking Date: Tue, 11 Jul 2006 18:55:38 +0000 Subject: [PATCH] Add un-escaped {$entry.html_title} variable --- docs/NEWS | 3 ++ include/functions_entries.inc.php | 3 +- include/functions_permalinks.inc.php | 58 ++++++++++++++-------------- 3 files changed, 34 insertions(+), 30 deletions(-) diff --git a/docs/NEWS b/docs/NEWS index c41e815..0b37795 100644 --- a/docs/NEWS +++ b/docs/NEWS @@ -3,6 +3,9 @@ Version 1.1-alpha7() ------------------------------------------------------------------------ + * Templating: Add new {$entry.html_title} variable that holds + unescaped HTML code of the Entry's title (garvinhicking) + * BC-Break / Plugin API change: The serendipity_getTemplate() file now no longer returns FALSE when a file is not found, but instead the filename without a path. This is required so that the smarty- diff --git a/include/functions_entries.inc.php b/include/functions_entries.inc.php index 3070f98..148a73d 100644 --- a/include/functions_entries.inc.php +++ b/include/functions_entries.inc.php @@ -934,6 +934,7 @@ function serendipity_printEntries($entries, $extended = 0, $preview = false, $sm $entry['link'] = serendipity_archiveURL($entry['id'], $entry['title'], 'serendipityHTTPPath', true, array('timestamp' => $entry['timestamp'])); $entry['commURL'] = serendipity_archiveURL($entry['id'], $entry['title'], 'baseURL', false, array('timestamp' => $entry['timestamp'])); + $entry['html_title']= $entry['title']; $entry['title'] = htmlspecialchars($entry['title']); $entry['title_rdf'] = preg_replace('@-{2,}@', '-', $entry['title']); @@ -1442,7 +1443,7 @@ function serendipity_printArchives() { $output[$y]['months'][] = $data; } } - + $serendipity['smarty']->assign_by_ref('archives', $output); $serendipity['smarty']->assign_by_ref('max_entries', $max); diff --git a/include/functions_permalinks.inc.php b/include/functions_permalinks.inc.php index 5607827..d28c622 100644 --- a/include/functions_permalinks.inc.php +++ b/include/functions_permalinks.inc.php @@ -136,7 +136,7 @@ function serendipity_makeFilename($str, $stripDots = false) { // Remove excess separators $str = trim($str, $to[0]); - + if (empty($str)) { if (isset($GLOBALS['i18n_unknown'])) { $str = $GLOBALS['i18n_unknown']; @@ -160,67 +160,67 @@ function serendipity_initPermalinks() { if (!isset($serendipity['permalinkStructure'])) { $serendipity['permalinkStructure'] = 'archives/%id%-%title%.html'; } - + if (!isset($serendipity['permalinkFeedAuthorStructure'])) { $serendipity['permalinkFeedAuthorStructure'] = 'feeds/authors/%id%-%realname%.rss'; } - + if (!isset($serendipity['permalinkFeedCategoryStructure'])) { $serendipity['permalinkFeedCategoryStructure'] = 'feeds/categories/%id%-%name%.rss'; } - + if (!isset($serendipity['permalinkCategoryStructure'])) { $serendipity['permalinkCategoryStructure'] = 'categories/%id%-%name%'; } - + if (!isset($serendipity['permalinkAuthorStructure'])) { $serendipity['permalinkAuthorStructure'] = 'authors/%id%-%realname%'; } - + if (!isset($serendipity['permalinkArchivesPath'])) { $serendipity['permalinkArchivesPath'] = 'archives'; } - + if (!isset($serendipity['permalinkArchivePath'])) { $serendipity['permalinkArchivePath'] = 'archive'; } - + if (!isset($serendipity['permalinkCategoriesPath'])) { $serendipity['permalinkCategoriesPath'] = 'categories'; } - + if (!isset($serendipity['permalinkAuthorsPath'])) { $serendipity['permalinkAuthorsPath'] = 'authors'; } - + if (!isset($serendipity['permalinkUnsubscribePath'])) { $serendipity['permalinkUnsubscribePath'] = 'unsubscribe'; } - + if (!isset($serendipity['permalinkDeletePath'])) { $serendipity['permalinkDeletePath'] = 'delete'; } - + if (!isset($serendipity['permalinkApprovePath'])) { $serendipity['permalinkApprovePath'] = 'approve'; } - + if (!isset($serendipity['permalinkFeedsPath'])) { $serendipity['permalinkFeedsPath'] = 'feeds'; } - + if (!isset($serendipity['permalinkPluginPath'])) { $serendipity['permalinkPluginPath'] = 'plugin'; } - + if (!isset($serendipity['permalinkAdminPath'])) { $serendipity['permalinkAdminPath'] = 'admin'; } - + if (!isset($serendipity['permalinkSearchPath'])) { $serendipity['permalinkSearchPath'] = 'search'; } - + /* URI paths * These could be defined in the language headers, except that would break * backwards URL compatibility @@ -235,7 +235,7 @@ function serendipity_initPermalinks() { @define('PATH_PLUGIN', $serendipity['permalinkPluginPath']); @define('PATH_ADMIN', $serendipity['permalinkAdminPath']); @define('PATH_SEARCH', $serendipity['permalinkSearchPath']); - + /* URI patterns * Note that it's important to use @ as the pattern delimiter. DO NOT use shortcuts * like \d or \s, since mod_rewrite will use the regexps as well and chokes on them. @@ -259,7 +259,7 @@ function serendipity_initPermalinks() { */ function &serendipity_permalinkPatterns($return = false) { global $serendipity; - + $PAT = array(); $PAT['UNSUBSCRIBE'] = '@/' . $serendipity['permalinkUnsubscribePath'].'/(.*)/([0-9]+)@'; @@ -323,7 +323,7 @@ function serendipity_searchPermalink($struct, $url, $default, $type = 'entry') { if (is_array($permalink)) { return $permalink['entry_id']; } - } + } return $default; } @@ -354,12 +354,12 @@ function serendipity_getPermalink(&$data, $type = 'entry') { case 'category': return serendipity_categoryURL($data, '', false); break; - + case 'author': return serendipity_authorURL($data, '', false); break; } - + return false; } @@ -404,16 +404,16 @@ function serendipity_insertPermalink(&$data, $type = 'entry') { case 'entry': $idfield = 'id'; break; - + case 'author': $idfield = 'authorid'; break; - + case 'category': $idfield = 'categoryid'; break; } - + return(serendipity_db_query(sprintf("INSERT INTO {$serendipity['dbPrefix']}permalinks (permalink, entry_id, type) VALUES ('%s', '%s', '%s')", @@ -503,9 +503,9 @@ function serendipity_makePermalink($format, $data, $type = 'entry') { $data['entry']['timestamp'] = time(); } } - + $ts = serendipity_serverOffsetHour($data['entry']['timestamp']); - + $replacements = array( (int)$data['id'], @@ -516,7 +516,7 @@ function serendipity_makePermalink($format, $data, $type = 'entry') { ); return str_replace($entryKeys, $replacements, $format); break; - + case 'author': $replacements = array( @@ -527,7 +527,7 @@ function serendipity_makePermalink($format, $data, $type = 'entry') { ); return str_replace($authorKeys, $replacements, $format); break; - + case 'category': $replacements = array( -- 2.39.5