Skip to content

Commit

Permalink
Merge branch '2.0.0' into issue-156
Browse files Browse the repository at this point in the history
Conflicts:
	bin/.travis.yml
	includes/db.php
	includes/db/install/wpdb.php
	phpcs.ruleset.xml
	stream.php
	tests/bootstrap.php
  • Loading branch information
Luke Carbis committed May 28, 2014
2 parents d42ca26 + 900159e commit b8b2d3b
Show file tree
Hide file tree
Showing 39 changed files with 1,491 additions and 1,057 deletions.
5 changes: 5 additions & 0 deletions .ci-env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export PHPCS_GITHUB_SRC=x-team/PHP_CodeSniffer
export PHPCS_GIT_TREE=subset-selection
export WPCS_GIT_TREE=rule-subset-with-phpcs-pr
export WPCS_STANDARD=WordPress:core-extra
export PHPCS_IGNORE='tests/*,includes/vendor/*'
2 changes: 2 additions & 0 deletions bin/.travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ env:
- WP_VERSION=latest WP_MULTISITE=1
- WP_VERSION=3.8 WP_MULTISITE=0
- WP_VERSION=3.8 WP_MULTISITE=1
- WP_VERSION=3.7 WP_MULTISITE=0
- WP_VERSION=3.7 WP_MULTISITE=1

before_script:
- export WP_TESTS_DIR=/tmp/wordpress-tests/
Expand Down
65 changes: 0 additions & 65 deletions bin/install-wp-tests.sh

This file was deleted.

15 changes: 8 additions & 7 deletions connectors/blogs.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
class WP_Stream_Connector_Blogs extends WP_Stream_Connector {

/**
* Context name
* Connector slug
*
* @var string
*/
public static $name = 'blogs';

/**
* Actions registered for this context
* Actions registered for this connector
* @var array
*/
public static $actions = array(
Expand All @@ -30,12 +31,12 @@ class WP_Stream_Connector_Blogs extends WP_Stream_Connector {
);

/**
* Return translated context label
* Return translated connector label
*
* @return string Translated context label
* @return string Translated connector label
*/
public static function get_label() {
return __( 'Sites', 'stream' );
return __( 'Sites', 'default' );
}

/**
Expand Down Expand Up @@ -79,12 +80,12 @@ public static function get_context_labels() {
* @return array Action links
*/
public static function action_links( $links, $record ) {
$links [ __( 'Site Admin', 'stream' ) ] = get_admin_url( $record->object_id );
$links [ __( 'Site Admin', 'default' ) ] = get_admin_url( $record->object_id );
if ( $record->object_id ) {
$site_admin_link = get_admin_url( $record->object_id );

if ( $site_admin_link ) {
$links [ __( 'Site Admin', 'stream' ) ] = $site_admin_link;
$links [ __( 'Site Admin', 'default' ) ] = $site_admin_link;
}

$site_settings_link = add_query_arg(
Expand Down
81 changes: 68 additions & 13 deletions connectors/comments.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
class WP_Stream_Connector_Comments extends WP_Stream_Connector {

/**
* Context name
* Connector slug
*
* @var string
*/
public static $name = 'comments';

/**
* Actions registered for this context
* Actions registered for this connector
*
* @var array
*/
Expand All @@ -28,12 +28,12 @@ class WP_Stream_Connector_Comments extends WP_Stream_Connector {
);

/**
* Return translated context label
* Return translated connector label
*
* @return string Translated context label
* @return string Translated connector label
*/
public static function get_label() {
return __( 'Comments', 'stream' );
return __( 'Comments', 'default' );
}

/**
Expand Down Expand Up @@ -65,7 +65,7 @@ public static function get_action_labels() {
*/
public static function get_context_labels() {
return array(
'comments' => __( 'Comments', 'stream' ),
'comments' => __( 'Comments', 'default' ),
);
}

Expand All @@ -83,7 +83,7 @@ public static function action_links( $links, $record ) {
$del_nonce = wp_create_nonce( "delete-comment_$comment->comment_ID" );
$approve_nonce = wp_create_nonce( "approve-comment_$comment->comment_ID" );

$links[ __( 'Edit', 'stream' ) ] = admin_url( "comment.php?action=editcomment&c=$comment->comment_ID" );
$links[ __( 'Edit', 'default' ) ] = admin_url( "comment.php?action=editcomment&c=$comment->comment_ID" );

if ( 1 === $comment->comment_approved ) {
$links[ __( 'Unapprove', 'stream' ) ] = admin_url(
Expand Down Expand Up @@ -179,6 +179,10 @@ public static function callback_comment_flood_trigger( $time_lastcomment, $time_
* @action wp_insert_comment
*/
public static function callback_wp_insert_comment( $comment_id, $comment ) {
if ( in_array( $comment->comment_type, self::get_ignored_comment_types() ) ) {
return;
}

$user_id = self::get_comment_author( $comment, 'id' );
$user_name = self::get_comment_author( $comment, 'name' );
$post_id = $comment->comment_post_ID;
Expand Down Expand Up @@ -222,7 +226,12 @@ public static function callback_wp_insert_comment( $comment_id, $comment ) {
* @action edit_comment
*/
public static function callback_edit_comment( $comment_id ) {
$comment = get_comment( $comment_id );
$comment = get_comment( $comment_id );

if ( in_array( $comment->comment_type, self::get_ignored_comment_types() ) ) {
return;
}

$user_id = self::get_comment_author( $comment, 'id' );
$user_name = self::get_comment_author( $comment, 'name' );
$post_id = $comment->comment_post_ID;
Expand All @@ -247,7 +256,12 @@ public static function callback_edit_comment( $comment_id ) {
* @action delete_comment
*/
public static function callback_delete_comment( $comment_id ) {
$comment = get_comment( $comment_id );
$comment = get_comment( $comment_id );

if ( in_array( $comment->comment_type, self::get_ignored_comment_types() ) ) {
return;
}

$user_id = self::get_comment_author( $comment, 'id' );
$user_name = self::get_comment_author( $comment, 'name' );
$post_id = $comment->comment_post_ID;
Expand All @@ -272,7 +286,12 @@ public static function callback_delete_comment( $comment_id ) {
* @action trash_comment
*/
public static function callback_trash_comment( $comment_id ) {
$comment = get_comment( $comment_id );
$comment = get_comment( $comment_id );

if ( in_array( $comment->comment_type, self::get_ignored_comment_types() ) ) {
return;
}

$user_id = self::get_comment_author( $comment, 'id' );
$user_name = self::get_comment_author( $comment, 'name' );
$post_id = $comment->comment_post_ID;
Expand All @@ -297,7 +316,12 @@ public static function callback_trash_comment( $comment_id ) {
* @action untrash_comment
*/
public static function callback_untrash_comment( $comment_id ) {
$comment = get_comment( $comment_id );
$comment = get_comment( $comment_id );

if ( in_array( $comment->comment_type, self::get_ignored_comment_types() ) ) {
return;
}

$user_id = self::get_comment_author( $comment, 'id' );
$user_name = self::get_comment_author( $comment, 'name' );
$post_id = $comment->comment_post_ID;
Expand All @@ -322,7 +346,12 @@ public static function callback_untrash_comment( $comment_id ) {
* @action spam_comment
*/
public static function callback_spam_comment( $comment_id ) {
$comment = get_comment( $comment_id );
$comment = get_comment( $comment_id );

if ( in_array( $comment->comment_type, self::get_ignored_comment_types() ) ) {
return;
}

$user_id = self::get_comment_author( $comment, 'id' );
$user_name = self::get_comment_author( $comment, 'name' );
$post_id = $comment->comment_post_ID;
Expand All @@ -347,7 +376,12 @@ public static function callback_spam_comment( $comment_id ) {
* @action unspam_comment
*/
public static function callback_unspam_comment( $comment_id ) {
$comment = get_comment( $comment_id );
$comment = get_comment( $comment_id );

if ( in_array( $comment->comment_type, self::get_ignored_comment_types() ) ) {
return;
}

$user_id = self::get_comment_author( $comment, 'id' );
$user_name = self::get_comment_author( $comment, 'name' );
$post_id = $comment->comment_post_ID;
Expand All @@ -372,6 +406,10 @@ public static function callback_unspam_comment( $comment_id ) {
* @action transition_comment_status
*/
public static function callback_transition_comment_status( $new_status, $old_status, $comment ) {
if ( in_array( $comment->comment_type, self::get_ignored_comment_types() ) ) {
return;
}

if ( 'approved' !== $new_status && 'unapproved' !== $new_status || 'trash' === $old_status || 'spam' === $old_status ) {
return;
}
Expand Down Expand Up @@ -404,6 +442,11 @@ public static function callback_comment_duplicate_trigger( $comment_data ) {

$comment_id = $wpdb->last_result[0]->comment_ID;
$comment = get_comment( $comment_id );

if ( in_array( $comment->comment_type, self::get_ignored_comment_types() ) ) {
return;
}

$user_id = self::get_comment_author( $comment, 'id' );
$user_name = self::get_comment_author( $comment, 'name' );
$post_id = $comment->comment_post_ID;
Expand All @@ -422,4 +465,16 @@ public static function callback_comment_duplicate_trigger( $comment_data ) {
);
}

/**
* Constructs list of ignored comment types for the comments connector
*
* @return array List of ignored comment types
*/
public static function get_ignored_comment_types() {
return apply_filters(
'wp_stream_comment_exclude_comment_types',
array()
);
}

}
10 changes: 5 additions & 5 deletions connectors/editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@
class WP_Stream_Connector_Editor extends WP_Stream_Connector {

/**
* Context name
* Connector slug
*
* @var string
*/
public static $name = 'editor';

/**
* Actions registered for this context
* Actions registered for this connector
*
* @var array
*/
public static $actions = array();

/**
* Actions registered for this context
* Actions registered for this connector
*
* @var array
*/
Expand All @@ -35,9 +35,9 @@ public static function register() {
}

/**
* Return translated context label
* Return translated connector label
*
* @return string Translated context label
* @return string Translated connector label
*/
public static function get_label() {
return __( 'Theme Editor', 'stream' );
Expand Down
14 changes: 7 additions & 7 deletions connectors/installer.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
class WP_Stream_Connector_Installer extends WP_Stream_Connector {

/**
* Context name
* Context slug

This comment has been minimized.

Copy link
@shadyvb

shadyvb Jun 18, 2014

Contributor

@lukecarbis This should probably say 'Connector' as well.

This comment has been minimized.

Copy link
@frankiejarrett

frankiejarrett Jun 18, 2014

Contributor

@shadyvb @lukecarbis Whoops, I thought I fixed this in all the connectors in ed76de0#diff-5dbdac24c40e63eaa3f5325b2d2d4878R3 but it looks like I missed it in the Installer connector.

This comment has been minimized.

Copy link
@frankiejarrett
*
* @var string
*/
public static $name = 'installer';

/**
* Actions registered for this context
* Actions registered for this connector
*
* @var array
*/
Expand All @@ -27,9 +27,9 @@ class WP_Stream_Connector_Installer extends WP_Stream_Connector {
);

/**
* Return translated context label
* Return translated connector label
*
* @return string Translated context label
* @return string Translated connector label
*/
public static function get_label() {
return __( 'Installer', 'stream' );
Expand Down Expand Up @@ -58,9 +58,9 @@ public static function get_action_labels() {
*/
public static function get_context_labels() {
return array(
'plugins' => __( 'Plugins', 'stream' ),
'themes' => __( 'Themes', 'stream' ),
'wordpress' => __( 'WordPress', 'stream' ),
'plugins' => __( 'Plugins', 'default' ),
'themes' => __( 'Themes', 'default' ),
'wordpress' => __( 'WordPress', 'default' ),
);
}

Expand Down
Loading

1 comment on commit b8b2d3b

@lukecarbis
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fjarrett @shadyvb Can you please review this merge? Particularly bin/.travis.yml and tests/bootstrap.php changes.

Also, phpcs.ruleset.xml was removed from the 2.0.0 branch and I couldn't figure out why, so I put it back (since @shadyvb made some changes to it). Do we still need it?

Please sign in to comment.