function comicpress_notice_debug()
{
    global $current_user, $comiccat, $blogcat, $comic_folder, $wpdb, $category_tree, $non_comic_categories, $comicpress_options;
    if (substr($_SERVER['PHP_SELF'], -19) != '/wp-admin/index.php' || !$comicpress_options['enable_comicpress_debug']) {
        return;
    }
    $comicpress_options = comicpress_load_options();
    $error = array();
    if (floatval(phpversion()) < 5.0) {
        $phpversion = phpversion();
        $error[] = array('header', __('You are using PHP version: ', 'comicpress') . $phpversion);
        $error[] = __('Version 5 or higher is required for this theme to work correctly.  Please check with your host about upgrading to a newer version.', 'comicpress');
    }
    $post_cat_link = get_bloginfo('wpurl') . '/wp-admin/categories.php';
    // Check Categories
    if ($comiccat == $blogcat) {
        $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>' . __(' 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)) {
        // Check Comics Folder
        $document_root = ABSPATH;
        if (function_exists('cpm_wpmu_modify_path')) {
            $document_root = cpm_wpmu_modify_path($document_root);
        }
        if (!is_dir($document_root . '/' . $comic_folder)) {
            $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 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 Manager - Manager Config will allow you to create the directories needed.');
        }
    }
    if (empty($error)) {
        // Make sure the ComicPress theme is installed in themes/comicpress
        if (ABSPATH . 'wp-content/themes/comicpress' != get_template_directory()) {
            $error[] = array('header', __('ComicPress theme is not installed into the correct folder.', 'comicpress'));
            $error[] = __('As of version 2.9, the ComicPress main core theme is required to be installed into the wp-content/themes/comicpress directory.  It is currently not installed into that directory.', 'comicpress');
        }
    }
    if (empty($error) && $comicpress_options['enable_full_post_check']) {
        // Check to make sure posts are not in blogcat and comiccat both
        $founderror = false;
        $non_comic_categories = str_replace(' and ', ',', $non_comic_categories);
        $blog_query = '&show_posts=-1&posts_per_page=-1&cat=' . $non_comic_categories;
        query_posts($blog_query);
        if (have_posts()) {
            while (have_posts()) {
                the_post();
                if (in_comic_category()) {
                    $founderrorpostlist .= '<a href="' . get_bloginfo('wpurl') . '/wp-admin/post.php?action=edit&post=' . get_the_ID() . '">' . get_the_title() . '</a> - Error: Category Crossover<br />';
                    $founderror = true;
                }
            }
        }
        if ($founderror) {
            $error[] = array('header', __('Post\'s are in both a comic category and blog category.', 'comicpress'));
            $error[] = __('The following posts are set both in a comic category and a blog category, with ComicPress the designations of categories is very important.  The rule of thumb is to make sure that all posts are only in a single category.   If a post is in both the comic category and blog category there will be issues with both navigation and execution of the ComicPress code.', 'comicpress');
            $error[] = $founderrorpostlist;
        }
    }
    if (empty($error) && $comicpress_options['enable_full_post_check']) {
        $founderror = false;
        $blog_query = '&show_posts=-1&posts_per_page=-1';
        $posts = query_posts($blog_query);
        foreach ($posts as $testpost) {
            $post_title_slug = $testpost->post_name;
            if (is_numeric($post_title_slug)) {
                $founderror = true;
                $founderrorpostname .= '<a href="' . get_bloginfo('wpurl') . '/wp-admin/post.php?action=edit&post=' . $testpost->ID . '">' . get_the_title($testpost->ID) . '</a> - Error: Post Slug (Permalink) is Numeric<br />';
            }
        }
        if ($founderror) {
            $error[] = array('header', __('Post\'s slug is a numeric.', 'comicpress'));
            $error[] = __('The following posts have a post slug (permalink) that is numeric.  This will cause problems with permalinks.   Post slugs must have at least one alphabetic character in them for Wordpress to handle correctly.', 'comicpress');
            $error[] = $founderrorpostname;
        }
    }
    if (!empty($error)) {
        ?>
	<div class="error">
		<h2>ComicPress Debug</h2>
		ComicPress doesn't seem to be fully installed at this time, check out these messages.<br />
		<br />
		<?php 
        foreach ($error as $info) {
            unset($text);
            if (is_array($info)) {
                list($type, $text) = $info;
            } else {
                if (is_string($info)) {
                    $text = $info;
                    $type = 'paragraph';
                }
            }
            if (!empty($text) && !empty($type)) {
                switch ($type) {
                    case 'header':
                        echo "<h3>{$text}</h3>";
                        break;
                    case 'raw':
                        echo $text;
                        break;
                    default:
                        echo "<p>{$text}</p>";
                        break;
                }
            }
        }
        ?>
		<br />
		<br />
	</div>
<?php 
    }
}
示例#2
0
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/
$comicpress_options = comicpress_load_options();
if ($comicpress_options['enable_numbered_pagination']) {
    ### Function: Page Navigation: Boxed Style Paging
    function wp_pagenavi($before = '', $after = '')
    {
        global $wpdb, $wp_query;
        pagenavi_init();
        //Calling the pagenavi_init() function
        if (!is_single()) {
            $request = $wp_query->request;
            $posts_per_page = intval(get_query_var('posts_per_page'));
            $paged = intval(get_query_var('paged'));
            $pagenavi_options = get_option('pagenavi_options');
            $numposts = $wp_query->found_posts;
            $max_page = $wp_query->max_num_pages;
            /*
function comicpress_admin()
{
    global $upload_path, $blogcat;
    $comicpress_options = get_option('comicpress_options');
    ?>

<div class="wrap">
	<div id="cpadmin-headericon" style="background: url('<?php 
    echo get_template_directory_uri();
    ?>
/images/options/comicpress_icon.png') no-repeat;"></div>
	<h2 class="alignleft"><?php 
    _e('ComicPress Options', 'comicpress');
    ?>
</h2>
	<div class="clear"></div>
	<?php 
    $tab = '';
    if (wp_verify_nonce($_POST['_wpnonce'], 'update-options')) {
        if ($_REQUEST['action'] == 'comicpress_save_layout') {
            $comicpress_options['cp_theme_layout'] = wp_filter_nohtml_kses($_REQUEST['cp_theme_layout']);
            $tab = 'themestyle';
            update_option('comicpress_options', $comicpress_options);
        }
        if ($_REQUEST['action'] == 'comicpress_save_general') {
            foreach (array('disable_page_restraints', 'rascal_says', 'disable_comment_note', 'enable_numbered_pagination', 'enable_comment_count_in_rss', 'enable_post_thumbnail_rss', 'comic_clicks_next', 'disable_default_comic_nav', 'enable_widgetarea_use_sidebar_css', 'disable_lrsidebars', 'disable_footer_text', 'disable_blogheader', 'enable_comicpress_debug', 'enable_full_post_check', 'enable_scroll_to_top', 'enable_page_load_info') 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]);
            }
            $tab = 'general';
            update_option('comicpress_options', $comicpress_options);
        }
        if ($_REQUEST['action'] == 'comicpress_save_index') {
            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);
            }
            $comicpress_options['blog_postcount'] = wp_filter_nohtml_kses($_REQUEST['blog_postcount']);
            $tab = 'index';
            update_option('comicpress_options', $comicpress_options);
        }
        if ($_REQUEST['action'] == 'comicpress_save_post') {
            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]);
            }
            $tab = 'post';
            update_option('comicpress_options', $comicpress_options);
        }
        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]);
            }
            $tab = 'archivesearch';
            update_option('comicpress_options', $comicpress_options);
        }
        if ($_REQUEST['action'] == 'comicpress_save_menubar') {
            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);
            }
            $tab = 'menubar';
            update_option('comicpress_options', $comicpress_options);
        }
        if ($_REQUEST['action'] == 'comicpress_save_addons') {
            foreach (array('enable_custom_image_header', 'enable_members_only_post_comments', 'buy_print_add_shipping') as $key) {
                $comicpress_options[$key] = (bool) ($_REQUEST[$key] == 1 ? true : false);
            }
            foreach (array('custom_image_header_width', 'custom_image_header_height', 'enable_members_only', 'members_post_category', '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]);
            }
            $tab = 'addons';
            update_option('comicpress_options', $comicpress_options);
        }
        if ($_REQUEST['action'] == 'comicpress_save_config') {
            foreach (array('comiccat', 'blogcat', 'comic_folder', 'rss_comic_folder', 'archive_comic_folder', 'mini_comic_folder', 'archive_comic_width', 'rss_comic_width', 'mini_comic_width') as $key) {
                $comicpress_options['comicpress_config'][$key] = wp_filter_nohtml_kses($_REQUEST[$key]);
            }
            $tab = 'config';
            update_option('comicpress_options', $comicpress_options);
        }
        if ($tab) {
            ?>
			<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 
        }
    }
    if ($_REQUEST['action'] == 'comicpress_reset') {
        delete_option('comicpress_options');
        $comicpress_options = comicpress_load_options();
        ?>
			<div id="message" class="updated"><p><strong><?php 
        _e('ComicPress Settings RESET!', 'comicpress');
        ?>
</strong></p></div>
		<?php 
    }
    ?>

	<div id="poststuff" class="metabox-holder">
		<div id="cpadmin">
		  <?php 
    $tab_info = array('themestyle' => __('Layout', 'comicpress'), 'general' => __('General', 'comicpress'), 'index' => __('Home Page', 'comicpress'), 'post' => __('Posts &amp; Pages', 'comicpress'), 'archivesearch' => __('Archive &amp; Search', 'comicpress'), 'menubar' => __('Menubar', 'comicpress'), 'addons' => __('Add Ons', 'comicpress'), 'config' => __('Configuration', 'comicpress'));
    if (empty($tab)) {
        $tab = array_shift(array_keys($tab_info));
    }
    foreach ($tab_info as $tab_id => $label) {
        ?>
		  		<div id="comicpress-tab-<?php 
        echo $tab_id;
        ?>
" class="comicpress-tab <?php 
        echo $tab == $tab_id ? 'on' : 'off';
        ?>
"><span><?php 
        echo $label;
        ?>
</span></div>
		  	<?php 
    }
    ?>
		</div>

		<div id="comicpress-options-pages">
		  <?php 
    foreach (glob(get_template_directory() . '/options/*.php') as $file) {
        include $file;
    }
    ?>
		</div>
	</div>
	<script type="text/javascript">
		(function($) {
			var showPage = function(which) {
				$('#comicpress-options-pages > div').each(function(i) {
					$(this)[(this.id == 'comicpress-' + which) ? 'show' : 'hide']();
				});
			};

			$('.comicpress-tab').click(function() {
				$('#message').animate({height:"0", opacity:0, margin: 0}, 100, 'swing', function() { $(this).remove() });

				showPage(this.id.replace('comicpress-tab-', ''));
				var myThis = this;
				$('.comicpress-tab').each(function() {
					var isSame = (this == myThis);
					$(this).toggleClass('on', isSame).toggleClass('off', !isSame);
				});
				return false;
			});

			showPage('<?php 
    echo esc_js($tab);
    ?>
');
		}(jQuery));
	</script>
</div>

<?php 
}
示例#4
0
function comicpress_themeinfo($whichinfo = null)
{
    global $comicpress_themeinfo;
    if (empty($comicpress_themeinfo) || $whichinfo == 'reset') {
        global $comiccat, $blogcat, $comic_folder, $rss_comic_folder, $mini_comic_folder, $archive_comic_folder, $archive_comic_width, $rss_comic_width, $mini_comic_width, $blog_postcount;
        $comicpress_themeinfo = '';
        //		$comicpress_config = comicpress_load_config();
        $comicpress_options = comicpress_load_options();
        $comicpress_coreinfo = wp_upload_dir();
        $comicpress_addinfo = array('upload_path' => get_option('upload_path'), 'version' => '2.9.3.1', 'siteurl' => trailingslashit(get_option('siteurl')), 'home' => trailingslashit(home_url()), 'comiccat' => $comiccat, 'blogcat' => $blogcat, 'comic_folder' => $comic_folder, 'rss_comic_folder' => $rss_comic_folder, 'archive_comic_folder' => $archive_comic_folder, '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' => $blog_postcount, 'enable-storyline-support' => get_option('comicpress-enable-storyline-support'));
        $comicpress_themeinfo = array_merge($comicpress_coreinfo, $comicpress_addinfo);
        $comicpress_themeinfo = array_merge($comicpress_themeinfo, $comicpress_options);
        if ($comicpress_themeinfo['enable-storyline-support']) {
            // This is now sep. to make sure that it only loads when it needs to
            $comicpress_storyline = array('category_tree' => comicpress_create_category_tree(), 'storyline-category-order' => get_option('comicpress-storyline-category-order'));
            $comicpress_themeinfo = array_merge($comicpress_themeinfo, $comicpress_storyline);
        }
        if (is_multisite()) {
            $comicpress_themeinfo['basedir'] = trailingslashit(ABSPATH . $comicpress_themeinfo['upload_path']);
            $comicpress_themeinfo['baseurl'] = trailingslashit($comicpress_themeinfo['siteurl'] . 'files');
        } else {
            $comicpress_themeinfo['basedir'] = ABSPATH;
            $comicpress_themeinfo['baseurl'] = trailingslashit($comicpress_themeinfo['siteurl']);
        }
        if ($comicpress_themeinfo['cp_theme_layout'] == 'standard') {
            $comicpress_themeinfo['cp_theme_layout'] = '2cr';
        }
        if ($comicpress_themeinfo['cp_theme_layout'] == 'gn') {
            $comicpress_themeinfo['cp_theme_layout'] = 'lgn';
        }
        if ($comicpress_themeinfo['cp_theme_layout'] == 'v') {
            $comicpress_themeinfo['cp_theme_layout'] = '2cvl';
        }
    }
    if ($whichinfo && $whichinfo !== 'reset') {
        if (isset($comicpress_themeinfo[$whichinfo])) {
            return $comicpress_themeinfo[$whichinfo];
        } else {
            return false;
        }
    }
    return $comicpress_themeinfo;
}
示例#5
0
function is_cp_theme_layout($choices)
{
    $comicpress_options = comicpress_load_options();
    $choices = explode(",", $choices);
    foreach ($choices as $choice) {
        if ($comicpress_options['cp_theme_layout'] == $choice) {
            return true;
        }
    }
    return false;
}