This commit is contained in:
2024-05-20 15:37:46 +03:00
commit 00b7dbd0b7
10404 changed files with 3285853 additions and 0 deletions

View File

@ -0,0 +1,123 @@
<?php
namespace Nextend\SmartSlider3\Conflict;
use Nextend\Framework\Database\Database;
use Nextend\Framework\Model\StorageSectionManager;
class Conflict {
/**
* @var Conflict
*/
private static $platformConflict;
protected $conflicts = array();
protected $debugConflicts = array();
public $curlLog = false;
/**
* @return Conflict
*/
final public static function getInstance() {
if (!isset(self::$platformConflict)) {
self::$platformConflict = new WordPress\WordPressConflict();
}
return static::$platformConflict;
}
protected function __construct() {
$this->testPHPINIMaxInputVars();
$this->testOpcache();
$this->testApiConnection();
$this->testDatabaseTables();
$this->testGantry4();
}
public function getConflicts() {
return $this->conflicts;
}
public function getDebugConflicts() {
return $this->debugConflicts;
}
public function getCurlLog() {
return $this->curlLog;
}
protected function displayConflict($title, $description, $url = '') {
$this->conflicts[] = '<b>' . $title . '</b> - ' . $description . (!empty($url) ? ' <a href="' . $url . '" target="_blank">' . n2_('Learn more') . '</a>' : '');
$this->debugConflicts[] = $title;
}
private function testPHPINIMaxInputVars() {
if (function_exists('ini_get')) {
$max_input_vars = intval(ini_get('max_input_vars'));
if ($max_input_vars < 1000) {
$this->displayConflict('PHP - max_input_vars', sprintf(n2_('Increase %1$s in php.ini to 1000 or more. Current value: %2$s'), '<b>max_input_vars</b>', $max_input_vars), 'https://smartslider.helpscoutdocs.com/article/1717-wordpress-installation');
}
}
}
private function testOpcache() {
if (function_exists('ini_get') && ini_get('opcache.enable')) {
$revalidateFrequenty = intval(ini_get('opcache.revalidate_freq'));
if ($revalidateFrequenty >= 15) {
$this->displayConflict('PHP - opcache', sprintf(n2_('Decrease %1$s below 15 in php.ini to prevent fatal errors on plugin updates. Current value: %2$s'), '<b>opcache.revalidate_freq</b>', $revalidateFrequenty), 'https://smartslider.helpscoutdocs.com/article/1717-wordpress-installation');
}
}
}
private function testApiConnection() {
$log = StorageSectionManager::getStorage('smartslider')
->get('log', 'api');
if (!empty($log)) {
if (strpos($log, 'ACTION_MISSING') === false) {
$this->displayConflict(n2_('Unable to connect to the API'), sprintf(n2_('See %1$sDebug Information%2$s for more details!'), '<b>', '</b>'));
$this->curlLog = json_decode($log, true);
}
}
}
private function testDatabaseTables() {
$tables = array(
'#__nextend2_image_storage',
'#__nextend2_section_storage',
'#__nextend2_smartslider3_generators',
'#__nextend2_smartslider3_sliders',
'#__nextend2_smartslider3_sliders_xref',
'#__nextend2_smartslider3_slides'
);
foreach ($tables as $table) {
$table = Database::parsePrefix($table);
$result = Database::queryRow('SHOW TABLES LIKE :table', array(
":table" => $table
));
if (empty($result)) {
$this->conflicts[] = n2_('MySQL table missing') . ': ' . $table;
$this->debugConflicts[] = n2_('MySQL table missing') . ': ' . $table;
}
}
}
private function testGantry4() {
if (defined('GANTRY_VERSION') && version_compare(GANTRY_VERSION, '5', '<')) {
$this->displayConflict('Gantry 4', n2_('Your theme uses an outdated MooTools library which is not compatible.'), 'https://wordpress.org/support/topic/mootools-overwrites-the-native-bind/');
}
}
}

View File

@ -0,0 +1,122 @@
<?php
namespace Nextend\SmartSlider3\Conflict\WordPress;
use Nextend\SmartSlider3\Conflict\Conflict;
use WPH_functions;
class WordPressConflict extends Conflict {
protected function __construct() {
parent::__construct();
$this->testPluginForgetAboutShortcodeButtons();
$this->testPluginWPHideAndSecurity();
$this->testPluginNetbaseWidgetsForSiteOrigin();
$this->testPluginNavMenuAddonForElementor();
$this->testPluginSimplyExclude();
$this->testPluginCaches();
}
/**
* Forget About Shortcode Buttons
* @url https://wordpress.org/plugins/forget-about-shortcode-buttons/
*/
private function testPluginForgetAboutShortcodeButtons() {
if (function_exists('run_forget_about_shortcode_buttons')) {
$this->displayConflict('Forget About Shortcode Buttons', n2_('This plugin breaks JavaScript in the admin area, deactivate it and use alternative plugin.'), 'https://wordpress.org/support/topic/fasc-breaks-js-in-several-other-plugins/');
}
}
/**
* WP Hide & Security Enhancer
* @url https://wordpress.org/plugins/wp-hide-security-enhancer/
*/
private function testPluginWPHideAndSecurity() {
if (class_exists('WPH', false)) {
if (class_exists('WPH_functions', false)) {
$functions = new WPH_functions();
if ($functions->is_permalink_enabled()) {
$new_admin_url = $functions->get_module_item_setting('admin_url', 'admin');
if (!empty($new_admin_url)) {
$this->displayConflict('WP Hide & Security Enhancer', n2_('This plugin breaks Smart Slider 3 ajax calls if custom admin url enabled.'), 'https://wordpress.org/support/topic/smart-slider-3-does-not-work-with-custom-admin-url/');
}
}
}
}
}
/**
* Netbase Widgets For SiteOrigin
* @url https://wordpress.org/plugins/netbase-widgets-for-siteorigin/
*/
private function testPluginNetbaseWidgetsForSiteOrigin() {
if (class_exists('NBT_SiteOrigin_Widgets')) {
$this->displayConflict('Netbase Widgets For SiteOrigin', n2_('This plugin adds a background image to every SVG and breaks SSL.'), 'https://wordpress.org/support/topic/plugin-messes-up-svg-and-breaks-ssl/');
}
}
/**
* NavMenu Addon For Elementor
* @url https://wordpress.org/plugins/navmenu-addon-for-elementor/
*/
private function testPluginNavMenuAddonForElementor() {
if (defined('ELEMENTOR_MENUS_VERSION')) {
$this->displayConflict('NavMenu Addon For Elementor', n2_('This plugin has a JavaScript error which might break Smart Slider.'), 'https://wordpress.org/support/topic/plugin-causes-javascript-error-and-breaks-others/');
}
}
/**
* Simply Exclude
* @url https://wordpress.org/plugins/simply-exclude/
*/
private function testPluginSimplyExclude() {
if (defined('SIMPLY_EXCLUDE_I18N_DOMAIN')) {
$this->displayConflict('Simply Exclude', sprintf(n2_('This plugin breaks the filtering options of the dynamic slide generators when %1$s is set to %2$s. Also it has not received any updates since WordPress 3.9.'), 'Query Filtering', 'All Loops'));
}
}
/**
* Cache plugins
*/
private function testPluginCaches() {
$description = n2_('Optimization plugins often create issues, so if you see anything wrong, follow our documentation:');
$link = 'https://smartslider.helpscoutdocs.com/article/1976-cache-or-minification';
if (defined('WP_ROCKET_VERSION')) {
$this->displayConflict('WP Rocket', $description, $link . '#wp-rocket');
}
if (defined('WPFC_WP_PLUGIN_DIR')) {
$this->displayConflict('WP Fastest Cache', $description, $link . '#wp-fastest-cache');
}
if (defined('NITROPACK_VERSION')) {
$this->displayConflict('Nitropack', $description, $link . '#nitropack');
}
if (defined('AUTOPTIMIZE_PLUGIN_VERSION')) {
$this->displayConflict('Autoptimize', $description, $link . '#autoptimize');
}
if (defined('LSCWP_V')) {
$this->displayConflict('Litespeed Cache', $description, $link . '#litespeed');
}
if (defined('SiteGround_Optimizer\VERSION')) {
$this->displayConflict('SiteGround Optimizer', $description, $link . '#sg-optimizer');
}
if (defined('W3TC_DIR')) {
$this->displayConflict('W3 Total Cache', $description, $link . '#w3-total-cache');
}
if (defined('WPCACHEHOME')) {
$this->displayConflict('WP Super Cache', $description, $link . '#wp-super-cache');
}
if (defined('JETPACK__VERSION')) {
$this->displayConflict('Jetpack', $description, $link . '#jetpack');
}
}
}