Skip to content

Commit

Permalink
phpcs fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Bardo committed Oct 19, 2016
1 parent 32748a8 commit 5b15a55
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 15 deletions.
4 changes: 3 additions & 1 deletion godaddy-email-marketing.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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;
}

Expand Down
10 changes: 5 additions & 5 deletions includes/class-dispatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) {
Expand All @@ -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;
}

Expand All @@ -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() {
Expand Down Expand Up @@ -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 ) );
}
}
10 changes: 7 additions & 3 deletions includes/class-shortcode.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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 ) ) {
Expand All @@ -83,6 +87,6 @@ function gem_form( $id, $echo = true ) {
return $form;
}

echo $form;
echo $form;//xss ok
}
}
10 changes: 7 additions & 3 deletions includes/render.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand All @@ -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();
?>

<div class="gem-form-wrapper" id="form-<?php echo absint( $form_id ); ?>">
<form action="<?php echo esc_url( $form->submit ); ?>" method="post" class="gem-form">
Expand Down Expand Up @@ -338,7 +342,7 @@ public static function date( $args ) {
<select fingerprint="date" data-id="<?php echo esc_attr( self::get_form_id( $args->name ) ); ?>" data-name="<?php echo esc_attr( $args->name ); ?>">
<option value=""> <?php esc_html_e( 'Day', 'godaddy-email-marketing' ) ?> </option>
<?php for ( $i = 1; $i < 32; $i++ ) : ?>
<option value="<?php echo strlen( $i ) < 2 ? '0'.$i : $i; ?>"> <?php echo esc_attr( $i ); ?> </option>
<option value="<?php echo strlen( $i ) < 2 ? '0' . esc_attr( $i ) : esc_attr( $i ); ?>"> <?php echo esc_attr( $i ); ?> </option>
<?php endfor; ?>
</select>
</span>
Expand Down
4 changes: 2 additions & 2 deletions includes/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -575,7 +575,7 @@ public function display_settings_page() {
<td data-colname="<?php esc_html_e( 'Shortcode', 'godaddy-email-marketing' ); ?>">
<input type="text" id="form-<?php echo absint( $form->id ); ?>" class="code clipboard-value" value="[gem id=<?php echo absint( $form->id ); ?>]" readonly />
<button data-copytarget="#form-<?php echo absint( $form->id ); ?>" class="button copy-to-clipboard">
<img src="<?php echo plugins_url( 'images/clippy.svg', GEM_PLUGIN_BASE ); ?>" width="14" alt="Copy to clipboard">
<img src="<?php echo esc_url( plugins_url( 'images/clippy.svg', GEM_PLUGIN_BASE ) ); ?>" width="14" alt="Copy to clipboard">
</button>
</td>
</tr>
Expand Down
2 changes: 1 addition & 1 deletion includes/widget.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public function form( $instance ) {
<?php else : ?>

<span><?php printf(
_x( 'Please set up your GoDaddy Email Marketing account in the %s.', 'link to settings page', 'godaddy-email-marketing' ),
esc_html_x( 'Please set up your GoDaddy Email Marketing account in the %s.', 'link to settings page', 'godaddy-email-marketing' ),
sprintf(
'<a href="%s">%s</a>',
esc_url( admin_url( 'options-general.php?page=gem-settings' ) ),
Expand Down

0 comments on commit 5b15a55

Please sign in to comment.