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


PHP FabrikString::rtrimWord方法代码示例

本文整理汇总了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);
 }
开发者ID:LGBGit,项目名称:tierno,代码行数:54,代码来源:image.php

示例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);
 }
开发者ID:rhotog,项目名称:fabrik,代码行数:70,代码来源:image.php


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