forked from DineshDevkota/Pyrocms_Google-analytics-Module
-
Notifications
You must be signed in to change notification settings - Fork 0
/
details.php
executable file
·224 lines (219 loc) · 6.11 KB
/
details.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
<?php
defined ( 'BASEPATH' ) or exit ( 'No direct script access allowed' );
/**
* social Media Module
*
* @author Dinesh Devkota
* @package
*
* @link http://www.dineshdevkota.com
*
*/
// admin
class Module_Media_stats extends Module {
public $version = '0.2';
public function __construct() {
parent::__construct ();
// load the streams driver
$this->load->driver ( 'Streams' );
set_time_limit ( 60 );
}
public function info() {
return array (
'name' => array (
'en' => 'Statistics Module'
),
'description' => array (
'en' => 'Module Made by Senior Citizens.'
),
'frontend' => False,
'backend' => TRUE,
'menu' => 'content',
'skip_xss' => true,
'shortcuts' => array (
array (
'name' => 'media_stats:API',
'uri' => 'admin/media_stats/',
'class' => 'add'
)
)
); // You can also place modules in their top level menu. For example try: 'menu' => 'Sample',
}
public function install() {
// remove all tables if they exist already
$this->streams->utilities->remove_namespace ( 'social_media' );
// add our new stream( table) for API creds
$this->streams->streams->add_stream ( 'social_media_creds', 'social_media_creds', 'social_media', "nt", "Stream used for the creds if Social Media of USER to consume API." );
$this->streams->streams->add_stream ( 'google_analytics', 'google_analytics', 'social_media', "nt_", "Table for Google Analytics" );
$credsfield = array (
array (
'name' => 'Google Ana Accesstoken',
'slug' => 'ga_accessToken',
'namespace' => 'social_media',
'type' => 'text',
'assign' => 'social_media_creds',
'required' => false
),
array (
'name' => 'Google Ana tokenCreated',
'slug' => 'ga_tokenCreated',
'namespace' => 'social_media',
'type' => 'text',
'assign' => 'social_media_creds',
'required' => false
),
array (
'name' => 'Google Ana tokenExpires',
'slug' => 'ga_tokenExpires',
'namespace' => 'social_media',
'type' => 'text',
'assign' => 'social_media_creds',
'required' => false
),
array (
'name' => 'Google Ana refreshToken',
'slug' => 'ga_refreshToken',
'namespace' => 'social_media',
'type' => 'text',
'assign' => 'social_media_creds',
'required' => false
),
array (
'name' => 'sende crud code',
'slug' => 'sender_crud_code',
'namespace' => 'social_media',
'type' => 'text',
'assign' => 'social_media_creds',
'required' => false
),
array (
'name' => 'ClientId',
'slug' => 'ClientId',
'namespace' => 'social_media',
'type' => 'text',
'assign' => 'social_media_creds',
'required' => false
),
array (
'name' => 'Clientsecret',
'slug' => 'Clientsecret',
'namespace' => 'social_media',
'type' => 'text',
'assign' => 'social_media_creds',
'required' => false
),
array (
'name' => 'Analytics ClientId',
'slug' => 'Analytics_ClientId',
'namespace' => 'social_media',
'type' => 'text',
'assign' => 'social_media_creds',
'required' => false
),
array (
'name' => 'Analytics ClientName',
'slug' => 'Analytics_ClientName',
'namespace' => 'social_media',
'type' => 'text',
'assign' => 'social_media_creds',
'required' => false
)
)
;
$this->streams->fields->add_fields ( $credsfield );
/* Begin Google Analytics Fields */
$fieldsb = array (
array (
'name' => 'Raw Data',
'slug' => 'raw_data',
'namespace' => 'social_media',
'type' => 'textarea',
'assign' => 'google_analytics',
'required' => false
),
array (
'name' => 'Total Visit Days',
'slug' => 'total_visit',
'namespace' => 'social_media',
'type' => 'integer',
'assign' => 'google_analytics',
'required' => false
),
array (
'name' => 'Visits By Day Facebook',
'slug' => 'vbd_fb',
'namespace' => 'social_media',
'type' => 'integer',
'assign' => 'google_analytics',
'required' => false
),
array (
'name' => 'Visits By Day Google',
'slug' => 'vbd_google',
'namespace' => 'social_media',
'type' => 'integer',
'assign' => 'google_analytics',
'required' => false
),
array (
'name' => 'Visits By Day Reddit',
'slug' => 'vbd_reddit',
'namespace' => 'social_media',
'type' => 'integer',
'assign' => 'google_analytics',
'required' => false
),
array (
'name' => 'Visits By Day Twitter',
'slug' => 'vbd_Twitter',
'namespace' => 'social_media',
'type' => 'integer',
'assign' => 'google_analytics',
'required' => false
),
array (
'name' => 'Visits By Day Bing',
'slug' => 'vbd_bing',
'namespace' => 'social_media',
'type' => 'integer',
'assign' => 'google_analytics',
'required' => false
),
array (
'name' => 'Visits By Day Pininterest',
'slug' => 'vbd_pininterest',
'namespace' => 'social_media',
'type' => 'integer',
'assign' => 'google_analytics',
'required' => false
),
array (
'name' => 'Visits By Day Linkedin',
'slug' => 'vbd_linkedin',
'namespace' => 'social_media',
'type' => 'integer',
'assign' => 'google_analytics',
'required' => false
)
);
$this->streams->fields->add_fields ( $fieldsb );
// We made it!
return TRUE;
}
public function uninstall() { // Remove all tables with this namespace.
$this->streams->utilities->remove_namespace ( 'social_media' );
// Put a check in to see if something failed, otherwise it worked
return TRUE;
}
public function upgrade($old_version) {
// Your Upgrade Logic
return TRUE;
}
public function help() {
// Return a string containing help info
return "Here you can enter HTML with paragrpah tags or whatever you like";
// You could include a file and return it here.
return $this->load->view ( 'help', NULL, TRUE ); // loads modules/sample/views/help.php
}
}
?>