Changeset 576057
- Timestamp:
- 07/23/2012 01:31:03 PM (14 years ago)
- Location:
- wp-wiki-userprofile/trunk
- Files:
-
- 2 edited
-
readme.txt (modified) (4 diffs)
-
wp-wiki-userprofile.php (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-wiki-userprofile/trunk/readme.txt
r561301 r576057 1 1 === Wp Wiki Userprofile === 2 2 Contributors: gchokeen 3 Donate link: http:// example.com/3 Donate link: http://code-cocktail.in/donate-me/ 4 4 Tags: widget, wiki 5 5 Requires at least: 2.8 6 Tested up to: 3. 3.27 Stable tag: 1. 06 Tested up to: 3.4.1 7 Stable tag: 1.1 8 8 License: GPLv2 9 9 … … 16 16 using CURL request. 17 17 18 = Plugin Features = 19 20 * Widget Support 21 * Shortcode support 22 23 = Shortcode Usage = 24 *`[wikiuser]` 25 26 *`[wikiuser param="editcount"]` 27 28 *`[wikiuser username="xxx" param="editcount"]` 29 30 18 31 19 32 == Installation == … … 25 38 1. Upload the entire `wp-wiki-userprofile` folder to the `/wp-content/plugins/` directory 26 39 2. Activate the plugin through the 'Plugins' menu in WordPress 40 41 27 42 28 43 … … 44 59 == Changelog == 45 60 61 = 1.1 = 62 * Shortcode support added. 63 * Feedback links is are added. 64 65 46 66 = 1.0 = 47 67 * Initial release. -
wp-wiki-userprofile/trunk/wp-wiki-userprofile.php
r561301 r576057 4 4 Plugin URI: http://wordpress.org/extend/plugins/wp-wiki-userprofile/ 5 5 Description: This plugin is used to grab Wikipedia user contribution to wordpress blog. 6 Version: 1. 06 Version: 1.1 7 7 Author: Gowri Sankar Ramasamy. 8 Author URI: http://code-cocktail.in/author/gowrisankar/ 9 Donate link: http://code-cocktail.in/donate-me/ 8 10 License: GPL2 9 11 */ … … 46 48 } 47 49 50 51 // admin wiki userprofile settings page 52 48 53 function wiki_profile_options() { 49 if ( !current_user_can( 'manage_options' ) ) { 50 wp_die( __( 'You do not have sufficient permissions to access this page.' ) ); 51 } 52 53 if(isset($_POST['wiki-profile-submit'])){ 54 55 update_option('codecocktail_wiki_username',$_POST['codecocktail_wiki_username']); 56 update_option('codecocktail_wiki_user_param',$_POST['codecocktail_wiki_user_param']); 57 58 } 59 60 61 62 echo ' 63 <form method="post" action="" name="wiki-profile-form"> 64 <div class="wrap"> 65 <div class="icon32" id="icon-options-general"><br> 66 </div> 67 <h2>Wiki Userprofile Settings</h2> 68 <table class="form-table"> 69 <tbody> 70 <tr> 71 <td width="30%" valign="top"><strong>'.__('Wiki Userprofile UserName:','codecocktail-wikiprofile').'</strong></td> 72 <td valign="top"> 73 <input type="text" name="codecocktail_wiki_username" value="'.get_option("codecocktail_wiki_username").'" size="60"/> 74 </td> 75 </tr> 76 <tr> 77 <td width="30%" valign="top"><strong>'.__('Parameters:','codecocktail-wikiprofile').'</strong></td> 78 <td valign="top"> 79 <input type="text" name="codecocktail_wiki_user_param" value="'.get_option("codecocktail_wiki_user_param").'" size="80"/> 80 </td> 81 </tr> 82 </tbody> 83 </table> 84 <h3> </h3> 85 <p class="submit"> 86 <input type="submit" value="Save Changes" class="button-primary" name="wiki-profile-submit"> 87 </p> 88 </div> 89 </form> 90 91 '; 92 93 54 if ( !current_user_can( 'manage_options' ) ) { 55 wp_die( __( 'You do not have sufficient permissions to access this page.' ) ); 56 } 57 58 if(isset($_POST['wiki-profile-submit'])){ 59 60 update_option('codecocktail_wiki_username',$_POST['codecocktail_wiki_username']); 61 update_option('codecocktail_wiki_user_param',$_POST['codecocktail_wiki_user_param']); 62 63 } 64 65 66 67 echo ' 68 <div class="wrap"> 69 <form method="post" action="" name="wiki-profile-form"> 70 71 <div class="icon32" id="icon-options-general"><br> 72 </div> 73 <h2>'.__('Wiki Userprofile Settings','codecocktail-wikiprofile').'</h2> 74 <table class="form-table"> 75 <tbody> 76 <tr> 77 <td width="30%" valign="top"><strong>'.__('Wikipedia UserName:','codecocktail-wikiprofile').'</strong></td> 78 <td valign="top"> 79 <input type="text" name="codecocktail_wiki_username" value="'.get_option("codecocktail_wiki_username").'" size="60"/> 80 </td> 81 </tr> 82 <tr> 83 <td width="30%" valign="top"><strong>'.__('Parameters:','codecocktail-wikiprofile').'</strong></td> 84 <td valign="top"> 85 <input type="text" name="codecocktail_wiki_user_param" value="'.get_option("codecocktail_wiki_user_param").'" size="80"/> 86 </td> 87 </tr> 88 </tbody> 89 </table> 90 <h3> </h3> 91 <p class="submit"> 92 <input type="submit" value="Save Changes" class="button-primary" name="wiki-profile-submit"> 93 </p> 94 95 </form> 96 <div class="shortcode-doc"> 97 <strong>'.__("Example Shortcode Usage:","codecocktail-wikiprofile").'</strong> 98 <ul> 99 <li>[wikiuser]</li> 100 <li>[wikiuser param="editcount"]</li> 101 <li>[wikiuser username="xxx" param="editcount"]</li> 102 </ul> 103 </div> 104 <div class="feedback-doc"> 105 <strong>'.__("Feedback","codecocktail-wikiprofile").'</strong> 106 <p>Feel free to contact me <a href="mailto:[email protected]?subject=Wp Wiki Userprofile">[email protected]</a>. I like to hear 107 <a href="mailto:[email protected]?subject=Wp Wiki Userprofile Feedback">'.__("Future request","codecocktail-wikiprofile").'</a>, 108 <a href="mailto:[email protected]?subject=Wp Wiki Userprofile Suggestion">'.__("Suggestion","codecocktail-wikiprofile").'</a>, 109 <a href="mailto:[email protected]?subject=Wp Wiki Userprofile Bug Report">'.__("Bug Report","codecocktail-wikiprofile").'</a> 110 or 111 <a href="mailto:[email protected]?subject=Wp Wiki Userprofile Future request">'.__("Future request","codecocktail-wikiprofile").'</a> 112 from you.</p> 113 </div> 114 </div> 115 116 117 '; 118 119 94 120 } 95 121 … … 111 137 112 138 function wiki_profile_admin_notices() { 113 echo "<div id='notice' class='updated fade'><p>". __( 'Wiki Userprofile is not configured yet. Please do it now.','codecocktail-wikiprofile' )."</p></div>\n";139 echo "<div id='notice' class='updated fade'><p>". __( 'Wiki Userprofile is not configured yet. Please configure it <a href="'.admin_url( 'options-general.php?page=wiki-profile').'">here</a> .','codecocktail-wikiprofile' )."</p></div>\n"; 114 140 } 115 141 … … 159 185 } 160 186 161 function get_wiki_response( ){187 function get_wiki_response($wiki_username = "",$wiki_user_param=""){ 162 188 do_action('get_wiki_response'); 163 189 164 $codecocktail_wiki_username = get_option("codecocktail_wiki_username"); 165 $codecocktail_wiki_user_param = get_option("codecocktail_wiki_user_param"); 190 $codecocktail_wiki_username = ($wiki_username=="" ? get_option("codecocktail_wiki_username"):$wiki_username); 191 $codecocktail_wiki_user_param = ($wiki_user_param=="" ? get_option("codecocktail_wiki_user_param"):$wiki_user_param); 192 166 193 167 194 $wiki_API_URL ="http://en.wikipedia.org/w/api.php?format=json&action=query&list=users&ususers=".$codecocktail_wiki_username."&usprop=".$codecocktail_wiki_user_param.""; … … 186 213 187 214 188 /*function wiki_reorder($array){ 189 do_action('wiki_reorder'); 190 191 $wiki_reposnse = $array['query']['users']; 192 $order_referece = explode("|",get_option("codecocktail_wiki_user_param")); 193 194 $temp_array = array(); 195 196 foreach($wiki_reposnse as $key=>$value){ 197 198 //print_r($value); 199 200 // $temp_array[$key] = array_multisort($order_referece,$value); 201 202 } 203 204 return $temp_array; 205 206 }*/ 207 208 215 /** 216 * array_tree function will help to convert php array data into <ul>,<li> Html format. 217 */ 209 218 210 219 function array_tree($array,$args = array(),$level=0){ … … 218 227 $data = array_merge($default,$args); 219 228 220 if(is_array($array)){ 221 222 $output .= '<ul'.($level==0?" class='$data[container_class]'":" class='sub-level-$level'").($level==0?" id='$data[container_id]'":'').'>'; 223 224 foreach($array as $key=>$value){ 225 226 if(is_array($value)){ 227 228 $output .='<li>'.(!is_numeric($key)?'<label>'.ucfirst($key).'</label>: ':''); 229 $output .=array_tree($value,$data,$level++); 230 $output .='</li>'; 229 if(is_array($array)){ 230 231 $output .= '<ul'.($level==0?" class='$data[container_class]'":" class='sub-level-$level'").($level==0?" id='$data[container_id]'":'').'>'; 232 233 foreach($array as $key=>$value){ 234 235 if(is_array($value)){ 236 237 $output .='<li>'.(!is_numeric($key)?'<label>'.ucfirst($key).'</label>: ':''); 238 $output .=array_tree($value,$data,$level++); 239 $output .='</li>'; 240 } 241 else{ 242 if(!in_array(strtolower($key),$data['exclude'])){ 243 244 $output .= '<li>'.(!is_numeric($key)?'<label>'.ucfirst($key).'</label>: ':'').ucfirst($value).'</li>'; 245 } 246 } 247 } 248 $output .= '</ul>'; 249 250 return $output; 231 251 } 232 252 else{ 233 if(!in_array(strtolower($key),$data['exclude'])){ 234 235 $output .= '<li>'.(!is_numeric($key)?'<label>'.ucfirst($key).'</label>: ':'').ucfirst($value).'</li>'; 236 } 237 } 238 } 239 $output .= '</ul>'; 240 241 return $output; 242 } 243 else{ 244 return $array; 245 } 246 247 248 } 249 250 251 252 253 function get_wiki_display(){ 254 255 $array = get_wiki_response(); 253 return $array; 254 } 255 256 257 } 258 259 260 261 262 function get_wiki_display($wiki_username = "",$wiki_user_param=""){ 263 264 $array = get_wiki_response($wiki_username,$wiki_user_param); 256 265 257 266 $wiki_reposnse = $array['query']['users']; 258 //print_r( $wiki_reposnse);259 267 260 268 return array_tree($wiki_reposnse,array('exclude'=>array('userid'))); … … 295 303 if ( ! empty( $title ) ) 296 304 echo $before_title . $title . $after_title; 297 298 299 300 301 //'http://en.wikipedia.org/w/api.php?action=query&prop=revisions&titles=API|Main_Page&rvprop=timestamp|user|comment|content'; 302 303 304 echo get_wiki_display(); 305 306 /* echo "<pre>"; 307 print_r(get_wiki_display()); 308 309 310 echo "</pre>"; */ 311 312 ?><?php 313 echo $after_widget; 305 echo get_wiki_display(); 306 307 echo $after_widget; 314 308 } 315 309 … … 359 353 add_action( 'widgets_init', create_function( '', 'register_widget( "wiki_profile_widget" );' ) ); 360 354 355 356 /** 357 * short code support added. 358 * 359 * @version 1.1 360 * 361 * @param username,param. 362 */ 363 364 function wikiuser_shortcode($atts) { 365 366 $codecocktail_wiki_username = get_option("codecocktail_wiki_username"); 367 $codecocktail_wiki_user_param = get_option("codecocktail_wiki_user_param"); 368 369 extract(shortcode_atts(array( 370 'username' => $codecocktail_wiki_username, 371 'param' => $codecocktail_wiki_user_param, 372 ), $atts)); 373 374 return get_wiki_display($username,$param); 375 } 376 add_shortcode('wikiuser', 'wikiuser_shortcode');
Note: See TracChangeset
for help on using the changeset viewer.