-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprofiles.php
More file actions
65 lines (57 loc) · 2.01 KB
/
profiles.php
File metadata and controls
65 lines (57 loc) · 2.01 KB
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
<?php
/**
* The plugin bootstrap file
*
* This file is read by WordPress to generate the plugin information in the plugin
* admin area. This file also includes all of the dependencies used by the plugin,
* registers the activation and deactivation functions, and defines a function
* that starts the plugin.
*
* @link https://research.utdallas.edu/
* @since 1.0.0
* @package Research_profiles
*
* @wordpress-plugin
* Plugin Name: UT Dallas Research Profiles
* Plugin URI: https://github.com/utdal/profiles-wordpress-plugin
* Description: Adds research profiles shortcode.
* Version: 1.4.1
* Author: UT Dallas Research Information Systems
* Author URI: https://research.utdallas.edu/
* License: MIT
* License URI: http://opensource.org/licenses/MIT
* Text Domain: profiles
* Domain Path: /languages
*/
define('Profiles\VERSION', '1.4.1');
// If this file is called directly, abort.
if (!defined('WPINC')) {
die;
}
// Autoload classes
spl_autoload_register(function ($class_name) {
$prefix = 'Profiles\\';
$prefix_length = strlen($prefix);
if (strncmp($prefix, $class_name, $prefix_length) !== 0) { // Only autoload ReMods classes
return;
}
$relative_class = substr($class_name, $prefix_length);
$filename = plugin_dir_path(__FILE__) . str_replace('\\', '/', $relative_class) . '.php';
if (file_exists($filename)) {
include_once $filename;
}
});
/**
* Load scripts for the plugin
*/
function profiles_enqueue_scripts()
{
$public_url = plugin_dir_url(__FILE__) . 'public';
// CSS
wp_enqueue_style('profiles_css', $public_url . '/css/profiles.css', [], Profiles\VERSION);
// JS
wp_enqueue_script('profiles_js', $public_url . '/js/profile.js', ['jquery'], Profiles\VERSION);
}
// Define WordPress hooks
add_action('wp_enqueue_scripts', 'profiles_enqueue_scripts');
add_action('init', [(new Profiles\Shortcodes\Profile(Profiles\VERSION)), 'register']);