Plugin Directory

Changeset 685745


Ignore:
Timestamp:
03/22/2013 04:34:27 PM (13 years ago)
Author:
tobyberesford
Message:

Updated to use latest Leaderboarded URI schema

File:
1 edited

Legend:

Unmodified
Added
Removed
  • leaderboarded/trunk/leaderboarded.php

    r547932 r685745  
    99Description: Allows you to embed a Leaderboard in your Wordpress blog
    1010Author: Toby Beresford
    11 Version: 0.11
     11Version: 0.12
    1212Author URI: http://www.tobyberesford.com
    1313*/
    1414
    15 
    1615// We need some CSS for colors and what not
     16// add_action( 'wp_head', 'leaderboarded_css' );
    1717function leaderboarded_css() {
    18 
    19 
    20     $copy= "
    21 
     18    echo '
    2219<style>
    2320</style>
    24     ";
    25     echo $copy;
     21    ';
    2622}
    2723
     24// add_action('admin_menu', 'leaderboarded_admin_settings');
     25function 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}
    2836
     37function leaderboarded_admin_settings_page() {
     38    echo 'hello';
     39}
    2940
    30 function leaderboarded($atts) {
    31     extract( shortcode_atts( array(
     41add_shortcode('leaderboarded', 'leaderboarded_board');
     42function leaderboarded_board($atts) {
     43    extract(shortcode_atts(array(
    3244        'slug' => 'gurus',
    3345        '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));
    3847
    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/';
    4649
     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.';
    4753}
    4854
    49 //add_action( 'wp_head', 'leaderboarded_css' );
    50 
    51 add_shortcode('leaderboarded', 'leaderboarded');
    52 
    53 
    5455?>
Note: See TracChangeset for help on using the changeset viewer.