Update of /cvsroot/php-blog/serendipity
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19351
Modified Files:
index.php serendipity.css.php serendipity_admin.php
serendipity_config.inc.php
Log Message:
Pretty URLs for CSS output, hopefully exactly as Tom imagined.
I'm going to tweak IE styles now, so I needed the PNG behavior plugin stuff.
Also fix the PAT_AUTHORS into the htaccess template and properly move the
"search" pretty URL code above matching index.php so that it works on
hosts without rewriting.
Index: serendipity.css.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity.css.php,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- serendipity.css.php 19 Nov 2004 11:24:34 -0000 1.33
+++ serendipity.css.php 11 Jan 2005 12:53:27 -0000 1.34
@@ -2,6 +2,23 @@
session_start();
+if (!isset($css_mode)) {
+ $css_mode = 'frontend';
+}
+
+switch($css_mode) {
+ case 'serendipity.css':
+ default:
+ $css_hook = 'css';
+ $css_file = 'style.css';
+ break;
+
+ case 'serendipity_admin.css':
+ $css_hook = 'css_backend';
+ $css_file = 'admin/style.css';
+ break;
+}
+
/* This is a small hack to allow CSS display during installations and upgrades */
define('IN_installer', true);
define('IN_upgrader', true);
@@ -11,19 +28,19 @@
header('Content-type: text/css');
function serendipity_printStylesheet($file) {
global $serendipity;
- return str_replace('{TEMPLATE_PATH}', dirname($file) .'/', @file_get_contents($file, 1));
+ return str_replace('{TEMPLATE_PATH}', dirname($file) . '/', @file_get_contents($file, 1));
}
if (IS_installed === false) {
- if (file_exists('templates/'. $serendipity['defaultTemplate'] .'/style.css')) {
- echo serendipity_printStylesheet('templates/'. $serendipity['defaultTemplate'] .'/style.css');
+ if (file_exists('templates/' . $serendipity['defaultTemplate'] . '/' . $css_file)) {
+ echo serendipity_printStylesheet('templates/'. $serendipity['defaultTemplate'] . $css_file);
}
die();
}
-$out = serendipity_printStylesheet(serendipity_getTemplateFile('style.css', ''));
+$out = serendipity_printStylesheet(serendipity_getTemplateFile($css_file, ''));
-serendipity_plugin_api::hook_event('css', $out);
+serendipity_plugin_api::hook_event($css_hook, $out);
echo $out;
/* vim: set sts=4 ts=4 expandtab : */
Index: serendipity_config.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_config.inc.php,v
retrieving revision 1.130
retrieving revision 1.131
diff -u -d -r1.130 -r1.131
--- serendipity_config.inc.php 10 Jan 2005 13:12:53 -0000 1.130
+++ serendipity_config.inc.php 11 Jan 2005 12:53:27 -0000 1.131
@@ -114,9 +114,9 @@
@define('PATH_ADMIN', 'admin');
@define('PATH_ENTRIES', 'entries');
@define('PATH_SEARCH', 'search');
+@define('PATH_CSS', 'css');
@define('PATH_SMARTY_COMPILE', 'templates_c'); // will be placed inside the template directory
-
/* Changing this is NOT recommended, rewrite rules does not take them into account - yet */
@define('PERM_ARCHIVES', '%id%-%title%.html');
@define('PERM_CATEGORIES', '%id%-%title%');
@@ -126,6 +126,8 @@
/* 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_UNSUBSCRIBE', '@/'.PATH_UNSUBSCRIBE.'/(.*)/([0-9]+)@');
@@ -142,6 +144,7 @@
@define('PAT_CATEGORIES', '@/'.PATH_CATEGORIES.'/([0-9]+)@');
@define('PAT_PLUGIN', '@/' . PATH_PLUGIN . '/(.*)@');
@define('PAT_SEARCH', '@/' . PATH_SEARCH . '/(.*)@');
+@define('PAT_CSS', '@/' . PATH_CSS . '/(.*)@');
@define('USERLEVEL_ADMIN', 255);
@define('USERLEVEL_CHIEF', 1);
Index: index.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/index.php,v
retrieving revision 1.71
retrieving revision 1.72
diff -u -d -r1.71 -r1.72
--- index.php 10 Jan 2005 13:12:52 -0000 1.71
+++ index.php 11 Jan 2005 12:53:26 -0000 1.72
@@ -254,16 +254,6 @@
$serendipity['head_subtitle'] = $serendipity['blogTitle'];
include_once(S9Y_INCLUDE_PATH . 'include/genpage.inc.php');
-} else if (preg_match('@/(index(\.php|\.html)?)|'. preg_quote($serendipity['indexFile']) .'@', $uri) ||
- preg_match('@^/' . preg_quote(trim($serendipity['serendipityHTTPPath'], '/')) . '/?(\?.*)?$@', $uri)) {
-
- if ($serendipity['GET']['action'] == 'search') {
- $serendipity['uriArguments'] = array(PATH_SEARCH, urlencode($serendipity['GET']['searchTerm']));
- } else {
- $serendipity['uriArguments'][] = PATH_ARCHIVES;
- }
-
- include_once(S9Y_INCLUDE_PATH . 'include/genpage.inc.php');
} else if (preg_match(PAT_SEARCH, $uri, $matches)) {
$_args = $serendipity['uriArguments'];
@@ -286,6 +276,20 @@
$serendipity['GET']['action'] = 'search';
$serendipity['GET']['searchTerm'] = urldecode(htmlspecialchars(strip_tags(implode(' ', $search))));
include_once(S9Y_INCLUDE_PATH . 'include/genpage.inc.php');
+} elseif (preg_match(PAT_CSS, $uri, $matches)) {
+ $css_mode = $matches[1];
+ include_once(S9Y_INCLUDE_PATH . 'serendipity.css.php');
+ exit;
+} else if (preg_match('@/(index(\.php|\.html)?)|'. preg_quote($serendipity['indexFile']) .'@', $uri) ||
+ preg_match('@^/' . preg_quote(trim($serendipity['serendipityHTTPPath'], '/')) . '/?(\?.*)?$@', $uri)) {
+
+ if ($serendipity['GET']['action'] == 'search') {
+ $serendipity['uriArguments'] = array(PATH_SEARCH, urlencode($serendipity['GET']['searchTerm']));
+ } else {
+ $serendipity['uriArguments'][] = PATH_ARCHIVES;
+ }
+
+ include_once(S9Y_INCLUDE_PATH . 'include/genpage.inc.php');
} else {
header('HTTP/1.0 404 Not found');
include_once(S9Y_INCLUDE_PATH . 'include/genpage.inc.php');
Index: serendipity_admin.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_admin.php,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -d -r1.57 -r1.58
--- serendipity_admin.php 19 Dec 2004 00:03:23 -0000 1.57
+++ serendipity_admin.php 11 Jan 2005 12:53:27 -0000 1.58
@@ -31,7 +31,7 @@
<head>
<title><?php echo SERENDIPITY_ADMIN_SUITE; ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo LANG_CHARSET; ?>" />
- <link rel="stylesheet" type="text/css" href="<?php echo serendipity_getTemplateFile('admin/style.css') ?>" />
+ <link rel="stylesheet" type="text/css" href="<?php echo serendipity_rewriteURL(PATH_CSS . '/serendipity_admin.css'); ?>" />
<script type="text/javascript">
function spawn() {
if (self.Spawnextended) {
|