当前位置: 首页>>代码示例>>PHP>>正文


PHP Module::findClass方法代码示例

本文整理汇总了PHP中Module::findClass方法的典型用法代码示例。如果您正苦于以下问题:PHP Module::findClass方法的具体用法?PHP Module::findClass怎么用?PHP Module::findClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Module的用法示例。


在下文中一共展示了Module::findClass方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: compile

 protected function compile()
 {
     $objContentStart = \Database::getInstance()->prepare("SELECT * FROM tl_content WHERE pid=? AND type=? ORDER BY sorting")->limit(1)->execute($this->pid, 'formhybridStart');
     if ($objContentStart->numRows === 0) {
         return;
     }
     $objModule = \ModuleModel::findByPk($objContentStart->formhybridModule);
     if ($objModule === null) {
         return;
     }
     $objModule->refresh();
     $strClass = \Module::findClass($objModule->type);
     // Return if the class does not exist
     if (!class_exists($strClass)) {
         static::log('Module class "' . $strClass . '" (module "' . $objModule->type . '") does not exist', __METHOD__, TL_ERROR);
         return '';
     }
     $objArticle = \ArticleModel::findByPk($this->pid);
     if ($objArticle === null) {
         return;
     }
     global $objPage;
     $objModule = new $strClass($objModule, $objArticle->inColumn);
     $objModule->renderStop = true;
     $objModule->startModule = $_SESSION[FormSession::FORMHYBRID_FORMSESSION_START_KEY][$objPage->id . '_' . $objModule->formHybridDataContainer];
     $this->Template->content = $objModule->generate();
 }
开发者ID:heimrichhannot,项目名称:contao-formhybrid,代码行数:27,代码来源:ContentFormHybridStop.php

示例2: getFrontendModuleAjax

 /**
  * Generate a front end module and return it as string
  *
  * @param mixed  $intId     A module ID or a Model object
  * @param string $strColumn The name of the column
  *
  * @return string The module HTML markup
  */
 protected static function getFrontendModuleAjax($intId, $strColumn = 'main')
 {
     if (!is_object($intId) && !strlen($intId)) {
         return '';
     }
     if (is_object($intId)) {
         $objRow = $intId;
     } else {
         $objRow = \ModuleModel::findByPk($intId);
         if ($objRow === null) {
             return '';
         }
     }
     // Check the visibility (see #6311)
     if (!\Controller::isVisibleElement($objRow)) {
         return '';
     }
     $strClass = \Module::findClass($objRow->type);
     // Return if the class does not exist
     if (!class_exists($strClass)) {
         \System::log('Module class "' . $strClass . '" (module "' . $objRow->type . '") does not exist', __METHOD__, TL_ERROR);
         return '';
     }
     $objRow->typePrefix = 'mod_';
     $objModule = new $strClass($objRow, $strColumn);
     $strBuffer = AjaxInput::get('g') == '1' ? $objModule->generate() : $objModule->generateAjax();
     // HOOK: add custom logic
     if (isset($GLOBALS['TL_HOOKS']['getFrontendModule']) && is_array($GLOBALS['TL_HOOKS']['getFrontendModule'])) {
         foreach ($GLOBALS['TL_HOOKS']['getFrontendModule'] as $callback) {
             $strBuffer = \System::importStatic($callback[0])->{$callback}[1]($objRow, $strBuffer, $objModule);
         }
     }
     return $strBuffer;
 }
开发者ID:rhymedigital,项目名称:contao_rhyme_ajax,代码行数:42,代码来源:HandleLegacy.php

示例3: generate

 /**
  * Parse the template
  *
  * @return string
  */
 public function generate()
 {
     if (TL_MODE == 'FE' && !BE_USER_LOGGED_IN && ($this->invisible || $this->start > 0 && $this->start > time() || $this->stop > 0 && $this->stop < time())) {
         return '';
     }
     $objModule = \ModuleModel::findByPk($this->news_module);
     if ($objModule === null) {
         return '';
     }
     $strClass = \Module::findClass($objModule->type);
     if (!class_exists($strClass)) {
         return '';
     }
     $objModule->typePrefix = 'ce_';
     $objModule = new $strClass($objModule, $this->strColumn);
     // Overwrite spacing and CSS ID
     $objModule->origSpace = $objModule->space;
     $objModule->space = $this->space;
     $objModule->origCssID = $objModule->cssID;
     $objModule->cssID = $this->cssID;
     // Override news filter settings
     $objModule->news_filterCategories = $this->news_filterCategories;
     $objModule->news_filterDefault = $this->news_filterDefault;
     $objModule->news_filterPreserve = $this->news_filterPreserve;
     return $objModule->generate();
 }
开发者ID:hielsnoppe,项目名称:contao-test-plugin,代码行数:31,代码来源:ContentNewsFilter.php

示例4: generate

 /**
  * Parse the template
  *
  * @return string
  */
 public function generate()
 {
     if (TL_MODE == 'FE' && !BE_USER_LOGGED_IN && ($this->invisible || $this->start != '' && $this->start > time() || $this->stop != '' && $this->stop < time())) {
         return '';
     }
     $objModule = \ModuleModel::findByPk($this->module);
     if ($objModule === null) {
         return '';
     }
     $strClass = \Module::findClass($objModule->type);
     if (!class_exists($strClass)) {
         return '';
     }
     $objModule->typePrefix = 'ce_';
     /** @var Module $objModule */
     $objModule = new $strClass($objModule, $this->strColumn);
     $cssID = deserialize($objModule->cssID, true);
     // Override the CSS ID (see #305)
     if (!empty($this->cssID[0])) {
         $cssID[0] = $this->cssID[0];
     }
     // Merge the CSS classes (see #6011)
     if (!empty($this->cssID[1])) {
         $cssID[1] = trim($cssID[1] . ' ' . $this->cssID[1]);
     }
     $objModule->cssID = $cssID;
     return $objModule->generate();
 }
开发者ID:Mozan,项目名称:core-bundle,代码行数:33,代码来源:ContentModule.php

示例5: generate

 /**
  * Parse the template
  * @return string
  */
 public function generate()
 {
     if (TL_MODE == 'FE' && !BE_USER_LOGGED_IN && ($this->invisible || $this->start > 0 && $this->start > time() || $this->stop > 0 && $this->stop < time())) {
         return '';
     }
     $objModule = \ModuleModel::findByPk($this->module);
     if ($objModule === null) {
         return '';
     }
     $strClass = \Module::findClass($objModule->type);
     if (!class_exists($strClass)) {
         return '';
     }
     $objModule->typePrefix = 'ce_';
     $objModule = new $strClass($objModule, $this->strColumn);
     // create new cssID array
     $cssID = array();
     // set the ID
     $cssID[0] = $this->cssID[0] ?: $objModule->cssID[0];
     // merge the classes
     $arrElementClasses = explode(' ', $this->cssID[1]);
     $arrModuleClasses = explode(' ', $objModule->cssID[1]);
     $cssID[1] = implode(' ', array_unique(array_merge($arrModuleClasses, $arrElementClasses)));
     // Overwrite spacing and CSS ID
     $objModule->space = $this->space;
     $objModule->cssID = $cssID;
     return $objModule->generate();
 }
开发者ID:fritzmg,项目名称:contao-mergecssclasses,代码行数:32,代码来源:ContentModuleMerged_C32.php

示例6: getPossibleFilterOptions

 public function getPossibleFilterOptions($objModule)
 {
     \Controller::loadDataContainer('tl_calendar_events');
     $arrOptions = array();
     $arrFields = deserialize($objModule->formHybridEditable, true);
     // Return if there are no fields
     if (!is_array($arrFields) || empty($arrFields)) {
         return $arrOptions;
     }
     $strClass = \Module::findClass($objModule->type);
     if (class_exists($strClass)) {
         $objFilterModule = new $strClass($objModule);
         $arrOptions = $objFilterModule->getFilterOptions();
     }
     return $arrOptions;
 }
开发者ID:heimrichhannot,项目名称:contao-calendar_plus,代码行数:16,代码来源:EventsPlus.php

示例7: parseTemplate

 /**
  * Add the html attribute to allowed elements
  *
  * @param \Template $objTemplate
  */
 public function parseTemplate($objTemplate)
 {
     if (!$objTemplate instanceof \FrontendTemplate || !$objTemplate->allowAjaxReload) {
         return;
     }
     // Determine whether we have a module or a content element by the vars given at this point
     if (\Module::findClass($objTemplate->type)) {
         $strType = 'mod';
     } elseif (\ContentElement::findClass($objTemplate->type)) {
         $strType = 'ce';
     } else {
         return;
     }
     // Some elements use the auto_item which we need to pass
     $strAutoItem = Input::getAutoItem('auto_item');
     // cssID is parsed in all common templates
     // Use cssID for our attribute
     $objTemplate->cssID .= sprintf(' data-ajax-reload-element="%s::%u"%s%s', $strType, $objTemplate->id, strlen($strAutoItem) ? sprintf(' data-ajax-reload-auto-item="%s"', $strAutoItem) : '', $objTemplate->ajaxReloadFormSubmit ? ' data-ajax-reload-form-submit=""' : '');
 }
开发者ID:richardhj,项目名称:contao-ajax_reload_element,代码行数:24,代码来源:AjaxReloadElement.php

示例8: generate

 /**
  * {@inheritDoc}
  */
 public function generate()
 {
     $objModule = \ModuleModel::findByPk($this->module);
     if ($objModule === null || !static::isVisibleElement($objModule)) {
         return '';
     }
     $strClass = \Module::findClass($objModule->type);
     if (!class_exists($strClass)) {
         return '';
     }
     $objModule->typePrefix = 'ce_';
     /** @var \Module $objModule */
     $objModule = new $strClass($objModule, $this->strColumn);
     // Overwrite spacing and CSS ID
     $objModule->origSpace = $objModule->space;
     $objModule->space = $this->space;
     $objModule->origCssID = $objModule->cssID;
     $objModule->cssID = $this->cssID;
     return $objModule->generate();
 }
开发者ID:netzmacht,项目名称:contao-i18n,代码行数:23,代码来源:ContentModule.php

示例9: generate

 /**
  * Parse the template
  * @return string
  */
 public function generate()
 {
     if (TL_MODE == 'FE' && !BE_USER_LOGGED_IN && ($this->invisible || $this->start != '' && $this->start > time() || $this->stop != '' && $this->stop < time())) {
         return '';
     }
     $objModule = \ModuleModel::findByPk($this->module);
     if ($objModule === null) {
         return '';
     }
     $strClass = \Module::findClass($objModule->type);
     if (!class_exists($strClass)) {
         return '';
     }
     $objModule->typePrefix = 'ce_';
     $objModule = new $strClass($objModule, $this->strColumn);
     // Overwrite spacing and CSS ID
     $objModule->space = $this->space;
     $objModule->cssID = $this->cssID;
     return $objModule->generate();
 }
开发者ID:iCodr8,项目名称:core,代码行数:24,代码来源:ContentModule.php

示例10: renderModule

 protected function renderModule($objChild)
 {
     $objModule = \ModuleModel::findByPK($objChild->module);
     if ($objModule === null) {
         return '';
     }
     if (!\Controller::isVisibleElement($objModule)) {
         return '';
     }
     $strClass = \Module::findClass($objModule->type);
     if (!class_exists($strClass)) {
         $this->log('Module class "' . $GLOBALS['FE_MOD'][$objModule->type] . '" (module "' . $objModule->type . '") does not exist', 'ModuleBlock renderModule()', TL_ERROR);
         return '';
     }
     $objModule->typePrefix = 'mod_';
     if (!$objChild->addWrapper) {
         $objModule = $this->overrideCommonProps($objModule, $objChild);
     }
     $objModule = new $strClass($objModule);
     return $objModule->generate();
 }
开发者ID:heimrichhannot,项目名称:contao-blocks,代码行数:21,代码来源:ModuleBlock.php

示例11: generate

 public function generate()
 {
     // TODO ???  Print the article as PDF
     /*  if (isset($_GET['pdf'])  && \Input::get('pdf') == $this->objModel->id)
     		{
     			// Backwards compatibility
     			if ($this->objModel->printable == 1)
     			{
     				$objArticle = new \ModuleArticle($objRow);
     				$objArticle->generatePdf();
     			}
     			elseif ($this->objModel->printable != '')
     			{
     				$options = deserialize($objRow->printable);
     
     				if (is_array($options) && in_array('pdf', $options))
     				{
     					$objArticle = new \ModuleArticle($this->objModel);
     					$objArticle->generatePdf();
     				}
     			}
         	} //*/
     // Export iCal
     if (strlen(\Input::get('ical'))) {
         $this->generateIcal(\Input::get('ical'));
         return;
     }
     // PDF
     if (strlen(\Input::get('pdf'))) {
         \Input::setGet("pdf", false);
         // prevent endless loops, because of generate
         $strClass = \Module::findClass($this->objModel->type);
         if (!class_exists($strClass)) {
             return;
         }
         $objModule = new $strClass($this->objModel);
         $this->strItem = $objModule->generate();
         $this->generatePdf();
     }
     // Render share buttons
     $this->Template = new \FrontendTemplate($this->strTemplate);
     $this->Template->setData($this->arrData);
     $this->compile();
     // Do not change this order (see #6191)
     $this->Template->style = !empty($this->arrStyle) ? implode(' ', $this->arrStyle) : '';
     $this->Template->class = trim('share share_' . $this->type . ' ' . $this->cssID[1]);
     $this->Template->cssID = $this->cssID[0] != '' ? ' id="' . $this->cssID[0] . '"' : '';
     return $this->Template->parse();
 }
开发者ID:heimrichhannot,项目名称:contao-share,代码行数:49,代码来源:Share.php

示例12: findFrontendModule

 /**
  * Find a front end module in the FE_MOD array and return the class name
  *
  * @param string $strName The front end module name
  *
  * @return string The class name
  *
  * @deprecated Use Module::findClass() instead
  */
 public static function findFrontendModule($strName)
 {
     return \Module::findClass($strName);
 }
开发者ID:StephenGWills,项目名称:sample-contao-app,代码行数:13,代码来源:Controller.php

示例13: templates

 public function templates($obj)
 {
     $template = $obj->getName();
     switch ($template) {
         case 'fe_page':
         case 'fe_page_multitoggle':
             //custom
             $obj->setName($template . '_gc');
             //gc = grid controll only
             $obj->__get("layout")->__set("gridCSS", (array) $this->getGridArr($obj->layout));
             break;
         case 'form':
             $obj->setName($template . '_' . \Config::get('co_grid_prefix'));
             break;
         default:
     }
     // `-,-´ ContentElements
     if ($obj->__get('typePrefix') == 'ce_' && strpos($template, 'ce_row_start') === FALSE) {
         $strClass = $this->findContentElement($obj->__get('type'));
         if ($strClass !== NULL && $strClass != '') {
             $objModel = \ContentModel::findBy('id', $obj->__get('id'));
             if ($objModel !== NULL) {
                 $objEl = new $strClass($objModel);
                 $objEl = $this->design_elements($objEl);
                 $obj->__set('ftc_classes', $objEl->ftc_classes);
                 $obj->__set('ftcID', $objEl->ftcID);
                 $obj->__set('data_attr', $this->splitArr($objEl->data_attr));
                 $obj->__set('class', $objEl->ftc_classes);
                 $obj->__set('cssID', $objEl->ftcID);
             }
         }
     }
     if (strpos($template, 'ce_row_start') !== FALSE) {
         $obj->__set('row_data_attr_ftc', $this->splitArr($obj->row_data_attr_ftc));
     }
     // `-,-´ Article
     if (strpos($template, 'mod_article') !== FALSE) {
         $objModel = \ArticleModel::findBy('id', $obj->__get('id'));
         if ($objModel !== NULL) {
             $objEl = new \ModuleArticle($objModel);
             $objEl = $this->design_articles($objEl);
             $obj->__set('class', '' . $objEl->ftc_classes);
             $obj->__set('cssID', $objEl->ftcID . ' ');
             //.$objEl->data_attr.' '
         }
     }
     // `-,-´ Module
     if ($obj->__get('typePrefix') == 'mod_') {
         $strClass = \Module::findClass($obj->__get('type'));
         if ($strClass !== NULL && $strClass != '') {
             $objModel = \ModuleModel::findBy('id', $obj->__get('id'));
             if ($objModel !== NULL) {
                 $objEl = new $strClass($objModel);
                 $co_grid = $this->design_modules($objEl);
                 $obj->__set('class', $co_grid['class'] . ' ' . $co_grid['co_grid_classes']);
                 // $obj->__set('cssID',$co_grid['ftcID'].' '.$co_grid['data_attr'].' ');
                 $obj->__set('ftc_classes', $co_grid['class'] . ' ' . $co_grid['co_grid_classes']);
                 $obj->__set('ftcID', $co_grid['ftcID'] . ' ');
                 $obj->__set('ftc_data_attr', $co_grid['data_attr']);
             }
         }
     }
 }
开发者ID:designs2,项目名称:codeowl_grid_control,代码行数:63,代码来源:OutputGridVars.php

示例14: getPageFrontendModule

 /**
  * Generate a front end module and return it as HTML string.
  *
  * @param int
  * @param string
  *
  * @return string
  */
 protected function getPageFrontendModule($page, $moduleId, $columnName = 'main', $inheritableOnly = false)
 {
     if (!is_object($moduleId) && !strlen($moduleId)) {
         return '';
     }
     // Articles
     if ($moduleId == 0) {
         // Show a particular article only
         if ($page->type == 'regular' && \Input::get('articles')) {
             list($sectionName, $articleName) = explode(':', \Input::get('articles'));
             if ($articleName === null) {
                 $articleName = $sectionName;
                 $sectionName = 'main';
             }
             if ($sectionName == $columnName) {
                 $article = \ArticleModel::findByIdOrAliasAndPid($articleName, $page->id);
                 // Send a 404 header if the article does not exist
                 if ($article === null) {
                     // Do not index the page
                     $page->noSearch = 1;
                     $page->cache = 0;
                     header('HTTP/1.1 404 Not Found');
                     return '<p class="error">' . sprintf($GLOBALS['TL_LANG']['MSC']['invalidPage'], $articleName) . '</p>';
                 }
                 if (!$inheritableOnly || $article->inheritable) {
                     // Add the "first" and "last" classes (see #2583)
                     $article->classes = array('first', 'last');
                     return $this->getArticle($article);
                 }
                 return '';
             }
         }
         // HOOK: trigger the article_raster_designer extension
         if (in_array('article_raster_designer', \ModuleLoader::getActive())) {
             return \RasterDesigner::load($page->id, $columnName);
         }
         // Show all articles (no else block here, see #4740)
         $articleCollection = \ArticleModel::findPublishedByPidAndColumn($page->id, $columnName);
         if ($articleCollection === null) {
             return '';
         }
         $return = '';
         $intCount = 0;
         $blnMultiMode = $articleCollection->count() > 1;
         $intLast = $articleCollection->count() - 1;
         while ($articleCollection->next()) {
             if ($inheritableOnly && !$articleCollection->inheritable) {
                 continue;
             }
             $articleRow = $articleCollection->current();
             // Add the "first" and "last" classes (see #2583)
             if ($intCount == 0 || $intCount == $intLast) {
                 $cssClasses = array();
                 if ($intCount == 0) {
                     $cssClasses[] = 'first';
                 }
                 if ($intCount == $intLast) {
                     $cssClasses[] = 'last';
                 }
                 $articleRow->classes = $cssClasses;
             }
             $return .= $this->getArticle($articleRow, $blnMultiMode, false, $columnName);
             ++$intCount;
         }
         return $return;
     } else {
         if (is_object($moduleId)) {
             $articleRow = $moduleId;
         } else {
             $articleRow = \ModuleModel::findByPk($moduleId);
             if ($articleRow === null) {
                 return '';
             }
         }
         // Check the visibility (see #6311)
         if (!static::isVisibleElement($articleRow)) {
             return '';
         }
         $moduleClassName = \Module::findClass($articleRow->type);
         // Return if the class does not exist
         if (!class_exists($moduleClassName)) {
             $this->log('Module class "' . $moduleClassName . '" (module "' . $articleRow->type . '") does not exist', __METHOD__, TL_ERROR);
             return '';
         }
         $articleRow->typePrefix = 'mod_';
         /** @var \Module $module */
         $module = new $moduleClassName($articleRow, $columnName);
         $buffer = $module->generate();
         // HOOK: add custom logic
         if (isset($GLOBALS['TL_HOOKS']['getFrontendModule']) && is_array($GLOBALS['TL_HOOKS']['getFrontendModule'])) {
             foreach ($GLOBALS['TL_HOOKS']['getFrontendModule'] as $callback) {
                 $this->import($callback[0]);
//.........这里部分代码省略.........
开发者ID:bit3,项目名称:contao-merger2,代码行数:101,代码来源:ModuleMerger2.php


注:本文中的Module::findClass方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。