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.

admin/settings/class-alnp-settings-templates.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 Settings - Templates
4
 *
5
 * @version  1.6.0
6
 * @author   Sébastien Dumont
7
 * @category Admin
8
 * @package  Auto Load Next Post/Admin/Settings
9
 * @license  GPL-2.0+
10
 */
11
12
// Exit if accessed directly.
13
if ( ! defined( 'ABSPATH' ) ) {
14
	exit;
15
}
16
17
if ( ! class_exists( 'ALNP_Settings_Templates' ) ) {
18
19
	class ALNP_Settings_Templates extends ALNP_Settings_Page {
20
21
		/**
22
		 * Constructor.
23
		 *
24
		 * @access public
25
		 */
26
		public function __construct() {
27
			$this->id    = 'templates';
28
			$this->label = esc_html__( 'Templates', 'auto-load-next-post' );
29
30
			parent::__construct();
31
32
			add_action( 'auto_load_next_post_settings_templates', array( __CLASS__, 'template_location' ), 0 );
33
		} // END __construct()
34
35
		/**
36
		 * Displays a notification to the user if the templates 
37
		 * location was found and where or if the templates was 
38
		 * not found.
39
		 *
40
		 * @access public
41
		 * @static
42
		 */
43
		public static function template_location() {
44
			include( dirname( AUTO_LOAD_NEXT_POST_FILE ) . '/includes/admin/views/html-notice-template-location.php' );
45
		} // END template_location()
46
47
		/**
48
		 * Get settings array
49
		 *
50
		 * @access public
51
		 * @return array $settings
52
		 */
53
		public function get_settings() {
54
			$settings = array();
55
56
			$description = sprintf( __( 'This helps fine tune %s to locate your theme templates directory in order to display content in the same style as your theme.', 'auto-load-next-post' ), esc_html__( 'Auto Load Next Post', 'auto-load-next-post' ) );
57
58
			if ( is_alnp_pro_version_installed() ) {
59
				$description .= ' ' . sprintf( __( 'Set the location for each post type if they are located in their own template directory. Otherwise just enter the location for %1$sPosts%2$s.', 'auto-load-next-post' ), '<strong>', '</strong>' );
60
			}
61
62
			$settings[] = array(
63
				'title' => $this->label,
64
				'type'  => 'title',
65
				'desc'  => $description,
66
				'id'    => 'templates_options'
67
			);
68
69
			$locate_single = alnp_get_template();
70
71
			// Only show fallback support option if template location was found. May be required should theme structure fail.
72
			if ( ! empty( $locate_single ) ) {
73
				$settings[] = array(
74
					'title'    => esc_html__( 'Use Fallback?', 'auto-load-next-post' ),
75
					'desc'     => sprintf( __( 'Enabling this will force the use of fallback support should your active theme not have a great structure. %1$sSee help for more information%2$s.', 'auto-load-next-post' ), '<strong class="red">', '</strong>' ),
76
					'id'       => 'auto_load_next_post_use_fallback',
77
					'default'  => 'no',
78
					'type'     => 'checkbox',
79
					'autoload' => false
80
				);
81
			}
82
83
			foreach( alnp_get_post_types() as $post_type ) {
84
				$default  = '';
85
				$readonly = 'no';
86
87
				// Checks if the filter has been used already and disable posts only if true.
88
				if ( has_filter( 'alnp_template_location' ) && strtolower( $post_type ) == 'post' ) {
89
					$default  = alnp_template_location();
90
					$readonly = 'yes';
91
				}
92
93
				// Checks if theme support provided directory location for post and disable posts only if true.
94
				else if ( ! empty( alnp_get_theme_support( 'directory_post' ) ) && strtolower( $post_type ) == 'post' ) {
95
					$default  = alnp_get_theme_support( 'directory_post' );
96
					$readonly = 'yes';
97
				}
98
99
				$settings[] = array(
100
					'title'       => ucfirst( $post_type ),
101
					'desc'        => sprintf( __( 'Enter the folder location where the theme template for %s are stored.', 'auto-load-next-post' ), $post_type ),
102
					'id'          => 'auto_load_next_post_directory_' . strtolower( $post_type ),
103
					'default'     => $default,
104
					'placeholder' => sprintf( esc_html__( 'e.g. %s', 'auto-load-next-post' ), 'template-parts/' ),
105
					'readonly'    => $readonly,
106
					'type'        => 'text',
107
					'css'         => 'min-width:300px;',
108
					'autoload'    => false
109
				);
110
			}
111
112
			$settings[] = array(
113
				'type' => 'sectionend',
114
				'id'   => 'template_locations'
115
			);
116
117
			return $settings;
118
		} // END get_settings()
119
120
		/**
121
		 * Output the settings.
122
		 *
123
		 * @access public
124
		 */
125
		public function output() {
126
			$settings = $this->get_settings();
127
128
			ALNP_Admin_Settings::output_fields( $settings );
129
		} // END output()
130
131
		/**
132
		 * Save settings.
133
		 *
134
		 * @access public
135
		 * @global $current_view
136
		 */
137
		public function save() {
138
			global $current_view;
139
140
			$settings = $this->get_settings();
141
142
			ALNP_Admin_Settings::save_fields( $settings, $current_view );
0 ignored issues
show
The call to ALNP_Admin_Settings::save_fields() has too many arguments starting with $current_view.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
143
		} // END save()
144
145
	} // END class
146
147
} // END if class exists
148
149
return new ALNP_Settings_Templates();
150