Files
comic-easel/comiceasel.php
coraislovely-codeandClaude Fable 5 c404a7cce9 Prepare the 1.18 release
Version 1.18 in the plugin header and the stable tag, with the changelog and an
upgrade notice for the release. Tested up to 7.0 is claimed on the strength of
a manual pass over the recipes in tests/manual on WordPress 7.0.4 and PHP 8.5.

Domain Path names the directory holding the shipped translations, which
WordPress needs to find them for a plugin whose files do not sit under a
matching path. The readme gains the Screenshots section that gives the listing
image its caption.

ceo_pluginfo('version') still answered 1.15 -- it was missed when the header was
corrected for 1.17 -- and now matches the header. It reaches the front end
through the generator meta tag and the update-check user agent.

The screenshot moves to .wordpress-org/, the directory the listing assets are
uploaded from; wordpress.org serves them out of SVN rather than the plugin zip,
so shipping it only added 133 KB to every download. No icon or banner yet.

Co-Authored-By: Claude Fable 5 <[email protected]>
2026-08-13 18:22:10 -04:00

615 lines
24 KiB
PHP

<?php
/*
Plugin Name: Comic Easel
Plugin URI: https://github.com/Frumph/comic-easel
Description: Comic Easel allows you to incorporate a WebComic using the WordPress Media Library functionality with Navigation into almost all WordPress themes. With just a few modifications of adding injection do_action locations into a theme, you can have the theme of your choice display and manage a webcomic.
Version: 1.18
Author: Philip M. Hofer (Frumph)
Author URI: http://frumph.net/
Text Domain: comic-easel
Domain Path: /lang
License: GPLv3 or later
License URI: https://www.gnu.org/licenses/gpl-3.0.html
Requires at least: 4.8.2
Requires PHP: 7.4
Copyright 2012-2018 Philip M. Hofer (Frumph) (email : [email protected])
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
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
if (!defined('ABSPATH')) exit;
add_action('init', 'ceo_initialize_post_types');
function ceo_initialize_post_types() {
if (!post_type_exists('comic')) {
$menu_position = 5;
if (class_exists('Jetpack_Comic')) $menu_position = 6; /* Allow Jetpack to have 5 */
$labels = array(
'name' => __('Comics', 'comic-easel'),
'singular_name' => __('Comic', 'comic-easel'),
'add_new' => __('Add Comic', 'comic-easel'),
'add_new_item' => __('Add Comic', 'comic-easel'),
'edit_item' => __('Edit Comic','comic-easel'),
'edit' => __('Edit', 'comic-easel'),
'new_item' => __('New Comic', 'comic-easel'),
'all_items' => __('All Comics', 'comic-easel'),
'view_item' => __('View Comic', 'comic-easel'),
'search_items' => __('Search Comics', 'comic-easel'),
'not_found' => __('No comics found', 'comic-easel'),
'not_found_in_trash' => __('No comics found in Trash', 'comic-easel'),
'view' => __('View Comic', 'comic-easel'),
'parent_item_colon' => '',
'menu_name' => __('Comics', 'comic-easel')
);
$comic_slug = ceo_pluginfo('custom_post_type_slug_name');
if (empty($comic_slug) || is_array($comic_slug)) $comic_slug = 'comic';
if (ceo_pluginfo('enable_chapter_in_url')) $comic_slug = $comic_slug.'/%chapters%';
register_post_type(
'comic',
array(
'labels' => $labels,
'public' => true,
'public_queryable' => true,
'show_ui' => true,
'query_var' => 'comic', // was true
'capability_type' => 'post',
'taxonomies' => array( 'post_tag' ),
'rewrite' => array( 'slug' => $comic_slug, 'with_front' => true, 'feeds' => true ),
'hierarchical' => false,
'can_export' => true,
'show_in_menu' => true,
'menu_position' => $menu_position,
'exclude_from_search' => false,
'map_meta_cap' => true,
'has_archive' => true,
'menu_icon' => ceo_pluginfo('plugin_url') . 'images/ceo-icon.png',
'supports' => array( 'title', 'editor', 'excerpt', 'author', 'comments', 'thumbnail', 'custom-fields', 'revisions', 'trackbacks', 'shortlinks', 'publicize' ),
/* publicize and shortlinks from jetpack plugin */
'description' => 'Post type for Comics'
));
$chapter_slug = ucwords(ceo_pluginfo('chapter_type_slug_name'));
$chapter_slug_plural = ucwords(ceo_pluginfo('chapter_type_name_plural'));
if (empty($chapter_slug) || is_array($chapter_slug)) $chapter_slug = 'Chapter';
if (empty($chapter_slug_plural) || is_array($chapter_slug_plural)) $chapter_slug_plural = 'Chapters';
$labels = array(
'name' => $chapter_slug_plural,
'menu_name' => $chapter_slug_plural,
'singular_name' => $chapter_slug,
'search_items' => __( 'Search', 'comic-easel' ).' '.$chapter_slug_plural,
'popular_items' => __( 'Popular', 'comic-easel' ).' '.$chapter_slug_plural,
'all_items' => __( 'All', 'comic-easel' ).' '.$chapter_slug_plural,
'parent_item' => __( 'Parent', 'comic-easel' ).' '.$chapter_slug,
'parent_item_colon' => __( 'Parent', 'comic-easel' ).' '.$chapter_slug.':',
'edit_item' => __( 'Edit', 'comic-easel' ).' '.$chapter_slug_plural,
'update_item' => __( 'Update', 'comic-easel' ).' '.$chapter_slug_plural,
'add_new_item' => __( 'Add New', 'comic-easel' ).' '.$chapter_slug,
'new_item_name' => __( 'New', 'comic-easel' ).' '.$chapter_slug.__('Name', 'comic-easel')
);
register_taxonomy('chapters', 'comic', array(
'hierarchical' => true,
'public' => true,
'labels' => $labels,
'show_ui' => true,
'query_var' => true,
'show_tagcloud' => false,
'has_archive' => true,
'rewrite' => array( 'slug' => strtolower($chapter_slug), 'with_front' => true, 'feeds' => true ),
));
$labels = array(
'name' => __('Characters', 'comic-easel' ),
'singular_name' => __( 'Character', 'comic-easel' ),
'search_items' => __( 'Search Characters', 'comic-easel' ),
'popular_items' => __( 'Popular Characters', 'comic-easel' ),
'all_items' => __( 'All Characters', 'comic-easel' ),
'parent_item' => __( 'Parent Character', 'comic-easel' ),
'parent_item_colon' => __( 'Parent Character:', 'comic-easel' ),
'edit_item' => __( 'Edit Character', 'comic-easel' ),
'update_item' => __( 'Update Character', 'comic-easel' ),
'add_new_item' => __( 'Add New Character', 'comic-easel' ),
'new_item_name' => __( 'New Character Name', 'comic-easel' ),
);
register_taxonomy('characters', 'comic', array(
'hierarchical' => false,
'public' => true,
'labels' => $labels,
'show_ui' => true,
'query_var' => true,
'show_tagcloud' => false,
'rewrite' => array( 'slug' => 'character', 'with_front' => true, 'feeds' => false ),
));
$labels = array(
'name' => __( 'Locations', 'comic-easel'),
'singular_name' => __( 'Location', 'comic-easel' ),
'search_items' => __( 'Search Locations', 'comic-easel' ),
'popular_items' => __( 'Popular Locations', 'comic-easel' ),
'all_items' => __( 'All Locations', 'comic-easel' ),
'parent_item' => __( 'Parent Locations', 'comic-easel' ),
'parent_item_colon' => __( 'Parent Location:', 'comic-easel' ),
'edit_item' => __( 'Edit Location', 'comic-easel' ),
'update_item' => __( 'Update Location', 'comic-easel' ),
'add_new_item' => __( 'Add New Location', 'comic-easel' ),
'new_item_name' => __( 'New Location Name', 'comic-easel' ),
);
register_taxonomy('locations', 'comic', array(
'hierarchical' => true,
'public' => true,
'labels' => $labels,
'show_ui' => true,
'query_var' => true,
'show_tagcloud' => false,
'rewrite' => array( 'slug' => 'location', 'with_front' => true, 'feeds' => false ),
));
if (ceo_pluginfo('allow_comics_to_have_categories'))
register_taxonomy_for_object_type('category', 'comic');
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');
}
}
if (ceo_pluginfo('enable_chapter_in_url')) {
add_filter( 'post_type_link', 'ceo_add_chapters_to_permalinks', 1, 2 );
}
function ceo_add_chapters_to_permalinks( $post_link, $id = 0 ){
$post = get_post($id);
$chapter_slug = ucwords(ceo_pluginfo('chapter_type_slug_name'));
if (empty($chapter_slug) || is_array($chapter_slug)) $chapter_slug = 'chapter';
$chapter_slug = strtolower($chapter_slug);
if ( is_object( $post ) && $post->post_type == 'comic' ){
$terms = wp_get_object_terms( $post->ID, 'chapters' );
if( $terms ){
return str_replace( '%chapters%' , $terms[0]->slug , $post_link );
}
}
return $post_link;
}
if (!defined('CEO_FEATURE_DISABLE_REWRITE_RULES') && !ceo_pluginfo('disable_cal_rewrite_rules'))
add_action('generate_rewrite_rules', 'ceo_datearchives_rewrite_rules');
function ceo_datearchives_rewrite_rules($wp_rewrite) {
$rules = ceo_generate_date_archives('comic', $wp_rewrite);
$wp_rewrite->rules = $rules + $wp_rewrite->rules;
return $wp_rewrite;
}
function ceo_generate_date_archives($cpt, $wp_rewrite) {
$rules = array();
$post_type = get_post_type_object($cpt);
$slug_archive = $post_type->has_archive;
if ($slug_archive === false) return $rules;
if ($slug_archive === true) {
$slug_archive = $post_type->name;
}
$dates = array(
array(
'rule' => "([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})",
'vars' => array('year', 'monthnum', 'day')),
array(
'rule' => "([0-9]{4})/([0-9]{1,2})",
'vars' => array('year', 'monthnum')),
array(
'rule' => "([0-9]{4})",
'vars' => array('year'))
);
foreach ($dates as $data) {
$query = 'index.php?post_type='.$cpt;
$rule = $slug_archive.'/'.$data['rule'];
$i = 1;
foreach ($data['vars'] as $var) {
$query.= '&'.$var.'='.$wp_rewrite->preg_index($i);
$i++;
}
$rules[$rule."/?$"] = $query;
$rules[$rule."/feed/(feed|rdf|rss|rss2|atom)/?$"] = $query."&feed=".$wp_rewrite->preg_index($i);
$rules[$rule."/(feed|rdf|rss|rss2|atom)/?$"] = $query."&feed=".$wp_rewrite->preg_index($i);
$rules[$rule."/page/([0-9]{1,})/?$"] = $query."&paged=".$wp_rewrite->preg_index($i);
}
return $rules;
}
// Create CEO Specific Sidebars regardless if they already exist.
function ceo_register_sidebars() {
if (ceo_pluginfo('enable_comic_sidebar_locations')) {
foreach (array(
__('Over Comic', 'comic-easel'),
__('Left of Comic','comic-easel'),
__('Right of Comic', 'comic-easel'),
__('Under Comic', 'comic-easel')
) as $sidebartitle) {
register_sidebar(array(
'name'=> $sidebartitle,
'id' => 'ceo-sidebar-'.sanitize_title($sidebartitle),
'description' => __('Comic Easel Sidebar Location', 'comic-easel'),
'before_widget' => "<div id=\"".'%1$s'."\" class=\"widget ".'%2$s'."\">\r\n<div class=\"widget-head\"></div>\r\n<div class=\"widget-content\">\r\n",
'after_widget' => "</div>\r\n<div class=\"clear\"></div>\r\n<div class=\"widget-foot\"></div>\r\n</div>\r\n",
'before_title' => "<h2 class=\"widgettitle\">",
'after_title' => "</h2>\r\n"
));
}
}
}
add_action('widgets_init', 'ceo_register_sidebars');
/**
* This is function ceo_clean_filename
*
* @param string $filename the BASE filename
* @return string returns the rawurlencoded filename with the %2F put back to /
*
*/
function ceo_clean_filename($filename) {
return str_replace("%2F", "/", rawurlencode($filename));
}
function ceo_revert_filename($filename) {
return rawurldecode($filename);
}
// THIS STUFF ONLY RUNS IN THE WP-ADMIN
if (is_admin()) {
// only load the plugin code of we're in the administration part of WordPress.
@require('ceo-admin.php');
@require('functions/admin-meta.php');
} else {
add_action('wp_print_styles', 'ceo_run_css', 1);
add_action('wp_enqueue_scripts', 'ceo_run_scripts', 1);
}
// This style needs to be loaded on all the comic-easel pages inside ceo-core.php instead.
function ceo_chapters_add_menu_order_column() {
global $wpdb;
$init_query = $wpdb->query("SHOW COLUMNS FROM $wpdb->terms LIKE 'menu_order'");
if (!$init_query) {
$sql = "ALTER TABLE `{$wpdb->terms}` ADD `menu_order` INT (11) NOT NULL DEFAULT 0;";
// phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- The table identifier comes from WordPress's wpdb object; this query has no variable values.
$wpdb->query($sql);
}
}
// currently not hooked in
function ceo_chapters_deactivate() {
global $wpdb;
$sql = "ALTER TABLE `{$wpdb->terms}` DROP COLUMN `menu_order`;";
// phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- The table identifier comes from WordPress's wpdb object; this query has no variable values.
$result = $wpdb->query($sql);
}
/**
* If WPMS loop through and do add column to each blog, otherwise just add it to the non-wpms install
*/
function ceo_chapters_activate() {
global $wpdb;
if (function_exists('is_multisite') && is_multisite()) {
$curr_blog = $wpdb->blogid;
$blogids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
foreach ($blogids as $blog_id) {
switch_to_blog($blog_id);
ceo_chapters_add_menu_order_column();
}
switch_to_blog($curr_blog);
} else
ceo_chapters_add_menu_order_column();
}
// Flush Rewrite Rules
register_activation_hook( __FILE__, 'ceo_initialize_post_types' );
register_activation_hook( __FILE__, 'flush_rewrite_rules' );
register_activation_hook( __FILE__, 'ceo_activation' );
function ceo_activation() {
ceo_chapters_activate();
}
// 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');
// This file handles reading the comic from the filesystem and displaying it
@require('functions/displaycomic.php');
// 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');
/**
* These set of functions are for the configuration ceo_pluginfo() information
*
*/
function ceo_load_options($reset = false) {
if ($reset) delete_option('comiceasel-config');
$ceo_config = get_option('comiceasel-config');
if (empty($ceo_config)) {
delete_option('comiceasel-config');
// get_option() returns false when the option is absent, which is exactly the case
// this branch handles. Assigning into that false is a deprecation on PHP 8.1 and an
// error on PHP 9, so start from a real array.
$ceo_config = array();
foreach (array(
'db_version' => '1.2',
'disable_comic_on_home_page' => false,
'disable_comic_blog_on_home_page' => false,
'click_comic_next' => true,
'navigate_only_chapters' => false,
'enable_chapter_nav' => false,
'enable_comic_nav' => false,
'enable_comment_nav' => true,
'enable_random_nav' => true,
'enable_embed_nav' => false,
'disable_default_nav' => false,
'enable_comments_on_homepage' => false,
'enable_comic_sidebar_locations' => true,
'thumbnail_size_for_rss' => 'thumbnail',
'thumbnail_size_for_direct_rss' => 'full',
'thumbnail_size_for_archive' => 'large',
'thumbnail_size_for_facebook' => 'full',
'graphic_navigation_directory' => 'default',
'disable_mininav' => false,
'include_comics_in_blog_archive' => false,
'disable_related_comics' => true,
'custom_post_type_slug_name' => __('comic','comic-easel'),
'chapter_type_slug_name' => __('chapter', 'comic-easel'),
'chapter_type_name_plural' => __('chapters', 'comic-easel'),
'display_first_comic_on_home_page' => false,
'disable_style_sheet' => false,
'enable_transcripts_in_comic_posts' => false,
'enable_chapter_only_random' => false,
'enable_hoverbox' => false,
'enable_buy_comic' => false,
'buy_comic_email' => '[email protected]',
'buy_comic_currency' => 'USD',
'buy_comic_url' => home_url().'/shop/',
'buy_comic_sell_print' => false,
'buy_comic_print_amount' => '25.00',
'buy_comic_sell_original' => true,
'buy_comic_orig_amount' => '65.00',
'buy_comic_text' => __('*Additional shipping charges will applied at time of purchase.','comic-easel'),
'enable_prevnext_chapter_traversing' => false,
'disable_cal_rewrite_rules' => false,
'chapter_on_home' => 0,
'allow_comics_to_have_categories' => false,
'enable_nav_above_comic' => false,
'enable_chapter_in_url' => false,
'disable_keynav' => false,
'enable_chapter_landing' => false,
'enable_chapter_landing_first' => false,
'enable_blog_on_chapter_landing' => false,
'enable_comments_on_chapter_landing' => false,
'default_nav_bar_chapter_goes_to_archive' => false,
'remove_post_thumbnail' => false
) as $field => $value) {
$ceo_config[$field] = $value;
}
add_option('comiceasel-config', $ceo_config, '', 'yes');
}
return $ceo_config;
}
function ceo_pluginfo($whichinfo = null) {
global $ceo_pluginfo;
// ceo_load_options('reset'); -- uncomment to reset defaults
if (empty($ceo_pluginfo) || $whichinfo == 'reset') {
// Important to assign pluginfo as an array to begin with.
$ceo_pluginfo = array();
$ceo_options = ceo_load_options();
if ( !isset($ceo_options['db_version']) || empty($ceo_options['db_version']) || (version_compare($ceo_options['db_version'], '1.2', '<')) ) {
$ceo_options['db_version'] = '1.2';
$ceo_options['enable_buy_comic'] = false;
$ceo_options['buy_comic_email'] = '[email protected]';
$ceo_options['buy_comic_url'] = home_url().'/shop/';
$ceo_options['buy_comic_amount'] = '25.00';
$ceo_options['buy_comic_sell_original'] = true;
$ceo_options['buy_comic_sell_print'] = false;
$ceo_options['buy_comic_orig_amount'] = '65.00';
$ceo_options['buy_comic_text'] = __('*Additional shipping charges will applied at time of purchase.','comic-easel');
}
if (version_compare($ceo_options['db_version'], '1.3', '<')) {
$ceo_options['db_version'] = '1.3';
$ceo_options['chapter_on_home'] = 0;
}
if (version_compare($ceo_options['db_version'], '1.4', '<')) {
$ceo_options['db_version'] = '1.4';
$ceo_options['allow_comics_to_have_categories'] = false;
}
if (version_compare($ceo_options['db_version'], '1.5', '<')) {
$ceo_options['db_version'] = '1.5';
$ceo_options['enable_nav_above_comic'] = false;
}
if (version_compare($ceo_options['db_version'], '1.6', '<')) {
$ceo_options['db_version'] = '1.6';
$ceo_options['thumbnail_size_for_facebook'] = 'large';
}
if (version_compare($ceo_options['db_version'], '1.7', '<')) {
$ceo_options['db_version'] = '1.7';
$ceo_options['chapter_type_slug_name'] = 'chapter';
$ceo_options['chapter_type_name_plural'] = 'chapters';
}
if (version_compare($ceo_options['db_version'], '1.8', '<')) {
$ceo_options['db_version'] = '1.8';
$ceo_options['disable_keynav'] = false;
update_option('comiceasel-config', $ceo_options);
}
if (version_compare($ceo_options['db_version'], '1.9', '<')) {
$ceo_options['db_version'] = '1.9';
$ceo_options['enable_comic_nav'] = false;
update_option('comiceasel-config', $ceo_options);
}
if (version_compare($ceo_options['db_version'], '1.9.6', '<')) {
$ceo_options['db_version'] = '1.9.6';
$ceo_options['enable_chapter_landing'] = false;
$ceo_options['enable_chapter_landing_first'] = false;
$ceo_options['enable_blog_on_chapter_landing'] = false;
$ceo_options['enable_comments_on_chapter_landing'] = false;
$ceo_options['default_nav_bar_chapter_goes_to_archive'] = false;
update_option('comiceasel-config', $ceo_options);
}
if (version_compare($ceo_options['db_version'], '1.9.7', '<')) {
$ceo_options['db_version'] = '1.9.7';
$ceo_options['remove_post_thumbnail'] = false;
update_option('comiceasel-config', $ceo_options);
}
if (version_compare($ceo_options['db_version'], '1.9.8', '<')) {
$ceo_options['db_version'] = '1.9.8';
update_option('comiceasel-config', $ceo_options);
}
if (version_compare($ceo_options['db_version'], '1.9.9', '<')) {
$ceo_options['db_version'] = '1.9.9';
$currency = isset($ceo_options['buy_comic_currency']) ? strtoupper(trim((string)$ceo_options['buy_comic_currency'])) : '';
// Existing stores previously relied on the PayPal account's implicit currency.
// Do not guess and risk charging in the wrong one; the owner must choose it once.
$ceo_options['buy_comic_currency'] = preg_match('/^[A-Z]{3}$/', $currency) ? $currency : '';
update_option('comiceasel-config', $ceo_options);
}
$ceo_coreinfo = wp_upload_dir();
$ceo_addinfo = array(
// if wp_upload_dir reports an error, capture it
'error' => $ceo_coreinfo['error'],
// upload_path-url
'base_url' => trailingslashit($ceo_coreinfo['baseurl']),
'base_path' => trailingslashit($ceo_coreinfo['basedir']),
// Parent theme
'theme_url' => get_template_directory_uri(),
'theme_path' => get_template_directory(),
// Child Theme (or parent if no child)
'style_url' => get_stylesheet_directory_uri(),
'style_path' => get_stylesheet_directory(),
// comic-easel plugin directory/url
'plugin_url' => plugin_dir_url(__FILE__),
'plugin_path' => plugin_dir_path(__FILE__),
'version' => '1.18'
);
// Combine em.
$ceo_pluginfo = array_merge($ceo_pluginfo, $ceo_addinfo);
$ceo_pluginfo = array_merge($ceo_pluginfo, $ceo_options);
if (!isset($ceo_pluginfo['disable_style_sheet'])) $ceo_pluginfo['disable_style_sheet'] = false;
if (!isset($ceo_pluginfo['enable_transcripts_in_comic_posts'])) $ceo_pluginfo['enable_transcripts_in_comic_posts'] = false;
if (!isset($ceo_pluginfo['enable_prevnext_chapter_traversing'])) $ceo_pluginfo['enable_prevnext_chapter_traversing'] = false;
}
if ($whichinfo) {
if (isset($ceo_pluginfo[$whichinfo])) {
return $ceo_pluginfo[$whichinfo];
} else return false;
}
return $ceo_pluginfo;
}
// Load all the widgets
foreach (glob(ceo_pluginfo('plugin_path') . 'widgets/*.php') as $widgefile) {
require_once($widgefile);
}
// for older PHP versions cannot use function inside of add_action
add_action( 'widgets_init', 'ceo_register_widgets');
function ceo_register_widgets() {
register_widget('ceo_comic_archive_dropdown_widget');
register_widget('ceo_casthover_reference_widget');
register_widget('ceo_comic_blog_post_widget');
register_widget('ceo_calendar_widget');
register_widget('ceo_comic_list_dropdown_widget');
register_widget('ceo_comic_navigation_widget');
register_widget('ceo_latest_comics_widget');
register_widget('ceo_scheduled_comics_widget');
register_widget('ceo_thumbnail_widget');
}
/**
* Keep this explicit call, which Plugin Check discourages. It names lang/, which the plugin
* headers do not, and on WordPress before 6.7 -- where nothing else asks for a translation file
* by name -- it is the only thing that gives ceo_legacy_textdomain_mofile() in
* functions/filters.php a chance to redirect the request to a translation a site compiled under
* the old text domain.
*/
function ceo_language_init() {
load_plugin_textdomain( 'comic-easel', false, dirname( plugin_basename( __FILE__ ) ) . '/lang/' );
}
add_action('plugins_loaded', 'ceo_language_init');
function ceo_run_css() {
if (!ceo_pluginfo('disable_style_sheet')) {
wp_register_style('comiceasel-style', ceo_pluginfo('plugin_url').'css/comiceasel.css');
wp_enqueue_style('comiceasel-style');
if (is_active_widget(false, false, 'ceo_comic_navigation_widget', true)) {
if (is_child_theme() && file_exists(get_stylesheet_directory() . '/images/nav/' . ceo_pluginfo('graphic_navigation_directory') . '/navstyle.css')) {
wp_register_style('comiceasel-navstyle',get_stylesheet_directory_uri() . '/images/nav/' . ceo_pluginfo('graphic_navigation_directory') . '/navstyle.css');
} elseif (file_exists(get_template_directory() . '/images/nav/' . ceo_pluginfo('graphic_navigation_directory'). '/navstyle.css')) {
wp_register_style('comiceasel-navstyle',get_template_directory_uri() . '/images/nav/' . ceo_pluginfo('graphic_navigation_directory') . '/navstyle.css');
} elseif (file_exists(ceo_pluginfo('plugin_path') . 'images/nav/' . ceo_pluginfo('graphic_navigation_directory') . '/navstyle.css')) {
wp_register_style('comiceasel-navstyle', ceo_pluginfo('plugin_url').'images/nav/'. ceo_pluginfo('graphic_navigation_directory'). '/navstyle.css');
} else
wp_register_style('comiceasel-navstyle', ceo_pluginfo('plugin_url').'css/navstyle.css');
wp_enqueue_style('comiceasel-navstyle');
}
}
}
function ceo_run_scripts() {
global $post;
if (!empty($post)) {
$comic_content_warning = get_post_meta( $post->ID, 'comic-content-warning', true );
if ($comic_content_warning) {
add_action('wp_head', 'ceo_content_warning_in_head');
wp_enqueue_script('ceo_comic_content_warning', ceo_pluginfo('plugin_url').'js/content-warning.js', null, null, true);
}
}
if (!ceo_pluginfo('disable_keynav')) {
wp_enqueue_script('ceo_keynav', ceo_pluginfo('plugin_url').'js/keynav.js', array('jquery'), null, true);
}
}