本文整理汇总了PHP中t3lib_div::revExplode方法的典型用法代码示例。如果您正苦于以下问题:PHP t3lib_div::revExplode方法的具体用法?PHP t3lib_div::revExplode怎么用?PHP t3lib_div::revExplode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类t3lib_div
的用法示例。
在下文中一共展示了t3lib_div::revExplode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: revExplode
/**
* @param string $delimiter Delimiter string to explode with
* @param string $string The string to explode
* @param int $count Number of array entries
* @return array Exploded values
*/
public function revExplode($delimiter, $string, $count = 0)
{
/** @noinspection PhpDeprecationInspection PhpUndefinedClassInspection */
return t3lib_div::revExplode($delimiter, $string, $count);
}
示例2: decodeSpURL_decodeFileName
/**
* Decodes the file name and adjusts file parts accordingly
*
* @param array $pathParts Path parts of the URLs (can be modified)
* @return array GET varaibles from the file name or empty array
*/
protected function decodeSpURL_decodeFileName(array &$pathParts) {
$getVars = array();
$fileName = array_pop($pathParts);
$fileParts = t3lib_div::revExplode('.', $fileName, 2);
if (count($fileParts) == 2 && !$fileParts[1]) {
$this->decodeSpURL_throw404('File "' . $fileName . '" was not found (2)!');
}
list($segment, $extension) = $fileParts;
if ($extension) {
$getVars = array();
if (!$this->decodeSpURL_decodeFileName_lookupInIndex($fileName, $segment, $extension, $pathParts, $getVars)) {
if (!$this->decodeSpURL_decodeFileName_checkHtmlSuffix($fileName, $segment, $extension, $pathParts)) {
$this->decodeSpURL_throw404('File "' . $fileName . '" was not found (1)!');
}
}
}
elseif ($fileName != '') {
$pathParts[] = $fileName;
}
return $getVars;
}
示例3: freeIndexUidWhere
/**
* Where-clause for free index-uid value.
*
* @param integer Free Index UID value to limit search to.
* @return string WHERE SQL clause part.
*/
function freeIndexUidWhere($freeIndexUid)
{
if ($freeIndexUid >= 0) {
// First, look if the freeIndexUid is a meta configuration:
list($indexCfgRec) = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('indexcfgs', 'index_config', 'type=5 AND uid=' . intval($freeIndexUid) . $this->cObj->enableFields('index_config'));
if (is_array($indexCfgRec)) {
$refs = t3lib_div::trimExplode(',', $indexCfgRec['indexcfgs']);
$list = array(-99);
// Default value to protect against empty array.
foreach ($refs as $ref) {
list($table, $uid) = t3lib_div::revExplode('_', $ref, 2);
switch ($table) {
case 'index_config':
list($idxRec) = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('uid', 'index_config', 'uid=' . intval($uid) . $this->cObj->enableFields('index_config'));
if ($idxRec) {
$list[] = $uid;
}
break;
case 'pages':
$indexCfgRecordsFromPid = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('uid', 'index_config', 'pid=' . intval($uid) . $this->cObj->enableFields('index_config'));
foreach ($indexCfgRecordsFromPid as $idxRec) {
$list[] = $idxRec['uid'];
}
break;
}
}
$list = array_unique($list);
} else {
$list = array(intval($freeIndexUid));
}
return ' AND IP.freeIndexUid IN (' . implode(',', $list) . ')';
}
}
示例4: register_editor
/**
* Register a class which renders a "editor".
* A editor is something that modifies a file. This can be a text editor or a module to crop an image.
*
* @param string $idName This is the ID of the editor. Chars allowed only: [a-zA-z]
* @param string $class Function/Method reference, '[file-reference":"]["&"]class'. See t3lib_div::callUserFunction().
* @param string $position can be used to set the position of a new item within the list of existing items. $position has this syntax: [cmd]:[item-key]. cmd can be "after", "before" or "top" (or "bottom"/blank which is default). If "after"/"before" then submodule will be inserted after/before the existing item with [item-key] if found. If not found, the bottom of list. If "top" the item is inserted in the top of the item list.
* @return void
*/
function register_editor($idName, $classRef, $position = '')
{
tx_dam::_addItem($idName, $classRef, $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['dam']['editorClasses'], $position);
// an editor is also and module function so we register it here
if (strstr($classRef, ':')) {
list($file, $class) = t3lib_div::revExplode(':', $classRef, 2);
$requireFile = t3lib_div::getFileAbsFileName($file);
} else {
$class = $classRef;
}
// Check for persistent object token, "&"
if (substr($class, 0, 1) == '&') {
$class = substr($class, 1);
}
// register module function
t3lib_extMgm::insertModuleFunction('txdamM1_edit', $class, $requireFile, 'LLL:EXT:dam/mod_edit/locallang.xml:tx_dam_edit.title');
}
示例5: decodeSpURL_decodeFileName
/**
* This is taken directly from class.tx_realurl.php
* Decodes the file name and adjusts file parts accordingly
*
* @param array $pathParts Path parts of the URLs (can be modified)
* @return array GET varaibles from the file name or empty array
*/
protected function decodeSpURL_decodeFileName(array &$pathParts) {
$getVars = array();
$fileName = rawurldecode(array_pop($pathParts));
list($segment, $extension) = t3lib_div::revExplode('.', $fileName, 2);
if ($extension) {
$getVars = array();
if (!$this->decodeSpURL_decodeFileName_lookupInIndex($fileName, $segment, $extension, $pathParts, $getVars)) {
if (!$this->decodeSpURL_decodeFileName_checkHtmlSuffix($fileName, $segment, $extension, $pathParts)) {
}
}
}
return $getVars;
}
示例6: list
/**
* Creates and returns reference to a user defined object.
* This function can return an object reference if you like. Just prefix the function call with "&": "$objRef = &t3lib_div::getUserObj('EXT:myext/class.tx_myext_myclass.php:&tx_myext_myclass');". This will work ONLY if you prefix the class name with "&" as well. See description of function arguments.
* Usage: 5
*
* @param string Class reference, '[file-reference":"]["&"]class-name'. You can prefix the class name with "[file-reference]:" and t3lib_div::getFileAbsFileName() will then be used to resolve the filename and subsequently include it by "require_once()" which means you don't have to worry about including the class file either! Example: "EXT:realurl/class.tx_realurl.php:&tx_realurl". Finally; for the class name you can prefix it with "&" and you will reuse the previous instance of the object identified by the full reference string (meaning; if you ask for the same $classRef later in another place in the code you will get a reference to the first created one!).
* @param string Required prefix of class name. By default "tx_" is allowed.
* @param boolean If set, no debug() error message is shown if class/function is not present.
* @return object The instance of the class asked for. Instance is created with t3lib_div::makeInstance
* @see callUserFunction()
*/
function &getUserObj($classRef, $checkPrefix = 'user_', $silent = 0)
{
global $TYPO3_CONF_VARS;
// Check persistent object and if found, call directly and exit.
if (is_object($GLOBALS['T3_VAR']['getUserObj'][$classRef])) {
return $GLOBALS['T3_VAR']['getUserObj'][$classRef];
} else {
// Check file-reference prefix; if found, require_once() the file (should be library of code)
if (strstr($classRef, ':')) {
list($file, $class) = t3lib_div::revExplode(':', $classRef, 2);
$requireFile = t3lib_div::getFileAbsFileName($file);
if ($requireFile) {
require_once $requireFile;
}
} else {
$class = $classRef;
}
// Check for persistent object token, "&"
if (substr($class, 0, 1) == '&') {
$class = substr($class, 1);
$storePersistentObject = TRUE;
} else {
$storePersistentObject = FALSE;
}
// Check prefix is valid:
if ($checkPrefix && !t3lib_div::isFirstPartOfStr(trim($class), $checkPrefix) && !t3lib_div::isFirstPartOfStr(trim($class), 'tx_')) {
if (!$silent) {
debug("Class '" . $class . "' was not prepended with '" . $checkPrefix . "'", 1);
}
return FALSE;
}
// Check if class exists:
if (class_exists($class)) {
$classObj =& t3lib_div::makeInstance($class);
// If persistent object should be created, set reference:
if ($storePersistentObject) {
$GLOBALS['T3_VAR']['getUserObj'][$classRef] =& $classObj;
}
return $classObj;
} else {
if (!$silent) {
debug("<strong>ERROR:</strong> No class named: " . $class, 1);
}
}
}
}
示例7: splitGroup
function splitGroup($group, $default = '')
{
$groups = explode(',', $group);
foreach ($groups as $group) {
$item = t3lib_div::revExplode('_', $group, 2);
if (count($item) == 1) {
$record_ids[$default][] = $item[0];
} else {
$record_ids[$item[0]][] = $item[1];
}
}
return $record_ids;
}
示例8: checkValueEnabled
/**
* Check a config value if its enabled
* Anything except '' and 0 is true
* If the the option is not set the default value will be returned
*
* @param string $configPath Pointer to an "object" in the TypoScript array, fx. 'setup.selections.default'
* @param mixed $default Default value when option is not set, otherwise the value itself
* @return boolean
*/
function checkValueEnabled($configPath, $default = false)
{
$parts = t3lib_div::revExplode('.', $configPath, 2);
$config = tx_dam_config::getValue($parts[0], true);
return tx_dam_config::isEnabledOption($config, $parts[1], $default);
}
示例9: getSingleField_typeFlex_draw
//.........这里部分代码省略.........
$output .= '
<div class="t3-form-field-toggle-flexsection">
<a href="#" onclick="' . htmlspecialchars('flexFormToggleSubs("' . $idTagPrefix . '"); return false;') . '">' . t3lib_iconWorks::getSpriteIcon('actions-move-right', array('title' => $toggleAll)) . $toggleAll . '
</a>
</div>
<div id="' . $idTagPrefix . '" class="t3-form-field-container-flexsection">' . implode('', $tRows) . '</div>';
$output .= $mayRestructureFlexforms ? '<div class="t3-form-field-add-flexsection"><strong>' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.addnew', 1) . ':</strong> ' . implode(' | ', $newElementsLinks) . '</div>' : '';
} else {
// It is a container
$toggleIcon_open = t3lib_iconWorks::getSpriteIcon('actions-move-down');
$toggleIcon_close = t3lib_iconWorks::getSpriteIcon('actions-move-right');
// Create on-click actions.
//$onClickCopy = 'new Insertion.After($("'.$idTagPrefix.'"), getOuterHTML("'.$idTagPrefix.'").replace(/'.$idTagPrefix.'-/g,"'.$idTagPrefix.'-copy"+Math.floor(Math.random()*100000+1)+"-")); return false;'; // Copied elements doesn't work (well) in Safari while they do in Firefox and MSIE! UPDATE: It turned out that copying doesn't work for any browser, simply because the data from the copied form never gets submitted to the server for some reason! So I decided to simply disable copying for now. If it's requested by customers we can look to enable it again and fix the issue. There is one un-fixable problem though; Copying an element like this will violate integrity if files are attached inside that element because the file reference doesn't get an absolute path prefixed to it which would be required to have TCEmain generate a new copy of the file.
$onClickRemove = 'if (confirm("Are you sure?")){/*###REMOVE###*/;$("' . $idTagPrefix . '").hide();setActionStatus("' . $idPrefix . '");} return false;';
$onClickToggle = 'flexFormToggle("' . $idTagPrefix . '"); return false;';
$onMove = 'flexFormSortable("' . $idPrefix . '")';
// Notice: Creating "new" elements after others seemed to be too difficult to do and since moving new elements created in the bottom is now so easy with drag'n'drop I didn't see the need.
// Putting together header of a section. Sections can be removed, copied, opened/closed, moved up and down:
// I didn't know how to make something right-aligned without a table, so I put it in a table. can be made into <div>'s if someone like to.
// Notice: The fact that I make a "Sortable.create" right onmousedown is that if we initialize this when rendering the form in PHP new and copied elements will not be possible to move as a sortable. But this way a new sortable is initialized everytime someone tries to move and it will always work.
$ctrlHeader = '
<table class="t3-form-field-header-flexsection" onmousedown="' . ($mayRestructureFlexforms ? htmlspecialchars($onMove) : '') . '">
<tr>
<td>
<a href="#" onclick="' . htmlspecialchars($onClickToggle) . '" id="' . $idTagPrefix . '-toggle">
' . ($toggleClosed ? $toggleIcon_close : $toggleIcon_open) . '
</a>
<strong>' . $theTitle . '</strong> <em><span id="' . $idTagPrefix . '-preview"></span></em>
</td>
<td align="right">' . ($mayRestructureFlexforms ? t3lib_iconWorks::getSpriteIcon('actions-move-move', array('title' => 'Drag to Move')) : '') . ($mayRestructureFlexforms ? '<a href="#" onclick="' . htmlspecialchars($onClickRemove) . '">' . t3lib_iconWorks::getSpriteIcon('actions-edit-delete', array('title' => 'Delete')) : '') . '</td>
</tr>
</table>';
$s = t3lib_div::revExplode('[]', $formPrefix, 2);
$actionFieldName = '_ACTION_FLEX_FORM' . $PA['itemFormElName'] . $s[0] . '][_ACTION][' . $s[1];
// Push the container to DynNestedStack as it may be toggled
$this->pushToDynNestedStack('flex', $idTagPrefix);
// Putting together the container:
$this->additionalJS_delete = array();
$output .= '
<div id="' . $idTagPrefix . '" class="t3-form-field-container-flexsections">
<input id="' . $idTagPrefix . '-action" type="hidden" name="' . htmlspecialchars($actionFieldName) . '" value=""/>
' . $ctrlHeader . '
<div class="t3-form-field-record-flexsection" id="' . $idTagPrefix . '-content"' . ($toggleClosed ? ' style="display:none;"' : '') . '>' . $this->getSingleField_typeFlex_draw($value['el'], $editData[$key]['el'], $table, $field, $row, $PA, $formPrefix . '[' . $key . '][el]', $level + 1, $idTagPrefix) . '
</div>
<input id="' . $idTagPrefix . '-toggleClosed" type="hidden" name="' . htmlspecialchars('data[' . $table . '][' . $row['uid'] . '][' . $field . ']' . $formPrefix . '[_TOGGLE]') . '" value="' . ($toggleClosed ? 1 : 0) . '" />
</div>';
$output = str_replace('/*###REMOVE###*/', t3lib_div::slashJS(htmlspecialchars(implode('', $this->additionalJS_delete))), $output);
// NOTICE: We are saving the toggle-state directly in the flexForm XML and "unauthorized" according to the data structure. It means that flexform XML will report unclean and a cleaning operation will remove the recorded togglestates. This is not a fatal problem. Ideally we should save the toggle states in meta-data but it is much harder to do that. And this implementation was easy to make and with no really harmful impact.
// Pop the container from DynNestedStack
$this->popFromDynNestedStack('flex', $idTagPrefix);
}
// If it's a "single form element":
} elseif (is_array($value['TCEforms']['config'])) {
// Rendering a single form element:
if (is_array($PA['_valLang'])) {
$rotateLang = $PA['_valLang'];
} else {
$rotateLang = array($PA['_valLang']);
}
$conditionData = is_array($editData) ? $editData : array();
// add current $row to data processed by isDisplayCondition()
$conditionData['parentRec'] = $row;
$tRows = array();
foreach ($rotateLang as $vDEFkey) {
示例10: explodeElement
function explodeElement($elementList)
{
$elements = t3lib_div::trimExplode(',', $elementList);
foreach ($elements as $k => $element) {
$elements[$k] = t3lib_div::revExplode('_', $element, 2);
}
return $elements;
}
示例11: checkRevExplodeCorrectlyExplodesString
/**
* @test
*/
public function checkRevExplodeCorrectlyExplodesString()
{
$testString = 'my:words:here';
$expectedArray = array('my:words', 'here');
$actualArray = t3lib_div::revExplode(':', $testString, 2);
$this->assertEquals($expectedArray, $actualArray);
}
示例12: getSectionDivisionComment
/**
* Tries to get the division comment above the function
*
* @param string $string: Content to test
* @return mixed Returns array with comment text lines if found.
* @access private
*/
function getSectionDivisionComment($string)
{
$comment = t3lib_div::revExplode('**/', $string, 2);
if (trim($comment[1]) && preg_match('#\\*\\/$#', trim($comment[1]))) {
$outLines = array();
$cDat = $this->parseFunctionComment($comment[1], array());
$textLines = t3lib_div::trimExplode(chr(10), $cDat['text'], 1);
foreach ($textLines as $v) {
if (substr($v, 0, 1) != '*') {
$outLines[] = $v;
}
}
return $outLines;
}
}
示例13: buildCodeBehind
function buildCodeBehind($aCB)
{
$sCBRef = $aCB["path"];
$sName = $aCB["name"];
if ($sCBRef[0] === "E" && $sCBRef[1] === "X" && t3lib_div::isFirstPartOfStr($sCBRef, "EXT:")) {
$sCBRef = substr($sCBRef, 4);
$sPrefix = "EXT:";
} else {
$sPrefix = "";
}
$aParts = explode(":", $sCBRef);
$sFileRef = $sPrefix . $aParts[0];
$sFilePath = $this->toServerPath($sFileRef);
// determining type of the CB
$sFileExt = strtolower(array_pop(t3lib_div::revExplode(".", $sFileRef, 2)));
switch ($sFileExt) {
case "php":
if (is_file($sFilePath) && is_readable($sFilePath)) {
if (count($aParts) < 2) {
if (!in_array($sFilePath, get_included_files())) {
// class has not been defined. Let's try to determine automatically the class name
$aClassesBefore = get_declared_classes();
ob_start();
require_once $sFilePath;
ob_end_clean();
// output buffering for easing use of php class files that execute something outside the class definition ( like BE module's index.php !!)
$aClassesAfter = get_declared_classes();
$aNewClasses = array_diff($aClassesAfter, $aClassesBefore);
if (count($aNewClasses) !== 1) {
$this->mayday("<b>CodeBehind: Cannot automatically determine the classname to use in '" . $sFilePath . "'</b><br />Please add ':myClassName' after the file-path to explicitely.");
} else {
$sClass = array_shift($aNewClasses);
}
} else {
$this->mayday("<b>CodeBehind: Cannot automatically determine the classname to use in '" . $sFilePath . "'</b><br />Please add ':myClassName' after the file-path.");
}
} else {
$sClass = $aParts[1];
ob_start();
require_once $sFilePath;
ob_end_clean();
// output buffering for easing use of php class files that execute something outside the class definition ( like BE module's index.php !!)
}
if (class_exists($sClass)) {
$oCB = new $sClass();
$oCB->oForm =& $this;
$oCB->aConf = $aCB;
return array("type" => "php", "name" => $sName, "filepath" => $sFilePath, "class" => $sClass, "object" => &$oCB, "config" => isset($aCB["config"]) ? $aCB["config"] : FALSE);
} else {
$this->mayday("CodeBehind [" . $sCBRef . "]: class <b>" . $sClass . "</b> does not exist.");
}
} else {
$this->mayday("CodeBehind [" . $sCBRef . "]: file <b>" . $sFileRef . "</b> does not exist.");
}
break;
case "js":
if (count($aParts) < 2) {
$this->mayday("CodeBehind [" . $sCBRef . "]: you have to provide a class name for javascript codebehind <b>" . $sCBRef . "</b>. Please add ':myClassName' after the file-path.");
} else {
$sClass = $aParts[1];
}
if (is_file($sFilePath) && is_readable($sFilePath)) {
if (intval(filesize($sFilePath)) === 0) {
//$this->mayday("CodeBehind [" . $sCBRef . "]: seems to be empty</b>.");
$this->smartMayday_CBJavascript($sFilePath, $sClass, FALSE);
}
return array("type" => "js", "name" => $sName, "filepath" => $sFilePath, "class" => $sClass, "config" => isset($aCB["config"]) ? $aCB["config"] : FALSE);
}
break;
default:
$this->mayday("CodeBehind [" . $sCBRef . "]: allowed file extensions are <b>'.php', '.js' and '.ts'</b>.");
}
}
示例14: main
/**
* Main function
* Makes a header-location redirect to an edit form IF POSSIBLE from the passed data - otherwise the window will just close.
*
* @return void
*/
function main()
{
global $TCA;
if ($this->doClose) {
$this->closeWindow();
} else {
// Initialize:
$table = $this->P['table'];
$field = $this->P['field'];
t3lib_div::loadTCA($table);
$config = $TCA[$table]['columns'][$field]['config'];
$fTable = $this->P['currentValue'] < 0 ? $config['neg_foreign_table'] : $config['foreign_table'];
// Detecting the various allowed field type setups and acting accordingly.
if (is_array($config) && $config['type'] == 'select' && !$config['MM'] && $config['maxitems'] <= 1 && t3lib_div::testInt($this->P['currentValue']) && $this->P['currentValue'] && $fTable) {
// SINGLE value:
$redirectUrl = 'alt_doc.php?returnUrl=' . rawurlencode('wizard_edit.php?doClose=1') . '&edit[' . $fTable . '][' . $this->P['currentValue'] . ']=edit';
t3lib_utility_Http::redirect($redirectUrl);
} elseif (is_array($config) && $this->P['currentSelectedValues'] && ($config['type'] == 'select' && $config['foreign_table'] || $config['type'] == 'group' && $config['internal_type'] == 'db')) {
// MULTIPLE VALUES:
// Init settings:
$allowedTables = $config['type'] == 'group' ? $config['allowed'] : $config['foreign_table'] . ',' . $config['neg_foreign_table'];
$prependName = 1;
$params = '';
// Selecting selected values into an array:
$dbAnalysis = t3lib_div::makeInstance('t3lib_loadDBGroup');
$dbAnalysis->start($this->P['currentSelectedValues'], $allowedTables);
$value = $dbAnalysis->getValueArray($prependName);
// Traverse that array and make parameters for alt_doc.php:
foreach ($value as $rec) {
$recTableUidParts = t3lib_div::revExplode('_', $rec, 2);
$params .= '&edit[' . $recTableUidParts[0] . '][' . $recTableUidParts[1] . ']=edit';
}
// Redirect to alt_doc.php:
t3lib_utility_Http::redirect('alt_doc.php?returnUrl=' . rawurlencode('wizard_edit.php?doClose=1') . $params);
} else {
$this->closeWindow();
}
}
}
示例15: getEmailsForStageChangeNotification
/**
* Return be_users that should be notified on stage change from input list.
* previously called notifyStageChange_getEmails() in tcemain
*
* @param string $listOfUsers List of backend users, on the form "be_users_10,be_users_2" or "10,2" in case noTablePrefix is set.
* @param boolean $noTablePrefix If set, the input list are integers and not strings.
* @return array Array of emails
*/
protected function getEmailsForStageChangeNotification($listOfUsers, $noTablePrefix = FALSE)
{
$users = t3lib_div::trimExplode(',', $listOfUsers, 1);
$emails = array();
foreach ($users as $userIdent) {
if ($noTablePrefix) {
$id = intval($userIdent);
} else {
list($table, $id) = t3lib_div::revExplode('_', $userIdent, 2);
}
if ($table === 'be_users' || $noTablePrefix) {
if ($userRecord = t3lib_BEfunc::getRecord('be_users', $id, 'uid,email,lang,realName')) {
if (strlen(trim($userRecord['email']))) {
$emails[$id] = $userRecord;
}
}
}
}
return $emails;
}