Issues (896)

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/class-sensei-autoloader.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
0 ignored issues
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 12 and the first side effect is on line 2.

The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.

The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.

To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.

Loading history...
2
if ( ! defined( 'ABSPATH' ) ) exit; // security check, don't load file outside WP
3
/**
4
 * Loading all class files within the Sensei/includes directory
5
 *
6
 * The auto loader class listens for calls to classes within Sensei and loads
7
 * the file containing the class.
8
 *
9
 * @package Core
10
 * @since 1.9.0
11
 */
12
class Sensei_Autoloader {
13
14
    /**
15
     * @var path to the includes directory within Sensei.
16
     */
17
    private $include_path = 'includes';
18
19
    /**
20
     * @var array $class_file_map. List of classes mapped to their files
21
     */
22
    private $class_file_map = array();
23
24
    /**
25
     * Constructor
26
     * @since 1.9.0
27
     */
28
    public function __construct(){
29
30
        // make sure we do not override an existing autoload function
31
        if( function_exists('__autoload') ){
32
           spl_autoload_register( '__autoload' );
33
        }
34
35
        // setup a relative path for the current autoload instance
36
        $this->include_path = trailingslashit( untrailingslashit( dirname( __FILE__ ) ) );
37
38
        //setup the class file map
39
        $this->initialize_class_file_map();
40
41
        // add Sensei custom auto loader
42
        spl_autoload_register( array( $this, 'autoload' )  );
43
44
    }
45
46
    /**
47
     * Generate a list of Sensei class and map them the their respective
48
     * files within the includes directory
49
     *
50
     * @since 1.9.0
51
     */
52
    public function initialize_class_file_map(){
53
54
        $this->class_file_map = array(
55
56
            /**
57
             * Main Sensei class
58
             */
59
            'Sensei_Main' => 'class-sensei.php',
60
61
            /**
62
             * Admin
63
             */
64
            'Sensei_Welcome'            => 'admin/class-sensei-welcome.php' ,
65
            'Sensei_Learner_Management' => 'admin/class-sensei-learner-management.php' ,
66
67
            /**
68
             * Shortcodes
69
             */
70
            'Sensei_Shortcode_Loader'              => 'shortcodes/class-sensei-shortcode-loader.php',
71
            'Sensei_Shortcode_Interface'           => 'shortcodes/interface-sensei-shortcode.php',
72
            'Sensei_Shortcode_Featured_Courses'    => 'shortcodes/class-sensei-shortcode-featured-courses.php',
73
            'Sensei_Shortcode_User_Courses'        => 'shortcodes/class-sensei-shortcode-user-courses.php',
74
            'Sensei_Shortcode_Courses'             => 'shortcodes/class-sensei-shortcode-courses.php',
75
            'Sensei_Shortcode_Teachers'            => 'shortcodes/class-sensei-shortcode-teachers.php',
76
            'Sensei_Shortcode_User_Messages'       => 'shortcodes/class-sensei-shortcode-user-messages.php',
77
            'Sensei_Shortcode_Course_Page'         => 'shortcodes/class-sensei-shortcode-course-page.php',
78
            'Sensei_Shortcode_Lesson_Page'         => 'shortcodes/class-sensei-shortcode-lesson-page.php',
79
            'Sensei_Shortcode_Course_Categories'   => 'shortcodes/class-sensei-shortcode-course-categories.php',
80
            'Sensei_Shortcode_Unpurchased_Courses' => 'shortcodes/class-sensei-shortcode-unpurchased-courses.php',
81
            'Sensei_Legacy_Shortcodes'             => 'shortcodes/class-sensei-legacy-shortcodes.php',
82
83
            /**
84
             * Built in theme integration support
85
             */
86
            'Sensei_Theme_Integration_Loader' => 'theme-integrations/theme-integration-loader.php',
87
            'Sensei__S'                       => 'theme-integrations/_s.php',
88
            'Sensei_Twentyeleven'             => 'theme-integrations/twentyeleven.php',
89
            'Sensei_Twentytwelve'             => 'theme-integrations/twentytwelve.php',
90
            'Sensei_Twentythirteen'           => 'theme-integrations/Twentythirteen.php',
91
            'Sensei_Twentyfourteen'           => 'theme-integrations/Twentyfourteen.php',
92
            'Sensei_Twentyfifteen'            => 'theme-integrations/Twentyfifteen.php',
93
            'Sensei_Twentysixteen'            => 'theme-integrations/Twentysixteen.php',
94
            'Sensei_Storefront'               => 'theme-integrations/Storefront.php',
95
96
            /**
97
             * WooCommerce
98
             */
99
            'Sensei_WC' => 'class-sensei-wc.php',
100
101
        );
102
    }
103
104
    /**
105
     * Autoload all sensei files as the class names are used.
106
     */
107
    public function autoload( $class ){
108
109
        // only handle classes with the word `sensei` in it
110
        if( ! is_numeric( strpos ( strtolower( $class ), 'sensei') ) ){
111
112
            return;
113
114
        }
115
116
        // exit if we didn't provide mapping for this class
117
        if( isset( $this->class_file_map[ $class ] ) ){
118
119
            $file_location = $this->include_path . $this->class_file_map[ $class ];
120
            require_once( $file_location);
121
            return;
122
123
        }
124
125
        // check for file in the main includes directory
126
        $class_file_path = $this->include_path . 'class-'.str_replace( '_','-', strtolower( $class ) ) . '.php';
127
        if( file_exists( $class_file_path ) ){
128
129
            require_once( $class_file_path );
130
            return;
131
        }
132
133
        // lastly check legacy types
134
        $stripped_woothemes_from_class = str_replace( 'woothemes_','', strtolower( $class ) ); // remove woothemes
135
        $legacy_class_file_path = $this->include_path . 'class-'.str_replace( '_','-', strtolower( $stripped_woothemes_from_class ) ) . '.php';
136
        if( file_exists( $legacy_class_file_path ) ){
137
138
            require_once( $legacy_class_file_path );
139
            return;
140
        }
141
142
        return;
143
144
    }// end autoload
145
146
}
147
new Sensei_Autoloader();
148