Google Docs Embed Shortcode

  • Author
    Posts
  • #564647

    raphil
    Member

    How about a shortcode to easily embed Google Docs. Perhaps something like this:

    [gdoc 0B5jR2HibJE1COTI0ODliM2MtOTFkZC00YjVhLWI0ZmItOWQxMjQ0NzM1Y2M5]

    #564854

    timethief
    Member

    Hello there,
    If you wish you can send you suggestion directly to Staff. http://en.support.wordpress.com/contact/

    #565058

    ryanhellyer
    Member

    This is an excellent idea. I hadn’t realised it was possible to embed Google Docs until now, but it seems you can “publish as a web page” which provides you with a URL which looks like this:
    https://spreadsheets.google.com/pub?key=0AlefNJpykm2scFp4VUZFbnMxNWNlMnRyb3hvVmwtWEE&hl=en&output=html

    Unfortunately it doesn’t provide an embed code to use which is kinda annoying, but the posts could either be parsed to look for a URL string like that and automatically turn it into a shortcode, or the end-users could be made to make the shortcode themselves. I’d be more inclined to go for the latter.

    If I find some spare time this evening I might make whip together some code to do this as it seems like a really great idea.

    #565059

    ryanhellyer
    Member

    Actually, it seems that word processor documents DO provide an embed code. The spreadsheets however do not.

    #565060

    ryanhellyer
    Member

    Here’s a new plugin which adds support for this feature:
    http://pixopoint.com/products/google-docs/

    The first 40 characters of the URL string in the embed code is checked against a white list of known Google Docs to ensure that only specific Google Docs sub-domains are being used and then parses the URL through esc_url() to strip out any other potential nasties.

    Feel free to use the code, just let me know if you do make use of it and if you make any changes/improvements I’d love to hear about those too :) … http://pixopoint.com/contact/

    In particular, this plugin needs that autoembed functionality so that users can just dump the embed codes (for the Google Docs that support it) rather than having to figure out the shortcode syntax.

    I may have missed some strings for the white list. I didn’t look very hard for various combinations, I just opened up a bunch of docs and grabbed what I saw. It’s highly likely I’ve missed a couple.

    #565061

    auxclass
    Member

    @ryanhellyer

    Plug-in’s are not allowed on WordPress.COM so your Post is very misleading to users here.

    Your Plug-in flat will not work and can not be installed here.

    #565062

    ryanhellyer
    Member

    It is not misleading in the slightest. My plugin would work. Whether I can install it here myself or not is irrelevant.

    This is the ideas forum, hence I’m posting it here as an idea for WordPress.com to implement.

    #565063

    ryanhellyer
    Member

    Sorry if that came across a little blunt. It’s 3am and I’m too sleepy to find an edit button.

    I’m aware of where I’m posting this. But since it’s in the ideas forum and I was already writing the code anyway, it seemed like the most sensible place to post it.

    #565064

    justjennifer
    Moderator
    #565066

    1tess
    Moderator Emeritus

    @ryanhellyer,

    To be very clear:
    Plug-ins are not allowed here on wordpress.COM. We volunteers in the forums have no authority to change that.

    So as not to confuse wordpress.COM users, please follow the link timethief and justjennifer provided: http://en.support.wordpress.com/contact/

    Because further discussion would not be useful, I’ll close this thread.

    Tess

The topic ‘Google Docs Embed Shortcode’ is closed to new replies.