Plugin Directory

Changeset 837766


Ignore:
Timestamp:
01/13/2014 04:53:56 PM (12 years ago)
Author:
phikai
Message:

3.8 compatibility

Location:
runkeeper-activity-feed/trunk
Files:
1 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • runkeeper-activity-feed/trunk/readme.txt

    r819400 r837766  
    22Contributors: phikai
    33Donate link: http://runkeeper.thinkonezero.com
    4 Tags: runkeeper, widget, 
     4Tags: runkeeper, widget,
    55Requires at least: 3.5
    6 Tested up to: 3.8-RC2
    7 Stable tag: 1.7.0
     6Tested up to: 3.8
     7Stable tag: 1.7.1
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
  • runkeeper-activity-feed/trunk/runkeeper-wordpress-activity-feed.php

    r784096 r837766  
    66Description: A plugin to automatically draft posts of all your Runkeeper Activities.
    77Author: A. Kai Armstrong
    8 Version: 1.7.0
     8Version: 1.7.1
    99Author URI: http://www.kaiarmstrong.com
    1010*/
     
    5959        exit();
    6060    }
    61    
     61
    6262    /* Stores the access values we'll need after we've authorized our account. */
    6363    if ( isset($_GET['code']) && isset($_GET['access_token']) ) {
     
    6565        update_option('toz_rk_access_token', $_GET['access_token']);
    6666    }
    67    
     67
    6868    //Set the Acess Token for API Use
    6969    $toz_rk_auth_code = get_option( 'toz_rk_auth_code' );
     
    7171        $toz_rkAPI->setRunkeeperToken( get_option( 'toz_rk_access_token' ) );
    7272    }
    73    
     73
    7474    //Update Plugin Options
    7575    if ( isset($_POST['action']) && ( $_POST['action'] == 'toz_rk_update_options' )){
     
    9696        //Do Nothing
    9797    }
    98    
     98
    9999?>
    100100    <div class="wrap">
     
    113113            <h3>Plugin Settings</h3>
    114114            <p><form method="post" action="">
    115            
     115
    116116                <!-- Author Options -->
    117117                <table class="form-table"><tbody>
     
    135135                    </tr>
    136136                </tbody></table>
    137                
     137
    138138                <!-- Units Table -->
    139139                <table class="form-table"><tbody>
     
    150150                    </tr>
    151151                </tbody></table>
    152                
     152
    153153                <!-- Post Content Options //3 Columns -->
    154154                <table class="form-table"><tbody>
     
    206206                    </tr>
    207207                </tbody></table>
    208                
     208
    209209                <input type="hidden" name="action" value="toz_rk_update_options" />
    210210                <p class="submit"><input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" /></p>
    211211            </form></p>
    212212            <p><form method="post" action="">
    213                 <p>Reset (so you can authorize again): 
     213                <p>Reset (so you can authorize again):
    214214                <input type="hidden" name="action" value="toz_rk_reset_options" />
    215215                <input type="submit" class="button-primary" value="<?php _e('Reset Options') ?>" /></p>
     
    224224            <hr />
    225225            <p><form method="post" action="">
    226                 <p>Import all (1000) of your previous activities: 
     226                <p>Import all (1000) of your previous activities:
    227227                <input type="hidden" name="action" value="toz_rk_import_old" />
    228228                <input type="submit" class="button-primary" value="<?php _e('Import') ?>" /></p>
     
    231231            <?php if ( isset($_POST['action']) && ( $_POST['action'] == 'toz_rk_import_old' )) { ?>
    232232                <h3>Historical Import</h3>
    233                 <?php toz_rk_import_old(); 
     233                <?php toz_rk_import_old();
    234234            } else if ( isset($_POST['action']) && ( $_POST['action'] == 'toz_rk_import_single' )) { ?>
    235235                <h3>Single Activity Import</h3>
     
    278278        foreach ($rkActivitiesFeedImport_array['items'] as $rkActivitiesItem) {
    279279            $rkActivity_uri = $rkActivitiesItem->uri;
    280                    
     280
    281281            $rkActivity_id = explode('/', $rkActivity_uri);
    282282            $rkActivity_id = $rkActivity_id[2];
    283                    
     283
    284284            if ( intval($rkActivity_id) > intval(get_option('toz_rk_last_event')) ) {
    285285                $rkActivity_detailed = $toz_schedule_rkAPI->doRunkeeperRequest('FitnessActivity','Read', '', $rkActivity_uri);
     
    287287
    288288                toz_rk_post($rkActivity_detailed_array);
    289                        
     289
    290290                update_option('toz_rk_last_event', $rkActivity_id);
    291                        
     291
    292292            } else {
    293293                update_option('toz_rk_schedule_result', 'failure: '.time());
    294294            }
    295                                            
     295
    296296        }
    297297    } else {
     
    315315        $toz_import_single_rkAPI->setRunkeeperToken( get_option( 'toz_rk_access_token' ) );
    316316    }
    317    
     317
    318318    if ( !empty($rkActivity_id) ) {
    319    
     319
    320320        $rkActivity_uri = '/fitnessActivities/' . $rkActivity_id;
    321321
     
    323323        $rkActivity_detailed_array = (array) $rkActivity_detailed;
    324324
    325         toz_rk_post($rkActivity_detailed_array);                           
    326                
     325        toz_rk_post($rkActivity_detailed_array);
     326
    327327    } else {
    328328        echo $toz_import_single_rkAPI->api_last_error;
     
    359359
    360360            toz_rk_post($rkActivity_detailed_array);
    361                    
    362             toz_rk_import_progress($rkActivity_uri);                           
    363                
     361
     362            toz_rk_import_progress($rkActivity_uri);
     363
    364364        }
    365365    } else {
     
    372372
    373373    $publish_date = date_create_from_format('*, j M Y H:i:s', $rkActivity_detailed_array['start_time']);
    374                    
     374
    375375    $post_import_content = '';
    376        
     376
    377377    //Get all the Post Options and build the post_content
    378378    $post_options = array (
     
    387387        'time'      => get_option('toz_rk_post_options_time')
    388388    );
    389                    
     389
    390390    $post_options_notes = get_option('toz_rk_post_options_notes');
    391                        
     391
    392392    if ( !empty($post_options_notes) ) {
    393393        if ( !empty($rkActivity_detailed_array['notes']) ) {
     
    399399        //Do Nothing
    400400    }
    401                    
     401
    402402    if ( !empty($post_options) ) {
    403                        
     403
    404404        $post_import_content .= '<ul>';
    405                        
     405
    406406        if ( !empty($post_options['type']) ) {
    407407            if ( !empty($rkActivity_detailed_array['type']) ) {
     
    413413            //Do Nothing
    414414        }
    415        
     415
    416416        if ( !empty($post_options['distance']) ) {
    417417            if ( !empty($rkActivity_detailed_array['total_distance']) ) {
     
    429429            //Do Nothing
    430430        }
    431                        
     431
    432432        if ( !empty($post_options['duration']) ) {
    433433            if ( !empty($rkActivity_detailed_array['duration']) ) {
     
    439439            //Do Nothing
    440440        }
    441                        
     441
    442442        if ( !empty($post_options['speed']) ) {
    443443            if ( !empty($rkActivity_detailed_array['duration']) && !empty($rkActivity_detailed_array['total_distance']) ) {
     
    445445                list($hours, $minutes, $seconds) = explode(":",$hms);
    446446                $total_seconds = $hours * 60 * 60 + $minutes * 60 + $seconds;
    447                
     447
    448448                if ( get_option('toz_rk_units') == 'standard' ) {
    449449                    $dps = round($rkActivity_detailed_array['total_distance'] * 0.00062137, 2) / $total_seconds;
     
    458458                    $sph = round($dps * 60 * 60, 2);
    459459                    $post_import_content .= '<li>Average Speed: ' . $sph . ' mph</li>';
    460                 }           
    461                
    462             } else {
    463                 //Do Nothing
    464             }
    465         } else {
    466             //Do Nothing
    467         }
    468        
     460                }
     461
     462            } else {
     463                //Do Nothing
     464            }
     465        } else {
     466            //Do Nothing
     467        }
     468
    469469        if ( !empty($post_options['pace']) ) {
    470470            if ( !empty($rkActivity_detailed_array['duration']) && !empty($rkActivity_detailed_array['total_distance']) ) {
     
    472472                list($hours, $minutes, $seconds) = explode(":",$hms);
    473473                $total_seconds = $hours * 60 * 60 + $minutes * 60 + $seconds;
    474                
     474
    475475                if ( get_option('toz_rk_units') == 'standard' ) {
    476476                    $pps = $total_seconds / round($rkActivity_detailed_array['total_distance'] * 0.00062137, 2);
     
    485485                    $ppm = date('i:s', $pps);
    486486                    $post_import_content .= '<li>Average Pace: ' . $ppm . ' min/mi</li>';
    487                 }           
    488                
    489             } else {
    490                 //Do Nothing
    491             }
    492         } else {
    493             //Do Nothing
    494         }
    495                        
     487                }
     488
     489            } else {
     490                //Do Nothing
     491            }
     492        } else {
     493            //Do Nothing
     494        }
     495
    496496        if ( !empty($post_options['calories']) ) {
    497497            if ( !empty($rkActivity_detailed_array['total_calories']) ) {
     
    503503            //Do Nothing
    504504        }
    505                        
     505
    506506        if ( !empty($post_options['heartrate']) ) {
    507507            if ( !empty($rkActivity_detailed_array['average_heart_rate']) ) {
     
    513513            //Do Nothing
    514514        }
    515                        
     515
    516516        if ( !empty($post_options['url']) ) {
    517517            if ( !empty($rkActivity_detailed_array['activity']) ) {
     
    523523            //Do Nothing
    524524        }
    525                        
     525
    526526        if ( !empty($post_options['time']) ) {
    527527            if ( !empty($rkActivity_detailed_array['start_time']) ) {
     
    533533            //Do Nothing
    534534        }
    535                        
     535
    536536        $post_import_content .= '</ul>';
    537                    
     537
    538538    } else {
    539539        //Do Nothing
    540540    }
    541                    
     541
    542542    $toz_rk_post_import = array (
    543543        'post_title'    => $rkActivity_detailed_array['type'] . ': ' . $rkActivity_detailed_array['start_time'],
     
    549549        'tags_input'    => $rkActivity_detailed_array['type']
    550550    );
    551                        
     551
    552552    $post_id = wp_insert_post( $toz_rk_post_import );
    553                    
     553
    554554    if (isset($rkActivity_detailed_array['images']['0'])) {
    555555        $rkActivity_detailed_array_images = (array) $rkActivity_detailed_array['images']['0'];
     
    586586        'post_status'    => 'inherit'
    587587    );
    588    
     588
    589589    $attach_id = wp_insert_attachment( $attachment, $file, $post_id );
    590590    require_once(ABSPATH . 'wp-admin/includes/image.php');
Note: See TracChangeset for help on using the changeset viewer.