| 1 |
<?php |
| 2 |
/* |
| 3 |
* Plugin Name: Swipe Slider |
| 4 |
* Plugin URI: https://pluginenvision.com/plugins/swipe-slider |
| 5 |
* Description: Make dynamic slider with solid, gradient, or image background. |
| 6 |
* Version: 0.19 |
| 7 |
* Requires at least: 6.5 |
| 8 |
* Requires PHP: 7.2 |
| 9 |
* Author: Plugin Envision |
| 10 |
* Author URI: https://pluginenvision.com |
| 11 |
* License: GPLv3 or later |
| 12 |
* License URI: https://www.gnu.org/licenses/gpl-3.0.html |
| 13 |
* Text Domain: swipe-slider |
| 14 |
* Domain Path: /languages |
| 15 |
*/ |
| 16 |
|
| 17 |
if( !defined( 'ABSPATH' ) ) { exit; } |
| 18 |
|
| 19 |
define( 'EVSS_FREE_SLUG', 'swipe-slider/swipe-slider.php' ); |
| 20 |
define( 'EVSS_PRO_SLUG', 'swipe-slider-pro/swipe-slider.php' ); |
| 21 |
|
| 22 |
if( function_exists( 'evss_fs' ) ){ |
| 23 |
register_activation_hook( __FILE__, function(){ |
| 24 |
if( is_plugin_active( EVSS_FREE_SLUG ) ){ |
| 25 |
deactivate_plugins( EVSS_FREE_SLUG ); |
| 26 |
} |
| 27 |
if( is_plugin_active( EVSS_PRO_SLUG ) ){ |
| 28 |
deactivate_plugins( EVSS_PRO_SLUG ); |
| 29 |
} |
| 30 |
} ); |
| 31 |
}else{ |
| 32 |
define( 'EVSS_VERSION', isset( $_SERVER['HTTP_HOST'] ) && 'localhost' === $_SERVER['HTTP_HOST'] ? time() : '0.19' ); |
| 33 |
define( 'EVSS_DIR_URL', plugin_dir_url( __FILE__ ) ); |
| 34 |
define( 'EVSS_DIR_PATH', plugin_dir_path( __FILE__ ) ); |
| 35 |
define( 'EVSS_WP_PLUG', EVSS_FREE_SLUG === plugin_basename( __FILE__ ) ); |
| 36 |
define( 'EVSS_FS_PLUG', EVSS_PRO_SLUG === plugin_basename( __FILE__ ) ); |
| 37 |
|
| 38 |
if( EVSS_FS_PLUG ){ |
| 39 |
require_once EVSS_DIR_PATH . 'includes/premium.php'; |
| 40 |
|
| 41 |
if( function_exists( 'evss_fs' ) ){ |
| 42 |
evss_fs()->set_basename( false, __FILE__ ); |
| 43 |
} |
| 44 |
} |
| 45 |
|
| 46 |
function evssWusul(){ |
| 47 |
if( EVSS_FS_PLUG ){ |
| 48 |
return evss_fs()->can_use_premium_code(); |
| 49 |
}else{ |
| 50 |
return false; |
| 51 |
} |
| 52 |
} |
| 53 |
|
| 54 |
if( !class_exists( 'EVSSPlugin' ) ){ |
| 55 |
class EVSSPlugin{ |
| 56 |
public function __construct(){ |
| 57 |
add_action( 'init', [ $this, 'onInit' ] ); |
| 58 |
add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), [$this, 'pluginActionLinks'] ); |
| 59 |
add_action( 'wp_ajax_evssWusulDekho', [$this, 'evssWusulDekho'] ); |
| 60 |
add_action( 'wp_ajax_nopriv_evssWusulDekho', [$this, 'evssWusulDekho'] ); |
| 61 |
add_action( 'admin_init', [$this, 'registerSettings'] ); |
| 62 |
add_action( 'rest_api_init', [$this, 'registerSettings']); |
| 63 |
} |
| 64 |
|
| 65 |
function onInit(){ |
| 66 |
register_block_type( __DIR__ . '/build' ); |
| 67 |
} |
| 68 |
|
| 69 |
function pluginActionLinks ( $links ) { |
| 70 |
$acLinks = []; |
| 71 |
|
| 72 |
if( EVSS_WP_PLUG ){ |
| 73 |
$acLinks[] = "<a href='https://pluginenvision.com/plugins/swipe-slider/#plans' target='_blank' style='font-size: 1.1em; font-weight: bold; color: #5465ff; text-shadow: 1px 1px 1px #eee;'>Get Pro</a>"; |
| 74 |
} |
| 75 |
|
| 76 |
return array_merge( $links, $acLinks ); |
| 77 |
} |
| 78 |
|
| 79 |
function registerSettings(){ |
| 80 |
register_setting( 'evssUtils', 'evssUtils', [ |
| 81 |
'show_in_rest' => [ |
| 82 |
'name' => 'evssUtils', |
| 83 |
'schema' => [ 'type' => 'string' ] |
| 84 |
], |
| 85 |
'type' => 'string', |
| 86 |
'default' => wp_json_encode( [ 'nonce' => wp_create_nonce( 'wp_ajax' ) ] ), |
| 87 |
'sanitize_callback' => 'sanitize_text_field' |
| 88 |
] ); |
| 89 |
} |
| 90 |
|
| 91 |
function evssWusulDekho(){ |
| 92 |
$nonce = sanitize_text_field( $_POST['_wpnonce'] ) ?? null; |
| 93 |
|
| 94 |
if( !wp_verify_nonce( $nonce, 'wp_ajax' )){ |
| 95 |
wp_send_json_error( 'Invalid Request' ); |
| 96 |
} |
| 97 |
|
| 98 |
wp_send_json_success( [ 'wusul' => evssWusul() ] ); |
| 99 |
} |
| 100 |
} |
| 101 |
new EVSSPlugin(); |
| 102 |
} |
| 103 |
} |