-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhelper.php
92 lines (80 loc) · 2.59 KB
/
helper.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<?php
/**
* @package Xpert Gallery
* @version ##VERSION##
* @author ThemeXpert http://www.themexpert.com
* @copyright Copyright (C) 2009 - 2011 ThemeXpert
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 only
*
*/
// no direct access
defined('_JEXEC') or die;
abstract class XEFXpertGalleryHelper
{
public static function getCatFilterList($items, $params)
{
$html = '';
// Set the var name based on content source
switch ( $params->get('content_source', 'joomla') ) {
case 'k2':
$cat_alias = 'categoryalias';
$cat_name = 'categoryname';
break;
// Default Joomla
default:
$cat_alias = 'category_route';
$cat_name = 'category_title';
break;
}
$i = 1;
foreach( $items as $item )
{
if( !$params->get('show_all') AND ($i == 1) )
{
$class = 'class="active"';
}else{
$class = '';
}
$html .= '<li data-filter=".'. str_replace('/', '-', $item[0]->$cat_alias) .'"'. $class .'>' . $item[0]->$cat_name . '</li>' . "\n";
$i++;
}
return $html ;
}
public static function getCatNameAsClass( $item, $params )
{
switch ( $params->get('content_source', 'joomla') )
{
case 'k2':
$class = $item->categoryalias;
break;
default:
$class = str_replace('/', '-', $item->category_route);
break;
}
return $class;
}
public static function loadScript($module, $params)
{
if( !defined('XPERT_GALLERY') )
{
$doc = JFactory::getDocument();
$js_path = JURI::root(true).'/modules/mod_xpertgallery/assets/js';
$css_path = JURI::root(true).'/modules/mod_xpertgallery/assets/css';
if( $params->get('sort_enabled') OR
$params->get('cat_sort_enabled') AND
($params->get('content_source') !== 'flickr') )
{
$doc->addScript($js_path . '/jquery.isotope.min.js');
}
if( !defined('XPERT_POPUP') )
{
$doc->addScript($js_path . '/magnific.min.js');
$doc->addStyleSheet($css_path . '/magnific.css');
define('XPERT_POPUP',1);
}
// Load module script last
$doc->addScript($js_path . '/script.min.js');
define('XPERT_GALLERY',1);
}
}
}