add monetize widget (base) and refix the comiceasel.php files editing

This commit is contained in:
Frumph
2018-11-19 10:39:29 -08:00
parent a75de53259
commit 2a84bd0f15
3 changed files with 64 additions and 4 deletions

View File

@@ -289,8 +289,6 @@ if (is_admin()) {
// 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'");
@@ -417,7 +415,7 @@ function ceo_load_options($reset = false) {
'enable_comments_on_chapter_landing' => false,
'default_nav_bar_chapter_goes_to_archive' => false,
'remove_post_thumbnail' => false,
'bf_code' => ''
'bf_adinfo' => ''
) as $field => $value) {
$ceo_config[$field] = $value;
}
@@ -492,7 +490,7 @@ function ceo_pluginfo($whichinfo = null) {
}
if (version_compare($ceo_options['db_version'], '1.9.8', '<')) {
$ceo_options['db_version'] = '1.9.8';
$ceo_options['bf_code'] = '';
$ceo_options['bf_adinfo'] = '';
update_option('comiceasel-config', $ceo_options);
}
$ceo_coreinfo = wp_upload_dir();
@@ -554,6 +552,7 @@ foreach (glob(ceo_pluginfo('plugin_path') . 'widgets/*.php') as $widgefile) {
add_action( 'widgets_init', 'ceo_register_widgets');
function ceo_register_widgets() {
register_widget('ceo_bf_adwidget');
register_widget('ceo_comic_archive_dropdown_widget');
register_widget('ceo_casthover_reference_widget');
register_widget('ceo_comic_blog_post_widget');

View File

@@ -133,6 +133,7 @@ The comic navigation widget is only seen if you have the comic sidebar's enabled
* keynav update - to preserve browser forward/back functions / jn-squire
* added Text Domain: to readme / Frumph
* added .comic_navi width auto to fix for alternative themes that adjust tables to max width
* added Monetize with widgets*
= 1.14 =
* compatibility check w/4.8.2 of WordPress

60
widgets/bf_adwidget.php Normal file
View File

@@ -0,0 +1,60 @@
<?php
/*
Widget Name: BF_adwidget
Description: Display an advertisement for BF based on code, will not display if no-code
Author: Philip M. Hofer (Frumph)
Author URI: http://frumph.net/
Version: 1.0
*/
class ceo_bf_adwidget extends WP_Widget {
/**
* Register widget with WordPress.
*/
function __construct() {
parent::__construct(
__CLASS__, // Base ID
__( 'Comic Easel - BF Ad Widget', 'comiceasel' ), // Name
array( 'classname' => __CLASS__, 'description' => __( 'Display a BF Advertisement based on dropdown selection.', 'comiceasel' ), ) // Args
);
}
function widget($args, $instance) {
global $post, $wp_query;
extract($args, EXTR_SKIP);
ceo_protect();
$center = (isset($instance['center'])) ? $instance['center'] : '0';
$divID = (isset($instance['divID'])) ? $instance['divID'] : '';
echo $before_widget;
$title = empty($instance['title']) ? '' : apply_filters('widget_title', $instance['title']);
if ( !empty( $title ) ) { echo $before_title . $title . $after_title; };
echo $after_widget;
ceo_unprotect();
}
function update($new_instance, $old_instance) {
$instance = $old_instance;
$instance['title'] = strip_tags($new_instance['title']);
$instance['divID'] = strip_tags($new_instance['divID']);
$instance['center'] = (bool)( $new_instance['center'] == 1 ? true : false );
return $instance;
}
function form($instance) {
$instance = wp_parse_args( (array) $instance, array( 'title' => '', 'divID' => '', 'center' => false) );
$title = strip_tags($instance['title']);
$divID = (isset($instance['divID'])) ? $instance['divID'] : '';
$center = (isset($instance['center'])) ? $instance['center'] : '0';
?>
<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('divID'); ?>"><?php _e('div ID:','comiceasel'); ?></label>
<input class="widefat" id="<?php echo $this->get_field_id('divID'); ?>" name="<?php echo $this->get_field_name('divID'); ?>" type="text" value="<?php echo esc_attr($divID); ?>" /></label><br />
<?php _e('*Found on the customer portal page for the adsize you want to use.'); ?></p>
<p><label for="<?php echo $this->get_field_id('center'); ?>"><?php _e('Add Centering?','comiceasel'); ?> <input id="<?php echo $this->get_field_id('center'); ?>" name="<?php echo $this->get_field_name('center'); ?>" type="checkbox" value="1" <?php checked(true, $center); ?> /></label></p>
<br />
<?php
}
}