Plugin Directory

Changeset 193586


Ignore:
Timestamp:
01/13/2010 02:29:37 PM (16 years ago)
Author:
mmilan81
Message:

Adding ver 0.6

Location:
mm-breaking-news/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • mm-breaking-news/trunk/changelog.txt

    r107565 r193586  
    1 2009-04-03 0.5.2 Milan Milosevic
     12010-01-13, ver 0.6, Milan Milosevic
     2    Added shortcode [mm-breaking-news] for displaying a list in a page/post
    23
     42009-12-25, ver 0.5.3, Milan Milosevic
     5    Bugfix: Wordpress 2.9
     6
     72009-04-03, ver 0.5.2, Milan Milosevic
    38    Bugfix: problem with CSS file
    49
    5 2009-03-6 0.5  Milan Milosevic
    6 
     102009-03-6, ver 0.5,  Milan Milosevic
    711    Uploaded to Wordpress.org
  • mm-breaking-news/trunk/mm-bnlist.php

    r187043 r193586  
    66Author: Milan Milosevic
    77Author URI: http://www.mmilan.com/
    8 Version: 0.5.3
     8Version: 0.6
    99License: GPL v3 - http://www.gnu.org/licenses/
    1010
     
    7373            echo "<b>".$opt_tmp['title'][$i]."</b>";
    7474            echo "<ul>";
    75                 global $post;
    7675                $catid = Array();
    7776                if (!empty($opt_tmp['in'][$i])) foreach ($opt_tmp['in'][$i] as $tmp) $catid[] = $tmp;
     
    8281                if ($show_rand[$i] == "YES") $myposts = get_posts("numberposts=$num&category=$catids&orderby=rand");
    8382                    else $myposts = get_posts("numberposts=$num&category=$catids");
    84                 foreach($myposts as $post) :
    85                     setup_postdata($post);
     83                foreach($myposts as $show_post) :
     84                    setup_postdata($show_post);
    8685                    if ($show_date[$i] == "YES") $sh_date = the_date('M dS, Y', ' (', '', FALSE);
    8786                        else $sh_date = '';
    88                     if ($show_comments[$i] == "YES") $no_com = "".$post->comment_count." comments)";
     87                    if ($show_comments[$i] == "YES") $no_com = "".$show_post->comment_count." comments)";
    8988                        else $no_com = '';
    9089                    if (($show_date[$i] == "YES") and ($show_comments[$i] == "YES")) $sep = "; ";
     
    9291                            else $sep = " (";
    9392                    if (($show_date[$i] != "YES") and ($show_comments[$i] != "YES")) $sep = "";
    94                     print "<li><a href=\"".get_permalink()."\">".$post->post_title."</a><span class=\"date_com\">".$sh_date.$sep.$no_com."</span></li>";
     93                    print "<li><a href=\"".get_permalink()."\">".$show_post->post_title."</a><span class=\"date_com\">".$sh_date.$sep.$no_com."</span></li>";
    9594                endforeach;
    9695            echo "</ul>";
     
    102101    }
    103102}
     103
     104// Add shortcode
     105function mm_bnlist_code ($attr) {
     106
     107    // Read in existing option value from database
     108    $opt_name = array(
     109        'n' =>'mm_bnlist_n',
     110        'in' => 'mm_bnlist_in',
     111        'out' => 'mm_bnlist_out',
     112        'num' => 'mm_bnlist_num',
     113        'title' => 'mm_bnlist_title',
     114    );
     115       
     116    $opt_val = array(
     117        'n' => get_option( $opt_name['n'] ),
     118        'in' => get_option( $opt_name['in'] ),
     119        'out' => get_option( $opt_name['out'] ),
     120        'num' => get_option( $opt_name['num'] ),
     121        'title' =>  get_option( $opt_name['title'] ),
     122    );
     123    if ($opt_val['n'] < 1) $opt_val['n'] = 1;
     124
     125    $opt_tmp['title'] = unserialize($opt_val['title']);
     126    $opt_tmp['num'] = unserialize($opt_val['num']);
     127    $opt_tmp['in'] = unserialize($opt_val['in']);
     128    $opt_tmp['out'] = unserialize($opt_val['out']);
     129    $show_comments = unserialize(get_option('mm_bnlist_comments'));
     130    $show_date = unserialize(get_option('mm_bnlist_date'));
     131    $show_rand = unserialize(get_option('mm_bnlist_rand'));
     132
     133    for ( $i = 0; $i < $opt_val['n']; $i+=1 ) {
     134        echo "<h3>".$opt_tmp['title'][$i]."</h3>";
     135        echo "<ul>";
     136            $catid = Array();
     137            if (!empty($opt_tmp['in'][$i])) foreach ($opt_tmp['in'][$i] as $tmp) $catid[] = $tmp;
     138            if (!empty($opt_tmp['out'][$i])) foreach ($opt_tmp['out'][$i] as $tmp) $catid[] = -$tmp;
     139            $catids = implode(',', $catid);
     140
     141            $num = $opt_tmp['num'][$i];
     142            if ($show_rand[$i] == "YES") $myposts = get_posts("numberposts=$num&category=$catids&orderby=rand");
     143                else $myposts = get_posts("numberposts=$num&category=$catids");
     144            foreach($myposts as $show_post) :
     145                setup_postdata($show_post);
     146                if ($show_date[$i] == "YES") $sh_date = the_date('M dS, Y', ' (', '', FALSE);
     147                    else $sh_date = '';
     148                if ($show_comments[$i] == "YES") $no_com = "".$show_post->comment_count." comments)";
     149                    else $no_com = '';
     150                if (($show_date[$i] == "YES") and ($show_comments[$i] == "YES")) $sep = "; ";
     151                    else if ($show_date[$i] == "YES") $sep = ")";
     152                        else $sep = " (";
     153                if (($show_date[$i] != "YES") and ($show_comments[$i] != "YES")) $sep = "";
     154                print "<li><a href=\"".get_permalink()."\">".$show_post->post_title."</a><span class=\"date_com\">".$sh_date.$sep.$no_com."</span></li>";
     155            endforeach;
     156        echo "</ul>";
     157    }
     158
     159    if (get_option('mm_bnlist_credits') != "NO")
     160        echo "<p style=\"text-align: right; font-size: 0.7em \">Plugin by <a href=\"http://www.mmilan.com\">mmilan.com</a></p>";
     161}
     162
     163add_shortcode('mm-breaking-news', 'mm_bnlist_code');
    104164
    105165// Admin menu
  • mm-breaking-news/trunk/readme.txt

    r187043 r193586  
    44Tags: latest, post, category, front, page, archive, news
    55Requires at least: 2.6
    6 Tested up to: 2.9
    7 Stable tag: 0.5.3
     6Tested up to: 2.9.1
     7Stable tag: 0.6
    88
    99Displays lists of posts from selected categories. You can select how many different lists you want, sort posts by date or random.
     
    1717Lists can be show whereber you want - above or below posts, in archive, or on single post or page. Also, you can place it in sidebar. You can choose to show lists only on first page or not.
    1818
     19If you want to show a list on one page (or post) you can use a shortcode [mm-breaking-news] when you write and the whole bullet list will be displayed.
     20
    1921Changelog:
    2022
    21     2009-12-25 0.5.3 Milan Milosevic
     23    2010-01-13, ver 0.6, Milan Milosevic
     24        Added shortcode [mm-breaking-news] for displaying a list in a page/post
     25
     26    2009-12-25, ver 0.5.3, Milan Milosevic
    2227        Bugfix: Wordpress 2.9
    2328
    24     2009-04-03 0.5.1 Milan Milosevic
     29    2009-04-03, ver 0.5.2, Milan Milosevic
    2530        Bugfix: problem with CSS file
    2631
    27     2009-03-6 0.5  Milan Milosevic
    28         First realase!
     32    2009-03-6, ver 0.5,  Milan Milosevic
     33        Uploaded to Wordpress.org
     34
    2935
    3036== Installation ==
Note: See TracChangeset for help on using the changeset viewer.