default_arguments ); foreach ( $arguments as $var => $val ) { if ( 'options' == $var ) { $this->response[$var] = $this->get_values( $var, $val, 'get_option', 'wp_load_alloptions' ); } else if ( 'site-options' == $var ) { $this->response[$var] = $this->get_values( $var, $val, 'get_site_option' ); } else if ( 'transients' == $var ) { $this->response[$var] = $this->get_values( $var, $val, 'get_transient' ); } else if ( 'site-transients' == $var ) { $this->response[$var] = $this->get_values( $var, $val, 'get_site_transient' ); } else { $this->response[$var] = new WP_Error( 'invalid-argument', "The $var argument is not recognized by the get-options verb." ); } } return $this->response; } private function get_values( $argument, $names, $function, $all_function = false ) { if ( true === $names ) { if ( false === $all_function ) { return new WP_Error( 'invalid-argument-value', "The $argument argument does not support listing all availble options. Please supply an array of strings." ); } else if ( is_callable( $all_function ) ) { $options = call_user_func( $all_function ); unset( $options['ithemes-sync-cache'] ); return $options; } else { return new WP_Error( "missing-function-$all_function", "An unknown error is preventing the function for listing all $argument from being callable." ); } } else if ( is_array( $names ) || is_string( $names ) ) { $options = array(); foreach ( (array) $names as $name ) { $options[$name] = call_user_func( $function, $name ); } return $options; } else { if ( false === $all_function ) { return new WP_Error( 'invalid-argument-value', "The $argument argument requires an array of strings." ); } else { return new WP_Error( 'invalid-argument-value', "The $argument argument requires an array of strings or a boolean true." ); } } } }