1 | <?php |
||
8 | class Jetpack_3rd_Party_Domain_Mapping { |
||
9 | |||
10 | /** |
||
11 | * @var Jetpack_3rd_Party_Domain_Mapping |
||
12 | **/ |
||
13 | private static $instance = null; |
||
14 | |||
15 | /** |
||
16 | * An array of methods that are used to hook the Jetpack sync filters for home_url and site_url to a mapping plugin. |
||
17 | * |
||
18 | * @var array |
||
19 | */ |
||
20 | static $test_methods = array( |
||
|
|||
21 | 'hook_wordpress_mu_domain_mapping', |
||
22 | 'hook_wpmu_dev_domain_mapping' |
||
23 | ); |
||
24 | |||
25 | static function init() { |
||
32 | |||
33 | private function __construct() { |
||
36 | |||
37 | /** |
||
38 | * This function is called on the plugins_loaded action and will loop through the $test_methods |
||
39 | * to try and hook a domain mapping plugin to the Jetpack sync filters for the home_url and site_url callables. |
||
40 | */ |
||
41 | function attempt_to_hook_domain_mapping_plugins() { |
||
52 | |||
53 | /** |
||
54 | * This method will test for a constant and function that are known to be used with Donncha's WordPress MU |
||
55 | * Domain Mapping plugin. If conditions are met, we hook the domain_mapping_siteurl() function to Jetpack sync |
||
56 | * filters for home_url and site_url callables. |
||
57 | * |
||
58 | * @return bool |
||
59 | */ |
||
60 | function hook_wordpress_mu_domain_mapping() { |
||
70 | |||
71 | /** |
||
72 | * This method will test for a class and method known to be used in WPMU Dev's domain mapping plugin. If the |
||
73 | * method exists, then we'll hook the swap_to_mapped_url() to our Jetpack sync filters for home_url and site_url. |
||
74 | * |
||
75 | * @return bool |
||
76 | */ |
||
77 | function hook_wpmu_dev_domain_mapping() { |
||
88 | |||
89 | /* |
||
90 | * Utility Methods |
||
91 | * |
||
92 | * These methods are very minimal, and in most cases, simply pass on arguments. Why create them you ask? |
||
93 | * So that we can test. |
||
94 | */ |
||
95 | |||
96 | public function method_exists( $class, $method ) { |
||
99 | |||
100 | public function class_exists( $class ) { |
||
103 | |||
104 | public function function_exists( $function ) { |
||
107 | |||
108 | public function get_domain_mapping_utils_instance() { |
||
111 | } |
||
112 | |||
114 |
The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using
the property is implicitly global.
To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.