本文整理汇总了PHP中FabrikString::rtrimWord方法的典型用法代码示例。如果您正苦于以下问题:PHP FabrikString::rtrimWord方法的具体用法?PHP FabrikString::rtrimWord怎么用?PHP FabrikString::rtrimWord使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FabrikString
的用法示例。
在下文中一共展示了FabrikString::rtrimWord方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
/**
* Draws the html form element
*
* @param array $data to pre-populate element with
* @param int $repeatCounter repeat group counter
*
* @return string elements html
*/
public function render($data, $repeatCounter = 0)
{
$params = $this->getParams();
$name = $this->getHTMLName($repeatCounter);
$value = $this->getValue($data, $repeatCounter);
$id = $this->getHTMLId($repeatCounter);
$rootFolder = $this->rootFolder($value);
if ($rootFolder != '/') {
$value = str_replace($rootFolder, '', $value);
}
// $$$ rob - 30/06/2011 can only select an image if its not a remote image
$canSelect = $params->get('image_front_end_select', '0') && JString::substr($value, 0, 4) !== 'http';
// $$$ rob - 30/062011 allow for full urls in the image. (e.g from csv import)
$defaultImage = JString::substr($value, 0, 4) == 'http' ? $value : COM_FABRIK_LIVESITE . $rootFolder . $value;
$float = $params->get('image_float');
$float = $float != '' ? "style='float:{$float};'" : '';
$w = new FabrikWorker();
$rootFolder = str_replace('/', DS, $rootFolder);
$layout = $this->getLayout('form');
$layoutData = new stdClass();
$layoutData->id = $id;
$layoutData->name = $name;
$layoutData->defaultImage = $defaultImage;
$layoutData->canSelect = $canSelect && $this->isEditable();
$layoutData->value = $w->parseMessageForPlaceHolder($value, $data);
$layoutData->float = $float;
if ($layoutData->canSelect) {
$path = $this->getPath($value, $data, $repeatCounter);
$images = array();
$imageNames = (array) JFolder::files(JPATH_SITE . '/' . $path);
foreach ($imageNames as $n) {
$images[] = JHTML::_('select.option', $n, $n);
}
// $$$rob not sure about his name since we are adding $repeatCounter to getHTMLName();
$layoutData->imageName = $this->getGroupModel()->canRepeat() ? FabrikString::rtrimWord($name, "][{$repeatCounter}]") . "_image][{$repeatCounter}]" : $id . '_image';
$bits = explode('/', $value);
$image = array_pop($bits);
// $$$ hugh - append $rootFolder to JPATH_SITE, otherwise we're showing folders
// they aren't supposed to be able to see.
$layoutData->folders = JFolder::folders(JPATH_SITE . '/' . $rootFolder);
$layoutData->images = $images;
$layoutData->image = $image;
}
$layoutData->linkURL = $params->get('link_url', '');
return $layout->render($layoutData);
}
示例2: render
/**
* draws the form element
* @param int repeat group counter
* @return string returns element html
*/
function render($data, $repeatCounter = 0)
{
$params = $this->getParams();
$name = $this->getHTMLName($repeatCounter);
$value = $this->getValue($data, $repeatCounter);
$id = $this->getHTMLId($repeatCounter);
$rootFolder = $params->get('selectImage_root_folder');
// $$$ hugh - tidy up a bit so we don't have so many ///'s in the URL's
$rootFolder = ltrim($rootFolder, '/');
$rootFolder = rtrim($rootFolder, '/');
// $$$ rob - 30/062011 allow for full urls in the image. (e.g from csv import)
$defaultImage = substr($value, 0, 4) == 'http' ? $value : COM_FABRIK_LIVESITE . $rootFolder . '/' . $value;
// $$$ rob - 30/06/2011 can only select an image if its not a remote image
$canSelect = $params->get('image_front_end_select', '0') && substr($value, 0, 4) !== 'http';
$float = $params->get('image_float');
$float = $float != '' ? "style='float:{$float};'" : '';
$str = array();
$str[] = '<div class="fabrikSubElementContainer" id="' . $id . '">';
$rootFolder = str_replace('/', DS, $rootFolder);
if ($canSelect && $this->_editable) {
$str[] = '<img src="' . $defaultImage . '" alt="' . $value . '" ' . $float . ' class="imagedisplayor"/>';
if (array_key_exists($name, $data)) {
if (trim($value) == '') {
$path = "/";
} else {
$bits = explode("/", $value);
if (count($bits) > 1) {
$path = DS . array_shift($bits) . DS;
$path = $rootFolder . $path;
$val = array_shift($bits);
} else {
$path = $rootFolder;
}
}
} else {
$path = $rootFolder;
}
$images = array();
$imagenames = (array) JFolder::files(JPATH_SITE . DS . $path);
foreach ($imagenames as $n) {
$images[] = JHTML::_('select.option', $n, $n);
}
// $$$rob not sure about his name since we are adding $repeatCounter to getHTMLName();
$imageName = $this->_group->canRepeat() ? FabrikString::rtrimWord($name, "][{$repeatCounter}]") . "_image][{$repeatCounter}]" : $id . '_image';
$image = array_pop(explode('/', $value));
// $$$ hugh - append $rootFolder to JPATH_SITE, otherwise we're showing folders
// they aren't supposed to be able to see.
$folders = JFolder::folders(JPATH_SITE . DS . $rootFolder);
// @TODO - if $folders is empty, hide the button/widget? All they can do is select
// from the initial image dropdown list, so no point having the widget for changing folder?
$str[] = '<br/>' . JHTML::_('select.genericlist', $images, $imageName, 'class="inputbox imageselector" ', 'value', 'text', $image);
$str[] = FabrikHelperHTML::folderAjaxSelect($folders);
$str[] = '<input type="hidden" name="' . $name . '" value="' . $value . '" class="fabrikinput hiddenimagepath folderpath" />';
} else {
$linkURL = $params->get('link_url', '');
$imgstr = '<img src="' . $defaultImage . '" alt="' . $value . '" ' . $float . ' class="imagedisplayor"/>' . "\n";
if ($linkURL) {
$imgstr = '<a href="' . $linkURL . '" target="_blank">' . $imgstr . '</a>';
}
$str[] = $imgstr;
$str[] = '<input type="hidden" name="' . $name . '" value="' . $value . '" class="fabrikinput hiddenimagepath folderpath" />';
}
$str[] = '</div>';
return implode("\n", $str);
}