$avail_layouts trying to figure out the best method for having child themes set the themestyle.php which themes are available for the child theme.

Signed-off-by: Philip M. Hofer (Frumph) <frumph_dragon@yahoo.com>
This commit is contained in:
Philip M. Hofer (Frumph) 2009-12-30 06:03:52 -08:00
parent 3615389411
commit 2297c16ea9
3 changed files with 32 additions and 3 deletions

View File

@ -30,7 +30,7 @@ function comicpress_admin() {
<div class="clear"></div>
<?php
$tab = '';
if ( wp_verify_nonce($_POST['_wpnonce'], 'update-options') ) {
if ( isset($_POST['_wponce']) && wp_verify_nonce($_POST['_wpnonce'], 'update-options') ) {
if ($_REQUEST['action'] == 'comicpress_save_layout') {
foreach (array(
@ -193,7 +193,7 @@ function comicpress_admin() {
<script>function hidemessage() { document.getElementById('message').style.display = 'none'; }</script>
<?php }
}
if ($_REQUEST['action'] == 'comicpress_reset') {
if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'comicpress_reset') {
delete_option('comicpress_options');
$comicpress_options = comicpress_load_options();
?>

View File

@ -233,6 +233,18 @@ function is_cp_theme_layout($choices) {
return false;
}
function is_cp_layout_avail($layout, $avail_layouts) {
if (empty($layout)) return false;
if (empty($avail_layouts)) $avail_layouts = 'standard,v,3c,3c2r,v3c,v3cr,gn,rgn';
$avail_layouts = explode(",",$avail_layouts);
foreach ($avail_layouts as $able_layout) {
if ($layout == $able_layout) {
return true;
}
}
return false;
}
/**
* Remove of wordpress auto-texturizer.
* Dependant on the need remove the commented out areas of this code.

View File

@ -20,17 +20,34 @@
<th colspan="4"><?php _e('Layout','comicpress'); ?></th>
</tr>
</thead>
<?php $avail_layouts = ''; ?>
<tr class="alternate">
<th scope="row" style="width:250px"><label for="cp_theme_layout" style="text-align:left"><?php _e('Choose Your Website Layout','comicpress'); ?></label>
<th scope="row" style="width:250px" valign="top"><label for="cp_theme_layout" style="text-align:left"><?php _e('Choose Your Website Layout','comicpress'); ?></label>
<select name="cp_theme_layout" id="cp_theme_layout" onchange="showimage(this,'cpthemestyle')">
<?php if (is_cp_layout_avail('standard',$avail_layouts)) { ?>
<option class="level-0" value="standard" <?php if ($comicpress_options['cp_theme_layout'] == 'standard') { ?>selected="selected" <?php } ?>><?php _e('2 Column - Standard','comicpress'); ?></option>
<?php } ?>
<?php if (is_cp_layout_avail('v',$avail_layouts)) { ?>
<option class="level-0" value="v" <?php if ($comicpress_options['cp_theme_layout'] =='v') { ?>selected="selected" <?php } ?>><?php _e('2 Column - Vertical','comicpress'); ?></option>
<?php } ?>
<?php if (is_cp_layout_avail('3c',$avail_layouts)) { ?>
<option class="level-0" value="3c" <?php if ($comicpress_options['cp_theme_layout'] =='3c') { ?>selected="selected" <?php } ?>><?php _e('3 Column - Standard ','comicpress'); ?></option>
<?php } ?>
<?php if (is_cp_layout_avail('3c2r',$avail_layouts)) { ?>
<option class="level-0" value="3c2r" <?php if ($comicpress_options['cp_theme_layout'] =='3c2r') { ?>selected="selected" <?php } ?>><?php _e('3 Column - Double Right Sidebar','comicpress'); ?></option>
<?php } ?>
<?php if (is_cp_layout_avail('v3c',$avail_layouts)) { ?>
<option class="level-0" value="v3c" <?php if ($comicpress_options['cp_theme_layout'] =='v3c') { ?>selected="selected" <?php } ?>><?php _e('3 Column - Vertical','comicpress'); ?></option>
<?php } ?>
<?php if (is_cp_layout_avail('v3cr',$avail_layouts)) { ?>
<option class="level-0" value="v3cr" <?php if ($comicpress_options['cp_theme_layout'] =='v3c') { ?>selected="selected" <?php } ?>><?php _e('3 Column - Vertical Double Right Sidebar','comicpress'); ?></option>
<?php } ?>
<?php if (is_cp_layout_avail('gn',$avail_layouts)) { ?>
<option class="level-0" value="gn" <?php if ($comicpress_options['cp_theme_layout'] =='gn') { ?>selected="selected" <?php } ?>><?php _e('Graphic Novel - Left Sidebar','comicpress'); ?></option>
<?php } ?>
<?php if (is_cp_layout_avail('rgn',$avail_layouts)) { ?>
<option class="level-0" value="rgn" <?php if ($comicpress_options['cp_theme_layout'] =='rgn') { ?>selected="selected" <?php } ?>><?php _e('Graphic Novel - Right Sidebar','comicpress'); ?></option>
<?php } ?>
</select>
</th>
<td>