function generateOptions(&$xml) { $template = (string) $this->_xml; $cssfile = NextendFilesystem::translateToMediaPath(str_replace(DIRECTORY_SEPARATOR, '/', dirname($this->_form->_xmlfile)) . '/style.'); $css = NextendCss::getInstance(); if (NextendFilesystem::fileexists($cssfile . 'less')) { $css->enableLess(); $cssfile .= 'less'; $css->addCssFile(array($cssfile, $cssfile, array('id' => 'body'))); } else { $cssfile .= 'css'; $css->addCssFile($cssfile); } $prefix = NextendXmlGetAttribute($this->_xml, 'prefix'); $this->_values = array(); $html = ''; foreach ($xml->option as $option) { $v = NextendXmlGetAttribute($option, 'value'); $this->_values[] = $v; if ($v != -1) { $info = pathinfo($v); $class = $prefix . basename($v, '.' . $info['extension']); $html .= ' <div class="nextend-radio-option nextend-imagelist-option' . $this->isSelected($v) . '"> ' . str_Replace('{image}', NextendUri::pathToUri($v), str_Replace('{class}', $class, $template)) . ' </div>'; } else { $html .= '<div class="nextend-radio-option' . $this->isSelected($v) . '">' . (string) $option . '</div>'; } } return $html; }
function nextendimportpath($file) { $file .= '.php'; if (NextendFilesystem::fileexists($file)) { require_once $file; return true; } return false; }
function addCSS() { parent::addCSS(); $css = NextendCss::getInstance(); end($css->_cssFiles); $last = key($css->_cssFiles); $override = str_replace(WP_PLUGIN_DIR, get_template_directory(), $css->_cssFiles[$last][1]); if (NextendFilesystem::fileexists($override)) { $css->_cssFiles[$last][1] = $override; } }
function auth() { $folder = NextendRequest::getVar('folder'); if ($folder) { $authfile = NextendFilesystem::pathToAbsolutePath($folder) . 'auth.php'; if (NextendFilesystem::fileexists($authfile)) { require_once $authfile; if (function_exists('nextend_api_auth_flow')) { nextend_api_auth_flow(); } } } exit; }
function subform() { $response = array(); if (!isset($_POST['data'])) { echo json_encode(array('error' => 'Post not OK!')); exit; } if (get_magic_quotes_gpc() || nextendIsWordPress()) { $_POST['data'] = stripslashes($_POST['data']); } $data = json_decode($_POST['data'], true); $configurationXmlFile = rtrim(NextendFilesystem::getBasePath(), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $data['xml']; if (NextendFilesystem::fileexists($configurationXmlFile)) { nextendimport('nextend.css.css'); nextendimport('nextend.javascript.javascript'); $css = NextendCSS::getInstance(); $js = NextendJavascript::getInstance(); $js->loadLibrary('dojo'); nextendimport('nextend.form.form'); $form = new NextendForm(); $form->loadArray($data['orig']); $form->loadArray(array($data['name'] => $data['value'])); $form->loadXMLFile($configurationXmlFile); ob_start(); $subform = $form->getSubform($data['tab'], $data['name']); $subform->initAjax($data['control_name']); echo $subform->renderForm(); echo "<style>"; echo $css->generateAjaxCSS($data['loadedCSS']); echo "</style>"; $scripts = $js->generateAjaxJs($data['loadedJSS']); $html = ob_get_clean(); $response = array('html' => $html, 'scripts' => $scripts); } else { $response = array('error' => 'Configuration file not found'); } echo json_encode($response); exit; }
function NextendSliderCache($slider) { nextendimportsmartslider2('nextend.smartslider.check'); nextendimport('nextend.css.css'); nextendimport('nextend.javascript.javascript'); nextendimport('nextend.fonts.google'); $this->slider = $slider; $sliderid = $slider->_sliderid; $recache = false; $cached = json_decode(NextendSmartSliderStorage::get('slidercache' . $sliderid), true); if (nextendIsWordpress()) { $time = current_time('timestamp'); } else { $time = time(); } nextendimportsmartslider2('nextend.smartslider.admin.models.slides'); $slidesModel = new NextendSmartsliderAdminModelSlides(null); $slides = $slidesModel->getSlides($sliderid, ''); $slideexpire = null; foreach ($slides as $s) { $publish_up = strtotime($s['publish_up']); if ($publish_up && $publish_up > $time && ($slideexpire == null || $publish_up < $slideexpire)) { $slideexpire = $publish_up; } $publish_down = strtotime($s['publish_down']); if ($publish_down && $publish_down > $time && ($slideexpire == null || $publish_down < $slideexpire)) { $slideexpire = $publish_down; } } if (is_array($cached)) { if (NextendSmartSliderStorage::get('sliderchanged' . $sliderid) == 1) { $recache = true; } else { if (isset($cached['time']) && isset($cached['expire']) && $cached['time'] < time() - $cached['expire'] * 60 * 60) { $recache = true; } else { if (isset($cached['slideexpire']) && $cached['slideexpire'] < $time) { $recache = true; } } } } else { $recache = true; } if (!$recache) { $data = $cached['data']; if (isset($data['css'])) { if (!NextendFilesystem::fileexists(NextendFilesystem::absoluteURLToPath($data['css']))) { $recache = true; } } else { $recache = true; } if (!isset($data['libraries']) || !isset($data['libraries']['jquery']) || !isset($data['libraries']['jquery']['jsfiles']) || count($data['libraries']['jquery']['jsfiles']) == 0) { $recache = true; } } //$recache = true; if ($recache) { $data = $this->render(); $cached = array('time' => time(), 'data' => $data); if ($this->slider->_generatorParams->get('enabled', 0)) { $generatorcached = json_decode(NextendSmartSliderStorage::get('generator' . $sliderid), true); if (is_array($generatorcached)) { $cached['time'] = $generatorcached['time']; $cached['expire'] = $this->slider->_generatorParams->get('cachetime', '24'); } } if ($slideexpire) { $cached['slideexpire'] = $slideexpire; } NextendSmartSliderStorage::set('slidercache' . $sliderid, json_encode($cached)); NextendSmartSliderStorage::set('sliderchanged' . $sliderid, '0'); } $this->cssurl = $data['css']; if (nextendIsWordPress()) { add_action('nextend_css', array($this, 'addCSS')); } elseif (nextendIsMagento()) { Nextend_SmartSlider2_Model_Observer::$sliders[] = array($this, 'addCSS'); } else { $this->addCSS(); } $js = NextendJavascript::getInstance(); foreach ($data['js']['core'] as $j) { $js->addJsFile($j); } if (isset($data['libraries']) && count($data['libraries'])) { foreach ($data['libraries'] as $library => $jss) { $js->loadLibrary($library); if (!empty($jss['js'])) { $js->addLibraryJs($library, $jss['js']); } if (count($jss['jsfiles'])) { foreach ($jss['jsfiles'] as $j) { $js->addLibraryJsFile($library, $j); } } } } if (isset($data['fonts']) && count($data['fonts'])) { $google = NextendFontsGoogle::getInstance(); foreach ($data['fonts'] as $k => $v) { $style = explode(',', $v[0]); $subset = explode(',', $v[1]); for ($i = 0; $i < count($style); $i++) { $google->addFont($k, $style[$i], $subset[$i]); } } } $slider = $data['html']; if (nextendIsJoomla()) { if (version_compare(JVERSION, '1.6.0', 'ge')) { $dispatcher = JDispatcher::getInstance(); JPluginHelper::importPlugin('content'); $article = new stdClass(); $article->text = $slider; $_p = array(); $dispatcher->trigger('onContentPrepare', array('com_smartslider2', &$article, &$_p, 0)); if (!empty($article->text)) { $slider = $article->text; } } } elseif (nextendIsWordPress()) { if (!function_exists('ss2_attr_shortcode')) { function ss2_attr_shortcode($matches) { return 'data-' . $matches[1] . '="' . str_replace('"', '"', do_shortcode(str_replace('"', '"', $matches[2]))) . '"'; } } $slider = preg_replace_callback("/data-(click|enter|leave)=\"(.*?)\"/", "ss2_attr_shortcode", $slider); $slider = do_shortcode($slider); } echo $slider; }
function fetchElement($name, $value, &$node, $control_name) { $html = ''; jimport('nextend.library'); nextendimport('nextend.css.css'); nextendimport('nextend.javascript.javascript'); $css = NextendCss::getInstance(); $js = NextendJavascript::getInstance(); $css->addCssLibraryFile('common.css'); $css->addCssLibraryFile('window.css'); $css->addCssLibraryFile('configurator.css'); $configurationXmlFile = JPATH_SITE . $node->attributes('xml'); if (NextendFilesystem::fileexists($configurationXmlFile)) { $js->loadLibrary('dojo'); $js->addLibraryJsLibraryFile('dojo', 'dojo/window.js'); $js->addLibraryJsAssetsFile('dojo', 'window.js'); $js->addLibraryJs('dojo', ' new NextendWindow({ button: dojo.byId("nextend-configurator-button"), node: dojo.byId("nextend-configurator-lightbox"), save: dojo.byId("nextend-configurator-save"), message: dojo.byId("nextend-configurator-message"), onHide: function(){ this.message.innerHTML = "Now you should save the module settings to apply changes!"; } }); '); $html .= '<div id="nextend-configurator-lightbox" class="gk_hack nextend-window ' . $node->attributes('identifier') . '">'; $html .= '<div class="gk_hack nextend-window-container">'; $html .= '<div class="gk_hack nextend-topbar"><div class="gk_hack nextend-topbar-logo"></div>'; $manual = $node->attributes('manual'); if ($manual != "") { $html .= '<a href="' . $manual . '" target="_blank" class="gk_hack nextend-topbar-button nextend-topbar-manual">Manual</a>'; } $support = $node->attributes('support'); if ($support != "") { $html .= '<a href="' . $support . '" target="_blank" class="gk_hack nextend-topbar-button nextend-topbar-support">Support</a>'; } $html .= '<div id="nextend-configurator-save" class="nextend-window-save"><div class="NextendWindowSave">APPLY</div></div>'; $html .= '</div>'; $html .= '<div class="gk_hack nextend-window-container-inner">'; $html .= '<fieldset id="nextend-configurator-panels" class="gk_hack panelform">'; $html .= '<div id="menu-pane" class="gk_hack pane-sliders">'; nextendimport('nextend.form.form'); $form = new NextendForm(); $form->loadArray($this->_parent->toArray()); $form->set('manual', $manual); $form->set('support', $support); $form->loadXMLFile($configurationXmlFile); ob_start(); $form->render($control_name); $html .= ob_get_clean(); $html .= '</div>'; $html .= '</fieldset>'; $html .= '</div>'; $html .= '</div>'; $html .= '</div>'; $html .= '<a id="nextend-configurator-button" class="nextend-configurator-button" href="#">Configure<span></span></a> <span id="nextend-configurator-message"> </span>'; $js->addLibraryJsAssetsFile('dojo', 'form.js'); $js->addLibraryJs('dojo', ' new NextendForm({ container: "nextend-configurator-lightbox", data: ' . json_encode($form->_data) . ', xml: "' . NextendFilesystem::toLinux(NextendFilesystem::pathToRelativePath($configurationXmlFile)) . '", control_name: "' . $control_name . '", url: "' . JUri::current() . '", loadedJSS: ' . json_encode($js->generateArrayJs()) . ', loadedCSS: ' . json_encode($css->generateArrayCSS()) . ' }); ', true); return $html; } else { return NextendText::_("Not found xml configuration: ") . $configurationXmlFile; } return "asd"; return '<input type="hidden" name="' . $control_name . '[' . $name . ']" id="' . $control_name . $name . '" value="' . $value . '" ' . $class . ' />'; }
<?php defined('NEXTENDLIBRARY') or die; $dir = dirname(__FILE__) . DIRECTORY_SEPARATOR; foreach (NextendFilesystem::folders($dir) as $folder) { $file = $dir . $folder . DIRECTORY_SEPARATOR . $folder . '.php'; if (NextendFilesystem::fileexists($file)) { require_once $file; } }
function importlocalAction() { if ($this->canDo('slider.create')) { $path = NEXTEND_SMART_SLIDER2_ASSETS . 'admin/smart/'; if (NextendRequest::getInt('full', 0)) { $path .= 'full_smart/'; } else { $path .= 'free_smart/'; } $filepath = $path . basename(NextendRequest::getVar('slider', '')) . '.smart'; if (NextendFilesystem::fileexists($filepath)) { $sliderid = $this->importFile($filepath); header('LOCATION: ' . $this->route('controller=sliders&view=sliders_slider&action=dashboard&sliderid=' . $sliderid)); exit; } else { NextendMessage::error(NextendText::_('Error'), NextendText::_('The .smart file not found!')); } $this->display('default', 'create'); } else { $this->noaccess(); } }
function ss2_css_image_replace($ms) { global $zip; if (substr($ms[1], 0, 2) == '//') { $ms[1] = 'http:' . $ms[1]; } $path = NextendFilesystem::absoluteURLToPath($ms[1]); if (NextendFilesystem::fileexists($path)) { if (nextendIsJoomla()) { $rel = str_replace('plugins/', 'images/', NextendFilesystem::pathToRelativePath($path)); } else { if (nextendIsWordpress()) { $rel = str_replace(NEXTEND_SMART_SLIDER2 . 'plugins/', 'images/', $path); } } $zip->addFile(NextendFilesystem::readFile($path), $rel); return 'url(' . $rel . ')'; } }
function nextend_configuration_box($object, $box) { $configurationXmlFile = $box['args']['xml']; if (NextendFilesystem::fileexists($configurationXmlFile)) { nextendimport('nextend.css.css'); nextendimport('nextend.javascript.javascript'); $css = NextendCss::getInstance(); $js = NextendJavascript::getInstance(); $css->addCssLibraryFile('wordpress/removeslug.css'); $css->addCssLibraryFile('common.css'); $css->addCssLibraryFile('window.css'); $css->addCssLibraryFile('configurator.css'); $js->loadLibrary('dojo'); $js->addLibraryJsLibraryFile('dojo', 'dojo/window.js'); $js->addLibraryJsAssetsFile('dojo', 'window.js'); nextendimport('nextend.form.form'); $control_name = 'nextend'; $form = new NextendForm(); $data = get_post_meta($object->ID, 'nextend_configuration', true); $form->loadArray($data); $form->loadXMLFile($configurationXmlFile); require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'themes' . DIRECTORY_SEPARATOR . 'loadplugin.php'; ?> <div id="nextend-configurator-wp" class="accordionmenu"> <div class="gk_hack nextend-topbar"><div class="gk_hack nextend-topbar-logo"></div> <?php $manual = 'http://www.nextendweb.com/wiki/accordion-menu-documentation/'; if ($manual != "") { ?> <a href="<?php echo $manual; ?> " target="_blank" class="gk_hack nextend-topbar-button nextend-topbar-manual">Manual</a> <?php } $support = 'http://www.nextendweb.com/accordion-menu/#support'; if ($support != "") { ?> <a href="<?php echo $support; ?> " target="_blank" class="gk_hack nextend-topbar-button nextend-topbar-support">Support</a> <?php } ?> <?php if (defined('NEXTENDACCORDIONMENULITE')) { ?> <a href="http://www.nextendweb.com/accordion-menu/" target="_blank" class="gk_hack nextend-topbar-button nextend-topbar-getpro">Get PRO</a> <?php } ?> <div id="nextend-configurator-save" onclick="jQuery('#publish').trigger('click');" class="nextend-window-save"><div class="NextendWindowSave">SAVE</div></div> <div id="nextend-configurator-cancel" onclick="document.location.href='<?php echo admin_url('edit.php?post_type=accordion_menu'); ?> ';" class="nextend-window-cancel"><div class="NextendWindowCancel">CANCEL</div></div> </div> <?php $form->set('manual', $manual); $form->set('support', $support); $form->render($control_name); $js->addLibraryJsAssetsFile('dojo', 'form.js'); $js->addLibraryJs('dojo', ' new NextendForm({ container: "nextend-configurator-wp", data: ' . json_encode($form->_data) . ', xml: "' . NextendFilesystem::toLinux(NextendFilesystem::pathToRelativePath($configurationXmlFile)) . '", control_name: "' . $control_name . '", url: "' . site_url('/wp-admin/admin-ajax.php?action=nextend') . '", loadedJSS: ' . json_encode($js->generateArrayJs()) . ', loadedCSS: ' . json_encode($css->generateArrayCSS()) . ' }); ', true); ?> </div> <?php } }
protected function getInput() { $html = ''; jimport('nextend.library'); NextendText::l('common'); nextendimport('nextend.css.css'); nextendimport('nextend.javascript.javascript'); $css = NextendCss::getInstance(); $js = NextendJavascript::getInstance(); $css->addCssLibraryFile('common.css'); $css->addCssLibraryFile('window.css'); $css->addCssLibraryFile('configurator.css'); $attribs = $this->element->attributes(); $configurationXmlFile = JPATH_SITE . (string) $attribs->xml; if (NextendFilesystem::fileexists($configurationXmlFile)) { $js->loadLibrary('dojo'); $js->addLibraryJsLibraryFile('dojo', 'dojo/window.js'); $js->addLibraryJsAssetsFile('dojo', 'window.js'); $js->addLibraryJs('dojo', ' new NextendWindow({ button: dojo.byId("nextend-configurator-button"), node: dojo.byId("nextend-configurator-lightbox"), save: dojo.byId("nextend-configurator-save"), message: dojo.byId("nextend-configurator-message"), onHide: function(){ this.message.innerHTML = "' . NextendText::_('Now_you_should_save_the_module_settings_to_apply_changes') . '"; } }); '); $html .= '<div id="nextend-configurator-lightbox" class="gk_hack nextend-window ' . (string) $attribs->identifier . '">'; $html .= '<div class="gk_hack nextend-window-container">'; $html .= '<div class="gk_hack nextend-topbar"><div class="gk_hack nextend-topbar-logo"></div>'; $manual = (string) $attribs->manual; if ($manual != "") { $html .= '<a href="' . $manual . '" target="_blank" class="gk_hack nextend-topbar-button nextend-topbar-manual">' . NextendText::_('Manual') . '</a>'; } $support = (string) $attribs->support; if ($support != "") { $html .= '<a href="' . $support . '" target="_blank" class="gk_hack nextend-topbar-button nextend-topbar-support">' . NextendText::_('Support') . '</a>'; } $html .= '<div id="nextend-configurator-save" class="nextend-window-save"><div class="NextendWindowSave">' . NextendText::_('APPLY') . '</div></div>'; $html .= '</div>'; $html .= '<div class="gk_hack nextend-window-container-inner">'; $html .= '<fieldset id="nextend-configurator-panels" class="gk_hack panelform">'; $html .= '<div id="menu-pane" class="gk_hack pane-sliders">'; nextendimport('nextend.form.form'); $form = new NextendForm(); $form->loadArray($this->value); $form->set('manual', $manual); $form->set('support', $support); $form->loadXMLFile($configurationXmlFile); ob_start(); $form->render($this->name); $html .= ob_get_clean(); $html .= '</div>'; $html .= '</fieldset>'; $html .= '</div>'; $html .= '</div>'; $html .= '</div>'; $html .= '<a id="nextend-configurator-button" class="nextend-configurator-button" href="#">' . NextendText::_('Configure') . '<span></span></a> <span id="nextend-configurator-message"> </span>'; $js->addLibraryJsAssetsFile('dojo', 'form.js'); $js->addLibraryJs('dojo', ' new NextendForm({ container: "nextend-configurator-lightbox", data: ' . json_encode($form->_data) . ', xml: "' . NextendFilesystem::toLinux(NextendFilesystem::pathToRelativePath($configurationXmlFile)) . '", control_name: "' . $this->name . '", url: "' . JUri::current() . '", loadedJSS: ' . json_encode($js->generateArrayJs()) . ', loadedCSS: ' . json_encode($css->generateArrayCSS()) . ' }); ', true); $doc = JFactory::getDocument(); $doc->_script = str_replace("jQuery('select').chosen({", "jQuery('select:not(.nextend-select)').chosen({", $doc->_script); return $html; } else { return NextendText::_("Not_found_xml_configuration") . $configurationXmlFile; } }
function nextend_settings_page() { ?> <div> <h2>Nextend Global Settings</h2> <?php if (isset($_POST['nextend'])) { update_option('nextend_config', $_POST['nextend']); } ?> <div id="nextend_configuration" class="postbox" style="margin: 0 20px 0 0;"> <form method="post" id="nextend-settings" action="<?php echo admin_url("options-general.php?page=nextend_settings_page"); ?> "> <?php $configurationXmlFile = NEXTENDLIBRARY . 'wordpress/configuration.xml'; if (NextendFilesystem::fileexists($configurationXmlFile)) { nextendimport('nextend.css.css'); nextendimport('nextend.javascript.javascript'); $css = NextendCss::getInstance(); $js = NextendJavascript::getInstance(); $css->addCssLibraryFile('wordpress/removeslug.css'); $css->addCssLibraryFile('common.css'); $css->addCssLibraryFile('window.css'); $css->addCssLibraryFile('configurator.css'); $js->loadLibrary('dojo'); $js->addLibraryJsLibraryFile('dojo', 'dojo/window.js'); $js->addLibraryJsAssetsFile('dojo', 'window.js'); nextendimport('nextend.form.form'); $control_name = 'nextend'; $form = new NextendForm(); $data = get_option('nextend_config'); global $nextend; foreach ($nextend as $k => $v) { if (!isset($data[$k])) { $data[$k] = $v; } } $form->loadArray($data); $form->loadXMLFile($configurationXmlFile); ?> <div id="nextend-configurator-wp"> <div class="gk_hack nextend-topbar"><div class="gk_hack nextend-topbar-logo"></div> <?php $manual = 'http://www.nextendweb.com/wiki/'; if ($manual != "") { ?> <a href="<?php echo $manual; ?> " target="_blank" class="gk_hack nextend-topbar-button nextend-topbar-manual">Manual</a> <?php } $support = 'http://www.nextendweb.com/accordion-menu/#support'; if ($support != "") { ?> <a href="<?php echo $support; ?> " target="_blank" class="gk_hack nextend-topbar-button nextend-topbar-support">Support</a> <?php } ?> <?php if (defined('NEXTENDACCORDIONMENULITE')) { ?> <a href="http://www.nextendweb.com/accordion-menu/" target="_blank" class="gk_hack nextend-topbar-button nextend-topbar-getpro">Get PRO</a> <?php } ?> <div id="nextend-configurator-save" onclick="njQuery('#nextend-settings').submit();" class="nextend-window-save"><div class="NextendWindowSave">SAVE</div></div> </div> <?php $form->render($control_name); $js->addLibraryJsAssetsFile('dojo', 'form.js'); $js->addLibraryJs('dojo', ' new NextendForm({ container: "nextend-configurator-wp", data: ' . json_encode($form->_data) . ', xml: "' . NextendFilesystem::toLinux(NextendFilesystem::pathToRelativePath($configurationXmlFile)) . '", control_name: "' . $control_name . '", url: "' . site_url('/wp-admin/admin-ajax.php?action=nextend') . '", loadedJSS: ' . json_encode($js->generateArrayJs()) . ', loadedCSS: ' . json_encode($css->generateArrayCSS()) . ' }); ', true); ?> </div> <?php } ?> </div> </form> </div> <?php }
function getData($number) { nextendimport('nextend.database.database'); $db = NextendDatabase::getInstance(); $data = array(); $category = array_map('intval', explode('||', $this->_data->get('k2itemssourcecategory', ''))); $query = 'SELECT '; $query .= 'con.id, '; $query .= 'con.title, '; $query .= 'con.alias, '; $query .= 'con.introtext, '; $query .= 'con.fulltext, '; $query .= 'con.catid, '; $query .= 'cat.name AS cat_title, '; $query .= 'cat.alias AS cat_alias, '; $query .= 'con.created_by, '; $query .= 'usr.name AS created_by_alias, '; $query .= 'con.hits, '; $query .= 'con.image_caption, '; $query .= 'con.image_credits, '; $query .= 'con.extra_fields '; $query .= 'FROM #__k2_items AS con '; $query .= 'LEFT JOIN #__users AS usr ON usr.id = con.created_by '; $query .= 'LEFT JOIN #__k2_categories AS cat ON cat.id = con.catid '; $query .= 'WHERE con.catid IN (' . implode(',', $category) . ') '; $sourceuserid = intval($this->_data->get('k2itemssourceuserid', '')); if ($sourceuserid) { $query .= 'AND con.created_by = ' . $sourceuserid . ' '; } if ($this->_data->get('k2itemssourcepublished', 1)) { $jnow = JFactory::getDate(); $now = version_compare(JVERSION, '1.6.0', '<') ? $jnow->toMySQL() : $jnow->toSql(); $query .= "AND con.published = 1 AND (con.publish_up = '0000-00-00 00:00:00' OR con.publish_up < '" . $now . "') AND (con.publish_down = '0000-00-00 00:00:00' OR con.publish_down > '" . $now . "') "; } $query .= 'AND con.trash = 0 '; if ($this->_data->get('k2itemssourcefeatured', 0)) { $query .= 'AND con.featured = 1 '; } $language = $this->_data->get('k2itemssourcelanguage', '*'); if ($language) { $query .= 'AND con.language = ' . $db->quote($language) . ' '; } $order = NextendParse::parse($this->_data->get('k2itemsorder1', 'con.title|*|asc')); if ($order[0]) { $query .= 'ORDER BY ' . $order[0] . ' ' . $order[1] . ' '; $order = NextendParse::parse($this->_data->get('k2itemsorder2', 'con.title|*|asc')); if ($order[0]) { $query .= ', ' . $order[0] . ' ' . $order[1] . ' '; } } $query .= 'LIMIT 0, ' . $number . ' '; $db->setQuery($query); $result = $db->loadAssocList(); $this->loadExtraFields(); require_once JPATH_SITE . '/components/com_k2/helpers/utilities.php'; require_once JPATH_SITE . '/components/com_k2/models/item.php'; $k2item = new K2ModelItem(); for ($i = 0; $i < count($result); $i++) { $result[$i]['url'] = 'index.php?option=com_k2&view=item&id=' . $result[$i]['id'] . ':' . $result[$i]['alias']; $result[$i]['categoryurl'] = 'index.php?option=com_k2&view=itemlist&task=category&id=' . $result[$i]['catid'] . ':' . $result[$i]['cat_alias']; $result[$i]['thumbnail'] = $result[$i]['image'] = "media/k2/items/cache/" . md5("Image" . $result[$i]['id']) . "_XL.jpg"; if (!NextendFilesystem::fileexists(JPATH_SITE . '/' . $result[$i]['image'])) { $result[$i]['thumbnail'] = $result[$i]['image'] = ''; } $result[$i]['description'] = $result[$i]['introtext']; $result[$i]['url_label'] = 'View article'; $result[$i]['author_name'] = $result[$i]['created_by_alias']; $result[$i]['author_url'] = '#'; $item = (object) $result[$i]; $extras = $k2item->getItemExtraFields($result[$i]['extra_fields'], $item); if (is_array($extras) && count($extras) > 0) { foreach ($extras as $field) { $result[$i]['extra' . $field->id . '_' . preg_replace("/\\W|_/", "", $this->extraFields[$field->id]['group_name'] . '_' . $this->extraFields[$field->id]['name'])] = $field->value; } } } return $result; }