本文整理汇总了PHP中TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath方法的典型用法代码示例。如果您正苦于以下问题:PHP ExtensionManagementUtility::siteRelPath方法的具体用法?PHP ExtensionManagementUtility::siteRelPath怎么用?PHP ExtensionManagementUtility::siteRelPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Core\Utility\ExtensionManagementUtility
的用法示例。
在下文中一共展示了ExtensionManagementUtility::siteRelPath方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
/**
* Render the captcha image html
*
* @param string suffix to be appended to the extenstion key when forming css class names
* @return string The html used to render the captcha image
*/
public function render($suffix = '')
{
$value = '';
// Include the required JavaScript
$GLOBALS['TSFE']->additionalHeaderData[$this->extensionKey . '_freeCap'] = '<script type="text/javascript" src="' . GeneralUtility::createVersionNumberedFilename(ExtensionManagementUtility::siteRelPath($this->extensionKey) . 'Resources/Public/JavaScript/freeCap.js') . '"></script>';
// Disable caching
$GLOBALS['TSFE']->no_cache = 1;
// Get the plugin configuration
$settings = $this->configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_SETTINGS, $this->extensionName);
// Get the translation view helper
$objectManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
$translator = $objectManager->get('SJBR\\SrFreecap\\ViewHelpers\\TranslateViewHelper');
$translator->injectConfigurationManager($this->configurationManager);
// Generate the image url
$fakeId = GeneralUtility::shortMD5(uniqid(rand()), 5);
$siteURL = GeneralUtility::getIndpEnv('TYPO3_SITE_URL');
$L = GeneralUtility::_GP('L');
$urlParams = array('eID' => 'sr_freecap_EidDispatcher', 'id' => $GLOBALS['TSFE']->id, 'vendorName' => 'SJBR', 'extensionName' => 'SrFreecap', 'pluginName' => 'ImageGenerator', 'controllerName' => 'ImageGenerator', 'actionName' => 'show', 'formatName' => 'png', 'L' => $GLOBALS['TSFE']->sys_language_uid);
if ($GLOBALS['TSFE']->MP) {
$urlParams['MP'] = $GLOBALS['TSFE']->MP;
}
$urlParams['set'] = $fakeId;
$imageUrl = $siteURL . 'index.php?' . ltrim(GeneralUtility::implodeArrayForUrl('', $urlParams), '&');
// Generate the html text
$value = '<img' . $this->getClassAttribute('image', $suffix) . ' id="tx_srfreecap_captcha_image_' . $fakeId . '"' . ' src="' . htmlspecialchars($imageUrl) . '"' . ' alt="' . $translator->render('altText') . ' "/>' . '<span' . $this->getClassAttribute('cant-read', $suffix) . '>' . $translator->render('cant_read1') . ' <a href="#" onclick="this.blur();' . $this->extensionName . '.newImage(\'' . $fakeId . '\', \'' . $translator->render('noImageMessage') . '\');return false;">' . $translator->render('click_here') . '</a>' . $translator->render('cant_read2') . '</span>';
return $value;
}
示例2: getExtensionSummary
/**
* Returns information about this extension plugin
*
* @param array $params Parameters to the hook
*
* @return string Information about pi1 plugin
* @hook TYPO3_CONF_VARS|SC_OPTIONS|cms/layout/class.tx_cms_layout.php|list_type_Info|calendarize_calendar
*/
public function getExtensionSummary(array $params)
{
$relIconPath = GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . ExtensionManagementUtility::siteRelPath('calendarize') . 'ext_icon.png';
$this->flexFormService = GeneralUtility::makeInstance('HDNET\\Calendarize\\Service\\FlexFormService');
$this->layoutService = GeneralUtility::makeInstance('HDNET\\Calendarize\\Service\\ContentElementLayoutService');
$this->layoutService->setTitle('<img src="' . $relIconPath . '" /> Calendarize');
if ($params['row']['list_type'] != 'calendarize_calendar') {
return '';
}
$this->flexFormService->load($params['row']['pi_flexform']);
if (!$this->flexFormService->isValid()) {
return '';
}
$actions = $this->flexFormService->get('switchableControllerActions', 'main');
$parts = GeneralUtility::trimExplode(';', $actions, true);
$parts = array_map(function ($element) {
$split = explode('->', $element);
return ucfirst($split[1]);
}, $parts);
$actionKey = lcfirst(implode('', $parts));
$this->layoutService->addRow(LocalizationUtility::translate('mode', 'calendarize'), LocalizationUtility::translate('mode.' . $actionKey, 'calendarize'));
$this->layoutService->addRow(LocalizationUtility::translate('configuration', 'calendarize'), $this->flexFormService->get('settings.configuration', 'main'));
if ((bool) $this->flexFormService->get('settings.hidePagination', 'main')) {
$this->layoutService->addRow(LocalizationUtility::translate('hide.pagination.teaser', 'calendarize'), '!!!');
}
$this->addPageIdsToTable();
return $this->layoutService->render();
}
示例3: getDefaultMarkers
/**
* Returns the default markers for the template, with some additional parameters for the error page.
*
* @return array
*/
protected function getDefaultMarkers()
{
$defaultMarkers = parent::getDefaultMarkers();
$defaultMarkers['###EXTPATH_CORE###'] = ExtensionManagementUtility::siteRelPath('core');
$defaultMarkers['###EXTPATH_BACKEND###'] = ExtensionManagementUtility::siteRelPath('backend');
return $defaultMarkers;
}
示例4: getLoginScripts
/**
* Provides form code and javascript for the user setup.
*
* @param array $parameters Parameters to the script
* @param \TYPO3\CMS\Setup\Controller\SetupModuleController $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\Utility\ExtensionManagementUtility::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: 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\Utility\ExtensionManagementUtility::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;
}
示例6: enableRsaEncryption
/**
* Load all necessary Javascript files
*
* @param bool $useRequireJsModule
*/
public function enableRsaEncryption($useRequireJsModule = false)
{
if ($this->moduleLoaded || !$this->isAvailable()) {
return;
}
$this->moduleLoaded = true;
$pageRenderer = GeneralUtility::makeInstance(PageRenderer::class);
// Include necessary javascript files
if ($useRequireJsModule) {
$pageRenderer->loadRequireJsModule('TYPO3/CMS/Rsaauth/RsaEncryptionModule');
} else {
// Register ajax handler url
$code = 'var TYPO3RsaEncryptionPublicKeyUrl = ' . GeneralUtility::quoteJSvalue(GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . 'index.php?eID=RsaPublicKeyGenerationController') . ';';
$pageRenderer->addJsInlineCode('TYPO3RsaEncryptionPublicKeyUrl', $code);
$javascriptPath = ExtensionManagementUtility::siteRelPath('rsaauth') . 'Resources/Public/JavaScript/';
if (!$GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['debug']) {
$files = array('RsaEncryptionWithLib.min.js');
} else {
$files = array('RsaLibrary.js', 'RsaEncryption.js');
}
foreach ($files as $file) {
$pageRenderer->addJsFile($javascriptPath . $file);
}
}
}
示例7: __construct
/**
* Constructor
*/
public function __construct()
{
$this->defaultIcon = '../' . ExtensionManagementUtility::siteRelPath('fluidcontent') . 'Resources/Public/Icons/Plugin.png';
$this->extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['fluidcontent']);
$this->extConf['iconWidth'] = $this->extConf['iconWidth'] ?: self::ICON_WIDTH;
$this->extConf['iconHeight'] = $this->extConf['iconHeight'] ?: self::ICON_HEIGHT;
}
示例8: setNewsletter
/**
* Sets the newsletter
*
* @param Newsletter $newsletter
* @param string $language
* @throws \Exception
*/
public function setNewsletter(Newsletter $newsletter, $language = null)
{
// When sending newsletter via scheduler (so via CLI mode) realurl cannot guess
// the domain name by himself, so we help him by filling HTTP_HOST variable
$_SERVER['HTTP_HOST'] = $newsletter->getDomain();
$_SERVER['SCRIPT_NAME'] = '/index.php';
$this->siteUrl = $newsletter->getBaseUrl() . '/';
$this->linksCache = [];
$this->newsletter = $newsletter;
$this->homeUrl = $this->siteUrl . \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath('newsletter');
$this->senderName = $newsletter->getSenderName();
$this->senderEmail = $newsletter->getSenderEmail();
$this->replytoName = $newsletter->getReplytoName();
$this->replytoEmail = $newsletter->getReplytoEmail();
$bounceAccount = $newsletter->getBounceAccount();
$this->bounceAddress = $bounceAccount ? $bounceAccount->getEmail() : null;
// Build html
$validatedContent = $newsletter->getValidatedContent($language);
if (count($validatedContent['errors'])) {
throw new \Exception('The newsletter HTML content does not validate. The sending is aborted. See errors: ' . serialize($validatedContent['errors']));
}
$this->setHtml($validatedContent['content']);
// Build title from HTML source (we cannot use $newsletter->getTitle(), because it is NOT localized)
$this->setTitle($validatedContent['content']);
// Attaching files
$files = $newsletter->getAttachments();
foreach ($files as $file) {
if (trim($file) != '') {
$filename = PATH_site . "uploads/tx_newsletter/{$file}";
$this->attachments[] = Swift_Attachment::fromPath($filename);
}
}
}
示例9: getEntry
/**
* Renders entry for one page of the current document.
*
* @access protected
*
* @param integer $number: The page to render
* @param string $template: Parsed template subpart
*
* @return string The rendered entry ready for output
*/
protected function getEntry($number, $template)
{
// Set current page if applicable.
if (!empty($this->piVars['page']) && $this->piVars['page'] == $number) {
$markerArray['###STATE###'] = 'cur';
} else {
$markerArray['###STATE###'] = 'no';
}
// Set page number.
$markerArray['###NUMBER###'] = $number;
// Set pagination.
$markerArray['###PAGINATION###'] = $this->doc->physicalPagesInfo[$this->doc->physicalPages[$number]]['label'];
// Get thumbnail or placeholder.
if (!empty($this->doc->physicalPagesInfo[$this->doc->physicalPages[$number]]['files'][$this->conf['fileGrpThumbs']])) {
$thumbnailFile = $this->doc->getFileLocation($this->doc->physicalPagesInfo[$this->doc->physicalPages[$number]]['files'][$this->conf['fileGrpThumbs']]);
} elseif (!empty($this->conf['placeholder'])) {
$thumbnailFile = $GLOBALS['TSFE']->tmpl->getFileName($this->conf['placeholder']);
} else {
$thumbnailFile = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey) . 'plugins/pagegrid/placeholder.jpg';
}
$thumbnail = '<img alt="' . $markerArray['###PAGINATION###'] . '" src="' . $thumbnailFile . '" />';
// Get new plugin variables for typolink.
$piVars = $this->piVars;
// Unset no longer needed plugin variables.
// unset($piVars['pagegrid']) is for DFG Viewer compatibility!
unset($piVars['pointer'], $piVars['DATA'], $piVars['pagegrid']);
$piVars['page'] = $number;
$linkConf = array('useCacheHash' => 1, 'parameter' => $this->conf['targetPid'], 'additionalParams' => \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl($this->prefixId, $piVars, '', TRUE, FALSE), 'title' => $markerArray['###PAGINATION###']);
$markerArray['###THUMBNAIL###'] = $this->cObj->typoLink($thumbnail, $linkConf);
return $this->cObj->substituteMarkerArray($template, $markerArray);
}
示例10: constructPostProcess
/**
* constructPostProcess
*
* @param array $config
* @param \TYPO3\CMS\Backend\Controller\BackendController $backendReference
*/
public function constructPostProcess($config, &$backendReference)
{
$lastPwChange = $GLOBALS['BE_USER']->user['tx_besecurepw_lastpwchange'];
$lastLogin = $GLOBALS['BE_USER']->user['lastlogin'];
// get configuration of a secure password
$extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['be_secure_pw']);
$validUntilConfiguration = trim($extConf['validUntil']);
$validUntil = 0;
if ($validUntilConfiguration != '') {
$validUntil = strtotime('- ' . $validUntilConfiguration);
}
if ($validUntilConfiguration != '' && ($lastPwChange == 0 || $lastPwChange < $validUntil) || $lastLogin == 0) {
// let the popup pop up :)
$generatedLabels = array('passwordReminderWindow_title' => $GLOBALS['LANG']->sL('LLL:EXT:be_secure_pw/Resources/Private/Language/locallang_reminder.xml:passwordReminderWindow_title'), 'passwordReminderWindow_message' => $GLOBALS['LANG']->sL('LLL:EXT:be_secure_pw/Resources/Private/Language/locallang_reminder.xml:passwordReminderWindow_message'), 'passwordReminderWindow_button_changePassword' => $GLOBALS['LANG']->sL('LLL:EXT:be_secure_pw/Resources/Private/Language/locallang_reminder.xml:passwordReminderWindow_button_changePassword'), 'passwordReminderWindow_button_postpone' => $GLOBALS['LANG']->sL('LLL:EXT:be_secure_pw/Resources/Private/Language/locallang_reminder.xml:passwordReminderWindow_button_postpone'));
// Convert labels/settings back to UTF-8 since json_encode() only works with UTF-8:
if ($GLOBALS['LANG']->charSet !== 'utf-8') {
$GLOBALS['LANG']->csConvObj->convArray($generatedLabels, $GLOBALS['LANG']->charSet, 'utf-8');
}
$labelsForJS = 'TYPO3.LLL.beSecurePw = ' . json_encode($generatedLabels) . ';';
$backendReference->addJavascript($labelsForJS);
$version7 = \TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger('7.0.0');
$currentVersion = \TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version);
if ($currentVersion < $version7) {
$javaScriptFile = 'passwordreminder.js';
} else {
$javaScriptFile = 'passwordreminder7.js';
}
$backendReference->addJavascriptFile($GLOBALS['BACK_PATH'] . '../' . ExtensionManagementUtility::siteRelPath('be_secure_pw') . 'Resources/Public/JavaScript/' . $javaScriptFile);
}
}
示例11: show3dAction
/**
* action show
* @return void
*/
public function show3dAction()
{
if ($this->settings['general']['mode3d'] == 1) {
// get relative typo path
$relPath = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath('vk2');
// render different js library regarding if production or debug mode
if ($this->settings['general']['debug'] == 1) {
$GLOBALS['TSFE']->additionalHeaderData[] = '
<script type="text/javascript" src="' . $relPath . 'Resources/Public/dist/Cesium/Cesium.js"></script>
<script type="text/javascript" src="' . $relPath . 'Resources/Public/dist/ol3cesium-debug.js"></script>
<script type="text/javascript" src="' . $relPath . 'Resources/Public/lib/closure-library/closure/goog/base.js"></script>
<script type="text/javascript" src="' . $relPath . 'Resources/Public/lib/closure-library/closure/goog/deps.js"></script>
<script type="text/javascript" src="' . $relPath . 'Resources/Public/src/vk2-deps.js"></script>';
} else {
$GLOBALS['TSFE']->additionalHeaderData[] = '
<script type="text/javascript" src="' . $relPath . 'Resources/Public/dist/Cesium/Cesium.js"></script>
<script type="text/javascript" src="' . $relPath . 'Resources/Public/dist/ol3cesium.js"></script>
<script type="text/javascript" src="' . $relPath . 'Resources/Public/dist/vk2-min.js"></script>';
}
\SLUB\Vk2\Utils\Tools::renderClientSettings($this->settings);
} else {
// 2.5d mode is deactivated
// redirect to main page
$this->redirect('show', 'Main', NULL);
}
}
示例12: __construct
/**
* Initializes the Module
*
* @return void
*/
public function __construct()
{
parent::init();
// Initialize document
$this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate');
$this->doc->setModuleTemplate(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('taskcenter') . 'res/mod_template.html');
$this->doc->backPath = $GLOBALS['BACK_PATH'];
$this->doc->getPageRenderer()->loadScriptaculous('effects,dragdrop');
$this->doc->addStyleSheet('tx_taskcenter', '../' . \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath('taskcenter') . 'res/mod_styles.css');
}
示例13: render
/**
*
* @param string $name
* @return NULL
*/
public function render($name)
{
$pageRenderer = $this->getPageRenderer();
$block = $this->renderChildren();
$pageRenderer->addJsLibrary('googlemap', 'http://maps.google.com/maps/api/js?v=3&sensor=false', 'text/javascript', false, false, '', true);
$pageRenderer->addJsLibrary('infobox', 'http://google-maps-utility-library-v3.googlecode.com/svn/trunk/infobox/src/infobox.js', 'text/javascript', false, false, '', true);
$pageRenderer->addCssFile($this->templateVariableContainer->get('settings')['cssfile'] ?: \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath(easy_googlemap) . 'Resources/Public/css/map.css');
$pageRenderer->addJsFooterInlineCode($name, $block, $compress, $forceOnTop);
return null;
}
示例14: renderForeignRecordHeaderControl_postProcess
/**
* Post-processing to define which control items to show. Possibly own icons can be added here.
*
* @param string $parentUid The uid of the parent (embedding) record (uid or NEW...)
* @param string $foreignTable The table (foreign_table) we create control-icons for
* @param array $childRecord The current record of that foreign_table
* @param array $childConfig TCA configuration of the current field of the child record
* @param bool $isVirtual Defines whether the current records is only virtually shown and not physically part of the parent record
* @param array &$controlItems (reference) Associative array with the currently available control items
* @return void
*/
public function renderForeignRecordHeaderControl_postProcess($parentUid, $foreignTable, array $childRecord, array $childConfig, $isVirtual, array &$controlItems)
{
if ($foreignTable === 'sys_file_reference' && !empty($childRecord['showinpreview'])) {
$ll = 'LLL:EXT:news/Resources/Private/Language/locallang_db.xlf:';
$label = $GLOBALS['LANG']->sL($ll . 'tx_news_domain_model_media.showinpreview', true);
$icon = '../' . \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath('news') . 'Resources/Public/Icons/preview.gif';
$extraItem = ['showinpreview' => ' <span class="btn btn-default"><img title="' . $label . '" src="' . $icon . '" /></span>'];
$controlItems = $extraItem + $controlItems;
}
}
示例15: initialize
/**
*
* Initialize ViewHelper
*/
public function initialize()
{
$this->extKey = $this->controllerContext->getRequest()->getControllerExtensionKey();
$this->extPath = ExtensionManagementUtility::extPath($this->extKey);
$this->relExtPath = ExtensionManagementUtility::siteRelPath($this->extKey);
if (TYPO3_MODE === 'BE') {
$this->initializeBackend();
} else {
$this->initializeFrontend();
}
}