From c7d630eaf56949a94e17da1218d684df397a655d Mon Sep 17 00:00:00 2001 From: "Philip M. Hofer (Frumph)" Date: Mon, 12 Oct 2009 07:32:01 -0700 Subject: [PATCH] Adjusted to work with subdirectory installations of wordpress. Signed-off-by: Philip M. Hofer (Frumph) --- functions.php | 27 +++++++++++++++------- style.css | 22 ++++++++++++++---- widgets/control-panel.php | 47 +++++++++++++++++++------------------- widgets/latestcomics.php | 22 ++++++++---------- widgets/scheduledposts.php | 15 ++++++------ 5 files changed, 75 insertions(+), 58 deletions(-) diff --git a/functions.php b/functions.php index 3feebf2..6e4650f 100644 --- a/functions.php +++ b/functions.php @@ -410,13 +410,20 @@ function get_comic_path($folder = 'comic', $override_post = null, $filter = 'def $post_date = mysql2date(CP_DATE_FORMAT, $post_to_use->post_date); $filter_with_date = str_replace('{date}', $post_date, $filter_to_use); - + + $cwd = get_stylesheet_directory(); + if ($cwd !== false) { + // Strip the wp-admin part and just get to the root. + $root_path = preg_replace('#[\\/]wp-(admin|content).*#', '', $cwd); + } + $results = array(); - - if (count($results = glob("${folder_to_use}/${filter_with_date}")) > 0) { + /* have to use root_path to get subdirectory installation directories */ + if (count($results = glob("${root_path}/${folder_to_use}/${filter_with_date}")) > 0) { if (!empty($wpmu_version)) { $comic = reset($results); + $comic = $folder_to_use . '/'. basename($comic); if ($wpmu_path !== false) { $comic = str_replace($wpmu_path, "files", $comic); } return $comic; } @@ -424,11 +431,14 @@ function get_comic_path($folder = 'comic', $override_post = null, $filter = 'def if (!empty($multi)) { return $results; } else { - return reset($results); + /* clear the root path */ + $comic = reset($results); + $comic = $folder_to_use .'/'. basename($comic); + return $comic; } } - $comic_pathfinding_errors[] = sprintf(__("Unable to find the file in the %s folder that matched the pattern %s. Check your WordPress and ComicPress settings.", 'comicpress'), $folder, $filter_with_date); + echo $comic_pathfinding_errors[] = sprintf(__("Unable to find the file in the %s folder that matched the pattern %s. Check your WordPress and ComicPress settings.", 'comicpress'), $folder_to_use, $filter_with_date); return false; } @@ -442,13 +452,14 @@ function get_comic_path($folder = 'comic', $override_post = null, $filter = 'def */ function get_comic_url($folder = 'comic', $override_post = null, $filter = 'default') { if (($result = get_comic_path($folder, $override_post, $filter)) !== false) { - return get_option('home') . '/' . $result; + return get_bloginfo('wpurl') . '/' . $result; } else { if (($result = get_comic_path('comic', $override_post, $filter)) !== false) { - return get_option('home') . '/' . $result; + $basecomic = basename($result); + return get_bloginfo('wpurl') . '/' . $result; } } - return false; + return $result; } /** diff --git a/style.css b/style.css index e7c38bd..e8f1df7 100644 --- a/style.css +++ b/style.css @@ -830,13 +830,25 @@ ul.children { .sidebar ul { margin: 0; + padding: 0 0 0 14px; list-style: none; - padding: 0; } - - .sidebar ul li ul li { - margin: 0; - padding-left: 14px; + + .sidebar ul li { + margin: 0; + padding: 0; + text-align: left; + list-style: none; + } + + .sidebar ul li ul li { + margin: 0; + padding: 0; + text-align: left; + } + + .sidebar li h2 { + margin-top: 15px; } .sidebar .widget { diff --git a/widgets/control-panel.php b/widgets/control-panel.php index 8ef7fab..d330713 100644 --- a/widgets/control-panel.php +++ b/widgets/control-panel.php @@ -4,43 +4,42 @@ Widget Name: Control Panel Widget URI: http://comicpress.org/ Description: Display an area for login and logout, forgot password and register. Author: Philip M. Hofer (Frumph) -Version: 1.01 +Version: 1.02 Author URI: http://webcomicplanet.com/ */ function comicpress_show_control_panel() { global $wpmu_version; ?> - - - '; - } else { - foreach($scheduled_posts as $post) : ?> - - + + '; }