start work on cleaning up widgets

This commit is contained in:
John Bintz 2009-11-21 10:24:01 -05:00
parent 7e4a5de392
commit f2129728ad
2 changed files with 66 additions and 52 deletions

View File

@ -5,10 +5,21 @@ if (function_exists('add_theme_support')) {
add_theme_support( 'post-thumbnails' );
}
// Queue up the scripts.
wp_enqueue_script('comicpress_scroll', get_template_directory_uri() . '/js/scroll.js');
function __comicpress_widgets_init() {
if (($dh = opendir(dirname(__FILE__) . '/widgets')) !== false) {
while (($file = readdir($dh)) !== false) {
if (strpos($file, '.inc') !== false) {
$class_name = preg_replace('#\..*$#', '', $file);
require_once(dirname(__FILE__) . '/widgets/' . $file);
$widget = new $class_name();
if (method_exists($widget, 'init')) { $widget->init(); }
}
}
closedir($dh);
}
}
function init_language(){
function __comicpress_init() {
// xili-language plugin check
if (class_exists('xili_language')) {
define('THEME_TEXTDOMAIN','comicpress');
@ -16,14 +27,19 @@ function init_language(){
} else {
load_theme_textdomain( 'comicpress', get_template_directory() . '/lang' );
}
}
add_action ('init', 'init_language');
// remove intense debates control over the comment numbers
if (function_exists('id_get_comment_number')) {
remove_filter('comments_number','id_get_comment_number');
// Queue up the scripts.
wp_enqueue_script('comicpress_scroll', get_template_directory_uri() . '/js/scroll.js');
// remove intense debates control over the comment numbers
if (function_exists('id_get_comment_number')) {
remove_filter('comments_number','id_get_comment_number');
}
}
add_action('widgets_init', '__comicpress_widgets_init');
add_action('init', '__comicpress_init');
$comicpress_version = '2.9.0.0';
global $wpmu_version;

View File

@ -1,11 +1,9 @@
<?php
class ComicPressAddonBookmarkWidget {
function init($comicpress) {
class BookmarkWidget {
function init() {
wp_register_sidebar_widget('comic-bookmark', __('Comic Bookmark', 'comicpress'), array(&$this, 'render_widget'), array('description' => __('Let your readers save their place via a cookie.', 'comicpress')));
$this->comicpress = $comicpress;
add_action('wp_head', array(&$this, 'wp_head'));
wp_enqueue_script('prototype');