Changeset 616397
- Timestamp:
- 10/23/2012 05:20:36 PM (13 years ago)
- Location:
- simplicy-random-post/trunk
- Files:
-
- 1 added
- 5 edited
-
css/admin.css (added)
-
func/function.php (modified) (7 diffs)
-
readme.txt (modified) (1 diff)
-
screenshot-1.jpg (modified) (previous)
-
screenshot-2.jpg (modified) (previous)
-
sp-random-post.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
simplicy-random-post/trunk/func/function.php
r609758 r616397 13 13 $_num_cat=$_GET['cat']; 14 14 $_num_month=$_GET['month']; 15 $_thumbsrand=$_GET['thumbsrand']; 15 $_thumb_w=$_GET['thumb_w']; 16 $_thumb_h=$_GET['thumb_h']; 16 17 $_thumbsaffiche=$_GET['thumbsaffiche']; 18 $_dateaffiche=$_GET['dateaffiche']; 17 19 $_excerpt=$_GET['excerpt']; 18 20 $_length=$_GET['length']; 19 21 $_auto=$_GET['auto']; 20 22 $_time=$_GET['time']; 21 echo WARP_sp1_Random_posts("number=$_num&cat=$_num_cat&year=$_num_year&month=$_num_month&thumbsaffiche=$_thumbsaffiche& thumbsrand=$_thumbsrand&excerpt=$_excerpt&length=$_length&auto=$_auto&time=$_time");23 echo WARP_sp1_Random_posts("number=$_num&cat=$_num_cat&year=$_num_year&month=$_num_month&thumbsaffiche=$_thumbsaffiche&dateaffiche=$_dateaffiche&thumb_w=$_thumb_w&thumb_h=$_thumb_h&excerpt=$_excerpt&length=$_length&auto=$_auto&time=$_time"); 22 24 die(); 23 25 } … … 28 30 29 31 function WARP_sp1_Random_posts($args=''){ 30 $defargs=array('number' => 8,'cmtcount' => 0,'month' => 0,'year' => 0,'thumbsaffiche' => 0, 'excerpt' => 0, 'length' => 100, 'auto' => 0, 'time' => 60);32 $defargs=array('number' => 8,'cmtcount' => 0,'month' => 0,'year' => 0,'thumbsaffiche' => 0,'dateaffiche' => 0, 'excerpt' => 0, 'length' => 100, 'auto' => 0, 'time' => 60); 31 33 $args = wp_parse_args($args, $defargs);$output='';$number=$args['number'];$month=$args['month'];$year=$args['year'];$cat=$args['cat']; 32 34 … … 55 57 56 58 if (has_post_thumbnail()) { 57 $thumb = get_post_thumbnail_id(); $img_url = wp_get_attachment_url( $thumb,'full' ); $image = sp_post_ramdom_resize( $img_url, $args['thumb srand'], $args['thumbsrand'], true );59 $thumb = get_post_thumbnail_id(); $img_url = wp_get_attachment_url( $thumb,'full' ); $image = sp_post_ramdom_resize( $img_url, $args['thumb_w'], $args['thumb_h'], true ); 58 60 $output.='<div class="SP-random-post-clear-top"></div>'; 59 61 // image fin 60 if($args['thumbsaffiche']!=0)$output.='<img class="simplicy-random-post-img" width="'.$args['thumb srand'].'" height="'.$args['thumbsrand'].'" src="'.$image.'" alt="" />'; }62 if($args['thumbsaffiche']!=0)$output.='<img class="simplicy-random-post-img" width="'.$args['thumb_w'].'" height="'.$args['thumb_h'].'" src="'.$image.'" alt="" />'; } 61 63 $output.='<li id="random-post-'.get_the_ID().'" class="simplicy-random-post"><div class="random-post-title"><a title="'.get_the_title().'" href="'.get_permalink().'">'.get_the_title().'</a>'; 62 64 63 $output.='<dd class="simplicy-date_random-post">'.get_the_date().'</dd>';65 if($args['dateaffiche']!=0)$output.='<dd class="simplicy-date_random-post">'.get_the_date().'</dd>'; 64 66 65 67 $output.='</div>'; 66 68 67 if($args['excerpt']!=0)$output.='<div class="random-post-excerpt">'. WARP_SP_Random_posts_substr(strip_tags(get_the_content()),(int)$args['length']).'</div>';;69 if($args['excerpt']!=0)$output.='<div class="random-post-excerpt">'.simplicy_random_content((int)$args['length']).'</div>'; 68 70 $output.='</li><div class="SP-random-post"></div>'; 69 71 … … 72 74 endwhile; 73 75 wp_reset_query(); 74 $output.='<li id="random-post-more" class="simplicy-random-post" style="text-align:center"><div><a style="width:100%;height:100%" href="javascript:;" onclick="WARP_.get_random_posts(\'number='.$args['number'].'&month='.$args['month'].'&year='.$args['year'].'&cat='.$args['cat'].'&thumbsaffiche='.$args['thumbsaffiche'].'& excerpt='.$args['excerpt'].'&length='.$args['length'].'&thumbsrand='.$args['thumbsrand'].'&auto='.$args['auto'].'&time='.$args['time'].'\')"><div class="icon-reload"></div></a>'.($args['auto']?'<span id="refreshTime">'.$args['time'].'</span>':'').'</div></li>';76 $output.='<li id="random-post-more" class="simplicy-random-post" style="text-align:center"><div><a style="width:100%;height:100%" href="javascript:;" onclick="WARP_.get_random_posts(\'number='.$args['number'].'&month='.$args['month'].'&year='.$args['year'].'&cat='.$args['cat'].'&thumbsaffiche='.$args['thumbsaffiche'].'&dateaffiche='.$args['dateaffiche'].'&excerpt='.$args['excerpt'].'&length='.$args['length'].'&thumb_w='.$args['thumb_w'].'&thumb_h='.$args['thumb_h'].'&auto='.$args['auto'].'&time='.$args['time'].'\')"><div class="icon-reload"></div></a>'.($args['auto']?'<span id="refreshTime">'.$args['time'].'</span>':'').'</div></li>'; 75 77 return $output; 76 78 }else{ … … 113 115 'month'=>0, 114 116 'thumbsaffiche'=>false, 117 'dateaffiche'=>false, 115 118 'excerpt'=>false, 116 119 'length'=>35, 117 120 'auto'=>false, 118 121 'time'=>60)); 119 echo '<p><label for="'.$this->get_field_name('title').'">'.__('Titre du Widget', 'SP-Random-Post').'<input style="width:265px;" name="'.$this->get_field_name('title').'" type="text" value="'.htmlspecialchars($instance['title']).'" /></label></p>'; 120 echo '<p><label for="'.$this->get_field_name('number').'">'.__('Nombre d´article aléatoire', 'SP-Random-Post').'<input style="width:40px;float: right;" name="'.$this->get_field_name('number').'" type="text" value="'.htmlspecialchars($instance['number']).'" /></label></p>'; 122 echo '<p><label for="'.$this->get_field_name('title').'">'.__('Titre <small>(Title)</small>', 'SP-Random-Post').'<input style="width:100%;" name="'.$this->get_field_name('title').'" type="text" value="'.htmlspecialchars($instance['title']).'" /></label></p>'; 123 124 echo'<fieldset> 125 <legend>Articles <small>(Posts)</small></legend>'; 126 echo '<p><label for="'.$this->get_field_name('number').'">'.__('Nombre d´article aléatoire', 'SP-Random-Post').'<input style="width:40px;float: right;" name="'.$this->get_field_name('number').'" type="text" value="'.htmlspecialchars($instance['number']).'" /></label></br><small>(Random post number)</small></p>'; 121 127 122 128 // Mois de publication 123 echo '<p><label for="'.$this->get_field_name('month').'">'.__('Ici vous pouvez indiquer le mois de publication', 'SP-Random-Post').'<input style="width:40px;float: right;" name="'.$this->get_field_name('month').'" type="text" value="'.htmlspecialchars($instance['month']).'" /></label></ p>';129 echo '<p><label for="'.$this->get_field_name('month').'">'.__('Ici vous pouvez indiquer le mois de publication', 'SP-Random-Post').'<input style="width:40px;float: right;" name="'.$this->get_field_name('month').'" type="text" value="'.htmlspecialchars($instance['month']).'" /></label></br><small>(Here you can specify the month of publication)</small></p>'; 124 130 //fin 125 131 126 132 // Année de publication 127 echo '<p><label for="'.$this->get_field_name('year').'">'.__('Ici vous pouvez indiquer l´année de publication', 'SP-Random-Post').'<input style="width:40px;float: right;" name="'.$this->get_field_name('year').'" type="text" value="'.htmlspecialchars($instance['year']).'" /></label></ p>';133 echo '<p><label for="'.$this->get_field_name('year').'">'.__('Ici vous pouvez indiquer l´année de publication', 'SP-Random-Post').'<input style="width:40px;float: right;" name="'.$this->get_field_name('year').'" type="text" value="'.htmlspecialchars($instance['year']).'" /></label></br><small>(Here you can enter the year of publication)</small></p>'; 128 134 //fin 129 135 echo '<p><input style="" name="'.$this->get_field_name('excerpt').'" type="checkbox" value="checkbox" ';if($instance['excerpt'])echo 'checked="checked"';echo '/><label for="'.$this->get_field_name('excerpt').'">'.__('Cochez cette case pour afficher un extrait', 'SP-Random-Post').'</label></br><small>(Check this box to display an excerpt)</small></p>'; 136 137 echo '<p><label for="'.$this->get_field_name('length').'">'.__('Longueur de l´extrait :', 'SP-Random-Post').'<input style="width:40px;float: right;" name="'.$this->get_field_name('length').'" type="text" value="'.htmlspecialchars($instance['length']).'" /></label></br><small>(Length of excerpt)</small></p>'; 138 139 echo '<p><input style="" name="'.$this->get_field_name('dateaffiche').'" type="checkbox" value="checkbox" ';if($instance['dateaffiche'])echo 'checked="checked"';echo '/><label for="'.$this->get_field_name('dateaffiche').'">'.__('Cochez cette case pour afficher la date', 'SP-Random-Post').'</label></br><small>(Check this box to display the date)</small></p>'; 130 140 ?> 131 <p> 132 <label> 133 <?php _e( 'Categorie' ); ?>: 134 <?php wp_dropdown_categories( array( 'show_option_all' => __('ALL'),'hide_empty' => 0,'name' => $this->get_field_name("cat"), 'selected' => $instance["cat"] ) ); ?> 135 </label> 136 </p> 141 <p> 142 <label><?php _e( 'Categorie' ); ?>:</label> 143 <?php wp_dropdown_categories( array( 'show_option_all' => __('ALL'),'hide_empty' => 0,'name' => $this->get_field_name("cat"), 'selected' => $instance["cat"] ) ); ?> 144 </br><small>(Category)</small> 145 </p> 137 146 <?php 147 echo'</fieldset>'; 138 148 // image 139 echo '<p><input style="" name="'.$this->get_field_name('thumbsaffiche').'" type="checkbox" value="checkbox" ';if($instance['thumbsaffiche'])echo 'checked="checked"';echo '/><label for="'.$this->get_field_name('thumbsaffiche').'">'.__('Voulez-vous afficher une vignette ?', 'SP-Random-Post').'</label></p>'; 140 141 echo '<p><label for="'.$this->get_field_name('thumbsrand').'">'.__('Taille de la Vignette', 'SP-Random-Post').'<input style="width:40px;float: right;" name="'.$this->get_field_name('thumbsrand').'" type="text" value="'.htmlspecialchars($instance['thumbsrand']).'" /></label></p>'; 149 echo'<fieldset> 150 <legend>Vignette <small>(Thumbnail)</small></legend>'; 151 echo '<p><input style="" name="'.$this->get_field_name('thumbsaffiche').'" type="checkbox" value="checkbox" ';if($instance['thumbsaffiche'])echo 'checked="checked"';echo '/><label for="'.$this->get_field_name('thumbsaffiche').'">'.__('Cochez cette case pour afficher une vignette </br><small>(Check this box to display a thumbnail)</small>', 'SP-Random-Post').'</label></p>'; 152 153 echo '<p><label for="'.$this->get_field_name('thumb_w').'">'.__('Largeur de la Vignette ', 'SP-Random-Post').'<input style="width:40px; float:right;margin-right:60px;" name="'.$this->get_field_name('thumb_w').'" type="text" value="'.htmlspecialchars($instance['thumb_w']).'" /></label></br><small>(Thumbnail width)</small></p>'; 154 155 echo '<p><label for="'.$this->get_field_name('thumb_h').'">'.__('Hauteur de la Vignette ', 'SP-Random-Post').'<input style="width:40px; float:right;margin-right:60px;" name="'.$this->get_field_name('thumb_h').'" type="text" value="'.htmlspecialchars($instance['thumb_h']).'" /></label></br><small>(Thumbnail height)</small></p>'; 156 echo'</fieldset>'; 142 157 // image fin 143 echo '<p><input style="" name="'.$this->get_field_name('excerpt').'" type="checkbox" value="checkbox" ';if($instance['excerpt'])echo 'checked="checked"';echo '/><label for="'.$this->get_field_name('excerpt').'">'.__('Afficher un extrait ?', 'SP-Random-Post').'</label></p>'; 144 145 echo '<p><label for="'.$this->get_field_name('length').'">'.__('Longueur de l´extrait :', 'SP-Random-Post').'<input style="width:40px;float: right;" name="'.$this->get_field_name('length').'" type="text" value="'.htmlspecialchars($instance['length']).'" /></label></p>'; 146 echo '<p><input style="" name="'.$this->get_field_name('auto').'" type="checkbox" value="checkbox" ';if($instance['auto'])echo 'checked="checked"';echo '/><label for="'.$this->get_field_name('auto').'">'.__('actualisation automatique?', 'SP-Random-Post').'</label></p>'; 147 echo '<p><label for="'.$this->get_field_name('time').'">'.__('Intervalle en seconde de actualisation automatique', 'SP-Random-Post').'<input style="width:40px;" name="'.$this->get_field_name('time').'" type="text" value="'.htmlspecialchars($instance['time']).'" /></label></p>'; 158 159 160 echo'</br>'; 161 echo'<fieldset> 162 <legend>Auto actualisation <small>(Auto update)</small></legend>'; 163 echo '<p><input style="" name="'.$this->get_field_name('auto').'" type="checkbox" value="checkbox" ';if($instance['auto'])echo 'checked="checked"';echo '/><label for="'.$this->get_field_name('auto').'">'.__('Cochez cette case pour l´actualisation automatique', 'SP-Random-Post').'</label></br><small>(Select this checkbox to refresh automatically)</small></p>'; 164 165 echo '<p><label for="'.$this->get_field_name('time').'">'.__('Intervalle en seconde de actualisation automatique', 'SP-Random-Post').'<input style="width:40px;float: right;" name="'.$this->get_field_name('time').'" type="text" value="'.htmlspecialchars($instance['time']).'" /></label></br><small>(Second interval auto-refresh)</small></p>'; 166 167 echo'</fieldset>'; 148 168 } 149 169 function update($new_instance,$old_instance){ … … 154 174 $instance['cat'] = (int)$new_instance['cat']; 155 175 $instance['year'] = (int)$new_instance['year']; 156 $instance['thumbsrand'] = (int)$new_instance['thumbsrand']; 176 $instance['thumb_w'] = (int)$new_instance['thumb_w']; 177 $instance['thumb_h'] = (int)$new_instance['thumb_h']; 157 178 $instance['thumbsaffiche'] = (bool)$new_instance['thumbsaffiche']; 179 $instance['dateaffiche'] = (bool)$new_instance['dateaffiche']; 158 180 $instance['excerpt'] = (bool)$new_instance['excerpt']; 159 181 $instance['length'] = (int)$new_instance['length']; … … 164 186 function widget($args,$instance){ 165 187 extract($args); 166 $myargs='number='.$instance['number'].'&thumb srand='.((int)$instance['thumbsrand']).'&thumbsaffiche='.((int)$instance['thumbsaffiche']).'&excerpt='.((int)$instance['excerpt']).'&length='.(int)$instance['length'].'&month='.(int)$instance['month'].'&year='.(int)$instance['year'].'&cat='.(int)$instance['cat'].'&auto='.((int)$instance['auto']).'&time='.(int)$instance['time'];188 $myargs='number='.$instance['number'].'&thumb_w='.((int)$instance['thumb_w']).'&thumb_h='.((int)$instance['thumb_h']).'&thumbsaffiche='.((int)$instance['thumbsaffiche']).'&dateaffiche='.((int)$instance['dateaffiche']).'&excerpt='.((int)$instance['excerpt']).'&length='.(int)$instance['length']. '&month='.(int)$instance['month'].'&year='.(int)$instance['year'].'&cat='.(int)$instance['cat'].'&auto='.((int)$instance['auto']).'&time='.(int)$instance['time']; 167 189 $title = apply_filters('widget_title',empty($instance['title']) ? __('Random Posts', 'SP-Random-Post') : $instance['title']); 168 190 echo '<li id="random-post-widget" class="widget"><h3 class="widget-title" >'.$title.'</h3>'; -
simplicy-random-post/trunk/readme.txt
r609758 r616397 53 53 Version 1.6 (08/10/2012)<br /> 54 54 <p> Changing the image function </p> 55 Version 1.7 (23/10/2012)<br /> 56 <p> adding options </p> 55 57 56 58 -
simplicy-random-post/trunk/sp-random-post.php
r609758 r616397 2 2 /* 3 3 Plugin Name: Simplicy Random Post 4 Plugin URI: http://www.naxialis.com 4 Plugin URI: http://www.naxialis.com/simplicy-random-post 5 5 Description: Afficher des articles aléatoire dans votre sidebar. 6 Version: 1. 66 Version: 1.7 7 7 Author: naxialis 8 8 Author URI: http://www.naxialis.com 9 9 */ 10 load_plugin_textdomain('SP-Random-Post', false, basename(dirname(__FILE__)) . '/lang');11 10 require_once(dirname(__FILE__).'/func/function.php'); 12 11 /* Register our stylesheet. */ 13 12 wp_enqueue_style('simplicy_random_post', '/wp-content/plugins/simplicy-random-post/css/simplicy_random_post.css'); 13 /* Register our stylesheet Admin. */ 14 wp_enqueue_style('admin', '/wp-content/plugins/simplicy-random-post/css/admin.css'); 15 16 // Excerpt length filter 17 function simplicy_random_content($limit) { 18 $excerpt = explode(' ', get_the_excerpt(), $limit); 19 if (count($excerpt)>=$limit) { 20 array_pop($excerpt); 21 $excerpt = implode(" ",$excerpt).''; 22 } else { 23 $excerpt = implode(" ",$excerpt); 24 } 25 $excerpt = preg_replace('`\[[^\]]*\]`','',$excerpt); 26 27 28 29 return $excerpt; 30 } 14 31 ?>
Note: See TracChangeset
for help on using the changeset viewer.