Permalink
Browse files

Initial commit.

Register the class and show an error warning if Jetpack or P2 aren't available
  • Loading branch information...
0 parents commit 668a7eeb5abd2ce863e4ad01f421ccefbbc0c4d6 @danielbachhuber committed Aug 5, 2012
Showing with 48 additions and 0 deletions.
  1. +48 −0 jetpack-follow-link-for-p2.php
  2. 0 readme.txt
@@ -0,0 +1,48 @@
+<?php
+/*
+Plugin Name: Jetpack Follow Link for P2
+Plugin URI: https://github.com/danielbachhuber/Jetpack-Follow-Link-for-P2
+Description: Add a nifty "Follow" action link to P2 like WordPress.com has. Allows you to easily subscribe to a comment thread without commenting
+Author: Daniel Bachhuber
+Version: 0.0
+Author URI: http://danielbachhuber.com/
+*/
+
+
+class JPFLFP2 {
+
+ /**
+ * Construct the plugin
+ */
+ function __construct() {
+
+ add_action( 'init', array( $this, 'action_init' ) );
+
+ }
+
+ /**
+ *
+ */
+ function action_init() {
+
+ // Check to make sure Jetpack and P2 are running
+ // @todo Also check to make sure subscriptions are configured
+ if ( !class_exists( 'P2' ) || !class_exists( 'Jetpack' ) ) {
+ add_action( 'admin_notices', array( $this, 'action_admin_notices' ) );
+ return;
+ }
+
+ }
+
+ /**
+ * Display an error notice if P2 or Jetpack aren't present
+ */
+ function action_admin_notices() {
+ $message = sprintf( __( "Jetpack Follow Link for P2 is enabled. You'll also need to activate the <a href='%s' target='_blank'>P2 theme</a> and <a href='%s' target='_blank'>Jetpack</a> to start using the plugin.", 'jpflfp2' ), 'http://p2theme.com/', 'http://jetpack.me' );
+ echo '<div class="error"><p>' . $message . '</p></div>';
+ }
+
+}
+
+global $jpflfp2;
+$jpflfp2 = new JPFLFP2();
No changes.

0 comments on commit 668a7ee

Please sign in to comment.