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.

homefinder/widgets/class-homefinder-widgets.php (16 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 15 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
 * HomeFinder Widgets Class
4
 *
5
 * @package RE-PRO
6
 */
7
8
// Exit if accessed directly.
9
if ( ! defined( 'ABSPATH' ) ) { exit; }
10
11
if ( ! class_exists( 'HomeFinderWidgets' ) ) {
12
	/**
13
	 * HomeFinderWidgets class.
14
	 */
15
	class HomeFinderWidgets {
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...
16
17
		/**
18
		 * Widget data to be sent to JS.
19
		 *
20
		 * @var [Array]
21
		 */
22
		static private $hf_data;
23
24
		/**
25
		 * __construct function.
26
		 *
27
		 * @access public
28
		 * @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...
29
		 */
30
		public function __construct() {
31
			add_action( 'wp_footer', array( $this, 'hf_enqueue' ) );
32
33
		}
34
35
		/**
36
		 * Enqueue JS on footer and handle multiple widgets.
37
		 */
38
		public function hf_enqueue() {
39
			wp_enqueue_script( 'hf-widget-loader', 'http://www.homefinder.com/widgets/js/widgetLoader.js', array( 'jquery' ), null, true );
40
			wp_enqueue_script( 'hf-widgets-js', plugins_url( 'homefinder-widgets.js', __FILE__ ), array( 'jquery' ), null, true );
41
			wp_localize_script( 'hf-widgets-js', 'hf_data', static::$hf_data );
0 ignored issues
show
Since $hf_data is declared private, accessing it with static will lead to errors in possible sub-classes; consider using self, or increasing the visibility of $hf_data to at least protected.

Let’s assume you have a class which uses late-static binding:

class YourClass
{
    private static $someVariable;

    public static function getSomeVariable()
    {
        return static::$someVariable;
    }
}

The code above will run fine in your PHP runtime. However, if you now create a sub-class and call the getSomeVariable() on that sub-class, you will receive a runtime error:

class YourSubClass extends YourClass { }

YourSubClass::getSomeVariable(); // Will cause an access error.

In the case above, it makes sense to update SomeClass to use self instead:

class SomeClass
{
    private static $someVariable;

    public static function getSomeVariable()
    {
        return self::$someVariable; // self works fine with private.
    }
}
Loading history...
42
43
		}
44
45
		/**
46
		 * HomeFinder ID Names.
47
		 *
48
		 * @access public
49
		 * @param string $widget_id (default: '').
50
		 * @return string $widget_id.
51
		 */
52
		public function homefinder_id( $widget_id = '' ) {
53
54
			if ( '' !== $widget_id  ) {
55
				return sanitize_html_class( $widget_id );
56
			}
57
58
		}
59
60
		/**
61
		 * HomeFinder div Class Names.
62
		 *
63
		 * @access public
64
		 * @param string $widget_name (default: '').
65
		 * @return string class name.
66
		 */
67
		public function homefinder_class( $widget_name = '' ) {
68
69
			if ( '' !== $widget_name ) {
70
				return 'homefinder homefinder-widget homefinder-' . sanitize_html_class( $widget_name ) . '-widget';
71
			} else {
72
				return 'homefinder homefinder-widget';
73
			}
74
75
		}
76
77
		/* HomeFinder WIDGETS. */
78
79
		/**
80
		 * Get Homes For Sale Widget.
81
		 *
82
		 * @access public
83
		 * @return void
84
		 */
85 View Code Duplication
		public function get_homes_for_sale_widget() {
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...
86
87
			$widget_data = array(
88
				'type' => 'homeSearch',
89
				'container' => 'homeSearchWidget',
90
			);
91
			static::$hf_data[] = $widget_data;
0 ignored issues
show
Since $hf_data is declared private, accessing it with static will lead to errors in possible sub-classes; consider using self, or increasing the visibility of $hf_data to at least protected.

Let’s assume you have a class which uses late-static binding:

class YourClass
{
    private static $someVariable;

    public static function getSomeVariable()
    {
        return static::$someVariable;
    }
}

The code above will run fine in your PHP runtime. However, if you now create a sub-class and call the getSomeVariable() on that sub-class, you will receive a runtime error:

class YourSubClass extends YourClass { }

YourSubClass::getSomeVariable(); // Will cause an access error.

In the case above, it makes sense to update SomeClass to use self instead:

class SomeClass
{
    private static $someVariable;

    public static function getSomeVariable()
    {
        return self::$someVariable; // self works fine with private.
    }
}
Loading history...
92
93
			$index = count( static::$hf_data ) - 1;
0 ignored issues
show
Since $hf_data is declared private, accessing it with static will lead to errors in possible sub-classes; consider using self, or increasing the visibility of $hf_data to at least protected.

Let’s assume you have a class which uses late-static binding:

class YourClass
{
    private static $someVariable;

    public static function getSomeVariable()
    {
        return static::$someVariable;
    }
}

The code above will run fine in your PHP runtime. However, if you now create a sub-class and call the getSomeVariable() on that sub-class, you will receive a runtime error:

class YourSubClass extends YourClass { }

YourSubClass::getSomeVariable(); // Will cause an access error.

In the case above, it makes sense to update SomeClass to use self instead:

class SomeClass
{
    private static $someVariable;

    public static function getSomeVariable()
    {
        return self::$someVariable; // self works fine with private.
    }
}
Loading history...
94
95
			echo '<div id="homeSearchWidget-'. $index .'" class="'. $this->homefinder_class( 'homes-for-sale' ) .'"></div>';
96
97
		}
98
99
		/**
100
		 * Get Open House Widget.
101
		 *
102
		 * @access public
103
		 * @return void
104
		 */
105 View Code Duplication
		public function get_open_house_widget() {
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...
106
107
			$widget_data = array(
108
				'type' => 'openHouseSearch',
109
				'container' => 'openHouseSearchWidget',
110
			);
111
			static::$hf_data[] = $widget_data;
0 ignored issues
show
Since $hf_data is declared private, accessing it with static will lead to errors in possible sub-classes; consider using self, or increasing the visibility of $hf_data to at least protected.

Let’s assume you have a class which uses late-static binding:

class YourClass
{
    private static $someVariable;

    public static function getSomeVariable()
    {
        return static::$someVariable;
    }
}

The code above will run fine in your PHP runtime. However, if you now create a sub-class and call the getSomeVariable() on that sub-class, you will receive a runtime error:

class YourSubClass extends YourClass { }

YourSubClass::getSomeVariable(); // Will cause an access error.

In the case above, it makes sense to update SomeClass to use self instead:

class SomeClass
{
    private static $someVariable;

    public static function getSomeVariable()
    {
        return self::$someVariable; // self works fine with private.
    }
}
Loading history...
112
113
			$index = count( static::$hf_data ) - 1;
0 ignored issues
show
Since $hf_data is declared private, accessing it with static will lead to errors in possible sub-classes; consider using self, or increasing the visibility of $hf_data to at least protected.

Let’s assume you have a class which uses late-static binding:

class YourClass
{
    private static $someVariable;

    public static function getSomeVariable()
    {
        return static::$someVariable;
    }
}

The code above will run fine in your PHP runtime. However, if you now create a sub-class and call the getSomeVariable() on that sub-class, you will receive a runtime error:

class YourSubClass extends YourClass { }

YourSubClass::getSomeVariable(); // Will cause an access error.

In the case above, it makes sense to update SomeClass to use self instead:

class SomeClass
{
    private static $someVariable;

    public static function getSomeVariable()
    {
        return self::$someVariable; // self works fine with private.
    }
}
Loading history...
114
115
			echo '<div id="openHouseSearchWidget-'. $index .'" class="'. $this->homefinder_class( 'open-house' ) .'"></div>';
116
117
		}
118
119
		/**
120
		 * Get Foreclosure Homes Widget.
121
		 *
122
		 * @access public
123
		 * @return void
124
		 */
125 View Code Duplication
		public function get_foreclosure_homes_widget() {
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...
126
127
			$widget_data = array(
128
				'type' => 'foreclosureSearch',
129
				'container' => 'foreclosureSearchWidget',
130
			);
131
			static::$hf_data[] = $widget_data;
0 ignored issues
show
Since $hf_data is declared private, accessing it with static will lead to errors in possible sub-classes; consider using self, or increasing the visibility of $hf_data to at least protected.

Let’s assume you have a class which uses late-static binding:

class YourClass
{
    private static $someVariable;

    public static function getSomeVariable()
    {
        return static::$someVariable;
    }
}

The code above will run fine in your PHP runtime. However, if you now create a sub-class and call the getSomeVariable() on that sub-class, you will receive a runtime error:

class YourSubClass extends YourClass { }

YourSubClass::getSomeVariable(); // Will cause an access error.

In the case above, it makes sense to update SomeClass to use self instead:

class SomeClass
{
    private static $someVariable;

    public static function getSomeVariable()
    {
        return self::$someVariable; // self works fine with private.
    }
}
Loading history...
132
133
			$index = count( static::$hf_data ) - 1;
0 ignored issues
show
Since $hf_data is declared private, accessing it with static will lead to errors in possible sub-classes; consider using self, or increasing the visibility of $hf_data to at least protected.

Let’s assume you have a class which uses late-static binding:

class YourClass
{
    private static $someVariable;

    public static function getSomeVariable()
    {
        return static::$someVariable;
    }
}

The code above will run fine in your PHP runtime. However, if you now create a sub-class and call the getSomeVariable() on that sub-class, you will receive a runtime error:

class YourSubClass extends YourClass { }

YourSubClass::getSomeVariable(); // Will cause an access error.

In the case above, it makes sense to update SomeClass to use self instead:

class SomeClass
{
    private static $someVariable;

    public static function getSomeVariable()
    {
        return self::$someVariable; // self works fine with private.
    }
}
Loading history...
134
135
			echo '<div id="foreclosureSearchWidget-'. $index .'" class="'. $this->homefinder_class( 'foreclosure-homes' ) .'"></div>';
136
137
		}
138
139
		/**
140
		 * Get HomeFinder Widget.
141
		 *
142
		 * @access public
143
		 * @param string  $type Widget Type.
144
		 * @param  [Mixed] $widget_data : Array of widget data to send to js.
0 ignored issues
show
The doc-type [Mixed] could not be parsed: Unknown type name "" 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...
145
		 * @return void
146
		 */
147
		public function get_affiliates_widget( $type, $widget_data ) {
148
149
			$widget_data['type'] = $type;
150
			static::$hf_data[] = $widget_data;
0 ignored issues
show
Since $hf_data is declared private, accessing it with static will lead to errors in possible sub-classes; consider using self, or increasing the visibility of $hf_data to at least protected.

Let’s assume you have a class which uses late-static binding:

class YourClass
{
    private static $someVariable;

    public static function getSomeVariable()
    {
        return static::$someVariable;
    }
}

The code above will run fine in your PHP runtime. However, if you now create a sub-class and call the getSomeVariable() on that sub-class, you will receive a runtime error:

class YourSubClass extends YourClass { }

YourSubClass::getSomeVariable(); // Will cause an access error.

In the case above, it makes sense to update SomeClass to use self instead:

class SomeClass
{
    private static $someVariable;

    public static function getSomeVariable()
    {
        return self::$someVariable; // self works fine with private.
    }
}
Loading history...
151
152
			$index = count( static::$hf_data ) - 1;
0 ignored issues
show
Since $hf_data is declared private, accessing it with static will lead to errors in possible sub-classes; consider using self, or increasing the visibility of $hf_data to at least protected.

Let’s assume you have a class which uses late-static binding:

class YourClass
{
    private static $someVariable;

    public static function getSomeVariable()
    {
        return static::$someVariable;
    }
}

The code above will run fine in your PHP runtime. However, if you now create a sub-class and call the getSomeVariable() on that sub-class, you will receive a runtime error:

class YourSubClass extends YourClass { }

YourSubClass::getSomeVariable(); // Will cause an access error.

In the case above, it makes sense to update SomeClass to use self instead:

class SomeClass
{
    private static $someVariable;

    public static function getSomeVariable()
    {
        return self::$someVariable; // self works fine with private.
    }
}
Loading history...
153
154
			if ( 'search' === $type ) {
155
				echo '<div id="searchPreview-' . $index . '" class="'. $this->homefinder_class( 'affiliate-search' ) .'"><div>';
156
			} else if ( 'directory' === $type ) {
157
				echo '<div id="directoryPreview-' . $index . '" class="'. $this->homefinder_class( 'adveritser-directory' ) .'"></div>';
158
			}
159
160
		}
161
	}
162
}
163