file = __FILE__; // leave this as it is $register->slug = "pluginregister"; // create a unique slug for your plugin (normally the plugin name in lowercase, with no spaces or special characters works fine) $register->name = "Plugin Register"; // the full name of your plugin (this will be displayed in your statistics) $register->version = "1.0"; // the version of your plugin (this will be displayed in your statistics) $register->developer = "Chris Taylor"; // your name $register->homepage = "http://www.stillbreathing.co.uk"; // your Wordpress website where Plugin Register is installed (no trailing slash) // the next two lines are optional // 'register_plugin' is the message you want to be displayed when someone has activated this plugin. The %1 is replaced by the correct URL to register the plugin (the %1 MUST be the HREF attribute of an element) $register->register_message = 'Hey! Thanks! Register the plugin here.'; // 'thanks_message' is the message you want to display after someone has registered your plugin $register->thanks_message = "That's great, thanks a million."; $register->Plugin_Register(); // leave this as it is */ if ( !class_exists( "Plugin_Register" ) ) { class Plugin_Register { var $slug = ""; var $developer = "the developer"; var $version = ""; var $homepage = "#"; var $name = ""; var $file = ""; var $register_message = ""; var $thanks_message = ""; function Register() { @session_start(); register_activation_hook( $this->file, array( $this, "Activated" ) ); add_action( "admin_notices", array( $this, "Registration" ) ); } function Activated() { if ( $this->slug != "" && $this->name != "" && $this->version != "" ) { $_SESSION["activated_plugin"] = $this->slug; } } function Registration() { if ( isset( $_SESSION["activated_plugin"] ) && $_SESSION["activated_plugin"] == $this->slug ) { $_SESSION["activated_plugin"] = ""; echo '

'; if ( $this->register_message == "" || strpos( $this->register_message, "%1" ) === false ) { echo ' Please consider slug . '=register">registering your use of ' . $this->name . ' to tell ' . $this->developer . ' (the plugin maker) you are using it. This sends only your site name and URL to ' . $this->developer . ' so they know where their plugin is being used. No other data is sent.'; } else { echo str_replace( "%1", "plugins.php?paged=" . @$_GET["paged"] . "&" . $this->slug . "=register", $this->register_message ); } echo '

'; } if ( isset( $_GET[$this->slug] ) && $_GET[$this->slug] == "register" ) { $site = get_option( "blogname" ); $url = get_option( "siteurl" ); $register_url = trim( $this->homepage, "/" ) . "/?plugin=" . urlencode( $this->name ) . "&version=" . urlencode( $this->version ) . "&site=" . urlencode( $site ) . "&url=" . urlencode( $url ); wp_remote_fopen( $register_url ); echo '

'; if ( $this->thanks_message == "" ) { echo ' Thank you for registering ' . $this->name . '. '; } else { echo $this->thanks_message; } echo '

'; } } } } ?>