Skip to content

Commit b549865

Browse files
Improving docblocks on hooks throughout plugin
1 parent 3b2ab1f commit b549865

File tree

6 files changed

+73
-13
lines changed

6 files changed

+73
-13
lines changed

classes/class-wp-stream-api.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,18 @@ protected function remote_request( $url = '', $args = array(), $allow_cache = tr
325325
}
326326

327327
if ( ! is_wp_error( $request ) ) {
328+
/**
329+
* Filter the request data of the API response.
330+
*
331+
* Does not fire on non-blocking requests.
332+
*
333+
* @since 2.0.0
334+
*
335+
* @param string $url
336+
* @param array $args
337+
*
338+
* @return array
339+
*/
328340
$data = apply_filters( 'wp_stream_api_request_data', json_decode( $request['body'] ), $url, $args );
329341

330342
// Loose comparison needed

classes/class-wp-stream-author.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,13 @@ static function get_current_agent() {
223223
$agent = 'wp_cron';
224224
}
225225

226+
/**
227+
* Filter the current agent string
228+
*
229+
* @since 1.4.4
230+
*
231+
* @return string
232+
*/
226233
$agent = apply_filters( 'wp_stream_current_agent', $agent );
227234

228235
return $agent;
@@ -241,6 +248,15 @@ static function get_agent_label( $agent ) {
241248
$label = '';
242249
}
243250

251+
/**
252+
* Filter agent labels
253+
*
254+
* @since 1.4.4
255+
*
256+
* @param string $agent
257+
*
258+
* @return string
259+
*/
244260
$label = apply_filters( 'wp_stream_agent_label', $label, $agent );
245261

246262
return $label;

classes/class-wp-stream-db.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function store( $records ) {
4141
/**
4242
* Allows modification of record information just before logging occurs.
4343
*
44-
* @since 0.0.2
44+
* @since 0.2.0
4545
*
4646
* @param array $records An array of record data.
4747
*/
@@ -57,9 +57,12 @@ public function store( $records ) {
5757
$result = $this->insert( $records );
5858

5959
if ( $result && ! is_wp_error( $result ) ) {
60+
6061
/**
6162
* Fires when A Post is inserted
6263
*
64+
* @since 2.0.0
65+
*
6366
* @param int $record_id Inserted record ID
6467
* @param array $recordarr Array of information on this record
6568
*/
@@ -106,6 +109,8 @@ public function query( $query, $fields ) {
106109
/**
107110
* Allows developers to change the final result set of records
108111
*
112+
* @since 2.0.0
113+
*
109114
* @param array $results
110115
* @param array $query
111116
* @param array $fields

classes/class-wp-stream-log.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@ public static function load() {
1818
/**
1919
* Filter allows developers to change log handler class
2020
*
21-
* @param array Current Class
22-
* @return string New Class for log handling
21+
* @since 0.2.0
22+
*
23+
* @return string Class name to use for log handling
2324
*/
2425
$log_handler = apply_filters( 'wp_stream_log_handler', __CLASS__ );
2526

@@ -236,6 +237,8 @@ public static function debug_backtrace( $recordarr ) {
236237
* use the available $recordarr parameter to specify what types of records to
237238
* create backtrace logs for.
238239
*
240+
* @since 2.0.2
241+
*
239242
* @param array $recordarr
240243
*
241244
* @return bool Set to FALSE by default (backtrace disabled)

classes/class-wp-stream-query.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ public function query( $args ) {
7373
/**
7474
* Filter allows additional query properties to be added
7575
*
76+
* @since 2.0.0
77+
*
7678
* @return array Array of query properties
7779
*/
7880
$properties = apply_filters( 'wp_stream_query_properties', $properties );
@@ -91,6 +93,8 @@ public function query( $args ) {
9193
/**
9294
* Filter allows additional arguments to query $args
9395
*
96+
* @since 1.4.0
97+
*
9498
* @return array Array of query arguments
9599
*/
96100
$args = apply_filters( 'wp_stream_query_args', $args );
@@ -249,13 +253,17 @@ public function query( $args ) {
249253
/**
250254
* Filter allows the final query args to be modified
251255
*
256+
* @since 2.0.0
257+
*
252258
* @return array Array of query arguments
253259
*/
254260
$query = apply_filters( 'wp_stream_db_query', $query );
255261

256262
/**
257263
* Filter allows the final query fields to be modified
258264
*
265+
* @since 2.0.0
266+
*
259267
* @return array Array of query fields
260268
*/
261269
$fields = apply_filters( 'wp_stream_db_fields', $fields );

stream.php

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ private function __construct() {
103103
/**
104104
* Filter allows a custom Stream API class to be instantiated
105105
*
106+
* @since 2.0.2
107+
*
106108
* @return object The API class object
107109
*/
108110
self::$api = apply_filters( 'wp_stream_api_class', new WP_Stream_API );
@@ -133,6 +135,7 @@ private function __construct() {
133135
// Add frontend indicator
134136
add_action( 'wp_head', array( $this, 'frontend_indicator' ) );
135137

138+
// Load admin area classes
136139
if ( is_admin() ) {
137140
add_action( 'init', array( 'WP_Stream_Admin', 'load' ) );
138141
add_action( 'init', array( 'WP_Stream_Dashboard_Widget', 'load' ) );
@@ -143,16 +146,21 @@ private function __construct() {
143146
}
144147

145148
/**
146-
* Invoked when the PHP version check fails. Load up the translations and
147-
* add the error message to the admin notices
149+
* Invoked when the PHP version check fails
150+
*
151+
* Load up the translations and add the error message to the admin notices.
152+
*
153+
* @return void
148154
*/
149155
public static function fail_php_version() {
150156
add_action( 'plugins_loaded', array( __CLASS__, 'i18n' ) );
151157
self::notice( __( 'Stream requires PHP version 5.3+, plugin is currently NOT ACTIVE.', 'stream' ) );
152158
}
153159

154160
/**
161+
* Check for deprecated extension plugins
155162
*
163+
* @return bool
156164
*/
157165
public static function deprecated_plugins_exist() {
158166
foreach ( self::$deprecated_extensions as $class => $dir ) {
@@ -165,7 +173,9 @@ public static function deprecated_plugins_exist() {
165173
}
166174

167175
/**
176+
* Display admin notices when deprecated extension plugins exist
168177
*
178+
* @return void
169179
*/
170180
public static function deprecated_plugins_notice() {
171181
add_action( 'plugins_loaded', array( __CLASS__, 'i18n' ) );
@@ -209,11 +219,12 @@ public static function deprecated_plugins_notice() {
209219
}
210220

211221
/**
212-
* Autoloader for classes
213-
*
214-
* @param string $class
215-
* @return void
216-
*/
222+
* Autoloader for classes
223+
*
224+
* @param string $class
225+
*
226+
* @return void
227+
*/
217228
function autoload( $class ) {
218229
$class = strtolower( str_replace( '_', '-', $class ) );
219230
$class_file = sprintf( '%sclass-%s.php', WP_STREAM_CLASS_DIR, $class );
@@ -226,8 +237,8 @@ function autoload( $class ) {
226237
/**
227238
* Loads the translation files.
228239
*
229-
* @access public
230240
* @action plugins_loaded
241+
*
231242
* @return void
232243
*/
233244
public static function i18n() {
@@ -269,6 +280,8 @@ public static function is_development_mode() {
269280
/**
270281
* Filter allows development mode to be overridden
271282
*
283+
* @since 2.0.0
284+
*
272285
* @return bool
273286
*/
274287
return apply_filters( 'wp_stream_development_mode', $development_mode );
@@ -279,6 +292,7 @@ public static function is_development_mode() {
279292
*
280293
* @param string $message
281294
* @param bool $is_error
295+
*
282296
* @return void
283297
*/
284298
public static function notice( $message, $is_error = true ) {
@@ -305,6 +319,7 @@ public static function notice( $message, $is_error = true ) {
305319
* Show an error or other message in the WP Admin
306320
*
307321
* @action shutdown
322+
*
308323
* @return void
309324
*/
310325
public static function admin_notices() {
@@ -336,9 +351,8 @@ public static function admin_notices() {
336351
* Displays an HTML comment in the frontend head to indicate that Stream is activated,
337352
* and which version of Stream is currently in use.
338353
*
339-
* @since 1.4.5
340-
*
341354
* @action wp_head
355+
*
342356
* @return string|void An HTML comment, or nothing if the value is filtered out.
343357
*/
344358
public function frontend_indicator() {
@@ -348,6 +362,8 @@ public function frontend_indicator() {
348362
* Filter allows the HTML output of the frontend indicator comment
349363
* to be altered or removed, if desired.
350364
*
365+
* @since 1.4.5
366+
*
351367
* @return string The content of the HTML comment
352368
*/
353369
$comment = apply_filters( 'wp_stream_frontend_indicator', $comment );

0 commit comments

Comments
 (0)