本文整理汇总了PHP中t3lib_div::makeInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP t3lib_div::makeInstance方法的具体用法?PHP t3lib_div::makeInstance怎么用?PHP t3lib_div::makeInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类t3lib_div
的用法示例。
在下文中一共展示了t3lib_div::makeInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mysql2Connect
public static function mysql2Connect()
{
$mysql2Sql = t3lib_div::makeInstance('t3lib_db');
$mysql2Sql->sql_pconnect("mysql2.hs-esslingen.de", "rzlx33xxtypo3_ro", "Neuhioceid3") or die('Could not connect to Mysql server "mysql2.hs-esslingen.de".');
$mysql2Sql->sql_select_db("wetterstation") or die('Could not select database "wetterstation".');
return $mysql2Sql;
}
示例2: execute
/**
* Function executed from the Scheduler.
*
* @return void
*/
public function execute()
{
$_SERVER['argv'] = array($_SERVER['argv'][0], '0', '-o', $this->mode);
/* @var $crawlerObj tx_crawler_lib */
$crawlerObj = t3lib_div::makeInstance('tx_crawler_lib');
return $crawlerObj->CLI_main_flush();
}
示例3: __construct
/**
* Constructor
*
* @param tx_solr_SolrService $solrConnection The Solr connection to use for searching
*/
public function __construct(tx_solr_SolrService $solrConnection = NULL)
{
$this->solr = $solrConnection;
if (is_null($solrConnection)) {
$this->solr = t3lib_div::makeInstance('tx_solr_ConnectionManager')->getConnectionByPageId($GLOBALS['TSFE']->id, $GLOBALS['TSFE']->sys_language_uid);
}
}
示例4: autoPublishWorkspaces
/**
* This method is called by the Scheduler task that triggers
* the autopublication process
* It searches for workspaces whose publication date is in the past
* and publishes them
*
* @return void
*/
public function autoPublishWorkspaces()
{
global $TYPO3_CONF_VARS;
// Temporarily set admin rights
// FIXME: once workspaces are cleaned up a better solution should be implemented
$currentAdminStatus = $GLOBALS['BE_USER']->user['admin'];
$GLOBALS['BE_USER']->user['admin'] = 1;
// Select all workspaces that needs to be published / unpublished:
$workspaces = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('uid,swap_modes,publish_time,unpublish_time', 'sys_workspace', 'pid=0
AND
((publish_time!=0 AND publish_time<=' . intval($GLOBALS['EXEC_TIME']) . ')
OR (publish_time=0 AND unpublish_time!=0 AND unpublish_time<=' . intval($GLOBALS['EXEC_TIME']) . '))' . t3lib_BEfunc::deleteClause('sys_workspace'));
$workspaceService = t3lib_div::makeInstance('tx_Workspaces_Service_Workspaces');
foreach ($workspaces as $rec) {
// First, clear start/end time so it doesn't get select once again:
$fieldArray = $rec['publish_time'] != 0 ? array('publish_time' => 0) : array('unpublish_time' => 0);
$GLOBALS['TYPO3_DB']->exec_UPDATEquery('sys_workspace', 'uid=' . intval($rec['uid']), $fieldArray);
// Get CMD array:
$cmd = $workspaceService->getCmdArrayForPublishWS($rec['uid'], $rec['swap_modes'] == 1);
// $rec['swap_modes']==1 means that auto-publishing will swap versions, not just publish and empty the workspace.
// Execute CMD array:
$tce = t3lib_div::makeInstance('t3lib_TCEmain');
$tce->stripslashes_values = 0;
$tce->start(array(), $cmd);
$tce->process_cmdmap();
}
// Restore admin status
$GLOBALS['BE_USER']->user['admin'] = $currentAdminStatus;
}
示例5: show
/**
* Generates and prints out a organizers list.
*
* @return string the HTML source code to display
*/
public function show()
{
$content = '';
$pageData = $this->page->getPageData();
$this->template->setMarker('new_record_button', $this->getNewIcon($pageData['uid']));
$this->template->setMarker('label_full_name', $GLOBALS['LANG']->getLL('organizerlist.title'));
/** @var tx_seminars_BagBuilder_Organizer $builder */
$builder = t3lib_div::makeInstance('tx_seminars_BagBuilder_Organizer');
$builder->setSourcePages($pageData['uid'], self::RECURSION_DEPTH);
$organizerBag = $builder->build();
$tableRows = '';
/** @var tx_seminars_OldModel_Organizer $organizerBag */
foreach ($organizerBag as $this->organizer) {
$this->template->setMarker('icon', $this->organizer->getRecordIcon());
$this->template->setMarker('full_name', htmlspecialchars($this->organizer->getTitle()));
$this->template->setMarker('edit_button', $this->getEditIcon($this->organizer->getUid(), $this->organizer->getPageUid()));
$this->template->setMarker('delete_button', $this->getDeleteIcon($this->organizer->getUid(), $this->organizer->getPageUid()));
$tableRows .= $this->template->getSubpart('ORGANIZER_ROW');
}
$this->template->setSubpart('ORGANIZER_ROW', $tableRows);
$this->template->setMarker('label_print_button', $GLOBALS['LANG']->getLL('print'));
$content .= $this->template->getSubpart('SEMINARS_ORGANIZER_LIST');
$content .= $organizerBag->checkConfiguration();
return $content;
}
示例6: initialize
/**
* Initializes the Module
*
* @return void
*/
public function initialize()
{
parent::init();
$this->doc = t3lib_div::makeInstance('template');
$this->doc->setModuleTemplate(t3lib_extMgm::extPath('recycler') . 'mod1/mod_template.html');
$this->doc->backPath = $GLOBALS['BACK_PATH'];
$this->doc->setExtDirectStateProvider();
$this->pageRenderer = $this->doc->getPageRenderer();
$this->relativePath = t3lib_extMgm::extRelPath('recycler');
$this->pageRecord = t3lib_BEfunc::readPageAccess($this->id, $this->perms_clause);
$this->isAccessibleForCurrentUser = $this->id && is_array($this->pageRecord) || !$this->id && $this->isCurrentUserAdmin();
//don't access in workspace
if ($GLOBALS['BE_USER']->workspace !== 0) {
$this->isAccessibleForCurrentUser = false;
}
//read configuration
$modTS = $GLOBALS['BE_USER']->getTSConfig('mod.recycler');
if ($this->isCurrentUserAdmin()) {
$this->allowDelete = true;
} else {
$this->allowDelete = $modTS['properties']['allowDelete'] == '1';
}
if (isset($modTS['properties']['recordsPageLimit']) && intval($modTS['properties']['recordsPageLimit']) > 0) {
$this->recordsPageLimit = intval($modTS['properties']['recordsPageLimit']);
}
}
示例7: __construct
/**
* class constructor checks if cache has to be rebuild and initiates the rebuild
* instantiates the handler class
*
* @param boolean $regenerate with set to false, cache won't be regenerated if needed (useful for feediting)
* @return void
*/
function __construct($regenerate = TRUE)
{
// we check for existance of our targetDirectory
if (!is_dir(PATH_site . self::$tempPath)) {
t3lib_div::mkdir(PATH_site . self::$tempPath);
}
// create a fileName, the hash includes all icons and css-styles registered and the extlist
$this->tempFileName = PATH_site . self::$tempPath . md5(serialize($GLOBALS['TBE_STYLES']['spritemanager']) . md5(serialize($GLOBALS['TBE_STYLES']['spriteIconApi']['coreSpriteImageNames'])) . $GLOBALS['TYPO3_CONF_VARS']['EXT']['extList']) . '.inc';
// if no cache-file for the current config ist present, regenerate it
if (!@file_exists($this->tempFileName)) {
// regenerate if allowed
if ($regenerate) {
$handlerClass = $GLOBALS['TYPO3_CONF_VARS']['BE']['spriteIconGenerator_handler'] ? $GLOBALS['TYPO3_CONF_VARS']['BE']['spriteIconGenerator_handler'] : 't3lib_spritemanager_SimpleHandler';
$this->handler = t3lib_div::makeInstance($handlerClass);
// check if the handler could be loaded and implements the needed interface
if (!$this->handler || !$this->handler instanceof t3lib_spritemanager_SpriteIconGenerator) {
throw new Exception("class in TYPO3_CONF_VARS[BE][spriteIconGenerator_handler] does not exist,\n\t\t\t\t\t\tor does not implement t3lib_spritemanager_SpriteIconGenerator");
}
// all went good? to go for rebuild
$this->rebuildCache();
} else {
// use old file if present
list($this->tempFileName) = t3lib_div::getFilesInDir(PATH_site . self::$tempPath, 'inc', 1);
}
}
}
示例8: getSearchWords
/**
* Splits the search word input into an array where each word is represented by an array with key "sword" holding the search word and key "oper" holds the SQL operator (eg. AND, OR)
*
* Only words with 2 or more characters are accepted
* Max 200 chars total
* Space is used to split words, "" can be used search for a whole string (not indexed search then)
* AND, OR and NOT are prefix words, overruling the default operator
* +/|/- equals AND, OR and NOT as operators.
* All search words are converted to lowercase.
*
* $defOp is the default operator. 1=OR, 0=AND
*
* @param boolean If true, the default operator will be OR, not AND
* @return array Returns array with search words if any found
*/
function getSearchWords($defOp)
{
//start OVERWRITE
$returnArray = array();
//end OVERWRITE
// Shorten search-word string to max 200 bytes (does NOT take multibyte charsets into account - but never mind, shortening the string here is only a run-away feature!)
$inSW = substr($this->piVars['sword'], 0, 200);
// Convert to UTF-8 + conv. entities (was also converted during indexing!)
$inSW = $GLOBALS['TSFE']->csConvObj->utf8_encode($inSW, $GLOBALS['TSFE']->metaCharset);
$inSW = $GLOBALS['TSFE']->csConvObj->entities_to_utf8($inSW, TRUE);
if ($hookObj =& $this->hookRequest('getSearchWords')) {
$returnArray = $hookObj->getSearchWords_splitSWords($inSW, $defOp);
} else {
if ($this->piVars['type'] == 20) {
$returnArray = array(array('sword' => trim($inSW), 'oper' => 'AND'));
} else {
$search = t3lib_div::makeInstance('tslib_search');
$search->default_operator = $defOp == 1 ? 'OR' : 'AND';
$search->operator_translate_table = $this->operator_translate_table;
$search->register_and_explode_search_string($inSW);
if (is_array($search->sword_array)) {
$returnArray = $this->procSearchWordsByLexer($search->sword_array);
}
}
}
$this->mapSWtoColor($returnArray);
return $returnArray;
}
示例9: getUpdateEncoded
/**
* Convert the values of a SQL update statement to a different encoding than UTF-8.
*
* @param string $query Update statement like: UPDATE static_countries SET cn_short_de='XXX' WHERE cn_iso_2='DE';
* @param string $destEncoding Destination encoding
* @return string Converted update statement
*/
function getUpdateEncoded($query, $destEncoding)
{
static $csconv;
if (!($destEncoding == 'utf-8')) {
if (!is_object($csconv)) {
$csconv = t3lib_div::makeInstance('t3lib_cs');
}
$queryElements = explode('WHERE', $query);
$where = preg_replace('#;$#', '', trim($queryElements[1]));
$queryElements = explode('SET', $queryElements[0]);
$queryFields = $queryElements[1];
$queryElements = t3lib_div::trimExplode('UPDATE', $queryElements[0], 1);
$table = $queryElements[0];
$fields_values = array();
$queryFields = t3lib_div::trimExplode(',', $queryFields, 1);
foreach ($queryFields as $fieldsSet) {
$col = t3lib_div::trimExplode('=', $fieldsSet, 1);
$value = stripslashes(substr($col[1], 1, strlen($col[1]) - 2));
$value = $csconv->conv($value, 'utf-8', $destEncoding);
$fields_values[$col[0]] = $value;
}
$query = $GLOBALS['TYPO3_DB']->UPDATEquery($table, $where, $fields_values);
}
return $query;
}
示例10: loadConfig4BE
/**
* Lädt ein COnfigurations Objekt nach mit der TS aus der Extension
* Dabei wird alles geholt was in "plugin.tx_$extKey", "lib.$extKey." und
* "lib.links." liegt
*
* @param string $extKey Extension, deren TS Config geladen werden soll
* @param string $extKeyTS Extension, deren Konfig innerhalb der
* TS Config geladen werden soll.
* Es kann also zb. das TS von mklib geladen werden aber darin die konfig für
* das plugin von mkxyz
* @param string $sStaticPath pfad zum TS
* @param array $aConfig zusätzliche Konfig, die die default überschreibt
* @param boolean $resolveReferences sollen referenzen die in lib.
* und plugin.tx_$extKeyTS stehen aufgelöst werden?
* @param boolean $forceTsfePreparation
* @return tx_rnbase_configurations
*/
public static function loadConfig4BE($extKey, $extKeyTs = null, $sStaticPath = '', $aConfig = array(), $resolveReferences = false, $forceTsfePreparation = false)
{
$extKeyTs = is_null($extKeyTs) ? $extKey : $extKeyTs;
if (!$sStaticPath) {
$sStaticPath = '/static/ts/setup.txt';
}
if (file_exists(t3lib_div::getFileAbsFileName('EXT:' . $extKey . $sStaticPath))) {
t3lib_extMgm::addPageTSConfig('<INCLUDE_TYPOSCRIPT: source="FILE:EXT:' . $extKey . $sStaticPath . '">');
}
tx_rnbase::load('tx_rnbase_configurations');
tx_rnbase::load('tx_rnbase_util_Misc');
$tsfePreparationOptions = array();
if ($forceTsfePreparation) {
$tsfePreparationOptions['force'] = true;
}
// Ist bei Aufruf aus BE notwendig! (@TODO: sicher???)
tx_rnbase_util_Misc::prepareTSFE($tsfePreparationOptions);
$GLOBALS['TSFE']->config = array();
$cObj = t3lib_div::makeInstance('tslib_cObj');
$pageTsConfig = self::getPagesTSconfig(0);
$tempConfig = $pageTsConfig['plugin.']['tx_' . $extKeyTs . '.'];
$tempConfig['lib.'][$extKeyTs . '.'] = $pageTsConfig['lib.'][$extKeyTs . '.'];
$tempConfig['lib.']['links.'] = $pageTsConfig['lib.']['links.'];
if ($resolveReferences) {
$GLOBALS['TSFE']->tmpl->setup['lib.'][$extKeyTs . '.'] = $tempConfig['lib.'][$extKeyTs . '.'];
$GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_' . $extKeyTs . '.'] = $pageTsConfig['plugin.']['tx_' . $extKeyTs . '.'];
}
$pageTsConfig = $tempConfig;
$qualifier = $pageTsConfig['qualifier'] ? $pageTsConfig['qualifier'] : $extKeyTs;
// möglichkeit die default konfig zu überschreiben
$pageTsConfig = t3lib_div::array_merge_recursive_overrule($pageTsConfig, $aConfig);
$configurations = new tx_rnbase_configurations();
$configurations->init($pageTsConfig, $cObj, $extKeyTs, $qualifier);
return $configurations;
}
示例11: execute
/**
* Returns an URL that switches the sorting indicator according to the
* given sorting direction
*
* @param array $arguments Expects 'asc' or 'desc' as sorting direction in key 0
* @return string
* @throws InvalidArgumentException when providing an invalid sorting direction
*/
public function execute(array $arguments = array())
{
$content = '';
$sortDirection = trim($arguments[0]);
$configuration = Tx_Solr_Util::getSolrConfiguration();
$contentObject = t3lib_div::makeInstance('tslib_cObj');
$defaultImagePrefix = 'EXT:solr/Resources/Images/Indicator';
switch ($sortDirection) {
case 'asc':
$imageConfiguration = $configuration['viewHelpers.']['sortIndicator.']['up.'];
if (!isset($imageConfiguration['file'])) {
$imageConfiguration['file'] = $defaultImagePrefix . 'Up.png';
}
$content = $contentObject->IMAGE($imageConfiguration);
break;
case 'desc':
$imageConfiguration = $configuration['viewHelpers.']['sortIndicator.']['down.'];
if (!isset($imageConfiguration['file'])) {
$imageConfiguration['file'] = $defaultImagePrefix . 'Down.png';
}
$content = $contentObject->IMAGE($imageConfiguration);
break;
case '###SORT.CURRENT_DIRECTION###':
case '':
// ignore
break;
default:
throw new InvalidArgumentException('Invalid sorting direction "' . $arguments[0] . '", must be "asc" or "desc".', 1390868460);
}
return $content;
}
示例12: __construct
/**
* constructor for class tx_solr_viewhelper_Relevance
*/
public function __construct(array $arguments = array())
{
if (is_null($this->search)) {
$this->search = t3lib_div::makeInstance('tx_solr_Search');
$this->maxScore = $this->search->getMaximumResultScore();
}
}
示例13: user_rgsg
public function user_rgsg($content, $conf)
{
$sysPageObj = t3lib_div::makeInstance('t3lib_pageSelect');
$rootLine = $sysPageObj->getRootLine($GLOBALS['TSFE']->id);
$TSObj = t3lib_div::makeInstance('t3lib_tsparser_ext');
$TSObj->tt_track = 0;
$TSObj->init();
$TSObj->runThroughTemplates($rootLine);
$TSObj->generateConfig();
$this->conf = $TSObj->setup['plugin.']['tx_rgsmoothgallery_pi1.'];
$split = strpos($GLOBALS['TSFE']->currentRecord, ':');
$id = substr($GLOBALS['TSFE']->currentRecord, $split + 1);
$where = 'uid =' . $id;
$table = 'tt_content';
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('imagewidth,imageheight', $table, $where, $groupBy = '', $orderBy, $limit = '');
$row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
$css .= $row['imagewidth'] ? 'width:' . $row['imagewidth'] . 'px;' : '';
$css .= $row['imageheight'] ? 'height:' . $row['imageheight'] . 'px;' : '';
$GLOBALS['TSFE']->additionalCSS['rgsmoothgallery' . $id] = '#myGallery' . $id . ' {' . $css . '}';
if (t3lib_extMgm::isLoaded('t3mootools')) {
require_once t3lib_extMgm::extPath('t3mootools') . 'class.tx_t3mootools.php';
}
if (defined('T3MOOTOOLS')) {
tx_t3mootools::addMooJS();
} else {
$header .= $this->getPath($this->conf['pathToMootools']) ? '<script src="' . $this->getPath($this->conf['pathToMootools']) . '" type="text/javascript"></script>' : '';
$header .= $this->getPath($this->conf['pathToMootoolsMore']) ? '<script src="' . $this->getPath($this->conf['pathToMootoolsMore']) . '" type="text/javascript"></script>' : '';
}
// path to js + css
$GLOBALS['TSFE']->additionalHeaderData['rgsmoothgallery'] = $header . '
<script src="' . $this->getPath($this->conf['pathToJdgalleryJS']) . '" type="text/javascript"></script>
<link rel="stylesheet" href="' . $this->getPath($this->conf['pathToJdgalleryCSS']) . '" type="text/css" media="screen" />
';
return $content;
}
示例14: checkDataSubmission
function checkDataSubmission($feObj)
{
// config
global $TSFE;
$this->cObj = $TSFE->cObj;
// cObject
$this->confArr = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['wt_doorman']);
// Get backandconfig
$this->removeXSS = t3lib_div::makeInstance('tx_wtdoorman_RemoveXSS');
// Create new instance for removeXSS class
$varsDefinition = $this->string2array($this->confArr['varsDefinition']);
// get config for doorman
if ($this->confArr['pidInRootline'] > -1) {
$pid = t3lib_div::trimExplode(',', $this->confArr['pidInRootline'] . ',' . tslib_cObj::getTreeList($this->confArr['pidInRootline'], 100), 1);
}
// array with all allowed pids
// Let's go
if ($this->confArr['pidInRootline'] > -1 && (in_array($GLOBALS['TSFE']->id, $pid) || $this->confArr['pidInRootline'] == 0)) {
// if current page is allowed
$this->sec = t3lib_div::makeInstance('tx_wtdoorman_security');
// Create new instance for security class
$this->sec->secParams = $this->string2array($this->confArr['varsDefinition']);
// get config for backend definition
$this->sec->delNotSetVars = $this->confArr['clearNotDefinedVars'];
// now allowed params should be deleted or not?
$_GET = $this->sec->sec($_GET);
// overwrite GET params with vars from doorman class
$_POST = $this->sec->sec($_POST);
// overwrite POST params with vars from doorman class
}
}
示例15: user_wtcart_clearCart
/**
* clear cart
*
* @return void
*/
public function user_wtcart_clearCart($content = '', $conf = array())
{
$div = t3lib_div::makeInstance('tx_wtcart_div');
// Create new instance for div functions
$div->removeAllProductsFromSession();
// clear cart now
}