$consumer_email = $this->get_current_option( 'consumer_email' ); $bonus = $this->plugin_options && $this->plugin_options->get( 'do_beta' ) ? '+' : ''; $php_version = preg_replace( '@^(\d+\.\d+).*@', '\1', phpversion() ); return sprintf( 'WP-Rocket|%s%s|%s|%s|%s|%s;', $this->plugin_version, $bonus, $consumer_key, $consumer_email, esc_url( $this->site_url ), $php_version ); } /** * Get a plugin option. If the value is currently being posted through the settings page, it is returned instead of the one stored in the database. * * @since 3.3.6 * @access protected * @author Grégory Viguier * * @param string $field_name Name of a plugin option. * @return string */ protected function get_current_option( $field_name ) { if ( current_user_can( 'rocket_manage_options' ) && wp_verify_nonce( filter_input( INPUT_POST, '_wpnonce' ), $this->settings_nonce_key . '-options' ) ) { $posted = filter_input( INPUT_POST, $this->settings_slug, FILTER_DEFAULT, FILTER_REQUIRE_ARRAY ); if ( ! empty( $posted[ $field_name ] ) && is_string( $posted[ $field_name ] ) ) { // The value has been posted through the settings page. return sanitize_text_field( $posted[ $field_name ] ); } } if ( ! $this->plugin_options ) { return ''; } $option_value = $this->plugin_options->get( $field_name ); if ( $option_value && is_string( $option_value ) ) { return $option_value; } return ''; } }