Issues (87)

Security Analysis    not enabled

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.

abstracts/view.php (2 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
2
namespace DummyPress\Abstracts;
3
4
5
/**
6
 * Class to generate a view for the admin page.
7
 *
8
 * @abstract
9
 * @package    WordPress
10
 * @subpackage Test Content
11
 * @author     Mike Selander
12
 */
13
abstract class View {
14
15
	/**
16
	 * title
17
	 * Title of the tab.
18
	 *
19
	 * @var string
20
	 * @access protected
21
	 */
22
	protected $title;
23
24
	/**
25
	 * type
26
	 * Type of objects we'll be dealing with i.e.: post or term.
27
	 *
28
	 * @var string
29
	 * @access protected
30
	 */
31
	protected $type;
32
33
	/**
34
	 * priority
35
	 * SPriority to pass into the actions.
36
	 *
37
	 * @var int
38
	 * @access protected
39
	 */
40
	protected $priority;
41
42
	/**
43
	 * Registers our view with appropriate actions.
44
	 *
45
	 * @see tab, view
46
	 */
47
	public function register_view() {
48
49
		add_action( 'tc-admin-tabs', array( $this, 'tab' ), $this->priority );
50
		add_action( 'tc-admin-sections', array( $this, 'view' ), $this->priority );
51
52
	}
53
54
55
	/**
56
	 * Builf the HTML for our tab navigation item.
57
	 *
58
	 * Each view has a tab and tab navigation - this function compiles our
59
	 * navigation tab. Rarely extended.
60
	 */
61
	public function tab() {
62
		$html = "";
63
64
		$html .= "<a class='nav-tab' data-type='" . esc_attr( sanitize_title( $this->title ) ) . "' href='javascript:void(0)'>";
65
			$html .= esc_html( $this->title );
66
		$html .= "</a>";
67
68
		echo $html;
69
70
	}
71
72
73
	/**
74
	 * Build the HTML for the actual tab content.
75
	 *
76
	 * Each view has a tab and tab navigation - this function compiles our
77
	 * tab content. Rarely extended
78
	 *
79
	 * @see actions_section, options_section
80
	 */
81
	public function view() {
0 ignored issues
show
Coding Style Best Practice introduced by
Please use __construct() instead of a PHP4-style constructor that is named after the class.
Loading history...
82
		$html = '';
83
84
		$html .= "<section class='test-content-tab' data-type='" . esc_attr( sanitize_title( $this->title ) ) . "'>";
85
			$html .= $this->actions_section();
86
			$html .= $this->options_section();
87
		$html .= "</section>";
88
89
		echo $html;
90
91
	}
92
93
94
	/**
95
	 * Holder function to build the tab main content. Extend this with your content.
96
	 *
97
	 * @access protected
98
	 *
99
	 * @return string HTML content.
100
	 */
101
	protected function actions_section() {
102
		$html = '';
103
		return $html;
104
	}
105
106
107
	/**
108
	 * Starter for an options section for the view.
109
	 *
110
	 * Options are where you could add various options and triggers such as author,
111
	 * quantity, or any other customization of the created/deleted data.
112
	 *
113
	 * @access protected
114
	 *
115
	 * @param string $html Existing HTML content.
116
	 * @return string HTML section content.
117
	 */
118 View Code Duplication
	protected function options_section( $html = '' ) {
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...
119
		$html .= "<hr>";
120
121
		$html .= "<div class='test-data-cpt'>";
122
			$html .= "<h3>";
123
				$html .= "<span class='label'>" . esc_html__( 'Quantity', 'dummybot' ) . "</span>";
124
				$html .= "<input type='number' value='0' class='quantity-adjustment' for='" . esc_attr( $this->type ) . "' > ";
125
			$html .= "</h3>";
126
		$html .= "</div>";
127
128
		return $html;
129
	}
130
131
132
	/**
133
	 * Builds action buttons for creating or deleting content.
134
	 *
135
	 * @access protected
136
	 *
137
	 * @param string $action Type of action to take - i.e.: create or delete.
138
	 * @param string $slug Slug ID of the object to create i.e.: page or category.
139
	 * @param string $text Text to display in the button.
140
	 * @return string HTML.
141
	 */
142
	protected function build_button( $action, $slug, $text ) {
143
		$html = $dashicon = '';
144
145
		if ( $action == 'create' ) {
146
			$dashicon = 'dashicons-plus';
147
		} elseif ( $action == 'delete' ) {
148
			$dashicon = 'dashicons-trash';
149
		}
150
151
		$html .= "<a href='javascript:void(0);' ";
152
			$html .= " data-type='" . esc_attr( $this->type ) . "'";
153
			$html .= " data-slug='" . esc_attr( $slug ) . "'";
154
			$html .= " data-todo='" . esc_attr( $action ) . "'";
155
			$html .= " class='button-primary handle-test-data'";
156
		$html .= "/>";
157
			$html .= "<span class='dashicons " . esc_attr( $dashicon ) . "'></span>";
158
			$html .= esc_html( $text );
159
		$html .= "</a>";
160
161
		return $html;
162
163
	}
164
165
}
166