当前位置: 首页>>代码示例>>PHP>>正文


PHP ArrayUtility::removeArrayEntryByValue方法代码示例

本文整理汇总了PHP中TYPO3\CMS\Core\Utility\ArrayUtility::removeArrayEntryByValue方法的典型用法代码示例。如果您正苦于以下问题:PHP ArrayUtility::removeArrayEntryByValue方法的具体用法?PHP ArrayUtility::removeArrayEntryByValue怎么用?PHP ArrayUtility::removeArrayEntryByValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TYPO3\CMS\Core\Utility\ArrayUtility的用法示例。


在下文中一共展示了ArrayUtility::removeArrayEntryByValue方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: pageSubContent

    /**
     * Recursively look for children for page version with $pid
     *
     * @param int $pid UID of page record for which to look up sub-elements following that version
     * @param int $c Counter, do not set (limits to 100 levels)
     * @return string Table with content if any
     */
    public function pageSubContent($pid, $c = 0)
    {
        $tableNames = ArrayUtility::removeArrayEntryByValue(array_keys($GLOBALS['TCA']), 'pages');
        $tableNames[] = 'pages';
        $content = '';
        foreach ($tableNames as $table) {
            // Basically list ALL tables - not only those being copied might be found!
            $mres = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', $table, 'pid=' . (int) $pid . BackendUtility::deleteClause($table), '', $GLOBALS['TCA'][$table]['ctrl']['sortby'] ? $GLOBALS['TCA'][$table]['ctrl']['sortby'] : '');
            if ($GLOBALS['TYPO3_DB']->sql_num_rows($mres)) {
                $content .= '
					<table class="table">
						<tr>
							<th class="col-icon">' . $this->moduleTemplate->getIconFactory()->getIconForRecord($table, array(), Icon::SIZE_SMALL)->render() . '</th>
							<th class="col-title">' . $GLOBALS['LANG']->sL($GLOBALS['TCA'][$table]['ctrl']['title'], true) . '</th>
							<th></th>
							<th></th>
						</tr>';
                while ($subrow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($mres)) {
                    $ownVer = $this->lookForOwnVersions($table, $subrow['uid']);
                    $content .= '
						<tr>
							<td class="col-icon">' . $this->moduleTemplate->getIconFactory()->getIconForRecord($table, $subrow, Icon::SIZE_SMALL)->render() . '</td>
							<td class="col-title">' . htmlspecialchars(BackendUtility::getRecordTitle($table, $subrow, true)) . '</td>
							<td>' . ($ownVer > 1 ? '<a href="' . htmlspecialchars(BackendUtility::getModuleUrl('web_txversionM1', array('table' => $table, 'uid' => $subrow['uid']))) . '">' . ($ownVer - 1) . '</a>' : '') . '</td>
							<td class="col-control">' . $this->adminLinks($table, $subrow) . '</td>
						</tr>';
                    if ($table == 'pages' && $c < 100) {
                        $sub = $this->pageSubContent($subrow['uid'], $c + 1);
                        if ($sub) {
                            $content .= '
								<tr>
									<td></td>
									<td></td>
									<td></td>
									<td width="98%">' . $sub . '</td>
								</tr>';
                        }
                    }
                }
                $content .= '</table>';
            }
            $GLOBALS['TYPO3_DB']->sql_free_result($mres);
        }
        return $content;
    }
开发者ID:vip3out,项目名称:TYPO3.CMS,代码行数:52,代码来源:VersionModuleController.php

示例2: removeArrayEntryByValue

 /**
  * Removes the value $cmpValue from the $array if found there. Returns the modified array
  *
  * @param array $array Array containing the values
  * @param string $cmpValue Value to search for and if found remove array entry where found.
  * @return array Output array with entries removed if search string is found
  * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8  - use ArrayUtility::removeArrayEntryByValue() instead
  */
 public static function removeArrayEntryByValue(array $array, $cmpValue)
 {
     static::logDeprecatedFunction();
     return ArrayUtility::removeArrayEntryByValue($array, $cmpValue);
 }
开发者ID:Gregpl,项目名称:TYPO3.CMS,代码行数:13,代码来源:GeneralUtility.php

示例3: checkValue_group_select_file

 /**
  * Handling files for group/select function
  *
  * @param array $valueArray Array of incoming file references. Keys are numeric, values are files (basically, this is the exploded list of incoming files)
  * @param array $tcaFieldConf Configuration array from TCA of the field
  * @param string $curValue Current value of the field
  * @param array $uploadedFileArray Array of uploaded files, if any
  * @param string $status 'update' or 'new' flag
  * @param string $table tablename of record
  * @param int $id UID of record
  * @param string $recFID Field identifier [table:uid:field] for flexforms
  * @return array Modified value array
  *
  * @throws \RuntimeException
  * @see checkValue_group_select()
  */
 public function checkValue_group_select_file($valueArray, $tcaFieldConf, $curValue, $uploadedFileArray, $status, $table, $id, $recFID)
 {
     // If file handling should NOT be bypassed, do processing:
     if (!$this->bypassFileHandling) {
         // If any files are uploaded, add them to value array
         // Numeric index means that there are multiple files
         if (isset($uploadedFileArray[0])) {
             $uploadedFiles = $uploadedFileArray;
         } else {
             // There is only one file
             $uploadedFiles = array($uploadedFileArray);
         }
         foreach ($uploadedFiles as $uploadedFileArray) {
             if (!empty($uploadedFileArray['name']) && $uploadedFileArray['tmp_name'] !== 'none') {
                 $valueArray[] = $uploadedFileArray['tmp_name'];
                 $this->alternativeFileName[$uploadedFileArray['tmp_name']] = $uploadedFileArray['name'];
             }
         }
         // Creating fileFunc object.
         if (!$this->fileFunc) {
             $this->fileFunc = GeneralUtility::makeInstance(BasicFileUtility::class);
             $this->include_filefunctions = 1;
         }
         // Setting permitted extensions.
         $all_files = array();
         $all_files['webspace']['allow'] = $tcaFieldConf['allowed'];
         $all_files['webspace']['deny'] = $tcaFieldConf['disallowed'] ?: '*';
         $all_files['ftpspace'] = $all_files['webspace'];
         $this->fileFunc->init('', $all_files);
     }
     // If there is an upload folder defined:
     if ($tcaFieldConf['uploadfolder'] && $tcaFieldConf['internal_type'] == 'file') {
         $currentFilesForHistory = null;
         // If filehandling should NOT be bypassed, do processing:
         if (!$this->bypassFileHandling) {
             // For logging..
             $propArr = $this->getRecordProperties($table, $id);
             // Get destrination path:
             $dest = $this->destPathFromUploadFolder($tcaFieldConf['uploadfolder']);
             // If we are updating:
             if ($status == 'update') {
                 // Traverse the input values and convert to absolute filenames in case the update happens to an autoVersionized record.
                 // Background: This is a horrible workaround! The problem is that when a record is auto-versionized the files of the record get copied and therefore get new names which is overridden with the names from the original record in the incoming data meaning both lost files and double-references!
                 // The only solution I could come up with (except removing support for managing files when autoversioning) was to convert all relative files to absolute names so they are copied again (and existing files deleted). This should keep references intact but means that some files are copied, then deleted after being copied _again_.
                 // Actually, the same problem applies to database references in case auto-versioning would include sub-records since in such a case references are remapped - and they would be overridden due to the same principle then.
                 // Illustration of the problem comes here:
                 // We have a record 123 with a file logo.gif. We open and edit the files header in a workspace. So a new version is automatically made.
                 // The versions uid is 456 and the file is copied to "logo_01.gif". But the form data that we sent was based on uid 123 and hence contains the filename "logo.gif" from the original.
                 // The file management code below will do two things: First it will blindly accept "logo.gif" as a file attached to the record (thus creating a double reference) and secondly it will find that "logo_01.gif" was not in the incoming filelist and therefore should be deleted.
                 // If we prefix the incoming file "logo.gif" with its absolute path it will be seen as a new file added. Thus it will be copied to "logo_02.gif". "logo_01.gif" will still be deleted but since the files are the same the difference is zero - only more processing and file copying for no reason. But it will work.
                 if ($this->autoVersioningUpdate === true) {
                     foreach ($valueArray as $key => $theFile) {
                         // If it is an already attached file...
                         if ($theFile === basename($theFile)) {
                             $valueArray[$key] = PATH_site . $tcaFieldConf['uploadfolder'] . '/' . $theFile;
                         }
                     }
                 }
                 // Finding the CURRENT files listed, either from MM or from the current record.
                 $theFileValues = array();
                 // If MM relations for the files also!
                 if ($tcaFieldConf['MM']) {
                     $dbAnalysis = $this->createRelationHandlerInstance();
                     /** @var $dbAnalysis RelationHandler */
                     $dbAnalysis->start('', 'files', $tcaFieldConf['MM'], $id);
                     foreach ($dbAnalysis->itemArray as $item) {
                         if ($item['id']) {
                             $theFileValues[] = $item['id'];
                         }
                     }
                 } else {
                     $theFileValues = GeneralUtility::trimExplode(',', $curValue, true);
                 }
                 $currentFilesForHistory = implode(',', $theFileValues);
                 // DELETE files: If existing files were found, traverse those and register files for deletion which has been removed:
                 if (!empty($theFileValues)) {
                     // Traverse the input values and for all input values which match an EXISTING value, remove the existing from $theFileValues array (this will result in an array of all the existing files which should be deleted!)
                     foreach ($valueArray as $key => $theFile) {
                         if ($theFile && !strstr(GeneralUtility::fixWindowsFilePath($theFile), '/')) {
                             $theFileValues = ArrayUtility::removeArrayEntryByValue($theFileValues, $theFile);
                         }
                     }
                     // This array contains the filenames in the uploadfolder that should be deleted:
                     foreach ($theFileValues as $key => $theFile) {
//.........这里部分代码省略.........
开发者ID:rickymathew,项目名称:TYPO3.CMS,代码行数:101,代码来源:DataHandler.php

示例4: pageSubContent

    /**
     * Recursively look for children for page version with $pid
     *
     * @param int $pid UID of page record for which to look up sub-elements following that version
     * @param int $c Counter, do not set (limits to 100 levels)
     * @return string Table with content if any
     */
    public function pageSubContent($pid, $c = 0)
    {
        $tableNames = ArrayUtility::removeArrayEntryByValue(array_keys($GLOBALS['TCA']), 'pages');
        $tableNames[] = 'pages';
        $content = '';
        foreach ($tableNames as $table) {
            // Basically list ALL tables - not only those being copied might be found!
            $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($table);
            $queryBuilder->getRestrictions()->removeAll()->add(GeneralUtility::makeInstance(DeletedRestriction::class));
            $queryBuilder->select('*')->from($table)->where($queryBuilder->expr()->eq('pid', $queryBuilder->createNamedParameter($pid, \PDO::PARAM_INT)));
            if (!empty($GLOBALS['TCA'][$table]['ctrl']['sortby'])) {
                $queryBuilder->orderBy($GLOBALS['TCA'][$table]['ctrl']['sortby']);
            }
            $result = $queryBuilder->execute();
            if ($result->rowCount()) {
                $content .= '
					<table class="table">
						<tr>
							<th class="col-icon">' . $this->moduleTemplate->getIconFactory()->getIconForRecord($table, [], Icon::SIZE_SMALL)->render() . '</th>
							<th class="col-title">' . htmlspecialchars($this->getLanguageService()->sL($GLOBALS['TCA'][$table]['ctrl']['title'])) . '</th>
							<th></th>
							<th></th>
						</tr>';
                while ($subrow = $result->fetch()) {
                    $ownVer = $this->lookForOwnVersions($table, $subrow['uid']);
                    $content .= '
						<tr>
							<td class="col-icon">' . $this->moduleTemplate->getIconFactory()->getIconForRecord($table, $subrow, Icon::SIZE_SMALL)->render() . '</td>
							<td class="col-title">' . BackendUtility::getRecordTitle($table, $subrow, true) . '</td>
							<td>' . ($ownVer > 1 ? '<a href="' . htmlspecialchars(BackendUtility::getModuleUrl('web_txversionM1', ['table' => $table, 'uid' => $subrow['uid']])) . '">' . ($ownVer - 1) . '</a>' : '') . '</td>
							<td class="col-control">' . $this->adminLinks($table, $subrow) . '</td>
						</tr>';
                    if ($table == 'pages' && $c < 100) {
                        $sub = $this->pageSubContent($subrow['uid'], $c + 1);
                        if ($sub) {
                            $content .= '
								<tr>
									<td></td>
									<td></td>
									<td></td>
									<td width="98%">' . $sub . '</td>
								</tr>';
                        }
                    }
                }
                $content .= '</table>';
            }
        }
        return $content;
    }
开发者ID:,项目名称:,代码行数:57,代码来源:

示例5: cmd_displayImport

    /**
     * Import CSV-Data in step-by-step mode
     *
     * @return	string		HTML form
     */
    public function cmd_displayImport()
    {
        $step = GeneralUtility::_GP('importStep');
        $defaultConf = array('remove_existing' => 0, 'first_fieldname' => 0, 'valid_email' => 0, 'remove_dublette' => 0, 'update_unique' => 0);
        if (GeneralUtility::_GP('CSV_IMPORT')) {
            $importerConfig = GeneralUtility::_GP('CSV_IMPORT');
            if ($step['next'] == 'mapping') {
                $this->indata = $importerConfig + $defaultConf;
            } else {
                $this->indata = $importerConfig;
            }
        }
        if (empty($this->indata)) {
            $this->indata = array();
        }
        if (empty($this->params)) {
            $this->params = array();
        }
        // merge it with inData, but inData has priority.
        $this->indata = $this->indata + $this->params;
        //		$currentFileInfo = BasicFileUtility::getTotalFileInfo($this->indata['newFile']);
        //		$currentFileName = $currentFileInfo['file'];
        //		$currentFileSize = GeneralUtility::formatSize($currentFileInfo['size']);
        //		$currentFileMessage = $currentFileName . ' (' . $currentFileSize . ')';
        if (empty($this->indata['csv']) && !empty($_FILES['upload_1']['name'])) {
            $this->indata['newFile'] = $this->checkUpload();
            // TYPO3 6.0 returns an object...
            if (is_object($this->indata['newFile'][0])) {
                $storageConfig = $this->indata['newFile'][0]->getStorage()->getConfiguration();
                $this->indata['newFile'] = $storageConfig['basePath'] . ltrim($this->indata['newFile'][0]->getIdentifier(), '/');
            }
        } elseif (!empty($this->indata['csv']) && empty($_FILES['upload_1']['name'])) {
            if ((strpos($currentFileInfo['file'], 'import') === false ? 0 : 1) && $currentFileInfo['realFileext'] === 'txt') {
                // do nothing
            } else {
                unset($this->indata['newFile']);
            }
        }
        if ($this->indata['back']) {
            $stepCurrent = $step['back'];
        } elseif ($this->indata['next']) {
            $stepCurrent = $step['next'];
        } elseif ($this->indata['update']) {
            $stepCurrent = 'mapping';
        }
        if (strlen($this->indata['csv']) > 0) {
            $this->indata['mode'] = 'csv';
            $this->indata['newFile'] = $this->writeTempFile();
        } elseif (!empty($this->indata['newFile'])) {
            $this->indata['mode'] = 'file';
        } else {
            unset($stepCurrent);
        }
        // check if "email" is mapped
        if ($stepCurrent === 'import') {
            $map = $this->indata['map'];
            $error = array();
            // check noMap
            $newMap = ArrayUtility::removeArrayEntryByValue(array_unique($map), 'noMap');
            if (empty($newMap)) {
                $error[] = 'noMap';
            } elseif (!ArrayUtility::inArray($map, 'email')) {
                $error[] = 'email';
            }
            if ($error) {
                $stepCurrent = 'mapping';
            }
        }
        $out = "";
        switch ($stepCurrent) {
            case 'conf':
                // get list of sysfolder
                // TODO: maybe only subtree von this->id??
                $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid,title', 'pages', 'doktype = 254 AND ' . $GLOBALS['BE_USER']->getPagePermsClause(3) . BackendUtility::deleteClause('pages') . BackendUtility::BEenableFields('pages'), '', 'uid');
                $optStorage = array();
                while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
                    if (BackendUtility::readPageAccess($row['uid'], $GLOBALS['BE_USER']->getPagePermsClause(1))) {
                        $optStorage[] = array($row['uid'], $row['title'] . ' [uid:' . $row['uid'] . ']');
                    }
                }
                $GLOBALS['TYPO3_DB']->sql_free_result($res);
                $optDelimiter = array(array('comma', $this->getLanguageService()->getLL('mailgroup_import_separator_comma')), array('semicolon', $this->getLanguageService()->getLL('mailgroup_import_separator_semicolon')), array('colon', $this->getLanguageService()->getLL('mailgroup_import_separator_colon')), array('tab', $this->getLanguageService()->getLL('mailgroup_import_separator_tab')));
                $optEncap = array(array('doubleQuote', ' " '), array('singleQuote', " ' "));
                // TODO: make it variable?
                $optUnique = array(array('email', 'email'), array('name', 'name'));
                $this->params['inputDisable'] == 1 ? $disableInput = 'disabled="disabled"' : ($disableInput = '');
                // show configuration
                $out = '<hr /><h3>' . $this->getLanguageService()->getLL('mailgroup_import_header_conf') . '</h3>';
                $tblLines = array();
                // get the all sysfolder
                $tblLines[] = array($this->getLanguageService()->getLL('mailgroup_import_storage'), $this->makeDropdown('CSV_IMPORT[storage]', $optStorage, $this->indata['storage']));
                // remove existing option
                $tblLines[] = array($this->getLanguageService()->getLL('mailgroup_import_remove_existing'), '<input type="checkbox" name="CSV_IMPORT[remove_existing]" value="1"' . (!$this->indata['remove_existing'] ? '' : ' checked="checked"') . ' ' . $disableInput . '/> ');
                // first line in csv is to be ignored
                $tblLines[] = array($this->getLanguageService()->getLL('mailgroup_import_first_fieldnames'), '<input type="checkbox" name="CSV_IMPORT[first_fieldname]" value="1"' . (!$this->indata['first_fieldname'] ? '' : ' checked="checked"') . ' ' . $disableInput . '/> ');
//.........这里部分代码省略.........
开发者ID:kartolo,项目名称:direct_mail,代码行数:101,代码来源:Importer.php

示例6: moduleContent


//.........这里部分代码省略.........
             $navigationButtons .= '<input type="submit" class="btn btn-default " value="' . $this->getLanguageService()->getLL('dmail_wiz_next') . '">';
             $theOutput .= '<div id="box-1" class="toggleBox">';
             $theOutput .= $this->makeCategoriesForm($row);
             $theOutput .= '</div></div>';
             $theOutput .= '<input type="hidden" name="CMD" value="send_test">';
             $theOutput .= '<input type="hidden" name="sys_dmail_uid" value="' . $this->sys_dmail_uid . '">';
             $theOutput .= '<input type="hidden" name="pages_uid" value="' . $this->pages_uid . '">';
             $theOutput .= '<input type="hidden" name="currentCMD" value="' . $this->CMD . '">';
             break;
         case 'send_test':
             // Same as send_mail_test
         // Same as send_mail_test
         case 'send_mail_test':
             // send test mail
             $this->currentStep = 4 - (5 - $totalSteps);
             $markers['TITLE'] = $this->getLanguageService()->getLL('dmail_wiz4_testmail');
             $navigationButtons = '<input type="submit" class="btn btn-default" value="' . $this->getLanguageService()->getLL('dmail_wiz_back') . '" name="back">&nbsp;';
             $navigationButtons .= '<input type="submit" class="btn btn-default" value="' . $this->getLanguageService()->getLL('dmail_wiz_next') . '">';
             if ($this->CMD == 'send_mail_test') {
                 // using Flashmessages to show sent test mail
                 $markers['FLASHMESSAGES'] = $this->cmd_send_mail($row);
             }
             $theOutput .= '<br /><div id="box-1" class="toggleBox">';
             $theOutput .= $this->cmd_testmail();
             $theOutput .= '</div></div>';
             $theOutput .= '<input type="hidden" name="CMD" value="send_mass">';
             $theOutput .= '<input type="hidden" name="sys_dmail_uid" value="' . $this->sys_dmail_uid . '">';
             $theOutput .= '<input type="hidden" name="pages_uid" value="' . $this->pages_uid . '">';
             $theOutput .= '<input type="hidden" name="currentCMD" value="' . $this->CMD . '">';
             break;
         case 'send_mail_final':
             // same as send_mass
         // same as send_mass
         case 'send_mass':
             $this->currentStep = 5 - (5 - $totalSteps);
             if ($this->CMD == 'send_mass') {
                 $navigationButtons = '<input type="submit" class="btn btn-default" value="' . $this->getLanguageService()->getLL('dmail_wiz_back') . '" name="back">';
             }
             if ($this->CMD == 'send_mail_final') {
                 $selectedMailGroups = GeneralUtility::_GP('mailgroup_uid');
                 if (is_array($selectedMailGroups)) {
                     $markers['FLASHMESSAGES'] = $this->cmd_send_mail($row);
                     break;
                 } else {
                     $theOutput .= 'no recipients';
                 }
             }
             // send mass, show calendar
             $theOutput .= '<div id="box-1" class="toggleBox">';
             $theOutput .= $this->cmd_finalmail($row);
             $theOutput .= '</div>';
             $theOutput = $this->doc->section($this->getLanguageService()->getLL('dmail_wiz5_sendmass'), $theOutput, 1, 1, 0, true);
             $theOutput .= '<input type="hidden" name="CMD" value="send_mail_final">';
             $theOutput .= '<input type="hidden" name="sys_dmail_uid" value="' . $this->sys_dmail_uid . '">';
             $theOutput .= '<input type="hidden" name="pages_uid" value="' . $this->pages_uid . '">';
             $theOutput .= '<input type="hidden" name="currentCMD" value="' . $this->CMD . '">';
             break;
         default:
             // choose source newsletter
             $this->currentStep = 1;
             $markers['TITLE'] = $this->getLanguageService()->getLL('dmail_wiz1_new_newsletter') . ' - ' . $this->getLanguageService()->getLL('dmail_wiz1_select_nl_source');
             $showTabs = array('int', 'ext', 'quick', 'dmail');
             $hideTabs = GeneralUtility::trimExplode(',', $GLOBALS['BE_USER']->userTS['tx_directmail.']['hideTabs']);
             foreach ($hideTabs as $hideTab) {
                 $showTabs = ArrayUtility::removeArrayEntryByValue($showTabs, $hideTab);
             }
             if (!$GLOBALS['BE_USER']->userTS['tx_directmail.']['defaultTab']) {
                 $GLOBALS['BE_USER']->userTS['tx_directmail.']['defaultTab'] = 'dmail';
             }
             $i = 1;
             $countTabs = count($showTabs);
             foreach ($showTabs as $showTab) {
                 $open = false;
                 if ($GLOBALS['BE_USER']->userTS['tx_directmail.']['defaultTab'] == $showTab) {
                     $open = true;
                 }
                 switch ($showTab) {
                     case 'int':
                         $theOutput .= $this->makeFormInternal('box-' . $i, $countTabs, $open);
                         break;
                     case 'ext':
                         $theOutput .= $this->makeFormExternal('box-' . $i, $countTabs, $open);
                         break;
                     case 'quick':
                         $theOutput .= $this->makeFormQuickMail('box-' . $i, $countTabs, $open);
                         break;
                     case 'dmail':
                         $theOutput .= $this->makeListDMail('box-' . $i, $countTabs, $open);
                         break;
                     default:
                 }
                 $i++;
             }
             $theOutput .= '<input type="hidden" name="CMD" value="info" />';
     }
     $markers['NAVIGATION'] = $navigationButtons;
     $markers['CONTENT'] = $theOutput;
     $markers['WIZARDSTEPS'] = $this->showSteps($totalSteps);
     return $markers;
 }
开发者ID:kartolo,项目名称:direct_mail,代码行数:101,代码来源:Dmail.php

示例7: checkRemoveArrayEntryByValueRemovesEntryWithEmptyString

 /**
  * @test
  */
 public function checkRemoveArrayEntryByValueRemovesEntryWithEmptyString()
 {
     $inputArray = array('0' => 'foo', '1' => '', '2' => 'bar');
     $compareValue = '';
     $expectedResult = array('0' => 'foo', '2' => 'bar');
     $actualResult = ArrayUtility::removeArrayEntryByValue($inputArray, $compareValue);
     $this->assertEquals($expectedResult, $actualResult);
 }
开发者ID:graurus,项目名称:testgit_t37,代码行数:11,代码来源:ArrayUtilityTest.php

示例8: pageSubContent

    /**
     * Recursively look for children for page version with $pid
     *
     * @param int $pid UID of page record for which to look up sub-elements following that version
     * @param int $c Counter, do not set (limits to 100 levels)
     * @return string Table with content if any
     */
    public function pageSubContent($pid, $c = 0)
    {
        $tableNames = ArrayUtility::removeArrayEntryByValue(array_keys($GLOBALS['TCA']), 'pages');
        $tableNames[] = 'pages';
        $content = '';
        foreach ($tableNames as $tN) {
            // Basically list ALL tables - not only those being copied might be found!
            $mres = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', $tN, 'pid=' . (int) $pid . BackendUtility::deleteClause($tN), '', $GLOBALS['TCA'][$tN]['ctrl']['sortby'] ? $GLOBALS['TCA'][$tN]['ctrl']['sortby'] : '');
            if ($GLOBALS['TYPO3_DB']->sql_num_rows($mres)) {
                $content .= '
					<tr>
						<td colspan="4" class="' . ($GLOBALS['TCA'][$tN]['ctrl']['versioning_followPages'] ? 'bgColor6' : ($tN == 'pages' ? 'bgColor5' : 'bgColor-10')) . '"' . (!$GLOBALS['TCA'][$tN]['ctrl']['versioning_followPages'] && $tN !== 'pages' ? ' style="color: #666666; font-style:italic;"' : '') . '>' . $tN . '</td>
					</tr>';
                while ($subrow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($mres)) {
                    $ownVer = $this->lookForOwnVersions($tN, $subrow['uid']);
                    $content .= '
						<tr>
							<td>' . $this->adminLinks($tN, $subrow) . '</td>
							<td>' . $subrow['uid'] . '</td>
							' . ($ownVer > 1 ? '<td style="font-weight: bold; background-color: yellow;"><a href="' . htmlspecialchars(BackendUtility::getModuleUrl('web_txversionM1', array('table' => $tN, 'uid' => $subrow['uid']))) . '">' . ($ownVer - 1) . '</a></td>' : '<td></td>') . '
							<td width="98%">' . BackendUtility::getRecordTitle($tN, $subrow, TRUE) . '</td>
						</tr>';
                    if ($tN == 'pages' && $c < 100) {
                        $sub = $this->pageSubContent($subrow['uid'], $c + 1);
                        if ($sub) {
                            $content .= '
								<tr>
									<td></td>
									<td></td>
									<td></td>
									<td width="98%">' . $sub . '</td>
								</tr>';
                        }
                    }
                }
            }
            $GLOBALS['TYPO3_DB']->sql_free_result($mres);
        }
        return $content ? '<table border="1" cellpadding="1" cellspacing="0" width="100%">' . $content . '</table>' : '';
    }
开发者ID:plan2net,项目名称:TYPO3.CMS,代码行数:47,代码来源:VersionModuleController.php

示例9: removeFromList

 /**
  * Removes an value from an Comma-separated list
  * stored $key of user settings
  *
  * @param string $key
  * @param mixed $value
  * @return void
  */
 protected function removeFromList($key, $value)
 {
     $list = $this->get($key);
     if (GeneralUtility::inList($list, $value)) {
         $list = GeneralUtility::trimExplode(',', $list, true);
         $list = ArrayUtility::removeArrayEntryByValue($list, $value);
         $this->set($key, implode(',', $list));
     }
 }
开发者ID:rickymathew,项目名称:TYPO3.CMS,代码行数:17,代码来源:UserSettingsController.php

示例10: init


//.........这里部分代码省略.........
     // Setting cmdKey which is either 'edit' or 'create'
     switch ($this->cmd) {
         case 'edit':
             $this->cmdKey = 'edit';
             break;
         default:
             $this->cmdKey = 'create';
             break;
     }
     // Setting requiredArr to the fields in 'required' intersected field the total field list in order to remove invalid fields.
     $this->requiredArr = array_intersect(GeneralUtility::trimExplode(',', $this->conf[$this->cmdKey . '.']['required'], 1), GeneralUtility::trimExplode(',', $this->conf[$this->cmdKey . '.']['fields'], 1));
     // Setting incoming data. Non-stripped
     $fe = GeneralUtility::_GP('FE');
     $this->dataArr = $fe[$this->theTable];
     // Incoming data.
     // Checking template file and table value
     if (!$this->templateCode) {
         $content = 'No template file found: ' . $this->conf['templateFile'];
         return $content;
     }
     if (!$this->theTable || !$this->fieldList) {
         $content = 'Wrong table: ' . $this->theTable;
         return $content;
         // Not listed or editable table!
     }
     // *****************
     // If data is submitted, we take care of it here.
     // *******************
     if ($this->cmd == 'delete' && !$this->preview && !GeneralUtility::_GP('doNotSave')) {
         // Delete record if delete command is sent + the preview flag is NOT set.
         $this->deleteRecord();
     }
     // If incoming data is seen...
     if (is_array($this->dataArr) && count(ArrayUtility::removeArrayEntryByValue(array_keys($this->dataArr), 'captcha'))) {
         // Evaluation of data:
         $this->parseValues();
         $this->overrideValues();
         $this->evalValues();
         if ($this->conf['evalFunc']) {
             $this->dataArr = $this->userProcess('evalFunc', $this->dataArr);
         }
         /*
         debug($this->dataArr);
         debug($this->failure);
         debug($this->preview);
         */
         // if not preview and no failures, then set data...
         if (!$this->failure && !$this->preview && !GeneralUtility::_GP('doNotSave')) {
             // doNotSave is a global var (eg a 'Cancel' submit button) that prevents the data from being processed
             $this->save();
         } else {
             if ($this->conf['debug']) {
                 debug($this->failure);
             }
         }
     } else {
         $this->defaultValues();
         // If no incoming data, this will set the default values.
         $this->preview = 0;
         // No preview if data is not received
     }
     if ($this->failure) {
         $this->preview = 0;
     }
     // No preview flag if a evaluation failure has occured
     $this->previewLabel = $this->preview ? '_PREVIEW' : '';
开发者ID:cedricziel,项目名称:direct_mail_subscription,代码行数:67,代码来源:Plugin.php


注:本文中的TYPO3\CMS\Core\Utility\ArrayUtility::removeArrayEntryByValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。