/home/coolpkct/www/websites/cake3.cool.rocks/admin/classes/fieldfactory.php
<?php
/**
 * Part of Showkase web site management package
 *
 * @package Showkase
 * @author Jack Hardie {@link http://www.jhardie.com}
 * @copyright Copyright (c) 2012, SimpleViewer Inc.
 */
defined('SK_ACCESS')||die('<h1>403: Forbidden</h1>');

/**
 * Gallery factory class
 *
 * @access public
 * @package Showkase
 */
Class FieldFactory
{
    /**
     * Creates field object
     *
     * @access public
     * @param array with same structure as an ini file entry
     * 
     * @return object gallery object
     */
    public static function make($iniVars)
    {
        $type =  isset($iniVars['type']) ? $iniVars['type'] : 'text';
        $class = ucfirst($type).'Field';
        if (include_once 'classes'.DIRECTORY_SEPARATOR.strtolower($type).'field.php') {
            return new $class($iniVars);
        }
        throw new Exception('FieldFactory cannot recognise the field type: <i>'.$class.'</i>');
    }
}