| @@ -12,9 +12,9 @@ | ||
| 12 | 12 | /** |
| 13 | 13 | * Duplicator Class |
| 14 | 14 | */ |
| 15 | 15 | |
| 16 | -if (!class_exists('BdThemes_Duplicator')) : | |
| 16 | +if (!class_exists(__NAMESPACE__ . '\\BdThemes_Duplicator')) : | |
| 17 | 17 | class BdThemes_Duplicator { |
| 18 | 18 | |
| 19 | 19 | public function __construct() { |
| 20 | 20 | add_action('admin_action_ultimate_post_kit_duplicate_as_draft', [$this, 'bdt_duplicate_as_draft']); |
| @@ -215,6 +215,15 @@ | ||
| 215 | 215 | } |
| 216 | 216 | } |
| 217 | 217 | endif; |
| 218 | 218 | |
| 219 | - | |
| 219 | +/** | |
| 220 | + * Instantiate the namespaced class. | |
| 221 | + * | |
| 222 | + * The guard above and this statement must resolve to the same class. An | |
| 223 | + * unqualified class_exists() string is always resolved against the global | |
| 224 | + * namespace, so a sibling plugin declaring a global \BdThemes_Duplicator | |
| 225 | + * (Live Copy Paste does) used to satisfy the old guard and skip the | |
| 226 | + * declaration, while this line still asked for | |
| 227 | + * UltimatePostKit\Includes\BdThemes_Duplicator -- a fatal error. | |
| 228 | + */ | |
| 220 | 229 | new BdThemes_Duplicator(); |