Overview

Packages

  • Core
    • Authentication
    • Backend
    • Cache
    • CEC
    • Chain
    • ContentType
    • Database
    • Datatype
    • Debug
    • Exception
    • Frontend
      • Search
      • URI
      • Util
    • GenericDB
      • Model
    • GUI
      • HTML
    • I18N
    • LayoutHandler
    • Log
    • Security
    • Session
    • Util
    • Validation
    • Versioning
    • XML
  • Module
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationMain
    • NavigationTop
  • mpAutoloaderClassMap
  • None
  • Plugin
    • ContentAllocation
    • CronjobOverview
    • FormAssistant
    • FrontendLogic
    • FrontendUsers
    • Linkchecker
    • ModRewrite
    • Newsletter
    • Repository
      • FrontendNavigation
      • KeywordDensity
    • SearchSolr
    • SmartyWrapper
    • UrlShortener
    • UserForum
    • Workflow
  • PluginManager
  • Setup
    • Form
    • GUI
    • Helper
      • Environment
      • Filesystem
      • MySQL
      • PHP
    • UpgradeJob

Classes

  • cCodeGeneratorAbstract
  • cCodeGeneratorFactory
  • cCodeGeneratorStandard
  • cContentTypeAbstract
  • cContentTypeAbstractTabbed
  • cContentTypeDate
  • cContentTypeFilelist
  • cContentTypeHead
  • cContentTypeHtml
  • cContentTypeHtmlhead
  • cContentTypeImg
  • cContentTypeImgdescr
  • cContentTypeImgeditor
  • cContentTypeLink
  • cContentTypeLinkdescr
  • cContentTypeLinkeditor
  • cContentTypeLinktarget
  • cContentTypeTeaser
  • cContentTypeText
  • cTypeGenerator
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo
 1: <?php
 2: /**
 3:  * CONTENIDO code generator factory
 4:  *
 5:  * @package    Core
 6:  * @subpackage ContentType
 7:  * @version    SVN Revision $Rev:$
 8:  *
 9:  * @author     Murat Purc <murat@purc.de>
10:  * @copyright  four for business AG <www.4fb.de>
11:  * @license    http://www.contenido.org/license/LIZENZ.txt
12:  * @link       http://www.4fb.de
13:  * @link       http://www.contenido.org
14:  */
15: 
16: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
17: 
18: /**
19:  * CONTENIDO code generator factory.
20:  * @package    Core
21:  * @subpackage ContentType
22:  */
23: class cCodeGeneratorFactory {
24: 
25:     /**
26:      * Returns code generator instance by it's name.
27:      *
28:      * @param  string $name   The generator name, e. g. 'Standard' to retrieve instance of
29:      *                        cCodeGeneratorStandard
30:      *
31:      * @throws cInvalidArgumentException If name is invalid, class file is missing or
32:      *                                   class isn't available
33:      * @return cCodeGeneratorAbstract
34:      */
35:     public static function getInstance($name = '') {
36:         global $cfg;
37: 
38:         if ($name == '') {
39:             $name = $cfg['code_generator']['name'];
40:         }
41: 
42:         if ($name == 'Factory' || $name == 'Abstract') {
43:             throw new cInvalidArgumentException('Invalid name passed to cCodeGeneratorFactory: ' . $name . '!');
44:         }
45: 
46:         $className = 'cCodeGenerator' . $name;
47:         if (!class_exists($className)) {
48:             $fileName = $name . '.class.php';
49:             $path = str_replace('\\', '/', dirname(__FILE__)) . '/';
50:             if (!cFileHandler::exists($path . $fileName)) {
51:                 throw new cInvalidArgumentException('The classfile couldn\'t included by cCodeGeneratorFactory: ' . $name . '!');
52:             }
53: 
54:             include_once($path . $fileName);
55:             if (!class_exists($className)) {
56:                 throw new cInvalidArgumentException('The class isn\'t available for cCodeGeneratorFactory: ' . $name . '!');
57:             }
58:         }
59: 
60:         return new $className();
61:     }
62: 
63: }
64: 
CMS CONTENIDO 4.9.0 API documentation generated by ApiGen 2.8.0