| 1 |
<?php |
| 2 |
namespace Kibo\PhastPlugins\PhastPress\Compat; |
| 3 |
|
| 4 |
use ReflectionClass; |
| 5 |
use ReflectionException; |
| 6 |
|
| 7 |
class NextGenGallery { |
| 8 |
public function setup($deploymentPriority) { |
| 9 |
try { |
| 10 |
$class = new ReflectionClass('C_Photocrati_Resource_Manager'); |
| 11 |
$resourceManager = $class->getStaticPropertyValue('instance'); |
| 12 |
} catch (ReflectionException $e) { |
| 13 |
return; |
| 14 |
} |
| 15 |
|
| 16 |
if ($resourceManager |
| 17 |
&& ($resourceManagerPriority = has_filter('init', [$resourceManager, 'start_buffer'])) !== false |
| 18 |
&& $resourceManagerPriority < $deploymentPriority |
| 19 |
) { |
| 20 |
Log::add( |
| 21 |
'nextgen-gallery', |
| 22 |
'moving NextGEN Gallery resource manager hook after PhastPress deployment ' . |
| 23 |
'to support WP Super Cache late init' |
| 24 |
); |
| 25 |
remove_action('init', [$resourceManager, 'start_buffer'], $resourceManagerPriority); |
| 26 |
add_action('init', [$resourceManager, 'start_buffer'], $deploymentPriority); |
| 27 |
} |
| 28 |
} |
| 29 |
} |
| 30 |
|