classes/PodsForm.php
public static function field_loader( $field_type, $file = '' ) {

		if ( isset( self::$loaded[ $field_type ] ) ) {
			$class_vars = get_class_vars( get_class( self::$loaded[ $field_type ] ) );
			// PHP 5.2.x workaround
			self::$field_group = ( isset( $class_vars['group'] ) ? $class_vars['group'] : '' );
			self::$field_type  = $class_vars['type'];

			if ( 'Unknown' !== $class_vars['label'] ) {
				return self::$loaded[ $field_type ];
			}
		}

		include_once PODS_DIR . 'classes/PodsField.php';

		$field_type = self::clean( $field_type, true, true );

		$class_name = ucfirst( $field_type );
		$class_name = "PodsField_{$class_name}";

		$content_dir   = realpath( WP_CONTENT_DIR );
		$plugins_dir   = realpath( WP_PLUGIN_DIR );
		$muplugins_dir = realpath( WPMU_PLUGIN_DIR );
		$abspath_dir   = realpath( ABSPATH );
		$pods_dir      = realpath( PODS_DIR );

		if ( ! class_exists( $class_name ) ) {
			if ( isset( self::$field_types[ $field_type ] ) && ! empty( self::$field_types[ $field_type ]['file'] ) ) {
				$file = realpath( self::$field_types[ $field_type ]['file'] );
			}

			if ( ! empty( $file ) && 0 === strpos( $file, $abspath_dir ) && file_exists( $file ) ) {
				include_once $file;
			} else {
				$file = str_replace( '../', '', apply_filters( 'pods_form_field_include', PODS_DIR . 'classes/fields/' . basename( $field_type ) . '.php', $field_type ) );
				$file = realpath( $file );

				if ( file_exists( $file ) && ( 0 === strpos( $file, $pods_dir ) || 0 === strpos( $file, $content_dir ) || 0 === strpos( $file, $plugins_dir ) || 0 === strpos( $file, $muplugins_dir ) || 0 === strpos( $file, $abspath_dir ) ) ) {
					include_once $file;
				}
			}
		}

		if ( class_exists( $class_name ) ) {
			$class = new $class_name();
		} else {
			$class      = new PodsField();
			$class_name = 'PodsField';
		}

		$class_vars = get_class_vars( $class_name );
		// PHP 5.2.x workaround
		self::$field_group = ( isset( $class_vars['group'] ) ? $class_vars['group'] : '' );
		self::$field_type  = $class_vars['type'];

		self::$loaded[ $field_type ] =& $class;

		return self::$loaded[ $field_type ];
	}
public static function field_loader( $field_type, $file = '' ) {

		if ( isset( self::$loaded[ $field_type ] ) ) {
			$class_vars = get_class_vars( get_class( self::$loaded[ $field_type ] ) );
			// PHP 5.2.x workaround
			self::$field_group = ( isset( $class_vars['group'] ) ? $class_vars['group'] : '' );
			self::$field_type  = $class_vars['type'];

			if ( 'Unknown' !== $class_vars['label'] ) {
				return self::$loaded[ $field_type ];
			}
		}

		include_once PODS_DIR . 'classes/PodsField.php';

		$field_type = self::clean( $field_type, true, true );

		$class_name = ucfirst( $field_type );
		$class_name = "PodsField_{$class_name}";

		$content_dir   = realpath( WP_CONTENT_DIR );
		$plugins_dir   = realpath( WP_PLUGIN_DIR );
		$muplugins_dir = realpath( WPMU_PLUGIN_DIR );
		$abspath_dir   = realpath( ABSPATH );
		$pods_dir      = realpath( PODS_DIR );

		if ( ! class_exists( $class_name ) ) {
			if ( isset( self::$field_types[ $field_type ] ) && ! empty( self::$field_types[ $field_type ]['file'] ) ) {
				$file = realpath( self::$field_types[ $field_type ]['file'] );
			}

			if ( ! empty( $file ) && 0 === strpos( $file, $abspath_dir ) && file_exists( $file ) ) {
				include_once $file;
			} else {
				$file = str_replace( '../', '', apply_filters( 'pods_form_field_include', PODS_DIR . 'classes/fields/' . basename( $field_type ) . '.php', $field_type ) );
				$file = realpath( $file );

				if ( file_exists( $file ) && ( 0 === strpos( $file, $pods_dir ) || 0 === strpos( $file, $content_dir ) || 0 === strpos( $file, $plugins_dir ) || 0 === strpos( $file, $muplugins_dir ) || 0 === strpos( $file, $abspath_dir ) ) ) {
					include_once $file;
				}
			}
		}

		if ( class_exists( $class_name ) ) {
			$class = new $class_name();
		} else {
			$class      = new PodsField();
			$class_name = 'PodsField';
		}

		$class_vars = get_class_vars( $class_name );
		// PHP 5.2.x workaround
		self::$field_group = ( isset( $class_vars['group'] ) ? $class_vars['group'] : '' );
		self::$field_type  = $class_vars['type'];

		self::$loaded[ $field_type ] =& $class;

		return self::$loaded[ $field_type ];
	}
public static function field_loader ( $ field_type , $ file = '' ) { if ( isset ( self :: $ loaded [ $ field_type ] ) ) { $ class_vars = get_class_vars ( get_class ( self :: $ loaded [ $ field_type ] ) ) ; // PHP 5.2.x workaround self :: $ field_group = ( isset ( $ class_vars [ 'group' ] ) ? $ class_vars [ 'group' ] : '' ) ; self :: $ field_type = $ class_vars [ 'type' ] ; if ( 'Unknown' !== $ class_vars [ 'label' ] ) { return self :: $ loaded [ $ field_type ] ; } } include_once PODS_DIR . 'classes/PodsField.php' ; $ field_type = self :: clean ( $ field_type , true , true ) ; $ class_name = ucfirst ( $ field_type ) ; $ class_name = "PodsField_{$class_name}" ; $ content_dir = realpath ( WP_CONTENT_DIR ) ; $ plugins_dir = realpath ( WP_PLUGIN_DIR ) ; $ muplugins_dir = realpath ( WPMU_PLUGIN_DIR ) ; $ abspath_dir = realpath ( ABSPATH ) ; $ pods_dir = realpath ( PODS_DIR ) ; if ( ! class_exists ( $ class_name ) ) { if ( isset ( self :: $ field_types [ $ field_type ] ) && ! empty ( self :: $ field_types [ $ field_type ] [ 'file' ] ) ) { $ file = realpath ( self :: $ field_types [ $ field_type ] [ 'file' ] ) ; } if ( ! empty ( $ file ) && 0 === strpos ( $ file , $ abspath_dir ) && file_exists ( $ file ) ) { include_once $ file ; } else { $ file = str_replace ( '../' , '' , apply_filters ( 'pods_form_field_include' , PODS_DIR . 'classes/fields/' . basename ( $ field_type ) . '.php' , $ field_type ) ) ; $ file = realpath ( $ file ) ; if ( file_exists ( $ file ) && ( 0 === strpos ( $ file , $ pods_dir ) || 0 === strpos ( $ file , $ content_dir ) || 0 === strpos ( $ file , $ plugins_dir ) || 0 === strpos ( $ file , $ muplugins_dir ) || 0 === strpos ( $ file , $ abspath_dir ) ) ) { include_once $ file ; } } } if ( class_exists ( $ class_name ) ) { $ class = new $ class_name ( ) ; } else { $ class = new PodsField ( ) ; $ class_name = 'PodsField' ; } $ class_vars = get_class_vars ( $ class_name ) ; // PHP 5.2.x workaround self :: $ field_group = ( isset ( $ class_vars [ 'group' ] ) ? $ class_vars [ 'group' ] : '' ) ; self :: $ field_type = $ class_vars [ 'type' ] ; self :: $ loaded [ $ field_type ] = & $ class ; return self :: $ loaded [ $ field_type ] ; }
Autoload a Field Type's class

@param string $field_type Field Type indentifier
@param string $file       The Field Type class file location

@return string
@access public
@static
@since 2.0.0
Autoload a Field Type s class