Overview

Packages

  • CONTENIDO
  • Core
    • Authentication
    • Backend
    • Cache
    • CEC
    • Chain
    • ContentType
    • Database
    • Debug
    • Exception
    • Frontend
      • Search
      • URI
      • Util
    • GenericDB
      • Model
    • GUI
      • HTML
    • I18N
    • LayoutHandler
    • Log
    • Security
    • Session
    • Util
    • Validation
    • Versioning
    • XML
  • Module
    • ContentRssCreator
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
    • ScriptCookieDirective
  • 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
  • cContentTypeRaw
  • cContentTypeTeaser
  • cContentTypeText
  • cTypeGenerator
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo
 1: <?php
 2: 
 3: /**
 4:  * CONTENIDO code generator factory
 5:  *
 6:  * @package    Core
 7:  * @subpackage ContentType
 8:  * @author     Murat Purc <murat@purc.de>
 9:  * @copyright  four for business AG <www.4fb.de>
10:  * @license    http://www.contenido.org/license/LIZENZ.txt
11:  * @link       http://www.4fb.de
12:  * @link       http://www.contenido.org
13:  */
14: 
15: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
16: 
17: /**
18:  * CONTENIDO code generator factory.
19:  *
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 [optional]
29:      *         The generator name, e.g. 'Standard' to retrieve instance of
30:      *         cCodeGeneratorStandard.
31:      * @throws cInvalidArgumentException
32:      *         If name is invalid, class file is missing or 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.11 API documentation generated by ApiGen 2.8.0