PluginProbe ʕ •ᴥ•ʔ
WP Mail SMTP by WPForms – The Most Popular SMTP and Email Log Plugin / 2.1.1
WP Mail SMTP by WPForms – The Most Popular SMTP and Email Log Plugin v2.1.1
0.9.6 1.0.0 1.0.1 1.0.2 1.1.0 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 1.4.2 1.5.0 1.5.1 1.5.2 1.6.0 1.6.2 1.7.0 1.7.1 1.8.0 1.8.1 1.9.0 2.0.0 2.0.1 2.1.1 2.2.1 2.3.1 2.4.0 2.5.0 2.5.1 2.6.0 2.7.0 2.8.0 2.9.0 3.0.1 3.0.2 3.0.3 3.1.0 3.10.0 3.11.0 3.11.1 3.2.0 3.2.1 3.3.0 3.4.0 3.5.0 3.5.1 3.5.2 3.6.1 3.7.0 3.8.0 3.8.2 3.9.0 4.0.1 4.1.0 4.1.1 4.2.0 4.3.0 4.4.0 4.5.0 4.6.0 4.7.0 4.7.1 4.8.0 trunk 0.10.0 0.10.1 0.11.1 0.11.2 0.3.1 0.3.2 0.4 0.4.1 0.4.2 0.5.0 0.5.1 0.5.2 0.6 0.7 0.8 0.8.2 0.8.3 0.8.4 0.8.5 0.8.6 0.8.7 0.9.0 0.9.1 0.9.2 0.9.3 0.9.4 0.9.5
wp-mail-smtp / wp-mail-smtp.php
wp-mail-smtp Last commit date
assets 5 years ago src 5 years ago vendor 5 years ago readme.txt 5 years ago uninstall.php 5 years ago wp-mail-smtp.php 5 years ago wp_mail_smtp.php 5 years ago
wp-mail-smtp.php
84 lines
1 <?php
2
3 if ( ! defined( 'ABSPATH' ) ) {
4 exit; // Exit if accessed directly.
5 }
6
7 /**
8 * Autoloader. We needs it being separate and not using Composer autoloader because of the Gmail libs,
9 * which are huge and not needed for most users.
10 * Inspired by PSR-4 examples: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-4-autoloader-examples.md
11 *
12 * @since 1.0.0
13 *
14 * @param string $class The fully-qualified class name.
15 */
16 spl_autoload_register( function ( $class ) {
17
18 list( $plugin_space ) = explode( '\\', $class );
19 if ( $plugin_space !== 'WPMailSMTP' ) {
20 return;
21 }
22
23 /*
24 * This folder can be both "wp-mail-smtp" and "wp-mail-smtp-pro".
25 */
26 $plugin_dir = basename( __DIR__ );
27
28 // Default directory for all code is plugin's /src/.
29 $base_dir = plugin_dir_path( __DIR__ ) . '/' . $plugin_dir . '/src/';
30
31 // Get the relative class name.
32 $relative_class = substr( $class, strlen( $plugin_space ) + 1 );
33
34 /**
35 * Normalize a filesystem path.
36 * Copy of the `wp_normalize_path()` from WordPress 3.9.
37 *
38 * @since 1.2.0
39 *
40 * @param string $path
41 *
42 * @return string
43 */
44 $normalize = function( $path ) {
45 $path = str_replace( '\\', '/', $path );
46 $path = preg_replace( '|(?<=.)/+|', '/', $path );
47 if ( ':' === substr( $path, 1, 1 ) ) {
48 $path = ucfirst( $path );
49 }
50 return $path;
51 };
52
53 // Prepare a path to a file.
54 $file = $normalize( $base_dir . $relative_class . '.php' );
55
56 // If the file exists, require it.
57 if ( is_readable( $file ) ) {
58 /** @noinspection PhpIncludeInspection */
59 require_once $file;
60 }
61 } );
62
63 /**
64 * Global function-holder. Works similar to a singleton's instance().
65 *
66 * @since 1.0.0
67 *
68 * @return WPMailSMTP\Core
69 */
70 function wp_mail_smtp() {
71 /**
72 * @var \WPMailSMTP\Core
73 */
74 static $core;
75
76 if ( ! isset( $core ) ) {
77 $core = new \WPMailSMTP\Core();
78 }
79
80 return $core;
81 }
82
83 wp_mail_smtp();
84