本文整理汇总了PHP中t3lib_div::isFirstPartOfStr方法的典型用法代码示例。如果您正苦于以下问题:PHP t3lib_div::isFirstPartOfStr方法的具体用法?PHP t3lib_div::isFirstPartOfStr怎么用?PHP t3lib_div::isFirstPartOfStr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类t3lib_div
的用法示例。
在下文中一共展示了t3lib_div::isFirstPartOfStr方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render_clickenlarge
/**
* Rendering the "clickenlarge" custom attribute, called from TypoScript
*
* @param string Content input. Not used, ignore.
* @param array TypoScript configuration
* @return string HTML output.
* @access private
*/
function render_clickenlarge($content, $conf)
{
$clickenlarge = isset($this->cObj->parameters['clickenlarge']) ? $this->cObj->parameters['clickenlarge'] : 0;
$path = $this->cObj->parameters['src'];
$pathPre = $GLOBALS['TYPO3_CONF_VARS']['BE']['RTE_imageStorageDir'] . 'RTEmagicC_';
if (t3lib_div::isFirstPartOfStr($path, $pathPre)) {
// Find original file:
$pI = pathinfo(substr($path, strlen($pathPre)));
$filename = substr($pI['basename'], 0, -strlen('.' . $pI['extension']));
$file = $GLOBALS['TYPO3_CONF_VARS']['BE']['RTE_imageStorageDir'] . 'RTEmagicP_' . $filename;
} else {
$file = $this->cObj->parameters['src'];
}
unset($this->cObj->parameters['clickenlarge']);
unset($this->cObj->parameters['allParams']);
$content = '<img ' . t3lib_div::implodeAttributes($this->cObj->parameters, TRUE, TRUE) . ' />';
if ($clickenlarge && is_array($conf['imageLinkWrap.'])) {
$theImage = $file ? $GLOBALS['TSFE']->tmpl->getFileName($file) : '';
if ($theImage) {
$this->cObj->parameters['origFile'] = $theImage;
if ($this->cObj->parameters['title']) {
$conf['imageLinkWrap.']['title'] = $this->cObj->parameters['title'];
}
if ($this->cObj->parameters['alt']) {
$conf['imageLinkWrap.']['alt'] = $this->cObj->parameters['alt'];
}
$content = $this->cObj->imageLinkWrap($content, $theImage, $conf['imageLinkWrap.']);
$content = $this->cObj->stdWrap($content, $conf['stdWrap.']);
}
}
return $content;
}
示例2: prependDomain
/**
* Prepend current url if url is relative
*
* @param string $url given url
* @return string
*/
public static function prependDomain($url)
{
if (!t3lib_div::isFirstPartOfStr($url, t3lib_div::getIndpEnv('TYPO3_SITE_URL'))) {
$url = t3lib_div::getIndpEnv('TYPO3_SITE_URL') . $url;
}
return $url;
}
示例3: validate
function validate(&$oRdt)
{
$sAbsName = $oRdt->getAbsName();
$sValue = $oRdt->getValue();
if ($sValue === "") {
// never evaluate if value is empty
// as this is left to STANDARD:required
return;
}
$aKeys = array_keys($this->_navConf("/"));
reset($aKeys);
while (!$oRdt->hasError() && (list(, $sKey) = each($aKeys))) {
/***********************************************************************
*
* /pattern
*
***********************************************************************/
if ($sKey[0] === "p" && t3lib_div::isFirstPartOfStr($sKey, "pattern")) {
$sPattern = $this->_navConf("/" . $sKey . "/value");
if (!$this->_isValid($sPattern)) {
$this->oForm->mayday("<b>validator:PREG</b> on renderlet " . $sAbsName . ": the given regular expression pattern seems to be not valid");
}
if (!$this->_isMatch($sPattern, $sValue)) {
$this->oForm->_declareValidationError($sAbsName, "PREG:pattern", $this->oForm->_getLLLabel($this->_navConf("/" . $sKey . "/message")), $sValue);
break;
}
}
}
}
示例4: translate
/**
* Returns the localized label of the LOCAL_LANG key, $key.
*
* @param string $key The key from the LOCAL_LANG array for which to return the value.
* @param string $extensionName The name of the extension
* @param array $arguments the arguments of the extension, being passed over to vsprintf
* @return string The value from LOCAL_LANG or NULL if no translation was found.
* @author Christopher Hlubek <hlubek@networkteam.com>
* @author Bastian Waidelich <bastian@typo3.org>
* @author Sebastian Kurfuerst <sebastian@typo3.org>
* @api
* @todo: If vsprintf gets a malformed string, it returns FALSE! Should we throw an exception there?
*/
public static function translate($key, $extensionName, $arguments = NULL)
{
if (t3lib_div::isFirstPartOfStr($key, 'LLL:')) {
$value = self::translateFileReference($key);
} else {
self::initializeLocalization($extensionName);
// The "from" charset of csConv() is only set for strings from TypoScript via _LOCAL_LANG
if (isset(self::$LOCAL_LANG[$extensionName][self::$languageKey][$key])) {
$value = self::$LOCAL_LANG[$extensionName][self::$languageKey][$key];
if (isset(self::$LOCAL_LANG_charset[$extensionName][self::$languageKey][$key])) {
$value = self::convertCharset($value, self::$LOCAL_LANG_charset[$extensionName][self::$languageKey][$key]);
}
} elseif (self::$alternativeLanguageKey !== '' && isset(self::$LOCAL_LANG[$extensionName][self::$alternativeLanguageKey][$key])) {
$value = self::$LOCAL_LANG[$extensionName][self::$alternativeLanguageKey][$key];
if (isset(self::$LOCAL_LANG_charset[$extensionName][self::$alternativeLanguageKey][$key])) {
$value = self::convertCharset($value, self::$LOCAL_LANG_charset[$extensionName][self::$alternativeLanguageKey][$key]);
}
} elseif (isset(self::$LOCAL_LANG[$extensionName]['default'][$key])) {
$value = self::$LOCAL_LANG[$extensionName]['default'][$key];
// No charset conversion because default is english and thereby ASCII
}
}
if (is_array($arguments)) {
return vsprintf($value, $arguments);
} else {
return $value;
}
}
示例5: loadAggregates
function loadAggregates()
{
reset($this->aElement);
while (list($sElementName, ) = each($this->aElement)) {
if ($sElementName[0] === "a" && t3lib_div::isFirstPartOfStr($sElementName, "aggregate")) {
if (($sClassFile = $this->_navConf("/" . $sElementName . "/classfile")) === FALSE) {
$this->oForm->mayday("datasource:CONTENTREPOSITORY[name='" . $this->getName() . "'] You have to provide <b>/aggregate/classFile</b>.");
} else {
$sClassFile = $this->oForm->toServerPath($sClassFile);
if (!file_exists($sClassFile)) {
$this->oForm->mayday("datasource:CONTENTREPOSITORY[name='" . $this->getName() . "'] The given <b>/aggregate/classFile</b> given (" . $sClassFile . ") does not exist.");
}
if (!is_readable($sClassFile)) {
$this->oForm->mayday("datasource:CONTENTREPOSITORY[name='" . $this->getName() . "'] The given <b>/aggregate/classFile</b> given (" . $sClassFile . ") exists, but is not readable.");
}
require_once $sClassFile;
}
if (($sClassName = $this->_navConf("/" . $sElementName . "/classname")) === FALSE) {
$this->oForm->mayday("datasource:CONTENTREPOSITORY[name='" . $this->getName() . "'] You have to provide <b>/aggregate/className</b>.");
} else {
if (!class_exists($sClassName)) {
$this->oForm->mayday("datasource:CONTENTREPOSITORY[name='" . $this->getName() . "'] The given <b>/aggregate/className</b> (" . $sClassName . ") does not exist.");
}
}
}
}
}
示例6: render
/**
* @return string
*/
public function render()
{
$url = t3lib_div::getIndpEnv('TYPO3_REQUEST_URL');
if (!t3lib_div::isFirstPartOfStr($url, t3lib_div::getIndpEnv('TYPO3_SITE_URL'))) {
$url = t3lib_div::getIndpEnv('TYPO3_SITE_URL') . $url;
}
return $url;
}
示例7: execute
/**
* returns a label for the given key
*
* @param array $arguments
* @return string
*/
public function execute(array $arguments = array())
{
$label = '';
if (t3lib_div::isFirstPartOfStr($arguments[0], 'EXT')) {
// a full path reference...
$label = $this->resolveFullPathLabel($arguments[0]);
} else {
$label = $this->getLabel($this->languageFile, $arguments[0]);
}
return $label;
}
示例8: _getPathReload
function _getPathReload()
{
if (($sPath = $this->_navConf("/reloadpic/")) !== FALSE) {
if (tx_ameosformidable::isRunneable($sPath)) {
$sPath = $this->callRunneable($sPath);
}
if (t3lib_div::isFirstPartOfStr($sPath, "EXT:")) {
$sPath = t3lib_div::getIndpEnv("TYPO3_SITE_URL") . str_replace(t3lib_div::getIndpEnv("TYPO3_DOCUMENT_ROOT"), "", t3lib_div::getFileAbsFileName($sPath));
}
}
return $sPath;
}
示例9: handleError
public function handleError($params, tslib_fe $pObj)
{
if (isset($params['pageAccessFailureReasons']['fe_group']) && !isset($params['pageAccessFailureReasons']['hidden']) && current($params['pageAccessFailureReasons']['fe_group']) !== 0) {
// make sure realurl does't issue this 401
$code = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ajaxlogin']['unauthorized_handling'];
$header = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ajaxlogin']['unauthorized_handling_statheader'];
if (t3lib_div::isFirstPartOfStr($code, 'REDIRECT:')) {
$appendQueryString = 'redirect_url=' . rawurlencode(t3lib_div::getIndpEnv('TYPO3_REQUEST_URL'));
if (strpos($code, '?') === false) {
$code .= '?' . $appendQueryString;
} else {
$code .= '&' . $appendQueryString;
}
}
} else {
$code = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ajaxlogin']['pageNotFound_handling'];
$header = $GLOBALS['TYPO3_CONF_VARS']['FE']['pageNotFound_handling_statheader'];
}
$pObj->pageErrorHandler($code, $header, $params['reasonText']);
}
示例10: getSubMenu
/**
* Recursively builds a sub menu structure for the current menu.
*
* @param array $facetOptions Array of facet options
* @param string $menuName Name of the top level menu to build the sub menu structure for
* @param integer $level The sub level depth
* @return array Returns an array sub menu structure if a sub menu exists, an empty array otherwise
*/
protected function getSubMenu(array $facetOptions, $menuName, $level)
{
$menu = array();
$subMenuEntryPrefix = $level . '-' . $menuName;
foreach ($facetOptions as $facetOptionKey => $facetOption) {
// find the sub menu items for the current menu
if (t3lib_div::isFirstPartOfStr($facetOptionKey, $subMenuEntryPrefix)) {
$currentMenu = array('title' => $this->getFacetOptionLabel($facetOptionKey, $facetOption['numberOfResults']), 'facetKey' => Tx_Solr_Facet_HierarchicalFacetRenderer::getLastPathSegmentFromHierarchicalFacetOption($facetOptionKey), 'numberOfResults' => $facetOption['numberOfResults'], '_OVERRIDE_HREF' => $facetOption['url'], 'ITEM_STATE' => $facetOption['selected'] ? 'ACT' : 'NO');
$lastPathSegment = Tx_Solr_Facet_HierarchicalFacetRenderer::getLastPathSegmentFromHierarchicalFacetOption($facetOptionKey);
// move one level down (recursion)
$subMenu = $this->getSubMenu($facetOptions, $menuName . '/' . $lastPathSegment, $level + 1);
if (!empty($subMenu)) {
$currentMenu['_SUB_MENU'] = $subMenu;
}
$menu[] = $currentMenu;
}
}
// return one level up
return $menu;
}
示例11: render
/**
* This method executes the requested commands and applies the changes to
* the template.
*
* TODO This method should be located somewhere in a base view
*/
protected function render($actionResult)
{
$commandList = $this->getCommandList();
$commandResolver = $this->getCommandResolver();
foreach ($commandList as $commandName) {
$command = $commandResolver->getCommand($commandName, $this);
$commandVariables = $command->execute();
$subpartTemplate = clone $this->template;
$subpartTemplate->setWorkingTemplateContent($this->template->getSubpart('solr_search_' . $commandName));
if (!is_null($commandVariables)) {
foreach ($commandVariables as $variableName => $commandVariable) {
if (t3lib_div::isFirstPartOfStr($variableName, 'loop_')) {
$dividerPosition = strpos($variableName, '|');
$loopName = substr($variableName, 5, $dividerPosition - 5);
$loopedMarkerName = substr($variableName, $dividerPosition + 1);
$subpartTemplate->addLoop($loopName, $loopedMarkerName, $commandVariable);
} else {
if (t3lib_div::isFirstPartOfStr($variableName, 'subpart_')) {
$subpartName = substr($variableName, 8);
$subpartTemplate->addSubpart($subpartName, $commandVariable);
} else {
$subpartTemplate->addVariable($commandName, $commandVariables);
}
}
}
$this->template->addSubpart('solr_search_' . $commandName, $subpartTemplate->render());
}
unset($subpartTemplate);
}
if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['solr'][$this->getPluginKey()]['renderTemplate'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['solr'][$this->getPluginKey()]['renderTemplate'] as $classReference) {
$templateModifier =& t3lib_div::getUserObj($classReference);
if ($templateModifier instanceof tx_solr_TemplateModifier) {
$templateModifier->modifyTemplate($this->template);
} else {
// TODO throw exceptions
}
}
}
return $this->template->render(tx_solr_Template::CLEAN_TEMPLATE_YES);
}
开发者ID:hkremer,项目名称:Publieke-Omroep-Typo3,代码行数:47,代码来源:class.tx_solr_pluginbase_commandpluginbase.php
示例12: render
/**
* Renders a meta tag
*
* @param boolean $useCurrentDomain If set, current domain is used
* @param boolean $forceAbsoluteUrl If set, absolute url is forced
* @param boolean $useNameAttribute If set, the meta tag is built by using the attribute name="" instead of property
* @return void
*/
public function render($useCurrentDomain = FALSE, $forceAbsoluteUrl = FALSE, $useNameAttribute = FALSE)
{
// set current domain
if ($useCurrentDomain) {
$this->tag->addAttribute('content', t3lib_div::getIndpEnv('TYPO3_REQUEST_URL'));
}
// prepend current domain
if ($forceAbsoluteUrl) {
$path = $this->arguments['content'];
if (!t3lib_div::isFirstPartOfStr($path, t3lib_div::getIndpEnv('TYPO3_SITE_URL'))) {
$this->tag->addAttribute('content', t3lib_div::getIndpEnv('TYPO3_SITE_URL') . $this->arguments['content']);
}
}
if ($useCurrentDomain || isset($this->arguments['content']) && !empty($this->arguments['content'])) {
if ($useNameAttribute && $this->arguments['property'] !== '') {
$attributesContent = $this->arguments['property'];
$this->tag->removeAttribute('property');
$this->tag->addAttribute('name', $attributesContent);
}
$GLOBALS['TSFE']->getPageRenderer()->addMetaTag($this->tag->render());
}
}
示例13: validate
function validate(&$oRdt)
{
$sAbsName = $oRdt->getAbsName();
$mValue = $oRdt->getValue();
$aKeys = array_keys($this->_navConf("/"));
reset($aKeys);
while (!$oRdt->hasError() && (list(, $sKey) = each($aKeys))) {
/***********************************************************************
*
* /unique
*
***********************************************************************/
if ($sKey[0] === "u" && t3lib_div::isFirstPartOfStr($sKey, "unique")) {
// field value has to be unique in the database
// checking this
if (!$this->_isUnique($oRdt, $mValue)) {
$this->oForm->_declareValidationError($sAbsName, "DB:unique", $this->oForm->_getLLLabel($this->_navConf("/" . $sKey . "/message/")), $mValue);
break;
}
}
}
}
示例14: createTag
/**
* Create a tag
*
* @param array $params
* @param TYPO3AJAX $ajaxObj
* @return void
* @throws Exception
*/
public function createTag(array $params, TYPO3AJAX $ajaxObj)
{
$request = t3lib_div::_POST();
try {
// Check if a tag is submitted
if (!isset($request['item']) || empty($request['item'])) {
throw new Exception('error_no-tag');
}
$newsUid = $request['newsid'];
if ((int) $newsUid === 0 && (strlen($newsUid) == 16 && !t3lib_div::isFirstPartOfStr($newsUid, 'NEW'))) {
throw new Exception('error_no-newsid');
}
// Get tag uid
$newTagId = $this->getTagUid($request);
$ajaxObj->setContentFormat('javascript');
$ajaxObj->setContent('');
$response = array($newTagId, $request['item'], self::TAG, self::NEWS, 'tags', 'data[tx_news_domain_model_news][' . $newsUid . '][tags]', $newsUid);
$ajaxObj->setJavascriptCallbackWrap(implode('-', $response));
} catch (Exception $e) {
$errorMsg = $GLOBALS['LANG']->sL(self::LLPATH . $e->getMessage());
$ajaxObj->setError($errorMsg);
}
}
示例15: _doTheMagic
function _doTheMagic($aRendered, $sForm)
{
$sUrl = "";
if ($this->oForm->oDataHandler->_allIsValid()) {
if (($mPage = $this->_navConf("/pageid")) !== FALSE) {
if (tx_ameosformidable::isRunneable($mPage)) {
$mPage = $this->callRunneable($mPage);
}
$sUrl = $this->oForm->cObj->typolink_URL(array("parameter" => $mPage));
if (!t3lib_div::isFirstPartOfStr($sUrl, "http://") && trim($GLOBALS["TSFE"]->baseUrl) !== "") {
$sUrl = $this->oForm->_removeEndingSlash($GLOBALS["TSFE"]->baseUrl) . "/" . $sUrl;
}
} else {
$sUrl = $this->_navConf("/url");
if (tx_ameosformidable::isRunneable($sUrl)) {
$sUrl = $this->callRunneable($sUrl);
}
}
if (is_string($sUrl) && trim($sUrl) !== "") {
header("Location: " . $sUrl);
exit;
}
}
}