# jetformbuilder/1.1.1/includes/shortcodes/manager.php

JetFormBuilder — Dynamic Blocks Form Builder, version 1.1.1. 61 lines.

- Page: https://pluginprobe.com/plugins/jetformbuilder/1.1.1/code/includes/shortcodes/manager.php
- Raw: https://pluginprobe.com/plugins/jetformbuilder/1.1.1/raw/includes/shortcodes/manager.php
- Modified: 2021-03-11T08:51:14+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/jetformbuilder/1.1.1/code/includes/shortcodes/manager.php#L10-L20`.

```php
<?php


namespace Jet_Form_Builder\Shortcodes;


class Manager {

	private $_types;

	public static $instance = null;

	public static function instance() {
		if ( is_null( self::$instance ) ) {
			self::$instance = new self();
		}

		return self::$instance;
	}


	private function __construct() {
		$this->register_shortcodes();
	}

	private function register_shortcodes() {
		$types = array(
			new Form_Shortcode()
		);

		foreach ( $types as $type ) {
			$this->_types[ $type->get_name() ] = $type;
		}
	}

	private function get_shortcode_instance( $type ) {
		return isset( $this->_types[ $type ] ) ? $this->_types[ $type ] : false;
	}

	public static function get_shortcode( $type, $arguments ) {
		$format = '[%1$s %2$s]';

		$type = self::instance()->get_shortcode_instance( $type );

		if ( ! $type ) {
			return '';
		}

		return sprintf( $format, $type->get_name(), self::generate_arguments_string( $arguments ) );
	}

	public static function generate_arguments_string( $arguments ) {
		$response = array();

		foreach ( $arguments as $name => $value ) {
			$response[] = "$name=\"$value\"";
		}

		return implode( ' ', $response );
	}
}
```
