PluginProbe
MainWP Dashboard: Self-hosted WordPress Management for Agencies / 6.2.1
MainWP Dashboard: Self-hosted WordPress Management for Agencies v6.2.1
6.2.2 6.2.1 6.2 6.1.8 6.1.7 6.1.6 6.1.5 6.1.4 6.1.3 6.1.2 6.1.1 6.1 6.0.12 6.0.11 4.6.0.1 5.0 5.0.1 5.0.2 5.0.3 5.0.3.1 5.0.3.2 5.1 5.1.1 5.2 5.2.1 All 155 releases
← All changes | class/class-mainwp-hooks.php +32 -9 6.1.8 → 6.2.1 View file →
@@ -221,8 +221,9 @@
221 221
222 222 add_filter( 'mainwp_encrypt_key_value', array( &$this, 'hook_encrypt_key_value' ), 10, 4 );
223 223 add_filter( 'mainwp_decrypt_key_value', array( &$this, 'hook_decrypt_key_value' ), 10, 3 );
224 224 add_action( 'mainwp_delete_key_file', array( &$this, 'hook_delete_key_file' ), 10, 1 );
225 + add_filter( 'mainwp_delete_key_file_result', array( &$this, 'hook_delete_key_file_result' ), 10, 2 );
225 226 add_filter( 'mainwp_verify_ping_nonce', array( MainWP_Utility::class, 'hook_verify_ping_nonce' ), 10, 3 );
226 227 add_action( 'mainwp_fetch_url_authed', array( MainWP_Actions_Handler::instance(), 'hook_mainwp_fetch_url_authed' ), 10, 5 );
227 228
228 229 add_filter( 'mainwp_get_lookup_items', array( &$this, 'hook_get_lookup_items' ), 10, 4 );
@@ -870,10 +871,10 @@
870 871 /**
871 872 * Method hook_get_all_posts()
872 873 * Hook to get posts from sites.
873 874 *
874 - * @param object $sites Child Sites object.
875 - * @param array $post_data with values: keyword, dtsstart, dtsstop, status, maxRecords, post_type.
875 + * @param object|array $sites Child Sites object.
876 + * @param array $post_data with values: keyword, dtsstart, dtsstop, status, maxRecords, post_type.
876 877 *
877 878 * @return \stdClass $output All posts data array.
878 879 *
879 880 * @since 3.4.4
@@ -881,9 +882,9 @@
881 882 * @uses \MainWP\Dashboard\MainWP_Post::get_class_name()
882 883 * @uses \MainWP\Dashboard\MainWP_Utility::ctype_digit()
883 884 * @uses \MainWP\Dashboard\MainWP_Utility::map_site()
884 885 */
885 - public function hook_get_all_posts( $sites, $post_data = array() ) {
886 + public function hook_get_all_posts( $sites, $post_data = array() ) { // phpcs:ignore -- NOSONAR - complex.
886 887
887 888 $dbwebsites = array();
888 889
889 890 $data = MainWP_System_Utility::get_default_map_site_fields();
@@ -889,11 +890,21 @@
889 890 $data = MainWP_System_Utility::get_default_map_site_fields();
890 891 $data[] = 'verify_certificate';
891 892
892 893 if ( '' !== $sites ) {
893 - foreach ( $sites as $v ) {
894 - if ( MainWP_Utility::ctype_digit( $v ) ) {
895 - $website = MainWP_DB::instance()->get_website_by_id( $v );
894 + foreach ( $sites as $site ) {
895 + // Keep accepting the legacy list of scalar site IDs as well
896 + // as the mapped website objects used by REST v2.
897 + if ( is_object( $site ) ) {
898 + $site_id = isset( $site->id ) ? $site->id : '';
899 + } elseif ( is_array( $site ) ) {
900 + $site_id = isset( $site['id'] ) ? $site['id'] : '';
901 + } else {
902 + $site_id = $site;
903 + }
904 +
905 + if ( MainWP_Utility::ctype_digit( $site_id ) ) {
906 + $website = MainWP_DB::instance()->get_website_by_id( $site_id );
896 907 if ( empty( $website->sync_errors ) && ! MainWP_System_Utility::is_suspended_site( $website ) ) {
897 908 $dbwebsites[ $website->id ] = MainWP_Utility::map_site( $website, $data );
898 909 }
899 910 }
@@ -1760,9 +1771,9 @@
1760 1771
1761 1772 /**
1762 1773 * Method hook_uptime_preload_data().
1763 1774 *
1764 - * @param array $websites Websites array.
1775 + * @param array $websites Websites array.
1765 1776 *
1766 1777 * @return void
1767 1778 */
1768 1779 public function hook_uptime_preload_data( $websites ) {
@@ -1991,8 +2002,21 @@
1991 2002 return MainWP_Keys_Manager::instance()->delete_key_file( $key_file );
1992 2003 }
1993 2004
1994 2005 /**
2006 + * Delete one exact key file and return only read-verified truth.
2007 + *
2008 + * @param mixed $input_value Filter-chain initial value.
2009 + * @param string $key_file Key file name.
2010 + *
2011 + * @return bool Whether exact absence was proved.
2012 + */
2013 + public function hook_delete_key_file_result( $input_value, $key_file ) {
2014 + unset( $input_value );
2015 + return MainWP_Keys_Manager::instance()->delete_key_file_with_result( $key_file );
2016 + }
2017 +
2018 + /**
1995 2019 * Method hook_get_lookup_items().
1996 2020 *
1997 2021 * @param bool $false_val false value.
1998 2022 * @param string $item_name item name.
@@ -2080,9 +2104,9 @@
2080 2104
2081 2105 /**
2082 2106 * Method hook_get_primary_backup_method.
2083 2107 *
2084 - * @param mixed $inpval Hook input value.
2108 + * @param mixed $inpval Hook input value.
2085 2109 * @param int|false $siteid Optional Site ID; false for global method.
2086 2110 *
2087 2111 * @since 6.0.10.
2088 2112 *
@@ -2103,6 +2127,5 @@
2103 2127 }
2104 2128 }
2105 2129 return $primaryBackup;
2106 2130 }
2107 -
2108 2131 }