Subversion Repositories cheapmusic

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
103 - 1
<?php
2
 
3
/***************************************************************************
4
 *   Copyright (C) 2009-2011 by Geo Varghese(www.seopanel.in)  	   *
5
 *   sendtogeo@gmail.com   												   *
6
 *                                                                         *
7
 *   This program is free software; you can redistribute it and/or modify  *
8
 *   it under the terms of the GNU General Public License as published by  *
9
 *   the Free Software Foundation; either version 2 of the License, or     *
10
 *   (at your option) any later version.                                   *
11
 *                                                                         *
12
 *   This program is distributed in the hope that it will be useful,       *
13
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
14
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
15
 *   GNU General Public License for more details.                          *
16
 *                                                                         *
17
 *   You should have received a copy of the GNU General Public License     *
18
 *   along with this program; if not, write to the                         *
19
 *   Free Software Foundation, Inc.,                                       *
20
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
21
 ***************************************************************************/
22
 
23
# class defines all customizer helper controller functions
24
class Customizer_Helper extends Controller{
25
 
26
	// function to get customizer pages[guest,user,admin,top]
27
	function getCustomizerMenu($menuName, $langCode = 'en') {
28
		$menuInfo = [];
29
 
30
		// check whether plugin installed or not
31
		if (isPluginActivated("customizer")) {
32
			$menuName = addslashes($menuName);
33
			$langCode = addslashes($langCode);
34
			$custSiteInfo = getCustomizerDetails();
35
 
36
			// if custom menu enabled
37
			if (!empty($custSiteInfo['custom_menu'])) {
38
				$menuInfo = $this->dbHelper->getRow("cust_menu", "identifier='$menuName'");
39
 
40
				// if menu existing
41
				if (!empty($menuInfo['id'])) {
42
					$menuInfo['item_list'] = [];
43
					$whereCond = "status=1 and menu_id=" . $menuInfo['id'] . " order by priority asc, float_type asc";
44
					$menuItemList = $this->dbHelper->getAllRows("cust_menu_items", $whereCond);
45
 
46
					// loop through menu items
47
					foreach ($menuItemList as $menuItem) {
48
 
49
						if ($langCode != 'en') {
50
							$whereCond = "menu_item_id=" . $menuItem['id'] . " and lang_code='$langCode'";
51
							$menuTextInfo = $this->dbHelper->getRow("cust_menu_item_texts", $whereCond);
52
							$menuItem['label'] = !empty($menuTextInfo['content']) ? $menuTextInfo['content'] : $menuItem['name'];
53
						} else {
54
							$menuItem['label'] = $menuItem['name'];
55
						}
56
 
57
						if(!stristr($menuItem['url'],'http://') && !stristr($menuItem['url'],'https://')) {
58
							$menuItem['url'] = SP_WEBPATH . "/" . $menuItem['url'];
59
						}
60
 
61
						$menuInfo['item_list'][] = $menuItem;
62
 
63
					}
64
 
65
				}
66
 
67
			}
68
 
69
		}
70
 
71
		return $menuInfo;
72
 
73
	}
74
 
75
	// function to get custom theme styles
76
	function getThemeCustomStyles($themeId, $type='css') {
77
		$style = "";
78
		$type = addslashes($type);
79
 
80
		// check whether plugin installed or not
81
		if (isPluginActivated("customizer")) {
82
		    $desc = ($type == 'css') ? "desc" : "asc";
83
			$whereCond = "theme_id=". intval($themeId) . " and status=1 and type='$type' order by priority $desc";
84
			$styleList = $this->dbHelper->getAllRows("cust_styles", $whereCond);
85
 
86
			foreach ($styleList as $styleInfo) {
87
				$style .= $styleInfo['style_content'] . "\n\n";
88
			}
89
 
90
		}
91
 
92
		return $style;
93
 
94
	}
95
 
96
}
97
?>