function fetchElement() { $min = N2XmlHelper::getAttribute($this->_xml, 'min'); if ($min == '') { $min = '-Number.MAX_VALUE'; } $max = N2XmlHelper::getAttribute($this->_xml, 'max'); if ($max == '') { $max = 'Number.MAX_VALUE'; } N2JS::addInline('new NextendElementNumber("' . $this->_id . '", ' . $min . ', ' . $max . ');'); $html = N2Html::openTag('div', array('class' => 'n2-form-element-text ' . $this->getClass() . ($this->_xml->unit ? 'n2-text-has-unit ' : '') . 'n2-border-radius', 'style' => $this->fieldType == 'hidden' ? 'display: none;' : '')); $subLabel = N2XmlHelper::getAttribute($this->_xml, 'sublabel'); if ($subLabel) { $html .= N2Html::tag('div', array('class' => 'n2-text-sub-label n2-h5 n2-uc'), n2_($subLabel)); } $html .= $this->pre(); $html .= N2Html::tag('input', array('type' => $this->fieldType, 'id' => $this->_id, 'name' => $this->_inputname, 'value' => $this->_form->get($this->_name, $this->_default), 'class' => 'n2-h5', 'style' => $this->getStyle(), 'autocomplete' => 'off'), false); $html .= $this->post(); if ($this->_xml->unit) { $html .= N2Html::tag('div', array('class' => 'n2-text-unit n2-h5 n2-uc'), n2_((string) $this->_xml->unit)); } $html .= "</div>"; return $html; }
function generateOptions(&$xml) { $this->values = array(); $html = ''; foreach ($xml->option as $option) { $v = N2XmlHelper::getAttribute($option, 'value'); $image = N2Uri::pathToUri($v); $selected = $this->isSelected($v); if ($v != -1) { $value = $this->parseValue($image); $this->values[] = $value; $html .= N2Html::openTag("div", array("class" => "n2-radio-option n2-imagelist-option" . ($selected ? ' n2-active' : ''))); $ext = pathinfo($image, PATHINFO_EXTENSION); if ($ext == 'svg') { $image = 'data:image/svg+xml;base64,' . base64_encode(N2Filesystem::readFile(N2Filesystem::getBasePath() . $v)); } $html .= N2Html::image($image, (string) $option, array('data-image' => $value)); $html .= N2Html::closeTag("div"); } else { $this->values[] = -1; $html .= N2Html::tag("div", array("class" => "n2-radio-option" . ($selected ? ' n2-active' : '')), (string) $option); } } return $html; }
function fetchElement() { $html = N2Html::openTag("div", array('class' => 'n2-imagelist n2-imagelistlabel', 'style' => N2XmlHelper::getAttribute($this->_xml, 'style'))); $html .= parent::fetchElement(); $html .= N2Html::closeTag('div'); return $html; }
function render($control_name) { $this->initTabs(); $id = 'n2-form-matrix-' . $this->_name; $active = intval(N2XmlHelper::getAttribute($this->_xml, 'active')); $active = $active > 0 ? $active - 1 : 0; $underlined = N2XmlHelper::getAttribute($this->_xml, 'underlined'); $classes = N2XmlHelper::getAttribute($this->_xml, 'classes'); ?> <div id="<?php echo $id; ?> " class="n2-form-tab n2-form-matrix"> <div class="n2-h2 n2-content-box-title-bg n2-form-matrix-views <?php echo $classes; ?> "> <?php $i = 0; $class = ($underlined ? 'n2-underline' : '') . ' n2-h4 n2-uc n2-has-underline n2-form-matrix-menu'; foreach ($this->_tabs as $tabName => $tab) { echo N2Html::tag("div", array("class" => $class . ($i == $active ? ' n2-active' : '') . ' n2-fm-' . $tabName), N2Html::tag("span", array("class" => "n2-underline"), n2_(N2XmlHelper::getAttribute($tab->_xml, 'label')))); $i++; } ?> </div> <div class="n2-tabs"> <?php $i = 0; foreach ($this->_tabs as $tabName => $tab) { echo N2Html::openTag('div', array('class' => 'n2-form-matrix-pane' . ($i == $active ? ' n2-active' : '') . ' n2-fm-' . $tabName)); $tab->render($control_name); echo N2Html::closeTag('div'); $i++; } ?> </div> </div> <?php N2JS::addInline(' (function(){ var matrix = $("#' . $id . '"), views = matrix.find("> .n2-form-matrix-views > div"), panes = matrix.find("> .n2-tabs > div"); views.on("click", function(){ views.removeClass("n2-active"); panes.removeClass("n2-active"); var i = views.index(this); views.eq(i).addClass("n2-active"); panes.eq(i).addClass("n2-active"); }); })() '); ?> <?php }
private function getHtml($data, $id, $slider, $slide) { $font = N2FontRenderer::render($data->get('font'), 'link', $slider->elementId, 'div#' . $slider->elementId . ' ', $slider->fontSize); $html = N2Html::openTag("div", array("class" => "nextend-smartslider-button-container {$font}", "style" => "cursor: pointer; display:" . ($data->get('fullwidth', 0) ? 'block' : 'inline-block') . ";" . ($data->get('nowrap', 1) ? 'white-space:nowrap;' : ''))); $style = N2StyleRenderer::render($data->get('style'), 'heading', $slider->elementId, 'div#' . $slider->elementId . ' '); $html .= $this->getLink($slide, $data, $slide->fill($data->get("content")), array("style" => "display:" . ($data->get('fullwidth', 0) ? 'block' : 'inline-block') . ";", "class" => "{$style} {$data->get('class', '')}"), true); $html .= N2Html::closeTag("div"); return $html; }
function getTemplate($slider) { $html = N2Html::openTag("div", array('class' => '{styleclass}', 'style' => 'overflow:hidden;')); $html .= N2Html::openTag("a", array("href" => "{url}", "onclick" => 'return false;', "class" => "n2-ow", "style" => "display: block;background: none !important;")); $html .= '<img class="n2-ow" src="{image}" style="display: inline-block; max-width: 100%;width:{width};height:{height};" class="{cssclass}">'; $html .= N2Html::closeTag("a"); $html .= N2Html::closeTag("div"); return $html; }
public function renderFontsConfigurationForm() { $values = N2Fonts::loadSettings(); $form = new N2Form($this->appType); $form->loadArray($values); $form->loadArray($values['plugins']->toArray()); $form->loadXMLFile(N2Loader::getPath('models', 'system') . '/forms/fonts.xml'); echo N2Html::openTag("form", array("id" => "nextend-config", "method" => "post", "action" => N2Request::getRequestUri())); $form->render('fonts'); echo N2Html::closeTag("form"); }
function fetchElement() { $widgetTypes = $this->getOptions(); $id = 'n2-form-matrix-' . $this->_id; $html = N2Html::openTag("div", array('id' => $id, "class" => "n2-form-matrix")); $value = $this->getValue(); $test = false; foreach ($widgetTypes as $type => $v) { if ($value == $type) { $test = true; break; } } if (!$test) { $value = 'arrow'; } $html .= N2Html::openTag('div', array('class' => 'n2-h2 n2-content-box-title-bg n2-form-matrix-views')); $class = 'n2-underline n2-h4 n2-uc n2-has-underline n2-form-matrix-menu'; foreach ($widgetTypes as $type => $v) { $html .= N2Html::tag("div", array("onclick" => "n2('#{$this->_id}').val('{$type}');", "class" => $class . ($value == $type ? ' n2-active' : '')), N2Html::tag("span", array("class" => "n2-underline"), $v[0])); } $html .= N2Html::closeTag("div"); $html .= N2Html::openTag("div", array("class" => "n2-tabs")); foreach ($widgetTypes as $type => $v) { $html .= N2Html::openTag('div', array('class' => 'n2-form-matrix-pane' . ($value == $type ? ' n2-active' : ''))); $GLOBALS['nextendbuffer'] = ''; $form = new N2Form($this->_form->appType); $form->_data =& $this->_form->_data; $form->loadXMLFile($v[1] . 'config.xml'); ob_start(); $form->render($this->control_name); $html .= ob_get_clean(); $html .= $GLOBALS['nextendbuffer']; $html .= N2Html::closeTag("div"); } $html .= N2Html::closeTag("div"); $html .= N2Html::closeTag("div"); N2JS::addInline(' (function(){ var matrix = $("#' . $id . '"), views = matrix.find("> .n2-form-matrix-views > div"), panes = matrix.find("> .n2-tabs > div"); views.on("click", function(){ views.removeClass("n2-active"); panes.removeClass("n2-active"); var i = views.index(this); views.eq(i).addClass("n2-active"); panes.eq(i).addClass("n2-active"); }); })() '); return $html . parent::fetchElement(); }
/** * @param bool $error error message * @param int $limit */ public static function getDebugTrace($error = false, $limit = 5) { $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); $outrace = array(); if ($trace) { foreach ($trace as $k => $trow) { if ($k > 0 && $k <= $limit + 1) { $outrace[] = $trow; } } } if ($error) { echo "<p><strong>{$error}</strong></p>"; } echo N2Html::openTag("pre"); print_r($outrace); echo N2Html::closeTag("pre"); n2_exit(true); }
function fetchElement() { $items = array(); N2Plugin::callPlugin('ssitem', 'onNextendSliderItemList', array(&$items)); ob_start(); ?> <div id="smartslider-slide-toolbox-item" class="nextend-clearfix smartslider-slide-toolbox-view"> <?php $itemModel = new N2SmartsliderItemModel(); foreach ($items as $type => $item) { echo N2Html::openTag("div", array("id" => "smartslider-slide-toolbox-item-type-{$type}", "style" => "display:none", "data-itemtemplate" => $item[1], "data-itemvalues" => $item[3])); $itemModel->renderForm($type, $item); echo N2Html::closeTag("div"); } ?> </div> <?php return ob_get_clean(); }
function generateOptions(&$xml) { $this->values = array(); $html = ''; foreach ($xml->option as $option) { $v = N2XmlHelper::getAttribute($option, 'value'); $image = N2Uri::pathToUri($v); $selected = $this->isSelected($this->parseValue($v)); if ($v != -1) { $this->values[] = $this->parseValue($image); $html .= N2Html::openTag("div", array("class" => "n2-radio-option n2-imagelist-option" . ($selected ? ' n2-active' : ''))); $html .= N2Html::image($image, (string) $option); $html .= N2Html::closeTag("div"); } else { $this->values[] = -1; $html .= N2Html::tag("div", array("class" => "n2-radio-option" . ($selected ? ' n2-active' : '')), (string) $option); } } return $html; }
function fetchElement() { $this->_values = explode('||', $this->getValue()); if (!is_array($this->_values)) { $this->_values = array(); } $this->_multiple = intval(N2XmlHelper::getAttribute($this->_xml, 'multiple')); $this->_translateable = intval(N2XmlHelper::getAttribute($this->_xml, 'translateable')); $size = N2XmlHelper::getAttribute($this->_xml, 'size'); if ($size != '') { $size = " size='" . $size . "'"; } $html = N2Html::openTag("div", array("class" => "n2-form-element-list", "style" => N2XmlHelper::getAttribute($this->_xml, 'style'))); $html .= "<select id='" . $this->_id . "_select' name='select" . $this->_inputname . "' " . $size . $this->isMultiple() . " autocomplete='off'>"; $html .= $this->generateOptions($this->_xml); if ($this->_xml->optgroup) { $html .= $this->generateOptgroup($this->_xml); } $html .= "</select>"; $html .= N2Html::closeTag("div"); $html .= parent::fetchElement(); N2JS::addInline('new NextendElementList("' . $this->_id . '", ' . $this->_multiple . ', "' . $this->getValue() . '");'); return $html; }
$dlRow['options'] = array(); } echo N2Html::openTag('dt', $dlRow['options'] + array('class' => $dlRow['class'])); if (isset($dlRow["linkOptions"])) { echo N2Html::tag('a', isset($dlRow['linkOptions']) ? $dlRow['linkOptions'] : array(), $dlRow['title']); } elseif (isset($dlRow["link"])) { echo N2Html::tag('a', array('href' => $dlRow['link']), $dlRow['title']); } else { echo N2Html::tag('div', array(), $dlRow['title']); } if (!empty($dlRow['actions'])) { echo N2Html::tag('span', array('class' => 'n2-actions'), $dlRow['actions']); } if (!empty($dlRow['after'])) { echo $dlRow['after']; } echo N2Html::closeTag('dt'); echo N2Html::openTag('dd', array('class' => $dlRow['class'])); if (!empty($dlRow["preUl"])) { echo $dlRow["preUl"]; } /** * @see Listn */ if (!empty($dlRow["ul"])) { echo $this->widget->init('listn', array('ul' => $dlRow["ul"])); } echo N2Html::closeTag('dd'); } } echo N2Html::closeTag('dl');
<?php /** * @author Roland Soos * @copyright (C) 2015 Nextendweb.com * @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html **/ defined('_JEXEC') or die('Restricted access'); echo N2Html::openTag('div', $attributes); if ($image[0] == '<') { ?> <?php echo $image; } else { ?> <img src="<?php echo N2ImageHelper::fixed($image); ?> "/> <?php } ?> <?php if ($lt) { echo N2Html::tag('div', $ltAttributes, $lt); } if ($rt) { echo N2Html::tag('div', $rtAttributes, $rt); }
hideSidebarButtons = $('.n2-hide-sidebar') .on('click', function () { if (n2.hasClass('n2-sidebar-hidden')) { n2.removeClass('n2-sidebar-hidden'); } else { n2.addClass('n2-sidebar-hidden'); } $(window).trigger('resize'); }); } ); </script> <?php echo N2Html::openTag('div', array('class' => 'n2-table n2-table-fixed')); echo N2Html::openTag('div', array('class' => 'n2-tr')); if (!empty($logoUrl)) { echo N2Html::tag('div', array('class' => 'n2-td n2-blue-logo-bg n2-logo n2-border-radius-tl'), N2Html::tag('a', array('href' => $logoUrl), N2Html::image($logoImageUrl))); } ?> <div class="n2-td n2-blue-bg n2-header n2-border-radius-tr"> <?php if (isset($actions) && count($actions)) { ?> <div class="n2-header-action n2-left"> <?php foreach ($actions as $action) { echo $action; } ?> </div>
function decorateFormStart() { echo N2Html::openTag("div", array("class" => "n2-form")); }
/** * @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(); if ($showDescription && !empty($description)) { $html .= N2Html::tag('div', array('class' => $descriptionFont), $description); } $inner = N2Html::tag('div', array('class' => $captionStyle . 'n2-ss-caption ' . $captionClass, 'style' => $captionExtraStyle), $html); } switch ($captionPlacement) { case 'before': $inner .= $image; break; case 'after': default: $inner = $image . $inner; } $rows[$row][] = N2Html::tag('td', array(), N2Html::tag('div', array('class' => $slideStyle . $active, 'style' => $containerStyle), $inner)); $i++; } foreach ($rows as $row) { $slides .= N2Html::tag('tr', array(), implode('', $row)); } $slides .= N2Html::closeTag('table'); $parameters = array('overlay' => $params->get(self::$key . 'position-mode') != 'simple' || $params->get(self::$key . 'overlay'), 'area' => intval($params->get(self::$key . 'position-area')), 'orientation' => $orientation, 'group' => $group, 'action' => $params->get(self::$key . 'action')); N2JS::addInline('new NextendSmartSliderWidgetThumbnailDefault("' . $id . '", ' . json_encode($parameters) . ');'); $size = $params->get(self::$key . 'size'); if ($orientation == 'horizontal') { if (is_numeric($size) || substr($size, -1) == '%' || substr($size, -2) == 'px') { $style .= 'width:' . $size . ';'; } else { $attributes['data-sswidth'] = $size; } } else { if (is_numeric($size) || substr($size, -1) == '%' || substr($size, -2) == 'px') { $style .= 'height:' . $size . ';'; } else { $attributes['data-ssheight'] = $size; } } $previous = $next = ''; $showArrow = intval($slider->params->get(self::$key . 'arrow', 1)); if ($showArrow) { $previous = N2Html::image('data:image/svg+xml;base64,' . base64_encode(N2Filesystem::readFile(N2ImageHelper::fixed('$ss$/plugins/widgetthumbnail/default/default/thumbnail-up-arrow.svg', true))), '', array('class' => 'nextend-thumbnail-button nextend-thumbnail-previous')); $next = N2Html::image('data:image/svg+xml;base64,' . base64_encode(N2Filesystem::readFile(N2ImageHelper::fixed('$ss$/plugins/widgetthumbnail/default/default/thumbnail-down-arrow.svg', true))), '', array('class' => 'nextend-thumbnail-button nextend-thumbnail-next n2-active')); } if ($params->get(self::$key . 'position-mode') == 'simple' && $orientation == 'vertical') { $area = $params->get(self::$key . 'position-area'); switch ($area) { case '5': case '6': case '7': case '8': $attributes['data-sstop'] = '0'; break; } } return N2Html::tag('div', $displayAttributes + $attributes + array('class' => $displayClass . 'nextend-thumbnail nextend-thumbnail-default nextend-thumbnail-' . $orientation, 'style' => $style), $previous . $next . N2Html::tag('div', array('class' => 'nextend-thumbnail-inner'), N2Html::tag('div', array('class' => $barStyle . 'nextend-thumbnail-scroller'), $slides))); }
protected function openSliderElement() { return N2Html::openTag('div', array('id' => $this->slider->elementId, 'class' => 'n2-ss-slider ' . $this->getSliderClasses()) + $this->getFontSizeAttributes()); }
<?php echo N2Html::openTag('ul', array('class' => 'n2-list n2-h4 n2-list-orderable')); if (count($ul)) { foreach ($ul as $li) { //begin li $htmlOptions = array(); if (isset($li["htmlOptions"])) { $htmlOptions = $li["htmlOptions"]; } elseif (isset($li["class"])) { $htmlOptions = array("class" => $li["class"]); } if (isset($li["id"]) && strlen($li["id"]) > 1) { $htmlOptions["id"] = $li["id"]; } echo N2Html::openTag('li', $htmlOptions); echo $li['contents']; if (!empty($li['actions'])) { echo N2Html::tag('span', array('class' => 'n2-actions'), $li['actions']); } echo N2Html::closeTag('li'); //end li } } echo N2Html::closeTag('ul');
function render($control_name) { $this->initTabs(); $count = count($this->_tabs); $id = 'n2-tabbed-' . $this->_name; $active = intval(N2XmlHelper::getAttribute($this->_xml, 'active')); $active = $active > 0 ? $active - 1 : 0; $underlined = N2XmlHelper::getAttribute($this->_xml, 'underlined'); ?> <div id="<?php echo $id; ?> "> <div class="n2-table n2-table-fixed n2-labels <?php echo N2XmlHelper::getAttribute($this->_xml, 'classes') . ($underlined ? ' n2-has-underline' : ''); ?> "> <div class="n2-tr"> <?php $i = 0; $class = $underlined ? 'n2-underline' : ''; foreach ($this->_tabs as $tabname => $tab) { echo N2Html::tag('div', array('class' => "n2-td n2-h3 n2-uc n2-has-underline" . ($i == $active ? ' n2-active' : '')), N2Html::tag('span', array('class' => $class), n2_(N2XmlHelper::getAttribute($tab->_xml, 'label')))); $i++; } ?> </div> </div> <div class="n2-tabs"> <?php $tabs = array(); $i = 0; foreach ($this->_tabs as $tabname => $tab) { $display = 'none'; if ($i == $active) { $display = 'block'; } $tabs[] = "\$('#" . $id . '_' . $i . "')"; echo N2Html::openTag('div', array('id' => $id . '_' . $i, 'style' => 'display:' . $display . ';')); $tab->render($control_name); echo N2Html::closeTag('div'); $i++; } ?> </div> </div> <script type="text/javascript"> nextend.ready( function ($) { new NextendHeadingPane($('#<?php echo $id; ?> > .n2-labels .n2-td'), [ <?php echo implode(',', $tabs); ?> ]); } ); </script> <?php }