本文整理汇总了PHP中TYPO3\CMS\Core\Extension\ExtensionManager类的典型用法代码示例。如果您正苦于以下问题:PHP ExtensionManager类的具体用法?PHP ExtensionManager怎么用?PHP ExtensionManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ExtensionManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loginFormHook
/**
* Hooks to the felogin extension to provide additional code for FE login
*
* @return array 0 => onSubmit function, 1 => extra fields and required files
*/
public function loginFormHook()
{
$result = array(0 => '', 1 => '');
if (trim($GLOBALS['TYPO3_CONF_VARS']['FE']['loginSecurityLevel']) === 'rsa') {
$backend = \TYPO3\CMS\Rsaauth\Backend\BackendFactory::getBackend();
if ($backend) {
$result[0] = 'tx_rsaauth_feencrypt(this);';
$javascriptPath = \TYPO3\CMS\Core\Extension\ExtensionManager::siteRelPath('rsaauth') . 'resources/';
$files = array('jsbn/jsbn.js', 'jsbn/prng4.js', 'jsbn/rng.js', 'jsbn/rsa.js', 'jsbn/base64.js', 'rsaauth_min.js');
foreach ($files as $file) {
$result[1] .= '<script type="text/javascript" src="' . \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . $javascriptPath . $file . '"></script>';
}
// Generate a new key pair
$keyPair = $backend->createNewKeyPair();
// Save private key
$storage = \TYPO3\CMS\Rsaauth\Storage\StorageFactory::getStorage();
/** @var $storage \TYPO3\CMS\Rsaauth\Storage\AbstractStorage */
$storage->put($keyPair->getPrivateKey());
// Add RSA hidden fields
$result[1] .= '<input type="hidden" id="rsa_n" name="n" value="' . htmlspecialchars($keyPair->getPublicKeyModulus()) . '" />';
$result[1] .= '<input type="hidden" id="rsa_e" name="e" value="' . sprintf('%x', $keyPair->getExponent()) . '" />';
}
}
return $result;
}
示例2: initialize_editor
/**
* Initialize editor
*
* @param integer $pageId
* @param integer $template_uid
* @return integer
* @todo Define visibility
*/
public function initialize_editor($pageId, $template_uid = 0)
{
// Initializes the module. Done in this function because we may need to re-initialize if data is submitted!
global $tmpl, $tplRow, $theConstants;
$tmpl = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\TypoScript\\ExtendedTemplateService');
// Defined global here!
$tmpl->tt_track = 0;
// Do not log time-performance information
$tmpl->init();
$tmpl->ext_localGfxPrefix = \TYPO3\CMS\Core\Extension\ExtensionManager::extPath('tstemplate_ceditor');
$tmpl->ext_localWebGfxPrefix = $GLOBALS['BACK_PATH'] . \TYPO3\CMS\Core\Extension\ExtensionManager::extRelPath('tstemplate_ceditor');
// Get the row of the first VISIBLE template of the page. whereclause like the frontend.
$tplRow = $tmpl->ext_getFirstTemplate($pageId, $template_uid);
// IF there was a template...
if (is_array($tplRow)) {
// Gets the rootLine
$sys_page = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Page\\PageRepository');
$rootLine = $sys_page->getRootLine($pageId);
// This generates the constants/config + hierarchy info for the template.
$tmpl->runThroughTemplates($rootLine, $template_uid);
// The editable constants are returned in an array.
$theConstants = $tmpl->generateConfig_constants();
// The returned constants are sorted in categories, that goes into the $tmpl->categories array
$tmpl->ext_categorizeEditableConstants($theConstants);
// This array will contain key=[expanded constantname], value=linenumber in template. (after edit_divider, if any)
$tmpl->ext_regObjectPositions($tplRow['constants']);
return 1;
}
}
开发者ID:noxludo,项目名称:TYPO3v4-Core,代码行数:37,代码来源:TypoScriptTemplateConstantEditorModuleFunctionController.php
示例3: getSystemLanguages
/**
* Returns array of system languages
*
* Since TYPO3 4.5 the flagIcon is not returned as a filename in "gfx/flags/*" anymore,
* but as a string <flags-xx>. The calling party should call
* t3lib_iconWorks::getSpriteIcon(<flags-xx>) to get an HTML which will represent
* the flag of this language.
*
* @param integer $page_id Page id (only used to get TSconfig configuration setting flag and label for default language)
* @param string $backPath Backpath for flags
* @return array Array with languages (title, uid, flagIcon)
* @todo Define visibility
*/
public function getSystemLanguages($page_id = 0, $backPath = '')
{
$modSharedTSconfig = \TYPO3\CMS\Backend\Utility\BackendUtility::getModTSconfig($page_id, 'mod.SHARED');
$languageIconTitles = array();
// fallback "old iconstyles"
if (preg_match('/\\.gif$/', $modSharedTSconfig['properties']['defaultLanguageFlag'])) {
$modSharedTSconfig['properties']['defaultLanguageFlag'] = str_replace('.gif', '', $modSharedTSconfig['properties']['defaultLanguageFlag']);
}
$languageIconTitles[0] = array('uid' => 0, 'title' => strlen($modSharedTSconfig['properties']['defaultLanguageLabel']) ? $modSharedTSconfig['properties']['defaultLanguageLabel'] . ' (' . $GLOBALS['LANG']->sl('LLL:EXT:lang/locallang_mod_web_list.xml:defaultLanguage') . ')' : $GLOBALS['LANG']->sl('LLL:EXT:lang/locallang_mod_web_list.xml:defaultLanguage'), 'ISOcode' => 'DEF', 'flagIcon' => strlen($modSharedTSconfig['properties']['defaultLanguageFlag']) ? 'flags-' . $modSharedTSconfig['properties']['defaultLanguageFlag'] : 'empty-empty');
// Set "All" language:
$languageIconTitles[-1] = array('uid' => -1, 'title' => $GLOBALS['LANG']->getLL('multipleLanguages'), 'ISOcode' => 'DEF', 'flagIcon' => 'flags-multiple');
// Find all system languages:
$sys_languages = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*', 'sys_language', '');
foreach ($sys_languages as $row) {
$languageIconTitles[$row['uid']] = $row;
if ($row['static_lang_isocode'] && \TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded('static_info_tables')) {
$staticLangRow = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecord('static_languages', $row['static_lang_isocode'], 'lg_iso_2');
if ($staticLangRow['lg_iso_2']) {
$languageIconTitles[$row['uid']]['ISOcode'] = $staticLangRow['lg_iso_2'];
}
}
if (strlen($row['flag'])) {
$languageIconTitles[$row['uid']]['flagIcon'] = \TYPO3\CMS\Backend\Utility\IconUtility::mapRecordTypeToSpriteIconName('sys_language', $row);
}
}
return $languageIconTitles;
}
示例4: getLoginScripts
/**
* Provides form code and javascript for the user setup.
*
* @param array $parameters Parameters to the script
* @param \TYPO3\CMS\Backend\Controller\LoginController $userSetupObject Calling object: user setup module
* @return string The code for the user setup
*/
public function getLoginScripts(array $parameters, \TYPO3\CMS\Setup\Controller\SetupModuleController $userSetupObject)
{
$content = '';
if ($this->isRsaAvailable()) {
// If we can get the backend, we can proceed
$backend = \TYPO3\CMS\Rsaauth\Backend\BackendFactory::getBackend();
$javascriptPath = \TYPO3\CMS\Core\Extension\ExtensionManager::siteRelPath('rsaauth') . 'resources/';
$files = array('jsbn/jsbn.js', 'jsbn/prng4.js', 'jsbn/rng.js', 'jsbn/rsa.js', 'jsbn/base64.js', 'rsaauth_min.js');
$content = '';
foreach ($files as $file) {
$content .= '<script type="text/javascript" src="' . \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . $javascriptPath . $file . '"></script>';
}
// Generate a new key pair
$keyPair = $backend->createNewKeyPair();
// Save private key
$storage = \TYPO3\CMS\Rsaauth\Storage\StorageFactory::getStorage();
/** @var $storage \TYPO3\CMS\Rsaauth\Storage\AbstractStorage */
$storage->put($keyPair->getPrivateKey());
// Add form tag
$form = '<form action="' . \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('user_setup') . '" method="post" name="usersetup" enctype="application/x-www-form-urlencoded" onsubmit="tx_rsaauth_encryptUserSetup();">';
// Add RSA hidden fields
$form .= '<input type="hidden" id="rsa_n" name="n" value="' . htmlspecialchars($keyPair->getPublicKeyModulus()) . '" />';
$form .= '<input type="hidden" id="rsa_e" name="e" value="' . sprintf('%x', $keyPair->getExponent()) . '" />';
$userSetupObject->doc->form = $form;
}
return $content;
}
示例5: initialize
/**
* Initializes the Module
*
* @return void
*/
public function initialize()
{
parent::init();
$this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate');
$this->doc->setModuleTemplate(\TYPO3\CMS\Core\Extension\ExtensionManager::extPath('recycler') . 'mod1/mod_template.html');
$this->doc->backPath = $GLOBALS['BACK_PATH'];
$this->doc->setExtDirectStateProvider();
$this->pageRenderer = $this->doc->getPageRenderer();
$this->relativePath = \TYPO3\CMS\Core\Extension\ExtensionManager::extRelPath('recycler');
$this->pageRecord = \TYPO3\CMS\Backend\Utility\BackendUtility::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']);
}
}
示例6: init
/**
* Initialize, setting what is necessary for browsing pages.
* Using the current user.
*
* @param string $clause Additional clause for selecting pages.
* @param string $orderByFields record ORDER BY field
* @return void
* @todo Define visibility
*/
public function init($clause = '', $orderByFields = '')
{
// This will hide records from display - it has nothing todo with user rights!!
$clauseExcludePidList = '';
if ($pidList = $GLOBALS['BE_USER']->getTSConfigVal('options.hideRecords.pages')) {
if ($pidList = $GLOBALS['TYPO3_DB']->cleanIntList($pidList)) {
$clauseExcludePidList = ' AND pages.uid NOT IN (' . $pidList . ')';
}
}
// This is very important for making trees of pages: Filtering out deleted pages, pages with no access to and sorting them correctly:
parent::init(' AND ' . $GLOBALS['BE_USER']->getPagePermsClause(1) . ' ' . $clause . $clauseExcludePidList, 'sorting');
$this->table = 'pages';
$this->setTreeName('browsePages');
$this->domIdPrefix = 'pages';
$this->iconName = '';
$this->title = $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'];
$this->MOUNTS = $GLOBALS['WEBMOUNTS'];
if ($pidList) {
// Remove mountpoint if explicitly set in options.hideRecords.pages (see above)
$hideList = explode(',', $pidList);
$this->MOUNTS = array_diff($this->MOUNTS, $hideList);
}
$this->fieldArray = array_merge($this->fieldArray, array('doktype', 'php_tree_stop', 't3ver_id', 't3ver_state', 't3ver_wsid', 't3ver_state', 't3ver_move_id'));
if (\TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded('cms')) {
$this->fieldArray = array_merge($this->fieldArray, array('hidden', 'starttime', 'endtime', 'fe_group', 'module', 'extendToSubpages', 'is_siteroot', 'nav_hide'));
}
}
示例7: init
/**
* Init function
* REMEMBER to feed a $clause which will filter out non-readable pages!
*
* @param string $clause Part of where query which will filter out non-readable pages.
* @param string $orderByFields Record ORDER BY field
* @return void
* @todo Define visibility
*/
public function init($clause = '', $orderByFields = '')
{
parent::init(' AND deleted=0 ' . $clause, 'sorting');
if (\TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded('cms')) {
$this->fieldArray = array_merge($this->fieldArray, array('hidden', 'starttime', 'endtime', 'fe_group', 'module', 'extendToSubpages', 'nav_hide'));
}
$this->table = 'pages';
$this->treeName = 'pages';
}
示例8: headerNoCache
/**
* Frontend hook: If the page is not being re-generated this is our chance to force it to be (because re-generation of the page is required in order to have the indexer called!)
*
* @param array Parameters from frontend
* @param object TSFE object (reference under PHP5)
* @return void
*/
public function headerNoCache(array &$params, $ref)
{
// Requirements are that the crawler is loaded, a crawler session is running and re-indexing requested as processing instruction:
if (\TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded('crawler') && $params['pObj']->applicationData['tx_crawler']['running'] && in_array('tx_indexedsearch_reindex', $params['pObj']->applicationData['tx_crawler']['parameters']['procInstructions'])) {
// Setting simple log entry:
$params['pObj']->applicationData['tx_crawler']['log'][] = 'RE_CACHE (indexed), old status: ' . $params['disableAcquireCacheData'];
// Disables a look-up for cached page data - thus resulting in re-generation of the page even if cached.
$params['disableAcquireCacheData'] = TRUE;
}
}
示例9: getLoginScripts
/**
* Provides form code for the superchallenged authentication.
*
* @param array $params Parameters to the script
* @param \TYPO3\CMS\Backend\Controller\LoginController $pObj Calling object
* @return string The code for the login form
*/
public function getLoginScripts(array $params, \TYPO3\CMS\Backend\Controller\LoginController &$pObj)
{
$content = '';
if ($pObj->loginSecurityLevel == 'rsa') {
$javascriptPath = \TYPO3\CMS\Core\Extension\ExtensionManager::siteRelPath('rsaauth') . 'resources/';
$files = array('jsbn/jsbn.js', 'jsbn/prng4.js', 'jsbn/rng.js', 'jsbn/rsa.js', 'jsbn/base64.js', 'rsaauth_min.js');
$content = '';
foreach ($files as $file) {
$content .= '<script type="text/javascript" src="' . \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . $javascriptPath . $file . '"></script>';
}
}
return $content;
}
示例10: render
/**
* Renders the icon
*
* @param string $icon Icon to be used
* @param string $title Optional title
* @return strin Content rendered image
*/
public function render($icon, $title = '')
{
if (!empty($icon)) {
$absIconPath = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFilename($icon);
if (file_exists($absIconPath)) {
$icon = $GLOBALS['BACK_PATH'] . '../' . str_replace(PATH_site, '', $absIconPath);
}
} else {
$icon = \TYPO3\CMS\Core\Extension\ExtensionManager::extRelPath('reports') . 'Resources/Public/moduleicon.gif';
}
$content = '<img' . \t3lib_iconworks::skinImg($GLOBALS['BACK_PATH'], $icon, 'width="16" height="16"') . ' title="' . htmlspecialchars($title) . '" alt="' . htmlspecialchars($title) . '" />';
return $content;
}
示例11: main
/**
* Main Task center module
*
* @return string HTML content.
* @todo Define visibility
*/
public function main()
{
if ($id = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('display')) {
return $this->urlInIframe($this->backPath . \TYPO3\CMS\Core\Extension\ExtensionManager::extRelPath('impexp') . 'app/index.php?tx_impexp[action]=export&preset[load]=1&preset[select]=' . $id, 1);
} else {
// Thumbnail folder and files:
$tempDir = $this->userTempFolder();
if ($tempDir) {
$thumbnails = \TYPO3\CMS\Core\Utility\GeneralUtility::getFilesInDir($tempDir, 'png,gif,jpg', 1);
}
$clause = $GLOBALS['BE_USER']->getPagePermsClause(1);
$usernames = \TYPO3\CMS\Backend\Utility\BackendUtility::getUserNames();
// Create preset links:
$presets = $this->getPresets();
$opt = array();
$opt[] = '
<tr class="bgColor5 tableheader">
<td>Icon:</td>
<td>Preset Title:</td>
<td>Public</td>
<td>Owner:</td>
<td>Page:</td>
<td>Path:</td>
<td>Meta data:</td>
</tr>';
if (is_array($presets)) {
foreach ($presets as $presetCfg) {
$configuration = unserialize($presetCfg['preset_data']);
$thumbnailFile = $thumbnails[$configuration['meta']['thumbnail']];
$title = strlen($presetCfg['title']) ? $presetCfg['title'] : '[' . $presetCfg['uid'] . ']';
$opt[] = '
<tr class="bgColor4">
<td>' . ($thumbnailFile ? '<img src="' . $this->backPath . '../' . substr($tempDir, strlen(PATH_site)) . basename($thumbnailFile) . '" hspace="2" width="70" style="border: solid black 1px;" alt="" /><br />' : ' ') . '</td>
<td nowrap="nowrap"><a href="index.php?SET[function]=tx_impexp&display=' . $presetCfg['uid'] . '">' . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($title, 30)) . '</a> </td>
<td>' . ($presetCfg['public'] ? 'Yes' : ' ') . '</td>
<td>' . ($presetCfg['user_uid'] === $GLOBALS['BE_USER']->user['uid'] ? 'Own' : '[' . $usernames[$presetCfg['user_uid']]['username'] . ']') . '</td>
<td>' . ($configuration['pagetree']['id'] ? $configuration['pagetree']['id'] : ' ') . '</td>
<td>' . htmlspecialchars($configuration['pagetree']['id'] ? \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordPath($configuration['pagetree']['id'], $clause, 20) : '[Single Records]') . '</td>
<td>
<strong>' . htmlspecialchars($configuration['meta']['title']) . '</strong><br />' . htmlspecialchars($configuration['meta']['description']) . ($configuration['meta']['notes'] ? '<br /><br /><strong>Notes:</strong> <em>' . htmlspecialchars($configuration['meta']['notes']) . '</em>' : '') . '
</td>
</tr>';
}
$content = '<table border="0" cellpadding="0" cellspacing="1" class="lrPadding">' . implode('', $opt) . '</table>';
}
}
// Output:
$theOutput .= $this->pObj->doc->spacer(5);
$theOutput .= $this->pObj->doc->section('Export presets', $content, 0, 1);
return $theOutput;
}
示例12: showInstallToolEnableRequest
/**
* Shows warning message about ENABLE_INSTALL_TOOL file and a button to create this file
*
* @return void
*/
protected function showInstallToolEnableRequest()
{
// Create instance of object for output of data
$this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate');
$this->doc->setModuleTemplate(\TYPO3\CMS\Core\Extension\ExtensionManager::extPath('install') . 'mod/mod_template.html');
$this->doc->form = '<form method="post" id="t3-install-form-unlock" action="">';
$this->doc->addStyleSheet('install', 'stylesheets/install/install.css');
$this->doc->addStyleSheet('mod-install', \TYPO3\CMS\Core\Extension\ExtensionManager::extRelPath('install') . 'mod/mod_styles.css');
$markers = $buttons = array();
$markers['CONTENT'] = $this->renderMessage();
$content = $this->doc->moduleBody('', $buttons, $markers);
$this->doc->postCode = '<input type="hidden" name="enableInstallTool" value="1" />' . \TYPO3\CMS\Backend\Form\FormEngine::getHiddenTokenField('installToolEnableToken');
echo $this->doc->render('', $content);
}
示例13: renderByPid
/**
* Render sys_notes by pid
*
* @param string $pidList comma separated list of page ids
* @return string
*/
public function renderByPid($pidList)
{
/** @var $repository \TYPO3\CMS\SysNote\Domain\Repository\SysNoteRepository */
$repository = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\SysNote\\Domain\\Repository\\SysNoteRepository');
$notes = $repository->findAllByPidList($pidList);
$out = '';
if ($this->notesAvailable($notes)) {
/** @var $fluidView \TYPO3\CMS\Fluid\View\StandaloneView */
$fluidView = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Fluid\\View\\StandaloneView');
$templatePathAndFilename = \TYPO3\CMS\Core\Extension\ExtensionManager::extPath('sys_note', 'Resources/Private/Template/List.html');
$fluidView->setTemplatePathAndFilename($templatePathAndFilename);
$fluidView->assign('notes', $notes);
$out = $fluidView->render();
}
return $out;
}
示例14: render
/**
* Resolve workspace title from UID.
*
* @param integer $uid UID of the workspace
* @return string username or UID
*/
public function render($uid)
{
if ($uid === 0) {
return \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('live', $this->controllerContext->getRequest()->getControllerExtensionName());
}
if (!\TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded('workspaces')) {
return '';
}
/** @var $workspace \TYPO3\CMS\Belog\Domain\Model\Workspace */
$workspace = $this->workspaceRepository->findByUid($uid);
if ($workspace !== NULL) {
$title = $workspace->getTitle();
} else {
$title = '';
}
return $title;
}
示例15: performUpdate
/**
* performs the action of the UpdateManager
*
* @param array &$dbQueries: queries done in this update
* @param mixed &$customMessages: custom messages
* @return bool whether everything went smoothly or not
*/
public function performUpdate(array &$dbQueries, &$customMessages)
{
if ($this->versionNumber >= 4004000 && !\TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded('statictemplates')) {
// check wether the table can be truncated or if sysext with tca has to be installed
if ($this->checkForUpdate($customMessages[])) {
try {
\TYPO3\CMS\Core\Extension\ExtensionManager::loadExtension('statictemplates');
$customMessages[] = 'System Extension "statictemplates" was successfully loaded, static templates are now supported.';
$result = TRUE;
} catch (\RuntimeException $e) {
$result = FALSE;
}
return $result;
}
return TRUE;
}
}