Skip to content

Commit

Permalink
Add filterable frontend indicator method
Browse files Browse the repository at this point in the history
  • Loading branch information
frankiejarrett committed May 6, 2014
1 parent 0d752ef commit 843b41b
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions stream.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ private function __construct() {
require_once WP_STREAM_INC_DIR . 'feeds.php';
add_action( 'init', array( 'WP_Stream_Feeds', 'load' ) );

// Add frontend indicator
add_action( 'wp_head', array( $this, 'frontend_indicator' ) );

// Include Stream extension updater
require_once WP_STREAM_INC_DIR . 'updater.php';
WP_Stream_Updater::instance();
Expand Down Expand Up @@ -261,6 +264,33 @@ public static function notice( $message, $is_error = true ) {
}
}

/**
* Displays an HTML comment in the frontend head to indicate that Stream is activated,
* and which version of Stream is currently in use.
*
* @since 1.4.5
*
* @action wp_head
* @return string|void An HTML comment, or nothing if the value is filtered out.
*/
public function frontend_indicator() {
$comment = sprintf( 'Stream WordPress user activity plugin v%s', esc_html( self::VERSION ) ); // Localization not needed

/**
* Filter allows the HTML output of the frontend indicator comment
* to be altered or removed, if desired.
*
* @return string $comment The content of the HTML comment
*/
$comment = apply_filters( 'wp_stream_frontend_indicator', $comment ); // xss ok

if ( ! empty( $comment ) ) {
echo sprintf( "<!-- %s -->\n", esc_html( $comment ) );
}

return;
}

/**
* Return active instance of WP_Stream, create one if it doesn't exist
*
Expand Down

0 comments on commit 843b41b

Please sign in to comment.