ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable return 1; } /** * Retrieve the actions that will be sent for this module during a full sync. * * @access public * * @return array Full sync actions of this module. */ public function get_full_sync_actions() { return array( 'jetpack_full_sync_network_options' ); } /** * Retrieve all network options as per the current network options whitelist. * * @access public * * @return array All network options. */ public function get_all_network_options() { $options = array(); foreach ( $this->network_options_whitelist as $option ) { $options[ $option ] = get_site_option( $option ); } return $options; } /** * Set the network options whitelist. * * @access public * * @param array $options The new network options whitelist. */ public function set_network_options_whitelist( $options ) { $this->network_options_whitelist = $options; } /** * Get the network options whitelist. * * @access public * * @return array The network options whitelist. */ public function get_network_options_whitelist() { return $this->network_options_whitelist; } /** * Reject non-whitelisted network options. * * @access public * * @param array $args The hook parameters. * @return array|false $args The hook parameters, false if not a whitelisted network option. */ public function whitelist_network_options( $args ) { if ( ! $this->is_whitelisted_network_option( $args[0] ) ) { return false; } return $args; } /** * Whether the option is a whitelisted network option. * * @access public * * @param string $option Option name. * @return boolean True if this is a whitelisted network option. */ public function is_whitelisted_network_option( $option ) { return in_array( $option, $this->network_options_whitelist, true ); } /** * Expand the network options 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_network_options( $args ) { if ( $args[0] ) { return $this->get_all_network_options(); } return $args; } /** * 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 count( $this->network_options_whitelist ); } }