return $str;
}
+function serendipity_initPermalinks() {
+ global $serendipity;
+
+ if (!isset($serendipity['permalinkStructure'])) {
+ $serendipity['permalinkStructure'] = 'archives/%id%-%title%.html';
+ }
+
+ 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['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
+ */
+ @define('PATH_ARCHIVES', $serendipity['permalinkArchivesPath']);
+ @define('PATH_ARCHIVE', $serendipity['permalinkArchivePath']);
+ @define('PATH_CATEGORIES', $serendipity['permalinkCategoriesPath']);
+ @define('PATH_UNSUBSCRIBE', $serendipity['permalinkUnsubscribePath']);
+ @define('PATH_DELETE', $serendipity['permalinkDeletePath']);
+ @define('PATH_APPROVE', $serendipity['permalinkApprovePath']);
+ @define('PATH_FEEDS', $serendipity['permalinkFeedsPath']);
+ @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.
+ * If you add new patterns, remember to add the new rules to the *.tpl files and
+ * function serendipity_installFiles().
+ */
+ @define('PAT_FILENAME', '0-9a-z\.\_!;,\+\-');
+ @define('PAT_CSS', '@/(serendipity\.css|serendipity_admin\.css)@');
+ @define('PAT_FEED', '@/(index|atom|rss|b2rss|b2rdf).(rss|rdf|rss2|xml)$@');
+ @define('PAT_COMMENTSUB', '@/([0-9]+)[_\-][' . PAT_FILENAME . ']*\.html@i');
+
+ return true;
+}
+
function &serendipity_permalinkPatterns($return = false) {
global $serendipity;
}
/* Changing this is NOT recommended, rewrite rules does not take them into account - yet */
-if (!isset($serendipity['permalinkStructure'])) {
- $serendipity['permalinkStructure'] = 'archives/%id%-%title%.html';
-}
-
-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['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
- */
-@define('PATH_ARCHIVES', $serendipity['permalinkArchivesPath']);
-@define('PATH_ARCHIVE', $serendipity['permalinkArchivePath']);
-@define('PATH_CATEGORIES', $serendipity['permalinkCategoriesPath']);
-@define('PATH_UNSUBSCRIBE', $serendipity['permalinkUnsubscribePath']);
-@define('PATH_DELETE', $serendipity['permalinkDeletePath']);
-@define('PATH_APPROVE', $serendipity['permalinkApprovePath']);
-@define('PATH_FEEDS', $serendipity['permalinkFeedsPath']);
-@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.
- * If you add new patterns, remember to add the new rules to the *.tpl files and
- * function serendipity_installFiles().
- */
-@define('PAT_FILENAME', '0-9a-z\.\_!;,\+\-');
-@define('PAT_CSS', '@/(serendipity\.css|serendipity_admin\.css)@');
-@define('PAT_FEED', '@/(index|atom|rss|b2rss|b2rdf).(rss|rdf|rss2|xml)$@');
-@define('PAT_COMMENTSUB', '@/([0-9]+)[_\-][' . PAT_FILENAME . ']*\.html@i');
+serendipity_initPermalinks();
// Apply constants/definitions from custom permalinks
serendipity_permalinkPatterns();