本文整理汇总了PHP中TYPO3\CMS\Core\Utility\GeneralUtility::underscoredToLowerCamelCase方法的典型用法代码示例。如果您正苦于以下问题:PHP GeneralUtility::underscoredToLowerCamelCase方法的具体用法?PHP GeneralUtility::underscoredToLowerCamelCase怎么用?PHP GeneralUtility::underscoredToLowerCamelCase使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Core\Utility\GeneralUtility
的用法示例。
在下文中一共展示了GeneralUtility::underscoredToLowerCamelCase方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: reBuild
/**
* Rebuild the class cache
*
* @param array $parameters
*
* @throws \Evoweb\Extender\Exception\FileNotFoundException
* @throws \TYPO3\CMS\Core\Cache\Exception\InvalidDataException
* @return void
*/
public function reBuild(array $parameters = array())
{
if (empty($parameters) || !empty($parameters['cacheCmd']) && GeneralUtility::inList('all,system', $parameters['cacheCmd']) && isset($GLOBALS['BE_USER'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'] as $extensionKey => $extensionConfiguration) {
if (!isset($extensionConfiguration['extender']) || !is_array($extensionConfiguration['extender'])) {
continue;
}
foreach ($extensionConfiguration['extender'] as $entity => $entityConfiguration) {
$key = 'Domain/Model/' . $entity;
// Get the file to extend, this needs to be loaded as first
$path = ExtensionManagementUtility::extPath($extensionKey) . 'Classes/' . $key . '.php';
if (!is_file($path)) {
throw new \Evoweb\Extender\Exception\FileNotFoundException('given file "' . $path . '" does not exist');
}
$code = $this->parseSingleFile($path, false);
// Get the files from all other extensions that are extending this domain model
if (is_array($entityConfiguration)) {
foreach ($entityConfiguration as $extendingExtension => $extendingFilepath) {
$path = GeneralUtility::getFileAbsFileName($extendingFilepath, false);
if (!is_file($path) && !is_numeric($extendingExtension)) {
$path = ExtensionManagementUtility::extPath($extendingExtension) . 'Classes/' . $key . '.php';
}
$code .= $this->parseSingleFile($path);
}
}
// Close the class definition
$code = $this->closeClassDefinition($code);
// Add the new file to the class cache
$cacheEntryIdentifier = GeneralUtility::underscoredToLowerCamelCase($extensionKey) . '_' . str_replace('/', '', $key);
$this->cacheInstance->set($cacheEntryIdentifier, $code);
}
}
}
}
示例2: render
/**
* Solution for {outer.{inner}} call in fluid
*
* @param object|array $obj object or array
* @param string $prop property name
* @return mixed
*/
public function render($obj, $prop)
{
if (is_array($obj) && array_key_exists($prop, $obj)) {
return $obj[$prop];
}
if (is_object($obj)) {
return ObjectAccess::getProperty($obj, GeneralUtility::underscoredToLowerCamelCase($prop));
}
return null;
}
示例3: loadClass
/**
* Loads php files containing classes or interfaces found in the classes directory of
* an extension.
*
* @param string $className: Name of the class/interface to load
* @uses \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath()
* @return void
*/
public static function loadClass($className)
{
$delimiter = '\\';
$index = 1;
if (strpos($delimiter, $className) === FALSE) {
$delimiter = '_';
$index = 2;
}
$classNameParts = explode($delimiter, $className, 4);
$extensionKey = \TYPO3\CMS\Core\Utility\GeneralUtility::underscoredToLowerCamelCase($classNameParts[$index]);
$classFilePathAndName = PATH_typo3conf . 'ext/' . $extensionKey . '/Classes/' . strtr($classNameParts[$index + 1], $delimiter, '/') . '.php';
if (file_exists($classFilePathAndName)) {
require_once $classFilePathAndName;
}
}
示例4: toPropertyName
/**
* @return string
*/
public function toPropertyName()
{
$fieldName = $this->getFieldName();
$tableName = $this->getTableName();
if (empty($this->storage[$tableName][$fieldName])) {
if ($this->storage[$tableName]) {
$this->storage[$tableName] = array();
}
// Special case when the field name does not follow the conventions "field_name" => "fieldName".
// Rely on mapping for those cases.
if (!empty($GLOBALS['TCA'][$tableName]['vidi']['mappings'][$fieldName])) {
$propertyName = $GLOBALS['TCA'][$tableName]['vidi']['mappings'][$fieldName];
} else {
$propertyName = GeneralUtility::underscoredToLowerCamelCase($fieldName);
}
$this->storage[$tableName][$fieldName] = $propertyName;
}
return $this->storage[$tableName][$fieldName];
}
示例5: isValidOrdering
/**
* Validate ordering as extbase can't handle that currently
*
* @param string $fieldToCheck
* @param string $allowedSettings
* @return boolean
*/
public static function isValidOrdering($fieldToCheck, $allowedSettings)
{
$isValid = TRUE;
if (empty($fieldToCheck)) {
return $isValid;
} elseif (empty($allowedSettings)) {
return FALSE;
}
$fields = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $fieldToCheck, TRUE);
foreach ($GLOBALS['TCA']['tx_mooxnews_domain_model_news']['columns'] as $fieldname => $field) {
if ($field['addToMooxNewsFrontendSorting']) {
$allowedSettings .= "," . \TYPO3\CMS\Core\Utility\GeneralUtility::underscoredToLowerCamelCase($fieldname);
} else {
$nameParts = explode("_", $fieldname);
if ($nameParts[count($nameParts) - 1] == "sortfield") {
if (isset($GLOBALS['TCA']['tx_mooxnews_domain_model_news']['columns'][str_replace("_sortfield", "", $fieldname)])) {
$allowedSettings .= "," . \TYPO3\CMS\Core\Utility\GeneralUtility::underscoredToLowerCamelCase($fieldname);
}
}
}
}
foreach ($fields as $field) {
if ($isValid === TRUE) {
$split = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(' ', $field, TRUE);
$count = count($split);
switch ($count) {
case 1:
if (!\TYPO3\CMS\Core\Utility\GeneralUtility::inList($allowedSettings, $split[0])) {
$isValid = FALSE;
}
break;
case 2:
if (strtolower($split[1]) !== 'desc' && strtolower($split[1]) !== 'asc' || !\TYPO3\CMS\Core\Utility\GeneralUtility::inList($allowedSettings, $split[0])) {
$isValid = FALSE;
}
break;
default:
$isValid = FALSE;
}
}
}
return $isValid;
}
示例6: render
/**
* @param string $string
* @param string $case
* @return string
*/
public function render($string = null, $case = null)
{
if (null === $string) {
$string = $this->renderChildren();
}
if ('BE' === TYPO3_MODE) {
$tsfeBackup = FrontendSimulationUtility::simulateFrontendEnvironment();
}
$charset = $GLOBALS['TSFE']->renderCharset;
switch ($case) {
case self::CASE_LOWER:
$string = $GLOBALS['TSFE']->csConvObj->conv_case($charset, $string, 'toLower');
break;
case self::CASE_UPPER:
$string = $GLOBALS['TSFE']->csConvObj->conv_case($charset, $string, 'toUpper');
break;
case self::CASE_UCWORDS:
$string = ucwords($string);
break;
case self::CASE_UCFIRST:
$string = $GLOBALS['TSFE']->csConvObj->convCaseFirst($charset, $string, 'toUpper');
break;
case self::CASE_LCFIRST:
$string = $GLOBALS['TSFE']->csConvObj->convCaseFirst($charset, $string, 'toLower');
break;
case self::CASE_CAMELCASE:
$string = GeneralUtility::underscoredToUpperCamelCase($string);
break;
case self::CASE_LOWERCAMELCASE:
$string = GeneralUtility::underscoredToLowerCamelCase($string);
break;
case self::CASE_UNDERSCORED:
$string = GeneralUtility::camelCaseToLowerCaseUnderscored($string);
break;
default:
break;
}
if ('BE' === TYPO3_MODE) {
FrontendSimulationUtility::resetFrontendEnvironment($tsfeBackup);
}
return $string;
}
示例7: process
/**
* Preprocess fields from database-record for use in fluid-templates
*
* @param ContentObjectRenderer $cObj The data of the content element or page
* @param array $contentObjectConfiguration The configuration of Content Object
* @param array $processorConfiguration The configuration of this processor
* @param array $processedData Key/value store of processed data (e.g. to be passed to a Fluid View)
* @return array the processed data as key/value store
*/
public function process(ContentObjectRenderer $cObj, array $contentObjectConfiguration, array $processorConfiguration, array $processedData)
{
if (isset($processorConfiguration['if.']) && !$cObj->checkIf($processorConfiguration['if.'])) {
return $processedData;
}
// The field name to process
$fieldName = $cObj->stdWrapValue('fieldName', $processorConfiguration);
if (empty($fieldName)) {
return $processedData;
}
// Set the target variable
$defaultTargetName = GeneralUtility::underscoredToLowerCamelCase($fieldName);
$targetVariableName = $cObj->stdWrapValue('as', $processorConfiguration, $defaultTargetName);
// Let's see if we got a parentField from which the values should be retrieved
$parentField = $cObj->stdWrapValue('parentField', $processorConfiguration);
// Get settings from TypoScript
if (!empty($parentField)) {
$settings = $contentObjectConfiguration['settings.'][$fieldName . '.'][$cObj->data[$parentField] . '.'];
} else {
$settings = $contentObjectConfiguration['settings.'][$fieldName . '.'];
}
// Get value database
$fieldValue = $cObj->data[$fieldName];
// Fill output with value from TypoScript
if (!empty($fieldValue)) {
// Use the value defined in database
$output = $settings[$fieldValue];
} else {
if ($settings['default'] !== '' && $settings[$settings['default']] !== '') {
// Use default value (if set)
$output = $settings[$settings['default']];
} else {
$output = '';
}
}
$processedData[$targetVariableName] = $output;
return $processedData;
}
示例8: loadClass
/**
* Loads php files containing classes or interfaces part of the
* classes directory of an extension.
*
* @param string $className Name of the class/interface to load
*
* @return bool
*/
public function loadClass($className)
{
$className = ltrim($className, '\\');
$extensionKey = $this->getExtensionKey($className);
$classNameParts = GeneralUtility::trimExplode('\\', $className);
$entityKey = array_pop($classNameParts);
if (!$this->isValidClassName($className, $extensionKey, $entityKey)) {
return false;
}
$cacheEntryIdentifier = GeneralUtility::underscoredToLowerCamelCase($extensionKey) . '_' . str_replace('/', '', 'Domain/Model/' . $entityKey);
$classCache = $this->initializeCache();
if (!$classCache->has($cacheEntryIdentifier)) {
/**
* Class cache manager
*
* @var \Evoweb\Extender\Utility\ClassCacheManager $classCacheManager
*/
$classCacheManager = GeneralUtility::makeInstance('Evoweb\\Extender\\Utility\\ClassCacheManager');
$classCacheManager->reBuild();
}
$classCache->requireOnce($cacheEntryIdentifier);
return true;
}
示例9: __call
/**
* Checks for attribute in _contentRow
*
* @param string $name Name of unknown method
* @param array arguments Arguments of call
* @return mixed
*/
public function __call($name, $arguments)
{
if (substr(strtolower($name), 0, 3) == 'get' && strlen($name) > 3) {
$attributeName = lcfirst(substr($name, 3));
if (empty($this->_contentRow)) {
/** @var \TYPO3\CMS\Frontend\Page\PageRepository $pageSelect */
$pageSelect = $GLOBALS['TSFE']->sys_page;
$contentRow = $pageSelect->getRawRecord('tt_content', $this->getUid());
foreach ($contentRow as $key => $value) {
$this->_contentRow[\TYPO3\CMS\Core\Utility\GeneralUtility::underscoredToLowerCamelCase($key)] = $value;
}
}
if (isset($this->_contentRow[$attributeName])) {
return $this->_contentRow[$attributeName];
}
}
}
示例10: getTCAColumns
/**
* Aller TCA Felder holen für bestimmte Tabelle
*
*/
public static function getTCAColumns($table = 'tx_nnmembers_domain_model_member')
{
$cols = $GLOBALS['TCA'][$table]['columns'];
foreach ($cols as $k => $v) {
$cols[\TYPO3\CMS\Core\Utility\GeneralUtility::underscoredToLowerCamelCase($k)] = $v;
}
return $cols;
}
示例11: columnToProperty
/**
* transforms a columnName to a property name
*
* @param string $columnName
* @return string
*/
public static function columnToProperty($columnName)
{
return \TYPO3\CMS\Core\Utility\GeneralUtility::underscoredToLowerCamelCase($columnName);
}
示例12: generatePluginFiles
protected function generatePluginFiles()
{
if ($this->extension->getPlugins()) {
try {
$fileContents = $this->renderTemplate(GeneralUtility::underscoredToLowerCamelCase('ext_localconf.phpt'), array('extension' => $this->extension));
$this->writeFile($this->extensionDirectory . 'ext_localconf.php', $fileContents);
GeneralUtility::devlog('Generated ext_localconf.php', 'extension_builder', 0, array('Content' => $fileContents));
} catch (\Exception $e) {
throw new \Exception('Could not write ext_localconf.php. Error: ' . $e->getMessage());
}
$currentPluginKey = '';
try {
foreach ($this->extension->getPlugins() as $plugin) {
/**
* @var $plugin \EBT\ExtensionBuilder\Domain\Model\Plugin
*/
if ($plugin->getSwitchableControllerActions()) {
if (!is_dir($this->extensionDirectory . 'Configuration/FlexForms')) {
$this->mkdir_deep($this->extensionDirectory, 'Configuration/FlexForms');
}
$currentPluginKey = $plugin->getKey();
$fileContents = $this->renderTemplate('Configuration/Flexforms/flexform.xmlt', array('plugin' => $plugin));
$this->writeFile($this->extensionDirectory . 'Configuration/FlexForms/flexform_' . $currentPluginKey . '.xml', $fileContents);
GeneralUtility::devlog('Generated flexform_' . $currentPluginKey . '.xml', 'extension_builder', 0, array('Content' => $fileContents));
}
}
} catch (\Exception $e) {
throw new \Exception('Could not write flexform_' . $currentPluginKey . '.xml. Error: ' . $e->getMessage());
}
}
}
示例13: schemaAction
/**
* Renders browsable schema for ViewHelpers in extension selected in
* plugin onfiguration. Has a maximum namespace depth of five levels
* from the Tx_ExtensionKey_ViewHelpers location which should fit
* all reasonable setups.
*
* @param string $extensionKey
* @param string $version
* @param string $p1
* @param string $p2
* @param string $p3
* @param string $p4
* @param string $p5
* @return string
* @route NoMatch('bypass')
*/
public function schemaAction($extensionKey = NULL, $version = NULL, $p1 = NULL, $p2 = NULL, $p3 = NULL, $p4 = NULL, $p5 = NULL)
{
if (NULL === $extensionKey) {
$extensionKey = $this->getExtensionKeySetting();
if (NULL === $extensionKey) {
$extensionKey = 'TYPO3.Fluid';
}
if (NULL === $version) {
$version = 'master';
}
}
list($vendor, $extensionKey) = $this->schemaService->getRealExtensionKeyAndVendorFromCombinedExtensionKey($extensionKey);
$schemaFile = $this->getXsdStoragePathSetting() . $extensionKey . '-' . $version . '.xsd';
$schemaFile = GeneralUtility::getFileAbsFileName($schemaFile);
$namespaceName = str_replace('_', '', $extensionKey);
$namespaceName = strtolower($namespaceName);
$namespaceAlias = str_replace('_', '', $extensionKey);
if (isset($this->extensionKeyToNamespaceMap[$extensionKey])) {
$namespaceAlias = $this->extensionKeyToNamespaceMap[$extensionKey];
}
$relativeSchemaFile = substr($schemaFile, strlen(GeneralUtility::getFileAbsFileName('.')) - 1);
$segments = array($p1, $p2, $p3, $p4, $p5);
$segments = $this->trimPathSegments($segments);
if (TRUE === empty($version)) {
$version = 'master';
}
$arguments = $this->segmentsToArguments($extensionKey, $version, $segments);
$extensionName = GeneralUtility::underscoredToLowerCamelCase($extensionKey);
$extensionName = ucfirst($extensionName);
$extensionKeys = $this->getExtensionKeysSetting();
$versions = $this->getVersionsByExtensionKey($extensionKey);
$displayHeadsUp = FALSE;
if (isset($this->extensionKeyToNamespaceMap[$namespaceName])) {
$namespaceName = $this->extensionKeyToNamespaceMap[$namespaceName];
}
list($tree, $node, $viewHelperArguments, $docComment, $targetNamespaceUrl) = $this->getSchemaData($extensionKey, $version, $segments);
$gitCommand = '/usr/bin/git';
if (FALSE === file_exists($gitCommand)) {
$gitCommand = '/usr/local/bin/git';
}
$className = implode('/', $segments);
if (TRUE === ExtensionManagementUtility::isLoaded($extensionKey)) {
if (empty($className)) {
$extensionPath = ExtensionManagementUtility::extPath($extensionKey);
$readmeFile = $extensionPath . 'Classes/ViewHelpers/README.md';
if (TRUE === file_exists($readmeFile)) {
$readmeFile = file_get_contents($readmeFile);
} else {
unset($readmeFile);
}
}
}
$variables = array('action' => 'schema', 'readmeFile' => $readmeFile, 'name' => end($segments), 'schemaFile' => $relativeSchemaFile, 'keys' => array(), 'namespaceUrl' => $targetNamespaceUrl, 'displayHeadsUp' => $displayHeadsUp, 'namespaceName' => $namespaceName, 'namespaceAlias' => $namespaceAlias, 'className' => $className, 'ns' => $namespaceName, 'isFile' => NULL !== $node, 'arguments' => $arguments, 'segments' => $segments, 'markdownBlacklisted' => in_array($extensionKey, $this->markdownBlacklistedExtensionKeys), 'viewHelperArguments' => $viewHelperArguments, 'docComment' => $docComment, 'tree' => $tree, 'version' => $version, 'versions' => $versions, 'extensionKey' => $extensionKey, 'extensionKeys' => $extensionKeys, 'extensionName' => $extensionName, 'showJumpLinks' => TRUE);
$this->view->assignMultiple($variables);
}
示例14: caseshift
/**
* Changing character case of a string, converting typically used western charset characters as well.
*
* @param string $theValue The string to change case for.
* @param string $case The direction; either "upper" or "lower
* @return string
* @see HTMLcaseshift()
*/
public function caseshift($theValue, $case)
{
$tsfe = $this->getTypoScriptFrontendController();
switch (strtolower($case)) {
case 'upper':
$theValue = $tsfe->csConvObj->conv_case($tsfe->renderCharset, $theValue, 'toUpper');
break;
case 'lower':
$theValue = $tsfe->csConvObj->conv_case($tsfe->renderCharset, $theValue, 'toLower');
break;
case 'capitalize':
$theValue = ucwords($theValue);
break;
case 'ucfirst':
$theValue = $tsfe->csConvObj->convCaseFirst($tsfe->renderCharset, $theValue, 'toUpper');
break;
case 'lcfirst':
$theValue = $tsfe->csConvObj->convCaseFirst($tsfe->renderCharset, $theValue, 'toLower');
break;
case 'uppercamelcase':
$theValue = GeneralUtility::underscoredToUpperCamelCase($theValue);
break;
case 'lowercamelcase':
$theValue = GeneralUtility::underscoredToLowerCamelCase($theValue);
break;
}
return $theValue;
}
示例15: getLabelPropertyName
/**
* @param string $table
* @param string $type
* @return string
*/
protected function getLabelPropertyName($table, $type)
{
$typoScript = $this->getConfigurationService()->getAllTypoScript();
if (TRUE === isset($typoScript['config']['tx_extbase']['persistence']['classes'][$type])) {
$mapping = $typoScript['config']['tx_extbase']['persistence']['classes'][$type];
if (TRUE === isset($mapping['mapping']['tableName'])) {
$table = $mapping['mapping']['tableName'];
}
}
$labelField = $GLOBALS['TCA'][$table]['ctrl']['label'];
$propertyName = GeneralUtility::underscoredToLowerCamelCase($labelField);
return $propertyName;
}