Plugin Directory

Changeset 496741


Ignore:
Timestamp:
01/29/2012 05:20:14 AM (14 years ago)
Author:
thewarlog
Message:

cleaned up the code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ra-fb-like-box/trunk/ra_fb_like_box.php

    r496538 r496741  
    2626add_action("admin_menu", array("RAFacebookLikeBox", "ra_fb_likebox_options"));
    2727add_shortcode("rashid_fb_lb", array("RAFacebookLikeBox", "ra_fb_likebox_sc"));
     28
     29add_filter('plugin_row_meta', array("RAFacebookLikeBox", "ra_fb_plugin_row_meta"), 10, 2);
    2830
    2931class RAFacebookLikeBox {
     
    6163       
    6264        return $_ra_options;
     65    }
     66   
     67    static function ra_plugin_basename($file = __FILE__) {
     68        $file = str_replace('\\','/',$file); // sanitize for Win32 installs
     69        $file = preg_replace('|/+|','/', $file); // remove any duplicate slash
     70        $plugin_dir = str_replace('\\','/',WP_PLUGIN_DIR); // sanitize for Win32 installs
     71        $plugin_dir = preg_replace('|/+|','/', $plugin_dir); // remove any duplicate slash
     72        $mu_plugin_dir = str_replace('\\','/',WPMU_PLUGIN_DIR); // sanitize for Win32 installs
     73        $mu_plugin_dir = preg_replace('|/+|','/', $mu_plugin_dir); // remove any duplicate slash
     74        $file = preg_replace('#^' . preg_quote($plugin_dir, '#') . '/|^' . preg_quote($mu_plugin_dir, '#') . '/#','',$file); // get relative path from plugins dir
     75        $file = trim($file, '/');
     76        return $file;
    6377    }
    6478   
     
    238252    }
    239253   
     254    static function ra_fb_plugin_row_meta($meta, $file) {
     255        if ($file == self::ra_plugin_basename()) {
     256            $meta[] = '<a href="options-general.php?page=ra_fb_likebox">' . __('Settings') . '</a>';
     257            $meta[] = '<a href="http://blog.ecafechat.com/donations/" target="_blank">' . __('Donate') . '</a>';
     258        }
     259        return $meta;
     260    }
     261   
    240262    static function ra_fb_like_init(){
    241263        wp_register_sidebar_widget(__('ra-fb-lb'), __('Rashid\'s Facebook Like Box'), array('RAFacebookLikeBox', 'ra_fb_likebox_widget'));
Note: See TracChangeset for help on using the changeset viewer.