本文整理汇总了PHP中t3lib_div::readLLfile方法的典型用法代码示例。如果您正苦于以下问题:PHP t3lib_div::readLLfile方法的具体用法?PHP t3lib_div::readLLfile怎么用?PHP t3lib_div::readLLfile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类t3lib_div
的用法示例。
在下文中一共展示了t3lib_div::readLLfile方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: pi_loadLL
function pi_loadLL()
{
$filename = 'pi1/locallang.xml';
// d($filename);
// $filename = realpath($filename);
// d($filename);
$default = 'default';
$content = t3lib_div::readLLfile($filename, $default);
$this->LL = $content[$default];
foreach ($this->LL as &$assoc) {
$assoc = $assoc[0]['target'];
}
}
示例2: locallizeString
/**
* Translate a given string in the current language
*
* @param string $string
* @return string
*/
static function locallizeString($locallangString)
{
// handler whole LLL String
if (strpos($locallangString, 'LLL:') !== 0) {
$result = $locallangString;
} else {
switch (TYPO3_MODE) {
case 'FE':
// FE
if ($GLOBALS['TSFE']) {
$lcObj = t3lib_div::makeInstance('tslib_cObj');
$result = $lcObj->TEXT(array('data' => $locallangString));
} else {
$LANG = t3lib_div::makeInstance('language');
$LANG->init($language_key);
$result = $LANG->getLLL($locallang_key, t3lib_div::readLLfile(t3lib_div::getFileAbsFileName($locallang_file), $LANG->lang, $LANG->charSet));
}
break;
case 'BE':
$locallangParts = explode(':', $locallangString);
array_shift($locallangParts);
$locallang_key = array_pop($locallangParts);
$locallang_file = implode(':', $locallangParts);
$language_key = $GLOBALS['BE_USER']->uc['lang'];
$LANG = t3lib_div::makeInstance('language');
$LANG->init($language_key);
$result = $LANG->getLLL($locallang_key, t3lib_div::readLLfile(t3lib_div::getFileAbsFileName($locallang_file), $LANG->lang, $LANG->charSet));
break;
default:
$result = $locallangString;
break;
}
}
/// recursive call for {LLL:} parts
$result = preg_replace_callback('/{(LLL:EXT:[^ ]+?:[^ ]+?)}/', 'tx_caretaker_LocallizationHelper::locallizeSubstring', $result);
return $result;
}
示例3: locallizeString
/**
* Translate a given string in the current language
*
* @param string $string
* @return string
*/
protected function locallizeString($locallang_string)
{
$locallang_parts = explode(':', $locallang_string);
if (array_shift($locallang_parts) != 'LLL') {
return $locallang_string;
}
switch (TYPO3_MODE) {
case 'FE':
$lcObj = t3lib_div::makeInstance('tslib_cObj');
return $lcObj->TEXT(array('data' => $locallang_string));
case 'BE':
$locallang_key = array_pop($locallang_parts);
$locallang_file = implode(':', $locallang_parts);
$language_key = $GLOBALS['BE_USER']->uc['lang'];
$LANG = t3lib_div::makeInstance('language');
$LANG->init($language_key);
return $LANG->getLLL($locallang_key, t3lib_div::readLLfile(t3lib_div::getFileAbsFileName($locallang_file), $LANG->lang, $LANG->charSet));
default:
return $locallang_string;
}
}
示例4: readLLfile
/**
* Read locallang files - for frontend applications
*
* @param string Reference to a relative filename to include.
* @return array Returns the $LOCAL_LANG array found in the file. If no array found, returns empty array.
*/
function readLLfile($fileRef)
{
return t3lib_div::readLLfile($fileRef, $this->lang, $this->renderCharset);
}
示例5: 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!
*/
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 = t3lib_div::int_from_ver(TYPO3_version);
/* =======================================
* INIT THE EDITOR-SETTINGS
* =======================================
*/
// Get the path to this extension:
$this->extHttpPath = t3lib_extMgm::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;
} else {
if (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 = t3lib_div::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 (t3lib_extMgm::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 .= t3lib_BEfunc::BEenableFields($tableA);
$whereClause .= t3lib_BEfunc::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']));
}
}
//.........这里部分代码省略.........
示例6: readLLfile
/**
* Includes a locallang file and returns the $LOCAL_LANG array found inside.
*
* @param string Input is a file-reference (see t3lib_div::getFileAbsFileName) which, if exists, is included. That file is expected to be a 'local_lang' file containing a $LOCAL_LANG array.
* @return array Value of $LOCAL_LANG found in the included file. If that array is found it's returned. Otherwise an empty array
* @access private
*/
protected function readLLfile($fileRef)
{
return t3lib_div::readLLfile($fileRef, $this->lang, $this->charSet);
}
示例7: loadLL_fh002
/**
* used since TYPO3 4.6
* Loads local-language values by looking for a "locallang.php" file in the plugin class directory ($langObj->scriptRelPath) and if found includes it.
* Also locallang values set in the TypoScript property "_LOCAL_LANG" are merged onto the values found in the "locallang.xml" file.
*
* @param object tx_div2007_alpha_language_base or a tslib_pibase object
* @param string language file to load
* @param boolean If TRUE, then former language items can be overwritten from the new file
* @return boolean
*/
public static function loadLL_fh002($langObj, $langFileParam = '', $overwrite = TRUE)
{
$result = FALSE;
if (is_object($langObj)) {
$typoVersion = tx_div2007_core::getTypoVersion();
$langFile = $langFileParam ? $langFileParam : 'locallang.xml';
if (substr($langFile, 0, 4) === 'EXT:' || substr($langFile, 0, 5) === 'typo3' || substr($langFile, 0, 9) === 'fileadmin') {
$basePath = $langFile;
} else {
$basePath = t3lib_extMgm::extPath($langObj->extKey) . ($langObj->scriptRelPath ? dirname($langObj->scriptRelPath) . '/' : '') . $langFile;
}
// Read the strings in the required charset (since TYPO3 4.2)
$tempLOCAL_LANG = t3lib_div::readLLfile($basePath, $langObj->LLkey, $GLOBALS['TSFE']->renderCharset);
if (count($langObj->LOCAL_LANG) && is_array($tempLOCAL_LANG)) {
foreach ($langObj->LOCAL_LANG as $langKey => $tempArray) {
if (is_array($tempLOCAL_LANG[$langKey])) {
if ($overwrite) {
$langObj->LOCAL_LANG[$langKey] = array_merge($langObj->LOCAL_LANG[$langKey], $tempLOCAL_LANG[$langKey]);
} else {
$langObj->LOCAL_LANG[$langKey] = array_merge($tempLOCAL_LANG[$langKey], $langObj->LOCAL_LANG[$langKey]);
}
}
}
} else {
$langObj->LOCAL_LANG = $tempLOCAL_LANG;
}
if ($langObj->altLLkey) {
$tempLOCAL_LANG = t3lib_div::readLLfile($basePath, $langObj->altLLkey, $GLOBALS['TSFE']->renderCharset);
if (count($langObj->LOCAL_LANG) && is_array($tempLOCAL_LANG)) {
foreach ($langObj->LOCAL_LANG as $langKey => $tempArray) {
if (is_array($tempLOCAL_LANG[$langKey])) {
if ($overwrite) {
$langObj->LOCAL_LANG[$langKey] = array_merge($langObj->LOCAL_LANG[$langKey], $tempLOCAL_LANG[$langKey]);
} else {
$langObj->LOCAL_LANG[$langKey] = array_merge($tempLOCAL_LANG[$langKey], $langObj->LOCAL_LANG[$langKey]);
}
}
}
} else {
$langObj->LOCAL_LANG = $tempLOCAL_LANG;
}
}
// Overlaying labels from TypoScript (including fictitious language keys for non-system languages!):
$confLL = $langObj->conf['_LOCAL_LANG.'];
if (is_array($confLL)) {
foreach ($confLL as $languageKey => $languageArray) {
if (is_array($languageArray)) {
$languageKey = substr($languageKey, 0, -1);
$charset = $GLOBALS['TYPO3_CONF_VARS']['BE']['forceCharset'];
// For labels coming from the TypoScript (database) the charset is assumed to be "forceCharset"
// and if that is not set, assumed to be that of the individual system languages
if (!$charset) {
$charset = $GLOBALS['TSFE']->csConvObj->charSetArray[$languageKey];
}
// Remove the dot after the language key
foreach ($languageArray as $labelKey => $labelValue) {
if (is_array($labelValue)) {
foreach ($labelValue as $labelKey2 => $labelValue2) {
if (is_array($labelValue2)) {
foreach ($labelValue2 as $labelKey3 => $labelValue3) {
if (is_array($labelValue3)) {
foreach ($labelValue3 as $labelKey4 => $labelValue4) {
if (is_array($labelValue4)) {
} else {
if ($typoVersion >= 4006000) {
$langObj->LOCAL_LANG[$languageKey][$labelKey . $labelKey2 . $labelKey3 . $labelKey4][0]['target'] = $labelValue4;
} else {
$langObj->LOCAL_LANG[$languageKey][$labelKey . $labelKey2 . $labelKey3 . $labelKey4] = $labelValue4;
}
if ($languageKey != 'default') {
$langObj->LOCAL_LANG_charset[$languageKey][$labelKey . $labelKey2 . $labelKey3 . $labelKey4] = $charset;
// For labels coming from the TypoScript (database) the charset is assumed to be "forceCharset" and if that is not set, assumed to be that of the individual system languages (thus no conversion)
}
}
}
} else {
if ($typoVersion >= 4006000) {
$langObj->LOCAL_LANG[$languageKey][$labelKey . $labelKey2 . $labelKey3][0]['target'] = $labelValue3;
} else {
$langObj->LOCAL_LANG[$languageKey][$labelKey . $labelKey2 . $labelKey3] = $labelValue3;
}
if ($languageKey != 'default') {
$langObj->LOCAL_LANG_charset[$languageKey][$labelKey . $labelKey2 . $labelKey3] = $charset;
// For labels coming from the TypoScript (database) the charset is assumed to be "forceCharset" and if that is not set, assumed to be that of the individual system languages (thus no conversion)
}
}
}
} else {
if ($typoVersion >= 4006000) {
$langObj->LOCAL_LANG[$languageKey][$labelKey . $labelKey2][0]['target'] = $labelValue2;
//.........这里部分代码省略.........
示例8: includeLocalLang
/**
* Reads the [extDir]/locallang.xml and returns the $LOCAL_LANG array found in that file.
*
* @return The array with language labels
*/
function includeLocalLang()
{
$llFile = t3lib_extMgm::extPath('t3pimper') . 'locallang.xml';
$LOCAL_LANG = t3lib_div::readLLfile($llFile, $GLOBALS['LANG']->lang);
return $LOCAL_LANG;
}
示例9: initializeLocalization
/**
* Loads local-language values by looking for a "locallang.php" (or "locallang.xml") file in the plugin resources directory and if found includes it.
* Also locallang values set in the TypoScript property "_LOCAL_LANG" are merged onto the values found in the "locallang.php" file.
*
* @return void
* @author Christopher Hlubek <hlubek@networkteam.com>
* @author Bastian Waidelich <bastian@typo3.org>
*/
protected static function initializeLocalization($extensionName)
{
if (isset(self::$LOCAL_LANG[$extensionName])) {
return;
}
$locallangPathAndFilename = 'EXT:' . t3lib_div::camelCaseToLowerCaseUnderscored($extensionName) . '/' . self::$locallangPath . 'locallang.xml';
self::setLanguageKeys();
$renderCharset = TYPO3_MODE === 'FE' ? $GLOBALS['TSFE']->renderCharset : $GLOBALS['LANG']->charSet;
self::$LOCAL_LANG[$extensionName] = t3lib_div::readLLfile($locallangPathAndFilename, self::$languageKey, $renderCharset);
if (self::$alternativeLanguageKey !== '') {
$alternativeLocalLang = t3lib_div::readLLfile($locallangPathAndFilename, self::$alternativeLanguageKey);
self::$LOCAL_LANG[$extensionName] = array_merge(self::$LOCAL_LANG[$extensionName], $alternativeLocalLang);
}
self::loadTypoScriptLabels($extensionName);
}
示例10: pi_loadLL
/**
* Overwrites pi_loadLL() to handle custom location of language files.
*
* Loads local-language values by looking for a "locallang" file in the
* plugin class directory ($this->scriptRelPath) and if found includes it.
* Also locallang values set in the TypoScript property "_LOCAL_LANG" are
* merged onto the values found in the "locallang" file.
* Supported file extensions xlf, xml, php
*
* @return void
*/
public function pi_loadLL()
{
if (!$this->LOCAL_LANG_loaded && $this->scriptRelPath) {
list($languageFileName) = explode('/', $this->scriptRelPath);
$languageFileName = str_replace('Pi', 'Plugin', $languageFileName);
$basePath = 'EXT:' . $this->extKey . '/Resources/Private/Language/' . $languageFileName . '.xml';
// Read the strings in the required charset (since TYPO3 4.2)
$this->LOCAL_LANG = t3lib_div::readLLfile($basePath, $this->LLkey, $GLOBALS['TSFE']->renderCharset);
$alternativeLanguageKeys = t3lib_div::trimExplode(',', $this->altLLkey, TRUE);
foreach ($alternativeLanguageKeys as $languageKey) {
$tempLL = t3lib_div::readLLfile($basePath, $languageKey);
if ($this->LLkey !== 'default' && isset($tempLL[$languageKey])) {
$this->LOCAL_LANG[$languageKey] = $tempLL[$languageKey];
}
}
// Overlaying labels from TypoScript (including fictitious language keys for non-system languages!):
if (isset($this->conf['_LOCAL_LANG.'])) {
// Clear the "unset memory"
$this->LOCAL_LANG_UNSET = array();
foreach ($this->conf['_LOCAL_LANG.'] as $languageKey => $languageArray) {
// Remove the dot after the language key
$languageKey = substr($languageKey, 0, -1);
// Don't process label if the language is not loaded
if (is_array($languageArray) && isset($this->LOCAL_LANG[$languageKey])) {
foreach ($languageArray as $labelKey => $labelValue) {
if (!is_array($labelValue)) {
$this->LOCAL_LANG[$languageKey][$labelKey][0]['target'] = $labelValue;
if ($labelValue === '') {
$this->LOCAL_LANG_UNSET[$languageKey][$labelKey] = '';
}
$this->LOCAL_LANG_charset[$languageKey][$labelKey] = 'utf-8';
}
}
}
}
}
}
$this->LOCAL_LANG_loaded = 1;
}
示例11: buildJSLangArray
/**
* Return a Javascript localization array for the plugin
*
* @param string $plugin: identification string of the plugin
*
* @return string Javascript localization array
*/
function buildJSLangArray($plugin)
{
$LOCAL_LANG = FALSE;
$extensionKey = is_object($this->registeredPlugins[$plugin]) ? $this->registeredPlugins[$plugin]->getExtensionKey() : $this->ID;
$LOCAL_LANG = t3lib_div::readLLfile('EXT:' . $extensionKey . '/htmlarea/plugins/' . $plugin . '/locallang.xml', $this->language, 'utf-8', 1);
$linebreak = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$this->ID]['enableCompressedScripts'] ? '' : LF;
$JSLanguageArray = 'HTMLArea.I18N["' . $plugin . '"] = new Object();' . $linebreak;
if (is_array($LOCAL_LANG)) {
if (!empty($LOCAL_LANG[$this->language])) {
$LOCAL_LANG[$this->language] = t3lib_div::array_merge_recursive_overrule($LOCAL_LANG['default'], $LOCAL_LANG[$this->language]);
} else {
$LOCAL_LANG[$this->language] = $LOCAL_LANG['default'];
}
$JSLanguageArray .= 'HTMLArea.I18N["' . $plugin . '"] = ' . json_encode($LOCAL_LANG[$this->language]) . ';' . LF;
}
return $JSLanguageArray;
}
示例12: main
/**
* Returns true if the plugin is available and correctly initialized
*
* @param object Reference to parent object, which is an instance of the htmlArea RTE
*
* @return boolean true if this plugin object should be made available in the current environment and is correctly initialized
*/
public function main($parentObject)
{
global $TYPO3_CONF_VARS, $LANG, $TSFE;
$this->htmlAreaRTE = $parentObject;
$this->rteExtensionKey =& $this->htmlAreaRTE->ID;
$this->thisConfig =& $this->htmlAreaRTE->thisConfig;
$this->toolbar =& $this->htmlAreaRTE->toolbar;
$this->LOCAL_LANG =& $this->htmlAreaRTE->LOCAL_LANG;
// Set the value of this boolean based on the initial value of $this->pluginButtons
$this->pluginAddsButtons = !empty($this->pluginButtons);
// Check if the plugin should be disabled in frontend
if ($this->htmlAreaRTE->is_FE() && $TYPO3_CONF_VARS['EXTCONF'][$this->rteExtensionKey]['plugins'][$this->pluginName]['disableInFE']) {
return false;
}
// Localization array must be initialized here
if ($this->relativePathToLocallangFile) {
if ($this->htmlAreaRTE->is_FE()) {
$this->LOCAL_LANG = t3lib_div::array_merge_recursive_overrule($this->LOCAL_LANG, t3lib_div::readLLfile('EXT:' . $this->extensionKey . '/' . $this->relativePathToLocallangFile, $this->htmlAreaRTE->language));
} else {
$LANG->includeLLFile('EXT:' . $this->extensionKey . '/' . $this->relativePathToLocallangFile);
}
}
return true;
}
示例13: setLocallangSettings
/**
* This method loads the locallang.xml file (default language), and
* adds all keys found in it to the TYPO3.settings.extension_builder._LOCAL_LANG object
* translated into the current language
*
* Dots in a key are replaced by a _
*
* Example:
* error.name becomes TYPO3.settings.extension_builder._LOCAL_LANG.error_name
*
* @return void
*/
private function setLocallangSettings()
{
$LL = t3lib_div::readLLfile('EXT:extension_builder/Resources/Private/Language/locallang.xml', 'default');
if (!empty($LL['default']) && is_array($LL['default'])) {
foreach ($LL['default'] as $key => $value) {
$this->pageRenderer->addInlineSetting('extensionBuilder._LOCAL_LANG', str_replace('.', '_', $key), Tx_Extbase_Utility_Localization::translate($key, 'extension_builder'));
}
}
}
示例14: getLLarray
/**
* Includes locallang files and returns raw $LOCAL_LANG array
*
* @param string Absolute reference to the php locallang file.
* @return array LOCAL-LANG array from php file (with all possible sub-files for languages included)
*/
function getLLarray($phpFile)
{
$LOCAL_LANG = t3lib_div::readLLfile($phpFile, $GLOBALS['LANG']->lang, $GLOBALS['LANG']->charSet);
if (defined('TYPO3_languages')) {
$languages = explode('|', TYPO3_languages);
foreach ($languages as $langKey) {
// Localized addition?
$lFileRef = $this->localizedFileRef($phpFile, $langKey);
if ($lFileRef && (string) $LOCAL_LANG[$langKey] == 'EXT') {
$llang = t3lib_div::readLLfile($lFileRef, $GLOBALS['LANG']->lang, $GLOBALS['LANG']->charSet);
$LOCAL_LANG = t3lib_div::array_merge_recursive_overrule($LOCAL_LANG, $llang);
}
}
}
return $LOCAL_LANG;
}
示例15: user_images
/**
* Main function to get the FLV player working
*
* @param string $originalUrl: The uriginal url of the video
* @param array $params: Possible configuration
*/
function user_images($originalUrl, $conf)
{
$GLOBALS['TSFE']->additionalCSS['rgmediaimages'] = '.rgmi { text-align:center;}';
require_once t3lib_extMgm::extPath('rgmediaimages') . '/class.tx_rgmediaimages_api.php';
$this->media = t3lib_div::makeInstance('tx_rgmediaimages_api');
// include the SWF Object File
$this->media->initSwfObject();
// set a unique ID
$this->media->setUniqueID($this->cObj->data['uid']);
// set no flash text
$locallang = t3lib_div::readLLfile('EXT:rgmediaimages/locallang.xml', $GLOBALS['TSFE']->lang);
$noFlashText = $locallang[$GLOBALS['TSFE']->lang]['noflash'] != '' ? $locallang[$GLOBALS['TSFE']->lang]['noflash'] : $locallang['default']['noflash'];
$this->media->setNoFlashText($noFlashText);
// url to the media file
$url = htmlspecialchars(t3lib_div::getIndpEnv('TYPO3_SITE_URL') . $originalUrl);
// configuration through the Content Element
$pluginConf = $this->cObj->stdWrap($conf['override'], $conf['override.']);
$pluginConf = explode(',', $pluginConf);
$pluginConf2 = array();
foreach ($pluginConf as $key => $value) {
$value = str_replace('http://', '', trim($value));
$split = explode(':', $value);
$pluginConf2[$split[0]] = trim($split[1]);
}
// get width / height
$widthBE = intval($this->cObj->data['imagewidth']);
$conf['conf.']['width'] = $widthBE != 0 ? $widthBE : intval($conf['conf.']['width']);
$heightBE = intval($this->cObj->data['imageheight']);
$conf['conf.']['height'] = $heightBE != 0 ? $heightBE : intval($conf['conf.']['height']);
// merge the configuration from the CE and from TS
$c = array_merge($conf['conf.'], $pluginConf2);
$config = $this->media->getConfiguration($c);
// callback, needs the EXT:rgmediaimagescallback
if (t3lib_extMgm::isLoaded('rgmediaimagescallback') && $c['callback'] == 1 && 1 == 2) {
$urlParameter = '%26file=' . $originalUrl . '%26uid=' . $this->cObj->data['uid'] . '%26pid=' . $GLOBALS['TSFE']->id;
$securityKey = md5($urlParameter . $GLOBALS["TYPO3_CONF_VARS"]["SYS"]["encryptionKey"]);
$urlParameter .= '%26key=' . $securityKey;
$config['trackback'] = 'title="' . htmlspecialchars($url) . '"&id=' . md5($originalUrl) . '&callback=' . t3lib_div::getIndpEnv('TYPO3_SITE_URL') . 'index.php?eID=callback' . $urlParameter;
}
// height / width for the player
$height2 = explode('=', $config['height']);
$width2 = explode('=', $config['width']);
// check for mootools
$this->media->checkForMootools($c['mootools']);
/****************************************
* FLV & mp3 files, played with the JW FLV Player
************************/
if (substr($originalUrl, -4) != '.rgg') {
// if mp3 and 1pixelout is activated, use it
if (strtolower(substr($originalUrl, -4)) == '.mp3' && $conf['conf.']['use1PixelOut'] == 1) {
$video = $this->media->getMp3($url, $conf['conf.']['useSwfObject'], $conf['confmp3.']);
// include flash as plain
} elseif (strtolower(substr($originalUrl, -4)) == '.swf') {
$video = $this->media->getFlash($url, $width2[1], $height2[1], $conf['conf.']['useSwfObject']);
// use FLV JW Player
} else {
// output as swfObject
if ($c['useSwfObject'] == 1) {
$video = $this->media->getVideoSwfObj($url, $config, $width2[1], $height2[1]);
// output as embed
} else {
$video = $this->media->getVideoEmbed($url, $configuration, $width2[1], $height2[1]);
}
/* // if the callback is enabled
if (t3lib_extMgm::isLoaded('rgmediaimagescallback') && $c['callback']==1) {
$old = 'Uhrzeit gecached: '. strftime('%D - %H:%M:%S',time()) . '<br />';
$new= 'Uhrzeit ungecached: '. $this->callUserINT('getTime',$config) . '<br />';
$confDownloads['uid'] = $this->cObj->data['uid'];
$confDownloads['uniquekey'] = $securityKey;
$confDownloads['title'] = $originalUrl;
$downloadRates = $this->callUserINT('downloadRates',$confDownloads);
}
*/
}
} else {
// checks if a video is found
$found = false;
// get the file
$filename = htmlspecialchars(trim($c['file']));
$rtmp = htmlspecialchars(trim($c['rtmp']));
// embed a rtmp stream
if ($rtmp != '') {
$found = true;
$video = $this->media->getRtmpSwfObj($rtmp, $config, $width2[1], $height2[1]);
}
/****************************************
* search for the supported hosters
************************/
if (!$found) {
$obj = $this->media->getVideos($filename, $width2[1], $height2[1], $c);
if ($obj != '') {
$found = 1;
$video = $this->media->getVideoSwfObj($filename, $config, $width = '', $height = '', $obj);
}
//.........这里部分代码省略.........