public static function onSmartsliderDefaultSettings(&$settings) { self::initDefaultFont(); $settings['font'][] = '<param name="item-text-font" type="font" previewmode="paragraph" label="' . n2_('Item') . ' - ' . n2_('Text') . '" default="' . self::$font . '" />'; self::initDefaultStyle(); $settings['style'][] = '<param name="item-text-style" type="style" set="heading" previewmode="heading" label="' . n2_('Item') . ' - ' . n2_('Text') . '" default="' . self::$style . '" />'; }
public static function extend($params) { $params['labelButton'] = 'WordPress'; $params['labelDescription'] = n2_('Select a page or a blog post from your WordPress site.'); $params['image'] = '/element/link_platform.png'; return $params; }
public static function extend($params) { $params['labelButton'] = 'Joomla'; $params['labelDescription'] = n2_('Select article or menu item from your site.'); $params['image'] = '/element/link_platform.png'; return $params; }
public static function getLightboxFoldersFunction() { return 'function (callback) { this.joomlaModal = new NextendModal({ zero: { fit: true, size: [ 980, 680 ], title: "' . n2_('Images') . '", controlsClass: "n2-modal-controls-side", controls: [\'<a href="#" class="n2-button n2-button-big n2-button-green n2-uc n2-h4">' . n2_('Select') . '</a>\'], content: \'\', fn: { show: function () { this.content.append(nextend.browse.getNode("folder")); this.controls.find(".n2-button-green") .on("click", $.proxy(function (e) { e.preventDefault(); this.hide(e); callback(nextend.browse.getCurrentFolder()); }, this)); } } } }, true); }'; }
protected function post() { if (!N2Platform::$hasPosts && !N2PRO) { return ''; } return N2Html::tag('a', array('href' => '#', 'class' => 'n2-form-element-clear'), N2Html::tag('i', array('class' => 'n2-i n2-it n2-i-empty n2-i-grey-opacity'), '')) . '<a id="' . $this->_id . '_button" class="n2-form-element-button n2-h5 n2-uc" href="#">' . n2_('Link') . '</a>'; }
function isMultiple() { if ($this->_multiple) { return ' multiple="multiple" class="nextend-element-hastip" title="' . n2_('Hold down the ctrl (Windows) or command (MAC) button to select multiple options.') . '" '; } return ''; }
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 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 }
function fetchElement() { $html = parent::fetchElement(); $html .= '<a id="' . $this->_id . '_manage" class="n2-button n2-button-medium n2-button-grey n2-h5 n2-uc n2-expert" href="#">' . n2_('Manage') . '</a>'; N2JS::addInline('new NextendElementImageManager("' . $this->_id . '", {});'); return $html; }
function fetchElement() { $db = JFactory::getDBO(); $query = 'SELECT m.id, m.title AS name, m.title, m.parent_id AS parent, m.parent_id FROM #__categories m WHERE m.published = 1 AND (m.extension = "com_content" OR m.extension = "system") ORDER BY m.lft'; $db->setQuery($query); $menuItems = $db->loadObjectList(); $children = array(); if ($menuItems) { foreach ($menuItems as $v) { $pt = $v->parent_id; $list = isset($children[$pt]) ? $children[$pt] : array(); array_push($list, $v); $children[$pt] = $list; } } $this->_xml->addChild('option', htmlspecialchars(n2_('All')))->addAttribute('value', '0'); jimport('joomla.html.html.menu'); $options = JHTML::_('menu.treerecurse', 1, '', array(), $children, 9999, 0, 0); if (count($options)) { foreach ($options as $option) { $this->_xml->addChild('option', htmlspecialchars($option->treename))->addAttribute('value', $option->id); } } return parent::fetchElement(); }
function fetchElement() { $easings = array("dojo.fx.easing.linear" => "Linear", "dojo.fx.easing.quadIn" => "Quad_In", "dojo.fx.easing.quadOut" => "Quad_Out", "dojo.fx.easing.quadInOut" => "Quad_In_Out", "dojo.fx.easing.cubicIn" => "Cubic_In", "dojo.fx.easing.cubicOut" => "Cubic_Out", "dojo.fx.easing.cubicInOut" => "Cubic_In_Out", "dojo.fx.easing.quartIn" => "Quart_In", "dojo.fx.easing.quartOut" => "Quart_Out", "dojo.fx.easing.quartInOut" => "Quart_In_Out", "dojo.fx.easing.quintIn" => "Quint_In", "dojo.fx.easing.quintOut" => "Quint_Out", "dojo.fx.easing.quintInOut" => "Quint_In_Out", "dojo.fx.easing.sineIn" => "Sine_In", "dojo.fx.easing.sineOut" => "Sine_Out", "dojo.fx.easing.sineInOut" => "Sine_In_Out", "dojo.fx.easing.expoIn" => "Expo_In", "dojo.fx.easing.expoOut" => "Expo_Out", "dojo.fx.easing.expoInOut" => "Expo_In_Out", "dojo.fx.easing.circIn" => "Circ_In", "dojo.fx.easing.circOut" => "Circ_Out", "dojo.fx.easing.circInOut" => "Circ_In_Out", "dojo.fx.easing.backIn" => "Back_In", "dojo.fx.easing.backOut" => "Back_Out", "dojo.fx.easing.backInOut" => "Back_In_Out", "dojo.fx.easing.bounceIn" => "Bounce_In", "dojo.fx.easing.bounceOut" => "Bounce_Out", "dojo.fx.easing.bounceInOut" => "Bounce_In_Out"); foreach ($easings as $k => $easing) { $this->_xml->addChild('option', n2_($easing))->addAttribute('value', $k); } return parent::fetchElement(); }
public function lastCheck() { $time = $this->storage->get('update', 'lastcheck'); if (empty($time)) { return n2_('never'); } return date("Y-m-d H:i", $time); }
function fetchElement() { $html = N2Html::tag('div', array('class' => 'n2-form-element-text n2-form-element-icon n2-border-radius'), N2Html::image(N2Image::base64Transparent(), '', array('class' => 'n2-form-element-preview')) . '<a id="' . $this->_id . '_edit" class="n2-form-element-button n2-h5 n2-uc" href="#">' . n2_('Choose') . '</a>' . parent::fetchElement()); N2JS::addInline(' new NextendElementIconManager("' . $this->_id . '"); '); return $html; }
function generateOptions(&$xml) { $html = ''; $html .= '<option value="0" ' . $this->isSelected(0) . '>' . n2_('All') . '</option>'; $html .= '<option value="1" ' . $this->isSelected(1) . '>' . $this->_label . '</option>'; $html .= '<option value="-1" ' . $this->isSelected(-1) . '>' . sprintf(n2_('Not %s'), $this->_label) . '</option>'; return $html; }
function onGeneratorList(&$group, &$list) { $group[self::$group] = self::$groupLabel; if (!isset($list[self::$group])) { $list[self::$group] = array(); } $list[self::$group]['article'] = N2GeneratorInfo::getInstance(self::$groupLabel, n2_('Articles'), $this->getPath() . 'article')->setType('article'); $list[self::$group]['category'] = N2GeneratorInfo::getInstance(self::$groupLabel, n2_('Categories'), $this->getPath() . 'category')->setType('article'); }
function onGeneratorList(&$group, &$list) { $group[self::$_group] = 'Posts'; if (!isset($list[self::$_group])) { $list[self::$_group] = array(); } $list[self::$_group]['posts'] = N2GeneratorInfo::getInstance(self::$groupLabel, n2_('Posts by filter'), $this->getPath() . 'posts')->setType('article'); $list[self::$_group]['postsbyids'] = N2GeneratorInfo::getInstance(self::$groupLabel, n2_('Posts by IDs'), $this->getPath() . 'postsbyids')->setType('article'); }
public static function api($posts) { if (class_exists('JHttp')) { $posts_default = array('platform' => N2Platform::getPlatform()); $client = new JHttp(); $response = $client->post(self::$api, $posts + $posts_default, array('Content-Type' => 'application/x-www-form-urlencoded; charset=utf-8')); if ($response->code != '200') { N2Message::error(n2_('Unable to contact with the licensing server, please try again later!')); return array('status' => 'ERROR_HANDLED'); } if (isset($response->headers['Content-Type'])) { $contentType = $response->headers['Content-Type']; } $data = $response->body; } if (!isset($data)) { if (function_exists('curl_init')) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, self::$api); $posts_default = array('platform' => N2Platform::getPlatform()); curl_setopt($ch, CURLOPT_POSTFIELDS, $posts + $posts_default); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $data = curl_exec($ch); $contentType = curl_getinfo($ch, CURLINFO_CONTENT_TYPE); $error = curl_error($ch); $curlErrorNumber = curl_errno($ch); curl_close($ch); if ($curlErrorNumber) { N2Message::error($curlErrorNumber . $error); return array('status' => 'ERROR_HANDLED'); } } else { $posts_default = array('platform' => N2Platform::getPlatform()); $opts = array('http' => array('method' => 'POST', 'header' => 'Content-type: application/x-www-form-urlencoded', 'content' => http_build_query($posts + $posts_default))); $context = stream_context_create($opts); $data = file_get_contents(self::$api, false, $context); if ($data === false) { N2Message::error(n2_('CURL disabled in your php.ini configuration. Please enable it!')); return array('status' => 'ERROR_HANDLED'); } $headers = self::parseHeaders($http_response_header); if ($headers['status'] != '200') { N2Message::error(n2_('Unable to contact with the licensing server, please try again later!')); return array('status' => 'ERROR_HANDLED'); } if (isset($headers['content-type'])) { $contentType = $headers['content-type']; } } } switch ($contentType) { case 'application/json': return json_decode($data, true); } return $data; }
function fetchTooltip() { if ($this->_label == '-') { $this->_label = ''; } else { $this->_label = n2_($this->_label); } $html = N2Html::tag('label', array('for' => $this->_id), $this->_label); return $html; }
function fetchElement() { N2JS::addInline('new NextendElementFont("' . $this->_id . '", { previewmode: "' . N2XmlHelper::getAttribute($this->_xml, 'previewmode') . '", style: "' . N2XmlHelper::getAttribute($this->_xml, 'style') . '", style2: "' . N2XmlHelper::getAttribute($this->_xml, 'style2') . '", preview: ' . json_encode((string) $this->_xml) . ', set: "' . N2XmlHelper::getAttribute($this->_xml, 'set') . '" });'); return N2Html::tag('div', array('class' => 'n2-form-element-option-chooser n2-border-radius'), parent::fetchElement() . N2Html::tag('input', array('type' => 'text', 'class' => 'n2-h5', 'style' => 'width: 130px;' . N2XmlHelper::getAttribute($this->_xml, 'css'), 'disabled' => 'disabled'), false) . N2Html::tag('a', array('href' => '#', 'class' => 'n2-form-element-clear'), N2Html::tag('i', array('class' => 'n2-i n2-it n2-i-empty n2-i-grey-opacity'), '')) . N2Html::tag('a', array('href' => '#', 'class' => 'n2-form-element-button n2-h5 n2-uc'), n2_('Font'))); }
public function actionChangeVisual() { $this->validateToken(); $visualId = N2Request::getInt('visualId'); $this->validateVariable($visualId > 0, 'image'); $model = $this->getModel(); if ($visual = $model->changeVisual($visualId, N2Request::getVar('value'))) { $this->response->respond(array('visual' => $visual)); } N2Message::error(n2_('Unexpected error')); $this->response->error(); }
public function actionDuplicate() { if ($this->validateToken() && $this->validatePermission('smartslider_edit')) { if ($slideId = N2Request::getInt('slideid')) { $slidesModel = new N2SmartsliderSlidesModel(); $newSlideId = $slidesModel->duplicate($slideId); N2Message::success(n2_('Slide duplicated.')); $this->redirect(array("slides/edit", array("sliderid" => N2Request::getInt("sliderid"), "slideid" => $newSlideId))); } $this->redirect(array("sliders/index")); } }
function renderButton() { /* N2JS::addInline(" $('#{$this->_id}_button').on('click', function(e){ e.preventDefault(); NextendLightbox.open('nextend-subform-{$this->_id}'); }); "); */ return '<a id="' . $this->_id . '_button" class="n2-button n2-button-small n2-button-grey n2-uc" href="#">' . n2_('Configure') . '</a>'; }
public function hasSlides() { //check slide number if (count($this->slides) === 0) { if (N2Platform::$isAdmin) { N2Message::error(n2_('0 slides available for this slider.')); } $this->slider->norender = true; return false; } return true; }
public function actionDuplicate() { if ($this->validateToken() && $this->validatePermission('smartslider_edit')) { $slidersModel = new N2SmartsliderSlidersModel(); if (($sliderid = N2Request::getInt('sliderid')) && $slidersModel->get($sliderid)) { $newSliderId = $slidersModel->duplicate($sliderid); N2Message::success(n2_('Slider duplicated.')); $this->redirect(array("slider/edit", array("sliderid" => $newSliderId))); } $this->redirectToSliders(); } }
function fetchElement() { $preview = preg_replace_callback('/url\\(\'(.*?)\'\\)/', 'N2ElementStyle::fixPreviewImages', (string) $this->_xml); N2JS::addInline('new NextendElementStyle("' . $this->_id . '", { previewmode: "' . N2XmlHelper::getAttribute($this->_xml, 'previewmode') . '", font: "' . N2XmlHelper::getAttribute($this->_xml, 'font') . '", font2: "' . N2XmlHelper::getAttribute($this->_xml, 'font2') . '", style2: "' . N2XmlHelper::getAttribute($this->_xml, 'style2') . '", preview: ' . json_encode($preview) . ', set: "' . N2XmlHelper::getAttribute($this->_xml, 'set') . '" });'); return N2Html::tag('div', array('class' => 'n2-form-element-option-chooser n2-border-radius'), parent::fetchElement() . N2Html::tag('input', array('type' => 'text', 'class' => 'n2-h5', 'style' => 'width: 130px;' . N2XmlHelper::getAttribute($this->_xml, 'css'), 'disabled' => 'disabled'), false) . N2Html::tag('a', array('href' => '#', 'class' => 'n2-form-element-clear'), N2Html::tag('i', array('class' => 'n2-i n2-it n2-i-empty n2-i-grey-opacity'), '')) . N2Html::tag('a', array('href' => '#', 'class' => 'n2-form-element-button n2-h5 n2-uc'), n2_('Style'))); }
function generateOptions(&$xml) { $length = count($xml->option) - 1; $html = ''; $i = 0; foreach ($xml->option as $option) { $value = N2XmlHelper::getAttribute($option, 'value'); $this->values[] = $value; $html .= N2Html::tag('div', array('class' => 'n2-radio-option n2-h4' . ($this->isSelected($value) ? ' n2-active' : '') . ($i == 0 ? ' n2-first' : '') . ($i == $length ? ' n2-last' : '')), n2_((string) $option)); $i++; } return $html; }
function generateOptions(&$xml) { $length = count($xml->option) - 1; $html = ''; $i = 0; foreach ($xml->option as $option) { $v = N2XmlHelper::getAttribute($option, 'value'); $this->values[] = $v; $html .= N2Html::tag('div', array('class' => 'n2-radio-option n2-h4' . ($this->isSelected($v) ? ' n2-active' : '') . ($i == 0 ? ' n2-first' : '') . ($i == $length ? ' n2-last' : '')), N2Html::tag('div', array('class' => 'n2-radio-option-marker'), '<i class="n2-i n2-it n2-i-tick"></i>') . '<span>' . n2_((string) $option) . '</span>'); $i++; } return $html; }
function fetchElement() { $db = JFactory::getDBO(); $query = 'SELECT id, title FROM #__tags WHERE published = 1 ORDER BY id'; $db->setQuery($query); $menuItems = $db->loadObjectList(); $this->_xml->addChild('option', htmlspecialchars(n2_('All')))->addAttribute('value', '0'); if (count($menuItems)) { array_shift($menuItems); foreach ($menuItems as $option) { $this->_xml->addChild('option', htmlspecialchars($option->title))->addAttribute('value', $option->id); } } return parent::fetchElement(); }
public function actionClearCache() { if ($this->validatePermission('smartslider_config')) { if ($this->validateToken()) { $slidersModel = new N2SmartsliderSlidersModel(); foreach ($slidersModel->getAll() as $slider) { $slidersModel->refreshCache($slider['id']); } N2Cache::clearGroup('n2-ss-0'); N2Cache::clearGroup('combined'); N2Message::success(n2_('Cache cleared.')); } $this->redirect(array("settings/default")); } }
public function renderPlaceholder($sizes) { if (!$this->slider->isAdmin && $this->fadeOnLoad && ($this->slider->features->responsive->scaleDown || $this->slider->features->responsive->scaleUp)) { if (N2SystemHelper::testMemoryLimit()) { if ($sizes['width'] + $sizes['marginHorizontal'] > 0 && $sizes['height'] > 0 && function_exists('imagecreatetruecolor')) { return N2Html::tag("div", array("id" => $this->slider->elementId . "-placeholder", "encode" => false, "style" => 'position: relative;z-index:2;'), $this->makeImage($sizes)); } else { N2CSS::addCode("#{$this->slider->elementId} .n2-ss-load-fade{position: relative !important;}", $this->slider->cacheId); } } else { N2Message::error(n2_("It seems like the <a href='http://php.net/manual/en/ini.core.php#ini.memory-limit'>memory_limit</a> on the server is too low for the fade on load feature. Please set it minimum 60M and reload the page! You can disable this message in <a href='" . N2Form::$documentation . "#Troubleshooting-G-Server'>global configuration</a> 'Frontend debug message' option.")); } } else { N2CSS::addCode("#{$this->slider->elementId}.n2-ss-load-fade{position: relative !important;}", $this->slider->cacheId); } return ''; }