get_namespace_prefix(); $builders = $this->get_builders(); foreach ($builders as $builder) { $class_name = str_replace('-', ' ', $builder); $class_name = str_replace(' ', '', ucwords($class_name)); $class_name = $modules_namespace_prefix . '\\Widgets\\' . $class_name . '\Manager'; $this->widgets[$builder] = $class_name::instance(); } } /** * Retrieves a list of builders available within WordPress, including Oxygen if enabled. * * @return array An array containing the list of available builders. * @since Unknown */ public function get_builders() { $selected_builder = Wpfnl_functions::get_builder_type(); $builder = array(); $oxygen_capability = Wpfnl_functions::oxygen_builder_version_capability(); if ('oxygen' === $selected_builder && $oxygen_capability){ array_push($builder,'oxygen'); }elseif ('divi-builder' === $selected_builder ){ if ( Wpfnl_functions::is_divi5_active() ) { array_push($builder,'diviModulesV5'); } else { array_push($builder,'diviModules'); } }elseif ('elementor' === $selected_builder ){ array_push($builder,'elementor'); }elseif ( 'bricks' === $selected_builder && 'bricks' === wp_get_theme()->template ){ array_push($builder,'bricks'); }elseif ('gutenberg' === $selected_builder ){ array_push($builder,'gutenberg'); } return apply_filters('wpfunnels/builders',$builder); } /** * Retrieves MailMint forms' IDs and titles. * * @return array An array containing MailMint forms' IDs and titles. * @since 2.8.15 */ public static function get_mailmint_forms() { $mailmint_forms = method_exists( 'Mint\MRM\DataBase\Models\FormModel', 'get_all_id_title' ) ? \Mint\MRM\DataBase\Models\FormModel::get_all_id_title() : []; if ( is_array( $mailmint_forms ) && !empty( $mailmint_forms[ 'data' ] ) ) { foreach( $mailmint_forms[ 'data' ] as $form ) { if ( !empty( $form[ 'id' ] ) && !empty( $form[ 'title' ] ) ) { $forms[ $form[ 'id' ] ] = $form[ 'title' ]; } } } return $forms ?? []; } /** * Renders a Mail Mint form based on the provided form ID. * * This protected function checks for the existence of the \Mint\MRM\Internal\ShortCode\ContactForm class and utilizes it to render the content of a Mail Mint form specified by the provided form ID. * * @param string|int $form_id Represents the unique identifier of the Mail Mint form to be rendered. * @param array $options Represents widget settings. * * @return void Outputs the rendered content of the Mail Mint form or an empty string if rendering fails. * @since 2.8.15 */ public static function render_mailmint_form( $form_id, $options = [] ) { if ( class_exists( '\Mint\MRM\Internal\ShortCode\ContactForm' ) ) { $mailmint_contact_form = new \Mint\MRM\Internal\ShortCode\ContactForm( [] ); ob_start(); echo method_exists( $mailmint_contact_form, 'render_content' ) ? $mailmint_contact_form->render_content( $form_id ) : ''; $mailmint_form = ob_get_clean(); $replace = 'id="mrm-form">'; $replace .= ''; $replace .= !empty( $options[ 'admin_email' ] ) ? '' : ''; $replace .= !empty( $options[ 'admin_email_subject' ] ) ? '' : ''; $replace .= !empty( $options[ 'notification_text' ] ) ? '' : ''; $replace .= !empty( $options[ 'other_action' ] ) ? '' : ''; $replace .= !empty( $options[ 'redirect_url' ] ) ? '' : ''; $replace .= !empty( $options[ 'data_to_checkout' ] ) && 'on' === $options[ 'data_to_checkout' ] ? '' : ''; $replace .= !empty( $options[ 'register_as_subscriber' ] ) && 'on' === $options[ 'register_as_subscriber' ] ? '' : ''; echo str_replace( 'id="mrm-form">', $replace, $mailmint_form ); } } }