forked from lianglee/UserCSV
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathossn_com.php
41 lines (40 loc) · 1.11 KB
/
ossn_com.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
<?php
/**
* Open Source Social Network
*
* @packageOpen Source Social Network
* @author Open Social Website Core Team <[email protected]>
* @copyright 2014 iNFORMATIKON TECHNOLOGIES
* @license General Public Licence http://www.opensource-socialnetwork.org/licence
* @link http://www.opensource-socialnetwork.org/licence
*/
define('__USERCVS__', ossn_route()->com . 'UserCSV/');
/**
* Initialize Component
*
* @return void
*/
function users_cvs_init() {
ossn_register_com_panel('UserCSV', 'settings');
if(ossn_isLoggedin()) {
ossn_register_action('users/to/cvs', __USERCVS__ . 'actions/generate.php');
}
}
/**
* Array to csv
*
* See the original source: [email protected]:4274500.git
*/
function array2csv($array, &$title, &$data) {
foreach($array as $key => $value) {
if(is_array($value)) {
$title .= $key . ",";
$data .= "" . ",";
array2csv($value, $title, $data);
} else {
$title .= $key . ",";
$data .= '"' . $value . '",';
}
}
}
ossn_register_callback('ossn', 'init', 'users_cvs_init');