Issues (557)

Security Analysis    no request data  

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

homes-com/widgets/class-commute-time-widget.php (5 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
0 ignored issues
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 16 and the first side effect is on line 9.

The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.

The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.

To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.

Loading history...
2
/**
3
 * Homes.com Commute Time Widget (http://www.homes.com/widget/commute-time/)
4
 *
5
 * @package RE-PRO
6
 */
7
8
	/* Exit if accessed directly. */
9
if ( ! defined( 'ABSPATH' ) ) { exit; }
10
11
/**
12
 * HomesCommuteTimeWidget class.
13
 *
14
 * @extends WP_Widget
15
 */
16
class HomesCommuteTimeWidget extends WP_Widget {
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
17
18
	/**
19
	 * __construct function.
20
	 *
21
	 * @access public
22
	 * @return void
0 ignored issues
show
Comprehensibility Best Practice introduced by
Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.

Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.

Please refer to the PHP core documentation on constructors.

Loading history...
23
	 */
24
	public function __construct() {
25
26
		parent::__construct(
27
			'homes_commute_time',
28
			__( 'Homes Commute Time', 're-pro' ),
29
			array(
30
				'description' => __( 'Display a form that checks the commute time from Homes.com', 're-pro' ),
31
				'classname'   => 're-pro re-pro-widget homes-widget homes-commute-time',
32
				'customize_selective_refresh' => true,
33
			)
34
		);
35
	}
36
37
	/**
38
	 * Widget function.
39
	 *
40
	 * @access public
41
	 * @param mixed $args Arguments.
42
	 * @param mixed $instance Instance.
43
	 */
44
	public function widget( $args, $instance ) {
45
46
		$iframe_id = ! empty( $args['widget_id'] ) ? $args['widget_id'] : '';
47
		$title = ! empty( $instance['title'] ) ? $instance['title'] : '';
48
		$addr = ! empty( $instance['addr'] ) ? $instance['addr'] : '';
49
		$color = ! empty( $instance['color'] ) ? $instance['color'] : '';
50
51
		echo $args['before_widget'];
52
53
		echo $args['before_title'] . esc_attr( $title ) . $args['after_title'];
54
55
		$homes_widgets = new HomesWidgets();
56
57
		$homes_widgets->get_commute_time_widget( $iframe_id, $addr, $color );
58
59
		echo $args['after_widget'];
60
	}
61
62
	/**
63
	 * Form function.
64
	 *
65
	 * @access public
66
	 * @param mixed $instance Instance.
67
	 * @return void
68
	 */
69
	public function form( $instance ) {
70
71
		// Set default values.
72
		$instance = wp_parse_args( (array) $instance, array(
73
			'title' => '',
74
			'addr' => '',
75
			'color' => '0054a0',
76
		) );
77
78
		// Retrieve an existing value from the database.
79
		$title = ! empty( $instance['title'] ) ? $instance['title'] : '';
80
		$addr = ! empty( $instance['addr'] ) ? $instance['addr'] : '';
81
		$color = ! empty( $instance['color'] ) ? $instance['color'] : '';
82
83
		// Title.
84
		echo '<p>';
85
		echo '	<label for="' . $this->get_field_id( 'title' ) . '" class="title-label">' . __( 'Tile:', 're-pro' ) . '</label>';
86
		echo '	<input id="' . $this->get_field_id( 'title' ) . '" name="' . $this->get_field_name( 'title' ) . '" value="' . $title  . '" class="widefat">';
87
		echo '</p>';
88
89
		// Street Address.
90
		echo '<p>';
91
		echo '	<label for="' . $this->get_field_id( 'addr' ) . '" class="title-label">' . __( 'Default Start Address:', 're-pro' ) . '</label>';
92
		echo '	<input id="' . $this->get_field_id( 'addr' ) . '" name="' . $this->get_field_name( 'addr' ) . '" value="' . $addr  . '" class="widefat">';
93
		echo '</p>';
94
95
		// Button Color
96
		echo '<p>';
97
		echo '	<label for="' . $this->get_field_id( 'color' ) . '" class="title-label">' . __( 'Button Color:', 're-pro' ) . '</label>';
98
		echo '	<input id="' . $this->get_field_id( 'color' ) . '" name="' . $this->get_field_name( 'color' ) . '" value="' . $color  . '" class="widefat">';
99
		echo '</p>';
100
101
	}
102
103
	/**
104
	 * Update Widget Instance.
105
	 *
106
	 * @access public
107
	 * @param mixed $new_instance New Instance.
108
	 * @param mixed $old_instance Old Instance.
109
	 * @return $instance
0 ignored issues
show
The doc-type $instance could not be parsed: Unknown type name "$instance" at position 0. (view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
110
	 */
111 View Code Duplication
	public function update( $new_instance, $old_instance ) {
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
112
113
		$instance = $old_instance;
114
115
		$instance['title'] = ! empty( $new_instance['title'] ) ? strip_tags( $new_instance['title'] ) : '';
116
		$instance['addr'] = ! empty( $new_instance['addr'] ) ? strip_tags( $new_instance['addr'] ) : '';
117
		$instance['color'] = ! empty( $new_instance['color'] ) ? strip_tags( $new_instance['color'] ) : '';
118
119
		return $instance;
120
	}
121
}
122
123
/**
124
 * Register Homes.com Cummute Time Widget.
125
 *
126
 * @access public
127
 * @return void
128
 */
129
function repro_homes_com_commute_widget() {
130
	if ( ! is_ssl() ) {
131
		register_widget( 'HomesCommuteTimeWidget' );
132
	}
133
}
134
add_action( 'widgets_init', 'repro_homes_com_commute_widget' );
135