Changeset 705196
- Timestamp:
- 04/29/2013 03:19:43 AM (13 years ago)
- Location:
- runkeeper-activity-feed/trunk
- Files:
-
- 1 deleted
- 2 edited
-
assets-wp-repo (deleted)
-
readme.txt (modified) (2 diffs)
-
runkeeper-wordpress-activity-feed.php (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
runkeeper-activity-feed/trunk/readme.txt
r703569 r705196 5 5 Requires at least: 3.5 6 6 Tested up to: 3.5.1 7 Stable tag: 1. 5.07 Stable tag: 1.6.0 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 59 59 == Changelog == 60 60 61 = 1.6.0 = 62 * NEW FEATURE: Average Pace Options for Posts 63 61 64 = 1.5.0 = 62 65 * NEW FEATURE: Metric Unit Support for Posts and Widget -
runkeeper-activity-feed/trunk/runkeeper-wordpress-activity-feed.php
r703569 r705196 6 6 Description: A plugin to automatically draft posts of all your Runkeeper Activities. 7 7 Author: A. Kai Armstrong 8 Version: 1. 5.08 Version: 1.6.0 9 9 Author URI: http://www.kaiarmstrong.com 10 10 */ … … 21 21 add_option('toz_rk_post_options_duration', ''); 22 22 add_option('toz_rk_post_options_speed', ''); 23 add_option('toz_rk_post_options_pace', ''); 23 24 add_option('toz_rk_post_options_calories', ''); 24 25 add_option('toz_rk_post_options_heartrate', ''); … … 80 81 if ( isset($_POST['toz_rk_post_options_duration']) ) { update_option('toz_rk_post_options_duration', $_POST['toz_rk_post_options_duration']); } 81 82 if ( isset($_POST['toz_rk_post_options_speed']) ) { update_option('toz_rk_post_options_speed', $_POST['toz_rk_post_options_speed']); } 83 if ( isset($_POST['toz_rk_post_options_pace']) ) { update_option('toz_rk_post_options_pace', $_POST['toz_rk_post_options_pace']); } 82 84 if ( isset($_POST['toz_rk_post_options_calories']) ) { update_option('toz_rk_post_options_calories', $_POST['toz_rk_post_options_calories']); } 83 85 if ( isset($_POST['toz_rk_post_options_heartrate']) ) { update_option('toz_rk_post_options_heartrate', $_POST['toz_rk_post_options_heartrate']); } … … 111 113 <h3>Plugin Settings</h3> 112 114 <p><form method="post" action=""> 115 116 <!-- Author Options --> 113 117 <table class="form-table"><tbody> 114 118 <tr valign="top"> … … 126 130 </td> 127 131 </tr> 132 </tbody></table> 133 134 <!-- Units Table --> 135 <table class="form-table"><tbody> 128 136 <tr valign="top"> 129 137 <th scope="row"><label for="toz_rk_units">Units:</label></th> 130 <td >138 <td width="200px"> 131 139 <input type="radio" name="toz_rk_units" value="standard" class="code" <?php if ( get_option('toz_rk_units') == 'standard' ) { echo 'checked'; } else { } ?> /> 132 140 <span class="description">Standard</span> 133 141 </td> 134 </tr>135 <tr valign="top">136 <th scope="row"></th>137 142 <td> 138 143 <input type="radio" name="toz_rk_units" value="metric" class="code" <?php if ( get_option('toz_rk_units') == 'metric' ) { echo 'checked'; } else { } ?> /> … … 140 145 </td> 141 146 </tr> 147 </tbody></table> 148 149 <!-- Post Content Options //3 Columns --> 150 <table class="form-table"><tbody> 142 151 <tr valign="top"> 143 152 <th scope="row"><label for="toz_rk_post_options">Post Options:</label></th> 144 <td >153 <td width="200px"> 145 154 <input type="checkbox" name="toz_rk_post_options_notes" value="true" class="code" <?php if ( get_option('toz_rk_post_options_notes') == true ) { echo 'checked'; } else { } ?> /> 146 155 <span class="description">Activity Notes</span> 147 156 </td> 148 </tr> 149 <tr valign="top"> 150 <th scope="row"></th> 151 <td> 157 <td width="200px"> 152 158 <input type="checkbox" name="toz_rk_post_options_type" value="true" class="code" <?php if ( get_option('toz_rk_post_options_type') == true ) { echo 'checked'; } else { } ?> /> 153 159 <span class="description">Activity Type</span> 154 160 </td> 155 </tr>156 <tr valign="top">157 <th scope="row"></th>158 161 <td> 159 162 <input type="checkbox" name="toz_rk_post_options_distance" value="true" class="code" <?php if ( get_option('toz_rk_post_options_distance') == true ) { echo 'checked'; } else { } ?> /> … … 167 170 <span class="description">Total Duration</span> 168 171 </td> 169 </tr>170 <tr valign="top">171 <th scope="row"></th>172 172 <td> 173 173 <input type="checkbox" name="toz_rk_post_options_speed" value="true" class="code" <?php if ( get_option('toz_rk_post_options_speed') == true ) { echo 'checked'; } else { } ?> /> 174 174 <span class="description">Average Speed</span> 175 175 </td> 176 <td> 177 <input type="checkbox" name="toz_rk_post_options_pace" value="true" class="code" <?php if ( get_option('toz_rk_post_options_pace') == true ) { echo 'checked'; } else { } ?> /> 178 <span class="description">Average Pace</span> 179 </td> 176 180 </tr> 177 181 <tr valign="top"> … … 181 185 <span class="description">Total Calories</span> 182 186 </td> 183 </tr>184 <tr valign="top">185 <th scope="row"></th>186 187 <td> 187 188 <input type="checkbox" name="toz_rk_post_options_heartrate" value="true" class="code" <?php if ( get_option('toz_rk_post_options_heartrate') == true ) { echo 'checked'; } else { } ?> /> 188 189 <span class="description">Heart Rate</span> 189 190 </td> 190 </tr>191 <tr valign="top">192 <th scope="row"></th>193 191 <td> 194 192 <input type="checkbox" name="toz_rk_post_options_url" value="true" class="code" <?php if ( get_option('toz_rk_post_options_url') == true ) { echo 'checked'; } else { } ?> /> … … 204 202 </tr> 205 203 </tbody></table> 204 206 205 <input type="hidden" name="action" value="toz_rk_update_options" /> 207 206 <p class="submit"><input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" /></p> … … 367 366 368 367 function toz_rk_post( $rkActivity_detailed_array ) { 368 369 369 $publish_date = date_create_from_format('*, j M Y H:i:s', $rkActivity_detailed_array['start_time']); 370 370 … … 377 377 'duration' => get_option('toz_rk_post_options_duration'), 378 378 'speed' => get_option('toz_rk_post_options_speed'), 379 'pace' => get_option('toz_rk_post_options_pace'), 379 380 'calories' => get_option('toz_rk_post_options_calories'), 380 381 'heartrate' => get_option('toz_rk_post_options_heartrate'), … … 442 443 443 444 if ( get_option('toz_rk_units') == 'standard' ) { 444 $dps = round($rkActivity_detailed_array['total_distance'] *0.00062137, 2) / $total_seconds;445 $dps = round($rkActivity_detailed_array['total_distance'] * 0.00062137, 2) / $total_seconds; 445 446 $sph = round($dps * 60 * 60, 2); 446 447 $post_import_content .= '<li>Average Speed: ' . $sph . ' mph</li>'; 447 448 } else if ( get_option('toz_rk_units') == 'metric' ) { 448 $dps = round($rkActivity_detailed_array['total_distance'] /1000, 2) / $total_seconds;449 $dps = round($rkActivity_detailed_array['total_distance'] / 1000, 2) / $total_seconds; 449 450 $sph = round($dps * 60 * 60, 2); 450 451 $post_import_content .= '<li>Average Speed: ' . $sph . ' kmh</li>'; 451 452 } else { 452 $dps = round($rkActivity_detailed_array['total_distance'] *0.00062137, 2) / $total_seconds;453 $dps = round($rkActivity_detailed_array['total_distance'] * 0.00062137, 2) / $total_seconds; 453 454 $sph = round($dps * 60 * 60, 2); 454 455 $post_import_content .= '<li>Average Speed: ' . $sph . ' mph</li>'; 456 } 457 458 } else { 459 //Do Nothing 460 } 461 } else { 462 //Do Nothing 463 } 464 465 if ( !empty($post_options['pace']) ) { 466 if ( !empty($rkActivity_detailed_array['duration']) && !empty($rkActivity_detailed_array['total_distance']) ) { 467 $hms = date('H:i:s', $rkActivity_detailed_array['duration']); 468 list($hours, $minutes, $seconds) = explode(":",$hms); 469 $total_seconds = $hours * 60 * 60 + $minutes * 60 + $seconds; 470 471 if ( get_option('toz_rk_units') == 'standard' ) { 472 $pps = $total_seconds / round($rkActivity_detailed_array['total_distance'] * 0.00062137, 2); 473 $ppm = date('i:s', $pps); 474 $post_import_content .= '<li>Average Pace: ' . $ppm . ' min/mi</li>'; 475 } else if ( get_option('toz_rk_units') == 'metric' ) { 476 $pps = $total_seconds / round($rkActivity_detailed_array['total_distance'] / 1000, 2); 477 $ppm = date('i:s', $pps); 478 $post_import_content .= '<li>Average Pace: ' . $ppm . ' min/km</li>'; 479 } else { 480 $pps = $total_seconds / round($rkActivity_detailed_array['total_distance'] * 0.00062137, 2); 481 $ppm = date('i:s', $pps); 482 $post_import_content .= '<li>Average Pace: ' . $ppm . ' min/mi</li>'; 455 483 } 456 484
Note: See TracChangeset
for help on using the changeset viewer.