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


PHP N2Filesystem::translate方法代码示例

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


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

示例1: render

 /**
  * @param $slider N2SmartSliderAbstract
  * @param $id
  * @param $params
  *
  * @return string
  */
 static function render($slider, $id, $params)
 {
     N2CSS::addFile(N2Filesystem::translate(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'horizontal' . DIRECTORY_SEPARATOR . 'style.css'), $id);
     N2JS::addFile(N2Filesystem::translate(dirname(__FILE__) . '/horizontal/bar.js'), $id);
     list($displayClass, $displayAttributes) = self::getDisplayAttributes($params, self::$key);
     $styleClass = N2StyleRenderer::render($params->get(self::$key . 'style'), 'simple', $slider->elementId, 'div#' . $slider->elementId . ' ');
     $fontTitle = N2FontRenderer::render($params->get(self::$key . 'font-title'), 'simple', $slider->elementId, 'div#' . $slider->elementId . ' ', $slider->fontSize);
     $fontDescription = N2FontRenderer::render($params->get(self::$key . 'font-description'), 'simple', $slider->elementId, 'div#' . $slider->elementId . ' ', $slider->fontSize);
     list($style, $attributes) = self::getPosition($params, self::$key);
     $attributes['data-offset'] = $params->get(self::$key . 'position-offset');
     $style .= 'text-align: ' . $params->get(self::$key . 'align') . ';';
     $width = $params->get(self::$key . 'width');
     if (is_numeric($width) || substr($width, -1) == '%' || substr($width, -2) == 'px') {
         $style .= 'width:' . $width . ';';
     } else {
         $attributes['data-sswidth'] = $width;
     }
     $innerStyle = '';
     if (!$params->get(self::$key . 'full-width')) {
         $innerStyle = 'display: inline-block;';
     }
     $separator = $params->get(self::$key . 'separator');
     $showDescription = intval($params->get(self::$key . 'show-description'));
     $slides = array();
     for ($i = 0; $i < count($slider->slides); $i++) {
         $slides[$i] = N2Html::tag('span', array('class' => $fontTitle), $slider->slides[$i]->getTitle());
         $description = $slider->slides[$i]->getDescription();
         if ($showDescription && !empty($description)) {
             $slides[$i] .= N2Html::tag('span', array('class' => $fontDescription), $separator . $description);
         }
     }
     $parameters = array('overlay' => $params->get(self::$key . 'position-mode') != 'simple' || $params->get(self::$key . 'overlay'), 'area' => intval($params->get(self::$key . 'position-area')), 'animate' => intval($params->get(self::$key . 'animate')));
     N2JS::addInline('new NextendSmartSliderWidgetBarHorizontal("' . $id . '", ' . json_encode($slides) . ', ' . json_encode($parameters) . ');');
     return N2Html::tag("div", $displayAttributes + $attributes + array("class" => $displayClass . "nextend-bar nextend-bar-horizontal", "style" => $style), N2Html::tag("div", array("class" => $styleClass, "style" => $innerStyle), $slides[$slider->_activeSlide]));
 }
开发者ID:vicpril,项目名称:rep_bidqa,代码行数:42,代码来源:horizontal.php

示例2: renderType

 protected function renderType(&$context)
 {
     $params = $this->slider->params;
     N2Loader::import('libraries.image.color');
     $width = intval($context['width']);
     $height = intval($context['height']);
     $context['backgroundSize'] = $params->get('background-size');
     $context['backgroundAttachment'] = $params->get('background-fixed') ? 'fixed' : 'scroll';
     $borderWidth = $params->get('border-width');
     $borderColor = $params->get('border-color');
     $context['borderRadius'] = $params->get('border-radius') . 'px';
     $padding = N2Parse::parse($params->get('padding'));
     $context['paddingt'] = $padding[0] . 'px';
     $context['paddingr'] = $padding[1] . 'px';
     $context['paddingb'] = $padding[2] . 'px';
     $context['paddingl'] = $padding[3] . 'px';
     if ($context['canvas']) {
         $width += 2 * $borderWidth + $padding[1] + $padding[3];
         $height += 2 * $borderWidth + $padding[0] + $padding[2];
         $context['width'] = $width . "px";
         $context['height'] = $height . "px";
     }
     $context['border'] = $borderWidth . 'px';
     $rgba = N2Color::hex2rgba($borderColor);
     $context['borderrgba'] = 'RGBA(' . $rgba[0] . ',' . $rgba[1] . ',' . $rgba[2] . ',' . round($rgba[3] / 127, 2) . ')';
     $context['borderhex'] = '#' . substr($borderColor, 0, 6);
     $width = $width - ($padding[1] + $padding[3]) - $borderWidth * 2;
     $height = $height - ($padding[0] + $padding[2]) - $borderWidth * 2;
     $context['inner1height'] = $height . 'px';
     $context['canvaswidth'] = $width . "px";
     $context['canvasheight'] = $height . "px";
     N2LESS::addFile(N2Filesystem::translate(dirname(__FILE__) . NDS . 'style.less'), $this->slider->cacheId, $context, NEXTEND_SMARTSLIDER_ASSETS . '/less' . NDS);
 }
开发者ID:RenatoToasa,项目名称:Pagina-Web,代码行数:33,代码来源:css.php

示例3: render

 static function render($slider, $id, $params)
 {
     $shadow = $params->get(self::$key . 'shadow-image');
     if (empty($shadow)) {
         $shadow = $params->get(self::$key . 'shadow');
         if ($shadow == -1) {
             $shadow = null;
         }
     }
     if (!$shadow) {
         return '';
     }
     N2JS::addFile(N2Filesystem::translate(dirname(__FILE__) . '/shadow/shadow.js'), $id);
     list($displayClass, $displayAttributes) = self::getDisplayAttributes($params, self::$key);
     list($style, $attributes) = self::getPosition($params, self::$key);
     $width = $params->get(self::$key . 'width');
     if (is_numeric($width) || substr($width, -1) == '%' || substr($width, -2) == 'px') {
         $style .= 'width:' . $width . ';';
     } else {
         $attributes['data-sswidth'] = $width;
     }
     $parameters = array('overlay' => $params->get(self::$key . 'position-mode') != 'simple' || 0, 'area' => intval($params->get(self::$key . 'position-area')));
     N2JS::addInline('new NextendSmartSliderWidgetShadow("' . $id . '", ' . json_encode($parameters) . ');');
     return N2Html::tag('div', $displayAttributes + $attributes + array('class' => $displayClass . "nextend-shadow", 'style' => $style), N2Html::image(N2ImageHelper::fixed($shadow), 'Shadow', array('style' => 'display: block; width:100%;max-width:none;', 'class' => 'n2-ow nextend-shadow-image')));
 }
开发者ID:vicpril,项目名称:rep_bidqa,代码行数:25,代码来源:shadow.php

示例4: renderType

    protected function renderType()
    {
        $params = $this->slider->params;
        N2JS::addFiles(N2Filesystem::translate(dirname(__FILE__) . "/gsap"), array("MainAnimationSimple.js", "TypeSimple.js", "ResponsiveSimple.js"), "smartslider-simple-type-frontend");
        N2JS::addFiles(N2Filesystem::translate(dirname(__FILE__) . "/gsap"), array("BackgroundAnimation.js"), "smartslider-simple-type-frontend");
        N2JS::addFiles(NEXTEND_SMARTSLIDER_ASSETS . "/js/animation", array("BackgroundAnimationAbstract.js", 'Flux.js'), "smartslider-simple-type-frontend");
        $background = $params->get('background');
        $css = $params->get('slider-css');
        $slidecss = $params->get('slide-css');
        if (!empty($background)) {
            $css = 'background-image: url(' . N2ImageHelper::fixed($background) . ');';
        }
        $this->initBackgroundAnimation();
        echo $this->openSliderElement();
        ?>

        <div class="n2-ss-slider-1" style="<?php 
        echo $css;
        ?>
">
            <?php 
        echo $this->getBackgroundVideo($params);
        ?>
            <div class="n2-ss-slider-2">
                <?php 
        if ($this->backgroundAnimation) {
            ?>
                    <div class="n2-ss-background-animation"></div>
                <?php 
        }
        ?>
                <div class="n2-ss-slider-3" style="<?php 
        echo $slidecss;
        ?>
">

                    <?php 
        echo $this->slider->staticHtml;
        foreach ($this->slider->slides as $i => $slide) {
            echo N2Html::tag('div', $slide->attributes + array('class' => 'n2-ss-slide n2-ss-canvas ' . $slide->classes, 'style' => $slide->style), $slide->background . $slide->getHTML());
        }
        ?>
                </div>
            </div>
        </div>
        <?php 
        $this->widgets->echoRemainder();
        echo N2Html::closeTag('div');
        $this->javaScriptProperties['mainanimation'] = array('type' => $params->get('animation'), 'duration' => intval($params->get('animation-duration')), 'delay' => intval($params->get('animation-delay')), 'ease' => $params->get('animation-easing'), 'parallax' => floatval($params->get('animation-parallax')), 'shiftedBackgroundAnimation' => $params->get('animation-shifted-background-animation'));
        $this->javaScriptProperties['mainanimation']['shiftedBackgroundAnimation'] = 0;
        $this->javaScriptProperties['carousel'] = intval($params->get('carousel'));
        $this->javaScriptProperties['dynamicHeight'] = intval($params->get('dynamic-height', '0'));
        $this->javaScriptProperties['dynamicHeight'] = 0;
        N2Plugin::callPlugin('nextendslider', 'onNextendSliderProperties', array(&$this->javaScriptProperties));
        N2JS::addFirstCode("new NextendSmartSliderSimple('#{$this->slider->elementId}', " . json_encode($this->javaScriptProperties) . ");");
        echo N2Html::clear();
    }
开发者ID:vicpril,项目名称:rep_bidqa,代码行数:57,代码来源:type.php

示例5: setFolder

 function setFolder()
 {
     $folder = N2XmlHelper::getAttribute($this->_xml, 'folder');
     if (!empty($folder) && $folder[0] != '$') {
         $folder = dirname($this->_form->_xmlfile) . '/' . $folder . '/';
     } else {
         $folder = N2ImageHelper::fixed($folder, true);
     }
     $this->_folder = N2Filesystem::translate($folder);
 }
开发者ID:RenatoToasa,项目名称:Pagina-Web,代码行数:10,代码来源:imagelistfromfolder.php

示例6: render

 static function render($slider, $id, $params)
 {
     $html = '';
     $previous = $params->get(self::$key . 'previous-image');
     $previousColor = $params->get(self::$key . 'previous-color');
     $previousHover = $params->get(self::$key . 'previous-hover');
     $previousHoverColor = $params->get(self::$key . 'previous-hover-color');
     if (empty($previous)) {
         $previous = $params->get(self::$key . 'previous');
         if ($previous == -1) {
             $previous = null;
         } elseif ($previous[0] != '$') {
             $previous = N2Uri::pathToUri(dirname(__FILE__) . '/image/previous/' . $previous);
         }
     }
     if ($params->get(self::$key . 'mirror')) {
         $next = str_replace('image/previous/', 'image/next/', $previous);
         $nextColor = $previousColor;
         $nextHover = $previousHover;
         $nextHoverColor = $previousHoverColor;
     } else {
         $next = $params->get(self::$key . 'next-image');
         $nextColor = $params->get(self::$key . 'next-color');
         $nextHover = $params->get(self::$key . 'next-hover');
         $nextHoverColor = $params->get(self::$key . 'next-hover-color');
         if (empty($next)) {
             $next = $params->get(self::$key . 'next');
             if ($next == -1) {
                 $next = null;
             } elseif ($next[0] != '$') {
                 $next = N2Uri::pathToUri(dirname(__FILE__) . '/image/next/' . $next);
             }
         }
     }
     if ($previous || $next) {
         N2LESS::addFile(N2Filesystem::translate(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'image' . DIRECTORY_SEPARATOR . 'style.less'), $slider->cacheId, array("sliderid" => $slider->elementId), NEXTEND_SMARTSLIDER_ASSETS . '/less' . NDS);
         N2JS::addFile(N2Filesystem::translate(dirname(__FILE__) . '/image/arrow.js'), $id);
         list($displayClass, $displayAttributes) = self::getDisplayAttributes($params, self::$key);
         $animation = $params->get(self::$key . 'animation');
         if ($animation == 'none' || $animation == 'fade') {
             $styleClass = N2StyleRenderer::render($params->get(self::$key . 'style'), 'heading', $slider->elementId, 'div#' . $slider->elementId . ' ');
         } else {
             $styleClass = N2StyleRenderer::render($params->get(self::$key . 'style'), 'heading-active', $slider->elementId, 'div#' . $slider->elementId . ' ');
         }
         if ($previous) {
             $html .= self::getHTML($id, $params, $animation, 'previous', $previous, $displayClass, $displayAttributes, $styleClass, $previousColor, $previousHover, $previousHoverColor);
         }
         if ($next) {
             $html .= self::getHTML($id, $params, $animation, 'next', $next, $displayClass, $displayAttributes, $styleClass, $nextColor, $nextHover, $nextHoverColor);
         }
         N2JS::addInline('new NextendSmartSliderWidgetArrowImage("' . $id . '", ' . floatval($params->get(self::$key . 'responsive-desktop')) . ', ' . floatval($params->get(self::$key . 'responsive-tablet')) . ', ' . floatval($params->get(self::$key . 'responsive-mobile')) . ');');
     }
     return $html;
 }
开发者ID:rfulwell,项目名称:transitionalresources.org,代码行数:54,代码来源:image.php

示例7: render

 static function render($slider, $id, $params)
 {
     $html = '';
     $play = $params->get(self::$key . 'play-image');
     $playColor = $params->get(self::$key . 'play-color');
     if (empty($play)) {
         $play = $params->get(self::$key . 'play');
         if ($play == -1) {
             $play = null;
         } elseif ($play[0] != '$') {
             $play = N2Uri::pathToUri(dirname(__FILE__) . '/image/play/' . $play);
         }
     }
     if ($params->get(self::$key . 'mirror')) {
         $pause = str_replace('image/play/', 'image/pause/', $play);
         $pauseColor = $playColor;
     } else {
         $pause = $params->get(self::$key . 'pause-image');
         $pauseColor = $params->get(self::$key . 'pause-color');
         if (empty($pause)) {
             $pause = $params->get(self::$key . 'pause');
             if ($pause == -1) {
                 $pause = null;
             } elseif ($pause[0] != '$') {
                 $pause = N2Uri::pathToUri(dirname(__FILE__) . '/image/pause/' . $pause);
             }
         }
     }
     $ext = pathinfo($play, PATHINFO_EXTENSION);
     if (substr($play, 0, 1) == '$' && $ext == 'svg') {
         list($color, $opacity) = N2Color::colorToSVG($playColor);
         $play = 'data:image/svg+xml;base64,' . base64_encode(str_replace(array('fill="#FFF"', 'opacity="1"'), array('fill="#' . $color . '"', 'opacity="' . $opacity . '"'), N2Filesystem::readFile(N2ImageHelper::fixed($play, true))));
     } else {
         $play = N2ImageHelper::fixed($play);
     }
     $ext = pathinfo($pause, PATHINFO_EXTENSION);
     if (substr($pause, 0, 1) == '$' && $ext == 'svg') {
         list($color, $opacity) = N2Color::colorToSVG($pauseColor);
         $pause = 'data:image/svg+xml;base64,' . base64_encode(str_replace(array('fill="#FFF"', 'opacity="1"'), array('fill="#' . $color . '"', 'opacity="' . $opacity . '"'), N2Filesystem::readFile(N2ImageHelper::fixed($pause, true))));
     } else {
         $pause = N2ImageHelper::fixed($pause);
     }
     if ($play && $pause) {
         N2CSS::addFile(N2Filesystem::translate(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'image' . DIRECTORY_SEPARATOR . 'style.css'), $id);
         N2JS::addFile(N2Filesystem::translate(dirname(__FILE__) . '/image/autoplay.js'), $id);
         list($displayClass, $displayAttributes) = self::getDisplayAttributes($params, self::$key);
         $styleClass = N2StyleRenderer::render($params->get(self::$key . 'style'), 'heading', $slider->elementId, 'div#' . $slider->elementId . ' ');
         list($style, $attributes) = self::getPosition($params, self::$key);
         N2JS::addInline('new NextendSmartSliderWidgetAutoplayImage("' . $id . '", ' . floatval($params->get(self::$key . 'responsive-desktop')) . ', ' . floatval($params->get(self::$key . 'responsive-tablet')) . ', ' . floatval($params->get(self::$key . 'responsive-mobile')) . ');');
         $html = N2Html::tag('div', $displayAttributes + $attributes + array('class' => $displayClass . $styleClass . 'nextend-autoplay nextend-autoplay-image', 'style' => $style), N2Html::image($play, '', array('class' => 'nextend-autoplay-play n2-ow')) . N2Html::image($pause, '', array('class' => 'nextend-autoplay-pause n2-ow')));
     }
     return $html;
 }
开发者ID:MBerguer,项目名称:wp-demo,代码行数:53,代码来源:image.php

示例8: render

 /**
  * @param $slider N2SmartSliderAbstract
  * @param $id
  * @param $params
  *
  * @return string
  */
 static function render($slider, $id, $params)
 {
     $showImage = intval($params->get(self::$key . 'show-image'));
     $showTitle = intval($params->get(self::$key . 'title'));
     $showDescription = intval($params->get(self::$key . 'description'));
     if (!$showImage && !$showTitle && !$showDescription) {
         // Nothing to show
         return '';
     }
     N2JS::addFile(N2Filesystem::translate(dirname(__FILE__) . '/default/thumbnail.js'), $id);
     N2LESS::addFile(N2Filesystem::translate(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'default' . DIRECTORY_SEPARATOR . 'style.less'), $slider->cacheId, array("sliderid" => $slider->elementId), NEXTEND_SMARTSLIDER_ASSETS . '/less' . NDS);
     list($displayClass, $displayAttributes) = self::getDisplayAttributes($params, self::$key);
     list($style, $attributes) = self::getPosition($params, self::$key);
     $attributes['data-offset'] = $params->get(self::$key . 'position-offset', 0);
     $barStyle = N2StyleRenderer::render($params->get(self::$key . 'style-bar'), 'simple', $slider->elementId, 'div#' . $slider->elementId . ' ');
     $slideStyle = N2StyleRenderer::render($params->get(self::$key . 'style-slides'), 'dot', $slider->elementId, 'div#' . $slider->elementId . ' ');
     $width = intval($slider->params->get(self::$key . 'width', 160));
     $height = intval($slider->params->get(self::$key . 'height', 100));
     $captionPlacement = $slider->params->get(self::$key . 'caption-placement', 'overlay');
     if (!$showImage) {
         $captionPlacement = 'before';
     }
     if (!$showTitle && !$showDescription) {
         $captionPlacement = 'overlay';
     }
     $captionSize = intval($slider->params->get(self::$key . 'caption-size', 100));
     $showCaption = $showTitle || $showDescription;
     if ($showCaption) {
         $captionStyle = N2StyleRenderer::render($params->get(self::$key . 'title-style'), 'simple', $slider->elementId, 'div#' . $slider->elementId . ' ');
         if ($showTitle) {
             $titleFont = N2FontRenderer::render($params->get(self::$key . 'title-font'), 'simple', $slider->elementId, 'div#' . $slider->elementId . ' ');
         }
         if ($showDescription) {
             $descriptionFont = N2FontRenderer::render($params->get(self::$key . 'description-font'), 'simple', $slider->elementId, 'div#' . $slider->elementId . ' ');
         }
     }
     $group = max(1, intval($params->get(self::$key . 'group')));
     $orientation = self::getOrientationByPosition($params->get(self::$key . 'position-mode'), $params->get(self::$key . 'position-area'), $params->get(self::$key . 'orientation'));
     if ($orientation == 'auto') {
         $orientation = 'vertical';
     }
     $slides = N2Html::openTag('table');
     $containerStyle = '';
     $captionClass = 'n2-caption-' . $captionPlacement;
     $captionExtraStyle = '';
     switch ($captionPlacement) {
         case 'before':
         case 'after':
             switch ($orientation) {
                 case 'vertical':
                     if (!$showImage) {
                         $width = 0;
                     }
                     $containerStyle = "width: " . ($width + $captionSize) . "px; height: {$height}px;";
                     $captionExtraStyle .= "width: {$captionSize}px";
                     break;
                 default:
                     if (!$showImage) {
                         $height = 0;
                     }
                     $containerStyle = "width: {$width}px; height: " . ($height + $captionSize) . "px;";
                     $captionExtraStyle .= "height: {$captionSize}px";
             }
             break;
         default:
             $containerStyle = "width: {$width}px; height: {$height}px;";
     }
     $image = '';
     $rows = array();
     $i = 0;
     foreach ($slider->slides as $slide) {
         $active = '';
         if ($slider->_activeSlide == $i) {
             $active = 'n2-active ';
         }
         if ($orientation == 'horizontal') {
             $row = $i % $group;
         } else {
             $row = intval($i / $group);
         }
         if (!isset($rows[$row])) {
             $rows[$row] = array();
         }
         if ($showImage) {
             $image = N2Html::tag('div', array('class' => 'n2-ss-thumb-image', 'style' => "background-image: URL('" . $slide->getThumbnail() . "'); width: {$width}px; height: {$height}px;"), '');
         }
         $inner = '';
         if ($showCaption) {
             $html = '';
             if ($showTitle) {
                 $html .= N2Html::tag('div', array('class' => $titleFont), $slide->getTitle());
             }
             $description = $slide->getDescription();
//.........这里部分代码省略.........
开发者ID:rfulwell,项目名称:transitionalresources.org,代码行数:101,代码来源:default.php

示例9: getImage

 function getImage($path, $key)
 {
     return N2Uri::pathToUri(N2Filesystem::translate($path . $key . '.png'));
 }
开发者ID:RenatoToasa,项目名称:Pagina-Web,代码行数:4,代码来源:widgetpluginmatrix.php

示例10: _renderGroupOption

 public function _renderGroupOption($group, $sources)
 {
     $options = array();
     foreach ($sources as $type => $info) {
         /**
          * @var $info N2GeneratorInfo
          */
         $options[$type] = $info->title;
         if ($info->hasConfiguration) {
             $button = N2Html::link("Next", $this->appType->router->createUrl(array("generator/checkConfiguration", array("sliderid" => N2Request::getInt('sliderid'), "group" => $group))), array("onclick" => "var el = n2(this); el.attr('href', el.attr('href') + '&type='+el.parents('.n2-box-placeholder').find('select').val());", "class" => "n2-button n2-button-small n2-button-blue"));
         } elseif (!$info->installed) {
             $button = N2Html::link("Check extension", $info->readMore, array("target" => "_blank", "class" => "n2-button n2-button-small n2-button-grey"));
         } else {
             $button = N2Html::link("Next", $this->appType->router->createUrl(array("generator/createSettings", array("sliderid" => N2Request::getInt('sliderid'), "group" => $group))), array("onclick" => "var el = n2(this); el.attr('href', el.attr('href') + '&type='+el.parents('.n2-box-placeholder').find('select').val());", "class" => "n2-button n2-button-small n2-button-blue"));
         }
     }
     $optionsHTML = '';
     foreach ($options as $k => $v) {
         $optionsHTML .= N2Html::tag('option', array('value' => $k), $v);
     }
     echo N2Html::tag('div', array('class' => 'n2-box'), N2Html::image(N2Uri::pathToUri(N2Filesystem::translate($info->path . '/../dynamic.png'))) . N2Html::tag("div", array('class' => 'n2-box-placeholder'), N2Html::tag("table", array(), N2Html::tag("tr", array(), N2Html::tag("td", array('class' => 'n2-box-label'), N2Html::tag('select', array('name' => 'generator-type'), $optionsHTML)) . N2Html::tag("td", array('class' => 'n2-box-button'), $button)))));
 }
开发者ID:MBerguer,项目名称:wp-demo,代码行数:22,代码来源:_view.php

示例11: render

 /**
  * @param $slider N2SmartSliderAbstract
  * @param $id
  * @param $params
  *
  * @return string
  */
 static function render($slider, $id, $params)
 {
     N2JS::addFile(N2Filesystem::translate(dirname(__FILE__) . '/transition/bullet.js'), $id);
     N2CSS::addFile(N2Filesystem::translate(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'transition' . DIRECTORY_SEPARATOR . 'style.css'), $id);
     list($displayClass, $displayAttributes) = self::getDisplayAttributes($params, self::$key);
     $bulletStyle = N2StyleRenderer::render($params->get(self::$key . 'style'), 'dot', $slider->elementId, 'div#' . $slider->elementId . ' ');
     $barStyle = N2StyleRenderer::render($params->get(self::$key . 'bar'), 'simple', $slider->elementId, 'div#' . $slider->elementId . ' ');
     list($style, $attributes) = self::getPosition($params, self::$key);
     $attributes['data-offset'] = $params->get(self::$key . 'position-offset', 0);
     $dots = array();
     $i = 1;
     foreach ($slider->slides as $slide) {
         $dots[] = N2Html::tag('div', array('class' => $bulletStyle . ($slide->isActive() ? 'n2-active' : '')), '');
         $i++;
     }
     $orientation = self::getOrientationByPosition($params->get(self::$key . 'position-mode'), $params->get(self::$key . 'position-area'), $params->get(self::$key . 'orientation'));
     if ($orientation == 'auto') {
         $orientation = 'horizontal';
     }
     $html = '';
     switch ($orientation) {
         case 'vertical':
             $html .= implode('<br>', $dots);
             break;
         default:
             $html .= implode('', $dots);
     }
     $parameters = array('overlay' => $params->get(self::$key . 'position-mode') != 'simple' || $params->get(self::$key . 'overlay'), 'area' => intval($params->get(self::$key . 'position-area')));
     $thumbnails = array();
     if ($params->get(self::$key . 'thumbnail-show-image')) {
         foreach ($slider->slides as $slide) {
             $thumbnails[] = $slide->getThumbnail();
         }
         $parameters['thumbnailWidth'] = intval($params->get(self::$key . 'thumbnail-width'));
         $parameters['thumbnailHeight'] = intval($params->get(self::$key . 'thumbnail-height'));
         $parameters['thumbnailStyle'] = N2StyleRenderer::render($params->get(self::$key . 'thumbnail-style'), 'simple', $slider->elementId, '');
         $side = $params->get(self::$key . 'thumbnail-side');
         if ($side == 'before') {
             if ($orientation == 'vertical') {
                 $position = 'left';
             } else {
                 $position = 'top';
             }
         } else {
             if ($orientation == 'vertical') {
                 $position = 'right';
             } else {
                 $position = 'bottom';
             }
         }
         $parameters['thumbnailPosition'] = $position;
     }
     $parameters['thumbnails'] = $thumbnails;
     $parameters['action'] = $params->get(self::$key . 'action');
     $parameters['numeric'] = 0;
     N2JS::addInline('new NextendSmartSliderWidgetBulletTransition("' . $id . '", ' . json_encode($parameters) . ');');
     $fullSize = intval($params->get(self::$key . 'bar-full-size'));
     if ($fullSize) {
         $displayClass .= "n2-bullet-bar-full-size ";
     }
     return N2Html::tag("div", $displayAttributes + $attributes + array("class" => $displayClass . $barStyle . "nextend-bullet-bar nextend-bullet-bar-" . $orientation, "style" => "text-align: " . $params->get(self::$key . 'align') . ";" . $style), $html);
 }
开发者ID:vicpril,项目名称:rep_bidqa,代码行数:69,代码来源:transition.php


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