forked from surveyjs/surveyjs-wordpress
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsurveyjs.php
90 lines (69 loc) · 2.31 KB
/
surveyjs.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
<?php
/*
Plugin Name: SurveyJS
Plugin URI: https://wordpress.org/plugins/surveyjs
Description: Easy to use, drag & drop Survey Builder with myriad options.
Version: 1.0.33
Author: Devsoft Baltic OÜ
Author URI: http://devsoftbaltic.com/
*/
?>
<?php
function wps_install() {
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
createMySurveysTable();
createResultsTable();
}
function createMySurveysTable() {
global $wpdb;
$charset_collate = $wpdb->get_charset_collate();
$table_name = $wpdb->prefix . 'sjs_my_surveys';
//var_dump( $table_name );
$sql = "CREATE TABLE $table_name (
id mediumint(9) NOT NULL AUTO_INCREMENT,
name text NOT NULL,
json LONGTEXT,
UNIQUE KEY id (id)
) $charset_collate;";
dbDelta( $sql );
}
function createResultsTable() {
global $wpdb;
$charset_collate = $wpdb->get_charset_collate();
$table_name = $wpdb->prefix . 'sjs_results';
//var_dump( $table_name );
$sql = "CREATE TABLE $table_name (
id mediumint(9) NOT NULL AUTO_INCREMENT,
surveyId mediumint(9) NOT NULL,
json longtext,
UNIQUE KEY id (id)
) $charset_collate;";
dbDelta( $sql );
}
function wps_uninstall() {
}
register_activation_hook( __FILE__, 'wps_install');
register_deactivation_hook( __FILE__, 'wps_uninstall');
include("ajax_handlers/insert_survey.php");
new SurveyJS_InsertSurveyHandler();
include("ajax_handlers/save_survey.php");
new SurveyJS_SaveSurvey();
include("ajax_handlers/rename_survey.php");
new SurveyJS_RenameSurvey();
include("ajax_handlers/add_survey.php");
new SurveyJS_AddSurvey();
include("ajax_handlers/delete_survey.php");
new SurveyJS_DeleteSurvey();
include("ajax_handlers/clone_survey.php");
new SurveyJS_CloneSurvey();
include("ajax_handlers/get_survey_json.php");
new SurveyJS_GetSurveyJson();
include("ajax_handlers/save_result.php");
new SurveyJS_SaveResult();
include("ajax_handlers/delete_result.php");
new SurveyJS_DeleteResult();
include("ajax_handlers/upload_file.php");
new SurveyJS_UploadFile();
include("initializer.php");
new SurveyJS_SurveyJS();
?>