!empty( get_option('navigation') ) ? get_option('navigation') : 'false', 'drag' => !empty( get_option('drag') ) ? get_option('drag') : 'false', 'playspeed' => !empty( get_option('playspeed') ) ? get_option('playspeed') : 100, 'framerate' => !empty( get_option('framerate') ) ? get_option('framerate') : 10, 'enablespin' => !empty( get_option('enablespin') ) ? get_option('enablespin') : 'false', 'showcursor' => !empty( get_option('showcursor') ) ? get_option('showcursor') : 'false', ) ); } add_action( 'wp_enqueue_scripts', 'wp360view_enqueue_custom_style' ); } if( ! function_exists( 'wp360view_enqueue_admin_custom_style' ) ) { function wp360view_enqueue_admin_custom_style() { wp_register_style( 'custom-admin-css', WP360VIEW_PLUGIN_URL . 'css/360-admin-custom.css', null, Wp360view_Config::WC_MIN_PLUGIN_VERSION ); wp_enqueue_style( 'custom-admin-css' ); } add_action( 'admin_enqueue_scripts', 'wp360view_enqueue_admin_custom_style' ); } if( ! function_exists( 'wp360view_action_links' ) ) { function wp360view_action_links( $links ) { $url = 'admin.php?page=wc-settings&tab=wp360view_settings'; $settings_link = ''. esc_html__( 'Settings', '360-product-viewer-for-woocommerce' ) .''; array_unshift( $links, $settings_link ); return $links; } add_filter( 'plugin_action_links_' . WP360VIEW_PLUGIN_BASENAME, 'wp360view_action_links' ); } // Load session if it is not created add_action( 'woocommerce_init', function(){ if ( function_exists( 'WC' ) && class_exists( 'woocommerce' ) && is_plugin_active( 'woocommerce/woocommerce.php' ) && isset(WC()->session) && ! WC()->session->has_session() ) { WC()->session->set_customer_session_cookie( true ); } },9999 ); // Start the execution of the plugin. if( ! function_exists( 'wp360view_run_plugin' ) ) { function wp360view_run_plugin() { return \WP360view\Wp360view_Run::instance(); } wp360view_run_plugin(); } } add_action( 'plugins_loaded', 'wp360view_plugin', 999 ); } } else { // Deactivate Plugin Conditional if Woocommerce is not installed. if( ! function_exists( 'wp360view_deactivate' ) ) { function wp360view_deactivate() { if ( ! ( function_exists( 'WC' ) && class_exists( 'woocommerce' ) && is_plugin_active( 'woocommerce/woocommerce.php' ) ) ) { add_action( 'admin_notices', function() { $wc_link = sprintf( '%2$s', esc_url( 'https://woocommerce.com/' ), esc_html__( 'WooCommerce', '360-product-viewer-for-woocommerce' ) ); echo '

'; /* translators: %s: Link to the WooCommerce download page. */ printf( /* translators: %s: Link to download WooCommerce */ esc_html__( 'WP 360view plugin requires WooCommerce to be installed and active. You can download %s here.', '360-product-viewer-for-woocommerce' ), $wc_link // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ); echo '

'; } ); deactivate_plugins( plugin_basename( __FILE__ ) ); if ( isset( $_GET['activate'] ) ) unset( $_GET['activate'] ); } } add_action( 'admin_init', 'wp360view_deactivate' ); } }