Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle bool values appropriately during wp_stream_log_data filter #684

Merged
merged 1 commit into from
Jan 17, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion connectors/class-wp-stream-connector-acf.php
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,11 @@ public static function check_location_rules() {
*
* @return array|bool
*/
public static function log_override( array $data ) {
public static function log_override( $data ) {
if ( ! is_array( $data ) ) {
return $data;
}

if ( 'posts' === $data['connector'] && 'acf' === $data['context'] ) {
$data['context'] = 'field_groups';
$data['connector'] = self::$name;
Expand Down
13 changes: 12 additions & 1 deletion connectors/class-wp-stream-connector-bbpress.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,18 @@ public static function register() {
add_filter( 'wp_stream_log_data', array( __CLASS__, 'log_override' ) );
}

public static function log_override( array $data ) {
/**
* Override connector log for our own Settings / Actions
*
* @param array $data
*
* @return array|bool
*/
public static function log_override( $data ) {
if ( ! is_array( $data ) ) {
return $data;
}

if ( 'settings' === $data['connector'] && 'bbpress' === $data['args']['context'] ) {
$settings = bbp_admin_get_settings_fields();

Expand Down
6 changes: 5 additions & 1 deletion connectors/class-wp-stream-connector-edd.php
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,11 @@ public static function check_edd_settings( $old_value, $new_value ) {
*
* @return array|bool
*/
public static function log_override( array $data ) {
public static function log_override( $data ) {
if ( ! is_array( $data ) ) {
return $data;
}

if ( 'posts' === $data['connector'] && 'download' === $data['context'] ) {
// Download posts operations
$data['context'] = 'downloads';
Expand Down
6 changes: 5 additions & 1 deletion connectors/class-wp-stream-connector-jetpack.php
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,11 @@ public static function check_sharedaddy_disable_resources( $old_value, $new_valu
*
* @return array|bool
*/
public static function log_override( array $data ) {
public static function log_override( $data ) {
if ( ! is_array( $data ) ) {
return $data;
}

// Handling our Settings
if ( 'settings' === $data['connector'] && isset( self::$options_override[ $data['args']['option'] ] ) ) {
if ( isset( $data['args']['option_key'] ) ) {
Expand Down
6 changes: 5 additions & 1 deletion connectors/class-wp-stream-connector-wordpress-seo.php
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,11 @@ private static function meta( $object_id, $meta_key, $meta_value ) {
*
* @return array|bool
*/
public static function log_override( array $data ) {
public static function log_override( $data ) {
if ( ! is_array( $data ) ) {
return $data;
}

global $pagenow;

if ( 'options.php' === $pagenow && 'settings' === $data['connector'] && wp_stream_filter_input( INPUT_POST, '_wp_http_referer' ) ) {
Expand Down