Skip to content

Commit 0a380d3

Browse files
committed
Add our oEmbed service for raw URLs
Very simplistic implementation: recognizes raw URLs as supported oEmbeddable objects. Doesn't allow any parameter setting. Also tweaked README a little. Affects #16 Closes #8
1 parent b29eb6b commit 0a380d3

File tree

2 files changed

+25
-7
lines changed

2 files changed

+25
-7
lines changed

documentcloud.php

+23-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Plugin Name: DocumentCloud
44
* Plugin URI: https://www.documentcloud.org/
55
* Description: Embed DocumentCloud resources in WordPress content.
6-
* Version: 0.1.1
6+
* Version: 0.1.2
77
* Authors: Chris Amico, Justin Reese
88
* License: GPLv2
99
***/
@@ -29,17 +29,36 @@ class WP_DocumentCloud {
2929

3030
function __construct() {
3131

32+
// Register us as an oEmbed provider
33+
add_action('init', array(&$this, 'register_dc_oembed_provider'));
34+
// Register [documentcloud] shortcode using old embed method
3235
add_shortcode('documentcloud', array(&$this, 'embed_shortcode'));
3336

37+
// Setup TinyMCE shortcode-generation plugin
3438
add_action('init', array(&$this, 'register_tinymce_filters'));
35-
39+
40+
// Process shortcodes and add admin settings
3641
add_action('save_post', array(&$this, 'save'));
37-
3842
add_action('admin_menu', array(&$this, 'add_options_page'));
39-
4043
add_action('admin_init', array(&$this, 'settings_init'));
4144
}
4245

46+
function register_dc_oembed_provider() {
47+
/*
48+
Hello developer. If you wish to test this plugin against your
49+
local installation of DocumentCloud (with its own testing
50+
domain), uncomment-out the next three lines and replace
51+
`[your_domain]` with, uh, your domain. You'll also want to keep
52+
the provider HTTP unless cURL can happily access your domain via
53+
HTTPS. Please remember not to commit these back to the repo.
54+
*/
55+
// add_filter( 'http_request_host_is_external', '__return_true' );
56+
// wp_oembed_add_provider('http://[your_domain]/documents/*','http://[your_domain]/api/oembed.{format}');
57+
// wp_oembed_add_provider('https://[your_domain]/documents/*','http://[your_domain]/api/oembed.{format}');
58+
59+
wp_oembed_add_provider('https://www.documentcloud.org/documents/*', 'https://www.documentcloud.org/api/oembed.{format}');
60+
}
61+
4362
function register_tinymce_filters() {
4463
add_filter('mce_external_plugins',
4564
array(&$this, 'add_tinymce_plugin')

readme.txt

+2-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Embed DocumentCloud resources in WordPress content.
99

1010
== Description ==
1111

12-
[DocumentCloud](https://www.documentcloud.org/) is a free service allowing journalists to analyze, annotate and publish documents, funded by the Knight Foundation. Initial development of this plugin supported by [NPR](http://www.npr.org) as part of [StateImpact](http://stateimpact.npr.org) project.
12+
[DocumentCloud](https://www.documentcloud.org/) is a service that allows journalists to analyze, annotate and publish documents, hosted by Investigative Reporters & Editors. Initial development of this plugin supported by [NPR](http://www.npr.org) as part of [StateImpact](http://stateimpact.npr.org) project.
1313

1414
DocumentCloud's normal embed code looks like this:
1515

@@ -43,5 +43,4 @@ This will use default height and width settings, which you can update in the Wor
4343

4444
1. Upload the documentcloud directory to `wp-content/plugins/documentcloud`
4545
2. Activate the plugin
46-
3. In your posts, add documents using the DocumentCloud button, or the `[documentcloud]` shortcode.
47-
46+
3. In your posts, add documents using the DocumentCloud button or the `[documentcloud]` shortcode

0 commit comments

Comments
 (0)