Changeset 685745
- Timestamp:
- 03/22/2013 04:34:27 PM (13 years ago)
- File:
-
- 1 edited
-
leaderboarded/trunk/leaderboarded.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
leaderboarded/trunk/leaderboarded.php
r547932 r685745 9 9 Description: Allows you to embed a Leaderboard in your Wordpress blog 10 10 Author: Toby Beresford 11 Version: 0.1 111 Version: 0.12 12 12 Author URI: http://www.tobyberesford.com 13 13 */ 14 14 15 16 15 // We need some CSS for colors and what not 16 // add_action( 'wp_head', 'leaderboarded_css' ); 17 17 function leaderboarded_css() { 18 19 20 $copy= " 21 18 echo ' 22 19 <style> 23 20 </style> 24 "; 25 echo $copy; 21 '; 26 22 } 27 23 24 // add_action('admin_menu', 'leaderboarded_admin_settings'); 25 function leaderboarded_admin_settings() { 26 add_menu_page( 27 'Leaderboarded Settings', // The title to be displayed in the browser window for this page. 28 'Leaderboarded Settings', // The text to be displayed for this menu item 29 'add_users', // Which type of users can see this menu item 30 'leaderboarded_settings', // The unique ID - that is, the slug - for this menu item 31 'leaderboarded_admin_settings_page', // The name of the function to call when rendering this menu's page, 32 NULL, // Menu Icon URL 33 NULL // Menu Position 34 ); 35 } 28 36 37 function leaderboarded_admin_settings_page() { 38 echo 'hello'; 39 } 29 40 30 function leaderboarded($atts) { 31 extract( shortcode_atts( array( 41 add_shortcode('leaderboarded', 'leaderboarded_board'); 42 function leaderboarded_board($atts) { 43 extract(shortcode_atts(array( 32 44 'slug' => 'gurus', 33 45 'release' => 'latest', 34 ), $atts ) ); 35 $url = "http://www.leaderboarded.com/leaderboard/board/".$slug."/".$release."/barebones_html/cut/"; 36 37 $theBody = wp_remote_retrieve_body( wp_remote_get($url) ); 46 ), $atts)); 38 47 39 if($theBody) 40 { 41 //var_dump ($theBody); 42 return($theBody); 43 } else { 44 return "Leaderboarded Plugin: could not find the leaderboard you asked for."; 45 } 48 $url = 'http://www.leaderboarded.com/display/' . $slug . '/' . $release . '/embed/cut/'; 46 49 50 $theBody = wp_remote_retrieve_body(wp_remote_get($url)); 51 52 return ($theBody) ? $theBody : 'Leaderboarded Plugin: could not find the leaderboard you asked for.'; 47 53 } 48 54 49 //add_action( 'wp_head', 'leaderboarded_css' );50 51 add_shortcode('leaderboarded', 'leaderboarded');52 53 54 55 ?>
Note: See TracChangeset
for help on using the changeset viewer.