From 5b15a558546841d8793290666e23e16d67b47e0d Mon Sep 17 00:00:00 2001 From: Jonathan Bardo Date: Wed, 19 Oct 2016 15:24:21 -0400 Subject: [PATCH] phpcs fix --- godaddy-email-marketing.php | 4 +++- includes/class-dispatcher.php | 10 +++++----- includes/class-shortcode.php | 10 +++++++--- includes/render.php | 10 +++++++--- includes/settings.php | 4 ++-- includes/widget.php | 2 +- 6 files changed, 25 insertions(+), 15 deletions(-) diff --git a/godaddy-email-marketing.php b/godaddy-email-marketing.php index 4686391..1f2d306 100644 --- a/godaddy-email-marketing.php +++ b/godaddy-email-marketing.php @@ -206,6 +206,8 @@ public function enqueue() { * Adds the settings page to the action links. * * @param array $actions An array of plugin action links. + * + * @return array */ public function action_links( $actions ) { return array_merge( @@ -234,7 +236,7 @@ public function deactivate() { public function action_admin_notices() { $screen = get_current_screen(); - if ( 'plugins' != $screen->id ) { + if ( 'plugins' !== $screen->id ) { return; } diff --git a/includes/class-dispatcher.php b/includes/class-dispatcher.php index 986cd86..4883be0 100644 --- a/includes/class-dispatcher.php +++ b/includes/class-dispatcher.php @@ -29,9 +29,10 @@ class GEM_Dispatcher { /** * Gets and sets the forms. * - * @param string $username The username. + * @param string $username The username. + * @param string $api_key + * * @return string $api_key The API key. - * @return array|false The form fields array or false. */ public static function fetch_forms( $username = '', $api_key = '' ) { if ( ! $username && ! $api_key ) { @@ -57,7 +58,7 @@ public static function fetch_forms( $username = '', $api_key = '' ) { delete_transient( 'gem-' . $username . '-lists' ); // Credentials are incorrect. - if ( ! in_array( wp_remote_retrieve_response_code( $response ), self::$ok_codes ) ) { + if ( ! in_array( wp_remote_retrieve_response_code( $response ), self::$ok_codes, true ) ) { return false; } @@ -70,7 +71,6 @@ public static function fetch_forms( $username = '', $api_key = '' ) { /** * Add a default form. * - * @param string $username The username. * @return bool True on success or false on failue. */ public static function add_default_form() { @@ -247,6 +247,6 @@ public static function get_method_url( $method, $params = array(), $auth = false * @return bool */ public static function is_response_ok( $request ) { - return ( ! is_wp_error( $request ) && in_array( wp_remote_retrieve_response_code( $request ), self::$ok_codes ) ); + return ( ! is_wp_error( $request ) && in_array( wp_remote_retrieve_response_code( $request ), self::$ok_codes, true ) ); } } diff --git a/includes/class-shortcode.php b/includes/class-shortcode.php index a73422c..6370d60 100644 --- a/includes/class-shortcode.php +++ b/includes/class-shortcode.php @@ -16,6 +16,8 @@ class GEM_Shortcode { * Renders the shortcode. * * @param array $atts An array of shortcode attributes. + * + * @return string|void */ public function render( $atts ) { extract( shortcode_atts( array( @@ -69,10 +71,12 @@ public function shortcode_ui() { * The main template tag. Pass on the ID and watch the magic happen. * * @since 1.0 - * @see GEM_Form_Renderer + * @see GEM_Form_Renderer * - * @param int $id The ID of the form you wish to output. + * @param int $id The ID of the form you wish to output. * @param bool $echo Wether to echo the form field. Default true. + * + * @return string */ function gem_form( $id, $echo = true ) { if ( class_exists( 'GEM_Form_Renderer', false ) ) { @@ -83,6 +87,6 @@ function gem_form( $id, $echo = true ) { return $form; } - echo $form; + echo $form;//xss ok } } diff --git a/includes/render.php b/includes/render.php index c6694c4..8a00d0a 100644 --- a/includes/render.php +++ b/includes/render.php @@ -23,7 +23,9 @@ class GEM_Form_Renderer { * Generates the form. * * @param string $form_id Form ID. - * @param bool $echo Wether to echo the form field. Default false. + * @param bool $echo Wether to echo the form field. Default false. + * + * @return string */ public function process( $form_id, $echo = false ) { $form = GEM_Dispatcher::get_fields( (int) $form_id ); @@ -38,7 +40,9 @@ public function process( $form_id, $echo = false ) { if ( ! empty( $form->fields ) && in_array( (int) $form_id, $form_ids, true ) ) : - self::$loops++; ob_start(); ?> + self::$loops++; + ob_start(); + ?>
@@ -338,7 +342,7 @@ public static function date( $args ) { diff --git a/includes/settings.php b/includes/settings.php index 35d1ba8..608c13f 100644 --- a/includes/settings.php +++ b/includes/settings.php @@ -207,7 +207,7 @@ public function page_load() { break; } - } else if ( isset( $_GET['settings-updated'] ) && 'cli' !== php_sapi_name() ) { // @codeCoverageIgnoreStart + } elseif ( isset( $_GET['settings-updated'] ) && 'cli' !== php_sapi_name() ) { // @codeCoverageIgnoreStart wp_safe_redirect( remove_query_arg( array( 'action', 'settings-updated' ), add_query_arg( 'tab', 'settings' ) ) ); exit; } @@ -575,7 +575,7 @@ public function display_settings_page() { diff --git a/includes/widget.php b/includes/widget.php index 6cce0ac..4e98d9c 100644 --- a/includes/widget.php +++ b/includes/widget.php @@ -153,7 +153,7 @@ public function form( $instance ) { %s', esc_url( admin_url( 'options-general.php?page=gem-settings' ) ),