PluginProbe
weForms – Easy Drag & Drop Contact Form Builder For WordPress / 1.3.4
weForms – Easy Drag & Drop Contact Form Builder For WordPress v1.3.4
1.6.7 1.6.8 1.6.9 1.6.12 1.6.13 1.6.14 1.6.15 1.6.16 1.6.17 1.6.18 1.6.19 1.6.2 1.6.20 1.6.21 1.6.22 1.6.23 1.6.24 1.6.25 1.6.26 1.6.27 1.6.28 1.6.3 1.6.4 1.6.5 1.6.6 All 74 releases
← All changes | includes/integrations/class-abstract-integration.php +227 -220 1.6.211.3.4 View file →
@@ -1,220 +1,227 @@
1 -<?php
2 -
3 -/**
4 - * The Integration abstract class
5 - *
6 - * @since 1.1.0
7 - */
8 -abstract class WeForms_Abstract_Integration {
9 -
10 - /**
11 - * The integration id
12 - *
13 - * @var bool
14 - */
15 - public $id;
16 -
17 - /**
18 - * If the integration is enabled
19 - *
20 - * @var bool
21 - */
22 - public $enabled;
23 -
24 - /**
25 - * Integration title
26 - *
27 - * @var string
28 - */
29 - public $title;
30 -
31 - /**
32 - * URL to the integration icon
33 - *
34 - * @var string
35 - */
36 - public $icon;
37 -
38 - /**
39 - * The settings fields for this integrations
40 - *
41 - * @var array
42 - */
43 - public $settings_fields = [];
44 -
45 - /**
46 - * The settings fields for this integrations
47 - *
48 - * @var array
49 - */
50 - protected $template = null;
51 -
52 - /**
53 - * The settings settings_template
54 - *
55 - * @var array
56 - */
57 - protected $settings_template = null;
58 -
59 - /**
60 - * Get the integration title
61 - *
62 - * @return string
63 - */
64 - public function get_title() {
65 - return apply_filters( 'weforms_integration_title', $this->title, $this );
66 - }
67 -
68 - /**
69 - * Get the integration id
70 - *
71 - * @return string
72 - */
73 - public function get_id() {
74 - return apply_filters( 'weforms_integration_title', $this->id, $this );
75 - }
76 -
77 - /**
78 - * Get intgration icon
79 - *
80 - * @return string
81 - */
82 - public function get_icon() {
83 - return apply_filters( 'weforms_integration_icon', $this->icon, $this );
84 - }
85 -
86 - /**
87 - * Check if the integration is enabled
88 - *
89 - * @return bool
90 - */
91 - public function is_enabled() {
92 - return $this->enabled == true;
93 - }
94 -
95 - /**
96 - * Check if it's a pro field
97 - *
98 - * @return bool
99 - */
100 - public function is_pro() {
101 - return false;
102 - }
103 -
104 - /**
105 - * Get the settings fields
106 - *
107 - * @return array
108 - */
109 - public function get_settings_fields() {
110 - return $this->settings_fields;
111 - }
112 -
113 - /**
114 - * Get the integration settings for the component
115 - *
116 - * @return array
117 - */
118 - public function get_js_settings() {
119 - return [
120 - 'id' => $this->get_id(),
121 - 'title' => $this->get_title(),
122 - 'icon' => $this->get_icon(),
123 - 'settings' => $this->get_settings_fields(),
124 - 'pro' => $this->is_pro(),
125 - ];
126 - }
127 -
128 - /**
129 - * Check if it's the forms page
130 - *
131 - * @return bool
132 - */
133 - public function is_weforms_page() {
134 - if ( get_current_screen()->base != 'toplevel_page_weforms' ) {
135 - return false;
136 - }
137 -
138 - return true;
139 - }
140 -
141 - /**
142 - * Load the individual template file if exists
143 - *
144 - * @return void
145 - */
146 - public function load_template() {
147 - if ( !$this->is_weforms_page() ) {
148 - return;
149 - }
150 -
151 - if ( !$this->template ) {
152 - return;
153 - }
154 -
155 - echo '<script type="text/x-template" id="tmpl-wpuf-integration-' . esc_attr( $this->id ). '">';
156 - include $this->template;
157 - echo '</script>';
158 - }
159 -
160 - /**
161 - * Load settings
162 - *
163 - * @return void
164 - */
165 - public function load_settings( $priority = 10 ) {
166 - if ( !$this->settings_template ) {
167 - return;
168 - }
169 -
170 - add_action( 'weforms_settings_tabs', [ $this, 'settings_tabs' ], $priority );
171 - add_action( 'weforms_settings_tab_content_' . $this->id, [ $this, 'settings_panel' ], $priority );
172 - }
173 -
174 - /**
175 - * Render the settings panel
176 - *
177 - * @return void
178 - */
179 - public function settings_panel() {
180 - if ( file_exists( $this->settings_template ) ) {
181 - include $this->settings_template;
182 - }
183 - }
184 -
185 - /**
186 - * Add new tab at settings
187 - *
188 - * @return void
189 - */
190 - public function settings_tabs( $tabs ) {
191 - $tabs[ $this->id ] = [
192 - 'label' => $this->title,
193 - 'icon' => $this->icon,
194 - ];
195 -
196 - return $tabs;
197 - }
198 -
199 - /**
200 - * Get file prefix
201 - *
202 - * @return string
203 - */
204 - public function get_prefix() {
205 - $prefix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
206 -
207 - return $prefix;
208 - }
209 -
210 - /**
211 - * Get default componenet url
212 - *
213 - * @return string
214 - */
215 - public function module_component_file( $plugin_file ) {
216 - $prefix = $this->get_prefix();
217 -
218 - return plugins_url( 'component/index' . $prefix . '.js', $plugin_file );
219 - }
220 -}
1 +<?php
2 +
3 +/**
4 + * The Integration abstract class
5 + *
6 + * @since 1.1.0
7 + */
8 +abstract class WeForms_Abstract_Integration {
9 +
10 + /**
11 + * The integration id
12 + *
13 + * @var boolean
14 + */
15 + public $id;
16 +
17 + /**
18 + * If the integration is enabled
19 + *
20 + * @var boolean
21 + */
22 + public $enabled;
23 +
24 + /**
25 + * Integration title
26 + *
27 + * @var string
28 + */
29 + public $title;
30 +
31 + /**
32 + * URL to the integration icon
33 + *
34 + * @var string
35 + */
36 + public $icon;
37 +
38 + /**
39 + * The settings fields for this integrations
40 + *
41 + * @var array
42 + */
43 + public $settings_fields = array();
44 +
45 + /**
46 + * The settings fields for this integrations
47 + *
48 + * @var array
49 + */
50 + protected $template = null;
51 +
52 +
53 + /**
54 + * The settings settings_template
55 + *
56 + * @var array
57 + */
58 + protected $settings_template = null;
59 +
60 +
61 + /**
62 + * Get the integration title
63 + *
64 + * @return string
65 + */
66 + public function get_title() {
67 + return apply_filters( 'weforms_integration_title', $this->title, $this );
68 + }
69 +
70 + /**
71 + * Get the integration id
72 + *
73 + * @return string
74 + */
75 + public function get_id() {
76 + return apply_filters( 'weforms_integration_title', $this->id, $this );
77 + }
78 +
79 + /**
80 + * Get intgration icon
81 + *
82 + * @return string
83 + */
84 + public function get_icon() {
85 + return apply_filters( 'weforms_integration_icon', $this->icon, $this );
86 + }
87 +
88 + /**
89 + * Check if the integration is enabled
90 + *
91 + * @return boolean
92 + */
93 + public function is_enabled() {
94 + return $this->enabled == true;
95 + }
96 +
97 + /**
98 + * Check if it's a pro field
99 + *
100 + * @return boolean
101 + */
102 + public function is_pro() {
103 + return false;
104 + }
105 +
106 + /**
107 + * Get the settings fields
108 + *
109 + * @return array
110 + */
111 + public function get_settings_fields() {
112 + return $this->settings_fields;
113 + }
114 +
115 + /**
116 + * Get the integration settings for the component
117 + *
118 + * @return array
119 + */
120 + public function get_js_settings() {
121 + return array(
122 + 'id' => $this->get_id(),
123 + 'title' => $this->get_title(),
124 + 'icon' => $this->get_icon(),
125 + 'settings' => $this->get_settings_fields(),
126 + 'pro' => $this->is_pro()
127 + );
128 + }
129 +
130 +
131 + /**
132 + * Check if it's the forms page
133 + *
134 + * @return boolean
135 + */
136 + public function is_weforms_page() {
137 + if ( get_current_screen()->base != 'toplevel_page_weforms' ) {
138 + return false;
139 + }
140 +
141 + return true;
142 + }
143 +
144 + /**
145 + * Load the individual template file if exists
146 + *
147 + * @return void
148 + */
149 + public function load_template() {
150 + if ( ! $this->is_weforms_page() ) {
151 + return;
152 + }
153 +
154 + if ( ! $this->template ) {
155 + return;
156 + }
157 +
158 + echo '<script type="text/x-template" id="tmpl-wpuf-integration-' . $this->id . '">';
159 + include $this->template;
160 + echo '</script>';
161 + }
162 +
163 + /**
164 + * Load settings
165 + *
166 + * @return void
167 + */
168 + public function load_settings( $priority = 10 ) {
169 +
170 + if ( ! $this->settings_template ) {
171 + return;
172 + }
173 +
174 + add_action( 'weforms_settings_tabs', array( $this, 'settings_tabs' ), $priority );
175 + add_action( 'weforms_settings_tab_content_' . $this->id, array( $this, 'settings_panel' ), $priority );
176 + }
177 +
178 +
179 + /**
180 + * Render the settings panel
181 + *
182 + * @return void
183 + */
184 + public function settings_panel() {
185 + if( file_exists( $this->settings_template )) {
186 + include $this->settings_template;
187 + }
188 + }
189 +
190 + /**
191 + * Add new tab at settings
192 + *
193 + * @return void
194 + */
195 + public function settings_tabs( $tabs ) {
196 +
197 + $tabs[ $this->id ] = array(
198 + 'label' => $this->title,
199 + 'icon' => $this->icon,
200 + );
201 +
202 + return $tabs;
203 + }
204 +
205 + /**
206 + * Get file prefix
207 + *
208 + * @return string
209 + */
210 + public function get_prefix() {
211 + $prefix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
212 +
213 + return $prefix;
214 + }
215 +
216 + /**
217 + * Get default componenet url
218 + *
219 + * @return string
220 + */
221 + public function module_component_file( $plugin_file ) {
222 +
223 + $prefix = $this->get_prefix();
224 +
225 + return plugins_url( 'component/index' . $prefix . '.js', $plugin_file );
226 + }
227 +}