PluginProbe
Code Snippets / 4.0.0-beta.2
Code Snippets v4.0.0-beta.2
4.0.0-beta.2 3.10.2 3.10.1 3.10.0 3.10.0-beta.2 3.10.0-beta.1 4.0.0-beta.1 3.9.6 trunk 2.10.0 2.10.1 2.12.0 2.12.1 2.13.0 2.13.1 2.13.2 2.13.3 2.14.0 2.14.1 2.14.2 2.14.3 2.14.4 2.14.5 2.14.6 3.0.0 All 65 releases
← All changes | code-snippets.php +50 -98 2.12.14.0.0-beta.2 View file →
@@ -1,112 +1,64 @@
1 1 <?php
2 -
3 2 /**
4 - * 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
5 14 *
6 - * If you're interested in helping to develop Code Snippets, or perhaps contribute
7 - * 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
8 21 *
9 - * @package Code_Snippets
10 - * @author Shea Bunge <[email protected]>
11 - * @copyright 2012-2018 Shea Bunge
12 - * @license MIT http://opensource.org/licenses/MIT
13 - * @version 2.12.0
14 - * @link https://github.com/sheabunge/code-snippets
22 + * phpcs:disable Modernize.FunctionCalls.Dirname.FileConstant
15 23 */
16 24
17 -/*
18 -Plugin Name: Code Snippets
19 -Plugin URI: https://github.com/sheabunge/code-snippets
20 -Description: An easy, clean and simple way to add code snippets to your site. No need to edit to your theme's functions.php file again!
21 -Author: Shea Bunge
22 -Author URI: https://bungeshea.com
23 -Version: 2.12.1
24 -License: MIT
25 -License URI: license.txt
26 -Text Domain: code-snippets
27 -Domain Path: /languages
28 -*/
29 -
30 -/* Exit if accessed directly */
25 +// Exit if accessed directly.
31 26 if ( ! defined( 'ABSPATH' ) ) {
32 - exit;
27 + return;
33 28 }
34 29
35 -/**
36 - * The version number for this release of the plugin.
37 - * This will later be used for upgrades and enqueuing files
38 - *
39 - * This should be set to the 'Plugin Version' value,
40 - * as defined above in the plugin header
41 - *
42 - * @since 2.0
43 - * @var string A PHP-standardized version number string
44 - */
45 -define( 'CODE_SNIPPETS_VERSION', '2.12.1' );
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', '>=' ) ) {
46 32
47 -/**
48 - * The full path to the main file of this plugin
49 - *
50 - * This can later be passed to functions such as
51 - * plugin_dir_path(), plugins_url() and plugin_basename()
52 - * to retrieve information about plugin paths
53 - *
54 - * @since 2.0
55 - * @var string
56 - */
57 -define( 'CODE_SNIPPETS_FILE', __FILE__ );
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' );
58 41
59 -/**
60 - * Enable autoloading of plugin classes
61 - * @param $class_name
62 - */
63 -function code_snippets_autoload( $class_name ) {
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__ );
64 52
65 - /* Only autoload classes from this plugin */
66 - if ( 'Code_Snippet' !== $class_name && 'Code_Snippets' !== substr( $class_name, 0, 13 ) ) {
67 - return;
68 - }
53 + /**
54 + * Used to determine which version of Code Snippets is running.
55 + *
56 + * @since 3.0.0
57 + * @const bool
58 + */
59 + define( 'CODE_SNIPPETS_PRO', false );
69 60
70 - /* Remove namespace from class name */
71 - $class_file = str_replace( 'Code_Snippets_', '', $class_name );
72 -
73 - if ( 'Code_Snippet' === $class_name ) {
74 - $class_file = 'Snippet';
75 - }
76 -
77 - /* Convert class name format to file name format */
78 - $class_file = strtolower( $class_file );
79 - $class_file = str_replace( '_', '-', $class_file );
80 -
81 - $class_path = dirname( __FILE__ ) . '/php/';
82 -
83 - if ( 'Menu' === substr( $class_name, -4, 4 ) ) {
84 - $class_path .= 'admin-menus/';
85 - }
86 -
87 - /* Load the class */
88 - require_once $class_path . "class-{$class_file}.php";
61 + require_once dirname( __FILE__ ) . '/php/Core/load.php';
62 +} else {
63 + require_once dirname( __FILE__ ) . '/php/Core/deactivation-notice.php';
89 64 }
90 -
91 -spl_autoload_register( 'code_snippets_autoload' );
92 -
93 -/**
94 - * Retrieve the instance of the main plugin class
95 - *
96 - * @since 2.6.0
97 - * @return Code_Snippets
98 - */
99 -function code_snippets() {
100 - static $plugin;
101 -
102 - if ( is_null( $plugin ) ) {
103 - $plugin = new Code_Snippets( CODE_SNIPPETS_VERSION, __FILE__ );
104 - }
105 -
106 - return $plugin;
107 -}
108 -
109 -code_snippets()->load_plugin();
110 -
111 -/* Execute the snippets once the plugins are loaded */
112 -add_action( 'plugins_loaded', 'execute_active_snippets', 1 );