本文整理汇总了PHP中JUDirectoryHelper::isJoomla3x方法的典型用法代码示例。如果您正苦于以下问题:PHP JUDirectoryHelper::isJoomla3x方法的具体用法?PHP JUDirectoryHelper::isJoomla3x怎么用?PHP JUDirectoryHelper::isJoomla3x使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JUDirectoryHelper
的用法示例。
在下文中一共展示了JUDirectoryHelper::isJoomla3x方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __set
public function __set($name, $value)
{
switch ($name) {
case 'height':
case 'width':
case 'assetField':
case 'authorField':
case 'asset':
$this->{$name} = (string) $value;
break;
case 'buttons':
$value = (string) $value;
if ($value == 'true' || $value == 'yes' || $value == '1') {
$this->buttons = true;
} elseif ($value == 'false' || $value == 'no' || $value == '0') {
$this->buttons = false;
} else {
$this->buttons = explode(',', $value);
}
break;
case 'hide':
$value = (string) $value;
$this->hide = $value ? explode(',', $value) : array();
break;
case 'editorType':
$this->editorType = explode('|', trim((string) $value));
break;
default:
if (JUDirectoryHelper::isJoomla3x()) {
parent::__set($name, $value);
} else {
$this->{$name} = $value;
}
}
}
示例2: getInput
protected function getInput()
{
$language = JFactory::getLanguage();
$language->load('com_judirectory', JPATH_ADMINISTRATOR);
$isJoomla3x = JUDirectoryHelper::isJoomla3x();
$fieldsGroup = JUDirectoryHelper::getAdvSearchFields();
$html = '<div id="judirectory-field" style="clear: both;">';
if ($isJoomla3x) {
$html .= JHtml::_('bootstrap.startTabSet', 'search-form', array('active' => 'fieldgroup-1'));
} else {
$html .= JHtml::_('tabs.start', 'search-form');
}
foreach ($fieldsGroup as $groupField) {
if ($isJoomla3x) {
$html .= JHtml::_('bootstrap.addTab', 'search-form', 'fieldgroup-' . $groupField->id, $groupField->name, true);
} else {
$html .= JHtml::_('tabs.panel', $groupField->name, 'fieldgroup-' . $groupField->id);
}
if (!$isJoomla3x) {
$html .= '<fieldset class="adminform">';
$html .= '<ul class="adminformlist">';
}
foreach ($groupField->fields as $field) {
$value = isset($this->value[$field->id]) ? $this->value[$field->id] : "";
$fieldClass = JUDirectoryFrontHelperField::getField($field);
if (JFactory::getApplication()->input->getCmd('view', '') == 'module') {
$fieldClass->name = 'jform[params][fields][' . $fieldClass->id . ']';
}
if ($isJoomla3x) {
$html .= '<div class="control-group">';
$html .= '<div class="control-label">';
$html .= $fieldClass->getLabel(false);
$html .= '</div>';
$html .= '<div class="controls">';
$html .= $fieldClass->getDisplayPrefixText() . $fieldClass->getSearchInput($value) . $fieldClass->getDisplaySuffixText();
$html .= "</div>";
$html .= "</div>";
} else {
$html .= "<li>";
$html .= $fieldClass->getLabel(false);
$html .= $fieldClass->getDisplayPrefixText() . $fieldClass->getSearchInput($value) . $fieldClass->getDisplaySuffixText();
$html .= "</li>";
}
}
if (!$isJoomla3x) {
$html .= '</ul>';
$html .= '</fieldset>';
}
if ($isJoomla3x) {
$html .= JHtml::_('bootstrap.endTab');
}
}
if ($isJoomla3x) {
$html .= JHtml::_('bootstrap.endTabSet');
} else {
$html .= JHtml::_('tabs.end');
}
$html .= '</div>';
return $html;
}
示例3: display
public function display($tpl = null)
{
if (count($errors = $this->get('Errors'))) {
JError::raiseError(500, implode('<br />', $errors));
return false;
}
$app = JFactory::getApplication();
if ($app->input->get('layout') == null) {
$app->redirect('index.php?option=com_judirectory&view=listcats');
}
$this->items = $this->get('Items');
$this->state = $this->get('State');
$this->authors = $this->get('Authors');
$this->pagination = $this->get('Pagination');
if ($app->input->get('layout') == 'copy') {
JToolBarHelper::title(JText::_('COM_JUDIRECTORY_COPY_LISTINGS'), 'copy-listings');
JToolBarHelper::apply('listings.copyListings', 'JTOOLBAR_APPLY');
JToolBarHelper::cancel('listing.cancel', 'JTOOLBAR_CANCEL');
} elseif ($app->input->get('layout') == 'move') {
JToolBarHelper::title(JText::_('COM_JUDIRECTORY_MOVE_LISTINGS'), 'move-listings');
JToolBarHelper::apply('listings.moveListings', 'JTOOLBAR_APPLY');
JToolBarHelper::cancel('listing.cancel', 'JTOOLBAR_CANCEL');
} else {
JToolBarHelper::title(JText::_('COM_JUDIRECTORY_LISTINGS'), 'listings');
$this->totalListings = $this->get('Total');
$this->setDocument();
}
if (JUDirectoryHelper::isJoomla3x() && $app->input->get('layout') == 'modal') {
$this->filterForm = $this->get('FilterForm');
$this->activeFilters = $this->get('ActiveFilters');
}
parent::display($tpl);
}
示例4: getOptions
protected function getOptions()
{
$document = JFactory::getDocument();
if (JUDirectoryHelper::isJoomla3x()) {
$triggerJqueryChosen = '$("#jform_parent_id").trigger("liszt:updated");';
} else {
$triggerJqueryChosen = '';
}
$script = '
jQuery(document).ready(function($){
$("#jform_template_id").change(function(){
var objData = {};
objData.value = $(this).val();
$.ajax({
type: "POST",
url : "index.php?option=com_judirectory&task=style.changeTemplateId",
data: objData
}).done(function (data) {
$("option","#jform_parent_id").remove();
$("#jform_parent_id").append(data);
' . $triggerJqueryChosen . '
});
});
});
';
$document->addScriptDeclaration($script);
$db = JFactory::getDbo();
$options = array();
$styleId = $this->form->getValue('id');
if ($styleId) {
$templateId = $this->form->getValue('template_id');
$query = $db->getQuery(true);
$query->select('parent_id');
$query->from('#__judirectory_templates');
$query->where('id = ' . (int) $templateId);
$db->setQuery($query);
$templateParentId = $db->loadResult();
} else {
$templateParentId = 0;
}
$query = $db->getQuery(true);
$query->select('*');
$query->select('title AS text');
$query->select('id AS value');
$query->from('#__judirectory_template_styles');
$query->where('template_id = ' . (int) $templateParentId);
$query->order('lft ASC');
$db->setQuery($query);
try {
$options = $db->loadObjectList();
} catch (RuntimeException $e) {
JError::raiseWarning(500, $e->getMessage());
}
for ($i = 0, $n = count($options); $i < $n; $i++) {
$options[$i]->text = str_repeat('- ', $options[$i]->level) . $options[$i]->text;
}
$options = array_merge(parent::getOptions(), $options);
return $options;
}
示例5: loadFormData
protected function loadFormData()
{
$data = JFactory::getApplication()->getUserState('com_judirectory.edit.criteriagroup.data', array());
if (empty($data)) {
$data = $this->getItem();
}
if (JUDirectoryHelper::isJoomla3x()) {
$this->preprocessData('com_judirectory.criteriagroup', $data);
}
return $data;
}
示例6: display
public function display($tpl = null)
{
$this->state = $this->get('State');
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
if (count($errors = $this->get('Errors'))) {
JError::raiseError(500, implode("\n", $errors));
return false;
}
$this->_prepareDocument();
if (JUDirectoryHelper::isJoomla3x()) {
$this->filterForm = $this->get('FilterForm');
$this->activeFilters = $this->get('ActiveFilters');
}
parent::display($tpl);
}
示例7: fetchButton
public function fetchButton($type = 'JUHelp', $name = '', $text = '', $task = '', $list = true)
{
$i18n_text = JText::_($text);
$class = $this->fetchIconClass($name);
$doTask = $this->_getCommand($text, $task, $list);
if (!JUDirectoryHelper::isJoomla3x()) {
$html = "<a href=\"#\" onclick=\"{$doTask}\" class=\"toolbar\">\n";
$html .= "<span class=\"{$class}\">\n";
$html .= "</span>\n";
$html .= "{$i18n_text}\n";
$html .= "</a>\n";
} else {
$html = "<button onclick=\"{$doTask}\" class=\"btn btn-small\">\n";
$html .= "<span class=\"{$class}\">\n";
$html .= "</span>\n";
$html .= "{$i18n_text}\n";
$html .= "</button>\n";
}
return $html;
}
示例8: getInput
protected function getInput()
{
$document = JFactory::getDocument();
$document->addStyleSheet(JUri::root() . 'administrator/components/com_judirectory/assets/css/juselect.css');
$document->addScript(JUri::root() . 'administrator/components/com_judirectory/assets/js/juselect.js');
$document->addScript(JUri::root() . "components/com_judirectory/assets/js/jquery.dragsort.min.js");
$scriptv3 = '
setTimeout(function(){
$(".juselect-container").find(".juselect-select").show();
$(".juselect-container").next(".chzn-container").hide();
}, 10);';
$script = 'jQuery(document).ready(function($){
$("#' . $this->id . '").juSelect({
\'selectItems\' : "' . ($this->value ? implode(",", $this->value) : '') . '"
});
$(".juselect-list").dragsort({
dragSelector: "li",
placeHolderTemplate: \'<li class="placeHolder"></li>\',
dragSelectorExclude: \'a\'
});
' . (JUDirectoryHelper::isJoomla3x() ? $scriptv3 : '') . '
});';
$document->addScriptDeclaration($script);
$attr = '';
$attr .= !empty($this->class) ? ' class="' . $this->class . '"' : '';
$attr .= !empty($this->size) ? ' size="' . $this->size . '"' : '';
$attr .= $this->multiple ? ' multiple' : '';
$attr .= $this->required ? ' required aria-required="true"' : '';
$attr .= $this->autofocus ? ' autofocus' : '';
if ((string) $this->readonly == '1' || (string) $this->readonly == 'true' || (string) $this->disabled == '1' || (string) $this->disabled == 'true') {
$attr .= ' disabled="disabled"';
}
$attr .= $this->onchange ? ' onchange="' . $this->onchange . '"' : '';
$options = (array) $this->getOptions();
return JHtml::_('select.groupedlist', $options, $this->name, array('id' => $this->id, 'group.id' => 'id', 'list.attr' => $attr, 'list.select' => ''));
}
示例9: spl_autoload_register
JLoader::register('JUDIRViewAdmin', JPATH_ADMINISTRATOR . '/components/com_judirectory/helpers/judirviewadmin.php');
JLoader::register('JUDirectorySearchHelper', JPATH_SITE . '/components/com_judirectory/helpers/search.php');
spl_autoload_register(array('JUDirectoryHelper', 'autoLoadFieldClass'));
jimport('joomla.application.component.controller');
$app = JFactory::getApplication();
$task = $app->input->get('task');
$view = $app->input->get('view');
$permission = JUDirectoryHelper::checkGroupPermission($task, $view);
if (!$permission) {
return JError::raiseError(403, JText::_('JLIB_APPLICATION_ERROR_ACCESS_FORBIDDEN'));
}
if (!JFactory::getUser()->authorise('core.manage', 'com_judirectory')) {
return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR'));
}
$document = JFactory::getDocument();
$isJoomla3x = JUDirectoryHelper::isJoomla3x();
if ($isJoomla3x) {
$document->addStyleSheet(JUri::root(true) . '/administrator/components/com_judirectory/assets/css/styles.css');
} else {
$document->addStyleSheet(JUri::root(true) . '/administrator/components/com_judirectory/assets/css/styles.j25.css');
$document->addStyleSheet(JUri::root(true) . '/administrator/components/com_judirectory/assets/css/jicomoon.css');
}
JUDirectoryFrontHelper::loadjQuery();
JUDirectoryFrontHelper::loadBootstrap();
$document->addScript(JUri::root() . "components/com_judirectory/assets/js/jquery.dragsort.min.js");
if ($isJoomla3x && $view == 'subscriptions') {
$document->addScript(JUri::base() . "components/com_judirectory/models/forms/subscriptions.js");
}
if ($isJoomla3x && $view == 'collections') {
$document->addScript(JUri::base() . "components/com_judirectory/models/forms/collections.js");
}
示例10: setGlobal
static function setGlobal($value = 0, $i, $canChange = true, $controller = 'collections', $id = 'cb')
{
$states = array(0 => array('publish_x.png', 'icon-unpublish', '', $controller . '.setGlobal', JText::_('COM_JUDIRECTORY_NOT_GLOBAL'), JText::_('COM_JUDIRECTORY_TOGGLE_TO_SET_GLOBAL')), 1 => array('tick.png', 'icon-publish', 'active', $controller . '.unsetGlobal', JText::_('COM_JUDIRECTORY_GLOBAL'), JText::_('COM_JUDIRECTORY_TOGGLE_TO_UNSET_GLOBAL')));
$state = JArrayHelper::getValue($states, (int) $value, $states[1]);
if (JUDirectoryHelper::isJoomla3x()) {
$html = '<i class="' . $state[1] . '"></i>';
if ($canChange) {
$html = '<a class="btn btn-micro ' . $state[2] . ' hasTooltip" href="#" onclick="return listItemTask(\'' . $id . $i . '\',\'' . $state[3] . '\')" title="' . $state[4] . '<br/>' . $state[5] . '">' . $html . '</a>';
} else {
$html = '<a class="btn btn-micro disabled hasTooltip" href="#" onclick="return listItemTask(\'' . $id . $i . '\',\'' . $state[3] . '\')" title="' . $state[4] . '<br/>' . $state[5] . '">' . $html . '</a>';
}
} else {
$html = JHtml::_('image', 'admin/' . $state[0], $state[4], null, true);
if ($canChange) {
$html = '<a class="hasTip" href="#" onclick="return listItemTask(\'' . $id . $i . '\',\'' . $state[3] . '\')" title="' . $state[4] . '::' . $state[5] . '">' . $html . '</a>';
}
}
return $html;
}
示例11: defined
* ------------------------------------------------------------------------
* JUDirectory for Joomla 2.5, 3.x
* ------------------------------------------------------------------------
*
* @copyright Copyright (C) 2010-2015 JoomUltra Co., Ltd. All Rights Reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
* @author JoomUltra Co., Ltd
* @website http://www.joomultra.com
* @----------------------------------------------------------------------@
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
$title = "";
$class = "control-label col-sm-2";
if ($this->description) {
if (JUDirectoryHelper::isJoomla3x()) {
$class .= " hasTooltip";
$separator = "<br/>";
} else {
$separator = "::";
$class .= " hasTip";
}
// If write description as UPPERCASE -> translate it
if ($this->description == strtoupper($this->description)) {
$description = JText::_($this->description);
} else {
$description = $this->description;
}
$title = htmlspecialchars('<strong>' . trim($this->getCaption(), ':') . '</strong>' . $separator . $description, ENT_COMPAT, 'UTF-8');
}
$this->addAttribute("class", $class, "label");
示例12: loadBootstrap
public static function loadBootstrap($version = 2, $type = 2)
{
$document = JFactory::getDocument();
if ($document->getType() != 'html') {
return true;
}
$isJoomla3x = JUDirectoryHelper::isJoomla3x();
$app = JFactory::getApplication();
if ($type == 0 && ($isJoomla3x || $app->isSite())) {
return false;
}
$loadBootstrap = true;
if ($type == 2 || $app->isAdmin()) {
$header = $document->getHeadData();
$scripts = $header['scripts'];
if (count($scripts)) {
$pattern = '/([\\/\\a-zA-Z0-9_:\\.-]*)bootstrap.([0-9\\.-]|core|custom|min|pack)*?.js(.*?)/i';
foreach ($scripts as $script => $opts) {
if (preg_match($pattern, $script)) {
$loadBootstrap = false;
break;
}
}
}
}
if ($loadBootstrap) {
JUDirectoryFrontHelper::loadjQuery();
if ($version == 2) {
if (!$isJoomla3x) {
$document->addScript(JUri::root(true) . '/components/com_judirectory/assets/bootstrap2/js/bootstrap.min.js');
$document->addStyleSheet(JUri::root(true) . '/components/com_judirectory/assets/bootstrap2/css/bootstrap.min.css');
$document->addStyleSheet(JUri::root(true) . '/components/com_judirectory/assets/bootstrap2/css/bootstrap-responsive.min.css');
$document->addScriptDeclaration('
jQuery(document).ready(function($){
$(\'.hasTooltip\').tooltip({\'html\': true, trigger: \'hover\'}).bind(\'hidden\', function () {
$(this).show();
});
});
');
} else {
JHtml::_('bootstrap.framework');
if ($app->isSite()) {
}
}
} elseif ($version == 3) {
$document->addScript(JUri::root(true) . '/components/com_judirectory/assets/bootstrap3/js/bootstrap.min.js');
$document->addStyleSheet(JUri::root(true) . '/components/com_judirectory/assets/bootstrap3/css/bootstrap.min.css');
$document->addStyleSheet(JUri::root(true) . '/components/com_judirectory/assets/bootstrap3/css/bootstrap-theme.min.css');
$document->addScriptDeclaration('
jQuery(document).ready(function($){
$(\'.hasTooltip\').tooltip({\'html\': true, trigger: \'hover\'}).bind(\'hidden\', function () {
$(this).show();
});
});
');
}
}
if ($app->isAdmin()) {
$document->addScript(JUri::root(true) . '/administrator/components/com_judirectory/assets/js/bootstrap-hover-dropdown.js');
}
}
示例13: getInput
public function getInput($fieldValue = null)
{
if (!$this->isPublished()) {
return "";
}
if (JUDirectoryHelper::getListingSubmitType($this->listing_id) == 'submit' && $this->canSubmit() || JUDirectoryHelper::getListingSubmitType($this->listing_id) == 'edit' && $this->canEdit()) {
$disabled = false;
} else {
$disabled = true;
}
$document = JFactory::getDocument();
$rootCat = JUDirectoryFrontHelperCategory::getRootCategory();
JText::script('COM_JUDIRECTORY_TOTAL_CATS_OVER_MAXIMUM_N_CATS');
JText::script('COM_JUDIRECTORY_CATEGORY_X_ALREADY_EXIST');
$app = JFactory::getApplication();
// getParams by cat_id if possible
if (isset($this->listing) && $this->listing->cat_id) {
$params = JUDirectoryHelper::getParams($this->listing->cat_id);
} else {
$params = JUDirectoryHelper::getParams(null, $this->listing_id);
}
$db = JFactory::getDbo();
$listingId = $this->listing_id;
$listingObject = JUDirectoryHelper::getListingById($listingId);
$secondaryCatIds = $secondaryCatIdsStr = "";
// Edit listing, but not valid data -> $fieldValue = user selected categories
if ($fieldValue && !empty($fieldValue['main'])) {
$categoryId = (int) $fieldValue['main'];
if ($fieldValue['secondary']) {
$secondaryCatIdsStr = $fieldValue['secondary'];
$secondaryCatIds = explode(",", $secondaryCatIdsStr);
}
$query = $db->getQuery(true);
$query->select("c.id, c.parent_id");
$query->from("#__judirectory_categories AS c");
$query->select("field_group.id AS fieldgroup_id, field_group.name AS fieldgroup_name");
$query->join("LEFT", "#__judirectory_fields_groups AS field_group ON (field_group.id = c.fieldgroup_id AND field_group.published = 1)");
$query->where("c.id = " . $categoryId);
$db->setQuery($query);
$mainCategory = $db->loadObject();
} elseif ($listingId) {
$categories = $this->value;
foreach ($categories as $category) {
if ($category->main == 1) {
$mainCategory = $category;
$query = $db->getQuery(true);
$query->select("field_group.id, field_group.name");
$query->from("#__judirectory_fields_groups AS field_group");
$query->join("", "#__judirectory_categories AS c on c.fieldgroup_id = field_group.id");
$query->where("c.id = " . $mainCategory->id);
$query->where("field_group.published = 1");
$db->setQuery($query);
$fieldGroup = $db->loadObject();
if (is_object($fieldGroup)) {
$mainCategory->fieldgroup_name = $fieldGroup->name;
$mainCategory->fieldgroup_id = $fieldGroup->id;
} else {
$mainCategory->fieldgroup_name = null;
$mainCategory->fieldgroup_id = null;
}
} else {
$secondaryCatIds[] = $category->id;
}
}
if ($secondaryCatIds) {
$secondaryCatIdsStr = implode(",", $secondaryCatIds);
}
} elseif ($app->input->getInt('cat_id')) {
$categoryId = $app->input->getInt('cat_id');
$mainCategory = JUDirectoryHelper::getCategoryById($categoryId);
$query = "SELECT id, name FROM #__judirectory_fields_groups WHERE id= " . $mainCategory->fieldgroup_id . " AND published = 1";
$db->setQuery($query);
$fieldGroup = $db->loadObject();
if (is_object($fieldGroup)) {
$mainCategory->fieldgroup_name = $fieldGroup->name;
$mainCategory->fieldgroup_id = $fieldGroup->id;
} else {
$mainCategory->fieldgroup_name = null;
$mainCategory->fieldgroup_id = null;
}
} else {
$mainCategory = new stdClass();
$mainCategory->id = '';
$mainCategory->parent_id = $rootCat->id;
$mainCategory->fieldgroup_name = null;
$mainCategory->fieldgroup_id = null;
}
$document->addStyleSheet(JUri::root() . "components/com_judirectory/fields/" . $this->folder . "/core_categories.css");
if (!$disabled) {
$document->addScript(JUri::root() . "components/com_judirectory/fields/" . $this->folder . "/core_categories.js");
if (JUDirectoryHelper::isJoomla3x()) {
$jsIsJoomla3x = 1;
} else {
$jsIsJoomla3x = 0;
}
$script = "jQuery(document).ready(function(\$){\n\t\t\t\t\t\t\t\t\$('.category_selection').listingChangeCategory({\n\t\t\t\t\t\t\t\t\tlisting_id: '" . $listingId . "',\n\t\t\t\t\t\t\t\t\tis_joomla_3x: '" . $jsIsJoomla3x . "',\n\t\t\t\t\t\t\t\t\tmain_cat_id: '" . $mainCategory->id . "',\n\t\t\t\t\t\t\t\t\tfieldgroup_id: '" . $mainCategory->fieldgroup_id . "',\n\t\t\t\t\t\t\t\t\tfieldgroup_name : '" . $mainCategory->fieldgroup_name . "',\n\t\t\t\t\t\t\t\t\tmax_cats : " . (int) $params->get("max_cats_per_listing", 0) . "\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t});";
$document->addScriptDeclaration($script);
}
$this->addAttribute("class", "categories", "input");
$this->addAttribute("class", $this->getInputClass(), "input");
//.........这里部分代码省略.........
示例14: strtolower
JHtml::_('formbehavior.chosen', 'select');
$user = JFactory::getUser();
$userId = $user->get('id');
$listOrder = $this->escape($this->state->get('list.ordering'));
$listDirn = $this->escape($this->state->get('list.direction'));
$saveOrder = $listOrder == 'field.ordering';
$priority = $listOrder == 'field.priority';
$backend_list_view_ordering = $listOrder == 'field.backend_list_view_ordering';
if ($saveOrder) {
$saveOrderingUrl = 'index.php?option=com_judirectory&task=fields.saveOrderAjax&tmpl=component';
JHtml::_('sortablelist.sortable', 'data-list', 'adminForm', strtolower($listDirn), $saveOrderingUrl);
}
?>
<script type="text/javascript">
var isJoomla3x = <?php
echo JUDirectoryHelper::isJoomla3x() ? 1 : 0;
?>
;
Joomla.orderTable = function () {
table = document.getElementById("sortTable");
direction = document.getElementById("directionTable");
order = table.options[table.selectedIndex].value;
if (order != '<?php
echo $listOrder;
?>
') {
dirn = 'asc';
} else {
dirn = direction.options[direction.selectedIndex].value;
}
Joomla.tableOrdering(order, dirn, '');
示例15: thumb
public static function thumb($template, $type = null)
{
$template = strtolower($template);
$basePath = JPATH_SITE . '/components/com_judirectory/templates/' . $template;
$baseUrl = JUri::root(true) . '/components/com_judirectory/';
if ($type == 'thumbnail') {
$fileList = JFolder::files($basePath . '/');
if (!empty($fileList)) {
foreach ($fileList as $fileName) {
$explodeArray = explode('.', $fileName);
if ($explodeArray[0] == 'template_thumbnail') {
$extThumbnail = end($explodeArray);
break;
}
}
}
if (isset($extThumbnail)) {
$thumb = $basePath . '/template_thumbnail.' . $extThumbnail;
}
if (isset($extThumbnail)) {
$preview = $basePath . '/template_thumbnail.' . $extThumbnail;
}
} elseif ($type == 'preview') {
$fileList = JFolder::files($basePath . '/');
if (!empty($fileList)) {
foreach ($fileList as $fileName) {
$explodeArray = explode('.', $fileName);
if ($explodeArray[0] == 'template_preview') {
$extPreview = end($explodeArray);
break;
}
}
}
if (isset($extPreview)) {
$thumb = $basePath . '/template_preview.' . $extPreview;
}
if (isset($extPreview)) {
$preview = $basePath . '/template_preview.' . $extPreview;
}
} else {
$fileList = JFolder::files($basePath . '/');
if (!empty($fileList)) {
foreach ($fileList as $fileName) {
$explodeArray = explode('.', $fileName);
if ($explodeArray[0] == 'template_thumbnail') {
$extThumbnail = end($explodeArray);
} elseif ($explodeArray[0] == 'template_preview') {
$extPreview = end($explodeArray);
}
}
}
if (isset($extThumbnail)) {
$thumb = $basePath . '/template_thumbnail.' . $extThumbnail;
}
if (isset($extPreview)) {
$preview = $basePath . '/template_preview.' . $extPreview;
}
}
$thumbIsImage = false;
if (isset($thumb)) {
if (@is_array(getimagesize($thumb))) {
$thumbIsImage = true;
}
}
$previewIsImage = false;
if (isset($preview)) {
if (@is_array(getimagesize($preview))) {
$previewIsImage = true;
}
}
$html = '';
if (isset($thumb) && $thumbIsImage && file_exists($thumb)) {
if (JUDirectoryHelper::isJoomla3x()) {
JHtml::_('bootstrap.tooltip');
}
JHtml::_('behavior.modal');
if ($type == 'thumbnail') {
$thumb = 'components/com_judirectory/templates/' . $template . '/template_thumbnail.' . $extThumbnail;
$html = JHtml::_('image', $thumb, JText::_('COM_JUDIRECTORY_PREVIEW'), array('width' => '200px', 'height' => '200px'));
} elseif ($type == 'preview') {
$thumb = 'components/com_judirectory/templates/' . $template . '/template_preview.' . $extPreview;
$html = JHtml::_('image', $thumb, JText::_('COM_JUDIRECTORY_PREVIEW'), array('width' => '200px', 'height' => '200px'));
} else {
$thumb = 'components/com_judirectory/templates/' . $template . '/template_thumbnail.' . $extThumbnail;
$html = JHtml::_('image', $thumb, JText::_('COM_JUDIRECTORY_PREVIEW'));
}
if (isset($preview) && $previewIsImage && file_exists($preview)) {
if ($type == 'thumbnail') {
$preview = $baseUrl . '/templates/' . $template . '/template_thumbnail.' . $extThumbnail;
} elseif ($type == 'preview') {
$preview = $baseUrl . '/templates/' . $template . '/template_preview.' . $extPreview;
} else {
$preview = $baseUrl . '/templates/' . $template . '/template_preview.' . $extPreview;
}
if (JUDirectoryHelper::isJoomla3x()) {
$html = '<a href="' . $preview . '" class="thumbnail pull-left modal hasTooltip" title="' . JHtml::tooltipText('COM_JUDIRECTORY_CLICK_TO_ENLARGE') . '">' . $html . '</a>';
} else {
$html = '<a href="' . $preview . '" class="thumbnail pull-left modal hasTip" title="' . JText::_('COM_JUDIRECTORY_CLICK_TO_ENLARGE') . '" style="width:200px;">' . $html . '</a>';
}
}
//.........这里部分代码省略.........