Plugin Directory

Changeset 192047


Ignore:
Timestamp:
01/09/2010 11:17:01 PM (16 years ago)
Author:
mmilan81
Message:

Adding ver 0.2

Location:
mm-did-you-know/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • mm-did-you-know/trunk/changelog.txt

    r191757 r192047  
    1 2010-01-08 0.1  Milan Milosevic
     12010-01-08 ver 0.2, Milan Milosevic
     2    Options page added.
    23
     42010-01-08 ver 0.1, Milan Milosevic
    35    First version!
    46    Uploaded to Wordpress.org
  • mm-did-you-know/trunk/mm-did-you-know.php

    r191757 r192047  
    66 *  Plugin URI: http://www.mmilan.com/did-you-know/
    77 *  Description: Adds a sidebar widget that display interesting quotes from posts with link to the post.
    8  *  Version: 0.1
     8 *  Version: 0.2
    99 *  Author: Milan Milosevic
    1010 *  Author URI: http://www.mmilan.com/
     
    234234
    235235function mmdyk_page() {
     236   
    236237    // Page wrapper start
    237238    echo '<div class="wrap">';
     
    241242    echo '<h2>MM Did You Know?</h2>';
    242243
     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   
    243271    // 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 }
    248290
    249291
  • mm-did-you-know/trunk/readme.txt

    r191757 r192047  
    55Requires at least: 2.7
    66Tested up to: 2.9.1
    7 Stable tag: 0.1
     7Stable tag: 0.2
    88
    99Display useless facts or quotes from posts (with link) at the sidebar widget.
     
    1515Changelog:
    1616
     17    2010-01-08, version 0.2
     18        Options page added.
     19       
    1720    2010-01-08, version 0.1
    1821        First realase!
     
    2932
    3033Yes. Some new features I plan to add:
    31     * add more useless facts
    32     * options page
    3334    * easyer way to edit quotes / facts
    3435
Note: See TracChangeset for help on using the changeset viewer.