Issues (15)

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/class-alnp-admin.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
 * Auto Load Next Post - Admin.
4
 *
5
 * @since    1.0.0
6
 * @version  1.6.0
7
 * @author   Sébastien Dumont
8
 * @category Admin
9
 * @package  Auto Load Next Post/Admin
10
 * @license  GPL-2.0+
11
 */
12
13
// Exit if accessed directly.
14
if ( ! defined( 'ABSPATH' ) ) {
15
	exit;
16
}
17
18
if ( ! class_exists( 'ALNP_Admin' ) ) {
19
20
	class ALNP_Admin {
21
22
		/**
23
		 * Constructor
24
		 *
25
		 * @access  public
26
		 * @since   1.0.0
27
		 * @version 1.6.0
28
		 */
29
		public function __construct() {
30
			// Include classes.
31
			self::includes();
32
33
			// Add settings page.
34
			add_action( 'admin_menu', array( $this, 'admin_menu' ), 9 );
35
		} // END __construct()
36
37
		/**
38
		 * Include any classes we need within admin.
39
		 *
40
		 * @access  public
41
		 * @since   1.0.0
42
		 * @version 1.6.0
43
		 * @global  string $wp_version - The version of WordPress
44
		 */
45
		public function includes() {
46
			global $wp_version;
47
48
			include( dirname( __FILE__ ) . '/class-alnp-admin-action-links.php' );        // Action Links
49
			include( dirname( __FILE__ ) . '/class-alnp-admin-assets.php' );              // Admin Assets
50
			include( dirname( __FILE__ ) . '/class-alnp-admin-notices.php' );             // Plugin Notices
51
52
			if ( apply_filters( 'alnp_enable_admin_help_tab', true ) ) {
53
				include( dirname( __FILE__ ) . '/class-alnp-admin-help.php' );            // Plugin Help Tab
54
			}
55
56
			include_once( dirname( __FILE__ ) . '/class-alnp-getting-started.php');       // Getting Started.
57
			include_once( dirname( __FILE__ ) . '/class-alnp-setup-wizard.php');          // Setup Wizard.
58
			include_once( dirname( __FILE__ ) . '/class-alnp-extensions.php');            // Extensions.
59
60
			if ( ! is_alnp_pro_version_installed() ) {
61
				include_once( dirname( __FILE__ ) . '/class-alnp-admin-pro-preview.php'); // Pro Preview.
62
			}
63
64
			include( dirname( __FILE__ ) . '/class-alnp-sidebar.php' );                   // Sidebar
65
			include( dirname( __FILE__ ) . '/class-alnp-admin-footer.php' );              // Admin Footer
66
			include( dirname( __FILE__ ) . '/class-alnp-privacy.php' );                   // Plugin Privacy
67
68
			if ( version_compare( $wp_version, '5.2', '>=' ) ) {
69
				include( dirname( __FILE__ ) . '/class-alnp-admin-site-health.php' );     // Site Health
70
			}
71
		} // END includes()
72
73
		/**
74
		 * Add Auto Load Next Post to the settings menu.
75
		 *
76
		 * @access  public
77
		 * @since   1.0.0
78
		 * @version 1.6.0
79
		 */
80
		public function admin_menu() {
81
			$current_view = ! empty( $_GET['view'] ) ? sanitize_title( wp_unslash( $_GET['view'] ) ) : '';
82
			$title = '';
0 ignored issues
show
$title is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
83
84
			switch( $current_view ) {
85
				case 'getting-started':
86
					$title = sprintf( esc_attr__( 'Getting Started with %s', 'auto-load-next-post' ), esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ) );
87
					break;
88
				case 'setup-wizard':
89
					$title = sprintf( esc_attr__( 'Setup Wizard for %s', 'auto-load-next-post' ), esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ) );
90
					break;
91
				case 'extensions':
92
					$title = sprintf( esc_attr__( '%s | Extensions', 'auto-load-next-post' ), esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ) );
93
					break;
94
				default:
95
					$title = sprintf( esc_attr__( '%s Settings', 'auto-load-next-post' ), esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ) );
96
					break;
97
			}
98
99
			$settings_page = add_options_page(
100
				$title,
101
				esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ),
102
				'manage_options',
103
				'auto-load-next-post',
104
				array( $this, 'settings_page' )
105
			);
106
107
			add_action( 'load-' . $settings_page, array( $this, 'settings_page_init' ) );
108
		} // END admin_menu()
109
110
		/**
111
		 * Loads settings.
112
		 *
113
		 * @access  public
114
		 * @since   1.0.0
115
		 * @version 1.6.0
116
		 * @global  string $current_view
117
		 * @global  string $current_section
118
		 */
119
		public function settings_page_init() {
120
			global $current_view, $current_section;
121
122
			// Include settings pages.
123
			include_once( dirname( __FILE__ ) . '/class-alnp-admin-settings.php' );
124
125
			ALNP_Admin_Settings::get_settings_pages();
126
127
			// Get current view/section.
128
			$current_view    = empty( $_GET['view'] ) ? 'theme-selectors' : sanitize_title( wp_unslash( $_GET['view'] ) );
129
			$current_section = empty( $_REQUEST['section'] ) ? '' : sanitize_title( wp_unslash( $_REQUEST['section'] ) );
130
131
			// Save settings if data has been posted.
132
			if ( apply_filters( '' !== $current_section ? "alnp_save_settings_{$current_view}_{$current_section}" : "alnp_save_settings_{$current_view}", ! empty( $_POST ) ) ) {
133
				ALNP_Admin_Settings::save();
134
			}
135
136
			// Add any posted messages.
137
			if ( ! empty( $_GET['auto_load_next_post_error'] ) ) {
138
				ALNP_Admin_Settings::add_error( wp_kses_post( wp_unslash( $_GET['auto_load_next_post_error'] ) ) );
139
			}
140
141
			if ( ! empty( $_GET['auto_load_next_post_message'] ) ) {
142
				ALNP_Admin_Settings::add_message( wp_kses_post( wp_unslash( $_GET['auto_load_next_post_message'] ) ) );
143
			}
144
145
			do_action( 'auto_load_next_post_settings_page_init' );
146
		} // END settings_page_init()
147
148
		/**
149
		 * Initialize the Auto Load Next Post settings page.
150
		 *
151
		 * @access public
152
		 * @since  1.0.0
153
		 */
154
		public function settings_page() {
155
			include_once( dirname( __FILE__ ) . '/class-alnp-admin-settings.php' );
156
157
			ALNP_Admin_Settings::output();
158
		} // END settings_page()
159
160
	} // END class
161
162
} // END if class exists
163
164
return new ALNP_Admin();
165