Changeset 192047
- Timestamp:
- 01/09/2010 11:17:01 PM (16 years ago)
- Location:
- mm-did-you-know/trunk
- Files:
-
- 3 edited
-
changelog.txt (modified) (1 diff)
-
mm-did-you-know.php (modified) (3 diffs)
-
readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
mm-did-you-know/trunk/changelog.txt
r191757 r192047 1 2010-01-08 0.1 Milan Milosevic 1 2010-01-08 ver 0.2, Milan Milosevic 2 Options page added. 2 3 4 2010-01-08 ver 0.1, Milan Milosevic 3 5 First version! 4 6 Uploaded to Wordpress.org -
mm-did-you-know/trunk/mm-did-you-know.php
r191757 r192047 6 6 * Plugin URI: http://www.mmilan.com/did-you-know/ 7 7 * Description: Adds a sidebar widget that display interesting quotes from posts with link to the post. 8 * Version: 0. 18 * Version: 0.2 9 9 * Author: Milan Milosevic 10 10 * Author URI: http://www.mmilan.com/ … … 234 234 235 235 function mmdyk_page() { 236 236 237 // Page wrapper start 237 238 echo '<div class="wrap">'; … … 241 242 echo '<h2>MM Did You Know?</h2>'; 242 243 244 global $wpdb; 245 $table_name = $wpdb->prefix . 'mmdyk_quote'; 246 $hidden_field_name = 'mm_dyk_submit'; 247 248 // See if the user has posted us some information 249 // If they did, this hidden field will be set to 'Y' 250 if(isset($_POST[ $hidden_field_name ]) && $_POST[ $hidden_field_name ] == 'Y' ) { 251 $mydata = $_POST['mmdyk_txtarea']; 252 $wpdb->query("DELETE FROM $table_name WHERE post_id = 0"); 253 254 // Do something with $mydata 255 256 if($mmdyk_list = strip_tags(stripslashes($mydata))) { 257 $mmdyk_array = explode("\n", $mmdyk_list); 258 sort($mmdyk_array); 259 260 foreach($mmdyk_array as $mmdyk_current) { 261 $mmdyk_current = trim($mmdyk_current); 262 if(!empty($mmdyk_current)) { 263 $mmdyk_str = explode(" http://", $mmdyk_current); 264 if (strlen($mmdyk_str[1]) > 0) $mmdyk_str[1] = "http://".$mmdyk_str[1]; 265 $wpdb->insert( $table_name, array( 'quotes' => $mmdyk_str[0], 'post_id' => $post_id, 'link' => $mmdyk_str[1] )); 266 } 267 } 268 } 269 } 270 243 271 // Options 244 echo '<div id="poststuff" class="ui-sortable">'; 245 echo 'Come back after upgrading to version 0.2! In a few days :)'; 246 echo '</div>'; 247 } 272 ?> 273 <p>Only one quote per line (no HTML code). To add a link put it at the end of line and start it with http://</p> 274 <form name="mmdyk_form" method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>"> 275 <input type="hidden" name="<?php echo $hidden_field_name; ?>" value="Y"> 276 277 <textarea name="mmdyk_txtarea" rows="30" cols="120" wrap="off" style="overflow: auto;"> 278 <?php $mmdyk_rec = $wpdb->get_results("SELECT * FROM $table_name WHERE post_id = 0"); 279 foreach($mmdyk_rec as $mmdyk_act) { 280 echo $mmdyk_act->quotes . " " . $mmdyk_act->link . "\r\n"; 281 } 282 ?> 283 </textarea> 284 285 <p class="submit"> 286 <input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" /> 287 </p> 288 </form> 289 <?php } 248 290 249 291 -
mm-did-you-know/trunk/readme.txt
r191757 r192047 5 5 Requires at least: 2.7 6 6 Tested up to: 2.9.1 7 Stable tag: 0. 17 Stable tag: 0.2 8 8 9 9 Display useless facts or quotes from posts (with link) at the sidebar widget. … … 15 15 Changelog: 16 16 17 2010-01-08, version 0.2 18 Options page added. 19 17 20 2010-01-08, version 0.1 18 21 First realase! … … 29 32 30 33 Yes. Some new features I plan to add: 31 * add more useless facts32 * options page33 34 * easyer way to edit quotes / facts 34 35
Note: See TracChangeset
for help on using the changeset viewer.