2009-11-13 16:00:25 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
function options() {
|
|
|
|
$pagehook = add_submenu_page('themes.php','comicpress', __('ComicPress Options','comicpress'), 10, 'comicpress-options', 'comicpress_admin');
|
|
|
|
add_action('admin_head-'.$pagehook, 'comicpress_admin_page_head');
|
|
|
|
}
|
|
|
|
|
2009-12-26 00:50:51 +00:00
|
|
|
function comicpress_admin_page_head() {
|
|
|
|
wp_admin_css( 'css/global' );
|
|
|
|
wp_admin_css();
|
|
|
|
wp_admin_css( 'css/colors' );
|
|
|
|
wp_admin_css( 'css/ie' );
|
|
|
|
wp_enqueue_script('utils');
|
|
|
|
?>
|
2009-11-28 05:04:48 +00:00
|
|
|
<link rel="stylesheet" href="<?php echo get_template_directory_uri(); ?>/options/options.css" type="text/css" media="screen" />
|
|
|
|
<script type="text/javascript" src="<?php echo get_template_directory_uri(); ?>/js/tabbed_pages.js"></script>
|
|
|
|
<!--[if lt ie 8]> <style> div.show { position: static; margin-top: 1px; } #cpadmin div.off { height: 22px; } </style> <![endif]-->
|
2009-11-13 16:00:25 +00:00
|
|
|
|
2009-11-17 01:50:50 +00:00
|
|
|
<?php }
|
2009-11-13 16:00:25 +00:00
|
|
|
|
|
|
|
function comicpress_admin() {
|
2009-11-22 18:06:19 +00:00
|
|
|
global $upload_path, $blogcat;
|
2009-12-26 00:50:51 +00:00
|
|
|
$comicpress_options = get_option('comicpress_options');
|
|
|
|
?>
|
2009-11-13 16:00:25 +00:00
|
|
|
|
2009-11-17 01:50:50 +00:00
|
|
|
<div class="wrap">
|
|
|
|
|
|
|
|
<div id="cpadmin-headericon" style="background: url('<?php echo get_template_directory_uri(); ?>/images/options/comicpress_icon.png') no-repeat;"></div>
|
2009-11-13 16:00:25 +00:00
|
|
|
<h2 class="alignleft"><?php _e('ComicPress Options','comicpress'); ?></h2>
|
2009-11-22 18:06:19 +00:00
|
|
|
<div class="clear"></div>
|
2009-11-13 16:00:25 +00:00
|
|
|
<?php
|
2009-11-22 19:56:35 +00:00
|
|
|
$tab = '';
|
2009-11-13 16:00:25 +00:00
|
|
|
if ( wp_verify_nonce($_POST['_wpnonce'], 'update-options') ) {
|
|
|
|
|
2009-12-26 00:50:51 +00:00
|
|
|
if ($_REQUEST['action'] == 'comicpress_save_layout') {
|
|
|
|
foreach (array(
|
|
|
|
'cp_theme_layout'
|
|
|
|
) as $key) {
|
|
|
|
$comicpress_options[$key] = wp_filter_nohtml_kses($_REQUEST[$key]);
|
|
|
|
}
|
2009-11-22 18:06:19 +00:00
|
|
|
$tab = 'themestyle';
|
|
|
|
update_option('comicpress_options',$comicpress_options);
|
|
|
|
}
|
|
|
|
|
2009-11-22 19:56:35 +00:00
|
|
|
if ($_REQUEST['action'] == 'comicpress_save_general') {
|
2009-12-26 00:50:51 +00:00
|
|
|
|
|
|
|
foreach (array(
|
|
|
|
'disable_page_restraints',
|
|
|
|
'rascal_says',
|
|
|
|
'disable_comment_note',
|
|
|
|
'enable_numbered_pagination',
|
2009-12-26 13:50:54 +00:00
|
|
|
'enable_comment_count_in_rss',
|
2009-12-26 00:50:51 +00:00
|
|
|
'comic_clicks_next',
|
|
|
|
'disable_default_comic_nav',
|
|
|
|
'enable_widgetarea_use_sidebar_css',
|
|
|
|
'disable_lrsidebars_frontpage',
|
|
|
|
'disable_footer_text',
|
|
|
|
'disable_blogheader',
|
|
|
|
'enable_comicpress_debug',
|
2009-12-26 14:44:29 +00:00
|
|
|
'enable_full_post_check',
|
|
|
|
'enable_scroll_to_top'
|
2009-12-26 00:50:51 +00:00
|
|
|
) as $key) {
|
|
|
|
$comicpress_options[$key] = (bool)( $_REQUEST[$key] == 1 ? true : false );
|
|
|
|
}
|
|
|
|
foreach (array(
|
|
|
|
'graphicnav_directory'
|
|
|
|
) as $key) {
|
|
|
|
$comicpress_options[$key] = wp_filter_nohtml_kses($_REQUEST[$key]);
|
|
|
|
}
|
2009-11-22 19:56:35 +00:00
|
|
|
$tab = 'general';
|
|
|
|
update_option('comicpress_options',$comicpress_options);
|
|
|
|
}
|
|
|
|
|
2009-11-22 22:44:03 +00:00
|
|
|
if ($_REQUEST['action'] == 'comicpress_save_index') {
|
2009-12-26 00:50:51 +00:00
|
|
|
foreach (array(
|
|
|
|
'disable_comic_frontpage',
|
|
|
|
'disable_comic_blog_frontpage',
|
|
|
|
'disable_comic_blog_single',
|
|
|
|
'disable_blog_frontpage'
|
|
|
|
) as $key) {
|
|
|
|
$comicpress_options[$key] = (bool)( $_REQUEST[$key] == 1 ? true : false );
|
|
|
|
}
|
|
|
|
|
2009-11-23 06:33:29 +00:00
|
|
|
$tab = 'index';
|
|
|
|
update_option('comicpress_options',$comicpress_options);
|
2009-11-22 22:44:03 +00:00
|
|
|
}
|
2009-11-23 06:33:29 +00:00
|
|
|
|
|
|
|
if ($_REQUEST['action'] == 'comicpress_save_post') {
|
2009-12-26 00:50:51 +00:00
|
|
|
foreach (array(
|
|
|
|
'transcript_in_posts',
|
|
|
|
'enable_related_comics',
|
|
|
|
'enable_related_posts',
|
|
|
|
'remove_wptexturize',
|
|
|
|
'enable_comic_post_author_gravatar',
|
|
|
|
'enable_post_author_gravatar',
|
|
|
|
'split_column_in_two',
|
|
|
|
'enable_comic_post_calendar',
|
|
|
|
'enable_post_calendar',
|
|
|
|
'disable_tags_in_posts',
|
|
|
|
'disable_categories_in_posts',
|
|
|
|
'blogposts_with_comic',
|
|
|
|
'static_blog',
|
|
|
|
'disable_page_titles'
|
|
|
|
) as $key) {
|
|
|
|
$comicpress_options[$key] = (bool)( $_REQUEST[$key] == 1 ? true : false );
|
|
|
|
}
|
|
|
|
foreach (array(
|
|
|
|
'author_column_one',
|
|
|
|
'author_column_two',
|
|
|
|
'avatar_directory',
|
|
|
|
'moods_directory',
|
|
|
|
'calendar_directory'
|
|
|
|
) as $key) {
|
|
|
|
$comicpress_options[$key] = wp_filter_nohtml_kses($_REQUEST[$key]);
|
|
|
|
}
|
2009-11-23 06:33:29 +00:00
|
|
|
$tab = 'post';
|
|
|
|
update_option('comicpress_options',$comicpress_options);
|
|
|
|
}
|
|
|
|
|
2009-12-26 00:50:51 +00:00
|
|
|
if ($_REQUEST['action'] == 'comicpress_save_archivesearch') {
|
|
|
|
foreach (array(
|
|
|
|
'archive_display_order',
|
|
|
|
'excerpt_or_content_archive',
|
|
|
|
'excerpt_or_content_search',
|
|
|
|
'category_thumbnail_postcount'
|
|
|
|
) as $key) {
|
|
|
|
$comicpress_options[$key] = wp_filter_nohtml_kses($_REQUEST[$key]);
|
|
|
|
}
|
2009-11-23 06:33:29 +00:00
|
|
|
$tab = 'archivesearch';
|
|
|
|
update_option('comicpress_options',$comicpress_options);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($_REQUEST['action'] == 'comicpress_save_menubar') {
|
2009-12-26 00:50:51 +00:00
|
|
|
foreach (array(
|
|
|
|
'enable_search_in_menubar',
|
|
|
|
'enable_rss_in_menubar',
|
|
|
|
'enable_navigation_in_menubar',
|
|
|
|
'contact_in_menubar',
|
|
|
|
'disable_dynamic_menubar_links',
|
|
|
|
'disable_default_menubar',
|
|
|
|
'enable_blogroll_off_links'
|
|
|
|
) as $key) {
|
|
|
|
$comicpress_options[$key] = (bool)( $_REQUEST[$key] == 1 ? true : false );
|
|
|
|
}
|
2009-11-23 06:33:29 +00:00
|
|
|
$tab = 'menubar';
|
|
|
|
update_option('comicpress_options',$comicpress_options);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($_REQUEST['action'] == 'comicpress_save_customheader') {
|
2009-12-26 00:50:51 +00:00
|
|
|
foreach (array(
|
|
|
|
'enable_custom_image_header'
|
|
|
|
) as $key) {
|
|
|
|
$comicpress_options[$key] = (bool)( $_REQUEST[$key] == 1 ? true : false );
|
|
|
|
}
|
|
|
|
foreach (array(
|
|
|
|
'custom_image_header_width',
|
|
|
|
'custom_image_header_height'
|
|
|
|
) as $key) {
|
|
|
|
$comicpress_options[$key] = wp_filter_nohtml_kses($_REQUEST[$key]);
|
|
|
|
}
|
2009-11-23 06:33:29 +00:00
|
|
|
$tab = 'customheader';
|
|
|
|
update_option('comicpress_options',$comicpress_options);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($_REQUEST['action'] == 'comicpress_save_buyprint') {
|
2009-12-26 00:50:51 +00:00
|
|
|
foreach (array(
|
|
|
|
'buy_print_add_shipping'
|
|
|
|
) as $key) {
|
|
|
|
$comicpress_options[$key] = (bool)( $_REQUEST[$key] == 1 ? true : false );
|
|
|
|
}
|
|
|
|
foreach (array(
|
|
|
|
'buy_print_email',
|
|
|
|
'buy_print_url',
|
|
|
|
'buy_print_us_amount',
|
|
|
|
'buy_print_int_amount',
|
|
|
|
'buy_print_us_ship',
|
|
|
|
'buy_print_int_ship'
|
|
|
|
) as $key) {
|
|
|
|
$comicpress_options[$key] = wp_filter_nohtml_kses($_REQUEST[$key]);
|
|
|
|
}
|
2009-11-23 06:33:29 +00:00
|
|
|
$tab = 'buyprint';
|
|
|
|
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);
|
|
|
|
}
|
2009-11-22 19:56:35 +00:00
|
|
|
if ($tab) {
|
2009-11-22 18:06:19 +00:00
|
|
|
?>
|
2009-11-23 06:33:29 +00:00
|
|
|
<div id="message" class="updated fade"><p><strong><?php _e('ComicPress Settings SAVED!','comicpress'); ?></strong></p></div>
|
2009-11-17 01:50:50 +00:00
|
|
|
<script>function hidemessage() { document.getElementById('message').style.display = 'none'; }</script>
|
2009-11-23 06:33:29 +00:00
|
|
|
<?php }
|
|
|
|
}
|
2009-11-23 06:36:54 +00:00
|
|
|
if ($_REQUEST['action'] == 'comicpress_reset') {
|
|
|
|
delete_option('comicpress_options');
|
|
|
|
$comicpress_options = comicpress_load_options();
|
|
|
|
?>
|
2009-11-17 01:50:50 +00:00
|
|
|
<div id="message" class="updated fade"><p><strong><?php _e('ComicPress Settings RESET!','comicpress'); ?></strong></p></div>
|
|
|
|
<script>function hidemessage() { document.getElementById('message').style.display = 'none'; }</script>
|
2009-11-13 16:00:25 +00:00
|
|
|
<?php
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|
2009-11-17 01:50:50 +00:00
|
|
|
|
2009-11-13 16:00:25 +00:00
|
|
|
<div id="poststuff" class="metabox-holder">
|
|
|
|
|
2009-11-24 06:34:16 +00:00
|
|
|
<div id="cpadmin" onclick="hidemessage();">
|
|
|
|
<div class="<?php if ($tab == 'themestyle' || empty($tab)) { ?>on<?php } else { ?>off<?php } ?>" title="themestyle"><span><?php _e('Layout','comicpress'); ?></span></div>
|
|
|
|
<div class="<?php if ($tab == 'general') { ?>on<?php } else { ?>off<?php } ?>" title="generaloptions"><span><?php _e('General','comicpress'); ?></span></div>
|
|
|
|
<div class="<?php if ($tab == 'index') { ?>on<?php } else { ?>off<?php } ?>" title="indexoptions"><span><?php _e('Home Page','comicpress'); ?></span></div>
|
|
|
|
<div class="<?php if ($tab == 'post') { ?>on<?php } else { ?>off<?php } ?>" title="postoptions"><span><?php _e('Posts & Pages','comicpress'); ?></span></div>
|
|
|
|
<div class="<?php if ($tab == 'archivesearch') { ?>on<?php } else { ?>off<?php } ?>" title="archivesearch"><span><?php _e('Archive & Search','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 == '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>
|
2009-12-26 01:42:55 +00:00
|
|
|
|
|
|
|
<?php
|
|
|
|
foreach (glob(get_template_directory() . '/options/*.php') as $file) {
|
|
|
|
include($file);
|
|
|
|
}
|
|
|
|
?>
|
2009-11-13 16:00:25 +00:00
|
|
|
</div>
|
2009-11-24 06:34:16 +00:00
|
|
|
|
|
|
|
</div>
|
|
|
|
|
2009-11-13 16:00:25 +00:00
|
|
|
<?php
|
|
|
|
}
|
|
|
|
|
|
|
|
add_action('admin_menu', 'options');
|
|
|
|
|
|
|
|
?>
|