Easy Modal - Version 0.9.0.2

Version Description

  • Added Overlay Color Picker.
Download this release

Release Info

Developer danieliser
Plugin Icon 128x128 Easy Modal
Version 0.9.0.2
Comparing to
See all releases

Version 0.9.0.2

content/content.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Easy Modal
4
+ * http://wizardinternetsolutions.com/project/easy-modal/
5
+ *
6
+ * Copyright (c) 2011 Wizard Internet Solutions
7
+ * http://wizardinternetsolutions.com
8
+ *
9
+ * Licensed under the MIT license:
10
+ * http://www.opensource.org/licenses/mit-license.php
11
+ */
12
+
13
+ require( '../../../../wp-load.php' );
14
+ global $eM;
15
+ $options = $eM->getAdminOptions();
16
+
17
+ ?>
18
+ <div>
19
+ <div class='eM-content'>
20
+ <h1 class='eM-title'><?php echo $options['title'] ?></h1>
21
+
22
+ <?php echo do_shortcode($options['content']) ?>
23
+ </div>
24
+ </div>
25
+ <?php if(strstr($options['content'],'[contact-form')!= NULL){ ?>
26
+ <?php } ?>
css/easy-modal.css ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Easy Modal
3
+ * http://wizardinternetsolutions.com/project/easy-modal/
4
+ *
5
+ * Copyright (c) 2011 Wizard Internet Solutions
6
+ * http://wizardinternetsolutions.com
7
+ *
8
+ * Licensed under the MIT license:
9
+ * http://www.opensource.org/licenses/mit-license.php
10
+ */
11
+
12
+ /* Overlay */
13
+ #eM-overlay {background-color:#000; cursor:wait;}
14
+
15
+ /* Container */
16
+ #eM-container {font: 16px/22px 'Trebuchet MS', Verdana, Arial; text-align:left; width:450px;}
17
+ .eM-content {background-color:#333; color:#ddd;}
18
+ .eM-title {color:#d76300; font-size:20px; line-height:20px; margin:0; padding:0 0 6px 12px; text-align:left;}
easy-modal.php ADDED
@@ -0,0 +1,452 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+
5
+ Plugin Name: Easy Modal
6
+
7
+ Plugin URI: http://wizardinternetsolutions.com/plugins/easy-modal/
8
+
9
+ Description: Easy Modal allows you to easily add just about any shortcodes or other content into a modal window. This includes forms such as CF7.
10
+
11
+ Author: Wizard Internet Solutions
12
+
13
+ Version: 0.9.0.2
14
+
15
+ Author URI: http://wizardinternetsolutions.com
16
+
17
+ */
18
+
19
+
20
+
21
+ add_action('wp_print_styles', 'easy_modal_styles');
22
+
23
+
24
+
25
+ function easy_modal_styles()
26
+
27
+ {
28
+
29
+ $em_plugin_url = trailingslashit( get_bloginfo('wpurl') ).PLUGINDIR.'/'. dirname( plugin_basename(__FILE__) );
30
+
31
+
32
+
33
+ if (!is_admin()) {
34
+
35
+ wp_enqueue_style('easy-modal-style', $em_plugin_url.'/css/easy-modal.css');
36
+
37
+ } else {
38
+
39
+ wp_enqueue_style('farbtastic');
40
+
41
+ }
42
+
43
+ }
44
+
45
+ add_action('wp_print_scripts', 'easy_modal_scripts');
46
+
47
+
48
+
49
+ function easy_modal_scripts()
50
+
51
+ {
52
+
53
+ global $eM;
54
+
55
+ $options = $eM->getAdminOptions();
56
+
57
+ $em_plugin_url = trailingslashit( get_bloginfo('wpurl') ).PLUGINDIR.'/'. dirname( plugin_basename(__FILE__) );
58
+
59
+
60
+
61
+ if (!is_admin()) {
62
+
63
+ wp_enqueue_script('jquery');
64
+
65
+ wp_enqueue_script('jquery-form', array('jquery'));
66
+
67
+ wp_enqueue_script('jquery-simplemodal', $em_plugin_url.'/js/jquery.simplemodal.js', array('jquery'));
68
+
69
+ wp_enqueue_script('easy-modal-script', $em_plugin_url.'/js/easy-modal.js', array('jquery','jquery-simplemodal'));
70
+
71
+ wp_localize_script( 'easy-modal-script', 'eMSettings', array(
72
+
73
+ 'plugin_url' => $em_plugin_url,
74
+
75
+ // Overlay Options
76
+
77
+ 'overlayId' => $options['overlayId'],
78
+
79
+ 'overlayColor' => $options['overlayColor'],
80
+
81
+ 'overlayCss' => $options['overlayCss'],
82
+
83
+ 'opacity' => $options['opacity'],
84
+
85
+ // Container Options
86
+
87
+ 'containerId' => $options['containerId'],
88
+
89
+ 'minHeight' => $options['minHeight'],
90
+
91
+ 'maxHeight' => $options['maxHeight'],
92
+
93
+ 'minWidth' => $options['minWidth'],
94
+
95
+ 'maxWidth' => $options['maxWidth'],
96
+
97
+ // Content Options
98
+
99
+ 'cf7form' => $options['cf7form'],
100
+
101
+
102
+
103
+ ));
104
+
105
+ } else {
106
+
107
+ wp_enqueue_script( 'farbtastic' );
108
+
109
+ }
110
+
111
+ }
112
+
113
+
114
+ class easy_modal {
115
+
116
+ var $adminOptionsName = "easy_modalOptions";
117
+
118
+ //Returns an array of admin options
119
+
120
+ function getAdminOptions() {
121
+
122
+ $easy_modalAdminOptions = array(
123
+
124
+ 'title' => '',
125
+
126
+ 'content' => '',
127
+
128
+ 'overlayId' => 'eM-overlay',
129
+
130
+ 'overlayColor' => '#000000',
131
+
132
+ 'opacity' => '50',
133
+
134
+ 'overlayCss' => '',
135
+
136
+ 'containerId' => 'eM-container',
137
+
138
+ 'minHeight' => '',
139
+
140
+ 'maxHeight' => '',
141
+
142
+ 'minWidth' => '',
143
+
144
+ 'maxWidth' => '',
145
+
146
+ 'cf7form' => false,
147
+
148
+ );
149
+
150
+ $eMOptions = get_option($this->adminOptionsName);
151
+
152
+ if (!empty($eMOptions)) {
153
+
154
+ foreach ($eMOptions as $key => $option)
155
+
156
+ $easy_modalAdminOptions[$key] = $option;
157
+
158
+ }
159
+
160
+ update_option($this->adminOptionsName, $easy_modalAdminOptions);
161
+
162
+ return $easy_modalAdminOptions;
163
+
164
+ }
165
+
166
+ // Plugin Initialization
167
+
168
+ function init() {
169
+
170
+ $this->getAdminOptions();
171
+
172
+ }
173
+
174
+ //Prints out the admin page
175
+
176
+ function printAdminPage() {
177
+
178
+ $eM_Options = $this->getAdminOptions();
179
+
180
+ if (isset($_POST['update_eM_settings'])) {
181
+
182
+ if (isset($_POST['eM_title'])) {
183
+
184
+ $eM_Options['title'] = apply_filters('content_save_pre', $_POST['eM_title']);
185
+
186
+ }
187
+
188
+ if (isset($_POST['eM_content'])) {
189
+
190
+ if(strstr($_POST['eM_content'],'[contact-form')!= NULL){ $eM_Options['cf7form'] = true; }
191
+
192
+ else { $eM_Options['cf7form'] = false; }
193
+
194
+ $eM_Options['content'] = $_POST['eM_content'];
195
+
196
+ }
197
+ // Validate Overlay Options
198
+ if (isset($_POST['eM_overlayId'])) {
199
+
200
+ $eM_Options['overlayId'] = $_POST['eM_overlayId'];
201
+
202
+ }
203
+
204
+ if (isset($_POST['eM_overlayColor'])) {
205
+
206
+ //hex color is valid
207
+
208
+ if(preg_match('/^#[a-f0-9]{6}$/i', $_POST['eM_overlayColor'])){
209
+
210
+ $eM_Options['overlayColor'] = $_POST['eM_overlayColor'];
211
+
212
+ }
213
+
214
+ }
215
+
216
+ if (isset($_POST['eM_opacity'])) {
217
+
218
+ if ($_POST['eM_opacity']>=0 && $_POST['eM_opacity']<=100){
219
+
220
+ $eM_Options['opacity'] = $_POST['eM_opacity'];
221
+
222
+ }
223
+
224
+ }
225
+
226
+ if (isset($_POST['eM_overlayCss'])) {
227
+
228
+ $eM_Options['overlayCss'] = $_POST['eM_overlayCss'];
229
+
230
+ }
231
+
232
+ if (isset($_POST['eM_overlayClose'])) {
233
+
234
+ $eM_Options['overlayClose'] = $_POST['eM_overlayClose'];
235
+
236
+ }
237
+ // Validate Container Options
238
+ if (isset($_POST['eM_containerId'])) {
239
+
240
+ $eM_Options['containerId'] = $_POST['eM_containerId'];
241
+
242
+ }
243
+
244
+ if (isset($_POST['eM_minHeight'])) {
245
+
246
+ $eM_Options['minHeight'] = $_POST['eM_minHeight'];
247
+
248
+ }
249
+
250
+ if (isset($_POST['eM_maxHeight'])) {
251
+
252
+ $eM_Options['maxHeight'] = $_POST['eM_maxHeight'];
253
+
254
+ }
255
+
256
+ if (isset($_POST['eM_minWidth'])) {
257
+
258
+ $eM_Options['minWidth'] = $_POST['eM_minWidth'];
259
+
260
+ }
261
+
262
+ if (isset($_POST['eM_maxWidth'])) {
263
+
264
+ $eM_Options['maxWidth'] = $_POST['eM_maxWidth'];
265
+
266
+ }
267
+
268
+ $eM_Options = stripslashes_deep($eM_Options);
269
+
270
+ update_option($this->adminOptionsName, $eM_Options);?>
271
+
272
+ <div class="updated"><p><strong><?php _e('Settings Updated','easy-modal')?>.</strong></p></div><?php
273
+
274
+ } ?>
275
+
276
+ <div id="poststuff" class="metabox-holder has-right-sidebar wrap" style="width:600px;">
277
+
278
+ <form method="post" action="<?php echo $_SERVER["REQUEST_URI"];?>">
279
+
280
+ <h2><?php _e('Easy Modal','easy-modal')?></h2>
281
+
282
+ <div class="postbox">
283
+
284
+ <h3><?php _e('Modal','easy-modal')?></h3>
285
+
286
+ <div class="inside">
287
+
288
+ <h4><?php _e('Title','easy-modal')?></h4>
289
+
290
+ <p><input type="text" name="eM_title" value="<?php echo $eM_Options['title'];?>" /></p>
291
+
292
+ <h4 style="display:inline-block;"><?php _e('Content','easy-modal');?></h4> - <h5 style="display:inline-block;"><?php _e('Can contain shortcodes','easy-modal')?></h5>
293
+
294
+ <p><textarea name="eM_content" style="width: 80%; height: 100px;"><?php echo $eM_Options['content']?></textarea></p>
295
+
296
+ </div>
297
+
298
+ </div>
299
+
300
+ <div class="postbox">
301
+
302
+ <h3><?php _e('Overlay Options','easy-modal')?></h3>
303
+
304
+ <div class="inside">
305
+
306
+ <h4><?php _e('CSS Id','easy-modal')?></h4>
307
+
308
+ <p><input type="text" name="eM_overlayId" value="<?php echo $eM_Options['overlayId']?>" /></p>
309
+
310
+ <h4><?php _e('Overlay Color', 'easy-modal');?></h4>
311
+
312
+ <p>
313
+ <input type="hidden" name="eM_overlayColor" value="<?php echo $eM_Options['overlayColor']?>" />
314
+ <div id="colorSelector" style="height:36px;position:relative;width:36px;">
315
+ <div style="background: url('<?php echo WP_PLUGIN_URL.'/'.str_replace(basename( __FILE__),"",plugin_basename(__FILE__)) ?>/images/admin/color_selector.png') no-repeat center center transparent;background-color:<?php echo $eM_Options['overlayColor']?>;height: 30px;left: 3px; position: absolute;top: 3px;width: 30px;"></div>
316
+ </div>
317
+ <script type="text/javascript">
318
+ jQuery(document).ready(function() {
319
+ jQuery('#colorSelector').ColorPicker({
320
+ color: '<?php echo $eM_Options['overlayColor']?>',
321
+ onShow: function (colpkr) {
322
+ jQuery(colpkr).fadeIn(500);
323
+ return false;
324
+ },
325
+ onHide: function (colpkr) {
326
+ jQuery(colpkr).fadeOut(500);
327
+ return false;
328
+ },
329
+ onChange: function (hsb, hex, rgb) {
330
+ jQuery('#colorSelector div').css('backgroundColor', '#' + hex);
331
+ jQuery('input[name=eM_overlayColor]').val('#' + hex);
332
+ }
333
+ });
334
+ });
335
+ </script>
336
+ </p>
337
+
338
+ <h4><?php _e('Opacity', 'easy-modal');?></h4>
339
+
340
+ <p><input type="text" name="eM_opacity" value="<?php echo $eM_Options['opacity']?>" /></p>
341
+
342
+ </div>
343
+
344
+ </div>
345
+
346
+ <div class="postbox">
347
+
348
+ <h3><?php _e('Container Options','easy-modal')?></h3>
349
+
350
+ <div class="inside">
351
+
352
+ <h4><?php _e('CSS Id','easy-modal')?></h4>
353
+
354
+ <p><input type="text" name="eM_containerId" value="<?php echo $eM_Options['containerId']?>" /></p>
355
+
356
+ <h4></h4>
357
+
358
+ <p></p>
359
+
360
+ <h4><?php _e('Height','easy-modal')?></h4>
361
+
362
+ <p><?php _e('Min','easy-modal')?>: <input type="text" name="eM_minHeight" value="<?php echo $eM_Options['minHeight']?>" /> <?php _e('Max','easy-modal')?>: <input type="text" name="eM_maxHeight" value="<?php echo $eM_Options['maxHeight']?>" /></p>
363
+
364
+ <h4><?php _e('Width','easy-modal')?></h4>
365
+
366
+ <p><?php _e('Min','easy-modal')?>: <input type="text" name="eM_minWidth" value="<?php echo $eM_Options['minWidth']?>" /> <?php _e('Max','easy-modal')?>: <input type="text" name="eM_maxWidth" value="<?php echo $eM_Options['maxWidth']?>" /></p>
367
+
368
+ </div>
369
+
370
+ </div>
371
+
372
+ <div class="submit">
373
+
374
+ <input type="submit" name="update_eM_settings" value="<?php _e('Update Settings','easy-modal')?>" />
375
+
376
+ </div>
377
+
378
+ </form>
379
+
380
+ </div><?php
381
+
382
+ }//End function printAdminPage()
383
+
384
+
385
+
386
+ }
387
+
388
+
389
+ //Initialize the admin panel
390
+ add_action('admin_menu', 'easy_modal_ap');
391
+
392
+ if (!function_exists("easy_modal_ap")) {
393
+
394
+ function easy_modal_ap() {
395
+
396
+ global $eM;
397
+
398
+ if (!isset($eM)) {
399
+
400
+ return;
401
+
402
+ }
403
+
404
+ if (function_exists('add_options_page')) {
405
+
406
+ add_options_page('Easy Modal', 'Easy Modal', 10, basename(__FILE__), array(&$eM, 'printAdminPage'));
407
+
408
+ }
409
+
410
+ }
411
+
412
+ }
413
+
414
+ // Display a Settings link on the main Plugins page
415
+
416
+ add_filter( 'plugin_action_links', 'easy_modal_plugin_action_links', 10, 2 );
417
+
418
+ function easy_modal_plugin_action_links( $links, $file ) {
419
+
420
+ if ( $file == plugin_basename( __FILE__ ) ) {
421
+
422
+ $posk_links = '<a href="'.get_admin_url().'options-general.php?page=easy-modal.php">'.__('Settings').'</a>';
423
+
424
+ // make the 'Settings' link appear first
425
+
426
+ array_unshift( $links, $posk_links );
427
+
428
+ }
429
+
430
+ return $links;
431
+
432
+ }
433
+
434
+
435
+ // Initialize i18n Support
436
+
437
+ add_action( 'init', 'easy_modal_i18n' );
438
+
439
+ if(!function_exists(easy_modal_i18n)){
440
+
441
+ function easy_modal_i18n() {
442
+
443
+ load_plugin_textdomain( 'easy-modal', false, 'easy-modal/languages' );
444
+
445
+ }
446
+
447
+ }
448
+
449
+ $eM = new easy_modal;
450
+ register_activation_hook(__FILE__, array(&$eM, 'init'));
451
+
452
+ ?>
images/admin/color_selector.png ADDED
Binary file
js/easy-modal.js ADDED
@@ -0,0 +1,475 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+
3
+ * Easy Modal
4
+
5
+ * http://wizardinternetsolutions.com/project/easy-modal/
6
+
7
+ */
8
+
9
+ eM_plugin_url = convertEntities(eMSettings.plugin_url);
10
+
11
+
12
+
13
+
14
+
15
+
16
+
17
+ eM_overlayId = convertEntities(eMSettings.overlayId);
18
+
19
+ eM_overlayColor = convertEntities(eMSettings.overlayColor);
20
+
21
+ eM_opacity = convertEntities(eMSettings.opacity);
22
+
23
+
24
+
25
+ eM_containerId = convertEntities(eMSettings.containerId);
26
+
27
+ eM_minHeight = convertEntities(eMSettings.minHeight);
28
+
29
+ eM_maxHeight = convertEntities(eMSettings.maxHeight);
30
+
31
+ eM_minWidth = convertEntities(eMSettings.minWidth);
32
+
33
+ eM_maxWidth = convertEntities(eMSettings.maxWidth);
34
+
35
+
36
+
37
+
38
+
39
+ eM_cf7form = convertEntities(eMSettings.cf7form);
40
+
41
+
42
+
43
+
44
+
45
+ jQuery(function ($) {
46
+
47
+ var contact = {
48
+
49
+ message: null,
50
+
51
+ init: function () {
52
+
53
+ $('.eModal').click(function (e) {
54
+
55
+ e.preventDefault();
56
+
57
+ // load the contact form using ajax
58
+
59
+
60
+
61
+ $.get("/wp-content/plugins/easy-modal/content/content.php?plugin_url=" + eM_plugin_url, function(data){
62
+
63
+ // create a modal dialog with the data
64
+
65
+ $(data).modal({
66
+
67
+ closeHTML: "<a href='#' title='Close' class='modal-close'>x</a>",
68
+
69
+ position: ["15%",],
70
+
71
+ overlayId: eM_overlayId,
72
+
73
+ overlayCss: {backgroundColor:eM_overlayColor},
74
+
75
+ opacity : eM_opacity,
76
+
77
+ containerId: eM_containerId,
78
+
79
+ minHeight: eM_minHeight,
80
+
81
+ maxHeight: eM_maxHeight,
82
+
83
+ minWidth: eM_minWidth,
84
+
85
+ maxWidth: eM_maxWidth,
86
+
87
+ onOpen: contact.open,
88
+
89
+ onShow: contact.show,
90
+
91
+ onClose: contact.close
92
+
93
+ });
94
+
95
+ });
96
+
97
+ });
98
+
99
+ },
100
+
101
+ open: function (dialog) {
102
+
103
+ // add padding to the buttons in firefox/mozilla
104
+
105
+ if ($.browser.mozilla) {
106
+
107
+ $('#eM-container .contact-button').css({
108
+
109
+ 'padding-bottom': '2px'
110
+
111
+ });
112
+
113
+ }
114
+
115
+ // input field font size
116
+
117
+ if ($.browser.safari) {
118
+
119
+ $('#eM-container .contact-input').css({
120
+
121
+ 'font-size': '.9em'
122
+
123
+ });
124
+
125
+ }
126
+
127
+
128
+
129
+ // dynamically determine height
130
+
131
+ var h = 280;
132
+
133
+ if ($('#eM-subject').length) {
134
+
135
+ h += 26;
136
+
137
+ }
138
+
139
+ if ($('#eM-cc').length) {
140
+
141
+ h += 22;
142
+
143
+ }
144
+
145
+
146
+
147
+ var title = $('#eM-container .contact-title').html();
148
+
149
+ $('#eM-container .contact-title').html('Loading...');
150
+
151
+ dialog.overlay.fadeIn(200, function () {
152
+
153
+ dialog.container.fadeIn(200, function () {
154
+
155
+ dialog.data.fadeIn(200, function () {
156
+
157
+ $('#eM-container .contact-content').animate({
158
+
159
+ height: h
160
+
161
+ }, function () {
162
+
163
+ $('#eM-container .contact-title').html(title);
164
+
165
+ $('#eM-container form').fadeIn(200, function () {
166
+
167
+ $('#eM-container #eM-name').focus();
168
+
169
+
170
+
171
+ $('#eM-container .contact-cc').click(function () {
172
+
173
+ var cc = $('#eM-container #eM-cc');
174
+
175
+ cc.is(':checked') ? cc.attr('checked', '') : cc.attr('checked', 'checked');
176
+
177
+ });
178
+
179
+
180
+
181
+ // fix png's for IE 6
182
+
183
+ if ($.browser.msie && $.browser.version < 7) {
184
+
185
+ $('#eM-container .contact-button').each(function () {
186
+
187
+ if ($(this).css('backgroundImage').match(/^url[("']+(.*\.png)[)"']+$/i)) {
188
+
189
+ var src = RegExp.$1;
190
+
191
+ $(this).css({
192
+
193
+ backgroundImage: 'none',
194
+
195
+ filter: 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="' + src + '", sizingMethod="crop")'
196
+
197
+ });
198
+
199
+ }
200
+
201
+ });
202
+
203
+ }
204
+
205
+ });
206
+
207
+ });
208
+
209
+ });
210
+
211
+ });
212
+
213
+ });
214
+
215
+ },
216
+
217
+ show: function (dialog) {
218
+
219
+ if(eM_cf7form == true){
220
+
221
+ $('div.wpcf7 > form').ajaxForm({
222
+
223
+
224
+
225
+ beforeSubmit: function(formData, jqForm, options) {
226
+
227
+
228
+
229
+ jqForm.wpcf7ClearResponseOutput();
230
+
231
+
232
+
233
+ jqForm.find('img.ajax-loader').css({ visibility: 'visible' });
234
+
235
+
236
+
237
+ return true;
238
+
239
+
240
+
241
+ },
242
+
243
+
244
+
245
+ beforeSerialize: function(jqForm, options) {
246
+
247
+
248
+
249
+ jqForm.find('.wpcf7-use-title-as-watermark.watermark').each(function(i, n) {
250
+
251
+
252
+
253
+ $(n).val('');
254
+
255
+
256
+
257
+ });
258
+
259
+
260
+
261
+ return true;
262
+
263
+
264
+
265
+ },
266
+
267
+
268
+
269
+ data: { '_wpcf7_is_ajax_call': 1 },
270
+
271
+
272
+
273
+ dataType: 'json',
274
+
275
+
276
+
277
+ success: function(data) {
278
+
279
+
280
+
281
+ var ro = $(data.into).find('div.wpcf7-response-output');
282
+
283
+
284
+
285
+ $(data.into).wpcf7ClearResponseOutput();
286
+
287
+
288
+
289
+
290
+
291
+
292
+
293
+ if (data.invalids) {
294
+
295
+
296
+
297
+ $.each(data.invalids, function(i, n) {
298
+
299
+
300
+
301
+ $(data.into).find(n.into).wpcf7NotValidTip(n.message);
302
+
303
+
304
+
305
+ });
306
+
307
+
308
+
309
+ ro.addClass('wpcf7-validation-errors');
310
+
311
+
312
+
313
+ }
314
+
315
+
316
+
317
+
318
+
319
+
320
+
321
+ if (data.captcha)
322
+
323
+
324
+
325
+ $(data.into).wpcf7RefillCaptcha(data.captcha);
326
+
327
+
328
+
329
+
330
+
331
+
332
+
333
+ if (data.quiz)
334
+
335
+
336
+
337
+ $(data.into).wpcf7RefillQuiz(data.quiz);
338
+
339
+
340
+
341
+
342
+
343
+
344
+
345
+ if (1 == data.spam)
346
+
347
+
348
+
349
+ ro.addClass('wpcf7-spam-blocked');
350
+
351
+
352
+
353
+
354
+
355
+
356
+
357
+ if (1 == data.mailSent) {
358
+
359
+
360
+
361
+ $(data.into).find('form').resetForm().clearForm();
362
+
363
+
364
+
365
+ ro.addClass('wpcf7-mail-sent-ok');
366
+
367
+
368
+
369
+
370
+
371
+
372
+
373
+ if (data.onSentOk)
374
+
375
+
376
+
377
+ $.each(data.onSentOk, function(i, n) { eval(n) });
378
+
379
+
380
+
381
+ } else {
382
+
383
+
384
+
385
+ ro.addClass('wpcf7-mail-sent-ng');
386
+
387
+
388
+
389
+ }
390
+
391
+
392
+
393
+
394
+
395
+
396
+
397
+ if (data.onSubmit)
398
+
399
+
400
+
401
+ $.each(data.onSubmit, function(i, n) { eval(n) });
402
+
403
+
404
+
405
+
406
+
407
+
408
+
409
+ $(data.into).find('.wpcf7-use-title-as-watermark.watermark').each(function(i, n) {
410
+
411
+
412
+
413
+ $(n).val($(n).attr('title'));
414
+
415
+
416
+
417
+ });
418
+
419
+
420
+
421
+
422
+
423
+
424
+
425
+ ro.append(data.message).slideDown('fast');
426
+
427
+
428
+
429
+ }
430
+
431
+
432
+
433
+ });
434
+
435
+ }
436
+
437
+ },
438
+
439
+ close: function (dialog) {
440
+
441
+ $('#eM-container').fadeOut();
442
+
443
+ $('#eM-container .eM-content').animate({
444
+
445
+ height: 40
446
+
447
+ }, function () {
448
+
449
+ dialog.data.fadeOut(200, function () {
450
+
451
+ dialog.container.fadeOut(200, function () {
452
+
453
+ dialog.overlay.fadeOut(200, function () {
454
+
455
+ $.modal.close();
456
+
457
+ });
458
+
459
+ });
460
+
461
+ });
462
+
463
+ });
464
+
465
+ },
466
+
467
+ };
468
+
469
+
470
+
471
+ contact.init();
472
+
473
+
474
+
475
+ });
js/jquery.simplemodal.js ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * SimpleModal 1.4.1 - jQuery Plugin
3
+ * http://www.ericmmartin.com/projects/simplemodal/
4
+ * Copyright (c) 2010 Eric Martin (http://twitter.com/ericmmartin)
5
+ * Dual licensed under the MIT and GPL licenses
6
+ * Revision: $Id: jquery.simplemodal.js 259 2010-11-05 05:53:13Z emartin24 $
7
+ */
8
+ (function(d){var k=d.browser.msie&&parseInt(d.browser.version)===6&&typeof window.XMLHttpRequest!=="object",m=d.browser.msie&&parseInt(d.browser.version)===7,l=null,f=[];d.modal=function(a,b){return d.modal.impl.init(a,b)};d.modal.close=function(){d.modal.impl.close()};d.modal.focus=function(a){d.modal.impl.focus(a)};d.modal.setContainerDimensions=function(){d.modal.impl.setContainerDimensions()};d.modal.setPosition=function(){d.modal.impl.setPosition()};d.modal.update=function(a,b){d.modal.impl.update(a,
9
+ b)};d.fn.modal=function(a){return d.modal.impl.init(this,a)};d.modal.defaults={appendTo:"body",focus:true,opacity:50,overlayId:"simplemodal-overlay",overlayCss:{},containerId:"simplemodal-container",containerCss:{},dataId:"simplemodal-data",dataCss:{},minHeight:null,minWidth:null,maxHeight:null,maxWidth:null,autoResize:false,autoPosition:true,zIndex:1E3,close:true,closeHTML:'<a class="modalCloseImg" title="Close"></a>',closeClass:"simplemodal-close",escClose:true,overlayClose:false,position:null,
10
+ persist:false,modal:true,onOpen:null,onShow:null,onClose:null};d.modal.impl={d:{},init:function(a,b){var c=this;if(c.d.data)return false;l=d.browser.msie&&!d.boxModel;c.o=d.extend({},d.modal.defaults,b);c.zIndex=c.o.zIndex;c.occb=false;if(typeof a==="object"){a=a instanceof jQuery?a:d(a);c.d.placeholder=false;if(a.parent().parent().size()>0){a.before(d("<span></span>").attr("id","simplemodal-placeholder").css({display:"none"}));c.d.placeholder=true;c.display=a.css("display");if(!c.o.persist)c.d.orig=
11
+ a.clone(true)}}else if(typeof a==="string"||typeof a==="number")a=d("<div></div>").html(a);else{alert("SimpleModal Error: Unsupported data type: "+typeof a);return c}c.create(a);c.open();d.isFunction(c.o.onShow)&&c.o.onShow.apply(c,[c.d]);return c},create:function(a){var b=this;f=b.getDimensions();if(b.o.modal&&k)b.d.iframe=d('<iframe src="javascript:false;"></iframe>').css(d.extend(b.o.iframeCss,{display:"none",opacity:0,position:"fixed",height:f[0],width:f[1],zIndex:b.o.zIndex,top:0,left:0})).appendTo(b.o.appendTo);
12
+ b.d.overlay=d("<div></div>").attr("id",b.o.overlayId).addClass("simplemodal-overlay").css(d.extend(b.o.overlayCss,{display:"none",opacity:b.o.opacity/100,height:b.o.modal?f[0]:0,width:b.o.modal?f[1]:0,position:"fixed",left:0,top:0,zIndex:b.o.zIndex+1})).appendTo(b.o.appendTo);b.d.container=d("<div></div>").attr("id",b.o.containerId).addClass("simplemodal-container").css(d.extend(b.o.containerCss,{display:"none",position:"fixed",zIndex:b.o.zIndex+2})).append(b.o.close&&b.o.closeHTML?d(b.o.closeHTML).addClass(b.o.closeClass):
13
+ "").appendTo(b.o.appendTo);b.d.wrap=d("<div></div>").attr("tabIndex",-1).addClass("simplemodal-wrap").css({height:"100%",outline:0,width:"100%"}).appendTo(b.d.container);b.d.data=a.attr("id",a.attr("id")||b.o.dataId).addClass("simplemodal-data").css(d.extend(b.o.dataCss,{display:"none"})).appendTo("body");b.setContainerDimensions();b.d.data.appendTo(b.d.wrap);if(k||l)b.fixIE()},bindEvents:function(){var a=this;d("."+a.o.closeClass).bind("click.simplemodal",function(b){b.preventDefault();a.close()});
14
+ a.o.modal&&a.o.close&&a.o.overlayClose&&a.d.overlay.bind("click.simplemodal",function(b){b.preventDefault();a.close()});d(document).bind("keydown.simplemodal",function(b){if(a.o.modal&&b.keyCode===9)a.watchTab(b);else if(a.o.close&&a.o.escClose&&b.keyCode===27){b.preventDefault();a.close()}});d(window).bind("resize.simplemodal",function(){f=a.getDimensions();a.o.autoResize?a.setContainerDimensions():a.o.autoPosition&&a.setPosition();if(k||l)a.fixIE();else if(a.o.modal){a.d.iframe&&a.d.iframe.css({height:f[0],
15
+ width:f[1]});a.d.overlay.css({height:f[0],width:f[1]})}})},unbindEvents:function(){d("."+this.o.closeClass).unbind("click.simplemodal");d(document).unbind("keydown.simplemodal");d(window).unbind("resize.simplemodal");this.d.overlay.unbind("click.simplemodal")},fixIE:function(){var a=this,b=a.o.position;d.each([a.d.iframe||null,!a.o.modal?null:a.d.overlay,a.d.container],function(c,h){if(h){var g=h[0].style;g.position="absolute";if(c<2){g.removeExpression("height");g.removeExpression("width");g.setExpression("height",
16
+ 'document.body.scrollHeight > document.body.clientHeight ? document.body.scrollHeight : document.body.clientHeight + "px"');g.setExpression("width",'document.body.scrollWidth > document.body.clientWidth ? document.body.scrollWidth : document.body.clientWidth + "px"')}else{var e;if(b&&b.constructor===Array){c=b[0]?typeof b[0]==="number"?b[0].toString():b[0].replace(/px/,""):h.css("top").replace(/px/,"");c=c.indexOf("%")===-1?c+' + (t = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"':
17
+ parseInt(c.replace(/%/,""))+' * ((document.documentElement.clientHeight || document.body.clientHeight) / 100) + (t = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"';if(b[1]){e=typeof b[1]==="number"?b[1].toString():b[1].replace(/px/,"");e=e.indexOf("%")===-1?e+' + (t = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft) + "px"':parseInt(e.replace(/%/,""))+' * ((document.documentElement.clientWidth || document.body.clientWidth) / 100) + (t = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft) + "px"'}}else{c=
18
+ '(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (t = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"';e='(document.documentElement.clientWidth || document.body.clientWidth) / 2 - (this.offsetWidth / 2) + (t = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft) + "px"'}g.removeExpression("top");g.removeExpression("left");g.setExpression("top",
19
+ c);g.setExpression("left",e)}}})},focus:function(a){var b=this;a=a&&d.inArray(a,["first","last"])!==-1?a:"first";var c=d(":input:enabled:visible:"+a,b.d.wrap);setTimeout(function(){c.length>0?c.focus():b.d.wrap.focus()},10)},getDimensions:function(){var a=d(window);return[d.browser.opera&&d.browser.version>"9.5"&&d.fn.jquery<"1.3"||d.browser.opera&&d.browser.version<"9.5"&&d.fn.jquery>"1.2.6"?a[0].innerHeight:a.height(),a.width()]},getVal:function(a,b){return a?typeof a==="number"?a:a==="auto"?0:
20
+ a.indexOf("%")>0?parseInt(a.replace(/%/,""))/100*(b==="h"?f[0]:f[1]):parseInt(a.replace(/px/,"")):null},update:function(a,b){var c=this;if(!c.d.data)return false;c.d.origHeight=c.getVal(a,"h");c.d.origWidth=c.getVal(b,"w");c.d.data.hide();a&&c.d.container.css("height",a);b&&c.d.container.css("width",b);c.setContainerDimensions();c.d.data.show();c.o.focus&&c.focus();c.unbindEvents();c.bindEvents()},setContainerDimensions:function(){var a=this,b=k||m,c=a.d.origHeight?a.d.origHeight:d.browser.opera?
21
+ a.d.container.height():a.getVal(b?a.d.container[0].currentStyle.height:a.d.container.css("height"),"h");b=a.d.origWidth?a.d.origWidth:d.browser.opera?a.d.container.width():a.getVal(b?a.d.container[0].currentStyle.width:a.d.container.css("width"),"w");var h=a.d.data.outerHeight(true),g=a.d.data.outerWidth(true);a.d.origHeight=a.d.origHeight||c;a.d.origWidth=a.d.origWidth||b;var e=a.o.maxHeight?a.getVal(a.o.maxHeight,"h"):null,i=a.o.maxWidth?a.getVal(a.o.maxWidth,"w"):null;e=e&&e<f[0]?e:f[0];i=i&&i<
22
+ f[1]?i:f[1];var j=a.o.minHeight?a.getVal(a.o.minHeight,"h"):"auto";c=c?a.o.autoResize&&c>e?e:c<j?j:c:h?h>e?e:a.o.minHeight&&j!=="auto"&&h<j?j:h:j;e=a.o.minWidth?a.getVal(a.o.minWidth,"w"):"auto";b=b?a.o.autoResize&&b>i?i:b<e?e:b:g?g>i?i:a.o.minWidth&&e!=="auto"&&g<e?e:g:e;a.d.container.css({height:c,width:b});a.d.wrap.css({overflow:h>c||g>b?"auto":"visible"});a.o.autoPosition&&a.setPosition()},setPosition:function(){var a=this,b,c;b=f[0]/2-a.d.container.outerHeight(true)/2;c=f[1]/2-a.d.container.outerWidth(true)/
23
+ 2;if(a.o.position&&Object.prototype.toString.call(a.o.position)==="[object Array]"){b=a.o.position[0]||b;c=a.o.position[1]||c}else{b=b;c=c}a.d.container.css({left:c,top:b})},watchTab:function(a){var b=this;if(d(a.target).parents(".simplemodal-container").length>0){b.inputs=d(":input:enabled:visible:first, :input:enabled:visible:last",b.d.data[0]);if(!a.shiftKey&&a.target===b.inputs[b.inputs.length-1]||a.shiftKey&&a.target===b.inputs[0]||b.inputs.length===0){a.preventDefault();b.focus(a.shiftKey?"last":
24
+ "first")}}else{a.preventDefault();b.focus()}},open:function(){var a=this;a.d.iframe&&a.d.iframe.show();if(d.isFunction(a.o.onOpen))a.o.onOpen.apply(a,[a.d]);else{a.d.overlay.show();a.d.container.show();a.d.data.show()}a.o.focus&&a.focus();a.bindEvents()},close:function(){var a=this;if(!a.d.data)return false;a.unbindEvents();if(d.isFunction(a.o.onClose)&&!a.occb){a.occb=true;a.o.onClose.apply(a,[a.d])}else{if(a.d.placeholder){var b=d("#simplemodal-placeholder");if(a.o.persist)b.replaceWith(a.d.data.removeClass("simplemodal-data").css("display",
25
+ a.display));else{a.d.data.hide().remove();b.replaceWith(a.d.orig)}}else a.d.data.hide().remove();a.d.container.hide().remove();a.d.overlay.hide();a.d.iframe&&a.d.iframe.hide().remove();setTimeout(function(){a.d.overlay.remove();a.d={}},10)}}}})(jQuery);
readme.txt ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Easy Modal ===
2
+ Contributors: danieliser
3
+ Donate link: http://wizardinternetsolutions.com/
4
+ Tags: modal, contact form 7, ajax
5
+ Requires at least: 3.0.1
6
+ Tested up to: 3.1.3
7
+ Stable tag: 0.9.0.2
8
+
9
+ This plugin allows you to easily add a Modal window with just about any content. It accepts shortcodes and has been tested to work with Contact Form 7 custom forms using ajax submission.
10
+
11
+ == Description ==
12
+
13
+ This plugin allows you to easily add a Modal window with just about any content. It accepts shortcodes and has been tested to work with Contact Form 7 custom forms using ajax submission.
14
+
15
+ If you like the plugin please rate it.
16
+
17
+
18
+ [easyModal Page](http://wizardinternetsolutions.com/plugins/easy-modal/ "easyModal Page - Info, Demo and Discussion") - Info, Demo and Feature Discussion
19
+
20
+ [Wizard Internet Solutions](http://wizardinternetsolutions.com/ "Website Design & Development") - Developers Site
21
+
22
+ == Installation ==
23
+
24
+ 1. Upload `easy-Modal` folder to the `/wp-content/plugins/` directory
25
+ 2. Activate the plugin through the 'Plugins' menu in WordPress
26
+ 3. Add `eModal` class to the object you want to make activate the modal window. Will work on divs, links, list elements and just about anything else.
27
+
28
+ == Frequently Asked Questions ==
29
+
30
+ = Does this work with CF7 =
31
+
32
+ Yes, this will work with any custom form shortcode and uses ajax submit features.
33
+
34
+ = Is the form styled =
35
+
36
+ We have only included some basic styling for the modal at this point. We will be adding more features to customize the look and feel of the plugin and modal windows in upcoming versions. For now you can add styles to your themes styles.css or add them to the head via plugin.
37
+
38
+ == Screenshots ==
39
+
40
+ 1. easy-Modal Example used on our site.
41
+
42
+ == Changelog ==
43
+
44
+ = 0.9.0.2 =
45
+ * Added Overlay Color Picker.
46
+
47
+ = 0.9.0.1 =
48
+ * Added Height & Width options.
49
+
50
+ = 0.9 =
51
+ * Initial Release
52
+
53
+
54
+ == Upgrade Notice ==
55
+
56
+ = 0.9 =
57
+ * Initial Release