wysija_classes_autoloader

Classes Autoloader.

Description

wysija_classes_autoloader( (Class) $class ); 

It loads automatically the right class on class instantation. Since we still can't use namespaces, we use WJ_ as a prefix for our classes.

Parameters (1)

0. $class (Class)
The class.

Usage

  1. if ( !function_exists( 'wysija_classes_autoloader' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'mailpoet-newsletters/core/autoloader.php'; 
  3.  
  4. // The class. 
  5. $class = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = wysija_classes_autoloader($class); 
  9.  

Defined (1)

The function is defined in the following location(s).

/core/autoloader.php  
  1. function wysija_classes_autoloader($class) { 
  2. // Check if the class name has our prefix. 
  3. if (strpos($class, 'WJ_') !== false) { 
  4. // Class file path. 
  5. $class_path = WYSIJA_CLASSES . $class . '.php'; 
  6. // If the class file exists, let's load it. 
  7. if (file_exists($class_path)) { 
  8. require_once $class_path;