-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathnubuilder-forte.php
125 lines (89 loc) · 3.25 KB
/
nubuilder-forte.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
<?php
/**
* @package nubuilder-forte
* @version 1.0
*/
/*
Plugin Name: nuBuilder Forte
Plugin URI: https://www.nubuilder.com/
Description: nuBuilder Database is a low-code, open-source application builder. Build reports and forms using Wordpress tables and any other table created in the Wordpress database.
Author: nuSoftware
Version: 1.0
Text Domain: nubuilder-forte
*/
defined( 'ABSPATH' ) or die();
require_once('nuwordpresssetuplibs.php');
function nu_set_menu() {
add_menu_page('nuBuilder Forte', 'nuBuilder', 'read', 'nubuilder-forte-slug', 'nu_menu_function', 'dashicons-chart-bar');
}
function nu_start_session() {
if(!session_id()) {
session_start();
} else {
unset($_SESSION['nubuilder_wordpress_session_data']);
unset($_SESSION['nubuilder_session_data']);
}
}
class nuBuilderForte{
function __construct() {
add_action('auth_redirect', 'nu_set_menu');
add_action('init', 'nu_start_session', 1);
add_shortcode( 'nubuilder-forte', 'nubuilder_forte_shortcode' );
}
function activate() {
nuWPImportNewDB();
nuWPSetWPFlagDB();
nuWPSetDeniedFlagDB();
nuWPSetNewHeaderAndButtonsDB();
nu_construct_access_levels_WPcoupled();
flush_rewrite_rules();
wp_register_script('nubuilder-forte', plugins_url('nubuilder-forte.php', __FILE__));
wp_enqueue_script('nubuilder-forte');
}
function deactivate() {
flush_rewrite_rules();
}
}
if ( class_exists( 'nuBuilderForte' ) ) {
$nuBuilderForte = new nuBuilderForte();
}
register_activation_hook( __FILE__, array( $nuBuilderForte, 'activate' ) );
register_deactivation_hook( __FILE__, array( $nuBuilderForte, 'deactivate' ) );
function nu_menu_function() {
nu_start_session();
$iframe_url = plugin_dir_url( __FILE__ ).'index.php';
nu_construct_session_data_WPcoupled();
nu_construct_access_levels_WPcoupled();
$j = "
<iframe id='nubuilder4_iframe' style='margin:20px;border-style:solid;border-width:2px;border-color:lightgrey;width:1300px;height:1000px' src='$iframe_url'></iframe>
<script>
jQuery(window).resize(function(){
nuResize();
});
function nuResize(){
var w = parseInt(jQuery('#adminmenuback').css('width')) ;
if(w == 190){
w = 0;
}
document.getElementById('nubuilder4_iframe').style.width = String(Number(window.innerWidth) - w - 100) + 'px';
document.getElementById('nubuilder4_iframe').style.height = String(Number(window.innerHeight) - 95) + 'px';
}
nuResize();
document.body.addEventListener('onresize', nuResize);
</script>
";
echo $j;
}
function nubuilder_forte_shortcode($atts){
$iframe_url = plugin_dir_url( __FILE__ ).'index.php';
$w = isset($atts['width']) ? intval($atts['width']) : 300 . 'px';
$h = isset($atts['height']) ? intval($atts['height']) : 300 . 'px';
$t = isset($atts['top']) ? intval($atts['top']) : 0 . 'px';
$l = isset($atts['left']) ? intval($atts['left']) : 0 . 'px';
$b = isset($atts['border-width']) ? intval($atts['border-width']) : 0 . 'px';
$u = isset($atts['username']) ? $atts['username'] : 0;
$p = isset($atts['password']) ? $atts['password'] : 0;
$j = "<iframe id='nubuilder4_iframe' style='top:$t;left:$l;border-style:solid;border-width:$b;border-color:lightgrey;width:$w;height:$h' src='$iframe_url'></iframe>";
return $j;
}
?>