Plugin Directory

Changeset 648458


Ignore:
Timestamp:
01/05/2013 09:46:57 PM (13 years ago)
Author:
gliffy
Message:

v 0.4 release
Bug fixes
New user management

Location:
gliffy-plugin-for-wordpress
Files:
132 added
2 edited

Legend:

Unmodified
Added
Removed
  • gliffy-plugin-for-wordpress/trunk/gliffy-plugin-for-wordpress.php

    r502800 r648458  
    44Plugin URI: http://wordpress.org/extend/plugins/gliffy-plugin-for-wordpress/
    55Description: Create diagrams and insert them into your posts or pages!  Look for the "Diagrams" menu when you activate the plugin, and use the Gliffy button on the media bar to insert diagrams. Once activated, make sure to <a href="options-general.php?page=gliffy-config">configure</a> the plugin in the settings menu.
    6 Version: 0.3.4
     6Version: 0.4
    77Author: Gliffy, Inc.
    88Author URI: http://www.gliffy.com/
     
    229229
    230230// resize javascript
    231 add_action('wp_head', 'gliffy_resize_javascript' );
     231add_action('wp_enqueue_scripts', 'gliffy_resize_javascript' );
    232232
    233233/**
     
    263263    global $_GLIFFY_oauth_consumer_key;
    264264    global $_GLIFFY_oauth_consumer_secret;
     265    $username = get_option('gliffy_username');
    265266       
    266267    if (empty($_GLIFFY_root) ||
    267268            empty($_GLIFFY_accountID) ||
    268269            empty($_GLIFFY_oauth_consumer_key) ||
    269             empty($_GLIFFY_oauth_consumer_secret) ) {
     270            empty($_GLIFFY_oauth_consumer_secret) ||
     271            empty($username)) {
    270272        return false;
    271273    }
     
    278280        error_log("**** Someone up the chain returned an error or is bypassing login, don't process and return");
    279281        return $user;
     282    }
     283    $username = get_option('gliffy_username');
     284
     285    if (empty($username)) {
     286        $username = get_bloginfo('admin_email');
     287        update_option('gliffy_username', $username);
    280288    }
    281289
     
    413421
    414422function gliffy_register_settings() {
     423    register_setting( 'gliffy-option-group', 'gliffy_username' );
    415424    register_setting( 'gliffy-option-group', 'gliffy_account_id' );
    416425    register_setting( 'gliffy-option-group', 'gliffy_oauth_consumer_key' );
     
    456465 
    457466            $macropara = str_replace($macro_begin, '', $macro);
    458         $macropara = str_replace($macro_end, '', $macropara );
     467            $macropara = str_replace($macro_end, '', $macropara );
    459468
    460469            $params = explode(',', $macropara );
     
    483492    $mapurl = $gliffy_root."/gliffy/diagramEmbed.jsp?did=".$diagram_id;
    484493    $path_to_image = "http://www.gliffy.com/gliffy/api/clientdiagramjpeg?did={$diagram_id}&pk=pub&size=L";
    485    
    486     if ($diagram_size == "i")
    487         list($width, $height, $type, $attr) = getimagesize($path_to_image);
     494
     495    try {
     496        if ($diagram_size == "i")
     497            list($width, $height, $type, $attr) = getimagesize($path_to_image);
     498        else {
     499            // diagram is set as image - no map is used
     500            $width = '';
     501            $height = '';
     502        }
     503    } catch (Exception $e) {
     504        // allow_url_fopen is likely set to Off, cannot find image size
     505        $width = '';
     506        $height = '';
     507    }
     508
    488509     
    489     if (($width != '') && ($height != '')) {
     510    if (($width != '') && ($height != '') && ($diagram_size == "i")) {
    490511        $img = "<img class=\"gliffyimg\" usemap=\"#GLIFFY_MAP_{$diagram_id}\" border=\"0\" src=\"{$path_to_image}\"";
    491512        $map = file_get_contents($mapurl);
     
    497518            $img .= " orgwidth=\"{$width}\" orgheight=\"{$height}\" ";
    498519        }
     520
    499521        $img .= " onLoad=\"resizeMap(this)\" >".$map;
    500522
     523    } elseif ($diagram_size == "i") {
     524        $img = "<a href='$gliffy_root/pubdoc/$diagram_id/L.jpg' ><img src='$gliffy_root/pubdoc/$diagram_id/".
     525            "L.jpg' alt='[cannot update linkmap]'/></a>";
    501526    } else {
    502527        $img = "<a href='$gliffy_root/pubdoc/$diagram_id/L.jpg' ><img src='$gliffy_root/pubdoc/$diagram_id/".
    503             strtoupper($diagram_size).".jpg' alt='[Gliffy Diagram is Private]'/></a>";
     528            $diagram_size.".jpg' alt=''/></a>";
    504529    }
    505530    return $img;
     
    541566
    542567function gliffy_resize_javascript() {
    543     $siteurl = get_option('siteurl');
    544     echo "<script src=\"{$siteurl}/wp-content/plugins/".basename(dirname(__FILE__))."/map_resize.js\"></script>";
     568    wp_deregister_script( 'jquery' );
     569    wp_register_script( 'jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js');
     570    wp_enqueue_script( 'jquery' );
     571
     572    wp_enqueue_script( 'ava-test-js', plugins_url( '/map_resize.js', __FILE__ ));
    545573}
    546574
  • gliffy-plugin-for-wordpress/trunk/gliffy-wp-options.php

    r500015 r648458  
    2121        $gliffy_root = "http://www.gliffy.com";
    2222    }
     23
     24    $gliffy_username = get_option('gliffy_username');
     25    if (empty($gliffy_username)) {
     26        $gliffy_username = get_bloginfo('admin_email');
     27    }
    2328?>
    2429
     
    2631
    2732<table class="form-table">
     33    <tr valign="top">
     34        <th scope="row">Gliffy Username (email)</th>
     35        <td><input type="text" size="35" name="gliffy_username" value="<?php echo $gliffy_username; ?>" /></td>
     36    </tr>
     37
    2838    <tr valign="top">
    2939        <th scope="row">Account Id</th>
Note: See TracChangeset for help on using the changeset viewer.