| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin Name: SmartVideo |
| 4 |
* Description: SmartVideo makes building a beautiful, professional video experience for your site effortless. |
| 5 |
* Version: 2.4.4 |
| 6 |
* Requires at least: 6.6 |
| 7 |
* Requires PHP: 7.3 |
| 8 |
* Author: Swarmify |
| 9 |
* Author URI: https://swarmify.com/?smartvideo_wordpress_plugin |
| 10 |
* Developer: James Christensen |
| 11 |
* Developer URI: https://profiles.wordpress.org/chris10sen/ |
| 12 |
* Text Domain: swarmify |
| 13 |
* Domain Path: /languages |
| 14 |
* |
| 15 |
* License: AGPL-3.0-or-later |
| 16 |
* License URI: https://www.gnu.org/licenses/agpl-3.0.html |
| 17 |
* |
| 18 |
* @package SmartVideo |
| 19 |
*/ |
| 20 |
|
| 21 |
defined( 'ABSPATH' ) || exit; |
| 22 |
|
| 23 |
if ( ! defined( 'SMARTVIDEO_PLUGIN_FILE' ) ) { |
| 24 |
define( 'SMARTVIDEO_PLUGIN_FILE', __FILE__ ); |
| 25 |
} |
| 26 |
|
| 27 |
if ( ! defined( 'SWARMIFY_PLUGIN_VERSION' ) ) { |
| 28 |
define( 'SWARMIFY_PLUGIN_VERSION', '2.4.4' ); |
| 29 |
} |
| 30 |
|
| 31 |
require_once plugin_dir_path( __FILE__ ) . 'vendor/autoload.php'; |
| 32 |
|
| 33 |
use Swarmify\Smartvideo; |
| 34 |
|
| 35 |
|
| 36 |
// phpcs:disable WordPress.Files.FileName |
| 37 |
|
| 38 |
|
| 39 |
if ( ! function_exists( 'activate_smartvideo' ) ) { |
| 40 |
function activate_smartvideo() { |
| 41 |
Smartvideo\Activator::activate(); |
| 42 |
} |
| 43 |
} |
| 44 |
|
| 45 |
register_activation_hook( __FILE__, 'activate_smartvideo' ); |
| 46 |
|
| 47 |
if ( ! function_exists( 'deactivate_smartvideo' ) ) { |
| 48 |
function deactivate_smartvideo() { |
| 49 |
delete_transient( 'smartvideo_activation_redirect_' . get_current_user_id() ); |
| 50 |
} |
| 51 |
} |
| 52 |
|
| 53 |
register_deactivation_hook( __FILE__, 'deactivate_smartvideo' ); |
| 54 |
|
| 55 |
|
| 56 |
if ( ! class_exists( 'SmartVideo_Bootstrap' ) ) { |
| 57 |
class SmartVideo_Bootstrap { |
| 58 |
/** |
| 59 |
* @var \SmartVideo_Bootstrap single instance of this class. |
| 60 |
*/ |
| 61 |
private static $instance; |
| 62 |
|
| 63 |
public function __construct() { |
| 64 |
new Smartvideo\Swarmify( 'SmartVideo' ); |
| 65 |
} |
| 66 |
|
| 67 |
public function __clone() { |
| 68 |
_doing_it_wrong( __FUNCTION__, esc_html__( 'Cloning is forbidden.', 'swarmify' ), esc_html( SWARMIFY_PLUGIN_VERSION ) ); |
| 69 |
} |
| 70 |
|
| 71 |
public function __wakeup() { |
| 72 |
_doing_it_wrong( __FUNCTION__, esc_html__( 'Unserializing instances of this class is forbidden.', 'swarmify' ), esc_html( SWARMIFY_PLUGIN_VERSION ) ); |
| 73 |
} |
| 74 |
|
| 75 |
/** |
| 76 |
* @return \SmartVideo_Bootstrap |
| 77 |
*/ |
| 78 |
public static function instance() { |
| 79 |
|
| 80 |
if ( null === self::$instance ) { |
| 81 |
self::$instance = new self(); |
| 82 |
} |
| 83 |
|
| 84 |
return self::$instance; |
| 85 |
} |
| 86 |
} |
| 87 |
} |
| 88 |
|
| 89 |
|
| 90 |
if ( ! function_exists( 'smartvideo_load_elementor' ) ) { |
| 91 |
function smartvideo_load_elementor() { |
| 92 |
if ( did_action( 'elementor/loaded' ) ) { |
| 93 |
require_once plugin_dir_path( __FILE__ ) . 'includes/page-builders/elementor/class-elementor-swarmify.php'; |
| 94 |
} |
| 95 |
} |
| 96 |
add_action( 'init', 'smartvideo_load_elementor' ); |
| 97 |
} |
| 98 |
|
| 99 |
if ( ! function_exists( 'smartvideo_load_gutenberg' ) ) { |
| 100 |
function smartvideo_load_gutenberg() { |
| 101 |
if ( function_exists( 'register_block_type' ) ) { |
| 102 |
require_once plugin_dir_path( __FILE__ ) . 'includes/page-builders/gutenberg/src/init.php'; |
| 103 |
} |
| 104 |
} |
| 105 |
add_action( 'init', 'smartvideo_load_gutenberg', 5 ); |
| 106 |
} |
| 107 |
|
| 108 |
if ( ! function_exists( 'smartvideo_load_beaver_builder' ) ) { |
| 109 |
function smartvideo_load_beaver_builder() { |
| 110 |
if ( class_exists( 'FLBuilder' ) ) { |
| 111 |
require plugin_dir_path( __FILE__ ) . 'includes/page-builders/beaverbuilder/class-beaverbuilder-smartvideo.php'; |
| 112 |
} |
| 113 |
} |
| 114 |
add_action( 'init', 'smartvideo_load_beaver_builder' ); |
| 115 |
} |
| 116 |
|
| 117 |
// Divi 5 modules must be registered from the dependency-tree action — |
| 118 |
// divi_extensions_init fires too late for D5's module registry. |
| 119 |
if ( ! function_exists( 'smartvideo_load_divi5_builder' ) ) { |
| 120 |
/** |
| 121 |
* @param object $dependency_tree The dependency tree. |
| 122 |
*/ |
| 123 |
function smartvideo_load_divi5_builder( $dependency_tree ) { |
| 124 |
if ( ! function_exists( 'et_builder_d5_enabled' ) || ! et_builder_d5_enabled() ) { |
| 125 |
return; |
| 126 |
} |
| 127 |
require_once plugin_dir_path( __FILE__ ) . 'includes/page-builders/divi5-builder/divi5-smartvideo.php'; |
| 128 |
$dependency_tree->add_dependency( |
| 129 |
new \Swarmify\Divi5\Modules\SmartVideo\SmartVideo() |
| 130 |
); |
| 131 |
} |
| 132 |
add_action( 'divi_module_library_modules_dependency_tree', 'smartvideo_load_divi5_builder', 10 ); |
| 133 |
|
| 134 |
// Load again on divi_extensions_init so the Visual Builder's script/style enqueues get registered. |
| 135 |
add_action( |
| 136 |
'divi_extensions_init', |
| 137 |
function () { |
| 138 |
if ( function_exists( 'et_builder_d5_enabled' ) && et_builder_d5_enabled() ) { |
| 139 |
if ( ! defined( 'SMARTVIDEO_DIVI5_PATH' ) ) { |
| 140 |
require_once plugin_dir_path( __FILE__ ) . 'includes/page-builders/divi5-builder/divi5-smartvideo.php'; |
| 141 |
} |
| 142 |
} |
| 143 |
}, |
| 144 |
5 |
| 145 |
); |
| 146 |
} |
| 147 |
|
| 148 |
if ( ! function_exists( 'smartvideo_load_divi_builder' ) ) { |
| 149 |
function smartvideo_load_divi_builder() { |
| 150 |
if ( function_exists( 'et_builder_d5_enabled' ) && et_builder_d5_enabled() ) { |
| 151 |
return; |
| 152 |
} |
| 153 |
require_once plugin_dir_path( __FILE__ ) . 'includes/page-builders/divi-builder/includes/DiviBuilder.php'; |
| 154 |
} |
| 155 |
add_action( 'divi_extensions_init', 'smartvideo_load_divi_builder' ); |
| 156 |
} |
| 157 |
|
| 158 |
if ( ! function_exists( 'smartvideo_load_bricks' ) ) { |
| 159 |
function smartvideo_load_bricks() { |
| 160 |
if ( defined( 'BRICKS_VERSION' ) ) { |
| 161 |
require_once plugin_dir_path( __FILE__ ) . 'includes/page-builders/bricks/class-bricks-smartvideo.php'; |
| 162 |
} |
| 163 |
} |
| 164 |
add_action( 'init', 'smartvideo_load_bricks', 9 ); |
| 165 |
} |
| 166 |
|
| 167 |
// before_breakdance_loaded, not init: Breakdance globs its element save |
| 168 |
// locations during breakdance_loaded, which fires on plugins_loaded. |
| 169 |
if ( ! function_exists( 'smartvideo_load_breakdance' ) ) { |
| 170 |
function smartvideo_load_breakdance() { |
| 171 |
if ( defined( '__BREAKDANCE_VERSION' ) && defined( 'BREAKDANCE_MODE' ) && class_exists( '\Breakdance\Elements\Element' ) ) { |
| 172 |
require_once plugin_dir_path( __FILE__ ) . 'includes/page-builders/breakdance/class-breakdance-smartvideo.php'; |
| 173 |
} |
| 174 |
} |
| 175 |
add_action( 'before_breakdance_loaded', 'smartvideo_load_breakdance' ); |
| 176 |
} |
| 177 |
|
| 178 |
|
| 179 |
|
| 180 |
/** |
| 181 |
* @since 2.1.0 |
| 182 |
*/ |
| 183 |
function smart_video_init() { |
| 184 |
load_plugin_textdomain( 'swarmify', false, plugin_basename( __DIR__ ) . '/languages' ); |
| 185 |
|
| 186 |
SmartVideo_Bootstrap::instance(); |
| 187 |
} |
| 188 |
|
| 189 |
add_action( 'plugins_loaded', 'smart_video_init', 10 ); |
| 190 |
|