Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate embed codes through DocumentCloud's oEmbed endpoint #21

Merged
merged 27 commits into from
Apr 29, 2015
Merged

Conversation

knowtheory
Copy link
Member

This is a proposal to replace Navis-DocumentCloud's existing embed code construction by deferring to DocumentCloud's oEmbed endpoint.

This release would include deploying a new plugin named Wordpress-DocumentCloud to supersede Navis-DocumentCloud.

reefdog added 15 commits April 16, 2015 18:45
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
* Fetch embed codes from the new oEmbed service instead of creating them manually (but leave existing functions in place until we're sure they can be discarded)
* Support both `maxwidth/maxheight` and `height/width` shortcode attrs, but only sends `max*` to the provider
* Nominally backwards-compatible with existing shortcodes and settings (should be tested)
* Piggy-backs on WordPress's internal oembed caching; to disable, change `add_shortcode('documentcloud', array(&$this, 'handle_dc_shortcode_with_caching'));` to `add_shortcode('documentcloud', array(&$this, 'handle_dc_shortcode'));`

Affects #16
Closes #14
* Create class constants for regularly-modifiable settings (mostly for testing)
* Consolidate cached and non-cached shortcode call and just toggle where it mattesr

Affects #16
I previously overcomplicated the height/width calculations out of deference to WordPress's internal height/width calculator. Realized the plugin already set its own defaults and thus I could simplify things by starting with that, and maintain better backwards-compatibility too.

* Remove complicated height/width calculations
* Make precedence order clear

Affects #16
And make it supreme above all other width declarations to be consistent with previous plugin behavior.

Affects #16
* Adjust `save()` as minimally as necessary to support new function names and the dual-`width/maxwidth` presence
* Add note re: need for new post_metadata key
* Add note re: functions we should be able to remove once tested

Affects #16
Was committed accidentally. Not ready to be the default within WP.

Affects #16
The readme.txt for WordPress looks ugly here at GitHub. Copy relevant info over.
WP likes upgrade notices. Here's an upgrade notice. Since you like upgrade notices.
Supports documents and known note variants.

Affects #16
Closes #4
Accidentally converted to HTTP
@reefdog
Copy link

reefdog commented Apr 28, 2015

Accepting this should close #4, #8, #14, and #16.

reefdog added 9 commits April 28, 2015 13:53
Per discussion and consensus among @eyeseast, @aschweigert, @knowtheory, @anthonydb and @reefdog.

Affects #14
`$SITEURL` seems to behave inconsistently, so just buffaloing a solution by checking for trailing slash and adding it if it doesn't exist.
When there's no shortcode or user-defined default, use the theme's defaults for embed sizes instead of defining our own final defaults.

Closes #19
Trying to balance user intent: now that we're responsive by default, it stands to reason that a user indicating a width directly on a shortcode actually wants that width, so we should disable responsiveness unless they have actually ALSO indicated they want responsiveness, in which case they are confused and we'll go with responsive.

Affects #14
This started life as a task to include note ID in the post metadata when it was keyed off a note, since the document slug is the same on notes and documents, and thus two resources from the same doc could cause a ID collision.

Then I realized that we already only save a single piece of metadata per post anyway (see how `update_post_meta()` is outside the `foreach()`?) and so this was unnecessary.

But I'd already done the work to abstract out `parse_dc_url()` and clean up some things, so.

Affects #22
See discussion on #20.

Closes #20.
@reefdog
Copy link

reefdog commented Apr 29, 2015

We're happy enough with this to go ahead and pull it into master so we can tag and submit to WordPress plugin directory today. There are still a few issues (like the preexisting #23) but we can fix those as point releases. Unless @eyeseast or @aschweigert want us to hold off for a bit longer, I'd like to merge this in later this afternoon.

reefdog added 3 commits April 29, 2015 14:05
Confirmed compatibility with 3.2 and 4.2.1.
Toolbar button has been broken for a while, since at least 3.9.1, because of an update to the version of TinyMCE included in WP. It needs some signifiant fixing, and could stand to have it fleshed out with additional attribute options anyway. Disabling until we have time for the full solution.

Affects #23
Docs and notes have the same document slug, which resulted in the same postmeta key. When you had a wide document followed by a normal note, this resulted in the postmeta not properly reporting a `wide_asset`. Append note ID to its meta key so it can be distinguished from docs.

Affects #22
reefdog added a commit that referenced this pull request Apr 29, 2015
Generate embed codes through DocumentCloud's oEmbed endpoint
@reefdog reefdog merged commit 46dc58c into master Apr 29, 2015
@reefdog reefdog deleted the oembed branch April 29, 2015 23:37
@eyeseast eyeseast mentioned this pull request Apr 30, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants