本文整理汇总了PHP中ContentElement::generate方法的典型用法代码示例。如果您正苦于以下问题:PHP ContentElement::generate方法的具体用法?PHP ContentElement::generate怎么用?PHP ContentElement::generate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ContentElement
的用法示例。
在下文中一共展示了ContentElement::generate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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();
}
示例2: 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();
}
示例3: 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();
}
示例4: 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();
}
示例5: 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();
}
示例6: 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();
}
示例7: 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();
}
示例8: generate
public function generate()
{
if (!empty($GLOBALS['SLICKMAP']['CSS'])) {
$GLOBALS['TL_CSS'][] = $GLOBALS['SLICKMAP']['CSS'];
}
return parent::generate();
}
示例9: 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();
}
示例10: generate
/**
* Parse the template
* @return string
*/
public function generate()
{
if (TL_MODE == 'BE' && !defined('NEWSLETTER_CONTENT_PREVIEW')) {
return 'NEWSLETTER ROW BREAK';
}
return parent::generate();
}
示例11: 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();
}
示例12: 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 '';
}
}
}
示例13: 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();
}
示例14: 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();
}
示例15: 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();
}