Merge branch 'master' of git@github.com:johnbintz/comicpress-2.8

This commit is contained in:
John Bintz 2009-12-17 23:07:13 -05:00
commit 8992ecbc81
4 changed files with 48 additions and 19 deletions

View File

@ -1,9 +1,9 @@
<?php <?php
function comicpress_notice_debug() { function comicpress_notice_debug() {
global $current_user, $comiccat, $blogcat, $comic_folder, $wpdb, $category_tree; global $current_user, $comiccat, $blogcat, $comic_folder, $wpdb, $category_tree, $non_comic_categories, $comicpress_options;
if( substr( $_SERVER[ 'PHP_SELF' ], -19 ) != '/wp-admin/index.php' ) if( substr( $_SERVER[ 'PHP_SELF' ], -19 ) != '/wp-admin/index.php' || !$comicpress_options['enable_comicpress_debug'])
return; return;
$comicpress_options = comicpress_load_options(); $comicpress_options = comicpress_load_options();
@ -34,28 +34,27 @@ function comicpress_notice_debug() {
} }
} }
if (empty($error)) { if (empty($error) && $comicpress_options['enable_full_post_check']) {
$founderror = FALSE; // Check to make sure posts are not in blogcat and comiccat both
$blog_query = '&show_posts=-1&posts_per_page=-1&cat="-'.exclude_comic_categories().'"'; $founderror = false;
$non_comic_categories = str_replace(' and ', ',', $non_comic_categories);
$blog_query = '&show_posts=-1&posts_per_page=-1&cat='.$non_comic_categories;
$comic_categories = array();
$founderrorpost = array(); $founderrorpost = array();
foreach ($category_tree as $node) {
$comic_categories[] = end(explode("/", $node));
}
query_posts($blog_query); query_posts($blog_query);
if (have_posts()) { if (have_posts()) {
while (have_posts()) : the_post(); while (have_posts()) : the_post();
$founderrorpost[] = wp_get_post_categories($post->ID); if (in_comic_category()) {
if (count(array_intersect($comic_categories, wp_get_post_categories($post->ID))) > 0) { $founderrorpostlist .= '<a href="'.get_bloginfo('wpurl').'/wp-admin/post.php?action=edit&post='.get_the_ID().'">'.get_the_title().'</a><br />';
$founderror = TRUE; $founderror = true;
} }
endwhile; endwhile;
} }
// if ($founderror) { if ($founderror) {
$error[] = array('header', __('A post is in both a comic category and blog category.','comicpress')); $error[] = array('header', __('Post\'s are in both a comic category and blog category.','comicpress'));
$error[] = __('*duel category error message and fix*','comicpress'); $error[] = __('The following posts are set both in a comic category and a blog category, with ComicPress the designations of categories is very important. The rule of thumb is to make sure that all posts are only in a single category. If a post is in both the comic category and blog category there will be issues with both navigation and execution of the ComicPress code.','comicpress');
// } $error[] = $founderrorpostlist;
}
} }
if (!empty($error)) { if (!empty($error)) {
@ -65,8 +64,6 @@ function comicpress_notice_debug() {
ComicPress doesn't seem to be fully installed at this time, check out these messages.<br /> ComicPress doesn't seem to be fully installed at this time, check out these messages.<br />
<br /> <br />
<?php <?php
var_dump($founderrorpost);
// var_dump($comic_categories);
foreach ($error as $info) { foreach ($error as $info) {
unset($text); unset($text);
if (is_array($info)) { if (is_array($info)) {

View File

@ -43,6 +43,8 @@ function comicpress_admin() {
$comicpress_options['disable_lrsidebars_frontpage'] = (bool)($_REQUEST['disable_lrsidebars_frontpage'] == 1 ? true : false ); $comicpress_options['disable_lrsidebars_frontpage'] = (bool)($_REQUEST['disable_lrsidebars_frontpage'] == 1 ? true : false );
$comicpress_options['disable_footer_text'] = (bool)($_REQUEST['disable_footer_text'] == 1 ? true : false ); $comicpress_options['disable_footer_text'] = (bool)($_REQUEST['disable_footer_text'] == 1 ? true : false );
$comicpress_options['disable_blogheader'] = (bool)($_REQUEST['disable_blogheader'] == 1 ? true : false ); $comicpress_options['disable_blogheader'] = (bool)($_REQUEST['disable_blogheader'] == 1 ? true : false );
$comicpress_options['enable_comicpress_debug'] = (bool)($_REQUEST['enable_comicpress_debug'] == 1 ? true : false );
$comicpress_options['enable_full_post_check'] = (bool)($_REQUEST['enable_full_post_check'] == 1 ? true : false );
$tab = 'general'; $tab = 'general';
update_option('comicpress_options',$comicpress_options); update_option('comicpress_options',$comicpress_options);
} }

View File

@ -169,7 +169,11 @@ function comicpress_load_options() {
'buy_print_int_amount' => '29.95', 'buy_print_int_amount' => '29.95',
'buy_print_add_shipping' => false, 'buy_print_add_shipping' => false,
'buy_print_us_ship' => '4.95', 'buy_print_us_ship' => '4.95',
'buy_print_int_ship' => '9.95' 'buy_print_int_ship' => '9.95',
'enable_comicpress_debug' => true,
'enable_full_post_check' => false
) as $field => $value) { ) as $field => $value) {
$comicpress_options[$field] = $value; $comicpress_options[$field] = $value;
} }

View File

@ -152,6 +152,32 @@
</td> </td>
</tr> </tr>
</table> </table>
<table class="widefat">
<thead>
<tr>
<th colspan="3"><?php _e('Debug','comicpress'); ?></th>
</tr>
</thead>
<tr class="alternate">
<th scope="row"><label for="enable_comicpress_debug"><?php _e('Enable the dashboard ComicPress debug?','comicpress'); ?></label></th>
<td>
<input id="enable_comicpress_debug" name="enable_comicpress_debug" type="checkbox" value="1" <?php checked(true, $comicpress_options['enable_comicpress_debug']); ?> />
</td>
<td>
<?php _e('Default enabled, this will do some sanity checks on your ComicPress installation and report the findings on your dashboard.', 'comicpress'); ?>
</td>
</tr>
<tr>
<th scope="row"><label for="enable_full_post_check"><?php _e('Enable checking EVERY post for category problems?','comicpress'); ?></label></th>
<td>
<input id="enable_full_post_check" name="enable_full_post_check" type="checkbox" value="1" <?php checked(true, $comicpress_options['enable_full_post_check']); ?> />
</td>
<td>
<?php _e('Enable this if you would like to check ALL of your posts to see if there are any category problems and inconsistancies.', 'comicpress'); ?>
</td>
</tr>
</table>
</div> </div>