Adjusted to work with subdirectory installations of wordpress.

Signed-off-by: Philip M. Hofer (Frumph) <frumph_dragon@yahoo.com>
This commit is contained in:
Philip M. Hofer (Frumph) 2009-10-12 07:32:01 -07:00
parent 661cf0eda3
commit c7d630eaf5
5 changed files with 75 additions and 58 deletions

View File

@ -411,12 +411,19 @@ function get_comic_path($folder = 'comic', $override_post = null, $filter = 'def
$filter_with_date = str_replace('{date}', $post_date, $filter_to_use);
$results = array();
$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);
}
if (count($results = glob("${folder_to_use}/${filter_with_date}")) > 0) {
$results = array();
/* 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 <strong>%s</strong> folder that matched the pattern <strong>%s</strong>. Check your WordPress and ComicPress settings.", 'comicpress'), $folder, $filter_with_date);
echo $comic_pathfinding_errors[] = sprintf(__("Unable to find the file in the <strong>%s</strong> folder that matched the pattern <strong>%s</strong>. 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;
}
/**

View File

@ -830,13 +830,25 @@ ul.children {
.sidebar ul {
margin: 0;
padding: 0 0 0 14px;
list-style: none;
}
.sidebar ul li {
margin: 0;
padding: 0;
text-align: left;
list-style: none;
}
.sidebar ul li ul li {
margin: 0;
padding-left: 14px;
padding: 0;
text-align: left;
}
.sidebar li h2 {
margin-top: 15px;
}
.sidebar .widget {

View File

@ -4,18 +4,15 @@ 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; ?>
<ul>
<?php if (!is_user_logged_in()) { ?>
<li>
<?php if ( get_option('users_can_register') ) { ?>
<form action="<?php bloginfo('url') ?>/wp-login.php" method="post">
<form action="<?php bloginfo('wpurl') ?>/wp-login.php" method="post">
<?php _e('UserName:','comicpress'); ?><br />
<input type="text" name="log" id="sname" value="<?php echo wp_specialchars(stripslashes($user_login), 1) ?>" size="22" /><br /><br />
<?php _e('Password:','comicpress'); ?><br />
@ -26,21 +23,23 @@ global $wpmu_version; ?>
<input type="hidden" name="redirect_to" value="<?php echo $_SERVER['REQUEST_URI']; ?>"/>
</form>
<br />
<ul>
<?php if (!empty($wpmu_version)) { ?>
<a href="<?php bloginfo('url') ?>/wp-signup.php"><?php _e('Register','comicpress'); ?></a><br />
<li><a href="<?php bloginfo('wpurl') ?>/wp-signup.php"><?php _e('Register','comicpress'); ?></a></li>
<?php } else { ?>
<a href="<?php bloginfo('url') ?>/wp-register.php"><?php _e('Register','comicpress'); ?></a><br />
<li><a href="<?php bloginfo('wpurl') ?>/wp-register.php"><?php _e('Register','comicpress'); ?></a></li>
<?php } ?>
<?php } ?>
<a href="<?php bloginfo('url') ?>/wp-login.php?action=lostpassword"><?php _e('Recover password','comicpress'); ?></a>
<li><a href="<?php bloginfo('wpurl') ?>/wp-login.php?action=lostpassword"><?php _e('Recover password','comicpress'); ?></a></li>
</ul>
<?php } else { ?>
<?php $redirect = '&amp;redirect_to='.urlencode(wp_make_link_relative(get_option('siteurl')));
<ul>
<?php $redirect = '&amp;redirect_to='.urlencode(wp_make_link_relative(get_bloginfo('wpurl')));
$uri = wp_nonce_url( site_url("wp-login.php?action=logout$redirect", 'login'), 'log-out' ); ?>
<li><a href="<?php echo $uri; ?>"><?php _e('Logout','comicpress'); ?></a></li>
<?php wp_register(); ?>
<li><a href="/wp-admin/profile.php"><?php _e('Profile','comicpress'); ?></a></li>
<?php } ?>
<li><a href="<?php bloginfo('wpurl'); ?>/wp-admin/profile.php"><?php _e('Profile','comicpress'); ?></a></li>
</ul>
<?php } ?>
<?php
}

View File

@ -9,9 +9,7 @@ Author URI: http://webcomicplanet.com/
*/
function comicpress_latest_comics() { ?>
<ul>
<li>
function comicpress_latest_comics() { ?>
<h2>Latest Comics</h2>
<ul>
<?php global $post;
@ -20,8 +18,6 @@ Author URI: http://webcomicplanet.com/
<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
<?php endforeach; ?>
</ul>
</li>
</ul>
<?php
}

View File

@ -26,14 +26,13 @@ class widget_comicpress_show_scheduled_posts extends WP_Widget {
$scheduled_posts = get_posts('post_status=future&numberposts=-1');
if (empty($scheduled_posts)) {
echo '<ul><li>None.</li></ul>';
} else {
foreach($scheduled_posts as $post) : ?>
} else { ?>
<ul>
<li><span class="scheduled-post-title"><?php echo $post->post_title; ?></span>
<span class="scheduled-post-date"><?php echo date('m/d/Y',strtotime($post->post_date)); ?></span> </li>
<?php foreach($scheduled_posts as $post) : ?>
<li><span class="scheduled-post-date"><?php echo date('m/d/Y',strtotime($post->post_date)); ?></span> <span class="scheduled-post-title"><?php echo $post->post_title; ?></span></li>
<?php endforeach; ?>
</ul>
<?php endforeach;
}
<?php }
echo $after_widget;
echo '</div>';
}