本文整理汇总了PHP中t3lib_div::makeInstanceClassName方法的典型用法代码示例。如果您正苦于以下问题:PHP t3lib_div::makeInstanceClassName方法的具体用法?PHP t3lib_div::makeInstanceClassName怎么用?PHP t3lib_div::makeInstanceClassName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类t3lib_div
的用法示例。
在下文中一共展示了t3lib_div::makeInstanceClassName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: user_fieldvisibility
public function user_fieldvisibility($PA, $fobj)
{
$this->init();
//init some class attributes
$this->pageId = $PA['row']['pid'];
$uid = $PA['row']['uid'];
if (substr($uid, 0, 3) == 'NEW') {
$this->isNewElement = TRUE;
}
if ($PA['table'] == 'pages' && !$this->isNewElement) {
$this->pageId = $PA['row']['uid'];
}
$_modTSconfig = $GLOBALS["BE_USER"]->getTSConfig('mod.languagevisibility', t3lib_BEfunc::getPagesTSconfig($this->pageId));
$this->modTSconfig = $_modTSconfig['properties'];
###
$languageRep = t3lib_div::makeInstance('tx_languagevisibility_languagerepository');
$dao = t3lib_div::makeInstance('tx_languagevisibility_daocommon');
if (version_compare(TYPO3_version, '4.3.0', '<')) {
$elementfactoryName = t3lib_div::makeInstanceClassName('tx_languagevisibility_elementFactory');
$elementfactory = new $elementfactoryName($dao);
} else {
$elementfactory = t3lib_div::makeInstance('tx_languagevisibility_elementFactory', $dao);
}
$value = $PA['row'][$PA['field']];
$table = $PA['table'];
$isOverlay = tx_languagevisibility_beservices::isOverlayRecord($PA['row'], $table);
$visivilitySetting = @unserialize($value);
if (!is_array($visivilitySetting) && $value != '') {
$content .= 'Visibility Settings seems to be corrupt:' . $value;
}
if ($isOverlay) {
$uid = tx_languagevisibility_beservices::getOriginalUidOfTranslation($PA['row'], $table);
$table = tx_languagevisibility_beservices::getOriginalTableOfTranslation($table);
//This element is an overlay therefore we need to render the visibility field just for the language of the overlay
$overlayRecordsLanguage = $languageRep->getLanguageById($PA['row']['sys_language_uid']);
try {
$originalElement = $elementfactory->getElementForTable($table, $uid);
} catch (Exception $e) {
return '';
}
$infosStruct = $this->_getLanguageInfoStructurListForElementAndLanguageList($originalElement, array($overlayRecordsLanguage), $PA['itemFormElName'], true);
} else {
//This element is an original element (no overlay)
try {
$originalElement = $elementfactory->getElementForTable($table, $uid);
} catch (Exception $e) {
return 'sorry this element supports no visibility settings';
}
$content .= $originalElement->getInformativeDescription();
if ($originalElement->isMonolithicTranslated()) {
return $content;
}
$languageList = $languageRep->getLanguages();
$infosStruct = $this->_getLanguageInfoStructurListForElementAndLanguageList($originalElement, $languageList, $PA['itemFormElName'], false);
}
$content .= $this->_renderLanguageInfos($infosStruct);
return '<div id="fieldvisibility">' . $content . '<a href="#" onclick="resetSelectboxes()">reset</a></div>' . $this->_javascript();
}
示例2: check
/**
* Validates that the correct image of possible images displayed by the extension "simple_captcha" got selected.
*
* @param array &$check The TypoScript settings for this error check
* @param string $name The field name
* @param array &$gp The current GET/POST parameters
* @return string The error string
*/
public function check(&$check, $name, &$gp)
{
$checkFailed = '';
if (t3lib_extMgm::isLoaded('simple_captcha')) {
require_once t3lib_extMgm::extPath('simple_captcha') . 'class.tx_simplecaptcha.php';
$simpleCaptcha_className = t3lib_div::makeInstanceClassName('tx_simplecaptcha');
$this->simpleCaptcha = new $simpleCaptcha_className();
if (!$this->simpleCaptcha->checkCaptcha()) {
$checkFailed = $this->getCheckFailed($check);
}
}
return $checkFailed;
}
示例3: makeInstanceClassName
/**
* Return classname for new instance
* Takes the class-extensions API of TYPO3 into account
* Usage: 17
*
* @param string Base Class name to evaluate
* @return string Final class name to instantiate with "new [classname]"
*/
function makeInstanceClassName($className)
{
return class_exists('ux_' . $className) ? t3lib_div::makeInstanceClassName('ux_' . $className) : $className;
}
示例4: unserialize
* A copy is found in the textfile GPL.txt and important notices to the license
* from the author is found in LICENSE.txt distributed with these scripts.
*
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
// Initialize FE user object:
$feUserObj = tslib_eidtools::initFeUser();
require_once PATH_t3lib . 'class.t3lib_page.php';
require_once PATH_tslib . "class.tslib_content.php";
$temp_TSFEclassName = t3lib_div::makeInstanceClassName('tslib_fe');
// create object instances:
$TSFE = t3lib_div::makeInstance('tslib_fe', $TYPO3_CONF_VARS, $page, 0, true);
tslib_eidtools::connectDB();
extract($_POST, EXTR_PREFIX_SAME, "post_");
$tmp_confArr = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['rgmediaimagescallback']);
$securityKey = t3lib_div::_GET('key');
$pid = intval(t3lib_div::_GET('pid'));
$uid = intval(t3lib_div::_GET('uid'));
$file = $GLOBALS['TYPO3_DB']->fullQuoteStr(t3lib_div::_GET('file'), 'tx_rgmediaimagescallback_statistic');
if ($file != '' && $title != '' && $id != '' && $securityKey != '' && $pid != '' && $uid != '' && $state == 'start') {
// fetch existing data
$where = 'hidden=0 AND deleted = 0 AND pageid=' . $pid . ' AND ceuid = ' . $uid . ' AND uniquekey ="' . $securityKey . '" AND title="' . $file . '"';
$res = $TYPO3_DB->exec_SELECTquery('countmedia,uid', 'tx_rgmediaimagescallback_statistic', $where);
$row = $TYPO3_DB->sql_fetch_assoc($res);
// there is already one record => update
示例5: render_table
/**
* Rendering the "Table" type content element, called from TypoScript (tt_content.table.20)
*
* @param string Content input. Not used, ignore.
* @param array TypoScript configuration
* @return string HTML output.
* @access private
*/
function render_table($content, $conf)
{
$content = trim($this->cObj->data['bodytext']);
// Init FlexForm configuration
$this->pi_initPIflexForm();
// Get bodytext field content
$content = trim($this->cObj->data['bodytext']);
if (!strcmp($content, '')) {
return '';
}
// get flexform values
$caption = trim(htmlspecialchars($this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'acctables_caption')));
$summary = trim(htmlspecialchars($this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'acctables_summary')));
$useTfoot = trim($this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'acctables_tfoot'));
$headerPos = $this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'acctables_headerpos');
$noStyles = $this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'acctables_nostyles');
$tableClass = $this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'acctables_tableclass');
$delimiter = trim($this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'tableparsing_delimiter', 's_parsing'));
if ($delimiter) {
$delimiter = chr(intval($delimiter));
} else {
$delimiter = '|';
}
$quotedInput = trim($this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'tableparsing_quote', 's_parsing'));
if ($quotedInput) {
$quotedInput = chr(intval($quotedInput));
} else {
$quotedInput = '';
}
// Split into single lines (will become table-rows):
$rows = t3lib_div::trimExplode(chr(10), $content);
reset($rows);
// Find number of columns to render:
$cols = t3lib_div::intInRange($this->cObj->data['cols'] ? $this->cObj->data['cols'] : count(explode($delimiter, current($rows))), 0, 100);
// Traverse rows (rendering the table here)
$rCount = count($rows);
//***************************************
//***********RENDERING*******************
require_once t3lib_extMgm::extPath('th_exttableservice') . 'class.tx_thexttableservice.php';
$tableClass = t3lib_div::makeInstanceClassName('tx_thexttableservice');
$table = new $tableClass();
$table->loadDefinitions(t3lib_extMgm::extPath('aoe_advancedtable') . 'pi1/exttabledefinitions.xml');
$table->insertRows(0, $rCount - 1);
$table->insertCols(0, $cols - 1);
$cellcontent = '';
//***********Traverse each Row*******************
for ($row = 0; $row < $table->getRowCount(); $row++) {
$cells = explode($delimiter, $rows[$row]);
//Set common row attributes:
$_rowClass = $row % 2 ? 'tr-odd ' : 'tr-even ';
if ($row == $table->getRowCount() - 1) {
//is last row:
$_rowClass .= 'tr-last ';
}
$_rowClass .= 'tr-' . $row;
$lastCellInRowData = array();
//***********Traverse each col in row*******************
for ($col = 0; $col < $table->getColCount(); $col++) {
$cellData = $this->_getCellDataFromCellValue($cells[$col]);
$cellcontent = $cellData['content'];
//Set common cell attributes:
$_cellClass = '';
if ($col == $table->getColCount() - 1) {
//is last col:
$_cellClass = 'td-last ';
}
$_cellClass .= 'td-' . $col;
//process attributes for the current cell:
foreach ($cellData['attributes'] as $k => $v) {
switch ($k) {
case 'class':
$_cellClass .= ' ' . $v;
break;
case 'rowClass':
$_rowClass .= ' ' . $v;
break;
case 'cellType':
if ($v == 'header') {
$table->setCellType($col, $row, 'th');
}
break;
default:
//$table->setCellAttribute($col, $row, $k,$v);
break;
}
}
$table->setCellAttribute($col, $row, 'class', $_cellClass);
//***Check colspan and rowspan******
if ($cellData['colspan']) {
$this->_setColspanForTable($col, $row, $table);
} elseif ($cellData['rowspan']) {
$this->_setRowspanForTable($col, $row, $table);
//.........这里部分代码省略.........
示例6: createActFromPostData
/**
* createActFromPostData()
*
* creates an activity-object based on POSTed data
*/
function createActFromPostData()
{
$leg = t3lib_div::makeInstance('tx_user_fdf_actdb_cc_leg');
$loeb = t3lib_div::makeInstance('tx_user_fdf_actdb_cc_loeb');
$sketch = t3lib_div::makeInstance('tx_user_fdf_actdb_cc_sketch');
$act = $this->createActFromType($this->postdata[type]);
$this->ogiue('title', $act);
$this->ogiue('actid', $act, 'id');
$this->ogiue('keywords', $act);
$this->ogiue('teaser', $act);
$this->ogiue('notes', $act, 'nb');
$this->ogiue('description', $act);
$this->ogiue('author_name', $act);
$this->ogiue('author_email', $act);
$this->ogiue('duration_min', $act);
$this->ogiue('duration_max', $act);
$this->ogiue('participants_min', $act);
$this->ogiue('participants_max', $act);
$this->ogiue('age_min', $act);
$this->ogiue('age_max', $act);
if (isset($this->postdata['catids'])) {
foreach ($this->postdata['catids'] as $catid) {
$act->categories[$catid] = $this->cat_from_id($catid);
}
}
if (isset($this->postdata['ageids'])) {
print_r($this->postdata['ageids']);
foreach ($this->postdata['ageids'] as $ageid) {
print_r($ageid);
$age = t3lib_div::makeInstanceClassName('tx_user_fdf_actdb_cc_age');
$age = new $age($ageid);
$act->ages[$ageid] = $age;
}
}
if ($act->type == $leg->type || $act->type == $loeb->type) {
$this->ogiue('place', $act);
$this->ogiue('materials', $act);
if (isset($this->postdata[indoor])) {
$act->indoor = 1;
}
if (isset($this->postdata[outdoor])) {
$act->outdoor = 1;
}
} elseif ($act->type == 2) {
$this->ogiue('scene', $act);
$this->ogiue('roles', $act);
$this->ogiue('props', $act);
$this->ogiue('lines', $act);
$this->ogiue('audience_min_age', $act);
$this->ogiue('duration', $act);
}
return $act;
}
示例7: fillCaptchaMarkers
/**
* Fills the markers for the supported captcha extensions.
*
* @param array &$markers Reference to the markers array
* @return void
*/
protected function fillCaptchaMarkers(&$markers)
{
global $LANG;
if (t3lib_extMgm::isLoaded('captcha')) {
$markers['###CAPTCHA###'] = '<img src="' . t3lib_extMgm::siteRelPath('captcha') . 'captcha/captcha.php" alt="" />';
$markers['###captcha###'] = $markers['###CAPTCHA###'];
}
if (t3lib_extMgm::isLoaded('simple_captcha')) {
require_once t3lib_extMgm::extPath('simple_captcha') . 'class.tx_simplecaptcha.php';
$simpleCaptcha_className = t3lib_div::makeInstanceClassName('tx_simplecaptcha');
$this->simpleCaptcha = new $simpleCaptcha_className();
$captcha = $this->simpleCaptcha->getCaptcha();
$markers['###simple_captcha###'] = $captcha;
$markers['###SIMPLE_CAPTCHA###'] = $captcha;
}
if (t3lib_extMgm::isLoaded('sr_freecap')) {
require_once t3lib_extMgm::extPath('sr_freecap') . 'pi2/class.tx_srfreecap_pi2.php';
$this->freeCap = t3lib_div::makeInstance('tx_srfreecap_pi2');
$markers = array_merge($markers, $this->freeCap->makeCaptcha());
}
if (t3lib_extMgm::isLoaded('jm_recaptcha')) {
require_once t3lib_extMgm::extPath('jm_recaptcha') . 'class.tx_jmrecaptcha.php';
$this->recaptcha = new tx_jmrecaptcha();
$markers['###RECAPTCHA###'] = $this->recaptcha->getReCaptcha();
$markers['###recaptcha###'] = $markers['###RECAPTCHA###'];
}
if (t3lib_extMgm::isLoaded('wt_calculating_captcha')) {
require_once t3lib_extMgm::extPath('wt_calculating_captcha') . 'class.tx_wtcalculatingcaptcha.php';
$captcha = t3lib_div::makeInstance('tx_wtcalculatingcaptcha');
$markers['###WT_CALCULATING_CAPTCHA###'] = $captcha->generateCaptcha();
$markers['###wt_calculating_captcha###'] = $markers['###WT_CALCULATING_CAPTCHA###'];
}
if (t3lib_extMgm::isLoaded('mathguard')) {
require_once t3lib_extMgm::extPath('mathguard') . 'class.tx_mathguard.php';
$captcha = t3lib_div::makeInstance('tx_mathguard');
$markers['###MATHGUARD###'] = $captcha->getCaptcha();
$markers['###mathguard###'] = $markers['###MATHGUARD###'];
}
}
示例8: define
* @version $Id$
*/
$TYPO3_AJAX = true;
define('TYPO3_MOD_PATH', '../typo3conf/ext/tt_news/compat/');
$BACK_PATH = '';
// this path is used later for tree icons when the tree class is executed from typo3/alt_doc.php
require $BACK_PATH . '../../../../typo3/init.php';
require_once t3lib_extMgm::extPath('tt_news') . 'lib/class.tx_ttnews_typo3ajax.php';
require_once PATH_typo3 . 'sysext/lang/lang.php';
$GLOBALS['LANG'] = t3lib_div::makeInstance('language');
$GLOBALS['LANG']->init($GLOBALS['BE_USER']->uc['lang']);
// finding the script path from the variable
$ajaxID = (string) t3lib_div::_GP('ajaxID');
$ajaxScript = $TYPO3_CONF_VARS['BE']['AJAX'][$ajaxID];
// instantiating the AJAX object
$ajaxClassName = t3lib_div::makeInstanceClassName('tx_ttnews_typo3ajax');
$ajaxObj = new $ajaxClassName($ajaxID);
$ajaxParams = array();
// evaluating the arguments and calling the AJAX method/function
if (empty($ajaxID)) {
$ajaxObj->setError('No valid ajaxID parameter given.');
} else {
if (empty($ajaxScript)) {
$ajaxObj->setError('Registered backend function for ajaxID "' . $ajaxID . '" was not found.');
} else {
$ret = t3lib_div::callUserFunction($ajaxScript, $ajaxParams, $ajaxObj, false, true);
if ($ret === false) {
$ajaxObj->setError('Registered backend function for ajaxID "' . $ajaxID . '" was not found.');
}
}
}
示例9: lock
/**
* Obtain exclusive lock
*
* @param string Filename which we want to lock
* @return bool Success or failure of operation
*/
function lock($filename)
{
try {
if (!is_object($this->fileLock)) {
if (t3lib_div::compat_version('4.3')) {
$this->fileLock = t3lib_div::makeInstance('t3lib_lock', 'tx_dam_indexing_' . md5($filename), $GLOBALS['TYPO3_CONF_VARS']['SYS']['lockingMode'], 60, 10);
} else {
$className = t3lib_div::makeInstanceClassName('t3lib_lock');
$this->fileLock = new $className('tx_dam_indexing_' . md5($filename), $GLOBALS['TYPO3_CONF_VARS']['SYS']['lockingMode'], 60, 10);
}
}
$success = false;
if (is_object($this->fileLock)) {
// true = Page could get locked without blocking
// false = Page could get locked but process was blocked before
$success = $this->fileLock->acquire() || $GLOBALS['TYPO3_CONF_VARS']['SYS']['lockingMode'] == 'disable';
if ($this->fileLock->getLockStatus()) {
if ($this->writeDevLog) {
t3lib_div::devLog('lock(): lock aquired ' . $filename, 'tx_dam_indexing');
}
} else {
if ($this->writeDevLog) {
t3lib_div::devLog('lock(): lock failed ' . $filename, 'tx_dam_indexing');
}
}
}
} catch (Exception $e) {
if ($this->writeDevLog) {
t3lib_div::devLog('lock(): Exception caught ' . $e->getMessage(), 'tx_dam_indexing');
}
}
return $success;
}
示例10: _initBeUser
function _initBeUser()
{
global $BE_USER, $_COOKIE, $TYPO3_CONF_VARS;
$temp_TSFEclassName = t3lib_div::makeInstanceClassName('tslib_fe');
$TSFE = new $temp_TSFEclassName($TYPO3_CONF_VARS, 0, 0);
$TSFE->connectToDB();
// *********
// BE_USER
// *********
$BE_USER = '';
if ($_COOKIE['be_typo_user']) {
// If the backend cookie is set, we proceed and checks if a backend user is logged in.
require_once PATH_t3lib . 'class.t3lib_befunc.php';
require_once PATH_t3lib . 'class.t3lib_userauthgroup.php';
require_once PATH_t3lib . 'class.t3lib_beuserauth.php';
require_once PATH_t3lib . 'class.t3lib_tsfebeuserauth.php';
// the value this->formfield_status is set to empty in order to disable login-attempts to the backend account through this script
$BE_USER = t3lib_div::makeInstance('t3lib_tsfeBeUserAuth');
// New backend user object
$BE_USER->OS = TYPO3_OS;
$BE_USER->lockIP = $TYPO3_CONF_VARS['BE']['lockIP'];
$BE_USER->start();
// Object is initialized
$BE_USER->unpack_uc('');
if ($BE_USER->user['uid']) {
$BE_USER->fetchGroupData();
$TSFE->beUserLogin = 1;
}
if ($BE_USER->checkLockToIP() && $BE_USER->checkBackendAccessSettingsFromInitPhp()) {
$BE_USER->extInitFeAdmin();
if ($BE_USER->extAdmEnabled) {
require_once t3lib_extMgm::extPath('lang') . 'lang.php';
$LANG = t3lib_div::makeInstance('language');
$LANG->init($BE_USER->uc['lang']);
$BE_USER->extSaveFeAdminConfig();
// Setting some values based on the admin panel
$TSFE->forceTemplateParsing = $BE_USER->extGetFeAdminValue('tsdebug', 'forceTemplateParsing');
$TSFE->displayEditIcons = $BE_USER->extGetFeAdminValue('edit', 'displayIcons');
$TSFE->displayFieldEditIcons = $BE_USER->extGetFeAdminValue('edit', 'displayFieldIcons');
if (t3lib_div::_GP('ADMCMD_editIcons')) {
$TSFE->displayFieldEditIcons = 1;
$BE_USER->uc['TSFE_adminConfig']['edit_editNoPopup'] = 1;
}
if (t3lib_div::_GP('ADMCMD_simUser')) {
$BE_USER->uc['TSFE_adminConfig']['preview_simulateUserGroup'] = intval(t3lib_div::_GP('ADMCMD_simUser'));
$BE_USER->ext_forcePreview = 1;
}
if (t3lib_div::_GP('ADMCMD_simTime')) {
$BE_USER->uc['TSFE_adminConfig']['preview_simulateDate'] = intval(t3lib_div::_GP('ADMCMD_simTime'));
$BE_USER->ext_forcePreview = 1;
}
// Include classes for editing IF editing module in Admin Panel is open
if ($BE_USER->extAdmModuleEnabled('edit') && $BE_USER->extIsAdmMenuOpen('edit') || $TSFE->displayEditIcons == 1) {
$TSFE->includeTCA();
if ($BE_USER->extIsEditAction()) {
require_once PATH_t3lib . 'class.t3lib_tcemain.php';
$BE_USER->extEditAction();
}
if ($BE_USER->extIsFormShown()) {
require_once PATH_t3lib . 'class.t3lib_tceforms.php';
require_once PATH_t3lib . 'class.t3lib_iconworks.php';
require_once PATH_t3lib . 'class.t3lib_loaddbgroup.php';
require_once PATH_t3lib . 'class.t3lib_transferdata.php';
}
}
if ($TSFE->forceTemplateParsing || $TSFE->displayEditIcons || $TSFE->displayFieldEditIcons) {
$TSFE->set_no_cache();
}
}
// $WEBMOUNTS = (string)($BE_USER->groupData['webmounts'])!='' ? explode(',',$BE_USER->groupData['webmounts']) : Array();
// $FILEMOUNTS = $BE_USER->groupData['filemounts'];
} else {
// Unset the user initialization.
$BE_USER = '';
$TSFE->beUserLogin = 0;
}
} elseif ($TSFE->ADMCMD_preview_BEUSER_uid) {
require_once PATH_t3lib . 'class.t3lib_befunc.php';
require_once PATH_t3lib . 'class.t3lib_userauthgroup.php';
require_once PATH_t3lib . 'class.t3lib_beuserauth.php';
require_once PATH_t3lib . 'class.t3lib_tsfebeuserauth.php';
// the value this->formfield_status is set to empty in order to disable login-attempts to the backend account through this script
$BE_USER = t3lib_div::makeInstance('t3lib_tsfeBeUserAuth');
// New backend user object
$BE_USER->userTS_dontGetCached = 1;
$BE_USER->OS = TYPO3_OS;
$BE_USER->setBeUserByUid($TSFE->ADMCMD_preview_BEUSER_uid);
$BE_USER->unpack_uc('');
if ($BE_USER->user['uid']) {
$BE_USER->fetchGroupData();
$TSFE->beUserLogin = 1;
} else {
$BE_USER = '';
$TSFE->beUserLogin = 0;
}
}
return $BE_USER;
}
示例11: getElementInstance
/**
* Gets instance depending on TYPO3 version
* @param $name name of the class
* @param array $row row that is used to initialaze element instance
* @return tx_languagevisibility_element
*/
private function getElementInstance($name, $row)
{
if (version_compare(TYPO3_version, '4.3.0', '<')) {
require_once t3lib_extMgm::extPath("languagevisibility") . 'classes/class.' . $name . '.php';
$elementclass = t3lib_div::makeInstanceClassName($name);
return new $elementclass($row);
} else {
return t3lib_div::makeInstance($name, $row);
}
}
示例12: createTSFE
/**
* Creates TSFE for executing RealURL. Code idea comes from vara_feurlfrombe extension.
*
* @param int $pid Page uid
* @return void
*/
function createTSFE($pid) {
require_once(PATH_site.'typo3/sysext/cms/tslib/class.tslib_fe.php');
require_once(PATH_site.'t3lib/class.t3lib_userauth.php');
require_once(PATH_site.'typo3/sysext/cms/tslib/class.tslib_feuserauth.php');
require_once(PATH_site.'t3lib/class.t3lib_cs.php');
require_once(PATH_site.'typo3/sysext/cms/tslib/class.tslib_content.php') ;
require_once(PATH_site.'t3lib/class.t3lib_tstemplate.php');
require_once(PATH_site.'t3lib/class.t3lib_page.php');
require_once(PATH_site.'t3lib/class.t3lib_timetrack.php');
$temp_TTclassName = t3lib_div::makeInstanceClassName('t3lib_timeTrack');
$GLOBALS['TT'] = new $temp_TTclassName();
$GLOBALS['TT']->start();
// Finds the TSFE classname
$TSFEclassName = t3lib_div::makeInstanceClassName('tslib_fe');
// Create the TSFE class.
$GLOBALS['TSFE'] = new $TSFEclassName($GLOBALS['TYPO3_CONF_VARS'], $pid, '0', 0, '','','','');
$GLOBALS['TSFE']->config['config']['language']='default';
// Fire all the required function to get the typo3 FE all set up.
$GLOBALS['TSFE']->id = $pid;
$GLOBALS['TSFE']->connectToMySQL();
// Prevent mysql debug messages from messing up the output
$sqlDebug = $GLOBALS['TYPO3_DB']->debugOutput;
$GLOBALS['TYPO3_DB']->debugOutput = false;
$GLOBALS['TSFE']->initLLVars();
$GLOBALS['TSFE']->initFEuser();
// Look up the page
$GLOBALS['TSFE']->sys_page = t3lib_div::makeInstance('t3lib_pageSelect');
$GLOBALS['TSFE']->sys_page->init($GLOBALS['TSFE']->showHiddenPage);
// If the page is not found (if the page is a sysfolder, etc), then return no URL, preventing any further processing which would result in an error page.
$page = $GLOBALS['TSFE']->sys_page->getPage($pid);
if (count($page) == 0) {
$GLOBALS['TYPO3_DB']->debugOutput = $sqlDebug;
return false;
}
// If the page is a shortcut, look up the page to which the shortcut references, and do the same check as above.
if ($page['doktype']==4 && count($GLOBALS['TSFE']->getPageShortcut($page['shortcut'],$page['shortcut_mode'],$page['uid'])) == 0) {
$GLOBALS['TYPO3_DB']->debugOutput = $sqlDebug;
return false;
}
// Spacer pages and sysfolders result in a page not found page too...
if ($page['doktype'] == 199 || $page['doktype'] == 254) {
$GLOBALS['TYPO3_DB']->debugOutput = $sqlDebug;
return false;
}
$GLOBALS['TSFE']->getPageAndRootline();
$GLOBALS['TSFE']->initTemplate();
$GLOBALS['TSFE']->forceTemplateParsing = 1;
// Find the root template
$GLOBALS['TSFE']->tmpl->start($GLOBALS['TSFE']->rootLine);
// Fill the pSetup from the same variables from the same location as where tslib_fe->getConfigArray will get them, so they can be checked before this function is called
$GLOBALS['TSFE']->sPre = $GLOBALS['TSFE']->tmpl->setup['types.'][$GLOBALS['TSFE']->type]; // toplevel - objArrayName
$GLOBALS['TSFE']->pSetup = $GLOBALS['TSFE']->tmpl->setup[$GLOBALS['TSFE']->sPre.'.'];
// If there is no root template found, there is no point in continuing which would result in a 'template not found' page and then call exit php. Then there would be no clickmenu at all.
// And the same applies if pSetup is empty, which would result in a "The page is not configured" message.
if (!$GLOBALS['TSFE']->tmpl->loaded || ($GLOBALS['TSFE']->tmpl->loaded && !$GLOBALS['TSFE']->pSetup)) {
$GLOBALS['TYPO3_DB']->debugOutput = $sqlDebug;
return false;
}
$GLOBALS['TSFE']->getConfigArray();
$GLOBALS['TSFE']->inituserGroups();
$GLOBALS['TSFE']->connectToDB();
$GLOBALS['TSFE']->determineId();
$GLOBALS['TYPO3_DB']->debugOutput = $sqlDebug;
return true;
}
示例13: makeInstanceClassName
/**
* Return classname for new instance
* Takes the class-extensions API of TYPO3 into account
* Usage: 17
*
* @param string Base Class name to evaluate
* @return string Final class name to instantiate with "new [classname]"
* @deprecated since TYPO3 4.3 - Use t3lib_div::makeInstance('myClass', $arg1, $arg2, ..., $argN)
*/
public static function makeInstanceClassName($className)
{
self::logDeprecatedFunction();
return class_exists($className) && class_exists('ux_' . $className, false) ? t3lib_div::makeInstanceClassName('ux_' . $className) : $className;
}
示例14: main_parseTreeCallBack
/**
* Call back function for page tree traversal!
*
* @param string Table name
* @param integer UID of record in processing
* @param integer Echo level (see calling function
* @param string Version swap mode on that level (see calling function
* @param integer Is root version (see calling function
* @return void
*/
function main_parseTreeCallBack($tableName, $uid, $echoLevel, $versionSwapmode, $rootIsVersion)
{
if ($tableName == 'pages' && $uid > 0) {
if (!$versionSwapmode) {
// Initialize TemplaVoila API class:
$apiClassName = t3lib_div::makeInstanceClassName('tx_templavoila_api');
$apiObj = new $apiClassName('pages');
// Fetch the content structure of page:
$contentTreeData = $apiObj->getContentTree('pages', t3lib_BEfunc::getRecordRaw('pages', 'uid=' . intval($uid)));
if ($contentTreeData['tree']['ds_is_found']) {
$usedUids = array_keys($contentTreeData['contentElementUsage']);
$usedUids[] = 0;
// Look up all content elements that are NOT used on this page...
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid, header', 'tt_content', 'pid=' . intval($uid) . ' ' . 'AND uid NOT IN (' . implode(',', $usedUids) . ') ' . 'AND t3ver_state!=1' . t3lib_BEfunc::deleteClause('tt_content') . t3lib_BEfunc::versioningPlaceholderClause('tt_content'), '', 'uid');
// Traverse, for each find references if any and register them.
while (false !== ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))) {
// Look up references to elements:
$refrows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*', 'sys_refindex', 'ref_table=' . $GLOBALS['TYPO3_DB']->fullQuoteStr('tt_content', 'sys_refindex') . ' AND ref_uid=' . intval($row['uid']) . ' AND deleted=0');
// Register elements etc:
$this->resultArray['all_unused'][$row['uid']] = array($row['header'], count($refrows));
if ($echoLevel > 2) {
echo chr(10) . ' [tx_templavoila_unusedce:] tt_content:' . $row['uid'] . ' was not used on page...';
}
if (!count($refrows)) {
$this->resultArray['deleteMe'][$row['uid']] = $row['uid'];
if ($echoLevel > 2) {
echo ' and can be DELETED';
}
} else {
if ($echoLevel > 2) {
echo ' but is referenced to (' . count($refrows) . ') so do not delete...';
}
}
}
} else {
if ($echoLevel > 2) {
echo chr(10) . ' [tx_templavoila_unusedce:] Did not check page - did not have a Data Structure set.';
}
}
} else {
if ($echoLevel > 2) {
echo chr(10) . ' [tx_templavoila_unusedce:] Did not check page - was on offline page.';
}
}
}
}
示例15: hasTranslation
/**
* Check if given element has traslation in given language
*
* @param int $elementUid
* @param string $table
* @param int $languageUid
* @return boolean
*/
public static function hasTranslation($elementUid, $table, $languageUid)
{
$dao = t3lib_div::makeInstance('tx_languagevisibility_daocommon');
if (version_compare(TYPO3_version, '4.3.0', '<')) {
$elementfactoryName = t3lib_div::makeInstanceClassName('tx_languagevisibility_elementFactory');
$elementfactory = new $elementfactoryName($dao);
} else {
$elementfactory = t3lib_div::makeInstance('tx_languagevisibility_elementFactory', $dao);
}
$result = false;
try {
$element = $elementfactory->getElementForTable($table, $elementUid);
$result = $element->hasTranslation($languageUid);
} catch (UnexpectedValueException $e) {
//the element can not be handeld by language visibility
$result = false;
}
return $result;
}