plugin_name = '9Map - Map Multi Locations'; $this->plugin_name = apply_filters( 'nimap_plugin_display_name', $this->plugin_name ); if ( ! class_exists( 'VillaTheme_Require_Environment' ) ) { require_once plugin_dir_path( __FILE__ ) . DIRECTORY_SEPARATOR . "includes/support.php"; } $environment = new VillaTheme_Require_Environment( [ 'plugin_name' => $this->plugin_name, 'php_version' => '7.4', 'wp_version' => '6.0', ] ); do_action( 'nimap_environment_checked', $environment, $this->plugin_name ); if ( $environment->has_error() ) { return; } $this->define(); $this->includes(); if ( get_option( 'nimap_setup_wizard' ) ) { if ( ! current_user_can( 'manage_options' ) ) { return; } $page = isset( $_GET['page'] ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended $post_type = isset( $_GET['post_type'] ) ? sanitize_text_field( wp_unslash( $_GET['post_type'] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended if ( strpos( $page, '9map' ) !== false || strpos( $post_type, 'nimap' ) !== false ) { if ( ! isset( $_GET['nimap_setup_wizard'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended $url = admin_url( '?nimap_setup_wizard=true' ); $url = add_query_arg( '_wpnonce', wp_create_nonce( 'nimap_setup_nonce' ), $url ); exit( wp_safe_redirect( $url ) );//phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } } } } public function before_woocommerce_init() { if ( class_exists( '\Automattic\WooCommerce\Utilities\FeaturesUtil' ) ) { \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true ); \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'cart_checkout_blocks', __FILE__, true ); } } protected function define() { $this->plugin_name = '9Map - Map Multi Locations'; define( 'NIMAP_DIR', plugin_dir_path( __FILE__ ) ); define( 'NIMAP_LANGUAGES', NIMAP_DIR . "languages" . DIRECTORY_SEPARATOR ); define( 'NIMAP_INCLUDES', NIMAP_DIR . "includes" . DIRECTORY_SEPARATOR ); define( 'NIMAP_ADMIN', NIMAP_INCLUDES . "admin" . DIRECTORY_SEPARATOR ); define( 'NIMAP_FRONTEND', NIMAP_INCLUDES . "frontend" . DIRECTORY_SEPARATOR ); define( 'NIMAP_TEMPLATES', NIMAP_DIR . "templates" . DIRECTORY_SEPARATOR ); define( 'NIMAP_URL', plugins_url( '', __FILE__ ) ); $plugin_url = plugins_url( 'assets/', __FILE__ ); define( 'NIMAP_ASSETS', $plugin_url . "/" ); define( 'NIMAP_CSS', $plugin_url . "css/" ); define( 'NIMAP_JS', $plugin_url . "js/" ); define( 'NIMAP_IMAGES', $plugin_url . "images/" ); } protected function includes() { $files = array( NIMAP_INCLUDES . 'nimap-data.php', NIMAP_INCLUDES . 'nimap-functions.php', NIMAP_INCLUDES . 'nimap-customize-controls.php', NIMAP_INCLUDES . 'support.php', ); foreach ( $files as $file ) { if ( file_exists( $file ) ) { require_once $file; } } villatheme_include_folder( NIMAP_ADMIN, 'NIMAP_' ); villatheme_include_folder( NIMAP_FRONTEND, 'NIMAP_' ); } public function install() { global $wp_version; if ( version_compare( $wp_version, "5.0", "<" ) ) { return; } $g_nimap_settings = get_option( 'nimap_multi_locator', array() ); if ( $g_nimap_settings && is_array( $g_nimap_settings ) && isset( $g_nimap_settings['general_api_key'] ) && ! empty( $g_nimap_settings['general_api_key'] ) ) { return; } update_option( 'nimap_setup_wizard', 1, 'no' ); } } new NIMAP_MULTI_LOCATOR();