本文整理汇总了PHP中TYPO3\CMS\Core\Extension\ExtensionManager::siteRelPath方法的典型用法代码示例。如果您正苦于以下问题:PHP ExtensionManager::siteRelPath方法的具体用法?PHP ExtensionManager::siteRelPath怎么用?PHP ExtensionManager::siteRelPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Core\Extension\ExtensionManager
的用法示例。
在下文中一共展示了ExtensionManager::siteRelPath方法的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: 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;
}
示例3: __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\Extension\ExtensionManager::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\Extension\ExtensionManager::siteRelPath('taskcenter') . 'res/mod_styles.css');
}
示例4: 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;
}
示例5: makeAccessIndication
/**
* Returns the HTML code for the locking symbol.
* NOTICE: Requires a call to ->getPathFromPageId() first in order to work (done in ->makeInfo() by calling that first)
*
* @param integer Page id for which to find answer
* @return string <img> tag if access is limited.
* @todo Define visibility
*/
public function makeAccessIndication($id)
{
if (is_array($this->fe_groups_required[$id]) && count($this->fe_groups_required[$id])) {
return '<img src="' . \TYPO3\CMS\Core\Extension\ExtensionManager::siteRelPath('indexed_search') . 'pi/res/locked.gif" width="12" height="15" vspace="5" title="' . sprintf($this->pi_getLL('res_memberGroups', '', 1), implode(',', array_unique($this->fe_groups_required[$id]))) . '" alt="" />';
}
}
示例6: getFileName
/**
* Returns the reference to a 'resource' in TypoScript.
* This could be from the filesystem if '/' is found in the value $fileFromSetup, else from the resource-list
*
* @param string $fileFromSetup TypoScript "resource" data type value.
* @return string Resulting filename, if any.
* @todo Define visibility
*/
public function getFileName($fileFromSetup)
{
$file = trim($fileFromSetup);
if (!$file) {
return;
} elseif (strstr($file, '../')) {
if ($this->tt_track) {
$GLOBALS['TT']->setTSlogMessage('File path "' . $file . '" contained illegal string "../"!', 3);
}
return;
}
// Cache
$hash = md5($file);
if (isset($this->fileCache[$hash])) {
return $this->fileCache[$hash];
}
if (!strcmp(substr($file, 0, 4), 'EXT:')) {
$newFile = '';
list($extKey, $script) = explode('/', substr($file, 4), 2);
if ($extKey && \TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded($extKey)) {
$extPath = \TYPO3\CMS\Core\Extension\ExtensionManager::extPath($extKey);
$newFile = substr($extPath, strlen(PATH_site)) . $script;
}
if (!@is_file(PATH_site . $newFile)) {
if ($this->tt_track) {
$GLOBALS['TT']->setTSlogMessage('Extension media file "' . $newFile . '" was not found!', 3);
}
return;
} else {
$file = $newFile;
}
}
if (parse_url($file) !== FALSE) {
return $file;
}
// Find
if (strpos($file, '/') !== FALSE) {
// If the file is in the media/ folder but it doesn't exist,
// it is assumed that it's in the tslib folder
if (\TYPO3\CMS\Core\Utility\GeneralUtility::isFirstPartOfStr($file, 'media/') && !is_file($this->getFileName_backPath . $file)) {
$file = \TYPO3\CMS\Core\Extension\ExtensionManager::siteRelPath('cms') . 'tslib/' . $file;
}
if (is_file($this->getFileName_backPath . $file)) {
$outFile = $file;
$fileInfo = \TYPO3\CMS\Core\Utility\GeneralUtility::split_fileref($outFile);
$OK = 0;
foreach ($this->allowedPaths as $val) {
if (substr($fileInfo['path'], 0, strlen($val)) == $val) {
$OK = 1;
break;
}
}
if ($OK) {
$this->fileCache[$hash] = $outFile;
return $outFile;
} elseif ($this->tt_track) {
$GLOBALS['TT']->setTSlogMessage('"' . $file . '" was not located in the allowed paths: (' . implode(',', $this->allowedPaths) . ')', 3);
}
} elseif ($this->tt_track) {
$GLOBALS['TT']->setTSlogMessage('"' . $this->getFileName_backPath . $file . '" is not a file (non-uploads/.. resource, did not exist).', 3);
}
}
}
示例7: extProc_finish
/**
* Putting things together, in particular the JavaScript code needed for the DHTML menu.
*
* @return string Empty string! (Since $GLOBALS['TSFE']->divSection is set with the <div>-sections used in the menu)
* @todo Define visibility
*/
public function extProc_finish()
{
$bHeight = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->mconf['bottomHeight'] ? $this->mconf['bottomHeight'] : 100, 0, 3000);
$bottomContent = $this->mconf['bottomContent'] ? $GLOBALS['TSFE']->cObj->cObjGetSingle($this->mconf['bottomContent'], $this->mconf['bottomContent.'], '/GMENU_FOLDOUT/.bottomContent') : '';
$adjustTopHeights = intval($this->mconf['adjustItemsH']);
$adjustSubHeights = intval($this->mconf['adjustSubItemsH']);
$mWidth = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->mconf['menuWidth'] ? $this->mconf['menuWidth'] : 170, 0, 3000);
$mHeight = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->mconf['menuHeight'] ? $this->mconf['menuHeight'] : 400, 0, 3000);
$insertmColor = $this->mconf['menuBackColor'] ? 'BACKGROUND-COLOR: ' . $this->mconf['menuBackColor'] . '; layer-background-color: ' . $this->mconf['menuBackColor'] : '';
$insertBottomColor = $this->mconf['bottomBackColor'] ? 'BACKGROUND-COLOR: ' . $this->mconf['bottomBackColor'] . '; layer-background-color: ' . $this->mconf['bottomBackColor'] : '';
$menuOffset = \TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $this->mconf['menuOffset'] . ',');
$subOffset = \TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $this->mconf['subMenuOffset'] . ',');
$GLOBALS['TSFE']->additionalHeaderData['gmenu_layer_shared'] = '<script type="text/javascript" src="' . \TYPO3\CMS\Core\Extension\ExtensionManager::siteRelPath('statictemplates') . 'media/scripts/jsfunc.layermenu.js"></script>';
$GLOBALS['TSFE']->additionalHeaderData['gmenu_foldout'] = '<script type="text/javascript" src="' . \TYPO3\CMS\Core\Extension\ExtensionManager::siteRelPath('statictemplates') . 'media/scripts/jsfunc.foldout.js"></script>';
$GLOBALS['TSFE']->additionalHeaderData[] .= '
<style type="text/css">
/*<![CDATA[*/
#divCont {
Z-INDEX: 1; LEFT: ' . $menuOffset[0] . 'px; VISIBILITY: hidden; WIDTH: ' . $mWidth . 'px; POSITION: absolute; TOP: ' . $menuOffset[1] . 'px; HEIGHT: ' . $mHeight . 'px
}
.clTop {
Z-INDEX: 1; WIDTH: ' . $mWidth . 'px; POSITION: absolute; ' . $insertmColor . '
}
.clSub {
Z-INDEX: 1; LEFT: ' . $subOffset[0] . 'px; WIDTH: ' . $mWidth . 'px; POSITION: absolute; TOP: ' . $subOffset[1] . 'px
}
.bottomLayer {
Z-INDEX: 1; WIDTH: ' . $mWidth . 'px; CLIP: rect(0px ' . $mWidth . 'px ' . $bHeight . 'px 0px); POSITION: absolute; HEIGHT: ' . $bHeight . 'px; ' . $insertBottomColor . '
}
/*]]>*/
</style>
<script type="text/javascript">
/*<![CDATA[*/
<!--
GFV_foldNumber=' . $this->WMmenuItems . '; //How many toplinks do you have?
GFV_foldTimer=' . \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->mconf['foldTimer'] ? $this->mconf['foldTimer'] : 40, 1, 3000) . '; //The timeout in the animation, these are milliseconds.
GFV_foldSpeed=' . \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->mconf['foldSpeed'], 1, 100) . '; //How many steps in an animation?
GFV_stayFolded=' . ($this->mconf['stayFolded'] ? 'true' : 'false') . '; //Stay open when you click a new toplink?
GFV_foldImg=' . $this->WMimagesFlag . '; //Do you want images (if not set to 0 and remove the images from the body)?
GFV_currentFold=null;
GFV_foldStep1=null;
GFV_foldStep2=null;
GFV_step=0;
GFV_active=false; //Don\'t change this one.
GFV_adjustTopHeights = ' . $adjustTopHeights . ';
GFV_adjustSubHeights = ' . $adjustSubHeights . ';
if (bw.opera) {
GFV_scrX= innerWidth;
GFV_scrY= innerHeight;
}
//This is the default image.
//Remember to change the actual images in the page as well, but remember to keep the name of the image.
var GFV_unImg=new Image();
GFV_unImg.src="' . $GLOBALS['TSFE']->absRefPrefix . $this->WMarrowNO[3] . '";
var GFV_exImg=new Image(); //Making an image variable...
GFV_exImg.src="' . $GLOBALS['TSFE']->absRefPrefix . $this->WMarrowACT[3] . '"; //...this is the source of the image that it changes to when the menu expands.
//-->
/*]]>*/
</script>
';
$GLOBALS['TSFE']->JSeventFuncCalls['onmousemove']['GF_resizeForOpera()'] = 'GF_resizeForOpera();';
$GLOBALS['TSFE']->JSeventFuncCalls['onload']['GMENU_FOLDOUT'] = 'if(bw.bw) {GF_initFoldout();' . $this->WM_activeOnLoad . '}';
$GLOBALS['TSFE']->divSection .= '
<div id="divCont"><!-- These are the contents of the foldoutmenu. -->
' . $this->tmpl->wrap($this->WMresult, $this->mconf['wrap']) . '
<div class="bottomLayer" id="divTop' . ($this->WMmenuItems + 1) . '">
<div class="clSub" id="divSub' . ($this->WMmenuItems + 1) . '"><!-- This is a cover layer, it should always be the last one, and does NOT count in your number of toplinks! --><!-- So if this one is divTop7, the GFV_foldNumber variable should be set to 6 --><!-- This layer covers up the last sub, so if the last sub gets too big, increase this layers size in the stylesheet. --><!-- There are tables with width="100%" around the toplinks, to force NS4 to use the real width specified for the toplinks in the stylesheet. -->
</div>' . $this->tmpl->wrap($bottomContent, $this->WMtableWrap) . '
</div>
</div><!-- Here ends the foldoutmenu. -->
';
return '';
}
示例8: getPathToPluginDirectory
/**
* Returns the path to the plugin directory, if any
*
* @return string the full path to the plugin directory
*/
public function getPathToPluginDirectory()
{
return $this->relativePathToPluginDirectory ? $this->htmlAreaRTE->httpTypo3Path . \TYPO3\CMS\Core\Extension\ExtensionManager::siteRelPath($this->extensionKey) . $this->relativePathToPluginDirectory : '';
}
示例9: getFullFileName
public function getFullFileName($filename)
{
if (substr($filename, 0, 4) == 'EXT:') {
// extension
list($extKey, $local) = explode('/', substr($filename, 4), 2);
$newFilename = '';
if (strcmp($extKey, '') && \TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded($extKey) && strcmp($local, '')) {
$newFilename = ($this->is_FE() || $this->isFrontendEditActive() ? \TYPO3\CMS\Core\Extension\ExtensionManager::siteRelPath($extKey) : $this->backPath . \TYPO3\CMS\Core\Extension\ExtensionManager::extRelPath($extKey)) . $local;
}
} elseif (substr($filename, 0, 1) != '/') {
$newFilename = ($this->is_FE() || $this->isFrontendEditActive() ? '' : $this->backPath . '../') . $filename;
} else {
$newFilename = ($this->is_FE() || $this->isFrontendEditActive() ? '' : $this->backPath . '../') . substr($filename, 1);
}
return \TYPO3\CMS\Core\Utility\GeneralUtility::resolveBackPath($newFilename);
}
示例10: extProc_finish
//.........这里部分代码省略.........
$DoTop[] = 'GLV_menuOn["' . $this->WMid . '"].left = (' . $relCode['X'] . intval($this->mconf['leftOffset']) . $dirL . ')+"px";';
}
}
}
// BordersWithIn:
$DoTop[] = $this->extCalcBorderWithin('left', $this->WMbordersWithin[0]);
$DoTop[] = $this->extCalcBorderWithin('top', $this->WMbordersWithin[1]);
$DoTop[] = $this->extCalcBorderWithin('right', $this->WMbordersWithin[2]);
$DoTop[] = $this->extCalcBorderWithin('bottom', $this->WMbordersWithin[3]);
$DoTop[] = $this->extCalcBorderWithin('left', $this->WMbordersWithin[4]);
$DoTop[] = $this->extCalcBorderWithin('top', $this->WMbordersWithin[5]);
if ($this->mconf['freezeMouseover'] && !$this->mconf['freezeMouseover.']['alwaysKeep']) {
$this->WMhideCode .= '
GL' . $this->WMid . '_out("");';
}
$TEST = '';
if (count($GLOBALS['TSFE']->applicationData['GMENU_LAYERS']['WMid'])) {
foreach ($GLOBALS['TSFE']->applicationData['GMENU_LAYERS']['WMid'] as $mIdStr) {
$this->WMhideCode .= '
GL_hideAll("' . $mIdStr . '");';
$this->WMrestoreScript .= '
GL_restoreMenu("' . $mIdStr . '");';
$this->WMresetSubMenus .= '
if (!GLV_doReset["' . $mIdStr . '"] && GLV_currentLayer["' . $mIdStr . '"]!=null) resetSubMenu=0;';
}
}
// IESelectFix - Adds IFRAME tag to HTML, Hides IFRAME layer below menu
if ($this->mconf['ieSelectFix']) {
$this->WMhideCode .= '
GL_iframer(\'' . $this->WMid . '\',\'\',false);';
$this->divLayers['iframe'] = '<iframe id="Iframe' . $this->WMid . '" scrolling="no" frameborder="0" style="position:absolute; top:0px; left:0px; background-color:transparent; layer-background-color:transparent; display:none;"></iframe>';
}
$GLOBALS['TSFE']->applicationData['GMENU_LAYERS']['WMid'] = array_merge($this->WMtempStore, $GLOBALS['TSFE']->applicationData['GMENU_LAYERS']['WMid']);
$GLOBALS['TSFE']->additionalHeaderData['gmenu_layer_shared'] = '<script type="text/javascript" src="' . \TYPO3\CMS\Core\Extension\ExtensionManager::siteRelPath('statictemplates') . 'media/scripts/jsfunc.layermenu.js"></script>';
$GLOBALS['TSFE']->JSCode .= '
GLV_curLayerWidth["' . $this->WMid . '"]=0;
GLV_curLayerHeight["' . $this->WMid . '"]=0;
GLV_curLayerX["' . $this->WMid . '"]=0;
GLV_curLayerY["' . $this->WMid . '"]=0;
GLV_menuOn["' . $this->WMid . '"] = null;
GLV_gap["' . $this->WMid . '"]=' . \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->mconf['hideMenuWhenNotOver'], 0, 600) . ';
GLV_currentLayer["' . $this->WMid . '"] = null;
GLV_currentROitem["' . $this->WMid . '"] = null;
GLV_hasBeenOver["' . $this->WMid . '"]=0;
GLV_doReset["' . $this->WMid . '"]=false;
GLV_lastKey["' . $this->WMid . '"] = "' . $this->WMlastKey . '";
GLV_onlyOnLoad["' . $this->WMid . '"] = ' . ($this->WMonlyOnLoad ? 1 : 0) . ';
GLV_dontHideOnMouseUp["' . $this->WMid . '"] = ' . ($this->mconf['dontHideOnMouseUp'] ? 1 : 0) . ';
GLV_dontFollowMouse["' . $this->WMid . '"] = ' . ($this->mconf['dontFollowMouse'] ? 1 : 0) . ';
GLV_date = new Date();
GLV_timeout["' . $this->WMid . '"] = GLV_date.getTime();
GLV_timeoutRef["' . $this->WMid . '"] = ' . \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->mconf['hideMenuTimer'], 0, 20000) . ';
GLV_menuXY["' . $this->WMid . '"] = new Array();
' . implode(LF, $this->WMxyArray) . '
' . $this->WMrestoreVars;
if ($this->mconf['freezeMouseover']) {
$GLOBALS['TSFE']->JSCode .= '
// Alternative rollover/out functions for use with GMENU_LAYER
function GL' . $this->WMid . '_over(mitm_id) {
GL' . $this->WMid . '_out(""); // removes any old roll over state of an item. Needed for alwaysKeep and Opera browsers.
switch(mitm_id) {
' . implode(LF, $this->VMmouseoverActions) . '
}
GLV_currentROitem["' . $this->WMid . '"]=mitm_id;
}
示例11: getBackPath
/**
* Calculates the path to the TYPO3 directory from the current directory
*
* @return string
*/
protected function getBackPath()
{
$extPath = \TYPO3\CMS\Core\Extension\ExtensionManager::siteRelPath('openid');
$segmentCount = count(explode('/', $extPath));
$path = str_pad('', $segmentCount * 3, '../') . TYPO3_mainDir;
return $path;
}
示例12: main
//.........这里部分代码省略.........
header('Pragma: no-cache');
if ($to_p_dict || $to_r_list) {
$tmpFileName = \TYPO3\CMS\Core\Utility\GeneralUtility::tempnam($this->filePrefix);
$filehandle = fopen($tmpFileName, 'wb');
if ($filehandle) {
// Get the character set of the main dictionary
// We need to convert the input into the character set of the main dictionary
$mainDictionaryCharacterSet = $this->getMainDictionaryCharacterSet();
// Write the personal words addition commands to the temporary file
foreach ($to_p_dict as $personal_word) {
$cmd = '&' . $this->csConvObj->conv($personal_word, $this->parserCharset, $mainDictionaryCharacterSet) . LF;
fwrite($filehandle, $cmd, strlen($cmd));
}
// Write the replacent pairs addition commands to the temporary file
foreach ($to_r_list as $replace_pair) {
$cmd = '$$ra ' . $this->csConvObj->conv($replace_pair[0], $this->parserCharset, $mainDictionaryCharacterSet) . ' , ' . $this->csConvObj->conv($replace_pair[1], $this->parserCharset, $mainDictionaryCharacterSet) . LF;
fwrite($filehandle, $cmd, strlen($cmd));
}
$cmd = '#' . LF;
fwrite($filehandle, $cmd, strlen($cmd));
// Assemble the Aspell command
$AspellCommand = (TYPO3_OS === 'WIN' ? 'type ' : 'cat ') . escapeshellarg($tmpFileName) . ' | ' . $this->AspellDirectory . ' -a --mode=none' . ($this->personalDictionaryPath ? ' --home-dir=' . escapeshellarg($this->personalDictionaryPath) : '') . ' --lang=' . escapeshellarg($this->dictionary) . ' --encoding=' . escapeshellarg($mainDictionaryCharacterSet) . ' 2>&1';
$AspellAnswer = shell_exec($AspellCommand);
// Close and delete the temporary file
fclose($filehandle);
\TYPO3\CMS\Core\Utility\GeneralUtility::unlink_tempfile($tmpFileName);
echo 'Personal word list was updated.';
} else {
\TYPO3\CMS\Core\Utility\GeneralUtility::sysLog('SpellChecker tempfile open error: ' . $tmpFileName, $this->extKey, \TYPO3\CMS\Core\Utility\GeneralUtility::SYSLOG_SEVERITY_ERROR);
echo 'SpellChecker tempfile open error.';
}
} else {
echo 'Nothing to add to the personal word list.';
}
flush();
die;
} else {
// Check spelling content
// Initialize output
$this->result = '<?xml version="1.0" encoding="' . $this->parserCharset . '"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="' . substr($this->dictionary, 0, 2) . '" lang="' . substr($this->dictionary, 0, 2) . '">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=' . $this->parserCharset . '" />
<link rel="stylesheet" type="text/css" media="all" href="' . (TYPO3_MODE == 'BE' ? '../' : '') . \TYPO3\CMS\Core\Extension\ExtensionManager::siteRelPath($this->extKey) . '/htmlarea/plugins/SpellChecker/spell-check-style.css" />
<script type="text/javascript">
/*<![CDATA[*/
<!--
';
// Getting the input content
$content = \TYPO3\CMS\Core\Utility\GeneralUtility::_POST('content');
// Parsing the input HTML
$parser = xml_parser_create(strtoupper($this->parserCharset));
xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
xml_set_object($parser, $this);
if (!xml_set_element_handler($parser, 'startHandler', 'endHandler')) {
echo 'Bad xml handler setting';
}
if (!xml_set_character_data_handler($parser, 'collectDataHandler')) {
echo 'Bad xml handler setting';
}
if (!xml_set_default_handler($parser, 'defaultHandler')) {
echo 'Bad xml handler setting';
}
if (!xml_parse($parser, '<?xml version="1.0" encoding="' . $this->parserCharset . '"?><spellchecker> ' . preg_replace('/ /' . ($this->parserCharset == 'utf-8' ? 'u' : ''), ' ', $content) . ' </spellchecker>')) {
echo 'Bad parsing';
}
if (xml_get_error_code($parser)) {
throw new \UnexpectedException('Line ' . xml_get_current_line_number($parser) . ': ' . xml_error_string(xml_get_error_code($parser)), 1294585788);
}
xml_parser_free($parser);
if ($this->pspell_is_available && !$this->forceCommandMode) {
pspell_clear_session($this->pspell_link);
}
$this->result .= 'var suggestedWords = {' . $this->suggestedWords . '};
var dictionaries = "' . $dictionaryList . '";
var selectedDictionary = "' . $this->dictionary . '";
';
// Calculating parsing and spell checkting time
$time = number_format(microtime(TRUE) - $time_start, 2, ',', ' ');
// Insert spellcheck info
$this->result .= 'var spellcheckInfo = { "Total words":"' . $this->wordCount . '","Misspelled words":"' . sizeof($this->misspelled) . '","Total suggestions":"' . $this->suggestionCount . '","Total words suggested":"' . $this->suggestedWordCount . '","Spelling checked in":"' . $time . '" };
// -->
/*]]>*/
</script>
</head>
';
$this->result .= '<body onload="window.parent.RTEarea[\'' . \TYPO3\CMS\Core\Utility\GeneralUtility::_POST('editorId') . '\'].editor.getPlugin(\'SpellChecker\').spellCheckComplete();">';
$this->result .= preg_replace('/' . preg_quote('<?xml') . '.*' . preg_quote('?>') . '[' . preg_quote(LF . CR . chr(32)) . ']*/' . ($this->parserCharset == 'utf-8' ? 'u' : ''), '', $this->text);
$this->result .= '<div style="display: none;">' . $dictionaries . '</div>';
// Closing
$this->result .= '
</body></html>';
// Outputting
header('Content-Type: text/html; charset=' . strtoupper($this->parserCharset));
echo $this->result;
}
}
示例13: compileSingleResultRow
/**
* This prints a single result row, including a recursive call for subrows.
*
* @param array $row Search result row
* @param integer $headerOnly 1=Display only header (for sub-rows!), 2=nothing at all
* @return string HTML code
*/
protected function compileSingleResultRow($row, $headerOnly = 0)
{
$specRowConf = $this->getSpecialConfigForResultRow($row);
$resultData = $row;
$resultData['headerOnly'] = $headerOnly;
$resultData['CSSsuffix'] = $specRowConf['CSSsuffix'] ? '-' . $specRowConf['CSSsuffix'] : '';
if ($this->multiplePagesType($row['item_type'])) {
$dat = unserialize($row['cHashParams']);
$pp = explode('-', $dat['key']);
if ($pp[0] != $pp[1]) {
$resultData['titleaddition'] = ', ' . \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('result.page', 'indexed_search') . ' ' . $dat['key'];
} else {
$resultData['titleaddition'] = ', ' . \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('result.pages', 'indexed_search') . ' ' . $pp[0];
}
}
$title = $resultData['item_title'] . $resultData['titleaddition'];
$title = htmlspecialchars($title);
// If external media, link to the media-file instead.
if ($row['item_type']) {
if ($row['show_resume']) {
// Can link directly.
$targetAttribute = '';
if ($GLOBALS['TSFE']->config['config']['fileTarget']) {
$targetAttribute = ' target="' . htmlspecialchars($GLOBALS['TSFE']->config['config']['fileTarget']) . '"';
}
$title = '<a href="' . htmlspecialchars($row['data_filename']) . '"' . $targetAttribute . '>' . $title . '</a>';
} else {
// Suspicious, so linking to page instead...
$copiedRow = $row;
unset($copiedRow['cHashParams']);
$title = $this->linkPage($row['page_id'], $title, $copiedRow);
}
} else {
// Else the page:
// Prepare search words for markup in content:
if ($this->settings['forwardSearchWordsInResultLink']) {
$markUpSwParams = array('no_cache' => 1);
foreach ($this->sWArr as $d) {
$markUpSwParams['sword_list'][] = $d['sword'];
}
} else {
$markUpSwParams = array();
}
$title = $this->linkPage($row['data_page_id'], $title, $row, $markUpSwParams);
}
$resultData['title'] = $title;
$resultData['icon'] = $this->makeItemTypeIcon($row['item_type'], '', $specRowConf);
$resultData['rating'] = $this->makeRating($row);
$resultData['description'] = $this->makeDescription($row, $this->searchData['extResume'] && !$headerOnly ? 0 : 1);
$resultData['language'] = $this->makeLanguageIndication($row);
$resultData['size'] = \TYPO3\CMS\Core\Utility\GeneralUtility::formatSize($row['item_size']);
$resultData['created'] = $row['item_crdate'];
$resultData['modified'] = $row['item_mtime'];
$pI = parse_url($row['data_filename']);
if ($pI['scheme']) {
$targetAttribute = '';
if ($GLOBALS['TSFE']->config['config']['fileTarget']) {
$targetAttribute = ' target="' . htmlspecialchars($GLOBALS['TSFE']->config['config']['fileTarget']) . '"';
}
$resultData['path'] = '<a href="' . htmlspecialchars($row['data_filename']) . '"' . $targetAttribute . '>' . htmlspecialchars($row['data_filename']) . '</a>';
} else {
$pathId = $row['data_page_id'] ? $row['data_page_id'] : $row['page_id'];
$pathMP = $row['data_page_id'] ? $row['data_page_mp'] : '';
$pathStr = htmlspecialchars($this->getPathFromPageId($pathId, $pathMP));
$resultData['path'] = $this->linkPage($pathId, $pathStr, array('cHashParams' => $row['cHashParams'], 'data_page_type' => $row['data_page_type'], 'data_page_mp' => $pathMP, 'sys_language_uid' => $row['sys_language_uid']));
// check if the access is restricted
if (is_array($this->requiredFrontendUsergroups[$id]) && count($this->requiredFrontendUsergroups[$id])) {
$resultData['access'] = '<img src="' . \TYPO3\CMS\Core\Extension\ExtensionManager::siteRelPath('indexed_search') . 'pi/res/locked.gif" width="12" height="15" vspace="5" title="' . sprintf(\TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('result.memberGroups', 'indexed_search'), implode(',', array_unique($this->requiredFrontendUsergroups[$id]))) . '" alt="" />';
}
}
// If there are subrows (eg. subpages in a PDF-file or if a duplicate page
// is selected due to user-login (phash_grouping))
if (is_array($row['_sub'])) {
$resultData['subresults'] = array();
if ($this->multiplePagesType($row['item_type'])) {
$resultData['subresults']['header'] = \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('result.otherMatching', 'indexed_search');
foreach ($row['_sub'] as $subRow) {
$resultData['subresults']['items'][] = $this->compileSingleResultRow($subRow, 1);
}
} else {
$resultData['subresults']['header'] = \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('result.otherMatching', 'indexed_search');
$resultData['subresults']['info'] = \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('result.otherPageAsWell', 'indexed_search');
}
}
return $resultData;
}
示例14: drawRTE
/**
* Draws the RTE as an iframe
*
* @param object Reference to parent object, which is an instance of the TCEforms.
* @param string The table name
* @param string The field name
* @param array The current row from which field is being rendered
* @param array Array of standard content for rendering form fields from TCEforms. See TCEforms for details on this. Includes for instance the value and the form field name, java script actions and more.
* @param array "special" configuration - what is found at position 4 in the types configuration of a field from record, parsed into an array.
* @param array Configuration for RTEs; A mix between TSconfig and otherwise. Contains configuration for display, which buttons are enabled, additional transformation information etc.
* @param string Record "type" field value.
* @param string Relative path for images/links in RTE; this is used when the RTE edits content from static files where the path of such media has to be transformed forth and back!
* @param integer PID value of record (true parent page id)
* @return string HTML code for RTE!
* @todo Define visibility
*/
public function drawRTE(&$parentObject, $table, $field, $row, $PA, $specConf, $thisConfig, $RTEtypeVal, $RTErelPath, $thePidValue)
{
global $TSFE, $TYPO3_CONF_VARS, $TYPO3_DB;
$this->TCEform = $parentObject;
$this->client = $this->clientInfo();
$this->typoVersion = \TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version);
/* =======================================
* INIT THE EDITOR-SETTINGS
* =======================================
*/
// Get the path to this extension:
$this->extHttpPath = \TYPO3\CMS\Core\Extension\ExtensionManager::siteRelPath($this->ID);
// Get the site URL
$this->siteURL = $GLOBALS['TSFE']->absRefPrefix ? $GLOBALS['TSFE']->absRefPrefix : '';
// Get the host URL
$this->hostURL = '';
// Element ID + pid
$this->elementId = $PA['itemFormElName'];
$this->elementParts[0] = $table;
$this->elementParts[1] = $row['uid'];
$this->tscPID = $thePidValue;
$this->thePid = $thePidValue;
// Record "type" field value:
$this->typeVal = $RTEtypeVal;
// TCA "type" value for record
// RTE configuration
$pageTSConfig = $TSFE->getPagesTSconfig();
if (is_array($pageTSConfig) && is_array($pageTSConfig['RTE.'])) {
$this->RTEsetup = $pageTSConfig['RTE.'];
}
if (is_array($thisConfig) && !empty($thisConfig)) {
$this->thisConfig = $thisConfig;
} elseif (is_array($this->RTEsetup['default.']) && is_array($this->RTEsetup['default.']['FE.'])) {
$this->thisConfig = $this->RTEsetup['default.']['FE.'];
}
// Special configuration (line) and default extras:
$this->specConf = $specConf;
if ($this->thisConfig['forceHTTPS']) {
$this->extHttpPath = preg_replace('/^(http|https)/', 'https', $this->extHttpPath);
$this->siteURL = preg_replace('/^(http|https)/', 'https', $this->siteURL);
$this->hostURL = preg_replace('/^(http|https)/', 'https', $this->hostURL);
}
// Register RTE windows:
$this->TCEform->RTEwindows[] = $PA['itemFormElName'];
$textAreaId = preg_replace('/[^a-zA-Z0-9_:.-]/', '_', $PA['itemFormElName']);
$textAreaId = htmlspecialchars(preg_replace('/^[^a-zA-Z]/', 'x', $textAreaId)) . '_' . strval($this->TCEform->RTEcounter);
/* =======================================
* LANGUAGES & CHARACTER SETS
* =======================================
*/
// Language
$TSFE->initLLvars();
$this->language = $TSFE->lang;
$this->LOCAL_LANG = \TYPO3\CMS\Core\Utility\GeneralUtility::readLLfile('EXT:' . $this->ID . '/locallang.xml', $this->language);
if ($this->language == 'default' || !$this->language) {
$this->language = 'en';
}
$this->contentLanguageUid = $row['sys_language_uid'] > 0 ? $row['sys_language_uid'] : 0;
if (\TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded('static_info_tables')) {
if ($this->contentLanguageUid) {
$tableA = 'sys_language';
$tableB = 'static_languages';
$languagesUidsList = $this->contentLanguageUid;
$selectFields = $tableA . '.uid,' . $tableB . '.lg_iso_2,' . $tableB . '.lg_country_iso_2,' . $tableB . '.lg_typo3';
$tableAB = $tableA . ' LEFT JOIN ' . $tableB . ' ON ' . $tableA . '.static_lang_isocode=' . $tableB . '.uid';
$whereClause = $tableA . '.uid IN (' . $languagesUidsList . ') ';
$whereClause .= \TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields($tableA);
$whereClause .= \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause($tableA);
$res = $TYPO3_DB->exec_SELECTquery($selectFields, $tableAB, $whereClause);
while ($languageRow = $TYPO3_DB->sql_fetch_assoc($res)) {
$this->contentISOLanguage = strtolower(trim($languageRow['lg_iso_2']) . (trim($languageRow['lg_country_iso_2']) ? '_' . trim($languageRow['lg_country_iso_2']) : ''));
$this->contentTypo3Language = strtolower(trim($languageRow['lg_typo3']));
}
} else {
$this->contentISOLanguage = $GLOBALS['TSFE']->sys_language_isocode ? $GLOBALS['TSFE']->sys_language_isocode : 'en';
$selectFields = 'lg_iso_2, lg_typo3';
$tableAB = 'static_languages';
$whereClause = 'lg_iso_2 = ' . $TYPO3_DB->fullQuoteStr(strtoupper($this->contentISOLanguage), $tableAB);
$res = $TYPO3_DB->exec_SELECTquery($selectFields, $tableAB, $whereClause);
while ($languageRow = $TYPO3_DB->sql_fetch_assoc($res)) {
$this->contentTypo3Language = strtolower(trim($languageRow['lg_typo3']));
}
}
}
//.........这里部分代码省略.........
示例15: loadCss
/**
* Load the necessarry css
*
* This will only be done when the referenced record is available
*
* @return void
*/
protected function loadCss()
{
// TODO Set to TRUE when finished
$compress = FALSE;
$baseUrl = \TYPO3\CMS\Core\Utility\GeneralUtility::resolveBackPath('../../../../../' . \TYPO3\CMS\Core\Extension\ExtensionManager::siteRelPath('form') . 'Resources/Public/CSS/');
$cssFiles = array('Wizard/Form.css', 'Wizard/Wizard.css');
// Load the wizards css
foreach ($cssFiles as $cssFile) {
$this->pageRenderer->addCssFile($baseUrl . $cssFile, 'stylesheet', 'all', '', $compress, FALSE);
}
}