mirror of
https://github.com/Frumph/comic-easel.git
synced 2026-07-01 09:24:58 -04:00
Complete rewrite and release of Comic Easel, 05/27/2012 1:43am
This commit is contained in:
+50
-26
@@ -1,6 +1,5 @@
|
||||
<?php
|
||||
if ($_REQUEST['action'] == ('ceo_uploader' || 'ceo_thumb_update' || 'ceo_comic_add' || 'ceo_comic_remove'))
|
||||
require_once('ceo-ajax-functions.php');
|
||||
|
||||
// actions
|
||||
add_action('admin_menu', 'ceo_add_menu_pages');
|
||||
add_action('wp_dashboard_setup', 'ceo_add_dashboard_widgets' );
|
||||
@@ -13,29 +12,16 @@ function ceo_add_menu_pages() {
|
||||
|
||||
$menu_location = 'edit.php?post_type=comic';
|
||||
$plugin_title = __('Comic Easel', 'comiceasel');
|
||||
$library_title = __('Library', 'comiceasel');
|
||||
$config_title = __('Config', 'comiceasel');
|
||||
$debug_title = __('Debug', 'comiceasel');
|
||||
|
||||
// the ceo_pluginfo used here actually initiates it.
|
||||
$library_hook = add_submenu_page($menu_location, $plugin_title . ' - ' . $library_title, $library_title, 'edit_theme_options', 'comiceasel-library', 'ceo_library');
|
||||
// $debug_hook = add_submenu_page($menu_location, $plugin_title . ' - ' . $debug_title, $debug_title, 'edit_theme_options', 'comiceasel-debug', 'ceo_debug');
|
||||
$config_hook = add_submenu_page($menu_location, $plugin_title . ' - ' . $config_title, $config_title, 'edit_theme_options', 'comiceasel-config', 'ceo_manager_config');
|
||||
$debug_hook = add_submenu_page($menu_location, $plugin_title . ' - ' . $debug_title, $debug_title, 'edit_theme_options', 'comiceasel-debug', 'ceo_debug');
|
||||
|
||||
// post_type is only found on the post-new.php with $_GET, so when the $pagenow is post.php it will not be able to strictly determine the post type so it will be executed on all already made post/page edits
|
||||
if ( (isset($_GET['post_type']) && $_GET['post_type'] == 'comic') || $post_type == 'comic') {
|
||||
|
||||
}
|
||||
// Notice how its checking the _GET['page'], do this for the other areas
|
||||
// if you need to execute scripts on the particular areas
|
||||
/* if (isset($_GET['page'])) {
|
||||
switch ($_GET['page']) {
|
||||
case 'comiceasel-chapter-manager':
|
||||
default:
|
||||
add_action('admin_print_scripts-' . $chapter_manager_hook, 'ceo_load_scripts_chapter_manager');
|
||||
break;
|
||||
}
|
||||
} */
|
||||
add_action('admin_head-' . $config_hook, 'ceo_admin_page_head');
|
||||
add_action('admin_print_scripts-' . $config_hook, 'ceo_admin_print_scripts');
|
||||
add_action('admin_print_styles-' . $config_hook, 'ceo_admin_print_styles');
|
||||
ceo_enqueue_admin_cpt_style('comic', 'comic-admin-editor-style', ceo_pluginfo('plugin_url').'/css/admin-editor.css');
|
||||
}
|
||||
|
||||
function ceo_load_scripts_chapter_manager() {
|
||||
@@ -44,6 +30,23 @@ function ceo_load_scripts_chapter_manager() {
|
||||
wp_enqueue_script('jquery-ui-sortable');
|
||||
}
|
||||
|
||||
function ceo_admin_print_scripts() {
|
||||
wp_enqueue_script('utils');
|
||||
wp_enqueue_script('jquery');
|
||||
}
|
||||
|
||||
function ceo_admin_print_styles() {
|
||||
wp_admin_css('css/global');
|
||||
wp_admin_css('css/colors');
|
||||
wp_admin_css('css/ie');
|
||||
wp_enqueue_style('comiceasel-options-style', ceo_pluginfo('plugin_url') . '/css/config.css');
|
||||
}
|
||||
|
||||
|
||||
function ceo_admin_page_head() { ?>
|
||||
<!--[if lt ie 8]> <style> div.show { position: static; margin-top: 1px; } #eadmin div.off { height: 22px; } </style> <![endif]-->
|
||||
<?php }
|
||||
|
||||
// This is done this way to *not* load pages unless they are called, self sufficient code,
|
||||
// but since attached to the ceo-admin it can use the library in core. so the global functions used in multiple areas
|
||||
// go into the ceo-admin.php file, while local functions that are only run on the individual pages go on those pages
|
||||
@@ -57,21 +60,42 @@ function ceo_debug() {
|
||||
require_once('ceo-debug.php');
|
||||
}
|
||||
|
||||
function ceo_library() {
|
||||
require_once('ceo-library.php');
|
||||
}
|
||||
|
||||
/**
|
||||
* This set of functions is for displaying the dashboard feed widget.
|
||||
*
|
||||
*/
|
||||
function ceo_dashboard_feed_widget() {
|
||||
wp_widget_rss_output('http://comicpress.net/?feed=rss2', array('items' => 3, 'show_summary' => true));
|
||||
wp_widget_rss_output('http://frumph.net/?feed=rss2', array('items' => 3, 'show_summary' => true));
|
||||
}
|
||||
|
||||
function ceo_add_dashboard_widgets() {
|
||||
wp_add_dashboard_widget('ceo_dashboard_widget', 'ComicPress.NET News', 'ceo_dashboard_feed_widget');
|
||||
wp_add_dashboard_widget('ceo_dashboard_widget', 'Frumph.NET News', 'ceo_dashboard_feed_widget');
|
||||
}
|
||||
|
||||
function ceo_enqueue_admin_cpt_style( $cpt, $handle, $src = false, $deps = array(), $ver = false, $media = 'all' ) {
|
||||
|
||||
/* Check the admin page we are on. */
|
||||
global $pagenow;
|
||||
|
||||
/* Default to null to prevent enqueuing. */
|
||||
$enqueue = null;
|
||||
|
||||
/* Enqueue style only if we are on the correct CPT editor page. */
|
||||
if ( isset($_GET['post_type']) && $_GET['post_type'] == $cpt && $pagenow == "post-new.php" ) {
|
||||
$enqueue = true;
|
||||
}
|
||||
|
||||
/* Enqueue style only if we are on the correct CPT editor page. */
|
||||
if ( isset($_GET['post']) && $pagenow == "post.php" ) {
|
||||
$post_id = $_GET['post'];
|
||||
$post_obj = get_post( $post_id );
|
||||
if( $post_obj->post_type == $cpt )
|
||||
$enqueue = true;
|
||||
}
|
||||
|
||||
/* Only enqueue if editor page is the correct CPT. */
|
||||
if( $enqueue )
|
||||
wp_enqueue_style( $handle, $src, $deps, $ver, $media );
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -1,48 +0,0 @@
|
||||
<?php
|
||||
// ajax stuff
|
||||
// if both logged in and not logged in users can send this AJAX request,
|
||||
// add both of these actions, otherwise add only the appropriate one
|
||||
// add_action( 'wp_ajax_nopriv_ceo_comic_upload', 'myajax_submit' );
|
||||
add_action( 'wp_ajax_ceo_uploader', 'ceo_comic_upload' );
|
||||
|
||||
// Ajax function to upload and attach files. uploader.php handles uploads, thumb generation, and attaching to post
|
||||
// This ajax function will only work itthe user has edit privlages on the site and is currentl;y logged in.
|
||||
function ceo_comic_upload() {
|
||||
require_once('functions/uploader.php');
|
||||
$result = ceo_handleUpload();
|
||||
// to pass data through iframe you will need to encode all html tags
|
||||
echo htmlspecialchars(json_encode($result), ENT_NOQUOTES);
|
||||
exit;
|
||||
}
|
||||
|
||||
add_action( 'wp_ajax_ceo_thumb_update', 'ceo_comic_thumb_update' );
|
||||
|
||||
// Ajax function to update thumb list on comic edit page when new files are attached to the post by the uploader or the selectbox attacher.
|
||||
//This ajax function will only work itthe user has edit privlages on the site and is currentl;y logged in.
|
||||
function ceo_comic_thumb_update() {
|
||||
$post = get_post( $_GET['post_id']);
|
||||
echo ceo_display_comic_thumbnail_editor('small', $post , false, 198);
|
||||
exit;
|
||||
}
|
||||
|
||||
add_action( 'wp_ajax_ceo_comic_add', 'ceo_comic_add' );
|
||||
// Ajax function to attach files submited in select box. This ajax function will only work itthe user has edit privlages on the site and is currentl;y logged in.
|
||||
function ceo_comic_add() {
|
||||
$comicfiles = $_GET['comicfile'];
|
||||
if (!($comicfiles == '')){
|
||||
$pieces = explode(",", $comicfiles);
|
||||
foreach ($pieces as $comicfile){
|
||||
add_post_meta($_GET['post_id'], 'comic', $comicfile, false);
|
||||
}
|
||||
}
|
||||
return 'success';
|
||||
exit;
|
||||
}
|
||||
add_action( 'wp_ajax_ceo_comic_remove', 'ceo_comic_remove' );
|
||||
// Ajax function to remove files when Remove button is clicked. This ajax function will only work itthe user has edit privlages on the site and is currentl;y logged in.
|
||||
function ceo_comic_remove() {
|
||||
delete_post_meta($_GET['post_id'], 'comic', $_GET['comicfile']);
|
||||
return 'success';
|
||||
exit;
|
||||
}
|
||||
?>
|
||||
+141
-12
@@ -1,15 +1,144 @@
|
||||
<?php
|
||||
// Show Config Variables for right now
|
||||
// var_dump(ceo_pluginfo());
|
||||
?>
|
||||
<div class="wrap">
|
||||
<div id="ceoadmin-headericon" style="background: url('<?php echo ceo_pluginfo('plugin_url') ?>/images/easel_small.png') no-repeat;"></div>
|
||||
<p class="alignleft">
|
||||
<h2><?php _e('Comic Easel - Config','comiceasel'); ?></h2>
|
||||
<table class="widefat">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="3"><?php _e('Variables','comiceasel'); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tr><td>error</td><td><?php echo ceo_pluginfo('error'); ?></td></tr>
|
||||
</table>
|
||||
</p>
|
||||
<div class="clear"></div>
|
||||
<?php
|
||||
$tab = '';
|
||||
if (isset($_GET['tab'])) $tab = wp_filter_nohtml_kses($_GET['tab']);
|
||||
if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'comiceasel_reset') {
|
||||
delete_option('comiceasel-config');
|
||||
global $ceo_pluginfo;
|
||||
$ceo_pluginfo = array();
|
||||
ceo_load_options('reset');
|
||||
?>
|
||||
<div id="message" class="updated"><p><strong><?php _e('Comic Easel Settings RESET!','easel'); ?></strong></p></div>
|
||||
<?php
|
||||
}
|
||||
$ceo_options = get_option('comiceasel-config');
|
||||
if ( isset($_POST['_wpnonce']) && wp_verify_nonce($_POST['_wpnonce'], 'update-options') ) {
|
||||
|
||||
if ($_REQUEST['action'] == 'ceo_save_general') {
|
||||
/*
|
||||
foreach (array(
|
||||
'layout',
|
||||
'scheme'
|
||||
) as $key) {
|
||||
if (isset($_REQUEST[$key]))
|
||||
$easel_options[$key] = wp_filter_nohtml_kses($_REQUEST[$key]);
|
||||
}
|
||||
*/
|
||||
foreach (array(
|
||||
'add_dashboard_frumph_feed_widget',
|
||||
'disable_comic_on_home_page',
|
||||
'disable_comic_blog_on_home_page'
|
||||
) as $key) {
|
||||
if (!isset($_REQUEST[$key])) $_REQUEST[$key] = 0;
|
||||
$ceo_options[$key] = (bool)( $_REQUEST[$key] == 1 ? true : false );
|
||||
}
|
||||
|
||||
$tab = 'general';
|
||||
update_option('comiceasel-config', $ceo_options);
|
||||
}
|
||||
if ($_REQUEST['action'] == 'ceo_save_navigation') {
|
||||
/*
|
||||
foreach (array(
|
||||
'layout',
|
||||
'scheme'
|
||||
) as $key) {
|
||||
if (isset($_REQUEST[$key]))
|
||||
$easel_options[$key] = wp_filter_nohtml_kses($_REQUEST[$key]);
|
||||
}
|
||||
*/
|
||||
foreach (array(
|
||||
'click_comic_next',
|
||||
'navigate_only_chapters',
|
||||
'enable_chapter_nav',
|
||||
'enable_comment_nav',
|
||||
'enable_random_nav',
|
||||
'enable_embed_nav'
|
||||
) as $key) {
|
||||
if (!isset($_REQUEST[$key])) $_REQUEST[$key] = 0;
|
||||
$ceo_options[$key] = (bool)( $_REQUEST[$key] == 1 ? true : false );
|
||||
}
|
||||
|
||||
$tab = 'navigation';
|
||||
update_option('comiceasel-config', $ceo_options);
|
||||
}
|
||||
if ($tab) { ?>
|
||||
<div id="message" class="updated"><p><strong><?php _e('Comic Easel Settings SAVED!','comiceasel'); ?></strong></p></div>
|
||||
<script>function hidemessage() { document.getElementById('message').style.display = 'none'; }</script>
|
||||
<?php }
|
||||
}
|
||||
$ceo_options = get_option('comiceasel-config');
|
||||
?>
|
||||
<div id="poststuff" class="metabox-holder">
|
||||
<div id="ceoadmin">
|
||||
<?php
|
||||
$tab_info = array(
|
||||
'general' => __('General', 'comiceasel'),
|
||||
'navigation' => __('Navigation', 'comiceasel')
|
||||
);
|
||||
if (empty($tab)) { $tab = array_shift(array_keys($tab_info)); }
|
||||
|
||||
foreach($tab_info as $tab_id => $label) { ?>
|
||||
<div id="comiceasel-tab-<?php echo $tab_id ?>" class="comiceasel-tab <?php echo ($tab == $tab_id) ? 'on' : 'off'; ?>"><span><?php echo $label; ?></span></div>
|
||||
<?php }
|
||||
?>
|
||||
</div>
|
||||
|
||||
<div id="comiceasel-options-pages">
|
||||
<?php foreach (glob(ceo_pluginfo('plugin_path') . '/options/*.php') as $file) { include($file); } ?>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
(function($) {
|
||||
var showPage = function(which) {
|
||||
$('#comiceasel-options-pages > div').each(function(i) {
|
||||
$(this)[(this.id == 'comiceasel-' + which) ? 'show' : 'hide']();
|
||||
});
|
||||
};
|
||||
|
||||
$('.comiceasel-tab').click(function() {
|
||||
$('#message').animate({height:"0", opacity:0, margin: 0}, 100, 'swing', function() { $(this).remove() });
|
||||
|
||||
showPage(this.id.replace('comiceasel-tab-', ''));
|
||||
var myThis = this;
|
||||
$('.comiceasel-tab').each(function() {
|
||||
var isSame = (this == myThis);
|
||||
$(this).toggleClass('on', isSame).toggleClass('off', !isSame);
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
showPage('<?php echo esc_js($tab); ?>');
|
||||
}(jQuery));
|
||||
</script>
|
||||
</div>
|
||||
|
||||
<div class="ceoadmin-footer">
|
||||
<br />
|
||||
<?php _e('Created, Developed and maintained by','easel'); ?> <a href="http://frumph.net/">Philip M. Hofer</a> <small>(<a href="http://frumph.net/">Frumph</a>)</small><br />
|
||||
<?php _e('If you like the Comic Easel plugin, please donate. It will help in developing new features and versions.','easel'); ?>
|
||||
<table style="margin:0 auto;">
|
||||
<tr>
|
||||
<td style="width:200px;">
|
||||
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
|
||||
<input type="hidden" name="cmd" value="_s-xclick" />
|
||||
<input type="hidden" name="hosted_button_id" value="46RNWXBE7467Q" />
|
||||
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif" name="submit" alt="PayPal - The safer, easier way to pay online!" />
|
||||
<img alt="" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1" />
|
||||
</form>
|
||||
</td>
|
||||
<td style="width:200px;">
|
||||
<form method="post" id="myForm" name="template" enctype="multipart/form-data" action="">
|
||||
<?php wp_nonce_field('update-options') ?>
|
||||
<input name="easel_reset" type="submit" class="button" value="Reset All Settings" />
|
||||
<input type="hidden" name="action" value="comiceasel_reset" />
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
<div class="wrap">
|
||||
<h2><?php _e('Comic Easel - Image Manager','comiceasel'); ?></h2>
|
||||
</div>
|
||||
<div id="file-uploader-demo1">
|
||||
<noscript>
|
||||
<p>Please enable JavaScript to use file uploader.</p>
|
||||
<!-- or put a simple form for upload here -->
|
||||
</noscript>
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function createUploader(){
|
||||
var uploader = new qq.FileUploader({
|
||||
element: document.getElementById('file-uploader-demo1'),
|
||||
action: '<?php echo admin_url( 'admin-ajax.php' ); ?>',
|
||||
params: {
|
||||
action: 'ceo_uploader'
|
||||
}
|
||||
});
|
||||
}
|
||||
// in your app create uploader as soon as the DOM is readyi
|
||||
// don't wait for the window to load
|
||||
window.onload = createUploader;
|
||||
</script>
|
||||
|
||||
+44
-80
@@ -2,12 +2,12 @@
|
||||
/*
|
||||
Plugin Name: Comic Easel
|
||||
Plugin URI: http://comiceasel.com
|
||||
Description: Manage a Comic with the Easel theme.
|
||||
Version: 1.0
|
||||
Author: Philip M. Hofer (Frumph), Tyler Martin and Contributions from the ComicPress dev team.
|
||||
Description: Comic Easel allows you to incorporate a WebComic using the WordPress Media Library functionality with Navigation into almost any WordPress theme. With just a few modifications of adding *injection* action locations into a theme, you can have the theme of your choice display a comic.
|
||||
Version: 1.0.1
|
||||
Author: Philip M. Hofer (Frumph)
|
||||
Author URI: http://frumph.net/
|
||||
|
||||
Copyright 2010 Philip M. Hofer (Frumph) (email : philip@frumph.net)
|
||||
Copyright 2012 Philip M. Hofer (Frumph) (email : philip@frumph.net)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -30,7 +30,7 @@ add_action('init', 'ceo_initialize_post_types');
|
||||
|
||||
function ceo_initialize_post_types() {
|
||||
$labels = array(
|
||||
'name' => __('Comic Easel', 'comiceasel'),
|
||||
'name' => __('Comics', 'comiceasel'),
|
||||
'singular_name' => __('Comic', 'comiceasel'),
|
||||
'add_new' => __('Add Comic', 'comiceasel'),
|
||||
'add_new_item' => __('Add Comic', 'comiceasel'),
|
||||
@@ -58,9 +58,13 @@ function ceo_initialize_post_types() {
|
||||
'rewrite' => array( 'slug' => 'comic', 'with_front' => true ),
|
||||
'hierarchical' => false,
|
||||
'can_export' => true,
|
||||
'menu_position' => 57,
|
||||
'show_in_menu' => true,
|
||||
'menu_position' => 5,
|
||||
'exclude_from_search' => false,
|
||||
'has_archive' => true,
|
||||
'query_var' => true,
|
||||
'menu_icon' => ceo_pluginfo('plugin_url') . '/images/ceo-icon.png',
|
||||
'supports' => array( 'title', 'editor', 'excerpt', 'author', 'comments', 'thumbnail', 'custom-fields' ),
|
||||
'supports' => array( 'title', 'editor', 'excerpt', 'author', 'comments', 'thumbnail', 'custom-fields', 'revisions', 'trackbacks' ),
|
||||
'description' => 'Post type for Comics'
|
||||
));
|
||||
|
||||
@@ -136,6 +140,7 @@ function ceo_initialize_post_types() {
|
||||
'rewrite' => array( 'slug' => 'location' ),
|
||||
));
|
||||
|
||||
register_taxonomy_for_object_type('post_tag', 'comic');
|
||||
register_taxonomy_for_object_type('chapters', 'comic');
|
||||
register_taxonomy_for_object_type('characters', 'comic');
|
||||
register_taxonomy_for_object_type('locations', 'comic');
|
||||
@@ -143,30 +148,18 @@ function ceo_initialize_post_types() {
|
||||
|
||||
// THIS STUFF ONLY RUNS IN THE WP-ADMIN
|
||||
if (is_admin()) {
|
||||
|
||||
// check if this is a easel theme, if not, dont execute.
|
||||
// This will be removed since actions can be added to any theme.
|
||||
if (strpos(get_template_directory(), 'easel') == false) {
|
||||
if( substr( $_SERVER[ 'PHP_SELF' ], -19 ) != '/wp-admin/index.php' ) return;
|
||||
|
||||
function ceo_no_ceo_theme() {
|
||||
$output = '<div class="error">';
|
||||
$output .= '<h2>'.__('Comic Easel Error','comiceasel').'</h2>';
|
||||
$output .= __('The current theme is not an Easel theme; Comic Easel will not load.','comiceasel').'<br />';
|
||||
$output .='<br />';
|
||||
$output .='</div>';
|
||||
echo $output;
|
||||
}
|
||||
|
||||
add_action( 'admin_notices', 'ceo_no_ceo_theme' );
|
||||
return;
|
||||
}
|
||||
// only load the plugin code of we're in the administration part of WordPress.
|
||||
@require('ceo-admin.php');
|
||||
@require('functions/admin-meta.php');
|
||||
} else {
|
||||
// This style needs to be loaded on all the comic-easel pages inside ceo-core.php instead.
|
||||
wp_enqueue_style('comiceasel-default-style', ceo_pluginfo('plugin_url').'/css/comiceasel.css');
|
||||
}
|
||||
|
||||
add_action('wp_print_styles', 'ceo_run_css');
|
||||
|
||||
// This style needs to be loaded on all the comic-easel pages inside ceo-core.php instead.
|
||||
|
||||
function ceo_run_css() {
|
||||
wp_register_style('comiceasel-style', ceo_pluginfo('plugin_url').'/css/comiceasel.css');
|
||||
wp_enqueue_style('comiceasel-style');
|
||||
}
|
||||
|
||||
// Flush Rewrite Rules & create chapters
|
||||
@@ -178,40 +171,11 @@ function ceo_flush_rewrite() {
|
||||
$wp_rewrite->flush_rules();
|
||||
}
|
||||
|
||||
// Checks chapters, creates them if needs be, checks directories, creates them if need be.
|
||||
// This does not work yet, its purpose is to generate default chapters if no chapters exist.
|
||||
function ceo_checkdefaults() {
|
||||
$checkchapters = get_terms('chapters', 'orderby=count&hide_empty=0');
|
||||
if (empty($checkchapters)) {
|
||||
$bookname = stripslashes(__('Book 1', 'comiceasel'));
|
||||
$bookslug = sanitize_title($bookname);
|
||||
// Should I check for .. the slug of term or name of term?
|
||||
if (!term_exists($bookslug, 'chapters')) {
|
||||
$args = array(
|
||||
'description' => stripslashes(__('The first book.', 'comiceasel')),
|
||||
'slug' => $bookslug
|
||||
);
|
||||
$returned_book_info = wp_insert_term($bookname, 'chapters', $args);
|
||||
$parent_term_id = 0;
|
||||
// should I get term_taxonomy_id ?
|
||||
// old: if (isset($returned_book_info['term_id'])) $parent_term_id = $returned_book_info['term_id'];
|
||||
$parent_term = term_exists( $bookslug, 'chapters' ); // array is returned if taxonomy is given
|
||||
$parent_term_id = $parent_term['term_id']; // get numeric term id
|
||||
|
||||
if ($parent_term_id) {
|
||||
$chaptername = stripslashes(__('Chapter 1', 'comiceasel'));
|
||||
$chapterslug = sanitize_title($chaptername);
|
||||
$args = array(
|
||||
'description' => stripslashes(__('First chapter of Book 1', 'comiceasel')),
|
||||
'slug' => $chapterslug,
|
||||
'parent' => $parent_term_id
|
||||
);
|
||||
$returned_chapter_info = wp_insert_term($chaptername, 'chapters', $args);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// This file contains functions that is used elsewhere in the plugin
|
||||
@require('functions/library.php');
|
||||
|
||||
// Filters that change the behavior of WordPress
|
||||
@require('functions/filters.php');
|
||||
|
||||
// This file handles navigation of the comic
|
||||
@require('functions/navigation.php');
|
||||
@@ -222,6 +186,12 @@ function ceo_checkdefaults() {
|
||||
// This file contains the functions that are injected into the theme
|
||||
@require('functions/injections.php');
|
||||
|
||||
// This file contains all the shortcodes for archives and cast pages
|
||||
@require('functions/shortcodes.php');
|
||||
|
||||
// Redirects /?latest /?random etc.
|
||||
@require('functions/redirects.php');
|
||||
|
||||
/**
|
||||
* This is function ceo_clean_filename
|
||||
*
|
||||
@@ -252,12 +222,15 @@ function ceo_load_options($reset = false) {
|
||||
if (empty($ceo_config)) {
|
||||
delete_option('comiceasel-config');
|
||||
foreach (array(
|
||||
'comic_folder' => 'webcomic',
|
||||
'comic_folder_medium' => 'webcomic-medium',
|
||||
'comic_folder_small' => 'webcomic-small',
|
||||
'medium_comic_width' => '360',
|
||||
'small_comic_width' => '200',
|
||||
'add_dashboard_frumph_feed_widget' => true
|
||||
'add_dashboard_frumph_feed_widget' => true,
|
||||
'disable_comic_on_home_page' => false,
|
||||
'disable_comic_blog_on_home_page' => false,
|
||||
'click_comic_next' => true,
|
||||
'navigate_only_chapters' => true,
|
||||
'enable_chapter_nav' => false,
|
||||
'enable_comments_nav' => true,
|
||||
'enable_random_nav' => true,
|
||||
'enable_embed_nav' => false
|
||||
) as $field => $value) {
|
||||
$ceo_config[$field] = $value;
|
||||
}
|
||||
@@ -269,11 +242,11 @@ function ceo_load_options($reset = false) {
|
||||
|
||||
function ceo_pluginfo($whichinfo = null) {
|
||||
global $ceo_pluginfo;
|
||||
ceo_load_options('reset');
|
||||
// ceo_load_options('reset');
|
||||
if (empty($ceo_pluginfo) || $whichinfo == 'reset') {
|
||||
// Important to assign pluginfo as an array to begin with.
|
||||
$ceo_pluginfo = array();
|
||||
$ceo_options = ceo_load_options('reset'); // TEMP: Reset is temporary
|
||||
$ceo_options = ceo_load_options();
|
||||
$ceo_coreinfo = wp_upload_dir();
|
||||
$ceo_addinfo = array(
|
||||
// if wp_upload_dir reports an error, capture it
|
||||
@@ -289,16 +262,7 @@ function ceo_pluginfo($whichinfo = null) {
|
||||
'style_path' => get_stylesheet_directory(),
|
||||
// comic-easel plugin directory/url
|
||||
'plugin_url' => plugin_dir_url(dirname (__FILE__)) . 'comic-easel',
|
||||
'plugin_path' => trailingslashit(ABSPATH) . ceo_get_plugin_path(),
|
||||
// Comic folders
|
||||
'comic_url' => trailingslashit($ceo_coreinfo['baseurl']) . $ceo_options['comic_folder'],
|
||||
'comic_path' => trailingslashit($ceo_coreinfo['basedir']) . $ceo_options['comic_folder'],
|
||||
// Medium Thumbnail Folder
|
||||
'thumbnail_medium_url' => trailingslashit($ceo_coreinfo['baseurl']) . $ceo_options['comic_folder_medium'],
|
||||
'thumbnail_medium_path' => trailingslashit($ceo_coreinfo['basedir']) . $ceo_options['comic_folder_medium'],
|
||||
// Small Thumbnail Folder
|
||||
'thumbnail_small_url' =>trailingslashit($ceo_coreinfo['baseurl']) . $ceo_options['comic_folder_small'],
|
||||
'thumbnail_small_path' => trailingslashit($ceo_coreinfo['basedir']) . $ceo_options['comic_folder_small']
|
||||
'plugin_path' => trailingslashit(ABSPATH) . ceo_get_plugin_path()
|
||||
);
|
||||
// Combine em.
|
||||
$ceo_pluginfo = array_merge($ceo_pluginfo, $ceo_addinfo);
|
||||
@@ -326,7 +290,7 @@ function ceo_test_information($vartodump) { ?>
|
||||
// Load all the widgets
|
||||
|
||||
foreach (glob(ceo_pluginfo('plugin_path') . '/widgets/*.php') as $widgefile) {
|
||||
@include($widgefile);
|
||||
require_once($widgefile);
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
/* runs in the post editor */
|
||||
|
||||
.admin-comicbox img {
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
@@ -1,82 +0,0 @@
|
||||
.qq-uploader {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.qq-upload-button {
|
||||
display: block; /* or inline-block */
|
||||
width: 105px;
|
||||
padding: 7px 0;
|
||||
text-align: center;
|
||||
background: #000;
|
||||
border-bottom: 1px solid #ddd;
|
||||
color: #fff;
|
||||
}
|
||||
.qq-upload-button-hover {
|
||||
background: #cc0000;
|
||||
}
|
||||
.qq-upload-button-focus {
|
||||
outline: 1px dotted black;
|
||||
}
|
||||
|
||||
.qq-upload-drop-area {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
min-height: 70px;
|
||||
z-index: 2;
|
||||
background: #FF9797;
|
||||
text-align: center;
|
||||
}
|
||||
.qq-upload-drop-area span {
|
||||
display: block;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
width: 100%;
|
||||
margin-top: -8px;
|
||||
font-size: 16px;
|
||||
}
|
||||
.qq-upload-drop-area-active {
|
||||
background: #FF7171;
|
||||
}
|
||||
|
||||
.qq-upload-list {
|
||||
margin: 15px 35px;
|
||||
padding: 0;
|
||||
list-style: disc;
|
||||
}
|
||||
.qq-upload-list li {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
line-height: 15px;
|
||||
font-size: 12px;
|
||||
}
|
||||
.qq-upload-file, .qq-upload-spinner, .qq-upload-size, .qq-upload-cancel, .qq-upload-failed-text {
|
||||
margin-right: 7px;
|
||||
}
|
||||
|
||||
.qq-upload-file {
|
||||
}
|
||||
.qq-upload-spinner {
|
||||
display: inline-block;
|
||||
background: url("/wp-content/plugins/comic-easel/images/loading.gif");
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
vertical-align: text-bottom;
|
||||
}
|
||||
.qq-upload-size, .qq-upload-cancel {
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
.qq-upload-failed-text {
|
||||
display: none;
|
||||
}
|
||||
.qq-upload-fail .qq-upload-failed-text {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
#wpcontent #ceo_comic_in_post select {
|
||||
height: auto;
|
||||
}
|
||||
+123
-11
@@ -3,20 +3,41 @@ Comic Easel - Style.css
|
||||
Defaults for the Comic Easel Elements.
|
||||
*/
|
||||
|
||||
#default-nav-wrapper {
|
||||
width: 100%;
|
||||
table#comic-nav-wrapper {
|
||||
background: none;
|
||||
border: 0;
|
||||
text-align: center;
|
||||
border-collapse: collapse;
|
||||
margin: 0 auto;
|
||||
background: #333 !important;
|
||||
margin: 6px auto;
|
||||
border: solid 1px #000;
|
||||
-moz-border-radius: 5px;
|
||||
-khtml-border-radius: 5px;
|
||||
-webkit-border-radius: 5px;
|
||||
border-radius: 5px;
|
||||
padding: 3px;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.default-nav {
|
||||
margin: 0 auto;
|
||||
width: 300px;
|
||||
}
|
||||
|
||||
.default-nav-base {
|
||||
td.comic-nav {
|
||||
border: 0 !important;
|
||||
display: inline-block;
|
||||
padding: 0 10px;
|
||||
}
|
||||
|
||||
.comic-nav a:link, .comic-nav a:visited {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.comic-nav a:hover {
|
||||
color: #fffc00;
|
||||
}
|
||||
|
||||
.comic-nav-embed {
|
||||
width: 99%;
|
||||
}
|
||||
|
||||
.infotext {
|
||||
font-size: 10px;
|
||||
color: gray;
|
||||
@@ -40,15 +61,106 @@ Defaults for the Comic Easel Elements.
|
||||
color: #ffcf00;
|
||||
}
|
||||
|
||||
.ceo_thumbnail_widget .widget-content {
|
||||
#comic {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#comic {
|
||||
text-align: center;
|
||||
#comic img {
|
||||
margin: 0 auto;
|
||||
padding: 0;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
#blogheader {
|
||||
border-bottom: solid 1px #fff;
|
||||
margin: 10px auto;
|
||||
}
|
||||
|
||||
/* cast archive shorttag */
|
||||
|
||||
.cast-box {
|
||||
width: 520px;
|
||||
padding: 2px;
|
||||
margin: 10px auto;
|
||||
border: solid 1px #ccc;
|
||||
-moz-border-radius: 3px;
|
||||
-khtml-border-radius: 3px;
|
||||
-webkit-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
-moz-box-shadow: 2px 2px 2px #000;
|
||||
-webkit-box-shadow: 2px 2px 2px #000;
|
||||
-khtml-box-shadow: 2px 2px 2px #000;
|
||||
box-shadow: 2px 2px 2px #000;
|
||||
}
|
||||
|
||||
.cast-pic {
|
||||
float: left;
|
||||
width: 150px;
|
||||
height: 150px;
|
||||
border: solid 1px #bff;
|
||||
}
|
||||
|
||||
.cast-info {
|
||||
width: 358px;
|
||||
float: left;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
.cast-comic-link {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
/* Archive Shortcode */
|
||||
|
||||
.comic-archive-chapter-wrap {
|
||||
width: 530px;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.comic-archive-series-description {
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.comic-archive-chapter-description {
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
h2.comic-archive-series-title {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.comic-archive-title {
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
.comic-archive-date {
|
||||
width: 88px;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.comic-archive-thumbnail {
|
||||
width: 150px;
|
||||
float: left;
|
||||
margin-right: 3px;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.comic-archive-list-wrap {
|
||||
padding: 0;
|
||||
list-style-type: none;
|
||||
float: right;
|
||||
width: 376px;
|
||||
}
|
||||
|
||||
.comic-list-alt {
|
||||
background: #f7f7f7;
|
||||
}
|
||||
|
||||
.level-select {
|
||||
font-weight: 700;
|
||||
background: #eee;
|
||||
}
|
||||
|
||||
#comic-foot {
|
||||
text-align: center;
|
||||
}
|
||||
+233
@@ -0,0 +1,233 @@
|
||||
/* Admin Styles Here */
|
||||
|
||||
#ceoadmin-headericon {
|
||||
height: 100px;
|
||||
width: 100px;
|
||||
margin: 14px 6px 0 0;
|
||||
float: left;
|
||||
}
|
||||
|
||||
#ceoadmin {
|
||||
font-family: 'Verdana', sans-serif;
|
||||
font-size: 11px;
|
||||
padding: 5px 0 0 0;
|
||||
line-height: 5px;
|
||||
margin: 0 0 1px 0;
|
||||
overflow: hidden
|
||||
}
|
||||
|
||||
#ceoadmin div {
|
||||
border-top-left-radius: 3px;
|
||||
-moz-border-radius-topleft: 3px;
|
||||
-webkit-border-top-left-radius: 3px;
|
||||
-khtml-border-top-left-radius: 3px;
|
||||
border-top-right-radius: 3px;
|
||||
-moz-border-radius-topright: 3px;
|
||||
-webkit-border-top-right-radius: 3px;
|
||||
-khtml-border-top-right-radius: 3px;
|
||||
}
|
||||
|
||||
#ceoadmin div.off {
|
||||
color: #999;
|
||||
height: 23px;
|
||||
margin: 0 0 0 5px;
|
||||
line-height: 23px;
|
||||
padding: 0 7px;
|
||||
float: left;
|
||||
background: #e9e9e9;
|
||||
border-top: 1px solid #dfdfdf;
|
||||
border-left: solid 1px #dfdfdf;
|
||||
border-right: solid 1px #dfdfdf;
|
||||
position: relative;
|
||||
cursor: pointer;
|
||||
z-index: 20;
|
||||
}
|
||||
#ceoadmin div.on {
|
||||
color: #333;
|
||||
padding: 0 7px;
|
||||
margin: 0 0 0 5px;
|
||||
float: left;
|
||||
background: #fff;
|
||||
border-top: 1px solid #dfdfdf;
|
||||
border-left: 1px solid #dfdfdf;
|
||||
border-right: 1px solid #dfdfdf;
|
||||
border-bottom: 0px;
|
||||
cursor: pointer;
|
||||
height: 24px;
|
||||
line-height: 23px;
|
||||
position: relative;
|
||||
z-index: 100;
|
||||
}
|
||||
|
||||
div.hide {
|
||||
display: none;
|
||||
width: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
div.show {
|
||||
clear: left;
|
||||
display: run-in;
|
||||
position: relative;
|
||||
z-index: 50;
|
||||
}
|
||||
div.show img {
|
||||
float: left;
|
||||
margin: 0 10px 10px 0;
|
||||
}
|
||||
.clear {
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.ceoadmin-footer {
|
||||
padding: 10px;
|
||||
margin: 10px 0 0 0;
|
||||
color: #777;
|
||||
text-align: center;
|
||||
background: #fff;
|
||||
border: 1px solid #dfdfdf;
|
||||
font-family: 'Arial', sans-serif;
|
||||
border-radius: 6px;
|
||||
-moz-border-radius: 6px;
|
||||
-webkit-border-radius: 6px;
|
||||
-khtml-border-radius: 6px;
|
||||
}
|
||||
.ceoadmin-donate {
|
||||
float: right;
|
||||
}
|
||||
.ceoadmin-footer a {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.comiceasel-options {
|
||||
padding: 10px 10px 1px 10px;
|
||||
background: #fff;
|
||||
border-width: 1px 1px 1px 1px;
|
||||
border-style: solid;
|
||||
border-color: #dfdfdf;
|
||||
margin-top: -2px;
|
||||
font: 11px verdana, arial, sans-serif;
|
||||
line-height: 18px;
|
||||
border-top-left-radius: 6px;
|
||||
-moz-border-radius-topleft: 6px;
|
||||
-webkit-border-top-left-radius: 6px;
|
||||
-khtml-border-top-left-radius: 6px;
|
||||
border-top-right-radius: 6px;
|
||||
-moz-border-radius-topright: 6px;
|
||||
-webkit-border-top-right-radius: 6px;
|
||||
-khtml-border-top-right-radius: 6px;
|
||||
}
|
||||
|
||||
.comiceasel-options-save {
|
||||
margin-bottom: 15px;
|
||||
border-width: 0 1px 1px 1px;
|
||||
border-style: solid;
|
||||
border-color: #dfdfdf;
|
||||
border-bottom-left-radius: 6px;
|
||||
-moz-border-radius-bottomleft: 6px;
|
||||
-webkit-border-bottom-left-radius: 6px;
|
||||
-khtml-border-bottom-left-radius: 6px;
|
||||
border-bottom-right-radius: 6px;
|
||||
-moz-border-radius-bottomright: 6px;
|
||||
-webkit-border-bottom-right-radius: 6px;
|
||||
-khtml-border-bottom-right-radius: 6px;
|
||||
}
|
||||
|
||||
.comiceasel-options table.widefat thead tr th {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.comiceasel-options table.widefat label {
|
||||
display: block;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.comiceasel-options table.widefat label.inline-label {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
.comiceasel-options table.widefat select {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.comiceasel-options table.widefat {
|
||||
/* margin-bottom: 10px; */
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
#comiceasel-general .comiceasel-options table.widefat, #comiceasel-addons .comiceasel-options table.widefat {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.comiceasel-options table.widefat th {
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
.comiceasel-options table.widefat th input{
|
||||
margin: 1px;
|
||||
padding: 3px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.comiceasel-options table.widefat th .radio input{
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
.comiceasel-options table.widefat th label {
|
||||
color: #21759b;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.comiceasel-options table.widefat th label:hover {
|
||||
color: #d54e21;
|
||||
}
|
||||
|
||||
.comiceasel-options table.widefat th, .comiceasel-options table.widefat td {
|
||||
vertical-align: middle;
|
||||
}
|
||||
#comiceasel-version-title {
|
||||
font-family: 'Georgia', serif;
|
||||
font-size: 48px;
|
||||
letter-spacing: -2px;
|
||||
margin: 0;
|
||||
padding: 30px 0 5px 0;
|
||||
font-variant: small-caps;
|
||||
}
|
||||
|
||||
#easel-version-title a {
|
||||
color: #333;
|
||||
}
|
||||
|
||||
#comiceasel-version-number {
|
||||
font-family: monospace;
|
||||
font-size: 16px;
|
||||
letter-spacing: 8px;
|
||||
}
|
||||
|
||||
.comiceasel-options .radio {
|
||||
padding-top: 5px;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
div.show .ceoadmin-footer img{
|
||||
float: none;
|
||||
}
|
||||
|
||||
.comiceasel-major-publishing-actions {
|
||||
padding: 6px;
|
||||
clear: both;
|
||||
border-top: none;
|
||||
background: #eaf2fa;
|
||||
}
|
||||
|
||||
.comiceasel-major-publishing-actions input {
|
||||
float: right;
|
||||
min-width: 80px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.alternate {
|
||||
background: #eff;
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
body {
|
||||
font: 12px/16px Arial, Helvetica, sans-serif;
|
||||
}
|
||||
#fileQueue {
|
||||
width: 400px;
|
||||
height: 300px;
|
||||
overflow: auto;
|
||||
border: 1px solid #E5E5E5;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
/*
|
||||
Uploadify v2.1.0
|
||||
Release Date: August 24, 2009
|
||||
|
||||
Copyright (c) 2009 Ronnie Garcia, Travis Nickels
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
.uploadifyQueueItem {
|
||||
font: 11px Verdana, Geneva, sans-serif;
|
||||
border: 2px solid #E5E5E5;
|
||||
background-color: #F5F5F5;
|
||||
margin-top: 5px;
|
||||
padding: 10px;
|
||||
width: 350px;
|
||||
}
|
||||
.uploadifyError {
|
||||
border: 2px solid #FBCBBC !important;
|
||||
background-color: #FDE5DD !important;
|
||||
}
|
||||
.uploadifyQueueItem .cancel {
|
||||
float: right;
|
||||
}
|
||||
.uploadifyProgress {
|
||||
background-color: #FFFFFF;
|
||||
border-top: 1px solid #808080;
|
||||
border-left: 1px solid #808080;
|
||||
border-right: 1px solid #C5C5C5;
|
||||
border-bottom: 1px solid #C5C5C5;
|
||||
margin-top: 10px;
|
||||
width: 100%;
|
||||
}
|
||||
.uploadifyProgressBar {
|
||||
background-color: #0099FF;
|
||||
width: 1px;
|
||||
height: 3px;
|
||||
}
|
||||
+49
-33
@@ -5,15 +5,14 @@ add_filter('manage_edit-comic_columns', 'ceo_add_new_comic_columns');
|
||||
function ceo_add_new_comic_columns($comic_columns) {
|
||||
$new_columns['cb'] = '<input type="checkbox" />';
|
||||
|
||||
$new_columns['title'] = _x('Comic Title Name', 'column name');
|
||||
|
||||
$new_columns['chapter'] = __('Chapter','easel');
|
||||
$new_columns['characters'] = __('Characters','easel');
|
||||
$new_columns['locations'] = __('Location','easel');
|
||||
$new_columns['tags'] = __('Tags', 'easel');
|
||||
$new_columns['title'] = __('Comic Title', 'comiceasel');
|
||||
|
||||
$new_columns['chapter'] = __('Chapter','comiceasel');
|
||||
$new_columns['characters'] = __('Characters','comiceasel');
|
||||
$new_columns['locations'] = __('Location','comiceasel');
|
||||
$new_columns['tags'] = __('Tags', 'comiceasel');
|
||||
$new_columns['date'] = _x('Date', 'column name');
|
||||
$new_columns['comicimages'] = _x('Comic', 'column name');
|
||||
$new_columns['comicimages'] = __('Thumbnail', 'comiceasel');
|
||||
|
||||
return $new_columns;
|
||||
}
|
||||
@@ -52,7 +51,7 @@ function ceo_manage_comic_columns($column_name, $id) {
|
||||
break;
|
||||
case 'comicimages':
|
||||
$post = &get_post($id);
|
||||
$comicthumb = ceo_display_comic_thumbnail('small', $post, false, 100);
|
||||
$comicthumb = ceo_display_comic_thumbnail('thumbnail', $post);
|
||||
if (!$comicthumb) { echo 'No Comic Found.'; } else {
|
||||
echo $comicthumb;
|
||||
}
|
||||
@@ -62,28 +61,20 @@ function ceo_manage_comic_columns($column_name, $id) {
|
||||
} // end switch
|
||||
}
|
||||
|
||||
function ceo_edit_comic_in_post($post) {
|
||||
?>
|
||||
<div class="inside" style="overflow: hidden; width: 100%;">
|
||||
<div id="comicthumbs">
|
||||
<center>
|
||||
<?php echo ceo_display_comic_thumbnail('medium', $post, false, 200); ?><br />
|
||||
</center>
|
||||
</div>
|
||||
function ceo_edit_comic_in_post($post) { ?>
|
||||
<div class="admin-comicbox" style="margin:0; padding:0; overflow:hidden;">
|
||||
<center>
|
||||
<?php echo ceo_display_comic_thumbnail('medium', $post); ?><br />
|
||||
</center>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
function ceo_edit_hovertext_in_post($post) {
|
||||
wp_nonce_field( basename( __FILE__ ), 'comic_hovertext_nonce' );
|
||||
?>
|
||||
<div class="inside" style="overflow: hidden">
|
||||
<table>
|
||||
<td valign="top">
|
||||
Alt Text (Hover) - This is text that is displayed when the mouse is over the comic.<br />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
The text placed here will appear when you mouse over the comic.<br />
|
||||
<textarea name="comic-hovertext" id="comic-hovertext" class="admin-comic-hovertext" style="width:100%"><?php echo esc_attr( get_post_meta( $post->ID, 'hovertext', true ) ); ?></textarea>
|
||||
<?php
|
||||
}
|
||||
|
||||
@@ -94,15 +85,40 @@ function ceo_add_comic_in_post() {
|
||||
add_meta_box('ceo_hovertext_in_post', __('Alt (Hover) Text', 'comiceasel'), 'ceo_edit_hovertext_in_post', 'comic', 'normal', 'high');
|
||||
}
|
||||
|
||||
function ceo_handle_edit_save_comic($post_id) {
|
||||
/* $moods_directory = ceo_pluginfo('moods_directory');
|
||||
if (!empty($moods_directory) && $moods_directory != 'none') {
|
||||
$currentmood = get_post_meta( $post_id, "mood", true );
|
||||
if (isset($_POST['postmood']) && $_POST['postmood'] !== $currentmood) {
|
||||
$postmood = $_POST['postmood'];
|
||||
update_post_meta($post_id, 'mood', $postmood);
|
||||
}
|
||||
} */
|
||||
add_action( 'save_post', 'ceo_handle_edit_save_comic', 10, 2 );
|
||||
|
||||
function ceo_handle_edit_save_comic($post_id, $post) {
|
||||
/* Verify the nonce before proceeding. */
|
||||
if ( !isset( $_POST['comic_hovertext_nonce'] ) || !wp_verify_nonce( $_POST['comic_hovertext_nonce'], basename( __FILE__ ) ) )
|
||||
return $post_id;
|
||||
|
||||
/* Get the post type object. */
|
||||
$post_type = get_post_type_object( $post->post_type );
|
||||
|
||||
/* Check if the current user has permission to edit the post. */
|
||||
if ( !current_user_can( $post_type->cap->edit_post, $post_id ) )
|
||||
return $post_id;
|
||||
|
||||
/* Get the posted data and sanitize it for use as an HTML class. */
|
||||
$new_meta_value = ( isset( $_POST['comic-hovertext'] ) ? esc_textarea( $_POST['comic-hovertext'] ) : '' );
|
||||
|
||||
/* Get the meta key. */
|
||||
$meta_key = 'hovertext';
|
||||
|
||||
/* Get the meta value of the custom field key. */
|
||||
$meta_value = get_post_meta( $post_id, $meta_key, true );
|
||||
|
||||
/* If a new meta value was added and there was no previous value, add it. */
|
||||
if ( $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 ( $new_meta_value && $new_meta_value != $meta_value )
|
||||
update_post_meta( $post_id, $meta_key, $new_meta_value );
|
||||
|
||||
/* If there is no new meta value but an old value exists, delete it. */
|
||||
elseif ( '' == $new_meta_value && $meta_value )
|
||||
delete_post_meta( $post_id, $meta_key, $meta_value );
|
||||
}
|
||||
|
||||
|
||||
|
||||
+41
-331
@@ -1,79 +1,25 @@
|
||||
<?php
|
||||
|
||||
// If any errors occur while searching for a comic file, the error messages will be pushed into here.
|
||||
$comic_pathfinding_errors = array();
|
||||
|
||||
// If ComicPress Manager is installed, use the date format defined there. If not, default to
|
||||
// Y-m-d.. It's best to use CPM's date definition for improved operability between theme and plugin.
|
||||
|
||||
if (defined("CPM_DATE_FORMAT")) {
|
||||
define("CP_DATE_FORMAT", CPM_DATE_FORMAT);
|
||||
} else {
|
||||
define("CP_DATE_FORMAT", "Y-m-d");
|
||||
function ceo_display_comic($size = 'full') {
|
||||
global $post;
|
||||
$post_image_id = get_post_thumbnail_id($post->ID);
|
||||
if ($post_image_id) {
|
||||
$thumbnail = wp_get_attachment_image_src( $post_image_id, $size, false);
|
||||
$thumbnail = reset($thumbnail);
|
||||
$hovertext = ceo_the_hovertext();
|
||||
$next_comic = ceo_get_next_comic_permalink();
|
||||
if (ceo_pluginfo('click_comic_next') && !empty($next_comic)) {
|
||||
$output = '<a href="'.$next_comic.'">';
|
||||
}
|
||||
$output .= '<img src="'.$thumbnail.'" alt="'.$hovertext.'" title="'.$hovertext.'" />';
|
||||
if (ceo_pluginfo('click_comic_next') && !empty($next_comic)) {
|
||||
$output .= '</a>';
|
||||
}
|
||||
return apply_filters('ceo_comics_display_comic', $output);
|
||||
} else
|
||||
return "No Comic (featured image) Found. Set One.";
|
||||
}
|
||||
|
||||
// If you want to run multiple comics on a single day, define your additional filters here.
|
||||
// Example: you want to run an additional comic with the filename 2008-01-01-a-my-new-years-comic.jpg.
|
||||
// Define an additional filter in the list below:
|
||||
//
|
||||
// $comic_filename_filters['secondary'] = "{date}-a*.*";
|
||||
//
|
||||
// Then show the second comic on your page by calling the_comic with your filter name (PHP tags munged
|
||||
// to maintain valid file syntax):
|
||||
//
|
||||
//
|
||||
// Note that it's quite possible to slurp up the wrong file if your expressions are too broad.
|
||||
|
||||
$comic_filename_filters = array();
|
||||
$comic_filename_filters['default'] = "{date}*.*";
|
||||
|
||||
// TODO: Change this to $output at some point.
|
||||
function ceo_display_comic_navigation() {
|
||||
global $post, $wp_query;
|
||||
$first_comic = ceo_get_first_comic_permalink();
|
||||
$first_text = __('‹‹ First','comiceasel');
|
||||
$last_comic = ceo_get_last_comic_permalink();
|
||||
$last_text = __('Last ››','comiceasel');
|
||||
$next_comic = ceo_get_next_comic_permalink();
|
||||
$next_text = __('Next ›','comiceasel');
|
||||
$prev_comic = ceo_get_previous_comic_permalink();
|
||||
$prev_text = __('‹ Prev','comiceasel');
|
||||
?>
|
||||
<div id="default-nav-wrapper">
|
||||
<div class="default-nav">
|
||||
<div class="default-nav-base default-nav-first"><?php if ( get_permalink() != $first_comic ) { ?><a href="<?php echo $first_comic ?>"><?php echo $first_text; ?></a><?php } else { echo $first_text; } ?></div>
|
||||
<div class="default-nav-base default-nav-previous"><?php if ($prev_comic) { ?><a href="<?php echo $prev_comic ?>"><?php echo $prev_text; ?></a><?php } else { echo $prev_text; } ?></div>
|
||||
<div class="default-nav-base default-nav-last"><?php if ( get_permalink() != $last_comic ) { ?><a href="<?php echo $last_comic ?>"><?php echo $last_text; ?></a><?php } else { echo $last_text; } ?></div>
|
||||
<div class="default-nav-base default-nav-next"><?php if ($next_comic) { ?><a href="<?php echo $next_comic ?>"><?php echo $next_text; ?></a><?php } else { echo $next_text; } ?></div>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
function ceo_display_comic_swf($post, $comic) {
|
||||
$file_url = ceo_pluginfo('base_url') .'/' . ceo_clean_filename($comic);
|
||||
$height = get_post_meta( $post->ID, "fheight", true );
|
||||
$width = get_post_meta( $post->ID, "fwidth", true );
|
||||
if (empty($height)) $height = '300';
|
||||
if (empty($width)) $width = '100%';
|
||||
$output = "<object id=\"myId\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\"{$width}\" height=\"{$height}\">\r\n";
|
||||
$output .= " <param name=\"movie\" value=\"".$file_url."\" />\r\n";
|
||||
$output .= "<!--[if !IE]>--><object type=\"application/x-shockwave-flash\" data=\"".$file_url."\" width=\"{$width}\" height=\"{$height}\"><!--<![endif]-->\r\n";
|
||||
$output .= " <div>\r\n";
|
||||
$output .= " <h1>Get Flash!</h1>\r\n";
|
||||
$output .= " <p><a href=\"http://www.adobe.com/go/getflashplayer\"><img src=\"http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif\" alt=\"Get Adobe Flash player\" /></a></p>\r\n";
|
||||
$output .= " </div>\r\n";
|
||||
$output .= "<!--[if !IE]>--></object><!--<![endif]--></object>\r\n";
|
||||
add_action('wp_footer', 'ceo_init_comic_swf');
|
||||
return apply_filters('ceo_display_comic_swf',$output);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display text when image (comic) is hovered
|
||||
* Text is taken from a custom field named "hovertext"
|
||||
*/
|
||||
function ceo_the_hovertext($override_post = null) {
|
||||
global $post;
|
||||
$post_to_use = !is_null($override_post) ? $override_post : $post;
|
||||
@@ -81,274 +27,38 @@ function ceo_the_hovertext($override_post = null) {
|
||||
return (empty($hovertext)) ? get_the_title($post_to_use->ID) : $hovertext;
|
||||
}
|
||||
|
||||
function ceo_init_comic_swf() {
|
||||
wp_enqueue_script('swfobject');
|
||||
}
|
||||
|
||||
// This function will let authors who want to use comicpress as a way to output their books/text in a comic area as a page.
|
||||
function ceo_display_comic_text($comic) {
|
||||
if (file_exists(ceo_pluginfo('base_path') . $comic)) {
|
||||
$output = nl2br(file_get_contents(ceo_pluginfo('base_path') . $comic));
|
||||
// We use this type of query so that $post is set, it's already set with is_single - but needs to be set on the home page
|
||||
function ceo_display_comic_area() {
|
||||
global $wp_query, $post;
|
||||
if (is_single()) {
|
||||
ceo_display_comic_wrapper();
|
||||
} else {
|
||||
if (is_home() && !is_paged() && ceo_pluginfo('display_comic_on_home')) {
|
||||
ceo_Protect();
|
||||
$comic_args = array(
|
||||
'posts_per_page' => 1,
|
||||
'post_type' => 'comic'
|
||||
);
|
||||
$wp_query->in_the_loop = true; $comicFrontpage = new WP_Query(); $comicFrontpage->query($comic_args);
|
||||
while ($comicFrontpage->have_posts()) : $comicFrontpage->the_post();
|
||||
ceo_display_comic_wrapper();
|
||||
endwhile;
|
||||
ceo_UnProtect();
|
||||
}
|
||||
}
|
||||
return apply_filters('ceo_display_comic_text', $output);
|
||||
}
|
||||
|
||||
|
||||
// Do the thumbnail display functions here.
|
||||
function ceo_display_comic_thumbnail($type = 'small', $override_post = null, $use_post_image = false, $setwidth = 0) {
|
||||
function ceo_display_comic_thumbnail($thumbnail_size = 'thumbnail', $override_post = null) {
|
||||
global $post;
|
||||
$thumbnail = '';
|
||||
$post_to_use = !empty($override_post) ? $override_post : $post;
|
||||
|
||||
// use_post_image if its set to true
|
||||
if ($use_post_image) {
|
||||
$post_image_id = get_post_thumbnail_id($post_to_use->ID);
|
||||
if ($post_image_id) {
|
||||
$thumbnail = wp_get_attachment_image_src( $post_image_id, 'post-thumbnail', false);
|
||||
if ($thumbnail) (string)$thumbnail = $thumbnail[0];
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($thumbnail)) {
|
||||
if (count($thumb_found = get_comic_path($type, $post_to_use)) > 0) {
|
||||
// adjust the thumbnail directories of all of them not just one, time to stop outputting them singularly and do array
|
||||
$thumbnail = array();
|
||||
if (!empty($thumb_found)) {
|
||||
foreach ($thumb_found as $thumb) {
|
||||
$thumbnail[] = ceo_pluginfo('base_url') . ceo_clean_filename($thumb);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($thumbnail)) {
|
||||
// TODO: Need to determine the filename's extension at this point and mark it as such for those who don't have thumbnails.
|
||||
return false;
|
||||
}
|
||||
|
||||
$output = '';
|
||||
if (is_array($thumbnail)) {
|
||||
foreach ($thumbnail as $thumb) {
|
||||
if ($setwidth) {
|
||||
$output .= '<img src="'.$thumb.'" alt="'.get_the_title($post_to_use).'" style="max-width:'.$setwidth.'px" class="comicthumbnail" title="'.get_the_title($post_to_use).'" />'."\r\n";
|
||||
} else {
|
||||
$output .= '<img src="'.$thumb.'" alt="'.get_the_title($post_to_use).'" width="" class="comicthumbnail" title="'.get_the_title($post_to_use).'" />'."\r\n";
|
||||
}
|
||||
}
|
||||
if ( has_post_thumbnail($post_to_use->ID) ) {
|
||||
$output = '<a href="'.get_permalink($post_to_use->ID).'" rel="bookmark" title="'.get_the_title().'">'.get_the_post_thumbnail($post_to_use->ID, $thumbnail_size).'</a>'."\r\n";
|
||||
} else {
|
||||
if ($setwidth) {
|
||||
$output = '<img src="'.$thumbnail.'" alt="'.get_the_title($post_to_use).'" style="max-width:'.$setwidth.'px" class="comicthumbnail" title="'.get_the_title($post_to_use).'" />'."\r\n";
|
||||
} else {
|
||||
$output = '<img src="'.$thumbnail.'" alt="'.get_the_title($post_to_use).'" width="" class="comicthumbnail" title="'.get_the_title($post_to_use).'" />'."\r\n";
|
||||
}
|
||||
// $output = "No Thumbnail Found.";
|
||||
}
|
||||
// if ($count > 1) $output = $count.' comics attached.<br />'.$output;
|
||||
|
||||
return apply_filters('ceo_display_comic_thumbnail', $output);
|
||||
return apply_filters('easel_display_comic_thumbnail', $output);
|
||||
}
|
||||
|
||||
// TODO: Add the hovertext - rascal code and click to next INSIDE this.
|
||||
function ceo_display_comic_image($post, $comic) {
|
||||
$file_url = ceo_pluginfo('base_url') . ceo_clean_filename($comic);
|
||||
if (ceo_pluginfo('rascal_says')) {
|
||||
$alt_text = get_the_title($post);
|
||||
} else {
|
||||
$alt_text = ceo_the_hovertext($post);
|
||||
}
|
||||
$output = '<img src="'.$file_url.'" alt="'.$alt_text.'" title="'.$alt_text.'" />';
|
||||
return apply_filters('ceo_display_comic_image',$output);
|
||||
}
|
||||
|
||||
// jquery code image swap by @brianarn
|
||||
function ceo_display_comic() {
|
||||
global $post;
|
||||
$comics = get_comic_path('comic', $post);
|
||||
if (is_array($comics)) {
|
||||
$count = 1;
|
||||
$outputlist = ''; $output = '';
|
||||
foreach ($comics as $comic) {
|
||||
$comicsplit = explode(".", $comic);
|
||||
switch (strtolower($comicsplit[1])) {
|
||||
case 'swf':
|
||||
$output .= '<div id="comic-'.$count.'" class="comicpane">';
|
||||
$output .= ceo_display_comic_swf($post, $comic);
|
||||
$output .= "</div>\r\n";
|
||||
$outputlist .= "<button id=\"show-".$count."\" type=\"button\">".$count."</button>\r\n";
|
||||
$count += 1;
|
||||
break;
|
||||
case 'txt':
|
||||
case 'inc':
|
||||
case 'htm':
|
||||
$output .= '<div id="comic-'.$count.'" class="comicpane">';
|
||||
$output .= ceo_display_comic_text($comic);
|
||||
$output .= "</div>\r\n";
|
||||
$outputlist .= "<button id=\"show-".$count."\" type=\"button\">".$count."</button>\r\n";
|
||||
$count += 1;
|
||||
break;
|
||||
case 'png':
|
||||
case 'gif':
|
||||
case 'jpg':
|
||||
case 'jpeg':
|
||||
case 'tif':
|
||||
case 'tiff':
|
||||
case 'bmp':
|
||||
default:
|
||||
$output .= '<div id="comic-'.$count.'" class="comicpane">';
|
||||
$output .= ceo_display_comic_image($post, $comic);
|
||||
$output .= "</div>\r\n";
|
||||
$outputlist .= "<button id=\"show-".$count."\" type=\"button\">".$count."</button>\r\n";
|
||||
$count += 1;
|
||||
}
|
||||
}
|
||||
if ($count > 2 && ceo_pluginfo('enable_multicomic_jquery')) {
|
||||
// Add the script stuff before the rest here.
|
||||
$output = $outputscript . $output;
|
||||
}
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
function ceo_comic_clicks_next($output) {
|
||||
global $post, $wp_query;
|
||||
if (is_search() || is_archive() || is_feed()) return $output;
|
||||
$hovertext = ceo_the_hovertext($post);
|
||||
$next_comic = ceo_get_next_comic_permalink();
|
||||
if (empty($next_comic)) $next_comic = '#';
|
||||
$class = '';
|
||||
if (ceo_pluginfo('rascal_says')) {
|
||||
$the_title = get_the_title($post);
|
||||
$class='class="tt"';
|
||||
} else {
|
||||
$the_title = ceo_the_hovertext($post);
|
||||
}
|
||||
$output = "<a {$class} href=\"{$next_comic}\" title=\"{$the_title}\">{$output}</a>\r\n";
|
||||
return $output;
|
||||
}
|
||||
|
||||
function ceo_rascal_says($output) {
|
||||
global $post, $wp_query;
|
||||
if (is_search() || is_archive() || is_feed()) return $output;
|
||||
$hovertext = get_post_meta( $post->ID, "hovertext", true );
|
||||
$href_to_use = "#";
|
||||
if (!empty($hovertext)) {
|
||||
$output = preg_replace('#title="([^*]*)"#', '', $output);
|
||||
$output = "<span class=\"tooltip\"><span class=\"top\"> </span><span class=\"middle\">{$hovertext}</span><span class=\"bottom\"> </span></span>{$output}\r\n";
|
||||
}
|
||||
if (ceo_pluginfo('comic_clicks_next')) {
|
||||
$href_to_use = ceo_get_next_comic_permalink();
|
||||
if (empty($href_to_use)) $href_to_use = "#";
|
||||
$output = "<a href=\"{$href_to_use}\" class=\"tt\" title=\"".$post->post_title."\">{$output}</a>";
|
||||
} else {
|
||||
$output = "<a class=\"tt\" href=\"{$href_to_use}\" title=\"".$post->post_title."\">{$output}</a>";
|
||||
}
|
||||
return apply_filters('ceo_rascal_says',$output);
|
||||
}
|
||||
|
||||
if (ceo_pluginfo('rascal_says')) {
|
||||
add_filter('ceo_display_comic_image', 'ceo_rascal_says');
|
||||
}
|
||||
|
||||
if (ceo_pluginfo('comic_clicks_next') && !ceo_pluginfo('rascal_says')) {
|
||||
add_filter('ceo_display_comic_image', 'ceo_comic_clicks_next');
|
||||
}
|
||||
|
||||
/**
|
||||
* Find a comic file in the filesystem.
|
||||
* @param string $folder The folder name to search.
|
||||
* @param string $override_post A WP Post object to use in place of global $post.
|
||||
* @param string $filter The $comic_filename_filters to use.
|
||||
* @return string The relative path to the comic file, or false if not found.
|
||||
*/
|
||||
|
||||
function get_comic_path($folder = 'comic', $override_post = null, $filter = 'default') {
|
||||
global $post, $comic_filename_filters, $comic_pathfinding_errors;
|
||||
|
||||
$post_to_use = !empty($override_post) ? $override_post : $post;
|
||||
|
||||
$meta_name = 'comic';
|
||||
|
||||
if (function_exists('xlanguage_current_language_code'))
|
||||
$meta_name .= '-'.xlanguage_current_language_code();
|
||||
|
||||
$comicfile = get_post_meta( $post_to_use->ID, $meta_name, false );
|
||||
|
||||
// Backswards compatibility here
|
||||
|
||||
switch ($folder) {
|
||||
case "medium": $subfolder_to_use = ceo_pluginfo('comic_folder_medium'); break;
|
||||
case "small": $subfolder_to_use = ceo_pluginfo('comic_folder_small'); break;
|
||||
case "comic": default: $subfolder_to_use = ceo_pluginfo('comic_folder'); break;
|
||||
}
|
||||
|
||||
$folder_to_use = ceo_pluginfo('base_path') . $subfolder_to_use;
|
||||
|
||||
/* if (!is_dir($folder_to_use . '/' . $comicfile) && $folder !== 'comic')
|
||||
$folder_to_use = ceo_pluginfo('base_path') . '/' . ceo_pluginfo('comic_folder'); */
|
||||
|
||||
if (!empty($comicfile)) {
|
||||
// return this as an array if we want to include in the future multiple comics found type thing, keeping it compatible.
|
||||
$newresults = array();
|
||||
foreach ($comicfile as $comic) {
|
||||
if (!file_exists($folder_to_use . '/' . $comic) && $folder !== 'comic')
|
||||
$subfolder_to_use = ceo_pluginfo('comic_folder');
|
||||
$newresults[] = $subfolder_to_use .'/' .$comic;
|
||||
}
|
||||
return $newresults;
|
||||
|
||||
} else {
|
||||
// backwards compatibility
|
||||
if (isset($comic_filename_filters[$filter])) {
|
||||
$filter_to_use = $comic_filename_filters[$filter];
|
||||
} else {
|
||||
$filter_to_use = '{date}*.*';
|
||||
}
|
||||
$post_date = mysql2date(CP_DATE_FORMAT, $post_to_use->post_date);
|
||||
$filter_with_date = str_replace('{date}', $post_date, $filter_to_use);
|
||||
|
||||
$results = array();
|
||||
if (count($results = glob("${folder_to_use}/${filter_with_date}")) > 0) {
|
||||
$newresults = array();
|
||||
foreach ($results as $result) {
|
||||
// Strip the base directory off.
|
||||
$newresults[] = str_replace(ceo_pluginfo('base_path'), '', $result);
|
||||
}
|
||||
return $newresults;
|
||||
|
||||
}
|
||||
// fallback to the comics directory ^ if nothing returned above.
|
||||
$folder_to_use = ceo_pluginfo('base_path') . ceo_pluginfo('comic_folder');
|
||||
if (count($results = glob("${folder_to_use}/${filter_with_date}")) > 0) {
|
||||
$newresults = array();
|
||||
foreach ($results as $result) {
|
||||
// Strip the base directory off.
|
||||
$newresults[] = str_replace(ceo_pluginfo('base_path'), '', $result);
|
||||
}
|
||||
return $newresults;
|
||||
}
|
||||
}
|
||||
|
||||
$comic_pathfinding_errors[] = sprintf(__("Unable to find the file in the <strong>%s</strong> folder that matched the pattern <strong>%s</strong>. Check your WordPress and ComicPress settings.", 'comicpress'), $folder_to_use, $filter_with_date);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Find a comic file in the filesystem and return an absolute URL to that file.
|
||||
* @param string $folder The folder name to search.
|
||||
* @param string $override_post A WP Post object to use in place of global $post.
|
||||
* @param string $filter The $comic_filename_filters to use.
|
||||
* @return string The absolute URL to the comic file, or false if not found.
|
||||
*/
|
||||
function get_comic_url($folder = 'comic', $override_post = null, $filter = 'default') {
|
||||
if (($results = get_comic_path($folder, $override_post, $filter)) !== false) {
|
||||
$newresults = array();
|
||||
foreach ($results as $result) {
|
||||
$newresults[] = ceo_pluginfo('base_url') . $result;
|
||||
}
|
||||
return $newresults;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/* Filters */
|
||||
|
||||
add_filter('request', 'ceo_rss_request'); // Add comics to the main RSS
|
||||
add_filter('the_content_rss','ceo_insert_comic_into_feed'); // Insert the comic image into the rss
|
||||
add_filter('the_excerpt_rss','ceo_insert_comic_into_feed');
|
||||
add_filter('the_content', 'ceo_insert_comic_into_archive'); // Insert the comic into the archive and search pages
|
||||
add_filter('the_excerpt', 'ceo_insert_comic_into_archive');
|
||||
add_filter('previous_post_rel_link', 'ceo_change_prev_rel_link_two', $link); // change the rel links for comic pages
|
||||
add_filter('next_post_rel_link', 'ceo_change_next_rel_link_two', $link);
|
||||
|
||||
function ceo_rss_request($qv) {
|
||||
if (isset($qv['feed']) && !isset($qv['post_type'])) {
|
||||
$qv['post_type'] = array('post', 'comic');
|
||||
}
|
||||
return $qv;
|
||||
}
|
||||
|
||||
function ceo_insert_comic_into_feed($content) {
|
||||
global $wp_query, $post;
|
||||
if (is_feed() && $post->post_type == 'comic') {
|
||||
$content = '<p>'. ceo_display_comic_thumbnail('full', $post) . '</p>' . $content;
|
||||
}
|
||||
return apply_filters('ceo_insert_comic_into_feed', $content);
|
||||
}
|
||||
|
||||
function ceo_insert_comic_into_archive($content) {
|
||||
global $wp_query, $post;
|
||||
if (is_archive() || is_search() && ($post->post-type == 'comic') && !is_single() && !is_feed()) {
|
||||
$content = '<p>'.ceo_display_comic_thumbnail('medium', $post) . '</p>' . $content;
|
||||
}
|
||||
return apply_filters('ceo_insert_comic_into_archive', $content);
|
||||
}
|
||||
|
||||
function ceo_change_prev_rel_link_two($object) {
|
||||
global $post, $wp_query;
|
||||
if ($post->post_type=='comic' || is_home()) $link='<link rel="previous" href="'.ceo_get_previous_comic_permalink().'" />'."\r\n";
|
||||
return $link;
|
||||
}
|
||||
|
||||
function ceo_change_next_rel_link_two($object) {
|
||||
global $post;
|
||||
if ($post->post_type=='comic') $link='<link rel="next" href="'.ceo_get_next_comic_permalink().'" />'."\r\n";
|
||||
return $link;
|
||||
}
|
||||
|
||||
|
||||
+143
-63
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
// Injected with a poison.
|
||||
add_action('easel-post-foot', 'ceo_display_edit_link');
|
||||
add_action('comic-post-foot', 'ceo_display_edit_link');
|
||||
|
||||
function ceo_display_edit_link() {
|
||||
global $post;
|
||||
@@ -10,52 +10,91 @@ function ceo_display_edit_link() {
|
||||
}
|
||||
}
|
||||
|
||||
add_filter('easel_display_post_category', 'ceo_display_comic_chapters');
|
||||
add_action('comic-post-info', 'ceo_display_comic_chapters');
|
||||
|
||||
// TODO: Make this actually output a chapter set that the comic is in, instead of the post-type
|
||||
function ceo_display_comic_chapters($post_category) {
|
||||
global $post;
|
||||
if ($post->post_type == 'comic') {
|
||||
$before = '<div class="comic-chapter">Chapter: ';
|
||||
$before = '<div class="comic-chapter">Story: ';
|
||||
$sep = ', ';
|
||||
$after = '</div>';
|
||||
$post_category = get_the_term_list( $post->ID, 'chapters', $before, $sep, $after );
|
||||
}
|
||||
return apply_filters('ceo_display_comic_chapters', $post_category);
|
||||
echo apply_filters('ceo_display_comic_chapters', $post_category);
|
||||
}
|
||||
|
||||
add_action('easel-content-area', 'ceo_display_comic_area');
|
||||
// var_dump(ceo_pluginfo('disable_comic_on_home_page'));
|
||||
|
||||
function ceo_display_comic_area() {
|
||||
global $wp_query, $post;
|
||||
if (is_single()) {
|
||||
ceo_display_comic_wrapper();
|
||||
} /* else {
|
||||
if (is_home() && !is_paged()) {
|
||||
Protect();
|
||||
$comic_args = array(
|
||||
'posts_per_page' => 1,
|
||||
'post_type' => 'comic'
|
||||
);
|
||||
$wp_query->in_the_loop = true; $comicFrontpage = new WP_Query(); $comicFrontpage->query($comic_args);
|
||||
while ($comicFrontpage->have_posts()) : $comicFrontpage->the_post();
|
||||
ceo_display_comic_wrapper();
|
||||
endwhile;
|
||||
UnProtect();
|
||||
}
|
||||
} */
|
||||
|
||||
add_action('comic-area', 'ceo_display_comic_area');
|
||||
|
||||
if (!function_exists('ceo_display_comic_navigation')) {
|
||||
function ceo_display_comic_navigation() {
|
||||
global $post, $wp_query;
|
||||
|
||||
$first_comic = ceo_get_first_comic_permalink();
|
||||
$first_text = __('‹‹ First','easel');
|
||||
$last_comic = ceo_get_last_comic_permalink();
|
||||
$last_text = __('Last ››','easel');
|
||||
$next_comic = ceo_get_next_comic_permalink();
|
||||
$next_text = __('Next ›','easel');
|
||||
$prev_comic = ceo_get_previous_comic_permalink();
|
||||
$prev_text = __('‹ Prev','easel');
|
||||
?>
|
||||
<table id="comic-nav-wrapper">
|
||||
<tr class="comic-nav-container">
|
||||
<td class="comic-nav"><?php if ( get_permalink() != $first_comic ) { ?><a href="<?php echo $first_comic ?>" class="comic-nav-first<?php if ( get_permalink() == $first_comic ) { ?> comic-nav-inactive<?php } ?>"><?php echo $first_text; ?></a><?php } else { echo $first_text; } ?></td>
|
||||
<td class="comic-nav"><?php if ($prev_comic) { ?><a href="<?php echo $prev_comic ?>" class="comic-nav-previous<?php if (!$prev_comic) { ?> comic-nav-inactive<?php } ?>"><?php echo $prev_text; ?></a><?php } else { echo $prev_text; } ?></td>
|
||||
<?php if (ceo_pluginfo('enable_comment_nav')) { ?>
|
||||
<td class="comic-nav"><a href="<?php comments_link(); ?>" class="comic-nav-comments" title="<?php the_title(); ?>"><?php _e('Comments','comiceasel'); ?>(<span class="comic-nav-comment-count"><?php comments_number( '0', '1', '%' ); ?></span>)</a></td>
|
||||
<?php } ?>
|
||||
<?php if (ceo_pluginfo('enable_random_nav')) { ?>
|
||||
<td class="comic-nav"><a href="<?php bloginfo('url') ?>?random&nocache=1" class="comic-nav-random" title="Random Comic"><?php _e('Random','comiceasel'); ?></a></td>
|
||||
<?php } ?>
|
||||
<td class="comic-nav"><?php if ($next_comic) { ?><a href="<?php echo $next_comic ?>" class="comic-nav-next<?php if (!$next_comic) { ?> comic-nav-inactive<?php } ?>"><?php echo $next_text; ?></a><?php } else { echo $next_text; } ?></td>
|
||||
<td class="comic-nav"><?php if ( get_permalink() != $last_comic ) { ?><a href="<?php echo $last_comic ?>" class="comic-nav-last<?php if ( get_permalink() == $last_comic ) { ?> comic-nav-inactive<?php } ?>"><?php echo $last_text; ?></a><?php } else { echo $last_text; } ?></td>
|
||||
<?php if (ceo_pluginfo('enable_chapter_nav')) { ?>
|
||||
<td class="comic-nav comic-nav-jumpto"><?php ceo_comic_archive_jump_to_chapter(); ?></td>
|
||||
<?php } ?>
|
||||
</tr>
|
||||
<?php if (ceo_pluginfo('enable_embed_nav')) { ?>
|
||||
<tr>
|
||||
<td class="comic-nav">
|
||||
<?php
|
||||
$post_image_id = get_post_thumbnail_id($post->ID);
|
||||
$thumbnail = wp_get_attachment_image_src( $post_image_id, 'full', false);
|
||||
if (is_array($thumbnail)) {
|
||||
$thumbnail = reset($thumbnail);
|
||||
echo $thumbnail;
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</table>
|
||||
<?php
|
||||
}
|
||||
wp_reset_query();
|
||||
// remove this if this is ever going into a sidebar ;/
|
||||
}
|
||||
|
||||
// This is used inside ceo_display_comic_area()
|
||||
function ceo_display_comic_wrapper() {
|
||||
global $post;
|
||||
global $post, $wp_query;
|
||||
if (is_home() && ceo_pluginfo('disable_comic_on_home_page')) return;
|
||||
if ($post->post_type == 'comic') { ?>
|
||||
<div id="comic-wrap" class="comic-id-<?php echo $post->ID; ?>">
|
||||
<div id="comic-head"></div>
|
||||
<div id="comic-head">
|
||||
<?php if (is_active_sidebar('over-comic')) ceo_get_sidebar('over'); ?>
|
||||
</div>
|
||||
<?php if (is_active_sidebar('left-of-comic')) ceo_get_sidebar('comicleft'); ?>
|
||||
<div id="comic">
|
||||
<?php echo ceo_display_comic(); ?>
|
||||
</div>
|
||||
<?php if (is_active_sidebar('right-of-comic')) ceo_get_sidebar('comicright'); ?>
|
||||
<div id="comic-foot">
|
||||
<?php if (is_active_sidebar('under-comic')) ceo_get_sidebar('under'); ?>
|
||||
<?php ceo_display_comic_navigation(); ?>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
@@ -63,26 +102,7 @@ function ceo_display_comic_wrapper() {
|
||||
<?php }
|
||||
}
|
||||
|
||||
// add_action('easel-narrowcolumn-area', 'ceo_display_comic_post_home');
|
||||
|
||||
/* This will only work if using the Easel theme. */
|
||||
|
||||
function ceo_display_comic_post_home() {
|
||||
global $wp_query;
|
||||
if (is_home() && function_exists('easel_display_post')) {
|
||||
if (!is_paged()) {
|
||||
$wp_query->in_the_loop = true; $comicFrontpage = new WP_Query(); $comicFrontpage->query('post_type=comic&showposts=1');
|
||||
while ($comicFrontpage->have_posts()) : $comicFrontpage->the_post();
|
||||
easel_display_post();
|
||||
endwhile;
|
||||
}
|
||||
if (is_home()) { ?>
|
||||
<div id="blogheader"></div>
|
||||
<?php }
|
||||
}
|
||||
}
|
||||
|
||||
add_action('easel-post-info', 'ceo_display_comic_locations');
|
||||
add_action('comic-post-info', 'ceo_display_comic_locations');
|
||||
|
||||
function ceo_display_comic_locations() {
|
||||
global $post;
|
||||
@@ -95,7 +115,7 @@ function ceo_display_comic_locations() {
|
||||
}
|
||||
}
|
||||
|
||||
add_action('easel-post-info', 'ceo_display_comic_characters');
|
||||
add_action('comic-post-info', 'ceo_display_comic_characters');
|
||||
|
||||
function ceo_display_comic_characters() {
|
||||
global $post;
|
||||
@@ -108,21 +128,9 @@ function ceo_display_comic_characters() {
|
||||
}
|
||||
}
|
||||
|
||||
// Syndication Injection
|
||||
|
||||
add_filter('easel_thumbnail_feed', 'ceo_inject_comic_into_feed');
|
||||
|
||||
function ceo_inject_comic_into_feed($post_thumbnail) {
|
||||
global $post;
|
||||
if (empty($post_thumbnail) && ($post->post_type == 'comic'))
|
||||
$post_thumbnail = '<p>'. ceo_display_comic_thumbnail('medium', $post, true) . '</p>';
|
||||
return $post_thumbnail;
|
||||
}
|
||||
|
||||
add_action('easel-display-the-content-archive-before', 'ceo_inject_thumbnail_into_archive_posts');
|
||||
// add_action('easel-display-the-content-archive-before', 'ceo_inject_thumbnail_into_archive_posts');
|
||||
// add_action('easel-display-the-content-before', 'ceo_inject_thumbnail_into_archive_posts');
|
||||
|
||||
|
||||
function ceo_inject_thumbnail_into_archive_posts() {
|
||||
global $post;
|
||||
if ($post->post_type == 'comic') {
|
||||
@@ -132,20 +140,23 @@ function ceo_inject_thumbnail_into_archive_posts() {
|
||||
|
||||
// Inject into the menubar some mini navigation
|
||||
|
||||
add_action('easel-menubar-mini-navigation', 'ceo_inject_mini_navigation');
|
||||
add_action('comic-mini-navigation', 'ceo_inject_mini_navigation');
|
||||
|
||||
function ceo_inject_mini_navigation() {
|
||||
global $post;
|
||||
$next_comic = $prev_comic = '';
|
||||
|
||||
if (is_home() && !is_paged()) {
|
||||
$wp_query->in_the_loop = true; $comicFrontpage = new WP_Query(); $comicFrontpage->query('post_type=comic&showposts=1');
|
||||
while ($comicFrontpage->have_posts()) : $comicFrontpage->the_post();
|
||||
$next_comic = ceo_get_next_comic_permalink();
|
||||
$prev_comic = ceo_get_previous_comic_permalink();
|
||||
endwhile;
|
||||
} elseif ($post->post_type == 'comic') {
|
||||
$next_comic = ceo_get_next_comic_permalink();
|
||||
$prev_comic = ceo_get_previous_comic_permalink();
|
||||
} else {
|
||||
if ($post->post_type == 'comic') {
|
||||
$next_comic = ceo_get_next_comic_permalink();
|
||||
$prev_comic = ceo_get_previous_comic_permalink();
|
||||
}
|
||||
}
|
||||
if (!empty($next_comic) || !empty($prev_comic)) {
|
||||
$next_text = __('›','comiceasel');
|
||||
@@ -161,4 +172,73 @@ function ceo_inject_mini_navigation() {
|
||||
}
|
||||
}
|
||||
|
||||
add_action('comic-blog-area', 'ceo_display_comic_post_home');
|
||||
|
||||
function ceo_display_comic_post_home() {
|
||||
global $wp_query;
|
||||
if (is_home() && !ceo_pluginfo('disable_comic_blog_on_home_page')) {
|
||||
if (!is_paged()) {
|
||||
$wp_query->in_the_loop = true; $comicFrontpage = new WP_Query(); $comicFrontpage->query('post_type=comic&showposts=1');
|
||||
while ($comicFrontpage->have_posts()) : $comicFrontpage->the_post();
|
||||
if (function_exists('comicpress_display_post')) {
|
||||
comicpress_display_post();
|
||||
} elseif (function_exists('easel_display_post')) {
|
||||
easel_display_post();
|
||||
} else ceo_display_comic_post();
|
||||
endwhile;
|
||||
if (ceo_pluginfo('enable_comments_on_homepage')) {
|
||||
$withcomments = 1;
|
||||
comments_template('', true);
|
||||
}
|
||||
wp_reset_query();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function ceo_display_comic_post() {
|
||||
global $post, $wp_query; ?>
|
||||
<div <?php post_class(); ?>>
|
||||
<div class="comic-post-head"></div>
|
||||
<div class="comic-post-content">
|
||||
<div class="comic-post-text post-title">
|
||||
<h2 class="comic-post-title entry-title"><a href="<?php echo get_permalink(); ?>"><?php the_title(); ?></a></h2>
|
||||
</div>
|
||||
<div class="comic-post-info">
|
||||
<?php do_action('comic-post-info'); ?>
|
||||
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
<div class="entry">
|
||||
<?php the_content(); ?>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
<?php wp_link_pages(array('before' => '<div class="linkpages"><span class="linkpages-pagetext">Pages:</span> ', 'after' => '</div>', 'next_or_number' => 'number')); ?>
|
||||
<div class="clear"></div>
|
||||
<div class="comic-post-extras">
|
||||
<?php
|
||||
do_action('comic-post-extras');
|
||||
?>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="comic-post-foot"></div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
add_filter('pre_get_posts', 'ceo_query_post_type');
|
||||
|
||||
function ceo_query_post_type($query) {
|
||||
if (is_tag() && empty( $query->query_vars['suppress_filters'] ) ) {
|
||||
$post_type = get_query_var('post_type');
|
||||
if($post_type) :
|
||||
$post_type = $post_type;
|
||||
else:
|
||||
$post_type = array('post','comic');
|
||||
$query->set('post_type',$post_type);
|
||||
endif;
|
||||
return $query;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
/*
|
||||
* Get a sidebar and create a generic dynamic sidebar for it, else find the sidebar-*.php in the theme/childtheme
|
||||
*/
|
||||
|
||||
function ceo_get_sidebar($location = '') {
|
||||
if (empty($location)) { get_sidebar(); return; }
|
||||
if (file_exists(get_stylesheet_directory().'/sidebar-'.$location.'.php')) {
|
||||
get_sidebar($location);
|
||||
} elseif (is_active_sidebar('sidebar-'.$location)) { ?>
|
||||
<div id="sidebar-<?php echo $location; ?>" class="sidebar">
|
||||
<?php dynamic_sidebar('sidebar-'.$location); ?>
|
||||
</div>
|
||||
<?php }
|
||||
}
|
||||
|
||||
/**
|
||||
* Protect global $post and $wp_query.
|
||||
* @param object $use_this_post If provided, after saving the current post, set up this post for template tag use.
|
||||
*/
|
||||
function ceo_Protect($use_this_post = null) {
|
||||
global $post, $wp_query, $__post, $__wp_query;
|
||||
if (!empty($post)) {
|
||||
$__post = $post;
|
||||
}
|
||||
if (!empty($wp_query)) {
|
||||
$__wp_query = $wp_query;
|
||||
}
|
||||
if (!is_null($use_this_post)) {
|
||||
$post = $use_this_post;
|
||||
setup_postdata($post);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Temporarily restore the global $post variable and set it up for use.
|
||||
*/
|
||||
function ceo_Restore() {
|
||||
global $post, $__post;
|
||||
$post = $__post;
|
||||
setup_postdata($post);
|
||||
}
|
||||
|
||||
/**
|
||||
* Restore global $post and $wp_query.
|
||||
*/
|
||||
function ceo_Unprotect() {
|
||||
global $post, $wp_query, $__post, $__wp_query;
|
||||
if (!empty($__post)) {
|
||||
$post = $__post;
|
||||
}
|
||||
if (!empty($__wp_query)) {
|
||||
$wp_query = $__wp_query;
|
||||
}
|
||||
|
||||
$__post = $__wp_query = null;
|
||||
}
|
||||
+10
-10
@@ -2,10 +2,10 @@
|
||||
|
||||
function ceo_get_first_comic() {
|
||||
global $post;
|
||||
$current_chapter = reset(get_the_terms( $post->ID, 'chapters'));
|
||||
if (empty($current_chapter) || is_null($current_chapter)) {
|
||||
$current_chapter_id = 0;
|
||||
} else {
|
||||
$current_chapter = get_the_terms( $post->ID, 'chapters');
|
||||
$current_chapter_id = 0;
|
||||
if (is_array($current_chapter) && ceo_pluginfo('navigate_only_chapters')) {
|
||||
$current_chapter = reset($current_chapter);
|
||||
$current_chapter_id = $current_chapter->term_id;
|
||||
}
|
||||
return ceo_get_terminal_post_of_chapter($current_chapter_id, true);
|
||||
@@ -18,10 +18,10 @@ function ceo_get_first_comic_permalink() {
|
||||
|
||||
function ceo_get_last_comic() {
|
||||
global $post;
|
||||
$current_chapter = reset(get_the_terms( $post->ID, 'chapters'));
|
||||
if (empty($current_chapter) || is_null($current_chapter)) {
|
||||
$current_chapter_id = 0;
|
||||
} else {
|
||||
$current_chapter = get_the_terms( $post->ID, 'chapters');
|
||||
$current_chapter_id = 0;
|
||||
if (is_array($current_chapter) && ceo_pluginfo('navigate_only_chapters')) {
|
||||
$current_chapter = reset($current_chapter);
|
||||
$current_chapter_id = $current_chapter->term_id;
|
||||
}
|
||||
return ceo_get_terminal_post_of_chapter($current_chapter_id, false);
|
||||
@@ -33,7 +33,7 @@ function ceo_get_last_comic_permalink() {
|
||||
}
|
||||
|
||||
function ceo_get_previous_comic() {
|
||||
return ceo_get_adjacent_comic(true, true);
|
||||
return ceo_get_adjacent_comic(true, ceo_pluginfo('navigate_only_chapters'));
|
||||
}
|
||||
|
||||
function ceo_get_previous_comic_permalink() {
|
||||
@@ -47,7 +47,7 @@ function ceo_get_previous_comic_permalink() {
|
||||
}
|
||||
|
||||
function ceo_get_next_comic() {
|
||||
return ceo_get_adjacent_comic(false, true);
|
||||
return ceo_get_adjacent_comic(false, ceo_pluginfo('navigate_only_chapters'));
|
||||
}
|
||||
|
||||
function ceo_get_next_comic_permalink() {
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
if ( isset( $_GET['latest'] ) )
|
||||
add_action( 'template_redirect', 'ceo_latest_comic_jump' );
|
||||
|
||||
if ( isset( $_GET['random'] ) )
|
||||
add_action( 'template_redirect', 'ceo_random_comic' );
|
||||
|
||||
//to use simply create a URL link to "/?latestcomic"
|
||||
function ceo_latest_comic_jump() {
|
||||
if (isset($_GET['latest'])) $chapter = (int)$_GET['latest'];
|
||||
if (!empty($chapter)) {
|
||||
$this_chapter = get_term_by('term_id', $chapter, 'chapters');
|
||||
$args = array(
|
||||
'numberposts' => 1,
|
||||
'post_type' => 'comic',
|
||||
'orderby' => 'post_date',
|
||||
'order' => 'DESC',
|
||||
'post_status' => 'publish',
|
||||
'chapters' => $this_chapter->slug
|
||||
);
|
||||
$qposts = get_posts( $args );
|
||||
if (is_array($qposts)) {
|
||||
$qposts = reset($qposts);
|
||||
wp_redirect( get_permalink( $qposts->ID ) );
|
||||
} else {
|
||||
wp_redirect( bloginfo('url') );
|
||||
}
|
||||
} else {
|
||||
$args = array(
|
||||
'numberposts' => 1,
|
||||
'post_type' => 'comic',
|
||||
'orderby' => 'post_date',
|
||||
'order' => 'DESC',
|
||||
'post_status' => 'publish'
|
||||
);
|
||||
$qposts = get_posts( $args );
|
||||
if (is_array($qposts)) {
|
||||
$qposts = reset($qposts);
|
||||
wp_redirect( get_permalink( $qposts->ID ) );
|
||||
}
|
||||
}
|
||||
wp_reset_query();
|
||||
exit;
|
||||
}
|
||||
|
||||
function ceo_random_comic() {
|
||||
$args = array(
|
||||
'numberposts' => 1,
|
||||
'post_type' => 'comic',
|
||||
'orderby' => 'rand',
|
||||
'post_status' => 'publish'
|
||||
);
|
||||
$qposts = get_posts( $args );
|
||||
if (is_array($qposts)) {
|
||||
$qposts = reset($qposts);
|
||||
wp_redirect( get_permalink( $qposts->ID ) );
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,198 @@
|
||||
<?php
|
||||
/* Short Codes go Here */
|
||||
|
||||
add_shortcode( 'cast-page', 'ceo_cast_page' );
|
||||
add_shortcode( 'comic-archive', 'ceo_comic_archive_multi');
|
||||
// [comic-archive list="default"]
|
||||
|
||||
function ceo_cast_page( $atts, $content = null ) {
|
||||
$cast_output = '';
|
||||
$characters = get_terms( 'characters', 'orderby=count&order=desc&hide_empty=1' );
|
||||
if (is_array($characters)) {
|
||||
foreach ($characters as $character) {
|
||||
$cast_output .= '<div class="cast-box">';
|
||||
$cast_output .= '<div class="cast-pic character-'.$character->slug.'">';
|
||||
$cast_output .= '</div>';
|
||||
$cast_output .= '<div class="cast-info cast-info-'.$character->slug.'">';
|
||||
$cast_output .= '<h4 class="cast-name"><a href="'.get_term_link($character->slug, 'characters').'">'.$character->name.'</a></h4>';
|
||||
$cast_output .= '<p class="cast-description">';
|
||||
$cast_output .= $character->description;
|
||||
$cast_output .= '</p>';
|
||||
$cast_output .= '<p class="cast-character-stats">';
|
||||
$cast_output .= '<i>'.__('Comics:','comiceasel').'</i> <strong>'.$character->count.'</strong><br />';
|
||||
$args = array(
|
||||
'numberposts' => 1,
|
||||
'post_type' => 'comic',
|
||||
'orderby' => 'post_date',
|
||||
'order' => 'ASC',
|
||||
'post_status' => 'publish',
|
||||
'characters' => $character->slug,
|
||||
);
|
||||
$qposts = get_posts( $args );
|
||||
if (!empty($qposts)) {
|
||||
$first_seen = $qposts[0]->post_title;
|
||||
$first_seen_id = $qposts[0]->ID;
|
||||
$cast_output .= '<i>'.__('First Appearance:','comiceasel').'</i> <a href="'.get_permalink($first_seen_id).'">'.$first_seen.'</a><br />';
|
||||
}
|
||||
wp_reset_query();
|
||||
$cast_output .= '</p>';
|
||||
$cast_output .= '</div>';
|
||||
$cast_output .= '<div style="clear:both;"></div>';
|
||||
$cast_output .= '</div>';
|
||||
}
|
||||
} else {
|
||||
$cast_output = __('You do not have any characters yet.','comiceasel');
|
||||
}
|
||||
return $cast_output;
|
||||
}
|
||||
|
||||
function ceo_comic_archive_multi( $atts, $content = null ) {
|
||||
extract( shortcode_atts( array(
|
||||
'list' => 0,
|
||||
'style' => 0,
|
||||
'chapter' => 0,
|
||||
'thumbnail' => 0,
|
||||
'order' => 'ASC'
|
||||
), $atts ) );
|
||||
switch ($list) {
|
||||
case 1:
|
||||
ceo_archive_list_series($thumbnail);
|
||||
break;
|
||||
case 0:
|
||||
default:
|
||||
if ($chapter) {
|
||||
ceo_archive_list_single($chapter, $order, $thumbnail);
|
||||
} else {
|
||||
ceo_archive_list_all($order, $thumbnail);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function ceo_archive_list_single($chapter = 0, $order = 'ASC', $thumbnail = 0) {
|
||||
$output = '';
|
||||
// get chapter from ID#
|
||||
$single_chapter = get_term_by('term_id', $chapter, 'chapters');
|
||||
if (is_null($single_chapter)) { echo "Invalid Chapter Specified"; return; }
|
||||
$output .= '<div class="comic-archive-chapter-wrap">';
|
||||
$output .= '<h3 class="comic-archive-chapter">'.$single_chapter->name.'</h3>';
|
||||
$output .= '<div class="comic-archive-image-'.$single_chapter->slug.'"></div>';
|
||||
$output .= '<div class="comic-archive-chapter-description">'.$single_chapter->description.'</div>';
|
||||
$args = array(
|
||||
'numberposts' => -1,
|
||||
'post_type' => 'comic',
|
||||
'orderby' => 'post_date',
|
||||
'order' => $order,
|
||||
'post_status' => 'publish',
|
||||
'chapters' => $single_chapter->slug
|
||||
);
|
||||
$qposts = get_posts( $args );
|
||||
$archive_count = 0;
|
||||
if ($thumbnail) {
|
||||
$output .= '<div class="comic-archive-thumbnail">'.get_the_post_thumbnail($qposts[0]->ID, 'thumbnail').'</div>';
|
||||
}
|
||||
$output .= '<div class="comic-archive-list-wrap">';
|
||||
$css_alt = false;
|
||||
foreach ($qposts as $qpost) {
|
||||
$archive_count++;
|
||||
if ($css_alt) { $alternate = ' comic-list-alt'; $css_alt = false; } else { $alternate = ''; $css_alt=true; }
|
||||
$output .= '<div class="comic-list comic-list-'.$archive_count.$alternate.'"><span class="comic-archive-date">'.get_the_time('M d, Y', $qpost->ID).'</span><span class="comic-archive-title"><a href="'.get_permalink($qpost->ID).'" rel="bookmark" title="'.__('Permanent Link:','comiceasel').' '.$qpost->post_title.'">'.$qpost->post_title.'</a></span></div>';
|
||||
}
|
||||
$output .= '</div>';
|
||||
$output .= '<div style="clear:both;"></div></div>';
|
||||
wp_reset_query();
|
||||
echo apply_filters('ceo_archive_list_single', $output);
|
||||
}
|
||||
|
||||
function ceo_archive_list_all($order = 'ASC', $thumbnail = 0) {
|
||||
$output = '';
|
||||
$all_chapters = get_terms('chapters');
|
||||
if (is_null($all_chapters)) { echo 'There are no chapters available.'; return; }
|
||||
$output = '';
|
||||
foreach ($all_chapters as $chapter) {
|
||||
if ($chapter->count) {
|
||||
$output .= '<div class="comic-archive-chapter-wrap">';
|
||||
$output .= '<h3 class="comic-archive-chapter">'.$chapter->name.'</h3>';
|
||||
$output .= '<div class="comic-archive-image-'.$chapter->slug.'"></div>';
|
||||
$output .= '<div class="comic-archive-chapter-description">'.$chapter->description.'</div>';
|
||||
$args = array(
|
||||
'numberposts' => -1,
|
||||
'post_type' => 'comic',
|
||||
'orderby' => 'post_date',
|
||||
'order' => $order,
|
||||
'post_status' => 'publish',
|
||||
'chapters' => $chapter->slug
|
||||
);
|
||||
$qposts = get_posts( $args );
|
||||
$archive_count = 0;
|
||||
if ($thumbnail) {
|
||||
$output .= '<div class="comic-archive-thumbnail">'.get_the_post_thumbnail($qposts[0]->ID, 'thumbnail').'</div>';
|
||||
}
|
||||
$output .= '<div class="comic-archive-list-wrap">';
|
||||
$css_alt = false;
|
||||
foreach ($qposts as $qpost) {
|
||||
$archive_count++;
|
||||
if ($css_alt) { $alternate = ' comic-list-alt'; $css_alt = false; } else { $alternate = ''; $css_alt=true; }
|
||||
$output .= '<div class="comic-list comic-list-'.$archive_count.$alternate.'"><span class="comic-archive-date">'.get_the_time('M d, Y', $qpost->ID).'</span><span class="comic-archive-title"><a href="'.get_permalink($qpost->ID).'" rel="bookmark" title="'.__('Permanent Link:','comiceasel').' '.$qpost->post_title.'">'.$qpost->post_title.'</a></span></div>';
|
||||
}
|
||||
$output .= '</div>';
|
||||
$output .= '<div style="clear:both;"></div></div>';
|
||||
}
|
||||
}
|
||||
wp_reset_query();
|
||||
echo apply_filters('ceo_archive_list_all', $output);
|
||||
}
|
||||
|
||||
function ceo_archive_list_series($thumbnail = 0) {
|
||||
$output = '';
|
||||
$archive_count = 0;
|
||||
$args = array(
|
||||
'pad_counts' => 0,
|
||||
'orderby' => 'id',
|
||||
'order' => 'DESC',
|
||||
'hide_empty' => 0,
|
||||
'parent' => 0
|
||||
);
|
||||
$parent_chapters = get_terms( 'chapters', $args );
|
||||
if (is_array($parent_chapters)) {
|
||||
foreach($parent_chapters as $parent_chapter) {
|
||||
$output .= '<h2 class="comic-archive-series-title">'.$parent_chapter->name.'</h2>';
|
||||
$output .= '<div class="comic-archive-image-'.$parent_chapter->slug.'"></div>';
|
||||
$output .= '<div class="comic-archive-series-description">'.$parent_chapter->description.'</div>';
|
||||
$child_chapters = get_term_children( $parent_chapter->term_id, 'chapters' );
|
||||
foreach ($child_chapters as $child) {
|
||||
$child_term = get_term_by( 'id', $child, 'chapters' );
|
||||
if ($child_term->count) {
|
||||
$output .= '<div class="comic-archive-chapter-wrap">';
|
||||
$output .= '<h3 class="comic-archive-chapter-title">'.$child_term->name.'</h3>';
|
||||
$output .= '<div class="comic-archive-image-'.$child_term->slug.'"></div>';
|
||||
$output .= '<div class="comic-archive-chapter-description">'.$child_term->description.'</div>';
|
||||
$child_args = array(
|
||||
'numberposts' => -1,
|
||||
'post_type' => 'comic',
|
||||
'orderby' => 'post_date',
|
||||
'order' => 'ASC',
|
||||
'post_status' => 'publish',
|
||||
'chapters' => $child_term->slug
|
||||
);
|
||||
$qcposts = get_posts( $child_args );
|
||||
if ($thumbnail) {
|
||||
$output .= '<div class="comic-archive-thumbnail">'.get_the_post_thumbnail($qcposts[0]->ID, 'thumbnail').'</div>';
|
||||
}
|
||||
$output .= '<div class="comic-archive-list-wrap">';
|
||||
$css_alt = false;
|
||||
foreach ($qcposts as $qcpost) {
|
||||
$archive_count++;
|
||||
if ($css_alt) { $alternate = ' comic-list-alt'; $css_alt = false; } else { $alternate = ''; $css_alt=true; }
|
||||
$output .= '<div class="comic-list comic-list-'.$archive_count.$alternate.'"><span class="comic-archive-date">'.get_the_time('M d, Y', $qcpost->ID).'</span><span class="comic-archive-title"><a href="'.get_permalink($qcpost->ID).'" rel="bookmark" title="'.__('Permanent Link:','comiceasel').' '.$qcpost->post_title.'">'.$qcpost->post_title.'</a></span></div>';
|
||||
}
|
||||
$output .= '</div>';
|
||||
$output .= '<div style="clear:both;"></div></div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
echo $output;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -1,86 +0,0 @@
|
||||
<?php
|
||||
|
||||
include_once('easyphpthumbnail.class.php');
|
||||
class ceo_UploadFileXhr {
|
||||
function save($path){
|
||||
$input = fopen("php://input", "r");
|
||||
$fp = fopen($path, "w");
|
||||
while ($data = fread($input, 1024)){
|
||||
fwrite($fp,$data);
|
||||
}
|
||||
fclose($fp);
|
||||
fclose($input);
|
||||
}
|
||||
function getName(){
|
||||
return $_GET['qqfile'];
|
||||
}
|
||||
function getSize(){
|
||||
$headers = apache_request_headers();
|
||||
return (int)$headers['Content-Length'];
|
||||
}
|
||||
}
|
||||
|
||||
class ceo_UploadFileForm {
|
||||
function save($path){
|
||||
move_uploaded_file($_FILES['qqfile']['tmp_name'], $path);
|
||||
}
|
||||
function getName(){
|
||||
return $_FILES['qqfile']['name'];
|
||||
}
|
||||
function getSize(){
|
||||
return $_FILES['qqfile']['size'];
|
||||
}
|
||||
}
|
||||
|
||||
function ceo_handleUpload(){
|
||||
|
||||
$maxFileSize = 100 * 1024 * 1024;
|
||||
|
||||
if (isset($_GET['qqfile'])){
|
||||
$file = new ceo_UploadFileXhr();
|
||||
} elseif (isset($_FILES['qqfile'])){
|
||||
$file = new ceo_UploadFileForm();
|
||||
} else {
|
||||
return array(success=>false);
|
||||
}
|
||||
|
||||
$size = $file->getSize();
|
||||
if ($size == 0){
|
||||
return array(success=>false, error=>"File is empty.");
|
||||
}
|
||||
if ($size > $maxFileSize){
|
||||
return array(success=>false, error=>"File is too large.");
|
||||
}
|
||||
|
||||
$pathinfo = pathinfo($file->getName());
|
||||
$filename = $pathinfo['filename'];
|
||||
$ext = $pathinfo['extension'];
|
||||
|
||||
// if you limit file extensions on the client side,
|
||||
// you should check file extension here too
|
||||
|
||||
while (file_exists(ceo_pluginfo('comic_path') .'/'. $filename . '.' . $ext)){
|
||||
$filename .= rand(10, 99);
|
||||
}
|
||||
|
||||
$file->save(ceo_pluginfo('comic_path') .'/'. $filename . '.' . $ext);
|
||||
|
||||
if (preg_match("/jpg|jpeg|gif|png/i", $ext)){
|
||||
//generate medium comic image
|
||||
$thumb = new easyphpthumbnail;
|
||||
$thumb -> Thumbwidth = ceo_pluginfo('medium_comic_width');
|
||||
$thumb -> Thumblocation = ceo_pluginfo('thumbnail_medium_path') .'/';
|
||||
$thumb -> Thumbprefix = '';
|
||||
$thumb -> Createthumb(ceo_pluginfo('comic_path') .'/'. $filename . '.' . $ext,'file');
|
||||
|
||||
//generate small comic image
|
||||
$thumb -> Thumbwidth = ceo_pluginfo('small_comic_width');
|
||||
$thumb -> Thumblocation = ceo_pluginfo('thumbnail_small_path') .'/';
|
||||
$thumb -> Thumbprefix = '';
|
||||
$thumb -> Createthumb(ceo_pluginfo('comic_path') .'/'. $filename . '.' . $ext,'file');
|
||||
}
|
||||
add_post_meta($_GET[post_id], 'comic', $filename . '.' . $ext, false);
|
||||
|
||||
return array(success=>true);
|
||||
}
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 5.5 KiB |
-1018
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,58 @@
|
||||
<div id="comiceasel-general">
|
||||
|
||||
<form method="post" id="myForm-general" enctype="multipart/form-data">
|
||||
<?php wp_nonce_field('update-options') ?>
|
||||
|
||||
<div class="comiceasel-options">
|
||||
|
||||
<table class="widefat">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="3"><?php _e('Configuration','comiceasel'); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tr class="alternate">
|
||||
<th scope="row"><label for="add_dashboard_frumph_feed_widget"><?php _e('Enable Dashboard Feed to Frumph.NET','comiceasel'); ?></label></th>
|
||||
<td>
|
||||
<input id="add_dashboard_frumph_feed_widget" name="add_dashboard_frumph_feed_widget" type="checkbox" value="1" <?php checked(true, $ceo_options['add_dashboard_frumph_feed_widget']); ?> />
|
||||
</td>
|
||||
<td>
|
||||
<?php _e('This is a feed that shows what is happening on Frumph.NET','comiceasel'); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="disable_comic_on_home_page"><?php _e('Disable Comic on the Home Page?','comiceasel'); ?></label></th>
|
||||
<td>
|
||||
<input id="disable_comic_on_home_page" name="disable_comic_on_home_page" type="checkbox" value="1" <?php checked(true, $ceo_options['disable_comic_on_home_page']); ?> />
|
||||
</td>
|
||||
<td>
|
||||
<?php _e('Checking this will stop the display of the comic and comic area on the home page','comiceasel'); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="alternate">
|
||||
<th scope="row"><label for="disable_comic_blog_on_home_page"><?php _e('Disable the Comic Post on the Home Page?','comiceasel'); ?></label></th>
|
||||
<td>
|
||||
<input id="disable_comic_blog_on_home_page" name="disable_comic_blog_on_home_page" type="checkbox" value="1" <?php checked(true, $ceo_options['disable_comic_blog_on_home_page']); ?> />
|
||||
</td>
|
||||
<td>
|
||||
<?php _e('Checking this will stop the display of the comic\'s blog on the home page.','comiceasel'); ?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
|
||||
<br />
|
||||
<div class="ceo-options-save">
|
||||
<div class="ceo-major-publishing-actions">
|
||||
<div class="ceo-publishing-action">
|
||||
<input name="ceo_save_config" type="submit" class="button-primary" value="Save Settings" />
|
||||
<input type="hidden" name="action" value="ceo_save_general" />
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,84 @@
|
||||
<div id="comiceasel-navigation">
|
||||
|
||||
<form method="post" id="myForm-navigation" enctype="multipart/form-data">
|
||||
<?php wp_nonce_field('update-options') ?>
|
||||
|
||||
<div class="comiceasel-options">
|
||||
|
||||
<table class="widefat">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="3"><?php _e('Navigation Options','comiceasel'); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tr class="alternate">
|
||||
<th scope="row"><label for="navigate_only_chapters"><?php _e('Navigate through only the chapters and not all comics?','comiceasel'); ?></label></th>
|
||||
<td>
|
||||
<input id="navigate_only_chapters" name="navigate_only_chapters" type="checkbox" value="1" <?php checked(true, $ceo_options['navigate_only_chapters']); ?> />
|
||||
</td>
|
||||
<td>
|
||||
<?php _e('Enabling this make the navigation only navigate through individual chapters.','comiceasel'); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="click_comic_next"><?php _e('Clicking the comic goes to next comic?','comiceasel'); ?></label></th>
|
||||
<td>
|
||||
<input id="click_comic_next" name="click_comic_next" type="checkbox" value="1" <?php checked(true, $ceo_options['click_comic_next']); ?> />
|
||||
</td>
|
||||
<td>
|
||||
<?php _e('When this is enabled, when the comic is mouse over and clicked it will go to the next comic in the chapter.','comiceasel'); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="alternate">
|
||||
<th scope="row"><label for="enable_chapter_nav"><?php _e('Enable the chapter navigation drop down in the comic navigation?','comiceasel'); ?></label></th>
|
||||
<td>
|
||||
<input id="enable_chapter_nav" name="enable_chapter_nav" type="checkbox" value="1" <?php checked(true, $ceo_options['enable_chapter_nav']); ?> />
|
||||
</td>
|
||||
<td>
|
||||
<?php _e('When this is enabled, a drop down archive box will appear in the navigation that lets you go to the start of each chapter','comiceasel'); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="enable_random_nav"><?php _e('Enable the random comic link in the comic navigation?','comiceasel'); ?></label></th>
|
||||
<td>
|
||||
<input id="enable_random_nav" name="enable_random_nav" type="checkbox" value="1" <?php checked(true, $ceo_options['enable_random_nav']); ?> />
|
||||
</td>
|
||||
<td>
|
||||
<?php _e('When this is enabled, a link will appear in the navigation that lets you go to a random comic in all chapters.','comiceasel'); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="alternate">
|
||||
<th scope="row"><label for="enable_comment_nav"><?php _e('Enable the comment link in the comic navigation?','comiceasel'); ?></label></th>
|
||||
<td>
|
||||
<input id="enable_comment_nav" name="enable_comment_nav" type="checkbox" value="1" <?php checked(true, $ceo_options['enable_comment_nav']); ?> />
|
||||
</td>
|
||||
<td>
|
||||
<?php _e('When this is enabled, a link will appear in the navigation that lets you go to the comments section of the current post, it also shows how many comments there currently are.','comiceasel'); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="enable_embed_nav"><?php _e('Enable the "embed this comic" textarea in the comic navigation?','comiceasel'); ?></label></th>
|
||||
<td>
|
||||
<input id="enable_embed_nav" name="enable_embed_nav" type="checkbox" value="1" <?php checked(true, $ceo_options['enable_embed_nav']); ?> />
|
||||
</td>
|
||||
<td>
|
||||
<?php _e('When this is enabled, a textarea will appear under the navigation with the href and image link to have users embed this comic on their site.','comiceasel'); ?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<br />
|
||||
<div class="ceo-options-save">
|
||||
<div class="ceo-major-publishing-actions">
|
||||
<div class="ceo-publishing-action">
|
||||
<input name="ceo_save_config" type="submit" class="button-primary" value="Save Settings" />
|
||||
<input type="hidden" name="action" value="ceo_save_navigation" />
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
+114
-7
@@ -1,14 +1,121 @@
|
||||
=== Comic Easel ===
|
||||
Contributors: frumph, zerzix
|
||||
Tags: comiceasel, easel, webcomic, comic, webcomics, management, admin, posts, plugin
|
||||
Contributors: frumph
|
||||
Tags: comiceasel, easel, webcomic, comic, webcomic
|
||||
Requires at least: 3.0
|
||||
Tested up to: 3.0.1
|
||||
Stable tag: 1.0
|
||||
Tested up to: 3.4
|
||||
Stable tag: 1.0.1
|
||||
Donate link: http://frumph.net
|
||||
License: GPLv3 or later
|
||||
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
Comic Easel allows you to post webcomics to your theme.
|
||||
|
||||
Comic Easel ties in with the Easel theme to allow you to post webcomics.
|
||||
|
||||
== Description ==
|
||||
|
||||
Description Needed.
|
||||
will be added latter
|
||||
Comic Easel allows you to incorporate a WebComic using the WordPress Media Library functionality with Navigation into almost any WordPress theme. With just a few modifications of adding *injection* action locations into a theme, you can have the theme of your choice display a comic.
|
||||
|
||||
The core reason to use Comic Easel above other WordPress theme's is that you are not limited to the basic ComicPress & Other themes that are specifically designed for WebComics that utilize structures that you do not require or want to make use of. There are a plentiful amount of themes in the WordPress repository that you can now take advantage of that give you tons of options you otherwise wouldn't have had.
|
||||
|
||||
With Comic Easel's extra taxonomies to control Character and Locations, you can provide your end readers with a plethora of information that wouldn't have had before that is auto-generated. The Cast Page itself shows how many times a character was in a comic as well as the first comic they were seen in.
|
||||
|
||||
To Convert your existing ComicPress theme comics to Comic Easel's post type there is a plugin available called CP2CE.
|
||||
|
||||
= Features of 1.0 =
|
||||
|
||||
- Custom Post Type control of posts.
|
||||
- Media Library handling of comics.
|
||||
- As many chapters/stories as you would like.
|
||||
- Individual navigation per chapter or all.
|
||||
- Character and Location settings per Comic
|
||||
- As many comic posts you can do in a day as you want.
|
||||
- Hovertext on the comic
|
||||
- And More!
|
||||
|
||||
= Widgets =
|
||||
|
||||
- Chapter Dropdown, brings you to the first comic in the chapter (story)
|
||||
- Calendar display, show's you what days comic posts were made on, can add images and links to backgrounds.
|
||||
- Recent Comics, a list of comics that have been posted as of late.
|
||||
- Thumbnail, display a thumbnail of a random comic, or first/latest comic in a chapter (or all)
|
||||
|
||||
= Redirects =
|
||||
|
||||
- `/?latest` or `/?latest=<chapter-id>` in the url will automatically take the end user to the latest comic, or latest of a specific chapter
|
||||
- `/?random` in the url will redirect to a random comic out of all the comics.
|
||||
|
||||
= Short Codes =
|
||||
|
||||
Shortcodes are simple embed statements that you can put into pages/post that display information.
|
||||
|
||||
- `[comic-archive list=0/1 chapter=# thumbnail=0/1]` Display a list of your comics by individual chapters or all.
|
||||
* list=0 (default) - All chapters, not in parent->child relationship
|
||||
* chapter=# if list=0 and chapter=# (# = chapter ID number) do a singular view
|
||||
* list=1 if list=1 do it for series that has parent->child book->chapter (chapter= will not work)
|
||||
* thumbnail=1 display the thumbnail of the first post it finds
|
||||
- `[cast-page]` Display a list of all of your characters, how many comics they were in and when they first appeared
|
||||
|
||||
= Action Injection Locations =
|
||||
|
||||
A number of injection snippets that you add to your theme, mini navigation for the menubar, comic area and comic blost post area, including post-information is available to customize your theme out with auto generated information.
|
||||
|
||||
|
||||
== Installation ==
|
||||
|
||||
= Modifying themes to use =
|
||||
|
||||
* Modify your theme adding `<?php do_action('comic-area'); ?>` in a position where to display the comic, generally it should be right above the #content and under the menu bar.
|
||||
|
||||
Generally the two files to edit is the index.php and the single.php, however some layouts are auto-generated with code and those you will need to seek advice out from their designers, the makers of those particular themes.
|
||||
|
||||
There are other "action" area's that you can put into your theme, not just the comic-area. Those are being documented and will be available this coming week.
|
||||
|
||||
|
||||
`do_action('comic_area');` - This is for the area you want your comic displayed on the home page and single pages.
|
||||
|
||||
`do_action('comic_blog_area');` - This is for the blog portion of the comic for the home page only.
|
||||
|
||||
`do_action('comic-mini-navigation');` - For menubar's to have mini navigation (prev/next) in them.
|
||||
|
||||
`do_action('comic-post-info');` - For inside of the single/archive/search post pages posts, showing more comic info.
|
||||
|
||||
= Adding the Comic area sidebars =
|
||||
|
||||
Find the code in the functions.php of the theme that registers sidebars. The only relevant information you need to add is the name and ID, just duplicate the rest of how the theme does it. This is completely optional.
|
||||
|
||||
`
|
||||
'name' => 'Over Comic', 'id' => 'over-comic',
|
||||
'name' => 'Left of Comic', id' => 'left-of-comic',
|
||||
'name' => 'Right of Comic', 'id' => 'right-of-comic',
|
||||
'name' => 'Under Comic', 'id' => 'under-comic'
|
||||
`
|
||||
|
||||
The usage in the plugin for get_sidebar is 'over', 'comicleft', 'comicright', 'under' which makes the CSS #sidebar-over #sidebar-comicleft #sidebar-comicright and #sidebar-under which will also look in your theme and child themes for sidebar-over.php sidebar-under.php sidebar-comicleft.php and sidebar-comicright.php which are only optional.
|
||||
|
||||
|
||||
== Frequently Asked Questions ==
|
||||
|
||||
= The permalinks are not working to go to the comic =
|
||||
|
||||
Go to your settings -> permalinks and just click save, the wp_rewrite will refresh. This generally happens after it is first installed and should not happen again.
|
||||
|
||||
|
||||
== Changelog ==
|
||||
|
||||
= 1.0.1 =
|
||||
Updated: 05/26/2012 12:25am Pacific
|
||||
- Made the prev/next link rel's properly navigate for comic posts
|
||||
|
||||
Updated: 05/26/2012 5:25pm Pacific
|
||||
- Sidebar locations for the comic-area
|
||||
|
||||
|
||||
|
||||
== Upgrade Notice ==
|
||||
|
||||
= 1.0.1 =
|
||||
Additions and fixes of 1.0 - reinstall it.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 130 KiB |
@@ -1,35 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
Uploadify v2.1.0
|
||||
Release Date: August 24, 2009
|
||||
|
||||
Copyright (c) 2009 Ronnie Garcia, Travis Nickels
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
$fileArray = array();
|
||||
foreach ($_POST as $key => $value) {
|
||||
if ($key != 'folder') {
|
||||
if (file_exists($_SERVER['DOCUMENT_ROOT'] . $_POST['folder'] . '/' . $value)) {
|
||||
$fileArray[$key] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
echo json_encode($fileArray);
|
||||
?>
|
||||
Binary file not shown.
@@ -1,46 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
Uploadify v2.1.0
|
||||
Release Date: August 24, 2009
|
||||
|
||||
Copyright (c) 2009 Ronnie Garcia, Travis Nickels
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
if (!empty($_FILES)) {
|
||||
$tempFile = $_FILES['Filedata']['tmp_name'];
|
||||
$targetPath = $_SERVER['DOCUMENT_ROOT'] . $_REQUEST['folder'] . '/';
|
||||
$targetFile = str_replace('//','/',$targetPath) . $_FILES['Filedata']['name'];
|
||||
|
||||
// $fileTypes = str_replace('*.','',$_REQUEST['fileext']);
|
||||
// $fileTypes = str_replace(';','|',$fileTypes);
|
||||
// $typesArray = split('\|',$fileTypes);
|
||||
// $fileParts = pathinfo($_FILES['Filedata']['name']);
|
||||
|
||||
// if (in_array($fileParts['extension'],$typesArray)) {
|
||||
// Uncomment the following line if you want to make the directory if it doesn't exist
|
||||
// mkdir(str_replace('//','/',$targetPath), 0755, true);
|
||||
|
||||
move_uploaded_file($tempFile,$targetFile);
|
||||
echo "1";
|
||||
// } else {
|
||||
// echo 'Invalid file type.';
|
||||
// }
|
||||
}
|
||||
?>
|
||||
Binary file not shown.
@@ -0,0 +1,105 @@
|
||||
<?php
|
||||
/*
|
||||
Widget Name: Comic Archive Dropdown
|
||||
Widget URI: http://comiceasel.org/
|
||||
Description: Display a list of links of the latest comics.
|
||||
Author: Philip M. Hofer (Frumph)
|
||||
Version: 1.02
|
||||
*/
|
||||
|
||||
function ceo_comic_archive_jump_to_chapter() {
|
||||
$args = array(
|
||||
'pad_counts' => 1,
|
||||
'orderby' => 'id',
|
||||
'order' => 'DESC',
|
||||
'hide_empty' => 0,
|
||||
'parent' => 0
|
||||
);
|
||||
$parent_chapters = get_terms( 'chapters', $args );
|
||||
$output = '<form method="get">';
|
||||
$output .= '<select onchange="document.location.href=this.options[this.selectedIndex].value;">';
|
||||
$level = 0;
|
||||
$output .= '<option class="level-select" value="">'.__('Select Story','comiceasel').'</option>';
|
||||
if (!is_null($parent_chapters)) {
|
||||
foreach($parent_chapters as $parent_chapter) {
|
||||
$count = '';
|
||||
$parent_args = array(
|
||||
'numberposts' => 1,
|
||||
'post_type' => 'comic',
|
||||
'orderby' => 'post_date',
|
||||
'order' => 'ASC',
|
||||
'post_status' => 'publish',
|
||||
'chapters' => $parent_chapter->slug,
|
||||
);
|
||||
$qposts = get_posts( $parent_args );
|
||||
if (is_array($qposts)) {
|
||||
$qposts = reset($qposts);
|
||||
if ($parent_chapter->count) $count = ' ('.$parent_chapter->count.') ';
|
||||
$output .='<option class="level-0" value="'.get_permalink($qposts->ID).'">'.$parent_chapter->name.$count.'</option>';
|
||||
}
|
||||
$child_chapters = get_term_children( $parent_chapter->term_id, 'chapters' );
|
||||
foreach ($child_chapters as $child) {
|
||||
$child_term = get_term_by( 'id', $child, 'chapters' );
|
||||
if ($child_term->count) {
|
||||
$child_args = array(
|
||||
'numberposts' => 1,
|
||||
'post_type' => 'comic',
|
||||
'orderby' => 'post_date',
|
||||
'order' => 'ASC',
|
||||
'post_status' => 'publish',
|
||||
'chapters' => $child_term->slug
|
||||
);
|
||||
$qcposts = get_posts( $child_args );
|
||||
if (is_array($qcposts)) {
|
||||
$qcposts = reset($qcposts);
|
||||
$output .= '<option class="level-1" value="' . get_permalink($qcposts->ID) . '"> ' . $child_term->name . ' ('.$child_term->count.') </option>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$output .= '</select>';
|
||||
$output .= '<noscript>';
|
||||
$output .= '<div><input type="submit" value="View" /></div>';
|
||||
$output .= '</noscript>';
|
||||
$output .= '</form>';
|
||||
echo $output;
|
||||
}
|
||||
|
||||
class ceo_comic_archive_dropdown_widget extends WP_Widget {
|
||||
|
||||
function ceo_comic_archive_dropdown_widget($skip_widget_init = false) {
|
||||
if (!$skip_widget_init) {
|
||||
$widget_ops = array('classname' => __CLASS__, 'description' => __('Display dropdown list of comic chapters.','easel') );
|
||||
$this->WP_Widget(__CLASS__, __('Comic Easel - Comic Chapters','easel'), $widget_ops);
|
||||
}
|
||||
}
|
||||
|
||||
function widget($args, $instance) {
|
||||
global $post;
|
||||
extract($args, EXTR_SKIP);
|
||||
echo $before_widget;
|
||||
$title = empty($instance['title']) ? __('Comic Chapters','easel') : apply_filters('widget_title', $instance['title']);
|
||||
if ( !empty( $title ) ) { echo $before_title . $title . $after_title; };
|
||||
ceo_comic_archive_jump_to_chapter();
|
||||
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:','easel'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></label></p>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
add_action( 'widgets_init', create_function('', 'return register_widget("ceo_comic_archive_dropdown_widget");') );
|
||||
|
||||
?>
|
||||
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
/*
|
||||
Widget Name: ComicEasel Calendar
|
||||
Widget URI: http://comiceasel.org/
|
||||
Description: Display a calendar of this months posts.
|
||||
Widget Name: Comic Calendar
|
||||
Widget URI: http://frumph.net/
|
||||
Description: Display a calendar of this months posts of comics
|
||||
Author: Philip M. Hofer (Frumph)
|
||||
Author URI: http://frumph.net/
|
||||
Version: 1.03
|
||||
@@ -246,7 +246,7 @@ class comiceasel_calendar_widget extends WP_Widget {
|
||||
function comiceasel_calendar_widget($skip_widget_init = false) {
|
||||
if (!$skip_widget_init) {
|
||||
$widget_ops = array('classname' => __CLASS__, 'description' => __('Display a calendar showing this months posts. (this calendar does not drop lines if there is no title given.)','comiceasel') );
|
||||
$this->WP_Widget(__CLASS__, __('Comic Calendar','comiceasel'), $widget_ops);
|
||||
$this->WP_Widget(__CLASS__, __('Comic Easel - Calendar','comiceasel'), $widget_ops);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -335,10 +335,5 @@ class comiceasel_calendar_widget extends WP_Widget {
|
||||
}
|
||||
}
|
||||
|
||||
add_action( 'widgets_init', 'comiceasel_calendar_widget_init' );
|
||||
|
||||
function comiceasel_calendar_widget_init() {
|
||||
register_widget('comiceasel_calendar_widget');
|
||||
}
|
||||
|
||||
add_action( 'widgets_init', create_function('', 'return register_widget("comiceasel_calendar_widget");') );
|
||||
?>
|
||||
+21
-27
@@ -6,32 +6,31 @@ Description: Display a list of links of the latest comics.
|
||||
Author: Philip M. Hofer (Frumph)
|
||||
Version: 1.02
|
||||
*/
|
||||
|
||||
class ceo_recent_comics_widget extends WP_Widget {
|
||||
|
||||
function ceo_recent_comics_widget() {
|
||||
$widget_ops = array('classname' => __CLASS__, 'description' => __('The most recent comics.', 'comiceasel') );
|
||||
$this->WP_Widget(__CLASS__, __('Recent Comics', 'comiceasel'), $widget_ops);
|
||||
|
||||
class ceo_latest_comics_widget extends WP_Widget {
|
||||
|
||||
function ceo_latest_comics_widget($skip_widget_init = false) {
|
||||
if (!$skip_widget_init) {
|
||||
$widget_ops = array('classname' => __CLASS__, 'description' => __('Display a list of the latest comics','easel') );
|
||||
$this->WP_Widget(__CLASS__, __('Comic Easel - Latest Comics','easel'), $widget_ops);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function widget($args, $instance) {
|
||||
global $post;
|
||||
extract($args, EXTR_SKIP);
|
||||
ceo_Protect();
|
||||
echo $before_widget;
|
||||
$title = empty($instance['title']) ? __('Recent Comics','comiceasel') : apply_filters('widget_title', $instance['title']);
|
||||
$title = empty($instance['title']) ? __('Latest Comics','easel') : apply_filters('widget_title', $instance['title']);
|
||||
if ( !empty( $title ) ) { echo $before_title . $title . $after_title; };
|
||||
$latestcomics = new WP_Query('showposts=5&numberposts=5&post_type=comic');
|
||||
if ($latestcomics->have_posts() ) {
|
||||
?>
|
||||
<ul>
|
||||
<?php while ($latestcomics->have_posts()) {
|
||||
$latestcomics->the_post(); ?>
|
||||
<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
<?php
|
||||
}
|
||||
wp_reset_postdata();
|
||||
$latestmusic = get_posts('numberposts=5&post_type=comic'); ?>
|
||||
<ul>
|
||||
<?php foreach($latestmusic as $post) : ?>
|
||||
<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php
|
||||
ceo_UnProtect();
|
||||
echo $after_widget;
|
||||
}
|
||||
|
||||
@@ -45,16 +44,11 @@ class ceo_recent_comics_widget extends WP_Widget {
|
||||
$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:','comiceasel'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></label></p>
|
||||
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:','easel'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></label></p>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
add_action( 'widgets_init', 'ceo_recent_comics_widget_init' );
|
||||
|
||||
function ceo_recent_comics_widget_init() {
|
||||
register_widget('ceo_recent_comics_widget');
|
||||
}
|
||||
|
||||
add_action( 'widgets_init', create_function('', 'return register_widget("ceo_latest_comics_widget");') );
|
||||
|
||||
?>
|
||||
+16
-22
@@ -6,12 +6,12 @@ Author: Philip M. Hofer (Frumph)
|
||||
Author URI: http://frumph.net/
|
||||
Version: 1.3
|
||||
*/
|
||||
|
||||
|
||||
class ceo_thumbnail_widget extends WP_Widget {
|
||||
|
||||
function ceo_thumbnail_widget() {
|
||||
$widget_ops = array('classname' => __CLASS__, 'description' => __('Display a thumbnail of a comic, by chapter, newest, first or random, clickable to go to the comic.', 'comiceasel') );
|
||||
$this->WP_Widget(__CLASS__, __('Thumbnail', 'comiceasel'), $widget_ops);
|
||||
$widget_ops = array('classname' => __CLASS__, 'description' => __('Display a thumbnail of a comic, by chapter, newest, first or random, clickable to go to the comic.', 'easel') );
|
||||
$this->WP_Widget(__CLASS__, __('Comic Easel - Thumbnail', 'easel'), $widget_ops);
|
||||
}
|
||||
|
||||
function widget($args, $instance) {
|
||||
@@ -34,16 +34,13 @@ class ceo_thumbnail_widget extends WP_Widget {
|
||||
echo $before_widget;
|
||||
$title = empty($instance['title']) ? '' : apply_filters('widget_title', $instance['title']);
|
||||
if ( !empty( $title ) ) { echo $before_title . $title . $after_title; };
|
||||
if (function_exists('has_post_thumbnail')) {
|
||||
if ( has_post_thumbnail($post->ID) ) {
|
||||
echo "<a href=\"".get_permalink($post->ID)."\" rel=\"bookmark\" title=\"Permanent Link to ".get_the_title()."\">".get_the_post_thumbnail($post->ID, 'small')."</a>\r\n";
|
||||
} else {
|
||||
echo "<a href=\"".get_permalink($post->ID)."\" title=\"".$post->post_title."\">".ceo_display_comic_thumbnail('small', $post, true, 198)."</a>\r\n";
|
||||
}
|
||||
} else {
|
||||
echo "here";
|
||||
echo "<a href=\"".get_permalink($post->ID)."\" title=\"".$post->post_title."\">".ceo_display_comic_thumbnail('small', $post, true, 198)."</a>\r\n";
|
||||
}
|
||||
echo "\r\n<center>\r\n";
|
||||
if ( has_post_thumbnail($post->ID) ) {
|
||||
echo "<a href=\"".get_permalink($post->ID)."\" rel=\"bookmark\" title=\"Permanent Link to ".get_the_title()."\">".get_the_post_thumbnail($post->ID, 'thumbnail')."</a>\r\n";
|
||||
} else {
|
||||
echo "No Thumbnail Found.";
|
||||
}
|
||||
echo "\r\n</center>\r\n";
|
||||
echo $after_widget;
|
||||
endwhile;
|
||||
}
|
||||
@@ -66,8 +63,8 @@ class ceo_thumbnail_widget extends WP_Widget {
|
||||
$first = $instance['first'];
|
||||
$random = $instance['random'];
|
||||
?>
|
||||
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'comiceasel'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></label></p>
|
||||
<p><?php _e('Which Chapter?', 'comiceasel'); ?><br />
|
||||
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'easel'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></label></p>
|
||||
<p><?php _e('Which Chapter?', 'easel'); ?><br />
|
||||
<?php
|
||||
|
||||
$allterms = &get_terms('chapters');
|
||||
@@ -86,18 +83,15 @@ class ceo_thumbnail_widget extends WP_Widget {
|
||||
</select>
|
||||
<?php } ?>
|
||||
</p>
|
||||
<p><label for="<?php echo $this->get_field_id('first'); ?>"><?php _e('Get first in chapter instead?','comiceasel'); ?> <input id="<?php echo $this->get_field_id('first'); ?>" name="<?php echo $this->get_field_name('first'); ?>" type="checkbox" value="1" <?php checked(true, $first); ?> /></label></p>
|
||||
<p><label for="<?php echo $this->get_field_id('random'); ?>"><?php _e('Display a random Thumbnail?','comiceasel'); ?> <input id="<?php echo $this->get_field_id('random'); ?>" name="<?php echo $this->get_field_name('random'); ?>" type="checkbox" value="1" <?php checked(true, $random); ?> /></label></p>
|
||||
<p><em><?php _e('*note: Random thumbnail overrides the get first in chapter option.','comiceasel'); ?></em></p>
|
||||
<p><label for="<?php echo $this->get_field_id('first'); ?>"><?php _e('Get first in chapter instead?','easel'); ?> <input id="<?php echo $this->get_field_id('first'); ?>" name="<?php echo $this->get_field_name('first'); ?>" type="checkbox" value="1" <?php checked(true, $first); ?> /></label></p>
|
||||
<p><label for="<?php echo $this->get_field_id('random'); ?>"><?php _e('Display a random Thumbnail?','easel'); ?> <input id="<?php echo $this->get_field_id('random'); ?>" name="<?php echo $this->get_field_name('random'); ?>" type="checkbox" value="1" <?php checked(true, $random); ?> /></label></p>
|
||||
<p><em><?php _e('*note: Random thumbnail overrides the get first in chapter option.','easel'); ?></em></p>
|
||||
<br />
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
add_action( 'widgets_init', 'ceo_thumbnail_widget_init' );
|
||||
add_action( 'widgets_init', create_function('', 'return register_widget("ceo_thumbnail_widget");') );
|
||||
|
||||
function ceo_thumbnail_widget_init() {
|
||||
register_widget('ceo_thumbnail_widget');
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user