-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathar-model-viewer-for-woocommerce.php
More file actions
176 lines (156 loc) · 6.31 KB
/
Copy pathar-model-viewer-for-woocommerce.php
File metadata and controls
176 lines (156 loc) · 6.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
<?php
/**
* The plugin bootstrap file
*
* This file is read by WordPress or ClassicPress to generate the plugin information in the plugin
* admin area. This file also includes all of the dependencies used by the plugin,
* registers the activation and deactivation functions, and defines a function
* that starts the plugin.
*
* @link https://racmanuel.dev
* @since 1.0.0
* @package Ar_Model_Viewer_For_Woocommerce
*
* @wordpress-plugin
* Plugin Name: 3D/AR/VR Model Viewer for WooCommerce
* Plugin URI: https://racmanuel.dev/plugins-wordpress/ar-model-viewer-for-woocommerce/
* Description: Display 3D models of your products in augmented reality (AR) directly in the browser on iOS and Android devices. Supports .glb files and AI-powered features to generate 3D models from text or images with meshy.ai.
* Version: 2.0.3
* Author: Manuel Ramirez Coronel
* Requires at least: 5.9
* Requires PHP: 7.4
* Tested up to: 6.8
* Requires Plugins: woocommerce
* WC requires at least: 3.9
* WC tested up to: 9.8
* Author URI: https://racmanuel.dev/
* License: GPL-2.0+
* License URI: https://www.gnu.org/licenses/gpl-2.0.txt
* Text Domain: ar-model-viewer-for-woocommerce
* Domain Path: /languages
*
* @fs_premium_only /admin/class-ar-model-viewer-for-woocommerce-admin-pro.php
*
*/
// If this file is called directly, abort.
if (!defined('WPINC')) {
die;
}
/**
* Get the bootstrap!
* (Update path to use cmb2 or CMB2, depending on the name of the folder.
* Case-sensitive is important on some systems.)
*/
require_once plugin_dir_path(__FILE__) . 'vendor/autoload.php';
if (!function_exists('ar_model_viewer_for_woocommerce_fs')) {
// Create a helper function for easy SDK access.
function ar_model_viewer_for_woocommerce_fs()
{
global $ar_model_viewer_for_woocommerce_fs;
if (!isset($ar_model_viewer_for_woocommerce_fs)) {
// Include Freemius SDK.
require_once dirname(__FILE__) . '/vendor/freemius/wordpress-sdk/start.php';
$ar_model_viewer_for_woocommerce_fs = fs_dynamic_init( array(
'id' => '16088',
'slug' => 'ar-model-viewer-for-woocommerce',
'type' => 'plugin',
'public_key' => 'pk_5143076d3ed4661ac299aa66baabc',
'is_premium' => true,
'premium_suffix' => 'pro',
// If your plugin is a serviceware, set this option to false.
'has_premium_version' => true,
'has_addons' => false,
'has_paid_plans' => true,
'menu' => array(
'slug' => 'ar_model_viewer_for_woocommerce_settings',
'parent' => array(
'slug' => 'options-general.php',
),
),
) );
}
return $ar_model_viewer_for_woocommerce_fs;
}
// Init Freemius.
ar_model_viewer_for_woocommerce_fs();
// Signal that SDK was initiated.
do_action('ar_model_viewer_for_woocommerce_fs_loaded');
}
/**
* Current plugin version.
* Start at version 1.0.0 and use SemVer - https://semver.org
* Rename this for your plugin and update it as you release new versions.
*/
define('AR_MODEL_VIEWER_FOR_WOOCOMMERCE_VERSION', '2.0.3');
/**
* Define the Plugin basename
*/
define('AR_MODEL_VIEWER_FOR_WOOCOMMERCE_BASE_NAME', plugin_basename(__FILE__));
/**
* The code that runs during plugin activation.
*
* This action is documented in includes/class-ar-model-viewer-for-woocommerce-activator.php
* Full security checks are performed inside the class.
*/
function ar_model_viewer_for_woocommerce_activate()
{
require_once plugin_dir_path(__FILE__) . 'includes/class-ar-model-viewer-for-woocommerce-activator.php';
Ar_Model_Viewer_For_Woocommerce_Activator::activate();
}
/**
* The code that runs during plugin deactivation.
*
* This action is documented in includes/class-ar-model-viewer-for-woocommerce-deactivator.php
* Full security checks are performed inside the class.
*/
function ar_model_viewer_for_woocommerce_deactivate()
{
require_once plugin_dir_path(__FILE__) . 'includes/class-ar-model-viewer-for-woocommerce-deactivator.php';
Ar_Model_Viewer_For_Woocommerce_Deactivator::deactivate();
}
register_activation_hook(__FILE__, 'ar_model_viewer_for_woocommerce_activate');
register_deactivation_hook(__FILE__, 'ar_model_viewer_for_woocommerce_deactivate');
// Not like register_uninstall_hook(), you do NOT have to use a static function.
ar_model_viewer_for_woocommerce_fs()->add_action('after_uninstall', 'ar_model_viewer_for_woocommerce_uninstall');
function ar_model_viewer_for_woocommerce_uninstall()
{
if (!defined('WP_UNINSTALL_PLUGIN')
|| empty($_REQUEST)
|| !isset($_REQUEST['plugin'])
|| !isset($_REQUEST['action'])
|| 'ar-model-viewer-for-woocommerce/ar-model-viewer-for-woocommerce.php' !== $_REQUEST['plugin']
|| 'delete-plugin' !== $_REQUEST['action']
|| !check_ajax_referer('updates', '_ajax_nonce')
|| !current_user_can('activate_plugins')
) {
exit;
}
}
/**
* The core plugin class that is used to define internationalization,
* admin-specific hooks, and public-facing site hooks.
*/
require plugin_dir_path(__FILE__) . 'includes/class-ar-model-viewer-for-woocommerce.php';
add_action( 'before_woocommerce_init', function() {
if ( class_exists( \Automattic\WooCommerce\Utilities\FeaturesUtil::class ) ) {
\Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true );
}
} );
/**
* Begins execution of the plugin.
*
* Since everything within the plugin is registered via hooks,
* kicking off the plugin from this point in the file does
* not affect the page life cycle.
*
* Generally you will want to hook this function, instead of callign it globally.
* However since the purpose of your plugin is not known until you write it, we include the function globally.
*
* @since 1.0.0
*/
function ar_model_viewer_for_woocommerce_run()
{
$plugin = new Ar_Model_Viewer_For_Woocommerce();
$plugin->run();
}
ar_model_viewer_for_woocommerce_run();