nction getSettings() { $settings = aioseo()->options->all(); array_walk_recursive( $settings, function( &$v ) { if ( is_string( $v ) && strpos( $v, '"' ) !== false ) { $v = str_replace( '"', '\"', $v ); } }); $settings = $this->filterPrivateSettings( $settings ); $internal = aioseo()->internalOptions->all(); array_walk_recursive( $internal, function( &$v ) { if ( is_string( $v ) && strpos( $v, '"' ) !== false ) { $v = str_replace( '"', '\"', $v ); } }); return [ 'options' => $settings, 'internal' => $internal ]; } /** * Return a list of active plugins. * * @since 4.0.0 * * @return array An array of active plugin data. */ private function getActivePlugins() { if ( ! function_exists( 'get_plugins' ) ) { include ABSPATH . '/wp-admin/includes/plugin.php'; } $active = get_option( 'active_plugins', [] ); $plugins = array_intersect_key( get_plugins(), array_flip( $active ) ); return array_map( static function ( $plugin ) { if ( isset( $plugin['Version'] ) ) { return $plugin['Version']; } return 'Not Set'; }, $plugins ); } /** * Generate a random start date for usage tracking. * * @since 4.0.0 * * @return integer The randomized start date. */ private function generateStartDate() { $tracking = [ 'days' => wp_rand( 0, 6 ) * DAY_IN_SECONDS, 'hours' => wp_rand( 0, 23 ) * HOUR_IN_SECONDS, 'minutes' => wp_rand( 0, 23 ) * HOUR_IN_SECONDS, 'seconds' => wp_rand( 0, 59 ) ]; return strtotime( 'next sunday' ) + array_sum( $tracking ); } /** * Anonimizes or obfuscates the value of certain settings. * * @since 4.3.2 * * @param array $settings The settings. * @return array The altered settings. */ private function filterPrivateSettings( $settings ) { if ( ! empty( $settings['advanced']['openAiKey'] ) ) { $settings['advanced']['openAiKey'] = true; } if ( ! empty( $settings['localBusiness']['maps']['apiKey'] ) ) { $settings['localBusiness']['maps']['apiKey'] = true; } return $settings; } }