-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctions.php
executable file
·49 lines (45 loc) · 1.34 KB
/
functions.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
<?php
session_start();
//Setup API Instance
global $current_user, $wpdb, $table_prefix;
$myrows = $wpdb->get_results( "SELECT * FROM `".DEC_TABLE_DETAILS."` where type='de'" );
foreach($myrows as $myrow){
$api_base_url_1= $myrow->api_base_url;
$api_end_point_1= $myrow->api_end_point;
$api_key_1=$myrow->api_key;
$estate_id_1=$myrow->main_estate_id;
}
$url=$api_base_url_1.'/'.$api_end_point_1.$estate_id_1.'?api_key='.$api_key_1;
De_api::get_instance($api_key_1, $api_base_url_1, $estate_id_1);
//Used for product detail view
if(!isset($_REQUEST['id']) || $_REQUEST['id']==''){
$_SESSION['api_arry']='';
}
else if($_SESSION['api_arry']->id==$_REQUEST['id']){
global $api_arry;
$api_arry=$_SESSION['api_arry'] ;
}
else{
global $api_arry;
$id=$_REQUEST['id'];
$deApi=De_api::get_instance();
$response_1 = $deApi->estates([], $id);
$api_arry=$response_1;
$_SESSION['api_arry']=$api_arry;
}
/**Function**/
function api_error_function(){
global $api_arry;
if($api_arry->status=='error'){
$api_key_error= $api_arry->description;
return $api_key_error;
}
else if($api_arry->status==false){
$api_key_error= $api_arry->error;
return $api_key_error;
}
}
/*****Require Files***/
require_once 'shortcodes/shortcodes.php'; //Self Initilisation
require_once 'shortcodes/widget.php'; //Self initialisation
?>