Plugin Directory

Changeset 949294


Ignore:
Timestamp:
07/16/2014 03:30:25 AM (12 years ago)
Author:
kushsharma
Message:

Added title, text color option

Location:
kush-micro-news/trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • kush-micro-news/trunk/assets/css/style.css

    r872168 r949294  
    4949}
    5050
    51 .wrapNews .title{
     51#micro-news .wrapNews .title{
    5252    color:#0066cc;
    5353    font-size:15px;
     
    5757}
    5858
    59 .wrapNews .text{
     59#micro-news .wrapNews .text{
    6060    padding-bottom:20px;
    6161    position: relative;
    6262}
    6363
    64 .wrapNews .postedOn{
     64#micro-news .wrapNews .postedOn{
    6565    font-size:10px;
    6666    border-bottom:2px solid #CCC;
     
    7070}
    7171
    72 .wrapNews .link{
     72#micro-news .wrapNews .link{
    7373    position:absolute;
    7474    right:5px;
     
    7777}
    7878
    79 .wrapNews .link:hover{
     79#micro-news .wrapNews .link:hover{
    8080    background-color:#8bbf36;
    8181}
    8282
    83 .wrapNews .clean:hover{
     83#micro-news .wrapNews .clean:hover{
    8484    background-color:transparent;
    8585}
    8686
    87 .wrapNews .link a{
     87#micro-news .wrapNews .link a{
    8888    color:#8bbf36 ;
    8989}
    9090
    91 .wrapNews .link a:visited{
     91#micro-news .wrapNews .link a:visited{
    9292    color:#8bbf36 ;
    9393}
    9494
    95 .wrapNews .link a:hover{
     95#micro-news .wrapNews .link a:hover{
    9696    color:black;
    9797}
     
    109109
    110110#micro-news .editB{
    111 float:right;
    112 width:100px;
    113 position:absolute;
    114 top:0px;
    115 right:15px;
     111    float:right;
     112    width:50px;
     113    position:absolute;
     114    top:0px;
     115    right:15px;
    116116
    117117}
     
    119119#micro-news  .closeB{
    120120    margin-top:1px;
    121     padding:4px 5px 4px 5px;
     121    padding:3px 5px 3px 5px;
    122122    color: #fff;
    123123    background: #21759b;
     
    125125    position:absolute;
    126126    top:0px;
    127     right:0px;
    128     width:5px;
     127    right:0px; 
     128    width:5px; 
    129129   
    130130    -webkit-border-radius: 11px;
    131 border-radius: 11px;
    132 -moz-box-sizing: content-box;
    133 -webkit-box-sizing: content-box;
    134 box-sizing: content-box;
     131    border-radius: 11px;
     132    -moz-box-sizing: content-box;
     133    -webkit-box-sizing: content-box;
     134    box-sizing: content-box;
    135135}
    136136
    137137#micro-news  .closeB:hover{
    138138    -webkit-border-radius: 1px;
    139 border-radius: 1px;
     139    border-radius: 1px;
    140140}
    141141
     
    211211}
    212212
     213/* - config - */
     214#mirco-news-config .options {
     215    padding: 5px;
     216}
     217#mirco-news-config .options label{
     218    min-width: 20%;
     219    display: inline-block;
     220}
     221
     222
     223
    213224/* ----Admin ends ----*/
    214225
  • kush-micro-news/trunk/assets/js/script.js

    r734004 r949294  
    11jQuery(function ($) {
    2 $(document).ready(function(){
    32
    4 
    5     $('#micro-news .editB').click(function(){
    6        
     3    $(document).on('click','#micro-news .editB',function(){     
    74               
    85        parent=$(this).parent();
     
    1411        var link=$('#mn-link-'+id).html();
    1512       
    16         var fields='<form action="" method="post" id="update-micro-news" class="update-micro-news-'+id+'"><div class="row"><label for="nTitle">Title:</label><input type="text" name="nTitle" class="title-updated regular-text" value="'+title+'"/></div><div class="row"><label for="nContent">Content:</label><textarea class="text-updated" name="nContent">'+content+'</textarea></div><div class="row"><label for="nLink">Link:</label><input type="text" name="nLink" class="link-updated regular-text" value="'+link+'"/></div><input type="hidden" name="nId" value="'+id+'"/><div class="row"><input type="submit" class="submit-update"></div></form>';
     13        var fields='<form action="" method="post" id="update-micro-news" class="update-micro-news-'+id+'">';
     14        fields +='<div class="row"><label for="nTitle">Title:</label><input type="text" name="nTitle" class="title-updated regular-text" value="'+title+'"/></div>';
     15        fields +='<div class="row"><label for="nContent">Content:</label><textarea class="text-updated" name="nContent">'+content+'</textarea></div>';
     16        fields +='<div class="row"><label for="nLink">Link:</label><input type="text" name="nLink" class="link-updated regular-text" value="'+link+'"/>';
     17        fields +='</div><input type="hidden" name="nId" value="'+id+'"/><div class="row"><input type="submit" class="submit-update"></div></form>';
    1718       
    1819       
     
    2526            parent.addClass('open');
    2627           
     28            //show cross sign
     29            //$("#micro-news .closeB").attr('visibility','visible');
     30
    2731            $(this).attr('value','Update');}
    2832        else
    2933            {
     34            //hide cross sign
     35            //$("#micro-news .closeB").attr('visibility','hidden');
     36
    3037           
    3138            title=$('#update-micro-news .title-updated').val();
     
    5158    });
    5259   
    53    
    54     $('#micro-news .delB').click(function(){
     60    $(document).on('click','#micro-news .delB',function(){ 
    5561        parent=$(this).parent();
    5662       
     
    6975    });
    7076   
    71     $('#micro-news .closeB').click(function(){
     77    $(document).on('click','#micro-news .closeB',function(){
     78
    7279        parent=$(this).parent();
    7380       
     
    8188    });
    8289
     90
    8391});
    84 });
  • kush-micro-news/trunk/includes/admin.php

    r872168 r949294  
    1616$what='';
    1717if(isset($_POST['valSub']))
    18     {
     18{
    1919    if(isset($_POST['numPost']))
    2020        {
     
    3232    if(isset($_POST['myRename']))
    3333    {
    34     if($_POST['myRename']!='')
    35         {$name=$_POST['myRename'];
    36          update_option("kush_mn_widget_name",$name);
    37          
     34        if($_POST['myRename']!='')
     35        {update_option("kush_mn_widget_name",$_POST['myRename']);       
    3836         $what='Changes Saved !';
    3937        }
     
    5856        }
    5957    else   
    60     update_option('kush_mn_show_linkclean','false');
     58        update_option('kush_mn_show_linkclean','false');
    6159       
    6260    if(isset($_POST['chkHtmlParse']))
     
    6765        }
    6866    else   
    69     update_option('kush_mn_parse_html','false');
    70    
    71 
     67        update_option('kush_mn_parse_html','false');
     68   
     69   
     70    if(isset($_POST['textColor']) && $_POST['textColor']!="")
     71    {
     72        update_option( "kush_mn_color_text",$_POST['textColor']);
     73        $what='Changes Saved !';
     74    }
     75   
     76    if(isset($_POST['titleColor']) && $_POST['titleColor']!="")
     77        {
     78            update_option( "kush_mn_color_title",$_POST['titleColor']);
     79            $what='Changes Saved !';
     80        }           
     81       
    7282
    7383   
     
    7989    <?php echo ($what!='')?'<div class="updated"><p><strong>'.$what.'</strong></p></div>':''; ?>
    8090    <br/>
    81     <form action="" method="post">
     91    <form action="" method="post" id="mirco-news-config">
    8292        <h3>Functional Settings :</h3>
    8393        <div class="options">
     
    8696            <h5 style="display:inline-block;margin:0;">(via kush_micro_news_output() function)</h5>
    8797        </div>
     98
    8899        <h3>Display Settings :</h3>
    89100        <div class="options">
     
    91102            <input type="text" name="myRename" value="<?php echo get_option("kush_mn_widget_name");?>"/>
    92103            <h5 style="display:inline-block;margin:0;">(Try not to use any special character like inverted commas)</h5>
    93             <br>
     104        </div>
     105        <div class="options">
    94106            <label for="chkBorder">Enable colorful borders:</label>
    95107            <input type="checkbox" name="chkBorder" value="true" <?php $sBor=get_option('kush_mn_show_lborder');if($sBor=='true'){echo 'checked';}?>/>
    96108        </div>
     109        <div class="options">           
     110            <label for="titleColor">Title Color:</label>
     111            <select name="titleColorList" onclick="check_custom_color(this,'title')">
     112                <option value="#0066CC">Light Blue [Default]</option>
     113                <option value="#000000">Black</option>
     114                <option value="#666666">Grey</option>
     115                <option value="#8bbf36">Green</option>
     116                <option value="#fff2a8">Golden</option>
     117                <option value="#F25555">Red</option>
     118                <option value="#FFD700">Yellow</option>
     119                <option value="#FFB6C1">Pink</option>
     120                <option value="#191970">Midnight Blue</option>             
     121            </select>
     122            <input type="text" name="titleColor" value="<?php echo get_option('kush_mn_color_title');?>" />
     123            <h5 style="display:inline-block;margin:0;">(Hexadecimal color values, like: #0066CC)</h5>
     124        </div>
     125        <div class="options">
     126            <label for="textColor">Text Color:</label>
     127            <select name="textColorList" onclick="check_custom_color(this,'text')">
     128                <option value="#666666">Grey [Default]</option>
     129                <option value="#0066CC">Light Blue</option>
     130                <option value="#000000">Black</option>
     131                <option value="#8bbf36">Green</option>
     132                <option value="#fff2a8">Golden</option>
     133                <option value="#F25555">Red</option>
     134                <option value="#FFD700">Yellow</option>
     135                <option value="#FFB6C1">Pink</option>
     136                <option value="#191970">Midnight Blue</option>             
     137            </select>
     138            <input type="text" name="textColor" value="<?php echo get_option('kush_mn_color_text');?>" />
     139        </div>
    97140        <div class="options">
    98141            <label for="chkHover">Enable link hover effect:</label>
    99142            <input type="checkbox" name="chkHover" value="true" <?php $lHov=get_option('kush_mn_show_linkclean');if($lHov=='true'){echo 'checked';}?>/>
    100143        </div>
     144
    101145        <h3>Input Settings :</h3>
    102146        <div class="options">
     
    105149            <h5 style="display:inline-block;margin:0;">(Try not to use improper markup if HTML parsing is enabled otherwise it could break up your whole site.)</h5>
    106150        </div>
     151       
    107152        <br/><br/>
    108153        <input type="hidden" name="valSub" value="submitted"/>
     
    115160   
    116161</div>
     162<script type="text/javascript">
     163    function check_custom_color(obj,elem){
     164        var form = document.getElementById('mirco-news-config');   
     165        if(elem == 'title')
     166            form.titleColor.value = obj.value;
     167        else
     168            form.textColor.value = obj.value;
     169    }   
     170</script>
    117171<?php
    118172}
  • kush-micro-news/trunk/includes/core.php

    r872168 r949294  
    22
    33function kush_micro_news_output($no_of_news=0){
     4    //this is responsible for displaying the final output to user site in widgets or anywhere this function is called!
    45
    56global $wpdb;
    67$table_name = $wpdb->prefix . "kushmicronews";
    78
    8     $color = array('#55A4F2','#8bbf36','#fff2a8','#33363B',' #F25555','#222','#999966','#FF66FF'); $i=0;
     9    $color = array('#55A4F2','#8bbf36','#fff2a8','#33363B',' #F25555','#222','#999966','#FF66FF');
     10    $i=0;//counter for multiple colors.
    911    if($no_of_news==0)
    1012        {$no_of_news=get_option( "kush_mn_num_news");}
     
    1214    $cleanHov=get_option('kush_mn_show_linkclean');
    1315    $widgetName = get_option('kush_mn_widget_name');
    14      ?>
    15 <?php $rows = $wpdb->get_results( "SELECT * FROM `$table_name` ORDER BY `time` DESC LIMIT 0,$no_of_news ;" );
     16    $titleColor = get_option('kush_mn_color_title');
     17    $textColor = get_option('kush_mn_color_text');
     18   
     19    $rows = $wpdb->get_results( "SELECT * FROM `$table_name` ORDER BY `time` DESC LIMIT 0, $no_of_news ");
    1620?>
     21
    1722<div id="micro-news" class="clearfix">
    18 <h2 class="head"><strong><?php echo $widgetName; ?></strong></h2>
    19 <?php
    20 foreach ( $rows as $row )
    21 {   
    22  ?>
    23     <div class="wrapNews <?php echo $row->id;?>" style="border-color:<?php if($showBorder=='true'){echo $color[$i];}?>">
    24         <h3 class="title"><?php echo $row->name;?></h3>     
    25         <div class="text"><?php echo $row->text;?>
    26             <span class="postedOn"> on <?php $date=strtotime($row->time); echo date('d M Y',$date);?></span>
    27         </div>
    28        
    29         <?php if($row->url):?>
    30         <span class="link <?php if($cleanHov!='true'){echo 'clean';}?>"><a href="<?php echo $row->url;?>" title="<?php echo $row->name;?>" target="_blank">Read Full story &raquo;</a></span>
    31         <?php endif;?>
    32     </div>
     23    <h2 class="head"><strong><?php echo $widgetName; ?></strong></h2>
     24    <?php
     25    foreach ( $rows as $row )
     26    {   
     27    ?> 
     28        <div class="wrapNews <?php echo $row->id;?>" style="border-color:<?php if($showBorder=='true'){echo $color[$i];}?>">
     29            <h3 class="title" style="color:<?php echo $titleColor?>"><?php echo $row->name;?></h3>     
     30            <div class="text" style="color:<?php echo $textColor?>"><?php echo $row->text;?>
     31                <span class="postedOn"> on <?php $date=strtotime($row->time); echo date('d M Y',$date);?></span>
     32            </div>
     33           
     34            <?php if($row->url):?>
     35            <span class="link <?php if($cleanHov!='true'){echo 'clean';}?>"><a href="<?php echo $row->url;?>" title="<?php echo $row->name;?>" target="_blank">Read Full story &raquo;</a></span>
     36            <?php endif;?>
     37        </div>
    3338   
    34 <?php
    35     if($i>=7)
    36         $i=0;
    37     else
    38         $i++;   
    39        
     39    <?php
     40        if($i>=7)
     41            $i=0;
     42        else
     43            $i++;   
     44           
    4045    }//foreach loop
    41 ?>
    42 </div><?php //micro news ends
     46    ?>
     47</div>
     48<?php //micro news ends
     49}//kush_micro_news_output function ends
    4350
    44 }
    45 /////////////////////////////////////////////////////////////////////////////////////
     51//////----------------------///////
    4652
     53//this will handle the admin page of Micro news
    4754function kush_micro_news_output_admin(){
    4855
     
    130137                    <strong>Reference Link : </strong><span id="mn-link-<?php echo $row->id;?>"><?php echo $row->url;?></a></span>
    131138                </div>
    132                 <input type="button" value="edit" class="button-primary editB" data-id="mn-edit-<?php echo $row->id;?>"/>
     139                <input type="button" value="Edit" class="button-primary editB" data-id="mn-edit-<?php echo $row->id;?>"/>
    133140                <input type="button" value="Delete" class="button-primary delB"/>
    134141                <span class="closeB">x</span>
  • kush-micro-news/trunk/index.php

    r872168 r949294  
    33Plugin Name: Kush Micro News
    44Description: Spread the news in shortest possible way. Use links to refer data and title to concise it.
    5 Version: 1.3.3
     5Version: 1.3.4
    66Author: Kush Sharma
    77Author Email: thekushsharma@gmail.com
    88Author URI: http://softnuke.com/
    99Plugin URI: https://github.com/kushsharma/micro-news
    10 Last Officially Updated: 9 March 2014
     10Last Officially Updated: 15 July 2014
    1111*/
    1212
     
    2424add_action('wp_enqueue_scripts','kush_micronews_load_depen');
    2525add_action('admin_enqueue_scripts','kush_micronews_load_depen');
     26
     27//load dependent libraries
    2628function kush_micronews_load_depen(){
    2729
     
    5153
    5254register_activation_hook(__FILE__, 'kush_micronews_activation');
    53 register_deactivation_hook(__FILE__, 'msp_micronews_deactivation');
    54 
     55register_deactivation_hook(__FILE__, 'kush_micronews_deactivation');
    5556
    5657class KushMNWidget extends WP_Widget {
     
    8687           
    8788           
    88         $instance = wp_parse_args(
    89             (array)$instance,
    90                 array(
    91                     'no_news' => ''
    92                 )
    93         );
    94             $no_news = strip_tags(stripslashes($instance['no_news']));
     89        $instance = wp_parse_args((array)$instance, array('no_news' => ''));
     90
     91        $no_news = strip_tags(stripslashes($instance['no_news']));
    9592           
    9693?>
     
    105102           
    106103<?php
    107         }
    108        
    109        
    110     }
     104        }//form ends       
     105}//class ends
     106
     107//this will add micro news widget along with all wordpress widgets
    111108function kush_mn_reg_widg(){
    112109    register_widget( "KushMNWidget" );
     
    115112   
    116113
    117 function kush_micronews_activation() {
    118    
     114function kush_micronews_activation() {   
    119115    //actions to perform once on plugin activation go here     
    120116   
    121 function kush_mn_install () {
    122    global $wpdb;
    123    $table_name = $wpdb->prefix . "kushmicronews";
    124     require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
     117    function kush_mn_install(){
     118        global $wpdb;
     119        $table_name = $wpdb->prefix . "kushmicronews";
     120        require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
    125121
    126     $ver=get_option("kush_mn_db_version");
    127    
    128 if($wpdb->get_var("SHOW TABLES LIKE '".$table_name."';")!=$table_name)   
    129 {   
    130     $query = "CREATE TABLE $table_name (
    131       id mediumint(9) PRIMARY KEY AUTO_INCREMENT,
    132       time datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
    133       name mediumtext NOT NULL,
    134       text text NOT NULL,
    135       url tinytext
    136     );";
    137    
    138     dbDelta( $query );
     122        $ver=get_option("kush_mn_db_version");
     123       
     124    if($wpdb->get_var("SHOW TABLES LIKE '".$table_name."';")!=$table_name)   
     125    {   
     126        $query = "CREATE TABLE $table_name (
     127          id mediumint(9) PRIMARY KEY AUTO_INCREMENT,
     128          time datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
     129          name mediumtext NOT NULL,
     130          text text NOT NULL,
     131          url tinytext
     132        );";
     133       
     134        dbDelta( $query );
    139135
    140136
    141137
    142   $welcome_name = "Ms. WordPress";
    143   $welcome_text = "Congratulations, you just completed the installation! Delete or edit this news.";
    144   $welcome_link = "http://www.softnuke.com";
     138      $welcome_name = "Ms. WordPress";
     139      $welcome_text = "Congratulations, you just completed the installation! Delete or edit this news.";
     140      $welcome_link = "http://www.softnuke.com";
     141      $rows_affected = $wpdb->insert( $table_name, array( 'time' => current_time('mysql'), 'name' => $welcome_name, 'text' =>$welcome_text, 'url' => $welcome_link ) );
     142    }
     143     
     144     
    145145
    146   $rows_affected = $wpdb->insert( $table_name, array( 'time' => current_time('mysql'), 'name' => $welcome_name, 'text' =>$welcome_text, 'url' => $welcome_link ) );
    147 }
    148  
    149   add_option( "kush_mn_db_version", "1.0" );
    150   //setting default values
    151   add_option( "kush_mn_num_news","5");
    152   add_option( "kush_mn_show_lborder",'true');
    153   add_option('kush_mn_show_linkclean','true');
    154   add_option('kush_mn_parse_html','true');
    155   add_option('kush_mn_widget_name','Micro News');
    156  
    157 }
    158 kush_mn_install ();
     146        //setting default values
     147        add_option( "kush_mn_db_version", "1.0" );
     148        add_option( "kush_mn_num_news","5");
     149        add_option( "kush_mn_show_lborder",'true');
     150        add_option('kush_mn_show_linkclean','true');
     151        add_option('kush_mn_parse_html','true');
     152        add_option('kush_mn_widget_name','Micro News');
     153        add_option('kush_mn_color_title','#0066cc');
     154        add_option('kush_mn_color_text','#666666');
     155     
     156    }
     157    kush_mn_install(); 
    159158   
    160159}
     
    167166
    168167
    169 
    170 
     168// misc functions
    171169function sanitize($data){
    172170    return htmlentities($data);
  • kush-micro-news/trunk/readme.txt

    r872168 r949294  
    22Contributors: kushsharma
    33Donate link: http://www.softnuke.com/
    4 Tags: post,news,micro,short,share,link,kush,refer,short
     4Tags: post,news,micro,short,share,link,kush,refer,concise,fast
    55Requires at least: 3.0.1
    6 Tested up to: 3.8.1
    7 Stable tag: 1.3.3
     6Tested up to: 3.9.1
     7Stable tag: 1.3.4
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    2828*   You can add new news from your wordpress panel with easy GUI interface.
    2929*   Edit/Delete old news if you have messed up something.
    30 *   It is already styled with cool rainbow like colors(am not kidding).
     30*   It is already styled with cool rainbow like colors(not kidding).
    3131*   Can be installed anywhere, but looks good in sidebar.
    3232*   Comes with widget, can be placed where you like.
     33*   Colors of text and title can be changed from settings.
    3334*   Developed and maintained by a single guy, so be kind while reporting bugs and don't forget to rate. Thats it!
    3435   
     
    6263Many of your website styles will automatically blend in nicely. I am trying to look as cool as possible. However, you can makes changes to our styles by overiding your own CSS in your stylesheet.
    6364
    64 = Do i have to do anything else ? =
     65= Do i have to do anything else? =
    6566
    6667No. Just sit back and start adding micro news.
     
    7475
    7576== Changelog ==
     77
     78= 1.3.5 =
     79* Option to change title and text color.
     80* Misc updates.
    7681
    7782= 1.3.3 =
     
    136141This enable and disable hover effect comes over Refer Link.
    137142
     143* Text and Title color --
     144You can change the color of news text and title from available options but if you want to add your own then use hexadecimal format. Eg. #E2E2E2
     145
    138146* Allow HTML parsing while adding news --
    139147This enable and disable HTML parsing when you are going to add new news or update an old one. If the box is checked, then all html tags will be parsed as DOM. But if it is disabled then HTML tags will treat as HTML entities. Try not to use improper markup if HTML parsing is enabled otherwise it could break up your whole site.
    140148**Note:** Also avoid using <h1-6> heading tags in title, because it will overide my default heading tag and mess up markup.
    141149
    142 Styling :
    143 
    144 * If you want to customize the look of this plugin, feel free to do so by editing CSS file present in "assets/css/style.css". For now you have to do it manually, later i will add GUI interface of customizing it.
     150* Styling --
     151If you want to customize the look of this plugin, feel free to do so by editing CSS file present in "assets/css/style.css". For now you have to do it manually, later i will add GUI interface of customizing it.
  • kush-micro-news/trunk/uninstall.php

    r724282 r949294  
    11<?php
    22
    3 if(defined(WP_UNINSTALL_PLUGIN))
    4 {exit;}
     3//if uninstall not called from WordPress exit
     4if ( !defined( 'WP_UNINSTALL_PLUGIN' ) )
     5    exit();
    56
     7//delete all registered options
    68delete_option('kush_mn_db_version');
    79delete_option('kush_mn_num_news');
     
    911delete_option('kush_mn_show_linkclean');
    1012delete_option('kush_mn_parse_html');
     13delete_option('kush_mn_widget_name');
     14delete_option('kush_mn_color_title');
     15delete_option('kush_mn_color_text');
    1116
    1217global $wpdb;
    13    $table_name = $wpdb->prefix . "kushmicronews";
     18    $table_name = $wpdb->prefix . "kushmicronews";
    1419   
    15    $query = "DROP TABLE $table_name";
     20    $query = "DROP TABLE IF EXISTS $table_name";
    1621   
    1722    $wpdb->query($query);
Note: See TracChangeset for help on using the changeset viewer.