Changeset 703569
- Timestamp:
- 04/25/2013 04:56:25 PM (13 years ago)
- Location:
- runkeeper-activity-feed/trunk
- Files:
-
- 1 added
- 3 edited
-
assets-wp-repo (added)
-
readme.txt (modified) (3 diffs)
-
runkeeper-wordpress-activity-feed.php (modified) (8 diffs)
-
runkeeper-wordpress-records-widget.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
runkeeper-activity-feed/trunk/readme.txt
r701681 r703569 5 5 Requires at least: 3.5 6 6 Tested up to: 3.5.1 7 Stable tag: 1. 4.07 Stable tag: 1.5.0 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 14 14 15 15 The RunKeeper + WordPress Activity Feed plugin automatically posts RunKeeper Activities straight to your blog. All you need to do is activate the plugin and connect your account. After that, track your activities with RunKeeper and they'll show up on your WordPress site for everyone to see! 16 17 **NEW FEATURE**: Metric Unit Support 18 19 * Post Options and the Widget now support the use of metric units, just update your options! 16 20 17 21 **NEW FEATURE**: RunKeeper Records Widget … … 55 59 == Changelog == 56 60 61 = 1.5.0 = 62 * NEW FEATURE: Metric Unit Support for Posts and Widget 63 57 64 = 1.4.0 = 58 65 * NEW FEATURE: Single Activity Import based on Activity ID -
runkeeper-activity-feed/trunk/runkeeper-wordpress-activity-feed.php
r701681 r703569 6 6 Description: A plugin to automatically draft posts of all your Runkeeper Activities. 7 7 Author: A. Kai Armstrong 8 Version: 1. 4.08 Version: 1.5.0 9 9 Author URI: http://www.kaiarmstrong.com 10 10 */ … … 26 26 add_option('toz_rk_post_options_time', ''); 27 27 add_option('toz_rk_last_event', '0'); 28 add_option('toz_rk_units', 'standard'); 28 29 } 29 30 register_activation_hook( __FILE__, 'toz_rk_activate'); … … 83 84 if ( isset($_POST['toz_rk_post_options_url']) ) { update_option('toz_rk_post_options_url', $_POST['toz_rk_post_options_url']); } 84 85 if ( isset($_POST['toz_rk_post_options_time']) ) { update_option('toz_rk_post_options_time', $_POST['toz_rk_post_options_time']); } 86 if ( isset($_POST['toz_rk_units']) ) { update_option('toz_rk_units', $_POST['toz_rk_units']); } 85 87 toz_rk_schedule_activate(); 86 88 } else if ( isset($_POST['action']) && ( $_POST['action'] == 'toz_rk_reset_options' )) { … … 109 111 <h3>Plugin Settings</h3> 110 112 <p><form method="post" action=""> 111 <table class="form-table"><tbod >113 <table class="form-table"><tbody> 112 114 <tr valign="top"> 113 115 <th scope="row"><label for="toz_rk_author_id">Author ID:</label></th> … … 125 127 </tr> 126 128 <tr valign="top"> 129 <th scope="row"><label for="toz_rk_units">Units:</label></th> 130 <td> 131 <input type="radio" name="toz_rk_units" value="standard" class="code" <?php if ( get_option('toz_rk_units') == 'standard' ) { echo 'checked'; } else { } ?> /> 132 <span class="description">Standard</span> 133 </td> 134 </tr> 135 <tr valign="top"> 136 <th scope="row"></th> 137 <td> 138 <input type="radio" name="toz_rk_units" value="metric" class="code" <?php if ( get_option('toz_rk_units') == 'metric' ) { echo 'checked'; } else { } ?> /> 139 <span class="description">Metric</span> 140 </td> 141 </tr> 142 <tr valign="top"> 127 143 <th scope="row"><label for="toz_rk_post_options">Post Options:</label></th> 128 144 <td> … … 130 146 <span class="description">Activity Notes</span> 131 147 </td> 132 133 148 </tr> 134 149 <tr valign="top"> … … 396 411 if ( !empty($post_options['distance']) ) { 397 412 if ( !empty($rkActivity_detailed_array['total_distance']) ) { 398 $post_import_content .= '<li>Distance: ' . round($rkActivity_detailed_array['total_distance']*0.00062137, 2) . '</li>'; 413 if ( get_option('toz_rk_units') == 'standard' ) { 414 $post_import_content .= '<li>Distance: ' . round($rkActivity_detailed_array['total_distance']*0.00062137, 2) . ' mi</li>'; //Meters * Miles 415 } else if ( get_option('toz_rk_units') == 'metric' ) { 416 $post_import_content .= '<li>Distance: ' . round($rkActivity_detailed_array['total_distance']/1000, 2) . ' km</li>'; //Meters / KM 417 } else { 418 $post_import_content .= '<li>Distance: ' . round($rkActivity_detailed_array['total_distance']*0.00062137, 2) . ' mi</li>'; //Default to Standard 419 } 399 420 } else { 400 421 //Do Nothing … … 419 440 list($hours, $minutes, $seconds) = explode(":",$hms); 420 441 $total_seconds = $hours * 60 * 60 + $minutes * 60 + $seconds; 421 422 $mps = round($rkActivity_detailed_array['total_distance']*0.00062137, 2) / $total_seconds; 423 $mph = round($mps * 60 * 60, 2); 424 425 $post_import_content .= '<li>Average Speed: ' . $mph . '</li>'; 442 443 if ( get_option('toz_rk_units') == 'standard' ) { 444 $dps = round($rkActivity_detailed_array['total_distance']*0.00062137, 2) / $total_seconds; 445 $sph = round($dps * 60 * 60, 2); 446 $post_import_content .= '<li>Average Speed: ' . $sph . ' mph</li>'; 447 } else if ( get_option('toz_rk_units') == 'metric' ) { 448 $dps = round($rkActivity_detailed_array['total_distance']/1000, 2) / $total_seconds; 449 $sph = round($dps * 60 * 60, 2); 450 $post_import_content .= '<li>Average Speed: ' . $sph . ' kmh</li>'; 451 } else { 452 $dps = round($rkActivity_detailed_array['total_distance']*0.00062137, 2) / $total_seconds; 453 $sph = round($dps * 60 * 60, 2); 454 $post_import_content .= '<li>Average Speed: ' . $sph . ' mph</li>'; 455 } 456 426 457 } else { 427 458 //Do Nothing -
runkeeper-activity-feed/trunk/runkeeper-wordpress-records-widget.php
r701681 r703569 49 49 $toz_widget_rkAPI->setRunkeeperToken( get_option( 'toz_rk_access_token' ) ); 50 50 } 51 52 //Get Unit Options 53 if ( get_option('toz_rk_units') == 'standard' ) { 54 $toz_rk_units = 'mi'; 55 } else if ( get_option('toz_rk_units') == 'metric' ) { 56 $toz_rk_units = 'km'; 57 } else { 58 $toz_rk_units = 'mi'; 59 } 51 60 52 61 $rkRecordsFeed = $toz_widget_rkAPI->doRunkeeperRequest('Records','Read'); … … 58 67 foreach ($rkRecordsFeed[$i] as $rkRecordsActivity) { 59 68 $toz_records_content = '<ul>'; 60 $toz_records_content .= '<li>Best Activity: '.round($rkRecordsActivity[0]->value, 2).' miles</li>';61 $toz_records_content .= '<li>Best Week: '.round($rkRecordsActivity[1]->value, 2).' miles</li>';62 $toz_records_content .= '<li>Last Week: '.round($rkRecordsActivity[2]->value, 2).' miles</li>';63 $toz_records_content .= '<li>This Week: '.round($rkRecordsActivity[3]->value, 2).' miles</li>';64 $toz_records_content .= '<li>Best Month: '.round($rkRecordsActivity[4]->value, 2).' miles</li>';65 $toz_records_content .= '<li>Last Month: '.round($rkRecordsActivity[5]->value, 2).' miles</li>';66 $toz_records_content .= '<li>This Month: '.round($rkRecordsActivity[6]->value, 2).' miles</li>';69 $toz_records_content .= '<li>Best Activity: '.round($rkRecordsActivity[0]->value, 2).' ' . $toz_rk_units . '</li>'; 70 $toz_records_content .= '<li>Best Week: '.round($rkRecordsActivity[1]->value, 2).' ' . $toz_rk_units . '</li>'; 71 $toz_records_content .= '<li>Last Week: '.round($rkRecordsActivity[2]->value, 2).' ' . $toz_rk_units . '</li>'; 72 $toz_records_content .= '<li>This Week: '.round($rkRecordsActivity[3]->value, 2).' ' . $toz_rk_units . '</li>'; 73 $toz_records_content .= '<li>Best Month: '.round($rkRecordsActivity[4]->value, 2).' ' . $toz_rk_units . '</li>'; 74 $toz_records_content .= '<li>Last Month: '.round($rkRecordsActivity[5]->value, 2).' ' . $toz_rk_units . '</li>'; 75 $toz_records_content .= '<li>This Month: '.round($rkRecordsActivity[6]->value, 2).' ' . $toz_rk_units . '</li>'; 67 76 $toz_records_content .= '</ul>'; 68 77
Note: See TracChangeset
for help on using the changeset viewer.