MOOOOOOOOOOOOOOOOOOODS!

Signed-off-by: Philip M. Hofer (Frumph) <frumph_dragon@yahoo.com>
This commit is contained in:
Philip M. Hofer (Frumph) 2009-08-24 00:41:30 -07:00
parent 9443bf3bc3
commit df23446e94
48 changed files with 137 additions and 4 deletions

View File

@ -164,6 +164,11 @@ $options = array (
"default" => "no", "default" => "no",
"type" => "comicpress-disable_categories_in_posts"), "type" => "comicpress-disable_categories_in_posts"),
array(
"id" => "comicpress-moods_directory",
"default" => "default",
"type" => "comicpress-moods_directory"),
array("type" => "close") array("type" => "close")
); );

View File

@ -7,7 +7,7 @@ function comicpress_options() {
} }
function comicpress_admin() { function comicpress_admin() {
global $options, $upload_path, $blogcat; global $options, $upload_path, $blogcat, $moods_directory;
?> ?>
@ -388,13 +388,49 @@ function comicpress_admin() {
<?php break; <?php break;
case "comicpress-moods_directory":
$current_directory = get_option($value['id']);
if (empty($current_directory)) $current_directory = 'default';
$count = count($results = glob(get_template_directory() . '/images/moods/'.$current_directory.'/*'));
$mood_directories = glob(get_template_directory() . '/images/moods/*');
?>
<tr>
<th scope="row"><strong>Moods Directory</strong><br /><br />Choose a directory to get the post moods from.<br /></th>
<td valign="top">
<label>
<select name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>">
<?php
foreach ($mood_directories as $mood_dirs) {
if (is_dir($mood_dirs)) {
$mood_dir_name = basename($mood_dirs); ?>
<option class="level-0" value="<?php echo $mood_dir_name; ?>" <?php if ($current_directory == $mood_dir_name) { ?>selected="selected"<?php } ?>><?php echo $mood_dir_name; ?></option>
<?php }
}
?>
</select>
</label>
</td>
<td valign="top">
Found: <?php echo $count; ?> moods in the "<?php echo $current_directory; ?>" directory.<br />
<br />
Mood directories are found in your theme directory/images/moods/* to create your own custom moods just create a directory
under images/moods/ and place ONLY image files inside of it. The name of the image file represents what the mood is.
</td>
</tr>
<?php break;
} }
} }
?> ?>
</table> </table>
</div> </div>
</div> </div>
<input name="comicpress_save" type="submit" class="button-primary" value="Save Settings" />
<input type="hidden" name="action" value="comicpress_save" />
<br />
<br />
<div class="stuffbox"> <div class="stuffbox">
<h3><label for="link_url">Settings - Custom Header</label></h3> <h3><label for="link_url">Settings - Custom Header</label></h3>

View File

@ -64,10 +64,11 @@ if (get_option('upload_path') !== false) {
'disable_css_style_editor' => 'disable_css_style_editor', 'disable_css_style_editor' => 'disable_css_style_editor',
'enable_post_calendar' => 'enable_post_calendar', 'enable_post_calendar' => 'enable_post_calendar',
'enable_post_author_gravatar' => 'enable_post_author_gravatar', 'enable_post_author_gravatar' => 'enable_post_author_gravatar',
'enable_comic_post_calendar' => 'enable_comic_post_calendar', 'enable_comic_post_calendar' => 'enable_comic_post_calendar',
'enable_comic_post_author_gravatar' => 'enable_comic_post_author_gravatar', 'enable_comic_post_author_gravatar' => 'enable_comic_post_author_gravatar',
'disable_tags_in_posts' => 'disable_tags_in_posts', 'disable_tags_in_posts' => 'disable_tags_in_posts',
'disable_categories_in_posts' => 'disable_categories_in_posts', 'disable_categories_in_posts' => 'disable_categories_in_posts',
'moods_directory' => 'moods_directory',
'contact_in_menubar' => 'contact_in_menubar' ) as $options => $variable_name) { 'contact_in_menubar' => 'contact_in_menubar' ) as $options => $variable_name) {
$variables_to_extract[$variable_name] = get_option("comicpress-${options}"); $variables_to_extract[$variable_name] = get_option("comicpress-${options}");
} }
@ -125,6 +126,7 @@ require_once(get_template_directory() . '/functions/relatedposts.php');
require_once(get_template_directory() . '/functions/relatedcomics.php'); require_once(get_template_directory() . '/functions/relatedcomics.php');
require_once(get_template_directory() . '/functions/membersonly.php'); require_once(get_template_directory() . '/functions/membersonly.php');
require_once(get_template_directory() . '/functions/syndication.php'); require_once(get_template_directory() . '/functions/syndication.php');
require_once(get_template_directory() . '/functions/moods.php');
if ($enable_dropdown_sidebar == 'yes') { if ($enable_dropdown_sidebar == 'yes') {

View File

@ -21,6 +21,7 @@ function display_blog_post() {
<?php if ($enable_post_author_gravatar == 'yes') { ?> <?php if ($enable_post_author_gravatar == 'yes') { ?>
<div class="post-author-gravatar"><?php echo str_replace("alt='", "alt='".get_the_author_meta('display_name')."' title='".get_the_author_meta('display_name'),get_avatar(get_the_author_meta('email'), 64)); ?></div> <div class="post-author-gravatar"><?php echo str_replace("alt='", "alt='".get_the_author_meta('display_name')."' title='".get_the_author_meta('display_name'),get_avatar(get_the_author_meta('email'), 64)); ?></div>
<?php } ?> <?php } ?>
<?php if (function_exists('comicpress_show_mood_in_post')) comicpress_show_mood_in_post(); ?>
<?php if ($enable_post_calendar == 'yes') { ?> <?php if ($enable_post_calendar == 'yes') { ?>
<div class="post-date"> <div class="post-date">
<div class="date"><span><?php the_time('M') ?></span> <?php the_time('d') ?></div> <div class="date"><span><?php the_time('M') ?></span> <?php the_time('d') ?></div>

View File

@ -23,6 +23,7 @@ function display_comic_post() {
<?php if ($enable_comic_post_author_gravatar == 'yes') { ?> <?php if ($enable_comic_post_author_gravatar == 'yes') { ?>
<div class="post-author-gravatar"><?php echo str_replace("alt='", "alt='".get_the_author_meta('display_name')."' title='".get_the_author_meta('display_name'),get_avatar(get_the_author_meta('email'), 64)); ?></div> <div class="post-author-gravatar"><?php echo str_replace("alt='", "alt='".get_the_author_meta('display_name')."' title='".get_the_author_meta('display_name'),get_avatar(get_the_author_meta('email'), 64)); ?></div>
<?php } ?> <?php } ?>
<?php if (function_exists('comicpress_show_mood_in_post')) comicpress_show_mood_in_post(); ?>
<?php if ($enable_comic_post_calendar == 'yes') { ?> <?php if ($enable_comic_post_calendar == 'yes') { ?>
<div class="post-date"> <div class="post-date">
<div class="date"><span><?php the_time('M') ?></span> <?php the_time('d') ?></div> <div class="date"><span><?php the_time('M') ?></span> <?php the_time('d') ?></div>

81
functions/moods.php Normal file
View File

@ -0,0 +1,81 @@
<?php
/**
* Theme Function: Moods
* Author: Philip M. Hofer (Frumph)
* Created: 08/22/2009
* Lets you set and make moods for your blog posts.
*
* Usage: if (function_exists('comicpress_show_mood_in_post')) comicpress_show_mood_in_post();
*
* Edit a post and it you will see the possible moods you can use, select one.
*
*/
function comicpress_show_mood_in_post() {
global $post;
$moods_directory = get_option('comicpress-moods_directory');
$mood_file = get_post_meta( get_the_ID(), "mood", true );
$mood = explode(".", $mood);
$mood = reset($mood);
if ( !empty($mood_file) && file_exists(get_template_directory() . '/images/moods/'.$moods_directory.'/'.$mood_file) ) { ?>
<div class="post-mood post-<?php echo $mood; ?>"><img src="<?php bloginfo('stylesheet_directory'); ?>/images/moods/default/<?php echo $mood_file; ?>" alt="<?php echo $mood; ?>" title="<?php echo $mood; ?>" /></div>
<?php }
}
function comicpress_showmood_edit_post() {
global $post;
$moods_directory = get_option('comicpress-moods_directory');
?>
<div id="mooddiv" class="postbox">
<h3><?php _e("Available Moods", 'comicpress') ?></h3>
<div class="inside" style="overflow: hidden">
Available Moods here, you can set which mood images to use in the ComicPress Options.<br />
<br />
<?php
$currentmood = get_post_meta( $post->ID, "mood", true );
if (empty($currentmood)) {
$mood = 'none';
} else {
$mood = explode(".", $currentmood);
$mood = reset($mood);
}
$filtered_glob_results = array();
$count = count($results = glob(get_template_directory() . '/images/moods/'.$moods_directory.'/*'));
echo $count .' moods are available.<br />
Using Moods from directory: '.$moods_directory.'<br />
Current Mood: '.$mood.'<br /><br />';
if (!empty($results)) { ?>
<div style="float:left; margin-top: 10px; text-align: center; width: 68px; padding-top: 64px;">
None.<br />
<label><input name="postmood" id="postmood-none" type="radio" value="none"<?php if ( $mood == "none" ) { echo " checked"; } ?> /></label>
</div>
<?php foreach ($results as $file) {
$newmood_file = basename($file);
$newmood = explode(".", $newmood_file);
$newmood = $newmood[0]; ?>
<div style="float:left; margin-top: 10px; text-align: center; width: 68px; overflow: hidden;">
<img src="<?php bloginfo('stylesheet_directory'); ?>/images/moods/<?php echo $moods_directory; ?>/<?php echo basename($file); ?>"><br />
<?php echo $newmood; ?><br />
<label><input name="postmood" style="margin-top: 3px;" id="postmood-<?php echo $newmood; ?>" type="radio" value="<?php echo $newmood_file; ?>"<?php if ( $mood == $newmood ) { echo " checked"; } ?> /></label>
</div>
<?php }
} ?>
</div>
</div>
<?php }
function comicpress_handle_edit_post_mood_save($post_id) {
if (empty($_POST['postmood']) || $_POST['postmood'] == 'none') {
$postmood = 'none';
} else {
$postmood = $_POST['postmood'];
}
update_post_meta($post_id, 'mood', $postmood);
}
add_action('edit_form_advanced', 'comicpress_showmood_edit_post', 5, 1);
add_action('save_post', 'comicpress_handle_edit_post_mood_save' ,5, 1);
?>

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

View File

@ -516,6 +516,13 @@ h3, h3 a {
height: 63px; height: 63px;
} }
.post-mood {
float: left;
margin: 2px;
width: 63px;
height: 63px;
}
.post-date { .post-date {
color: #777; color: #777;
font-family: 'Georgia' , serif; font-family: 'Georgia' , serif;

View File

@ -65,7 +65,7 @@ function comicpress_menubar() {
<?php if ($contact_in_menubar == 'yes') { ?> <?php if ($contact_in_menubar == 'yes') { ?>
<li class="page_item page-item-contact"><a href="mailto:<?php bloginfo('admin_email'); ?>">Contact</a></li> <li class="page_item page-item-contact"><a href="mailto:<?php bloginfo('admin_email'); ?>">Contact</a></li>
<?php } ?> <?php } ?>
<li><a href="<?php bloginfo('rss2_url'); ?>"><img src="<?php bloginfo('stylesheet_directory'); ?>/images/data_rss.gif" class="rss" alt="RSS" /></a></li> <li class="page_item page-item-rss"><a href="<?php bloginfo('rss2_url'); ?>"><img src="<?php bloginfo('stylesheet_directory'); ?>/images/data_rss.gif" class="rss" alt="RSS" /></a></li>
</ul> </ul>
<div class="clear"></div> <div class="clear"></div>
</div> </div>