Merge branch 'master' of github.com:johnbintz/comicpress-2.8

This commit is contained in:
mindfaucet 2009-12-21 13:06:39 -07:00
commit c07936c363
6 changed files with 9 additions and 134 deletions

View File

@ -1,6 +1,6 @@
<?php global $comicpress_options; <?php global $comicpress_options;
if (!$comicpress_options['disable_default_menubar']) { if (!$comicpress_options['disable_default_menubar']) {
comicpress_menubar(); the_widget('MenubarWidget',array(),array());
} }
?> ?>
<?php if (comicpress_is_active_sidebar('Menubar')) { ?> <?php if (comicpress_is_active_sidebar('Menubar')) { ?>

View File

@ -4,9 +4,7 @@ if (!$comicpress_options['disable_lrsidebars_frontpage']) { ?>
<div class="sidebar-head"></div> <div class="sidebar-head"></div>
<div class="sidebar"> <div class="sidebar">
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Right Sidebar') ) : ?> <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Right Sidebar') ) : ?>
<div class="widget"> <?php the_widget('BookmarkWidget',array(),array()); ?>
<?php comicpress_comic_bookmark_embed(); ?>
</div>
<?php if (is_cp_theme_layout('standard,v')) { ?> <?php if (is_cp_theme_layout('standard,v')) { ?>
<div class="widget"> <div class="widget">
<?php comicpress_calendar_embed(); ?> <?php comicpress_calendar_embed(); ?>

View File

@ -154,6 +154,8 @@ class BookmarkWidget extends WP_Widget {
$title = empty($instance['title']) ? '' : apply_filters('widget_title', $instance['title']); $title = empty($instance['title']) ? '' : apply_filters('widget_title', $instance['title']);
if (!empty($title)) { echo $before_title . $title . $after_title; }; if (!empty($title)) { echo $before_title . $title . $after_title; };
$mode = !isset($this->text_fields[$instance['mode']]) ? array_shift(array_keys($this->text_fields)) : $instance['mode'];
$link = is_home() ? get_bloginfo('url') : get_permalink($post); $link = is_home() ? get_bloginfo('url') : get_permalink($post);
$id = 'comic-bookmark-' . md5(rand()); $id = 'comic-bookmark-' . md5(rand());
@ -173,10 +175,10 @@ class BookmarkWidget extends WP_Widget {
} ?> } ?>
<script type="text/javascript"> <script type="text/javascript">
(function() { (function() {
ComicBookmark.setup('<?php echo $id ?>', '<?php echo $instance['mode'] ?>', '<?php echo $link ?>', { ComicBookmark.setup('<?php echo $id ?>', '<?php echo $mode ?>', '<?php echo $link ?>', {
<?php <?php
$elements = array(); $elements = array();
foreach (array_keys($this->text_fields[$instance['mode']]) as $field) { foreach (array_keys($this->text_fields[$mode]) as $field) {
$elements[] = "'{$field}': '{$instance[$field]}'"; $elements[] = "'{$field}': '{$instance[$field]}'";
} }
echo implode(',', $elements); echo implode(',', $elements);

View File

@ -13,7 +13,7 @@ class BuyThisPrintWidget extends WP_Widget {
function BuyThisPrintWidget($skip_widget_init = false) { function BuyThisPrintWidget($skip_widget_init = false) {
if (!$skip_widget_init) { if (!$skip_widget_init) {
$widget_ops = array('classname' => __CLASS__, 'description' => __('Adds a button that goes to the buy print template page.','comicpress') ); $widget_ops = array('classname' => __CLASS__, 'description' => __('Adds a button that goes to the buy print template page.','comicpress') );
$this->WP_Widget(__CLASS__, __('Buy This Print','comicpress'), $widget_ops); $this->WP_Widget(__CLASS__, __('ComicPress Buy This Print','comicpress'), $widget_ops);
} }
} }

View File

@ -14,7 +14,7 @@ class GraphicalNavigationWidget extends WP_Widget {
function GraphicalNavigationWidget($skip_widget_init = false) { function GraphicalNavigationWidget($skip_widget_init = false) {
if (!$skip_widget_init) { if (!$skip_widget_init) {
$widget_ops = array('classname' => __CLASS__, 'description' => __('Displays Graphical Navigation Buttons. (used in comic sidebars)','comicpress') ); $widget_ops = array('classname' => __CLASS__, 'description' => __('Displays Graphical Navigation Buttons. (used in comic sidebars)','comicpress') );
$this->WP_Widget(__CLASS__, __('Comic Navigation','comicpress'), $widget_ops); $this->WP_Widget(__CLASS__, __('ComicPress Comic Navigation','comicpress'), $widget_ops);
} }
} }

View File

@ -1,128 +1,3 @@
<?php <?php
/* // depreciated
Widget Name: Menubar
Widget URI: http://comicpress.org/
Description: Display a calendar of this months posts.
Author: Philip M. Hofer (Frumph)
Version: 1.05
Author URI: http://frumph.net/
*/
function comicpress_menubar() {
global $comicpress_options;
if (comicpress_check_child_file('menubar') == false) {
if (file_exists(get_stylesheet_directory() . '/custom-menubar.php')) {
include(get_stylesheet_directory() . '/custom-menubar.php');
} else { ?>
<div id="menubar">
<div id="menunav">
<?php if ($comicpress_options['enable_search_in_menubar']) { ?>
<div class="menunav-search"><?php include(get_template_directory() . '/searchform.php'); ?></div>
<?php } ?>
<?php if ($comicpress_options['enable_rss_in_menubar']) { ?>
<a href="<?php bloginfo('rss2_url') ?>" title="RSS Feed" class="menunav-rss">RSS</a>
<?php } ?>
<?php if ($comicpress_options['enable_navigation_in_menubar']) { ?>
<?php if (is_home()) {
$comicFrontpage = new WP_Query(); $comicFrontpage->query('showposts=1&cat='.get_all_comic_categories_as_cat_string());
while ($comicFrontpage->have_posts()) : $comicFrontpage->the_post();
global $wp_query; $wp_query->is_single = true; ?>
<div class="menunav-prev">
<?php previous_comic_link('%link', '&lsaquo;'); ?>
</div>
<?php $wp_query->is_single = false;
endwhile;
} elseif (is_single() & in_comic_category()) { ?>
<div class="menunav-prev">
<?php previous_comic_link('%link', '&lsaquo;'); ?>
</div>
<div class="menunav-next">
<?php next_comic_link('%link', '&rsaquo;'); ?>
</div>
<?php } ?>
<?php } ?>
</div>
<?php
$linkcatid = get_term_by('name','menubar','link_category');
$linkcatid = $linkcatid->term_id;
$menulinks = wp_list_bookmarks('echo=0&title_li=&categorize=0&title_before=&title_after=&category_name=menubar');
$menulinks = preg_replace('#<li ([^>]*)>#', '<li class="page-item link">', $menulinks);
$menulinks = preg_replace('#<ul ([^>]*)>#', '', $menulinks);
$menulinks = str_replace('</ul>', '', $menulinks);
if ($comicpress_options['enable_blogroll_off_links']) {
$bookmarks = wp_list_bookmarks('echo=0&title_li=&categorize=1&title_before=&title_after=&exclude_category='.$linkcatid);
$bookmarks = preg_replace('#<li ([^>]*)>#', '<li class="page-item link">', $bookmarks);
$bookmarks = preg_replace('#<ul ([^>]*)>#', '<ul>', $bookmarks);
}
$listpages = '';
if (!$comicpress_options['disable_dynamic_menubar_links']) {
$listpages = wp_list_pages('echo=0&sort_column=menu_order&depth=4&title_li=');
}
if (!empty($bookmarks) && $comicpress_options['enable_blogroll_off_links']) {
$listpages = str_replace('Links</a></li>', 'Links</a>
<ul>
'.$bookmarks.'
</ul>
</li>
', $listpages);
}
$listpages .= $menulinks;
?>
<ul id="menu">
<li class="page_item page-item-home<?php if (is_home()) { ?> current_page_item<?php } ?>"><a href="<?php bloginfo('url'); ?>">Home</a></li>
<?php echo $listpages; ?>
<?php if ($comicpress_options['contact_in_menubar']) { ?>
<li class="page_item page-item-contact"><a href="mailto:<?php bloginfo('admin_email'); ?>">Contact</a></li>
<?php } ?>
</ul>
<div class="clear"></div>
</div>
<?php }
}
}
class widget_comicpress_menubar extends WP_Widget {
function widget_comicpress_menubar() {
$widget_ops = array('classname' => 'widget_comicpress_menubar', 'description' => __('Displays a menubar.','comicpress') );
$this->WP_Widget('comicpress_menubar', __('Comicpress Menubar','comicpress'), $widget_ops);
}
function widget($args, $instance) {
global $post;
extract($args, EXTR_SKIP);
echo $before_widget;
$title = empty($instance['title']) ? '' : apply_filters('widget_title', $instance['title']);
if ( !empty( $title ) ) { echo $before_title . $title . $after_title; };
comicpress_menubar();
echo $after_widget;
}
function update($new_instance, $old_instance) {
$instance = $old_instance;
$instance['title'] = strip_tags($new_instance['title']);
return $instance;
}
function form($instance) {
$instance = wp_parse_args( (array) $instance, array( 'title' => '' ) );
$title = strip_tags($instance['title']);
?>
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:','comicpress'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo attribute_escape($title); ?>" /></label></p>
<?php
}
}
register_widget('widget_comicpress_menubar');
function widget_comicpress_menubar_init() {
new widget_comicpress_menubar();
}
add_action('widgets_init', 'widget_comicpress_menubar_init');
?> ?>