Skip to content

Commit

Permalink
Merge pull request #509 from x-team/issue-507
Browse files Browse the repository at this point in the history
Add filterable frontend indicator method
  • Loading branch information
lukecarbis committed May 6, 2014
2 parents 0d752ef + 834d591 commit b5f1361
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 );

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

return;
}

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

0 comments on commit b5f1361

Please sign in to comment.