part 3 of removing the comicpress-config.php file from being in use, -> done, configuration page made note: blog_postcount is now seperated from the config options and a regular upper level var on the indexoptions.php

currently the vars are being extracted to be the $vars that they were previously so they are backward compatible but would like to move those to be read from $comicpress_options['comicpress_config'][$key] at some point.

Signed-off-by: Philip M. Hofer (Frumph) <frumph_dragon@yahoo.com>
This commit is contained in:
Philip M. Hofer (Frumph) 2009-12-31 15:32:17 -08:00
parent fff8d4c5a9
commit 30f3ebea26
8 changed files with 54 additions and 22 deletions

View File

@ -6,9 +6,9 @@ Template Name: Blog
<?php get_header(); ?>
<?php include(get_template_directory() . '/layout-head.php'); ?>
<?php global $blog_postcount;
if (!$comicpress['split_column_in_two']) {
$blog_query = 'showposts='.$blog_postcount.'&cat="-'.exclude_comic_categories().'"&paged='.$paged;
<?php
if (!$comicpress_options['split_column_in_two']) {
$blog_query = 'showposts='.$comicpress_options['blog_postcount'].'&cat="-'.exclude_comic_categories().'"&paged='.$paged;
$posts = query_posts($blog_query);
if (have_posts()) {

View File

@ -78,7 +78,7 @@ function comicpress_admin() {
) as $key) {
$comicpress_options[$key] = (bool)( $_REQUEST[$key] == 1 ? true : false );
}
$comicpress_options['blog_postcount'] = wp_filter_nohtml_kses($_REQUEST['blog_postcount']);
$tab = 'index';
update_option('comicpress_options',$comicpress_options);
}
@ -191,8 +191,7 @@ function comicpress_admin() {
'mini_comic_folder',
'archive_comic_width',
'rss_comic_width',
'mini_comic_width',
'blog_postcount'
'mini_comic_width'
) as $key) {
$comicpress_options['comicpress_config'][$key] = wp_filter_nohtml_kses($_REQUEST[$key]);
}
@ -202,7 +201,7 @@ function comicpress_admin() {
if ($tab) {
?>
<div id="message" class="updated fade"><p><strong><?php _e('ComicPress Settings SAVED!','comicpress'); ?></strong></p></div>
<div id="message" class="updated"><p><strong><?php _e('ComicPress Settings SAVED!','comicpress'); ?></strong></p></div>
<script>function hidemessage() { document.getElementById('message').style.display = 'none'; }</script>
<?php }
}
@ -210,7 +209,7 @@ function comicpress_admin() {
delete_option('comicpress_options');
$comicpress_options = comicpress_load_options();
?>
<div id="message" class="updated fade"><p><strong><?php _e('ComicPress Settings RESET!','comicpress'); ?></strong></p></div>
<div id="message" class="updated"><p><strong><?php _e('ComicPress Settings RESET!','comicpress'); ?></strong></p></div>
<script>function hidemessage() { document.getElementById('message').style.display = 'none'; }</script>
<?php
}

View File

@ -100,7 +100,7 @@ add_action('init', '__comicpress_init');
function comicpress_load_options() {
global $comicpress_options, $comiccat, $blogcat, $comic_folder, $rss_comic_folder,
$archive_comic_folder, $mini_comic_folder, $archive_comic_width,
$rss_comic_width, $blog_postcount;
$rss_comic_width;
$comicpress_options = get_option('comicpress_options');
if (empty($comicpress_options)) {
@ -108,15 +108,14 @@ function comicpress_load_options() {
$comicpress_config = array();
foreach (array(
'comiccat' => '3',
'blogcat' => '2',
'blogcat' => '1',
'comic_folder' => 'comics',
'rss_comic_folder' => 'comics-rss',
'archive_comic_folder' => 'comics-archive',
'mini_comic_folder' => 'comics-mini',
'archive_comic_width' => '480',
'rss_comic_width' => '320',
'mini_comic_width' => '80',
'blog_postcount' => '10'
'archive_comic_width' => '480',
'mini_comic_width' => '80'
) as $field => $value) {
$comicpress_options['comicpress_config'][$field] = $value;
}
@ -126,6 +125,7 @@ function comicpress_load_options() {
'cp_theme_layout' => 'standard',
'disable_comic_frontpage' => false,
'blog_postcount' => '10',
'disable_comic_blog_frontpage' => false,
'disable_comic_blog_single' => false,
'disable_blog_frontpage' => false,
@ -144,7 +144,7 @@ function comicpress_load_options() {
'custom_image_header_width' => '980',
'custom_image_header_height' => '120',
'enable_numbered_pagination' => false,
'enable_numbered_pagination' => true,
'disable_page_restraints' => false,
'enable_related_comics' => false,

View File

@ -1,11 +1,11 @@
<?php
function comicpress_dual_columns() {
global $comicpress_options, $blog_postcount; ?>
global $comicpress_options; ?>
<div id="dualcolumns">
<div class="column_one">
<div class="column_one_header"></div>
<?php $blog_query = 'showposts='.$blog_postcount.'&cat="-'.exclude_comic_categories().'"&author='.$comicpress_options['author_column_one'].'&paged='.$paged;
<?php $blog_query = 'showposts='.$comicpress_options['blog_postcount'].'&cat="-'.exclude_comic_categories().'"&author='.$comicpress_options['author_column_one'].'&paged='.$paged;
$posts = query_posts($blog_query);
if (have_posts()) {
while (have_posts()) : the_post();
@ -16,7 +16,7 @@ function comicpress_dual_columns() {
</div>
<div class="column_two">
<div class="column_two_header"></div>
<?php $blog_query = 'showposts='.$blog_postcount.'&cat="-'.exclude_comic_categories().'"&author='.$comicpress_options['author_column_two'];
<?php $blog_query = 'showposts='.$comicpress_options['blog_postcount'].'&cat="-'.exclude_comic_categories().'"&author='.$comicpress_options['author_column_two'];
$posts = query_posts($blog_query);
if (have_posts()) {
while (have_posts()) : the_post();

View File

@ -28,10 +28,9 @@
<?php } ?>
<?php if (!$comicpress_options['disable_blog_frontpage']) {
global $blog_postcount;
Protect();
if (!$comicpress_options['split_column_in_two']) {
$blog_query = 'showposts='.$blog_postcount.'&cat="-'.exclude_comic_categories().'"&paged='.$paged;
$blog_query = 'showposts='.$comicpress_options['blog_postcount'].'&cat="-'.exclude_comic_categories().'"&paged='.$paged;
$posts = query_posts($blog_query);
if (have_posts()) { ?>

View File

@ -139,7 +139,33 @@
</td>
</tr>
<tr class="alternate">
<th scope="row"><label for="rss_comic_width"><?php _e('RSS Thumbnail Width','comicpress'); ?></label></th>
<td>
<input type="text" size="7" name="rss_comic_width" id="rss_comic_width" value="<?php echo $comicpress_options['comicpress_config']['rss_comic_width']; ?>" />
</td>
<td/>
</td>
</tr>
<tr>
<th scope="row"><label for="archive_comic_width"><?php _e('ARCHIVE Thumbnail Width','comicpress'); ?></label></th>
<td>
<input type="text" size="7" name="archive_comic_width" id="archive_comic_width" value="<?php echo $comicpress_options['comicpress_config']['archive_comic_width']; ?>" />
</td>
<td/>
</td>
</tr>
<tr class="alternate">
<th scope="row"><label for="mini_comic_width"><?php _e('MINI Thumbnail Width','comicpress'); ?></label></th>
<td>
<input type="text" size="7" name="mini_comic_width" id="mini_comic_width" value="<?php echo $comicpress_options['comicpress_config']['mini_comic_width']; ?>" />
</td>
<td/>
</td>
</tr>
</table>
</div>

View File

@ -20,6 +20,15 @@
<?php _e('Checkmark this and the blog will not display on the Home page of your site. The features allows to either not have a blog at all, or, if you place a menu link to your blog page, you can maintain your blog within the same site without readers having to see it when they are just trying to read your comic.','comicpress'); ?>
</td>
</tr>
<tr>
<th scope="row"><label for="blog_postcount"><?php _e('Blog Post Count','comicpress'); ?></label></th>
<td>
<input type="text" size="7" name="blog_postcount" id="blog_postcount" value="<?php echo $comicpress_options['blog_postcount']; ?>" />
</td>
<td>
<?php _e('How many blog posts you would like displayed on the index page at one time.','comicpress'); ?>
</td>
</tr>
</table>
<table class="widefat">

View File

@ -10,7 +10,7 @@ if (have_posts()) : while (have_posts()) : the_post();
$next_comic = get_next_comic();
$next_comic = (array)$next_comic;
$next_date = mysql2date('Y-m-j', $next_comic['post_date']);
$blog_query = 'showposts='.$blog_postcount.'&order=asc&cat=-'.exclude_comic_categories();
$blog_query = 'showposts='.$comicpress_options['blog_postcount'].'&order=asc&cat=-'.exclude_comic_categories();
}
} else {
comicpress_display_post();
@ -25,9 +25,8 @@ if (have_posts()) : while (have_posts()) : the_post();
<?php
if ($comicpress_options['static_blog'] && in_comic_category()) {
global $blog_postcount;
if (!$comicpress_options['split_column_in_two']) {
$blog_query = 'showposts='.$blog_postcount.'&cat="-'.exclude_comic_categories().'"&paged='.$paged;
$blog_query = 'showposts='.$comicpress_options['blog_postcount'].'&cat="-'.exclude_comic_categories().'"&paged='.$paged;
$posts = query_posts($blog_query);
if (have_posts()) { ?>