forked from UCF/UCF-Weather-Shortcode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ucf-weather.php
68 lines (57 loc) · 2.34 KB
/
ucf-weather.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
<?php
/*
Plugin Name: UCF Weather Shortcode
Description: Provides a shortcode for displaying the current weather using the UCF Weather service.
Version: 1.1.1
Author: UCF Web Communications
License: GPL3
*/
if ( ! defined( 'WPINC' ) ) {
die;
}
define( 'UCF_WEATHER__PLUGIN_FILE', __FILE__ );
define( 'UCF_WEATHER__PLUGIN_URL', plugins_url( basename( dirname( __FILE__ ) ) ) );
define( 'UCF_WEATHER__PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
define( 'UCF_WEATHER__STATIC_URL', UCF_WEATHER__PLUGIN_URL . '/static' );
define( 'UCF_WEATHER__STATIC_DIR', UCF_WEATHER__PLUGIN_DIR . 'static/' );
define( 'UCF_WEATHER__STYLES_URL', UCF_WEATHER__STATIC_URL . '/css' );
define( 'UCF_WEATHER__SCRIPT_URL', UCF_WEATHER__STATIC_URL . '/js' );
define( 'UCF_WEATHER__IMAGES_DIR', UCF_WEATHER__STATIC_DIR . 'img/' );
include_once UCF_WEATHER__PLUGIN_DIR . 'includes/ucf-weather-config.php';
include_once UCF_WEATHER__PLUGIN_DIR . 'includes/ucf-weather-feed.php';
include_once UCF_WEATHER__PLUGIN_DIR . 'includes/ucf-weather-shortcode.php';
include_once UCF_WEATHER__PLUGIN_DIR . 'includes/ucf-weather-common.php';
include_once UCF_WEATHER__PLUGIN_DIR . 'admin/ucf-weather-admin.php';
if ( ! function_exists( 'ucf_weather_activate' ) ) {
function ucf_weather_activate() {
UCF_Weather_Config::add_options();
}
register_activation_hook( UCF_WEATHER__PLUGIN_FILE, 'ucf_weather_activate' );
}
if ( ! function_exists( 'ucf_weather_deactivate' ) ) {
function ucf_weather_deactivate() {
UCF_Weather_Config::delete_options();
}
register_deactivation_hook( UCF_WEATHER__PLUGIN_FILE, 'ucf_weather_deactivate' );
}
if ( ! function_exists( 'ucf_weather_init' ) ) {
/**
* Called when all plugins are loaded.
* Add all actions and hooks here.
*
* @author Jim Barnes
* @since 1.0.0
**/
function ucf_weather_init() {
// Settings
add_action( 'admin_init', array( 'UCF_Weather_Config', 'settings_init' ) );
add_action( 'admin_menu', array( 'UCF_Weather_Config', 'add_options_page' ) );
add_action( 'admin_enqueue_scripts', array( 'UCF_Weather_Admin', 'enqueue_admin_assets' ), 10, 1 );
// Register the shortcode
add_action( 'init', array( 'UCF_Weather_Shortcode', 'register_shortcode' ) );
// Add frontend assets
add_action( 'wp_enqueue_scripts', array( 'UCF_Weather_Config', 'enqueue_frontend_assets' ), 10, 0 );
}
add_action( 'plugins_loaded', 'ucf_weather_init' );
}
?>