Version Description
- Is it "campaign"? Or "optin"? No, it's definitely "campaign".
- OptinMonster now works with the shiny new MailPoet 3.
- We're feeling a little lighter after removing some deprecated code.
Download this release
Release Info
Developer | dvinson |
Plugin | Popups by OptinMonster – Best WordPress Lead Generation Plugin |
Version | 1.3.0 |
Comparing to | |
See all releases |
Code changes from version 1.2.2 to 1.3.0
- OMAPI/Actions.php +134 -194
- OMAPI/Ajax.php +27 -4
- OMAPI/Content.php +292 -296
- OMAPI/Menu.php +880 -862
- OMAPI/Output.php +1 -1
- OMAPI/Refresh.php +2 -2
- OMAPI/Save.php +2 -2
- OMAPI/Type.php +12 -12
- OMAPI/Widget.php +3 -3
- assets/js/clipboard.min.js +0 -0
- assets/js/jspdf.min.js +0 -0
- includes/class-am-notification.php +527 -0
- optin-monster-wp-api.php +59 -44
- readme.txt +11 -6
OMAPI/Actions.php
CHANGED
@@ -10,77 +10,77 @@
|
|
10 |
class OMAPI_Actions {
|
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 |
-
* Primary class constructor.
|
50 |
-
*
|
51 |
-
* @since 1.0.0
|
52 |
-
*/
|
53 |
-
public function __construct() {
|
54 |
-
|
55 |
-
// Set our object.
|
56 |
-
$this->set();
|
57 |
|
58 |
// Add validation messages.
|
59 |
add_action( 'admin_init', array( $this, 'actions' ) );
|
60 |
add_action( 'admin_notices', array( $this, 'notices' ) );
|
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 |
// Ensure action is set and correct and the optin is set.
|
86 |
$action = isset( $_GET['optin_monster_api_action'] ) ? stripslashes( $_GET['optin_monster_api_action'] ) : false;
|
@@ -115,136 +115,84 @@ class OMAPI_Actions {
|
|
115 |
$args['optin_monster_api_action_type'] = 'error';
|
116 |
}
|
117 |
break;
|
118 |
-
|
119 |
-
case 'migrate' :
|
120 |
-
if ( $this->migrate() ) {
|
121 |
-
$args['optin_monster_api_action_type'] = 'updated';
|
122 |
-
} else {
|
123 |
-
$args['optin_monster_api_action_type'] = 'error';
|
124 |
-
}
|
125 |
-
$args['optin_monster_api_view'] = 'migrate';
|
126 |
-
break;
|
127 |
-
|
128 |
-
case 'migrate-reset' :
|
129 |
-
if ( $this->migrate_reset() ) {
|
130 |
-
$args['optin_monster_api_action_type'] = 'updated';
|
131 |
-
} else {
|
132 |
-
$args['optin_monster_api_action_type'] = 'error';
|
133 |
-
}
|
134 |
-
$args['optin_monster_api_view'] = 'migrate';
|
135 |
-
break;
|
136 |
}
|
137 |
|
138 |
// Now redirect to prevent reloads from undoing actions.
|
139 |
$redirect = esc_url_raw( add_query_arg( $args, admin_url( 'admin.php?page=optin-monster-api-settings' ) ) );
|
140 |
die( wp_redirect( $redirect ) );
|
141 |
|
142 |
-
|
143 |
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
|
151 |
// Prepare variables.
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
// Maybe update the global/automatic status.
|
163 |
-
if ( $field ) {
|
164 |
-
update_post_meta( $this->optin_id, '_omapi_' . $field, $new );
|
165 |
-
}
|
166 |
-
|
167 |
-
// Set enabled status.
|
168 |
-
return update_post_meta( $this->optin_id, '_omapi_enabled', $new );
|
169 |
-
|
170 |
-
}
|
171 |
-
|
172 |
-
/**
|
173 |
-
* Changes test mode for the optin.
|
174 |
-
*
|
175 |
-
* @since 1.0.0
|
176 |
-
*/
|
177 |
-
public function test() {
|
178 |
-
|
179 |
-
$status = (bool) get_post_meta( $this->optin_id, '_omapi_test', true );
|
180 |
-
$new = $status ? false : true;
|
181 |
-
return update_post_meta( $this->optin_id, '_omapi_test', $new );
|
182 |
-
|
183 |
-
}
|
184 |
-
|
185 |
-
/**
|
186 |
-
* Clears the local cookies.
|
187 |
-
*
|
188 |
-
* @since 1.0.0
|
189 |
-
*/
|
190 |
-
public function cookies() {
|
191 |
-
|
192 |
-
$optins = $this->base->get_optins();
|
193 |
-
foreach ( (array) $optins as $optin ) {
|
194 |
-
if ( $optin ) {
|
195 |
-
// Array of ids so all splits are included
|
196 |
-
$ids = get_post_meta( $optin->ID, '_omapi_ids', true );
|
197 |
-
foreach ( (array) $ids as $id ) {
|
198 |
-
setcookie( 'om-' . $id, '', -1, COOKIEPATH, COOKIE_DOMAIN, false );
|
199 |
-
setcookie( 'om-success-' . $id, '', -1, COOKIEPATH, COOKIE_DOMAIN, false );
|
200 |
-
setcookie( 'om-second-' . $id, '', -1, COOKIEPATH, COOKIE_DOMAIN, false );
|
201 |
-
setcookie( 'om-' . $id . '-closed', '', -1, COOKIEPATH, COOKIE_DOMAIN, false );
|
202 |
-
}
|
203 |
-
}
|
204 |
-
}
|
205 |
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
// Clear out generic success cookie.
|
211 |
-
setcookie( 'om-success-cookie', '', -1, COOKIEPATH, COOKIE_DOMAIN, false );
|
212 |
|
213 |
-
|
|
|
214 |
|
215 |
-
|
216 |
|
217 |
/**
|
218 |
-
*
|
219 |
*
|
220 |
* @since 1.0.0
|
221 |
-
*
|
222 |
-
* @return bool
|
223 |
*/
|
224 |
-
|
225 |
|
226 |
-
|
227 |
-
$
|
228 |
-
|
229 |
-
|
230 |
-
// Run migration
|
231 |
-
$migration = new OMAPI_Migration( $api );
|
232 |
-
|
233 |
-
// Return status
|
234 |
-
return $migration->run();
|
235 |
|
236 |
}
|
237 |
|
238 |
/**
|
239 |
-
*
|
240 |
*
|
241 |
* @since 1.0.0
|
242 |
-
*
|
243 |
-
* @return bool
|
244 |
*/
|
245 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
246 |
|
247 |
-
return
|
248 |
|
249 |
}
|
250 |
|
@@ -262,49 +210,41 @@ class OMAPI_Actions {
|
|
262 |
|
263 |
switch ( $action ) {
|
264 |
case 'status' :
|
265 |
-
$notice = 'updated' == $type ? sprintf( __( 'The
|
266 |
break;
|
267 |
case 'cookies' :
|
268 |
$notice = 'updated' == $type ? __( 'The local cookies have been cleared successfully.', 'optin-monster-api' ) : __( 'There was an error clearing the local cookies. Please try again.', 'optin-monster-api' );
|
269 |
break;
|
270 |
-
|
271 |
-
case 'migrate' :
|
272 |
-
$notice = 'updated' == $type ? __( 'Your data has been migrated.', 'optin-monster-api' ) : __( 'Something happened while migrating your data. Please try again.', 'optin-monster-api' );
|
273 |
-
break;
|
274 |
-
|
275 |
-
case 'migrate-reset' :
|
276 |
-
$notice = 'updated' == $type ? __( 'Migration data has been reset.', 'optin-monster-api' ) : __( 'Something happened while resetting your data. Please try again.', 'optin-monster-api' );
|
277 |
-
break;
|
278 |
}
|
279 |
|
280 |
return $notice;
|
281 |
}
|
282 |
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
|
307 |
-
|
308 |
|
309 |
|
310 |
-
}
|
10 |
class OMAPI_Actions {
|
11 |
|
12 |
/**
|
13 |
+
* Holds the class object.
|
14 |
+
*
|
15 |
+
* @since 1.0.0
|
16 |
+
*
|
17 |
+
* @var object
|
18 |
+
*/
|
19 |
+
public static $instance;
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Path to the file.
|
23 |
+
*
|
24 |
+
* @since 1.0.0
|
25 |
+
*
|
26 |
+
* @var string
|
27 |
+
*/
|
28 |
+
public $file = __FILE__;
|
29 |
|
30 |
/**
|
31 |
+
* Holds any action notices.
|
32 |
+
*
|
33 |
+
* @since 1.0.0
|
34 |
+
*
|
35 |
+
* @var array
|
36 |
+
*/
|
37 |
+
public $notices = array();
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Holds the base class object.
|
41 |
+
*
|
42 |
+
* @since 1.0.0
|
43 |
+
*
|
44 |
+
* @var object
|
45 |
+
*/
|
46 |
+
public $base;
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Primary class constructor.
|
50 |
+
*
|
51 |
+
* @since 1.0.0
|
52 |
+
*/
|
53 |
+
public function __construct() {
|
54 |
+
|
55 |
+
// Set our object.
|
56 |
+
$this->set();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
|
58 |
// Add validation messages.
|
59 |
add_action( 'admin_init', array( $this, 'actions' ) );
|
60 |
add_action( 'admin_notices', array( $this, 'notices' ) );
|
61 |
|
62 |
+
}
|
63 |
|
64 |
+
/**
|
65 |
+
* Sets our object instance and base class instance.
|
66 |
+
*
|
67 |
+
* @since 1.0.0
|
68 |
+
*/
|
69 |
+
public function set() {
|
70 |
|
71 |
+
self::$instance = $this;
|
72 |
+
$this->base = OMAPI::get_instance();
|
73 |
+
$this->view = isset( $_GET['optin_monster_api_view'] ) ? stripslashes( $_GET['optin_monster_api_view'] ) : $this->base->get_view();
|
74 |
+
$this->optin_id = isset( $_GET['optin_monster_api_id'] ) ? absint( $_GET['optin_monster_api_id'] ) : false;
|
75 |
|
76 |
+
}
|
77 |
|
78 |
+
/**
|
79 |
+
* Process admin actions.
|
80 |
+
*
|
81 |
+
* @since 1.0.0
|
82 |
+
*/
|
83 |
+
public function actions() {
|
84 |
|
85 |
// Ensure action is set and correct and the optin is set.
|
86 |
$action = isset( $_GET['optin_monster_api_action'] ) ? stripslashes( $_GET['optin_monster_api_action'] ) : false;
|
115 |
$args['optin_monster_api_action_type'] = 'error';
|
116 |
}
|
117 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
118 |
}
|
119 |
|
120 |
// Now redirect to prevent reloads from undoing actions.
|
121 |
$redirect = esc_url_raw( add_query_arg( $args, admin_url( 'admin.php?page=optin-monster-api-settings' ) ) );
|
122 |
die( wp_redirect( $redirect ) );
|
123 |
|
124 |
+
}
|
125 |
|
126 |
+
/**
|
127 |
+
* Changes the status of an optin.
|
128 |
+
*
|
129 |
+
* @since 1.0.0
|
130 |
+
*/
|
131 |
+
public function status() {
|
132 |
|
133 |
// Prepare variables.
|
134 |
+
$status = (bool) get_post_meta( $this->optin_id, '_omapi_enabled', true );
|
135 |
+
$new = $status ? false : true;
|
136 |
+
$field = 'global';
|
137 |
+
$type = get_post_meta( $this->optin_id, '_omapi_type', true );
|
138 |
+
if ( 'post' == $type ) {
|
139 |
+
$field = 'automatic';
|
140 |
+
} else if ( 'sidebar' == $type ) {
|
141 |
+
$field = false;
|
142 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
143 |
|
144 |
+
// Maybe update the global/automatic status.
|
145 |
+
if ( $field ) {
|
146 |
+
update_post_meta( $this->optin_id, '_omapi_' . $field, $new );
|
147 |
+
}
|
|
|
|
|
148 |
|
149 |
+
// Set enabled status.
|
150 |
+
return update_post_meta( $this->optin_id, '_omapi_enabled', $new );
|
151 |
|
152 |
+
}
|
153 |
|
154 |
/**
|
155 |
+
* Changes test mode for the optin.
|
156 |
*
|
157 |
* @since 1.0.0
|
|
|
|
|
158 |
*/
|
159 |
+
public function test() {
|
160 |
|
161 |
+
$status = (bool) get_post_meta( $this->optin_id, '_omapi_test', true );
|
162 |
+
$new = $status ? false : true;
|
163 |
+
return update_post_meta( $this->optin_id, '_omapi_test', $new );
|
|
|
|
|
|
|
|
|
|
|
|
|
164 |
|
165 |
}
|
166 |
|
167 |
/**
|
168 |
+
* Clears the local cookies.
|
169 |
*
|
170 |
* @since 1.0.0
|
|
|
|
|
171 |
*/
|
172 |
+
public function cookies() {
|
173 |
+
|
174 |
+
$optins = $this->base->get_optins();
|
175 |
+
foreach ( (array) $optins as $optin ) {
|
176 |
+
if ( $optin ) {
|
177 |
+
// Array of ids so all splits are included
|
178 |
+
$ids = get_post_meta( $optin->ID, '_omapi_ids', true );
|
179 |
+
foreach ( (array) $ids as $id ) {
|
180 |
+
setcookie( 'om-' . $id, '', -1, COOKIEPATH, COOKIE_DOMAIN, false );
|
181 |
+
setcookie( 'om-success-' . $id, '', -1, COOKIEPATH, COOKIE_DOMAIN, false );
|
182 |
+
setcookie( 'om-second-' . $id, '', -1, COOKIEPATH, COOKIE_DOMAIN, false );
|
183 |
+
setcookie( 'om-' . $id . '-closed', '', -1, COOKIEPATH, COOKIE_DOMAIN, false );
|
184 |
+
}
|
185 |
+
}
|
186 |
+
}
|
187 |
+
|
188 |
+
// Clear out global cookie.
|
189 |
+
setcookie( 'om-global-cookie', '', -1, COOKIEPATH, COOKIE_DOMAIN, false );
|
190 |
+
// Clear out interaction cookie.
|
191 |
+
setcookie( 'om-interaction-cookie', '', -1, COOKIEPATH, COOKIE_DOMAIN, false );
|
192 |
+
// Clear out generic success cookie.
|
193 |
+
setcookie( 'om-success-cookie', '', -1, COOKIEPATH, COOKIE_DOMAIN, false );
|
194 |
|
195 |
+
return true;
|
196 |
|
197 |
}
|
198 |
|
210 |
|
211 |
switch ( $action ) {
|
212 |
case 'status' :
|
213 |
+
$notice = 'updated' == $type ? sprintf( __( 'The campaign status was updated successfully. You can configure more specific loading requirements by <a href="%s" title="Click here to edit the output settings for the updated campaign.">editing the output settings</a> for the campaign.', 'optin-monster-api' ), esc_url_raw( add_query_arg( array( 'page' => 'optin-monster-api-settings', 'optin_monster_api_view' => 'optins', 'optin_monster_api_action' => 'edit', 'optin_monster_api_id' => $this->optin_id ), admin_url( 'admin.php' ) ) ) ) : __( 'There was an error updating the campaign status. Please try again.', 'optin-monster-api' );
|
214 |
break;
|
215 |
case 'cookies' :
|
216 |
$notice = 'updated' == $type ? __( 'The local cookies have been cleared successfully.', 'optin-monster-api' ) : __( 'There was an error clearing the local cookies. Please try again.', 'optin-monster-api' );
|
217 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
218 |
}
|
219 |
|
220 |
return $notice;
|
221 |
}
|
222 |
|
223 |
+
/**
|
224 |
+
* Outputs any action notices.
|
225 |
+
*
|
226 |
+
* @since 1.0.0
|
227 |
+
*/
|
228 |
+
public function notices() {
|
229 |
|
230 |
+
// Check to see if any notices should be output based on query args.
|
231 |
+
$action = isset( $_GET['optin_monster_api_action_done'] ) ? strip_tags( stripslashes( $_GET['optin_monster_api_action_done' ] ) ) : false;
|
232 |
+
$type = isset( $_GET['optin_monster_api_action_type'] ) ? strip_tags( stripslashes( $_GET['optin_monster_api_action_type' ] ) ) : false;
|
233 |
|
234 |
+
// Maybe set the optin ID if it is available.
|
235 |
+
if ( isset( $_GET['optin_monster_api_action_id'] ) ) {
|
236 |
+
$this->optin_id = absint( $_GET['optin_monster_api_action_id'] );
|
237 |
+
}
|
238 |
|
239 |
+
if ( $action && $type ) {
|
240 |
+
$this->notices[ $type ] = $this->get_notice( $action, $type );
|
241 |
+
}
|
242 |
|
243 |
+
foreach ( $this->notices as $id => $message ) {
|
244 |
+
echo '<div class="' . $id . '"><p>' . $message . '</p></div>';
|
245 |
+
}
|
246 |
|
247 |
+
}
|
248 |
|
249 |
|
250 |
+
}
|
OMAPI/Ajax.php
CHANGED
@@ -291,13 +291,36 @@ class OMAPI_Ajax {
|
|
291 |
);
|
292 |
$data = apply_filters( 'optin_monster_pre_optin_mailpoet', $data, $_REQUEST, $list, null );
|
293 |
|
294 |
-
|
295 |
-
|
296 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
297 |
|
298 |
// Send back a response.
|
299 |
die( json_encode( true ) );
|
300 |
|
301 |
}
|
302 |
|
303 |
-
}
|
291 |
);
|
292 |
$data = apply_filters( 'optin_monster_pre_optin_mailpoet', $data, $_REQUEST, $list, null );
|
293 |
|
294 |
+
// Save the subscriber. Check for MailPoet 3 first. Default to legacy.
|
295 |
+
if ( class_exists( '\\MailPoet\\Config\\Initializer' ) ) {
|
296 |
+
// Customize the lead data for MailPoet 3.
|
297 |
+
if ( isset( $user['firstname'] ) ) {
|
298 |
+
$user['first_name'] = $user['firstname'];
|
299 |
+
unset( $user['firstname'] );
|
300 |
+
}
|
301 |
+
|
302 |
+
if ( isset( $user['lastname'] ) ) {
|
303 |
+
$user['last_name'] = $user['lastname'];
|
304 |
+
unset( $user['lastname'] );
|
305 |
+
}
|
306 |
+
|
307 |
+
if ( \MailPoet\Models\Subscriber::findOne( $user['email'] ) ) {
|
308 |
+
try {
|
309 |
+
\MailPoet\API\API::MP( 'v1' )->subscribeToList( $user['email'], $list );
|
310 |
+
} catch ( Exception $e ) {}
|
311 |
+
} else {
|
312 |
+
try {
|
313 |
+
\MailPoet\API\API::MP( 'v1' )->addSubscriber( $user, array( $list ) );
|
314 |
+
} catch ( Exception $e ) {}
|
315 |
+
}
|
316 |
+
} else {
|
317 |
+
$userHelper = WYSIJA::get( 'user', 'helper' );
|
318 |
+
$userHelper->addSubscriber( $data );
|
319 |
+
}
|
320 |
|
321 |
// Send back a response.
|
322 |
die( json_encode( true ) );
|
323 |
|
324 |
}
|
325 |
|
326 |
+
}
|
OMAPI/Content.php
CHANGED
@@ -10,31 +10,31 @@
|
|
10 |
class OMAPI_Content {
|
11 |
|
12 |
/**
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
|
21 |
/**
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
/**
|
31 |
-
* Holds the base class object.
|
32 |
-
*
|
33 |
-
* @since 1.0.0
|
34 |
-
*
|
35 |
-
* @var object
|
36 |
-
*/
|
37 |
-
public $base;
|
38 |
|
39 |
/**
|
40 |
* The current view slug
|
@@ -46,139 +46,139 @@ class OMAPI_Content {
|
|
46 |
protected $view;
|
47 |
|
48 |
/**
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
|
55 |
-
|
56 |
-
|
57 |
|
58 |
// Load actions and filters.
|
59 |
add_action( 'optin_monster_api_content_before', array( $this, 'form_start' ), 0, 2 );
|
60 |
add_action( 'optin_monster_api_content_after', array( $this, 'form_end' ), 9999 );
|
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 |
<?php printf( __( 'Output Settings for %s', 'optin-monster-api' ), esc_html( $this->optin->post_title ) ); ?>
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
</h3>
|
114 |
-
|
115 |
-
|
116 |
|
117 |
// Action to load success/reset messages.
|
118 |
do_action( 'optin_monster_api_messages_' . $id );
|
119 |
|
120 |
-
|
121 |
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
|
129 |
// Load different form buttons based on if credentials have been supplied or not.
|
130 |
if ( ! $this->base->get_api_credentials() && 'support' !== $this->view ) :
|
131 |
?>
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
elseif ( 'optins' == $this->view ) :
|
138 |
if ( isset( $_GET['optin_monster_api_action'] ) && 'edit' == $_GET['optin_monster_api_action'] ) :
|
139 |
?>
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
else :
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
endif;
|
154 |
elseif ( 'migrate' == $this->view ) :
|
155 |
?>
|
156 |
-
|
157 |
-
|
158 |
elseif ( 'support' == $this->view ) :
|
159 |
|
160 |
//you get nothing
|
161 |
|
162 |
else :
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
endif;
|
170 |
|
171 |
-
|
172 |
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
|
183 |
$link = $this->base->menu->get_action_link();
|
184 |
$text = $this->base->menu->has_trial_link() ? 'Click here to start your free 30-day trial!' : 'Click here to view OptinMonster plans and pricing.';
|
@@ -190,89 +190,89 @@ class OMAPI_Content {
|
|
190 |
<p><em><?php printf( __( 'Need an OptinMonster account? <a href="%s" title="Click here to view OptinMonster plans and pricing" target="_blank">%s</a>', 'optin-monster-api' ), $link, $text ); ?></em></p>
|
191 |
<?php endif; ?>
|
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 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
|
277 |
public function support( $panel, $object ) {
|
278 |
|
@@ -282,18 +282,18 @@ class OMAPI_Content {
|
|
282 |
|
283 |
}
|
284 |
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
echo $object->get_setting_ui( 'optins', 'enabled' );
|
298 |
|
299 |
if ( 'sidebar' !== $type ) {
|
@@ -306,100 +306,96 @@ class OMAPI_Content {
|
|
306 |
echo $object->get_setting_ui( 'optins', 'users' );
|
307 |
}
|
308 |
|
309 |
-
|
310 |
-
|
311 |
|
312 |
// Add support for MailPoet if the plugin is active.
|
313 |
-
if (
|
314 |
echo $object->get_setting_ui( 'optins', 'mailpoet' );
|
315 |
echo $object->get_setting_ui( 'optins', 'mailpoet_list' );
|
316 |
}
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
|
379 |
$optin = get_post( $optin_id );
|
380 |
$slug = $optin->post_name;
|
381 |
$status = (bool) get_post_meta( $optin_id, '_omapi_enabled', true );
|
382 |
$status_link = $status ? __( 'Disable', 'optin-monster-api' ) : __( 'Go Live', 'optin-monster-api' );
|
383 |
-
$status_desc = $status ? esc_attr__( 'Disable this
|
384 |
$links = array();
|
385 |
-
$links['editd'] = '<a href="' . esc_url_raw( 'https://app.optinmonster.com/campaigns/' . $slug . '/edit/' ) . '" title="' . esc_attr__( 'Edit this
|
386 |
-
$links['edito'] = '<a href="' . esc_url_raw( add_query_arg( array( 'optin_monster_api_view' => $this->view, 'optin_monster_api_action' => 'edit', 'optin_monster_api_id' => $optin_id ), admin_url( 'admin.php?page=optin-monster-api-settings' ) ) ) . '" title="' . esc_attr__( 'Edit the output settings for this
|
387 |
$links['status'] = '<a href="' . wp_nonce_url( esc_url_raw( add_query_arg( array( 'optin_monster_api_view' => $this->view, 'optin_monster_api_action' => 'status', 'optin_monster_api_id' => $optin_id ), admin_url( 'admin.php?page=optin-monster-api-settings' ) ) ), 'omapi-action' ) . '" title="' . $status_desc . '">' . $status_link . '</a>';
|
388 |
|
389 |
-
|
390 |
-
|
391 |
|
392 |
-
|
393 |
|
394 |
public function migrate() {
|
395 |
-
|
396 |
-
|
397 |
?>
|
398 |
<p><?php _e( 'Your campaigns created within WordPress using the original OptinMonster plugin can be recreated manually in your OptinMonster account.', 'optin-monster-api' ); ?></p>
|
399 |
-
|
400 |
-
<p><a href="http://optinmonster.com/docs/old-wordpress-customers-migrating-to-the-new-optinmonster-app/"><?php __e( 'Read the full post about the changes.')?></a></p>
|
401 |
-
|
402 |
<?php
|
403 |
}
|
404 |
|
405 |
-
}
|
10 |
class OMAPI_Content {
|
11 |
|
12 |
/**
|
13 |
+
* Holds the class object.
|
14 |
+
*
|
15 |
+
* @since 1.0.0
|
16 |
+
*
|
17 |
+
* @var object
|
18 |
+
*/
|
19 |
+
public static $instance;
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Path to the file.
|
23 |
+
*
|
24 |
+
* @since 1.0.0
|
25 |
+
*
|
26 |
+
* @var string
|
27 |
+
*/
|
28 |
+
public $file = __FILE__;
|
29 |
|
30 |
/**
|
31 |
+
* Holds the base class object.
|
32 |
+
*
|
33 |
+
* @since 1.0.0
|
34 |
+
*
|
35 |
+
* @var object
|
36 |
+
*/
|
37 |
+
public $base;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
|
39 |
/**
|
40 |
* The current view slug
|
46 |
protected $view;
|
47 |
|
48 |
/**
|
49 |
+
* Primary class constructor.
|
50 |
+
*
|
51 |
+
* @since 1.0.0
|
52 |
+
*/
|
53 |
+
public function __construct() {
|
54 |
|
55 |
+
// Set our object.
|
56 |
+
$this->set();
|
57 |
|
58 |
// Load actions and filters.
|
59 |
add_action( 'optin_monster_api_content_before', array( $this, 'form_start' ), 0, 2 );
|
60 |
add_action( 'optin_monster_api_content_after', array( $this, 'form_end' ), 9999 );
|
61 |
+
add_action( 'optin_monster_api_content_api', array( $this, 'api' ), 10, 2 );
|
62 |
+
add_action( 'optin_monster_api_content_optins', array( $this, 'optins' ), 10, 2 );
|
63 |
+
add_action( 'optin_monster_api_content_settings', array( $this, 'settings' ), 10, 2 );
|
64 |
+
add_action( 'optin_monster_api_content_support', array( $this, 'support' ), 10, 2 );
|
65 |
+
add_action( 'optin_monster_api_content_migrate', array( $this, 'migrate' ), 10, 2 );
|
66 |
+
|
67 |
+
}
|
68 |
+
|
69 |
+
/**
|
70 |
+
* Sets our object instance and base class instance.
|
71 |
+
*
|
72 |
+
* @since 1.0.0
|
73 |
+
*/
|
74 |
+
public function set() {
|
75 |
+
|
76 |
+
self::$instance = $this;
|
77 |
+
$this->base = OMAPI::get_instance();
|
78 |
+
$this->view = isset( $_GET['optin_monster_api_view'] ) ? stripslashes( $_GET['optin_monster_api_view'] ) : $this->base->get_view();
|
79 |
+
$this->optin = isset( $_GET['optin_monster_api_id'] ) ? $this->base->get_optin( absint( $_GET['optin_monster_api_id'] ) ) : false;
|
80 |
+
|
81 |
+
}
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Loads the starting form HTML for the panel content.
|
85 |
+
*
|
86 |
+
* @since 1.0.0
|
87 |
+
*
|
88 |
+
* @param string $id The panel ID we are targeting.
|
89 |
+
* @param string $panel The panel name we are targeting.
|
90 |
+
*/
|
91 |
+
public function form_start( $id, $panel ) {
|
92 |
+
|
93 |
+
if ( $this->view == 'support' ) :
|
94 |
+
?>
|
95 |
+
<h3><?php echo esc_html( $panel ); ?></h3>
|
96 |
+
<?php
|
97 |
+
else:
|
98 |
+
?>
|
99 |
+
<form id="omapi-form-<?php echo sanitize_html_class( $id ); ?>" class="omapi-form" method="post" action="<?php echo esc_attr( stripslashes( $_SERVER['REQUEST_URI'] ) ); ?>">
|
100 |
+
<?php wp_nonce_field( 'omapi_nonce_' . $id, 'omapi_nonce_' . $id ); ?>
|
101 |
+
<input type="hidden" name="omapi_panel" value="<?php echo $id; ?>" />
|
102 |
+
<input type="hidden" name="omapi_save" value="true" />
|
103 |
+
<?php if ( 'settings' == $this->view ) : ?>
|
104 |
+
<input type="hidden" name="omapi[<?php echo esc_attr( $this->view ); ?>][wpform]" value="true" />
|
105 |
+
<?php endif; ?>
|
106 |
+
<h3>
|
107 |
+
<?php if ( isset( $_GET['optin_monster_api_action'] ) && 'edit' == $_GET['optin_monster_api_action'] ) : ?>
|
108 |
<?php printf( __( 'Output Settings for %s', 'optin-monster-api' ), esc_html( $this->optin->post_title ) ); ?>
|
109 |
+
<span class="omapi-back"><a class="button button-secondary button-small" href="<?php echo esc_url_raw( add_query_arg( array( 'optin_monster_api_view' => 'optins' ), admin_url( 'admin.php?page=optin-monster-api-settings' ) ) ); ?>" title="<?php esc_attr_e( 'Back to campaign overview', 'optin-monster-api' ); ?>"><?php _e( 'Back to Overview', 'optin-monster-api' ); ?></a></span>
|
110 |
+
<?php else : ?>
|
111 |
+
<?php echo esc_html( $panel ); ?>
|
112 |
+
<?php endif; ?>
|
113 |
</h3>
|
114 |
+
<?php
|
115 |
+
endif;
|
116 |
|
117 |
// Action to load success/reset messages.
|
118 |
do_action( 'optin_monster_api_messages_' . $id );
|
119 |
|
120 |
+
}
|
121 |
|
122 |
+
/**
|
123 |
+
* Loads the ending form HTML for the panel content.
|
124 |
+
*
|
125 |
+
* @since 1.0.0
|
126 |
+
*/
|
127 |
+
public function form_end() {
|
128 |
|
129 |
// Load different form buttons based on if credentials have been supplied or not.
|
130 |
if ( ! $this->base->get_api_credentials() && 'support' !== $this->view ) :
|
131 |
?>
|
132 |
+
<p class="submit">
|
133 |
+
<input class="button button-primary" type="submit" name="omapi_submit" value="<?php esc_attr_e( 'Connect to OptinMonster', 'optin-monster-api' ); ?>" tabindex="749" />
|
134 |
+
</p>
|
135 |
+
</form>
|
136 |
+
<?php
|
137 |
elseif ( 'optins' == $this->view ) :
|
138 |
if ( isset( $_GET['optin_monster_api_action'] ) && 'edit' == $_GET['optin_monster_api_action'] ) :
|
139 |
?>
|
140 |
+
<p class="submit">
|
141 |
+
<input class="button button-primary" type="submit" name="submit" value="<?php esc_attr_e( 'Save Settings', 'optin-monster-api' ); ?>" tabindex="749" />
|
142 |
+
</p>
|
143 |
+
</form>
|
144 |
+
<?php
|
145 |
else :
|
146 |
+
?>
|
147 |
+
<p class="submit">
|
148 |
+
<input class="button button-primary" type="submit" name="omapi_refresh" value="<?php esc_attr_e( 'Refresh Campaigns', 'optin-monster-api' ); ?>" tabindex="749" />
|
149 |
+
<a class="button button-secondary" href="<?php echo wp_nonce_url( esc_url_raw( add_query_arg( array( 'optin_monster_api_view' => $this->view, 'optin_monster_api_action' => 'cookies' ), admin_url( 'admin.php?page=optin-monster-api-settings' ) ) ), 'omapi-action' ); ?>" title="<?php esc_attr_e( 'Clear Local Cookies', 'optin-monster-api' ); ?>"><?php _e( 'Clear Local Cookies', 'optin-monster-api' ); ?></a>
|
150 |
+
</p>
|
151 |
+
</form>
|
152 |
+
<?php
|
153 |
endif;
|
154 |
elseif ( 'migrate' == $this->view ) :
|
155 |
?>
|
156 |
+
</form>
|
157 |
+
<?php
|
158 |
elseif ( 'support' == $this->view ) :
|
159 |
|
160 |
//you get nothing
|
161 |
|
162 |
else :
|
163 |
+
?>
|
164 |
+
<p class="submit">
|
165 |
+
<input class="button button-primary" type="submit" name="submit" value="<?php esc_attr_e( 'Save Settings', 'optin-monster-api' ); ?>" tabindex="749" />
|
166 |
+
</p>
|
167 |
+
</form>
|
168 |
+
<?php
|
169 |
endif;
|
170 |
|
171 |
+
}
|
172 |
|
173 |
+
/**
|
174 |
+
* Loads the content output for the API panel.
|
175 |
+
*
|
176 |
+
* @since 1.0.0
|
177 |
+
*
|
178 |
+
* @param string $panel The panel name we are targeting.
|
179 |
+
* @param object $object The menu object (useful for settings helpers).
|
180 |
+
*/
|
181 |
+
public function api( $panel, $object ) {
|
182 |
|
183 |
$link = $this->base->menu->get_action_link();
|
184 |
$text = $this->base->menu->has_trial_link() ? 'Click here to start your free 30-day trial!' : 'Click here to view OptinMonster plans and pricing.';
|
190 |
<p><em><?php printf( __( 'Need an OptinMonster account? <a href="%s" title="Click here to view OptinMonster plans and pricing" target="_blank">%s</a>', 'optin-monster-api' ), $link, $text ); ?></em></p>
|
191 |
<?php endif; ?>
|
192 |
|
193 |
+
<?php echo $object->get_setting_ui( 'api', 'apikey' ); ?>
|
194 |
+
|
195 |
+
<?php // If we have credentials only show the old stuff if it is saved ?>
|
196 |
+
<?php if ( $credentials ) : ?>
|
197 |
+
<?php if ( isset( $credentials['api'] ) && '' != $credentials['api'] || isset( $credentials['key'] ) && '' != $credentials['key'] ) : ?>
|
198 |
+
<p>The Legacy API Username and Key below will be deprecated soon. Please <a href="https://app.optinmonster.com/account/api/" target="_blank">generate a new API key</a> and paste it above to authenticate using our new and improved REST API.</p>
|
199 |
+
<?php echo $object->get_setting_ui( 'api', 'user' ); ?>
|
200 |
+
<?php echo $object->get_setting_ui( 'api', 'key' ); ?>
|
201 |
+
<?php endif; ?>
|
202 |
+
<?php endif; ?>
|
203 |
+
|
204 |
+
<?php
|
205 |
+
|
206 |
+
}
|
207 |
+
|
208 |
+
/**
|
209 |
+
* Loads the content output for the Database panel.
|
210 |
+
*
|
211 |
+
* @since 1.0.0
|
212 |
+
*
|
213 |
+
* @param string $panel The panel name we are targeting.
|
214 |
+
* @param object $object The menu object (useful for settings helpers).
|
215 |
+
*/
|
216 |
+
public function optins( $panel, $object ) {
|
217 |
+
|
218 |
+
$optin_view = isset( $_GET['optin_monster_api_action'] ) && 'edit' == $_GET['optin_monster_api_action'] ? 'edit' : 'overview';
|
219 |
+
if ( 'edit' == $optin_view ) {
|
220 |
+
$this->optin_edit( $object );
|
221 |
+
} else {
|
222 |
+
$this->optin_overview( $object );
|
223 |
+
}
|
224 |
+
|
225 |
+
}
|
226 |
+
|
227 |
+
/**
|
228 |
+
* Shows the optins loaded on the site.
|
229 |
+
*
|
230 |
+
* @since 1.0.0
|
231 |
+
*
|
232 |
+
* @param object $object The menu object (useful for settings helpers).
|
233 |
+
*/
|
234 |
+
public function optin_overview( $object ) {
|
235 |
+
|
236 |
+
$optins = $this->base->get_optins();
|
237 |
+
$i = 0;
|
238 |
+
if ( $optins ) :
|
239 |
+
?>
|
240 |
+
<?php foreach ( $optins as $optin ) : $class = 0 == $i ? ' omapi-optin-first' : '';
|
241 |
+
if ( (bool) get_post_meta( $optin->ID, '_omapi_enabled', true ) ) {
|
242 |
+
$status = '<span class="omapi-green">' . __( 'Live', 'optin-monster-api' ) . '</span>';
|
243 |
+
$status_tooltip = __('This campaign is embedded on your site based on your output settings and will load subject to the display rules configured in the campaign builder.', 'optin-monster-api');
|
244 |
+
} else {
|
245 |
+
$status = '<span class="omapi-red">' . __( 'Disabled', 'optin-monster-api' ) . '</span>';
|
246 |
+
$status_tooltip = __('This campaign is not embedded by the plugin anywhere on this site.', 'optin-monster-api');
|
247 |
+
}
|
248 |
+
?>
|
249 |
+
<p class="omapi-optin<?php echo $class; ?>">
|
250 |
+
<a href="<?php echo esc_url_raw( add_query_arg( array( 'optin_monster_api_view' => $this->view, 'optin_monster_api_action' => 'edit', 'optin_monster_api_id' => $optin->ID ), admin_url( 'admin.php?page=optin-monster-api-settings' ) ) ); ?>" title="<?php printf( esc_attr__( 'Manage output settings for %s', 'optin-monster-api' ), $optin->post_title ); ?>"><?php echo $optin->post_title; ?></a>
|
251 |
+
<span class="omapi-status omapi-has-tooltip" data-toggle="tooltip" data-placement="bottom" title="<?php echo $status_tooltip; ?>"><?php echo $status; ?></span><br>
|
252 |
+
<span class="omapi-slug omapi-has-tooltip" data-toggle="tooltip" data-placement="bottom" title="<?php _e('The unique slug of this campaign. Used for shortcodes and embed scripts.', 'optin-monster-api'); ?>"><?php echo $optin->post_name; ?></span>
|
253 |
+
<span class="omapi-links"><?php echo $this->get_optin_links( $optin->ID ); ?></span>
|
254 |
+
</p>
|
255 |
+
<?php $i++; endforeach; ?>
|
256 |
+
<?php else : ?>
|
257 |
+
<p><strong><?php _e( 'No campaigns could be retrieved for this site.', 'optin-monster-api' ); ?></strong></p>
|
258 |
+
<?php
|
259 |
+
endif;
|
260 |
+
|
261 |
+
}
|
262 |
+
|
263 |
+
/**
|
264 |
+
* Loads the content output for the Support panel.
|
265 |
+
*
|
266 |
+
* @since 1.0.0
|
267 |
+
*
|
268 |
+
* @param string $panel The panel name we are targeting.
|
269 |
+
* @param object $object The menu object (useful for settings helpers).
|
270 |
+
*/
|
271 |
+
public function settings( $panel, $object ) {
|
272 |
+
|
273 |
+
echo $object->get_setting_ui( 'settings', 'cookies' );
|
274 |
+
|
275 |
+
}
|
276 |
|
277 |
public function support( $panel, $object ) {
|
278 |
|
282 |
|
283 |
}
|
284 |
|
285 |
+
/**
|
286 |
+
* Shows the editing interface for optins.
|
287 |
+
*
|
288 |
+
* @since 1.0.0
|
289 |
+
*
|
290 |
+
* @param object $object The menu object (useful for settings helpers).
|
291 |
+
*/
|
292 |
+
public function optin_edit( $object ) {
|
293 |
+
|
294 |
+
//Check for existing optins
|
295 |
+
if ( $this->optin ) {
|
296 |
+
$type = get_post_meta( $this->optin->ID, '_omapi_type', true );
|
297 |
echo $object->get_setting_ui( 'optins', 'enabled' );
|
298 |
|
299 |
if ( 'sidebar' !== $type ) {
|
306 |
echo $object->get_setting_ui( 'optins', 'users' );
|
307 |
}
|
308 |
|
309 |
+
echo $object->get_setting_ui( 'optins', 'shortcode' );
|
310 |
+
echo $object->get_setting_ui( 'optins', 'shortcode_output' );
|
311 |
|
312 |
// Add support for MailPoet if the plugin is active.
|
313 |
+
if ( $this->base->is_mailpoet_active() ) {
|
314 |
echo $object->get_setting_ui( 'optins', 'mailpoet' );
|
315 |
echo $object->get_setting_ui( 'optins', 'mailpoet_list' );
|
316 |
}
|
317 |
+
if ( 'sidebar' !== $type ) {
|
318 |
+
|
319 |
+
// Add WooCommerce Toggle
|
320 |
+
if ( $this->base->is_woocommerce_active() ) {
|
321 |
+
echo $object->get_setting_ui( 'toggle', 'woocommerce-start');
|
322 |
+
|
323 |
+
echo $object->get_setting_ui( 'optins', 'show_on_woocommerce');
|
324 |
+
// Don't show if output can't use the_content filter
|
325 |
+
if ( 'post' !== $type ) {
|
326 |
+
echo $object->get_setting_ui( 'optins', 'is_wc_shop' );
|
327 |
+
}
|
328 |
+
echo $object->get_setting_ui( 'optins', 'is_wc_product');
|
329 |
+
echo $object->get_setting_ui( 'optins', 'is_wc_cart');
|
330 |
+
echo $object->get_setting_ui( 'optins', 'is_wc_checkout');
|
331 |
+
echo $object->get_setting_ui( 'optins', 'is_wc_account');
|
332 |
+
echo $object->get_setting_ui( 'optins', 'is_wc_endpoint');
|
333 |
+
echo $object->get_setting_ui( 'optins', 'is_wc_endpoint_order_pay');
|
334 |
+
echo $object->get_setting_ui( 'optins', 'is_wc_endpoint_order_received');
|
335 |
+
echo $object->get_setting_ui( 'optins', 'is_wc_endpoint_view_order');
|
336 |
+
echo $object->get_setting_ui( 'optins', 'is_wc_endpoint_edit_account');
|
337 |
+
echo $object->get_setting_ui( 'optins', 'is_wc_endpoint_edit_address');
|
338 |
+
echo $object->get_setting_ui( 'optins', 'is_wc_endpoint_lost_password');
|
339 |
+
echo $object->get_setting_ui( 'optins', 'is_wc_endpoint_customer_logout');
|
340 |
+
echo $object->get_setting_ui( 'optins', 'is_wc_endpoint_add_payment_method');
|
341 |
+
echo $object->get_setting_ui( 'optins', 'is_wc_product_category' );
|
342 |
+
echo $object->get_setting_ui( 'optins', 'is_wc_product_tag' );
|
343 |
+
echo $object->get_setting_ui( 'toggle', 'woocommerce-end');
|
344 |
+
}
|
345 |
+
|
346 |
+
|
347 |
+
// Advanced Settings
|
348 |
+
echo $object->get_setting_ui( 'toggle', 'advanced-start' );
|
349 |
+
echo $object->get_setting_ui( 'optins', 'never' );
|
350 |
+
echo $object->get_setting_ui( 'optins', 'only' );
|
351 |
+
echo $object->get_setting_ui( 'optins', 'categories' );
|
352 |
+
echo $object->get_setting_ui( 'optins', 'taxonomies' );
|
353 |
+
echo $object->get_setting_ui( 'optins', 'show' );
|
354 |
+
echo $object->get_setting_ui( 'toggle', 'advanced-end' );
|
355 |
+
}
|
356 |
+
|
357 |
+
if ('sidebar' == $type ) {
|
358 |
+
echo $object->get_setting_ui('note', 'sidebar_widget_notice');
|
359 |
+
}
|
360 |
+
|
361 |
+
} else {
|
362 |
+
?>
|
363 |
+
<p><strong><?php _e( 'No campaign could be retrieved for the ID specified.', 'optin-monster-api' ); ?></strong></p>
|
364 |
+
<?php
|
365 |
+
}
|
366 |
+
|
367 |
+
}
|
368 |
+
|
369 |
+
/**
|
370 |
+
* Returns the action links for the optin.
|
371 |
+
*
|
372 |
+
* @since 1.0.0
|
373 |
+
*
|
374 |
+
* @param int $optin_id The optin ID to target.
|
375 |
+
* @return string $links HTML string of action links.
|
376 |
+
*/
|
377 |
+
public function get_optin_links( $optin_id ) {
|
378 |
|
379 |
$optin = get_post( $optin_id );
|
380 |
$slug = $optin->post_name;
|
381 |
$status = (bool) get_post_meta( $optin_id, '_omapi_enabled', true );
|
382 |
$status_link = $status ? __( 'Disable', 'optin-monster-api' ) : __( 'Go Live', 'optin-monster-api' );
|
383 |
+
$status_desc = $status ? esc_attr__( 'Disable this campaign', 'optin-monster-api' ) : esc_attr__( 'Go live with this campaign', 'optin-monster-api' );
|
384 |
$links = array();
|
385 |
+
$links['editd'] = '<a href="' . esc_url_raw( 'https://app.optinmonster.com/campaigns/' . $slug . '/edit/' ) . '" title="' . esc_attr__( 'Edit this campaign on the OptinMonster App', 'optin-monster-api' ) . '" target="_blank">Edit Design</a>';
|
386 |
+
$links['edito'] = '<a href="' . esc_url_raw( add_query_arg( array( 'optin_monster_api_view' => $this->view, 'optin_monster_api_action' => 'edit', 'optin_monster_api_id' => $optin_id ), admin_url( 'admin.php?page=optin-monster-api-settings' ) ) ) . '" title="' . esc_attr__( 'Edit the output settings for this campaign', 'optin-monster-api' ) . '">Edit Output Settings</a>';
|
387 |
$links['status'] = '<a href="' . wp_nonce_url( esc_url_raw( add_query_arg( array( 'optin_monster_api_view' => $this->view, 'optin_monster_api_action' => 'status', 'optin_monster_api_id' => $optin_id ), admin_url( 'admin.php?page=optin-monster-api-settings' ) ) ), 'omapi-action' ) . '" title="' . $status_desc . '">' . $status_link . '</a>';
|
388 |
|
389 |
+
$links = apply_filters( 'optin_monster_api_action_links', $links, $optin_id );
|
390 |
+
return implode( ' | ', (array) $links );
|
391 |
|
392 |
+
}
|
393 |
|
394 |
public function migrate() {
|
|
|
|
|
395 |
?>
|
396 |
<p><?php _e( 'Your campaigns created within WordPress using the original OptinMonster plugin can be recreated manually in your OptinMonster account.', 'optin-monster-api' ); ?></p>
|
397 |
+
<p><a href="http://optinmonster.com/docs/old-wordpress-customers-migrating-to-the-new-optinmonster-app/"><?php _e( 'Read the full post about the changes.')?></a></p>
|
|
|
|
|
398 |
<?php
|
399 |
}
|
400 |
|
401 |
+
}
|
OMAPI/Menu.php
CHANGED
@@ -10,49 +10,49 @@
|
|
10 |
class OMAPI_Menu {
|
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 |
* Primary class constructor.
|
@@ -61,73 +61,73 @@ class OMAPI_Menu {
|
|
61 |
*
|
62 |
* @param bool $isTesting
|
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 |
-
// Load global icon font styles.
|
110 |
-
add_action( 'admin_head', array( $this, 'icon' ) );
|
111 |
-
|
112 |
-
// Load settings page assets.
|
113 |
-
if ( $this->hook ) {
|
114 |
-
add_action( 'load-' . $this->hook, array( $this, 'assets' ) );
|
115 |
-
}
|
116 |
|
117 |
-
|
|
|
118 |
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
*/
|
124 |
-
public function icon() {
|
125 |
|
126 |
-
|
127 |
-
<style type="text/css">@font-face{font-family: 'archie';src:url('<?php echo plugins_url( '/assets/fonts/archie.eot?velzrt', OMAPI_FILE ); ?>');src:url('<?php echo plugins_url( '/assets/fonts/archie.eot?#iefixvelzrt', OMAPI_FILE ); ?>') format('embedded-opentype'),url('<?php echo plugins_url( '/assets/fonts/archie.woff?velzrt', OMAPI_FILE ); ?>') format('woff'),url('<?php echo plugins_url( '/assets/fonts/archie.ttf?velzrt', OMAPI_FILE ); ?>') format('truetype'),url('<?php echo plugins_url( '/assets/fonts/archie.svg?velzrt#archie', OMAPI_FILE ); ?>') format('svg');font-weight: normal;font-style: normal;}#toplevel_page_optin-monster-api-settings .dashicons-before,#toplevel_page_optin-monster-api-settings .dashicons-before:before,#toplevel_page_optin-monster-api-welcome .dashicons-before,#toplevel_page_optin-monster-api-welcome .dashicons-before:before{font-family: 'archie';speak: none;font-style: normal;font-weight: normal;font-variant: normal;text-transform: none;line-height: 1;-webkit-font-smoothing: antialiased;-moz-osx-font-smoothing: grayscale;}#toplevel_page_optin-monster-api-settings .dashicons-before:before,#toplevel_page_optin-monster-api-welcome .dashicons-before:before{content: "\e600";font-size: 38px;margin-top: -9px;margin-left: -8px;}</style>
|
128 |
-
<?php
|
129 |
|
130 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
131 |
|
132 |
public function admin_body_classes( $classes ) {
|
133 |
|
@@ -141,71 +141,71 @@ class OMAPI_Menu {
|
|
141 |
|
142 |
}
|
143 |
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
add_action( 'admin_enqueue_scripts', array( $this, 'fix_plugin_js_conflicts'), 100 );
|
156 |
|
157 |
-
|
158 |
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
|
166 |
wp_register_style( $this->base->plugin_slug . '-select2', plugins_url( '/assets/css/select2.min.css', OMAPI_FILE ), array(), $this->base->version );
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
|
171 |
-
|
172 |
-
|
173 |
|
174 |
-
|
175 |
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
|
183 |
wp_register_script( $this->base->plugin_slug . '-select2', plugins_url( '/assets/js/select2.min.js', OMAPI_FILE ), array( 'jquery' ), $this->base->version, true );
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
'ajax' => admin_url( 'admin-ajax.php' ),
|
198 |
'nonce' => wp_create_nonce( 'omapi-query-nonce' ),
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
)
|
203 |
-
|
204 |
|
205 |
-
|
206 |
-
|
207 |
|
208 |
-
|
209 |
|
210 |
/**
|
211 |
* Deque specific scripts that cause conflicts on settings page
|
@@ -267,7 +267,7 @@ class OMAPI_Menu {
|
|
267 |
$slug = $optin->post_name;
|
268 |
$design_type = get_post_meta( $optin->ID, '_omapi_type', true );
|
269 |
$optin_data[ $slug ] = array(
|
270 |
-
'
|
271 |
'WordPress ID' => $optin->ID,
|
272 |
'Associated IDs' => get_post_meta( $optin->ID, '_omapi_ids', true ),
|
273 |
'Current Status' => get_post_meta( $optin->ID, '_omapi_enabled', true ) ? 'Live' : 'Disabled',
|
@@ -280,7 +280,7 @@ class OMAPI_Menu {
|
|
280 |
'Shortcodes Synced and Recognized' => get_post_meta( $optin->ID, '_omapi_shortcode', true ) ? htmlspecialchars_decode( get_post_meta( $optin->ID, '_omapi_shortcode_output', true ) ) : 'None recognized',
|
281 |
);
|
282 |
if ( 'post' == $design_type ) {
|
283 |
-
|
284 |
}
|
285 |
|
286 |
}
|
@@ -331,82 +331,82 @@ class OMAPI_Menu {
|
|
331 |
return $array;
|
332 |
}
|
333 |
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
|
344 |
-
|
345 |
$text = sprintf( __( 'Please rate <strong>OptinMonster</strong> <a href="%s" target="_blank" rel="noopener">★★★★★</a> on <a href="%s" target="_blank">WordPress.org</a> to help us spread the word. Thank you from the OptinMonster team!', 'optin-monster-api' ), $url, $url );
|
346 |
return $text;
|
347 |
|
348 |
-
|
349 |
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
|
390 |
-
|
391 |
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
|
401 |
// Only load the API panel if no API credentials have been set.
|
402 |
$panels = array();
|
403 |
$creds = $this->base->get_api_credentials();
|
404 |
-
|
405 |
-
|
406 |
|
407 |
// Set panels requiring credentials.
|
408 |
if ( $creds ) {
|
409 |
-
$panels['optins'] = __( '
|
410 |
}
|
411 |
|
412 |
// Set default panels.
|
@@ -415,78 +415,78 @@ class OMAPI_Menu {
|
|
415 |
// Set the settings panel.
|
416 |
//$panels['settings'] = __( 'Settings', 'optin-monster-api' );
|
417 |
|
418 |
-
|
419 |
-
|
420 |
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
|
426 |
return apply_filters( 'optin_monster_api_panels', $panels );
|
427 |
|
428 |
-
|
429 |
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
// Prepare variables.
|
442 |
-
$ret = '';
|
443 |
-
$optin_id = isset( $_GET['optin_monster_api_id'] ) ? absint( $_GET['optin_monster_api_id'] ) : 0;
|
444 |
-
$value = 'optins' == $id ? get_post_meta( $optin_id, '_omapi_' . $setting, true ) : $this->base->get_option( $id, $setting );
|
445 |
-
$optin = get_post( $optin_id);
|
446 |
-
|
447 |
-
// Load the type of setting UI based on the option.
|
448 |
-
switch ( $id ) {
|
449 |
-
case 'api' :
|
450 |
-
switch ( $setting ) {
|
451 |
-
case 'user' :
|
452 |
-
$ret = $this->get_password_field( $setting, $value, $id, __( 'Legacy API Username', 'optin-monster-api' ), __( 'The Legacy API Username found in your OptinMonster Account API area.', 'optin-monster-api' ), __( 'Enter your Legacy API Username here...', 'optin-monster-api' ) );
|
453 |
-
break 2;
|
454 |
|
455 |
-
|
456 |
-
|
457 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
458 |
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
}
|
463 |
break;
|
464 |
|
465 |
case 'settings' :
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
}
|
471 |
break;
|
472 |
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
|
489 |
-
|
490 |
switch ( $setting ) {
|
491 |
case 'advanced-start' :
|
492 |
$ret = $this->get_toggle_start( $setting, __( 'Advanced Settings', 'optin-monster-api'), __('More specific settings available for campaign visibility.', 'optin-monster-api') );
|
@@ -494,274 +494,274 @@ class OMAPI_Menu {
|
|
494 |
case 'advanced-end' :
|
495 |
$ret = $this->get_toggle_end();
|
496 |
break 2;
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
}
|
504 |
-
|
505 |
|
506 |
-
|
507 |
-
|
508 |
case 'enabled' :
|
509 |
-
$ret = $this->get_checkbox_field( $setting, $value, $id, __( 'Enable
|
510 |
break 2;
|
511 |
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
$full_shortcode ='[optin-monster-shortcode id="'. $optin->post_name .'"]';
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
|
715 |
-
|
716 |
-
|
717 |
-
|
718 |
-
|
719 |
-
|
720 |
-
|
721 |
-
|
722 |
-
|
723 |
-
|
724 |
-
|
725 |
-
|
726 |
-
|
727 |
-
|
728 |
-
|
729 |
-
|
730 |
-
|
731 |
-
|
732 |
-
|
733 |
-
|
734 |
-
|
735 |
-
|
736 |
|
737 |
// Return the setting output.
|
738 |
-
|
739 |
|
740 |
-
|
741 |
|
742 |
-
|
743 |
-
|
744 |
-
|
745 |
-
|
746 |
-
|
747 |
-
|
748 |
-
|
749 |
-
|
750 |
-
|
751 |
-
|
752 |
-
|
753 |
-
|
754 |
-
|
755 |
-
|
756 |
-
|
757 |
-
|
758 |
-
|
759 |
-
|
760 |
-
|
761 |
-
|
762 |
-
|
763 |
-
|
764 |
-
|
765 |
)
|
766 |
);
|
767 |
|
@@ -776,10 +776,20 @@ class OMAPI_Menu {
|
|
776 |
*/
|
777 |
public function get_mailpoet_lists() {
|
778 |
|
779 |
-
|
780 |
-
|
781 |
-
|
782 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
783 |
|
784 |
// Add default option.
|
785 |
$ret[] = array(
|
@@ -791,11 +801,19 @@ class OMAPI_Menu {
|
|
791 |
foreach ( (array) $lists as $list ) {
|
792 |
$ret[] = array(
|
793 |
'name' => $list['name'],
|
794 |
-
'value' => $list[
|
795 |
);
|
796 |
}
|
797 |
|
798 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
799 |
|
800 |
}
|
801 |
|
@@ -871,196 +889,196 @@ class OMAPI_Menu {
|
|
871 |
}
|
872 |
|
873 |
|
874 |
-
|
875 |
-
|
876 |
-
|
877 |
-
|
878 |
-
|
879 |
-
|
880 |
-
|
881 |
-
|
882 |
-
|
883 |
-
|
884 |
-
|
885 |
-
|
886 |
-
|
887 |
-
|
888 |
-
|
889 |
|
890 |
-
|
891 |
-
|
892 |
|
893 |
-
|
894 |
-
|
895 |
-
|
896 |
-
|
897 |
-
|
898 |
-
|
899 |
-
|
900 |
-
|
901 |
-
|
902 |
|
903 |
-
|
904 |
-
|
905 |
|
906 |
-
|
907 |
|
908 |
-
|
909 |
-
|
910 |
-
|
911 |
-
|
912 |
-
|
913 |
-
|
914 |
-
|
915 |
-
|
916 |
-
|
917 |
-
|
918 |
-
|
919 |
-
|
920 |
|
921 |
-
|
922 |
-
|
923 |
|
924 |
-
|
925 |
-
|
926 |
-
|
927 |
-
|
928 |
|
929 |
-
|
930 |
-
|
931 |
|
932 |
-
|
933 |
-
|
934 |
-
|
935 |
-
|
936 |
-
|
937 |
-
|
938 |
-
|
939 |
-
|
940 |
-
|
941 |
-
|
942 |
-
|
943 |
-
|
944 |
-
|
945 |
-
|
946 |
-
|
947 |
-
|
948 |
|
949 |
-
|
950 |
-
|
951 |
|
952 |
-
|
953 |
-
|
954 |
-
|
955 |
-
|
956 |
-
|
957 |
-
|
958 |
-
|
959 |
-
|
960 |
-
|
961 |
|
962 |
-
|
963 |
-
|
964 |
|
965 |
-
|
966 |
|
967 |
-
|
968 |
-
|
969 |
-
|
970 |
-
|
971 |
-
|
972 |
-
|
973 |
-
|
974 |
-
|
975 |
-
|
976 |
-
|
977 |
-
|
978 |
-
|
979 |
-
|
980 |
-
|
981 |
|
982 |
-
|
983 |
-
|
984 |
|
985 |
-
|
986 |
-
|
987 |
-
|
988 |
-
|
989 |
-
|
990 |
-
|
991 |
-
|
992 |
-
|
993 |
-
|
994 |
|
995 |
-
|
996 |
-
|
997 |
|
998 |
-
|
999 |
|
1000 |
-
|
1001 |
-
|
1002 |
-
|
1003 |
-
|
1004 |
-
|
1005 |
-
|
1006 |
-
|
1007 |
-
|
1008 |
-
|
1009 |
-
|
1010 |
-
|
1011 |
-
|
1012 |
-
|
1013 |
-
|
1014 |
-
|
1015 |
|
1016 |
-
|
1017 |
-
|
1018 |
|
1019 |
-
|
1020 |
-
|
1021 |
-
|
1022 |
-
|
1023 |
-
|
1024 |
-
|
1025 |
-
|
1026 |
-
|
1027 |
-
|
1028 |
-
|
1029 |
-
|
1030 |
-
|
1031 |
-
|
1032 |
-
|
1033 |
-
// Return the HTML.
|
1034 |
-
return apply_filters( 'omapi_dropdown_field', $field, $setting, $value, $id, $label, $data );
|
1035 |
|
1036 |
-
|
|
|
1037 |
|
1038 |
-
|
1039 |
-
|
1040 |
-
|
1041 |
-
|
1042 |
-
|
1043 |
-
|
1044 |
-
|
1045 |
-
|
1046 |
-
|
1047 |
-
|
1048 |
-
|
1049 |
-
|
|
|
|
|
1050 |
|
1051 |
-
|
1052 |
-
|
1053 |
-
|
1054 |
-
|
1055 |
-
|
1056 |
-
|
1057 |
-
|
1058 |
-
|
1059 |
|
1060 |
-
|
1061 |
-
|
1062 |
|
1063 |
-
|
1064 |
|
1065 |
/**
|
1066 |
* Starts the toggle wrapper for a toggle section.
|
@@ -1167,178 +1185,178 @@ class OMAPI_Menu {
|
|
1167 |
*/
|
1168 |
public function get_svg_logo() {
|
1169 |
return '<svg class ="omapi-svg-logo" width="100%" height="100%" viewBox="0 0 716 112" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:1.41421;">
|
1170 |
-
|
1171 |
-
|
1172 |
-
|
1173 |
-
|
1174 |
-
|
1175 |
-
|
1176 |
-
|
1177 |
-
|
1178 |
-
|
1179 |
-
|
1180 |
-
|
1181 |
-
|
1182 |
-
|
1183 |
-
|
1184 |
-
|
1185 |
-
|
1186 |
-
|
1187 |
-
|
1188 |
-
|
1189 |
-
|
1190 |
-
|
1191 |
-
|
1192 |
-
|
1193 |
-
|
1194 |
-
|
1195 |
-
|
1196 |
-
|
1197 |
-
|
1198 |
-
|
1199 |
-
|
1200 |
-
|
1201 |
-
|
1202 |
-
|
1203 |
-
|
1204 |
-
|
1205 |
-
|
1206 |
-
|
1207 |
-
|
1208 |
-
|
1209 |
-
|
1210 |
-
|
1211 |
-
|
1212 |
-
|
1213 |
-
|
1214 |
-
|
1215 |
-
|
1216 |
-
|
1217 |
-
|
1218 |
-
|
1219 |
-
|
1220 |
-
|
1221 |
-
|
1222 |
-
|
1223 |
-
|
1224 |
-
|
1225 |
-
|
1226 |
-
|
1227 |
-
|
1228 |
-
|
1229 |
-
|
1230 |
-
|
1231 |
-
|
1232 |
-
|
1233 |
-
|
1234 |
-
|
1235 |
-
|
1236 |
-
|
1237 |
-
|
1238 |
-
|
1239 |
-
|
1240 |
-
|
1241 |
-
|
1242 |
-
|
1243 |
-
|
1244 |
-
|
1245 |
-
|
1246 |
-
|
1247 |
-
|
1248 |
-
|
1249 |
-
|
1250 |
-
|
1251 |
-
|
1252 |
-
|
1253 |
-
|
1254 |
-
|
1255 |
-
|
1256 |
-
|
1257 |
-
|
1258 |
-
|
1259 |
-
|
1260 |
-
|
1261 |
-
|
1262 |
-
|
1263 |
-
|
1264 |
-
|
1265 |
-
|
1266 |
-
|
1267 |
-
|
1268 |
-
|
1269 |
-
|
1270 |
-
|
1271 |
-
|
1272 |
-
|
1273 |
-
|
1274 |
-
|
1275 |
-
|
1276 |
-
|
1277 |
-
|
1278 |
-
|
1279 |
-
|
1280 |
-
|
1281 |
-
|
1282 |
-
|
1283 |
-
|
1284 |
-
|
1285 |
-
|
1286 |
-
|
1287 |
-
|
1288 |
-
|
1289 |
-
|
1290 |
-
|
1291 |
-
|
1292 |
-
|
1293 |
-
|
1294 |
-
|
1295 |
-
|
1296 |
-
|
1297 |
-
|
1298 |
-
|
1299 |
-
|
1300 |
-
|
1301 |
-
|
1302 |
-
|
1303 |
-
|
1304 |
-
|
1305 |
-
|
1306 |
-
|
1307 |
-
|
1308 |
-
|
1309 |
-
|
1310 |
-
|
1311 |
-
|
1312 |
-
|
1313 |
-
|
1314 |
-
|
1315 |
-
|
1316 |
-
|
1317 |
-
|
1318 |
-
|
1319 |
-
|
1320 |
-
|
1321 |
-
|
1322 |
-
|
1323 |
-
|
1324 |
-
|
1325 |
-
|
1326 |
-
|
1327 |
-
|
1328 |
-
|
1329 |
-
|
1330 |
-
|
1331 |
-
|
1332 |
-
|
1333 |
-
|
1334 |
-
|
1335 |
-
|
1336 |
-
|
1337 |
-
|
1338 |
-
|
1339 |
-
|
1340 |
-
|
1341 |
-
|
1342 |
</svg>';
|
1343 |
}
|
1344 |
|
@@ -1351,7 +1369,7 @@ class OMAPI_Menu {
|
|
1351 |
|
1352 |
$screen = get_current_screen();
|
1353 |
|
1354 |
-
|
1355 |
|
1356 |
$html .= '<div class="omapi-static-banner">';
|
1357 |
$html .= '<div class="inner-container">';
|
@@ -1360,7 +1378,7 @@ class OMAPI_Menu {
|
|
1360 |
$html .= '<li><a target="_blank" href="' . esc_url_raw( 'https://optinmonster.com/docs/' ) . '">' . __('Need Help?', 'optin-monster-api') . '</a></li>';
|
1361 |
$html .= '<li><a href="' . esc_url_raw( 'https://optinmonster.com/contact-us/' ) . '" target="_blank">' . __('Send Us Feedback', 'optin-monster-api') . '</a></li>';
|
1362 |
if( $screen->id === 'toplevel_page_optin-monster-api-settings' ) {
|
1363 |
-
$html .= '<li class="omapi-menu-button"><a id="omapi-create-new-optin-button" href="https://app.optinmonster.com/campaigns/new/" class="button button-secondary omapi-new-optin" title="' . __( 'Create New
|
1364 |
}
|
1365 |
$html .= '</ul></div>';
|
1366 |
$html .= '</div>';
|
@@ -1414,8 +1432,8 @@ class OMAPI_Menu {
|
|
1414 |
// Return the sas link if we have a sas ID
|
1415 |
if ( ! empty( $omSasId ) ) {
|
1416 |
return 'http://www.shareasale.com/r.cfm?u='
|
1417 |
-
|
1418 |
-
|
1419 |
}
|
1420 |
|
1421 |
// Return the regular pricing page by default
|
@@ -1458,8 +1476,8 @@ class OMAPI_Menu {
|
|
1458 |
// Return the trial link if we have a trial ID
|
1459 |
if ( ! empty( $omTrialId ) ) {
|
1460 |
return 'http://www.shareasale.com/r.cfm?u='
|
1461 |
-
|
1462 |
-
|
1463 |
}
|
1464 |
|
1465 |
// Return the regular pricing page by default
|
@@ -1494,4 +1512,4 @@ class OMAPI_Menu {
|
|
1494 |
|
1495 |
}
|
1496 |
|
1497 |
-
}
|
10 |
class OMAPI_Menu {
|
11 |
|
12 |
/**
|
13 |
+
* Holds the class object.
|
14 |
+
*
|
15 |
+
* @since 1.0.0
|
16 |
+
*
|
17 |
+
* @var object
|
18 |
+
*/
|
19 |
+
public static $instance;
|
20 |
|
21 |
/**
|
22 |
+
* Path to the file.
|
23 |
+
*
|
24 |
+
* @since 1.0.0
|
25 |
+
*
|
26 |
+
* @var string
|
27 |
+
*/
|
28 |
+
public $file = __FILE__;
|
29 |
|
30 |
+
/**
|
31 |
+
* Holds the base class object.
|
32 |
+
*
|
33 |
+
* @since 1.0.0
|
34 |
+
*
|
35 |
+
* @var OMAPI
|
36 |
+
*/
|
37 |
+
public $base;
|
38 |
|
39 |
+
/**
|
40 |
+
* Holds the admin menu slug.
|
41 |
+
*
|
42 |
+
* @since 1.0.0
|
43 |
+
*
|
44 |
+
* @var string
|
45 |
+
*/
|
46 |
+
public $hook;
|
47 |
|
48 |
+
/**
|
49 |
+
* Holds a tabindex counter for easy navigation through form fields.
|
50 |
+
*
|
51 |
+
* @since 1.0.0
|
52 |
+
*
|
53 |
+
* @var int
|
54 |
+
*/
|
55 |
+
public $tabindex = 429;
|
56 |
|
57 |
/**
|
58 |
* Primary class constructor.
|
61 |
*
|
62 |
* @param bool $isTesting
|
63 |
*/
|
64 |
+
public function __construct( $isTesting = false ) {
|
65 |
|
66 |
+
if ( ! $isTesting ) {
|
67 |
+
// Set our object.
|
68 |
+
$this->set();
|
69 |
|
70 |
+
// Load actions and filters.
|
71 |
+
add_action( 'admin_menu', array( $this, 'menu' ) );
|
72 |
+
// Load helper body classes
|
73 |
+
add_filter( 'admin_body_class', array( $this, 'admin_body_classes' ) );
|
74 |
|
75 |
+
}
|
76 |
|
77 |
+
}
|
78 |
|
79 |
+
/**
|
80 |
+
* Sets our object instance and base class instance.
|
81 |
+
*
|
82 |
+
* @since 1.0.0
|
83 |
+
*/
|
84 |
+
public function set() {
|
85 |
|
86 |
+
self::$instance = $this;
|
87 |
+
$this->base = OMAPI::get_instance();
|
88 |
+
$this->view = isset( $_GET['optin_monster_api_view'] ) ? stripslashes( $_GET['optin_monster_api_view'] ) : $this->base->get_view();
|
89 |
|
90 |
+
}
|
91 |
|
92 |
+
/**
|
93 |
+
* Loads the OptinMonster admin menu.
|
94 |
+
*
|
95 |
+
* @since 1.0.0
|
96 |
+
*/
|
97 |
+
public function menu() {
|
98 |
+
|
99 |
+
$this->hook = add_menu_page(
|
100 |
+
__( 'OptinMonster', 'optin-monster-api' ),
|
101 |
+
__( 'OptinMonster', 'optin-monster-api' ),
|
102 |
+
apply_filters( 'optin_monster_api_menu_cap', 'manage_options' ),
|
103 |
+
'optin-monster-api-settings',
|
104 |
+
array( $this, 'page' ),
|
105 |
+
'none',
|
106 |
+
579
|
107 |
+
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
108 |
|
109 |
+
// Load global icon font styles.
|
110 |
+
add_action( 'admin_head', array( $this, 'icon' ) );
|
111 |
|
112 |
+
// Load settings page assets.
|
113 |
+
if ( $this->hook ) {
|
114 |
+
add_action( 'load-' . $this->hook, array( $this, 'assets' ) );
|
115 |
+
}
|
|
|
|
|
116 |
|
117 |
+
}
|
|
|
|
|
118 |
|
119 |
+
/**
|
120 |
+
* Loads the custom Archie icon.
|
121 |
+
*
|
122 |
+
* @since 1.0.0
|
123 |
+
*/
|
124 |
+
public function icon() {
|
125 |
+
|
126 |
+
?>
|
127 |
+
<style type="text/css">@font-face{font-family: 'archie';src:url('<?php echo plugins_url( '/assets/fonts/archie.eot?velzrt', OMAPI_FILE ); ?>');src:url('<?php echo plugins_url( '/assets/fonts/archie.eot?#iefixvelzrt', OMAPI_FILE ); ?>') format('embedded-opentype'),url('<?php echo plugins_url( '/assets/fonts/archie.woff?velzrt', OMAPI_FILE ); ?>') format('woff'),url('<?php echo plugins_url( '/assets/fonts/archie.ttf?velzrt', OMAPI_FILE ); ?>') format('truetype'),url('<?php echo plugins_url( '/assets/fonts/archie.svg?velzrt#archie', OMAPI_FILE ); ?>') format('svg');font-weight: normal;font-style: normal;}#toplevel_page_optin-monster-api-settings .dashicons-before,#toplevel_page_optin-monster-api-settings .dashicons-before:before,#toplevel_page_optin-monster-api-welcome .dashicons-before,#toplevel_page_optin-monster-api-welcome .dashicons-before:before{font-family: 'archie';speak: none;font-style: normal;font-weight: normal;font-variant: normal;text-transform: none;line-height: 1;-webkit-font-smoothing: antialiased;-moz-osx-font-smoothing: grayscale;}#toplevel_page_optin-monster-api-settings .dashicons-before:before,#toplevel_page_optin-monster-api-welcome .dashicons-before:before{content: "\e600";font-size: 38px;margin-top: -9px;margin-left: -8px;}</style>
|
128 |
+
<?php
|
129 |
+
|
130 |
+
}
|
131 |
|
132 |
public function admin_body_classes( $classes ) {
|
133 |
|
141 |
|
142 |
}
|
143 |
|
144 |
+
/**
|
145 |
+
* Loads assets for the settings page.
|
146 |
+
*
|
147 |
+
* @since 1.0.0
|
148 |
+
*/
|
149 |
+
public function assets() {
|
150 |
|
151 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'styles' ) );
|
152 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'scripts' ) );
|
153 |
+
add_filter( 'admin_footer_text', array( $this, 'footer' ) );
|
154 |
+
add_action( 'in_admin_header', array( $this, 'output_plugin_screen_banner') );
|
155 |
add_action( 'admin_enqueue_scripts', array( $this, 'fix_plugin_js_conflicts'), 100 );
|
156 |
|
157 |
+
}
|
158 |
|
159 |
+
/**
|
160 |
+
* Register and enqueue settings page specific CSS.
|
161 |
+
*
|
162 |
+
* @since 1.0.0
|
163 |
+
*/
|
164 |
+
public function styles() {
|
165 |
|
166 |
wp_register_style( $this->base->plugin_slug . '-select2', plugins_url( '/assets/css/select2.min.css', OMAPI_FILE ), array(), $this->base->version );
|
167 |
+
wp_enqueue_style( $this->base->plugin_slug . '-select2' );
|
168 |
+
wp_register_style( $this->base->plugin_slug . '-settings', plugins_url( '/assets/css/settings.css', OMAPI_FILE ), array(), $this->base->version );
|
169 |
+
wp_enqueue_style( $this->base->plugin_slug . '-settings' );
|
170 |
|
171 |
+
// Run a hook to load in custom styles.
|
172 |
+
do_action( 'optin_monster_api_admin_styles', $this->view );
|
173 |
|
174 |
+
}
|
175 |
|
176 |
+
/**
|
177 |
+
* Register and enqueue settings page specific JS.
|
178 |
+
*
|
179 |
+
* @since 1.0.0
|
180 |
+
*/
|
181 |
+
public function scripts() {
|
182 |
|
183 |
wp_register_script( $this->base->plugin_slug . '-select2', plugins_url( '/assets/js/select2.min.js', OMAPI_FILE ), array( 'jquery' ), $this->base->version, true );
|
184 |
+
wp_enqueue_script( $this->base->plugin_slug . '-select2' );
|
185 |
+
wp_register_script( $this->base->plugin_slug . '-settings', plugins_url( '/assets/js/settings.js', OMAPI_FILE ), array( 'jquery', 'jquery-ui-core', 'jquery-ui-datepicker', $this->base->plugin_slug . '-select2' ), $this->base->version, true );
|
186 |
+
wp_enqueue_script( $this->base->plugin_slug . '-settings' );
|
187 |
+
wp_register_script( $this->base->plugin_slug . '-clipboard', plugins_url( '/assets/js/clipboard.min.js', OMAPI_FILE ), array( $this->base->plugin_slug . '-settings' ), $this->base->version, true );
|
188 |
+
wp_enqueue_script( $this->base->plugin_slug . '-clipboard' );
|
189 |
+
wp_register_script( $this->base->plugin_slug . '-tooltip', plugins_url( '/assets/js/tooltip.min.js', OMAPI_FILE ), array( $this->base->plugin_slug . '-settings' ), $this->base->version, true );
|
190 |
+
wp_enqueue_script( $this->base->plugin_slug . '-tooltip' );
|
191 |
+
wp_register_script( $this->base->plugin_slug . '-jspdf', plugins_url( '/assets/js/jspdf.min.js', OMAPI_FILE ), array( $this->base->plugin_slug . '-settings' ), $this->base->version, true );
|
192 |
+
wp_enqueue_script( $this->base->plugin_slug . '-jspdf' );
|
193 |
+
wp_localize_script(
|
194 |
+
$this->base->plugin_slug . '-settings',
|
195 |
+
'omapi',
|
196 |
+
array(
|
197 |
'ajax' => admin_url( 'admin-ajax.php' ),
|
198 |
'nonce' => wp_create_nonce( 'omapi-query-nonce' ),
|
199 |
+
'confirm' => __( 'Are you sure you want to reset these settings?', 'optin-monster-api' ),
|
200 |
+
'date_format' => 'F j, Y',
|
201 |
+
'supportData' => $this->get_support_data(),
|
202 |
)
|
203 |
+
);
|
204 |
|
205 |
+
// Run a hook to load in custom styles.
|
206 |
+
do_action( 'optin_monster_api_admin_scripts', $this->view );
|
207 |
|
208 |
+
}
|
209 |
|
210 |
/**
|
211 |
* Deque specific scripts that cause conflicts on settings page
|
267 |
$slug = $optin->post_name;
|
268 |
$design_type = get_post_meta( $optin->ID, '_omapi_type', true );
|
269 |
$optin_data[ $slug ] = array(
|
270 |
+
'Campaign Type' => $design_type,
|
271 |
'WordPress ID' => $optin->ID,
|
272 |
'Associated IDs' => get_post_meta( $optin->ID, '_omapi_ids', true ),
|
273 |
'Current Status' => get_post_meta( $optin->ID, '_omapi_enabled', true ) ? 'Live' : 'Disabled',
|
280 |
'Shortcodes Synced and Recognized' => get_post_meta( $optin->ID, '_omapi_shortcode', true ) ? htmlspecialchars_decode( get_post_meta( $optin->ID, '_omapi_shortcode_output', true ) ) : 'None recognized',
|
281 |
);
|
282 |
if ( 'post' == $design_type ) {
|
283 |
+
$optin_data[$slug]['Automatic Output Status'] = get_post_meta( $optin->ID, '_omapi_automatic', true ) ? 'Enabled' : 'Disabled';
|
284 |
}
|
285 |
|
286 |
}
|
331 |
return $array;
|
332 |
}
|
333 |
|
334 |
+
/**
|
335 |
+
* Customizes the footer text on the OptinMonster settings page.
|
336 |
+
*
|
337 |
+
* @since 1.0.0
|
338 |
+
*
|
339 |
+
* @param string $text The default admin footer text.
|
340 |
+
* @return string $text Amended admin footer text.
|
341 |
+
*/
|
342 |
+
public function footer( $text ) {
|
343 |
|
344 |
+
$url = 'https://wordpress.org/support/plugin/optinmonster/reviews?filter=5#new-post';
|
345 |
$text = sprintf( __( 'Please rate <strong>OptinMonster</strong> <a href="%s" target="_blank" rel="noopener">★★★★★</a> on <a href="%s" target="_blank">WordPress.org</a> to help us spread the word. Thank you from the OptinMonster team!', 'optin-monster-api' ), $url, $url );
|
346 |
return $text;
|
347 |
|
348 |
+
}
|
349 |
|
350 |
+
/**
|
351 |
+
* Outputs the OptinMonster settings page.
|
352 |
+
*
|
353 |
+
* @since 1.0.0
|
354 |
+
*/
|
355 |
+
public function page() {
|
356 |
+
|
357 |
+
?>
|
358 |
+
|
359 |
+
<div class="wrap omapi-page">
|
360 |
+
<h2></h2>
|
361 |
+
<div class="omapi-ui">
|
362 |
+
<div class="omapi-tabs">
|
363 |
+
<ul class="omapi-panels">
|
364 |
+
<?php
|
365 |
+
$i = 0; foreach ( $this->get_panels() as $id => $panel ) :
|
366 |
+
$first = 0 == $i ? ' omapi-panel-first' : '';
|
367 |
+
$active = $id == $this->view ? ' omapi-panel-active' : '';
|
368 |
+
?>
|
369 |
+
<li class="omapi-panel omapi-panel-<?php echo sanitize_html_class( $id ); ?><?php echo $first . $active; ?>"><a href="<?php echo esc_url_raw( add_query_arg( 'optin_monster_api_view', $id, admin_url( 'admin.php?page=optin-monster-api-settings' ) ) ); ?>" class="omapi-panel-link" data-panel="<?php echo $id; ?>" data-panel-title="<?php echo $panel; ?>"><?php echo $panel; ?></a></li>
|
370 |
+
<?php $i++; endforeach; ?>
|
371 |
+
</ul>
|
372 |
+
</div>
|
373 |
+
<div class="omapi-tabs-content">
|
374 |
+
<?php
|
375 |
+
foreach ( $this->get_panels() as $id => $panel ) :
|
376 |
+
$active = $id == $this->view ? ' omapi-content-active' : '';
|
377 |
+
?>
|
378 |
+
<div class="omapi-content omapi-content-<?php echo sanitize_html_class( $id ); ?><?php echo $active; ?>">
|
379 |
+
<?php
|
380 |
+
do_action( 'optin_monster_api_content_before', $id, $panel, $this );
|
381 |
+
do_action( 'optin_monster_api_content_' . $id, $panel, $this );
|
382 |
+
do_action( 'optin_monster_api_content_after', $id, $panel, $this ); ?>
|
383 |
+
</div>
|
384 |
+
<?php endforeach; ?>
|
385 |
+
</div>
|
386 |
+
</div>
|
387 |
+
</div>
|
388 |
+
<?php
|
389 |
|
390 |
+
}
|
391 |
|
392 |
+
/**
|
393 |
+
* Retrieves the available tab panels.
|
394 |
+
*
|
395 |
+
* @since 1.0.0
|
396 |
+
*
|
397 |
+
* @return array $panels Array of tab panels.
|
398 |
+
*/
|
399 |
+
public function get_panels() {
|
400 |
|
401 |
// Only load the API panel if no API credentials have been set.
|
402 |
$panels = array();
|
403 |
$creds = $this->base->get_api_credentials();
|
404 |
+
$can_migrate = $this->base->can_migrate();
|
405 |
+
$is_legacy_active = $this->base->is_legacy_active();
|
406 |
|
407 |
// Set panels requiring credentials.
|
408 |
if ( $creds ) {
|
409 |
+
$panels['optins'] = __( 'Campaigns', 'optin-monster-api' );
|
410 |
}
|
411 |
|
412 |
// Set default panels.
|
415 |
// Set the settings panel.
|
416 |
//$panels['settings'] = __( 'Settings', 'optin-monster-api' );
|
417 |
|
418 |
+
// Set the Support panel
|
419 |
+
$panels['support'] = __( 'Support', 'optin-monster-api' );
|
420 |
|
421 |
+
// Set the migration panel.
|
422 |
+
if ( $creds && $can_migrate && $is_legacy_active ) {
|
423 |
+
$panels['migrate'] = __( 'Migration', 'optin-monster-api' );
|
424 |
+
}
|
425 |
|
426 |
return apply_filters( 'optin_monster_api_panels', $panels );
|
427 |
|
428 |
+
}
|
429 |
|
430 |
+
/**
|
431 |
+
* Retrieves the setting UI for the setting specified.
|
432 |
+
*
|
433 |
+
* @since 1.0.0
|
434 |
+
*
|
435 |
+
* @param string $id The optin ID to target.
|
436 |
+
* @param string $setting The possible subkey setting for the option.
|
437 |
+
* @return string HTML setting string.
|
438 |
+
*/
|
439 |
+
public function get_setting_ui( $id, $setting = '' ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
440 |
|
441 |
+
// Prepare variables.
|
442 |
+
$ret = '';
|
443 |
+
$optin_id = isset( $_GET['optin_monster_api_id'] ) ? absint( $_GET['optin_monster_api_id'] ) : 0;
|
444 |
+
$value = 'optins' == $id ? get_post_meta( $optin_id, '_omapi_' . $setting, true ) : $this->base->get_option( $id, $setting );
|
445 |
+
$optin = get_post( $optin_id);
|
446 |
+
|
447 |
+
// Load the type of setting UI based on the option.
|
448 |
+
switch ( $id ) {
|
449 |
+
case 'api' :
|
450 |
+
switch ( $setting ) {
|
451 |
+
case 'user' :
|
452 |
+
$ret = $this->get_password_field( $setting, $value, $id, __( 'Legacy API Username', 'optin-monster-api' ), __( 'The Legacy API Username found in your OptinMonster Account API area.', 'optin-monster-api' ), __( 'Enter your Legacy API Username here...', 'optin-monster-api' ) );
|
453 |
+
break 2;
|
454 |
+
|
455 |
+
case 'key' :
|
456 |
+
$ret = $this->get_password_field( $setting, $value, $id, __( 'Legacy API Key', 'optin-monster-api' ), __( 'The Legacy API Key found in your OptinMonster Account API area.', 'optin-monster-api' ), __( 'Enter your Legacy API Key here...', 'optin-monster-api' ) );
|
457 |
+
break 2;
|
458 |
|
459 |
+
case 'apikey' :
|
460 |
+
$ret = $this->get_password_field( $setting, $value, $id, __( 'API Key', 'optin-monster-api'), __( 'A single API Key found in your OptinMonster Account API area.', 'optin-monster-api'), __( 'Enter your API Key here...', 'optin-monster-api') );
|
461 |
+
break 2;
|
462 |
}
|
463 |
break;
|
464 |
|
465 |
case 'settings' :
|
466 |
+
switch ( $setting ) {
|
467 |
+
case 'cookies' :
|
468 |
+
$ret = $this->get_checkbox_field( $setting, $value, $id, __( 'Clear local cookies on campaign update?', 'optin-monster-api' ), __( 'If checked, local cookies will be cleared for all campaigns after campaign settings are adjusted and saved.', 'optin-monster-api' ) );
|
469 |
+
break 2;
|
470 |
}
|
471 |
break;
|
472 |
|
473 |
+
case 'support' :
|
474 |
+
switch ( $setting ) {
|
475 |
+
case 'video' :
|
476 |
+
$ret = '<div class="omapi-half-column"><div class="omapi-video-container"><iframe width="640" height="360" src="https://www.youtube.com/embed/tUoJcp5Z9H0?rel=0&showinfo=0" frameborder="0" allowfullscreen></iframe></div></div>';
|
477 |
+
break 2;
|
478 |
|
479 |
+
case 'links' :
|
480 |
+
$ret = $this->get_support_links( $setting, 'Helpful Links' );
|
481 |
+
break 2;
|
482 |
|
483 |
+
case 'server-report';
|
484 |
+
$ret = $this->get_plugin_report($setting, 'Server / Plugin Report');
|
485 |
+
break 2;
|
486 |
+
}
|
487 |
+
break;
|
488 |
|
489 |
+
case 'toggle' :
|
490 |
switch ( $setting ) {
|
491 |
case 'advanced-start' :
|
492 |
$ret = $this->get_toggle_start( $setting, __( 'Advanced Settings', 'optin-monster-api'), __('More specific settings available for campaign visibility.', 'optin-monster-api') );
|
494 |
case 'advanced-end' :
|
495 |
$ret = $this->get_toggle_end();
|
496 |
break 2;
|
497 |
+
case 'woocommerce-start' :
|
498 |
+
$ret = $this->get_toggle_start( $setting, __( 'WooCommerce Settings', 'optin-monster-api'), __('More specific settings available for WooCommerce integration.', 'optin-monster-api') );
|
499 |
+
break 2;
|
500 |
+
case 'woocommerce-end' :
|
501 |
+
$ret = $this->get_toggle_end();
|
502 |
+
break 2;
|
503 |
}
|
504 |
+
break;
|
505 |
|
506 |
+
case 'optins' :
|
507 |
+
switch ( $setting ) {
|
508 |
case 'enabled' :
|
509 |
+
$ret = $this->get_checkbox_field( $setting, $value, $id, __( 'Enable campaign on site?', 'optin-monster-api' ), __( 'The campaign will not be displayed on this site unless this setting is checked.', 'optin-monster-api' ) );
|
510 |
break 2;
|
511 |
|
512 |
+
case 'automatic' :
|
513 |
+
$ret = $this->get_checkbox_field( $setting, $value, $id, __( 'Automatically add after post?', 'optin-monster-api' ), sprintf( __( 'Automatically adds the campaign after each post. You can turn this off and add it manually to your posts by <a href="%s" target="_blank">clicking here and viewing the tutorial.</a>', 'optin-monster-api' ), 'https://optinmonster.com/docs/manually-add-after-post-optin/' ), array('omapi-after-post-auto-select') );
|
514 |
+
break 2;
|
515 |
+
case 'automatic_shortcode' :
|
516 |
$full_shortcode ='[optin-monster-shortcode id="'. $optin->post_name .'"]';
|
517 |
+
$ret = $this->get_text_field(
|
518 |
+
$setting,
|
519 |
+
$full_shortcode,
|
520 |
+
$id,
|
521 |
+
__( 'Shortcode for this campaign', 'optin-monster-api' ),
|
522 |
+
sprintf( __( 'Use the shortcode to manually add this campaign to inline to a post or page. <a href="%s" title="Click here to learn more about how this work" target="_blank">Click here to learn more about how this works.</a>', 'optin-monster-api' ), 'https://optinmonster.com/docs/how-to-manually-add-an-after-post-or-inline-optin/' ),
|
523 |
+
false,
|
524 |
+
array(),
|
525 |
+
true
|
526 |
+
);
|
527 |
+
break 2;
|
528 |
|
529 |
+
case 'users' :
|
530 |
+
$ret = $this->get_dropdown_field( $setting, $value, $id, $this->get_user_output(), __( 'Who should see this campaign?', 'optin-monster-api' ), sprintf( __( 'Determines who should be able to view this campaign. Want to hide for newsletter subscribers? <a href="%s" target="_blank">Click here to learn how.</a>', 'optin-monster-api' ), 'https://optinmonster.com/docs/how-to-hide-optinmonster-from-existing-newsletter-subscribers/' ) );
|
531 |
+
break 2;
|
532 |
|
533 |
+
case 'never' :
|
534 |
+
$val = is_array( $value ) ? implode( ',', $value ) : $value;
|
535 |
+
$ret = $this->get_custom_field( $setting, '<input type="hidden" value="' . $val . '" id="omapi-field-' . $setting . '" class="omapi-select-ajax" name="omapi[' . $id . '][' . $setting . ']" data-placeholder="' . esc_attr__( 'Type to search and select post(s)...', 'optin-monster-api' ) . '">', __( 'Never load campaign on:', 'optin-monster-api' ), __( 'Never loads the campaign on the selected posts and/or pages. Does not disable automatic Global output.', 'optin-monster-api' ) );
|
536 |
+
break 2;
|
537 |
|
538 |
+
case 'only' :
|
539 |
+
$val = is_array( $value ) ? implode( ',', $value ) : $value;
|
540 |
+
$ret = $this->get_custom_field( $setting, '<input type="hidden" value="' . $val . '" id="omapi-field-' . $setting . '" class="omapi-select-ajax" name="omapi[' . $id . '][' . $setting . ']" data-placeholder="' . esc_attr__( 'Type to search and select post(s)...', 'optin-monster-api' ) . '">', __( 'Load campaign specifically on:', 'optin-monster-api' ), __( 'Loads the campaign on the selected posts and/or pages.', 'optin-monster-api' ) );
|
541 |
+
break 2;
|
542 |
|
543 |
+
case 'categories' :
|
544 |
+
$categories = get_categories();
|
545 |
+
if ( $categories ) {
|
546 |
+
ob_start();
|
547 |
+
wp_category_checklist( 0, 0, (array) $value, false, null, true );
|
548 |
+
$cats = ob_get_clean();
|
549 |
+
$ret = $this->get_custom_field( 'categories', $cats, __( 'Load campaign on post categories:', 'optin-monster-api' ) );
|
550 |
+
}
|
551 |
+
break;
|
552 |
+
|
553 |
+
case 'taxonomies' :
|
554 |
+
// Attempt to load post tags.
|
555 |
+
$html = '';
|
556 |
+
$tags = get_taxonomy( 'post_tag' );
|
557 |
+
if ( $tags ) {
|
558 |
+
$tag_terms = get_tags();
|
559 |
+
if ( $tag_terms ) {
|
560 |
+
$display = (array) $value;
|
561 |
+
$display = isset( $display['post_tag'] ) ? implode( ',', $display['post_tag'] ) : '';
|
562 |
+
$html = $this->get_custom_field( $setting, '<input type="hidden" value="' . $display . '" id="omapi-field-' . $setting . '" class="omapi-select-ajax" name="tax_input[post_tag][]" data-placeholder="' . esc_attr__( 'Type to search and select post tag(s)...', 'optin-monster-api' ) . '">', __( 'Load campaign on post tags:', 'optin-monster-api' ), __( 'Loads the campaign on the selected post tags.', 'optin-monster-api' ) );
|
563 |
+
}
|
564 |
+
}
|
565 |
+
|
566 |
+
// Possibly load taxonomies setting if they exist.
|
567 |
+
$taxonomies = get_taxonomies( array( 'public' => true, '_builtin' => false ) );
|
568 |
+
$taxonomies['post_format'] = 'post_format';
|
569 |
+
$data = array();
|
570 |
+
|
571 |
+
// Allow returned taxonmies to be filtered before creating UI.
|
572 |
+
$taxonomies = apply_filters('optin_monster_api_setting_ui_taxonomies', $taxonomies );
|
573 |
+
|
574 |
+
if ( $taxonomies ) {
|
575 |
+
foreach ( $taxonomies as $taxonomy ) {
|
576 |
+
$terms = get_terms( $taxonomy );
|
577 |
+
if ( $terms ) {
|
578 |
+
ob_start();
|
579 |
+
$display = (array) $value;
|
580 |
+
$display = isset( $display[ $taxonomy ] ) ? $display[ $taxonomy ] : array();
|
581 |
+
$tax = get_taxonomy( $taxonomy );
|
582 |
+
$args = array(
|
583 |
+
'descendants_and_self' => 0,
|
584 |
+
'selected_cats' => (array) $display,
|
585 |
+
'popular_cats' => false,
|
586 |
+
'walker' => null,
|
587 |
+
'taxonomy' => $taxonomy,
|
588 |
+
'checked_ontop' => true
|
589 |
+
);
|
590 |
+
wp_terms_checklist( 0, $args );
|
591 |
+
$output = ob_get_clean();
|
592 |
+
if ( ! empty( $output ) ) {
|
593 |
+
$data[ $taxonomy ] = $this->get_custom_field( 'taxonomies', $output, __( 'Load campaign on ' . strtolower( $tax->labels->name ) . ':', 'optin-monster-api' ) );
|
594 |
+
}
|
595 |
+
}
|
596 |
+
}
|
597 |
+
}
|
598 |
+
|
599 |
+
// If we have taxonomies, add them to the taxonomies key.
|
600 |
+
if ( ! empty( $data ) ) {
|
601 |
+
foreach ( $data as $setting ) {
|
602 |
+
$html .= $setting;
|
603 |
+
}
|
604 |
+
}
|
605 |
+
|
606 |
+
// Return the data.
|
607 |
+
$ret = $html;
|
608 |
+
break;
|
609 |
+
|
610 |
+
case 'show' :
|
611 |
+
$ret = $this->get_custom_field( 'show', $this->get_show_fields( $value ), __( 'Load campaign on post types and archives:', 'optin-monster-api' ) );
|
612 |
+
break;
|
613 |
+
|
614 |
+
case 'mailpoet' :
|
615 |
+
$ret = $this->get_checkbox_field( $setting, $value, $id, __( 'Save lead to MailPoet?', 'optin-monster-api' ), __( 'If checked, successful campaign leads will be saved to MailPoet.', 'optin-monster-api' ) );
|
616 |
+
break 2;
|
617 |
|
618 |
+
case 'mailpoet_list' :
|
619 |
+
$ret = $this->get_dropdown_field( $setting, $value, $id, $this->get_mailpoet_lists(), __( 'Add lead to this MailPoet list:', 'optin-monster-api' ), __( 'All successful leads for the campaign will be added to this particular MailPoet list.', 'optin-monster-api' ) );
|
620 |
+
break 2;
|
621 |
|
622 |
+
// Start WooCommerce settings.
|
623 |
+
case 'show_on_woocommerce' :
|
624 |
+
$ret = $this->get_checkbox_field( $setting, $value, $id, __( 'Show on all WooCommerce pages', 'optin-monster-api' ), __( 'The campaign will show on any page where WooCommerce templates are used.', 'optin-monster-api' ) );
|
625 |
+
break 2;
|
626 |
+
|
627 |
+
case 'is_wc_shop' :
|
628 |
+
$ret = $this->get_checkbox_field( $setting, $value, $id, __( 'Show on WooCommerce shop', 'optin-monster-api' ), __( 'The campaign will show on the product archive page (shop).', 'optin-monster-api' ) );
|
629 |
+
break 2;
|
630 |
+
|
631 |
+
case 'is_wc_product' :
|
632 |
+
$ret = $this->get_checkbox_field( $setting, $value, $id, __( 'Show on WooCommerce products', 'optin-monster-api' ), __( 'The campaign will show on any single product.', 'optin-monster-api' ) );
|
633 |
+
break 2;
|
634 |
+
|
635 |
+
case 'is_wc_cart' :
|
636 |
+
$ret = $this->get_checkbox_field( $setting, $value, $id, __( 'Show on WooCommerce Cart', 'optin-monster-api' ), __( 'The campaign will show on the cart page.', 'optin-monster-api' ) );
|
637 |
+
break 2;
|
638 |
+
|
639 |
+
case 'is_wc_checkout' :
|
640 |
+
$ret = $this->get_checkbox_field( $setting, $value, $id, __( 'Show on WooCommerce Checkout', 'optin-monster-api' ), __( 'The campaign will show on the checkout page.', 'optin-monster-api' ) );
|
641 |
+
break 2;
|
642 |
+
|
643 |
+
case 'is_wc_account' :
|
644 |
+
$ret = $this->get_checkbox_field( $setting, $value, $id, __( 'Show on WooCommerce Customer Account', 'optin-monster-api' ), __( 'The campaign will show on the WooCommerce customer account pages.', 'optin-monster-api' ) );
|
645 |
+
break 2;
|
646 |
+
|
647 |
+
case 'is_wc_endpoint' :
|
648 |
+
$ret = $this->get_checkbox_field( $setting, $value, $id, __( 'Show on all WooCommerce Endpoints', 'optin-monster-api' ), __( 'The campaign will show when on any WooCommerce Endpoint.', 'optin-monster-api' ) );
|
649 |
+
break 2;
|
650 |
+
case 'is_wc_endpoint_order_pay' :
|
651 |
+
$ret = $this->get_checkbox_field( $setting, $value, $id, __( 'Show on WooCommerce Order Pay endpoint', 'optin-monster-api' ), __( 'The campaign will show when the endpoint page for order pay is displayed.', 'optin-monster-api' ) );
|
652 |
+
break 2;
|
653 |
+
|
654 |
+
case 'is_wc_endpoint_order_received' :
|
655 |
+
$ret = $this->get_checkbox_field( $setting, $value, $id, __( 'Show on WooCommerce Order Received endpoint', 'optin-monster-api' ), __( 'The campaign will show when the endpoint page for order received is displayed.', 'optin-monster-api' ) );
|
656 |
+
break 2;
|
657 |
+
|
658 |
+
case 'is_wc_endpoint_view_order' :
|
659 |
+
$ret = $this->get_checkbox_field( $setting, $value, $id, __( 'Show on WooCommerce View Order endpoint', 'optin-monster-api' ), __( 'The campaign will show when the endpoint page for view order is displayed.', 'optin-monster-api' ) );
|
660 |
+
break 2;
|
661 |
+
|
662 |
+
case 'is_wc_endpoint_edit_account' :
|
663 |
+
$ret = $this->get_checkbox_field( $setting, $value, $id, __( 'Show on WooCommerce Edit Account endpoint', 'optin-monster-api' ), __( 'The campaign will show when the endpoint page for edit account is displayed.', 'optin-monster-api' ) );
|
664 |
+
break 2;
|
665 |
+
|
666 |
+
case 'is_wc_endpoint_edit_address' :
|
667 |
+
$ret = $this->get_checkbox_field( $setting, $value, $id, __( 'Show on WooCommerce Edit Address endpoint', 'optin-monster-api' ), __( 'The campaign will show when the endpoint page for edit address is displayed.', 'optin-monster-api' ) );
|
668 |
+
break 2;
|
669 |
+
|
670 |
+
case 'is_wc_endpoint_lost_password' :
|
671 |
+
$ret = $this->get_checkbox_field( $setting, $value, $id, __( 'Show on WooCommerce Lost Password endpoint', 'optin-monster-api' ), __( 'The campaign will show when the endpoint page for lost password is displayed.', 'optin-monster-api' ) );
|
672 |
+
break 2;
|
673 |
+
|
674 |
+
case 'is_wc_endpoint_customer_logout' :
|
675 |
+
$ret = $this->get_checkbox_field( $setting, $value, $id, __( 'Show on WooCommerce Customer Logout endpoint', 'optin-monster-api' ), __( 'The campaign will show when the endpoint page for customer logout is displayed.', 'optin-monster-api' ) );
|
676 |
+
break 2;
|
677 |
+
|
678 |
+
case 'is_wc_endpoint_add_payment_method' :
|
679 |
+
$ret = $this->get_checkbox_field( $setting, $value, $id, __( 'Show on WooCommerce Add Payment Method endpoint', 'optin-monster-api' ), __( 'The campaign will show when the endpoint page for add payment method is displayed.', 'optin-monster-api' ) );
|
680 |
+
break 2;
|
681 |
+
|
682 |
+
case 'is_wc_product_category' :
|
683 |
+
$taxonomy = 'product_cat';
|
684 |
+
$terms = get_terms( $taxonomy );
|
685 |
+
if ( $terms ) {
|
686 |
+
ob_start();
|
687 |
+
$display = isset( $value ) ? (array) $value : array();
|
688 |
+
$args = array(
|
689 |
+
'descendants_and_self' => 0,
|
690 |
+
'selected_cats' => $display,
|
691 |
+
'popular_cats' => false,
|
692 |
+
'walker' => null,
|
693 |
+
'taxonomy' => $taxonomy,
|
694 |
+
'checked_ontop' => true
|
695 |
+
);
|
696 |
+
wp_terms_checklist( 0, $args );
|
697 |
+
$output = ob_get_clean();
|
698 |
+
if ( ! empty( $output ) ) {
|
699 |
+
$ret = $this->get_custom_field( $setting, $output, __( 'Show on WooCommerce Product Categories:', 'optin-monster-api' ) );
|
700 |
+
}
|
701 |
+
}
|
702 |
+
break 2;
|
703 |
+
|
704 |
+
case 'is_wc_product_tag' :
|
705 |
+
$taxonomy = 'product_tag';
|
706 |
+
$terms = get_terms( $taxonomy );
|
707 |
+
if ( $terms ) {
|
708 |
+
ob_start();
|
709 |
+
$display = isset( $value ) ? (array) $value : array();
|
710 |
+
$args = array(
|
711 |
+
'descendants_and_self' => 0,
|
712 |
+
'selected_cats' => $display,
|
713 |
+
'popular_cats' => false,
|
714 |
+
'walker' => null,
|
715 |
+
'taxonomy' => $taxonomy,
|
716 |
+
'checked_ontop' => true
|
717 |
+
);
|
718 |
+
wp_terms_checklist( 0, $args );
|
719 |
+
$output = ob_get_clean();
|
720 |
+
if ( ! empty( $output ) ) {
|
721 |
+
$ret = $this->get_custom_field( $setting, $output, __( 'Show on WooCommerce Product Tags:', 'optin-monster-api' ) );
|
722 |
+
}
|
723 |
+
}
|
724 |
+
break 2;
|
725 |
+
|
726 |
+
}
|
727 |
+
break;
|
728 |
+
case 'note' :
|
729 |
+
switch ( $setting ) {
|
730 |
+
case 'sidebar_widget_notice' :
|
731 |
+
$ret = $this->get_optin_type_note( $setting, __('Use Widgets to set Sidebar output', 'optin-monster-api'), __('You can set this campaign to show in your sidebars using the OptinMonster widget within your sidebars.', 'optin-monster-api'), 'widgets.php', __('Go to Widgets', 'optin-monster-api') );
|
732 |
+
break 2;
|
733 |
+
}
|
734 |
+
break;
|
735 |
+
}
|
736 |
|
737 |
// Return the setting output.
|
738 |
+
return apply_filters( 'optin_monster_api_setting_ui', $ret, $setting, $id );
|
739 |
|
740 |
+
}
|
741 |
|
742 |
+
/**
|
743 |
+
* Returns the user output settings available for an optin.
|
744 |
+
*
|
745 |
+
* @since 1.0.0
|
746 |
+
*
|
747 |
+
* @return array An array of user dropdown values.
|
748 |
+
*/
|
749 |
+
public function get_user_output() {
|
750 |
+
|
751 |
+
return apply_filters( 'optin_monster_api_user_output',
|
752 |
+
array(
|
753 |
+
array(
|
754 |
+
'name' => __( 'Show campaign to all visitors and users', 'optin-monster-api' ),
|
755 |
+
'value' => 'all'
|
756 |
+
),
|
757 |
+
array(
|
758 |
+
'name' => __( 'Show campaign to only visitors (not logged-in)', 'optin-monster-api' ),
|
759 |
+
'value' => 'out'
|
760 |
+
),
|
761 |
+
array(
|
762 |
+
'name' => __( 'Show campaign to only users (logged-in)', 'optin-monster-api' ),
|
763 |
+
'value' => 'in'
|
764 |
+
)
|
765 |
)
|
766 |
);
|
767 |
|
776 |
*/
|
777 |
public function get_mailpoet_lists() {
|
778 |
|
779 |
+
// Prepare variables.
|
780 |
+
$mailpoet = null;
|
781 |
+
$lists = array();
|
782 |
+
$ret = array();
|
783 |
+
$listIdKey = 'id';
|
784 |
+
|
785 |
+
// Get lists. Check for MailPoet 3 first. Default to legacy.
|
786 |
+
if ( class_exists( '\\MailPoet\\Config\\Initializer' ) ) {
|
787 |
+
$lists = \MailPoet\API\API::MP('v1')->getLists();
|
788 |
+
} else {
|
789 |
+
$mailpoet = WYSIJA::get( 'list', 'model' );
|
790 |
+
$lists = $mailpoet->get( array( 'name', 'list_id' ), array( 'is_enabled' => 1 ) );
|
791 |
+
$listIdKey = 'list_id';
|
792 |
+
}
|
793 |
|
794 |
// Add default option.
|
795 |
$ret[] = array(
|
801 |
foreach ( (array) $lists as $list ) {
|
802 |
$ret[] = array(
|
803 |
'name' => $list['name'],
|
804 |
+
'value' => $list[ $listIdKey ],
|
805 |
);
|
806 |
}
|
807 |
|
808 |
+
/**
|
809 |
+
* Filters the MailPoet lists.
|
810 |
+
*
|
811 |
+
*
|
812 |
+
* @param array $ret The MailPoet lists array.
|
813 |
+
* @param array $lists The raw MailPoet lists array. Format differs by plugin verison.
|
814 |
+
* @param WYSIJA|null $mailpoet The MailPoet object if using legacy. Null otherwise.
|
815 |
+
*/
|
816 |
+
return apply_filters( 'optin_monster_api_mailpoet_lists', $ret, $lists, $mailpoet );
|
817 |
|
818 |
}
|
819 |
|
889 |
}
|
890 |
|
891 |
|
892 |
+
/**
|
893 |
+
* Retrieves the UI output for a password input field setting.
|
894 |
+
*
|
895 |
+
* @since 1.0.0
|
896 |
+
*
|
897 |
+
* @param string $setting The name of the setting to be saved to the DB.
|
898 |
+
* @param mixed $value The value of the setting.
|
899 |
+
* @param string $id The setting ID to target for name field.
|
900 |
+
* @param string $label The label of the input field.
|
901 |
+
* @param string $desc The description for the input field.
|
902 |
+
* @param string $place Placeholder text for the field.
|
903 |
+
* @param array $classes Array of classes to add to the field.
|
904 |
+
* @return string $html HTML representation of the data.
|
905 |
+
*/
|
906 |
+
public function get_password_field( $setting, $value, $id, $label, $desc = false, $place = false, $classes = array() ) {
|
907 |
|
908 |
+
// Increment the global tabindex counter.
|
909 |
+
$this->tabindex++;
|
910 |
|
911 |
+
// Build the HTML.
|
912 |
+
$field = '<div class="omapi-field-box omapi-password-field omapi-field-box-' . $setting . ' omapi-clear">';
|
913 |
+
$field .= '<p class="omapi-field-wrap"><label for="omapi-field-' . $setting . '">' . $label . '</label><br />';
|
914 |
+
$field .= '<input type="password" id="omapi-field-' . $setting . '" class="' . implode( ' ', (array) $classes ) . '" name="omapi[' . $id . '][' . $setting . ']" tabindex="' . $this->tabindex . '" value="' . $value . '"' . ( $place ? ' placeholder="' . $place . '"' : '' ) . ' />';
|
915 |
+
if ( $desc ) {
|
916 |
+
$field .= '<br /><span class="omapi-field-desc">' . $desc . '</span>';
|
917 |
+
}
|
918 |
+
$field .= '</p>';
|
919 |
+
$field .= '</div>';
|
920 |
|
921 |
+
// Return the HTML.
|
922 |
+
return apply_filters( 'optin_monster_api_password_field', $field, $setting, $value, $id, $label );
|
923 |
|
924 |
+
}
|
925 |
|
926 |
+
/**
|
927 |
+
* Retrieves the UI output for a hidden input field setting.
|
928 |
+
*
|
929 |
+
* @since 1.0.0
|
930 |
+
*
|
931 |
+
* @param string $setting The name of the setting to be saved to the DB.
|
932 |
+
* @param mixed $value The value of the setting.
|
933 |
+
* @param string $id The setting ID to target for name field.
|
934 |
+
* @param array $classes Array of classes to add to the field.
|
935 |
+
* @return string $html HTML representation of the data.
|
936 |
+
*/
|
937 |
+
public function get_hidden_field( $setting, $value, $id, $classes = array() ) {
|
938 |
|
939 |
+
// Increment the global tabindex counter.
|
940 |
+
$this->tabindex++;
|
941 |
|
942 |
+
// Build the HTML.
|
943 |
+
$field = '<div class="omapi-field-box omapi-hidden-field omapi-field-box-' . $setting . ' omapi-clear omapi-hidden">';
|
944 |
+
$field .= '<input type="hidden" id="omapi-field-' . $setting . '" class="' . implode( ' ', (array) $classes ) . '" name="omapi[' . $id . '][' . $setting . ']" tabindex="' . $this->tabindex . '" value="' . $value . '" />';
|
945 |
+
$field .= '</div>';
|
946 |
|
947 |
+
// Return the HTML.
|
948 |
+
return apply_filters( 'optin_monster_api_hidden_field', $field, $setting, $value, $id );
|
949 |
|
950 |
+
}
|
951 |
+
/**
|
952 |
+
* Retrieves the UI output for a plain textarea field setting.
|
953 |
+
*
|
954 |
+
* @since 1.0.0
|
955 |
+
*
|
956 |
+
* @param string $setting The name of the setting to be saved to the DB.
|
957 |
+
* @param mixed $value The value of the setting.
|
958 |
+
* @param string $id The setting ID to target for name field.
|
959 |
+
* @param string $label The label of the input field.
|
960 |
+
* @param string $desc The description for the input field.
|
961 |
+
* @param string $place Placeholder text for the field.
|
962 |
+
* @param array $classes Array of classes to add to the field.
|
963 |
+
* @return string $html HTML representation of the data.
|
964 |
+
*/
|
965 |
+
public function get_textarea_field( $setting, $value, $id, $label, $desc = false, $place = false, $classes = array() ) {
|
966 |
|
967 |
+
// Increment the global tabindex counter.
|
968 |
+
$this->tabindex++;
|
969 |
|
970 |
+
// Build the HTML.
|
971 |
+
$field = '<div class="omapi-field-box omapi-textarea-field omapi-field-box-' . $setting . ' omapi-clear">';
|
972 |
+
$field .= '<p class="omapi-field-wrap"><label for="omapi-field-' . $setting . '">' . $label . '</label><br />';
|
973 |
+
$field .= '<textarea id="omapi-field-' . $setting . '" class="' . implode( ' ', (array) $classes ) . '" name="omapi[' . $id . '][' . $setting . ']" rows="5" tabindex="' . $this->tabindex . '"' . ( $place ? ' placeholder="' . $place . '"' : '' ) . '>' . $value . '</textarea>';
|
974 |
+
if ( $desc ) {
|
975 |
+
$field .= '<br /><span class="omapi-field-desc">' . $desc . '</span>';
|
976 |
+
}
|
977 |
+
$field .= '</p>';
|
978 |
+
$field .= '</div>';
|
979 |
|
980 |
+
// Return the HTML.
|
981 |
+
return apply_filters( 'optin_monster_api_textarea_field', $field, $setting, $value, $id, $label );
|
982 |
|
983 |
+
}
|
984 |
|
985 |
+
/**
|
986 |
+
* Retrieves the UI output for a checkbox setting.
|
987 |
+
*
|
988 |
+
* @since 1.0.0
|
989 |
+
*
|
990 |
+
* @param string $setting The name of the setting to be saved to the DB.
|
991 |
+
* @param mixed $value The value of the setting.
|
992 |
+
* @param string $id The setting ID to target for name field.
|
993 |
+
* @param string $label The label of the input field.
|
994 |
+
* @param string $desc The description for the input field.
|
995 |
+
* @param array $classes Array of classes to add to the field.
|
996 |
+
* @return string $html HTML representation of the data.
|
997 |
+
*/
|
998 |
+
public function get_checkbox_field( $setting, $value, $id, $label, $desc = false, $classes = array() ) {
|
999 |
|
1000 |
+
// Increment the global tabindex counter.
|
1001 |
+
$this->tabindex++;
|
1002 |
|
1003 |
+
// Build the HTML.
|
1004 |
+
$field = '<div class="omapi-field-box omapi-checkbox-field omapi-field-box-' . $setting . ' omapi-clear">';
|
1005 |
+
$field .= '<p class="omapi-field-wrap"><label for="omapi-field-' . $setting . '">' . $label . '</label><br />';
|
1006 |
+
$field .= '<input type="checkbox" id="omapi-field-' . $setting . '" class="' . implode( ' ', (array) $classes ) . '" name="omapi[' . $id . '][' . $setting . ']" tabindex="' . $this->tabindex . '" value="' . $value . '"' . checked( $value, 1, false ) . ' /> ';
|
1007 |
+
if ( $desc ) {
|
1008 |
+
$field .= '<span class="omapi-field-desc">' . $desc . '</span>';
|
1009 |
+
}
|
1010 |
+
$field .= '</p>';
|
1011 |
+
$field .= '</div>';
|
1012 |
|
1013 |
+
// Return the HTML.
|
1014 |
+
return apply_filters( 'optin_monster_api_checkbox_field', $field, $setting, $value, $id, $label );
|
1015 |
|
1016 |
+
}
|
1017 |
|
1018 |
+
/**
|
1019 |
+
* Retrieves the UI output for a dropdown field setting.
|
1020 |
+
*
|
1021 |
+
* @since 1.0.0
|
1022 |
+
*
|
1023 |
+
* @param string $setting The name of the setting to be saved to the DB.
|
1024 |
+
* @param mixed $value The value of the setting.
|
1025 |
+
* @param string $id The setting ID to target for name field.
|
1026 |
+
* @param array $data The data to be used for option fields.
|
1027 |
+
* @param string $label The label of the input field.
|
1028 |
+
* @param string $desc The description for the input field.
|
1029 |
+
* @param array $classes Array of classes to add to the field.
|
1030 |
+
* @return string $html HTML representation of the data.
|
1031 |
+
*/
|
1032 |
+
public function get_dropdown_field( $setting, $value, $id, $data, $label, $desc = false, $classes = array() ) {
|
1033 |
|
1034 |
+
// Increment the global tabindex counter.
|
1035 |
+
$this->tabindex++;
|
1036 |
|
1037 |
+
// Build the HTML.
|
1038 |
+
$field = '<div class="omapi-field-box omapi-dropdown-field omapi-field-box-' . $setting . ' omapi-clear">';
|
1039 |
+
$field .= '<p class="omapi-field-wrap"><label for="omapi-field-' . $setting . '">' . $label . '</label><br />';
|
1040 |
+
$field .= '<select id="omapi-field-' . $setting . '" class="' . implode( ' ', (array) $classes ) . '" name="omapi[' . $id . '][' . $setting . ']" tabindex="' . $this->tabindex . '">';
|
1041 |
+
foreach ( $data as $i => $info ) {
|
1042 |
+
$field .= '<option value="' . $info['value'] . '"' . selected( $info['value'], $value, false ) . '>' . $info['name'] . '</option>';
|
1043 |
+
}
|
1044 |
+
$field .= '</select>';
|
1045 |
+
if ( $desc ) {
|
1046 |
+
$field .= '<br /><span class="omapi-field-desc">' . $desc . '</span>';
|
1047 |
+
}
|
1048 |
+
$field .= '</p>';
|
1049 |
+
$field .= '</div>';
|
|
|
|
|
|
|
1050 |
|
1051 |
+
// Return the HTML.
|
1052 |
+
return apply_filters( 'omapi_dropdown_field', $field, $setting, $value, $id, $label, $data );
|
1053 |
|
1054 |
+
}
|
1055 |
+
|
1056 |
+
/**
|
1057 |
+
* Retrieves the UI output for a field with a custom output.
|
1058 |
+
*
|
1059 |
+
* @since 1.0.0
|
1060 |
+
*
|
1061 |
+
* @param string $setting The name of the setting to be saved to the DB.
|
1062 |
+
* @param mixed $value The value of the setting.
|
1063 |
+
* @param string $label The label of the input field.
|
1064 |
+
* @param string $desc The description for the input field.
|
1065 |
+
* @return string $html HTML representation of the data.
|
1066 |
+
*/
|
1067 |
+
public function get_custom_field( $setting, $value, $label, $desc = false ) {
|
1068 |
|
1069 |
+
// Build the HTML.
|
1070 |
+
$field = '<div class="omapi-field-box omapi-custom-field omapi-field-box-' . $setting . ' omapi-clear">';
|
1071 |
+
$field .= '<p class="omapi-field-wrap"><label for="omapi-field-' . $setting . '">' . $label . '</label></p>';
|
1072 |
+
$field .= $value;
|
1073 |
+
if ( $desc ) {
|
1074 |
+
$field .= '<br /><span class="omapi-field-desc">' . $desc . '</span>';
|
1075 |
+
}
|
1076 |
+
$field .= '</div>';
|
1077 |
|
1078 |
+
// Return the HTML.
|
1079 |
+
return apply_filters( 'optin_monster_api_custom_field', $field, $setting, $value, $label );
|
1080 |
|
1081 |
+
}
|
1082 |
|
1083 |
/**
|
1084 |
* Starts the toggle wrapper for a toggle section.
|
1185 |
*/
|
1186 |
public function get_svg_logo() {
|
1187 |
return '<svg class ="omapi-svg-logo" width="100%" height="100%" viewBox="0 0 716 112" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:1.41421;">
|
1188 |
+
<g transform="matrix(1,0,0,1,-37.6592,-251.388)">
|
1189 |
+
<path d="M565.437,342.797C565.437,343.888 564.892,344.524 563.711,344.707C561.166,345.071 547.717,345.071 545.355,344.616C544.174,344.344 543.54,343.526 543.54,342.162C543.54,338.891 543.903,328.168 543.903,324.897C543.903,322.354 543.63,313.993 543.63,311.447C543.63,305.905 541.268,303.179 536.451,303.179C533.543,303.179 527.546,306.541 527.546,309.813L527.546,342.526C527.546,343.889 526.91,344.616 525.635,344.799C523,345.161 510.097,345.072 507.735,344.708C506.462,344.525 505.827,343.798 505.827,342.709L505.917,314.176C505.917,304.089 505.099,296.183 503.555,290.458C503.372,289.64 503.281,288.459 504.371,288.187C506.916,287.914 510.277,287.46 514.549,286.823C520.999,285.551 524.544,284.916 525.361,284.916C526.544,284.916 526.272,293.094 527.451,293.094C527.906,293.094 529.178,291.731 533.994,288.914C538.81,286.097 542.992,284.733 546.536,284.733C556.35,284.733 565.164,289.548 565.164,299.998C565.164,311.63 565.164,318.809 565.255,331.167C565.255,336.44 565.346,340.346 565.346,342.981L565.437,342.797ZM605.785,295.545C605.785,295.908 605.51,296.453 604.875,297.18C599.967,295.908 592.516,297.453 592.516,303.45C592.516,308.72 604.421,313.358 604.421,325.352C604.421,329.35 602.695,334.984 599.697,337.436C593.699,342.525 584.975,346.795 577.251,346.795C575.343,346.795 567.619,333.892 567.619,332.165C567.619,331.802 567.891,331.62 568.255,331.529C571.071,330.984 573.98,330.439 576.796,329.984C580.342,328.802 582.158,326.986 582.158,324.351C582.158,322.533 581.158,320.534 579.07,318.171C575.344,314.082 573.434,311.901 573.254,311.629C562.803,296.088 580.615,281.277 597.063,281.277C598.607,281.277 605.695,294.272 605.695,295.453L605.785,295.545ZM652.946,326.804C652.946,328.714 652.038,335.8 652.038,337.71C652.038,340.073 651.765,340.162 649.675,341.345C644.496,344.16 638.679,345.615 632.319,345.615C620.596,345.615 614.781,341.162 614.781,332.166C614.781,327.716 615.417,312.631 615.417,308.086C615.417,303.272 608.42,307.27 608.42,303.815C608.42,302.725 608.693,298.908 608.693,297.909C608.693,296.454 608.42,291.547 608.42,290.185C608.42,289.367 609.692,288.913 612.328,288.821C613.782,288.821 614.599,288.367 614.69,287.64C614.962,286.095 615.053,283.642 614.962,280.371C614.781,275.191 614.69,273.192 614.69,272.919C614.69,268.194 615.145,265.922 616.053,265.922C617.78,265.922 624.049,267.376 625.504,267.557C627.592,267.83 630.683,268.284 634.864,268.739C635.864,268.83 636.408,269.193 636.408,269.738C636.408,272.464 635.589,281.734 635.589,284.46C635.589,286.459 636.137,287.458 637.317,287.458C639.679,287.458 647.767,287.094 650.222,287.094C651.13,287.094 651.584,287.368 651.584,288.004C651.584,289.821 650.947,294.547 650.947,296.364L651.039,304.815C651.039,305.633 650.494,306.087 649.311,306.087C645.132,305.996 640.863,305.905 636.68,305.905C636.044,305.905 635.772,306.814 635.772,308.54L635.864,317.173C635.864,323.534 636.679,326.805 643.405,326.805C647.222,326.805 652.946,323.718 652.946,326.716L652.946,326.804ZM690.476,307.903C690.476,299.906 680.572,294.727 675.119,301.633C673.575,303.632 672.847,305.904 672.847,308.63C672.847,309.719 673.392,310.266 674.575,310.266C677.573,310.266 682.208,309.811 688.568,308.902C689.931,308.719 690.568,308.358 690.568,307.903L690.476,307.903ZM711.74,311.629C711.74,315.719 710.379,318.079 707.742,318.626C707.289,318.717 703.107,319.171 695.202,319.989C690.385,320.534 683.298,321.17 673.847,321.898C675.575,330.166 689.295,331.712 697.836,326.714C699.381,325.714 700.927,324.804 702.471,323.804C704.289,324.715 709.741,335.163 709.741,337.073C709.741,337.346 709.469,337.798 708.834,338.437C703.926,343.706 696.292,346.342 685.842,346.342C666.759,346.342 653.492,334.256 653.492,315.08C653.492,296.726 665.124,283.003 683.844,283.003C691.567,283.003 698.201,285.82 703.653,291.545C709.103,297.179 711.83,303.903 711.83,311.717L711.74,311.629ZM752.813,306.813C752.813,309.902 749.363,309.175 746.816,308.995C743.092,308.72 738.639,308.72 736.64,310.447C735.457,311.446 734.822,313.629 734.822,316.808C734.822,319.718 735.005,329.714 735.005,332.62C735.005,334.528 735.459,341.161 735.459,343.07C735.459,344.07 734.822,344.615 733.46,344.706C729.552,345.069 719.376,345.069 715.287,344.615C713.923,344.434 713.288,343.797 713.288,342.615L713.377,313.537C713.377,303.995 712.469,296.181 710.743,290.092C710.56,289.274 710.469,288.184 711.56,288.002C713.832,287.73 717.012,287.275 721.375,286.639C727.735,285.367 731.097,284.731 731.279,284.731C733.097,284.731 732.37,292.364 733.733,292.364C734.278,292.364 734.821,291.274 738.731,289.184C742.637,287.093 746.364,286.003 749.906,286.003C752.177,286.003 753.268,286.457 753.268,287.457C753.268,288.638 753.177,290.274 752.905,292.455C752.268,298.361 752.632,301.815 752.632,306.813L752.813,306.813ZM404.505,342.344C404.505,343.706 403.869,344.524 402.687,344.706C400.236,345.069 386.967,345.069 384.515,344.615C383.333,344.343 382.698,343.343 382.698,341.616C382.698,338.437 383.061,328.075 383.061,324.987C383.061,317.899 382.97,312.901 382.788,309.902C382.516,305.086 380.244,302.724 375.973,302.724C372.156,302.724 367.613,306.54 367.159,310.447C366.977,312.174 366.886,317.08 366.886,325.352C366.886,328.531 367.249,339.436 367.249,342.708C367.249,344.071 366.704,344.707 365.523,344.707L347.166,344.707C346.077,344.707 345.44,343.889 345.44,342.253C345.44,338.983 345.804,328.351 345.804,325.081C345.804,322.534 345.531,313.994 345.531,311.447C345.531,296.546 329.72,304.178 329.72,309.54L329.81,342.436C329.81,344.524 329.628,344.616 327.539,344.797C323.177,345.159 315.816,345.159 310.273,344.707C308.274,344.524 308.274,344.524 308.274,342.436L308.365,313.358C308.365,306.723 307.91,299.272 306.911,291.002C306.729,290.003 306.548,288.913 307.638,288.549C309.637,287.731 316.725,287.368 318.088,287.094C319.451,286.822 325.358,285.005 327.629,285.005C329.447,285.005 328.538,293.547 329.356,293.456C331.81,292.819 337.535,284.551 349.439,284.551C356.526,284.551 363.796,287.913 365.704,294.819C369.976,289.003 378.335,284.551 385.515,284.551C395.69,284.551 404.234,289.548 404.234,300.18C404.234,303.815 403.871,315.901 403.871,319.535C403.871,323.807 404.234,338.255 404.234,342.526L404.505,342.344Z" style="fill:white;fill-rule:nonzero;"/>
|
1190 |
+
</g>
|
1191 |
+
<g transform="matrix(1,0,0,1,-37.6592,-251.388)">
|
1192 |
+
<path d="M79.096,314.536C79.096,308.448 75.098,302.45 68.465,302.45C58.559,302.45 54.379,315.445 60.558,322.988C66.738,330.529 79.096,326.35 79.096,314.536M145.432,315.081C145.432,303.359 132.619,298.815 126.713,306.63C121.806,313.173 123.714,327.35 134.709,327.35C141.798,327.349 145.432,323.26 145.432,315.081M167.878,315.173C167.878,332.165 156.973,345.523 139.525,345.523C132.801,345.523 124.441,340.889 124.714,340.889C124.168,340.889 123.896,341.524 123.896,342.707C123.896,346.342 124.532,357.7 124.532,361.335C124.532,362.607 123.896,363.243 122.533,363.243C119.443,363.243 106.993,363.515 104.813,362.971C103.631,362.698 102.995,361.971 102.995,360.699L103.087,313.991C103.087,304.54 102.359,296.635 100.996,290.183C100.814,289.365 100.724,288.274 101.632,287.911C104.904,286.639 116.445,284.913 120.079,284.913C123.805,284.913 122.442,291.182 123.623,291.182C123.169,291.182 124.986,290.092 128.803,287.911C132.71,285.729 136.163,284.64 139.344,284.64C157.245,284.64 167.968,297.453 167.968,315.081L167.878,315.173ZM214.221,326.622C214.221,329.258 213.313,334.982 213.313,337.526C213.313,339.709 213.131,339.98 210.95,341.161C205.771,343.978 199.955,345.434 193.594,345.434C181.871,345.434 176.056,340.981 176.056,331.985C176.056,327.35 176.692,312.538 176.692,307.904C176.692,302.997 169.695,307.177 169.695,303.634C169.695,302.543 169.967,298.726 169.967,297.726C169.967,296.273 169.695,291.366 169.695,290.002C169.695,289.184 170.967,288.73 173.602,288.64C175.056,288.64 175.874,288.185 175.965,287.458C176.238,285.913 176.328,283.46 176.238,280.188C176.056,275.009 175.965,272.464 175.965,272.737C175.965,268.012 176.419,265.74 177.328,265.74C179.509,265.74 184.507,267.103 186.779,267.376C188.868,267.648 191.958,268.102 196.138,268.557C197.138,268.648 197.683,269.012 197.683,269.557C197.683,272.646 196.865,281.188 196.865,284.277C196.865,286.277 197.41,287.276 198.592,287.276C200.954,287.276 209.042,286.913 211.496,286.913C212.404,286.913 212.858,287.185 212.858,287.822C212.858,289.639 212.222,294.364 212.222,296.182L212.313,304.633C212.313,305.451 211.768,305.905 210.587,305.905C206.225,305.814 202.318,305.723 197.956,305.723C197.32,305.723 197.047,306.632 197.047,308.359L197.138,316.991C197.138,323.352 198.047,326.624 204.68,326.624C208.951,326.624 214.221,323.441 214.221,326.532L214.221,326.622ZM237.757,316.535C237.757,321.533 238.12,337.89 238.12,342.888C238.12,343.706 237.575,344.251 236.575,344.434C233.759,344.887 220.764,344.979 217.947,344.434C217.038,344.251 216.493,343.98 216.312,343.616C216.039,343.071 216.584,318.719 216.584,316.537C216.584,305.087 216.13,295.909 215.221,289.094C214.857,286.095 215.585,286.277 221.946,287.004C230.124,287.822 231.487,286.731 237.757,286.731C239.484,286.731 239.211,287.822 239.12,289.094C238.212,296.998 237.757,306.086 237.757,316.535M239.302,271.464C239.302,278.46 235.304,282.005 227.398,282.005C214.857,282.005 212.04,269.464 219.129,263.739C226.58,257.742 239.302,261.831 239.302,271.464M304.366,342.615C304.366,343.706 303.821,344.343 302.639,344.523C300.095,344.887 286.646,344.887 284.283,344.434C283.102,344.16 282.466,343.344 282.466,341.98C282.466,338.71 282.829,327.987 282.829,324.716C282.829,322.17 282.556,313.809 282.556,311.266C282.556,305.723 280.194,302.997 275.378,302.997C272.288,302.997 266.472,306.45 266.472,309.631L266.472,342.345C266.472,343.708 265.836,344.434 264.564,344.616C261.565,344.979 249.479,344.979 246.662,344.524C245.39,344.344 244.754,343.616 244.754,342.525L244.845,313.994C244.845,303.907 244.027,296.001 242.482,290.276C242.301,289.368 242.301,288.277 243.3,288.005C245.845,287.732 249.207,287.277 253.478,286.641C259.93,285.369 263.473,284.733 264.292,284.733C265.472,284.733 265.2,292.912 266.382,292.912C265.928,292.912 268.108,291.549 272.924,288.732C277.741,285.915 281.921,284.552 285.465,284.552C295.279,284.552 304.093,289.368 304.093,299.818C304.093,311.449 304.093,318.629 304.184,330.987C304.184,336.257 304.275,340.163 304.275,342.799L304.366,342.615ZM98.907,314.536C98.907,332.983 86.73,345.614 68.192,345.614C50.381,345.614 37.659,333.165 37.659,315.264C37.659,296.726 49.2,283.64 68.192,283.64C86.548,283.64 98.907,296.181 98.907,314.536" style="fill:white;fill-rule:nonzero;"/>
|
1193 |
+
</g>
|
1194 |
+
<g transform="matrix(1,0,0,1,-37.6592,-251.388)">
|
1195 |
+
<g opacity="0.149002">
|
1196 |
+
<clipPath id="_clip1">
|
1197 |
+
<rect x="385.878" y="344.16" width="139.94" height="15.086"/>
|
1198 |
+
</clipPath>
|
1199 |
+
<g clip-path="url(#_clip1)">
|
1200 |
+
<path d="M455.848,344.16C494.47,344.16 525.819,347.522 525.819,351.704C525.819,355.884 494.469,359.246 455.848,359.246C417.228,359.246 385.879,355.884 385.879,351.704C385.878,347.522 417.228,344.16 455.848,344.16" style="fill:black;fill-rule:nonzero;"/>
|
1201 |
+
</g>
|
1202 |
+
</g>
|
1203 |
+
</g>
|
1204 |
+
<g transform="matrix(1,0,0,1,-37.6592,-251.388)">
|
1205 |
+
<path d="M497.921,284.186C498.831,283.641 499.012,280.278 499.104,279.279C499.376,277.007 502.193,276.008 504.011,277.189C507.192,279.46 508.827,283.823 509.28,287.548C509.735,291.364 509.372,296.453 506.646,299.452C503.738,302.724 496.377,303.724 492.016,303.269C490.835,303.178 489.744,302.905 488.653,302.724L486.563,284.004L488.837,284.458C491.108,284.912 495.743,285.368 497.833,284.186L497.921,284.186Z" style="fill:rgb(153,153,102);fill-rule:nonzero;"/>
|
1206 |
+
</g>
|
1207 |
+
<g transform="matrix(1,0,0,1,-37.6592,-251.388)">
|
1208 |
+
<path d="M505.009,280.551C504.464,279.824 503.828,279.097 503.101,278.643C502.374,278.097 501.011,278.552 500.918,279.461L500.829,280.096C502.193,279.642 503.737,280.006 505.009,280.551M507.554,293.364C508.099,290.456 507.826,287.093 506.827,284.186C506.1,283.277 505.372,282.551 504.009,282.005C502.282,281.278 501.374,281.551 500.559,282.278C500.467,283.005 500.283,283.55 500.104,284.095C504.829,285.64 506.828,290.183 507.555,293.454L507.555,293.364L507.554,293.364ZM493.741,286.639C492.106,286.639 490.379,286.457 488.653,286.094L490.287,301.178C492.471,301.633 495.013,301.633 497.284,301.361C498.92,295.545 497.284,288.73 493.651,286.549L493.741,286.639ZM498.83,285.64C498.195,286.003 497.283,286.276 496.196,286.457C499.466,289.911 500.466,296.181 499.282,301.088C502.009,300.543 504.28,299.543 505.462,298.271C505.735,297.998 505.916,297.634 506.19,297.362C506.19,292.182 504.1,286.639 499.102,285.549C499.01,285.64 499.01,285.64 498.918,285.64L498.83,285.64Z" style="fill:rgb(192,192,160);fill-rule:nonzero;"/>
|
1209 |
+
</g>
|
1210 |
+
<g transform="matrix(1,0,0,1,-37.6592,-251.388)">
|
1211 |
+
<path d="M497.921,295.453C495.74,295.999 493.378,296.09 491.65,295.908C490.924,295.817 490.287,295.726 489.651,295.544L488.561,286.185C490.287,286.548 492.015,286.73 493.65,286.73C496.013,288.184 497.56,291.637 497.832,295.453L497.921,295.453ZM504.556,282.277C504.644,282.823 504.736,283.368 504.827,283.912C505.009,285.003 505.009,286.275 504.918,287.548C503.735,286.094 502.192,284.822 500.103,284.095C500.283,283.55 500.466,283.004 500.557,282.277C501.281,281.641 502.281,281.277 504.008,282.005C504.192,282.095 504.373,282.186 504.556,282.277M503.192,278.733C503.465,279.188 503.645,279.642 503.828,280.096C502.828,279.824 501.829,279.732 500.738,280.006L500.829,279.37C500.918,278.46 502.281,278.006 503.01,278.552L503.193,278.642L503.193,278.733L503.192,278.733ZM498.83,285.64C498.194,286.003 497.283,286.275 496.195,286.457C498.194,288.547 499.282,291.637 499.647,294.909C500.918,294.453 502.1,293.818 502.828,292.91C503.556,292.182 501.646,286.094 499.012,285.549C498.92,285.64 498.92,285.64 498.83,285.64" style="fill:rgb(251,250,196);fill-rule:nonzero;"/>
|
1212 |
+
</g>
|
1213 |
+
<g transform="matrix(1,0,0,1,-37.6592,-251.388)">
|
1214 |
+
<path d="M412.685,284.186C411.774,283.641 411.594,280.278 411.501,279.279C411.229,277.007 408.412,276.008 406.595,277.189C403.413,279.46 401.779,283.823 401.325,287.548C400.871,291.364 401.234,296.453 403.96,299.452C406.868,302.724 414.228,303.724 418.59,303.269C419.771,303.178 420.862,302.905 421.953,302.724L424.042,284.004L421.769,284.458C419.498,284.912 414.863,285.368 412.773,284.186L412.685,284.186Z" style="fill:rgb(153,153,102);fill-rule:nonzero;"/>
|
1215 |
+
</g>
|
1216 |
+
<g transform="matrix(1,0,0,1,-37.6592,-251.388)">
|
1217 |
+
<path d="M405.597,280.551C406.142,279.824 406.778,279.097 407.504,278.643C408.232,278.097 409.595,278.552 409.688,279.461L409.776,280.096C408.413,279.642 406.868,280.006 405.597,280.551M403.051,293.364C402.507,290.456 402.78,287.093 403.779,284.186C404.506,283.277 405.233,282.551 406.596,282.005C408.323,281.278 409.232,281.551 410.047,282.278C410.139,283.005 410.323,283.55 410.502,284.095C405.777,285.64 403.778,290.183 403.05,293.454L403.05,293.364L403.051,293.364ZM416.865,286.639C418.5,286.639 420.227,286.457 421.953,286.094L420.318,301.178C418.135,301.633 415.592,301.633 413.321,301.361C411.685,295.545 413.321,288.73 416.955,286.549L416.865,286.639ZM411.776,285.64C412.411,286.003 413.323,286.276 414.41,286.457C411.139,289.911 410.14,296.181 411.323,301.088C408.597,300.543 406.326,299.543 405.143,298.271C404.87,297.998 404.69,297.634 404.416,297.362C404.416,292.182 406.506,286.639 411.504,285.549C411.595,285.64 411.595,285.64 411.688,285.64L411.776,285.64Z" style="fill:rgb(192,192,160);fill-rule:nonzero;"/>
|
1218 |
+
</g>
|
1219 |
+
<g transform="matrix(1,0,0,1,-37.6592,-251.388)">
|
1220 |
+
<path d="M412.685,295.453C414.866,295.999 417.228,296.09 418.955,295.908C419.682,295.817 420.318,295.726 420.954,295.544L422.044,286.185C420.318,286.548 418.591,286.73 416.956,286.73C414.593,288.184 413.048,291.637 412.774,295.453L412.685,295.453ZM406.05,282.277C405.961,282.823 405.87,283.368 405.778,283.912C405.597,285.003 405.597,286.275 405.689,287.548C406.87,286.094 408.414,284.822 410.503,284.095C410.323,283.55 410.14,283.004 410.048,282.277C409.324,281.641 408.325,281.277 406.598,282.005C406.414,282.095 406.233,282.186 406.05,282.277M407.414,278.733C407.141,279.188 406.961,279.642 406.778,280.096C407.777,279.824 408.777,279.732 409.868,280.006L409.776,279.37C409.688,278.46 408.325,278.006 407.596,278.552L407.413,278.642L407.413,278.733L407.414,278.733ZM411.776,285.64C412.412,286.003 413.323,286.275 414.411,286.457C412.412,288.547 411.323,291.637 410.959,294.909C409.688,294.453 408.505,293.818 407.777,292.91C407.051,292.182 408.96,286.094 411.594,285.549C411.685,285.64 411.685,285.64 411.776,285.64" style="fill:rgb(251,250,196);fill-rule:nonzero;"/>
|
1221 |
+
</g>
|
1222 |
+
<g transform="matrix(1,0,0,1,-37.6592,-251.388)">
|
1223 |
+
<path d="M422.77,280.551C419.59,280.278 416.499,280.914 413.41,281.369L416.136,278.733C418.773,276.189 422.316,273.917 425.681,272.281C430.677,269.737 436.403,267.829 442.126,267.284C438.126,265.557 433.583,264.739 429.314,263.739C445.763,260.287 466.843,259.014 481.929,271.827C490.563,279.188 495.287,292.819 495.287,305.177C495.287,351.796 415.866,351.796 415.866,305.177C415.866,298.907 417.41,292.91 420.319,287.457C419.229,287.73 418.229,288.093 417.136,288.548L412.323,290.547L415.773,286.639C417.864,284.277 420.227,282.278 422.953,280.733L422.77,280.551Z" style="fill:rgb(142,212,30);fill-rule:nonzero;"/>
|
1224 |
+
</g>
|
1225 |
+
<g transform="matrix(1,0,0,1,-37.6592,-251.388)">
|
1226 |
+
<path d="M458.393,266.193C466.118,267.101 473.659,269.646 479.927,275.007C487.56,281.459 491.65,293.454 491.65,304.268C491.65,324.076 475.293,334.346 458.392,334.891L458.392,266.193L458.393,266.193Z" style="fill:rgb(112,169,27);fill-rule:nonzero;"/>
|
1227 |
+
</g>
|
1228 |
+
<g transform="matrix(1,0,0,1,-37.6592,-251.388)">
|
1229 |
+
<path d="M429.131,276.28C435.129,272.281 444.944,271.009 456.758,271.646C454.668,269.193 452.76,267.647 449.943,266.284C455.304,266.102 459.574,267.284 470.206,270.919C461.03,265.557 449.763,263.104 439.22,264.285C443.036,265.375 446.671,267.102 450.033,269.374C439.22,268.193 426.769,273.372 421.771,277.643C425.044,277.28 427.95,277.915 431.042,279.279C426.68,280.823 423.862,282.187 421.135,284.822C425.86,282.459 429.586,280.46 435.584,279.188C433.221,278.37 431.949,276.916 429.131,276.28" style="fill:rgb(161,225,65);fill-rule:nonzero;"/>
|
1230 |
+
</g>
|
1231 |
+
<g transform="matrix(1,0,0,1,-37.6592,-251.388)">
|
1232 |
+
<path d="M455.483,265.284C466.39,265.284 475.203,273.826 475.203,284.458C475.203,294.999 466.39,303.632 455.483,303.632C444.58,303.632 435.767,295.09 435.767,284.458C435.765,273.917 444.58,265.284 455.483,265.284" style="fill:rgb(112,169,27);fill-rule:nonzero;"/>
|
1233 |
+
</g>
|
1234 |
+
<g transform="matrix(1,0,0,1,-37.6592,-251.388)">
|
1235 |
+
<path d="M424.225,302.36C424.861,301.178 484.654,300.724 485.836,302.36C487.924,305.086 486.745,307.721 485.836,309.993L424.225,309.993C423.68,307.539 422.771,304.904 424.225,302.36" style="fill:rgb(112,169,27);fill-rule:nonzero;"/>
|
1236 |
+
</g>
|
1237 |
+
<g transform="matrix(1,0,0,1,-37.6592,-251.388)">
|
1238 |
+
<path d="M425.043,304.086C425.679,302.541 483.926,301.905 485.108,304.086C487.107,307.811 485.925,311.446 485.108,314.536L425.043,314.536C424.497,311.173 423.68,307.63 425.043,304.086" style="fill:rgb(75,113,19);fill-rule:nonzero;"/>
|
1239 |
+
</g>
|
1240 |
+
<g transform="matrix(1,0,0,1,-37.6592,-251.388)">
|
1241 |
+
<path d="M473.477,264.467C472.66,248.928 451.758,247.292 446.307,259.469C455.939,254.198 465.752,256.107 473.477,264.467" style="fill:rgb(112,169,27);fill-rule:nonzero;"/>
|
1242 |
+
</g>
|
1243 |
+
<g transform="matrix(1,0,0,1,-37.6592,-251.388)">
|
1244 |
+
<path d="M461.845,251.563C455.759,250.654 449.125,253.29 446.399,259.377C450.033,257.378 453.76,256.47 457.303,256.47C458.031,255.107 459.757,252.472 461.938,251.563L461.845,251.563Z" style="fill:rgb(133,197,31);fill-rule:nonzero;"/>
|
1245 |
+
</g>
|
1246 |
+
<g transform="matrix(1,0,0,1,-37.6592,-251.388)">
|
1247 |
+
<path d="M455.483,263.285C465.297,263.285 473.204,271.191 473.204,281.005C473.204,290.819 465.297,298.725 455.483,298.725C445.671,298.725 437.766,290.819 437.766,281.005C437.766,271.191 445.67,263.285 455.483,263.285" style="fill:rgb(211,232,239);fill-rule:nonzero;"/>
|
1248 |
+
</g>
|
1249 |
+
<g transform="matrix(1,0,0,1,-37.6592,-251.388)">
|
1250 |
+
<path d="M444.308,267.829C450.214,262.922 458.484,262.922 462.663,268.011C466.843,273.009 465.39,281.096 459.483,286.094C453.575,291.001 445.307,291.001 441.125,285.912C436.947,280.914 438.402,272.827 444.308,267.829" style="fill:white;fill-rule:nonzero;"/>
|
1251 |
+
</g>
|
1252 |
+
<g transform="matrix(1,0,0,1,-37.6592,-251.388)">
|
1253 |
+
<path d="M455.938,275.008C462.844,275.008 468.388,280.188 468.388,286.639C468.388,293.091 462.842,298.271 455.938,298.271C449.034,298.271 443.489,293.091 443.489,286.639C443.489,280.188 449.033,275.008 455.938,275.008" style="fill:rgb(13,130,223);fill-rule:nonzero;"/>
|
1254 |
+
</g>
|
1255 |
+
<g transform="matrix(1,0,0,1,-37.6592,-251.388)">
|
1256 |
+
<path d="M455.938,275.008C459.3,275.008 462.39,276.28 464.571,278.279C463.754,281.096 462.027,283.913 459.482,286.094C454.575,290.183 448.034,290.82 443.58,288.093C443.489,287.639 443.489,287.185 443.489,286.639C443.489,280.188 449.033,275.008 455.938,275.008" style="fill:rgb(3,153,237);fill-rule:nonzero;"/>
|
1257 |
+
</g>
|
1258 |
+
<g transform="matrix(1,0,0,1,-37.6592,-251.388)">
|
1259 |
+
<path d="M455.938,279.188C460.3,279.188 463.935,282.55 463.935,286.639C463.935,290.729 460.391,294.09 455.938,294.09C451.577,294.09 447.942,290.729 447.942,286.639C447.942,282.55 451.485,279.188 455.938,279.188" style="fill:rgb(35,35,35);fill-rule:nonzero;"/>
|
1260 |
+
</g>
|
1261 |
+
<g transform="matrix(1,0,0,1,-37.6592,-251.388)">
|
1262 |
+
<path d="M455.938,279.188C458.755,279.188 461.209,280.551 462.663,282.55C461.844,283.822 460.754,285.003 459.482,286.003C456.209,288.73 452.21,289.911 448.668,289.638C448.214,288.73 447.942,287.639 447.942,286.548C447.942,282.459 451.485,279.097 455.938,279.097L455.938,279.188Z" style="fill:rgb(50,50,50);fill-rule:nonzero;"/>
|
1263 |
+
</g>
|
1264 |
+
<g transform="matrix(1,0,0,1,-37.6592,-251.388)">
|
1265 |
+
<path d="M448.941,275.644C452.212,275.644 454.847,278.098 454.847,281.187C454.847,284.277 452.212,286.731 448.941,286.731C445.67,286.731 443.035,284.277 443.035,281.187C443.035,278.098 445.67,275.644 448.941,275.644" style="fill:white;fill-rule:nonzero;"/>
|
1266 |
+
</g>
|
1267 |
+
<g transform="matrix(1,0,0,1,-37.6592,-251.388)">
|
1268 |
+
<path d="M414.138,308.448C441.581,304.359 469.117,304.722 496.56,308.448C498.559,322.805 497.468,336.438 496.56,350.157C469.117,351.248 441.581,351.431 414.138,350.157C412.502,336.255 412.322,322.351 414.138,308.448" style="fill:rgb(156,174,179);fill-rule:nonzero;"/>
|
1269 |
+
</g>
|
1270 |
+
<g transform="matrix(1,0,0,1,-37.6592,-251.388)">
|
1271 |
+
<path d="M422.044,347.341C444.308,348.157 466.481,348.069 488.743,347.341C480.747,342.796 472.75,338.437 463.754,335.983C460.844,337.346 457.757,338.437 454.667,339.345C454.212,339.435 454.212,339.435 453.758,339.345C451.212,338.527 448.669,337.527 446.214,336.438C437.49,338.981 429.585,342.707 421.952,347.433L422.044,347.341ZM416.773,313.173C415.592,324.169 415.773,335.255 416.956,346.25C424.953,341.253 433.494,337.254 442.489,334.438C432.13,328.986 424.86,321.17 416.773,313.173M491.65,310.993C467.389,308.083 443.035,307.811 418.773,310.993C428.768,322.168 439.766,331.348 454.396,336.162C469.933,331.712 480.655,321.988 491.65,310.993M493.741,346.25C494.469,335.255 495.195,324.26 494.014,313.265C485.837,321.353 477.112,329.076 466.934,334.436C476.385,337.253 485.201,341.435 493.834,346.249L493.741,346.249L493.741,346.25Z" style="fill:rgb(211,232,239);fill-rule:nonzero;"/>
|
1272 |
+
</g>
|
1273 |
+
<g transform="matrix(1,0,0,1,-37.6592,-251.388)">
|
1274 |
+
<path d="M422.044,347.341C432.765,347.705 443.487,347.886 454.303,347.886L454.303,339.345C454.212,339.345 454.122,339.345 453.849,339.253C451.305,338.438 448.762,337.437 446.307,336.346C437.583,338.89 429.678,342.615 422.044,347.341M416.773,313.173C415.592,324.169 415.773,335.255 416.956,346.25C424.953,341.253 433.494,337.254 442.489,334.438C432.13,328.986 424.86,321.17 416.773,313.173M454.303,308.72C442.399,308.72 430.586,309.447 418.773,310.994C428.679,322.17 439.766,331.258 454.303,336.163L454.303,308.72Z" style="fill:white;fill-rule:nonzero;"/>
|
1275 |
+
</g>
|
1276 |
+
<g transform="matrix(1,0,0,1,-37.6592,-251.388)">
|
1277 |
+
<path d="M438.855,315.264C438.765,315.627 438.583,315.992 438.403,316.355C438.219,316.9 437.856,317.443 437.403,317.807C436.312,318.625 434.95,318.354 433.766,317.898C431.131,316.807 429.315,314.172 428.223,311.628C426.952,308.718 426.86,306.63 427.587,303.449C445.943,302.45 464.754,302.268 482.564,303.358L482.564,303.449L482.838,303.449C483.111,306.539 482.838,307.811 482.112,310.358C481.293,313.265 479.565,316.807 476.659,318.17C475.568,318.717 474.296,318.989 473.296,318.261C472.843,317.898 472.481,317.353 472.206,316.807C471.57,315.808 471.39,314.356 471.207,313.264C470.844,313.991 470.39,314.445 469.662,314.626C468.481,314.899 467.118,315.079 465.936,315.171C464.755,315.263 463.485,315.355 462.21,315.355C460.302,315.355 458.211,315.171 456.396,314.628C456.124,315.719 455.669,316.716 454.579,317.079C453.398,317.443 451.943,317.626 450.671,317.718C449.308,317.807 447.945,317.899 446.673,317.899C444.583,317.899 442.22,317.718 440.312,316.9C439.584,316.627 439.128,316.081 438.858,315.355L438.858,315.264L438.855,315.264Z" style="fill:rgb(153,153,102);fill-rule:nonzero;"/>
|
1278 |
+
</g>
|
1279 |
+
<g transform="matrix(1,0,0,1,-37.6592,-251.388)">
|
1280 |
+
<path d="M469.66,302.814C470.388,306.903 470.205,312.174 469.024,312.446C467.206,312.901 460.209,313.629 456.757,312.357C455.846,310.631 455.846,306.269 455.938,302.725C460.664,302.724 465.389,302.724 469.66,302.814M440.308,303.632C439.673,305.541 439.037,307.721 438.401,310.358C438.037,311.994 437.764,313.629 437.49,314.809C437.127,316.444 436.309,316.718 434.764,316.081C430.765,314.356 428.678,307.632 428.857,303.541C431.584,303.359 435.674,303.178 440.307,302.996C444.761,302.905 449.759,302.814 454.757,302.814C455.209,307.812 455.209,313.81 454.121,315.081C452.21,315.72 444.761,316.628 441.124,314.992C439.488,314.266 440.124,308.177 440.215,303.724L440.308,303.632ZM470.388,302.814C470.931,304.995 471.568,307.267 472.203,310.175C472.566,311.992 472.75,313.721 473.021,314.9C473.385,316.717 474.112,316.99 475.565,316.264C479.111,314.445 481.11,307.72 481.017,303.269C478.384,303.087 474.658,302.905 470.388,302.814" style="fill:rgb(192,192,160);fill-rule:nonzero;"/>
|
1281 |
+
</g>
|
1282 |
+
<g transform="matrix(1,0,0,1,-37.6592,-251.388)">
|
1283 |
+
<path d="M455.938,305.268C460.209,305.268 464.482,305.268 468.388,305.358C469.024,307.631 469.024,311.72 466.297,312.719C463.39,312.993 459.209,313.082 456.756,312.174C456.121,310.901 455.938,308.084 455.938,305.268M440.217,305.54C444.125,305.449 448.578,305.358 453.031,305.358C453.483,308.63 454.302,315.173 450.213,315.536C447.214,315.809 443.489,315.809 441.125,314.809C439.765,314.173 439.945,309.63 440.126,305.631L440.217,305.54ZM429.041,306.086C430.949,305.904 433.492,305.812 436.49,305.722C436.854,305.722 437.581,314.718 437.581,314.718C437.217,316.354 436.4,316.627 434.855,315.991C431.674,314.628 429.675,310.082 429.129,306.176L429.041,306.086ZM473.022,314.9C473.385,316.717 474.113,316.99 475.566,316.264C478.476,314.809 480.292,310.083 480.838,305.995C479.112,305.812 477.022,305.722 474.566,305.631C473.113,306.722 472.839,314.264 473.022,314.9" style="fill:rgb(251,250,196);fill-rule:nonzero;"/>
|
1284 |
+
</g>
|
1285 |
+
<g transform="matrix(1,0,0,1,-37.6592,-251.388)">
|
1286 |
+
<path d="M448.123,305.449C448.307,308.995 448.123,312.537 447.671,312.809C446.763,313.357 443.4,314.082 441.765,312.719C441.126,312.266 441.218,308.811 441.31,305.54C443.49,305.449 445.763,305.449 448.216,305.358L448.123,305.449ZM463.391,305.358C463.481,307.994 463.299,310.447 462.936,310.629C462.119,311.082 458.937,311.629 457.302,310.538C456.757,310.175 456.757,307.72 456.847,305.268L463.392,305.268L463.392,305.358L463.391,305.358ZM434.675,305.812C434.584,306.812 434.584,307.995 434.584,309.175L434.584,312.809C434.584,314.173 434.221,314.445 433.493,313.809C432.041,312.719 430.767,309.266 430.222,306.086C431.494,305.994 433.04,305.904 434.675,305.812M479.747,305.904C478.563,305.812 477.201,305.722 475.657,305.722C475.657,306.721 475.749,307.811 475.749,308.994L475.749,312.901C475.749,314.355 476.021,314.628 476.748,313.991C478.02,312.809 479.202,309.357 479.747,305.904" style="fill:white;fill-rule:nonzero;"/>
|
1287 |
+
</g>
|
1288 |
+
<g transform="matrix(1,0,0,1,-37.6592,-251.388)">
|
1289 |
+
<path d="M419.591,348.068C418.591,352.611 414.045,355.61 409.504,355.428C403.234,355.154 393.51,348.249 393.692,341.434C393.783,337.618 396.6,334.163 399.508,331.984C402.325,329.8 407.05,327.531 410.686,328.53C414.32,329.53 416.864,334.528 418.046,337.798C419.135,340.616 420.227,345.071 419.498,348.069L419.591,348.069L419.591,348.068Z" style="fill:rgb(133,197,31);fill-rule:nonzero;"/>
|
1290 |
+
</g>
|
1291 |
+
<g transform="matrix(1,0,0,1,-37.6592,-251.388)">
|
1292 |
+
<path d="M418.046,347.613C418.135,347.068 418.228,346.522 418.228,345.886C417.047,340.888 414.229,335.164 411.049,334.256C406.142,332.8 396.238,339.344 396.781,346.069C399.508,350.249 405.325,353.702 409.504,353.882C413.32,354.065 417.228,351.519 418.047,347.703L418.047,347.613L418.046,347.613Z" style="fill:rgb(112,169,27);fill-rule:nonzero;"/>
|
1293 |
+
</g>
|
1294 |
+
<g transform="matrix(1,0,0,1,-37.6592,-251.388)">
|
1295 |
+
<path d="M413.502,342.524C414.773,339.98 412.686,335.527 409.504,335.89C406.142,336.345 398.872,341.343 398.872,345.251C398.872,347.705 402.234,349.432 405.777,348.433C408.413,347.705 412.502,344.615 413.502,342.524M416.319,348.885C416.955,347.34 416.046,344.615 414.229,344.886C412.321,345.251 407.776,348.521 407.959,350.339C408.048,351.794 410.594,353.066 412.594,352.338C414.047,351.794 415.773,350.157 416.319,348.885" style="fill:rgb(93,141,23);fill-rule:nonzero;"/>
|
1296 |
+
</g>
|
1297 |
+
<g transform="matrix(1,0,0,1,-37.6592,-251.388)">
|
1298 |
+
<path d="M408.504,330.712C408.595,332.348 405.414,333.8 404.142,332.62C403.051,330.529 403.326,327.985 404.233,327.44C405.233,326.895 407.687,327.895 408.504,330.712" style="fill:rgb(44,68,12);fill-rule:nonzero;"/>
|
1299 |
+
</g>
|
1300 |
+
<g transform="matrix(1,0,0,1,-37.6592,-251.388)">
|
1301 |
+
<path d="M402.325,333.711C402.686,335.526 400.235,337.073 399.052,336.255C397.508,334.71 396.964,331.984 397.688,331.348C398.417,330.712 401.052,331.712 402.325,333.711" style="fill:rgb(44,68,12);fill-rule:nonzero;"/>
|
1302 |
+
</g>
|
1303 |
+
<g transform="matrix(1,0,0,1,-37.6592,-251.388)">
|
1304 |
+
<path d="M397.69,338.254C398.238,339.436 397.054,341.071 395.691,340.981C394.239,339.89 392.876,337.346 393.419,336.709C393.965,335.983 396.419,336.709 397.69,338.254" style="fill:rgb(44,68,12);fill-rule:nonzero;"/>
|
1305 |
+
</g>
|
1306 |
+
<g transform="matrix(1,0,0,1,-37.6592,-251.388)">
|
1307 |
+
<path d="M420.953,321.352C421.681,319.989 419.682,319.078 418.046,318.442C416.408,317.898 415.592,317.898 414.956,319.261C414.228,320.624 413.865,322.713 415.592,323.258C417.227,323.804 420.317,322.713 421.045,321.35L420.953,321.35L420.953,321.352Z" style="fill:rgb(44,68,12);fill-rule:nonzero;"/>
|
1308 |
+
</g>
|
1309 |
+
<g transform="matrix(1,0,0,1,-37.6592,-251.388)">
|
1310 |
+
<path d="M422.408,316.264C422.59,317.808 420.407,318.626 418.592,318.99C416.865,319.354 416.137,319.171 415.957,317.626C415.773,316.079 416.229,313.628 418.047,313.265C419.771,312.902 422.225,314.718 422.408,316.264" style="fill:rgb(44,68,12);fill-rule:nonzero;"/>
|
1311 |
+
</g>
|
1312 |
+
<g transform="matrix(1,0,0,1,-37.6592,-251.388)">
|
1313 |
+
<path d="M422.77,311.174C422.955,312.629 420.771,313.358 418.956,313.721C417.229,314.082 416.501,313.902 416.321,312.358C416.136,310.903 416.593,308.632 418.319,308.268C420.047,307.904 422.499,309.631 422.682,311.083L422.77,311.174Z" style="fill:rgb(44,68,12);fill-rule:nonzero;"/>
|
1314 |
+
</g>
|
1315 |
+
<g transform="matrix(1,0,0,1,-37.6592,-251.388)">
|
1316 |
+
<path d="M408.504,307.812C408.776,308.996 411.048,308.72 412.775,308.36C414.501,307.905 415.138,307.541 414.774,306.36C414.501,305.178 413.41,303.543 411.687,303.997C409.96,304.451 408.233,306.633 408.504,307.905L408.504,307.812Z" style="fill:rgb(44,68,12);fill-rule:nonzero;"/>
|
1317 |
+
</g>
|
1318 |
+
<g transform="matrix(1,0,0,1,-37.6592,-251.388)">
|
1319 |
+
<path d="M406.96,322.261L407.504,323.805L406.323,322.897C405.776,322.442 405.324,321.806 404.96,321.079C405.049,321.806 405.142,322.262 405.324,322.897C403.598,320.079 402.051,316.99 403.05,312.902C403.961,309.175 407.687,307.448 410.322,306.722C411.957,306.268 413.773,305.995 415.408,306.177C416.408,306.268 418.135,306.54 418.862,307.448C419.589,308.36 419.953,310.266 420.134,311.538C420.406,313.537 420.317,315.627 420.045,317.626C419.771,319.442 419.227,321.17 418.318,322.624C417.591,323.715 416.772,324.532 415.684,324.988C414.409,325.532 413.137,325.623 411.773,325.351C409.958,324.988 408.322,323.897 406.867,322.352L406.96,322.261Z" style="fill:rgb(133,197,31);fill-rule:nonzero;"/>
|
1320 |
+
</g>
|
1321 |
+
<g transform="matrix(1,0,0,1,-37.6592,-251.388)">
|
1322 |
+
<path d="M417.955,308.72C419.046,309.994 419.591,315.357 418.318,319.263C417.955,319.355 417.5,319.445 417.047,319.445C415.047,319.628 413.137,318.72 411.866,317.629C411.957,318.174 412.139,318.537 412.321,318.81C411.23,318.358 410.322,316.994 409.685,315.448C409.774,316.721 409.958,317.266 410.139,317.994C408.775,317.539 407.686,315.994 406.867,314.36C406.14,312.905 406.231,310.814 407.503,309.907C410.865,307.453 416.591,307.271 417.862,308.816L417.955,308.72Z" style="fill:rgb(161,225,65);fill-rule:nonzero;"/>
|
1323 |
+
</g>
|
1324 |
+
<g transform="matrix(1,0,0,1,-37.6592,-251.388)">
|
1325 |
+
<path d="M491.106,348.068C492.105,352.611 496.648,355.61 501.193,355.428C507.462,355.154 517.185,348.249 517.002,341.434C516.914,337.618 514.094,334.163 511.188,331.984C508.371,329.8 503.644,327.531 500.01,328.53C496.377,329.53 493.832,334.528 492.65,337.798C491.559,340.616 490.469,345.071 491.198,348.069L491.106,348.069L491.106,348.068Z" style="fill:rgb(133,197,31);fill-rule:nonzero;"/>
|
1326 |
+
</g>
|
1327 |
+
<g transform="matrix(1,0,0,1,-37.6592,-251.388)">
|
1328 |
+
<path d="M492.561,347.613C492.469,347.068 492.376,346.522 492.376,345.886C493.559,340.888 496.375,335.164 499.556,334.256C504.463,332.8 514.367,339.344 513.823,346.069C511.096,350.249 505.279,353.702 501.101,353.882C497.284,354.065 493.376,351.519 492.558,347.703L492.558,347.613L492.561,347.613Z" style="fill:rgb(112,169,27);fill-rule:nonzero;"/>
|
1329 |
+
</g>
|
1330 |
+
<g transform="matrix(1,0,0,1,-37.6592,-251.388)">
|
1331 |
+
<path d="M497.194,342.524C495.92,339.98 498.01,335.527 501.193,335.89C504.555,336.345 511.824,341.343 511.824,345.251C511.824,347.705 508.462,349.432 504.918,348.433C502.282,347.705 498.194,344.615 497.194,342.524M494.377,348.885C493.741,347.34 494.649,344.615 496.467,344.886C498.375,345.251 502.917,348.521 502.737,350.339C502.646,351.794 500.102,353.066 498.102,352.338C496.648,351.794 494.922,350.157 494.377,348.885" style="fill:rgb(93,141,23);fill-rule:nonzero;"/>
|
1332 |
+
</g>
|
1333 |
+
<g transform="matrix(1,0,0,1,-37.6592,-251.388)">
|
1334 |
+
<path d="M502.102,330.712C502.01,332.348 505.192,333.8 506.463,332.62C507.554,330.529 507.28,327.985 506.373,327.44C505.373,326.895 502.918,327.895 502.102,330.712" style="fill:rgb(44,68,12);fill-rule:nonzero;"/>
|
1335 |
+
</g>
|
1336 |
+
<g transform="matrix(1,0,0,1,-37.6592,-251.388)">
|
1337 |
+
<path d="M508.28,333.711C507.919,335.526 510.37,337.073 511.553,336.255C513.097,334.71 513.641,331.984 512.917,331.348C512.188,330.712 509.552,331.712 508.28,333.711" style="fill:rgb(44,68,12);fill-rule:nonzero;"/>
|
1338 |
+
</g>
|
1339 |
+
<g transform="matrix(1,0,0,1,-37.6592,-251.388)">
|
1340 |
+
<path d="M512.915,338.254C512.368,339.436 513.552,341.071 514.914,340.981C516.366,339.89 517.729,337.346 517.186,336.709C516.64,335.983 514.187,336.709 512.915,338.254" style="fill:rgb(44,68,12);fill-rule:nonzero;"/>
|
1341 |
+
</g>
|
1342 |
+
<g transform="matrix(1,0,0,1,-37.6592,-251.388)">
|
1343 |
+
<path d="M489.651,321.352C488.924,319.989 490.923,319.078 492.561,318.442C494.197,317.898 495.012,317.898 495.649,319.261C496.376,320.624 496.74,322.713 495.012,323.258C493.378,323.804 490.287,322.713 489.56,321.35L489.651,321.35L489.651,321.352Z" style="fill:rgb(44,68,12);fill-rule:nonzero;"/>
|
1344 |
+
</g>
|
1345 |
+
<g transform="matrix(1,0,0,1,-37.6592,-251.388)">
|
1346 |
+
<path d="M488.288,316.264C488.107,317.808 490.287,318.626 492.105,318.99C493.832,319.354 494.559,319.171 494.74,317.626C494.922,316.079 494.469,313.628 492.65,313.265C490.924,312.902 488.471,314.718 488.288,316.264" style="fill:rgb(44,68,12);fill-rule:nonzero;"/>
|
1347 |
+
</g>
|
1348 |
+
<g transform="matrix(1,0,0,1,-37.6592,-251.388)">
|
1349 |
+
<path d="M487.835,311.174C487.651,312.629 489.834,313.358 491.649,313.721C493.376,314.082 494.104,313.902 494.284,312.358C494.469,310.903 494.013,308.632 492.285,308.268C490.559,307.904 488.106,309.631 487.924,311.083L487.835,311.174Z" style="fill:rgb(44,68,12);fill-rule:nonzero;"/>
|
1350 |
+
</g>
|
1351 |
+
<g transform="matrix(1,0,0,1,-37.6592,-251.388)">
|
1352 |
+
<path d="M502.192,307.812C501.918,308.996 499.646,308.72 497.919,308.36C496.195,307.905 495.557,307.541 495.92,306.36C496.195,305.178 497.283,303.543 499.009,303.997C500.737,304.451 502.463,306.633 502.192,307.905L502.192,307.812Z" style="fill:rgb(44,68,12);fill-rule:nonzero;"/>
|
1353 |
+
</g>
|
1354 |
+
<g transform="matrix(1,0,0,1,-37.6592,-251.388)">
|
1355 |
+
<path d="M503.646,322.261L503.101,323.805L504.282,322.897C504.83,322.442 505.282,321.806 505.645,321.079C505.556,321.806 505.464,322.262 505.282,322.897C507.008,320.079 508.555,316.99 507.555,312.902C506.645,309.175 502.918,307.448 500.284,306.722C498.648,306.268 496.833,305.995 495.197,306.177C494.198,306.268 492.471,306.54 491.744,307.448C491.016,308.36 490.653,310.266 490.472,311.538C490.2,313.537 490.288,315.627 490.562,317.626C490.835,319.442 491.378,321.17 492.288,322.624C493.014,323.715 493.834,324.532 494.922,324.988C496.197,325.532 497.468,325.623 498.832,325.351C500.647,324.988 502.283,323.897 503.739,322.352L503.646,322.261Z" style="fill:rgb(133,197,31);fill-rule:nonzero;"/>
|
1356 |
+
</g>
|
1357 |
+
<g transform="matrix(1,0,0,1,-37.6592,-251.388)">
|
1358 |
+
<path d="M492.65,308.72C491.559,309.994 491.014,315.357 492.287,319.263C492.65,319.355 493.105,319.445 493.558,319.445C495.558,319.628 497.467,318.72 498.739,317.629C498.647,318.174 498.466,318.537 498.284,318.81C499.375,318.358 500.283,316.994 500.919,315.448C500.83,316.721 500.646,317.266 500.466,317.994C501.83,317.539 502.918,315.994 503.738,314.36C504.464,312.905 504.374,310.814 503.102,309.907C499.74,307.453 494.014,307.271 492.743,308.816L492.65,308.72Z" style="fill:rgb(161,225,65);fill-rule:nonzero;"/>
|
1359 |
+
</g>
|
1360 |
</svg>';
|
1361 |
}
|
1362 |
|
1369 |
|
1370 |
$screen = get_current_screen();
|
1371 |
|
1372 |
+
$html = '';
|
1373 |
|
1374 |
$html .= '<div class="omapi-static-banner">';
|
1375 |
$html .= '<div class="inner-container">';
|
1378 |
$html .= '<li><a target="_blank" href="' . esc_url_raw( 'https://optinmonster.com/docs/' ) . '">' . __('Need Help?', 'optin-monster-api') . '</a></li>';
|
1379 |
$html .= '<li><a href="' . esc_url_raw( 'https://optinmonster.com/contact-us/' ) . '" target="_blank">' . __('Send Us Feedback', 'optin-monster-api') . '</a></li>';
|
1380 |
if( $screen->id === 'toplevel_page_optin-monster-api-settings' ) {
|
1381 |
+
$html .= '<li class="omapi-menu-button"><a id="omapi-create-new-optin-button" href="https://app.optinmonster.com/campaigns/new/" class="button button-secondary omapi-new-optin" title="' . __( 'Create New Campaign', 'optin-monster-api' ) . '" target="_blank">' . __( 'Create New Campaign', 'optin-monster-api' ) . '</a></li>';
|
1382 |
}
|
1383 |
$html .= '</ul></div>';
|
1384 |
$html .= '</div>';
|
1432 |
// Return the sas link if we have a sas ID
|
1433 |
if ( ! empty( $omSasId ) ) {
|
1434 |
return 'http://www.shareasale.com/r.cfm?u='
|
1435 |
+
. urlencode( trim( $omSasId ) )
|
1436 |
+
. '&b=601672&m=49337&afftrack=&urllink=optinmonster.com';
|
1437 |
}
|
1438 |
|
1439 |
// Return the regular pricing page by default
|
1476 |
// Return the trial link if we have a trial ID
|
1477 |
if ( ! empty( $omTrialId ) ) {
|
1478 |
return 'http://www.shareasale.com/r.cfm?u='
|
1479 |
+
. urlencode( trim( $omTrialId ) )
|
1480 |
+
. '&b=601672&m=49337&afftrack=&urllink=optinmonster.com%2Ffree-trial%2F%3Fid%3D' . urlencode( trim( $omTrialId ) );
|
1481 |
}
|
1482 |
|
1483 |
// Return the regular pricing page by default
|
1512 |
|
1513 |
}
|
1514 |
|
1515 |
+
}
|
OMAPI/Output.php
CHANGED
@@ -1128,7 +1128,7 @@ class OMAPI_Output {
|
|
1128 |
*/
|
1129 |
public function wp_helper() {
|
1130 |
// Only try to use the MailPoet integration if it is active.
|
1131 |
-
if (
|
1132 |
wp_enqueue_script(
|
1133 |
$this->base->plugin_slug . '-wp-helper',
|
1134 |
plugins_url( 'assets/js/helper.js', OMAPI_FILE ),
|
1128 |
*/
|
1129 |
public function wp_helper() {
|
1130 |
// Only try to use the MailPoet integration if it is active.
|
1131 |
+
if ( $this->base->is_mailpoet_active() ) {
|
1132 |
wp_enqueue_script(
|
1133 |
$this->base->plugin_slug . '-wp-helper',
|
1134 |
plugins_url( 'assets/js/helper.js', OMAPI_FILE ),
|
OMAPI/Refresh.php
CHANGED
@@ -151,9 +151,9 @@ class OMAPI_Refresh {
|
|
151 |
public function message() {
|
152 |
|
153 |
?>
|
154 |
-
<div class="updated"><p><?php _e( 'Your
|
155 |
<?php
|
156 |
|
157 |
}
|
158 |
|
159 |
-
}
|
151 |
public function message() {
|
152 |
|
153 |
?>
|
154 |
+
<div class="updated"><p><?php _e( 'Your campaigns have been refreshed successfully.', 'optin-monster-api' ); ?></p></div>
|
155 |
<?php
|
156 |
|
157 |
}
|
158 |
|
159 |
+
}
|
OMAPI/Save.php
CHANGED
@@ -267,7 +267,7 @@ class OMAPI_Save {
|
|
267 |
delete_post_meta( $optin_id, '_omapi_test' );
|
268 |
}
|
269 |
|
270 |
-
if (
|
271 |
$fields['mailpoet'] = isset( $data['mailpoet'] ) ? 1 : 0;
|
272 |
$fields['mailpoet_list'] = isset( $data['mailpoet_list'] ) ? esc_attr( $data['mailpoet_list'] ) : 'none';
|
273 |
}
|
@@ -457,4 +457,4 @@ class OMAPI_Save {
|
|
457 |
|
458 |
}
|
459 |
|
460 |
-
}
|
267 |
delete_post_meta( $optin_id, '_omapi_test' );
|
268 |
}
|
269 |
|
270 |
+
if ( $this->base->is_mailpoet_active() ) {
|
271 |
$fields['mailpoet'] = isset( $data['mailpoet'] ) ? 1 : 0;
|
272 |
$fields['mailpoet_list'] = isset( $data['mailpoet_list'] ) ? esc_attr( $data['mailpoet_list'] ) : 'none';
|
273 |
}
|
457 |
|
458 |
}
|
459 |
|
460 |
+
}
|
OMAPI/Type.php
CHANGED
@@ -75,19 +75,19 @@ class OMAPI_Type {
|
|
75 |
array(
|
76 |
'labels' => apply_filters( 'optin_monster_api_post_type_labels',
|
77 |
array(
|
78 |
-
'name' => _x( '
|
79 |
-
'singular_name' => _x( '
|
80 |
'add_new' => __( 'Add New', 'optin-monster-api' ),
|
81 |
-
'add_new_item' => __( 'Add New
|
82 |
-
'edit_item' => __( 'Edit
|
83 |
-
'new_item' => __( 'New
|
84 |
-
'all_items' => __( '
|
85 |
-
'view_item' => __( 'View
|
86 |
-
'search_items' => __( 'Search
|
87 |
-
'not_found' => __( 'No
|
88 |
-
'not_found_in_trash' => __( 'No
|
89 |
'parent_item_colon' => '',
|
90 |
-
'menu_name' => __( '
|
91 |
)
|
92 |
),
|
93 |
'public' => false,
|
@@ -101,4 +101,4 @@ class OMAPI_Type {
|
|
101 |
|
102 |
}
|
103 |
|
104 |
-
}
|
75 |
array(
|
76 |
'labels' => apply_filters( 'optin_monster_api_post_type_labels',
|
77 |
array(
|
78 |
+
'name' => _x( 'Campaigns', 'post type general name', 'optin-monster-api' ),
|
79 |
+
'singular_name' => _x( 'Campaign', 'post type singular name', 'optin-monster-api' ),
|
80 |
'add_new' => __( 'Add New', 'optin-monster-api' ),
|
81 |
+
'add_new_item' => __( 'Add New Campaign', 'optin-monster-api' ),
|
82 |
+
'edit_item' => __( 'Edit Campaign', 'optin-monster-api' ),
|
83 |
+
'new_item' => __( 'New Campaign', 'optin-monster-api' ),
|
84 |
+
'all_items' => __( 'Campaigns', 'optin-monster-api' ),
|
85 |
+
'view_item' => __( 'View Campaign', 'optin-monster-api' ),
|
86 |
+
'search_items' => __( 'Search Campaigns', 'optin-monster-api' ),
|
87 |
+
'not_found' => __( 'No Campaigns found', 'optin-monster-api' ),
|
88 |
+
'not_found_in_trash' => __( 'No Campaigns found in trash', 'optin-monster-api' ),
|
89 |
'parent_item_colon' => '',
|
90 |
+
'menu_name' => __( 'Campaigns', 'optin-monster-api' )
|
91 |
)
|
92 |
),
|
93 |
'public' => false,
|
101 |
|
102 |
}
|
103 |
|
104 |
+
}
|
OMAPI/Widget.php
CHANGED
@@ -49,7 +49,7 @@ class OMAPI_Widget extends WP_Widget {
|
|
49 |
$widget_ops = apply_filters( 'optin_monster_api_widget_ops',
|
50 |
array(
|
51 |
'classname' => 'optin-monster-api',
|
52 |
-
'description' => __( 'Place an OptinMonster
|
53 |
)
|
54 |
);
|
55 |
|
@@ -171,7 +171,7 @@ class OMAPI_Widget extends WP_Widget {
|
|
171 |
</p>
|
172 |
<?php do_action( 'optin_monster_api_widget_middle_form', $instance ); ?>
|
173 |
<p>
|
174 |
-
<label for="<?php echo $this->get_field_id( 'optin_monster_id' ); ?>"><?php _e( '
|
175 |
<select id="<?php echo esc_attr( $this->get_field_id( 'optin_monster_id' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'optin_monster_id' ) ); ?>" style="width: 100%;">
|
176 |
<?php
|
177 |
foreach ( $optins as $optin ) {
|
@@ -198,4 +198,4 @@ class OMAPI_Widget extends WP_Widget {
|
|
198 |
|
199 |
}
|
200 |
|
201 |
-
}
|
49 |
$widget_ops = apply_filters( 'optin_monster_api_widget_ops',
|
50 |
array(
|
51 |
'classname' => 'optin-monster-api',
|
52 |
+
'description' => __( 'Place an OptinMonster campaign into a widgetized area.', 'optin-monster-api' )
|
53 |
)
|
54 |
);
|
55 |
|
171 |
</p>
|
172 |
<?php do_action( 'optin_monster_api_widget_middle_form', $instance ); ?>
|
173 |
<p>
|
174 |
+
<label for="<?php echo $this->get_field_id( 'optin_monster_id' ); ?>"><?php _e( 'Campaign', 'optin-monster-api' ); ?></label>
|
175 |
<select id="<?php echo esc_attr( $this->get_field_id( 'optin_monster_id' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'optin_monster_id' ) ); ?>" style="width: 100%;">
|
176 |
<?php
|
177 |
foreach ( $optins as $optin ) {
|
198 |
|
199 |
}
|
200 |
|
201 |
+
}
|
assets/js/clipboard.min.js
CHANGED
File without changes
|
assets/js/jspdf.min.js
CHANGED
File without changes
|
includes/class-am-notification.php
ADDED
@@ -0,0 +1,527 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( ! class_exists( 'AM_Notification' ) ) {
|
3 |
+
/**
|
4 |
+
* Awesome Motive Notifications
|
5 |
+
*
|
6 |
+
* This creates a custom post type (if it doesn't exist) and calls the API to
|
7 |
+
* retrieve notifications for this product.
|
8 |
+
*
|
9 |
+
* @package AwesomeMotive
|
10 |
+
* @author Benjamin Rojas
|
11 |
+
* @license GPL-2.0+
|
12 |
+
* @copyright Copyright (c) 2017, Retyp LLC
|
13 |
+
* @version 1.0.0
|
14 |
+
*/
|
15 |
+
class AM_Notification {
|
16 |
+
/**
|
17 |
+
* The api url we are calling.
|
18 |
+
*
|
19 |
+
* @since 1.0.0
|
20 |
+
*
|
21 |
+
* @var string
|
22 |
+
*/
|
23 |
+
public $api_url = 'https://api.awesomemotive.com/v1/notification/';
|
24 |
+
|
25 |
+
/**
|
26 |
+
* A unique slug for this plugin.
|
27 |
+
* (Not the WordPress plugin slug)
|
28 |
+
*
|
29 |
+
* @since 1.0.0
|
30 |
+
*
|
31 |
+
* @var string
|
32 |
+
*/
|
33 |
+
public $plugin;
|
34 |
+
|
35 |
+
/**
|
36 |
+
* The current plugin version.
|
37 |
+
*
|
38 |
+
* @since 1.0.0
|
39 |
+
*
|
40 |
+
* @var string
|
41 |
+
*/
|
42 |
+
public $plugin_version;
|
43 |
+
|
44 |
+
/**
|
45 |
+
* The list of installed plugins.
|
46 |
+
*
|
47 |
+
* @since 1.0.0
|
48 |
+
*
|
49 |
+
* @var array
|
50 |
+
*/
|
51 |
+
public $plugin_list = array();
|
52 |
+
|
53 |
+
/**
|
54 |
+
* The list of installed themes.
|
55 |
+
*
|
56 |
+
* @since 1.0.0
|
57 |
+
*
|
58 |
+
* @var string
|
59 |
+
*/
|
60 |
+
public $theme_list = array();
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Flag if a notice has been registered.
|
64 |
+
*
|
65 |
+
* @since 1.0.0
|
66 |
+
*
|
67 |
+
* @var bool
|
68 |
+
*/
|
69 |
+
public static $registered = false;
|
70 |
+
|
71 |
+
/**
|
72 |
+
* Construct.
|
73 |
+
*
|
74 |
+
* @since 1.0.0
|
75 |
+
*
|
76 |
+
* @param string $plugin The plugin slug.
|
77 |
+
* @param mixed $version The version of the plugin.
|
78 |
+
*/
|
79 |
+
public function __construct( $plugin = '', $version = 0 ) {
|
80 |
+
$this->plugin = $plugin;
|
81 |
+
$this->plugin_version = $version;
|
82 |
+
|
83 |
+
add_action( 'init', array( $this, 'custom_post_type' ) );
|
84 |
+
add_action( 'admin_init', array( $this, 'get_remote_notifications' ), 100 );
|
85 |
+
add_action( 'admin_notices', array( $this, 'display_notifications' ) );
|
86 |
+
add_action( 'wp_ajax_am_notification_dismiss', array( $this, 'dismiss_notification' ) );
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* Registers a custom post type.
|
91 |
+
*
|
92 |
+
* @since 1.0.0
|
93 |
+
*/
|
94 |
+
public function custom_post_type() {
|
95 |
+
register_post_type( 'amn_' . $this->plugin, array(
|
96 |
+
'supports' => false,
|
97 |
+
) );
|
98 |
+
}
|
99 |
+
|
100 |
+
/**
|
101 |
+
* Retrieve the remote notifications if the time has expired.
|
102 |
+
*
|
103 |
+
* @since 1.0.0
|
104 |
+
*/
|
105 |
+
public function get_remote_notifications() {
|
106 |
+
if ( ! current_user_can( apply_filters( 'am_notifications_display', 'manage_options' ) ) ) {
|
107 |
+
return;
|
108 |
+
}
|
109 |
+
|
110 |
+
$last_checked = get_option( '_amn_' . $this->plugin . '_last_checked', strtotime( '-1 week' ) );
|
111 |
+
|
112 |
+
if ( $last_checked < strtotime( 'today midnight' ) ) {
|
113 |
+
$plugin_notifications = $this->get_plugin_notifications( 1 );
|
114 |
+
$notification_id = null;
|
115 |
+
|
116 |
+
if ( ! empty( $plugin_notifications ) ) {
|
117 |
+
// Unset it from the array.
|
118 |
+
$notification = $plugin_notifications[0];
|
119 |
+
$notification_id = get_post_meta( $notification->ID, 'notification_id', true );
|
120 |
+
}
|
121 |
+
|
122 |
+
$response = wp_remote_retrieve_body( wp_remote_post( $this->api_url, array(
|
123 |
+
'body' => array(
|
124 |
+
'slug' => $this->plugin,
|
125 |
+
'version' => $this->plugin_version,
|
126 |
+
'last_notification' => $notification_id,
|
127 |
+
'plugins' => $this->get_plugins_list(),
|
128 |
+
'themes' => $this->get_themes_list(),
|
129 |
+
),
|
130 |
+
) ) );
|
131 |
+
|
132 |
+
$data = json_decode( $response );
|
133 |
+
|
134 |
+
if ( ! empty( $data->id ) ) {
|
135 |
+
$notifications = array();
|
136 |
+
|
137 |
+
foreach ( (array) $data->slugs as $slug ) {
|
138 |
+
$notifications = array_merge(
|
139 |
+
$notifications,
|
140 |
+
(array) get_posts(
|
141 |
+
array(
|
142 |
+
'post_type' => 'amn_' . $slug,
|
143 |
+
'post_status' => 'all',
|
144 |
+
'meta_key' => 'notification_id',
|
145 |
+
'meta_value' => $data->id,
|
146 |
+
)
|
147 |
+
)
|
148 |
+
);
|
149 |
+
}
|
150 |
+
|
151 |
+
if ( empty( $notifications ) ) {
|
152 |
+
$new_notification_id = wp_insert_post( array(
|
153 |
+
'post_content' => wp_kses_post( $data->content ),
|
154 |
+
'post_type' => 'amn_' . $this->plugin,
|
155 |
+
) );
|
156 |
+
|
157 |
+
update_post_meta( $new_notification_id, 'notification_id', absint( $data->id ) );
|
158 |
+
update_post_meta( $new_notification_id, 'type', sanitize_text_field( trim( $data->type ) ) );
|
159 |
+
update_post_meta( $new_notification_id, 'dismissable', (bool) $data->dismissible ? 1 : 0 );
|
160 |
+
update_post_meta( $new_notification_id, 'location', function_exists( 'wp_json_encode' ) ? wp_json_encode( $data->location ) : json_encode( $data->location ) );
|
161 |
+
update_post_meta( $new_notification_id, 'plugins', function_exists( 'wp_json_encode' ) ? wp_json_encode( $data->plugins ) : json_encode( $data->plugins ) );
|
162 |
+
update_post_meta( $new_notification_id, 'theme', sanitize_text_field( trim( $data->theme ) ) );
|
163 |
+
update_post_meta( $new_notification_id, 'version', sanitize_text_field( trim( $data->version ) ) );
|
164 |
+
update_post_meta( $new_notification_id, 'viewed', 0 );
|
165 |
+
update_post_meta( $new_notification_id, 'expiration', $data->expiration ? absint( $data->expiration ) : false );
|
166 |
+
update_post_meta( $new_notification_id, 'plans', function_exists( 'wp_json_encode' ) ? wp_json_encode( $data->plans ) : json_encode( $data->plans ) );
|
167 |
+
}
|
168 |
+
}
|
169 |
+
|
170 |
+
// Possibly revoke notifications.
|
171 |
+
if ( ! empty( $data->revoked ) ) {
|
172 |
+
$this->revoke_notifications( $data->revoked );
|
173 |
+
}
|
174 |
+
|
175 |
+
// Set the option now so we can't run this again until after 24 hours.
|
176 |
+
update_option( '_amn_' . $this->plugin . '_last_checked', strtotime( 'today midnight' ) );
|
177 |
+
}
|
178 |
+
}
|
179 |
+
|
180 |
+
/**
|
181 |
+
* Get local plugin notifications that have already been set.
|
182 |
+
*
|
183 |
+
* @since 1.0.0
|
184 |
+
*
|
185 |
+
* @param integer $limit Set the limit for how many posts to retrieve.
|
186 |
+
* @param array $args Any top-level arguments to add to the array.
|
187 |
+
*
|
188 |
+
* @return WP_Post[] WP_Post that match the query.
|
189 |
+
*/
|
190 |
+
public function get_plugin_notifications( $limit = -1, $args = array() ) {
|
191 |
+
return get_posts(
|
192 |
+
array(
|
193 |
+
'showposts' => $limit,
|
194 |
+
'post_type' => 'amn_' . $this->plugin,
|
195 |
+
) + $args
|
196 |
+
);
|
197 |
+
}
|
198 |
+
|
199 |
+
/**
|
200 |
+
* Retrieve a list of plugins that are currently installed.
|
201 |
+
*
|
202 |
+
* @since 1.0.0
|
203 |
+
*
|
204 |
+
* @return array An array of plugins that are currently installed.
|
205 |
+
*/
|
206 |
+
public function get_plugins_list() {
|
207 |
+
if ( ! empty( $this->plugin_list ) ) {
|
208 |
+
return $this->plugin_list;
|
209 |
+
}
|
210 |
+
|
211 |
+
if ( ! function_exists( 'get_plugins' ) ) {
|
212 |
+
require_once ABSPATH . 'wp-admin/includes/plugin.php';
|
213 |
+
}
|
214 |
+
|
215 |
+
$plugins = get_plugins();
|
216 |
+
|
217 |
+
foreach ( $plugins as $slug => $plugin ) {
|
218 |
+
$this->plugin_list[ $slug ] = array(
|
219 |
+
'slug' => $slug,
|
220 |
+
'name' => $plugin['Name'],
|
221 |
+
'version' => $plugin['Version'],
|
222 |
+
'active' => is_plugin_active( $slug ),
|
223 |
+
);
|
224 |
+
}
|
225 |
+
|
226 |
+
return $this->plugin_list;
|
227 |
+
}
|
228 |
+
|
229 |
+
/**
|
230 |
+
* Retrieve a list of themes that are currently installed.
|
231 |
+
*
|
232 |
+
* @since 1.0.0
|
233 |
+
*
|
234 |
+
* @return array An array of themes that are currently installed.
|
235 |
+
*/
|
236 |
+
public function get_themes_list() {
|
237 |
+
if ( ! empty( $this->theme_list ) ) {
|
238 |
+
return $this->theme_list;
|
239 |
+
}
|
240 |
+
|
241 |
+
$themes = wp_get_themes();
|
242 |
+
|
243 |
+
foreach ( $themes as $slug => $theme ) {
|
244 |
+
$this->theme_list[ $slug ] = array(
|
245 |
+
'slug' => $slug,
|
246 |
+
'name' => $theme->Name,
|
247 |
+
'version' => $theme->Version,
|
248 |
+
'active' => (string) wp_get_theme() === $theme->Name,
|
249 |
+
);
|
250 |
+
}
|
251 |
+
|
252 |
+
return $this->theme_list;
|
253 |
+
}
|
254 |
+
|
255 |
+
/**
|
256 |
+
* Display any notifications that should be displayed.
|
257 |
+
*
|
258 |
+
* @since 1.0.0
|
259 |
+
*/
|
260 |
+
public function display_notifications() {
|
261 |
+
if ( ! current_user_can( apply_filters( 'am_notifications_display', 'manage_options' ) ) ) {
|
262 |
+
return;
|
263 |
+
}
|
264 |
+
|
265 |
+
$plugin_notifications = $this->get_plugin_notifications( -1, array(
|
266 |
+
'post_status' => 'all',
|
267 |
+
'meta_key' => 'viewed',
|
268 |
+
'meta_value' => '0',
|
269 |
+
) );
|
270 |
+
|
271 |
+
$plugin_notifications = $this->validate_notifications( $plugin_notifications );
|
272 |
+
|
273 |
+
if ( ! empty( $plugin_notifications ) && ! self::$registered ) {
|
274 |
+
foreach ( $plugin_notifications as $notification ) {
|
275 |
+
$dismissable = get_post_meta( $notification->ID, 'dismissable', true );
|
276 |
+
$type = get_post_meta( $notification->ID, 'type', true );
|
277 |
+
?>
|
278 |
+
<div class="am-notification am-notification-<?php echo $notification->ID; ?> notice notice-<?php echo $type; ?><?php echo $dismissable ? ' is-dismissible' : ''; ?>">
|
279 |
+
<?php echo $notification->post_content; ?>
|
280 |
+
</div>
|
281 |
+
<script type="text/javascript">
|
282 |
+
jQuery(document).ready(function ($) {
|
283 |
+
$(document).on('click', '.am-notification-<?php echo $notification->ID; ?> button.notice-dismiss', function (event) {
|
284 |
+
$.post(ajaxurl, {
|
285 |
+
action: 'am_notification_dismiss',
|
286 |
+
notification_id: '<?php echo $notification->ID; ?>'
|
287 |
+
});
|
288 |
+
});
|
289 |
+
});
|
290 |
+
</script>
|
291 |
+
<?php
|
292 |
+
}
|
293 |
+
|
294 |
+
self::$registered = true;
|
295 |
+
}
|
296 |
+
}
|
297 |
+
|
298 |
+
/**
|
299 |
+
* Validate the notifications before displaying them.
|
300 |
+
*
|
301 |
+
* @since 1.0.0
|
302 |
+
*
|
303 |
+
* @param array $plugin_notifications An array of plugin notifications.
|
304 |
+
*
|
305 |
+
* @return array A filtered array of plugin notifications.
|
306 |
+
*/
|
307 |
+
public function validate_notifications( $plugin_notifications ) {
|
308 |
+
global $pagenow;
|
309 |
+
|
310 |
+
foreach ( $plugin_notifications as $key => $notification ) {
|
311 |
+
// Location validation.
|
312 |
+
$location = (array) json_decode( get_post_meta( $notification->ID, 'location', true ) );
|
313 |
+
$continue = false;
|
314 |
+
if ( ! in_array( 'everywhere', $location, true ) ) {
|
315 |
+
if ( in_array( 'index.php', $location, true ) && 'index.php' === $pagenow ) {
|
316 |
+
$continue = true;
|
317 |
+
}
|
318 |
+
|
319 |
+
if ( in_array( 'plugins.php', $location, true ) && 'plugins.php' === $pagenow ) {
|
320 |
+
$continue = true;
|
321 |
+
}
|
322 |
+
|
323 |
+
if ( ! $continue ) {
|
324 |
+
unset( $plugin_notifications[ $key ] );
|
325 |
+
}
|
326 |
+
}
|
327 |
+
|
328 |
+
// Plugin validation (OR conditional).
|
329 |
+
$plugins = (array) json_decode( get_post_meta( $notification->ID, 'plugins', true ) );
|
330 |
+
$continue = false;
|
331 |
+
if ( ! empty( $plugins ) ) {
|
332 |
+
foreach ( $plugins as $plugin ) {
|
333 |
+
if ( is_plugin_active( $plugin ) ) {
|
334 |
+
$continue = true;
|
335 |
+
}
|
336 |
+
}
|
337 |
+
|
338 |
+
if ( ! $continue ) {
|
339 |
+
unset( $plugin_notifications[ $key ] );
|
340 |
+
}
|
341 |
+
}
|
342 |
+
|
343 |
+
// Theme validation.
|
344 |
+
$theme = get_post_meta( $notification->ID, 'theme', true );
|
345 |
+
$continue = (string) wp_get_theme() === $theme;
|
346 |
+
|
347 |
+
if ( ! empty( $theme ) && ! $continue ) {
|
348 |
+
unset( $plugin_notifications[ $key ] );
|
349 |
+
}
|
350 |
+
|
351 |
+
// Version validation.
|
352 |
+
$version = get_post_meta( $notification->ID, 'version', true );
|
353 |
+
$continue = false;
|
354 |
+
if ( ! empty( $version ) ) {
|
355 |
+
if ( version_compare( $this->plugin_version, $version, '<=' ) ) {
|
356 |
+
$continue = true;
|
357 |
+
}
|
358 |
+
|
359 |
+
if ( ! $continue ) {
|
360 |
+
unset( $plugin_notifications[ $key ] );
|
361 |
+
}
|
362 |
+
}
|
363 |
+
|
364 |
+
// Expiration validation.
|
365 |
+
$expiration = get_post_meta( $notification->ID, 'expiration', true );
|
366 |
+
$continue = false;
|
367 |
+
if ( ! empty( $expiration ) ) {
|
368 |
+
if ( $expiration > time() ) {
|
369 |
+
$continue = true;
|
370 |
+
}
|
371 |
+
|
372 |
+
if ( ! $continue ) {
|
373 |
+
unset( $plugin_notifications[ $key ] );
|
374 |
+
}
|
375 |
+
}
|
376 |
+
|
377 |
+
// Plan validation.
|
378 |
+
$plans = (array) json_decode( get_post_meta( $notification->ID, 'plans', true ) );
|
379 |
+
$continue = false;
|
380 |
+
if ( ! empty( $plans ) ) {
|
381 |
+
$level = $this->get_plan_level();
|
382 |
+
if ( in_array( $level, $plans, true ) ) {
|
383 |
+
$continue = true;
|
384 |
+
}
|
385 |
+
|
386 |
+
if ( ! $continue ) {
|
387 |
+
unset( $plugin_notifications[ $key ] );
|
388 |
+
}
|
389 |
+
}
|
390 |
+
}
|
391 |
+
|
392 |
+
return $plugin_notifications;
|
393 |
+
}
|
394 |
+
|
395 |
+
/**
|
396 |
+
* Grab the current plan level.
|
397 |
+
*
|
398 |
+
* @since 1.0.0
|
399 |
+
*
|
400 |
+
* @return string The current plan level.
|
401 |
+
*/
|
402 |
+
public function get_plan_level() {
|
403 |
+
// Prepare variables.
|
404 |
+
$key = '';
|
405 |
+
$level = '';
|
406 |
+
$option = false;
|
407 |
+
switch ( $this->plugin ) {
|
408 |
+
case 'wpforms' :
|
409 |
+
$option = get_option( 'wpforms_license' );
|
410 |
+
$key = is_array( $option ) && isset( $option['key'] ) ? $option['key'] : '';
|
411 |
+
$level = is_array( $option ) && isset( $option['type'] ) ? $option['type'] : '';
|
412 |
+
|
413 |
+
// Possibly check for a constant.
|
414 |
+
if ( empty( $key ) && defined( 'WPFORMS_LICENSE_KEY' ) ) {
|
415 |
+
$key = WPFORMS_LICENSE_KEY;
|
416 |
+
}
|
417 |
+
break;
|
418 |
+
case 'mi' :
|
419 |
+
$option = get_option( 'monsterinsights_license' );
|
420 |
+
$key = is_array( $option ) && isset( $option['key'] ) ? $option['key'] : '';
|
421 |
+
$level = is_array( $option ) && isset( $option['type'] ) ? $option['type'] : '';
|
422 |
+
|
423 |
+
// Possibly check for a constant.
|
424 |
+
if ( empty( $key ) && defined( 'MONSTERINSIGHTS_LICENSE_KEY' ) && is_string( MONSTERINSIGHTS_LICENSE_KEY ) && strlen( MONSTERINSIGHTS_LICENSE_KEY ) > 10 ) {
|
425 |
+
$key = MONSTERINSIGHTS_LICENSE_KEY;
|
426 |
+
}
|
427 |
+
break;
|
428 |
+
case 'sol' :
|
429 |
+
$option = get_option( 'soliloquy' );
|
430 |
+
$key = is_array( $option ) && isset( $option['key'] ) ? $option['key'] : '';
|
431 |
+
$level = is_array( $option ) && isset( $option['type'] ) ? $option['type'] : '';
|
432 |
+
|
433 |
+
// Possibly check for a constant.
|
434 |
+
if ( empty( $key ) && defined( 'SOLILOQUY_LICENSE_KEY' ) ) {
|
435 |
+
$key = SOLILOQUY_LICENSE_KEY;
|
436 |
+
}
|
437 |
+
break;
|
438 |
+
case 'envira' :
|
439 |
+
$option = get_option( 'envira_gallery' );
|
440 |
+
$key = is_array( $option ) && isset( $option['key'] ) ? $option['key'] : '';
|
441 |
+
$level = is_array( $option ) && isset( $option['type'] ) ? $option['type'] : '';
|
442 |
+
|
443 |
+
// Possibly check for a constant.
|
444 |
+
if ( empty( $key ) && defined( 'ENVIRA_LICENSE_KEY' ) ) {
|
445 |
+
$key = ENVIRA_LICENSE_KEY;
|
446 |
+
}
|
447 |
+
break;
|
448 |
+
case 'om' :
|
449 |
+
$option = get_option( 'optin_monster_api' );
|
450 |
+
$key = is_array( $option ) && isset( $option['api']['apikey'] ) ? $option['api']['apikey'] : '';
|
451 |
+
|
452 |
+
// Possibly check for a constant.
|
453 |
+
if ( empty( $key ) && defined( 'OPTINMONSTER_REST_API_LICENSE_KEY' ) ) {
|
454 |
+
$key = OPTINMONSTER_REST_API_LICENSE_KEY;
|
455 |
+
}
|
456 |
+
|
457 |
+
// If the key is still empty, check for the old legacy key.
|
458 |
+
if ( empty( $key ) ) {
|
459 |
+
$key = is_array( $option ) && isset( $option['api']['key'] ) ? $option['api']['key'] : '';
|
460 |
+
}
|
461 |
+
break;
|
462 |
+
}
|
463 |
+
|
464 |
+
// Possibly set the level to 'none' if the key is empty and no level has been set.
|
465 |
+
if ( empty( $key ) && empty( $level ) ) {
|
466 |
+
$level = 'none';
|
467 |
+
}
|
468 |
+
|
469 |
+
// Normalize the level.
|
470 |
+
switch ( $level ) {
|
471 |
+
case 'bronze' :
|
472 |
+
case 'personal' :
|
473 |
+
$level = 'basic';
|
474 |
+
break;
|
475 |
+
case 'silver' :
|
476 |
+
case 'multi' :
|
477 |
+
$level = 'plus';
|
478 |
+
break;
|
479 |
+
case 'gold' :
|
480 |
+
case 'developer' :
|
481 |
+
$level = 'pro';
|
482 |
+
break;
|
483 |
+
case 'platinum' :
|
484 |
+
case 'master' :
|
485 |
+
$level = 'ultimate';
|
486 |
+
break;
|
487 |
+
}
|
488 |
+
|
489 |
+
// Return the plan level.
|
490 |
+
return $level;
|
491 |
+
}
|
492 |
+
|
493 |
+
/**
|
494 |
+
* Dismiss the notification via AJAX.
|
495 |
+
*
|
496 |
+
* @since 1.0.0
|
497 |
+
*/
|
498 |
+
public function dismiss_notification() {
|
499 |
+
if ( ! current_user_can( apply_filters( 'am_notifications_display', 'manage_options' ) ) ) {
|
500 |
+
die;
|
501 |
+
}
|
502 |
+
|
503 |
+
$notification_id = intval( $_POST['notification_id'] );
|
504 |
+
update_post_meta( $notification_id, 'viewed', 1 );
|
505 |
+
die;
|
506 |
+
}
|
507 |
+
|
508 |
+
/**
|
509 |
+
* Revokes notifications.
|
510 |
+
*
|
511 |
+
* @since 1.0.0
|
512 |
+
*
|
513 |
+
* @param array $ids An array of notification IDs to revoke.
|
514 |
+
*/
|
515 |
+
public function revoke_notifications( $ids ) {
|
516 |
+
// Loop through each of the IDs and find the post that has it as meta.
|
517 |
+
foreach ( (array) $ids as $id ) {
|
518 |
+
$notifications = $this->get_plugin_notifications( -1, array( 'post_status' => 'all', 'meta_key' => 'notification_id', 'meta_value' => $id ) );
|
519 |
+
if ( $notifications ) {
|
520 |
+
foreach ( $notifications as $notification ) {
|
521 |
+
update_post_meta( $notification->ID, 'viewed', 1 );
|
522 |
+
}
|
523 |
+
}
|
524 |
+
}
|
525 |
+
}
|
526 |
+
}
|
527 |
+
}
|
optin-monster-wp-api.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* Description: OptinMonster API plugin to connect your WordPress site to your OptinMonster account.
|
6 |
* Author: OptinMonster Team
|
7 |
* Author URI: https://optinmonster.com
|
8 |
-
* Version: 1.
|
9 |
* Text Domain: optin-monster-api
|
10 |
* Domain Path: languages
|
11 |
*
|
@@ -60,7 +60,7 @@ class OMAPI {
|
|
60 |
*
|
61 |
* @var string
|
62 |
*/
|
63 |
-
public $version = '1.
|
64 |
|
65 |
/**
|
66 |
* The name of the plugin.
|
@@ -200,15 +200,19 @@ class OMAPI {
|
|
200 |
*/
|
201 |
public function load_admin() {
|
202 |
|
|
|
|
|
|
|
203 |
// Register admin components.
|
204 |
-
$this->actions
|
205 |
-
$this->menu
|
206 |
-
$this->content
|
207 |
-
$this->save
|
208 |
-
$this->refresh
|
209 |
-
$this->validate
|
210 |
-
$this->welcome
|
211 |
-
$this->review
|
|
|
212 |
|
213 |
// Fire a hook to say that the admin classes are loaded.
|
214 |
do_action( 'optin_monster_api_admin_loaded' );
|
@@ -310,13 +314,13 @@ class OMAPI {
|
|
310 |
|
311 |
|
312 |
// Attempt to grab the new API Key
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
|
321 |
// Attempt to grab the Legacy API key and API user.
|
322 |
if ( empty( $option['api']['key'] ) ) {
|
@@ -337,11 +341,11 @@ class OMAPI {
|
|
337 |
|
338 |
// Check if we have any of the authentication data
|
339 |
if ( ! $apikey ) {
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
|
346 |
|
347 |
// Return the API credentials.
|
@@ -349,7 +353,7 @@ class OMAPI {
|
|
349 |
array(
|
350 |
'key' => $key,
|
351 |
'user' => $user,
|
352 |
-
|
353 |
)
|
354 |
);
|
355 |
|
@@ -395,19 +399,30 @@ class OMAPI {
|
|
395 |
return false;
|
396 |
}
|
397 |
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
public function is_woocommerce_active() {
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
411 |
|
412 |
/**
|
413 |
* Returns possible API key error flag.
|
@@ -424,17 +439,17 @@ class OMAPI {
|
|
424 |
}
|
425 |
|
426 |
/**
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
|
435 |
-
|
436 |
|
437 |
-
|
438 |
|
439 |
/**
|
440 |
* Loads the default plugin options.
|
5 |
* Description: OptinMonster API plugin to connect your WordPress site to your OptinMonster account.
|
6 |
* Author: OptinMonster Team
|
7 |
* Author URI: https://optinmonster.com
|
8 |
+
* Version: 1.3.0
|
9 |
* Text Domain: optin-monster-api
|
10 |
* Domain Path: languages
|
11 |
*
|
60 |
*
|
61 |
* @var string
|
62 |
*/
|
63 |
+
public $version = '1.3.0';
|
64 |
|
65 |
/**
|
66 |
* The name of the plugin.
|
200 |
*/
|
201 |
public function load_admin() {
|
202 |
|
203 |
+
// Manually load notification api.
|
204 |
+
require_once plugin_dir_path( __FILE__ ) . 'includes/class-am-notification.php';
|
205 |
+
|
206 |
// Register admin components.
|
207 |
+
$this->actions = new OMAPI_Actions();
|
208 |
+
$this->menu = new OMAPI_Menu();
|
209 |
+
$this->content = new OMAPI_Content();
|
210 |
+
$this->save = new OMAPI_Save();
|
211 |
+
$this->refresh = new OMAPI_Refresh();
|
212 |
+
$this->validate = new OMAPI_Validate();
|
213 |
+
$this->welcome = new OMAPI_Welcome();
|
214 |
+
$this->review = new OMAPI_Review();
|
215 |
+
$this->notifications = new AM_Notification( 'om', $this->version );
|
216 |
|
217 |
// Fire a hook to say that the admin classes are loaded.
|
218 |
do_action( 'optin_monster_api_admin_loaded' );
|
314 |
|
315 |
|
316 |
// Attempt to grab the new API Key
|
317 |
+
if ( empty( $option['api']['apikey'] ) ) {
|
318 |
+
if ( defined( 'OPTINMONSTER_REST_API_LICENSE_KEY' ) ) {
|
319 |
+
$apikey = OPTINMONSTER_REST_API_LICENSE_KEY;
|
320 |
+
}
|
321 |
+
} else {
|
322 |
+
$apikey = $option['api']['apikey'];
|
323 |
+
}
|
324 |
|
325 |
// Attempt to grab the Legacy API key and API user.
|
326 |
if ( empty( $option['api']['key'] ) ) {
|
341 |
|
342 |
// Check if we have any of the authentication data
|
343 |
if ( ! $apikey ) {
|
344 |
+
// Do we at least have Legacy API Key and User
|
345 |
+
if ( ! $key || ! $user ) {
|
346 |
+
return false;
|
347 |
+
}
|
348 |
+
}
|
349 |
|
350 |
|
351 |
// Return the API credentials.
|
353 |
array(
|
354 |
'key' => $key,
|
355 |
'user' => $user,
|
356 |
+
'apikey' => $apikey,
|
357 |
)
|
358 |
);
|
359 |
|
399 |
return false;
|
400 |
}
|
401 |
|
402 |
+
/**
|
403 |
+
* Check if the main WooCommerce class is active.
|
404 |
+
*
|
405 |
+
* @since 1.1.9
|
406 |
+
*
|
407 |
+
* @return bool
|
408 |
+
*/
|
409 |
public function is_woocommerce_active() {
|
410 |
+
if (class_exists( 'WooCommerce' ) ) {
|
411 |
+
return true;
|
412 |
+
}
|
413 |
+
return false;
|
414 |
+
}
|
415 |
+
|
416 |
+
/**
|
417 |
+
* Check to see if Mailpoet is active.
|
418 |
+
*
|
419 |
+
* @since 1.2.3
|
420 |
+
*
|
421 |
+
* @return bool
|
422 |
+
*/
|
423 |
+
public function is_mailpoet_active() {
|
424 |
+
return ( class_exists( 'WYSIJA_object' ) || class_exists( '\\MailPoet\\Config\\Initializer' ) );
|
425 |
+
}
|
426 |
|
427 |
/**
|
428 |
* Returns possible API key error flag.
|
439 |
}
|
440 |
|
441 |
/**
|
442 |
+
* Retrieves the proper default view for the OptinMonster settings page.
|
443 |
+
*
|
444 |
+
* @since 1.0.0
|
445 |
+
*
|
446 |
+
* @return string $view The default view for the OptinMonster settings page.
|
447 |
+
*/
|
448 |
+
public function get_view() {
|
449 |
|
450 |
+
return $this->get_api_credentials() ? 'optins' : 'api';
|
451 |
|
452 |
+
}
|
453 |
|
454 |
/**
|
455 |
* Loads the default plugin options.
|
readme.txt
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
Contributors: optinmonster, griffinjt, smub
|
3 |
Tags: wordpress popup, popup, lightbox popup, mailchimp, aweber, campaign monitor, constant contact, exit-intent, madmimi, infusionsoft, getresponse, hubspot, marketo, activecampaign, pardot, totalsend, emma, icontact, mailerlite, mailpoet, google analytics, pop over, optin forms, email list, subscribers, wordpress popup form, lightbox, wordpress popups, popups, lightbox popups, optin form, wordpress optin form, sidebar optin form, sidebar optin, sidebar form, wordpress overlay popup, wordpress popup plugin, popup plugin, wordpress lightbox optin, wordpress lightbox optin form, after post optin form, wordpress after post optin form, after post optin form plugin, lightbox popup plugin, wordpress popup solution, exit intent, exit-intent, optinmonster, optin monster, optin-monster, mobile popup, mobile popups, mobile optin forms, mobile optins, lightbox optins, wordpress mobile popup, wordpress mobile popups, wordpress mobile optin forms, wordpress lightbox optins, lead gen, lead generation, wordpress lead generation, lead generation wordpress, wordpress lead gen, fullscreen, welcome gate, interstitial
|
4 |
Requires at least: 3.5.1
|
5 |
-
Tested up to: 4.8
|
6 |
-
Stable tag: 1.
|
7 |
License: GNU General Public License v2.0 or later
|
8 |
|
9 |
OptinMonster helps you grow your email list by converting visitors into subscribers and customers. Get more email subscribers now!
|
@@ -16,7 +16,7 @@ Did you know that over 70% of website visitors who leave your website will never
|
|
16 |
> <strong>OptinMonster App</strong><br>
|
17 |
> OptinMonster is a standalone application that integrates with all web platforms including WordPress. You must have an OptinMonster account in order to take advantage of this plugin. <a href="http://optinmonster.com/pricing/" rel="friend" title="OptinMonster Plans">Click here to create your account.</a>
|
18 |
|
19 |
-
OptinMonster comes with an easy to use form builder that allows you to create beautiful optin forms that are proven to convert. You can create various type of
|
20 |
|
21 |
Using OptinMonster forms combined with our exit-intent technology, page-level targeting, and behavior automation, users have seen an instant boost in conversion rate, _even upwards of 785%!_
|
22 |
|
@@ -29,7 +29,7 @@ Let's take a look at how OptinMonster can help you get more email subscribers.
|
|
29 |
|
30 |
OptinMonster allows you to build high converting opt-in forms in minutes, not hours!
|
31 |
|
32 |
-
You can choose from 8 different type of
|
33 |
|
34 |
All of our templates are 100% responsive and mobile friendly.
|
35 |
|
@@ -138,7 +138,7 @@ OptinMonster® and Exit-Intent® are registered trademarks of Retyp, LLC.
|
|
138 |
1. Install OptinMonster either via the WordPress.org plugin repository or by uploading the files to your server.
|
139 |
2. Activate OptinMonster.
|
140 |
3. Navigate to the OptinMonster tab at the bottom of your admin menu and enter your OptinMonster API Username and API Key to connect your OptinMonster account to your WordPress site.
|
141 |
-
4. Click on the
|
142 |
|
143 |
== Frequently Asked Questions ==
|
144 |
|
@@ -156,10 +156,15 @@ OptinMonster is the <a href="http://optinmonster.com" rel="friend" title="OptinM
|
|
156 |
= Testimonial =
|
157 |
|
158 |
> OptinMonster is unlike most plugins. Most plugins cost you money. OptinMonster makes you money. Most barely get updated - OptinMonster just keeps getting better.<br>
|
159 |
-
> Chris Lema -
|
160 |
|
161 |
== Changelog ==
|
162 |
|
|
|
|
|
|
|
|
|
|
|
163 |
= 1.2.2 =
|
164 |
* Updated API calls to always be done over HTTPS.
|
165 |
* Updated error responses from the OptinMonster API to be more informative.
|
2 |
Contributors: optinmonster, griffinjt, smub
|
3 |
Tags: wordpress popup, popup, lightbox popup, mailchimp, aweber, campaign monitor, constant contact, exit-intent, madmimi, infusionsoft, getresponse, hubspot, marketo, activecampaign, pardot, totalsend, emma, icontact, mailerlite, mailpoet, google analytics, pop over, optin forms, email list, subscribers, wordpress popup form, lightbox, wordpress popups, popups, lightbox popups, optin form, wordpress optin form, sidebar optin form, sidebar optin, sidebar form, wordpress overlay popup, wordpress popup plugin, popup plugin, wordpress lightbox optin, wordpress lightbox optin form, after post optin form, wordpress after post optin form, after post optin form plugin, lightbox popup plugin, wordpress popup solution, exit intent, exit-intent, optinmonster, optin monster, optin-monster, mobile popup, mobile popups, mobile optin forms, mobile optins, lightbox optins, wordpress mobile popup, wordpress mobile popups, wordpress mobile optin forms, wordpress lightbox optins, lead gen, lead generation, wordpress lead generation, lead generation wordpress, wordpress lead gen, fullscreen, welcome gate, interstitial
|
4 |
Requires at least: 3.5.1
|
5 |
+
Tested up to: 4.8
|
6 |
+
Stable tag: 1.3.0
|
7 |
License: GNU General Public License v2.0 or later
|
8 |
|
9 |
OptinMonster helps you grow your email list by converting visitors into subscribers and customers. Get more email subscribers now!
|
16 |
> <strong>OptinMonster App</strong><br>
|
17 |
> OptinMonster is a standalone application that integrates with all web platforms including WordPress. You must have an OptinMonster account in order to take advantage of this plugin. <a href="http://optinmonster.com/pricing/" rel="friend" title="OptinMonster Plans">Click here to create your account.</a>
|
18 |
|
19 |
+
OptinMonster comes with an easy to use form builder that allows you to create beautiful optin forms that are proven to convert. You can create various type of campaigns including WordPress popup forms, floating header and footer bars, slide-ins also known as scroll triggered boxes, sidebar forms, after post forms, in-line forms, mobile-specific forms, welcome gates and more.
|
20 |
|
21 |
Using OptinMonster forms combined with our exit-intent technology, page-level targeting, and behavior automation, users have seen an instant boost in conversion rate, _even upwards of 785%!_
|
22 |
|
29 |
|
30 |
OptinMonster allows you to build high converting opt-in forms in minutes, not hours!
|
31 |
|
32 |
+
You can choose from 8 different type of campaigns including: popup forms, floating bars, slide-ins, sidebar forms, after-post forms, in-line forms, mobile-only popup forms, and Canvas.
|
33 |
|
34 |
All of our templates are 100% responsive and mobile friendly.
|
35 |
|
138 |
1. Install OptinMonster either via the WordPress.org plugin repository or by uploading the files to your server.
|
139 |
2. Activate OptinMonster.
|
140 |
3. Navigate to the OptinMonster tab at the bottom of your admin menu and enter your OptinMonster API Username and API Key to connect your OptinMonster account to your WordPress site.
|
141 |
+
4. Click on the Campaigns tab and configure the output settings for each campaign you have created in your OptinMonster account.
|
142 |
|
143 |
== Frequently Asked Questions ==
|
144 |
|
156 |
= Testimonial =
|
157 |
|
158 |
> OptinMonster is unlike most plugins. Most plugins cost you money. OptinMonster makes you money. Most barely get updated - OptinMonster just keeps getting better.<br>
|
159 |
+
> Chris Lema - VP of Product at Liquid Web
|
160 |
|
161 |
== Changelog ==
|
162 |
|
163 |
+
= 1.3.0 =
|
164 |
+
* Is it "campaign"? Or "optin"? No, it's definitely "campaign".
|
165 |
+
* OptinMonster now works with the shiny new MailPoet 3.
|
166 |
+
* We're feeling a little lighter after removing some deprecated code.
|
167 |
+
|
168 |
= 1.2.2 =
|
169 |
* Updated API calls to always be done over HTTPS.
|
170 |
* Updated error responses from the OptinMonster API to be more informative.
|