| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
| 3 |
|
| 4 |
function mbt_admin_pages_init() { |
| 5 |
if(is_admin()) { |
| 6 |
add_action('admin_menu', 'mbt_add_admin_pages', 9); |
| 7 |
add_action('admin_enqueue_scripts', 'mbt_enqueue_admin_resources'); |
| 8 |
} |
| 9 |
} |
| 10 |
add_action('mbt_init', 'mbt_admin_pages_init'); |
| 11 |
|
| 12 |
function mbt_enqueue_admin_resources() { |
| 13 |
wp_enqueue_style('mbt-admin-global-css', plugins_url('css/admin-global-style.css', dirname(__FILE__)), array(), MBT_VERSION); |
| 14 |
wp_enqueue_script('mbt-admin-global-js', plugins_url('js/admin-global.js', dirname(__FILE__)), array('jquery'), MBT_VERSION); |
| 15 |
|
| 16 |
if(!mbt_is_mbt_admin_page()) { return; } |
| 17 |
|
| 18 |
wp_enqueue_style('mbt-admin-css', plugins_url('css/admin-style.css', dirname(__FILE__)), array(), MBT_VERSION); |
| 19 |
wp_enqueue_style('mbt-jquery-ui', plugins_url('css/jquery-ui.css', dirname(__FILE__)), array(), MBT_VERSION); |
| 20 |
|
| 21 |
wp_enqueue_script('jquery-ui-core'); |
| 22 |
wp_enqueue_script('jquery-ui-widget'); |
| 23 |
wp_enqueue_script('jquery-ui-position'); |
| 24 |
wp_enqueue_script('jquery-ui-tabs'); |
| 25 |
wp_enqueue_script('jquery-ui-sortable'); |
| 26 |
wp_enqueue_script('jquery-ui-slider'); |
| 27 |
wp_enqueue_script('jquery-ui-accordion'); |
| 28 |
|
| 29 |
wp_enqueue_script('mbt-admin-pages', plugins_url('js/admin.js', dirname(__FILE__)), array('jquery', 'underscore', 'jquery-ui-core', 'jquery-ui-widget', 'jquery-ui-position', 'jquery-ui-tabs', 'jquery-ui-sortable', 'jquery-ui-slider', 'jquery-ui-accordion'), MBT_VERSION); |
| 30 |
wp_localize_script('mbt-admin-pages', 'mbt_admin_pages_i18n', array( |
| 31 |
'select' => __('Select', 'mybooktable'), |
| 32 |
'post_title' => __('Post Title', 'mybooktable'), |
| 33 |
'post_date' => __('Post Date', 'mybooktable'), |
| 34 |
'author' => __('Author', 'mybooktable'), |
| 35 |
'genre' => __('Genre', 'mybooktable'), |
| 36 |
'tag' => __('Tag', 'mybooktable'), |
| 37 |
'series' => __('Series', 'mybooktable'), |
| 38 |
'series_order' => __('Series Order', 'mybooktable'), |
| 39 |
'ascending' => __('Ascending', 'mybooktable'), |
| 40 |
'descending' => __('Descending', 'mybooktable'), |
| 41 |
'import_interrupted' => __('Import Interrupted', 'mybooktable'), |
| 42 |
'import_complete' => __('Import Complete', 'mybooktable'), |
| 43 |
'successfully_imported' => __('Successfully imported', 'mybooktable'), |
| 44 |
'swich_to_mode' => __('Switch to mode', 'mybooktable'), |
| 45 |
'set_author_priority' => __('Set the priority (order) of the authors', 'mybooktable'), |
| 46 |
'enter_main_author_bio' => __('Edit the main author bio', 'mybooktable'), |
| 47 |
)); |
| 48 |
if(function_exists('wp_enqueue_media')) { wp_enqueue_media(); } |
| 49 |
} |
| 50 |
|
| 51 |
function mbt_add_admin_pages() { |
| 52 |
add_menu_page(__('MyBookTable', 'mybooktable'), __('MyBookTable', 'mybooktable'), 'edit_posts', 'mbt_dashboard', 'mbt_render_dashboard', 'dashicons-book-alt', '10.7'); |
| 53 |
add_submenu_page('mbt_dashboard', __('Books', 'mybooktable'), __('Books', 'mybooktable'), 'edit_posts', 'edit.php?post_type=mbt_book'); |
| 54 |
add_submenu_page('mbt_dashboard', __('Add Book', 'mybooktable'), __('Add Book', 'mybooktable'), 'edit_posts', 'post-new.php?post_type=mbt_book'); |
| 55 |
add_submenu_page('mbt_dashboard', __('Authors', 'mybooktable'), __('Authors', 'mybooktable'), 'manage_categories', 'edit-tags.php?taxonomy=mbt_author&post_type=mbt_book'); |
| 56 |
add_submenu_page('mbt_dashboard', __('Genres', 'mybooktable'), __('Genres', 'mybooktable'), 'manage_categories', 'edit-tags.php?taxonomy=mbt_genre&post_type=mbt_book'); |
| 57 |
add_submenu_page('mbt_dashboard', __('Series', 'mybooktable'), __('Series', 'mybooktable'), 'manage_categories', 'edit-tags.php?taxonomy=mbt_series&post_type=mbt_book'); |
| 58 |
add_submenu_page('mbt_dashboard', __('Tags', 'mybooktable'), __('Tags', 'mybooktable'), 'manage_categories', 'edit-tags.php?taxonomy=mbt_tag&post_type=mbt_book'); |
| 59 |
add_submenu_page('mbt_dashboard', __('Import Books', 'mybooktable'), __('Import Books', 'mybooktable'), 'edit_posts', 'mbt_import', 'mbt_render_import_page'); |
| 60 |
add_submenu_page('mbt_dashboard', __('MyBookTable Settings', 'mybooktable'), __('Settings', 'mybooktable'), 'manage_options', 'mbt_settings', 'mbt_render_settings_page'); |
| 61 |
add_submenu_page('mbt_dashboard', __('MyBookTable Help', 'mybooktable'), __('Help', 'mybooktable'), 'edit_posts', 'mbt_help', 'mbt_render_help_page'); |
| 62 |
|
| 63 |
if(mbt_get_upgrade() === false) { |
| 64 |
$page_hook = add_submenu_page('mbt_dashboard', __('Upgrade', 'mybooktable'), __('Upgrade MyBookTable', 'mybooktable'), 'edit_posts', 'mbt_upgrade_link', ' '); |
| 65 |
add_action('load-'.$page_hook, 'mbt_upgrade_link_redirect'); |
| 66 |
} |
| 67 |
|
| 68 |
remove_menu_page("edit.php?post_type=mbt_book"); |
| 69 |
remove_submenu_page("edit.php?post_type=mbt_book", "edit.php?post_type=mbt_book"); |
| 70 |
remove_submenu_page("edit.php?post_type=mbt_book", "post-new.php?post_type=mbt_book"); |
| 71 |
remove_submenu_page("edit.php?post_type=mbt_book", "edit-tags.php?taxonomy=mbt_author&post_type=mbt_book"); |
| 72 |
remove_submenu_page("edit.php?post_type=mbt_book", "edit-tags.php?taxonomy=mbt_genre&post_type=mbt_book"); |
| 73 |
remove_submenu_page("edit.php?post_type=mbt_book", "edit-tags.php?taxonomy=mbt_series&post_type=mbt_book"); |
| 74 |
remove_submenu_page("edit.php?post_type=mbt_book", "edit-tags.php?taxonomy=mbt_tag&post_type=mbt_book"); |
| 75 |
} |
| 76 |
|
| 77 |
function mbt_upgrade_link_redirect() { |
| 78 |
wp_safe_redirect('https://www.stormhillmedia.com/all-products/mybooktable/upgrades/', 301); |
| 79 |
exit(); |
| 80 |
} |
| 81 |
|
| 82 |
/*---------------------------------------------------------*/ |
| 83 |
/* Settings Page */ |
| 84 |
/*---------------------------------------------------------*/ |
| 85 |
|
| 86 |
function mbt_settings_page_init() { |
| 87 |
add_action('wp_ajax_mbt_api_key_refresh', 'mbt_api_key_refresh_ajax'); |
| 88 |
add_action('wp_ajax_mbt_style_pack_preview', 'mbt_style_pack_preview_ajax'); |
| 89 |
add_action('wp_ajax_mbt_button_size_preview', 'mbt_button_size_preview_ajax'); |
| 90 |
add_action('wp_ajax_mbt_check_reviews', 'mbt_check_reviews_ajax'); |
| 91 |
add_action('wp_ajax_mbt_google_api_key_refresh', 'mbt_google_api_key_refresh_ajax'); |
| 92 |
|
| 93 |
//needs to happen before setup.php admin_init in order to properly update admin notices |
| 94 |
add_action('admin_init', 'mbt_save_settings_page'); |
| 95 |
} |
| 96 |
add_action('mbt_init', 'mbt_settings_page_init'); |
| 97 |
|
| 98 |
function mbt_save_settings_page() { |
| 99 |
if( (isset($_REQUEST['page']) && $_REQUEST['page'] === 'mbt_settings') && ((isset($_REQUEST['data-settings-nonce']) && wp_verify_nonce(sanitize_key($_REQUEST['data-settings-nonce']),'mbt-settings-nonce'))) && isset($_REQUEST['save_settings'])) { |
| 100 |
|
| 101 |
do_action('mbt_settings_save'); |
| 102 |
|
| 103 |
if(isset($_REQUEST['mbt_api_key']) && $_REQUEST['mbt_api_key'] !== mbt_get_setting('api_key') && $_REQUEST['mbt_api_key'] !== mbt_hide_api_key(mbt_get_setting('api_key'))) { |
| 104 |
mbt_update_setting('api_key', sanitize_text_field(wp_unslash($_REQUEST['mbt_api_key']))); |
| 105 |
mbt_verify_api_key(); |
| 106 |
} |
| 107 |
if(isset($_REQUEST['mbt_product_name'])){ |
| 108 |
mbt_update_setting('product_name', sanitize_text_field(wp_unslash($_REQUEST['mbt_product_name']))); |
| 109 |
mbt_update_setting('product_slug', sanitize_title(wp_unslash($_REQUEST['mbt_product_name']))); |
| 110 |
} |
| 111 |
if(isset($_REQUEST['mbt_booktable_page'])){ |
| 112 |
mbt_update_setting('booktable_page', intval($_REQUEST['mbt_booktable_page'])); |
| 113 |
} |
| 114 |
mbt_update_setting('compatibility_mode', isset($_REQUEST['mbt_compatibility_mode'])); |
| 115 |
mbt_update_setting('enable_socialmedia_single_book',isset($_REQUEST['mbt_enable_socialmedia_single_book'])); |
| 116 |
|
| 117 |
mbt_update_setting('enable_socialmedia_book_excerpt', isset($_REQUEST['mbt_enable_socialmedia_book_excerpt'])); |
| 118 |
|
| 119 |
mbt_update_setting('enable_seo', isset($_REQUEST['mbt_enable_seo'])); |
| 120 |
|
| 121 |
if(isset($_REQUEST['mbt_style_pack'])){ |
| 122 |
mbt_update_setting('style_pack', sanitize_text_field(wp_unslash($_REQUEST['mbt_style_pack']))); |
| 123 |
} |
| 124 |
if(isset($_REQUEST['mbt_image_size'])){ |
| 125 |
mbt_update_setting('image_size', sanitize_text_field(wp_unslash($_REQUEST['mbt_image_size']))); |
| 126 |
} |
| 127 |
mbt_update_setting('reviews_type', isset($_REQUEST['mbt_reviews_type']) ? sanitize_text_field(wp_unslash($_REQUEST['mbt_reviews_type'])) : 'none'); |
| 128 |
|
| 129 |
if(isset($_REQUEST['mbt_buybutton_shadowbox'])){ |
| 130 |
mbt_update_setting('buybutton_shadowbox', sanitize_text_field(wp_unslash($_REQUEST['mbt_buybutton_shadowbox']))); |
| 131 |
} |
| 132 |
|
| 133 |
mbt_update_setting('enable_breadcrumbs', isset($_REQUEST['mbt_enable_breadcrumbs'])); |
| 134 |
mbt_update_setting('show_series', isset($_REQUEST['mbt_show_series'])); |
| 135 |
mbt_update_setting('show_find_bookstore', isset($_REQUEST['mbt_show_find_bookstore'])); |
| 136 |
mbt_update_setting('show_find_bookstore_buybuttons_shadowbox', isset($_REQUEST['mbt_show_find_bookstore_buybuttons_shadowbox'])); |
| 137 |
mbt_update_setting('show_about_author', isset($_REQUEST['mbt_show_about_author'])); |
| 138 |
mbt_update_setting('hide_domc_notice', isset($_REQUEST['mbt_hide_domc_notice'])); |
| 139 |
if(isset($_REQUEST['mbt_domc_notice_text'])){ |
| 140 |
mbt_update_setting('domc_notice_text', wp_kses_post(wp_unslash($_REQUEST['mbt_domc_notice_text']))); |
| 141 |
} |
| 142 |
if(isset($_REQUEST['mbt_posts_per_page'])){ |
| 143 |
mbt_update_setting('posts_per_page', intval(sanitize_text_field(wp_unslash($_REQUEST['mbt_posts_per_page'])))); |
| 144 |
} |
| 145 |
if(isset($_REQUEST['mbt_book_button_size'])){ |
| 146 |
mbt_update_setting('book_button_size', sanitize_text_field(wp_unslash($_REQUEST['mbt_book_button_size']))); |
| 147 |
} |
| 148 |
if(isset($_REQUEST['mbt_listing_button_size'])){ |
| 149 |
mbt_update_setting('listing_button_size', sanitize_text_field(wp_unslash($_REQUEST['mbt_listing_button_size']))); |
| 150 |
} |
| 151 |
if(isset($_REQUEST['mbt_widget_button_size'])){ |
| 152 |
mbt_update_setting('widget_button_size', sanitize_text_field(wp_unslash($_REQUEST['mbt_widget_button_size']))); |
| 153 |
} |
| 154 |
if(isset($_REQUEST['mbt_google_api_key'])){ |
| 155 |
mbt_update_setting('google_api_key', sanitize_text_field(wp_unslash($_REQUEST['mbt_google_api_key']))); |
| 156 |
} |
| 157 |
$settings_updated = true; |
| 158 |
} else if(isset($_REQUEST['page']) and $_REQUEST['page'] === 'mbt_settings' and isset($_REQUEST['save_default_affiliate_settings'])) { |
| 159 |
if(isset($_REQUEST['mbt_enable_default_affiliates']) and !empty($_REQUEST['mbt_enable_default_affiliates'])) { |
| 160 |
mbt_update_setting('enable_default_affiliates', $_REQUEST['mbt_enable_default_affiliates'] === 'true'); |
| 161 |
} |
| 162 |
} |
| 163 |
} |
| 164 |
|
| 165 |
function mbt_hide_api_key($key) { |
| 166 |
if (strlen($key) > 0){ |
| 167 |
return substr($key, 0, 4) . str_repeat("*", max(0, strlen($key)-4)); |
| 168 |
} |
| 169 |
} |
| 170 |
|
| 171 |
function mbt_api_key_refresh_ajax() { |
| 172 |
if(!current_user_can('manage_options')) { die(); } |
| 173 |
if(isset($_REQUEST['mbt_nonce']) && wp_verify_nonce(sanitize_key($_REQUEST['mbt_nonce']),'mbt-ajax-nonce')){ |
| 174 |
if(isset($_REQUEST['data']) && $_REQUEST['data'] !== mbt_hide_api_key(mbt_get_setting('api_key'))) { |
| 175 |
mbt_update_setting('api_key', sanitize_text_field(wp_unslash($_REQUEST['data']))); |
| 176 |
} |
| 177 |
mbt_verify_api_key(); |
| 178 |
echo(wp_kses_post(mbt_api_key_feedback())); |
| 179 |
die(); |
| 180 |
} else { |
| 181 |
die( esc_attr_e('Nonce Failed', 'mybooktable')); |
| 182 |
} |
| 183 |
} |
| 184 |
|
| 185 |
function mbt_api_key_feedback() { |
| 186 |
$output = ''; |
| 187 |
if(mbt_get_setting('api_key') and mbt_get_setting('api_key_status') != 0) { |
| 188 |
if(mbt_get_setting('api_key_status') > 0) { |
| 189 |
$output .= '<span class="mbt_admin_message_success">'.__('Valid License Key', 'mybooktable').': '.mbt_get_setting('api_key_message').'</span>'; |
| 190 |
$upgrade_message = mbt_get_upgrade_message(false, '', ''); |
| 191 |
if(!empty($upgrade_message)) { $output .= '<br>'.$upgrade_message; } |
| 192 |
} else { |
| 193 |
$output .= '<span class="mbt_admin_message_failure">'.__('Invalid License Key', 'mybooktable').': '.mbt_get_setting('api_key_message').'</span>'; |
| 194 |
} |
| 195 |
} |
| 196 |
return $output; |
| 197 |
} |
| 198 |
|
| 199 |
function mbt_google_api_key_refresh_ajax() { |
| 200 |
if(!isset($_REQUEST['mbt_nonce']) || !wp_verify_nonce(sanitize_key($_REQUEST['mbt_nonce']), 'mbt-ajax-nonce')) { die(); } |
| 201 |
if(!empty($_REQUEST['data'])) { |
| 202 |
echo('<span class="mbt_admin_message_success">'.esc_attr_e('Valid API Key', 'mybooktable').'</span>'); |
| 203 |
} |
| 204 |
die(); |
| 205 |
} |
| 206 |
|
| 207 |
function mbt_style_pack_preview_ajax() { |
| 208 |
if(!isset($_REQUEST['mbt_nonce']) || !wp_verify_nonce(sanitize_key($_REQUEST['mbt_nonce']), 'mbt-ajax-nonce')) { die(); } |
| 209 |
if(isset($_REQUEST['data'])){ |
| 210 |
echo(wp_kses_post('<img src="'.mbt_style_url('bnn_button.png', sanitize_text_field(wp_unslash($_REQUEST['data']))).'" />')); |
| 211 |
} |
| 212 |
die(); |
| 213 |
} |
| 214 |
|
| 215 |
function mbt_button_size_preview_ajax() { |
| 216 |
if(!isset($_REQUEST['mbt_nonce']) || !wp_verify_nonce(sanitize_key($_REQUEST['mbt_nonce']), 'mbt-ajax-nonce')) { die(); } |
| 217 |
if(isset($_REQUEST['data'])){ |
| 218 |
mbt_button_size_feedback(sanitize_text_field(wp_unslash($_REQUEST['data']))); |
| 219 |
} |
| 220 |
die(); |
| 221 |
} |
| 222 |
|
| 223 |
function mbt_button_size_feedback($size) { |
| 224 |
$id = 'mbt_book_'.time().'_'.wp_rand(); |
| 225 |
echo(wp_kses_post('<img id="'.$id.'" src="'.mbt_style_url('bnn_button.png', mbt_get_default_style_pack()).'">')); |
| 226 |
echo('<style type="text/css">'); |
| 227 |
if($size === 'small') { echo('#'.esc_attr($id).' { width: 144px; height: 25px; }'); } |
| 228 |
else if($size === 'medium') { echo('#'.esc_attr($id).' { width: 172px; height: 30px; }'); } |
| 229 |
else { echo('#'.esc_attr($id).' { width: 201px; height: 35px; }'); } |
| 230 |
echo('</style>'); |
| 231 |
} |
| 232 |
|
| 233 |
function mbt_check_reviews_ajax() { |
| 234 |
if(!isset($_REQUEST['mbt_nonce']) || !wp_verify_nonce(sanitize_key($_REQUEST['mbt_nonce']), 'mbt-ajax-nonce')) { die(); } |
| 235 |
$output = ''; |
| 236 |
$reviews_types = mbt_get_reviews_types(); |
| 237 |
if(isset($_REQUEST['reviews_type'])){ |
| 238 |
$reviews_type = sanitize_text_field(wp_unslash($_REQUEST['reviews_type'])); |
| 239 |
} else { |
| 240 |
$reviews_type = ''; |
| 241 |
} |
| 242 |
if(!empty($reviews_types[$reviews_type]['book-check'])) { |
| 243 |
$books_query = new WP_Query(array('post_type' => 'mbt_book', 'posts_per_page' => -1)); |
| 244 |
$books_results = array(); |
| 245 |
foreach ($books_query->posts as $book) { |
| 246 |
$result = call_user_func_array($reviews_types[$reviews_type]['book-check'], array($book->ID)); |
| 247 |
$books_results[] = array('id' => $book->ID, 'title' => (strlen($book->post_title) > 30 ? substr($book->post_title, 0, 30) : $book->post_title), 'result' => $result); |
| 248 |
} |
| 249 |
|
| 250 |
$sort_books_results = function($a, $b) { |
| 251 |
$a_val = (strpos($a['result'], 'mbt_admin_message_failure') !== false) ? 0 : ((strpos($a['result'], 'mbt_admin_message_warning') !== false) ? 1 : 2); |
| 252 |
$b_val = (strpos($b['result'], 'mbt_admin_message_failure') !== false) ? 0 : ((strpos($b['result'], 'mbt_admin_message_warning') !== false) ? 1 : 2); |
| 253 |
return $a_val == $b_val ? 0 : ($a_val > $b_val ? 1 : -1); |
| 254 |
}; |
| 255 |
usort($books_results, $sort_books_results); |
| 256 |
|
| 257 |
$output .= '<ul id="mbt-check-reviews-results-list">'; |
| 258 |
foreach($books_results as $result) { |
| 259 |
$output .= '<li><a href="'.get_permalink($result['id']).'" target="_blank">'.$result['title'].'</a> - '.$result['result'].'</li>'; |
| 260 |
} |
| 261 |
$output .= '</ul>'; |
| 262 |
} else { |
| 263 |
$output .= '<div class="mbt-check-reviews-noresults">This reviews system does not support reviews checking.</div>'; |
| 264 |
} |
| 265 |
|
| 266 |
echo(wp_kses_post($output)); exit(); |
| 267 |
} |
| 268 |
|
| 269 |
|
| 270 |
function mbt_render_settings_page() { |
| 271 |
$mbt_settings_nonce = wp_create_nonce('mbt-settings-nonce','data-settings-nonce'); |
| 272 |
$mbt_nonce = wp_create_nonce('mbt-ajax-nonce'); |
| 273 |
//if(!empty($_GET['mbt_setup_default_affiliates'])) { return mbt_render_setup_default_affiliates_page(); } |
| 274 |
?> |
| 275 |
<div class="wrap mbt_settings"> |
| 276 |
<h2><?php esc_attr_e('MyBookTable Settings', 'mybooktable'); ?></h2> |
| 277 |
<?php if(!empty($settings_updated)) { ?> |
| 278 |
<div id="setting-error-settings_updated" class="updated settings-error"><p><strong><?php esc_attr_e('Settings saved', 'mybooktable'); ?>.</strong></p></div> |
| 279 |
<?php } ?> |
| 280 |
|
| 281 |
<form id="mbt_settings_form" method="post" action="<?php echo(esc_url(admin_url('admin.php?page=mbt_settings'))); ?>"> |
| 282 |
|
| 283 |
<input type="hidden" id="data-settings-nonce" name="data-settings-nonce" value="<?php echo(esc_attr($mbt_settings_nonce)); ?>"> |
| 284 |
<!-- <input type="hidden" name="mbt_current_tab" id="mbt_current_tab" value="<?php //echo(wp_kses_post(isset($_REQUEST['mbt_current_tab'])?$_REQUEST['mbt_current_tab']:1)); ?>"> --> |
| 285 |
|
| 286 |
<div id="mbt-settings-tabs"> |
| 287 |
<ul> |
| 288 |
<li><a href="#mbt-tab-1"><?php esc_attr_e('Setup', 'mybooktable'); ?></a></li> |
| 289 |
<li><a href="#mbt-tab-2"><?php esc_attr_e('Style', 'mybooktable'); ?></a></li> |
| 290 |
<li><a href="#mbt-tab-3"><?php esc_attr_e('Promote', 'mybooktable'); ?></a></li> |
| 291 |
<li><a href="#mbt-tab-4"><?php esc_attr_e('Earn', 'mybooktable'); ?></a></li> |
| 292 |
<li><a href="#mbt-tab-5"><?php esc_attr_e('Integrate', 'mybooktable'); ?></a></li> |
| 293 |
<li><a href="<?php echo(esc_url(admin_url('admin.php?page=mbt_help'))); ?>" id="mbt-help-link" ><?php esc_attr_e('Troubleshoot', 'mybooktable'); ?></a></li> |
| 294 |
<?php do_action('additional_mbt_tabs');?> |
| 295 |
</ul> |
| 296 |
<div class="mbt-tab" id="mbt-tab-1"> |
| 297 |
<table class="form-table"> |
| 298 |
<tbody> |
| 299 |
<tr> |
| 300 |
<th><?php esc_attr_e('MyBookTable License Key', 'mybooktable'); ?></th> |
| 301 |
<td> |
| 302 |
<div class="mbt_feedback_above mbt_feedback"><?php echo(wp_kses_post(mbt_api_key_feedback())); ?></div> |
| 303 |
<div style="clear:both"></div> |
| 304 |
<input type="text" name="mbt_api_key" id="mbt_api_key" value="<?php echo(esc_attr(mbt_hide_api_key(mbt_get_setting('api_key')))); ?>" size="60" class="regular-text" /> |
| 305 |
<div class="mbt_feedback_refresh" data-refresh-action="mbt_api_key_refresh" data-refresh-nonce="<?php echo(esc_attr($mbt_nonce)); ?>" data-element="mbt_api_key"></div> |
| 306 |
<p class="description"><?php |
| 307 |
/* translators: %s: link to gumroad where plugin was purchased */ |
| 308 |
echo sprintf(esc_html__('If you have purchased an License Key for MyBookTable, enter it here to activate your enhanced features. You can find it in your %1$s. If you would like to purchase an License key visit %2$s.','mybooktable'),'<a href="https://gumroad.com/library/" target="_blank">Gumroad Library here</a>','<a href="https://www.stormhillmedia.com/all-products/mybooktable/upgrades/">MyBookTable Upgrades</a>');?> |
| 309 |
</p> |
| 310 |
</td> |
| 311 |
</tr> |
| 312 |
<tr> |
| 313 |
<th><?php esc_attr_e('Book Table Page', 'mybooktable'); ?></th> |
| 314 |
<td> |
| 315 |
<select name="mbt_booktable_page" id="mbt_booktable_page"> |
| 316 |
<option value="0" <?php selected(mbt_get_setting('booktable_page'), 0); ?> ><?php esc_attr_e('-- Choose One --', 'mybooktable');?></option> |
| 317 |
<?php foreach(get_pages() as $page) { ?> |
| 318 |
<option value="<?php echo(esc_attr($page->ID)); ?>" <?php selected(mbt_get_setting('booktable_page'), $page->ID); ?> ><?php echo(esc_attr($page->post_title)); ?></option> |
| 319 |
<?php } ?> |
| 320 |
</select> |
| 321 |
<?php if(mbt_get_setting('booktable_page') == 0 or !get_page(mbt_get_setting('booktable_page'))) { |
| 322 |
// nonce the url |
| 323 |
$add_bt_page_url = wp_nonce_url(admin_url('admin.php?page=mbt_settings&mbt_add_booktable_page=1'),'add_page_nonce','nonce_add_page'); |
| 324 |
?> |
| 325 |
<a href="<?php echo(esc_url($add_bt_page_url)); ?>" class="button button-primary"><?php esc_attr_e('Click here to create a Book Table page', 'mybooktable'); ?></a> |
| 326 |
<?php } else { |
| 327 |
// nonce the url |
| 328 |
$remove_bt_page_url = wp_nonce_url(admin_url('admin.php?page=mbt_settings&mbt_remove_booktable_page=1'),'remove_page_nonce','nonce_remove_page'); ?> |
| 329 |
<a href="<?php echo(esc_url($remove_bt_page_url)); ?>" class="button button-primary"><?php esc_attr_e('Remove Book Table page', 'mybooktable'); ?></a> |
| 330 |
<?php } ?> |
| 331 |
<p class="description"><?php esc_attr_e('The Book Table page is the main landing page for your books.', 'mybooktable'); ?></p> |
| 332 |
</td> |
| 333 |
</tr> |
| 334 |
<?php if(!mbt_get_setting('installed_examples')) { ?> |
| 335 |
<tr> |
| 336 |
<th><?php esc_attr_e('Example Books', 'mybooktable'); ?></th> |
| 337 |
<td> |
| 338 |
<a href="<?php echo(esc_url(admin_url('admin.php?page=mbt_settings&mbt_install_examples=1'))); ?>" class="button button-primary"><?php esc_attr_e('Click here to create example books', 'mybooktable'); ?></a> |
| 339 |
<p class="description"><?php esc_attr_e('These examples will help you learn how to set up Genres, Series, Authors, and Books of your own.', 'mybooktable'); ?></p> |
| 340 |
</td> |
| 341 |
</tr> |
| 342 |
<?php } ?> |
| 343 |
<tr> |
| 344 |
<th><?php esc_attr_e('Compatability Mode', 'mybooktable'); ?></th> |
| 345 |
<td> |
| 346 |
<input type="checkbox" name="mbt_compatibility_mode" id="mbt_compatibility_mode" <?php checked(mbt_get_setting('compatibility_mode'), true); ?> > |
| 347 |
<p class="description"><?php esc_attr_e('Checked = More Compatible Out of the Box. Unchecked = More Developer Control.', 'mybooktable'); ?></p> |
| 348 |
</td> |
| 349 |
</tr> |
| 350 |
<tr> |
| 351 |
<th><?php esc_attr_e('MyBookTable Product Name', 'mybooktable'); ?></th> |
| 352 |
<td> |
| 353 |
<input type="text" name="mbt_product_name" id="mbt_product_name" value="<?php echo(esc_attr(mbt_get_setting('product_name'))); ?>" size="60" class="regular-text" /> |
| 354 |
<p class="description"><?php esc_attr_e('You can use this to change the "books" slug used in the book page urls if you are selling something other than books, such as "DVDs", "Movies", or simply "Products".', 'mybooktable'); ?></p> |
| 355 |
</td> |
| 356 |
</tr> |
| 357 |
</tbody> |
| 358 |
</table> |
| 359 |
<?php do_action("mbt_setup_settings_render"); ?> |
| 360 |
<input type="submit" name="save_settings" class="button button-primary" value="<?php echo sprintf(esc_html__('Save Changes', 'mybooktable')); ?>"> |
| 361 |
</div> |
| 362 |
<div class="mbt-tab" id="mbt-tab-2"> |
| 363 |
<div class="mbt-section"> |
| 364 |
<div class="mbt-section-header">Buy Button Styles</div> |
| 365 |
<div class="mbt-section-content"> |
| 366 |
<table class="form-table"> |
| 367 |
<tbody> |
| 368 |
<tr> |
| 369 |
<th><?php esc_attr_e('Style Pack', 'mybooktable'); ?></th> |
| 370 |
<td colspan="3"> |
| 371 |
<?php $pack_upload_output = mbt_do_style_pack_upload(); ?> |
| 372 |
<?php $current_style = mbt_get_setting('style_pack'); ?> |
| 373 |
<div id="mbt_style_pack_preview" class="mbt_feedback"><img src="<?php echo(esc_url(mbt_style_url('bnn_button.png', $current_style))); ?>"></div> |
| 374 |
<select name="mbt_style_pack" id="mbt_style_pack" class="mbt_feedback_refresh" data-refresh-action="mbt_style_pack_preview" data-refresh-nonce="<?php echo(esc_attr($mbt_nonce)); ?>" data-element="mbt_style_pack"> |
| 375 |
<?php foreach(mbt_get_style_packs() as $style) { ?> |
| 376 |
<?php $meta = mbt_get_style_pack_meta($style); ?> |
| 377 |
<option value="<?php echo(esc_attr($style)); ?>" <?php echo($current_style == $style ? ' selected="selected"' : ''); ?> ><?php echo(esc_attr($meta['name'])); ?></option> |
| 378 |
<?php } ?> |
| 379 |
</select> |
| 380 |
<input type="hidden" id="mbt_style_pack_id" name="mbt_style_pack_id" onchange="jQuery('#mbt_current_tab').val(2); jQuery('#mbt_settings_form').submit();"> |
| 381 |
<p class="description"><?php esc_attr_e('Choose the style pack you would like for your buy buttons.', 'mybooktable'); ?></p> |
| 382 |
</td> |
| 383 |
</tr> |
| 384 |
<tr> |
| 385 |
<th><?php esc_attr_e('Buy Button Sizes', 'mybooktable'); ?></th> |
| 386 |
<?php $button_sizes = array('small' =>__('Small', 'mybooktable'), 'medium' => __('Medium', 'mybooktable'), 'large' => __('Large', 'mybooktable')); ?> |
| 387 |
<td> |
| 388 |
<h4><label for="mbt_book_button_size"><?php esc_attr_e('Book Pages', 'mybooktable'); ?></label></h4> |
| 389 |
<?php $book_button_size = mbt_get_setting('book_button_size'); ?> |
| 390 |
<?php if(empty($book_button_size)) { $book_button_size = 'medium'; } ?> |
| 391 |
<div id="mbt_book_button_size_preview" class="mbt_feedback"><?php mbt_button_size_feedback($book_button_size); ?></div> |
| 392 |
<?php foreach($button_sizes as $size => $size_name) { ?> |
| 393 |
<input type="radio" name="mbt_book_button_size" id="mbt_book_button_size_<?php echo(esc_attr($size)); ?>" value="<?php echo(esc_attr($size)); ?>" <?php checked($book_button_size, $size); ?> |
| 394 |
class="mbt_feedback_refresh" data-refresh-action="mbt_button_size_preview" data-refresh-nonce="<?php echo(esc_attr($mbt_nonce)); ?>" data-element="mbt_book_button_size_<?php echo(esc_attr($size)); ?>"><?php echo(esc_attr($size_name)); ?><br> |
| 395 |
<?php } ?> |
| 396 |
<p class="description"><?php esc_attr_e('Select the size of the buy buttons on book pages.', 'mybooktable'); ?></p> |
| 397 |
</td> |
| 398 |
<td> |
| 399 |
<h4><label for="mbt_book_button_size"><?php esc_attr_e('Book Listings', 'mybooktable'); ?></label></h4> |
| 400 |
<?php $listing_button_size = mbt_get_setting('listing_button_size'); ?> |
| 401 |
<?php if(empty($listing_button_size)) { $listing_button_size = 'medium'; } ?> |
| 402 |
<div id="mbt_listing_button_size_preview" class="mbt_feedback"><?php mbt_button_size_feedback($listing_button_size); ?></div> |
| 403 |
<?php foreach($button_sizes as $size => $size_name) { ?> |
| 404 |
<input type="radio" name="mbt_listing_button_size" id="mbt_listing_button_size_<?php echo(esc_attr($size)); ?>" value="<?php echo(esc_attr($size)); ?>" <?php checked($listing_button_size, $size); ?> |
| 405 |
class="mbt_feedback_refresh" data-refresh-action="mbt_button_size_preview" data-refresh-nonce="<?php echo(esc_attr($mbt_nonce)); ?>" data-element="mbt_listing_button_size_<?php echo(esc_attr($size)); ?>"><?php echo(esc_attr($size_name)); ?><br> |
| 406 |
<?php } ?> |
| 407 |
<p class="description"><?php esc_attr_e('Select the size of the buy buttons on book listings.', 'mybooktable'); ?></p> |
| 408 |
</td> |
| 409 |
<td> |
| 410 |
<h4><label for="mbt_book_button_size"><?php esc_attr_e('Widgets', 'mybooktable'); ?></label></h4> |
| 411 |
<?php $widget_button_size = mbt_get_setting('widget_button_size'); ?> |
| 412 |
<?php if(empty($widget_button_size)) { $widget_button_size = 'medium'; } ?> |
| 413 |
<div id="mbt_widget_button_size_preview" class="mbt_feedback"><?php mbt_button_size_feedback($widget_button_size); ?></div> |
| 414 |
<?php foreach($button_sizes as $size => $size_name) { ?> |
| 415 |
<input type="radio" name="mbt_widget_button_size" id="mbt_widget_button_size_<?php echo(esc_attr($size)); ?>" value="<?php echo(esc_attr($size)); ?>" <?php checked($widget_button_size, $size); ?> |
| 416 |
class="mbt_feedback_refresh" data-refresh-action="mbt_button_size_preview" data-refresh-nonce="<?php echo(esc_attr($mbt_nonce)); ?>" data-element="mbt_widget_button_size_<?php echo(esc_attr($size)); ?>"><?php echo(esc_attr($size_name)); ?><br> |
| 417 |
<?php } ?> |
| 418 |
<p class="description"><?php esc_attr_e('Select the size of the buy buttons on widgets.', 'mybooktable'); ?></p> |
| 419 |
</td> |
| 420 |
</tr> |
| 421 |
<tr> |
| 422 |
<th><?php esc_attr_e('Buy Button Shadow Box', 'mybooktable'); ?></th> |
| 423 |
<td colspan="3"> |
| 424 |
<label class="mbt_buybutton_shadowbox"><input type="radio" name="mbt_buybutton_shadowbox" value="none" <?php checked(mbt_get_setting('buybutton_shadowbox'), 'none'); ?> ><?php esc_attr_e('Nowhere', 'mybooktable'); ?></label> |
| 425 |
<label class="mbt_buybutton_shadowbox"><input type="radio" name="mbt_buybutton_shadowbox" value="listings" <?php checked(mbt_get_setting('buybutton_shadowbox'), 'listings'); ?> ><?php esc_attr_e('Book Listings Only', 'mybooktable'); ?></label> |
| 426 |
<label class="mbt_buybutton_shadowbox"><input type="radio" name="mbt_buybutton_shadowbox" value="all" <?php checked(mbt_get_setting('buybutton_shadowbox'), 'all'); ?> ><?php esc_attr_e('Everywhere', 'mybooktable'); ?></label> |
| 427 |
<p class="description"><?php esc_attr_e('Replace store buy buttons with a single "Buy Now" button that loads a shadow box with all the buttons within it.', 'mybooktable'); ?></p> |
| 428 |
</td> |
| 429 |
</tr> |
| 430 |
<tr> |
| 431 |
<th><?php esc_attr_e('Upload New Style Pack', 'mybooktable'); ?></th> |
| 432 |
<td colspan="3"> |
| 433 |
<?php |
| 434 |
if(isset($pack_upload_output) && !empty($pack_upload_output)){ |
| 435 |
echo(wp_kses_post($pack_upload_output)); |
| 436 |
} |
| 437 |
?> |
| 438 |
<input id="mbt_upload_style_pack_button" class="button mbt_upload_button" data-upload-target="mbt_style_pack_id" data-upload-property="id" data-upload-title="<?php esc_attr_e('Style Pack', 'mybooktable'); ?>" type="button" value="<?php esc_attr_e('Upload', 'mybooktable'); ?>"> |
| 439 |
<p class="description"><?php |
| 440 |
/* translators: %s: link to tutorial */ |
| 441 |
echo sprintf(esc_html__('If you would like to make your own style pack you can learn how from our %s.', 'mybooktable'), |
| 442 |
'<a href="https://gitlab.com/authormedia/mybooktable/wikis/Style-Pack-System" target="_blank">developer documentation</a>'); ?> |
| 443 |
</p> |
| 444 |
</td> |
| 445 |
</tr> |
| 446 |
</tbody> |
| 447 |
</table> |
| 448 |
<?php do_action("mbt_buybutton_style_settings_render"); ?> |
| 449 |
</div> |
| 450 |
</div> |
| 451 |
<div class="mbt-section"> |
| 452 |
<div class="mbt-section-header">General Styles</div> |
| 453 |
<div class="mbt-section-content"> |
| 454 |
<table class="form-table"> |
| 455 |
<tbody> |
| 456 |
<tr> |
| 457 |
<th><?php esc_attr_e('Book Image Size', 'mybooktable'); ?></th> |
| 458 |
<td> |
| 459 |
<?php $image_sizes = array('small' =>__('Small', 'mybooktable'), 'medium' => __('Medium', 'mybooktable'), 'large' => __('Large', 'mybooktable')); ?> |
| 460 |
<?php $image_size = mbt_get_setting('image_size'); ?> |
| 461 |
<?php if(empty($image_size)) { $image_size = 'medium'; } ?> |
| 462 |
<?php foreach($image_sizes as $size => $size_name) { ?> |
| 463 |
<input type="radio" name="mbt_image_size" value="<?php echo(esc_attr($size)); ?>" <?php checked($image_size, $size); ?> ><?php echo(esc_attr($size_name)); ?><br> |
| 464 |
<?php } ?> |
| 465 |
<p class="description"><?php esc_attr_e('Book Images in MyBookTable respond to mobile devices regardless of which size you select.', 'mybooktable'); ?></p> |
| 466 |
</td> |
| 467 |
</tr> |
| 468 |
<tr> |
| 469 |
<th><?php esc_attr_e('Breadcrumbs', 'mybooktable'); ?></th> |
| 470 |
<td> |
| 471 |
<input type="checkbox" name="mbt_enable_breadcrumbs" id="mbt_enable_breadcrumbs" <?php checked(mbt_get_setting('enable_breadcrumbs'), true); ?> > |
| 472 |
<label for="mbt_enable_breadcrumbs"><?php esc_attr_e('Enable', 'mybooktable'); ?></label> |
| 473 |
<p class="description"><?php esc_attr_e('Breadcrumbs make your website easier to navigate for both humans and search engines. Uncheck this box if MyBookTable\'s breadcrumb system is conflicting with your theme.', 'mybooktable'); ?></p> |
| 474 |
</td> |
| 475 |
</tr> |
| 476 |
</tbody> |
| 477 |
</table> |
| 478 |
<?php do_action("mbt_general_style_settings_render"); ?> |
| 479 |
</div> |
| 480 |
</div> |
| 481 |
<div class="mbt-section"> |
| 482 |
<div class="mbt-section-header">Book Listing Styles</div> |
| 483 |
<div class="mbt-section-content"> |
| 484 |
<table class="form-table"> |
| 485 |
<tbody> |
| 486 |
<tr> |
| 487 |
<th><?php esc_attr_e('Number of Books per Page', 'mybooktable'); ?></th> |
| 488 |
<td> |
| 489 |
<input name="mbt_posts_per_page" type="text" id="mbt_posts_per_page" value="<?php echo(mbt_get_setting('posts_per_page') ? esc_attr(mbt_get_setting('posts_per_page')) : esc_attr(get_option('posts_per_page'))); ?>" class="regular-text"> |
| 490 |
<p class="description"><?php esc_attr_e('Choose the number of books to show per page on the book listings.', 'mybooktable'); ?></p> |
| 491 |
</td> |
| 492 |
</tr> |
| 493 |
</tbody> |
| 494 |
</table> |
| 495 |
<?php do_action("mbt_listings_style_settings_render"); ?> |
| 496 |
</div> |
| 497 |
</div> |
| 498 |
<input type="submit" name="save_settings" class="button button-primary" value="<?php esc_attr_e('Save Changes', 'mybooktable'); ?>"> |
| 499 |
</div> |
| 500 |
<div class="mbt-tab" id="mbt-tab-3"> |
| 501 |
<table class="form-table"> |
| 502 |
<tbody> |
| 503 |
<tr> |
| 504 |
<th><?php esc_attr_e('Search Engine Optimization', 'mybooktable'); ?></th> |
| 505 |
<td> |
| 506 |
<input type="checkbox" name="mbt_enable_seo" id="mbt_enable_seo" <?php echo(mbt_get_setting('enable_seo') ? ' checked="checked"' : ''); ?> > |
| 507 |
<label for="mbt_enable_seo"><?php esc_attr_e('Use MyBookTable\'s built-in SEO features', 'mybooktable'); ?></label> |
| 508 |
<p class="description"><?php esc_attr_e('Let MyBookTable\'s built in search engine optimization do the work for you.', 'mybooktable'); ?></p> |
| 509 |
</td> |
| 510 |
</tr> |
| 511 |
<tr> |
| 512 |
<th><?php esc_attr_e('Book Reviews', 'mybooktable'); ?></th> |
| 513 |
<td> |
| 514 |
<?php |
| 515 |
$reviews_types = mbt_get_reviews_types(); |
| 516 |
$current_reviews = mbt_get_setting('reviews_type'); |
| 517 |
if(empty($current_reviews) or empty($reviews_types[$current_reviews])) { $current_reviews = 'none'; } |
| 518 |
echo('<input type="radio" name="mbt_reviews_type" id="mbt_reviews_type_none" value="none" '.checked($current_reviews, 'none', false).'><label for="mbt_reviews_type_none">None</label><br>'); |
| 519 |
foreach($reviews_types as $slug => $reviews_data) { |
| 520 |
if(!empty($reviews_data['disabled'])) { |
| 521 |
echo('<input type="radio" name="mbt_reviews_type" id="mbt_reviews_type_'.esc_attr($slug).'" value="'.esc_attr($slug).'" '.checked($current_reviews, $slug, false).' disabled="disabled">'); |
| 522 |
echo(wp_kses_post('<label for="mbt_reviews_type_'.$slug.'" class="mbt_reviews_type_disabled">'.$reviews_data['name'].' ('.$reviews_data['disabled'].')</label><br>')); |
| 523 |
} else { |
| 524 |
echo(wp_kses_post('<input type="radio" name="mbt_reviews_type" id="mbt_reviews_type_'.$slug.'" value="'.$slug.'" '.checked($current_reviews, $slug, false).'>')); |
| 525 |
echo(wp_kses_post('<label for="mbt_reviews_type_'.$slug.'">'.$reviews_data['name'].'</label><br>')); |
| 526 |
} |
| 527 |
} |
| 528 |
?> |
| 529 |
<p class="description"><?php esc_attr_e('Select the reviews provider that will be displayed under each book with a valid ISBN.', 'mybooktable'); ?></p> |
| 530 |
<div class="mbt-check-reviews"> |
| 531 |
<div class="mbt-check-reviews-checking">Checking…<div class="mbt-check-reviews-spinner"></div></div> |
| 532 |
<div class="mbt-check-reviews-results"></div> |
| 533 |
<div class="mbt-check-reviews-begin"> |
| 534 |
<div class="mbt-check-reviews-button button" data-nonce="<?php echo(esc_attr($mbt_nonce)); ?>"><?php esc_attr_e('Check Reviews', 'mybooktable'); ?></div> |
| 535 |
<span class="description"> - <?php esc_attr_e('Use this tool to check if your books will be able to display reviews.', 'mybooktable'); ?></span> |
| 536 |
</div> |
| 537 |
</div> |
| 538 |
</td> |
| 539 |
</tr> |
| 540 |
<tr> |
| 541 |
<th><?php esc_attr_e('Social Media', 'mybooktable'); ?></th> |
| 542 |
<td> |
| 543 |
<input type="checkbox" name="mbt_enable_socialmedia_single_book" id="mbt_enable_socialmedia_single_book" <?php checked(mbt_get_setting('enable_socialmedia_single_book'), true); ?> > |
| 544 |
<label for="mbt_enable_socialmedia_single_book"><?php esc_attr_e('Show on Book Pages', 'mybooktable'); ?></label><br> |
| 545 |
<input type="checkbox" name="mbt_enable_socialmedia_book_excerpt" id="mbt_enable_socialmedia_book_excerpt" <?php checked(mbt_get_setting('enable_socialmedia_book_excerpt'), true); ?> > |
| 546 |
<label for="mbt_enable_socialmedia_book_excerpt"><?php esc_attr_e('Show on Book Listings', 'mybooktable'); ?></label> |
| 547 |
<p class="description"><?php esc_attr_e('Check to enable MyBookTable\'s social media buttons.', 'mybooktable'); ?></p> |
| 548 |
</td> |
| 549 |
</tr> |
| 550 |
<tr> |
| 551 |
<th><?php esc_attr_e('"Find a Local Bookstore" Form', 'mybooktable'); ?></th> |
| 552 |
<td> |
| 553 |
<input type="checkbox" name="mbt_show_find_bookstore" id="mbt_show_find_bookstore" <?php checked(mbt_get_setting('show_find_bookstore'), true); ?> > |
| 554 |
<label for="mbt_show_find_bookstore"><?php esc_attr_e('Show on Book Pages', 'mybooktable'); ?></label><br> |
| 555 |
<input type="checkbox" name="mbt_show_find_bookstore_buybuttons_shadowbox" id="mbt_show_find_bookstore_buybuttons_shadowbox" <?php checked(mbt_get_setting('show_find_bookstore_buybuttons_shadowbox'), true); ?> > |
| 556 |
<label for="mbt_show_find_bookstore_buybuttons_shadowbox"><?php esc_attr_e('Show in Buy Buttons Shadow Box', 'mybooktable'); ?></label> |
| 557 |
<p class="description"> |
| 558 |
<?php esc_attr_e('If checked, show a form that helps your readers find places to buy your book will display under each book.', 'mybooktable'); ?> |
| 559 |
<?php sprintf('<a href="%s">(', admin_url('admin.php?page=mbt_settings&mbt_current_tab=5')).__('You must enter your Google Maps API Key for this feature to work', 'mybooktable').')</a>'; ?> |
| 560 |
</p> |
| 561 |
</td> |
| 562 |
</tr> |
| 563 |
<tr> |
| 564 |
<th><?php esc_attr_e('Cross Promote Books in a Series', 'mybooktable'); ?></th> |
| 565 |
<td> |
| 566 |
<input type="checkbox" name="mbt_show_series" id="mbt_show_series" <?php checked(mbt_get_setting('show_series'), true); ?> > |
| 567 |
<label for="mbt_show_series"><?php esc_attr_e('Show books', 'mybooktable'); ?></label> |
| 568 |
<p class="description"><?php esc_attr_e('If checked, the other books in the same series will display under the book on that book\'s page.', 'mybooktable'); ?></p> |
| 569 |
</td> |
| 570 |
</tr> |
| 571 |
<tr> |
| 572 |
<th><?php esc_attr_e('"About the Author" Section', 'mybooktable'); ?></th> |
| 573 |
<td> |
| 574 |
<input type="checkbox" name="mbt_show_about_author" id="mbt_show_about_author" <?php checked(mbt_get_setting('show_about_author'), true); ?> > |
| 575 |
<label for="mbt_show_about_author"><?php esc_attr_e('Show on Book Pages', 'mybooktable'); ?></label><br> |
| 576 |
<p class="description"><?php esc_attr_e('If checked, show a section on the book page that displays information about the book author.', 'mybooktable'); ?></p> |
| 577 |
</td> |
| 578 |
</tr> |
| 579 |
</tbody> |
| 580 |
</table> |
| 581 |
<?php do_action("mbt_promote_settings_render"); ?> |
| 582 |
<input type="submit" name="save_settings" class="button button-primary" value="<?php esc_attr_e('Save Changes', 'mybooktable'); ?>"> |
| 583 |
</div> |
| 584 |
<div class="mbt-tab" id="mbt-tab-4"> |
| 585 |
<?php do_action("mbt_affiliate_settings_render", $mbt_nonce); ?> |
| 586 |
<table class="form-table"> |
| 587 |
<tbody> |
| 588 |
<tr> |
| 589 |
<th><?php esc_attr_e('Disclosure of Material Connection Disclaimer', 'mybooktable'); ?></th> |
| 590 |
<td> |
| 591 |
<textarea rows="5" cols="60" name="mbt_domc_notice_text" id="mbt_domc_notice_text"><?php echo(wp_kses_post(mbt_get_setting('domc_notice_text'))); ?></textarea> |
| 592 |
<p class="description"> |
| 593 |
<input type="checkbox" name="mbt_hide_domc_notice" id="mbt_hide_domc_notice" <?php checked(mbt_get_setting('hide_domc_notice'), true); ?> > |
| 594 |
<?php esc_attr_e('Hide Disclosure of Material Connection Disclaimer?', 'mybooktable'); ?> |
| 595 |
</p> |
| 596 |
</td> |
| 597 |
</tr> |
| 598 |
</tbody> |
| 599 |
</table> |
| 600 |
<?php |
| 601 |
if(mbt_get_upgrade() === false) { |
| 602 |
echo('<div class="mbt-default-affiliates">'); |
| 603 |
if(mbt_get_setting('enable_default_affiliates')) { |
| 604 |
//echo(esc_attr_e('Amazon and Barnes & Noble Buy Buttons enabled!', 'mybooktable').sprintf('<a href="%s" target="_blank">', esc_url(admin_url('admin.php?page=mbt_settings&mbt_setup_default_affiliates=1')).esc_attr_e('Disable').'</a>')); |
| 605 |
} else { |
| 606 |
//echo(esc_attr_e('Amazon and Barnes & Noble Buy Buttons disabled!', 'mybooktable')); |
| 607 |
//echo '<a href="'.esc_url(admin_url('admin.php?page=mbt_settings&mbt_setup_default_affiliates=1')).'" target="_blank">'.__('Enable', 'mybooktable').'</a>'; |
| 608 |
} |
| 609 |
//echo('<a href="'.esc_url(admin_url('admin.php?page=mbt_settings&mbt_setup_default_affiliates=1')).'" class="mbt-default-affiliates-small" target="_blank">'.__('What does this mean?', 'mybooktable').'</a>'); |
| 610 |
//echo('</div>'); |
| 611 |
} |
| 612 |
?> |
| 613 |
<input type="submit" name="save_settings" class="button button-primary" value="<?php esc_attr_e('Save Changes', 'mybooktable'); ?>"> |
| 614 |
</div> |
| 615 |
<div class="mbt-tab" id="mbt-tab-5"> |
| 616 |
<?php do_action("mbt_integrate_settings_render"); ?> |
| 617 |
<table class="form-table"> |
| 618 |
<tbody> |
| 619 |
<tr> |
| 620 |
<th><label for="mbt_google_api_key"><?php esc_attr_e('Google Maps API', 'mybooktable'); ?></label></th> |
| 621 |
<td> |
| 622 |
<div class="mbt_feedback_above mbt_feedback"></div> |
| 623 |
<label for="mbt_google_api_key" class="mbt-integrate-label">API Key:</label> |
| 624 |
<input type="text" id="mbt_google_api_key" name="mbt_google_api_key" value="<?php echo(esc_attr(mbt_get_setting('google_api_key'))); ?>" class="regular-text"> |
| 625 |
<div class="mbt_feedback_refresh mbt_feedback_refresh_initial" data-refresh-action="mbt_google_api_key_refresh" data-refresh-nonce="<?php echo(esc_attr($mbt_nonce)); ?>" data-element="mbt_google_api_key"></div> |
| 626 |
<p class="description"><?php |
| 627 |
/* translators: %s: link to tutorial */ |
| 628 |
echo sprintf(esc_html__('Insert your Google Maps API Key to %s on your book pages.', 'mybooktable'), |
| 629 |
'<a href="'.esc_url(admin_url('admin.php?page=mbt_settings&mbt_current_tab=3')).'" target="_blank">enable the Find Local Bookstore Form</a>'); ?> |
| 630 |
<p><a href="https://developers.google.com/maps/documentation/javascript/get-api-key#key" target="_blank"> <?php esc_attr_e('Learn how to get a Google Maps API Key', 'mybooktable'); ?></a></p> |
| 631 |
</p> |
| 632 |
|
| 633 |
</td> |
| 634 |
</tr> |
| 635 |
</tbody> |
| 636 |
</table> |
| 637 |
<input type="submit" name="save_settings" class="button button-primary" value="<?php esc_attr_e('Save Changes', 'mybooktable'); ?>"> |
| 638 |
</div> |
| 639 |
</div> |
| 640 |
|
| 641 |
</form> |
| 642 |
|
| 643 |
</div> |
| 644 |
<?php |
| 645 |
} |
| 646 |
|
| 647 |
function mbt_mailchimp_api_key_settings_render() { |
| 648 |
?> |
| 649 |
<table class="form-table"> |
| 650 |
<tbody> |
| 651 |
<tr> |
| 652 |
<th style="color: #666"><?php esc_attr_e('MailChimp', 'mybooktable'); ?></th> |
| 653 |
<td> |
| 654 |
<input type="text" disabled="true" value="" class="regular-text"> |
| 655 |
<p class="description"><?php echo(wp_kses_post(mbt_get_upgrade_message())); ?></p> |
| 656 |
</td> |
| 657 |
</tr> |
| 658 |
</tbody> |
| 659 |
</table> |
| 660 |
<?php |
| 661 |
} |
| 662 |
add_action('mbt_integrate_settings_render', 'mbt_mailchimp_api_key_settings_render'); |
| 663 |
|
| 664 |
function mbt_amazon_web_services_general_settings_render() { |
| 665 |
?> |
| 666 |
<table class="form-table"> |
| 667 |
<tbody> |
| 668 |
<tr> |
| 669 |
<th style="color: #666"><?php esc_attr_e('Amazon Web Services', 'mybooktable'); ?></th> |
| 670 |
<td> |
| 671 |
<input type="text" disabled="true" value="" class="regular-text"> |
| 672 |
<p class="description"><?php echo(wp_kses_post(mbt_get_upgrade_message())); ?></p> |
| 673 |
</td> |
| 674 |
</tr> |
| 675 |
</tbody> |
| 676 |
</table> |
| 677 |
<?php |
| 678 |
} |
| 679 |
//add_action('mbt_integrate_settings_render', 'mbt_amazon_web_services_general_settings_render'); |
| 680 |
|
| 681 |
function mbt_genius_link_integration_general_settings_render() { |
| 682 |
?> |
| 683 |
<table class="form-table"> |
| 684 |
<tbody> |
| 685 |
<tr> |
| 686 |
<th style="color: #666"><?php esc_attr_e('Genius Link', 'mybooktable'); ?></th> |
| 687 |
<td> |
| 688 |
<input type="text" disabled="true" value="" class="regular-text"> |
| 689 |
<p class="description"><?php echo(wp_kses_post(mbt_get_upgrade_message())); ?></p> |
| 690 |
</td> |
| 691 |
</tr> |
| 692 |
</tbody> |
| 693 |
</table> |
| 694 |
<?php |
| 695 |
} |
| 696 |
add_action('mbt_integrate_settings_render', 'mbt_genius_link_integration_general_settings_render'); |
| 697 |
|
| 698 |
function mbt_render_setup_default_affiliates_page() { |
| 699 |
?> |
| 700 |
<div class="wrap mbt_settings"> |
| 701 |
<h2><?php esc_attr_e('MyBookTable Settings', 'mybooktable'); ?></h2> |
| 702 |
|
| 703 |
<p style="font-size:16px;"> |
| 704 |
<?php esc_attr_e('MyBookTable comes with over a dozen buy buttons from stores around the web. Several of these buttons, including the ones for Audible and Barnes & Noble, use affiliate links. The revenue from these links is used to help support and improve the MyBookTable plugin. If you would like to use your own affiliate links, we have premium upgrades that come not only with affiliate integration but with premium support as well. You may also disable these buttons if you prefer.', 'mybooktable'); ?> |
| 705 |
</p> |
| 706 |
|
| 707 |
<form id="mbt_settings_form" method="post" action="<?php echo(esc_url(admin_url('admin.php?page=mbt_settings'))); ?>"> |
| 708 |
<input type="hidden" name="mbt_enable_default_affiliates" id="mbt_enable_default_affiliates" value=""> |
| 709 |
<input type="submit" name="save_default_affiliate_settings" class="button button-primary" onclick="jQuery('#mbt_enable_default_affiliates').val('true');" value="<?php esc_attr_e('Enable Affiliate Buttons', 'mybooktable'); ?>"> |
| 710 |
<input type="submit" name="save_default_affiliate_settings" class="button button-primary" onclick="jQuery('#mbt_enable_default_affiliates').val('false');" value="<?php esc_attr_e('Disable Affiliate Buttons', 'mybooktable'); ?>"> |
| 711 |
<a href="https://www.stormhillmedia.com/all-products/mybooktable/upgrades/" class="button button-primary" target="_blank"><?php esc_attr_e('Buy a Premium Upgrade with Affiliate support', 'mybooktable'); ?></a> |
| 712 |
</form> |
| 713 |
<br> |
| 714 |
<a href="<?php echo(esc_url(admin_url('admin.php?page=mbt_settings'))); ?>&mbt_current_tab=4"><?php esc_attr_e('Go to Affiliate Settings', 'mybooktable'); ?></a> |
| 715 |
</div> |
| 716 |
<?php |
| 717 |
} |
| 718 |
|
| 719 |
function mbt_do_style_pack_upload() { |
| 720 |
if( (isset($_REQUEST['page']) && $_REQUEST['page'] === 'mbt_settings') && ((isset($_REQUEST['data-settings-nonce']) && wp_verify_nonce(sanitize_key($_REQUEST['data-settings-nonce']),'mbt-settings-nonce'))) ) { |
| 721 |
if(empty($_REQUEST['mbt_style_pack_id'])) { return ""; } |
| 722 |
$file_post = get_post(intval($_REQUEST['mbt_style_pack_id'])); |
| 723 |
if(empty($file_post)) { return ""; } |
| 724 |
$style_name = $file_post->post_title; |
| 725 |
$file_path = get_post_meta(intval($_REQUEST['mbt_style_pack_id']), '_wp_attached_file', true); |
| 726 |
|
| 727 |
$nonce_url = wp_nonce_url('admin.php?page=mbt_settings', 'mbt-style-pack-upload'); |
| 728 |
$output = mbt_get_wp_filesystem($nonce_url); |
| 729 |
if(!empty($output)) { return '<br>'.$output; } |
| 730 |
|
| 731 |
global $wp_filesystem; |
| 732 |
|
| 733 |
$upload_dir = wp_upload_dir(); |
| 734 |
if(substr($upload_dir['basedir'], 0, strlen(ABSPATH)) !== ABSPATH) { |
| 735 |
return '<br><span class="mbt_admin_message_failure">'.__('Path error while adding style pack!', 'mybooktable').'</span>'; |
| 736 |
} |
| 737 |
$content_prefix = substr($upload_dir['basedir'], strlen(ABSPATH)); |
| 738 |
$from = $upload_dir['basedir'].DIRECTORY_SEPARATOR.$file_path; |
| 739 |
$to = $wp_filesystem->abspath().$content_prefix.DIRECTORY_SEPARATOR.'mbt_styles'.DIRECTORY_SEPARATOR.$style_name; |
| 740 |
$result = unzip_file($from, $to); |
| 741 |
|
| 742 |
if($result === true) { |
| 743 |
return '<br><span class="mbt_admin_message_success">'.__('Successfully added button pack!', 'mybooktable').'</span>'; |
| 744 |
} else { |
| 745 |
return '<br><span class="mbt_admin_message_failure">'.__('Error unzipping style pack!', 'mybooktable').'</span>'; |
| 746 |
} |
| 747 |
} |
| 748 |
} |
| 749 |
|
| 750 |
|
| 751 |
|
| 752 |
/*---------------------------------------------------------*/ |
| 753 |
/* Help Page */ |
| 754 |
/*---------------------------------------------------------*/ |
| 755 |
|
| 756 |
function mbt_render_help_page() { |
| 757 |
?> |
| 758 |
<div class="wrap mbt_help"> |
| 759 |
<h2 class="mbt_help_title"><?php esc_attr_e('MyBookTable Help', 'mybooktable'); ?></h2> |
| 760 |
|
| 761 |
<div class="mbt_help_top_links"> |
| 762 |
<a class="mbt_help_link mbt_apikey" href="https://gumroad.com/library/" target="_blank" > |
| 763 |
<div class="mbt_icon"></div><?php esc_attr_e('Need to find or manage your License Key? Access through Gumroad', 'mybooktable'); ?> |
| 764 |
</a> |
| 765 |
<a class="mbt_help_link mbt_forum" href="https://wordpress.org/support/plugin/mybooktable" target="_blank"> |
| 766 |
<div class="mbt_icon"></div><?php esc_attr_e('Have questions or comments? Check out the Support Forum', 'mybooktable'); ?> |
| 767 |
</a> |
| 768 |
<a class="mbt_help_link mbt_develop" href="https://gitlab.com/authormedia/mybooktable/wikis" target="_blank"> |
| 769 |
<div class="mbt_icon"></div><?php esc_attr_e('Looking for developer documentation? Find it on Gitlab', 'mybooktable'); ?> |
| 770 |
</a> |
| 771 |
<div style="clear:both"></div> |
| 772 |
</div> |
| 773 |
|
| 774 |
<?php if(mbt_get_upgrade() === false) { ?> |
| 775 |
<div class="mbt_get_premium_support"><a href="https://www.stormhillmedia.com/all-products/mybooktable/upgrades/" class="button button-primary"><?php esc_attr_e('Need Premium Support? Purchase an upgrade here', 'mybooktable'); ?></a></div> |
| 776 |
<?php } else { ?> |
| 777 |
<div class="mbt_help_box"> |
| 778 |
<div class="mbt_help_box_title"><?php esc_attr_e('Premium Support Options', 'mybooktable'); ?></div> |
| 779 |
<div class="mbt_help_box_content"> |
| 780 |
<ul class="mbt_premium_support"> |
| 781 |
<li><a href="https://www.stormhillmedia.com/book-table/premium-support/" target="_blank"><div class="mbt_icon mbt_ticket"></div><?php esc_attr_e('Submit a Ticket', 'mybooktable'); ?></a></li> |
| 782 |
<li><a href=" https://www.stormhillmedia.com/book-table/mybooktable-feature-request/" target="_blank"><div class="mbt_icon mbt_feature"></div><?php esc_attr_e('Suggest a Feature', 'mybooktable'); ?></a></li> |
| 783 |
<li><a href="https://www.stormhillmedia.com/book-table/premium-support/" target="_blank"><div class="mbt_icon mbt_bug"></div><?php esc_attr_e('Submit a Bug', 'mybooktable'); ?></a><br></li> |
| 784 |
<div style="clear:both"></div> |
| 785 |
</ul> |
| 786 |
</div> |
| 787 |
</div> |
| 788 |
<?php } ?> |
| 789 |
|
| 790 |
<?php |
| 791 |
$mybooktable_articles = array( |
| 792 |
'goodreads' => array( |
| 793 |
'link' => 'https://www.authormedia.com/how-to-add-goodreads-book-reviews-to-mybooktable/', |
| 794 |
'img' => plugins_url('images/help/goodreads-reviews.jpg', dirname(__FILE__)), |
| 795 |
'title' => 'How to Add GoodReads Book Reviews to MyBookTable' |
| 796 |
), |
| 797 |
); |
| 798 |
?> |
| 799 |
|
| 800 |
<div class="mbt_help_box"> |
| 801 |
<div class="mbt_help_box_title"><?php esc_attr_e('MyBookTable Tutorials', 'mybooktable'); ?></div> |
| 802 |
<div class="mbt_help_box_content"> |
| 803 |
<ul class="mbt_articles"> |
| 804 |
<?php foreach ($mybooktable_articles as $id => $article) { ?> |
| 805 |
<li> |
| 806 |
<a href="<?php echo(esc_url($article['link'])); ?>" target="_blank"> |
| 807 |
<img src="<?php echo(wp_kses_post($article['img'])); ?>"> |
| 808 |
<span><?php echo(esc_attr($article['title'])); ?></span> |
| 809 |
</a> |
| 810 |
</li> |
| 811 |
<?php } ?> |
| 812 |
<div style="clear:both"></div> |
| 813 |
</ul> |
| 814 |
</div> |
| 815 |
</div> |
| 816 |
|
| 817 |
<?php |
| 818 |
$video_tutorial = array( |
| 819 |
/* 'overview' => array( |
| 820 |
'video' => 'https://player.vimeo.com/video/66113243', |
| 821 |
'title' => 'MyBookTable Overview', |
| 822 |
'desc' => 'This video is a general introduction to MyBookTable.' |
| 823 |
),*/ |
| 824 |
'buy_buttons' => array( |
| 825 |
'video' => 'https://player.vimeo.com/video/68790296', |
| 826 |
'title' => 'How to Add Buy Buttons', |
| 827 |
'desc' => 'This video shows you how to add buy buttons to your books.' |
| 828 |
), |
| 829 |
'books_in_series' => array( |
| 830 |
'video' => 'https://player.vimeo.com/video/66110874', |
| 831 |
'title' => 'How to Put Books in a Series', |
| 832 |
'desc' => 'This video shows you how to add books into a series.' |
| 833 |
), |
| 834 |
'amazon_affiliates' => array( |
| 835 |
'video' => 'https://player.vimeo.com/video/69188658', |
| 836 |
'title' => 'How to Setup an Amazon Affiliate Account With MyBookTable', |
| 837 |
'desc' => 'This video walks you through setting up an Amazon Affiliate account and how to take your affiliate code and insert it into your MyBookTable plugin.' |
| 838 |
), |
| 839 |
'book_blurbs' => array( |
| 840 |
'video' => 'https://www.youtube.com/embed/LABESfhThhY', |
| 841 |
'title' => 'Effective Book Blurb Strategies', |
| 842 |
'desc' => 'This video shows you how to write book blurbs for your books.' |
| 843 |
), |
| 844 |
); |
| 845 |
?> |
| 846 |
|
| 847 |
<div class="mbt_help_box mbt_video_tutorials"> |
| 848 |
<div class="mbt_help_box_title"><?php esc_attr_e('Tutorial Videos', 'mybooktable'); ?></div> |
| 849 |
<div class="mbt_video_selector"> |
| 850 |
<?php foreach ($video_tutorial as $id => $tutorial) { ?> |
| 851 |
<a target="_blank" href="<?php echo(wp_kses_post($tutorial['video'])); ?>" data-video-id="mbt_video_<?php echo(esc_attr($id)); ?>"><?php echo(esc_attr($tutorial['title'])); ?></a> |
| 852 |
<?php } ?> |
| 853 |
</div> |
| 854 |
<div class="mbt_video_display"> |
| 855 |
<?php foreach ($video_tutorial as $id => $tutorial) { ?> |
| 856 |
<div class="mbt_video" id="mbt_video_<?php echo(esc_attr($id)); ?>"> |
| 857 |
<iframe src="<?php echo(wp_kses_post($tutorial['video'])); ?>" frameborder="0" allowfullscreen></iframe> |
| 858 |
</div> |
| 859 |
<?php } ?> |
| 860 |
</div> |
| 861 |
<div style="clear:both"></div> |
| 862 |
</div> |
| 863 |
|
| 864 |
<?php |
| 865 |
$wordpress_articles = array( |
| 866 |
'shortcodes' => array( |
| 867 |
'link' => 'https://www.authormedia.com/how-to-harness-the-magic-of-mybooktable-with-shortcodes/', |
| 868 |
'img' => plugins_url('images/help/shortcodes.jpg', dirname(__FILE__)), |
| 869 |
'title' => 'How to Harness the Magic of MyBookTable with Shortcodes' |
| 870 |
), |
| 871 |
'draw_readers' => array( |
| 872 |
'link' => 'https://www.authormedia.com/10-elements-proven-to-draw-readers-to-your-novels-website/', |
| 873 |
'img' => plugins_url('images/help/draw-readers.jpg', dirname(__FILE__)), |
| 874 |
'title' => '10 Ways Proven to Draw Readers to Your Novel\'s Website' |
| 875 |
), |
| 876 |
'upload_file' => array( |
| 877 |
'link' => 'https://www.authormedia.com/how-to-upload-a-file-to-your-wordpress-site/', |
| 878 |
'img' => plugins_url('images/help/upload-file.jpg', dirname(__FILE__)), |
| 879 |
'title' => 'How to Upload a File to Your WordPress Site' |
| 880 |
), |
| 881 |
'create_pdf' => array( |
| 882 |
'link' => 'https://www.authormedia.com/how-to-create-a-pdf/', |
| 883 |
'img' => plugins_url('images/help/create-pdf.jpg', dirname(__FILE__)), |
| 884 |
'title' => 'How to Create a PDF' |
| 885 |
), |
| 886 |
'add_hyperlink' => array( |
| 887 |
'link' => 'https://www.authormedia.com/how-to-add-a-hyperlink-to-wordpress/', |
| 888 |
'img' => plugins_url('images/help/add-link.jpg', dirname(__FILE__)), |
| 889 |
'title' => 'How to Add a Hyperlink to WordPress' |
| 890 |
), |
| 891 |
'hotkeys_cheat_sheet' => array( |
| 892 |
'link' => 'https://www.authormedia.com/the-wordpress-hotkey-cheat-sheet-every-author-needs/', |
| 893 |
'img' => plugins_url('images/help/hotkeys.jpg', dirname(__FILE__)), |
| 894 |
'title' => 'The WordPress Hotkey Cheat Sheet Every Author Needs' |
| 895 |
), |
| 896 |
'write_posts' => array( |
| 897 |
'link' => 'https://www.authormedia.com/how-to-create-or-edit-posts-in-wordpress/', |
| 898 |
'img' => plugins_url('images/help/write-posts.jpg', dirname(__FILE__)), |
| 899 |
'title' => 'How to Create or Edit Posts in WordPress' |
| 900 |
), |
| 901 |
'protect_from_hackers' => array( |
| 902 |
'link' => 'https://www.authormedia.com/how-to-keep-your-wordpress-site-secure-from-hackers/', |
| 903 |
'img' => plugins_url('images/help/hackers.jpg', dirname(__FILE__)), |
| 904 |
'title' => 'How to Keep Your WordPress Site Secure From Hackers' |
| 905 |
), |
| 906 |
'zen_mode' => array( |
| 907 |
'link' => 'https://www.authormedia.com/how-to-find-zen-mode-in-wordpress/', |
| 908 |
'img' => plugins_url('images/help/zen.jpg', dirname(__FILE__)), |
| 909 |
'title' => 'How To Find Zen Mode in WordPress' |
| 910 |
), |
| 911 |
'book_marketing_ideas' => array( |
| 912 |
'link' => 'https://www.authormedia.com/89-book-marketing-ideas-that-will-change-your-life/', |
| 913 |
'img' => plugins_url('images/help/ideas.jpg', dirname(__FILE__)), |
| 914 |
'title' => '89+ Book Marketing Ideas That Will Change Your Life' |
| 915 |
), |
| 916 |
'standard_nonfiction' => array( |
| 917 |
'link' => 'https://www.authormedia.com/standard-pages-for-a-non-fiction-website/', |
| 918 |
'img' => plugins_url('images/help/standard-nonfiction.jpg', dirname(__FILE__)), |
| 919 |
'title' => 'Standard Pages for A Non-Fiction Website' |
| 920 |
), |
| 921 |
'standard_fiction' => array( |
| 922 |
'link' => 'https://www.authormedia.com/standard-pages-for-a-fiction-website/', |
| 923 |
'img' => plugins_url('images/help/standard-fiction.jpg', dirname(__FILE__)), |
| 924 |
'title' => 'Standard Pages for A Fiction Website' |
| 925 |
), |
| 926 |
'what_readers_want' => array( |
| 927 |
'link' => 'https://www.authormedia.com/what-readers-want-from-your-author-website/', |
| 928 |
'img' => plugins_url('images/help/what-readers-want.jpg', dirname(__FILE__)), |
| 929 |
'title' => '6 Things Readers Want from Your Author Website' |
| 930 |
), |
| 931 |
); |
| 932 |
?> |
| 933 |
|
| 934 |
<div class="mbt_help_box"> |
| 935 |
<div class="mbt_help_box_title"><?php esc_attr_e('General WordPress Guides & Tutorials', 'mybooktable'); ?></div> |
| 936 |
<div class="mbt_help_box_content"> |
| 937 |
<ul class="mbt_articles"> |
| 938 |
<?php foreach ($wordpress_articles as $id => $article) { ?> |
| 939 |
<li> |
| 940 |
<a href="<?php echo(esc_url($article['link'])); ?>" target="_blank"> |
| 941 |
<img src="<?php echo(wp_kses_post($article['img'])); ?>"> |
| 942 |
<span><?php echo(esc_attr($article['title'])); ?></span> |
| 943 |
</a> |
| 944 |
</li> |
| 945 |
<?php } ?> |
| 946 |
<div style="clear:both"></div> |
| 947 |
</ul> |
| 948 |
</div> |
| 949 |
</div> |
| 950 |
|
| 951 |
<?php do_action("mbt_render_help_page", 'mybooktable'); ?> |
| 952 |
|
| 953 |
<br> |
| 954 |
</div> |
| 955 |
|
| 956 |
<?php |
| 957 |
} |
| 958 |
|
| 959 |
add_filter('wp101_get_custom_help_topics', 'mbt_add_wp101_help'); |
| 960 |
function mbt_add_wp101_help($videos) { |
| 961 |
//$videos["mbt-overview"] = array("title" => "MyBookTable Overview", "content" => '<iframe width="640" height="360" src="https://player.vimeo.com/video/66113243" frameborder="0" allowfullscreen></iframe>'); |
| 962 |
$videos["mbt-buybuttons"] = array("title" => "MyBookTable Buy Buttons", "content" => '<iframe width="640" height="360" src="https://player.vimeo.com/video/68790296" frameborder="0" allowfullscreen></iframe>'); |
| 963 |
$videos["mbt-booksinseries"] = array("title" => "How to Put Books in a Series", "content" => '<iframe width="640" height="360" src="https://player.vimeo.com/video/66110874" frameborder="0" allowfullscreen></iframe>'); |
| 964 |
$videos["mbt-amazonaffiliates"] = array("title" => "MyBookTable Amazon Affiliate Accounts", "content" => '<iframe width="640" height="360" src="https://player.vimeo.com/video/69188658" frameborder="0" allowfullscreen></iframe>'); |
| 965 |
$videos["mbt-bookblurbs"] = array("title" => "MyBookTable Book Blurbs", "content" => '<iframe width="640" height="360" src="https://www.youtube.com/embed/LABESfhThhY" frameborder="0" allowfullscreen></iframe>'); |
| 966 |
return $videos; |
| 967 |
} |
| 968 |
|
| 969 |
|
| 970 |
|
| 971 |
/*---------------------------------------------------------*/ |
| 972 |
/* Dashboard Page */ |
| 973 |
/*---------------------------------------------------------*/ |
| 974 |
|
| 975 |
function mbt_render_dashboard() { |
| 976 |
|
| 977 |
if(!empty($_REQUEST['subpage']) and $_REQUEST['subpage'] === 'mbt_founders_page' && (isset($_REQUEST['nonce_dashboard']) && wp_verify_nonce(sanitize_key($_REQUEST['nonce_dashboard']),'dashboard_nonce'))) { |
| 978 |
return mbt_render_founders_page(); |
| 979 |
} |
| 980 |
if(!empty($_REQUEST['subpage']) and $_REQUEST['subpage'] === 'mbt_get_upgrade_page' && (isset($_REQUEST['nonce_dashboard']) && wp_verify_nonce(sanitize_key($_REQUEST['nonce_dashboard']),'dashboard_nonce'))) |
| 981 |
{ |
| 982 |
return mbt_render_get_upgrade_page(); |
| 983 |
} |
| 984 |
|
| 985 |
$founderpage_url = |
| 986 |
wp_nonce_url(admin_url('admin.php?page=mbt_dashboard&subpage=mbt_founders_page'),'dashboard_nonce','nonce_dashboard'); |
| 987 |
|
| 988 |
$upgradepage_url = |
| 989 |
wp_nonce_url(admin_url('admin.php?page=mbt_dashboard&subpage=mbt_get_upgrade_page'),'dashboard_nonce','nonce_dashboard'); |
| 990 |
|
| 991 |
$import_url = wp_nonce_url(admin_url('admin.php?page=mbt_import'),'import_nonce','nonce_import'); |
| 992 |
?> |
| 993 |
|
| 994 |
<div class="wrap mbt-dashboard"> |
| 995 |
<h2><?php esc_attr_e('MyBookTable', 'mybooktable'); ?></h2> |
| 996 |
<table class="mbt-dashboard-table"><tbody> |
| 997 |
<tr> |
| 998 |
<td class="dashboard-contents-left"> |
| 999 |
<div class="welcome-video-container"> |
| 1000 |
<a href="<?php echo(esc_url(admin_url('admin.php?page=mbt_help'))); ?>"><?php esc_attr_e('Tutorial Videos', 'mybooktable'); ?></a> |
| 1001 |
</div> |
| 1002 |
|
| 1003 |
<div class="buttons-container"> |
| 1004 |
<a href="<?php echo(esc_url(admin_url('post-new.php?post_type=mbt_book'))); ?>" class="add-new-book"><?php esc_attr_e('Add New Book', 'mybooktable'); ?></a> |
| 1005 |
</div> |
| 1006 |
|
| 1007 |
<div class="welcome-panel"> |
| 1008 |
<div class="welcome-panel-content"> |
| 1009 |
<h3><?php esc_attr_e('Welcome to MyBookTable!', 'mybooktable'); ?></h3> |
| 1010 |
<div class="welcome-panel-column-container"> |
| 1011 |
<div class="welcome-panel-column"> |
| 1012 |
<h4><?php esc_attr_e('First Steps', 'mybooktable'); ?></h4> |
| 1013 |
<ul> |
| 1014 |
<?php if(!mbt_get_setting('installed_examples')) { ?> |
| 1015 |
<li><a href="<?php echo(esc_url(admin_url('edit.php?post_type=mbt_book&mbt_install_examples=1'))); ?>" class="welcome-icon welcome-view-site"><?php esc_attr_e('Look at some example Books', 'mybooktable'); ?></a></li> |
| 1016 |
<?php } ?> |
| 1017 |
<li><a href="<?php echo(esc_url(admin_url('post-new.php?post_type=mbt_book'))); ?>" class="welcome-icon welcome-add-page"><?php esc_attr_e('Create your first book', 'mybooktable'); ?></a></li> |
| 1018 |
<li><a href="<?php echo(esc_url($import_url)); ?>" class="welcome-icon welcome-widgets-menus"><?php esc_attr_e('Import Books', 'mybooktable'); ?></a></li> |
| 1019 |
<li><a href="<?php echo(esc_url(mbt_get_booktable_url())); ?>" class="welcome-icon welcome-view-site"><?php esc_attr_e('View your Book Table', 'mybooktable'); ?></a></li> |
| 1020 |
</ul> |
| 1021 |
</div> |
| 1022 |
<div class="welcome-panel-column"> |
| 1023 |
<h4><?php esc_attr_e('Actions', 'mybooktable'); ?></h4> |
| 1024 |
<ul> |
| 1025 |
<li><div class="welcome-icon welcome-widgets-menus"><?php esc_attr_e('Manage', 'mybooktable'); ?> <a href="<?php echo(esc_url(admin_url('edit.php?post_type=mbt_book'))); ?>"><?php esc_attr_e('Books', 'mybooktable'); ?></a></div></li> |
| 1026 |
<li><div class="welcome-icon welcome-widgets-menus"><?php esc_attr_e('Manage', 'mybooktable'); ?> <a href="<?php echo(esc_url(admin_url('edit-tags.php?taxonomy=mbt_author'))); ?>"><?php esc_attr_e('Authors', 'mybooktable'); ?></a></div></li> |
| 1027 |
<li><div class="welcome-icon welcome-widgets-menus"><?php esc_attr_e('Manage', 'mybooktable'); ?> <a href="<?php echo(esc_url(admin_url('edit-tags.php?taxonomy=mbt_genre'))); ?>"><?php esc_attr_e('Genres', 'mybooktable'); ?></a></div></li> |
| 1028 |
<li><div class="welcome-icon welcome-widgets-menus"><?php esc_attr_e('Manage', 'mybooktable'); ?> <a href="<?php echo(esc_url(admin_url('edit-tags.php?taxonomy=mbt_series'))); ?>"><?php esc_attr_e('Series', 'mybooktable'); ?></a></div></li> |
| 1029 |
<li><div class="welcome-icon welcome-widgets-menus"><?php esc_attr_e('Manage', 'mybooktable'); ?> <a href="<?php echo(esc_url(admin_url('edit-tags.php?taxonomy=mbt_tag'))); ?>"><?php esc_attr_e('Tags', 'mybooktable'); ?></a></div></li> |
| 1030 |
<li><div class="welcome-icon welcome-widgets-menus"><?php esc_attr_e('Manage', 'mybooktable'); ?> <a href="<?php echo(esc_url(admin_url('admin.php?page=mbt_settings'))); ?>"><?php esc_attr_e('Settings', 'mybooktable'); ?></a></div></li> |
| 1031 |
</ul> |
| 1032 |
</div> |
| 1033 |
<div class="welcome-panel-column welcome-panel-last"> |
| 1034 |
<h4><?php esc_attr_e('Resources', 'mybooktable'); ?></h4> |
| 1035 |
<ul> |
| 1036 |
<li><a href="<?php echo(esc_url(admin_url('admin.php?page=mbt_help'))); ?>" class="welcome-icon welcome-learn-more"><?php esc_attr_e('Get help using MyBookTable', 'mybooktable'); ?></a></li> |
| 1037 |
<li><a href="https://gitlab.com/authormedia/mybooktable/wikis" class="welcome-icon welcome-learn-more" target="_blank"><?php esc_attr_e('Developer Documentation', 'mybooktable'); ?></a></li> |
| 1038 |
<li><a href="https://authormedia.us1.list-manage.com/subscribe?u=b7358f48fe541fe61acdf747b&id=6b5a675fcf" class="welcome-icon welcome-write-blog" target="_blank"><?php esc_attr_e('Sign Up for Book Marketing Tips from Author Media', 'mybooktable'); ?></a></li> |
| 1039 |
<li><a href="<?php echo(esc_url($founderpage_url)); ?>" class="welcome-icon welcome-write-blog"><?php esc_attr_e('Plugin Founders', 'mybooktable'); ?></a></li> |
| 1040 |
</ul> |
| 1041 |
</div> |
| 1042 |
</div> |
| 1043 |
</div> |
| 1044 |
</div> |
| 1045 |
|
| 1046 |
<div class="metabox-holder"> |
| 1047 |
<div id="mbt_dashboard_rss" class="postbox"> |
| 1048 |
<div class="handlediv" title=""><br></div> |
| 1049 |
<h3 class="hndle"><?php esc_attr_e('Book Marketing Tips from Author Media', 'mybooktable'); ?></h3> |
| 1050 |
<div class="inside"> |
| 1051 |
<?php wp_widget_rss_output(array( |
| 1052 |
'link' => 'https://www.authormedia.com/', |
| 1053 |
'url' => 'https://www.authormedia.com/feed/', |
| 1054 |
'title' => __('Recent News from Author Media', 'mybooktable'), |
| 1055 |
'items' => 3, |
| 1056 |
'show_summary' => 1, |
| 1057 |
'show_author' => 0, |
| 1058 |
'show_date' => 0, |
| 1059 |
)); ?> |
| 1060 |
</div> |
| 1061 |
</div> |
| 1062 |
<div id="mbt_dashboard_upsell" class="postbox"> |
| 1063 |
<div class="handlediv"><br></div> |
| 1064 |
<h3 class="hndle"><?php esc_attr_e('Current Version', 'mybooktable'); ?></h3> |
| 1065 |
<div class="inside"> |
| 1066 |
<h1 class="mybooktable-version"><?php echo(esc_attr_e('You are currently using', 'mybooktable').' <span class="current-version">'.esc_attr_e('MyBookTable', 'mybooktable').wp_kses_post(MBT_VERSION).'</span>'); ?></h1> |
| 1067 |
<?php |
| 1068 |
$with_the = _x('with the', 'You are currently using MyBookTable (with the) Developer Upgrade.', 'mybooktable'); |
| 1069 |
$dev_upgrade = __('Developer Upgrade', 'mybooktable'); |
| 1070 |
$pro_upgrade = __('Professional Upgrade', 'mybooktable'); |
| 1071 |
?> |
| 1072 |
<?php if(mbt_get_upgrade() == 'mybooktable-dev3' and mbt_get_upgrade_plugin_exists()) { ?> |
| 1073 |
<h1 class="upgrade-version"><?php echo(esc_attr($with_the).' <span class="current-version">'.esc_attr($dev_upgrade).' '.wp_kses_post(MBTDEV3_VERSION).'</span>'); ?></h1> |
| 1074 |
<h2 class="thank-you"><?php esc_attr_e('Thank you for your support!', 'mybooktable'); ?></h2> |
| 1075 |
<?php } else if(mbt_get_upgrade() == 'mybooktable-pro3' and mbt_get_upgrade_plugin_exists()) { ?> |
| 1076 |
<h1 class="upgrade-version"><?php echo(esc_attr($with_the).' <span class="current-version">'.wp_kses_post($pro_upgrade).' '.wp_kses_post(MBTPRO3_VERSION).'</span>'); ?></h1> |
| 1077 |
<h2 class="thank-you"><?php esc_attr_e('Thank you for your support!', 'mybooktable'); ?></h2> |
| 1078 |
<?php } else if(mbt_get_upgrade() == 'mybooktable-dev2' and mbt_get_upgrade_plugin_exists()) { ?> |
| 1079 |
<h1 class="upgrade-version"><?php echo(esc_attr($with_the).' <span class="current-version">'.wp_kses_post($dev_upgrade).' '.wp_kses_post(MBTDEV2_VERSION).'</span>'); ?></h1> |
| 1080 |
<h2 class="thank-you"><?php esc_attr_e('Thank you for your support!', 'mybooktable'); ?></h2> |
| 1081 |
<?php } else if(mbt_get_upgrade() == 'mybooktable-pro2' and mbt_get_upgrade_plugin_exists()) { ?> |
| 1082 |
<h1 class="upgrade-version"><?php echo(esc_attr($with_the).' <span class="current-version">'.wp_kses_post($pro_upgrade).' '.wp_kses_post(MBTPRO2_VERSION).'</span>'); ?></h1> |
| 1083 |
<h2 class="thank-you"><?php esc_attr_e('Thank you for your support!', 'mybooktable'); ?></h2> |
| 1084 |
<?php } else if(mbt_get_upgrade() == 'mybooktable-dev' and mbt_get_upgrade_plugin_exists()) { ?> |
| 1085 |
<h1 class="upgrade-version"><?php echo(esc_attr($with_the).' <span class="current-version">'.wp_kses_post($dev_upgrade).' '.wp_kses_post(MBTDEV_VERSION).'</span>'); ?></h1> |
| 1086 |
<h2 class="thank-you"><?php esc_attr_e('Thank you for your support!', 'mybooktable'); ?></h2> |
| 1087 |
<?php } else if(mbt_get_upgrade() == 'mybooktable-pro' and mbt_get_upgrade_plugin_exists()) { ?> |
| 1088 |
<h1 class="upgrade-version"><?php echo(esc_attr($with_the).' <span class="current-version">'.wp_kses_post($pro_upgrade).' '.wp_kses_post(MBTPRO_VERSION).'</span>'); ?></h1> |
| 1089 |
<h2 class="thank-you"><?php esc_attr_e('Thank you for your support!', 'mybooktable'); ?></h2> |
| 1090 |
<?php } else if(mbt_get_upgrade() and !mbt_get_upgrade_plugin_exists()) { ?> |
| 1091 |
<h1 class="activate-upgrade"><?php echo(wp_kses_post(mbt_get_upgrade_message())); ?></h1> |
| 1092 |
<?php } else { ?> |
| 1093 |
<h2 class="upgrade-title"><?php esc_attr_e('Upgrade your MyBookTable and get:', 'mybooktable'); ?></h2> |
| 1094 |
<ul class="upgrade-list"> |
| 1095 |
<li><?php esc_attr_e('Premium Support', 'mybooktable'); ?></li> |
| 1096 |
<li><?php esc_attr_e('Amazon Affiliate Integration', 'mybooktable'); ?></li> |
| 1097 |
<li><?php esc_attr_e('Barnes & Noble Affiliate Integration', 'mybooktable'); ?></li> |
| 1098 |
<li><?php esc_attr_e('Universal Buy Button', 'mybooktable'); ?></li> |
| 1099 |
<li><a href="https://mybooktable.com" target="_blank"><?php esc_attr_e('And much much more', 'mybooktable'); ?></a></li> |
| 1100 |
</ul> |
| 1101 |
<?php } ?> |
| 1102 |
</div> |
| 1103 |
</div> |
| 1104 |
</div> |
| 1105 |
</td> |
| 1106 |
<td class="welcome-panel welcome-panel-promotions-right"> |
| 1107 |
<div> |
| 1108 |
<div class="welcome-panel-content"> |
| 1109 |
<h3><?php esc_attr_e('Promotions', 'mybooktable'); ?></h3> |
| 1110 |
<div class="welcome-panel-column-container"> |
| 1111 |
<div class="welcome-panel-column"> |
| 1112 |
<a href="https://www.authormedia.com/all-products/7-tax-saving-tips-irs-doesnt-want-authors-know-2/" target="_blank"><img src="<?php echo(esc_url(plugins_url('images/promotions/tax_strategies_authors.jpg', dirname(__FILE__)))); ?>"></a> |
| 1113 |
<div style="font-size: 20px; font-weight: 700; text-align: center;">$99.00</div> |
| 1114 |
</div> |
| 1115 |
</div> |
| 1116 |
</div> |
| 1117 |
</div> |
| 1118 |
</td> |
| 1119 |
</tr> |
| 1120 |
</tbody></table> |
| 1121 |
<div style="clear:both"></div> |
| 1122 |
</div> |
| 1123 |
|
| 1124 |
<?php |
| 1125 |
} |
| 1126 |
|
| 1127 |
|
| 1128 |
|
| 1129 |
/*---------------------------------------------------------*/ |
| 1130 |
/* Upgrade Page */ |
| 1131 |
/*---------------------------------------------------------*/ |
| 1132 |
|
| 1133 |
function mbt_render_get_upgrade_page() { |
| 1134 |
?> |
| 1135 |
<div class="wrap mbt_settings"> |
| 1136 |
<h2><?php esc_attr_e('Get Upgrade', 'mybooktable'); ?></h2> |
| 1137 |
<?php |
| 1138 |
function mbt_get_upgrade_check_is_plugin_inactivate($slug) { |
| 1139 |
$plugin = $slug.DIRECTORY_SEPARATOR.$slug.'.php'; |
| 1140 |
if(!is_wp_error(activate_plugin($plugin))) { |
| 1141 |
echo('<p>'.esc_attr_e('Plugin successfully activated.', 'mybooktable').'</p>'); |
| 1142 |
return true; |
| 1143 |
} |
| 1144 |
|
| 1145 |
return false; |
| 1146 |
} |
| 1147 |
|
| 1148 |
function mbt_get_upgrade_get_plugin_url($slug) { |
| 1149 |
global $wp_version; |
| 1150 |
|
| 1151 |
$api_key = mbt_get_setting('api_key'); |
| 1152 |
if(!empty($api_key)) { |
| 1153 |
$to_send = array( |
| 1154 |
'action' => 'basic_check', |
| 1155 |
'version' => 'none', |
| 1156 |
'api-key' => $api_key, |
| 1157 |
'site' => get_bloginfo('url') |
| 1158 |
); |
| 1159 |
|
| 1160 |
$options = array( |
| 1161 |
'timeout' => 3, |
| 1162 |
'body' => $to_send, |
| 1163 |
'user-agent' => 'WordPress/'.$wp_version |
| 1164 |
); |
| 1165 |
|
| 1166 |
$raw_response = wp_remote_post('https://api.stormhillmedia.com/plugins/'.$slug.'/update-check', $options); |
| 1167 |
if(!is_wp_error($raw_response) and wp_remote_retrieve_response_code($raw_response) == 200) { |
| 1168 |
$response = maybe_unserialize(wp_remote_retrieve_body($raw_response)); |
| 1169 |
if(is_array($response) and !empty($response['package'])) { |
| 1170 |
return $response['package']; |
| 1171 |
} |
| 1172 |
} |
| 1173 |
} |
| 1174 |
|
| 1175 |
return ''; |
| 1176 |
} |
| 1177 |
|
| 1178 |
function mbt_get_upgrade_do_plugin_install($name, $slug, $url) { |
| 1179 |
if(empty(esc_url($url))) { echo('<p>'.esc_attr_e('An error occurred while trying to retrieve the plugin from the server. Please check your License Key.', 'mybooktable').'</p>'); return; } |
| 1180 |
if(!current_user_can('install_plugins')) { echo('<p>'.esc_attr_e('Sorry, but you do not have the correct permissions to install plugins. Contact the administrator of this site for help on getting the plugin installed.', 'mybooktable').'</p>'); return; } |
| 1181 |
|
| 1182 |
$nonce_url = wp_nonce_url('admin.php?page=mbt_dashboard', 'mbt-install-upgrade'); |
| 1183 |
$output = mbt_get_wp_filesystem($nonce_url); |
| 1184 |
|
| 1185 |
if(!empty($output)) { echo(wp_kses_post($output)); return; } |
| 1186 |
|
| 1187 |
$plugin = array(); |
| 1188 |
$plugin['name'] = $name; |
| 1189 |
$plugin['slug'] = $slug; |
| 1190 |
$plugin['source'] = $url; |
| 1191 |
|
| 1192 |
require_once ABSPATH . 'wp-admin/includes/plugin-install.php'; |
| 1193 |
require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; |
| 1194 |
|
| 1195 |
$args = array( |
| 1196 |
'type' => 'web', |
| 1197 |
/* translators: %s: plugin name */ |
| 1198 |
'title' => sprintf(esc_attr_e('Installing Plugin: %s', 'mybooktable'), $plugin['name']), |
| 1199 |
'nonce' => 'install-plugin_' . $plugin['slug'], |
| 1200 |
'plugin' => $plugin, |
| 1201 |
); |
| 1202 |
|
| 1203 |
add_filter('install_plugin_complete_actions', '__return_false', 100); |
| 1204 |
$upgrader = new Plugin_Upgrader(new Plugin_Installer_Skin($args)); |
| 1205 |
$upgrader->install($plugin['source']); |
| 1206 |
wp_cache_flush(); |
| 1207 |
remove_filter('install_plugin_complete_actions', '__return_false', 100); |
| 1208 |
|
| 1209 |
$plugin_info = $upgrader->plugin_info(); |
| 1210 |
$activate = activate_plugin($plugin_info); |
| 1211 |
if(is_wp_error($activate)) { echo('<div id="message" class="error"><p>'.wp_kses_post($activate->get_error_message()).'</p></div>'); } |
| 1212 |
} |
| 1213 |
|
| 1214 |
$slug = mbt_get_upgrade(); |
| 1215 |
if(empty($slug) or mbt_get_upgrade_plugin_exists()) { |
| 1216 |
echo('<p>'.esc_attr_e('You have no Upgrades available to download at this time.', 'mybooktable').'</p>'); |
| 1217 |
} else { |
| 1218 |
if(!mbt_get_upgrade_check_is_plugin_inactivate($slug)) { |
| 1219 |
$url = mbt_get_upgrade_get_plugin_url($slug); |
| 1220 |
if($slug == 'mybooktable-dev3') { $name = 'MyBookTable Developer Upgrade 3.0'; } |
| 1221 |
if($slug == 'mybooktable-pro3') { $name = 'MyBookTable Professional Upgrade 3.0'; } |
| 1222 |
if($slug == 'mybooktable-dev2') { $name = 'MyBookTable Developer Upgrade 2.0'; } |
| 1223 |
if($slug == 'mybooktable-pro2') { $name = 'MyBookTable Professional Upgrade 2.0'; } |
| 1224 |
if($slug == 'mybooktable-dev') { $name = 'MyBookTable Developer Upgrade'; } |
| 1225 |
if($slug == 'mybooktable-pro') { $name = 'MyBookTable Professional Upgrade'; } |
| 1226 |
mbt_get_upgrade_do_plugin_install($name, $slug, $url); |
| 1227 |
} |
| 1228 |
} |
| 1229 |
?> |
| 1230 |
<a class="button button-primary" href="<?php echo(esc_url(admin_url('admin.php?page=mbt_dashboard'))); ?>"><?php esc_attr_e('Back to Dashboard', 'mybooktable'); ?></a> |
| 1231 |
</div> |
| 1232 |
<?php |
| 1233 |
} |
| 1234 |
|
| 1235 |
|
| 1236 |
|
| 1237 |
/*---------------------------------------------------------*/ |
| 1238 |
/* Founders Page */ |
| 1239 |
/*---------------------------------------------------------*/ |
| 1240 |
|
| 1241 |
function mbt_render_founders_page() { |
| 1242 |
?> |
| 1243 |
<div class="wrap"> |
| 1244 |
<h2><?php esc_attr_e('MyBookTable Founders', 'mybooktable'); ?></h2> |
| 1245 |
<p><?php esc_attr_e('This plugin was made possible by some adventurous kickstarters. We are so grateful for the members of the writing community who backed our Kickstarter project and helped us launch this plugin! Below are the ones who sponsored at the $75 level or higher. Thank you for your support!', 'mybooktable'); ?></p> |
| 1246 |
<h3 dir="ltr">$75+ Backer Level</h3> |
| 1247 |
<ul> |
| 1248 |
<li><a href="http://www.stevelaube.com">Steve Laube</a>, founder of <a href="http://www.stevelaube.com">Steve Laube Agency</a></li> |
| 1249 |
<li><a href="http://www.dianneprice-author.com/">Dianne Price</a>, author of <a href="http://www.amazon.com/dp/B00CGDPZ68">Dying Light</a></li> |
| 1250 |
|
| 1251 |
<li><a href="http://www.creatingthestory.com">Inger Fountain</a>, author of <a href="http://www.creatingthestory.com">Creating the Story</a></li> |
| 1252 |
<li><a href="http://www.caroletowriss.com">Carole Towriss</a>, author of <a href="http://www.amazon.com/Shadow-Sinai-Journey-Canaan-ebook/dp/B00BM92PUQ/ref=sr_1_1?ie=UTF8&qid=1366837954&sr=8-1&keywords=towriss">The Shadow of Sinai</a></li> |
| 1253 |
<li><a href="http://www.hiswords2growby.com">Lisa Phillips</a>, author of <a href="http://www.hiswords2growby.com">Words 2 Grow By</a></li> |
| 1254 |
<li><a href="http://tracyhigley.com">Tracy Higley</a>, author of <a href="http://amzn.to/RxemDx">So Shines the Night</a></li> |
| 1255 |
<li><a href="http://www.normandiefischer.com">Normandie Fischer</a>, author of <a href="http://www.amazon.com/Becalmed-Normandie-Fischer/dp/1938499611/">Becalmed</a></li> |
| 1256 |
<li><a href="http://www.judykbaer.com/">Judy Baer</a>, author of <a href="http://www.amazon.com/Judy-Baer/e/B000APHRLK/">Tales from Grace Chapel Inn</a></li> |
| 1257 |
<li><a href="http://www.robinleehatcher.com">Robin Lee Hatcher</a>, author of <a href="http://www.amazon.com/exec/obidos/ASIN/031025809X/novelistrobinlee">Betrayed</a></li> |
| 1258 |
<li><a href="http://www.contrarymarket.com">Krystine Kercher</a>, author of <a href="http://www.amazon.com/Shadow-Land-Legends-Astarkand/dp/148262477X/">A Shadow on the Land</a></li> |
| 1259 |
<li><a href="http://www.mischievousmalamute.com">Harley Christensen</a>, author of <a href="http://www.amazon.com/Gemini-Rising-Mischievous-Malamute-ebook/dp/B00A9FTM3C">Gemini Rising</a></li> |
| 1260 |
<li><a href="http://www.juliemcovert.com">Julie Covert</a>, author of <a href="http://www.amazon.com/Art-Winter-Julie-M-Covert/dp/0985369000/ref=sr_1_1?ie=UTF8&qid=1366665243&sr=8-1&keywords=Art+of+Winter">Art of Winter</a></li> |
| 1261 |
<li><a href="http://www.dogmathebook.com">Barbara Brunner</a>, author of <a href="http://www.amazon.com/Dog-Ma-Slobber-barbara-boswell-brunner/dp/1478106581/ref=sr_1_1?ie=UTF8&qid=1366664672&sr=8-1&keywords=Dog-Ma">Dog-Ma: The Zen of Slobber</a></li> |
| 1262 |
<li><a href="http://writingas.kerineal.com">Keri Neal</a>, author of <a href="http://www.amazon.com/Keri-Neal/e/B007SD2KNC">Torn</a></li> |
| 1263 |
<li><a href="http://angelahuntbooks.com">Angela Hunt</a>, author of <a href="http://www.amazon.com/Angela-E.-Hunt/e/B000AQ1EJU/ref=sr_tc_2_0?qid=1366664404&sr=8-2-ent">The Offering</a></li> |
| 1264 |
<li><a href="http://www.calebbreakey.com">Caleb Jennings Breakey</a>, author of <a href="http://www.amazon.com/Called-Stay-Uncompromising-Mission-Church/dp/0736955429">Called to Stay</a></li> |
| 1265 |
<li><a href="http://www.thedigitaldelusion.com">Doyle Buehler</a>, author of <a href="http://digitaldelusion.info/">The Digital Delusion</a></li> |
| 1266 |
<li><a href="http://johnwhowell.com">John Howell</a></li> |
| 1267 |
<li><a href="http://www.amazingthingsministry.com">Mona Corwin</a>, author of <a href="http://www.amazon.com/Table-Doing-Savoring-Scripture-together/dp/1415868417/" target="_blank">Table for Two</a></li> |
| 1268 |
<li><a href="http://saltrunpublishing.com" target="_blank">Kellie Sharpe</a>, author of <a href="http://www.amazon.com/Surviving-Foaling-Season-ebook/dp/B00BEZBFSG" target="_blank">Surviving Foaling Season</a></li> |
| 1269 |
</ul> |
| 1270 |
<h3 dir="ltr">$100 + Backer Level</h3> |
| 1271 |
<ul> |
| 1272 |
<li><a href="http://www.thetrustdiamond.com">Tink DeWitt</a>, author of <a href="http://www.amazon.com/s/ref=nb_sb_noss?url=search-alias%3Daps&field-keywords=The+Trust+Diamond">The Trust Diamond</a></li> |
| 1273 |
<li><a href="http://authorsbroadcast.com">Reno Lovison</a>, author of <a href="http://www.amazon.com/Turn-Your-Business-Card-Into/dp/1434847683/">Turn Your Business Card into Business</a></li> |
| 1274 |
<li><a href="http://www.alex-f-fayle.com">Alex F. Fayle</a>, author of <a href="http://www.amazon.com/An-Extraordinarily-Ordinary-Life-ebook/dp/B0051EZL54/">An Extraordinarily Ordinary Life</a></li> |
| 1275 |
<li><a href="http://www.talkstorymedia.net">Barbara Holbrook</a>, founder of <a href="http://www.talkstorymedia.net">TalkStory Media</a></li> |
| 1276 |
<li><a href="http://mirwriter.wordpress.com">Mir Schultz</a>, author of <a href="http://mirwriter.wordpress.com">Mir Writes</a></li> |
| 1277 |
<li><a href="http://www.beachhousesinvabeach.com">Bruce Gwaltney</a>, author of <a href="http://www.beachhousesinvabeach.com">Beach Houses in Virginia Beach</a></li> |
| 1278 |
<li><a href="http://www.rabbimoffic.com">Evan Moffic</a>, author of <a href="http://www.amazon.com/-/e/B00BNHHWPK">Wisdom for People of all Faiths</a></li> |
| 1279 |
<li><a href="http://www.adminismith.com">Janica Smith</a>, author of <a href="http://www.adminismith.com">Virtual Business Solutions</a></li> |
| 1280 |
<li><a href="http://www.booksbyjoy.com">Joy DeKok</a>, author of <a href="http://www.amazon.com/s/ref=ntt_athr_dp_sr_1?_encoding=UTF8&field-author=Joy%20DeKok&search-alias=books&sort=relevancerank">Rain Dance</a></li> |
| 1281 |
<li><a href="http://www.lindahoenigsberg.com">Linda Hoenigsberg</a></li> |
| 1282 |
<li>Lisa Hendrix</li> |
| 1283 |
<li><a href="http://vickivlucas.com/" target="_blank">Vicki Lucas</a>, author of <a href="http://www.amazon.com/Vicki-V.-Lucas/e/B006X7117U/ref=ntt_athr_dp_pel_1" target="_blank">Toxic</a></li> |
| 1284 |
<li><a href="http://www.Hunting-America.com" target="_blank">Richard James</a></li> |
| 1285 |
</ul> |
| 1286 |
<h3>$150 + Backer Level</h3> |
| 1287 |
<ul> |
| 1288 |
<li><a href="http://www.dollarplanning.com">Brenda Taylor</a>, author of <a href="http://www.dollarplanning.com">Dollar Planning</a></li> |
| 1289 |
<li><a href="http://lauradomino.com">Laura Domino</a>, author of <a href="http://lauradomino.com">Laura Domino</a></li> |
| 1290 |
<li><a href="http://www.warmenhoven.co">Adrianus Warmenhoven</a>, author of <a href="http://www.warmenhoven.co">Warmenhoven</a></li> |
| 1291 |
<li><a href="http://www.accidentalauthor.ca">Mike Hartner</a>, author of <a href="http://www.amazon.com/I-Walter-ebook/dp/B00C7FJ7B4/ref=sr_1_1?ie=UTF8&qid=1366292416&sr=8-1&keywords=%22I%2C+Walter%22">I, Walter</a></li> |
| 1292 |
<li><a href="http://www.kathleenoverby.com">Kathleen Overby</a></li> |
| 1293 |
<li><a href="http://vivianmabuni.com/">Vivian Mabuni</a>, author of <a href="http://vivianmabuni.com/">Warrior in Pink</a></li> |
| 1294 |
<li><a href="http://wadewebster.com">Wade Webster</a></li> |
| 1295 |
<li><a href="http://gloriaclover.com">Gloria Clover</a>, author of <a href="http://www.amazon.com/Children-King-Book-Two-ebook/dp/B008W1AUUO/ref=sr_1_1?ie=UTF8&qid=1366664833&sr=8-1&keywords=The+Fire+Starter%2C+Clover">The Fire Starter</a></li> |
| 1296 |
<li><a href="http://www.lisabergren.com">Lisa Bergren</a>, author of <a href="http://www.amazon.com/Glamorous-Illusions-Novel-Grand-Series/dp/1434764303/ref=tmm_pap_title_0">Glamorous Illusions</a></li> |
| 1297 |
<li><a href="http://techguyjay.com/books" target="_blank">Jay Donovan</a></li> |
| 1298 |
<li><a href="http://www.DebiJHolliday.com" target="_blank">Debi J. Holliday</a></li> |
| 1299 |
<li><a href="http://www.nickbuchan.com" target="_blank">Nick and Lu</a></li> |
| 1300 |
<li><a href="http://www.sbbflonghorns.com" target="_blank">Chrisann Merriman</a></li> |
| 1301 |
<li><a href="http://www.cloudlinkco.com" target="_blank">Brandon Frye</a></li> |
| 1302 |
<li>Diane Finlayson</li> |
| 1303 |
<li>David Buggs</li> |
| 1304 |
</ul> |
| 1305 |
<h3 dir="ltr">$250+ Backer Level</h3> |
| 1306 |
<ul> |
| 1307 |
<li><a href="http://christopherschmitt.com/">Christopher Schmitt</a>, author of <a href="http://www.amazon.com/Designing-Web-Mobile-Graphics-Fundamental/dp/0321858549/">Designing Web and Mobile Graphics</a></li> |
| 1308 |
<li><a href="http://hotappleciderbooks.com">Les and N.J. Lindquist</a>, authors of <a href="http://www.amazon.com/Second-Cup-Hot-Apple-Cider/dp/0978496310/ref=sr_1_3?s=books&ie=UTF8&qid=1366743096&sr=1-3">A Second Cup of Apple Cider</a></li> |
| 1309 |
<li><a href="http://www.inboundmastery.com">Tony Tovar</a>, <a href="http://www.amazon.com/dp/B008R1F446">How to Make Money from Writing Online</a></li> |
| 1310 |
<li><a href="http://www.remcdermott.com">R.E. McDermott</a>, author of <a href="http://www.amazon.com/Deadly-Straits-Dugan-Novel-ebook/dp/B0057AMO2A">Deadly Straits</a></li> |
| 1311 |
<li><a href="http://www.marydemuth.com">Mary DeMuth</a>, author of <a href="http://amzn.to/sDBhqT">The 11 Secrets of Getting Published</a></li> |
| 1312 |
<li><a href="http://livinignited.org/Livin_Ignited/Home.html">Nancy Grisham</a>, author of <a href="http://www.amazon.com/Thriving-Trusting-God-Life-Fullest/dp/080101543X/ref=sr_1_1?ie=UTF8&qid=1366995488&sr=8-1&keywords=nancy+grisham">Thriving: Trusting God for Life to the Fullest</a></li> |
| 1313 |
<li><a href="http://www.markmittleburg.com">Mark Mittleberg</a>, author of <a href="http://www.amazon.com/Confident-Faith-Building-Foundation-Beliefs/dp/1414329962/ref=sr_1_2?s=books&ie=UTF8&qid=1367010724&sr=1-2&keywords=confident+faith">Confident Faith</a></li> |
| 1314 |
<li><a href="http://www.ageviewpress.com">Jeanette Vaughan</a>, author of <a href="http://www.amazon.com/Flying-Solo-Unconventional-Navigates-Turbulence/dp/061561888X/ref=sr_1_1?ie=UTF8&qid=1366856431&sr=8-1&keywords=jeanette+vaughan+flying+solo">Flying Solo</a></li> |
| 1315 |
<li><a href="http://markmccluretoday.com" target="_blank">Mark McClure</a></li> |
| 1316 |
<li><a href="http://www.recalculatingthebook.com/" target="_blank">Dennis Pappenfus</a></li> |
| 1317 |
<li><a href="http://www.advancedfictionwriting.com">Randy Ingermanson</a>, author of <a href="http://www.amazon.com/Writing-Fiction-Dummies-Randy-Ingermanson/dp/0470530707/">Writing Fiction for Dummies</a></li> |
| 1318 |
<li><a href="http://www.qualityusproducts.com">Ellen Pope</a></li> |
| 1319 |
</ul> |
| 1320 |
</div> |
| 1321 |
<?php |
| 1322 |
} |
| 1323 |
|
| 1324 |
|
| 1325 |
|
| 1326 |
/*---------------------------------------------------------*/ |
| 1327 |
/* Import Page */ |
| 1328 |
/*---------------------------------------------------------*/ |
| 1329 |
|
| 1330 |
function mbt_import_page_init() { |
| 1331 |
add_action('wp_ajax_mbt_import_page_import_book', 'mbt_import_page_import_book'); |
| 1332 |
} |
| 1333 |
add_action('mbt_init', 'mbt_import_page_init'); |
| 1334 |
|
| 1335 |
function mbt_import_page_import_book() { |
| 1336 |
$importer_nonce = wp_create_nonce('importer_nonce','nonce_importer'); |
| 1337 |
$response = array('error' => 'Unknown error!'); |
| 1338 |
|
| 1339 |
$importers = mbt_get_importers(); |
| 1340 |
$import_data = get_transient('mbt_import_data'); |
| 1341 |
|
| 1342 |
if(is_array($import_data) and isset($_POST['book']) and !empty($importers[$import_data['import_type']]) && wp_verify_nonce(sanitize_key($importer_nonce),'importer_nonce')) { |
| 1343 |
$importer = $importers[$import_data['import_type']]; |
| 1344 |
$pbook = sanitize_text_field(wp_unslash($_POST['book'])); |
| 1345 |
$book = apply_filters('mbt_pre_import_book', $import_data['book_list'][$pbook], $import_data['import_type']); |
| 1346 |
if(is_array($book)) { |
| 1347 |
$imported_book_id = mbt_import_book($book); |
| 1348 |
$response = array( |
| 1349 |
'book_link' => get_permalink($imported_book_id), |
| 1350 |
'title' => $book['title'], |
| 1351 |
); |
| 1352 |
} else { |
| 1353 |
$response = array('error' => $book); |
| 1354 |
} |
| 1355 |
} |
| 1356 |
|
| 1357 |
echo(wp_json_encode($response)); |
| 1358 |
die(); |
| 1359 |
} |
| 1360 |
|
| 1361 |
function mbt_render_import_page() { |
| 1362 |
$import_nonce = wp_create_nonce('import_nonce','nonce_import'); |
| 1363 |
$importers = mbt_get_importers(); |
| 1364 |
?> |
| 1365 |
<div class="main-importer-wrap"> |
| 1366 |
<?php |
| 1367 |
if(!empty($_GET['mbt_import_type']) && wp_verify_nonce(sanitize_key($import_nonce),'import_nonce')) { |
| 1368 |
$import_type = sanitize_text_field(wp_unslash($_GET['mbt_import_type'])); |
| 1369 |
if(!empty($importers[$import_type])) { |
| 1370 |
$importer = $importers[$import_type]; |
| 1371 |
|
| 1372 |
if(isset($_POST['import-submit'])) { |
| 1373 |
if(is_callable($importer['get_book_list'])) { |
| 1374 |
$book_list = call_user_func($importer['get_book_list']); |
| 1375 |
} else if(is_array($importer['get_book_list'])) { |
| 1376 |
$book_list = call_user_func($importer['get_book_list']['parse_import_form']); |
| 1377 |
} |
| 1378 |
if(!is_array($book_list)) { |
| 1379 |
?> |
| 1380 |
<div class="wrap mbt-book-importer"> |
| 1381 |
<h2><?php echo(isset($importer['page_title']) ? esc_attr($importer['page_title']) : esc_attr($importer['name'])); ?></h2> |
| 1382 |
<span class="mbt-book-importer-error"><?php esc_attr_e('Import error:', 'mybooktable'); ?></span> |
| 1383 |
<?php echo(wp_kses_post($book_list)); ?> |
| 1384 |
</div> |
| 1385 |
<?php |
| 1386 |
return; |
| 1387 |
} |
| 1388 |
|
| 1389 |
set_transient('mbt_import_data', array('import_type' => $import_type, 'book_list' => $book_list), DAY_IN_SECONDS); |
| 1390 |
?> |
| 1391 |
<div class="wrap mbt-book-importer"> |
| 1392 |
<h2><?php echo(isset($importer['page_title']) ? esc_attr($importer['page_title']) : esc_attr($importer['name'])); ?></h2> |
| 1393 |
|
| 1394 |
<h3 id="mbt-book-import-progress-status"><?php esc_attr_e('Please wait, your books are importing...', 'mybooktable'); ?></h3> |
| 1395 |
<div id="mbt-book-import-progress"> |
| 1396 |
<div id="mbt-book-import-progress-bar"><div id="mbt-book-import-progress-bar-inner"></div></div> |
| 1397 |
<button type="button" class="import-stop button"><?php esc_attr_e('Stop Import', 'mybooktable'); ?></a> |
| 1398 |
</div> |
| 1399 |
<ul id="mbt-book-import-results"></ul> |
| 1400 |
<a href="<?php echo(esc_url(admin_url('edit.php?post_type=mbt_book'))); ?>" class="import-continue button button-primary" style="display:none"><?php esc_attr_e('Continue', 'mybooktable'); ?></a> |
| 1401 |
<script type="text/javascript"> |
| 1402 |
jQuery(document).ready(function() { |
| 1403 |
var num_books = <?php echo(count($book_list)); ?>; |
| 1404 |
|
| 1405 |
var import_stopped = false; |
| 1406 |
jQuery('.import-stop').click(function() { |
| 1407 |
import_stopped = true; |
| 1408 |
jQuery(this).attr('disabled', 'disabled'); |
| 1409 |
}); |
| 1410 |
|
| 1411 |
function mbt_book_imported(response) { |
| 1412 |
try { response = JSON.parse(response); } |
| 1413 |
catch(e) { response = {error: 'PHP error: "'+response+'"'}; } |
| 1414 |
|
| 1415 |
var el = null; |
| 1416 |
if('error' in response) { |
| 1417 |
el = jQuery('<li class="mbt-result-failure">'+response.error+'</li>'); |
| 1418 |
} else { |
| 1419 |
el = jQuery('<li class="mbt-result-success">'+mbt_admin_pages_i18n.successfully_imported+': <a href="'+response.book_link+'" target="_blank">'+response.title+'</a></li>'); |
| 1420 |
} |
| 1421 |
jQuery('#mbt-book-import-results').append(el); |
| 1422 |
jQuery('#mbt-book-import-results').scrollTop(jQuery('#mbt-book-import-results').prop('scrollHeight')); |
| 1423 |
} |
| 1424 |
|
| 1425 |
function mbt_book_request_failed(query) { |
| 1426 |
mbt_book_imported('HTTP error: '+query.status+' '+query.statusText); |
| 1427 |
} |
| 1428 |
|
| 1429 |
function mbt_import_book(i) { |
| 1430 |
i = typeof i !== 'undefined' ? i : 0; |
| 1431 |
|
| 1432 |
if(i >= num_books || import_stopped) { |
| 1433 |
if(import_stopped) { |
| 1434 |
jQuery('#mbt-book-import-progress-status').text(mbt_admin_pages_i18n.import_interrupted); |
| 1435 |
} else { |
| 1436 |
jQuery('#mbt-book-import-progress-status').text(mbt_admin_pages_i18n.import_complete); |
| 1437 |
} |
| 1438 |
jQuery('.import-stop').remove(); |
| 1439 |
jQuery('.import-continue').show(); |
| 1440 |
return; |
| 1441 |
} |
| 1442 |
|
| 1443 |
jQuery.post(ajaxurl, { |
| 1444 |
action: 'mbt_import_page_import_book', |
| 1445 |
book: i, |
| 1446 |
}).done(mbt_book_imported).fail(mbt_book_request_failed).always(function() { |
| 1447 |
var percent = ((i+1)/num_books)*90.0 + 10.0; |
| 1448 |
jQuery('#mbt-book-import-progress-bar-inner').css('width', percent+'%'); |
| 1449 |
mbt_import_book(i+1); |
| 1450 |
}); |
| 1451 |
} |
| 1452 |
|
| 1453 |
mbt_import_book(); |
| 1454 |
}); |
| 1455 |
</script> |
| 1456 |
</div> |
| 1457 |
<?php |
| 1458 |
} else { |
| 1459 |
?> |
| 1460 |
<div class="wrap mbt-book-importer"> |
| 1461 |
<h2><?php echo(isset($importer['page_title']) ? esc_attr($importer['page_title']) : esc_attr($importer['name'])); ?></h2> |
| 1462 |
<form action="<?php echo(esc_url(admin_url('admin.php?page=mbt_import&mbt_import_type='.$import_type))); ?>" method="POST" enctype="multipart/form-data"> |
| 1463 |
<?php |
| 1464 |
if(is_callable($importer['get_book_list'])) { |
| 1465 |
$book_list = call_user_func($importer['get_book_list']); |
| 1466 |
echo('<h3>'.esc_attr_e('The following books will be imported:', 'mybooktable').'</h3>'); |
| 1467 |
echo('<ul class="mbt-import-books-preview">'); |
| 1468 |
foreach($book_list as $book) { |
| 1469 |
echo('<li>'.esc_attr($book['title']).'</li>'); |
| 1470 |
} |
| 1471 |
echo('</ul>'); |
| 1472 |
echo('<h3>'.esc_attr_e('Are you sure you want to import these books?', 'mybooktable').'</h3>'); |
| 1473 |
echo('<div style="clear:both"></div><input type="submit" name="import-submit" class="import-submit button button-primary" value="'.sprintf(esc_html__('Import', 'mybooktable')).'">'); |
| 1474 |
} else if(is_array($importer['get_book_list'])) { |
| 1475 |
if(!isset($importer['get_book_list']['render_import_form']) or !isset($importer['get_book_list']['parse_import_form'])) { |
| 1476 |
esc_attr_e('Importer error! Unable to render import form.', 'mybooktable'); |
| 1477 |
} else { |
| 1478 |
call_user_func($importer['get_book_list']['render_import_form']); |
| 1479 |
echo('<div style="clear:both"></div><input type="submit" name="import-submit" class="import-submit button button-primary" value="'.sprintf(esc_html__('Import','mybooktable')).'">'); |
| 1480 |
} |
| 1481 |
} else { |
| 1482 |
esc_attr_e('Importer error! Please ensure your MyBookTable Upgrade plugins are updated.', 'mybooktable'); |
| 1483 |
} |
| 1484 |
?> |
| 1485 |
</form> |
| 1486 |
</div> |
| 1487 |
</div> |
| 1488 |
<?php |
| 1489 |
} |
| 1490 |
return; |
| 1491 |
} |
| 1492 |
} |
| 1493 |
?> |
| 1494 |
<div class="wrap mbt-import-page"> |
| 1495 |
<h2>Import Books</h2> |
| 1496 |
<p>If you have books in another system, MyBookTable can import those into this site. To get started, choose a system to import from below:</p> |
| 1497 |
<table class="widefat importers"> |
| 1498 |
<tbody> |
| 1499 |
<?php |
| 1500 |
$alternate = true; |
| 1501 |
foreach($importers as $slug => $importer) { |
| 1502 |
echo('<tr'.($alternate ? ' class="alternate"' : '').'>'); |
| 1503 |
if(empty($importer['disabled'])) { |
| 1504 |
echo('<td class="import-system row-title"><a href="'.esc_url(admin_url('admin.php?page=mbt_import&mbt_import_type='.$slug)).'">'.esc_attr($importer['name']).'</a></td>'); |
| 1505 |
} else { |
| 1506 |
echo('<td class="import-system row-title disabled">'.esc_attr($importer['name']).'</td>'); |
| 1507 |
} |
| 1508 |
echo('<td class="desc">'.wp_kses_post($importer['desc']).((!empty($importer['disabled']) and is_string($importer['disabled'])) ? ' ('.esc_attr($importer['disabled']).')' : '').'</td>'); |
| 1509 |
echo('</tr>'); |
| 1510 |
$alternate = !$alternate; |
| 1511 |
} |
| 1512 |
?> |
| 1513 |
</tbody> |
| 1514 |
</table> |
| 1515 |
</div> |
| 1516 |
<?php |
| 1517 |
} |
| 1518 |
|