-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathscripts-to-footer.php
87 lines (78 loc) · 2.54 KB
/
scripts-to-footer.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<?php
/**
* Main Plugin File
*
* Plugin Name: Scripts-To-Footer
* Plugin URI: http://wordpress.org/plugins/scripts-to-footerphp/
* Description: Move your scripts to the footer to help speed up perceived page load times and improve user experience.
* Version: 0.7.2
* Author: Joshua David Nelson
* Author URI: http://joshuadnelson.com
* License: GPL2
* GitHub Plugin URI: https://github.com/joshuadavidnelson/scripts-to-footer
* GitHub Branch: master
*
* @package Scripts_To_Footer
* @author Joshua David Nelson <[email protected]>
* @copyright Copyright (c) 2023, Joshua David Nelson
* @license http://www.opensource.org/licenses/gpl-license.php GPL-2.0+
* @link https://github.com/joshuadavidnelson/scripts-to-footer
*/
/**
* Prevent direct access to this file.
*/
if ( ! defined( 'ABSPATH' ) ) {
exit( 'You are not allowed to access this file directly.' );
}
// Plugin Directory.
if ( ! defined( 'STF_DIR' ) ) {
define( 'STF_DIR', __DIR__ );
}
// Plugin URL.
if ( ! defined( 'STF_URL' ) ) {
define( 'STF_URL', plugins_url( '/', __FILE__ ) );
}
// Custom Debug Constant, intended for developer use.
if ( ! defined( 'STF_DEBUG' ) ) {
define( 'STF_DEBUG', false );
}
// Constants.
define( 'STF_PLUGIN_NAME', 'scripts-to-footer' );
define( 'STF_VERSION', '0.7.2' );
/**
* The code that runs during plugin activation.
* This action is documented in includes/class-stf-activator.php
*/
function activate_scripts_to_footer() {
require_once plugin_dir_path( __FILE__ ) . 'includes/class-stf-activator.php';
STF_Activator::activate();
}
/**
* The code that runs during plugin deactivation.
* This action is documented in includes/class-stf-deactivator.php
*/
function deactivate_scripts_to_footer() {
require_once plugin_dir_path( __FILE__ ) . 'includes/class-stf-deactivator.php';
STF_Deactivator::deactivate();
}
register_activation_hook( __FILE__, 'activate_scripts_to_footer' );
register_deactivation_hook( __FILE__, 'deactivate_scripts_to_footer' );
/**
* The core plugin class that is used to define internationalization,
* admin-specific hooks, and public-facing site hooks.
*/
require plugin_dir_path( __FILE__ ) . 'includes/class-scripts-to-footer.php';
/**
* Begins execution of the plugin.
*
* Since everything within the plugin is registered via hooks,
* then kicking off the plugin from this point in the file does
* not affect the page life cycle.
*
* @since 0.7.0
*/
function run_scripts_to_footer() {
$plugin = new Scripts_To_Footer();
$plugin->run();
}
add_action( 'plugins_loaded', 'run_scripts_to_footer', 10, 0 );