本文整理汇总了PHP中ContentElement类的典型用法代码示例。如果您正苦于以下问题:PHP ContentElement类的具体用法?PHP ContentElement怎么用?PHP ContentElement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ContentElement类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: generate
/**
* Display a wildcard in the back end
* @return string
*/
public function generate()
{
$objElement = $this->Database->prepare("SELECT * FROM `tl_content` WHERE id = ?")->limit(1)->execute($this->id);
$strAdditional = '';
if ($this->sh5_additional) {
foreach (deserialize($this->sh5_additional) as $arrAdditional) {
if ($arrAdditional['property']) {
$strAdditional .= ' ' . $arrAdditional['property'] . (strlen($arrAdditional['value']) > 0 ? '="' . specialchars($arrAdditional['value']) . '"' : '');
}
}
}
$this->sh5_additional = $strAdditional;
if (TL_MODE == 'BE') {
$objTemplate = new BackendTemplate('be_wildcard');
$objTemplate->wildcard = vsprintf("<%s%s%s%s>", array(($this->sh5_tag == 'end' ? '/' : '') . $objElement->sh5_type, $this->sh5_tag == 'start' && strlen($this->cssID[0]) ? ' id="' . $this->cssID[0] . '"' : '', $this->sh5_tag == 'start' && strlen($this->cssID[1]) ? ' class="' . $this->cssID[1] . '"' : '', $this->sh5_additional));
$strReturn = $objTemplate->parse();
// Add script to toggle wrong wrapper class in backend
$strReturn .= $this->sh5_tag == 'end' && version_compare(VERSION, 3, '>=') ? '<script>
if(document.getElementById("li_' . $this->id . '")) {
var elem = document.getElementById("li_' . $this->id . '").firstElementChild;
elem.className = elem.className.replace("wrapper_start", "wrapper_stop");
}
</script>' : '';
// Add script to remove all indent classes as quick workaround
$strReturn .= version_compare(VERSION, 3, '>=') ? '<script>
var el = document.getElementById("li_' . $this->id . '");
if(el) {
var elem = el.firstElementChild;
elem.className = elem.className.replace(" indent ", "");
}
</script>' : '';
return $strReturn;
}
return parent::generate();
}
开发者ID:menatwork,项目名称:semantic_html5,代码行数:39,代码来源:SemanticHTML5.php
示例2: generate
/**
* generate function.
*
* @access public
* @return void
*/
public function generate()
{
// Set Pa2 Type
$this->pa2type = 'CE';
// Deserialize vars
$this->groups = deserialize($this->groups);
$this->pa2ImagesMetaFields = deserialize($this->pa2ImagesMetaFields);
$this->pa2TimeFilterStart = deserialize($this->pa2TimeFilterStart);
$this->pa2TimeFilterEnd = deserialize($this->pa2TimeFilterEnd);
// Set true and false on checkboxes
$this->pa2ImagesShowHeadline = $this->pa2ImagesShowHeadline == 1 ? true : false;
$this->pa2ImagesShowTitle = $this->pa2ImagesShowTitle == 1 ? true : false;
$this->pa2ImagesShowTeaser = $this->pa2ImagesShowTeaser == 1 ? true : false;
if (TL_MODE == 'BE') {
$this->pa2ImagesShowHeadline = false;
$this->pa2ImagesShowTitle = false;
$this->pa2ImagesShowTeaser = false;
$this->pa2ImagesPerRow = 1;
$this->pa2ImagesPerPage = 0;
$this->pa2NumberOfImages = 0;
$this->pa2ImagesImageSize = serialize(array(50, 31, 'center_center'));
$this->pa2ImagesImageMargin = serialize(array('bottom' => 6, 'left' => '', 'right' => 6, 'top' => '', 'unit' => 'px'));
}
return parent::generate();
}
开发者ID:craffft,项目名称:contao-photoalbums2,代码行数:31,代码来源:ContentPhotoalbums2.php
示例3: generate
/**
* Display a wildcard in the back end
* @return string
*/
public function generate()
{
$this->strSet = $GLOBALS['TL_CONFIG']['subcolumns'] ? $GLOBALS['TL_CONFIG']['subcolumns'] : 'yaml3';
if (TL_MODE == 'BE') {
$arrColor = unserialize($this->sc_color);
if (!$GLOBALS['TL_SUBCL'][$this->strSet]['files']['css']) {
$this->Template = new \BackendTemplate('be_subcolumns');
$this->Template->setColor = $this->compileColor($arrColor);
$this->Template->colsetTitle = '### COLUMNSET START ' . $this->sc_type . ' <strong>' . $this->sc_name . '</strong> ###';
return $this->Template->parse();
}
$GLOBALS['TL_CSS']['subcolumns'] = 'system/modules/Subcolumns/assets/be_style.css';
$GLOBALS['TL_CSS']['subcolumns_set'] = $GLOBALS['TL_SUBCL'][$this->strSet]['files']['css'];
$arrColset = $GLOBALS['TL_SUBCL'][$this->strSet]['sets'][$this->sc_type];
$strSCClass = $GLOBALS['TL_SUBCL'][$this->strSet]['scclass'];
$blnInside = $GLOBALS['TL_SUBCL'][$this->strSet]['inside'];
$intCountContainers = count($GLOBALS['TL_SUBCL'][$this->strSet]['sets'][$this->sc_type]);
$strMiniset = '<div class="colsetexample final ' . $strSCClass . '">';
for ($i = 0; $i < $intCountContainers; $i++) {
$arrPresentColset = $arrColset[$i];
$strMiniset .= '<div class="' . $arrPresentColset[0] . '">' . ($blnInside ? '<div class="' . $arrPresentColset[1] . '">' : '') . ($i + 1) . ($blnInside ? '</div>' : '') . '</div>';
}
$strMiniset .= '</div>';
$this->Template = new \BackendTemplate('be_subcolumns');
$this->Template->setColor = $this->compileColor($arrColor);
$this->Template->colsetTitle = '### COLUMNSET START ' . $this->sc_type . ' <strong>' . $this->sc_name . '</strong> ###';
$this->Template->visualSet = $strMiniset;
return $this->Template->parse();
}
return parent::generate();
}
开发者ID:felixpfeiffer,项目名称:subcolumns,代码行数:35,代码来源:colsetEnd.php
示例4: __construct
/**
* @param $objElement
* @param string $strColumn
*/
public function __construct($objElement, $strColumn = 'main')
{
parent::__construct($objElement, $strColumn);
$this->arrData = new Attributes($this->arrData);
$this->arrData->registerNamespaceAttributes($this->arrBootstrapAttributes);
$this->cssDefinitioin = $this->cssID;
}
开发者ID:netzmacht,项目名称:contao-bootstrap,代码行数:11,代码来源:BootstrapAbstract.php
示例5: generate
/**
* Extend the parent method
* @return string
*/
public function generate()
{
if ($this->playerSRC == '') {
return '';
}
$source = deserialize($this->playerSRC);
if (!is_array($source) || empty($source)) {
return '';
}
$objFiles = \FilesModel::findMultipleByIdsAndExtensions($source, array('mp4', 'm4v', 'mov', 'wmv', 'webm', 'ogv', 'm4a', 'mp3', 'wma', 'mpeg', 'wav'));
if ($objFiles === null) {
return '';
}
// Display a list of files in the back end
if (TL_MODE == 'BE') {
$return = '<ul>';
while ($objFiles->next()) {
$objFile = new \File($objFiles->path);
$return .= '<li><img src="system/themes/' . $this->getTheme() . '/images/' . $objFile->icon . '" width="18" height="18" alt="" class="mime_icon"> <span>' . $objFile->name . '</span> <span class="size">(' . $this->getReadableSize($objFile->size) . ')</span></li>';
}
return $return . '</ul>';
}
$this->objFiles = $objFiles;
return parent::generate();
}
开发者ID:rikaix,项目名称:core,代码行数:29,代码来源:ContentMedia.php
示例6: generate
/**
* Return if there are no files
*
* @return string
*/
public function generate()
{
if ($this->playerSRC == '') {
return '';
}
$source = \StringUtil::deserialize($this->playerSRC);
if (!is_array($source) || empty($source)) {
return '';
}
$objFiles = \FilesModel::findMultipleByUuidsAndExtensions($source, array('mp4', 'm4v', 'mov', 'wmv', 'webm', 'ogv', 'm4a', 'mp3', 'wma', 'mpeg', 'wav', 'ogg'));
if ($objFiles === null) {
return '';
}
// Display a list of files in the back end
if (TL_MODE == 'BE') {
$return = '<ul>';
while ($objFiles->next()) {
$objFile = new \File($objFiles->path);
$return .= '<li>' . \Image::getHtml($objFile->icon, '', 'class="mime_icon"') . ' <span>' . $objFile->name . '</span> <span class="size">(' . $this->getReadableSize($objFile->size) . ')</span></li>';
}
return $return . '</ul>';
}
$this->objFiles = $objFiles;
return parent::generate();
}
开发者ID:contao,项目名称:core-bundle,代码行数:30,代码来源:ContentMedia.php
示例7: generate
public function generate()
{
if (!empty($GLOBALS['SLICKMAP']['CSS'])) {
$GLOBALS['TL_CSS'][] = $GLOBALS['SLICKMAP']['CSS'];
}
return parent::generate();
}
开发者ID:4t2,项目名称:slickmap,代码行数:7,代码来源:SlickMap.php
示例8: generate
/**
* Parse the template
* @return string
*/
public function generate()
{
if (TL_MODE == 'BE' && !defined('NEWSLETTER_CONTENT_PREVIEW')) {
return 'NEWSLETTER ROW BREAK';
}
return parent::generate();
}
开发者ID:davidenke,项目名称:newsletter_content,代码行数:11,代码来源:ContentBreakRow.php
示例9: generate
public function generate()
{
if (TL_MODE == 'BE') {
return '';
}
return parent::generate();
}
开发者ID:heimrichhannot,项目名称:contao-formhybrid,代码行数:7,代码来源:ContentFormHybridStop.php
示例10: __construct
public function __construct($rowDefintion)
{
parent::__construct($rowDefintion);
foreach ($rowDefintion['data'] as $cellDefintion) {
$this->data[] = new Cell($cellDefintion);
}
}
开发者ID:wasabi-cms,项目名称:cms,代码行数:7,代码来源:Row.php
示例11: generate
/**
* Return if the file does not exist
*
* @return string
*/
public function generate()
{
// Return if there is no file
if ($this->singleSRC == '') {
return '';
}
$objFile = \FilesModel::findByUuid($this->singleSRC);
if ($objFile === null) {
if (!\Validator::isUuid($this->singleSRC)) {
return '<p class="error">' . $GLOBALS['TL_LANG']['ERR']['version2format'] . '</p>';
}
return '';
}
$allowedDownload = trimsplit(',', strtolower(\Config::get('allowedDownload')));
// Return if the file type is not allowed
if (!in_array($objFile->extension, $allowedDownload)) {
return '';
}
$file = \Input::get('file', true);
// Send the file to the browser and do not send a 404 header (see #4632)
if ($file != '' && $file == $objFile->path) {
\Controller::sendFileToBrowser($file);
}
$this->singleSRC = $objFile->path;
return parent::generate();
}
开发者ID:bytehead,项目名称:contao-core,代码行数:31,代码来源:ContentDownload.php
示例12: generate
/**
* Return if there are no files
* @return string
*/
public function generate()
{
// Use the home directory of the current user as file source
if ($this->useHomeDir && FE_USER_LOGGED_IN) {
$this->import('FrontendUser', 'User');
if ($this->User->assignDir && is_dir(TL_ROOT . '/' . $this->User->homeDir)) {
$this->multiSRC = array($this->User->homeDir);
}
} else {
$this->multiSRC = deserialize($this->multiSRC);
}
// Return if there are no files
if (!is_array($this->multiSRC) || empty($this->multiSRC)) {
return '';
}
// Check for version 3 format
if (!is_numeric($this->multiSRC[0])) {
return '<p class="error">' . $GLOBALS['TL_LANG']['ERR']['version2format'] . '</p>';
}
// Get the file entries from the database
$this->objFiles = \FilesModel::findMultipleByIds($this->multiSRC);
if ($this->objFiles === null) {
return '';
}
return parent::generate();
}
开发者ID:rikaix,项目名称:core,代码行数:30,代码来源:ContentGallery.php
示例13: generate
/**
* Return if there are no files
*
* @return string
*/
public function generate()
{
// Use the home directory of the current user as file source
if ($this->useHomeDir && FE_USER_LOGGED_IN) {
$this->import('FrontendUser', 'User');
if ($this->User->assignDir && $this->User->homeDir) {
$this->multiSRC = array($this->User->homeDir);
}
} else {
$this->multiSRC = deserialize($this->multiSRC);
}
// Return if there are no files
if (!is_array($this->multiSRC) || empty($this->multiSRC)) {
return '';
}
// Get the file entries from the database
$this->objFiles = \FilesModel::findMultipleByUuids($this->multiSRC);
if ($this->objFiles === null) {
if (!\Validator::isUuid($this->multiSRC[0])) {
return '<p class="error">' . $GLOBALS['TL_LANG']['ERR']['version2format'] . '</p>';
}
return '';
}
$file = \Input::get('file', true);
// Send the file to the browser and do not send a 404 header (see #4632)
if ($file != '' && !preg_match('/^meta(_[a-z]{2})?\\.txt$/', basename($file))) {
while ($this->objFiles->next()) {
if ($file == $this->objFiles->path || dirname($file) == $this->objFiles->path) {
\Controller::sendFileToBrowser($file);
}
}
$this->objFiles->reset();
}
return parent::generate();
}
开发者ID:StephenGWills,项目名称:sample-contao-app,代码行数:40,代码来源:ContentDownloads.php
示例14: generate
/**
* Return if the image does not exist
* @return string
*/
public function generate()
{
if (!strlen($this->singleSRC) || !is_file(TL_ROOT . '/' . $this->singleSRC)) {
return '';
}
return parent::generate();
}
开发者ID:Juuro,项目名称:Dreamapp-Website,代码行数:11,代码来源:ContentImage.php
示例15: __construct
/**
* Initialize the object
* @param object
* @param string
*/
public function __construct($objElement, $strColumn = 'main')
{
parent::__construct($objElement, $strColumn);
if ($this->customTpl != '') {
$this->strTemplate = $this->customTpl;
}
}
开发者ID:davidenke,项目名称:newsletter_content,代码行数:12,代码来源:ContentBoundaries.php
示例16: generate
/**
* Parse the template
* @return string
*/
public function generate()
{
if (TL_MODE == 'BE' && !defined('EX_TL_MODE_FE')) {
$strContent = parent::generate();
if ($this->pageCode < 0) {
$strContent = '<div style="color:#a22;font-weight:bold;">→ ' . $this->pageLink . '</div>' . $strContent;
} elseif ($this->pageCode > 0) {
$strContent = '<div style="color:#22a">→ ' . $this->pageLink . '</div>' . $strContent;
} else {
$strContent = '<div>→ ' . $this->pageLink . '</div>' . $strContent;
}
return $strContent;
} else {
if (!empty($GLOBALS['TL_CONFIG']['pageTeaserJsLink']) && !defined('PAGE_TEASER_JS_LINK')) {
$GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/ce_page_teaser/assets/scripts/page_teaser.js|static';
define('PAGE_TEASER_JS_LINK', 1);
}
$strContent = parent::generate();
if ($this->pageCode > -1) {
return $strContent;
} else {
return '';
}
}
}
开发者ID:4t2,项目名称:ce_page_teaser,代码行数:29,代码来源:PageTeaser.php
示例17: generate
/**
* Return if the file does not exist
* @return string
*/
public function generate()
{
// Return if there is no file
if ($this->singleSRC == '') {
return '';
}
// Check for version 3 format
if (!is_numeric($this->singleSRC)) {
return '<p class="error">' . $GLOBALS['TL_LANG']['ERR']['version2format'] . '</p>';
}
$objFile = \FilesModel::findByPk($this->singleSRC);
if ($objFile === null) {
return '';
}
$allowedDownload = trimsplit(',', strtolower($GLOBALS['TL_CONFIG']['allowedDownload']));
// Return if the file type is not allowed
if (!in_array($objFile->extension, $allowedDownload)) {
return '';
}
$file = \Input::get('file', true);
// Send the file to the browser and do not send a 404 header (see #4632)
if ($file != '' && $file == $objFile->path) {
$this->sendFileToBrowser($file);
}
$this->singleSRC = $objFile->path;
return parent::generate();
}
开发者ID:rburch,项目名称:core,代码行数:31,代码来源:ContentDownload.php
示例18: generate
/**
* Parse the template
*
* @return string Parsed element
*/
public function generate()
{
if (TL_MODE === 'BE') {
return parent::generate();
}
$parentKey = ($this->arrData['ptable'] ?: 'tl_article') . '__' . $this->arrData['pid'];
$htmlPrefix = '';
if (!empty($GLOBALS['TL_RS_COLUMNS'][$parentKey])) {
if ($GLOBALS['TL_RS_COLUMNS'][$parentKey]['active']) {
$GLOBALS['TL_RS_COLUMNS'][$parentKey]['count']++;
$count = $GLOBALS['TL_RS_COLUMNS'][$parentKey]['count'];
if ($count) {
$classes = array('rs-column');
foreach ($GLOBALS['TL_RS_COLUMNS'][$parentKey]['config'] as $name => $media) {
$classes = array_merge($classes, $media[($count - 1) % count($media)]);
if ($count - 1 < count($media)) {
$classes[] = '-' . $name . '-first-row';
}
}
$htmlPrefix .= '<div class="' . implode(' ', $classes) . '">';
}
}
$GLOBALS['TL_RS_COLUMNS_STACK'][$parentKey][] = $GLOBALS['TL_RS_COLUMNS'][$parentKey];
}
$GLOBALS['TL_RS_COLUMNS'][$parentKey] = array('active' => true, 'count' => 0, 'config' => static::getColumnsConfiguration($this->arrData));
return $htmlPrefix . parent::generate();
}
开发者ID:madeyourday,项目名称:contao-rocksolid-columns,代码行数:32,代码来源:ColumnsStart.php
示例19: generate
public function generate()
{
Dump($_POST);
$pathFile = \Input::get($this->strQsParam, true);
$isPath = substr($pathFile, 0, 1) === '/';
if ($pathFile != '') {
$accessToken = \Config::get('dropboxAccessToken');
$dbxClient = new \DropboxClient($accessToken, "PHP-Example/1.0");
try {
if (!$isPath) {
$files = json_decode(urldecode($this->dropboxChooserFiles), true);
foreach ($files as $f) {
$basename = urldecode(explode('?', basename($f['link']))[0]);
if ($basename == $pathFile) {
$metadata = $dbxClient->getMetadataSharedLink($f['link']);
$pathFile = $metadata['path'];
}
}
}
$sharedLink = $dbxClient->createTemporaryDirectLink($pathFile);
//$sharedLink = $dbxClient->createShareableLink($pathFile);
} catch (dbx\Exception_BadRequest $ex) {
print "Error loading <app-info-file>: " . $ex->getMessage() . "\n";
// fwrite(STDERR, "Error loading <app-info-file>: ".$ex->getMessage()."\n");
die;
}
//Dump($sharedLink);
$this->redirect($sharedLink[0]);
}
return parent::generate();
}
开发者ID:rocchidavide,项目名称:contao-dropbox_tools,代码行数:31,代码来源:ContentDropboxToolsTest.php
示例20: generate
/**
* Parse the template
*
* @return string Parsed element
*/
public function generate()
{
if (TL_MODE === 'BE') {
return parent::generate();
}
$classes = array('rs-column');
$parentKey = ($this->arrData['ptable'] ?: 'tl_article') . '__' . $this->arrData['pid'];
if (isset($GLOBALS['TL_RS_COLUMNS'][$parentKey]) && $GLOBALS['TL_RS_COLUMNS'][$parentKey]['active']) {
$GLOBALS['TL_RS_COLUMNS'][$parentKey]['active'] = false;
$GLOBALS['TL_RS_COLUMNS'][$parentKey]['count']++;
$count = $GLOBALS['TL_RS_COLUMNS'][$parentKey]['count'];
foreach ($GLOBALS['TL_RS_COLUMNS'][$parentKey]['config'] as $name => $media) {
$classes = array_merge($classes, $media[($count - 1) % count($media)]);
if ($count - 1 < count($media)) {
$classes[] = '-' . $name . '-first-row';
}
}
} else {
trigger_error('Missing column wrapper start element before column start element ID ' . $this->id . '.', E_USER_WARNING);
}
if (!is_array($this->cssID)) {
$this->cssID = array('', '');
}
$this->arrData['cssID'][1] .= ' ' . implode(' ', $classes);
return parent::generate();
}
开发者ID:madeyourday,项目名称:contao-rocksolid-columns,代码行数:31,代码来源:ColumnStart.php
注:本文中的ContentElement类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论