Changeset 949573
- Timestamp:
- 07/16/2014 11:29:30 AM (12 years ago)
- Location:
- kush-micro-news/trunk
- Files:
-
- 6 edited
-
assets/css/style.css (modified) (2 diffs)
-
includes/admin.php (modified) (4 diffs)
-
includes/core.php (modified) (4 diffs)
-
index.php (modified) (5 diffs)
-
readme.txt (modified) (7 diffs)
-
uninstall.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
kush-micro-news/trunk/assets/css/style.css
r949376 r949573 134 134 #micro-news-board .editB{ 135 135 float:right; 136 width: 50px;136 width:70px; 137 137 position:absolute; 138 138 top:0px; 139 right: 25px;139 right:45px; 140 140 } 141 141 … … 242 242 243 243 #add-micro-news input[type=submit]{ 244 width:100px; 245 padding: 5px; 244 width:100px; 246 245 } 247 246 -
kush-micro-news/trunk/includes/admin.php
r949376 r949573 75 75 76 76 if(isset($_POST['titleColor']) && $_POST['titleColor']!="") 77 { 78 update_option( "kush_mn_color_title",$_POST['titleColor']); 79 $what='Changes Saved !'; 80 } 81 82 77 { 78 update_option( "kush_mn_color_title",$_POST['titleColor']); 79 $what='Changes Saved !'; 80 } 81 82 if(isset($_POST['linkColorField']) && $_POST['linkColorField']!="") 83 { 84 update_option( "kush_mn_color_link",$_POST['linkColorField']); 85 $what='Changes Saved !'; 86 } 83 87 84 88 } … … 102 106 <input type="text" name="myRename" value="<?php echo get_option("kush_mn_widget_name");?>"/> 103 107 <h5 style="display:inline-block;margin:0;">(Try not to use any special character like inverted commas)</h5> 104 </div> 105 <div class="options"> 106 <label for="chkBorder">Enable colorful borders:</label> 107 <input type="checkbox" name="chkBorder" value="true" <?php $sBor=get_option('kush_mn_show_lborder');if($sBor=='true'){echo 'checked';}?>/> 108 </div> 108 </div> 109 109 <div class="options"> 110 110 <label for="titleColor">Title Color:</label> … … 139 139 </div> 140 140 <div class="options"> 141 <label for="linkColorField">Link Color:</label> 142 <input type="text" name="linkColorField" value="<?php echo get_option('kush_mn_color_link');?>" /> 143 <select name="linkColorList" onclick="check_custom_color(this,'link')"> 144 <option value="#8bbf36">Green [Default]</option> 145 <option value="#666666">Grey</option> 146 <option value="#0066CC">Light Blue</option> 147 <option value="#000000">Black</option> 148 <option value="#fff2a8">Golden</option> 149 <option value="#F25555">Red</option> 150 <option value="#FFD700">Yellow</option> 151 <option value="#FFB6C1">Pink</option> 152 <option value="#191970">Midnight Blue</option> 153 </select> 154 </div> 155 <div class="options"> 156 <label for="chkBorder">Enable colorful borders:</label> 157 <input type="checkbox" name="chkBorder" value="true" <?php $sBor=get_option('kush_mn_show_lborder');if($sBor=='true'){echo 'checked';}?>/> 158 </div> 159 <div class="options"> 141 160 <label for="chkHover">Enable link hover effect:</label> 142 161 <input type="checkbox" name="chkHover" value="true" <?php $lHov=get_option('kush_mn_show_linkclean');if($lHov=='true'){echo 'checked';}?>/> … … 165 184 if(elem == 'title') 166 185 form.titleColor.value = obj.value; 167 else 186 else if(elem == 'text') 168 187 form.textColor.value = obj.value; 188 else 189 form.linkColorField.value = obj.value; 169 190 } 170 191 </script> -
kush-micro-news/trunk/includes/core.php
r949376 r949573 1 1 <?php 2 2 3 function kush_micro_news_output($no_of_news=0 ){3 function kush_micro_news_output($no_of_news=0,$header="true"){ 4 4 //this is responsible for displaying the final output to user site in widgets or anywhere this function is called! 5 5 //$header attribute will decide whether to show Micro News Header or not 6 6 global $wpdb; 7 7 $table_name = $wpdb->prefix . "kushmicronews"; 8 8 9 $color = array('#55A4F2','#8bbf36','#fff2a8','#33363B',' #F25555','#222','#999966','#FF66FF');9 $color = array('#55A4F2','#8bbf36','#fff2a8','#33363B','#F25555','#666666','#999966','#FF66FF'); 10 10 $i=0;//counter for multiple colors. 11 11 if($no_of_news==0) … … 16 16 $titleColor = get_option('kush_mn_color_title'); 17 17 $textColor = get_option('kush_mn_color_text'); 18 $linkColor = get_option('kush_mn_color_link'); 18 19 19 20 $rows = $wpdb->get_results( "SELECT * FROM `$table_name` ORDER BY `time` DESC LIMIT 0, $no_of_news "); 20 ?>21 21 22 <div id="micro-news" class="clearfix"> 23 <h2 class="head"><strong><?php echo $widgetName; ?></strong></h2> 24 <?php 25 foreach ( $rows as $row ) 22 $output_html = "";//this will contain final output 23 24 25 $output_html .= '<div id="micro-news" class="clearfix">'; 26 27 if($header=="true"){ 28 $output_html .= '<h2 class="head"><strong>'.$widgetName.'</strong></h2>'; 29 }//header if closed 30 31 32 foreach ( $rows as $row ) 26 33 { 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> 34 $date=strtotime($row->time); 35 $formateddate = date('d M Y',$date); 36 37 $output_html .='<div class="wrapNews '.$row->id.'" style="border-color:'; 38 if($showBorder=='true')//check border color 39 {$output_html .=$color[$i];} 40 $output_html .='">'; 41 42 //show title 43 $output_html .='<h3 class="title" style="color:'.$titleColor.'">'.$row->name.'</h3>'; 44 45 //show text 46 $output_html .='<div class="text" style="color:'.$textColor.'">'.$row->text.' '; 47 $output_html .='<span class="postedOn"> on '.$formateddate.'</span>'; 48 $output_html .='</div>'; 33 49 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> 50 //show url if present 51 if($row->url): 52 $output_html .='<span class="link '; 53 if($cleanHov!='true')//check if show link color inverted 54 $output_html .='clean'; 55 $output_html .='"><a href="'.$row->url.'" title="'.$row->name.'" target="_blank" style="color:'.$linkColor.'">Read Full story »</a></span>'; 56 endif; 57 58 $output_html .='</div>';//wrapNews ends 38 59 39 <?php60 //this will reloop border color 40 61 if($i>=7) 41 62 $i=0; … … 44 65 45 66 }//foreach loop 46 ?> 47 </div> 48 <?php //micro news ends 67 68 $output_html .='</div>';//micro news ends 69 70 return $output_html; 49 71 }//kush_micro_news_output function ends 50 72 … … 165 187 } 166 188 167 168 169 189 ?> -
kush-micro-news/trunk/index.php
r949376 r949573 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.4. 05 Version: 1.4.1 6 6 Author: Kush Sharma 7 7 Author Email: thekushsharma@gmail.com … … 21 21 } 22 22 add_action('init','kush_micronews_load_depen_reg'); 23 add_action('init','kush_micronews_create_shortcode'); 23 24 24 25 add_action('wp_enqueue_scripts','kush_micronews_load_depen'); 25 26 add_action('admin_enqueue_scripts','kush_micronews_load_depen'); 26 27 28 29 function kush_micronews_load_depen(){ 27 30 //load dependent libraries 28 function kush_micronews_load_depen(){29 30 31 if(is_admin()) 31 32 {//load admin files only in admin … … 52 53 kush_micronews_load(); 53 54 55 function kush_micronews_create_shortcode(){ 56 // this will create shortcode [kushmicronews news="5" header="true"] 57 58 function micronews_shortcode( $atts ) { 59 $a = shortcode_atts( array( 'news' => '5', 'header' => 'true' ), $atts ); 60 61 return kush_micro_news_output($a['news'],$a['header']); 62 } 63 add_shortcode( 'kushmicronews', 'micronews_shortcode' ); 64 } 65 66 54 67 register_activation_hook(__FILE__, 'kush_micronews_activation'); 55 68 register_deactivation_hook(__FILE__, 'kush_micronews_deactivation'); … … 70 83 71 84 echo $before_widget; 72 kush_micro_news_output($no_news);85 echo kush_micro_news_output($no_news); 73 86 echo $after_widget; 74 87 } … … 153 166 add_option('kush_mn_color_title','#0066cc'); 154 167 add_option('kush_mn_color_text','#666666'); 168 add_option('kush_mn_color_link','#8bbf36;'); 155 169 156 170 } 157 kush_mn_install(); 158 171 kush_mn_install(); 172 159 173 } 160 174 -
kush-micro-news/trunk/readme.txt
r949376 r949573 5 5 Requires at least: 3.0.1 6 6 Tested up to: 3.9.1 7 Stable tag: 1.4. 07 Stable tag: 1.4.1 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 26 26 How much better can a plugin be ? Wait there is more : 27 27 28 * You can add new news from your wordpress panel with easy GUI interface.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 30 * It is already styled with cool rainbow like colors(not kidding). … … 32 32 * Comes with widget, can be placed where you like. 33 33 * Colors of text and title can be changed from settings. 34 * Shortcode to output news in post and pages. 34 35 * Developed and maintained by a single guy, so be kind while reporting bugs and don't forget to rate. Thats it! 35 36 … … 40 41 1. Upload `micro-news-kush` folder to the `/wp-content/plugins/` directory 41 42 2. Activate the plugin through the 'Plugins' menu in WordPress 42 3. Place `<?php if(function_exists('kush_micro_news_output')){ kush_micro_news_output();} ?>` in your template file.43 3. Place `<?php if(function_exists('kush_micro_news_output')){echo kush_micro_news_output();} ?>` in your template file. 43 44 4. You can also use Kush Micro News Widget to place in your desired location. 45 5. Shortcode [kushmicronews] is also available to show news in a page or post. 44 46 45 47 * The location where you gonna output this plugin should have atleast 200px width to present itself well. … … 59 61 All of your data is stored in a seperate table inside wordpress database, you can download backup in (.sql) extension anytime you want. This feature is available in Settings page. 60 62 63 = How can i show news in a page or post? = 64 65 Use shortcode '[kushmicronews news="5" header="true"]' inside wordpress editor where you want news to display itself. You can use this in any of your page or post but keep in mind that page should have enough free space for all the content. 66 - 'news' attribute will decide how many news should be displayed. Default : 5 67 - 'header' attribute will decide whether "Micro News" header is visible. It takes two parameters "true" or "false". Default : "true" 68 61 69 = Will it look like the rest of my site? = 62 70 … … 75 83 76 84 == Changelog == 85 86 = 1.4.1 = 87 * Added feature of shortcode to output news in post & pages 88 * Can change link color 89 * Minor Visual Bug Fix. 77 90 78 91 = 1.4.0 = … … 115 128 116 129 = 1.0.1 = 117 * Database connectivity fixed 130 * Database connectivity fixed. 118 131 119 132 = 1.0 = -
kush-micro-news/trunk/uninstall.php
r949294 r949573 14 14 delete_option('kush_mn_color_title'); 15 15 delete_option('kush_mn_color_text'); 16 delete_option('kush_mn_color_link'); 16 17 17 18 global $wpdb;
Note: See TracChangeset
for help on using the changeset viewer.