'; self::install_button( $form, 'auto' ); echo ''; } } } /** * @since 4.05 * * @return void */ public static function maybe_add_to_inbox() { $forms = self::import_links(); if ( ! $forms ) { return; } $inbox = new FrmInbox(); foreach ( $forms as $form ) { $inbox->add_message( array( 'key' => $form['class'], 'subject' => 'You have new importable forms', 'message' => 'Did you know you can import your forms created in ' . esc_html( $form['name'] ) . '?', 'cta' => '' . esc_html__( 'Learn More', 'formidable' ) . '', 'icon' => 'frm_cloud_upload_solid_icon', 'type' => 'news', ) ); } } /** * @return array */ private static function import_links() { if ( ! current_user_can( 'activate_plugins' ) ) { return array(); } $forms = array(); foreach ( self::importable_forms() as $form ) { if ( class_exists( $form['class'] ) || ! is_plugin_active( $form['plugin'] ) ) { // Either the importer is installed or the source plugin isn't. continue; } $installer = new FrmInstallPlugin( array( 'plugin_file' => $form['importer'] ) ); $form['installed'] = $installer->is_installed(); $form['link'] = $installer->get_activate_link(); $forms[] = $form; } return $forms; } /** * @return string[][] */ private static function importable_forms() { return array( 'gf' => array( 'class' => 'FrmGravityImporter', 'plugin' => 'gravityforms/gravityforms.php', 'importer' => 'formidable-gravity-forms-importer/formidable-gravity-forms-importer.php', 'name' => 'Gravity Forms', 'package' => 'https://downloads.wordpress.org/plugin/formidable-gravity-forms-importer.zip', ), 'pf' => array( 'class' => 'FrmPirateImporter', 'plugin' => 'pirate-forms/pirate-forms.php', 'importer' => 'formidable-import-pirate-forms/pf-to-frm.php', 'name' => 'Pirate Forms', 'package' => 'https://downloads.wordpress.org/plugin/formidable-import-pirate-forms.zip', ), ); } private static function install_banner( $install ) { if ( empty( $install['link'] ) ) { return ''; } ?>