| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin Name: WowOptin |
| 4 |
* Description: A WordPress Optin plugin helps capture visitor info through customizable forms to grow your email list and boost lead generation! |
| 5 |
* Requires at least: 6.4 |
| 6 |
* Requires PHP: 7.4 |
| 7 |
* Version: 1.4.41 |
| 8 |
* Author: WPXPO |
| 9 |
* Author URI: https://wpxpo.com/ |
| 10 |
* License: GPLv3 |
| 11 |
* License URI: http://www.gnu.org/licenses/gpl-3.0.html |
| 12 |
* Text Domain: optin |
| 13 |
* Domain Path: /languages |
| 14 |
* |
| 15 |
* @package optin |
| 16 |
*/ |
| 17 |
|
| 18 |
// If this file is called directly, abort. |
| 19 |
if ( ! defined( 'WPINC' ) ) { |
| 20 |
die; |
| 21 |
} |
| 22 |
|
| 23 |
|
| 24 |
define( 'OPTN_VERSION', '1.4.41' ); |
| 25 |
define( 'OPTN_BASE', plugin_basename( __FILE__ ) ); |
| 26 |
define( 'OPTN_DIR', plugin_dir_path( __FILE__ ) ); |
| 27 |
define( 'OPTN_URL', plugin_dir_url( __FILE__ ) ); |
| 28 |
define( 'OPTN_MIN_CAPABILITY', 'edit_pages' ); |
| 29 |
define( 'OPTN_CACHE_DAY', 3 ); |
| 30 |
|
| 31 |
use OPTN\Includes\Activator; |
| 32 |
use OPTN\Includes\Deactivator; |
| 33 |
use OPTN\Includes\Init; |
| 34 |
|
| 35 |
/** |
| 36 |
* The code that runs during plugin activation. |
| 37 |
*/ |
| 38 |
function optn_activate_plugin() { |
| 39 |
Activator::activate(); |
| 40 |
} |
| 41 |
|
| 42 |
/** |
| 43 |
* The code that runs during plugin deactivation. |
| 44 |
*/ |
| 45 |
function optn_deactivate_plugin() { |
| 46 |
Deactivator::deactivate(); |
| 47 |
} |
| 48 |
|
| 49 |
register_activation_hook( __FILE__, 'optn_activate_plugin' ); |
| 50 |
register_deactivation_hook( __FILE__, 'optn_deactivate_plugin' ); |
| 51 |
|
| 52 |
|
| 53 |
/** |
| 54 |
* Autoloader function |
| 55 |
* |
| 56 |
* @param string $class_name class name. |
| 57 |
* @return void |
| 58 |
*/ |
| 59 |
function optn_autoloader( $class_name ) { |
| 60 |
$namespace = 'OPTN\\'; |
| 61 |
$base_dir = OPTN_DIR; |
| 62 |
|
| 63 |
$len = strlen( $namespace ); |
| 64 |
if ( strncmp( $namespace, $class_name, $len ) !== 0 ) { |
| 65 |
return; |
| 66 |
} |
| 67 |
|
| 68 |
$relative_class = substr( $class_name, $len ); |
| 69 |
|
| 70 |
$segments = explode( '\\', $relative_class ); |
| 71 |
$file_name = array_pop( $segments ); |
| 72 |
$subfolder = strtolower( implode( '/', $segments ) ); |
| 73 |
|
| 74 |
$prefix = ( strpos( $subfolder, 'traits' ) !== false ) ? 'trait-' : 'class-'; |
| 75 |
|
| 76 |
$file_name = strtolower( |
| 77 |
preg_replace( '/([a-z])([A-Z])/', '$1-$2', $file_name ) |
| 78 |
); |
| 79 |
|
| 80 |
$file = rtrim( $base_dir . $subfolder, '/' ) . '/' . $prefix . $file_name . '.php'; |
| 81 |
|
| 82 |
if ( file_exists( $file ) ) { |
| 83 |
require_once $file; |
| 84 |
return; |
| 85 |
} |
| 86 |
} |
| 87 |
|
| 88 |
spl_autoload_register( 'optn_autoloader' ); |
| 89 |
|
| 90 |
|
| 91 |
/** |
| 92 |
* Begins execution of the plugin. |
| 93 |
* |
| 94 |
* @since 1.0.0 |
| 95 |
*/ |
| 96 |
function optn_run_plugin() { |
| 97 |
$plugin = new Init(); |
| 98 |
$plugin->run(); |
| 99 |
} |
| 100 |
|
| 101 |
optn_run_plugin(); |
| 102 |
|