); } /** * Remove unnecessary keys from synced updates data. * * @access public * * @param array $args Hook arguments. * @return array $args Hook arguments. */ public function filter_update_keys( $args ) { $updates = $args[0]; if ( isset( $updates->no_update ) ) { unset( $updates->no_update ); } return $args; } /** * Filter out upgrader object from the completed upgrader action args. * * @access public * * @param array $args Hook arguments. * @return array $args Filtered hook arguments. */ public function filter_upgrader_process_complete( $args ) { array_shift( $args ); return $args; } /** * Expand the updates within a hook before they are serialized and sent to the server. * * @access public * * @param array $args The hook parameters. * @return array $args The hook parameters. */ public function expand_updates( $args ) { if ( $args[0] ) { return $this->get_all_updates(); } return $args; } /** * Expand the themes within a hook before they are serialized and sent to the server. * * @access public * * @param array $args The hook parameters. * @return array $args The hook parameters. */ public function expand_themes( $args ) { if ( ! isset( $args[0], $args[0]->response ) ) { return $args; } if ( ! is_array( $args[0]->response ) ) { // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_trigger_error trigger_error( 'Warning: Not an Array as expected but -> ' . wp_json_encode( $args[0]->response ) . ' instead', E_USER_WARNING ); return $args; } foreach ( $args[0]->response as $stylesheet => &$theme_data ) { $theme = wp_get_theme( $stylesheet ); $theme_data['name'] = $theme->name; } return $args; } /** * Perform module cleanup. * Deletes any transients and options that this module uses. * Usually triggered when uninstalling the plugin. * * @access public */ public function reset_data() { delete_option( self::UPDATES_CHECKSUM_OPTION_NAME ); } /** * Return Total number of objects. * * @param array $config Full Sync config. * * @return int total */ public function total( $config ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable return 3; } }