PluginProbe
MyBookTable Bookstore by Stormhill Media / 3.6.5
MyBookTable Bookstore by Stormhill Media v3.6.5
3.6.5 trunk
mybooktable / mybooktable.php

mybooktable.php in MyBookTable Bookstore by Stormhill Media 3.6.5, at mybooktable.php

138 lines 5.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /*
3 Plugin Name: MyBookTable Bookstore by Stormhill Media
4 Plugin URI: https://stormhillmedia.com/all-products/mybooktable/
5 Description: A WordPress Bookstore Plugin to help authors boost book sales on sites like Amazon and Apple iBooks with great-looking book pages.
6 Author: Stormhill Media
7 Author URI: https://www.stormhillmedia.com
8 Text Domain: mybooktable
9 Domain Path: /i18n/
10 Version: 3.6.5
11 License: GPLv2 or later
12 License URI: http://www.gnu.org/licenses/gpl-2.0.html
13 */
14
15 define("MBT_VERSION", "3.6.5");
16
17 /*---------------------------------------------------------*/
18 /* PHP Version Check */
19 /*---------------------------------------------------------*/
20
21 if(!defined('PHP_VERSION_ID')) {
22 $version = explode('.', PHP_VERSION);
23 define('PHP_VERSION_ID', ($version[0] * 10000 + $version[1] * 100 + $version[2]));
24 }
25
26 if(PHP_VERSION_ID < 50309) {
27 function mbt_php_version_admin_notice() {
28 load_plugin_textdomain('mybooktable', false, plugin_basename(dirname(__FILE__))."/i18n");
29 ?>
30 <div id="message" class="error">
31 <p>
32 <strong><?php esc_attr_e('PHP Out of Date', 'mybooktable'); ?></strong> &#8211;
33 <?php
34 /* translators: %s: PHP version on this server */
35 printf(esc_attr_e('MyBookTable requires at least PHP 5.3.9. You are currently running PHP %s. Please contact your hosting provider to request that they update your PHP.', 'mybooktable'), PHP_VERSION); ?>
36 </p>
37 </div>
38 <?php
39 }
40 add_action('admin_notices', 'mbt_php_version_admin_notice');
41 return;
42 }
43
44 /*---------------------------------------------------------*/
45 /* Includes */
46 /*---------------------------------------------------------*/
47 require_once(dirname(__FILE__).'/includes/functions.php');
48 require_once(dirname(__FILE__).'/includes/setup.php');
49 require_once(dirname(__FILE__).'/includes/templates.php');
50 require_once(dirname(__FILE__).'/includes/buybuttons.php');
51 require_once(dirname(__FILE__).'/includes/admin_pages.php');
52 require_once(dirname(__FILE__).'/includes/post_types.php');
53 require_once(dirname(__FILE__).'/includes/taxonomies.php');
54 require_once(dirname(__FILE__).'/includes/metaboxes.php');
55 require_once(dirname(__FILE__).'/includes/extras/seo.php');
56 require_once(dirname(__FILE__).'/includes/extras/widgets.php');
57 require_once(dirname(__FILE__).'/includes/extras/shortcodes.php');
58 require_once(dirname(__FILE__).'/includes/extras/compatibility.php');
59 require_once(dirname(__FILE__).'/includes/extras/googleanalytics.php');
60 require_once(dirname(__FILE__).'/includes/extras/breadcrumbs.php');
61 require_once(dirname(__FILE__).'/includes/extras/goodreads.php');
62 require_once(dirname(__FILE__).'/includes/extras/booksorting.php');
63 require_once(dirname(__FILE__).'/includes/extras/getnoticed.php');
64 require_once(dirname(__FILE__).'/includes/extras/totallybooked.php');
65 require_once(dirname(__FILE__).'/includes/extras/customimport.php');
66 require_once(dirname(__FILE__).'/includes/extras/universalbuybutton.php');
67 require_once(dirname(__FILE__).'/includes/extras/blocks.php');
68 require_once(dirname(__FILE__).'/includes/extras/themes.php');
69 require_once(dirname(__FILE__).'/includes/extras/divi.php');
70
71
72
73 /*---------------------------------------------------------*/
74 /* Activate Plugin */
75 /*---------------------------------------------------------*/
76
77 function mbt_activate() {
78 mbt_register_post_types();
79 mbt_register_taxonomies();
80 flush_rewrite_rules();
81 }
82 register_activation_hook(__FILE__, 'mbt_activate');
83
84 function mbt_deactivate() {
85 flush_rewrite_rules();
86 }
87 register_deactivation_hook(__FILE__, 'mbt_deactivate');
88
89
90
91 /*---------------------------------------------------------*/
92 /* Initialize Plugin */
93 /*---------------------------------------------------------*/
94
95 function mbt_init() {
96 load_plugin_textdomain('mybooktable', false, plugin_basename(dirname(__FILE__))."/i18n");
97 mbt_load_settings();
98 mbt_update_check();
99 mbt_customize_plugins_page();
100 //if(mbt_detect_deactivation()) { return; }
101 do_action('mbt_init');
102 }
103 add_action('plugins_loaded', 'mbt_init');
104
105 /*
106 function mbt_detect_deactivation() {
107 if($GLOBALS['pagenow'] == "plugins.php" and current_user_can('install_plugins') and isset($_GET['action']) and $_GET['action'] == 'deactivate' and isset($_GET['plugin']) and $_GET['plugin'] == plugin_basename(dirname(__FILE__)).'/mybooktable.php') {
108 mbt_update_setting('detect_deactivated', 'detected');
109 //mbt_track_event('plugin_deactivated', true);
110 //mbt_send_tracking_data();
111 return true;
112 } else if(mbt_get_setting('detect_deactivated') === 'detected') {
113 mbt_update_setting('detect_deactivated', false);
114 //mbt_track_event('plugin_activated', true);
115 }
116 return false;
117 }
118 */
119
120 function mbt_customize_plugins_page() {
121 add_filter('plugin_action_links_'.plugin_basename(__FILE__), 'mbt_plugin_action_links');
122 add_filter('plugin_row_meta', 'mbt_plugin_row_meta', 10, 2);
123 }
124
125 function mbt_plugin_action_links($actions) {
126 unset($actions['edit']);
127 $actions['settings'] = '<a href="'.admin_url('admin.php?page=mbt_settings').'">'.__('Settings', 'mybooktable').'</a>';
128 $actions['help'] = '<a href="'.admin_url('admin.php?page=mbt_help').'">'.__('Help', 'mybooktable').'</a>';
129 $actions['upgrade'] = '<a href="https://www.stormhillmedia.com/all-products/mybooktable/upgrades/" target="_blank">'.__('Purchase Upgrade', 'mybooktable').'</a>';
130 return $actions;
131 }
132
133 function mbt_plugin_row_meta($links, $file) {
134 if($file == plugin_basename(__FILE__)) {
135 $links[] = '<a target="_blank" href="https://wordpress.org/support/view/plugin-reviews/mybooktable?filter=5#postform">'.__('Write a Review', 'mybooktable').'</a>';
136 }
137 return $links;
138 }