Changeset 949294
- Timestamp:
- 07/16/2014 03:30:25 AM (12 years ago)
- Location:
- kush-micro-news/trunk
- Files:
-
- 7 edited
-
assets/css/style.css (modified) (8 diffs)
-
assets/js/script.js (modified) (6 diffs)
-
includes/admin.php (modified) (9 diffs)
-
includes/core.php (modified) (3 diffs)
-
index.php (modified) (7 diffs)
-
readme.txt (modified) (5 diffs)
-
uninstall.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
kush-micro-news/trunk/assets/css/style.css
r872168 r949294 49 49 } 50 50 51 .wrapNews .title{51 #micro-news .wrapNews .title{ 52 52 color:#0066cc; 53 53 font-size:15px; … … 57 57 } 58 58 59 .wrapNews .text{59 #micro-news .wrapNews .text{ 60 60 padding-bottom:20px; 61 61 position: relative; 62 62 } 63 63 64 .wrapNews .postedOn{64 #micro-news .wrapNews .postedOn{ 65 65 font-size:10px; 66 66 border-bottom:2px solid #CCC; … … 70 70 } 71 71 72 .wrapNews .link{72 #micro-news .wrapNews .link{ 73 73 position:absolute; 74 74 right:5px; … … 77 77 } 78 78 79 .wrapNews .link:hover{79 #micro-news .wrapNews .link:hover{ 80 80 background-color:#8bbf36; 81 81 } 82 82 83 .wrapNews .clean:hover{83 #micro-news .wrapNews .clean:hover{ 84 84 background-color:transparent; 85 85 } 86 86 87 .wrapNews .link a{87 #micro-news .wrapNews .link a{ 88 88 color:#8bbf36 ; 89 89 } 90 90 91 .wrapNews .link a:visited{91 #micro-news .wrapNews .link a:visited{ 92 92 color:#8bbf36 ; 93 93 } 94 94 95 .wrapNews .link a:hover{95 #micro-news .wrapNews .link a:hover{ 96 96 color:black; 97 97 } … … 109 109 110 110 #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; 116 116 117 117 } … … 119 119 #micro-news .closeB{ 120 120 margin-top:1px; 121 padding: 4px 5px 4px 5px;121 padding:3px 5px 3px 5px; 122 122 color: #fff; 123 123 background: #21759b; … … 125 125 position:absolute; 126 126 top:0px; 127 right:0px; 128 width:5px; 127 right:0px; 128 width:5px; 129 129 130 130 -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; 135 135 } 136 136 137 137 #micro-news .closeB:hover{ 138 138 -webkit-border-radius: 1px; 139 border-radius: 1px;139 border-radius: 1px; 140 140 } 141 141 … … 211 211 } 212 212 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 213 224 /* ----Admin ends ----*/ 214 225 -
kush-micro-news/trunk/assets/js/script.js
r734004 r949294 1 1 jQuery(function ($) { 2 $(document).ready(function(){3 2 4 5 $('#micro-news .editB').click(function(){ 6 3 $(document).on('click','#micro-news .editB',function(){ 7 4 8 5 parent=$(this).parent(); … … 14 11 var link=$('#mn-link-'+id).html(); 15 12 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>'; 17 18 18 19 … … 25 26 parent.addClass('open'); 26 27 28 //show cross sign 29 //$("#micro-news .closeB").attr('visibility','visible'); 30 27 31 $(this).attr('value','Update');} 28 32 else 29 33 { 34 //hide cross sign 35 //$("#micro-news .closeB").attr('visibility','hidden'); 36 30 37 31 38 title=$('#update-micro-news .title-updated').val(); … … 51 58 }); 52 59 53 54 $('#micro-news .delB').click(function(){ 60 $(document).on('click','#micro-news .delB',function(){ 55 61 parent=$(this).parent(); 56 62 … … 69 75 }); 70 76 71 $('#micro-news .closeB').click(function(){ 77 $(document).on('click','#micro-news .closeB',function(){ 78 72 79 parent=$(this).parent(); 73 80 … … 81 88 }); 82 89 90 83 91 }); 84 }); -
kush-micro-news/trunk/includes/admin.php
r872168 r949294 16 16 $what=''; 17 17 if(isset($_POST['valSub'])) 18 {18 { 19 19 if(isset($_POST['numPost'])) 20 20 { … … 32 32 if(isset($_POST['myRename'])) 33 33 { 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']); 38 36 $what='Changes Saved !'; 39 37 } … … 58 56 } 59 57 else 60 update_option('kush_mn_show_linkclean','false');58 update_option('kush_mn_show_linkclean','false'); 61 59 62 60 if(isset($_POST['chkHtmlParse'])) … … 67 65 } 68 66 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 72 82 73 83 … … 79 89 <?php echo ($what!='')?'<div class="updated"><p><strong>'.$what.'</strong></p></div>':''; ?> 80 90 <br/> 81 <form action="" method="post" >91 <form action="" method="post" id="mirco-news-config"> 82 92 <h3>Functional Settings :</h3> 83 93 <div class="options"> … … 86 96 <h5 style="display:inline-block;margin:0;">(via kush_micro_news_output() function)</h5> 87 97 </div> 98 88 99 <h3>Display Settings :</h3> 89 100 <div class="options"> … … 91 102 <input type="text" name="myRename" value="<?php echo get_option("kush_mn_widget_name");?>"/> 92 103 <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"> 94 106 <label for="chkBorder">Enable colorful borders:</label> 95 107 <input type="checkbox" name="chkBorder" value="true" <?php $sBor=get_option('kush_mn_show_lborder');if($sBor=='true'){echo 'checked';}?>/> 96 108 </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> 97 140 <div class="options"> 98 141 <label for="chkHover">Enable link hover effect:</label> 99 142 <input type="checkbox" name="chkHover" value="true" <?php $lHov=get_option('kush_mn_show_linkclean');if($lHov=='true'){echo 'checked';}?>/> 100 143 </div> 144 101 145 <h3>Input Settings :</h3> 102 146 <div class="options"> … … 105 149 <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> 106 150 </div> 151 107 152 <br/><br/> 108 153 <input type="hidden" name="valSub" value="submitted"/> … … 115 160 116 161 </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> 117 171 <?php 118 172 } -
kush-micro-news/trunk/includes/core.php
r872168 r949294 2 2 3 3 function 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! 4 5 5 6 global $wpdb; 6 7 $table_name = $wpdb->prefix . "kushmicronews"; 7 8 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. 9 11 if($no_of_news==0) 10 12 {$no_of_news=get_option( "kush_mn_num_news");} … … 12 14 $cleanHov=get_option('kush_mn_show_linkclean'); 13 15 $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 "); 16 20 ?> 21 17 22 <div id="micro-news" class="clearfix"> 18 <h2 class="head"><strong><?php echo $widgetName; ?></strong></h2>19 <?php20 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 »</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 »</a></span> 36 <?php endif;?> 37 </div> 33 38 34 <?php35 if($i>=7)36 $i=0;37 else38 $i++;39 39 <?php 40 if($i>=7) 41 $i=0; 42 else 43 $i++; 44 40 45 }//foreach loop 41 ?> 42 </div><?php //micro news ends 46 ?> 47 </div> 48 <?php //micro news ends 49 }//kush_micro_news_output function ends 43 50 44 } 45 ///////////////////////////////////////////////////////////////////////////////////// 51 //////----------------------/////// 46 52 53 //this will handle the admin page of Micro news 47 54 function kush_micro_news_output_admin(){ 48 55 … … 130 137 <strong>Reference Link : </strong><span id="mn-link-<?php echo $row->id;?>"><?php echo $row->url;?></a></span> 131 138 </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;?>"/> 133 140 <input type="button" value="Delete" class="button-primary delB"/> 134 141 <span class="closeB">x</span> -
kush-micro-news/trunk/index.php
r872168 r949294 3 3 Plugin Name: Kush Micro News 4 4 Description: Spread the news in shortest possible way. Use links to refer data and title to concise it. 5 Version: 1.3. 35 Version: 1.3.4 6 6 Author: Kush Sharma 7 7 Author Email: thekushsharma@gmail.com 8 8 Author URI: http://softnuke.com/ 9 9 Plugin URI: https://github.com/kushsharma/micro-news 10 Last Officially Updated: 9 March201410 Last Officially Updated: 15 July 2014 11 11 */ 12 12 … … 24 24 add_action('wp_enqueue_scripts','kush_micronews_load_depen'); 25 25 add_action('admin_enqueue_scripts','kush_micronews_load_depen'); 26 27 //load dependent libraries 26 28 function kush_micronews_load_depen(){ 27 29 … … 51 53 52 54 register_activation_hook(__FILE__, 'kush_micronews_activation'); 53 register_deactivation_hook(__FILE__, 'msp_micronews_deactivation'); 54 55 register_deactivation_hook(__FILE__, 'kush_micronews_deactivation'); 55 56 56 57 class KushMNWidget extends WP_Widget { … … 86 87 87 88 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'])); 95 92 96 93 ?> … … 105 102 106 103 <?php 107 } 108 109 110 } 104 }//form ends 105 }//class ends 106 107 //this will add micro news widget along with all wordpress widgets 111 108 function kush_mn_reg_widg(){ 112 109 register_widget( "KushMNWidget" ); … … 115 112 116 113 117 function kush_micronews_activation() { 118 114 function kush_micronews_activation() { 119 115 //actions to perform once on plugin activation go here 120 116 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' ); 125 121 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 tinytext136 );";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 ); 139 135 140 136 141 137 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 145 145 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(); 159 158 160 159 } … … 167 166 168 167 169 170 168 // misc functions 171 169 function sanitize($data){ 172 170 return htmlentities($data); -
kush-micro-news/trunk/readme.txt
r872168 r949294 2 2 Contributors: kushsharma 3 3 Donate link: http://www.softnuke.com/ 4 Tags: post,news,micro,short,share,link,kush,refer, short4 Tags: post,news,micro,short,share,link,kush,refer,concise,fast 5 5 Requires at least: 3.0.1 6 Tested up to: 3. 8.17 Stable tag: 1.3. 36 Tested up to: 3.9.1 7 Stable tag: 1.3.4 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 28 28 * You can add new news from your wordpress panel with easy GUI interface. 29 29 * Edit/Delete old news if you have messed up something. 30 * It is already styled with cool rainbow like colors( amnot kidding).30 * It is already styled with cool rainbow like colors(not kidding). 31 31 * Can be installed anywhere, but looks good in sidebar. 32 32 * Comes with widget, can be placed where you like. 33 * Colors of text and title can be changed from settings. 33 34 * Developed and maintained by a single guy, so be kind while reporting bugs and don't forget to rate. Thats it! 34 35 … … 62 63 Many 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. 63 64 64 = Do i have to do anything else ? =65 = Do i have to do anything else? = 65 66 66 67 No. Just sit back and start adding micro news. … … 74 75 75 76 == Changelog == 77 78 = 1.3.5 = 79 * Option to change title and text color. 80 * Misc updates. 76 81 77 82 = 1.3.3 = … … 136 141 This enable and disable hover effect comes over Refer Link. 137 142 143 * Text and Title color -- 144 You 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 138 146 * Allow HTML parsing while adding news -- 139 147 This 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. 140 148 **Note:** Also avoid using <h1-6> heading tags in title, because it will overide my default heading tag and mess up markup. 141 149 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 -- 151 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. -
kush-micro-news/trunk/uninstall.php
r724282 r949294 1 1 <?php 2 2 3 if(defined(WP_UNINSTALL_PLUGIN)) 4 {exit;} 3 //if uninstall not called from WordPress exit 4 if ( !defined( 'WP_UNINSTALL_PLUGIN' ) ) 5 exit(); 5 6 7 //delete all registered options 6 8 delete_option('kush_mn_db_version'); 7 9 delete_option('kush_mn_num_news'); … … 9 11 delete_option('kush_mn_show_linkclean'); 10 12 delete_option('kush_mn_parse_html'); 13 delete_option('kush_mn_widget_name'); 14 delete_option('kush_mn_color_title'); 15 delete_option('kush_mn_color_text'); 11 16 12 17 global $wpdb; 13 $table_name = $wpdb->prefix . "kushmicronews";18 $table_name = $wpdb->prefix . "kushmicronews"; 14 19 15 $query = "DROP TABLE$table_name";20 $query = "DROP TABLE IF EXISTS $table_name"; 16 21 17 22 $wpdb->query($query);
Note: See TracChangeset
for help on using the changeset viewer.