Plugin Directory

Changeset 808889


Ignore:
Timestamp:
11/22/2013 02:37:42 PM (12 years ago)
Author:
vicchi
Message:

Committing v1.3.1 changes

Location:
wp-quadratum/trunk
Files:
126 added
1 deleted
10 edited

Legend:

Unmodified
Added
Removed
  • wp-quadratum/trunk/css/wp-quadratum-admin.css

    r531408 r808889  
    5151    background: #FCB2B5 url(../images/error.png) no-repeat 5px center;
    5252}
     53
     54#wp-quadratum-client-id, #wp-quadratum-client-secret,
     55#wp-quadratum-factual-oauth-key, #wp-quadratum-factual-oauth-secret {
     56    width: 450px;
     57}
  • wp-quadratum/trunk/css/wp-quadratum-admin.min.css

    r580206 r808889  
    1 @charset "utf-8";.wp-quadratum-postbox-settings{width:60%;padding:0 0 0 0}.wp-quadratum-postbox-sidebar{width:30%;padding:0 0 0 10px}.wp-quadratum-postbox-sidebar ul{list-style:square;padding:0 0 0 1em}.wp-quadratum-success{border:1px solid #8ACEFF;padding:3px 15px 4px 27px;display:block;margin-bottom:5px;font-size:11px;line-height:15px;-moz-border-radius:3px;-webkit-border-radius:3px;background:#E2F5FE url(../images/success.png) no-repeat 5px center}.wp-quadratum-warning{border:1px solid #F8C44F;padding:3px 15px 4px 27px;display:block;margin-bottom:5px;font-size:11px;line-height:15px;-moz-border-radius:3px;-webkit-border-radius:3px;background:#FEE8B9 url(../images/warning.png) no-repeat 5px center}.wp-quadratum-error{border:1px solid #F96764;padding:3px 15px 4px 27px;display:block;margin-bottom:5px;font-size:11px;line-height:15px;-moz-border-radius:3px;-webkit-border-radius:3px;background:#FCB2B5 url(../images/error.png) no-repeat 5px center}
     1@charset "utf-8";.wp-quadratum-postbox-settings{width:60%;padding:0 0 0 0}.wp-quadratum-postbox-sidebar{width:30%;padding:0 0 0 10px}.wp-quadratum-postbox-sidebar ul{list-style:square;padding:0 0 0 1em}.wp-quadratum-success{border:1px solid #8ACEFF;padding:3px 15px 4px 27px;display:block;margin-bottom:5px;font-size:11px;line-height:15px;-moz-border-radius:3px;-webkit-border-radius:3px;background:#E2F5FE url(../images/success.png) no-repeat 5px center}.wp-quadratum-warning{border:1px solid #F8C44F;padding:3px 15px 4px 27px;display:block;margin-bottom:5px;font-size:11px;line-height:15px;-moz-border-radius:3px;-webkit-border-radius:3px;background:#FEE8B9 url(../images/warning.png) no-repeat 5px center}.wp-quadratum-error{border:1px solid #F96764;padding:3px 15px 4px 27px;display:block;margin-bottom:5px;font-size:11px;line-height:15px;-moz-border-radius:3px;-webkit-border-radius:3px;background:#FCB2B5 url(../images/error.png) no-repeat 5px center}#wp-quadratum-client-id,#wp-quadratum-client-secret,#wp-quadratum-factual-oauth-key,#wp-quadratum-factual-oauth-secret{width:450px}
  • wp-quadratum/trunk/includes/class-wp-quadratum-admin.php

    r761076 r808889  
    2222            'foursquare' => "Foursquare",
    2323            'maps' => "Maps",
     24            'shortcodes' => __('Shortcodes'),
    2425            'defaults' => "Defaults",
    2526            'colophon' => "Colophon"
     
    161162        $upgrade_settings = false;
    162163        $current_plugin_version = NULL;
    163 
    164164        $options = WP_Quadratum::get_option ();
     165
    165166        if (is_array ($options) &&
    166167                !empty ($options['version']) &&
     
    277278                    $this->admin_upgrade_option($options, 'openmq_key', '');
    278279                    $this->admin_upgrade_option($options, 'microsoft7_key', '');
    279                
     280
     281                case '131':
     282                    $this->admin_upgrade_option($options, 'enable_map_sc', 'on');
     283                    $this->admin_upgrade_option($options, 'enable_locality_sc', '');
     284                    $this->admin_upgrade_option($options, 'factual_oauth_key', '');
     285                    $this->admin_upgrade_option($options, 'factual_oauth_secret', '');
     286                   
     287                    $cache = array();
     288                    $cache['timestamp'] = time();
     289                    $cache['checkin'] = null;
     290                    $cache['locality'] = null;
     291                    update_option(WP_Quadratum::CACHE, $cache);
     292
    280293                    $options['version'] = WP_Quadratum::VERSION;
    281294                    $upgrade_settings = true;
     
    307320        $foursquare_settings = array ();
    308321        $foursquare_title = __('Foursquare OAuth Settings');
     322        $factual_title = __('Factual OAuth Settings');
    309323        $nokia_settings = array ();
    310324        $nokia_title = __('Nokia Location API Settings');
     
    317331        $openmq_settings = array ();
    318332        $bingv7_settings = array();
    319        
     333
     334        $shortcodes_settings = array();
     335
    320336        $tab = $this->admin_validate_tab ();
    321337        //$providers = $this->mxn->get_supported_providers ();
     
    391407                break;
    392408               
     409            case 'shortcodes':
     410                /****************************************************************************
     411                 * Shortcodes tab content
     412                 */
     413           
     414                $shortcodes_settings[] = '<p><em>' . __('This tab allows you to control whether the plugin\'s shortcodes are acted on in post or page content.', 'wp-quadratum') . '</em></p>';
     415                $shortcodes_settings[] = '<p><strong>' . __('Enable Map Shortcode Usage', 'wp-quadratum') . '</strong><br/>
     416                    <input type="checkbox" name="wp_quadratum_enable_map_sc" id="wp-quadratum-enable-map-sc" '
     417                    .checked ($options['enable_map_sc'], 'on', false)
     418                    . '/>
     419                    <small>' . __('Enable use of the <code>[wp_quadratum]</code> and <code>[wpq_map]</code> shortcodes</em>', 'wp-quadratum') . '</small></p>';
     420                $shortcodes_settings[] = '<p><strong>' . __('Enable Locality Shortcode Usage', 'wp-quadratum') . '</strong><br/>
     421                    <input type="checkbox" name="wp_quadratum_enable_locality_sc" id="wp-quadratum-enable-locality-sc" '
     422                    .checked ($options['enable_locality_sc'], 'on', false)
     423                    . '/>
     424                    <small>' . __('Enable use of the <code>[wp_quadratum_locality]</code> and <code>[wpq_locality]</code> shortcodes</em>', 'wp-quadratum') . '</small></p>';
     425
     426                if (!empty($options['factual_oauth_key']) && !empty($options['factual_oauth_secret'])) {
     427                    $factual_title .= ' (' . __('Successfully Authenticated', 'wp-quadratum') . ')';
     428                }
     429                else {
     430                    $factual_title .= ' (' . __('Not Authenticated', 'wp-quadratum') . ')';
     431                }
     432
     433                $have_factual_key = !empty($options['factual_oauth_key']);
     434                $have_factual_secret = !empty($options['factual_oauth_secret']);
     435
     436                $factual_settings[] = '<p><em>' . __('You\'ve enabled support for the Locality Shortcode. This allows you to embed the postal code, address, region, locality or geographic coordinates of your last Foursquare checkin in a page or post. Unfortunately not all Foursquare Venues contain this information. WP Quadratum can obtain this missing information for you by using a service called a <a href="http://en.wikipedia.org/wiki/Reverse_geocoding" target="_blank">reverse geocoder</a> from Factual. To do this, you\'ll need to sign up for a <a href="https://www.factual.com/api-keys/request" target="_blank">Factual API Key</a> and enter the OAuth key and secret below.', 'wp-quadratum') . '</em></p>';
     437
     438                $factual_settings[] = '<p><strong>' . __('Factual OAuth Key') . '</strong><br />
     439                    <input type="text" name="wp_quadratum_factual_oauth_key" id="wp-quadratum-factual-oauth-key" value="' . $options['factual_oauth_key'] . '" /><br />
     440                    <small>Your Factual API OAuth key</small></p>';
     441
     442                $factual_settings[] = '<p><strong>' . __('Factual OAuth Secret') . '</strong><br />
     443                    <input type="text" name="wp_quadratum_factual_oauth_secret" id="wp-quadratum-factual-oauth-secret" value="' . $options['factual_oauth_secret'] . '" /><br />
     444                    <small>Your Factual API OAuth secret</small></p>';
     445
     446                if ($have_factual_key && $have_factual_secret) {
     447                    $factual_settings[] = '<div class="wp-quadratum-success">'
     448                        . __('You are currently successfully authenticated with the Factual API.')
     449                        . '</div>';
     450                }
     451               
     452                else {
     453                    $factual_settings[] = '<div class="wp-quadratum-warning">'
     454                        . __('You are not currently authenticated with the Factual API; the Locality Shortcode will be disabled.')
     455                        . '</div>';
     456                }
     457               
     458                break;
     459
    393460            case 'defaults':
    394461                /****************************************************************************
     
    429496                 */
    430497
    431                 if (empty ($options['oauth_token'])) {
     498               
     499                $have_oauth_token = (isset($options['oauth_token']) && !empty($options['oauth_token']));
     500                $have_client_id = (isset($options['client_id']) && !empty($options['client_id']));
     501                $have_client_secret = (isset($options['client_secret']) && !empty($options['client_secret']));
     502
     503                if ($have_oauth_token) {
     504                    $foursquare_title .= __(' (Successfully Authenticated)');
     505                }
     506
     507                else {
    432508                    $foursquare_title .= __(' (Not Authenticated)');
    433509                }
    434510
    435                 else {
    436                     $foursquare_title .= __(' (Successfully Authenticated)');
    437                 }
    438 
    439511                $foursquare_settings[] = '<p><em>' . __('This tab allows you to authenticate with Foursquare to allow WP Quadratum to display your checkins.', 'wp-quadratum') . '</em></p>';
    440 
    441                 if (empty ($options['oauth_token'])) {
     512                $foursquare_settings[] = '<div>';
     513
     514                $disabled = '';
     515                if (!$have_client_id && !$have_client_secret) {
    442516                    $foursquare_settings[] = '<div class="wp-quadratum-error">'
    443517                        . __('You are not currently authenticated with the Foursquare API.')
    444518                        . '</div>';
    445519
    446                     $foursquare_settings[] = '<div><p>'
     520                    $foursquare_settings[] = '<p>'
    447521                        . __('To display your Foursquare checkins, WP Quadratum needs to be authorised to access your Foursquare account information; this is a simple, safe and secure 3 step process. WP Quadratum never sees your account login information and cannot store any personally identifiable information.')
    448522                        . '</p>'
     
    466540                        . __('Step 2. Copy and paste the supplied Client id and Client secret below and click on the "Save Foursquare Settings" button')
    467541                        . '</strong></p>';
    468 
    469                     $foursquare_settings[] = '<p><strong>' . __('Foursquare Client ID') . '</strong><br />
    470                         <input type="text" name="wp_quadratum_client_id" id="wp-quadratum-client-id" value="' . $options['client_id'] . '" /><br />
    471                         <small>Your Foursquare API Client ID</small></p>';
    472 
    473                     $foursquare_settings[] = '<p><strong>' . __('Foursquare Client Secret') . '</strong><br />
    474                         <input type="text" name="wp_quadratum_client_secret" id="wp-quadratum-client-secret" value="' . $options['client_secret'] . '" /><br />
    475                         <small>Your Foursquare API Client Secret</small></p>';
    476 
    477                     if (!empty ($options['client_id'])) {
    478                         $foursquare_settings[] = '<p><strong>'
    479                         . __('Step 3. You should now be authorised and ready to go; click on the <em>Connect to Foursquare</em> button below.')
    480                         . '</strong></p>';
    481 
    482                         $client_id = $options['client_id'];
    483                         $client_secret = $options['client_secret'];
    484                         $redirect_url = WP_Quadratum::make_redirect_url ();
    485                         $fh = new FoursquareHelper_v1_0 ($client_id, $client_secret, $redirect_url);
    486                         $foursquare_settings[] = '<p class="submit">'
    487                             . '<a href="' . $fh->authentication_link () . '" class="button-primary">'
    488                             . __('Connect to Foursquare') . '</a>'
    489                             . '</p>';
    490                     }
    491 
    492                     $foursquare_settings[] = '</div>';
    493542                }
    494543
    495544                else {
     545                    $disabled = ' disabled="disabled"';
     546                }
     547
     548
     549                $foursquare_settings[] = '<p><strong>' . __('Foursquare Client ID') . '</strong><br />
     550                    <input type="text" name="wp_quadratum_client_id" id="wp-quadratum-client-id" value="' . $options['client_id'] . '"' . $disabled . ' /><br />
     551                    <small>Your Foursquare API Client ID</small></p>';
     552
     553                $foursquare_settings[] = '<p><strong>' . __('Foursquare Client Secret') . '</strong><br />
     554                    <input type="text" name="wp_quadratum_client_secret" id="wp-quadratum-client-secret" value="' . $options['client_secret'] . '"' . $disabled . ' /><br />
     555                    <small>Your Foursquare API Client Secret</small></p>';
     556
     557                if ($have_client_id && $have_client_secret && !$have_oauth_token) {
     558                    $foursquare_settings[] = '<p><strong>'
     559                    . __('Step 3. You should now be authorised and ready to go; click on the <em>Connect to Foursquare</em> button below.')
     560                    . '</strong></p>';
     561
     562                    $client_id = $options['client_id'];
     563                    $client_secret = $options['client_secret'];
     564                    $redirect_url = WP_Quadratum::make_redirect_url ();
     565                    $fh = new FoursquareHelper_v1_0 ($client_id, $client_secret, $redirect_url);
     566                    $foursquare_settings[] = '<p class="submit">'
     567                        . '<a href="' . $fh->authentication_link () . '" class="button-primary">'
     568                        . __('Connect to Foursquare') . '</a>'
     569                        . '</p>';
     570                }
     571
     572                else if ($have_oauth_token) {
    496573                    $foursquare_settings[] = '<div class="wp-quadratum-success">'
    497574                        . __('You are currently successfully authenticated with the Foursquare API.')
    498575                        . '</div>';
    499576                }
     577
     578                $foursquare_settings[] = '</div>';
    500579                break;
    501580
     
    528607                    $wrapped_content[] = $this->admin_postbox ($id, $title, implode ('', $$block), $hidden);
    529608                }   // end-foreach
     609                break;
     610               
     611            case 'shortcodes':
     612                $wrapped_content[] = $this->admin_postbox('wp-quadratum-shortcodes-settings',
     613                    'Shortcodes', implode('', $shortcodes_settings));
     614
     615                $hidden = ($options['enable_locality_sc'] !== 'on');
     616                $wrapped_content[] = $this->admin_postbox('wp-quadratum-factual-settings',
     617                    $factual_title, implode('', $factual_settings), $hidden);
     618                    break;
    530619                break;
    531620               
     
    594683                        break;
    595684                       
     685                    case 'shortcodes':
     686                        $options['enable_map_sc'] = $this->admin_option('wp_quadratum_enable_map_sc');
     687                        $options['enable_locality_sc'] = $this->admin_option('wp_quadratum_enable_locality_sc');
     688                        $options['factual_oauth_key'] = html_entity_decode($this->admin_option('wp_quadratum_factual_oauth_key'));
     689                        $options['factual_oauth_secret'] = html_entity_decode($this->admin_option('wp_quadratum_factual_oauth_secret'));
     690                        break;
     691                       
    596692                    case 'defaults':
    597693                        $update_options = false;
     
    601697                            $this->admin_reset_plugin ();
    602698                            $update_msg = __('All', 'wp-quadratum');
    603                             $update_action = __('Reset To Default Values', 'wp-quadratum');
     699                            $action_msg = __('Reset To Default Values', 'wp-quadratum');
    604700                        }
    605701                        break;
     
    689785                        <?php
    690786                            echo $this->admin_help_and_support ();
     787                            echo $this->acknowledgements();
    691788                        ?>
    692789                        </div>
     
    711808            case 'foursquare':
    712809            case 'maps':
     810            case 'shortcodes':
    713811            case 'defaults':
    714812                $content[] = '<p class="submit">';
     
    752850            . '</p>'
    753851            . '<p>'
    754             . __('But ... help and support is a two way street; here\'s what you might want to do:')
     852            . __('But help and support is a two way street; here\'s what you might want to do:')
    755853            . '<ul>'
    756854            . '<li>'
     
    761859            . '</li>'
    762860            . '<li>'
    763             . __('WP Quadratum is both free as in speech and free as in beer; <a href="http://www.vicchi.org/codeage/donate/">here\'s why</a>.')
     861            . __('WP Quadratum is free; no premium or light version, no ads. If you\'d like to support this plugin <a href="http://www.vicchi.org/codeage/donate/">here\'s how</a>.', 'wp-quadratum')
    764862            . '</li>'
    765863            . '</ul>'
     
    767865
    768866        return $this->admin_postbox ('wp-quadratum-support', __('Help &amp; Support'), $content);
     867    }
     868
     869    function acknowledgements() {
     870        $content = array();
     871       
     872        $content[] = '<p>';
     873        $content[] = sprintf(__('Checkin data powered by <a href="%s" target="_blank">Foursquare</a>. Reverse geocoding courtesy of <a href="%s" target="_blank">Factual</a>.', 'wp-quadratum'),
     874            'https://foursquare.com/',
     875            'http://www.factual.com/'
     876            );
     877        $content[] = '</p>';
     878       
     879        return $this->admin_postbox('wp-quadratum-legal', __('Acknowledgements', 'wp-quadratum'), implode(PHP_EOL, $content));
    769880    }
    770881
  • wp-quadratum/trunk/includes/class-wp-quadratum-frontend.php

    r761076 r808889  
    1616    private $widgets = null;
    1717    private $checkin = null;
     18    private $cache = null;
    1819    private $icon_url = null;
    1920   
     
    2324   
    2425    private function __construct () {
    25         add_shortcode ('wp_quadratum', array ($this, 'shortcode'));
    26 
     26        add_shortcode('wp_quadratum', array($this, 'map_shortcode'));
     27        add_shortcode('wp_quadratum_map', array($this, 'map_shortcode'));
     28        add_shortcode('wpq_map', array($this, 'map_shortcode'));
     29
     30        add_shortcode('wp_quadratum_locality', array($this, 'locality_shortcode'));
     31        add_shortcode('wpq_locality', array($this, 'locality_shortcode'));
     32       
    2733        $this->hook('wp_loaded');
    2834        $this->hook('wp_enqueue_scripts');
     
    8086            );
    8187
    82             $strapline = '<h5>Last seen at <a href="' . $venue_url . '" target="_blank">' . $venue->name . '</a> on ' . date ("d M Y G:i T", $this->checkin->createdAt) . '</h5>';
     88            $strapline = '<h5>Last seen at <a href="' . $venue_url . '?ref=' . WP_Quadratum::get_option('client_id') . '" target="_blank">' . $venue->name . '</a> on ' . date ("d M Y G:i T", $this->checkin->createdAt) . '</h5>';
    8389
    8490            apply_filters('wp_quadratum_checkin', $this->checkin);
     
    96102        }
    97103
     104        else {
     105            $content[] = '<h5>Something went wrong; the Foursquare API might be down?</h5>';
     106        }
     107       
    98108        return $content;
    99109    }
    100110
    101111    /**
    102      * Shortcode handler for the [wp_quadratum] shortcode; expands the shortcode to the
    103      * checkin map according to the current set of plugin settings/options.
     112     * Shortcode handler for the [wp_quadratum] and [wpq_map] shortcodes; expands the
     113     * shortcode to the checkin map according to the current set of plugin settings/options.
    104114     *
    105115     * @param array atts Array containing the optional shortcode attributes specified by
     
    112122     */
    113123
    114     function shortcode ($atts, $content=null) {
    115        
    116         // TODO: handle self-closing and enclosing shortcode forms properly
    117         // TODO: this function is fugly; need to break out the checkin acquisition
    118         // and map generation code into a function/functions that can be called by
    119         // both the shortcode, the widget and the the_content filter (when I write it)
    120         // TODO: check and handle error responses from the 4sq API
    121         // TODO: handle 4sq API response caching
    122        
    123         static $instance = 0;
    124 
    125         $container_id = 'wp-quadratum-shortcode-container-' . $instance;
    126         $map_id = 'wp-quadratum-shortcode-map-' . $instance;
    127         $form_id = 'wp-quadratum-shortcode-form-' . $instance;
    128         $zoom_id = 'wp-quadratum-shortcode-zoom-' . $instance;
    129         $content = array ();
    130        
    131         extract (shortcode_atts (array (
    132             'width' => 300,
    133             'width_units' => 'px',
    134             'height' => 300,
    135             'height_units' => 'px',
    136             'zoom' => 16
    137         ), $atts));
    138 
    139         if (strpos($width_units, 'px') === false && strpos($width_units, '%') === false) {
    140             $width_units = 'px';
    141         }
    142         if (strpos($height_units, 'px') === false && strpos($height_units, '%') === false) {
    143             $height_units = 'px';
    144         }
    145 
    146         $args = array ();
    147         $args['width'] = $width;
    148         $args['width_units'] = $width_units;
    149         $args['height'] = $height;
    150         $args['height_units'] = $height_units;
    151         $args['zoom'] = $zoom;
    152         $args['container-class'] = 'wp-quadratum-shortcode-container';
    153         $args['container-id'] = $container_id;
    154         $args['map-class'] = 'wp-quadratum-shortcode-map';
    155         $args['map-id'] = $map_id;
    156         $args['venue-class'] = 'wp-quadratum-shortcode-venue';
    157         $args['form-id'] = $form_id;
    158         $args['zoom-id'] = $zoom_id;
    159         $args['instance'] = $instance;
    160         $content = WP_QuadratumFrontEnd::render_checkin_map ($args, true);
    161         $instance++;
    162 
    163         return implode (PHP_EOL, $content);
     124    function map_shortcode ($atts, $content=null) {
     125        if ($options['enable_map_sc'] === 'on') {
     126            // TODO: handle self-closing and enclosing shortcode forms properly
     127            // TODO: this function is fugly; need to break out the checkin acquisition
     128            // and map generation code into a function/functions that can be called by
     129            // both the shortcode, the widget and the the_content filter (when I write it)
     130            // TODO: check and handle error responses from the 4sq API
     131            // TODO: handle 4sq API response caching
     132       
     133            static $instance = 0;
     134
     135            $container_id = 'wp-quadratum-shortcode-container-' . $instance;
     136            $map_id = 'wp-quadratum-shortcode-map-' . $instance;
     137            $form_id = 'wp-quadratum-shortcode-form-' . $instance;
     138            $zoom_id = 'wp-quadratum-shortcode-zoom-' . $instance;
     139            $content = array ();
     140       
     141            extract (shortcode_atts (array (
     142                'width' => 300,
     143                'width_units' => 'px',
     144                'height' => 300,
     145                'height_units' => 'px',
     146                'zoom' => 16
     147            ), $atts));
     148
     149            if (strpos($width_units, 'px') === false && strpos($width_units, '%') === false) {
     150                $width_units = 'px';
     151            }
     152            if (strpos($height_units, 'px') === false && strpos($height_units, '%') === false) {
     153                $height_units = 'px';
     154            }
     155
     156            $args = array ();
     157            $args['width'] = $width;
     158            $args['width_units'] = $width_units;
     159            $args['height'] = $height;
     160            $args['height_units'] = $height_units;
     161            $args['zoom'] = $zoom;
     162            $args['container-class'] = 'wp-quadratum-shortcode-container';
     163            $args['container-id'] = $container_id;
     164            $args['map-class'] = 'wp-quadratum-shortcode-map';
     165            $args['map-id'] = $map_id;
     166            $args['venue-class'] = 'wp-quadratum-shortcode-venue';
     167            $args['form-id'] = $form_id;
     168            $args['zoom-id'] = $zoom_id;
     169            $args['instance'] = $instance;
     170            $content = WP_QuadratumFrontEnd::render_checkin_map ($args, true);
     171            $instance++;
     172
     173            $content = implode (PHP_EOL, $content);
     174        }
     175       
     176        return $content;
     177    }
     178   
     179    function locality_shortcode($atts, $content=null) {
     180        $options = WP_Quadratum::get_option();
     181        if ($options['enable_locality_sc'] === 'on' &&
     182                !empty($options['factual_oauth_key']) &&
     183                !empty($options['factual_oauth_secret'])) {
     184            extract (shortcode_atts (array (
     185                'type' => 'locality'
     186            ), $atts));
     187
     188            $type = strtolower($type);
     189
     190            if ($this->checkin) {
     191                $value = __('No information currently available', 'wp-quadratum');
     192                $location = null;
     193                if (isset($this->checkin) && isset($this->checkin->venue) && isset($this->checkin->venue->location)) {
     194                    $location = $this->checkin->venue->location;
     195                }
     196               
     197                switch ($type) {
     198                    case 'venue':
     199                        if (isset($this->checkin) && isset($this->checkin->venue) && isset($this->checkin->venue->name)) {
     200                            $value = $this->checkin->venue->name;
     201                        }
     202                        break;
     203                       
     204                    case 'address':
     205                        if (isset($location) && isset($location->address)) {
     206                            $value = $location->address;
     207                        }
     208                        else if (isset($location) && isset($location->lat) && isset($location->lng)) {
     209                            $cache = $this->get_reverse_geocode($location);
     210                            if (isset($cache['address'])) {
     211                                $value = $cache['address'];
     212                            }
     213                        }
     214                        break;
     215
     216                    case 'region':
     217                        if (isset($location) && isset($location->lat) && isset($location->lng)) {
     218                            $cache = $this->get_reverse_geocode($location);
     219                            if (isset($cache['region'])) {
     220                                $value = $cache['region'];
     221                            }
     222                        }
     223                        break;
     224                       
     225                    case 'postcode':
     226                        if (isset($location) && isset($location->lat) && isset($location->lng)) {
     227                            $cache = $this->get_reverse_geocode($location);
     228                            if (isset($cache['postcode'])) {
     229                                $value = $cache['postcode'];
     230                            }
     231                        }
     232                        break;
     233                       
     234                    case 'coordinates':
     235                        if (isset($location) && isset($location->lat) && isset($location->lng)) {
     236                            $value = $location->lat . ',' . $location->lng;
     237                        }
     238                        break;
     239
     240                    case 'timezone':
     241                        if (isset($this->checkin) && isset($this->checkin->timeZone)) {
     242                            $value = $this->checkin->timeZone;
     243                        }
     244                        break;
     245                       
     246                    case 'tzoffset':
     247                        if (isset($this->checkin) && isset($this->checkin->timeZoneOffset)) {
     248                            $tzo = $this->checkin->timeZoneOffset;
     249                            $minus = strpos($tzo, '-');
     250                            if ($minus === 0) {
     251                                $tzo = substr($tzo, $minus, 1);
     252                                $minus = '-';
     253                            }
     254                            else {
     255                                $minus = '+';
     256                            }
     257                            $tzo = $tzo / 60;
     258                            $value = 'GMT' . $minus . $tzo;
     259                        }
     260                        break;
     261                       
     262                    case 'locality':
     263                    default:
     264                        $type = 'locality';
     265                        if (isset($location) && isset($location->city)) {
     266                            $value = $location->city;
     267                        }
     268                        else if (isset($location) && isset($location->lat) && isset($location->lng)) {
     269                            $cache = $this->get_reverse_geocode($location);
     270                            $value = $cache['locality'];
     271                        }
     272                        break;
     273                }
     274
     275                $content = '<span class="wp-quadratum-'
     276                    . $type . '">'
     277                    . apply_filters('wp_quadratum_locality', $value, $type)
     278                    . '</span>';
     279
     280            }
     281        }
     282
     283        return $content;
     284    }
     285   
     286    private function get_reverse_geocode($location) {
     287        if ($this->cache === null) {
     288            require_once(FACTUAL_DRIVER_SRC);
     289           
     290            $options = WP_Quadratum::get_option();
     291            $factual = new Factual($options['factual_oauth_key'], $options['factual_oauth_secret']);
     292            $point = new FactualPoint($location->lat, $location->lng);
     293            try {
     294                //$start = microtime(true);
     295                $response = $factual->factualReverseGeocode($point);
     296                $this->cache = $response[0];
     297                WP_Quadratum::set_cache(WP_Quadratum::LOCALITY_CACHE, $this->cache);
     298            }
     299           
     300            catch (FactualApiException $e) {
     301                $this->cache = WP_Quadratum::get_cache(WP_Quadratum::LOCALITY_CACHE);
     302            }
     303            //$end = (microtime(true) - $start);
     304            //error_log('Cache refreshed in ' . $end . ' secs');
     305        }
     306       
     307        return $this->cache;
    164308    }
    165309   
     
    183327
    184328        //if (count($this->widgets) !== 0) {
    185             $json = WP_Quadratum::get_foursquare_checkins ();
     329        $have_checkin = false;
     330        $cached_checkin = false;
     331       
     332        $json = WP_Quadratum::get_foursquare_checkins ();
     333        if (!$this->validate_checkin($json)) {
     334            $json = WP_Quadratum::get_cache(WP_Quadratum::CHECKIN_CACHE);
     335            if ($this->validate_checkin($json)) {
     336                $have_checkin = true;
     337                $cached_checkin = true;
     338            }
     339        }
     340        else {
     341            $have_checkin = true;
     342        }
     343       
     344        if ($have_checkin) {
    186345            $checkins = $json->response->checkins->items;
    187            
     346
    188347            $provider = WP_Quadratum::get_option ('provider');
    189348
     
    208367            $this->checkin = $checkins[0];
    209368            $this->icon_url = $icon_url;
    210            
     369
    211370            wp_localize_script($handle, 'WPQuadratum', $args);
     371           
     372            if (!$cached_checkin) {
     373                WP_Quadratum::set_cache(WP_Quadratum::CHECKIN_CACHE, $json);
     374            }
     375        }
    212376        //}
    213377    }
    214378   
     379    private function validate_checkin($json) {
     380        if ($json === false || $json === null) {
     381            return false;
     382        }
     383       
     384        if (!isset($json->response) || !isset($json->response->checkins) || !isset($json->response->checkins->items)) {
     385            return false;
     386        }
     387       
     388        return true;
     389    }
     390
    215391    private function get_widgets() {
    216392        $this->widgets = array();
  • wp-quadratum/trunk/includes/class-wp-quadratum.php

    r761076 r808889  
    66   
    77        const OPTIONS = 'wp_quadratum_settings';
    8         const VERSION = '130';
    9         const DISPLAY_VERSION = 'v1.3.0';
     8        const CACHE = 'wp_quadratum_cache';
     9        const LOCALITY_CACHE = 'locality';
     10        const CHECKIN_CACHE = 'checkin';
     11        const VERSION = '131';
     12        const DISPLAY_VERSION = 'v1.3.1';
    1013   
    1114        /**
     
    166169                        //"cloudmade_key" => "",
    167170                        'openmq_key' => '',
    168                         'bingv7_key' => ''
     171                        'bingv7_key' => '',
     172                        'enable_map_sc' => 'on',
     173                        'enable_locality_sc' => '',
     174                        'factual_oauth_key' => '',
     175                        'factual_oauth_secret' => ''
    169176                        )
    170177                    );
    171178
    172179                update_option (self::OPTIONS, $settings);
     180            }
     181           
     182            $cache = WP_Quadratum::get_cache();
     183            if (!is_array($cache)) {
     184                $cache = array(
     185                    'timestamp' => time(),
     186                    'checkin' => null,
     187                    'locality' => null
     188                );
     189                update_option(self::CACHE, $cache);
    173190            }
    174191        }
     
    203220            }
    204221        }
     222       
     223        static function get_cache($key=NULL) {
     224            $cache = get_option(self::CACHE);
     225
     226            if (isset($key) && !empty($key)) {
     227                return json_decode($cache[$key]);
     228            }
     229           
     230            else {
     231                return $cache;
     232            }
     233        }
    205234
    206235        /**
     
    211240         */
    212241
    213         static function set_option ($key, $value) {
    214             $options = get_options (self::OPTIONS);
     242        static function set_option($key, $value) {
     243            $options = get_option(self::OPTIONS);
    215244            $options[$key] = $value;
    216             update_option (self::OPTIONS, $options);
    217         }
    218 
     245            update_option(self::OPTIONS, $options);
     246        }
     247
     248        static function set_cache($key, $value) {
     249            $cache = get_option(self::CACHE);
     250            $cache['timestamp'] = time();
     251            $cache[$key] = json_encode($value);
     252            update_option(self::CACHE, $cache);
     253        }
    219254
    220255        /**
     
    269304            $fsq->set_access_token ($oauth_token);
    270305            $rsp = $fsq->get_private ($endpoint, $params);
    271             $json = json_decode ($rsp);
    272             return $json;
     306
     307            if ($rsp !== false) {
     308                $json = json_decode($rsp);
     309                return $json;
     310            }
     311           
     312            return $rsp;
    273313        }
    274314
  • wp-quadratum/trunk/js/wp-quadratum-admin.js

    r580206 r808889  
    11(function($) {
    22    $().ready(function() {
    3         $('#wp-quadratum-map-provider').focus (function () {
    4             $(this).data ('prev-provider', $(this).val ());
     3        $('#wp-quadratum-map-provider').focus(function() {
     4            $(this).data('prev-provider', $(this).val());
    55        });
    6         $('#wp-quadratum-map-provider').change (function() {
    7             var prev_id = $('#wp-quadratum-' + $(this).data ('prev-provider') + '-settings');
    8             var curr_id = $('#wp-quadratum-' + $(this).val () + '-settings');
    9             prev_id.toggle ();
    10             curr_id.toggle ();
    11             $(this).data ('prev-provider', $(this).val ());
     6
     7        $('#wp-quadratum-map-provider').change(function() {
     8            var prev_id = $('#wp-quadratum-' + $(this).data('prev-provider') + '-settings');
     9            var curr_id = $('#wp-quadratum-' + $(this).val() + '-settings');
     10            prev_id.toggle();
     11            curr_id.toggle();
     12            $(this).data('prev-provider', $(this).val());
     13        });
     14       
     15        $('#wp-quadratum-enable-locality-sc').click(function() {
     16            $('#wp-quadratum-factual-settings').toggle('slow');
    1217        });
    1318    });
  • wp-quadratum/trunk/js/wp-quadratum-admin.min.js

    r580206 r808889  
    1 (function(a){a().ready(function(){a("#wp-quadratum-map-provider").focus(function(){a(this).data("prev-provider",a(this).val())});a("#wp-quadratum-map-provider").change(function(){var b=a("#wp-quadratum-"+a(this).data("prev-provider")+"-settings"),c=a("#wp-quadratum-"+a(this).val()+"-settings");b.toggle();c.toggle();a(this).data("prev-provider",a(this).val())})})})(jQuery);
     1(function(a){a().ready(function(){a("#wp-quadratum-map-provider").focus(function(){a(this).data("prev-provider",a(this).val())});a("#wp-quadratum-map-provider").change(function(){var b=a("#wp-quadratum-"+a(this).data("prev-provider")+"-settings"),c=a("#wp-quadratum-"+a(this).val()+"-settings");b.toggle();c.toggle();a(this).data("prev-provider",a(this).val())});a("#wp-quadratum-enable-locality-sc").click(function(){a("#wp-quadratum-factual-settings").toggle("slow")})})})(jQuery);
  • wp-quadratum/trunk/readme.txt

    r761076 r808889  
    33Donate Link: http://www.vicchi.org/codeage/donate/
    44Tags: wp-quadratum, maps, map, foursquare, checkins, checkin, widget
    5 Requires at least: 3.6.0
    6 Tested up to: 3.6.0
    7 Stable tag: 1.3.0
     5Requires at least: 3.7.0
     6Tested up to: 3.7.1
     7Stable tag: 1.3.1
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    40401. Configure your Foursquare credentials; from the Dashboard, navigate to the *Settings / WP Quadratum* page or click on the *"Settings"* link from the Plugins page on the Dashboard.
    41411. To display your Foursquare checkins, WP Quadratum needs to be authorised to access your Foursquare account information; this is a simple, safe and secure 3 step process. WP Quadratum never sees your account login information and cannot store any personally identifiable information.
    42     1. Register your WordPress site as a Foursquare application on the [Foursquare App Registration](https://foursquare.com/developers/register) page. If you're not currently logged into your Foursquare account, you'll need to login with the Foursquare account whose checkins you want WP Quadratum to display. The *Your app name* field is a label you want to use to identify this connection to your Foursquare account. The *Download / welcome page url* is the URL of your Wordpress site. The *Redirect URI* will be provided for you and will be along the lines of http://www.yoursite.com/wp-content/plugins/wp-quadratum/includes/wp-quadratum-callback.php (this is just an example, *don't use this URL*). *Push API Notifications* should be set to *Disable pushes to this app*. All other fields can be left at their default values. Once you have successfully registered your site, you'll be provided with two keys, the *Client ID* and the *Client Secret*.
     42    1. Register your WordPress site as a Foursquare application on the [Foursquare App Registration](https://foursquare.com/developers/register) page. If you're not currently logged into your Foursquare account, you'll need to login with the Foursquare account whose checkins you want WP Quadratum to display. The *Your app name* field is a label you want to use to identify this connection to your Foursquare account. The *Download / welcome page url* is the URL of your Wordpress site. The *Redirect URI* will be provided for you and will be along the lines of `http://www.yoursite.com/wp-content/plugins/wp-quadratum/includes/wp-quadratum-callback.php` (this is just an example, *don't use this URL*). *Push API Notifications* should be set to *Disable pushes to this app*. All other fields can be left at their default values. Once you have successfully registered your site, you'll be provided with two keys, the *Client ID* and the *Client Secret*.
    4343    1. Copy and paste the supplied *Client ID* and *Client Secret* into the respective WP Quadratum setting fields. Click on the *"Save Changes"* button to preserve them.
    4444    1. You should now be authorised and ready to go; click on the *Connect to Foursquare* button.
     
    7575== Screenshots ==
    7676
    77 1. Settings and Options: Foursquare Tab; Client ID and Client Secret entered
     771. Installed Plugins: Authentication prompt shown after activating plugin for the first time
     781. Settings and Options: Foursquare Tab; No Client ID or Client Secret entered or saved
    78791. Settings and Options: Foursquare Tab; Client ID and Client Secret saved
    79 1. Foursquare Authentication; not logged in
    80 1. Foursquare Authentication; logged in
     801. Foursquare Authentication: Allow or deny plugin access to your Foursquare account
    81811. Settings and Options: Foursquare Tab; Successfully authenticated with Foursquare
    82821. Settings and Options: Maps Tab; HERE Maps configuration
     
    86861. Settings and Options: Maps Tab; OpenLayers Maps configuration
    87871. Settings and Options: Maps Tab; MapQuest Open Maps configuration
     881. Settings and Options: Shortcode Tab; [wp_quadratum] shortcode enabled
     891. Settings and Options: Shortcode Tab; [wp_quadratum_locality] shortcode enabled, no Factual OAuth Key or Secret entered or saved
     901. Settings and Options: Shortcode Tab; [wp_quadratum_locality] shortcode enabled, no Factual OAuth Key or Secret saved
    88911. Settings and Options: Defaults Tab
    89921. Settings and Options: Colophon Tab
     
    9497== Changelog ==
    9598
    96 The current version is 1.3.0 (2013.08.22)
     99The current version is 1.3.1 (2013.10.23)
     100
     101= 1.3.1 =
     102* Released: 2013.10.23
     103* Added: Caching of last good response from the Foursquare API, allowing the plugin to operate if the API is temporarily down.
     104* Added: New locality shortcodes, `[wp_quadratum_locality]` (and `[wpq_locality]` as an alias) to allow the last checkin's venue name, address, region, postal code, coordinates, timezone and/or timezone offset to be embedded in posts or pages.
     105* Added: New checkin map shortcodes, `[wp_quadratum_map]` and `[wpq_map]` as aliases for the plugin's `[wp_quadratum]` shortcode.
     106* Added: Ability for the plugin's shortcodes to be made configurable, on and off.
     107* Added: Ability to backfill the response of the Foursquare API, via Factual's reverse geocoder, to cope with cases when a Foursquare venue doesn't have a complete set of metadata attributes to be used in conjunction with the locality shortcodes.
     108* Added: New filter, `wp_quadratum_locality`, to filter and amend the output of the `[wp_quadratum_locality]` shortcode.
     109* Fixed: Detect and trap an invalid or empty response from the Foursquare API, preventing numerous PHP warnings from polluting a post or page.
     110* Other: Fully compatible with WordPress v3.7 "Basie".
    97111
    98112= 1.3.0 =
     
    111125* Other: Transitioned to `WP_Mapstraction` from `WP_MXNHelper`.
    112126
    113 = 1.2 =
     127= 1.2.0 =
    114128* Released: 2012.11.06
    115129* Added: Support for the `wp_quadratum_strapline` filter.
     
    118132* Other: Moved all submodule classes/libraries from the plugin's root directory to /includes.
    119133
    120 = 1.1 =
     134= 1.1.0 =
    121135* Released: 2012.07.01
    122136* Added: Support for Nokia, CloudMade, Google and OpenLayers maps via Mapstraction
     
    133147Fixed: An issue with an old version of WP_PluginBase, the PHP class which WP Quadratum extends.
    134148
    135 = 1.0 =
     149= 1.0.0 =
    136150* First version of WP Quadratum released
    137151
    138152== Upgrade Notice ==
     153= 1.3.1 =
     154Cache last good Foursquare checkin response for when the Foursquare API is down. Add new locality shortcode. This release is fully compatible with WordPress 3.7 "Basie".
     155
    139156= 1.3.0 =
    140157Fix issue where the map did not load due to new GitHub content serving policy. Add support for Leaflet, Bing and MapQuest Open maps. Add new `wp_quadratum_checkin` filter.
     
    157174== Shortcode Support And Usage ==
    158175
    159 WP Quadratum supports a single shortcode, `[wp_quadratum]`. Adding this shortcode to the content of a post or page or into a theme template as content, expands the shortcode and replaces it with a checkin map.
     176WP Quadratum supports two shortcodes and three shortcode aliases; `[wp_quadratum_map]` to expand the shortcode in a post or page and replace it with the checkin map and `[wp_quadratum_locality]` to allow you to embed aspects of your last checkin in a post or page.
     177
     178= [wp_quadratum_map] =
     179
     180Adding this shortcode to the content of a post or page as content, expands the shortcode and replaces it with a checkin map.
    160181
    161182The shortcode also supports multiple *attributes* which allow you to customise the way in which the shortcode is expanded into the checkin map:
     
    167188* the `zoom` attribute
    168189
    169 = The "width" Attribute =
     190** The "width" Attribute **
    170191
    171192The `width` attribute, in conjunction with the `height` attribute specifies the width of the map to be inserted into a post or page. If omitted, the map width defaults to a value of `300`.
    172193
    173 = The "width_units" Attribute =
     194** The "width_units" Attribute **
    174195
    175196The `width_units` attribute, specifies how the value specified in the `width` attribute should be interpreted. Valid values for this attribute as `px` and `%`, denoting that the `width` attribute should be interpreted in pixels or as a percentage respectively. If omitted, this attribute defaults to a value of `px`.
    176197
    177 = The "height" Attribute =
     198** The "height" Attribute **
    178199
    179200The `height` attribute, in conjunction with the `width` attribute specifies the height of the map to be inserted into a post or page. If omitted, the map height defaults to a value of `300`.
    180201
    181 = The "height_units" Attribute =
     202** The "height_units" Attribute **
    182203
    183204The `height_units` attribute, specifies how the value specified in the `height` attribute should be interpreted. Valid values for this attribute as `px` and `%`, denoting that the `height` attribute should be interpreted in pixels or as a percentage respectively. If omitted, this attribute defaults to a value of `px`.
    184205
    185 = The "zoom" Attribute =
     206** The "zoom" Attribute **
    186207
    187208The `zoom` attribute specifies the zoom level to be used when displaying the checkin map. If omitted, the zoom level defaults to a value of `16` which is roughly analogous to a neighbourhood zoom.
    188209
     210= [wp_quadratum] =
     211
     212The `[wp_quadratum]` shortcode is an alias for the `[wp_quadratum_map]` shortcode and has the same functionality.
     213
     214= [wpq_map] =
     215
     216The `[wpq_map]` shortcode is an alias for the `[wp_quadratum_map]` shortcode and has the same functionality.
     217
     218= [wp_quadratum_locality] =
     219
     220Adding this shortcode to the content of a post or page, expands the shortcode and replaces it with information about your last Foursquare checkin. The information to be displayed is selected by the shortcode's `type` attribute, which allows you to select the venue name, address, region, postal code, coordinates, timezone or timezone offset.
     221
     222By default, the `[wp_quadratum_locality]` shortcode and the `[wpq_locality]` alias are disabled. This is because not all Foursquare venues contain the full scope of locality elements that the shortcode supports (the minimum requirements for a Foursquare venue are name, category and coordinates). To backfill any missing venue elements, WP Quadratum uses a *reverse geocoding* service from [Factual](http://www.factual.com/) to supply the missing information.
     223
     224To enable the `[wp_quadratum_locality]` shortcode, from the Dashboard navigate to *Settings / WP Quadratum* and click on the *Shortcodes* tab. Select the *Enable Locality Shortcode Usage* checkbox and the *Factual OAuth Settings* meta-box will appear. You'll then need to sign up for a [Factual API key](https://www.factual.com/api-keys/request) after which you'll be given an *OAuth Key* and *OAuth Secret*. Copy and paste these into the *Factual OAuth* text fields and click on *Save Shortcode Settings*. You'll now be able to use the `[wp_quadratum_locality]` shortcode or its alias.
     225
     226
     227**The "type" Attribute**
     228
     229The `type` attribute specifies the element of your last Foursquare checkin that is to be displayed in a post or page and can take one of the following values:
     230
     231* `venue` - the name of the last Foursquare venue you checked into.
     232* `address` - the street address of the venue; not including the region, locality or postal code.
     233* `region` - the region of the venue; the geographic context of the region will vary from country to country but is roughly analogous to the venue's city.
     234* `postcode` - the postal code of the venue, if the country or region supports postal codes.
     235* `coordinates` - the geographic coordinates of the venue, in the form latitude,longitude.
     236* `timezone` - the timezone name of the time of the checkin, such as `Europe/London`.
     237* `tzoffset` - the offset from GMT of the time of the checkin, in the form GMT[-+]hours, such as GMT-1 or GMT+2.
     238* `locality` - the locality of the venue; the geographic context of the locality will vary according to country, but is roughly analogous to the town or neighbourhood.
     239
     240If the `type` attribute is not supplied, or if the value of this attribute is not one of the above values, `type="locality"` will be assumed. The shortcode's replacement value can be modified via the plugin's `wp_quadratum_locality` filter; see the *Filter Support and Usage* section for more information.
     241
     242= [wpq_locality] =
     243
     244The `[wpq_locality]` shortcode is an alias for the `[wp_quadratum_locality]` shortcode and has the same functionality.
     245
    189246== Filter Support And Usage ==
    190247
    191 WP Quadratum supports two filters, which are described in more detail below. The plugin's filters allow you to:
     248WP Quadratum supports three filters, which are described in more detail below. The plugin's filters allow you to:
    192249
    193250* change the descriptive text that appears immediately below the map when displayed via the plugin's widget or shortcode.
    194251* gain access to the checkin metadata that is returned from the Foursquare API
     252* change the output of the [wp_quadratum_locality]` shortcode
    195253
    196254= wp_quadratum_checkin =
     
    225283    return $strapline;
    226284}`
     285
     286= wp_quadratum_locality =
     287
     288Applied to the replacement content of the `[wp_quadratum_locality]` shortcode immediately before the shortcode is replaced. The filter's hook function is passed two arguments; the shortcode's value and corresponding `type` attribute.
     289
     290*Example:* Wrap each invocation of the `[wp_quadratum_locality]` shortcode in a `div` whose class includes the attribute type.
     291
     292`add_filter('wp_quadratum_locality', 'format_locality', 10, 2);
     293function format_locality($value, $type) {
     294    $class = 'wp-quadratum-locality-' . $type;
     295    return '<div class="' . $class . '">' . $value . '</div>';
     296}`
  • wp-quadratum/trunk/uninstall.php

    r761076 r808889  
    44    delete_option('wp_quadratum_settings');
    55    delete_option('widget_wp_quadratumwidget');
     6    delete_option('wp_quadratum_cache');
    67}
    78
  • wp-quadratum/trunk/wp-quadratum.php

    r761076 r808889  
    44Plugin URI: http://www.vicchi.org/codeage/wp-quadratum/
    55Description: A WordPress plugin to display your last Foursquare checkin as a map widget, fully authenticated via OAuth 2.0.
    6 Version: 1.3.0
     6Version: 1.3.1
    77Author: Gary Gale
    88Author URI: http://www.garygale.com/
     
    4141
    4242define('FOURSQUARE_HELPER_SRC', WPQUADRATUM_PATH . 'includes/foursquare-helper/foursquare-helper.php');
     43define('FACTUAL_DRIVER_SRC', WPQUADRATUM_PATH . 'includes/factual-php-driver/Factual.php');
    4344
    4445include_once(ABSPATH . 'wp-admin/includes/plugin.php');
Note: See TracChangeset for help on using the changeset viewer.