first
This commit is contained in:
51
wp-content/plugins/smart-slider-3/Nextend/WordPress/Fail.php
Normal file
51
wp-content/plugins/smart-slider-3/Nextend/WordPress/Fail.php
Normal file
@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
if (!function_exists('smartslider3_admin_menu')) {
|
||||
if (!defined('NEXTEND_SMARTSLIDER_3_URL_PATH')) {
|
||||
define('NEXTEND_SMARTSLIDER_3_URL_PATH', 'smart-slider3');
|
||||
}
|
||||
|
||||
add_action('admin_menu', 'smartslider3_admin_menu');
|
||||
|
||||
function smartslider3_admin_menu() {
|
||||
add_menu_page('Smart Slider', 'Smart Slider', 'smartslider', NEXTEND_SMARTSLIDER_3_URL_PATH, 'smartslider3_admin_error', 'dashicons-format-gallery');
|
||||
}
|
||||
|
||||
function smartslider3_admin_error() {
|
||||
}
|
||||
|
||||
if (isset($_GET['page']) && $_GET['page'] == NEXTEND_SMARTSLIDER_3_URL_PATH) {
|
||||
if (!version_compare(PHP_VERSION, '7.0', '>=')) {
|
||||
|
||||
@wp_die(sprintf('<div class="error"><p>%s</p></div>', sprintf('Smart Slider 3 requires PHP version 7.0+, plugin is currently NOT RUNNING. Current PHP version: %1$s. %2$s%2$s Consult your host about %3$s upgrading your PHP version%4$s.', PHP_VERSION, '<br>', '<a href="https://wordpress.org/support/update-php/" target="_blank">', '</a>')));
|
||||
} else if (!version_compare(get_bloginfo('version'), '5.0', '>=')) {
|
||||
|
||||
@wp_die(sprintf('<div class="error"><p>%s</p></div>', 'Smart Slider 3 requires WordPress version 5.0+. Because you are using an earlier version, the plugin is currently NOT RUNNING.'));
|
||||
} else if (!defined('NONCE_SALT')) {
|
||||
|
||||
@wp_die(sprintf('<div class="error"><p>%1$s %2$s</p></div>', 'NONCE_SALT constant is missing from the wp-config.php file.', sprintf('%1$sMake sure it is defined.%2$s', '<a href="https://smartslider.helpscoutdocs.com/article/2014-use-of-undefined-constant-noncesalt" target="_blank">', '</a>')));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!function_exists('smartslider3_fail_php_version')) {
|
||||
function smartslider3_fail_php_version() {
|
||||
$html_message = sprintf('<div class="error"><p>%s</p></div>', sprintf('Smart Slider 3 requires PHP version 7.0+, plugin is currently NOT RUNNING. Current PHP version: %1$s. %2$s%2$s Consult your host about %3$s upgrading your PHP version%4$s.', PHP_VERSION, '<br>', '<a href="https://wordpress.org/support/update-php/" target="_blank">', '</a>'));
|
||||
echo wp_kses_post($html_message);
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('smartslider3_fail_wp_version')) {
|
||||
function smartslider3_fail_wp_version() {
|
||||
$html_message = sprintf('<div class="error"><p>%s</p></div>', 'Smart Slider 3 requires WordPress version 5.0+. Because you are using an earlier version, the plugin is currently NOT RUNNING.');
|
||||
echo wp_kses_post($html_message);
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('smartslider3_fail_nonce_salt')) {
|
||||
function smartslider3_fail_nonce_salt() {
|
||||
$html_message = sprintf('<div class="error"><p>%1$s %2$s</p></div>', 'NONCE_SALT constant is missing from the wp-config.php file.', sprintf('%1$sMake sure it is defined.%2$s', '<a href="https://smartslider.helpscoutdocs.com/article/2014-use-of-undefined-constant-noncesalt" target="_blank">', '</a>'));
|
||||
echo wp_kses_post($html_message);
|
||||
}
|
||||
}
|
@ -0,0 +1,289 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace Nextend\WordPress;
|
||||
|
||||
|
||||
use Nextend\Framework\Pattern\SingletonTrait;
|
||||
|
||||
class OutputBuffer {
|
||||
|
||||
use SingletonTrait;
|
||||
|
||||
protected $priority = 100;
|
||||
|
||||
protected $extraObStart = 0;
|
||||
|
||||
protected function init() {
|
||||
|
||||
add_action('init', array(
|
||||
$this,
|
||||
'onInit'
|
||||
), $this->priority);
|
||||
|
||||
add_action('shutdown', array(
|
||||
$this,
|
||||
'closeOutputBuffers'
|
||||
), -1 * $this->priority);
|
||||
|
||||
/**
|
||||
* Fix for KeyCDN cache enabled
|
||||
* @url https://wordpress.org/plugins/cache-enabler/
|
||||
*/
|
||||
if (class_exists('Cache_Enabler', false)) {
|
||||
add_action('template_redirect', function () {
|
||||
ob_start(array(
|
||||
$this,
|
||||
"outputCallback"
|
||||
));
|
||||
}, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fix for Hyper Cache
|
||||
* @url https://wordpress.org/plugins/hyper-cache/
|
||||
*/
|
||||
if (function_exists('hyper_cache_callback')) {
|
||||
add_filter('cache_buffer', array(
|
||||
$this,
|
||||
'prepareOutput'
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Fix for Speed booster Pack
|
||||
* @url https://wordpress.org/plugins/speed-booster-pack/
|
||||
*/
|
||||
if (defined('SBP_VERSION')) {
|
||||
add_filter('sbp_output_buffer', array(
|
||||
$this,
|
||||
'prepareOutput'
|
||||
));
|
||||
}
|
||||
|
||||
if (class_exists('PagespeedNinja')) {
|
||||
/**
|
||||
* @see SSDEV-2358
|
||||
*/
|
||||
add_action('template_redirect', function () {
|
||||
ob_start(array(
|
||||
$this,
|
||||
"outputCallback"
|
||||
));
|
||||
});
|
||||
}
|
||||
|
||||
if (class_exists('Cachify')) {
|
||||
/**
|
||||
* @see SSDEV-2776
|
||||
*/
|
||||
add_action('template_redirect', function () {
|
||||
ob_start(array(
|
||||
$this,
|
||||
"outputCallback"
|
||||
));
|
||||
});
|
||||
}
|
||||
|
||||
if (class_exists('Ionos\Performance\Caching')) {
|
||||
/**
|
||||
* @see SSDEV-3780
|
||||
*/
|
||||
add_action('template_redirect', function () {
|
||||
ob_start(array(
|
||||
$this,
|
||||
"outputCallback"
|
||||
));
|
||||
});
|
||||
}
|
||||
|
||||
if (class_exists('WP_Grid_Builder\Autoload')) {
|
||||
/**
|
||||
* @see SSDEV-3888
|
||||
*/
|
||||
add_action('template_redirect', function () {
|
||||
ob_start(array(
|
||||
$this,
|
||||
"outputCallback"
|
||||
));
|
||||
});
|
||||
}
|
||||
|
||||
if (class_exists('wps_ic')) {
|
||||
/**
|
||||
* @see SSDEV-3916
|
||||
*/
|
||||
add_action('template_redirect', function () {
|
||||
ob_start(array(
|
||||
$this,
|
||||
"outputCallback"
|
||||
));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Theme's functions.php loaded at this point.
|
||||
*/
|
||||
public function onInit() {
|
||||
|
||||
/**
|
||||
* Borlabs cache
|
||||
* @url https://borlabs.io/download/
|
||||
*/
|
||||
if (defined('BORLABS_CACHE_SLUG') && !is_admin()) {
|
||||
add_action('template_redirect', array(
|
||||
$this,
|
||||
'outputStart'
|
||||
), -1 * $this->priority);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (defined('THEMIFY_VERSION') && !is_admin()) {
|
||||
|
||||
add_filter('template_include', array(
|
||||
$this,
|
||||
'templateIncludeOutputStart'
|
||||
), 1); // Themify use priority: 0
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
add_action('pp_end_html', array(
|
||||
$this,
|
||||
'closeOutputBuffers'
|
||||
), -10000); // ProPhoto 6 theme: we must close the buffer before the cache
|
||||
|
||||
add_action('headway_html_close', array(
|
||||
$this,
|
||||
'closeOutputBuffers'
|
||||
), $this->priority); // Headway theme
|
||||
|
||||
$this->outputStart();
|
||||
}
|
||||
|
||||
public function templateIncludeOutputStart($template) {
|
||||
|
||||
$this->outputStart();
|
||||
|
||||
return $template;
|
||||
}
|
||||
|
||||
public function outputStart() {
|
||||
static $started = false;
|
||||
if ($started) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$started = true;
|
||||
|
||||
if (defined('AUTOPTIMIZE_PLUGIN_DIR')) {
|
||||
add_filter('autoptimize_filter_html_before_minify', array(
|
||||
$this,
|
||||
'prepareOutput'
|
||||
));
|
||||
}
|
||||
|
||||
if (defined('WP_ROCKET_VERSION')) {
|
||||
add_filter('rocket_buffer', array(
|
||||
$this,
|
||||
'prepareOutput'
|
||||
), -100000);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gantry 4 improvement to use the inbuilt output filter
|
||||
*/
|
||||
if (defined('GANTRY_VERSION') && version_compare(GANTRY_VERSION, '4.0.0', '>=') && version_compare(GANTRY_VERSION, '5.0.0', '<')) {
|
||||
if (!is_admin()) {
|
||||
add_filter('gantry_before_render_output', array(
|
||||
$this,
|
||||
'prepareOutput'
|
||||
));
|
||||
remove_action('shutdown', array(
|
||||
$this,
|
||||
'closeOutputBuffers'
|
||||
), -1 * $this->priority);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
ob_start(array(
|
||||
$this,
|
||||
"outputCallback"
|
||||
));
|
||||
|
||||
for ($i = 0; $i < $this->extraObStart; $i++) {
|
||||
ob_start();
|
||||
}
|
||||
|
||||
/**
|
||||
* Ultimate reviews open a buffer on init and tries to close it on wp_footer.
|
||||
* To prevent that, lets open a new buffer which can be closed on wp_footer.
|
||||
*
|
||||
* @bug install Speed Contact Bar + Ultimate Reviews
|
||||
* @see https://wordpress.org/plugins/ultimate-reviews/
|
||||
*/
|
||||
if (function_exists('EWD_URP_add_ob_start')) {
|
||||
ob_start();
|
||||
}
|
||||
|
||||
/**
|
||||
* Cart66 closes our output buffer in forceDownload method
|
||||
* @url http://www.cart66.com
|
||||
*/
|
||||
if (class_exists('Cart66')) {
|
||||
ob_start();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function closeOutputBuffers() {
|
||||
|
||||
if (!defined('WC_DOING_AJAX') || !WC_DOING_AJAX) {
|
||||
$handlers = ob_list_handlers();
|
||||
$callback = self::class . '::outputCallback';
|
||||
if (in_array($callback, $handlers)) {
|
||||
for ($i = count($handlers) - 1; $i >= 0; $i--) {
|
||||
ob_end_flush();
|
||||
|
||||
if ($handlers[$i] === $callback) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function outputCallback($buffer, $phase) {
|
||||
|
||||
if ($phase & PHP_OUTPUT_HANDLER_FINAL || $phase & PHP_OUTPUT_HANDLER_END) {
|
||||
return $this->prepareOutput($buffer);
|
||||
}
|
||||
|
||||
return $buffer;
|
||||
}
|
||||
|
||||
public function prepareOutput($buffer) {
|
||||
|
||||
return apply_filters('wordpress_prepare_output', $buffer);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $priority
|
||||
*/
|
||||
public function setPriority($priority) {
|
||||
$this->priority = $priority;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $extraObStart
|
||||
*/
|
||||
public function setExtraObStart($extraObStart) {
|
||||
|
||||
$this->extraObStart = $extraObStart;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user