networkLicense->isActive() ) { global $submenu; $submenu[ $this->pageSlug ][] = [ '' . esc_html__( 'Add License Key', 'aioseo-pro' ) . '', apply_filters( 'aioseo_manage_seo', 'aioseo_manage_seo' ), esc_url( network_admin_url( 'admin.php?page=aioseo-settings' ) ) ]; } } /** * Add options to the network new site form. * * @since 4.2.5 * * @return void */ public function newSiteForm() { aioseo()->templates->getTemplate( 'admin/add-network-site.php' ); } /** * When the form is submitted, check if we should clone SEO settings for the new site. * * @since 4.2.5 * * @param \WP_Site $site The new site. * @return void */ public function cloneSeoSettings( $site ) { // A few preliminary failsafes. if ( ! isset( $_REQUEST['action'] ) || 'add-site' !== $_REQUEST['action'] || empty( $_POST['aioseo-import-site'] ) ) { return; } // Copied from the add new site settings. check_admin_referer( 'add-blog', '_wpnonce_add-blog' ); // Get the blog ID of the site we want to import data from. $seoSettingsBlogId = intval( wp_unslash( $_POST['aioseo-import-site'] ) ); // Switch to the blog to grab the options from. aioseo()->helpers->switchToBlog( $seoSettingsBlogId ); // Grab the options. $options = aioseo()->options->all(); $dynamicOptions = aioseo()->dynamicOptions->all(); // Switch to the new site. aioseo()->helpers->restoreCurrentBlog(); aioseo()->helpers->switchToBlog( (int) $site->blog_id ); // Save the options! aioseo()->options->sanitizeAndSave( $options ); aioseo()->dynamicOptions->sanitizeAndSave( $dynamicOptions ); // Switch back to the original network one before going on. aioseo()->helpers->restoreCurrentBlog(); } /** * Drop blog tables when a blog is deleted. * * @since 4.2.5 * * @param array $tables An array of WP tables to drop. * @return array An array of tables (including our own). */ public function dropTables( $tables ) { $tables = array_merge( aioseo()->core->getDbTables(), $tables ); return $tables; } }