Plugin Directory

Changeset 943206


Ignore:
Timestamp:
07/04/2014 05:40:35 AM (12 years ago)
Author:
ericboles
Message:

Updated to version 2

File:
1 edited

Legend:

Unmodified
Added
Removed
  • scribd-doc-embedder/trunk/scribd_doc.php

    r863633 r943206  
    55Plugin URI: http://ericbol.es/
    66Description: Uses the Scribd API to embed supported Scribd documents (e.g. PDF, MS Office, ePub, and many others) into a web page using
    7 the Scribd Docs Reader.
     7the Scribd Docs Reader. 
    88Author: Eric Boles
    99Author URI: http://www.ericbol.es/
    10 Version: 1.0
     10Version: 2.0
    1111License: GPLv2
    1212*/
     
    137137add_shortcode("scribd-url", "scribd_url");
    138138add_shortcode("scribd-doc", "scribd_doc");
     139
     140// Hooks your functions into the correct filters
     141function scribd_doc_add_mce_button() {
     142    // check user permissions
     143    if ( !current_user_can( 'edit_posts' ) && !current_user_can( 'edit_pages' ) ) {
     144        return;
     145    }
     146    // check if WYSIWYG is enabled
     147    if ( 'true' == get_user_option( 'rich_editing' ) ) {
     148        add_filter( 'mce_external_plugins', 'scribd_doc_tinymce' );
     149        add_filter( 'mce_buttons', 'scribd_doc_mce_button' );
     150    }
     151}
     152add_action('admin_head', 'scribd_doc_add_mce_button');
     153
     154// Declare script for new button
     155function scribd_doc_tinymce( $plugin_array ) {
     156$wp_version = get_bloginfo( 'version' );
     157    if ( version_compare( $wp_version, '3.9', '>=' ) ) {
     158    $plugin_array['scribd_doc_mce_button'] = plugins_url( '/js/scribd-doc-mce-button.js' , __FILE__ );
     159    return $plugin_array;
     160    }
     161}
     162
     163// Register new button in the editor
     164function scribd_doc_mce_button( $buttons ) {
     165    array_push( $buttons, 'scribd_doc_mce_button' );
     166    return $buttons;
     167}
     168
     169function scribd_doc_mce_css() {
     170    wp_enqueue_style('scribd-doc-sc', plugins_url('/css/scribd-doc-mce-style.css', __FILE__) );
     171}
     172add_action( 'admin_enqueue_scripts', 'scribd_doc_mce_css' );
     173
    139174?>
Note: See TracChangeset for help on using the changeset viewer.