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 get_header(); ?>
<?php include(get_template_directory() . '/layout-head.php'); ?> <?php include(get_template_directory() . '/layout-head.php'); ?>
<?php global $blog_postcount; <?php
if (!$comicpress['split_column_in_two']) { 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); $posts = query_posts($blog_query);
if (have_posts()) { if (have_posts()) {

View File

@ -78,7 +78,7 @@ function comicpress_admin() {
) as $key) { ) as $key) {
$comicpress_options[$key] = (bool)( $_REQUEST[$key] == 1 ? true : false ); $comicpress_options[$key] = (bool)( $_REQUEST[$key] == 1 ? true : false );
} }
$comicpress_options['blog_postcount'] = wp_filter_nohtml_kses($_REQUEST['blog_postcount']);
$tab = 'index'; $tab = 'index';
update_option('comicpress_options',$comicpress_options); update_option('comicpress_options',$comicpress_options);
} }
@ -191,8 +191,7 @@ function comicpress_admin() {
'mini_comic_folder', 'mini_comic_folder',
'archive_comic_width', 'archive_comic_width',
'rss_comic_width', 'rss_comic_width',
'mini_comic_width', 'mini_comic_width'
'blog_postcount'
) as $key) { ) as $key) {
$comicpress_options['comicpress_config'][$key] = wp_filter_nohtml_kses($_REQUEST[$key]); $comicpress_options['comicpress_config'][$key] = wp_filter_nohtml_kses($_REQUEST[$key]);
} }
@ -202,7 +201,7 @@ function comicpress_admin() {
if ($tab) { 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> <script>function hidemessage() { document.getElementById('message').style.display = 'none'; }</script>
<?php } <?php }
} }
@ -210,7 +209,7 @@ function comicpress_admin() {
delete_option('comicpress_options'); delete_option('comicpress_options');
$comicpress_options = comicpress_load_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> <script>function hidemessage() { document.getElementById('message').style.display = 'none'; }</script>
<?php <?php
} }

View File

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

View File

@ -1,11 +1,11 @@
<?php <?php
function comicpress_dual_columns() { function comicpress_dual_columns() {
global $comicpress_options, $blog_postcount; ?> global $comicpress_options; ?>
<div id="dualcolumns"> <div id="dualcolumns">
<div class="column_one"> <div class="column_one">
<div class="column_one_header"></div> <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); $posts = query_posts($blog_query);
if (have_posts()) { if (have_posts()) {
while (have_posts()) : the_post(); while (have_posts()) : the_post();
@ -16,7 +16,7 @@ function comicpress_dual_columns() {
</div> </div>
<div class="column_two"> <div class="column_two">
<div class="column_two_header"></div> <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); $posts = query_posts($blog_query);
if (have_posts()) { if (have_posts()) {
while (have_posts()) : the_post(); while (have_posts()) : the_post();

View File

@ -28,10 +28,9 @@
<?php } ?> <?php } ?>
<?php if (!$comicpress_options['disable_blog_frontpage']) { <?php if (!$comicpress_options['disable_blog_frontpage']) {
global $blog_postcount;
Protect(); Protect();
if (!$comicpress_options['split_column_in_two']) { 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); $posts = query_posts($blog_query);
if (have_posts()) { ?> if (have_posts()) { ?>

View File

@ -139,6 +139,32 @@
</td> </td>
</tr> </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> </table>

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'); ?> <?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> </td>
</tr> </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>
<table class="widefat"> <table class="widefat">

View File

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