Permalink
Browse files

Getting Hybrid Core on this Git thing.

  • Loading branch information...
0 parents commit 07779cf6635f7a45d090c90ff368c48deac44c2a @justintadlock committed Jun 4, 2012
Showing with 12,717 additions and 0 deletions.
  1. +132 −0 admin/admin.php
  2. +128 −0 admin/meta-box-post-seo.php
  3. +133 −0 admin/meta-box-post-template.php
  4. +94 −0 admin/meta-box-theme-about.php
  5. +74 −0 admin/meta-box-theme-footer.php
  6. +300 −0 admin/theme-settings.php
  7. +206 −0 classes/widget-archives.php
  8. +211 −0 classes/widget-authors.php
  9. +326 −0 classes/widget-bookmarks.php
  10. +120 −0 classes/widget-calendar.php
  11. +287 −0 classes/widget-categories.php
  12. +205 −0 classes/widget-nav-menu.php
  13. +275 −0 classes/widget-pages.php
  14. +171 −0 classes/widget-search.php
  15. +307 −0 classes/widget-tags.php
  16. +1 −0 css/18px.css
  17. +308 −0 css/18px.dev.css
  18. +1 −0 css/20px.css
  19. +308 −0 css/20px.dev.css
  20. +1 −0 css/21px.css
  21. +308 −0 css/21px.dev.css
  22. +1 −0 css/22px.css
  23. +308 −0 css/22px.dev.css
  24. +1 −0 css/24px.css
  25. +308 −0 css/24px.dev.css
  26. +1 −0 css/25px.css
  27. +308 −0 css/25px.dev.css
  28. +5 −0 css/2c-l-fixed.css
  29. +5 −0 css/2c-r-fixed.css
  30. +5 −0 css/3c-c-fixed.css
  31. +5 −0 css/3c-l-fixed.css
  32. +5 −0 css/3c-r-fixed.css
  33. +1 −0 css/admin.css
  34. +76 −0 css/admin.dev.css
  35. +1 −0 css/drop-downs.css
  36. +64 −0 css/drop-downs.dev.css
  37. +1 −0 css/gallery.css
  38. +68 −0 css/gallery.dev.css
  39. +5 −0 css/holy-grail-fluid.css
  40. +1 −0 css/nav-bar.css
  41. +83 −0 css/nav-bar.dev.css
  42. +5 −0 css/plugins.css
  43. +1 −0 css/reset.css
  44. +27 −0 css/reset.dev.css
  45. +5 −0 css/screen.css
  46. +687 −0 extensions/breadcrumb-trail.php
  47. +88 −0 extensions/cleaner-caption.php
  48. +166 −0 extensions/cleaner-gallery.php
  49. +270 −0 extensions/custom-field-series.php
  50. +194 −0 extensions/entry-views.php
  51. +544 −0 extensions/get-the-image.php
  52. +107 −0 extensions/loop-pagination.php
  53. +327 −0 extensions/post-stylesheets.php
  54. +553 −0 extensions/theme-layouts.php
  55. +233 −0 functions/comments.php
  56. +468 −0 functions/context.php
  57. +244 −0 functions/core-seo.php
  58. +216 −0 functions/core.php
  59. +575 −0 functions/deprecated.php
  60. +209 −0 functions/i18n.php
  61. +247 −0 functions/media.php
  62. +49 −0 functions/menus.php
  63. +66 −0 functions/meta.php
  64. +87 −0 functions/settings.php
  65. +474 −0 functions/shortcodes.php
  66. +114 −0 functions/sidebars.php
  67. +211 −0 functions/template-hierarchy.php
  68. +199 −0 functions/utility.php
  69. +113 −0 functions/widgets.php
  70. +348 −0 hybrid.php
  71. BIN images/pingback.png
  72. BIN images/trackback.png
  73. +248 −0 js/drop-downs.dev.js
  74. +1 −0 js/drop-downs.js
  75. +153 −0 js/nav-bar.dev.js
  76. +1 −0 js/nav-bar.js
  77. +339 −0 license.txt
132 admin/admin.php
@@ -0,0 +1,132 @@
+<?php
+/**
+ * Theme administration functions used with other components of the framework admin. This file is for
+ * setting up any basic features and holding additional admin helper functions.
+ *
+ * @package HybridCore
+ * @subpackage Admin
+ * @author Justin Tadlock <justin@justintadlock.com>
+ * @copyright Copyright (c) 2008 - 2012, Justin Tadlock
+ * @link http://themehybrid.com/hybrid-core
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+ */
+
+/* Add the admin setup function to the 'admin_menu' hook. */
+add_action( 'admin_menu', 'hybrid_admin_setup' );
+
+/**
+ * Sets up the adminstration functionality for the framework and themes.
+ *
+ * @since 1.3.0
+ * @return void
+ */
+function hybrid_admin_setup() {
+
+ /* Load the post meta boxes on the new post and edit post screens. */
+ add_action( 'load-post.php', 'hybrid_admin_load_post_meta_boxes' );
+ add_action( 'load-post-new.php', 'hybrid_admin_load_post_meta_boxes' );
+
+ /* Registers admin stylesheets for the framework. */
+ add_action( 'admin_enqueue_scripts', 'hybrid_admin_register_styles', 1 );
+
+ /* Loads admin stylesheets for the framework. */
+ add_action( 'admin_enqueue_scripts', 'hybrid_admin_enqueue_styles' );
+}
+
+/**
+ * Loads the core post meta box files on the 'load-post.php' action hook. Each meta box file is only loaded if
+ * the theme declares support for the feature.
+ *
+ * @since 1.2.0
+ * @return void
+ */
+function hybrid_admin_load_post_meta_boxes() {
+
+ /* Load the SEO post meta box. */
+ require_if_theme_supports( 'hybrid-core-seo', trailingslashit( HYBRID_ADMIN ) . 'meta-box-post-seo.php' );
+
+ /* Load the post template meta box. */
+ require_if_theme_supports( 'hybrid-core-template-hierarchy', trailingslashit( HYBRID_ADMIN ) . 'meta-box-post-template.php' );
+}
+
+/**
+ * Registers the framework's 'admin.css' stylesheet file. The function does not load the stylesheet. It merely
+ * registers it with WordPress.
+ *
+ * @since 1.2.0
+ * @return void
+ */
+function hybrid_admin_register_styles() {
+ wp_register_style( 'hybrid-core-admin', trailingslashit( HYBRID_CSS ) . 'admin.css', false, '20110512', 'screen' );
+}
+
+/**
+ * Loads the admin.css stylesheet for admin-related features.
+ *
+ * @since 1.2.0
+ * @return void
+ */
+function hybrid_admin_enqueue_styles( $hook_suffix ) {
+
+ /* Load admin styles if on the widgets screen and the current theme supports 'hybrid-core-widgets'. */
+ if ( current_theme_supports( 'hybrid-core-widgets' ) && 'widgets.php' == $hook_suffix )
+ wp_enqueue_style( 'hybrid-core-admin' );
+}
+
+/**
+ * Function for getting an array of available custom templates with a specific header. Ideally, this function
+ * would be used to grab custom singular post (any post type) templates. It is a recreation of the WordPress
+ * page templates function because it doesn't allow for other types of templates.
+ *
+ * @since 0.7.0
+ * @param array $args Arguments to check the templates against.
+ * @return array $post_templates The array of templates.
+ */
+function hybrid_get_post_templates( $args = array() ) {
+
+ /* Parse the arguments with the defaults. */
+ $args = wp_parse_args( $args, array( 'label' => array( 'Post Template' ) ) );
+
+ /* Get theme and templates variables. */
+ $themes = get_themes();
+ $theme = get_current_theme();
+ $templates = $themes[$theme]['Template Files'];
+ $post_templates = array();
+
+ /* If there's an array of templates, loop through each template. */
+ if ( is_array( $templates ) ) {
+
+ /* Set up a $base path that we'll use to remove from the file name. */
+ $base = array( trailingslashit( get_template_directory() ), trailingslashit( get_stylesheet_directory() ) );
+
+ /* Loop through the post templates. */
+ foreach ( $templates as $template ) {
+
+ /* Remove the base (parent/child theme path) from the template file name. */
+ $basename = str_replace( $base, '', $template );
+
+ /* Get the template data. */
+ $template_data = implode( '', file( $template ) );
+
+ /* Make sure the name is set to an empty string. */
+ $name = '';
+
+ /* Loop through each of the potential labels and see if a match is found. */
+ foreach ( $args['label'] as $label ) {
+ if ( preg_match( "|{$label}:(.*)$|mi", $template_data, $name ) ) {
+ $name = _cleanup_header_comment( $name[1] );
+ break;
+ }
+ }
+
+ /* If a post template was found, add its name and file name to the $post_templates array. */
+ if ( !empty( $name ) )
+ $post_templates[trim( $name )] = $basename;
+ }
+ }
+
+ /* Return array of post templates. */
+ return $post_templates;
+}
+
+?>
128 admin/meta-box-post-seo.php
@@ -0,0 +1,128 @@
+<?php
+/**
+ * Adds the SEO meta box to the post editing screen for public post types. This feature allows the post author
+ * to set a custom title, description, and keywords for the post, which will be viewed on the singular post page.
+ * To use this feature, the theme must support the 'hybrid-core-seo' feature. The functions in this file create
+ * the SEO meta box and save the settings chosen by the user when the post is saved.
+ *
+ * @package HybridCore
+ * @subpackage Admin
+ * @author Justin Tadlock <justin@justintadlock.com>
+ * @copyright Copyright (c) 2008 - 2012, Justin Tadlock
+ * @link http://themehybrid.com/hybrid-core
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+ */
+
+/* Add the post SEO meta box on the 'add_meta_boxes' hook. */
+add_action( 'add_meta_boxes', 'hybrid_meta_box_post_add_seo', 10, 2 );
+add_action( 'add_meta_boxes', 'hybrid_meta_box_post_remove_seo', 10, 2 );
+
+/* Save the post SEO meta box data on the 'save_post' hook. */
+add_action( 'save_post', 'hybrid_meta_box_post_save_seo', 10, 2 );
+
+/**
+ * Adds the post SEO meta box for all public post types.
+ *
+ * @since 1.2.0
+ * @param string $post_type The post type of the current post being edited.
+ * @param object $post The current post being edited.
+ * @return void
+ */
+function hybrid_meta_box_post_add_seo( $post_type, $post ) {
+
+ $post_type_object = get_post_type_object( $post_type );
+
+ /* Only add meta box if current user can edit, add, or delete meta for the post. */
+ if ( ( true === $post_type_object->public ) && ( current_user_can( 'edit_post_meta', $post->ID ) || current_user_can( 'add_post_meta', $post->ID ) || current_user_can( 'delete_post_meta', $post->ID ) ) )
+ add_meta_box( 'hybrid-core-post-seo', __( 'SEO', 'hybrid-core' ), 'hybrid_meta_box_post_display_seo', $post_type, 'normal', 'high' );
+}
+
+/**
+ * Remove the meta box from some post types.
+ *
+ * @since 1.3.0
+ * @param string $post_type The post type of the current post being edited.
+ * @param object $post The current post being edited.
+ * @return void
+ */
+function hybrid_meta_box_post_remove_seo( $post_type, $post ) {
+
+ /* Removes post stylesheets support of the bbPress 'topic' post type. */
+ if ( function_exists( 'bbp_get_topic_post_type' ) && bbp_get_topic_post_type() == $post_type )
+ remove_meta_box( 'hybrid-core-post-seo', bbp_get_topic_post_type(), 'normal' );
+
+ /* Removes post stylesheets support of the bbPress 'reply' post type. */
+ elseif ( function_exists( 'bbp_get_reply_post_type' ) && bbp_get_reply_post_type() == $post_type )
+ remove_meta_box( 'hybrid-core-post-seo', bbp_get_reply_post_type(), 'normal' );
+}
+
+/**
+ * Displays the post SEO meta box.
+ *
+ * @since 1.2.0
+ * @return void
+ */
+function hybrid_meta_box_post_display_seo( $object, $box ) {
+
+ wp_nonce_field( basename( __FILE__ ), 'hybrid-core-post-seo' ); ?>
+
+ <p>
+ <label for="hybrid-document-title"><?php _e( 'Document Title:', 'hybrid-core' ); ?></label>
+ <br />
+ <input type="text" name="hybrid-document-title" id="hybrid-document-title" value="<?php echo esc_attr( get_post_meta( $object->ID, 'Title', true ) ); ?>" size="30" tabindex="30" style="width: 99%;" />
+ </p>
+
+ <p>
+ <label for="hybrid-meta-description"><?php _e( 'Meta Description:', 'hybrid-core' ); ?></label>
+ <br />
+ <textarea name="hybrid-meta-description" id="hybrid-meta-description" cols="60" rows="2" tabindex="30" style="width: 99%;"><?php echo esc_textarea( get_post_meta( $object->ID, 'Description', true ) ); ?></textarea>
+ </p>
+
+ <p>
+ <label for="hybrid-meta-keywords"><?php _e( 'Meta Keywords:', 'hybrid-core' ); ?></label>
+ <br />
+ <input type="text" name="hybrid-meta-keywords" id="hybrid-meta-keywords" value="<?php echo esc_attr( get_post_meta( $object->ID, 'Keywords', true ) ); ?>" size="30" tabindex="30" style="width: 99%;" />
+ </p>
+<?php }
+
+/**
+ * Saves the post SEO meta box settings as post metadata.
+ *
+ * @since 1.2.0
+ * @param int $post_id The ID of the current post being saved.
+ * @param int $post The post object currently being saved.
+ */
+function hybrid_meta_box_post_save_seo( $post_id, $post ) {
+
+ $prefix = hybrid_get_prefix();
+
+ /* Verify the nonce before proceeding. */
+ if ( !isset( $_POST['hybrid-core-post-seo'] ) || !wp_verify_nonce( $_POST['hybrid-core-post-seo'], basename( __FILE__ ) ) )
+ return $post_id;
+
+ $meta = array(
+ 'Title' => $_POST['hybrid-document-title'],
+ 'Description' => $_POST['hybrid-meta-description'],
+ 'Keywords' => $_POST['hybrid-meta-keywords']
+ );
+
+ foreach ( $meta as $meta_key => $new_meta_value ) {
+
+ /* Get the meta value of the custom field key. */
+ $meta_value = get_post_meta( $post_id, $meta_key, true );
+
+ /* If there is no new meta value but an old value exists, delete it. */
+ if ( current_user_can( 'delete_post_meta', $post_id, $meta_key ) && '' == $new_meta_value && $meta_value )
+ delete_post_meta( $post_id, $meta_key, $meta_value );
+
+ /* If a new meta value was added and there was no previous value, add it. */
+ elseif ( current_user_can( 'add_post_meta', $post_id, $meta_key ) && $new_meta_value && '' == $meta_value )
+ add_post_meta( $post_id, $meta_key, $new_meta_value, true );
+
+ /* If the new meta value does not match the old value, update it. */
+ elseif ( current_user_can( 'edit_post_meta', $post_id, $meta_key ) && $new_meta_value && $new_meta_value != $meta_value )
+ update_post_meta( $post_id, $meta_key, $new_meta_value );
+ }
+}
+
+?>
133 admin/meta-box-post-template.php
@@ -0,0 +1,133 @@
+<?php
+/**
+ * Adds the template meta box to the post editing screen for public post types. This feature allows users and
+ * devs to create custom templates for any post type, not just pages as default in WordPress core. The
+ * functions in this file create the template meta box and save the template chosen by the user when the
+ * post is saved. This file is only used if the theme supports the 'hybrid-core-template-hierarchy' feature.
+ *
+ * @package HybridCore
+ * @subpackage Admin
+ * @author Justin Tadlock <justin@justintadlock.com>
+ * @copyright Copyright (c) 2008 - 2012, Justin Tadlock
+ * @link http://themehybrid.com/hybrid-core
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+ */
+
+/* Add the post template meta box on the 'add_meta_boxes' hook. */
+add_action( 'add_meta_boxes', 'hybrid_meta_box_post_add_template', 10, 2 );
+add_action( 'add_meta_boxes', 'hybrid_meta_box_post_remove_template', 10, 2 );
+
+/* Save the post template meta box data on the 'save_post' hook. */
+add_action( 'save_post', 'hybrid_meta_box_post_save_template', 10, 2 );
+
+/**
+ * Adds the post template meta box for all public post types, excluding the 'page' post type since WordPress
+ * core already handles page templates.
+ *
+ * @since 1.2.0
+ * @return void
+ */
+function hybrid_meta_box_post_add_template( $post_type, $post ) {
+
+ $post_type_object = get_post_type_object( $post_type );
+
+ /* Only add meta box if current user can edit, add, or delete meta for the post. */
+ if ( ( true === $post_type_object->public ) && ( current_user_can( 'edit_post_meta', $post->ID ) || current_user_can( 'add_post_meta', $post->ID ) || current_user_can( 'delete_post_meta', $post->ID ) ) )
+ add_meta_box( 'hybrid-core-post-template', __( 'Template', 'hybrid-core' ), 'hybrid_meta_box_post_display_template', $post_type, 'side', 'default' );
+}
+
+/**
+ * Remove the meta box from some post types.
+ *
+ * @since 1.3.0
+ * @param string $post_type The post type of the current post being edited.
+ * @param object $post The current post being edited.
+ * @return void
+ */
+function hybrid_meta_box_post_remove_template( $post_type, $post ) {
+
+ /* Removes meta box from pages since this is a built-in WordPress feature. */
+ if ( 'page' == $post_type )
+ remove_meta_box( 'hybrid-core-post-template', 'page', 'side' );
+
+ /* Removes meta box from the bbPress 'topic' post type. */
+ elseif ( function_exists( 'bbp_get_topic_post_type' ) && bbp_get_topic_post_type() == $post_type )
+ remove_meta_box( 'hybrid-core-post-template', bbp_get_topic_post_type(), 'side' );
+
+ /* Removes meta box from the bbPress 'reply' post type. */
+ elseif ( function_exists( 'bbp_get_reply_post_type' ) && bbp_get_reply_post_type() == $post_type )
+ remove_meta_box( 'hybrid-core-post-template', bbp_get_reply_post_type(), 'side' );
+}
+
+/**
+ * Displays the post template meta box.
+ *
+ * @since 1.2.0
+ * @return void
+ */
+function hybrid_meta_box_post_display_template( $object, $box ) {
+
+ /* Get the post type object. */
+ $post_type_object = get_post_type_object( $object->post_type );
+
+ /* Get a list of available custom templates for the post type. */
+ $templates = hybrid_get_post_templates( array( 'label' => array( "{$post_type_object->labels->singular_name} Template", "{$post_type_object->name} Template" ) ) );
+
+ wp_nonce_field( basename( __FILE__ ), 'hybrid-core-post-meta-box-template' ); ?>
+
+ <p>
+ <?php if ( 0 != count( $templates ) ) { ?>
+ <select name="hybrid-post-template" id="hybrid-post-template" class="widefat">
+ <option value=""></option>
+ <?php foreach ( $templates as $label => $template ) { ?>
+ <option value="<?php echo esc_attr( $template ); ?>" <?php selected( esc_attr( get_post_meta( $object->ID, "_wp_{$post_type_object->name}_template", true ) ), esc_attr( $template ) ); ?>><?php echo esc_html( $label ); ?></option>
+ <?php } ?>
+ </select>
+ <?php } else { ?>
+ <?php _e( 'No templates exist for this post type.', 'hybrid-core' ); ?>
+ <?php } ?>
+ </p>
+<?php
+}
+
+/**
+ * Saves the post template meta box settings as post metadata.
+ *
+ * @since 1.2.0
+ * @param int $post_id The ID of the current post being saved.
+ * @param int $post The post object currently being saved.
+ * @return void|int
+ */
+function hybrid_meta_box_post_save_template( $post_id, $post ) {
+
+ /* Verify the nonce before proceeding. */
+ if ( !isset( $_POST['hybrid-core-post-meta-box-template'] ) || !wp_verify_nonce( $_POST['hybrid-core-post-meta-box-template'], basename( __FILE__ ) ) )
+ return $post_id;
+
+ /* Return here if the template is not set. There's a chance it won't be if the post type doesn't have any templates. */
+ if ( !isset( $_POST['hybrid-post-template'] ) )
+ return $post_id;
+
+ /* Get the posted meta value. */
+ $new_meta_value = $_POST['hybrid-post-template'];
+
+ /* Set the $meta_key variable based off the post type name. */
+ $meta_key = "_wp_{$post->post_type}_template";
+
+ /* Get the meta value of the meta key. */
+ $meta_value = get_post_meta( $post_id, $meta_key, true );
+
+ /* If there is no new meta value but an old value exists, delete it. */
+ if ( current_user_can( 'delete_post_meta', $post_id ) && '' == $new_meta_value && $meta_value )
+ delete_post_meta( $post_id, $meta_key, $meta_value );
+
+ /* If a new meta value was added and there was no previous value, add it. */
+ elseif ( current_user_can( 'add_post_meta', $post_id, $meta_key ) && $new_meta_value && '' == $meta_value )
+ add_post_meta( $post_id, $meta_key, $new_meta_value, true );
+
+ /* If the new meta value does not match the old value, update it. */
+ elseif ( current_user_can( 'edit_post_meta', $post_id ) && $new_meta_value && $new_meta_value != $meta_value )
+ update_post_meta( $post_id, $meta_key, $new_meta_value );
+}
+
+?>
94 admin/meta-box-theme-about.php
@@ -0,0 +1,94 @@
+<?php
+/**
+ * Creates a meta box for the theme settings page, which displays information about the theme. If a child
+ * theme is in use, an additional meta box will be added with its information. To use this feature, the theme
+ * must support the 'about' argument for 'hybrid-core-theme-settings' feature.
+ *
+ * @package HybridCore
+ * @subpackage Admin
+ * @author Justin Tadlock <justin@justintadlock.com>
+ * @copyright Copyright (c) 2008 - 2012, Justin Tadlock
+ * @link http://themehybrid.com/hybrid-core
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+ */
+
+/* Create the about theme meta box on the 'add_meta_boxes' hook. */
+add_action( 'add_meta_boxes', 'hybrid_meta_box_theme_add_about' );
+
+/**
+ * Adds the core about theme meta box to the theme settings page.
+ *
+ * @since 1.2.0
+ * @return void
+ */
+function hybrid_meta_box_theme_add_about() {
+
+ /* Get theme information. */
+ $prefix = hybrid_get_prefix();
+ $theme_data = hybrid_get_theme_data();
+
+ /* Adds the About box for the parent theme. */
+ add_meta_box( 'hybrid-core-about-theme', sprintf( __( 'About %1$s', 'hybrid-core' ), $theme_data['Title'] ), 'hybrid_meta_box_theme_display_about', hybrid_get_settings_page_name(), 'side', 'high' );
+
+ /* If the user is using a child theme, add an About box for it. */
+ if ( is_child_theme() ) {
+ $child_data = hybrid_get_theme_data( 'stylesheet' );
+ add_meta_box( 'hybrid-core-about-child', sprintf( __( 'About %1$s', 'hybrid-core' ), $child_data['Title'] ), 'hybrid_meta_box_theme_display_about', hybrid_get_settings_page_name(), 'side', 'high' );
+ }
+}
+
+/**
+ * Creates an information meta box with no settings about the theme. The meta box will display
+ * information about both the parent theme and child theme. If a child theme is active, this function
+ * will be called a second time.
+ *
+ * @since 1.2.0
+ * @param object $object Variable passed through the do_meta_boxes() call.
+ * @param array $box Specific information about the meta box being loaded.
+ * @return void
+ */
+function hybrid_meta_box_theme_display_about( $object, $box ) {
+
+ /* Get theme information. */
+ $prefix = hybrid_get_prefix();
+
+ /* Grab theme information for the parent/child theme. */
+ $theme_data = ( ( 'hybrid-core-about-child' == $box['id'] ) ? hybrid_get_theme_data( 'stylesheet' ) : hybrid_get_theme_data() ); ?>
+
+ <table class="form-table">
+ <tr>
+ <th>
+ <?php _e( 'Theme:', 'hybrid-core' ); ?>
+ </th>
+ <td>
+ <a href="<?php echo $theme_data['URI']; ?>" title="<?php echo $theme_data['Title']; ?>"><?php echo $theme_data['Title']; ?></a>
+ </td>
+ </tr>
+ <tr>
+ <th>
+ <?php _e( 'Version:', 'hybrid-core' ); ?>
+ </th>
+ <td>
+ <?php echo $theme_data['Version']; ?>
+ </td>
+ </tr>
+ <tr>
+ <th>
+ <?php _e( 'Author:', 'hybrid-core' ); ?>
+ </th>
+ <td>
+ <?php echo $theme_data['Author']; ?>
+ </td>
+ </tr>
+ <tr>
+ <th>
+ <?php _e( 'Description:', 'hybrid-core' ); ?>
+ </th>
+ <td>
+ <?php echo $theme_data['Description']; ?>
+ </td>
+ </tr>
+ </table><!-- .form-table --><?php
+}
+
+?>
74 admin/meta-box-theme-footer.php
@@ -0,0 +1,74 @@
+<?php
+/**
+ * Creates a meta box for the theme settings page, which holds a textarea for custom footer text within
+ * the theme. To use this feature, the theme must support the 'footer' argument for the
+ * 'hybrid-core-theme-settings' feature.
+ *
+ * @package HybridCore
+ * @subpackage Admin
+ * @author Justin Tadlock <justin@justintadlock.com>
+ * @copyright Copyright (c) 2008 - 2012, Justin Tadlock
+ * @link http://themehybrid.com/hybrid-core
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+ */
+
+/* Create the footer meta box on the 'add_meta_boxes' hook. */
+add_action( 'add_meta_boxes', 'hybrid_meta_box_theme_add_footer' );
+
+/* Sanitize the footer settings before adding them to the database. */
+add_filter( 'sanitize_option_' . hybrid_get_prefix() . '_theme_settings', 'hybrid_meta_box_theme_save_footer' );
+
+/**
+ * Adds the core theme footer meta box to the theme settings page in the admin.
+ *
+ * @since 1.2.0
+ * @return void
+ */
+function hybrid_meta_box_theme_add_footer() {
+
+ add_meta_box( 'hybrid-core-footer', __( 'Footer settings', 'hybrid-core' ), 'hybrid_meta_box_theme_display_footer', hybrid_get_settings_page_name(), 'normal', 'high' );
+}
+
+/**
+ * Creates a meta box that allows users to customize their footer.
+ *
+ * @since 1.2.0
+ * @uses wp_editor() Creates an instance of the WordPress text/content editor.
+ * @return void
+ */
+function hybrid_meta_box_theme_display_footer() {
+
+ /* Add a textarea using the wp_editor() function to make it easier on users to add custom content. */
+ wp_editor(
+ esc_textarea( hybrid_get_setting( 'footer_insert' ) ), // Editor content.
+ hybrid_settings_field_id( 'footer_insert' ), // Editor ID.
+ array(
+ 'tinymce' => false, // Don't use TinyMCE in a meta box.
+ 'textarea_name' => hybrid_settings_field_name( 'footer_insert' )
+ )
+ ); ?>
+
+ <p>
+ <span class="description"><?php _e( 'You can add custom <acronym title="Hypertext Markup Language">HTML</acronym> and/or shortcodes, which will be automatically inserted into your theme.', 'hybrid-core' ); ?></span>
+ </p>
+
+<?php }
+
+/**
+ * Saves the footer meta box settings by filtering the "sanitize_option_{$prefix}_theme_settings" hook.
+ *
+ * @since 1.2.0
+ * @param array $settings Array of theme settings passed by the Settings API for validation.
+ * @return array $settings
+ */
+function hybrid_meta_box_theme_save_footer( $settings ) {
+
+ /* Make sure we kill evil scripts from users without the 'unfiltered_html' cap. */
+ if ( isset( $settings['footer_insert'] ) && !current_user_can( 'unfiltered_html' ) )
+ $settings['footer_insert'] = stripslashes( wp_filter_post_kses( addslashes( $settings['footer_insert'] ) ) );
+
+ /* Return the theme settings. */
+ return $settings;
+}
+
+?>
300 admin/theme-settings.php
@@ -0,0 +1,300 @@
+<?php
+/**
+ * Handles the display and functionality of the theme settings page. This provides the needed hooks and
+ * meta box calls for developers to create any number of theme settings needed. This file is only loaded if
+ * the theme supports the 'hybrid-core-theme-settings' feature.
+ *
+ * Provides the ability for developers to add custom meta boxes to the theme settings page by using the
+ * add_meta_box() function. Developers should register their meta boxes on the 'add_meta_boxes' hook
+ * and register the meta box for 'appearance_page_theme-settings'. To validate/sanitize data from
+ * custom settings, devs should use the 'sanitize_option_{$prefix}_theme_settings' filter hook.
+ *
+ * @package HybridCore
+ * @subpackage Admin
+ * @author Justin Tadlock <justin@justintadlock.com>
+ * @copyright Copyright (c) 2008 - 2012, Justin Tadlock
+ * @link http://themehybrid.com/hybrid-core
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+ */
+
+/* Hook the settings page function to 'admin_menu'. */
+add_action( 'admin_menu', 'hybrid_settings_page_init' );
+
+/**
+ * Initializes all the theme settings page functionality. This function is used to create the theme settings
+ * page, then use that as a launchpad for specific actions that need to be tied to the settings page.
+ *
+ * @since 0.7.0
+ * @global string $hybrid The global theme object.
+ * @return void
+ */
+function hybrid_settings_page_init() {
+ global $hybrid;
+
+ /* Get theme information. */
+ $theme = hybrid_get_theme_data();
+ $prefix = hybrid_get_prefix();
+
+ /* Register theme settings. */
+ register_setting(
+ "{$prefix}_theme_settings", // Options group.
+ "{$prefix}_theme_settings", // Database option.
+ 'hybrid_save_theme_settings' // Validation callback function.
+ );
+
+ /* Create the theme settings page. */
+ $hybrid->settings_page = add_theme_page(
+ sprintf( esc_html__( '%1$s Theme Settings', 'hybrid-core' ), $theme['Name'] ), // Settings page name.
+ esc_html__( 'Theme Settings', 'hybrid-core' ), // Menu item name.
+ hybrid_settings_page_capability(), // Required capability.
+ 'theme-settings', // Screen name.
+ 'hybrid_settings_page' // Callback function.
+ );
+
+ /* Check if the settings page is being shown before running any functions for it. */
+ if ( !empty( $hybrid->settings_page ) ) {
+
+ /* Filter the settings page capability so that it recognizes the 'edit_theme_options' cap. */
+ add_filter( "option_page_capability_{$prefix}_theme_settings", 'hybrid_settings_page_capability' );
+
+ /* Add help tabs to the theme settings page. */
+ add_action( "load-{$hybrid->settings_page}", 'hybrid_settings_page_help' );
+
+ /* Load the theme settings meta boxes. */
+ add_action( "load-{$hybrid->settings_page}", 'hybrid_load_settings_page_meta_boxes' );
+
+ /* Create a hook for adding meta boxes. */
+ add_action( "load-{$hybrid->settings_page}", 'hybrid_settings_page_add_meta_boxes' );
+
+ /* Load the JavaScript and stylesheets needed for the theme settings screen. */
+ add_action( 'admin_enqueue_scripts', 'hybrid_settings_page_enqueue_scripts' );
+ add_action( 'admin_enqueue_scripts', 'hybrid_settings_page_enqueue_styles' );
+ add_action( "admin_footer-{$hybrid->settings_page}", 'hybrid_settings_page_load_scripts' );
+ }
+}
+
+/**
+ * Returns the required capability for viewing and saving theme settings.
+ *
+ * @since 1.2.0
+ * @return string
+ */
+function hybrid_settings_page_capability() {
+ return apply_filters( hybrid_get_prefix() . '_settings_capability', 'edit_theme_options' );
+}
+
+/**
+ * Returns the theme settings page name/hook as a string.
+ *
+ * @since 1.2.0
+ * @return string
+ */
+function hybrid_get_settings_page_name() {
+ global $hybrid;
+
+ return ( isset( $hybrid->settings_page ) ? $hybrid->settings_page : 'appearance_page_theme-settings' );
+}
+
+/**
+ * Provides a hook for adding meta boxes as seen on the post screen in the WordPress admin. This addition
+ * is needed because normal plugin/theme pages don't have this hook by default. The other goal of this
+ * function is to provide a way for themes to load and execute meta box code only on the theme settings
+ * page in the admin. This way, they're not needlessly loading extra files.
+ *
+ * @since 1.2.0
+ * @return void
+ */
+function hybrid_settings_page_add_meta_boxes() {
+
+ do_action( 'add_meta_boxes', hybrid_get_settings_page_name(), hybrid_get_theme_data() );
+}
+
+/**
+ * Loads the meta boxes packaged with the framework on the theme settings page. These meta boxes are
+ * merely loaded with this function. Meta boxes are only loaded if the feature is supported by the theme.
+ *
+ * @since 1.2.0
+ * @return void
+ */
+function hybrid_load_settings_page_meta_boxes() {
+
+ /* Get theme-supported meta boxes for the settings page. */
+ $supports = get_theme_support( 'hybrid-core-theme-settings' );
+
+ /* If there are any supported meta boxes, load them. */
+ if ( is_array( $supports[0] ) ) {
+
+ /* Load the 'About' meta box if it is supported. */
+ if ( in_array( 'about', $supports[0] ) )
+ require_once( trailingslashit( HYBRID_ADMIN ) . 'meta-box-theme-about.php' );
+
+ /* Load the 'Footer' meta box if it is supported. */
+ if ( in_array( 'footer', $supports[0] ) )
+ require_once( trailingslashit( HYBRID_ADMIN ) . 'meta-box-theme-footer.php' );
+ }
+}
+
+/**
+ * Validation/Sanitization callback function for theme settings. This just returns the data passed to it. Theme
+ * developers should validate/sanitize their theme settings on the "sanitize_option_{$prefix}_theme_settings"
+ * hook. This function merely exists for backwards compatibility.
+ *
+ * @since 0.7.0
+ * @param array $settings An array of the theme settings passed by the Settings API for validation.
+ * @return array $settings The array of theme settings.
+ */
+function hybrid_save_theme_settings( $settings ) {
+
+ /* @deprecated 1.0.0. Developers should filter "sanitize_option_{$prefix}_theme_settings" instead. */
+ return apply_filters( hybrid_get_prefix() . '_validate_theme_settings', $settings );
+}
+
+/**
+ * Displays the theme settings page and calls do_meta_boxes() to allow additional settings
+ * meta boxes to be added to the page.
+ *
+ * @since 0.7.0
+ * @return void
+ */
+function hybrid_settings_page() {
+
+ /* Get the theme information. */
+ $prefix = hybrid_get_prefix();
+ $theme_data = hybrid_get_theme_data(); ?>
+
+ <div class="wrap">
+
+ <?php screen_icon(); ?>
+ <h2><?php printf( __( '%1$s Theme Settings', 'hybrid-core' ), $theme_data['Name'] ); ?></h2>
+ <?php settings_errors(); ?>
+
+ <div class="hybrid-core-settings-wrap">
+
+ <form method="post" action="options.php">
+
+ <?php settings_fields( "{$prefix}_theme_settings" ); ?>
+ <?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?>
+ <?php wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); ?>
+
+ <div class="metabox-holder">
+ <div class="post-box-container column-1 normal"><?php do_meta_boxes( hybrid_get_settings_page_name(), 'normal', null ); ?></div>
+ <div class="post-box-container column-2 side"><?php do_meta_boxes( hybrid_get_settings_page_name(), 'side', null ); ?></div>
+ <div class="post-box-container column-3 advanced"><?php do_meta_boxes( hybrid_get_settings_page_name(), 'advanced', null ); ?></div>
+ </div>
+
+ <?php submit_button( esc_attr__( 'Update Settings', 'hybrid-core' ) ); ?>
+
+ </form>
+
+ </div><!-- .hybrid-core-settings-wrap -->
+
+ </div><!-- .wrap --><?php
+}
+
+/**
+ * Creates a settings field id attribute for use on the theme settings page. This is a helper function for use
+ * with the WordPress settings API.
+ *
+ * @since 1.0.0
+ * @return string
+ */
+function hybrid_settings_field_id( $setting ) {
+ return hybrid_get_prefix() . '_theme_settings-' . sanitize_html_class( $setting );
+}
+
+/**
+ * Creates a settings field name attribute for use on the theme settings page. This is a helper function for
+ * use with the WordPress settings API.
+ *
+ * @since 1.0.0
+ * @return string
+ */
+function hybrid_settings_field_name( $setting ) {
+ return hybrid_get_prefix() . "_theme_settings[{$setting}]";
+}
+
+/**
+ * Adds a help tab to the theme settings screen if the theme has provided a 'Documentation URI' and/or
+ * 'Support URI'. Theme developers can add custom help tabs using get_current_screen()->add_help_tab().
+ *
+ * @since 1.3.0
+ * @return void
+ */
+function hybrid_settings_page_help() {
+
+ /* Get the parent theme data. */
+ $theme = hybrid_get_theme_data();
+
+ /* If the theme has provided a documentation or support URI, add them to the help text. */
+ if ( !empty( $theme['Documentation URI'] ) || !empty( $theme['Support URI'] ) ) {
+
+ /* Open an unordered list for the help text. */
+ $help = '<ul>';
+
+ /* Add the Documentation URI. */
+ if ( !empty( $theme['Documentation URI'] ) )
+ $help .= '<li><a href="' . esc_url( $theme['Documentation URI'] ) . '">' . __( 'Documentation', 'hybrid-core' ) . '</a></li>';
+
+ /* Add the Support URI. */
+ if ( !empty( $theme['Support URI'] ) )
+ $help .= '<li><a href="' . esc_url( $theme['Support URI'] ) . '">' . __( 'Support', 'hybrid-core' ) . '</a></li>';
+
+ /* Close the unordered list for the help text. */
+ $help .= '</ul>';
+
+ /* Add a help tab with links for documentation and support. */
+ get_current_screen()->add_help_tab(
+ array(
+ 'id' => 'default',
+ 'title' => esc_attr( $theme['Name'] ),
+ 'content' => $help
+ )
+ );
+ }
+}
+
+/**
+ * Loads the required stylesheets for displaying the theme settings page in the WordPress admin.
+ *
+ * @since 1.2.0
+ * @return void
+ */
+function hybrid_settings_page_enqueue_styles( $hook_suffix ) {
+
+ /* Load admin stylesheet if on the theme settings screen. */
+ if ( $hook_suffix == hybrid_get_settings_page_name() )
+ wp_enqueue_style( 'hybrid-core-admin' );
+}
+
+/**
+ * Loads the JavaScript files required for managing the meta boxes on the theme settings
+ * page, which allows users to arrange the boxes to their liking.
+ *
+ * @since 1.2.0
+ * @param string $hook_suffix The current page being viewed.
+ * @return void
+ */
+function hybrid_settings_page_enqueue_scripts( $hook_suffix ) {
+
+ if ( $hook_suffix == hybrid_get_settings_page_name() )
+ wp_enqueue_script( 'postbox' );
+}
+
+/**
+ * Loads the JavaScript required for toggling the meta boxes on the theme settings page.
+ *
+ * @since 0.7.0
+ * @return void
+ */
+function hybrid_settings_page_load_scripts() { ?>
+ <script type="text/javascript">
+ //<![CDATA[
+ jQuery(document).ready( function($) {
+ $('.if-js-closed').removeClass('if-js-closed').addClass('closed');
+ postboxes.add_postbox_toggles( '<?php echo hybrid_get_settings_page_name(); ?>' );
+ });
+ //]]>
+ </script><?php
+}
+
+?>
206 classes/widget-archives.php
@@ -0,0 +1,206 @@
+<?php
+/**
+ * The Archives widget replaces the default WordPress Archives widget. This version gives total
+ * control over the output to the user by allowing the input of all the arguments typically seen
+ * in the wp_get_archives() function.
+ *
+ * @package Hybrid
+ * @subpackage Classes
+ * @author Justin Tadlock <justin@justintadlock.com>
+ * @copyright Copyright (c) 2008 - 2012, Justin Tadlock
+ * @link http://themehybrid.com/hybrid-core
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+ */
+
+/**
+ * Archives widget class.
+ *
+ * @since 0.6.0
+ */
+class Hybrid_Widget_Archives extends WP_Widget {
+
+ /**
+ * Set up the widget's unique name, ID, class, description, and other options.
+ *
+ * @since 1.2.0
+ */
+ function __construct() {
+
+ /* Set up the widget options. */
+ $widget_options = array(
+ 'classname' => 'archives',
+ 'description' => esc_html__( 'An advanced widget that gives you total control over the output of your archives.', 'hybrid-core' )
+ );
+
+ /* Set up the widget control options. */
+ $control_options = array(
+ 'width' => 525,
+ 'height' => 350
+ );
+
+ /* Create the widget. */
+ $this->WP_Widget(
+ 'hybrid-archives', // $this->id_base
+ __( 'Archives', 'hybrid-core' ), // $this->name
+ $widget_options, // $this->widget_options
+ $control_options // $this->control_options
+ );
+ }
+
+ /**
+ * Outputs the widget based on the arguments input through the widget controls.
+ *
+ * @since 0.6.0
+ */
+ function widget( $sidebar, $instance ) {
+ extract( $sidebar );
+
+ /* Set the $args for wp_get_archives() to the $instance array. */
+ $args = $instance;
+
+ /* Overwrite the $echo argument and set it to false. */
+ $args['echo'] = false;
+
+ /* Output the theme's $before_widget wrapper. */
+ echo $before_widget;
+
+ /* If a title was input by the user, display it. */
+ if ( !empty( $instance['title'] ) )
+ echo $before_title . apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base ) . $after_title;
+
+ /* Get the archives list. */
+ $archives = str_replace( array( "\r", "\n", "\t" ), '', wp_get_archives( $args ) );
+
+ /* If the archives should be shown in a <select> drop-down. */
+ if ( 'option' == $args['format'] ) {
+
+ /* Create a title for the drop-down based on the archive type. */
+ if ( 'yearly' == $args['type'] )
+ $option_title = esc_html__( 'Select Year', 'hybrid-core' );
+
+ elseif ( 'monthly' == $args['type'] )
+ $option_title = esc_html__( 'Select Month', 'hybrid-core' );
+
+ elseif ( 'weekly' == $args['type'] )
+ $option_title = esc_html__( 'Select Week', 'hybrid-core' );
+
+ elseif ( 'daily' == $args['type'] )
+ $option_title = esc_html__( 'Select Day', 'hybrid-core' );
+
+ elseif ( 'postbypost' == $args['type'] || 'alpha' == $args['type'] )
+ $option_title = esc_html__( 'Select Post', 'hybrid-core' );
+
+ /* Output the <select> element and each <option>. */
+ echo '<p><select name="archive-dropdown" onchange=\'document.location.href=this.options[this.selectedIndex].value;\'>';
+ echo '<option value="">' . $option_title . '</option>';
+ echo $archives;
+ echo '</select></p>';
+ }
+
+ /* If the format should be an unordered list. */
+ elseif ( 'html' == $args['format'] ) {
+ echo '<ul class="xoxo archives">' . $archives . '</ul><!-- .xoxo .archives -->';
+ }
+
+ /* All other formats. */
+ else {
+ echo $archives;
+ }
+
+ /* Close the theme's widget wrapper. */
+ echo $after_widget;
+ }
+
+ /**
+ * Updates the widget control options for the particular instance of the widget.
+ *
+ * @since 0.6.0
+ */
+ function update( $new_instance, $old_instance ) {
+
+ $instance = $new_instance;
+
+ $instance['title'] = strip_tags( $new_instance['title'] );
+ $instance['before'] = strip_tags( $new_instance['before'] );
+ $instance['after'] = strip_tags( $new_instance['after'] );
+ $instance['limit'] = strip_tags( $new_instance['limit'] );
+ $instance['show_post_count'] = ( isset( $new_instance['show_post_count'] ) ? 1 : 0 );
+
+ return $instance;
+ }
+
+ /**
+ * Displays the widget control options in the Widgets admin screen.
+ *
+ * @since 0.6.0
+ */
+ function form( $instance ) {
+
+ /* Set up the default form values. */
+ $defaults = array(
+ 'title' => esc_attr__( 'Archives', 'hybrid-core' ),
+ 'limit' => 10,
+ 'type' => 'monthly',
+ 'format' => 'html',
+ 'before' => '',
+ 'after' => '',
+ 'show_post_count' => false
+ );
+
+ /* Merge the user-selected arguments with the defaults. */
+ $instance = wp_parse_args( (array) $instance, $defaults );
+
+ /* Create an array of archive types. */
+ $type = array( 'alpha' => esc_attr__( 'Alphabetical', 'hybrid-core' ), 'daily' => esc_attr__( 'Daily', 'hybrid-core' ), 'monthly' => esc_attr__( 'Monthly', 'hybrid-core' ),'postbypost' => esc_attr__( 'Post By Post', 'hybrid-core' ), 'weekly' => esc_attr__( 'Weekly', 'hybrid-core' ), 'yearly' => esc_attr__( 'Yearly', 'hybrid-core' ) );
+
+ /* Create an array of archive formats. */
+ $format = array( 'custom' => esc_attr__( 'Custom', 'hybrid-core' ), 'html' => esc_attr__( 'HTML', 'hybrid-core' ), 'option' => esc_attr__( 'Option', 'hybrid-core' ) );
+ ?>
+
+ <div class="hybrid-widget-controls columns-2">
+ <p>
+ <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'hybrid-core' ); ?></label>
+ <input type="text" class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo esc_attr( $instance['title'] ); ?>" />
+ </p>
+ <p>
+ <label for="<?php echo $this->get_field_id( 'limit' ); ?>"><code>limit</code></label>
+ <input type="text" class="smallfat code" id="<?php echo $this->get_field_id( 'limit' ); ?>" name="<?php echo $this->get_field_name( 'limit' ); ?>" value="<?php echo esc_attr( $instance['limit'] ); ?>" />
+ </p>
+ <p>
+ <label for="<?php echo $this->get_field_id( 'type' ); ?>"><code>type</code></label>
+ <select class="widefat" id="<?php echo $this->get_field_id( 'type' ); ?>" name="<?php echo $this->get_field_name( 'type' ); ?>">
+ <?php foreach ( $type as $option_value => $option_label ) { ?>
+ <option value="<?php echo esc_attr( $option_value ); ?>" <?php selected( $instance['type'], $option_value ); ?>><?php echo esc_html( $option_label ); ?></option>
+ <?php } ?>
+ </select>
+ </p>
+ <p>
+ <label for="<?php echo $this->get_field_id( 'format' ); ?>"><code>format</code></label>
+ <select class="widefat" id="<?php echo $this->get_field_id( 'format' ); ?>" name="<?php echo $this->get_field_name( 'format' ); ?>">
+ <?php foreach ( $format as $option_value => $option_label ) { ?>
+ <option value="<?php echo esc_attr( $option_value ); ?>" <?php selected( $instance['format'], $option_value ); ?>><?php echo esc_html( $option_label ); ?></option>
+ <?php } ?>
+ </select>
+ </p>
+ </div>
+
+ <div class="hybrid-widget-controls columns-2 column-last">
+ <p>
+ <label for="<?php echo $this->get_field_id( 'before' ); ?>"><code>before</code></label>
+ <input type="text" class="widefat code" id="<?php echo $this->get_field_id( 'before' ); ?>" name="<?php echo $this->get_field_name( 'before' ); ?>" value="<?php echo esc_attr( $instance['before'] ); ?>" />
+ </p>
+ <p>
+ <label for="<?php echo $this->get_field_id( 'after' ); ?>"><code>after</code></label>
+ <input type="text" class="widefat code" id="<?php echo $this->get_field_id( 'after' ); ?>" name="<?php echo $this->get_field_name( 'after' ); ?>" value="<?php echo esc_attr( $instance['after'] ); ?>" />
+ </p>
+ <p>
+ <label for="<?php echo $this->get_field_id( 'show_post_count' ); ?>">
+ <input class="checkbox" type="checkbox" <?php checked( $instance['show_post_count'], true ); ?> id="<?php echo $this->get_field_id( 'show_post_count' ); ?>" name="<?php echo $this->get_field_name( 'show_post_count' ); ?>" /> <?php _e( 'Show post count?', 'hybrid-core' ); ?> <code>show_post_count</code></label>
+ </p>
+ </div>
+ <div style="clear:both;">&nbsp;</div>
+ <?php
+ }
+}
+
+?>
211 classes/widget-authors.php
@@ -0,0 +1,211 @@
+<?php
+/**
+ * The authors widget was created to give users the ability to list the authors of their blog because
+ * there was no equivalent WordPress widget that offered the functionality. This widget allows full
+ * control over its output by giving access to the parameters of wp_list_authors().
+ *
+ * @package Hybrid
+ * @subpackage Classes
+ * @author Justin Tadlock <justin@justintadlock.com>
+ * @copyright Copyright (c) 2008 - 2012, Justin Tadlock
+ * @link http://themehybrid.com/hybrid-core
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+ */
+
+/**
+ * Authors Widget Class
+ *
+ * @since 0.6.0
+ */
+class Hybrid_Widget_Authors extends WP_Widget {
+
+ /**
+ * Set up the widget's unique name, ID, class, description, and other options.
+ *
+ * @since 1.2.0
+ */
+ function __construct() {
+
+ /* Set up the widget options. */
+ $widget_options = array(
+ 'classname' => 'authors',
+ 'description' => esc_html__( 'An advanced widget that gives you total control over the output of your author lists.', 'hybrid-core' )
+ );
+
+ /* Set up the widget control options. */
+ $control_options = array(
+ 'width' => 525,
+ 'height' => 350
+ );
+
+ /* Create the widget. */
+ $this->WP_Widget(
+ 'hybrid-authors', // $this->id_base
+ __( 'Authors', 'hybrid-core' ), // $this->name
+ $widget_options, // $this->widget_options
+ $control_options // $this->control_options
+ );
+ }
+
+ /**
+ * Outputs the widget based on the arguments input through the widget controls.
+ *
+ * @since 0.6.0
+ */
+ function widget( $sidebar, $instance ) {
+ extract( $sidebar );
+
+ /* Set the $args for wp_list_authors() to the $instance array. */
+ $args = $instance;
+
+ /* Overwrite the $echo argument and set it to false. */
+ $args['echo'] = false;
+
+ /* Output the theme's $before_widget wrapper. */
+ echo $before_widget;
+
+ /* If a title was input by the user, display it. */
+ if ( !empty( $instance['title'] ) )
+ echo $before_title . apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base ) . $after_title;
+
+ /* Get the authors list. */
+ $authors = str_replace( array( "\r", "\n", "\t" ), '', wp_list_authors( $args ) );
+
+ /* If 'list' is the style and the output should be HTML, wrap the authors in a <ul>. */
+ if ( 'list' == $args['style'] && $args['html'] )
+ $authors = '<ul class="xoxo authors">' . $authors . '</ul><!-- .xoxo .authors -->';
+
+ /* Display the authors list. */
+ echo $authors;
+
+ /* Close the theme's widget wrapper. */
+ echo $after_widget;
+ }
+
+ /**
+ * Updates the widget control options for the particular instance of the widget.
+ *
+ * @since 0.6.0
+ */
+ function update( $new_instance, $old_instance ) {
+ $instance = $old_instance;
+
+ $instance = $new_instance;
+
+ $instance['title'] = strip_tags( $new_instance['title'] );
+ $instance['feed'] = strip_tags( $new_instance['feed'] );
+ $instance['order'] = strip_tags( $new_instance['order'] );
+ $instance['orderby'] = strip_tags( $new_instance['orderby'] );
+ $instance['number'] = strip_tags( $new_instance['number'] );
+
+ $instance['html'] = ( isset( $new_instance['html'] ) ? 1 : 0 );
+ $instance['optioncount'] = ( isset( $new_instance['optioncount'] ) ? 1 : 0 );
+ $instance['exclude_admin'] = ( isset( $new_instance['exclude_admin'] ) ? 1 : 0 );
+ $instance['show_fullname'] = ( isset( $new_instance['show_fullname'] ) ? 1 : 0 );
+ $instance['hide_empty'] = ( isset( $new_instance['hide_empty'] ) ? 1 : 0 );
+
+ return $instance;
+ }
+
+ /**
+ * Displays the widget control options in the Widgets admin screen.
+ *
+ * @since 0.6.0
+ */
+ function form( $instance ) {
+
+ /* Set up the default form values. */
+ $defaults = array(
+ 'title' => esc_attr__( 'Authors', 'hybrid-core' ),
+ 'order' => 'ASC',
+ 'orderby' => 'display_name',
+ 'number' => '',
+ 'optioncount' => false,
+ 'exclude_admin' => false,
+ 'show_fullname' => true,
+ 'hide_empty' => true,
+ 'style' => 'list',
+ 'html' => true,
+ 'feed' => '',
+ 'feed_image' => ''
+ );
+
+ /* Merge the user-selected arguments with the defaults. */
+ $instance = wp_parse_args( (array) $instance, $defaults );
+
+ $order = array( 'ASC' => esc_attr__( 'Ascending', 'hybrid-core' ), 'DESC' => esc_attr__( 'Descending', 'hybrid-core' ) );
+ $orderby = array( 'display_name' => esc_attr__( 'Display Name', 'hybrid-core' ), 'email' => esc_attr__( 'Email', 'hybrid-core' ), 'ID' => esc_attr__( 'ID', 'hybrid-core' ), 'nicename' => esc_attr__( 'Nice Name', 'hybrid-core' ), 'post_count' => esc_attr__( 'Post Count', 'hybrid-core' ), 'registered' => esc_attr__( 'Registered', 'hybrid-core' ), 'url' => esc_attr__( 'URL', 'hybrid-core' ), 'user_login' => esc_attr__( 'Login', 'hybrid-core' ) );
+
+ ?>
+
+ <div class="hybrid-widget-controls columns-2">
+ <p>
+ <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'hybrid-core' ); ?></label>
+ <input type="text" class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo esc_attr( $instance['title'] ); ?>" />
+ </p>
+ <p>
+ <label for="<?php echo $this->get_field_id( 'order' ); ?>"><code>order</code></label>
+ <select class="widefat" id="<?php echo $this->get_field_id( 'order' ); ?>" name="<?php echo $this->get_field_name( 'order' ); ?>">
+ <?php foreach ( $order as $option_value => $option_label ) { ?>
+ <option value="<?php echo esc_attr( $option_value ); ?>" <?php selected( $instance['order'], $option_value ); ?>><?php echo esc_html( $option_label ); ?></option>
+ <?php } ?>
+ </select>
+ </p>
+ <p>
+ <label for="<?php echo $this->get_field_id( 'orderby' ); ?>"><code>orderby</code></label>
+ <select class="widefat" id="<?php echo $this->get_field_id( 'orderby' ); ?>" name="<?php echo $this->get_field_name( 'orderby' ); ?>">
+ <?php foreach ( $orderby as $option_value => $option_label ) { ?>
+ <option value="<?php echo esc_attr( $option_value ); ?>" <?php selected( $instance['orderby'], $option_value ); ?>><?php echo esc_html( $option_label ); ?></option>
+ <?php } ?>
+ </select>
+ </p>
+ <p>
+ <label for="<?php echo $this->get_field_id( 'number' ); ?>"><code>number</code></label>
+ <input type="text" class="smallfat code" id="<?php echo $this->get_field_id( 'number' ); ?>" name="<?php echo $this->get_field_name( 'number' ); ?>" value="<?php echo esc_attr( $instance['number'] ); ?>" />
+ </p>
+ <p>
+ <label for="<?php echo $this->get_field_id( 'style' ); ?>"><code>style</code></label>
+ <select class="widefat" id="<?php echo $this->get_field_id( 'style' ); ?>" name="<?php echo $this->get_field_name( 'style' ); ?>">
+ <?php foreach ( array( 'list' => esc_attr__( 'List', 'hybrid-core'), 'none' => esc_attr__( 'None', 'hybrid-core' ) ) as $option_value => $option_label ) { ?>
+ <option value="<?php echo esc_attr( $option_value ); ?>" <?php selected( $instance['style'], $option_value ); ?>><?php echo esc_html( $option_label ); ?></option>
+ <?php } ?>
+ </select>
+ </p>
+ </div>
+
+ <div class="hybrid-widget-controls columns-2 column-last">
+ <p>
+ <label for="<?php echo $this->get_field_id( 'feed' ); ?>"><code>feed</code></label>
+ <input type="text" class="widefat code" id="<?php echo $this->get_field_id( 'feed' ); ?>" name="<?php echo $this->get_field_name( 'feed' ); ?>" value="<?php echo esc_attr( $instance['feed'] ); ?>" />
+ </p>
+ <p>
+ <label for="<?php echo $this->get_field_id( 'feed_image' ); ?>"><code>feed_image</code></label>
+ <input type="text" class="widefat code" id="<?php echo $this->get_field_id( 'feed_image' ); ?>" name="<?php echo $this->get_field_name( 'feed_image' ); ?>" value="<?php echo esc_attr( $instance['feed_image'] ); ?>" />
+ </p>
+ <p>
+ <label for="<?php echo $this->get_field_id( 'html' ); ?>">
+ <input class="checkbox" type="checkbox" <?php checked( $instance['html'], true ); ?> id="<?php echo $this->get_field_id( 'html' ); ?>" name="<?php echo $this->get_field_name( 'html' ); ?>" /> <?php _e( '<acronym title="Hypertext Markup Language">HTML</acronym>?', 'hybrid-core' ); ?> <code>html</code></label>
+ </p>
+ <p>
+ <label for="<?php echo $this->get_field_id( 'optioncount' ); ?>">
+ <input class="checkbox" type="checkbox" <?php checked( $instance['optioncount'], true ); ?> id="<?php echo $this->get_field_id( 'optioncount' ); ?>" name="<?php echo $this->get_field_name( 'optioncount' ); ?>" /> <?php _e( 'Show post count?', 'hybrid-core' ); ?> <code>optioncount</code></label>
+ </p>
+ <p>
+ <label for="<?php echo $this->get_field_id( 'exclude_admin' ); ?>">
+ <input class="checkbox" type="checkbox" <?php checked( $instance['exclude_admin'], true ); ?> id="<?php echo $this->get_field_id( 'exclude_admin' ); ?>" name="<?php echo $this->get_field_name( 'exclude_admin' ); ?>" /> <?php _e( 'Exclude admin?', 'hybrid-core' ); ?> <code>exclude_admin</code></label>
+ </p>
+ <p>
+ <label for="<?php echo $this->get_field_id( 'show_fullname' ); ?>">
+ <input class="checkbox" type="checkbox" <?php checked( $instance['show_fullname'], true ); ?> id="<?php echo $this->get_field_id( 'show_fullname' ); ?>" name="<?php echo $this->get_field_name( 'show_fullname' ); ?>" /> <?php _e( 'Show full name?', 'hybrid-core' ); ?> <code>show_fullname</code></label>
+ </p>
+ <p>
+ <label for="<?php echo $this->get_field_id( 'hide_empty' ); ?>">
+ <input class="checkbox" type="checkbox" <?php checked( $instance['hide_empty'], true ); ?> id="<?php echo $this->get_field_id( 'hide_empty' ); ?>" name="<?php echo $this->get_field_name( 'hide_empty' ); ?>" /> <?php _e( 'Hide empty?', 'hybrid-core' ); ?> <code>hide_empty</code></label>
+ </p>
+ </div>
+ <div style="clear:both;">&nbsp;</div>
+ <?php
+ }
+}
+
+?>
326 classes/widget-bookmarks.php
@@ -0,0 +1,326 @@
+<?php
+/**
+ * The Bookmarks widget replaces the default WordPress Links widget. This version gives total
+ * control over the output to the user by allowing the input of all the arguments typically seen
+ * in the wp_list_bookmarks() function.
+ *
+ * @package Hybrid
+ * @subpackage Classes
+ * @author Justin Tadlock <justin@justintadlock.com>
+ * @copyright Copyright (c) 2008 - 2012, Justin Tadlock
+ * @link http://themehybrid.com/hybrid-core
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+ */
+
+/**
+ * Bookmarks Widget Class
+ *
+ * @since 0.6.0
+ */
+class Hybrid_Widget_Bookmarks extends WP_Widget {
+
+ /**
+ * Set up the widget's unique name, ID, class, description, and other options.
+ *
+ * @since 1.2.0
+ */
+ function __construct() {
+
+ /* Set up the widget options. */
+ $widget_options = array(
+ 'classname' => 'bookmarks',
+ 'description' => esc_html__( 'An advanced widget that gives you total control over the output of your bookmarks (links).', 'hybrid-core' )
+ );
+
+ /* Set up the widget control options. */
+ $control_options = array(
+ 'width' => 800,
+ 'height' => 350
+ );
+
+ /* Create the widget. */
+ $this->WP_Widget(
+ 'hybrid-bookmarks', // $this->id_base
+ __( 'Bookmarks', 'hybrid-core' ), // $this->name
+ $widget_options, // $this->widget_options
+ $control_options // $this->control_options
+ );
+ }
+ /**
+ * Outputs the widget based on the arguments input through the widget controls.
+ *
+ * @since 0.6.0
+ */
+ function widget( $sidebar, $instance ) {
+ extract( $sidebar );
+
+ /* Set up the $before_widget ID for multiple widgets created by the bookmarks widget. */
+ if ( !empty( $instance['categorize'] ) )
+ $before_widget = preg_replace( '/id="[^"]*"/','id="%id"', $before_widget );
+
+ /* Add a class to $before_widget if one is set. */
+ if ( !empty( $instance['class'] ) )
+ $before_widget = str_replace( 'class="', 'class="' . esc_attr( $instance['class'] ) . ' ', $before_widget );
+
+ /* Set the $args for wp_list_bookmarks() to the $instance array. */
+ $args = $instance;
+
+ /* wp_list_bookmarks() hasn't been updated in WP to use wp_parse_id_list(), so we have to pass strings for includes/excludes. */
+ if ( !empty( $args['category'] ) && is_array( $args['category'] ) )
+ $args['category'] = join( ', ', $args['category'] );
+
+ if ( !empty( $args['exclude_category'] ) && is_array( $args['exclude_category'] ) )
+ $args['exclude_category'] = join( ', ', $args['exclude_category'] );
+
+ if ( !empty( $args['include'] ) && is_array( $args['include'] ) )
+ $args['include'] = join( ',', $args['include'] );
+
+ if ( !empty( $args['exclude'] ) && is_array( $args['exclude'] ) )
+ $args['exclude'] = join( ',', $args['exclude'] );
+
+ /* If no limit is given, set it to -1. */
+ $args['limit'] = empty( $args['limit'] ) ? -1 : $args['limit'];
+
+ /* Some arguments must be set to the sidebar arguments to be output correctly. */
+ $args['title_li'] = apply_filters( 'widget_title', ( empty( $args['title_li'] ) ? __( 'Bookmarks', 'hybrid-core' ) : $args['title_li'] ), $instance, $this->id_base );
+ $args['title_before'] = $before_title;
+ $args['title_after'] = $after_title;
+ $args['category_before'] = $before_widget;
+ $args['category_after'] = $after_widget;
+ $args['category_name'] = '';
+ $args['echo'] = false;
+
+ /* Output the bookmarks widget. */
+ $bookmarks = str_replace( array( "\r", "\n", "\t" ), '', wp_list_bookmarks( $args ) );
+
+ /* If no title is given and the bookmarks aren't categorized, add a wrapper <ul>. */
+ if ( empty( $args['title_li'] ) && false === $args['categorize'] )
+ $bookmarks = '<ul class="xoxo bookmarks">' . $bookmarks . '</ul>';
+
+ /* Output the bookmarks. */
+ echo $bookmarks;
+ }
+
+ /**
+ * Updates the widget control options for the particular instance of the widget.
+ *
+ * @since 0.6.0
+ */
+ function update( $new_instance, $old_instance ) {
+ $instance = $old_instance;
+
+ /* Set the instance to the new instance. */
+ $instance = $new_instance;
+
+ $instance['title_li'] = strip_tags( $new_instance['title_li'] );
+ $instance['limit'] = strip_tags( $new_instance['limit'] );
+ $instance['class'] = strip_tags( $new_instance['class'] );
+ $instance['search'] = strip_tags( $new_instance['search'] );
+ $instance['category_order'] = $new_instance['category_order'];
+ $instance['category_orderby'] = $new_instance['category_orderby'];
+ $instance['orderby'] = $new_instance['orderby'];
+ $instance['order'] = $new_instance['order'];
+ $instance['between'] = $new_instance['between'];
+ $instance['link_before'] = $new_instance['link_before'];
+ $instance['link_after'] = $new_instance['link_after'];
+
+ $instance['categorize'] = ( isset( $new_instance['categorize'] ) ? 1 : 0 );
+ $instance['hide_invisible'] = ( isset( $new_instance['hide_invisible'] ) ? 1 : 0 );
+ $instance['show_private'] = ( isset( $new_instance['show_private'] ) ? 1 : 0 );
+ $instance['show_rating'] = ( isset( $new_instance['show_rating'] ) ? 1 : 0 );
+ $instance['show_updated'] = ( isset( $new_instance['show_updated'] ) ? 1 : 0 );
+ $instance['show_images'] = ( isset( $new_instance['show_images'] ) ? 1 : 0 );
+ $instance['show_name'] = ( isset( $new_instance['show_name'] ) ? 1 : 0 );
+ $instance['show_description'] = ( isset( $new_instance['show_description'] ) ? 1 : 0 );
+
+ return $instance;
+ }
+
+ /**
+ * Displays the widget control options in the Widgets admin screen.
+ *
+ * @since 0.6.0
+ */
+ function form( $instance ) {
+
+ /* Set up the default form values. */
+ $defaults = array(
+ 'title_li' => esc_attr__( 'Bookmarks', 'hybrid-core' ),
+ 'categorize' => true,
+ 'category_order' => 'ASC',
+ 'category_orderby' => 'name',
+ 'category' => array(),
+ 'exclude_category' => array(),
+ 'limit' => -1,
+ 'order' => 'ASC',
+ 'orderby' => 'name',
+ 'include' => array(),
+ 'exclude' => array(),
+ 'search' => '',
+ 'hide_invisible' => true,
+ 'show_description' => false,
+ 'show_images' => false,
+ 'show_rating' => false,
+ 'show_updated' => false,
+ 'show_private' => false,
+ 'show_name' => false,
+ 'class' => 'linkcat',
+ 'link_before' => '<span>',
+ 'link_after' => '</span>',
+ 'between' => '<br />',
+ );
+
+ /* Merge the user-selected arguments with the defaults. */
+ $instance = wp_parse_args( (array) $instance, $defaults );
+
+ $terms = get_terms( 'link_category' );
+ $bookmarks = get_bookmarks( array( 'hide_invisible' => false ) );
+ $category_order = array( 'ASC' => esc_attr__( 'Ascending', 'hybrid-core' ), 'DESC' => esc_attr__( 'Descending', 'hybrid-core' ) );
+ $category_orderby = array( 'count' => esc_attr__( 'Count', 'hybrid-core' ), 'ID' => esc_attr__( 'ID', 'hybrid-core' ), 'name' => esc_attr__( 'Name', 'hybrid-core' ), 'slug' => esc_attr__( 'Slug', 'hybrid-core' ) );
+ $order = array( 'ASC' => esc_attr__( 'Ascending', 'hybrid-core' ), 'DESC' => esc_attr__( 'Descending', 'hybrid-core' ) );
+ $orderby = array( 'id' => esc_attr__( 'ID', 'hybrid-core' ), 'description' => esc_attr__( 'Description', 'hybrid-core' ), 'length' => esc_attr__( 'Length', 'hybrid-core' ), 'name' => esc_attr__( 'Name', 'hybrid-core' ), 'notes' => esc_attr__( 'Notes', 'hybrid-core' ), 'owner' => esc_attr__( 'Owner', 'hybrid-core' ), 'rand' => esc_attr__( 'Random', 'hybrid-core' ), 'rating' => esc_attr__( 'Rating', 'hybrid-core' ), 'rel' => esc_attr__( 'Rel', 'hybrid-core' ), 'rss' => esc_attr__( 'RSS', 'hybrid-core' ), 'target' => esc_attr__( 'Target', 'hybrid-core' ), 'updated' => esc_attr__( 'Updated', 'hybrid-core' ), 'url' => esc_attr__( 'URL', 'hybrid-core' ) );
+
+ ?>
+
+ <div class="hybrid-widget-controls columns-3">
+ <p>
+ <label for="<?php echo $this->get_field_id( 'title_li' ); ?>"><?php _e( 'Title:', 'hybrid-core' ); ?></label>
+ <input type="text" class="widefat" id="<?php echo $this->get_field_id( 'title_li' ); ?>" name="<?php echo $this->get_field_name( 'title_li' ); ?>" value="<?php echo esc_attr( $instance['title_li'] ); ?>" />
+ </p>
+ <p>
+ <label for="<?php echo $this->get_field_id( 'category_order' ); ?>"><code>category_order</code></label>
+ <select class="widefat" id="<?php echo $this->get_field_id( 'category_order' ); ?>" name="<?php echo $this->get_field_name( 'category_order' ); ?>">
+ <?php foreach ( $category_order as $option_value => $option_label ) { ?>
+ <option value="<?php echo esc_attr( $option_value ); ?>" <?php selected( $instance['category_order'], $option_value ); ?>><?php echo esc_html( $option_label ); ?></option>
+ <?php } ?>
+ </select>
+ </p>
+ <p>
+ <label for="<?php echo $this->get_field_id( 'category_orderby' ); ?>"><code>category_orderby</code></label>
+ <select class="widefat" id="<?php echo $this->get_field_id( 'category_orderby' ); ?>" name="<?php echo $this->get_field_name( 'category_orderby' ); ?>">
+ <?php foreach ( $category_orderby as $option_value => $option_label ) { ?>
+ <option value="<?php echo esc_attr( $option_value ); ?>" <?php selected( $instance['category_orderby'], $option_value ); ?>><?php echo esc_html( $option_label ); ?></option>
+ <?php } ?>
+ </select>
+ </p>
+ <p>
+ <label for="<?php echo $this->get_field_id( 'category' ); ?>"><code>category</code></label>
+ <select class="widefat" id="<?php echo $this->get_field_id( 'category' ); ?>" name="<?php echo $this->get_field_name( 'category' ); ?>[]" size="4" multiple="multiple">
+ <?php foreach ( $terms as $term ) { ?>
+ <option value="<?php echo esc_attr( $term->term_id ); ?>" <?php echo ( in_array( $term->term_id, (array) $instance['category'] ) ? 'selected="selected"' : '' ); ?>><?php echo esc_html( $term->name ); ?></option>
+ <?php } ?>
+ </select>
+ </p>
+ <p>
+ <label for="<?php echo $this->get_field_id( 'exclude_category' ); ?>"><code>exclude_category</code></label>
+ <select class="widefat" id="<?php echo $this->get_field_id( 'exclude_category' ); ?>" name="<?php echo $this->get_field_name( 'exclude_category' ); ?>[]" size="4" multiple="multiple">
+ <?php foreach ( $terms as $term ) { ?>
+ <option value="<?php echo esc_attr( $term->term_id ); ?>" <?php echo ( in_array( $term->term_id, (array) $instance['exclude_category'] ) ? 'selected="selected"' : '' ); ?>><?php echo esc_html( $term->name ); ?></option>
+ <?php } ?>
+ </select>
+ </p>
+ <p>
+ <label for="<?php echo $this->get_field_id( 'class' ); ?>"><code>class</code></label>
+ <input type="text" class="smallfat code" id="<?php echo $this->get_field_id( 'class' ); ?>" name="<?php echo $this->get_field_name( 'class' ); ?>" value="<?php echo esc_attr( $instance['class'] ); ?>" />
+ </p>
+
+ </div>
+
+ <div class="hybrid-widget-controls columns-3">
+
+ <p>
+ <label for="<?php echo $this->get_field_id( 'limit' ); ?>"><code>limit</code></label>
+ <input type="text" class="smallfat code" id="<?php echo $this->get_field_id( 'limit' ); ?>" name="<?php echo $this->get_field_name( 'limit' ); ?>" value="<?php echo esc_attr( $instance['limit'] ); ?>" />
+ </p>
+ <p>
+ <label for="<?php echo $this->get_field_id( 'order' ); ?>"><code>order</code></label>
+ <select class="widefat" id="<?php echo $this->get_field_id( 'order' ); ?>" name="<?php echo $this->get_field_name( 'order' ); ?>">
+ <?php foreach ( $order as $option_value => $option_label ) { ?>
+ <option value="<?php echo esc_attr( $option_value ); ?>" <?php selected( $instance['order'], $option_value ); ?>><?php echo esc_html( $option_label ); ?></option>
+ <?php } ?>
+ </select>
+ </p>
+ <p>
+ <label for="<?php echo $this->get_field_id( 'orderby' ); ?>"><code>orderby</code></label>
+ <select class="widefat" id="<?php echo $this->get_field_id( 'orderby' ); ?>" name="<?php echo $this->get_field_name( 'orderby' ); ?>">
+ <?php foreach ( $orderby as $option_value => $option_label ) { ?>
+ <option value="<?php echo esc_attr( $option_value ); ?>" <?php selected( $instance['orderby'], $option_value ); ?>><?php echo esc_html( $option_label ); ?></option>
+ <?php } ?>
+ </select>
+ </p>
+ <p>
+ <label for="<?php echo $this->get_field_id( 'include' ); ?>"><code>include</code></label>
+ <select class="widefat" id="<?php echo $this->get_field_id( 'include' ); ?>" name="<?php echo $this->get_field_name( 'include' ); ?>[]" size="4" multiple="multiple">
+ <?php foreach ( $bookmarks as $bookmark ) { ?>
+ <option value="<?php echo esc_attr( $bookmark->link_id ); ?>" <?php echo ( in_array( $bookmark->link_id, (array) $instance['include'] ) ? 'selected="selected"' : '' ); ?>><?php echo esc_html( $bookmark->link_name ); ?></option>
+ <?php } ?>
+ </select>
+ </p>
+ <p>
+ <label for="<?php echo $this->get_field_id( 'exclude' ); ?>"><code>exclude</code></label>
+ <select class="widefat" id="<?php echo $this->get_field_id( 'exclude' ); ?>" name="<?php echo $this->get_field_name( 'exclude' ); ?>[]" size="4" multiple="multiple">
+ <?php foreach ( $bookmarks as $bookmark ) { ?>
+ <option value="<?php echo esc_attr( $bookmark->link_id ); ?>" <?php echo ( in_array( $bookmark->link_id, (array) $instance['exclude'] ) ? 'selected="selected"' : '' ); ?>><?php echo esc_html( $bookmark->link_name ); ?></option>
+ <?php } ?>
+ </select>
+ </p>
+ <p>
+ <label for="<?php echo $this->get_field_id( 'search' ); ?>"><code>search</code></label>
+ <input type="text" class="widefat code" id="<?php echo $this->get_field_id( 'search' ); ?>" name="<?php echo $this->get_field_name( 'search' ); ?>" value="<?php echo esc_attr( $instance['search'] ); ?>" />
+ </p>
+
+ </div>
+
+ <div class="hybrid-widget-controls columns-3 column-last">
+ <p>
+ <label for="<?php echo $this->get_field_id( 'between' ); ?>"><code>between</code></label>
+ <input type="text" class="smallfat code" id="<?php echo $this->get_field_id( 'between' ); ?>" name="<?php echo $this->get_field_name( 'between' ); ?>" value="<?php echo esc_attr( $instance['between'] ); ?>" />
+ </p>
+ <p>
+ <label for="<?php echo $this->get_field_id( 'link_before' ); ?>"><code>link_before</code></label>
+ <input type="text" class="smallfat code" id="<?php echo $this->get_field_id( 'link_before' ); ?>" name="<?php echo $this->get_field_name( 'link_before' ); ?>" value="<?php echo esc_attr( $instance['link_before'] ); ?>" />
+ </p>
+ <p>
+ <label for="<?php echo $this->get_field_id( 'link_after' ); ?>"><code>link_after</code></label>
+ <input type="text" class="smallfat code" id="<?php echo $this->get_field_id( 'link_after' ); ?>" name="<?php echo $this->get_field_name( 'link_after' ); ?>" value="<?php echo esc_attr( $instance['link_after'] ); ?>" />
+ </p>
+ <p>
+ <label for="<?php echo $this->get_field_id( 'categorize' ); ?>">
+ <input class="checkbox" type="checkbox" <?php checked( $instance['categorize'], true ); ?> id="<?php echo $this->get_field_id( 'categorize' ); ?>" name="<?php echo $this->get_field_name( 'categorize' ); ?>" /> <?php _e( 'Categorize?', 'hybrid-core' ); ?> <code>categorize</code></label>
+ </p>
+ <p>
+ <label for="<?php echo $this->get_field_id( 'show_description' ); ?>">
+ <input class="checkbox" type="checkbox" <?php checked( $instance['show_description'], true ); ?> id="<?php echo $this->get_field_id( 'show_description' ); ?>" name="<?php echo $this->get_field_name( 'show_description' ); ?>" /> <?php _e( 'Show description?', 'hybrid-core' ); ?> <code>show_description</code></label>
+ </p>
+ <p>
+ <label for="<?php echo $this->get_field_id( 'hide_invisible' ); ?>">
+ <input class="checkbox" type="checkbox" <?php checked( $instance['hide_invisible'], true ); ?> id="<?php echo $this->get_field_id( 'hide_invisible' ); ?>" name="<?php echo $this->get_field_name( 'hide_invisible' ); ?>" /> <?php _e( 'Hide invisible?', 'hybrid-core' ); ?> <code>hide_invisible</code></label>
+ </p>
+ <p>
+ <label for="<?php echo $this->get_field_id( 'show_rating' ); ?>">
+ <input class="checkbox" type="checkbox" <?php checked( $instance['show_rating'], true ); ?> id="<?php echo $this->get_field_id( 'show_rating' ); ?>" name="<?php echo $this->get_field_name( 'show_rating' ); ?>" /> <?php _e( 'Show rating?', 'hybrid-core' ); ?> <code>show_rating</code></label>
+ </p>
+ <p>
+ <label for="<?php echo $this->get_field_id( 'show_updated' ); ?>">
+ <input class="checkbox" type="checkbox" <?php checked( $instance['show_updated'], true ); ?> id="<?php echo $this->get_field_id( 'show_updated' ); ?>" name="<?php echo $this->get_field_name( 'show_updated' ); ?>" /> <?php _e( 'Show updated?', 'hybrid-core' ); ?> <code>show_updated</code></label>
+ </p>
+ <p>
+ <label for="<?php echo $this->get_field_id( 'show_images' ); ?>">
+ <input class="checkbox" type="checkbox" <?php checked( $instance['show_images'], true ); ?> id="<?php echo $this->get_field_id( 'show_images' ); ?>" name="<?php echo $this->get_field_name( 'show_images' ); ?>" /> <?php _e( 'Show images?', 'hybrid-core' ); ?> <code>show_images</code></label>
+ </p>
+ <p>
+ <label for="<?php echo $this->get_field_id( 'show_name' ); ?>">
+ <input class="checkbox" type="checkbox" <?php checked( $instance['show_name'], true ); ?> id="<?php echo $this->get_field_id( 'show_name' ); ?>" name="<?php echo $this->get_field_name( 'show_name' ); ?>" /> <?php _e( 'Show name?', 'hybrid-core' ); ?> <code>show_name</code></label>
+ </p>
+ <p>
+ <label for="<?php echo $this->get_field_id( 'show_private' ); ?>">
+ <input class="checkbox" type="checkbox" <?php checked( $instance['show_private'], true ); ?> id="<?php echo $this->get_field_id( 'show_private' ); ?>" name="<?php echo $this->get_field_name( 'show_private' ); ?>" /> <?php _e( 'Show private?', 'hybrid-core' ); ?> <code>show_private</code></label>
+ </p>
+
+ </div>
+ <div style="clear:both;">&nbsp;</div>
+ <?php
+ }
+}
+
+?>
120 classes/widget-calendar.php
@@ -0,0 +1,120 @@
+<?php
+/**
+ * The calendar widget was created to give users the ability to show a post calendar for their blog
+ * using all the available options given in the get_calendar() function. It replaces the default WordPress
+ * calendar widget.
+ *
+ * @package Hybrid
+ * @subpackage Classes
+ * @author Justin Tadlock <justin@justintadlock.com>
+ * @copyright Copyright (c) 2008 - 2012, Justin Tadlock
+ * @link http://themehybrid.com/hybrid-core
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+ */
+
+/**
+ * Calendar Widget Class
+ *
+ * @since 0.6.0
+ */
+class Hybrid_Widget_Calendar extends WP_Widget {
+
+ /**
+ * Set up the widget's unique name, ID, class, description, and other options.
+ *
+ * @since 1.2.0
+ */
+ function __construct() {
+
+ /* Set up the widget options. */
+ $widget_options = array(
+ 'classname' => 'calendar',
+ 'description' => esc_html__( 'An advanced widget that gives you total control over the output of your calendar.', 'hybrid-core' )
+ );
+
+ /* Set up the widget control options. */
+ $control_options = array(
+ 'width' => 200,
+ 'height' => 350
+ );
+
+ /* Create the widget. */
+ $this->WP_Widget(
+ 'hybrid-calendar', // $this->id_base
+ __( 'Calendar', 'hybrid-core' ), // $this->name
+ $widget_options, // $this->widget_options
+ $control_options // $this->control_options
+ );
+ }
+
+ /**
+ * Outputs the widget based on the arguments input through the widget controls.
+ *
+ * @since 0.6.0
+ */
+ function widget( $sidebar, $instance ) {
+ extract( $sidebar );
+
+ /* Get the $initial argument. */
+ $initial = !empty( $instance['initial'] ) ? true : false;
+
+ /* Output the theme's widget wrapper. */
+ echo $before_widget;
+
+ /* If a title was input by the user, display it. */
+ if ( !empty( $instance['title'] ) )
+ echo $before_title . apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base ) . $after_title;
+
+ /* Display the calendar. */
+ echo '<div class="calendar-wrap">';
+ echo str_replace( array( "\r", "\n", "\t" ), '', get_calendar( $initial, false ) );
+ echo '</div><!-- .calendar-wrap -->';
+
+ /* Close the theme's widget wrapper. */
+ echo $after_widget;
+ }
+
+ /**
+ * Updates the widget control options for the particular instance of the widget.
+ *
+ * @since 0.6.0
+ */
+ function update( $new_instance, $old_instance ) {
+
+ $instance['title'] = strip_tags( $new_instance['title'] );
+ $instance['initial'] = ( isset( $new_instance['initial'] ) ? 1 : 0 );
+
+ return $instance;
+ }
+
+ /**
+ * Displays the widget control options in the Widgets admin screen.
+ *
+ * @since 0.6.0
+ */
+ function form( $instance ) {
+
+ /* Set up the default form values. */
+ $defaults = array(
+ 'title' => esc_attr__( 'Calendar', 'hybrid-core' ),
+ 'initial' => false
+ );
+
+ /* Merge the user-selected arguments with the defaults. */
+ $instance = wp_parse_args( (array) $instance, $defaults ); ?>
+
+ <div class="hybrid-widget-controls columns-1">
+ <p>
+ <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'hybrid-core' ); ?></label>
+ <input type="text" class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo esc_attr( $instance['title'] ); ?>" />
+ </p>
+ <p>
+ <input class="checkbox" type="checkbox" <?php checked( $instance['initial'], true ); ?> id="<?php echo $this->get_field_id( 'initial' ); ?>" name="<?php echo $this->get_field_name( 'initial' ); ?>" />
+ <label for="<?php echo $this->get_field_id( 'initial' ); ?>"><?php _e( 'One-letter abbreviation?', 'hybrid-core' ); ?> <code>initial</code></label>
+ </p>
+ </div>
+ <?php
+ }
+}
+
+?>
287 classes/widget-categories.php
@@ -0,0 +1,287 @@
+<?php
+/**
+ * The Categories widget replaces the default WordPress Categories widget. This version gives total
+ * control over the output to the user by allowing the input of all the arguments typically seen
+ * in the wp_list_categories() function.
+ *
+ * @package Hybrid
+ * @subpackage Classes
+ * @author Justin Tadlock <justin@justintadlock.com>
+ * @copyright Copyright (c) 2008 - 2012, Justin Tadlock
+ * @link http://themehybrid.com/hybrid-core
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+ */
+
+/**
+ * Categories Widget Class
+ *
+ * @since 0.6.0
+ */
+class Hybrid_Widget_Categories extends WP_Widget {
+
+ /**
+ * Set up the widget's unique name, ID, class, description, and other options.
+ *
+ * @since 1.2.0
+ */
+ function __construct() {
+
+ /* Set up the widget options. */
+ $widget_options = array(
+ 'classname' => 'categories',
+ 'description' => esc_html__( 'An advanced widget that gives you total control over the output of your category links.', 'hybrid-core' )
+ );
+
+ /* Set up the widget control options. */
+ $control_options = array(
+ 'width' => 800,
+ 'height' => 350
+ );
+
+ /* Create the widget. */
+ $this->WP_Widget(
+ 'hybrid-categories', // $this->id_base
+ __( 'Categories', 'hybrid-core' ), // $this->name
+