$value ) { if ( array_key_exists( $key, $all_plugins ) || array_key_exists( $key, $all_themes ) ) { if ( $bws_menu_version <= $value && ( is_plugin_active( $key ) || preg_match( '|' . $key . '$|', get_template_directory() ) ) ) { if ( ! isset( $product_with_newer_menu ) ) { $product_with_newer_menu = $key; } elseif ( $bstwbsftwppdtplgns_options['bws_menu']['version_pro'][ $product_with_newer_menu ] <= $bstwbsftwppdtplgns_options['bws_menu']['version_pro'][ $key ] ) { $product_with_newer_menu = $key; } } } else { unset( $bstwbsftwppdtplgns_options['bws_menu']['version_pro'][ $key ] ); if ( function_exists( 'is_multisite' ) && is_multisite() ) { update_site_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options ); } else { update_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options ); } } } } if ( ! isset( $product_with_newer_menu ) ) { if ( $is_pro_bws_menu ) { $product_with_newer_menu = $base; } else { foreach ( $bstwbsftwppdtplgns_options['bws_menu']['version'] as $key => $value ) { if ( array_key_exists( $key, $all_plugins ) || array_key_exists( $key, $all_themes ) ) { if ( $bws_menu_version <= $value && ( is_plugin_active( $key ) || preg_match( '|' . $key . '$|', get_template_directory() ) ) ) { if ( ! isset( $product_with_newer_menu ) ) { $product_with_newer_menu = $key; } elseif ( $bstwbsftwppdtplgns_options['bws_menu']['version'][ $product_with_newer_menu ] <= $bstwbsftwppdtplgns_options['bws_menu']['version'][ $key ] ) { $product_with_newer_menu = $key; } } } else { unset( $bstwbsftwppdtplgns_options['bws_menu']['version'][ $key ] ); if ( function_exists( 'is_multisite' ) && is_multisite() ) { update_site_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options ); } else { update_option( 'bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options ); } } } } } if ( ! isset( $product_with_newer_menu ) ) { $product_with_newer_menu = $base; } $folder_with_newer_menu = explode( '/', $product_with_newer_menu ); if ( array_key_exists( $product_with_newer_menu, $all_plugins ) ) { $bws_menu_source = 'plugins'; $bws_menu_new_dir = $wp_plugins_dir . '/' . $folder_with_newer_menu[0]; } elseif ( array_key_exists( $product_with_newer_menu, $all_themes ) ) { $bws_menu_source = 'themes'; $bws_menu_new_dir = $wp_content_dir . '/themes/' . $folder_with_newer_menu[0] . '/inc'; } else { $bws_menu_new_dir = ''; } if ( file_exists( $bws_menu_new_dir . '/bws_menu/bws_functions.php' ) ) { require_once $bws_menu_new_dir . '/bws_menu/bws_functions.php'; require_once $bws_menu_new_dir . '/bws_menu/bws_menu.php'; require_once $bws_menu_new_dir . '/bws_menu/class-bws-settings.php'; } else { require_once dirname( __FILE__ ) . '/bws_menu.php'; require_once dirname( __FILE__ ) . '/bws_functions.php'; require_once dirname( __FILE__ ) . '/class-bws-settings.php'; } $bstwbsftwppdtplgns_added_menu = true; } } }