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/assets.php (1 issue)

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 Assets
4
 *
5
 * @package SimpleCalendar\Admin
6
 */
7
namespace SimpleCalendar\Admin;
8
9
if ( ! defined( 'ABSPATH' ) ) {
10
	exit;
11
}
12
13
/**
14
 * Admin scripts and styles.
15
 *
16
 * Handles the plugin scripts and styles for back end dashboard pages.
17
 *
18
 * @since 3.0.0
19
 */
20
class Assets {
21
22
	/**
23
	 * Load minified assets.
24
	 *
25
	 * @access public
26
	 * @var string
27
	 */
28
	public $min = '.min';
29
30
	/**
31
	 * Hook in tabs.
32
	 *
33
	 * @since 3.0.0
34
	 */
35
	public function __construct() {
36
37
		$this->min = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG == true ) ? '' : '.min';
38
39
		add_action( 'admin_enqueue_scripts', array( $this, 'load' ) );
40
	}
41
42
	/**
43
	 * Enqueue scripts and styles.
44
	 *
45
	 * @since 3.0.0
46
	 */
47
	public function load() {
48
49
		$css_path        = SIMPLE_CALENDAR_ASSETS . 'css/';
50
		$css_path_vendor = $css_path . 'vendor/';
51
		$js_path         = SIMPLE_CALENDAR_ASSETS . 'js/';
52
		$js_path_vendor  = $js_path . 'vendor/';
53
54
		/* ====================== *
55
		 * Register Admin Scripts *
56
		 * ====================== */
57
58
		// TipTip uses ".minified.js" filename ending.
59
		wp_register_script(
60
			'simcal-tiptip',
61
			$js_path_vendor . 'jquery.tipTip' . ( ( $this->min !== '' ) ? '.minified' : '' ) . '.js',
62
			array( 'jquery' ),
63
			SIMPLE_CALENDAR_VERSION,
64
			true
65
		);
66
		wp_register_script(
67
			'simcal-select2',
68
			$js_path_vendor . 'select2' . $this->min . '.js',
69
			array(),
70
			SIMPLE_CALENDAR_VERSION,
71
			true
72
		);
73
		wp_register_script(
74
			'simcal-admin',
75
			$js_path . 'admin' . $this->min . '.js',
76
			array(
77
				'jquery',
78
				'jquery-ui-sortable',
79
				'jquery-ui-datepicker',
80
				'wp-color-picker',
81
				'simcal-tiptip',
82
				'simcal-select2',
83
			),
84
			SIMPLE_CALENDAR_VERSION,
85
			true
86
		);
87
		wp_register_script(
88
			'simcal-admin-add-calendar',
89
			$js_path . 'admin-add-calendar' . $this->min . '.js',
90
			array( 'simcal-select2' ),
91
			SIMPLE_CALENDAR_VERSION,
92
			true
93
		);
94
95
		/* ===================== *
96
		 * Register Admin Styles *
97
		 * ===================== */
98
99
		wp_register_style(
100
			'simcal-select2',
101
			$css_path_vendor . 'select2' . $this->min . '.css',
102
			array(),
103
			SIMPLE_CALENDAR_VERSION
104
		);
105
		wp_register_style(
106
			'simcal-admin',
107
			$css_path . 'admin' . $this->min . '.css',
108
			array(
109
				'wp-color-picker',
110
				'simcal-select2',
111
			),
112
			SIMPLE_CALENDAR_VERSION
113
		);
114
		wp_register_style(
115
			'simcal-admin-add-calendar',
116
			$css_path . 'admin-add-calendar' . $this->min . '.css',
117
			array( 'simcal-select2' ),
118
			SIMPLE_CALENDAR_VERSION
119
		);
120
121
		if ( simcal_is_admin_screen() !== false ) {
122
123
			wp_enqueue_script( 'simcal-admin' );
124
			wp_localize_script(
125
				'simcal-admin',
126
				'simcal_admin',
127
				simcal_common_scripts_variables()
128
			);
129
130
			wp_enqueue_style( 'simcal-admin' );
131
132
		} else {
133
134
			global $post_type;
0 ignored issues
show
Compatibility Best Practice introduced by
Use of global functionality is not recommended; it makes your code harder to test, and less reusable.

Instead of relying on global state, we recommend one of these alternatives:

1. Pass all data via parameters

function myFunction($a, $b) {
    // Do something
}

2. Create a class that maintains your state

class MyClass {
    private $a;
    private $b;

    public function __construct($a, $b) {
        $this->a = $a;
        $this->b = $b;
    }

    public function myFunction() {
        // Do something
    }
}
Loading history...
135
			$screen = get_current_screen();
136
137
			$post_types = array();
138
			$settings = get_option( 'simple-calendar_settings_calendars' );
139
			if ( isset( $settings['general']['attach_calendars_posts'] ) ) {
140
				$post_types = $settings['general']['attach_calendars_posts'];
141
			}
142
143
			$conditions = array(
144
				in_array( $post_type, (array) $post_types ),
145
				$screen->id == 'widgets',
146
			);
147
148
			if ( in_array( true, $conditions ) ) {
149
150
				wp_enqueue_script( 'simcal-admin-add-calendar' );
151
				wp_localize_script( 'simcal-admin-add-calendar', 'simcal_admin', array(
152
					'locale'   => get_locale(),
153
					'text_dir' => is_rtl() ? 'rtl' : 'ltr',
154
				) );
155
156
				wp_enqueue_style( 'simcal-admin-add-calendar' );
157
			}
158
159
		}
160
161
	}
162
163
}
164