Issues (234)

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.

includes/admin/menus.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
/**
3
 * Admin Menus
4
 *
5
 * @package SimpleCalendar\Admin
6
 */
7
namespace SimpleCalendar\Admin;
8
9
if ( ! defined( 'ABSPATH' ) ) {
10
	exit;
11
}
12
13
/**
14
 * Admin Menus.
15
 *
16
 * Handles the plugin admin dashboard menus.
17
 *
18
 * @since 3.0.0
19
 */
20
class Menus {
21
22
	/**
23
	 * The main menu screen hook.
24
	 *
25
	 * @access public
26
	 * @var string
27
	 */
28
	public static $main_menu = '';
29
30
	/**
31
	 * Plugin basename.
32
	 *
33
	 * @access private
34
	 * @var string
35
	 */
36
	private static $plugin = '';
37
38
	/**
39
	 * Set properties.
40
	 *
41
	 * @since 3.0.0
42
	 */
43
	public function __construct() {
44
45
		self::$main_menu = 'edit.php?post_type=calendar';
46
47
		add_action( 'admin_menu', array( __CLASS__, 'add_menu_items' ) );
48
49
		self::$plugin = plugin_basename( SIMPLE_CALENDAR_MAIN_FILE );
50
51
		new Welcome();
52
53
		// Links and meta content in plugins page.
54
		add_filter( 'plugin_action_links_' . self::$plugin, array( __CLASS__, 'plugin_action_links' ), 10, 5 );
55
		add_filter( 'plugin_row_meta', array( __CLASS__, 'plugin_row_meta' ), 10, 2 );
56
		// Custom text in admin footer.
57
		add_filter( 'admin_footer_text', array( $this, 'admin_footer_text' ), 1 );
58
	}
59
60
	/**
61
	 * Add menu items.
62
	 *
63
	 * @since 3.0.0
64
	 */
65
	public static function add_menu_items() {
66
67
		add_submenu_page(
68
			self::$main_menu,
69
			__( 'Settings', 'google-calendar-events' ),
70
			__( 'Settings', 'google-calendar-events' ),
71
			'manage_options',
72
			'simple-calendar_settings',
73
			function () {
74
				$page = new Pages( 'settings' );
75
				$page->html();
76
			}
77
		);
78
79
		add_submenu_page(
80
			self::$main_menu,
81
			__( 'Add-ons', 'google-calendar-events' ),
82
			__( 'Add-ons', 'google-calendar-events' ),
83
			'manage_options',
84
			'simple-calendar_add_ons',
85
			function() {
86
				$page = new Pages( 'add-ons' );
87
				$page->html();
88
			}
89
		);
90
91
		add_submenu_page(
92
			self::$main_menu,
93
			__( 'Tools', 'google-calendar-events' ),
94
			__( 'Tools', 'google-calendar-events' ),
95
			'manage_options',
96
			'simple-calendar_tools',
97
			function () {
98
				$page = new Pages( 'tools' );
99
				$page->html();
100
			}
101
		);
102
103
		do_action( 'simcal_admin_add_menu_items' );
104
	}
105
106
	/**
107
	 * Action links in plugins page.
108
	 *
109
	 * @since  3.0.0
110
	 *
111
	 * @param  array  $action_links
112
	 * @param  string $file
113
	 *
114
	 * @return array
115
	 */
116
	public static function plugin_action_links( $action_links, $file ) {
117
118
		if ( self::$plugin == $file ) {
119
120
			$links = array();
121
			$links['settings']  = '<a href="' . admin_url( 'edit.php?post_type=calendar&page=simple-calendar_settings' ) . '">' . __( 'Settings', 'google-calendar-events' ) . '</a>';
122
			$links['feeds']     = '<a href="' . admin_url( 'edit.php?post_type=calendar' ) . '">' . __( 'Calendars', 'google-calendar-events' ) . '</a>';
123
124
			return apply_filters( 'simcal_plugin_action_links', array_merge( $links, $action_links ) );
125
		}
126
127
		return $action_links;
128
	}
129
130
	/**
131
	 * Links in plugin meta in plugins page.
132
	 *
133
	 * @since  3.0.0
134
	 *
135
	 * @param  array  $meta_links
136
	 * @param  string $file
137
	 *
138
	 * @return array
139
	 */
140
	public static function plugin_row_meta( $meta_links, $file ) {
141
142
		if ( self::$plugin == $file ) {
143
144
			$links = array();
145
			$links['add-ons'] = '<a href="' . simcal_ga_campaign_url( simcal_get_url( 'addons' ), 'core-plugin', 'plugin-listing' ) . '" target="_blank" >' .
146
			                           __( 'Add-ons', 'google-calendar-events' ) . '</a>';
147
148
			return apply_filters( 'simcal_plugin_action_links', array_merge( $meta_links, $links ) );
149
		}
150
151
		return $meta_links;
152
	}
153
154
	/**
155
	 * Admin footer text filter callback.
156
	 *
157
	 * Change this plugin screens admin footer text.
158
	 *
159
	 * @since  3.0.0
160
	 *
161
	 * @param  $footer_text
162
	 *
163
	 * @return string|void
164
	 */
165
	public function admin_footer_text( $footer_text ) {
166
167
		// Check to make sure we're on a SimpleCal admin page
168
		$screen = simcal_is_admin_screen();
169
		if ( $screen !== false ) {
170
171
			if ( 'calendar' == $screen ) {
0 ignored issues
show
This if statement is empty and can be removed.

This check looks for the bodies of if statements that have no statements or where all statements have been commented out. This may be the result of changes for debugging or the code may simply be obsolete.

These if bodies can be removed. If you have an empty if but statements in the else branch, consider inverting the condition.

if (rand(1, 6) > 3) {
//print "Check failed";
} else {
    print "Check succeeded";
}

could be turned into

if (rand(1, 6) <= 3) {
    print "Check succeeded";
}

This is much more concise to read.

Loading history...
172
173
				// Add Drip promo signup form (@see Newsletter meta box).
174
				// Removed 9/26/16.
0 ignored issues
show
Unused Code Comprehensibility introduced by
38% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
175
176
				/*
177
				$drip_form_id = '5368192';
178
179
				?>
180
				<form id="simcal-drip-form"
181
				      method="post"
182
				      target="_blank"
183
				      action="https://www.getdrip.com/forms/<?php echo $drip_form_id; ?>/submissions/"
184
				      data-drip-embedded-form="<?php echo $drip_form_id; ?>">
185
					<input type="hidden"
186
					       id="simcal-drip-real-field-first_name"
187
					       name="fields[first_name]"
188
					       value="" />
189
					<input type="hidden"
190
					       id="simcal-drip-real-field-email"
191
					       name="fields[email]"
192
					       value="" />
193
					<input type="submit"
194
					       class="hidden"/>
195
				</form>
196
				<?php
197
				*/
198
			}
199
200
			// Change the footer text
201
			if ( ! get_option( 'simple-calendar_admin_footer_text_rated' ) ) {
202
203
				$footer_text = sprintf(
204
					__( 'If you like <strong>Simple Calendar</strong> please leave us a %s&#9733;&#9733;&#9733;&#9733;&#9733; rating on WordPress.org%s. A huge thank you in advance!', 'google-calendar-events' ),
205
					'<a href="https://wordpress.org/support/view/plugin-reviews/google-calendar-events?filter=5#postform" target="_blank" class="simcal-rating-link" data-rated="' . esc_attr__( 'Thanks :)', 'google-calendar-events' ) . '">', '</a>'
206
				);
207
208
				$footer_text .= '<script type="text/javascript">';
209
				$footer_text .= "jQuery( 'a.simcal-rating-link' ).click( function() {
210
						jQuery.post( '" . \SimpleCalendar\plugin()->ajax_url() . "', { action: 'simcal_rated' } );
211
						jQuery( this ).parent().text( jQuery( this ).data( 'rated' ) );
212
					});";
213
				$footer_text .= '</script>';
214
215
			} else {
216
217
				$footer_text = __( 'Thanks for using Simple Calendar!', 'google-calendar-events' );
218
219
			}
220
221
		}
222
223
		return $footer_text;
224
	}
225
226
}
227