| 1 |
<?php |
| 2 |
/** |
| 3 |
* SEO Integration |
| 4 |
* |
| 5 |
* @package Charitable/Classes/Charitable_Intergrations_SEO |
| 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.8 |
| 10 |
* @version 1.8.8 |
| 11 |
*/ |
| 12 |
|
| 13 |
// Exit if accessed directly. |
| 14 |
if ( ! defined( 'ABSPATH' ) ) { |
| 15 |
exit; |
| 16 |
} |
| 17 |
|
| 18 |
if ( ! class_exists( 'Charitable_Intergrations_SEO' ) ) : |
| 19 |
|
| 20 |
/** |
| 21 |
* Charitable_Intergrations_SEO |
| 22 |
* |
| 23 |
* @final |
| 24 |
* @since 1.8.8 |
| 25 |
*/ |
| 26 |
class Charitable_Intergrations_SEO { |
| 27 |
|
| 28 |
/** |
| 29 |
* The single instance of this class. |
| 30 |
* |
| 31 |
* @since 1.8.8 |
| 32 |
* |
| 33 |
* @var Charitable_Intergrations_SEO|null |
| 34 |
*/ |
| 35 |
private static $instance = null; |
| 36 |
|
| 37 |
/** |
| 38 |
* Hooks. |
| 39 |
* |
| 40 |
* @since 1.8.8 |
| 41 |
*/ |
| 42 |
private function hooks() { |
| 43 |
} |
| 44 |
|
| 45 |
/** |
| 46 |
* Enqueue assets. |
| 47 |
* |
| 48 |
* @since 1.8.8 |
| 49 |
*/ |
| 50 |
public function enqueue_scripts() { |
| 51 |
|
| 52 |
if ( ! class_exists( 'Charitable' ) ) { |
| 53 |
return; |
| 54 |
} |
| 55 |
|
| 56 |
$min = charitable_get_min_suffix(); |
| 57 |
$version = charitable()->get_version(); |
| 58 |
$assets_dir = charitable()->get_path( 'assets', false ); |
| 59 |
|
| 60 |
/* The following styles are only loaded on Charitable screens. */ |
| 61 |
$screen = get_current_screen(); |
| 62 |
|
| 63 |
if ( ( ! empty( $_GET['page'] ) && 'charitable-seo' === $_GET['page'] ) ) { // phpcs:ignore |
| 64 |
|
| 65 |
wp_enqueue_style( |
| 66 |
'charitable-seo', |
| 67 |
$assets_dir . 'css/integrations/seo.css', |
| 68 |
array(), |
| 69 |
$version |
| 70 |
); |
| 71 |
|
| 72 |
wp_register_script( |
| 73 |
'charitable-admin-plugins', |
| 74 |
$assets_dir . 'js/plugins/charitable-admin-plugins' . $min . '.js', |
| 75 |
array( 'jquery' ), |
| 76 |
$version, |
| 77 |
true |
| 78 |
); |
| 79 |
|
| 80 |
} |
| 81 |
} |
| 82 |
|
| 83 |
/** |
| 84 |
* Returns and/or create the single instance of this class. |
| 85 |
* |
| 86 |
* @since 1.8.8 |
| 87 |
* |
| 88 |
* @return Charitable_Intergrations_SEO |
| 89 |
*/ |
| 90 |
public static function get_instance() { |
| 91 |
if ( is_null( self::$instance ) ) { |
| 92 |
self::$instance = new self(); |
| 93 |
} |
| 94 |
|
| 95 |
return self::$instance; |
| 96 |
} |
| 97 |
} |
| 98 |
|
| 99 |
endif; |
| 100 |
|