From 378cf1c4ebd791351a1acd141072a664d6ca90c2 Mon Sep 17 00:00:00 2001 From: Mike Schinkel Date: Sat, 4 Jun 2016 21:54:18 -0400 Subject: [PATCH 1/3] Fixed a problem with WPLib_Post_List_Base list_owner defaulting to WPLib_Posts when it should not. --- .../posts/includes/class-post-list-base.php | 20 ++++++++++++++++--- wplib.php | 2 +- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/modules/posts/includes/class-post-list-base.php b/modules/posts/includes/class-post-list-base.php index 47cb62b..a4e753f 100644 --- a/modules/posts/includes/class-post-list-base.php +++ b/modules/posts/includes/class-post-list-base.php @@ -19,7 +19,7 @@ function __construct( $posts, $args = array() ) { if ( isset( $posts ) && is_array( $posts ) ) { $args = wp_parse_args( $args, array( - 'list_owner' => 'WPLib_Posts', + 'list_owner' => false, )); /** @@ -27,12 +27,26 @@ function __construct( $posts, $args = array() ) { */ $list_owner = $args['list_owner']; - foreach ( $posts as $index => $post ) { + if ( ! $args['list_owner'] ) { - $posts[ $index ] = $list_owner::make_new_item( $post, $args ); + foreach ($posts as $index => $post) { + + $posts[$index] = $list_owner::make_new_item( $post, $args ); + + } + + } else { + + foreach ($posts as $index => $post) { + + $list_owner = $args['list_owner'] = WPLib_Posts::get_post_type_class( $post->post_type ); + $posts[$index] = $list_owner::make_new_item( $post, $args ); + + } } + } parent::__construct( $posts, $args ); diff --git a/wplib.php b/wplib.php index 3fcf39f..da01b67 100644 --- a/wplib.php +++ b/wplib.php @@ -43,7 +43,7 @@ */ class WPLib { - const RECENT_COMMIT = '0e85bc1'; + const RECENT_COMMIT = 'b6a8ed1'; const PREFIX = 'wplib_'; const SHORT_PREFIX = 'wplib_'; From e51244bf2f45e497824603f7a1676193157009e9 Mon Sep 17 00:00:00 2001 From: Mike Schinkel Date: Sun, 12 Jun 2016 21:12:43 -0400 Subject: [PATCH 2/3] Added an improvement to trigger_error() reporting. --- wplib.php | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/wplib.php b/wplib.php index da01b67..b6e46cd 100644 --- a/wplib.php +++ b/wplib.php @@ -496,7 +496,7 @@ private static function _load_modules() { foreach ( self::$_modules as $priority ) { - foreach ( $priority as $filepath ) { + foreach ( $priority as $module_name => $filepath ) { if ( isset( self::$_loaded_include_files[ $filepath ] ) ) { /* @@ -507,7 +507,7 @@ private static function _load_modules() { if ( self::is_development() && ! WPLib::is_found( $filepath ) ) { - self::trigger_error( sprintf( __( "Required file not found: %s", 'wplib' ), $filepath ) ); + self::trigger_error( sprintf( __( "File for Module %s not found: %s", 'wplib' ), $module_name, $filepath ) ); } @@ -617,6 +617,7 @@ private static function _find_autoload_files() { $class_key = self::is_production() ? md5( $class_key ) : $class_key; $autoload_files = static::cache_get( $cache_key = "autoload_files[{$class_key}]" ); + $autoload_files = array(); if ( ! $autoload_files || 0 === count( $autoload_files ) ) { @@ -1041,8 +1042,8 @@ static function is_script_debug() { */ static function add_class_action( $action, $priority = 10 ) { - $hook = str_replace( '-', '_', "_{$action}" ) . ( 10 !== intval( $priority ) ? "_{$priority}" : '' ); - add_action( $action, array( get_called_class(), $hook ), $priority, 99 ); + $method = str_replace( ['-', ':' ], '_', "_{$action}" ) . ( 10 !== intval( $priority ) ? "_{$priority}" : '' ); + add_action( $action, array( get_called_class(), $method ), $priority, 99 ); } @@ -1052,8 +1053,8 @@ static function add_class_action( $action, $priority = 10 ) { */ static function add_class_filter( $filter, $priority = 10 ) { - $hook = str_replace( '-', '_', "_{$filter}" ) . ( 10 !== intval( $priority ) ? "_{$priority}" : '' ); - add_filter( $filter, array( get_called_class(), $hook ), $priority, 99 ); + $method = str_replace( ['-', ':' ], '_', "_{$filter}" ) . ( 10 !== intval( $priority ) ? "_{$priority}" : '' ); + add_filter( $filter, array( get_called_class(), $method ), $priority, 99 ); } @@ -1063,8 +1064,8 @@ static function add_class_filter( $filter, $priority = 10 ) { */ static function remove_class_action( $action, $priority = 10 ) { - $hook = str_replace( '-', '_', "_{$action}" ) . ( 10 !== intval( $priority ) ? "_{$priority}" : '' ); - remove_action( $action, array( get_called_class(), $hook ), $priority ); + $method = str_replace( ['-', ':' ], '_', "_{$action}" ) . ( 10 !== intval( $priority ) ? "_{$priority}" : '' ); + remove_action( $action, array( get_called_class(), $method ), $priority ); } @@ -1074,8 +1075,8 @@ static function remove_class_action( $action, $priority = 10 ) { */ static function remove_class_filter( $filter, $priority = 10 ) { - $hook = str_replace( '-', '_', "_{$filter}" ) . ( 10 !== intval( $priority ) ? "_{$priority}" : '' ); - remove_filter( $filter, array( get_called_class(), $hook ), $priority ); + $method = str_replace( ['-', ':' ], '_', "_{$filter}" ) . ( 10 !== intval( $priority ) ? "_{$priority}" : '' ); + remove_filter( $filter, array( get_called_class(), $method ), $priority ); } From efaf9bdfa6350103e84b3065fe0f0ad3d6d8b992 Mon Sep 17 00:00:00 2001 From: Mike Schinkel Date: Mon, 13 Jun 2016 21:16:28 -0400 Subject: [PATCH 3/3] Merge branch 'master' into unit-tests # Conflicts: # www/content/mu-plugins/planit/planit.php --- wplib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wplib.php b/wplib.php index b6e46cd..42a7ce7 100644 --- a/wplib.php +++ b/wplib.php @@ -43,7 +43,7 @@ */ class WPLib { - const RECENT_COMMIT = 'b6a8ed1'; + const RECENT_COMMIT = 'e51244b'; const PREFIX = 'wplib_'; const SHORT_PREFIX = 'wplib_';