-
Notifications
You must be signed in to change notification settings - Fork 0
/
dataquest-wordpress.php
47 lines (40 loc) · 1.43 KB
/
dataquest-wordpress.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
<?php
/**
* @package DataquestCaravan
* @version 1.0
*/
/*
Plugin Name: Dataquest Caravan
Description: Enables embedding the Dataquest code running interface and answer checking into a blog post.
Version: 1.0
Author URI: https://dataquest.io/
Author: Dataquest
GitHub: https://github.com/dataquestio/caravan_wordpress
*/
// Code written by Curtis M. Humphrey, Ph.D.
if (!defined('ABSPATH')) exit;
class DataquestCaravan {
public static function load_scripts() {
wp_enqueue_script("dataquest-postbox", '//dqeditor.dataquest.io/dq_post_box.js');
wp_enqueue_script("dataquest-helper", plugins_url('/dq_helper.js' , __FILE__ ), array('jquery'));
}
public static function show_media_button() {
echo '<a href="" class="button" ' .
'id="insert-dataquest-exercise-button" ' .
'title="' . __("Insert Dataquest Caravan Exercise Template", 'add_dataquest_exercise') .
'">' .
'Add Caravan Template' .
'</a>';
}
public static function include_media_button() {
wp_enqueue_script('dataquest_media_button', plugins_url('/media_button_insert.js', __FILE__), array('jquery'));
}
public static function run() {
add_action('media_buttons', array(__CLASS__, 'show_media_button'));
add_action('wp_enqueue_media', array(__CLASS__, 'include_media_button'));
add_action("wp_enqueue_scripts", array(__CLASS__, "load_scripts"));
}
}
// Run plugin
DataquestCaravan::run();
?>