| 1 |
<?php |
| 2 |
/** |
| 3 |
* Charitable Intergration For SMTP. |
| 4 |
* |
| 5 |
* @package Charitable/Classes/Class_Intergrations_SMTP |
| 6 |
* @author David Bisset |
| 7 |
* @copyright Copyright (c) 2023, WP Charitable LLC |
| 8 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
| 9 |
* @since 1.8.1.8 |
| 10 |
* @version 1.8.1.8 |
| 11 |
*/ |
| 12 |
|
| 13 |
// Exit if accessed directly. |
| 14 |
if ( ! defined( 'ABSPATH' ) ) { |
| 15 |
exit; |
| 16 |
} |
| 17 |
|
| 18 |
if ( ! class_exists( 'Charitable_Intergrations_SMTP' ) ) : |
| 19 |
|
| 20 |
/** |
| 21 |
* Charitable_Tools |
| 22 |
* |
| 23 |
* @final |
| 24 |
* @since 1.8.1.8 |
| 25 |
*/ |
| 26 |
class Charitable_Intergrations_SMTP { |
| 27 |
|
| 28 |
/** |
| 29 |
* The single instance of this class. |
| 30 |
* |
| 31 |
* @since 1.8.1.8 |
| 32 |
* |
| 33 |
* @var Charitable_Tools_Settings|null |
| 34 |
*/ |
| 35 |
private static $instance = null; |
| 36 |
|
| 37 |
/** |
| 38 |
* Load the class. |
| 39 |
* |
| 40 |
* @since 1.8.1.8 |
| 41 |
*/ |
| 42 |
public function load() { |
| 43 |
|
| 44 |
$this->hooks(); |
| 45 |
} |
| 46 |
|
| 47 |
/** |
| 48 |
* Hooks. |
| 49 |
* |
| 50 |
* @since 1.8.1.8 |
| 51 |
*/ |
| 52 |
private function hooks() { |
| 53 |
} |
| 54 |
|
| 55 |
/** |
| 56 |
* Enqueue assets. |
| 57 |
* |
| 58 |
* @since 1.8.1.8 |
| 59 |
*/ |
| 60 |
public function enqueue_scripts() { |
| 61 |
|
| 62 |
if ( ! class_exists( 'Charitable' ) ) { |
| 63 |
return; |
| 64 |
} |
| 65 |
|
| 66 |
$min = charitable_get_min_suffix(); |
| 67 |
$version = charitable()->get_version(); |
| 68 |
$assets_dir = charitable()->get_path( 'assets', false ); |
| 69 |
|
| 70 |
/* The following styles are only loaded on Charitable screens. */ |
| 71 |
$screen = get_current_screen(); |
| 72 |
|
| 73 |
if ( ( ! empty( $_GET['page'] ) && 'charitable-smtp' === $_GET['page'] ) ) { // phpcs:ignore |
| 74 |
|
| 75 |
wp_enqueue_style( |
| 76 |
'charitable-smtp', |
| 77 |
$assets_dir . 'css/integrations/smtp.css', |
| 78 |
array(), |
| 79 |
$version |
| 80 |
); |
| 81 |
|
| 82 |
wp_register_script( |
| 83 |
'charitable-admin-plugins', |
| 84 |
$assets_dir . 'js/plugins/charitable-admin-plugins' . $min . '.js', |
| 85 |
array( 'jquery' ), |
| 86 |
$version, |
| 87 |
true |
| 88 |
); |
| 89 |
|
| 90 |
} |
| 91 |
} |
| 92 |
|
| 93 |
/** |
| 94 |
* Returns and/or create the single instance of this class. |
| 95 |
* |
| 96 |
* @since 1.8.1.8 |
| 97 |
* |
| 98 |
* @return Charitable_Tools_Settings |
| 99 |
*/ |
| 100 |
public static function get_instance() { |
| 101 |
if ( is_null( self::$instance ) ) { |
| 102 |
self::$instance = new self(); |
| 103 |
} |
| 104 |
|
| 105 |
return self::$instance; |
| 106 |
} |
| 107 |
} |
| 108 |
|
| 109 |
endif; |
| 110 |
|