| 1 |
<?php |
| 2 |
/** |
| 3 |
* Setup wizard for the plugin |
| 4 |
* |
| 5 |
* @package '' |
| 6 |
* @since 8.4.10 |
| 7 |
*/ |
| 8 |
|
| 9 |
class WPVR_Setup_Wizard |
| 10 |
{ |
| 11 |
|
| 12 |
/** |
| 13 |
* Initialize setup wizards |
| 14 |
* |
| 15 |
* @since 8.4.10 |
| 16 |
*/ |
| 17 |
public function setup_wizard() |
| 18 |
{ |
| 19 |
add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts')); |
| 20 |
$this->output_html(); |
| 21 |
} |
| 22 |
|
| 23 |
public function enqueue_scripts($hook) { |
| 24 |
if (!isset($_GET['page']) || $_GET['page'] !== 'rex-wpvr-setup-wizard') { |
| 25 |
return; |
| 26 |
} |
| 27 |
wp_enqueue_media(); |
| 28 |
|
| 29 |
wp_enqueue_style( |
| 30 |
'wpvr-admin-post-type', |
| 31 |
plugin_dir_url( __DIR__ ) . 'admin/css/wpvr-admin-post-type.css', |
| 32 |
[], |
| 33 |
WPVR_VERSION |
| 34 |
); |
| 35 |
wp_enqueue_style( |
| 36 |
'wpvr-setup-wizard', |
| 37 |
WPVR_CSS_PATH . 'setup-wizard.css', |
| 38 |
[ 'wpvr-admin-post-type' ], |
| 39 |
WPVR_VERSION |
| 40 |
); |
| 41 |
wp_enqueue_style( |
| 42 |
'wpvr-pannellum-css', |
| 43 |
WPVR_PLUGIN_DIR_URL . 'admin/lib/pannellum/src/css/pannellum.css', |
| 44 |
[], |
| 45 |
WPVR_VERSION |
| 46 |
); |
| 47 |
|
| 48 |
wp_enqueue_script( |
| 49 |
'wpvr-libpannellum-js', |
| 50 |
WPVR_PLUGIN_DIR_URL . 'admin/lib/pannellum/src/js/libpannellum.js', |
| 51 |
['jquery'], |
| 52 |
WPVR_VERSION, |
| 53 |
true |
| 54 |
); |
| 55 |
wp_enqueue_script( |
| 56 |
'wpvr-pannellum-js', |
| 57 |
WPVR_PLUGIN_DIR_URL . 'admin/lib/pannellum/src/js/pannellum.js', |
| 58 |
['jquery'], |
| 59 |
WPVR_VERSION, |
| 60 |
true |
| 61 |
); |
| 62 |
wp_enqueue_script( |
| 63 |
'wpvr-onboarding-js', |
| 64 |
WPVR_PLUGIN_DIR_URL . 'admin/lib/onboarding/js/onboarding.js', |
| 65 |
['jquery'], |
| 66 |
WPVR_VERSION, |
| 67 |
true |
| 68 |
); |
| 69 |
wp_enqueue_script( |
| 70 |
'wpvr-setup-wizard', |
| 71 |
WPVR_JS_PATH . 'setup-wizard.js', |
| 72 |
['jquery'], |
| 73 |
WPVR_VERSION, |
| 74 |
true |
| 75 |
); |
| 76 |
|
| 77 |
wp_localize_script( |
| 78 |
'wpvr-setup-wizard', |
| 79 |
'wpvrSetupWizardData', |
| 80 |
array( |
| 81 |
'is_pro' => (bool) apply_filters( 'is_wpvr_pro_active', false ), |
| 82 |
'hotspot_limit' => 5, |
| 83 |
'upgrade_url' => esc_url( 'https://rextheme.com/wpvr/pricing/' ), |
| 84 |
'wizard_strings' => array( |
| 85 |
'limit_heading' => __( 'Limit Reached', 'wpvr' ), |
| 86 |
/* translators: %d: maximum number of hotspots allowed in free version */ |
| 87 |
'limit_line1' => sprintf( __( 'You can add up to %d hotspots on each scene in the Free version.', 'wpvr' ), 5 ), |
| 88 |
'limit_line2' => __( 'Upgrade to Pro to add an unlimited number of hotspots.', 'wpvr' ), |
| 89 |
), |
| 90 |
) |
| 91 |
); |
| 92 |
} |
| 93 |
|
| 94 |
/** |
| 95 |
* Output the rendered contents |
| 96 |
* |
| 97 |
* @since 8.4.10 |
| 98 |
*/ |
| 99 |
private function output_html() |
| 100 |
{ |
| 101 |
require_once plugin_dir_path(__FILE__) . '../admin/partials/wpvr-setup-wizard-views.php'; |
| 102 |
exit(); |
| 103 |
} |
| 104 |
} |
| 105 |
|