| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* The plugin bootstrap file |
| 5 |
* |
| 6 |
* This file is read by WordPress to generate the plugin information in the plugin |
| 7 |
* admin area. This file also includes all of the dependencies used by the plugin, |
| 8 |
* registers the activation and deactivation functions, and defines a function |
| 9 |
* that starts the plugin. |
| 10 |
* |
| 11 |
* @link https://jamiebergen.com/ |
| 12 |
* @since 1.0.0 |
| 13 |
* @package Plugin_Notes_Plus |
| 14 |
* |
| 15 |
* @wordpress-plugin |
| 16 |
* Plugin Name: Plugin Notes Plus |
| 17 |
* Plugin URI: https://jamiebergen.com/plugin-notes-plus/ |
| 18 |
* Description: Adds a column for plugin notes. |
| 19 |
* Version: 1.2.0 |
| 20 |
* Author: Jamie Bergen |
| 21 |
* Author URI: https://jamiebergen.com/ |
| 22 |
* License: GPL-2.0+ |
| 23 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt |
| 24 |
* Text Domain: plugin-notes-plus |
| 25 |
* Domain Path: /languages |
| 26 |
*/ |
| 27 |
|
| 28 |
// If this file is called directly, abort. |
| 29 |
if ( ! defined( 'WPINC' ) ) { |
| 30 |
die; |
| 31 |
} |
| 32 |
|
| 33 |
/** |
| 34 |
* Current plugin version. |
| 35 |
* Start at version 1.0.0 and use SemVer - https://semver.org |
| 36 |
*/ |
| 37 |
define( 'PLUGIN_NOTES_PLUS_VERSION', '1.2.0' ); |
| 38 |
|
| 39 |
/** |
| 40 |
* The code that runs during plugin activation. |
| 41 |
* This action is documented in includes/class-plugin-name-activator.php |
| 42 |
*/ |
| 43 |
global $plugin_notes_plus_db_version; |
| 44 |
$plugin_notes_plus_db_version = '1.1'; |
| 45 |
|
| 46 |
function activate_plugin_notes_plus() { |
| 47 |
require_once plugin_dir_path( __FILE__ ) . 'includes/class-plugin-notes-plus-activator.php'; |
| 48 |
Plugin_Notes_Plus_Activator::activate(); |
| 49 |
} |
| 50 |
register_activation_hook( __FILE__, 'activate_plugin_notes_plus' ); |
| 51 |
|
| 52 |
/** |
| 53 |
* The code that runs on plugin update. |
| 54 |
* Migrates data out of _options and into new custom table if upgrading from 1.0.0 |
| 55 |
* Removes old notes from options after migration is complete |
| 56 |
*/ |
| 57 |
function plugin_notes_plus_migrate_to_table() { |
| 58 |
if ( !get_option( 'plugin_notes_plus_db_version' ) || get_option( 'plugin_notes_plus_db_version' ) == 1.0 ) { |
| 59 |
activate_plugin_notes_plus(); |
| 60 |
} |
| 61 |
} |
| 62 |
add_action( 'plugins_loaded', 'plugin_notes_plus_migrate_to_table' ); |
| 63 |
|
| 64 |
/** |
| 65 |
* The core plugin class that is used to define internationalization, |
| 66 |
* admin-specific hooks, and public-facing site hooks. |
| 67 |
*/ |
| 68 |
require plugin_dir_path( __FILE__ ) . 'includes/class-plugin-notes-plus.php'; |
| 69 |
|
| 70 |
/** |
| 71 |
* Begins execution of the plugin. |
| 72 |
* |
| 73 |
* Since everything within the plugin is registered via hooks, |
| 74 |
* then kicking off the plugin from this point in the file does |
| 75 |
* not affect the page life cycle. |
| 76 |
* |
| 77 |
* @since 1.0.0 |
| 78 |
*/ |
| 79 |
function run_plugin_notes_plus() { |
| 80 |
|
| 81 |
$plugin = new Plugin_Notes_Plus(); |
| 82 |
$plugin->run(); |
| 83 |
|
| 84 |
} |
| 85 |
run_plugin_notes_plus(); |
| 86 |
|