| @@ -1,99 +1,64 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Code Snippets - An easy, clean and simple way to add code snippets to your site. | |
| 3 | + * Plugin Name: Code Snippets | |
| 4 | + * Plugin URI: https://codesnippets.pro | |
| 5 | + * Description: An easy, clean, and simple way to run code snippets on your site. No need to edit your theme's functions.php file again! | |
| 6 | + * Author: Code Snippets Pro | |
| 7 | + * Author URI: https://codesnippets.pro | |
| 8 | + * License: GPL-2.0-or-later | |
| 9 | + * License URI: license.txt | |
| 10 | + * Text Domain: code-snippets | |
| 11 | + * Version: 4.0.0-beta.2 | |
| 12 | + * Requires PHP: 7.4 | |
| 13 | + * Requires at least: 5.5 | |
| 4 | 14 | * |
| 5 | - * If you're interested in helping to develop Code Snippets, or perhaps contribute | |
| 6 | - * to the localization, please see https://github.com/sheabunge/code-snippets | |
| 15 | + * @version 4.0.0-beta.2 | |
| 16 | + * @package Code_Snippets | |
| 17 | + * @author Shea Bunge <[email protected]> | |
| 18 | + * @copyright 2012-2026 Code Snippets Pro | |
| 19 | + * @license GPL-2.0-or-later https://spdx.org/licenses/GPL-2.0-or-later.html | |
| 20 | + * @link https://github.com/codesnippetspro/code-snippets | |
| 7 | 21 | * |
| 8 | - * @package Code_Snippets | |
| 9 | - * @author Shea Bunge <[email protected]> | |
| 10 | - * @copyright 2012-2021 Shea Bunge | |
| 11 | - * @license GPL-2.0-or-later https://spdx.org/licenses/GPL-2.0-or-later.html | |
| 12 | - * @version 3.0.0 | |
| 13 | - * @link https://github.com/sheabunge/code-snippets | |
| 22 | + * phpcs:disable Modernize.FunctionCalls.Dirname.FileConstant | |
| 14 | 23 | */ |
| 15 | 24 | |
| 16 | -/* | |
| 17 | -Plugin Name: Code Snippets | |
| 18 | -Plugin URI: https://codesnippets.pro | |
| 19 | -Description: An easy, clean and simple way to run code snippets on your site. No need to edit to your theme's functions.php file again! | |
| 20 | -Author: Code Snippets Pro | |
| 21 | -Author URI: https://codesnippets.pro | |
| 22 | -Version: 3.0.0 | |
| 23 | -License: GPL-2.0-or-later | |
| 24 | -License URI: license.txt | |
| 25 | -Text Domain: code-snippets | |
| 26 | -Domain Path: /languages | |
| 27 | -Requires PHP: 5.2 | |
| 28 | -Requires at least: 3.6 | |
| 29 | -*/ | |
| 30 | - | |
| 31 | -/* Exit if accessed directly */ | |
| 25 | +// Exit if accessed directly. | |
| 32 | 26 | if ( ! defined( 'ABSPATH' ) ) { |
| 33 | 27 | return; |
| 34 | 28 | } |
| 35 | 29 | |
| 36 | -/* If a version of code snippets has already been loaded, then deactivate this plugin. */ | |
| 37 | -if ( defined( 'CODE_SNIPPETS_FILE' ) ) { | |
| 38 | - require_once ABSPATH . 'wp-admin/includes/plugin.php'; | |
| 39 | - deactivate_plugins( array( 'code-snippets/code-snippets.php' ), true ); | |
| 30 | +// Halt loading here if the plugin is already loaded, or we're running an incompatible version of PHP. | |
| 31 | +if ( ! defined( 'CODE_SNIPPETS_FILE' ) && version_compare( phpversion(), '7.4', '>=' ) ) { | |
| 40 | 32 | |
| 41 | - if ( ! function_exists( 'code_snippets_deactivated_old_version_notice' ) ) { | |
| 42 | - /** | |
| 43 | - * Display a message informing the user that this plugin has been deactivated. | |
| 44 | - */ | |
| 45 | - function code_snippets_deactivated_old_version_notice() { | |
| 46 | - echo '<div class="error fade"><p>'; | |
| 47 | - esc_html_e( 'Another version of Code Snippets appears to be installed. Deactivating this version.', 'code-snippets' ); | |
| 48 | - echo '</p></div>'; | |
| 49 | - } | |
| 50 | - } | |
| 33 | + /** | |
| 34 | + * The current plugin version. | |
| 35 | + * | |
| 36 | + * Should be set to the same value as set above. | |
| 37 | + * | |
| 38 | + * @const string | |
| 39 | + */ | |
| 40 | + define( 'CODE_SNIPPETS_VERSION', '4.0.0-beta.2' ); | |
| 51 | 41 | |
| 52 | - add_action( 'admin_notices', 'code_snippets_deactivated_old_version_notice', 11 ); | |
| 53 | - return; | |
| 54 | -} | |
| 42 | + /** | |
| 43 | + * The full path to the main file of this plugin. | |
| 44 | + * | |
| 45 | + * This can later be passed to functions such as plugin_dir_path(), plugins_url() and plugin_basename() | |
| 46 | + * to retrieve information about plugin paths. | |
| 47 | + * | |
| 48 | + * @since 2.0.0 | |
| 49 | + * @const string | |
| 50 | + */ | |
| 51 | + define( 'CODE_SNIPPETS_FILE', __FILE__ ); | |
| 55 | 52 | |
| 56 | -/** | |
| 57 | - * The full path to the main file of this plugin | |
| 58 | - * | |
| 59 | - * This can later be passed to functions such as | |
| 60 | - * plugin_dir_path(), plugins_url() and plugin_basename() | |
| 61 | - * to retrieve information about plugin paths | |
| 62 | - * | |
| 63 | - * @since 2.0 | |
| 64 | - * @var string | |
| 65 | - */ | |
| 66 | -define( 'CODE_SNIPPETS_FILE', __FILE__ ); | |
| 67 | - | |
| 68 | -if ( version_compare( phpversion(), '5.6', '>=' ) ) { | |
| 69 | - require_once __DIR__ . '/php/load.php'; | |
| 70 | - | |
| 71 | - return; | |
| 72 | -} | |
| 73 | - | |
| 74 | -if ( ! function_exists( 'code_snippets_php_version_notice' ) ) { | |
| 75 | - | |
| 76 | 53 | /** |
| 77 | - * Display a warning message and deactivate the plugin if the user is using an incompatible version of PHP | |
| 54 | + * Used to determine which version of Code Snippets is running. | |
| 78 | 55 | * |
| 79 | 56 | * @since 3.0.0 |
| 57 | + * @const bool | |
| 80 | 58 | */ |
| 81 | - function code_snippets_php_version_notice() { | |
| 82 | - echo '<div class="error fade"><p>'; | |
| 83 | - echo '<p><strong>', esc_html__( 'Code Snippets requires PHP 5.6 or later.', 'code-snippets' ), '</strong><br>'; | |
| 59 | + define( 'CODE_SNIPPETS_PRO', false ); | |
| 84 | 60 | |
| 85 | - $update_url = function_exists( 'wp_get_default_update_php_url' ) ? | |
| 86 | - wp_get_default_update_php_url() : | |
| 87 | - 'https://wordpress.org/support/update-php/'; | |
| 88 | - | |
| 89 | - /* translators: %s: Update PHP URL */ | |
| 90 | - $text = __( 'Please <a href="%s">upgrade your server to the latest version of PHP</a> to continue using Code Snippets.', 'code-snippets' ); | |
| 91 | - | |
| 92 | - echo wp_kses( sprintf( $text, $update_url ), array( 'a' => array( 'href' => array() ) ) ); | |
| 93 | - echo '</p></div>'; | |
| 94 | - | |
| 95 | - deactivate_plugins( plugin_basename( __FILE__ ) ); | |
| 96 | - } | |
| 97 | - | |
| 98 | - add_action( 'admin_notices', 'code_snippets_php_version_notice' ); | |
| 61 | + require_once dirname( __FILE__ ) . '/php/Core/load.php'; | |
| 62 | +} else { | |
| 63 | + require_once dirname( __FILE__ ) . '/php/Core/deactivation-notice.php'; | |
| 99 | 64 | } |