Advertisement
Guest User

WordPress plugin Better Tag Cloud, fixed

a guest
Feb 5th, 2013
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.33 KB | None | 0 0
  1. <?php
  2. /*
  3. Plugin Name: Better Tag Cloud
  4. Plugin URI: http://www.nkuttler.de/wordpress/nktagcloud/
  5. Author: Nicolas Kuttler
  6. Author URI: http://www.nkuttler.de/
  7. Description: A Better Tag Cloud than the default one. Deprecated calls in 0.99.5 fixed. Get also new version of inc/page.php at http://pastebin.com/CwDxGABQ
  8. Version: 0.99.5.1
  9. Text Domain: nktagcloud
  10. */
  11.  
  12. /**
  13.  * Plugin (de)activation
  14.  *
  15.  * @since 0.8.0alpha-1
  16.  */
  17. function nktagcloud_load() {
  18.     if ( is_admin() ) {
  19.         require_once( 'inc/admin.php' );
  20.         register_activation_hook( __FILE__, 'nktagcloud_install' );
  21.     }
  22. }
  23. nktagcloud_load();
  24.  
  25. /**
  26.  * Things to run during init hook
  27.  *
  28.  * @since 0.8.6
  29.  */
  30. function nktagcloud_init() {
  31.     // http://codex.wordpress.org/Determining_Plugin_and_Content_Directories
  32.     // Pre-2.6 compatibility
  33.     if ( ! defined( 'WP_CONTENT_URL' ) )
  34.           define( 'WP_CONTENT_URL', get_option( 'siteurl' ) . '/wp-content' );
  35.     if ( ! defined( 'WP_CONTENT_DIR' ) )
  36.           define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' );
  37.     if ( ! defined( 'WP_PLUGIN_URL' ) )
  38.           define( 'WP_PLUGIN_URL', WP_CONTENT_URL. '/plugins' );
  39.     if ( ! defined( 'WP_PLUGIN_DIR' ) )
  40.           define( 'WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins' );
  41.     global $nktagcloud;
  42.     $nktagcloud = array(
  43.         'path' => WP_PLUGIN_DIR . '/' . str_replace( basename( __FILE__ ), "", plugin_basename( __FILE__ ) ),
  44.         'url' => WP_PLUGIN_URL . '/' . str_replace( basename( __FILE__ ), "", plugin_basename( __FILE__ ) ),
  45.     );
  46.  
  47.     // always needed for footer link
  48.     // TODO which footer link? we don't need this in admin, or do we?
  49.     require_once( 'inc/page.php' );
  50.  
  51.     if ( is_admin() ) {
  52.         require_once( 'inc/admin.php' );
  53.         add_action( 'admin_menu', 'nktagcloud_add_pages' );
  54.  
  55.         wp_register_widget_control('your_widget_2', __('Better Tag Cloud', 'nktagcloud' ), 'nktagcloud_control' );
  56.         wp_register_sidebar_widget('your_widget_2', __('Better Tag Cloud', 'nktagcloud'), 'widget_nktagcloud' );
  57.     }
  58.     else {
  59.         add_shortcode( 'nktagcloud', 'nktagcloud_shortcode' );
  60.         add_shortcode( 'nktagcloud_single', 'nktagcloud_single_shortcode' );
  61.         wp_register_sidebar_widget('your_widget_1', __('Better Tag Cloud', 'nktagcloud'), 'widget_nktagcloud' );
  62.     }
  63. }
  64. add_action( 'init', 'nktagcloud_init' );
  65.  
  66. // load the new widget class if available
  67. if ( class_exists( 'WP_Widget' ) )
  68.     require_once( 'inc/multiwidget.php' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement