Spacer - Version 3.0.5

Version Description

  • Fixes string offset error
Download this release

Release Info

Developer clevelandwebdeveloper
Plugin Icon 128x128 Spacer
Version 3.0.5
Comparing to
See all releases

Code changes from version 3.0.4 to 3.0.5

Files changed (3) hide show
  1. index.php +1922 -1917
  2. readme.txt +7 -4
  3. sva/sva.php +926 -910
index.php CHANGED
@@ -1,1917 +1,1922 @@
1
- <?php
2
-
3
- /*
4
- Plugin Name: Spacer
5
- Plugin URI: http://www.clevelandwebdeveloper.com/wordpress-plugins/spacer
6
- Description: Adds a spacer button to the WYSIWYG visual editor which allows you to add precise custom spacing between lines in your posts and pages.
7
- Version: 3.0.4
8
- Author: Justin Saad
9
- Author URI: http://www.clevelandwebdeveloper.com
10
- License: GPL2
11
- */
12
-
13
-
14
- //begin wysiwyg visual editor custom button plugin
15
-
16
- $plugin_label = "Spacer";
17
- $plugin_slug = "motech_spacer";
18
-
19
- class motech_spacer {
20
-
21
- public function __construct() {
22
-
23
- global $plugin_label, $plugin_slug;
24
- $this->plugin_slug = $plugin_slug;
25
- $this->plugin_label = $plugin_label;
26
- $this->plugin_dir = plugins_url( '' , __FILE__ );
27
- $checkaddspacers = get_option($this->plugin_slug."_addspacer_id");
28
- if(!empty($checkaddspacers)){
29
- $this->key_array = $checkaddspacers;
30
- $this->has_addspacers = true;
31
- }else{
32
- $this->key_array = array(0);
33
- $this->has_addspacers = false;
34
- }
35
-
36
- //do when class is instantiated
37
- add_shortcode('spacer', array($this, 'addShortcodeHandler'));
38
- add_filter( 'tiny_mce_version', array($this, 'my_refresh_mce'));
39
-
40
- //plugin row links
41
- add_filter( 'plugin_row_meta', array($this,'plugin_row_links'), 10, 2 );
42
-
43
- if(is_admin()){
44
- add_action('admin_init', array($this, 'page_init'));
45
- add_action('admin_menu', array($this, 'add_plugin_page'));
46
- //custom image picker css for admin page
47
- add_action('admin_head', array($this,'motech_imagepicker_admin_css'));
48
- //custom image picker jquery for admin page
49
- add_action('admin_footer', array($this,'motech_imagepicker_admin_jquery'));
50
- //add Settings link to plugin page
51
- add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array($this, 'add_plugin_action_links') );
52
- //image upload script
53
- add_action('admin_enqueue_scripts', array($this,'spacer_imageupload_script'));
54
-
55
- add_action( 'admin_enqueue_scripts', array($this, 'enqueue_color_picker') ); //enqueue color picker
56
-
57
- add_action( 'admin_enqueue_scripts', array($this, 'enqueue_motech_javascript'), 50 ); //enqueue color picker
58
-
59
- add_action( 'wp_ajax_motech_spacer', array($this,'motech_spacer_callback') );
60
-
61
- //admin messages
62
- add_action('admin_notices', array($this,'admin_show_message'));
63
- add_action('admin_init', array($this,'adminmessage_init'));
64
-
65
- add_action( 'admin_enqueue_scripts', array($this,'load_custom_wp_admin_style'), 50 );
66
- } else{
67
- add_action( 'wp_enqueue_scripts', array($this,'load_custom_wp_admin_style') );
68
- }
69
-
70
- //prepare plugin for localization
71
- load_plugin_textdomain('motech-spacer', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
72
- }
73
-
74
- function load_custom_wp_admin_style() {
75
- if ( current_user_can('edit_posts') or current_user_can('edit_pages') ) {
76
- wp_register_style( 'mspacer_wp_admin_css', plugins_url( 'admin-style.css' , __FILE__ ), false, '1.0.0' );
77
- wp_enqueue_style( 'mspacer_wp_admin_css' );
78
- }
79
- if (isset($_GET['page']) && $_GET['page'] == $this->plugin_slug.'-setting-admin') { //if we are on our admin page
80
- wp_register_style( 'mspacer_wp_adminpage_css', plugins_url( 'adminpage-style.css' , __FILE__ ), false, '1.0.0' );
81
- wp_enqueue_style( 'mspacer_wp_adminpage_css' );
82
- }
83
- }
84
-
85
- function motech_spacer_callback() {
86
- $return = array();
87
- $checkheight = get_option($this->plugin_slug . '_default_height','20');
88
- $checkunit = get_option($this->plugin_slug . '_default_height_unit','px');
89
- $return["useheight"] = $checkheight.$checkunit;
90
- if($this->has_addspacers){
91
- $ids = $this->key_array;
92
- $checkaddheights = get_option($this->plugin_slug . '_default_height_addspacers');
93
- $checkaddheightunits = get_option($this->plugin_slug . '_default_height_unit_addspacers');
94
- $checktitles = get_option($this->plugin_slug . '_title_addspacers');
95
- foreach($ids as $key=>$value){
96
- $useheight = $checkaddheights[$key];
97
- $useunit = $checkaddheightunits[$key];
98
- $usetitle = $checktitles[$key];
99
- if(empty($usetitle)){
100
- $usetitle = "Untitled";
101
- }
102
- $return["addspacers"][] = array("id"=>$value,"height"=>$useheight.$useunit,"title"=>$usetitle);
103
- }
104
- }
105
- echo json_encode($return);
106
- wp_die(); // this is required to terminate immediately and return a proper response
107
- }
108
-
109
- function admin_show_message()
110
- {
111
- $user_id = get_current_user_id();
112
- //there is no default spacer height set, and nag message not ignored...
113
- //$checkdefault = get_option($this->plugin_slug . '_default_height_mobile','');
114
- if ( ( ! get_user_meta($user_id, 'spacer2295_nag_ignore') ) && (current_user_can( 'manage_options' )) ) {
115
- echo '<div id="message" class="updated fade notice"><p>';
116
- echo "<b>".__("Take more time as you craft article updates. Designate 'draft' content with one-click! Try the new Spacer add-on, Draft It!", "motech-spacer")."</b>";
117
- echo "</p>";
118
- echo "<p><strong><a href=\"http://www.clevelandwebdeveloper.com/?p=1269&amp;utm_medium=plugin&amp;utm_source=plugin-notice-msg&amp;utm_campaign=Spacer+Notice+Msg&amp;utm_content=Draftit+Notice\" target=\"_blank\">".__('Start Drafting &raquo;', 'motech-spacer')."</a> | <a class=\"dismiss-notice\" style=\"color:red;\" href=\"".get_bloginfo( 'wpurl' ) . "/wp-admin/options-general.php?page=".$this->plugin_slug."-setting-admin&spacer2295_nag_ignore=0\" target=\"_parent\">".__('I got it. Thanks.', 'motech-spacer')." [X]</a></strong></p></div>";
119
- }
120
- }
121
-
122
- function adminmessage_init()
123
- {
124
- if ( isset($_GET['spacer2295_nag_ignore']) && '0' == $_GET['spacer2295_nag_ignore'] ) {
125
- $user_id = get_current_user_id();
126
- add_user_meta($user_id, 'spacer2295_nag_ignore', 'true', true);
127
- if (wp_get_referer()) {
128
- /* Redirects user to where they were before */
129
- wp_safe_redirect(wp_get_referer());
130
- } else {
131
- /* if there is no referrer you redirect to home */
132
- wp_safe_redirect(home_url());
133
- }
134
- }
135
- }
136
-
137
- function enqueue_color_picker( $hook_suffix ) {
138
- wp_enqueue_style( 'wp-color-picker' );
139
- wp_enqueue_script( $this->plugin_slug.'-script-handle', plugins_url('js/motech-color-picker.js', __FILE__ ), array( 'wp-color-picker' ), false, true );
140
- }
141
-
142
- function enqueue_motech_javascript( ) {
143
- if (isset($_GET['page']) && $_GET['page'] == $this->plugin_slug.'-setting-admin') {
144
- wp_enqueue_script( $this->plugin_slug.'-motech-javascript', plugins_url('js/motech-javascript.js', __FILE__ ), array('jquery'), false, true );
145
- }
146
- }
147
-
148
- function spacer_imageupload_script() {
149
- if (isset($_GET['page']) && $_GET['page'] == $this->plugin_slug.'-setting-admin') {
150
- if(function_exists('wp_enqueue_media')){
151
- wp_enqueue_media();
152
- }
153
- wp_register_script('spacer_imageupload-js', plugins_url( 'js/spacer_imageupload.js' , __FILE__ ), array('jquery'));
154
- wp_enqueue_script('spacer_imageupload-js');
155
- }
156
- }
157
-
158
- function activespacer($id="") { #return attributes for active spacer based on id.
159
- $return = array();
160
- if($this->has_addspacers && $id!=""){
161
- $ids = $this->key_array;
162
- $key = array_search($id, $ids);
163
- if($key){
164
- #associated spacer id found so we return those values
165
- $get = get_option($this->plugin_slug . '_spacer_style_addspacers');
166
- $return["defaultstyle"] = $get[$key];
167
- $get = get_option($this->plugin_slug . '_default_height_mobile_addspacers');
168
- $return["mobile_height_default"] = $get[$key];
169
- $return["mobile_height"] = $return["mobile_height_default"];
170
- $get = get_option($this->plugin_slug . '_default_height_mobile_unit_addspacers');
171
- $return["mobileunit"] = $get[$key];
172
- $get = get_option($this->plugin_slug . '_default_height_addspacers');
173
- $return["checkheight"] = $get[$key];
174
- $get = get_option($this->plugin_slug . '_default_height_unit_addspacers');
175
- $return["checkunit"] = $get[$key];
176
- //$get = get_option($this->plugin_slug.'_custom_background_image_upload_addspacers');
177
- //$return["bg"] = $get[$key];
178
- //$get = get_option($this->plugin_slug . '_background_color_addspacers');
179
- //$return["bgcolor"] = $get[$key];
180
- $get = get_option($this->plugin_slug . '_spacer_class_addspacers');
181
- $return["defaultclasses"] = $get[$key];
182
- if(has_filter('spacer_add_to_extras')) {
183
- $return = apply_filters('spacer_add_to_extras',$return,$key);
184
- }
185
- return $return;
186
- }
187
-
188
-
189
- }
190
-
191
- #no associated spacer id found so we return default spacer values
192
- $return["mobile_height_default"] = get_option($this->plugin_slug . '_default_height_mobile','');
193
- $return["mobile_height"] = get_option($this->plugin_slug . '_default_height_mobile','');
194
- $return["mobileunit"] = get_option($this->plugin_slug . '_default_height_mobile_unit','px');
195
- $return["checkheight"] = get_option($this->plugin_slug . '_default_height','20');
196
- $return["checkunit"] = get_option($this->plugin_slug . '_default_height_unit','px');
197
- //$return["bg"] = get_option($this->plugin_slug.'_custom_background_image_upload');
198
- //$return["bgcolor"] = get_option($this->plugin_slug.'_background_color');
199
- $return["defaultclasses"] = get_option($this->plugin_slug.'_spacer_class','');
200
- $return["defaultstyle"] = get_option($this->plugin_slug.'_spacer_style','');
201
- if(has_filter('spacer_add_to_default')) {
202
- $return = apply_filters('spacer_add_to_default', $return);
203
- }
204
-
205
- return $return;
206
- }
207
-
208
- // add the shortcode handler
209
- function addShortcodeHandler($atts, $content = null) {
210
- extract(shortcode_atts(array( "height" => '', "mheight" => '', "class" => '', "id" => '', "style" => '' ), $atts));
211
- $activespacer = $this->activespacer($id);
212
-
213
- //prep variables
214
- $spacer_css = "";
215
- $classes = "";
216
-
217
- //prep mobile height, if it's empty we will use desktop height. if set to 0 we will hide the spacer on mobile devices.
218
- $mobile_height = "";
219
- $mobile_height_inline = "";
220
- $mobile_height_default = $activespacer["mobile_height_default"];
221
-
222
- //first check for inline height, then check default mobile height
223
- if(isset($mheight) && $mheight != ""){
224
- $mobile_height = $mheight;
225
- $mobile_height_inline = $mheight;
226
- }elseif(isset($mobile_height_default) && $mobile_height_default != ""){
227
- $mobile_height = $activespacer["mobile_height"];
228
- $mobile_height_default = $mobile_height;
229
- }
230
-
231
-
232
- //determine the height to use for the spacer. if it's a mobile device and there is a mobile height set, use that. otherwise use desktop height
233
- if( function_exists('wp_is_mobile') && wp_is_mobile() && (isset($mobile_height) && $mobile_height != "")) {
234
- $mobileunit = $activespacer["mobileunit"];
235
-
236
-
237
- if(isset($mobile_height_inline) && $mobile_height_inline != "") {
238
- if ($mobile_height_inline > 0 ) {
239
- $spacer_css .= "padding-top: " . $mobile_height_inline . ";";
240
- } elseif($mobile_height_inline < 0) {
241
- $spacer_css .= "margin-top: " . $mobile_height_inline . ";";
242
- } elseif($mobile_height_inline == 0){
243
- $spacer_css .= "display:none;";
244
- }
245
- } elseif(isset($mobile_height_default) && $mobile_height_default != ""){
246
- if($mobile_height_default > 0){
247
- $spacer_css .= "padding-top: " . $mobile_height_default . $mobileunit.";";
248
- }elseif($mobile_height_default < 0){
249
- $spacer_css .= "margin-top: " . $mobile_height_default . $mobileunit. ";";
250
- }elseif($mobile_height_default == 0){;
251
- $spacer_css .= "display:none;";
252
- }
253
- }
254
-
255
- } elseif($height=="default"){ //there is no mobile height set. use the desktop default height
256
-
257
- //for now assume positive. in a sec add logic for if negative
258
- $checkheight = $activespacer["checkheight"];
259
- $checkunit = $activespacer["checkunit"];
260
-
261
- if($checkheight > 0){
262
- $spacer_css .= "padding-top: " . $checkheight . $checkunit.";";
263
- }elseif($checkheight < 0){
264
- $spacer_css .= "margin-top: " . $checkheight . $checkunit. ";";
265
- }
266
- } elseif ($height > 0 ) { #no default for desktop, use positive inline height
267
- $spacer_css .= "padding-top: " . $height . ";";
268
- } elseif($height < 0) { #no positive inline for desktop, use negative inline height
269
- $spacer_css .= "margin-top: " . $height . ";";
270
- }
271
-
272
-
273
- //custom background image
274
- /* $bg = $activespacer["bg"];
275
- if(!empty($bg)) {
276
- $spacer_css .= "background: url(".$bg.");";
277
- }*/
278
-
279
- //custom background image position
280
- //$spacer_css .= $this->background_position();
281
-
282
- //background color
283
- /* $bgcolor = $activespacer["bgcolor"];
284
- if(!empty($bgcolor)) {
285
- $spacer_css .= "background-color:".$bgcolor.";";
286
- }*/
287
-
288
- //classes
289
- $defaultclasses = $activespacer["defaultclasses"];
290
- $classes .= $defaultclasses;
291
- if(!empty($class)){
292
- $classes .= " ".$class;
293
- }
294
-
295
- if(has_filter('spacer_add_css')) {
296
- $spacer_css = apply_filters('spacer_add_css', $spacer_css, $activespacer);
297
- }
298
-
299
- //styles
300
- $defaultstyle = $activespacer["defaultstyle"];
301
- $spacer_css .= $defaultstyle;
302
- if(!empty($style)){
303
- $spacer_css .= " ".$style;
304
- }
305
-
306
- //create the spacer after all settings have been loaded
307
- return '<span class="'.$classes.'" style="display:block;clear:both;height: 0px;'.$spacer_css.'"></span>';
308
- }
309
-
310
- function background_position(){
311
- $bgposition = get_option($this->plugin_slug.'_custom_background_image_position','repeat');
312
- if($bgposition=="repeat"){
313
- return "background-repeat:repeat;";
314
- } elseif($bgposition=="croptofit"){
315
- return "background-size:cover;background-position:center;";
316
- } elseif($bgposition=="stretch"){
317
- return "background-size: 100% 100%;background-repeat: no-repeat;background-position: center;";
318
- } elseif($bgposition=="propstretch"){
319
- return "background-size: contain;background-repeat: no-repeat;background-position: center;";
320
- }
321
- }
322
-
323
-
324
- function add_custom_button() {
325
- if ( ! current_user_can('edit_posts') && ! current_user_can('edit_pages') )
326
- return;
327
- if ( get_user_option('rich_editing') == 'true') {
328
- add_filter('mce_external_plugins', array($this, 'add_custom_tinymce_plugin'),99999999);
329
- add_filter('mce_buttons', array($this, 'register_custom_button'),99999999);
330
- global $wp_version;
331
- //if($wp_version < 3.9){
332
- add_action('admin_head', array($this,'motech_spacer_prepjsbuttons'));
333
- add_action('wp_head', array($this,'motech_spacer_prepjsbuttons'));
334
- //}
335
- }
336
-
337
- }
338
-
339
- function register_custom_button($buttons) {
340
- array_push($buttons, "|", get_class($this));
341
- return $buttons;
342
- }
343
-
344
- function add_custom_tinymce_plugin($plugin_array) {
345
- global $wp_version;
346
- //use this in a plugin
347
- if($wp_version >= 3.9){
348
- $plugin_array[get_class($this)] = plugins_url( 'editor_plugin.js' , __FILE__ );
349
- }else {
350
- $plugin_array[get_class($this)] = plugins_url( 'editor_plugin_back.js' , __FILE__ );
351
- }
352
- //use this in a theme
353
- //$plugin_array[get_class($this)] = get_bloginfo('template_url').'/editor_plugin.js';
354
- return $plugin_array;
355
- }
356
-
357
- function my_refresh_mce($ver) {
358
- $ver += 5;
359
- return $ver;
360
- }
361
-
362
- function plugin_row_links($links, $file) {
363
- $plugin = plugin_basename(__FILE__);
364
- if ($file == $plugin) // only for this plugin
365
- return array_merge( $links,
366
- array( '<a target="_blank" href="http://www.clevelandwebdeveloper.com/wordpress-plugins/spacer/">' . __('Project homepage', 'motech-spacer' ) . '</a>' ),
367
- array( '<a target="_blank" href="http://www.linkedin.com/in/ClevelandWebDeveloper/">' . __('Find me on LinkedIn', 'motech-spacer' ) . '</a>' ),
368
- array( '<a target="_blank" href="http://twitter.com/ClevelandWebDev">' . __('Follow me on Twitter', 'motech-spacer') . '</a>' )
369
- );
370
- return $links;
371
- }
372
-
373
- public function create_admin_page(){
374
- ?>
375
- <div class="wrap" style="position:relative">
376
- <?php screen_icon(); ?>
377
- <h2 class="aplabel"><?php echo $this->plugin_label ?></h2>
378
-
379
-
380
- <div id="green_ribbon">
381
- <div class="grwrap visualartist" style="display:none;">
382
- <div id="green_ribbon_top">
383
- <div id="green_ribbon_left">
384
- </div>
385
- <div id="green_ribbon_base">
386
- <span id="hms_get_premium" addonname="visualartist"><?php _e('NEW! Get Premium &raquo;', 'motech-spacer')?></span>
387
- <span class="hms_get_premium_meta"><?php _e('Visual Artist Add-On now available for as low as $20!', 'motech-spacer')?></span>
388
- </div>
389
- <div id="green_ribbon_right">
390
- </div>
391
- </div>
392
-
393
- <div class="motech_premium_box">
394
-
395
-
396
- <div class="motech_premium_box_wrap">
397
- <h2><?php _e('Get Visual Artist', 'motech-spacer')?></h2>
398
- <div class="updated below-h2" style="margin-bottom: -20px !important;"><p><strong><?php _e('Purchase will be processed via PayPal.', 'motech-spacer')?></strong></p></div>
399
- <div class="updated below-h2"><p><strong><?php _e('Every license is valid for the lifetime of the website where it\'s installed.', 'motech-spacer')?></strong></p></div>
400
- <div class="motech_purchase_buttons">
401
-
402
- <div class="motech_purchase_button unlimited_use">
403
- <form action="https://www.paypal.com/cgi-bin/webscr" method="post"><input name="cmd" value="_s-xclick" type="hidden"><input name="hosted_button_id" value="FK8RLFRUBCL5N" type="hidden"><input type="hidden" name="page_style" value="visual_artist">
404
- <button name="submit">
405
- <div class="purchase_graphic"><?php _e('Buy', 'motech-spacer')?> <span><?php _e('Unlimited', 'motech-spacer')?></span></div>
406
- <div class="purchase_bubble">
407
- <div class="purchase_price">$50</div>
408
- <div class="purchase_meta"><?php _e('Unlimited sites forever!', 'motech-spacer')?></div>
409
- </div>
410
- </button>
411
- <img src="https://www.paypal.com/en_US/i/scr/pixel.gif" alt="" border="0" height="1" width="1">
412
- </form>
413
- </div>
414
-
415
- <div class="motech_purchase_button one_use">
416
- <form action="https://www.paypal.com/cgi-bin/webscr" method="post"><input name="cmd" value="_s-xclick" type="hidden"><input name="hosted_button_id" value="C59XHASJBCHLQ" type="hidden"><input type="hidden" name="page_style" value="visual_artist">
417
- <button name="submit">
418
- <div class="purchase_graphic"><?php _e('Buy 1 Use', 'motech-spacer')?></div>
419
- <div class="purchase_bubble">
420
- <div class="purchase_price">$20</div>
421
- <div class="purchase_meta"><?php _e('1 site license', 'motech-spacer')?></div>
422
- </div>
423
- </button>
424
- <img src="https://www.paypal.com/en_US/i/scr/pixel.gif" alt="" border="0" height="1" width="1">
425
- </form>
426
- </div>
427
-
428
- </div>
429
-
430
- <div class="motech_premium_cancel"><span><?php _e('Cancel', 'motech-spacer')?></span></div>
431
-
432
- </div>
433
-
434
- </div>
435
- </div>
436
-
437
-
438
- <div class="grwrap lineonsidesheaders" style="display:none;">
439
-
440
- <div id="green_ribbon_top">
441
- <div id="green_ribbon_left">
442
- </div>
443
- <div id="green_ribbon_base">
444
- <span id="hms_get_premium" addonname="lineonsidesheaders"><?php _e('NEW! Get Premium &raquo;', 'motech-spacer')?></span>
445
- <span class="hms_get_premium_meta"><?php _e('Header Add-On now available for as low as $10!', 'motech-spacer')?></span>
446
- </div>
447
- <div id="green_ribbon_right">
448
- </div>
449
- </div>
450
-
451
- <div class="motech_premium_box">
452
-
453
-
454
- <div class="motech_premium_box_wrap">
455
- <h2><?php _e('Get Line-On-Sides Headers', 'motech-spacer')?></h2>
456
- <div class="updated below-h2" style="margin-bottom: -20px !important;"><p><strong><?php _e('Purchase will be processed via PayPal.', 'motech-spacer')?></strong></p></div>
457
- <div class="updated below-h2"><p><strong><?php _e('Every license is valid for the lifetime of the website where it\'s installed.', 'motech-spacer')?></strong></p></div>
458
- <div class="motech_purchase_buttons">
459
-
460
- <div class="motech_purchase_button unlimited_use">
461
- <form action="https://www.paypal.com/cgi-bin/webscr" method="post"><input name="cmd" value="_s-xclick" type="hidden"><input name="hosted_button_id" value="D2R9YPYQHK63L" type="hidden">
462
- <button name="submit">
463
- <div class="purchase_graphic"><?php _e('Buy', 'motech-spacer')?> <span><?php _e('Unlimited', 'motech-spacer')?></span></div>
464
- <div class="purchase_bubble">
465
- <div class="purchase_price">$25</div>
466
- <div class="purchase_meta"><?php _e('Unlimited sites forever!', 'motech-spacer')?></div>
467
- </div>
468
- </button>
469
- <img src="https://www.paypal.com/en_US/i/scr/pixel.gif" alt="" border="0" height="1" width="1">
470
- </form>
471
- </div>
472
-
473
- <div class="motech_purchase_button one_use">
474
- <form action="https://www.paypal.com/cgi-bin/webscr" method="post"><input name="cmd" value="_s-xclick" type="hidden"><input name="hosted_button_id" value="F2CNV7FMSGAN8" type="hidden">
475
- <button name="submit">
476
- <div class="purchase_graphic"><?php _e('Buy 1 Use', 'motech-spacer')?></div>
477
- <div class="purchase_bubble">
478
- <div class="purchase_price">$10</div>
479
- <div class="purchase_meta"><?php _e('1 site license', 'motech-spacer')?></div>
480
- </div>
481
- </button>
482
- <img src="https://www.paypal.com/en_US/i/scr/pixel.gif" alt="" border="0" height="1" width="1">
483
- </form>
484
- </div>
485
-
486
- </div>
487
-
488
- <div class="motech_premium_cancel"><span><?php _e('Cancel', 'motech-spacer')?></span></div>
489
-
490
- </div>
491
-
492
- </div>
493
- </div>
494
-
495
-
496
- <div class="grwrap panels" style="display:none;">
497
-
498
- <div id="green_ribbon_top">
499
- <div id="green_ribbon_left">
500
- </div>
501
- <div id="green_ribbon_base">
502
- <span id="hms_get_premium" addonname="panels"><?php _e('NEW! Get Premium &raquo;', 'motech-spacer')?></span>
503
- <span class="hms_get_premium_meta"><?php _e('Panels Add-On now available for as low as $10!', 'motech-spacer')?></span>
504
- </div>
505
- <div id="green_ribbon_right">
506
- </div>
507
- </div>
508
-
509
- <div class="motech_premium_box">
510
-
511
-
512
- <div class="motech_premium_box_wrap">
513
- <h2><?php _e('Get Panels', 'motech-spacer')?></h2>
514
- <div class="updated below-h2" style="margin-bottom: -20px !important;"><p><strong><?php _e('Purchase will be processed via PayPal.', 'motech-spacer')?></strong></p></div>
515
- <div class="updated below-h2"><p><strong><?php _e('Every license is valid for the lifetime of the website where it\'s installed.', 'motech-spacer')?></strong></p></div>
516
- <div class="motech_purchase_buttons">
517
-
518
- <div class="motech_purchase_button unlimited_use">
519
- <form action="https://www.paypal.com/cgi-bin/webscr" method="post"><input name="cmd" value="_s-xclick" type="hidden"><input name="hosted_button_id" value="ZV77J555HXJTE" type="hidden">
520
- <button name="submit">
521
- <div class="purchase_graphic"><?php _e('Buy', 'motech-spacer')?> <span><?php _e('Unlimited', 'motech-spacer')?></span></div>
522
- <div class="purchase_bubble">
523
- <div class="purchase_price">$25</div>
524
- <div class="purchase_meta"><?php _e('Unlimited sites forever!', 'motech-spacer')?></div>
525
- </div>
526
- </button>
527
- <img src="https://www.paypal.com/en_US/i/scr/pixel.gif" alt="" border="0" height="1" width="1">
528
- </form>
529
- </div>
530
-
531
- <div class="motech_purchase_button one_use">
532
- <form action="https://www.paypal.com/cgi-bin/webscr" method="post"><input name="cmd" value="_s-xclick" type="hidden"><input name="hosted_button_id" value="GNBBYMDBN3UUE" type="hidden">
533
- <button name="submit">
534
- <div class="purchase_graphic"><?php _e('Buy 1 Use', 'motech-spacer')?></div>
535
- <div class="purchase_bubble">
536
- <div class="purchase_price">$10</div>
537
- <div class="purchase_meta"><?php _e('1 site license', 'motech-spacer')?></div>
538
- </div>
539
- </button>
540
- <img src="https://www.paypal.com/en_US/i/scr/pixel.gif" alt="" border="0" height="1" width="1">
541
- </form>
542
- </div>
543
-
544
- </div>
545
-
546
- <div class="motech_premium_cancel"><span><?php _e('Cancel', 'motech-spacer')?></span></div>
547
-
548
- </div>
549
-
550
- </div>
551
- </div>
552
-
553
-
554
- </div>
555
-
556
- <div class="grwrap draftit">
557
-
558
- <div id="green_ribbon_top">
559
- <div id="green_ribbon_left">
560
- </div>
561
- <div id="green_ribbon_base">
562
- <span id="hms_get_premium" addonname="gotourl" useurl="http://www.clevelandwebdeveloper.com/?p=1269&amp;utm_medium=plugin&amp;utm_source=plugin-notice-msg&amp;utm_campaign=Spacer+Notice+Msg&amp;utm_content=Draftit+Notice"><?php _e('NEW! Get Draft It! &raquo;', 'motech-spacer')?></span>
563
- <span class="hms_get_premium_meta"><?php _e('Draft It! Add-On now available for as low as $19!', 'motech-spacer')?></span>
564
- </div>
565
- <div id="green_ribbon_right">
566
- </div>
567
- </div>
568
-
569
- </div>
570
-
571
-
572
- <h2 class="nav-tab-wrapper">
573
- <a href="#defaultspacer" class="nav-tab nav-tab-active"><?php _e('Default', 'motech-spacer')?></a>
574
- <a href="#addspacers" class="nav-tab"><span class="dashicons dashicons-plus dashicons-plus-alt"></span> <?php _e('Add Spacers', 'motech-spacer')?></a>
575
- <?php do_action( 'spacer_sectiontabhook' ); #use this hook to add additional section tabs ?>
576
- <a href="#suggestionbox" class="nav-tab"><span class="dashicons dashicons-email-alt"></span> <?php _e('Suggestion Box', 'motech-spacer')?></a>
577
- <a href="#addons" class="nav-tab"><span class="dashicons dashicons-admin-plugins"></span> <?php _e('Add-Ons', 'motech-spacer')?></a>
578
- <a href="#licenses" class="nav-tab"><span class="dashicons dashicons-admin-network"></span> <?php _e('Licenses', 'motech-spacer')?></a>
579
- <?php /*?> <a href="#privacy-settings" class="nav-tab">Privacy settings</a>
580
- <a href="#admin-custom" class="nav-tab">Admin Customizations</a>
581
- <a href="#smtp" class="nav-tab">Smtp Settings</a><?php */?>
582
- </h2>
583
-
584
- <form method="post" action="options.php" class="<?php echo $this->plugin_slug ?>_form">
585
- <?php
586
- // This prints out all hidden setting fields
587
- settings_fields($this->plugin_slug.'_option_group');
588
- ?>
589
- <div id="defaultspacer" class="metabox-holder mainsection aspacerunit">
590
- <div class="motech-spacer-options section general wrap" style="border-bottom: solid 1px #BFBFBF;padding-bottom: 3px;">
591
- <?php do_settings_sections($this->plugin_slug.'-setting-admin'); ?>
592
- </div>
593
- <div class="motech-spacer-options section mobileoptions" style="border-bottom: solid 1px #BFBFBF;padding-bottom: 3px;">
594
- <?php do_settings_sections($this->plugin_slug.'-setting-admin_mobileoptions'); ?>
595
- </div>
596
- <div class="motech-spacer-options section styleoptions">
597
- <?php do_settings_sections($this->plugin_slug.'-setting-admin_styleoptions'); ?>
598
- </div>
599
- <?php
600
- if(has_filter('spacer_default_sections')) {
601
- apply_filters('spacer_default_sections', '',$this);
602
- }
603
- ?>
604
- <div class="spacer_preview_area_container">
605
- <h2><?php _e('Preview', 'motech-spacer')?></h2>
606
- <div class="spacer_preview_area">
607
- <p><?php _e('Sample text before Spacer', 'motech-spacer')?></p>
608
- <span class="spacer_preview" style="display:block;clear:both;height: 0px;padding-top: 20px;"></span>
609
- <p><?php _e('Sample text after Spacer', 'motech-spacer')?></p>
610
- </div>
611
- </div>
612
- <div class="hidden" style="display:none;"><?php do_settings_sections($this->plugin_slug.'-setting-admin_hdoptions'); ?></div>
613
- </div>
614
- <div id="addspacers" class="metabox-holder mainsection hidden wrap">
615
- <h2 style="padding-bottom:20px;"><?php _e('Add New Spacers', 'motech-spacer')?></h2>
616
- <div class="nothinghere hidden"><div style="font-weight: bold;font-size: 127px;line-height: normal;margin-bottom: 10px;">:-(</div><div style="font-size: 19px; line-height: normal;margin-bottom: 30px;"><?php _e('You don\'t have any additional Spacers yet', 'motech-spacer')?></div></div>
617
- <?php
618
- $key_array = $this->key_array;
619
- $getoption = get_option($this->plugin_slug.'_title_addspacers','');
620
- foreach($key_array as $key=>$value){
621
- if(isset($getoption[$key])){
622
- $gettitle = $getoption[$key];
623
- }
624
- if(empty($gettitle)){
625
- $gettitle = "Untitled";
626
- }
627
- ?>
628
- <div class="aspacerunit addspacerunit postbox closed">
629
- <button type="button" class="handlediv button-link" aria-expanded="true"><span class="toggle-indicator" aria-hidden="true"></span></button>
630
- <h2 class="hndle ui-sortable-handle"><span><?php echo $gettitle ?></span></h2>
631
- <div class="inside">
632
- <div class="motech-spacer-options section title" style="border-bottom: solid 1px #eee;padding-bottom: 3px;">
633
- <?php do_settings_sections($this->plugin_slug.'-setting-admin_title_addspacers'.$key); ?>
634
- </div>
635
- <div class="motech-spacer-options section general" style="border-bottom: solid 1px #eee;padding-bottom: 3px;">
636
- <?php do_settings_sections($this->plugin_slug.'-setting-admin_addspacers'.$key); ?>
637
- </div>
638
- <div class="motech-spacer-options section mobileoptions" style="border-bottom: solid 1px #eee;padding-bottom: 3px;">
639
- <?php do_settings_sections($this->plugin_slug.'-setting-admin_mobileoptions_addspacers'.$key); ?>
640
- </div>
641
- <div class="motech-spacer-options section styleoptions">
642
- <?php do_settings_sections($this->plugin_slug.'-setting-admin_styleoptions_addspacers'.$key); ?>
643
- </div>
644
- <?php
645
- if(has_filter('spacer_addspacer_sections'.$key)) {
646
- apply_filters('spacer_addspacer_sections'.$key, '',$key);
647
- }
648
- ?>
649
- <div class="spacer_preview_area_container">
650
- <h2><?php _e('Preview', 'motech-spacer')?></h2>
651
- <div class="spacer_preview_area">
652
- <p><?php _e('Sample text before Spacer', 'motech-spacer')?></p>
653
- <span class="spacer_preview" style="display:block;clear:both;height: 0px;padding-top: 20px;"></span>
654
- <p><?php _e('Sample text after Spacer', 'motech-spacer')?></p>
655
- </div>
656
- </div>
657
- <div class="hiddenx" style="display:none;">
658
- <?php do_settings_sections($this->plugin_slug.'-setting-admin_hd_addspacers'.$key); ?>
659
- </div>
660
- <div class="removebutton"><span class="dashicons dashicons-post-trash"></span> <?php _e('REMOVE', 'motech-spacer') ?></div>
661
- </div>
662
- </div>
663
- <?php } ?>
664
-
665
- <div class="newbutton"><span class="dashicons dashicons-plus dashicons-plus-alt"></span> <?php _e('NEW SPACER', 'motech-spacer') ?></div>
666
-
667
-
668
- </div>
669
- <?php do_action( 'spacer_sectionshook' ); #use this hook to add additional sections ?>
670
- <div id="addons" class="metabox-holder mainsection hidden wrap">
671
- <?php
672
- $actionbutton = '<a href="#" title="'.__('Buy Visual Artist', 'motech-spacer').'" class="button-primary msbutton buynowbutton" addonname="visualartist">'.__('Buy Now', 'motech-spacer').'</a>';
673
- if( is_plugin_active( 'spacer-visual-artist/index.php' ) ) {
674
- $actionbutton = '<a href="javascript:void(0)" title="'.__('Active', 'motech-spacer').'" class="button-secondary msbutton">'.__('Active', 'motech-spacer').'</a>';
675
- } elseif( file_exists(plugin_dir_path(__FILE__) . '../spacer-visual-artist/index.php') ) {
676
- $actionbutton = '<a href="javascript:void(0)" title="'.__('Installed', 'motech-spacer').'" class="button-secondary msbutton">'.__('Installed', 'motech-spacer').'</a>';
677
- }
678
- ?>
679
- <div class="msaddon mscol"><img src="<?php echo plugins_url( 'images/vart.png' , __FILE__ ) ?>"><h2><?php _e('Visual Artist', 'motech-spacer') ?></h2><div class="msaddon-content"><p><?php _e('Design fancy dividers, horizontal rules, and other ornate section breaks. Incorporate rich colors and images, all without mastering css.', 'motech-spacer') ?></p><div class="msaddon-buttons"><a href="http://www.clevelandwebdeveloper.com/?p=644&amp;utm_medium=plugin&amp;utm_source=plugin-addons-page&amp;utm_campaign=Spacers+Addons+Page&amp;utm_content=Spacer+Learn" target="_blank" class="button-secondary msdbutton"><?php _e('Learn More', 'motech-spacer') ?></a><?php echo $actionbutton ?></div></div></div>
680
-
681
- <?php
682
- $actionbutton = '<a href="#" title="'.__('Buy Line-On-Sides Headers', 'motech-spacer').'" class="button-primary msbutton buynowbutton" addonname="lineonsidesheaders">'.__('Buy Now', 'motech-spacer').'</a>';
683
- if( is_plugin_active( 'spacer-lineonsides-headers/index.php' ) ) {
684
- $actionbutton = '<a href="javascript:void(0)" title="'.__('Active', 'motech-spacer').'" class="button-secondary msbutton">'.__('Active', 'motech-spacer').'</a>';
685
- } elseif( file_exists(plugin_dir_path(__FILE__) . '../spacer-lineonsides-headers/index.php') ) {
686
- $actionbutton = '<a href="javascript:void(0)" title="'.__('Installed', 'motech-spacer').'" class="button-secondary msbutton">'.__('Installed', 'motech-spacer').'</a>';
687
- }
688
- ?>
689
- <div class="msaddon mscol"><img src="<?php echo plugins_url( 'images/lhart.png' , __FILE__ ) ?>"><h2><?php _e('Line-On-Sides Headers', 'motech-spacer') ?></h2><div class="msaddon-content"><p><?php _e('Create headers that really stand out with lines on the sides.', 'motech-spacer') ?></p><div class="msaddon-buttons"><a href="http://www.clevelandwebdeveloper.com/?p=868&amp;utm_medium=plugin&amp;utm_source=plugin-addons-page&amp;utm_campaign=Spacers+Addons+Page&amp;utm_content=Lineonsides+Learn" target="_blank" class="button-secondary msdbutton"><?php _e('Learn More', 'motech-spacer') ?></a><?php echo $actionbutton ?></div></div></div>
690
-
691
- <?php
692
- $actionbutton = '<a href="#" title="'.__('Buy Panels', 'motech-spacer').'" class="button-primary msbutton buynowbutton" addonname="panels">'.__('Buy Now', 'motech-spacer').'</a>';
693
- if( is_plugin_active( 'spacer-panels/index.php' ) ) {
694
- $actionbutton = '<a href="javascript:void(0)" title="'.__('Active', 'motech-spacer').'" class="button-secondary msbutton">'.__('Active', 'motech-spacer').'</a>';
695
- } elseif( file_exists(plugin_dir_path(__FILE__) . '../spacer-panels/index.php') ) {
696
- $actionbutton = '<a href="javascript:void(0)" title="'.__('Installed', 'motech-spacer').'" class="button-secondary msbutton">'.__('Installed', 'motech-spacer').'</a>';
697
- }
698
- ?>
699
- <div class="msaddon mscol"><img src="<?php echo plugins_url( 'images/part.png' , __FILE__ ) ?>"><h2><?php _e('Panels', 'motech-spacer') ?></h2><div class="msaddon-content"><p><?php _e('Style your own panels (think alerts, info boxes) and use them in your posts and pages whenever they are needed.', 'motech-spacer') ?></p><div class="msaddon-buttons"><a href="http://www.clevelandwebdeveloper.com/?p=931&amp;utm_medium=plugin&amp;utm_source=plugin-addons-page&amp;utm_campaign=Spacers+Addons+Page&amp;utm_content=Panels+Learn" target="_blank" class="button-secondary msdbutton"><?php _e('Learn More', 'motech-spacer') ?></a><?php echo $actionbutton ?></div></div></div>
700
-
701
- <?php
702
- $actionbutton = '<a href="http://www.clevelandwebdeveloper.com/?p=1269&amp;utm_medium=plugin&amp;utm_source=plugin-addons-page&amp;utm_campaign=Spacers+Addons+Page&amp;utm_content=Draftit+Learn" target="_blank" title="'.__('Buy Draft It!', 'motech-spacer').'" class="button-primary msbutton">'.__('Buy Now', 'motech-spacer').'</a>';
703
- if( is_plugin_active( 'spacer-draftit/index.php' ) ) {
704
- $actionbutton = '<a href="javascript:void(0)" title="'.__('Active', 'motech-spacer').'" class="button-secondary msbutton">'.__('Active', 'motech-spacer').'</a>';
705
- } elseif( file_exists(plugin_dir_path(__FILE__) . '../spacer-draftit/index.php') ) {
706
- $actionbutton = '<a href="javascript:void(0)" title="'.__('Installed', 'motech-spacer').'" class="button-secondary msbutton">'.__('Installed', 'motech-spacer').'</a>';
707
- }
708
- ?>
709
- <div class="msaddon mscol"><img src="<?php echo plugins_url( 'images/diart.png' , __FILE__ ) ?>"><h2><?php _e('Draft It!', 'motech-spacer') ?></h2><div class="msaddon-content"><p><?php _e("Take more time as you craft article updates. Designate 'draft' content with one-click!", "motech-spacer") ?></p><div class="msaddon-buttons"><a href="http://www.clevelandwebdeveloper.com/?p=1269&amp;utm_medium=plugin&amp;utm_source=plugin-addons-page&amp;utm_campaign=Spacers+Addons+Page&amp;utm_content=Draftit+Learn" target="_blank" class="button-secondary msdbutton"><?php _e('Learn More', 'motech-spacer') ?></a><?php echo $actionbutton ?></div></div></div>
710
-
711
- </div>
712
- <div id="licenses" class="metabox-holder mainsection hidden wrap">
713
- <div class="motech-spacer-options section general wrap">
714
- <?php do_settings_sections($this->plugin_slug.'-setting-admin_licenses'); ?>
715
- </div>
716
- </div>
717
- <div id="suggestionbox" class="metabox-holder mainsection hidden wrap">
718
- <div class="motech-spacer-options section general wrap">
719
- <h1>Have a good suggestion for a Spacer add-on or a feature request? Let's hear it...</h1>
720
- <?php
721
- global $current_user;
722
- wp_get_current_user();
723
- ?>
724
- <textarea style="width:100%;min-height:250px;" name="mysuggestion" placeholder="Suggestions go here"></textarea>
725
- <div style="font-size:20px;line-height:normal;margin: 25px 0px;margin-bottom: 35px;"><input type="checkbox" name="signmeup" value="yes" checked="checked">Yes, I want to subscribe to the Spacer newsletter and be the first to know of important Spacer news and upcoming releases. I want to stay notified about exclusive discounts and insider deals on premium features. My email address is: <input type="text" name="myemail" value="<?php echo $current_user->user_email ?>" /> <div style="font-size:14px;">(The Spacer newsletter is personally written and sent out about once a month (at most). It's not remotely annoying or spammy. We promise.)</div></div>
726
- <div class="sendhook">
727
- <div class="newbutton readysend"><span class="dashicons dashicons-email-alt"></span> <span class="readysendlabel"><?php _e('SEND', 'motech-spacer') ?></span></div>
728
- <div class="responsehook" style="margin-top: -20px;padding: 15px;margin-left: 10px;margin-right: 10px;background: rgb(252, 248, 227); color: rgb(138, 109, 59);border: 1px solid rgb(252, 220, 126);border-radius: 3px;display:none;"></div>
729
- </div>
730
- </div>
731
- </div>
732
- <div class="wrap"><div class="savebutton"><button type="submit"><span class="dashicons dashicons-yes"></span> <?php _e('SAVE CHANGES!', 'motech-spacer') ?></button></div></div>
733
- </form>
734
- </div>
735
- <?php
736
- }
737
-
738
- public function DisplayAddSpacers(){
739
- $key_array = $this->key_array;
740
- foreach($key_array as $key=>$value){
741
- add_settings_section(
742
- $this->plugin_slug.'_setting_section',
743
- __('', 'motech-spacer'),
744
- false,
745
- $this->plugin_slug.'-setting-admin_title_addspacers'.$key
746
- );
747
-
748
- add_settings_section(
749
- $this->plugin_slug.'_setting_section',
750
- __('', 'motech-spacer'),
751
- false,
752
- $this->plugin_slug.'-setting-admin_hd_addspacers'.$key
753
- );
754
-
755
- //add text input field
756
- $field_slug = "title_addspacers";
757
- $field_label = __('Spacer Title', 'motech-spacer');
758
- $field_id = $this->plugin_slug.'_'.$field_slug;
759
- register_setting($this->plugin_slug.'_option_group', $field_id);
760
- add_settings_field(
761
- $field_id,
762
- $field_label,
763
- array($this, 'create_a_text_input_array'), //callback function for text input
764
- $this->plugin_slug.'-setting-admin_title_addspacers'.$key,
765
- $this->plugin_slug.'_setting_section',
766
- array( // The array of arguments to pass to the callback.
767
- "id" => $field_id, //sends field id to callback
768
- "key" => $key,
769
- "class" => "addingspacer",
770
- "desc" => __('Give this Spacer a title.', 'motech-spacer'), //description of the field (optional)
771
- "placeholder" => __('eg: Medium Spacer', 'motech-spacer')
772
- //"default" => '20' //sets the default field value (optional), when grabbing this option value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
773
- )
774
- );
775
-
776
- //add text input field
777
- $field_slug = "addspacer_id";
778
- $field_label = "Spacer ID";
779
- $field_id = $this->plugin_slug.'_'.$field_slug;
780
- register_setting($this->plugin_slug.'_option_group', $field_id);
781
- $desc = "";
782
- add_settings_field(
783
- $field_id,
784
- $field_label,
785
- array($this, 'create_a_text_input_array'), //callback function for text input
786
- $this->plugin_slug.'-setting-admin_hd_addspacers'.$key,
787
- $this->plugin_slug.'_setting_section',
788
- array( // The array of arguments to pass to the callback.
789
- "id" => $field_id, //sends field id to callback
790
- "key" => $key,
791
- "class" => "hmshidden addspacer_id",
792
- "desc" => $desc, //description of the field (optional)
793
- )
794
- );
795
-
796
- add_settings_section(
797
- $this->plugin_slug.'_setting_section',
798
- __('', 'motech-spacer'),
799
- false,
800
- $this->plugin_slug.'-setting-admin_addspacers'.$key
801
- );
802
-
803
- //add text input field
804
- $field_slug = "default_height_addspacers";
805
- $field_label = __('Default Height', 'motech-spacer');
806
- $field_id = $this->plugin_slug.'_'.$field_slug;
807
- register_setting($this->plugin_slug.'_option_group', $field_id);
808
- add_settings_field(
809
- $field_id,
810
- $field_label,
811
- array($this, 'create_a_text_input_array'), //callback function for text input
812
- $this->plugin_slug.'-setting-admin_addspacers'.$key,
813
- $this->plugin_slug.'_setting_section',
814
- array( // The array of arguments to pass to the callback.
815
- "id" => $field_id, //sends field id to callback
816
- "key" => $key,
817
- "class" => 'sheight',
818
- "desc" => __('Set a default height. Note that you can also enter negative spacing to shift the following content upwards.', 'motech-spacer'), //description of the field (optional)
819
- "placeholder" => __('eg: 20', 'motech-spacer'),
820
- "default" => '20' //sets the default field value (optional), when grabbing this option value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
821
- )
822
- );
823
-
824
- //add a select input field
825
- $field_slug = "default_height_unit_addspacers";
826
- $field_label = __('Height Unit', 'motech-spacer');
827
- $field_id = $this->plugin_slug.'_'.$field_slug;
828
- $this->unit_options = array(
829
- array("label" => "px", "value" => "px"),
830
- array("label" => "em", "value" => "em"),
831
- array("label" => "rem", "value" => "rem"),
832
- array("label" => "%", "value" => "%"),
833
- );
834
- register_setting($this->plugin_slug.'_option_group', $field_id);
835
- add_settings_field(
836
- $field_id,
837
- $field_label,
838
- array($this, 'create_a_select_input_array'), //callback function for select input
839
- $this->plugin_slug.'-setting-admin_addspacers'.$key,
840
- $this->plugin_slug.'_setting_section',
841
- array( // The array of arguments to pass to the callback.
842
- "id" => $field_id, //sends select field id to callback
843
- "default" => 'px', //sets the default field value (optional), when grabbing this field value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
844
- "desc" => __('Select a unit of measurement to use with your default spacer height.', 'motech-spacer'), //description of the field (optional)
845
- "key" => $key,
846
- "class" => "msunit",
847
- "meta" => 'style="max-width:450px;"',
848
- "select_options" => $this->unit_options //sets select option data
849
- )
850
- );
851
-
852
- add_settings_section(
853
- $this->plugin_slug.'_setting_section',
854
- __('', 'motech-spacer'),
855
- false,
856
- $this->plugin_slug.'-setting-admin_mobileoptions_addspacers'.$key
857
- );
858
-
859
- //add text input field
860
- $field_slug = "default_height_mobile_addspacers";
861
- $field_label = __('Default Height On Mobile (Optional)', 'motech-spacer');
862
- $field_id = $this->plugin_slug.'_'.$field_slug;
863
- register_setting($this->plugin_slug.'_option_group', $field_id);
864
- add_settings_field(
865
- $field_id,
866
- $field_label,
867
- array($this, 'create_a_text_input_array'), //callback function for text input
868
- $this->plugin_slug.'-setting-admin_mobileoptions_addspacers'.$key,
869
- $this->plugin_slug.'_setting_section',
870
- array( // The array of arguments to pass to the callback.
871
- "id" => $field_id, //sends field id to callback
872
- "desc" => __('Set the default height on mobile devices. If left empty, the mobile height will be the same as the desktop height. If set to 0, the spacer will be hidden on mobile.', 'motech-spacer'), //description of the field (optional)
873
- "key" => $key,
874
- "placeholder" => __('eg: 10', 'motech-spacer'),
875
- "default" => '' //sets the default field value (optional), when grabbing this option value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
876
- )
877
- );
878
-
879
- //add a select input field
880
- $field_slug = "default_height_mobile_unit_addspacers";
881
- $field_label = __('Height Unit On Mobile', 'motech-spacer');
882
- $field_id = $this->plugin_slug.'_'.$field_slug;
883
- $this->unit_options = array(
884
- array("label" => "px", "value" => "px"),
885
- array("label" => "em", "value" => "em"),
886
- array("label" => "rem", "value" => "rem"),
887
- array("label" => "%", "value" => "%"),
888
- );
889
- register_setting($this->plugin_slug.'_option_group', $field_id);
890
- add_settings_field(
891
- $field_id,
892
- $field_label,
893
- array($this, 'create_a_select_input_array'), //callback function for select input
894
- $this->plugin_slug.'-setting-admin_mobileoptions_addspacers'.$key,
895
- $this->plugin_slug.'_setting_section',
896
- array( // The array of arguments to pass to the callback.
897
- "id" => $field_id, //sends select field id to callback
898
- "default" => 'px', //sets the default field value (optional), when grabbing this field value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
899
- "desc" => __('Select a unit of measurement to use with your default spacer height on mobile devices. This only applies if you have a default spacer height set for mobile.', 'motech-spacer'), //description of the field (optional)
900
- "key" => $key,
901
- "class"=> "msunitmobile",
902
- "meta" => 'style="max-width:450px;"',
903
- "select_options" => $this->unit_options //sets select option data
904
- )
905
- );
906
-
907
- add_settings_section(
908
- $this->plugin_slug.'_setting_section',
909
- __('', 'motech-spacer'),
910
- false,
911
- $this->plugin_slug.'-setting-admin_styleoptions_addspacers'.$key
912
- );
913
-
914
- //add text input field
915
- $field_slug = "spacer_class_addspacers";
916
- $field_label = __('Default Class (Optional)', 'motech-spacer');
917
- $field_id = $this->plugin_slug.'_'.$field_slug;
918
- register_setting($this->plugin_slug.'_option_group', $field_id);
919
- add_settings_field(
920
- $field_id,
921
- $field_label,
922
- array($this, 'create_a_text_input_array'), //callback function for text input
923
- $this->plugin_slug.'-setting-admin_styleoptions_addspacers'.$key,
924
- $this->plugin_slug.'_setting_section',
925
- array( // The array of arguments to pass to the callback.
926
- "id" => $field_id, //sends field id to callback
927
- "desc" => __('Enter a custom css class to apply to all of your spacer elements. Multiple classes can be added by putting a blank space between each class name', 'motech-spacer'), //description of the field (optional)
928
- "key" => $key,
929
- "placeholder" => __('eg: MyClass1 Class2', 'motech-spacer')
930
- )
931
- );
932
-
933
- //add textarea input field
934
- $field_slug = "spacer_style_addspacers";
935
- $field_label = __('Style (Optional)', 'motech-spacer');
936
- $field_id = $this->plugin_slug.'_'.$field_slug;
937
- register_setting($this->plugin_slug.'_option_group', $field_id);
938
- add_settings_field(
939
- $field_id,
940
- $field_label,
941
- array($this, 'create_a_textarea_input_array'), //callback function for textarea input
942
- $this->plugin_slug.'-setting-admin_styleoptions_addspacers'.$key,
943
- $this->plugin_slug.'_setting_section',
944
- array( // The array of arguments to pass to the callback.
945
- "id" => $field_id, //sends field id to callback
946
- "desc" => __('Enter custom css to apply to all of your spacer elements. This is for advanced users. Just leave this empty if you\'re not sure what this means or if you don\'t have a use for it.<br><span style="color:red">NEW:</span> Want to create visually stunning divider elements, without needing to know any CSS? See <a href="http://www.clevelandwebdeveloper.com/wordpress-plugins/visual-artist/?utm_medium=plugin&amp;utm_source=plugin-settings-page&amp;utm_campaign=Spacers+Settings+Page&amp;utm_content=Spacer+Inline" target="_blank">examples of what you can do with the Visual Artist add-on &raquo;</a><br>Ready to make your own? <a href="#" class="buynowbutton" addonname="visualartist">Buy It Now &raquo;</a>', 'motech-spacer'), //description of the field (optional)
947
- "key" => $key,
948
- "class" => 'msstyle',
949
- "placeholder" => __('(for example)', 'motech-spacer').' border-top: solid 2px black; border-bottom: solid 2px black; margin-bottom: 25px;' //sets the field placeholder which appears when the field is empty (optional)
950
- )
951
- );
952
-
953
- //add text input field
954
- $field_slug = "addspacer_index";
955
- $field_label = "Add Spacer index";
956
- $field_id = $this->plugin_slug.'_'.$field_slug;
957
- register_setting($this->plugin_slug.'_option_group', $field_id);
958
- $desc = "";
959
- add_settings_field(
960
- $field_id,
961
- $field_label,
962
- array($this, 'create_a_text_input'), //callback function for text input
963
- $this->plugin_slug.'-setting-admin_hdoptions',
964
- $this->plugin_slug.'_setting_section',
965
- array( // The array of arguments to pass to the callback.
966
- "id" => $field_id, //sends field id to callback
967
- "class" => "hmshidden",
968
- "default" => "1",
969
- "desc" => $desc, //description of the field (optional)
970
- )
971
- );
972
-
973
- }
974
-
975
- }
976
-
977
- public function DisplayMobileOptions(){
978
- add_settings_section(
979
- $this->plugin_slug.'_setting_section',
980
- __('', 'motech-spacer'),
981
- false,
982
- $this->plugin_slug.'-setting-admin_mobileoptions'
983
- );
984
-
985
- //add text input field
986
- $field_slug = "default_height_mobile";
987
- $field_label = __('Default Spacer Height On Mobile (Optional)', 'motech-spacer');
988
- $field_id = $this->plugin_slug.'_'.$field_slug;
989
- register_setting($this->plugin_slug.'_option_group', $field_id);
990
- add_settings_field(
991
- $field_id,
992
- $field_label,
993
- array($this, 'create_a_text_input'), //callback function for text input
994
- $this->plugin_slug.'-setting-admin_mobileoptions',
995
- $this->plugin_slug.'_setting_section',
996
- array( // The array of arguments to pass to the callback.
997
- "id" => $field_id, //sends field id to callback
998
- "desc" => __('Set the default spacer height on mobile devices. If left empty, the spacer mobile height will be the same as the spacer desktop height. If set to 0, the spacer will be hidden on mobile.', 'motech-spacer'), //description of the field (optional)
999
- "placeholder" => __('eg: 10', 'motech-spacer'),
1000
- "default" => '' //sets the default field value (optional), when grabbing this option value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
1001
- )
1002
- );
1003
-
1004
- //add a select input field
1005
- $field_slug = "default_height_mobile_unit";
1006
- $field_label = __('Spacer Height Unit On Mobile', 'motech-spacer');
1007
- $field_id = $this->plugin_slug.'_'.$field_slug;
1008
- $this->unit_options = array(
1009
- array("label" => "px", "value" => "px"),
1010
- array("label" => "em", "value" => "em"),
1011
- array("label" => "rem", "value" => "rem"),
1012
- array("label" => "%", "value" => "%"),
1013
- );
1014
- register_setting($this->plugin_slug.'_option_group', $field_id);
1015
- add_settings_field(
1016
- $field_id,
1017
- $field_label,
1018
- array($this, 'create_a_select_input'), //callback function for select input
1019
- $this->plugin_slug.'-setting-admin_mobileoptions',
1020
- $this->plugin_slug.'_setting_section',
1021
- array( // The array of arguments to pass to the callback.
1022
- "id" => $field_id, //sends select field id to callback
1023
- "default" => 'px', //sets the default field value (optional), when grabbing this field value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
1024
- "desc" => __('Select a unit of measurement to use with your default spacer height on mobile devices. This only applies if you have a default spacer height set for mobile.', 'motech-spacer'), //description of the field (optional)
1025
- "meta" => 'style="max-width:450px;"',
1026
- "select_options" => $this->unit_options //sets select option data
1027
- )
1028
- );
1029
- }
1030
-
1031
- public function DisplayStyleOptions(){
1032
- add_settings_section(
1033
- $this->plugin_slug.'_setting_section',
1034
- __('', 'motech-spacer'),
1035
- false,
1036
- $this->plugin_slug.'-setting-admin_styleoptions'
1037
- );
1038
-
1039
- //add text input field
1040
- $field_slug = "spacer_class";
1041
- $field_label = __('Default Spacer Class (Optional)', 'motech-spacer');
1042
- $field_id = $this->plugin_slug.'_'.$field_slug;
1043
- register_setting($this->plugin_slug.'_option_group', $field_id);
1044
- add_settings_field(
1045
- $field_id,
1046
- $field_label,
1047
- array($this, 'create_a_text_input'), //callback function for text input
1048
- $this->plugin_slug.'-setting-admin_styleoptions',
1049
- $this->plugin_slug.'_setting_section',
1050
- array( // The array of arguments to pass to the callback.
1051
- "id" => $field_id, //sends field id to callback
1052
- "desc" => __('Enter a custom css class to apply to all of your spacer elements. Multiple classes can be added by putting a blank space between each class name', 'motech-spacer'), //description of the field (optional)
1053
- "placeholder" => __('eg: MyClass1 Class2', 'motech-spacer')
1054
- )
1055
- );
1056
-
1057
- //add textarea input field
1058
- $field_slug = "spacer_style";
1059
- $field_label = __('Spacer Style (Optional)', 'motech-spacer');
1060
- $field_id = $this->plugin_slug.'_'.$field_slug;
1061
- register_setting($this->plugin_slug.'_option_group', $field_id);
1062
- add_settings_field(
1063
- $field_id,
1064
- $field_label,
1065
- array($this, 'create_a_textarea_input'), //callback function for textarea input
1066
- $this->plugin_slug.'-setting-admin_styleoptions',
1067
- $this->plugin_slug.'_setting_section',
1068
- array( // The array of arguments to pass to the callback.
1069
- "id" => $field_id, //sends field id to callback
1070
- "desc" => __('Enter custom css to apply to all of your spacer elements. This is for advanced users. Just leave this empty if you\'re not sure what this means or if you don\'t have a use for it.<br><span style="color:red">NEW:</span> Want to create visually stunning divider elements, without needing to know any CSS? See <a href="http://www.clevelandwebdeveloper.com/wordpress-plugins/visual-artist/?utm_medium=plugin&amp;utm_source=plugin-settings-page&amp;utm_campaign=Spacers+Settings+Page&amp;utm_content=Spacer+Inline" target="_blank">examples of what you can do with the Visual Artist add-on &raquo;</a><br>Ready to make your own? <a href="#" class="buynowbutton" addonname="visualartist">Buy It Now &raquo;</a>', 'motech-spacer'), //description of the field (optional)
1071
- "placeholder" => __('(for example)', 'motech-spacer').' border-top: solid 2px black; border-bottom: solid 2px black; margin-bottom: 25px;' //sets the field placeholder which appears when the field is empty (optional)
1072
- )
1073
- );
1074
-
1075
- if(has_filter('spacer_default_settings')) {
1076
- apply_filters('spacer_default_settings','',$this);
1077
- }
1078
-
1079
- add_settings_section(
1080
- $this->plugin_slug.'_setting_section',
1081
- __('', 'motech-spacer'),
1082
- false,
1083
- $this->plugin_slug.'-setting-admin_hdoptions'
1084
- );
1085
- }
1086
-
1087
- public function page_init(){
1088
-
1089
- //register other settings sections
1090
- $this->DisplayMobileOptions();
1091
- $this->DisplayStyleOptions();
1092
- $this->DisplayAddSpacers();
1093
- do_action( 'spacer_sectionfieldhook', $this ); #use this hook to add additional field sections
1094
-
1095
-
1096
- add_settings_section(
1097
- $this->plugin_slug.'_setting_section',
1098
- __('Configure Default Spacer', 'motech-spacer'),
1099
- array($this, 'print_section_info'),
1100
- $this->plugin_slug.'-setting-admin'
1101
- );
1102
-
1103
- add_settings_section(
1104
- $this->plugin_slug.'_setting_section',
1105
- __('Licenses', 'motech-spacer'),
1106
- array($this, 'print_section_info_licenses'),
1107
- $this->plugin_slug.'-setting-admin_licenses'
1108
- );
1109
-
1110
- if(has_filter('spacer_licenses_settings')) {
1111
- apply_filters('spacer_licenses_settings','',$this);
1112
- }
1113
-
1114
- //add text input field
1115
- $field_slug = "default_height";
1116
- $field_label = __('Default Spacer Height', 'motech-spacer');
1117
- $field_id = $this->plugin_slug.'_'.$field_slug;
1118
- register_setting($this->plugin_slug.'_option_group', $field_id);
1119
- add_settings_field(
1120
- $field_id,
1121
- $field_label,
1122
- array($this, 'create_a_text_input'), //callback function for text input
1123
- $this->plugin_slug.'-setting-admin',
1124
- $this->plugin_slug.'_setting_section',
1125
- array( // The array of arguments to pass to the callback.
1126
- "id" => $field_id, //sends field id to callback
1127
- "desc" => __('Speed up your workflow by setting a default height to apply to your spacers. Note that you can also enter negative spacing to shift the following content upwards.', 'motech-spacer'), //description of the field (optional)
1128
- "placeholder" => __('eg: 20', 'motech-spacer'),
1129
- "default" => '20' //sets the default field value (optional), when grabbing this option value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
1130
- )
1131
- );
1132
-
1133
- //add a select input field
1134
- $field_slug = "default_height_unit";
1135
- $field_label = __('Spacer Height Unit', 'motech-spacer');
1136
- $field_id = $this->plugin_slug.'_'.$field_slug;
1137
- $this->unit_options = array(
1138
- array("label" => "px", "value" => "px"),
1139
- array("label" => "em", "value" => "em"),
1140
- array("label" => "rem", "value" => "rem"),
1141
- array("label" => "%", "value" => "%"),
1142
- );
1143
- register_setting($this->plugin_slug.'_option_group', $field_id);
1144
- add_settings_field(
1145
- $field_id,
1146
- $field_label,
1147
- array($this, 'create_a_select_input'), //callback function for select input
1148
- $this->plugin_slug.'-setting-admin',
1149
- $this->plugin_slug.'_setting_section',
1150
- array( // The array of arguments to pass to the callback.
1151
- "id" => $field_id, //sends select field id to callback
1152
- "default" => 'px', //sets the default field value (optional), when grabbing this field value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
1153
- "desc" => __('Select a unit of measurement to use with your default spacer height.', 'motech-spacer'), //description of the field (optional)
1154
- "meta" => 'style="max-width:450px;"',
1155
- "select_options" => $this->unit_options //sets select option data
1156
- )
1157
- );
1158
-
1159
-
1160
- //add radio option
1161
- //$option_id = "status";
1162
- //add_settings_field($option_id, 'Status', array($this, 'create_radio_field'), 'wordpresshidesite-setting-admin', 'setting_section_id', array("option_id" => $option_id));
1163
-
1164
- } //end page_init
1165
-
1166
-
1167
- /**
1168
- * This following set of functions handle all input field creation
1169
- *
1170
- */
1171
- function create_image_upload($args) {
1172
- ?>
1173
- <?php
1174
- //set default value if applicable
1175
- if(isset($args["default"])) {
1176
- $default = $args["default"];
1177
- } else {
1178
- $default = false;
1179
- }
1180
- if(isset($args["meta"])) {
1181
- $meta = $args["meta"];
1182
- } else {
1183
- $meta = "";
1184
- }
1185
- ?>
1186
- <input class="motech_upload_image" type="text" name="<?php echo $args["id"] ?>" value="<?php echo get_option($args["id"], $default) ?>" <?php echo $meta ?> />
1187
- <input class="motech_upload_image_button" class="button" type="button" value="<?php _e('Upload Image', 'motech-spacer')?>" />
1188
- <br />
1189
- <?php
1190
- if(isset($args["desc"])) {
1191
- echo "<span class='description'>".$args["desc"]."</span>";
1192
- } else {
1193
- echo "<span class='description'>".__('Enter a URL or upload an image.', 'motech-spacer')."</span>";
1194
- }
1195
- ?>
1196
- <?php /*?> <?php
1197
- $current_image = get_option($args["id"],$default);
1198
- if(!empty($current_image)) {
1199
- echo "<span class='motech_spacer_preview_image_container'><br><strong>".__('Image Preview', 'motech-spacer')."</strong><br><span class='motech_spacer_preview_image' style='background-size: contain;background-position: 0% 0%;background-repeat: no-repeat;margin-left:20px;display:block; width:75px; height: 75px;background-image:url(".$current_image.");'></span></span>";
1200
- }
1201
- ?><?php */?>
1202
- <?php
1203
- } // end create_image_upload
1204
-
1205
- function create_image_upload_array($args) {
1206
- ?>
1207
- <?php
1208
- //set default value if applicable
1209
- if(isset($args["default"])) {
1210
- $default = $args["default"];
1211
- } else {
1212
- $default = false;
1213
- }
1214
- $key = $args["key"];
1215
- $getarray = get_option($args["id"]);
1216
- if(!isset($getarray[$key])){
1217
- $getarray[$key] = "";
1218
- }
1219
- ?>
1220
- <input class="motech_upload_image" type="text" name="<?php echo $args["id"]."[".$key."]" ?>" value="<?php echo $getarray[$key] ?>" />
1221
- <input class="motech_upload_image_button" class="button" type="button" value="<?php _e('Upload Image', 'motech-spacer')?>" />
1222
- <br />
1223
- <?php
1224
- if(isset($args["desc"])) {
1225
- echo "<span class='description'>".$args["desc"]."</span>";
1226
- } else {
1227
- echo "<span class='description'>".__('Enter a URL or upload an image.', 'motech-spacer')."</span>";
1228
- }
1229
- ?>
1230
- <?php /*?> <?php
1231
- $current_image = $getarray[$key];
1232
- if(!empty($current_image)) {
1233
- echo "<span class='motech_spacer_preview_image_container'><br><strong>".__('Image Preview', 'motech-spacer')."</strong><br><span class='motech_spacer_preview_image' style='background-size: contain;background-position: 0% 0%;background-repeat: no-repeat;margin-left:20px;display:block; width:75px; height: 75px;background-image:url(".$current_image.");'></span>";
1234
- }
1235
- ?><?php */?>
1236
- <?php
1237
- } // end create_image_upload
1238
-
1239
- function create_a_checkbox($args) {
1240
- $html = '<input type="checkbox" id="' . $args["id"] . '" name="' . $args["id"] . '" value="1" ' . checked(1, get_option($args["id"], $args["default"]), false) . '/>';
1241
-
1242
- // Here, we will take the desc argument of the array and add it to a label next to the checkbox
1243
- $html .= '<label for="' . $args["id"] . '">&nbsp;' . $args["desc"] . '</label>';
1244
-
1245
- echo $html;
1246
-
1247
- } // end create_a_checkbox
1248
-
1249
- function create_a_text_input($args) {
1250
- //grab placeholder if there is one
1251
- if(isset($args["placeholder"])) {
1252
- $placeholder_html = "placeholder=\"".$args["placeholder"]."\"";
1253
- } else {
1254
- $placeholder_html = "";
1255
- }
1256
- //grab maxlength if there is one
1257
- if(isset($args["maxlength"])) {
1258
- $max_length_html = "maxlength=\"".$args["maxlength"]."\"";
1259
- } else {
1260
- $max_length_html = "";
1261
- }
1262
- if(isset($args["default"])) {
1263
- $default = $args["default"];
1264
- } else {
1265
- $default = false;
1266
- }
1267
- if(!isset($args["class"])){
1268
- $args["class"] = "";
1269
- }
1270
- // Render the output
1271
- echo '<input type="text" ' . $placeholder_html . $max_length_html . ' id="' . $args["id"] . '" class="' . $args["class"]. '" name="' . $args["id"] . '" value="' . get_option($args["id"], $default) . '" />';
1272
- if(isset($args["desc"])) {
1273
- echo "<p class='description'>".$args["desc"]."</p>";
1274
- }
1275
-
1276
-
1277
- } // end create_a_text_input
1278
-
1279
- function create_a_text_input_array($args) {
1280
- //grab placeholder if there is one
1281
- if(isset($args["placeholder"])) {
1282
- $placeholder_html = "placeholder=\"".$args["placeholder"]."\"";
1283
- } else {
1284
- $placeholder_html = "";
1285
- }
1286
- //grab maxlength if there is one
1287
- if(isset($args["maxlength"])) {
1288
- $max_length_html = "maxlength=\"".$args["maxlength"]."\"";
1289
- } else {
1290
- $max_length_html = "";
1291
- }
1292
- if(isset($args["default"])) {
1293
- $usevalue = $args["default"];
1294
- }
1295
- if(!isset($args["class"])){
1296
- $args["class"] = "";
1297
- }
1298
- $key = $args["key"];
1299
- $getarray = get_option($args["id"]);
1300
- if(!isset($getarray[$key])){
1301
- //$getarray[$key] = "";
1302
- $usevalue = "";
1303
- } else {
1304
- $usevalue = $getarray[$key];
1305
- }
1306
- // Render the output
1307
- echo '<input type="text" ' . $placeholder_html . $max_length_html . ' class="' . $args["class"]. '" name="' . $args["id"] . '['.$key.']" value="' . $usevalue . '" />';
1308
- //echo '<input type="text" ' . ' name="' . $args["id"] . '['.$key.']" value="' . $value . '" />';
1309
- if(isset($args["desc"])) {
1310
- echo "<p class='description'>".$args["desc"]."</p>";
1311
- }
1312
-
1313
-
1314
- } // end create_a_text_input
1315
-
1316
- function create_a_textarea_input($args) {
1317
- //grab placeholder if there is one
1318
- if($args["placeholder"]) {
1319
- $placeholder_html = "placeholder=\"".$args["placeholder"]."\"";
1320
- } else {
1321
- $placeholder_html = "";
1322
- }
1323
- //get default value if there is one
1324
- if(isset($args["default"])) {
1325
- $default = $args["default"];
1326
- } else {
1327
- $default = false;
1328
- }
1329
- // Render the output
1330
- echo '<textarea ' . $placeholder_html . ' id="' . $args["id"] . '" name="' . $args["id"] . '" rows="5" cols="50">' . get_option($args["id"], $default) . '</textarea>';
1331
- if($args["desc"]) {
1332
- echo "<p class='description'>".$args["desc"]."</p>";
1333
- }
1334
- }
1335
-
1336
- function create_a_textarea_input_array($args) {
1337
- //grab placeholder if there is one
1338
- if($args["placeholder"]) {
1339
- $placeholder_html = "placeholder=\"".$args["placeholder"]."\"";
1340
- } else {
1341
- $placeholder_html = "";
1342
- }
1343
- //get default value if there is one
1344
- if(isset($args["default"])) {
1345
- $default = $args["default"];
1346
- } else {
1347
- $default = false;
1348
- }
1349
- if(!isset($args["class"])){
1350
- $args["class"] = "";
1351
- }
1352
- $key = $args["key"];
1353
- $getarray = get_option($args["id"], $default);
1354
- if(!isset($getarray[$key])){
1355
- $getarray[$key] = "";
1356
- }
1357
- // Render the output
1358
- echo '<textarea ' . $placeholder_html . ' id="' . $args["id"] . $args["key"] .'" class="' . $args["class"]. '" name="' . $args["id"] . '['.$key.']" rows="5" cols="50">' . $getarray[$key] . '</textarea>';
1359
- if($args["desc"]) {
1360
- echo "<p class='description'>".$args["desc"]."</p>";
1361
- }
1362
- }
1363
-
1364
- function create_a_radio_input($args) {
1365
-
1366
- $radio_options = $args["radio_options"];
1367
- $html = "";
1368
- if($args["desc"]) {
1369
- $html .= $args["desc"] . "<br>";
1370
- }
1371
- //get default value if there is one
1372
- if(isset($args["default"])) {
1373
- $default = $args["default"];
1374
- } else {
1375
- $default = false;
1376
- }
1377
- foreach($radio_options as $radio_option) {
1378
- $html .= '<input type="radio" id="' . $args["id"] . '_' . $radio_option["value"] . '" name="' . $args["id"] . '" value="'.$radio_option["value"].'" ' . checked($radio_option["value"], get_option($args['id'], $default), false) . '/>';
1379
- $html .= '<label for="' . $args["id"] . '_' . $radio_option["value"] . '"> '.$radio_option["label"].'</label><br>';
1380
- }
1381
-
1382
- echo $html;
1383
-
1384
- } // end create_a_radio_input callback
1385
-
1386
- function create_a_select_input($args) {
1387
-
1388
- $select_options = $args["select_options"];
1389
- $html = "";
1390
- //get default value if there is one
1391
- if(isset($args["default"])) {
1392
- $default = $args["default"];
1393
- } else {
1394
- $default = false;
1395
- }
1396
- if(isset($args["meta"])) {
1397
- $meta = $args["meta"];
1398
- } else {
1399
- $meta = "";
1400
- }
1401
- $html .= '<select id="' . $args["id"] . '" name="' . $args["id"] . '" ' . $meta . '" >';
1402
- foreach($select_options as $select_option) {
1403
- $html .= '<option value="'.$select_option["value"].'" ' . selected( $select_option["value"], get_option($args["id"], $default), false) . '>'.$select_option["label"].'</option>';
1404
- }
1405
- $html .= '</select>';
1406
- if(isset($args["desc"])) {
1407
- $html .= "<p class='description'>".$args["desc"]."</p>";
1408
- }
1409
- echo $html;
1410
-
1411
- } // end create_a_select_input callback
1412
-
1413
- function create_a_select_input_array($args) {
1414
-
1415
- $select_options = $args["select_options"];
1416
- $html = "";
1417
- //get default value if there is one
1418
- if(isset($args["default"])) {
1419
- $usevalue = $args["default"];
1420
- } else {
1421
- //$default = false;
1422
- }
1423
- if(isset($args["meta"])) {
1424
- $meta = $args["meta"];
1425
- } else {
1426
- $meta = "";
1427
- }
1428
- if(!isset($args["class"])){
1429
- $args["class"] = "";
1430
- }
1431
- $key = $args["key"];
1432
- $getarray = get_option($args["id"]);
1433
- if(!isset($getarray[$key])){
1434
- //$getarray[$key] = "";
1435
- } else {
1436
- $usevalue = $getarray[$key];
1437
- }
1438
- $html .= '<select id="' . $args["id"] . $args["key"] . '" class="' . $args["class"]. '" name="' . $args["id"]. '['.$key.']" ' . $meta . '" >';
1439
- foreach($select_options as $select_option) {
1440
- $html .= '<option value="'.$select_option["value"].'" ' . selected( $select_option["value"], $usevalue, false) . '>'.$select_option["label"].'</option>';
1441
- }
1442
- $html .= '</select>';
1443
- if(isset($args["desc"])) {
1444
- $html .= "<p class='description'>".$args["desc"]."</p>";
1445
- }
1446
- echo $html;
1447
-
1448
- } // end create_a_select_input callback
1449
-
1450
- public function print_section_info(){ //section summary info goes here
1451
- //print 'This is the where you set the password for your site.';
1452
- }
1453
-
1454
- public function print_section_info_licenses(){ //section summary info goes here
1455
- if(!has_filter('spacer_licenses_settings')) {
1456
- _e('To activate licenses for Spacer add ons you must first install and activate the chosen add on. License settings will then appear below.', 'motech-spacer');
1457
- }
1458
- }
1459
-
1460
- public function add_plugin_page(){
1461
- // This page will be under "Settings"
1462
- add_options_page('Settings Admin', $this->plugin_label, 'manage_options', $this->plugin_slug.'-setting-admin', array($this, 'create_admin_page'));
1463
- }
1464
-
1465
- //add plugin action links logic
1466
- function add_plugin_action_links( $links ) {
1467
-
1468
-
1469
- return array_merge(
1470
- array(
1471
- 'settings' => '<a href="' . get_bloginfo( 'wpurl' ) . '/wp-admin/options-general.php?page='.$this->plugin_slug.'-setting-admin">'.__('Settings', 'motech-spacer').'</a>'
1472
- ),
1473
- $links
1474
- );
1475
-
1476
- }
1477
-
1478
- function motech_imagepicker_admin_css() {
1479
- if (isset($_GET['page']) && $_GET['page'] == $this->plugin_slug.'-setting-admin') { //if we are on our admin page
1480
- ?>
1481
- <style>
1482
- .motech_spacer_preview_image { -moz-transition: all .5s ease-out;
1483
- -o-transition: all .5s ease-out;
1484
- transition: all .5s ease-out;}
1485
- .spacer_preview_area_container h2 {margin-bottom:3px;}
1486
- .addspacerunit .spacer_preview_area_container h2 {font-size:1.3em;font-weight:bold; padding-bottom: 0px; margin-bottom: -3px;}
1487
- .spacer_preview_area { min-height: 75px; overflow: hidden;
1488
- background: white;
1489
- padding-left: 25px;
1490
- padding-top: 1px;
1491
- padding-bottom: 11px;
1492
- padding-right: 25px;box-shadow: 0 1px 1px rgba(0,0,0,.04); border: #e5e5e5 solid 1px;}
1493
- .spacer_preview {-moz-transition: all .5s ease-out;-o-transition: all .5s ease-out;transition: all .5s ease-out;}
1494
- .spacer_preview_area p {
1495
- font-size: 15px;}
1496
- .nothinghere {text-align:center;color:#9C9C98;}
1497
- .newbutton,.removebutton,.savebutton {
1498
- font-family: Helvetica,Verdana,sans-serif!important;
1499
- margin: 10px;
1500
- background: #3ba0ff;
1501
- color:#fff;
1502
- display:block;
1503
- font-weight:700;
1504
- font-size:14px;
1505
- padding:10px;
1506
- text-shadow:none;
1507
- text-align: center;cursor:pointer; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none;
1508
- user-select: none; transition: background 300ms ease-out;
1509
- }
1510
- .motech-spacer-options.general h3{
1511
- font-size: 23px !important;
1512
- font-weight: normal;
1513
- padding-left: 0px;
1514
- }
1515
- .newbutton:hover{background:#1E7CD4;}
1516
- .newbutton{margin-bottom:50px;}
1517
- .removebutton{background:red;margin-top: 27px; margin-bottom: 26px;}
1518
- .removebutton:hover{background:#a00;}
1519
- .js .postbox .handlediv { background: transparent;
1520
- border: 0;
1521
- outline: 0;}
1522
- .js .postbox .handlediv .toggle-indicator:before {
1523
- margin-top: 4px;
1524
- width: 20px;
1525
- -webkit-border-radius: 50%;
1526
- border-radius: 50%;
1527
- text-indent: -1px;
1528
- }
1529
- .savebutton {padding: 0px;background:#45CE58;margin-top: 40px;}
1530
- .savebutton:hover {background:#39b54a;}
1531
- .savebutton button{width: 100%;
1532
- border: 0;
1533
- outline: 0;
1534
- padding: 10px;
1535
- background: none;
1536
- cursor: pointer;
1537
- color: white;}
1538
- .savebutton .dashicons{
1539
- font-size: 28px;
1540
- position: relative;
1541
- top: -4px;
1542
- left: -2px;
1543
- }
1544
- .js .postbox .toggle-indicator:before, .js .sidebar-name .sidebar-name-arrow:before {
1545
- content: "\f142";
1546
- display: inline-block;
1547
- font: 400 20px/1 dashicons;
1548
- speak: none;
1549
- -webkit-font-smoothing: antialiased;
1550
- -moz-osx-font-smoothing: grayscale;
1551
- text-decoration: none!important;
1552
- }
1553
- .js .postbox.closed .handlediv .toggle-indicator:before, .js .widgets-holder-wrap.closed .sidebar-name-arrow:before {
1554
- content: "\f140";
1555
- }
1556
- .motech_spacer_form .postbox .hndle {cursor:pointer;font-size: 14px;
1557
- font-weight: bold;
1558
- padding: 8px 12px;
1559
- line-height: 1.4;
1560
- border-bottom: 1px solid #eee;}
1561
- .hmshidden {display:none;}
1562
- #wpbody h3 {font-size:20px;}
1563
- #hide_my_site_current_theme {display:none;}
1564
- div.updated.success {background-color: rgb(169, 252, 169);border-color: rgb(85, 151, 85);}
1565
- .mvalid {background-color: rgb(169, 252, 169);border-color: rgb(85, 151, 85);width: 127px;font-weight: bold;padding-left: 10px;border: solid 1px rgb(85, 151, 85);border-radius: 3px;}
1566
- .motech_premium_only {color:red;}
1567
- #green_ribbon_top {position:relative;z-index:2;}
1568
- #green_ribbon_left {background:url(<?php echo $this->plugin_dir ?>/images/green_ribbon_left.png) no-repeat -11px 0px;width: 80px;height: 60px;float: left;}
1569
- #green_ribbon_right {background:url(<?php echo $this->plugin_dir ?>/images/green_ribbon_right.png) no-repeat;width: 80px;height: 60px;position: absolute;top: 0px;right: -10px;}
1570
- #green_ribbon_base {background:url(<?php echo $this->plugin_dir ?>/images/green_ribbon_base.png) repeat-x;height: 60px;margin-left: 49px;margin-right: 70px;}
1571
- #green_ribbon_base span {display: inline-block;color: white;position: relative;top: 11px;height: 35px; line-height:33px;font-size: 17px;font-weight: bold;font-style: italic;text-shadow: 1px 3px 2px #597c2a;}
1572
- #hms_get_premium {background: rgb(58, 80, 27);background: rgba(58, 80, 27, 0.73);cursor:pointer;padding: 0px 12px;margin-left: -17px;font-style: normal !important;margin-right: 12px;text-shadow: 1px 3px 2px #364C18 !important;}
1573
- #hms_get_premium:hover {background:rgb(30, 43, 12);background:rgba(30, 43, 12, 0.73);text-shadow: 1px 3px 2px #21310B !important;}
1574
- .motech_premium_box {background:url(<?php echo $this->plugin_dir ?>/images/premium_back.png); margin-left: 49px;padding-top: 29px;padding-bottom:36px;margin-right: 70px;position:relative;top:-16px;display:none;}
1575
- .motech_premium_box_wrap {margin-left:20px; margin-right:20px;}
1576
- .motech_premium_box h2 {text-align: center;color: #585858;font-size: 36px;text-shadow: 1px 3px 2px #acabab;}
1577
- .motech_premium_box .updated {margin-bottom: 20px !important;margin-top: 29px !important;}
1578
- .motech_premium_box button {background: none;border: none; position:relative;cursor: pointer;overflow: visible;}
1579
- .motech_purchase_button .purchase_graphic {background:url(<?php echo $this->plugin_dir ?>/images/buy_sprite.png) no-repeat;height: 100px;width: 101px;background-position: -17px -24px;color: white;font-size: 22px;padding: 20px 42px;padding-top: 57px;text-shadow: 1px 1px 7px black;position: absolute;top: -80px;left: -80px;line-height:normal;font-family: 'Open Sans', sans-serif;}
1580
- .redeem_info{margin-top:20px;display:none;}
1581
- .motech_purchase_button.unlimited_use .purchase_graphic {width: 115px;padding: 21px 36px;padding-top: 57px;}
1582
- .motech_purchase_button.unlimited_use .purchase_graphic span {font-weight:bold;}
1583
- .motech_purchase_button .purchase_bubble {background: white;border-radius: 9px;width: 350px;height: 123px;margin-bottom: 5px;-webkit-transition: all .2s ease-out; -moz-transition: all .2s ease-out;-o-transition: all .2s ease-out;transition: all .2s ease-out;}
1584
- .motech_purchase_button:hover .purchase_bubble { background-color: #99dcf8;box-shadow:2px 3px 2px rgba(0, 0, 0, 0.31);}
1585
- .motech_purchase_button.three_use:hover .purchase_bubble { background-color: #96f5e4;}
1586
- .motech_purchase_button.unlimited_use:hover .purchase_bubble { background-color: #f8c4c6;}
1587
- .motech_purchase_buttons {padding-top:90px;text-align:center;}
1588
- .motech_purchase_button {display:inline-block;margin-right: 100px;vertical-align:top;}
1589
- .motech_purchase_button .purchase_price {font-size: 60px;color: #585858;line-height:normal;}
1590
- .motech_purchase_button:last-child {margin-right:0px;}
1591
- .motech_purchase_button.three_use .purchase_graphic {background-position: -208px -24px;}
1592
- .motech_purchase_button.unlimited_use .purchase_graphic {background-position: -397px -24px;}
1593
- .motech_premium_cancel {color:#626262;text-align:center;font-size:22px;margin-top:43px;}
1594
- .motech_premium_cancel span:hover {cursor:pointer;text-decoration:underline;}
1595
- .<?php echo $this->plugin_slug ?>_form > .form-table {max-width:770px;}
1596
-
1597
-
1598
- /*css for the image picker*/
1599
- .motech_image_picker img {border-radius: 14px;box-shadow: 0px 0px 0px 2px rgba(0, 0, 255, 0.3);}
1600
- .motech_image_picker_wrap:hover img, .motech_image_picker_wrap:focus img {box-shadow: 0px 0px 0px 2px rgba(0, 0, 255, 0.56);}
1601
- .motech_image_picker_wrap.current img, .motech_image_picker_wrap:active img {box-shadow: 0px 0px 0px 4px rgba(0, 0, 255, 0.9);}
1602
- .motech_image_picker_wrap {display:inline-block;cursor: pointer;margin-right:20px;margin-bottom: 30px;}
1603
- .motech_image_picker_wrap div {font-weight:bold;font-size:16px;margin-top:10px;color:rgba(0, 0, 0, 0.47);}
1604
- </style>
1605
- <?php
1606
- if(has_filter('spacer_add_to_admincss')) {
1607
- apply_filters('spacer_add_to_admincss','');
1608
- }
1609
- ?>
1610
- <style>
1611
-
1612
- /* Begin Responsive
1613
- ====================================================================== */
1614
- @media only screen and (max-width: 1700px) {
1615
- .motech_purchase_button .purchase_price {font-size: 42px;padding-top: 18px;}
1616
- .motech_purchase_button .purchase_bubble {width: 252px;}
1617
- }
1618
- @media only screen and (max-width: 1535px) {
1619
- .motech_purchase_button .purchase_bubble {width: 131px;padding-top: 69px;}
1620
- .motech_purchase_button .purchase_graphic {left: -23px;}
1621
- .motech_purchase_button {margin-right:70px;}
1622
- }
1623
- @media only screen and (max-width: 1255px) {
1624
- .motechdonate {height: 55px;}
1625
- }
1626
- @media only screen and (max-width: 1025px) {
1627
- .hms_get_premium_meta {display:none !important;}
1628
- }
1629
- @media only screen and (max-width: 980px) {
1630
- .motech_purchase_button {display:block;margin-bottom: 80px;margin-right:0px;}
1631
- }
1632
- @media only screen and (max-width: 445px) {
1633
- .motech_premium_box h2 {font-size:22px;}
1634
- }
1635
- @media only screen and (max-width: 380px) {
1636
- #green_ribbon_base span {font-size: 12px;}
1637
- #hms_get_premium {margin-right:0px;}
1638
- }
1639
- @media only screen and (max-width: 330px) {
1640
- .motech_purchase_button {
1641
- margin-left: -9px;
1642
- }
1643
- </style>
1644
-
1645
- <!--[if lt IE 9]>
1646
- <style>
1647
- .motech_image_picker_wrap.current img, .motech_image_picker_wrap:active img {
1648
- border: 4px solid rgb(0, 0, 255);
1649
- margin:-4px;
1650
- }
1651
- .motech_purchase_button {
1652
- display: block;
1653
- padding-bottom: 70px;
1654
- margin-right: 0px;
1655
- }
1656
- .motech_purchase_button.unlimited_use {
1657
- padding-bottom: 0px;
1658
- }
1659
- .hms_get_premium_meta {display:none !important;}
1660
- </style>
1661
- <![endif]-->
1662
- <?php
1663
- }
1664
- }
1665
-
1666
- function po($input) {
1667
- if (get_option($this->plugin_slug . '_ihmsa','') == 'hmsia') {
1668
- return $input;
1669
- }
1670
- if(is_array($input)){
1671
- foreach($input as $val){
1672
- if (!empty($val)) {
1673
- add_settings_error('plk_error_id81',esc_attr('settings_updated_81'),__('A premium option was not saved. You must first enter your license key to unlock this premium feature.', 'motech-spacer'),'error');
1674
- }
1675
- }
1676
- } else {
1677
- if (!empty($input)) {
1678
- add_settings_error('plk_error_id81',esc_attr('settings_updated_81'),__('A premium option was not saved. You must first enter your license key to unlock this premium feature.', 'motech-spacer'),'error');
1679
- }
1680
- }
1681
-
1682
- }
1683
-
1684
- function po_px($input) {
1685
- if (get_option($this->plugin_slug . '_ihmsa','') == 'hmsia') {
1686
- return $input;
1687
- }
1688
- if ($input != "px") {
1689
- add_settings_error('plk_error_id82',esc_attr('settings_updated_82'),__('A premium option was not saved. You must first enter your license key to unlock this premium feature.', 'motech-spacer'),'error');
1690
- }
1691
- }
1692
-
1693
- function po_repeat($input) {
1694
- if (get_option($this->plugin_slug . '_ihmsa','') == 'hmsia') {
1695
- return $input;
1696
- }
1697
-
1698
- if(is_array($input)){
1699
- foreach($input as $val){
1700
- if ($val != "repeat") {
1701
- add_settings_error('plk_error_id81',esc_attr('settings_updated_81'),__('A premium option was not saved. You must first enter your license key to unlock this premium feature.', 'motech-spacer'),'error');
1702
- }
1703
- }
1704
- } else {
1705
- if ((!empty($input))&&($input != "repeat")) {
1706
- add_settings_error('plk_error_id81',esc_attr('settings_updated_81'),__('A premium option was not saved. You must first enter your license key to unlock this premium feature.', 'motech-spacer'),'error');
1707
- }
1708
- }
1709
-
1710
- }
1711
-
1712
- function po_solid($input) {
1713
- if (get_option($this->plugin_slug . '_ihmsa','') == 'hmsia') {
1714
- return $input;
1715
- }
1716
-
1717
- if(is_array($input)){
1718
- foreach($input as $val){
1719
- if ($val != "solid") {
1720
- add_settings_error('plk_error_id81',esc_attr('settings_updated_81'),__('A premium option was not saved. You must first enter your license key to unlock this premium feature.', 'motech-spacer'),'error');
1721
- }
1722
- }
1723
- } else {
1724
- if ((!empty($input))&&($input != "solid")) {
1725
- add_settings_error('plk_error_id81',esc_attr('settings_updated_81'),__('A premium option was not saved. You must first enter your license key to unlock this premium feature.', 'motech-spacer'),'error');
1726
- }
1727
- }
1728
-
1729
- }
1730
-
1731
- function po_none($input) {
1732
- if (get_option($this->plugin_slug . '_ihmsa','') == 'hmsia') {
1733
- return $input;
1734
- }
1735
-
1736
- if(is_array($input)){
1737
- foreach($input as $val){
1738
- if ($val != "none") {
1739
- add_settings_error('plk_error_id81',esc_attr('settings_updated_81'),__('A premium option was not saved. You must first enter your license key to unlock this premium feature.', 'motech-spacer'),'error');
1740
- }
1741
- }
1742
- } else {
1743
- if ((!empty($input))&&($input != "none")) {
1744
- add_settings_error('plk_error_id81',esc_attr('settings_updated_81'),__('A premium option was not saved. You must first enter your license key to unlock this premium feature.', 'motech-spacer'),'error');
1745
- }
1746
- }
1747
-
1748
- }
1749
-
1750
- function po_20($input) {
1751
- if (get_option($this->plugin_slug . '_ihmsa','') == 'hmsia') {
1752
- return $input;
1753
- }
1754
- if ($input != "20") {
1755
- add_settings_error('plk_error_id83',esc_attr('settings_updated_83'),__('A premium option was not saved. You must first enter your license key to unlock this premium feature.', 'motech-spacer'),'error');
1756
- }
1757
- return "20";
1758
- }
1759
-
1760
- function get_premium_warning() {
1761
- if (get_option($this->plugin_slug . '_ihmsa','') == 'hmsia') {
1762
- return '';
1763
- } else {
1764
- return '<span class="motech_premium_only"> ('.__('Premium Only', 'motech-spacer').')</span>';
1765
- }
1766
- }
1767
-
1768
- function motech_spacer_prepjsbuttons(){
1769
- ?>
1770
- <script type="text/javascript">
1771
- <?php
1772
- $checkheight = get_option($this->plugin_slug . '_default_height','20');
1773
- $checkunit = get_option($this->plugin_slug . '_default_height_unit','px');
1774
- $return["useheight"] = $checkheight.$checkunit;
1775
- if($this->has_addspacers){
1776
- $ids = $this->key_array;
1777
- $checkaddheights = get_option($this->plugin_slug . '_default_height_addspacers');
1778
- $checkaddheightunits = get_option($this->plugin_slug . '_default_height_unit_addspacers');
1779
- $checktitles = get_option($this->plugin_slug . '_title_addspacers');
1780
- foreach($ids as $key=>$value){
1781
- $useheight = $checkaddheights[$key];
1782
- $useunit = $checkaddheightunits[$key];
1783
- $usetitle = $checktitles[$key];
1784
- if(empty($usetitle)){
1785
- $usetitle = "Untitled";
1786
- }
1787
- $return["addspacers"][] = array("id"=>$value,"height"=>$useheight.$useunit,"title"=>$usetitle);
1788
- }
1789
- }
1790
- ?>
1791
-
1792
- var motech_spacer_prepjsbuttons = <?php echo json_encode($return); ?>;
1793
- </script>
1794
- <?php
1795
- }
1796
-
1797
- function motech_imagepicker_admin_jquery() {
1798
- if (isset($_GET['page']) && $_GET['page'] == $this->plugin_slug.'-setting-admin') { //if we are on our admin page
1799
- ?>
1800
- <script>
1801
- jQuery(function() {
1802
-
1803
- jQuery("body").on("click",".sendhook .newbutton.readysend", function() {
1804
- buttonelement = jQuery(this);
1805
- jQuery(this).find(".readysendlabel").html("SENDING...");
1806
- jQuery(this).removeClass("readysend").addClass("notreadysend").css("cursor","not-allowed");
1807
- suggestion = jQuery("textarea[name=mysuggestion]").val();
1808
- signmeup = jQuery("input[name=signmeup]:checked").val();
1809
- myemail = jQuery("input[name=myemail]").val();
1810
-
1811
- //user doesn't want to sign up for mailing list, email not sent
1812
- if(typeof signmeup == 'undefined'){
1813
- myemail = "";
1814
- }
1815
-
1816
- jQuery.ajax({
1817
- type: "POST",
1818
- dataType: "json",
1819
- url: "http://www.justinsaad.com/suggestions/response.php",
1820
- data: { suggestion : suggestion, signmeup : signmeup, myemail : myemail },
1821
- success: function(data) { //data is the response from the php page
1822
- jQuery(".responsehook").text(data['response']).fadeIn('slow');
1823
- buttonelement.find(".readysendlabel").html("SENT!");
1824
- }
1825
- });
1826
-
1827
- });
1828
-
1829
- //jquery for color picker
1830
- jQuery('tr.motech-color-field').removeClass('motech-color-field');
1831
-
1832
- //jquery for image picker
1833
- jQuery(".motech_image_picker_wrap").click(function(){
1834
- jQuery(this).closest(".motech_image_picker").find(".motech_image_picker_wrap").removeClass("current");
1835
- jQuery(this).addClass("current");
1836
- selectedvalue = jQuery(this).find("img").attr("alt");
1837
- jQuery("#<?php echo $this->plugin_slug ?>_current_theme").val(selectedvalue);
1838
- });
1839
- jQuery("#<?php echo $this->plugin_slug ?>_current_theme").parent().parent().hide();
1840
- <?php if (get_option($this->plugin_slug . '_ihmsa','') == 'hmsia') : ?>
1841
- <?php
1842
- if(get_option('hide_my_site_premium_expansion_plk','') != '') {
1843
- $useval = get_option('hide_my_site_premium_expansion_plk','');
1844
- } elseif(get_option($this->plugin_slug . '_plk','') != '') {
1845
- $useval = get_option('hide_my_site_premium_expansion_plk','');
1846
- }
1847
- ?>
1848
- useval = '<?php echo $useval ?>';
1849
- jQuery("#hide_my_site_plk").replaceWith("<div>"+useval+"</div>");
1850
- <?php else : ?>
1851
- jQuery("#hide_my_site_plk").replaceWith("<div></div>");
1852
- <?php endif ?>
1853
-
1854
- jQuery("#hms_get_premium").click(function(){
1855
- //jQuery(".motech_premium_box").slideToggle(200);
1856
- });
1857
-
1858
- jQuery(".motech_premium_cancel span").click(function(){
1859
- jQuery(".motech_premium_box").slideUp(200, function() {
1860
- // Animation complete.
1861
- //jQuery("#green_ribbon").hide();
1862
- });
1863
-
1864
- });
1865
- jQuery(".how_to_redeem").click(function(){
1866
- jQuery(".redeem_info").slideToggle(200);
1867
- });
1868
-
1869
- jQuery("body").on('click', '#hms_get_premium, .hms_get_premium, .buynowbutton', function(e) {
1870
- e.preventDefault();
1871
- jQuery("html, body").animate({ scrollTop: 0 }, 300, function() {
1872
- // Animation complete.
1873
- jQuery("#green_ribbon").show();
1874
- jQuery(".motech_premium_box").slideDown(200);
1875
-
1876
- });
1877
-
1878
- //switch to different add on if set
1879
- var addonname = jQuery(this).attr('addonname');
1880
- console.log(addonname);
1881
- // For some browsers, `attr` is undefined; for others, `attr` is false. Check for both.
1882
- if (typeof addonname !== typeof undefined && addonname !== false) {
1883
- // Element has this attribute
1884
- if(addonname=="gotourl"){
1885
- var useurl = jQuery(this).attr('useurl');
1886
- window.open(useurl);
1887
- }else{
1888
- jQuery(".grwrap").hide();
1889
- jQuery(".grwrap."+addonname).show();
1890
- }
1891
- }
1892
-
1893
- });
1894
-
1895
-
1896
- });
1897
- </script>
1898
- <?php
1899
- }
1900
- }
1901
-
1902
-
1903
- } //end class
1904
-
1905
- function load_sva() {
1906
- if( !class_exists( 'spacer_layout_aid' ) ) {
1907
-
1908
- include 'sva/sva.php';
1909
-
1910
- }
1911
- }
1912
- add_action( 'plugins_loaded', 'load_sva' );
1913
-
1914
- $class = new motech_spacer();
1915
-
1916
- add_action('init', array($class, 'add_custom_button'));
1917
-
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ Plugin Name: Spacer
5
+ Plugin URI: http://www.clevelandwebdeveloper.com/wordpress-plugins/spacer
6
+ Description: Adds a spacer button to the WYSIWYG visual editor which allows you to add precise custom spacing between lines in your posts and pages.
7
+ Version: 3.0.5
8
+ Author: Justin Saad
9
+ Author URI: http://www.clevelandwebdeveloper.com
10
+ License: GPL2
11
+ */
12
+
13
+
14
+ //begin wysiwyg visual editor custom button plugin
15
+
16
+ $plugin_label = "Spacer";
17
+ $plugin_slug = "motech_spacer";
18
+
19
+ class motech_spacer {
20
+
21
+ public function __construct() {
22
+
23
+ global $plugin_label, $plugin_slug;
24
+ $this->plugin_slug = $plugin_slug;
25
+ $this->plugin_label = $plugin_label;
26
+ $this->plugin_dir = plugins_url( '' , __FILE__ );
27
+ $checkaddspacers = get_option($this->plugin_slug."_addspacer_id");
28
+ if(!empty($checkaddspacers)){
29
+ $this->key_array = $checkaddspacers;
30
+ $this->has_addspacers = true;
31
+ }else{
32
+ $this->key_array = array(0);
33
+ $this->has_addspacers = false;
34
+ }
35
+
36
+ //do when class is instantiated
37
+ add_shortcode('spacer', array($this, 'addShortcodeHandler'));
38
+ add_filter( 'tiny_mce_version', array($this, 'my_refresh_mce'));
39
+
40
+ //plugin row links
41
+ add_filter( 'plugin_row_meta', array($this,'plugin_row_links'), 10, 2 );
42
+
43
+ if(is_admin()){
44
+ add_action('admin_init', array($this, 'page_init'));
45
+ add_action('admin_menu', array($this, 'add_plugin_page'));
46
+ //custom image picker css for admin page
47
+ add_action('admin_head', array($this,'motech_imagepicker_admin_css'));
48
+ //custom image picker jquery for admin page
49
+ add_action('admin_footer', array($this,'motech_imagepicker_admin_jquery'));
50
+ //add Settings link to plugin page
51
+ add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array($this, 'add_plugin_action_links') );
52
+ //image upload script
53
+ add_action('admin_enqueue_scripts', array($this,'spacer_imageupload_script'));
54
+
55
+ add_action( 'admin_enqueue_scripts', array($this, 'enqueue_color_picker') ); //enqueue color picker
56
+
57
+ add_action( 'admin_enqueue_scripts', array($this, 'enqueue_motech_javascript'), 50 ); //enqueue color picker
58
+
59
+ add_action( 'wp_ajax_motech_spacer', array($this,'motech_spacer_callback') );
60
+
61
+ //admin messages
62
+ add_action('admin_notices', array($this,'admin_show_message'));
63
+ add_action('admin_init', array($this,'adminmessage_init'));
64
+
65
+ add_action( 'admin_enqueue_scripts', array($this,'load_custom_wp_admin_style'), 50 );
66
+ } else{
67
+ add_action( 'wp_enqueue_scripts', array($this,'load_custom_wp_admin_style') );
68
+ }
69
+
70
+ //prepare plugin for localization
71
+ load_plugin_textdomain('motech-spacer', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
72
+ }
73
+
74
+ function load_custom_wp_admin_style() {
75
+ if ( current_user_can('edit_posts') or current_user_can('edit_pages') ) {
76
+ wp_register_style( 'mspacer_wp_admin_css', plugins_url( 'admin-style.css' , __FILE__ ), false, '1.0.0' );
77
+ wp_enqueue_style( 'mspacer_wp_admin_css' );
78
+ }
79
+ if (isset($_GET['page']) && $_GET['page'] == $this->plugin_slug.'-setting-admin') { //if we are on our admin page
80
+ wp_register_style( 'mspacer_wp_adminpage_css', plugins_url( 'adminpage-style.css' , __FILE__ ), false, '1.0.0' );
81
+ wp_enqueue_style( 'mspacer_wp_adminpage_css' );
82
+ }
83
+ }
84
+
85
+ function motech_spacer_callback() {
86
+ $return = array();
87
+ $checkheight = get_option($this->plugin_slug . '_default_height','20');
88
+ $checkunit = get_option($this->plugin_slug . '_default_height_unit','px');
89
+ $return["useheight"] = $checkheight.$checkunit;
90
+ if($this->has_addspacers){
91
+ $ids = $this->key_array;
92
+ $checkaddheights = get_option($this->plugin_slug . '_default_height_addspacers');
93
+ $checkaddheightunits = get_option($this->plugin_slug . '_default_height_unit_addspacers');
94
+ $checktitles = get_option($this->plugin_slug . '_title_addspacers');
95
+ foreach($ids as $key=>$value){
96
+ $useheight = $checkaddheights[$key];
97
+ $useunit = $checkaddheightunits[$key];
98
+ $usetitle = $checktitles[$key];
99
+ if(empty($usetitle)){
100
+ $usetitle = "Untitled";
101
+ }
102
+ $return["addspacers"][] = array("id"=>$value,"height"=>$useheight.$useunit,"title"=>$usetitle);
103
+ }
104
+ }
105
+ echo json_encode($return);
106
+ wp_die(); // this is required to terminate immediately and return a proper response
107
+ }
108
+
109
+ function admin_show_message()
110
+ {
111
+ $user_id = get_current_user_id();
112
+ //there is no default spacer height set, and nag message not ignored...
113
+ //$checkdefault = get_option($this->plugin_slug . '_default_height_mobile','');
114
+ if ( ( ! get_user_meta($user_id, 'spacer2295_nag_ignore') ) && (current_user_can( 'manage_options' )) ) {
115
+ echo '<div id="message" class="updated fade notice"><p>';
116
+ echo "<b>".__("Take more time as you craft article updates. Designate 'draft' content with one-click! Try the new Spacer add-on, Draft It!", "motech-spacer")."</b>";
117
+ echo "</p>";
118
+ echo "<p><strong><a href=\"http://www.clevelandwebdeveloper.com/?p=1269&amp;utm_medium=plugin&amp;utm_source=plugin-notice-msg&amp;utm_campaign=Spacer+Notice+Msg&amp;utm_content=Draftit+Notice\" target=\"_blank\">".__('Start Drafting &raquo;', 'motech-spacer')."</a> | <a class=\"dismiss-notice\" style=\"color:red;\" href=\"".get_bloginfo( 'wpurl' ) . "/wp-admin/options-general.php?page=".$this->plugin_slug."-setting-admin&spacer2295_nag_ignore=0\" target=\"_parent\">".__('I got it. Thanks.', 'motech-spacer')." [X]</a></strong></p></div>";
119
+ }
120
+ }
121
+
122
+ function adminmessage_init()
123
+ {
124
+ if ( isset($_GET['spacer2295_nag_ignore']) && '0' == $_GET['spacer2295_nag_ignore'] ) {
125
+ $user_id = get_current_user_id();
126
+ add_user_meta($user_id, 'spacer2295_nag_ignore', 'true', true);
127
+ if (wp_get_referer()) {
128
+ /* Redirects user to where they were before */
129
+ wp_safe_redirect(wp_get_referer());
130
+ } else {
131
+ /* if there is no referrer you redirect to home */
132
+ wp_safe_redirect(home_url());
133
+ }
134
+ }
135
+ }
136
+
137
+ function enqueue_color_picker( $hook_suffix ) {
138
+ wp_enqueue_style( 'wp-color-picker' );
139
+ wp_enqueue_script( $this->plugin_slug.'-script-handle', plugins_url('js/motech-color-picker.js', __FILE__ ), array( 'wp-color-picker' ), false, true );
140
+ }
141
+
142
+ function enqueue_motech_javascript( ) {
143
+ if (isset($_GET['page']) && $_GET['page'] == $this->plugin_slug.'-setting-admin') {
144
+ wp_enqueue_script( $this->plugin_slug.'-motech-javascript', plugins_url('js/motech-javascript.js', __FILE__ ), array('jquery'), false, true );
145
+ }
146
+ }
147
+
148
+ function spacer_imageupload_script() {
149
+ if (isset($_GET['page']) && $_GET['page'] == $this->plugin_slug.'-setting-admin') {
150
+ if(function_exists('wp_enqueue_media')){
151
+ wp_enqueue_media();
152
+ }
153
+ wp_register_script('spacer_imageupload-js', plugins_url( 'js/spacer_imageupload.js' , __FILE__ ), array('jquery'));
154
+ wp_enqueue_script('spacer_imageupload-js');
155
+ }
156
+ }
157
+
158
+ function activespacer($id="") { #return attributes for active spacer based on id.
159
+ $return = array();
160
+ if($this->has_addspacers && $id!=""){
161
+ $ids = $this->key_array;
162
+ $key = array_search($id, $ids);
163
+ if($key){
164
+ #associated spacer id found so we return those values
165
+ $get = get_option($this->plugin_slug . '_spacer_style_addspacers');
166
+ $return["defaultstyle"] = $get[$key];
167
+ $get = get_option($this->plugin_slug . '_default_height_mobile_addspacers');
168
+ $return["mobile_height_default"] = $get[$key];
169
+ $return["mobile_height"] = $return["mobile_height_default"];
170
+ $get = get_option($this->plugin_slug . '_default_height_mobile_unit_addspacers');
171
+ $return["mobileunit"] = $get[$key];
172
+ $get = get_option($this->plugin_slug . '_default_height_addspacers');
173
+ $return["checkheight"] = $get[$key];
174
+ $get = get_option($this->plugin_slug . '_default_height_unit_addspacers');
175
+ $return["checkunit"] = $get[$key];
176
+ //$get = get_option($this->plugin_slug.'_custom_background_image_upload_addspacers');
177
+ //$return["bg"] = $get[$key];
178
+ //$get = get_option($this->plugin_slug . '_background_color_addspacers');
179
+ //$return["bgcolor"] = $get[$key];
180
+ $get = get_option($this->plugin_slug . '_spacer_class_addspacers');
181
+ $return["defaultclasses"] = $get[$key];
182
+ if(has_filter('spacer_add_to_extras')) {
183
+ $return = apply_filters('spacer_add_to_extras',$return,$key);
184
+ }
185
+ return $return;
186
+ }
187
+
188
+
189
+ }
190
+
191
+ #no associated spacer id found so we return default spacer values
192
+ $return["mobile_height_default"] = get_option($this->plugin_slug . '_default_height_mobile','');
193
+ $return["mobile_height"] = get_option($this->plugin_slug . '_default_height_mobile','');
194
+ $return["mobileunit"] = get_option($this->plugin_slug . '_default_height_mobile_unit','px');
195
+ $return["checkheight"] = get_option($this->plugin_slug . '_default_height','20');
196
+ $return["checkunit"] = get_option($this->plugin_slug . '_default_height_unit','px');
197
+ //$return["bg"] = get_option($this->plugin_slug.'_custom_background_image_upload');
198
+ //$return["bgcolor"] = get_option($this->plugin_slug.'_background_color');
199
+ $return["defaultclasses"] = get_option($this->plugin_slug.'_spacer_class','');
200
+ $return["defaultstyle"] = get_option($this->plugin_slug.'_spacer_style','');
201
+ if(has_filter('spacer_add_to_default')) {
202
+ $return = apply_filters('spacer_add_to_default', $return);
203
+ }
204
+
205
+ return $return;
206
+ }
207
+
208
+ // add the shortcode handler
209
+ function addShortcodeHandler($atts, $content = null) {
210
+ extract(shortcode_atts(array( "height" => '', "mheight" => '', "class" => '', "id" => '', "style" => '' ), $atts));
211
+ $activespacer = $this->activespacer($id);
212
+
213
+ //prep variables
214
+ $spacer_css = "";
215
+ $classes = "";
216
+
217
+ //prep mobile height, if it's empty we will use desktop height. if set to 0 we will hide the spacer on mobile devices.
218
+ $mobile_height = "";
219
+ $mobile_height_inline = "";
220
+ $mobile_height_default = $activespacer["mobile_height_default"];
221
+
222
+ //first check for inline height, then check default mobile height
223
+ if(isset($mheight) && $mheight != ""){
224
+ $mobile_height = $mheight;
225
+ $mobile_height_inline = $mheight;
226
+ }elseif(isset($mobile_height_default) && $mobile_height_default != ""){
227
+ $mobile_height = $activespacer["mobile_height"];
228
+ $mobile_height_default = $mobile_height;
229
+ }
230
+
231
+
232
+ //determine the height to use for the spacer. if it's a mobile device and there is a mobile height set, use that. otherwise use desktop height
233
+ if( function_exists('wp_is_mobile') && wp_is_mobile() && (isset($mobile_height) && $mobile_height != "")) {
234
+ $mobileunit = $activespacer["mobileunit"];
235
+
236
+
237
+ if(isset($mobile_height_inline) && $mobile_height_inline != "") {
238
+ if ($mobile_height_inline > 0 ) {
239
+ $spacer_css .= "padding-top: " . $mobile_height_inline . ";";
240
+ } elseif($mobile_height_inline < 0) {
241
+ $spacer_css .= "margin-top: " . $mobile_height_inline . ";";
242
+ } elseif($mobile_height_inline == 0){
243
+ $spacer_css .= "display:none;";
244
+ }
245
+ } elseif(isset($mobile_height_default) && $mobile_height_default != ""){
246
+ if($mobile_height_default > 0){
247
+ $spacer_css .= "padding-top: " . $mobile_height_default . $mobileunit.";";
248
+ }elseif($mobile_height_default < 0){
249
+ $spacer_css .= "margin-top: " . $mobile_height_default . $mobileunit. ";";
250
+ }elseif($mobile_height_default == 0){;
251
+ $spacer_css .= "display:none;";
252
+ }
253
+ }
254
+
255
+ } elseif($height=="default"){ //there is no mobile height set. use the desktop default height
256
+
257
+ //for now assume positive. in a sec add logic for if negative
258
+ $checkheight = $activespacer["checkheight"];
259
+ $checkunit = $activespacer["checkunit"];
260
+
261
+ if($checkheight > 0){
262
+ $spacer_css .= "padding-top: " . $checkheight . $checkunit.";";
263
+ }elseif($checkheight < 0){
264
+ $spacer_css .= "margin-top: " . $checkheight . $checkunit. ";";
265
+ }
266
+ } elseif ($height > 0 ) { #no default for desktop, use positive inline height
267
+ $spacer_css .= "padding-top: " . $height . ";";
268
+ } elseif($height < 0) { #no positive inline for desktop, use negative inline height
269
+ $spacer_css .= "margin-top: " . $height . ";";
270
+ }
271
+
272
+
273
+ //custom background image
274
+ /* $bg = $activespacer["bg"];
275
+ if(!empty($bg)) {
276
+ $spacer_css .= "background: url(".$bg.");";
277
+ }*/
278
+
279
+ //custom background image position
280
+ //$spacer_css .= $this->background_position();
281
+
282
+ //background color
283
+ /* $bgcolor = $activespacer["bgcolor"];
284
+ if(!empty($bgcolor)) {
285
+ $spacer_css .= "background-color:".$bgcolor.";";
286
+ }*/
287
+
288
+ //classes
289
+ $defaultclasses = $activespacer["defaultclasses"];
290
+ $classes .= $defaultclasses;
291
+ if(!empty($class)){
292
+ $classes .= " ".$class;
293
+ }
294
+
295
+ if(has_filter('spacer_add_css')) {
296
+ $spacer_css = apply_filters('spacer_add_css', $spacer_css, $activespacer);
297
+ }
298
+
299
+ //styles
300
+ $defaultstyle = $activespacer["defaultstyle"];
301
+ $spacer_css .= $defaultstyle;
302
+ if(!empty($style)){
303
+ $spacer_css .= " ".$style;
304
+ }
305
+
306
+ //create the spacer after all settings have been loaded
307
+ return '<span class="'.$classes.'" style="display:block;clear:both;height: 0px;'.$spacer_css.'"></span>';
308
+ }
309
+
310
+ function background_position(){
311
+ $bgposition = get_option($this->plugin_slug.'_custom_background_image_position','repeat');
312
+ if($bgposition=="repeat"){
313
+ return "background-repeat:repeat;";
314
+ } elseif($bgposition=="croptofit"){
315
+ return "background-size:cover;background-position:center;";
316
+ } elseif($bgposition=="stretch"){
317
+ return "background-size: 100% 100%;background-repeat: no-repeat;background-position: center;";
318
+ } elseif($bgposition=="propstretch"){
319
+ return "background-size: contain;background-repeat: no-repeat;background-position: center;";
320
+ }
321
+ }
322
+
323
+
324
+ function add_custom_button() {
325
+ if ( ! current_user_can('edit_posts') && ! current_user_can('edit_pages') )
326
+ return;
327
+ if ( get_user_option('rich_editing') == 'true') {
328
+ add_filter('mce_external_plugins', array($this, 'add_custom_tinymce_plugin'),99999999);
329
+ add_filter('mce_buttons', array($this, 'register_custom_button'),99999999);
330
+ global $wp_version;
331
+ //if($wp_version < 3.9){
332
+ add_action('admin_head', array($this,'motech_spacer_prepjsbuttons'));
333
+ add_action('wp_head', array($this,'motech_spacer_prepjsbuttons'));
334
+ //}
335
+ }
336
+
337
+ }
338
+
339
+ function register_custom_button($buttons) {
340
+ array_push($buttons, "|", get_class($this));
341
+ return $buttons;
342
+ }
343
+
344
+ function add_custom_tinymce_plugin($plugin_array) {
345
+ global $wp_version;
346
+ //use this in a plugin
347
+ if($wp_version >= 3.9){
348
+ $plugin_array[get_class($this)] = plugins_url( 'editor_plugin.js' , __FILE__ );
349
+ }else {
350
+ $plugin_array[get_class($this)] = plugins_url( 'editor_plugin_back.js' , __FILE__ );
351
+ }
352
+ //use this in a theme
353
+ //$plugin_array[get_class($this)] = get_bloginfo('template_url').'/editor_plugin.js';
354
+ return $plugin_array;
355
+ }
356
+
357
+ function my_refresh_mce($ver) {
358
+ $ver += 5;
359
+ return $ver;
360
+ }
361
+
362
+ function plugin_row_links($links, $file) {
363
+ $plugin = plugin_basename(__FILE__);
364
+ if ($file == $plugin) // only for this plugin
365
+ return array_merge( $links,
366
+ array( '<a target="_blank" href="http://www.clevelandwebdeveloper.com/wordpress-plugins/spacer/">' . __('Project homepage', 'motech-spacer' ) . '</a>' ),
367
+ array( '<a target="_blank" href="http://www.linkedin.com/in/ClevelandWebDeveloper/">' . __('Find me on LinkedIn', 'motech-spacer' ) . '</a>' ),
368
+ array( '<a target="_blank" href="http://twitter.com/ClevelandWebDev">' . __('Follow me on Twitter', 'motech-spacer') . '</a>' )
369
+ );
370
+ return $links;
371
+ }
372
+
373
+ public function create_admin_page(){
374
+ ?>
375
+ <div class="wrap" style="position:relative">
376
+ <h2 class="aplabel"><?php echo $this->plugin_label ?></h2>
377
+
378
+
379
+ <div id="green_ribbon">
380
+ <div class="grwrap visualartist" style="display:none;">
381
+ <div id="green_ribbon_top">
382
+ <div id="green_ribbon_left">
383
+ </div>
384
+ <div id="green_ribbon_base">
385
+ <span id="hms_get_premium" addonname="visualartist"><?php _e('NEW! Get Premium &raquo;', 'motech-spacer')?></span>
386
+ <span class="hms_get_premium_meta"><?php _e('Visual Artist Add-On now available for as low as $20!', 'motech-spacer')?></span>
387
+ </div>
388
+ <div id="green_ribbon_right">
389
+ </div>
390
+ </div>
391
+
392
+ <div class="motech_premium_box">
393
+
394
+
395
+ <div class="motech_premium_box_wrap">
396
+ <h2><?php _e('Get Visual Artist', 'motech-spacer')?></h2>
397
+ <div class="updated below-h2" style="margin-bottom: -20px !important;"><p><strong><?php _e('Purchase will be processed via PayPal.', 'motech-spacer')?></strong></p></div>
398
+ <div class="updated below-h2"><p><strong><?php _e('Every license is valid for the lifetime of the website where it\'s installed.', 'motech-spacer')?></strong></p></div>
399
+ <div class="motech_purchase_buttons">
400
+
401
+ <div class="motech_purchase_button unlimited_use">
402
+ <form action="https://www.paypal.com/cgi-bin/webscr" method="post"><input name="cmd" value="_s-xclick" type="hidden"><input name="hosted_button_id" value="FK8RLFRUBCL5N" type="hidden"><input type="hidden" name="page_style" value="visual_artist">
403
+ <button name="submit">
404
+ <div class="purchase_graphic"><?php _e('Buy', 'motech-spacer')?> <span><?php _e('Unlimited', 'motech-spacer')?></span></div>
405
+ <div class="purchase_bubble">
406
+ <div class="purchase_price">$50</div>
407
+ <div class="purchase_meta"><?php _e('Unlimited sites forever!', 'motech-spacer')?></div>
408
+ </div>
409
+ </button>
410
+ <img src="https://www.paypal.com/en_US/i/scr/pixel.gif" alt="" border="0" height="1" width="1">
411
+ </form>
412
+ </div>
413
+
414
+ <div class="motech_purchase_button one_use">
415
+ <form action="https://www.paypal.com/cgi-bin/webscr" method="post"><input name="cmd" value="_s-xclick" type="hidden"><input name="hosted_button_id" value="C59XHASJBCHLQ" type="hidden"><input type="hidden" name="page_style" value="visual_artist">
416
+ <button name="submit">
417
+ <div class="purchase_graphic"><?php _e('Buy 1 Use', 'motech-spacer')?></div>
418
+ <div class="purchase_bubble">
419
+ <div class="purchase_price">$20</div>
420
+ <div class="purchase_meta"><?php _e('1 site license', 'motech-spacer')?></div>
421
+ </div>
422
+ </button>
423
+ <img src="https://www.paypal.com/en_US/i/scr/pixel.gif" alt="" border="0" height="1" width="1">
424
+ </form>
425
+ </div>
426
+
427
+ </div>
428
+
429
+ <div class="motech_premium_cancel"><span><?php _e('Cancel', 'motech-spacer')?></span></div>
430
+
431
+ </div>
432
+
433
+ </div>
434
+ </div>
435
+
436
+
437
+ <div class="grwrap lineonsidesheaders" style="display:none;">
438
+
439
+ <div id="green_ribbon_top">
440
+ <div id="green_ribbon_left">
441
+ </div>
442
+ <div id="green_ribbon_base">
443
+ <span id="hms_get_premium" addonname="lineonsidesheaders"><?php _e('NEW! Get Premium &raquo;', 'motech-spacer')?></span>
444
+ <span class="hms_get_premium_meta"><?php _e('Header Add-On now available for as low as $10!', 'motech-spacer')?></span>
445
+ </div>
446
+ <div id="green_ribbon_right">
447
+ </div>
448
+ </div>
449
+
450
+ <div class="motech_premium_box">
451
+
452
+
453
+ <div class="motech_premium_box_wrap">
454
+ <h2><?php _e('Get Line-On-Sides Headers', 'motech-spacer')?></h2>
455
+ <div class="updated below-h2" style="margin-bottom: -20px !important;"><p><strong><?php _e('Purchase will be processed via PayPal.', 'motech-spacer')?></strong></p></div>
456
+ <div class="updated below-h2"><p><strong><?php _e('Every license is valid for the lifetime of the website where it\'s installed.', 'motech-spacer')?></strong></p></div>
457
+ <div class="motech_purchase_buttons">
458
+
459
+ <div class="motech_purchase_button unlimited_use">
460
+ <form action="https://www.paypal.com/cgi-bin/webscr" method="post"><input name="cmd" value="_s-xclick" type="hidden"><input name="hosted_button_id" value="D2R9YPYQHK63L" type="hidden">
461
+ <button name="submit">
462
+ <div class="purchase_graphic"><?php _e('Buy', 'motech-spacer')?> <span><?php _e('Unlimited', 'motech-spacer')?></span></div>
463
+ <div class="purchase_bubble">
464
+ <div class="purchase_price">$25</div>
465
+ <div class="purchase_meta"><?php _e('Unlimited sites forever!', 'motech-spacer')?></div>
466
+ </div>
467
+ </button>
468
+ <img src="https://www.paypal.com/en_US/i/scr/pixel.gif" alt="" border="0" height="1" width="1">
469
+ </form>
470
+ </div>
471
+
472
+ <div class="motech_purchase_button one_use">
473
+ <form action="https://www.paypal.com/cgi-bin/webscr" method="post"><input name="cmd" value="_s-xclick" type="hidden"><input name="hosted_button_id" value="F2CNV7FMSGAN8" type="hidden">
474
+ <button name="submit">
475
+ <div class="purchase_graphic"><?php _e('Buy 1 Use', 'motech-spacer')?></div>
476
+ <div class="purchase_bubble">
477
+ <div class="purchase_price">$10</div>
478
+ <div class="purchase_meta"><?php _e('1 site license', 'motech-spacer')?></div>
479
+ </div>
480
+ </button>
481
+ <img src="https://www.paypal.com/en_US/i/scr/pixel.gif" alt="" border="0" height="1" width="1">
482
+ </form>
483
+ </div>
484
+
485
+ </div>
486
+
487
+ <div class="motech_premium_cancel"><span><?php _e('Cancel', 'motech-spacer')?></span></div>
488
+
489
+ </div>
490
+
491
+ </div>
492
+ </div>
493
+
494
+
495
+ <div class="grwrap panels" style="display:none;">
496
+
497
+ <div id="green_ribbon_top">
498
+ <div id="green_ribbon_left">
499
+ </div>
500
+ <div id="green_ribbon_base">
501
+ <span id="hms_get_premium" addonname="panels"><?php _e('NEW! Get Premium &raquo;', 'motech-spacer')?></span>
502
+ <span class="hms_get_premium_meta"><?php _e('Panels Add-On now available for as low as $10!', 'motech-spacer')?></span>
503
+ </div>
504
+ <div id="green_ribbon_right">
505
+ </div>
506
+ </div>
507
+
508
+ <div class="motech_premium_box">
509
+
510
+
511
+ <div class="motech_premium_box_wrap">
512
+ <h2><?php _e('Get Panels', 'motech-spacer')?></h2>
513
+ <div class="updated below-h2" style="margin-bottom: -20px !important;"><p><strong><?php _e('Purchase will be processed via PayPal.', 'motech-spacer')?></strong></p></div>
514
+ <div class="updated below-h2"><p><strong><?php _e('Every license is valid for the lifetime of the website where it\'s installed.', 'motech-spacer')?></strong></p></div>
515
+ <div class="motech_purchase_buttons">
516
+
517
+ <div class="motech_purchase_button unlimited_use">
518
+ <form action="https://www.paypal.com/cgi-bin/webscr" method="post"><input name="cmd" value="_s-xclick" type="hidden"><input name="hosted_button_id" value="ZV77J555HXJTE" type="hidden">
519
+ <button name="submit">
520
+ <div class="purchase_graphic"><?php _e('Buy', 'motech-spacer')?> <span><?php _e('Unlimited', 'motech-spacer')?></span></div>
521
+ <div class="purchase_bubble">
522
+ <div class="purchase_price">$25</div>
523
+ <div class="purchase_meta"><?php _e('Unlimited sites forever!', 'motech-spacer')?></div>
524
+ </div>
525
+ </button>
526
+ <img src="https://www.paypal.com/en_US/i/scr/pixel.gif" alt="" border="0" height="1" width="1">
527
+ </form>
528
+ </div>
529
+
530
+ <div class="motech_purchase_button one_use">
531
+ <form action="https://www.paypal.com/cgi-bin/webscr" method="post"><input name="cmd" value="_s-xclick" type="hidden"><input name="hosted_button_id" value="GNBBYMDBN3UUE" type="hidden">
532
+ <button name="submit">
533
+ <div class="purchase_graphic"><?php _e('Buy 1 Use', 'motech-spacer')?></div>
534
+ <div class="purchase_bubble">
535
+ <div class="purchase_price">$10</div>
536
+ <div class="purchase_meta"><?php _e('1 site license', 'motech-spacer')?></div>
537
+ </div>
538
+ </button>
539
+ <img src="https://www.paypal.com/en_US/i/scr/pixel.gif" alt="" border="0" height="1" width="1">
540
+ </form>
541
+ </div>
542
+
543
+ </div>
544
+
545
+ <div class="motech_premium_cancel"><span><?php _e('Cancel', 'motech-spacer')?></span></div>
546
+
547
+ </div>
548
+
549
+ </div>
550
+ </div>
551
+
552
+
553
+ </div>
554
+
555
+ <div class="grwrap draftit">
556
+
557
+ <div id="green_ribbon_top">
558
+ <div id="green_ribbon_left">
559
+ </div>
560
+ <div id="green_ribbon_base">
561
+ <span id="hms_get_premium" addonname="gotourl" useurl="http://www.clevelandwebdeveloper.com/?p=1269&amp;utm_medium=plugin&amp;utm_source=plugin-notice-msg&amp;utm_campaign=Spacer+Notice+Msg&amp;utm_content=Draftit+Notice"><?php _e('NEW! Get Draft It! &raquo;', 'motech-spacer')?></span>
562
+ <span class="hms_get_premium_meta"><?php _e('Draft It! Add-On now available for as low as $19!', 'motech-spacer')?></span>
563
+ </div>
564
+ <div id="green_ribbon_right">
565
+ </div>
566
+ </div>
567
+
568
+ </div>
569
+
570
+
571
+ <h2 class="nav-tab-wrapper">
572
+ <a href="#defaultspacer" class="nav-tab nav-tab-active"><?php _e('Default', 'motech-spacer')?></a>
573
+ <a href="#addspacers" class="nav-tab"><span class="dashicons dashicons-plus dashicons-plus-alt"></span> <?php _e('Add Spacers', 'motech-spacer')?></a>
574
+ <?php do_action( 'spacer_sectiontabhook' ); #use this hook to add additional section tabs ?>
575
+ <a href="#suggestionbox" class="nav-tab"><span class="dashicons dashicons-email-alt"></span> <?php _e('Suggestion Box', 'motech-spacer')?></a>
576
+ <a href="#addons" class="nav-tab"><span class="dashicons dashicons-admin-plugins"></span> <?php _e('Add-Ons', 'motech-spacer')?></a>
577
+ <a href="#licenses" class="nav-tab"><span class="dashicons dashicons-admin-network"></span> <?php _e('Licenses', 'motech-spacer')?></a>
578
+ <?php /*?> <a href="#privacy-settings" class="nav-tab">Privacy settings</a>
579
+ <a href="#admin-custom" class="nav-tab">Admin Customizations</a>
580
+ <a href="#smtp" class="nav-tab">Smtp Settings</a><?php */?>
581
+ </h2>
582
+
583
+ <form method="post" action="options.php" class="<?php echo $this->plugin_slug ?>_form">
584
+ <?php
585
+ // This prints out all hidden setting fields
586
+ settings_fields($this->plugin_slug.'_option_group');
587
+ ?>
588
+ <div id="defaultspacer" class="metabox-holder mainsection aspacerunit">
589
+ <div class="motech-spacer-options section general wrap" style="border-bottom: solid 1px #BFBFBF;padding-bottom: 3px;">
590
+ <?php do_settings_sections($this->plugin_slug.'-setting-admin'); ?>
591
+ </div>
592
+ <div class="motech-spacer-options section mobileoptions" style="border-bottom: solid 1px #BFBFBF;padding-bottom: 3px;">
593
+ <?php do_settings_sections($this->plugin_slug.'-setting-admin_mobileoptions'); ?>
594
+ </div>
595
+ <div class="motech-spacer-options section styleoptions">
596
+ <?php do_settings_sections($this->plugin_slug.'-setting-admin_styleoptions'); ?>
597
+ </div>
598
+ <?php
599
+ if(has_filter('spacer_default_sections')) {
600
+ apply_filters('spacer_default_sections', '',$this);
601
+ }
602
+ ?>
603
+ <div class="spacer_preview_area_container">
604
+ <h2><?php _e('Preview', 'motech-spacer')?></h2>
605
+ <div class="spacer_preview_area">
606
+ <p><?php _e('Sample text before Spacer', 'motech-spacer')?></p>
607
+ <span class="spacer_preview" style="display:block;clear:both;height: 0px;padding-top: 20px;"></span>
608
+ <p><?php _e('Sample text after Spacer', 'motech-spacer')?></p>
609
+ </div>
610
+ </div>
611
+ <div class="hidden" style="display:none;"><?php do_settings_sections($this->plugin_slug.'-setting-admin_hdoptions'); ?></div>
612
+ </div>
613
+ <div id="addspacers" class="metabox-holder mainsection hidden wrap">
614
+ <h2 style="padding-bottom:20px;"><?php _e('Add New Spacers', 'motech-spacer')?></h2>
615
+ <div class="nothinghere hidden"><div style="font-weight: bold;font-size: 127px;line-height: normal;margin-bottom: 10px;">:-(</div><div style="font-size: 19px; line-height: normal;margin-bottom: 30px;"><?php _e('You don\'t have any additional Spacers yet', 'motech-spacer')?></div></div>
616
+ <?php
617
+ $key_array = $this->key_array;
618
+ $getoption = get_option($this->plugin_slug.'_title_addspacers','');
619
+ foreach($key_array as $key=>$value){
620
+ if(isset($getoption[$key])){
621
+ $gettitle = $getoption[$key];
622
+ }
623
+ if(empty($gettitle)){
624
+ $gettitle = "Untitled";
625
+ }
626
+ ?>
627
+ <div class="aspacerunit addspacerunit postbox closed">
628
+ <button type="button" class="handlediv button-link" aria-expanded="true"><span class="toggle-indicator" aria-hidden="true"></span></button>
629
+ <h2 class="hndle ui-sortable-handle"><span><?php echo $gettitle ?></span></h2>
630
+ <div class="inside">
631
+ <div class="motech-spacer-options section title" style="border-bottom: solid 1px #eee;padding-bottom: 3px;">
632
+ <?php do_settings_sections($this->plugin_slug.'-setting-admin_title_addspacers'.$key); ?>
633
+ </div>
634
+ <div class="motech-spacer-options section general" style="border-bottom: solid 1px #eee;padding-bottom: 3px;">
635
+ <?php do_settings_sections($this->plugin_slug.'-setting-admin_addspacers'.$key); ?>
636
+ </div>
637
+ <div class="motech-spacer-options section mobileoptions" style="border-bottom: solid 1px #eee;padding-bottom: 3px;">
638
+ <?php do_settings_sections($this->plugin_slug.'-setting-admin_mobileoptions_addspacers'.$key); ?>
639
+ </div>
640
+ <div class="motech-spacer-options section styleoptions">
641
+ <?php do_settings_sections($this->plugin_slug.'-setting-admin_styleoptions_addspacers'.$key); ?>
642
+ </div>
643
+ <?php
644
+ if(has_filter('spacer_addspacer_sections'.$key)) {
645
+ apply_filters('spacer_addspacer_sections'.$key, '',$key);
646
+ }
647
+ ?>
648
+ <div class="spacer_preview_area_container">
649
+ <h2><?php _e('Preview', 'motech-spacer')?></h2>
650
+ <div class="spacer_preview_area">
651
+ <p><?php _e('Sample text before Spacer', 'motech-spacer')?></p>
652
+ <span class="spacer_preview" style="display:block;clear:both;height: 0px;padding-top: 20px;"></span>
653
+ <p><?php _e('Sample text after Spacer', 'motech-spacer')?></p>
654
+ </div>
655
+ </div>
656
+ <div class="hiddenx" style="display:none;">
657
+ <?php do_settings_sections($this->plugin_slug.'-setting-admin_hd_addspacers'.$key); ?>
658
+ </div>
659
+ <div class="removebutton"><span class="dashicons dashicons-post-trash"></span> <?php _e('REMOVE', 'motech-spacer') ?></div>
660
+ </div>
661
+ </div>
662
+ <?php } ?>
663
+
664
+ <div class="newbutton"><span class="dashicons dashicons-plus dashicons-plus-alt"></span> <?php _e('NEW SPACER', 'motech-spacer') ?></div>
665
+
666
+
667
+ </div>
668
+ <?php do_action( 'spacer_sectionshook' ); #use this hook to add additional sections ?>
669
+ <div id="addons" class="metabox-holder mainsection hidden wrap">
670
+ <?php
671
+ $actionbutton = '<a href="#" title="'.__('Buy Visual Artist', 'motech-spacer').'" class="button-primary msbutton buynowbutton" addonname="visualartist">'.__('Buy Now', 'motech-spacer').'</a>';
672
+ if( is_plugin_active( 'spacer-visual-artist/index.php' ) ) {
673
+ $actionbutton = '<a href="javascript:void(0)" title="'.__('Active', 'motech-spacer').'" class="button-secondary msbutton">'.__('Active', 'motech-spacer').'</a>';
674
+ } elseif( file_exists(plugin_dir_path(__FILE__) . '../spacer-visual-artist/index.php') ) {
675
+ $actionbutton = '<a href="javascript:void(0)" title="'.__('Installed', 'motech-spacer').'" class="button-secondary msbutton">'.__('Installed', 'motech-spacer').'</a>';
676
+ }
677
+ ?>
678
+ <div class="msaddon mscol"><img src="<?php echo plugins_url( 'images/vart.png' , __FILE__ ) ?>"><h2><?php _e('Visual Artist', 'motech-spacer') ?></h2><div class="msaddon-content"><p><?php _e('Design fancy dividers, horizontal rules, and other ornate section breaks. Incorporate rich colors and images, all without mastering css.', 'motech-spacer') ?></p><div class="msaddon-buttons"><a href="http://www.clevelandwebdeveloper.com/?p=644&amp;utm_medium=plugin&amp;utm_source=plugin-addons-page&amp;utm_campaign=Spacers+Addons+Page&amp;utm_content=Spacer+Learn" target="_blank" class="button-secondary msdbutton"><?php _e('Learn More', 'motech-spacer') ?></a><?php echo $actionbutton ?></div></div></div>
679
+
680
+ <?php
681
+ $actionbutton = '<a href="#" title="'.__('Buy Line-On-Sides Headers', 'motech-spacer').'" class="button-primary msbutton buynowbutton" addonname="lineonsidesheaders">'.__('Buy Now', 'motech-spacer').'</a>';
682
+ if( is_plugin_active( 'spacer-lineonsides-headers/index.php' ) ) {
683
+ $actionbutton = '<a href="javascript:void(0)" title="'.__('Active', 'motech-spacer').'" class="button-secondary msbutton">'.__('Active', 'motech-spacer').'</a>';
684
+ } elseif( file_exists(plugin_dir_path(__FILE__) . '../spacer-lineonsides-headers/index.php') ) {
685
+ $actionbutton = '<a href="javascript:void(0)" title="'.__('Installed', 'motech-spacer').'" class="button-secondary msbutton">'.__('Installed', 'motech-spacer').'</a>';
686
+ }
687
+ ?>
688
+ <div class="msaddon mscol"><img src="<?php echo plugins_url( 'images/lhart.png' , __FILE__ ) ?>"><h2><?php _e('Line-On-Sides Headers', 'motech-spacer') ?></h2><div class="msaddon-content"><p><?php _e('Create headers that really stand out with lines on the sides.', 'motech-spacer') ?></p><div class="msaddon-buttons"><a href="http://www.clevelandwebdeveloper.com/?p=868&amp;utm_medium=plugin&amp;utm_source=plugin-addons-page&amp;utm_campaign=Spacers+Addons+Page&amp;utm_content=Lineonsides+Learn" target="_blank" class="button-secondary msdbutton"><?php _e('Learn More', 'motech-spacer') ?></a><?php echo $actionbutton ?></div></div></div>
689
+
690
+ <?php
691
+ $actionbutton = '<a href="#" title="'.__('Buy Panels', 'motech-spacer').'" class="button-primary msbutton buynowbutton" addonname="panels">'.__('Buy Now', 'motech-spacer').'</a>';
692
+ if( is_plugin_active( 'spacer-panels/index.php' ) ) {
693
+ $actionbutton = '<a href="javascript:void(0)" title="'.__('Active', 'motech-spacer').'" class="button-secondary msbutton">'.__('Active', 'motech-spacer').'</a>';
694
+ } elseif( file_exists(plugin_dir_path(__FILE__) . '../spacer-panels/index.php') ) {
695
+ $actionbutton = '<a href="javascript:void(0)" title="'.__('Installed', 'motech-spacer').'" class="button-secondary msbutton">'.__('Installed', 'motech-spacer').'</a>';
696
+ }
697
+ ?>
698
+ <div class="msaddon mscol"><img src="<?php echo plugins_url( 'images/part.png' , __FILE__ ) ?>"><h2><?php _e('Panels', 'motech-spacer') ?></h2><div class="msaddon-content"><p><?php _e('Style your own panels (think alerts, info boxes) and use them in your posts and pages whenever they are needed.', 'motech-spacer') ?></p><div class="msaddon-buttons"><a href="http://www.clevelandwebdeveloper.com/?p=931&amp;utm_medium=plugin&amp;utm_source=plugin-addons-page&amp;utm_campaign=Spacers+Addons+Page&amp;utm_content=Panels+Learn" target="_blank" class="button-secondary msdbutton"><?php _e('Learn More', 'motech-spacer') ?></a><?php echo $actionbutton ?></div></div></div>
699
+
700
+ <?php
701
+ $actionbutton = '<a href="http://www.clevelandwebdeveloper.com/?p=1269&amp;utm_medium=plugin&amp;utm_source=plugin-addons-page&amp;utm_campaign=Spacers+Addons+Page&amp;utm_content=Draftit+Learn" target="_blank" title="'.__('Buy Draft It!', 'motech-spacer').'" class="button-primary msbutton">'.__('Buy Now', 'motech-spacer').'</a>';
702
+ if( is_plugin_active( 'spacer-draftit/index.php' ) ) {
703
+ $actionbutton = '<a href="javascript:void(0)" title="'.__('Active', 'motech-spacer').'" class="button-secondary msbutton">'.__('Active', 'motech-spacer').'</a>';
704
+ } elseif( file_exists(plugin_dir_path(__FILE__) . '../spacer-draftit/index.php') ) {
705
+ $actionbutton = '<a href="javascript:void(0)" title="'.__('Installed', 'motech-spacer').'" class="button-secondary msbutton">'.__('Installed', 'motech-spacer').'</a>';
706
+ }
707
+ ?>
708
+ <div class="msaddon mscol"><img src="<?php echo plugins_url( 'images/diart.png' , __FILE__ ) ?>"><h2><?php _e('Draft It!', 'motech-spacer') ?></h2><div class="msaddon-content"><p><?php _e("Take more time as you craft article updates. Designate 'draft' content with one-click!", "motech-spacer") ?></p><div class="msaddon-buttons"><a href="http://www.clevelandwebdeveloper.com/?p=1269&amp;utm_medium=plugin&amp;utm_source=plugin-addons-page&amp;utm_campaign=Spacers+Addons+Page&amp;utm_content=Draftit+Learn" target="_blank" class="button-secondary msdbutton"><?php _e('Learn More', 'motech-spacer') ?></a><?php echo $actionbutton ?></div></div></div>
709
+
710
+ </div>
711
+ <div id="licenses" class="metabox-holder mainsection hidden wrap">
712
+ <div class="motech-spacer-options section general wrap">
713
+ <?php do_settings_sections($this->plugin_slug.'-setting-admin_licenses'); ?>
714
+ </div>
715
+ </div>
716
+ <div id="suggestionbox" class="metabox-holder mainsection hidden wrap">
717
+ <div class="motech-spacer-options section general wrap">
718
+ <h1>Have a good suggestion for a Spacer add-on or a feature request? Let's hear it...</h1>
719
+ <?php
720
+ global $current_user;
721
+ wp_get_current_user();
722
+ ?>
723
+ <textarea style="width:100%;min-height:250px;" name="mysuggestion" placeholder="Suggestions go here"></textarea>
724
+ <div style="font-size:20px;line-height:normal;margin: 25px 0px;margin-bottom: 35px;"><input type="checkbox" name="signmeup" value="yes" checked="checked">Yes, I want to subscribe to the Spacer newsletter and be the first to know of important Spacer news and upcoming releases. I want to stay notified about exclusive discounts and insider deals on premium features. My email address is: <input type="text" name="myemail" value="<?php echo $current_user->user_email ?>" /> <div style="font-size:14px;">(The Spacer newsletter is personally written and sent out about once a month (at most). It's not remotely annoying or spammy. We promise.)</div></div>
725
+ <div class="sendhook">
726
+ <div class="newbutton readysend"><span class="dashicons dashicons-email-alt"></span> <span class="readysendlabel"><?php _e('SEND', 'motech-spacer') ?></span></div>
727
+ <div class="responsehook" style="margin-top: -20px;padding: 15px;margin-left: 10px;margin-right: 10px;background: rgb(252, 248, 227); color: rgb(138, 109, 59);border: 1px solid rgb(252, 220, 126);border-radius: 3px;display:none;"></div>
728
+ </div>
729
+ </div>
730
+ </div>
731
+ <div class="wrap"><div class="savebutton"><button type="submit"><span class="dashicons dashicons-yes"></span> <?php _e('SAVE CHANGES!', 'motech-spacer') ?></button></div></div>
732
+ </form>
733
+ </div>
734
+ <?php
735
+ }
736
+
737
+ public function DisplayAddSpacers(){
738
+ $key_array = $this->key_array;
739
+ foreach($key_array as $key=>$value){
740
+ add_settings_section(
741
+ $this->plugin_slug.'_setting_section',
742
+ __('', 'motech-spacer'),
743
+ false,
744
+ $this->plugin_slug.'-setting-admin_title_addspacers'.$key
745
+ );
746
+
747
+ add_settings_section(
748
+ $this->plugin_slug.'_setting_section',
749
+ __('', 'motech-spacer'),
750
+ false,
751
+ $this->plugin_slug.'-setting-admin_hd_addspacers'.$key
752
+ );
753
+
754
+ //add text input field
755
+ $field_slug = "title_addspacers";
756
+ $field_label = __('Spacer Title', 'motech-spacer');
757
+ $field_id = $this->plugin_slug.'_'.$field_slug;
758
+ register_setting($this->plugin_slug.'_option_group', $field_id);
759
+ add_settings_field(
760
+ $field_id,
761
+ $field_label,
762
+ array($this, 'create_a_text_input_array'), //callback function for text input
763
+ $this->plugin_slug.'-setting-admin_title_addspacers'.$key,
764
+ $this->plugin_slug.'_setting_section',
765
+ array( // The array of arguments to pass to the callback.
766
+ "id" => $field_id, //sends field id to callback
767
+ "key" => $key,
768
+ "class" => "addingspacer",
769
+ "desc" => __('Give this Spacer a title.', 'motech-spacer'), //description of the field (optional)
770
+ "placeholder" => __('eg: Medium Spacer', 'motech-spacer')
771
+ //"default" => '20' //sets the default field value (optional), when grabbing this option value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
772
+ )
773
+ );
774
+
775
+ //add text input field
776
+ $field_slug = "addspacer_id";
777
+ $field_label = "Spacer ID";
778
+ $field_id = $this->plugin_slug.'_'.$field_slug;
779
+ register_setting($this->plugin_slug.'_option_group', $field_id);
780
+ $desc = "";
781
+ add_settings_field(
782
+ $field_id,
783
+ $field_label,
784
+ array($this, 'create_a_text_input_array'), //callback function for text input
785
+ $this->plugin_slug.'-setting-admin_hd_addspacers'.$key,
786
+ $this->plugin_slug.'_setting_section',
787
+ array( // The array of arguments to pass to the callback.
788
+ "id" => $field_id, //sends field id to callback
789
+ "key" => $key,
790
+ "class" => "hmshidden addspacer_id",
791
+ "desc" => $desc, //description of the field (optional)
792
+ )
793
+ );
794
+
795
+ add_settings_section(
796
+ $this->plugin_slug.'_setting_section',
797
+ __('', 'motech-spacer'),
798
+ false,
799
+ $this->plugin_slug.'-setting-admin_addspacers'.$key
800
+ );
801
+
802
+ //add text input field
803
+ $field_slug = "default_height_addspacers";
804
+ $field_label = __('Default Height', 'motech-spacer');
805
+ $field_id = $this->plugin_slug.'_'.$field_slug;
806
+ register_setting($this->plugin_slug.'_option_group', $field_id);
807
+ add_settings_field(
808
+ $field_id,
809
+ $field_label,
810
+ array($this, 'create_a_text_input_array'), //callback function for text input
811
+ $this->plugin_slug.'-setting-admin_addspacers'.$key,
812
+ $this->plugin_slug.'_setting_section',
813
+ array( // The array of arguments to pass to the callback.
814
+ "id" => $field_id, //sends field id to callback
815
+ "key" => $key,
816
+ "class" => 'sheight',
817
+ "desc" => __('Set a default height. Note that you can also enter negative spacing to shift the following content upwards.', 'motech-spacer'), //description of the field (optional)
818
+ "placeholder" => __('eg: 20', 'motech-spacer'),
819
+ "default" => '20' //sets the default field value (optional), when grabbing this option value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
820
+ )
821
+ );
822
+
823
+ //add a select input field
824
+ $field_slug = "default_height_unit_addspacers";
825
+ $field_label = __('Height Unit', 'motech-spacer');
826
+ $field_id = $this->plugin_slug.'_'.$field_slug;
827
+ $this->unit_options = array(
828
+ array("label" => "px", "value" => "px"),
829
+ array("label" => "em", "value" => "em"),
830
+ array("label" => "rem", "value" => "rem"),
831
+ array("label" => "%", "value" => "%"),
832
+ );
833
+ register_setting($this->plugin_slug.'_option_group', $field_id);
834
+ add_settings_field(
835
+ $field_id,
836
+ $field_label,
837
+ array($this, 'create_a_select_input_array'), //callback function for select input
838
+ $this->plugin_slug.'-setting-admin_addspacers'.$key,
839
+ $this->plugin_slug.'_setting_section',
840
+ array( // The array of arguments to pass to the callback.
841
+ "id" => $field_id, //sends select field id to callback
842
+ "default" => 'px', //sets the default field value (optional), when grabbing this field value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
843
+ "desc" => __('Select a unit of measurement to use with your default spacer height.', 'motech-spacer'), //description of the field (optional)
844
+ "key" => $key,
845
+ "class" => "msunit",
846
+ "meta" => 'style="max-width:450px;"',
847
+ "select_options" => $this->unit_options //sets select option data
848
+ )
849
+ );
850
+
851
+ add_settings_section(
852
+ $this->plugin_slug.'_setting_section',
853
+ __('', 'motech-spacer'),
854
+ false,
855
+ $this->plugin_slug.'-setting-admin_mobileoptions_addspacers'.$key
856
+ );
857
+
858
+ //add text input field
859
+ $field_slug = "default_height_mobile_addspacers";
860
+ $field_label = __('Default Height On Mobile (Optional)', 'motech-spacer');
861
+ $field_id = $this->plugin_slug.'_'.$field_slug;
862
+ register_setting($this->plugin_slug.'_option_group', $field_id);
863
+ add_settings_field(
864
+ $field_id,
865
+ $field_label,
866
+ array($this, 'create_a_text_input_array'), //callback function for text input
867
+ $this->plugin_slug.'-setting-admin_mobileoptions_addspacers'.$key,
868
+ $this->plugin_slug.'_setting_section',
869
+ array( // The array of arguments to pass to the callback.
870
+ "id" => $field_id, //sends field id to callback
871
+ "desc" => __('Set the default height on mobile devices. If left empty, the mobile height will be the same as the desktop height. If set to 0, the spacer will be hidden on mobile.', 'motech-spacer'), //description of the field (optional)
872
+ "key" => $key,
873
+ "placeholder" => __('eg: 10', 'motech-spacer'),
874
+ "default" => '' //sets the default field value (optional), when grabbing this option value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
875
+ )
876
+ );
877
+
878
+ //add a select input field
879
+ $field_slug = "default_height_mobile_unit_addspacers";
880
+ $field_label = __('Height Unit On Mobile', 'motech-spacer');
881
+ $field_id = $this->plugin_slug.'_'.$field_slug;
882
+ $this->unit_options = array(
883
+ array("label" => "px", "value" => "px"),
884
+ array("label" => "em", "value" => "em"),
885
+ array("label" => "rem", "value" => "rem"),
886
+ array("label" => "%", "value" => "%"),
887
+ );
888
+ register_setting($this->plugin_slug.'_option_group', $field_id);
889
+ add_settings_field(
890
+ $field_id,
891
+ $field_label,
892
+ array($this, 'create_a_select_input_array'), //callback function for select input
893
+ $this->plugin_slug.'-setting-admin_mobileoptions_addspacers'.$key,
894
+ $this->plugin_slug.'_setting_section',
895
+ array( // The array of arguments to pass to the callback.
896
+ "id" => $field_id, //sends select field id to callback
897
+ "default" => 'px', //sets the default field value (optional), when grabbing this field value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
898
+ "desc" => __('Select a unit of measurement to use with your default spacer height on mobile devices. This only applies if you have a default spacer height set for mobile.', 'motech-spacer'), //description of the field (optional)
899
+ "key" => $key,
900
+ "class"=> "msunitmobile",
901
+ "meta" => 'style="max-width:450px;"',
902
+ "select_options" => $this->unit_options //sets select option data
903
+ )
904
+ );
905
+
906
+ add_settings_section(
907
+ $this->plugin_slug.'_setting_section',
908
+ __('', 'motech-spacer'),
909
+ false,
910
+ $this->plugin_slug.'-setting-admin_styleoptions_addspacers'.$key
911
+ );
912
+
913
+ //add text input field
914
+ $field_slug = "spacer_class_addspacers";
915
+ $field_label = __('Default Class (Optional)', 'motech-spacer');
916
+ $field_id = $this->plugin_slug.'_'.$field_slug;
917
+ register_setting($this->plugin_slug.'_option_group', $field_id);
918
+ add_settings_field(
919
+ $field_id,
920
+ $field_label,
921
+ array($this, 'create_a_text_input_array'), //callback function for text input
922
+ $this->plugin_slug.'-setting-admin_styleoptions_addspacers'.$key,
923
+ $this->plugin_slug.'_setting_section',
924
+ array( // The array of arguments to pass to the callback.
925
+ "id" => $field_id, //sends field id to callback
926
+ "desc" => __('Enter a custom css class to apply to all of your spacer elements. Multiple classes can be added by putting a blank space between each class name', 'motech-spacer'), //description of the field (optional)
927
+ "key" => $key,
928
+ "placeholder" => __('eg: MyClass1 Class2', 'motech-spacer')
929
+ )
930
+ );
931
+
932
+ //add textarea input field
933
+ $field_slug = "spacer_style_addspacers";
934
+ $field_label = __('Style (Optional)', 'motech-spacer');
935
+ $field_id = $this->plugin_slug.'_'.$field_slug;
936
+ register_setting($this->plugin_slug.'_option_group', $field_id);
937
+ add_settings_field(
938
+ $field_id,
939
+ $field_label,
940
+ array($this, 'create_a_textarea_input_array'), //callback function for textarea input
941
+ $this->plugin_slug.'-setting-admin_styleoptions_addspacers'.$key,
942
+ $this->plugin_slug.'_setting_section',
943
+ array( // The array of arguments to pass to the callback.
944
+ "id" => $field_id, //sends field id to callback
945
+ "desc" => __('Enter custom css to apply to all of your spacer elements. This is for advanced users. Just leave this empty if you\'re not sure what this means or if you don\'t have a use for it.<br><span style="color:red">NEW:</span> Want to create visually stunning divider elements, without needing to know any CSS? See <a href="http://www.clevelandwebdeveloper.com/wordpress-plugins/visual-artist/?utm_medium=plugin&amp;utm_source=plugin-settings-page&amp;utm_campaign=Spacers+Settings+Page&amp;utm_content=Spacer+Inline" target="_blank">examples of what you can do with the Visual Artist add-on &raquo;</a><br>Ready to make your own? <a href="#" class="buynowbutton" addonname="visualartist">Buy It Now &raquo;</a>', 'motech-spacer'), //description of the field (optional)
946
+ "key" => $key,
947
+ "class" => 'msstyle',
948
+ "placeholder" => __('(for example)', 'motech-spacer').' border-top: solid 2px black; border-bottom: solid 2px black; margin-bottom: 25px;' //sets the field placeholder which appears when the field is empty (optional)
949
+ )
950
+ );
951
+
952
+ //add text input field
953
+ $field_slug = "addspacer_index";
954
+ $field_label = "Add Spacer index";
955
+ $field_id = $this->plugin_slug.'_'.$field_slug;
956
+ register_setting($this->plugin_slug.'_option_group', $field_id);
957
+ $desc = "";
958
+ add_settings_field(
959
+ $field_id,
960
+ $field_label,
961
+ array($this, 'create_a_text_input'), //callback function for text input
962
+ $this->plugin_slug.'-setting-admin_hdoptions',
963
+ $this->plugin_slug.'_setting_section',
964
+ array( // The array of arguments to pass to the callback.
965
+ "id" => $field_id, //sends field id to callback
966
+ "class" => "hmshidden",
967
+ "default" => "1",
968
+ "desc" => $desc, //description of the field (optional)
969
+ )
970
+ );
971
+
972
+ }
973
+
974
+ }
975
+
976
+ public function DisplayMobileOptions(){
977
+ add_settings_section(
978
+ $this->plugin_slug.'_setting_section',
979
+ __('', 'motech-spacer'),
980
+ false,
981
+ $this->plugin_slug.'-setting-admin_mobileoptions'
982
+ );
983
+
984
+ //add text input field
985
+ $field_slug = "default_height_mobile";
986
+ $field_label = __('Default Spacer Height On Mobile (Optional)', 'motech-spacer');
987
+ $field_id = $this->plugin_slug.'_'.$field_slug;
988
+ register_setting($this->plugin_slug.'_option_group', $field_id);
989
+ add_settings_field(
990
+ $field_id,
991
+ $field_label,
992
+ array($this, 'create_a_text_input'), //callback function for text input
993
+ $this->plugin_slug.'-setting-admin_mobileoptions',
994
+ $this->plugin_slug.'_setting_section',
995
+ array( // The array of arguments to pass to the callback.
996
+ "id" => $field_id, //sends field id to callback
997
+ "desc" => __('Set the default spacer height on mobile devices. If left empty, the spacer mobile height will be the same as the spacer desktop height. If set to 0, the spacer will be hidden on mobile.', 'motech-spacer'), //description of the field (optional)
998
+ "placeholder" => __('eg: 10', 'motech-spacer'),
999
+ "default" => '' //sets the default field value (optional), when grabbing this option value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
1000
+ )
1001
+ );
1002
+
1003
+ //add a select input field
1004
+ $field_slug = "default_height_mobile_unit";
1005
+ $field_label = __('Spacer Height Unit On Mobile', 'motech-spacer');
1006
+ $field_id = $this->plugin_slug.'_'.$field_slug;
1007
+ $this->unit_options = array(
1008
+ array("label" => "px", "value" => "px"),
1009
+ array("label" => "em", "value" => "em"),
1010
+ array("label" => "rem", "value" => "rem"),
1011
+ array("label" => "%", "value" => "%"),
1012
+ );
1013
+ register_setting($this->plugin_slug.'_option_group', $field_id);
1014
+ add_settings_field(
1015
+ $field_id,
1016
+ $field_label,
1017
+ array($this, 'create_a_select_input'), //callback function for select input
1018
+ $this->plugin_slug.'-setting-admin_mobileoptions',
1019
+ $this->plugin_slug.'_setting_section',
1020
+ array( // The array of arguments to pass to the callback.
1021
+ "id" => $field_id, //sends select field id to callback
1022
+ "default" => 'px', //sets the default field value (optional), when grabbing this field value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
1023
+ "desc" => __('Select a unit of measurement to use with your default spacer height on mobile devices. This only applies if you have a default spacer height set for mobile.', 'motech-spacer'), //description of the field (optional)
1024
+ "meta" => 'style="max-width:450px;"',
1025
+ "select_options" => $this->unit_options //sets select option data
1026
+ )
1027
+ );
1028
+ }
1029
+
1030
+ public function DisplayStyleOptions(){
1031
+ add_settings_section(
1032
+ $this->plugin_slug.'_setting_section',
1033
+ __('', 'motech-spacer'),
1034
+ false,
1035
+ $this->plugin_slug.'-setting-admin_styleoptions'
1036
+ );
1037
+
1038
+ //add text input field
1039
+ $field_slug = "spacer_class";
1040
+ $field_label = __('Default Spacer Class (Optional)', 'motech-spacer');
1041
+ $field_id = $this->plugin_slug.'_'.$field_slug;
1042
+ register_setting($this->plugin_slug.'_option_group', $field_id);
1043
+ add_settings_field(
1044
+ $field_id,
1045
+ $field_label,
1046
+ array($this, 'create_a_text_input'), //callback function for text input
1047
+ $this->plugin_slug.'-setting-admin_styleoptions',
1048
+ $this->plugin_slug.'_setting_section',
1049
+ array( // The array of arguments to pass to the callback.
1050
+ "id" => $field_id, //sends field id to callback
1051
+ "desc" => __('Enter a custom css class to apply to all of your spacer elements. Multiple classes can be added by putting a blank space between each class name', 'motech-spacer'), //description of the field (optional)
1052
+ "placeholder" => __('eg: MyClass1 Class2', 'motech-spacer')
1053
+ )
1054
+ );
1055
+
1056
+ //add textarea input field
1057
+ $field_slug = "spacer_style";
1058
+ $field_label = __('Spacer Style (Optional)', 'motech-spacer');
1059
+ $field_id = $this->plugin_slug.'_'.$field_slug;
1060
+ register_setting($this->plugin_slug.'_option_group', $field_id);
1061
+ add_settings_field(
1062
+ $field_id,
1063
+ $field_label,
1064
+ array($this, 'create_a_textarea_input'), //callback function for textarea input
1065
+ $this->plugin_slug.'-setting-admin_styleoptions',
1066
+ $this->plugin_slug.'_setting_section',
1067
+ array( // The array of arguments to pass to the callback.
1068
+ "id" => $field_id, //sends field id to callback
1069
+ "desc" => __('Enter custom css to apply to all of your spacer elements. This is for advanced users. Just leave this empty if you\'re not sure what this means or if you don\'t have a use for it.<br><span style="color:red">NEW:</span> Want to create visually stunning divider elements, without needing to know any CSS? See <a href="http://www.clevelandwebdeveloper.com/wordpress-plugins/visual-artist/?utm_medium=plugin&amp;utm_source=plugin-settings-page&amp;utm_campaign=Spacers+Settings+Page&amp;utm_content=Spacer+Inline" target="_blank">examples of what you can do with the Visual Artist add-on &raquo;</a><br>Ready to make your own? <a href="#" class="buynowbutton" addonname="visualartist">Buy It Now &raquo;</a>', 'motech-spacer'), //description of the field (optional)
1070
+ "placeholder" => __('(for example)', 'motech-spacer').' border-top: solid 2px black; border-bottom: solid 2px black; margin-bottom: 25px;' //sets the field placeholder which appears when the field is empty (optional)
1071
+ )
1072
+ );
1073
+
1074
+ if(has_filter('spacer_default_settings')) {
1075
+ apply_filters('spacer_default_settings','',$this);
1076
+ }
1077
+
1078
+ add_settings_section(
1079
+ $this->plugin_slug.'_setting_section',
1080
+ __('', 'motech-spacer'),
1081
+ false,
1082
+ $this->plugin_slug.'-setting-admin_hdoptions'
1083
+ );
1084
+ }
1085
+
1086
+ public function page_init(){
1087
+
1088
+ //register other settings sections
1089
+ $this->DisplayMobileOptions();
1090
+ $this->DisplayStyleOptions();
1091
+ $this->DisplayAddSpacers();
1092
+ do_action( 'spacer_sectionfieldhook', $this ); #use this hook to add additional field sections
1093
+
1094
+
1095
+ add_settings_section(
1096
+ $this->plugin_slug.'_setting_section',
1097
+ __('Configure Default Spacer', 'motech-spacer'),
1098
+ array($this, 'print_section_info'),
1099
+ $this->plugin_slug.'-setting-admin'
1100
+ );
1101
+
1102
+ add_settings_section(
1103
+ $this->plugin_slug.'_setting_section',
1104
+ __('Licenses', 'motech-spacer'),
1105
+ array($this, 'print_section_info_licenses'),
1106
+ $this->plugin_slug.'-setting-admin_licenses'
1107
+ );
1108
+
1109
+ if(has_filter('spacer_licenses_settings')) {
1110
+ apply_filters('spacer_licenses_settings','',$this);
1111
+ }
1112
+
1113
+ //add text input field
1114
+ $field_slug = "default_height";
1115
+ $field_label = __('Default Spacer Height', 'motech-spacer');
1116
+ $field_id = $this->plugin_slug.'_'.$field_slug;
1117
+ register_setting($this->plugin_slug.'_option_group', $field_id);
1118
+ add_settings_field(
1119
+ $field_id,
1120
+ $field_label,
1121
+ array($this, 'create_a_text_input'), //callback function for text input
1122
+ $this->plugin_slug.'-setting-admin',
1123
+ $this->plugin_slug.'_setting_section',
1124
+ array( // The array of arguments to pass to the callback.
1125
+ "id" => $field_id, //sends field id to callback
1126
+ "desc" => __('Speed up your workflow by setting a default height to apply to your spacers. Note that you can also enter negative spacing to shift the following content upwards.', 'motech-spacer'), //description of the field (optional)
1127
+ "placeholder" => __('eg: 20', 'motech-spacer'),
1128
+ "default" => '20' //sets the default field value (optional), when grabbing this option value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
1129
+ )
1130
+ );
1131
+
1132
+ //add a select input field
1133
+ $field_slug = "default_height_unit";
1134
+ $field_label = __('Spacer Height Unit', 'motech-spacer');
1135
+ $field_id = $this->plugin_slug.'_'.$field_slug;
1136
+ $this->unit_options = array(
1137
+ array("label" => "px", "value" => "px"),
1138
+ array("label" => "em", "value" => "em"),
1139
+ array("label" => "rem", "value" => "rem"),
1140
+ array("label" => "%", "value" => "%"),
1141
+ );
1142
+ register_setting($this->plugin_slug.'_option_group', $field_id);
1143
+ add_settings_field(
1144
+ $field_id,
1145
+ $field_label,
1146
+ array($this, 'create_a_select_input'), //callback function for select input
1147
+ $this->plugin_slug.'-setting-admin',
1148
+ $this->plugin_slug.'_setting_section',
1149
+ array( // The array of arguments to pass to the callback.
1150
+ "id" => $field_id, //sends select field id to callback
1151
+ "default" => 'px', //sets the default field value (optional), when grabbing this field value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
1152
+ "desc" => __('Select a unit of measurement to use with your default spacer height.', 'motech-spacer'), //description of the field (optional)
1153
+ "meta" => 'style="max-width:450px;"',
1154
+ "select_options" => $this->unit_options //sets select option data
1155
+ )
1156
+ );
1157
+
1158
+
1159
+ //add radio option
1160
+ //$option_id = "status";
1161
+ //add_settings_field($option_id, 'Status', array($this, 'create_radio_field'), 'wordpresshidesite-setting-admin', 'setting_section_id', array("option_id" => $option_id));
1162
+
1163
+ } //end page_init
1164
+
1165
+
1166
+ /**
1167
+ * This following set of functions handle all input field creation
1168
+ *
1169
+ */
1170
+ function create_image_upload($args) {
1171
+ ?>
1172
+ <?php
1173
+ //set default value if applicable
1174
+ if(isset($args["default"])) {
1175
+ $default = $args["default"];
1176
+ } else {
1177
+ $default = false;
1178
+ }
1179
+ if(isset($args["meta"])) {
1180
+ $meta = $args["meta"];
1181
+ } else {
1182
+ $meta = "";
1183
+ }
1184
+ ?>
1185
+ <input class="motech_upload_image" type="text" name="<?php echo $args["id"] ?>" value="<?php echo get_option($args["id"], $default) ?>" <?php echo $meta ?> />
1186
+ <input class="motech_upload_image_button" class="button" type="button" value="<?php _e('Upload Image', 'motech-spacer')?>" />
1187
+ <br />
1188
+ <?php
1189
+ if(isset($args["desc"])) {
1190
+ echo "<span class='description'>".$args["desc"]."</span>";
1191
+ } else {
1192
+ echo "<span class='description'>".__('Enter a URL or upload an image.', 'motech-spacer')."</span>";
1193
+ }
1194
+ ?>
1195
+ <?php /*?> <?php
1196
+ $current_image = get_option($args["id"],$default);
1197
+ if(!empty($current_image)) {
1198
+ echo "<span class='motech_spacer_preview_image_container'><br><strong>".__('Image Preview', 'motech-spacer')."</strong><br><span class='motech_spacer_preview_image' style='background-size: contain;background-position: 0% 0%;background-repeat: no-repeat;margin-left:20px;display:block; width:75px; height: 75px;background-image:url(".$current_image.");'></span></span>";
1199
+ }
1200
+ ?><?php */?>
1201
+ <?php
1202
+ } // end create_image_upload
1203
+
1204
+ function create_image_upload_array($args) {
1205
+ ?>
1206
+ <?php
1207
+ //set default value if applicable
1208
+ if(isset($args["default"])) {
1209
+ $default = $args["default"];
1210
+ } else {
1211
+ $default = false;
1212
+ }
1213
+ $key = $args["key"];
1214
+ $getarray = get_option($args["id"]);
1215
+ if(!isset($getarray[$key])){
1216
+ //$getarray[$key] = "";
1217
+ $usevalue = "";
1218
+ } else {
1219
+ $usevalue = $getarray[$key];
1220
+ }
1221
+ ?>
1222
+ <input class="motech_upload_image" type="text" name="<?php echo $args["id"]."[".$key."]" ?>" value="<?php echo $usevalue ?>" />
1223
+ <input class="motech_upload_image_button" class="button" type="button" value="<?php _e('Upload Image', 'motech-spacer')?>" />
1224
+ <br />
1225
+ <?php
1226
+ if(isset($args["desc"])) {
1227
+ echo "<span class='description'>".$args["desc"]."</span>";
1228
+ } else {
1229
+ echo "<span class='description'>".__('Enter a URL or upload an image.', 'motech-spacer')."</span>";
1230
+ }
1231
+ ?>
1232
+ <?php /*?> <?php
1233
+ $current_image = $getarray[$key];
1234
+ if(!empty($current_image)) {
1235
+ echo "<span class='motech_spacer_preview_image_container'><br><strong>".__('Image Preview', 'motech-spacer')."</strong><br><span class='motech_spacer_preview_image' style='background-size: contain;background-position: 0% 0%;background-repeat: no-repeat;margin-left:20px;display:block; width:75px; height: 75px;background-image:url(".$current_image.");'></span>";
1236
+ }
1237
+ ?><?php */?>
1238
+ <?php
1239
+ } // end create_image_upload
1240
+
1241
+ function create_a_checkbox($args) {
1242
+ $html = '<input type="checkbox" id="' . $args["id"] . '" name="' . $args["id"] . '" value="1" ' . checked(1, get_option($args["id"], $args["default"]), false) . '/>';
1243
+
1244
+ // Here, we will take the desc argument of the array and add it to a label next to the checkbox
1245
+ $html .= '<label for="' . $args["id"] . '">&nbsp;' . $args["desc"] . '</label>';
1246
+
1247
+ echo $html;
1248
+
1249
+ } // end create_a_checkbox
1250
+
1251
+ function create_a_text_input($args) {
1252
+ //grab placeholder if there is one
1253
+ if(isset($args["placeholder"])) {
1254
+ $placeholder_html = "placeholder=\"".$args["placeholder"]."\"";
1255
+ } else {
1256
+ $placeholder_html = "";
1257
+ }
1258
+ //grab maxlength if there is one
1259
+ if(isset($args["maxlength"])) {
1260
+ $max_length_html = "maxlength=\"".$args["maxlength"]."\"";
1261
+ } else {
1262
+ $max_length_html = "";
1263
+ }
1264
+ if(isset($args["default"])) {
1265
+ $default = $args["default"];
1266
+ } else {
1267
+ $default = false;
1268
+ }
1269
+ if(!isset($args["class"])){
1270
+ $args["class"] = "";
1271
+ }
1272
+ // Render the output
1273
+ echo '<input type="text" ' . $placeholder_html . $max_length_html . ' id="' . $args["id"] . '" class="' . $args["class"]. '" name="' . $args["id"] . '" value="' . get_option($args["id"], $default) . '" />';
1274
+ if(isset($args["desc"])) {
1275
+ echo "<p class='description'>".$args["desc"]."</p>";
1276
+ }
1277
+
1278
+
1279
+ } // end create_a_text_input
1280
+
1281
+ function create_a_text_input_array($args) {
1282
+ //grab placeholder if there is one
1283
+ if(isset($args["placeholder"])) {
1284
+ $placeholder_html = "placeholder=\"".$args["placeholder"]."\"";
1285
+ } else {
1286
+ $placeholder_html = "";
1287
+ }
1288
+ //grab maxlength if there is one
1289
+ if(isset($args["maxlength"])) {
1290
+ $max_length_html = "maxlength=\"".$args["maxlength"]."\"";
1291
+ } else {
1292
+ $max_length_html = "";
1293
+ }
1294
+ if(isset($args["default"])) {
1295
+ $usevalue = $args["default"];
1296
+ }
1297
+ if(!isset($args["class"])){
1298
+ $args["class"] = "";
1299
+ }
1300
+ $key = $args["key"];
1301
+ $getarray = get_option($args["id"]);
1302
+ if(!isset($getarray[$key])){
1303
+ //$getarray[$key] = "";
1304
+ $usevalue = "";
1305
+ } else {
1306
+ $usevalue = $getarray[$key];
1307
+ }
1308
+ // Render the output
1309
+ echo '<input type="text" ' . $placeholder_html . $max_length_html . ' class="' . $args["class"]. '" name="' . $args["id"] . '['.$key.']" value="' . $usevalue . '" />';
1310
+ //echo '<input type="text" ' . ' name="' . $args["id"] . '['.$key.']" value="' . $value . '" />';
1311
+ if(isset($args["desc"])) {
1312
+ echo "<p class='description'>".$args["desc"]."</p>";
1313
+ }
1314
+
1315
+
1316
+ } // end create_a_text_input
1317
+
1318
+ function create_a_textarea_input($args) {
1319
+ //grab placeholder if there is one
1320
+ if($args["placeholder"]) {
1321
+ $placeholder_html = "placeholder=\"".$args["placeholder"]."\"";
1322
+ } else {
1323
+ $placeholder_html = "";
1324
+ }
1325
+ //get default value if there is one
1326
+ if(isset($args["default"])) {
1327
+ $default = $args["default"];
1328
+ } else {
1329
+ $default = false;
1330
+ }
1331
+ // Render the output
1332
+ echo '<textarea ' . $placeholder_html . ' id="' . $args["id"] . '" name="' . $args["id"] . '" rows="5" cols="50">' . get_option($args["id"], $default) . '</textarea>';
1333
+ if($args["desc"]) {
1334
+ echo "<p class='description'>".$args["desc"]."</p>";
1335
+ }
1336
+ }
1337
+
1338
+ function create_a_textarea_input_array($args) {
1339
+ //grab placeholder if there is one
1340
+ if($args["placeholder"]) {
1341
+ $placeholder_html = "placeholder=\"".$args["placeholder"]."\"";
1342
+ } else {
1343
+ $placeholder_html = "";
1344
+ }
1345
+ //get default value if there is one
1346
+ if(isset($args["default"])) {
1347
+ $default = $args["default"];
1348
+ } else {
1349
+ $default = false;
1350
+ }
1351
+ if(!isset($args["class"])){
1352
+ $args["class"] = "";
1353
+ }
1354
+ $key = $args["key"];
1355
+ $getarray = get_option($args["id"], $default);
1356
+ if(!isset($getarray[$key])){
1357
+ //$getarray[$key] = "";
1358
+ $usevalue = "";
1359
+ } else {
1360
+ $usevalue = $getarray[$key];
1361
+ }
1362
+ // Render the output
1363
+ echo '<textarea ' . $placeholder_html . ' id="' . $args["id"] . $args["key"] .'" class="' . $args["class"]. '" name="' . $args["id"] . '['.$key.']" rows="5" cols="50">' . $usevalue . '</textarea>';
1364
+ if($args["desc"]) {
1365
+ echo "<p class='description'>".$args["desc"]."</p>";
1366
+ }
1367
+ }
1368
+
1369
+ function create_a_radio_input($args) {
1370
+
1371
+ $radio_options = $args["radio_options"];
1372
+ $html = "";
1373
+ if($args["desc"]) {
1374
+ $html .= $args["desc"] . "<br>";
1375
+ }
1376
+ //get default value if there is one
1377
+ if(isset($args["default"])) {
1378
+ $default = $args["default"];
1379
+ } else {
1380
+ $default = false;
1381
+ }
1382
+ foreach($radio_options as $radio_option) {
1383
+ $html .= '<input type="radio" id="' . $args["id"] . '_' . $radio_option["value"] . '" name="' . $args["id"] . '" value="'.$radio_option["value"].'" ' . checked($radio_option["value"], get_option($args['id'], $default), false) . '/>';
1384
+ $html .= '<label for="' . $args["id"] . '_' . $radio_option["value"] . '"> '.$radio_option["label"].'</label><br>';
1385
+ }
1386
+
1387
+ echo $html;
1388
+
1389
+ } // end create_a_radio_input callback
1390
+
1391
+ function create_a_select_input($args) {
1392
+
1393
+ $select_options = $args["select_options"];
1394
+ $html = "";
1395
+ //get default value if there is one
1396
+ if(isset($args["default"])) {
1397
+ $default = $args["default"];
1398
+ } else {
1399
+ $default = false;
1400
+ }
1401
+ if(isset($args["meta"])) {
1402
+ $meta = $args["meta"];
1403
+ } else {
1404
+ $meta = "";
1405
+ }
1406
+ $html .= '<select id="' . $args["id"] . '" name="' . $args["id"] . '" ' . $meta . '" >';
1407
+ foreach($select_options as $select_option) {
1408
+ $html .= '<option value="'.$select_option["value"].'" ' . selected( $select_option["value"], get_option($args["id"], $default), false) . '>'.$select_option["label"].'</option>';
1409
+ }
1410
+ $html .= '</select>';
1411
+ if(isset($args["desc"])) {
1412
+ $html .= "<p class='description'>".$args["desc"]."</p>";
1413
+ }
1414
+ echo $html;
1415
+
1416
+ } // end create_a_select_input callback
1417
+
1418
+ function create_a_select_input_array($args) {
1419
+
1420
+ $select_options = $args["select_options"];
1421
+ $html = "";
1422
+ //get default value if there is one
1423
+ if(isset($args["default"])) {
1424
+ $usevalue = $args["default"];
1425
+ } else {
1426
+ //$default = false;
1427
+ }
1428
+ if(isset($args["meta"])) {
1429
+ $meta = $args["meta"];
1430
+ } else {
1431
+ $meta = "";
1432
+ }
1433
+ if(!isset($args["class"])){
1434
+ $args["class"] = "";
1435
+ }
1436
+ $key = $args["key"];
1437
+ $getarray = get_option($args["id"]);
1438
+ if(!isset($getarray[$key])){
1439
+ //$getarray[$key] = "";
1440
+ } else {
1441
+ $usevalue = $getarray[$key];
1442
+ }
1443
+ $html .= '<select id="' . $args["id"] . $args["key"] . '" class="' . $args["class"]. '" name="' . $args["id"]. '['.$key.']" ' . $meta . '" >';
1444
+ foreach($select_options as $select_option) {
1445
+ $html .= '<option value="'.$select_option["value"].'" ' . selected( $select_option["value"], $usevalue, false) . '>'.$select_option["label"].'</option>';
1446
+ }
1447
+ $html .= '</select>';
1448
+ if(isset($args["desc"])) {
1449
+ $html .= "<p class='description'>".$args["desc"]."</p>";
1450
+ }
1451
+ echo $html;
1452
+
1453
+ } // end create_a_select_input callback
1454
+
1455
+ public function print_section_info(){ //section summary info goes here
1456
+ //print 'This is the where you set the password for your site.';
1457
+ }
1458
+
1459
+ public function print_section_info_licenses(){ //section summary info goes here
1460
+ if(!has_filter('spacer_licenses_settings')) {
1461
+ _e('To activate licenses for Spacer add ons you must first install and activate the chosen add on. License settings will then appear below.', 'motech-spacer');
1462
+ }
1463
+ }
1464
+
1465
+ public function add_plugin_page(){
1466
+ // This page will be under "Settings"
1467
+ add_options_page('Settings Admin', $this->plugin_label, 'manage_options', $this->plugin_slug.'-setting-admin', array($this, 'create_admin_page'));
1468
+ }
1469
+
1470
+ //add plugin action links logic
1471
+ function add_plugin_action_links( $links ) {
1472
+
1473
+
1474
+ return array_merge(
1475
+ array(
1476
+ 'settings' => '<a href="' . get_bloginfo( 'wpurl' ) . '/wp-admin/options-general.php?page='.$this->plugin_slug.'-setting-admin">'.__('Settings', 'motech-spacer').'</a>'
1477
+ ),
1478
+ $links
1479
+ );
1480
+
1481
+ }
1482
+
1483
+ function motech_imagepicker_admin_css() {
1484
+ if (isset($_GET['page']) && $_GET['page'] == $this->plugin_slug.'-setting-admin') { //if we are on our admin page
1485
+ ?>
1486
+ <style>
1487
+ .motech_spacer_preview_image { -moz-transition: all .5s ease-out;
1488
+ -o-transition: all .5s ease-out;
1489
+ transition: all .5s ease-out;}
1490
+ .spacer_preview_area_container h2 {margin-bottom:3px;}
1491
+ .addspacerunit .spacer_preview_area_container h2 {font-size:1.3em;font-weight:bold; padding-bottom: 0px; margin-bottom: -3px;}
1492
+ .spacer_preview_area { min-height: 75px; overflow: hidden;
1493
+ background: white;
1494
+ padding-left: 25px;
1495
+ padding-top: 1px;
1496
+ padding-bottom: 11px;
1497
+ padding-right: 25px;box-shadow: 0 1px 1px rgba(0,0,0,.04); border: #e5e5e5 solid 1px;}
1498
+ .spacer_preview {-moz-transition: all .5s ease-out;-o-transition: all .5s ease-out;transition: all .5s ease-out;}
1499
+ .spacer_preview_area p {
1500
+ font-size: 15px;}
1501
+ .nothinghere {text-align:center;color:#9C9C98;}
1502
+ .newbutton,.removebutton,.savebutton {
1503
+ font-family: Helvetica,Verdana,sans-serif!important;
1504
+ margin: 10px;
1505
+ background: #3ba0ff;
1506
+ color:#fff;
1507
+ display:block;
1508
+ font-weight:700;
1509
+ font-size:14px;
1510
+ padding:10px;
1511
+ text-shadow:none;
1512
+ text-align: center;cursor:pointer; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none;
1513
+ user-select: none; transition: background 300ms ease-out;
1514
+ }
1515
+ .motech-spacer-options.general h3{
1516
+ font-size: 23px !important;
1517
+ font-weight: normal;
1518
+ padding-left: 0px;
1519
+ }
1520
+ .newbutton:hover{background:#1E7CD4;}
1521
+ .newbutton{margin-bottom:50px;}
1522
+ .removebutton{background:red;margin-top: 27px; margin-bottom: 26px;}
1523
+ .removebutton:hover{background:#a00;}
1524
+ .js .postbox .handlediv { background: transparent;float: right;
1525
+ border: 0;
1526
+ outline: 0;}
1527
+ .js .postbox .handlediv .toggle-indicator:before {
1528
+ margin-top: 4px;
1529
+ width: 20px;
1530
+ -webkit-border-radius: 50%;
1531
+ border-radius: 50%;
1532
+ text-indent: -1px;
1533
+ }
1534
+ .savebutton {padding: 0px;background:#45CE58;margin-top: 40px;}
1535
+ .savebutton:hover {background:#39b54a;}
1536
+ .savebutton button{width: 100%;
1537
+ border: 0;
1538
+ outline: 0;
1539
+ padding: 10px;
1540
+ background: none;
1541
+ cursor: pointer;
1542
+ color: white;}
1543
+ .savebutton .dashicons{
1544
+ font-size: 28px;
1545
+ position: relative;
1546
+ top: -4px;
1547
+ left: -2px;
1548
+ }
1549
+ .js .postbox .toggle-indicator:before, .js .sidebar-name .sidebar-name-arrow:before {
1550
+ content: "\f142";
1551
+ display: inline-block;
1552
+ font: 400 20px/1 dashicons;
1553
+ speak: none;
1554
+ -webkit-font-smoothing: antialiased;
1555
+ -moz-osx-font-smoothing: grayscale;
1556
+ text-decoration: none!important;
1557
+ }
1558
+ .js .postbox.closed .handlediv .toggle-indicator:before, .js .widgets-holder-wrap.closed .sidebar-name-arrow:before {
1559
+ content: "\f140";
1560
+ }
1561
+ .motech_spacer_form .postbox.closed .hndle {border-bottom: 1px solid #ccd0d4;}
1562
+ .motech_spacer_form .postbox .hndle {cursor:pointer;font-size: 14px;
1563
+ font-weight: bold;
1564
+ padding: 8px 12px;
1565
+ line-height: 1.4;
1566
+ border-bottom: 1px solid #eee;}
1567
+ .hmshidden {display:none;}
1568
+ #wpbody h3 {font-size:20px;}
1569
+ #hide_my_site_current_theme {display:none;}
1570
+ div.updated.success {background-color: rgb(169, 252, 169);border-color: rgb(85, 151, 85);}
1571
+ .mvalid {background-color: rgb(169, 252, 169);border-color: rgb(85, 151, 85);width: 127px;font-weight: bold;padding-left: 10px;border: solid 1px rgb(85, 151, 85);border-radius: 3px;}
1572
+ .motech_premium_only {color:red;}
1573
+ #green_ribbon_top {position:relative;z-index:2;}
1574
+ #green_ribbon_left {background:url(<?php echo $this->plugin_dir ?>/images/green_ribbon_left.png) no-repeat -11px 0px;width: 80px;height: 60px;float: left;}
1575
+ #green_ribbon_right {background:url(<?php echo $this->plugin_dir ?>/images/green_ribbon_right.png) no-repeat;width: 80px;height: 60px;position: absolute;top: 0px;right: -10px;}
1576
+ #green_ribbon_base {background:url(<?php echo $this->plugin_dir ?>/images/green_ribbon_base.png) repeat-x;height: 60px;margin-left: 49px;margin-right: 70px;}
1577
+ #green_ribbon_base span {display: inline-block;color: white;position: relative;top: 11px;height: 35px; line-height:33px;font-size: 17px;font-weight: bold;font-style: italic;text-shadow: 1px 3px 2px #597c2a;}
1578
+ #hms_get_premium {background: rgb(58, 80, 27);background: rgba(58, 80, 27, 0.73);cursor:pointer;padding: 0px 12px;margin-left: -17px;font-style: normal !important;margin-right: 12px;text-shadow: 1px 3px 2px #364C18 !important;}
1579
+ #hms_get_premium:hover {background:rgb(30, 43, 12);background:rgba(30, 43, 12, 0.73);text-shadow: 1px 3px 2px #21310B !important;}
1580
+ .motech_premium_box {background:url(<?php echo $this->plugin_dir ?>/images/premium_back.png); margin-left: 49px;padding-top: 29px;padding-bottom:36px;margin-right: 70px;position:relative;top:-16px;display:none;}
1581
+ .motech_premium_box_wrap {margin-left:20px; margin-right:20px;}
1582
+ .motech_premium_box h2 {text-align: center;color: #585858;font-size: 36px;text-shadow: 1px 3px 2px #acabab;}
1583
+ .motech_premium_box .updated {margin-bottom: 20px !important;margin-top: 29px !important;}
1584
+ .motech_premium_box button {background: none;border: none; position:relative;cursor: pointer;overflow: visible;}
1585
+ .motech_purchase_button .purchase_graphic {background:url(<?php echo $this->plugin_dir ?>/images/buy_sprite.png) no-repeat;height: 100px;width: 101px;background-position: -17px -24px;color: white;font-size: 22px;padding: 20px 42px;padding-top: 57px;text-shadow: 1px 1px 7px black;position: absolute;top: -80px;left: -80px;line-height:normal;font-family: 'Open Sans', sans-serif;}
1586
+ .redeem_info{margin-top:20px;display:none;}
1587
+ .motech_purchase_button.unlimited_use .purchase_graphic {width: 115px;padding: 21px 36px;padding-top: 57px;}
1588
+ .motech_purchase_button.unlimited_use .purchase_graphic span {font-weight:bold;}
1589
+ .motech_purchase_button .purchase_bubble {background: white;border-radius: 9px;width: 350px;height: 123px;margin-bottom: 5px;-webkit-transition: all .2s ease-out; -moz-transition: all .2s ease-out;-o-transition: all .2s ease-out;transition: all .2s ease-out;}
1590
+ .motech_purchase_button:hover .purchase_bubble { background-color: #99dcf8;box-shadow:2px 3px 2px rgba(0, 0, 0, 0.31);}
1591
+ .motech_purchase_button.three_use:hover .purchase_bubble { background-color: #96f5e4;}
1592
+ .motech_purchase_button.unlimited_use:hover .purchase_bubble { background-color: #f8c4c6;}
1593
+ .motech_purchase_buttons {padding-top:90px;text-align:center;}
1594
+ .motech_purchase_button {display:inline-block;margin-right: 100px;vertical-align:top;}
1595
+ .motech_purchase_button .purchase_price {font-size: 60px;color: #585858;line-height:normal;}
1596
+ .motech_purchase_button:last-child {margin-right:0px;}
1597
+ .motech_purchase_button.three_use .purchase_graphic {background-position: -208px -24px;}
1598
+ .motech_purchase_button.unlimited_use .purchase_graphic {background-position: -397px -24px;}
1599
+ .motech_premium_cancel {color:#626262;text-align:center;font-size:22px;margin-top:43px;}
1600
+ .motech_premium_cancel span:hover {cursor:pointer;text-decoration:underline;}
1601
+ .<?php echo $this->plugin_slug ?>_form > .form-table {max-width:770px;}
1602
+
1603
+
1604
+ /*css for the image picker*/
1605
+ .motech_image_picker img {border-radius: 14px;box-shadow: 0px 0px 0px 2px rgba(0, 0, 255, 0.3);}
1606
+ .motech_image_picker_wrap:hover img, .motech_image_picker_wrap:focus img {box-shadow: 0px 0px 0px 2px rgba(0, 0, 255, 0.56);}
1607
+ .motech_image_picker_wrap.current img, .motech_image_picker_wrap:active img {box-shadow: 0px 0px 0px 4px rgba(0, 0, 255, 0.9);}
1608
+ .motech_image_picker_wrap {display:inline-block;cursor: pointer;margin-right:20px;margin-bottom: 30px;}
1609
+ .motech_image_picker_wrap div {font-weight:bold;font-size:16px;margin-top:10px;color:rgba(0, 0, 0, 0.47);}
1610
+ </style>
1611
+ <?php
1612
+ if(has_filter('spacer_add_to_admincss')) {
1613
+ apply_filters('spacer_add_to_admincss','');
1614
+ }
1615
+ ?>
1616
+ <style>
1617
+
1618
+ /* Begin Responsive
1619
+ ====================================================================== */
1620
+ @media only screen and (max-width: 1700px) {
1621
+ .motech_purchase_button .purchase_price {font-size: 42px;padding-top: 18px;}
1622
+ .motech_purchase_button .purchase_bubble {width: 252px;}
1623
+ }
1624
+ @media only screen and (max-width: 1535px) {
1625
+ .motech_purchase_button .purchase_bubble {width: 131px;padding-top: 69px;}
1626
+ .motech_purchase_button .purchase_graphic {left: -23px;}
1627
+ .motech_purchase_button {margin-right:70px;}
1628
+ }
1629
+ @media only screen and (max-width: 1255px) {
1630
+ .motechdonate {height: 55px;}
1631
+ }
1632
+ @media only screen and (max-width: 1025px) {
1633
+ .hms_get_premium_meta {display:none !important;}
1634
+ }
1635
+ @media only screen and (max-width: 980px) {
1636
+ .motech_purchase_button {display:block;margin-bottom: 80px;margin-right:0px;}
1637
+ }
1638
+ @media only screen and (max-width: 445px) {
1639
+ .motech_premium_box h2 {font-size:22px;}
1640
+ }
1641
+ @media only screen and (max-width: 380px) {
1642
+ #green_ribbon_base span {font-size: 12px;}
1643
+ #hms_get_premium {margin-right:0px;}
1644
+ }
1645
+ @media only screen and (max-width: 330px) {
1646
+ .motech_purchase_button {
1647
+ margin-left: -9px;
1648
+ }
1649
+ </style>
1650
+
1651
+ <!--[if lt IE 9]>
1652
+ <style>
1653
+ .motech_image_picker_wrap.current img, .motech_image_picker_wrap:active img {
1654
+ border: 4px solid rgb(0, 0, 255);
1655
+ margin:-4px;
1656
+ }
1657
+ .motech_purchase_button {
1658
+ display: block;
1659
+ padding-bottom: 70px;
1660
+ margin-right: 0px;
1661
+ }
1662
+ .motech_purchase_button.unlimited_use {
1663
+ padding-bottom: 0px;
1664
+ }
1665
+ .hms_get_premium_meta {display:none !important;}
1666
+ </style>
1667
+ <![endif]-->
1668
+ <?php
1669
+ }
1670
+ }
1671
+
1672
+ function po($input) {
1673
+ if (get_option($this->plugin_slug . '_ihmsa','') == 'hmsia') {
1674
+ return $input;
1675
+ }
1676
+ if(is_array($input)){
1677
+ foreach($input as $val){
1678
+ if (!empty($val)) {
1679
+ add_settings_error('plk_error_id81',esc_attr('settings_updated_81'),__('A premium option was not saved. You must first enter your license key to unlock this premium feature.', 'motech-spacer'),'error');
1680
+ }
1681
+ }
1682
+ } else {
1683
+ if (!empty($input)) {
1684
+ add_settings_error('plk_error_id81',esc_attr('settings_updated_81'),__('A premium option was not saved. You must first enter your license key to unlock this premium feature.', 'motech-spacer'),'error');
1685
+ }
1686
+ }
1687
+
1688
+ }
1689
+
1690
+ function po_px($input) {
1691
+ if (get_option($this->plugin_slug . '_ihmsa','') == 'hmsia') {
1692
+ return $input;
1693
+ }
1694
+ if ($input != "px") {
1695
+ add_settings_error('plk_error_id82',esc_attr('settings_updated_82'),__('A premium option was not saved. You must first enter your license key to unlock this premium feature.', 'motech-spacer'),'error');
1696
+ }
1697
+ }
1698
+
1699
+ function po_repeat($input) {
1700
+ if (get_option($this->plugin_slug . '_ihmsa','') == 'hmsia') {
1701
+ return $input;
1702
+ }
1703
+
1704
+ if(is_array($input)){
1705
+ foreach($input as $val){
1706
+ if ($val != "repeat") {
1707
+ add_settings_error('plk_error_id81',esc_attr('settings_updated_81'),__('A premium option was not saved. You must first enter your license key to unlock this premium feature.', 'motech-spacer'),'error');
1708
+ }
1709
+ }
1710
+ } else {
1711
+ if ((!empty($input))&&($input != "repeat")) {
1712
+ add_settings_error('plk_error_id81',esc_attr('settings_updated_81'),__('A premium option was not saved. You must first enter your license key to unlock this premium feature.', 'motech-spacer'),'error');
1713
+ }
1714
+ }
1715
+
1716
+ }
1717
+
1718
+ function po_solid($input) {
1719
+ if (get_option($this->plugin_slug . '_ihmsa','') == 'hmsia') {
1720
+ return $input;
1721
+ }
1722
+
1723
+ if(is_array($input)){
1724
+ foreach($input as $val){
1725
+ if ($val != "solid") {
1726
+ add_settings_error('plk_error_id81',esc_attr('settings_updated_81'),__('A premium option was not saved. You must first enter your license key to unlock this premium feature.', 'motech-spacer'),'error');
1727
+ }
1728
+ }
1729
+ } else {
1730
+ if ((!empty($input))&&($input != "solid")) {
1731
+ add_settings_error('plk_error_id81',esc_attr('settings_updated_81'),__('A premium option was not saved. You must first enter your license key to unlock this premium feature.', 'motech-spacer'),'error');
1732
+ }
1733
+ }
1734
+
1735
+ }
1736
+
1737
+ function po_none($input) {
1738
+ if (get_option($this->plugin_slug . '_ihmsa','') == 'hmsia') {
1739
+ return $input;
1740
+ }
1741
+
1742
+ if(is_array($input)){
1743
+ foreach($input as $val){
1744
+ if ($val != "none") {
1745
+ add_settings_error('plk_error_id81',esc_attr('settings_updated_81'),__('A premium option was not saved. You must first enter your license key to unlock this premium feature.', 'motech-spacer'),'error');
1746
+ }
1747
+ }
1748
+ } else {
1749
+ if ((!empty($input))&&($input != "none")) {
1750
+ add_settings_error('plk_error_id81',esc_attr('settings_updated_81'),__('A premium option was not saved. You must first enter your license key to unlock this premium feature.', 'motech-spacer'),'error');
1751
+ }
1752
+ }
1753
+
1754
+ }
1755
+
1756
+ function po_20($input) {
1757
+ if (get_option($this->plugin_slug . '_ihmsa','') == 'hmsia') {
1758
+ return $input;
1759
+ }
1760
+ if ($input != "20") {
1761
+ add_settings_error('plk_error_id83',esc_attr('settings_updated_83'),__('A premium option was not saved. You must first enter your license key to unlock this premium feature.', 'motech-spacer'),'error');
1762
+ }
1763
+ return "20";
1764
+ }
1765
+
1766
+ function get_premium_warning() {
1767
+ if (get_option($this->plugin_slug . '_ihmsa','') == 'hmsia') {
1768
+ return '';
1769
+ } else {
1770
+ return '<span class="motech_premium_only"> ('.__('Premium Only', 'motech-spacer').')</span>';
1771
+ }
1772
+ }
1773
+
1774
+ function motech_spacer_prepjsbuttons(){
1775
+ ?>
1776
+ <script type="text/javascript">
1777
+ <?php
1778
+ $checkheight = get_option($this->plugin_slug . '_default_height','20');
1779
+ $checkunit = get_option($this->plugin_slug . '_default_height_unit','px');
1780
+ $return["useheight"] = $checkheight.$checkunit;
1781
+ if($this->has_addspacers){
1782
+ $ids = $this->key_array;
1783
+ $checkaddheights = get_option($this->plugin_slug . '_default_height_addspacers');
1784
+ $checkaddheightunits = get_option($this->plugin_slug . '_default_height_unit_addspacers');
1785
+ $checktitles = get_option($this->plugin_slug . '_title_addspacers');
1786
+ foreach($ids as $key=>$value){
1787
+ $useheight = $checkaddheights[$key];
1788
+ $useunit = $checkaddheightunits[$key];
1789
+ $usetitle = $checktitles[$key];
1790
+ if(empty($usetitle)){
1791
+ $usetitle = "Untitled";
1792
+ }
1793
+ $return["addspacers"][] = array("id"=>$value,"height"=>$useheight.$useunit,"title"=>$usetitle);
1794
+ }
1795
+ }
1796
+ ?>
1797
+
1798
+ var motech_spacer_prepjsbuttons = <?php echo json_encode($return); ?>;
1799
+ </script>
1800
+ <?php
1801
+ }
1802
+
1803
+ function motech_imagepicker_admin_jquery() {
1804
+ if (isset($_GET['page']) && $_GET['page'] == $this->plugin_slug.'-setting-admin') { //if we are on our admin page
1805
+ ?>
1806
+ <script>
1807
+ jQuery(function() {
1808
+
1809
+ jQuery("body").on("click",".sendhook .newbutton.readysend", function() {
1810
+ buttonelement = jQuery(this);
1811
+ jQuery(this).find(".readysendlabel").html("SENDING...");
1812
+ jQuery(this).removeClass("readysend").addClass("notreadysend").css("cursor","not-allowed");
1813
+ suggestion = jQuery("textarea[name=mysuggestion]").val();
1814
+ signmeup = jQuery("input[name=signmeup]:checked").val();
1815
+ myemail = jQuery("input[name=myemail]").val();
1816
+
1817
+ //user doesn't want to sign up for mailing list, email not sent
1818
+ if(typeof signmeup == 'undefined'){
1819
+ myemail = "";
1820
+ }
1821
+
1822
+ jQuery.ajax({
1823
+ type: "POST",
1824
+ dataType: "json",
1825
+ url: "http://www.justinsaad.com/suggestions/response.php",
1826
+ data: { suggestion : suggestion, signmeup : signmeup, myemail : myemail },
1827
+ success: function(data) { //data is the response from the php page
1828
+ jQuery(".responsehook").text(data['response']).fadeIn('slow');
1829
+ buttonelement.find(".readysendlabel").html("SENT!");
1830
+ }
1831
+ });
1832
+
1833
+ });
1834
+
1835
+ //jquery for color picker
1836
+ jQuery('tr.motech-color-field').removeClass('motech-color-field');
1837
+
1838
+ //jquery for image picker
1839
+ jQuery(".motech_image_picker_wrap").click(function(){
1840
+ jQuery(this).closest(".motech_image_picker").find(".motech_image_picker_wrap").removeClass("current");
1841
+ jQuery(this).addClass("current");
1842
+ selectedvalue = jQuery(this).find("img").attr("alt");
1843
+ jQuery("#<?php echo $this->plugin_slug ?>_current_theme").val(selectedvalue);
1844
+ });
1845
+ jQuery("#<?php echo $this->plugin_slug ?>_current_theme").parent().parent().hide();
1846
+ <?php if (get_option($this->plugin_slug . '_ihmsa','') == 'hmsia') : ?>
1847
+ <?php
1848
+ if(get_option('hide_my_site_premium_expansion_plk','') != '') {
1849
+ $useval = get_option('hide_my_site_premium_expansion_plk','');
1850
+ } elseif(get_option($this->plugin_slug . '_plk','') != '') {
1851
+ $useval = get_option('hide_my_site_premium_expansion_plk','');
1852
+ }
1853
+ ?>
1854
+ useval = '<?php echo $useval ?>';
1855
+ jQuery("#hide_my_site_plk").replaceWith("<div>"+useval+"</div>");
1856
+ <?php else : ?>
1857
+ jQuery("#hide_my_site_plk").replaceWith("<div></div>");
1858
+ <?php endif ?>
1859
+
1860
+ jQuery("#hms_get_premium").click(function(){
1861
+ //jQuery(".motech_premium_box").slideToggle(200);
1862
+ });
1863
+
1864
+ jQuery(".motech_premium_cancel span").click(function(){
1865
+ jQuery(".motech_premium_box").slideUp(200, function() {
1866
+ // Animation complete.
1867
+ //jQuery("#green_ribbon").hide();
1868
+ });
1869
+
1870
+ });
1871
+ jQuery(".how_to_redeem").click(function(){
1872
+ jQuery(".redeem_info").slideToggle(200);
1873
+ });
1874
+
1875
+ jQuery("body").on('click', '#hms_get_premium, .hms_get_premium, .buynowbutton', function(e) {
1876
+ e.preventDefault();
1877
+ jQuery("html, body").animate({ scrollTop: 0 }, 300, function() {
1878
+ // Animation complete.
1879
+ jQuery("#green_ribbon").show();
1880
+ jQuery(".motech_premium_box").slideDown(200);
1881
+
1882
+ });
1883
+
1884
+ //switch to different add on if set
1885
+ var addonname = jQuery(this).attr('addonname');
1886
+ console.log(addonname);
1887
+ // For some browsers, `attr` is undefined; for others, `attr` is false. Check for both.
1888
+ if (typeof addonname !== typeof undefined && addonname !== false) {
1889
+ // Element has this attribute
1890
+ if(addonname=="gotourl"){
1891
+ var useurl = jQuery(this).attr('useurl');
1892
+ window.open(useurl);
1893
+ }else{
1894
+ jQuery(".grwrap").hide();
1895
+ jQuery(".grwrap."+addonname).show();
1896
+ }
1897
+ }
1898
+
1899
+ });
1900
+
1901
+
1902
+ });
1903
+ </script>
1904
+ <?php
1905
+ }
1906
+ }
1907
+
1908
+
1909
+ } //end class
1910
+
1911
+ function load_sva() {
1912
+ if( !class_exists( 'spacer_layout_aid' ) ) {
1913
+
1914
+ include 'sva/sva.php';
1915
+
1916
+ }
1917
+ }
1918
+ add_action( 'plugins_loaded', 'load_sva' );
1919
+
1920
+ $class = new motech_spacer();
1921
+
1922
+ add_action('init', array($class, 'add_custom_button'));
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: clevelandwebdeveloper
3
  Donate link: http://www.clevelandwebdeveloper.com/wordpress-plugins/donate.php
4
  Tags: spacer, spacing, line space
5
  Requires at least: 3.5
6
- Tested up to: 4.9.4
7
- Stable tag: 3.0.4
8
  License: GPLv2
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -85,6 +85,9 @@ Try adding <code>margin-bottom: 25px;</code> to the Spacer's Style setting.
85
 
86
  == Changelog ==
87
 
 
 
 
88
  = 3.0.4 =
89
  * Adds compatibility with Draft It! add-on
90
  * WP tested up to version 4.6.1
@@ -133,5 +136,5 @@ Try adding <code>margin-bottom: 25px;</code> to the Spacer's Style setting.
133
 
134
  == Upgrade Notice ==
135
 
136
- = 3.0.4 =
137
- New: This version adds compatibility with the new Draft It! add-on. Spacer is now tested up to WP version 4.6.1 - Enjoy!
3
  Donate link: http://www.clevelandwebdeveloper.com/wordpress-plugins/donate.php
4
  Tags: spacer, spacing, line space
5
  Requires at least: 3.5
6
+ Tested up to: 6.0.2
7
+ Stable tag: 3.0.5
8
  License: GPLv2
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
85
 
86
  == Changelog ==
87
 
88
+ = 3.0.5 =
89
+ * Fixes string offset error
90
+
91
  = 3.0.4 =
92
  * Adds compatibility with Draft It! add-on
93
  * WP tested up to version 4.6.1
136
 
137
  == Upgrade Notice ==
138
 
139
+ = 3.0.5 =
140
+ New: This version fixes the string offset error - Enjoy!
sva/sva.php CHANGED
@@ -1,911 +1,927 @@
1
- <?php
2
-
3
- $sva_plugin_label = "Spacer - Visual Artist";
4
- $sva_plugin_slug = "spacer_layout_aid_preview";
5
-
6
- class spacer_layout_aid_preview {
7
-
8
- public function __construct(){
9
-
10
- global $sva_plugin_label, $plugin_slug;
11
- $this->sva_plugin_slug = $plugin_slug;
12
- $this->sva_plugin_label = $sva_plugin_label;
13
-
14
- $checkaddspacers = get_option("motech_spacer_addspacer_id");
15
- if(!empty($checkaddspacers)){
16
- $this->key_array = $checkaddspacers;
17
- $this->has_addspacers = true;
18
- }else{
19
- $this->key_array = array(0);
20
- $this->has_addspacers = false;
21
- }
22
-
23
- $this->ihmsa = 'hmsia';
24
-
25
-
26
-
27
- //uncomment the following line to enqueue color picker
28
- //add_action( 'admin_enqueue_scripts', array($this, 'enqueue_color_picker') );
29
-
30
- //uncomment following line to add extra plugin row links under plugin description
31
- //add_filter( 'plugin_row_meta', array($this,'plugin_row_links'), 10, 2 );
32
-
33
- add_filter('spacer_add_css', array($this,'spacer_add_css'),50,2);
34
-
35
- add_filter('spacer_add_to_default', array($this,'spacer_add_to_default'),50);
36
- add_filter('spacer_add_to_extras', array($this,'spacer_add_to_extras'),50,2);
37
-
38
- if(is_admin()){
39
-
40
- //uncomment following line to add Settings link to plugin page
41
- //add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array($this, 'add_plugin_action_links') );
42
-
43
- //uncomment following line to add admin notices
44
- //add_action( 'admin_notices', array($this, 'admin_notices') );
45
-
46
- //add_action('admin_menu', array($this, 'add_plugin_page'));
47
- //add_action('admin_init', array($this, 'page_init'));
48
- //add_filter('spacer_licenses_settings', array($this,'add_layout_licenses_section'),50,2);
49
-
50
- add_action( 'admin_enqueue_scripts', array($this, 'enqueue_motech_javascript'), 10 ); //enqueue color picker. set this to a number lower than 50, so it will load before spacer javascript.
51
- add_filter('spacer_default_settings', array($this,'add_layout_aid_section'),50,2);
52
- if($this->ihmsa == 'hmsia'){
53
- add_filter('spacer_default_sections', array($this,'add_layout_aid_section_container'),50,2);
54
- }
55
- add_filter('spacer_add_to_admincss', array($this,'spacer_add_to_admincss'),50);
56
- if($this->ihmsa == 'hmsia'){
57
- add_action( 'admin_enqueue_scripts', array($this,'load_custom_wp_admin_style'), 60 ); //set this to a number higher than 50, so it will load after spacer core
58
- }
59
- $key_array = $this->key_array;
60
- $getoption = get_option($this->sva_plugin_slug.'_title_addspacers','');
61
- if($this->ihmsa == 'hmsia'){
62
- foreach($key_array as $key=>$value){
63
- add_filter('spacer_addspacer_sections'.$key, array($this,'add_layout_aid_addspacer_section_container'),50,2);
64
- }
65
- }
66
- }
67
-
68
- }
69
-
70
- function load_custom_wp_admin_style() {
71
-
72
- //wp_register_style( 'mspacerlayout_wp_admin_css', plugins_url( 'admin-style.css' , __FILE__ ), false, '1.0.0' );
73
- //wp_enqueue_style( 'mspacerlayout_wp_admin_css' );
74
- }
75
-
76
- function spacer_add_to_admincss($val){
77
- ?>
78
- <style>
79
- <?php if ($this->ihmsa == 'hmsia') { ?> #motech_spacer_visualartist_license{display:none;} <?php } ?>
80
- /*css for column box - move to add on css via hook instead */
81
- .columnbox { background: #fff;
82
- padding: 0 8px;
83
- margin-bottom: 9px;
84
- outline: 0;
85
- margin: 10px 0 0;
86
- border: 1px solid #e5e5e5;
87
- -webkit-box-shadow: 0 1px 1px rgba(0,0,0,.04);
88
- box-shadow: 0 1px 1px rgba(0,0,0,.04); float: left; width: 21%;margin-right:16px;overflow:hidden;}
89
-
90
- .columnbox h2,.postbox .inside .columnbox h2 {
91
- background: #fafafa;
92
- color: #23282d;
93
- margin: 0;
94
- padding: 15px;
95
- font-size: 1em;
96
- line-height: 1;
97
- overflow: hidden;
98
- white-space: nowrap;
99
- text-overflow: ellipsis;
100
- padding-left: 9px;
101
- margin-left: -10px;
102
- border-bottom: 1px solid #e5e5e5;
103
- margin-right: -10px;
104
- font-weight:600;
105
- }
106
-
107
- .columnbox .form-table th {font-weight: normal; }
108
- .columnbox .form-table td { padding-left: 0px;}
109
- .addspacerunit .columnbox { background: #fafafa;}
110
- .addspacerunit .columnbox h2, .addspacerunit .postbox .inside .columnbox h2 {background:white;}
111
- .motech_spacer_preview_image_container {display:none;}
112
- .wp-picker-holder {position:absolute;}
113
-
114
- @media only screen and (max-width: 1370px) {
115
- .columnbox input[type="text"], .columnbox select {max-width:50%;}
116
- .columnbox {width:auto;float:none;margin-right:0px;}
117
- }
118
-
119
- @media only screen and (max-width: 1050px) {
120
- .columnbox {width:auto;float:none;margin-right:0px;}
121
- }
122
- </style>
123
- <?php
124
- }
125
-
126
- function spacer_add_to_default($return) {
127
- //return is an array like $return["checkheight"], we want to add elements to it
128
- $return["bgcolor"] = get_option('motech_spacer_default_bg_color');
129
- $return["bgimage"] = get_option('motech_spacer_default_background_image_upload');
130
- $return["bordertopwidth"] = get_option('motech_spacer_default_border_top_width');
131
- $return["bordertopstyle"] = get_option('motech_spacer_default_border_top_style');
132
- $return["bordertopcolor"] = get_option('motech_spacer_default_border_top_color');
133
- $return["borderbottomwidth"] = get_option('motech_spacer_default_border_bottom_width');
134
- $return["borderbottomstyle"] = get_option('motech_spacer_default_border_bottom_style');
135
- $return["borderbottomcolor"] = get_option('motech_spacer_default_border_bottom_color');
136
- $return["bottommargin"] = get_option('motech_spacer_default_bottom_margin');
137
- $return["shadow"] = get_option('motech_spacer_default_shadow');
138
- $return["bgimageposition"] = get_option('motech_spacer_custom_background_image_position');
139
-
140
- //$spacer_css .= "background:red;";
141
- return $return;
142
- }
143
-
144
- function spacer_add_to_extras($return,$key) {
145
- $get = get_option('motech_spacer_default_bg_color_addspacers');
146
- $return["bgcolor"] = $get[$key];
147
-
148
- $get = get_option('motech_spacer_default_background_image_upload_addspacers');
149
- $return["bgimage"] = $get[$key];
150
-
151
- $get = get_option('motech_spacer_default_border_top_width_addspacers');
152
- $return["bordertopwidth"] = $get[$key];
153
-
154
- $get = get_option('motech_spacer_default_border_top_style_addspacers');
155
- $return["bordertopstyle"] = $get[$key];
156
-
157
- $get = get_option('motech_spacer_default_border_top_color_addspacers');
158
- $return["bordertopcolor"] = $get[$key];
159
-
160
- $get = get_option('motech_spacer_default_border_bottom_width_addspacers');
161
- $return["borderbottomwidth"] = $get[$key];
162
-
163
- $get = get_option('motech_spacer_default_border_bottom_style_addspacers');
164
- $return["borderbottomstyle"] = $get[$key];
165
-
166
- $get = get_option('motech_spacer_default_border_bottom_color_addspacers');
167
- $return["borderbottomcolor"] = $get[$key];
168
-
169
- $get = get_option('motech_spacer_default_bottom_margin_addspacers');
170
- $return["bottommargin"] = $get[$key];
171
-
172
- $get = get_option('motech_spacer_default_shadow_addspacers');
173
- $return["shadow"] = $get[$key];
174
-
175
- $get = get_option('motech_spacer_custom_background_image_position_addspacers');
176
- $return["bgimageposition"] = $get[$key];
177
-
178
- //$spacer_css .= "background:red;";
179
- return $return;
180
- }
181
-
182
-
183
- function use_shadow($shadow){
184
- if($shadow=="light"){
185
- return "box-shadow:0px 2px 3px rgba(119, 119, 119,0.5);";
186
- }elseif($shadow=="medium"){
187
- return "box-shadow:0px 2px 4px #777;";
188
- }elseif($shadow=="heavy"){
189
- return "box-shadow:0px 2px 10px #888;";
190
- }
191
-
192
- }
193
-
194
- function use_bgimageposition($bgimageposition){
195
- if($bgimageposition=="repeat"){
196
- return "background-repeat:repeat;";
197
- }elseif($bgimageposition=="croptofit"){
198
- return "background-size:cover;background-position:center;";
199
- }elseif($bgimageposition=="stretch"){
200
- return "background-size:100% 100%;background-repeat:no-repeat;background-position:center;";
201
- }elseif($bgimageposition=="propstretch"){
202
- return "background-size:contain;background-repeat:no-repeat;background-position:center;";
203
- }elseif($bgimageposition=="proprepeat"){
204
- return "background-size:contain;background-repeat:repeat;background-position:center;";
205
- }
206
-
207
- }
208
-
209
- function spacer_add_css($spacer_css,$activespacer) {
210
-
211
- extract($activespacer);
212
-
213
- if(!empty($bgcolor)) {
214
- $spacer_css .= "background-color:".$bgcolor.";";
215
- }
216
- if(!empty($bgimage)) {
217
- $spacer_css .= "background-image:url(".$bgimage.");";
218
- }
219
- if(!empty($bordertopstyle)) {
220
- $spacer_css .= "border-top-style:".$bordertopstyle.";";
221
- }
222
- if(!empty($bordertopwidth)) {
223
- $spacer_css .= "border-top-width:".$bordertopwidth."px;";
224
- } else{
225
- $spacer_css .= "border-top-width:0px;";
226
- }
227
- if(!empty($bordertopcolor)) {
228
- $spacer_css .= "border-top-color:".$bordertopcolor.";";
229
- }
230
- if(!empty($borderbottomwidth)) {
231
- $spacer_css .= "border-bottom-width:".$borderbottomwidth."px;";
232
- }else{
233
- $spacer_css .= "border-bottom-width:0px;";
234
- }
235
- if(!empty($borderbottomstyle)) {
236
- $spacer_css .= "border-bottom-style:".$borderbottomstyle.";";
237
- }
238
- if(!empty($borderbottomcolor)) {
239
- $spacer_css .= "border-bottom-color:".$borderbottomcolor.";";
240
- }
241
- if(!empty($bottommargin)) {
242
- $spacer_css .= "margin-bottom:".$bottommargin."px;";
243
- }
244
- if(!empty($shadow)) {
245
- $spacer_css .= $this->use_shadow($shadow);
246
- }
247
- if(!empty($bgimageposition)) {
248
- $spacer_css .= $this->use_bgimageposition($bgimageposition);
249
- }
250
-
251
- //imaqe position
252
-
253
- return $spacer_css;
254
- }
255
-
256
- function enqueue_motech_javascript( ) {
257
- if (isset($_GET['page']) && $_GET['page'] == 'motech_spacer-setting-admin') {
258
- wp_enqueue_script( $this->sva_plugin_slug.'-motech-javascript2', plugins_url('js/motech-javascript.js', __FILE__ ), array('jquery'), false, true );
259
- }
260
- }
261
-
262
-
263
- function add_layout_aid_section_container($val,$object){
264
- ?>
265
- <div class="motech-spacer-options section layoutaid" style="border-top: solid 1px #BFBFBF;margin-top: 3px;">
266
- <div class="postbox closed" style="margin-top:20px;margin-bottom:12px;">
267
- <button type="button" class="handlediv button-link" aria-expanded="true"><span class="toggle-indicator" aria-hidden="true"></span></button>
268
- <h2 class="hndle ui-sortable-handle" style="font-size: 1.3em;font-weight: bold;padding-left: 51px;position: relative;"><img style="position: absolute;top: -1px;width: 42px;left: 7px;" src="<?php echo plugins_url('images/palette.png', __FILE__ ) ?>" /><span><?php _e('Visual Artist', 'spacer-layout-aid') ?><?php echo $object->get_premium_warning() ?></span></h2>
269
- <div class="inside">
270
- <div class="columnbox"><h2><?php _e('Background', 'spacer-layout-aid') ?></h2><?php do_settings_sections($object->plugin_slug.'-setting-admin_layoutaidbg'); ?></div>
271
- <div class="columnbox"><h2><?php _e('Top Border', 'spacer-layout-aid') ?></h2><?php do_settings_sections($object->plugin_slug.'-setting-admin_layoutaidtb'); ?></div>
272
- <div class="columnbox"><h2><?php _e('Bottom Border', 'spacer-layout-aid') ?></h2><?php do_settings_sections($object->plugin_slug.'-setting-admin_layoutaidbb'); ?></div>
273
- <div class="columnbox" style="margin-right:0px;"><h2><?php _e('Other', 'spacer-layout-aid') ?></h2><?php do_settings_sections($object->plugin_slug.'-setting-admin_layoutaidother'); ?></div>
274
- <div style="clear:both;"></div>
275
- </div>
276
- </div>
277
- </div>
278
- <?php
279
- }
280
-
281
- function add_layout_aid_addspacer_section_container($val,$key){
282
- ?>
283
- <div class="motech-spacer-options section layoutaid aslayoutaid" style="border-top: solid 1px #eee;margin-top: 3px;">
284
- <?php /*?><?php do_settings_sections('motech_spacer-setting-admin_layoutaid_addspacer'.$key); ?><?php */?>
285
- <div class="postbox closed" style="margin-top:20px;margin-bottom:12px;background: #fafafa;">
286
- <button type="button" class="handlediv button-link" aria-expanded="true"><span class="toggle-indicator" aria-hidden="true"></span></button>
287
- <h2 class="hndle ui-sortable-handle" style="font-size: 1.3em;font-weight: bold;padding-left: 51px;position: relative;"><img style="position: absolute;top: -1px;width: 42px;left: 7px;" src="<?php echo plugins_url('images/palette.png', __FILE__ ) ?>" /><span><?php _e('Visual Artist', 'spacer-layout-aid') ?><?php echo '<span class="motech_premium_only"> ('.__('Premium Only', 'motech-spacer').')</span>'?></span></h2>
288
- <div class="inside">
289
- <div class="columnbox"><h2><?php _e('Background', 'spacer-layout-aid') ?></h2><?php do_settings_sections('motech_spacer-setting-admin_layoutaidbg_addspacer'.$key); ?></div>
290
- <div class="columnbox"><h2><?php _e('Top Border', 'spacer-layout-aid') ?></h2><?php do_settings_sections('motech_spacer-setting-admin_layoutaidtb_addspacer'.$key); ?></div>
291
- <div class="columnbox"><h2><?php _e('Bottom Border', 'spacer-layout-aid') ?></h2><?php do_settings_sections('motech_spacer-setting-admin_layoutaidbb_addspacer'.$key); ?></div>
292
- <div class="columnbox" style="margin-right:0px;"><h2><?php _e('Other', 'spacer-layout-aid') ?></h2><?php do_settings_sections('motech_spacer-setting-admin_layoutaidother_addspacer'.$key); ?></div>
293
- <div style="clear:both;"></div>
294
- </div>
295
- </div>
296
- </div>
297
- <?php
298
- }
299
-
300
-
301
-
302
- function add_layout_licenses_section($val,$object){
303
- //update_option('motech_spacer_visualartist_license','');
304
- //update_option('motech_spacer_visualartist_ihmsa','');
305
- //add text input field
306
- $field_slug = "visualartist_license";
307
- $field_label = __('Visual Artist Key', 'spacer-layout-aid');
308
- $field_id = $object->plugin_slug.'_'.$field_slug;
309
- //register_setting($object->plugin_slug.'_option_group', $field_id);
310
- register_setting($object->plugin_slug.'_option_group', $field_id, array($this, 'license_v'));
311
- if ($this->ihmsa == 'hmsia') {
312
- $desc = "<div class='mvalid'>".__('Valid', 'spacer-layout-aid')."</div>";
313
- } else {
314
- //$desc = "Enter your license key to unlock premium features. <a href='#' class='hms_validate_alt'>Alernative Method</a>";
315
- $desc = __("You will find this included with your purchase email. If this doesn't work, try the <a href='#' class='motech_spacer_visualartist_validate_alt'>Alternative Method</a>", "spacer-layout-aid");
316
- }
317
- add_settings_field(
318
- $field_id,
319
- $field_label,
320
- array($object, 'create_a_text_input'), //callback function for text input
321
- $object->plugin_slug.'-setting-admin_licenses',
322
- $object->plugin_slug.'_setting_section',
323
- array( // The array of arguments to pass to the callback.
324
- "id" => $field_id, //sends field id to callback
325
- //"desc" => __('Speed up your workflow by setting a default height to apply to your spacers. Note that you can also enter negative spacing to shift the following content upwards.', 'motech-spacer'), //description of the field (optional)
326
- //"placeholder" => __('5', 'spacer-layout-aid'),
327
- "desc" => $desc,
328
- "default" => '' //sets the default field value (optional), when grabbing this option value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
329
- )
330
- );
331
- }
332
-
333
- function add_layout_aid_section($val,$object){
334
-
335
- add_settings_section(
336
- $object->plugin_slug.'_setting_section',
337
- __('', 'spacer-layout-aid'),
338
- false,
339
- $object->plugin_slug.'-setting-admin_layoutaidbg'
340
- );
341
-
342
- add_settings_section(
343
- $object->plugin_slug.'_setting_section',
344
- __('', 'spacer-layout-aid'),
345
- false,
346
- $object->plugin_slug.'-setting-admin_layoutaidtb'
347
- );
348
-
349
- add_settings_section(
350
- $object->plugin_slug.'_setting_section',
351
- __('', 'spacer-layout-aid'),
352
- false,
353
- $object->plugin_slug.'-setting-admin_layoutaidbb'
354
- );
355
-
356
- add_settings_section(
357
- $object->plugin_slug.'_setting_section',
358
- __('', 'spacer-layout-aid'),
359
- false,
360
- $object->plugin_slug.'-setting-admin_layoutaidother'
361
- );
362
-
363
- //add color picker text input field
364
- $field_slug = "default_bg_color";
365
- $field_label = __('Color', 'spacer-layout-aid');
366
- $field_id = $object->plugin_slug.'_'.$field_slug;
367
- register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po'));
368
- add_settings_field(
369
- $field_id,
370
- $field_label,
371
- array($object, 'create_a_text_input'), //callback function for text input
372
- $object->plugin_slug.'-setting-admin_layoutaidbg',
373
- $object->plugin_slug.'_setting_section',
374
- array( // The array of arguments to pass to the callback.
375
- "id" => $field_id, //sends field id to callback
376
- //"desc" => 'Choose a background color to appear behind your custom image. If left empty, default background color will be used', //description of the field (optional)
377
- "default" => '', //sets the default field value (optional), when grabbing this option value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
378
- "class" => "motech-color-field" //designate this as color field. remember to uncomment js enqueue in class construct
379
- )
380
- );
381
-
382
- //add image upload field
383
- $field_slug = "default_background_image_upload";
384
- $field_label = "Image";
385
- $field_id = $object->plugin_slug.'_'.$field_slug;
386
- register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po'));
387
- add_settings_field(
388
- $field_id, // ID of the option
389
- $field_label, // Title of the option
390
- array($object, 'create_image_upload'), // Callback used to render the input field
391
- $object->plugin_slug.'-setting-admin_layoutaidbg', // Page to associate this option with
392
- $object->plugin_slug.'_setting_section', // Section to associate this option with
393
- array( // The array of arguments to pass to the callback.
394
- "id" => $field_id //sends field id to callback
395
- )
396
- );
397
-
398
- //add an image select input field
399
- $field_slug = "custom_background_image_position";
400
- $field_label = "Image Position";
401
- $field_id = $object->plugin_slug.'_'.$field_slug;
402
- $object->back_options = array(
403
- array("label" => "Repeat", "value" => "repeat"),
404
- array("label" => "Proportional Stretch", "value" => "propstretch"),
405
- array("label" => "Proportional Repeat", "value" => "proprepeat"),
406
- array("label" => "Crop to Fit", "value" => "croptofit"),
407
- array("label" => "Stretch", "value" => "stretch")
408
- );
409
- register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po_repeat'));
410
- add_settings_field(
411
- $field_id,
412
- $field_label,
413
- array($object, 'create_a_select_input'), //callback function for select input
414
- $object->plugin_slug.'-setting-admin_layoutaidbg',
415
- $object->plugin_slug.'_setting_section',
416
- array( // The array of arguments to pass to the callback.
417
- "id" => $field_id, //sends select field id to callback
418
- "default" => 'repeat', //sets the default field value (optional), when grabbing this field value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
419
- "select_options" => $object->back_options //sets select option data
420
- )
421
- );
422
-
423
- //add text input field
424
- $field_slug = "default_border_top_width";
425
- $field_label = __('Width (px)', 'spacer-layout-aid');
426
- $field_id = $object->plugin_slug.'_'.$field_slug;
427
- register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po'));
428
- add_settings_field(
429
- $field_id,
430
- $field_label,
431
- array($object, 'create_a_text_input'), //callback function for text input
432
- $object->plugin_slug.'-setting-admin_layoutaidtb',
433
- $object->plugin_slug.'_setting_section',
434
- array( // The array of arguments to pass to the callback.
435
- "id" => $field_id, //sends field id to callback
436
- //"desc" => __('Speed up your workflow by setting a default height to apply to your spacers. Note that you can also enter negative spacing to shift the following content upwards.', 'motech-spacer'), //description of the field (optional)
437
- "placeholder" => __('eg: 5', 'spacer-layout-aid'),
438
- "default" => '' //sets the default field value (optional), when grabbing this option value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
439
- )
440
- );
441
-
442
- //add a select input field
443
- $field_slug = "default_border_top_style";
444
- $field_label = __('Style', 'spacer-layout-aid');
445
- $field_id = $object->plugin_slug.'_'.$field_slug;
446
- $object->unit_options = array(
447
- array("label" => "Solid", "value" => "solid"),
448
- array("label" => "Dotted", "value" => "dotted"),
449
- array("label" => "Dashed", "value" => "dashed"),
450
- array("label" => "Double", "value" => "double"),
451
- array("label" => "Groove", "value" => "groove"),
452
- array("label" => "Inset", "value" => "inset"),
453
- array("label" => "Outset", "value" => "outset"),
454
- );
455
- register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po_solid'));
456
- add_settings_field(
457
- $field_id,
458
- $field_label,
459
- array($object, 'create_a_select_input'), //callback function for select input
460
- $object->plugin_slug.'-setting-admin_layoutaidtb',
461
- $object->plugin_slug.'_setting_section',
462
- array( // The array of arguments to pass to the callback.
463
- "id" => $field_id, //sends select field id to callback
464
- "default" => 'solid', //sets the default field value (optional), when grabbing this field value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
465
- "meta" => 'style="max-width:450px;"',
466
- "select_options" => $object->unit_options //sets select option data
467
- )
468
- );
469
-
470
- //add color picker text input field
471
- $field_slug = "default_border_top_color";
472
- $field_label = __('Color', 'spacer-layout-aid');
473
- $field_id = $object->plugin_slug.'_'.$field_slug;
474
- register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po'));
475
- add_settings_field(
476
- $field_id,
477
- $field_label,
478
- array($object, 'create_a_text_input'), //callback function for text input
479
- $object->plugin_slug.'-setting-admin_layoutaidtb',
480
- $object->plugin_slug.'_setting_section',
481
- array( // The array of arguments to pass to the callback.
482
- "id" => $field_id, //sends field id to callback
483
- //"desc" => 'Choose a background color to appear behind your custom image. If left empty, default background color will be used', //description of the field (optional)
484
- "default" => '', //sets the default field value (optional), when grabbing this option value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
485
- "class" => "motech-color-field" //designate this as color field. remember to uncomment js enqueue in class construct
486
- )
487
- );
488
-
489
- //add text input field
490
- $field_slug = "default_border_bottom_width";
491
- $field_label = __('Width (px)', 'spacer-layout-aid');
492
- $field_id = $object->plugin_slug.'_'.$field_slug;
493
- register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po'));
494
- add_settings_field(
495
- $field_id,
496
- $field_label,
497
- array($object, 'create_a_text_input'), //callback function for text input
498
- $object->plugin_slug.'-setting-admin_layoutaidbb',
499
- $object->plugin_slug.'_setting_section',
500
- array( // The array of arguments to pass to the callback.
501
- "id" => $field_id, //sends field id to callback
502
- //"desc" => __('Speed up your workflow by setting a default height to apply to your spacers. Note that you can also enter negative spacing to shift the following content upwards.', 'motech-spacer'), //description of the field (optional)
503
- "placeholder" => __('eg: 5', 'spacer-layout-aid'),
504
- "default" => '' //sets the default field value (optional), when grabbing this option value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
505
- )
506
- );
507
-
508
- //add a select input field
509
- $field_slug = "default_border_bottom_style";
510
- $field_label = __('Style', 'spacer-layout-aid');
511
- $field_id = $object->plugin_slug.'_'.$field_slug;
512
- $object->unit_options = array(
513
- array("label" => "Solid", "value" => "solid"),
514
- array("label" => "Dotted", "value" => "dotted"),
515
- array("label" => "Dashed", "value" => "dashed"),
516
- array("label" => "Double", "value" => "double"),
517
- array("label" => "Groove", "value" => "groove"),
518
- array("label" => "Inset", "value" => "inset"),
519
- array("label" => "Outset", "value" => "outset"),
520
- );
521
- register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po_solid'));
522
- add_settings_field(
523
- $field_id,
524
- $field_label,
525
- array($object, 'create_a_select_input'), //callback function for select input
526
- $object->plugin_slug.'-setting-admin_layoutaidbb',
527
- $object->plugin_slug.'_setting_section',
528
- array( // The array of arguments to pass to the callback.
529
- "id" => $field_id, //sends select field id to callback
530
- "default" => 'solid', //sets the default field value (optional), when grabbing this field value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
531
- "meta" => 'style="max-width:450px;"',
532
- "select_options" => $object->unit_options //sets select option data
533
- )
534
- );
535
-
536
- //add color picker text input field
537
- $field_slug = "default_border_bottom_color";
538
- $field_label = __('Color', 'spacer-layout-aid');
539
- $field_id = $object->plugin_slug.'_'.$field_slug;
540
- register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po'));
541
- add_settings_field(
542
- $field_id,
543
- $field_label,
544
- array($object, 'create_a_text_input'), //callback function for text input
545
- $object->plugin_slug.'-setting-admin_layoutaidbb',
546
- $object->plugin_slug.'_setting_section',
547
- array( // The array of arguments to pass to the callback.
548
- "id" => $field_id, //sends field id to callback
549
- //"desc" => 'Choose a background color to appear behind your custom image. If left empty, default background color will be used', //description of the field (optional)
550
- "default" => '', //sets the default field value (optional), when grabbing this option value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
551
- "class" => "motech-color-field" //designate this as color field. remember to uncomment js enqueue in class construct
552
- )
553
- );
554
-
555
- //add text input field
556
- $field_slug = "default_bottom_margin";
557
- $field_label = __('Bottom Margin (px)', 'spacer-layout-aid');
558
- $field_id = $object->plugin_slug.'_'.$field_slug;
559
- register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po'));
560
- add_settings_field(
561
- $field_id,
562
- $field_label,
563
- array($object, 'create_a_text_input'), //callback function for text input
564
- $object->plugin_slug.'-setting-admin_layoutaidother',
565
- $object->plugin_slug.'_setting_section',
566
- array( // The array of arguments to pass to the callback.
567
- "id" => $field_id, //sends field id to callback
568
- //"desc" => __('Speed up your workflow by setting a default height to apply to your spacers. Note that you can also enter negative spacing to shift the following content upwards.', 'motech-spacer'), //description of the field (optional)
569
- "placeholder" => __('eg: 5', 'spacer-layout-aid'),
570
- "default" => '' //sets the default field value (optional), when grabbing this option value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
571
- )
572
- );
573
-
574
- //add a select input field
575
- $field_slug = "default_shadow";
576
- $field_label = __('Shadow', 'spacer-layout-aid');
577
- $field_id = $object->plugin_slug.'_'.$field_slug;
578
- $object->unit_options = array(
579
- array("label" => "None", "value" => "none"),
580
- array("label" => "Light", "value" => "light"),
581
- array("label" => "Medium", "value" => "medium"),
582
- array("label" => "Heavy", "value" => "heavy")
583
- );
584
- register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po_none'));
585
- add_settings_field(
586
- $field_id,
587
- $field_label,
588
- array($object, 'create_a_select_input'), //callback function for select input
589
- $object->plugin_slug.'-setting-admin_layoutaidother',
590
- $object->plugin_slug.'_setting_section',
591
- array( // The array of arguments to pass to the callback.
592
- "id" => $field_id, //sends select field id to callback
593
- "default" => 'solid', //sets the default field value (optional), when grabbing this field value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
594
- "meta" => 'style="max-width:450px;"',
595
- "select_options" => $object->unit_options //sets select option data
596
- )
597
- );
598
-
599
-
600
-
601
- //BEGIN ADD SPACER LAYOUT FIELDS
602
-
603
- $key_array = $object->key_array;
604
- foreach($key_array as $key=>$value){
605
- add_settings_section(
606
- $object->plugin_slug.'_setting_section',
607
- __('', 'spacer-layout-aid'),
608
- false,
609
- $object->plugin_slug.'-setting-admin_layoutaidbg_addspacer'.$key
610
- );
611
-
612
- add_settings_section(
613
- $object->plugin_slug.'_setting_section',
614
- __('', 'spacer-layout-aid'),
615
- false,
616
- $object->plugin_slug.'-setting-admin_layoutaidtb_addspacer'.$key
617
- );
618
-
619
- add_settings_section(
620
- $object->plugin_slug.'_setting_section',
621
- __('', 'spacer-layout-aid'),
622
- false,
623
- $object->plugin_slug.'-setting-admin_layoutaidbb_addspacer'.$key
624
- );
625
-
626
- add_settings_section(
627
- $object->plugin_slug.'_setting_section',
628
- __('', 'spacer-layout-aid'),
629
- false,
630
- $object->plugin_slug.'-setting-admin_layoutaidother_addspacer'.$key
631
- );
632
-
633
- //add color picker text input field
634
- $field_slug = "default_bg_color_addspacers";
635
- $field_label = __('Color', 'spacer-layout-aid');
636
- $field_id = $object->plugin_slug.'_'.$field_slug;
637
- register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po'));
638
- add_settings_field(
639
- $field_id,
640
- $field_label,
641
- array($object, 'create_a_text_input_array'), //callback function for text input
642
- $object->plugin_slug.'-setting-admin_layoutaidbg_addspacer'.$key,
643
- $object->plugin_slug.'_setting_section',
644
- array( // The array of arguments to pass to the callback.
645
- "id" => $field_id, //sends field id to callback
646
- //"desc" => 'Choose a background color to appear behind your custom image. If left empty, default background color will be used', //description of the field (optional)
647
- "default" => '', //sets the default field value (optional), when grabbing this option value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
648
- "key" => $key,
649
- "class" => "motech-color-field" //designate this as color field. remember to uncomment js enqueue in class construct
650
- )
651
- );
652
-
653
- //add image upload field
654
- $field_slug = "default_background_image_upload_addspacers";
655
- $field_label = "Image";
656
- $field_id = $object->plugin_slug.'_'.$field_slug;
657
- register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po'));
658
- add_settings_field(
659
- $field_id, // ID of the option
660
- $field_label, // Title of the option
661
- array($object, 'create_image_upload_array'), // Callback used to render the input field
662
- $object->plugin_slug.'-setting-admin_layoutaidbg_addspacer'.$key, // Page to associate this option with
663
- $object->plugin_slug.'_setting_section', // Section to associate this option with
664
- array( // The array of arguments to pass to the callback.
665
- "id" => $field_id, //sends field id to callback
666
- "key" => $key
667
- )
668
- );
669
-
670
- //add an image select input field
671
- $field_slug = "custom_background_image_position_addspacers";
672
- $field_label = "Image Position";
673
- $field_id = $object->plugin_slug.'_'.$field_slug;
674
- $object->back_options = array(
675
- array("label" => "Repeat", "value" => "repeat"),
676
- array("label" => "Proportional Stretch", "value" => "propstretch"),
677
- array("label" => "Proportional Repeat", "value" => "proprepeat"),
678
- array("label" => "Crop to Fit", "value" => "croptofit"),
679
- array("label" => "Stretch", "value" => "stretch")
680
- );
681
- register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po_repeat'));
682
- add_settings_field(
683
- $field_id,
684
- $field_label,
685
- array($object, 'create_a_select_input_array'), //callback function for select input
686
- $object->plugin_slug.'-setting-admin_layoutaidbg_addspacer'.$key,
687
- $object->plugin_slug.'_setting_section',
688
- array( // The array of arguments to pass to the callback.
689
- "id" => $field_id, //sends select field id to callback
690
- "default" => 'repeat', //sets the default field value (optional), when grabbing this field value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
691
- "key" => $key,
692
- "select_options" => $object->back_options //sets select option data
693
- )
694
- );
695
-
696
- //add text input field
697
- $field_slug = "default_border_top_width_addspacers";
698
- $field_label = __('Width (px)', 'spacer-layout-aid');
699
- $field_id = $object->plugin_slug.'_'.$field_slug;
700
- register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po'));
701
- add_settings_field(
702
- $field_id,
703
- $field_label,
704
- array($object, 'create_a_text_input_array'), //callback function for text input
705
- $object->plugin_slug.'-setting-admin_layoutaidtb_addspacer'.$key,
706
- $object->plugin_slug.'_setting_section',
707
- array( // The array of arguments to pass to the callback.
708
- "id" => $field_id, //sends field id to callback
709
- //"desc" => __('Speed up your workflow by setting a default height to apply to your spacers. Note that you can also enter negative spacing to shift the following content upwards.', 'motech-spacer'), //description of the field (optional)
710
- "placeholder" => __('eg: 5', 'spacer-layout-aid'),
711
- "key" => $key,
712
- "default" => '0' //sets the default field value (optional), when grabbing this option value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
713
- )
714
- );
715
-
716
- //add a select input field
717
- $field_slug = "default_border_top_style_addspacers";
718
- $field_label = __('Style', 'spacer-layout-aid');
719
- $field_id = $object->plugin_slug.'_'.$field_slug;
720
- $object->unit_options = array(
721
- array("label" => "Solid", "value" => "solid"),
722
- array("label" => "Dotted", "value" => "dotted"),
723
- array("label" => "Dashed", "value" => "dashed"),
724
- array("label" => "Double", "value" => "double"),
725
- array("label" => "Groove", "value" => "groove"),
726
- array("label" => "Inset", "value" => "inset"),
727
- array("label" => "Outset", "value" => "outset"),
728
- );
729
- register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po_solid'));
730
- add_settings_field(
731
- $field_id,
732
- $field_label,
733
- array($object, 'create_a_select_input_array'), //callback function for select input
734
- $object->plugin_slug.'-setting-admin_layoutaidtb_addspacer'.$key,
735
- $object->plugin_slug.'_setting_section',
736
- array( // The array of arguments to pass to the callback.
737
- "id" => $field_id, //sends select field id to callback
738
- "default" => 'solid', //sets the default field value (optional), when grabbing this field value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
739
- "meta" => 'style="max-width:450px;"',
740
- "key" => $key,
741
- "select_options" => $object->unit_options //sets select option data
742
- )
743
- );
744
-
745
- //add color picker text input field
746
- $field_slug = "default_border_top_color_addspacers";
747
- $field_label = __('Color', 'spacer-layout-aid');
748
- $field_id = $object->plugin_slug.'_'.$field_slug;
749
- register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po'));
750
- add_settings_field(
751
- $field_id,
752
- $field_label,
753
- array($object, 'create_a_text_input_array'), //callback function for text input
754
- $object->plugin_slug.'-setting-admin_layoutaidtb_addspacer'.$key,
755
- $object->plugin_slug.'_setting_section',
756
- array( // The array of arguments to pass to the callback.
757
- "id" => $field_id, //sends field id to callback
758
- //"desc" => 'Choose a background color to appear behind your custom image. If left empty, default background color will be used', //description of the field (optional)
759
- "default" => '', //sets the default field value (optional), when grabbing this option value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
760
- "key" => $key,
761
- "class" => "motech-color-field" //designate this as color field. remember to uncomment js enqueue in class construct
762
- )
763
- );
764
-
765
- //add text input field
766
- $field_slug = "default_border_bottom_width_addspacers";
767
- $field_label = __('Width (px)', 'spacer-layout-aid');
768
- $field_id = $object->plugin_slug.'_'.$field_slug;
769
- register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po'));
770
- add_settings_field(
771
- $field_id,
772
- $field_label,
773
- array($object, 'create_a_text_input_array'), //callback function for text input
774
- $object->plugin_slug.'-setting-admin_layoutaidbb_addspacer'.$key,
775
- $object->plugin_slug.'_setting_section',
776
- array( // The array of arguments to pass to the callback.
777
- "id" => $field_id, //sends field id to callback
778
- //"desc" => __('Speed up your workflow by setting a default height to apply to your spacers. Note that you can also enter negative spacing to shift the following content upwards.', 'motech-spacer'), //description of the field (optional)
779
- "placeholder" => __('eg: 5', 'spacer-layout-aid'),
780
- "key" => $key,
781
- "default" => '0' //sets the default field value (optional), when grabbing this option value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
782
- )
783
- );
784
-
785
- //add a select input field
786
- $field_slug = "default_border_bottom_style_addspacers";
787
- $field_label = __('Style', 'spacer-layout-aid');
788
- $field_id = $object->plugin_slug.'_'.$field_slug;
789
- $object->unit_options = array(
790
- array("label" => "Solid", "value" => "solid"),
791
- array("label" => "Dotted", "value" => "dotted"),
792
- array("label" => "Dashed", "value" => "dashed"),
793
- array("label" => "Double", "value" => "double"),
794
- array("label" => "Groove", "value" => "groove"),
795
- array("label" => "Inset", "value" => "inset"),
796
- array("label" => "Outset", "value" => "outset"),
797
- );
798
- register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po_solid'));
799
- add_settings_field(
800
- $field_id,
801
- $field_label,
802
- array($object, 'create_a_select_input_array'), //callback function for select input
803
- $object->plugin_slug.'-setting-admin_layoutaidbb_addspacer'.$key,
804
- $object->plugin_slug.'_setting_section',
805
- array( // The array of arguments to pass to the callback.
806
- "id" => $field_id, //sends select field id to callback
807
- "default" => 'solid', //sets the default field value (optional), when grabbing this field value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
808
- "meta" => 'style="max-width:450px;"',
809
- "key" => $key,
810
- "select_options" => $object->unit_options //sets select option data
811
- )
812
- );
813
-
814
- //add color picker text input field
815
- $field_slug = "default_border_bottom_color_addspacers";
816
- $field_label = __('Color', 'spacer-layout-aid');
817
- $field_id = $object->plugin_slug.'_'.$field_slug;
818
- register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po'));
819
- add_settings_field(
820
- $field_id,
821
- $field_label,
822
- array($object, 'create_a_text_input_array'), //callback function for text input
823
- $object->plugin_slug.'-setting-admin_layoutaidbb_addspacer'.$key,
824
- $object->plugin_slug.'_setting_section',
825
- array( // The array of arguments to pass to the callback.
826
- "id" => $field_id, //sends field id to callback
827
- //"desc" => 'Choose a background color to appear behind your custom image. If left empty, default background color will be used', //description of the field (optional)
828
- "default" => '', //sets the default field value (optional), when grabbing this option value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
829
- "key" => $key,
830
- "class" => "motech-color-field" //designate this as color field. remember to uncomment js enqueue in class construct
831
- )
832
- );
833
-
834
- //add text input field
835
- $field_slug = "default_bottom_margin_addspacers";
836
- $field_label = __('Bottom Margin (px)', 'spacer-layout-aid');
837
- $field_id = $object->plugin_slug.'_'.$field_slug;
838
- register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po'));
839
- add_settings_field(
840
- $field_id,
841
- $field_label,
842
- array($object, 'create_a_text_input_array'), //callback function for text input
843
- $object->plugin_slug.'-setting-admin_layoutaidother_addspacer'.$key,
844
- $object->plugin_slug.'_setting_section',
845
- array( // The array of arguments to pass to the callback.
846
- "id" => $field_id, //sends field id to callback
847
- //"desc" => __('Speed up your workflow by setting a default height to apply to your spacers. Note that you can also enter negative spacing to shift the following content upwards.', 'motech-spacer'), //description of the field (optional)
848
- "placeholder" => __('eg: 5', 'spacer-layout-aid'),
849
- "key" => $key,
850
- "default" => '0' //sets the default field value (optional), when grabbing this option value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
851
- )
852
- );
853
-
854
- //add a select input field
855
- $field_slug = "default_shadow_addspacers";
856
- $field_label = __('Shadow', 'spacer-layout-aid');
857
- $field_id = $object->plugin_slug.'_'.$field_slug;
858
- $object->unit_options = array(
859
- array("label" => "None", "value" => "none"),
860
- array("label" => "Light", "value" => "light"),
861
- array("label" => "Medium", "value" => "medium"),
862
- array("label" => "Heavy", "value" => "heavy")
863
- );
864
- register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po_none'));
865
- add_settings_field(
866
- $field_id,
867
- $field_label,
868
- array($object, 'create_a_select_input_array'), //callback function for select input
869
- $object->plugin_slug.'-setting-admin_layoutaidother_addspacer'.$key,
870
- $object->plugin_slug.'_setting_section',
871
- array( // The array of arguments to pass to the callback.
872
- "id" => $field_id, //sends select field id to callback
873
- "default" => 'solid', //sets the default field value (optional), when grabbing this field value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
874
- "meta" => 'style="max-width:450px;"',
875
- "key" => $key,
876
- "select_options" => $object->unit_options //sets select option data
877
- )
878
- );
879
-
880
- }
881
-
882
- }
883
-
884
-
885
-
886
-
887
- //add plugin action links logic
888
- function add_plugin_action_links( $links ) {
889
-
890
- return array_merge(
891
- array(
892
- 'settings' => '<a href="' . get_bloginfo( 'wpurl' ) . '/wp-admin/options-general.php?page='.$this->sva_plugin_slug.'-setting-admin">Settings</a>'
893
- ),
894
- $links
895
- );
896
-
897
- }
898
-
899
- public function plugin_row_links($links, $file) {
900
- $plugin = plugin_basename(__FILE__);
901
- if ($file == $plugin) // only for this plugin
902
- return array_merge( $links,
903
- array( '<a target="_blank" href="http://www.linkedin.com/in/ClevelandWebDeveloper/">' . __('Find me on LinkedIn' ) . '</a>' ),
904
- array( '<a target="_blank" href="http://twitter.com/ClevelandWebDev">' . __('Follow me on Twitter') . '</a>' )
905
- );
906
- return $links;
907
- }
908
-
909
- } //end of plugin class
910
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
911
  $custom_plugin = new $sva_plugin_slug();
1
+ <?php
2
+
3
+ $sva_plugin_label = "Spacer - Visual Artist";
4
+ $sva_plugin_slug = "spacer_layout_aid_preview";
5
+
6
+ class spacer_layout_aid_preview {
7
+
8
+ public function __construct(){
9
+
10
+ global $sva_plugin_label, $plugin_slug;
11
+ $this->sva_plugin_slug = $plugin_slug;
12
+ $this->sva_plugin_label = $sva_plugin_label;
13
+
14
+ $checkaddspacers = get_option("motech_spacer_addspacer_id");
15
+ if(!empty($checkaddspacers)){
16
+ $this->key_array = $checkaddspacers;
17
+ $this->has_addspacers = true;
18
+ }else{
19
+ $this->key_array = array(0);
20
+ $this->has_addspacers = false;
21
+ }
22
+
23
+ $this->ihmsa = 'hmsia';
24
+
25
+
26
+
27
+ //uncomment the following line to enqueue color picker
28
+ //add_action( 'admin_enqueue_scripts', array($this, 'enqueue_color_picker') );
29
+
30
+ //uncomment following line to add extra plugin row links under plugin description
31
+ //add_filter( 'plugin_row_meta', array($this,'plugin_row_links'), 10, 2 );
32
+
33
+ add_filter('spacer_add_css', array($this,'spacer_add_css'),50,2);
34
+
35
+ add_filter('spacer_add_to_default', array($this,'spacer_add_to_default'),50);
36
+ add_filter('spacer_add_to_extras', array($this,'spacer_add_to_extras'),50,2);
37
+
38
+ if(is_admin()){
39
+
40
+ //uncomment following line to add Settings link to plugin page
41
+ //add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array($this, 'add_plugin_action_links') );
42
+
43
+ //uncomment following line to add admin notices
44
+ //add_action( 'admin_notices', array($this, 'admin_notices') );
45
+
46
+ //add_action('admin_menu', array($this, 'add_plugin_page'));
47
+ //add_action('admin_init', array($this, 'page_init'));
48
+ //add_filter('spacer_licenses_settings', array($this,'add_layout_licenses_section'),50,2);
49
+
50
+ add_action( 'admin_enqueue_scripts', array($this, 'enqueue_motech_javascript'), 10 ); //enqueue color picker. set this to a number lower than 50, so it will load before spacer javascript.
51
+ add_filter('spacer_default_settings', array($this,'add_layout_aid_section'),50,2);
52
+ if($this->ihmsa == 'hmsia'){
53
+ add_filter('spacer_default_sections', array($this,'add_layout_aid_section_container'),50,2);
54
+ }
55
+ add_filter('spacer_add_to_admincss', array($this,'spacer_add_to_admincss'),50);
56
+ if($this->ihmsa == 'hmsia'){
57
+ add_action( 'admin_enqueue_scripts', array($this,'load_custom_wp_admin_style'), 60 ); //set this to a number higher than 50, so it will load after spacer core
58
+ }
59
+ $key_array = $this->key_array;
60
+ $getoption = get_option($this->sva_plugin_slug.'_title_addspacers','');
61
+ if($this->ihmsa == 'hmsia'){
62
+ foreach($key_array as $key=>$value){
63
+ add_filter('spacer_addspacer_sections'.$key, array($this,'add_layout_aid_addspacer_section_container'),50,2);
64
+ }
65
+ }
66
+ }
67
+
68
+ }
69
+
70
+ function load_custom_wp_admin_style() {
71
+
72
+ //wp_register_style( 'mspacerlayout_wp_admin_css', plugins_url( 'admin-style.css' , __FILE__ ), false, '1.0.0' );
73
+ //wp_enqueue_style( 'mspacerlayout_wp_admin_css' );
74
+ }
75
+
76
+ function spacer_add_to_admincss($val){
77
+ ?>
78
+ <style>
79
+ <?php if ($this->ihmsa == 'hmsia') { ?> #motech_spacer_visualartist_license{display:none;} <?php } ?>
80
+ /*css for column box - move to add on css via hook instead */
81
+ .columnbox { background: #fff;
82
+ padding: 0 8px;
83
+ margin-bottom: 9px;
84
+ outline: 0;
85
+ margin: 10px 0 0;
86
+ border: 1px solid #e5e5e5;
87
+ -webkit-box-shadow: 0 1px 1px rgba(0,0,0,.04);
88
+ box-shadow: 0 1px 1px rgba(0,0,0,.04); float: left; width: 21%;margin-right:16px;overflow:hidden;}
89
+
90
+ .columnbox h2,.postbox .inside .columnbox h2 {
91
+ background: #fafafa;
92
+ color: #23282d;
93
+ margin: 0;
94
+ padding: 15px;
95
+ font-size: 1em;
96
+ line-height: 1;
97
+ overflow: hidden;
98
+ white-space: nowrap;
99
+ text-overflow: ellipsis;
100
+ padding-left: 9px;
101
+ margin-left: -10px;
102
+ border-bottom: 1px solid #e5e5e5;
103
+ margin-right: -10px;
104
+ font-weight:600;
105
+ }
106
+
107
+ .columnbox .form-table th {font-weight: normal; }
108
+ .columnbox .form-table td { padding-left: 0px;}
109
+ .addspacerunit .columnbox { background: #fafafa;}
110
+ .addspacerunit .columnbox h2, .addspacerunit .postbox .inside .columnbox h2 {background:white;}
111
+ .motech_spacer_preview_image_container {display:none;}
112
+ .wp-picker-holder {position:absolute;}
113
+
114
+ @media only screen and (max-width: 1370px) {
115
+ .columnbox input[type="text"], .columnbox select {max-width:50%;}
116
+ .columnbox {width:auto;float:none;margin-right:0px;}
117
+ }
118
+
119
+ @media only screen and (max-width: 1050px) {
120
+ .columnbox {width:auto;float:none;margin-right:0px;}
121
+ }
122
+ </style>
123
+ <?php
124
+ }
125
+
126
+ function spacer_add_to_default($return) {
127
+ //return is an array like $return["checkheight"], we want to add elements to it
128
+ $return["bgcolor"] = get_option('motech_spacer_default_bg_color');
129
+ $return["bgimage"] = get_option('motech_spacer_default_background_image_upload');
130
+ $return["bordertopwidth"] = get_option('motech_spacer_default_border_top_width');
131
+ $return["bordertopstyle"] = get_option('motech_spacer_default_border_top_style');
132
+ $return["bordertopcolor"] = get_option('motech_spacer_default_border_top_color');
133
+ $return["borderbottomwidth"] = get_option('motech_spacer_default_border_bottom_width');
134
+ $return["borderbottomstyle"] = get_option('motech_spacer_default_border_bottom_style');
135
+ $return["borderbottomcolor"] = get_option('motech_spacer_default_border_bottom_color');
136
+ $return["bottommargin"] = get_option('motech_spacer_default_bottom_margin');
137
+ $return["shadow"] = get_option('motech_spacer_default_shadow');
138
+ $return["bgimageposition"] = get_option('motech_spacer_custom_background_image_position');
139
+
140
+ //$spacer_css .= "background:red;";
141
+ return $return;
142
+ }
143
+
144
+ function spacer_add_to_extras($return,$key) {
145
+ $get = get_option('motech_spacer_default_bg_color_addspacers');
146
+ if(isset($get[$key])){
147
+ $return["bgcolor"] = $get[$key];
148
+ }
149
+
150
+ $get = get_option('motech_spacer_default_background_image_upload_addspacers');
151
+ if(isset($get[$key])){
152
+ $return["bgimage"] = $get[$key];
153
+ }
154
+
155
+ $get = get_option('motech_spacer_default_border_top_width_addspacers');
156
+ if(isset($get[$key])){
157
+ $return["bordertopwidth"] = $get[$key];
158
+ }
159
+
160
+ $get = get_option('motech_spacer_default_border_top_style_addspacers');
161
+ if(isset($get[$key])){
162
+ $return["bordertopstyle"] = $get[$key];
163
+ }
164
+
165
+ $get = get_option('motech_spacer_default_border_top_color_addspacers');
166
+ if(isset($get[$key])){
167
+ $return["bordertopcolor"] = $get[$key];
168
+ }
169
+ $get = get_option('motech_spacer_default_border_bottom_width_addspacers');
170
+ if(isset($get[$key])){
171
+ $return["borderbottomwidth"] = $get[$key];
172
+ }
173
+ $get = get_option('motech_spacer_default_border_bottom_style_addspacers');
174
+ if(isset($get[$key])){
175
+ $return["borderbottomstyle"] = $get[$key];
176
+ }
177
+ $get = get_option('motech_spacer_default_border_bottom_color_addspacers');
178
+ if(isset($get[$key])){
179
+ $return["borderbottomcolor"] = $get[$key];
180
+ }
181
+ $get = get_option('motech_spacer_default_bottom_margin_addspacers');
182
+ if(isset($get[$key])){
183
+ $return["bottommargin"] = $get[$key];
184
+ }
185
+ $get = get_option('motech_spacer_default_shadow_addspacers');
186
+ if(isset($get[$key])){
187
+ $return["shadow"] = $get[$key];
188
+ }
189
+ $get = get_option('motech_spacer_custom_background_image_position_addspacers');
190
+ if(isset($get[$key])){
191
+ $return["bgimageposition"] = $get[$key];
192
+ }
193
+
194
+ //$spacer_css .= "background:red;";
195
+ return $return;
196
+ }
197
+
198
+
199
+ function use_shadow($shadow){
200
+ if($shadow=="light"){
201
+ return "box-shadow:0px 2px 3px rgba(119, 119, 119,0.5);";
202
+ }elseif($shadow=="medium"){
203
+ return "box-shadow:0px 2px 4px #777;";
204
+ }elseif($shadow=="heavy"){
205
+ return "box-shadow:0px 2px 10px #888;";
206
+ }
207
+
208
+ }
209
+
210
+ function use_bgimageposition($bgimageposition){
211
+ if($bgimageposition=="repeat"){
212
+ return "background-repeat:repeat;";
213
+ }elseif($bgimageposition=="croptofit"){
214
+ return "background-size:cover;background-position:center;";
215
+ }elseif($bgimageposition=="stretch"){
216
+ return "background-size:100% 100%;background-repeat:no-repeat;background-position:center;";
217
+ }elseif($bgimageposition=="propstretch"){
218
+ return "background-size:contain;background-repeat:no-repeat;background-position:center;";
219
+ }elseif($bgimageposition=="proprepeat"){
220
+ return "background-size:contain;background-repeat:repeat;background-position:center;";
221
+ }
222
+
223
+ }
224
+
225
+ function spacer_add_css($spacer_css,$activespacer) {
226
+
227
+ extract($activespacer);
228
+
229
+ if(!empty($bgcolor)) {
230
+ $spacer_css .= "background-color:".$bgcolor.";";
231
+ }
232
+ if(!empty($bgimage)) {
233
+ $spacer_css .= "background-image:url(".$bgimage.");";
234
+ }
235
+ if(!empty($bordertopstyle)) {
236
+ $spacer_css .= "border-top-style:".$bordertopstyle.";";
237
+ }
238
+ if(!empty($bordertopwidth)) {
239
+ $spacer_css .= "border-top-width:".$bordertopwidth."px;";
240
+ } else{
241
+ $spacer_css .= "border-top-width:0px;";
242
+ }
243
+ if(!empty($bordertopcolor)) {
244
+ $spacer_css .= "border-top-color:".$bordertopcolor.";";
245
+ }
246
+ if(!empty($borderbottomwidth)) {
247
+ $spacer_css .= "border-bottom-width:".$borderbottomwidth."px;";
248
+ }else{
249
+ $spacer_css .= "border-bottom-width:0px;";
250
+ }
251
+ if(!empty($borderbottomstyle)) {
252
+ $spacer_css .= "border-bottom-style:".$borderbottomstyle.";";
253
+ }
254
+ if(!empty($borderbottomcolor)) {
255
+ $spacer_css .= "border-bottom-color:".$borderbottomcolor.";";
256
+ }
257
+ if(!empty($bottommargin)) {
258
+ $spacer_css .= "margin-bottom:".$bottommargin."px;";
259
+ }
260
+ if(!empty($shadow)) {
261
+ $spacer_css .= $this->use_shadow($shadow);
262
+ }
263
+ if(!empty($bgimageposition)) {
264
+ $spacer_css .= $this->use_bgimageposition($bgimageposition);
265
+ }
266
+
267
+ //imaqe position
268
+
269
+ return $spacer_css;
270
+ }
271
+
272
+ function enqueue_motech_javascript( ) {
273
+ if (isset($_GET['page']) && $_GET['page'] == 'motech_spacer-setting-admin') {
274
+ wp_enqueue_script( $this->sva_plugin_slug.'-motech-javascript2', plugins_url('js/motech-javascript.js', __FILE__ ), array('jquery'), false, true );
275
+ }
276
+ }
277
+
278
+
279
+ function add_layout_aid_section_container($val,$object){
280
+ ?>
281
+ <div class="motech-spacer-options section layoutaid" style="border-top: solid 1px #BFBFBF;margin-top: 3px;">
282
+ <div class="postbox closed" style="margin-top:20px;margin-bottom:12px;">
283
+ <button type="button" class="handlediv button-link" aria-expanded="true"><span class="toggle-indicator" aria-hidden="true"></span></button>
284
+ <h2 class="hndle ui-sortable-handle" style="font-size: 1.3em;font-weight: bold;padding-left: 51px;position: relative;"><img style="position: absolute;top: -1px;width: 42px;left: 7px;" src="<?php echo plugins_url('images/palette.png', __FILE__ ) ?>" /><span><?php _e('Visual Artist', 'spacer-layout-aid') ?><?php echo $object->get_premium_warning() ?></span></h2>
285
+ <div class="inside">
286
+ <div class="columnbox"><h2><?php _e('Background', 'spacer-layout-aid') ?></h2><?php do_settings_sections($object->plugin_slug.'-setting-admin_layoutaidbg'); ?></div>
287
+ <div class="columnbox"><h2><?php _e('Top Border', 'spacer-layout-aid') ?></h2><?php do_settings_sections($object->plugin_slug.'-setting-admin_layoutaidtb'); ?></div>
288
+ <div class="columnbox"><h2><?php _e('Bottom Border', 'spacer-layout-aid') ?></h2><?php do_settings_sections($object->plugin_slug.'-setting-admin_layoutaidbb'); ?></div>
289
+ <div class="columnbox" style="margin-right:0px;"><h2><?php _e('Other', 'spacer-layout-aid') ?></h2><?php do_settings_sections($object->plugin_slug.'-setting-admin_layoutaidother'); ?></div>
290
+ <div style="clear:both;"></div>
291
+ </div>
292
+ </div>
293
+ </div>
294
+ <?php
295
+ }
296
+
297
+ function add_layout_aid_addspacer_section_container($val,$key){
298
+ ?>
299
+ <div class="motech-spacer-options section layoutaid aslayoutaid" style="border-top: solid 1px #eee;margin-top: 3px;">
300
+ <?php /*?><?php do_settings_sections('motech_spacer-setting-admin_layoutaid_addspacer'.$key); ?><?php */?>
301
+ <div class="postbox closed" style="margin-top:20px;margin-bottom:12px;background: #fafafa;">
302
+ <button type="button" class="handlediv button-link" aria-expanded="true"><span class="toggle-indicator" aria-hidden="true"></span></button>
303
+ <h2 class="hndle ui-sortable-handle" style="font-size: 1.3em;font-weight: bold;padding-left: 51px;position: relative;"><img style="position: absolute;top: -1px;width: 42px;left: 7px;" src="<?php echo plugins_url('images/palette.png', __FILE__ ) ?>" /><span><?php _e('Visual Artist', 'spacer-layout-aid') ?><?php echo '<span class="motech_premium_only"> ('.__('Premium Only', 'motech-spacer').')</span>'?></span></h2>
304
+ <div class="inside">
305
+ <div class="columnbox"><h2><?php _e('Background', 'spacer-layout-aid') ?></h2><?php do_settings_sections('motech_spacer-setting-admin_layoutaidbg_addspacer'.$key); ?></div>
306
+ <div class="columnbox"><h2><?php _e('Top Border', 'spacer-layout-aid') ?></h2><?php do_settings_sections('motech_spacer-setting-admin_layoutaidtb_addspacer'.$key); ?></div>
307
+ <div class="columnbox"><h2><?php _e('Bottom Border', 'spacer-layout-aid') ?></h2><?php do_settings_sections('motech_spacer-setting-admin_layoutaidbb_addspacer'.$key); ?></div>
308
+ <div class="columnbox" style="margin-right:0px;"><h2><?php _e('Other', 'spacer-layout-aid') ?></h2><?php do_settings_sections('motech_spacer-setting-admin_layoutaidother_addspacer'.$key); ?></div>
309
+ <div style="clear:both;"></div>
310
+ </div>
311
+ </div>
312
+ </div>
313
+ <?php
314
+ }
315
+
316
+
317
+
318
+ function add_layout_licenses_section($val,$object){
319
+ //update_option('motech_spacer_visualartist_license','');
320
+ //update_option('motech_spacer_visualartist_ihmsa','');
321
+ //add text input field
322
+ $field_slug = "visualartist_license";
323
+ $field_label = __('Visual Artist Key', 'spacer-layout-aid');
324
+ $field_id = $object->plugin_slug.'_'.$field_slug;
325
+ //register_setting($object->plugin_slug.'_option_group', $field_id);
326
+ register_setting($object->plugin_slug.'_option_group', $field_id, array($this, 'license_v'));
327
+ if ($this->ihmsa == 'hmsia') {
328
+ $desc = "<div class='mvalid'>".__('Valid', 'spacer-layout-aid')."</div>";
329
+ } else {
330
+ //$desc = "Enter your license key to unlock premium features. <a href='#' class='hms_validate_alt'>Alernative Method</a>";
331
+ $desc = __("You will find this included with your purchase email. If this doesn't work, try the <a href='#' class='motech_spacer_visualartist_validate_alt'>Alternative Method</a>", "spacer-layout-aid");
332
+ }
333
+ add_settings_field(
334
+ $field_id,
335
+ $field_label,
336
+ array($object, 'create_a_text_input'), //callback function for text input
337
+ $object->plugin_slug.'-setting-admin_licenses',
338
+ $object->plugin_slug.'_setting_section',
339
+ array( // The array of arguments to pass to the callback.
340
+ "id" => $field_id, //sends field id to callback
341
+ //"desc" => __('Speed up your workflow by setting a default height to apply to your spacers. Note that you can also enter negative spacing to shift the following content upwards.', 'motech-spacer'), //description of the field (optional)
342
+ //"placeholder" => __('5', 'spacer-layout-aid'),
343
+ "desc" => $desc,
344
+ "default" => '' //sets the default field value (optional), when grabbing this option value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
345
+ )
346
+ );
347
+ }
348
+
349
+ function add_layout_aid_section($val,$object){
350
+
351
+ add_settings_section(
352
+ $object->plugin_slug.'_setting_section',
353
+ __('', 'spacer-layout-aid'),
354
+ false,
355
+ $object->plugin_slug.'-setting-admin_layoutaidbg'
356
+ );
357
+
358
+ add_settings_section(
359
+ $object->plugin_slug.'_setting_section',
360
+ __('', 'spacer-layout-aid'),
361
+ false,
362
+ $object->plugin_slug.'-setting-admin_layoutaidtb'
363
+ );
364
+
365
+ add_settings_section(
366
+ $object->plugin_slug.'_setting_section',
367
+ __('', 'spacer-layout-aid'),
368
+ false,
369
+ $object->plugin_slug.'-setting-admin_layoutaidbb'
370
+ );
371
+
372
+ add_settings_section(
373
+ $object->plugin_slug.'_setting_section',
374
+ __('', 'spacer-layout-aid'),
375
+ false,
376
+ $object->plugin_slug.'-setting-admin_layoutaidother'
377
+ );
378
+
379
+ //add color picker text input field
380
+ $field_slug = "default_bg_color";
381
+ $field_label = __('Color', 'spacer-layout-aid');
382
+ $field_id = $object->plugin_slug.'_'.$field_slug;
383
+ register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po'));
384
+ add_settings_field(
385
+ $field_id,
386
+ $field_label,
387
+ array($object, 'create_a_text_input'), //callback function for text input
388
+ $object->plugin_slug.'-setting-admin_layoutaidbg',
389
+ $object->plugin_slug.'_setting_section',
390
+ array( // The array of arguments to pass to the callback.
391
+ "id" => $field_id, //sends field id to callback
392
+ //"desc" => 'Choose a background color to appear behind your custom image. If left empty, default background color will be used', //description of the field (optional)
393
+ "default" => '', //sets the default field value (optional), when grabbing this option value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
394
+ "class" => "motech-color-field" //designate this as color field. remember to uncomment js enqueue in class construct
395
+ )
396
+ );
397
+
398
+ //add image upload field
399
+ $field_slug = "default_background_image_upload";
400
+ $field_label = "Image";
401
+ $field_id = $object->plugin_slug.'_'.$field_slug;
402
+ register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po'));
403
+ add_settings_field(
404
+ $field_id, // ID of the option
405
+ $field_label, // Title of the option
406
+ array($object, 'create_image_upload'), // Callback used to render the input field
407
+ $object->plugin_slug.'-setting-admin_layoutaidbg', // Page to associate this option with
408
+ $object->plugin_slug.'_setting_section', // Section to associate this option with
409
+ array( // The array of arguments to pass to the callback.
410
+ "id" => $field_id //sends field id to callback
411
+ )
412
+ );
413
+
414
+ //add an image select input field
415
+ $field_slug = "custom_background_image_position";
416
+ $field_label = "Image Position";
417
+ $field_id = $object->plugin_slug.'_'.$field_slug;
418
+ $object->back_options = array(
419
+ array("label" => "Repeat", "value" => "repeat"),
420
+ array("label" => "Proportional Stretch", "value" => "propstretch"),
421
+ array("label" => "Proportional Repeat", "value" => "proprepeat"),
422
+ array("label" => "Crop to Fit", "value" => "croptofit"),
423
+ array("label" => "Stretch", "value" => "stretch")
424
+ );
425
+ register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po_repeat'));
426
+ add_settings_field(
427
+ $field_id,
428
+ $field_label,
429
+ array($object, 'create_a_select_input'), //callback function for select input
430
+ $object->plugin_slug.'-setting-admin_layoutaidbg',
431
+ $object->plugin_slug.'_setting_section',
432
+ array( // The array of arguments to pass to the callback.
433
+ "id" => $field_id, //sends select field id to callback
434
+ "default" => 'repeat', //sets the default field value (optional), when grabbing this field value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
435
+ "select_options" => $object->back_options //sets select option data
436
+ )
437
+ );
438
+
439
+ //add text input field
440
+ $field_slug = "default_border_top_width";
441
+ $field_label = __('Width (px)', 'spacer-layout-aid');
442
+ $field_id = $object->plugin_slug.'_'.$field_slug;
443
+ register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po'));
444
+ add_settings_field(
445
+ $field_id,
446
+ $field_label,
447
+ array($object, 'create_a_text_input'), //callback function for text input
448
+ $object->plugin_slug.'-setting-admin_layoutaidtb',
449
+ $object->plugin_slug.'_setting_section',
450
+ array( // The array of arguments to pass to the callback.
451
+ "id" => $field_id, //sends field id to callback
452
+ //"desc" => __('Speed up your workflow by setting a default height to apply to your spacers. Note that you can also enter negative spacing to shift the following content upwards.', 'motech-spacer'), //description of the field (optional)
453
+ "placeholder" => __('eg: 5', 'spacer-layout-aid'),
454
+ "default" => '' //sets the default field value (optional), when grabbing this option value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
455
+ )
456
+ );
457
+
458
+ //add a select input field
459
+ $field_slug = "default_border_top_style";
460
+ $field_label = __('Style', 'spacer-layout-aid');
461
+ $field_id = $object->plugin_slug.'_'.$field_slug;
462
+ $object->unit_options = array(
463
+ array("label" => "Solid", "value" => "solid"),
464
+ array("label" => "Dotted", "value" => "dotted"),
465
+ array("label" => "Dashed", "value" => "dashed"),
466
+ array("label" => "Double", "value" => "double"),
467
+ array("label" => "Groove", "value" => "groove"),
468
+ array("label" => "Inset", "value" => "inset"),
469
+ array("label" => "Outset", "value" => "outset"),
470
+ );
471
+ register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po_solid'));
472
+ add_settings_field(
473
+ $field_id,
474
+ $field_label,
475
+ array($object, 'create_a_select_input'), //callback function for select input
476
+ $object->plugin_slug.'-setting-admin_layoutaidtb',
477
+ $object->plugin_slug.'_setting_section',
478
+ array( // The array of arguments to pass to the callback.
479
+ "id" => $field_id, //sends select field id to callback
480
+ "default" => 'solid', //sets the default field value (optional), when grabbing this field value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
481
+ "meta" => 'style="max-width:450px;"',
482
+ "select_options" => $object->unit_options //sets select option data
483
+ )
484
+ );
485
+
486
+ //add color picker text input field
487
+ $field_slug = "default_border_top_color";
488
+ $field_label = __('Color', 'spacer-layout-aid');
489
+ $field_id = $object->plugin_slug.'_'.$field_slug;
490
+ register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po'));
491
+ add_settings_field(
492
+ $field_id,
493
+ $field_label,
494
+ array($object, 'create_a_text_input'), //callback function for text input
495
+ $object->plugin_slug.'-setting-admin_layoutaidtb',
496
+ $object->plugin_slug.'_setting_section',
497
+ array( // The array of arguments to pass to the callback.
498
+ "id" => $field_id, //sends field id to callback
499
+ //"desc" => 'Choose a background color to appear behind your custom image. If left empty, default background color will be used', //description of the field (optional)
500
+ "default" => '', //sets the default field value (optional), when grabbing this option value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
501
+ "class" => "motech-color-field" //designate this as color field. remember to uncomment js enqueue in class construct
502
+ )
503
+ );
504
+
505
+ //add text input field
506
+ $field_slug = "default_border_bottom_width";
507
+ $field_label = __('Width (px)', 'spacer-layout-aid');
508
+ $field_id = $object->plugin_slug.'_'.$field_slug;
509
+ register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po'));
510
+ add_settings_field(
511
+ $field_id,
512
+ $field_label,
513
+ array($object, 'create_a_text_input'), //callback function for text input
514
+ $object->plugin_slug.'-setting-admin_layoutaidbb',
515
+ $object->plugin_slug.'_setting_section',
516
+ array( // The array of arguments to pass to the callback.
517
+ "id" => $field_id, //sends field id to callback
518
+ //"desc" => __('Speed up your workflow by setting a default height to apply to your spacers. Note that you can also enter negative spacing to shift the following content upwards.', 'motech-spacer'), //description of the field (optional)
519
+ "placeholder" => __('eg: 5', 'spacer-layout-aid'),
520
+ "default" => '' //sets the default field value (optional), when grabbing this option value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
521
+ )
522
+ );
523
+
524
+ //add a select input field
525
+ $field_slug = "default_border_bottom_style";
526
+ $field_label = __('Style', 'spacer-layout-aid');
527
+ $field_id = $object->plugin_slug.'_'.$field_slug;
528
+ $object->unit_options = array(
529
+ array("label" => "Solid", "value" => "solid"),
530
+ array("label" => "Dotted", "value" => "dotted"),
531
+ array("label" => "Dashed", "value" => "dashed"),
532
+ array("label" => "Double", "value" => "double"),
533
+ array("label" => "Groove", "value" => "groove"),
534
+ array("label" => "Inset", "value" => "inset"),
535
+ array("label" => "Outset", "value" => "outset"),
536
+ );
537
+ register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po_solid'));
538
+ add_settings_field(
539
+ $field_id,
540
+ $field_label,
541
+ array($object, 'create_a_select_input'), //callback function for select input
542
+ $object->plugin_slug.'-setting-admin_layoutaidbb',
543
+ $object->plugin_slug.'_setting_section',
544
+ array( // The array of arguments to pass to the callback.
545
+ "id" => $field_id, //sends select field id to callback
546
+ "default" => 'solid', //sets the default field value (optional), when grabbing this field value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
547
+ "meta" => 'style="max-width:450px;"',
548
+ "select_options" => $object->unit_options //sets select option data
549
+ )
550
+ );
551
+
552
+ //add color picker text input field
553
+ $field_slug = "default_border_bottom_color";
554
+ $field_label = __('Color', 'spacer-layout-aid');
555
+ $field_id = $object->plugin_slug.'_'.$field_slug;
556
+ register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po'));
557
+ add_settings_field(
558
+ $field_id,
559
+ $field_label,
560
+ array($object, 'create_a_text_input'), //callback function for text input
561
+ $object->plugin_slug.'-setting-admin_layoutaidbb',
562
+ $object->plugin_slug.'_setting_section',
563
+ array( // The array of arguments to pass to the callback.
564
+ "id" => $field_id, //sends field id to callback
565
+ //"desc" => 'Choose a background color to appear behind your custom image. If left empty, default background color will be used', //description of the field (optional)
566
+ "default" => '', //sets the default field value (optional), when grabbing this option value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
567
+ "class" => "motech-color-field" //designate this as color field. remember to uncomment js enqueue in class construct
568
+ )
569
+ );
570
+
571
+ //add text input field
572
+ $field_slug = "default_bottom_margin";
573
+ $field_label = __('Bottom Margin (px)', 'spacer-layout-aid');
574
+ $field_id = $object->plugin_slug.'_'.$field_slug;
575
+ register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po'));
576
+ add_settings_field(
577
+ $field_id,
578
+ $field_label,
579
+ array($object, 'create_a_text_input'), //callback function for text input
580
+ $object->plugin_slug.'-setting-admin_layoutaidother',
581
+ $object->plugin_slug.'_setting_section',
582
+ array( // The array of arguments to pass to the callback.
583
+ "id" => $field_id, //sends field id to callback
584
+ //"desc" => __('Speed up your workflow by setting a default height to apply to your spacers. Note that you can also enter negative spacing to shift the following content upwards.', 'motech-spacer'), //description of the field (optional)
585
+ "placeholder" => __('eg: 5', 'spacer-layout-aid'),
586
+ "default" => '' //sets the default field value (optional), when grabbing this option value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
587
+ )
588
+ );
589
+
590
+ //add a select input field
591
+ $field_slug = "default_shadow";
592
+ $field_label = __('Shadow', 'spacer-layout-aid');
593
+ $field_id = $object->plugin_slug.'_'.$field_slug;
594
+ $object->unit_options = array(
595
+ array("label" => "None", "value" => "none"),
596
+ array("label" => "Light", "value" => "light"),
597
+ array("label" => "Medium", "value" => "medium"),
598
+ array("label" => "Heavy", "value" => "heavy")
599
+ );
600
+ register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po_none'));
601
+ add_settings_field(
602
+ $field_id,
603
+ $field_label,
604
+ array($object, 'create_a_select_input'), //callback function for select input
605
+ $object->plugin_slug.'-setting-admin_layoutaidother',
606
+ $object->plugin_slug.'_setting_section',
607
+ array( // The array of arguments to pass to the callback.
608
+ "id" => $field_id, //sends select field id to callback
609
+ "default" => 'solid', //sets the default field value (optional), when grabbing this field value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
610
+ "meta" => 'style="max-width:450px;"',
611
+ "select_options" => $object->unit_options //sets select option data
612
+ )
613
+ );
614
+
615
+
616
+
617
+ //BEGIN ADD SPACER LAYOUT FIELDS
618
+
619
+ $key_array = $object->key_array;
620
+ foreach($key_array as $key=>$value){
621
+ add_settings_section(
622
+ $object->plugin_slug.'_setting_section',
623
+ __('', 'spacer-layout-aid'),
624
+ false,
625
+ $object->plugin_slug.'-setting-admin_layoutaidbg_addspacer'.$key
626
+ );
627
+
628
+ add_settings_section(
629
+ $object->plugin_slug.'_setting_section',
630
+ __('', 'spacer-layout-aid'),
631
+ false,
632
+ $object->plugin_slug.'-setting-admin_layoutaidtb_addspacer'.$key
633
+ );
634
+
635
+ add_settings_section(
636
+ $object->plugin_slug.'_setting_section',
637
+ __('', 'spacer-layout-aid'),
638
+ false,
639
+ $object->plugin_slug.'-setting-admin_layoutaidbb_addspacer'.$key
640
+ );
641
+
642
+ add_settings_section(
643
+ $object->plugin_slug.'_setting_section',
644
+ __('', 'spacer-layout-aid'),
645
+ false,
646
+ $object->plugin_slug.'-setting-admin_layoutaidother_addspacer'.$key
647
+ );
648
+
649
+ //add color picker text input field
650
+ $field_slug = "default_bg_color_addspacers";
651
+ $field_label = __('Color', 'spacer-layout-aid');
652
+ $field_id = $object->plugin_slug.'_'.$field_slug;
653
+ register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po'));
654
+ add_settings_field(
655
+ $field_id,
656
+ $field_label,
657
+ array($object, 'create_a_text_input_array'), //callback function for text input
658
+ $object->plugin_slug.'-setting-admin_layoutaidbg_addspacer'.$key,
659
+ $object->plugin_slug.'_setting_section',
660
+ array( // The array of arguments to pass to the callback.
661
+ "id" => $field_id, //sends field id to callback
662
+ //"desc" => 'Choose a background color to appear behind your custom image. If left empty, default background color will be used', //description of the field (optional)
663
+ "default" => '', //sets the default field value (optional), when grabbing this option value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
664
+ "key" => $key,
665
+ "class" => "motech-color-field" //designate this as color field. remember to uncomment js enqueue in class construct
666
+ )
667
+ );
668
+
669
+ //add image upload field
670
+ $field_slug = "default_background_image_upload_addspacers";
671
+ $field_label = "Image";
672
+ $field_id = $object->plugin_slug.'_'.$field_slug;
673
+ register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po'));
674
+ add_settings_field(
675
+ $field_id, // ID of the option
676
+ $field_label, // Title of the option
677
+ array($object, 'create_image_upload_array'), // Callback used to render the input field
678
+ $object->plugin_slug.'-setting-admin_layoutaidbg_addspacer'.$key, // Page to associate this option with
679
+ $object->plugin_slug.'_setting_section', // Section to associate this option with
680
+ array( // The array of arguments to pass to the callback.
681
+ "id" => $field_id, //sends field id to callback
682
+ "key" => $key
683
+ )
684
+ );
685
+
686
+ //add an image select input field
687
+ $field_slug = "custom_background_image_position_addspacers";
688
+ $field_label = "Image Position";
689
+ $field_id = $object->plugin_slug.'_'.$field_slug;
690
+ $object->back_options = array(
691
+ array("label" => "Repeat", "value" => "repeat"),
692
+ array("label" => "Proportional Stretch", "value" => "propstretch"),
693
+ array("label" => "Proportional Repeat", "value" => "proprepeat"),
694
+ array("label" => "Crop to Fit", "value" => "croptofit"),
695
+ array("label" => "Stretch", "value" => "stretch")
696
+ );
697
+ register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po_repeat'));
698
+ add_settings_field(
699
+ $field_id,
700
+ $field_label,
701
+ array($object, 'create_a_select_input_array'), //callback function for select input
702
+ $object->plugin_slug.'-setting-admin_layoutaidbg_addspacer'.$key,
703
+ $object->plugin_slug.'_setting_section',
704
+ array( // The array of arguments to pass to the callback.
705
+ "id" => $field_id, //sends select field id to callback
706
+ "default" => 'repeat', //sets the default field value (optional), when grabbing this field value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
707
+ "key" => $key,
708
+ "select_options" => $object->back_options //sets select option data
709
+ )
710
+ );
711
+
712
+ //add text input field
713
+ $field_slug = "default_border_top_width_addspacers";
714
+ $field_label = __('Width (px)', 'spacer-layout-aid');
715
+ $field_id = $object->plugin_slug.'_'.$field_slug;
716
+ register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po'));
717
+ add_settings_field(
718
+ $field_id,
719
+ $field_label,
720
+ array($object, 'create_a_text_input_array'), //callback function for text input
721
+ $object->plugin_slug.'-setting-admin_layoutaidtb_addspacer'.$key,
722
+ $object->plugin_slug.'_setting_section',
723
+ array( // The array of arguments to pass to the callback.
724
+ "id" => $field_id, //sends field id to callback
725
+ //"desc" => __('Speed up your workflow by setting a default height to apply to your spacers. Note that you can also enter negative spacing to shift the following content upwards.', 'motech-spacer'), //description of the field (optional)
726
+ "placeholder" => __('eg: 5', 'spacer-layout-aid'),
727
+ "key" => $key,
728
+ "default" => '0' //sets the default field value (optional), when grabbing this option value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
729
+ )
730
+ );
731
+
732
+ //add a select input field
733
+ $field_slug = "default_border_top_style_addspacers";
734
+ $field_label = __('Style', 'spacer-layout-aid');
735
+ $field_id = $object->plugin_slug.'_'.$field_slug;
736
+ $object->unit_options = array(
737
+ array("label" => "Solid", "value" => "solid"),
738
+ array("label" => "Dotted", "value" => "dotted"),
739
+ array("label" => "Dashed", "value" => "dashed"),
740
+ array("label" => "Double", "value" => "double"),
741
+ array("label" => "Groove", "value" => "groove"),
742
+ array("label" => "Inset", "value" => "inset"),
743
+ array("label" => "Outset", "value" => "outset"),
744
+ );
745
+ register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po_solid'));
746
+ add_settings_field(
747
+ $field_id,
748
+ $field_label,
749
+ array($object, 'create_a_select_input_array'), //callback function for select input
750
+ $object->plugin_slug.'-setting-admin_layoutaidtb_addspacer'.$key,
751
+ $object->plugin_slug.'_setting_section',
752
+ array( // The array of arguments to pass to the callback.
753
+ "id" => $field_id, //sends select field id to callback
754
+ "default" => 'solid', //sets the default field value (optional), when grabbing this field value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
755
+ "meta" => 'style="max-width:450px;"',
756
+ "key" => $key,
757
+ "select_options" => $object->unit_options //sets select option data
758
+ )
759
+ );
760
+
761
+ //add color picker text input field
762
+ $field_slug = "default_border_top_color_addspacers";
763
+ $field_label = __('Color', 'spacer-layout-aid');
764
+ $field_id = $object->plugin_slug.'_'.$field_slug;
765
+ register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po'));
766
+ add_settings_field(
767
+ $field_id,
768
+ $field_label,
769
+ array($object, 'create_a_text_input_array'), //callback function for text input
770
+ $object->plugin_slug.'-setting-admin_layoutaidtb_addspacer'.$key,
771
+ $object->plugin_slug.'_setting_section',
772
+ array( // The array of arguments to pass to the callback.
773
+ "id" => $field_id, //sends field id to callback
774
+ //"desc" => 'Choose a background color to appear behind your custom image. If left empty, default background color will be used', //description of the field (optional)
775
+ "default" => '', //sets the default field value (optional), when grabbing this option value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
776
+ "key" => $key,
777
+ "class" => "motech-color-field" //designate this as color field. remember to uncomment js enqueue in class construct
778
+ )
779
+ );
780
+
781
+ //add text input field
782
+ $field_slug = "default_border_bottom_width_addspacers";
783
+ $field_label = __('Width (px)', 'spacer-layout-aid');
784
+ $field_id = $object->plugin_slug.'_'.$field_slug;
785
+ register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po'));
786
+ add_settings_field(
787
+ $field_id,
788
+ $field_label,
789
+ array($object, 'create_a_text_input_array'), //callback function for text input
790
+ $object->plugin_slug.'-setting-admin_layoutaidbb_addspacer'.$key,
791
+ $object->plugin_slug.'_setting_section',
792
+ array( // The array of arguments to pass to the callback.
793
+ "id" => $field_id, //sends field id to callback
794
+ //"desc" => __('Speed up your workflow by setting a default height to apply to your spacers. Note that you can also enter negative spacing to shift the following content upwards.', 'motech-spacer'), //description of the field (optional)
795
+ "placeholder" => __('eg: 5', 'spacer-layout-aid'),
796
+ "key" => $key,
797
+ "default" => '0' //sets the default field value (optional), when grabbing this option value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
798
+ )
799
+ );
800
+
801
+ //add a select input field
802
+ $field_slug = "default_border_bottom_style_addspacers";
803
+ $field_label = __('Style', 'spacer-layout-aid');
804
+ $field_id = $object->plugin_slug.'_'.$field_slug;
805
+ $object->unit_options = array(
806
+ array("label" => "Solid", "value" => "solid"),
807
+ array("label" => "Dotted", "value" => "dotted"),
808
+ array("label" => "Dashed", "value" => "dashed"),
809
+ array("label" => "Double", "value" => "double"),
810
+ array("label" => "Groove", "value" => "groove"),
811
+ array("label" => "Inset", "value" => "inset"),
812
+ array("label" => "Outset", "value" => "outset"),
813
+ );
814
+ register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po_solid'));
815
+ add_settings_field(
816
+ $field_id,
817
+ $field_label,
818
+ array($object, 'create_a_select_input_array'), //callback function for select input
819
+ $object->plugin_slug.'-setting-admin_layoutaidbb_addspacer'.$key,
820
+ $object->plugin_slug.'_setting_section',
821
+ array( // The array of arguments to pass to the callback.
822
+ "id" => $field_id, //sends select field id to callback
823
+ "default" => 'solid', //sets the default field value (optional), when grabbing this field value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
824
+ "meta" => 'style="max-width:450px;"',
825
+ "key" => $key,
826
+ "select_options" => $object->unit_options //sets select option data
827
+ )
828
+ );
829
+
830
+ //add color picker text input field
831
+ $field_slug = "default_border_bottom_color_addspacers";
832
+ $field_label = __('Color', 'spacer-layout-aid');
833
+ $field_id = $object->plugin_slug.'_'.$field_slug;
834
+ register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po'));
835
+ add_settings_field(
836
+ $field_id,
837
+ $field_label,
838
+ array($object, 'create_a_text_input_array'), //callback function for text input
839
+ $object->plugin_slug.'-setting-admin_layoutaidbb_addspacer'.$key,
840
+ $object->plugin_slug.'_setting_section',
841
+ array( // The array of arguments to pass to the callback.
842
+ "id" => $field_id, //sends field id to callback
843
+ //"desc" => 'Choose a background color to appear behind your custom image. If left empty, default background color will be used', //description of the field (optional)
844
+ "default" => '', //sets the default field value (optional), when grabbing this option value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
845
+ "key" => $key,
846
+ "class" => "motech-color-field" //designate this as color field. remember to uncomment js enqueue in class construct
847
+ )
848
+ );
849
+
850
+ //add text input field
851
+ $field_slug = "default_bottom_margin_addspacers";
852
+ $field_label = __('Bottom Margin (px)', 'spacer-layout-aid');
853
+ $field_id = $object->plugin_slug.'_'.$field_slug;
854
+ register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po'));
855
+ add_settings_field(
856
+ $field_id,
857
+ $field_label,
858
+ array($object, 'create_a_text_input_array'), //callback function for text input
859
+ $object->plugin_slug.'-setting-admin_layoutaidother_addspacer'.$key,
860
+ $object->plugin_slug.'_setting_section',
861
+ array( // The array of arguments to pass to the callback.
862
+ "id" => $field_id, //sends field id to callback
863
+ //"desc" => __('Speed up your workflow by setting a default height to apply to your spacers. Note that you can also enter negative spacing to shift the following content upwards.', 'motech-spacer'), //description of the field (optional)
864
+ "placeholder" => __('eg: 5', 'spacer-layout-aid'),
865
+ "key" => $key,
866
+ "default" => '0' //sets the default field value (optional), when grabbing this option value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
867
+ )
868
+ );
869
+
870
+ //add a select input field
871
+ $field_slug = "default_shadow_addspacers";
872
+ $field_label = __('Shadow', 'spacer-layout-aid');
873
+ $field_id = $object->plugin_slug.'_'.$field_slug;
874
+ $object->unit_options = array(
875
+ array("label" => "None", "value" => "none"),
876
+ array("label" => "Light", "value" => "light"),
877
+ array("label" => "Medium", "value" => "medium"),
878
+ array("label" => "Heavy", "value" => "heavy")
879
+ );
880
+ register_setting($object->plugin_slug.'_option_group', $field_id, array($object, 'po_none'));
881
+ add_settings_field(
882
+ $field_id,
883
+ $field_label,
884
+ array($object, 'create_a_select_input_array'), //callback function for select input
885
+ $object->plugin_slug.'-setting-admin_layoutaidother_addspacer'.$key,
886
+ $object->plugin_slug.'_setting_section',
887
+ array( // The array of arguments to pass to the callback.
888
+ "id" => $field_id, //sends select field id to callback
889
+ "default" => 'solid', //sets the default field value (optional), when grabbing this field value later on remember to use get_option(option_name, default_value) so it will return default value if no value exists yet
890
+ "meta" => 'style="max-width:450px;"',
891
+ "key" => $key,
892
+ "select_options" => $object->unit_options //sets select option data
893
+ )
894
+ );
895
+
896
+ }
897
+
898
+ }
899
+
900
+
901
+
902
+
903
+ //add plugin action links logic
904
+ function add_plugin_action_links( $links ) {
905
+
906
+ return array_merge(
907
+ array(
908
+ 'settings' => '<a href="' . get_bloginfo( 'wpurl' ) . '/wp-admin/options-general.php?page='.$this->sva_plugin_slug.'-setting-admin">Settings</a>'
909
+ ),
910
+ $links
911
+ );
912
+
913
+ }
914
+
915
+ public function plugin_row_links($links, $file) {
916
+ $plugin = plugin_basename(__FILE__);
917
+ if ($file == $plugin) // only for this plugin
918
+ return array_merge( $links,
919
+ array( '<a target="_blank" href="http://www.linkedin.com/in/ClevelandWebDeveloper/">' . __('Find me on LinkedIn' ) . '</a>' ),
920
+ array( '<a target="_blank" href="http://twitter.com/ClevelandWebDev">' . __('Follow me on Twitter') . '</a>' )
921
+ );
922
+ return $links;
923
+ }
924
+
925
+ } //end of plugin class
926
+
927
  $custom_plugin = new $sva_plugin_slug();