ComicPress options changes

Signed-off-by: Philip M. Hofer (Frumph) <frumph_dragon@yahoo.com>
This commit is contained in:
Philip M. Hofer (Frumph) 2009-12-31 13:22:47 -08:00
parent 6ac1fb1884
commit 94d7cdbc02
6 changed files with 86 additions and 62 deletions

View File

@ -15,14 +15,14 @@ function comicpress_notice_debug() {
if ($comiccat == $blogcat) { if ($comiccat == $blogcat) {
$error[] = array('header', __('Primary Comic and Blog categories are not configured properly.','comicpress')); $error[] = array('header', __('Primary Comic and Blog categories are not configured properly.','comicpress'));
$error[] = __('ComicPress requires 2 categories to be added to the ','comicpress') . '<a href="'.$post_cat_link.'">' . __('post categories.','comicpress') . '</a>' . $error[] = __('ComicPress requires 2 categories to be added to the ','comicpress') . '<a href="'.$post_cat_link.'">' . __('post categories.','comicpress') . '</a>' .
__(' It is necessary to have 2 more categories in addition to the uncategorized category, a Blog and Comic primary categories. These two additional categories will be the root categories that seperate the difference between the comic and blog posts. When you post a new comic you will be posting it into the comic category or heirarchal children of the comic category. When posting a new blog post you need to set it into the blog category or child of the blog category. Uncategorized will act as a blog post category (do not rename uncategorized). You can configure the categories to set as the primary blog and comic category from within the comicpress-config.php file or use ComicPress Manager - ComicPress Config','comicpress'); __(' It is necessary to have 2 more categories in addition to the uncategorized category, a Blog and Comic primary categories. These two additional categories will be the root categories that seperate the difference between the comic and blog posts. When you post a new comic you will be posting it into the comic category or heirarchal children of the comic category. When posting a new blog post you need to set it into the blog category or child of the blog category. Uncategorized will act as a blog post category (do not rename uncategorized). You can configure the categories to set as the primary blog and comic category from within the ComicPress Manager plugin.','comicpress');
} }
if (empty($error)) { if (empty($error)) {
// Check Comics Folder // Check Comics Folder
if (!is_dir(ABSPATH . '/' . $comic_folder)) { if (!is_dir(ABSPATH . '/' . $comic_folder)) {
$error[] = array('header', __('Comics Folder is not configured and is unable to be found.','comicpress')); $error[] = array('header', __('Comics Folder is not configured and is unable to be found.','comicpress'));
$error[] = __('ComicPress stores the files it uses inside a specific directory and that directory is set within the comicpress-config.php or you can configure it from within ComicPress Manager. When this error is present it means that the theme is unable to find the appropriate directory to read the comics from.','comicpress'); $error[] = __('ComicPress stores the files it uses inside a specific directory and that directory is set from within ComicPress Manager. When this error is present it means that the theme is unable to find the appropriate directory to read the comics from.','comicpress');
} }
} }

View File

@ -58,8 +58,10 @@ 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 );
} }
foreach (array( foreach (array(
'graphicnav_directory' 'graphicnav_directory',
'members_post_category'
) as $key) { ) as $key) {
$comicpress_options[$key] = wp_filter_nohtml_kses($_REQUEST[$key]); $comicpress_options[$key] = wp_filter_nohtml_kses($_REQUEST[$key]);
} }
@ -178,11 +180,6 @@ function comicpress_admin() {
update_option('comicpress_options',$comicpress_options); update_option('comicpress_options',$comicpress_options);
} }
if ($_REQUEST['action'] == 'comicpress_save_members') {
$comicpress_options['members_post_category'] = wp_filter_nohtml_kses($_REQUEST['members_post_category']);
$tab = 'members';
update_option('comicpress_options',$comicpress_options);
}
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 fade"><p><strong><?php _e('ComicPress Settings SAVED!','comicpress'); ?></strong></p></div>
@ -211,7 +208,8 @@ function comicpress_admin() {
<div class="<?php if ($tab == 'menubar') { ?>on<?php } else { ?>off<?php } ?>" title="menubaroptions"><span><?php _e('Menubar','comicpress'); ?></span></div> <div class="<?php if ($tab == 'menubar') { ?>on<?php } else { ?>off<?php } ?>" title="menubaroptions"><span><?php _e('Menubar','comicpress'); ?></span></div>
<div class="<?php if ($tab == 'customheader') { ?>on<?php } else { ?>off<?php } ?>" title="customheader"><span><?php _e('Custom Header','comicpress'); ?></span></div> <div class="<?php if ($tab == 'customheader') { ?>on<?php } else { ?>off<?php } ?>" title="customheader"><span><?php _e('Custom Header','comicpress'); ?></span></div>
<div class="<?php if ($tab == 'buyprint') { ?>on<?php } else { ?>off<?php } ?>" title="buyprintoptions"><span><?php _e('Buy Print','comicpress'); ?></span></div> <div class="<?php if ($tab == 'buyprint') { ?>on<?php } else { ?>off<?php } ?>" title="buyprintoptions"><span><?php _e('Buy Print','comicpress'); ?></span></div>
<div class="<?php if ($tab == 'members') { ?>on<?php } else { ?>off<?php } ?>" title="membersoptions"><span><?php _e('Members','comicpress'); ?></span></div> <div class="<?php if ($tab == 'config') { ?>on<?php } else { ?>off<?php } ?>" title="configoptions"><span><?php _e('Configuration','comicpress'); ?></span></div>
</div> </div>
<?php <?php

View File

@ -52,7 +52,11 @@ function __comicpress_init() {
// Check if the $comicpress_options exist, if not set defaults // Check if the $comicpress_options exist, if not set defaults
$comicpress_options = comicpress_load_options(); $comicpress_options = comicpress_load_options();
extract($comicpress_options['comicpress_config']); if (file_exists(get_template_directory() . '/comicpress-config.php')) {
include(get_template_directory() . '/comicpress-config.php');
} else {
extract($comicpress_options['comicpress_config']);
}
// xili-language plugin check // xili-language plugin check
if (class_exists('xili_language')) { if (class_exists('xili_language')) {

44
options/configoptions.php Normal file
View File

@ -0,0 +1,44 @@
<div id="configoptions" class="<?php if ($tab == 'config') { ?>show<?php } else { ?>hide<?php } ?>">
<form method="post" id="myForm" name="template" enctype="multipart/form-data">
<?php wp_nonce_field('update-options') ?>
<div id="comicpress-options">
<table class="widefat">
<thead>
<tr>
<th colspan="2"><?php _e('Configuration','comicpress'); ?></th>
</tr>
</thead>
<tr class="alternate">
<th scope="row">
<label for="comiccat"><?php _e('Comic Category','comicpress'); ?></label>
<?php
global $comiccat;
$select = wp_dropdown_categories('show_option_none=Select category&show_count=0&orderby=name&echo=0&selected='.$comiccat);
$select = preg_replace('#<select([^>]*)>#', '<select name="comiccat" id="comicccat">', $select);
echo $select;
?>
</th>
<td>
<?php _e('The category that is designated for the primary comic category.','comicpress'); ?>
</td>
</tr>
</table>
</div>
<div id="comicpress-options-save">
<div id="major-publishing-actions">
<div id="publishing-action">
<input name="comicpress_save_config" type="submit" class="button-primary" value="Save Settings" />
<input type="hidden" name="action" value="comicpress_save_members" />
</div>
<div class="clear"></div>
</div>
</div>
</form>
</div>

View File

@ -171,6 +171,36 @@
</tr> </tr>
</table> </table>
<table class="widefat">
<thead>
<tr>
<th colspan="2"><?php _e('Members Only Content','comicpress'); ?></th>
</tr>
</thead>
<tr class="alternate">
<th scope="row">
<label for="members_post_category"><?php _e('Members category','comicpress'); ?></label>
<?php
$select = wp_dropdown_categories('show_option_none=Select category&show_count=0&orderby=name&echo=0&selected='.$comicpress_options['members_post_category']);
$select = preg_replace('#<select([^>]*)>#', '<select name="members_post_category" id="members_post_category">', $select);
echo $select;
?>
</th>
<td>
<?php _e('The category that is designated to show members only content.','comicpress'); ?>
</td>
</tr>
<tr>
<td colspan="2">
<p><?php _e('USAGE: Edit the user with <em>Dashboard -> Users -> Authors & Users</em> and flag the user you want to be a member with the option at the bottom.','comicpress'); ?></p>
<p><?php _e('Inside posts, add [members] content you only want members to see [/members]','comicpress'); ?></p>
<p><?php _e('When setting a \'members\' category, you *cannot* use an existing comic category, uncategorized, or blog category!','comicpress'); ?></p>
<p><?php _e('You MUST create a whole new category and called it "members", then you select that category here and create a page called "Members" or something equivelant and associate the Member\'s Only template to it.','comicpress'); ?></p>
<p><?php _e('This will make it so that that category is only seen as blogposts inside that area and not anywhere else on the site unless the user has the members flag.','comicpress'); ?></p>
</td>
</tr>
</table>
<table class="widefat"> <table class="widefat">
<thead> <thead>
<tr> <tr>

View File

@ -1,52 +0,0 @@
<div id="membersoptions" class="<?php if ($tab == 'members') { ?>show<?php } else { ?>hide<?php } ?>">
<form method="post" id="myForm" name="template" enctype="multipart/form-data">
<?php wp_nonce_field('update-options') ?>
<div id="comicpress-options">
<table class="widefat">
<thead>
<tr>
<th colspan="2"><?php _e('Members Only Content','comicpress'); ?></th>
</tr>
</thead>
<tr class="alternate">
<th scope="row">
<label for="members_post_category"><?php _e('Members category','comicpress'); ?></label>
<?php
$select = wp_dropdown_categories('show_option_none=Select category&show_count=0&orderby=name&echo=0&selected='.$comicpress_options['members_post_category']);
$select = preg_replace('#<select([^>]*)>#', '<select name="members_post_category" id="members_post_category">', $select);
echo $select;
?>
</th>
<td>
<?php _e('The category that is designated to show members only content.','comicpress'); ?>
</td>
</tr>
<tr>
<td colspan="2">
<p><?php _e('USAGE: Edit the user with <em>Dashboard -> Users -> Authors & Users</em> and flag the user you want to be a member with the option at the bottom.','comicpress'); ?></p>
<p><?php _e('Inside posts, add [members] content you only want members to see [/members]','comicpress'); ?></p>
<p><?php _e('When setting a \'members\' category, you *cannot* use an existing comic category, uncategorized, or blog category!','comicpress'); ?></p>
<p><?php _e('You MUST create a whole new category and called it "members", then you select that category here and create a page called "Members" or something equivelant and associate the Member\'s Only template to it.','comicpress'); ?></p>
<p><?php _e('This will make it so that that category is only seen as blogposts inside that area and not anywhere else on the site unless the user has the members flag.','comicpress'); ?></p>
</td>
</tr>
</table>
</div>
<div id="comicpress-options-save">
<div id="major-publishing-actions">
<div id="publishing-action">
<input name="comicpress_save_members" type="submit" class="button-primary" value="Save Settings" />
<input type="hidden" name="action" value="comicpress_save_members" />
</div>
<div class="clear"></div>
</div>
</div>
</form>
</div>