WP User Frontend – Membership, Profile, Registration & Post Submission Plugin for WordPress - Version 2.4

Version Description

Download this release

Release Info

Developer sohelamin
Plugin Icon 128x128 WP User Frontend – Membership, Profile, Registration & Post Submission Plugin for WordPress
Version 2.4
Comparing to
See all releases

Version 2.4

Files changed (89) hide show
  1. .gitignore +11 -0
  2. .svnignore +6 -0
  3. admin/add-ons.php +100 -0
  4. admin/form-template.php +214 -0
  5. admin/form.php +1643 -0
  6. admin/html/modal.php +105 -0
  7. admin/installer.php +310 -0
  8. admin/posting.php +267 -0
  9. admin/settings-options.php +426 -0
  10. admin/settings.php +228 -0
  11. admin/subscription.php +610 -0
  12. admin/template-post.php +306 -0
  13. admin/template.php +651 -0
  14. admin/tools.php +445 -0
  15. admin/transaction.php +227 -0
  16. assets/css/admin.css +154 -0
  17. assets/css/chosen/chosen-sprite.png +0 -0
  18. assets/css/chosen/chosen-sprite@2x.png +0 -0
  19. assets/css/chosen/chosen.css +436 -0
  20. assets/css/formbuilder.css +343 -0
  21. assets/css/formbuilder.less +423 -0
  22. assets/css/frontend-forms.css +957 -0
  23. assets/css/frontend-forms.less +1032 -0
  24. assets/css/images/ui-bg_diagonals-small_75_cccccc_40x40.png +0 -0
  25. assets/css/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  26. assets/css/images/ui-bg_flat_0_ffffff_40x100.png +0 -0
  27. assets/css/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  28. assets/css/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  29. assets/css/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  30. assets/css/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  31. assets/css/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  32. assets/css/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  33. assets/css/images/ui-icons_222222_256x240.png +0 -0
  34. assets/css/images/ui-icons_2e83ff_256x240.png +0 -0
  35. assets/css/images/ui-icons_454545_256x240.png +0 -0
  36. assets/css/images/ui-icons_888888_256x240.png +0 -0
  37. assets/css/images/ui-icons_cd0a0a_256x240.png +0 -0
  38. assets/css/jquery-ui-1.9.1.custom.css +461 -0
  39. assets/css/jquery.smallipop.css +117 -0
  40. assets/css/wpuf.css +467 -0
  41. assets/images/add.png +0 -0
  42. assets/images/arrow-move.png +0 -0
  43. assets/images/arrows.png +0 -0
  44. assets/images/cross.png +0 -0
  45. assets/images/del.png +0 -0
  46. assets/images/delete.png +0 -0
  47. assets/images/edit.png +0 -0
  48. assets/images/help.png +0 -0
  49. assets/images/no-image.png +0 -0
  50. assets/images/paypal.png +0 -0
  51. assets/images/remove.png +0 -0
  52. assets/images/tick.png +0 -0
  53. assets/images/wpspin_light.gif +0 -0
  54. assets/js/chosen.jquery.js +1211 -0
  55. assets/js/conditional-logic.js +123 -0
  56. assets/js/conditional.js +321 -0
  57. assets/js/countries.json +245 -0
  58. assets/js/formbuilder.js +398 -0
  59. assets/js/formbuilder.min.js +1 -0
  60. assets/js/frontend-form.js +866 -0
  61. assets/js/frontend-form.min.js +1 -0
  62. assets/js/jquery-ui-timepicker-addon.js +1919 -0
  63. assets/js/jquery.smallipop-0.4.0.min.js +9 -0
  64. assets/js/jquery.validate.min.js +4 -0
  65. assets/js/subscriptions.js +306 -0
  66. assets/js/upload.js +214 -0
  67. assets/js/upload.min.js +1 -0
  68. class/frontend-dashboard.php +145 -0
  69. class/frontend-form-post.php +786 -0
  70. class/payment.php +414 -0
  71. class/post-form-template.php +128 -0
  72. class/post-form-templates/post.php +156 -0
  73. class/render-form.php +1453 -0
  74. class/subscription.php +1094 -0
  75. class/upgrades.php +105 -0
  76. class/upload.php +203 -0
  77. includes/countries.php +249 -0
  78. includes/free/edit-profile.php +318 -0
  79. includes/free/edit-user.php +251 -0
  80. includes/free/form.php +485 -0
  81. includes/free/loader.php +232 -0
  82. includes/free/post-form-templates/woocommerce.php +305 -0
  83. includes/free/prompt.php +21 -0
  84. includes/free/subscription.php +20 -0
  85. languages/readme.txt +5 -0
  86. languages/wpuf-fa_IR.mo +0 -0
  87. languages/wpuf-fa_IR.po +2593 -0
  88. languages/wpuf-zh_CN.mo +0 -0
  89. languages/wpuf-zh_CN.po +2517 -0
.gitignore ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ .DS_Store
2
+ plugin-deploy.sh
3
+ config.codekit
4
+ export.sh
5
+ .idea
6
+ /.DS_Store
7
+ nbproject
8
+ node_modules
9
+ includes/pro
10
+ build
11
+ secret.json
.svnignore ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ includes/pro
2
+ nbproject
3
+ Gruntfile.js
4
+ package.json
5
+ docs.md
6
+ changelog.txt
admin/add-ons.php ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="wrap">
2
+ <h2><?php _e( 'WP User Frontend - Add-Ons', 'wpuf' ); ?></h2>
3
+
4
+ <?php
5
+ $add_ons = get_transient( 'wpuf_addons' );
6
+
7
+ if ( false === $add_ons ) {
8
+ $response = wp_remote_get( 'https://wedevs.com/api/wpuf/addons.php', array('timeout' => 15) );
9
+ $update = wp_remote_retrieve_body( $response );
10
+
11
+ if ( is_wp_error( $response ) || $response['response']['code'] != 200 ) {
12
+ return false;
13
+ }
14
+
15
+ set_transient( 'wpuf_addons', $update, 12 * HOUR_IN_SECONDS );
16
+ $add_ons = $update;
17
+ }
18
+
19
+ $add_ons = json_decode( $add_ons );
20
+
21
+ if ( count( $add_ons ) ) {
22
+ foreach ($add_ons as $addon) {
23
+ ?>
24
+
25
+ <div class="wpuf-addon">
26
+ <div class="wpuf-addon-thumb">
27
+ <a href="<?php echo $addon->url; ?>" target="_blank">
28
+ <img src="<?php echo $addon->thumbnail; ?>" alt="<?php echo esc_attr( $addon->title ); ?>" />
29
+ </a>
30
+ </div>
31
+
32
+ <div class="wpuf-detail">
33
+ <h3 class="title">
34
+ <a href="<?php echo $addon->url; ?>" target="_blank"><?php echo $addon->title; ?></a>
35
+ </h3>
36
+
37
+ <div class="text"><?php echo $addon->desc; ?></div>
38
+ </div>
39
+
40
+ <div class="wpuf-links">
41
+ <?php if ( class_exists( $addon->class ) ) { ?>
42
+ <a class="button button-disabled" href="<?php echo $addon->url; ?>" target="_blank">Installed</a>
43
+ <?php } else { ?>
44
+ <a class="button" href="<?php echo $addon->url; ?>" target="_blank">View Details</a>
45
+ <?php } ?>
46
+ </div>
47
+ </div>
48
+
49
+ <?php
50
+ }
51
+ } else {
52
+ echo '<div class="error"><p>Error fetching add-ons. Please refresh the page again.</p></div>';
53
+ }
54
+ ?>
55
+
56
+ <style type="text/css">
57
+ .wpuf-addon {
58
+ width: 22%;
59
+ float: left;
60
+ margin: 10px;
61
+ border: 1px solid #E6E6E6;
62
+ }
63
+
64
+ .wpuf-addon:nth-child(5n+1) {
65
+ clear: both;
66
+ }
67
+
68
+ .wpuf-addon-thumb img {
69
+ max-width: 100%;
70
+ /*max-height: 140px;*/
71
+ }
72
+
73
+ .wpuf-detail {
74
+ padding: 6px 10px 10px;
75
+ min-height: 110px;
76
+ background: #fff;
77
+ }
78
+
79
+ .wpuf-detail h3.title {
80
+ margin: 5px 0 10px;
81
+ padding: 0;
82
+ }
83
+
84
+ .wpuf-detail h3.title a {
85
+ text-decoration: none;
86
+ color: #111;
87
+ }
88
+
89
+ .wpuf-links {
90
+ padding: 10px;
91
+ background: #F5F5F5;
92
+ border-top: 1px solid #E6E6E6;
93
+ }
94
+
95
+ a.button.disabled {
96
+ background: #eee;
97
+ }
98
+ </style>
99
+
100
+ </div>
admin/form-template.php ADDED
@@ -0,0 +1,214 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Admin form template handler
5
+ *
6
+ * Create forms based on form templates
7
+ *
8
+ * @since 2.4
9
+ */
10
+ class WPUF_Admin_Form_Template {
11
+
12
+ public function __construct() {
13
+ add_action( 'admin_enqueue_scripts', array($this, 'enqueue_scripts') );
14
+
15
+ // post form templates
16
+ add_action( 'admin_footer', array( $this, 'render_post_form_templates' ) );
17
+ add_filter( 'admin_action_wpuf_post_form_template', array( $this, 'create_post_form_from_template' ) );
18
+
19
+ // form settings
20
+ add_action( 'wpuf_form_setting', array( $this, 'post_form_settings' ), 8, 2 );
21
+
22
+ // frontend insert/update
23
+ add_action( 'wpuf_add_post_after_insert', array( $this, 'post_form_submission' ), 10, 3 );
24
+ add_action( 'wpuf_edit_post_after_update', array( $this, 'post_form_submission' ), 10, 3 );
25
+ }
26
+
27
+ /**
28
+ * Should a form displayed or sciprt enqueued?
29
+ *
30
+ * @return boolean
31
+ */
32
+ public function should_display() {
33
+ $current_screen = get_current_screen();
34
+
35
+ if ( in_array( $current_screen->id, array( 'edit-wpuf_forms', 'wpuf_forms' ) ) ) {
36
+ return true;
37
+ }
38
+
39
+ return false;
40
+ }
41
+
42
+ public function enqueue_scripts() {
43
+ if ( ! $this->should_display() ) {
44
+ return;
45
+ }
46
+
47
+ wp_enqueue_style( 'wpuf-formbuilder', WPUF_ASSET_URI . '/css/formbuilder.css' );
48
+ }
49
+
50
+ /**
51
+ * Render the forms in the modal
52
+ *
53
+ * @return void
54
+ */
55
+ public function render_post_form_templates() {
56
+ if ( ! $this->should_display() ) {
57
+ return;
58
+ }
59
+
60
+ $registry = wpuf_get_post_form_templates();
61
+
62
+ if ( ! $registry ) {
63
+ return;
64
+ }
65
+
66
+ include dirname( __FILE__ ) . '/html/modal.php';
67
+ }
68
+
69
+ /**
70
+ * Get a template object by name from the registry
71
+ *
72
+ * @param string $template
73
+ *
74
+ * @return boolean|WPUF_Post_Form_Template
75
+ */
76
+ public function get_template_object( $template ) {
77
+ $registry = wpuf_get_post_form_templates();
78
+
79
+ if ( ! array_key_exists( $template, $registry ) ) {
80
+ return false;
81
+ }
82
+
83
+ $template_object = $registry[ $template ];
84
+
85
+ if ( ! is_a( $template_object, 'WPUF_Post_Form_Template') ) {
86
+ return false;
87
+ }
88
+
89
+ return $template_object;
90
+ }
91
+
92
+ /**
93
+ * Create a posting form from a post template
94
+ *
95
+ * @since 2.4
96
+ *
97
+ * @return void
98
+ */
99
+ public function create_post_form_from_template() {
100
+ check_admin_referer( 'wpuf_create_from_template' );
101
+
102
+ $template_name = isset( $_GET['template'] ) ? sanitize_text_field( $_GET['template'] ) : '';
103
+
104
+ if ( ! $template_name ) {
105
+ return;
106
+ }
107
+
108
+ $template_object = $this->get_template_object( $template_name );
109
+
110
+ if ( false === $template_object ) {
111
+ return;
112
+ }
113
+
114
+ // var_dump( $template_object ); die();
115
+ $current_user = get_current_user_id();
116
+
117
+ $form_post_data = array(
118
+ 'post_title' => $template_object->get_title(),
119
+ 'post_type' => 'wpuf_forms',
120
+ 'post_status' => 'publish',
121
+ 'post_author' => $current_user
122
+ );
123
+
124
+ $form_id = wp_insert_post( $form_post_data );
125
+
126
+ if ( is_wp_error( $form_id ) ) {
127
+ return;
128
+ }
129
+
130
+ // form has been created, lets setup
131
+ update_post_meta( $form_id, 'wpuf_form_settings', $template_object->get_form_settings() );
132
+
133
+ $form_fields = $template_object->get_form_fields();
134
+
135
+ if ( ! $form_fields ) {
136
+ return;
137
+ }
138
+
139
+ foreach ($form_fields as $menu_order => $field) {
140
+ wp_insert_post( array(
141
+ 'post_type' => 'wpuf_input',
142
+ 'post_status' => 'publish',
143
+ 'post_content' => maybe_serialize( $field ),
144
+ 'post_parent' => $form_id,
145
+ 'menu_order' => $menu_order
146
+ ) );
147
+ }
148
+
149
+ wp_redirect( admin_url( 'post.php?post=' . $form_id . '&action=edit&message=11') );
150
+ exit;
151
+ }
152
+
153
+ /**
154
+ * Add settings field to override a form template
155
+ *
156
+ * @param array $form_settings
157
+ * @param object $post
158
+ *
159
+ * @return void
160
+ */
161
+ public function post_form_settings( $form_settings, $post ) {
162
+ $registry = wpuf_get_post_form_templates();
163
+ $selected = isset( $form_settings['form_template'] ) ? $form_settings['form_template'] : '';
164
+ ?>
165
+ <tr>
166
+ <th><?php _e( 'Form Template', 'wpuf' ); ?></th>
167
+ <td>
168
+ <select name="wpuf_settings[form_template]">
169
+ <option value=""><?php echo __( '&mdash; No Template &mdash;', 'wpuf' ); ?></option>
170
+ <?php
171
+ if ( $registry ) {
172
+ foreach ($registry as $key => $template) {
173
+ printf( '<option value="%s"%s>%s</option>' . "\n", $key, selected( $selected, $key, false ), $template->get_title() );
174
+ }
175
+ }
176
+ ?>
177
+ </select>
178
+ <p class="description"><?php _e( 'If selected a form template, it will try to execute that integration options when new post created and updated.', 'wpuf' ); ?></p>
179
+ </td>
180
+ </tr>
181
+ <?php
182
+ }
183
+
184
+ /**
185
+ * Call the integration functions on form submission/update
186
+ *
187
+ * @param int $post_id
188
+ * @param int $form_id
189
+ * @param array $form_settings
190
+ *
191
+ * @return void
192
+ */
193
+ public function post_form_submission( $post_id, $form_id, $form_settings ) {
194
+ $template = isset( $form_settings['form_template'] ) ? $form_settings['form_template'] : '';
195
+
196
+ if ( !$template ) {
197
+ return;
198
+ }
199
+
200
+ $template_object = $this->get_template_object( $template );
201
+
202
+ if ( false === $template_object ) {
203
+ return;
204
+ }
205
+
206
+ $current_action = current_action();
207
+
208
+ if ( $current_action == 'wpuf_add_post_after_insert' ) {
209
+ $template_object->after_insert( $post_id, $form_id, $form_settings );
210
+ } elseif ( $current_action == 'wpuf_edit_post_after_update' ) {
211
+ $template_object->after_update( $post_id, $form_id, $form_settings );
212
+ }
213
+ }
214
+ }
admin/form.php ADDED
@@ -0,0 +1,1643 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Admin Form UI Builder
4
+ *
5
+ * @package WP User Frontend
6
+ */
7
+
8
+
9
+ class WPUF_Admin_Form {
10
+
11
+ private $form_data_key = 'wpuf_form';
12
+ private $form_settings_key = 'wpuf_form_settings';
13
+
14
+ /**
15
+ * Add neccessary actions and filters
16
+ *
17
+ * @return void
18
+ */
19
+ function __construct() {
20
+ add_action( 'init', array($this, 'register_post_type') );
21
+ add_filter( 'post_updated_messages', array($this, 'form_updated_message') );
22
+
23
+ add_action( 'admin_enqueue_scripts', array($this, 'enqueue_scripts') );
24
+ add_action( 'admin_footer-edit.php', array($this, 'add_form_button_style') );
25
+ add_action( 'admin_footer-post.php', array($this, 'add_form_button_style') );
26
+
27
+ add_action( 'admin_head', array( $this, 'menu_icon' ) );
28
+
29
+ // form duplication
30
+ add_filter( 'post_row_actions', array( $this, 'row_action_duplicate' ), 10, 2 );
31
+ add_filter( 'admin_action_wpuf_duplicate', array( $this, 'duplicate_form' ) );
32
+
33
+ // meta boxes
34
+ add_action( 'add_meta_boxes', array($this, 'add_meta_box_form_select') );
35
+ add_action( 'add_meta_boxes_wpuf_forms', array($this, 'add_meta_box_post') );
36
+ add_action( 'add_meta_boxes_wpuf_profile', array($this, 'add_meta_box_profile') );
37
+
38
+ // custom columns
39
+ add_filter( 'manage_edit-wpuf_forms_columns', array( $this, 'admin_column' ) );
40
+ add_filter( 'manage_edit-wpuf_profile_columns', array( $this, 'admin_column_profile' ) );
41
+ add_action( 'manage_wpuf_forms_posts_custom_column', array( $this, 'admin_column_value' ), 10, 2 );
42
+ add_action( 'manage_wpuf_profile_posts_custom_column', array( $this, 'admin_column_value_profile' ), 10, 2 );
43
+ add_filter( 'post_row_actions', array( $this, 'remove_quick_edit' ) );
44
+
45
+ // ajax actions for post forms
46
+ add_action( 'wp_ajax_wpuf_form_dump', array( $this, 'form_dump' ) );
47
+ add_action( 'wp_ajax_wpuf_form_add_el', array( $this, 'ajax_post_add_element' ) );
48
+
49
+ add_action( 'save_post', array( $this, 'save_form_meta' ), 1, 3 ); // save the custom fields
50
+ add_action( 'save_post', array( $this, 'form_selection_metabox_save' ), 1, 2 ); // save the custom fields
51
+
52
+
53
+ }
54
+
55
+ function remove_quick_edit( $actions ) {
56
+ global $current_screen;
57
+
58
+ if ( ! $current_screen ) {
59
+ return $actions;
60
+ }
61
+
62
+ if ( $current_screen->post_type == 'wpuf_forms' || $current_screen->post_type == 'wpuf_profile' ) {
63
+ unset( $actions['inline hide-if-no-js'] );
64
+ }
65
+
66
+ return $actions;
67
+ }
68
+
69
+ public static function insert_form_field( $form_id, $fields = array(), $field_id = null, $order = 0 ) {
70
+
71
+ $args = array(
72
+ 'post_type' => 'wpuf_input',
73
+ 'post_parent' => $form_id,
74
+ 'post_status' => 'publish',
75
+ 'post_content' => maybe_serialize( wp_unslash( $fields ) ),
76
+ 'menu_order' => $order
77
+ );
78
+
79
+ if ( $field_id ) {
80
+ $args['ID'] = $field_id;
81
+ }
82
+
83
+ if ( $field_id ) {
84
+ wp_update_post( $args );
85
+ } else {
86
+ wp_insert_post( $args );
87
+ }
88
+ }
89
+
90
+ /**
91
+ * Enqueue scripts and styles for form builder
92
+ *
93
+ * @global string $pagenow
94
+ * @return void
95
+ */
96
+ function enqueue_scripts() {
97
+ global $pagenow, $post;
98
+
99
+ if ( !in_array( $pagenow, array( 'post.php', 'post-new.php') ) ) {
100
+ return;
101
+ }
102
+
103
+ wp_enqueue_script( 'jquery-ui-autocomplete' );
104
+
105
+ if ( !in_array( $post->post_type, array( 'wpuf_forms', 'wpuf_profile' ) ) ) {
106
+ return;
107
+ }
108
+
109
+ // scripts
110
+ wp_enqueue_script( 'jquery-smallipop', WPUF_ASSET_URI . '/js/jquery.smallipop-0.4.0.min.js', array('jquery') );
111
+ wp_enqueue_script( 'wpuf-formbuilder-script', WPUF_ASSET_URI . '/js/formbuilder.js', array('jquery', 'jquery-ui-sortable') );
112
+ wp_enqueue_script( 'wpuf-conditional-script', WPUF_ASSET_URI . '/js/conditional.js' );
113
+
114
+ // styles
115
+ wp_enqueue_style( 'jquery-smallipop', WPUF_ASSET_URI . '/css/jquery.smallipop.css' );
116
+ wp_enqueue_style( 'wpuf-formbuilder', WPUF_ASSET_URI . '/css/formbuilder.css' );
117
+ wp_enqueue_style( 'jquery-ui-core', WPUF_ASSET_URI . '/css/jquery-ui-1.9.1.custom.css' );
118
+ }
119
+
120
+ function add_form_button_style() {
121
+ global $pagenow, $post_type;
122
+
123
+ if ( !in_array( $post_type, array( 'wpuf_forms', 'wpuf_profile') ) ) {
124
+ return;
125
+ }
126
+
127
+ $fixed_sidebar = wpuf_get_option( 'fixed_form_element', 'wpuf_general' );
128
+ ?>
129
+ <style type="text/css">
130
+ .wrap .add-new-h2, .wrap .add-new-h2:active {
131
+ background: #21759b;
132
+ color: #fff;
133
+ text-shadow: 0 1px 1px #446E81;
134
+ }
135
+
136
+ <?php if ( $fixed_sidebar == 'on' ) { ?>
137
+ #wpuf-metabox-fields{
138
+ position: fixed;
139
+ bottom: 10px;
140
+ }
141
+ <?php } ?>
142
+ </style>
143
+ <?php
144
+ }
145
+
146
+ /**
147
+ * Register form post types
148
+ *
149
+ * @return void
150
+ */
151
+ function register_post_type() {
152
+ $capability = wpuf_admin_role();
153
+
154
+ register_post_type( 'wpuf_forms', array(
155
+ 'label' => __( 'Forms', 'wpuf' ),
156
+ 'public' => false,
157
+ 'show_ui' => true,
158
+ 'show_in_menu' => 'wpuf-admin-opt', //false,
159
+ 'capability_type' => 'post',
160
+ 'hierarchical' => false,
161
+ 'query_var' => false,
162
+ 'supports' => array('title'),
163
+ 'capabilities' => array(
164
+ 'publish_posts' => $capability,
165
+ 'edit_posts' => $capability,
166
+ 'edit_others_posts' => $capability,
167
+ 'delete_posts' => $capability,
168
+ 'delete_others_posts' => $capability,
169
+ 'read_private_posts' => $capability,
170
+ 'edit_post' => $capability,
171
+ 'delete_post' => $capability,
172
+ 'read_post' => $capability,
173
+ ),
174
+ 'labels' => array(
175
+ 'name' => __( 'Forms', 'wpuf' ),
176
+ 'singular_name' => __( 'Form', 'wpuf' ),
177
+ 'menu_name' => __( 'Forms', 'wpuf' ),
178
+ 'add_new' => __( 'Add Form', 'wpuf' ),
179
+ 'add_new_item' => __( 'Add New Form', 'wpuf' ),
180
+ 'edit' => __( 'Edit', 'wpuf' ),
181
+ 'edit_item' => __( 'Edit Form', 'wpuf' ),
182
+ 'new_item' => __( 'New Form', 'wpuf' ),
183
+ 'view' => __( 'View Form', 'wpuf' ),
184
+ 'view_item' => __( 'View Form', 'wpuf' ),
185
+ 'search_items' => __( 'Search Form', 'wpuf' ),
186
+ 'not_found' => __( 'No Form Found', 'wpuf' ),
187
+ 'not_found_in_trash' => __( 'No Form Found in Trash', 'wpuf' ),
188
+ 'parent' => __( 'Parent Form', 'wpuf' ),
189
+ ),
190
+ ) );
191
+
192
+ register_post_type( 'wpuf_profile', array(
193
+ 'label' => __( 'Registraton Forms', 'wpuf' ),
194
+ 'public' => false,
195
+ 'show_ui' => true,
196
+ 'show_in_menu' => false,
197
+ 'capability_type' => 'post',
198
+ 'hierarchical' => false,
199
+ 'query_var' => false,
200
+ 'supports' => array('title'),
201
+ 'capabilities' => array(
202
+ 'publish_posts' => $capability,
203
+ 'edit_posts' => $capability,
204
+ 'edit_others_posts' => $capability,
205
+ 'delete_posts' => $capability,
206
+ 'delete_others_posts' => $capability,
207
+ 'read_private_posts' => $capability,
208
+ 'edit_post' => $capability,
209
+ 'delete_post' => $capability,
210
+ 'read_post' => $capability,
211
+ ),
212
+ 'labels' => array(
213
+ 'name' => __( 'Forms', 'wpuf' ),
214
+ 'singular_name' => __( 'Form', 'wpuf' ),
215
+ 'menu_name' => __( 'Registration Forms', 'wpuf' ),
216
+ 'add_new' => __( 'Add Form', 'wpuf' ),
217
+ 'add_new_item' => __( 'Add New Form', 'wpuf' ),
218
+ 'edit' => __( 'Edit', 'wpuf' ),
219
+ 'edit_item' => __( 'Edit Form', 'wpuf' ),
220
+ 'new_item' => __( 'New Form', 'wpuf' ),
221
+ 'view' => __( 'View Form', 'wpuf' ),
222
+ 'view_item' => __( 'View Form', 'wpuf' ),
223
+ 'search_items' => __( 'Search Form', 'wpuf' ),
224
+ 'not_found' => __( 'No Form Found', 'wpuf' ),
225
+ 'not_found_in_trash' => __( 'No Form Found in Trash', 'wpuf' ),
226
+ 'parent' => __( 'Parent Form', 'wpuf' ),
227
+ ),
228
+ ) );
229
+
230
+ register_post_type( 'wpuf_input', array(
231
+ 'public' => false,
232
+ 'show_ui' => false,
233
+ 'show_in_menu' => false,
234
+ ) );
235
+ }
236
+
237
+ /**
238
+ * Custom post update message
239
+ *
240
+ * @param array $messages
241
+ * @return array
242
+ */
243
+ function form_updated_message( $messages ) {
244
+ $message = array(
245
+ 0 => '',
246
+ 1 => __( 'Form updated.', 'wpuf' ),
247
+ 2 => __( 'Custom field updated.', 'wpuf' ),
248
+ 3 => __( 'Custom field deleted.', 'wpuf' ),
249
+ 4 => __( 'Form updated.', 'wpuf' ),
250
+ 5 => isset($_GET['revision']) ? sprintf( __('Form restored to revision from %s', 'wpuf'), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
251
+ 6 => __( 'Form published.', 'wpuf'),
252
+ 7 => __( 'Form saved.', 'wpuf' ),
253
+ 8 => __( 'Form submitted.', 'wpuf' ),
254
+ 9 => '',
255
+ 10 => __( 'Form draft updated.', 'wpuf' ),
256
+ 11 => __( 'Successfully created from the form template.', 'wpuf' ),
257
+ );
258
+
259
+ $messages['wpuf_forms'] = $message;
260
+ $messages['wpuf_profile'] = $message;
261
+
262
+ return $messages;
263
+ }
264
+
265
+ function menu_icon() {
266
+ ?>
267
+ <style type="text/css">
268
+ .icon32-posts-wpuf_forms,
269
+ .icon32-posts-wpuf_profile {
270
+ background: url('<?php echo admin_url( "images/icons32.png" ); ?>') no-repeat 2% 35%;
271
+ }
272
+ </style>
273
+ <?php
274
+ }
275
+
276
+ /**
277
+ * Columns form builder list table
278
+ *
279
+ * @param type $columns
280
+ * @return string
281
+ */
282
+ function admin_column( $columns ) {
283
+ $columns = array(
284
+ 'cb' => '<input type="checkbox" />',
285
+ 'title' => __( 'Form Name', 'wpuf' ),
286
+ 'post_type' => __( 'Post Type', 'wpuf' ),
287
+ 'post_status' => __( 'Post Status', 'wpuf' ),
288
+ 'guest_post' => __( 'Guest Post', 'wpuf' ),
289
+ 'shortcode' => __( 'Shortcode', 'wpuf' )
290
+ );
291
+
292
+ return $columns;
293
+ }
294
+
295
+ /**
296
+ * Columns form builder list table
297
+ *
298
+ * @param type $columns
299
+ * @return string
300
+ */
301
+ function admin_column_profile( $columns ) {
302
+ $columns = array(
303
+ 'cb' => '<input type="checkbox" />',
304
+ 'title' => __( 'Form Name', 'wpuf' ),
305
+ 'role' => __( 'User Role', 'wpuf' ),
306
+ 'shortcode' => __( 'Shortcode', 'wpuf' )
307
+ );
308
+
309
+ return $columns;
310
+ }
311
+
312
+ /**
313
+ * Custom Column value for post form builder
314
+ *
315
+ * @param string $column_name
316
+ * @param int $post_id
317
+ */
318
+ function admin_column_value( $column_name, $post_id ) {
319
+ switch ($column_name) {
320
+ case 'shortcode':
321
+ printf( '[wpuf_form id="%d"]', $post_id );
322
+ break;
323
+
324
+ case 'post_type':
325
+ $settings = wpuf_get_form_settings( $post_id );
326
+ echo isset( $settings['post_type'] ) ? $settings['post_type'] : 'post';
327
+ break;
328
+
329
+ case 'post_status':
330
+ $settings = wpuf_get_form_settings( $post_id );
331
+ $status = isset( $settings['post_status'] ) ? $settings['post_status'] : 'publish';
332
+ echo wpuf_admin_post_status( $status );
333
+ break;
334
+
335
+ case 'guest_post':
336
+ $settings = wpuf_get_form_settings( $post_id );
337
+ $guest = isset( $settings['guest_post'] ) ? $settings['guest_post'] : 'false';
338
+ $url = WPUF_ASSET_URI . '/images/';
339
+ $image = '<img src="%s" alt="%s">';
340
+ echo $settings['guest_post'] == 'false' ? sprintf( $image, $url . 'cross.png', __( 'No', 'wpuf' ) ) : sprintf( $image, $url . 'tick.png', __( 'Yes', 'wpuf' ) ) ;
341
+ break;
342
+
343
+ default:
344
+ # code...
345
+ break;
346
+ }
347
+ }
348
+
349
+ /**
350
+ * Custom Column value for profile form builder
351
+ *
352
+ * @param string $column_name
353
+ * @param int $post_id
354
+ */
355
+ function admin_column_value_profile( $column_name, $post_id ) {
356
+
357
+ switch ($column_name) {
358
+ case 'shortcode':
359
+ printf( 'Registration: [wpuf_profile type="registration" id="%d"]<br>', $post_id );
360
+ printf( 'Edit Profile: [wpuf_profile type="profile" id="%d"]', $post_id );
361
+ break;
362
+
363
+ case 'role':
364
+ $settings = wpuf_get_form_settings( $post_id );
365
+ $role = isset( $settings['role'] ) ? $settings['role'] : 'subscriber';
366
+ echo ucfirst( $role );
367
+ break;
368
+ }
369
+ }
370
+
371
+ /**
372
+ * Duplicate form row action link
373
+ *
374
+ * @param array $actions
375
+ * @param object $post
376
+ * @return array
377
+ */
378
+ function row_action_duplicate($actions, $post) {
379
+ if ( !current_user_can( 'activate_plugins' ) ) {
380
+ return $actions;
381
+ }
382
+
383
+ if ( !in_array( $post->post_type, array( 'wpuf_forms', 'wpuf_profile') ) ) {
384
+ return $actions;
385
+ }
386
+
387
+ $actions['duplicate'] = '<a href="' . esc_url( add_query_arg( array( 'action' => 'wpuf_duplicate', 'id' => $post->ID, '_wpnonce' => wp_create_nonce( 'wpuf_duplicate' ) ), admin_url( 'admin.php' ) ) ) . '" title="' . esc_attr( __( 'Duplicate form', 'wpuf' ) ) . '">' . __( 'Duplicate', 'wpuf' ) . '</a>';
388
+ return $actions;
389
+ }
390
+
391
+ /**
392
+ * Form Duplication handler
393
+ *
394
+ * @return type
395
+ */
396
+ function duplicate_form() {
397
+ check_admin_referer( 'wpuf_duplicate' );
398
+
399
+ if ( !current_user_can( 'activate_plugins' ) ) {
400
+ return;
401
+ }
402
+
403
+ $post_id = isset( $_GET['id'] ) ? intval( $_GET['id'] ) : 0;
404
+ $post = get_post( $post_id );
405
+
406
+ if ( !$post ) {
407
+ return;
408
+ }
409
+
410
+ $contents = self::get_form_fields( $post_id );
411
+
412
+ $new_form = array(
413
+ 'post_title' => $post->post_title,
414
+ 'post_type' => $post->post_type,
415
+ 'post_status' => 'draft'
416
+ );
417
+
418
+
419
+ $form_id = wp_insert_post( $new_form );
420
+
421
+ foreach ( $contents as $content ) {
422
+ $post_content = maybe_unserialize( $content->post_content );
423
+ self::insert_form_field( $form_id, $post_content, null, $order );
424
+ }
425
+
426
+ if ( $form_id ) {
427
+ $form_settings = wpuf_get_form_settings( $post_id );
428
+ update_post_meta( $form_id, $this->form_settings_key, $form_settings );
429
+ $location = admin_url( 'edit.php?post_type=' . $post->post_type );
430
+ wp_redirect( $location );
431
+ }
432
+ }
433
+
434
+ /**
435
+ * Meta box for all Post form selection
436
+ *
437
+ * Registers a meta box in public post types to select the desired WPUF
438
+ * form select box to assign a form id.
439
+ *
440
+ * @return void
441
+ */
442
+ function add_meta_box_form_select() {
443
+
444
+ // remove the submit div, because submit button placed on form elements
445
+ remove_meta_box('submitdiv', 'wpuf_forms', 'side');
446
+ remove_meta_box('submitdiv', 'wpuf_profile', 'side');
447
+
448
+ $post_types = get_post_types( array('public' => true) );
449
+ foreach ($post_types as $post_type) {
450
+ add_meta_box( 'wpuf-select-form', __('WPUF Form'), array($this, 'form_selection_metabox'), $post_type, 'side', 'high' );
451
+ }
452
+ }
453
+
454
+ /**
455
+ * Add meta boxes to post form builder
456
+ *
457
+ * @return void
458
+ */
459
+ function add_meta_box_post() {
460
+ add_meta_box( 'wpuf-metabox-editor', __( 'Form Editor', 'wpuf' ), array($this, 'metabox_post_form'), 'wpuf_forms', 'normal', 'high' );
461
+ add_meta_box( 'wpuf-metabox-fields', __( 'Form Elements', 'wpuf' ), array($this, 'form_elements_post'), 'wpuf_forms', 'side', 'core' );
462
+ add_meta_box( 'wpuf-metabox-fields-shortcode', __( 'Shortcode', 'wpuf' ), array($this, 'form_elements_shortcode'), 'wpuf_forms', 'side', 'core' );
463
+ }
464
+
465
+ /**
466
+ * Adds meta boxes to profile form builder
467
+ *
468
+ * @return void
469
+ */
470
+ function add_meta_box_profile() {
471
+ add_meta_box( 'wpuf-metabox-editor', __( 'Form Editor', 'wpuf' ), array($this, 'metabox_profile_form'), 'wpuf_profile', 'normal', 'high' );
472
+ add_meta_box( 'wpuf-metabox-fields', __( 'Form Elements', 'wpuf' ), array($this, 'form_elements_profile'), 'wpuf_profile', 'side', 'core' );
473
+ add_meta_box( 'wpuf-metabox-fields-shortcode', __( 'Shortcode', 'wpuf' ), array($this, 'form_elements_profile_shortcode'), 'wpuf_profile', 'side', 'core' );
474
+ }
475
+
476
+ /**
477
+ * Prints form shortcode
478
+ *
479
+ * @since 2.3
480
+ *
481
+ * @return void
482
+ */
483
+ public function form_elements_shortcode() {
484
+ global $post;
485
+ ?>
486
+ <p>
487
+ <em><?php _e( 'Copy and insert this shortcode to a page:', 'wpuf' ); ?></em>
488
+ </p>
489
+ <input type='text' readonly value='[wpuf_form id="<?php echo $post->ID; ?>"]' style="width: 100%" />
490
+ <?php
491
+ }
492
+
493
+ /**
494
+ * Prints form shortcode
495
+ *
496
+ * @since 2.3
497
+ *
498
+ * @return void
499
+ */
500
+ public function form_elements_profile_shortcode() {
501
+ global $post;
502
+ ?>
503
+ <p>
504
+ <em><?php _e( 'Copy and insert this shortcode to a page:', 'wpuf' ); ?></em>
505
+ </p>
506
+
507
+ <label for="wpuf-profile-shortcode">
508
+ <?php _e( 'Profile Shortcode:', 'wpuf' ); ?>
509
+ <input type='text' id="wpuf-profile-shortcode" readonly value='[wpuf_profile type="profile" id="<?php echo $post->ID; ?>"]' style="width: 100%" />
510
+ </label>
511
+
512
+ <br>
513
+ <br>
514
+
515
+ <label for="wpuf-reg-shortcode">
516
+ <?php _e( 'Registration Shortcode:', 'wpuf' ); ?>
517
+ <input type='text' id="wpuf-reg-shortcode" readonly value='[wpuf_profile type="registration" id="<?php echo $post->ID; ?>"]' style="width: 100%" />
518
+ </label>
519
+ <?php
520
+ }
521
+
522
+ /**
523
+ * Replaces the core publish button with ours
524
+ *
525
+ * @global object $post
526
+ * @global string $pagenow
527
+ */
528
+ function publish_button() {
529
+ global $post, $pagenow;
530
+
531
+ $post_type = $post->post_type;
532
+ $post_type_object = get_post_type_object($post_type);
533
+ $can_publish = current_user_can($post_type_object->cap->publish_posts);
534
+ ?>
535
+ <div class="submitbox" id="submitpost">
536
+ <div id="major-publishing-actions">
537
+ <div id="publishing-action">
538
+ <?php if( $pagenow == 'post.php' ) { ?>
539
+ <a class="button button-primary button-large" target="_blank" href="<?php printf('%s?action=wpuf_form_preview&form_id=%s', admin_url( 'admin-ajax.php' ), $post->ID ); ?>"><?php _e( 'Preview Form', 'wpuf' ); ?></a>
540
+ <?php } ?>
541
+
542
+ <span class="spinner"></span>
543
+ <?php
544
+ if ( !in_array( $post->post_status, array('publish', 'future', 'private') ) || 0 == $post->ID ) {
545
+ if ( $can_publish ) :
546
+ if ( !empty( $post->post_date_gmt ) && time() < strtotime( $post->post_date_gmt . ' +0000' ) ) :
547
+ ?>
548
+ <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e( 'Schedule' ) ?>" />
549
+ <?php submit_button( __( 'Schedule' ), 'primary button-large', 'publish', false, array('accesskey' => 'p') ); ?>
550
+ <?php else : ?>
551
+ <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e( 'Publish' ) ?>" />
552
+ <?php submit_button( __( 'Publish' ), 'primary button-large', 'publish', false, array('accesskey' => 'p') ); ?>
553
+ <?php endif;
554
+ else :
555
+ ?>
556
+ <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e( 'Submit for Review' ) ?>" />
557
+ <?php submit_button( __( 'Submit for Review' ), 'primary button-large', 'publish', false, array('accesskey' => 'p') ); ?>
558
+ <?php
559
+ endif;
560
+ } else {
561
+ ?>
562
+ <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e( 'Update' ) ?>" />
563
+ <input name="save" type="submit" class="button button-primary button-large" id="publish" accesskey="p" value="<?php esc_attr_e( 'Update' ) ?>" />
564
+ <?php }
565
+ ?>
566
+ </div>
567
+ <div class="clear"></div>
568
+ </div>
569
+ </div>
570
+ <?php
571
+ }
572
+
573
+ /**
574
+ * Form selection meta box in post types
575
+ *
576
+ * Registered via $this->add_meta_box_form_select()
577
+ *
578
+ * @global object $post
579
+ */
580
+ function form_selection_metabox() {
581
+ global $post;
582
+
583
+ $forms = get_posts( array('post_type' => 'wpuf_forms', 'numberposts' => '-1') );
584
+ $selected = get_post_meta( $post->ID, '_wpuf_form_id', true );
585
+ ?>
586
+
587
+ <input type="hidden" name="wpuf_form_select_nonce" value="<?php echo wp_create_nonce( plugin_basename( __FILE__ ) ); ?>" />
588
+
589
+ <select name="wpuf_form_select">
590
+ <option value="">--</option>
591
+ <?php foreach ($forms as $form) { ?>
592
+ <option value="<?php echo $form->ID; ?>"<?php selected($selected, $form->ID); ?>><?php echo $form->post_title; ?></option>
593
+ <?php } ?>
594
+ </select>
595
+ <?php
596
+ }
597
+
598
+ /**
599
+ * Saves the form ID from form selection meta box
600
+ *
601
+ * @param int $post_id
602
+ * @param object $post
603
+ * @return int|void
604
+ */
605
+ function form_selection_metabox_save( $post_id, $post ) {
606
+ if ( !isset($_POST['wpuf_form_select'])) {
607
+ return $post->ID;
608
+ }
609
+
610
+ if ( !wp_verify_nonce( $_POST['wpuf_form_select_nonce'], plugin_basename( __FILE__ ) ) ) {
611
+ return $post->ID;
612
+ }
613
+
614
+ // Is the user allowed to edit the post or page?
615
+ if ( !current_user_can( 'edit_post', $post->ID ) ) {
616
+ return $post->ID;
617
+ }
618
+
619
+ update_post_meta( $post->ID, '_wpuf_form_id', $_POST['wpuf_form_select'] );
620
+ }
621
+
622
+ /**
623
+ * Displays settings on post form builder
624
+ *
625
+ * @global object $post
626
+ */
627
+ function form_settings_posts() {
628
+ global $post;
629
+
630
+
631
+
632
+ $form_settings = wpuf_get_form_settings( $post->ID );
633
+
634
+ $post_status_selected = isset( $form_settings['post_status'] ) ? $form_settings['post_status'] : 'publish';
635
+ $restrict_message = __( "This page is restricted. Please Log in / Register to view this page.", 'wpuf' );
636
+
637
+ $post_type_selected = isset( $form_settings['post_type'] ) ? $form_settings['post_type'] : 'post';
638
+
639
+ $post_format_selected = isset( $form_settings['post_format'] ) ? $form_settings['post_format'] : 0;
640
+ $default_cat = isset( $form_settings['default_cat'] ) ? $form_settings['default_cat'] : -1;
641
+
642
+ $guest_post = isset( $form_settings['guest_post'] ) ? $form_settings['guest_post'] : 'false';
643
+ $guest_details = isset( $form_settings['guest_details'] ) ? $form_settings['guest_details'] : 'true';
644
+ $name_label = isset( $form_settings['name_label'] ) ? $form_settings['name_label'] : __( 'Name' );
645
+ $email_label = isset( $form_settings['email_label'] ) ? $form_settings['email_label'] : __( 'Email' );
646
+ $message_restrict = isset( $form_settings['message_restrict'] ) ? $form_settings['message_restrict'] : $restrict_message;
647
+
648
+ $redirect_to = isset( $form_settings['redirect_to'] ) ? $form_settings['redirect_to'] : 'post';
649
+ $message = isset( $form_settings['message'] ) ? $form_settings['message'] : __( 'Post saved', 'wpuf' );
650
+ $update_message = isset( $form_settings['update_message'] ) ? $form_settings['update_message'] : __( 'Post updated successfully', 'wpuf' );
651
+ $page_id = isset( $form_settings['page_id'] ) ? $form_settings['page_id'] : 0;
652
+ $url = isset( $form_settings['url'] ) ? $form_settings['url'] : '';
653
+ $comment_status = isset( $form_settings['comment_status'] ) ? $form_settings['comment_status'] : 'open';
654
+
655
+ $submit_text = isset( $form_settings['submit_text'] ) ? $form_settings['submit_text'] : __( 'Submit', 'wpuf' );
656
+ $draft_text = isset( $form_settings['draft_text'] ) ? $form_settings['draft_text'] : __( 'Save Draft', 'wpuf' );
657
+ $preview_text = isset( $form_settings['preview_text'] ) ? $form_settings['preview_text'] : __( 'Preview', 'wpuf' );
658
+ $draft_post = isset( $form_settings['draft_post'] ) ? $form_settings['draft_post'] : 'false';
659
+ $subscription_disabled = isset( $form_settings['subscription_disabled'] ) ? $form_settings['subscription_disabled'] : '';
660
+
661
+ ?>
662
+ <table class="form-table">
663
+
664
+ <tr class="">
665
+ <th><?php _e( 'Disable Subscription', 'wpuf' ); ?></th>
666
+ <td>
667
+ <label>
668
+ <input type="checkbox" name="wpuf_settings[subscription_disabled]" value="yes" <?php checked( $subscription_disabled, 'yes' ); ?> />
669
+ <?php _e( 'Disable Subscription', 'wpuf' ); ?>
670
+ </label>
671
+
672
+ <p class="description"><?php echo __( 'If checked, any subscription and pay-per-post will be disabled on the form and will take no effect.', 'wpuf' ); ?></p>
673
+ </td>
674
+ </tr>
675
+
676
+ <tr class="wpuf-post-type">
677
+ <th><?php _e( 'Post Type', 'wpuf' ); ?></th>
678
+ <td>
679
+ <select name="wpuf_settings[post_type]">
680
+ <?php
681
+ $post_types = get_post_types();
682
+ unset($post_types['attachment']);
683
+ unset($post_types['revision']);
684
+ unset($post_types['nav_menu_item']);
685
+ unset($post_types['wpuf_forms']);
686
+ unset($post_types['wpuf_profile']);
687
+
688
+ foreach ($post_types as $post_type) {
689
+ printf('<option value="%s"%s>%s</option>', $post_type, selected( $post_type_selected, $post_type, false ), $post_type );
690
+ }
691
+ ?>
692
+ </select>
693
+ </td>
694
+ </tr>
695
+
696
+ <tr class="wpuf-post-status">
697
+ <th><?php _e( 'Post Status', 'wpuf' ); ?></th>
698
+ <td>
699
+ <select name="wpuf_settings[post_status]">
700
+ <?php
701
+ $statuses = get_post_statuses();
702
+ foreach ($statuses as $status => $label) {
703
+ printf('<option value="%s"%s>%s</option>', $status, selected( $post_status_selected, $status, false ), $label );
704
+ }
705
+ ?>
706
+ </select>
707
+ </td>
708
+ </tr>
709
+
710
+ <tr class="wpuf-post-fromat">
711
+ <th><?php _e( 'Post Format', 'wpuf' ); ?></th>
712
+ <td>
713
+ <select name="wpuf_settings[post_format]">
714
+ <option value="0"><?php _e( '- None -', 'wpuf' ); ?></option>
715
+ <?php
716
+ $post_formats = get_theme_support( 'post-formats' );
717
+
718
+ if ( isset($post_formats[0]) && is_array( $post_formats[0] ) ) {
719
+ foreach ($post_formats[0] as $format) {
720
+ printf('<option value="%s"%s>%s</option>', $format, selected( $post_format_selected, $format, false ), $format );
721
+ }
722
+ }
723
+ ?>
724
+ </select>
725
+ </td>
726
+ </tr>
727
+ </tr>
728
+
729
+ <tr class="wpuf-default-cat">
730
+ <th><?php _e( 'Default Post Category', 'wpuf' ); ?></th>
731
+ <td>
732
+ <?php
733
+ wp_dropdown_categories( array(
734
+ 'hide_empty' => false,
735
+ 'hierarchical' => true,
736
+ 'selected' => $default_cat,
737
+ 'name' => 'wpuf_settings[default_cat]',
738
+ 'show_option_none' => __( '- None -', 'wpuf' )
739
+ ) );
740
+ ?>
741
+ <p class="description"><?php echo __( 'If users are not allowed to choose any category, this category will be used instead (if post type supports)', 'wpuf' ); ?></p>
742
+ </td>
743
+ </tr>
744
+
745
+ <tr>
746
+ <th><?php _e( 'Guest Post', 'wpuf' ); ?></th>
747
+ <td>
748
+ <label>
749
+ <input type="hidden" name="wpuf_settings[guest_post]" value="false">
750
+ <input type="checkbox" name="wpuf_settings[guest_post]" value="true"<?php checked( $guest_post, 'true' ); ?> />
751
+ <?php _e( 'Enable Guest Post', 'wpuf' ) ?>
752
+ </label>
753
+ <p class="description"><?php _e( 'Unregistered users will be able to submit posts', 'wpuf' ); ?></p>
754
+ </td>
755
+ </tr>
756
+
757
+ <tr class="show-if-guest">
758
+ <th><?php _e( 'User Details', 'wpuf' ); ?></th>
759
+ <td>
760
+ <label>
761
+ <input type="hidden" name="wpuf_settings[guest_details]" value="false">
762
+ <input type="checkbox" name="wpuf_settings[guest_details]" value="true"<?php checked( $guest_details, 'true' ); ?> />
763
+ <?php _e( 'Require Name and Email address', 'wpuf' ) ?>
764
+ </label>
765
+ <p class="description"><?php _e( 'If requires, users will be automatically registered to the site using the name and email address', 'wpuf' ); ?></p>
766
+ </td>
767
+ </tr>
768
+
769
+ <tr class="show-if-guest show-if-details">
770
+ <th><?php _e( 'Name Label', 'wpuf' ); ?></th>
771
+ <td>
772
+ <label>
773
+ <input type="text" name="wpuf_settings[name_label]" value="<?php echo esc_attr( $name_label ); ?>" />
774
+ </label>
775
+ <p class="description"><?php _e( 'Label text for name field', 'wpuf' ); ?></p>
776
+ </td>
777
+ </tr>
778
+
779
+ <tr class="show-if-guest show-if-details">
780
+ <th><?php _e( 'E-Mail Label', 'wpuf' ); ?></th>
781
+ <td>
782
+ <label>
783
+ <input type="text" name="wpuf_settings[email_label]" value="<?php echo esc_attr( $email_label ); ?>" />
784
+ </label>
785
+ <p class="description"><?php _e( 'Label text for email field', 'wpuf' ); ?></p>
786
+ </td>
787
+ </tr>
788
+
789
+ <tr class="show-if-not-guest">
790
+ <th><?php _e( 'Unauthorized Message', 'wpuf' ); ?></th>
791
+ <td>
792
+ <textarea rows="3" cols="40" name="wpuf_settings[message_restrict]"><?php echo esc_textarea( $message_restrict ); ?></textarea>
793
+ <p class="description"><?php _e( 'Not logged in users will see this message', 'wpuf' ); ?></p>
794
+ </td>
795
+ </tr>
796
+
797
+ <tr class="wpuf-redirect-to">
798
+ <th><?php _e( 'Redirect To', 'wpuf' ); ?></th>
799
+ <td>
800
+ <select name="wpuf_settings[redirect_to]">
801
+ <?php
802
+ $redirect_options = array(
803
+ 'post' => __( 'Newly created post', 'wpuf' ),
804
+ 'same' => __( 'Same Page', 'wpuf' ),
805
+ 'page' => __( 'To a page', 'wpuf' ),
806
+ 'url' => __( 'To a custom URL', 'wpuf' )
807
+ );
808
+
809
+ foreach ($redirect_options as $to => $label) {
810
+ printf('<option value="%s"%s>%s</option>', $to, selected( $redirect_to, $to, false ), $label );
811
+ }
812
+ ?>
813
+ </select>
814
+ <p class="description">
815
+ <?php _e( 'After successfull submit, where the page will redirect to', $domain = 'default' ) ?>
816
+ </p>
817
+ </td>
818
+ </tr>
819
+
820
+ <tr class="wpuf-same-page">
821
+ <th><?php _e( 'Message to show', 'wpuf' ); ?></th>
822
+ <td>
823
+ <textarea rows="3" cols="40" name="wpuf_settings[message]"><?php echo esc_textarea( $message ); ?></textarea>
824
+ </td>
825
+ </tr>
826
+ </tr>
827
+
828
+ <tr class="wpuf-page-id">
829
+ <th><?php _e( 'Page', 'wpuf' ); ?></th>
830
+ <td>
831
+ <select name="wpuf_settings[page_id]">
832
+ <?php
833
+ $pages = get_posts( array( 'numberposts' => -1, 'post_type' => 'page') );
834
+
835
+ foreach ($pages as $page) {
836
+ printf('<option value="%s"%s>%s</option>', $page->ID, selected( $page_id, $page->ID, false ), esc_attr( $page->post_title ) );
837
+ }
838
+ ?>
839
+ </select>
840
+ </td>
841
+ </tr>
842
+
843
+ <tr class="wpuf-url">
844
+ <th><?php _e( 'Custom URL', 'wpuf' ); ?></th>
845
+ <td>
846
+ <input type="url" name="wpuf_settings[url]" value="<?php echo esc_attr( $url ); ?>">
847
+ </td>
848
+ </tr>
849
+
850
+ <tr class="wpuf-comment">
851
+ <th><?php _e( 'Comment Status', 'wpuf' ); ?></th>
852
+ <td>
853
+ <select name="wpuf_settings[comment_status]">
854
+ <option value="open" <?php selected( $comment_status, 'open'); ?>><?php _e('Open'); ?></option>
855
+ <option value="closed" <?php selected( $comment_status, 'closed'); ?>><?php _e('Closed'); ?></option>
856
+ </select>
857
+ </td>
858
+ </tr>
859
+
860
+ <tr class="wpuf-submit-text">
861
+ <th><?php _e( 'Submit Post Button text', 'wpuf' ); ?></th>
862
+ <td>
863
+ <input type="text" name="wpuf_settings[submit_text]" value="<?php echo esc_attr( $submit_text ); ?>">
864
+ </td>
865
+ </tr>
866
+
867
+ <tr>
868
+ <th><?php _e( 'Post Draft', 'wpuf' ); ?></th>
869
+ <td>
870
+ <label>
871
+ <input type="hidden" name="wpuf_settings[draft_post]" value="false">
872
+ <input type="checkbox" name="wpuf_settings[draft_post]" value="true"<?php checked( $draft_post, 'true' ); ?> />
873
+ <?php _e( 'Enable Saving as draft', 'wpuf' ) ?>
874
+ </label>
875
+ <p class="description"><?php _e( 'It will show a button to save as draft', 'wpuf' ); ?></p>
876
+ </td>
877
+ </tr>
878
+
879
+ <?php do_action( 'wpuf_form_setting', $form_settings, $post ); ?>
880
+ </table>
881
+ <?php
882
+ }
883
+
884
+ /**
885
+ * Displays settings on post form builder
886
+ *
887
+ * @global object $post
888
+ */
889
+ function form_settings_posts_edit() {
890
+ global $post;
891
+
892
+ $form_settings = wpuf_get_form_settings( $post->ID );
893
+
894
+ $post_status_selected = isset( $form_settings['edit_post_status'] ) ? $form_settings['edit_post_status'] : 'publish';
895
+ $redirect_to = isset( $form_settings['edit_redirect_to'] ) ? $form_settings['edit_redirect_to'] : 'same';
896
+ $update_message = isset( $form_settings['update_message'] ) ? $form_settings['update_message'] : __( 'Post updated successfully', 'wpuf' );
897
+ $page_id = isset( $form_settings['edit_page_id'] ) ? $form_settings['edit_page_id'] : 0;
898
+ $url = isset( $form_settings['edit_url'] ) ? $form_settings['edit_url'] : '';
899
+ $update_text = isset( $form_settings['update_text'] ) ? $form_settings['update_text'] : __( 'Update', 'wpuf' );
900
+ $subscription = isset( $form_settings['subscription'] ) ? $form_settings['subscription'] : null;
901
+ ?>
902
+ <table class="form-table">
903
+
904
+ <tr class="wpuf-post-status">
905
+ <th><?php _e( 'Set Post Status to', 'wpuf' ); ?></th>
906
+ <td>
907
+ <select name="wpuf_settings[edit_post_status]">
908
+ <?php
909
+ $statuses = get_post_statuses();
910
+
911
+ foreach ($statuses as $status => $label) {
912
+ printf('<option value="%s"%s>%s</option>', $status, selected( $post_status_selected, $status, false ), $label );
913
+ }
914
+
915
+ printf( '<option value="_nochange"%s>%s</option>', selected( $post_status_selected, '_nochange', false ), __( 'No Change', 'wpuf' ) );
916
+ ?>
917
+ </select>
918
+ </td>
919
+ </tr>
920
+
921
+ <tr class="wpuf-redirect-to">
922
+ <th><?php _e( 'Redirect To', 'wpuf' ); ?></th>
923
+ <td>
924
+ <select name="wpuf_settings[edit_redirect_to]">
925
+ <?php
926
+ $redirect_options = array(
927
+ 'post' => __( 'Newly created post', 'wpuf' ),
928
+ 'same' => __( 'Same Page', 'wpuf' ),
929
+ 'page' => __( 'To a page', 'wpuf' ),
930
+ 'url' => __( 'To a custom URL', 'wpuf' )
931
+ );
932
+
933
+ foreach ($redirect_options as $to => $label) {
934
+ printf('<option value="%s"%s>%s</option>', $to, selected( $redirect_to, $to, false ), $label );
935
+ }
936
+ ?>
937
+ </select>
938
+ <p class="description">
939
+ <?php _e( 'After successfull submit, where the page will redirect to', $domain = 'default' ) ?>
940
+ </p>
941
+ </td>
942
+ </tr>
943
+
944
+ <tr class="wpuf-same-page">
945
+ <th><?php _e( 'Post Update Message', 'wpuf' ); ?></th>
946
+ <td>
947
+ <textarea rows="3" cols="40" name="wpuf_settings[update_message]"><?php echo esc_textarea( $update_message ); ?></textarea>
948
+ </td>
949
+ </tr>
950
+
951
+ <tr class="wpuf-page-id">
952
+ <th><?php _e( 'Page', 'wpuf' ); ?></th>
953
+ <td>
954
+ <select name="wpuf_settings[edit_page_id]">
955
+ <?php
956
+ $pages = get_posts( array( 'numberposts' => -1, 'post_type' => 'page') );
957
+
958
+ foreach ($pages as $page) {
959
+ printf('<option value="%s"%s>%s</option>', $page->ID, selected( $page_id, $page->ID, false ), esc_attr( $page->post_title ) );
960
+ }
961
+ ?>
962
+ </select>
963
+ </td>
964
+ </tr>
965
+
966
+ <tr class="wpuf-url">
967
+ <th><?php _e( 'Custom URL', 'wpuf' ); ?></th>
968
+ <td>
969
+ <input type="url" name="wpuf_settings[edit_url]" value="<?php echo esc_attr( $url ); ?>">
970
+ </td>
971
+ </tr>
972
+
973
+ <tr class="wpuf-subscription-pack" style="display: none;">
974
+ <th><?php _e( 'Subscription Title'); ?></th>
975
+ <td>
976
+ <select id="wpuf-subscription-list" name="wpuf_settings[subscription]">
977
+ <?php $this->subscription_dropdown( $subscription ); ?>
978
+ </select>
979
+ </td>
980
+ </tr>
981
+
982
+ <tr class="wpuf-update-text">
983
+ <th><?php _e( 'Update Post Button text', 'wpuf' ); ?></th>
984
+ <td>
985
+ <input type="text" name="wpuf_settings[update_text]" value="<?php echo esc_attr( $update_text ); ?>">
986
+ </td>
987
+ </tr>
988
+ </table>
989
+ <?php
990
+ }
991
+
992
+ function subscription_dropdown( $selected = null ) {
993
+ $subscriptions = WPUF_Subscription::init()->get_subscriptions();
994
+
995
+ if ( ! $subscriptions ) {
996
+ printf( '<option>%s</option>', __( '- Select -' ), 'wpuf' );
997
+ return;
998
+ }
999
+
1000
+ printf( '<option>%s</option>', __( '- Select -', 'wpuf' ) );
1001
+
1002
+ foreach ( $subscriptions as $key => $subscription ) {
1003
+ ?>
1004
+ <option value="<?php echo esc_attr( $subscription->ID ); ?>" <?php selected( $selected, $subscription->ID ); ?> ><?php echo $subscription->post_title; ?></option>
1005
+ <?php
1006
+ }
1007
+ }
1008
+
1009
+ /**
1010
+ * Displays settings on post form builder
1011
+ *
1012
+ * @global object $post
1013
+ */
1014
+ function form_settings_posts_notification() {
1015
+ do_action('wpuf_form_settings_post_notification');
1016
+ }
1017
+
1018
+ /**
1019
+ * Settings for post expiration
1020
+ *
1021
+ * @since 2.2.7
1022
+ *
1023
+ * @global $post
1024
+ */
1025
+ function form_post_expiration(){
1026
+ do_action('wpuf_form_post_expiration');
1027
+ }
1028
+
1029
+ /**
1030
+ * Display settings for user profile builder
1031
+ *
1032
+ * @return void
1033
+ */
1034
+ function form_settings_profile() {
1035
+
1036
+ ?>
1037
+ <table class="form-table">
1038
+ <?php do_action( 'registration_setting' ); ?>
1039
+ </table>
1040
+ <?php
1041
+ }
1042
+
1043
+ function metabox_post_form( $post ) {
1044
+ ?>
1045
+
1046
+ <h2 class="nav-tab-wrapper">
1047
+ <a href="#wpuf-metabox" class="nav-tab" id="wpuf-editor-tab"><?php _e( 'Form Editor', 'wpuf' ); ?></a>
1048
+ <a href="#wpuf-metabox-settings" class="nav-tab" id="wpuf-post-settings-tab"><?php _e( 'Post Settings', 'wpuf' ); ?></a>
1049
+ <a href="#wpuf-metabox-settings-update" class="nav-tab" id="wpuf-edit-settings-tab"><?php _e( 'Edit Settings', 'wpuf' ); ?></a>
1050
+ <a href="#wpuf-metabox-notification" class="nav-tab" id="wpuf-notification-tab"><?php _e( 'Notification', 'wpuf' ); ?></a>
1051
+ <a href="#wpuf-metabox-post_expiration" class="nav-tab" id="wpuf-notification-tab"><?php _e( 'Post Expiration', 'wpuf' ); ?></a>
1052
+
1053
+ <?php do_action( 'wpuf_post_form_tab' ); ?>
1054
+ </h2>
1055
+
1056
+ <div class="tab-content">
1057
+ <div id="wpuf-metabox" class="group">
1058
+ <?php $this->edit_form_area(); ?>
1059
+ </div>
1060
+
1061
+ <div id="wpuf-metabox-settings" class="group">
1062
+ <?php $this->form_settings_posts(); ?>
1063
+ </div>
1064
+
1065
+ <div id="wpuf-metabox-settings-update" class="group">
1066
+ <?php $this->form_settings_posts_edit(); ?>
1067
+ </div>
1068
+
1069
+ <div id="wpuf-metabox-notification" class="group">
1070
+ <?php $this->form_settings_posts_notification(); ?>
1071
+ </div>
1072
+
1073
+ <div id="wpuf-metabox-post_expiration" class="group wpuf-metabox-post_expiration">
1074
+ <?php $this->form_post_expiration(); ?>
1075
+ </div>
1076
+
1077
+ <?php do_action( 'wpuf_post_form_tab_content' ); ?>
1078
+ </div>
1079
+ <?php
1080
+ }
1081
+
1082
+ function metabox_profile_form( $post ) {
1083
+
1084
+ ?>
1085
+
1086
+ <h2 class="nav-tab-wrapper">
1087
+ <a href="#wpuf-metabox" class="nav-tab" id="wpuf_general-tab"><?php _e( 'Form Editor', 'wpuf' ); ?></a>
1088
+ <a href="#wpuf-metabox-settings" class="nav-tab" id="wpuf_dashboard-tab"><?php _e( 'Settings', 'wpuf' ); ?></a>
1089
+
1090
+ <?php do_action( 'wpuf_profile_form_tab' ); ?>
1091
+ </h2>
1092
+
1093
+ <div class="tab-content">
1094
+ <div id="wpuf-metabox" class="group">
1095
+ <?php $this->edit_form_area_profile(); ?>
1096
+ </div>
1097
+
1098
+ <div id="wpuf-metabox-settings" class="group">
1099
+ <?php $this->form_settings_profile(); ?>
1100
+ </div>
1101
+
1102
+ <?php do_action( 'wpuf_profile_form_tab_content' ); ?>
1103
+ </div>
1104
+ <?php
1105
+ }
1106
+
1107
+ function form_elements_common() {
1108
+ $title = esc_attr( __( 'Click to add to the editor', 'wpuf' ) );
1109
+ ?>
1110
+ <h2><?php _e( 'Custom Fields', 'wpuf' ); ?></h2>
1111
+ <div class="wpuf-form-buttons">
1112
+ <button class="button" data-name="custom_text" data-type="text" title="<?php echo $title; ?>"><?php _e( 'Text', 'wpuf' ); ?></button>
1113
+ <button class="button" data-name="custom_textarea" data-type="textarea" title="<?php echo $title; ?>"><?php _e( 'Textarea', 'wpuf' ); ?></button>
1114
+ <button class="button" data-name="custom_select" data-type="select" title="<?php echo $title; ?>"><?php _e( 'Dropdown', 'wpuf' ); ?></button>
1115
+ <button class="button" data-name="custom_multiselect" data-type="multiselect" title="<?php echo $title; ?>"><?php _e( 'Multi Select', 'wpuf' ); ?></button>
1116
+ <button class="button" data-name="custom_radio" data-type="radio" title="<?php echo $title; ?>"><?php _e( 'Radio', 'wpuf' ); ?></button>
1117
+ <button class="button" data-name="custom_checkbox" data-type="checkbox" title="<?php echo $title; ?>"><?php _e( 'Checkbox', 'wpuf' ); ?></button>
1118
+ <button class="button" data-name="custom_url" data-type="url" title="<?php echo $title; ?>"><?php _e( 'URL', 'wpuf' ); ?></button>
1119
+ <button class="button" data-name="custom_email" data-type="email" title="<?php echo $title; ?>"><?php _e( 'Email', 'wpuf' ); ?></button>
1120
+ <button class="button" data-name="custom_hidden" data-type="hidden" title="<?php echo $title; ?>"><?php _e( 'Hidden Field', 'wpuf' ); ?></button>
1121
+
1122
+
1123
+
1124
+ <?php do_action( 'wpuf_form_buttons_custom' ); ?>
1125
+ </div>
1126
+
1127
+ <h2><?php _e( 'Others', 'wpuf' ); ?></h2>
1128
+ <div class="wpuf-form-buttons">
1129
+ <button class="button" data-name="section_break" data-type="break" title="<?php echo $title; ?>"><?php _e( 'Section Break', 'wpuf' ); ?></button>
1130
+ <button class="button" data-name="custom_html" data-type="html" title="<?php echo $title; ?>"><?php _e( 'HTML', 'wpuf' ); ?></button></button>
1131
+
1132
+ <?php do_action( 'wpuf_form_buttons_other' ); ?>
1133
+ </div>
1134
+
1135
+ <?php
1136
+ }
1137
+
1138
+ /**
1139
+ * Form elements for post form builder
1140
+ *
1141
+ * @return void
1142
+ */
1143
+ function form_elements_post() {
1144
+ ?>
1145
+ <div class="wpuf-loading hide"></div>
1146
+
1147
+ <h2><?php _e( 'Post Fields', 'wpuf' ); ?></h2>
1148
+ <div class="wpuf-form-buttons">
1149
+ <button class="button" data-name="post_title" data-type="text" title="<?php _e( 'Click to add to the editor', 'wpuf' ); ?>"><?php _e( 'Post Title', 'wpuf' ); ?></button>
1150
+ <button class="button" data-name="post_content" data-type="textarea" title="<?php _e( 'Click to add to the editor', 'wpuf' ); ?>"><?php _e( 'Post Body', 'wpuf' ); ?></button>
1151
+ <button class="button" data-name="post_excerpt" data-type="textarea" title="<?php _e( 'Click to add to the editor', 'wpuf' ); ?>"><?php _e( 'Excerpt', 'wpuf' ); ?></button>
1152
+ <button class="button" data-name="tags" data-type="text" title="<?php _e( 'Click to add to the editor', 'wpuf' ); ?>"><?php _e( 'Tags', 'wpuf' ); ?></button>
1153
+ <button class="button" data-name="category" data-type="category" title="<?php _e( 'Click to add to the editor', 'wpuf' ); ?>"><?php _e( 'Category', 'wpuf' ); ?></button>
1154
+ <button class="button" data-name="featured_image" data-type="image" title="<?php _e( 'Click to add to the editor', 'wpuf' ); ?>"><?php _e( 'Featured Image', 'wpuf' ); ?></button>
1155
+
1156
+ <?php do_action( 'wpuf_form_buttons_post' ); ?>
1157
+ </div>
1158
+
1159
+
1160
+ <h2><?php _e( 'Custom Taxonomies', 'wpuf' ); ?></h2>
1161
+ <div class="wpuf-form-buttons wpuf-custom-taxonomies">
1162
+
1163
+ <?php do_action( 'wpuf_form_custom_taxonomies' ); ?>
1164
+
1165
+ </div>
1166
+
1167
+
1168
+ <?php
1169
+
1170
+ $this->form_elements_common();
1171
+ $this->publish_button();
1172
+ }
1173
+
1174
+ /**
1175
+ * Form elements for Profile Builder
1176
+ *
1177
+ * @return void
1178
+ */
1179
+ function form_elements_profile() {
1180
+ ?>
1181
+
1182
+ <div class="wpuf-loading hide"></div>
1183
+
1184
+ <h2><?php _e( 'Profile Fields', 'wpuf' ); ?></h2>
1185
+ <div class="wpuf-form-buttons">
1186
+ <button class="button" data-name="user_login" data-type="text"><?php _e( 'Username', 'wpuf' ); ?></button>
1187
+ <button class="button" data-name="first_name" data-type="textarea"><?php _e( 'First Name', 'wpuf' ); ?></button>
1188
+ <button class="button" data-name="last_name" data-type="textarea"><?php _e( 'Last Name', 'wpuf' ); ?></button>
1189
+ <button class="button" data-name="nickname" data-type="text"><?php _e( 'Nickname', 'wpuf' ); ?></button>
1190
+ <button class="button" data-name="user_email" data-type="category"><?php _e( 'E-mail', 'wpuf' ); ?></button>
1191
+ <button class="button" data-name="user_url" data-type="text"><?php _e( 'Website', 'wpuf' ); ?></button>
1192
+ <button class="button" data-name="user_bio" data-type="textarea"><?php _e( 'Biographical Info', 'wpuf' ); ?></button>
1193
+ <button class="button" data-name="password" data-type="password"><?php _e( 'Password', 'wpuf' ); ?></button>
1194
+ <button class="button" data-name="user_avatar" data-type="avatar"><?php _e( 'Avatar', 'wpuf' ); ?></button>
1195
+
1196
+ <?php do_action( 'wpuf_form_buttons_user' ); ?>
1197
+ </div>
1198
+
1199
+ <?php
1200
+ $this->form_elements_common();
1201
+ $this->publish_button();
1202
+ }
1203
+
1204
+ /**
1205
+ * Saves the form settings
1206
+ *
1207
+ * @param int $post_id
1208
+ * @param object $post
1209
+ * @return int|void
1210
+ */
1211
+ function save_form_meta( $post_id, $post, $update ) {
1212
+
1213
+ do_action( 'wpuf_check_post_type', $post, $update );
1214
+
1215
+ if ( ! in_array( $post->post_type, array( 'wpuf_forms', 'wpuf_profile' ) ) ) {
1216
+ return;
1217
+ }
1218
+
1219
+ if ( !isset($_POST['wpuf_form_editor'] ) ) {
1220
+ return $post->ID;
1221
+ }
1222
+
1223
+ if ( !wp_verify_nonce( $_POST['wpuf_form_editor'], plugin_basename( __FILE__ ) ) ) {
1224
+ return $post->ID;
1225
+ }
1226
+
1227
+ // Is the user allowed to edit the post or page?
1228
+ if ( !current_user_can( 'edit_post', $post->ID ) ) {
1229
+ return $post->ID;
1230
+ }
1231
+
1232
+ $conditions = isset( $_POST['wpuf_cond'] ) ? $_POST['wpuf_cond'] : array();
1233
+
1234
+ if ( count( $conditions ) ) {
1235
+ foreach ($conditions as $key => $condition) {
1236
+ if ( $condition['condition_status'] == 'no' ) {
1237
+ unset( $conditions[$key] );
1238
+ }
1239
+ }
1240
+ }
1241
+
1242
+ $_POST['wpuf_input'] = isset( $_POST['wpuf_input'] ) ? $_POST['wpuf_input'] : array();
1243
+
1244
+ foreach ( $_POST['wpuf_input'] as $key => $field_val ) {
1245
+ if ( array_key_exists( 'options', $field_val) ) {
1246
+ $view_option = array();
1247
+
1248
+ foreach ( $field_val['options'] as $options_key => $options_value ) {
1249
+ $opt_value = ( $field_val['options_values'][$options_key] == '' ) ? $options_value : $field_val['options_values'][$options_key];
1250
+ $view_option[$opt_value] = $options_value;//$_POST['wpuf_input'][$key]['options'][$opt_value] = $options_value;
1251
+ }
1252
+
1253
+ unset($_POST['wpuf_input'][$key]['options_values']);
1254
+ $_POST['wpuf_input'][$key]['options'] = $view_option;
1255
+ }
1256
+
1257
+
1258
+ if ( $field_val['input_type'] == 'taxonomy' ) {
1259
+ $tax = get_terms( $field_val['name'], array(
1260
+ 'orderby' => 'count',
1261
+ 'hide_empty' => 0
1262
+ ) );
1263
+
1264
+ $tax = is_array( $tax ) ? $tax : array();
1265
+
1266
+ foreach($tax as $tax_obj) {
1267
+ $terms[$tax_obj->term_id] = $tax_obj->name;
1268
+ }
1269
+
1270
+ $_POST['wpuf_input'][$key]['options'] = $terms;
1271
+ $terms = '';
1272
+ }
1273
+ }
1274
+
1275
+ $contents = self::get_form_fields( $post->ID );
1276
+
1277
+ $db_id = wp_list_pluck( $contents, 'ID' );
1278
+
1279
+ $order = 0;
1280
+ foreach( $_POST['wpuf_input'] as $key => $content ) {
1281
+ $content['wpuf_cond'] = $_POST['wpuf_cond'][$key];
1282
+
1283
+ $field_id = isset( $content['id'] ) ? intval( $content['id'] ) : 0;
1284
+
1285
+ if ( $field_id ) {
1286
+ $compare_id[$field_id] = $field_id;
1287
+ unset( $content['id'] );
1288
+
1289
+ self::insert_form_field( $post->ID, $content, $field_id, $order );
1290
+
1291
+ } else {
1292
+ self::insert_form_field( $post->ID, $content, null, $order );
1293
+ }
1294
+
1295
+ $order++;
1296
+ }
1297
+
1298
+ // delete fields from previous form
1299
+ $del_post_id = array_diff_key( $db_id, $compare_id );
1300
+
1301
+ if ( $del_post_id ) {
1302
+
1303
+ foreach ($del_post_id as $key => $post_id ) {
1304
+ wp_delete_post( $post_id , true );
1305
+ }
1306
+
1307
+ } else if ( !count( $_POST['wpuf_input'] ) && count( $db_id ) ) {
1308
+
1309
+ foreach ( $db_id as $key => $post_id ) {
1310
+
1311
+ wp_delete_post( $post_id , true );
1312
+ }
1313
+ }
1314
+
1315
+ update_post_meta( $post->ID, $this->form_settings_key, $_POST['wpuf_settings'] );
1316
+ }
1317
+
1318
+ /**
1319
+ * Get form fields only
1320
+ *
1321
+ * @param int $form_id
1322
+ * @return array
1323
+ */
1324
+ public static function get_form_fields( $form_id ) {
1325
+
1326
+ $contents = get_children(array(
1327
+ 'post_parent' => $form_id,
1328
+ 'post_status' => 'publish',
1329
+ 'post_type' => 'wpuf_input',
1330
+ 'numberposts' => '-1',
1331
+ 'orderby' => 'menu_order',
1332
+ 'order' => 'ASC',
1333
+ ));
1334
+
1335
+ return $contents;
1336
+ }
1337
+
1338
+ /**
1339
+ * Edit form elements area for post
1340
+ *
1341
+ * @global object $post
1342
+ * @global string $pagenow
1343
+ */
1344
+ function edit_form_area() {
1345
+
1346
+ global $post, $pagenow, $form_inputs;
1347
+
1348
+ $form_inputs = wpuf_get_form_fields( $post->ID );
1349
+ ?>
1350
+
1351
+ <input type="hidden" name="wpuf_form_editor" id="wpuf_form_editor" value="<?php echo wp_create_nonce( plugin_basename( __FILE__ ) ); ?>" />
1352
+
1353
+ <div style="margin-bottom: 10px">
1354
+ <button class="button wpuf-collapse"><?php _e( 'Toggle All', 'wpuf' ); ?></button>
1355
+ </div>
1356
+
1357
+ <div class="wpuf-updated">
1358
+ <p><?php _e( 'Click on a form element to add to the editor', 'wpuf' ); ?></p>
1359
+ </div>
1360
+
1361
+ <ul id="wpuf-form-editor" class="wpuf-form-editor unstyled">
1362
+
1363
+ <?php
1364
+
1365
+ if ($form_inputs) {
1366
+
1367
+ $count = 0;
1368
+
1369
+ $con_fields = $this->get_conditional_fields( $form_inputs );
1370
+
1371
+ foreach ( $form_inputs as $order => $input_field ) {
1372
+
1373
+ $input_field['template'] = isset( $input_field['template'] ) ? $input_field['template'] : '';
1374
+ $method = $input_field['template'];
1375
+
1376
+ $name = ucwords( str_replace( '_', ' ', $input_field['template'] ) );
1377
+ if ( isset( $cond_inputs[$order] ) ) {
1378
+ $input_field = array_merge( $input_field, $cond_inputs[$order] );
1379
+ }
1380
+
1381
+ if ( $method == 'taxonomy') {
1382
+ WPUF_Admin_Template_Post::$method( $count, $name, $input_field['name'], $input_field );
1383
+
1384
+ } else if ( method_exists( 'WPUF_Admin_Template_Post', $method ) ) {
1385
+ WPUF_Admin_Template_Post::$method( $count, $name, $input_field );
1386
+
1387
+ } else {
1388
+ do_action( 'wpuf_admin_template_post_' . $input_field['template'], $name, $count, $input_field, 'WPUF_Admin_Template_Post', $this );
1389
+ }
1390
+
1391
+ $count++;
1392
+ }
1393
+ }
1394
+ ?>
1395
+ </ul>
1396
+
1397
+ <?php
1398
+ }
1399
+
1400
+ /**
1401
+ * Get all conditional fields
1402
+ *
1403
+ * @param array $fields
1404
+ * @return array
1405
+ */
1406
+ public static function get_conditional_fields( $fields ) {
1407
+
1408
+ $conditionals = array(
1409
+ 'fields' => array(),
1410
+ 'options' => array()
1411
+ );
1412
+
1413
+ foreach ($fields as $field) {
1414
+
1415
+ if ( !isset( $field['input_type'] ) ) {
1416
+ continue;
1417
+ }
1418
+
1419
+ if ( !in_array( $field['input_type'], array('select', 'radio', 'checkbox', 'taxonomy')) ) {
1420
+ continue;
1421
+ }
1422
+
1423
+ $conditionals['fields'][$field['name']] = $field['label'];
1424
+ $conditionals['options'][$field['name']] = $field['options'];
1425
+ }
1426
+
1427
+ return $conditionals;
1428
+ }
1429
+
1430
+ /**
1431
+ * Get only conditional options from fields
1432
+ *
1433
+ * @param array $fields
1434
+ * @return array
1435
+ */
1436
+ public static function get_conditional_option( $fields ) {
1437
+
1438
+ $conditionals = array(
1439
+ 'fields' => array(),
1440
+ 'options' => array()
1441
+ );
1442
+
1443
+ foreach ($fields as $field) {
1444
+
1445
+ if ( !in_array( $field['input_type'], array('select', 'radio', 'checkbox')) ) {
1446
+ continue;
1447
+ }
1448
+
1449
+ $conditionals['fields'][$field['name']] = $field['label'];
1450
+ $conditionals['options'][$field['name']] = $field['options'];
1451
+ }
1452
+
1453
+ return $conditionals;
1454
+ }
1455
+
1456
+ /**
1457
+ * Generate a conditional field dropdown
1458
+ *
1459
+ * @param array $fields
1460
+ * @return array
1461
+ */
1462
+ public static function get_conditional_fields_dropdown( $fields ) {
1463
+
1464
+ $options = array('' => '- select -');
1465
+
1466
+ if ( count( $fields ) ) {
1467
+
1468
+
1469
+
1470
+ foreach ($fields as $key => $label) {
1471
+ $options[$key] = $label;
1472
+ }
1473
+ }
1474
+
1475
+ return $options;
1476
+ }
1477
+
1478
+ /**
1479
+ * Generate a conditional field dropdown
1480
+ *
1481
+ * @param array $fields
1482
+ * @return array
1483
+ */
1484
+ public static function get_conditional_option_dropdown( $fields ) {
1485
+
1486
+ $options = array('' => '- select -');
1487
+
1488
+ if ( count( $fields ) ) {
1489
+ foreach ($fields as $key => $label) {
1490
+ $options[$key] = $label;
1491
+ }
1492
+ }
1493
+
1494
+ return $options;
1495
+ }
1496
+
1497
+ /**
1498
+ * Edit form elements area for profile
1499
+ *
1500
+ * @global object $post
1501
+ * @global string $pagenow
1502
+ */
1503
+ function edit_form_area_profile() {
1504
+
1505
+ ?>
1506
+ <input type="hidden" name="wpuf_form_editor" id="wpuf_form_editor" value="<?php echo wp_create_nonce( plugin_basename( __FILE__ ) ); ?>" />
1507
+ <?php
1508
+ do_action( 'wpuf_edit_form_area_profile' );
1509
+ }
1510
+
1511
+ /**
1512
+ * Ajax Callback handler for insrting fields in forms
1513
+ *
1514
+ * @return void
1515
+ */
1516
+ function ajax_post_add_element() {
1517
+
1518
+ $name = $_POST['name'];
1519
+ $type = $_POST['type'];
1520
+ $field_id = $_POST['order'];
1521
+
1522
+ switch ($name) {
1523
+ case 'post_title':
1524
+ WPUF_Admin_Template_Post::post_title( $field_id, 'Post Title');
1525
+ break;
1526
+
1527
+ case 'post_content':
1528
+ WPUF_Admin_Template_Post::post_content( $field_id, 'Post Body');
1529
+ break;
1530
+
1531
+ case 'post_excerpt':
1532
+ WPUF_Admin_Template_Post::post_excerpt( $field_id, 'Excerpt');
1533
+ break;
1534
+
1535
+ case 'tags':
1536
+ WPUF_Admin_Template_Post::post_tags( $field_id, 'Tags');
1537
+ break;
1538
+
1539
+ case 'featured_image':
1540
+ WPUF_Admin_Template_Post::featured_image( $field_id, 'Featured Image');
1541
+ break;
1542
+
1543
+ case 'custom_text':
1544
+ WPUF_Admin_Template_Post::text_field( $field_id, 'Custom field: Text');
1545
+ break;
1546
+
1547
+ case 'custom_textarea':
1548
+ WPUF_Admin_Template_Post::textarea_field( $field_id, 'Custom field: Textarea');
1549
+ break;
1550
+
1551
+ case 'custom_select':
1552
+ WPUF_Admin_Template_Post::dropdown_field( $field_id, 'Custom field: Select');
1553
+ break;
1554
+
1555
+ case 'custom_image':
1556
+ WPUF_Admin_Template::image_upload( $field_id, 'Custom field: Image' );
1557
+ break;
1558
+
1559
+ case 'custom_multiselect':
1560
+ WPUF_Admin_Template_Post::multiple_select( $field_id, 'Custom field: Multiselect');
1561
+ break;
1562
+
1563
+ case 'custom_radio':
1564
+ WPUF_Admin_Template_Post::radio_field( $field_id, 'Custom field: Radio');
1565
+ break;
1566
+
1567
+ case 'custom_checkbox':
1568
+ WPUF_Admin_Template_Post::checkbox_field( $field_id, 'Custom field: Checkbox');
1569
+ break;
1570
+
1571
+ case 'custom_url':
1572
+ WPUF_Admin_Template_Post::website_url( $field_id, 'Custom field: URL');
1573
+ break;
1574
+
1575
+ case 'custom_email':
1576
+ WPUF_Admin_Template_Post::email_address( $field_id, 'Custom field: E-Mail');
1577
+ break;
1578
+
1579
+ case 'custom_html':
1580
+ WPUF_Admin_Template_Post::custom_html( $field_id, 'HTML' );
1581
+ break;
1582
+
1583
+ case 'category':
1584
+ WPUF_Admin_Template_Post::taxonomy( $field_id, 'Category', $type );
1585
+ break;
1586
+
1587
+ case 'taxonomy':
1588
+ WPUF_Admin_Template_Post::taxonomy( $field_id, 'Taxonomy: ' . $type, $type );
1589
+ break;
1590
+
1591
+ case 'section_break':
1592
+ WPUF_Admin_Template_Post::section_break( $field_id, 'Section Break' );
1593
+ break;
1594
+
1595
+ case 'custom_hidden':
1596
+ WPUF_Admin_Template_Post::custom_hidden_field( $field_id, 'Hidden Field' );
1597
+ break;
1598
+
1599
+ case 'user_login':
1600
+ WPUF_Admin_Template_Profile::user_login( $field_id, __( 'Username', 'wpuf' ) );
1601
+ break;
1602
+
1603
+ case 'first_name':
1604
+ WPUF_Admin_Template_Profile::first_name( $field_id, __( 'First Name', 'wpuf' ) );
1605
+ break;
1606
+
1607
+ case 'last_name':
1608
+ WPUF_Admin_Template_Profile::last_name( $field_id, __( 'Last Name', 'wpuf' ) );
1609
+ break;
1610
+
1611
+ case 'nickname':
1612
+ WPUF_Admin_Template_Profile::nickname( $field_id, __( 'Nickname', 'wpuf' ) );
1613
+ break;
1614
+
1615
+ case 'user_email':
1616
+ WPUF_Admin_Template_Profile::user_email( $field_id, __( 'E-mail', 'wpuf' ) );
1617
+ break;
1618
+
1619
+ case 'user_url':
1620
+ WPUF_Admin_Template_Profile::user_url( $field_id, __( 'Website', 'wpuf' ) );
1621
+ break;
1622
+
1623
+ case 'user_bio':
1624
+ WPUF_Admin_Template_Profile::description( $field_id, __( 'Biographical Info', 'wpuf' ) );
1625
+ break;
1626
+
1627
+ case 'password':
1628
+ WPUF_Admin_Template_Profile::password( $field_id, __( 'Password', 'wpuf' ) );
1629
+ break;
1630
+
1631
+ case 'user_avatar':
1632
+ WPUF_Admin_Template_Profile::avatar( $field_id, __( 'Avatar', 'wpuf' ) );
1633
+ break;
1634
+
1635
+ default:
1636
+ do_action( 'wpuf_admin_field_' . $name, $type, $field_id, 'WPUF_Admin_Template_Post', $this );
1637
+ break;
1638
+ }
1639
+
1640
+ exit;
1641
+ }
1642
+
1643
+ }
admin/html/modal.php ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div id="wpuf-form-template-modal">
2
+ <div class="wpuf-form-template-modal">
3
+
4
+ <span id="modal-label" class="screen-reader-text"><?php _e( 'Modal window. Press escape to close.', 'erp' ); ?></span>
5
+ <a href="#" class="close">× <span class="screen-reader-text"><?php _e( 'Close modal window', 'erp' ); ?></span></a>
6
+
7
+ <header class="modal-header">
8
+ <h2>
9
+ <?php _e( 'Select a Template', 'wpuf' ); ?>
10
+ <small><?php
11
+ printf(
12
+ __( 'Select from a pre-defined template or from a <a href="%s">blank form</a>', 'wpuf' ),
13
+ admin_url( 'post-new.php?post_type=wpuf_forms' )
14
+ ); ?></small>
15
+ </h2>
16
+ </header>
17
+
18
+ <div class="content-container modal-footer">
19
+ <div class="content">
20
+
21
+ <ul>
22
+ <li class="blank-form">
23
+ <a href="<?php echo admin_url( 'post-new.php?post_type=wpuf_forms' ); ?>">
24
+ <span class="dashicons dashicons-plus"></span>
25
+ <div class="title"><?php _e( 'Blank Form', 'wpuf' ); ?></div>
26
+ </a>
27
+ </li>
28
+
29
+ <?php
30
+ foreach ($registry as $key => $template ) {
31
+ $class = 'template-active';
32
+ $title = '';
33
+ $url = esc_url( add_query_arg( array(
34
+ 'action' => 'wpuf_post_form_template',
35
+ 'template' => $key,
36
+ '_wpnonce' => wp_create_nonce( 'wpuf_create_from_template' )
37
+ ), admin_url( 'admin.php' ) ) );
38
+
39
+ if ( ! $template->is_enabled() ) {
40
+ $url = '#';
41
+ $class = 'template-inactive';
42
+ $title = __( 'This integration is not installed.', 'wpuf' );
43
+ }
44
+ ?>
45
+
46
+ <li class="<?php echo $class; ?>">
47
+ <a href="<?php echo $url; ?>" title="<?php echo esc_attr( $title ); ?>">
48
+ <div class="title"><?php echo $template->get_title(); ?></div>
49
+ <div class="description"><?php echo $template->get_description(); ?></div>
50
+ </a>
51
+ </li>
52
+
53
+ <?php } ?>
54
+ </ul>
55
+ </div>
56
+ </div>
57
+
58
+ <footer>
59
+ <?php printf( __( 'List of available templates can be found <a href="%s" target="_blank">here</a>.', 'wpuf' ), 'http://docs.wedevs.com/?p=3718' ); ?>
60
+ <?php printf( __( 'Want a new integration? <a href="%s" target="_blank">Let us know</a>.'), 'mailto:support@wedevs.com?subject=WPUF Custom Post Template Integration Request' ); ?>
61
+ </footer>
62
+ </div>
63
+ <div class="wpuf-form-template-modal-backdrop"></div>
64
+ </div>
65
+
66
+
67
+ <script type="text/javascript">
68
+ (function($) {
69
+ var popup = {
70
+ init: function() {
71
+ $('a.page-title-action').on('click', this.openModal);
72
+ $('.wpuf-form-template-modal-backdrop, .wpuf-form-template-modal .close').on('click', $.proxy(this.closeModal, this) );
73
+
74
+ $('body').on( 'keydown', $.proxy(this.onEscapeKey, this) );
75
+ },
76
+
77
+ openModal: function(e) {
78
+ e.preventDefault();
79
+
80
+ $('.wpuf-form-template-modal').show();
81
+ $('.wpuf-form-template-modal-backdrop').show();
82
+ },
83
+
84
+ onEscapeKey: function(e) {
85
+ if ( 27 === e.keyCode ) {
86
+ this.closeModal(e);
87
+ }
88
+ },
89
+
90
+ closeModal: function(e) {
91
+ if ( typeof e !== 'undefined' ) {
92
+ e.preventDefault();
93
+ }
94
+
95
+ $('.wpuf-form-template-modal').hide();
96
+ $('.wpuf-form-template-modal-backdrop').hide();
97
+ }
98
+ };
99
+
100
+ $(function() {
101
+ popup.init();
102
+ });
103
+
104
+ })(jQuery);
105
+ </script>
admin/installer.php ADDED
@@ -0,0 +1,310 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Page installer
5
+ *
6
+ * @since 2.3
7
+ */
8
+ class WPUF_Admin_Installer {
9
+
10
+ function __construct() {
11
+ add_action( 'admin_notices', array($this, 'admin_notice') );
12
+ add_action( 'admin_init', array($this, 'handle_request') );
13
+ }
14
+
15
+ /**
16
+ * Print admin notices
17
+ *
18
+ * @return void
19
+ */
20
+ function admin_notice() {
21
+ $page_created = get_option( '_wpuf_page_created' );
22
+
23
+ if ( $page_created != '1' ) {
24
+ ?>
25
+ <div class="updated error">
26
+ <p>
27
+ <?php _e( 'If you have not created <strong>WP User Frontend Pro</strong> pages yet, you can do this by one click.', 'wpuf' ); ?>
28
+ </p>
29
+ <p class="submit">
30
+ <a class="button button-primary" href="<?php echo add_query_arg( array( 'install_wpuf_pages' => true ), admin_url( 'admin.php?page=wpuf-settings' ) ); ?>"><?php _e( 'Install WPUF Pages', 'wpuf' ); ?></a>
31
+ or
32
+ <a class="button" href="<?php echo add_query_arg( array( 'wpuf_hide_page_nag' => true ) ); ?>"><?php _e( 'Skip Setup', 'wpuf' ); ?></a>
33
+ </p>
34
+ </div>
35
+ <?php
36
+ }
37
+
38
+ if ( isset( $_GET['wpuf_page_installed'] ) && $_GET['wpuf_page_installed'] == '1' ) {
39
+ ?>
40
+ <div class="updated">
41
+ <p>
42
+ <strong><?php _e( 'Congratulations!', 'wpuf' ); ?></strong> <?php _e( 'Pages for <strong>WP User Frontend Pro</strong> has been successfully installed and saved!', 'wpuf' ); ?>
43
+ </p>
44
+ </div>
45
+ <?php
46
+ }
47
+ }
48
+
49
+ /**
50
+ * Handle the page creation button requests
51
+ *
52
+ * @return void
53
+ */
54
+ function handle_request() {
55
+ if ( isset( $_GET['install_wpuf_pages'] ) && $_GET['install_wpuf_pages'] == '1' ) {
56
+ $this->init_pages();
57
+ }
58
+
59
+ if ( isset( $_GET['wpuf_hide_page_nag'] ) && $_GET['wpuf_hide_page_nag'] == '1' ) {
60
+ update_option( '_wpuf_page_created', '1' );
61
+ }
62
+ }
63
+
64
+ /**
65
+ * Initialize the plugin with some default page/settings
66
+ *
67
+ * @since 2.2
68
+ * @return void
69
+ */
70
+ function init_pages() {
71
+
72
+ // create a dashboard page
73
+ $dashboard_page = $this->create_page( __( 'Dashboard', 'wpuf' ), '[wpuf_dashboard]' );
74
+ $edit_page = $this->create_page( __( 'Edit', 'wpuf' ), '[wpuf_edit]' );
75
+
76
+ // login page
77
+ $login_page = $this->create_page( __( 'Login', 'wpuf' ), '[wpuf-login]' );
78
+
79
+ $post_form = $this->create_form();
80
+
81
+ // payment page
82
+ $subscr_page = $this->create_page( __( 'Subscription', 'wpuf' ), __( '[wpuf_sub_pack]') );
83
+ $payment_page = $this->create_page( __( 'Payment', 'wpuf' ), __( 'Please select a gateway for payment') );
84
+ $thank_page = $this->create_page( __( 'Thank You', 'wpuf' ), __( '<h1>Payment is complete</h1><p>Congratulations, your payment has been completed!</p>') );
85
+ $bank_page = $this->create_page( __( 'Order Received', 'wpuf' ), __( 'Hi, we have received your order. We will validate the order and will take necessary steps to move forward.') );
86
+
87
+ // save the settings
88
+ if ( $edit_page ) {
89
+ update_option( 'wpuf_general', array(
90
+ 'edit_page_id' => $edit_page,
91
+ 'default_post_form' => $post_form
92
+ ) );
93
+ }
94
+
95
+ // profile pages
96
+ $profile_options = array();
97
+ $reg_page = false;
98
+
99
+ if ( $login_page ) {
100
+ $profile_options['login_page'] = $login_page;
101
+ }
102
+
103
+ $data = apply_filters( 'wpuf_pro_page_install', $profile_options );
104
+
105
+ if ( is_array( $data ) ) {
106
+
107
+ if ( isset ( $data['profile_options'] ) ) {
108
+ $profile_options = $data['profile_options'];
109
+ }
110
+ if ( isset ( $data['reg_page'] ) ) {
111
+ $reg_page = $data['reg_page'];
112
+ }
113
+ }
114
+
115
+ if ( $login_page && $reg_page ) {
116
+ $profile_options['register_link_override'] = 'on';
117
+ }
118
+
119
+ update_option( 'wpuf_profile', $profile_options );
120
+
121
+ // payment pages
122
+ update_option( 'wpuf_payment', array(
123
+ 'subscription_page' => $subscr_page,
124
+ 'payment_page' => $payment_page,
125
+ 'payment_success' => $thank_page,
126
+ 'bank_success' => $bank_page
127
+ ) );
128
+
129
+ update_option( '_wpuf_page_created', '1' );
130
+
131
+ wp_redirect( admin_url( 'admin.php?page=wpuf-settings&wpuf_page_installed=1' ) );
132
+ exit;
133
+ }
134
+
135
+ /**
136
+ * Create a page with title and content
137
+ *
138
+ * @param string $page_title
139
+ * @param string $post_content
140
+ * @return false|int
141
+ */
142
+ function create_page( $page_title, $post_content = '', $post_type = 'page' ) {
143
+ $page_id = wp_insert_post( array(
144
+ 'post_title' => $page_title,
145
+ 'post_type' => $post_type,
146
+ 'post_status' => 'publish',
147
+ 'comment_status' => 'closed',
148
+ 'post_content' => $post_content
149
+ ) );
150
+
151
+ if ( $page_id && ! is_wp_error( $page_id ) ) {
152
+ return $page_id;
153
+ }
154
+
155
+ return false;
156
+ }
157
+
158
+ /**
159
+ * Create a basic registration form by default
160
+ *
161
+ * @return int|boolean
162
+ */
163
+ function create_reg_form() {
164
+ $form_id = $this->create_page( __( 'Registration', 'wpuf' ), '', 'wpuf_profile' );
165
+
166
+ if ( $form_id ) {
167
+ $form_fields = array(
168
+ array(
169
+ 'input_type' => 'email',
170
+ 'template' => 'user_email',
171
+ 'required' => 'yes',
172
+ 'label' => 'Email',
173
+ 'name' => 'user_email',
174
+ 'is_meta' => 'no',
175
+ 'help' => '',
176
+ 'css' => '',
177
+ 'placeholder' => '',
178
+ 'default' => '',
179
+ 'size' => '40',
180
+ 'wpuf_cond' => NULL,
181
+ ),
182
+ array(
183
+ 'input_type' => 'password',
184
+ 'template' => 'password',
185
+ 'required' => 'yes',
186
+ 'label' => 'Password',
187
+ 'name' => 'password',
188
+ 'is_meta' => 'no',
189
+ 'help' => '',
190
+ 'css' => '',
191
+ 'placeholder' => '',
192
+ 'default' => '',
193
+ 'size' => '40',
194
+ 'min_length' => '5',
195
+ 'repeat_pass' => 'yes',
196
+ 're_pass_label' => 'Confirm Password',
197
+ 'pass_strength' => 'yes',
198
+ 'wpuf_cond' => NULL
199
+ )
200
+ );
201
+
202
+ foreach ($form_fields as $order => $field) {
203
+ WPUF_Admin_Form::insert_form_field( $form_id, $field, false, $order );
204
+ }
205
+
206
+ update_post_meta( $form_id, 'wpuf_form_settings', array(
207
+ 'role' => 'subscriber',
208
+ 'redirect_to' => 'same',
209
+ 'message' => 'Registration successful',
210
+ 'update_message' => 'Profile updated successfully',
211
+ 'page_id' => '0',
212
+ 'url' => '',
213
+ 'submit_text' => 'Register',
214
+ 'update_text' => 'Update Profile'
215
+ ) );
216
+
217
+ return $form_id;
218
+ }
219
+
220
+ return false;
221
+ }
222
+
223
+ /**
224
+ * Create a post form
225
+ *
226
+ * @return void
227
+ */
228
+ function create_form() {
229
+ $form_id = $this->create_page( __( 'Sample Form', 'wpuf' ), '', 'wpuf_forms' );
230
+
231
+ if ( $form_id ) {
232
+ $form_fields = array(
233
+ array(
234
+ 'input_type' => 'text',
235
+ 'template' => 'post_title',
236
+ 'required' => 'yes',
237
+ 'label' => 'Post Title',
238
+ 'name' => 'post_title',
239
+ 'is_meta' => 'no',
240
+ 'help' => '',
241
+ 'css' => '',
242
+ 'placeholder' => '',
243
+ 'default' => '',
244
+ 'size' => '40',
245
+ 'wpuf_cond' => array( )
246
+ ),
247
+ array(
248
+ 'input_type' => 'textarea',
249
+ 'template' => 'post_content',
250
+ 'required' => 'yes',
251
+ 'label' => 'Post Content',
252
+ 'name' => 'post_content',
253
+ 'is_meta' => 'no',
254
+ 'help' => '',
255
+ 'css' => '',
256
+ 'rows' => '5',
257
+ 'cols' => '25',
258
+ 'placeholder' => '',
259
+ 'default' => '',
260
+ 'rich' => 'teeny',
261
+ 'insert_image' => 'yes',
262
+ 'wpuf_cond' => array( )
263
+ )
264
+ );
265
+
266
+ foreach ($form_fields as $order => $field) {
267
+ WPUF_Admin_Form::insert_form_field( $form_id, $field, false, $order );
268
+ }
269
+
270
+ $settings = array(
271
+ 'post_type' => 'post',
272
+ 'post_status' => 'publish',
273
+ 'post_format' => '0',
274
+ 'default_cat' => '-1',
275
+ 'guest_post' => 'false',
276
+ 'guest_details' => 'true',
277
+ 'name_label' => 'Name',
278
+ 'email_label' => 'Email',
279
+ 'message_restrict' => 'This page is restricted. Please Log in / Register to view this page.',
280
+ 'redirect_to' => 'post',
281
+ 'message' => 'Post saved',
282
+ 'page_id' => '',
283
+ 'url' => '',
284
+ 'comment_status' => 'open',
285
+ 'submit_text' => 'Submit',
286
+ 'draft_post' => 'false',
287
+ 'edit_post_status' => 'publish',
288
+ 'edit_redirect_to' => 'same',
289
+ 'update_message' => 'Post updated successfully',
290
+ 'edit_page_id' => '',
291
+ 'edit_url' => '',
292
+ 'subscription' => '- Select -',
293
+ 'update_text' => 'Update',
294
+ 'notification' => array(
295
+ 'new' => 'on',
296
+ 'new_to' => get_option( 'admin_email' ),
297
+ 'new_subject' => 'New post created',
298
+ 'new_body' => "Hi Admin, \r\n\r\nA new post has been created in your site %sitename% (%siteurl%). \r\n\r\nHere is the details: \r\nPost Title: %post_title% \r\nContent: %post_content% \r\nAuthor: %author% \r\nPost URL: %permalink% \r\nEdit URL: %editlink%",
299
+ 'edit' => 'off',
300
+ 'edit_to' => get_option( 'admin_email' ),
301
+ 'edit_subject' => 'A post has been edited',
302
+ 'edit_body' => "Hi Admin, \r\n\r\nThe post \"%post_title%\" has been updated. \r\n\r\nHere is the details: \r\nPost Title: %post_title% \r\nContent: %post_content% \r\nAuthor: %author% \r\nPost URL: %permalink% \r\nEdit URL: %editlink%",
303
+ ),
304
+ );
305
+
306
+ update_post_meta( $form_id, 'wpuf_form_settings', $settings );
307
+ }
308
+ }
309
+
310
+ }
admin/posting.php ADDED
@@ -0,0 +1,267 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Admin side posting handler
5
+ *
6
+ * Builds custom fields UI for post add/edit screen
7
+ * and handles value saving.
8
+ *
9
+ * @package WP User Frontend
10
+ */
11
+ class WPUF_Admin_Posting extends WPUF_Render_Form {
12
+
13
+ function __construct() {
14
+ add_action( 'add_meta_boxes', array($this, 'add_meta_boxes') );
15
+ add_action( 'admin_enqueue_scripts', array($this, 'enqueue_script') );
16
+
17
+ add_action( 'save_post', array($this, 'save_meta'), 1, 2 ); // save the custom fields
18
+ }
19
+
20
+ function enqueue_script() {
21
+ global $pagenow;
22
+
23
+ if ( !in_array( $pagenow, array('profile.php', 'post-new.php', 'post.php', 'user-edit.php') ) ) {
24
+ return;
25
+ }
26
+
27
+ $scheme = is_ssl() ? 'https' : 'http';
28
+ $api_key = wpuf_get_option( 'gmap_api_key', 'wpuf_general' );
29
+
30
+ wp_enqueue_style( 'jquery-ui', WPUF_ASSET_URI . '/css/jquery-ui-1.9.1.custom.css' );
31
+
32
+ wp_enqueue_script( 'jquery-ui-datepicker' );
33
+ wp_enqueue_script( 'jquery-ui-slider' );
34
+ wp_enqueue_script( 'jquery-ui-timepicker', WPUF_ASSET_URI . '/js/jquery-ui-timepicker-addon.js', array('jquery-ui-datepicker') );
35
+
36
+ if ( !empty( $api_key ) ) {
37
+ wp_enqueue_script( 'google-maps', $scheme . '://maps.google.com/maps/api/js?key='.$api_key, array(), null );
38
+ }else{
39
+ add_action('admin_head', 'wpuf_hide_google_map_button');
40
+
41
+ function wpuf_hide_google_map_button() {
42
+ echo "<style>
43
+ button.button[data-name='custom_map'] {
44
+ display: none;
45
+ }
46
+ </style>";
47
+ }
48
+ }
49
+
50
+ wp_enqueue_script( 'wpuf-upload', WPUF_ASSET_URI . '/js/upload.js', array('jquery', 'plupload-handlers') );
51
+ wp_localize_script( 'wpuf-upload', 'wpuf_frontend_upload', array(
52
+ 'confirmMsg' => __( 'Are you sure?', 'wpuf' ),
53
+ 'ajaxurl' => admin_url( 'admin-ajax.php' ),
54
+ 'nonce' => wp_create_nonce( 'wpuf_nonce' ),
55
+ 'plupload' => array(
56
+ 'url' => admin_url( 'admin-ajax.php' ) . '?nonce=' . wp_create_nonce( 'wpuf-upload-nonce' ),
57
+ 'flash_swf_url' => includes_url( 'js/plupload/plupload.flash.swf' ),
58
+ 'filters' => array(array('title' => __( 'Allowed Files' ), 'extensions' => '*')),
59
+ 'multipart' => true,
60
+ 'urlstream_upload' => true,
61
+ 'warning' => __( 'Maximum number of files reached!', 'wpuf' ),
62
+ 'size_error' => __( 'The file you have uploaded exceeds the file size limit. Please try again.', 'wpuf' ),
63
+ 'type_error' => __( 'You have uploaded an incorrect file type. Please try again.', 'wpuf' )
64
+ )
65
+ ) );
66
+ }
67
+
68
+ function add_meta_boxes() {
69
+ $post_types = get_post_types( array('public' => true) );
70
+
71
+ foreach ($post_types as $post_type) {
72
+ add_meta_box( 'wpuf-custom-fields', __( 'WPUF Custom Fields', 'wpuf' ), array($this, 'render_form'), $post_type, 'normal', 'high' );
73
+ }
74
+ }
75
+
76
+ function hide_form() {
77
+ ?>
78
+ <style type="text/css">
79
+ #wpuf-custom-fields { display: none; }
80
+ </style>
81
+ <?php
82
+ }
83
+
84
+ function render_form( $form_id, $post_id = null, $preview = false) {
85
+ global $post;
86
+
87
+ $form_id = get_post_meta( $post->ID, '_wpuf_form_id', true );
88
+ $form_settings = wpuf_get_form_settings( $form_id );
89
+
90
+
91
+ // hide the metabox itself if no form ID is set
92
+ if ( !$form_id ) {
93
+ $this->hide_form();
94
+ return;
95
+ }
96
+
97
+ list($post_fields, $taxonomy_fields, $custom_fields) = $this->get_input_fields( $form_id );
98
+
99
+ if ( empty( $custom_fields ) ) {
100
+ _e( 'No custom fields found.', 'wpuf' );
101
+ return;
102
+ }
103
+ ?>
104
+
105
+ <input type="hidden" name="wpuf_cf_update" value="<?php echo wp_create_nonce( plugin_basename( __FILE__ ) ); ?>" />
106
+ <input type="hidden" name="wpuf_cf_form_id" value="<?php echo $form_id; ?>" />
107
+
108
+ <table class="form-table wpuf-cf-table">
109
+ <tbody>
110
+ <?php
111
+ $this->render_items( $custom_fields, $post->ID, 'post', $form_id, $form_settings );
112
+ ?>
113
+ </tbody>
114
+ </table>
115
+ <?php
116
+ $this->scripts_styles();
117
+ }
118
+
119
+ /**
120
+ * Prints form input label
121
+ *
122
+ * @param string $attr
123
+ */
124
+ function label( $attr, $post_id = 0 ) {
125
+ ?>
126
+ <?php echo $attr['label'] . $this->required_mark( $attr ); ?>
127
+ <?php
128
+ }
129
+
130
+ function render_item_before( $form_field, $post_id = 0 ) {
131
+ echo '<tr>';
132
+ echo '<th><strong>';
133
+ $this->label( $form_field );
134
+ echo '</strong></th>';
135
+ echo '<td>';
136
+ }
137
+
138
+ function render_item_after( $form_field ) {
139
+ echo '</td>';
140
+ echo '</tr>';
141
+ }
142
+
143
+ function scripts_styles() {
144
+ ?>
145
+ <script type="text/javascript">
146
+ jQuery(function($){
147
+ var wpuf = {
148
+ init: function() {
149
+ $('.wpuf-cf-table').on('click', 'img.wpuf-clone-field', this.cloneField);
150
+ $('.wpuf-cf-table').on('click', 'img.wpuf-remove-field', this.removeField);
151
+ $('.wpuf-cf-table').on('click', 'a.wpuf-delete-avatar', this.deleteAvatar);
152
+ },
153
+ cloneField: function(e) {
154
+ e.preventDefault();
155
+
156
+ var $div = $(this).closest('tr');
157
+ var $clone = $div.clone();
158
+ // console.log($clone);
159
+
160
+ //clear the inputs
161
+ $clone.find('input').val('');
162
+ $clone.find(':checked').attr('checked', '');
163
+ $div.after($clone);
164
+ },
165
+
166
+ removeField: function() {
167
+ //check if it's the only item
168
+ var $parent = $(this).closest('tr');
169
+ var items = $parent.siblings().andSelf().length;
170
+
171
+ if( items > 1 ) {
172
+ $parent.remove();
173
+ }
174
+ },
175
+
176
+ deleteAvatar: function(e) {
177
+ e.preventDefault();
178
+
179
+ var data = {
180
+ action: 'wpuf_delete_avatar',
181
+ user_id : $('#profile-page').find('#user_id').val(),
182
+ _wpnonce: '<?php echo wp_create_nonce( 'wpuf_nonce' ); ?>'
183
+ };
184
+
185
+ if ( confirm( $(this).data('confirm') ) ) {
186
+ $.post(ajaxurl, data, function() {
187
+ window.location.reload();
188
+ });
189
+ }
190
+ }
191
+ };
192
+
193
+ wpuf.init();
194
+ });
195
+
196
+ </script>
197
+ <style type="text/css">
198
+ ul.wpuf-attachment-list li {
199
+ display: inline-block;
200
+ border: 1px solid #dfdfdf;
201
+ padding: 5px;
202
+ -webkit-border-radius: 5px;
203
+ -moz-border-radius: 5px;
204
+ border-radius: 5px;
205
+ margin-right: 5px;
206
+ }
207
+ ul.wpuf-attachment-list li a.attachment-delete {
208
+ text-decoration: none;
209
+ padding: 3px 12px;
210
+ border: 1px solid #C47272;
211
+ color: #ffffff;
212
+ text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
213
+ -webkit-border-radius: 3px;
214
+ -moz-border-radius: 3px;
215
+ border-radius: 3px;
216
+ background-color: #da4f49;
217
+ background-image: -moz-linear-gradient(top, #ee5f5b, #bd362f);
218
+ background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ee5f5b), to(#bd362f));
219
+ background-image: -webkit-linear-gradient(top, #ee5f5b, #bd362f);
220
+ background-image: -o-linear-gradient(top, #ee5f5b, #bd362f);
221
+ background-image: linear-gradient(to bottom, #ee5f5b, #bd362f);
222
+ background-repeat: repeat-x;
223
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffee5f5b', endColorstr='#ffbd362f', GradientType=0);
224
+ border-color: #bd362f #bd362f #802420;
225
+ border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
226
+ *background-color: #bd362f;
227
+ filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
228
+ }
229
+ ul.wpuf-attachment-list li a.attachment-delete:hover,
230
+ ul.wpuf-attachment-list li a.attachment-delete:active {
231
+ color: #ffffff;
232
+ background-color: #bd362f;
233
+ *background-color: #a9302a;
234
+ }
235
+
236
+ .wpuf-cf-table table th,
237
+ .wpuf-cf-table table td{
238
+ padding-left: 0 !important;
239
+ }
240
+
241
+ .wpuf-cf-table .required { color: red;}
242
+ .wpuf-cf-table textarea { width: 400px; }
243
+
244
+ </style>
245
+ <?php
246
+ }
247
+
248
+ // Save the Metabox Data
249
+ function save_meta( $post_id, $post ) {
250
+ if ( !isset( $_POST['wpuf_cf_update'] ) ) {
251
+ return $post->ID;
252
+ }
253
+
254
+ if ( !wp_verify_nonce( $_POST['wpuf_cf_update'], plugin_basename( __FILE__ ) ) ) {
255
+ return $post->ID;
256
+ }
257
+
258
+ // Is the user allowed to edit the post or page?
259
+ if ( !current_user_can( 'edit_post', $post->ID ) )
260
+ return $post->ID;
261
+
262
+ list( $post_vars, $tax_vars, $meta_vars ) = self::get_input_fields( $_POST['wpuf_cf_form_id'] );
263
+
264
+ WPUF_Frontend_Form_Post::update_post_meta( $meta_vars, $post->ID );
265
+ }
266
+
267
+ }
admin/settings-options.php ADDED
@@ -0,0 +1,426 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Settings Sections
5
+ *
6
+ * @since 1.0
7
+ * @return array
8
+ */
9
+ function wpuf_settings_sections() {
10
+ $sections = array(
11
+ array(
12
+ 'id' => 'wpuf_general',
13
+ 'title' => __( 'General Options', 'wpuf' )
14
+ ),
15
+ array(
16
+ 'id' => 'wpuf_dashboard',
17
+ 'title' => __( 'Dashboard', 'wpuf' )
18
+ ),
19
+ array(
20
+ 'id' => 'wpuf_profile',
21
+ 'title' => __( 'Login / Registration', 'wpuf' )
22
+ ),
23
+ array(
24
+ 'id' => 'wpuf_payment',
25
+ 'title' => __( 'Payments', 'wpuf' )
26
+ ),
27
+ array(
28
+ 'id' => 'wpuf_support',
29
+ 'title' => __( 'Support', 'wpuf' )
30
+ ),
31
+ );
32
+
33
+ return apply_filters( 'wpuf_settings_sections', $sections );
34
+ }
35
+
36
+ function wpuf_settings_fields() {
37
+ $pages = wpuf_get_pages();
38
+ $users = wpuf_list_users();
39
+
40
+ $settings_fields = array(
41
+ 'wpuf_general' => apply_filters( 'wpuf_options_others', array(
42
+ array(
43
+ 'name' => 'fixed_form_element',
44
+ 'label' => __( 'Fixed Form Elements ', 'wpuf' ),
45
+ 'desc' => __( 'Show fixed form elements sidebar in form editor', 'wpuf' ),
46
+ 'type' => 'checkbox',
47
+ 'default' => 'on'
48
+ ),
49
+ array(
50
+ 'name' => 'edit_page_id',
51
+ 'label' => __( 'Edit Page', 'wpuf' ),
52
+ 'desc' => __( 'Select the page where [wpuf_edit] is located', 'wpuf' ),
53
+ 'type' => 'select',
54
+ 'options' => $pages
55
+ ),
56
+ array(
57
+ 'name' => 'default_post_owner',
58
+ 'label' => __( 'Default Post Owner', 'wpuf' ),
59
+ 'desc' => __( 'If guest post is enabled and user details are OFF, the posts are assigned to this user', 'wpuf' ),
60
+ 'type' => 'select',
61
+ 'options' => $users,
62
+ 'default' => '1'
63
+ ),
64
+ array(
65
+ 'name' => 'admin_access',
66
+ 'label' => __( 'Admin area access', 'wpuf' ),
67
+ 'desc' => __( 'Allow you to block specific user role to WordPress admin area.', 'wpuf' ),
68
+ 'type' => 'select',
69
+ 'default' => 'read',
70
+ 'options' => array(
71
+ 'manage_options' => __( 'Admin Only', 'wpuf' ),
72
+ 'edit_others_posts' => __( 'Admins, Editors', 'wpuf' ),
73
+ 'publish_posts' => __( 'Admins, Editors, Authors', 'wpuf' ),
74
+ 'edit_posts' => __( 'Admins, Editors, Authors, Contributors', 'wpuf' ),
75
+ 'read' => __( 'Default', 'wpuf' )
76
+ )
77
+ ),
78
+ array(
79
+ 'name' => 'override_editlink',
80
+ 'label' => __( 'Override the post edit link', 'wpuf' ),
81
+ 'desc' => __( 'Users see the edit link in post if s/he is capable to edit the post/page. Selecting <strong>Yes</strong> will override the default WordPress edit post link in frontend', 'wpuf' ),
82
+ 'type' => 'select',
83
+ 'default' => 'yes',
84
+ 'options' => array(
85
+ 'yes' => __( 'Yes', 'wpuf' ),
86
+ 'no' => __( 'No', 'wpuf' )
87
+ )
88
+ ),
89
+ array(
90
+ 'name' => 'cf_show_front',
91
+ 'label' => __( 'Custom Fields in post', 'wpuf' ),
92
+ 'desc' => __( 'Show custom fields on post content area', 'wpuf' ),
93
+ 'type' => 'checkbox',
94
+ 'default' => 'off'
95
+ ),
96
+ array(
97
+ 'name' => 'load_script',
98
+ 'label' => __( 'Load Scripts', 'wpuf' ),
99
+ 'desc' => __( 'Load scripts/styles in all pages', 'wpuf' ),
100
+ 'type' => 'checkbox',
101
+ 'default' => 'on'
102
+ ),
103
+ array(
104
+ 'name' => 'insert_photo_size',
105
+ 'label' => __( 'Insert Photo image size', 'wpuf' ),
106
+ 'desc' => __( 'Default image size of "<strong>Insert Photo</strong>" button in post content area', 'wpuf' ),
107
+ 'type' => 'select',
108
+ 'options' => wpuf_get_image_sizes(),
109
+ 'default' => 'thumbnail'
110
+ ),
111
+ array(
112
+ 'name' => 'insert_photo_type',
113
+ 'label' => __( 'Insert Photo image type', 'wpuf' ),
114
+ 'desc' => __( 'Default image type of "<strong>Insert Photo</strong>" button in post content area', 'wpuf' ),
115
+ 'type' => 'select',
116
+ 'options' => array(
117
+ 'image' => __( 'Image only', 'wpuf' ),
118
+ 'link' => __( 'Image with link', 'wpuf' )
119
+ ),
120
+ 'default' => 'link'
121
+ ),
122
+ array(
123
+ 'name' => 'image_caption',
124
+ 'label' => __( 'Enable Image Caption', 'wpuf' ),
125
+ 'desc' => __( 'Allow users to update image/video title, caption and description', 'wpuf' ),
126
+ 'type' => 'checkbox',
127
+ 'default' => 'off'
128
+ ),
129
+ array(
130
+ 'name' => 'default_post_form',
131
+ 'label' => __( 'Default Post Form', 'wpuf' ),
132
+ 'desc' => __( 'Fallback form for post editing if no associated form found', 'wpuf' ),
133
+ 'type' => 'select',
134
+ 'options' => wpuf_get_pages( 'wpuf_forms' )
135
+ ),
136
+ array(
137
+ 'name' => 'recaptcha_public',
138
+ 'label' => __( 'reCAPTCHA Public Key', 'wpuf' ),
139
+ ),
140
+ array(
141
+ 'name' => 'recaptcha_private',
142
+ 'label' => __( 'reCAPTCHA Private Key', 'wpuf' ),
143
+ ),
144
+ array(
145
+ 'name' => 'gmap_api_key',
146
+ 'label' => __( 'Google Map API', 'wpuf' ),
147
+ 'desc' => __( '<a target="_blank" href="https://developers.google.com/maps/documentation/javascript">API</a> key is needed to render Google Maps', 'wpuf' ),
148
+ ),
149
+ array(
150
+ 'name' => 'custom_css',
151
+ 'label' => __( 'Custom CSS codes', 'wpuf' ),
152
+ 'desc' => __( 'If you want to add your custom CSS code, it will be added on page header wrapped with style tag', 'wpuf' ),
153
+ 'type' => 'textarea'
154
+ ),
155
+ ) ),
156
+ 'wpuf_dashboard' => apply_filters( 'wpuf_options_dashboard', array(
157
+ array(
158
+ 'name' => 'enable_post_edit',
159
+ 'label' => __( 'Users can edit post?', 'wpuf' ),
160
+ 'desc' => __( 'Users will be able to edit their own posts', 'wpuf' ),
161
+ 'type' => 'select',
162
+ 'default' => 'yes',
163
+ 'options' => array(
164
+ 'yes' => __( 'Yes', 'wpuf' ),
165
+ 'no' => __( 'No', 'wpuf' )
166
+ )
167
+ ),
168
+ array(
169
+ 'name' => 'enable_post_del',
170
+ 'label' => __( 'User can delete post?', 'wpuf' ),
171
+ 'desc' => __( 'Users will be able to delete their own posts', 'wpuf' ),
172
+ 'type' => 'select',
173
+ 'default' => 'yes',
174
+ 'options' => array(
175
+ 'yes' => __( 'Yes', 'wpuf' ),
176
+ 'no' => __( 'No', 'wpuf' )
177
+ )
178
+ ),
179
+ array(
180
+ 'name' => 'disable_pending_edit',
181
+ 'label' => __( 'Pending Post Edit', 'wpuf' ),
182
+ 'desc' => __( 'Disable post editing while post in "pending" status', 'wpuf' ),
183
+ 'type' => 'checkbox',
184
+ 'default' => 'on'
185
+ ),
186
+ array(
187
+ 'name' => 'per_page',
188
+ 'label' => __( 'Posts per page', 'wpuf' ),
189
+ 'desc' => __( 'How many posts will be listed in a page', 'wpuf' ),
190
+ 'type' => 'text',
191
+ 'default' => '10'
192
+ ),
193
+ array(
194
+ 'name' => 'show_user_bio',
195
+ 'label' => __( 'Show user bio', 'wpuf' ),
196
+ 'desc' => __( 'Users biographical info will be shown', 'wpuf' ),
197
+ 'type' => 'checkbox',
198
+ 'default' => 'on'
199
+ ),
200
+ array(
201
+ 'name' => 'show_post_count',
202
+ 'label' => __( 'Show post count', 'wpuf' ),
203
+ 'desc' => __( 'Show how many posts are created by the user', 'wpuf' ),
204
+ 'type' => 'checkbox',
205
+ 'default' => 'on'
206
+ ),
207
+ array(
208
+ 'name' => 'show_ft_image',
209
+ 'label' => __( 'Show Featured Image', 'wpuf' ),
210
+ 'desc' => __( 'Show featured image of the post', 'wpuf' ),
211
+ 'type' => 'checkbox'
212
+ ),
213
+ array(
214
+ 'name' => 'ft_img_size',
215
+ 'label' => __( 'Featured Image size', 'wpuf' ),
216
+ 'type' => 'select',
217
+ 'options' => wpuf_get_image_sizes()
218
+ ),
219
+ array(
220
+ 'name' => 'un_auth_msg',
221
+ 'label' => __( 'Unauthorized Message', 'wpuf' ),
222
+ 'desc' => __( 'Not logged in users will see this message', 'wpuf' ),
223
+ 'type' => 'textarea'
224
+ ),
225
+ ) ),
226
+ 'wpuf_profile' => array(
227
+ array(
228
+ 'name' => 'autologin_after_registration',
229
+ 'label' => __( 'Auto Login After Registration', 'wpuf' ),
230
+ 'desc' => __( 'If enabled, users after registration will be logged in to the system', 'wpuf' ),
231
+ 'type' => 'checkbox',
232
+ 'default' => 'off'
233
+ ),
234
+ array(
235
+ 'name' => 'register_link_override',
236
+ 'label' => __( 'Login/Registration override', 'wpuf' ),
237
+ 'desc' => __( 'If enabled, default login and registration forms will be overridden by WPUF with pages below', 'wpuf' ),
238
+ 'type' => 'checkbox',
239
+ 'default' => 'off'
240
+ ),
241
+ array(
242
+ 'name' => 'reg_override_page',
243
+ 'label' => __( 'Registration Page', 'wpuf' ),
244
+ 'desc' => __( 'Select the page you want to use as registration page override <em>(should have shortcode)</em>', 'wpuf' ),
245
+ 'type' => 'select',
246
+ 'options' => $pages
247
+ ),
248
+ array(
249
+ 'name' => 'login_page',
250
+ 'label' => __( 'Login Page', 'wpuf' ),
251
+ 'desc' => __( 'Select the page which contains <code>[wpuf-login]</code> shortcode', 'wpuf' ),
252
+ 'type' => 'select',
253
+ 'options' => $pages
254
+ ),
255
+ ),
256
+ 'wpuf_payment' => apply_filters( 'wpuf_options_payment', array(
257
+ array(
258
+ 'name' => 'charge_posting',
259
+ 'label' => __( 'Charge for posting', 'wpuf' ),
260
+ 'desc' => __( 'Charge user for submitting a post', 'wpuf' ),
261
+ 'type' => 'select',
262
+ 'default' => 'no',
263
+ 'options' => array(
264
+ 'yes' => __( 'Yes', 'wpuf' ),
265
+ 'no' => __( 'No', 'wpuf' )
266
+ )
267
+ ),
268
+ array(
269
+ 'name' => 'force_pack',
270
+ 'label' => __( 'Force pack purchase', 'wpuf' ),
271
+ 'desc' => __( 'When active, users must have to buy a pack for posting', 'wpuf' ),
272
+ 'type' => 'select',
273
+ 'default' => 'no',
274
+ 'options' => array(
275
+ 'no' => __( 'Disable', 'wpuf' ),
276
+ 'yes' => __( 'Enable', 'wpuf' )
277
+ )
278
+ ),
279
+ array(
280
+ 'name' => 'subscription_page',
281
+ 'label' => __( 'Subscription Pack Page', 'wpuf' ),
282
+ 'desc' => __( 'Select the page where <code>[wpuf_sub_pack]</code> located.', 'wpuf' ),
283
+ 'type' => 'select',
284
+ 'options' => $pages
285
+ ),
286
+ array(
287
+ 'name' => 'register_subscription',
288
+ 'label' => __( 'Subscription at registration', 'wpuf' ),
289
+ 'desc' => __( 'Registration time redirect to subscription page', 'wpuf' ),
290
+ 'type' => 'checkbox',
291
+ ),
292
+ array(
293
+ 'name' => 'currency',
294
+ 'label' => __( 'Currency', 'wpuf' ),
295
+ 'type' => 'select',
296
+ 'default' => 'USD',
297
+ 'options' => array(
298
+ 'AUD' => 'Australian Dollar',
299
+ 'CAD' => 'Canadian Dollar',
300
+ 'EUR' => 'Euro',
301
+ 'GBP' => 'British Pound',
302
+ 'JPY' => 'Japanese Yen',
303
+ 'USD' => 'U.S. Dollar',
304
+ 'NZD' => 'New Zealand Dollar',
305
+ 'CHF' => 'Swiss Franc',
306
+ 'HKD' => 'Hong Kong Dollar',
307
+ 'SGD' => 'Singapore Dollar',
308
+ 'SEK' => 'Swedish Krona',
309
+ 'DKK' => 'Danish Krone',
310
+ 'PLN' => 'Polish Zloty',
311
+ 'NOK' => 'Norwegian Krone',
312
+ 'HUF' => 'Hungarian Forint',
313
+ 'CZK' => 'Czech Koruna',
314
+ 'ILS' => 'Israeli New Shekel',
315
+ 'MXN' => 'Mexican Peso',
316
+ 'BRL' => 'Brazilian Real',
317
+ 'MYR' => 'Malaysian Ringgit',
318
+ 'PHP' => 'Philippine Peso',
319
+ 'TWD' => 'New Taiwan Dollar',
320
+ 'THB' => 'Thai Baht',
321
+ 'TRY' => 'Turkish Lira'
322
+ )
323
+ ),
324
+ array(
325
+ 'name' => 'currency_symbol',
326
+ 'label' => __( 'Currency Symbol', 'wpuf' ),
327
+ 'type' => 'text',
328
+ 'default' => '$'
329
+ ),
330
+ array(
331
+ 'name' => 'cost_per_post',
332
+ 'label' => __( 'Cost', 'wpuf' ),
333
+ 'desc' => __( 'Cost per post', 'wpuf' ),
334
+ 'type' => 'text',
335
+ 'default' => '2'
336
+ ),
337
+ array(
338
+ 'name' => 'sandbox_mode',
339
+ 'label' => __( 'Enable demo/sandbox mode', 'wpuf' ),
340
+ 'desc' => __( 'When sandbox mode is active, all payment gateway will be used in demo mode', 'wpuf' ),
341
+ 'type' => 'checkbox',
342
+ 'default' => 'on'
343
+ ),
344
+ array(
345
+ 'name' => 'payment_page',
346
+ 'label' => __( 'Payment Page', 'wpuf' ),
347
+ 'desc' => __( 'This page will be used to process payment options', 'wpuf' ),
348
+ 'type' => 'select',
349
+ 'options' => $pages
350
+ ),
351
+ array(
352
+ 'name' => 'payment_success',
353
+ 'label' => __( 'Payment Success Page', 'wpuf' ),
354
+ 'desc' => __( 'After payment users will be redirected here', 'wpuf' ),
355
+ 'type' => 'select',
356
+ 'options' => $pages
357
+ ),
358
+ array(
359
+ 'name' => 'active_gateways',
360
+ 'label' => __( 'Payment Gateways', 'wpuf' ),
361
+ 'desc' => __( 'Active payment gateways', 'wpuf' ),
362
+ 'type' => 'multicheck',
363
+ 'options' => wpuf_get_gateways()
364
+ )
365
+ ) ),
366
+ 'wpuf_support' => apply_filters( 'wpuf_options_support', array(
367
+ array(
368
+ 'name' => 'support',
369
+ 'label' => __( 'Need Help?', 'wpuf' ),
370
+ 'type' => 'html',
371
+ 'desc' => '
372
+ <ul>
373
+ <li>
374
+ <strong>Step 1: <a target="_blank" href="http://docs.wedevs.com/">Read Documentation and FAQ</a></strong>
375
+ <p>We have created detailed step by step documentation for all the features (including docs for developers). We have also answered all possible FAQ queries based on user request. We hope you will find what you are looking for. If not, please continue to Step 2.</p>
376
+ </li>
377
+ <br/>
378
+ <li>
379
+ <strong>Step 2: <a href="https://wedevs.com/account/ticket" target="_blank">Create a Support Ticket</a></strong>
380
+ <p>We reply from <code>10am to 6pm (GMT+6)</code> except <code><strong>Friday</strong></code>. Our responses are usually under 12 hours to as quick as 1 hour depending on channel pressure.</p>
381
+ <p>When you are creating a ticket, please care to include a screenshot of the issue if possible and write the problem as specificly as you can. This will help us track and solve your trouble quickly.
382
+ </p>
383
+ </li>
384
+ </ul>'
385
+ )
386
+ ) ),
387
+ );
388
+
389
+ return apply_filters( 'wpuf_settings_fields', $settings_fields );
390
+ }
391
+
392
+ function wpuf_settings_field_profile( $form ) {
393
+ $user_roles = wpuf_get_user_roles();
394
+ $forms = get_posts( array(
395
+ 'numberposts' => -1,
396
+ 'post_type' => 'wpuf_profile'
397
+ ) );
398
+
399
+ $val = get_option( 'wpuf_profile', array() );
400
+ ?>
401
+
402
+ <p style="padding-left: 10px; font-style: italic; font-size: 13px;">
403
+ <strong><?php _e( 'Select profile/registration forms for user roles. These forms will be used to populate extra edit profile fields in backend.', 'wpuf' ); ?></strong>
404
+ </p>
405
+ <table class="form-table">
406
+ <?php
407
+ foreach ($user_roles as $role => $name) {
408
+ $current = isset( $val['roles'][$role] ) ? $val['roles'][$role] : '';
409
+ ?>
410
+ <tr valign="top">
411
+ <th scrope="row"><?php echo $name; ?></th>
412
+ <td>
413
+ <select name="wpuf_profile[roles][<?php echo $role; ?>]">
414
+ <option value=""><?php _e( ' - select - ', 'wpuf' ); ?></option>
415
+ <?php foreach ($forms as $form) { ?>
416
+ <option value="<?php echo $form->ID; ?>"<?php selected( $current, $form->ID ); ?>><?php echo $form->post_title; ?></option>
417
+ <?php } ?>
418
+ </select>
419
+ </td>
420
+ </tr>
421
+ <?php } ?>
422
+ </table>
423
+ <?php
424
+ }
425
+
426
+ add_action( 'wsa_form_bottom_wpuf_profile', 'wpuf_settings_field_profile' );
admin/settings.php ADDED
@@ -0,0 +1,228 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * WordPress settings API demo class
5
+ *
6
+ * @author Tareq Hasan
7
+ */
8
+ class WPUF_Admin_Settings {
9
+
10
+ private $settings_api;
11
+ private static $_instance;
12
+
13
+ function __construct() {
14
+
15
+ if ( !class_exists( 'WeDevs_Settings_API' ) ) {
16
+ require_once dirname( dirname( __FILE__ ) ) . '/lib/class.settings-api.php';
17
+ }
18
+
19
+ $this->settings_api = new WeDevs_Settings_API();
20
+
21
+ add_action( 'admin_init', array($this, 'admin_init') );
22
+ add_action( 'admin_menu', array($this, 'admin_menu') );
23
+
24
+ add_filter( 'parent_file', array($this, 'fix_parent_menu' ) );
25
+
26
+ add_action( 'admin_init', array($this, 'handle_tools_action') );
27
+ }
28
+
29
+ public static function init() {
30
+ if ( !self::$_instance ) {
31
+ self::$_instance = new self();
32
+ }
33
+
34
+ return self::$_instance;
35
+ }
36
+
37
+ function admin_init() {
38
+
39
+ //set the settings
40
+ $this->settings_api->set_sections( $this->get_settings_sections() );
41
+ $this->settings_api->set_fields( $this->get_settings_fields() );
42
+
43
+ //initialize settings
44
+ $this->settings_api->admin_init();
45
+ }
46
+
47
+ /**
48
+ * Register the admin menu
49
+ *
50
+ * @since 1.0
51
+ */
52
+ function admin_menu() {
53
+ $capability = wpuf_admin_role();
54
+
55
+ add_menu_page( __( 'WP User Frontend', 'wpuf' ), __( 'User Frontend', 'wpuf' ), $capability, 'wpuf-admin-opt', array($this, 'plugin_page'), 'dashicons-exerpt-view', 55 );
56
+
57
+ /**
58
+ * @since 2.3
59
+ */
60
+ do_action( 'wpuf_admin_menu_top' );
61
+
62
+ add_submenu_page( 'wpuf-admin-opt', __( 'Subscription', 'wpuf' ), __( 'Subscription', 'wpuf' ), $capability, 'edit.php?post_type=wpuf_subscription' );
63
+
64
+ do_action( 'wpuf_admin_menu' );
65
+
66
+ add_submenu_page( 'wpuf-admin-opt', __( 'Transaction', 'wpuf' ), __( 'Transaction', 'wpuf' ), $capability, 'wpuf_transaction', array($this, 'transaction_page') );
67
+ add_submenu_page( 'wpuf-admin-opt', __( 'Add-ons', 'wpuf' ), __( 'Add-ons', 'wpuf' ), $capability, 'wpuf_addons', array($this, 'addons_page') );
68
+ add_submenu_page( 'wpuf-admin-opt', __( 'Tools', 'wpuf' ), __( 'Tools', 'wpuf' ), $capability, 'wpuf_tools', array($this, 'tools_page') );
69
+ add_submenu_page( 'wpuf-admin-opt', __( 'Settings', 'wpuf' ), __( 'Settings', 'wpuf' ), $capability, 'wpuf-settings', array($this, 'plugin_page') );
70
+ }
71
+
72
+ /**
73
+ * WPUF Settings sections
74
+ *
75
+ * @since 1.0
76
+ * @return array
77
+ */
78
+ function get_settings_sections() {
79
+ return wpuf_settings_sections();
80
+ }
81
+
82
+ /**
83
+ * Returns all the settings fields
84
+ *
85
+ * @return array settings fields
86
+ */
87
+ function get_settings_fields() {
88
+ return wpuf_settings_fields();
89
+ }
90
+
91
+ function plugin_page() {
92
+ ?>
93
+ <div class="wrap">
94
+
95
+ <?php screen_icon( 'options-general' ); ?>
96
+
97
+ <?php
98
+ settings_errors();
99
+
100
+ $this->settings_api->show_navigation();
101
+ $this->settings_api->show_forms();
102
+ ?>
103
+
104
+ </div>
105
+ <?php
106
+ }
107
+
108
+ function transaction_page() {
109
+ require_once dirname( dirname( __FILE__ ) ) . '/admin/transaction.php';
110
+ }
111
+
112
+ function subscription_page() {
113
+ require_once dirname( dirname( __FILE__ ) ) . '/admin/subscription.php';
114
+ }
115
+
116
+ function addons_page() {
117
+ require_once dirname( dirname( __FILE__ ) ) . '/admin/add-ons.php';
118
+ }
119
+
120
+ function tools_page() {
121
+ require_once dirname( dirname( __FILE__ ) ) . '/admin/tools.php';
122
+ }
123
+
124
+ /**
125
+ * highlight the proper top level menu
126
+ *
127
+ * @link http://wordpress.org/support/topic/moving-taxonomy-ui-to-another-main-menu?replies=5#post-2432769
128
+ * @global obj $current_screen
129
+ * @param string $parent_file
130
+ * @return string
131
+ */
132
+ function fix_parent_menu( $parent_file ) {
133
+ global $current_screen;
134
+
135
+ $post_types = array( 'wpuf_forms', 'wpuf_profile', 'wpuf_subscription', 'wpuf_coupon');
136
+
137
+ if ( in_array( $current_screen->post_type, $post_types ) ) {
138
+ $parent_file = 'wpuf-admin-opt';
139
+ }
140
+
141
+ return $parent_file;
142
+ }
143
+
144
+ /**
145
+ * Hanlde tools page action
146
+ *
147
+ * @return void
148
+ */
149
+ function handle_tools_action() {
150
+ if ( ! isset( $_GET['wpuf_action'] ) ) {
151
+ return;
152
+ }
153
+
154
+ check_admin_referer( 'wpuf-tools-action' );
155
+
156
+ if ( ! current_user_can( 'manage_options' ) ) {
157
+ return;
158
+ }
159
+
160
+ global $wpdb;
161
+
162
+ $action = $_GET['wpuf_action'];
163
+ $message = 'del_forms';
164
+
165
+ switch ($action) {
166
+ case 'clear_settings':
167
+ delete_option( 'wpuf_general' );
168
+ delete_option( 'wpuf_dashboard' );
169
+ delete_option( 'wpuf_profile' );
170
+ delete_option( 'wpuf_payment' );
171
+ delete_option( '_wpuf_page_created' );
172
+
173
+ $message = 'settings_cleared';
174
+ break;
175
+
176
+ case 'del_post_forms':
177
+ $this->delete_post_type( 'wpuf_forms' );
178
+ break;
179
+
180
+ case 'del_pro_forms':
181
+ $this->delete_post_type( 'wpuf_profile' );
182
+ break;
183
+
184
+ case 'del_subs':
185
+ $this->delete_post_type( 'wpuf_subscription' );
186
+ break;
187
+
188
+ case 'del_coupon':
189
+ $this->delete_post_type( 'wpuf_coupon' );
190
+ break;
191
+
192
+ case 'clear_transaction':
193
+ $wpdb->query( "TRUNCATE TABLE {$wpdb->prefix}wpuf_transaction");
194
+
195
+ $message = 'del_trans';
196
+ break;
197
+
198
+ default:
199
+ # code...
200
+ break;
201
+ }
202
+
203
+ wp_redirect( add_query_arg( array( 'msg' => $message ), admin_url( 'admin.php?page=wpuf_tools&action=tools' ) ) );
204
+ exit;
205
+ }
206
+
207
+ /**
208
+ * Delete all posts by a post type
209
+ *
210
+ * @param string $post_type
211
+ * @return void
212
+ */
213
+ function delete_post_type( $post_type ) {
214
+ $query = new WP_Query( array(
215
+ 'post_type' => $post_type,
216
+ 'posts_per_page' => -1,
217
+ 'post_status' => array( 'publish', 'draft', 'pending', 'trash' )
218
+ ) );
219
+
220
+ $posts = $query->get_posts();
221
+
222
+ if ( $posts ) {
223
+ foreach ($posts as $item) {
224
+ wp_delete_post( $item->ID, true );
225
+ }
226
+ }
227
+ }
228
+ }
admin/subscription.php ADDED
@@ -0,0 +1,610 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Manage Subscription packs
5
+ *
6
+ * @package WP User Frontend
7
+ */
8
+ class WPUF_Admin_Subscription {
9
+
10
+ private $table;
11
+ private $db;
12
+ public $baseurl;
13
+ private static $_instance;
14
+
15
+ public static function getInstance() {
16
+ if ( !self::$_instance ) {
17
+ self::$_instance = new WPUF_Admin_Subscription();
18
+ }
19
+
20
+ return self::$_instance;
21
+ }
22
+
23
+ function __construct() {
24
+ global $wpdb;
25
+
26
+ $this->db = $wpdb;
27
+ $this->table = $this->db->prefix . 'wpuf_subscription';
28
+ $this->baseurl = admin_url( 'admin.php?page=wpuf_subscription' );
29
+
30
+ add_filter( 'post_updated_messages', array($this, 'form_updated_message') );
31
+
32
+ add_action( 'show_user_profile', array($this, 'profile_subscription_details'), 30 );
33
+ add_action( 'edit_user_profile', array($this, 'profile_subscription_details'), 30 );
34
+ add_action( 'personal_options_update', array($this, 'profile_subscription_update') );
35
+ add_action( 'edit_user_profile_update', array($this, 'profile_subscription_update') );
36
+ add_action( 'wp_ajax_wpuf_delete_user_package', array($this, 'delete_user_package') );
37
+
38
+ add_filter('manage_wpuf_subscription_posts_columns', array( $this, 'subscription_columns_head') );
39
+
40
+ add_action('manage_wpuf_subscription_posts_custom_column', array( $this, 'subscription_columns_content' ),10, 2 );
41
+ }
42
+
43
+ /**
44
+ * Custom post update message
45
+ *
46
+ * @param array $messages
47
+ * @return array
48
+ */
49
+ function form_updated_message( $messages ) {
50
+ $message = array(
51
+ 0 => '',
52
+ 1 => __('Subscription pack updated.'),
53
+ 2 => __('Custom field updated.'),
54
+ 3 => __('Custom field deleted.'),
55
+ 4 => __('Subscription pack updated.'),
56
+ 5 => isset($_GET['revision']) ? sprintf( __('Subscription pack restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
57
+ 6 => __('Subscription pack published.'),
58
+ 7 => __('Subscription pack saved.'),
59
+ 8 => __('Subscription pack submitted.' ),
60
+ 9 => '',
61
+ 10 => __('Subscription pack draft updated.'),
62
+ );
63
+
64
+ $messages['wpuf_subscription'] = $message;
65
+
66
+ return $messages;
67
+ }
68
+
69
+ /**
70
+ * Update user profile lock
71
+ *
72
+ * @param int $user_id
73
+ */
74
+ function profile_subscription_update( $user_id ) {
75
+ if ( !is_admin() && !current_user_can( 'edit_users' ) ) {
76
+ return;
77
+ }
78
+
79
+ if ( !isset( $_POST['pack_id'] ) ) {
80
+ return;
81
+ }
82
+
83
+ $pack_id = $_POST['pack_id'];
84
+ $user_pack = WPUF_Subscription::get_user_pack( $_POST['user_id'] );
85
+ if ( isset ( $user_pack['pack_id'] ) && $pack_id == $user_pack['pack_id'] ) {
86
+ //updating number of posts
87
+
88
+ if( isset( $user_pack['posts'] ) ) {
89
+
90
+ foreach( $user_pack['posts'] as $post_type => $post_num ) {
91
+ $user_pack['posts'][$post_type] = $_POST[$post_type];
92
+ }
93
+
94
+ }
95
+
96
+ //post expiration enable or disable
97
+
98
+ if( isset( $_POST['is_post_expiration_enabled'] ) ) {
99
+ $user_pack['_enable_post_expiration'] = $_POST['is_post_expiration_enabled'];
100
+ } else {
101
+ unset($user_pack['_enable_post_expiration']);
102
+ }
103
+
104
+ //updating post time
105
+
106
+ if( isset( $_POST['post_expiration_settings'] ) ) {
107
+ echo $user_pack['_post_expiration_time'] = $_POST['post_expiration_settings']['expiration_time_value'].' '.$_POST['post_expiration_settings']['expiration_time_type'];
108
+ }
109
+ if ( isset( $user_pack['recurring'] ) && $user_pack['recurring'] == 'yes' ) {
110
+ foreach ( $user_pack['posts'] as $type => $value ) {
111
+ $user_pack['posts'][$type] = isset( $_POST[$type] ) ? $_POST[$type] : 0;
112
+ }
113
+ } else {
114
+ foreach ( $user_pack['posts'] as $type => $value ) {
115
+ $user_pack['posts'][$type] = isset( $_POST[$type] ) ? $_POST[$type] : 0;
116
+ }
117
+ $user_pack['expire'] = isset( $_POST['expire'] ) ? wpuf_date2mysql( $_POST['expire'] ) : $user_pack['expire'];
118
+ }
119
+ WPUF_Subscription::update_user_subscription_meta( $user_id, $user_pack );
120
+ } else {
121
+ if ( $pack_id == '-1' ) {
122
+ return;
123
+ }
124
+ WPUF_Subscription::init()->new_subscription( $user_id, $pack_id, null, false, $status = null );
125
+ }
126
+ }
127
+
128
+ function subscription_columns_content( $column_name, $post_ID ) {
129
+ switch ( $column_name ) {
130
+ case 'amount':
131
+
132
+ $amount = get_post_meta( $post_ID, '_billing_amount', true );
133
+ if ( intval($amount) == 0 ) {
134
+ $amount = __( 'Free', 'wpuf' );
135
+ } else {
136
+ $currency = wpuf_get_option( 'currency_symbol', 'wpuf_payment' );
137
+ $amount = $currency . $amount;
138
+ }
139
+ echo $amount;
140
+ break;
141
+
142
+ case 'recurring':
143
+
144
+ $recurring = get_post_meta( $post_ID, '_recurring_pay', true );
145
+ if ( $recurring == 'yes' ) {
146
+ _e( 'Yes', 'wpuf' );
147
+ } else {
148
+ _e( 'No', 'wpuf' );
149
+ }
150
+ break;
151
+
152
+ case 'duration':
153
+
154
+ $recurring_pay = get_post_meta( $post_ID, '_recurring_pay', true );
155
+ $billing_cycle_number = get_post_meta( $post_ID, '_billing_cycle_number', true );
156
+ $cycle_period = get_post_meta( $post_ID, '_cycle_period', true );
157
+ if ( $recurring_pay == 'yes' ) {
158
+ echo $billing_cycle_number .' '. $cycle_period . '\'s (cycle)';
159
+ } else {
160
+ $expiration_number = get_post_meta( $post_ID, '_expiration_number', true );
161
+ $expiration_period = get_post_meta( $post_ID, '_expiration_period', true );
162
+ echo $expiration_number .' '. $expiration_period . '\'s';
163
+ }
164
+ break;
165
+ }
166
+
167
+ }
168
+
169
+ function subscription_columns_head( $head ) {
170
+ unset($head['date']);
171
+ $head['title'] = __('Pack Name', 'wpuf' );
172
+ $head['amount'] = __( 'Amount', 'wpuf' );
173
+ $head['recurring'] = __( 'Recurring', 'wpuf' );
174
+ $head['duration'] = __( 'Duration', 'wpuf' );
175
+
176
+ return $head;
177
+ }
178
+
179
+ function get_packs() {
180
+ return $this->db->get_results( "SELECT * FROM {$this->table} ORDER BY created DESC" );
181
+ }
182
+
183
+ function get_pack( $pack_id ) {
184
+ return $this->db->get_row( $this->db->prepare( "SELECT * FROM {$this->table} WHERE id = %d", $pack_id ) );
185
+ }
186
+
187
+ function delete_pack( $pack_id ) {
188
+ $this->db->query( $this->db->prepare( "DELETE FROM {$this->table} WHERE id= %d", $pack_id ) );
189
+ }
190
+
191
+ function list_packs() {
192
+
193
+ //delete packs
194
+ if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == "del" ) {
195
+ check_admin_referer( 'wpuf_pack_del' );
196
+ $this->delete_pack( $_GET['id'] );
197
+ echo '<div class="updated fade" id="message"><p><strong>' . __( 'Pack Deleted', 'wpuf' ) . '</strong></p></div>';
198
+
199
+ echo '<script type="text/javascript">window.location.href = "' . $this->baseurl . '";</script>';
200
+ }
201
+ ?>
202
+
203
+ <table class="widefat meta" style="margin-top: 20px;">
204
+ <thead>
205
+ <tr>
206
+ <th scope="col"><?php _e( 'Name', 'wpuf' ); ?></th>
207
+ <th scope="col"><?php _e( 'Description', 'wpuf' ); ?></th>
208
+ <th scope="col"><?php _e( 'Cost', 'wpuf' ); ?></th>
209
+ <th scope="col"><?php _e( 'Validity', 'wpuf' ); ?></th>
210
+ <th scope="col"><?php _e( 'Post Count', 'wpuf' ); ?></th>
211
+ <th scope="col"><?php _e( 'Action', 'wpuf' ); ?></th>
212
+ </tr>
213
+ </thead>
214
+ <?php
215
+ $packs = $this->get_packs();
216
+ if ( $packs ) {
217
+ $count = 0;
218
+ foreach ($packs as $row) {
219
+ ?>
220
+ <tr valign="top" <?php echo ( ($count % 2) == 0) ? 'class="alternate"' : ''; ?>>
221
+ <td><?php echo stripslashes( htmlspecialchars( $row->name ) ); ?></td>
222
+ <td><?php echo stripslashes( htmlspecialchars( $row->description ) ); ?></td>
223
+ <td><?php echo $row->cost; ?> <?php echo get_option( 'wpuf_sub_currency' ); ?></td>
224
+ <td><?php echo ( $row->pack_length == 0 ) ? 'Unlimited' : $row->pack_length . ' days'; ?></td>
225
+ <td><?php echo ( $row->count == 0 ) ? 'Unlimited' : $row->count; ?></td>
226
+ <td>
227
+ <a href="<?php echo wp_nonce_url( add_query_arg( array('action' => 'edit', 'pack_id' => $row->id), $this->baseurl, 'wpuf_pack_edit' ) ); ?>">
228
+ <?php _e( 'Edit', 'wpuf' ); ?>
229
+ </a>
230
+ <span class="sep">|</span>
231
+ <a href="<?php echo wp_nonce_url( add_query_arg( array('action' => 'del', 'id' => $row->id), $this->baseurl ), 'wpuf_pack_del' ); ?>" onclick="return confirm('<?php _e( 'Are you sure to delete this pack?', 'wpuf' ); ?>');">
232
+ <?php _e( 'Delete', 'wpuf' ); ?>
233
+ </a>
234
+ </td>
235
+
236
+ </tr>
237
+ <?php
238
+ $count++;
239
+ }
240
+ ?>
241
+ <?php } else { ?>
242
+ <tr>
243
+ <td colspan="6"><?php _e( 'No subscription pack found', 'wpuf' ); ?></td>
244
+ </tr>
245
+ <?php } ?>
246
+
247
+ </table>
248
+ <?php
249
+ }
250
+
251
+ function get_post_types( $post_types = null ) {
252
+
253
+ if ( ! $post_types ) {
254
+ $post_types = WPUF_Subscription::init()->get_all_post_type();
255
+ }
256
+
257
+ ob_start();
258
+
259
+ foreach ( $post_types as $key => $name ) {
260
+ $name = ( $post_types !== null ) ? $name : '';
261
+ ?>
262
+ <tr>
263
+ <th><label for="wpuf-<?php echo esc_attr( $key ); ?>"><?php printf( 'Number of %ss', $key ); ?></label></th>
264
+ <td>
265
+ <input type="text" size="20" style="" id="wpuf-<?php echo esc_attr( $key ); ?>" value="<?php echo esc_attr( (int)$name ); ?>" name="post_type_name[<?php echo esc_attr( $key ); ?>]" />
266
+ <div><span class="description"><span><?php printf( 'How many %s the user can list with this pack? Enter <strong>-1</strong> for unlimited.', $key ); ?></span></span></div>
267
+ </td>
268
+ </tr>
269
+ <?php
270
+ }
271
+
272
+ return ob_get_clean();
273
+ }
274
+
275
+ function form( $pack_id = null ) {
276
+ global $post;
277
+
278
+ $sub_meta = WPUF_Subscription::init()->get_subscription_meta( $post->ID, $post );
279
+
280
+ $hidden_recurring_class = ( $sub_meta['recurring_pay'] != 'yes' ) ? 'none' : '';
281
+ $hidden_trial_class = ( $sub_meta['trial_status'] != 'yes' ) ? 'none' : '';
282
+ $hidden_expire = ( $sub_meta['recurring_pay'] == 'yes' ) ? 'none' : '';
283
+
284
+ ?>
285
+
286
+ <table class="form-table" style="width: 100%">
287
+ <tbody>
288
+ <input type="hidden" name="wpuf_subscription" id="wpuf_subscription_editor" value="<?php echo wp_create_nonce( 'wpuf_subscription_editor' ); ?>" />
289
+ <tr>
290
+ <th><label><?php _e( 'Pack Description', 'wpuf' ); ?></label></th>
291
+ <td>
292
+ <?php wp_editor( $sub_meta['post_content'], 'post_content', array('editor_height' => 100, 'quicktags' => false, 'media_buttons' => false) ); ?>
293
+ </td>
294
+ </tr>
295
+ <tr>
296
+ <th><label for="wpuf-billing-amount">
297
+ <span class="wpuf-biling-amount wpuf-subcription-expire" style="display: <?php echo $hidden_expire; ?>;"><?php _e( 'Billing amount:', 'wpuf' ); ?></span>
298
+ <span class="wpuf-billing-cycle wpuf-recurring-child" style="display: <?php echo $hidden_recurring_class; ?>;"><?php _e( 'Billing amount each cycle:', 'wpuf' ); ?></span></label></th>
299
+ <td>
300
+ <?php echo wpuf_get_option( 'currency_symbol', 'wpuf_payment', '$' ); ?><input type="text" size="20" style="" id="wpuf-billing-amount" value="<?php echo esc_attr( $sub_meta['billing_amount'] ); ?>" name="billing_amount" />
301
+ <div><span class="description"></span></div>
302
+ </td>
303
+ </tr>
304
+
305
+ <tr class="wpuf-subcription-expire" style="display: <?php echo $hidden_expire; ?>;">
306
+ <th><label for="wpuf-expiration-number"><?php _e( 'Expires In:', 'wpuf' ); ?></label></th>
307
+ <td>
308
+ <input type="text" size="20" style="" id="wpuf-expiration-number" value="<?php echo esc_attr( $sub_meta['expiration_number'] ); ?>" name="expiration_number" />
309
+
310
+ <select id="expiration-period" name="expiration_period">
311
+ <?php echo $this->option_field( $sub_meta['expiration_period'] ); ?>
312
+ </select>
313
+ <div><span class="description"></span></div>
314
+ </td>
315
+ </tr>
316
+
317
+ <?php
318
+ $is_post_exp_selected = isset($sub_meta['_enable_post_expiration']) && $sub_meta['_enable_post_expiration'] == 'on'?'checked':'';
319
+ $_post_expiration_time = explode(' ',isset($sub_meta['_post_expiration_time'])?$sub_meta['_post_expiration_time']:' ');
320
+ $time_value = isset($_post_expiration_time[0])?$_post_expiration_time[0]:1;
321
+ $time_type = isset($_post_expiration_time[1])?$_post_expiration_time[1]:'day';
322
+
323
+ $expired_post_status = isset($sub_meta['_expired_post_status'])?$sub_meta['_expired_post_status']:'';
324
+ $is_enable_mail_after_expired = isset($sub_meta['_enable_mail_after_expired']) && $sub_meta['_enable_mail_after_expired'] == 'on'?'checked':'';
325
+ $post_expiration_message = isset($sub_meta['_post_expiration_message'])?$sub_meta['_post_expiration_message']:'';;
326
+ ?>
327
+ <tr class="wpuf-metabox-post_expiration">
328
+ <th><?php _e( 'Enable Post Expiration', 'wpuf' ); ?></th>
329
+ <td>
330
+ <input type="checkbox" id="wpuf-enable_post_expiration" name="post_expiration_settings[enable_post_expiration]" value="on" <?php echo $is_post_exp_selected;?> />
331
+ </td>
332
+ </tr>
333
+ <tr class="wpuf-metabox-post_expiration wpuf_expiration_field">
334
+ <?php
335
+ $timeType_array = array(
336
+ 'year' => 100,
337
+ 'month' => 12,
338
+ 'day' => 30
339
+ );
340
+ ?>
341
+ <th><?php _e( 'Post Expiration Time', 'wpuf' ); ?></th>
342
+ <td>
343
+ <select name="post_expiration_settings[expiration_time_value]" id="wpuf-expiration_time_value">
344
+ <?php
345
+ for($i = 1;$i <= $timeType_array[$time_type];$i++){
346
+ ?>
347
+ <option value="<?php echo $i; ?>" <?php echo $i == $time_value?'selected':''; ?>><?php echo $i;?></option>
348
+ <?php
349
+ }
350
+ ?>
351
+ </select>
352
+ <select name="post_expiration_settings[expiration_time_type]" id="wpuf-expiration_time_type">
353
+ <?php
354
+ foreach($timeType_array as $each_time_type=>$each_time_type_val){
355
+ ?>
356
+ <option value="<?php echo $each_time_type;?>" <?php echo $each_time_type==$time_type?'selected':''; ?>><?php echo ucfirst($each_time_type);?></option>
357
+ <?php
358
+ }
359
+ ?>
360
+ </select>
361
+ </td>
362
+
363
+ </tr>
364
+ <tr class="wpuf_expiration_field">
365
+ <th>
366
+ Post Status :
367
+ </th>
368
+ <td>
369
+ <?php $post_statuses = get_post_statuses();
370
+ ?>
371
+ <select name="post_expiration_settings[expired_post_status]" id="wpuf-expired_post_status">
372
+ <?php
373
+ foreach($post_statuses as $post_status => $text){
374
+ ?>
375
+ <option value="<?php echo $post_status ?>" <?php echo ( $expired_post_status == $post_status )?'selected':''; ?>><?php echo $text;?></option>
376
+ <?php
377
+ }
378
+ ?>
379
+ </select>
380
+ <p class="description"><?php echo _('Status of post after post expiration time is over ');?></p>
381
+ </td>
382
+ </tr>
383
+ <tr class="wpuf_expiration_field">
384
+ <th>
385
+ Send Mail :
386
+ </th>
387
+ <td>
388
+ <input type="checkbox" name="post_expiration_settings[enable_mail_after_expired]" value="on" <?php echo $is_enable_mail_after_expired;?> />
389
+ Send Mail to Author After Exceeding Post Expiration Time
390
+ </td>
391
+ </tr>
392
+ <tr class="wpuf_expiration_field">
393
+ <th>Post Expiration Message</th>
394
+ <td>
395
+ <textarea name="post_expiration_settings[post_expiration_message]" id="wpuf-post_expiration_message" cols="50" rows="5"><?php echo $post_expiration_message;?></textarea>
396
+ </td>
397
+ </tr>
398
+ <?php echo $this->get_post_types( $sub_meta['post_type_name'] ); ?>
399
+ <?php
400
+ do_action( 'wpuf_admin_subscription_detail', $sub_meta, $hidden_recurring_class, $hidden_trial_class, $this );
401
+ ?>
402
+ </tbody>
403
+ </table>
404
+
405
+ <?php
406
+
407
+ }
408
+
409
+ function option_field( $selected ) {
410
+ ?>
411
+ <option value="day" <?php selected( $selected, 'day' ); ?> ><?php _e( 'Day(s)', 'wpuf' ); ?></option>
412
+ <option value="week" <?php selected( $selected, 'week' ); ?> ><?php _e( 'Week(s)', 'wpuf' ); ?></option>
413
+ <option value="month" <?php selected( $selected, 'month' ); ?> ><?php _e( 'Month(s)', 'wpur'); ?></option>
414
+ <option value="year" <?php selected( $selected, 'year' ); ?> ><?php _e( 'Year(s)', 'wpuf' ); ?></option>
415
+ <?php
416
+ }
417
+
418
+ function packdropdown_without_recurring( $packs, $selected = '' ) {
419
+ $packs = isset( $packs ) ? $packs : array();
420
+ foreach( $packs as $key => $pack ) {
421
+ $recurring = isset( $pack->meta_value['recurring_pay'] ) ? $pack->meta_value['recurring_pay'] : '';
422
+ if( $recurring == 'yes' ) {
423
+ continue;
424
+ }
425
+ ?>
426
+ <option value="<?php echo $pack->ID; ?>" <?php selected( $selected, $pack->ID ); ?>><?php echo $pack->post_title; ?></option>
427
+ <?php
428
+ }
429
+ }
430
+
431
+ /**
432
+ * Adds the postlock form in users profile
433
+ *
434
+ * @param object $profileuser
435
+ */
436
+ function profile_subscription_details( $profileuser ) {
437
+
438
+ if ( ! current_user_can( 'edit_users' ) ) {
439
+ return;
440
+ }
441
+ if ( wpuf_get_option( 'charge_posting', 'wpuf_payment' ) != 'yes' ) {
442
+ return;
443
+ }
444
+ $userdata = get_userdata( $profileuser->ID ); //wp 3.3 fix
445
+
446
+ $packs = WPUF_Subscription::init()->get_subscriptions();
447
+ $user_sub = WPUF_Subscription::get_user_pack( $userdata->ID );
448
+ $pack_id = isset( $user_sub['pack_id'] ) ? $user_sub['pack_id'] : '';
449
+ ?>
450
+ <div class="wpuf-user-subscription">
451
+ <h3><?php _e( 'WPUF Subscription', 'wpuf' ); ?></h3>
452
+ <?php
453
+
454
+
455
+ if ( isset( $user_sub['pack_id'] ) ) :
456
+
457
+ $pack = WPUF_Subscription::get_subscription( $user_sub['pack_id'] );
458
+ $details_meta = WPUF_Subscription::init()->get_details_meta_value();
459
+
460
+ $billing_amount = ( intval( $pack->meta_value['billing_amount'] ) > 0 ) ? $details_meta['symbol'] . $pack->meta_value['billing_amount'] : __( 'Free', 'wpuf' );
461
+ if ( $billing_amount && $pack->meta_value['recurring_pay'] == 'yes' ) {
462
+ $recurring_des = sprintf( 'For each %s %s', $pack->meta_value['billing_cycle_number'], $pack->meta_value['cycle_period'], $pack->meta_value['trial_duration_type'] );
463
+ $recurring_des .= !empty( $pack->meta_value['billing_limit'] ) ? sprintf( ', for %s installments', $pack->meta_value['billing_limit'] ) : '';
464
+ $recurring_des = $recurring_des;
465
+ } else {
466
+ $recurring_des = '';
467
+ }
468
+
469
+ ?>
470
+ <div class="wpuf-user-sub-info">
471
+ <h3><?php _e( 'Subscription Details', 'wpuf' ); ?></h3>
472
+ <?php if(isset($user_sub['recurring']) && $user_sub['recurring'] == 'yes' ){
473
+ ?>
474
+ <div class="updated">
475
+ <p><?php _e( 'This user is using recurring subscription pack', 'wpuf' ); ?></p>
476
+ </div>
477
+ <?php
478
+ } ?>
479
+ <div class="wpuf-text">
480
+ <div><strong><?php _e( 'Subcription Name: ','wpuf' ); ?></strong><?php echo $pack->post_title; ?></div>
481
+ <div>
482
+ <strong><?php _e( 'Package billing details: '); ?></strong>
483
+ <div class="wpuf-pricing-wrap">
484
+ <div class="wpuf-sub-amount">
485
+ <?php echo $billing_amount; ?>
486
+ <?php echo $recurring_des; ?>
487
+
488
+ </div>
489
+ </div>
490
+ </div>
491
+
492
+ <strong><?php _e( 'Remaining post: ', 'wpuf'); ?></strong>
493
+ <table class="form-table">
494
+
495
+ <?php
496
+
497
+ foreach ($user_sub['posts'] as $key => $value) {
498
+ ?>
499
+ <tr>
500
+ <th><label><?php echo $key; ?></label></th>
501
+ <td><input type="text" value="<?php echo $value; ?>" name="<?php echo $key; ?>" ></td>
502
+ </tr>
503
+ <?php
504
+ }
505
+ ?>
506
+ <?php
507
+ if ( $user_sub['recurring'] != 'yes' ) {
508
+ if ( !empty( $user_sub['expire'] ) ) {
509
+
510
+ $expire = ( $user_sub['expire'] == 'unlimited' ) ? ucfirst( 'unlimited' ) : wpuf_date2mysql( $user_sub['expire'] );
511
+
512
+ ?>
513
+ <tr>
514
+ <th><label><?php echo _e('Expire date:'); ?></label></th>
515
+ <td><input type="text" class="wpuf-date-picker" name="expire" value="<?php echo wpuf_get_date( $expire ); ?>"></td>
516
+ </tr>
517
+ <?php
518
+ }
519
+
520
+ } ?>
521
+ <?php
522
+ $is_post_exp_selected = isset($user_sub['_enable_post_expiration'])?'checked':'';
523
+ $_post_expiration_time = explode(' ',isset($user_sub['_post_expiration_time'])?$user_sub['_post_expiration_time']:' ');
524
+ $time_value = isset($_post_expiration_time[0]) && !empty($_post_expiration_time[0])?$_post_expiration_time[0]:'1';
525
+ $time_type = isset($_post_expiration_time[1]) && !empty($_post_expiration_time[1])?$_post_expiration_time[1]:'day';
526
+ ?>
527
+ <tr>
528
+ <th><label><?php echo _e('Post Expiration Enabled'); ?></label></th>
529
+ <td><input type="checkbox" name="is_post_expiration_enabled" value="on" <?php echo $is_post_exp_selected;?>></td>
530
+ </tr>
531
+ <tr>
532
+ <?php
533
+ $timeType_array = array(
534
+ 'year' => 100,
535
+ 'month' => 12,
536
+ 'day' => 30
537
+ );
538
+ ?>
539
+ <th><?php _e( 'Post Expiration Time', 'wpuf' ); ?></th>
540
+ <td>
541
+ <select name="post_expiration_settings[expiration_time_value]" id="wpuf-expiration_time_value">
542
+ <?php
543
+ for($i = 1;$i <= $timeType_array[$time_type];$i++){
544
+ ?>
545
+ <option value="<?php echo $i; ?>" <?php echo $i == $time_value?'selected':''; ?>><?php echo $i;?></option>
546
+ <?php
547
+ }
548
+ ?>
549
+ </select>
550
+ <select name="post_expiration_settings[expiration_time_type]" id="wpuf-expiration_time_type">
551
+ <?php
552
+ foreach($timeType_array as $each_time_type=>$each_time_type_val){
553
+ ?>
554
+ <option value="<?php echo $each_time_type;?>" <?php echo $each_time_type==$time_type?'selected':''; ?>><?php echo ucfirst($each_time_type);?></option>
555
+ <?php
556
+ }
557
+ ?>
558
+ </select>
559
+ </td>
560
+ </tr>
561
+ </table>
562
+ </div>
563
+ </div>
564
+ <?php endif;?>
565
+ <?php if(!isset($user_sub['recurring']) || $user_sub['recurring'] != 'yes' ): ?>
566
+ <a class="btn button-primary wpuf-assing-pack-btn wpuf-add-pack" href="#"><?php _e( 'Assign Package', 'wpuf' ); ?></a>
567
+ <a class="btn button-primary wpuf-assing-pack-btn wpuf-cancel-pack" style="display:none;" href="#"><?php _e( 'Show Package', 'wpuf' ); ?></a>
568
+ <table class="form-table wpuf-pack-dropdown" disabled="disabled" style="display: none;">
569
+ <tr>
570
+ <th><label for="wpuf_sub_pack"><?php _e( 'Pack:', 'wpuf' ); ?> </label></th>
571
+ <td>
572
+ <select name="pack_id" id="wpuf_sub_pack">
573
+ <option value="-1"><?php _e( '--Select--', 'wpuf' ); ?></option>
574
+ <?php $this->packdropdown_without_recurring( $packs, $pack_id );//WPUF_Subscription::init()->packdropdown( $packs, $selected = '' ); ?>
575
+ </select>
576
+ </td>
577
+ </tr>
578
+ </table>
579
+ <?php endif;?>
580
+ <?php if( !empty($user_sub) ):?>
581
+ <a class="btn button-primary wpuf-delete-pack-btn" href="javascript:" data-userid = "<?php echo $userdata->ID; ?>"><?php _e( 'Delete Package', 'wpuf' ); ?></a>
582
+ <?php endif; ?>
583
+ </div>
584
+ <?php
585
+
586
+ }
587
+
588
+ function lenght_type_option( $selected ) {
589
+
590
+ for ($i = 1; $i <= 30; $i++) {
591
+ ?>
592
+ <option value="<?php echo $i; ?>" <?php selected( $i, $selected ); ?>><?php echo $i; ?></option>
593
+ <?php
594
+ }
595
+
596
+ }
597
+
598
+ /**
599
+ * Ajax function. Delete user package
600
+ * @since 2.2.7
601
+ */
602
+ function delete_user_package(){
603
+ echo delete_user_meta($_POST['userid'],'_wpuf_subscription_pack');
604
+ $wpuf_paypal = new WPUF_Paypal();
605
+ $wpuf_paypal->recurring_change_status( $_POST['userid'], 'Cancel' );
606
+ exit;
607
+ }
608
+ }
609
+
610
+ //$subscription = new WPUF_Admin_Subscription();
admin/template-post.php ADDED
@@ -0,0 +1,306 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Post related form templates
4
+ *
5
+ * @package WP User Frontend
6
+ */
7
+ class WPUF_Admin_Template_Post extends WPUF_Admin_Template {
8
+
9
+ public static function post_title( $field_id, $label, $values = array() ) {
10
+
11
+ ?>
12
+ <li class="post_title">
13
+ <?php self::legend( $label, $values, $field_id ); ?>
14
+ <?php self::hidden_field( "[$field_id][input_type]", 'text' ); ?>
15
+ <?php self::hidden_field( "[$field_id][template]", 'post_title' ); ?>
16
+
17
+ <div class="wpuf-form-holder">
18
+ <?php self::common( $field_id, 'post_title', false, $values ); ?>
19
+ <?php self::common_text( $field_id, $values ); ?>
20
+ <?php self::conditional_field( $field_id, $values ); ?>
21
+ </div> <!-- .wpuf-form-holder -->
22
+ </li>
23
+ <?php
24
+ }
25
+
26
+ public static function post_content( $field_id, $label, $values = array() ) {
27
+
28
+ $image_insert_name = sprintf( '%s[%d][insert_image]', self::$input_name, $field_id );
29
+ $image_insert_value = isset( $values['insert_image'] ) ? $values['insert_image'] : 'yes';
30
+ $word_restriction_name = sprintf( '%s[%d][word_restriction]', self::$input_name, $field_id );
31
+ $word_restriction_value = isset( $values['word_restriction'] ) && is_numeric( $values['word_restriction'] ) ? $values['word_restriction'] : '';
32
+ ?>
33
+ <li class="post_content">
34
+ <?php self::legend( $label, $values, $field_id ); ?>
35
+ <?php self::hidden_field( "[$field_id][input_type]", 'textarea' ); ?>
36
+ <?php self::hidden_field( "[$field_id][template]", 'post_content' ); ?>
37
+
38
+ <div class="wpuf-form-holder">
39
+ <?php self::common( $field_id, 'post_content', false, $values ); ?>
40
+ <?php self::common_textarea( $field_id, $values ); ?>
41
+
42
+ <div class="wpuf-form-rows">
43
+ <label><?php _e( 'Enable Image Insertion', 'wpuf' ); ?></label>
44
+
45
+ <div class="wpuf-form-sub-fields">
46
+ <label>
47
+ <?php self::hidden_field( "[$field_id][insert_image]", 'no' ); ?>
48
+ <input type="checkbox" name="<?php echo $image_insert_name ?>" value="yes"<?php checked( $image_insert_value, 'yes' ); ?> />
49
+ <?php _e( 'Enable image upload in post area', 'wpuf' ); ?>
50
+ </label>
51
+ </div>
52
+
53
+ <label><?php _e( 'Word Restriction', 'wpuf' ); ?></label>
54
+
55
+ <div class="wpuf-form-sub-fields">
56
+ <label>
57
+ <input type="text" class="smallipopInput" name="<?php echo $word_restriction_name ?>" value="<?php echo $word_restriction_value; ?>" title="<?php esc_attr_e( 'Numebr of words the author to be restricted in', 'wpuf' ); ?>" />
58
+ </label>
59
+ </div>
60
+ </div> <!-- .wpuf-form-rows -->
61
+
62
+ <?php self::conditional_field( $field_id, $values ); ?>
63
+ </div> <!-- .wpuf-form-holder -->
64
+ </li>
65
+ <?php
66
+ }
67
+
68
+ public static function post_excerpt( $field_id, $label, $values = array() ) {
69
+ ?>
70
+ <li class="post_excerpt">
71
+ <?php self::legend( $label, $values, $field_id ); ?>
72
+ <?php self::hidden_field( "[$field_id][input_type]", 'textarea' ); ?>
73
+ <?php self::hidden_field( "[$field_id][template]", 'post_excerpt' ); ?>
74
+
75
+ <div class="wpuf-form-holder">
76
+ <?php self::common( $field_id, 'post_excerpt', false, $values ); ?>
77
+ <?php self::common_textarea( $field_id, $values ); ?>
78
+ <?php self::conditional_field( $field_id, $values ); ?>
79
+ </div> <!-- .wpuf-form-holder -->
80
+ </li>
81
+ <?php
82
+ }
83
+
84
+ public static function post_tags( $field_id, $label, $values = array() ) {
85
+ ?>
86
+ <li class="post_tags">
87
+ <?php self::legend( $label, $values, $field_id ); ?>
88
+ <?php self::hidden_field( "[$field_id][input_type]", 'text' ); ?>
89
+ <?php self::hidden_field( "[$field_id][template]", 'post_tags' ); ?>
90
+
91
+ <div class="wpuf-form-holder">
92
+ <?php self::common( $field_id, 'tags', false, $values ); ?>
93
+ <?php self::common_text( $field_id, $values ); ?>
94
+ <?php self::conditional_field( $field_id, $values ); ?>
95
+ </div> <!-- .wpuf-form-holder -->
96
+ </li>
97
+ <?php
98
+ }
99
+
100
+ public static function featured_image( $field_id, $label, $values = array() ) {
101
+ $max_file_name = sprintf( '%s[%d][max_size]', self::$input_name, $field_id );
102
+ $max_file_value = $values ? $values['max_size'] : '1024';
103
+ $help = esc_attr( __( 'Enter maximum upload size limit in KB', 'wpuf' ) );
104
+ ?>
105
+ <li class="featured_image">
106
+ <?php self::legend( $label, $values, $field_id ); ?>
107
+ <?php self::hidden_field( "[$field_id][input_type]", 'image_upload' ); ?>
108
+ <?php self::hidden_field( "[$field_id][template]", 'featured_image' ); ?>
109
+ <?php self::hidden_field( "[$field_id][count]", '1' ); ?>
110
+
111
+ <div class="wpuf-form-holder">
112
+ <?php self::common( $field_id, 'featured_image', false, $values ); ?>
113
+
114
+ <div class="wpuf-form-rows">
115
+ <label><?php _e( 'Max. file size', 'wpuf' ); ?></label>
116
+ <input type="text" class="smallipopInput" name="<?php echo $max_file_name; ?>" value="<?php echo $max_file_value; ?>" title="<?php echo $help; ?>">
117
+ </div> <!-- .wpuf-form-rows -->
118
+ <?php self::conditional_field( $field_id, $values ); ?>
119
+ </div> <!-- .wpuf-form-holder -->
120
+ </li>
121
+ <?php
122
+ }
123
+
124
+ public static function post_category( $field_id, $label, $values = array() ) {
125
+ ?>
126
+ <li class="post_category">
127
+ <?php self::legend( $label, $values, $field_id ); ?>
128
+ <?php self::hidden_field( "[$field_id][template]", 'post_category' ); ?>
129
+
130
+ <div class="wpuf-form-holder">
131
+ <?php self::common( $field_id, 'category', false, $values ); ?>
132
+ <?php self::conditional_field( $field_id, $values ); ?>
133
+ </div> <!-- .wpuf-form-holder -->
134
+ </li>
135
+ <?php
136
+ }
137
+
138
+ public static function taxonomy( $field_id, $label, $taxonomy = '', $values = array() ) {
139
+ $type_name = sprintf( '%s[%d][type]', self::$input_name, $field_id );
140
+ $order_name = sprintf( '%s[%d][order]', self::$input_name, $field_id );
141
+ $orderby_name = sprintf( '%s[%d][orderby]', self::$input_name, $field_id );
142
+ $exclude_type_name = sprintf( '%s[%d][exclude_type]', self::$input_name, $field_id );
143
+ $exclude_name = sprintf( '%s[%d][exclude]', self::$input_name, $field_id );
144
+ $woo_attr_name = sprintf( '%s[%d][woo_attr]', self::$input_name, $field_id );
145
+ $woo_attr_vis_name = sprintf( '%s[%d][woo_attr_vis]', self::$input_name, $field_id );
146
+
147
+ $type_value = $values ? esc_attr( $values['type'] ) : 'select';
148
+ $order_value = $values ? esc_attr( $values['order'] ) : 'ASC';
149
+ $orderby_value = $values ? esc_attr( $values['orderby'] ) : 'name';
150
+ $exclude_type_value = $values ? esc_attr( $values['exclude_type'] ) : 'exclude';
151
+ $exclude_value = $values ? esc_attr( $values['exclude'] ) : '';
152
+ $woo_attr_value = $values ? esc_attr( $values['woo_attr'] ) : 'no';
153
+ $woo_attr_vis_value = $values ? esc_attr( $values['woo_attr_vis'] ) : 'no';
154
+ ?>
155
+ <li class="taxonomy <?php echo $taxonomy; ?> wpuf-conditional">
156
+ <?php self::legend( $label, $values, $field_id ); ?>
157
+ <?php self::hidden_field( "[$field_id][input_type]", 'taxonomy' ); ?>
158
+ <?php self::hidden_field( "[$field_id][template]", 'taxonomy' ); ?>
159
+
160
+ <div class="wpuf-form-holder">
161
+ <?php self::common( $field_id, $taxonomy, false, $values ); ?>
162
+
163
+ <div class="wpuf-form-rows">
164
+ <label><?php _e( 'Type', 'wpuf' ); ?></label>
165
+ <select name="<?php echo $type_name ?>">
166
+ <option value="select"<?php selected( $type_value, 'select' ); ?>><?php _e( 'Dropdown', 'wpuf' ); ?></option>
167
+ <option value="multiselect"<?php selected( $type_value, 'multiselect' ); ?>><?php _e( 'Multi Select', 'wpuf' ); ?></option>
168
+ <option value="checkbox"<?php selected( $type_value, 'checkbox' ); ?>><?php _e( 'Checkbox', 'wpuf' ); ?></option>
169
+ <option value="text"<?php selected( $type_value, 'text' ); ?>><?php _e( 'Text Input', 'wpuf' ); ?></option>
170
+ <option value="ajax"<?php selected( $type_value, 'ajax' ); ?>><?php _e( 'Ajax', 'wpuf' ); ?></option>
171
+ </select>
172
+ </div> <!-- .wpuf-form-rows -->
173
+
174
+ <div class="wpuf-form-rows">
175
+ <label><?php _e( 'Order By', 'wpuf' ); ?></label>
176
+ <select name="<?php echo $orderby_name ?>">
177
+ <option value="name"<?php selected( $orderby_value, 'name' ); ?>><?php _e( 'Name', 'wpuf' ); ?></option>
178
+ <option value="id"<?php selected( $orderby_value, 'id' ); ?>><?php _e( 'Term ID', 'wpuf' ); ?></option>
179
+ <option value="slug"<?php selected( $orderby_value, 'slug' ); ?>><?php _e( 'Slug', 'wpuf' ); ?></option>
180
+ <option value="count"<?php selected( $orderby_value, 'count' ); ?>><?php _e( 'Count', 'wpuf' ); ?></option>
181
+ <option value="term_group"<?php selected( $orderby_value, 'term_group' ); ?>><?php _e( 'Term Group', 'wpuf' ); ?></option>
182
+ </select>
183
+ </div> <!-- .wpuf-form-rows -->
184
+
185
+ <div class="wpuf-form-rows">
186
+ <label><?php _e( 'Order', 'wpuf' ); ?></label>
187
+ <select name="<?php echo $order_name ?>">
188
+ <option value="ASC"<?php selected( $order_value, 'ASC' ); ?>><?php _e( 'ASC', 'wpuf' ); ?></option>
189
+ <option value="DESC"<?php selected( $order_value, 'DESC' ); ?>><?php _e( 'DESC', 'wpuf' ); ?></option>
190
+ </select>
191
+ </div> <!-- .wpuf-form-rows -->
192
+
193
+ <div class="wpuf-form-rows">
194
+ <label><?php _e( 'Selection Type', 'wpuf' ); ?></label>
195
+ <select name="<?php echo $exclude_type_name ?>">
196
+ <option value="exclude"<?php selected( $exclude_type_value, 'exclude' ); ?>><?php _e( 'Exclude', 'wpuf' ); ?></option>
197
+ <option value="include"<?php selected( $exclude_type_value, 'include' ); ?>><?php _e( 'Include', 'wpuf' ); ?></option>
198
+ <option value="child_of"<?php selected( $exclude_type_value, 'child_of' ); ?>><?php _e( 'Child of', 'wpuf' ); ?></option>
199
+ </select>
200
+ </div> <!-- .wpuf-form-rows -->
201
+
202
+ <div class="wpuf-form-rows">
203
+ <label><?php _e( 'Selection terms', 'wpuf' ); ?></label>
204
+ <input type="text" class="smallipopInput" name="<?php echo $exclude_name; ?>" title="<?php _e( 'Enter the term IDs as comma separated (without space) to exclude/include in the form.', 'wpuf' ); ?>" value="<?php echo $exclude_value; ?>" />
205
+ </div> <!-- .wpuf-form-rows -->
206
+
207
+ <div class="wpuf-form-rows">
208
+ <label><?php _e( 'WooCommerce Attribute', 'wpuf' ); ?></label>
209
+
210
+ <div class="wpuf-form-sub-fields">
211
+ <label>
212
+ <?php self::hidden_field( "[$field_id][woo_attr]", 'no' ); ?>
213
+ <input type="checkbox" class="woo_attr" name="<?php echo $woo_attr_name ?>" value="yes"<?php checked( $woo_attr_value, 'yes' ); ?> />
214
+ <?php _e( 'This taxonomy is a WooCommerce attribute', 'wpuf' ); ?>
215
+ </label>
216
+ </div>
217
+ </div> <!-- .wpuf-form-rows -->
218
+
219
+ <div class="wpuf-form-rows<?php echo $woo_attr_value == 'no' ? ' wpuf-hide' : ''; ?>">
220
+ <label><?php _e( 'Visibility', 'wpuf' ); ?></label>
221
+
222
+ <div class="wpuf-form-sub-fields">
223
+ <label>
224
+ <?php self::hidden_field( "[$field_id][woo_attr_vis]", 'no' ); ?>
225
+ <input type="checkbox" name="<?php echo $woo_attr_vis_name ?>" value="yes"<?php checked( $woo_attr_vis_value, 'yes' ); ?> />
226
+ <?php _e( 'Visible on product page', 'wpuf' ); ?>
227
+ </label>
228
+ </div>
229
+ </div> <!-- .wpuf-form-rows -->
230
+
231
+ <?php self::conditional_field( $field_id, $values ); ?>
232
+ <div class="wpuf-options">
233
+ <?php
234
+
235
+ $tax = get_terms( $taxonomy, array(
236
+ 'orderby' => 'count',
237
+ 'hide_empty' => 0
238
+ ) );
239
+
240
+ $tax = is_array( $tax ) ? $tax : array();
241
+
242
+ foreach($tax as $tax_obj) {
243
+ ?>
244
+ <div>
245
+ <input type="hidden" value="<?php echo $tax_obj->name;?>" data-taxonomy="yes" data-term-id="<?php echo $tax_obj->term_id;?>" data-type="option">
246
+ <input type="hidden" value="<?php echo $tax_obj->term_id;?>" data-taxonomy="yes" data-term-id="<?php echo $tax_obj->term_id;?>" data-type="option_value">
247
+ </div>
248
+ <?php
249
+ }
250
+ ?>
251
+ </div>
252
+ </div> <!-- .wpuf-form-holder -->
253
+ </li>
254
+ <?php
255
+ }
256
+
257
+
258
+ /**
259
+ * Drop Down portion
260
+ * @param array $param
261
+ */
262
+ public static function render_drop_down_portion( $param = array( 'names_to_hide' => array( 'name' => '', 'value' => '' ),'names_to_show' => array( 'name' => '', 'value' => '' ),'option_to_chose' => array('name' => '', 'value' => '' ) ) ) {
263
+ empty( $param['option_to_chose']['value'] ) ? ( $param['option_to_chose']['value'] = 'all' ) : '';
264
+
265
+ ?>
266
+ <div class="wpuf-form-rows">
267
+ <label><input type="radio" name="<?php echo $param['option_to_chose']['name'] ?>" value="<?php echo _e('all','wpuf'); ?>" <?php echo ( ( $param['option_to_chose']['value'] == 'all' )?'checked':'' ); ?> /><?php _e( 'Show All', 'wpuf' ); ?></label>
268
+ </div>
269
+ <div class="wpuf-form-rows">
270
+ <label><input type="radio" name="<?php echo $param['option_to_chose']['name'] ?>" value="<?php echo _e('hide','wpuf'); ?>" <?php echo ( ( $param['option_to_chose']['value'] == 'hide' )?'checked':'' ); ?> /><?php _e( 'Hide These Countries', 'wpuf' ); ?></label>
271
+ <select name="<?php echo $param['names_to_hide']['name'];?>" class="wpuf-country_to_hide" multiple data-placeholder="<?php esc_attr_e( 'Chose Country to hide from List', 'wpuf' ); ?>"></select>
272
+ </div>
273
+
274
+ <div class="wpuf-form-rows">
275
+ <label><input type="radio" name="<?php echo $param['option_to_chose']['name'] ?>" value="<?php echo _e('show','wpuf'); ?>" <?php echo ( ( $param['option_to_chose']['value'] == 'show' )?'checked':'' ); ?> /><?php _e( 'Show These Countries', 'wpuf' ); ?></label>
276
+ <select name="<?php echo $param['names_to_show']['name'];?>" class="wpuf-country_to_hide" multiple data-placeholder="<?php esc_attr_e( 'Add Country to List', 'wpuf' ); ?>"></select>
277
+ </div>
278
+
279
+ <script>
280
+ (function($){
281
+ $(document).ready(function(){
282
+ var hide_field_name = '<?php echo $param['names_to_hide']['name'];?>';
283
+ var hide_field_value = JSON.parse('<?php echo json_encode($param['names_to_hide']['value']);?>');
284
+ var show_field_name = '<?php echo $param['names_to_show']['name'];?>';
285
+ var show_field_value = JSON.parse('<?php echo json_encode($param['names_to_show']['value']);?>');
286
+ var countries = <?php echo file_get_contents(WPUF_ASSET_URI . '/js/countries.json');?>;
287
+ var hide_field_option_string = '';
288
+ var show_field_option_string = '';
289
+
290
+ for(country in countries){
291
+ hide_field_option_string = hide_field_option_string + '<option value="'+ countries[country].code +'" '+ (( $.inArray(countries[country].code,hide_field_value) != -1 )?'selected':'') +'>'+ countries[country].name +'</option>';
292
+ show_field_option_string = show_field_option_string + '<option value="'+ countries[country].code +'" '+ (( $.inArray(countries[country].code,show_field_value) != -1 )?'selected':'') +'>'+ countries[country].name +'</option>';
293
+ }
294
+
295
+ jQuery('select[name="'+ hide_field_name +'"]').html(hide_field_option_string);
296
+ jQuery('select[name="'+ show_field_name +'"]').html(show_field_option_string);
297
+ jQuery('select[name="'+ hide_field_name +'"],select[name="'+ show_field_name +'"]').chosen({allow_single_deselect:true});
298
+ })
299
+
300
+ }(jQuery))
301
+
302
+ </script>
303
+ <?php
304
+ }
305
+
306
+ }
admin/template.php ADDED
@@ -0,0 +1,651 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * WPUF Form builder template
5
+ *
6
+ * @package WP User Frontend
7
+ * @author Tareq Hasan <tareq@wedevs.com>
8
+ */
9
+ class WPUF_Admin_Template {
10
+
11
+ static $input_name = 'wpuf_input';
12
+ static $cond_name = 'wpuf_cond';
13
+
14
+ /**
15
+ * Legend of a form item
16
+ *
17
+ * @param string $title
18
+ * @param array $values
19
+ */
20
+ public static function legend( $title = 'Field Name', $values = array(), $field_id = 0 ) {
21
+
22
+ $field_label = $values ? ': <strong>' . $values['label'] . '</strong>' : '';
23
+ $id = isset( $values['id'] ) ? $values['id'] : '';
24
+ ?>
25
+ <div class="wpuf-legend" title="<?php _e( 'Click and Drag to rearrange', 'wpuf' ); ?>">
26
+ <input type="hidden" value="<?php echo $id; ?>" name="wpuf_input[<?php echo $field_id; ?>][id]">
27
+ <div class="wpuf-label"><?php echo $title . $field_label; ?></div>
28
+ <div class="wpuf-actions">
29
+ <a href="#" class="wpuf-remove"><?php _e( 'Remove', 'wpuf' ); ?></a>
30
+ <a href="#" class="wpuf-toggle"><?php _e( 'Toggle', 'wpuf' ); ?></a>
31
+ </div>
32
+ </div> <!-- .wpuf-legend -->
33
+ <?php
34
+ }
35
+
36
+ /**
37
+ * Common Fields for a input field
38
+ *
39
+ * Contains required, label, meta_key, help text, css class name
40
+ *
41
+ * @param int $id field order
42
+ * @param mixed $field_name_value
43
+ * @param bool $custom_field if it a custom field or not
44
+ * @param array $values saved value
45
+ */
46
+ public static function common( $id, $field_name_value = '', $custom_field = true, $values = array() ) {
47
+
48
+ $tpl = '%s[%d][%s]';
49
+ $required_name = sprintf( $tpl, self::$input_name, $id, 'required' );
50
+ $field_name = sprintf( $tpl, self::$input_name, $id, 'name' );
51
+ $label_name = sprintf( $tpl, self::$input_name, $id, 'label' );
52
+ $is_meta_name = sprintf( $tpl, self::$input_name, $id, 'is_meta' );
53
+ $help_name = sprintf( $tpl, self::$input_name, $id, 'help' );
54
+ $css_name = sprintf( $tpl, self::$input_name, $id, 'css' );
55
+
56
+ // $field_name_value = $field_name_value ?
57
+ $required = $values ? esc_attr( $values['required'] ) : 'yes';
58
+ $label_value = $values ? esc_attr( $values['label'] ) : '';
59
+ $help_value = $values ? stripslashes( $values['help'] ) : '';
60
+ $css_value = $values ? esc_attr( $values['css'] ) : '';
61
+
62
+ if ( $custom_field && $values ) {
63
+ $field_name_value = $values['name'];
64
+ }
65
+
66
+ // var_dump($values);
67
+ // var_dump($required, $label_value, $help_value);
68
+ ?>
69
+ <div class="wpuf-form-rows required-field">
70
+ <label><?php _e( 'Required', 'wpuf' ); ?></label>
71
+
72
+ <div class="wpuf-form-sub-fields">
73
+ <label><input type="radio" name="<?php echo $required_name; ?>" value="yes"<?php checked( $required, 'yes' ); ?>> <?php _e( 'Yes', 'wpuf' ); ?> </label>
74
+ <label><input type="radio" name="<?php echo $required_name; ?>" value="no"<?php checked( $required, 'no' ); ?>> <?php _e( 'No', 'wpuf' ); ?> </label>
75
+ </div>
76
+ </div> <!-- .wpuf-form-rows -->
77
+
78
+ <div class="wpuf-form-rows">
79
+ <label><?php _e( 'Field Label', 'wpuf' ); ?></label>
80
+ <input type="text" data-type="label" name="<?php echo $label_name; ?>" value="<?php echo $label_value; ?>" class="smallipopInput" title="<?php _e( 'Enter a title of this field', 'wpuf' ); ?>">
81
+ </div> <!-- .wpuf-form-rows -->
82
+
83
+ <?php if ( $custom_field ) { ?>
84
+ <div class="wpuf-form-rows">
85
+ <label><?php _e( 'Meta Key', 'wpuf' ); ?></label>
86
+ <input type="text" data-type="name" name="<?php echo $field_name; ?>" value="<?php echo $field_name_value; ?>" class="smallipopInput" title="<?php _e( 'Name of the meta key this field will save to', 'wpuf' ); ?>">
87
+ <input type="hidden" name="<?php echo $is_meta_name; ?>" value="yes">
88
+ </div> <!-- .wpuf-form-rows -->
89
+ <?php } else { ?>
90
+
91
+ <input type="hidden" data-type="name" name="<?php echo $field_name; ?>" value="<?php echo $field_name_value; ?>">
92
+ <input type="hidden" name="<?php echo $is_meta_name; ?>" value="no">
93
+
94
+ <?php } ?>
95
+
96
+ <div class="wpuf-form-rows">
97
+ <label><?php _e( 'Help text', 'wpuf' ); ?></label>
98
+ <textarea name="<?php echo $help_name; ?>" class="smallipopInput" title="<?php _e( 'Give the user some information about this field', 'wpuf' ); ?>"><?php echo $help_value; ?></textarea>
99
+ </div> <!-- .wpuf-form-rows -->
100
+
101
+ <div class="wpuf-form-rows">
102
+ <label><?php _e( 'CSS Class Name', 'wpuf' ); ?></label>
103
+ <input type="text" name="<?php echo $css_name; ?>" value="<?php echo $css_value; ?>" class="smallipopInput" title="<?php _e( 'Add a CSS class name for this field', 'wpuf' ); ?>">
104
+ </div> <!-- .wpuf-form-rows -->
105
+
106
+ <?php
107
+ }
108
+
109
+ /**
110
+ * Common fields for a text area
111
+ *
112
+ * @param int $id
113
+ * @param array $values
114
+ */
115
+ public static function common_text( $id, $values = array() ) {
116
+ $tpl = '%s[%d][%s]';
117
+ $placeholder_name = sprintf( $tpl, self::$input_name, $id, 'placeholder' );
118
+ $default_name = sprintf( $tpl, self::$input_name, $id, 'default' );
119
+ $size_name = sprintf( $tpl, self::$input_name, $id, 'size' );
120
+
121
+ $placeholder_value = $values ? esc_attr( $values['placeholder'] ) : '';
122
+ $default_value = $values ? esc_attr( $values['default'] ) : '';
123
+ $size_value = $values ? esc_attr( $values['size'] ) : '40';
124
+
125
+ ?>
126
+ <div class="wpuf-form-rows">
127
+ <label><?php _e( 'Placeholder text', 'wpuf' ); ?></label>
128
+ <input type="text" class="smallipopInput" name="<?php echo $placeholder_name; ?>" title="<?php esc_attr_e( 'Text for HTML5 placeholder attribute', 'wpuf' ); ?>" value="<?php echo $placeholder_value; ?>" />
129
+ </div> <!-- .wpuf-form-rows -->
130
+
131
+ <div class="wpuf-form-rows">
132
+ <label><?php _e( 'Default value', 'wpuf' ); ?></label>
133
+ <input type="text" class="smallipopInput" name="<?php echo $default_name; ?>" title="<?php esc_attr_e( 'The default value this field will have', 'wpuf' ); ?>" value="<?php echo $default_value; ?>" />
134
+ </div> <!-- .wpuf-form-rows -->
135
+
136
+ <div class="wpuf-form-rows">
137
+ <label><?php _e( 'Size', 'wpuf' ); ?></label>
138
+ <input type="text" class="smallipopInput" name="<?php echo $size_name; ?>" title="<?php esc_attr_e( 'Size of this input field', 'wpuf' ); ?>" value="<?php echo $size_value; ?>" />
139
+ </div> <!-- .wpuf-form-rows -->
140
+ <?php
141
+ }
142
+
143
+ /**
144
+ * Common fields for a textarea
145
+ *
146
+ * @param int $id
147
+ * @param array $values
148
+ */
149
+ public static function common_textarea( $id, $values = array() ) {
150
+ $tpl = '%s[%d][%s]';
151
+ $rows_name = sprintf( $tpl, self::$input_name, $id, 'rows' );
152
+ $cols_name = sprintf( $tpl, self::$input_name, $id, 'cols' );
153
+ $rich_name = sprintf( $tpl, self::$input_name, $id, 'rich' );
154
+ $placeholder_name = sprintf( $tpl, self::$input_name, $id, 'placeholder' );
155
+ $default_name = sprintf( $tpl, self::$input_name, $id, 'default' );
156
+
157
+ $rows_value = $values ? esc_attr( $values['rows'] ) : '5';
158
+ $cols_value = $values ? esc_attr( $values['cols'] ) : '25';
159
+ $rich_value = $values ? esc_attr( $values['rich'] ) : 'no';
160
+ $placeholder_value = $values ? esc_attr( $values['placeholder'] ) : '';
161
+ $default_value = $values ? esc_attr( $values['default'] ) : '';
162
+
163
+ ?>
164
+ <div class="wpuf-form-rows">
165
+ <label><?php _e( 'Rows', 'wpuf' ); ?></label>
166
+ <input type="text" class="smallipopInput" name="<?php echo $rows_name; ?>" title="Number of rows in textarea" value="<?php echo $rows_value; ?>" />
167
+ </div> <!-- .wpuf-form-rows -->
168
+
169
+ <div class="wpuf-form-rows">
170
+ <label><?php _e( 'Columns', 'wpuf' ); ?></label>
171
+ <input type="text" class="smallipopInput" name="<?php echo $cols_name; ?>" title="Number of columns in textarea" value="<?php echo $cols_value; ?>" />
172
+ </div> <!-- .wpuf-form-rows -->
173
+
174
+ <div class="wpuf-form-rows">
175
+ <label><?php _e( 'Placeholder text', 'wpuf' ); ?></label>
176
+ <input type="text" class="smallipopInput" name="<?php echo $placeholder_name; ?>" title="text for HTML5 placeholder attribute" value="<?php echo $placeholder_value; ?>" />
177
+ </div> <!-- .wpuf-form-rows -->
178
+
179
+ <div class="wpuf-form-rows">
180
+ <label><?php _e( 'Default value', 'wpuf' ); ?></label>
181
+ <input type="text" class="smallipopInput" name="<?php echo $default_name; ?>" title="the default value this field will have" value="<?php echo $default_value; ?>" />
182
+ </div> <!-- .wpuf-form-rows -->
183
+
184
+ <div class="wpuf-form-rows">
185
+ <label><?php _e( 'Textarea', 'wpuf' ); ?></label>
186
+
187
+ <div class="wpuf-form-sub-fields">
188
+ <label><input type="radio" name="<?php echo $rich_name; ?>" value="no"<?php checked( $rich_value, 'no' ); ?>> <?php _e( 'Normal', 'wpuf' ); ?></label>
189
+ <label><input type="radio" name="<?php echo $rich_name; ?>" value="yes"<?php checked( $rich_value, 'yes' ); ?>> <?php _e( 'Rich textarea', 'wpuf' ); ?></label>
190
+ <label><input type="radio" name="<?php echo $rich_name; ?>" value="teeny"<?php checked( $rich_value, 'teeny' ); ?>> <?php _e( 'Teeny Rich textarea', 'wpuf' ); ?></label>
191
+ </div>
192
+ </div> <!-- .wpuf-form-rows -->
193
+ <?php
194
+ }
195
+
196
+ /**
197
+ * Hidden field helper function
198
+ *
199
+ * @param string $name
200
+ * @param string $value
201
+ */
202
+ public static function hidden_field( $name, $value = '' ) {
203
+ printf( '<input type="hidden" name="%s" value="%s" />', self::$input_name . $name, $value );
204
+ }
205
+
206
+ /**
207
+ * Displays a radio custom field
208
+ *
209
+ * @param int $field_id
210
+ * @param string $name
211
+ * @param array $values
212
+ */
213
+ public static function radio_fields( $field_id, $name, $values = array() ) {
214
+
215
+ $selected_name = sprintf( '%s[%d][selected]', self::$input_name, $field_id );
216
+ $input_name = sprintf( '%s[%d][%s]', self::$input_name, $field_id, $name );
217
+ $input_value_name = sprintf( '%s[%d][%s]', self::$input_name, $field_id, $name.'_values' );
218
+
219
+ $selected_value = ( $values && isset( $values['selected'] ) ) ? $values['selected'] : '';
220
+ ?>
221
+
222
+ <label for="wpuf-<?php echo $name.'_'.$field_id; ?>" class="wpuf-show-field-value">
223
+ <input type="checkbox" class="wpuf-value-handelar" id="wpuf-<?php echo $name . '_' . $field_id; ?>"><?php _e( 'Show values', 'wpuf' ); ?>
224
+ </label>
225
+
226
+ <div class="wpuf-option-label-value"><span><?php _e( 'Label', 'wpuf' ); ?></span><span class="wpuf-option-value" style="display: none;"><?php _e( 'Value', 'wpuf' ); ?></span></div>
227
+ <?php
228
+ if ( $values && $values['options'] > 0 ) {
229
+ foreach ($values['options'] as $key => $value) {
230
+ ?>
231
+ <div class="wpuf-clone-field">
232
+ <input type="radio" name="<?php echo $selected_name ?>" value="<?php echo $value; ?>" <?php checked( $selected_value, $value ); ?>>
233
+ <input type="text" data-type="option" name="<?php echo $input_name; ?>[]" value="<?php echo $value; ?>">
234
+ <input type="text" data-type="option_value" name="<?php echo $input_value_name; ?>[]" value="<?php echo $key; ?>" style="display:none;">
235
+
236
+ <?php self::remove_button(); ?>
237
+ </div>
238
+ <?php
239
+ }
240
+
241
+ } else {
242
+ ?>
243
+ <div class="wpuf-clone-field">
244
+ <input type="radio" name="<?php echo $selected_name ?>">
245
+ <input type="text" data-type="option" name="<?php echo $input_name; ?>[]" value="">
246
+ <input type="text" data-type="option_value" name="<?php echo $input_value_name; ?>[]" value="" style="display:none;">
247
+
248
+ <?php self::remove_button(); ?>
249
+ </div>
250
+ <?php
251
+ }
252
+ }
253
+
254
+ public static function conditional_field( $field_id, $con_fields = array() ) {
255
+
256
+ do_action( 'wpuf_conditional_field_render_hook',$field_id, $con_fields, 'WPUF_Admin_Template' );
257
+
258
+ }
259
+
260
+ /**
261
+ * Displays a checkbox custom field
262
+ *
263
+ * @param int $field_id
264
+ * @param string $name
265
+ * @param array $values
266
+ */
267
+ public static function common_checkbox( $field_id, $name, $values = array() ) {
268
+
269
+ $selected_name = sprintf( '%s[%d][selected]', self::$input_name, $field_id );
270
+ $input_name = sprintf( '%s[%d][%s]', self::$input_name, $field_id, $name );
271
+ $input_value_name = sprintf( '%s[%d][%s]', self::$input_name, $field_id, $name.'_values' );
272
+
273
+ $selected_value = ( $values && isset( $values['selected'] ) ) ? $values['selected'] : array();
274
+
275
+ ?>
276
+ <style>
277
+ .wpuf-option-label-value span {
278
+ font-weight: bold;
279
+ margin-left: 5%;
280
+ margin-right: 27%;
281
+ }
282
+ </style>
283
+ <input type="checkbox" class="wpuf-value-handelar" id="<?php echo $name.'_'.$field_id; ?>"><label for="<?php echo $name.'_'.$field_id; ?>"><?php _e('show values', 'wpuf'); ?></label>
284
+ <div class="wpuf-option-label-value"><span><?php _e( 'Label', 'wpuf' ); ?></span><span class="wpuf-option-value" style="display: none;"><?php _e( 'Value', 'wpuf' ); ?></span></div>
285
+ <?php
286
+ if ( $values && $values['options'] > 0 ) {
287
+ foreach ($values['options'] as $key => $value) {
288
+ ?>
289
+ <div class="wpuf-clone-field">
290
+
291
+ <input type="checkbox" name="<?php echo $selected_name ?>[]" value="<?php echo $value; ?>"<?php echo in_array( $value, $selected_value ) ? ' checked="checked"' : ''; ?> />
292
+ <input type="text" data-type="option" name="<?php echo $input_name; ?>[]" value="<?php echo $value; ?>">
293
+ <input type="text" data-type="option_value" name="<?php echo $input_value_name; ?>[]" value="<?php echo $key; ?>" style="display:none;">
294
+ <?php self::remove_button(); ?>
295
+ </div>
296
+ <?php
297
+ }
298
+ } else {
299
+ ?>
300
+ <div class="wpuf-clone-field">
301
+ <input type="checkbox" name="<?php echo $selected_name ?>[]">
302
+ <input type="text" data-type="option" name="<?php echo $input_name; ?>[]" value="">
303
+ <input type="text" data-type="option_value" name="<?php echo $input_value_name; ?>[]" value="" style="display:none;">
304
+
305
+ <?php self::remove_button(); ?>
306
+ </div>
307
+ <?php
308
+ }
309
+ }
310
+
311
+ /**
312
+ * Add/remove buttons for repeatable fields
313
+ *
314
+ * @return void
315
+ */
316
+ public static function remove_button() {
317
+ $add = plugins_url( 'assets/images/add.png', dirname( __FILE__ ) );
318
+ $remove = plugins_url( 'assets/images/remove.png', dirname( __FILE__ ) );
319
+ ?>
320
+ <img style="cursor:pointer; margin:0 3px;" alt="add another choice" title="add another choice" class="wpuf-clone-field" src="<?php echo $add; ?>">
321
+ <img style="cursor:pointer;" class="wpuf-remove-field" alt="remove this choice" title="remove this choice" src="<?php echo $remove; ?>">
322
+ <?php
323
+ }
324
+
325
+ public static function get_buffered( $func, $field_id, $label ) {
326
+ ob_start();
327
+
328
+ self::$func( $field_id, $label );
329
+
330
+ return ob_get_clean();
331
+ }
332
+
333
+ public static function text_field( $field_id, $label, $values = array() ) {
334
+
335
+ ?>
336
+ <li class="custom-field text_field">
337
+ <?php self::legend( $label, $values, $field_id ); ?>
338
+ <?php self::hidden_field( "[$field_id][input_type]", 'text' ); ?>
339
+ <?php self::hidden_field( "[$field_id][template]", 'text_field' ); ?>
340
+
341
+ <div class="wpuf-form-holder">
342
+ <?php self::common( $field_id, '', true, $values ); ?>
343
+ <?php self::common_text( $field_id, $values ); ?>
344
+ <?php self::conditional_field( $field_id, $values ); ?>
345
+ </div> <!-- .wpuf-form-holder -->
346
+ </li>
347
+ <?php
348
+ }
349
+
350
+ public static function textarea_field( $field_id, $label, $values = array() ) {
351
+ $word_restriction_name = sprintf( '%s[%d][word_restriction]', self::$input_name, $field_id );
352
+ $word_restriction_value = isset( $values['word_restriction'] ) && is_numeric( $values['word_restriction'] ) ? $values['word_restriction'] : '';
353
+ ?>
354
+ <li class="custom-field textarea_field">
355
+ <?php self::legend( $label, $values, $field_id ); ?>
356
+ <?php self::hidden_field( "[$field_id][input_type]", 'textarea' ); ?>
357
+ <?php self::hidden_field( "[$field_id][template]", 'textarea_field' ); ?>
358
+
359
+ <div class="wpuf-form-holder">
360
+ <?php self::common( $field_id, '', true, $values ); ?>
361
+ <?php self::common_textarea( $field_id, $values ); ?>
362
+ <div class="wpuf-form-rows">
363
+ <label><?php _e( 'Word Restriction', 'wpuf' ); ?></label>
364
+
365
+ <div class="wpuf-form-sub-fields">
366
+ <label>
367
+ <input type="text" class="smallipopInput" name="<?php echo $word_restriction_name ?>" value="<?php echo $word_restriction_value; ?>" title="<?php esc_attr_e( 'Numebr of words the author to be restricted in', 'wpuf' ); ?>" />
368
+ </label>
369
+ </div>
370
+ </div>
371
+ <?php self::conditional_field( $field_id, $values ); ?>
372
+ </div> <!-- .wpuf-form-holder -->
373
+ </li>
374
+ <?php
375
+ }
376
+
377
+ public static function radio_field( $field_id, $label, $values = array() ) {
378
+ ?>
379
+ <li class="custom-field radio_field wpuf-conditional">
380
+ <?php self::legend( $label, $values, $field_id ); ?>
381
+ <?php self::hidden_field( "[$field_id][input_type]", 'radio' ); ?>
382
+ <?php self::hidden_field( "[$field_id][template]", 'radio_field' ); ?>
383
+
384
+ <div class="wpuf-form-holder">
385
+ <?php self::common( $field_id, '', true, $values ); ?>
386
+
387
+ <div class="wpuf-form-rows">
388
+ <label><?php _e( 'Options', 'wpuf' ); ?></label>
389
+
390
+ <div class="wpuf-form-sub-fields wpuf-options">
391
+ <?php self::radio_fields( $field_id, 'options', $values ); ?>
392
+
393
+ </div> <!-- .wpuf-form-sub-fields -->
394
+ <?php self::conditional_field( $field_id, $values ); ?>
395
+ </div> <!-- .wpuf-form-rows -->
396
+ </div> <!-- .wpuf-form-holder -->
397
+ </li>
398
+ <?php
399
+ }
400
+
401
+ public static function checkbox_field( $field_id, $label, $values = array() ) {
402
+ ?>
403
+ <li class="custom-field checkbox_field wpuf-conditional">
404
+ <?php self::legend( $label, $values, $field_id ); ?>
405
+ <?php self::hidden_field( "[$field_id][input_type]", 'checkbox' ); ?>
406
+ <?php self::hidden_field( "[$field_id][template]", 'checkbox_field' ); ?>
407
+
408
+ <div class="wpuf-form-holder">
409
+ <?php self::common( $field_id, '', true, $values ); ?>
410
+
411
+ <div class="wpuf-form-rows">
412
+ <label><?php _e( 'Options', 'wpuf' ); ?></label>
413
+
414
+ <div class="wpuf-form-sub-fields wpuf-options">
415
+ <?php self::common_checkbox( $field_id, 'options', $values ); ?>
416
+
417
+ </div> <!-- .wpuf-form-sub-fields -->
418
+ <?php self::conditional_field( $field_id, $values ); ?>
419
+ </div> <!-- .wpuf-form-rows -->
420
+ </div> <!-- .wpuf-form-holder -->
421
+ </li>
422
+ <?php
423
+ }
424
+
425
+ public static function dropdown_field( $field_id, $label, $values = array() ) {
426
+ $first_name = sprintf( '%s[%d][first]', self::$input_name, $field_id );
427
+ $first_value = $values ? $values['first'] : ' - select -';
428
+ $help = esc_attr( __( 'First element of the select dropdown. Leave this empty if you don\'t want to show this field', 'wpuf' ) );
429
+ ?>
430
+ <li class="custom-field dropdown_field wpuf-conditional">
431
+ <?php self::legend( $label, $values, $field_id ); ?>
432
+ <?php self::hidden_field( "[$field_id][input_type]", 'select' ); ?>
433
+ <?php self::hidden_field( "[$field_id][template]", 'dropdown_field' ); ?>
434
+
435
+ <div class="wpuf-form-holder">
436
+ <?php self::common( $field_id, '', true, $values ); ?>
437
+
438
+ <div class="wpuf-form-rows">
439
+ <label><?php _e( 'Select Text', 'wpuf' ); ?></label>
440
+ <input type="text" class="smallipopInput" name="<?php echo $first_name; ?>" value="<?php echo $first_value; ?>" title="<?php echo $help; ?>">
441
+ </div> <!-- .wpuf-form-rows -->
442
+
443
+ <div class="wpuf-form-rows">
444
+ <label><?php _e( 'Options', 'wpuf' ); ?></label>
445
+
446
+ <div class="wpuf-form-sub-fields wpuf-options">
447
+ <?php self::radio_fields( $field_id, 'options', $values ); ?>
448
+ </div> <!-- .wpuf-form-sub-fields -->
449
+
450
+ <?php self::conditional_field( $field_id, $values ); ?>
451
+ </div> <!-- .wpuf-form-rows -->
452
+ </div> <!-- .wpuf-form-holder -->
453
+ </li>
454
+ <?php
455
+ }
456
+
457
+ public static function multiple_select( $field_id, $label, $values = array() ) {
458
+ $first_name = sprintf( '%s[%d][first]', self::$input_name, $field_id );
459
+ $first_value = $values ? $values['first'] : ' - select -';
460
+ $help = esc_attr( __( 'First element of the select dropdown. Leave this empty if you don\'t want to show this field', 'wpuf' ) );
461
+ ?>
462
+ <li class="custom-field multiple_select">
463
+ <?php self::legend( $label, $values, $field_id ); ?>
464
+ <?php self::hidden_field( "[$field_id][input_type]", 'multiselect' ); ?>
465
+ <?php self::hidden_field( "[$field_id][template]", 'multiple_select' ); ?>
466
+
467
+ <div class="wpuf-form-holder">
468
+ <?php self::common( $field_id, '', true, $values ); ?>
469
+
470
+ <div class="wpuf-form-rows">
471
+ <label><?php _e( 'Select Text', 'wpuf' ); ?></label>
472
+ <input type="text" class="smallipopInput" name="<?php echo $first_name; ?>" value="<?php echo $first_value; ?>" title="<?php echo $help; ?>">
473
+ </div> <!-- .wpuf-form-rows -->
474
+
475
+ <div class="wpuf-form-rows">
476
+ <label><?php _e( 'Options', 'wpuf' ); ?></label>
477
+
478
+ <div class="wpuf-form-sub-fields wpuf-options">
479
+ <?php self::radio_fields( $field_id, 'options', $values ); ?>
480
+ </div> <!-- .wpuf-form-sub-fields -->
481
+
482
+ <?php self::conditional_field( $field_id, $values ); ?>
483
+ </div> <!-- .wpuf-form-rows -->
484
+ </div> <!-- .wpuf-form-holder -->
485
+ </li>
486
+ <?php
487
+ }
488
+
489
+ public static function website_url( $field_id, $label, $values = array() ) {
490
+ ?>
491
+ <li class="custom-field website_url">
492
+ <?php self::legend( $label, $values, $field_id ); ?>
493
+ <?php self::hidden_field( "[$field_id][input_type]", 'url' ); ?>
494
+ <?php self::hidden_field( "[$field_id][template]", 'website_url' ); ?>
495
+
496
+ <div class="wpuf-form-holder">
497
+ <?php self::common( $field_id, '', true, $values ); ?>
498
+ <?php self::common_text( $field_id, $values ); ?>
499
+ <?php self::conditional_field( $field_id, $values ); ?>
500
+ </div> <!-- .wpuf-form-holder -->
501
+ </li>
502
+ <?php
503
+ }
504
+
505
+ public static function email_address( $field_id, $label, $values = array() ) {
506
+ ?>
507
+ <li class="custom-field eamil_address">
508
+ <?php self::legend( $label, $values, $field_id ); ?>
509
+ <?php self::hidden_field( "[$field_id][input_type]", 'email' ); ?>
510
+ <?php self::hidden_field( "[$field_id][template]", 'email_address' ); ?>
511
+
512
+ <div class="wpuf-form-holder">
513
+ <?php self::common( $field_id, '', true, $values ); ?>
514
+ <?php self::common_text( $field_id, $values ); ?>
515
+ <?php self::conditional_field( $field_id, $values ); ?>
516
+ </div> <!-- .wpuf-form-holder -->
517
+ </li>
518
+ <?php
519
+ }
520
+
521
+ public static function custom_html( $field_id, $label, $values = array() ) {
522
+ $title_name = sprintf( '%s[%d][label]', self::$input_name, $field_id );
523
+ $html_name = sprintf( '%s[%d][html]', self::$input_name, $field_id );
524
+ $title_value = $values ? esc_attr( $values['label'] ) : '';
525
+ $html_value = $values ? esc_attr( $values['html'] ) : '';
526
+ ?>
527
+ <li class="custom-field custom_html">
528
+ <?php self::legend( $label, $values, $field_id ); ?>
529
+ <?php self::hidden_field( "[$field_id][input_type]", 'html' ); ?>
530
+ <?php self::hidden_field( "[$field_id][template]", 'custom_html' ); ?>
531
+
532
+ <div class="wpuf-form-holder">
533
+ <div class="wpuf-form-rows">
534
+ <label><?php _e( 'Title', 'wpuf' ); ?></label>
535
+ <input type="text" class="smallipopInput" title="Title of the section" name="<?php echo $title_name; ?>" value="<?php echo esc_attr( $title_value ); ?>" />
536
+ </div> <!-- .wpuf-form-rows -->
537
+
538
+ <div class="wpuf-form-rows">
539
+ <label><?php _e( 'HTML Codes', 'wpuf' ); ?></label>
540
+ <textarea class="smallipopInput" title="Paste your HTML codes, WordPress shortcodes will also work here" name="<?php echo $html_name; ?>" rows="10"><?php echo esc_html( $html_value ); ?></textarea>
541
+ </div>
542
+
543
+ <?php self::conditional_field( $field_id, $values ); ?>
544
+ </div> <!-- .wpuf-form-holder -->
545
+ </li>
546
+ <?php
547
+ }
548
+
549
+ public static function custom_hidden_field( $field_id, $label, $values = array() ) {
550
+ $meta_name = sprintf( '%s[%d][name]', self::$input_name, $field_id );
551
+ $value_name = sprintf( '%s[%d][meta_value]', self::$input_name, $field_id );
552
+ $is_meta_name = sprintf( '%s[%d][is_meta]', self::$input_name, $field_id );
553
+ $label_name = sprintf( '%s[%d][label]', self::$input_name, $field_id );
554
+
555
+ $meta_value = $values ? esc_attr( $values['name'] ) : '';
556
+ $value_value = $values ? esc_attr( $values['meta_value'] ) : '';
557
+ ?>
558
+ <li class="custom-field custom_hidden_field">
559
+ <?php self::legend( $label, $values, $field_id ); ?>
560
+ <?php self::hidden_field( "[$field_id][input_type]", 'hidden' ); ?>
561
+ <?php self::hidden_field( "[$field_id][template]", 'custom_hidden_field' ); ?>
562
+
563
+ <div class="wpuf-form-holder">
564
+ <div class="wpuf-form-rows">
565
+ <label><?php _e( 'Meta Key', 'wpuf' ); ?></label>
566
+ <input type="text" name="<?php echo $meta_name; ?>" value="<?php echo $meta_value; ?>" class="smallipopInput" title="<?php _e( 'Name of the meta key this field will save to', 'wpuf' ); ?>">
567
+ <input type="hidden" name="<?php echo $is_meta_name; ?>" value="yes">
568
+ <input type="hidden" name="<?php echo $label_name; ?>" value="">
569
+ </div> <!-- .wpuf-form-rows -->
570
+
571
+ <div class="wpuf-form-rows">
572
+ <label><?php _e( 'Meta Value', 'wpuf' ); ?></label>
573
+ <input type="text" class="smallipopInput" title="<?php esc_attr_e( 'Enter the meta value', 'wpuf' ); ?>" name="<?php echo $value_name; ?>" value="<?php echo $value_value; ?>">
574
+ </div>
575
+ </div> <!-- .wpuf-form-holder -->
576
+ </li>
577
+ <?php
578
+ }
579
+
580
+ public static function section_break( $field_id, $label, $values = array() ) {
581
+ $title_name = sprintf( '%s[%d][label]', self::$input_name, $field_id );
582
+ $description_name = sprintf( '%s[%d][description]', self::$input_name, $field_id );
583
+
584
+ $title_value = $values ? esc_attr( $values['label'] ) : '';
585
+ $description_value = $values ? esc_attr( $values['description'] ) : '';
586
+ ?>
587
+ <li class="custom-field custom_html">
588
+ <?php self::legend( $label, $values, $field_id ); ?>
589
+ <?php self::hidden_field( "[$field_id][input_type]", 'section_break' ); ?>
590
+ <?php self::hidden_field( "[$field_id][template]", 'section_break' ); ?>
591
+
592
+ <div class="wpuf-form-holder">
593
+ <div class="wpuf-form-rows">
594
+ <label><?php _e( 'Title', 'wpuf' ); ?></label>
595
+ <input type="text" class="smallipopInput" title="Title of the section" name="<?php echo $title_name; ?>" value="<?php echo esc_attr( $title_value ); ?>" />
596
+ </div> <!-- .wpuf-form-rows -->
597
+
598
+ <div class="wpuf-form-rows">
599
+ <label><?php _e( 'Description', 'wpuf' ); ?></label>
600
+ <textarea class="smallipopInput" title="Some details text about the section" name="<?php echo $description_name; ?>" rows="3"><?php echo esc_html( $description_value ); ?></textarea>
601
+ </div> <!-- .wpuf-form-rows -->
602
+
603
+ <?php self::conditional_field( $field_id, $values ); ?>
604
+ </div> <!-- .wpuf-form-holder -->
605
+ </li>
606
+ <?php
607
+ }
608
+
609
+ /**
610
+ * Render image upload
611
+ *
612
+ * @param $field_id
613
+ * @param $label
614
+ * @param self
615
+ * @param array $values
616
+ */
617
+ public static function image_upload( $field_id, $label, $values = array() ) {
618
+ $max_size_name = sprintf( '%s[%d][max_size]', self::$input_name, $field_id );
619
+ $max_files_name = sprintf( '%s[%d][count]', self::$input_name, $field_id );
620
+
621
+ $max_size_value = $values ? $values['max_size'] : '1024';
622
+ $max_files_value = $values ? $values['count'] : '1';
623
+
624
+ $help = esc_attr( __( 'Enter maximum upload size limit in KB', 'wpuf' ) );
625
+ $count = esc_attr( __( 'Number of images can be uploaded', 'wpuf' ) );
626
+ ?>
627
+ <li class="custom-field image_upload">
628
+ <?php self::legend( $label, $values, $field_id ); ?>
629
+ <?php self::hidden_field( "[$field_id][input_type]", 'image_upload' ); ?>
630
+ <?php self::hidden_field( "[$field_id][template]", 'image_upload' ); ?>
631
+
632
+ <div class="wpuf-form-holder">
633
+ <?php self::common( $field_id, '', true, $values ); ?>
634
+
635
+ <div class="wpuf-form-rows">
636
+ <label><?php _e( 'Max. file size', 'wpuf' ); ?></label>
637
+ <input type="text" class="smallipopInput" name="<?php echo $max_size_name; ?>" value="<?php echo $max_size_value; ?>" title="<?php echo $help; ?>">
638
+ </div> <!-- .wpuf-form-rows -->
639
+
640
+ <div class="wpuf-form-rows">
641
+ <label><?php _e( 'Max. files', 'wpuf' ); ?></label>
642
+ <input type="text" class="smallipopInput" name="<?php echo $max_files_name; ?>" value="<?php echo $max_files_value; ?>" title="<?php echo $count; ?>">
643
+ </div> <!-- .wpuf-form-rows -->
644
+
645
+ <?php self::conditional_field( $field_id, $values ); ?>
646
+ </div> <!-- .wpuf-form-holder -->
647
+ </li>
648
+ <?php
649
+ }
650
+
651
+ }
admin/tools.php ADDED
@@ -0,0 +1,445 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Manage Import Export
5
+ *
6
+ * @since 2.2
7
+ * @package WP User Frontend
8
+ */
9
+ class WPUF_Admin_Tools {
10
+
11
+ /**
12
+ * List of All the post forms
13
+ *
14
+ * @return void
15
+ */
16
+ function list_forms() {
17
+
18
+ if ( isset( $_POST['export'] ) ) {
19
+ $this->export_data( $_POST['export_content'], $_POST['formlist'] );
20
+ }
21
+
22
+ $args = array(
23
+ 'post_type' => 'wpuf_forms',
24
+ 'posts_per_page' => -1,
25
+ 'post_status' => 'publish'
26
+ );
27
+ $forms = get_posts( $args );
28
+
29
+ if ( $forms ) {
30
+ ?>
31
+ <div class="postbox" style="margin-top: 15px;">
32
+ <h3 style="padding:10px 15px"><?php _e( 'Form Export', 'wpuf' ); ?></h3>
33
+ <div class="inside">
34
+ <div class="main">
35
+ <form action="" method="post" style="margin-top: 20px;">
36
+ <p>
37
+ <input class="export_type" type="radio" name="export_content" value="all" id="wpuf-all_export" checked>
38
+ <label for="wpuf-all_export"><?php _e( 'All', 'wpuf' ); ?></label>
39
+ </p>
40
+
41
+ <p>
42
+ <input class="export_type" type="radio" name="export_content" value="selected" id="wpuf-selected_export">
43
+ <label for="wpuf-selected_export"><?php _e( 'Select individual', 'wpuf' ); ?></label></p>
44
+ <p>
45
+ <select class="formlist" name="formlist[]" multiple="multiple">
46
+ <?php foreach ( $forms as $form ) { ?>
47
+ <option value="<?php echo esc_attr( $form->ID ) ?>"><?php echo esc_attr( $form->post_title ); ?></option>
48
+ <?php } ?>
49
+ </select>
50
+ </p>
51
+
52
+ <?php wp_nonce_field( 'wpuf-export-form' ); ?>
53
+ <input type="submit" class="button button-primary" name="export" value="<?php _e( 'Export', 'wpuf' ) ?>">
54
+ </form>
55
+ </div>
56
+ </div>
57
+ </div>
58
+
59
+ <?php
60
+ } else {
61
+ sprintf( '<p>%s</p>', __( 'Sorry you have no form to export', 'wpuf' ) );
62
+ }
63
+ }
64
+
65
+ /**
66
+ * List of All Registration forms
67
+ *
68
+ * @return void
69
+ */
70
+ function list_regis_forms() {
71
+
72
+ if ( isset( $_POST['export_regis_form'] ) ) {
73
+ $this->export_regis_data( $_POST['export_regis_content'], $_POST['formlist'] );
74
+ }
75
+
76
+ $args = array(
77
+ 'post_type' => 'wpuf_profile',
78
+ 'posts_per_page' => -1,
79
+ 'post_status' => 'publish'
80
+ );
81
+
82
+ $forms = get_posts( $args );
83
+ if ( $forms ) {
84
+ ?>
85
+ <div class="postbox">
86
+ <h3 style="padding:10px 15px"><?php _e( 'Registration Form Export', 'wpuf' ); ?></h3>
87
+ <div class="inside">
88
+ <div class="main">
89
+
90
+ <form action="" method="post" style="margin-top: 20px;">
91
+
92
+ <p>
93
+ <input class="export_type" type="radio" name="export_regis_content" value="all" id="wpuf-all_regis_export" checked>
94
+ <label for="wpuf-all_regis_export"><?php _e( 'All', 'wpuf' ); ?></label>
95
+ </p>
96
+
97
+ <p>
98
+ <input class="export_type" type="radio" name="export_regis_content" value="selected" id="wpuf-selected_regis_export">
99
+ <label for="wpuf-selected_regis_export"><?php _e( 'Select individual', 'wpuf' ); ?></label>
100
+ </p>
101
+
102
+ <p>
103
+ <select class="formlist" name="formlist[]" multiple="multiple">
104
+ <?php foreach ( $forms as $form ) { ?>
105
+ <option value="<?php echo esc_attr( $form->ID ); ?>"><?php echo esc_attr( $form->post_title ); ?></option>";
106
+ <?php } ?>
107
+ </select>
108
+ </p>
109
+
110
+ <?php wp_nonce_field( 'wpuf-export-regs-form' ); ?>
111
+
112
+ <input type="submit" class="button button-primary" name="export_regis_form" value="<?php _e( 'Export', 'wpuf' ) ?>">
113
+ </form>
114
+ </div>
115
+ </div>
116
+ </div>
117
+ <?php
118
+ } else {
119
+ sprintf( '<p>%s</p>', __( 'Sorry you have no form to export', 'wpuf' ) );
120
+ }
121
+ }
122
+
123
+ /**
124
+ * Import functionality
125
+ */
126
+ function import_data() {
127
+
128
+ if ( isset( $_FILES['import'] ) && check_admin_referer( 'wpuf-import' ) ) {
129
+
130
+ if ( $_FILES['import']['error'] > 0 ) {
131
+
132
+ printf( '<div class="error"><p>%s</p></div>', __( 'Somthing went wrong. Please choose a file again', 'wpuf' ) );
133
+ } else {
134
+
135
+ $file_name = $_FILES['import']['name'];
136
+ $file_ext = pathinfo( $file_name, PATHINFO_EXTENSION );
137
+ $file_size = $_FILES['import']['size'];
138
+
139
+ if ( ($file_ext == "json") && ($file_size < 500000) ) {
140
+
141
+ $data = $this->import_json_file( $_FILES['import']['tmp_name'] );
142
+
143
+ if ( $data ) {
144
+ printf( '<div class="updated"><p>%s</p></div>', __( 'Import successful. Have fun!', 'wpuf' ) );
145
+ }
146
+ } else {
147
+ printf( '<div class="error"><p>%s</p></div>', __( 'Invalid file or file size too big.', 'wpuf' ) );
148
+ }
149
+ }
150
+ }
151
+ ?>
152
+
153
+ <h3><?php _e( 'Import forms', 'wpuf' ); ?></h3>
154
+
155
+ <p><?php _e( 'Click Browse button and choose a json file that you backup before.', 'wpuf' ); ?></p>
156
+ <p><?php _e( 'Press Restore button, WordPress does the rest for you.', 'wpuf' ); ?></p>
157
+
158
+ <form action="" method="post" enctype='multipart/form-data' style="margin-top: 20px;">
159
+ <?php wp_nonce_field( 'wpuf-import' ); ?>
160
+ <input type='file' name='import' />
161
+ <input type="submit" class="button button-primary" name="import_data" value="<?php _e( 'Import', 'wpuf' ); ?>">
162
+ </form>
163
+ <?php
164
+ }
165
+
166
+ /**
167
+ * Import json file into database
168
+ * @param array $file
169
+ * @return boolean
170
+ */
171
+ function import_json_file( $file ) {
172
+
173
+ $encode_data = file_get_contents( $file );
174
+ $options = json_decode( $encode_data, true );
175
+
176
+ foreach ( $options as $key => $value ) {
177
+
178
+ $generate_post = array(
179
+ 'post_title' => $value['post_data']['post_title'],
180
+ 'post_status' => $value['post_data']['post_status'],
181
+ 'post_type' => $value['post_data']['post_type'],
182
+ 'ping_status' => $value['post_data']['ping_status'],
183
+ 'comment_status' => $value['post_data']['comment_status']
184
+ );
185
+
186
+ $post_id = wp_insert_post( $generate_post, true );
187
+
188
+ if ( $post_id && !is_wp_error( $post_id ) ) {
189
+
190
+ foreach ( $value['meta_data']['fields'] as $order => $field ) {
191
+ WPUF_Admin_Form::insert_form_field( $post_id, $field, false, $order );
192
+ }
193
+
194
+ update_post_meta( $post_id, 'wpuf_form_settings', $value['meta_data']['settings'] );
195
+ }
196
+ }
197
+
198
+ return true;
199
+ }
200
+
201
+ /**
202
+ * Export Registration form
203
+ * @param string $export_type
204
+ * @param integer $post_ids
205
+ */
206
+ function export_regis_data( $export_type, $post_ids ) {
207
+
208
+ if ( $export_type == 'all' && check_admin_referer( 'wpuf-export-regs-form' ) ) {
209
+
210
+ $this->export_to_json( 'wpuf_profile' );
211
+
212
+ } elseif ( $export_type == 'selected' && check_admin_referer( 'wpuf-export-regs-form' ) ) {
213
+
214
+ if ( $_POST['formlist'] == NULL ) {
215
+ printf( '<div class="error"><p>%s</p></div>', __( 'Please select some form for exporting', 'wpuf' ) );
216
+ } else {
217
+ $this->export_to_json( 'wpuf_profile', $post_ids );
218
+ }
219
+ }
220
+ }
221
+
222
+ /**
223
+ * Export normal form data
224
+ * @param string $export_type
225
+ * @param integer $post_ids
226
+ */
227
+ function export_data( $export_type, $post_ids ) {
228
+ if ( $export_type == 'all' && check_admin_referer( 'wpuf-export-form' ) ) {
229
+
230
+ $this->export_to_json( 'wpuf_forms' );
231
+
232
+ } elseif ( $export_type == 'selected' && check_admin_referer( 'wpuf-export-form' ) ) {
233
+
234
+ if ( $_POST['formlist'] == NULL ) {
235
+ printf( '<div class="error"><p>%s</p></div>', __( 'Please select some form for exporting', 'wpuf' ) );
236
+ } else {
237
+ $this->export_to_json( 'wpuf_forms', $post_ids );
238
+ }
239
+ }
240
+ }
241
+
242
+ /**
243
+ * Export into json file
244
+ *
245
+ * @param string $post_type
246
+ * @param array $post_ids
247
+ */
248
+ function export_to_json( $post_type, $post_ids = array( ) ) {
249
+
250
+ $formatted_data = array( );
251
+ $ids = array( );
252
+ $blogname = str_replace( " ", "", get_option( 'blogname' ) );
253
+ $date = date( "Y-m-d" );
254
+ $json_name = $blogname . "-wpuf-" . $date; // Namming the filename will be generated.
255
+
256
+ if ( ! empty( $post_ids ) ) {
257
+ foreach ( $post_ids as $key => $value ) {
258
+ array_push( $ids, $value );
259
+ }
260
+ }
261
+
262
+ $args = array(
263
+ 'post_status' => 'publish',
264
+ 'post_type' => $post_type,
265
+ 'post__in' => (!empty( $ids ) ) ? $ids : ''
266
+ );
267
+
268
+ $query = new WP_Query( $args );
269
+
270
+ foreach ( $query->posts as $post ) {
271
+ $postdata = get_object_vars( $post );
272
+ unset( $postdata['ID'] );
273
+
274
+ $data = array(
275
+ 'post_data' => $postdata,
276
+ 'meta_data' => array(
277
+ 'fields' => wpuf_get_form_fields( $post->ID ),
278
+ 'settings' => get_post_meta( $post->ID, 'wpuf_form_settings', true )
279
+ )
280
+ );
281
+
282
+ array_push( $formatted_data, $data );
283
+ }
284
+
285
+ $json_file = json_encode( $formatted_data ); // Encode data into json data
286
+
287
+ ob_clean();
288
+
289
+ echo $json_file;
290
+
291
+ header( "Content-Type: text/json; charset=" . get_option( 'blog_charset' ) );
292
+ header( "Content-Disposition: attachment; filename=$json_name.json" );
293
+
294
+ exit();
295
+ }
296
+
297
+ /**
298
+ * Formetted meta key value
299
+ *
300
+ * @param array $array
301
+ * @return array
302
+ */
303
+ function formetted_meta_key_value( $array ) {
304
+ $result = array( );
305
+
306
+ foreach ( $array as $key => $val ) {
307
+ $result[$key] = $val[0];
308
+ }
309
+
310
+ return $result;
311
+ }
312
+
313
+ function tool_page() {
314
+ $msg = isset( $_GET['msg'] ) ? $_GET['msg'] : '';
315
+ $text = '';
316
+
317
+ switch ($msg) {
318
+ case 'del_forms':
319
+ $text = __( 'All forms has been deleted', 'wpuf' );
320
+ break;
321
+
322
+ case 'settings_cleared':
323
+ $text = __( 'Settings has been cleared!', 'wpuf' );
324
+ break;
325
+
326
+ case 'del_trans':
327
+ $text = __( 'All transactions has been deleted!', 'wpuf' );
328
+ break;
329
+ }
330
+
331
+ if ( $text ) {
332
+ ?>
333
+ <div class="updated">
334
+ <p>
335
+ <?php echo $text; ?>
336
+ </p>
337
+ </div>
338
+
339
+ <?php } ?>
340
+
341
+
342
+ <div class="metabox-holder">
343
+ <div class="postbox">
344
+ <h3><?php _e( 'Page Installation', 'wpuf' ); ?></h3>
345
+
346
+ <div class="inside">
347
+ <p><?php _e( 'Clicking this button will create required pages for the plugin. Note: It\'ll not delete/replace existing pages.', 'wpuf' ); ?></p>
348
+ <a class="button button-primary" href="<?php echo add_query_arg( array( 'install_wpuf_pages' => true ) ); ?>"><?php _e( 'Install WPUF Pages', 'wpuf' ); ?></a>
349
+ </div>
350
+ </div>
351
+
352
+ <div class="postbox">
353
+ <h3><?php _e( 'Reset Settings', 'wpuf' ); ?></h3>
354
+
355
+ <div class="inside">
356
+ <p><?php _e( '<strong>Caution:</strong> This tool will delete all the plugin settings of WP User Frontend Pro', 'wpuf' ); ?></p>
357
+ <a class="button button-primary" href="<?php echo wp_nonce_url( add_query_arg( array( 'wpuf_action' => 'clear_settings' ), 'admin.php?page=wpuf_tools&action=tools' ), 'wpuf-tools-action' ); ?>" onclick="return confirm('Are you sure?');"><?php _e( 'Reset Settings', 'wpuf' ); ?></a>
358
+ </div>
359
+ </div>
360
+
361
+ <div class="postbox">
362
+ <h3><?php _e( 'Delete Forms', 'wpuf' ); ?></h3>
363
+
364
+ <div class="inside">
365
+ <p><?php _e( '<strong>Caution:</strong> This tool will delete all the post and registration/profile forms.', 'wpuf' ); ?></p>
366
+
367
+ <a class="button button-primary" href="<?php echo wp_nonce_url( add_query_arg( array( 'wpuf_action' => 'del_post_forms' ), 'admin.php?page=wpuf_tools&action=tools' ), 'wpuf-tools-action' ); ?>" onclick="return confirm('Are you sure?');"><?php _e( 'Delete Post Forms', 'wpuf' ); ?></a>
368
+ <a class="button button-primary" href="<?php echo wp_nonce_url( add_query_arg( array( 'wpuf_action' => 'del_pro_forms' ), 'admin.php?page=wpuf_tools&action=tools' ), 'wpuf-tools-action' ); ?>" onclick="return confirm('Are you sure?');"><?php _e( 'Delete Registration Forms', 'wpuf' ); ?></a>
369
+ <a class="button button-primary" href="<?php echo wp_nonce_url( add_query_arg( array( 'wpuf_action' => 'del_subs' ), 'admin.php?page=wpuf_tools&action=tools' ), 'wpuf-tools-action' ); ?>" onclick="return confirm('Are you sure?');"><?php _e( 'Delete Subscriptions', 'wpuf' ); ?></a>
370
+ <a class="button button-primary" href="<?php echo wp_nonce_url( add_query_arg( array( 'wpuf_action' => 'del_coupon' ), 'admin.php?page=wpuf_tools&action=tools' ), 'wpuf-tools-action' ); ?>" onclick="return confirm('Are you sure?');"><?php _e( 'Delete Coupons', 'wpuf' ); ?></a>
371
+ </div>
372
+ </div>
373
+
374
+ <div class="postbox">
375
+ <h3><?php _e( 'Transactions', 'wpuf' ); ?></h3>
376
+
377
+ <div class="inside">
378
+ <p><?php _e( 'This tool will delete all the transactions from the transaction table.', 'wpuf' ); ?></p>
379
+
380
+ <a class="button button-primary" href="<?php echo wp_nonce_url( add_query_arg( array( 'wpuf_action' => 'clear_transaction' ), 'admin.php?page=wpuf_tools&action=tools' ), 'wpuf-tools-action' ); ?>" onclick="return confirm('Are you sure?');"><?php _e( 'Delete Transactions', 'wpuf' ); ?></a>
381
+ </div>
382
+ </div>
383
+ </div>
384
+ <?php
385
+ }
386
+
387
+ }
388
+
389
+ $tools = new WPUF_Admin_Tools();
390
+ ?>
391
+
392
+ <div class="wrap">
393
+ <div id="icon-options-general" class="icon32"><br></div>
394
+
395
+ <h2 class="nav-tab-wrapper">
396
+ <a class="nav-tab <?php echo (!isset( $_GET['action'] ) ) ? 'nav-tab-active' : ''; ?>" href="<?php echo add_query_arg( array( 'page' => 'wpuf_tools' ), admin_url( 'admin.php' ) ); ?>"><?php _e( 'Import', 'wpuf' ); ?></a>
397
+ <a class="nav-tab <?php echo ( isset( $_GET['action'] ) && $_GET['action'] == 'export' ) ? 'nav-tab-active' : ''; ?>" href="<?php echo add_query_arg( array( 'page' => 'wpuf_tools', 'action' => 'export' ), admin_url( 'admin.php' ) ); ?>"><?php _e( 'Export', 'wpuf' ); ?></a>
398
+ <a class="nav-tab <?php echo ( isset( $_GET['action'] ) && $_GET['action'] == 'tools' ) ? 'nav-tab-active' : ''; ?>" href="<?php echo add_query_arg( array( 'page' => 'wpuf_tools', 'action' => 'tools' ), admin_url( 'admin.php' ) ); ?>"><?php _e( 'Tools', 'wpuf' ); ?></a>
399
+ </h2>
400
+
401
+ <?php
402
+ $action = isset( $_GET['action'] ) ? $_GET['action'] : '';
403
+
404
+ switch ( $action ) {
405
+ case 'export':
406
+ $tools->list_forms();
407
+ $tools->list_regis_forms();
408
+ break;
409
+
410
+ case 'tools':
411
+ $tools->tool_page();
412
+ break;
413
+
414
+ default:
415
+ $tools->import_data();
416
+ break;
417
+ }
418
+ ?>
419
+ </div>
420
+
421
+ <style>
422
+ select.formlist{
423
+ display: block;
424
+ width: 300px;
425
+ }
426
+
427
+ </style>
428
+
429
+ <script>
430
+ (function($){
431
+
432
+ $('.formlist').hide();
433
+ $('input.export_type').on('change',function(){
434
+ $(this).closest('form').find('.formlist').slideUp(200);
435
+
436
+ if( $(this).attr('value') == 'selected' ) {
437
+ $(this).closest('form').find('.formlist').slideDown(200);
438
+ }
439
+ });
440
+
441
+
442
+ })(jQuery);
443
+
444
+ </script>
445
+
admin/transaction.php ADDED
@@ -0,0 +1,227 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ global $wpdb;
3
+
4
+ $base_url = admin_url( 'admin.php?page=wpuf_transaction' );
5
+
6
+ if ( isset( $_GET['action'] ) && $_GET['action'] == 'order_accept' ) {
7
+
8
+ if ( ! current_user_can( 'manage_options' ) ) {
9
+ return;
10
+ }
11
+
12
+ $order_id = isset( $_GET['id'] ) ? intval( $_GET['id'] ) : 0;
13
+ $info = get_post_meta( $order_id, '_data', true );
14
+
15
+ if ( $info ) {
16
+
17
+ switch ($info['type']) {
18
+ case 'post':
19
+ $post_id = $info['item_number'];
20
+ $pack_id = 0;
21
+ break;
22
+
23
+ case 'pack':
24
+ $post_id = 0;
25
+ $pack_id = $info['item_number'];
26
+ break;
27
+ }
28
+
29
+ $transaction = array(
30
+ 'user_id' => $info['user_info']['id'],
31
+ 'status' => 'completed',
32
+ 'cost' => $info['price'],
33
+ 'post_id' => $post_id,
34
+ 'pack_id' => $pack_id,
35
+ 'payer_first_name' => $info['user_info']['first_name'],
36
+ 'payer_last_name' => $info['user_info']['last_name'],
37
+ 'payer_email' => $info['user_info']['email'],
38
+ 'payment_type' => 'Bank/Manual',
39
+ 'transaction_id' => $order_id,
40
+ 'created' => current_time( 'mysql' )
41
+ );
42
+
43
+ do_action( 'wpuf_gateway_bank_order_complete', $transaction, $order_id );
44
+
45
+ WPUF_Payment::insert_payment( $transaction );
46
+ wp_delete_post( $order_id, true );
47
+ }
48
+ }
49
+
50
+ if ( isset( $_GET['action'] ) && $_GET['action'] == 'order_reject' ) {
51
+ $order_id = isset( $_GET['id'] ) ? intval( $_GET['id'] ) : 0;
52
+ do_action( 'wpuf_gateway_bank_order_reject', $order_id );
53
+ wp_delete_post( $order_id, true );
54
+ }
55
+
56
+ if ( isset( $_POST['delete_selected'] ) ) {
57
+
58
+ if ( !wp_verify_nonce( $_POST['_wpnonce'], 'wpuf_delete_transactions' ) ) {
59
+ wp_die("Cheating?");
60
+ }
61
+
62
+ if ( isset( $_POST['tr_id'] ) ) {
63
+ foreach ($_POST['tr_id'] as $tr_id) {
64
+ $wpdb->delete( $wpdb->prefix . 'wpuf_transaction', array('id' => $tr_id), array('%d') );
65
+ }
66
+
67
+ $transaction_deleted = true;
68
+ }
69
+ }
70
+
71
+ $total_income = $wpdb->get_var( "SELECT SUM(cost) FROM {$wpdb->prefix}wpuf_transaction WHERE status = 'completed'" );
72
+ $month_income = $wpdb->get_var( "SELECT SUM(cost) FROM {$wpdb->prefix}wpuf_transaction WHERE YEAR(`created`) = YEAR(NOW()) AND MONTH(`created`) = MONTH(NOW()) AND status = 'completed'" );
73
+ $transactions = $wpdb->get_results( "SELECT * FROM {$wpdb->prefix}wpuf_transaction ORDER BY `created` DESC LIMIT 0, 60", OBJECT );
74
+ ?>
75
+ <div class="wrap">
76
+ <?php screen_icon( 'options-general' ); ?>
77
+ <h2><?php _e( 'WP User Frontend: Payments Received', 'wpuf' ); ?></h2>
78
+
79
+ <ul>
80
+ <li>
81
+ <strong><?php _e( 'Total Income:', 'wpuf' ); ?></strong> <?php echo get_option( 'wpuf_sub_currency_sym' ) . $total_income; ?><br />
82
+ </li>
83
+ <li>
84
+ <strong><?php _e( 'This Month:', 'wpuf' ); ?></strong> <?php echo get_option( 'wpuf_sub_currency_sym' ) . $month_income; ?>
85
+ </li>
86
+ </ul>
87
+
88
+ <?php if ( isset( $transaction_deleted ) && $transaction_deleted == true ) { ?>
89
+ <div class="updated">
90
+ <p><strong><?php _e( 'Transaction(s) deleted', 'wpuf' ); ?></strong></p>
91
+ </div>
92
+ <?php } ?>
93
+
94
+ <form method="post" action="">
95
+ <?php wp_nonce_field( 'wpuf_delete_transactions' ); ?>
96
+
97
+ <table class="widefat meta" style="margin-top: 20px;">
98
+ <thead>
99
+ <tr>
100
+ <th scope="col" class="manage-column column-cb check-column"><input type="checkbox"></th>
101
+ <th scope="col"><?php _e( 'User ID', 'wpuf' ); ?></th>
102
+ <th scope="col"><?php _e( 'Status', 'wpuf' ); ?></th>
103
+ <th scope="col"><?php _e( 'Cost', 'wpuf' ); ?></th>
104
+ <th scope="col"><?php _e( 'Post', 'wpuf' ); ?></th>
105
+ <th scope="col"><?php _e( 'Pack ID', 'wpuf' ); ?></th>
106
+ <th scope="col"><?php _e( 'Payer', 'wpuf' ); ?></th>
107
+ <th scope="col"><?php _e( 'Email', 'wpuf' ); ?></th>
108
+ <th scope="col"><?php _e( 'Type', 'wpuf' ); ?></th>
109
+ <th scope="col"><?php _e( 'Transaction ID', 'wpuf' ); ?></th>
110
+ <th scope="col"><?php _e( 'Created', 'wpuf' ); ?></th>
111
+ </tr>
112
+ </thead>
113
+ <?php
114
+ if ( $transactions ) {
115
+ $count = 0;
116
+ foreach ($transactions as $row) {
117
+ ?>
118
+ <tr valign="top" <?php echo ( ($count % 2) == 0) ? 'class="alternate"' : ''; ?>>
119
+ <th scope="row" class="check-column">
120
+ <input id="cb-select-8231" type="checkbox" name="tr_id[]" value="<?php echo $row->id; ?>">
121
+ </th>
122
+ <td>
123
+ <?php printf( '<a href="%s">%d</a>', admin_url( 'user-edit.php?user_id=' . $row->user_id ), $row->user_id ); ?>
124
+ </td>
125
+ <td><?php echo stripslashes( htmlspecialchars( $row->status ) ); ?></td>
126
+ <td><?php echo stripslashes( htmlspecialchars( $row->cost ) ); ?></td>
127
+ <td>
128
+ <?php
129
+ if ( $row->post_id ) {
130
+ $post = WPUF_Subscription::post_by_orderid( $row->post_id );
131
+ if ( $post) {
132
+ printf( '<a href="%s">%s</a>', get_permalink( $post->ID ), $post->post_title );
133
+ }
134
+ } else {
135
+ echo '&mdash;';
136
+ }
137
+ ?>
138
+ </td>
139
+ <td>
140
+ <?php printf( '<a href="%s">%s</a>', admin_url( 'post.php?action=edit&post=' . $row->pack_id ), get_post_field( 'post_title', $row->pack_id ) ); ?>
141
+ </td>
142
+ <td><?php echo $row->payer_first_name . ' ' . $row->payer_last_name; ?></td>
143
+ <td><?php echo stripslashes( htmlspecialchars( $row->payer_email ) ); ?></td>
144
+ <td><?php echo stripslashes( htmlspecialchars( $row->payment_type ) ); ?></td>
145
+ <td><?php echo stripslashes( htmlspecialchars( $row->transaction_id ) ); ?></td>
146
+ <td><?php echo stripslashes( htmlspecialchars( $row->created ) ); ?></td>
147
+
148
+ </tr>
149
+ <?php
150
+ $count++;
151
+ }
152
+ ?>
153
+ <?php } else { ?>
154
+ <tr>
155
+ <td colspan="11"><?php _e( 'Nothing Found', 'wpuf' ); ?></td>
156
+ </tr>
157
+ <?php } ?>
158
+
159
+ </table>
160
+
161
+ <br>
162
+ <input type="submit" class="button" name="delete_selected" value="<?php esc_attr_e( 'Delete Selected', 'wpuf' ); ?>">
163
+ </form>
164
+
165
+
166
+ <h2 style="margin-top: 30px;"><?php _e( 'Pending Orders', 'wpuf' ); ?></h2>
167
+ <?php
168
+ $args = array(
169
+ 'post_type' => 'wpuf_order',
170
+ 'post_status' => array( 'publish', 'pending' ),
171
+ 'posts_per_page' => -1
172
+ );
173
+ $wpuf_order_query = new WP_Query( apply_filters( 'wpuf_order_query', $args ) );
174
+ $orders = $wpuf_order_query->get_posts();
175
+
176
+ if ( $orders ) {
177
+ ?>
178
+
179
+ <table class="widefat meta" style="margin-top: 10px;">
180
+ <thead>
181
+ <tr>
182
+ <th scope="col"><?php _e( 'ID', 'wpuf' ); ?></th>
183
+ <th scope="col"><?php _e( 'User', 'wpuf' ); ?></th>
184
+ <th scope="col"><?php _e( 'Type', 'wpuf' ); ?></th>
185
+ <th scope="col"><?php _e( 'Cost', 'wpuf' ); ?></th>
186
+ <th scope="col"><?php _e( 'Item Details', 'wpuf' ); ?></th>
187
+ <th scope="col"><?php _e( 'Date', 'wpuf' ); ?></th>
188
+ <th scope="col"><?php _e( 'Action', 'wpuf' ); ?></th>
189
+ </tr>
190
+ </thead>
191
+ <?php
192
+ if ( $orders ) {
193
+ $count = 0;
194
+ foreach ($orders as $order) {
195
+ $data = get_post_meta( $order->ID, '_data', true );
196
+ // var_dump( $data );
197
+ ?>
198
+ <tr valign="top" <?php echo ( ($count % 2) == 0) ? 'class="alternate"' : ''; ?>>
199
+ <td>#<?php echo $order->ID; ?></td>
200
+ <td><?php printf('<a href="%s">[%d] %s %s</a>', admin_url( 'edit-user.php?id=' . $data['user_info']['id'] ), $data['user_info']['id'], $data['user_info']['first_name'], $data['user_info']['last_name'] ); ?></td>
201
+ <td><?php echo ucfirst( $data['type'] ); ?></td>
202
+ <td><?php echo $data['price'] . ' ' . $data['currency']; ?></td>
203
+ <td><?php echo $data['item_name']; ?></td>
204
+ <td><?php echo $data['date']; ?></td>
205
+ <td>
206
+ <a class="button" onclick="return confirm('Are you sure?');" href="<?php echo wp_nonce_url( add_query_arg( array( 'action' => 'order_accept', 'id' => $order->ID ), $base_url), 'wpuf_order_accept' ); ?>"><?php _e( 'Accept', 'wpuf' ); ?></a>
207
+ <a class="button" onclick="return confirm('Are you sure?');" href="<?php echo wp_nonce_url( add_query_arg( array( 'action' => 'order_reject', 'id' => $order->ID ), $base_url), 'wpuf_order_accept' ); ?>"><?php _e( 'Reject', 'wpuf' ); ?></a>
208
+ </td>
209
+
210
+ </tr>
211
+ <?php
212
+ $count++;
213
+ }
214
+ ?>
215
+ <?php } else { ?>
216
+ <tr>
217
+ <td colspan="11"><?php _e( 'Nothing Found', 'wpuf' ); ?></td>
218
+ </tr>
219
+ <?php } ?>
220
+
221
+ </table>
222
+ <?php } else { ?>
223
+
224
+ <?php _e( 'No pending orders found', 'wpuf' ); ?>
225
+
226
+ <?php } ?>
227
+ </div>
assets/css/admin.css ADDED
@@ -0,0 +1,154 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .wpuf-admin fieldset{
2
+ border: 1px solid #E3E3E3;
3
+ margin: 20px 0 0px 0;
4
+ padding-bottom: 20px;
5
+ -moz-border-radius: 5px;
6
+ -webkit-border-radius: 5px;
7
+ background: #fff;
8
+ -moz-box-shadow:inset 0 0 5px #ccc;
9
+ -webkit-box-shadow:inset 0 0 5px #ccc;
10
+ box-shadow:inset 0 0 5px #ccc;
11
+ }
12
+
13
+ .wpuf-admin legend{
14
+ -moz-border-radius: 5px 5px 5px 5px;
15
+ -webkit-border-radius: 5px;
16
+ background: #FFFFFF;
17
+ border: 1px solid #E3E3E3;
18
+ color: #2481C6;
19
+ font-size: 15px;
20
+ font-weight: bold;
21
+ margin-left: 20px;
22
+ padding: 5px 10px;
23
+ text-transform: capitalize;
24
+ -moz-box-shadow:inset 0 0 5px #ccc;
25
+ -webkit-box-shadow:inset 0 0 5px #ccc;
26
+ box-shadow:inset 0 0 5px #ccc;
27
+ }
28
+
29
+ .wpuf-admin .widefat td{
30
+ padding: 7px 12px;
31
+ vertical-align: top;
32
+ }
33
+
34
+ .wpuf-admin .meta td.label{
35
+ width: 140px;
36
+ font-size: 12px;
37
+ }
38
+
39
+ .wpuf-admin td.label{
40
+ font-size: 12px;
41
+ }
42
+
43
+ .wpuf-admin .options td:nth-child(odd){
44
+ background-color: F9F9F9;
45
+ }
46
+
47
+ .wpuf-admin .meta .description {
48
+ font-size: 11px;
49
+ }
50
+
51
+ .wpuf_admin ul {
52
+ margin: 10px;
53
+ }
54
+
55
+ .wpuf_admin li {
56
+ padding: 0 0 10px;
57
+ margin: 0 0 10px;
58
+ border-bottom: 1px solid #E7E7E7;
59
+ line-height: 20px;
60
+ }
61
+
62
+ .wpuf_admin li:last-child {
63
+ border-bottom: none;
64
+ }
65
+
66
+ .wpuf_admin span.label {
67
+ float: left;
68
+ height: 20px;
69
+ line-height: 20px;
70
+ width: 200px;
71
+ }
72
+
73
+ .wpuf-admin .nav-tab {
74
+ font-size: 15px;
75
+ margin: 0 0px -1px 0;
76
+ }
77
+
78
+ .tooltip {
79
+ position:absolute;
80
+ z-index:9999;
81
+ color: #fff;
82
+ font-size:11px;
83
+ width: 250px;
84
+ background: #333;
85
+ -moz-border-radius: 5px;
86
+ -webkit-border-radius: 5px;
87
+ margin: 20px;
88
+ opacity: .8;
89
+ }
90
+
91
+ .tooltip:after {
92
+ border-color: transparent transparent #333;
93
+ border-style: solid;
94
+ border-width: 8px;
95
+ content: "";
96
+ display: block;
97
+ height: 0;
98
+ left: 20px;
99
+ position: absolute;
100
+ top: -16px;
101
+ width: 0;
102
+ }
103
+
104
+
105
+ .tooltip .tipBody {
106
+ padding: 5px 10px;
107
+ text-indent: 0;
108
+ color: #fff;
109
+ text-shadow: 1px 1px 1px #333;
110
+ font-size: 12px;
111
+ }
112
+
113
+ .tooltip .buble {
114
+ border-right: 60px solid white;
115
+ border-top: 50px solid #CCCCCC;
116
+ height: 0;
117
+ line-height: 0;
118
+ position: absolute;
119
+ right: -60px;
120
+ top: 30px;
121
+ width: 0;
122
+ }
123
+
124
+ span.wpuf_help{
125
+ height: 16px;
126
+ width: 16px;
127
+ background: url('../images/help.png') no-repeat;
128
+ cursor: pointer;
129
+ float: right;
130
+ display: none;
131
+ }
132
+
133
+ #option-saved{
134
+ -moz-border-radius: 5px 5px 5px 5px;
135
+ background: none repeat scroll 0 0 orange;
136
+ border: 1px solid #CCCCCC;
137
+ color: #FFFFFF;
138
+ display: none;
139
+ font-size: 30px;
140
+ padding: 50px;
141
+ position: absolute;
142
+ left: 50%;
143
+ z-index: 99;
144
+ -moz-box-shadow:0 0 8px rgba(82,168,236,.5);
145
+ -webkit-box-shadow:0 0 8px rgba(82,168,236,.5);
146
+ }
147
+
148
+ .wpuf_loading {
149
+ height: 16px;
150
+ width: 16px;
151
+ background: url('../images/wpspin_light.gif') no-repeat;
152
+ padding: 0 0 0 20px;
153
+ margin-bottom: 10px;
154
+ }
assets/css/chosen/chosen-sprite.png ADDED
Binary file
assets/css/chosen/chosen-sprite@2x.png ADDED
Binary file
assets/css/chosen/chosen.css ADDED
@@ -0,0 +1,436 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*!
2
+ Chosen, a Select Box Enhancer for jQuery and Prototype
3
+ by Patrick Filler for Harvest, http://getharvest.com
4
+
5
+ Version 1.1.0
6
+ Full source at https://github.com/harvesthq/chosen
7
+ Copyright (c) 2011 Harvest http://getharvest.com
8
+
9
+ MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
10
+ This file is generated by `grunt build`, do not edit it by hand.
11
+ */
12
+
13
+ /* @group Base */
14
+ .chosen-container {
15
+ position: relative;
16
+ display: inline-block;
17
+ vertical-align: middle;
18
+ font-size: 13px;
19
+ zoom: 1;
20
+ *display: inline;
21
+ -webkit-user-select: none;
22
+ -moz-user-select: none;
23
+ user-select: none;
24
+ min-width: 200px;
25
+ }
26
+ .chosen-container .chosen-drop {
27
+ position: absolute;
28
+ top: 100%;
29
+ left: -9999px;
30
+ z-index: 1010;
31
+ -webkit-box-sizing: border-box;
32
+ -moz-box-sizing: border-box;
33
+ box-sizing: border-box;
34
+ width: 100%;
35
+ border: 1px solid #ddd;
36
+ border-top: 0;
37
+ background: #fff;
38
+ box-shadow: 0 4px 5px rgba(0, 0, 0, 0.15);
39
+ }
40
+ .chosen-container.chosen-with-drop .chosen-drop {
41
+ left: 0;
42
+ }
43
+ .chosen-container a {
44
+ cursor: pointer;
45
+ }
46
+
47
+ /* @end */
48
+ /* @group Single Chosen */
49
+ .chosen-container-single .chosen-single {
50
+ position: relative;
51
+ display: block;
52
+ overflow: hidden;
53
+ padding: 0 0 0 8px;
54
+ height: 23px;
55
+ border: 1px solid #aaa;
56
+ border-radius: 5px;
57
+ background-color: #fff;
58
+ background: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #ffffff), color-stop(50%, #f6f6f6), color-stop(52%, #eeeeee), color-stop(100%, #f4f4f4));
59
+ background: -webkit-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
60
+ background: -moz-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
61
+ background: -o-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
62
+ background: linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
63
+ background-clip: padding-box;
64
+ box-shadow: 0 0 3px white inset, 0 1px 1px rgba(0, 0, 0, 0.1);
65
+ color: #444;
66
+ text-decoration: none;
67
+ white-space: nowrap;
68
+ line-height: 24px;
69
+ }
70
+ .chosen-container-single .chosen-default {
71
+ color: #999;
72
+ }
73
+ .chosen-container-single .chosen-single span {
74
+ display: block;
75
+ overflow: hidden;
76
+ margin-right: 26px;
77
+ text-overflow: ellipsis;
78
+ white-space: nowrap;
79
+ }
80
+ .chosen-container-single .chosen-single-with-deselect span {
81
+ margin-right: 38px;
82
+ }
83
+ .chosen-container-single .chosen-single abbr {
84
+ position: absolute;
85
+ top: 6px;
86
+ right: 26px;
87
+ display: block;
88
+ width: 12px;
89
+ height: 12px;
90
+ background: url('chosen-sprite.png') -42px 1px no-repeat;
91
+ font-size: 1px;
92
+ }
93
+ .chosen-container-single .chosen-single abbr:hover {
94
+ background-position: -42px -10px;
95
+ }
96
+ .chosen-container-single.chosen-disabled .chosen-single abbr:hover {
97
+ background-position: -42px -10px;
98
+ }
99
+ .chosen-container-single .chosen-single div {
100
+ position: absolute;
101
+ top: 0;
102
+ right: 0;
103
+ display: block;
104
+ width: 18px;
105
+ height: 100%;
106
+ }
107
+ .chosen-container-single .chosen-single div b {
108
+ display: block;
109
+ width: 100%;
110
+ height: 100%;
111
+ background: url('chosen-sprite.png') no-repeat 0px 2px;
112
+ }
113
+ .chosen-container-single .chosen-search {
114
+ position: relative;
115
+ z-index: 1010;
116
+ margin: 0;
117
+ padding: 3px 4px;
118
+ white-space: nowrap;
119
+ }
120
+ .chosen-container-single .chosen-search input[type="text"] {
121
+ -webkit-box-sizing: border-box;
122
+ -moz-box-sizing: border-box;
123
+ box-sizing: border-box;
124
+ margin: 1px 0;
125
+ padding: 4px 20px 4px 5px;
126
+ width: 100%;
127
+ height: auto;
128
+ outline: 0;
129
+ border: 1px solid #aaa;
130
+ background: white url('chosen-sprite.png') no-repeat 100% -20px;
131
+ background: url('chosen-sprite.png') no-repeat 100% -20px;
132
+ font-size: 1em;
133
+ font-family: sans-serif;
134
+ line-height: normal;
135
+ border-radius: 0;
136
+ }
137
+ .chosen-container-single .chosen-drop {
138
+ margin-top: -1px;
139
+ border-radius: 0 0 4px 4px;
140
+ background-clip: padding-box;
141
+ }
142
+ .chosen-container-single.chosen-container-single-nosearch .chosen-search {
143
+ position: absolute;
144
+ left: -9999px;
145
+ }
146
+
147
+ /* @end */
148
+ /* @group Results */
149
+ .chosen-container .chosen-results {
150
+ position: relative;
151
+ overflow-x: hidden;
152
+ overflow-y: auto;
153
+ margin: 0 4px 4px 0;
154
+ padding: 0 0 0 4px;
155
+ max-height: 240px;
156
+ -webkit-overflow-scrolling: touch;
157
+ }
158
+ .chosen-container .chosen-results li {
159
+ display: none;
160
+ margin: 0;
161
+ padding: 5px 6px;
162
+ list-style: none;
163
+ line-height: 15px;
164
+ -webkit-touch-callout: none;
165
+ }
166
+ .chosen-container .chosen-results li.active-result {
167
+ display: list-item;
168
+ cursor: pointer;
169
+ }
170
+ .chosen-container .chosen-results li.disabled-result {
171
+ display: list-item;
172
+ color: #ccc;
173
+ cursor: default;
174
+ }
175
+ .chosen-container .chosen-results li.highlighted {
176
+ background-color: #3875d7;
177
+ background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #3875d7), color-stop(90%, #2a62bc));
178
+ background-image: -webkit-linear-gradient(#3875d7 20%, #2a62bc 90%);
179
+ background-image: -moz-linear-gradient(#3875d7 20%, #2a62bc 90%);
180
+ background-image: -o-linear-gradient(#3875d7 20%, #2a62bc 90%);
181
+ background-image: linear-gradient(#3875d7 20%, #2a62bc 90%);
182
+ color: #fff;
183
+ }
184
+ .chosen-container .chosen-results li.no-results {
185
+ display: list-item;
186
+ background: #f4f4f4;
187
+ }
188
+ .chosen-container .chosen-results li.group-result {
189
+ display: list-item;
190
+ font-weight: bold;
191
+ cursor: default;
192
+ }
193
+ .chosen-container .chosen-results li.group-option {
194
+ padding-left: 15px;
195
+ }
196
+ .chosen-container .chosen-results li em {
197
+ font-style: normal;
198
+ text-decoration: underline;
199
+ }
200
+
201
+ /* @end */
202
+ /* @group Multi Chosen */
203
+ .chosen-container-multi .chosen-choices {
204
+ position: relative;
205
+ overflow: hidden;
206
+ -webkit-box-sizing: border-box;
207
+ -moz-box-sizing: border-box;
208
+ box-sizing: border-box;
209
+ margin: 0;
210
+ padding: 0;
211
+ width: 100%;
212
+ height: auto !important;
213
+ height: 1%;
214
+ border: 1px solid #aaa;
215
+ background-color: #fff;
216
+ background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(1%, #eeeeee), color-stop(15%, #ffffff));
217
+ background-image: -webkit-linear-gradient(#eeeeee 1%, #ffffff 15%);
218
+ background-image: -moz-linear-gradient(#eeeeee 1%, #ffffff 15%);
219
+ background-image: -o-linear-gradient(#eeeeee 1%, #ffffff 15%);
220
+ background-image: linear-gradient(#eeeeee 1%, #ffffff 15%);
221
+ cursor: text;
222
+ }
223
+ .chosen-container-multi .chosen-choices li {
224
+ float: left;
225
+ list-style: none;
226
+ }
227
+ .chosen-container-multi .chosen-choices li.search-field {
228
+ margin: 0;
229
+ padding: 0;
230
+ white-space: nowrap;
231
+ }
232
+ .chosen-container-multi .chosen-choices li.search-field input[type="text"] {
233
+ margin: 1px 0;
234
+ padding: 5px;
235
+ height: 15px;
236
+ outline: 0;
237
+ border: 0 !important;
238
+ background: transparent !important;
239
+ box-shadow: none;
240
+ color: #666;
241
+ font-size: 100%;
242
+ font-family: sans-serif;
243
+ line-height: normal;
244
+ border-radius: 0;
245
+ }
246
+ .chosen-container-multi .chosen-choices li.search-field .default {
247
+ color: #999;
248
+ }
249
+ .chosen-container-multi .chosen-choices li.search-choice {
250
+ position: relative;
251
+ margin: 3px 0 3px 5px;
252
+ padding: 3px 20px 3px 5px;
253
+ border: 1px solid #aaa;
254
+ border-radius: 3px;
255
+ background-color: #e4e4e4;
256
+ background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), color-stop(100%, #eeeeee));
257
+ background-image: -webkit-linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
258
+ background-image: -moz-linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
259
+ background-image: -o-linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
260
+ background-image: linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
261
+ background-clip: padding-box;
262
+ box-shadow: 0 0 2px white inset, 0 1px 0 rgba(0, 0, 0, 0.05);
263
+ color: #333;
264
+ line-height: 13px;
265
+ cursor: default;
266
+ }
267
+ .chosen-container-multi .chosen-choices li.search-choice .search-choice-close {
268
+ position: absolute;
269
+ top: 4px;
270
+ right: 3px;
271
+ display: block;
272
+ width: 12px;
273
+ height: 12px;
274
+ background: url('chosen-sprite.png') -42px 1px no-repeat;
275
+ font-size: 1px;
276
+ }
277
+ .chosen-container-multi .chosen-choices li.search-choice .search-choice-close:hover {
278
+ background-position: -42px -10px;
279
+ }
280
+ .chosen-container-multi .chosen-choices li.search-choice-disabled {
281
+ padding-right: 5px;
282
+ border: 1px solid #ccc;
283
+ background-color: #e4e4e4;
284
+ background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), color-stop(100%, #eeeeee));
285
+ background-image: -webkit-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
286
+ background-image: -moz-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
287
+ background-image: -o-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
288
+ background-image: linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
289
+ color: #666;
290
+ }
291
+ .chosen-container-multi .chosen-choices li.search-choice-focus {
292
+ background: #d4d4d4;
293
+ }
294
+ .chosen-container-multi .chosen-choices li.search-choice-focus .search-choice-close {
295
+ background-position: -42px -10px;
296
+ }
297
+ .chosen-container-multi .chosen-results {
298
+ margin: 0;
299
+ padding: 0;
300
+ }
301
+ .chosen-container-multi .chosen-drop .result-selected {
302
+ display: list-item;
303
+ color: #ccc;
304
+ cursor: default;
305
+ }
306
+
307
+ /* @end */
308
+ /* @group Active */
309
+ .chosen-container-active .chosen-single {
310
+ border: 1px solid #5897fb;
311
+ box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
312
+ }
313
+ .chosen-container-active.chosen-with-drop .chosen-single {
314
+ border: 1px solid #aaa;
315
+ -moz-border-radius-bottomright: 0;
316
+ border-bottom-right-radius: 0;
317
+ -moz-border-radius-bottomleft: 0;
318
+ border-bottom-left-radius: 0;
319
+ background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #eeeeee), color-stop(80%, #ffffff));
320
+ background-image: -webkit-linear-gradient(#eeeeee 20%, #ffffff 80%);
321
+ background-image: -moz-linear-gradient(#eeeeee 20%, #ffffff 80%);
322
+ background-image: -o-linear-gradient(#eeeeee 20%, #ffffff 80%);
323
+ background-image: linear-gradient(#eeeeee 20%, #ffffff 80%);
324
+ box-shadow: 0 1px 0 #fff inset;
325
+ }
326
+ .chosen-container-active.chosen-with-drop .chosen-single div {
327
+ border-left: none;
328
+ background: transparent;
329
+ }
330
+ .chosen-container-active.chosen-with-drop .chosen-single div b {
331
+ background-position: -18px 2px;
332
+ }
333
+ .chosen-container-active .chosen-choices {
334
+ border: 1px solid #5897fb;
335
+ box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
336
+ }
337
+ .chosen-container-active .chosen-choices li.search-field input[type="text"] {
338
+ color: #111 !important;
339
+ }
340
+
341
+ /* @end */
342
+ /* @group Disabled Support */
343
+ .chosen-disabled {
344
+ opacity: 0.5 !important;
345
+ cursor: default;
346
+ }
347
+ .chosen-disabled .chosen-single {
348
+ cursor: default;
349
+ }
350
+ .chosen-disabled .chosen-choices .search-choice .search-choice-close {
351
+ cursor: default;
352
+ }
353
+
354
+ /* @end */
355
+ /* @group Right to Left */
356
+ .chosen-rtl {
357
+ text-align: right;
358
+ }
359
+ .chosen-rtl .chosen-single {
360
+ overflow: visible;
361
+ padding: 0 8px 0 0;
362
+ }
363
+ .chosen-rtl .chosen-single span {
364
+ margin-right: 0;
365
+ margin-left: 26px;
366
+ direction: rtl;
367
+ }
368
+ .chosen-rtl .chosen-single-with-deselect span {
369
+ margin-left: 38px;
370
+ }
371
+ .chosen-rtl .chosen-single div {
372
+ right: auto;
373
+ left: 3px;
374
+ }
375
+ .chosen-rtl .chosen-single abbr {
376
+ right: auto;
377
+ left: 26px;
378
+ }
379
+ .chosen-rtl .chosen-choices li {
380
+ float: right;
381
+ }
382
+ .chosen-rtl .chosen-choices li.search-field input[type="text"] {
383
+ direction: rtl;
384
+ }
385
+ .chosen-rtl .chosen-choices li.search-choice {
386
+ margin: 3px 5px 3px 0;
387
+ padding: 3px 5px 3px 19px;
388
+ }
389
+ .chosen-rtl .chosen-choices li.search-choice .search-choice-close {
390
+ right: auto;
391
+ left: 4px;
392
+ }
393
+ .chosen-rtl.chosen-container-single-nosearch .chosen-search,
394
+ .chosen-rtl .chosen-drop {
395
+ left: 9999px;
396
+ }
397
+ .chosen-rtl.chosen-container-single .chosen-results {
398
+ margin: 0 0 4px 4px;
399
+ padding: 0 4px 0 0;
400
+ }
401
+ .chosen-rtl .chosen-results li.group-option {
402
+ padding-right: 15px;
403
+ padding-left: 0;
404
+ }
405
+ .chosen-rtl.chosen-container-active.chosen-with-drop .chosen-single div {
406
+ border-right: none;
407
+ }
408
+ .chosen-rtl .chosen-search input[type="text"] {
409
+ padding: 4px 5px 4px 20px;
410
+ background: white url('chosen-sprite.png') no-repeat -30px -20px;
411
+ background: url('chosen-sprite.png') no-repeat -30px -20px;
412
+ direction: rtl;
413
+ }
414
+ .chosen-rtl.chosen-container-single .chosen-single div b {
415
+ background-position: 6px 2px;
416
+ }
417
+ .chosen-rtl.chosen-container-single.chosen-with-drop .chosen-single div b {
418
+ background-position: -12px 2px;
419
+ }
420
+
421
+ /* @end */
422
+ /* @group Retina compatibility */
423
+ @media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (min-resolution: 144dpi) {
424
+ .chosen-rtl .chosen-search input[type="text"],
425
+ .chosen-container-single .chosen-single abbr,
426
+ .chosen-container-single .chosen-single div b,
427
+ .chosen-container-single .chosen-search input[type="text"],
428
+ .chosen-container-multi .chosen-choices .search-choice .search-choice-close,
429
+ .chosen-container .chosen-results-scroll-down span,
430
+ .chosen-container .chosen-results-scroll-up span {
431
+ background-image: url('chosen-sprite@2x.png') !important;
432
+ background-size: 52px 37px !important;
433
+ background-repeat: no-repeat !important;
434
+ }
435
+ }
436
+ /* @end */
assets/css/formbuilder.css ADDED
@@ -0,0 +1,343 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .wpuf-hide {
2
+ display: none;
3
+ }
4
+ .wpuf-pro-text-alert {
5
+ font-style: italic;
6
+ color: #ccc;
7
+ }
8
+ .wpuf-pro-text-alert a {
9
+ text-decoration: none;
10
+ color: #aaa;
11
+ }
12
+ #wpuf-pro-content {
13
+ opacity: 0.7;
14
+ }
15
+ .wpuf-pro-content {
16
+ opacity: 0.7;
17
+ }
18
+ #wpuf-metabox-editor {
19
+ background: transparent;
20
+ border: none;
21
+ box-shadow: none;
22
+ }
23
+ #wpuf-metabox-editor .handlediv {
24
+ display: none;
25
+ }
26
+ #wpuf-metabox-editor .hndle {
27
+ display: none;
28
+ }
29
+ #wpuf-metabox-editor .wpuf-updated {
30
+ background-color: #ffffe0;
31
+ border: 1px solid #e6db55;
32
+ border-radius: 5px;
33
+ padding: 0 10px;
34
+ margin: 5px 0 15px;
35
+ font-weight: bold;
36
+ }
37
+ #wpuf-metabox-editor h2.nav-tab-wrapper {
38
+ padding: 0;
39
+ }
40
+ #wpuf-metabox-editor h2.nav-tab-wrapper a:first-child {
41
+ margin-left: 10px;
42
+ }
43
+ #wpuf-metabox-editor .inside {
44
+ margin: 0;
45
+ padding: 0;
46
+ }
47
+ #wpuf-metabox-editor .inside h3 {
48
+ border-bottom: 1px solid #E6E6E6;
49
+ cursor: pointer;
50
+ padding-left: 0;
51
+ padding-bottom: 10px;
52
+ }
53
+ #wpuf-metabox-fields h2 {
54
+ margin: 0;
55
+ }
56
+ #wpuf-metabox-fields .wpuf-form-buttons {
57
+ margin-bottom: 10px;
58
+ }
59
+ #wpuf-metabox-fields button {
60
+ margin-bottom: 5px;
61
+ }
62
+ #wpuf-metabox-fields .wpuf-loading {
63
+ width: 16px;
64
+ height: 16px;
65
+ background: url('../images/wpspin_light.gif') no-repeat;
66
+ }
67
+ #wpuf-metabox-fields .wpuf-loading.hide {
68
+ display: none;
69
+ }
70
+ .wpuf-form-editor {
71
+ font-size: 12px;
72
+ margin: 0;
73
+ }
74
+ .wpuf-form-editor li {
75
+ background: #FFF;
76
+ margin-bottom: 10px;
77
+ border: 1px solid #dfdfdf;
78
+ box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
79
+ }
80
+ .wpuf-form-editor li.ui-state-highlight {
81
+ border: 1px dashed #DDD;
82
+ min-height: 50px;
83
+ background: #eee;
84
+ }
85
+ .wpuf-form-editor li.password .required-field,
86
+ .wpuf-form-editor li.user_email .required-field {
87
+ display: none;
88
+ }
89
+ .wpuf-form-editor li .wpuf-legend {
90
+ background: #fff;
91
+ color: #464646;
92
+ border-bottom: 1px solid #eee;
93
+ padding-bottom: 5px;
94
+ padding: 7px 10px;
95
+ }
96
+ .wpuf-form-editor li .wpuf-legend:after {
97
+ clear: both;
98
+ content: "";
99
+ display: table;
100
+ }
101
+ .wpuf-form-editor li .wpuf-legend:hover {
102
+ cursor: move;
103
+ }
104
+ .wpuf-form-editor li .wpuf-legend .wpuf-label {
105
+ float: left;
106
+ width: 70%;
107
+ }
108
+ .wpuf-form-editor li .wpuf-legend .wpuf-actions {
109
+ float: right;
110
+ }
111
+ .wpuf-form-editor li .wpuf-legend .wpuf-actions a {
112
+ font-size: 11px;
113
+ padding: 2px 5px;
114
+ }
115
+ .wpuf-form-editor li .wpuf-legend .wpuf-actions a.wpuf-remove {
116
+ background: transparent url(../images/delete.png) no-repeat 70% 50%;
117
+ color: #f00;
118
+ width: 16px;
119
+ text-indent: -9999px;
120
+ display: inline-block;
121
+ }
122
+ .wpuf-form-editor li .wpuf-legend .wpuf-actions a.wpuf-toggle {
123
+ background: transparent url(../images/arrows.png) no-repeat 0 2px;
124
+ width: 10px;
125
+ text-indent: -9999px;
126
+ display: inline-block;
127
+ }
128
+ .wpuf-form-editor li .wpuf-form-holder {
129
+ padding: 10px;
130
+ }
131
+ .wpuf-form-editor li .wpuf-form-rows {
132
+ padding-bottom: 3px;
133
+ }
134
+ .wpuf-form-editor li .wpuf-form-rows:after {
135
+ clear: both;
136
+ content: "";
137
+ display: table;
138
+ }
139
+ .wpuf-form-editor li .wpuf-form-rows label {
140
+ float: left;
141
+ width: 20%;
142
+ font-size: 12px;
143
+ }
144
+ .wpuf-form-editor li .wpuf-form-rows textarea {
145
+ width: 60%;
146
+ }
147
+ .wpuf-form-editor li .wpuf-form-rows .wpuf-form-sub-fields {
148
+ width: 77%;
149
+ float: left;
150
+ }
151
+ .wpuf-form-editor li .wpuf-form-rows .wpuf-form-sub-fields label {
152
+ float: none;
153
+ display: inline-block;
154
+ width: auto;
155
+ }
156
+ .wpuf-form-editor li .wpuf-form-rows .wpuf-form-sub-fields .wpuf-show-field-value {
157
+ margin: 7px 0 7px 0;
158
+ }
159
+ .wpuf-form-editor li .wpuf-form-rows .wpuf-form-sub-fields .wpuf-option-label-value {
160
+ margin: 0;
161
+ }
162
+ .wpuf-form-editor li .wpuf-form-rows .wpuf-form-sub-fields .wpuf-option-label-value span {
163
+ font-weight: bold;
164
+ margin-left: 5%;
165
+ margin-right: 27%;
166
+ }
167
+ .wpuf-form-editor li .wpuf-form-rows .wpuf-form-sub-fields.wpuf-options {
168
+ margin-bottom: 10px;
169
+ }
170
+ .wpuf-form-editor li .wpuf-form-rows table.address-table {
171
+ width: 100%;
172
+ margin-bottom: 15px;
173
+ }
174
+ .wpuf-form-editor li .wpuf-form-rows table.address-table label {
175
+ float: none;
176
+ width: 100%;
177
+ }
178
+ .ui-state-highlight {
179
+ height: 1.5em;
180
+ line-height: 1.2em;
181
+ }
182
+ .wpuf-form-template-modal {
183
+ background: #fff;
184
+ position: fixed;
185
+ top: 5%;
186
+ bottom: 5%;
187
+ right: 10%;
188
+ left: 10%;
189
+ display: none;
190
+ box-shadow: 0 1px 20px 5px rgba(0, 0, 0, 0.1);
191
+ z-index: 160000;
192
+ }
193
+ .wpuf-form-template-modal * {
194
+ box-sizing: border-box;
195
+ }
196
+ .wpuf-form-template-modal a.close {
197
+ position: absolute;
198
+ top: 0;
199
+ right: 0;
200
+ font: 300 1.71429em "dashicons" !important;
201
+ color: #777;
202
+ content: '\f335';
203
+ display: inline-block;
204
+ padding: 10px 20px;
205
+ z-index: 5;
206
+ text-decoration: none;
207
+ height: 50px;
208
+ cursor: pointer;
209
+ border-left: 1px solid #ddd;
210
+ }
211
+ .wpuf-form-template-modal a.close:hover {
212
+ background: #eee;
213
+ opacity: 0.8;
214
+ text-decoration: none;
215
+ }
216
+ .wpuf-form-template-modal a.close:active {
217
+ background: #eee;
218
+ opacity: 0.4;
219
+ }
220
+ .wpuf-form-template-modal .modal-header {
221
+ position: absolute;
222
+ top: 0;
223
+ left: 0;
224
+ right: 0;
225
+ height: 50px;
226
+ z-index: 4;
227
+ border-bottom: 1px solid #ddd;
228
+ padding-left: 15px;
229
+ box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
230
+ }
231
+ .wpuf-form-template-modal .modal-header h2 {
232
+ line-height: 50px;
233
+ text-align: left;
234
+ margin-top: 0;
235
+ color: #5d6d74;
236
+ font-size: 20px;
237
+ text-shadow: 0 1px 1px #fff;
238
+ }
239
+ .wpuf-form-template-modal .modal-header h2 small {
240
+ font-weight: normal;
241
+ font-size: 13px;
242
+ margin-left: 15px;
243
+ }
244
+ .wpuf-form-template-modal .content-container {
245
+ position: absolute;
246
+ top: 75px;
247
+ right: 0;
248
+ bottom: 50px;
249
+ left: 0;
250
+ overflow: auto;
251
+ padding: 2em 2em;
252
+ }
253
+ .wpuf-form-template-modal .content {
254
+ margin: 0 auto;
255
+ max-width: 900px;
256
+ text-align: left;
257
+ }
258
+ .wpuf-form-template-modal .content ul {
259
+ width: 100%;
260
+ margin: 0;
261
+ padding: 0;
262
+ }
263
+ .wpuf-form-template-modal .content ul li {
264
+ float: left;
265
+ width: 31.292517006803%;
266
+ border: 1px solid #e4e4e4;
267
+ padding: 0;
268
+ margin-left: 3.0612244897959%;
269
+ margin-bottom: 30px;
270
+ position: relative;
271
+ min-height: 120px;
272
+ }
273
+ .wpuf-form-template-modal .content ul li:hover {
274
+ background: #F5F5F5;
275
+ }
276
+ .wpuf-form-template-modal .content ul li a {
277
+ text-decoration: none;
278
+ color: #555;
279
+ padding: 20px;
280
+ display: block;
281
+ }
282
+ .wpuf-form-template-modal .content ul li .title {
283
+ font-size: 17px;
284
+ margin: 0 0 10px 0;
285
+ line-height: 23px;
286
+ }
287
+ .wpuf-form-template-modal .content ul li .description {
288
+ color: #888;
289
+ }
290
+ .wpuf-form-template-modal .content ul li:nth-child(3n+1) {
291
+ margin-left: 0;
292
+ clear: both;
293
+ }
294
+ .wpuf-form-template-modal .content ul li.template-inactive .title,
295
+ .wpuf-form-template-modal .content ul li.template-inactive .description {
296
+ color: #ddd;
297
+ }
298
+ .wpuf-form-template-modal .content ul li.blank-form {
299
+ text-align: center;
300
+ }
301
+ .wpuf-form-template-modal .content ul li.blank-form span {
302
+ display: block;
303
+ }
304
+ .wpuf-form-template-modal .content ul li.blank-form span.dashicons {
305
+ font-size: 45px;
306
+ color: #ddd;
307
+ margin: 0 auto;
308
+ width: auto;
309
+ height: auto;
310
+ }
311
+ .wpuf-form-template-modal footer {
312
+ position: absolute;
313
+ left: 0;
314
+ bottom: 0;
315
+ width: 100%;
316
+ padding: 12px 20px;
317
+ border-top: 1px solid #ddd;
318
+ background: #fff;
319
+ text-align: left;
320
+ }
321
+ .wpuf-form-template-modal-backdrop {
322
+ position: fixed;
323
+ z-index: 159999;
324
+ top: 0;
325
+ left: 0;
326
+ right: 0;
327
+ bottom: 0;
328
+ min-height: 360px;
329
+ background: #000;
330
+ opacity: .7;
331
+ display: none;
332
+ }
333
+ /* Smartphones (portrait and landscape) ----------- */
334
+ @media only screen and (min-device-width: 320px) and (max-device-width: 480px) {
335
+ .wpuf-form-template-modal .modal-header h2 small {
336
+ display: none;
337
+ }
338
+ .wpuf-form-template-modal .content ul li {
339
+ float: none;
340
+ width: 100%;
341
+ margin-left: 0;
342
+ }
343
+ }
assets/css/formbuilder.less ADDED
@@ -0,0 +1,423 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .clearfix() {
2
+ &:after {
3
+ clear: both;
4
+ content: "";
5
+ display: table;
6
+ }
7
+ }
8
+
9
+ //variables
10
+ @fontSize: 12px;
11
+
12
+ .wpuf-hide {
13
+ display: none;
14
+ }
15
+
16
+ .wpuf-pro-text-alert {
17
+ font-style: italic;
18
+ color: #ccc;
19
+
20
+ a {
21
+ text-decoration: none;
22
+ color: #aaa;
23
+ }
24
+ }
25
+ #wpuf-pro-content{
26
+ opacity: 0.7;
27
+ }
28
+ .wpuf-pro-content{
29
+ opacity: 0.7;
30
+ }
31
+ #wpuf-metabox-editor {
32
+ background: transparent;
33
+ border: none;
34
+ box-shadow: none;
35
+
36
+ .handlediv { display: none; }
37
+ .hndle { display: none; }
38
+
39
+ .wpuf-updated {
40
+ background-color: #ffffe0;
41
+ border: 1px solid #e6db55;
42
+ border-radius: 5px;
43
+ padding: 0 10px;
44
+ margin: 5px 0 15px;
45
+ font-weight: bold;
46
+ }
47
+
48
+ h2.nav-tab-wrapper {
49
+ padding: 0;
50
+
51
+ a:first-child {
52
+ margin-left: 10px;
53
+ }
54
+ }
55
+
56
+ .inside {
57
+ margin: 0;
58
+ padding: 0;
59
+
60
+ h3 {
61
+ border-bottom: 1px solid #E6E6E6;
62
+ cursor: pointer;
63
+ padding-left: 0;
64
+ padding-bottom: 10px;
65
+ }
66
+ }
67
+ }
68
+
69
+ #wpuf-metabox-fields {
70
+ h2 {
71
+ margin:0;
72
+ }
73
+
74
+ .wpuf-form-buttons {
75
+ margin-bottom: 10px;
76
+ }
77
+
78
+ button {
79
+ margin-bottom: 5px;
80
+ }
81
+
82
+ .wpuf-loading {
83
+ width: 16px;
84
+ height: 16px;
85
+ background: url('../images/wpspin_light.gif') no-repeat;
86
+
87
+ &.hide {
88
+ display: none;
89
+ }
90
+ }
91
+ }
92
+
93
+ .wpuf-form-editor {
94
+ font-size: @fontSize;
95
+ margin: 0;
96
+
97
+ li {
98
+ background: #FFF;
99
+ margin-bottom: 10px;
100
+ border: 1px solid #dfdfdf;
101
+ box-shadow: 0 1px 1px rgba(0,0,0,0.04);
102
+
103
+ &.ui-state-highlight {
104
+ border: 1px dashed #DDD;
105
+ min-height: 50px;
106
+ background: #eee;
107
+ }
108
+
109
+ &.password, &.user_email {
110
+ .required-field {
111
+ display: none;
112
+ }
113
+ }
114
+
115
+ .wpuf-legend {
116
+ .clearfix();
117
+
118
+ background: #fff;
119
+ color: #464646;
120
+ border-bottom: 1px solid #eee;
121
+ padding-bottom: 5px;
122
+ // margin-bottom: 5px;
123
+ padding: 7px 10px;
124
+
125
+ &:hover {
126
+ cursor: move;
127
+ }
128
+
129
+ .wpuf-label {
130
+ float: left;
131
+ width: 70%;
132
+ // font-weight: bold;
133
+ }
134
+
135
+ .wpuf-actions {
136
+ float: right;
137
+
138
+ a {
139
+ // background: #ccc;
140
+ font-size: 11px;
141
+ padding: 2px 5px;
142
+ }
143
+
144
+ a.wpuf-remove {
145
+ background: transparent url(../images/delete.png) no-repeat 70% 50%;
146
+ color: #f00;
147
+ width: 16px;
148
+ text-indent: -9999px;
149
+ display: inline-block;
150
+ }
151
+
152
+ a.wpuf-toggle {
153
+ background: transparent url(../images/arrows.png) no-repeat 0 2px;
154
+ width: 10px;
155
+ text-indent: -9999px;
156
+ display: inline-block;
157
+ }
158
+ }
159
+ }
160
+
161
+ .wpuf-form-holder {
162
+ padding: 10px;
163
+ }
164
+
165
+ .wpuf-form-rows {
166
+ .clearfix();
167
+ padding-bottom: 3px;
168
+
169
+ label {
170
+ float: left;
171
+ width: 20%;
172
+ font-size: @fontSize;
173
+ }
174
+
175
+ textarea {
176
+ width: 60%;
177
+ }
178
+
179
+ .wpuf-form-sub-fields {
180
+ width: 77%;
181
+ float: left;
182
+
183
+ label {
184
+ float: none;
185
+ display: inline-block;
186
+ width: auto;
187
+ }
188
+
189
+ .wpuf-show-field-value {
190
+ margin: 7px 0 7px 0;
191
+ }
192
+
193
+ .wpuf-option-label-value {
194
+ margin: 0;
195
+
196
+ span {
197
+ font-weight: bold;
198
+ margin-left: 5%;
199
+ margin-right: 27%;
200
+ }
201
+ }
202
+
203
+ &.wpuf-options {
204
+ margin-bottom: 10px;
205
+ }
206
+ }
207
+
208
+ table.address-table {
209
+ width: 100%;
210
+ margin-bottom: 15px;
211
+
212
+ label {
213
+ float: none;
214
+ width: 100%;
215
+ }
216
+ }
217
+ }
218
+ }
219
+ }
220
+
221
+ .ui-state-highlight { height: 1.5em; line-height: 1.2em; }
222
+
223
+ .wpuf-form-template-modal {
224
+ background: #fff;
225
+ position: fixed;
226
+ top: 5%;
227
+ bottom: 5%;
228
+ right: 10%;
229
+ left: 10%;
230
+ // display: block;
231
+ display: none;
232
+ box-shadow: 0 1px 20px 5px rgba(0, 0, 0, 0.1);
233
+ z-index: 160000;
234
+
235
+ * { box-sizing: border-box; }
236
+
237
+
238
+ a.close {
239
+ position: absolute;
240
+ top: 0;
241
+ right: 0;
242
+ font: 300 1.71429em "dashicons" !important;
243
+ color: #777;
244
+ content: '\f335';
245
+ display: inline-block;
246
+ padding: 10px 20px;
247
+ z-index: 5;
248
+ text-decoration: none;
249
+ height: 50px;
250
+ cursor: pointer;
251
+ border-left: 1px solid #ddd;
252
+
253
+ &:hover {
254
+ background: #eee;
255
+ opacity: 0.8;
256
+ text-decoration: none;
257
+ }
258
+
259
+ &:active {
260
+ background: #eee;
261
+ opacity: 0.4;
262
+ }
263
+ }
264
+
265
+ .modal-header {
266
+ position: absolute;
267
+ top: 0;
268
+ left: 0;
269
+ right: 0;
270
+ height: 50px;
271
+ z-index: 4;
272
+ border-bottom: 1px solid #ddd;
273
+ padding-left: 15px;
274
+ box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
275
+
276
+ h2 {
277
+ line-height: 50px;
278
+ text-align: left;
279
+ margin-top: 0;
280
+ color: #5d6d74;
281
+ font-size: 20px;
282
+ text-shadow: 0 1px 1px #fff;
283
+
284
+ small {
285
+ font-weight: normal;
286
+ font-size: 13px;
287
+ margin-left: 15px;
288
+ }
289
+ }
290
+ }
291
+
292
+ .content-container {
293
+ position: absolute;
294
+ top: 75px;
295
+ right: 0;
296
+ bottom: 50px;
297
+ left: 0;
298
+ overflow: auto;
299
+ padding: 2em 2em;
300
+ }
301
+
302
+ .content {
303
+ margin: 0 auto;
304
+ max-width: 900px;
305
+ text-align: left;
306
+
307
+ ul {
308
+ width: 100%;
309
+ margin: 0;
310
+ padding: 0;
311
+
312
+ li {
313
+ float: left;
314
+ width: 31.292517006803%;
315
+ border: 1px solid #e4e4e4;
316
+ padding: 0;
317
+ margin-left: 3.0612244897959%;
318
+ margin-bottom: 30px;
319
+ position: relative;
320
+ min-height: 120px;
321
+
322
+ &:hover {
323
+ background: #F5F5F5;
324
+ }
325
+
326
+ a {
327
+ text-decoration: none;
328
+ color: #555;
329
+ padding: 20px;
330
+ display: block;
331
+ }
332
+
333
+ .title {
334
+ font-size: 17px;
335
+ margin: 0 0 10px 0;
336
+ line-height: 23px;
337
+ }
338
+
339
+ .description {
340
+ color: #888;
341
+ }
342
+
343
+ &:nth-child(3n+1) {
344
+ margin-left: 0;
345
+ clear: both;
346
+ }
347
+
348
+ &.template-inactive {
349
+ .title,
350
+ .description {
351
+ color: #ddd;
352
+ }
353
+ }
354
+
355
+ &.blank-form {
356
+ text-align: center;
357
+
358
+ span {
359
+ display: block;
360
+ }
361
+
362
+ span.dashicons {
363
+ font-size: 45px;
364
+ color: #ddd;
365
+ margin: 0 auto;
366
+ width: auto;
367
+ height: auto;
368
+ }
369
+
370
+ span.label {
371
+
372
+ }
373
+ }
374
+ }
375
+ }
376
+ }
377
+
378
+ footer {
379
+ position: absolute;
380
+ left: 0;
381
+ bottom: 0;
382
+ width: 100%;
383
+ padding: 12px 20px;
384
+ border-top: 1px solid #ddd;
385
+ background: #fff;
386
+ text-align: left;
387
+ }
388
+ }
389
+
390
+ .wpuf-form-template-modal-backdrop {
391
+ position: fixed;
392
+ z-index: 159999;
393
+ top: 0;
394
+ left: 0;
395
+ right: 0;
396
+ bottom: 0;
397
+ min-height: 360px;
398
+ background: #000;
399
+ opacity: .7;
400
+ display: none;
401
+ }
402
+
403
+ /* Smartphones (portrait and landscape) ----------- */
404
+ @media only screen
405
+ and (min-device-width : 320px)
406
+ and (max-device-width : 480px) {
407
+ .wpuf-form-template-modal {
408
+ .modal-header h2 small {
409
+ display: none;
410
+ }
411
+
412
+ .content {
413
+
414
+ ul {
415
+ li {
416
+ float: none;
417
+ width: 100%;
418
+ margin-left: 0;
419
+ }
420
+ }
421
+ }
422
+ }
423
+ }
assets/css/frontend-forms.css ADDED
@@ -0,0 +1,957 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .wpuf-loading {
2
+ width: 16px;
3
+ height: 16px;
4
+ background: url('../images/wpspin_light.gif') no-repeat;
5
+ display: inline-block;
6
+ }
7
+ .wpuf-loading.hide {
8
+ display: none;
9
+ }
10
+ .wpuf-button {
11
+ background: #f3f3f3;
12
+ background-image: -webkit-gradient(linear, left top, left bottom, from(#fefefe), to(#f4f4f4));
13
+ background-image: -webkit-linear-gradient(top, #fefefe, #f4f4f4);
14
+ background-image: -moz-linear-gradient(top, #fefefe, #f4f4f4);
15
+ background-image: -o-linear-gradient(top, #fefefe, #f4f4f4);
16
+ background-image: linear-gradient(to bottom, #fefefe, #f4f4f4);
17
+ border-color: #bbb;
18
+ color: #333;
19
+ text-shadow: 0 1px 0 #fff;
20
+ }
21
+ .wpuf-button:hover,
22
+ .wpuf-button:focus {
23
+ background: #f3f3f3;
24
+ background-image: -webkit-gradient(linear, left top, left bottom, from(#ffffff), to(#f3f3f3));
25
+ background-image: -webkit-linear-gradient(top, #ffffff, #f3f3f3);
26
+ background-image: -moz-linear-gradient(top, #ffffff, #f3f3f3);
27
+ background-image: -ms-linear-gradient(top, #ffffff, #f3f3f3);
28
+ background-image: -o-linear-gradient(top, #ffffff, #f3f3f3);
29
+ background-image: linear-gradient(to bottom, #ffffff, #f3f3f3);
30
+ border-color: #999;
31
+ color: #222;
32
+ }
33
+ .wpuf-success {
34
+ background-color: #dff0d8;
35
+ border: 1px solid #d6e9c6;
36
+ color: #3c763d;
37
+ padding: 10px;
38
+ margin: 10px 0 20px 0;
39
+ }
40
+ .wpuf-error {
41
+ background-color: #f2dede;
42
+ color: #a94442;
43
+ border: 1px solid #ebccd1;
44
+ margin: 10px 0 20px 0;
45
+ padding: 10px;
46
+ -webkit-border-radius: 3px;
47
+ -moz-border-radius: 3px;
48
+ border-radius: 3px;
49
+ font-size: 13px;
50
+ }
51
+ .wpuf-message {
52
+ background: #fcf8e3;
53
+ border: 1px solid #faebcc;
54
+ color: #8a6d3b;
55
+ margin: 10px 0 20px 0;
56
+ padding: 10px;
57
+ -webkit-border-radius: 3px;
58
+ -moz-border-radius: 3px;
59
+ border-radius: 3px;
60
+ font-size: 13px;
61
+ }
62
+ .wpuf-info {
63
+ background-color: #fef5be;
64
+ border: 2px solid #fdd425;
65
+ border-radius: 5px;
66
+ -moz-border-radius: 5px;
67
+ -webkit-border-radius: 5px;
68
+ padding: 5px 10px;
69
+ margin: 0 0 10px 0;
70
+ font-size: 13px;
71
+ }
72
+ ul.wpuf-form {
73
+ list-style: none !important;
74
+ margin: 0 !important;
75
+ padding: 0 !important;
76
+ width: 100%;
77
+ }
78
+ ul.wpuf-form li {
79
+ margin-left: 0;
80
+ margin-bottom: 10px;
81
+ padding: 10px;
82
+ }
83
+ ul.wpuf-form li:after {
84
+ clear: both;
85
+ content: "";
86
+ display: table;
87
+ }
88
+ ul.wpuf-form li.has-error {
89
+ background: #FFE4E4;
90
+ }
91
+ ul.wpuf-form li .wp-editor-wrap {
92
+ border: 1px solid #eeeeee;
93
+ }
94
+ ul.wpuf-form li .wpuf-label {
95
+ float: left;
96
+ width: 25%;
97
+ }
98
+ ul.wpuf-form li .wpuf-label .required {
99
+ color: red;
100
+ }
101
+ ul.wpuf-form li .wpuf-fields {
102
+ float: left;
103
+ width: 75%;
104
+ }
105
+ ul.wpuf-form li .wpuf-fields input[type=text],
106
+ ul.wpuf-form li .wpuf-fields input[type=password],
107
+ ul.wpuf-form li .wpuf-fields input[type=email],
108
+ ul.wpuf-form li .wpuf-fields input[type=url],
109
+ ul.wpuf-form li .wpuf-fields input[type=number],
110
+ ul.wpuf-form li .wpuf-fields textarea {
111
+ background: #fafafa;
112
+ -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.1);
113
+ -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.1);
114
+ box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.1);
115
+ border: 1px solid #ddd;
116
+ color: #888;
117
+ }
118
+ ul.wpuf-form li .wpuf-fields input[type=text]:focus,
119
+ ul.wpuf-form li .wpuf-fields input[type=password]:focus,
120
+ ul.wpuf-form li .wpuf-fields input[type=email]:focus,
121
+ ul.wpuf-form li .wpuf-fields input[type=url]:focus,
122
+ ul.wpuf-form li .wpuf-fields input[type=number]:focus,
123
+ ul.wpuf-form li .wpuf-fields textarea:focus {
124
+ color: #373737;
125
+ }
126
+ ul.wpuf-form li .wpuf-fields textarea {
127
+ padding-left: 3px;
128
+ width: 98%;
129
+ }
130
+ ul.wpuf-form li .wpuf-fields input[type=text],
131
+ ul.wpuf-form li .wpuf-fields input[type=password],
132
+ ul.wpuf-form li .wpuf-fields input[type=email],
133
+ ul.wpuf-form li .wpuf-fields input[type=url],
134
+ ul.wpuf-form li .wpuf-fields input[type=number] {
135
+ padding: 5px;
136
+ }
137
+ ul.wpuf-form li .wpuf-fields select {
138
+ border: 1px solid #eeeeee;
139
+ padding: 2px;
140
+ height: 2em;
141
+ -webkit-border-radius: 3px;
142
+ -moz-border-radius: 3px;
143
+ border-radius: 3px;
144
+ min-width: 150px;
145
+ }
146
+ ul.wpuf-form li .wpuf-fields select[multiple] {
147
+ height: auto;
148
+ }
149
+ ul.wpuf-form li .wpuf-fields a.file-selector {
150
+ padding: 5px 12px;
151
+ height: 30px;
152
+ line-height: 28px;
153
+ border: 1px solid #ccc;
154
+ -webkit-border-radius: 3px;
155
+ -moz-border-radius: 3px;
156
+ border-radius: 3px;
157
+ background-color: #21759b;
158
+ background-image: -webkit-gradient(linear, left top, left bottom, from(#2a95c5), to(#21759b));
159
+ background-image: -webkit-linear-gradient(top, #2a95c5, #21759b);
160
+ background-image: -moz-linear-gradient(top, #2a95c5, #21759b);
161
+ background-image: -ms-linear-gradient(top, #2a95c5, #21759b);
162
+ background-image: -o-linear-gradient(top, #2a95c5, #21759b);
163
+ background-image: linear-gradient(to bottom, #2a95c5, #21759b);
164
+ border-color: #21759b;
165
+ border-bottom-color: #1e6a8d;
166
+ -webkit-box-shadow: inset 0 1px 0 rgba(120, 200, 230, 0.5);
167
+ box-shadow: inset 0 1px 0 rgba(120, 200, 230, 0.5);
168
+ color: #fff;
169
+ text-decoration: none;
170
+ text-shadow: 0 1px 0 rgba(0, 0, 0, 0.1);
171
+ }
172
+ ul.wpuf-form li .wpuf-fields a.file-selector:hover,
173
+ ul.wpuf-form li .wpuf-fields a.file-selector:focus {
174
+ background-color: #278ab7;
175
+ background-image: -webkit-gradient(linear, left top, left bottom, from(#2e9fd2), to(#21759b));
176
+ background-image: -webkit-linear-gradient(top, #2e9fd2, #21759b);
177
+ background-image: -moz-linear-gradient(top, #2e9fd2, #21759b);
178
+ background-image: -ms-linear-gradient(top, #2e9fd2, #21759b);
179
+ background-image: -o-linear-gradient(top, #2e9fd2, #21759b);
180
+ background-image: linear-gradient(to bottom, #2e9fd2, #21759b);
181
+ border-color: #1b607f;
182
+ -webkit-box-shadow: inset 0 1px 0 rgba(120, 200, 230, 0.6);
183
+ box-shadow: inset 0 1px 0 rgba(120, 200, 230, 0.6);
184
+ color: #fff;
185
+ text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.3);
186
+ }
187
+ ul.wpuf-form li .wpuf-fields .google-map img {
188
+ max-width: none !important;
189
+ }
190
+ ul.wpuf-form li .wpuf-fields .wpuf-help {
191
+ color: #666;
192
+ margin: 2px 0 5px 0;
193
+ font-size: 12px;
194
+ font-style: italic;
195
+ font-family: sans-serif;
196
+ display: block;
197
+ }
198
+ ul.wpuf-form li .wpuf-fields table,
199
+ ul.wpuf-form li .wpuf-fields td {
200
+ border: none;
201
+ margin: 0;
202
+ }
203
+ ul.wpuf-form li .wpuf-fields table {
204
+ width: 100%;
205
+ }
206
+ ul.wpuf-form li .wpuf-fields img.wpuf-clone-field,
207
+ ul.wpuf-form li .wpuf-fields img.wpuf-remove-field {
208
+ cursor: pointer;
209
+ margin: 0 3px;
210
+ box-shadow: none;
211
+ border: none;
212
+ }
213
+ ul.wpuf-form li .wpuf-fields ul.wpuf-attachment-list {
214
+ list-style: none;
215
+ margin: 5px 0 0 0;
216
+ padding: 0;
217
+ }
218
+ ul.wpuf-form li .wpuf-fields ul.wpuf-attachment-list li {
219
+ display: inline-block;
220
+ border: 1px solid #eeeeee;
221
+ padding: 5px;
222
+ width: 150px;
223
+ margin-right: 5px;
224
+ -webkit-border-radius: 5px;
225
+ -moz-border-radius: 5px;
226
+ border-radius: 5px;
227
+ }
228
+ ul.wpuf-form li .wpuf-fields ul.wpuf-attachment-list li .wpuf-file-input-wrap {
229
+ margin: 10px 0;
230
+ }
231
+ ul.wpuf-form li .wpuf-fields ul.wpuf-attachment-list li .wpuf-file-input-wrap input,
232
+ ul.wpuf-form li .wpuf-fields ul.wpuf-attachment-list li .wpuf-file-input-wrap textarea {
233
+ border: 1px solid #eeeeee;
234
+ width: 93%;
235
+ }
236
+ ul.wpuf-form li .wpuf-fields ul.wpuf-attachment-list li .attachment-name {
237
+ text-align: center;
238
+ }
239
+ ul.wpuf-form li .wpuf-fields ul.wpuf-attachment-list li a.attachment-delete,
240
+ ul.wpuf-form li .wpuf-fields ul.wpuf-attachment-list li a.wpuf-delete-avatar {
241
+ text-decoration: none;
242
+ padding: 3px 12px;
243
+ border: 1px solid #C47272;
244
+ color: #ffffff;
245
+ text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
246
+ -webkit-border-radius: 3px;
247
+ -moz-border-radius: 3px;
248
+ border-radius: 3px;
249
+ background-color: #da4f49;
250
+ background-image: -moz-linear-gradient(top, #ee5f5b, #bd362f);
251
+ background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ee5f5b), to(#bd362f));
252
+ background-image: -webkit-linear-gradient(top, #ee5f5b, #bd362f);
253
+ background-image: -o-linear-gradient(top, #ee5f5b, #bd362f);
254
+ background-image: linear-gradient(to bottom, #ee5f5b, #bd362f);
255
+ background-repeat: repeat-x;
256
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffee5f5b', endColorstr='#ffbd362f', GradientType=0);
257
+ border-color: #bd362f #bd362f #802420;
258
+ border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
259
+ *background-color: #bd362f;
260
+ filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
261
+ }
262
+ ul.wpuf-form li .wpuf-fields ul.wpuf-attachment-list li a.attachment-delete:hover,
263
+ ul.wpuf-form li .wpuf-fields ul.wpuf-attachment-list li a.wpuf-delete-avatar:hover,
264
+ ul.wpuf-form li .wpuf-fields ul.wpuf-attachment-list li a.attachment-delete:active,
265
+ ul.wpuf-form li .wpuf-fields ul.wpuf-attachment-list li a.wpuf-delete-avatar:active {
266
+ color: #ffffff;
267
+ background-color: #bd362f;
268
+ *background-color: #a9302a;
269
+ }
270
+ ul.wpuf-form li .wpuf-fields .progress {
271
+ background: -moz-linear-gradient(center bottom, #ffffff 0%, #f7f7f7 100%) repeat scroll 0 0 #ffffff;
272
+ border: 1px solid #D1D1D1;
273
+ border-radius: 3px 3px 3px 3px;
274
+ box-shadow: 0 0 3px rgba(0, 0, 0, 0.1) inset;
275
+ float: right;
276
+ height: 22px;
277
+ line-height: 2em;
278
+ margin: 0;
279
+ overflow: hidden;
280
+ padding: 0;
281
+ width: 200px;
282
+ }
283
+ ul.wpuf-form li .wpuf-fields .bar {
284
+ background-color: #83B4D8;
285
+ background-image: -moz-linear-gradient(center bottom, #72a7cf 0%, #90c5ee 100%);
286
+ border-radius: 3px 3px 3px 3px;
287
+ box-shadow: 0 0 3px rgba(0, 0, 0, 0.3);
288
+ height: 100%;
289
+ width: 0;
290
+ z-index: 9;
291
+ }
292
+ ul.wpuf-form li .wpuf-fields .progress .percent {
293
+ color: rgba(0, 0, 0, 0.6);
294
+ padding: 0 8px;
295
+ position: relative;
296
+ text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
297
+ width: 200px;
298
+ z-index: 10;
299
+ }
300
+ ul.wpuf-form li .wpuf-fields ul.wpuf-category-checklist {
301
+ list-style: none;
302
+ margin: 0;
303
+ padding: 0;
304
+ }
305
+ ul.wpuf-form li .wpuf-fields ul.wpuf-category-checklist li {
306
+ margin-bottom: 5px;
307
+ padding: 0;
308
+ }
309
+ ul.wpuf-form li .wpuf-fields ul.wpuf-category-checklist ul.children {
310
+ list-style: none;
311
+ margin-left: 25px;
312
+ }
313
+ ul.wpuf-form li .wpuf-fields #wpuf-insert-image-container {
314
+ margin-bottom: 3px;
315
+ }
316
+ ul.wpuf-form li .wpuf-fields #wpuf-insert-image-container:after {
317
+ clear: both;
318
+ content: "";
319
+ display: table;
320
+ }
321
+ ul.wpuf-form li .wpuf-fields #wpuf-insert-image-container a.wpuf-insert-image {
322
+ text-decoration: none;
323
+ border: 1px solid #DFDFDF;
324
+ font-size: 11px;
325
+ -webkit-border-radius: 3px;
326
+ -moz-border-radius: 3px;
327
+ border-radius: 3px;
328
+ padding: 4px 6px;
329
+ margin-right: 10px;
330
+ }
331
+ ul.wpuf-form li .wpuf-fields #wpuf-insert-image-container a.wpuf-insert-image .wpuf-media-icon {
332
+ height: 12px;
333
+ width: 12px;
334
+ }
335
+ ul.wpuf-form li .wpuf-address-field {
336
+ width: 100%;
337
+ margin-bottom: 10px;
338
+ }
339
+ ul.wpuf-form li .wpuf-address-field:after {
340
+ clear: both;
341
+ content: "";
342
+ display: table;
343
+ }
344
+ ul.wpuf-form li .wpuf-section-wrap {
345
+ border-bottom: 1px solid #ccc;
346
+ margin: 15px 0;
347
+ }
348
+ ul.wpuf-form li .wpuf-section-wrap h2.wpuf-section-title {
349
+ margin: 0;
350
+ }
351
+ ul.wpuf-form li .wpuf-section-wrap .wpuf-section-details {
352
+ padding: 4px 0 8px;
353
+ font-size: 12px;
354
+ }
355
+ ul.wpuf-form .wpuf-submit input[type=submit] {
356
+ font-size: 16px;
357
+ padding: 5px 15px;
358
+ border: 1px solid #ccc;
359
+ -webkit-border-radius: 3px;
360
+ -moz-border-radius: 3px;
361
+ border-radius: 3px;
362
+ background-color: #21759b;
363
+ background-image: -webkit-gradient(linear, left top, left bottom, from(#2a95c5), to(#21759b));
364
+ background-image: -webkit-linear-gradient(top, #2a95c5, #21759b);
365
+ background-image: -moz-linear-gradient(top, #2a95c5, #21759b);
366
+ background-image: -ms-linear-gradient(top, #2a95c5, #21759b);
367
+ background-image: -o-linear-gradient(top, #2a95c5, #21759b);
368
+ background-image: linear-gradient(to bottom, #2a95c5, #21759b);
369
+ border-color: #21759b;
370
+ border-bottom-color: #1e6a8d;
371
+ -webkit-box-shadow: inset 0 1px 0 rgba(120, 200, 230, 0.5);
372
+ box-shadow: inset 0 1px 0 rgba(120, 200, 230, 0.5);
373
+ color: #fff;
374
+ text-decoration: none;
375
+ text-shadow: 0 1px 0 rgba(0, 0, 0, 0.1);
376
+ }
377
+ ul.wpuf-form .wpuf-submit .button-primary-disabled {
378
+ color: #94cde7 !important;
379
+ background: #298cba !important;
380
+ border-color: #1b607f !important;
381
+ -webkit-box-shadow: none !important;
382
+ box-shadow: none !important;
383
+ text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.1) !important;
384
+ cursor: default;
385
+ }
386
+ ul.wpuf-form .wpuf-submit .wpuf-errors {
387
+ background: #FFE4E4;
388
+ border: 1px solid #ffb1b1;
389
+ margin: 10px 0;
390
+ padding: 10px;
391
+ -webkit-border-radius: 3px;
392
+ -moz-border-radius: 3px;
393
+ border-radius: 3px;
394
+ font-size: 13px;
395
+ }
396
+ #wpuf-login-form label {
397
+ display: block;
398
+ }
399
+ #wpuf-login-form .forgetmenot label {
400
+ display: inline-block;
401
+ }
402
+ .wpuf_sub_info {
403
+ padding: 0;
404
+ margin: 10px 5px;
405
+ border: 1px solid #eeeeee;
406
+ border-radius: 3px;
407
+ }
408
+ .wpuf_sub_info h3 {
409
+ margin: 0 0 5px 0 !important;
410
+ background: green;
411
+ color: #fff !important;
412
+ padding: 3px 10px !important;
413
+ font-weight: bold;
414
+ }
415
+ .wpuf_sub_info .wpuf-text {
416
+ padding: 5px 10px;
417
+ }
418
+ .wpuf_sub_info .wpuf-expire {
419
+ border-top: 1px solid #eeeeee;
420
+ padding-top: 5px;
421
+ margin-top: 5px;
422
+ }
423
+ .wpuf-coupon-info-wrap {
424
+ border: 1px solid #eeeeee;
425
+ padding: 15px;
426
+ margin-bottom: 20px;
427
+ }
428
+ .wpuf-coupon-info-wrap .wpuf-coupon-field-spinner {
429
+ background: url('../images/wpspin_light.gif') no-repeat right scroll rgba(0, 0, 0, 0);
430
+ }
431
+ .wpuf-coupon-info-wrap .wpuf-copon-show {
432
+ background: #EEEEEE;
433
+ border-radius: 3px;
434
+ border-width: 1px;
435
+ box-shadow: 0 1px 0 rgba(217, 217, 217, 0.5) inset, 0 1px 0 rgba(0, 0, 0, 0.15);
436
+ color: #5C5A5A;
437
+ cursor: pointer;
438
+ display: inline-block;
439
+ font-size: 14px;
440
+ padding: 5px 12px;
441
+ text-decoration: none;
442
+ width: 175px;
443
+ margin-bottom: 8px;
444
+ }
445
+ .wpuf-coupon-info-wrap .wpuf-copon-wrap {
446
+ margin: 15px 0;
447
+ }
448
+ .wpuf-coupon-info-wrap .wpuf-pack-info {
449
+ margin-bottom: 20px;
450
+ }
451
+ .wpuf-coupon-info-wrap .wpuf-pack-info h3 {
452
+ margin: 0 0 10px 0;
453
+ padding: 0 0 10px 0;
454
+ border-bottom: 1px solid #eeeeee;
455
+ }
456
+ .wpuf-coupon-info-wrap .wpuf-pack-info h3 a {
457
+ float: right;
458
+ text-decoration: none;
459
+ background: #64c3de;
460
+ color: #fff;
461
+ padding: 3px 8px;
462
+ font-size: 14px;
463
+ }
464
+ .wpuf-coupon-info-wrap .wpuf-copon-show:hover {
465
+ background: none repeat scroll 0 0 #1E8CBE;
466
+ border-color: #0074A2;
467
+ box-shadow: 0 1px 0 rgba(120, 200, 230, 0.6) inset;
468
+ color: #FFFFFF;
469
+ }
470
+ .wpuf-coupon-info-wrap a.wpuf-apply-coupon {
471
+ text-decoration: none;
472
+ font-size: 11px;
473
+ margin-top: 10px;
474
+ margin-right: 10px;
475
+ background: #21759b;
476
+ color: #fff;
477
+ padding: 5px 10px;
478
+ display: inline-block;
479
+ -webkit-border-radius: 3px;
480
+ -moz-border-radius: 3px;
481
+ border-radius: 3px;
482
+ }
483
+ .wpuf-coupon-info-wrap .wpuf-copon-cancel {
484
+ text-decoration: none;
485
+ font-size: 11px;
486
+ }
487
+ .entry-content ul.wpuf_packs,
488
+ ul.wpuf_packs {
489
+ overflow: hidden;
490
+ margin: 15px;
491
+ }
492
+ .entry-content ul.wpuf_packs > li,
493
+ ul.wpuf_packs > li {
494
+ background: #fff;
495
+ border: 1px solid #DDD;
496
+ border-radius: 5px 5px 5px 5px;
497
+ float: left;
498
+ list-style: none outside none;
499
+ margin: 5px 25px 25px 0;
500
+ position: relative;
501
+ width: 200px;
502
+ box-shadow: 0 2px 6px rgba(100, 100, 100, 0.3);
503
+ }
504
+ .entry-content ul.wpuf_packs > li:first-child,
505
+ ul.wpuf_packs > li:first-child {
506
+ margin-left: 5px;
507
+ }
508
+ .entry-content ul.wpuf_packs h3,
509
+ ul.wpuf_packs h3 {
510
+ background: #52B5D5;
511
+ color: #fff;
512
+ font-size: 18px;
513
+ font-weight: normal;
514
+ margin: 0;
515
+ padding: 10px !important;
516
+ text-align: center;
517
+ border-bottom: 1px solid #3dacd0;
518
+ }
519
+ .entry-content ul.wpuf_packs .wpuf-pricing-wrap,
520
+ ul.wpuf_packs .wpuf-pricing-wrap {
521
+ background: #64c3de;
522
+ }
523
+ .entry-content ul.wpuf_packs .wpuf-pricing-wrap .wpuf-sub-amount,
524
+ ul.wpuf_packs .wpuf-pricing-wrap .wpuf-sub-amount {
525
+ position: relative;
526
+ text-align: center;
527
+ color: #FFF;
528
+ border-bottom: 1px solid #4fbbda;
529
+ padding: 10px 0;
530
+ }
531
+ .entry-content ul.wpuf_packs .wpuf-pricing-wrap .wpuf-sub-amount .wpuf-sub-symbol,
532
+ ul.wpuf_packs .wpuf-pricing-wrap .wpuf-sub-amount .wpuf-sub-symbol {
533
+ font-size: 19px;
534
+ position: absolute;
535
+ top: 25px;
536
+ line-height: 10px;
537
+ }
538
+ .entry-content ul.wpuf_packs .wpuf-pricing-wrap .wpuf-sub-amount .wpuf-sub-cost,
539
+ ul.wpuf_packs .wpuf-pricing-wrap .wpuf-sub-amount .wpuf-sub-cost {
540
+ font-size: 40px;
541
+ margin-left: 10px;
542
+ line-height: 50px;
543
+ }
544
+ .entry-content ul.wpuf_packs .wpuf-pricing-wrap .wpuf-sub-amount .wpuf-pack-cycle,
545
+ ul.wpuf_packs .wpuf-pricing-wrap .wpuf-sub-amount .wpuf-pack-cycle {
546
+ font-size: 13px;
547
+ padding-bottom: 5px;
548
+ }
549
+ .entry-content ul.wpuf_packs .wpuf-sub-body,
550
+ ul.wpuf_packs .wpuf-sub-body {
551
+ margin: 0;
552
+ padding: 8px 0 0 8px;
553
+ background: #fff;
554
+ font-size: 11px;
555
+ color: #999;
556
+ }
557
+ .entry-content ul.wpuf_packs .wpuf-sub-button,
558
+ ul.wpuf_packs .wpuf-sub-button {
559
+ text-align: center;
560
+ margin-bottom: 20px;
561
+ margin-top: 20px;
562
+ overflow: hidden;
563
+ }
564
+ .entry-content ul.wpuf_packs .wpuf-sub-button a,
565
+ ul.wpuf_packs .wpuf-sub-button a {
566
+ background: #64c3de;
567
+ color: #fff;
568
+ text-decoration: none;
569
+ padding: 5px 10px;
570
+ -webkit-border-radius: 3px;
571
+ -moz-border-radius: 3px;
572
+ border-radius: 3px;
573
+ display: inline-block;
574
+ }
575
+ .entry-content ul.wpuf_packs .wpuf-sub-button a:hover,
576
+ ul.wpuf_packs .wpuf-sub-button a:hover {
577
+ background: #3ab3d5;
578
+ }
579
+ .entry-content ul.wpuf_packs .wpuf-sub-button a:hover,
580
+ ul.wpuf_packs .wpuf-sub-button a:hover {
581
+ background: none repeat scroll 0 0 #1E8CBE;
582
+ border-color: #0074A2;
583
+ box-shadow: 0 1px 0 rgba(120, 200, 230, 0.6) inset;
584
+ color: #FFFFFF;
585
+ }
586
+ .entry-content ul.wpuf_packs .wpuf-sub-desciption,
587
+ ul.wpuf_packs .wpuf-sub-desciption {
588
+ margin-top: 15px;
589
+ }
590
+ .entry-content ul.wpuf_packs .wpuf-sub-desciption ul,
591
+ ul.wpuf_packs .wpuf-sub-desciption ul,
592
+ .entry-content ul.wpuf_packs .wpuf-sub-desciption li,
593
+ ul.wpuf_packs .wpuf-sub-desciption li {
594
+ margin: 0;
595
+ padding: 0;
596
+ list-style: none;
597
+ }
598
+ .entry-content ul.wpuf_packs .wpuf-sub-desciption li,
599
+ ul.wpuf_packs .wpuf-sub-desciption li {
600
+ text-align: center;
601
+ border-top: 1px solid #eee;
602
+ padding: 7px 0;
603
+ }
604
+ .entry-content ul.wpuf_packs .wpuf-sub-desciption li:last-child,
605
+ ul.wpuf_packs .wpuf-sub-desciption li:last-child {
606
+ border-bottom: 1px solid #eee;
607
+ }
608
+ .entry-content ul.wpuf_packs .wpuf-sub-desciption li:first-child,
609
+ ul.wpuf_packs .wpuf-sub-desciption li:first-child {
610
+ border-top: none;
611
+ }
612
+ .entry-content ul.wpuf_packs .wpuf-sub-desciption p,
613
+ ul.wpuf_packs .wpuf-sub-desciption p {
614
+ padding: 0 10px;
615
+ margin-bottom: 15px;
616
+ }
617
+ .entry-content ul.wpuf_packs .button,
618
+ ul.wpuf_packs .button {
619
+ background: none repeat scroll 0 0 #2EA2CC;
620
+ border-color: #0074A2;
621
+ box-shadow: 0 1px 0 rgba(120, 200, 230, 0.5) inset, 0 1px 0 rgba(0, 0, 0, 0.15);
622
+ color: #FFFFFF;
623
+ text-decoration: none;
624
+ padding: 0 12px 2px;
625
+ color: #fff;
626
+ }
627
+ .entry-content ul.wpuf_packs .cost,
628
+ ul.wpuf_packs .cost {
629
+ background: red;
630
+ border-radius: 30px 30px 30px 30px;
631
+ color: #FFFFFF;
632
+ margin: -16px -12px 0 0;
633
+ padding: 10px 8px 8px;
634
+ position: absolute;
635
+ right: 0;
636
+ top: 0;
637
+ }
638
+ /* css for timepicker */
639
+ .ui-timepicker-div .ui-widget-header {
640
+ margin-bottom: 8px;
641
+ }
642
+ .ui-timepicker-div dl {
643
+ text-align: left;
644
+ }
645
+ .ui-timepicker-div dl dt {
646
+ height: 25px;
647
+ margin-bottom: -25px;
648
+ }
649
+ .ui-timepicker-div dl dd {
650
+ margin: 0 10px 10px 65px;
651
+ }
652
+ .ui-timepicker-div td {
653
+ font-size: 90%;
654
+ }
655
+ .ui-tpicker-grid-label {
656
+ background: none;
657
+ border: none;
658
+ margin: 0;
659
+ padding: 0;
660
+ }
661
+ .ui-timepicker-rtl {
662
+ direction: rtl;
663
+ }
664
+ .ui-timepicker-rtl dl {
665
+ text-align: right;
666
+ }
667
+ .ui-timepicker-rtl dl dd {
668
+ margin: 0 65px 10px 10px;
669
+ }
670
+ #pass-strength-result {
671
+ border-style: solid;
672
+ border-width: 1px;
673
+ float: left;
674
+ margin: 0;
675
+ padding: 3px 5px;
676
+ text-align: center;
677
+ width: 200px;
678
+ display: none;
679
+ background-color: #eee;
680
+ border-color: #ddd !important;
681
+ }
682
+ #pass-strength-result.bad {
683
+ background-color: #ffb78c;
684
+ border-color: #ff853c !important;
685
+ }
686
+ #pass-strength-result.good {
687
+ background-color: #ffec8b;
688
+ border-color: #fc0 !important;
689
+ }
690
+ #pass-strength-result.short {
691
+ background-color: #ffa0a0;
692
+ border-color: #f04040 !important;
693
+ }
694
+ #pass-strength-result.strong {
695
+ background-color: #c3ff88;
696
+ border-color: #8dff1c !important;
697
+ }
698
+ .password[type="text"] {
699
+ display: none;
700
+ }
701
+ table.wpuf-table {
702
+ border: 1px solid #E7E7E7;
703
+ margin: 0 0px 10px 0;
704
+ text-align: left;
705
+ width: 100%;
706
+ }
707
+ table.wpuf-table thead th,
708
+ table.wpuf-table th {
709
+ color: #888888;
710
+ font-size: 12px;
711
+ font-weight: bold;
712
+ line-height: 18px;
713
+ padding: 9px 24px;
714
+ }
715
+ table.wpuf-table td {
716
+ border-top: 1px solid #E7E7E7;
717
+ padding: 6px 24px;
718
+ }
719
+ #wpuf-payment-gateway ul.wpuf-payment-gateways {
720
+ list-style: none;
721
+ margin: 10px 0;
722
+ }
723
+ #wpuf-payment-gateway ul.wpuf-payment-gateways li {
724
+ margin: 0;
725
+ }
726
+ #wpuf-payment-gateway ul.wpuf-payment-gateways li .wpuf-payment-instruction {
727
+ padding: 8px 10px;
728
+ margin: 0 10px;
729
+ }
730
+ #wpuf-payment-gateway ul.wpuf-payment-gateways li .wpuf-instruction {
731
+ padding: 8px 10px;
732
+ margin-bottom: 10px;
733
+ background: #ebe8eb;
734
+ font-size: 13px;
735
+ -webkit-border-radius: 2px;
736
+ -moz-border-radius: 2px;
737
+ border-radius: 2px;
738
+ }
739
+ .wpuf-pagination div.pagination {
740
+ text-align: center;
741
+ padding: 7px;
742
+ margin: 3px;
743
+ }
744
+ .wpuf-pagination .page-numbers {
745
+ padding: 2px 8px;
746
+ margin: 2px;
747
+ border: 1px solid #4A5154;
748
+ text-decoration: none;
749
+ color: #4A5154;
750
+ background: #fff;
751
+ border-radius: 5px;
752
+ -moz-border-radius: 5px;
753
+ }
754
+ .wpuf-pagination .page-numbers:hover,
755
+ .wpuf-pagination .page-numbers:active {
756
+ border: 1px solid #4A5154;
757
+ background-color: #4A5154;
758
+ color: #fff;
759
+ border-radius: 5px;
760
+ -moz-border-radius: 5px;
761
+ }
762
+ .wpuf-pagination .page-numbers.current {
763
+ padding: 2px 8px;
764
+ margin: 2px;
765
+ border: 1px solid #4A5154;
766
+ font-weight: bold;
767
+ background-color: #4A5154;
768
+ color: #FFF;
769
+ border-radius: 5px;
770
+ -moz-border-radius: 5px;
771
+ }
772
+ /** author info **/
773
+ .wpuf-author {
774
+ margin: 20px 0;
775
+ }
776
+ .wpuf-author:after {
777
+ clear: both;
778
+ content: "";
779
+ display: table;
780
+ }
781
+ .wpuf-author h3 {
782
+ margin: 0 !important;
783
+ background: #CFCFCF;
784
+ text-align: left;
785
+ padding: 3px 10px;
786
+ }
787
+ .wpuf-author .wpuf-author-inside {
788
+ background: none repeat scroll 0 0 #F0F0F0;
789
+ border-bottom: 2px solid #DDDDDD;
790
+ height: auto;
791
+ padding-left: 10px;
792
+ padding-top: 15px;
793
+ margin-bottom: 15px;
794
+ }
795
+ .wpuf-author .wpuf-author-inside:after {
796
+ clear: both;
797
+ content: "";
798
+ display: table;
799
+ }
800
+ .wpuf-author .wpuf-author-inside .wpuf-user-image {
801
+ float: left;
802
+ padding-right: 15px;
803
+ }
804
+ .wpuf-author .wpuf-author-inside p {
805
+ margin-bottom: 10px !important;
806
+ }
807
+ .wpuf-author .wpuf-author-inside p.wpuf-author-info {
808
+ padding-top: 8px;
809
+ word-wrap: break-word;
810
+ }
811
+ .wpuf-author .wpuf-author-inside p.wpuf-user-name a {
812
+ color: #335160;
813
+ font-size: 1.2em;
814
+ font-weight: bold;
815
+ }
816
+ /** jQuery Suggest **/
817
+ .ac_results {
818
+ padding: 0;
819
+ margin: 0;
820
+ list-style: none;
821
+ position: absolute;
822
+ z-index: 10000;
823
+ display: none;
824
+ border: 1px solid #ccc;
825
+ }
826
+ .ac_results li {
827
+ padding: 2px 5px;
828
+ white-space: nowrap;
829
+ text-align: left;
830
+ }
831
+ .ac_over {
832
+ cursor: pointer;
833
+ }
834
+ .ac_match {
835
+ text-decoration: underline;
836
+ }
837
+ /*------------------------------------
838
+ * Multistep form
839
+ *-----------------------------------*/
840
+ fieldset.wpuf-multistep-fieldset {
841
+ position: relative;
842
+ padding-bottom: 50px;
843
+ border: none;
844
+ display: none;
845
+ }
846
+ fieldset.wpuf-multistep-fieldset.field-active {
847
+ display: block;
848
+ }
849
+ fieldset.wpuf-multistep-fieldset .wpuf-multistep-prev-btn,
850
+ fieldset.wpuf-multistep-fieldset .wpuf-multistep-next-btn {
851
+ position: absolute;
852
+ bottom: 5px;
853
+ }
854
+ fieldset.wpuf-multistep-fieldset .wpuf-multistep-prev-btn {
855
+ left: 10px;
856
+ }
857
+ fieldset.wpuf-multistep-fieldset .wpuf-multistep-next-btn {
858
+ right: 10px;
859
+ }
860
+ .wpuf-multistep-progressbar {
861
+ overflow: hidden;
862
+ }
863
+ .wpuf-form .wpuf-multistep-progressbar ul.wpuf-step-wizard {
864
+ margin: 20px 0 40px 0;
865
+ padding: 0;
866
+ list-style: none;
867
+ }
868
+ .wpuf-form .wpuf-multistep-progressbar ul.wpuf-step-wizard * {
869
+ box-sizing: border-box;
870
+ }
871
+ .wpuf-form .wpuf-multistep-progressbar ul.wpuf-step-wizard li {
872
+ background-color: #E4E4E4;
873
+ border-radius: 5px;
874
+ display: inline-block;
875
+ padding: 10px 30px 10px 40px;
876
+ margin-right: -7px;
877
+ width: auto;
878
+ margin: 0;
879
+ position: relative;
880
+ text-align: center;
881
+ }
882
+ .wpuf-form .wpuf-multistep-progressbar ul.wpuf-step-wizard li::before,
883
+ .wpuf-form .wpuf-multistep-progressbar ul.wpuf-step-wizard li::after {
884
+ border: solid transparent;
885
+ content: " ";
886
+ height: 0;
887
+ width: 0;
888
+ position: absolute;
889
+ border-color: transparent;
890
+ border-left-color: #fff;
891
+ border-radius: 10px;
892
+ }
893
+ .wpuf-form .wpuf-multistep-progressbar ul.wpuf-step-wizard li::before {
894
+ border-width: 26px;
895
+ margin-top: -14px;
896
+ right: -50px;
897
+ z-index: 98;
898
+ }
899
+ .wpuf-form .wpuf-multistep-progressbar ul.wpuf-step-wizard li::after {
900
+ border-left-color: #E4E4E4;
901
+ border-width: 25px;
902
+ margin-top: -37px;
903
+ right: -44px;
904
+ z-index: 99;
905
+ }
906
+ .wpuf-form .wpuf-multistep-progressbar ul.wpuf-step-wizard li.active-step {
907
+ background-color: #00a0d2;
908
+ color: #fff;
909
+ }
910
+ .wpuf-form .wpuf-multistep-progressbar ul.wpuf-step-wizard li.active-step::after {
911
+ border-left-color: #00a0d2;
912
+ }
913
+ .wpuf-form .wpuf-multistep-progressbar ul.wpuf-step-wizard li:last-child::after {
914
+ border-left-color: transparent;
915
+ }
916
+ .wpuf-form .wpuf-multistep-progressbar .ui-widget-header {
917
+ background: #00a0d2;
918
+ }
919
+ .wpuf-form .wpuf-multistep-progressbar.ui-progressbar {
920
+ margin-bottom: 30px;
921
+ height: 25px;
922
+ border: 1px solid #eeeeee;
923
+ position: relative;
924
+ }
925
+ .wpuf-form .wpuf-multistep-progressbar.ui-progressbar .wpuf-progress-percentage {
926
+ position: absolute;
927
+ left: 50%;
928
+ font-size: 12px;
929
+ font-weight: bold;
930
+ text-shadow: 1px 1px 0 #fff;
931
+ top: 20%;
932
+ }
933
+ input.wpuf-btn {
934
+ text-decoration: none !important;
935
+ font-size: 15px !important;
936
+ margin-top: 10px;
937
+ margin-right: 10px;
938
+ background: #21759b !important;
939
+ color: #fff !important;
940
+ padding: 5px 10px;
941
+ display: inline-block;
942
+ -webkit-border-radius: 3px !important;
943
+ -moz-border-radius: 3px !important;
944
+ border-radius: 3px !important;
945
+ border: none !important;
946
+ }
947
+ /*rtl*/
948
+ body.rtl ul.wpuf-form li .wpuf-label {
949
+ float: right;
950
+ }
951
+ @media (max-width: 480px) {
952
+ ul.wpuf-form li .wpuf-label,
953
+ ul.wpuf-form li .wpuf-fields {
954
+ float: none;
955
+ width: 100%;
956
+ }
957
+ }
assets/css/frontend-forms.less ADDED
@@ -0,0 +1,1032 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @borderColor: #eee;
2
+ @mainColor: #64C3DE;
3
+
4
+ .clearfix() {
5
+ &:after {
6
+ clear: both;
7
+ content: "";
8
+ display: table;
9
+ }
10
+ }
11
+
12
+ .border-radius(@radius) {
13
+ -webkit-border-radius: @radius;
14
+ -moz-border-radius: @radius;
15
+ border-radius: @radius;
16
+ }
17
+
18
+ .core-button() {
19
+ background-color: #21759b;
20
+ background-image: -webkit-gradient(linear, left top, left bottom, from(#2a95c5), to(#21759b));
21
+ background-image: -webkit-linear-gradient(top, #2a95c5, #21759b);
22
+ background-image: -moz-linear-gradient(top, #2a95c5, #21759b);
23
+ background-image: -ms-linear-gradient(top, #2a95c5, #21759b);
24
+ background-image: -o-linear-gradient(top, #2a95c5, #21759b);
25
+ background-image: linear-gradient(to bottom, #2a95c5, #21759b);
26
+ border-color: #21759b;
27
+ border-bottom-color: #1e6a8d;
28
+ -webkit-box-shadow: inset 0 1px 0 rgba(120,200,230,0.5);
29
+ box-shadow: inset 0 1px 0 rgba(120,200,230,0.5);
30
+ color: #fff;
31
+ text-decoration: none;
32
+ text-shadow: 0 1px 0 rgba(0,0,0,0.1);
33
+ }
34
+
35
+ .core-button-hover() {
36
+ background-color: #278ab7;
37
+ background-image: -webkit-gradient(linear, left top, left bottom, from(#2e9fd2), to(#21759b));
38
+ background-image: -webkit-linear-gradient(top, #2e9fd2, #21759b);
39
+ background-image: -moz-linear-gradient(top, #2e9fd2, #21759b);
40
+ background-image: -ms-linear-gradient(top, #2e9fd2, #21759b);
41
+ background-image: -o-linear-gradient(top, #2e9fd2, #21759b);
42
+ background-image: linear-gradient(to bottom, #2e9fd2, #21759b);
43
+ border-color: #1b607f;
44
+ -webkit-box-shadow: inset 0 1px 0 rgba(120,200,230,0.6);
45
+ box-shadow: inset 0 1px 0 rgba(120,200,230,0.6);
46
+ color: #fff;
47
+ text-shadow: 0 -1px 0 rgba(0,0,0,0.3);
48
+ }
49
+
50
+ .wpuf-loading {
51
+ width: 16px;
52
+ height: 16px;
53
+ background: url('../images/wpspin_light.gif') no-repeat;
54
+ display: inline-block;
55
+
56
+ &.hide {
57
+ display: none;
58
+ }
59
+ }
60
+
61
+ .wpuf-button {
62
+ background: #f3f3f3;
63
+ background-image: -webkit-gradient(linear, left top, left bottom, from(#fefefe), to(#f4f4f4));
64
+ background-image: -webkit-linear-gradient(top, #fefefe, #f4f4f4);
65
+ background-image: -moz-linear-gradient(top, #fefefe, #f4f4f4);
66
+ background-image: -o-linear-gradient(top, #fefefe, #f4f4f4);
67
+ background-image: linear-gradient(to bottom, #fefefe, #f4f4f4);
68
+ border-color: #bbb;
69
+ color: #333;
70
+ text-shadow: 0 1px 0 #fff;
71
+
72
+ &:hover, &:focus {
73
+ background: #f3f3f3;
74
+ background-image: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#f3f3f3));
75
+ background-image: -webkit-linear-gradient(top, #fff, #f3f3f3);
76
+ background-image: -moz-linear-gradient(top, #fff, #f3f3f3);
77
+ background-image: -ms-linear-gradient(top, #fff, #f3f3f3);
78
+ background-image: -o-linear-gradient(top, #fff, #f3f3f3);
79
+ background-image: linear-gradient(to bottom, #fff, #f3f3f3);
80
+ border-color: #999;
81
+ color: #222;
82
+ }
83
+ }
84
+
85
+ .wpuf-success {
86
+ background-color: #dff0d8;
87
+ border: 1px solid #d6e9c6;
88
+ color: #3c763d;
89
+ padding: 10px;
90
+ margin: 10px 0 20px 0;
91
+ }
92
+
93
+ .wpuf-error {
94
+ background-color: #f2dede;
95
+ color: #a94442;
96
+ border: 1px solid #ebccd1;
97
+ margin: 10px 0 20px 0;
98
+ padding: 10px;
99
+ .border-radius(3px);
100
+ font-size: 13px;
101
+ }
102
+
103
+ .wpuf-message {
104
+ background: #fcf8e3;
105
+ border: 1px solid #faebcc;
106
+ color: #8a6d3b;
107
+ margin: 10px 0 20px 0;
108
+ padding: 10px;
109
+ .border-radius(3px);
110
+ font-size: 13px;
111
+ }
112
+
113
+ .wpuf-info {
114
+ background-color: #fef5be;
115
+ border: 2px solid #fdd425;
116
+ border-radius: 5px;
117
+ -moz-border-radius: 5px;
118
+ -webkit-border-radius: 5px;
119
+ padding: 5px 10px;
120
+ margin: 0 0 10px 0;
121
+ font-size: 13px;
122
+ }
123
+
124
+ ul.wpuf-form {
125
+ list-style: none !important;
126
+ margin: 0 !important;
127
+ padding: 0 !important;
128
+ width: 100%;
129
+
130
+ li {
131
+ .clearfix();
132
+ margin-left: 0;
133
+ margin-bottom: 10px;
134
+ padding: 10px;
135
+
136
+ &.has-error {
137
+ background: #FFE4E4;
138
+ }
139
+
140
+ .wp-editor-wrap {
141
+ border: 1px solid @borderColor;
142
+ }
143
+
144
+ .wpuf-label {
145
+ float: left;
146
+ width: 25%;
147
+
148
+ .required {
149
+ color: red;
150
+ }
151
+ }
152
+
153
+ .wpuf-fields {
154
+ float: left;
155
+ width: 75%;
156
+
157
+ input[type=text],
158
+ input[type=password],
159
+ input[type=email],
160
+ input[type=url],
161
+ input[type=number],
162
+ textarea {
163
+ background: #fafafa;
164
+ -moz-box-shadow: inset 0 1px 1px rgba(0,0,0,0.1);
165
+ -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,0.1);
166
+ box-shadow: inset 0 1px 1px rgba(0,0,0,0.1);
167
+ border: 1px solid #ddd;
168
+ color: #888;
169
+ }
170
+ input[type=text]:focus,
171
+ input[type=password]:focus,
172
+ input[type=email]:focus,
173
+ input[type=url]:focus,
174
+ input[type=number]:focus,
175
+ textarea:focus {
176
+ color: #373737;
177
+ }
178
+ textarea {
179
+ padding-left: 3px;
180
+ width: 98%;
181
+ }
182
+ input[type=text],
183
+ input[type=password],
184
+ input[type=email],
185
+ input[type=url],
186
+ input[type=number] {
187
+ padding: 5px;
188
+ }
189
+
190
+ select {
191
+ border: 1px solid @borderColor;
192
+ padding: 2px;
193
+ height: 2em;
194
+ .border-radius(3px);
195
+ min-width: 150px;
196
+ }
197
+
198
+ select[multiple] {
199
+ height: auto;
200
+ }
201
+
202
+ a.file-selector {
203
+ text-decoration: none;
204
+ padding: 5px 12px;
205
+ height: 30px;
206
+ line-height: 28px;
207
+ border: 1px solid #ccc;
208
+ .border-radius(3px);
209
+ .core-button();
210
+
211
+ &:hover,
212
+ &:focus {
213
+ .core-button-hover();
214
+ }
215
+ }
216
+
217
+ .google-map {
218
+ img {
219
+ max-width: none !important;
220
+ }
221
+ }
222
+
223
+ .wpuf-help {
224
+ color: #666;
225
+ margin: 2px 0 5px 0;
226
+ font-size: 12px;
227
+ font-style: italic;
228
+ font-family: sans-serif;
229
+ display: block;
230
+ }
231
+
232
+ table, td {
233
+ border: none;
234
+ margin: 0;
235
+ }
236
+
237
+ table {
238
+ width: 100%;
239
+ }
240
+
241
+ img.wpuf-clone-field,
242
+ img.wpuf-remove-field {
243
+ cursor: pointer;
244
+ margin: 0 3px;
245
+ box-shadow: none;
246
+ border: none;
247
+ }
248
+
249
+ ul.wpuf-attachment-list {
250
+ list-style: none;
251
+ margin: 5px 0 0 0;
252
+ padding: 0;
253
+
254
+ li {
255
+ display: inline-block;
256
+ border: 1px solid @borderColor;
257
+ padding: 5px;
258
+ width: 150px;
259
+ margin-right: 5px;
260
+ .border-radius(5px);
261
+
262
+ .wpuf-file-input-wrap {
263
+ margin: 10px 0;
264
+
265
+ input, textarea {
266
+ border: 1px solid @borderColor;
267
+ width: 93%;
268
+ }
269
+ }
270
+
271
+ .attachment-name {
272
+ text-align: center;
273
+ }
274
+
275
+ a.attachment-delete,a.wpuf-delete-avatar {
276
+ text-decoration: none;
277
+ padding: 3px 12px;
278
+ border: 1px solid #C47272;
279
+ color:#ffffff;
280
+ text-shadow:0 -1px 0 rgba(0, 0, 0, 0.25);
281
+ .border-radius(3px);
282
+ background-color:#da4f49;
283
+ background-image:-moz-linear-gradient(top, #ee5f5b, #bd362f);
284
+ background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#ee5f5b), to(#bd362f));
285
+ background-image:-webkit-linear-gradient(top, #ee5f5b, #bd362f);
286
+ background-image:-o-linear-gradient(top, #ee5f5b, #bd362f);
287
+ background-image:linear-gradient(to bottom, #ee5f5b, #bd362f);
288
+ background-repeat:repeat-x;
289
+ filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffee5f5b', endColorstr='#ffbd362f', GradientType=0);
290
+ border-color:#bd362f #bd362f #802420;
291
+ border-color:rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
292
+ *background-color:#bd362f;
293
+ filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);
294
+
295
+ &:hover, &:active {
296
+ color:#ffffff;
297
+ background-color:#bd362f;
298
+ *background-color:#a9302a;
299
+ }
300
+ }
301
+ }
302
+ }
303
+
304
+ .progress {
305
+ background: -moz-linear-gradient(center bottom , #FFFFFF 0%, #F7F7F7 100%) repeat scroll 0 0 #FFFFFF;
306
+ border: 1px solid #D1D1D1;
307
+ border-radius: 3px 3px 3px 3px;
308
+ box-shadow: 0 0 3px rgba(0, 0, 0, 0.1) inset;
309
+ float: right;
310
+ height: 22px;
311
+ line-height: 2em;
312
+ margin: 0;
313
+ overflow: hidden;
314
+ padding: 0;
315
+ width: 200px;
316
+ }
317
+
318
+ .bar {
319
+ background-color: #83B4D8;
320
+ background-image: -moz-linear-gradient(center bottom , #72A7CF 0%, #90C5EE 100%);
321
+ border-radius: 3px 3px 3px 3px;
322
+ box-shadow: 0 0 3px rgba(0, 0, 0, 0.3);
323
+ height: 100%;
324
+ // margin-top: -26px;
325
+ width: 0;
326
+ z-index: 9;
327
+ }
328
+
329
+ .progress .percent {
330
+ color: rgba(0, 0, 0, 0.6);
331
+ padding: 0 8px;
332
+ position: relative;
333
+ text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
334
+ width: 200px;
335
+ z-index: 10;
336
+ }
337
+
338
+ ul.wpuf-category-checklist {
339
+ list-style: none;
340
+ margin: 0;
341
+ padding: 0;
342
+
343
+ li {
344
+ margin-bottom: 5px;
345
+ padding: 0;
346
+ }
347
+
348
+ ul.children {
349
+ list-style: none;
350
+ margin-left: 25px;
351
+ }
352
+ }
353
+
354
+ #wpuf-insert-image-container {
355
+ .clearfix();
356
+ margin-bottom: 3px;
357
+
358
+ a.wpuf-insert-image {
359
+ text-decoration: none;
360
+ // float: left;
361
+ border: 1px solid #DFDFDF;
362
+ font-size: 11px;
363
+ .border-radius(3px);
364
+ padding: 4px 6px;
365
+ margin-right: 10px;
366
+
367
+ .wpuf-media-icon {
368
+ // background: url('../images/photo.png') no-repeat;
369
+ height: 12px;
370
+ width: 12px;
371
+ // display: inline-block;
372
+ }
373
+ }
374
+ }
375
+ }
376
+
377
+ .wpuf-address-field {
378
+ .clearfix();
379
+ width: 100%;
380
+ margin-bottom: 10px;
381
+ }
382
+
383
+ .wpuf-section-wrap {
384
+ border-bottom: 1px solid #ccc;
385
+ margin: 15px 0;
386
+
387
+ h2.wpuf-section-title {
388
+ margin: 0;
389
+ }
390
+
391
+ .wpuf-section-details {
392
+ padding: 4px 0 8px;
393
+ font-size: 12px;
394
+ }
395
+ }
396
+ }
397
+
398
+ .wpuf-submit {
399
+ input[type=submit] {
400
+ font-size: 16px;
401
+ padding: 5px 15px;
402
+ border: 1px solid #ccc;
403
+ .border-radius(3px);
404
+ .core-button();
405
+ }
406
+
407
+ .button-primary-disabled {
408
+ color: #94cde7 !important;
409
+ background: #298cba !important;
410
+ border-color: #1b607f !important;
411
+ -webkit-box-shadow: none !important;
412
+ box-shadow: none !important;
413
+ text-shadow: 0 -1px 0 rgba(0,0,0,0.1) !important;
414
+ cursor: default;
415
+ }
416
+
417
+ .wpuf-errors {
418
+ background: #FFE4E4;
419
+ border: 1px solid darken(#FFE4E4, 10%);
420
+ margin: 10px 0;
421
+ padding: 10px;
422
+ .border-radius(3px);
423
+ font-size: 13px;
424
+ }
425
+ }
426
+ }
427
+
428
+ #wpuf-login-form {
429
+ label {
430
+ display: block;
431
+ }
432
+
433
+ .forgetmenot label {
434
+ display: inline-block;
435
+ }
436
+ }
437
+
438
+ .wpuf_sub_info {
439
+ padding: 0;
440
+ margin: 10px 5px;
441
+ border: 1px solid @borderColor;
442
+ border-radius: 3px;
443
+
444
+ h3 {
445
+ margin: 0 0 5px 0 !important;
446
+ background: green;
447
+ color: #fff !important;
448
+ padding: 3px 10px !important;
449
+ font-weight: bold;
450
+ }
451
+
452
+ .wpuf-text{
453
+ padding: 5px 10px;
454
+ }
455
+
456
+ .wpuf-expire {
457
+ border-top: 1px solid @borderColor;
458
+ padding-top: 5px;
459
+ margin-top: 5px;
460
+ }
461
+ }
462
+
463
+ .wpuf-coupon-info-wrap {
464
+ border: 1px solid @borderColor;
465
+ padding: 15px;
466
+ margin-bottom: 20px;
467
+
468
+ .wpuf-coupon-field-spinner {
469
+ background: url( '../images/wpspin_light.gif' ) no-repeat right scroll rgba(0, 0, 0, 0);
470
+ }
471
+ .wpuf-copon-show {
472
+ background: #EEEEEE;
473
+ border-radius: 3px;
474
+ border-width: 1px;
475
+ box-shadow: 0 1px 0 rgba(217, 217, 217, 0.5) inset, 0 1px 0 rgba(0, 0, 0, 0.15);
476
+ color: #5C5A5A;
477
+ cursor: pointer;
478
+ display: inline-block;
479
+ font-size: 14px;
480
+ padding: 5px 12px;
481
+ text-decoration: none;
482
+ width: 175px;
483
+ margin-bottom: 8px;
484
+ }
485
+
486
+ .wpuf-copon-wrap {
487
+ margin: 15px 0;
488
+ }
489
+
490
+ .wpuf-pack-info {
491
+ margin-bottom: 20px;
492
+
493
+ h3 {
494
+ margin: 0 0 10px 0;
495
+ padding: 0 0 10px 0;
496
+ border-bottom: 1px solid @borderColor;
497
+
498
+ a {
499
+ float: right;
500
+ text-decoration: none;
501
+ background: @mainColor;
502
+ color: #fff;
503
+ padding: 3px 8px;
504
+ font-size: 14px;
505
+ }
506
+ }
507
+ }
508
+
509
+ .wpuf-copon-show:hover {
510
+ background: none repeat scroll 0 0 #1E8CBE;
511
+ border-color: #0074A2;
512
+ box-shadow: 0 1px 0 rgba(120, 200, 230, 0.6) inset;
513
+ color: #FFFFFF;
514
+ }
515
+
516
+ a.wpuf-apply-coupon {
517
+ text-decoration: none;
518
+ font-size: 11px;
519
+ margin-top: 10px;
520
+ margin-right: 10px;
521
+ background: #21759b;
522
+ color: #fff;
523
+ padding: 5px 10px;
524
+ display: inline-block;
525
+ .border-radius(3px);
526
+ }
527
+
528
+ .wpuf-copon-cancel {
529
+ text-decoration: none;
530
+ font-size: 11px;
531
+ }
532
+ }
533
+
534
+ .entry-content ul.wpuf_packs,
535
+ ul.wpuf_packs {
536
+ overflow: hidden;
537
+ margin: 15px;
538
+
539
+ > li {
540
+ background: #fff;
541
+ border: 1px solid #DDD;
542
+ border-radius: 5px 5px 5px 5px;
543
+ float: left;
544
+ list-style: none outside none;
545
+ margin: 5px 25px 25px 0;
546
+ position: relative;
547
+ width: 200px;
548
+ box-shadow: 0 2px 6px rgba(100, 100, 100, 0.3);
549
+
550
+ &:first-child {
551
+ margin-left: 5px;
552
+ }
553
+ }
554
+
555
+ h3 {
556
+ background: #52B5D5;
557
+ color: #fff;
558
+ font-size: 18px;
559
+ font-weight: normal;
560
+ margin: 0;
561
+ padding: 10px !important;
562
+ text-align: center;
563
+ border-bottom: 1px solid darken(#52B5D5, 5%);
564
+ }
565
+
566
+ .wpuf-pricing-wrap {
567
+ background: @mainColor;
568
+
569
+ .wpuf-sub-amount {
570
+ position: relative;
571
+ text-align: center;
572
+ color: #FFF;
573
+ border-bottom: 1px solid darken(@mainColor, 5%);
574
+ padding: 10px 0;
575
+
576
+ .wpuf-sub-symbol {
577
+ font-size: 19px;
578
+ position: absolute;
579
+ top: 25px;
580
+ line-height: 10px;
581
+ }
582
+
583
+ .wpuf-sub-cost {
584
+ font-size: 40px;
585
+ margin-left: 10px;
586
+ line-height: 50px;
587
+ }
588
+
589
+ .wpuf-pack-cycle {
590
+ font-size: 13px;
591
+ padding-bottom: 5px;
592
+ }
593
+ }
594
+ }
595
+
596
+ .wpuf-sub-body {
597
+ margin: 0;
598
+ padding: 8px 0 0 8px;
599
+ background: #fff;
600
+ font-size: 11px;
601
+ color: #999;
602
+ }
603
+
604
+ .wpuf-sub-button {
605
+ text-align: center;
606
+ margin-bottom: 20px;
607
+ margin-top: 20px;
608
+ overflow: hidden;
609
+
610
+ a {
611
+ // .core-button();
612
+ background: @mainColor;
613
+ color: #fff;
614
+ text-decoration: none;
615
+ padding: 5px 10px;
616
+ .border-radius(3px);
617
+ display: inline-block;
618
+
619
+ &:hover {
620
+ background: darken(@mainColor, 10%);
621
+ }
622
+ }
623
+
624
+ a:hover {
625
+ background: none repeat scroll 0 0 #1E8CBE;
626
+ border-color: #0074A2;
627
+ box-shadow: 0 1px 0 rgba(120, 200, 230, 0.6) inset;
628
+ color: #FFFFFF;
629
+ }
630
+ }
631
+
632
+ .wpuf-sub-desciption {
633
+ margin-top: 15px;
634
+
635
+ ul, li {
636
+ margin: 0;
637
+ padding: 0;
638
+ list-style: none;
639
+ }
640
+
641
+ li {
642
+ text-align: center;
643
+ border-top: 1px solid #eee;
644
+ padding: 7px 0;
645
+
646
+ &:last-child {
647
+ border-bottom: 1px solid #eee;
648
+ }
649
+
650
+ &:first-child {
651
+ border-top: none;
652
+ }
653
+ }
654
+
655
+ p {
656
+ padding: 0 10px;
657
+ margin-bottom: 15px;
658
+ }
659
+ }
660
+
661
+ .button {
662
+ background: none repeat scroll 0 0 #2EA2CC;
663
+ border-color: #0074A2;
664
+ box-shadow: 0 1px 0 rgba(120, 200, 230, 0.5) inset, 0 1px 0 rgba(0, 0, 0, 0.15);
665
+ color: #FFFFFF;
666
+ text-decoration: none;
667
+ padding: 0 12px 2px;
668
+ color: #fff;
669
+ }
670
+
671
+ .cost {
672
+ background: red;
673
+ border-radius: 30px 30px 30px 30px;
674
+ color: #FFFFFF;
675
+ margin: -16px -12px 0 0;
676
+ padding: 10px 8px 8px;
677
+ position: absolute;
678
+ right: 0;
679
+ top: 0;
680
+ }
681
+ }
682
+
683
+ /* css for timepicker */
684
+ .ui-timepicker-div .ui-widget-header { margin-bottom: 8px; }
685
+ .ui-timepicker-div dl { text-align: left; }
686
+ .ui-timepicker-div dl dt { height: 25px; margin-bottom: -25px; }
687
+ .ui-timepicker-div dl dd { margin: 0 10px 10px 65px; }
688
+ .ui-timepicker-div td { font-size: 90%; }
689
+ .ui-tpicker-grid-label { background: none; border: none; margin: 0; padding: 0; }
690
+
691
+ .ui-timepicker-rtl{ direction: rtl; }
692
+ .ui-timepicker-rtl dl { text-align: right; }
693
+ .ui-timepicker-rtl dl dd { margin: 0 65px 10px 10px; }
694
+
695
+ // Password Strength
696
+ #pass-strength-result {
697
+ border-style: solid;
698
+ border-width: 1px;
699
+ float: left;
700
+ margin: 0;
701
+ padding: 3px 5px;
702
+ text-align: center;
703
+ width: 200px;
704
+ display: none;
705
+ background-color: #eee;
706
+ border-color: #ddd !important;
707
+
708
+ &.bad {
709
+ background-color: #ffb78c;
710
+ border-color: #ff853c !important;
711
+ }
712
+
713
+ &.good {
714
+ background-color: #ffec8b;
715
+ border-color: #fc0 !important;
716
+ }
717
+
718
+ &.short {
719
+ background-color: #ffa0a0;
720
+ border-color: #f04040 !important;
721
+ }
722
+
723
+ &.strong {
724
+ background-color: #c3ff88;
725
+ border-color: #8dff1c !important;
726
+ }
727
+ }
728
+
729
+ .password[type="text"]{
730
+ display: none;
731
+ }
732
+
733
+ table.wpuf-table {
734
+ border: 1px solid #E7E7E7;
735
+ margin: 0 0px 10px 0;
736
+ text-align: left;
737
+ width: 100%;
738
+
739
+ thead th, th {
740
+ color: #888888;
741
+ font-size: 12px;
742
+ font-weight: bold;
743
+ line-height: 18px;
744
+ padding: 9px 24px;
745
+ }
746
+
747
+ td {
748
+ border-top: 1px solid #E7E7E7;
749
+ padding: 6px 24px;
750
+ }
751
+ }
752
+
753
+ #wpuf-payment-gateway {
754
+ ul.wpuf-payment-gateways {
755
+ list-style: none;
756
+ margin: 10px 0;
757
+
758
+ li {
759
+ margin: 0;
760
+
761
+ .wpuf-payment-instruction {
762
+ padding: 8px 10px;
763
+ margin: 0 10px;
764
+ }
765
+
766
+ .wpuf-instruction {
767
+ padding: 8px 10px;
768
+ margin-bottom: 10px;
769
+ background: #ebe8eb;
770
+ font-size: 13px;
771
+ .border-radius(2px);
772
+ }
773
+ }
774
+ }
775
+ }
776
+
777
+ .wpuf-pagination {
778
+ div.pagination{
779
+ text-align:center;
780
+ padding:7px;
781
+ margin:3px;
782
+ }
783
+
784
+ .page-numbers{
785
+ padding:2px 8px;
786
+ margin:2px;
787
+ border:1px solid #4A5154;
788
+ text-decoration:none;
789
+ color:#4A5154;
790
+ background: #fff;
791
+ border-radius: 5px;
792
+ -moz-border-radius: 5px;
793
+
794
+ &:hover,
795
+ &:active{
796
+ border:1px solid #4A5154;
797
+ background-color:#4A5154;
798
+ color:#fff;
799
+ border-radius: 5px;
800
+ -moz-border-radius: 5px;
801
+ }
802
+
803
+ &.current{
804
+ padding:2px 8px;
805
+ margin:2px;
806
+ border:1px solid #4A5154;
807
+ font-weight:bold;
808
+ background-color:#4A5154;
809
+ color:#FFF;
810
+ border-radius: 5px;
811
+ -moz-border-radius: 5px;
812
+ }
813
+ }
814
+ }
815
+
816
+ /** author info **/
817
+ .wpuf-author {
818
+ .clearfix();
819
+ margin: 20px 0;
820
+
821
+ h3{
822
+ margin: 0 !important;
823
+ background: #CFCFCF;
824
+ text-align: left;
825
+ padding: 3px 10px;
826
+ }
827
+
828
+ .wpuf-author-inside {
829
+ background: none repeat scroll 0 0 #F0F0F0;
830
+ border-bottom: 2px solid #DDDDDD;
831
+ height: auto;
832
+ padding-left: 10px;
833
+ padding-top: 15px;
834
+ margin-bottom: 15px;
835
+ .clearfix();
836
+
837
+ .wpuf-user-image {
838
+ float: left;
839
+ padding-right: 15px;
840
+ }
841
+
842
+ p {
843
+ margin-bottom: 10px !important;
844
+ }
845
+
846
+ p.wpuf-author-info {
847
+ padding-top: 8px;
848
+ word-wrap: break-word;
849
+ }
850
+
851
+ p.wpuf-user-name a {
852
+ color: #335160;
853
+ font-size: 1.2em;
854
+ font-weight: bold;
855
+ }
856
+ }
857
+ }
858
+
859
+ /** jQuery Suggest **/
860
+
861
+ .ac_results {
862
+ padding: 0;
863
+ margin: 0;
864
+ list-style: none;
865
+ position: absolute;
866
+ z-index: 10000;
867
+ display: none;
868
+ border: 1px solid #ccc;
869
+
870
+ li {
871
+ padding: 2px 5px;
872
+ white-space: nowrap;
873
+ text-align: left;
874
+ }
875
+ }
876
+
877
+ .ac_over {
878
+ cursor: pointer;
879
+ }
880
+
881
+ .ac_match {
882
+ text-decoration: underline;
883
+ }
884
+
885
+ /*------------------------------------
886
+ * Multistep form
887
+ *-----------------------------------*/
888
+ fieldset.wpuf-multistep-fieldset {
889
+ position: relative;
890
+ padding-bottom: 50px;
891
+ border: none;
892
+ display: none;
893
+
894
+ &.field-active {
895
+ display: block;
896
+ }
897
+
898
+ .wpuf-multistep-prev-btn,
899
+ .wpuf-multistep-next-btn {
900
+ position: absolute;
901
+ bottom: 5px;
902
+ }
903
+ .wpuf-multistep-prev-btn {
904
+ left: 10px;
905
+ }
906
+ .wpuf-multistep-next-btn {
907
+ right: 10px;
908
+ }
909
+ }
910
+
911
+ .wpuf-multistep-progressbar {
912
+ overflow: hidden;
913
+ }
914
+
915
+ .wpuf-form .wpuf-multistep-progressbar {
916
+
917
+ @stepBackground: #00a0d2;
918
+
919
+ ul.wpuf-step-wizard {
920
+ margin: 20px 0 40px 0;
921
+ padding: 0;
922
+ list-style: none;
923
+
924
+ * {
925
+ box-sizing: border-box;
926
+ }
927
+
928
+ li {
929
+ background-color: #E4E4E4;
930
+ border-radius: 5px;
931
+ display: inline-block;
932
+ padding: 10px 30px 10px 40px;
933
+ margin-right: -7px;
934
+ width: auto;
935
+ margin: 0;
936
+ position: relative;
937
+ text-align: center;
938
+
939
+ &::before,
940
+ &::after {
941
+ border: solid transparent;
942
+ content: " ";
943
+ height: 0;
944
+ width: 0;
945
+ position: absolute;
946
+ border-color: transparent;
947
+ border-left-color: #fff;
948
+ border-radius: 10px;
949
+ }
950
+
951
+ &::before {
952
+ border-width: 26px;
953
+ margin-top: -14px;
954
+ right: -50px;
955
+ z-index: 98;
956
+ }
957
+
958
+ &::after {
959
+ border-left-color: #E4E4E4;
960
+ border-width: 25px;
961
+ margin-top: -37px;
962
+ right: -44px;
963
+ z-index: 99;
964
+ }
965
+
966
+ &.active-step {
967
+ background-color: @stepBackground;
968
+ color: #fff;
969
+
970
+ &::after {
971
+ border-left-color: @stepBackground;
972
+ }
973
+ }
974
+
975
+ &:last-child::after {
976
+ border-left-color: transparent;
977
+ }
978
+ }
979
+ }
980
+
981
+ .ui-widget-header {
982
+ background: @stepBackground;
983
+ }
984
+
985
+ &.ui-progressbar {
986
+ margin-bottom: 30px;
987
+ height: 25px;
988
+ border: 1px solid @borderColor;
989
+ position: relative;
990
+
991
+ .wpuf-progress-percentage {
992
+ position: absolute;
993
+ left: 50%;
994
+ font-size: 12px;
995
+ font-weight: bold;
996
+ text-shadow: 1px 1px 0 #fff;
997
+ top: 20%;
998
+ }
999
+ }
1000
+ }
1001
+ input.wpuf-btn {
1002
+ text-decoration: none !important;
1003
+ font-size: 15px !important;
1004
+ margin-top: 10px;
1005
+ margin-right: 10px;
1006
+ background: #21759b !important;
1007
+ color: #fff !important;
1008
+ padding: 5px 10px;
1009
+ display: inline-block;
1010
+ -webkit-border-radius: 3px !important;
1011
+ -moz-border-radius: 3px !important;
1012
+ border-radius: 3px !important;
1013
+ border: none !important;
1014
+ }
1015
+ /*rtl*/
1016
+ body.rtl{
1017
+ ul.wpuf-form li .wpuf-label{
1018
+ float: right;
1019
+ }
1020
+ }
1021
+
1022
+ // landscape phones and smaller
1023
+ @media (max-width: 480px) {
1024
+ ul.wpuf-form {
1025
+ li {
1026
+ .wpuf-label, .wpuf-fields {
1027
+ float: none;
1028
+ width: 100%;
1029
+ }
1030
+ }
1031
+ }
1032
+ }
assets/css/images/ui-bg_diagonals-small_75_cccccc_40x40.png ADDED
Binary file
assets/css/images/ui-bg_flat_0_aaaaaa_40x100.png ADDED
Binary file
assets/css/images/ui-bg_flat_0_ffffff_40x100.png ADDED
Binary file
assets/css/images/ui-bg_flat_75_ffffff_40x100.png ADDED
Binary file
assets/css/images/ui-bg_glass_55_fbf9ee_1x400.png ADDED
Binary file
assets/css/images/ui-bg_glass_65_ffffff_1x400.png ADDED
Binary file
assets/css/images/ui-bg_glass_75_dadada_1x400.png ADDED
Binary file
assets/css/images/ui-bg_glass_75_e6e6e6_1x400.png ADDED
Binary file
assets/css/images/ui-bg_glass_95_fef1ec_1x400.png ADDED
Binary file
assets/css/images/ui-icons_222222_256x240.png ADDED
Binary file
assets/css/images/ui-icons_2e83ff_256x240.png ADDED
Binary file
assets/css/images/ui-icons_454545_256x240.png ADDED
Binary file
assets/css/images/ui-icons_888888_256x240.png ADDED
Binary file
assets/css/images/ui-icons_cd0a0a_256x240.png ADDED
Binary file
assets/css/jquery-ui-1.9.1.custom.css ADDED
@@ -0,0 +1,461 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*! jQuery UI - v1.9.1 - 2012-11-14
2
+ * http://jqueryui.com
3
+ * Includes: jquery.ui.core.css, jquery.ui.resizable.css, jquery.ui.selectable.css, jquery.ui.accordion.css, jquery.ui.autocomplete.css, jquery.ui.button.css, jquery.ui.datepicker.css, jquery.ui.dialog.css, jquery.ui.menu.css, jquery.ui.progressbar.css, jquery.ui.slider.css, jquery.ui.spinner.css, jquery.ui.tabs.css, jquery.ui.tooltip.css
4
+ * To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Verdana%2CArial%2Csans-serif&fwDefault=normal&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=cccccc&bgTextureHeader=07_diagonals_small.png&bgImgOpacityHeader=75&borderColorHeader=aaaaaa&fcHeader=222222&iconColorHeader=222222&bgColorContent=ffffff&bgTextureContent=01_flat.png&bgImgOpacityContent=75&borderColorContent=aaaaaa&fcContent=222222&iconColorContent=222222&bgColorDefault=e6e6e6&bgTextureDefault=02_glass.png&bgImgOpacityDefault=75&borderColorDefault=d3d3d3&fcDefault=555555&iconColorDefault=888888&bgColorHover=dadada&bgTextureHover=02_glass.png&bgImgOpacityHover=75&borderColorHover=999999&fcHover=212121&iconColorHover=454545&bgColorActive=ffffff&bgTextureActive=02_glass.png&bgImgOpacityActive=65&borderColorActive=aaaaaa&fcActive=212121&iconColorActive=454545&bgColorHighlight=fbf9ee&bgTextureHighlight=02_glass.png&bgImgOpacityHighlight=55&borderColorHighlight=fcefa1&fcHighlight=363636&iconColorHighlight=2e83ff&bgColorError=fef1ec&bgTextureError=02_glass.png&bgImgOpacityError=95&borderColorError=cd0a0a&fcError=cd0a0a&iconColorError=cd0a0a&bgColorOverlay=ffffff&bgTextureOverlay=01_flat.png&bgImgOpacityOverlay=0&opacityOverlay=90&bgColorShadow=aaaaaa&bgTextureShadow=01_flat.png&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=8px
5
+ * Copyright (c) 2012 jQuery Foundation and other contributors Licensed MIT */
6
+
7
+ /* Layout helpers
8
+ ----------------------------------*/
9
+ .ui-helper-hidden { display: none; }
10
+ .ui-helper-hidden-accessible { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px,1px,1px,1px); }
11
+ .ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
12
+ .ui-helper-clearfix:before, .ui-helper-clearfix:after { content: ""; display: table; }
13
+ .ui-helper-clearfix:after { clear: both; }
14
+ .ui-helper-clearfix { zoom: 1; }
15
+ .ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
16
+
17
+
18
+ /* Interaction Cues
19
+ ----------------------------------*/
20
+ .ui-state-disabled { cursor: default !important; }
21
+
22
+
23
+ /* Icons
24
+ ----------------------------------*/
25
+
26
+ /* states and images */
27
+ .ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
28
+
29
+
30
+ /* Misc visuals
31
+ ----------------------------------*/
32
+
33
+ /* Overlays */
34
+ .ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
35
+ .ui-resizable { position: relative;}
36
+ .ui-resizable-handle { position: absolute;font-size: 0.1px; display: block; }
37
+ .ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; }
38
+ .ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; }
39
+ .ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; }
40
+ .ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0; height: 100%; }
41
+ .ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0; height: 100%; }
42
+ .ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; }
43
+ .ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; }
44
+ .ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; }
45
+ .ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}.ui-selectable-helper { position: absolute; z-index: 100; border:1px dotted black; }
46
+ .ui-accordion .ui-accordion-header { display: block; cursor: pointer; position: relative; margin-top: 2px; padding: .5em .5em .5em .7em; zoom: 1; }
47
+ .ui-accordion .ui-accordion-icons { padding-left: 2.2em; }
48
+ .ui-accordion .ui-accordion-noicons { padding-left: .7em; }
49
+ .ui-accordion .ui-accordion-icons .ui-accordion-icons { padding-left: 2.2em; }
50
+ .ui-accordion .ui-accordion-header .ui-accordion-header-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; }
51
+ .ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; overflow: auto; zoom: 1; }
52
+ .ui-autocomplete {
53
+ position: absolute;
54
+ top: 0; /* #8656 */
55
+ cursor: default;
56
+ }
57
+
58
+ /* workarounds */
59
+ * html .ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */
60
+ .ui-button { display: inline-block; position: relative; padding: 0; margin-right: .1em; cursor: pointer; text-align: center; zoom: 1; overflow: visible; } /* the overflow property removes extra width in IE */
61
+ .ui-button, .ui-button:link, .ui-button:visited, .ui-button:hover, .ui-button:active { text-decoration: none; }
62
+ .ui-button-icon-only { width: 2.2em; } /* to make room for the icon, a width needs to be set here */
63
+ button.ui-button-icon-only { width: 2.4em; } /* button elements seem to need a little more width */
64
+ .ui-button-icons-only { width: 3.4em; }
65
+ button.ui-button-icons-only { width: 3.7em; }
66
+
67
+ /*button text element */
68
+ .ui-button .ui-button-text { display: block; line-height: 1.4; }
69
+ .ui-button-text-only .ui-button-text { padding: .4em 1em; }
70
+ .ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { padding: .4em; text-indent: -9999999px; }
71
+ .ui-button-text-icon-primary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 1em .4em 2.1em; }
72
+ .ui-button-text-icon-secondary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 2.1em .4em 1em; }
73
+ .ui-button-text-icons .ui-button-text { padding-left: 2.1em; padding-right: 2.1em; }
74
+ /* no icon support for input elements, provide padding by default */
75
+ input.ui-button { padding: .4em 1em; }
76
+
77
+ /*button icon element(s) */
78
+ .ui-button-icon-only .ui-icon, .ui-button-text-icon-primary .ui-icon, .ui-button-text-icon-secondary .ui-icon, .ui-button-text-icons .ui-icon, .ui-button-icons-only .ui-icon { position: absolute; top: 50%; margin-top: -8px; }
79
+ .ui-button-icon-only .ui-icon { left: 50%; margin-left: -8px; }
80
+ .ui-button-text-icon-primary .ui-button-icon-primary, .ui-button-text-icons .ui-button-icon-primary, .ui-button-icons-only .ui-button-icon-primary { left: .5em; }
81
+ .ui-button-text-icon-secondary .ui-button-icon-secondary, .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
82
+ .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
83
+
84
+ /*button sets*/
85
+ .ui-buttonset { margin-right: 7px; }
86
+ .ui-buttonset .ui-button { margin-left: 0; margin-right: -.3em; }
87
+
88
+ /* workarounds */
89
+ button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra padding in Firefox */
90
+ .ui-datepicker { width: 17em; padding: .2em .2em 0; display: none; }
91
+ .ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; }
92
+ .ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; }
93
+ .ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; }
94
+ .ui-datepicker .ui-datepicker-prev { left:2px; }
95
+ .ui-datepicker .ui-datepicker-next { right:2px; }
96
+ .ui-datepicker .ui-datepicker-prev-hover { left:1px; }
97
+ .ui-datepicker .ui-datepicker-next-hover { right:1px; }
98
+ .ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; }
99
+ .ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; }
100
+ .ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; }
101
+ .ui-datepicker select.ui-datepicker-month-year {width: 100%;}
102
+ .ui-datepicker select.ui-datepicker-month,
103
+ .ui-datepicker select.ui-datepicker-year { width: 49%;}
104
+ .ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; }
105
+ .ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; }
106
+ .ui-datepicker td { border: 0; padding: 1px; }
107
+ .ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; }
108
+ .ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; }
109
+ .ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; }
110
+ .ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; }
111
+
112
+ /* with multiple calendars */
113
+ .ui-datepicker.ui-datepicker-multi { width:auto; }
114
+ .ui-datepicker-multi .ui-datepicker-group { float:left; }
115
+ .ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; }
116
+ .ui-datepicker-multi-2 .ui-datepicker-group { width:50%; }
117
+ .ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; }
118
+ .ui-datepicker-multi-4 .ui-datepicker-group { width:25%; }
119
+ .ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; }
120
+ .ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; }
121
+ .ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; }
122
+ .ui-datepicker-row-break { clear:both; width:100%; font-size:0em; }
123
+
124
+ /* RTL support */
125
+ .ui-datepicker-rtl { direction: rtl; }
126
+ .ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; }
127
+ .ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; }
128
+ .ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; }
129
+ .ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; }
130
+ .ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; }
131
+ .ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; }
132
+ .ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; }
133
+ .ui-datepicker-rtl .ui-datepicker-group { float:right; }
134
+ .ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
135
+ .ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
136
+
137
+ /* IE6 IFRAME FIX (taken from datepicker 1.5.3 */
138
+ .ui-datepicker-cover {
139
+ position: absolute; /*must have*/
140
+ z-index: -1; /*must have*/
141
+ filter: mask(); /*must have*/
142
+ top: -4px; /*must have*/
143
+ left: -4px; /*must have*/
144
+ width: 200px; /*must have*/
145
+ height: 200px; /*must have*/
146
+ }.ui-dialog { position: absolute; padding: .2em; width: 300px; overflow: hidden; }
147
+ .ui-dialog .ui-dialog-titlebar { padding: .4em 1em; position: relative; }
148
+ .ui-dialog .ui-dialog-title { float: left; margin: .1em 16px .1em 0; }
149
+ .ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; }
150
+ .ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; }
151
+ .ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; }
152
+ .ui-dialog .ui-dialog-content { position: relative; border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; }
153
+ .ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; }
154
+ .ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { float: right; }
155
+ .ui-dialog .ui-dialog-buttonpane button { margin: .5em .4em .5em 0; cursor: pointer; }
156
+ .ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; }
157
+ .ui-draggable .ui-dialog-titlebar { cursor: move; }
158
+ .ui-menu { list-style:none; padding: 2px; margin: 0; display:block; outline: none; }
159
+ .ui-menu .ui-menu { margin-top: -3px; position: absolute; }
160
+ .ui-menu .ui-menu-item { margin: 0; padding: 0; zoom: 1; width: 100%; }
161
+ .ui-menu .ui-menu-divider { margin: 5px -2px 5px -2px; height: 0; font-size: 0; line-height: 0; border-width: 1px 0 0 0; }
162
+ .ui-menu .ui-menu-item a { text-decoration: none; display: block; padding: 2px .4em; line-height: 1.5; zoom: 1; font-weight: normal; }
163
+ .ui-menu .ui-menu-item a.ui-state-focus,
164
+ .ui-menu .ui-menu-item a.ui-state-active { font-weight: normal; margin: -1px; }
165
+
166
+ .ui-menu .ui-state-disabled { font-weight: normal; margin: .4em 0 .2em; line-height: 1.5; }
167
+ .ui-menu .ui-state-disabled a { cursor: default; }
168
+
169
+ /* icon support */
170
+ .ui-menu-icons { position: relative; }
171
+ .ui-menu-icons .ui-menu-item a { position: relative; padding-left: 2em; }
172
+
173
+ /* left-aligned */
174
+ .ui-menu .ui-icon { position: absolute; top: .2em; left: .2em; }
175
+
176
+ /* right-aligned */
177
+ .ui-menu .ui-menu-icon { position: static; float: right; }
178
+ .ui-progressbar { height:2em; text-align: left; overflow: hidden; }
179
+ .ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; }.ui-slider { position: relative; text-align: left; }
180
+ .ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; }
181
+ .ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; }
182
+
183
+ .ui-slider-horizontal { height: .8em; }
184
+ .ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; }
185
+ .ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; }
186
+ .ui-slider-horizontal .ui-slider-range-min { left: 0; }
187
+ .ui-slider-horizontal .ui-slider-range-max { right: 0; }
188
+
189
+ .ui-slider-vertical { width: .8em; height: 100px; }
190
+ .ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; }
191
+ .ui-slider-vertical .ui-slider-range { left: 0; width: 100%; }
192
+ .ui-slider-vertical .ui-slider-range-min { bottom: 0; }
193
+ .ui-slider-vertical .ui-slider-range-max { top: 0; }.ui-spinner { position:relative; display: inline-block; overflow: hidden; padding: 0; vertical-align: middle; }
194
+ .ui-spinner-input { border: none; background: none; padding: 0; margin: .2em 0; vertical-align: middle; margin-left: .4em; margin-right: 22px; }
195
+ .ui-spinner-button { width: 16px; height: 50%; font-size: .5em; padding: 0; margin: 0; text-align: center; position: absolute; cursor: default; display: block; overflow: hidden; right: 0; }
196
+ .ui-spinner a.ui-spinner-button { border-top: none; border-bottom: none; border-right: none; } /* more specificity required here to overide default borders */
197
+ .ui-spinner .ui-icon { position: absolute; margin-top: -8px; top: 50%; left: 0; } /* vertical centre icon */
198
+ .ui-spinner-up { top: 0; }
199
+ .ui-spinner-down { bottom: 0; }
200
+
201
+ /* TR overrides */
202
+ .ui-spinner .ui-icon-triangle-1-s {
203
+ /* need to fix icons sprite */
204
+ background-position:-65px -16px;
205
+ }
206
+ .ui-tabs { position: relative; padding: .2em; zoom: 1; } /* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */
207
+ .ui-tabs .ui-tabs-nav { margin: 0; padding: .2em .2em 0; }
208
+ .ui-tabs .ui-tabs-nav li { list-style: none; float: left; position: relative; top: 0; margin: 1px .2em 0 0; border-bottom: 0; padding: 0; white-space: nowrap; }
209
+ .ui-tabs .ui-tabs-nav li a { float: left; padding: .5em 1em; text-decoration: none; }
210
+ .ui-tabs .ui-tabs-nav li.ui-tabs-active { margin-bottom: -1px; padding-bottom: 1px; }
211
+ .ui-tabs .ui-tabs-nav li.ui-tabs-active a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-tabs-loading a { cursor: text; }
212
+ .ui-tabs .ui-tabs-nav li a, .ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-active a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */
213
+ .ui-tabs .ui-tabs-panel { display: block; border-width: 0; padding: 1em 1.4em; background: none; }
214
+ .ui-tooltip {
215
+ padding: 8px;
216
+ position: absolute;
217
+ z-index: 9999;
218
+ max-width: 300px;
219
+ -webkit-box-shadow: 0 0 5px #aaa;
220
+ box-shadow: 0 0 5px #aaa;
221
+ }
222
+ /* Fades and background-images don't work well together in IE6, drop the image */
223
+ * html .ui-tooltip {
224
+ background-image: none;
225
+ }
226
+ body .ui-tooltip { border-width: 2px; }
227
+
228
+ /* Component containers
229
+ ----------------------------------*/
230
+ .ui-widget { font-family: Verdana,Arial,sans-serif; font-size: 1.1em; }
231
+ .ui-widget .ui-widget { font-size: 1em; }
232
+ .ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Verdana,Arial,sans-serif; font-size: 1em; }
233
+ .ui-widget-content { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_flat_75_ffffff_40x100.png) 50% 50% repeat-x; color: #222222; }
234
+ .ui-widget-content a { color: #222222; }
235
+ .ui-widget-header { border: 1px solid #aaaaaa; background: #cccccc url(images/ui-bg_diagonals-small_75_cccccc_40x40.png) 50% 50% repeat; color: #222222; font-weight: bold; }
236
+ .ui-widget-header a { color: #222222; }
237
+
238
+ /* Interaction states
239
+ ----------------------------------*/
240
+ .ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #d3d3d3; background: #e6e6e6 url(images/ui-bg_glass_75_e6e6e6_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #555555; }
241
+ .ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #555555; text-decoration: none; }
242
+ .ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #999999; background: #dadada url(images/ui-bg_glass_75_dadada_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; }
243
+ .ui-state-hover a, .ui-state-hover a:hover, .ui-state-hover a:link, .ui-state-hover a:visited { color: #212121; text-decoration: none; }
244
+ .ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; }
245
+ .ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #212121; text-decoration: none; }
246
+
247
+ /* Interaction Cues
248
+ ----------------------------------*/
249
+ .ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #fcefa1; background: #fbf9ee url(images/ui-bg_glass_55_fbf9ee_1x400.png) 50% 50% repeat-x; color: #363636; }
250
+ .ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636; }
251
+ .ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a; background: #fef1ec url(images/ui-bg_glass_95_fef1ec_1x400.png) 50% 50% repeat-x; color: #cd0a0a; }
252
+ .ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #cd0a0a; }
253
+ .ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #cd0a0a; }
254
+ .ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; }
255
+ .ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }
256
+ .ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; }
257
+ .ui-state-disabled .ui-icon { filter:Alpha(Opacity=35); } /* For IE8 - See #6059 */
258
+
259
+ /* Icons
260
+ ----------------------------------*/
261
+
262
+ /* states and images */
263
+ .ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_222222_256x240.png); }
264
+ .ui-widget-content .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); }
265
+ .ui-widget-header .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); }
266
+ .ui-state-default .ui-icon { background-image: url(images/ui-icons_888888_256x240.png); }
267
+ .ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_454545_256x240.png); }
268
+ .ui-state-active .ui-icon {background-image: url(images/ui-icons_454545_256x240.png); }
269
+ .ui-state-highlight .ui-icon {background-image: url(images/ui-icons_2e83ff_256x240.png); }
270
+ .ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_cd0a0a_256x240.png); }
271
+
272
+ /* positioning */
273
+ .ui-icon-carat-1-n { background-position: 0 0; }
274
+ .ui-icon-carat-1-ne { background-position: -16px 0; }
275
+ .ui-icon-carat-1-e { background-position: -32px 0; }
276
+ .ui-icon-carat-1-se { background-position: -48px 0; }
277
+ .ui-icon-carat-1-s { background-position: -64px 0; }
278
+ .ui-icon-carat-1-sw { background-position: -80px 0; }
279
+ .ui-icon-carat-1-w { background-position: -96px 0; }
280
+ .ui-icon-carat-1-nw { background-position: -112px 0; }
281
+ .ui-icon-carat-2-n-s { background-position: -128px 0; }
282
+ .ui-icon-carat-2-e-w { background-position: -144px 0; }
283
+ .ui-icon-triangle-1-n { background-position: 0 -16px; }
284
+ .ui-icon-triangle-1-ne { background-position: -16px -16px; }
285
+ .ui-icon-triangle-1-e { background-position: -32px -16px; }
286
+ .ui-icon-triangle-1-se { background-position: -48px -16px; }
287
+ .ui-icon-triangle-1-s { background-position: -64px -16px; }
288
+ .ui-icon-triangle-1-sw { background-position: -80px -16px; }
289
+ .ui-icon-triangle-1-w { background-position: -96px -16px; }
290
+ .ui-icon-triangle-1-nw { background-position: -112px -16px; }
291
+ .ui-icon-triangle-2-n-s { background-position: -128px -16px; }
292
+ .ui-icon-triangle-2-e-w { background-position: -144px -16px; }
293
+ .ui-icon-arrow-1-n { background-position: 0 -32px; }
294
+ .ui-icon-arrow-1-ne { background-position: -16px -32px; }
295
+ .ui-icon-arrow-1-e { background-position: -32px -32px; }
296
+ .ui-icon-arrow-1-se { background-position: -48px -32px; }
297
+ .ui-icon-arrow-1-s { background-position: -64px -32px; }
298
+ .ui-icon-arrow-1-sw { background-position: -80px -32px; }
299
+ .ui-icon-arrow-1-w { background-position: -96px -32px; }
300
+ .ui-icon-arrow-1-nw { background-position: -112px -32px; }
301
+ .ui-icon-arrow-2-n-s { background-position: -128px -32px; }
302
+ .ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
303
+ .ui-icon-arrow-2-e-w { background-position: -160px -32px; }
304
+ .ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
305
+ .ui-icon-arrowstop-1-n { background-position: -192px -32px; }
306
+ .ui-icon-arrowstop-1-e { background-position: -208px -32px; }
307
+ .ui-icon-arrowstop-1-s { background-position: -224px -32px; }
308
+ .ui-icon-arrowstop-1-w { background-position: -240px -32px; }
309
+ .ui-icon-arrowthick-1-n { background-position: 0 -48px; }
310
+ .ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
311
+ .ui-icon-arrowthick-1-e { background-position: -32px -48px; }
312
+ .ui-icon-arrowthick-1-se { background-position: -48px -48px; }
313
+ .ui-icon-arrowthick-1-s { background-position: -64px -48px; }
314
+ .ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
315
+ .ui-icon-arrowthick-1-w { background-position: -96px -48px; }
316
+ .ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
317
+ .ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
318
+ .ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
319
+ .ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
320
+ .ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
321
+ .ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
322
+ .ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
323
+ .ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
324
+ .ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
325
+ .ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
326
+ .ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
327
+ .ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
328
+ .ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
329
+ .ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
330
+ .ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
331
+ .ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
332
+ .ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
333
+ .ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
334
+ .ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
335
+ .ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
336
+ .ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
337
+ .ui-icon-arrow-4 { background-position: 0 -80px; }
338
+ .ui-icon-arrow-4-diag { background-position: -16px -80px; }
339
+ .ui-icon-extlink { background-position: -32px -80px; }
340
+ .ui-icon-newwin { background-position: -48px -80px; }
341
+ .ui-icon-refresh { background-position: -64px -80px; }
342
+ .ui-icon-shuffle { background-position: -80px -80px; }
343
+ .ui-icon-transfer-e-w { background-position: -96px -80px; }
344
+ .ui-icon-transferthick-e-w { background-position: -112px -80px; }
345
+ .ui-icon-folder-collapsed { background-position: 0 -96px; }
346
+ .ui-icon-folder-open { background-position: -16px -96px; }
347
+ .ui-icon-document { background-position: -32px -96px; }
348
+ .ui-icon-document-b { background-position: -48px -96px; }
349
+ .ui-icon-note { background-position: -64px -96px; }
350
+ .ui-icon-mail-closed { background-position: -80px -96px; }
351
+ .ui-icon-mail-open { background-position: -96px -96px; }
352
+ .ui-icon-suitcase { background-position: -112px -96px; }
353
+ .ui-icon-comment { background-position: -128px -96px; }
354
+ .ui-icon-person { background-position: -144px -96px; }
355
+ .ui-icon-print { background-position: -160px -96px; }
356
+ .ui-icon-trash { background-position: -176px -96px; }
357
+ .ui-icon-locked { background-position: -192px -96px; }
358
+ .ui-icon-unlocked { background-position: -208px -96px; }
359
+ .ui-icon-bookmark { background-position: -224px -96px; }
360
+ .ui-icon-tag { background-position: -240px -96px; }
361
+ .ui-icon-home { background-position: 0 -112px; }
362
+ .ui-icon-flag { background-position: -16px -112px; }
363
+ .ui-icon-calendar { background-position: -32px -112px; }
364
+ .ui-icon-cart { background-position: -48px -112px; }
365
+ .ui-icon-pencil { background-position: -64px -112px; }
366
+ .ui-icon-clock { background-position: -80px -112px; }
367
+ .ui-icon-disk { background-position: -96px -112px; }
368
+ .ui-icon-calculator { background-position: -112px -112px; }
369
+ .ui-icon-zoomin { background-position: -128px -112px; }
370
+ .ui-icon-zoomout { background-position: -144px -112px; }
371
+ .ui-icon-search { background-position: -160px -112px; }
372
+ .ui-icon-wrench { background-position: -176px -112px; }
373
+ .ui-icon-gear { background-position: -192px -112px; }
374
+ .ui-icon-heart { background-position: -208px -112px; }
375
+ .ui-icon-star { background-position: -224px -112px; }
376
+ .ui-icon-link { background-position: -240px -112px; }
377
+ .ui-icon-cancel { background-position: 0 -128px; }
378
+ .ui-icon-plus { background-position: -16px -128px; }
379
+ .ui-icon-plusthick { background-position: -32px -128px; }
380
+ .ui-icon-minus { background-position: -48px -128px; }
381
+ .ui-icon-minusthick { background-position: -64px -128px; }
382
+ .ui-icon-close { background-position: -80px -128px; }
383
+ .ui-icon-closethick { background-position: -96px -128px; }
384
+ .ui-icon-key { background-position: -112px -128px; }
385
+ .ui-icon-lightbulb { background-position: -128px -128px; }
386
+ .ui-icon-scissors { background-position: -144px -128px; }
387
+ .ui-icon-clipboard { background-position: -160px -128px; }
388
+ .ui-icon-copy { background-position: -176px -128px; }
389
+ .ui-icon-contact { background-position: -192px -128px; }
390
+ .ui-icon-image { background-position: -208px -128px; }
391
+ .ui-icon-video { background-position: -224px -128px; }
392
+ .ui-icon-script { background-position: -240px -128px; }
393
+ .ui-icon-alert { background-position: 0 -144px; }
394
+ .ui-icon-info { background-position: -16px -144px; }
395
+ .ui-icon-notice { background-position: -32px -144px; }
396
+ .ui-icon-help { background-position: -48px -144px; }
397
+ .ui-icon-check { background-position: -64px -144px; }
398
+ .ui-icon-bullet { background-position: -80px -144px; }
399
+ .ui-icon-radio-on { background-position: -96px -144px; }
400
+ .ui-icon-radio-off { background-position: -112px -144px; }
401
+ .ui-icon-pin-w { background-position: -128px -144px; }
402
+ .ui-icon-pin-s { background-position: -144px -144px; }
403
+ .ui-icon-play { background-position: 0 -160px; }
404
+ .ui-icon-pause { background-position: -16px -160px; }
405
+ .ui-icon-seek-next { background-position: -32px -160px; }
406
+ .ui-icon-seek-prev { background-position: -48px -160px; }
407
+ .ui-icon-seek-end { background-position: -64px -160px; }
408
+ .ui-icon-seek-start { background-position: -80px -160px; }
409
+ /* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */
410
+ .ui-icon-seek-first { background-position: -80px -160px; }
411
+ .ui-icon-stop { background-position: -96px -160px; }
412
+ .ui-icon-eject { background-position: -112px -160px; }
413
+ .ui-icon-volume-off { background-position: -128px -160px; }
414
+ .ui-icon-volume-on { background-position: -144px -160px; }
415
+ .ui-icon-power { background-position: 0 -176px; }
416
+ .ui-icon-signal-diag { background-position: -16px -176px; }
417
+ .ui-icon-signal { background-position: -32px -176px; }
418
+ .ui-icon-battery-0 { background-position: -48px -176px; }
419
+ .ui-icon-battery-1 { background-position: -64px -176px; }
420
+ .ui-icon-battery-2 { background-position: -80px -176px; }
421
+ .ui-icon-battery-3 { background-position: -96px -176px; }
422
+ .ui-icon-circle-plus { background-position: 0 -192px; }
423
+ .ui-icon-circle-minus { background-position: -16px -192px; }
424
+ .ui-icon-circle-close { background-position: -32px -192px; }
425
+ .ui-icon-circle-triangle-e { background-position: -48px -192px; }
426
+ .ui-icon-circle-triangle-s { background-position: -64px -192px; }
427
+ .ui-icon-circle-triangle-w { background-position: -80px -192px; }
428
+ .ui-icon-circle-triangle-n { background-position: -96px -192px; }
429
+ .ui-icon-circle-arrow-e { background-position: -112px -192px; }
430
+ .ui-icon-circle-arrow-s { background-position: -128px -192px; }
431
+ .ui-icon-circle-arrow-w { background-position: -144px -192px; }
432
+ .ui-icon-circle-arrow-n { background-position: -160px -192px; }
433
+ .ui-icon-circle-zoomin { background-position: -176px -192px; }
434
+ .ui-icon-circle-zoomout { background-position: -192px -192px; }
435
+ .ui-icon-circle-check { background-position: -208px -192px; }
436
+ .ui-icon-circlesmall-plus { background-position: 0 -208px; }
437
+ .ui-icon-circlesmall-minus { background-position: -16px -208px; }
438
+ .ui-icon-circlesmall-close { background-position: -32px -208px; }
439
+ .ui-icon-squaresmall-plus { background-position: -48px -208px; }
440
+ .ui-icon-squaresmall-minus { background-position: -64px -208px; }
441
+ .ui-icon-squaresmall-close { background-position: -80px -208px; }
442
+ .ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
443
+ .ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
444
+ .ui-icon-grip-solid-vertical { background-position: -32px -224px; }
445
+ .ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
446
+ .ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
447
+ .ui-icon-grip-diagonal-se { background-position: -80px -224px; }
448
+
449
+
450
+ /* Misc visuals
451
+ ----------------------------------*/
452
+
453
+ /* Corner radius */
454
+ .ui-corner-all, .ui-corner-top, .ui-corner-left, .ui-corner-tl { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; -khtml-border-top-left-radius: 4px; border-top-left-radius: 4px; }
455
+ .ui-corner-all, .ui-corner-top, .ui-corner-right, .ui-corner-tr { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; -khtml-border-top-right-radius: 4px; border-top-right-radius: 4px; }
456
+ .ui-corner-all, .ui-corner-bottom, .ui-corner-left, .ui-corner-bl { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; -khtml-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; }
457
+ .ui-corner-all, .ui-corner-bottom, .ui-corner-right, .ui-corner-br { -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; -khtml-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; }
458
+
459
+ /* Overlays */
460
+ .ui-widget-overlay { background: #ffffff url(images/ui-bg_flat_0_ffffff_40x100.png) 50% 50% repeat-x; opacity: .9;filter:Alpha(Opacity=90); }
461
+ .ui-widget-shadow { margin: -8px 0 0 -8px; padding: 8px; background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .3;filter:Alpha(Opacity=30); -moz-border-radius: 8px; -khtml-border-radius: 8px; -webkit-border-radius: 8px; border-radius: 8px; }
assets/css/jquery.smallipop.css ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* smallipop css */
2
+ .smallipopHint { display: none; }
3
+
4
+ .smallipop-instance { position: absolute; display: none; top: 0; left: 0; background-color: #314b64; border: 1px solid #0f161e; color: #d2dfe7; z-index: 9999; max-width: 400px; }
5
+ .smallipop-instance font { size: 11px; family: arial; }
6
+ .smallipop-instance a { color: #98cbea; }
7
+ .smallipop-instance .sipContent { padding: 10px; }
8
+ .smallipop-instance .sipArrow, .smallipop-instance .sipArrowBorder { position: absolute; left: 50%; height: 0; width: 0; }
9
+ .smallipop-instance .sipArrow { bottom: -20px; margin-left: -10px; border: 10px solid transparent; }
10
+ .smallipop-instance .sipArrowBorder { bottom: -24px; margin-left: -12px; border: 12px solid transparent; }
11
+ .smallipop-instance.sipAlignLeft .sipArrow { margin-left: 0; left: auto; right: 20px; }
12
+ .smallipop-instance.sipAlignLeft .sipArrowBorder { margin-left: 0; left: auto; right: 18px; }
13
+ .smallipop-instance.sipAlignRight .sipArrow { margin-left: 0; left: 20px; right: auto; }
14
+ .smallipop-instance.sipAlignRight .sipArrowBorder { margin-left: 0; left: 18px; right: auto; }
15
+ .smallipop-instance.sipAlignBottom .sipArrow { bottom: auto; top: -20px; }
16
+ .smallipop-instance.sipAlignBottom .sipArrowBorder { bottom: auto; top: -24px; }
17
+ .smallipop-instance.sipPositionedLeft .sipArrow, .smallipop-instance.sipPositionedLeft .sipArrowBorder { right: -16px; left: auto; top: 50%; bottom: auto; border-width: 8px; margin: -8px 0 0; }
18
+ .smallipop-instance.sipPositionedLeft .sipArrowBorder { right: -20px; border-width: 10px; margin: -10px 0 0; }
19
+ .smallipop-instance.sipPositionedRight .sipArrow, .smallipop-instance.sipPositionedRight .sipArrowBorder { left: -16px; right: auto; top: 50%; bottom: auto; border-width: 8px; margin: -8px 0 0; }
20
+ .smallipop-instance.sipPositionedRight .sipArrowBorder { left: -20px; border-width: 10px; margin: -10px 0 0; }
21
+ .smallipop-instance .smallipop-tour-content { padding: 5px 0; min-width: 150px; }
22
+ .smallipop-instance .smallipop-tour-footer { padding-top: 5px; position: relative; }
23
+ .smallipop-instance .smallipop-tour-progress { color: #bbb; text-align: center; position: absolute; left: 50%; width: 80px; margin-left: -40px; top: 8px; }
24
+ .smallipop-instance .smallipop-tour-close-icon { position: absolute; right: -8px; top: -8px; width: 16px; height: 16px; padding-top: 0px; font-size: 11px; background: #555; color: #ccc; text-align: center; text-shadow: 0 -1px 1px #666666; border-radius: 8px; -o-border-radius: 8px; -moz-border-radius: 8px; -webkit-border-radius: 8px; -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); -moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); }
25
+ .smallipop-instance .smallipop-tour-close-icon:hover { text-decoration: none; background: #666; color: #fff; }
26
+ .smallipop-instance .smallipop-tour-prev, .smallipop-instance .smallipop-tour-next, .smallipop-instance .smallipop-tour-close { color: #ccc; display: block; padding: 3px 4px 2px; line-height: 1em; float: left; background: #203142; border-radius: 3px; -o-border-radius: 3px; -moz-border-radius: 3px; -webkit-border-radius: 3px; -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); -moz-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); }
27
+ .smallipop-instance .smallipop-tour-prev:hover, .smallipop-instance .smallipop-tour-next:hover, .smallipop-instance .smallipop-tour-close:hover { color: #fff; background: #293e53; text-decoration: none; }
28
+ .smallipop-instance .smallipop-tour-next, .smallipop-instance .smallipop-tour-close { float: right; }
29
+
30
+ /* default theme */
31
+ .smallipop-instance.default { text-shadow: 0 -1px 1px #0f161e; -webkit-box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5); -moz-box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5); border-radius: 12px; -o-border-radius: 12px; -moz-border-radius: 12px; -webkit-border-radius: 12px; background-repeat: repeat-x; background-image: -webkit-linear-gradient(top, rgba(49, 75, 100, 0.9), rgba(26, 38, 52, 0.9)); background-image: -moz-linear-gradient(top, rgba(49, 75, 100, 0.9), rgba(26, 38, 52, 0.9)); background-image: -ms-linear-gradient(top, rgba(49, 75, 100, 0.9), rgba(26, 38, 52, 0.9)); background-image: -o-linear-gradient(top, rgba(49, 75, 100, 0.9), rgba(26, 38, 52, 0.9)); background-image: linear-gradient(top, rgba(49, 75, 100, 0.9), rgba(26, 38, 52, 0.9)); /* Fallback for opera */ background-image: -webkit-radial-gradient(50% -100px, circle contain, rgba(49, 75, 100, 0.9) 100px, rgba(33, 50, 66, 0.9) 130px, rgba(26, 38, 52, 0.9) 150px); background-image: -moz-radial-gradient(50% -100px, circle contain, rgba(49, 75, 100, 0.9) 100px, rgba(33, 50, 66, 0.9) 130px, rgba(26, 38, 52, 0.9) 150px); background-image: -ms-radial-gradient(50% -100px, circle contain, rgba(49, 75, 100, 0.9) 100px, rgba(33, 50, 66, 0.9) 130px, rgba(26, 38, 52, 0.9) 150px); background-image: -o-radial-gradient(50% -100px, circle contain, rgba(49, 75, 100, 0.9) 100px, rgba(33, 50, 66, 0.9) 130px, rgba(26, 38, 52, 0.9) 150px); background-image: radial-gradient(50% -100px, circle contain, rgba(49, 75, 100, 0.9) 100px, rgba(33, 50, 66, 0.9) 130px, rgba(26, 38, 52, 0.9) 150px); }
32
+ .smallipop-instance.default a { text-shadow: 0 -1px 1px #0f161e; }
33
+ .smallipop-instance.default .sipContent { border-top: 1px solid #586d82; border-radius: 12px; -o-border-radius: 12px; -moz-border-radius: 12px; -webkit-border-radius: 12px; }
34
+ .smallipop-instance.default .sipArrow { border-color: #1a2634 transparent transparent transparent; }
35
+ .smallipop-instance.default .sipArrowBorder { border-color: #0f161e transparent transparent transparent; }
36
+ .smallipop-instance.default.sipAlignBottom .sipArrow { border-color: transparent transparent #1a2634 transparent; }
37
+ .smallipop-instance.default.sipAlignBottom .sipArrowBorder { border-color: transparent transparent #0f161e transparent; }
38
+ .smallipop-instance.default.sipPositionedLeft .sipArrow { border-color: transparent transparent transparent #1a2634; }
39
+ .smallipop-instance.default.sipPositionedLeft .sipArrowBorder { border-color: transparent transparent transparent #0f161e; }
40
+ .smallipop-instance.default.sipPositionedRight .sipArrow { border-color: transparent #1a2634 transparent transparent; }
41
+ .smallipop-instance.default.sipPositionedRight .sipArrowBorder { border-color: transparent #0f161e transparent transparent; }
42
+
43
+ .cssgradients.rgba .smallipop-instance.default { background-color: transparent; }
44
+
45
+ /* blue theme */
46
+ .smallipop-instance.blue { background: transparent; color: #111; border: 10px solid #0064b4; border-color: rgba(0, 100, 180, 0.9); -webkit-box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5); -moz-box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5); border-radius: 7px; -o-border-radius: 7px; -moz-border-radius: 7px; -webkit-border-radius: 7px; }
47
+ .smallipop-instance.blue a { color: #2276aa; }
48
+ .smallipop-instance.blue .sipContent { border: 0; background: #fcfcfc; }
49
+ .smallipop-instance.blue .sipArrow { bottom: -30px; border-color: #0064b4 transparent transparent transparent; border-color: rgba(0, 100, 180, 0.9) transparent transparent transparent; }
50
+ .smallipop-instance.blue.sipAlignBottom .sipArrow { top: -30px; border-color: transparent transparent #0064b4 transparent; border-color: transparent transparent rgba(0, 100, 180, 0.9) transparent; }
51
+ .smallipop-instance.blue.sipPositionedLeft .sipArrow { right: -26px; border-color: transparent transparent transparent #0064b4; border-color: transparent transparent transparent rgba(0, 100, 180, 0.9); }
52
+ .smallipop-instance.blue.sipPositionedRight .sipArrow { left: -26px; border-color: transparent #0064b4 transparent transparent; border-color: transparent rgba(0, 100, 180, 0.9) transparent transparent; }
53
+ .smallipop-instance.blue .smallipop-tour-progress { color: #777; }
54
+ .smallipop-instance.blue .smallipop-tour-prev, .smallipop-instance.blue .smallipop-tour-next, .smallipop-instance.blue .smallipop-tour-close { color: #222; background: #efefef; }
55
+ .smallipop-instance.blue .smallipop-tour-prev:hover, .smallipop-instance.blue .smallipop-tour-next:hover, .smallipop-instance.blue .smallipop-tour-close:hover { color: #111; background: #f7f7f7; }
56
+
57
+ /* black theme */
58
+ .smallipop-instance.black { background-color: #222; border-color: #111; text-shadow: 0 -1px 1px #111111; color: #f5f5f5; -webkit-box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5); -moz-box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5); background-repeat: repeat-x; background-image: -webkit-linear-gradient(top, #333333, #222222); background-image: -moz-linear-gradient(top, #333333, #222222); background-image: -ms-linear-gradient(top, #333333, #222222); background-image: -o-linear-gradient(top, #333333, #222222); background-image: linear-gradient(top, #333333, #222222); border-radius: 5px; -o-border-radius: 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px; }
59
+ .smallipop-instance.black a { color: #eef8ff; text-shadow: 0 -1px 1px #111111; }
60
+ .smallipop-instance.black .sipContent { border-top: 1px solid #666; border-radius: 5px; -o-border-radius: 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px; }
61
+ .smallipop-instance.black .sipArrow { border-color: #222 transparent transparent transparent; }
62
+ .smallipop-instance.black .sipArrowBorder { border-color: #111 transparent transparent transparent; }
63
+ .smallipop-instance.black.sipAlignBottom .sipArrow { border-color: transparent transparent #222 transparent; }
64
+ .smallipop-instance.black.sipAlignBottom .sipArrowBorder { border-color: transparent transparent #111 transparent; }
65
+ .smallipop-instance.black.sipPositionedLeft .sipArrow { border-color: transparent transparent transparent #222; }
66
+ .smallipop-instance.black.sipPositionedLeft .sipArrowBorder { border-color: transparent transparent transparent #111; }
67
+ .smallipop-instance.black.sipPositionedRight .sipArrow { border-color: transparent #222 transparent transparent; }
68
+ .smallipop-instance.black.sipPositionedRight .sipArrowBorder { border-color: transparent #111 transparent transparent; }
69
+ .smallipop-instance.black .smallipop-tour-progress { color: #888; }
70
+ .smallipop-instance.black .smallipop-tour-prev, .smallipop-instance.black .smallipop-tour-next, .smallipop-instance.black .smallipop-tour-close { color: #ccc; background: #333; }
71
+ .smallipop-instance.black .smallipop-tour-prev:hover, .smallipop-instance.black .smallipop-tour-next:hover, .smallipop-instance.black .smallipop-tour-close:hover { color: #fff; background: #3a3a3a; }
72
+
73
+ .cssgradients .smallipop-instance.black { background-color: transparent; }
74
+
75
+ /* orange theme */
76
+ .smallipop-instance.orange { background-color: #f9aa18; border-color: #e17500; text-shadow: 0 1px 1px #fff24d; color: #714900; background-repeat: repeat-x; background-image: -webkit-linear-gradient(top, #fff24d, #f9aa18); background-image: -moz-linear-gradient(top, #fff24d, #f9aa18); background-image: -ms-linear-gradient(top, #fff24d, #f9aa18); background-image: -o-linear-gradient(top, #fff24d, #f9aa18); background-image: linear-gradient(top, #fff24d, #f9aa18); -webkit-box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5); -moz-box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5); border-radius: 10px; -o-border-radius: 10px; -moz-border-radius: 10px; -webkit-border-radius: 10px; }
77
+ .smallipop-instance.orange a { color: #145d95; text-shadow: 0 1px 1px #fff24d; }
78
+ .smallipop-instance.orange .sipContent { border-top: 1px solid #fffabc; border-radius: 10px; -o-border-radius: 10px; -moz-border-radius: 10px; -webkit-border-radius: 10px; }
79
+ .smallipop-instance.orange .sipArrow { border-color: #f9aa18 transparent transparent transparent; }
80
+ .smallipop-instance.orange .sipArrowBorder { border-color: #e17500 transparent transparent transparent; }
81
+ .smallipop-instance.orange.sipAlignBottom .sipArrow { border-color: transparent transparent #f9aa18 transparent; }
82
+ .smallipop-instance.orange.sipAlignBottom .sipArrowBorder { border-color: transparent transparent #e17500 transparent; }
83
+ .smallipop-instance.orange.sipPositionedLeft .sipArrow { border-color: transparent transparent transparent #f9c718; }
84
+ .smallipop-instance.orange.sipPositionedLeft .sipArrowBorder { border-color: transparent transparent transparent #e17500; }
85
+ .smallipop-instance.orange.sipPositionedRight .sipArrow { border-color: transparent #f9c718 transparent transparent; }
86
+ .smallipop-instance.orange.sipPositionedRight .sipArrowBorder { border-color: transparent #e17500 transparent transparent; }
87
+ .smallipop-instance.orange .smallipop-tour-progress { color: #444; }
88
+ .smallipop-instance.orange .smallipop-tour-prev, .smallipop-instance.orange .smallipop-tour-next, .smallipop-instance.orange .smallipop-tour-close { color: #444; background: #f19f06; }
89
+ .smallipop-instance.orange .smallipop-tour-prev:hover, .smallipop-instance.orange .smallipop-tour-next:hover, .smallipop-instance.orange .smallipop-tour-close:hover { color: #333; background: #f9a509; }
90
+
91
+ /* white theme */
92
+ .smallipop-instance.white { background-color: #fcfcfc; border-color: #ccc; text-shadow: 0 1px 1px #eee; color: #444; width: 200px; max-width: 200px; -webkit-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1); -moz-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1); border-radius: 6px; -o-border-radius: 6px; -moz-border-radius: 6px; -webkit-border-radius: 6px; }
93
+ .smallipop-instance.white .sipContent { text-align: center; border-radius: 6px; -o-border-radius: 6px; -moz-border-radius: 6px; -webkit-border-radius: 6px; }
94
+ .smallipop-instance.white .sipArrow { border-color: #fcfcfc transparent transparent transparent; }
95
+ .smallipop-instance.white .sipArrowBorder { border-color: #ccc transparent transparent transparent; }
96
+ .smallipop-instance.white.sipAlignBottom .sipArrow { border-color: transparent transparent #fcfcfc transparent; }
97
+ .smallipop-instance.white.sipAlignBottom .sipArrowBorder { border-color: transparent transparent #ccc transparent; }
98
+ .smallipop-instance.white.sipPositionedLeft .sipArrow { border-color: transparent transparent transparent #fcfcfc; }
99
+ .smallipop-instance.white.sipPositionedLeft .sipArrowBorder { border-color: transparent transparent transparent #ccc; }
100
+ .smallipop-instance.white.sipPositionedRight .sipArrow { border-color: transparent #fcfcfc transparent transparent; }
101
+ .smallipop-instance.white.sipPositionedRight .sipArrowBorder { border-color: transparent #ccc transparent transparent; }
102
+ .smallipop-instance.white .smallipop-tour-progress { color: #777; }
103
+ .smallipop-instance.white .smallipop-tour-close-icon { background: #fafafa; color: #555; text-shadow: 0 1px 1px #fff; }
104
+ .smallipop-instance.white .smallipop-tour-close-icon:hover { background: #f5f5f5; color: #222; }
105
+ .smallipop-instance.white .smallipop-tour-prev, .smallipop-instance.white .smallipop-tour-next, .smallipop-instance.white .smallipop-tour-close { color: #666; background: #f0f0f0; }
106
+ .smallipop-instance.white .smallipop-tour-prev:hover, .smallipop-instance.white .smallipop-tour-next:hover, .smallipop-instance.white .smallipop-tour-close:hover { color: #333; background: #f4f4f4; }
107
+
108
+ /* white theme extended, requires rgba support */
109
+ .smallipop-instance.whiteTransparent { background-color: rgba(255, 255, 255, 0.8); }
110
+ .smallipop-instance.whiteTransparent .sipArrow { bottom: -21px; border-color: rgba(255, 255, 255, 0.8) transparent transparent transparent; }
111
+ .smallipop-instance.whiteTransparent .sipArrowBorder { border-color: transparent; }
112
+ .smallipop-instance.whiteTransparent.sipAlignBottom .sipArrow { top: -21px; border-color: transparent transparent rgba(255, 255, 255, 0.8) transparent; }
113
+ .smallipop-instance.whiteTransparent.sipPositionedLeft .sipArrow { border-color: transparent transparent transparent rgba(255, 255, 255, 0.8); }
114
+ .smallipop-instance.whiteTransparent.sipPositionedRight .sipArrow { border-color: transparent rgba(255, 255, 255, 0.8) transparent transparent; }
115
+
116
+ /* fat shadow extension theme */
117
+ .smallipop-instance.fatShadow { -webkit-box-shadow: 0 2px 20px rgba(0, 0, 0, 0.8); -moz-box-shadow: 0 2px 20px rgba(0, 0, 0, 0.8); box-shadow: 0 2px 20px rgba(0, 0, 0, 0.8); }
assets/css/wpuf.css ADDED
@@ -0,0 +1,467 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .wpuf-post-form{
2
+ list-style: none;
3
+ margin: 0;
4
+ padding: 0;
5
+ }
6
+ .wpuf-post-form li{
7
+ margin: 5px 0;
8
+ padding: 0;
9
+ }
10
+
11
+ .wpuf-post-form label {
12
+ float: left;
13
+ font-weight: bold;
14
+ height: 20px;
15
+ margin: 0;
16
+ min-width: 130px;
17
+ padding: 0 10px 0 0;
18
+ font-size: 12px;
19
+ cursor: pointer;
20
+ }
21
+
22
+ .wpuf-post-form input, .wpuf-post-form textarea, .wpuf-post-form select{
23
+ margin: 0;
24
+ padding: 5px;
25
+ border: 1px solid #ccc;
26
+ font-size: 12px;
27
+ -moz-border-radius: 5px;
28
+ border-radius: 5px;
29
+ }
30
+
31
+ .wpuf-post-form input:focus, .wpuf-post-form textarea:focus, .wpuf-post-form select:focus{
32
+ background: #F2F2F2;
33
+ }
34
+
35
+ .wpuf-post-form .childCategory {
36
+ padding-top: 5px;
37
+ }
38
+
39
+ .wpuf-post-form input[type=text]{
40
+ width: 50%;
41
+ }
42
+
43
+ .wpuf-post-form textarea{
44
+ width: 70%;
45
+ }
46
+
47
+ .wpuf-post-form .wpuf-check-container {
48
+ float: left;
49
+ width: 70%;
50
+ }
51
+
52
+ .wpuf-post-form input[type=submit], .wpuf-submit, .wpuf-button{
53
+ -moz-border-radius: 5px;
54
+ border-radius: 5px;
55
+ color: #333;
56
+ padding: 5px 10px;
57
+ border: 1px solid #ccc;
58
+ text-shadow: 0 1px 0 #FFFFFF;
59
+ background: #eeeeee; /* old browsers */
60
+ background: -moz-linear-gradient(top, #eeeeee 0%, #cccccc 100%); /* firefox */
61
+ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#eeeeee), color-stop(100%,#cccccc)); /* webkit */
62
+ cursor: pointer;
63
+ }
64
+
65
+ .wpuf-post-form input[type=submit]:active, .wpuf-submit:active, .wpuf-button:active{
66
+ background: #ddd;
67
+ }
68
+
69
+ .wpuf-post-form input[type=submit]:hover, .wpuf-submit:hover, .wpuf-button:hover{
70
+ background: #ddd; /* old browsers */
71
+ background: -moz-linear-gradient(top, #cccccc 0%, #eeeeee 100%); /* firefox */
72
+ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#cccccc), color-stop(100%,#eeeeee)); /* webkit */
73
+ }
74
+
75
+ .wpuf-post-form p.description {
76
+ color: #868686;
77
+ margin: 0;
78
+ padding: 3px 0 3px 140px;
79
+ font-size: 12px;
80
+ }
81
+
82
+ .wpuf-post-form #wp-new-post-desc-wrap tr td {
83
+ padding: 0;
84
+ }
85
+
86
+ .clear{
87
+ clear:both;
88
+ height:0;
89
+ font-size: 1px;
90
+ line-height: 0px;
91
+ }
92
+
93
+ .success {
94
+ background-color: #DFF2BF;
95
+ border: 1px solid #BCDF7D;
96
+ color: #4F8A10;
97
+ padding: 10px;
98
+ font-size: 13px;
99
+ font-weight: bold;
100
+ margin-bottom: 10px;
101
+ -moz-border-radius: 5px;
102
+ -webkit-border-radius: 5px;
103
+ border-radius: 5px;
104
+ text-shadow: 0 1px 0 #FFFFFF;
105
+ font-size: 13px;
106
+ }
107
+
108
+
109
+ .error {
110
+ margin: 0 10px 10px 10px;
111
+ padding: 3px 10px;
112
+ color: #D8000C;
113
+ background-color: #FFBABA;
114
+ border: solid 1px #dd3c10;
115
+ border-radius: 5px;
116
+ -moz-border-radius: 5px;
117
+ -webkit-border-radius: 5px;
118
+ font-weight: bold;
119
+ text-shadow: 0 1px 0 #FFFFFF;
120
+ font-size: 13px;
121
+ }
122
+
123
+ .info {
124
+ background-color: #fef5be;
125
+ border: 2px solid #fdd425;
126
+ border-radius: 5px;
127
+ -moz-border-radius: 5px;
128
+ -webkit-border-radius: 5px;
129
+ padding: 5px 10px;
130
+ margin: 0 0 10px 0;
131
+ font-size: 13px;
132
+ }
133
+
134
+ #content .wpuf-profile table, .wpuf-profile table{
135
+ border: none;
136
+ }
137
+
138
+ #content .wpuf-profile legend, .wpuf-profile legend{
139
+ border: 1px solid #eee;
140
+ padding: 5px 10px;
141
+ }
142
+
143
+ #content .wpuf-profile th, #content .wpuf-profile td, .wpuf-profile th, .wpuf-profile td{
144
+ vertical-align: top;
145
+ border-top: 1px solid #eee;
146
+ border: none;
147
+ }
148
+
149
+ #content .wpuf-profile input, .wpuf-profile input, .wpuf-profile textarea{
150
+ border: 1px solid #CCCCCC;
151
+ margin: 0;
152
+ padding: 5px;
153
+ }
154
+
155
+ .wpuf-profile h3, #content .wpuf-profile h3{
156
+ margin: 0;
157
+ }
158
+
159
+ .wpuf-profile table, #content .wpuf-profile table{
160
+ margin: 0 0 5px 0;
161
+ }
162
+
163
+ #content #editorcontainer tr td, #content #editorcontainer table {
164
+ padding: 0;
165
+ margin: 0;
166
+ }
167
+
168
+ #wpuf-post-area li{
169
+ list-style: none;
170
+ }
171
+
172
+ span.required {
173
+ color: red;
174
+ }
175
+
176
+ table.wpuf-table {
177
+ border: 1px solid #E7E7E7;
178
+ margin: 0 opx 10px 0;
179
+ text-align: left;
180
+ width: 100%;
181
+ }
182
+
183
+ table.wpuf-table thead th, table.wpuf-table th {
184
+ color: #888888;
185
+ font-size: 12px;
186
+ font-weight: bold;
187
+ line-height: 18px;
188
+ padding: 9px 24px;
189
+ }
190
+
191
+ table.wpuf-table td {
192
+ border-top: 1px solid #E7E7E7;
193
+ padding: 6px 24px;
194
+ }
195
+
196
+ .post_count {
197
+ border: 1px solid #E7E7E7;
198
+ margin: 5px 0;
199
+ padding: 5px;
200
+ }
201
+
202
+ .post_count span {
203
+ font-weight: bold;
204
+ }
205
+
206
+ .wpuf-pagination {
207
+ display: block;
208
+ width: 100%;
209
+ margin: 10px 0;
210
+ }
211
+
212
+ /** author info **/
213
+ .wpuf-author {
214
+ clear: both;
215
+ margin: 10px 0;
216
+ }
217
+ .wpuf-author h3{
218
+ margin: 0 !important;
219
+ background: #CFCFCF;
220
+ text-align: left;
221
+ padding: 3px 10px;
222
+ }
223
+ .wpuf-author-inside {
224
+ background: none repeat scroll 0 0 #F0F0F0;
225
+ border-bottom: 2px solid #DDDDDD;
226
+ height: 90px;
227
+ padding-left: 10px;
228
+ padding-top: 15px;
229
+ margin-bottom: 15px;
230
+ }
231
+
232
+ .wpuf-author-inside .wpuf-user-image {
233
+ float: left;
234
+ padding-right: 15px;
235
+ }
236
+ .wpuf-author-body p {
237
+ margin-bottom: 10px !important;
238
+ }
239
+
240
+ .wpuf-author-body p.wpuf-user-name a {
241
+ color: #335160;
242
+ font-size: 1.2em;
243
+ font-weight: bold;
244
+ }
245
+
246
+ .wpuf-author-inside p.wpuf-author-info {
247
+ padding-top: 8px;
248
+ }
249
+
250
+ .invalid {
251
+ border: 1px solid #FF7272 !important;
252
+ }
253
+
254
+
255
+ #pass-strength-result {
256
+ border-radius: 6px 6px 6px 6px;
257
+ border-style: solid;
258
+ border-width: 1px;
259
+ float: left;
260
+ margin: 12px 5px 5px 1px;
261
+ padding: 7px;
262
+ text-align: center;
263
+ width: 248px;
264
+ }
265
+ #pass-strength-result.good {
266
+ background-color: #FFEC8B;
267
+ border-color: #FFCC00 !important;
268
+ }
269
+ #pass-strength-result {
270
+ background-color: #EEEEEE;
271
+ border-color: #DDDDDD !important;
272
+ }
273
+ #pass-strength-result.bad {
274
+ background-color: #FFB78C;
275
+ border-color: #FF853C !important;
276
+ }
277
+ #pass-strength-result.strong {
278
+ background-color: #C3FF88;
279
+ border-color: #8DFF1C !important;
280
+ }
281
+ #pass-strength-result.short {
282
+ background-color: #FFA0A0;
283
+ border-color: #F04040 !important;
284
+ }
285
+
286
+ .timestamp-wrap input {
287
+ width: 40px !important;
288
+ }
289
+
290
+ .wpuf_sub_info {
291
+ padding: 0;
292
+ margin: 10px 5px;
293
+ border: 1px solid green;
294
+ border-radius: 5px;
295
+ }
296
+
297
+ .wpuf_sub_info h3{
298
+ margin: 0 0 5px 0 !important;
299
+ background: green;
300
+ color: #fff !important;
301
+ padding: 3px 10px !important;
302
+ font-weight: bold;
303
+ }
304
+
305
+ .wpuf_sub_info .text{
306
+ padding: 5px 10px;
307
+ }
308
+
309
+
310
+ ul.wpuf_packs {
311
+ overflow: hidden;
312
+ margin: 35px 0 15px;
313
+ }
314
+
315
+ ul.wpuf_packs li {
316
+ background: #EEEEEE;
317
+ border: 1px solid #DDDDDD;
318
+ border-radius: 5px 5px 5px 5px;
319
+ float: left;
320
+ list-style: none outside none;
321
+ margin: 25px 25px 10px 0;
322
+ padding: 5px;
323
+ position: relative;
324
+ width: 200px;
325
+ }
326
+
327
+ ul.wpuf_packs h3 {
328
+ padding: 10px !important;
329
+ font-size: 14px;
330
+ font-weight: bold;
331
+ }
332
+
333
+ ul.wpuf_packs p {
334
+ padding: 0 10px;
335
+ margin-bottom: 8px;
336
+ }
337
+
338
+ .wpuf_packs .cost {
339
+ background: red;
340
+ border-radius: 30px 30px 30px 30px;
341
+ color: #FFFFFF;
342
+ margin: -16px -12px 0 0;
343
+ padding: 10px 8px 8px;
344
+ position: absolute;
345
+ right: 0;
346
+ top: 0;
347
+ }
348
+
349
+ .wpuf-loading {
350
+ height: 16px;
351
+ width: 16px;
352
+ background: url('../images/wpspin_light.gif') no-repeat;
353
+ padding: 0;
354
+ margin: 5px 10px;
355
+ right: -40px;
356
+ top: 0;
357
+ float: left;
358
+ }
359
+
360
+ .wpuf-pagination div.pagination{
361
+ text-align:center;
362
+ padding:7px;
363
+ margin:3px;
364
+ }
365
+
366
+ .wpuf-pagination .page-numbers{
367
+ padding:2px 8px;
368
+ margin:2px;
369
+ border:1px solid #4A5154;
370
+ text-decoration:none;
371
+ color:#4A5154;
372
+ background: #fff;
373
+ border-radius: 5px;
374
+ -moz-border-radius: 5px;
375
+ }
376
+
377
+ .wpuf-pagination .page-numbers:hover,
378
+ .wpuf-pagination .page-numbers:active{
379
+ border:1px solid #4A5154;
380
+ background-color:#4A5154;
381
+ color:#fff;
382
+ border-radius: 5px;
383
+ -moz-border-radius: 5px;
384
+ }
385
+
386
+ .wpuf-pagination .page-numbers.current{
387
+ padding:2px 8px;
388
+ margin:2px;
389
+ border:1px solid #4A5154;
390
+ font-weight:bold;
391
+ background-color:#4A5154;
392
+ color:#FFF;
393
+ border-radius: 5px;
394
+ -moz-border-radius: 5px;
395
+ }
396
+
397
+ #wpuf-ft-upload-filelist img {
398
+ border: 1px solid #ddd;
399
+ padding: 5px;
400
+ border-radius: 5px;
401
+ margin: 0 10px 10px 0;
402
+ float: left;
403
+ }
404
+
405
+ #wpuf-ft-upload-filelist .button {
406
+ border: 1px solid #ddd;
407
+ padding: 5px;
408
+ border-radius: 5px;
409
+ font-size: 12px;
410
+ color: #5F5F5F;
411
+ }
412
+
413
+ ul.wpuf-category-checklist {
414
+ margin: 0;
415
+ list-style: none;
416
+ }
417
+ .wpuf-post-form .category-wrap {
418
+ position: relative;
419
+ }
420
+
421
+ .wpuf-post-form .category-wrap select {
422
+ display: block;
423
+ margin: 0 0 5px 0;
424
+ }
425
+
426
+ #wpuf-attachment-upload-filelist .wpuf-attachment {
427
+ display: block;
428
+ margin: 0 0 10px 0;
429
+ padding: 0 0 10px 0;
430
+ border-bottom: 1px solid #eee;
431
+ }
432
+
433
+ #wpuf-attachment-upload-filelist .wpuf-attachment .attachment-name {
434
+ font-size: 12px;
435
+ margin: 0 0 0 15px;
436
+ }
437
+
438
+ #wpuf-attachment-upload-filelist .wpuf-attachment .button {
439
+ padding: 3px 8px;
440
+ border: 1px solid #ccc;
441
+ background: #f2f2f2;
442
+ color: #333;
443
+ font-size: 12px;
444
+ margin: 0 0 0 15px;
445
+ border-radius: 5px;
446
+ }
447
+
448
+ #wpuf-attachment-upload-pickfiles {
449
+ font-weight: bold;
450
+ color: #333;
451
+ padding: 3px 8px;
452
+ border: 1px solid #ccc;
453
+ background: #f2f2f2;
454
+ margin: 5px 0 15px 0;
455
+ border-radius: 5px;
456
+ }
457
+
458
+ #wpuf-attachment-upload-filelist .handle {
459
+ background: url('../images/arrow-move.png') no-repeat;
460
+ cursor: move;
461
+ display: inline-block;
462
+ height: 16px;
463
+ margin: 0 10px 0 0;
464
+ padding: 0;
465
+ text-indent: -9999px;
466
+ width: 16px;
467
+ }
assets/images/add.png ADDED
Binary file
assets/images/arrow-move.png ADDED
Binary file
assets/images/arrows.png ADDED
Binary file
assets/images/cross.png ADDED
Binary file
assets/images/del.png ADDED
Binary file
assets/images/delete.png ADDED
Binary file
assets/images/edit.png ADDED
Binary file
assets/images/help.png ADDED
Binary file
assets/images/no-image.png ADDED
Binary file
assets/images/paypal.png ADDED
Binary file
assets/images/remove.png ADDED
Binary file
assets/images/tick.png ADDED
Binary file
assets/images/wpspin_light.gif ADDED
Binary file
assets/js/chosen.jquery.js ADDED
@@ -0,0 +1,1211 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*!
2
+ Chosen, a Select Box Enhancer for jQuery and Prototype
3
+ by Patrick Filler for Harvest, http://getharvest.com
4
+
5
+ Version 1.1.0
6
+ Full source at https://github.com/harvesthq/chosen
7
+ Copyright (c) 2011 Harvest http://getharvest.com
8
+
9
+ MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
10
+ This file is generated by `grunt build`, do not edit it by hand.
11
+ */
12
+
13
+ (function() {
14
+ var $, AbstractChosen, Chosen, SelectParser, _ref,
15
+ __hasProp = {}.hasOwnProperty,
16
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
17
+
18
+ SelectParser = (function() {
19
+ function SelectParser() {
20
+ this.options_index = 0;
21
+ this.parsed = [];
22
+ }
23
+
24
+ SelectParser.prototype.add_node = function(child) {
25
+ if (child.nodeName.toUpperCase() === "OPTGROUP") {
26
+ return this.add_group(child);
27
+ } else {
28
+ return this.add_option(child);
29
+ }
30
+ };
31
+
32
+ SelectParser.prototype.add_group = function(group) {
33
+ var group_position, option, _i, _len, _ref, _results;
34
+ group_position = this.parsed.length;
35
+ this.parsed.push({
36
+ array_index: group_position,
37
+ group: true,
38
+ label: this.escapeExpression(group.label),
39
+ children: 0,
40
+ disabled: group.disabled
41
+ });
42
+ _ref = group.childNodes;
43
+ _results = [];
44
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
45
+ option = _ref[_i];
46
+ _results.push(this.add_option(option, group_position, group.disabled));
47
+ }
48
+ return _results;
49
+ };
50
+
51
+ SelectParser.prototype.add_option = function(option, group_position, group_disabled) {
52
+ if (option.nodeName.toUpperCase() === "OPTION") {
53
+ if (option.text !== "") {
54
+ if (group_position != null) {
55
+ this.parsed[group_position].children += 1;
56
+ }
57
+ this.parsed.push({
58
+ array_index: this.parsed.length,
59
+ options_index: this.options_index,
60
+ value: option.value,
61
+ text: option.text,
62
+ html: option.innerHTML,
63
+ selected: option.selected,
64
+ disabled: group_disabled === true ? group_disabled : option.disabled,
65
+ group_array_index: group_position,
66
+ classes: option.className,
67
+ style: option.style.cssText
68
+ });
69
+ } else {
70
+ this.parsed.push({
71
+ array_index: this.parsed.length,
72
+ options_index: this.options_index,
73
+ empty: true
74
+ });
75
+ }
76
+ return this.options_index += 1;
77
+ }
78
+ };
79
+
80
+ SelectParser.prototype.escapeExpression = function(text) {
81
+ var map, unsafe_chars;
82
+ if ((text == null) || text === false) {
83
+ return "";
84
+ }
85
+ if (!/[\&\<\>\"\'\`]/.test(text)) {
86
+ return text;
87
+ }
88
+ map = {
89
+ "<": "&lt;",
90
+ ">": "&gt;",
91
+ '"': "&quot;",
92
+ "'": "&#x27;",
93
+ "`": "&#x60;"
94
+ };
95
+ unsafe_chars = /&(?!\w+;)|[\<\>\"\'\`]/g;
96
+ return text.replace(unsafe_chars, function(chr) {
97
+ return map[chr] || "&amp;";
98
+ });
99
+ };
100
+
101
+ return SelectParser;
102
+
103
+ })();
104
+
105
+ SelectParser.select_to_array = function(select) {
106
+ var child, parser, _i, _len, _ref;
107
+ parser = new SelectParser();
108
+ _ref = select.childNodes;
109
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
110
+ child = _ref[_i];
111
+ parser.add_node(child);
112
+ }
113
+ return parser.parsed;
114
+ };
115
+
116
+ AbstractChosen = (function() {
117
+ function AbstractChosen(form_field, options) {
118
+ this.form_field = form_field;
119
+ this.options = options != null ? options : {};
120
+ if (!AbstractChosen.browser_is_supported()) {
121
+ return;
122
+ }
123
+ this.is_multiple = this.form_field.multiple;
124
+ this.set_default_text();
125
+ this.set_default_values();
126
+ this.setup();
127
+ this.set_up_html();
128
+ this.register_observers();
129
+ }
130
+
131
+ AbstractChosen.prototype.set_default_values = function() {
132
+ var _this = this;
133
+ this.click_test_action = function(evt) {
134
+ return _this.test_active_click(evt);
135
+ };
136
+ this.activate_action = function(evt) {
137
+ return _this.activate_field(evt);
138
+ };
139
+ this.active_field = false;
140
+ this.mouse_on_container = false;
141
+ this.results_showing = false;
142
+ this.result_highlighted = null;
143
+ this.allow_single_deselect = (this.options.allow_single_deselect != null) && (this.form_field.options[0] != null) && this.form_field.options[0].text === "" ? this.options.allow_single_deselect : false;
144
+ this.disable_search_threshold = this.options.disable_search_threshold || 0;
145
+ this.disable_search = this.options.disable_search || false;
146
+ this.enable_split_word_search = this.options.enable_split_word_search != null ? this.options.enable_split_word_search : true;
147
+ this.group_search = this.options.group_search != null ? this.options.group_search : true;
148
+ this.search_contains = this.options.search_contains || false;
149
+ this.single_backstroke_delete = this.options.single_backstroke_delete != null ? this.options.single_backstroke_delete : true;
150
+ this.max_selected_options = this.options.max_selected_options || Infinity;
151
+ this.inherit_select_classes = this.options.inherit_select_classes || false;
152
+ this.display_selected_options = this.options.display_selected_options != null ? this.options.display_selected_options : true;
153
+ return this.display_disabled_options = this.options.display_disabled_options != null ? this.options.display_disabled_options : true;
154
+ };
155
+
156
+ AbstractChosen.prototype.set_default_text = function() {
157
+ if (this.form_field.getAttribute("data-placeholder")) {
158
+ this.default_text = this.form_field.getAttribute("data-placeholder");
159
+ } else if (this.is_multiple) {
160
+ this.default_text = this.options.placeholder_text_multiple || this.options.placeholder_text || AbstractChosen.default_multiple_text;
161
+ } else {
162
+ this.default_text = this.options.placeholder_text_single || this.options.placeholder_text || AbstractChosen.default_single_text;
163
+ }
164
+ return this.results_none_found = this.form_field.getAttribute("data-no_results_text") || this.options.no_results_text || AbstractChosen.default_no_result_text;
165
+ };
166
+
167
+ AbstractChosen.prototype.mouse_enter = function() {
168
+ return this.mouse_on_container = true;
169
+ };
170
+
171
+ AbstractChosen.prototype.mouse_leave = function() {
172
+ return this.mouse_on_container = false;
173
+ };
174
+
175
+ AbstractChosen.prototype.input_focus = function(evt) {
176
+ var _this = this;
177
+ if (this.is_multiple) {
178
+ if (!this.active_field) {
179
+ return setTimeout((function() {
180
+ return _this.container_mousedown();
181
+ }), 50);
182
+ }
183
+ } else {
184
+ if (!this.active_field) {
185
+ return this.activate_field();
186
+ }
187
+ }
188
+ };
189
+
190
+ AbstractChosen.prototype.input_blur = function(evt) {
191
+ var _this = this;
192
+ if (!this.mouse_on_container) {
193
+ this.active_field = false;
194
+ return setTimeout((function() {
195
+ return _this.blur_test();
196
+ }), 100);
197
+ }
198
+ };
199
+
200
+ AbstractChosen.prototype.results_option_build = function(options) {
201
+ var content, data, _i, _len, _ref;
202
+ content = '';
203
+ _ref = this.results_data;
204
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
205
+ data = _ref[_i];
206
+ if (data.group) {
207
+ content += this.result_add_group(data);
208
+ } else {
209
+ content += this.result_add_option(data);
210
+ }
211
+ if (options != null ? options.first : void 0) {
212
+ if (data.selected && this.is_multiple) {
213
+ this.choice_build(data);
214
+ } else if (data.selected && !this.is_multiple) {
215
+ this.single_set_selected_text(data.text);
216
+ }
217
+ }
218
+ }
219
+ return content;
220
+ };
221
+
222
+ AbstractChosen.prototype.result_add_option = function(option) {
223
+ var classes, option_el;
224
+ if (!option.search_match) {
225
+ return '';
226
+ }
227
+ if (!this.include_option_in_results(option)) {
228
+ return '';
229
+ }
230
+ classes = [];
231
+ if (!option.disabled && !(option.selected && this.is_multiple)) {
232
+ classes.push("active-result");
233
+ }
234
+ if (option.disabled && !(option.selected && this.is_multiple)) {
235
+ classes.push("disabled-result");
236
+ }
237
+ if (option.selected) {
238
+ classes.push("result-selected");
239
+ }
240
+ if (option.group_array_index != null) {
241
+ classes.push("group-option");
242
+ }
243
+ if (option.classes !== "") {
244
+ classes.push(option.classes);
245
+ }
246
+ option_el = document.createElement("li");
247
+ option_el.className = classes.join(" ");
248
+ option_el.style.cssText = option.style;
249
+ option_el.setAttribute("data-option-array-index", option.array_index);
250
+ option_el.innerHTML = option.search_text;
251
+ return this.outerHTML(option_el);
252
+ };
253
+
254
+ AbstractChosen.prototype.result_add_group = function(group) {
255
+ var group_el;
256
+ if (!(group.search_match || group.group_match)) {
257
+ return '';
258
+ }
259
+ if (!(group.active_options > 0)) {
260
+ return '';
261
+ }
262
+ group_el = document.createElement("li");
263
+ group_el.className = "group-result";
264
+ group_el.innerHTML = group.search_text;
265
+ return this.outerHTML(group_el);
266
+ };
267
+
268
+ AbstractChosen.prototype.results_update_field = function() {
269
+ this.set_default_text();
270
+ if (!this.is_multiple) {
271
+ this.results_reset_cleanup();
272
+ }
273
+ this.result_clear_highlight();
274
+ this.results_build();
275
+ if (this.results_showing) {
276
+ return this.winnow_results();
277
+ }
278
+ };
279
+
280
+ AbstractChosen.prototype.reset_single_select_options = function() {
281
+ var result, _i, _len, _ref, _results;
282
+ _ref = this.results_data;
283
+ _results = [];
284
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
285
+ result = _ref[_i];
286
+ if (result.selected) {
287
+ _results.push(result.selected = false);
288
+ } else {
289
+ _results.push(void 0);
290
+ }
291
+ }
292
+ return _results;
293
+ };
294
+
295
+ AbstractChosen.prototype.results_toggle = function() {
296
+ if (this.results_showing) {
297
+ return this.results_hide();
298
+ } else {
299
+ return this.results_show();
300
+ }
301
+ };
302
+
303
+ AbstractChosen.prototype.results_search = function(evt) {
304
+ if (this.results_showing) {
305
+ return this.winnow_results();
306
+ } else {
307
+ return this.results_show();
308
+ }
309
+ };
310
+
311
+ AbstractChosen.prototype.winnow_results = function() {
312
+ var escapedSearchText, option, regex, regexAnchor, results, results_group, searchText, startpos, text, zregex, _i, _len, _ref;
313
+ this.no_results_clear();
314
+ results = 0;
315
+ searchText = this.get_search_text();
316
+ escapedSearchText = searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
317
+ regexAnchor = this.search_contains ? "" : "^";
318
+ regex = new RegExp(regexAnchor + escapedSearchText, 'i');
319
+ zregex = new RegExp(escapedSearchText, 'i');
320
+ _ref = this.results_data;
321
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
322
+ option = _ref[_i];
323
+ option.search_match = false;
324
+ results_group = null;
325
+ if (this.include_option_in_results(option)) {
326
+ if (option.group) {
327
+ option.group_match = false;
328
+ option.active_options = 0;
329
+ }
330
+ if ((option.group_array_index != null) && this.results_data[option.group_array_index]) {
331
+ results_group = this.results_data[option.group_array_index];
332
+ if (results_group.active_options === 0 && results_group.search_match) {
333
+ results += 1;
334
+ }
335
+ results_group.active_options += 1;
336
+ }
337
+ if (!(option.group && !this.group_search)) {
338
+ option.search_text = option.group ? option.label : option.html;
339
+ option.search_match = this.search_string_match(option.search_text, regex);
340
+ if (option.search_match && !option.group) {
341
+ results += 1;
342
+ }
343
+ if (option.search_match) {
344
+ if (searchText.length) {
345
+ startpos = option.search_text.search(zregex);
346
+ text = option.search_text.substr(0, startpos + searchText.length) + '</em>' + option.search_text.substr(startpos + searchText.length);
347
+ option.search_text = text.substr(0, startpos) + '<em>' + text.substr(startpos);
348
+ }
349
+ if (results_group != null) {
350
+ results_group.group_match = true;
351
+ }
352
+ } else if ((option.group_array_index != null) && this.results_data[option.group_array_index].search_match) {
353
+ option.search_match = true;
354
+ }
355
+ }
356
+ }
357
+ }
358
+ this.result_clear_highlight();
359
+ if (results < 1 && searchText.length) {
360
+ this.update_results_content("");
361
+ return this.no_results(searchText);
362
+ } else {
363
+ this.update_results_content(this.results_option_build());
364
+ return this.winnow_results_set_highlight();
365
+ }
366
+ };
367
+
368
+ AbstractChosen.prototype.search_string_match = function(search_string, regex) {
369
+ var part, parts, _i, _len;
370
+ if (regex.test(search_string)) {
371
+ return true;
372
+ } else if (this.enable_split_word_search && (search_string.indexOf(" ") >= 0 || search_string.indexOf("[") === 0)) {
373
+ parts = search_string.replace(/\[|\]/g, "").split(" ");
374
+ if (parts.length) {
375
+ for (_i = 0, _len = parts.length; _i < _len; _i++) {
376
+ part = parts[_i];
377
+ if (regex.test(part)) {
378
+ return true;
379
+ }
380
+ }
381
+ }
382
+ }
383
+ };
384
+
385
+ AbstractChosen.prototype.choices_count = function() {
386
+ var option, _i, _len, _ref;
387
+ if (this.selected_option_count != null) {
388
+ return this.selected_option_count;
389
+ }
390
+ this.selected_option_count = 0;
391
+ _ref = this.form_field.options;
392
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
393
+ option = _ref[_i];
394
+ if (option.selected) {
395
+ this.selected_option_count += 1;
396
+ }
397
+ }
398
+ return this.selected_option_count;
399
+ };
400
+
401
+ AbstractChosen.prototype.choices_click = function(evt) {
402
+ evt.preventDefault();
403
+ if (!(this.results_showing || this.is_disabled)) {
404
+ return this.results_show();
405
+ }
406
+ };
407
+
408
+ AbstractChosen.prototype.keyup_checker = function(evt) {
409
+ var stroke, _ref;
410
+ stroke = (_ref = evt.which) != null ? _ref : evt.keyCode;
411
+ this.search_field_scale();
412
+ switch (stroke) {
413
+ case 8:
414
+ if (this.is_multiple && this.backstroke_length < 1 && this.choices_count() > 0) {
415
+ return this.keydown_backstroke();
416
+ } else if (!this.pending_backstroke) {
417
+ this.result_clear_highlight();
418
+ return this.results_search();
419
+ }
420
+ break;
421
+ case 13:
422
+ evt.preventDefault();
423
+ if (this.results_showing) {
424
+ return this.result_select(evt);
425
+ }
426
+ break;
427
+ case 27:
428
+ if (this.results_showing) {
429
+ this.results_hide();
430
+ }
431
+ return true;
432
+ case 9:
433
+ case 38:
434
+ case 40:
435
+ case 16:
436
+ case 91:
437
+ case 17:
438
+ break;
439
+ default:
440
+ return this.results_search();
441
+ }
442
+ };
443
+
444
+ AbstractChosen.prototype.clipboard_event_checker = function(evt) {
445
+ var _this = this;
446
+ return setTimeout((function() {
447
+ return _this.results_search();
448
+ }), 50);
449
+ };
450
+
451
+ AbstractChosen.prototype.container_width = function() {
452
+ if (this.options.width != null) {
453
+ return this.options.width;
454
+ } else {
455
+ return "" + this.form_field.offsetWidth + "px";
456
+ }
457
+ };
458
+
459
+ AbstractChosen.prototype.include_option_in_results = function(option) {
460
+ if (this.is_multiple && (!this.display_selected_options && option.selected)) {
461
+ return false;
462
+ }
463
+ if (!this.display_disabled_options && option.disabled) {
464
+ return false;
465
+ }
466
+ if (option.empty) {
467
+ return false;
468
+ }
469
+ return true;
470
+ };
471
+
472
+ AbstractChosen.prototype.search_results_touchstart = function(evt) {
473
+ this.touch_started = true;
474
+ return this.search_results_mouseover(evt);
475
+ };
476
+
477
+ AbstractChosen.prototype.search_results_touchmove = function(evt) {
478
+ this.touch_started = false;
479
+ return this.search_results_mouseout(evt);
480
+ };
481
+
482
+ AbstractChosen.prototype.search_results_touchend = function(evt) {
483
+ if (this.touch_started) {
484
+ return this.search_results_mouseup(evt);
485
+ }
486
+ };
487
+
488
+ AbstractChosen.prototype.outerHTML = function(element) {
489
+ var tmp;
490
+ if (element.outerHTML) {
491
+ return element.outerHTML;
492
+ }
493
+ tmp = document.createElement("div");
494
+ tmp.appendChild(element);
495
+ return tmp.innerHTML;
496
+ };
497
+
498
+ AbstractChosen.browser_is_supported = function() {
499
+ if (window.navigator.appName === "Microsoft Internet Explorer") {
500
+ return document.documentMode >= 8;
501
+ }
502
+ if (/iP(od|hone)/i.test(window.navigator.userAgent)) {
503
+ return false;
504
+ }
505
+ if (/Android/i.test(window.navigator.userAgent)) {
506
+ if (/Mobile/i.test(window.navigator.userAgent)) {
507
+ return false;
508
+ }
509
+ }
510
+ return true;
511
+ };
512
+
513
+ AbstractChosen.default_multiple_text = "Select Some Options";
514
+
515
+ AbstractChosen.default_single_text = "Select an Option";
516
+
517
+ AbstractChosen.default_no_result_text = "No results match";
518
+
519
+ return AbstractChosen;
520
+
521
+ })();
522
+
523
+ $ = jQuery;
524
+
525
+ $.fn.extend({
526
+ chosen: function(options) {
527
+ if (!AbstractChosen.browser_is_supported()) {
528
+ return this;
529
+ }
530
+ return this.each(function(input_field) {
531
+ var $this, chosen;
532
+ $this = $(this);
533
+ chosen = $this.data('chosen');
534
+ if (options === 'destroy' && chosen) {
535
+ chosen.destroy();
536
+ } else if (!chosen) {
537
+ $this.data('chosen', new Chosen(this, options));
538
+ }
539
+ });
540
+ }
541
+ });
542
+
543
+ Chosen = (function(_super) {
544
+ __extends(Chosen, _super);
545
+
546
+ function Chosen() {
547
+ _ref = Chosen.__super__.constructor.apply(this, arguments);
548
+ return _ref;
549
+ }
550
+
551
+ Chosen.prototype.setup = function() {
552
+ this.form_field_jq = $(this.form_field);
553
+ this.current_selectedIndex = this.form_field.selectedIndex;
554
+ return this.is_rtl = this.form_field_jq.hasClass("chosen-rtl");
555
+ };
556
+
557
+ Chosen.prototype.set_up_html = function() {
558
+ var container_classes, container_props;
559
+ container_classes = ["chosen-container"];
560
+ container_classes.push("chosen-container-" + (this.is_multiple ? "multi" : "single"));
561
+ if (this.inherit_select_classes && this.form_field.className) {
562
+ container_classes.push(this.form_field.className);
563
+ }
564
+ if (this.is_rtl) {
565
+ container_classes.push("chosen-rtl");
566
+ }
567
+ container_props = {
568
+ 'class': container_classes.join(' '),
569
+ 'style': "width: " + (this.container_width()) + ";",
570
+ 'title': this.form_field.title
571
+ };
572
+ if (this.form_field.id.length) {
573
+ container_props.id = this.form_field.id.replace(/[^\w]/g, '_') + "_chosen";
574
+ }
575
+ this.container = $("<div />", container_props);
576
+ if (this.is_multiple) {
577
+ this.container.html('<ul class="chosen-choices"><li class="search-field"><input type="text" value="' + this.default_text + '" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chosen-drop"><ul class="chosen-results"></ul></div>');
578
+ } else {
579
+ this.container.html('<a class="chosen-single chosen-default" tabindex="-1"><span>' + this.default_text + '</span><div><b></b></div></a><div class="chosen-drop"><div class="chosen-search"><input type="text" autocomplete="off" /></div><ul class="chosen-results"></ul></div>');
580
+ }
581
+ this.form_field_jq.hide().after(this.container);
582
+ this.dropdown = this.container.find('div.chosen-drop').first();
583
+ this.search_field = this.container.find('input').first();
584
+ this.search_results = this.container.find('ul.chosen-results').first();
585
+ this.search_field_scale();
586
+ this.search_no_results = this.container.find('li.no-results').first();
587
+ if (this.is_multiple) {
588
+ this.search_choices = this.container.find('ul.chosen-choices').first();
589
+ this.search_container = this.container.find('li.search-field').first();
590
+ } else {
591
+ this.search_container = this.container.find('div.chosen-search').first();
592
+ this.selected_item = this.container.find('.chosen-single').first();
593
+ }
594
+ this.results_build();
595
+ this.set_tab_index();
596
+ this.set_label_behavior();
597
+ return this.form_field_jq.trigger("chosen:ready", {
598
+ chosen: this
599
+ });
600
+ };
601
+
602
+ Chosen.prototype.register_observers = function() {
603
+ var _this = this;
604
+ this.container.bind('mousedown.chosen', function(evt) {
605
+ _this.container_mousedown(evt);
606
+ });
607
+ this.container.bind('mouseup.chosen', function(evt) {
608
+ _this.container_mouseup(evt);
609
+ });
610
+ this.container.bind('mouseenter.chosen', function(evt) {
611
+ _this.mouse_enter(evt);
612
+ });
613
+ this.container.bind('mouseleave.chosen', function(evt) {
614
+ _this.mouse_leave(evt);
615
+ });
616
+ this.search_results.bind('mouseup.chosen', function(evt) {
617
+ _this.search_results_mouseup(evt);
618
+ });
619
+ this.search_results.bind('mouseover.chosen', function(evt) {
620
+ _this.search_results_mouseover(evt);
621
+ });
622
+ this.search_results.bind('mouseout.chosen', function(evt) {
623
+ _this.search_results_mouseout(evt);
624
+ });
625
+ this.search_results.bind('mousewheel.chosen DOMMouseScroll.chosen', function(evt) {
626
+ _this.search_results_mousewheel(evt);
627
+ });
628
+ this.search_results.bind('touchstart.chosen', function(evt) {
629
+ _this.search_results_touchstart(evt);
630
+ });
631
+ this.search_results.bind('touchmove.chosen', function(evt) {
632
+ _this.search_results_touchmove(evt);
633
+ });
634
+ this.search_results.bind('touchend.chosen', function(evt) {
635
+ _this.search_results_touchend(evt);
636
+ });
637
+ this.form_field_jq.bind("chosen:updated.chosen", function(evt) {
638
+ _this.results_update_field(evt);
639
+ });
640
+ this.form_field_jq.bind("chosen:activate.chosen", function(evt) {
641
+ _this.activate_field(evt);
642
+ });
643
+ this.form_field_jq.bind("chosen:open.chosen", function(evt) {
644
+ _this.container_mousedown(evt);
645
+ });
646
+ this.form_field_jq.bind("chosen:close.chosen", function(evt) {
647
+ _this.input_blur(evt);
648
+ });
649
+ this.search_field.bind('blur.chosen', function(evt) {
650
+ _this.input_blur(evt);
651
+ });
652
+ this.search_field.bind('keyup.chosen', function(evt) {
653
+ _this.keyup_checker(evt);
654
+ });
655
+ this.search_field.bind('keydown.chosen', function(evt) {
656
+ _this.keydown_checker(evt);
657
+ });
658
+ this.search_field.bind('focus.chosen', function(evt) {
659
+ _this.input_focus(evt);
660
+ });
661
+ this.search_field.bind('cut.chosen', function(evt) {
662
+ _this.clipboard_event_checker(evt);
663
+ });
664
+ this.search_field.bind('paste.chosen', function(evt) {
665
+ _this.clipboard_event_checker(evt);
666
+ });
667
+ if (this.is_multiple) {
668
+ return this.search_choices.bind('click.chosen', function(evt) {
669
+ _this.choices_click(evt);
670
+ });
671
+ } else {
672
+ return this.container.bind('click.chosen', function(evt) {
673
+ evt.preventDefault();
674
+ });
675
+ }
676
+ };
677
+
678
+ Chosen.prototype.destroy = function() {
679
+ $(this.container[0].ownerDocument).unbind("click.chosen", this.click_test_action);
680
+ if (this.search_field[0].tabIndex) {
681
+ this.form_field_jq[0].tabIndex = this.search_field[0].tabIndex;
682
+ }
683
+ this.container.remove();
684
+ this.form_field_jq.removeData('chosen');
685
+ return this.form_field_jq.show();
686
+ };
687
+
688
+ Chosen.prototype.search_field_disabled = function() {
689
+ this.is_disabled = this.form_field_jq[0].disabled;
690
+ if (this.is_disabled) {
691
+ this.container.addClass('chosen-disabled');
692
+ this.search_field[0].disabled = true;
693
+ if (!this.is_multiple) {
694
+ this.selected_item.unbind("focus.chosen", this.activate_action);
695
+ }
696
+ return this.close_field();
697
+ } else {
698
+ this.container.removeClass('chosen-disabled');
699
+ this.search_field[0].disabled = false;
700
+ if (!this.is_multiple) {
701
+ return this.selected_item.bind("focus.chosen", this.activate_action);
702
+ }
703
+ }
704
+ };
705
+
706
+ Chosen.prototype.container_mousedown = function(evt) {
707
+ if (!this.is_disabled) {
708
+ if (evt && evt.type === "mousedown" && !this.results_showing) {
709
+ evt.preventDefault();
710
+ }
711
+ if (!((evt != null) && ($(evt.target)).hasClass("search-choice-close"))) {
712
+ if (!this.active_field) {
713
+ if (this.is_multiple) {
714
+ this.search_field.val("");
715
+ }
716
+ $(this.container[0].ownerDocument).bind('click.chosen', this.click_test_action);
717
+ this.results_show();
718
+ } else if (!this.is_multiple && evt && (($(evt.target)[0] === this.selected_item[0]) || $(evt.target).parents("a.chosen-single").length)) {
719
+ evt.preventDefault();
720
+ this.results_toggle();
721
+ }
722
+ return this.activate_field();
723
+ }
724
+ }
725
+ };
726
+
727
+ Chosen.prototype.container_mouseup = function(evt) {
728
+ if (evt.target.nodeName === "ABBR" && !this.is_disabled) {
729
+ return this.results_reset(evt);
730
+ }
731
+ };
732
+
733
+ Chosen.prototype.search_results_mousewheel = function(evt) {
734
+ var delta;
735
+ if (evt.originalEvent) {
736
+ delta = -evt.originalEvent.wheelDelta || evt.originalEvent.detail;
737
+ }
738
+ if (delta != null) {
739
+ evt.preventDefault();
740
+ if (evt.type === 'DOMMouseScroll') {
741
+ delta = delta * 40;
742
+ }
743
+ return this.search_results.scrollTop(delta + this.search_results.scrollTop());
744
+ }
745
+ };
746
+
747
+ Chosen.prototype.blur_test = function(evt) {
748
+ if (!this.active_field && this.container.hasClass("chosen-container-active")) {
749
+ return this.close_field();
750
+ }
751
+ };
752
+
753
+ Chosen.prototype.close_field = function() {
754
+ $(this.container[0].ownerDocument).unbind("click.chosen", this.click_test_action);
755
+ this.active_field = false;
756
+ this.results_hide();
757
+ this.container.removeClass("chosen-container-active");
758
+ this.clear_backstroke();
759
+ this.show_search_field_default();
760
+ return this.search_field_scale();
761
+ };
762
+
763
+ Chosen.prototype.activate_field = function() {
764
+ this.container.addClass("chosen-container-active");
765
+ this.active_field = true;
766
+ this.search_field.val(this.search_field.val());
767
+ return this.search_field.focus();
768
+ };
769
+
770
+ Chosen.prototype.test_active_click = function(evt) {
771
+ var active_container;
772
+ active_container = $(evt.target).closest('.chosen-container');
773
+ if (active_container.length && this.container[0] === active_container[0]) {
774
+ return this.active_field = true;
775
+ } else {
776
+ return this.close_field();
777
+ }
778
+ };
779
+
780
+ Chosen.prototype.results_build = function() {
781
+ this.parsing = true;
782
+ this.selected_option_count = null;
783
+ this.results_data = SelectParser.select_to_array(this.form_field);
784
+ if (this.is_multiple) {
785
+ this.search_choices.find("li.search-choice").remove();
786
+ } else if (!this.is_multiple) {
787
+ this.single_set_selected_text();
788
+ if (this.disable_search || this.form_field.options.length <= this.disable_search_threshold) {
789
+ this.search_field[0].readOnly = true;
790
+ this.container.addClass("chosen-container-single-nosearch");
791
+ } else {
792
+ this.search_field[0].readOnly = false;
793
+ this.container.removeClass("chosen-container-single-nosearch");
794
+ }
795
+ }
796
+ this.update_results_content(this.results_option_build({
797
+ first: true
798
+ }));
799
+ this.search_field_disabled();
800
+ this.show_search_field_default();
801
+ this.search_field_scale();
802
+ return this.parsing = false;
803
+ };
804
+
805
+ Chosen.prototype.result_do_highlight = function(el) {
806
+ var high_bottom, high_top, maxHeight, visible_bottom, visible_top;
807
+ if (el.length) {
808
+ this.result_clear_highlight();
809
+ this.result_highlight = el;
810
+ this.result_highlight.addClass("highlighted");
811
+ maxHeight = parseInt(this.search_results.css("maxHeight"), 10);
812
+ visible_top = this.search_results.scrollTop();
813
+ visible_bottom = maxHeight + visible_top;
814
+ high_top = this.result_highlight.position().top + this.search_results.scrollTop();
815
+ high_bottom = high_top + this.result_highlight.outerHeight();
816
+ if (high_bottom >= visible_bottom) {
817
+ return this.search_results.scrollTop((high_bottom - maxHeight) > 0 ? high_bottom - maxHeight : 0);
818
+ } else if (high_top < visible_top) {
819
+ return this.search_results.scrollTop(high_top);
820
+ }
821
+ }
822
+ };
823
+
824
+ Chosen.prototype.result_clear_highlight = function() {
825
+ if (this.result_highlight) {
826
+ this.result_highlight.removeClass("highlighted");
827
+ }
828
+ return this.result_highlight = null;
829
+ };
830
+
831
+ Chosen.prototype.results_show = function() {
832
+ if (this.is_multiple && this.max_selected_options <= this.choices_count()) {
833
+ this.form_field_jq.trigger("chosen:maxselected", {
834
+ chosen: this
835
+ });
836
+ return false;
837
+ }
838
+ this.container.addClass("chosen-with-drop");
839
+ this.results_showing = true;
840
+ this.search_field.focus();
841
+ this.search_field.val(this.search_field.val());
842
+ this.winnow_results();
843
+ return this.form_field_jq.trigger("chosen:showing_dropdown", {
844
+ chosen: this
845
+ });
846
+ };
847
+
848
+ Chosen.prototype.update_results_content = function(content) {
849
+ return this.search_results.html(content);
850
+ };
851
+
852
+ Chosen.prototype.results_hide = function() {
853
+ if (this.results_showing) {
854
+ this.result_clear_highlight();
855
+ this.container.removeClass("chosen-with-drop");
856
+ this.form_field_jq.trigger("chosen:hiding_dropdown", {
857
+ chosen: this
858
+ });
859
+ }
860
+ return this.results_showing = false;
861
+ };
862
+
863
+ Chosen.prototype.set_tab_index = function(el) {
864
+ var ti;
865
+ if (this.form_field.tabIndex) {
866
+ ti = this.form_field.tabIndex;
867
+ this.form_field.tabIndex = -1;
868
+ return this.search_field[0].tabIndex = ti;
869
+ }
870
+ };
871
+
872
+ Chosen.prototype.set_label_behavior = function() {
873
+ var _this = this;
874
+ this.form_field_label = this.form_field_jq.parents("label");
875
+ if (!this.form_field_label.length && this.form_field.id.length) {
876
+ this.form_field_label = $("label[for='" + this.form_field.id + "']");
877
+ }
878
+ if (this.form_field_label.length > 0) {
879
+ return this.form_field_label.bind('click.chosen', function(evt) {
880
+ if (_this.is_multiple) {
881
+ return _this.container_mousedown(evt);
882
+ } else {
883
+ return _this.activate_field();
884
+ }
885
+ });
886
+ }
887
+ };
888
+
889
+ Chosen.prototype.show_search_field_default = function() {
890
+ if (this.is_multiple && this.choices_count() < 1 && !this.active_field) {
891
+ this.search_field.val(this.default_text);
892
+ return this.search_field.addClass("default");
893
+ } else {
894
+ this.search_field.val("");
895
+ return this.search_field.removeClass("default");
896
+ }
897
+ };
898
+
899
+ Chosen.prototype.search_results_mouseup = function(evt) {
900
+ var target;
901
+ target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first();
902
+ if (target.length) {
903
+ this.result_highlight = target;
904
+ this.result_select(evt);
905
+ return this.search_field.focus();
906
+ }
907
+ };
908
+
909
+ Chosen.prototype.search_results_mouseover = function(evt) {
910
+ var target;
911
+ target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first();
912
+ if (target) {
913
+ return this.result_do_highlight(target);
914
+ }
915
+ };
916
+
917
+ Chosen.prototype.search_results_mouseout = function(evt) {
918
+ if ($(evt.target).hasClass("active-result" || $(evt.target).parents('.active-result').first())) {
919
+ return this.result_clear_highlight();
920
+ }
921
+ };
922
+
923
+ Chosen.prototype.choice_build = function(item) {
924
+ var choice, close_link,
925
+ _this = this;
926
+ choice = $('<li />', {
927
+ "class": "search-choice"
928
+ }).html("<span>" + item.html + "</span>");
929
+ if (item.disabled) {
930
+ choice.addClass('search-choice-disabled');
931
+ } else {
932
+ close_link = $('<a />', {
933
+ "class": 'search-choice-close',
934
+ 'data-option-array-index': item.array_index
935
+ });
936
+ close_link.bind('click.chosen', function(evt) {
937
+ return _this.choice_destroy_link_click(evt);
938
+ });
939
+ choice.append(close_link);
940
+ }
941
+ return this.search_container.before(choice);
942
+ };
943
+
944
+ Chosen.prototype.choice_destroy_link_click = function(evt) {
945
+ evt.preventDefault();
946
+ evt.stopPropagation();
947
+ if (!this.is_disabled) {
948
+ return this.choice_destroy($(evt.target));
949
+ }
950
+ };
951
+
952
+ Chosen.prototype.choice_destroy = function(link) {
953
+ if (this.result_deselect(link[0].getAttribute("data-option-array-index"))) {
954
+ this.show_search_field_default();
955
+ if (this.is_multiple && this.choices_count() > 0 && this.search_field.val().length < 1) {
956
+ this.results_hide();
957
+ }
958
+ link.parents('li').first().remove();
959
+ return this.search_field_scale();
960
+ }
961
+ };
962
+
963
+ Chosen.prototype.results_reset = function() {
964
+ this.reset_single_select_options();
965
+ this.form_field.options[0].selected = true;
966
+ this.single_set_selected_text();
967
+ this.show_search_field_default();
968
+ this.results_reset_cleanup();
969
+ this.form_field_jq.trigger("change");
970
+ if (this.active_field) {
971
+ return this.results_hide();
972
+ }
973
+ };
974
+
975
+ Chosen.prototype.results_reset_cleanup = function() {
976
+ this.current_selectedIndex = this.form_field.selectedIndex;
977
+ return this.selected_item.find("abbr").remove();
978
+ };
979
+
980
+ Chosen.prototype.result_select = function(evt) {
981
+ var high, item;
982
+ if (this.result_highlight) {
983
+ high = this.result_highlight;
984
+ this.result_clear_highlight();
985
+ if (this.is_multiple && this.max_selected_options <= this.choices_count()) {
986
+ this.form_field_jq.trigger("chosen:maxselected", {
987
+ chosen: this
988
+ });
989
+ return false;
990
+ }
991
+ if (this.is_multiple) {
992
+ high.removeClass("active-result");
993
+ } else {
994
+ this.reset_single_select_options();
995
+ }
996
+ item = this.results_data[high[0].getAttribute("data-option-array-index")];
997
+ item.selected = true;
998
+ this.form_field.options[item.options_index].selected = true;
999
+ this.selected_option_count = null;
1000
+ if (this.is_multiple) {
1001
+ this.choice_build(item);
1002
+ } else {
1003
+ this.single_set_selected_text(item.text);
1004
+ }
1005
+ if (!((evt.metaKey || evt.ctrlKey) && this.is_multiple)) {
1006
+ this.results_hide();
1007
+ }
1008
+ this.search_field.val("");
1009
+ if (this.is_multiple || this.form_field.selectedIndex !== this.current_selectedIndex) {
1010
+ this.form_field_jq.trigger("change", {
1011
+ 'selected': this.form_field.options[item.options_index].value
1012
+ });
1013
+ }
1014
+ this.current_selectedIndex = this.form_field.selectedIndex;
1015
+ return this.search_field_scale();
1016
+ }
1017
+ };
1018
+
1019
+ Chosen.prototype.single_set_selected_text = function(text) {
1020
+ if (text == null) {
1021
+ text = this.default_text;
1022
+ }
1023
+ if (text === this.default_text) {
1024
+ this.selected_item.addClass("chosen-default");
1025
+ } else {
1026
+ this.single_deselect_control_build();
1027
+ this.selected_item.removeClass("chosen-default");
1028
+ }
1029
+ return this.selected_item.find("span").text(text);
1030
+ };
1031
+
1032
+ Chosen.prototype.result_deselect = function(pos) {
1033
+ var result_data;
1034
+ result_data = this.results_data[pos];
1035
+ if (!this.form_field.options[result_data.options_index].disabled) {
1036
+ result_data.selected = false;
1037
+ this.form_field.options[result_data.options_index].selected = false;
1038
+ this.selected_option_count = null;
1039
+ this.result_clear_highlight();
1040
+ if (this.results_showing) {
1041
+ this.winnow_results();
1042
+ }
1043
+ this.form_field_jq.trigger("change", {
1044
+ deselected: this.form_field.options[result_data.options_index].value
1045
+ });
1046
+ this.search_field_scale();
1047
+ return true;
1048
+ } else {
1049
+ return false;
1050
+ }
1051
+ };
1052
+
1053
+ Chosen.prototype.single_deselect_control_build = function() {
1054
+ if (!this.allow_single_deselect) {
1055
+ return;
1056
+ }
1057
+ if (!this.selected_item.find("abbr").length) {
1058
+ this.selected_item.find("span").first().after("<abbr class=\"search-choice-close\"></abbr>");
1059
+ }
1060
+ return this.selected_item.addClass("chosen-single-with-deselect");
1061
+ };
1062
+
1063
+ Chosen.prototype.get_search_text = function() {
1064
+ if (this.search_field.val() === this.default_text) {
1065
+ return "";
1066
+ } else {
1067
+ return $('<div/>').text($.trim(this.search_field.val())).html();
1068
+ }
1069
+ };
1070
+
1071
+ Chosen.prototype.winnow_results_set_highlight = function() {
1072
+ var do_high, selected_results;
1073
+ selected_results = !this.is_multiple ? this.search_results.find(".result-selected.active-result") : [];
1074
+ do_high = selected_results.length ? selected_results.first() : this.search_results.find(".active-result").first();
1075
+ if (do_high != null) {
1076
+ return this.result_do_highlight(do_high);
1077
+ }
1078
+ };
1079
+
1080
+ Chosen.prototype.no_results = function(terms) {
1081
+ var no_results_html;
1082
+ no_results_html = $('<li class="no-results">' + this.results_none_found + ' "<span></span>"</li>');
1083
+ no_results_html.find("span").first().html(terms);
1084
+ this.search_results.append(no_results_html);
1085
+ return this.form_field_jq.trigger("chosen:no_results", {
1086
+ chosen: this
1087
+ });
1088
+ };
1089
+
1090
+ Chosen.prototype.no_results_clear = function() {
1091
+ return this.search_results.find(".no-results").remove();
1092
+ };
1093
+
1094
+ Chosen.prototype.keydown_arrow = function() {
1095
+ var next_sib;
1096
+ if (this.results_showing && this.result_highlight) {
1097
+ next_sib = this.result_highlight.nextAll("li.active-result").first();
1098
+ if (next_sib) {
1099
+ return this.result_do_highlight(next_sib);
1100
+ }
1101
+ } else {
1102
+ return this.results_show();
1103
+ }
1104
+ };
1105
+
1106
+ Chosen.prototype.keyup_arrow = function() {
1107
+ var prev_sibs;
1108
+ if (!this.results_showing && !this.is_multiple) {
1109
+ return this.results_show();
1110
+ } else if (this.result_highlight) {
1111
+ prev_sibs = this.result_highlight.prevAll("li.active-result");
1112
+ if (prev_sibs.length) {
1113
+ return this.result_do_highlight(prev_sibs.first());
1114
+ } else {
1115
+ if (this.choices_count() > 0) {
1116
+ this.results_hide();
1117
+ }
1118
+ return this.result_clear_highlight();
1119
+ }
1120
+ }
1121
+ };
1122
+
1123
+ Chosen.prototype.keydown_backstroke = function() {
1124
+ var next_available_destroy;
1125
+ if (this.pending_backstroke) {
1126
+ this.choice_destroy(this.pending_backstroke.find("a").first());
1127
+ return this.clear_backstroke();
1128
+ } else {
1129
+ next_available_destroy = this.search_container.siblings("li.search-choice").last();
1130
+ if (next_available_destroy.length && !next_available_destroy.hasClass("search-choice-disabled")) {
1131
+ this.pending_backstroke = next_available_destroy;
1132
+ if (this.single_backstroke_delete) {
1133
+ return this.keydown_backstroke();
1134
+ } else {
1135
+ return this.pending_backstroke.addClass("search-choice-focus");
1136
+ }
1137
+ }
1138
+ }
1139
+ };
1140
+
1141
+ Chosen.prototype.clear_backstroke = function() {
1142
+ if (this.pending_backstroke) {
1143
+ this.pending_backstroke.removeClass("search-choice-focus");
1144
+ }
1145
+ return this.pending_backstroke = null;
1146
+ };
1147
+
1148
+ Chosen.prototype.keydown_checker = function(evt) {
1149
+ var stroke, _ref1;
1150
+ stroke = (_ref1 = evt.which) != null ? _ref1 : evt.keyCode;
1151
+ this.search_field_scale();
1152
+ if (stroke !== 8 && this.pending_backstroke) {
1153
+ this.clear_backstroke();
1154
+ }
1155
+ switch (stroke) {
1156
+ case 8:
1157
+ this.backstroke_length = this.search_field.val().length;
1158
+ break;
1159
+ case 9:
1160
+ if (this.results_showing && !this.is_multiple) {
1161
+ this.result_select(evt);
1162
+ }
1163
+ this.mouse_on_container = false;
1164
+ break;
1165
+ case 13:
1166
+ evt.preventDefault();
1167
+ break;
1168
+ case 38:
1169
+ evt.preventDefault();
1170
+ this.keyup_arrow();
1171
+ break;
1172
+ case 40:
1173
+ evt.preventDefault();
1174
+ this.keydown_arrow();
1175
+ break;
1176
+ }
1177
+ };
1178
+
1179
+ Chosen.prototype.search_field_scale = function() {
1180
+ var div, f_width, h, style, style_block, styles, w, _i, _len;
1181
+ if (this.is_multiple) {
1182
+ h = 0;
1183
+ w = 0;
1184
+ style_block = "position:absolute; left: -1000px; top: -1000px; display:none;";
1185
+ styles = ['font-size', 'font-style', 'font-weight', 'font-family', 'line-height', 'text-transform', 'letter-spacing'];
1186
+ for (_i = 0, _len = styles.length; _i < _len; _i++) {
1187
+ style = styles[_i];
1188
+ style_block += style + ":" + this.search_field.css(style) + ";";
1189
+ }
1190
+ div = $('<div />', {
1191
+ 'style': style_block
1192
+ });
1193
+ div.text(this.search_field.val());
1194
+ $('body').append(div);
1195
+ w = div.width() + 25;
1196
+ div.remove();
1197
+ f_width = this.container.outerWidth();
1198
+ if (w > f_width - 10) {
1199
+ w = f_width - 10;
1200
+ }
1201
+ return this.search_field.css({
1202
+ 'width': w + 'px'
1203
+ });
1204
+ }
1205
+ };
1206
+
1207
+ return Chosen;
1208
+
1209
+ })(AbstractChosen);
1210
+
1211
+ }).call(this);
assets/js/conditional-logic.js ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function($) {
2
+
3
+ var conditional_logic = {
4
+
5
+ init: function() {
6
+
7
+ var _this = this;
8
+ _this.change();
9
+
10
+ // events
11
+ $(document).on( 'change', '.wpuf-fields input, .wpuf-fields textarea, .wpuf-fields select', function(){
12
+ _this.change();
13
+ });
14
+ },
15
+
16
+ change: function() {
17
+
18
+ var cond_field_val = [],
19
+ all = [],
20
+ prefix = 'wpuf_';
21
+
22
+ if ( typeof wpuf_conditional_items === 'undefined' ) {
23
+ return;
24
+ }
25
+
26
+ $.each( wpuf_conditional_items, function( k, item ) {
27
+
28
+ $.each( item.cond_field, function( key, value ) {
29
+
30
+ var form_id = '_'+item.form_id,
31
+ selector = '.'+prefix+value+form_id,
32
+ value = item.cond_option[key],
33
+ operator = ( item.cond_operator[key] == '=' ) ? true : false,
34
+ select = $('select'+selector),
35
+ checkbox = $('input[type=checkbox][value="'+value+'"]'+selector ),
36
+ radio = $('input[type=radio][value="'+value+'"]'+selector),
37
+ select = $('select'+selector+'>option[value="'+value+'"]');
38
+
39
+
40
+ if ( select.length ) {
41
+
42
+ var select_selectd_status = select.is(':selected') ? true : false;
43
+
44
+ if ( operator && select_selectd_status ) {
45
+ all[key] = true;
46
+
47
+ } else if ( operator === false && select_selectd_status === false ) {
48
+ all[key] = true;
49
+
50
+ } else {
51
+ all[key] = false;
52
+ }
53
+ }
54
+
55
+ if ( radio.length ) {
56
+
57
+ var radio_checked_status = radio.is(':checked') ? true : false;
58
+
59
+ if ( operator && radio_checked_status ) {
60
+
61
+ all[key] = true;
62
+
63
+ } else if ( operator === false && radio_checked_status === false ) {
64
+
65
+ all[key] = true;
66
+
67
+ } else {
68
+ all[key] = false;
69
+ }
70
+ }
71
+
72
+ if ( checkbox.length ) {
73
+
74
+ var checkbox_checked_status = checkbox.is(':checked') ? true : false;
75
+
76
+ if( operator && checkbox_checked_status ) {
77
+ all[key] = true;
78
+
79
+ } else if ( operator === false && checkbox_checked_status === false ) {
80
+ all[key] = true;
81
+
82
+ } else {
83
+ all[key] = false;
84
+ }
85
+ }
86
+ });
87
+
88
+ if ( item.cond_logic == 'any') {
89
+
90
+ var check = all.indexOf( true );
91
+
92
+ if ( check != '-1') {
93
+
94
+ $( '.' + prefix + item.name + '_' + item.form_id).closest('li').show();
95
+
96
+ } else {
97
+
98
+ $( '.' + prefix + item.name + '_' + item.form_id).closest('li').hide();
99
+
100
+ }
101
+
102
+ } else {
103
+
104
+ var check = all.indexOf( false );
105
+
106
+ if ( check == '-1') {
107
+
108
+ $( '.' + prefix + item.name + '_' + item.form_id).closest('li').show();
109
+
110
+ } else {
111
+
112
+ $( '.' + prefix+item.name + '_' + item.form_id).closest('li').hide();
113
+ }
114
+
115
+ }
116
+
117
+ all.length = 0;
118
+ });
119
+ }
120
+ }
121
+
122
+ conditional_logic.init();
123
+ })(jQuery);
assets/js/conditional.js ADDED
@@ -0,0 +1,321 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * This is a JavaScript Scratchpad.
3
+ *
4
+ * Enter some JavaScript, then Right Click or choose from the Execute Menu:
5
+ * 1. Run to evaluate the selected text (Cmd-R),
6
+ * 2. Inspect to bring up an Object Inspector on the result (Cmd-I), or,
7
+ * 3. Display to insert the result in a comment after the selection. (Cmd-L)
8
+ */
9
+
10
+ (function($, window) {
11
+
12
+ var WPUF_Conditional = {
13
+
14
+ init: function() {
15
+ var form = $('#wpuf-form-editor');
16
+ form.on('click', 'a.wpuf-conditional-plus', this.duplicateRow);
17
+ form.on('click', 'a.wpuf-conditional-minus', this.removeRow);
18
+ form.on('click', 'input[type=radio].wpuf-conditional-enable', this.showHide);
19
+ form.on('change', 'input[type=text][data-type="label"]', this.labelRender );
20
+ form.on('change', 'input[type=text][data-type="option"]', this.optionRender );
21
+ form.on('change', 'input[type=text][data-type="option_value"]', this.optionRender );
22
+ form.on('change', 'select.wpuf-conditional-fields', this.optionChange);
23
+
24
+ this.getLabel( true );
25
+
26
+ //initially get options values array
27
+ this.getOption( true );
28
+
29
+ this.labelRender();
30
+ this.optionRender();
31
+
32
+ },
33
+
34
+
35
+ newOptionValue: [],
36
+
37
+ prevOptionValue: [],
38
+
39
+ prevLabelValue: [],
40
+
41
+ newLabelValue: [],
42
+
43
+ getOption: function( optionStatus ) {
44
+ var labels = $('#wpuf-form-editor').find('input[data-type="name"]');
45
+
46
+ $.each( labels, function(k, label_field ) {
47
+ var label = $(label_field),
48
+ label_name = label.val();
49
+ if( label_name != '' ) {
50
+
51
+ var label_option = label.closest('.wpuf-form-holder').find('input[data-type="option_value"]');
52
+
53
+ var generate = [];
54
+
55
+ $.each( label_option, function( key, option ) {
56
+ var field_value = $(option).val();
57
+ if ( field_value == '' ) {
58
+ var field_value = $(option).closest('div').find('input[data-type=option]').val();
59
+ }
60
+ generate.push( field_value );
61
+ });
62
+
63
+ if( optionStatus === true ) {
64
+ WPUF_Conditional.prevOptionValue[label_name] = generate;
65
+ }
66
+
67
+ if( optionStatus === false ) {
68
+ WPUF_Conditional.newOptionValue[label_name] = generate;
69
+ }
70
+ }
71
+ });
72
+ },
73
+
74
+ getLabel: function( labelStatus ) {
75
+ var label = $('#wpuf-form-editor').find('input[data-type="name"]'),
76
+ prev_label = WPUF_Conditional.prevLabelValue,
77
+ new_label = WPUF_Conditional.newLabelValue;
78
+
79
+ if( labelStatus === true ) {
80
+ prev_label.length = 0;
81
+ }
82
+
83
+ if( labelStatus === false ) {
84
+ new_label.length = 0;
85
+ }
86
+
87
+ $.each( label, function(k, label_field ) {
88
+ var label = $(label_field),
89
+ label_name = label.val();
90
+ if( label_name != '' && labelStatus === true ) {
91
+ prev_label.push( label_name );
92
+ }
93
+
94
+ if( label_name != '' && labelStatus === false ) {
95
+ new_label.push( label_name );
96
+ }
97
+ });
98
+ },
99
+
100
+ labelRender: function() {
101
+
102
+ //after change get options values array
103
+ WPUF_Conditional.getLabel( false );
104
+
105
+ var options = WPUF_Conditional.fieldDropdown(),
106
+ label = $('#wpuf-form-editor').find('input[data-type="name"]'),
107
+ cond_select_wraps = $('select.wpuf-conditional-fields'),
108
+ wrap = $('.wpuf-form-holder'),
109
+ prev_label = WPUF_Conditional.prevLabelValue,
110
+ new_label = WPUF_Conditional.newLabelValue;
111
+
112
+ $.each( wrap, function( key, parent ) {
113
+
114
+ var label_name = $(parent).find('input[data-type="name"]').val(),
115
+ cond_select_wraps = $(parent).find('select.wpuf-conditional-fields'),
116
+ new_option = [];
117
+
118
+ $.each( options, function( k, opt_value ) {
119
+ var opt_val = $( opt_value ).attr('value');
120
+
121
+ if( opt_val !== label_name || label_name == '' ) {
122
+ new_option.push( opt_value );
123
+ }
124
+
125
+ });
126
+
127
+ $.each( cond_select_wraps, function( i, select_val) {
128
+ var select = $(select_val),
129
+ select_val = select.val();
130
+
131
+ var index = new_label.indexOf( select_val );
132
+
133
+ if( index == '-1' ) {
134
+ var oldindex = prev_label.indexOf( select_val );
135
+ select.html( new_option.join('') ).val( new_label[oldindex] );
136
+ } else {
137
+ select.html( new_option.join('') ).val( select_val );
138
+ }
139
+ });
140
+ });
141
+
142
+
143
+
144
+ WPUF_Conditional.getLabel( true );
145
+ WPUF_Conditional.getOption( true );
146
+ },
147
+
148
+ optionRender: function() {
149
+
150
+ //after change get options values array
151
+ WPUF_Conditional.getOption( false );
152
+
153
+ var option = WPUF_Conditional.labelOptionValue,
154
+ cond_select_wraps = $('select.wpuf-conditional-fields');
155
+
156
+ $.each( cond_select_wraps, function( i, select_val) {
157
+
158
+ var select = $(select_val),
159
+ select_val = $(select_val).val(),
160
+ option_generate = WPUF_Conditional.optionDropdown( select_val ),
161
+ optionDropdown = select.closest('tr').find('select.wpuf-conditional-fields-option'),
162
+ option_prev_val = optionDropdown.val(),
163
+ prev_options = WPUF_Conditional.prevOptionValue,
164
+ new_options = WPUF_Conditional.newOptionValue;
165
+
166
+ if( select_val !== '' ) {
167
+
168
+ var index = new_options[select_val].indexOf( option_prev_val );
169
+
170
+ if( index == '-1') {
171
+
172
+ var oldindex = prev_options[select_val].indexOf( option_prev_val );
173
+
174
+ optionDropdown.html(option_generate).val( new_options[select_val][oldindex] );
175
+ } else {
176
+ optionDropdown.html(option_generate).val(option_prev_val);
177
+ }
178
+ } else {
179
+ optionDropdown.html('<option>- select -</option>');
180
+ }
181
+ });
182
+
183
+ WPUF_Conditional.getOption( true );
184
+ },
185
+
186
+
187
+ getFields: function() {
188
+ var elements = [],
189
+ form_editor = $('#wpuf-form-editor');
190
+
191
+ form_editor.find('li.wpuf-conditional').each(function(i, el) {
192
+ el = $(el);
193
+
194
+ var label = el.find('input[type=text][data-type="label"]').val(),
195
+ name = el.find('[data-type="name"]').val();
196
+
197
+ elements[i] = {
198
+ 'name': name,
199
+ 'label': label,
200
+ 'options': [],
201
+ 'values': [],
202
+ };
203
+
204
+ el.find('.wpuf-options [data-type="option"]').each(function(j, jel){
205
+ var option_value = $(this).siblings('input[data-type="option_value"]').val();
206
+ if ( option_value == '') {
207
+ option_value = $(jel).val();
208
+ }
209
+ elements[i].options.push( $(jel).val() );
210
+ elements[i].values.push( option_value );
211
+ });
212
+ });
213
+
214
+ return elements;
215
+ },
216
+
217
+ fieldDropdown: function() {
218
+
219
+ var fields = this.getFields(),
220
+ dropdown = [];
221
+
222
+ dropdown.push('<option value="">- select -</option>');
223
+
224
+ for( var field in fields ) {
225
+
226
+ var label = fields[field].label;
227
+ if( label != '') {
228
+ dropdown.push('<option value="' + fields[field].name + '">' + label + '</option>');
229
+ }
230
+ }
231
+
232
+ return dropdown;
233
+ },
234
+
235
+ optionDropdown: function(fieldName) {
236
+ var fields = this.getFields(),
237
+ dropdown = '<option value="">- select -</option>',
238
+ options = [],
239
+ values =[];
240
+
241
+ for(field in fields) {
242
+
243
+ if(fields[field].name === fieldName) {
244
+ options = fields[field].options;
245
+ values = fields[field].values;
246
+ }
247
+ }
248
+
249
+ for( var option in options ) {
250
+
251
+ var o = options[option],
252
+ v = values[option];
253
+ dropdown += '<option value="' + v + '">' + o + '</option>';
254
+ }
255
+
256
+ return dropdown;
257
+ },
258
+
259
+ fillFields: function() {
260
+ var options = this.fieldDropdown();
261
+ $('.wpuf-conditional-fields').each(function(i, el) {
262
+ $(el).empty().append(options);
263
+ });
264
+ },
265
+
266
+ showHide: function() {
267
+
268
+ var self = $(this),
269
+ parent = self.closest('.wpuf-form-sub-fields').find('.conditional-rules-wrap'),
270
+ val = self.val();
271
+
272
+ if ( val === 'yes' ) {
273
+ parent.removeClass('wpuf-hide');
274
+ WPUF_Conditional.labelRender();
275
+ WPUF_Conditional.optionRender();
276
+
277
+ } else {
278
+ parent.addClass('wpuf-hide');
279
+ }
280
+ },
281
+
282
+ duplicateRow: function(e) {
283
+ e.preventDefault();
284
+
285
+ var self = $(this),
286
+ tr = self.closest('tr');
287
+
288
+ tr.clone().insertAfter(tr);
289
+ },
290
+
291
+ removeRow: function(e) {
292
+ e.preventDefault();
293
+
294
+ var table = $(this).closest('table'),
295
+ rows = table.find('tr').length;
296
+
297
+ if ( rows > 1 ) {
298
+ $(this).closest('tr').remove();
299
+ }
300
+ },
301
+
302
+ optionChange: function() {
303
+ var self = $(this),
304
+ value = self.val(),
305
+ optionDropdown = self.closest('tr').find('select.wpuf-conditional-fields-option');
306
+
307
+ if ( value !== '' ) {
308
+ options = WPUF_Conditional.optionDropdown(value);
309
+ optionDropdown.empty().append(options);
310
+ } else {
311
+ optionDropdown.html('<option>- Select -</option>');
312
+ }
313
+ }
314
+ };
315
+
316
+ $(function(){
317
+ window.wpuf_conditional = WPUF_Conditional;
318
+ WPUF_Conditional.init();
319
+ });
320
+
321
+ })(jQuery, window);
assets/js/countries.json ADDED
@@ -0,0 +1,245 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {"name": "Afghanistan", "code": "AF"},
3
+ {"name": "Åland Islands", "code": "AX"},
4
+ {"name": "Albania", "code": "AL"},
5
+ {"name": "Algeria", "code": "DZ"},
6
+ {"name": "American Samoa", "code": "AS"},
7
+ {"name": "AndorrA", "code": "AD"},
8
+ {"name": "Angola", "code": "AO"},
9
+ {"name": "Anguilla", "code": "AI"},
10
+ {"name": "Antarctica", "code": "AQ"},
11
+ {"name": "Antigua and Barbuda", "code": "AG"},
12
+ {"name": "Argentina", "code": "AR"},
13
+ {"name": "Armenia", "code": "AM"},
14
+ {"name": "Aruba", "code": "AW"},
15
+ {"name": "Australia", "code": "AU"},
16
+ {"name": "Austria", "code": "AT"},
17
+ {"name": "Azerbaijan", "code": "AZ"},
18
+ {"name": "Bahamas", "code": "BS"},
19
+ {"name": "Bahrain", "code": "BH"},
20
+ {"name": "Bangladesh", "code": "BD"},
21
+ {"name": "Barbados", "code": "BB"},
22
+ {"name": "Belarus", "code": "BY"},
23
+ {"name": "Belgium", "code": "BE"},
24
+ {"name": "Belize", "code": "BZ"},
25
+ {"name": "Benin", "code": "BJ"},
26
+ {"name": "Bermuda", "code": "BM"},
27
+ {"name": "Bhutan", "code": "BT"},
28
+ {"name": "Bolivia", "code": "BO"},
29
+ {"name": "Bosnia and Herzegovina", "code": "BA"},
30
+ {"name": "Botswana", "code": "BW"},
31
+ {"name": "Bouvet Island", "code": "BV"},
32
+ {"name": "Brazil", "code": "BR"},
33
+ {"name": "British Indian Ocean Territory", "code": "IO"},
34
+ {"name": "Brunei Darussalam", "code": "BN"},
35
+ {"name": "Bulgaria", "code": "BG"},
36
+ {"name": "Burkina Faso", "code": "BF"},
37
+ {"name": "Burundi", "code": "BI"},
38
+ {"name": "Cambodia", "code": "KH"},
39
+ {"name": "Cameroon", "code": "CM"},
40
+ {"name": "Canada", "code": "CA"},
41
+ {"name": "Cape Verde", "code": "CV"},
42
+ {"name": "Cayman Islands", "code": "KY"},
43
+ {"name": "Central African Republic", "code": "CF"},
44
+ {"name": "Chad", "code": "TD"},
45
+ {"name": "Chile", "code": "CL"},
46
+ {"name": "China", "code": "CN"},
47
+ {"name": "Christmas Island", "code": "CX"},
48
+ {"name": "Cocos (Keeling) Islands", "code": "CC"},
49
+ {"name": "Colombia", "code": "CO"},
50
+ {"name": "Comoros", "code": "KM"},
51
+ {"name": "Congo", "code": "CG"},
52
+ {"name": "Congo, The Democratic Republic of the", "code": "CD"},
53
+ {"name": "Cook Islands", "code": "CK"},
54
+ {"name": "Costa Rica", "code": "CR"},
55
+ {"name": "Cote D\"Ivoire", "code": "CI"},
56
+ {"name": "Croatia", "code": "HR"},
57
+ {"name": "Cuba", "code": "CU"},
58
+ {"name": "Cyprus", "code": "CY"},
59
+ {"name": "Czech Republic", "code": "CZ"},
60
+ {"name": "Denmark", "code": "DK"},
61
+ {"name": "Djibouti", "code": "DJ"},
62
+ {"name": "Dominica", "code": "DM"},
63
+ {"name": "Dominican Republic", "code": "DO"},
64
+ {"name": "Ecuador", "code": "EC"},
65
+ {"name": "Egypt", "code": "EG"},
66
+ {"name": "El Salvador", "code": "SV"},
67
+ {"name": "Equatorial Guinea", "code": "GQ"},
68
+ {"name": "Eritrea", "code": "ER"},
69
+ {"name": "Estonia", "code": "EE"},
70
+ {"name": "Ethiopia", "code": "ET"},
71
+ {"name": "Falkland Islands (Malvinas)", "code": "FK"},
72
+ {"name": "Faroe Islands", "code": "FO"},
73
+ {"name": "Fiji", "code": "FJ"},
74
+ {"name": "Finland", "code": "FI"},
75
+ {"name": "France", "code": "FR"},
76
+ {"name": "French Guiana", "code": "GF"},
77
+ {"name": "French Polynesia", "code": "PF"},
78
+ {"name": "French Southern Territories", "code": "TF"},
79
+ {"name": "Gabon", "code": "GA"},
80
+ {"name": "Gambia", "code": "GM"},
81
+ {"name": "Georgia", "code": "GE"},
82
+ {"name": "Germany", "code": "DE"},
83
+ {"name": "Ghana", "code": "GH"},
84
+ {"name": "Gibraltar", "code": "GI"},
85
+ {"name": "Greece", "code": "GR"},
86
+ {"name": "Greenland", "code": "GL"},
87
+ {"name": "Grenada", "code": "GD"},
88
+ {"name": "Guadeloupe", "code": "GP"},
89
+ {"name": "Guam", "code": "GU"},
90
+ {"name": "Guatemala", "code": "GT"},
91
+ {"name": "Guernsey", "code": "GG"},
92
+ {"name": "Guinea", "code": "GN"},
93
+ {"name": "Guinea-Bissau", "code": "GW"},
94
+ {"name": "Guyana", "code": "GY"},
95
+ {"name": "Haiti", "code": "HT"},
96
+ {"name": "Heard Island and Mcdonald Islands", "code": "HM"},
97
+ {"name": "Holy See (Vatican City State)", "code": "VA"},
98
+ {"name": "Honduras", "code": "HN"},
99
+ {"name": "Hong Kong", "code": "HK"},
100
+ {"name": "Hungary", "code": "HU"},
101
+ {"name": "Iceland", "code": "IS"},
102
+ {"name": "India", "code": "IN"},
103
+ {"name": "Indonesia", "code": "ID"},
104
+ {"name": "Iran, Islamic Republic Of", "code": "IR"},
105
+ {"name": "Iraq", "code": "IQ"},
106
+ {"name": "Ireland", "code": "IE"},
107
+ {"name": "Isle of Man", "code": "IM"},
108
+ {"name": "Israel", "code": "IL"},
109
+ {"name": "Italy", "code": "IT"},
110
+ {"name": "Jamaica", "code": "JM"},
111
+ {"name": "Japan", "code": "JP"},
112
+ {"name": "Jersey", "code": "JE"},
113
+ {"name": "Jordan", "code": "JO"},
114
+ {"name": "Kazakhstan", "code": "KZ"},
115
+ {"name": "Kenya", "code": "KE"},
116
+ {"name": "Kiribati", "code": "KI"},
117
+ {"name": "Korea, Democratic People\"S Republic of", "code": "KP"},
118
+ {"name": "Korea, Republic of", "code": "KR"},
119
+ {"name": "Kuwait", "code": "KW"},
120
+ {"name": "Kyrgyzstan", "code": "KG"},
121
+ {"name": "Lao People\"S Democratic Republic", "code": "LA"},
122
+ {"name": "Latvia", "code": "LV"},
123
+ {"name": "Lebanon", "code": "LB"},
124
+ {"name": "Lesotho", "code": "LS"},
125
+ {"name": "Liberia", "code": "LR"},
126
+ {"name": "Libyan Arab Jamahiriya", "code": "LY"},
127
+ {"name": "Liechtenstein", "code": "LI"},
128
+ {"name": "Lithuania", "code": "LT"},
129
+ {"name": "Luxembourg", "code": "LU"},
130
+ {"name": "Macao", "code": "MO"},
131
+ {"name": "Macedonia, The Former Yugoslav Republic of", "code": "MK"},
132
+ {"name": "Madagascar", "code": "MG"},
133
+ {"name": "Malawi", "code": "MW"},
134
+ {"name": "Malaysia", "code": "MY"},
135
+ {"name": "Maldives", "code": "MV"},
136
+ {"name": "Mali", "code": "ML"},
137
+ {"name": "Malta", "code": "MT"},
138
+ {"name": "Marshall Islands", "code": "MH"},
139
+ {"name": "Martinique", "code": "MQ"},
140
+ {"name": "Mauritania", "code": "MR"},
141
+ {"name": "Mauritius", "code": "MU"},
142
+ {"name": "Mayotte", "code": "YT"},
143
+ {"name": "Mexico", "code": "MX"},
144
+ {"name": "Micronesia, Federated States of", "code": "FM"},
145
+ {"name": "Moldova, Republic of", "code": "MD"},
146
+ {"name": "Monaco", "code": "MC"},
147
+ {"name": "Mongolia", "code": "MN"},
148
+ {"name": "Montserrat", "code": "MS"},
149
+ {"name": "Morocco", "code": "MA"},
150
+ {"name": "Mozambique", "code": "MZ"},
151
+ {"name": "Myanmar", "code": "MM"},
152
+ {"name": "Namibia", "code": "NA"},
153
+ {"name": "Nauru", "code": "NR"},
154
+ {"name": "Nepal", "code": "NP"},
155
+ {"name": "Netherlands", "code": "NL"},
156
+ {"name": "Netherlands Antilles", "code": "AN"},
157
+ {"name": "New Caledonia", "code": "NC"},
158
+ {"name": "New Zealand", "code": "NZ"},
159
+ {"name": "Nicaragua", "code": "NI"},
160
+ {"name": "Niger", "code": "NE"},
161
+ {"name": "Nigeria", "code": "NG"},
162
+ {"name": "Niue", "code": "NU"},
163
+ {"name": "Norfolk Island", "code": "NF"},
164
+ {"name": "Northern Mariana Islands", "code": "MP"},
165
+ {"name": "Norway", "code": "NO"},
166
+ {"name": "Oman", "code": "OM"},
167
+ {"name": "Pakistan", "code": "PK"},
168
+ {"name": "Palau", "code": "PW"},
169
+ {"name": "Palestinian Territory, Occupied", "code": "PS"},
170
+ {"name": "Panama", "code": "PA"},
171
+ {"name": "Papua New Guinea", "code": "PG"},
172
+ {"name": "Paraguay", "code": "PY"},
173
+ {"name": "Peru", "code": "PE"},
174
+ {"name": "Philippines", "code": "PH"},
175
+ {"name": "Pitcairn", "code": "PN"},
176
+ {"name": "Poland", "code": "PL"},
177
+ {"name": "Portugal", "code": "PT"},
178
+ {"name": "Puerto Rico", "code": "PR"},
179
+ {"name": "Qatar", "code": "QA"},
180
+ {"name": "Reunion", "code": "RE"},
181
+ {"name": "Romania", "code": "RO"},
182
+ {"name": "Russian Federation", "code": "RU"},
183
+ {"name": "RWANDA", "code": "RW"},
184
+ {"name": "Saint Helena", "code": "SH"},
185
+ {"name": "Saint Kitts and Nevis", "code": "KN"},
186
+ {"name": "Saint Lucia", "code": "LC"},
187
+ {"name": "Saint Pierre and Miquelon", "code": "PM"},
188
+ {"name": "Saint Vincent and the Grenadines", "code": "VC"},
189
+ {"name": "Samoa", "code": "WS"},
190
+ {"name": "San Marino", "code": "SM"},
191
+ {"name": "Sao Tome and Principe", "code": "ST"},
192
+ {"name": "Saudi Arabia", "code": "SA"},
193
+ {"name": "Senegal", "code": "SN"},
194
+ {"name": "Serbia and Montenegro", "code": "CS"},
195
+ {"name": "Seychelles", "code": "SC"},
196
+ {"name": "Sierra Leone", "code": "SL"},
197
+ {"name": "Singapore", "code": "SG"},
198
+ {"name": "Slovakia", "code": "SK"},
199
+ {"name": "Slovenia", "code": "SI"},
200
+ {"name": "Solomon Islands", "code": "SB"},
201
+ {"name": "Somalia", "code": "SO"},
202
+ {"name": "South Africa", "code": "ZA"},
203
+ {"name": "South Georgia and the South Sandwich Islands", "code": "GS"},
204
+ {"name": "Spain", "code": "ES"},
205
+ {"name": "Sri Lanka", "code": "LK"},
206
+ {"name": "Sudan", "code": "SD"},
207
+ {"name": "Suriname", "code": "SR"},
208
+ {"name": "Svalbard and Jan Mayen", "code": "SJ"},
209
+ {"name": "Swaziland", "code": "SZ"},
210
+ {"name": "Sweden", "code": "SE"},
211
+ {"name": "Switzerland", "code": "CH"},
212
+ {"name": "Syrian Arab Republic", "code": "SY"},
213
+ {"name": "Taiwan, Province of China", "code": "TW"},
214
+ {"name": "Tajikistan", "code": "TJ"},
215
+ {"name": "Tanzania, United Republic of", "code": "TZ"},
216
+ {"name": "Thailand", "code": "TH"},
217
+ {"name": "Timor-Leste", "code": "TL"},
218
+ {"name": "Togo", "code": "TG"},
219
+ {"name": "Tokelau", "code": "TK"},
220
+ {"name": "Tonga", "code": "TO"},
221
+ {"name": "Trinidad and Tobago", "code": "TT"},
222
+ {"name": "Tunisia", "code": "TN"},
223
+ {"name": "Turkey", "code": "TR"},
224
+ {"name": "Turkmenistan", "code": "TM"},
225
+ {"name": "Turks and Caicos Islands", "code": "TC"},
226
+ {"name": "Tuvalu", "code": "TV"},
227
+ {"name": "Uganda", "code": "UG"},
228
+ {"name": "Ukraine", "code": "UA"},
229
+ {"name": "United Arab Emirates", "code": "AE"},
230
+ {"name": "United Kingdom", "code": "GB"},
231
+ {"name": "United States", "code": "US"},
232
+ {"name": "United States Minor Outlying Islands", "code": "UM"},
233
+ {"name": "Uruguay", "code": "UY"},
234
+ {"name": "Uzbekistan", "code": "UZ"},
235
+ {"name": "Vanuatu", "code": "VU"},
236
+ {"name": "Venezuela", "code": "VE"},
237
+ {"name": "Viet Nam", "code": "VN"},
238
+ {"name": "Virgin Islands, British", "code": "VG"},
239
+ {"name": "Virgin Islands, U.S.", "code": "VI"},
240
+ {"name": "Wallis and Futuna", "code": "WF"},
241
+ {"name": "Western Sahara", "code": "EH"},
242
+ {"name": "Yemen", "code": "YE"},
243
+ {"name": "Zambia", "code": "ZM"},
244
+ {"name": "Zimbabwe", "code": "ZW"}
245
+ ]
assets/js/formbuilder.js ADDED
@@ -0,0 +1,398 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*jshint devel:true */
2
+ /*global ajaxurl */
3
+
4
+ ;(function($) {
5
+
6
+ var $formEditor = $('ul#wpuf-form-editor');
7
+
8
+ var Editor = {
9
+ init: function() {
10
+
11
+ $(function() {
12
+ $('.wpuf-ms-color').wpColorPicker();
13
+ });
14
+
15
+ // make it sortable
16
+ this.makeSortable();
17
+
18
+ this.tooltip();
19
+ this.tabber();
20
+ this.showHideHelp();
21
+
22
+ var this_obj = this;
23
+ // Form Settings
24
+ $('#wpuf-metabox-settings').on('change', 'select[name="wpuf_settings[redirect_to]"]', this.settingsRedirect);
25
+ $('#wpuf-metabox-settings-update').on('change', 'select[name="wpuf_settings[edit_redirect_to]"]', this.settingsRedirect);
26
+ $('select[name="wpuf_settings[redirect_to]"]').change();
27
+ $('select[name="wpuf_settings[edit_redirect_to]"]').change();
28
+
29
+ // Form settings: Guest post
30
+ $('#wpuf-metabox-settings').on('change', 'input[type=checkbox][name="wpuf_settings[guest_post]"]', this.settingsGuest);
31
+ $('input[type=checkbox][name="wpuf_settings[guest_post]"]').trigger('change');
32
+
33
+ // From settings: User details
34
+ $('#wpuf-metabox-settings').on('change', 'input[type=checkbox][name="wpuf_settings[guest_details]"]', this.settingsGuestDetails);
35
+ // $('input[type=checkbox][name="wpuf_settings[guest_details]"]').trigger('change');
36
+
37
+ // collapse all
38
+ $('button.wpuf-collapse').on('click', this.collpaseEditFields);
39
+
40
+ // add field click
41
+ $('.wpuf-form-buttons').on('click', 'button', this.addNewField);
42
+
43
+ // remove form field
44
+ $('#wpuf-form-editor').on('click', '.wpuf-remove', this.removeFormField);
45
+
46
+ // on change event: meta key
47
+ $('#wpuf-form-editor').on('change', 'li.custom-field input[data-type="label"]', this.setMetaKey);
48
+
49
+ // on change event: checkbox|radio fields
50
+ $('#wpuf-form-editor').on('change', '.wpuf-form-sub-fields input[type=text]', function() {
51
+ var self = $(this),
52
+ value = self.closest('div').find('input[data-type=option_value]').val();
53
+
54
+ if ( value === '' ) {
55
+ var replace_val = self.closest('div').find('input[data-type=option]').val();
56
+ self.siblings('input[type=checkbox], input[type=radio]').val(replace_val);
57
+ } else {
58
+ self.siblings('input[type=checkbox], input[type=radio]').val(value);
59
+ }
60
+
61
+
62
+ });
63
+
64
+ // on change event: checkbox|radio fields
65
+ $('#wpuf-form-editor').on('click', 'input[type=checkbox].multicolumn', function() {
66
+ // $(this).prev('input[type=checkbox], input[type=radio]').val($(this).val());
67
+ var $self = $(this),
68
+ $parent = $self.closest('.wpuf-form-rows');
69
+
70
+ if ($self.is(':checked')) {
71
+ $parent.next().hide().next().hide();
72
+ $parent.siblings('.column-names').show();
73
+ } else {
74
+ $parent.next().show().next().show();
75
+ $parent.siblings('.column-names').hide();
76
+ }
77
+ });
78
+
79
+ // on change event: checkbox|radio fields
80
+ $('#wpuf-form-editor').on('click', 'input[type=checkbox].retype-pass', function() {
81
+ // $(this).prev('input[type=checkbox], input[type=radio]').val($(this).val());
82
+ var $self = $(this),
83
+ $parent = $self.closest('.wpuf-form-rows');
84
+
85
+ if ($self.is(':checked')) {
86
+ $parent.next().show().next().show();
87
+ } else {
88
+ $parent.next().hide().next().hide();
89
+ }
90
+ });
91
+
92
+ // woo attribute
93
+ $('#wpuf-form-editor').on('click', 'input[type=checkbox].woo_attr', function() {
94
+ var $self = $(this),
95
+ $parent = $self.closest('.wpuf-form-rows');
96
+
97
+ if ($self.is(':checked')) {
98
+ $parent.next().show();
99
+ } else {
100
+ $parent.next().hide();
101
+ }
102
+ });
103
+
104
+ // toggle form field
105
+ $('#wpuf-form-editor').on('click', '.wpuf-toggle', this.toggleFormField);
106
+
107
+ // clone and remove repeated field
108
+ $('#wpuf-form-editor').on('click', 'img.wpuf-clone-field', this.cloneField);
109
+ $('#wpuf-form-editor').on('click', 'img.wpuf-remove-field', this.removeField);
110
+ $('#wpuf-form-editor').on('click', '.wpuf-value-handelar', this.showValueField);
111
+
112
+ //on change enable expiration check status
113
+ this.changeExpirationFieldVisibility(':checkbox#wpuf-enable_post_expiration')
114
+ $('.wpuf-metabox-post_expiration').on('change',':checkbox#wpuf-enable_post_expiration',this.changeExpirationFieldVisibility);
115
+ //on change expiration type drop down
116
+ //$('.wpuf-metabox-post_expiration').on('change','select#wpuf-expiration_time_type',this.setTimeExpiration);
117
+
118
+ this_obj.changeMultistepVisibility( $('.wpuf_enable_multistep_section :input[type="checkbox"]') );
119
+ $('.wpuf_enable_multistep_section :input[type="checkbox"]').click(function(){
120
+ this_obj.changeMultistepVisibility( $(this) );
121
+ });
122
+
123
+ //when changing the post type from the drop down
124
+ $(document).on( 'change', ':input[name="wpuf_settings[post_type]"]', function() {
125
+ $('.attributes_holder, .wpuf-custom-tax-btn', '.wpuf-taxonomies-holder ' ).hide();
126
+ $( '.attributes_holder.' + $(this).val() + ', .wpuf-custom-tax-btn.' + $(this).val(),'.wpuf-taxonomies-holder ').show();
127
+ } );
128
+ },
129
+
130
+ changeMultistepVisibility : function( target ){
131
+ if(target.is(':checked')){
132
+ $('.wpuf_multistep_content').show();
133
+ }else{
134
+ $('.wpuf_multistep_content').hide();
135
+ }
136
+ },
137
+
138
+ showValueField: function() {
139
+ var self = $(this),
140
+ field = self.closest('div').find( 'input[data-type=option_value], span.wpuf-option-value');
141
+
142
+ if ( self.is(':checked') ) {
143
+ field.show();
144
+ } else {
145
+ field.hide();
146
+ }
147
+
148
+ },
149
+
150
+ showHideHelp: function() {
151
+ var childs = $('ul#wpuf-form-editor').children('li');
152
+
153
+ if ( !childs.length) {
154
+ $('.wpuf-updated').show();
155
+ } else {
156
+ $('.wpuf-updated').hide();
157
+ }
158
+ },
159
+
160
+ makeSortable: function() {
161
+ $formEditor = $('ul#wpuf-form-editor');
162
+
163
+ if ($formEditor) {
164
+ $formEditor.sortable({
165
+ placeholder: "ui-state-highlight",
166
+ handle: '> .wpuf-legend',
167
+ distance: 5
168
+ });
169
+ }
170
+ },
171
+
172
+ addNewField: function(e) {
173
+ e.preventDefault();
174
+
175
+ var $self = $(this),
176
+ $formEditor = $('ul#wpuf-form-editor'),
177
+ name = $self.data('name'),
178
+ type = $self.data('type'),
179
+ data = {
180
+ name: name,
181
+ type: type,
182
+ order: $formEditor.find('li').length + 1,
183
+ action: 'wpuf_form_add_el'
184
+ };
185
+
186
+ // console.log($self, data);
187
+
188
+ // check if these are already inserted
189
+ var oneInstance = ['post_title', 'post_content', 'post_excerpt', 'featured_image',
190
+ 'user_login', 'first_name', 'last_name', 'nickname', 'user_email', 'user_url',
191
+ 'user_bio', 'password', 'user_avatar'];
192
+
193
+ if ($.inArray(name, oneInstance) >= 0) {
194
+ if( $formEditor.find('li.' + name).length ) {
195
+ alert('You already have this field in the form');
196
+ return false;
197
+ }
198
+ }
199
+
200
+ $('.wpuf-loading').removeClass('hide');
201
+ $.post(ajaxurl, data, function(res) {
202
+ $formEditor.append(res);
203
+
204
+ // re-call sortable
205
+ Editor.makeSortable();
206
+
207
+ // enable tooltip
208
+ Editor.tooltip();
209
+
210
+ $('.wpuf-loading').addClass('hide');
211
+ Editor.showHideHelp();
212
+ });
213
+ },
214
+
215
+ removeFormField: function(e) {
216
+ e.preventDefault();
217
+
218
+ if (confirm('are you sure?')) {
219
+
220
+ $(this).closest('li').fadeOut(function() {
221
+ $(this).remove();
222
+
223
+ Editor.showHideHelp();
224
+ });
225
+ }
226
+ },
227
+
228
+ toggleFormField: function(e) {
229
+ e.preventDefault();
230
+
231
+ $(this).closest('li').find('.wpuf-form-holder').slideToggle('fast');
232
+ },
233
+
234
+ cloneField: function(e) {
235
+ e.preventDefault();
236
+
237
+ var $div = $(this).closest('div');
238
+ var $clone = $div.clone();
239
+ // console.log($clone);
240
+
241
+ //clear the inputs
242
+ $clone.find('input').val('');
243
+ $clone.find(':checked').attr('checked', '');
244
+ $div.after($clone);
245
+ },
246
+
247
+ removeField: function() {
248
+ //check if it's the only item
249
+ var $parent = $(this).closest('div');
250
+ var items = $parent.siblings('.wpuf-clone-field').andSelf().length;
251
+
252
+ if( items > 1 ) {
253
+ $parent.remove();
254
+ }
255
+ },
256
+
257
+ setMetaKey: function() {
258
+ var $self = $(this),
259
+ val = $self.val().toLowerCase().split(' ').join('_').split('\'').join(''),
260
+ $metaKey = $(this).closest('.wpuf-form-rows').next().find('input[type=text]');
261
+
262
+ val = val.replace(/[^a-z0-9]|\s+|\r?\n|\r/gmi, "_");
263
+
264
+ if ($metaKey.length && !$metaKey.val()) {
265
+ $metaKey.val(val);
266
+ }
267
+ },
268
+
269
+ tooltip: function() {
270
+ $('.smallipopInput').smallipop({
271
+ preferredPosition: 'right',
272
+ theme: 'black',
273
+ popupOffset: 0,
274
+ triggerOnClick: true
275
+ });
276
+ },
277
+
278
+ collpaseEditFields: function(e) {
279
+ e.preventDefault();
280
+
281
+ $('ul#wpuf-form-editor').children('li').find('.wpuf-form-holder').slideToggle();
282
+ },
283
+
284
+ settingsGuest: function (e) {
285
+ e.preventDefault();
286
+
287
+ var table = $(this).closest('table');
288
+
289
+ if ( $(this).is(':checked') ) {
290
+ table.find('tr.show-if-guest').show();
291
+ table.find('tr.show-if-not-guest').hide();
292
+
293
+ $('input[type=checkbox][name="wpuf_settings[guest_details]"]').trigger('change');
294
+
295
+ } else {
296
+ table.find('tr.show-if-guest').hide();
297
+ table.find('tr.show-if-not-guest').show();
298
+ }
299
+ },
300
+
301
+ settingsGuestDetails: function (e) {
302
+ e.preventDefault();
303
+
304
+ var table = $(this).closest('table');
305
+
306
+ if ( $(this).is(':checked') ) {
307
+ table.find('tr.show-if-details').show();
308
+ } else {
309
+ table.find('tr.show-if-details').hide();
310
+ }
311
+ },
312
+
313
+ settingsRedirect: function(e) {
314
+ e.preventDefault();
315
+
316
+ var $self = $(this),
317
+ $table = $self.closest('table'),
318
+ value = $self.val();
319
+
320
+ switch( value ) {
321
+ case 'post':
322
+ $table.find('tr.wpuf-page-id, tr.wpuf-url, tr.wpuf-same-page').hide();
323
+ break;
324
+
325
+ case 'page':
326
+ $table.find('tr.wpuf-page-id').show();
327
+ $table.find('tr.wpuf-same-page').hide();
328
+ $table.find('tr.wpuf-url').hide();
329
+ break;
330
+
331
+ case 'url':
332
+ $table.find('tr.wpuf-page-id').hide();
333
+ $table.find('tr.wpuf-same-page').hide();
334
+ $table.find('tr.wpuf-url').show();
335
+ break;
336
+
337
+ case 'same':
338
+ $table.find('tr.wpuf-page-id').hide();
339
+ $table.find('tr.wpuf-url').hide();
340
+ $table.find('tr.wpuf-same-page').show();
341
+ break;
342
+ }
343
+ },
344
+
345
+ tabber: function() {
346
+ // Switches option sections
347
+ $('.group').hide();
348
+ $('.group:first').fadeIn();
349
+
350
+ $('.group .collapsed').each(function(){
351
+ $(this).find('input:checked').parent().parent().parent().nextAll().each(
352
+ function(){
353
+ if ($(this).hasClass('last')) {
354
+ $(this).removeClass('hidden');
355
+ return false;
356
+ }
357
+ $(this).filter('.hidden').removeClass('hidden');
358
+ });
359
+ });
360
+
361
+ $('.nav-tab-wrapper a:first').addClass('nav-tab-active');
362
+
363
+ $('.nav-tab-wrapper a').click(function(evt) {
364
+ $('.nav-tab-wrapper a').removeClass('nav-tab-active');
365
+ $(this).addClass('nav-tab-active').blur();
366
+ var clicked_group = $(this).attr('href');
367
+ $('.group').hide();
368
+ $(clicked_group).fadeIn();
369
+ evt.preventDefault();
370
+ });
371
+ },
372
+
373
+ setTimeExpiration: function(e){
374
+ var timeArray = {
375
+ 'day' : 30,
376
+ 'month' : 12,
377
+ 'year': 100
378
+ };
379
+ $('#wpuf-expiration_time_value').html('');
380
+ var timeVal = e.target?$(e.target).val():$(e).val();
381
+ for(var time = 1; time <= timeArray[timeVal]; time++){
382
+ $('#wpuf-expiration_time_value').append('<option value="'+ time +'" >'+ time +'</option>');
383
+ }
384
+ },
385
+
386
+ changeExpirationFieldVisibility : function(e){
387
+ console.log(e);
388
+ var checkbox_obj = e.target? $(e.target):$(e);
389
+ checkbox_obj.is(':checked')?$('.wpuf_expiration_field').show():$('.wpuf_expiration_field').hide();
390
+ }
391
+ };
392
+
393
+ // on DOM ready
394
+ $(function() {
395
+ Editor.init();
396
+ });
397
+
398
+ })(jQuery);
assets/js/formbuilder.min.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(e){var t=e("ul#wpuf-form-editor"),i={init:function(){this.makeSortable(),this.tooltip(),this.tabber(),this.showHideHelp(),e("#wpuf-metabox-settings").on("change",'select[name="wpuf_settings[redirect_to]"]',this.settingsRedirect),e("#wpuf-metabox-settings-update").on("change",'select[name="wpuf_settings[edit_redirect_to]"]',this.settingsRedirect),e('select[name="wpuf_settings[redirect_to]"]').change(),e('select[name="wpuf_settings[edit_redirect_to]"]').change(),e("#wpuf-metabox-settings").on("change",'input[type=checkbox][name="wpuf_settings[guest_post]"]',this.settingsGuest),e('input[type=checkbox][name="wpuf_settings[guest_post]"]').trigger("change"),e("#wpuf-metabox-settings").on("change",'input[type=checkbox][name="wpuf_settings[guest_details]"]',this.settingsGuestDetails),e("button.wpuf-collapse").on("click",this.collpaseEditFields),e(".wpuf-form-buttons").on("click","button",this.addNewField),e("#wpuf-form-editor").on("click",".wpuf-remove",this.removeFormField),e("#wpuf-form-editor").on("change",'li.custom-field input[data-type="label"]',this.setMetaKey),e("#wpuf-form-editor").on("change",".wpuf-form-sub-fields input[type=text]",function(){var t=e(this),i=t.closest("div").find("input[data-type=option_value]").val();if(""===i){var s=t.closest("div").find("input[data-type=option]").val();t.siblings("input[type=checkbox], input[type=radio]").val(s)}else t.siblings("input[type=checkbox], input[type=radio]").val(i)}),e("#wpuf-form-editor").on("click","input[type=checkbox].multicolumn",function(){var t=e(this),i=t.closest(".wpuf-form-rows");t.is(":checked")?(i.next().hide().next().hide(),i.siblings(".column-names").show()):(i.next().show().next().show(),i.siblings(".column-names").hide())}),e("#wpuf-form-editor").on("click","input[type=checkbox].retype-pass",function(){var t=e(this),i=t.closest(".wpuf-form-rows");t.is(":checked")?i.next().show().next().show():i.next().hide().next().hide()}),e("#wpuf-form-editor").on("click","input[type=checkbox].woo_attr",function(){var t=e(this),i=t.closest(".wpuf-form-rows");t.is(":checked")?i.next().show():i.next().hide()}),e("#wpuf-form-editor").on("click",".wpuf-toggle",this.toggleFormField),e("#wpuf-form-editor").on("click","img.wpuf-clone-field",this.cloneField),e("#wpuf-form-editor").on("click","img.wpuf-remove-field",this.removeField),e("#wpuf-form-editor").on("click",".wpuf-value-handelar",this.showValueField)},showValueField:function(){var t=e(this),i=t.closest("div").find("input[data-type=option_value], span.wpuf-option-value");t.is(":checked")?i.show():i.hide()},showHideHelp:function(){var t=e("ul#wpuf-form-editor").children("li");t.length?e(".wpuf-updated").hide():e(".wpuf-updated").show()},makeSortable:function(){t=e("ul#wpuf-form-editor"),t&&t.sortable({placeholder:"ui-state-highlight",handle:"> .wpuf-legend",distance:5})},addNewField:function(t){t.preventDefault();var s=e(this),n=e("ul#wpuf-form-editor"),o=s.data("name"),a=s.data("type"),r={name:o,type:a,order:n.find("li").length+1,action:"wpuf_form_add_el"},l=["post_title","post_content","post_excerpt","featured_image","user_login","first_name","last_name","nickname","user_email","user_url","user_bio","password","user_avatar"];return e.inArray(o,l)>=0&&n.find("li."+o).length?(alert("You already have this field in the form"),!1):(e(".wpuf-loading").removeClass("hide"),void e.post(ajaxurl,r,function(t){n.append(t),i.makeSortable(),i.tooltip(),e(".wpuf-loading").addClass("hide"),i.showHideHelp()}))},removeFormField:function(t){t.preventDefault(),confirm("are you sure?")&&e(this).closest("li").fadeOut(function(){e(this).remove(),i.showHideHelp()})},toggleFormField:function(t){t.preventDefault(),e(this).closest("li").find(".wpuf-form-holder").slideToggle("fast")},cloneField:function(t){t.preventDefault();var i=e(this).closest("div"),s=i.clone();s.find("input").val(""),s.find(":checked").attr("checked",""),i.after(s)},removeField:function(){var t=e(this).closest("div"),i=t.siblings(".wpuf-clone-field").andSelf().length;i>1&&t.remove()},setMetaKey:function(){var t=e(this),i=t.val().toLowerCase().split(" ").join("_").split("'").join(""),s=e(this).closest(".wpuf-form-rows").next().find("input[type=text]");i=i.replace(/[^a-z0-9]|\s+|\r?\n|\r/gim,"_"),s.length&&s.val(i)},tooltip:function(){e(".smallipopInput").smallipop({preferredPosition:"right",theme:"black",popupOffset:0,triggerOnClick:!0})},collpaseEditFields:function(t){t.preventDefault(),e("ul#wpuf-form-editor").children("li").find(".wpuf-form-holder").slideToggle()},settingsGuest:function(t){t.preventDefault();var i=e(this).closest("table");e(this).is(":checked")?(i.find("tr.show-if-guest").show(),i.find("tr.show-if-not-guest").hide(),e('input[type=checkbox][name="wpuf_settings[guest_details]"]').trigger("change")):(i.find("tr.show-if-guest").hide(),i.find("tr.show-if-not-guest").show())},settingsGuestDetails:function(t){t.preventDefault();var i=e(this).closest("table");e(this).is(":checked")?i.find("tr.show-if-details").show():i.find("tr.show-if-details").hide()},settingsRedirect:function(t){t.preventDefault();var i=e(this),s=i.closest("table"),n=i.val();switch(n){case"post":s.find("tr.wpuf-page-id, tr.wpuf-url, tr.wpuf-same-page").hide();break;case"page":s.find("tr.wpuf-page-id").show(),s.find("tr.wpuf-same-page").hide(),s.find("tr.wpuf-url").hide();break;case"url":s.find("tr.wpuf-page-id").hide(),s.find("tr.wpuf-same-page").hide(),s.find("tr.wpuf-url").show();break;case"same":s.find("tr.wpuf-page-id").hide(),s.find("tr.wpuf-url").hide(),s.find("tr.wpuf-same-page").show()}},tabber:function(){e(".group").hide(),e(".group:first").fadeIn(),e(".group .collapsed").each(function(){e(this).find("input:checked").parent().parent().parent().nextAll().each(function(){return e(this).hasClass("last")?(e(this).removeClass("hidden"),!1):void e(this).filter(".hidden").removeClass("hidden")})}),e(".nav-tab-wrapper a:first").addClass("nav-tab-active"),e(".nav-tab-wrapper a").click(function(t){e(".nav-tab-wrapper a").removeClass("nav-tab-active"),e(this).addClass("nav-tab-active").blur();var i=e(this).attr("href");e(".group").hide(),e(i).fadeIn(),t.preventDefault()})}};e(function(){i.init()})}(jQuery);
assets/js/frontend-form.js ADDED
@@ -0,0 +1,866 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ;(function($, window) {
2
+
3
+ $.fn.listautowidth = function() {
4
+ return this.each(function() {
5
+ var w = $(this).width();
6
+ var liw = w / $(this).children('li').length;
7
+ $(this).children('li').each(function(){
8
+ var s = $(this).outerWidth(true)-$(this).width();
9
+ $(this).width(liw-s);
10
+ });
11
+ });
12
+ };
13
+
14
+ window.WP_User_Frontend = {
15
+
16
+ pass_val : '',
17
+ retype_pass_val : '',
18
+
19
+ init: function() {
20
+
21
+ //enable multistep
22
+ this.enableMultistep(this);
23
+
24
+ // clone and remove repeated field
25
+ $('.wpuf-form').on('click', 'img.wpuf-clone-field', this.cloneField);
26
+ $('.wpuf-form').on('click', 'img.wpuf-remove-field', this.removeField);
27
+ $('.wpuf-form').on('click', 'a.wpuf-delete-avatar', this.deleteAvatar);
28
+ $('.wpuf-form').on('click', 'a#wpuf-post-draft', this.draftPost);
29
+
30
+ $('.wpuf-form-add').on('submit', this.formSubmit);
31
+ $('form#post').on('submit', this.adminPostSubmit);
32
+ $( '.wpuf-form').on('keyup', '#pass1', this.check_pass_strength );
33
+
34
+ this.ajaxCategory();
35
+ // image insert
36
+ // this.insertImage();
37
+
38
+ //comfirmation alert for canceling subscription
39
+ $( ':submit[name="wpuf_cancel_subscription"]').click(function(){
40
+ if ( !confirm( 'Are you sure you want to cancel your current subscription ?' ) ) {
41
+ return false;
42
+ }
43
+
44
+ });
45
+ },
46
+
47
+ check_pass_strength : function() {
48
+ var pass1 = $('#pass1').val(), strength;
49
+
50
+ $('#pass-strength-result').removeClass('short bad good strong');
51
+ if ( ! pass1 ) {
52
+ $('#pass-strength-result').html( '&nbsp;' );
53
+ return;
54
+ }
55
+
56
+ if ( typeof wp.passwordStrength != 'undefined' ) {
57
+
58
+ strength = wp.passwordStrength.meter( pass1, wp.passwordStrength.userInputBlacklist(), pass1 );
59
+
60
+ switch ( strength ) {
61
+ case 2:
62
+ $('#pass-strength-result').addClass('bad').html( pwsL10n.bad );
63
+ break;
64
+ case 3:
65
+ $('#pass-strength-result').addClass('good').html( pwsL10n.good );
66
+ break;
67
+ case 4:
68
+ $('#pass-strength-result').addClass('strong').html( pwsL10n.strong );
69
+ break;
70
+ case 5:
71
+ $('#pass-strength-result').addClass('short').html( pwsL10n.mismatch );
72
+ break;
73
+ default:
74
+ $('#pass-strength-result').addClass('short').html( pwsL10n['short'] );
75
+ }
76
+
77
+ }
78
+ },
79
+
80
+ enableMultistep: function(o) {
81
+
82
+ var js_obj = this;
83
+ var step_number = 0;
84
+ var progressbar_type = $(':hidden[name="wpuf_multistep_type"]').val();
85
+
86
+ if ( progressbar_type == null ) {
87
+ return;
88
+ }
89
+
90
+ // first fieldset doesn't have prev button,
91
+ // last fieldset doesn't have next button
92
+ $('fieldset:first .wpuf-multistep-prev-btn').remove();
93
+ $('fieldset:last .wpuf-multistep-next-btn').remove();
94
+
95
+ // at first first fieldset will be shown, and others will be hidden
96
+ $('.wpuf-form fieldset').removeClass('field-active').first().addClass('field-active');
97
+
98
+ if ( progressbar_type == 'progressive' && $('.wpuf-form .wpuf-multistep-fieldset').length != 0 ) {
99
+
100
+ var firstLegend = $('fieldset.wpuf-multistep-fieldset legend').first();
101
+ $('.wpuf-multistep-progressbar').html('<div class="wpuf-progress-percentage"></div>' );
102
+
103
+ var progressbar = $( ".wpuf-multistep-progressbar" ),
104
+ progressLabel = $( ".wpuf-progress-percentage" );
105
+
106
+ $( ".wpuf-multistep-progressbar" ).progressbar({
107
+ change: function() {
108
+ progressLabel.text( progressbar.progressbar( "value" ) + "%" );
109
+ }
110
+ });
111
+
112
+ $('.wpuf-multistep-fieldset legend').hide();
113
+
114
+ } else {
115
+ $('.wpuf-form').each(function() {
116
+ var this_obj = $(this);
117
+ var progressbar = $('.wpuf-multistep-progressbar', this_obj);
118
+ var nav = '';
119
+
120
+ progressbar.addClass('wizard-steps');
121
+ nav += '<ul class="wpuf-step-wizard">';
122
+
123
+ $('.wpuf-multistep-fieldset', this).each(function(){
124
+ nav += '<li>' + $.trim( $('legend', this).text() ) + '</li>';
125
+ $('legend', this).hide();
126
+ });
127
+
128
+ nav += '</ul>';
129
+ progressbar.append( nav );
130
+
131
+ $('.wpuf-step-wizard li', progressbar).first().addClass('active-step');
132
+ $('.wpuf-step-wizard', progressbar).listautowidth();
133
+ });
134
+ }
135
+
136
+ this.change_fieldset(step_number, progressbar_type);
137
+
138
+ $('fieldset .wpuf-multistep-prev-btn, fieldset .wpuf-multistep-next-btn').click(function(e) {
139
+
140
+ // js_obj.formSubmit();
141
+ if ( $(this).hasClass('wpuf-multistep-next-btn') ) {
142
+ var result = js_obj.formStepCheck( '', $(this).parent() );
143
+
144
+ if ( result != false ) {
145
+ o.change_fieldset(++step_number,progressbar_type);
146
+ }
147
+
148
+ } else if ( $(this).hasClass('wpuf-multistep-prev-btn') ) {
149
+ o.change_fieldset( --step_number,progressbar_type );
150
+ }
151
+
152
+ return false;
153
+ });
154
+ },
155
+
156
+ change_fieldset: function(step_number, progressbar_type) {
157
+ $('fieldset.wpuf-multistep-fieldset').removeClass('field-active').eq(step_number).addClass('field-active');
158
+
159
+ $('.wpuf-step-wizard li').each(function(){
160
+ if ( $(this).index() <= step_number ){
161
+ progressbar_type == 'step_by_step'? $(this).addClass('passed-wpuf-ms-bar') : $('.wpuf-ps-bar',this).addClass('passed-wpuf-ms-bar');
162
+ } else {
163
+ progressbar_type == 'step_by_step'? $(this).removeClass('passed-wpuf-ms-bar') : $('.wpuf-ps-bar',this).removeClass('passed-wpuf-ms-bar');
164
+ }
165
+ });
166
+
167
+ $('.wpuf-step-wizard li').removeClass('wpuf-ms-bar-active active-step completed-step');
168
+ $('.passed-wpuf-ms-bar').addClass('completed-step').last().addClass('wpuf-ms-bar-active');
169
+ $('.wpuf-ms-bar-active').addClass('active-step');
170
+
171
+ var legend = $('fieldset.wpuf-multistep-fieldset').eq(step_number).find('legend').text();
172
+ legend = $.trim( legend );
173
+
174
+ if ( progressbar_type == 'progressive' && $('.wpuf-form .wpuf-multistep-fieldset').length != 0 ) {
175
+ var progress_percent = ( step_number + 1 ) * 100 / $('fieldset.wpuf-multistep-fieldset').length ;
176
+ var progress_percent = Number( progress_percent.toFixed(2) );
177
+ $( ".wpuf-multistep-progressbar" ).progressbar({value: progress_percent });
178
+ $( '.wpuf-progress-percentage' ).text( legend + ' (' + progress_percent + '%)');
179
+ }
180
+
181
+ // trigger a change event
182
+ $('.wpuf-form').trigger('step-change-fieldset');
183
+ },
184
+
185
+ ajaxCategory: function () {
186
+
187
+ var el = '.cat-ajax',
188
+ wrap = '.category-wrap';
189
+
190
+ $(wrap).on('change', el, function(){
191
+ currentLevel = parseInt( $(this).parent().attr('level') );
192
+ WP_User_Frontend.getChildCats( $(this), 'lvl', currentLevel+1, wrap, 'category');
193
+ });
194
+ },
195
+
196
+ getChildCats: function (dropdown, result_div, level, wrap_div, taxonomy) {
197
+
198
+ cat = $(dropdown).val();
199
+ results_div = result_div + level;
200
+ taxonomy = typeof taxonomy !== 'undefined' ? taxonomy : 'category';
201
+ field_attr = $(dropdown).siblings('span').data('taxonomy');
202
+
203
+ $.ajax({
204
+ type: 'post',
205
+ url: wpuf_frontend.ajaxurl,
206
+ data: {
207
+ action: 'wpuf_get_child_cat',
208
+ catID: cat,
209
+ nonce: wpuf_frontend.nonce,
210
+ field_attr: field_attr
211
+ },
212
+ beforeSend: function() {
213
+ $(dropdown).parent().parent().next('.loading').addClass('wpuf-loading');
214
+ },
215
+ complete: function() {
216
+ $(dropdown).parent().parent().next('.loading').removeClass('wpuf-loading');
217
+ },
218
+ success: function(html) {
219
+ //console.log( html ); return;
220
+ $(dropdown).parent().nextAll().each(function(){
221
+ $(this).remove();
222
+ });
223
+
224
+ if(html != "") {
225
+ $(dropdown).parent().addClass('hasChild').parent().append('<div id="'+result_div+level+'" level="'+level+'"></div>');
226
+ dropdown.parent().parent().find('#'+results_div).html(html).slideDown('fast');
227
+ }
228
+ }
229
+ });
230
+ },
231
+
232
+ cloneField: function(e) {
233
+ e.preventDefault();
234
+
235
+ var $div = $(this).closest('tr');
236
+ var $clone = $div.clone();
237
+ // console.log($clone);
238
+
239
+ //clear the inputs
240
+ $clone.find('input').val('');
241
+ $clone.find(':checked').attr('checked', '');
242
+ $div.after($clone);
243
+ },
244
+
245
+ removeField: function() {
246
+ //check if it's the only item
247
+ var $parent = $(this).closest('tr');
248
+ var items = $parent.siblings().andSelf().length;
249
+
250
+ if( items > 1 ) {
251
+ $parent.remove();
252
+ }
253
+ },
254
+
255
+ adminPostSubmit: function(e) {
256
+ e.preventDefault();
257
+
258
+ var form = $(this),
259
+ form_data = WP_User_Frontend.validateForm(form);
260
+
261
+ if (form_data) {
262
+ return true;
263
+ }
264
+ },
265
+
266
+ draftPost: function (e) {
267
+ e.preventDefault();
268
+
269
+ var self = $(this),
270
+ form = $(this).closest('form'),
271
+ form_data = form.serialize() + '&action=wpuf_draft_post',
272
+ post_id = form.find('input[type="hidden"][name="post_id"]').val();
273
+
274
+ var rich_texts = [],
275
+ temp, val;
276
+
277
+ // grab rich texts from tinyMCE
278
+ $('.wpuf-rich-validation').each(function (index, item) {
279
+ temp = $(item).data('id');
280
+ val = $.trim( tinyMCE.get(temp).getContent() );
281
+
282
+ rich_texts.push(temp + '=' + encodeURIComponent( val ) );
283
+ });
284
+
285
+ // append them to the form var
286
+ form_data = form_data + '&' + rich_texts.join('&');
287
+
288
+
289
+ self.after(' <span class="wpuf-loading"></span>');
290
+ $.post(wpuf_frontend.ajaxurl, form_data, function(res) {
291
+ // console.log(res, post_id);
292
+ if ( typeof post_id === 'undefined') {
293
+ var html = '<input type="hidden" name="post_id" value="' + res.post_id +'">';
294
+ html += '<input type="hidden" name="post_date" value="' + res.date +'">';
295
+ html += '<input type="hidden" name="post_author" value="' + res.post_author +'">';
296
+ html += '<input type="hidden" name="comment_status" value="' + res.comment_status +'">';
297
+
298
+ form.append( html );
299
+ }
300
+
301
+ self.next('span.wpuf-loading').remove();
302
+
303
+ self.after('<span class="wpuf-draft-saved">&nbsp; Post Saved</span>');
304
+ $('.wpuf-draft-saved').delay(2500).fadeOut('fast', function(){
305
+ $(this).remove();
306
+ });
307
+ })
308
+ },
309
+
310
+ formStepCheck : function(e,fieldset) {
311
+ var form = fieldset,
312
+ submitButton = form.find('input[type=submit]');
313
+ form_data = WP_User_Frontend.validateForm(form);
314
+ if( form_data == false ) {
315
+ WP_User_Frontend.addErrorNotice( self, 'bottom' );
316
+ }
317
+ return form_data;
318
+ },
319
+
320
+ formSubmit: function(e) {
321
+ e.preventDefault();
322
+
323
+ var form = $(this),
324
+ submitButton = form.find('input[type=submit]')
325
+ form_data = WP_User_Frontend.validateForm(form);
326
+
327
+ if (form_data) {
328
+
329
+ // send the request
330
+ form.find('li.wpuf-submit').append('<span class="wpuf-loading"></span>');
331
+ submitButton.attr('disabled', 'disabled').addClass('button-primary-disabled');
332
+
333
+ $.post(wpuf_frontend.ajaxurl, form_data, function(res) {
334
+ // var res = $.parseJSON(res);
335
+
336
+ if ( res.success) {
337
+
338
+ // enable external plugins to use events
339
+ $('body').trigger('wpuf:postform:success', res);
340
+
341
+ if( res.show_message == true) {
342
+ form.before( '<div class="wpuf-success">' + res.message + '</div>');
343
+ form.slideUp( 'fast', function() {
344
+ form.remove();
345
+ });
346
+
347
+ //focus
348
+ $('html, body').animate({
349
+ scrollTop: $('.wpuf-success').offset().top - 100
350
+ }, 'fast');
351
+
352
+ } else {
353
+ window.location = res.redirect_to;
354
+ }
355
+
356
+ } else {
357
+
358
+ if ( typeof res.type !== 'undefined' && res.type === 'login' ) {
359
+
360
+ if ( confirm(res.error) ) {
361
+ window.location = res.redirect_to;
362
+ } else {
363
+ submitButton.removeAttr('disabled');
364
+ submitButton.removeClass('button-primary-disabled');
365
+ form.find('span.wpuf-loading').remove();
366
+ }
367
+
368
+ return;
369
+ } else {
370
+ alert( res.error );
371
+ }
372
+
373
+ submitButton.removeAttr('disabled');
374
+ }
375
+
376
+ submitButton.removeClass('button-primary-disabled');
377
+ form.find('span.wpuf-loading').remove();
378
+ });
379
+ }
380
+ },
381
+
382
+ validateForm: function( self ) {
383
+
384
+ var temp,
385
+ temp_val = '',
386
+ error = false,
387
+ error_items = [];
388
+ error_type = '';
389
+
390
+ // remove all initial errors if any
391
+ WP_User_Frontend.removeErrors(self);
392
+ WP_User_Frontend.removeErrorNotice(self);
393
+
394
+ // ===== Validate: Text and Textarea ========
395
+ var required = self.find('[data-required="yes"]:visible');
396
+
397
+ required.each(function(i, item) {
398
+ // temp_val = $.trim($(item).val());
399
+
400
+ // console.log( $(item).data('type') );
401
+ var data_type = $(item).data('type')
402
+ val = '';
403
+
404
+ switch(data_type) {
405
+ case 'rich':
406
+ var name = $(item).data('id')
407
+ val = $.trim( tinyMCE.get(name).getContent() );
408
+
409
+ if ( val === '') {
410
+ error = true;
411
+
412
+ // make it warn collor
413
+ WP_User_Frontend.markError(item);
414
+ }
415
+ break;
416
+
417
+ case 'textarea':
418
+ case 'text':
419
+
420
+ if ( $(item).hasClass('password') ) {
421
+ if ( WP_User_Frontend.pass_val == '' ) {
422
+ WP_User_Frontend.pass_val = $(item).val();
423
+ } else {
424
+ WP_User_Frontend.retype_pass_val = $(item).val();
425
+ }
426
+ if ( WP_User_Frontend.pass_val != '' && WP_User_Frontend.retype_pass_val != '' && WP_User_Frontend.pass_val != WP_User_Frontend.retype_pass_val ) {
427
+ error = true;
428
+ error_type = 'mismatch';
429
+
430
+ WP_User_Frontend.markError( item, error_type );
431
+ break;
432
+ }
433
+
434
+ }
435
+ val = $.trim( $(item).val() );
436
+
437
+ if ( val === '') {
438
+ error = true;
439
+ error_type = 'required';
440
+
441
+ // make it warn collor
442
+ WP_User_Frontend.markError( item, error_type );
443
+ }
444
+ break;
445
+
446
+ case 'select':
447
+ val = $(item).val();
448
+
449
+ // console.log(val);
450
+ if ( !val || val === '-1' ) {
451
+ error = true;
452
+ error_type = 'required';
453
+
454
+ // make it warn collor
455
+ WP_User_Frontend.markError( item, error_type );
456
+ }
457
+ break;
458
+
459
+ case 'multiselect':
460
+ val = $(item).val();
461
+
462
+ if ( val === null || val.length === 0 ) {
463
+ error = true;
464
+ error_type = 'required';
465
+
466
+ // make it warn collor
467
+ WP_User_Frontend.markError( item, error_type );
468
+ }
469
+ break;
470
+
471
+ case 'tax-checkbox':
472
+ var length = $(item).children().find('input:checked').length;
473
+
474
+ if ( !length ) {
475
+ error = true;
476
+ error_type = 'required';
477
+
478
+ // make it warn collor
479
+ WP_User_Frontend.markError( item, error_type );
480
+ }
481
+ break;
482
+
483
+ case 'radio':
484
+ var length = $(item).find('input:checked').length;
485
+
486
+ if ( !length ) {
487
+ error = true;
488
+ error_type = 'required';
489
+
490
+ // make it warn collor
491
+ WP_User_Frontend.markError( item, error_type );
492
+ }
493
+ break;
494
+
495
+ case 'file':
496
+ var length = $(item).find('ul').children().length;
497
+
498
+ if ( !length ) {
499
+ error = true;
500
+ error_type = 'required';
501
+
502
+ // make it warn collor
503
+ WP_User_Frontend.markError( item, error_type );
504
+ }
505
+ break;
506
+
507
+ case 'email':
508
+ var val = $(item).val();
509
+
510
+ if ( val !== '' ) {
511
+ //run the validation
512
+ if( !WP_User_Frontend.isValidEmail( val ) ) {
513
+ error = true;
514
+ error_type = 'validation';
515
+
516
+ WP_User_Frontend.markError( item, error_type );
517
+ }
518
+ } else if( val === '' ) {
519
+ error = true;
520
+ error_type = 'required';
521
+
522
+ WP_User_Frontend.markError( item, error_type );
523
+ }
524
+ break;
525
+
526
+
527
+ case 'url':
528
+ var val = $(item).val();
529
+
530
+ if ( val !== '' ) {
531
+ //run the validation
532
+ if( !WP_User_Frontend.isValidURL( val ) ) {
533
+ error = true;
534
+ error_type = 'validation';
535
+
536
+ WP_User_Frontend.markError( item, error_type );
537
+ }
538
+ }
539
+ break;
540
+
541
+ };
542
+
543
+ });
544
+
545
+ // if already some error found, bail out
546
+ if (error) {
547
+ // add error notice
548
+ WP_User_Frontend.addErrorNotice(self,'end');
549
+
550
+ return false;
551
+ }
552
+
553
+ var form_data = self.serialize(),
554
+ rich_texts = [];
555
+
556
+ // grab rich texts from tinyMCE
557
+ $('.wpuf-rich-validation', self).each(function (index, item) {
558
+ var item = $(item);
559
+ var editor_id = item.data('id');
560
+ var item_name = item.data('name');
561
+ var val = $.trim( tinyMCE.get(editor_id).getContent() );
562
+
563
+ rich_texts.push(item_name + '=' + encodeURIComponent( val ) );
564
+ });
565
+
566
+ // append them to the form var
567
+ form_data = form_data + '&' + rich_texts.join('&');
568
+ return form_data;
569
+ },
570
+
571
+ /**
572
+ *
573
+ * @param form
574
+ * @param position (value = bottom or end) end if form is onepare, bottom, if form is multistep
575
+ */
576
+ addErrorNotice: function( form, position ) {
577
+ if( position == 'bottom' ) {
578
+ $('.wpuf-multistep-fieldset:visible').append('<div class="wpuf-errors">' + wpuf_frontend.error_message + '</div>');
579
+ } else {
580
+ $(form).find('li.wpuf-submit').append('<div class="wpuf-errors">' + wpuf_frontend.error_message + '</div>');
581
+ }
582
+
583
+ },
584
+
585
+ removeErrorNotice: function(form) {
586
+ $(form).find('.wpuf-errors').remove();
587
+ },
588
+
589
+ markError: function(item, error_type) {
590
+
591
+ var error_string = '';
592
+ $(item).closest('li').addClass('has-error');
593
+
594
+ if ( error_type ) {
595
+ error_string = $(item).closest('li').data('label');
596
+ switch ( error_type ) {
597
+ case 'required' :
598
+ error_string = error_string + ' ' + error_str_obj[error_type];
599
+ break;
600
+ case 'mismatch' :
601
+ error_string = error_string + ' ' +error_str_obj[error_type];
602
+ break;
603
+ case 'validation' :
604
+ error_string = error_string + ' ' + error_str_obj[error_type];
605
+ break
606
+ }
607
+ $(item).siblings('.wpuf-error-msg').remove();
608
+ $(item).after('<div class="wpuf-error-msg">'+ error_string +'</div>')
609
+ }
610
+
611
+ $(item).focus();
612
+ },
613
+
614
+ removeErrors: function(item) {
615
+ $(item).find('.has-error').removeClass('has-error');
616
+ $('.wpuf-error-msg').remove();
617
+ },
618
+
619
+ isValidEmail: function( email ) {
620
+ var pattern = new RegExp(/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i);
621
+ return pattern.test(email);
622
+ },
623
+
624
+ isValidURL: function(url) {
625
+ var urlregex = new RegExp("^(http:\/\/www.|https:\/\/www.|ftp:\/\/www.|www.|http:\/\/|https:\/\/){1}([0-9A-Za-z]+\.)");
626
+ return urlregex.test(url);
627
+ },
628
+
629
+ insertImage: function(button, form_id) {
630
+
631
+ var container = 'wpuf-insert-image-container';
632
+
633
+ if ( ! $( '#' + button ).length ) {
634
+ return;
635
+ };
636
+
637
+ var imageUploader = new plupload.Uploader({
638
+ runtimes: 'html5,html4',
639
+ browse_button: button,
640
+ container: container,
641
+ multipart: true,
642
+ multipart_params: {
643
+ action: 'wpuf_insert_image',
644
+ form_id: $( '#' + button ).data('form_id')
645
+ },
646
+ multiple_queues: false,
647
+ multi_selection: false,
648
+ urlstream_upload: true,
649
+ file_data_name: 'wpuf_file',
650
+ max_file_size: '2mb',
651
+ url: wpuf_frontend_upload.plupload.url,
652
+ flash_swf_url: wpuf_frontend_upload.flash_swf_url,
653
+ filters: [{
654
+ title: 'Allowed Files',
655
+ extensions: 'jpg,jpeg,gif,png,bmp'
656
+ }]
657
+ });
658
+
659
+ imageUploader.bind('Init', function(up, params) {
660
+ // console.log("Current runtime environment: " + params.runtime);
661
+ });
662
+
663
+ imageUploader.bind('FilesAdded', function(up, files) {
664
+ var $container = $('#' + container);
665
+
666
+ $.each(files, function(i, file) {
667
+ $container.append(
668
+ '<div class="upload-item" id="' + file.id + '"><div class="progress progress-striped active"><div class="bar"></div></div></div>');
669
+ });
670
+
671
+ up.refresh();
672
+ up.start();
673
+ });
674
+
675
+ imageUploader.bind('QueueChanged', function (uploader) {
676
+ imageUploader.start();
677
+ });
678
+
679
+ imageUploader.bind('UploadProgress', function(up, file) {
680
+ var item = $('#' + file.id);
681
+
682
+ $('.bar', item).css({ width: file.percent + '%' });
683
+ $('.percent', item).html( file.percent + '%' );
684
+ });
685
+
686
+ imageUploader.bind('Error', function(up, error) {
687
+ alert('Error #' + error.code + ': ' + error.message);
688
+ });
689
+
690
+ imageUploader.bind('FileUploaded', function(up, file, response) {
691
+
692
+ $('#' + file.id).remove();
693
+
694
+ if ( response.response !== 'error' ) {
695
+ var success = false;
696
+
697
+ if ( typeof tinyMCE !== 'undefined' ) {
698
+
699
+ if ( typeof tinyMCE.execInstanceCommand !== 'function' ) {
700
+ // tinyMCE 4.x
701
+ var mce = tinyMCE.get( 'post_content_' + form_id );
702
+
703
+ if ( mce !== null ) {
704
+ mce.insertContent(response.response);
705
+ }
706
+ } else {
707
+ // tinyMCE 3.x
708
+ tinyMCE.execInstanceCommand( 'post_content_' + form_id, 'mceInsertContent', false, response.response);
709
+ }
710
+ }
711
+
712
+ // insert failed to the edit, perhaps insert into textarea
713
+ var post_content = $('#post_content_' + form_id);
714
+ post_content.val( post_content.val() + response.response );
715
+
716
+ } else {
717
+ alert('Something went wrong');
718
+ }
719
+ });
720
+
721
+ imageUploader.init();
722
+ },
723
+
724
+ deleteAvatar: function(e) {
725
+ e.preventDefault();
726
+
727
+ if ( confirm( $(this).data('confirm') ) ) {
728
+ $.post(wpuf_frontend.ajaxurl, {action: 'wpuf_delete_avatar', _wpnonce: wpuf_frontend.nonce}, function() {
729
+ $(e.target).parent().remove();
730
+ });
731
+ }
732
+ },
733
+
734
+ editorLimit: {
735
+
736
+ bind: function(limit, field, type) {
737
+ if ( type === 'no' ) {
738
+ // it's a textarea
739
+
740
+ $('textarea#' + field).keydown( function(event) {
741
+ WP_User_Frontend.editorLimit.textareaLimit.call(this, event, limit);
742
+ });
743
+
744
+ $('textarea#' + field).on('paste', function(event) {
745
+ var self = $(this);
746
+
747
+ setTimeout(function() {
748
+ WP_User_Frontend.editorLimit.textareaLimit.call(self, event, limit);
749
+ }, 100);
750
+ });
751
+
752
+ } else {
753
+ // it's a rich textarea
754
+ setTimeout(function () {
755
+ tinyMCE.get(field).onKeyDown.add( function(ed, event) {
756
+ WP_User_Frontend.editorLimit.tinymce.onKeyDown(ed, event, limit);
757
+ } );
758
+
759
+ tinyMCE.get(field).onPaste.add(function(ed, event) {
760
+ setTimeout(function() {
761
+ WP_User_Frontend.editorLimit.tinymce.onPaste(ed, event, limit);
762
+ }, 100);
763
+ });
764
+
765
+ }, 1000);
766
+ }
767
+ },
768
+
769
+ tinymce: {
770
+
771
+ getStats: function(ed) {
772
+ var body = ed.getBody(), text = tinymce.trim(body.innerText || body.textContent);
773
+
774
+ return {
775
+ chars: text.length,
776
+ words: text.split(/[\w\u2019\'-]+/).length
777
+ };
778
+ },
779
+
780
+ onKeyDown: function(ed, event, limit) {
781
+ var numWords = WP_User_Frontend.editorLimit.tinymce.getStats(ed).words - 1;
782
+
783
+ limit ? $('.mce-path-item.mce-last', ed.container).html('Word Limit : '+ numWords +'/'+limit):'';
784
+
785
+ if ( limit && numWords > limit ) {
786
+ WP_User_Frontend.editorLimit.blockTyping(event);
787
+ jQuery('.mce-path-item.mce-last', ed.container).html( wpuf_frontend.word_limit );
788
+ }
789
+ },
790
+
791
+ onPaste: function(ed, event, limit) {
792
+ var editorContent = ed.getContent().split(' ').slice(0, limit).join(' ');
793
+
794
+ // Let TinyMCE do the heavy lifting for inserting that content into the editor.
795
+ // ed.insertContent(content); //ed.execCommand('mceInsertContent', false, content);
796
+ ed.setContent(editorContent);
797
+
798
+ WP_User_Frontend.editorLimit.make_media_embed_code(editorContent, ed);
799
+ }
800
+ },
801
+
802
+ textareaLimit: function(event, limit) {
803
+ var self = $(this),
804
+ content = self.val().split(' ');
805
+
806
+ if ( limit && content.length > limit ) {
807
+ self.closest('.wpuf-fields').find('span.wpuf-wordlimit-message').html( wpuf_frontend.word_limit );
808
+ WP_User_Frontend.editorLimit.blockTyping(event);
809
+ } else {
810
+ self.closest('.wpuf-fields').find('span.wpuf-wordlimit-message').html('');
811
+ }
812
+
813
+ // handle the paste event
814
+ if ( event.type === 'paste' ) {
815
+ self.val( content.slice(0, limit).join( ' ' ) );
816
+ }
817
+ },
818
+
819
+ blockTyping: function(event) {
820
+ // Allow: backspace, delete, tab, escape, minus enter and . backspace = 8,delete=46,tab=9,enter=13,.=190,escape=27, minus = 189
821
+ if ($.inArray(event.keyCode, [46, 8, 9, 27, 13, 110, 190, 189]) !== -1 ||
822
+ // Allow: Ctrl+A
823
+ (event.keyCode == 65 && event.ctrlKey === true) ||
824
+ // Allow: home, end, left, right, down, up
825
+ (event.keyCode >= 35 && event.keyCode <= 40)) {
826
+ // let it happen, don't do anything
827
+ return;
828
+ }
829
+
830
+ event.preventDefault();
831
+ event.stopPropagation();
832
+ },
833
+
834
+ make_media_embed_code: function(content, editor){
835
+ $.post( ajaxurl, {
836
+ action:'make_media_embed_code',
837
+ content: content
838
+ },
839
+ function(data){
840
+ // console.log(data);
841
+ editor.setContent(editor.getContent() + editor.setContent(data));
842
+ }
843
+ )
844
+ }
845
+ }
846
+ };
847
+
848
+ $(function() {
849
+ WP_User_Frontend.init();
850
+
851
+ // payment gateway selection
852
+ $('ul.wpuf-payment-gateways').on('click', 'input[type=radio]', function(e) {
853
+ $('.wpuf-payment-instruction').slideUp(250);
854
+
855
+ $(this).parents('li').find('.wpuf-payment-instruction').slideDown(250);
856
+ });
857
+
858
+ if( !$('ul.wpuf-payment-gateways li').find('input[type=radio]').is(':checked') ) {
859
+ $('ul.wpuf-payment-gateways li').first().find('input[type=radio]').click()
860
+ } else {
861
+ var el = $('ul.wpuf-payment-gateways li').find('input[type=radio]:checked');
862
+ el.parents('li').find('.wpuf-payment-instruction').slideDown(250);
863
+ }
864
+ });
865
+
866
+ })(jQuery, window);
assets/js/frontend-form.min.js ADDED
@@ -0,0 +1 @@
 
1
+ (function(e){var t={init:function(){e(".wpuf-form").on("click","img.wpuf-clone-field",this.cloneField);e(".wpuf-form").on("click","img.wpuf-remove-field",this.removeField);e(".wpuf-form").on("click","a.wpuf-delete-avatar",this.deleteAvatar);e(".wpuf-form").on("click","a#wpuf-post-draft",this.draftPost);e(".wpuf-form-add").on("submit",this.formSubmit);e("form#post").on("submit",this.adminPostSubmit)},cloneField:function(t){t.preventDefault();var n=e(this).closest("tr"),r=n.clone();r.find("input").val("");r.find(":checked").attr("checked","");n.after(r)},removeField:function(){var t=e(this).closest("tr"),n=t.siblings().andSelf().length;n>1&&t.remove()},adminPostSubmit:function(n){n.preventDefault();var r=e(this),i=t.validateForm(r);if(i)return!0},draftPost:function(t){t.preventDefault();var n=e(this),r=e(this).closest("form"),i=r.serialize()+"&action=wpuf_draft_post",s=r.find('input[type="hidden"][name="post_id"]').val(),o=[],u,a;e(".wpuf-rich-validation").each(function(t,n){u=e(n).data("id");a=e.trim(tinyMCE.get(u).getContent());o.push(u+"="+encodeURIComponent(a))});i=i+"&"+o.join("&");n.after(' <span class="wpuf-loading"></span>');e.post(wpuf_frontend.ajaxurl,i,function(t){if(typeof s=="undefined"){var i='<input type="hidden" name="post_id" value="'+t.post_id+'">';i+='<input type="hidden" name="post_date" value="'+t.date+'">';i+='<input type="hidden" name="post_author" value="'+t.post_author+'">';i+='<input type="hidden" name="comment_status" value="'+t.comment_status+'">';r.append(i)}n.next("span.wpuf-loading").remove();n.after('<span class="wpuf-draft-saved">&nbsp; Post Saved</span>');e(".wpuf-draft-saved").delay(2500).fadeOut("fast",function(){e(this).remove()})})},formSubmit:function(n){n.preventDefault();var r=e(this),i=r.find("input[type=submit]");form_data=t.validateForm(r);if(form_data){r.find("li.wpuf-submit").append('<span class="wpuf-loading"></span>');i.attr("disabled","disabled").addClass("button-primary-disabled");e.post(wpuf_frontend.ajaxurl,form_data,function(t){if(t.success)if(t.show_message==1){r.before('<div class="wpuf-success">'+t.message+"</div>");r.slideUp("fast",function(){r.remove()});e("html, body").animate({scrollTop:e(".wpuf-success").offset().top-100},"fast")}else window.location=t.redirect_to;else{alert(t.error);i.removeAttr("disabled")}i.removeClass("button-primary-disabled");r.find("span.wpuf-loading").remove()})}},validateForm:function(n){var r,i="",s=!1,o=[];t.removeErrors(n);t.removeErrorNotice(n);var u=n.find('[data-required="yes"]');u.each(function(n,r){var i=e(r).data("type");a="";switch(i){case"rich":var o=e(r).data("id");a=e.trim(tinyMCE.get(o).getContent());if(a===""){s=!0;t.markError(r)}break;case"textarea":case"text":a=e.trim(e(r).val());if(a===""){s=!0;t.markError(r)}break;case"select":a=e(r).val();if(!a||a==="-1"){s=!0;t.markError(r)}break;case"multiselect":a=e(r).val();if(a===null||a.length===0){s=!0;t.markError(r)}break;case"tax-checkbox":var u=e(r).children().find("input:checked").length;if(!u){s=!0;t.markError(r)}break;case"radio":var u=e(r).parent().find("input:checked").length;if(!u){s=!0;t.markError(r)}break;case"file":var u=e(r).next("ul").children().length;if(!u){s=!0;t.markError(r)}break;case"email":var a=e(r).val();if(a!==""&&!t.isValidEmail(a)){s=!0;t.markError(r)}break;case"url":var a=e(r).val();if(a!==""&&!t.isValidURL(a)){s=!0;t.markError(r)}}});if(s){t.addErrorNotice(n);return!1}var a=n.serialize(),f=[];e(".wpuf-rich-validation").each(function(t,n){r=e(n).data("id");val=e.trim(tinyMCE.get(r).getContent());f.push(r+"="+encodeURIComponent(val))});a=a+"&"+f.join("&");return a},addErrorNotice:function(t){e(t).find("li.wpuf-submit").append('<div class="wpuf-errors">'+wpuf_frontend.error_message+"</div>")},removeErrorNotice:function(t){e(t).find(".wpuf-errors").remove()},markError:function(t){e(t).closest("li").addClass("has-error");e(t).focus()},removeErrors:function(t){e(t).find(".has-error").removeClass("has-error")},isValidEmail:function(e){var t=new RegExp(/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i);return t.test(e)},isValidURL:function(e){var t=new RegExp("^(http://www.|https://www.|ftp://www.|www.|http://|https://){1}([0-9A-Za-z]+.)");return t.test(e)},insertImage:function(){var t="wpuf-insert-image",n="wpuf-insert-image-container";if(!e("#"+t).length)return;var r=new plupload.Uploader({runtimes:"html5,html4",browse_button:t,container:n,multipart:!0,multipart_params:{action:"wpuf_insert_image"},multiple_queues:!1,multi_selection:!1,urlstream_upload:!0,file_data_name:"wpuf_file",max_file_size:"2mb",url:wpuf_frontend_upload.plupload.url,flash_swf_url:wpuf_frontend_upload.flash_swf_url,filters:[{title:"Allowed Files",extensions:"jpg,jpeg,gif,png,bmp"}]});r.bind("Init",function(e,t){});r.bind("FilesAdded",function(t,r){var i=e("#"+n);e.each(r,function(e,t){i.append('<div class="upload-item" id="'+t.id+'"><div class="progress progress-striped active"><div class="bar"></div></div></div>')});t.refresh();t.start()});r.bind("QueueChanged",function(e){r.start()});r.bind("UploadProgress",function(t,n){var r=e("#"+n.id);e(".bar",r).css({width:n.percent+"%"});e(".percent",r).html(n.percent+"%")});r.bind("Error",function(e,t){alert("Error #"+error.code+": "+error.message)});r.bind("FileUploaded",function(t,n,r){e("#"+n.id).remove();if(r.response!=="error"){var i=!1;typeof tinyMCE!="undefined"&&(i=tinyMCE.execInstanceCommand("post_content","mceInsertContent",!1,r.response));var s=e("#post_content");s.val(s.val()+r.response)}else alert("Something went wrong")});r.init()},deleteAvatar:function(t){t.preventDefault();confirm(e(this).data("confirm"))&&e.post(wpuf_frontend.ajaxurl,{action:"wpuf_delete_avatar",_wpnonce:wpuf_frontend.nonce},function(){window.location.reload()})}};e(function(){t.init();t.insertImage();e("ul.wpuf-payment-gateways").on("click","input[type=radio]",function(t){e(".wpuf-payment-instruction").slideUp(250);e(this).parents("li").find(".wpuf-payment-instruction").slideDown(250)});e("ul.wpuf-payment-gateways li").first().find("input[type=radio]").click()})})(jQuery);
assets/js/jquery-ui-timepicker-addon.js ADDED
@@ -0,0 +1,1919 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * jQuery timepicker addon
3
+ * By: Trent Richardson [http://trentrichardson.com]
4
+ * Version 1.2
5
+ * Last Modified: 02/02/2013
6
+ *
7
+ * Copyright 2013 Trent Richardson
8
+ * You may use this project under MIT or GPL licenses.
9
+ * http://trentrichardson.com/Impromptu/GPL-LICENSE.txt
10
+ * http://trentrichardson.com/Impromptu/MIT-LICENSE.txt
11
+ */
12
+
13
+ /*jslint evil: true, white: false, undef: false, nomen: false */
14
+
15
+ (function($) {
16
+
17
+ /*
18
+ * Lets not redefine timepicker, Prevent "Uncaught RangeError: Maximum call stack size exceeded"
19
+ */
20
+ $.ui.timepicker = $.ui.timepicker || {};
21
+ if ($.ui.timepicker.version) {
22
+ return;
23
+ }
24
+
25
+ /*
26
+ * Extend jQueryUI, get it started with our version number
27
+ */
28
+ $.extend($.ui, {
29
+ timepicker: {
30
+ version: "1.2"
31
+ }
32
+ });
33
+
34
+ /*
35
+ * Timepicker manager.
36
+ * Use the singleton instance of this class, $.timepicker, to interact with the time picker.
37
+ * Settings for (groups of) time pickers are maintained in an instance object,
38
+ * allowing multiple different settings on the same page.
39
+ */
40
+ var Timepicker = function() {
41
+ this.regional = []; // Available regional settings, indexed by language code
42
+ this.regional[''] = { // Default regional settings
43
+ currentText: 'Now',
44
+ closeText: 'Done',
45
+ amNames: ['AM', 'A'],
46
+ pmNames: ['PM', 'P'],
47
+ timeFormat: 'HH:mm',
48
+ timeSuffix: '',
49
+ timeOnlyTitle: 'Choose Time',
50
+ timeText: 'Time',
51
+ hourText: 'Hour',
52
+ minuteText: 'Minute',
53
+ secondText: 'Second',
54
+ millisecText: 'Millisecond',
55
+ timezoneText: 'Time Zone',
56
+ isRTL: false
57
+ };
58
+ this._defaults = { // Global defaults for all the datetime picker instances
59
+ showButtonPanel: true,
60
+ timeOnly: false,
61
+ showHour: true,
62
+ showMinute: true,
63
+ showSecond: false,
64
+ showMillisec: false,
65
+ showTimezone: false,
66
+ showTime: true,
67
+ stepHour: 1,
68
+ stepMinute: 1,
69
+ stepSecond: 1,
70
+ stepMillisec: 1,
71
+ hour: 0,
72
+ minute: 0,
73
+ second: 0,
74
+ millisec: 0,
75
+ timezone: null,
76
+ useLocalTimezone: false,
77
+ defaultTimezone: "+0000",
78
+ hourMin: 0,
79
+ minuteMin: 0,
80
+ secondMin: 0,
81
+ millisecMin: 0,
82
+ hourMax: 23,
83
+ minuteMax: 59,
84
+ secondMax: 59,
85
+ millisecMax: 999,
86
+ minDateTime: null,
87
+ maxDateTime: null,
88
+ onSelect: null,
89
+ hourGrid: 0,
90
+ minuteGrid: 0,
91
+ secondGrid: 0,
92
+ millisecGrid: 0,
93
+ alwaysSetTime: true,
94
+ separator: ' ',
95
+ altFieldTimeOnly: true,
96
+ altTimeFormat: null,
97
+ altSeparator: null,
98
+ altTimeSuffix: null,
99
+ pickerTimeFormat: null,
100
+ pickerTimeSuffix: null,
101
+ showTimepicker: true,
102
+ timezoneIso8601: false,
103
+ timezoneList: null,
104
+ addSliderAccess: false,
105
+ sliderAccessArgs: null,
106
+ controlType: 'slider',
107
+ defaultValue: null,
108
+ parse: 'strict'
109
+ };
110
+ $.extend(this._defaults, this.regional['']);
111
+ };
112
+
113
+ $.extend(Timepicker.prototype, {
114
+ $input: null,
115
+ $altInput: null,
116
+ $timeObj: null,
117
+ inst: null,
118
+ hour_slider: null,
119
+ minute_slider: null,
120
+ second_slider: null,
121
+ millisec_slider: null,
122
+ timezone_select: null,
123
+ hour: 0,
124
+ minute: 0,
125
+ second: 0,
126
+ millisec: 0,
127
+ timezone: null,
128
+ defaultTimezone: "+0000",
129
+ hourMinOriginal: null,
130
+ minuteMinOriginal: null,
131
+ secondMinOriginal: null,
132
+ millisecMinOriginal: null,
133
+ hourMaxOriginal: null,
134
+ minuteMaxOriginal: null,
135
+ secondMaxOriginal: null,
136
+ millisecMaxOriginal: null,
137
+ ampm: '',
138
+ formattedDate: '',
139
+ formattedTime: '',
140
+ formattedDateTime: '',
141
+ timezoneList: null,
142
+ units: ['hour','minute','second','millisec'],
143
+ control: null,
144
+
145
+ /*
146
+ * Override the default settings for all instances of the time picker.
147
+ * @param settings object - the new settings to use as defaults (anonymous object)
148
+ * @return the manager object
149
+ */
150
+ setDefaults: function(settings) {
151
+ extendRemove(this._defaults, settings || {});
152
+ return this;
153
+ },
154
+
155
+ /*
156
+ * Create a new Timepicker instance
157
+ */
158
+ _newInst: function($input, o) {
159
+ var tp_inst = new Timepicker(),
160
+ inlineSettings = {},
161
+ fns = {},
162
+ overrides, i;
163
+
164
+ for (var attrName in this._defaults) {
165
+ if(this._defaults.hasOwnProperty(attrName)){
166
+ var attrValue = $input.attr('time:' + attrName);
167
+ if (attrValue) {
168
+ try {
169
+ inlineSettings[attrName] = eval(attrValue);
170
+ } catch (err) {
171
+ inlineSettings[attrName] = attrValue;
172
+ }
173
+ }
174
+ }
175
+ }
176
+ overrides = {
177
+ beforeShow: function (input, dp_inst) {
178
+ if ($.isFunction(tp_inst._defaults.evnts.beforeShow)) {
179
+ return tp_inst._defaults.evnts.beforeShow.call($input[0], input, dp_inst, tp_inst);
180
+ }
181
+ },
182
+ onChangeMonthYear: function (year, month, dp_inst) {
183
+ // Update the time as well : this prevents the time from disappearing from the $input field.
184
+ tp_inst._updateDateTime(dp_inst);
185
+ if ($.isFunction(tp_inst._defaults.evnts.onChangeMonthYear)) {
186
+ tp_inst._defaults.evnts.onChangeMonthYear.call($input[0], year, month, dp_inst, tp_inst);
187
+ }
188
+ },
189
+ onClose: function (dateText, dp_inst) {
190
+ if (tp_inst.timeDefined === true && $input.val() !== '') {
191
+ tp_inst._updateDateTime(dp_inst);
192
+ }
193
+ if ($.isFunction(tp_inst._defaults.evnts.onClose)) {
194
+ tp_inst._defaults.evnts.onClose.call($input[0], dateText, dp_inst, tp_inst);
195
+ }
196
+ }
197
+ };
198
+ for (i in overrides) {
199
+ if (overrides.hasOwnProperty(i)) {
200
+ fns[i] = o[i] || null;
201
+ }
202
+ }
203
+ tp_inst._defaults = $.extend({}, this._defaults, inlineSettings, o, overrides, {
204
+ evnts:fns,
205
+ timepicker: tp_inst // add timepicker as a property of datepicker: $.datepicker._get(dp_inst, 'timepicker');
206
+ });
207
+ tp_inst.amNames = $.map(tp_inst._defaults.amNames, function(val) {
208
+ return val.toUpperCase();
209
+ });
210
+ tp_inst.pmNames = $.map(tp_inst._defaults.pmNames, function(val) {
211
+ return val.toUpperCase();
212
+ });
213
+
214
+ // controlType is string - key to our this._controls
215
+ if(typeof(tp_inst._defaults.controlType) === 'string'){
216
+ if($.fn[tp_inst._defaults.controlType] === undefined){
217
+ tp_inst._defaults.controlType = 'select';
218
+ }
219
+ tp_inst.control = tp_inst._controls[tp_inst._defaults.controlType];
220
+ }
221
+ // controlType is an object and must implement create, options, value methods
222
+ else{
223
+ tp_inst.control = tp_inst._defaults.controlType;
224
+ }
225
+
226
+ if (tp_inst._defaults.timezoneList === null) {
227
+ var timezoneList = ['-1200', '-1100', '-1000', '-0930', '-0900', '-0800', '-0700', '-0600', '-0500', '-0430', '-0400', '-0330', '-0300', '-0200', '-0100', '+0000',
228
+ '+0100', '+0200', '+0300', '+0330', '+0400', '+0430', '+0500', '+0530', '+0545', '+0600', '+0630', '+0700', '+0800', '+0845', '+0900', '+0930',
229
+ '+1000', '+1030', '+1100', '+1130', '+1200', '+1245', '+1300', '+1400'];
230
+
231
+ if (tp_inst._defaults.timezoneIso8601) {
232
+ timezoneList = $.map(timezoneList, function(val) {
233
+ return val == '+0000' ? 'Z' : (val.substring(0, 3) + ':' + val.substring(3));
234
+ });
235
+ }
236
+ tp_inst._defaults.timezoneList = timezoneList;
237
+ }
238
+
239
+ tp_inst.timezone = tp_inst._defaults.timezone;
240
+ tp_inst.hour = tp_inst._defaults.hour < tp_inst._defaults.hourMin? tp_inst._defaults.hourMin :
241
+ tp_inst._defaults.hour > tp_inst._defaults.hourMax? tp_inst._defaults.hourMax : tp_inst._defaults.hour;
242
+ tp_inst.minute = tp_inst._defaults.minute < tp_inst._defaults.minuteMin? tp_inst._defaults.minuteMin :
243
+ tp_inst._defaults.minute > tp_inst._defaults.minuteMax? tp_inst._defaults.minuteMax : tp_inst._defaults.minute;
244
+ tp_inst.second = tp_inst._defaults.second < tp_inst._defaults.secondMin? tp_inst._defaults.secondMin :
245
+ tp_inst._defaults.second > tp_inst._defaults.secondMax? tp_inst._defaults.secondMax : tp_inst._defaults.second;
246
+ tp_inst.millisec = tp_inst._defaults.millisec < tp_inst._defaults.millisecMin? tp_inst._defaults.millisecMin :
247
+ tp_inst._defaults.millisec > tp_inst._defaults.millisecMax? tp_inst._defaults.millisecMax : tp_inst._defaults.millisec;
248
+ tp_inst.ampm = '';
249
+ tp_inst.$input = $input;
250
+
251
+ if (o.altField) {
252
+ tp_inst.$altInput = $(o.altField).css({
253
+ cursor: 'pointer'
254
+ }).focus(function() {
255
+ $input.trigger("focus");
256
+ });
257
+ }
258
+
259
+ if (tp_inst._defaults.minDate === 0 || tp_inst._defaults.minDateTime === 0) {
260
+ tp_inst._defaults.minDate = new Date();
261
+ }
262
+ if (tp_inst._defaults.maxDate === 0 || tp_inst._defaults.maxDateTime === 0) {
263
+ tp_inst._defaults.maxDate = new Date();
264
+ }
265
+
266
+ // datepicker needs minDate/maxDate, timepicker needs minDateTime/maxDateTime..
267
+ if (tp_inst._defaults.minDate !== undefined && tp_inst._defaults.minDate instanceof Date) {
268
+ tp_inst._defaults.minDateTime = new Date(tp_inst._defaults.minDate.getTime());
269
+ }
270
+ if (tp_inst._defaults.minDateTime !== undefined && tp_inst._defaults.minDateTime instanceof Date) {
271
+ tp_inst._defaults.minDate = new Date(tp_inst._defaults.minDateTime.getTime());
272
+ }
273
+ if (tp_inst._defaults.maxDate !== undefined && tp_inst._defaults.maxDate instanceof Date) {
274
+ tp_inst._defaults.maxDateTime = new Date(tp_inst._defaults.maxDate.getTime());
275
+ }
276
+ if (tp_inst._defaults.maxDateTime !== undefined && tp_inst._defaults.maxDateTime instanceof Date) {
277
+ tp_inst._defaults.maxDate = new Date(tp_inst._defaults.maxDateTime.getTime());
278
+ }
279
+ tp_inst.$input.bind('focus', function() {
280
+ tp_inst._onFocus();
281
+ });
282
+
283
+ return tp_inst;
284
+ },
285
+
286
+ /*
287
+ * add our sliders to the calendar
288
+ */
289
+ _addTimePicker: function(dp_inst) {
290
+ var currDT = (this.$altInput && this._defaults.altFieldTimeOnly) ? this.$input.val() + ' ' + this.$altInput.val() : this.$input.val();
291
+
292
+ this.timeDefined = this._parseTime(currDT);
293
+ this._limitMinMaxDateTime(dp_inst, false);
294
+ this._injectTimePicker();
295
+ },
296
+
297
+ /*
298
+ * parse the time string from input value or _setTime
299
+ */
300
+ _parseTime: function(timeString, withDate) {
301
+ if (!this.inst) {
302
+ this.inst = $.datepicker._getInst(this.$input[0]);
303
+ }
304
+
305
+ if (withDate || !this._defaults.timeOnly) {
306
+ var dp_dateFormat = $.datepicker._get(this.inst, 'dateFormat');
307
+ try {
308
+ var parseRes = parseDateTimeInternal(dp_dateFormat, this._defaults.timeFormat, timeString, $.datepicker._getFormatConfig(this.inst), this._defaults);
309
+ if (!parseRes.timeObj) {
310
+ return false;
311
+ }
312
+ $.extend(this, parseRes.timeObj);
313
+ } catch (err) {
314
+ $.timepicker.log("Error parsing the date/time string: " + err +
315
+ "\ndate/time string = " + timeString +
316
+ "\ntimeFormat = " + this._defaults.timeFormat +
317
+ "\ndateFormat = " + dp_dateFormat);
318
+ return false;
319
+ }
320
+ return true;
321
+ } else {
322
+ var timeObj = $.datepicker.parseTime(this._defaults.timeFormat, timeString, this._defaults);
323
+ if (!timeObj) {
324
+ return false;
325
+ }
326
+ $.extend(this, timeObj);
327
+ return true;
328
+ }
329
+ },
330
+
331
+ /*
332
+ * generate and inject html for timepicker into ui datepicker
333
+ */
334
+ _injectTimePicker: function() {
335
+ var $dp = this.inst.dpDiv,
336
+ o = this.inst.settings,
337
+ tp_inst = this,
338
+ litem = '',
339
+ uitem = '',
340
+ max = {},
341
+ gridSize = {},
342
+ size = null;
343
+
344
+ // Prevent displaying twice
345
+ if ($dp.find("div.ui-timepicker-div").length === 0 && o.showTimepicker) {
346
+ var noDisplay = ' style="display:none;"',
347
+ html = '<div class="ui-timepicker-div'+ (o.isRTL? ' ui-timepicker-rtl' : '') +'"><dl>' + '<dt class="ui_tpicker_time_label"' + ((o.showTime) ? '' : noDisplay) + '>' + o.timeText + '</dt>' +
348
+ '<dd class="ui_tpicker_time"' + ((o.showTime) ? '' : noDisplay) + '></dd>';
349
+
350
+ // Create the markup
351
+ for(var i=0,l=this.units.length; i<l; i++){
352
+ litem = this.units[i];
353
+ uitem = litem.substr(0,1).toUpperCase() + litem.substr(1);
354
+ // Added by Peter Medeiros:
355
+ // - Figure out what the hour/minute/second max should be based on the step values.
356
+ // - Example: if stepMinute is 15, then minMax is 45.
357
+ max[litem] = parseInt((o[litem+'Max'] - ((o[litem+'Max'] - o[litem+'Min']) % o['step'+uitem])), 10);
358
+ gridSize[litem] = 0;
359
+
360
+ html += '<dt class="ui_tpicker_'+ litem +'_label"' + ((o['show'+uitem]) ? '' : noDisplay) + '>' + o[litem +'Text'] + '</dt>' +
361
+ '<dd class="ui_tpicker_'+ litem +'"><div class="ui_tpicker_'+ litem +'_slider"' + ((o['show'+uitem]) ? '' : noDisplay) + '></div>';
362
+
363
+ if (o['show'+uitem] && o[litem+'Grid'] > 0) {
364
+ html += '<div style="padding-left: 1px"><table class="ui-tpicker-grid-label"><tr>';
365
+
366
+ if(litem == 'hour'){
367
+ for (var h = o[litem+'Min']; h <= max[litem]; h += parseInt(o[litem+'Grid'], 10)) {
368
+ gridSize[litem]++;
369
+ var tmph = $.datepicker.formatTime(useAmpm(o.pickerTimeFormat || o.timeFormat)? 'hht':'HH', {hour:h}, o);
370
+ html += '<td data-for="'+litem+'">' + tmph + '</td>';
371
+ }
372
+ }
373
+ else{
374
+ for (var m = o[litem+'Min']; m <= max[litem]; m += parseInt(o[litem+'Grid'], 10)) {
375
+ gridSize[litem]++;
376
+ html += '<td data-for="'+litem+'">' + ((m < 10) ? '0' : '') + m + '</td>';
377
+ }
378
+ }
379
+
380
+ html += '</tr></table></div>';
381
+ }
382
+ html += '</dd>';
383
+ }
384
+
385
+ // Timezone
386
+ html += '<dt class="ui_tpicker_timezone_label"' + ((o.showTimezone) ? '' : noDisplay) + '>' + o.timezoneText + '</dt>';
387
+ html += '<dd class="ui_tpicker_timezone" ' + ((o.showTimezone) ? '' : noDisplay) + '></dd>';
388
+
389
+ // Create the elements from string
390
+ html += '</dl></div>';
391
+ var $tp = $(html);
392
+
393
+ // if we only want time picker...
394
+ if (o.timeOnly === true) {
395
+ $tp.prepend('<div class="ui-widget-header ui-helper-clearfix ui-corner-all">' + '<div class="ui-datepicker-title">' + o.timeOnlyTitle + '</div>' + '</div>');
396
+ $dp.find('.ui-datepicker-header, .ui-datepicker-calendar').hide();
397
+ }
398
+
399
+ // add sliders, adjust grids, add events
400
+ for(var i=0,l=tp_inst.units.length; i<l; i++){
401
+ litem = tp_inst.units[i];
402
+ uitem = litem.substr(0,1).toUpperCase() + litem.substr(1);
403
+
404
+ // add the slider
405
+ tp_inst[litem+'_slider'] = tp_inst.control.create(tp_inst, $tp.find('.ui_tpicker_'+litem+'_slider'), litem, tp_inst[litem], o[litem+'Min'], max[litem], o['step'+uitem]);
406
+
407
+ // adjust the grid and add click event
408
+ if (o['show'+uitem] && o[litem+'Grid'] > 0) {
409
+ size = 100 * gridSize[litem] * o[litem+'Grid'] / (max[litem] - o[litem+'Min']);
410
+ $tp.find('.ui_tpicker_'+litem+' table').css({
411
+ width: size + "%",
412
+ marginLeft: o.isRTL? '0' : ((size / (-2 * gridSize[litem])) + "%"),
413
+ marginRight: o.isRTL? ((size / (-2 * gridSize[litem])) + "%") : '0',
414
+ borderCollapse: 'collapse'
415
+ }).find("td").click(function(e){
416
+ var $t = $(this),
417
+ h = $t.html(),
418
+ n = parseInt(h.replace(/[^0-9]/g),10),
419
+ ap = h.replace(/[^apm]/ig),
420
+ f = $t.data('for'); // loses scope, so we use data-for
421
+
422
+ if(f == 'hour'){
423
+ if(ap.indexOf('p') !== -1 && n < 12){
424
+ n += 12;
425
+ }
426
+ else{
427
+ if(ap.indexOf('a') !== -1 && n === 12){
428
+ n = 0;
429
+ }
430
+ }
431
+ }
432
+
433
+ tp_inst.control.value(tp_inst, tp_inst[f+'_slider'], litem, n);
434
+
435
+ tp_inst._onTimeChange();
436
+ tp_inst._onSelectHandler();
437
+ })
438
+ .css({
439
+ cursor: 'pointer',
440
+ width: (100 / gridSize[litem]) + '%',
441
+ textAlign: 'center',
442
+ overflow: 'hidden'
443
+ });
444
+ } // end if grid > 0
445
+ } // end for loop
446
+
447
+ // Add timezone options
448
+ this.timezone_select = $tp.find('.ui_tpicker_timezone').append('<select></select>').find("select");
449
+ $.fn.append.apply(this.timezone_select,
450
+ $.map(o.timezoneList, function(val, idx) {
451
+ return $("<option />").val(typeof val == "object" ? val.value : val).text(typeof val == "object" ? val.label : val);
452
+ }));
453
+ if (typeof(this.timezone) != "undefined" && this.timezone !== null && this.timezone !== "") {
454
+ var local_date = new Date(this.inst.selectedYear, this.inst.selectedMonth, this.inst.selectedDay, 12);
455
+ var local_timezone = $.timepicker.timeZoneOffsetString(local_date);
456
+ if (local_timezone == this.timezone) {
457
+ selectLocalTimeZone(tp_inst);
458
+ } else {
459
+ this.timezone_select.val(this.timezone);
460
+ }
461
+ } else {
462
+ if (typeof(this.hour) != "undefined" && this.hour !== null && this.hour !== "") {
463
+ this.timezone_select.val(o.defaultTimezone);
464
+ } else {
465
+ selectLocalTimeZone(tp_inst);
466
+ }
467
+ }
468
+ this.timezone_select.change(function() {
469
+ tp_inst._defaults.useLocalTimezone = false;
470
+ tp_inst._onTimeChange();
471
+ tp_inst._onSelectHandler();
472
+ });
473
+ // End timezone options
474
+
475
+ // inject timepicker into datepicker
476
+ var $buttonPanel = $dp.find('.ui-datepicker-buttonpane');
477
+ if ($buttonPanel.length) {
478
+ $buttonPanel.before($tp);
479
+ } else {
480
+ $dp.append($tp);
481
+ }
482
+
483
+ this.$timeObj = $tp.find('.ui_tpicker_time');
484
+
485
+ if (this.inst !== null) {
486
+ var timeDefined = this.timeDefined;
487
+ this._onTimeChange();
488
+ this.timeDefined = timeDefined;
489
+ }
490
+
491
+ // slideAccess integration: http://trentrichardson.com/2011/11/11/jquery-ui-sliders-and-touch-accessibility/
492
+ if (this._defaults.addSliderAccess) {
493
+ var sliderAccessArgs = this._defaults.sliderAccessArgs,
494
+ rtl = this._defaults.isRTL;
495
+ sliderAccessArgs.isRTL = rtl;
496
+
497
+ setTimeout(function() { // fix for inline mode
498
+ if ($tp.find('.ui-slider-access').length === 0) {
499
+ $tp.find('.ui-slider:visible').sliderAccess(sliderAccessArgs);
500
+
501
+ // fix any grids since sliders are shorter
502
+ var sliderAccessWidth = $tp.find('.ui-slider-access:eq(0)').outerWidth(true);
503
+ if (sliderAccessWidth) {
504
+ $tp.find('table:visible').each(function() {
505
+ var $g = $(this),
506
+ oldWidth = $g.outerWidth(),
507
+ oldMarginLeft = $g.css(rtl? 'marginRight':'marginLeft').toString().replace('%', ''),
508
+ newWidth = oldWidth - sliderAccessWidth,
509
+ newMarginLeft = ((oldMarginLeft * newWidth) / oldWidth) + '%',
510
+ css = { width: newWidth, marginRight: 0, marginLeft: 0 };
511
+ css[rtl? 'marginRight':'marginLeft'] = newMarginLeft;
512
+ $g.css(css);
513
+ });
514
+ }
515
+ }
516
+ }, 10);
517
+ }
518
+ // end slideAccess integration
519
+
520
+ }
521
+ },
522
+
523
+ /*
524
+ * This function tries to limit the ability to go outside the
525
+ * min/max date range
526
+ */
527
+ _limitMinMaxDateTime: function(dp_inst, adjustSliders) {
528
+ var o = this._defaults,
529
+ dp_date = new Date(dp_inst.selectedYear, dp_inst.selectedMonth, dp_inst.selectedDay);
530
+
531
+ if (!this._defaults.showTimepicker) {
532
+ return;
533
+ } // No time so nothing to check here
534
+
535
+ if ($.datepicker._get(dp_inst, 'minDateTime') !== null && $.datepicker._get(dp_inst, 'minDateTime') !== undefined && dp_date) {
536
+ var minDateTime = $.datepicker._get(dp_inst, 'minDateTime'),
537
+ minDateTimeDate = new Date(minDateTime.getFullYear(), minDateTime.getMonth(), minDateTime.getDate(), 0, 0, 0, 0);
538
+
539
+ if (this.hourMinOriginal === null || this.minuteMinOriginal === null || this.secondMinOriginal === null || this.millisecMinOriginal === null) {
540
+ this.hourMinOriginal = o.hourMin;
541
+ this.minuteMinOriginal = o.minuteMin;
542
+ this.secondMinOriginal = o.secondMin;
543
+ this.millisecMinOriginal = o.millisecMin;
544
+ }
545
+
546
+ if (dp_inst.settings.timeOnly || minDateTimeDate.getTime() == dp_date.getTime()) {
547
+ this._defaults.hourMin = minDateTime.getHours();
548
+ if (this.hour <= this._defaults.hourMin) {
549
+ this.hour = this._defaults.hourMin;
550
+ this._defaults.minuteMin = minDateTime.getMinutes();
551
+ if (this.minute <= this._defaults.minuteMin) {
552
+ this.minute = this._defaults.minuteMin;
553
+ this._defaults.secondMin = minDateTime.getSeconds();
554
+ if (this.second <= this._defaults.secondMin) {
555
+ this.second = this._defaults.secondMin;
556
+ this._defaults.millisecMin = minDateTime.getMilliseconds();
557
+ } else {
558
+ if (this.millisec < this._defaults.millisecMin) {
559
+ this.millisec = this._defaults.millisecMin;
560
+ }
561
+ this._defaults.millisecMin = this.millisecMinOriginal;
562
+ }
563
+ } else {
564
+ this._defaults.secondMin = this.secondMinOriginal;
565
+ this._defaults.millisecMin = this.millisecMinOriginal;
566
+ }
567
+ } else {
568
+ this._defaults.minuteMin = this.minuteMinOriginal;
569
+ this._defaults.secondMin = this.secondMinOriginal;
570
+ this._defaults.millisecMin = this.millisecMinOriginal;
571
+ }
572
+ } else {
573
+ this._defaults.hourMin = this.hourMinOriginal;
574
+ this._defaults.minuteMin = this.minuteMinOriginal;
575
+ this._defaults.secondMin = this.secondMinOriginal;
576
+ this._defaults.millisecMin = this.millisecMinOriginal;
577
+ }
578
+ }
579
+
580
+ if ($.datepicker._get(dp_inst, 'maxDateTime') !== null && $.datepicker._get(dp_inst, 'maxDateTime') !== undefined && dp_date) {
581
+ var maxDateTime = $.datepicker._get(dp_inst, 'maxDateTime'),
582
+ maxDateTimeDate = new Date(maxDateTime.getFullYear(), maxDateTime.getMonth(), maxDateTime.getDate(), 0, 0, 0, 0);
583
+
584
+ if (this.hourMaxOriginal === null || this.minuteMaxOriginal === null || this.secondMaxOriginal === null) {
585
+ this.hourMaxOriginal = o.hourMax;
586
+ this.minuteMaxOriginal = o.minuteMax;
587
+ this.secondMaxOriginal = o.secondMax;
588
+ this.millisecMaxOriginal = o.millisecMax;
589
+ }
590
+
591
+ if (dp_inst.settings.timeOnly || maxDateTimeDate.getTime() == dp_date.getTime()) {
592
+ this._defaults.hourMax = maxDateTime.getHours();
593
+ if (this.hour >= this._defaults.hourMax) {
594
+ this.hour = this._defaults.hourMax;
595
+ this._defaults.minuteMax = maxDateTime.getMinutes();
596
+ if (this.minute >= this._defaults.minuteMax) {
597
+ this.minute = this._defaults.minuteMax;
598
+ this._defaults.secondMax = maxDateTime.getSeconds();
599
+ if (this.second >= this._defaults.secondMax) {
600
+ this.second = this._defaults.secondMax;
601
+ this._defaults.millisecMax = maxDateTime.getMilliseconds();
602
+ } else {
603
+ if (this.millisec > this._defaults.millisecMax) {
604
+ this.millisec = this._defaults.millisecMax;
605
+ }
606
+ this._defaults.millisecMax = this.millisecMaxOriginal;
607
+ }
608
+ } else {
609
+ this._defaults.secondMax = this.secondMaxOriginal;
610
+ this._defaults.millisecMax = this.millisecMaxOriginal;
611
+ }
612
+ } else {
613
+ this._defaults.minuteMax = this.minuteMaxOriginal;
614
+ this._defaults.secondMax = this.secondMaxOriginal;
615
+ this._defaults.millisecMax = this.millisecMaxOriginal;
616
+ }
617
+ } else {
618
+ this._defaults.hourMax = this.hourMaxOriginal;
619
+ this._defaults.minuteMax = this.minuteMaxOriginal;
620
+ this._defaults.secondMax = this.secondMaxOriginal;
621
+ this._defaults.millisecMax = this.millisecMaxOriginal;
622
+ }
623
+ }
624
+
625
+ if (adjustSliders !== undefined && adjustSliders === true) {
626
+ var hourMax = parseInt((this._defaults.hourMax - ((this._defaults.hourMax - this._defaults.hourMin) % this._defaults.stepHour)), 10),
627
+ minMax = parseInt((this._defaults.minuteMax - ((this._defaults.minuteMax - this._defaults.minuteMin) % this._defaults.stepMinute)), 10),
628
+ secMax = parseInt((this._defaults.secondMax - ((this._defaults.secondMax - this._defaults.secondMin) % this._defaults.stepSecond)), 10),
629
+ millisecMax = parseInt((this._defaults.millisecMax - ((this._defaults.millisecMax - this._defaults.millisecMin) % this._defaults.stepMillisec)), 10);
630
+
631
+ if (this.hour_slider) {
632
+ this.control.options(this, this.hour_slider, 'hour', { min: this._defaults.hourMin, max: hourMax });
633
+ this.control.value(this, this.hour_slider, 'hour', this.hour - (this.hour % this._defaults.stepHour));
634
+ }
635
+ if (this.minute_slider) {
636
+ this.control.options(this, this.minute_slider, 'minute', { min: this._defaults.minuteMin, max: minMax });
637
+ this.control.value(this, this.minute_slider, 'minute', this.minute - (this.minute % this._defaults.stepMinute));
638
+ }
639
+ if (this.second_slider) {
640
+ this.control.options(this, this.second_slider, 'second', { min: this._defaults.secondMin, max: secMax });
641
+ this.control.value(this, this.second_slider, 'second', this.second - (this.second % this._defaults.stepSecond));
642
+ }
643
+ if (this.millisec_slider) {
644
+ this.control.options(this, this.millisec_slider, 'millisec', { min: this._defaults.millisecMin, max: millisecMax });
645
+ this.control.value(this, this.millisec_slider, 'millisec', this.millisec - (this.millisec % this._defaults.stepMillisec));
646
+ }
647
+ }
648
+
649
+ },
650
+
651
+ /*
652
+ * when a slider moves, set the internal time...
653
+ * on time change is also called when the time is updated in the text field
654
+ */
655
+ _onTimeChange: function() {
656
+ var hour = (this.hour_slider) ? this.control.value(this, this.hour_slider, 'hour') : false,
657
+ minute = (this.minute_slider) ? this.control.value(this, this.minute_slider, 'minute') : false,
658
+ second = (this.second_slider) ? this.control.value(this, this.second_slider, 'second') : false,
659
+ millisec = (this.millisec_slider) ? this.control.value(this, this.millisec_slider, 'millisec') : false,
660
+ timezone = (this.timezone_select) ? this.timezone_select.val() : false,
661
+ o = this._defaults,
662
+ pickerTimeFormat = o.pickerTimeFormat || o.timeFormat,
663
+ pickerTimeSuffix = o.pickerTimeSuffix || o.timeSuffix;
664
+
665
+ if (typeof(hour) == 'object') {
666
+ hour = false;
667
+ }
668
+ if (typeof(minute) == 'object') {
669
+ minute = false;
670
+ }
671
+ if (typeof(second) == 'object') {
672
+ second = false;
673
+ }
674
+ if (typeof(millisec) == 'object') {
675
+ millisec = false;
676
+ }
677
+ if (typeof(timezone) == 'object') {
678
+ timezone = false;
679
+ }
680
+
681
+ if (hour !== false) {
682
+ hour = parseInt(hour, 10);
683
+ }
684
+ if (minute !== false) {
685
+ minute = parseInt(minute, 10);
686
+ }
687
+ if (second !== false) {
688
+ second = parseInt(second, 10);
689
+ }
690
+ if (millisec !== false) {
691
+ millisec = parseInt(millisec, 10);
692
+ }
693
+
694
+ var ampm = o[hour < 12 ? 'amNames' : 'pmNames'][0];
695
+
696
+ // If the update was done in the input field, the input field should not be updated.
697
+ // If the update was done using the sliders, update the input field.
698
+ var hasChanged = (hour != this.hour || minute != this.minute || second != this.second || millisec != this.millisec
699
+ || (this.ampm.length > 0 && (hour < 12) != ($.inArray(this.ampm.toUpperCase(), this.amNames) !== -1))
700
+ || ((this.timezone === null && timezone != this.defaultTimezone) || (this.timezone !== null && timezone != this.timezone)));
701
+
702
+ if (hasChanged) {
703
+
704
+ if (hour !== false) {
705
+ this.hour = hour;
706
+ }
707
+ if (minute !== false) {
708
+ this.minute = minute;
709
+ }
710
+ if (second !== false) {
711
+ this.second = second;
712
+ }
713
+ if (millisec !== false) {
714
+ this.millisec = millisec;
715
+ }
716
+ if (timezone !== false) {
717
+ this.timezone = timezone;
718
+ }
719
+
720
+ if (!this.inst) {
721
+ this.inst = $.datepicker._getInst(this.$input[0]);
722
+ }
723
+
724
+ this._limitMinMaxDateTime(this.inst, true);
725
+ }
726
+ if (useAmpm(o.timeFormat)) {
727
+ this.ampm = ampm;
728
+ }
729
+
730
+ // Updates the time within the timepicker
731
+ this.formattedTime = $.datepicker.formatTime(o.timeFormat, this, o);
732
+ if (this.$timeObj) {
733
+ if(pickerTimeFormat === o.timeFormat){
734
+ this.$timeObj.text(this.formattedTime + pickerTimeSuffix);
735
+ }
736
+ else{
737
+ this.$timeObj.text($.datepicker.formatTime(pickerTimeFormat, this, o) + pickerTimeSuffix);
738
+ }
739
+ }
740
+
741
+ this.timeDefined = true;
742
+ if (hasChanged) {
743
+ this._updateDateTime();
744
+ }
745
+ },
746
+
747
+ /*
748
+ * call custom onSelect.
749
+ * bind to sliders slidestop, and grid click.
750
+ */
751
+ _onSelectHandler: function() {
752
+ var onSelect = this._defaults.onSelect || this.inst.settings.onSelect;
753
+ var inputEl = this.$input ? this.$input[0] : null;
754
+ if (onSelect && inputEl) {
755
+ onSelect.apply(inputEl, [this.formattedDateTime, this]);
756
+ }
757
+ },
758
+
759
+ /*
760
+ * update our input with the new date time..
761
+ */
762
+ _updateDateTime: function(dp_inst) {
763
+ dp_inst = this.inst || dp_inst;
764
+ var dt = $.datepicker._daylightSavingAdjust(new Date(dp_inst.selectedYear, dp_inst.selectedMonth, dp_inst.selectedDay)),
765
+ dateFmt = $.datepicker._get(dp_inst, 'dateFormat'),
766
+ formatCfg = $.datepicker._getFormatConfig(dp_inst),
767
+ timeAvailable = dt !== null && this.timeDefined;
768
+ this.formattedDate = $.datepicker.formatDate(dateFmt, (dt === null ? new Date() : dt), formatCfg);
769
+ var formattedDateTime = this.formattedDate;
770
+
771
+ // if a slider was changed but datepicker doesn't have a value yet, set it
772
+ if(dp_inst.lastVal==""){
773
+ dp_inst.currentYear=dp_inst.selectedYear;
774
+ dp_inst.currentMonth=dp_inst.selectedMonth;
775
+ dp_inst.currentDay=dp_inst.selectedDay;
776
+ }
777
+
778
+ /*
779
+ * remove following lines to force every changes in date picker to change the input value
780
+ * Bug descriptions: when an input field has a default value, and click on the field to pop up the date picker.
781
+ * If the user manually empty the value in the input field, the date picker will never change selected value.
782
+ */
783
+ //if (dp_inst.lastVal !== undefined && (dp_inst.lastVal.length > 0 && this.$input.val().length === 0)) {
784
+ // return;
785
+ //}
786
+
787
+ if (this._defaults.timeOnly === true) {
788
+ formattedDateTime = this.formattedTime;
789
+ } else if (this._defaults.timeOnly !== true && (this._defaults.alwaysSetTime || timeAvailable)) {
790
+ formattedDateTime += this._defaults.separator + this.formattedTime + this._defaults.timeSuffix;
791
+ }
792
+
793
+ this.formattedDateTime = formattedDateTime;
794
+
795
+ if (!this._defaults.showTimepicker) {
796
+ this.$input.val(this.formattedDate);
797
+ } else if (this.$altInput && this._defaults.altFieldTimeOnly === true) {
798
+ this.$altInput.val(this.formattedTime);
799
+ this.$input.val(this.formattedDate);
800
+ } else if (this.$altInput) {
801
+ this.$input.val(formattedDateTime);
802
+ var altFormattedDateTime = '',
803
+ altSeparator = this._defaults.altSeparator ? this._defaults.altSeparator : this._defaults.separator,
804
+ altTimeSuffix = this._defaults.altTimeSuffix ? this._defaults.altTimeSuffix : this._defaults.timeSuffix;
805
+
806
+ if (this._defaults.altFormat) altFormattedDateTime = $.datepicker.formatDate(this._defaults.altFormat, (dt === null ? new Date() : dt), formatCfg);
807
+ else altFormattedDateTime = this.formattedDate;
808
+ if (altFormattedDateTime) altFormattedDateTime += altSeparator;
809
+ if (this._defaults.altTimeFormat) altFormattedDateTime += $.datepicker.formatTime(this._defaults.altTimeFormat, this, this._defaults) + altTimeSuffix;
810
+ else altFormattedDateTime += this.formattedTime + altTimeSuffix;
811
+ this.$altInput.val(altFormattedDateTime);
812
+ } else {
813
+ this.$input.val(formattedDateTime);
814
+ }
815
+
816
+ this.$input.trigger("change");
817
+ },
818
+
819
+ _onFocus: function() {
820
+ if (!this.$input.val() && this._defaults.defaultValue) {
821
+ this.$input.val(this._defaults.defaultValue);
822
+ var inst = $.datepicker._getInst(this.$input.get(0)),
823
+ tp_inst = $.datepicker._get(inst, 'timepicker');
824
+ if (tp_inst) {
825
+ if (tp_inst._defaults.timeOnly && (inst.input.val() != inst.lastVal)) {
826
+ try {
827
+ $.datepicker._updateDatepicker(inst);
828
+ } catch (err) {
829
+ $.timepicker.log(err);
830
+ }
831
+ }
832
+ }
833
+ }
834
+ },
835
+
836
+ /*
837
+ * Small abstraction to control types
838
+ * We can add more, just be sure to follow the pattern: create, options, value
839
+ */
840
+ _controls: {
841
+ // slider methods
842
+ slider: {
843
+ create: function(tp_inst, obj, unit, val, min, max, step){
844
+ var rtl = tp_inst._defaults.isRTL; // if rtl go -60->0 instead of 0->60
845
+ return obj.prop('slide', null).slider({
846
+ orientation: "horizontal",
847
+ value: rtl? val*-1 : val,
848
+ min: rtl? max*-1 : min,
849
+ max: rtl? min*-1 : max,
850
+ step: step,
851
+ slide: function(event, ui) {
852
+ tp_inst.control.value(tp_inst, $(this), unit, rtl? ui.value*-1:ui.value);
853
+ tp_inst._onTimeChange();
854
+ },
855
+ stop: function(event, ui) {
856
+ tp_inst._onSelectHandler();
857
+ }
858
+ });
859
+ },
860
+ options: function(tp_inst, obj, unit, opts, val){
861
+ if(tp_inst._defaults.isRTL){
862
+ if(typeof(opts) == 'string'){
863
+ if(opts == 'min' || opts == 'max'){
864
+ if(val !== undefined)
865
+ return obj.slider(opts, val*-1);
866
+ return Math.abs(obj.slider(opts));
867
+ }
868
+ return obj.slider(opts);
869
+ }
870
+ var min = opts.min,
871
+ max = opts.max;
872
+ opts.min = opts.max = null;
873
+ if(min !== undefined)
874
+ opts.max = min * -1;
875
+ if(max !== undefined)
876
+ opts.min = max * -1;
877
+ return obj.slider(opts);
878
+ }
879
+ if(typeof(opts) == 'string' && val !== undefined)
880
+ return obj.slider(opts, val);
881
+ return obj.slider(opts);
882
+ },
883
+ value: function(tp_inst, obj, unit, val){
884
+ if(tp_inst._defaults.isRTL){
885
+ if(val !== undefined)
886
+ return obj.slider('value', val*-1);
887
+ return Math.abs(obj.slider('value'));
888
+ }
889
+ if(val !== undefined)
890
+ return obj.slider('value', val);
891
+ return obj.slider('value');
892
+ }
893
+ },
894
+ // select methods
895
+ select: {
896
+ create: function(tp_inst, obj, unit, val, min, max, step){
897
+ var sel = '<select class="ui-timepicker-select" data-unit="'+ unit +'" data-min="'+ min +'" data-max="'+ max +'" data-step="'+ step +'">',
898
+ ul = tp_inst._defaults.timeFormat.indexOf('t') !== -1? 'toLowerCase':'toUpperCase',
899
+ m = 0;
900
+
901
+ for(var i=min; i<=max; i+=step){
902
+ sel += '<option value="'+ i +'"'+ (i==val? ' selected':'') +'>';
903
+ if(unit == 'hour' && useAmpm(tp_inst._defaults.pickerTimeFormat || tp_inst._defaults.timeFormat))
904
+ sel += $.datepicker.formatTime("hh TT", {hour:i}, tp_inst._defaults);
905
+ else if(unit == 'millisec' || i >= 10) sel += i;
906
+ else sel += '0'+ i.toString();
907
+ sel += '</option>';
908
+ }
909
+ sel += '</select>';
910
+
911
+ obj.children('select').remove();
912
+
913
+ $(sel).appendTo(obj).change(function(e){
914
+ tp_inst._onTimeChange();
915
+ tp_inst._onSelectHandler();
916
+ });
917
+
918
+ return obj;
919
+ },
920
+ options: function(tp_inst, obj, unit, opts, val){
921
+ var o = {},
922
+ $t = obj.children('select');
923
+ if(typeof(opts) == 'string'){
924
+ if(val === undefined)
925
+ return $t.data(opts);
926
+ o[opts] = val;
927
+ }
928
+ else o = opts;
929
+ return tp_inst.control.create(tp_inst, obj, $t.data('unit'), $t.val(), o.min || $t.data('min'), o.max || $t.data('max'), o.step || $t.data('step'));
930
+ },
931
+ value: function(tp_inst, obj, unit, val){
932
+ var $t = obj.children('select');
933
+ if(val !== undefined)
934
+ return $t.val(val);
935
+ return $t.val();
936
+ }
937
+ }
938
+ } // end _controls
939
+
940
+ });
941
+
942
+ $.fn.extend({
943
+ /*
944
+ * shorthand just to use timepicker..
945
+ */
946
+ timepicker: function(o) {
947
+ o = o || {};
948
+ var tmp_args = Array.prototype.slice.call(arguments);
949
+
950
+ if (typeof o == 'object') {
951
+ tmp_args[0] = $.extend(o, {
952
+ timeOnly: true
953
+ });
954
+ }
955
+
956
+ return $(this).each(function() {
957
+ $.fn.datetimepicker.apply($(this), tmp_args);
958
+ });
959
+ },
960
+
961
+ /*
962
+ * extend timepicker to datepicker
963
+ */
964
+ datetimepicker: function(o) {
965
+ o = o || {};
966
+ var tmp_args = arguments;
967
+
968
+ if (typeof(o) == 'string') {
969
+ if (o == 'getDate') {
970
+ return $.fn.datepicker.apply($(this[0]), tmp_args);
971
+ } else {
972
+ return this.each(function() {
973
+ var $t = $(this);
974
+ $t.datepicker.apply($t, tmp_args);
975
+ });
976
+ }
977
+ } else {
978
+ return this.each(function() {
979
+ var $t = $(this);
980
+ $t.datepicker($.timepicker._newInst($t, o)._defaults);
981
+ });
982
+ }
983
+ }
984
+ });
985
+
986
+ /*
987
+ * Public Utility to parse date and time
988
+ */
989
+ $.datepicker.parseDateTime = function(dateFormat, timeFormat, dateTimeString, dateSettings, timeSettings) {
990
+ var parseRes = parseDateTimeInternal(dateFormat, timeFormat, dateTimeString, dateSettings, timeSettings);
991
+ if (parseRes.timeObj) {
992
+ var t = parseRes.timeObj;
993
+ parseRes.date.setHours(t.hour, t.minute, t.second, t.millisec);
994
+ }
995
+
996
+ return parseRes.date;
997
+ };
998
+
999
+ /*
1000
+ * Public utility to parse time
1001
+ */
1002
+ $.datepicker.parseTime = function(timeFormat, timeString, options) {
1003
+ var o = extendRemove(extendRemove({}, $.timepicker._defaults), options || {});
1004
+
1005
+ // Strict parse requires the timeString to match the timeFormat exactly
1006
+ var strictParse = function(f, s, o){
1007
+
1008
+ // pattern for standard and localized AM/PM markers
1009
+ var getPatternAmpm = function(amNames, pmNames) {
1010
+ var markers = [];
1011
+ if (amNames) {
1012
+ $.merge(markers, amNames);
1013
+ }
1014
+ if (pmNames) {
1015
+ $.merge(markers, pmNames);
1016
+ }
1017
+ markers = $.map(markers, function(val) {
1018
+ return val.replace(/[.*+?|()\[\]{}\\]/g, '\\$&');
1019
+ });
1020
+ return '(' + markers.join('|') + ')?';
1021
+ };
1022
+
1023
+ // figure out position of time elements.. cause js cant do named captures
1024
+ var getFormatPositions = function(timeFormat) {
1025
+ var finds = timeFormat.toLowerCase().match(/(h{1,2}|m{1,2}|s{1,2}|l{1}|t{1,2}|z|'.*?')/g),
1026
+ orders = {
1027
+ h: -1,
1028
+ m: -1,
1029
+ s: -1,
1030
+ l: -1,
1031
+ t: -1,
1032
+ z: -1
1033
+ };
1034
+
1035
+ if (finds) {
1036
+ for (var i = 0; i < finds.length; i++) {
1037
+ if (orders[finds[i].toString().charAt(0)] == -1) {
1038
+ orders[finds[i].toString().charAt(0)] = i + 1;
1039
+ }
1040
+ }
1041
+ }
1042
+ return orders;
1043
+ };
1044
+
1045
+ var regstr = '^' + f.toString()
1046
+ .replace(/([hH]{1,2}|mm?|ss?|[tT]{1,2}|[lz]|'.*?')/g, function (match) {
1047
+ var ml = match.length;
1048
+ switch (match.charAt(0).toLowerCase()) {
1049
+ case 'h': return ml === 1? '(\\d?\\d)':'(\\d{'+ml+'})';
1050
+ case 'm': return ml === 1? '(\\d?\\d)':'(\\d{'+ml+'})';
1051
+ case 's': return ml === 1? '(\\d?\\d)':'(\\d{'+ml+'})';
1052
+ case 'l': return '(\\d?\\d?\\d)';
1053
+ case 'z': return '(z|[-+]\\d\\d:?\\d\\d|\\S+)?';
1054
+ case 't': return getPatternAmpm(o.amNames, o.pmNames);
1055
+ default: // literal escaped in quotes
1056
+ return '(' + match.replace(/\'/g, "").replace(/(\.|\$|\^|\\|\/|\(|\)|\[|\]|\?|\+|\*)/g, function (m) { return "\\" + m; }) + ')?';
1057
+ }
1058
+ })
1059
+ .replace(/\s/g, '\\s?') +
1060
+ o.timeSuffix + '$',
1061
+ order = getFormatPositions(f),
1062
+ ampm = '',
1063
+ treg;
1064
+
1065
+ treg = s.match(new RegExp(regstr, 'i'));
1066
+
1067
+ var resTime = {
1068
+ hour: 0,
1069
+ minute: 0,
1070
+ second: 0,
1071
+ millisec: 0
1072
+ };
1073
+
1074
+ if (treg) {
1075
+ if (order.t !== -1) {
1076
+ if (treg[order.t] === undefined || treg[order.t].length === 0) {
1077
+ ampm = '';
1078
+ resTime.ampm = '';
1079
+ } else {
1080
+ ampm = $.inArray(treg[order.t].toUpperCase(), o.amNames) !== -1 ? 'AM' : 'PM';
1081
+ resTime.ampm = o[ampm == 'AM' ? 'amNames' : 'pmNames'][0];
1082
+ }
1083
+ }
1084
+
1085
+ if (order.h !== -1) {
1086
+ if (ampm == 'AM' && treg[order.h] == '12') {
1087
+ resTime.hour = 0; // 12am = 0 hour
1088
+ } else {
1089
+ if (ampm == 'PM' && treg[order.h] != '12') {
1090
+ resTime.hour = parseInt(treg[order.h], 10) + 12; // 12pm = 12 hour, any other pm = hour + 12
1091
+ } else {
1092
+ resTime.hour = Number(treg[order.h]);
1093
+ }
1094
+ }
1095
+ }
1096
+
1097
+ if (order.m !== -1) {
1098
+ resTime.minute = Number(treg[order.m]);
1099
+ }
1100
+ if (order.s !== -1) {
1101
+ resTime.second = Number(treg[order.s]);
1102
+ }
1103
+ if (order.l !== -1) {
1104
+ resTime.millisec = Number(treg[order.l]);
1105
+ }
1106
+ if (order.z !== -1 && treg[order.z] !== undefined) {
1107
+ var tz = treg[order.z].toUpperCase();
1108
+ switch (tz.length) {
1109
+ case 1:
1110
+ // Z
1111
+ tz = o.timezoneIso8601 ? 'Z' : '+0000';
1112
+ break;
1113
+ case 5:
1114
+ // +hhmm
1115
+ if (o.timezoneIso8601) {
1116
+ tz = tz.substring(1) == '0000' ? 'Z' : tz.substring(0, 3) + ':' + tz.substring(3);
1117
+ }
1118
+ break;
1119
+ case 6:
1120
+ // +hh:mm
1121
+ if (!o.timezoneIso8601) {
1122
+ tz = tz == 'Z' || tz.substring(1) == '00:00' ? '+0000' : tz.replace(/:/, '');
1123
+ } else {
1124
+ if (tz.substring(1) == '00:00') {
1125
+ tz = 'Z';
1126
+ }
1127
+ }
1128
+ break;
1129
+ }
1130
+ resTime.timezone = tz;
1131
+ }
1132
+
1133
+
1134
+ return resTime;
1135
+ }
1136
+ return false;
1137
+ };// end strictParse
1138
+
1139
+ // First try JS Date, if that fails, use strictParse
1140
+ var looseParse = function(f,s,o){
1141
+ try{
1142
+ var d = new Date('2012-01-01 '+ s);
1143
+ if(isNaN(d.getTime())){
1144
+ d = new Date('2012-01-01T'+ s);
1145
+ if(isNaN(d.getTime())){
1146
+ d = new Date('01/01/2012 '+ s);
1147
+ if(isNaN(d.getTime())){
1148
+ throw "Unable to parse time with native Date: "+ s;
1149
+ }
1150
+ }
1151
+ }
1152
+
1153
+ return {
1154
+ hour: d.getHours(),
1155
+ minute: d.getMinutes(),
1156
+ second: d.getSeconds(),
1157
+ millisec: d.getMilliseconds(),
1158
+ timezone: $.timepicker.timeZoneOffsetString(d)
1159
+ };
1160
+ }
1161
+ catch(err){
1162
+ try{
1163
+ return strictParse(f,s,o);
1164
+ }
1165
+ catch(err2){
1166
+ $.timepicker.log("Unable to parse \ntimeString: "+ s +"\ntimeFormat: "+ f);
1167
+ }
1168
+ }
1169
+ return false;
1170
+ }; // end looseParse
1171
+
1172
+ if(typeof o.parse === "function"){
1173
+ return o.parse(timeFormat, timeString, o)
1174
+ }
1175
+ if(o.parse === 'loose'){
1176
+ return looseParse(timeFormat, timeString, o);
1177
+ }
1178
+ return strictParse(timeFormat, timeString, o);
1179
+ };
1180
+
1181
+ /*
1182
+ * Public utility to format the time
1183
+ * format = string format of the time
1184
+ * time = a {}, not a Date() for timezones
1185
+ * options = essentially the regional[].. amNames, pmNames, ampm
1186
+ */
1187
+ $.datepicker.formatTime = function(format, time, options) {
1188
+ options = options || {};
1189
+ options = $.extend({}, $.timepicker._defaults, options);
1190
+ time = $.extend({
1191
+ hour: 0,
1192
+ minute: 0,
1193
+ second: 0,
1194
+ millisec: 0,
1195
+ timezone: '+0000'
1196
+ }, time);
1197
+
1198
+ var tmptime = format,
1199
+ ampmName = options.amNames[0],
1200
+ hour = parseInt(time.hour, 10);
1201
+
1202
+ if (hour > 11) {
1203
+ ampmName = options.pmNames[0];
1204
+ }
1205
+
1206
+ tmptime = tmptime.replace(/(?:HH?|hh?|mm?|ss?|[tT]{1,2}|[lz]|('.*?'|".*?"))/g, function(match) {
1207
+ switch (match) {
1208
+ case 'HH':
1209
+ return ('0' + hour).slice(-2);
1210
+ case 'H':
1211
+ return hour;
1212
+ case 'hh':
1213
+ return ('0' + convert24to12(hour)).slice(-2);
1214
+ case 'h':
1215
+ return convert24to12(hour);
1216
+ case 'mm':
1217
+ return ('0' + time.minute).slice(-2);
1218
+ case 'm':
1219
+ return time.minute;
1220
+ case 'ss':
1221
+ return ('0' + time.second).slice(-2);
1222
+ case 's':
1223
+ return time.second;
1224
+ case 'l':
1225
+ return ('00' + time.millisec).slice(-3);
1226
+ case 'z':
1227
+ return time.timezone === null? options.defaultTimezone : time.timezone;
1228
+ case 'T':
1229
+ return ampmName.charAt(0).toUpperCase();
1230
+ case 'TT':
1231
+ return ampmName.toUpperCase();
1232
+ case 't':
1233
+ return ampmName.charAt(0).toLowerCase();
1234
+ case 'tt':
1235
+ return ampmName.toLowerCase();
1236
+ default:
1237
+ return match.replace(/\'/g, "") || "'";
1238
+ }
1239
+ });
1240
+
1241
+ tmptime = $.trim(tmptime);
1242
+ return tmptime;
1243
+ };
1244
+
1245
+ /*
1246
+ * the bad hack :/ override datepicker so it doesnt close on select
1247
+ // inspired: http://stackoverflow.com/questions/1252512/jquery-datepicker-prevent-closing-picker-when-clicking-a-date/1762378#1762378
1248
+ */
1249
+ $.datepicker._base_selectDate = $.datepicker._selectDate;
1250
+ $.datepicker._selectDate = function(id, dateStr) {
1251
+ var inst = this._getInst($(id)[0]),
1252
+ tp_inst = this._get(inst, 'timepicker');
1253
+
1254
+ if (tp_inst) {
1255
+ tp_inst._limitMinMaxDateTime(inst, true);
1256
+ inst.inline = inst.stay_open = true;
1257
+ //This way the onSelect handler called from calendarpicker get the full dateTime
1258
+ this._base_selectDate(id, dateStr);
1259
+ inst.inline = inst.stay_open = false;
1260
+ this._notifyChange(inst);
1261
+ this._updateDatepicker(inst);
1262
+ } else {
1263
+ this._base_selectDate(id, dateStr);
1264
+ }
1265
+ };
1266
+
1267
+ /*
1268
+ * second bad hack :/ override datepicker so it triggers an event when changing the input field
1269
+ * and does not redraw the datepicker on every selectDate event
1270
+ */
1271
+ $.datepicker._base_updateDatepicker = $.datepicker._updateDatepicker;
1272
+ $.datepicker._updateDatepicker = function(inst) {
1273
+
1274
+ // don't popup the datepicker if there is another instance already opened
1275
+ var input = inst.input[0];
1276
+ if ($.datepicker._curInst && $.datepicker._curInst != inst && $.datepicker._datepickerShowing && $.datepicker._lastInput != input) {
1277
+ return;
1278
+ }
1279
+
1280
+ if (typeof(inst.stay_open) !== 'boolean' || inst.stay_open === false) {
1281
+
1282
+ this._base_updateDatepicker(inst);
1283
+
1284
+ // Reload the time control when changing something in the input text field.
1285
+ var tp_inst = this._get(inst, 'timepicker');
1286
+ if (tp_inst) {
1287
+ tp_inst._addTimePicker(inst);
1288
+
1289
+ // if (tp_inst._defaults.useLocalTimezone) { //checks daylight saving with the new date.
1290
+ // var date = new Date(inst.selectedYear, inst.selectedMonth, inst.selectedDay, 12);
1291
+ // selectLocalTimeZone(tp_inst, date);
1292
+ // tp_inst._onTimeChange();
1293
+ // }
1294
+ }
1295
+ }
1296
+ };
1297
+
1298
+ /*
1299
+ * third bad hack :/ override datepicker so it allows spaces and colon in the input field
1300
+ */
1301
+ $.datepicker._base_doKeyPress = $.datepicker._doKeyPress;
1302
+ $.datepicker._doKeyPress = function(event) {
1303
+ var inst = $.datepicker._getInst(event.target),
1304
+ tp_inst = $.datepicker._get(inst, 'timepicker');
1305
+
1306
+ if (tp_inst) {
1307
+ if ($.datepicker._get(inst, 'constrainInput')) {
1308
+ var ampm = useAmpm(tp_inst._defaults.timeFormat),
1309
+ dateChars = $.datepicker._possibleChars($.datepicker._get(inst, 'dateFormat')),
1310
+ datetimeChars = tp_inst._defaults.timeFormat.toString()
1311
+ .replace(/[hms]/g, '')
1312
+ .replace(/TT/g, ampm ? 'APM' : '')
1313
+ .replace(/Tt/g, ampm ? 'AaPpMm' : '')
1314
+ .replace(/tT/g, ampm ? 'AaPpMm' : '')
1315
+ .replace(/T/g, ampm ? 'AP' : '')
1316
+ .replace(/tt/g, ampm ? 'apm' : '')
1317
+ .replace(/t/g, ampm ? 'ap' : '') +
1318
+ " " + tp_inst._defaults.separator +
1319
+ tp_inst._defaults.timeSuffix +
1320
+ (tp_inst._defaults.showTimezone ? tp_inst._defaults.timezoneList.join('') : '') +
1321
+ (tp_inst._defaults.amNames.join('')) + (tp_inst._defaults.pmNames.join('')) +
1322
+ dateChars,
1323
+ chr = String.fromCharCode(event.charCode === undefined ? event.keyCode : event.charCode);
1324
+ return event.ctrlKey || (chr < ' ' || !dateChars || datetimeChars.indexOf(chr) > -1);
1325
+ }
1326
+ }
1327
+
1328
+ return $.datepicker._base_doKeyPress(event);
1329
+ };
1330
+
1331
+ /*
1332
+ * Fourth bad hack :/ override _updateAlternate function used in inline mode to init altField
1333
+ */
1334
+ $.datepicker._base_updateAlternate = $.datepicker._updateAlternate;
1335
+ /* Update any alternate field to synchronise with the main field. */
1336
+ $.datepicker._updateAlternate = function(inst) {
1337
+ var tp_inst = this._get(inst, 'timepicker');
1338
+ if(tp_inst){
1339
+ var altField = tp_inst._defaults.altField;
1340
+ if (altField) { // update alternate field too
1341
+ var altFormat = tp_inst._defaults.altFormat || tp_inst._defaults.dateFormat,
1342
+ date = this._getDate(inst),
1343
+ formatCfg = $.datepicker._getFormatConfig(inst),
1344
+ altFormattedDateTime = '',
1345
+ altSeparator = tp_inst._defaults.altSeparator ? tp_inst._defaults.altSeparator : tp_inst._defaults.separator,
1346
+ altTimeSuffix = tp_inst._defaults.altTimeSuffix ? tp_inst._defaults.altTimeSuffix : tp_inst._defaults.timeSuffix,
1347
+ altTimeFormat = tp_inst._defaults.altTimeFormat !== null ? tp_inst._defaults.altTimeFormat : tp_inst._defaults.timeFormat;
1348
+
1349
+ altFormattedDateTime += $.datepicker.formatTime(altTimeFormat, tp_inst, tp_inst._defaults) + altTimeSuffix;
1350
+ if(!tp_inst._defaults.timeOnly && !tp_inst._defaults.altFieldTimeOnly && date !== null){
1351
+ if(tp_inst._defaults.altFormat)
1352
+ altFormattedDateTime = $.datepicker.formatDate(tp_inst._defaults.altFormat, date, formatCfg) + altSeparator + altFormattedDateTime;
1353
+ else altFormattedDateTime = tp_inst.formattedDate + altSeparator + altFormattedDateTime;
1354
+ }
1355
+ $(altField).val(altFormattedDateTime);
1356
+ }
1357
+ }
1358
+ else{
1359
+ $.datepicker._base_updateAlternate(inst);
1360
+ }
1361
+ };
1362
+
1363
+ /*
1364
+ * Override key up event to sync manual input changes.
1365
+ */
1366
+ $.datepicker._base_doKeyUp = $.datepicker._doKeyUp;
1367
+ $.datepicker._doKeyUp = function(event) {
1368
+ var inst = $.datepicker._getInst(event.target),
1369
+ tp_inst = $.datepicker._get(inst, 'timepicker');
1370
+
1371
+ if (tp_inst) {
1372
+ if (tp_inst._defaults.timeOnly && (inst.input.val() != inst.lastVal)) {
1373
+ try {
1374
+ $.datepicker._updateDatepicker(inst);
1375
+ } catch (err) {
1376
+ $.timepicker.log(err);
1377
+ }
1378
+ }
1379
+ }
1380
+
1381
+ return $.datepicker._base_doKeyUp(event);
1382
+ };
1383
+
1384
+ /*
1385
+ * override "Today" button to also grab the time.
1386
+ */
1387
+ $.datepicker._base_gotoToday = $.datepicker._gotoToday;
1388
+ $.datepicker._gotoToday = function(id) {
1389
+ var inst = this._getInst($(id)[0]),
1390
+ $dp = inst.dpDiv;
1391
+ this._base_gotoToday(id);
1392
+ var tp_inst = this._get(inst, 'timepicker');
1393
+ selectLocalTimeZone(tp_inst);
1394
+ var now = new Date();
1395
+ this._setTime(inst, now);
1396
+ $('.ui-datepicker-today', $dp).click();
1397
+ };
1398
+
1399
+ /*
1400
+ * Disable & enable the Time in the datetimepicker
1401
+ */
1402
+ $.datepicker._disableTimepickerDatepicker = function(target) {
1403
+ var inst = this._getInst(target);
1404
+ if (!inst) {
1405
+ return;
1406
+ }
1407
+
1408
+ var tp_inst = this._get(inst, 'timepicker');
1409
+ $(target).datepicker('getDate'); // Init selected[Year|Month|Day]
1410
+ if (tp_inst) {
1411
+ tp_inst._defaults.showTimepicker = false;
1412
+ tp_inst._updateDateTime(inst);
1413
+ }
1414
+ };
1415
+
1416
+ $.datepicker._enableTimepickerDatepicker = function(target) {
1417
+ var inst = this._getInst(target);
1418
+ if (!inst) {
1419
+ return;
1420
+ }
1421
+
1422
+ var tp_inst = this._get(inst, 'timepicker');
1423
+ $(target).datepicker('getDate'); // Init selected[Year|Month|Day]
1424
+ if (tp_inst) {
1425
+ tp_inst._defaults.showTimepicker = true;
1426
+ tp_inst._addTimePicker(inst); // Could be disabled on page load
1427
+ tp_inst._updateDateTime(inst);
1428
+ }
1429
+ };
1430
+
1431
+ /*
1432
+ * Create our own set time function
1433
+ */
1434
+ $.datepicker._setTime = function(inst, date) {
1435
+ var tp_inst = this._get(inst, 'timepicker');
1436
+ if (tp_inst) {
1437
+ var defaults = tp_inst._defaults;
1438
+
1439
+ // calling _setTime with no date sets time to defaults
1440
+ tp_inst.hour = date ? date.getHours() : defaults.hour;
1441
+ tp_inst.minute = date ? date.getMinutes() : defaults.minute;
1442
+ tp_inst.second = date ? date.getSeconds() : defaults.second;
1443
+ tp_inst.millisec = date ? date.getMilliseconds() : defaults.millisec;
1444
+
1445
+ //check if within min/max times..
1446
+ tp_inst._limitMinMaxDateTime(inst, true);
1447
+
1448
+ tp_inst._onTimeChange();
1449
+ tp_inst._updateDateTime(inst);
1450
+ }
1451
+ };
1452
+
1453
+ /*
1454
+ * Create new public method to set only time, callable as $().datepicker('setTime', date)
1455
+ */
1456
+ $.datepicker._setTimeDatepicker = function(target, date, withDate) {
1457
+ var inst = this._getInst(target);
1458
+ if (!inst) {
1459
+ return;
1460
+ }
1461
+
1462
+ var tp_inst = this._get(inst, 'timepicker');
1463
+
1464
+ if (tp_inst) {
1465
+ this._setDateFromField(inst);
1466
+ var tp_date;
1467
+ if (date) {
1468
+ if (typeof date == "string") {
1469
+ tp_inst._parseTime(date, withDate);
1470
+ tp_date = new Date();
1471
+ tp_date.setHours(tp_inst.hour, tp_inst.minute, tp_inst.second, tp_inst.millisec);
1472
+ } else {
1473
+ tp_date = new Date(date.getTime());
1474
+ }
1475
+ if (tp_date.toString() == 'Invalid Date') {
1476
+ tp_date = undefined;
1477
+ }
1478
+ this._setTime(inst, tp_date);
1479
+ }
1480
+ }
1481
+
1482
+ };
1483
+
1484
+ /*
1485
+ * override setDate() to allow setting time too within Date object
1486
+ */
1487
+ $.datepicker._base_setDateDatepicker = $.datepicker._setDateDatepicker;
1488
+ $.datepicker._setDateDatepicker = function(target, date) {
1489
+ var inst = this._getInst(target);
1490
+ if (!inst) {
1491
+ return;
1492
+ }
1493
+
1494
+ var tp_date = (date instanceof Date) ? new Date(date.getTime()) : date;
1495
+
1496
+ this._updateDatepicker(inst);
1497
+ this._base_setDateDatepicker.apply(this, arguments);
1498
+ this._setTimeDatepicker(target, tp_date, true);
1499
+ };
1500
+
1501
+ /*
1502
+ * override getDate() to allow getting time too within Date object
1503
+ */
1504
+ $.datepicker._base_getDateDatepicker = $.datepicker._getDateDatepicker;
1505
+ $.datepicker._getDateDatepicker = function(target, noDefault) {
1506
+ var inst = this._getInst(target);
1507
+ if (!inst) {
1508
+ return;
1509
+ }
1510
+
1511
+ var tp_inst = this._get(inst, 'timepicker');
1512
+
1513
+ if (tp_inst) {
1514
+ // if it hasn't yet been defined, grab from field
1515
+ if(inst.lastVal === undefined){
1516
+ this._setDateFromField(inst, noDefault);
1517
+ }
1518
+
1519
+ var date = this._getDate(inst);
1520
+ if (date && tp_inst._parseTime($(target).val(), tp_inst.timeOnly)) {
1521
+ date.setHours(tp_inst.hour, tp_inst.minute, tp_inst.second, tp_inst.millisec);
1522
+ }
1523
+ return date;
1524
+ }
1525
+ return this._base_getDateDatepicker(target, noDefault);
1526
+ };
1527
+
1528
+ /*
1529
+ * override parseDate() because UI 1.8.14 throws an error about "Extra characters"
1530
+ * An option in datapicker to ignore extra format characters would be nicer.
1531
+ */
1532
+ $.datepicker._base_parseDate = $.datepicker.parseDate;
1533
+ $.datepicker.parseDate = function(format, value, settings) {
1534
+ var date;
1535
+ try {
1536
+ date = this._base_parseDate(format, value, settings);
1537
+ } catch (err) {
1538
+ // Hack! The error message ends with a colon, a space, and
1539
+ // the "extra" characters. We rely on that instead of
1540
+ // attempting to perfectly reproduce the parsing algorithm.
1541
+ date = this._base_parseDate(format, value.substring(0,value.length-(err.length-err.indexOf(':')-2)), settings);
1542
+ $.timepicker.log("Error parsing the date string: " + err + "\ndate string = " + value + "\ndate format = " + format);
1543
+ }
1544
+ return date;
1545
+ };
1546
+
1547
+ /*
1548
+ * override formatDate to set date with time to the input
1549
+ */
1550
+ $.datepicker._base_formatDate = $.datepicker._formatDate;
1551
+ $.datepicker._formatDate = function(inst, day, month, year) {
1552
+ var tp_inst = this._get(inst, 'timepicker');
1553
+ if (tp_inst) {
1554
+ tp_inst._updateDateTime(inst);
1555
+ return tp_inst.$input.val();
1556
+ }
1557
+ return this._base_formatDate(inst);
1558
+ };
1559
+
1560
+ /*
1561
+ * override options setter to add time to maxDate(Time) and minDate(Time). MaxDate
1562
+ */
1563
+ $.datepicker._base_optionDatepicker = $.datepicker._optionDatepicker;
1564
+ $.datepicker._optionDatepicker = function(target, name, value) {
1565
+ var inst = this._getInst(target),
1566
+ name_clone;
1567
+ if (!inst) {
1568
+ return null;
1569
+ }
1570
+
1571
+ var tp_inst = this._get(inst, 'timepicker');
1572
+ if (tp_inst) {
1573
+ var min = null,
1574
+ max = null,
1575
+ onselect = null,
1576
+ overrides = tp_inst._defaults.evnts,
1577
+ fns = {},
1578
+ prop;
1579
+ if (typeof name == 'string') { // if min/max was set with the string
1580
+ if (name === 'minDate' || name === 'minDateTime') {
1581
+ min = value;
1582
+ } else if (name === 'maxDate' || name === 'maxDateTime') {
1583
+ max = value;
1584
+ } else if (name === 'onSelect') {
1585
+ onselect = value;
1586
+ } else if (overrides.hasOwnProperty(name)) {
1587
+ if (typeof (value) === 'undefined') {
1588
+ return overrides[name];
1589
+ }
1590
+ fns[name] = value;
1591
+ name_clone = {}; //empty results in exiting function after overrides updated
1592
+ }
1593
+ } else if (typeof name == 'object') { //if min/max was set with the JSON
1594
+ if (name.minDate) {
1595
+ min = name.minDate;
1596
+ } else if (name.minDateTime) {
1597
+ min = name.minDateTime;
1598
+ } else if (name.maxDate) {
1599
+ max = name.maxDate;
1600
+ } else if (name.maxDateTime) {
1601
+ max = name.maxDateTime;
1602
+ }
1603
+ for (prop in overrides) {
1604
+ if (overrides.hasOwnProperty(prop) && name[prop]) {
1605
+ fns[prop] = name[prop];
1606
+ }
1607
+ }
1608
+ }
1609
+ for (prop in fns) {
1610
+ if (fns.hasOwnProperty(prop)) {
1611
+ overrides[prop] = fns[prop];
1612
+ if (!name_clone) { name_clone = $.extend({}, name);}
1613
+ delete name_clone[prop];
1614
+ }
1615
+ }
1616
+ if (name_clone && isEmptyObject(name_clone)) { return; }
1617
+ if (min) { //if min was set
1618
+ if (min === 0) {
1619
+ min = new Date();
1620
+ } else {
1621
+ min = new Date(min);
1622
+ }
1623
+ tp_inst._defaults.minDate = min;
1624
+ tp_inst._defaults.minDateTime = min;
1625
+ } else if (max) { //if max was set
1626
+ if (max === 0) {
1627
+ max = new Date();
1628
+ } else {
1629
+ max = new Date(max);
1630
+ }
1631
+ tp_inst._defaults.maxDate = max;
1632
+ tp_inst._defaults.maxDateTime = max;
1633
+ } else if (onselect) {
1634
+ tp_inst._defaults.onSelect = onselect;
1635
+ }
1636
+ }
1637
+ if (value === undefined) {
1638
+ return this._base_optionDatepicker.call($.datepicker, target, name);
1639
+ }
1640
+ return this._base_optionDatepicker.call($.datepicker, target, name_clone || name, value);
1641
+ };
1642
+ /*
1643
+ * jQuery isEmptyObject does not check hasOwnProperty - if someone has added to the object prototype,
1644
+ * it will return false for all objects
1645
+ */
1646
+ var isEmptyObject = function(obj) {
1647
+ var prop;
1648
+ for (prop in obj) {
1649
+ if (obj.hasOwnProperty(obj)) {
1650
+ return false;
1651
+ }
1652
+ }
1653
+ return true;
1654
+ };
1655
+
1656
+ /*
1657
+ * jQuery extend now ignores nulls!
1658
+ */
1659
+ var extendRemove = function(target, props) {
1660
+ $.extend(target, props);
1661
+ for (var name in props) {
1662
+ if (props[name] === null || props[name] === undefined) {
1663
+ target[name] = props[name];
1664
+ }
1665
+ }
1666
+ return target;
1667
+ };
1668
+
1669
+ /*
1670
+ * Determine by the time format if should use ampm
1671
+ * Returns true if should use ampm, false if not
1672
+ */
1673
+ var useAmpm = function(timeFormat){
1674
+ return (timeFormat.indexOf('t') !== -1 && timeFormat.indexOf('h') !== -1);
1675
+ };
1676
+
1677
+ /*
1678
+ * Converts 24 hour format into 12 hour
1679
+ * Returns 12 hour without leading 0
1680
+ */
1681
+ var convert24to12 = function(hour) {
1682
+ if (hour > 12) {
1683
+ hour = hour - 12;
1684
+ }
1685
+
1686
+ if (hour == 0) {
1687
+ hour = 12;
1688
+ }
1689
+
1690
+ return String(hour);
1691
+ };
1692
+
1693
+ /*
1694
+ * Splits datetime string into date ans time substrings.
1695
+ * Throws exception when date can't be parsed
1696
+ * Returns [dateString, timeString]
1697
+ */
1698
+ var splitDateTime = function(dateFormat, dateTimeString, dateSettings, timeSettings) {
1699
+ try {
1700
+ // The idea is to get the number separator occurances in datetime and the time format requested (since time has
1701
+ // fewer unknowns, mostly numbers and am/pm). We will use the time pattern to split.
1702
+ var separator = timeSettings && timeSettings.separator ? timeSettings.separator : $.timepicker._defaults.separator,
1703
+ format = timeSettings && timeSettings.timeFormat ? timeSettings.timeFormat : $.timepicker._defaults.timeFormat,
1704
+ timeParts = format.split(separator), // how many occurances of separator may be in our format?
1705
+ timePartsLen = timeParts.length,
1706
+ allParts = dateTimeString.split(separator),
1707
+ allPartsLen = allParts.length;
1708
+
1709
+ if (allPartsLen > 1) {
1710
+ return [
1711
+ allParts.splice(0,allPartsLen-timePartsLen).join(separator),
1712
+ allParts.splice(0,timePartsLen).join(separator)
1713
+ ];
1714
+ }
1715
+
1716
+ } catch (err) {
1717
+ $.timepicker.log('Could not split the date from the time. Please check the following datetimepicker options' +
1718
+ "\nthrown error: " + err +
1719
+ "\ndateTimeString" + dateTimeString +
1720
+ "\ndateFormat = " + dateFormat +
1721
+ "\nseparator = " + timeSettings.separator +
1722
+ "\ntimeFormat = " + timeSettings.timeFormat);
1723
+
1724
+ if (err.indexOf(":") >= 0) {
1725
+ // Hack! The error message ends with a colon, a space, and
1726
+ // the "extra" characters. We rely on that instead of
1727
+ // attempting to perfectly reproduce the parsing algorithm.
1728
+ var dateStringLength = dateTimeString.length - (err.length - err.indexOf(':') - 2),
1729
+ timeString = dateTimeString.substring(dateStringLength);
1730
+
1731
+ return [$.trim(dateTimeString.substring(0, dateStringLength)), $.trim(dateTimeString.substring(dateStringLength))];
1732
+
1733
+ } else {
1734
+ throw err;
1735
+ }
1736
+ }
1737
+ return [dateTimeString, ''];
1738
+ };
1739
+
1740
+ /*
1741
+ * Internal function to parse datetime interval
1742
+ * Returns: {date: Date, timeObj: Object}, where
1743
+ * date - parsed date without time (type Date)
1744
+ * timeObj = {hour: , minute: , second: , millisec: } - parsed time. Optional
1745
+ */
1746
+ var parseDateTimeInternal = function(dateFormat, timeFormat, dateTimeString, dateSettings, timeSettings) {
1747
+ var date;
1748
+ var splitRes = splitDateTime(dateFormat, dateTimeString, dateSettings, timeSettings);
1749
+ date = $.datepicker._base_parseDate(dateFormat, splitRes[0], dateSettings);
1750
+ if (splitRes[1] !== '') {
1751
+ var timeString = splitRes[1],
1752
+ parsedTime = $.datepicker.parseTime(timeFormat, timeString, timeSettings);
1753
+
1754
+ if (parsedTime === null) {
1755
+ throw 'Wrong time format';
1756
+ }
1757
+ return {
1758
+ date: date,
1759
+ timeObj: parsedTime
1760
+ };
1761
+ } else {
1762
+ return {
1763
+ date: date
1764
+ };
1765
+ }
1766
+ };
1767
+
1768
+ /*
1769
+ * Internal function to set timezone_select to the local timezone
1770
+ */
1771
+ var selectLocalTimeZone = function(tp_inst, date) {
1772
+ if (tp_inst && tp_inst.timezone_select) {
1773
+ tp_inst._defaults.useLocalTimezone = true;
1774
+ var now = typeof date !== 'undefined' ? date : new Date();
1775
+ var tzoffset = $.timepicker.timeZoneOffsetString(now);
1776
+ if (tp_inst._defaults.timezoneIso8601) {
1777
+ tzoffset = tzoffset.substring(0, 3) + ':' + tzoffset.substring(3);
1778
+ }
1779
+ tp_inst.timezone_select.val(tzoffset);
1780
+ }
1781
+ };
1782
+
1783
+ /*
1784
+ * Create a Singleton Insance
1785
+ */
1786
+ $.timepicker = new Timepicker();
1787
+
1788
+ /**
1789
+ * Get the timezone offset as string from a date object (eg '+0530' for UTC+5.5)
1790
+ * @param date
1791
+ * @return string
1792
+ */
1793
+ $.timepicker.timeZoneOffsetString = function(date) {
1794
+ var off = date.getTimezoneOffset() * -1,
1795
+ minutes = off % 60,
1796
+ hours = (off - minutes) / 60;
1797
+ return (off >= 0 ? '+' : '-') + ('0' + (hours * 101).toString()).slice(-2) + ('0' + (minutes * 101).toString()).slice(-2);
1798
+ };
1799
+
1800
+ /**
1801
+ * Calls `timepicker()` on the `startTime` and `endTime` elements, and configures them to
1802
+ * enforce date range limits.
1803
+ * n.b. The input value must be correctly formatted (reformatting is not supported)
1804
+ * @param Element startTime
1805
+ * @param Element endTime
1806
+ * @param obj options Options for the timepicker() call
1807
+ * @return jQuery
1808
+ */
1809
+ $.timepicker.timeRange = function(startTime, endTime, options) {
1810
+ return $.timepicker.handleRange('timepicker', startTime, endTime, options);
1811
+ };
1812
+
1813
+ /**
1814
+ * Calls `datetimepicker` on the `startTime` and `endTime` elements, and configures them to
1815
+ * enforce date range limits.
1816
+ * @param Element startTime
1817
+ * @param Element endTime
1818
+ * @param obj options Options for the `timepicker()` call. Also supports `reformat`,
1819
+ * a boolean value that can be used to reformat the input values to the `dateFormat`.
1820
+ * @param string method Can be used to specify the type of picker to be added
1821
+ * @return jQuery
1822
+ */
1823
+ $.timepicker.dateTimeRange = function(startTime, endTime, options) {
1824
+ $.timepicker.dateRange(startTime, endTime, options, 'datetimepicker');
1825
+ };
1826
+
1827
+ /**
1828
+ * Calls `method` on the `startTime` and `endTime` elements, and configures them to
1829
+ * enforce date range limits.
1830
+ * @param Element startTime
1831
+ * @param Element endTime
1832
+ * @param obj options Options for the `timepicker()` call. Also supports `reformat`,
1833
+ * a boolean value that can be used to reformat the input values to the `dateFormat`.
1834
+ * @param string method Can be used to specify the type of picker to be added
1835
+ * @return jQuery
1836
+ */
1837
+ $.timepicker.dateRange = function(startTime, endTime, options, method) {
1838
+ method = method || 'datepicker';
1839
+ $.timepicker.handleRange(method, startTime, endTime, options);
1840
+ };
1841
+
1842
+ /**
1843
+ * Calls `method` on the `startTime` and `endTime` elements, and configures them to
1844
+ * enforce date range limits.
1845
+ * @param string method Can be used to specify the type of picker to be added
1846
+ * @param Element startTime
1847
+ * @param Element endTime
1848
+ * @param obj options Options for the `timepicker()` call. Also supports `reformat`,
1849
+ * a boolean value that can be used to reformat the input values to the `dateFormat`.
1850
+ * @return jQuery
1851
+ */
1852
+ $.timepicker.handleRange = function(method, startTime, endTime, options) {
1853
+ $.fn[method].call(startTime, $.extend({
1854
+ onClose: function(dateText, inst) {
1855
+ checkDates(this, endTime, dateText);
1856
+ },
1857
+ onSelect: function(selectedDateTime) {
1858
+ selected(this, endTime, 'minDate');
1859
+ }
1860
+ }, options, options.start));
1861
+ $.fn[method].call(endTime, $.extend({
1862
+ onClose: function(dateText, inst) {
1863
+ checkDates(this, startTime, dateText);
1864
+ },
1865
+ onSelect: function(selectedDateTime) {
1866
+ selected(this, startTime, 'maxDate');
1867
+ }
1868
+ }, options, options.end));
1869
+ // timepicker doesn't provide access to its 'timeFormat' option,
1870
+ // nor could I get datepicker.formatTime() to behave with times, so I
1871
+ // have disabled reformatting for timepicker
1872
+ if (method != 'timepicker' && options.reformat) {
1873
+ $([startTime, endTime]).each(function() {
1874
+ var format = $(this)[method].call($(this), 'option', 'dateFormat'),
1875
+ date = new Date($(this).val());
1876
+ if ($(this).val() && date) {
1877
+ $(this).val($.datepicker.formatDate(format, date));
1878
+ }
1879
+ });
1880
+ }
1881
+ checkDates(startTime, endTime, startTime.val());
1882
+
1883
+ function checkDates(changed, other, dateText) {
1884
+ if (other.val() && (new Date(startTime.val()) > new Date(endTime.val()))) {
1885
+ other.val(dateText);
1886
+ }
1887
+ }
1888
+ selected(startTime, endTime, 'minDate');
1889
+ selected(endTime, startTime, 'maxDate');
1890
+
1891
+ function selected(changed, other, option) {
1892
+ if (!$(changed).val()) {
1893
+ return;
1894
+ }
1895
+ var date = $(changed)[method].call($(changed), 'getDate');
1896
+ // timepicker doesn't implement 'getDate' and returns a jQuery
1897
+ if (date.getTime) {
1898
+ $(other)[method].call($(other), 'option', option, date);
1899
+ }
1900
+ }
1901
+ return $([startTime.get(0), endTime.get(0)]);
1902
+ };
1903
+
1904
+ /**
1905
+ * Log error or data to the console during error or debugging
1906
+ * @param Object err pass any type object to log to the console during error or debugging
1907
+ * @return void
1908
+ */
1909
+ $.timepicker.log = function(err){
1910
+ if(window.console)
1911
+ console.log(err);
1912
+ };
1913
+
1914
+ /*
1915
+ * Keep up with the version
1916
+ */
1917
+ $.timepicker.version = "1.2";
1918
+
1919
+ })(jQuery);
assets/js/jquery.smallipop-0.4.0.min.js ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ /*!
2
+ Smallipop (02/05/2013)
3
+ Copyright (c) 2011-2013 Small Improvements (http://www.small-improvements.com)
4
+
5
+ Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) license.
6
+
7
+ @author Sebastian Helzle (sebastian@helzle.net)
8
+ */
9
+ (function(b){var a;b.smallipop=a={version:"0.4.0",defaults:{autoscrollPadding:200,contentAnimationSpeed:150,cssAnimations:{enabled:false,show:"animated fadeIn",hide:"animated fadeOut"},funcEase:"easeInOutQuad",handleInputs:true,hideDelay:500,hideTrigger:false,hideOnPopupClick:true,hideOnTriggerClick:true,infoClass:"smallipopHint",invertAnimation:false,popupOffset:31,popupYOffset:0,popupDistance:20,popupDelay:100,popupAnimationSpeed:200,preferredPosition:"top",referencedSelector:null,theme:"default",touchSupport:true,triggerAnimationSpeed:150,triggerOnClick:false,onAfterHide:null,onAfterShow:null,onBeforeHide:null,onBeforeShow:null,onTourClose:null,onTourNext:null,onTourPrev:null,windowPadding:30},currentTour:null,lastId:1,nextInstanceId:1,lastScrollCheck:0,labels:{prev:"Back",next:"Next",close:"Close",of:"of"},instances:{},scrollTimer:null,templates:{popup:b.trim(' <div class="smallipop-instance"> <div class="sipContent"/> <div class="sipArrowBorder"/> <div class="sipArrow"/> </div>')},tours:{},_hideSmallipop:function(p){var s,i,m,d,g,c,q,o,h,j,r,f,n,l,k;o=(p!=null?p.target:void 0)?b(p.target):p;n=a.instances;k=[];for(c in n){d=n[c];g=d.data();if(!(q=g.shown)){continue}if(g.isTour&&!d.is(o)){continue}h=b(".smallipop"+q);j=((l=h.data("smallipop"))!=null?l.options:void 0)||a.defaults;m=!j.hideOnTriggerClick&&o.is(h);i=!j.hideOnPopupClick&&d.find(o).length;if(o&&h.length&&(p!=null?p.type:void 0)==="click"&&(m||i)){continue}if(q&&j.hideTrigger){h.stop(true).fadeTo(j.triggerAnimationSpeed,1)}d.data({hideDelayTimer:null,beingShown:false});if(j.cssAnimations.enabled){d.removeClass(j.cssAnimations.show).addClass(j.cssAnimations.hide).data("shown","");if(j.onAfterHide){k.push(window.setTimeout(j.onAfterHide,j.popupAnimationSpeed))}else{k.push(void 0)}}else{s=j.invertAnimation?-1:1;r=g.xDistance*s;f=g.yDistance*s;k.push(d.stop(true).animate({top:"-="+r+"px",left:"+="+f+"px",opacity:0},j.popupAnimationSpeed,j.funcEase,function(){var e;e=b(this);if(!e.data("beingShown")){e.css("display","none").data("shown","")}return typeof j.onAfterHide==="function"?j.onAfterHide():void 0}))}}return k},_showSmallipop:function(f){var c,d;c=b(this).data("smallipop");if(c.popupInstance.data("shown")!==c.id&&((d=!c.type)==="checkbox"||d==="radio")){if(f!=null){f.preventDefault()}}return a._triggerMouseover.call(this)},_onTouchDevice:function(){return typeof Modernizr!=="undefined"&&Modernizr!==null?Modernizr.touch:void 0},_killTimers:function(c){clearTimeout(c.data("hideDelayTimer"));return clearTimeout(c.data("showDelayTimer"))},_refreshPosition:function(){var E,q,n,h,i,c,D,o,B,p,l,m,k,A,s,C,H,F,I,g,x,z,w,j,e,v,y,u,G,r,t,f,d;t=a.instances;d=[];for(A in t){c=t[A];o=c.data();z=o.shown;if(!z){continue}w=b(".smallipop"+z);i=w.data("smallipop").options;c.removeClass(function(J,K){return((K!=null?K.match(/sip\w+/g):void 0)||[]).join(" ")});c.addClass(i.theme);j=b(window);u=G=i.popupDistance;r=i.popupYOffset;q=c.data("position")==="fixed";n=w.offset();k=c.outerHeight();H=c.outerWidth();D=H/2;v=j.width();e=j.height();y=i.windowPadding;g=w.outerWidth();I=w.outerHeight();x=n.top-j.scrollTop();s=n.left+g/2;C=n.top-k+r;F=k+i.popupDistance-r;m=x-F;B=e-x-I-F;p=n.left-H-i.popupOffset;l=v-n.left-g-H;if((f=i.preferredPosition)==="left"||f==="right"){u=0;C+=I/2+k/2;if((i.preferredPosition==="left"&&p>y)||l<y){c.addClass("sipPositionedLeft");s=n.left-H-i.popupOffset;G=-G}else{c.addClass("sipPositionedRight");s=n.left+g+i.popupOffset}}else{G=0;if(s+D>v-y){s-=D*2-i.popupOffset;c.addClass("sipAlignLeft")}else{if(s-D<y){s-=i.popupOffset;c.addClass("sipAlignRight")}else{s-=D}}if((i.preferredPosition==="bottom"&&B>y)||m<y){C+=k+I-2*r;u=-u;r=0;c.addClass("sipAlignBottom")}}if(i.hideTrigger){w.stop(true).fadeTo(i.triggerAnimationSpeed,0)}h=0;E=o.beingShown&&!i.cssAnimations.enabled;if(!E){C-=u;s+=G;u=0;G=0;h=1}if(q){s-=j.scrollLeft();C-=j.scrollTop()}c.data({xDistance:u,yDistance:G}).css({top:C,left:s,display:"block",opacity:h});d.push(a._fadeInPopup(c,{top:"-="+u+"px",left:"+="+G+"px",opacity:1}))}return d},_fadeInPopup:function(d,c){var e,f;e=((f=a._getTrigger(d.data("shown")).data("smallipop"))!=null?f.options:void 0)||a.defaults;if(e.cssAnimations.enabled){d.addClass(e.cssAnimations.show);return window.setTimeout(function(){return a._fadeInPopupFinished(d,e)},e.popupAnimationSpeed)}else{return d.stop(true).animate(c,e.popupAnimationSpeed,e.funcEase,function(){return a._fadeInPopupFinished(d,e)})}},_fadeInPopupFinished:function(d,e){var c;c=d.data();if(c.beingShown){d.data("beingShown",false);return typeof e.onAfterShow==="function"?e.onAfterShow(a._getTrigger(c.shown)):void 0}},_getTrigger:function(c){return b(".smallipop"+c)},_showPopup:function(e,h){var j,i,d,c,f,g;if(h==null){h=""}g=e.data("smallipop");d=g.popupInstance;if(!d.data("triggerHovered")){return}f=d.data("shown");if(f){j=a._getTrigger(f);if(j.length){i=j.data("smallipop").options||a.defaults;if(i.hideTrigger){j.stop(true).fadeTo(i.fadeSpeed,1)}}}c=h||g.hint;if(g.options.referencedContent&&!h){c=b(g.options.referencedContent).html()||c}d.data({beingShown:true,shown:g.id}).find(".sipContent").html(c);d.data("position","").css("position","absolute");if(this._isElementFixed(e)){d.data("position","fixed").css("position","fixed")}if(g.id!==f){d.attr("class","smallipop-instance")}return a._refreshPosition()},_isElementFixed:function(c){var d;d=c;while(d.length&&d[0].nodeName!=="HTML"){if(d.css("position")==="fixed"){return true}d=d.parent()}return false},_triggerMouseover:function(){var h,c,e,d,g,f;d=c=b(this);h=d.hasClass("sipInitialized");if(!h){d=a._getTrigger(c.data("shown"))}if(!d.length){return}g=d.data("smallipop");c=g.popupInstance.data((h?"triggerHovered":"hovered"),true);a._killTimers(c);e=c.data("shown");if(e!==g.id||c.css("opacity")===0){if(typeof(f=g.options).onBeforeShow==="function"){f.onBeforeShow(d)}return c.data("showDelayTimer",setTimeout(function(){return a._showPopup(d)},g.options.popupDelay))}},_triggerMouseout:function(){var h,d,c,e,g,f;e=d=b(this);h=e.hasClass("sipInitialized");if(!h){e=a._getTrigger(d.data("shown"))}if(!e.length){return}g=e.data("smallipop");d=g.popupInstance.data((h?"triggerHovered":"hovered"),false);a._killTimers(d);c=d.data();if(!(c.hovered||c.triggerHovered)){if(typeof(f=g.options).onBeforeHide==="function"){f.onBeforeHide(e)}return d.data("hideDelayTimer",setTimeout(function(){return a._hideSmallipop(d)},g.options.hideDelay))}},_onWindowScroll:function(c){clearTimeout(a.scrollTimer);return a.scrollTimer=setTimeout(a._refreshPosition,250)},setContent:function(e,g){var d,c,f;if(!(e!=null?e.length:void 0)){return}f=e.data("smallipop");d=f.tourTitle;if(d){c=f.popupInstance.find(".smallipop-tour-content")}else{c=f.popupInstance.find(".sipContent")}if(c.html()!==g){return c.stop(true).fadeTo(f.options.contentAnimationSpeed,0,function(){b(this).html(g).fadeTo(f.options.contentAnimationSpeed,1);return a._refreshPosition()})}},_runTour:function(d){var g,e,c,f,j,h;f=d.data("smallipop");c=f!=null?f.tourTitle:void 0;if(!(c&&a.tours[c])){return}a.tours[c].sort(function(k,i){return k.index-i.index});a.currentTour=c;g=a.tours[c];for(e=j=0,h=g.length-1;0<=h?j<=h:j>=h;e=0<=h?++j:--j){if(g[e].id===f.id){return a._tourShow(c,e)}}},_tourShow:function(j,g){var d,e,h,i,l,k,f,c;i=a.tours[j];if(!i){return}f=i[g].trigger;c=f.data("smallipop");k=g>0?'<a href="#" class="smallipop-tour-prev">'+a.labels.prev+"</a>":"";l=g<i.length-1?'<a href="#" class="smallipop-tour-next">'+a.labels.next+"</a>":"";d=g===i.length-1?'<a href="#" class="smallipop-tour-close">'+a.labels.close+"</a>":"";e='<a href="#" class="smallipop-tour-close-icon">&Chi;</a>';h=' <div class="smallipop-tour-content">'+c.hint+"</div> "+e+' <div class="smallipop-tour-footer"> <div class="smallipop-tour-progress"> '+(g+1)+" "+a.labels.of+" "+i.length+" </div> "+k+" "+l+" "+d+' <br style="clear:both;"/> </div>';a._killTimers(c.popupInstance);c.popupInstance.data("triggerHovered",true);return a._showWhenVisible(f,h)},_showWhenVisible:function(c,e){var g,d,f,h;d=c.offset().top;g=d-b(document).scrollTop();h=b(window).height();f=c.data("smallipop").options;if(!this._isElementFixed(c)&&(g<f.autoscrollPadding||g>h-f.autoscrollPadding)){return b("html, body").animate({scrollTop:d-h/2},800,"swing",function(){return a._showPopup(c,e)})}else{return a._showPopup(c,e)}},_tourNext:function(j){var l,h,c,k,m,f,g,d;if(j!=null){j.preventDefault()}l=a.tours[a.currentTour];if(!l){return}c=l[0].popupInstance;k=c.data("shown")||l[0].id;for(h=f=0,g=l.length-2;0<=g?f<=g:f>=g;h=0<=g?++f:--f){if(!(l[h].id===k)){continue}if((d=l[h].trigger.data("smallipop"))!=null){if(typeof(m=d.options).onTourNext==="function"){m.onTourNext(l[h+1].trigger)}}return a._tourShow(a.currentTour,h+1)}},_tourPrev:function(j){var l,h,c,k,m,f,g,d;if(j!=null){j.preventDefault()}l=a.tours[a.currentTour];if(!l){return}c=l[0].popupInstance;k=c.data("shown")||l[0].id;for(h=f=1,g=l.length-1;1<=g?f<=g:f>=g;h=1<=g?++f:--f){if(!(l[h].id===k)){continue}if((d=l[h].trigger.data("smallipop"))!=null){if(typeof(m=d.options).onTourPrev==="function"){m.onTourPrev(l[h-1].trigger)}}return a._tourShow(a.currentTour,h-1)}},_tourClose:function(g){var c,d,f;if(g!=null){g.preventDefault()}c=b(g.target).closest(".smallipop-instance");if((f=a._getTrigger(c.data("shown")).data("smallipop"))!=null){if(typeof(d=f.options).onTourClose==="function"){d.onTourClose()}}return a._hideSmallipop(c)},_destroy:function(c){return c.each(function(){var e,d;d=b(this);e=d.data("smallipop");if(e){return d.unbind(".smallipop").data("smallipop",{}).removeClass("smallipop sipInitialized smallipop"+e.id+" "+e.options.theme)}})},_onWindowKeyUp:function(j){var f,g,h,i,c,d;h=(i=j!=null?j.target.tagName.toLowerCase():void 0)==="input"||i==="textarea";switch(j.which){case 27:c=a.instances;d=[];for(g in c){f=c[g];d.push(a._hideSmallipop(f))}return d;break;case 37:if(!h){return a._tourPrev()}break;case 39:if(!h){return a._tourNext()}}},_getInstance:function(e,d){var c;if(e==null){e="default"}if(d==null){d=false}if(a.instances[e]){return a.instances[e]}c=b(a.templates.popup).css("opacity",0).attr("id","smallipop"+(a.nextInstanceId++)).addClass("smallipop-instance").data({xDistance:0,yDistance:0,isTour:d}).bind({"mouseover.smallipop":a._triggerMouseover,"mouseout.smallipop":a._triggerMouseout});b("body").append(c);if(d){c.delegate(".smallipop-tour-prev","click.smallipop",a._tourPrev).delegate(".smallipop-tour-next","click.smallipop",a._tourNext).delegate(".smallipop-tour-close, .smallipop-tour-close-icon","click.smallipop",a._tourClose)}else{c.delegate("a","click.smallipop",a._hideSmallipop)}if(a.nextInstanceId===2){b(document).bind("click.smallipop touchend.smallipop",a._hideSmallipop);b(window).bind({"resize.smallipop":a._refreshPosition,"scroll.smallipop":a._onWindowScroll,keyup:a._onWindowKeyUp})}return a.instances[e]=c}};if(!b.easing.easeInOutQuad){b.easing.easeInOutQuad=function(f,g,e,i,h){if((g/=h/2)<1){return i/2*g*g+e}else{return -i/2*((--g)*(g-2)-1)+e}}}return b.fn.smallipop=function(d,e){var c;if(d==null){d={}}if(e==null){e=""}if(typeof d==="string"){switch(d.toLowerCase()){case"show":a._showSmallipop.call(this.first().get(0));break;case"hide":a._hideSmallipop(this.first().get(0));break;case"destroy":a._destroy(this);break;case"tour":a._runTour(this.first());break;case"update":a.setContent(this.first(),e)}return this}d=b.extend({},a.defaults,d);if((typeof Modernizr!=="undefined"&&Modernizr!==null?Modernizr.cssanimations:void 0)===false){d.cssAnimations.enabled=false}c=a._getInstance();return this.each(function(){var l,i,r,n,g,s,h,k,f,o,j,m,p,q;s=b(this);h=s[0].tagName.toLowerCase();p=s.attr("type");f=s.data();r=e||s.find("."+d.infoClass).html()||s.attr("title");if(r&&!s.hasClass("sipInitialized")){i=a.lastId++;o={};m=c;j=b.extend(true,{},d);for(n in f){q=f[n];if(!(n.indexOf("smallipop")>=0)){continue}g=n.replace("smallipop","");g=g.substr(0,1).toLowerCase()+g.substr(1);j[g]=q}l=j.handleInputs&&(h==="input"||h==="select"||h==="textarea");if(l){j.hideOnTriggerClick=false;o["focus.smallipop"]=a._triggerMouseover;o["blur.smallipop"]=a._triggerMouseout}else{o["mouseout.smallipop"]=a._triggerMouseout}if(j.triggerOnClick||(j.touchSupport&&a._onTouchDevice())){o["click.smallipop"]=a._showSmallipop}else{o["click.smallipop"]=a._triggerMouseout;o["mouseover.smallipop"]=a._triggerMouseover}if(j.tourIndex){k=j.tourTitle||"defaultTour";o={};j.hideOnTriggerClick=false;j.hideOnPopupClick=false;m=a._getInstance(k,true);if(!a.tours[k]){a.tours[k]=[]}a.tours[k].push({index:j.tourIndex||0,id:i,trigger:s,popupInstance:m})}s.addClass("sipInitialized smallipop"+i).attr("title","").data("smallipop",{id:i,hint:r,options:j,tagName:h,type:p,tourTitle:k,popupInstance:m}).bind(o);if(!j.hideOnTriggerClick){return s.delegate("a","click.smallipop",a._hideSmallipop)}}})}})(jQuery);
assets/js/jquery.validate.min.js ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ /*! jQuery Validation Plugin - v1.11.0 - 2/4/2013
2
+ * https://github.com/jzaefferer/jquery-validation
3
+ * Copyright (c) 2013 Jörn Zaefferer; Licensed MIT */
4
+ (function(e){e.extend(e.fn,{validate:function(t){if(!this.length){t&&t.debug&&window.console&&console.warn("Nothing selected, can't validate, returning nothing.");return}var n=e.data(this[0],"validator");return n?n:(this.attr("novalidate","novalidate"),n=new e.validator(t,this[0]),e.data(this[0],"validator",n),n.settings.onsubmit&&(this.validateDelegate(":submit","click",function(t){n.settings.submitHandler&&(n.submitButton=t.target),e(t.target).hasClass("cancel")&&(n.cancelSubmit=!0)}),this.submit(function(t){function r(){var r;return n.settings.submitHandler?(n.submitButton&&(r=e("<input type='hidden'/>").attr("name",n.submitButton.name).val(n.submitButton.value).appendTo(n.currentForm)),n.settings.submitHandler.call(n,n.currentForm,t),n.submitButton&&r.remove(),!1):!0}return n.settings.debug&&t.preventDefault(),n.cancelSubmit?(n.cancelSubmit=!1,r()):n.form()?n.pendingRequest?(n.formSubmitted=!0,!1):r():(n.focusInvalid(),!1)})),n)},valid:function(){if(e(this[0]).is("form"))return this.validate().form();var t=!0,n=e(this[0].form).validate();return this.each(function(){t&=n.element(this)}),t},removeAttrs:function(t){var n={},r=this;return e.each(t.split(/\s/),function(e,t){n[t]=r.attr(t),r.removeAttr(t)}),n},rules:function(t,n){var r=this[0];if(t){var i=e.data(r.form,"validator").settings,s=i.rules,o=e.validator.staticRules(r);switch(t){case"add":e.extend(o,e.validator.normalizeRule(n)),s[r.name]=o,n.messages&&(i.messages[r.name]=e.extend(i.messages[r.name],n.messages));break;case"remove":if(!n)return delete s[r.name],o;var u={};return e.each(n.split(/\s/),function(e,t){u[t]=o[t],delete o[t]}),u}}var a=e.validator.normalizeRules(e.extend({},e.validator.classRules(r),e.validator.attributeRules(r),e.validator.dataRules(r),e.validator.staticRules(r)),r);if(a.required){var f=a.required;delete a.required,a=e.extend({required:f},a)}return a}}),e.extend(e.expr[":"],{blank:function(t){return!e.trim(""+t.value)},filled:function(t){return!!e.trim(""+t.value)},unchecked:function(e){return!e.checked}}),e.validator=function(t,n){this.settings=e.extend(!0,{},e.validator.defaults,t),this.currentForm=n,this.init()},e.validator.format=function(t,n){return arguments.length===1?function(){var n=e.makeArray(arguments);return n.unshift(t),e.validator.format.apply(this,n)}:(arguments.length>2&&n.constructor!==Array&&(n=e.makeArray(arguments).slice(1)),n.constructor!==Array&&(n=[n]),e.each(n,function(e,n){t=t.replace(new RegExp("\\{"+e+"\\}","g"),function(){return n})}),t)},e.extend(e.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",validClass:"valid",errorElement:"label",focusInvalid:!0,errorContainer:e([]),errorLabelContainer:e([]),onsubmit:!0,ignore:":hidden",ignoreTitle:!1,onfocusin:function(e,t){this.lastActive=e,this.settings.focusCleanup&&!this.blockFocusCleanup&&(this.settings.unhighlight&&this.settings.unhighlight.call(this,e,this.settings.errorClass,this.settings.validClass),this.addWrapper(this.errorsFor(e)).hide())},onfocusout:function(e,t){!this.checkable(e)&&(e.name in this.submitted||!this.optional(e))&&this.element(e)},onkeyup:function(e,t){if(t.which===9&&this.elementValue(e)==="")return;(e.name in this.submitted||e===this.lastElement)&&this.element(e)},onclick:function(e,t){e.name in this.submitted?this.element(e):e.parentNode.name in this.submitted&&this.element(e.parentNode)},highlight:function(t,n,r){t.type==="radio"?this.findByName(t.name).addClass(n).removeClass(r):e(t).addClass(n).removeClass(r)},unhighlight:function(t,n,r){t.type==="radio"?this.findByName(t.name).removeClass(n).addClass(r):e(t).removeClass(n).addClass(r)}},setDefaults:function(t){e.extend(e.validator.defaults,t)},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date (ISO).",number:"Please enter a valid number.",digits:"Please enter only digits.",creditcard:"Please enter a valid credit card number.",equalTo:"Please enter the same value again.",maxlength:e.validator.format("Please enter no more than {0} characters."),minlength:e.validator.format("Please enter at least {0} characters."),rangelength:e.validator.format("Please enter a value between {0} and {1} characters long."),range:e.validator.format("Please enter a value between {0} and {1}."),max:e.validator.format("Please enter a value less than or equal to {0}."),min:e.validator.format("Please enter a value greater than or equal to {0}.")},autoCreateRanges:!1,prototype:{init:function(){function r(t){var n=e.data(this[0].form,"validator"),r="on"+t.type.replace(/^validate/,"");n.settings[r]&&n.settings[r].call(n,this[0],t)}this.labelContainer=e(this.settings.errorLabelContainer),this.errorContext=this.labelContainer.length&&this.labelContainer||e(this.currentForm),this.containers=e(this.settings.errorContainer).add(this.settings.errorLabelContainer),this.submitted={},this.valueCache={},this.pendingRequest=0,this.pending={},this.invalid={},this.reset();var t=this.groups={};e.each(this.settings.groups,function(n,r){typeof r=="string"&&(r=r.split(/\s/)),e.each(r,function(e,r){t[r]=n})});var n=this.settings.rules;e.each(n,function(t,r){n[t]=e.validator.normalizeRule(r)}),e(this.currentForm).validateDelegate(":text, [type='password'], [type='file'], select, textarea, [type='number'], [type='search'] ,[type='tel'], [type='url'], [type='email'], [type='datetime'], [type='date'], [type='month'], [type='week'], [type='time'], [type='datetime-local'], [type='range'], [type='color'] ","focusin focusout keyup",r).validateDelegate("[type='radio'], [type='checkbox'], select, option","click",r),this.settings.invalidHandler&&e(this.currentForm).bind("invalid-form.validate",this.settings.invalidHandler)},form:function(){return this.checkForm(),e.extend(this.submitted,this.errorMap),this.invalid=e.extend({},this.errorMap),this.valid()||e(this.currentForm).triggerHandler("invalid-form",[this]),this.showErrors(),this.valid()},checkForm:function(){this.prepareForm();for(var e=0,t=this.currentElements=this.elements();t[e];e++)this.check(t[e]);return this.valid()},element:function(t){t=this.validationTargetFor(this.clean(t)),this.lastElement=t,this.prepareElement(t),this.currentElements=e(t);var n=this.check(t)!==!1;return n?delete this.invalid[t.name]:this.invalid[t.name]=!0,this.numberOfInvalids()||(this.toHide=this.toHide.add(this.containers)),this.showErrors(),n},showErrors:function(t){if(t){e.extend(this.errorMap,t),this.errorList=[];for(var n in t)this.errorList.push({message:t[n],element:this.findByName(n)[0]});this.successList=e.grep(this.successList,function(e){return!(e.name in t)})}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors()},resetForm:function(){e.fn.resetForm&&e(this.currentForm).resetForm(),this.submitted={},this.lastElement=null,this.prepareForm(),this.hideErrors(),this.elements().removeClass(this.settings.errorClass).removeData("previousValue")},numberOfInvalids:function(){return this.objectLength(this.invalid)},objectLength:function(e){var t=0;for(var n in e)t++;return t},hideErrors:function(){this.addWrapper(this.toHide).hide()},valid:function(){return this.size()===0},size:function(){return this.errorList.length},focusInvalid:function(){if(this.settings.focusInvalid)try{e(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus().trigger("focusin")}catch(t){}},findLastActive:function(){var t=this.lastActive;return t&&e.grep(this.errorList,function(e){return e.element.name===t.name}).length===1&&t},elements:function(){var t=this,n={};return e(this.currentForm).find("input, select, textarea").not(":submit, :reset, :image, [disabled]").not(this.settings.ignore).filter(function(){return!this.name&&t.settings.debug&&window.console&&console.error("%o has no name assigned",this),this.name in n||!t.objectLength(e(this).rules())?!1:(n[this.name]=!0,!0)})},clean:function(t){return e(t)[0]},errors:function(){var t=this.settings.errorClass.replace(" ",".");return e(this.settings.errorElement+"."+t,this.errorContext)},reset:function(){this.successList=[],this.errorList=[],this.errorMap={},this.toShow=e([]),this.toHide=e([]),this.currentElements=e([])},prepareForm:function(){this.reset(),this.toHide=this.errors().add(this.containers)},prepareElement:function(e){this.reset(),this.toHide=this.errorsFor(e)},elementValue:function(t){var n=e(t).attr("type"),r=e(t).val();return n==="radio"||n==="checkbox"?e("input[name='"+e(t).attr("name")+"']:checked").val():typeof r=="string"?r.replace(/\r/g,""):r},check:function(t){t=this.validationTargetFor(this.clean(t));var n=e(t).rules(),r=!1,i=this.elementValue(t),s;for(var o in n){var u={method:o,parameters:n[o]};try{s=e.validator.methods[o].call(this,i,t,u.parameters);if(s==="dependency-mismatch"){r=!0;continue}r=!1;if(s==="pending"){this.toHide=this.toHide.not(this.errorsFor(t));return}if(!s)return this.formatAndAdd(t,u),!1}catch(a){throw this.settings.debug&&window.console&&console.log("Exception occured when checking element "+t.id+", check the '"+u.method+"' method.",a),a}}if(r)return;return this.objectLength(n)&&this.successList.push(t),!0},customDataMessage:function(t,n){return e(t).data("msg-"+n.toLowerCase())||t.attributes&&e(t).attr("data-msg-"+n.toLowerCase())},customMessage:function(e,t){var n=this.settings.messages[e];return n&&(n.constructor===String?n:n[t])},findDefined:function(){for(var e=0;e<arguments.length;e++)if(arguments[e]!==undefined)return arguments[e];return undefined},defaultMessage:function(t,n){return this.findDefined(this.customMessage(t.name,n),this.customDataMessage(t,n),!this.settings.ignoreTitle&&t.title||undefined,e.validator.messages[n],"<strong>Warning: No message defined for "+t.name+"</strong>")},formatAndAdd:function(t,n){var r=this.defaultMessage(t,n.method),i=/\$?\{(\d+)\}/g;typeof r=="function"?r=r.call(this,n.parameters,t):i.test(r)&&(r=e.validator.format(r.replace(i,"{$1}"),n.parameters)),this.errorList.push({message:r,element:t}),this.errorMap[t.name]=r,this.submitted[t.name]=r},addWrapper:function(e){return this.settings.wrapper&&(e=e.add(e.parent(this.settings.wrapper))),e},defaultShowErrors:function(){var e,t;for(e=0;this.errorList[e];e++){var n=this.errorList[e];this.settings.highlight&&this.settings.highlight.call(this,n.element,this.settings.errorClass,this.settings.validClass),this.showLabel(n.element,n.message)}this.errorList.length&&(this.toShow=this.toShow.add(this.containers));if(this.settings.success)for(e=0;this.successList[e];e++)this.showLabel(this.successList[e]);if(this.settings.unhighlight)for(e=0,t=this.validElements();t[e];e++)this.settings.unhighlight.call(this,t[e],this.settings.errorClass,this.settings.validClass);this.toHide=this.toHide.not(this.toShow),this.hideErrors(),this.addWrapper(this.toShow).show()},validElements:function(){return this.currentElements.not(this.invalidElements())},invalidElements:function(){return e(this.errorList).map(function(){return this.element})},showLabel:function(t,n){var r=this.errorsFor(t);r.length?(r.removeClass(this.settings.validClass).addClass(this.settings.errorClass),r.html(n)):(r=e("<"+this.settings.errorElement+">").attr("for",this.idOrName(t)).addClass(this.settings.errorClass).html(n||""),this.settings.wrapper&&(r=r.hide().show().wrap("<"+this.settings.wrapper+"/>").parent()),this.labelContainer.append(r).length||(this.settings.errorPlacement?this.settings.errorPlacement(r,e(t)):r.insertAfter(t))),!n&&this.settings.success&&(r.text(""),typeof this.settings.success=="string"?r.addClass(this.settings.success):this.settings.success(r,t)),this.toShow=this.toShow.add(r)},errorsFor:function(t){var n=this.idOrName(t);return this.errors().filter(function(){return e(this).attr("for")===n})},idOrName:function(e){return this.groups[e.name]||(this.checkable(e)?e.name:e.id||e.name)},validationTargetFor:function(e){return this.checkable(e)&&(e=this.findByName(e.name).not(this.settings.ignore)[0]),e},checkable:function(e){return/radio|checkbox/i.test(e.type)},findByName:function(t){return e(this.currentForm).find("[name='"+t+"']")},getLength:function(t,n){switch(n.nodeName.toLowerCase()){case"select":return e("option:selected",n).length;case"input":if(this.checkable(n))return this.findByName(n.name).filter(":checked").length}return t.length},depend:function(e,t){return this.dependTypes[typeof e]?this.dependTypes[typeof e](e,t):!0},dependTypes:{"boolean":function(e,t){return e},string:function(t,n){return!!e(t,n.form).length},"function":function(e,t){return e(t)}},optional:function(t){var n=this.elementValue(t);return!e.validator.methods.required.call(this,n,t)&&"dependency-mismatch"},startRequest:function(e){this.pending[e.name]||(this.pendingRequest++,this.pending[e.name]=!0)},stopRequest:function(t,n){this.pendingRequest--,this.pendingRequest<0&&(this.pendingRequest=0),delete this.pending[t.name],n&&this.pendingRequest===0&&this.formSubmitted&&this.form()?(e(this.currentForm).submit(),this.formSubmitted=!1):!n&&this.pendingRequest===0&&this.formSubmitted&&(e(this.currentForm).triggerHandler("invalid-form",[this]),this.formSubmitted=!1)},previousValue:function(t){return e.data(t,"previousValue")||e.data(t,"previousValue",{old:null,valid:!0,message:this.defaultMessage(t,"remote")})}},classRuleSettings:{required:{required:!0},email:{email:!0},url:{url:!0},date:{date:!0},dateISO:{dateISO:!0},number:{number:!0},digits:{digits:!0},creditcard:{creditcard:!0}},addClassRules:function(t,n){t.constructor===String?this.classRuleSettings[t]=n:e.extend(this.classRuleSettings,t)},classRules:function(t){var n={},r=e(t).attr("class");return r&&e.each(r.split(" "),function(){this in e.validator.classRuleSettings&&e.extend(n,e.validator.classRuleSettings[this])}),n},attributeRules:function(t){var n={},r=e(t);for(var i in e.validator.methods){var s;i==="required"?(s=r.get(0).getAttribute(i),s===""&&(s=!0),s=!!s):s=r.attr(i),s?n[i]=s:r[0].getAttribute("type")===i&&(n[i]=!0)}return n.maxlength&&/-1|2147483647|524288/.test(n.maxlength)&&delete n.maxlength,n},dataRules:function(t){var n,r,i={},s=e(t);for(n in e.validator.methods)r=s.data("rule-"+n.toLowerCase()),r!==undefined&&(i[n]=r);return i},staticRules:function(t){var n={},r=e.data(t.form,"validator");return r.settings.rules&&(n=e.validator.normalizeRule(r.settings.rules[t.name])||{}),n},normalizeRules:function(t,n){return e.each(t,function(r,i){if(i===!1){delete t[r];return}if(i.param||i.depends){var s=!0;switch(typeof i.depends){case"string":s=!!e(i.depends,n.form).length;break;case"function":s=i.depends.call(n,n)}s?t[r]=i.param!==undefined?i.param:!0:delete t[r]}}),e.each(t,function(r,i){t[r]=e.isFunction(i)?i(n):i}),e.each(["minlength","maxlength"],function(){t[this]&&(t[this]=Number(t[this]))}),e.each(["rangelength"],function(){var n;t[this]&&(e.isArray(t[this])?t[this]=[Number(t[this][0]),Number(t[this][1])]:typeof t[this]=="string"&&(n=t[this].split(/[\s,]+/),t[this]=[Number(n[0]),Number(n[1])]))}),e.validator.autoCreateRanges&&(t.min&&t.max&&(t.range=[t.min,t.max],delete t.min,delete t.max),t.minlength&&t.maxlength&&(t.rangelength=[t.minlength,t.maxlength],delete t.minlength,delete t.maxlength)),t},normalizeRule:function(t){if(typeof t=="string"){var n={};e.each(t.split(/\s/),function(){n[this]=!0}),t=n}return t},addMethod:function(t,n,r){e.validator.methods[t]=n,e.validator.messages[t]=r!==undefined?r:e.validator.messages[t],n.length<3&&e.validator.addClassRules(t,e.validator.normalizeRule(t))},methods:{required:function(t,n,r){if(!this.depend(r,n))return"dependency-mismatch";if(n.nodeName.toLowerCase()==="select"){var i=e(n).val();return i&&i.length>0}return this.checkable(n)?this.getLength(t,n)>0:e.trim(t).length>0},remote:function(t,n,r){if(this.optional(n))return"dependency-mismatch";var i=this.previousValue(n);this.settings.messages[n.name]||(this.settings.messages[n.name]={}),i.originalMessage=this.settings.messages[n.name].remote,this.settings.messages[n.name].remote=i.message,r=typeof r=="string"&&{url:r}||r;if(i.old===t)return i.valid;i.old=t;var s=this;this.startRequest(n);var o={};return o[n.name]=t,e.ajax(e.extend(!0,{url:r,mode:"abort",port:"validate"+n.name,dataType:"json",data:o,success:function(r){s.settings.messages[n.name].remote=i.originalMessage;var o=r===!0||r==="true";if(o){var u=s.formSubmitted;s.prepareElement(n),s.formSubmitted=u,s.successList.push(n),delete s.invalid[n.name],s.showErrors()}else{var a={},f=r||s.defaultMessage(n,"remote");a[n.name]=i.message=e.isFunction(f)?f(t):f,s.invalid[n.name]=!0,s.showErrors(a)}i.valid=o,s.stopRequest(n,o)}},r)),"pending"},minlength:function(t,n,r){var i=e.isArray(t)?t.length:this.getLength(e.trim(t),n);return this.optional(n)||i>=r},maxlength:function(t,n,r){var i=e.isArray(t)?t.length:this.getLength(e.trim(t),n);return this.optional(n)||i<=r},rangelength:function(t,n,r){var i=e.isArray(t)?t.length:this.getLength(e.trim(t),n);return this.optional(n)||i>=r[0]&&i<=r[1]},min:function(e,t,n){return this.optional(t)||e>=n},max:function(e,t,n){return this.optional(t)||e<=n},range:function(e,t,n){return this.optional(t)||e>=n[0]&&e<=n[1]},email:function(e,t){return this.optional(t)||/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i.test(e)},url:function(e,t){return this.optional(t)||/^(https?|s?ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(e)},date:function(e,t){return this.optional(t)||!/Invalid|NaN/.test((new Date(e)).toString())},dateISO:function(e,t){return this.optional(t)||/^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/.test(e)},number:function(e,t){return this.optional(t)||/^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(e)},digits:function(e,t){return this.optional(t)||/^\d+$/.test(e)},creditcard:function(e,t){if(this.optional(t))return"dependency-mismatch";if(/[^0-9 \-]+/.test(e))return!1;var n=0,r=0,i=!1;e=e.replace(/\D/g,"");for(var s=e.length-1;s>=0;s--){var o=e.charAt(s);r=parseInt(o,10),i&&(r*=2)>9&&(r-=9),n+=r,i=!i}return n%10===0},equalTo:function(t,n,r){var i=e(r);return this.settings.onfocusout&&i.unbind(".validate-equalTo").bind("blur.validate-equalTo",function(){e(n).valid()}),t===i.val()}}}),e.format=e.validator.format})(jQuery),function(e){var t={};if(e.ajaxPrefilter)e.ajaxPrefilter(function(e,n,r){var i=e.port;e.mode==="abort"&&(t[i]&&t[i].abort(),t[i]=r)});else{var n=e.ajax;e.ajax=function(r){var i=("mode"in r?r:e.ajaxSettings).mode,s=("port"in r?r:e.ajaxSettings).port;return i==="abort"?(t[s]&&t[s].abort(),t[s]=n.apply(this,arguments)):n.apply(this,arguments)}}}(jQuery),function(e){e.extend(e.fn,{validateDelegate:function(t,n,r){return this.bind(n,function(n){var i=e(n.target);if(i.is(t))return r.apply(i,arguments)})}})}(jQuery);
assets/js/subscriptions.js ADDED
@@ -0,0 +1,306 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function($) {
2
+
3
+ var subscription = {
4
+
5
+ init: function() {
6
+
7
+ $('input#wpuf-recuring-pay').on('click', this.showSubscriptionRecurring );
8
+
9
+ $('input#wpuf-trial-status').on('click', this.showSubscriptionPack );
10
+
11
+ $('.wpuf-coupon-info-wrap').on( 'click','a.wpuf-apply-coupon', this.couponApply );
12
+
13
+ $('.wpuf-coupon-info-wrap').on( 'click','a.wpuf-copon-show', this.couponShow );
14
+
15
+ $('.wpuf-coupon-info-wrap').on( 'click','a.wpuf-copon-cancel', this.couponCancel );
16
+
17
+ $('.wpuf-assing-pack-btn').on( 'click', this.showPackDropdown );
18
+
19
+ $('.wpuf-delete-pack-btn').on( 'click', this.deletePack );
20
+
21
+ $('.wpuf-disabled-link').click( this.packAlert );
22
+
23
+ //on change enable expiration check status
24
+ this.changeExpirationFieldVisibility(':checkbox#wpuf-enable_post_expiration');
25
+
26
+ $('.wpuf-metabox-post_expiration').on('change',':checkbox#wpuf-enable_post_expiration',this.changeExpirationFieldVisibility);
27
+ //on change expiration type drop down
28
+ //this.setTimeExpiration('select#wpuf-expiration_time_type');
29
+ $('.wpuf-metabox-post_expiration').on('change','select#wpuf-expiration_time_type',this.setTimeExpiration);
30
+
31
+ },
32
+
33
+ packAlert : function () {
34
+ alert( 'Please Cancel Your Currently Active Pack first ! ' );
35
+ },
36
+
37
+ showPackDropdown: function(e) {
38
+ e.preventDefault();
39
+ var self = $(this),
40
+ wrap = self.parents('.wpuf-user-subscription'),
41
+ sub_dropdown = wrap.find('.wpuf-pack-dropdown'),
42
+ sub_details = wrap.find('.wpuf-user-sub-info'),
43
+ cancel_btn = wrap.find('.wpuf-cancel-pack'),
44
+ add_btn = wrap.find('.wpuf-add-pack');
45
+
46
+ if ( sub_dropdown.attr( 'disabled' ) === 'disabled' ) {
47
+ sub_dropdown.show().removeAttr('disabled');
48
+ sub_details.hide().attr('disabled', true );
49
+ cancel_btn.show();
50
+ add_btn.hide();
51
+ } else {
52
+ sub_details.show().removeAttr('disabled');
53
+ sub_dropdown.hide().attr('disabled', true );
54
+ cancel_btn.hide();
55
+ add_btn.show();
56
+ }
57
+
58
+ },
59
+
60
+ deletePack: function(e){
61
+ var userid = $(e.target).attr('data-userid');
62
+ $.post(
63
+ ajaxurl,
64
+ {
65
+ 'action' : 'wpuf_delete_user_package',
66
+ 'userid' : userid
67
+ },
68
+ function(data){
69
+ if(data){
70
+ $('.wpuf-user-sub-info').remove();
71
+ $(e.target).remove();
72
+ }
73
+ }
74
+ );
75
+
76
+ },
77
+
78
+ couponCancel: function(e) {
79
+
80
+ e.preventDefault();
81
+
82
+ var self = $(this),
83
+
84
+ data = {
85
+
86
+ action: 'coupon_cancel',
87
+
88
+ _wpnonce: wpuf_frontend.nonce,
89
+
90
+ pack_id: self.data('pack_id')
91
+
92
+ },
93
+
94
+ coupon_field = self.parents('.wpuf-coupon-info-wrap').find('input.wpuf-coupon-field');
95
+
96
+
97
+
98
+ coupon_field.addClass('wpuf-coupon-field-spinner');
99
+
100
+ $.post( wpuf_frontend.ajaxurl, data, function( res ) {
101
+
102
+ coupon_field.removeClass('wpuf-coupon-field-spinner');
103
+
104
+ if ( res.success ) {
105
+
106
+ $('.wpuf-pack-inner' ).html( res.data.append_data );
107
+
108
+ $('.wpuf-coupon-id-field').val('');
109
+
110
+ var coupon_wrap = self.closest('.wpuf-copon-wrap');
111
+
112
+ coupon_wrap.hide();
113
+
114
+ coupon_wrap.siblings('.wpuf-copon-show').show();
115
+
116
+ }
117
+
118
+ });
119
+
120
+
121
+
122
+ },
123
+
124
+
125
+
126
+ couponShow: function(e) {
127
+
128
+ e.preventDefault();
129
+
130
+ var self = $(this);
131
+
132
+ self.hide();
133
+
134
+ self.parents('.wpuf-coupon-info-wrap').find('.wpuf-copon-wrap').show();
135
+
136
+ },
137
+
138
+
139
+
140
+ couponApply: function(e) {
141
+
142
+ e.preventDefault();
143
+
144
+ var self = $(this),
145
+
146
+ coupon_field = self.parents('.wpuf-coupon-info-wrap').find('input.wpuf-coupon-field'),
147
+
148
+ coupon = coupon_field.val();
149
+
150
+ if ( coupon === '' ) {
151
+
152
+ return;
153
+
154
+ }
155
+
156
+ var data = {
157
+
158
+ action: 'coupon_apply',
159
+
160
+ _wpnonce: wpuf_frontend.nonce,
161
+
162
+ coupon: coupon,
163
+
164
+ pack_id: self.data('pack_id')
165
+
166
+ };
167
+
168
+
169
+
170
+ if ( self.attr('disabled') === 'disabled' ) {
171
+
172
+ //return;
173
+
174
+ }
175
+
176
+ self.attr( 'disabled', true );
177
+
178
+ coupon_field.addClass('wpuf-coupon-field-spinner');
179
+
180
+
181
+
182
+ $.post( wpuf_frontend.ajaxurl, data, function( res ) {
183
+
184
+ coupon_field.removeClass('wpuf-coupon-field-spinner');
185
+
186
+ if ( res.success ) {
187
+
188
+
189
+
190
+ $('.wpuf-pack-inner' ).html( res.data.append_data );
191
+
192
+ $('.wpuf-coupon-id-field').val( res.data.coupon_id );
193
+
194
+ if ( res.data.amount <= 0 ) {
195
+
196
+ $('.wpuf-nullamount-hide').hide();
197
+
198
+ }
199
+
200
+ } else {
201
+
202
+ $('.wpuf-subscription-error').html(res.data.message);
203
+
204
+ }
205
+
206
+ });
207
+
208
+ },
209
+
210
+
211
+
212
+ showSubscriptionRecurring: function() {
213
+
214
+
215
+
216
+ var self = $(this),
217
+
218
+ wrap = self.parents('table.form-table'),
219
+
220
+ pack_child = wrap.find('.wpuf-recurring-child'),
221
+
222
+ trial_checkbox = wrap.find( 'input#wpuf-trial-status'),
223
+
224
+ trial_child = wrap.find('.wpuf-trial-child'),
225
+
226
+ expire_field = wrap.find('.wpuf-subcription-expire');
227
+
228
+
229
+
230
+ if ( self.is(':checked') ) {
231
+
232
+ if ( trial_checkbox.is(':checked') ) {
233
+
234
+ trial_child.show();
235
+
236
+ }
237
+
238
+ pack_child.show();
239
+
240
+ expire_field.hide();
241
+
242
+ } else {
243
+
244
+ trial_child.hide();
245
+
246
+ pack_child.hide();
247
+
248
+ expire_field.show();
249
+
250
+ }
251
+
252
+ },
253
+
254
+
255
+
256
+ showSubscriptionPack: function() {
257
+
258
+ var self = $(this),
259
+
260
+ pack_status = self.closest('table.form-table').find('.wpuf-trial-child');
261
+
262
+ if ( self.is(':checked') ) {
263
+
264
+ pack_status.show();
265
+
266
+ } else {
267
+
268
+ pack_status.hide();
269
+
270
+ }
271
+
272
+ },
273
+
274
+ setTimeExpiration: function(e){
275
+ var timeArray = {
276
+ 'day' : 30,
277
+ 'month' : 12,
278
+ 'year': 100
279
+ };
280
+ $('#wpuf-expiration_time_value').html('');
281
+ var timeVal = e.target?$(e.target).val():$(e).val();
282
+ for(var time = 1; time <= timeArray[timeVal]; time++){
283
+ $('#wpuf-expiration_time_value').append('<option>'+ time +'</option>');
284
+ }
285
+ },
286
+
287
+ changeExpirationFieldVisibility : function(e){
288
+
289
+ var checkbox_obj = e.target? $(e.target) : $(e);
290
+
291
+ if ( checkbox_obj.is(':checked') ) {
292
+ $('.wpuf_expiration_field').show();
293
+ } else {
294
+ $('.wpuf_expiration_field').hide();
295
+ }
296
+ }
297
+
298
+ };
299
+
300
+ if ( typeof datepicker === 'function') {
301
+ $('.wpuf-date-picker').datepicker({ dateFormat: "yy-mm-dd" });
302
+ }
303
+
304
+ subscription.init();
305
+
306
+ })(jQuery);
assets/js/upload.js ADDED
@@ -0,0 +1,214 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ;(function($) {
2
+
3
+ /**
4
+ * Upload handler helper
5
+ *
6
+ * @param string {browse_button} browse_button ID of the pickfile
7
+ * @param string {container} container ID of the wrapper
8
+ * @param int {max} maximum number of file uplaods
9
+ * @param string {type}
10
+ */
11
+ window.WPUF_Uploader = function (browse_button, container, max, type, allowed_type, max_file_size) {
12
+ this.removed_files = [],
13
+ this.container = container;
14
+ this.browse_button = browse_button;
15
+ this.max = max || 1;
16
+ this.count = $('#' + container).find('.wpuf-attachment-list > li').length; //count how many items are there
17
+ this.perFileCount = 0; //file count on each upload
18
+
19
+ //if no element found on the page, bail out
20
+ if( !$('#'+browse_button).length ) {
21
+ return;
22
+ }
23
+
24
+ //instantiate the uploader
25
+ this.uploader = new plupload.Uploader({
26
+ runtimes: 'html5,html4',
27
+ browse_button: browse_button,
28
+ container: container,
29
+ multipart: true,
30
+ multipart_params: {
31
+ action: 'wpuf_file_upload',
32
+ form_id: $( '#' + browse_button ).data('form_id')
33
+ },
34
+ max_file_count : 2,
35
+ multiple_queues: false,
36
+ multi_selection: ( ( browse_button == 'wpuf-avatar-pickfiles' || browse_button == 'wpuf-featured_image-pickfiles' ) ? false : true ),
37
+ urlstream_upload: true,
38
+ file_data_name: 'wpuf_file',
39
+ max_file_size: max_file_size + 'kb',
40
+ url: wpuf_frontend_upload.plupload.url + '&type=' + type,
41
+ flash_swf_url: wpuf_frontend_upload.flash_swf_url,
42
+ filters: [{
43
+ title: 'Allowed Files',
44
+ extensions: allowed_type
45
+ }]
46
+ });
47
+
48
+ //attach event handlers
49
+ this.uploader.bind('Init', $.proxy(this, 'init'));
50
+ this.uploader.bind('FilesAdded', $.proxy(this, 'added'));
51
+ this.uploader.bind('QueueChanged', $.proxy(this, 'upload'));
52
+ this.uploader.bind('UploadProgress', $.proxy(this, 'progress'));
53
+ this.uploader.bind('Error', $.proxy(this, 'error'));
54
+ this.uploader.bind('FileUploaded', $.proxy(this, 'uploaded'));
55
+
56
+ this.uploader.init();
57
+
58
+ $('#' + container).on('click', 'a.attachment-delete', $.proxy(this.removeAttachment, this));
59
+ };
60
+
61
+ WPUF_Uploader.prototype = {
62
+
63
+ init: function (up, params) {
64
+ this.showHide();
65
+ $('#' + this.container).prepend('<div class="wpuf-file-warning"></div>');
66
+ },
67
+
68
+ showHide: function () {
69
+
70
+ if ( this.count >= this.max) {
71
+
72
+ if ( this.count > this.max ) {
73
+ $('#' + this.container + ' .wpuf-file-warning').html( wpuf_frontend_upload.warning );
74
+ } else {
75
+ $('#' + this.container + ' .wpuf-file-warning').html( wpuf_frontend_upload.warning );
76
+ }
77
+
78
+ $('#' + this.container).find('.file-selector').hide();
79
+
80
+ return;
81
+ };
82
+ $('#' + this.container + ' .wpuf-file-warning').html( '' );
83
+ $('#' + this.container).find('.file-selector').show();
84
+ },
85
+
86
+ added: function (up, files) {
87
+ var $container = $('#' + this.container).find('.wpuf-attachment-upload-filelist');
88
+
89
+ this.showHide();
90
+
91
+ $.each(files, function(i, file) {
92
+ $container.append(
93
+ '<div class="upload-item" id="' + file.id + '"><div class="progress progress-striped active"><div class="bar"></div></div><div class="filename original">' +
94
+ file.name + ' (' + plupload.formatSize(file.size) + ') <b></b>' +
95
+ '</div></div>');
96
+ });
97
+
98
+ up.refresh(); // Reposition Flash/Silverlight
99
+ up.start();
100
+ },
101
+
102
+ upload: function (uploader) {
103
+
104
+
105
+ this.count = uploader.files.length - this.removed_files.length ;
106
+ this.showHide();
107
+
108
+
109
+ },
110
+
111
+ progress: function (up, file) {
112
+ var item = $('#' + file.id);
113
+
114
+ $('.bar', item).css({ width: file.percent + '%' });
115
+ $('.percent', item).html( file.percent + '%' );
116
+ },
117
+
118
+ error: function (up, error) {
119
+ $('#' + this.container).find('#' + error.file.id).remove();
120
+
121
+ var msg = '';
122
+ switch(error.code) {
123
+ case -600:
124
+ msg = wpuf_frontend_upload.size_error;
125
+ break;
126
+
127
+ case -601:
128
+ msg = wpuf_frontend_upload.type_error;
129
+ break;
130
+
131
+ default:
132
+ msg = 'Error #' + error.code + ': ' + error.message;
133
+ break;
134
+ }
135
+
136
+ alert(msg);
137
+
138
+ this.count -= 1;
139
+ this.showHide();
140
+ this.uploader.refresh();
141
+ },
142
+
143
+ uploaded: function (up, file, response) {
144
+ // var res = $.parseJSON(response.response);
145
+ var self = this;
146
+
147
+ $('#' + file.id + " b").html("100%");
148
+ $('#' + file.id).remove();
149
+
150
+ if(response.response !== 'error') {
151
+
152
+ this.perFileCount++;
153
+ var $container = $('#' + this.container).find('.wpuf-attachment-list');
154
+ $container.append(response.response);
155
+
156
+ if ( this.perFileCount > this.max ) {
157
+ var attach_id = $('.wpuf-image-wrap:last a.attachment-delete',$container).data('attach_id');
158
+ self.removeExtraAttachment(attach_id);
159
+ $('.wpuf-image-wrap',$container).last().remove();
160
+ this.perFileCount--;
161
+ }
162
+
163
+ } else {
164
+ alert(response.error);
165
+
166
+ this.count -= 1;
167
+ this.showHide();
168
+ }
169
+ },
170
+
171
+ removeAttachment: function(e) {
172
+ e.preventDefault();
173
+
174
+ var self = this,
175
+ el = $(e.currentTarget);
176
+
177
+ if ( confirm(wpuf_frontend_upload.confirmMsg) ) {
178
+ var data = {
179
+ 'attach_id' : el.data('attach_id'),
180
+ 'nonce' : wpuf_frontend_upload.nonce,
181
+ 'action' : 'wpuf_file_del'
182
+ };
183
+ this.removed_files.push(data);
184
+ jQuery.post(wpuf_frontend_upload.ajaxurl, data, function() {
185
+ self.perFileCount--;
186
+ el.parent().parent().remove();
187
+
188
+ self.count -= 1;
189
+ self.showHide();
190
+ self.uploader.refresh();
191
+ });
192
+ }
193
+ },
194
+
195
+ removeExtraAttachment : function( attach_id ) {
196
+
197
+
198
+ var self = this;
199
+
200
+ var data = {
201
+ 'attach_id' : attach_id,
202
+ 'nonce' : wpuf_frontend_upload.nonce,
203
+ 'action' : 'wpuf_file_del'
204
+ };
205
+ this.removed_files.push(data);
206
+ jQuery.post(wpuf_frontend_upload.ajaxurl, data, function() {
207
+ self.count -= 1;
208
+ self.showHide();
209
+ self.uploader.refresh();
210
+ });
211
+ }
212
+
213
+ };
214
+ })(jQuery);
assets/js/upload.min.js ADDED
@@ -0,0 +1 @@
 
1
+ (function(e){window.WPUF_Uploader=function(t,n,r,i,s,o){this.container=n;this.browse_button=t;this.max=r||1;this.count=e("#"+n).find(".wpuf-attachment-list > li").length;if(!e("#"+t).length)return;this.uploader=new plupload.Uploader({runtimes:"html5,html4",browse_button:t,container:n,multipart:!0,multipart_params:{action:"wpuf_file_upload"},multiple_queues:!1,multi_selection:!1,urlstream_upload:!0,file_data_name:"wpuf_file",max_file_size:o+"kb",url:wpuf_frontend_upload.plupload.url+"&type="+i,flash_swf_url:wpuf_frontend_upload.flash_swf_url,filters:[{title:"Allowed Files",extensions:s}]});this.uploader.bind("Init",e.proxy(this,"init"));this.uploader.bind("FilesAdded",e.proxy(this,"added"));this.uploader.bind("QueueChanged",e.proxy(this,"upload"));this.uploader.bind("UploadProgress",e.proxy(this,"progress"));this.uploader.bind("Error",e.proxy(this,"error"));this.uploader.bind("FileUploaded",e.proxy(this,"uploaded"));this.uploader.init();e("#"+n).on("click","a.attachment-delete",e.proxy(this.removeAttachment,this))};WPUF_Uploader.prototype={init:function(e,t){this.showHide()},showHide:function(){if(this.count>=this.max){e("#"+this.container).find(".file-selector").hide();return}e("#"+this.container).find(".file-selector").show()},added:function(t,n){var r=e("#"+this.container).find(".wpuf-attachment-upload-filelist");this.count+=1;this.showHide();e.each(n,function(e,t){r.append('<div class="upload-item" id="'+t.id+'"><div class="progress progress-striped active"><div class="bar"></div></div><div class="filename original">'+t.name+" ("+plupload.formatSize(t.size)+") <b></b>"+"</div></div>")});t.refresh();t.start()},upload:function(e){this.uploader.start()},progress:function(t,n){var r=e("#"+n.id);e(".bar",r).css({width:n.percent+"%"});e(".percent",r).html(n.percent+"%")},error:function(t,n){e("#"+this.container).find("#"+n.file.id).remove();alert("Error #"+n.code+": "+n.message);this.count-=1;this.showHide();this.uploader.refresh()},uploaded:function(t,n,r){e("#"+n.id+" b").html("100%");e("#"+n.id).remove();if(r.response!=="error"){var i=e("#"+this.container).find(".wpuf-attachment-list");i.append(r.response)}else{alert(res.error);this.count-=1;this.showHide()}},removeAttachment:function(t){t.preventDefault();var n=this,r=e(t.currentTarget);if(confirm(wpuf_frontend_upload.confirmMsg)){var i={attach_id:r.data("attach_id"),nonce:wpuf_frontend_upload.nonce,action:"wpuf_file_del"};jQuery.post(wpuf_frontend_upload.ajaxurl,i,function(){r.parent().parent().remove();n.count-=1;n.showHide();n.uploader.refresh()})}}}})(jQuery);
class/frontend-dashboard.php ADDED
@@ -0,0 +1,145 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Dashboard class
5
+ *
6
+ * @author Tareq Hasan
7
+ * @package WP User Frontend
8
+ */
9
+ class WPUF_Frontend_Dashboard {
10
+
11
+ function __construct() {
12
+ add_shortcode( 'wpuf_dashboard', array($this, 'shortcode') );
13
+ }
14
+
15
+ /**
16
+ * Handle's user dashboard functionality
17
+ *
18
+ * Insert shortcode [wpuf_dashboard] in a page to
19
+ * show the user dashboard
20
+ *
21
+ * @since 0.1
22
+ */
23
+ function shortcode( $atts ) {
24
+
25
+ extract( shortcode_atts( array('post_type' => 'post'), $atts ) );
26
+
27
+ ob_start();
28
+
29
+ if ( is_user_logged_in() ) {
30
+ $this->post_listing( $post_type );
31
+ } else {
32
+ $message = wpuf_get_option( 'un_auth_msg', 'wpuf_dashboard' );
33
+
34
+ if ( empty( $message ) ) {
35
+ $msg = '<div class="wpuf-message">' . sprintf( __( "This page is restricted. Please %s to view this page.", 'wpuf' ), wp_loginout( get_permalink(), false ) ) . '</div>';
36
+ echo apply_filters( 'wpuf_dashboard_unauth', $msg, $post_type );
37
+ //wp_login_form();
38
+ } else {
39
+ echo $message;
40
+ }
41
+ }
42
+
43
+ $content = ob_get_contents();
44
+ ob_end_clean();
45
+
46
+ return $content;
47
+ }
48
+
49
+ /**
50
+ * List's all the posts by the user
51
+ *
52
+ * @global object $wpdb
53
+ * @global object $userdata
54
+ */
55
+ function post_listing( $post_type ) {
56
+ global $post;
57
+
58
+ $pagenum = isset( $_GET['pagenum'] ) ? intval( $_GET['pagenum'] ) : 1;
59
+
60
+ //delete post
61
+ if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == "del" ) {
62
+ $this->delete_post();
63
+ }
64
+
65
+ //show delete success message
66
+ if ( isset( $_GET['msg'] ) && $_GET['msg'] == 'deleted' ) {
67
+ echo '<div class="success">' . __( 'Post Deleted', 'wpuf' ) . '</div>';
68
+ }
69
+
70
+ $args = array(
71
+ 'author' => get_current_user_id(),
72
+ 'post_status' => array('draft', 'future', 'pending', 'publish', 'private'),
73
+ 'post_type' => $post_type,
74
+ 'posts_per_page' => wpuf_get_option( 'per_page', 'wpuf_dashboard', 10 ),
75
+ 'paged' => $pagenum
76
+ );
77
+
78
+ $original_post = $post;
79
+ $dashboard_query = new WP_Query( apply_filters( 'wpuf_dashboard_query', $args ) );
80
+ $post_type_obj = get_post_type_object( $post_type );
81
+
82
+ wpuf_load_template( 'dashboard.php', array(
83
+ 'post_type' => $post_type,
84
+ 'userdata' => wp_get_current_user(),
85
+ 'dashboard_query' => $dashboard_query,
86
+ 'post_type_obj' => $post_type_obj,
87
+ 'post' => $post,
88
+ 'pagenum' => $pagenum
89
+ ) );
90
+
91
+ wp_reset_postdata();
92
+
93
+ $this->user_info();
94
+ }
95
+
96
+ /**
97
+ * Show user info on dashboard
98
+ */
99
+ function user_info() {
100
+ global $userdata;
101
+
102
+ if ( wpuf_get_option( 'show_user_bio', 'wpuf_dashboard', 'on' ) == 'on' ) {
103
+ ?>
104
+ <div class="wpuf-author">
105
+ <h3><?php _e( 'Author Info', 'wpuf' ); ?></h3>
106
+ <div class="wpuf-author-inside odd">
107
+ <div class="wpuf-user-image"><?php echo get_avatar( $userdata->user_email, 80 ); ?></div>
108
+ <div class="wpuf-author-body">
109
+ <p class="wpuf-user-name"><a href="<?php echo get_author_posts_url( $userdata->ID ); ?>"><?php printf( esc_attr__( '%s', 'wpuf' ), $userdata->display_name ); ?></a></p>
110
+ <p class="wpuf-author-info"><?php echo $userdata->description; ?></p>
111
+ </div>
112
+ </div>
113
+ </div><!-- .author -->
114
+ <?php
115
+ }
116
+ }
117
+
118
+ /**
119
+ * Delete a post
120
+ *
121
+ * Only post author and editors has the capability to delete a post
122
+ */
123
+ function delete_post() {
124
+ global $userdata;
125
+
126
+ $nonce = $_REQUEST['_wpnonce'];
127
+ if ( !wp_verify_nonce( $nonce, 'wpuf_del' ) ) {
128
+ die( "Security check" );
129
+ }
130
+
131
+ //check, if the requested user is the post author
132
+ $maybe_delete = get_post( $_REQUEST['pid'] );
133
+
134
+ if ( ($maybe_delete->post_author == $userdata->ID) || current_user_can( 'delete_others_pages' ) ) {
135
+ wp_delete_post( $_REQUEST['pid'] );
136
+
137
+ //redirect
138
+ $redirect = add_query_arg( array('msg' => 'deleted'), get_permalink() );
139
+ wp_redirect( $redirect );
140
+ } else {
141
+ echo '<div class="error">' . __( 'You are not the post author. Cheeting huh!', 'wpuf' ) . '</div>';
142
+ }
143
+ }
144
+
145
+ }
class/frontend-form-post.php ADDED
@@ -0,0 +1,786 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class WPUF_Frontend_Form_Post extends WPUF_Render_Form {
4
+
5
+ private static $_instance;
6
+ private $post_expiration_date = 'wpuf-post_expiration_date';
7
+ private $expired_post_status = 'wpuf-expired_post_status';
8
+ private $post_expiration_message = 'wpuf-post_expiration_message';
9
+
10
+ function __construct() {
11
+
12
+ add_shortcode( 'wpuf_form', array( $this, 'add_post_shortcode' ) );
13
+ add_shortcode( 'wpuf_edit', array( $this, 'edit_post_shortcode' ) );
14
+
15
+ // ajax requests
16
+ add_action( 'wp_ajax_wpuf_submit_post', array( $this, 'submit_post' ) );
17
+ add_action( 'wp_ajax_nopriv_wpuf_submit_post', array( $this, 'submit_post' ) );
18
+ add_action( 'wp_ajax_make_media_embed_code', array( $this, 'make_media_embed_code' ) );
19
+ add_action( 'wp_ajax_nopriv_make_media_embed_code', array( $this, 'make_media_embed_code' ) );
20
+
21
+ // draft
22
+ add_action( 'wp_ajax_wpuf_draft_post', array( $this, 'draft_post' ) );
23
+
24
+ // form preview
25
+ add_action( 'wp_ajax_wpuf_form_preview', array( $this, 'preview_form' ) );
26
+ }
27
+
28
+ public static function init() {
29
+ if ( !self::$_instance ) {
30
+ self::$_instance = new self;
31
+ }
32
+
33
+ return self::$_instance;
34
+ }
35
+
36
+ /**
37
+ * Add post shortcode handler
38
+ *
39
+ * @param array $atts
40
+ * @return string
41
+ */
42
+ function add_post_shortcode( $atts ) {
43
+ extract( shortcode_atts( array( 'id' => 0 ), $atts ) );
44
+ ob_start();
45
+
46
+ $form_settings = wpuf_get_form_settings( $id );
47
+ $info = apply_filters( 'wpuf_addpost_notice', '', $id, $form_settings );
48
+ $user_can_post = apply_filters( 'wpuf_can_post', 'yes', $id, $form_settings );
49
+
50
+ if ( $user_can_post == 'yes' ) {
51
+ $this->render_form( $id );
52
+ } else {
53
+ echo '<div class="wpuf-info">' . $info . '</div>';
54
+ }
55
+
56
+ $content = ob_get_contents();
57
+ ob_end_clean();
58
+
59
+ return $content;
60
+ }
61
+
62
+ /**
63
+ * Edit post shortcode handler
64
+ *
65
+ * @param array $atts
66
+ * @return string
67
+ */
68
+ function edit_post_shortcode( $atts ) {
69
+ global $userdata;
70
+
71
+ ob_start();
72
+
73
+ if ( !is_user_logged_in() ) {
74
+ echo '<div class="wpuf-message">' . __( 'You are not logged in', 'wpuf' ) . '</div>';
75
+ wp_login_form();
76
+ return;
77
+ }
78
+
79
+ $post_id = isset( $_GET['pid'] ) ? intval( $_GET['pid'] ) : 0;
80
+
81
+ //is editing enabled?
82
+ if ( wpuf_get_option( 'enable_post_edit', 'wpuf_dashboard', 'yes' ) != 'yes' ) {
83
+ return '<div class="wpuf-info">' . __( 'Post Editing is disabled', 'wpuf' ) . '</div>';
84
+ }
85
+
86
+ $curpost = get_post( $post_id );
87
+
88
+ if ( !$curpost ) {
89
+ return '<div class="wpuf-info">' . __( 'Invalid post', 'wpuf' );
90
+ }
91
+
92
+ // has permission?
93
+ if ( !current_user_can( 'delete_others_posts' ) && ( $userdata->ID != $curpost->post_author ) ) {
94
+ return '<div class="wpuf-info">' . __( 'You are not allowed to edit', 'wpuf' ) . '</div>';
95
+ }
96
+
97
+ $form_id = get_post_meta( $post_id, self::$config_id, true );
98
+ $form_settings = wpuf_get_form_settings( $form_id );
99
+
100
+ // fallback to default form
101
+ if ( !$form_id ) {
102
+ $form_id = wpuf_get_option( 'default_post_form', 'wpuf_general' );
103
+ }
104
+
105
+ if ( !$form_id ) {
106
+ return '<div class="wpuf-info">' . __( "I don't know how to edit this post, I don't have the form ID", 'wpuf' ) . '</div>';
107
+ }
108
+
109
+ $disable_pending_edit = wpuf_get_option( 'disable_pending_edit', 'wpuf_dashboard', 'on' );
110
+
111
+ if ( $curpost->post_status == 'pending' && $disable_pending_edit == 'on' ) {
112
+ return '<div class="wpuf-info">' . __( 'You can\'t edit a post while in pending mode.', 'wpuf' );
113
+ }
114
+
115
+ if ( isset( $_GET['msg'] ) && $_GET['msg'] == 'post_updated' ) {
116
+ echo '<div class="wpuf-success">';
117
+ echo str_replace( '%link%', get_permalink( $post_id ), $form_settings['update_message'] );
118
+ echo '</div>';
119
+ }
120
+
121
+ $this->render_form( $form_id, $post_id );
122
+
123
+ $content = ob_get_contents();
124
+ ob_end_clean();
125
+
126
+ return $content;
127
+ }
128
+
129
+ /**
130
+ * New/Edit post submit handler
131
+ *
132
+ * @return void
133
+ */
134
+ function submit_post() {
135
+
136
+ check_ajax_referer( 'wpuf_form_add' );
137
+
138
+ @header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
139
+
140
+ $form_id = isset( $_POST['form_id'] ) ? intval( $_POST['form_id'] ) : 0;
141
+ $form_vars = $this->get_input_fields( $form_id );
142
+ $form_settings = wpuf_get_form_settings( $form_id );
143
+
144
+ list( $post_vars, $taxonomy_vars, $meta_vars ) = $form_vars;
145
+
146
+ // don't check captcha on post edit
147
+ if ( !isset( $_POST['post_id'] ) ) {
148
+
149
+ // search if rs captcha is there
150
+ if ( $this->search( $post_vars, 'input_type', 'really_simple_captcha' ) ) {
151
+ $this->validate_rs_captcha();
152
+ }
153
+
154
+ // check recaptcha
155
+ if ( $this->search( $post_vars, 'input_type', 'recaptcha' ) ) {
156
+
157
+ $no_captcha = '';
158
+ if ( isset( $_POST["g-recaptcha-response"] ) ) {
159
+ $no_captcha = 1;
160
+ } else {
161
+ $no_captcha = 0;
162
+ }
163
+ $this->validate_re_captcha( $no_captcha );
164
+ }
165
+ }
166
+
167
+ $is_update = false;
168
+ $post_author = null;
169
+ $default_post_author = wpuf_get_option( 'default_post_owner', 'wpuf_general', 1 );
170
+
171
+ // Guest Stuffs: check for guest post
172
+ if ( !is_user_logged_in() ) {
173
+
174
+ if ( $form_settings['guest_post'] == 'true' && $form_settings['guest_details'] == 'true' ) {
175
+ $guest_name = trim( $_POST['guest_name'] );
176
+ $guest_email = trim( $_POST['guest_email'] );
177
+
178
+ // is valid email?
179
+ if ( !is_email( $guest_email ) ) {
180
+ $this->send_error( __( 'Invalid email address.', 'wpuf' ) );
181
+ }
182
+
183
+ // check if the user email already exists
184
+ $user = get_user_by( 'email', $guest_email );
185
+ if ( $user ) {
186
+ // $post_author = $user->ID;
187
+ echo json_encode( array(
188
+ 'success' => false,
189
+ 'error' => __( "You already have an account in our site. Please login to continue.\n\nClicking 'OK' will redirect you to the login page and you will lost the form data.\nClick 'Cancel' to stay at this page.", 'wpuf' ),
190
+ 'type' => 'login',
191
+ 'redirect_to' => wp_login_url( get_permalink( $_POST['page_id'] ) )
192
+ ) );
193
+ exit;
194
+ } else {
195
+
196
+ // user not found, lets register him
197
+ // username from email address
198
+ $username = $this->guess_username( $guest_email );
199
+ $user_pass = wp_generate_password( 12, false );
200
+
201
+ $errors = new WP_Error();
202
+ do_action( 'register_post', $username, $guest_email, $errors );
203
+
204
+ $user_id = wp_create_user( $username, $user_pass, $guest_email );
205
+
206
+ // if its a success and no errors found
207
+ if ( $user_id && !is_wp_error( $user_id ) ) {
208
+ update_user_option( $user_id, 'default_password_nag', true, true ); //Set up the Password change nag.
209
+
210
+ if ( class_exists( 'Theme_My_Login_Custom_Email' ) ) {
211
+ do_action( 'tml_new_user_registered', $user_id, $user_pass );
212
+ } else {
213
+ wp_send_new_user_notifications( $user_id );
214
+ }
215
+
216
+ // update display name to full name
217
+ wp_update_user( array( 'ID' => $user_id, 'display_name' => $guest_name ) );
218
+
219
+ $post_author = $user_id;
220
+ } else {
221
+ //something went wrong creating the user, set post author to the default author
222
+ $post_author = $default_post_author;
223
+ }
224
+ }
225
+
226
+ // guest post is enabled and details are off
227
+ } elseif ( $form_settings['guest_post'] == 'true' && $form_settings['guest_details'] == 'false' ) {
228
+ $post_author = $default_post_author;
229
+ }
230
+
231
+ // the user must be logged in already
232
+ } else {
233
+ $post_author = get_current_user_id();
234
+ }
235
+
236
+ $postarr = array(
237
+ 'post_type' => $form_settings['post_type'],
238
+ 'post_status' => isset( $form_settings['post_status'] ) ? $form_settings['post_status'] : 'publish',
239
+ 'post_author' => $post_author,
240
+ 'post_title' => isset( $_POST['post_title'] ) ? trim( $_POST['post_title'] ) : '',
241
+ 'post_content' => isset( $_POST['post_content'] ) ? trim( $_POST['post_content'] ) : '',
242
+ 'post_excerpt' => isset( $_POST['post_excerpt'] ) ? trim( $_POST['post_excerpt'] ) : '',
243
+ );
244
+
245
+ //if date is set and assigned as publish date
246
+ if ( isset( $_POST['wpuf_is_publish_time'] ) ) {
247
+
248
+ if ( isset( $_POST[$_POST['wpuf_is_publish_time']] ) && !empty( $_POST[$_POST['wpuf_is_publish_time']] ) ) {
249
+ $postarr['post_date'] = date( 'Y-m-d H:i:s', strtotime( str_replace( array( ':', '/' ), '-', $_POST[$_POST['wpuf_is_publish_time']] ) ) );
250
+ }
251
+ }
252
+
253
+ if ( isset( $_POST['category'] ) ) {
254
+ $category = $_POST['category'];
255
+ $postarr['post_category'] = is_array( $category ) ? $category : array( $category );
256
+
257
+ if ( !is_array( $category ) && is_string( $category ) ) {
258
+ $category_strings = explode( ',', $category );
259
+
260
+ $cat_ids = array();
261
+
262
+ foreach ( $category_strings as $key => $each_cat_string ) {
263
+ $cat_ids[] = get_cat_ID( trim( $each_cat_string ) );
264
+ $postarr['post_category'] = $cat_ids;
265
+ }
266
+ }
267
+ }
268
+
269
+ if ( isset( $_POST['tags'] ) ) {
270
+ $postarr['tags_input'] = explode( ',', $_POST['tags'] );
271
+ }
272
+
273
+ // if post_id is passed, we update the post
274
+ if ( isset( $_POST['post_id'] ) ) {
275
+
276
+ $is_update = true;
277
+ $postarr['ID'] = $_POST['post_id'];
278
+ $postarr['post_date'] = $_POST['post_date'];
279
+ $postarr['comment_status'] = $_POST['comment_status'];
280
+ $postarr['post_author'] = $_POST['post_author'];
281
+ $postarr['post_parent'] = get_post_field( 'post_parent', $_POST['post_id'] );
282
+
283
+ if ( $form_settings['edit_post_status'] == '_nochange' ) {
284
+ $postarr['post_status'] = get_post_field( 'post_status', $_POST['post_id'] );
285
+ } else {
286
+ $postarr['post_status'] = $form_settings['edit_post_status'];
287
+ }
288
+ } else {
289
+ if ( isset( $form_settings['comment_status'] ) ) {
290
+ $postarr['comment_status'] = $form_settings['comment_status'];
291
+ }
292
+ }
293
+
294
+ // check the form status, it might be already a draft
295
+ // in that case, it already has the post_id field
296
+ // so, WPUF's add post action/filters won't work for new posts
297
+ if ( isset( $_POST['wpuf_form_status'] ) && $_POST['wpuf_form_status'] == 'new' ) {
298
+ $is_update = false;
299
+ }
300
+
301
+ // set default post category if it's not been set yet and if post type supports
302
+ if ( !isset( $postarr['post_category'] ) && isset( $form_settings['default_cat'] ) && is_object_in_taxonomy( $form_settings['post_type'], 'category' ) ) {
303
+ $postarr['post_category'] = array( $form_settings['default_cat'] );
304
+ }
305
+
306
+ // validation filter
307
+ if ( $is_update ) {
308
+ $error = apply_filters( 'wpuf_update_post_validate', '' );
309
+ } else {
310
+ $error = apply_filters( 'wpuf_add_post_validate', '' );
311
+ }
312
+
313
+ if ( !empty( $error ) ) {
314
+ $this->send_error( $error );
315
+ }
316
+
317
+ // ############ It's Time to Save the World ###############
318
+ if ( $is_update ) {
319
+ $postarr = apply_filters( 'wpuf_update_post_args', $postarr, $form_id, $form_settings, $form_vars );
320
+ } else {
321
+ $postarr = apply_filters( 'wpuf_add_post_args', $postarr, $form_id, $form_settings, $form_vars );
322
+ }
323
+
324
+ $post_id = wp_insert_post( $postarr );
325
+
326
+ if ( $post_id ) {
327
+
328
+ self::update_post_meta( $meta_vars, $post_id );
329
+
330
+ // if user has a subscription pack
331
+ $user_wpuf_subscription_pack = get_user_meta( get_current_user_id(), '_wpuf_subscription_pack', true );
332
+
333
+ if ( !empty( $user_wpuf_subscription_pack ) && isset( $user_wpuf_subscription_pack['_enable_post_expiration'] ) && isset( $user_wpuf_subscription_pack['expire'] ) && strtotime( $user_wpuf_subscription_pack['expire'] ) >= time()
334
+ ) {
335
+ $expire_date = date( 'Y-m-d', strtotime( "+" . $user_wpuf_subscription_pack['_post_expiration_time'] ) );
336
+ update_post_meta( $post_id, $this->post_expiration_date, $expire_date );
337
+
338
+ // save post status after expiration
339
+ $expired_post_status = $user_wpuf_subscription_pack['_expired_post_status'];
340
+ update_post_meta( $post_id, $this->expired_post_status, $expired_post_status );
341
+
342
+ // if mail active
343
+ if ( isset( $user_wpuf_subscription_pack['_enable_mail_after_expired'] ) && $user_wpuf_subscription_pack['_enable_mail_after_expired'] == 'on' ) {
344
+ $post_expiration_message = $user_wpuf_subscription_pack['_post_expiration_message'];
345
+ update_post_meta( $post_id, $this->post_expiration_message, $post_expiration_message );
346
+ }
347
+ } elseif ( !empty( $user_wpuf_subscription_pack ) && isset( $user_wpuf_subscription_pack['expire'] ) && strtotime( $user_wpuf_subscription_pack['expire'] ) <= time() ) {
348
+
349
+ if ( isset( $form_settings['expiration_settings']['enable_post_expiration'] ) ) {
350
+
351
+ $expire_date = date( 'Y-m-d', strtotime( "+" . $form_settings['expiration_settings']['expiration_time_value'] . ' ' . $form_settings['expiration_settings']['expiration_time_type'] . "" ) );
352
+ update_post_meta( $post_id, $this->post_expiration_date, $expire_date );
353
+
354
+ // save post status after expiration
355
+ $expired_post_status = $form_settings['expiration_settings']['expired_post_status'];
356
+ update_post_meta( $post_id, $this->expired_post_status, $expired_post_status );
357
+
358
+ // if mail active
359
+ if ( isset( $form_settings['expiration_settings']['enable_mail_after_expired'] ) && $form_settings['expiration_settings']['enable_mail_after_expired'] == 'on' ) {
360
+ $post_expiration_message = $form_settings['expiration_settings']['post_expiration_message'];
361
+ update_post_meta( $post_id, $this->post_expiration_message, $post_expiration_message );
362
+ }
363
+ }
364
+ } elseif ( empty( $user_wpuf_subscription_pack ) ) {
365
+
366
+ if ( isset( $form_settings['expiration_settings']['enable_post_expiration'] ) ) {
367
+ $expire_date = date( 'Y-m-d', strtotime( "+" . $form_settings['expiration_settings']['expiration_time_value'] . ' ' . $form_settings['expiration_settings']['expiration_time_type'] . "" ) );
368
+ update_post_meta( $post_id, $this->post_expiration_date, $expire_date );
369
+
370
+ // save post status after expiration
371
+ $expired_post_status = $form_settings['expiration_settings']['expired_post_status'];
372
+ update_post_meta( $post_id, $this->expired_post_status, $expired_post_status );
373
+
374
+ // if mail active
375
+ if ( isset( $form_settings['expiration_settings']['enable_mail_after_expired'] ) && $form_settings['expiration_settings']['enable_mail_after_expired'] == 'on' ) {
376
+ $post_expiration_message = $form_settings['expiration_settings']['post_expiration_message'];
377
+ update_post_meta( $post_id, $this->post_expiration_message, $post_expiration_message );
378
+ }
379
+ }
380
+ }
381
+
382
+
383
+ // set the post form_id for later usage
384
+ update_post_meta( $post_id, self::$config_id, $form_id );
385
+
386
+ // save post formats if have any
387
+ if ( isset( $form_settings['post_format'] ) && $form_settings['post_format'] != '0' ) {
388
+ if ( post_type_supports( $form_settings['post_type'], 'post-formats' ) ) {
389
+ set_post_format( $post_id, $form_settings['post_format'] );
390
+ }
391
+ }
392
+
393
+ // find our if any images in post content and associate them
394
+ if ( !empty( $postarr['post_content'] ) ) {
395
+ $dom = new DOMDocument();
396
+ @$dom->loadHTML( $postarr['post_content'] );
397
+ $images = $dom->getElementsByTagName( 'img' );
398
+
399
+ if ( $images->length ) {
400
+ foreach ( $images as $img ) {
401
+ $url = $img->getAttribute( 'src' );
402
+ $url = str_replace( array( '"', "'", "\\" ), '', $url );
403
+ $attachment_id = wpuf_get_attachment_id_from_url( $url );
404
+
405
+ if ( $attachment_id ) {
406
+ wpuf_associate_attachment( $attachment_id, $post_id );
407
+ }
408
+ }
409
+ }
410
+ }
411
+
412
+ // save any custom taxonomies
413
+ $woo_attr = array();
414
+
415
+ foreach ( $taxonomy_vars as $taxonomy ) {
416
+ if ( isset( $_POST[$taxonomy['name']] ) ) {
417
+
418
+ if ( is_object_in_taxonomy( $form_settings['post_type'], $taxonomy['name'] ) ) {
419
+ $tax = $_POST[$taxonomy['name']];
420
+
421
+ // if it's not an array, make it one
422
+ if ( !is_array( $tax ) ) {
423
+ $tax = array( $tax );
424
+ }
425
+
426
+ if ( $taxonomy['type'] == 'text' ) {
427
+
428
+ $hierarchical = array_map( 'trim', array_map( 'strip_tags', explode( ',', $_POST[$taxonomy['name']] ) ) );
429
+
430
+ wp_set_object_terms( $post_id, $hierarchical, $taxonomy['name'] );
431
+
432
+ // woocommerce check
433
+ if ( isset( $taxonomy['woo_attr'] ) && $taxonomy['woo_attr'] == 'yes' && !empty( $_POST[$taxonomy['name']] ) ) {
434
+ $woo_attr[sanitize_title( $taxonomy['name'] )] = $this->woo_attribute( $taxonomy );
435
+ }
436
+ } else {
437
+
438
+ if ( is_taxonomy_hierarchical( $taxonomy['name'] ) ) {
439
+ wp_set_post_terms( $post_id, $_POST[$taxonomy['name']], $taxonomy['name'] );
440
+
441
+ // woocommerce check
442
+ if ( isset( $taxonomy['woo_attr'] ) && $taxonomy['woo_attr'] == 'yes' && !empty( $_POST[$taxonomy['name']] ) ) {
443
+ $woo_attr[sanitize_title( $taxonomy['name'] )] = $this->woo_attribute( $taxonomy );
444
+ }
445
+ } else {
446
+ if ( $tax ) {
447
+ $non_hierarchical = array();
448
+
449
+ foreach ( $tax as $value ) {
450
+ $term = get_term_by( 'id', $value, $taxonomy['name'] );
451
+ if ( $term && !is_wp_error( $term ) ) {
452
+ $non_hierarchical[] = $term->name;
453
+ }
454
+ }
455
+
456
+ wp_set_post_terms( $post_id, $non_hierarchical, $taxonomy['name'] );
457
+ }
458
+ } // hierarchical
459
+ } // is text
460
+ } // is object tax
461
+ } // isset tax
462
+ }
463
+
464
+ // if a woocommerce attribute
465
+ if ( $woo_attr ) {
466
+ update_post_meta( $post_id, '_product_attributes', $woo_attr );
467
+ }
468
+
469
+ if ( $is_update ) {
470
+
471
+ // plugin API to extend the functionality
472
+ do_action( 'wpuf_edit_post_after_update', $post_id, $form_id, $form_settings, $form_vars );
473
+
474
+ //send mail notification
475
+ if ( isset( $form_settings['notification'] ) && $form_settings['notification']['edit'] == 'on' ) {
476
+ $mail_body = $this->prepare_mail_body( $form_settings['notification']['edit_body'], $post_author, $post_id );
477
+ wp_mail( $form_settings['notification']['edit_to'], $form_settings['notification']['edit_subject'], $mail_body );
478
+ }
479
+ } else {
480
+
481
+ // plugin API to extend the functionality
482
+ do_action( 'wpuf_add_post_after_insert', $post_id, $form_id, $form_settings, $form_vars );
483
+
484
+ // send mail notification
485
+ if ( isset( $form_settings['notification'] ) && $form_settings['notification']['new'] == 'on' ) {
486
+ $mail_body = $this->prepare_mail_body( $form_settings['notification']['new_body'], $post_author, $post_id );
487
+ wp_mail( $form_settings['notification']['new_to'], $form_settings['notification']['new_subject'], $mail_body );
488
+ }
489
+ }
490
+
491
+ //redirect URL
492
+ $show_message = false;
493
+ $redirect_to = false;
494
+
495
+ if ( $is_update ) {
496
+ if ( $form_settings['edit_redirect_to'] == 'page' ) {
497
+ $redirect_to = get_permalink( $form_settings['edit_page_id'] );
498
+ } elseif ( $form_settings['edit_redirect_to'] == 'url' ) {
499
+ $redirect_to = $form_settings['edit_url'];
500
+ } elseif ( $form_settings['edit_redirect_to'] == 'same' ) {
501
+ $redirect_to = add_query_arg( array(
502
+ 'pid' => $post_id,
503
+ '_wpnonce' => wp_create_nonce( 'wpuf_edit' ),
504
+ 'msg' => 'post_updated'
505
+ ), get_permalink( $_POST['page_id'] )
506
+ );
507
+ } else {
508
+ $redirect_to = get_permalink( $post_id );
509
+ }
510
+ } else {
511
+ if ( $form_settings['redirect_to'] == 'page' ) {
512
+ $redirect_to = get_permalink( $form_settings['page_id'] );
513
+ } elseif ( $form_settings['redirect_to'] == 'url' ) {
514
+ $redirect_to = $form_settings['url'];
515
+ } elseif ( $form_settings['redirect_to'] == 'same' ) {
516
+ $show_message = true;
517
+ } else {
518
+ $redirect_to = get_permalink( $post_id );
519
+ }
520
+ }
521
+
522
+ // send the response
523
+ $response = array(
524
+ 'success' => true,
525
+ 'redirect_to' => $redirect_to,
526
+ 'show_message' => $show_message,
527
+ 'message' => $form_settings['message']
528
+ );
529
+
530
+ if ( $is_update ) {
531
+ $response = apply_filters( 'wpuf_edit_post_redirect', $response, $post_id, $form_id, $form_settings );
532
+ } else {
533
+ $response = apply_filters( 'wpuf_add_post_redirect', $response, $post_id, $form_id, $form_settings );
534
+ }
535
+
536
+ wpuf_clear_buffer();
537
+
538
+ echo json_encode( $response );
539
+ exit;
540
+ }
541
+
542
+ $this->send_error( __( 'Something went wrong', 'wpuf' ) );
543
+ }
544
+
545
+ /**
546
+ * this will embed media to the editor
547
+ */
548
+ function make_media_embed_code() {
549
+ if ( $embed_code = wp_oembed_get( $_POST['content'] ) ) {
550
+ echo $embed_code;
551
+ } else {
552
+ echo '';
553
+ }
554
+
555
+ exit;
556
+ }
557
+
558
+ function draft_post() {
559
+ check_ajax_referer( 'wpuf_form_add' );
560
+
561
+ @header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
562
+
563
+ $form_id = isset( $_POST['form_id'] ) ? intval( $_POST['form_id'] ) : 0;
564
+ $form_vars = $this->get_input_fields( $form_id );
565
+ $form_settings = wpuf_get_form_settings( $form_id );
566
+
567
+ list( $post_vars, $taxonomy_vars, $meta_vars ) = $form_vars;
568
+
569
+ // echo json_encode( $_POST );
570
+ // print_r( $post_vars );
571
+ // print_r( $taxonomy_vars );
572
+ // print_r( $meta_vars );
573
+
574
+ $postarr = array(
575
+ 'post_type' => $form_settings['post_type'],
576
+ 'post_status' => 'draft',
577
+ 'post_author' => get_current_user_id(),
578
+ 'post_title' => isset( $_POST['post_title'] ) ? trim( $_POST['post_title'] ) : '',
579
+ 'post_content' => isset( $_POST['post_content'] ) ? trim( $_POST['post_content'] ) : '',
580
+ 'post_excerpt' => isset( $_POST['post_excerpt'] ) ? trim( $_POST['post_excerpt'] ) : '',
581
+ );
582
+
583
+ if ( isset( $_POST['category'] ) ) {
584
+ $category = $_POST['category'];
585
+ $postarr['post_category'] = is_array( $category ) ? $category : array( $category );
586
+ }
587
+
588
+ if ( isset( $_POST['tags'] ) ) {
589
+ $postarr['tags_input'] = explode( ',', $_POST['tags'] );
590
+ }
591
+
592
+ // if post_id is passed, we update the post
593
+ if ( isset( $_POST['post_id'] ) ) {
594
+ $is_update = true;
595
+ $postarr['ID'] = $_POST['post_id'];
596
+ $postarr['comment_status'] = 'open';
597
+ }
598
+
599
+ $post_id = wp_insert_post( $postarr );
600
+
601
+ if ( $post_id ) {
602
+ self::update_post_meta( $meta_vars, $post_id );
603
+
604
+ // set the post form_id for later usage
605
+ update_post_meta( $post_id, self::$config_id, $form_id );
606
+
607
+ // save post formats if have any
608
+ if ( isset( $form_settings['post_format'] ) && $form_settings['post_format'] != '0' ) {
609
+ if ( post_type_supports( $form_settings['post_type'], 'post-formats' ) ) {
610
+ set_post_format( $post_id, $form_settings['post_format'] );
611
+ }
612
+ }
613
+
614
+ // save any custom taxonomies
615
+ foreach ( $taxonomy_vars as $taxonomy ) {
616
+ if ( isset( $_POST[$taxonomy['name']] ) ) {
617
+
618
+ if ( is_object_in_taxonomy( $form_settings['post_type'], $taxonomy['name'] ) ) {
619
+ $tax = $_POST[$taxonomy['name']];
620
+
621
+ // if it's not an array, make it one
622
+ if ( !is_array( $tax ) ) {
623
+ $tax = array( $tax );
624
+ }
625
+
626
+ wp_set_post_terms( $post_id, $_POST[$taxonomy['name']], $taxonomy['name'] );
627
+ }
628
+ }
629
+ }
630
+ }
631
+
632
+ //used to add code to run when the post is going to draft
633
+ do_action( 'wpuf_draft_post_after_insert', $post_id, $form_id, $form_settings, $form_vars );
634
+
635
+
636
+ wpuf_clear_buffer();
637
+
638
+ echo json_encode( array(
639
+ 'post_id' => $post_id,
640
+ 'action' => $_POST['action'],
641
+ 'date' => current_time( 'mysql' ),
642
+ 'post_author' => get_current_user_id(),
643
+ 'comment_status' => get_option( 'default_comment_status' ),
644
+ 'url' => add_query_arg( 'preview', 'true', get_permalink( $post_id ) )
645
+ ) );
646
+
647
+ exit;
648
+ }
649
+
650
+ public static function update_post_meta( $meta_vars, $post_id ) {
651
+
652
+ // prepare the meta vars
653
+ list( $meta_key_value, $multi_repeated, $files ) = self::prepare_meta_fields( $meta_vars );
654
+
655
+ // set featured image if there's any
656
+ if ( isset( $_POST['wpuf_files']['featured_image'] ) ) {
657
+ $attachment_id = $_POST['wpuf_files']['featured_image'][0];
658
+
659
+ wpuf_associate_attachment( $attachment_id, $post_id );
660
+ set_post_thumbnail( $post_id, $attachment_id );
661
+
662
+ $file_data = isset( $_POST['wpuf_files_data'][$attachment_id] ) ? $_POST['wpuf_files_data'][$attachment_id] : false;
663
+ if ( $file_data ) {
664
+ wp_update_post( array(
665
+ 'ID' => $attachment_id,
666
+ 'post_title' => $file_data['title'],
667
+ 'post_content' => $file_data['desc'],
668
+ 'post_excerpt' => $file_data['caption'],
669
+ ) );
670
+
671
+ update_post_meta( $attachment_id, '_wp_attachment_image_alt', $file_data['title'] );
672
+ }
673
+ }
674
+
675
+ // save all custom fields
676
+ foreach ( $meta_key_value as $meta_key => $meta_value ) {
677
+ update_post_meta( $post_id, $meta_key, $meta_value );
678
+ }
679
+
680
+ // save any multicolumn repeatable fields
681
+ foreach ( $multi_repeated as $repeat_key => $repeat_value ) {
682
+ // first, delete any previous repeatable fields
683
+ delete_post_meta( $post_id, $repeat_key );
684
+
685
+ // now add them
686
+ foreach ( $repeat_value as $repeat_field ) {
687
+ add_post_meta( $post_id, $repeat_key, $repeat_field );
688
+ }
689
+ }
690
+
691
+ // save any files attached
692
+ foreach ( $files as $file_input ) {
693
+ // delete any previous value
694
+ delete_post_meta( $post_id, $file_input['name'] );
695
+
696
+ //to track how many files are being uploaded
697
+ $file_numbers = 0;
698
+
699
+ foreach ( $file_input['value'] as $attachment_id ) {
700
+
701
+ //if file numbers are greated than allowed number, prevent it from being uploaded
702
+ if ( $file_numbers >= $file_input['count'] ) {
703
+ wp_delete_attachment( $attachment_id );
704
+ continue;
705
+ }
706
+
707
+
708
+ wpuf_associate_attachment( $attachment_id, $post_id );
709
+ add_post_meta( $post_id, $file_input['name'], $attachment_id );
710
+
711
+ // file title, caption, desc update
712
+ $file_data = isset( $_POST['wpuf_files_data'][$attachment_id] ) ? $_POST['wpuf_files_data'][$attachment_id] : false;
713
+ if ( $file_data ) {
714
+ wp_update_post( array(
715
+ 'ID' => $attachment_id,
716
+ 'post_title' => $file_data['title'],
717
+ 'post_content' => $file_data['desc'],
718
+ 'post_excerpt' => $file_data['caption'],
719
+ ) );
720
+
721
+ update_post_meta( $attachment_id, '_wp_attachment_image_alt', $file_data['title'] );
722
+ }
723
+ $file_numbers++;
724
+ }
725
+ }
726
+ }
727
+
728
+ function prepare_mail_body( $content, $user_id, $post_id ) {
729
+ $user = get_user_by( 'id', $user_id );
730
+ $post = get_post( $post_id );
731
+
732
+ // var_dump($post);
733
+
734
+ $post_field_search = array( '%post_title%', '%post_content%', '%post_excerpt%', '%tags%', '%category%',
735
+ '%author%', '%author_email%', '%author_bio%', '%sitename%', '%siteurl%', '%permalink%', '%editlink%' );
736
+
737
+ $post_field_replace = array(
738
+ $post->post_title,
739
+ $post->post_content,
740
+ $post->post_excerpt,
741
+ get_the_term_list( $post_id, 'post_tag', '', ', ' ),
742
+ get_the_term_list( $post_id, 'category', '', ', ' ),
743
+ $user->display_name,
744
+ $user->user_email,
745
+ ($user->description) ? $user->description : 'not available',
746
+ get_bloginfo( 'name' ),
747
+ home_url(),
748
+ get_permalink( $post_id ),
749
+ admin_url( 'post.php?action=edit&post=' . $post_id )
750
+ );
751
+
752
+ $content = str_replace( $post_field_search, $post_field_replace, $content );
753
+
754
+ // custom fields
755
+ preg_match_all( '/%custom_([\w-]*)\b%/', $content, $matches );
756
+ list( $search, $replace ) = $matches;
757
+
758
+ if ( $replace ) {
759
+ foreach ( $replace as $index => $meta_key ) {
760
+ $value = get_post_meta( $post_id, $meta_key );
761
+ $new_value = implode( '; ', $value );
762
+
763
+ if ( get_post_mime_type( (int) $new_value ) ) {
764
+ $original_value = wp_get_attachment_url( $new_value );
765
+ } else {
766
+ $original_value = $new_value;
767
+ }
768
+
769
+ $content = str_replace( $search[$index], $original_value, $content );
770
+ }
771
+ }
772
+
773
+ return $content;
774
+ }
775
+
776
+ function woo_attribute( $taxonomy ) {
777
+ return array(
778
+ 'name' => $taxonomy['name'],
779
+ 'value' => $_POST[$taxonomy['name']],
780
+ 'is_visible' => $taxonomy['woo_attr_vis'] == 'yes' ? 1 : 0,
781
+ 'is_variation' => 0,
782
+ 'is_taxonomy' => 1
783
+ );
784
+ }
785
+
786
+ }
class/payment.php ADDED
@@ -0,0 +1,414 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * WP User Frontend payment gateway handler
5
+ *
6
+ * @since 0.8
7
+ * @package WP User Frontend
8
+ */
9
+ class WPUF_Payment {
10
+
11
+ function __construct() {
12
+ add_action( 'init', array($this, 'send_to_gateway') );
13
+ add_action( 'wpuf_payment_received', array($this, 'payment_notify_admin') );
14
+ add_filter( 'the_content', array($this, 'payment_page') );
15
+ }
16
+
17
+ public static function get_payment_gateways() {
18
+
19
+ // default, built-in gateways
20
+ $gateways = array(
21
+ 'paypal' => array(
22
+ 'admin_label' => __( 'PayPal', 'wpuf' ),
23
+ 'checkout_label' => __( 'PayPal', 'wpuf' ),
24
+ 'icon' => apply_filters( 'wpuf_paypal_checkout_icon', WPUF_ASSET_URI . '/images/paypal.png' )
25
+ ),
26
+ 'bank' => array(
27
+ 'admin_label' => __( 'Bank Payment', 'wpuf' ),
28
+ 'checkout_label' => __( 'Bank Payment', 'wpuf' ),
29
+ )
30
+ );
31
+
32
+ $gateways = apply_filters( 'wpuf_payment_gateways', $gateways );
33
+
34
+ return $gateways;
35
+ }
36
+
37
+ /**
38
+ * Get active payment gateways
39
+ *
40
+ * @return array
41
+ */
42
+ function get_active_gateways() {
43
+ $all_gateways = wpuf_get_gateways( 'checkout' );
44
+ $active_gateways = wpuf_get_option( 'active_gateways', 'wpuf_payment' );
45
+ $active_gateways = is_array( $active_gateways ) ? $active_gateways : array();
46
+ $gateways = array();
47
+
48
+ foreach ($all_gateways as $id => $label) {
49
+ if ( array_key_exists( $id, $active_gateways ) ) {
50
+ $gateways[$id] = $label;
51
+ }
52
+ }
53
+
54
+ return $gateways;
55
+ }
56
+
57
+ /**
58
+ * Show the payment page
59
+ *
60
+ * @param string $content
61
+ * @return string
62
+ */
63
+ function payment_page( $content ) {
64
+ global $post;
65
+
66
+ $pay_page = intval( wpuf_get_option( 'payment_page', 'wpuf_payment' ) );
67
+
68
+ if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'wpuf_pay' && $pay_page == 0 ) {
69
+ _e('Please select your payment page from admin panel', 'wpuf' );
70
+ return;
71
+ }
72
+
73
+ if ( $post->ID == $pay_page && isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'wpuf_pay' ) {
74
+
75
+ if ( !is_user_logged_in() ) {
76
+ //return __( 'You are not logged in', 'wpuf' );
77
+ }
78
+
79
+ $type = ( $_REQUEST['type'] == 'post' ) ? 'post' : 'pack';
80
+ $post_id = isset( $_REQUEST['post_id'] ) ? intval( $_REQUEST['post_id'] ) : 0;
81
+ $pack_id = isset( $_REQUEST['pack_id'] ) ? intval( $_REQUEST['pack_id'] ) : 0;
82
+ $is_free = false;
83
+
84
+ if ( $pack_id ) {
85
+ $pack_detail = WPUF_Subscription::get_subscription( $pack_id );
86
+ if ( empty( $pack_detail->meta_value['billing_amount'] ) || $pack_detail->meta_value['billing_amount'] <= 0) {
87
+ $is_free = true;
88
+ }
89
+ }
90
+
91
+ $gateways = $this->get_active_gateways();
92
+
93
+ if ( isset( $_REQUEST['wpuf_payment_submit'] ) ) {
94
+ $selected_gateway = $_REQUEST['wpuf_payment_method'];
95
+ } else {
96
+ $selected_gateway = 'paypal';
97
+ }
98
+
99
+ ob_start();
100
+
101
+ if ( is_user_logged_in() ) {
102
+ $current_user = wp_get_current_user();
103
+ } else {
104
+ $user_id = isset( $_GET['user_id'] ) ? $_GET['user_id'] : 0;
105
+ $current_user = get_userdata( $user_id );
106
+ }
107
+
108
+ if ( $pack_id && $is_free ) {
109
+
110
+ $wpuf_subscription = WPUF_Subscription::init();
111
+
112
+ if ( ! WPUF_Subscription::has_used_free_pack( $current_user->ID, $pack_id) ) {
113
+
114
+ $wpuf_subscription->new_subscription( $current_user->ID, $pack_id, null, false, 'free' );
115
+ WPUF_Subscription::add_used_free_pack( $current_user->ID, $pack_id );
116
+
117
+ $message = apply_filters( 'wpuf_fp_activated_msg', __( 'Your free package has been activated. Enjoy!' ), 'wpuf' );
118
+ } else {
119
+ $message = apply_filters( 'wpuf_fp_activated_error', __( 'You already have activated a free package previously.' ), 'wpuf' );
120
+ }
121
+ ?>
122
+ <div class="wpuf-info"><?php echo $message; ?></div>
123
+ <?php
124
+ } else {
125
+ ?>
126
+ <?php if ( count( $gateways ) ) {
127
+ ?>
128
+ <form id="wpuf-payment-gateway" action="<?php echo $_SERVER["REQUEST_URI"]; ?>" method="POST">
129
+
130
+ <?php if ( $pack_id ) {
131
+ $pack = WPUF_Subscription::init()->get_subscription( $pack_id );
132
+ $details_meta = WPUF_Subscription::init()->get_details_meta_value();
133
+ $currency = wpuf_get_option( 'currency_symbol', 'wpuf_payment' );
134
+ if ( is_user_logged_in() ) {
135
+ ?>
136
+ <input type="hidden" name="user_id" value="<?php echo $current_user->ID; ?>">
137
+ <?php } ?>
138
+
139
+ <div class="wpuf-coupon-info-wrap">
140
+ <div class="wpuf-coupon-info">
141
+ <div class="wpuf-pack-info">
142
+ <h3>
143
+ <?php _e( 'Pricing & Plans', 'wpuf' ); ?>
144
+
145
+ <a href="<?php echo wpuf_get_subscription_page_url(); ?>"><?php _e( 'Change Pack', 'wpuf' ); ?></a>
146
+ </h3>
147
+ <div class="wpuf-subscription-error"></div>
148
+
149
+ <div class="wpuf-pack-inner">
150
+ <?php if ( class_exists( 'WPUF_Coupons' ) ) { ?>
151
+ <?php echo WPUF_Coupons::init()->after_apply_coupon( $pack ); ?>
152
+ <?php } else {
153
+
154
+ $currency = wpuf_get_option( 'currency_symbol', 'wpuf_payment' );
155
+ ?>
156
+ <div><?php _e( 'Selected Pack ', 'wpuf' ); ?>: <strong><?php echo $pack->post_title; ?></strong></div>
157
+ <?php _e( 'Pack Price ', 'wpuf' ); ?>: <strong><?php echo $currency . $pack->meta_value['billing_amount']; ?></strong>
158
+ <?php } ?>
159
+ </div>
160
+ </div>
161
+ </div>
162
+
163
+ <?php if ( class_exists( 'WPUF_Coupons' ) ) { ?>
164
+ <div class="wpuf-copon-wrap" style="display:none;">
165
+ <div class="wpuf-coupon-error" style="color: red;"></div>
166
+ <input type="text" name="coupon_code" size="20" class="wpuf-coupon-field">
167
+ <input type="hidden" name="coupon_id" size="20" class="wpuf-coupon-id-field">
168
+ <div>
169
+ <a href="#" data-pack_id="<?php echo $pack_id; ?>" class="wpuf-apply-coupon"><?php _e( 'Apply Coupon', 'wpuf' ); ?></a>
170
+ <a href="#" data-pack_id="<?php echo $pack_id; ?>" class="wpuf-copon-cancel"><?php _e( 'Cancel', 'wpuf' ); ?></a>
171
+ </div>
172
+ </div>
173
+ <a href="#" class="wpuf-copon-show"><?php _e( 'Have a discount code?', 'wpuf' ); ?></a>
174
+
175
+ <?php } // coupon ?>
176
+ </div>
177
+
178
+ <?php } ?>
179
+ <?php wp_nonce_field( 'wpuf_payment_gateway' ) ?>
180
+
181
+ <?php do_action( 'wpuf_before_payment_gateway' ); ?>
182
+
183
+ <p>
184
+ <label for="wpuf-payment-method"><?php _e( 'Choose Your Payment Method', 'wpuf' ); ?></label><br />
185
+
186
+ <ul class="wpuf-payment-gateways">
187
+ <?php foreach ($gateways as $gateway_id => $gateway) { ?>
188
+ <li class="wpuf-gateway-<?php echo $gateway_id; ?>">
189
+ <label>
190
+ <input name="wpuf_payment_method" type="radio" value="<?php echo esc_attr( $gateway_id ); ?>" <?php checked( $selected_gateway, $gateway_id ); ?>>
191
+ <?php
192
+ echo $gateway['label'];
193
+
194
+ if ( !empty( $gateway['icon'] ) ) {
195
+ printf(' <img src="%s" alt="image">', $gateway['icon'] );
196
+ }
197
+ ?>
198
+ </label>
199
+
200
+ <div class="wpuf-payment-instruction" style="display: none;">
201
+ <div class="wpuf-instruction"><?php echo wpuf_get_option( 'gate_instruct_' . $gateway_id, 'wpuf_payment' ); ?></div>
202
+
203
+ <?php do_action( 'wpuf_gateway_form_' . $gateway_id, $type, $post_id, $pack_id ); ?>
204
+ </div>
205
+ </li>
206
+ <?php } ?>
207
+ </ul>
208
+
209
+ </p>
210
+ <?php do_action( 'wpuf_after_payment_gateway' ); ?>
211
+ <p>
212
+ <input type="hidden" name="type" value="<?php echo $type; ?>" />
213
+ <input type="hidden" name="action" value="wpuf_pay" />
214
+ <?php if ( $post_id ) { ?>
215
+ <input type="hidden" name="post_id" value="<?php echo $post_id; ?>" />
216
+ <?php } ?>
217
+
218
+ <?php if ( $pack_id ) { ?>
219
+ <input type="hidden" name="pack_id" value="<?php echo $pack_id; ?>" />
220
+ <?php } ?>
221
+ <input type="submit" name="wpuf_payment_submit" class="wpuf-btn" value="<?php _e( 'Proceed', 'wpuf' ); ?>"/>
222
+ </p>
223
+ </form>
224
+ <?php } else { ?>
225
+ <?php _e( 'No Payment gateway found', 'wpuf' ); ?>
226
+ <?php } ?>
227
+
228
+ <?php
229
+ }
230
+
231
+ return ob_get_clean();
232
+ }
233
+
234
+ return $content;
235
+ }
236
+
237
+ /**
238
+ * Send payment handler to the gateway
239
+ *
240
+ * This function sends the payment handler mechanism to the selected
241
+ * gateway. If 'paypal' is selected, then a particular action is being
242
+ * called. A listener function can be invoked for that gateway to handle
243
+ * the request and send it to the gateway.
244
+ *
245
+ * Need to use `wpuf_gateway_{$gateway_name}
246
+ */
247
+ function send_to_gateway() {
248
+
249
+ if ( isset( $_POST['wpuf_payment_submit'] ) && $_POST['action'] == 'wpuf_pay' && wp_verify_nonce( $_POST['_wpnonce'], 'wpuf_payment_gateway' ) ) {
250
+
251
+ $post_id = isset( $_REQUEST['post_id'] ) ? intval( $_REQUEST['post_id'] ) : 0;
252
+ $pack_id = isset( $_REQUEST['pack_id'] ) ? intval( $_REQUEST['pack_id'] ) : 0;
253
+ $gateway = $_POST['wpuf_payment_method'];
254
+ $type = $_POST['type'];
255
+
256
+ if ( is_user_logged_in() ) {
257
+ $userdata = wp_get_current_user();
258
+ } else {
259
+ $user_id = isset( $_REQUEST['user_id'] ) ? $_REQUEST['user_id'] : 0;
260
+
261
+ if ( $user_id ) {
262
+ $userdata = get_userdata( $user_id );
263
+ } else {
264
+ $userdata = new stdClass;
265
+ $userdata->ID = 0;
266
+ $userdata->user_email = '';
267
+ $userdata->first_name = '';
268
+ $userdata->last_name = '';
269
+ }
270
+ }
271
+
272
+
273
+ switch ($type) {
274
+ case 'post':
275
+ $post = get_post( $post_id );
276
+ $amount = wpuf_get_option( 'cost_per_post', 'wpuf_payment' );
277
+ $item_number = get_post_meta( $post_id, '_wpuf_order_id', true );
278
+ $item_name = $post->post_title;
279
+ break;
280
+
281
+ case 'pack':
282
+
283
+ $pack = WPUF_Subscription::init()->get_subscription( $pack_id );
284
+
285
+ $custom = $pack->meta_value;
286
+ $amount = $this->coupon_discount( $_POST['coupon_code'], $pack->meta_value['billing_amount'], $pack_id );
287
+ $item_name = $pack->post_title;
288
+ $item_number = $pack->ID;
289
+ break;
290
+ }
291
+
292
+ $payment_vars = array(
293
+ 'currency' => wpuf_get_option( 'currency', 'wpuf_payment' ),
294
+ 'price' => $amount,
295
+ 'item_number' => $item_number,
296
+ 'item_name' => $item_name,
297
+ 'type' => $type,
298
+ 'user_info' => array(
299
+ 'id' => $userdata->ID,
300
+ 'email' => $userdata->user_email,
301
+ 'first_name' => $userdata->first_name,
302
+ 'last_name' => $userdata->last_name
303
+ ),
304
+ 'date' => date( 'Y-m-d H:i:s' ),
305
+ 'post_data' => $_POST,
306
+ 'custom' => isset( $custom ) ? $custom : '',
307
+ );
308
+
309
+ do_action( 'wpuf_gateway_' . $gateway, $payment_vars );
310
+ }
311
+ }
312
+
313
+ function coupon_discount( $coupon_code, $amount, $pack_id ) {
314
+ if ( empty( $coupon_code ) ) {
315
+ return $amount;
316
+ }
317
+
318
+ $coupon = get_page_by_title( $coupon_code, 'OBJECT', 'wpuf_coupon' );
319
+ $coupon_meta = WPUF_Coupons::init()->get_coupon_meta( $coupon->ID );
320
+ $coupon_usage = get_post_meta( $coupon->ID, 'coupon_usage', true );
321
+ $coupon_usage = count( $coupon_usage );
322
+ $start_date = date( 'Y-d-m', strtotime( $coupon_meta['start_date'] ) );
323
+ $end_date = date( 'Y-d-m', strtotime( $coupon_meta['end_date'] ) );
324
+ $today = date( 'Y-d-m', time() );
325
+ $current_use_email = wp_get_current_user()->user_email;
326
+
327
+ if ( empty( $coupon_meta['amount'] ) || $coupon_meta['amount'] == 0 ) {
328
+ return $amount;
329
+ }
330
+
331
+ if ( $coupon_meta['package'] != 'all' && $coupon_meta['package'] != $pack_id ) {
332
+ return $amount;
333
+ }
334
+
335
+ if ( $coupon_meta['usage_limit'] < $coupon_usage ) {
336
+ return $amount;
337
+ }
338
+
339
+ if ( $start_date > $today && $today > $end_date ) {
340
+ return $amount;
341
+ }
342
+
343
+ if ( count( $coupon_meta['access'] ) && !in_array( $current_use_email, $coupon_meta['access'] ) ) {
344
+ return $amount;
345
+ }
346
+
347
+ if ( $coupon_meta['type'] == 'amount' ) {
348
+
349
+ $new_amount = $amount - $coupon_meta['amount'];
350
+ } else {
351
+ $new_amount = ( $amount * $coupon_meta['amount'] ) / 100;
352
+ }
353
+
354
+ if ( $new_amount >= 0 ) {
355
+ return $new_amount;
356
+ }
357
+
358
+ return $amount;
359
+
360
+ }
361
+
362
+ /**
363
+ * Insert payment info to database
364
+ *
365
+ * @global object $wpdb
366
+ * @param array $data payment data to insert
367
+ * @param int $transaction_id the transaction id in case of update
368
+ */
369
+ public static function insert_payment( $data, $transaction_id = 0, $recurring = false ) {
370
+ global $wpdb;
371
+
372
+ //check if it's already there
373
+ $sql = "SELECT transaction_id
374
+ FROM " . $wpdb->prefix . "wpuf_transaction
375
+ WHERE transaction_id = '" . $wpdb->escape( $transaction_id ) . "' LIMIT 1";
376
+
377
+ $result = $wpdb->get_row( $sql );
378
+
379
+ if ( $recurring != false ) {
380
+ $profile_id = $data['profile_id'];
381
+ }
382
+
383
+ if ( isset( $data['profile_id'] ) || empty( $data['profile_id'] ) ) {
384
+ unset( $data['profile_id'] );
385
+ }
386
+
387
+ if ( !$result ) {
388
+ $wpdb->insert( $wpdb->prefix . 'wpuf_transaction', $data );
389
+ } else {
390
+ $wpdb->update( $wpdb->prefix . 'wpuf_transaction', $data, array('transaction_id' => $transaction_id) );
391
+ }
392
+
393
+ if( isset( $profile_id ) ) {
394
+ $data['profile_id'] = $profile_id;
395
+ }
396
+
397
+ do_action( 'wpuf_payment_received', $data, $recurring );
398
+ }
399
+
400
+ /**
401
+ * Send payment received mail
402
+ *
403
+ * @param array $info payment information
404
+ */
405
+ function payment_notify_admin( $info ) {
406
+ $headers = "From: " . get_bloginfo( 'name' ) . " <" . get_bloginfo( 'admin_email' ) . ">" . "\r\n\\";
407
+ $subject = sprintf( __( '[%s] Payment Received', 'wpuf' ), get_bloginfo( 'name' ) );
408
+ $msg = sprintf( __( 'New payment received at %s', 'wpuf' ), get_bloginfo( 'name' ) );
409
+
410
+ $receiver = get_bloginfo( 'admin_email' );
411
+ wp_mail( $receiver, $subject, $msg, $headers );
412
+ }
413
+
414
+ }
class/post-form-template.php ADDED
@@ -0,0 +1,128 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Post form template
5
+ *
6
+ * @since 2.4
7
+ */
8
+ abstract class WPUF_Post_Form_Template {
9
+
10
+ /**
11
+ * If the form is enabled
12
+ *
13
+ * @var boolean
14
+ */
15
+ public $enabled = true;
16
+
17
+ /**
18
+ * Template title
19
+ *
20
+ * @var string
21
+ */
22
+ public $title;
23
+
24
+ /**
25
+ * Template description
26
+ *
27
+ * @var string
28
+ */
29
+ public $description;
30
+
31
+ /**
32
+ * Conditional logic
33
+ *
34
+ * @var array
35
+ */
36
+ protected $conditionals;
37
+
38
+ /**
39
+ * Form fields
40
+ *
41
+ * @var array
42
+ */
43
+ protected $form_fields;
44
+
45
+ /**
46
+ * Form settings
47
+ *
48
+ * @var array
49
+ */
50
+ protected $form_settings;
51
+
52
+ public function __construct() {
53
+ $this->conditionals = array(
54
+ 'condition_status' => 'no',
55
+ 'cond_field' => array(),
56
+ 'cond_operator' => array( '=' ),
57
+ 'cond_option' => array( '- select -' ),
58
+ 'cond_logic' => 'all'
59
+ );
60
+ }
61
+
62
+ /**
63
+ * Get the template title
64
+ *
65
+ * @return string
66
+ */
67
+ public function get_title() {
68
+ return apply_filters( 'wpuf_post_form_template_title', $this->title, $this );
69
+ }
70
+
71
+ /**
72
+ * Get the description
73
+ *
74
+ * @return string
75
+ */
76
+ public function get_description() {
77
+ return apply_filters( 'wpuf_post_form_template_description', $this->description, $this );
78
+ }
79
+
80
+ /**
81
+ * Get the form fields
82
+ *
83
+ * @return array
84
+ */
85
+ public function get_form_fields() {
86
+ return apply_filters( 'wpuf_post_form_template_form_fields', $this->form_fields, $this );
87
+ }
88
+
89
+ /**
90
+ * Get the form settings
91
+ *
92
+ * @return array
93
+ */
94
+ public function get_form_settings() {
95
+ return apply_filters( 'wpuf_post_form_template_form_settings', $this->form_settings, $this );
96
+ }
97
+
98
+ /**
99
+ * Check if the template is enabled
100
+ *
101
+ * @return boolean
102
+ */
103
+ public function is_enabled() {
104
+ return $this->enabled;
105
+ }
106
+
107
+ /**
108
+ * Run necessary processing after new post insert
109
+ *
110
+ * @param int $post_id
111
+ * @param int $form_id
112
+ * @param array $form_settings
113
+ *
114
+ * @return void
115
+ */
116
+ public function after_insert( $post_id, $form_id, $form_settings ) {}
117
+
118
+ /**
119
+ * Run necessary processing after editing a post
120
+ *
121
+ * @param int $post_id
122
+ * @param int $form_id
123
+ * @param array $form_settings
124
+ *
125
+ * @return void
126
+ */
127
+ public function after_update( $post_id, $form_id, $form_settings ) {}
128
+ }
class/post-form-templates/post.php ADDED
@@ -0,0 +1,156 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Normal post form
5
+ */
6
+ class WPUF_Post_Form_Template_Post extends WPUF_Post_Form_Template {
7
+
8
+ public function __construct() {
9
+ parent::__construct();
10
+
11
+ $this->enabled = true;
12
+ $this->title = __( 'Post Form', 'wpuf' );
13
+ $this->description = __( 'Form for creating a blog post.', 'wpuf' );
14
+ $this->form_fields = array(
15
+ array(
16
+ 'input_type' => 'text',
17
+ 'template' => 'post_title',
18
+ 'required' => 'yes',
19
+ 'label' => 'Post Title',
20
+ 'name' => 'post_title',
21
+ 'is_meta' => 'no',
22
+ 'help' => '',
23
+ 'css' => '',
24
+ 'placeholder' => 'Please enter your post name',
25
+ 'default' => '',
26
+ 'size' => '40',
27
+ 'wpuf_cond' => $this->conditionals
28
+ ),
29
+ array(
30
+ 'input_type' => 'taxonomy',
31
+ 'template' => 'taxonomy',
32
+ 'required' => 'yes',
33
+ 'label' => 'Category',
34
+ 'name' => 'category',
35
+ 'is_meta' => 'no',
36
+ 'help' => 'Select a category for your post',
37
+ 'css' => '',
38
+ 'type' => 'select',
39
+ 'orderby' => 'name',
40
+ 'order' => 'ASC',
41
+ 'exclude_type' => 'exclude',
42
+ 'exclude' => '',
43
+ 'woo_attr' => 'no',
44
+ 'woo_attr_vis' => 'no',
45
+ 'options' => array(),
46
+ 'wpuf_cond' => $this->conditionals
47
+ ),
48
+ array(
49
+ 'input_type' => 'textarea',
50
+ 'template' => 'post_content',
51
+ 'required' => 'yes',
52
+ 'label' => 'Post description',
53
+ 'name' => 'post_content',
54
+ 'is_meta' => 'no',
55
+ 'help' => 'Write the full description of your Post',
56
+ 'css' => '',
57
+ 'rows' => '5',
58
+ 'cols' => '25',
59
+ 'placeholder' => '',
60
+ 'default' => '',
61
+ 'rich' => 'yes',
62
+ 'insert_image' => 'yes',
63
+ 'word_restriction' => '',
64
+ 'wpuf_cond' => $this->conditionals
65
+ ),
66
+ array(
67
+ 'input_type' => 'image_upload',
68
+ 'template' => 'featured_image',
69
+ 'count' => '1',
70
+ 'required' => 'yes',
71
+ 'label' => 'Featured Image',
72
+ 'name' => 'featured_image',
73
+ 'is_meta' => 'no',
74
+ 'help' => 'Upload the main image of your post',
75
+ 'css' => '',
76
+ 'max_size' => '1024',
77
+ 'wpuf_cond' => $this->conditionals
78
+ ),
79
+ array(
80
+ 'input_type' => 'textarea',
81
+ 'template' => 'post_excerpt',
82
+ 'required' => 'no',
83
+ 'label' => 'Excerpt',
84
+ 'name' => 'post_excerpt',
85
+ 'is_meta' => 'no',
86
+ 'help' => 'Provide a short description of this post (optional)',
87
+ 'css' => '',
88
+ 'rows' => '5',
89
+ 'cols' => '25',
90
+ 'placeholder' => '',
91
+ 'default' => '',
92
+ 'rich' => 'no',
93
+ 'wpuf_cond' => $this->conditionals
94
+ ),
95
+ array(
96
+ 'input_type' => 'text',
97
+ 'template' => 'post_tags',
98
+ 'required' => 'no',
99
+ 'label' => 'Tags',
100
+ 'name' => 'tags',
101
+ 'is_meta' => 'no',
102
+ 'help' => 'Separate tags with commas.',
103
+ 'css' => '',
104
+ 'placeholder' => '',
105
+ 'default' => '',
106
+ 'size' => '40',
107
+ 'wpuf_cond' => $this->conditionals
108
+ ),
109
+ );
110
+
111
+ $this->form_settings = array (
112
+ 'post_type' => 'post',
113
+ 'post_status' => 'publish',
114
+ 'default_cat' => '-1',
115
+ 'guest_post' => 'false',
116
+ 'message_restrict' => 'This page is restricted. Please Log in / Register to view this page.',
117
+ 'redirect_to' => 'post',
118
+ 'comment_status' => 'open',
119
+ 'submit_text' => 'Create Post',
120
+ 'edit_post_status' => 'publish',
121
+ 'edit_redirect_to' => 'same',
122
+ 'update_message' => 'Post has been updated successfully. <a target="_blank" href="%link%">View post</a>',
123
+ 'edit_url' => '',
124
+ 'update_text' => 'Update Post',
125
+ 'form_template' => __CLASS__,
126
+ 'notification' => array(
127
+ 'new' => 'on',
128
+ 'new_to' => get_option( 'admin_email' ),
129
+ 'new_subject' => 'New post has been created',
130
+ 'new_body' => 'Hi,
131
+ A new post has been created in your site %sitename% (%siteurl%).
132
+
133
+ Here is the details:
134
+ Post Title: %post_title%
135
+ Description: %post_content%
136
+ Short Description: %post_excerpt%
137
+ Author: %author%
138
+ Post URL: %permalink%
139
+ Edit URL: %editlink%',
140
+ 'edit' => 'off',
141
+ 'edit_to' => get_option( 'admin_email' ),
142
+ 'edit_subject' => 'Post has been edited',
143
+ 'edit_body' => 'Hi,
144
+ The post "%post_title%" has been updated.
145
+
146
+ Here is the details:
147
+ Post Title: %post_title%
148
+ Description: %post_content%
149
+ Short Description: %post_excerpt%
150
+ Author: %author%
151
+ Post URL: %permalink%
152
+ Edit URL: %editlink%',
153
+ ),
154
+ );
155
+ }
156
+ }
class/render-form.php ADDED
@@ -0,0 +1,1453 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Handles form generaton and posting for add/edit post in frontend
5
+ *
6
+ * @package WP User Frontend
7
+ */
8
+ class WPUF_Render_Form {
9
+
10
+ static $meta_key = 'wpuf_form';
11
+ static $separator = '| ';
12
+ static $config_id = '_wpuf_form_id';
13
+ private $form_condition_key = 'wpuf_cond';
14
+ private static $_instance;
15
+ private $field_count = 0;
16
+ public $multiform_start = 0;
17
+
18
+ public static function init() {
19
+ if ( !self::$_instance ) {
20
+ self::$_instance = new WPUF_Render_Form();
21
+ }
22
+
23
+ return self::$_instance;
24
+ }
25
+
26
+ /**
27
+ * Send json error message
28
+ *
29
+ * @param string $error
30
+ */
31
+ function send_error( $error ) {
32
+ echo json_encode( array(
33
+ 'success' => false,
34
+ 'error' => $error
35
+ ) );
36
+
37
+ die();
38
+ }
39
+
40
+ /**
41
+ * Search on multi dimentional array
42
+ *
43
+ * @param array $array
44
+ * @param string $key name of key
45
+ * @param string $value the value to search
46
+ * @return array
47
+ */
48
+ function search( $array, $key, $value ) {
49
+ $results = array();
50
+
51
+ if ( is_array( $array ) ) {
52
+ if ( isset( $array[$key] ) && $array[$key] == $value )
53
+ $results[] = $array;
54
+
55
+ foreach ($array as $subarray)
56
+ $results = array_merge( $results, $this->search( $subarray, $key, $value ) );
57
+ }
58
+
59
+ return $results;
60
+ }
61
+
62
+ /**
63
+ * Really simple captcha validation
64
+ *
65
+ * @return void
66
+ */
67
+ function validate_rs_captcha() {
68
+ $rs_captcha_input = isset( $_POST['rs_captcha'] ) ? $_POST['rs_captcha'] : '';
69
+ $rs_captcha_file = isset( $_POST['rs_captcha_val'] ) ? $_POST['rs_captcha_val'] : '';
70
+
71
+ if ( class_exists( 'ReallySimpleCaptcha' ) ) {
72
+ $captcha_instance = new ReallySimpleCaptcha();
73
+
74
+ if ( !$captcha_instance->check( $rs_captcha_file, $rs_captcha_input ) ) {
75
+
76
+ $this->send_error( __( 'Really Simple Captcha validation failed', 'wpuf' ) );
77
+ } else {
78
+ // validation success, remove the files
79
+ $captcha_instance->remove( $rs_captcha_file );
80
+ }
81
+ }
82
+ }
83
+
84
+ /**
85
+ * reCaptcha Validation
86
+ *
87
+ * @return void
88
+ */
89
+ function validate_re_captcha( $no_captcha = '' ) {
90
+
91
+ $private_key = wpuf_get_option( 'recaptcha_private', 'wpuf_general' );
92
+ if ( $no_captcha == 1 ) {
93
+
94
+ $response = null;
95
+ $reCaptcha = new ReCaptcha($private_key);
96
+
97
+ $resp = $reCaptcha->verifyResponse(
98
+ $_SERVER["REMOTE_ADDR"],
99
+ $_POST["g-recaptcha-response"]
100
+ );
101
+
102
+ if ( !$resp->success ) {
103
+ $this->send_error( __( 'reCAPTCHA validation failed', 'wpuf' ) );
104
+ }
105
+
106
+ } elseif ( $no_captcha == 0 ) {
107
+
108
+ $recap_challenge = isset( $_POST['recaptcha_challenge_field'] ) ? $_POST['recaptcha_challenge_field'] : '';
109
+ $recap_response = isset( $_POST['recaptcha_response_field'] ) ? $_POST['recaptcha_response_field'] : '';
110
+
111
+ $resp = recaptcha_check_answer( $private_key, $_SERVER["REMOTE_ADDR"], $recap_challenge, $recap_response );
112
+
113
+ if ( !$resp->is_valid ) {
114
+ $this->send_error( __( 'reCAPTCHA validation failed', 'wpuf' ) );
115
+ }
116
+ }
117
+
118
+ }
119
+
120
+ /**
121
+ * Guess a suitable username for registration based on email address
122
+ * @param string $email email address
123
+ * @return string username
124
+ */
125
+ function guess_username( $email ) {
126
+ // username from email address
127
+ $username = sanitize_user( substr( $email, 0, strpos( $email, '@' ) ) );
128
+
129
+ if ( !username_exists( $username ) ) {
130
+ return $username;
131
+ }
132
+
133
+ // try to add some random number in username
134
+ // and may be we got our username
135
+ $username .= rand( 1, 199 );
136
+ if ( !username_exists( $username ) ) {
137
+ return $username;
138
+ }
139
+ }
140
+
141
+ /**
142
+ * Get input meta fields separated as post vars, taxonomy and meta vars
143
+ *
144
+ * @param int $form_id form id
145
+ * @return array
146
+ */
147
+ public static function get_input_fields( $form_id ) {
148
+ $form_vars = wpuf_get_form_fields( $form_id );
149
+
150
+ $ignore_lists = array('section_break', 'html');
151
+ $post_vars = $meta_vars = $taxonomy_vars = array();
152
+
153
+ foreach ($form_vars as $key => $value) {
154
+
155
+ // ignore section break and HTML input type
156
+ if ( in_array( $value['input_type'], $ignore_lists ) ) {
157
+ continue;
158
+ }
159
+
160
+ //separate the post and custom fields
161
+ if ( isset( $value['is_meta'] ) && $value['is_meta'] == 'yes' ) {
162
+ $meta_vars[] = $value;
163
+ continue;
164
+ }
165
+
166
+ if ( $value['input_type'] == 'taxonomy' ) {
167
+
168
+ // don't add "category"
169
+ if ( $value['name'] == 'category' ) {
170
+ continue;
171
+ }
172
+
173
+ $taxonomy_vars[] = $value;
174
+ } else {
175
+ $post_vars[] = $value;
176
+ }
177
+ }
178
+
179
+ return array($post_vars, $taxonomy_vars, $meta_vars);
180
+ }
181
+
182
+ public static function prepare_meta_fields( $meta_vars ) {
183
+ // loop through custom fields
184
+ // skip files, put in a key => value paired array for later executation
185
+ // process repeatable fields separately
186
+ // if the input is array type, implode with separator in a field
187
+
188
+ $files = array();
189
+ $meta_key_value = array();
190
+ $multi_repeated = array(); //multi repeated fields will in sotre duplicated meta key
191
+
192
+ foreach ($meta_vars as $key => $value) {
193
+
194
+ // put files in a separate array, we'll process it later
195
+ if ( ($value['input_type'] == 'file_upload') || ($value['input_type'] == 'image_upload') ) {
196
+ $files[] = array(
197
+ 'name' => $value['name'],
198
+ 'value' => isset( $_POST['wpuf_files'][$value['name']] ) ? $_POST['wpuf_files'][$value['name']] : array(),
199
+ 'count' => $value['count']
200
+ );
201
+
202
+ // process repeatable fiels
203
+ } elseif ( $value['input_type'] == 'repeat' ) {
204
+
205
+ // if it is a multi column repeat field
206
+ if ( isset( $value['multiple'] ) ) {
207
+
208
+ // if there's any items in the array, process it
209
+ if ( $_POST[$value['name']] ) {
210
+
211
+ $ref_arr = array();
212
+ $cols = count( $value['columns'] );
213
+ $first = array_shift( array_values( $_POST[$value['name']] ) ); //first element
214
+ $rows = count( $first );
215
+
216
+ // loop through columns
217
+ for ($i = 0; $i < $rows; $i++) {
218
+
219
+ // loop through the rows and store in a temp array
220
+ $temp = array();
221
+ for ($j = 0; $j < $cols; $j++) {
222
+
223
+ $temp[] = $_POST[$value['name']][$j][$i];
224
+ }
225
+
226
+ // store all fields in a row with self::$separator separated
227
+ $ref_arr[] = implode( self::$separator, $temp );
228
+ }
229
+
230
+ // now, if we found anything in $ref_arr, store to $multi_repeated
231
+ if ( $ref_arr ) {
232
+ $multi_repeated[$value['name']] = array_slice( $ref_arr, 0, $rows );
233
+ }
234
+ }
235
+ } else {
236
+ $meta_key_value[$value['name']] = implode( self::$separator, $_POST[$value['name']] );
237
+ }
238
+
239
+ // process other fields
240
+ } elseif ( $value['input_type'] == 'address' ) {
241
+
242
+ if( isset( $_POST[ $value['name'] ] ) && is_array( $_POST[ $value['name'] ] ) ) {
243
+ foreach ( $_POST[ $value['name'] ] as $address_field => $field_value ) {
244
+ $meta_key_value[ $value['name'] ][ $address_field ] = $field_value;
245
+ }
246
+ }
247
+
248
+ }
249
+ else {
250
+ // if it's an array, implode with this->separator
251
+ if ( is_array( $_POST[$value['name']] ) ) {
252
+
253
+ if ( $value['input_type'] == 'address' ) {
254
+ $meta_key_value[$value['name']] = $_POST[$value['name']];
255
+ } else {
256
+ $meta_key_value[$value['name']] = implode( self::$separator, $_POST[$value['name']] );
257
+ }
258
+ } else {
259
+ $meta_key_value[$value['name']] = trim( $_POST[$value['name']] );
260
+ }
261
+ }
262
+ } //end foreach
263
+
264
+ return array($meta_key_value, $multi_repeated, $files);
265
+ }
266
+
267
+ function guest_fields( $form_settings ) {
268
+ ?>
269
+ <li class="el-name">
270
+ <div class="wpuf-label">
271
+ <label><?php echo $form_settings['name_label']; ?> <span class="required">*</span></label>
272
+ </div>
273
+
274
+ <div class="wpuf-fields">
275
+ <input type="text" required="required" data-required="yes" data-type="text" name="guest_name" value="" size="40">
276
+ </div>
277
+ </li>
278
+
279
+ <li class="el-email">
280
+ <div class="wpuf-label">
281
+ <label><?php echo $form_settings['email_label']; ?> <span class="required">*</span></label>
282
+ </div>
283
+
284
+ <div class="wpuf-fields">
285
+ <input type="email" required="required" data-required="yes" data-type="email" name="guest_email" value="" size="40">
286
+ </div>
287
+ </li>
288
+ <?php
289
+ }
290
+
291
+ /**
292
+ * Handles the add post shortcode
293
+ *
294
+ * @param $atts
295
+ */
296
+ function render_form( $form_id, $post_id = NULL, $preview = false ) {
297
+
298
+ $form_vars = wpuf_get_form_fields( $form_id );
299
+ $form_settings = wpuf_get_form_settings( $form_id );
300
+
301
+ if ( ! is_user_logged_in() && $form_settings['guest_post'] != 'true' ) {
302
+ echo '<div class="wpuf-message">' . $form_settings['message_restrict'] . '</div>';
303
+ //wp_login_form();
304
+ return;
305
+ }
306
+
307
+ if ( $form_vars ) {
308
+ ?>
309
+
310
+ <?php if ( !$preview ) { ?>
311
+ <form class="wpuf-form-add" action="" method="post">
312
+ <?php } ?>
313
+
314
+ <ul class="wpuf-form">
315
+
316
+ <?php
317
+ if ( !$post_id ) {
318
+ do_action( 'wpuf_add_post_form_top', $form_id, $form_settings );
319
+ } else {
320
+ do_action( 'wpuf_edit_post_form_top', $form_id, $post_id, $form_settings );
321
+ }
322
+
323
+ if ( !is_user_logged_in() && $form_settings['guest_post'] == 'true' && $form_settings['guest_details'] == 'true' ) {
324
+ $this->guest_fields( $form_settings );
325
+ }
326
+
327
+ $this->render_items( $form_vars, $post_id, 'post', $form_id, $form_settings );
328
+ $this->submit_button( $form_id, $form_settings, $post_id );
329
+
330
+ if ( !$post_id ) {
331
+ do_action( 'wpuf_add_post_form_bottom', $form_id, $form_settings );
332
+ } else {
333
+ do_action( 'wpuf_edit_post_form_bottom', $form_id, $post_id, $form_settings );
334
+ }
335
+ ?>
336
+
337
+ </ul>
338
+
339
+ <?php if ( !$preview ) { ?>
340
+ </form>
341
+ <?php } ?>
342
+
343
+ <?php
344
+ } //endif
345
+ }
346
+
347
+ function render_item_before( $form_field, $post_id ) {
348
+ $label_exclude = array('section_break', 'html', 'action_hook', 'toc');
349
+ $el_name = !empty( $form_field['name'] ) ? $form_field['name'] : '';
350
+ $class_name = !empty( $form_field['css'] ) ? ' ' . $form_field['css'] : '';
351
+
352
+ printf( '<li class="wpuf-el %s%s" data-label="%s">', $el_name, $class_name, $form_field['label'] );
353
+
354
+ if ( isset( $form_field['input_type'] ) && !in_array( $form_field['input_type'], $label_exclude ) ) {
355
+ $this->label( $form_field, $post_id );
356
+ }
357
+ }
358
+
359
+ function render_item_after( $form_field ) {
360
+ echo '</li>';
361
+ }
362
+
363
+ function conditional_logic( $form_field, $form_id ) {
364
+
365
+ $cond_inputs = $form_field['wpuf_cond'];
366
+ $cond_inputs['condition_status'] = isset( $cond_inputs['condition_status'] ) ? $cond_inputs['condition_status'] : '';
367
+
368
+ if ( $cond_inputs['condition_status'] == 'yes') {
369
+ $cond_inputs['type'] = $form_field['input_type'];
370
+ $cond_inputs['name'] = $form_field['name'];
371
+ $cond_inputs['form_id'] = $form_id;
372
+ $condition = json_encode( $cond_inputs );
373
+
374
+ } else {
375
+ $condition = '';
376
+ }
377
+
378
+ //taxnomy name create unique
379
+ if ( $form_field['input_type'] == 'taxonomy' ) {
380
+ $cond_inputs['name'] = $form_field['name'] . '_' . $form_field['type'] .'_'. $form_field['id'];
381
+ $condition = json_encode( $cond_inputs );
382
+ }
383
+
384
+ //for section break
385
+ if ( $form_field['input_type'] == 'section_break' ) {
386
+ $cond_inputs['name'] = $form_field['name'] .'_'. $form_field['id'];
387
+ $condition = json_encode( $cond_inputs );
388
+ }
389
+
390
+
391
+ ?>
392
+ <script type="text/javascript">
393
+
394
+ wpuf_conditional_items.push(<?php echo $condition; ?>);
395
+
396
+ </script>
397
+ <?php
398
+
399
+ }
400
+
401
+ /**
402
+ * Render form items
403
+ *
404
+ * @param array $form_vars
405
+ * @param int|null $post_id
406
+ * @param string $type type of the form. post or user
407
+ */
408
+ function render_items( $form_vars, $post_id, $type = 'post', $form_id, $form_settings, $cond_inputs = array() ) {
409
+
410
+ $edit_ignore = array('recaptcha', 'really_simple_captcha');
411
+ $hidden_fields = array();
412
+ ?>
413
+ <script type="text/javascript">
414
+ if ( typeof wpuf_conditional_items === 'undefined' ) {
415
+ wpuf_conditional_items = [];
416
+ }
417
+ </script>
418
+ <?php
419
+
420
+ //through var, we will know if multiform step started already
421
+ //$multiform_start = 0;
422
+
423
+ //if multistep form is enabled
424
+ if ( isset( $form_settings['enable_multistep'] ) && $form_settings['enable_multistep'] == 'yes' ) {
425
+ ?>
426
+ <input type="hidden" name="wpuf_multistep_type" value="<?php echo $form_settings['multistep_progressbar_type'] ?>"/>
427
+ <?php
428
+ if ( $form_settings['multistep_progressbar_type'] == 'step_by_step' ){
429
+ ?>
430
+ <!--wpuf-multistep-progressbar-> wpuf_ms_pb-->
431
+ <div class="wpuf-multistep-progressbar">
432
+
433
+ </div>
434
+ <?php
435
+ } else {
436
+ ?>
437
+ <div class="wpuf-multistep-progressbar">
438
+
439
+ </div>
440
+ <?php
441
+
442
+ }
443
+
444
+ }
445
+
446
+ foreach ($form_vars as $key => $form_field) {
447
+ // don't show captcha in edit page
448
+ if ( $post_id && in_array( $form_field['input_type'], $edit_ignore ) ) {
449
+ continue;
450
+ }
451
+
452
+ // igonre the hidden fields
453
+ if ( $form_field['input_type'] == 'hidden' ) {
454
+ $hidden_fields[] = $form_field;
455
+ continue;
456
+ }
457
+
458
+ if ( $form_field['input_type'] != 'step_start' && $form_field['input_type'] != 'step_end' ) {
459
+ $this->render_item_before( $form_field, $post_id );
460
+ }
461
+
462
+ $this->field_count++;
463
+
464
+ switch ($form_field['input_type']) {
465
+ case 'text':
466
+ $this->text( $form_field, $post_id, $type, $form_id );
467
+ $this->conditional_logic( $form_field, $form_id );
468
+ break;
469
+
470
+ case 'textarea':
471
+ $this->textarea( $form_field, $post_id, $type, $form_id );
472
+ $this->conditional_logic( $form_field, $form_id );
473
+ break;
474
+
475
+ case 'select':
476
+ $this->select( $form_field, false, $post_id, $type, $form_id );
477
+ $this->conditional_logic( $form_field, $form_id );
478
+ break;
479
+
480
+ case 'multiselect':
481
+ $this->select( $form_field, true, $post_id, $type, $form_id );
482
+ $this->conditional_logic( $form_field, $form_id );
483
+ break;
484
+
485
+ case 'radio':
486
+ $this->radio( $form_field, $post_id, $type, $form_id );
487
+ $this->conditional_logic( $form_field, $form_id );
488
+ break;
489
+
490
+ case 'checkbox':
491
+ $this->checkbox( $form_field, $post_id, $type, $form_id );
492
+ $this->conditional_logic( $form_field, $form_id );
493
+ break;
494
+
495
+ case 'url':
496
+ $this->url( $form_field, $post_id, $type, $form_id );
497
+ $this->conditional_logic( $form_field, $form_id );
498
+ break;
499
+
500
+ case 'email':
501
+ $this->email( $form_field, $post_id, $type, $form_id );
502
+ $this->conditional_logic( $form_field, $form_id );
503
+ break;
504
+
505
+ case 'password':
506
+ $this->password( $form_field, $post_id, $type, $form_id );
507
+ $this->conditional_logic( $form_field, $form_id );
508
+ break;
509
+
510
+ case 'taxonomy':
511
+
512
+ $this->taxonomy( $form_field, $post_id, $form_id );
513
+ $this->conditional_logic( $form_field, $form_id );
514
+ break;
515
+
516
+ case 'section_break':
517
+ $form_field['name'] = 'section_break';
518
+ $this->section_break( $form_field, $post_id, $form_id );
519
+ $this->conditional_logic( $form_field, $form_id );
520
+ break;
521
+
522
+ case 'html':
523
+ $form_field['name'] = 'custom_html_'.str_replace( ' ','_', $form_field['label'] );
524
+
525
+ $this->html( $form_field, $form_id );
526
+ $this->conditional_logic( $form_field, $form_id );
527
+ break;
528
+
529
+ case 'image_upload':
530
+ $this->image_upload( $form_field, $post_id, $type, $form_id );
531
+ $this->conditional_logic( $form_field, $form_id );
532
+ break;
533
+
534
+ default:
535
+ do_action( 'wpuf_render_form_' . $form_field['input_type'], $form_field, $form_id, $post_id, $form_settings );
536
+ do_action( 'wpuf_render_pro_' . $form_field['input_type'], $form_field, $post_id, $type, $form_id, $form_settings, 'WPUF_Render_Form', $this, $this->multiform_start, isset( $form_settings['enable_multistep'] )?$form_settings['enable_multistep']:'' );
537
+ break;
538
+ }
539
+
540
+
541
+ $this->render_item_after( $form_field );
542
+ } //end foreach
543
+
544
+ if ( $hidden_fields ) {
545
+ foreach($hidden_fields as $field) {
546
+ printf( '<input type="hidden" name="%s" value="%s">', esc_attr( $field['name'] ), esc_attr( $field['meta_value'] ) );
547
+ echo "\r\n";
548
+ }
549
+ }
550
+ }
551
+
552
+ function submit_button( $form_id, $form_settings, $post_id ) {
553
+ ?>
554
+ <li class="wpuf-submit">
555
+ <div class="wpuf-label">
556
+ &nbsp;
557
+ </div>
558
+
559
+ <?php wp_nonce_field( 'wpuf_form_add' ); ?>
560
+ <input type="hidden" name="form_id" value="<?php echo $form_id; ?>">
561
+ <input type="hidden" name="page_id" value="<?php echo get_post() ? get_the_ID() : '0'; ?>">
562
+ <input type="hidden" name="action" value="wpuf_submit_post">
563
+
564
+ <?php
565
+ if ( $post_id ) {
566
+ $cur_post = get_post( $post_id );
567
+ ?>
568
+ <input type="hidden" name="post_id" value="<?php echo $post_id; ?>">
569
+ <input type="hidden" name="post_date" value="<?php echo esc_attr( $cur_post->post_date ); ?>">
570
+ <input type="hidden" name="comment_status" value="<?php echo esc_attr( $cur_post->comment_status ); ?>">
571
+ <input type="hidden" name="post_author" value="<?php echo esc_attr( $cur_post->post_author ); ?>">
572
+ <input type="submit" name="submit" value="<?php echo $form_settings['update_text']; ?>" />
573
+ <?php } else { ?>
574
+ <input type="submit" name="submit" value="<?php echo $form_settings['submit_text']; ?>" />
575
+ <input type="hidden" name="wpuf_form_status" value="new">
576
+ <?php } ?>
577
+
578
+ <?php if ( isset( $form_settings['draft_post'] ) && $form_settings['draft_post'] == 'true' ) { ?>
579
+ <a href="#" class="btn" id="wpuf-post-draft"><?php _e( 'Save Draft', 'wpuf' ); ?></a>
580
+ <?php } ?>
581
+ </li>
582
+ <?php
583
+ }
584
+
585
+
586
+
587
+ /**
588
+ * Form preview handler
589
+ *
590
+ * @return void
591
+ */
592
+ function preview_form() {
593
+ $form_id = isset( $_GET['form_id'] ) ? intval( $_GET['form_id'] ) : 0;
594
+
595
+
596
+ if ( $form_id ) {
597
+ ?>
598
+
599
+ <!doctype html>
600
+ <html lang="en">
601
+ <head>
602
+ <meta charset="UTF-8">
603
+ <title>Form Preview</title>
604
+ <link rel="stylesheet" href="<?php echo plugins_url( 'assets/css/frontend-forms.css', dirname( __FILE__ ) ); ?>">
605
+
606
+ <style type="text/css">
607
+ body {
608
+ margin: 0;
609
+ padding: 0;
610
+ background: #eee;
611
+ }
612
+
613
+ .container {
614
+ width: 700px;
615
+ margin: 0 auto;
616
+ margin-top: 20px;
617
+ padding: 20px;
618
+ background: #fff;
619
+ border: 1px solid #DFDFDF;
620
+ -webkit-box-shadow: 1px 1px 2px rgba(0,0,0,0.1);
621
+ box-shadow: 1px 1px 2px rgba(0,0,0,0.1);
622
+ }
623
+ </style>
624
+ </head>
625
+ <body>
626
+ <div class="container">
627
+
628
+ <?php $this->render_form( $form_id, null, true ); ?>
629
+ </div>
630
+ </body>
631
+ </html>
632
+
633
+ <?php
634
+ } else {
635
+ wp_die( 'Error generating the form preview' );
636
+ }
637
+
638
+ exit;
639
+ }
640
+
641
+ /**
642
+ * Prints required field asterisk
643
+ *
644
+ * @param array $attr
645
+ * @return string
646
+ */
647
+ function required_mark( $attr ) {
648
+ if ( isset( $attr['required'] ) && $attr['required'] == 'yes' ) {
649
+ return ' <span class="required">*</span>';
650
+ }
651
+ }
652
+
653
+ /**
654
+ * Prints HTML5 required attribute
655
+ *
656
+ * @param array $attr
657
+ * @return string
658
+ */
659
+ function required_html5( $attr ) {
660
+ if ( $attr['required'] == 'yes' ) {
661
+ // echo ' required="required"';
662
+ }
663
+ }
664
+
665
+ /**
666
+ * Print required class name
667
+ *
668
+ * @param array $attr
669
+ * @return string
670
+ */
671
+ function required_class( $attr ) {
672
+ return;
673
+ if ( $attr['required'] == 'yes' ) {
674
+ echo ' required';
675
+ }
676
+ }
677
+
678
+ /**
679
+ * Prints form input label
680
+ *
681
+ * @param array $attr
682
+ */
683
+ function label( $attr, $post_id = 0 ) {
684
+ if ( $post_id && $attr['input_type'] == 'password') {
685
+ $attr['required'] = 'no';
686
+ }
687
+ ?>
688
+ <div class="wpuf-label">
689
+ <label for="wpuf-<?php echo isset( $attr['name'] ) ? $attr['name'] : 'cls'; ?>"><?php echo $attr['label'] . $this->required_mark( $attr ); ?></label>
690
+ </div>
691
+ <?php
692
+ }
693
+
694
+ /**
695
+ * Prints help text for a field
696
+ *
697
+ * @param array $attr
698
+ */
699
+ function help_text( $attr ) {
700
+ if ( empty( $attr['help'] ) ) {
701
+ return;
702
+ }
703
+ ?>
704
+ <span class="wpuf-help"><?php echo stripslashes( $attr['help'] ); ?></span>
705
+ <?php
706
+ }
707
+
708
+ /**
709
+ * Check if its a meta field
710
+ *
711
+ * @param array $attr
712
+ * @return boolean
713
+ */
714
+ function is_meta( $attr ) {
715
+ if ( isset( $attr['is_meta'] ) && $attr['is_meta'] == 'yes' ) {
716
+ return true;
717
+ }
718
+
719
+ return false;
720
+ }
721
+
722
+ /**
723
+ * Get a meta value
724
+ *
725
+ * @param int $object_id user_ID or post_ID
726
+ * @param string $meta_key
727
+ * @param string $type post or user
728
+ * @param bool $single
729
+ * @return string
730
+ */
731
+ function get_meta( $object_id, $meta_key, $type = 'post', $single = true ) {
732
+ if ( !$object_id ) {
733
+ return '';
734
+ }
735
+
736
+ if ( $type == 'post' ) {
737
+ return get_post_meta( $object_id, $meta_key, $single );
738
+ }
739
+
740
+ return get_user_meta( $object_id, $meta_key, $single );
741
+ }
742
+
743
+ function get_user_data( $user_id, $field ) {
744
+ return get_user_by( 'id', $user_id )->$field;
745
+ }
746
+
747
+ /**
748
+ * Prints a text field
749
+ *
750
+ * @param array $attr
751
+ * @param int|null $post_id
752
+ */
753
+ function text( $attr, $post_id, $type = 'post', $form_id = null ) {
754
+ // checking for user profile username
755
+ $username = false;
756
+ $taxonomy = false;
757
+
758
+ if ( $post_id ) {
759
+
760
+ if ( $this->is_meta( $attr ) ) {
761
+ $value = $this->get_meta( $post_id, $attr['name'], $type );
762
+ } else {
763
+
764
+ // applicable for post tags
765
+ if ( $type == 'post' && $attr['name'] == 'tags' ) {
766
+ $post_tags = wp_get_post_tags( $post_id );
767
+ $tagsarray = array();
768
+ foreach ($post_tags as $tag) {
769
+ $tagsarray[] = $tag->name;
770
+ }
771
+
772
+ $value = implode( ', ', $tagsarray );
773
+ $taxonomy = true;
774
+ } elseif ( $type == 'post' ) {
775
+ $value = get_post_field( $attr['name'], $post_id );
776
+ } elseif ( $type == 'user' ) {
777
+ $name = $attr['name'];
778
+ $value = get_user_by( 'id', $post_id )->$name;
779
+ if ( $attr['name'] == 'user_login' ) {
780
+ $username = true;
781
+ }
782
+ }
783
+ }
784
+ } else {
785
+ $value = $attr['default'];
786
+
787
+ if ( $type == 'post' && $attr['name'] == 'tags' ) {
788
+ $taxonomy = true;
789
+ }
790
+ }
791
+
792
+ ?>
793
+
794
+ <div class="wpuf-fields">
795
+ <input class="textfield<?php echo $this->required_class( $attr ); echo ' wpuf_'.$attr['name'].'_'.$form_id; ?>" id="<?php echo $attr['name']; ?>" type="text" data-required="<?php echo $attr['required'] ?>" data-type="text"<?php $this->required_html5( $attr ); ?> name="<?php echo esc_attr( $attr['name'] ); ?>" placeholder="<?php echo esc_attr( $attr['placeholder'] ); ?>" value="<?php echo esc_attr( $value ) ?>" size="<?php echo esc_attr( $attr['size'] ) ?>" <?php echo $username ? 'disabled' : ''; ?> />
796
+ <?php $this->help_text( $attr ); ?>
797
+
798
+ <?php if ( $taxonomy ) { ?>
799
+ <script type="text/javascript">
800
+ jQuery(function($) {
801
+ $('li.tags input[name=tags]').suggest( wpuf_frontend.ajaxurl + '?action=wpuf-ajax-tag-search&tax=post_tag', { delay: 500, minchars: 2, multiple: true, multipleSep: ', ' } );
802
+ });
803
+ </script>
804
+ <?php } ?>
805
+ </div>
806
+
807
+ <?php
808
+ }
809
+
810
+
811
+ /**
812
+ * Function to check word restriction
813
+ *
814
+ * @param $word_nums number of words allowed
815
+ */
816
+ function check_word_restriction_func($word_nums, $rich_text, $field_name){
817
+ ?>
818
+ <script type="text/javascript">
819
+ (function($) {
820
+ $(function() {
821
+ WP_User_Frontend.editorLimit.bind(<?php printf( '%d, "%s", "%s"', $word_nums, $field_name, $rich_text ); ?>);
822
+ });
823
+ })(jQuery);
824
+ </script>
825
+ <?php
826
+
827
+ }
828
+
829
+ /**
830
+ * Prints a textarea field
831
+ * @param array $attr
832
+ * @param int|null $post_id
833
+ */
834
+ function textarea( $attr, $post_id, $type, $form_id ) {
835
+ $req_class = ( $attr['required'] == 'yes' ) ? 'required' : 'rich-editor';
836
+ if ( $post_id ) {
837
+ if ( $this->is_meta( $attr ) ) {
838
+ $value = $this->get_meta( $post_id, $attr['name'], $type, true );
839
+ } else {
840
+
841
+ if ( $type == 'post' ) {
842
+ $value = get_post_field( $attr['name'], $post_id );
843
+ } else {
844
+ $value = $this->get_user_data( $post_id, $attr['name'] );
845
+ }
846
+ }
847
+ } else {
848
+ $value = $attr['default'];
849
+ }
850
+ ?>
851
+
852
+ <?php if ( in_array( $attr['rich'], array( 'yes', 'teeny' ) ) ) { ?>
853
+ <div class="wpuf-fields wpuf-rich-validation <?php printf( 'wpuf_%s_%s', $attr['name'], $form_id ); ?>" data-type="rich" data-required="<?php echo esc_attr( $attr['required'] ); ?>" data-id="<?php echo esc_attr( $attr['name'] ) . '_' . $form_id; ?>" data-name="<?php echo esc_attr( $attr['name'] ); ?>">
854
+ <?php } else { ?>
855
+ <div class="wpuf-fields">
856
+ <?php } ?>
857
+
858
+ <?php if ( isset( $attr['insert_image'] ) && $attr['insert_image'] == 'yes' ) { ?>
859
+ <div id="wpuf-insert-image-container">
860
+ <a class="wpuf-button wpuf-insert-image" id="wpuf-insert-image_<?php echo $form_id; ?>" href="#" data-form_id="<?php echo $form_id; ?>">
861
+ <span class="wpuf-media-icon"></span>
862
+ <?php _e( 'Insert Photo', 'wpuf' ); ?>
863
+ </a>
864
+ </div>
865
+
866
+ <script type="text/javascript">
867
+ jQuery(function() {
868
+ WP_User_Frontend.insertImage('wpuf-insert-image_<?php echo $form_id; ?>', '<?php echo $form_id; ?>');
869
+ });
870
+ </script>
871
+ <?php } ?>
872
+
873
+ <?php
874
+ $textarea_id = $attr['name'] ? $attr['name'] . '_' . $form_id : 'textarea_' . $this->field_count;
875
+
876
+ if ( $attr['rich'] == 'yes' ) {
877
+ $editor_settings = array(
878
+ 'textarea_rows' => $attr['rows'],
879
+ 'quicktags' => false,
880
+ 'media_buttons' => false,
881
+ 'editor_class' => $req_class,
882
+ 'textarea_name' => $attr['name']
883
+ );
884
+
885
+ $editor_settings = apply_filters( 'wpuf_textarea_editor_args' , $editor_settings );
886
+ wp_editor( $value, $textarea_id, $editor_settings );
887
+
888
+ } elseif( $attr['rich'] == 'teeny' ) {
889
+
890
+ $editor_settings = array(
891
+ 'textarea_rows' => $attr['rows'],
892
+ 'quicktags' => false,
893
+ 'media_buttons' => false,
894
+ 'teeny' => true,
895
+ 'editor_class' => $req_class,
896
+ 'textarea_name' => $attr['name']
897
+ );
898
+
899
+ $editor_settings = apply_filters( 'wpuf_textarea_editor_args' , $editor_settings );
900
+ wp_editor( $value, $textarea_id, $editor_settings );
901
+
902
+ } else {
903
+ ?>
904
+ <textarea class="textareafield<?php echo $this->required_class( $attr ); ?> <?php echo ' wpuf_'.$attr['name'].'_'.$form_id; ?>" id="<?php echo $attr['name'] . '_' . $form_id; ?>" name="<?php echo $attr['name']; ?>" data-required="<?php echo $attr['required'] ?>" data-type="textarea"<?php $this->required_html5( $attr ); ?> placeholder="<?php echo esc_attr( $attr['placeholder'] ); ?>" rows="<?php echo $attr['rows']; ?>" cols="<?php echo $attr['cols']; ?>"><?php echo esc_textarea( $value ) ?></textarea>
905
+ <span class="wpuf-wordlimit-message wpuf-help"></span>
906
+ <?php } ?>
907
+ <?php $this->help_text( $attr ); ?>
908
+ </div>
909
+ <?php
910
+
911
+ if ( isset( $attr['word_restriction'] ) && $attr['word_restriction'] ) {
912
+ $this->check_word_restriction_func( $attr['word_restriction'], $attr['rich'], $attr['name'] . '_' . $form_id );
913
+ }
914
+ }
915
+
916
+
917
+ /**
918
+ * Prints a select or multiselect field
919
+ *
920
+ * @param array $attr
921
+ * @param bool $multiselect
922
+ * @param int|null $post_id
923
+ */
924
+ function select( $attr, $multiselect = false, $post_id, $type, $form_id = null ) {
925
+ if ( $post_id ) {
926
+ $selected = $this->get_meta( $post_id, $attr['name'], $type );
927
+ $selected = $multiselect ? explode( self::$separator, $selected ) : $selected;
928
+ } else {
929
+ $selected = isset( $attr['selected'] ) ? $attr['selected'] : '';
930
+ $selected = $multiselect ? ( is_array( $selected ) ? $selected : array() ) : $selected;
931
+ }
932
+
933
+ $name = $multiselect ? $attr['name'] . '[]' : $attr['name'];
934
+ $multi = $multiselect ? ' multiple="multiple"' : '';
935
+ $data_type = $multiselect ? 'multiselect' : 'select';
936
+ $css = $multiselect ? ' class="multiselect wpuf_'. $attr['name'] .'_'. $form_id.'"' : '';
937
+ ?>
938
+
939
+ <div class="wpuf-fields">
940
+ <select <?php echo $css; ?> class="<?php echo 'wpuf_'. $attr['name'] .'_'. $form_id; ?>" name="<?php echo $name; ?>"<?php echo $multi; ?> data-required="<?php echo $attr['required'] ?>" data-type="<?php echo $data_type; ?>"<?php $this->required_html5( $attr ); ?>>
941
+
942
+ <?php if ( !empty( $attr['first'] ) ) { ?>
943
+ <option value=""><?php echo $attr['first']; ?></option>
944
+ <?php } ?>
945
+
946
+ <?php
947
+ if ( $attr['options'] && count( $attr['options'] ) > 0 ) {
948
+ foreach ($attr['options'] as $value => $option) {
949
+ $current_select = $multiselect ? selected( in_array( $value, $selected ), true, false ) : selected( $selected, $value, false );
950
+ ?>
951
+ <option value="<?php echo esc_attr( $value ); ?>"<?php echo $current_select; ?>><?php echo $option; ?></option>
952
+ <?php
953
+ }
954
+ }
955
+ ?>
956
+ </select>
957
+ <?php $this->help_text( $attr ); ?>
958
+ </div>
959
+ <?php
960
+ }
961
+
962
+ /**
963
+ * Prints a radio field
964
+ *
965
+ * @param array $attr
966
+ * @param int|null $post_id
967
+ */
968
+ function radio( $attr, $post_id, $type, $form_id ) {
969
+ $selected = isset( $attr['selected'] ) ? $attr['selected'] : '';
970
+
971
+ if ( $post_id ) {
972
+ $selected = $this->get_meta( $post_id, $attr['name'], $type, true );
973
+ }
974
+ ?>
975
+
976
+ <div class="wpuf-fields" data-required="<?php echo $attr['required'] ?>" data-type="radio">
977
+
978
+ <?php
979
+ if ( $attr['options'] && count( $attr['options'] ) > 0 ) {
980
+ foreach ($attr['options'] as $value => $option) {
981
+ ?>
982
+
983
+ <label>
984
+ <input name="<?php echo $attr['name']; ?>" class="<?php echo 'wpuf_'.$attr['name']. '_'. $form_id; ?>" type="radio" value="<?php echo esc_attr( $value ); ?>"<?php checked( $selected, $value ); ?> />
985
+ <?php echo $option; ?>
986
+ </label>
987
+ <?php
988
+ }
989
+ }
990
+ ?>
991
+
992
+ <?php $this->help_text( $attr ); ?>
993
+ </div>
994
+
995
+ <?php
996
+ }
997
+
998
+ /**
999
+ * Prints a checkbox field
1000
+ *
1001
+ * @param array $attr
1002
+ * @param int|null $post_id
1003
+ */
1004
+ function checkbox( $attr, $post_id, $type, $form_id ) {
1005
+ $selected = isset( $attr['selected'] ) ? $attr['selected'] : array();
1006
+
1007
+ if ( $post_id ) {
1008
+ if ( $value = $this->get_meta( $post_id, $attr['name'], $type, true ) ) {
1009
+ $selected = explode( self::$separator, $value );
1010
+ }
1011
+ }
1012
+ ?>
1013
+
1014
+ <div class="wpuf-fields" data-required="<?php echo $attr['required'] ?>" data-type="radio">
1015
+
1016
+ <?php
1017
+ if ( $attr['options'] && count( $attr['options'] ) > 0 ) {
1018
+
1019
+ foreach ($attr['options'] as $value => $option) {
1020
+
1021
+ ?>
1022
+
1023
+ <label>
1024
+ <input type="checkbox" class="<?php echo 'wpuf_'.$attr['name']. '_'. $form_id; ?>" name="<?php echo $attr['name']; ?>[]" value="<?php echo esc_attr( $value ); ?>"<?php echo in_array( $value, $selected ) ? ' checked="checked"' : ''; ?> />
1025
+ <?php echo $option; ?>
1026
+ </label>
1027
+ <?php
1028
+ }
1029
+ }
1030
+ ?>
1031
+
1032
+ <?php $this->help_text( $attr ); ?>
1033
+
1034
+ </div>
1035
+
1036
+ <?php
1037
+ }
1038
+
1039
+ /**
1040
+ * Prints a url field
1041
+ *
1042
+ * @param array $attr
1043
+ * @param int|null $post_id
1044
+ */
1045
+ function url( $attr, $post_id, $type, $form_id ) {
1046
+
1047
+ if ( $post_id ) {
1048
+ if ( $this->is_meta( $attr ) ) {
1049
+ $value = $this->get_meta( $post_id, $attr['name'], $type, true );
1050
+ } else {
1051
+ //must be user profile url
1052
+ $value = $this->get_user_data( $post_id, $attr['name'] );
1053
+ }
1054
+ } else {
1055
+ $value = $attr['default'];
1056
+ }
1057
+ ?>
1058
+
1059
+ <div class="wpuf-fields">
1060
+ <input id="wpuf-<?php echo $attr['name']; ?>" type="url" class="url <?php echo ' wpuf_'.$attr['name'].'_'.$form_id; ?>" data-required="<?php echo $attr['required'] ?>" data-type="text"<?php $this->required_html5( $attr ); ?> name="<?php echo esc_attr( $attr['name'] ); ?>" placeholder="<?php echo esc_attr( $attr['placeholder'] ); ?>" value="<?php echo esc_attr( $value ) ?>" size="<?php echo esc_attr( $attr['size'] ) ?>" />
1061
+ <?php $this->help_text( $attr ); ?>
1062
+ </div>
1063
+
1064
+ <?php
1065
+ }
1066
+
1067
+ /**
1068
+ * Prints a email field
1069
+ *
1070
+ * @param array $attr
1071
+ * @param int|null $post_id
1072
+ */
1073
+ function email( $attr, $post_id, $type = 'post', $form_id ) {
1074
+ if ( $post_id ) {
1075
+ if ( $this->is_meta( $attr ) ) {
1076
+ $value = $this->get_meta( $post_id, $attr['name'], $type, true );
1077
+ } else {
1078
+ //must be user email
1079
+ $value = $this->get_user_data( $post_id, $attr['name'] );
1080
+ }
1081
+ } else {
1082
+ $value = $attr['default'];
1083
+ }
1084
+ ?>
1085
+
1086
+ <div class="wpuf-fields">
1087
+ <input id="wpuf-<?php echo $attr['name']; ?>" type="email" class="email <?php echo ' wpuf_'.$attr['name'].'_'.$form_id; ?>" data-required="<?php echo $attr['required'] ?>" data-type="email" <?php $this->required_html5( $attr ); ?> name="<?php echo esc_attr( $attr['name'] ); ?>" placeholder="<?php echo esc_attr( $attr['placeholder'] ); ?>" value="<?php echo esc_attr( $value ) ?>" size="<?php echo esc_attr( $attr['size'] ) ?>" />
1088
+ <?php $this->help_text( $attr ); ?>
1089
+ </div>
1090
+
1091
+ <?php
1092
+ }
1093
+
1094
+ /**
1095
+ * Prints a email field
1096
+ *
1097
+ * @param array $attr
1098
+ */
1099
+ function password( $attr, $post_id, $type, $form_id ) {
1100
+ if ( $post_id ) {
1101
+ $attr['required'] = 'no';
1102
+ }
1103
+ ?>
1104
+
1105
+ <div class="wpuf-fields">
1106
+ <input id="pass1" type="password" class="password <?php echo ' wpuf_'.$attr['name'].'_'.$form_id; ?>" data-required="<?php echo $attr['required'] ?>" data-type="text"<?php $this->required_html5( $attr ); ?> name="pass1" placeholder="<?php echo esc_attr( $attr['placeholder'] ); ?>" value="" size="<?php echo esc_attr( $attr['size'] ) ?>" />
1107
+ <?php $this->help_text( $attr ); ?>
1108
+ </div>
1109
+
1110
+ <?php
1111
+ if ( $attr['repeat_pass'] == 'yes' ) {
1112
+ echo '</li>';
1113
+ echo '<li>';
1114
+
1115
+ $this->label( array('name' => 'pass2', 'label' => $attr['re_pass_label'], 'required' => $post_id ? 'no' : 'yes') );
1116
+ ?>
1117
+
1118
+ <div class="wpuf-fields">
1119
+ <input id="pass2" type="password" class="password <?php echo ' wpuf_'.$attr['name'].'_'.$form_id; ?>" data-required="<?php echo $attr['required'] ?>" data-type="text"<?php $this->required_html5( $attr ); ?> name="pass2" value="" size="<?php echo esc_attr( $attr['size'] ) ?>" />
1120
+ </div>
1121
+
1122
+ <?php
1123
+ }
1124
+
1125
+ if ( $attr['repeat_pass'] == 'yes' && $attr['pass_strength'] == 'yes' ) {
1126
+ echo '</li>';
1127
+ echo '<li>';
1128
+ ?>
1129
+ <div class="wpuf-label">
1130
+ &nbsp;
1131
+ </div>
1132
+
1133
+ <div class="wpuf-fields">
1134
+ <div id="pass-strength-result" style="display: block"><?php _e( 'Strength indicator' ); ?></div>
1135
+ <script src="<?php echo includes_url( 'js/zxcvbn.min.js' ); ?>"></script>
1136
+ <script src="<?php echo admin_url( 'js/password-strength-meter.js' ); ?>"></script>
1137
+ <script type="text/javascript">
1138
+ var pwsL10n = {
1139
+ empty: "<?php _e( 'Strength indicator', 'wpuf' ); ?>",
1140
+ short: "<?php _e( 'Very weak', 'wpuf' ); ?>",
1141
+ bad: "<?php _e( 'Weak', 'wpuf' ); ?>",
1142
+ good: "<?php _e( 'Medium', 'wpuf' ); ?>",
1143
+ strong: "<?php _e( 'Strong', 'wpuf' ); ?>",
1144
+ mismatch: "<?php _e( 'Mismatch', 'wpuf' ); ?>"
1145
+ };
1146
+ try{convertEntities(pwsL10n);}catch(e){};
1147
+ </script>
1148
+ </div>
1149
+ <?php
1150
+ }
1151
+
1152
+ }
1153
+
1154
+
1155
+ function taxnomy_select( $terms, $attr ) {
1156
+
1157
+ $selected = $terms ? $terms : '';
1158
+ $required = sprintf( 'data-required="%s" data-type="select"', $attr['required'] );
1159
+ $taxonomy = $attr['name'];
1160
+ $class = ' wpuf_'.$attr['name'].'_'.$selected;
1161
+ $exclude_type = isset( $attr['exclude_type'] ) ? $attr['exclude_type'] : 'exclude';
1162
+ $exclude = $attr['exclude'];
1163
+
1164
+ $select = wp_dropdown_categories( array(
1165
+
1166
+ 'show_option_none' => __( '-- Select --', 'wpuf' ),
1167
+ 'hierarchical' => 1,
1168
+ 'hide_empty' => 0,
1169
+ 'orderby' => isset( $attr['orderby'] ) ? $attr['orderby'] : 'name',
1170
+ 'order' => isset( $attr['order'] ) ? $attr['order'] : 'ASC',
1171
+ 'name' => $taxonomy . '[]',
1172
+ 'taxonomy' => $taxonomy,
1173
+ 'echo' => 0,
1174
+ 'title_li' => '',
1175
+ 'class' => 'cat-ajax '. $taxonomy . $class,
1176
+ $exclude_type => $exclude,
1177
+ 'selected' => $selected,
1178
+ 'depth' => 1,
1179
+ 'child_of' => isset( $attr['parent_cat'] ) ? $attr['parent_cat'] : ''
1180
+ ) );
1181
+
1182
+ echo str_replace( '<select', '<select ' . $required, $select );
1183
+ $attr = array(
1184
+ 'required' => $attr['required'],
1185
+ 'name' => $attr['name'],
1186
+ 'exclude_type' => $attr['exclude_type'],
1187
+ 'exclude' => $attr['exclude'],
1188
+ 'orderby' => $attr['orderby'],
1189
+ 'order' => $attr['order'],
1190
+ 'name' => $attr['name'],
1191
+ //'last_term_id' => isset( $attr['parent_cat'] ) ? $attr['parent_cat'] : '',
1192
+ //'term_id' => $selected
1193
+ );
1194
+ ?>
1195
+ <span data-taxonomy=<?php echo json_encode( $attr ); ?>></span>
1196
+ <?php
1197
+ }
1198
+
1199
+ /**
1200
+ * Prints a taxonomy field
1201
+ *
1202
+ * @param array $attr
1203
+ * @param int|null $post_id
1204
+ */
1205
+ function taxonomy( $attr, $post_id, $form_id ) {
1206
+
1207
+ $exclude_type = isset( $attr['exclude_type'] ) ? $attr['exclude_type'] : 'exclude';
1208
+ $exclude = $attr['exclude'];
1209
+ $taxonomy = $attr['name'];
1210
+ $class = ' wpuf_'.$attr['name'].'_'.$form_id;
1211
+
1212
+
1213
+ $terms = array();
1214
+ if ( $post_id && $attr['type'] == 'text' ) {
1215
+ $terms = wp_get_post_terms( $post_id, $taxonomy, array('fields' => 'names') );
1216
+ } elseif( $post_id ) {
1217
+ $terms = wp_get_post_terms( $post_id, $taxonomy, array('fields' => 'ids') );
1218
+ }
1219
+
1220
+ $div_class = 'wpuf_' . $attr['name'] . '_' . $attr['type'] . '_' . $attr['id'] . '_' . $form_id;
1221
+ ?>
1222
+
1223
+
1224
+ <?php if ( $attr['type'] == 'checkbox' ) { ?>
1225
+ <div class="wpuf-fields <?php echo $div_class; ?>" data-required="<?php echo esc_attr( $attr['required'] ); ?>" data-type="tax-checkbox">
1226
+ <?php } else { ?>
1227
+ <div class="wpuf-fields <?php echo $div_class; ?>">
1228
+ <?php } ?>
1229
+
1230
+ <?php
1231
+ switch ($attr['type']) {
1232
+ case 'ajax':
1233
+ $class = ' wpuf_'.$attr['name'].'_'.$form_id;
1234
+ ?>
1235
+ <div class="category-wrap <?php echo $class; ?>">
1236
+ <?php
1237
+
1238
+ if ( !count( $terms ) ) {
1239
+
1240
+ ?>
1241
+ <div id="lvl0" level="0">
1242
+ <?php $this->taxnomy_select( null, $attr, $form_id ); ?>
1243
+ </div>
1244
+ <?php
1245
+ } else {
1246
+
1247
+ $level = 0;
1248
+ asort( $terms );
1249
+ $last_term_id = end( $terms );
1250
+
1251
+ foreach( $terms as $term_id) {
1252
+ $class = ( $last_term_id != $term_id ) ? 'hasChild' : '';
1253
+ ?>
1254
+ <div id="lvl<?php echo $level; ?>" level="<?php echo $level; ?>" >
1255
+ <?php $this->taxnomy_select( $term_id, $attr ); ?>
1256
+ </div>
1257
+ <?php
1258
+ $attr['parent_cat'] = $term_id;
1259
+ $level++;
1260
+ }
1261
+ }
1262
+
1263
+ ?>
1264
+ </div>
1265
+ <span class="loading"></span>
1266
+ <?php
1267
+ break;
1268
+ case 'select':
1269
+
1270
+ $selected = $terms ? $terms[0] : '';
1271
+ $required = sprintf( 'data-required="%s" data-type="select"', $attr['required'] );
1272
+
1273
+ $select = wp_dropdown_categories( array(
1274
+ 'show_option_none' => __( '-- Select --', 'wpuf' ),
1275
+ 'hierarchical' => 1,
1276
+ 'hide_empty' => 0,
1277
+ 'orderby' => isset( $attr['orderby'] ) ? $attr['orderby'] : 'name',
1278
+ 'order' => isset( $attr['order'] ) ? $attr['order'] : 'ASC',
1279
+ 'name' => $taxonomy . '[]',
1280
+ 'taxonomy' => $taxonomy,
1281
+ 'echo' => 0,
1282
+ 'title_li' => '',
1283
+ 'class' => $taxonomy . $class,
1284
+ $exclude_type => $exclude,
1285
+ 'selected' => $selected,
1286
+ ) );
1287
+
1288
+ echo str_replace( '<select', '<select ' . $required, $select );
1289
+ break;
1290
+
1291
+ case 'multiselect':
1292
+ $selected = $terms ? $terms : array();
1293
+ $required = sprintf( 'data-required="%s" data-type="multiselect"', $attr['required'] );
1294
+ $walker = new WPUF_Walker_Category_Multi();
1295
+
1296
+ $select = wp_dropdown_categories( array(
1297
+ // 'show_option_none' => __( '-- Select --', 'wpuf' ),
1298
+ 'hierarchical' => 1,
1299
+ 'hide_empty' => 0,
1300
+ 'orderby' => isset( $attr['orderby'] ) ? $attr['orderby'] : 'name',
1301
+ 'order' => isset( $attr['order'] ) ? $attr['order'] : 'ASC',
1302
+ 'name' => $taxonomy . '[]',
1303
+ 'id' => 'cat-ajax',
1304
+ 'taxonomy' => $taxonomy,
1305
+ 'echo' => 0,
1306
+ 'title_li' => '',
1307
+ 'class' => $taxonomy . ' multiselect' . $class,
1308
+ $exclude_type => $exclude,
1309
+ 'selected' => $selected,
1310
+ 'walker' => $walker
1311
+ ) );
1312
+
1313
+ echo str_replace( '<select', '<select multiple="multiple" ' . $required, $select );
1314
+ break;
1315
+
1316
+ case 'checkbox':
1317
+ wpuf_category_checklist( $post_id, false, $attr, $class );
1318
+ break;
1319
+
1320
+ case 'text':
1321
+ ?>
1322
+
1323
+ <input class="textfield<?php echo $this->required_class( $attr ); ?>" id="<?php echo $attr['name']; ?>" type="text" data-required="<?php echo $attr['required'] ?>" data-type="text"<?php $this->required_html5( $attr ); ?> name="<?php echo esc_attr( $attr['name'] ); ?>" value="<?php echo esc_attr( implode( ', ', $terms ) ); ?>" size="40" />
1324
+
1325
+ <script type="text/javascript">
1326
+ jQuery(function($) {
1327
+ $('#<?php echo $attr['name']; ?>').suggest( wpuf_frontend.ajaxurl + '?action=wpuf-ajax-tag-search&tax=<?php echo $attr['name']; ?>', { delay: 500, minchars: 2, multiple: true, multipleSep: ', ' } );
1328
+ });
1329
+ </script>
1330
+
1331
+ <?php
1332
+ break;
1333
+
1334
+ default:
1335
+ # code...
1336
+ break;
1337
+ }
1338
+ ?>
1339
+ <?php $this->help_text( $attr ); ?>
1340
+ </div>
1341
+
1342
+
1343
+ <?php
1344
+ }
1345
+
1346
+ /**
1347
+ * Prints a HTML field
1348
+ *
1349
+ * @param array $attr
1350
+ */
1351
+ function html( $attr, $form_id ) {
1352
+ ?>
1353
+ <div class="wpuf-fields <?php echo ' wpuf_'.$attr['name'].'_'.$form_id; ?>">
1354
+ <?php echo do_shortcode( $attr['html'] ); ?>
1355
+ </div>
1356
+ <?php
1357
+ }
1358
+
1359
+ /**
1360
+ * Prints a image upload field
1361
+ *
1362
+ * @param array $attr
1363
+ * @param int|null $post_id
1364
+ */
1365
+ function image_upload( $attr, $post_id, $type, $form_id ) {
1366
+
1367
+ $has_featured_image = false;
1368
+ $has_images = false;
1369
+ $has_avatar = false;
1370
+ $unique_id = sprintf( '%s-%d', $attr['name'], $form_id );
1371
+
1372
+ if ( $post_id ) {
1373
+ if ( $this->is_meta( $attr ) ) {
1374
+ $images = $this->get_meta( $post_id, $attr['name'], $type, false );
1375
+ $has_images = true;
1376
+ } else {
1377
+
1378
+ if ( $type == 'post' ) {
1379
+ // it's a featured image then
1380
+ $thumb_id = get_post_thumbnail_id( $post_id );
1381
+
1382
+ if ( $thumb_id ) {
1383
+ $has_featured_image = true;
1384
+ $featured_image = WPUF_Upload::attach_html( $thumb_id, 'featured_image' );
1385
+ }
1386
+ } else {
1387
+ // it must be a user avatar
1388
+ $has_avatar = true;
1389
+ $featured_image = get_avatar( $post_id );
1390
+ }
1391
+ }
1392
+ }
1393
+ ?>
1394
+
1395
+ <div class="wpuf-fields">
1396
+ <div id="wpuf-<?php echo $unique_id; ?>-upload-container">
1397
+ <div class="wpuf-attachment-upload-filelist" data-type="file" data-required="<?php echo $attr['required']; ?>">
1398
+ <a id="wpuf-<?php echo $unique_id; ?>-pickfiles" data-form_id="<?php echo $form_id; ?>" class="button file-selector <?php echo ' wpuf_' . $attr['name'] . '_' . $form_id; ?>" href="#"><?php _e( 'Select Image', 'wpuf' ); ?></a>
1399
+
1400
+ <ul class="wpuf-attachment-list thumbnails">
1401
+ <?php
1402
+ if ( $has_featured_image ) {
1403
+ echo $featured_image;
1404
+ }
1405
+
1406
+ if ( $has_avatar ) {
1407
+ $avatar = get_user_meta( $post_id, 'user_avatar', true );
1408
+ if ( $avatar ) {
1409
+ echo '<li>'.$featured_image;
1410
+ printf( '<br><a href="#" data-confirm="%s" class="btn btn-danger btn-small wpuf-button button wpuf-delete-avatar">%s</a>', __( 'Are you sure?', 'wpuf' ), __( 'Delete', 'wpuf' ) );
1411
+ echo '</li>';
1412
+ }
1413
+ }
1414
+
1415
+ if ( $has_images ) {
1416
+ foreach ($images as $attach_id) {
1417
+ echo WPUF_Upload::attach_html( $attach_id, $attr['name'] );
1418
+ }
1419
+ }
1420
+ ?>
1421
+ </ul>
1422
+ </div>
1423
+ </div><!-- .container -->
1424
+
1425
+ <?php $this->help_text( $attr ); ?>
1426
+
1427
+ </div> <!-- .wpuf-fields -->
1428
+
1429
+ <script type="text/javascript">
1430
+ jQuery(function($) {
1431
+ new WPUF_Uploader('wpuf-<?php echo $unique_id; ?>-pickfiles', 'wpuf-<?php echo $unique_id; ?>-upload-container', <?php echo $attr['count']; ?>, '<?php echo $attr['name']; ?>', 'jpg,jpeg,gif,png,bmp', <?php echo $attr['max_size'] ?>);
1432
+ });
1433
+ </script>
1434
+ <?php
1435
+
1436
+ }
1437
+
1438
+ /**
1439
+ * Prints a section break
1440
+ *
1441
+ * @param array $attr
1442
+ * @param int|null $post_id
1443
+ */
1444
+ function section_break( $attr, $post_id, $form_id ) {
1445
+ ?>
1446
+ <div class="wpuf-section-wrap <?php echo ' wpuf_'.$attr['name'].'_'.$attr['id'].'_'.$form_id; ?>">
1447
+ <h2 class="wpuf-section-title"><?php echo $attr['label']; ?></h2>
1448
+ <div class="wpuf-section-details"><?php echo $attr['description']; ?></div>
1449
+ </div>
1450
+ <?php
1451
+ }
1452
+
1453
+ }
class/subscription.php ADDED
@@ -0,0 +1,1094 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * WPUF subscription manager
5
+ *
6
+ * @since 0.2
7
+ * @author Tareq Hasan
8
+ * @package WP User Frontend
9
+ */
10
+ class WPUF_Subscription {
11
+
12
+ private static $_instance;
13
+
14
+ function __construct() {
15
+
16
+ add_action( 'init', array($this, 'register_post_type') );
17
+ add_filter( 'wpuf_add_post_args', array($this, 'set_pending'), 10, 3 );
18
+ add_filter( 'wpuf_add_post_redirect', array($this, 'post_redirect'), 10, 4 );
19
+
20
+ add_filter( 'wpuf_addpost_notice', array($this, 'force_pack_notice'), 20, 3 );
21
+ add_filter( 'wpuf_can_post', array($this, 'force_pack_permission'), 20, 3 );
22
+ add_action( 'wpuf_add_post_form_top', array($this, 'add_post_info'), 10, 2 );
23
+
24
+ add_action( 'wpuf_add_post_after_insert', array($this, 'monitor_new_post'), 10, 3 );
25
+ add_action( 'wpuf_payment_received', array($this, 'payment_received'), 10, 2 );
26
+
27
+ add_shortcode( 'wpuf_sub_info', array($this, 'subscription_info') );
28
+ add_shortcode( 'wpuf_sub_pack', array($this, 'subscription_packs') );
29
+
30
+ add_action( 'add_meta_boxes_wpuf_subscription', array($this, 'add_meta_box_subscription_post') );
31
+
32
+ add_action( 'save_post', array( $this, 'save_form_meta' ), 1, 3 );
33
+ add_filter( 'enter_title_here', array( $this, 'change_default_title' ) );
34
+ add_action( 'admin_enqueue_scripts', array( $this, 'subscription_script' ) );
35
+
36
+ add_action( 'user_register', array( $this,'after_registration' ), 10, 1 );
37
+
38
+ add_action( 'register_form',array( $this, 'register_form') );
39
+ add_action( 'wpuf_add_post_form_top',array( $this, 'register_form') );
40
+ add_filter( 'wpuf_user_register_redirect', array( $this, 'subs_redirect_pram' ), 10, 5 );
41
+
42
+ add_filter( 'template_redirect', array( $this, 'user_subscription_cancel' ) );
43
+
44
+ add_action( 'wpuf_draft_post_after_insert', array( $this, 'reset_user_subscription_data' ), 10, 4 );
45
+
46
+ }
47
+
48
+ /**
49
+ * Handle subscription cancel request from the user
50
+ *
51
+ * @return WPUF_Subscription
52
+ */
53
+ public function user_subscription_cancel () {
54
+
55
+ if ( isset( $_POST['wpuf_cancel_subscription'] ) ) {
56
+
57
+ if ( ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'wpuf-sub-cancel' ) ) {
58
+ wp_die( __( 'Nonce failure', 'dps' ) );
59
+ }
60
+
61
+ $user_id = get_current_user_id();
62
+ $current_pack = self::get_user_pack( $user_id );
63
+
64
+ if ( $current_pack['recurring'] == 'yes' ) {
65
+ $wpuf_paypal = new WPUF_Paypal();
66
+ $wpuf_paypal->recurring_change_status( $user_id, 'Cancel' );
67
+ } else {
68
+ WPUF_Subscription::init()->update_user_subscription_meta( $user_id, 'Cancel' );
69
+ }
70
+
71
+ wp_redirect( $_SERVER['REQUEST_URI'] );
72
+
73
+ }
74
+ }
75
+
76
+
77
+ public static function init() {
78
+ if ( !self::$_instance ) {
79
+ self::$_instance = new self;
80
+ }
81
+
82
+ return self::$_instance;
83
+ }
84
+
85
+ /**
86
+ * Redirect a user to subscription page after signup
87
+ *
88
+ * @since 2.2
89
+ *
90
+ * @param array $response
91
+ * @param int $user_id
92
+ * @param array $userdata
93
+ * @param int $form_id
94
+ * @param array $form_settings
95
+ * @return array
96
+ */
97
+ function subs_redirect_pram( $response, $user_id, $userdata, $form_id, $form_settings ) {
98
+ if ( ! isset( $_POST['wpuf_sub'] ) || $_POST['wpuf_sub'] != 'yes' ) {
99
+ return $response;
100
+ }
101
+
102
+ if ( ! isset( $_POST['pack_id'] ) || empty( $_POST['pack_id'] ) ) {
103
+ return $response;
104
+ }
105
+
106
+ $pack = $this->get_subscription( $_POST['pack_id'] );
107
+ $billing_amount = ( $pack->meta_value['billing_amount'] >= 0 && !empty( $pack->meta_value['billing_amount'] ) ) ? $pack->meta_value['billing_amount'] : false;
108
+
109
+ if ( $billing_amount !== false ) {
110
+ $pay_page = intval( wpuf_get_option( 'payment_page', 'wpuf_payment' ) );
111
+ $redirect = add_query_arg( array('action' => 'wpuf_pay', 'user_id' => $user_id, 'type' => 'pack', 'pack_id' => (int) $_POST['pack_id'] ), get_permalink( $pay_page ) );
112
+
113
+ $response['redirect_to'] = $redirect;
114
+ $response['show_message'] = false;
115
+ }
116
+
117
+ return $response;
118
+ }
119
+
120
+ /**
121
+ * Insert hidden field on the register form based on selected package
122
+ *
123
+ * @since 2.2
124
+ *
125
+ * @return void
126
+ */
127
+ function register_form() {
128
+ if ( !isset( $_GET['type'] ) || $_GET['type'] != 'wpuf_sub' ) {
129
+ return;
130
+ }
131
+
132
+ if ( !isset( $_GET['pack_id'] ) || empty( $_GET['pack_id'] ) ) {
133
+ return;
134
+ }
135
+
136
+ $pack_id = (int) $_GET['pack_id'];
137
+ ?>
138
+ <input type="hidden" name="wpuf_sub" value="yes" />
139
+ <input type="hidden" name="pack_id" value="<?php echo $pack_id; ?>" />
140
+
141
+ <?php
142
+ }
143
+
144
+ /**
145
+ * Redirect to payment page or add free subscription after user registration
146
+ *
147
+ * @since 2.2
148
+ *
149
+ * @param int $user_id
150
+ * @return void
151
+ */
152
+ function after_registration( $user_id ) {
153
+
154
+ if ( !isset( $_POST['wpuf_sub'] ) || $_POST['wpuf_sub'] != 'yes' ) {
155
+ return $user_id;
156
+ }
157
+
158
+ if ( !isset( $_POST['pack_id'] ) || empty( $_POST['pack_id'] ) ) {
159
+ return $user_id;
160
+ }
161
+
162
+ $pack_id = isset( $_POST['pack_id'] ) ? intval( $_POST['pack_id'] ) : 0;
163
+ $pack = $this->get_subscription( $pack_id );
164
+ $billing_amount = ( $pack->meta_value['billing_amount'] >= 0 && !empty( $pack->meta_value['billing_amount'] ) ) ? $pack->meta_value['billing_amount'] : false;
165
+
166
+ if ( $billing_amount === false ) {
167
+ $this->new_subscription( $user_id, $pack_id, null, false, 'free' );
168
+ WPUF_Subscription::add_used_free_pack( $user_id, $pack_id );
169
+ } else {
170
+ $pay_page = intval( wpuf_get_option( 'payment_page', 'wpuf_payment' ) );
171
+ $redirect = add_query_arg( array( 'action' => 'wpuf_pay', 'type' => 'pack', 'pack_id' => (int) $pack_id ), get_permalink( $pay_page ) );
172
+ }
173
+ }
174
+
175
+ /**
176
+ * Enqueue scripts and styles
177
+ *
178
+ * @since 2.2
179
+ */
180
+ function subscription_script() {
181
+ wp_enqueue_script( 'wpuf-subscriptions', WPUF_ASSET_URI . '/js/subscriptions.js', array('jquery'), false, true );
182
+ }
183
+
184
+ /**
185
+ * Get all subscription packs
186
+ *
187
+ * @return array
188
+ */
189
+ function get_subscriptions() {
190
+ $args = array(
191
+ 'post_type' => 'wpuf_subscription',
192
+ 'posts_per_page' => -1,
193
+ 'post_status' => 'publish',
194
+ );
195
+
196
+ $posts = get_posts( $args );
197
+
198
+ if ( $posts ) {
199
+ foreach ($posts as $key => $post) {
200
+ $post->meta_value = $this->get_subscription_meta( $post->ID, $posts );
201
+ }
202
+ }
203
+
204
+ return $posts;
205
+ }
206
+
207
+ /**
208
+ * Set meta fields on a subscription pack
209
+ *
210
+ * @since 2.2
211
+ *
212
+ * @param int $subscription_id
213
+ * @param \WP_Post $pack_post
214
+ * @return array
215
+ */
216
+ public static function get_subscription_meta( $subscription_id, $pack_post = null ) {
217
+
218
+ $meta['post_content'] = isset( $pack_post->post_content ) ? $pack_post->post_content : '';
219
+ $meta['post_title'] = isset( $pack_post->post_title ) ? $pack_post->post_title : '';
220
+ $meta['billing_amount'] = get_post_meta( $subscription_id, '_billing_amount', true );
221
+ $meta['expiration_number'] = get_post_meta( $subscription_id, '_expiration_number', true );
222
+ $meta['expiration_period'] = get_post_meta( $subscription_id, '_expiration_period', true );
223
+ $meta['recurring_pay'] = get_post_meta( $subscription_id, '_recurring_pay', true );
224
+ $meta['billing_cycle_number'] = get_post_meta( $subscription_id, '_billing_cycle_number', true );
225
+ $meta['cycle_period'] = get_post_meta( $subscription_id, '_cycle_period', true );
226
+ $meta['billing_limit'] = get_post_meta( $subscription_id, '_billing_limit', true );
227
+ $meta['trial_status'] = get_post_meta( $subscription_id, '_trial_status', true );
228
+ $meta['trial_cost'] = get_post_meta( $subscription_id, '_trial_cost', true );
229
+ $meta['trial_duration'] = get_post_meta( $subscription_id, '_trial_duration', true );
230
+ $meta['trial_duration_type'] = get_post_meta( $subscription_id, '_trial_duration_type', true );
231
+ $meta['post_type_name'] = get_post_meta( $subscription_id, '_post_type_name', true );
232
+ $meta['_enable_post_expiration'] = get_post_meta( $subscription_id, '_enable_post_expiration', true );
233
+ $meta['_post_expiration_time'] = get_post_meta( $subscription_id, '_post_expiration_time', true );
234
+ //
235
+ $meta['_expired_post_status'] = get_post_meta( $subscription_id, '_expired_post_status', true );
236
+ $meta['_enable_mail_after_expired'] = get_post_meta( $subscription_id, '_enable_mail_after_expired', true );
237
+ $meta['_post_expiration_message'] = get_post_meta( $subscription_id, '_post_expiration_message', true );
238
+
239
+ $meta = apply_filters( 'wpuf_get_subscription_meta', $meta, $subscription_id );
240
+
241
+ return $meta;
242
+ }
243
+
244
+ /**
245
+ * Get all post types
246
+ *
247
+ * @since 2.2
248
+ * @return array
249
+ */
250
+ function get_all_post_type() {
251
+ $post_types = get_post_types();
252
+
253
+ unset(
254
+ $post_types['attachment'],
255
+ $post_types['revision'],
256
+ $post_types['nav_menu_item'],
257
+ $post_types['wpuf_forms'],
258
+ $post_types['wpuf_profile'],
259
+ $post_types['wpuf_subscription'],
260
+ $post_types['wpuf_coupon'],
261
+ $post_types['wpuf_input']
262
+ );
263
+
264
+ return apply_filters( 'wpuf_posts_type', $post_types );
265
+ }
266
+
267
+ /**
268
+ * Post type name placeholder text
269
+ *
270
+ * @param string $title
271
+ * @return string
272
+ */
273
+ function change_default_title( $title ) {
274
+ $screen = get_current_screen();
275
+
276
+ if ( 'wpuf_subscription' == $screen->post_type ) {
277
+ $title = __( 'Pack Name', 'wpuf' );
278
+ }
279
+
280
+ return $title;
281
+ }
282
+
283
+ /**
284
+ * Save form data
285
+ *
286
+ * @param int $post_ID
287
+ * @param \WP_Post $post
288
+ * @return void
289
+ */
290
+ function save_form_meta( $subscription_id, $post ) {
291
+ $post = $_POST;
292
+ if ( !isset( $post['wpuf_subscription'] ) ) {
293
+ return;
294
+ }
295
+
296
+ if ( !wp_verify_nonce( $post['wpuf_subscription'], 'wpuf_subscription_editor' ) ) {
297
+ return;
298
+ }
299
+
300
+ // Is the user allowed to edit the post or page?
301
+ if ( ! current_user_can( 'edit_post', $post->ID ) ) {
302
+ return;
303
+ }
304
+
305
+ update_post_meta( $subscription_id, '_billing_amount', $post['billing_amount'] );
306
+ update_post_meta( $subscription_id, '_expiration_number', $post['expiration_number'] );
307
+ update_post_meta( $subscription_id, '_expiration_period', $post['expiration_period'] );
308
+ update_post_meta( $subscription_id, '_recurring_pay', $post['recurring_pay'] );
309
+ update_post_meta( $subscription_id, '_billing_cycle_number', $post['billing_cycle_number'] );
310
+ update_post_meta( $subscription_id, '_cycle_period', $post['cycle_period'] );
311
+ update_post_meta( $subscription_id, '_billing_limit', $post['billing_limit'] );
312
+ update_post_meta( $subscription_id, '_trial_status', $post['trial_status'] );
313
+ update_post_meta( $subscription_id, '_trial_cost', $post['trial_cost'] );
314
+ update_post_meta( $subscription_id, '_trial_duration', $post['trial_duration'] );
315
+ update_post_meta( $subscription_id, '_trial_duration_type', $post['trial_duration_type'] );
316
+ update_post_meta( $subscription_id, '_post_type_name', $post['post_type_name'] );
317
+ update_post_meta( $subscription_id, '_enable_post_expiration', ( isset($post['post_expiration_settings']['enable_post_expiration'])?$post['post_expiration_settings']['enable_post_expiration']:'' ) );
318
+ update_post_meta( $subscription_id, '_post_expiration_time', $post['post_expiration_settings']['expiration_time_value'].' '.$post['post_expiration_settings']['expiration_time_type'] );
319
+ update_post_meta( $subscription_id, '_expired_post_status', ( isset($post['post_expiration_settings']['expired_post_status'])?$post['post_expiration_settings']['expired_post_status']:'' ) );
320
+ update_post_meta( $subscription_id, '_enable_mail_after_expired', ( isset($post['post_expiration_settings']['enable_mail_after_expired'])?$post['post_expiration_settings']['enable_mail_after_expired']:'' ) );
321
+ update_post_meta( $subscription_id, '_post_expiration_message', ( isset($post['post_expiration_settings']['post_expiration_message'])?$post['post_expiration_settings']['post_expiration_message']:'' ) );
322
+ do_action( 'wpuf_update_subscription_pack', $subscription_id, $post );
323
+ }
324
+
325
+ /**
326
+ * Subscription post types
327
+ *
328
+ * @return void
329
+ */
330
+ function register_post_type() {
331
+
332
+ $capability = wpuf_admin_role();
333
+
334
+ register_post_type( 'wpuf_subscription', array(
335
+ 'label' => __( 'Subscription', 'wpuf' ),
336
+ 'public' => false,
337
+ 'show_ui' => true,
338
+ 'show_in_menu' => false,
339
+ 'hierarchical' => false,
340
+ 'query_var' => false,
341
+ 'supports' => array('title'),
342
+ 'capability_type' => 'post',
343
+ 'capabilities' => array(
344
+ 'publish_posts' => $capability,
345
+ 'edit_posts' => $capability,
346
+ 'edit_others_posts' => $capability,
347
+ 'delete_posts' => $capability,
348
+ 'delete_others_posts' => $capability,
349
+ 'read_private_posts' => $capability,
350
+ 'edit_post' => $capability,
351
+ 'delete_post' => $capability,
352
+ 'read_post' => $capability,
353
+ ),
354
+ 'labels' => array(
355
+ 'name' => __( 'Subscription', 'wpuf' ),
356
+ 'singular_name' => __( 'Subscription', 'wpuf' ),
357
+ 'menu_name' => __( 'Subscription', 'wpuf' ),
358
+ 'add_new' => __( 'Add Subscription', 'wpuf' ),
359
+ 'add_new_item' => __( 'Add New Subscription', 'wpuf' ),
360
+ 'edit' => __( 'Edit', 'wpuf' ),
361
+ 'edit_item' => __( 'Edit Subscription', 'wpuf' ),
362
+ 'new_item' => __( 'New Subscription', 'wpuf' ),
363
+ 'view' => __( 'View Subscription', 'wpuf' ),
364
+ 'view_item' => __( 'View Subscription', 'wpuf' ),
365
+ 'search_items' => __( 'Search Subscription', 'wpuf' ),
366
+ 'not_found' => __( 'No Subscription Found', 'wpuf' ),
367
+ 'not_found_in_trash' => __( 'No Subscription Found in Trash', 'wpuf' ),
368
+ 'parent' => __( 'Parent Subscription', 'wpuf' ),
369
+ ),
370
+ ) );
371
+ }
372
+
373
+ /**
374
+ * Update users subscription
375
+ *
376
+ * Updates the pack when new re-curring payment IPN notification is being
377
+ * sent from PayPal.
378
+ *
379
+ * @return void
380
+ */
381
+ function update_paypal_subscr_payment() {
382
+ if ( !isset( $_POST['txn_type'] ) && $_POST['txn_type'] != 'subscr_payment' ) {
383
+ return;
384
+ }
385
+
386
+ if ( strtolower( $_POST['payment_status'] ) != 'completed' ) {
387
+ return;
388
+ }
389
+
390
+ $pack = $this->get_subscription( $pack_id );
391
+ $payer = json_decode( stripcslashes( $_POST['custom'] ) );
392
+
393
+ $this->update_user_subscription_meta( $payer->payer_id, $pack );
394
+ }
395
+
396
+ function add_meta_box_subscription_post() {
397
+ add_meta_box( 'wpuf-metabox-subscription', __( 'Billing Details', 'wpuf' ), array($this, 'subscription_form_elements_post'), 'wpuf_subscription', 'normal', 'high' );
398
+ }
399
+
400
+ function subscription_form_elements_post() {
401
+ require_once dirname(__FILE__) . '/../admin/subscription.php';
402
+ ?>
403
+ <div class="wrap">
404
+ <?php WPUF_Admin_Subscription::getInstance()->form(); ?>
405
+ </div>
406
+ <?php
407
+ }
408
+
409
+ /**
410
+ * Get a subscription row from database
411
+ *
412
+ * @global object $wpdb
413
+ * @param int $sub_id subscription pack id
414
+ * @return object|bool
415
+ */
416
+ public static function get_subscription( $sub_id ) {
417
+ $pack = get_post( $sub_id );
418
+
419
+ if ( ! $pack ) {
420
+ return false;
421
+ }
422
+
423
+ $pack->meta_value = self::get_subscription_meta( $sub_id, $pack );
424
+
425
+ return $pack;
426
+ }
427
+
428
+
429
+
430
+ /**
431
+ * Set the new post status if charging is active
432
+ *
433
+ * @param string $postdata
434
+ * @return string
435
+ */
436
+ function set_pending( $postdata, $form_id, $form_settings ) {
437
+
438
+ if ( wpuf_get_option( 'charge_posting', 'wpuf_payment' ) == 'yes' ) {
439
+ if ( isset ( $form_settings['subscription_disabled'] ) && $form_settings['subscription_disabled'] == 'yes' ) {
440
+ return $postdata;
441
+ }
442
+ $postdata['post_status'] = 'pending';
443
+ }
444
+
445
+ return $postdata;
446
+ }
447
+
448
+ /**
449
+ * Checks the posting validity after a new post
450
+ *
451
+ * @global object $userdata
452
+ * @global object $wpdb
453
+ * @param int $post_id
454
+ */
455
+ function monitor_new_post( $post_id, $form_id, $form_settings ) {
456
+ // check form if subscription is disabled
457
+ if ( isset( $form_settings['subscription_disabled'] ) && $form_settings['subscription_disabled'] == 'yes' ) {
458
+ return;
459
+ }
460
+ global $wpdb, $userdata;
461
+
462
+ // bail out if charging is not enabled
463
+ if ( wpuf_get_option( 'charge_posting', 'wpuf_payment', 'no' ) != 'yes' ) {
464
+ return;
465
+ }
466
+
467
+ $userdata = get_userdata( get_current_user_id() );
468
+
469
+ if ( self::has_user_error( $form_settings ) ) {
470
+ //there is some error and it needs payment
471
+ //add a uniqid to track the post easily
472
+ $order_id = uniqid( rand( 10, 1000 ), false );
473
+ update_post_meta( $post_id, '_wpuf_order_id', $order_id, true );
474
+
475
+ } else {
476
+
477
+ $sub_info = self::get_user_pack( $userdata->ID );
478
+ $post_type = isset( $form_settings['post_type'] ) ? $form_settings['post_type'] : 'post';
479
+ $count = isset( $sub_info['posts'][$post_type] ) ? intval( $sub_info['posts'][$post_type] ) : 0;
480
+ $post_status = isset( $form_settings['post_status'] ) ? $form_settings['post_status'] : 'publish';
481
+
482
+ wp_update_post( array( 'ID' => $post_id , 'post_status' => $post_status) );
483
+
484
+ // decrease the post count, if not umlimited
485
+ $wpuf_post_status = get_post_meta( $post_id, 'wpuf_post_status', true );
486
+
487
+ if ( $wpuf_post_status != 'new_draft' ) {
488
+ if ( $count > 0 ) {
489
+ $sub_info['posts'][$post_type] = $count - 1;
490
+ $this->update_user_subscription_meta( $userdata->ID, $sub_info );
491
+ }
492
+ }
493
+
494
+ //meta added to make post have flag if post is published
495
+ update_post_meta( $post_id, 'wpuf_post_status', 'published' );
496
+
497
+ }
498
+
499
+ }
500
+
501
+ /**
502
+ * Redirect to payment page after new post
503
+ *
504
+ * @param string $str
505
+ * @param type $post_id
506
+ * @return string
507
+ */
508
+ function post_redirect( $response, $post_id, $form_id, $form_settings ) {
509
+
510
+ if ( self::has_user_error( $form_settings ) ) {
511
+
512
+ $order_id = get_post_meta( $post_id, '_wpuf_order_id', true );
513
+
514
+ // check if there is a order ID
515
+ if ( $order_id ) {
516
+ $response['show_message'] = false;
517
+ $response['redirect_to'] = add_query_arg( array(
518
+ 'action' => 'wpuf_pay',
519
+ 'type' => 'post',
520
+ 'post_id' => $post_id
521
+ ), get_permalink( wpuf_get_option( 'payment_page', 'wpuf_payment' ) ) );
522
+
523
+ return $response;
524
+ }
525
+ }
526
+
527
+ return $response;
528
+ }
529
+
530
+ /**
531
+ * Perform actions when a new payment is made
532
+ *
533
+ * @param array $info payment info
534
+ */
535
+ function payment_received( $info, $recurring ) {
536
+
537
+ if ( $info['post_id'] ) {
538
+
539
+ $this->handle_post_publish( $info['post_id'] );
540
+
541
+ } else if ( $info['pack_id'] ) {
542
+ $profile_id = isset( $info['profile_id'] ) ? $info['profile_id'] : null;
543
+ $this->new_subscription( $info['user_id'], $info['pack_id'], $profile_id, $recurring, $info['status'] );
544
+ }
545
+ }
546
+
547
+ /**
548
+ * Store new subscription info on user profile
549
+ *
550
+ * if data = 0, means 'unlimited'
551
+ *
552
+ * @param int $user_id
553
+ * @param int $pack_id subscription pack id
554
+ */
555
+ public function new_subscription( $user_id, $pack_id, $profile_id = null, $recurring, $status = null ) {
556
+
557
+ $subscription = $this->get_subscription( $pack_id );
558
+ if ( $user_id && $subscription ) {
559
+
560
+ $user_meta = array(
561
+ 'pack_id' => $pack_id,
562
+ 'posts' => $subscription->meta_value['post_type_name'],
563
+ 'status' => $status
564
+ );
565
+
566
+ if ( $recurring ) {
567
+ $totla_date = date( 'd-m-Y', strtotime('+' . $cycle_number . $cycle_period . 's') );
568
+ $user_meta['expire'] = '';
569
+ $user_meta['profile_id'] = $profile_id;
570
+ $user_meta['recurring'] = 'yes';
571
+ } else {
572
+
573
+ $period_type = $subscription->meta_value['expiration_period'];
574
+ $period_number = $subscription->meta_value['expiration_number'];
575
+ $date = date( 'd-m-Y', strtotime('+' . $period_number . $period_type . 's') );
576
+ $expired = ( empty( $period_number ) || ( $period_number == 0 ) ) ? 'unlimited' : wpuf_date2mysql( $date );
577
+ $user_meta['expire'] = $expired;
578
+ $user_meta['recurring'] = 'no';
579
+ }
580
+
581
+ $user_meta = apply_filters( 'wpuf_new_subscription', $user_meta, $user_id, $pack_id, $recurring );
582
+ if($subscription->_enable_post_expiration){
583
+ $user_meta['_enable_post_expiration'] = $subscription->_enable_post_expiration;
584
+ $user_meta['_post_expiration_time'] = $subscription->_post_expiration_time;
585
+ $user_meta['_expired_post_status'] = $subscription->_expired_post_status;
586
+ $user_meta['_enable_mail_after_expired'] = $subscription->_enable_mail_after_expired;
587
+ $user_meta['_post_expiration_message'] = $subscription->_post_expiration_message;
588
+ }
589
+ $this->update_user_subscription_meta( $user_id, $user_meta );
590
+ }
591
+ }
592
+
593
+ public static function update_user_subscription_meta( $user_id, $user_meta ) {
594
+
595
+ update_user_meta( $user_id, '_wpuf_subscription_pack', $user_meta );
596
+ }
597
+
598
+ public static function post_by_orderid( $order_id ) {
599
+ global $wpdb;
600
+
601
+ //$post = get_post( $post_id );
602
+ $sql = $wpdb->prepare( "SELECT p.ID, p.post_status
603
+ FROM $wpdb->posts p, $wpdb->postmeta m
604
+ WHERE p.ID = m.post_id AND p.post_status <> 'publish' AND m.meta_key = '_wpuf_order_id' AND m.meta_value = %s", $order_id );
605
+
606
+ return $wpdb->get_row( $sql );
607
+ }
608
+
609
+ /**
610
+ * Publish the post if payment is made
611
+ *
612
+ * @param int $post_id
613
+ */
614
+ function handle_post_publish( $order_id ) {
615
+ $post = self::post_by_orderid( $order_id );
616
+
617
+ if ( $post && $post->post_status != 'publish' ) {
618
+ $this->set_post_status( $post->ID );
619
+ }
620
+ }
621
+
622
+ /**
623
+ * Maintain post status from the form settings
624
+ *
625
+ * @since 2.1.9
626
+ * @param int $post_id
627
+ */
628
+ function set_post_status( $post_id ) {
629
+ $post_status = 'publish';
630
+ $form_id = get_post_meta( $post_id, '_wpuf_form_id', true );
631
+
632
+ if ( $form_id ) {
633
+ $form_settings = wpuf_get_form_settings( $form_id );
634
+ $post_status = $form_settings['post_status'];
635
+ }
636
+
637
+ $update_post = array(
638
+ 'ID' => $post_id,
639
+ 'post_status' => $post_status
640
+ );
641
+
642
+ wp_update_post( $update_post );
643
+ }
644
+
645
+ /**
646
+ * Generate users subscription info with a shortcode
647
+ *
648
+ * @global type $userdata
649
+ */
650
+ function subscription_info() {
651
+
652
+ if ( wpuf_get_option( 'charge_posting', 'wpuf_payment' ) != 'yes' || !is_user_logged_in() ) {
653
+ return;
654
+ }
655
+
656
+ global $userdata;
657
+
658
+ ob_start();
659
+
660
+ $userdata = get_userdata( $userdata->ID ); //wp 3.3 fix
661
+
662
+ $user_sub = self::get_user_pack( $userdata->ID );
663
+ if ( !isset( $user_sub['pack_id'] ) ) {
664
+ return;
665
+ }
666
+
667
+ $pack = $this->get_subscription( $user_sub['pack_id'] );
668
+
669
+ $details_meta = $this->get_details_meta_value();
670
+
671
+ $billing_amount = ( intval( $pack->meta_value['billing_amount'] ) > 0 ) ? $details_meta['symbol'] . $pack->meta_value['billing_amount'] : __( 'Free', 'wpuf' );
672
+ if ( $pack->meta_value['recurring_pay'] == 'yes' ) {
673
+ $recurring_des = sprintf( 'For each %s %s', $pack->meta_value['billing_cycle_number'], $pack->meta_value['cycle_period'], $pack->meta_value['trial_duration_type'] );
674
+ $recurring_des .= !empty( $pack->meta_value['billing_limit'] ) ? sprintf( ', for %s installments', $pack->meta_value['billing_limit'] ) : '';
675
+ $recurring_des = $recurring_des;
676
+ } else {
677
+ $recurring_des = '';
678
+ }
679
+
680
+ ?>
681
+ <div class="wpuf_sub_info">
682
+ <h3><?php _e( 'Subscription Details', 'wpuf' ); ?></h3>
683
+ <div class="wpuf-text">
684
+ <div><strong><?php _e( 'Subcription Name: ','wpuf' ); ?></strong><?php echo $pack->post_title; ?></div>
685
+ <div>
686
+ <strong><?php _e( 'Package & billing details: '); ?></strong>
687
+
688
+ <div class="wpuf-pricing-wrap">
689
+ <div class="wpuf-sub-amount">
690
+ <?php echo $billing_amount; ?>
691
+ <?php echo $recurring_des; ?>
692
+ </div>
693
+ </div>
694
+
695
+ </div>
696
+ <div>
697
+ <strong><?php _e( 'Remaining post: ', 'wpuf'); ?></strong>
698
+ <?php
699
+ foreach ($user_sub['posts'] as $key => $value) {
700
+ $value = intval( $value );
701
+
702
+ if ( $value === 0 ) {
703
+ continue;
704
+ }
705
+
706
+ $post_type_obj = get_post_type_object( $key );
707
+ if ( ! $post_type_obj ) {
708
+ continue;
709
+ }
710
+ $value = ( $value == '-1' ) ? __( 'Unlimited', 'wpuf' ) : $value;
711
+ ?>
712
+ <div><?php echo $post_type_obj->labels->name . ': ' . $value; ?></div>
713
+ <?php
714
+ }
715
+ ?>
716
+ </div>
717
+ <?php
718
+ if ( $user_sub['recurring'] != 'yes' ) {
719
+ if ( !empty( $user_sub['expire'] ) ) {
720
+
721
+ $expire = ( $user_sub['expire'] == 'unlimited' ) ? ucfirst( 'unlimited' ) : wpuf_date2mysql( $user_sub['expire'] );
722
+
723
+ ?>
724
+ <div class="wpuf-expire">
725
+ <strong><?php echo _e('Expire date:'); ?></strong> <?php echo wpuf_get_date( $expire ); ?>
726
+ </div>
727
+ <?php
728
+ }
729
+
730
+ } ?>
731
+ </div>
732
+ <?php
733
+ if ( $user_sub['recurring'] == 'yes' ) {
734
+ $payment_page = get_permalink( wpuf_get_option( 'payment_page', 'wpuf_payment' ) );
735
+ ?>
736
+ <form action="" method="post">
737
+ <?php wp_nonce_field( '_wpnonce', 'wpuf_payment_cancel' ); ?>
738
+ <input type="hidden" name="user_id" value="<?php echo $userdata->ID; ?>">
739
+ <input type="hidden" name="action" value="wpuf_cancel_pay">
740
+ <input type="hidden" name="gateway" value="paypal">
741
+ <input type="submit" name="wpuf_payment_cancel_submit" value="cancel">
742
+ </form>
743
+ <?php $subscription_page = wpuf_get_option( 'subscription_page','wpuf_payment' ); ?>
744
+ <a href="<?php echo get_permalink( $subscription_page ); ?>"><? _e( 'Change', 'wpuf'); ?></a>
745
+ <?php
746
+ }
747
+ echo '</div>';
748
+
749
+ $content = ob_get_clean();
750
+
751
+ return apply_filters( 'wpuf_sub_info', $content, $userdata, $user_sub, $pack );
752
+ }
753
+
754
+
755
+ /**
756
+ * Show the subscription packs that are built
757
+ * from admin Panel
758
+ */
759
+ function subscription_packs() {
760
+ $cost_per_post = wpuf_get_option( 'charge_posting', 'wpuf_payment' );
761
+
762
+ if ( $cost_per_post != 'yes' ) {
763
+ _e('Please enable force pack and charge posting from admin panel', 'wpuf' );
764
+ return;
765
+ }
766
+
767
+ $packs = $this->get_subscriptions();
768
+ $details_meta = $this->get_details_meta_value();
769
+
770
+ ob_start();
771
+
772
+ if ( isset( $_GET['action'] ) && $_GET['action'] == 'wpuf_paypal_success' ) {
773
+ printf( '<h1>%1$s</h1><p>%2$s</p>', __( 'Payment is complete', 'wpuf' ), __( 'Congratulations, your payment has been completed!', 'wpuf' ) );
774
+ }
775
+
776
+ $current_pack = self::get_user_pack( get_current_user_id());
777
+ if( isset( $current_pack['pack_id'] ) ) {
778
+ ?>
779
+
780
+ <?php _e( '<p><i>You have a subscription pack activated. </i></p>', 'dps' ); ?>
781
+ <?php _e( '<p><i>Pack name : '.get_the_title( $current_pack['pack_id'] ).' </i></p>', 'wpuf' ); ?>
782
+ <?php _e( '<p><i>To cancel the pack, press the following cancel button</i></p>', 'wpuf' ); ?>
783
+
784
+ <form action="" method="post">
785
+ <?php wp_nonce_field( 'wpuf-sub-cancel' ); ?>
786
+ <input type="submit" name="wpuf_cancel_subscription" class="btn btn-sm btn-danger" value="<?php _e( 'Cancel', 'wpuf' ); ?>">
787
+ </form>
788
+ <?php
789
+ }
790
+ if ( $packs ) {
791
+ echo '<ul class="wpuf_packs">';
792
+ foreach ($packs as $pack) {
793
+ $class = 'wpuf-pack-' . $pack->ID;
794
+ ?>
795
+ <li class="<?php echo $class; ?>">
796
+ <?php $this->pack_details( $pack, $details_meta, isset( $current_pack['pack_id'] ) ? $current_pack['pack_id'] : '' ); ?>
797
+ </li>
798
+ <?php
799
+ }
800
+ echo '</ul>';
801
+ }
802
+
803
+ $contents = ob_get_clean();
804
+
805
+ return apply_filters( 'wpuf_subscription_packs', $contents, $packs );
806
+ }
807
+
808
+ function get_details_meta_value() {
809
+
810
+ $meta['payment_page'] = get_permalink( wpuf_get_option( 'payment_page', 'wpuf_payment' ) );
811
+ $meta['onclick'] = '';
812
+ $meta['symbol'] = wpuf_get_option( 'currency_symbol', 'wpuf_payment' );
813
+
814
+ return $meta;
815
+ }
816
+
817
+ function pack_details( $pack, $details_meta, $current_pack_id = '', $coupon_satus = false ) {
818
+
819
+ $billing_amount = ( $pack->meta_value['billing_amount'] >= 0 && !empty( $pack->meta_value['billing_amount'] ) ) ? $pack->meta_value['billing_amount'] : '0.00';
820
+
821
+ if ( $billing_amount && $pack->meta_value['recurring_pay'] == 'yes' ) {
822
+ $recurring_des = sprintf( __('Every', 'wpuf').' %s %s', $pack->meta_value['billing_cycle_number'], $pack->meta_value['cycle_period'], $pack->meta_value['trial_duration_type'] );
823
+ $recurring_des .= !empty( $pack->meta_value['billing_limit'] ) ? __( sprintf( ', '.__('for', 'wpuf').' %s '.__( 'installments', 'wpuf' ), $pack->meta_value['billing_limit'] ), 'wpuf' ) : '';
824
+ $recurring_des = '<div class="wpuf-pack-cycle wpuf-nullamount-hide">'.$recurring_des.'</div>';
825
+ } else {
826
+ $recurring_des = '<div class="wpuf-pack-cycle wpuf-nullamount-hide">' . __( 'One time payment', 'wpuf' ) . '</div>';
827
+ }
828
+
829
+ if ( $billing_amount && $pack->meta_value['recurring_pay'] == 'yes' && $pack->meta_value['trial_status'] == 'yes' ) {
830
+
831
+ $trial_cost = ( empty( $pack->meta_value['trial_cost'] ) || $pack->meta_value['trial_cost'] == 0 ) ? __( 'Free', 'wpuf' ) : $details_meta['symbol'].$pack->meta_value['trial_cost'];
832
+ $trial_des = __( sprintf( '%s for the first %s %s', $trial_cost, $pack->meta_value['trial_duration'], $pack->meta_value['trial_duration_type'] ), 'wpuf' );
833
+
834
+ } else {
835
+ $trial_des = '';
836
+ }
837
+
838
+ if ( ! is_user_logged_in() ) {
839
+ $button_name = __( 'Sign Up', 'wpuf' );
840
+ $url = wp_login_url();
841
+ } else if ( $billing_amount == '0.00' ) {
842
+ $button_name = __( 'Free', 'wpuf' );
843
+ } else {
844
+ $button_name = __( 'Buy Now', 'wpuf' );
845
+ }
846
+ ?>
847
+ <div class="wpuf-pricing-wrap">
848
+ <h3><?php echo wp_kses_post( $pack->post_title ); ?> </h3>
849
+ <div class="wpuf-sub-amount">
850
+
851
+ <?php if ( $billing_amount != '0.00' ) { ?>
852
+ <sup class="wpuf-sub-symbol"><?php echo $details_meta['symbol']; ?></sup>
853
+ <span class="wpuf-sub-cost"><?php echo $billing_amount; ?></span>
854
+ <?php } else { ?>
855
+ <span class="wpuf-sub-cost"><?php _e( 'Free', 'wpuf' ); ?></span>
856
+ <?php } ?>
857
+
858
+ <?php _e( $recurring_des , 'wpuf' ); ?>
859
+
860
+ </div>
861
+ <?php
862
+ if ( $pack->meta_value['recurring_pay'] == 'yes' ) {
863
+ ?>
864
+ <div class="wpuf-sub-body wpuf-nullamount-hide">
865
+ <div class="wpuf-sub-terms"><?php echo $trial_des; ?></div>
866
+ </div>
867
+ <?php
868
+ }
869
+ ?>
870
+ </div>
871
+ <div class="wpuf-sub-desciption">
872
+ <?php echo wpautop( wp_kses_post( $pack->post_content ) ); ?>
873
+ </div>
874
+ <?php
875
+
876
+ if ( isset( $_GET['action'] ) && $_GET['action'] == 'wpuf_pay' || $coupon_satus ) {
877
+ return;
878
+ }
879
+ if ( $coupon_satus === false && is_user_logged_in() ) {
880
+ ?>
881
+ <div class="wpuf-sub-button"><a <?php echo ( $current_pack_id != '' ) ? ' class = "wpuf-disabled-link" ' : '' ;?> href="<?php echo ( $current_pack_id != '' ) ? 'javascript:' : add_query_arg( array('action' => 'wpuf_pay', 'type' => 'pack', 'pack_id' => $pack->ID ), $details_meta['payment_page'] ); ?>" onclick="<?php echo esc_attr( $details_meta['onclick'] ); ?>"><?php echo $button_name; ?></a></div>
882
+ <?php
883
+ } else {
884
+ ?>
885
+ <div class="wpuf-sub-button"><a <?php echo ( $current_pack_id != '' ) ? ' class = "wpuf-disabled-link" ' : '' ;?> href="<?php echo ( $current_pack_id != '' ) ? 'javascript:' : add_query_arg( array( 'action' => 'register', 'type' => 'wpuf_sub', 'pack_id' => $pack->ID ), wp_registration_url() ); ?>" onclick="<?php echo esc_attr( $details_meta['onclick'] ); ?>"><?php echo $button_name; ?></a></div>
886
+ <?php
887
+ //wp_registration_url()
888
+ }
889
+
890
+ }
891
+
892
+ /**
893
+ * Show a info message when posting if payment is enabled
894
+ */
895
+ function add_post_info( $form_id, $form_settings ) {
896
+ if ( self::has_user_error( $form_settings ) ) {
897
+ ?>
898
+ <div class="wpuf-info">
899
+ <?php
900
+ $text = sprintf( __( 'This will cost you <strong>%s</strong> to add a new post. ', 'wpuf' ), wpuf_get_option( 'currency_symbol', 'wpuf_payment' ) . wpuf_get_option( 'cost_per_post', 'wpuf_payment' ) );
901
+
902
+ echo apply_filters( 'wpuf_ppp_notice', $text, $form_id, $form_settings );
903
+ ?>
904
+ </div>
905
+ <?php
906
+ }
907
+ }
908
+
909
+ public static function get_user_pack( $user_id, $status = true ) {
910
+ return get_user_meta( $user_id, '_wpuf_subscription_pack', $status );
911
+ }
912
+
913
+ function force_pack_notice( $text, $id, $form_settings ) {
914
+ $force_pack = wpuf_get_option( 'force_pack', 'wpuf_payment' );
915
+
916
+ if ( $force_pack == 'yes' && WPUF_Subscription::has_user_error($form_settings) ) {
917
+ $pack_page = get_permalink( wpuf_get_option( 'subscription_page', 'wpuf_payment' ) );
918
+
919
+ $text = sprintf( __( 'You must <a href="%s">purchase a pack</a> before posting', 'wpuf' ), $pack_page );
920
+ }
921
+
922
+ return apply_filters( 'wpuf_pack_notice', $text, $id, $form_settings );
923
+ }
924
+
925
+ function force_pack_permission( $perm, $id, $form_settings ) {
926
+
927
+ $force_pack = wpuf_get_option( 'force_pack', 'wpuf_payment' );
928
+
929
+ if ( is_user_logged_in() ) {
930
+
931
+ $is_user_postlock = get_user_meta( get_current_user_id(), 'wpuf_postlock', true );
932
+
933
+ if ( $is_user_postlock == 'yes' ) {
934
+ return 'no';
935
+ } else {
936
+
937
+ if ( $force_pack == 'yes' && WPUF_Subscription::has_user_error( $form_settings ) ) {
938
+ return 'no';
939
+ } else {
940
+ return 'yes';
941
+ }
942
+
943
+ }
944
+ }
945
+
946
+ return $perm;
947
+ }
948
+
949
+ /**
950
+ * Checks against the user, if he is valid for posting new post
951
+ *
952
+ * @global object $userdata
953
+ * @return bool
954
+ */
955
+ public static function has_user_error( $form_settings = null ) {
956
+ global $userdata;
957
+
958
+ $user_id = isset( $userdata->ID ) ? $userdata->ID : '';
959
+ // bail out if charging is not enabled
960
+ if ( wpuf_get_option( 'charge_posting', 'wpuf_payment' ) != 'yes' ) {
961
+ return false;
962
+ }
963
+
964
+ // check form if subscription is disabled
965
+ if ( isset( $form_settings['subscription_disabled'] ) && $form_settings['subscription_disabled'] == 'yes' ) {
966
+ return false;
967
+ }
968
+
969
+ $user_sub_meta = self::get_user_pack( $user_id );
970
+ $form_post_type = isset( $form_settings['post_type'] ) ? $form_settings['post_type'] : 'post';
971
+ $post_count = isset( $user_sub_meta['posts'][$form_post_type] ) ? $user_sub_meta['posts'][$form_post_type] : 0;
972
+
973
+ if ( isset( $user_sub_meta['recurring'] ) && $user_sub_meta['recurring'] == 'yes' ) {
974
+
975
+ // user has recurring subscription
976
+ if ( $post_count > 0 || $post_count == '-1' ) {
977
+ return false;
978
+ } else {
979
+ return true;
980
+ }
981
+
982
+ } else {
983
+ $expire = isset( $user_sub_meta['expire'] ) ? $user_sub_meta['expire'] : 0;
984
+
985
+ if ( strtolower( $expire ) == 'unlimited' || empty( $expire ) ) {
986
+ $expire_status = false;
987
+ } else if ( ( strtotime( date( 'Y-m-d', strtotime( $expire ) ) ) >= strtotime( date( 'Y-m-d', time() ) ) ) && ( $post_count > 0 || $post_count == '-1' ) ) {
988
+ $expire_status = false;
989
+ } else {
990
+ $expire_status = true;
991
+ }
992
+
993
+
994
+
995
+ if ( $post_count > 0 || $post_count == '-1' ) {
996
+ $post_count_status = false;
997
+ } else {
998
+ $post_count_status = true;
999
+ }
1000
+
1001
+ if ( $expire_status || $post_count_status ) {
1002
+ return true;
1003
+ }
1004
+ }
1005
+
1006
+ return false;
1007
+ }
1008
+
1009
+ /**
1010
+ * Determine if the user has used a free pack before
1011
+ *
1012
+ * @since 2.1.8
1013
+ *
1014
+ * @param int $user_id
1015
+ * @param int $pack_id
1016
+ * @return boolean
1017
+ */
1018
+ public static function has_used_free_pack( $user_id, $pack_id ) {
1019
+ $has_used = get_user_meta( $user_id, 'wpuf_fp_used', true );
1020
+
1021
+ if ( $has_used == '' ) {
1022
+ return false;
1023
+ }
1024
+
1025
+ if ( is_array( $has_used ) && isset( $has_used[$pack_id] ) ) {
1026
+ return true;
1027
+ }
1028
+
1029
+ return false;
1030
+ }
1031
+
1032
+ /**
1033
+ * Add a free used pack to the user account
1034
+ *
1035
+ * @since 2.1.8
1036
+ *
1037
+ * @param int $user_id
1038
+ * @param int $pack_id
1039
+ */
1040
+ public static function add_used_free_pack( $user_id, $pack_id ) {
1041
+ $has_used = get_user_meta( $user_id, 'wpuf_fp_used', true );
1042
+ $has_used = is_array( $has_used ) ? $has_used : array();
1043
+
1044
+ $has_used[$pack_id] = $pack_id;
1045
+ update_user_meta( $user_id, 'wpuf_fp_used', $has_used );
1046
+ }
1047
+
1048
+ function packdropdown( $packs, $selected = '' ) {
1049
+ $packs = isset( $packs ) ? $packs : array();
1050
+ foreach( $packs as $key => $pack ) {
1051
+ ?>
1052
+ <option value="<?php echo $pack->ID; ?>" <?php selected( $selected, $pack->ID ); ?>><?php echo $pack->post_title; ?></option>
1053
+ <?php
1054
+ }
1055
+ }
1056
+
1057
+
1058
+ /**
1059
+ * Reset the post count of a subscription of a user
1060
+ *
1061
+ * @since 2.3.11
1062
+ *
1063
+ * @param $post_id
1064
+ * @param $form_id
1065
+ * @param $form_settings
1066
+ * @param $form_vars
1067
+ */
1068
+ public function reset_user_subscription_data( $post_id, $form_id, $form_settings, $form_vars ) {
1069
+
1070
+ global $userdata;
1071
+
1072
+ //update_user_meta( 1, 'test_data', $user_wpuf_subscription_pack );
1073
+
1074
+ $sub_info = self::get_user_pack( $userdata->ID );
1075
+ $post_type = isset( $form_settings['post_type'] ) ? $form_settings['post_type'] : 'post';
1076
+ $count = isset( $sub_info['posts'][$post_type] ) ? intval( $sub_info['posts'][$post_type] ) : 0;
1077
+
1078
+
1079
+ // decrease the post count, if not umlimited
1080
+ $wpuf_post_status = get_post_meta( $post_id , 'wpuf_post_status' , true );
1081
+
1082
+ if ( $wpuf_post_status != 'published' && $wpuf_post_status != 'new_draft' ) {
1083
+
1084
+ if ( $count > 0 ) {
1085
+ $sub_info['posts'][$post_type] = $count - 1;
1086
+ $this->update_user_subscription_meta( $userdata->ID, $sub_info );
1087
+ }
1088
+
1089
+ update_post_meta( $post_id , 'wpuf_post_status' , 'new_draft' );
1090
+ }
1091
+
1092
+ }
1093
+
1094
+ }
class/upgrades.php ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Runs upgrade routines
5
+ */
6
+ class WPUF_Upgrades {
7
+
8
+ private $version;
9
+
10
+ function __construct( $version ) {
11
+ $this->version = $version;
12
+
13
+ $this->after_update_2_1_9();
14
+ }
15
+
16
+ function after_update_2_1_9() {
17
+
18
+ $version = get_option( 'wpuf_version', '2.1.9' );
19
+
20
+ if ( version_compare( $this->version, $version, '<=' ) ) {
21
+ return;
22
+ }
23
+
24
+ $this->update_form_field();
25
+ $this->update_subscription();
26
+ $this->update_registration();
27
+
28
+ update_option( 'wpuf_version', $this->version );
29
+ }
30
+
31
+ function update_registration() {
32
+
33
+ }
34
+
35
+ function update_form_field() {
36
+ $posts = get_posts( array(
37
+ 'post_type' => array( 'wpuf_forms', 'wpuf_profile' ),
38
+ 'numberposts' => '-1'
39
+ ) );
40
+
41
+ if ( $posts ) {
42
+ foreach ($posts as $key => $post) {
43
+ $posts_meta = get_post_meta( $post->ID, 'wpuf_form', true );
44
+ $posts_meta = is_array( $posts_meta ) ? $posts_meta : array();
45
+ foreach ($posts_meta as $key => $post_meta) {
46
+ $post_meta['wpuf_cond'] = array();
47
+
48
+ // if key empty then replace by its value
49
+ if ( array_key_exists('options', $post_meta ) ) {
50
+ foreach ($post_meta['options'] as $key => $value) {
51
+ $post_meta['options'][$value] = $value;
52
+ unset( $post_meta['options'][$key] );
53
+ }
54
+ }
55
+
56
+ WPUF_Admin_Form::insert_form_field( $post->ID, $post_meta, null, $key );
57
+ delete_post_meta( $post->ID, 'wpuf_form' );
58
+ }
59
+ }
60
+ }
61
+ }
62
+
63
+ function update_subscription() {
64
+ global $wpdb;
65
+
66
+ $table = $wpdb->prefix . 'wpuf_subscription';
67
+ $results = $wpdb->get_results( "SELECT name, description, count, duration, cost FROM $table" );
68
+
69
+ if ( !$results ) {
70
+ return;
71
+ }
72
+
73
+ $post_type = WPUF_Subscription::init()->get_all_post_type();
74
+
75
+ foreach ( $results as $key => $result ) {
76
+ $args = array(
77
+ 'post_title' => $result->name,
78
+ 'post_content' => $result->description,
79
+ 'post_status' => 'publish',
80
+ 'post_type' => 'wpuf_subscription'
81
+ );
82
+
83
+ $post_ID = wp_insert_post( $args );
84
+
85
+ if ( $post_ID ) {
86
+ foreach ( $post_type as $key => $name ) {
87
+ $post_type[$key] = $result->count;
88
+ }
89
+
90
+ $post = array(
91
+ 'cost' => $result->cost,
92
+ 'duration' => $result->duration,
93
+ 'recurring_pay' => 'no',
94
+ 'trial_period' => '',
95
+ 'post_type_name' => $post_type
96
+ );
97
+
98
+ WPUF_Subscription::init()->update_user_subscription_meta( $post_ID, $post );
99
+ }
100
+ }
101
+
102
+ $sql = "DROP TABLE IF_EXISTS $table";
103
+ $wpdb->query($sql);
104
+ }
105
+ }
class/upload.php ADDED
@@ -0,0 +1,203 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Attachment Uploader class
5
+ *
6
+ * @since 1.0
7
+ * @package wpuf
8
+ */
9
+ class WPUF_Upload {
10
+
11
+ function __construct() {
12
+
13
+ add_action( 'wp_ajax_wpuf_file_upload', array($this, 'upload_file') );
14
+ add_action( 'wp_ajax_nopriv_wpuf_file_upload', array($this, 'upload_file') );
15
+
16
+ add_action( 'wp_ajax_wpuf_file_del', array($this, 'delete_file') );
17
+ add_action( 'wp_ajax_nopriv_wpuf_file_del', array($this, 'delete_file') );
18
+
19
+ add_action( 'wp_ajax_wpuf_insert_image', array( $this, 'insert_image' ) );
20
+ add_action( 'wp_ajax_nopriv_wpuf_insert_image', array( $this, 'insert_image' ) );
21
+ }
22
+
23
+ /**
24
+ * Validate if it's coming from WordPress with a valid nonce
25
+ *
26
+ * @return void
27
+ */
28
+ function validate_nonce() {
29
+ $nonce = isset( $_GET['nonce'] ) ? $_GET['nonce'] : '';
30
+
31
+ if ( ! wp_verify_nonce( $nonce, 'wpuf-upload-nonce' ) ) {
32
+ die( 'error' );
33
+ }
34
+ }
35
+
36
+ function upload_file( $image_only = false ) {
37
+ $this->validate_nonce();
38
+
39
+ // a valid request will have a form ID
40
+ $form_id = isset( $_POST['form_id'] ) ? intval( $_POST['form_id'] ) : false;
41
+
42
+ if ( ! $form_id ) {
43
+ die( 'error' );
44
+ }
45
+
46
+ // check if guest post enabled for guests
47
+ if ( ! is_user_logged_in() ) {
48
+
49
+ $guest_post = false;
50
+ $form_settings = wpuf_get_form_settings( $form_id );
51
+
52
+ if ( isset( $form_settings['guest_post'] ) && $form_settings['guest_post'] == 'true' ) {
53
+ $guest_post = true;
54
+ }
55
+
56
+ //if it is registration form, let the user upload the file
57
+ if ( get_post_type( $form_id ) == 'wpuf_profile' ) {
58
+ $guest_post = true;
59
+ }
60
+
61
+
62
+ if ( ! $guest_post ) {
63
+ die( 'error' );
64
+ }
65
+ }
66
+
67
+ $upload = array(
68
+ 'name' => $_FILES['wpuf_file']['name'],
69
+ 'type' => $_FILES['wpuf_file']['type'],
70
+ 'tmp_name' => $_FILES['wpuf_file']['tmp_name'],
71
+ 'error' => $_FILES['wpuf_file']['error'],
72
+ 'size' => $_FILES['wpuf_file']['size']
73
+ );
74
+
75
+ header('Content-Type: text/html; charset=' . get_option('blog_charset'));
76
+
77
+ $attach = $this->handle_upload( $upload );
78
+
79
+ if ( $attach['success'] ) {
80
+
81
+ $response = array( 'success' => true );
82
+
83
+ if ($image_only) {
84
+ $image_size = wpuf_get_option( 'insert_photo_size', 'wpuf_general', 'thumbnail' );
85
+ $image_type = wpuf_get_option( 'insert_photo_type', 'wpuf_general', 'link' );
86
+
87
+ if ( $image_type == 'link' ) {
88
+ $response['html'] = wp_get_attachment_link( $attach['attach_id'], $image_size );
89
+ } else {
90
+ $response['html'] = wp_get_attachment_image( $attach['attach_id'], $image_size );
91
+ }
92
+
93
+ } else {
94
+ $response['html'] = $this->attach_html( $attach['attach_id'] );
95
+ }
96
+
97
+ echo $response['html'];
98
+ } else {
99
+ echo 'error';
100
+ }
101
+
102
+
103
+ // $response = array('success' => false, 'message' => $attach['error']);
104
+ // echo json_encode( $response );
105
+ exit;
106
+ }
107
+
108
+ /**
109
+ * Generic function to upload a file
110
+ *
111
+ * @param string $field_name file input field name
112
+ * @return bool|int attachment id on success, bool false instead
113
+ */
114
+ function handle_upload( $upload_data ) {
115
+
116
+ $uploaded_file = wp_handle_upload( $upload_data, array('test_form' => false) );
117
+
118
+ // If the wp_handle_upload call returned a local path for the image
119
+ if ( isset( $uploaded_file['file'] ) ) {
120
+ $file_loc = $uploaded_file['file'];
121
+ $file_name = basename( $upload_data['name'] );
122
+ $file_type = wp_check_filetype( $file_name );
123
+
124
+ $attachment = array(
125
+ 'post_mime_type' => $file_type['type'],
126
+ 'post_title' => preg_replace( '/\.[^.]+$/', '', basename( $file_name ) ),
127
+ 'post_content' => '',
128
+ 'post_status' => 'inherit'
129
+ );
130
+
131
+ $attach_id = wp_insert_attachment( $attachment, $file_loc );
132
+ $attach_data = wp_generate_attachment_metadata( $attach_id, $file_loc );
133
+ wp_update_attachment_metadata( $attach_id, $attach_data );
134
+
135
+ return array('success' => true, 'attach_id' => $attach_id);
136
+ }
137
+
138
+ return array('success' => false, 'error' => $uploaded_file['error']);
139
+ }
140
+
141
+ public static function attach_html( $attach_id, $type = NULL ) {
142
+ if ( !$type ) {
143
+ $type = isset( $_GET['type'] ) ? $_GET['type'] : 'image';
144
+ }
145
+
146
+ $attachment = get_post( $attach_id );
147
+
148
+ if ( ! $attachment ) {
149
+ return;
150
+ }
151
+
152
+ if (wp_attachment_is_image( $attach_id)) {
153
+ $image = wp_get_attachment_image_src( $attach_id, 'thumbnail' );
154
+ $image = $image[0];
155
+ } else {
156
+ $image = wp_mime_type_icon( $attach_id );
157
+ }
158
+
159
+ $html = '<li class="wpuf-image-wrap thumbnail">';
160
+ $html .= sprintf( '<div class="attachment-name"><img src="%s" alt="%s" /></div>', $image, esc_attr( $attachment->post_title ) );
161
+
162
+ if ( wpuf_get_option( 'image_caption', 'wpuf_general', 'off' ) == 'on' ) {
163
+ $html .= '<div class="wpuf-file-input-wrap">';
164
+ $html .= sprintf( '<input type="text" name="wpuf_files_data[%d][title]" value="%s" placeholder="%s">', $attach_id, esc_attr( $attachment->post_title ), __( 'Title', 'wpuf' ) );
165
+ $html .= sprintf( '<textarea name="wpuf_files_data[%d][caption]" placeholder="%s">%s</textarea>', $attach_id, __( 'Caption', 'wpuf' ), esc_textarea( $attachment->post_excerpt ) );
166
+ $html .= sprintf( '<textarea name="wpuf_files_data[%d][desc]" placeholder="%s">%s</textarea>', $attach_id, __( 'Description', 'wpuf' ), esc_textarea( $attachment->post_content ) );
167
+ $html .= '</div>';
168
+ }
169
+
170
+ $html .= sprintf( '<input type="hidden" name="wpuf_files[%s][]" value="%d">', $type, $attach_id );
171
+ $html .= sprintf( '<div class="caption"><a href="#" class="btn btn-danger btn-small attachment-delete" data-attach_id="%d">%s</a></div>', $attach_id, __( 'Delete', 'wpuf' ) );
172
+ $html .= '</li>';
173
+
174
+ return $html;
175
+ }
176
+
177
+ function delete_file() {
178
+ check_ajax_referer( 'wpuf_nonce', 'nonce' );
179
+
180
+ $attach_id = isset( $_POST['attach_id'] ) ? intval( $_POST['attach_id'] ) : 0;
181
+ $attachment = get_post( $attach_id );
182
+
183
+ //post author or editor role
184
+ if ( get_current_user_id() == $attachment->post_author || current_user_can( 'delete_private_pages' ) ) {
185
+ wp_delete_attachment( $attach_id, true );
186
+ echo 'success';
187
+ }
188
+
189
+ exit;
190
+ }
191
+
192
+ function associate_file( $attach_id, $post_id ) {
193
+ wp_update_post( array(
194
+ 'ID' => $attach_id,
195
+ 'post_parent' => $post_id
196
+ ) );
197
+ }
198
+
199
+ function insert_image() {
200
+ $this->upload_file( true );
201
+ }
202
+
203
+ }
includes/countries.php ADDED
@@ -0,0 +1,249 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $countries = array (
4
+ 'AF' => 'Afghanistan',
5
+ 'AX' => 'Aland Islands',
6
+ 'AL' => 'Albania',
7
+ 'DZ' => 'Algeria',
8
+ 'AS' => 'American Samoa',
9
+ 'AD' => 'Andorra',
10
+ 'AO' => 'Angola',
11
+ 'AI' => 'Anguilla',
12
+ 'AQ' => 'Antarctica',
13
+ 'AG' => 'Antigua And Barbuda',
14
+ 'AR' => 'Argentina',
15
+ 'AM' => 'Armenia',
16
+ 'AW' => 'Aruba',
17
+ 'AU' => 'Australia',
18
+ 'AT' => 'Austria',
19
+ 'AZ' => 'Azerbaijan',
20
+ 'BS' => 'Bahamas',
21
+ 'BH' => 'Bahrain',
22
+ 'BD' => 'Bangladesh',
23
+ 'BB' => 'Barbados',
24
+ 'BY' => 'Belarus',
25
+ 'BE' => 'Belgium',
26
+ 'BZ' => 'Belize',
27
+ 'BJ' => 'Benin',
28
+ 'BM' => 'Bermuda',
29
+ 'BT' => 'Bhutan',
30
+ 'BO' => 'Bolivia',
31
+ 'BA' => 'Bosnia And Herzegovina',
32
+ 'BW' => 'Botswana',
33
+ 'BV' => 'Bouvet Island',
34
+ 'BR' => 'Brazil',
35
+ 'IO' => 'British Indian Ocean Territory',
36
+ 'BN' => 'Brunei Darussalam',
37
+ 'BG' => 'Bulgaria',
38
+ 'BF' => 'Burkina Faso',
39
+ 'BI' => 'Burundi',
40
+ 'KH' => 'Cambodia',
41
+ 'CM' => 'Cameroon',
42
+ 'CA' => 'Canada',
43
+ 'CV' => 'Cape Verde',
44
+ 'KY' => 'Cayman Islands',
45
+ 'CF' => 'Central African Republic',
46
+ 'TD' => 'Chad',
47
+ 'CL' => 'Chile',
48
+ 'CN' => 'China',
49
+ 'CX' => 'Christmas Island',
50
+ 'CC' => 'Cocos (Keeling) Islands',
51
+ 'CO' => 'Colombia',
52
+ 'KM' => 'Comoros',
53
+ 'CG' => 'Congo',
54
+ 'CD' => 'Congo, Democratic Republic',
55
+ 'CK' => 'Cook Islands',
56
+ 'CR' => 'Costa Rica',
57
+ 'CI' => 'Cote D\'Ivoire',
58
+ 'HR' => 'Croatia',
59
+ 'CU' => 'Cuba',
60
+ 'CY' => 'Cyprus',
61
+ 'CZ' => 'Czech Republic',
62
+ 'DK' => 'Denmark',
63
+ 'DJ' => 'Djibouti',
64
+ 'DM' => 'Dominica',
65
+ 'DO' => 'Dominican Republic',
66
+ 'EC' => 'Ecuador',
67
+ 'EG' => 'Egypt',
68
+ 'SV' => 'El Salvador',
69
+ 'GQ' => 'Equatorial Guinea',
70
+ 'ER' => 'Eritrea',
71
+ 'EE' => 'Estonia',
72
+ 'ET' => 'Ethiopia',
73
+ 'FK' => 'Falkland Islands (Malvinas)',
74
+ 'FO' => 'Faroe Islands',
75
+ 'FJ' => 'Fiji',
76
+ 'FI' => 'Finland',
77
+ 'FR' => 'France',
78
+ 'GF' => 'French Guiana',
79
+ 'PF' => 'French Polynesia',
80
+ 'TF' => 'French Southern Territories',
81
+ 'GA' => 'Gabon',
82
+ 'GM' => 'Gambia',
83
+ 'GE' => 'Georgia',
84
+ 'DE' => 'Germany',
85
+ 'GH' => 'Ghana',
86
+ 'GI' => 'Gibraltar',
87
+ 'GR' => 'Greece',
88
+ 'GL' => 'Greenland',
89
+ 'GD' => 'Grenada',
90
+ 'GP' => 'Guadeloupe',
91
+ 'GU' => 'Guam',
92
+ 'GT' => 'Guatemala',
93
+ 'GG' => 'Guernsey',
94
+ 'GN' => 'Guinea',
95
+ 'GW' => 'Guinea-Bissau',
96
+ 'GY' => 'Guyana',
97
+ 'HT' => 'Haiti',
98
+ 'HM' => 'Heard Island & Mcdonald Islands',
99
+ 'VA' => 'Holy See (Vatican City State)',
100
+ 'HN' => 'Honduras',
101
+ 'HK' => 'Hong Kong',
102
+ 'HU' => 'Hungary',
103
+ 'IS' => 'Iceland',
104
+ 'IN' => 'India',
105
+ 'ID' => 'Indonesia',
106
+ 'IR' => 'Iran, Islamic Republic Of',
107
+ 'IQ' => 'Iraq',
108
+ 'IE' => 'Ireland',
109
+ 'IM' => 'Isle Of Man',
110
+ 'IL' => 'Israel',
111
+ 'IT' => 'Italy',
112
+ 'JM' => 'Jamaica',
113
+ 'JP' => 'Japan',
114
+ 'JE' => 'Jersey',
115
+ 'JO' => 'Jordan',
116
+ 'KZ' => 'Kazakhstan',
117
+ 'KE' => 'Kenya',
118
+ 'KI' => 'Kiribati',
119
+ 'KR' => 'Korea',
120
+ 'KW' => 'Kuwait',
121
+ 'KG' => 'Kyrgyzstan',
122
+ 'LA' => 'Lao People\'s Democratic Republic',
123
+ 'LV' => 'Latvia',
124
+ 'LB' => 'Lebanon',
125
+ 'LS' => 'Lesotho',
126
+ 'LR' => 'Liberia',
127
+ 'LY' => 'Libyan Arab Jamahiriya',
128
+ 'LI' => 'Liechtenstein',
129
+ 'LT' => 'Lithuania',
130
+ 'LU' => 'Luxembourg',
131
+ 'MO' => 'Macao',
132
+ 'MK' => 'Macedonia',
133
+ 'MG' => 'Madagascar',
134
+ 'MW' => 'Malawi',
135
+ 'MY' => 'Malaysia',
136
+ 'MV' => 'Maldives',
137
+ 'ML' => 'Mali',
138
+ 'MT' => 'Malta',
139
+ 'MH' => 'Marshall Islands',
140
+ 'MQ' => 'Martinique',
141
+ 'MR' => 'Mauritania',
142
+ 'MU' => 'Mauritius',
143
+ 'YT' => 'Mayotte',
144
+ 'MX' => 'Mexico',
145
+ 'FM' => 'Micronesia, Federated States Of',
146
+ 'MD' => 'Moldova',
147
+ 'MC' => 'Monaco',
148
+ 'MN' => 'Mongolia',
149
+ 'ME' => 'Montenegro',
150
+ 'MS' => 'Montserrat',
151
+ 'MA' => 'Morocco',
152
+ 'MZ' => 'Mozambique',
153
+ 'MM' => 'Myanmar',
154
+ 'NA' => 'Namibia',
155
+ 'NR' => 'Nauru',
156
+ 'NP' => 'Nepal',
157
+ 'NL' => 'Netherlands',
158
+ 'AN' => 'Netherlands Antilles',
159
+ 'NC' => 'New Caledonia',
160
+ 'NZ' => 'New Zealand',
161
+ 'NI' => 'Nicaragua',
162
+ 'NE' => 'Niger',
163
+ 'NG' => 'Nigeria',
164
+ 'NU' => 'Niue',
165
+ 'NF' => 'Norfolk Island',
166
+ 'MP' => 'Northern Mariana Islands',
167
+ 'NO' => 'Norway',
168
+ 'OM' => 'Oman',
169
+ 'PK' => 'Pakistan',
170
+ 'PW' => 'Palau',
171
+ 'PS' => 'Palestinian Territory, Occupied',
172
+ 'PA' => 'Panama',
173
+ 'PG' => 'Papua New Guinea',
174
+ 'PY' => 'Paraguay',
175
+ 'PE' => 'Peru',
176
+ 'PH' => 'Philippines',
177
+ 'PN' => 'Pitcairn',
178
+ 'PL' => 'Poland',
179
+ 'PT' => 'Portugal',
180
+ 'PR' => 'Puerto Rico',
181
+ 'QA' => 'Qatar',
182
+ 'RE' => 'Reunion',
183
+ 'RO' => 'Romania',
184
+ 'RU' => 'Russian Federation',
185
+ 'RW' => 'Rwanda',
186
+ 'BL' => 'Saint Barthelemy',
187
+ 'SH' => 'Saint Helena',
188
+ 'KN' => 'Saint Kitts And Nevis',
189
+ 'LC' => 'Saint Lucia',
190
+ 'MF' => 'Saint Martin',
191
+ 'PM' => 'Saint Pierre And Miquelon',
192
+ 'VC' => 'Saint Vincent And Grenadines',
193
+ 'WS' => 'Samoa',
194
+ 'SM' => 'San Marino',
195
+ 'ST' => 'Sao Tome And Principe',
196
+ 'SA' => 'Saudi Arabia',
197
+ 'SN' => 'Senegal',
198
+ 'RS' => 'Serbia',
199
+ 'SC' => 'Seychelles',
200
+ 'SL' => 'Sierra Leone',
201
+ 'SG' => 'Singapore',
202
+ 'SK' => 'Slovakia',
203
+ 'SI' => 'Slovenia',
204
+ 'SB' => 'Solomon Islands',
205
+ 'SO' => 'Somalia',
206
+ 'ZA' => 'South Africa',
207
+ 'GS' => 'South Georgia And Sandwich Isl.',
208
+ 'ES' => 'Spain',
209
+ 'LK' => 'Sri Lanka',
210
+ 'SD' => 'Sudan',
211
+ 'SR' => 'Suriname',
212
+ 'SJ' => 'Svalbard And Jan Mayen',
213
+ 'SZ' => 'Swaziland',
214
+ 'SE' => 'Sweden',
215
+ 'CH' => 'Switzerland',
216
+ 'SY' => 'Syrian Arab Republic',
217
+ 'TW' => 'Taiwan',
218
+ 'TJ' => 'Tajikistan',
219
+ 'TZ' => 'Tanzania',
220
+ 'TH' => 'Thailand',
221
+ 'TL' => 'Timor-Leste',
222
+ 'TG' => 'Togo',
223
+ 'TK' => 'Tokelau',
224
+ 'TO' => 'Tonga',
225
+ 'TT' => 'Trinidad And Tobago',
226
+ 'TN' => 'Tunisia',
227
+ 'TR' => 'Turkey',
228
+ 'TM' => 'Turkmenistan',
229
+ 'TC' => 'Turks And Caicos Islands',
230
+ 'TV' => 'Tuvalu',
231
+ 'UG' => 'Uganda',
232
+ 'UA' => 'Ukraine',
233
+ 'AE' => 'United Arab Emirates',
234
+ 'GB' => 'United Kingdom',
235
+ 'US' => 'United States',
236
+ 'UM' => 'United States Outlying Islands',
237
+ 'UY' => 'Uruguay',
238
+ 'UZ' => 'Uzbekistan',
239
+ 'VU' => 'Vanuatu',
240
+ 'VE' => 'Venezuela',
241
+ 'VN' => 'Viet Nam',
242
+ 'VG' => 'Virgin Islands, British',
243
+ 'VI' => 'Virgin Islands, U.S.',
244
+ 'WF' => 'Wallis And Futuna',
245
+ 'EH' => 'Western Sahara',
246
+ 'YE' => 'Yemen',
247
+ 'ZM' => 'Zambia',
248
+ 'ZW' => 'Zimbabwe',
249
+ );
includes/free/edit-profile.php ADDED
@@ -0,0 +1,318 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class WPUF_Edit_Profile {
4
+
5
+ function __construct() {
6
+ add_shortcode( 'wpuf_editprofile', array($this, 'shortcode') );
7
+
8
+ add_action( 'personal_options_update', array($this, 'post_lock_update') );
9
+ add_action( 'edit_user_profile_update', array($this, 'post_lock_update') );
10
+
11
+ add_action( 'show_user_profile', array($this, 'post_lock_form') );
12
+ add_action( 'edit_user_profile', array($this, 'post_lock_form') );
13
+ }
14
+
15
+ /**
16
+ * Hanldes the editprofile shortcode
17
+ *
18
+ * @author Tareq Hasan
19
+ */
20
+ function shortcode() {
21
+
22
+ ob_start();
23
+
24
+ if ( is_user_logged_in() ) {
25
+ $this->show_form();
26
+ } else {
27
+ printf( __( "This page is restricted. Please %s to view this page.", 'wpuf' ), wp_loginout( '', false ) );
28
+ }
29
+
30
+ $content = ob_get_contents();
31
+ ob_end_clean();
32
+
33
+ return $content;
34
+ }
35
+
36
+ /**
37
+ * Shows the user profile form
38
+ *
39
+ * @global type $userdata
40
+ * @param type $user_id
41
+ */
42
+ function show_form( $user_id = null ) {
43
+ global $userdata, $wp_http_referer;
44
+ wp_get_current_user();
45
+
46
+ if ( !(function_exists( 'get_user_to_edit' )) ) {
47
+ require_once(ABSPATH . '/wp-admin/includes/user.php');
48
+ }
49
+
50
+ if ( !(function_exists( '_wp_get_user_contactmethods' )) ) {
51
+ require_once(ABSPATH . '/wp-includes/registration.php');
52
+ }
53
+
54
+ if ( !$user_id ) {
55
+ $current_user = wp_get_current_user();
56
+ $user_id = $user_ID = $current_user->ID;
57
+ }
58
+
59
+ if ( isset( $_POST['submit'] ) ) {
60
+ check_admin_referer( 'update-profile_' . $user_id );
61
+ $errors = edit_user( $user_id );
62
+ if ( is_wp_error( $errors ) ) {
63
+ $message = $errors->get_error_message();
64
+ $style = 'error';
65
+ } else {
66
+ $message = __( '<strong>Success</strong>: Profile updated', 'wpuf' );
67
+ $style = 'success';
68
+ do_action( 'personal_options_update', $user_id );
69
+ }
70
+ }
71
+
72
+ $profileuser = get_user_to_edit( $user_id );
73
+
74
+ if ( isset( $message ) ) {
75
+ echo '<div class="' . $style . '">' . $message . '</div>';
76
+ }
77
+ ?>
78
+ <div class="wpuf-profile">
79
+ <form name="profile" id="your-profile" action="" method="post">
80
+ <?php wp_nonce_field( 'update-profile_' . $user_id ) ?>
81
+ <?php if ( $wp_http_referer ) : ?>
82
+ <input type="hidden" name="wp_http_referer" value="<?php echo esc_url( $wp_http_referer ); ?>" />
83
+ <?php endif; ?>
84
+ <input type="hidden" name="from" value="profile" />
85
+ <input type="hidden" name="checkuser_id" value="<?php echo $user_id; ?>" />
86
+ <table class="wpuf-table">
87
+ <?php do_action( 'personal_options', $profileuser ); ?>
88
+ </table>
89
+ <?php do_action( 'profile_personal_options', $profileuser ); ?>
90
+
91
+ <fieldset>
92
+ <legend><?php _e( 'Name' ) ?></legend>
93
+
94
+ <table class="wpuf-table">
95
+ <tr>
96
+ <th><label for="user_login1"><?php _e( 'Username' ); ?></label></th>
97
+ <td><input type="text" name="user_login" id="user_login1" value="<?php echo esc_attr( $profileuser->user_login ); ?>" disabled="disabled" class="regular-text" /><br /><em><span class="description"><?php _e( 'Usernames cannot be changed.' ); ?></span></em></td>
98
+ </tr>
99
+ <tr>
100
+ <th><label for="first_name"><?php _e( 'First Name' ) ?></label></th>
101
+ <td><input type="text" name="first_name" id="first_name" value="<?php echo esc_attr( $profileuser->first_name ) ?>" class="regular-text" /></td>
102
+ </tr>
103
+
104
+ <tr>
105
+ <th><label for="last_name"><?php _e( 'Last Name' ) ?></label></th>
106
+ <td><input type="text" name="last_name" id="last_name" value="<?php echo esc_attr( $profileuser->last_name ) ?>" class="regular-text" /></td>
107
+ </tr>
108
+
109
+ <tr>
110
+ <th><label for="nickname"><?php _e( 'Nickname' ); ?> <span class="description"><?php _e( '(required)' ); ?></span></label></th>
111
+ <td><input type="text" name="nickname" id="nickname" value="<?php echo esc_attr( $profileuser->nickname ) ?>" class="regular-text" /></td>
112
+ </tr>
113
+
114
+ <tr>
115
+ <th><label for="display_name"><?php _e( 'Display to Public as' ) ?></label></th>
116
+ <td>
117
+ <select name="display_name" id="display_name">
118
+ <?php
119
+ $public_display = array();
120
+ $public_display['display_username'] = $profileuser->user_login;
121
+ $public_display['display_nickname'] = $profileuser->nickname;
122
+ if ( !empty( $profileuser->first_name ) )
123
+ $public_display['display_firstname'] = $profileuser->first_name;
124
+ if ( !empty( $profileuser->last_name ) )
125
+ $public_display['display_lastname'] = $profileuser->last_name;
126
+ if ( !empty( $profileuser->first_name ) && !empty( $profileuser->last_name ) ) {
127
+ $public_display['display_firstlast'] = $profileuser->first_name . ' ' . $profileuser->last_name;
128
+ $public_display['display_lastfirst'] = $profileuser->last_name . ' ' . $profileuser->first_name;
129
+ }
130
+ if ( !in_array( $profileuser->display_name, $public_display ) ) // Only add this if it isn't duplicated elsewhere
131
+ $public_display = array('display_displayname' => $profileuser->display_name) + $public_display;
132
+ $public_display = array_map( 'trim', $public_display );
133
+ $public_display = array_unique( $public_display );
134
+ foreach ($public_display as $id => $item) {
135
+ ?>
136
+ <option id="<?php echo $id; ?>" value="<?php echo esc_attr( $item ); ?>"<?php selected( $profileuser->display_name, $item ); ?>><?php echo $item; ?></option>
137
+ <?php
138
+ }
139
+ ?>
140
+ </select>
141
+ </td>
142
+ </tr>
143
+ </table>
144
+ </fieldset>
145
+
146
+ <fieldset>
147
+ <legend><?php _e( 'Contact Info' ) ?></legend>
148
+
149
+ <table class="wpuf-table">
150
+ <tr>
151
+ <th><label for="email"><?php _e( 'E-mail' ); ?> <span class="description"><?php _e( '(required)' ); ?></span></label></th>
152
+ <td><input type="text" name="email" id="email" value="<?php echo esc_attr( $profileuser->user_email ) ?>" class="regular-text" /> </td>
153
+ </tr>
154
+
155
+ <tr>
156
+ <th><label for="url"><?php _e( 'Website' ) ?></label></th>
157
+ <td><input type="text" name="url" id="url" value="<?php echo esc_attr( $profileuser->user_url ) ?>" class="regular-text code" /></td>
158
+ </tr>
159
+
160
+ <?php
161
+ foreach (_wp_get_user_contactmethods() as $name => $desc) {
162
+ ?>
163
+ <tr>
164
+ <th><label for="<?php echo $name; ?>"><?php echo apply_filters( 'user_' . $name . '_label', $desc ); ?></label></th>
165
+ <td><input type="text" name="<?php echo $name; ?>" id="<?php echo $name; ?>" value="<?php echo esc_attr( $profileuser->$name ) ?>" class="regular-text" /></td>
166
+ </tr>
167
+ <?php
168
+ }
169
+ ?>
170
+ </table>
171
+ </fieldset>
172
+
173
+ <fieldset>
174
+ <legend><?php _e( 'About Yourself' ); ?></legend>
175
+
176
+ <table class="wpuf-table">
177
+ <tr>
178
+ <th><label for="description"><?php _e( 'Biographical Info', 'wpuf' ); ?></label></th>
179
+ <td><textarea name="description" id="description" rows="5" cols="30"><?php echo esc_html( $profileuser->description ); ?></textarea><br />
180
+ <span class="description"><?php _e( 'Share a little biographical information to fill out your profile. This may be shown publicly.' ); ?></span></td>
181
+ </tr>
182
+ <tr id="password">
183
+ <th><label for="pass1"><?php _e( 'New Password', 'wpuf' ); ?></label></th>
184
+ <td>
185
+ <input type="password" name="pass1" id="pass1" size="16" value="" autocomplete="off" /><br /><br />
186
+ </td>
187
+ </tr>
188
+ <tr>
189
+ <th><label><?php _e( 'Confirm Password', 'wpuf' ); ?></label></th>
190
+ <td>
191
+ <input type="password" name="pass2" id="pass2" size="16" value="" autocomplete="off" />&nbsp;<em><span class="description"><?php _e( "Type your new password again." ); ?></span></em>
192
+ </td>
193
+ </tr>
194
+ <tr>
195
+
196
+ <th><label><?php _e( 'Password Strength', 'wpuf' ); ?></label></th>
197
+ <td>
198
+ <div id="pass-strength-result"><?php _e( 'Strength indicator' ); ?></div>
199
+ <script src="<?php echo site_url(); ?>/wp-includes/js/zxcvbn.min.js"></script>
200
+ <script src="<?php echo admin_url(); ?>/js/password-strength-meter.js"></script>
201
+ <script type="text/javascript">
202
+ var pwsL10n = {
203
+ empty: "Strength indicator",
204
+ short: "Very weak",
205
+ bad: "Weak",
206
+ good: "Medium",
207
+ strong: "Strong",
208
+ mismatch: "Mismatch"
209
+ };
210
+ try{convertEntities(pwsL10n);}catch(e){};
211
+ </script>
212
+ </td>
213
+ </tr>
214
+ </table>
215
+ </fieldset>
216
+
217
+ <?php do_action( 'show_user_profile', $profileuser ); ?>
218
+
219
+ <p class="submit">
220
+ <input type="hidden" name="action" value="update" />
221
+ <input type="hidden" name="user_id" id="user_id" value="<?php echo esc_attr( $user_id ); ?>" />
222
+ <input type="submit" class="wpuf-submit" value="<?php _e( 'Update Profile', 'wpuf' ); ?>" name="submit" />
223
+ </p>
224
+ </form>
225
+ </div>
226
+ <?php
227
+ }
228
+
229
+ /**
230
+ * Adds the postlock form in users profile
231
+ *
232
+ * @param object $profileuser
233
+ */
234
+ function post_lock_form( $profileuser ) {
235
+ global $wpuf_subscription;
236
+
237
+ if ( is_admin() && current_user_can( 'edit_users' ) ) {
238
+ $select = ( $profileuser->wpuf_postlock == 'yes' ) ? 'yes' : 'no';
239
+ ?>
240
+
241
+ <h3><?php _e( 'WPUF Post Lock', 'wpuf' ); ?></h3>
242
+ <table class="form-table">
243
+ <tr>
244
+ <th><label for="post-lock"><?php _e( 'Lock Post:', 'wpuf' ); ?> </label></th>
245
+ <td>
246
+ <select name="wpuf_postlock" id="post-lock">
247
+ <option value="no"<?php selected( $select, 'no' ); ?>>No</option>
248
+ <option value="yes"<?php selected( $select, 'yes' ); ?>>Yes</option>
249
+ </select>
250
+ <span class="description"><?php _e( 'Lock user from creating new post.', 'wpuf' ); ?></span></em>
251
+ </td>
252
+ </tr>
253
+
254
+ <tr>
255
+ <th><label for="post-lock"><?php _e( 'Lock Reason:', 'wpuf' ); ?> </label></th>
256
+ <td>
257
+ <input type="text" name="wpuf_lock_cause" id="wpuf_lock_cause" class="regular-text" value="<?php echo esc_attr( $profileuser->wpuf_lock_cause ); ?>" />
258
+ </td>
259
+ </tr>
260
+ </table>
261
+
262
+ <?php
263
+ if ( wpuf_get_option( 'charge_posting', 'wpuf_payment', 'no' ) == 'yes' ) {
264
+ $validity = (isset( $profileuser->wpuf_sub_validity )) ? $profileuser->wpuf_sub_validity : date( 'Y-m-d G:i:s', time() );
265
+ $count = ( isset( $profileuser->wpuf_sub_pcount ) ) ? $profileuser->wpuf_sub_pcount : 0;
266
+
267
+ if ( isset( $profileuser->wpuf_sub_pack ) ) {
268
+ $pack = $wpuf_subscription->get_subscription( $profileuser->wpuf_sub_pack );
269
+ $pack = $pack->name;
270
+ } else {
271
+ $pack = 'Free';
272
+ }
273
+ ?>
274
+
275
+ <h3><?php _e( 'WPUF Subscription', 'wpuf' ); ?></h3>
276
+
277
+ <table class="form-table">
278
+ <tr>
279
+ <th><label for="post-lock"><?php _e( 'Pack:', 'wpuf' ); ?> </label></th>
280
+ <td>
281
+ <input type="text" disabled="disabled" name="wpuf_sub_pack" id="wpuf_sub_pack" class="regular-text" value="<?php echo $pack; ?>" />
282
+ </td>
283
+ </tr>
284
+ <tr>
285
+ <th><label for="post-lock"><?php _e( 'Post Count:', 'wpuf' ); ?> </label></th>
286
+ <td>
287
+ <input type="text" name="wpuf_sub_pcount" id="wpuf_sub_pcount" class="regular-text" value="<?php echo $count; ?>" />
288
+ </td>
289
+ </tr>
290
+ <tr>
291
+ <th><label for="post-lock"><?php _e( 'Validity:', 'wpuf' ); ?> </label></th>
292
+ <td>
293
+ <input type="text" name="wpuf_sub_validity" id="wpuf_sub_validity" class="regular-text" value="<?php echo $validity; ?>" />
294
+ </td>
295
+ </tr>
296
+ </table>
297
+
298
+ <?php } ?>
299
+
300
+ <?php
301
+ }
302
+ }
303
+
304
+ /**
305
+ * Update user profile lock
306
+ *
307
+ * @param int $user_id
308
+ */
309
+ function post_lock_update( $user_id ) {
310
+ if ( is_admin() && current_user_can( 'edit_users' ) ) {
311
+ update_user_meta( $user_id, 'wpuf_postlock', $_POST['wpuf_postlock'] );
312
+ update_user_meta( $user_id, 'wpuf_lock_cause', $_POST['wpuf_lock_cause'] );
313
+ update_user_meta( $user_id, 'wpuf_sub_validity', $_POST['wpuf_sub_validity'] );
314
+ update_user_meta( $user_id, 'wpuf_sub_pcount', $_POST['wpuf_sub_pcount'] );
315
+ }
316
+ }
317
+
318
+ }
includes/free/edit-user.php ADDED
@@ -0,0 +1,251 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ require_once(ABSPATH . '/wp-admin/includes/user.php');
3
+
4
+ function wpuf_edit_users() {
5
+
6
+ ob_start();
7
+ //if user is logged in
8
+ if ( is_user_logged_in() ) {
9
+
10
+ //this user can edit the users
11
+ if ( current_user_can( 'edit_users' ) ) {
12
+
13
+ $action = isset( $_GET['action'] ) ? $_GET['action'] : 'show';
14
+ $user_id = isset( $_GET['user_id'] ) ? intval( $_GET['user_id'] ) : 0;
15
+ $userdata = get_userdata( $user_id );
16
+
17
+ switch ($action) {
18
+ case 'edit':
19
+ //if user exists
20
+ if ( $user_id && $userdata ) {
21
+ WPUF_Edit_Profile::show_form( $user_id );
22
+ } else {
23
+ printf( __( "User doesn't exists", 'wpuf' ) );
24
+ }
25
+ break;
26
+
27
+ case 'wpuf_add_user':
28
+ wpuf_add_user();
29
+ break;
30
+
31
+ default: wpuf_show_users();
32
+ }
33
+ } else { // user don't have any permission
34
+ printf( __( "You don't have permission for this purpose", 'wpuf' ) );
35
+ }
36
+ } else { //user is not logged in
37
+ printf( __( "This page is restricted. Please %s to view this page.", 'wpuf' ), wp_loginout( '', false ) );
38
+ }
39
+
40
+ return ob_get_clean();
41
+ }
42
+
43
+ add_shortcode( 'wpuf-edit-users', 'wpuf_edit_users' );
44
+
45
+ function wpuf_show_users() {
46
+ global $wpdb, $userdata;
47
+
48
+ //delete user
49
+ if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == "del" ) {
50
+
51
+ $nonce = $_REQUEST['_wpnonce'];
52
+ if ( !wp_verify_nonce( $nonce, 'wpuf_del_user' ) ) {
53
+ wp_die( 'Cheting?' );
54
+ }
55
+
56
+ $delete_flag = false;
57
+
58
+ //get users info
59
+ $cur_user = $userdata->ID;
60
+ $to_be_deleted = ( isset( $_GET['user_id'] ) ) ? intval( $_GET['user_id'] ) : 0;
61
+
62
+ //user can't delete himself and not the admin, whose id is 1
63
+ if ( $cur_user != $to_be_deleted && $to_be_deleted != 1 ) {
64
+
65
+ //check that user exists
66
+ $get_user = get_userdata( $to_be_deleted );
67
+ if ( $get_user ) {
68
+ $delete_flag = true;
69
+ }
70
+ }
71
+
72
+ //var_dump($to_be_deleted);
73
+ //delete the user
74
+ if ( current_user_can( 'delete_users' ) && $delete_flag == true ) {
75
+ //var_dump($userdata);
76
+ wp_delete_user( $to_be_deleted );
77
+ echo '<div class="success">' . __( 'User Deleted', 'wpuf' ) . '</div>';
78
+ } else {
79
+ echo '<div class="error">Cheatin&#8217; uh?</div>';
80
+ }
81
+ }
82
+
83
+ $sql = "SELECT ID, display_name FROM $wpdb->users ORDER BY user_registered ASC";
84
+ $users = $wpdb->get_results( $sql );
85
+ ?>
86
+
87
+ <a class="wpuf-button" href="<?php the_permalink(); ?>?action=wpuf_add_user">Add New User</a>
88
+
89
+ <?php if ( $users ) : ?>
90
+ <table class="wpuf-table" cellpadding="0" cellspacing="0">
91
+ <tr>
92
+ <th><?php _e( 'Username', 'wpuf' ); ?></th>
93
+ <th><?php _e( 'Action', 'wpuf' ); ?></th>
94
+ </tr>
95
+ <?php foreach ($users as $user): ?>
96
+ <tr>
97
+ <td><a href="<?php echo get_author_posts_url( $user->ID ); ?>"><?php printf( esc_attr__( '%s', 'wpuf' ), $user->display_name ); ?></td>
98
+ <td>
99
+ <a href="<?php echo wp_nonce_url(get_permalink() . '?action=edit&user_id='. $user->ID, 'wpuf_edit_user'); ?>"><?php _e( 'Edit', 'wpuf' ); ?></a>
100
+ <a href="<?php echo wp_nonce_url( the_permalink( 'echo=false' ) . "?action=del&user_id=" . $user->ID, 'wpuf_del_user' ) ?>" onclick="return confirm('Are you sure to delete this user?');"><span style="color: red;"><?php _e( 'Delete', 'wpuf' ); ?></span></a>
101
+ </td>
102
+ </tr>
103
+
104
+ <?php endforeach; ?>
105
+ </table>
106
+
107
+ <?php endif; ?>
108
+
109
+ <?php
110
+ }
111
+
112
+ function wpuf_add_user() {
113
+ global $wp_error;
114
+ //get admin template file. wp_dropdown_role is there :(
115
+ require_once(ABSPATH . '/wp-admin/includes/template.php');
116
+ ?>
117
+ <?php if ( current_user_can( 'create_users' ) ) : ?>
118
+
119
+ <h3><?php _e( 'Add New User', 'wpuf' ); ?></h3>
120
+
121
+ <?php
122
+ if ( isset( $_POST['wpuf_new_user_submit'] ) ) {
123
+ $errors = array();
124
+
125
+ $username = sanitize_user( $_POST['user_login'] );
126
+ $email = trim( $_POST['user_email'] );
127
+ $role = $_POST['role'];
128
+
129
+ $error = null;
130
+ $error = wpuf_register_new_user( $username, $email, $role );
131
+ if ( !is_wp_error( $error ) ) {
132
+ echo '<div class="success">' . __( 'User Added', 'wpuf' ) . '</div>';
133
+ } else {
134
+ echo '<div class="error">' . $error->get_error_message() . '</div>';
135
+ }
136
+ }
137
+ ?>
138
+
139
+ <form action="" method="post">
140
+
141
+ <ul class="wpuf-post-form">
142
+ <li>
143
+ <label for="user_login">
144
+ <?php _e( 'Username', 'wpuf' ); ?> <span class="required">*</span>
145
+ </label>
146
+ <input type="text" name="user_login" id="user_login" minlength="2" value="<?php if ( isset( $_POST['user_login'] ) ) echo wpuf_clean_tags( $_POST['user_login'] ); ?>">
147
+ <div class="clear"></div>
148
+ </li>
149
+
150
+ <li>
151
+ <label for="user_email">
152
+ <?php _e( 'Email', 'wpuf' ); ?> <span class="required">*</span>
153
+ </label>
154
+ <input type="text" name="user_email" id="user_email" minlength="2" value="<?php if ( isset( $_POST['user_email'] ) ) echo wpuf_clean_tags( $_POST['user_email'] ); ?>">
155
+ <div class="clear"></div>
156
+ </li>
157
+
158
+ <li>
159
+ <label for="role">
160
+ <?php _e( 'Role', 'wpuf' ); ?>
161
+ </label>
162
+
163
+ <select name="role" id="role">
164
+ <?php
165
+ if ( !$new_user_role ) {
166
+ $new_user_role = !empty( $current_role ) ? $current_role : get_option( 'default_role' );
167
+ }
168
+ wp_dropdown_roles( $new_user_role );
169
+ ?>
170
+ </select>
171
+
172
+ <div class="clear"></div>
173
+ </li>
174
+
175
+ <li>
176
+ <label>&nbsp;</label>
177
+ <input class="wpuf_submit" type="submit" name="wpuf_new_user_submit" value="<?php echo esc_attr( __( 'Add New User', 'wpuf' ) ); ?>">
178
+ </li>
179
+
180
+ </ul>
181
+
182
+ </form>
183
+
184
+ <?php endif; ?>
185
+
186
+ <?php
187
+ }
188
+
189
+ /**
190
+ * Handles registering a new user.
191
+ *
192
+ * @param string $user_login User's username for logging in
193
+ * @param string $user_email User's email address to send password and add
194
+ * @return int|WP_Error Either user's ID or error on failure.
195
+ */
196
+ function wpuf_register_new_user( $user_login, $user_email, $role ) {
197
+ $errors = new WP_Error();
198
+
199
+ $sanitized_user_login = sanitize_user( $user_login );
200
+ $user_email = apply_filters( 'user_registration_email', $user_email );
201
+
202
+ // Check the username
203
+ if ( $sanitized_user_login == '' ) {
204
+ $errors->add( 'empty_username', __( '<strong>ERROR</strong>: Please enter a username.' ) );
205
+ } elseif ( !validate_username( $user_login ) ) {
206
+ $errors->add( 'invalid_username', __( '<strong>ERROR</strong>: This username is invalid because it uses illegal characters. Please enter a valid username.' ) );
207
+ $sanitized_user_login = '';
208
+ } elseif ( username_exists( $sanitized_user_login ) ) {
209
+ $errors->add( 'username_exists', __( '<strong>ERROR</strong>: This username is already registered, please choose another one.' ) );
210
+ }
211
+
212
+ // Check the e-mail address
213
+ if ( $user_email == '' ) {
214
+ $errors->add( 'empty_email', __( '<strong>ERROR</strong>: Please type your e-mail address.' ) );
215
+ } elseif ( !is_email( $user_email ) ) {
216
+ $errors->add( 'invalid_email', __( '<strong>ERROR</strong>: The email address isn&#8217;t correct.' ) );
217
+ $user_email = '';
218
+ } elseif ( email_exists( $user_email ) ) {
219
+ $errors->add( 'email_exists', __( '<strong>ERROR</strong>: This email is already registered, please choose another one.' ) );
220
+ }
221
+
222
+ do_action( 'register_post', $sanitized_user_login, $user_email, $errors );
223
+
224
+ $errors = apply_filters( 'registration_errors', $errors, $sanitized_user_login, $user_email );
225
+
226
+ if ( $errors->get_error_code() )
227
+ return $errors;
228
+
229
+ $user_pass = wp_generate_password( 12, false );
230
+ //$user_id = wp_create_user( $sanitized_user_login, $user_pass, $user_email );
231
+
232
+ $userdata = array(
233
+ 'user_login' => $sanitized_user_login,
234
+ 'user_email' => $user_email,
235
+ 'user_pas' => $user_pass,
236
+ 'role' => $role
237
+ );
238
+
239
+ $user_id = wp_insert_user( $userdata );
240
+
241
+ if ( !$user_id ) {
242
+ $errors->add( 'registerfail', sprintf( __( '<strong>ERROR</strong>: Couldn&#8217;t register you... please contact the <a href="mailto:%s">webmaster</a> !' ), get_option( 'admin_email' ) ) );
243
+ return $errors;
244
+ }
245
+
246
+ update_user_option( $user_id, 'default_password_nag', true, true ); //Set up the Password change nag.
247
+
248
+ wp_send_new_user_notifications( $user_id );
249
+
250
+ return $user_id;
251
+ }
includes/free/form.php ADDED
@@ -0,0 +1,485 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class WPUF_form_element extends WPUF_Pro_Prompt {
4
+
5
+ public static function add_form_custom_buttons() {
6
+ $title = esc_attr( __( 'Click to add to the editor', 'wpuf' ) );
7
+ ?>
8
+ <button class="button" data-name="custom_image" data-type="image" title="<?php echo $title; ?>"><?php _e( 'Image Upload', 'wpuf' ); ?></button>
9
+
10
+ <?php self::get_pro_prompt(); ?>
11
+ <button class="button" disabled data-type="repeat" title="<?php echo $title; ?>"><?php _e( 'Repeat Field', 'wpuf' ); ?></button>
12
+ <button class="button" disabled data-type="date" title="<?php echo $title; ?>"><?php _e( 'Date', 'wpuf' ); ?></button>
13
+ <button class="button" disabled data-type="file" title="<?php echo $title; ?>"><?php _e( 'File Upload', 'wpuf' ); ?></button>
14
+ <button class="button" disabled data-type="map" title="<?php echo $title; ?>"><?php _e( 'Google Maps', 'wpuf' ); ?></button>
15
+ <button class="button" disabled data-type="select" title="<?php echo $title; ?>"><?php _e( 'Country List', 'wpuf' ); ?></button>
16
+ <button class="button" disabled data-type="text" title="<?php echo $title; ?>"><?php _e( 'Numeric Field', 'wpuf' ); ?></button>
17
+ <button class="button" disabled data-type="text" title="<?php echo $title; ?>"><?php _e( 'Address Field', 'wpuf' ); ?></button>
18
+ <button class="button" disabled data-type="text" title="<?php echo $title; ?>"><?php _e( 'Step Start', 'wpuf' ); ?></button>
19
+ <?php
20
+ }
21
+
22
+ /**
23
+ * add formbuilder's button in Others section
24
+ */
25
+ public static function add_form_other_buttons() {
26
+ $title = esc_attr( __( 'Click to add to the editor', 'wpuf' ) );
27
+
28
+ self::get_pro_prompt();
29
+ ?>
30
+ <button class="button" disabled data-type="captcha" title="<?php echo $title; ?>"><?php _e( 'reCaptcha', 'wpuf' ); ?></button>
31
+ <button class="button" disabled data-type="rscaptcha" title="<?php echo $title; ?>"><?php _e( 'Really Simple Captcha', 'wpuf' ); ?></button>
32
+ <button class="button" disabled data-type="action" title="<?php echo $title; ?>"><?php _e( 'Action Hook', 'wpuf' ); ?></button>
33
+ <button class="button" disabled data-type="action" title="<?php echo $title; ?>"><?php _e( 'Term &amp; Conditions', 'wpuf' ); ?></button>
34
+ <?php
35
+ }
36
+
37
+ /**
38
+ * Render form expiration tab
39
+ */
40
+ public static function render_form_expiration_tab() {
41
+ global $post;
42
+
43
+ $is_post_exp_selected = 'checked';
44
+ $time_value = 1;
45
+ $time_type = 'day';
46
+ $expired_post_status = 'draft';
47
+ $is_enable_mail_after_expired = 'checked';
48
+ $post_expiration_message = '';
49
+
50
+ self::get_pro_prompt();
51
+ ?>
52
+ <div id="wpuf-pro-content">
53
+ <table class="form-table">
54
+ <tr>
55
+ <th><?php _e( 'Post Expiration', 'wpuf' ); ?></th>
56
+ <td>
57
+ <label>
58
+ <input disabled type="checkbox" id="wpuf-enable_post_expiration" name="" value="on" <?php echo $is_post_exp_selected;?> />
59
+ <?php _e( 'Enable Post Expiration', 'wpuf' ); ?>
60
+ </label>
61
+ </td>
62
+ </tr>
63
+ <tr class="wpuf_expiration_field">
64
+ <th><?php _e( 'Post Expiration Time', 'wpuf' ); ?></th>
65
+ <td>
66
+ <?php
67
+ $timeType_array = array(
68
+ 'year' => 100,
69
+ 'month' => 12,
70
+ 'day' => 30
71
+ );
72
+ ?>
73
+ <select disabled name="" id="wpuf-expiration_time_value">
74
+ <?php
75
+ for( $i = 1; $i <= $timeType_array[$time_type]; $i++ ){
76
+ ?>
77
+ <option value="<?php echo $i; ?>" <?php echo $i == $time_value?'selected':''; ?> ><?php echo $i;?></option>
78
+ <?php
79
+ }
80
+ ?>
81
+ </select>
82
+ <select disabled name="" id="wpuf-expiration_time_type">
83
+ <?php
84
+ foreach( $timeType_array as $each_time_type=>$each_time_type_val ){
85
+ ?>
86
+ <option value="<?php echo $each_time_type;?>" <?php echo $each_time_type==$time_type?'selected':''; ?> ><?php echo ucfirst( $each_time_type ); ?></option>
87
+ <?php
88
+ }
89
+ ?>
90
+ </select>
91
+ </td>
92
+ </tr>
93
+
94
+ <tr class="wpuf_expiration_field">
95
+ <th>
96
+ Post Status :
97
+ </th>
98
+ <td>
99
+ <?php $post_statuses = get_post_statuses();
100
+ ?>
101
+ <select disabled name="" id="wpuf-expired_post_status">
102
+ <?php
103
+ foreach( $post_statuses as $post_status => $text ){
104
+ ?>
105
+ <option value="<?php echo $post_status ?>" <?php echo ( $expired_post_status == $post_status )?'selected':''; ?> ><?php echo $text;?></option>
106
+ <?php
107
+ }
108
+ ?>
109
+ </select>
110
+ <p class="description"><?php echo _( 'Status of post after post expiration time is over ' ); ?></p>
111
+
112
+ </td>
113
+ </tr>
114
+ <tr class="wpuf_expiration_field">
115
+ <th>
116
+ Send Mail :
117
+ </th>
118
+ <td>
119
+ <label>
120
+ <input disabled type="checkbox" name="" value="on" <?php echo $is_enable_mail_after_expired;?> />
121
+ <?php echo _( 'Send Email to Author After Exceeding Post Expiration Time' );?>
122
+ </label>
123
+ </td>
124
+ </tr>
125
+ <tr class="wpuf_expiration_field">
126
+ <th>Post Expiration Message</th>
127
+ <td>
128
+ <textarea disabled name="" id="wpuf-post_expiration_message" cols="50" rows="5"><?php echo $post_expiration_message; ?></textarea>
129
+ </td>
130
+ </tr>
131
+ </table>
132
+ </div>
133
+
134
+ <?php
135
+ }
136
+
137
+ /**
138
+ * Add form settings content
139
+ */
140
+ public static function add_form_settings_content( $form_settings, $post ) {
141
+ ?>
142
+ <tr>
143
+ <td colspan="2"><?php self::get_pro_prompt(); ?></td>
144
+ </tr>
145
+ <tr class="wpuf_enable_multistep_section wpuf-pro-content">
146
+ <th><?php _e( 'Enable Multistep', 'wpuf' ); ?></th>
147
+ <td>
148
+ <label>
149
+ <input disabled type="checkbox" name="" value="yes" checked />
150
+ <?php _e( 'Enable Multistep', 'wpuf' ); ?>
151
+ </label>
152
+
153
+ <p class="description"><?php echo __( 'If checked, form will be displayed in frontend in multiple steps', 'wpuf' ); ?></p>
154
+ </td>
155
+ </tr>
156
+ <tr class="wpuf_multistep_progress_type wpuf-pro-content">
157
+ <th><?php _e( 'Multistep Progressbar Type', 'wpuf' ); ?></th>
158
+ <td>
159
+ <label>
160
+ <select disabled name="">
161
+ <option value="progressive" selected >Progressive</option>
162
+ <option value="step_by_step" >Step by Step</option>
163
+ </select>
164
+ </label>
165
+
166
+
167
+ <p class="description"><?php echo __( 'Choose how you want the progressbar', 'wpuf' ); ?></p>
168
+ </td>
169
+ </tr>
170
+ <?php
171
+ }
172
+
173
+ /**
174
+ * Add content to post notification section
175
+ */
176
+ public static function add_post_notification_content() {
177
+
178
+ global $post;
179
+
180
+ $new_mail_body = "Hi Admin,\r\n";
181
+ $new_mail_body .= "A new post has been created in your site %sitename% (%siteurl%).\r\n\r\n";
182
+
183
+ $edit_mail_body = "Hi Admin,\r\n";
184
+ $edit_mail_body .= "The post \"%post_title%\" has been updated.\r\n\r\n";
185
+
186
+ $mail_body = "Here is the details:\r\n";
187
+ $mail_body .= "Post Title: %post_title%\r\n";
188
+ $mail_body .= "Content: %post_content%\r\n";
189
+ $mail_body .= "Author: %author%\r\n";
190
+ $mail_body .= "Post URL: %permalink%\r\n";
191
+ $mail_body .= "Edit URL: %editlink%";
192
+
193
+ $form_settings = wpuf_get_form_settings( $post->ID );
194
+
195
+ $new_notificaton = 'on';
196
+ $new_to = get_option( 'admin_email' );
197
+ $new_subject = __( 'New post created', 'wpuf' );
198
+ $new_body = $new_mail_body . $mail_body;
199
+
200
+ $edit_notificaton = 'off';
201
+ $edit_to = get_option( 'admin_email' );
202
+ $edit_subject = __( 'A post has been edited', 'wpuf' );
203
+ $edit_body = $edit_mail_body . $mail_body;
204
+ ?>
205
+
206
+ <?php self::get_pro_prompt(); ?>
207
+ <div id="wpuf-pro-content">
208
+ <h3><?php _e( 'New Post Notificatoin', 'wpuf' ); ?></h3>
209
+ <table class="form-table">
210
+ <tr>
211
+ <th><?php _e( 'Notification', 'wpuf' ); ?></th>
212
+ <td>
213
+ <label>
214
+ <input disabled type="checkbox" name="" value="on"<?php checked( $new_notificaton, 'on' ); ?>>
215
+ <input type="hidden" name="wpuf_settings[notification][new]" value="on">
216
+ <?php _e( 'Enable post notification', 'wpuf' ); ?>
217
+ </label>
218
+ </td>
219
+ </tr>
220
+
221
+ <tr>
222
+ <th><?php _e( 'To', 'wpuf' ); ?></th>
223
+ <td>
224
+ <input disabled type="text" name="" class="regular-text" value="<?php echo esc_attr( $new_to ) ?>">
225
+ <input type="hidden" name="wpuf_settings[notification][new_to]" value="<?php echo esc_attr( $new_to ) ?>">
226
+ </td>
227
+ </tr>
228
+
229
+ <tr>
230
+ <th><?php _e( 'Subject', 'wpuf' ); ?></th>
231
+ <td><input disabled type="text" name="" class="regular-text" value="<?php echo esc_attr( $new_subject ) ?>"></td>
232
+ <input type="hidden" name="wpuf_settings[notification][new_subject]" value="<?php echo esc_attr( $new_subject ) ?>">
233
+ </tr>
234
+
235
+ <tr>
236
+ <th><?php _e( 'Message', 'wpuf' ); ?></th>
237
+ <td>
238
+ <textarea disabled rows="6" cols="60" name=""><?php echo esc_textarea( $new_body ) ?></textarea>
239
+ <input type="hidden" name="wpuf_settings[notification][new_body]" value="<?php echo esc_attr( $new_body ) ?>">
240
+ </td>
241
+ </tr>
242
+ </table>
243
+
244
+ <h3><?php _e( 'Update Post Notificatoin', 'wpuf' ); ?></h3>
245
+
246
+ <table class="form-table">
247
+ <tr>
248
+ <th><?php _e( 'Notification', 'wpuf' ); ?></th>
249
+ <td>
250
+ <label>
251
+ <input disabled type="checkbox" name="" value="on"<?php checked( $edit_notificaton, 'on' ); ?>>
252
+ <input type="hidden" name="wpuf_settings[notification][edit]" value="off">
253
+ <?php _e( 'Enable post notification', 'wpuf' ); ?>
254
+ </label>
255
+ </td>
256
+ </tr>
257
+
258
+ <tr>
259
+ <th><?php _e( 'To', 'wpuf' ); ?></th>
260
+ <td><input disabled type="text" name="" class="regular-text" value="<?php echo esc_attr( $edit_to ) ?>"></td>
261
+ </tr>
262
+
263
+ <tr>
264
+ <th><?php _e( 'Subject', 'wpuf' ); ?></th>
265
+ <td><input disabled type="text" name="" class="regular-text" value="<?php echo esc_attr( $edit_subject ) ?>"></td>
266
+ </tr>
267
+
268
+ <tr>
269
+ <th><?php _e( 'Message', 'wpuf' ); ?></th>
270
+ <td>
271
+ <textarea disabled rows="6" cols="60" name=""><?php echo esc_textarea( $edit_body ) ?></textarea>
272
+ </td>
273
+ </tr>
274
+ </table>
275
+
276
+ <h3><?php _e( 'You may use in message:', 'wpuf' ); ?></h3>
277
+ <p>
278
+ <code>%post_title%</code>, <code>%post_content%</code>, <code>%post_excerpt%</code>, <code>%tags%</code>, <code>%category%</code>,
279
+ <code>%author%</code>, <code>%author_email%</code>, <code>%author_bio%</code>, <code>%sitename%</code>, <code>%siteurl%</code>, <code>%permalink%</code>, <code>%editlink%</code>
280
+ <br><code>%custom_{NAME_OF_CUSTOM_FIELD}%</code> e.g: <code>%custom_website_url%</code> for <code>website_url</code> meta field
281
+ </p>
282
+ </div>
283
+
284
+ <?php
285
+
286
+ }
287
+
288
+ /**
289
+ * Render registration form
290
+ */
291
+ public static function render_registration_form() {
292
+
293
+ global $post, $pagenow, $form_inputs;
294
+
295
+ $form_inputs = wpuf_get_form_fields( $post->ID );
296
+
297
+ self::get_pro_prompt();
298
+
299
+ ?>
300
+ <div style="margin-bottom: 10px">
301
+ <button class="button wpuf-collapse"><?php _e( 'Toggle All', 'wpuf' ); ?></button>
302
+ </div>
303
+
304
+ <div class="wpuf-updated">
305
+ <p><?php _e( 'Click on a form element to add to the editor', 'wpuf' ); ?></p>
306
+ </div>
307
+
308
+ <ul id="wpuf-form-editor" class="wpuf-form-editor unstyled">
309
+
310
+ <?php
311
+
312
+ if ($form_inputs) {
313
+ $count = 0;
314
+ foreach ($form_inputs as $order => $input_field) {
315
+ $name = ucwords( str_replace( '_', ' ', $input_field['template'] ) );
316
+
317
+ WPUF_Admin_Template_Profile::$input_field['template']( $count, $name, $input_field );
318
+
319
+ $count++;
320
+ }
321
+ }
322
+ ?>
323
+ </ul>
324
+ <?php
325
+
326
+ }
327
+
328
+ /**
329
+ * Render registration settings
330
+ */
331
+ public static function render_registration_settings() {
332
+ global $post;
333
+
334
+ $form_settings = wpuf_get_form_settings( $post->ID );
335
+
336
+ $email_verification = 'no';
337
+ $role_selected = 'subscriber';
338
+ $redirect_to = 'post';
339
+ $message = __( 'Registration successful', 'wpuf' );
340
+ $update_message = __( 'Profile updated successfully', 'wpuf' );
341
+ $page_id = 0;
342
+ $url = '';
343
+ $submit_text = __( 'Register', 'wpuf' );
344
+ $update_text = __( 'Update Profile', 'wpuf' );
345
+ ?>
346
+ <tr>
347
+ <td colspan="2">
348
+ <?php self::get_pro_prompt(); ?>
349
+ </td>
350
+ </tr>
351
+ <tr class="wpuf-post-type">
352
+ <th><?php _e( 'Enable Email Verfication', 'wpuf' ); ?></th>
353
+ <td>
354
+ <input type="hidden" name="" value="no">
355
+ <input disabled type="checkbox" id="wpuf-enable_email_verification" name="" value="yes" <?php checked( $email_verification, 'yes' ); ?> > <label for="wpuf-enable_email_verification">Enable Email Verification</label>
356
+ </td>
357
+ </tr>
358
+
359
+ <tr class="wpuf-post-type">
360
+ <th><?php _e( 'New User Role', 'wpuf' ); ?></th>
361
+ <td>
362
+ <select disabled name="">
363
+ <?php
364
+ $user_roles = wpuf_get_user_roles();
365
+ foreach ( $user_roles as $role => $label ) {
366
+ printf('<option value="%s"%s>%s</option>', $role, selected( $role_selected, $role, false ), $label );
367
+ }
368
+ ?>
369
+ </select>
370
+ </td>
371
+ </tr>
372
+
373
+ <tr class="wpuf-redirect-to">
374
+ <th><?php _e( 'Redirect To', 'wpuf' ); ?></th>
375
+ <td>
376
+ <select disabled name="">
377
+ <?php
378
+ $redirect_options = array(
379
+ 'same' => __( 'Same Page', 'wpuf' ),
380
+ 'page' => __( 'To a page', 'wpuf' ),
381
+ 'url' => __( 'To a custom URL', 'wpuf' )
382
+ );
383
+
384
+ foreach ( $redirect_options as $to => $label ) {
385
+ printf('<option value="%s"%s>%s</option>', $to, selected( $redirect_to, $to, false ), $label );
386
+ }
387
+ ?>
388
+ </select>
389
+ <div class="description">
390
+ <?php _e( 'After successfull submit, where the page will redirect to', 'wpuf' ) ?>
391
+ </div>
392
+ </td>
393
+ </tr>
394
+
395
+ <tr class="wpuf-same-page">
396
+ <th><?php _e( 'Registration success message', 'wpuf' ); ?></th>
397
+ <td>
398
+ <textarea disabled rows="3" cols="40" name=""><?php echo esc_textarea( $message ); ?></textarea>
399
+ </td>
400
+ </tr>
401
+
402
+ <tr class="wpuf-same-page">
403
+ <th><?php _e( 'Update profile message', 'wpuf' ); ?></th>
404
+ <td>
405
+ <textarea disabled rows="3" cols="40" name=""><?php echo esc_textarea( $update_message ); ?></textarea>
406
+ </td>
407
+ </tr>
408
+
409
+ <tr class="wpuf-page-id">
410
+ <th><?php _e( 'Page', 'wpuf' ); ?></th>
411
+ <td>
412
+ <select disabled name="">
413
+ <?php
414
+ $pages = get_posts( array( 'numberposts' => -1, 'post_type' => 'page') );
415
+
416
+ foreach ($pages as $page) {
417
+ printf('<option value="%s"%s>%s</option>', $page->ID, selected( $page_id, $page->ID, false ), esc_attr( $page->post_title ) );
418
+ }
419
+ ?>
420
+ </select>
421
+ </td>
422
+ </tr>
423
+
424
+ <tr class="wpuf-url">
425
+ <th><?php _e( 'Custom URL', 'wpuf' ); ?></th>
426
+ <td>
427
+ <input disabled type="url" name="" value="<?php echo esc_attr( $url ); ?>">
428
+ </td>
429
+ </tr>
430
+
431
+ <tr class="wpuf-submit-text">
432
+ <th><?php _e( 'Submit Button text', 'wpuf' ); ?></th>
433
+ <td>
434
+ <input disabled type="text" name="" value="<?php echo esc_attr( $submit_text ); ?>">
435
+ </td>
436
+ </tr>
437
+
438
+ <tr class="wpuf-update-text">
439
+ <th><?php _e( 'Update Button text', 'wpuf' ); ?></th>
440
+ <td>
441
+ <input disabled type="text" name="" value="<?php echo esc_attr( $update_text ); ?>">
442
+ </td>
443
+ </tr>
444
+ <?php
445
+ }
446
+
447
+ /**
448
+ * Checks what the post type is
449
+ */
450
+ public static function check_post_type( $post, $update ) {
451
+
452
+ if( get_post_type( $post->ID ) == 'wpuf_profile' && $update ){
453
+
454
+ wp_redirect($_SERVER["HTTP_REFERER"]);
455
+ die();
456
+ }
457
+ }
458
+
459
+ /**
460
+ * Render custom taxonomies
461
+ */
462
+ public static function render_custom_taxonomies_element() {
463
+ self::get_pro_prompt();
464
+ }
465
+
466
+ /**
467
+ * Render conditional logic
468
+ */
469
+ public static function render_conditional_field( $field_id, $con_fields, $obj ) {
470
+ ?>
471
+ <div class="wpuf-form-rows">
472
+ <label><?php _e( 'Conditional Logic', 'wpuf' ); ?></label>
473
+
474
+ <div class="wpuf-form-sub-fields">
475
+ <label><input type="radio" name="" disabled class="wpuf-conditional-enable" value="yes"> <?php _e( 'Yes', 'wpuf' ); ?></label>
476
+ <label><input type="radio" name="" disabled class="wpuf-conditional-enable" value="no" checked> <?php _e( 'No', 'wpuf' ); ?></label>
477
+
478
+ <label class="wpuf-pro-text-alert"> (<?php echo self::get_pro_prompt_text(); ?>)</label>
479
+ </div>
480
+ </div> <!-- .wpuf-form-rows -->
481
+ <?php
482
+
483
+ }
484
+
485
+ }
includes/free/loader.php ADDED
@@ -0,0 +1,232 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ require_once dirname( __FILE__ ) . '/prompt.php';
4
+
5
+ class WPUF_Free_Loader extends WPUF_Pro_Prompt {
6
+
7
+ public function __construct() {
8
+
9
+ $this->includes();
10
+ $this->instantiate();
11
+
12
+ add_action( 'add_meta_boxes_wpuf_forms', array($this, 'add_meta_box_post'), 99 );
13
+
14
+ add_action( 'wpuf_form_buttons_custom', array( $this, 'wpuf_form_buttons_custom_runner' ) );
15
+ add_action( 'wpuf_form_buttons_other', array( $this, 'wpuf_form_buttons_other_runner') );
16
+ add_action( 'wpuf_form_post_expiration', array( $this, 'wpuf_form_post_expiration_runner') );
17
+ add_action( 'wpuf_form_setting', array( $this, 'form_setting_runner' ),10,2 );
18
+ add_action( 'wpuf_form_settings_post_notification', array( $this, 'post_notification_hook_runner') );
19
+ add_action( 'wpuf_edit_form_area_profile', array( $this, 'wpuf_edit_form_area_profile_runner' ) );
20
+ add_action( 'registration_setting' , array($this,'registration_setting_runner') );
21
+ add_action( 'wpuf_check_post_type' , array( $this, 'wpuf_check_post_type_runner' ),10,2 );
22
+ add_action( 'wpuf_form_custom_taxonomies', array( $this, 'wpuf_form_custom_taxonomies_runner' ) );
23
+ add_action( 'wpuf_conditional_field_render_hook', array( $this, 'wpuf_conditional_field_render_hook_runner' ),10,3 );
24
+
25
+ //subscription
26
+ add_action( 'wpuf_admin_subscription_detail', array($this, 'wpuf_admin_subscription_detail_runner'), 10, 4 );
27
+
28
+ //coupon
29
+ add_action( 'wpuf_coupon_settings_form', array($this, 'wpuf_coupon_settings_form_runner'),10,1 );
30
+ add_action( 'wpuf_check_save_permission', array($this, 'wpuf_check_save_permission_runner'),10,2 );
31
+
32
+ // admin menu
33
+ add_action( 'wpuf_admin_menu_top', array($this, 'admin_menu_top') );
34
+ add_action( 'wpuf_admin_menu', array($this, 'admin_menu') );
35
+
36
+ // plugin settings
37
+ add_action( 'admin_footer', array($this, 'remove_login_from_settings') );
38
+ add_filter( 'wpuf_settings_fields', array($this, 'settings_login_prompt') );
39
+
40
+ // post form templates
41
+ add_action( 'wpuf_get_post_form_templates', array($this, 'post_form_templates') );
42
+ }
43
+
44
+ public function includes() {
45
+
46
+ //class files to include pro elements
47
+ require_once dirname( __FILE__ ) . '/form.php';
48
+ require_once dirname( __FILE__ ) . '/subscription.php';
49
+ require_once dirname( __FILE__ ) . '/edit-profile.php';
50
+ require_once dirname( __FILE__ ) . '/edit-user.php';
51
+ }
52
+
53
+ public function instantiate(){
54
+ new WPUF_Edit_Profile();
55
+ }
56
+
57
+ function admin_menu_top() {
58
+ $capability = wpuf_admin_role();
59
+
60
+ add_submenu_page( 'wpuf-admin-opt', __( 'Registration Forms', 'wpuf' ), __( 'Registration Forms', 'wpuf' ), $capability, 'wpuf_profile', array($this, 'admin_reg_forms_page') );
61
+ }
62
+
63
+ function admin_menu() {
64
+ $capability = wpuf_admin_role();
65
+
66
+ add_submenu_page( 'wpuf-admin-opt', __( 'Coupons', 'wpuf' ), __( 'Coupons', 'wpuf' ), $capability, 'wpuf_coupon', array($this, 'admin_coupon_page' ) );
67
+ }
68
+
69
+ function admin_reg_forms_page() {
70
+ ?>
71
+ <h2><?php _e( 'Registration Form', 'wpuf' ); ?></h2>
72
+
73
+ <div class="wpuf-notice" style="padding: 20px; background: #fff; border: 1px solid #ddd;">
74
+ <p>
75
+ <?php _e( 'Registration form builder is a two way form which can be used both for <strong>user registration</strong> and <strong>profile editing</strong>.', 'wpuf' ); ?>
76
+ </p>
77
+
78
+ <p>
79
+ <?php _e( 'Users can also register themselves by using a subscription pack.', 'wpuf' ); ?>
80
+ </p>
81
+
82
+ <p>
83
+ <?php _e( 'This feature is only available in the Pro Version.', 'wpuf' ); ?>
84
+ </p>
85
+
86
+ <p>
87
+ <a href="<?php echo self::get_pro_url(); ?>" target="_blank" class="button-primary"><?php _e( 'Upgrade to Pro Version', 'wpuf' ); ?></a>
88
+ </p>
89
+ </div>
90
+ <?php
91
+ }
92
+
93
+ function admin_coupon_page() {
94
+ ?>
95
+ <h2><?php _e( 'Coupons', 'wpuf' ); ?></h2>
96
+
97
+ <div class="wpuf-notice" style="padding: 20px; background: #fff; border: 1px solid #ddd;">
98
+ <p>
99
+ <?php _e( 'Use Coupon codes for subscription for discounts.', 'wpuf' ); ?>
100
+ </p>
101
+
102
+ <p>
103
+ <?php _e( 'This feature is only available in the Pro Version.', 'wpuf' ); ?>
104
+ </p>
105
+
106
+ <p>
107
+ <a href="<?php echo self::get_pro_url(); ?>" target="_blank" class="button-primary"><?php _e( 'Upgrade to Pro Version', 'wpuf' ); ?></a>
108
+ </p>
109
+ </div>
110
+
111
+ <?php
112
+ }
113
+
114
+ function remove_login_from_settings() {
115
+ global $current_screen;
116
+
117
+ if ( $current_screen->id == 'user-frontend_page_wpuf-settings' ) {
118
+ ?>
119
+ <script type="text/javascript">
120
+ jQuery(function($){
121
+ $('#wpuf_profile').find('input, select').each(function(i, el){ $(el).attr('disabled','disabled'); });
122
+ });
123
+ </script>
124
+ <?php
125
+ }
126
+ }
127
+
128
+ function settings_login_prompt( $fields ) {
129
+
130
+ // var_dump( $fields ); die();
131
+
132
+ $new_field = array(
133
+ 'name' => 'something',
134
+ 'label' => __( 'Pro Feature', 'wpuf' ),
135
+ 'desc' => 'These Features are ' . self::get_pro_prompt_text() . ' Only.',
136
+ 'type' => 'html',
137
+ );
138
+
139
+ array_unshift( $fields['wpuf_profile'], $new_field );
140
+
141
+ // var_dump( $fields ); die();
142
+
143
+ return $fields;
144
+ }
145
+
146
+ /**
147
+ * Add meta boxes to post form builder
148
+ *
149
+ * @return void
150
+ */
151
+ function add_meta_box_post() {
152
+ add_meta_box( 'wpuf-metabox-fields-banner', __( 'Upgrade to Pro', 'wpuf' ), array($this, 'show_banner_metabox'), 'wpuf_forms', 'side', 'core' );
153
+ }
154
+
155
+ function show_banner_metabox() {
156
+ printf( 'Upgrade to in <a href="%s" target="_blank">Pro Version</a> to get more fields and features.', self::get_pro_url() );
157
+ }
158
+
159
+ public function wpuf_form_buttons_custom_runner() {
160
+
161
+ //add formbuilder widget pro buttons
162
+ WPUF_form_element::add_form_custom_buttons();
163
+ }
164
+
165
+ public function wpuf_form_buttons_other_runner() {
166
+ WPUF_form_element::add_form_other_buttons();
167
+ }
168
+
169
+ public function wpuf_form_post_expiration_runner(){
170
+ WPUF_form_element::render_form_expiration_tab();
171
+ }
172
+
173
+ public function form_setting_runner( $form_settings, $post ) {
174
+ WPUF_form_element::add_form_settings_content( $form_settings, $post );
175
+ }
176
+ public function post_notification_hook_runner() {
177
+ WPUF_form_element::add_post_notification_content( );
178
+ }
179
+
180
+ public function wpuf_edit_form_area_profile_runner() {
181
+ WPUF_form_element::render_registration_form();
182
+ }
183
+
184
+ public function registration_setting_runner() {
185
+ WPUF_form_element::render_registration_settings();
186
+ }
187
+
188
+ public function wpuf_check_post_type_runner( $post, $update ) {
189
+ WPUF_form_element::check_post_type( $post, $update );
190
+ }
191
+
192
+ public function wpuf_form_custom_taxonomies_runner() {
193
+ WPUF_form_element::render_custom_taxonomies_element();
194
+ }
195
+
196
+ public function wpuf_conditional_field_render_hook_runner( $field_id, $con_fields, $obj ) {
197
+ WPUF_form_element::render_conditional_field( $field_id, $con_fields, $obj );
198
+ }
199
+
200
+ //subscription
201
+ public function wpuf_admin_subscription_detail_runner( $sub_meta, $hidden_recurring_class, $hidden_trial_class, $obj ) {
202
+ WPUF_subscription_element::add_subscription_element( $sub_meta, $hidden_recurring_class, $hidden_trial_class, $obj );
203
+ }
204
+
205
+ //coupon
206
+ public function wpuf_coupon_settings_form_runner( $obj ) {
207
+ WPUF_Coupon_Elements::add_coupon_elements( $obj );
208
+ }
209
+
210
+ public function wpuf_check_save_permission_runner( $post, $update ) {
211
+ WPUF_Coupon_Elements::check_saving_capability( $post, $update );
212
+ }
213
+
214
+ /**
215
+ * Post form templates
216
+ *
217
+ * @since 2.4
218
+ *
219
+ * @param array $integrations
220
+ *
221
+ * @return array
222
+ */
223
+ public function post_form_templates( $integrations ) {
224
+ require_once dirname( __FILE__ ) . '/post-form-templates/woocommerce.php';
225
+
226
+ $integrations['WPUF_Post_Form_Template_WooCommerce'] = new WPUF_Post_Form_Template_WooCommerce();
227
+
228
+ return $integrations;
229
+ }
230
+ }
231
+
232
+ new WPUF_Free_Loader();
includes/free/post-form-templates/woocommerce.php ADDED
@@ -0,0 +1,305 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * WooCommerce post form template
5
+ */
6
+ class WPUF_Post_Form_Template_WooCommerce extends WPUF_Post_Form_Template {
7
+
8
+ public function __construct() {
9
+ parent::__construct();
10
+
11
+ $this->enabled = class_exists( 'WooCommerce' );
12
+ $this->title = __( 'WooCommerce Product', 'wpuf' );
13
+ $this->description = __( 'Create a simple product form for WooCommerce.', 'wpuf' );
14
+ $this->form_fields = array(
15
+ array(
16
+ 'input_type' => 'text',
17
+ 'template' => 'post_title',
18
+ 'required' => 'yes',
19
+ 'label' => 'Product Name',
20
+ 'name' => 'post_title',
21
+ 'is_meta' => 'no',
22
+ 'help' => '',
23
+ 'css' => '',
24
+ 'placeholder' => 'Please enter your product name',
25
+ 'default' => '',
26
+ 'size' => '40',
27
+ 'wpuf_cond' => $this->conditionals
28
+ ),
29
+ array(
30
+ 'input_type' => 'textarea',
31
+ 'template' => 'post_content',
32
+ 'required' => 'yes',
33
+ 'label' => 'Product description',
34
+ 'name' => 'post_content',
35
+ 'is_meta' => 'no',
36
+ 'help' => 'Write the full description of your product',
37
+ 'css' => '',
38
+ 'rows' => '5',
39
+ 'cols' => '25',
40
+ 'placeholder' => '',
41
+ 'default' => '',
42
+ 'rich' => 'yes',
43
+ 'insert_image' => 'yes',
44
+ 'word_restriction' => '',
45
+ 'wpuf_cond' => $this->conditionals,
46
+ ),
47
+ array(
48
+ 'input_type' => 'textarea',
49
+ 'template' => 'post_excerpt',
50
+ 'required' => 'no',
51
+ 'label' => 'Product Short Description',
52
+ 'name' => 'post_excerpt',
53
+ 'is_meta' => 'no',
54
+ 'help' => 'Provide a short description of your product',
55
+ 'css' => '',
56
+ 'rows' => '5',
57
+ 'cols' => '25',
58
+ 'placeholder' => '',
59
+ 'default' => '',
60
+ 'rich' => 'no',
61
+ 'wpuf_cond' => $this->conditionals
62
+ ),
63
+ array(
64
+ 'input_type' => 'text',
65
+ 'template' => 'text_field',
66
+ 'required' => 'yes',
67
+ 'label' => 'Regular Price',
68
+ 'name' => '_regular_price',
69
+ 'is_meta' => 'yes',
70
+ 'help' => '',
71
+ 'css' => '',
72
+ 'placeholder' => 'regular price of your product',
73
+ 'default' => '',
74
+ 'size' => '40',
75
+ 'step_text_field' => '0.01',
76
+ 'min_value_field' => '0',
77
+ 'max_value_field' => '',
78
+ 'wpuf_cond' => $this->conditionals
79
+ ),
80
+ array(
81
+ 'input_type' => 'text',
82
+ 'template' => 'text_field',
83
+ 'required' => 'no',
84
+ 'label' => 'Sale Price',
85
+ 'name' => '_sale_price',
86
+ 'is_meta' => 'yes',
87
+ 'help' => '',
88
+ 'css' => '',
89
+ 'placeholder' => 'sale price of your product',
90
+ 'default' => '',
91
+ 'size' => '40',
92
+ 'step_text_field' => '0.01',
93
+ 'min_value_field' => '0',
94
+ 'max_value_field' => '',
95
+ 'wpuf_cond' => $this->conditionals
96
+ ),
97
+ array(
98
+ 'input_type' => 'image_upload',
99
+ 'template' => 'featured_image',
100
+ 'count' => '1',
101
+ 'required' => 'yes',
102
+ 'label' => 'Product Image',
103
+ 'name' => 'featured_image',
104
+ 'is_meta' => 'no',
105
+ 'help' => 'Upload the main image of your product',
106
+ 'css' => '',
107
+ 'max_size' => '1024',
108
+ 'wpuf_cond' => $this->conditionals
109
+ ),
110
+ array(
111
+ 'input_type' => 'image_upload',
112
+ 'template' => 'image_upload',
113
+ 'required' => 'no',
114
+ 'label' => 'Product Image Gallery',
115
+ 'name' => '_product_image',
116
+ 'is_meta' => 'yes',
117
+ 'help' => 'Upload additional pictures of your product and will be shown as image gallery',
118
+ 'css' => '',
119
+ 'max_size' => '1024',
120
+ 'count' => '5',
121
+ 'wpuf_cond' => $this->conditionals
122
+ ),
123
+ array(
124
+ 'input_type' => 'select',
125
+ 'template' => 'dropdown_field',
126
+ 'required' => 'yes',
127
+ 'label' => 'Catalog visibility',
128
+ 'name' => '_visibility',
129
+ 'is_meta' => 'yes',
130
+ 'help' => 'Choose where this product should be displayed in your catalog. The product will always be accessible directly.',
131
+ 'css' => '',
132
+ 'first' => ' - select -',
133
+ 'options' =>
134
+ array(
135
+ 'visible' => 'Catalog/search',
136
+ 'catalog' => 'Catalog',
137
+ 'search' => 'Search',
138
+ 'hidden' => 'Hidden',
139
+ ),
140
+ 'wpuf_cond' => $this->conditionals
141
+ ),
142
+ array(
143
+ 'input_type' => 'textarea',
144
+ 'template' => 'textarea_field',
145
+ 'required' => 'no',
146
+ 'label' => 'Purchase note',
147
+ 'name' => '_purchase_note',
148
+ 'is_meta' => 'yes',
149
+ 'help' => 'Enter an optional note to send to the customer after purchase',
150
+ 'css' => '',
151
+ 'rows' => '5',
152
+ 'cols' => '25',
153
+ 'placeholder' => '',
154
+ 'default' => '',
155
+ 'rich' => 'no',
156
+ 'word_restriction' => '',
157
+ 'wpuf_cond' => $this->conditionals
158
+ ),
159
+ array(
160
+ 'input_type' => 'checkbox',
161
+ 'template' => 'checkbox_field',
162
+ 'required' => 'no',
163
+ 'label' => 'Product Reviews',
164
+ 'name' => 'product_reviews',
165
+ 'is_meta' => 'yes',
166
+ 'help' => '',
167
+ 'css' => '',
168
+ 'options' => array(
169
+ '_enable_reviews' => 'Enable reviews',
170
+ ),
171
+ 'wpuf_cond' => $this->conditionals
172
+ ),
173
+ );
174
+
175
+ $this->form_settings = array (
176
+ 'post_type' => 'product',
177
+ 'post_status' => 'publish',
178
+ 'default_cat' => '-1',
179
+ 'guest_post' => 'false',
180
+ 'message_restrict' => 'This page is restricted. Please Log in / Register to view this page.',
181
+ 'redirect_to' => 'post',
182
+ 'comment_status' => 'open',
183
+ 'submit_text' => 'Create Product',
184
+ 'edit_post_status' => 'publish',
185
+ 'edit_redirect_to' => 'same',
186
+ 'update_message' => 'Product has been updated successfully. <a target="_blank" href="%link%">View Product</a>',
187
+ 'edit_url' => '',
188
+ 'update_text' => 'Update Product',
189
+ 'form_template' => __CLASS__,
190
+ 'notification' => array(
191
+ 'new' => 'on',
192
+ 'new_to' => get_option( 'admin_email' ),
193
+ 'new_subject' => 'New product has been created',
194
+ 'new_body' => 'Hi,
195
+ A new product has been created in your site %sitename% (%siteurl%).
196
+
197
+ Here is the details:
198
+ Product Title: %post_title%
199
+ Description: %post_content%
200
+ Short Description: %post_excerpt%
201
+ Author: %author%
202
+ Post URL: %permalink%
203
+ Edit URL: %editlink%',
204
+ 'edit' => 'off',
205
+ 'edit_to' => get_option( 'admin_email' ),
206
+ 'edit_subject' => 'Product has been edited',
207
+ 'edit_body' => 'Hi,
208
+ The product "%post_title%" has been updated.
209
+
210
+ Here is the details:
211
+ Product Title: %post_title%
212
+ Description: %post_content%
213
+ Short Description: %post_excerpt%
214
+ Author: %author%
215
+ Post URL: %permalink%
216
+ Edit URL: %editlink%',
217
+ ),
218
+ );
219
+ }
220
+
221
+ /**
222
+ * Run necessary processing after new post insert
223
+ *
224
+ * @param int $post_id
225
+ * @param int $form_id
226
+ * @param array $form_settings
227
+ *
228
+ * @return void
229
+ */
230
+ public function after_insert( $post_id, $form_id, $form_settings ) {
231
+ $this->handle_form_updates( $post_id, $form_id, $form_settings );
232
+ }
233
+
234
+ /**
235
+ * Run necessary processing after editing a post
236
+ *
237
+ * @param int $post_id
238
+ * @param int $form_id
239
+ * @param array $form_settings
240
+ *
241
+ * @return void
242
+ */
243
+ public function after_update( $post_id, $form_id, $form_settings ) {
244
+ $this->handle_form_updates( $post_id, $form_id, $form_settings );
245
+ }
246
+
247
+ /**
248
+ * Run the functions on update/insert
249
+ *
250
+ * @param int $post_id
251
+ * @param int $form_id
252
+ * @param array $form_settings
253
+ *
254
+ * @return void
255
+ */
256
+ public function handle_form_updates( $post_id, $form_id, $form_settings ) {
257
+ $this->update_reviews( $post_id );
258
+ $this->update_price( $post_id );
259
+ $this->update_gallery_images( $post_id );
260
+ }
261
+
262
+ /**
263
+ * Update the product reviews
264
+ *
265
+ * @param int $post_id
266
+ *
267
+ * @return void
268
+ */
269
+ public function update_reviews( $post_id ) {
270
+ $reviews = get_post_meta( $post_id, 'product_reviews', true );
271
+ $status = !empty( $reviews ) ? 'open' : 'close';
272
+
273
+ wp_update_post( array( 'ID' => $post_id, 'comment_status' => 'open' ) );
274
+ }
275
+
276
+ /**
277
+ * Update the proper price
278
+ *
279
+ * @param int $post_id
280
+ *
281
+ * @return void
282
+ */
283
+ function update_price( $post_id ) {
284
+ $regular_price = (float) get_post_meta( $post_id, '_regular_price', true );
285
+ $sale_price = (float) get_post_meta( $post_id, '_sale_price', true );
286
+
287
+ if ( $sale_price && $regular_price > $sale_price ) {
288
+ update_post_meta( $post_id, '_price', $sale_price );
289
+ } else {
290
+ update_post_meta( $post_id, '_price', $regular_price );
291
+ }
292
+ }
293
+
294
+ /**
295
+ * Update image gallery
296
+ *
297
+ * @param int $post_id
298
+ *
299
+ * @return void
300
+ */
301
+ public function update_gallery_images( $post_id ) {
302
+ $images = get_post_meta( $post_id, '_product_image' );
303
+ update_post_meta( $post_id, '_product_image_gallery', implode(',', $images) );
304
+ }
305
+ }
includes/free/prompt.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Free to Pro prompter class
5
+ *
6
+ * @package WPUF
7
+ */
8
+ class WPUF_Pro_Prompt {
9
+
10
+ public static function get_pro_prompt() {
11
+ echo '<h3 class="wpuf-pro-text-alert">' . self::get_pro_prompt_text() . '</h3>';
12
+ }
13
+
14
+ public static function get_pro_url() {
15
+ return 'https://wedevs.com/products/plugins/wp-user-frontend-pro/?utm_source=freeplugin&utm_medium=prompt&utm_term=wpuf_free_plugin&utm_content=textlink&utm_campaign=pro_prompt';
16
+ }
17
+
18
+ public static function get_pro_prompt_text() {
19
+ return sprintf( 'Available in <a href="%s" target="_blank">Pro Version</a>', self::get_pro_url() );
20
+ }
21
+ }
includes/free/subscription.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class WPUF_Subscription_Element extends WPUF_Pro_Prompt {
4
+
5
+ public static function add_subscription_element( $sub_meta, $hidden_recurring_class, $hidden_trial_class, $obj ) {
6
+ ?>
7
+ <tr valign="top">
8
+ <th><label><?php _e( 'Recurring', 'wpuf' ); ?></label></th>
9
+ <td>
10
+ <label for="wpuf-recuring-pay">
11
+ <input type="checkbox" disabled checked size="20" style="" id="wpuf-recuring-pay" value="yes" name="" />
12
+ <?php _e( 'Enable Recurring Payment', 'wpuf' ); ?>
13
+ </label>
14
+
15
+ <label class="wpuf-pro-text-alert"> (<?php echo self::get_pro_prompt_text(); ?>)</label>
16
+ </td>
17
+ </tr>
18
+ <?php
19
+ }
20
+ }
languages/readme.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ Instructions:
2
+ ----------------------------
3
+ 1. File name structure is: wpuf-LOCALE.po, e.g: wpuf-en_US.po
4
+ 2. Copy default.po in you language, and open with poEdit
5
+ 3. Translate
languages/wpuf-fa_IR.mo ADDED
Binary file
languages/wpuf-fa_IR.po ADDED
@@ -0,0 +1,2593 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: WP User Frontend\n"
4
+ "POT-Creation-Date: 2015-08-14 14:56+0430\n"
5
+ "PO-Revision-Date: 2015-08-17 17:41+0430\n"
6
+ "Last-Translator: \n"
7
+ "Language-Team: Code98 Web Design Team <info@code98.ir>\n"
8
+ "Language: fa_IR\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Generator: Poedit 1.8.4\n"
13
+ "X-Poedit-Basepath: ..\n"
14
+ "X-Poedit-WPHeader: wpuf.php\n"
15
+ "Plural-Forms: nplurals=1; plural=0;\n"
16
+ "X-Poedit-SourceCharset: UTF-8\n"
17
+ "X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;"
18
+ "esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;"
19
+ "_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
20
+ "X-Poedit-SearchPath-0: .\n"
21
+ "X-Poedit-SearchPathExcluded-0: *.js\n"
22
+
23
+ #: admin/add-ons.php:2
24
+ msgid "WP User Frontend - Add-Ons"
25
+ msgstr "افزونه های ناحیه کاربری پیشرفته"
26
+
27
+ #: admin/form.php:155 admin/form.php:175 admin/form.php:177 admin/form.php:213
28
+ msgid "Forms"
29
+ msgstr "فرم ها"
30
+
31
+ #: admin/form.php:176 admin/form.php:214
32
+ msgid "Form"
33
+ msgstr "فرم"
34
+
35
+ #: admin/form.php:178 admin/form.php:216
36
+ msgid "Add Form"
37
+ msgstr "اضافه کردن فرم"
38
+
39
+ #: admin/form.php:179 admin/form.php:217
40
+ msgid "Add New Form"
41
+ msgstr "ساخت فرم جدید"
42
+
43
+ #: admin/form.php:180 admin/form.php:218 admin/installer.php:74
44
+ #: admin/subscription.php:228 class/subscription.php:324
45
+ #: includes/free/edit-user.php:99 templates/dashboard.php:102
46
+ msgid "Edit"
47
+ msgstr "ویرایش"
48
+
49
+ #: admin/form.php:181 admin/form.php:219
50
+ msgid "Edit Form"
51
+ msgstr "ویرایش فرم"
52
+
53
+ #: admin/form.php:182 admin/form.php:220
54
+ msgid "New Form"
55
+ msgstr "فرم جدید"
56
+
57
+ #: admin/form.php:183 admin/form.php:184 admin/form.php:221 admin/form.php:222
58
+ msgid "View Form"
59
+ msgstr "مشاهده فرم"
60
+
61
+ #: admin/form.php:185 admin/form.php:223
62
+ msgid "Search Form"
63
+ msgstr "جستجوی فرم"
64
+
65
+ #: admin/form.php:186 admin/form.php:224
66
+ msgid "No Form Found"
67
+ msgstr "هیچ فرمی پیدا نشد"
68
+
69
+ #: admin/form.php:187 admin/form.php:225
70
+ msgid "No Form Found in Trash"
71
+ msgstr "هیچ فرمی در زباله دان پیدا نشد"
72
+
73
+ #: admin/form.php:188 admin/form.php:226
74
+ msgid "Parent Form"
75
+ msgstr "فرم اصلی"
76
+
77
+ #: admin/form.php:193
78
+ msgid "Registraton Forms"
79
+ msgstr "فرم های ثبت نام"
80
+
81
+ #: admin/form.php:215 includes/free/loader.php:57
82
+ msgid "Registration Forms"
83
+ msgstr "فرم های ثبت نام"
84
+
85
+ #: admin/form.php:246 admin/form.php:249
86
+ msgid "Form updated."
87
+ msgstr "فرم بروزرسانی شد"
88
+
89
+ #: admin/form.php:247 admin/subscription.php:53
90
+ msgid "Custom field updated."
91
+ msgstr "فیلد دلخواه به روز شد."
92
+
93
+ #: admin/form.php:248 admin/subscription.php:54
94
+ msgid "Custom field deleted."
95
+ msgstr "فیلد دلخواه حذف شد."
96
+
97
+ #: admin/form.php:250
98
+ #, php-format
99
+ msgid "Form restored to revision from %s"
100
+ msgstr "فرم از %s به نسخه اصلاح شده بازگردانی شد"
101
+
102
+ #: admin/form.php:251
103
+ msgid "Form published."
104
+ msgstr "فرم منتشر شد"
105
+
106
+ #: admin/form.php:252
107
+ msgid "Form saved."
108
+ msgstr "فرم ذخیره شد."
109
+
110
+ #: admin/form.php:253
111
+ msgid "Form submitted."
112
+ msgstr "فرم ارسال شد"
113
+
114
+ #: admin/form.php:255
115
+ msgid "Form draft updated."
116
+ msgstr "پیش نویس فرم به روز شد"
117
+
118
+ #: admin/form.php:284 admin/form.php:303
119
+ msgid "Form Name"
120
+ msgstr "نام فرم"
121
+
122
+ #: admin/form.php:285 admin/form.php:676
123
+ msgid "Post Type"
124
+ msgstr "نوع نوشته"
125
+
126
+ #: admin/form.php:286 admin/form.php:696
127
+ msgid "Post Status"
128
+ msgstr "وضعیت نوشته"
129
+
130
+ #: admin/form.php:287 admin/form.php:745
131
+ msgid "Guest Post"
132
+ msgstr "پست مهمان"
133
+
134
+ #: admin/form.php:288 admin/form.php:305 admin/form.php:461 admin/form.php:472
135
+ msgid "Shortcode"
136
+ msgstr "کد کوتاه"
137
+
138
+ #: admin/form.php:304
139
+ msgid "User Role"
140
+ msgstr "نقش کاربر"
141
+
142
+ #: admin/form.php:339 admin/settings-options.php:86
143
+ #: admin/settings-options.php:160 admin/settings-options.php:171
144
+ #: admin/settings-options.php:253 admin/subscription.php:148
145
+ #: admin/template.php:74 includes/free/form.php:476
146
+ msgid "No"
147
+ msgstr "خیر"
148
+
149
+ #: admin/form.php:339 admin/settings-options.php:85
150
+ #: admin/settings-options.php:159 admin/settings-options.php:170
151
+ #: admin/settings-options.php:252 admin/subscription.php:146
152
+ #: admin/template.php:73 includes/free/form.php:475
153
+ msgid "Yes"
154
+ msgstr "بلی"
155
+
156
+ #: admin/form.php:386
157
+ msgid "Duplicate form"
158
+ msgstr "فرم تکراری"
159
+
160
+ #: admin/form.php:386
161
+ msgid "Duplicate"
162
+ msgstr "تکثیر کردن"
163
+
164
+ #: admin/form.php:449
165
+ msgid "WPUF Form"
166
+ msgstr "فرم WPUF"
167
+
168
+ #: admin/form.php:459 admin/form.php:470 admin/form.php:1046
169
+ #: admin/form.php:1086
170
+ msgid "Form Editor"
171
+ msgstr "ویرایشگر فرم"
172
+
173
+ #: admin/form.php:460 admin/form.php:471
174
+ msgid "Form Elements"
175
+ msgstr "عناصر فرم"
176
+
177
+ #: admin/form.php:486 admin/form.php:503
178
+ msgid "Copy and insert this shortcode to a page:"
179
+ msgstr "کپی و درج این کد کوتاه به صفحه:"
180
+
181
+ #: admin/form.php:507
182
+ msgid "Profile Shortcode:"
183
+ msgstr "کد کوتاه پروفایل:"
184
+
185
+ #: admin/form.php:515
186
+ msgid "Registration Shortcode:"
187
+ msgstr "کد کوتاه ثبت نام:"
188
+
189
+ #: admin/form.php:538
190
+ msgid "Preview Form"
191
+ msgstr "پیش نمایش فرم"
192
+
193
+ #: admin/form.php:547 admin/form.php:548
194
+ msgid "Schedule"
195
+ msgstr "زمان بندی"
196
+
197
+ #: admin/form.php:550 admin/form.php:551
198
+ msgid "Publish"
199
+ msgstr "انتشار"
200
+
201
+ #: admin/form.php:555 admin/form.php:556
202
+ msgid "Submit for Review"
203
+ msgstr "ثبت نظر"
204
+
205
+ #: admin/form.php:561 admin/form.php:562 admin/form.php:898
206
+ msgid "Update"
207
+ msgstr "به روز رسانی"
208
+
209
+ #: admin/form.php:634
210
+ msgid "This page is restricted. Please Log in / Register to view this page."
211
+ msgstr ""
212
+ "این صفحه محدود شده است. لطفا برای دیدن این صفحه وارد شوید / ثبت نام شوید ."
213
+
214
+ #: admin/form.php:643 admin/subscription.php:206 admin/template-post.php:177
215
+ #: includes/free/edit-profile.php:92
216
+ msgid "Name"
217
+ msgstr "نام"
218
+
219
+ #: admin/form.php:644 admin/form.php:1118 admin/transaction.php:107
220
+ #: includes/free/edit-user.php:152
221
+ msgid "Email"
222
+ msgstr "ایمیل"
223
+
224
+ #: admin/form.php:648
225
+ msgid "Post saved"
226
+ msgstr "مطلب ذخیره شد"
227
+
228
+ #: admin/form.php:649 admin/form.php:895
229
+ msgid "Post updated successfully"
230
+ msgstr "مطلب با موفقیت بروز رسانی شد"
231
+
232
+ #: admin/form.php:654
233
+ msgid "Submit"
234
+ msgstr "ارسال"
235
+
236
+ #: admin/form.php:655 class/render-form.php:548
237
+ msgid "Save Draft"
238
+ msgstr "ذخیره به عنوان پیش نویس"
239
+
240
+ #: admin/form.php:656
241
+ msgid "Preview"
242
+ msgstr "پیش نمایش"
243
+
244
+ #: admin/form.php:664 admin/form.php:668
245
+ msgid "Disable Subscription"
246
+ msgstr "غیر فعال کردن اشتراک"
247
+
248
+ #: admin/form.php:671
249
+ msgid ""
250
+ "If checked, any subscription and pay-per-post will be disabled on the form "
251
+ "and will take no effect."
252
+ msgstr ""
253
+ "اگر این گزینه فعال شود، اشتراک و پرداخت به ازای ارسال مطلب برای این فرم "
254
+ "غیرفعال خواهد شد."
255
+
256
+ #: admin/form.php:710
257
+ msgid "Post Format"
258
+ msgstr "قالب نوشته"
259
+
260
+ #: admin/form.php:713 admin/form.php:737
261
+ msgid "- None -"
262
+ msgstr "-هیچ کدام-"
263
+
264
+ #: admin/form.php:729
265
+ msgid "Default Post Category"
266
+ msgstr "دسته بندی پیشفرض نوشته"
267
+
268
+ #: admin/form.php:740
269
+ msgid ""
270
+ "If users are not allowed to choose any category, this category will be used "
271
+ "instead (if post type supports)"
272
+ msgstr ""
273
+ "اگر کاربران مجاز به انتخاب دسته بندی نباشند، به صورت پیشفرض این دسته انتخاب "
274
+ "خواهد شد. (در صورت پشتیبانی از نوع نوشته)"
275
+
276
+ #: admin/form.php:750
277
+ msgid "Enable Guest Post"
278
+ msgstr "فعال کردن پست مهمان"
279
+
280
+ #: admin/form.php:752
281
+ msgid "Unregistered users will be able to submit posts"
282
+ msgstr "کاربر مهمان قادر به ارسال نوشته خواهد بود."
283
+
284
+ #: admin/form.php:757
285
+ msgid "User Details"
286
+ msgstr "جزئیات کاربر"
287
+
288
+ #: admin/form.php:762
289
+ msgid "Require Name and Email address"
290
+ msgstr "نیاز به نام و آدرس ایمیل"
291
+
292
+ #: admin/form.php:764
293
+ msgid ""
294
+ "If requires, users will be automatically registered to the site using the "
295
+ "name and email address"
296
+ msgstr ""
297
+ "اگر لازم بود، کاربران به طور خودکار با استفاده از نام و آدرس ایمیل در سایت "
298
+ "عضو خواهند شد"
299
+
300
+ #: admin/form.php:769
301
+ msgid "Name Label"
302
+ msgstr "برچسب نام"
303
+
304
+ #: admin/form.php:774
305
+ msgid "Label text for name field"
306
+ msgstr "متن برچسب برای فیلد نام"
307
+
308
+ #: admin/form.php:779
309
+ msgid "E-Mail Label"
310
+ msgstr "برچسب ایمیل"
311
+
312
+ #: admin/form.php:784
313
+ msgid "Label text for email field"
314
+ msgstr "متن برچسب برای فیلد ایمیل"
315
+
316
+ #: admin/form.php:789 admin/settings-options.php:216
317
+ msgid "Unauthorized Message"
318
+ msgstr "پیام های غیر مجاز"
319
+
320
+ #: admin/form.php:792 admin/settings-options.php:217
321
+ msgid "Not logged in users will see this message"
322
+ msgstr "کابرانی که وارد حساب خود نشده اند این پیغام را مشاهده خواهند کرد."
323
+
324
+ #: admin/form.php:797 admin/form.php:921 includes/free/form.php:374
325
+ msgid "Redirect To"
326
+ msgstr "هدایت به"
327
+
328
+ #: admin/form.php:802 admin/form.php:926
329
+ msgid "Newly created post"
330
+ msgstr "نوشته های اخیرا ایجاد شده"
331
+
332
+ #: admin/form.php:803 admin/form.php:927 includes/free/form.php:379
333
+ msgid "Same Page"
334
+ msgstr "همان برگه"
335
+
336
+ #: admin/form.php:804 admin/form.php:928 includes/free/form.php:380
337
+ msgid "To a page"
338
+ msgstr "به یک برگه"
339
+
340
+ #: admin/form.php:805 admin/form.php:929 includes/free/form.php:381
341
+ msgid "To a custom URL"
342
+ msgstr "به یک لینک دلخواه"
343
+
344
+ #: admin/form.php:814 admin/form.php:938 includes/free/form.php:390
345
+ msgid "After successfull submit, where the page will redirect to"
346
+ msgstr "پس از ارسال موفق، صفحه هدایت می شود به:"
347
+
348
+ #: admin/form.php:820
349
+ msgid "Message to show"
350
+ msgstr "پیغام برای نمایش"
351
+
352
+ #: admin/form.php:828 admin/form.php:951 includes/free/form.php:410
353
+ msgid "Page"
354
+ msgstr "برگه"
355
+
356
+ #: admin/form.php:843 admin/form.php:966 includes/free/form.php:425
357
+ msgid "Custom URL"
358
+ msgstr "لینک دلخواه"
359
+
360
+ #: admin/form.php:850
361
+ msgid "Comment Status"
362
+ msgstr "وضعیت دیدگاه"
363
+
364
+ #: admin/form.php:853
365
+ msgid "Open"
366
+ msgstr "باز"
367
+
368
+ #: admin/form.php:854
369
+ msgid "Closed"
370
+ msgstr "بسته"
371
+
372
+ #: admin/form.php:860
373
+ msgid "Submit Post Button text"
374
+ msgstr "متن دکمه ی ارسال"
375
+
376
+ #: admin/form.php:867
377
+ msgid "Post Draft"
378
+ msgstr "ارسال پیش نویس"
379
+
380
+ #: admin/form.php:872
381
+ msgid "Enable Saving as draft"
382
+ msgstr "فعال کردن ذخیره به عنوان پیش نویس"
383
+
384
+ #: admin/form.php:874
385
+ msgid "It will show a button to save as draft"
386
+ msgstr "این یک دکمه برای ذخیره به عنوان پیش نویس نشان خواهد داد."
387
+
388
+ #: admin/form.php:904
389
+ msgid "Set Post Status to"
390
+ msgstr "تنظیم وضعیت نوشته به"
391
+
392
+ #: admin/form.php:914
393
+ msgid "No Change"
394
+ msgstr "بدون تغییر"
395
+
396
+ #: admin/form.php:944
397
+ msgid "Post Update Message"
398
+ msgstr "پیام به روز رسانی نوشته"
399
+
400
+ #: admin/form.php:973
401
+ msgid "Subscription Title"
402
+ msgstr "عنوان اشتراک"
403
+
404
+ #: admin/form.php:982
405
+ msgid "Update Post Button text"
406
+ msgstr "متن دکمه بروزرسانی نوشته"
407
+
408
+ #: admin/form.php:995 admin/form.php:999
409
+ msgid "- Select -"
410
+ msgstr "- انتخاب -"
411
+
412
+ #: admin/form.php:1047
413
+ msgid "Post Settings"
414
+ msgstr "تنظیمات نوشته"
415
+
416
+ #: admin/form.php:1048
417
+ msgid "Edit Settings"
418
+ msgstr "تنظیمات ویرایش"
419
+
420
+ #: admin/form.php:1049 includes/free/form.php:211 includes/free/form.php:248
421
+ msgid "Notification"
422
+ msgstr "اعلان"
423
+
424
+ #: admin/form.php:1050 includes/free/form.php:55
425
+ msgid "Post Expiration"
426
+ msgstr "انقضاء نوشته"
427
+
428
+ #: admin/form.php:1087 admin/settings.php:69
429
+ msgid "Settings"
430
+ msgstr "تنظیمات"
431
+
432
+ #: admin/form.php:1107 admin/form.php:1148 admin/form.php:1149
433
+ #: admin/form.php:1150 admin/form.php:1151 admin/form.php:1152
434
+ #: admin/form.php:1153 includes/free/form.php:6 includes/free/form.php:26
435
+ msgid "Click to add to the editor"
436
+ msgstr "برای اضافه شدن به ویرایشگر کلیک کنید."
437
+
438
+ #: admin/form.php:1109
439
+ msgid "Custom Fields"
440
+ msgstr "زمینه های دلخواه"
441
+
442
+ #: admin/form.php:1111
443
+ msgid "Text"
444
+ msgstr "متن"
445
+
446
+ #: admin/form.php:1112 admin/template.php:185
447
+ msgid "Textarea"
448
+ msgstr "ناحیه متنی"
449
+
450
+ #: admin/form.php:1113 admin/template-post.php:166
451
+ msgid "Dropdown"
452
+ msgstr "کرکره ای"
453
+
454
+ #: admin/form.php:1114 admin/template-post.php:167
455
+ msgid "Multi Select"
456
+ msgstr "چند انتخابی"
457
+
458
+ #: admin/form.php:1115
459
+ msgid "Radio"
460
+ msgstr "دکمه رادیویی"
461
+
462
+ #: admin/form.php:1116 admin/template-post.php:168
463
+ msgid "Checkbox"
464
+ msgstr "چک باکس"
465
+
466
+ #: admin/form.php:1117
467
+ msgid "URL"
468
+ msgstr "آدرس اینترنتی"
469
+
470
+ #: admin/form.php:1119
471
+ msgid "Hidden Field"
472
+ msgstr "فیلد مخفی"
473
+
474
+ #: admin/form.php:1126
475
+ msgid "Others"
476
+ msgstr "سایر"
477
+
478
+ #: admin/form.php:1128
479
+ msgid "Section Break"
480
+ msgstr "Section Break"
481
+
482
+ #: admin/form.php:1129
483
+ msgid "HTML"
484
+ msgstr "HTML"
485
+
486
+ #: admin/form.php:1146
487
+ msgid "Post Fields"
488
+ msgstr "زمینه های نوشته"
489
+
490
+ #: admin/form.php:1148
491
+ msgid "Post Title"
492
+ msgstr "عنوان نوشته"
493
+
494
+ #: admin/form.php:1149
495
+ msgid "Post Body"
496
+ msgstr "متن نوشته"
497
+
498
+ #: admin/form.php:1150
499
+ msgid "Excerpt"
500
+ msgstr "خلاصه مطلب"
501
+
502
+ #: admin/form.php:1151
503
+ msgid "Tags"
504
+ msgstr "برچسب ها"
505
+
506
+ #: admin/form.php:1152
507
+ msgid "Category"
508
+ msgstr "دسته بندی"
509
+
510
+ #: admin/form.php:1153 templates/dashboard.php:23
511
+ msgid "Featured Image"
512
+ msgstr "تصویر شاخص"
513
+
514
+ #: admin/form.php:1159
515
+ msgid "Custom Taxonomies"
516
+ msgstr "طبقه بندی سفارشی"
517
+
518
+ #: admin/form.php:1183
519
+ msgid "Profile Fields"
520
+ msgstr "فیلد های پروفایل"
521
+
522
+ #: admin/form.php:1185 admin/form.php:1599 includes/free/edit-profile.php:96
523
+ #: includes/free/edit-user.php:92 includes/free/edit-user.php:144
524
+ #: templates/login-form.php:21
525
+ msgid "Username"
526
+ msgstr "نام کاربری"
527
+
528
+ #: admin/form.php:1186 admin/form.php:1603 includes/free/edit-profile.php:100
529
+ msgid "First Name"
530
+ msgstr "نام"
531
+
532
+ #: admin/form.php:1187 admin/form.php:1607 includes/free/edit-profile.php:105
533
+ msgid "Last Name"
534
+ msgstr "نام خانوادگی"
535
+
536
+ #: admin/form.php:1188 admin/form.php:1611 includes/free/edit-profile.php:110
537
+ msgid "Nickname"
538
+ msgstr "نام مستعار"
539
+
540
+ #: admin/form.php:1189 admin/form.php:1615 includes/free/edit-profile.php:151
541
+ msgid "E-mail"
542
+ msgstr "ایمیل"
543
+
544
+ #: admin/form.php:1190 admin/form.php:1619 includes/free/edit-profile.php:156
545
+ msgid "Website"
546
+ msgstr "وبسایت"
547
+
548
+ #: admin/form.php:1191 admin/form.php:1623 includes/free/edit-profile.php:178
549
+ msgid "Biographical Info"
550
+ msgstr "اطلاعت بیوگرافی"
551
+
552
+ #: admin/form.php:1192 admin/form.php:1627 templates/login-form.php:25
553
+ msgid "Password"
554
+ msgstr "کلمه عبور"
555
+
556
+ #: admin/form.php:1193 admin/form.php:1631
557
+ msgid "Avatar"
558
+ msgstr "آواتار"
559
+
560
+ #: admin/form.php:1353 includes/free/form.php:301
561
+ msgid "Toggle All"
562
+ msgstr "باز/بستن همه"
563
+
564
+ #: admin/form.php:1357 includes/free/form.php:305
565
+ msgid "Click on a form element to add to the editor"
566
+ msgstr "برای اضافه شدن به ویرایش گر روی عنصری از فرم کلیک کنید"
567
+
568
+ #: admin/installer.php:27
569
+ msgid ""
570
+ "If you have not created <strong>WP User Frontend Pro</strong> pages yet, you "
571
+ "can do this by one click."
572
+ msgstr ""
573
+ "اگر شما برگه های افزونه <strong>ناحیه کاربری پیشرفته</strong> را هنوز نساخته "
574
+ "اید، با یک کلیک اینکار را انجام دهید."
575
+
576
+ #: admin/installer.php:30 admin/tools.php:348
577
+ msgid "Install WPUF Pages"
578
+ msgstr "نصب برگه های WPUF"
579
+
580
+ #: admin/installer.php:32
581
+ msgid "Skip Setup"
582
+ msgstr "رد کردن نصب"
583
+
584
+ #: admin/installer.php:42
585
+ msgid "Congratulations!"
586
+ msgstr "تبریک می گویم!"
587
+
588
+ #: admin/installer.php:42
589
+ msgid ""
590
+ "Pages for <strong>WP User Frontend Pro</strong> has been successfully "
591
+ "installed and saved!"
592
+ msgstr ""
593
+ "برگه های <strong>ناحیه کاربری پیشرفته</strong> با موفقیت ساخته و ذخیره شد!"
594
+
595
+ #: admin/installer.php:73 admin/settings-options.php:17
596
+ msgid "Dashboard"
597
+ msgstr "پیشخوان"
598
+
599
+ #: admin/installer.php:77
600
+ msgid "Login"
601
+ msgstr "ورود"
602
+
603
+ #: admin/installer.php:82 admin/settings.php:62 class/subscription.php:299
604
+ #: class/subscription.php:319 class/subscription.php:320
605
+ #: class/subscription.php:321
606
+ msgid "Subscription"
607
+ msgstr "مشترک شدن"
608
+
609
+ #: admin/installer.php:82
610
+ msgid "[wpuf_sub_pack]"
611
+ msgstr "[wpuf_sub_pack]"
612
+
613
+ #: admin/installer.php:83 templates/dashboard.php:33
614
+ msgid "Payment"
615
+ msgstr "پرداخت"
616
+
617
+ #: admin/installer.php:83
618
+ msgid "Please select a gateway for payment"
619
+ msgstr "لطفا یک دروازه پرداخت انتخاب کنید"
620
+
621
+ #: admin/installer.php:84
622
+ msgid "Thank You"
623
+ msgstr "متشکرم"
624
+
625
+ #: admin/installer.php:84
626
+ msgid ""
627
+ "<h1>Payment is complete</h1><p>Congratulations, your payment has been "
628
+ "completed!</p>"
629
+ msgstr ""
630
+ "<h1>پرداخت تکمیل شد</h1><p>تبریک می گویم، پرداخت شما تکمیل شده است!</p>"
631
+
632
+ #: admin/installer.php:85
633
+ msgid "Order Received"
634
+ msgstr "سفارش دریافت شد"
635
+
636
+ #: admin/installer.php:85
637
+ msgid ""
638
+ "Hi, we have received your order. We will validate the order and will take "
639
+ "necessary steps to move forward."
640
+ msgstr ""
641
+ "سلام، ما سفارش شما را دریافت کرده ایم. تایید سفارش و اقدامات لازم را انجام "
642
+ "خواهیم داد."
643
+
644
+ #: admin/installer.php:104 admin/installer.php:160
645
+ msgid "Registration"
646
+ msgstr "ثبت نام"
647
+
648
+ #: admin/installer.php:225
649
+ msgid "Sample Form"
650
+ msgstr "فرم نمونه"
651
+
652
+ #: admin/posting.php:38 class/render-form.php:1404 wpuf.php:283
653
+ msgid "Are you sure?"
654
+ msgstr "آیا مطمئن هستید؟"
655
+
656
+ #: admin/posting.php:44 wpuf.php:289
657
+ msgid "Allowed Files"
658
+ msgstr "فایل های مجاز"
659
+
660
+ #: admin/posting.php:55
661
+ msgid "WPUF Custom Fields"
662
+ msgstr "زمینه های دلخواه افزونه ناحیه کاربری پیشرفته"
663
+
664
+ #: admin/posting.php:83
665
+ msgid "No custom fields found."
666
+ msgstr "هیچ زمینه دلخواهی یافت نشد."
667
+
668
+ #: admin/settings-options.php:13
669
+ msgid "General Options"
670
+ msgstr "تنظیمات عمومی"
671
+
672
+ #: admin/settings-options.php:21
673
+ msgid "Login / Registration"
674
+ msgstr "ورود / ثبت نام"
675
+
676
+ #: admin/settings-options.php:25
677
+ msgid "Payments"
678
+ msgstr "پرداخت ها"
679
+
680
+ #: admin/settings-options.php:29
681
+ msgid "Support"
682
+ msgstr "پشتیبانی"
683
+
684
+ #: admin/settings-options.php:44
685
+ msgid "Fixed Form Elements "
686
+ msgstr "عناصر ثابت فرم"
687
+
688
+ #: admin/settings-options.php:45
689
+ msgid "Show fixed form elements sidebar in form editor"
690
+ msgstr "نمایش ستون کناری عناصر ثابت فرم در ویرایشگر فرم"
691
+
692
+ #: admin/settings-options.php:51
693
+ msgid "Edit Page"
694
+ msgstr "برگه ویرایش"
695
+
696
+ #: admin/settings-options.php:52
697
+ msgid "Select the page where [wpuf_edit] is located"
698
+ msgstr "انتخاب برگه ای که [wpuf_edit] در آن واقع شده است"
699
+
700
+ #: admin/settings-options.php:58
701
+ msgid "Default Post Owner"
702
+ msgstr "مالک پیشفرض نوشته"
703
+
704
+ #: admin/settings-options.php:59
705
+ msgid ""
706
+ "If guest post is enabled and user details are OFF, the posts are assigned to "
707
+ "this user"
708
+ msgstr ""
709
+ "اگر پست مهمان فعال و جزئیات کاربر خاموش باشد، نوشته ها به این کاربر اختصاص "
710
+ "داده می شود"
711
+
712
+ #: admin/settings-options.php:66
713
+ msgid "Admin area access"
714
+ msgstr "دسترسی بخش مدیریت"
715
+
716
+ #: admin/settings-options.php:67
717
+ msgid "Allow you to block specific user role to WordPress admin area."
718
+ msgstr ""
719
+ "به شما اجازه داده می شود تا دسترسی یک نقش کاربری خاص را به صفحه مدیریت "
720
+ "وردپرس مسدود نمایید."
721
+
722
+ #: admin/settings-options.php:71
723
+ msgid "Admin Only"
724
+ msgstr "فقط مدیر"
725
+
726
+ #: admin/settings-options.php:72
727
+ msgid "Admins, Editors"
728
+ msgstr "مدیران، ویرایشگران"
729
+
730
+ #: admin/settings-options.php:73
731
+ msgid "Admins, Editors, Authors"
732
+ msgstr "مدیران، ویرایشگران، نویسندگان"
733
+
734
+ #: admin/settings-options.php:74
735
+ msgid "Admins, Editors, Authors, Contributors"
736
+ msgstr "مدیران، ویرایشگران، نویسندگان، مشترکان"
737
+
738
+ #: admin/settings-options.php:75
739
+ msgid "Default"
740
+ msgstr "پیش‌فرض"
741
+
742
+ #: admin/settings-options.php:80
743
+ msgid "Override the post edit link"
744
+ msgstr "نادیده گرفتن لینک ویرایش نوشته"
745
+
746
+ #: admin/settings-options.php:81
747
+ msgid ""
748
+ "Users see the edit link in post if s/he is capable to edit the post/page. "
749
+ "Selecting <strong>Yes</strong> will override the default WordPress edit post "
750
+ "link in frontend"
751
+ msgstr ""
752
+ "اگر کابران مجاز به ویرایش نوشته/برگه باشند، لینک ویرایش را در نوشته مشاهده "
753
+ "می کنند. با انتخاب گزینه <strong>بله</strong> ، لینک پیشفرض ویرایش نوشته "
754
+ "وردپرس نادیده گرفته خواهد شد."
755
+
756
+ #: admin/settings-options.php:91
757
+ msgid "Custom Fields in post"
758
+ msgstr "زمینه های دلخواه در نوشته"
759
+
760
+ #: admin/settings-options.php:92
761
+ msgid "Show custom fields on post content area"
762
+ msgstr "نمایش زمینه های دلخواه در ناحیه محتوای نوشته"
763
+
764
+ #: admin/settings-options.php:98
765
+ msgid "Load Scripts"
766
+ msgstr "بارگذاری اسکریپت ها"
767
+
768
+ #: admin/settings-options.php:99
769
+ msgid "Load scripts/styles in all pages"
770
+ msgstr "بارگذاری تمام اسکریپت ها و استایل ها در تمام برگه ها"
771
+
772
+ #: admin/settings-options.php:105
773
+ msgid "Insert Photo image size"
774
+ msgstr "اندازه تصویر را درج کنید"
775
+
776
+ #: admin/settings-options.php:106
777
+ msgid ""
778
+ "Default image size of \"<strong>Insert Photo</strong>\" button in post "
779
+ "content area"
780
+ msgstr ""
781
+ "اندازه پیشفرض تصویری که با دکمه \"<strong>افزودن تصویر</strong>\" در متن "
782
+ "نوشته بارگذاری می شود"
783
+
784
+ #: admin/settings-options.php:113
785
+ msgid "Insert Photo image type"
786
+ msgstr "نوع تصویر را درج کنید"
787
+
788
+ #: admin/settings-options.php:114
789
+ msgid ""
790
+ "Default image type of \"<strong>Insert Photo</strong>\" button in post "
791
+ "content area"
792
+ msgstr ""
793
+ "نوع پیشفرض تصویری که با دکمه \"<strong>افزودن تصویر</strong>\" در متن نوشته "
794
+ "بارگذاری می شود"
795
+
796
+ #: admin/settings-options.php:117
797
+ msgid "Image only"
798
+ msgstr "فقط تصویر"
799
+
800
+ #: admin/settings-options.php:118
801
+ msgid "Image with link"
802
+ msgstr "تصویر با لینک"
803
+
804
+ #: admin/settings-options.php:124
805
+ msgid "Enable Image Caption"
806
+ msgstr "فعال کردن برچسب تصویر"
807
+
808
+ #: admin/settings-options.php:125
809
+ msgid "Allow users to update image/video title, caption and description"
810
+ msgstr "کاربران اجازه بروزرسانی عنوان، برچسب و توضیحات تصویر/ویدئو را دارند."
811
+
812
+ #: admin/settings-options.php:131
813
+ msgid "Default Post Form"
814
+ msgstr "فرم ارسال پیش فرض"
815
+
816
+ #: admin/settings-options.php:132
817
+ msgid "Fallback form for post editing if no associated form found"
818
+ msgstr "اگر هیچ فرم خاصی معین نشود، فرم ویرایش نوشته در نظر گرفته خواهد شد."
819
+
820
+ #: admin/settings-options.php:138
821
+ msgid "reCAPTCHA Public Key"
822
+ msgstr "کلید عمومی reCAPTCHA"
823
+
824
+ #: admin/settings-options.php:142
825
+ msgid "reCAPTCHA Private Key"
826
+ msgstr "کلید خصوصی reCAPTCHA"
827
+
828
+ #: admin/settings-options.php:146
829
+ msgid "Custom CSS codes"
830
+ msgstr "کدهای CSS سفارشی"
831
+
832
+ #: admin/settings-options.php:147
833
+ msgid ""
834
+ "If you want to add your custom CSS code, it will be added on page header "
835
+ "wrapped with style tag"
836
+ msgstr ""
837
+ "اگر شما قصد اضافه کردن کدهای سفارشی CSS را دارید، آنها در بخش head و در بین "
838
+ "تگ style قرار خواهند گرفت."
839
+
840
+ #: admin/settings-options.php:154
841
+ msgid "Users can edit post?"
842
+ msgstr "کاربران می توانند نوشته را ویرایش کنند؟"
843
+
844
+ #: admin/settings-options.php:155
845
+ msgid "Users will be able to edit their own posts"
846
+ msgstr "کاربران قادر خواهند بود نوشته های خود را ویرایش کنند"
847
+
848
+ #: admin/settings-options.php:165
849
+ msgid "User can delete post?"
850
+ msgstr "کاربر می تواند نوشته را حذف کند؟"
851
+
852
+ #: admin/settings-options.php:166
853
+ msgid "Users will be able to delete their own posts"
854
+ msgstr "کاربران قادر خواهند بود نوشته های خود را حذف کنند"
855
+
856
+ #: admin/settings-options.php:176
857
+ msgid "Pending Post Edit"
858
+ msgstr "ویرایش نوشته در حال انتظار"
859
+
860
+ #: admin/settings-options.php:177
861
+ msgid "Disable post editing while post in \"pending\" status"
862
+ msgstr ""
863
+ "غیرفعال کردن ویرایش نوشته وقتی نوشته در وضعیت انتظار برای تایید قرار دارد"
864
+
865
+ #: admin/settings-options.php:183
866
+ msgid "Posts per page"
867
+ msgstr "تعداد نوشته در هر صفحه"
868
+
869
+ #: admin/settings-options.php:184
870
+ msgid "How many posts will be listed in a page"
871
+ msgstr "تعداد نوشته هایی که در یک صفحه لیست خواهند شد"
872
+
873
+ #: admin/settings-options.php:190
874
+ msgid "Show user bio"
875
+ msgstr "نمایش بیوگرافی کاربر"
876
+
877
+ #: admin/settings-options.php:191
878
+ msgid "Users biographical info will be shown"
879
+ msgstr "اطلاعات بیوگرافی کاربران نشان داده خواهد شد"
880
+
881
+ #: admin/settings-options.php:197
882
+ msgid "Show post count"
883
+ msgstr "نمایش تعداد ارسال ها"
884
+
885
+ #: admin/settings-options.php:198
886
+ msgid "Show how many posts are created by the user"
887
+ msgstr "نمایش تعداد نوشته هایی که کاربر ایجاد کرده است"
888
+
889
+ #: admin/settings-options.php:204
890
+ msgid "Show Featured Image"
891
+ msgstr "نمایش تصویر شاخص"
892
+
893
+ #: admin/settings-options.php:205
894
+ msgid "Show featured image of the post"
895
+ msgstr "نمایش تصویر شاخص نوشته"
896
+
897
+ #: admin/settings-options.php:210
898
+ msgid "Featured Image size"
899
+ msgstr "اندازه تصویر شاخص"
900
+
901
+ #: admin/settings-options.php:224
902
+ msgid "Login/Registration override"
903
+ msgstr "نادیده گرفتن ورود / عضویت"
904
+
905
+ #: admin/settings-options.php:225
906
+ msgid ""
907
+ "If enabled, default login and registration forms will be overridden by WPUF "
908
+ "with pages below"
909
+ msgstr ""
910
+ "اگر فعال باشد، فرم های پیشفرض عضویت و ورود نادیده خواهند گرفته شد و برگه های "
911
+ "زیر استفاده می شوند"
912
+
913
+ #: admin/settings-options.php:231
914
+ msgid "Registration Page"
915
+ msgstr "برگه ثبت نام"
916
+
917
+ #: admin/settings-options.php:232
918
+ msgid ""
919
+ "Select the page you want to use as registration page override <em>(should "
920
+ "have shortcode)</em>"
921
+ msgstr ""
922
+ "برگه فرم عضویت را انتخاب نمایید <em>(برگه باید حاوی کد کوتاه باشد)</em>"
923
+
924
+ #: admin/settings-options.php:238
925
+ msgid "Login Page"
926
+ msgstr "برگه ورود"
927
+
928
+ #: admin/settings-options.php:239
929
+ msgid "Select the page which contains <code>[wpuf-login]</code> shortcode"
930
+ msgstr ""
931
+ "برگه ای که حاوی کد کوتاه <code>[wpuf-login]</code> است را انتخاب نمایید"
932
+
933
+ #: admin/settings-options.php:247
934
+ msgid "Charge for posting"
935
+ msgstr "شارژ برای ارسال"
936
+
937
+ #: admin/settings-options.php:248
938
+ msgid "Charge user for submitting a post"
939
+ msgstr "شارژ کاربر برای ارسال یک نوشته"
940
+
941
+ #: admin/settings-options.php:258
942
+ msgid "Force pack purchase"
943
+ msgstr "اجبار به خرید بسته"
944
+
945
+ #: admin/settings-options.php:259
946
+ msgid "When active, users must have to buy a pack for posting"
947
+ msgstr "در صورت فعال کردن، کابران برای انتشار نوشته باید یک بسته بخرند."
948
+
949
+ #: admin/settings-options.php:263
950
+ msgid "Disable"
951
+ msgstr "غیر فعال کردن"
952
+
953
+ #: admin/settings-options.php:264
954
+ msgid "Enable"
955
+ msgstr "فعال کردن"
956
+
957
+ #: admin/settings-options.php:269
958
+ msgid "Subscription Pack Page"
959
+ msgstr "برگه بسته اشتراک"
960
+
961
+ #: admin/settings-options.php:270
962
+ msgid "Select the page where <code>[wpuf_sub_pack]</code> located."
963
+ msgstr "انتخاب برگه ای که در آن <code>[wpuf_sub_pack]</code> واقع شده است."
964
+
965
+ #: admin/settings-options.php:276
966
+ msgid "Subscription at registration"
967
+ msgstr "اشتراک در هنگام ثبت نام"
968
+
969
+ #: admin/settings-options.php:277
970
+ msgid "Registration time redirect to subscription page"
971
+ msgstr "در زمان ثبت نام، انتقال به برگه اشتراک صورت بگیرد"
972
+
973
+ #: admin/settings-options.php:282
974
+ msgid "Currency"
975
+ msgstr "واحد پول"
976
+
977
+ #: admin/settings-options.php:314
978
+ msgid "Currency Symbol"
979
+ msgstr "نماد ارز"
980
+
981
+ #: admin/settings-options.php:320 admin/subscription.php:208
982
+ #: admin/transaction.php:103 admin/transaction.php:181
983
+ msgid "Cost"
984
+ msgstr "هزینه"
985
+
986
+ #: admin/settings-options.php:321
987
+ msgid "Cost per post"
988
+ msgstr "هزینه هر نوشته"
989
+
990
+ #: admin/settings-options.php:327
991
+ msgid "Enable demo/sandbox mode"
992
+ msgstr "فعال کردن نسخه ی نمایشی / حالت سند باکس"
993
+
994
+ #: admin/settings-options.php:328
995
+ msgid ""
996
+ "When sandbox mode is active, all payment gateway will be used in demo mode"
997
+ msgstr ""
998
+ "هنگامی که حالت سند باکس فعال است، تمام دروازه های پرداخت در حالت آزمایشی "
999
+ "قرار دارند."
1000
+
1001
+ #: admin/settings-options.php:334
1002
+ msgid "Payment Page"
1003
+ msgstr "برگه پرداخت"
1004
+
1005
+ #: admin/settings-options.php:335
1006
+ msgid "This page will be used to process payment options"
1007
+ msgstr "این صفحه برای پردازش گزینه های پرداخت استفاده می شود"
1008
+
1009
+ #: admin/settings-options.php:341
1010
+ msgid "Payment Success Page"
1011
+ msgstr "برگه پرداخت موفق"
1012
+
1013
+ #: admin/settings-options.php:342 lib/gateway/bank.php:37
1014
+ msgid "After payment users will be redirected here"
1015
+ msgstr "پس از پرداخت کاربران به اینجا هدایت می شوند"
1016
+
1017
+ #: admin/settings-options.php:348
1018
+ msgid "Payment Gateways"
1019
+ msgstr "دروازه‌های پرداخت"
1020
+
1021
+ #: admin/settings-options.php:349
1022
+ msgid "Active payment gateways"
1023
+ msgstr "دروازه های پرداخت فعال"
1024
+
1025
+ #: admin/settings-options.php:357
1026
+ msgid "Need Help?"
1027
+ msgstr "به کمک نیاز دارید؟"
1028
+
1029
+ #: admin/settings-options.php:388
1030
+ msgid ""
1031
+ "Select profile/registration forms for user roles. These forms will be used "
1032
+ "to populate extra edit profile fields in backend."
1033
+ msgstr ""
1034
+ "انتخاب فرم های ثبت نام/پروفایل برای نقش های کاربری. این فرم ها برای افزایش "
1035
+ "تعداد فیلدهای ویرایش پروفایل استفاده خواهند شد."
1036
+
1037
+ #: admin/settings-options.php:399
1038
+ msgid " - select - "
1039
+ msgstr "- انتخاب -"
1040
+
1041
+ #. Plugin Name of the plugin/theme
1042
+ #: admin/settings.php:55
1043
+ msgid "WP User Frontend"
1044
+ msgstr "افزونه ناحیه کابری پیشرفته"
1045
+
1046
+ #: admin/settings.php:55
1047
+ msgid "User Frontend"
1048
+ msgstr "ناحیه کاربری پیشرفته"
1049
+
1050
+ #: admin/settings.php:66
1051
+ msgid "Transaction"
1052
+ msgstr "تراکنش"
1053
+
1054
+ #: admin/settings.php:67
1055
+ msgid "Add-ons"
1056
+ msgstr "افزونه ها"
1057
+
1058
+ #: admin/settings.php:68 admin/tools.php:398
1059
+ msgid "Tools"
1060
+ msgstr "ابزارها"
1061
+
1062
+ #: admin/subscription.php:52 admin/subscription.php:55
1063
+ msgid "Subscription pack updated."
1064
+ msgstr "بسته اشتراک بروز رسانی شد."
1065
+
1066
+ #: admin/subscription.php:56
1067
+ #, php-format
1068
+ msgid "Subscription pack restored to revision from %s"
1069
+ msgstr "بسته اشتراک از %s به نسخه اصلاح شده بازگردانی شد"
1070
+
1071
+ #: admin/subscription.php:57
1072
+ msgid "Subscription pack published."
1073
+ msgstr "بسته اشتراک منتشر شد."
1074
+
1075
+ #: admin/subscription.php:58
1076
+ msgid "Subscription pack saved."
1077
+ msgstr "بسته اشتراک ذخیره شد."
1078
+
1079
+ #: admin/subscription.php:59
1080
+ msgid "Subscription pack submitted."
1081
+ msgstr "بسته اشتراک ارسال شد."
1082
+
1083
+ #: admin/subscription.php:61
1084
+ msgid "Subscription pack draft updated."
1085
+ msgstr "پیش نویس بسته اشتراک به روز شد."
1086
+
1087
+ #: admin/subscription.php:134 admin/subscription.php:460
1088
+ #: class/subscription.php:624 class/subscription.php:767
1089
+ #: class/subscription.php:778 class/subscription.php:791
1090
+ msgid "Free"
1091
+ msgstr "رایگان"
1092
+
1093
+ #: admin/subscription.php:171 class/subscription.php:241
1094
+ msgid "Pack Name"
1095
+ msgstr "نام بسته"
1096
+
1097
+ #: admin/subscription.php:172
1098
+ msgid "Amount"
1099
+ msgstr "مبلغ"
1100
+
1101
+ #: admin/subscription.php:173 includes/free/subscription.php:8
1102
+ msgid "Recurring"
1103
+ msgstr "در محدوده زمانی معین"
1104
+
1105
+ #: admin/subscription.php:174
1106
+ msgid "Duration"
1107
+ msgstr "مدت"
1108
+
1109
+ #: admin/subscription.php:197
1110
+ msgid "Pack Deleted"
1111
+ msgstr "بسته حذف شد"
1112
+
1113
+ #: admin/subscription.php:207 admin/template.php:599 class/upload.php:123
1114
+ #: wpuf-functions.php:655
1115
+ msgid "Description"
1116
+ msgstr "توضیحات"
1117
+
1118
+ #: admin/subscription.php:209
1119
+ msgid "Validity"
1120
+ msgstr "اعتبار"
1121
+
1122
+ #: admin/subscription.php:210
1123
+ msgid "Post Count"
1124
+ msgstr "تعداد نوشته"
1125
+
1126
+ #: admin/subscription.php:211 admin/transaction.php:184
1127
+ #: includes/free/edit-user.php:93
1128
+ msgid "Action"
1129
+ msgstr "اقدام"
1130
+
1131
+ #: admin/subscription.php:231
1132
+ msgid "Are you sure to delete this pack?"
1133
+ msgstr "آیا مطمئن هستید می‌خواهید این بسته را حذف کنید؟"
1134
+
1135
+ #: admin/subscription.php:232 class/render-form.php:1404 class/upload.php:128
1136
+ #: includes/free/edit-user.php:100 templates/dashboard.php:112
1137
+ msgid "Delete"
1138
+ msgstr "حذف"
1139
+
1140
+ #: admin/subscription.php:243
1141
+ msgid "No subscription pack found"
1142
+ msgstr "هیچ بسته اشتراکی یافت نشد"
1143
+
1144
+ #: admin/subscription.php:290
1145
+ msgid "Pack Description"
1146
+ msgstr "توضیحات بسته"
1147
+
1148
+ #: admin/subscription.php:297
1149
+ msgid "Billing amount:"
1150
+ msgstr "مبلغ صورت حساب"
1151
+
1152
+ #: admin/subscription.php:298
1153
+ msgid "Billing amount each cycle:"
1154
+ msgstr "مبلغ صورت حساب هر دوره:"
1155
+
1156
+ #: admin/subscription.php:306
1157
+ msgid "Expires In:"
1158
+ msgstr "انقضا در:"
1159
+
1160
+ #: admin/subscription.php:328 includes/free/form.php:59
1161
+ msgid "Enable Post Expiration"
1162
+ msgstr "فعال سازی تاریخ انقضا نوشته"
1163
+
1164
+ #: admin/subscription.php:341 admin/subscription.php:539
1165
+ #: includes/free/form.php:64
1166
+ msgid "Post Expiration Time"
1167
+ msgstr "تاریخ انقضا نوشته"
1168
+
1169
+ #: admin/subscription.php:380 includes/free/form.php:110
1170
+ msgid "Status of post after post expiration time is over "
1171
+ msgstr "وضعیت نوشته بعد از گذشت تاریخ انقضا"
1172
+
1173
+ #: admin/subscription.php:411
1174
+ msgid "Day(s)"
1175
+ msgstr "روز(ها)"
1176
+
1177
+ #: admin/subscription.php:412
1178
+ msgid "Week(s)"
1179
+ msgstr "هفته(ها)"
1180
+
1181
+ #: admin/subscription.php:413
1182
+ msgid "Month(s)"
1183
+ msgstr "ماه(ها)"
1184
+
1185
+ #: admin/subscription.php:414
1186
+ msgid "Year(s)"
1187
+ msgstr "سال(ها)"
1188
+
1189
+ #: admin/subscription.php:451 includes/free/edit-profile.php:275
1190
+ msgid "WPUF Subscription"
1191
+ msgstr "اشتراک WPUF"
1192
+
1193
+ #: admin/subscription.php:471 class/subscription.php:635
1194
+ msgid "Subscription Details"
1195
+ msgstr "جزییات اشتراک"
1196
+
1197
+ #: admin/subscription.php:475
1198
+ msgid "This user is using recurring subscription pack"
1199
+ msgstr "این کاربر از بسته اشتراک در محدوده زمانی معینی استفاده می کند"
1200
+
1201
+ #: admin/subscription.php:480 class/subscription.php:637
1202
+ msgid "Subcription Name: "
1203
+ msgstr "نام اشتراک:"
1204
+
1205
+ #: admin/subscription.php:482
1206
+ msgid "Package billing details: "
1207
+ msgstr "جزئیات صورتحساب بسته:"
1208
+
1209
+ #: admin/subscription.php:492 class/subscription.php:650
1210
+ msgid "Remaining post: "
1211
+ msgstr "نوشته باقی مانده:"
1212
+
1213
+ #: admin/subscription.php:514 class/subscription.php:677
1214
+ msgid "Expire date:"
1215
+ msgstr "تاریخ انقضاء:"
1216
+
1217
+ #: admin/subscription.php:528
1218
+ msgid "Post Expiration Enabled"
1219
+ msgstr "انقضاء نوشته فعال شد"
1220
+
1221
+ #: admin/subscription.php:566
1222
+ msgid "Assign Package"
1223
+ msgstr "بسته اختصاصی"
1224
+
1225
+ #: admin/subscription.php:567
1226
+ msgid "Show Package"
1227
+ msgstr "نمایش بسته"
1228
+
1229
+ #: admin/subscription.php:570 includes/free/edit-profile.php:279
1230
+ msgid "Pack:"
1231
+ msgstr "بسته:"
1232
+
1233
+ #: admin/subscription.php:573
1234
+ msgid "--Select--"
1235
+ msgstr "-- انتخاب --"
1236
+
1237
+ #: admin/subscription.php:581
1238
+ msgid "Delete Package"
1239
+ msgstr "حذف بسته"
1240
+
1241
+ #: admin/template-post.php:43
1242
+ msgid "Enable Image Insertion"
1243
+ msgstr "فعال کردن درج تصویر"
1244
+
1245
+ #: admin/template-post.php:49
1246
+ msgid "Enable image upload in post area"
1247
+ msgstr "فعال کردن آپلود تصویر در ناحیه نوشته"
1248
+
1249
+ #: admin/template-post.php:53 admin/template.php:363
1250
+ msgid "Word Restriction"
1251
+ msgstr "محدودیت کلمات"
1252
+
1253
+ #: admin/template-post.php:57 admin/template.php:367
1254
+ msgid "Numebr of words the author to be restricted in"
1255
+ msgstr "تعداد کلماتی که نویسنده مجاز به استفاده است"
1256
+
1257
+ #: admin/template-post.php:103 admin/template.php:624
1258
+ msgid "Enter maximum upload size limit in KB"
1259
+ msgstr "حداکثر اندازه مجاز آپلود به واحد KB را وارد کنید"
1260
+
1261
+ #: admin/template-post.php:115 admin/template.php:636
1262
+ msgid "Max. file size"
1263
+ msgstr "حداکثر حجم فایل"
1264
+
1265
+ #: admin/template-post.php:164 admin/transaction.php:108
1266
+ #: admin/transaction.php:180
1267
+ msgid "Type"
1268
+ msgstr "نوع"
1269
+
1270
+ #: admin/template-post.php:169
1271
+ msgid "Text Input"
1272
+ msgstr "ورودی متن"
1273
+
1274
+ #: admin/template-post.php:170
1275
+ msgid "Ajax"
1276
+ msgstr "ایجکس"
1277
+
1278
+ #: admin/template-post.php:175
1279
+ msgid "Order By"
1280
+ msgstr "مرتب سازی بر اساس"
1281
+
1282
+ #: admin/template-post.php:178
1283
+ msgid "Term ID"
1284
+ msgstr "Term ID"
1285
+
1286
+ #: admin/template-post.php:179
1287
+ msgid "Slug"
1288
+ msgstr "نامک"
1289
+
1290
+ #: admin/template-post.php:180
1291
+ msgid "Count"
1292
+ msgstr "تعداد"
1293
+
1294
+ #: admin/template-post.php:181
1295
+ msgid "Term Group"
1296
+ msgstr "گروه Term"
1297
+
1298
+ #: admin/template-post.php:186
1299
+ msgid "Order"
1300
+ msgstr "مرتب سازی"
1301
+
1302
+ #: admin/template-post.php:188
1303
+ msgid "ASC"
1304
+ msgstr "صعودی"
1305
+
1306
+ #: admin/template-post.php:189
1307
+ msgid "DESC"
1308
+ msgstr "نزولی"
1309
+
1310
+ #: admin/template-post.php:194
1311
+ msgid "Selection Type"
1312
+ msgstr "نوع انتخاب"
1313
+
1314
+ #: admin/template-post.php:196
1315
+ msgid "Exclude"
1316
+ msgstr "استثناء"
1317
+
1318
+ #: admin/template-post.php:197
1319
+ msgid "Include"
1320
+ msgstr "شامل"
1321
+
1322
+ #: admin/template-post.php:198
1323
+ msgid "Child of"
1324
+ msgstr "فرزند"
1325
+
1326
+ #: admin/template-post.php:203
1327
+ msgid "Selection terms"
1328
+ msgstr "Term های انتخابی"
1329
+
1330
+ #: admin/template-post.php:204
1331
+ msgid ""
1332
+ "Enter the term IDs as comma separated (without space) to exclude/include in "
1333
+ "the form."
1334
+ msgstr ""
1335
+ "term ID ها را بدون فاصله وارد کرده و با کاما از هم جدا کیند تا شامل/مستثنی "
1336
+ "از فرم شوند."
1337
+
1338
+ #: admin/template-post.php:208
1339
+ msgid "WooCommerce Attribute"
1340
+ msgstr "صفات ووکامرس"
1341
+
1342
+ #: admin/template-post.php:214
1343
+ msgid "This taxonomy is a WooCommerce attribute"
1344
+ msgstr "این طبقه بندی یک صفت ووکامرس است"
1345
+
1346
+ #: admin/template-post.php:220
1347
+ msgid "Visibility"
1348
+ msgstr "وضعیت قابل رویت بودن"
1349
+
1350
+ #: admin/template-post.php:226
1351
+ msgid "Visible on product page"
1352
+ msgstr "قابل مشاهده در برگه محصول"
1353
+
1354
+ #: admin/template-post.php:687
1355
+ msgid "all"
1356
+ msgstr "همه"
1357
+
1358
+ #: admin/template-post.php:687
1359
+ msgid "Show All"
1360
+ msgstr "نمایش همه"
1361
+
1362
+ #: admin/template-post.php:690
1363
+ msgid "hide"
1364
+ msgstr "مخفی کردن"
1365
+
1366
+ #: admin/template-post.php:690
1367
+ msgid "Hide These Countries"
1368
+ msgstr "مخفی کردن این کشورها"
1369
+
1370
+ #: admin/template-post.php:691
1371
+ msgid "Chose Country to hide from List"
1372
+ msgstr "انتخاب کشور برای پنهان کردن از فهرست"
1373
+
1374
+ #: admin/template-post.php:695
1375
+ msgid "show"
1376
+ msgstr "نمایش"
1377
+
1378
+ #: admin/template-post.php:695
1379
+ msgid "Show These Countries"
1380
+ msgstr "نمایش این کشورها"
1381
+
1382
+ #: admin/template-post.php:696
1383
+ msgid "Add Country to List"
1384
+ msgstr "اضافه کردن کشور به لیست"
1385
+
1386
+ #: admin/template.php:25
1387
+ msgid "Click and Drag to rearrange"
1388
+ msgstr "کلیک کنید و بکشید تا دوباره تنظیم شود"
1389
+
1390
+ #: admin/template.php:29
1391
+ msgid "Remove"
1392
+ msgstr "حذف"
1393
+
1394
+ #: admin/template.php:30
1395
+ msgid "Toggle"
1396
+ msgstr "باز/بستن"
1397
+
1398
+ #: admin/template.php:70
1399
+ msgid "Required"
1400
+ msgstr "الزامی"
1401
+
1402
+ #: admin/template.php:79
1403
+ msgid "Field Label"
1404
+ msgstr "برچسب زمینه"
1405
+
1406
+ #: admin/template.php:80
1407
+ msgid "Enter a title of this field"
1408
+ msgstr "عنوان این زمینه وارد کنید"
1409
+
1410
+ #: admin/template.php:85 admin/template.php:565
1411
+ msgid "Meta Key"
1412
+ msgstr "کلید متا"
1413
+
1414
+ #: admin/template.php:86 admin/template.php:566
1415
+ msgid "Name of the meta key this field will save to"
1416
+ msgstr "نام کلید متایی که این زمینه در آن ذخیره می شود"
1417
+
1418
+ #: admin/template.php:97
1419
+ msgid "Help text"
1420
+ msgstr "متن راهنما"
1421
+
1422
+ #: admin/template.php:98
1423
+ msgid "Give the user some information about this field"
1424
+ msgstr "به کاربران درباره این زمینه اطلاعاتی بدهید"
1425
+
1426
+ #: admin/template.php:102
1427
+ msgid "CSS Class Name"
1428
+ msgstr "نام کلاس CSS"
1429
+
1430
+ #: admin/template.php:103
1431
+ msgid "Add a CSS class name for this field"
1432
+ msgstr "افزودن نام کلاس CSS برای این زمینه"
1433
+
1434
+ #: admin/template.php:127 admin/template.php:175
1435
+ msgid "Placeholder text"
1436
+ msgstr "متن نگهدارنده مکان"
1437
+
1438
+ #: admin/template.php:128
1439
+ msgid "Text for HTML5 placeholder attribute"
1440
+ msgstr "متن برای مقدار صفت Placeholder در HTML5"
1441
+
1442
+ #: admin/template.php:132 admin/template.php:180
1443
+ msgid "Default value"
1444
+ msgstr "مقدار پیش فرض"
1445
+
1446
+ #: admin/template.php:133
1447
+ msgid "The default value this field will have"
1448
+ msgstr "مقدار پیش فرض این زمینه خواهد شد:"
1449
+
1450
+ #: admin/template.php:137
1451
+ msgid "Size"
1452
+ msgstr "اندازه"
1453
+
1454
+ #: admin/template.php:138
1455
+ msgid "Size of this input field"
1456
+ msgstr "اندازه این زمینه"
1457
+
1458
+ #: admin/template.php:165
1459
+ msgid "Rows"
1460
+ msgstr "ردیف ها"
1461
+
1462
+ #: admin/template.php:170
1463
+ msgid "Columns"
1464
+ msgstr "ستون ها"
1465
+
1466
+ #: admin/template.php:188
1467
+ msgid "Normal"
1468
+ msgstr "معمولی"
1469
+
1470
+ #: admin/template.php:189
1471
+ msgid "Rich textarea"
1472
+ msgstr "ناحیه ی متن با ویرایشگر"
1473
+
1474
+ #: admin/template.php:190
1475
+ msgid "Teeny Rich textarea"
1476
+ msgstr "ناحیه ی متن کوچک با ویرایشگر"
1477
+
1478
+ #: admin/template.php:223
1479
+ msgid "Show values"
1480
+ msgstr "نمایش مقادیر"
1481
+
1482
+ #: admin/template.php:226 admin/template.php:284
1483
+ msgid "Label"
1484
+ msgstr "برچسب"
1485
+
1486
+ #: admin/template.php:226 admin/template.php:284
1487
+ msgid "Value"
1488
+ msgstr "مقدار"
1489
+
1490
+ #: admin/template.php:283
1491
+ msgid "show values"
1492
+ msgstr "نمایش مقادیر"
1493
+
1494
+ #: admin/template.php:388 admin/template.php:412 admin/template.php:444
1495
+ #: admin/template.php:476 templates/dashboard.php:36
1496
+ msgid "Options"
1497
+ msgstr "تنظیمات"
1498
+
1499
+ #: admin/template.php:428 admin/template.php:460
1500
+ msgid ""
1501
+ "First element of the select dropdown. Leave this empty if you don't want to "
1502
+ "show this field"
1503
+ msgstr ""
1504
+ "اولين عنصر Select Dropdown را انتخاب کنید. خالی گذاشتن این گزینه به معنای "
1505
+ "این است که شما نمی خواهید از آن استفاده کنید."
1506
+
1507
+ #: admin/template.php:439 admin/template.php:471
1508
+ msgid "Select Text"
1509
+ msgstr "متن انتخاب"
1510
+
1511
+ #: admin/template.php:534 admin/template.php:594 class/upload.php:121
1512
+ #: templates/dashboard.php:26 wpuf-functions.php:649
1513
+ msgid "Title"
1514
+ msgstr "عنوان"
1515
+
1516
+ #: admin/template.php:539
1517
+ msgid "HTML Codes"
1518
+ msgstr "کدهای HTML"
1519
+
1520
+ #: admin/template.php:572
1521
+ msgid "Meta Value"
1522
+ msgstr "مقدار متا"
1523
+
1524
+ #: admin/template.php:573
1525
+ msgid "Enter the meta value"
1526
+ msgstr "مقدار متا را وارد کنید"
1527
+
1528
+ #: admin/template.php:625
1529
+ msgid "Number of images can be uploaded"
1530
+ msgstr "تعداد تصاویر قابل آپلود"
1531
+
1532
+ #: admin/template.php:641
1533
+ msgid "Max. files"
1534
+ msgstr "حداکثر فایل ها"
1535
+
1536
+ #: admin/tools.php:32
1537
+ msgid "Form Export"
1538
+ msgstr "گرفتن خروجی از فرم"
1539
+
1540
+ #: admin/tools.php:38 admin/tools.php:94
1541
+ msgid "All"
1542
+ msgstr "همه"
1543
+
1544
+ #: admin/tools.php:43 admin/tools.php:99
1545
+ msgid "Select individual"
1546
+ msgstr "انتخاب فردی"
1547
+
1548
+ #: admin/tools.php:53 admin/tools.php:112 admin/tools.php:397
1549
+ msgid "Export"
1550
+ msgstr "برون بری"
1551
+
1552
+ #: admin/tools.php:61 admin/tools.php:119
1553
+ msgid "Sorry you have no form to export"
1554
+ msgstr "متاسفانه شما فرمی برای برون بری ندارید"
1555
+
1556
+ #: admin/tools.php:86
1557
+ msgid "Registration Form Export"
1558
+ msgstr "برون بری فرم ثبت نام"
1559
+
1560
+ #: admin/tools.php:132
1561
+ msgid "Somthing went wrong. Please choose a file again"
1562
+ msgstr "مشکلی پیش آمد. لطفا فایل را دوباره انتخاب کنید"
1563
+
1564
+ #: admin/tools.php:144
1565
+ msgid "Import successful. Have fun!"
1566
+ msgstr "درون ریزی با موفقیت انجام شد. موفق باشید!"
1567
+
1568
+ #: admin/tools.php:147
1569
+ msgid "Invalid file or file size too big."
1570
+ msgstr "فایل نامعتبر است و یا حجم فایل بیش از حد بزرگ است."
1571
+
1572
+ #: admin/tools.php:153
1573
+ msgid "Import forms"
1574
+ msgstr "فرم های درون ریزی"
1575
+
1576
+ #: admin/tools.php:155
1577
+ msgid "Click Browse button and choose a json file that you backup before."
1578
+ msgstr ""
1579
+ "روی دکمه Browse کلیک کنید و فایل json ای را که قبلا پشتیبان گرفته اید انتخاب "
1580
+ "نمایید."
1581
+
1582
+ #: admin/tools.php:156
1583
+ msgid "Press Restore button, WordPress does the rest for you."
1584
+ msgstr ""
1585
+ "دکمه درون ریزی را بفشارید، بقیه کارها را وردپرس برایتان انجام خواهد داد!"
1586
+
1587
+ #: admin/tools.php:161 admin/tools.php:396
1588
+ msgid "Import"
1589
+ msgstr "درون‌ریزی"
1590
+
1591
+ #: admin/tools.php:215 admin/tools.php:235
1592
+ msgid "Please select some form for exporting"
1593
+ msgstr "لطفا فرم را برای برون بری انتخاب کنید"
1594
+
1595
+ #: admin/tools.php:319
1596
+ msgid "All forms has been deleted"
1597
+ msgstr "همه فرم ها پاک شدند"
1598
+
1599
+ #: admin/tools.php:323
1600
+ msgid "Settings has been cleared!"
1601
+ msgstr "تنظیمات پاکسازی شده است!"
1602
+
1603
+ #: admin/tools.php:327
1604
+ msgid "All transactions has been deleted!"
1605
+ msgstr "همه معاملات حذف شده است!"
1606
+
1607
+ #: admin/tools.php:344
1608
+ msgid "Page Installation"
1609
+ msgstr "نصب برگه"
1610
+
1611
+ #: admin/tools.php:347
1612
+ msgid ""
1613
+ "Clicking this button will create required pages for the plugin. Note: It'll "
1614
+ "not delete/replace existing pages."
1615
+ msgstr ""
1616
+ "با کلیک بر روی این دکمه، برگه های مورد نیاز برای این افزونه ساخته خواهد شد. "
1617
+ "توجه: این کار موجب پاک شدن/جایگزینی برگه های موجود نخواهد شد."
1618
+
1619
+ #: admin/tools.php:353 admin/tools.php:357
1620
+ msgid "Reset Settings"
1621
+ msgstr "بازنشاندن تنظیمات"
1622
+
1623
+ #: admin/tools.php:356
1624
+ msgid ""
1625
+ "<strong>Caution:</strong> This tool will delete all the plugin settings of "
1626
+ "WP User Frontend Pro"
1627
+ msgstr ""
1628
+ "<strong>توجه:</strong> این ابزار همه تنظیمات افزونه ناحیه کاربری پیشرفته را "
1629
+ "حذف می کند."
1630
+
1631
+ #: admin/tools.php:362
1632
+ msgid "Delete Forms"
1633
+ msgstr "حذف فرم ها"
1634
+
1635
+ #: admin/tools.php:365
1636
+ msgid ""
1637
+ "<strong>Caution:</strong> This tool will delete all the post and "
1638
+ "registration/profile forms."
1639
+ msgstr ""
1640
+ "<strong>توجه:</strong> این ابزار تمام نوشته ها، فرم های ثبت نام و پروفایل "
1641
+ "را حذف می کند."
1642
+
1643
+ #: admin/tools.php:367
1644
+ msgid "Delete Post Forms"
1645
+ msgstr "حذف فرم های ارسال"
1646
+
1647
+ #: admin/tools.php:368
1648
+ msgid "Delete Registration Forms"
1649
+ msgstr "حذف فرم های ثبت نام"
1650
+
1651
+ #: admin/tools.php:369
1652
+ msgid "Delete Subscriptions"
1653
+ msgstr "حذف اشتراک ها"
1654
+
1655
+ #: admin/tools.php:370
1656
+ msgid "Delete Coupons"
1657
+ msgstr "حذف کوپن ها"
1658
+
1659
+ #: admin/tools.php:375
1660
+ msgid "Transactions"
1661
+ msgstr "تراکنش‌ها"
1662
+
1663
+ #: admin/tools.php:378
1664
+ msgid "This tool will delete all the transactions from the transaction table."
1665
+ msgstr "این ابزار تمام تراکنس ها را از جدول تراکنش حذف میکند."
1666
+
1667
+ #: admin/tools.php:380
1668
+ msgid "Delete Transactions"
1669
+ msgstr "حذف تراکنش ها"
1670
+
1671
+ #: admin/transaction.php:77
1672
+ msgid "WP User Frontend: Payments Received"
1673
+ msgstr "ناحیه کاربری پیشرفته: پرداخت های دریافت شده"
1674
+
1675
+ #: admin/transaction.php:81
1676
+ msgid "Total Income:"
1677
+ msgstr "کل درآمد:"
1678
+
1679
+ #: admin/transaction.php:84
1680
+ msgid "This Month:"
1681
+ msgstr "این ماه:"
1682
+
1683
+ #: admin/transaction.php:90
1684
+ msgid "Transaction(s) deleted"
1685
+ msgstr "تراکنش(ها) حذف شد"
1686
+
1687
+ #: admin/transaction.php:101
1688
+ msgid "User ID"
1689
+ msgstr "شناسه کاربر"
1690
+
1691
+ #: admin/transaction.php:102 templates/dashboard.php:27
1692
+ msgid "Status"
1693
+ msgstr "وضعیت"
1694
+
1695
+ #: admin/transaction.php:104
1696
+ msgid "Post"
1697
+ msgstr "نوشته"
1698
+
1699
+ #: admin/transaction.php:105
1700
+ msgid "Pack ID"
1701
+ msgstr "شناسه بسته"
1702
+
1703
+ #: admin/transaction.php:106
1704
+ msgid "Payer"
1705
+ msgstr "پرداخت کننده"
1706
+
1707
+ #: admin/transaction.php:109
1708
+ msgid "Transaction ID"
1709
+ msgstr "شناسه تراکنش"
1710
+
1711
+ #: admin/transaction.php:110
1712
+ msgid "Created"
1713
+ msgstr "ایجاد شد"
1714
+
1715
+ #: admin/transaction.php:151 admin/transaction.php:213
1716
+ msgid "Nothing Found"
1717
+ msgstr "پیدا نشد"
1718
+
1719
+ #: admin/transaction.php:158
1720
+ msgid "Delete Selected"
1721
+ msgstr "پاک کردن مورد انتخاب شده"
1722
+
1723
+ #: admin/transaction.php:162
1724
+ msgid "Pending Orders"
1725
+ msgstr "سفارشات در حال انتظار"
1726
+
1727
+ #: admin/transaction.php:178
1728
+ msgid "ID"
1729
+ msgstr "شناسه"
1730
+
1731
+ #: admin/transaction.php:179
1732
+ msgid "User"
1733
+ msgstr "کاربر"
1734
+
1735
+ #: admin/transaction.php:182
1736
+ msgid "Item Details"
1737
+ msgstr "جزئیات آیتم"
1738
+
1739
+ #: admin/transaction.php:183 includes/free/form.php:12
1740
+ msgid "Date"
1741
+ msgstr "تاریخ"
1742
+
1743
+ #: admin/transaction.php:202
1744
+ msgid "Accept"
1745
+ msgstr "قبول"
1746
+
1747
+ #: admin/transaction.php:203
1748
+ msgid "Reject"
1749
+ msgstr "رد کردن"
1750
+
1751
+ #: admin/transaction.php:220
1752
+ msgid "No pending orders found"
1753
+ msgstr "هیچ سفارش در حال انتظاری یافت نشد"
1754
+
1755
+ #: class/frontend-dashboard.php:35 includes/free/edit-profile.php:27
1756
+ #: includes/free/edit-user.php:37
1757
+ #, php-format
1758
+ msgid "This page is restricted. Please %s to view this page."
1759
+ msgstr "این برگه محدود شده است. لطفا %s تا این صفحه را مشاهده کنید."
1760
+
1761
+ #: class/frontend-dashboard.php:67
1762
+ msgid "Post Deleted"
1763
+ msgstr "نوشته حذف شد"
1764
+
1765
+ #: class/frontend-dashboard.php:105
1766
+ msgid "Author Info"
1767
+ msgstr "اطلاعات نویسنده"
1768
+
1769
+ #: class/frontend-dashboard.php:109 includes/free/edit-user.php:97
1770
+ #, php-format
1771
+ msgid "%s"
1772
+ msgstr "%s"
1773
+
1774
+ #: class/frontend-dashboard.php:141
1775
+ msgid "You are not the post author. Cheeting huh!"
1776
+ msgstr "شما نویسنده نوشته نیستید. تعجب کردید!"
1777
+
1778
+ #: class/frontend-form-post.php:74
1779
+ msgid "You are not logged in"
1780
+ msgstr "شما وارد نشده اید"
1781
+
1782
+ #: class/frontend-form-post.php:83
1783
+ msgid "Post Editing is disabled"
1784
+ msgstr "ویرایش نوشته غیرفعال است"
1785
+
1786
+ #: class/frontend-form-post.php:89
1787
+ msgid "Invalid post"
1788
+ msgstr "نوشته نامعتبر است"
1789
+
1790
+ #: class/frontend-form-post.php:94
1791
+ msgid "You are not allowed to edit"
1792
+ msgstr "مجاز به ویرایش نیستید"
1793
+
1794
+ #: class/frontend-form-post.php:106
1795
+ msgid "I don't know how to edit this post, I don't have the form ID"
1796
+ msgstr "به دلیل عدم وجود شناسه فرم، امکان ویرایش نوشته وجود ندارد."
1797
+
1798
+ #: class/frontend-form-post.php:112
1799
+ msgid "You can't edit a post while in pending mode."
1800
+ msgstr "زمانی که یک نوشته در حالت انتظار است شما نمی توانید آن را ویرایش کنید."
1801
+
1802
+ #: class/frontend-form-post.php:173
1803
+ msgid "Invalid email address."
1804
+ msgstr "آدرس ایمیل نامعتبر."
1805
+
1806
+ #: class/frontend-form-post.php:182
1807
+ msgid ""
1808
+ "You already have an account in our site. Please login to continue.\n"
1809
+ "\n"
1810
+ "Clicking 'OK' will redirect you to the login page and you will lost the form "
1811
+ "data.\n"
1812
+ "Click 'Cancel' to stay at this page."
1813
+ msgstr ""
1814
+ "شما در حال حاضر یک حساب کابری در وبسایت ما دارید. لطفا وارد شویذ.\n"
1815
+ "\n"
1816
+ "با کلیک بر روی 'بله' به صفحه ورود منتقل شده و اطلاعات فرم را از دست خواهید "
1817
+ "داد.\n"
1818
+ "برای ماندن در این صفحه بر روی دکمه 'انصراف' کلیک کنید."
1819
+
1820
+ #: class/frontend-form-post.php:526
1821
+ msgid "Something went wrong"
1822
+ msgstr "مشکلی پیش آمد."
1823
+
1824
+ #: class/payment.php:22 class/payment.php:23
1825
+ msgid "PayPal"
1826
+ msgstr "PayPal"
1827
+
1828
+ #: class/payment.php:27 class/payment.php:28
1829
+ msgid "Bank Payment"
1830
+ msgstr "پرداخت بانکی"
1831
+
1832
+ #: class/payment.php:69
1833
+ msgid "Please select your payment page from admin panel"
1834
+ msgstr "لطفا برگه پرداخت خود را از ناحیه مدیریت انتخاب کنید"
1835
+
1836
+ #: class/payment.php:117
1837
+ msgid "Your free package has been activated. Enjoy!"
1838
+ msgstr "بسته رایگان شما فعال شده است. لذت ببرید!"
1839
+
1840
+ #: class/payment.php:119
1841
+ msgid "You already have activated a free package previously."
1842
+ msgstr "شما در حال حاضر یک بسته رایگان از قبل فعال کرده اید."
1843
+
1844
+ #: class/payment.php:143
1845
+ msgid "Pricing & Plans"
1846
+ msgstr "قیمت گذاری و پلن ها"
1847
+
1848
+ #: class/payment.php:145
1849
+ msgid "Change Pack"
1850
+ msgstr "تغییر بسته"
1851
+
1852
+ #: class/payment.php:156
1853
+ msgid "Selected Pack "
1854
+ msgstr "بسته های انتخاب شده"
1855
+
1856
+ #: class/payment.php:157
1857
+ msgid "Pack Price "
1858
+ msgstr "قیمت بسته"
1859
+
1860
+ #: class/payment.php:169
1861
+ msgid "Apply Coupon"
1862
+ msgstr "اعمال کوپن"
1863
+
1864
+ #: class/payment.php:170
1865
+ msgid "Cancel"
1866
+ msgstr "انصراف"
1867
+
1868
+ #: class/payment.php:173
1869
+ msgid "Have a discount code?"
1870
+ msgstr "کد تخفیف دارید؟"
1871
+
1872
+ #: class/payment.php:184
1873
+ msgid "Choose Your Payment Method"
1874
+ msgstr "روش پرداخت خود را انتخاب کنید"
1875
+
1876
+ #: class/payment.php:221
1877
+ msgid "Proceed"
1878
+ msgstr "ادامه"
1879
+
1880
+ #: class/payment.php:225
1881
+ msgid "No Payment gateway found"
1882
+ msgstr "هبچ درگاه پرداختی یافت نشد"
1883
+
1884
+ #: class/payment.php:399 lib/gateway/bank.php:99
1885
+ #, php-format
1886
+ msgid "[%s] Payment Received"
1887
+ msgstr "[%s] پرداخت دریافت شد"
1888
+
1889
+ #: class/payment.php:400
1890
+ #, php-format
1891
+ msgid "New payment received at %s"
1892
+ msgstr "پرداخت جدید در %s دریافت شد"
1893
+
1894
+ #: class/render-form.php:76
1895
+ msgid "Really Simple Captcha validation failed"
1896
+ msgstr "Really Simple Captcha تأیید نشد"
1897
+
1898
+ #: class/render-form.php:97
1899
+ msgid "reCAPTCHA validation failed"
1900
+ msgstr "reCAPTCHA تایید نشد"
1901
+
1902
+ #: class/render-form.php:781
1903
+ msgid "Word Limit Reached !"
1904
+ msgstr "محدودیت کلمه رسیده است!"
1905
+
1906
+ #: class/render-form.php:878
1907
+ msgid "Insert Photo"
1908
+ msgstr "درج تصویر"
1909
+
1910
+ #: class/render-form.php:1128 class/render-form.php:1134
1911
+ #: includes/free/edit-profile.php:198
1912
+ msgid "Strength indicator"
1913
+ msgstr "شاخص قدرت"
1914
+
1915
+ #: class/render-form.php:1135
1916
+ msgid "Very weak"
1917
+ msgstr "خیلی ضعیف"
1918
+
1919
+ #: class/render-form.php:1136
1920
+ msgid "Weak"
1921
+ msgstr "ضعیف"
1922
+
1923
+ #: class/render-form.php:1137
1924
+ msgid "Medium"
1925
+ msgstr "متوسط"
1926
+
1927
+ #: class/render-form.php:1138
1928
+ msgid "Strong"
1929
+ msgstr "قوی"
1930
+
1931
+ #: class/render-form.php:1139
1932
+ msgid "Mismatch"
1933
+ msgstr "عدم مطابقت"
1934
+
1935
+ #: class/render-form.php:1161 class/render-form.php:1269
1936
+ msgid "-- Select --"
1937
+ msgstr "-- انتخاب --"
1938
+
1939
+ #: class/render-form.php:1392
1940
+ msgid "Select Image"
1941
+ msgstr "گزینش تصویر"
1942
+
1943
+ #: class/subscription.php:322
1944
+ msgid "Add Subscription"
1945
+ msgstr "افزودن اشتراک"
1946
+
1947
+ #: class/subscription.php:323
1948
+ msgid "Add New Subscription"
1949
+ msgstr "افزودن یک اشتراک جدید"
1950
+
1951
+ #: class/subscription.php:325
1952
+ msgid "Edit Subscription"
1953
+ msgstr "ویرایش اشتراک"
1954
+
1955
+ #: class/subscription.php:326
1956
+ msgid "New Subscription"
1957
+ msgstr "اشتراک جدید"
1958
+
1959
+ #: class/subscription.php:327 class/subscription.php:328
1960
+ msgid "View Subscription"
1961
+ msgstr "مشاهده اشتراک"
1962
+
1963
+ #: class/subscription.php:329
1964
+ msgid "Search Subscription"
1965
+ msgstr "جست و جوی اشتراک"
1966
+
1967
+ #: class/subscription.php:330
1968
+ msgid "No Subscription Found"
1969
+ msgstr "هیچ اشتراکی پیدا نشد"
1970
+
1971
+ #: class/subscription.php:331
1972
+ msgid "No Subscription Found in Trash"
1973
+ msgstr "هیچ اشتراکی در زباله دان پیدا نشد"
1974
+
1975
+ #: class/subscription.php:332
1976
+ msgid "Parent Subscription"
1977
+ msgstr "اشتراک اصلی"
1978
+
1979
+ #: class/subscription.php:361
1980
+ msgid "Billing Details"
1981
+ msgstr "جزئیات صورتحساب"
1982
+
1983
+ #: class/subscription.php:639
1984
+ msgid "Package & billing details: "
1985
+ msgstr "جزئیات بسته و صورت حساب:"
1986
+
1987
+ #: class/subscription.php:696
1988
+ msgid "Change"
1989
+ msgstr "تغییر"
1990
+
1991
+ #: class/subscription.php:715
1992
+ msgid "Please enable force pack and charge posting from admin panel"
1993
+ msgstr ""
1994
+ "لطفا اجبار خرید بسته و شارژ برای ارسال نوشته را از ناحیه مدیریت فعال نمایید."
1995
+
1996
+ #: class/subscription.php:723
1997
+ msgid "Payment is complete"
1998
+ msgstr "پرداخت تکمیل شد"
1999
+
2000
+ #: class/subscription.php:723
2001
+ msgid "Congratulations, your payment has been completed!"
2002
+ msgstr "تبریک می گویم، پرداخت شما تکمیل شد!"
2003
+
2004
+ #: class/subscription.php:762
2005
+ msgid "One time payment"
2006
+ msgstr "پرداخت فوری"
2007
+
2008
+ #: class/subscription.php:775
2009
+ msgid "Sign Up"
2010
+ msgstr "ثبت نام"
2011
+
2012
+ #: class/subscription.php:780
2013
+ msgid "Buy Now"
2014
+ msgstr "اکنون بخرید!"
2015
+
2016
+ #: class/subscription.php:836
2017
+ #, php-format
2018
+ msgid "This will cost you <strong>%s</strong> to add a new post. "
2019
+ msgstr "هزینه ارسال یک نوشته جدید <strong>%s</strong> می باشد."
2020
+
2021
+ #: class/subscription.php:855
2022
+ #, php-format
2023
+ msgid "You must <a href=\"%s\">purchase a pack</a> before posting"
2024
+ msgstr "شما قبل از ارسال نوشته باید <a href=\\\"%s\\\">یک بسته بخرید</a>"
2025
+
2026
+ #: class/upload.php:122 wpuf-functions.php:652
2027
+ msgid "Caption"
2028
+ msgstr "عنوان"
2029
+
2030
+ #: includes/free/edit-profile.php:66
2031
+ msgid "<strong>Success</strong>: Profile updated"
2032
+ msgstr "<strong>موفقیت آمیز بود</strong>: پروفایل آپدیت شد"
2033
+
2034
+ #: includes/free/edit-profile.php:97
2035
+ msgid "Usernames cannot be changed."
2036
+ msgstr "نام کاربری قابل تغییر نیست"
2037
+
2038
+ #: includes/free/edit-profile.php:110 includes/free/edit-profile.php:151
2039
+ msgid "(required)"
2040
+ msgstr "(الزامی)"
2041
+
2042
+ #: includes/free/edit-profile.php:115
2043
+ msgid "Display to Public as"
2044
+ msgstr "نمایش به صورت عمومی"
2045
+
2046
+ #: includes/free/edit-profile.php:147
2047
+ msgid "Contact Info"
2048
+ msgstr "اطلاعات تماس"
2049
+
2050
+ #: includes/free/edit-profile.php:174
2051
+ msgid "About Yourself"
2052
+ msgstr "درباره خودتان"
2053
+
2054
+ #: includes/free/edit-profile.php:180
2055
+ msgid ""
2056
+ "Share a little biographical information to fill out your profile. This may "
2057
+ "be shown publicly."
2058
+ msgstr ""
2059
+ "برای تکمیل کردن پروفایل خود اطلاعات کمی از بیوگرافی خود به اشتراک بگذراید. "
2060
+ "این اطلاعات ممکن است به صورت عمومی نمایش داده شود."
2061
+
2062
+ #: includes/free/edit-profile.php:183
2063
+ msgid "New Password"
2064
+ msgstr "کلمه عبور جدید"
2065
+
2066
+ #: includes/free/edit-profile.php:189
2067
+ msgid "Confirm Password"
2068
+ msgstr "تکرار کلمه عبور"
2069
+
2070
+ #: includes/free/edit-profile.php:191
2071
+ msgid "Type your new password again."
2072
+ msgstr "کلمه عبور جدید خود را مجدداً وارد کنید."
2073
+
2074
+ #: includes/free/edit-profile.php:196
2075
+ msgid "Password Strength"
2076
+ msgstr "استحکام گذرواژه"
2077
+
2078
+ #: includes/free/edit-profile.php:222 includes/free/form.php:344
2079
+ msgid "Update Profile"
2080
+ msgstr "به روز رسانی پروفایل"
2081
+
2082
+ #: includes/free/edit-profile.php:241
2083
+ msgid "WPUF Post Lock"
2084
+ msgstr "قفل نوشته WPUF"
2085
+
2086
+ #: includes/free/edit-profile.php:244
2087
+ msgid "Lock Post:"
2088
+ msgstr "قفل نوشته:"
2089
+
2090
+ #: includes/free/edit-profile.php:250
2091
+ msgid "Lock user from creating new post."
2092
+ msgstr "قفل کاربر از ایجاد نوشته جدید."
2093
+
2094
+ #: includes/free/edit-profile.php:255
2095
+ msgid "Lock Reason:"
2096
+ msgstr "دلیل قفل شدن:"
2097
+
2098
+ #: includes/free/edit-profile.php:285
2099
+ msgid "Post Count:"
2100
+ msgstr "تعداد نوشته:"
2101
+
2102
+ #: includes/free/edit-profile.php:291
2103
+ msgid "Validity:"
2104
+ msgstr "اعتبار:"
2105
+
2106
+ #: includes/free/edit-user.php:23
2107
+ msgid "User doesn't exists"
2108
+ msgstr "کاربر وجود ندارد"
2109
+
2110
+ #: includes/free/edit-user.php:34
2111
+ msgid "You don't have permission for this purpose"
2112
+ msgstr "شما اجازه دسترسی برای اینکار را ندارید"
2113
+
2114
+ #: includes/free/edit-user.php:77
2115
+ msgid "User Deleted"
2116
+ msgstr "کاربر حذف شد"
2117
+
2118
+ #: includes/free/edit-user.php:119 includes/free/edit-user.php:177
2119
+ msgid "Add New User"
2120
+ msgstr "اضافه کردن کاربر جدید"
2121
+
2122
+ #: includes/free/edit-user.php:132
2123
+ msgid "User Added"
2124
+ msgstr "کاربر اضافه شد"
2125
+
2126
+ #: includes/free/edit-user.php:160
2127
+ msgid "Role"
2128
+ msgstr "نقش"
2129
+
2130
+ #: includes/free/edit-user.php:204
2131
+ msgid "<strong>ERROR</strong>: Please enter a username."
2132
+ msgstr "<strong>خطا:</strong> لطفا یک نام کاربری وارد کنید."
2133
+
2134
+ #: includes/free/edit-user.php:206
2135
+ msgid ""
2136
+ "<strong>ERROR</strong>: This username is invalid because it uses illegal "
2137
+ "characters. Please enter a valid username."
2138
+ msgstr ""
2139
+ "<strong>خطا</strong>: نام کاربری وارد شده نامعتبر است، زیرا در آن از "
2140
+ "کاراکترهای غیر مجاز استفاده شده است. لطفا یک نام کاربری مجاز وارد کنید."
2141
+
2142
+ #: includes/free/edit-user.php:209
2143
+ msgid ""
2144
+ "<strong>ERROR</strong>: This username is already registered, please choose "
2145
+ "another one."
2146
+ msgstr ""
2147
+ "<strong>خطا</strong>: نام کاربری وارد شده، قبلا در سایت ثبت شده است. لطفا "
2148
+ "نام کاربری دیگری انتخاب و وارد نمایید."
2149
+
2150
+ #: includes/free/edit-user.php:214
2151
+ msgid "<strong>ERROR</strong>: Please type your e-mail address."
2152
+ msgstr "<strong>خطا</strong>: لطفا آدرس ایمیل خود را وارد کنید."
2153
+
2154
+ #: includes/free/edit-user.php:216
2155
+ msgid "<strong>ERROR</strong>: The email address isn&#8217;t correct."
2156
+ msgstr "<strong>خطا:</strong> آدرس ایمیل صحیح نمی باشد."
2157
+
2158
+ #: includes/free/edit-user.php:219
2159
+ msgid ""
2160
+ "<strong>ERROR</strong>: This email is already registered, please choose "
2161
+ "another one."
2162
+ msgstr ""
2163
+ "<strong>خطا</strong>: آدرس ایمیل وارد شده قبلا در سایت ثبت شده است. لطفا "
2164
+ "آدرس ایمیل دیگری انتخاب و وارد نمایید."
2165
+
2166
+ #: includes/free/edit-user.php:242
2167
+ #, php-format
2168
+ msgid ""
2169
+ "<strong>ERROR</strong>: Couldn&#8217;t register you... please contact the <a "
2170
+ "href=\"mailto:%s\">webmaster</a> !"
2171
+ msgstr ""
2172
+ "<strong>خطــا</strong>: امکان ثبت نام شما وجود ندارد. لطفا با <a href="
2173
+ "\"mailto:%s\"> مدیر</a> تماس بگیرید."
2174
+
2175
+ #: includes/free/form.php:8
2176
+ msgid "Image Upload"
2177
+ msgstr "آپلود تصویر"
2178
+
2179
+ #: includes/free/form.php:11
2180
+ msgid "Repeat Field"
2181
+ msgstr "فیلد تکرار شونده"
2182
+
2183
+ #: includes/free/form.php:13
2184
+ msgid "File Upload"
2185
+ msgstr "بارگذاری فایل"
2186
+
2187
+ #: includes/free/form.php:14
2188
+ msgid "Google Maps"
2189
+ msgstr "نقشه گوگل"
2190
+
2191
+ #: includes/free/form.php:15
2192
+ msgid "Country List"
2193
+ msgstr "فهرست کشور"
2194
+
2195
+ #: includes/free/form.php:16
2196
+ msgid "Numeric Field"
2197
+ msgstr "فیلد عددی"
2198
+
2199
+ #: includes/free/form.php:17
2200
+ msgid "Address Field"
2201
+ msgstr "فیلد آدرس"
2202
+
2203
+ #: includes/free/form.php:18
2204
+ msgid "Step Start"
2205
+ msgstr "مرحله شروع"
2206
+
2207
+ #: includes/free/form.php:30
2208
+ msgid "reCaptcha"
2209
+ msgstr "reCaptcha"
2210
+
2211
+ #: includes/free/form.php:31
2212
+ msgid "Really Simple Captcha"
2213
+ msgstr "Really Simple Captcha"
2214
+
2215
+ #: includes/free/form.php:32
2216
+ msgid "Action Hook"
2217
+ msgstr "Action Hook"
2218
+
2219
+ #: includes/free/form.php:33
2220
+ msgid "Term &amp; Conditions"
2221
+ msgstr "شرایط و مقررات"
2222
+
2223
+ #: includes/free/form.php:121
2224
+ msgid "Send Email to Author After Exceeding Post Expiration Time"
2225
+ msgstr "ارسال ایمیل به نویسنده بعد از گذشتن تاریخ انقضای نوشته"
2226
+
2227
+ #: includes/free/form.php:146 includes/free/form.php:150
2228
+ msgid "Enable Multistep"
2229
+ msgstr "فعال کردن چند مرحله ای"
2230
+
2231
+ #: includes/free/form.php:153
2232
+ msgid "If checked, form will be displayed in frontend in multiple steps"
2233
+ msgstr "در صورت انتخاب، فرم در چند مرحله نمایش داده خوهد شد"
2234
+
2235
+ #: includes/free/form.php:157
2236
+ msgid "Multistep Progressbar Type"
2237
+ msgstr "نوار پیشرفت چند مرحله ای"
2238
+
2239
+ #: includes/free/form.php:167
2240
+ msgid "Choose how you want the progressbar"
2241
+ msgstr "انتخاب کنید چه نوار پیشرفتی می خواهید"
2242
+
2243
+ #: includes/free/form.php:197
2244
+ msgid "New post created"
2245
+ msgstr "نوشته جدید ایجاد شده است"
2246
+
2247
+ #: includes/free/form.php:202
2248
+ msgid "A post has been edited"
2249
+ msgstr "یک نوشته ویرایش شده است"
2250
+
2251
+ #: includes/free/form.php:208
2252
+ msgid "New Post Notificatoin"
2253
+ msgstr "اطلاعیه نوشته جدید"
2254
+
2255
+ #: includes/free/form.php:216 includes/free/form.php:253
2256
+ msgid "Enable post notification"
2257
+ msgstr "فعال کردن اطلاعیه نوشته"
2258
+
2259
+ #: includes/free/form.php:222 includes/free/form.php:259
2260
+ msgid "To"
2261
+ msgstr "به"
2262
+
2263
+ #: includes/free/form.php:230 includes/free/form.php:264
2264
+ msgid "Subject"
2265
+ msgstr "موضوع"
2266
+
2267
+ #: includes/free/form.php:236 includes/free/form.php:269
2268
+ msgid "Message"
2269
+ msgstr "پیغام"
2270
+
2271
+ #: includes/free/form.php:244
2272
+ msgid "Update Post Notificatoin"
2273
+ msgstr "اطلاعیه بروزرسانی نوشته"
2274
+
2275
+ #: includes/free/form.php:276
2276
+ msgid "You may use in message:"
2277
+ msgstr "شما ممکن است در پیام استفاده کنید:"
2278
+
2279
+ #: includes/free/form.php:339
2280
+ msgid "Registration successful"
2281
+ msgstr "ثبت نام موفیت آمیز بود"
2282
+
2283
+ #: includes/free/form.php:340
2284
+ msgid "Profile updated successfully"
2285
+ msgstr "بروز رسانی پروفایل با موفقیت انجام شد"
2286
+
2287
+ #: includes/free/form.php:343
2288
+ msgid "Register"
2289
+ msgstr "ثبت نام"
2290
+
2291
+ #: includes/free/form.php:352
2292
+ msgid "Enable Email Verfication"
2293
+ msgstr "فعال کردن تایید از طریق ایمیل"
2294
+
2295
+ #: includes/free/form.php:360
2296
+ msgid "New User Role"
2297
+ msgstr "نقش کاربری جدید"
2298
+
2299
+ #: includes/free/form.php:396
2300
+ msgid "Registration success message"
2301
+ msgstr "پیغام ثبت نام موفقیت آمیز"
2302
+
2303
+ #: includes/free/form.php:403
2304
+ msgid "Update profile message"
2305
+ msgstr "پیغام بروزرسانی پروفایل"
2306
+
2307
+ #: includes/free/form.php:432
2308
+ msgid "Submit Button text"
2309
+ msgstr "متن دکمه ی ارسال"
2310
+
2311
+ #: includes/free/form.php:439
2312
+ msgid "Update Button text"
2313
+ msgstr "متن دکمه بروزرسانی"
2314
+
2315
+ #: includes/free/form.php:472
2316
+ msgid "Conditional Logic"
2317
+ msgstr "منطق شرطی"
2318
+
2319
+ #: includes/free/loader.php:63 includes/free/loader.php:92
2320
+ msgid "Coupons"
2321
+ msgstr "کوپن ها"
2322
+
2323
+ #: includes/free/loader.php:68
2324
+ msgid "Registration Form"
2325
+ msgstr "فرم ثبت نام"
2326
+
2327
+ #: includes/free/loader.php:72
2328
+ msgid ""
2329
+ "Registration form builder is a two way form which can be used both for "
2330
+ "<strong>user registration</strong> and <strong>profile editing</strong>."
2331
+ msgstr ""
2332
+ "سازنده فرم ثبت نام یک فرم دو طرفه است که می تواند برای هم <strong>ثبت نام "
2333
+ "کاربر</strong> و هم <strong>ویرایش مشخصات</strong> استفاده شود."
2334
+
2335
+ #: includes/free/loader.php:76
2336
+ msgid "Users can also register themselves by using a subscription pack."
2337
+ msgstr ""
2338
+ "کاربران همچنین می توانند خود را با استفاده از یک بسته اشتراک ثبت نام نمایند."
2339
+
2340
+ #: includes/free/loader.php:80 includes/free/loader.php:100
2341
+ msgid "This feature is only available in the Pro Version."
2342
+ msgstr "این قابلیت تنها در نسخه حرفه ای در دسترس است."
2343
+
2344
+ #: includes/free/loader.php:84 includes/free/loader.php:104
2345
+ msgid "Upgrade to Pro Version"
2346
+ msgstr "ارتقا به نسخه حرفه ای"
2347
+
2348
+ #: includes/free/loader.php:96
2349
+ msgid "Use Coupon codes for subscription for discounts."
2350
+ msgstr "استفاده از کدهای کوپن برای اشتراک تخفیف."
2351
+
2352
+ #: includes/free/loader.php:131
2353
+ msgid "Pro Feature"
2354
+ msgstr "ویژگی های نسخه حرفه ای"
2355
+
2356
+ #: includes/free/loader.php:149
2357
+ msgid "Upgrade to Pro"
2358
+ msgstr "ارتقاع به نسخه حرفه ای"
2359
+
2360
+ #: includes/free/subscription.php:12
2361
+ msgid "Enable Recurring Payment"
2362
+ msgstr "فعال کرن پرداخت دوره ای"
2363
+
2364
+ #: lib/gateway/bank.php:29
2365
+ msgid "Bank Instruction"
2366
+ msgstr "ساختار بانک"
2367
+
2368
+ #: lib/gateway/bank.php:36
2369
+ msgid "Bank Payment Success Page"
2370
+ msgstr "برگه پرداخت بانکی موفقیت آمیز"
2371
+
2372
+ #: lib/gateway/bank.php:77
2373
+ #, php-format
2374
+ msgid "[%s] New Bank Order Received"
2375
+ msgstr "[%s] سفارش جدید دریافت شده"
2376
+
2377
+ #: lib/gateway/bank.php:78
2378
+ #, php-format
2379
+ msgid "New bank order received at %s, please check it out: %s"
2380
+ msgstr "سفارش جدید بانکی در %s دریافت شده، لطفا بررسی نمایید: %s"
2381
+
2382
+ #: lib/gateway/bank.php:100
2383
+ #, php-format
2384
+ msgid "Hello %s,"
2385
+ msgstr "سلام %s"
2386
+
2387
+ #: lib/gateway/bank.php:101
2388
+ msgid "We have received your bank payment."
2389
+ msgstr "ما پرداخت بانکی شما را دریافت کردیم."
2390
+
2391
+ #: lib/gateway/bank.php:102
2392
+ msgid "Thanks for being with us."
2393
+ msgstr "برای اینکه با ما بودید متشکریم."
2394
+
2395
+ #: lib/gateway/paypal.php:75
2396
+ #, php-format
2397
+ msgid "Subscription %s at %s"
2398
+ msgstr "اشتراک %s در %s"
2399
+
2400
+ #: lib/gateway/paypal.php:106
2401
+ msgid "PayPal Email"
2402
+ msgstr "ایمیل PayPal"
2403
+
2404
+ #: lib/gateway/paypal.php:111
2405
+ msgid "PayPal Instruction"
2406
+ msgstr "ساختار PayPal"
2407
+
2408
+ #: lib/gateway/paypal.php:118
2409
+ msgid "PayPal API username"
2410
+ msgstr "نام کاربری PayPal API"
2411
+
2412
+ #: lib/gateway/paypal.php:122
2413
+ msgid "PayPal API password"
2414
+ msgstr "کلمه عبور PayPal API"
2415
+
2416
+ #: lib/gateway/paypal.php:126
2417
+ msgid "PayPal API signature"
2418
+ msgstr "امضای PayPal API"
2419
+
2420
+ #: templates/dashboard.php:2
2421
+ #, php-format
2422
+ msgid "%s's Dashboard"
2423
+ msgstr "پیشخوان %s"
2424
+
2425
+ #: templates/dashboard.php:6
2426
+ #, php-format
2427
+ msgid "You have created <span>%d</span> %s"
2428
+ msgstr "شما <span>%d</span> %s ساختید."
2429
+
2430
+ #: templates/dashboard.php:56
2431
+ msgid "No Image"
2432
+ msgstr "بدون تصویر"
2433
+
2434
+ #: templates/dashboard.php:70
2435
+ #, php-format
2436
+ msgid "Permalink to %s"
2437
+ msgstr "پیوند یکتا به %s"
2438
+
2439
+ #: templates/dashboard.php:86
2440
+ msgid "Pay Now"
2441
+ msgstr "هم‌اکنون پرداخت کنید"
2442
+
2443
+ #: templates/dashboard.php:130
2444
+ msgid "&laquo;"
2445
+ msgstr "&laquo;"
2446
+
2447
+ #: templates/dashboard.php:131
2448
+ msgid "&raquo;"
2449
+ msgstr "&raquo;"
2450
+
2451
+ #: templates/dashboard.php:145
2452
+ #, php-format
2453
+ msgid "No %s found"
2454
+ msgstr "هیچ %s ای پیدا نشد"
2455
+
2456
+ #: templates/logged-in.php:8
2457
+ #, php-format
2458
+ msgid "Hello %s"
2459
+ msgstr "سلام %s"
2460
+
2461
+ #: templates/logged-in.php:11
2462
+ #, php-format
2463
+ msgid "You are currently logged in! %s?"
2464
+ msgstr "شما در حال حاضر به سیستم وارد شده اید! %s?"
2465
+
2466
+ #: templates/login-form.php:33
2467
+ msgid "Remember Me"
2468
+ msgstr "مرا خاطر داشته باش"
2469
+
2470
+ #: templates/login-form.php:37
2471
+ msgid "Log In"
2472
+ msgstr "ورود"
2473
+
2474
+ #: templates/lost-pass-form.php:14
2475
+ msgid "Username or E-mail:"
2476
+ msgstr "نام کاربری یا ایمیل:"
2477
+
2478
+ #: templates/lost-pass-form.php:21
2479
+ msgid "Get New Password"
2480
+ msgstr "دریافت کلمه عبور جدید"
2481
+
2482
+ #: templates/reset-pass-form.php:14
2483
+ msgid "New password"
2484
+ msgstr "کلمه عبور جدید"
2485
+
2486
+ #: templates/reset-pass-form.php:19
2487
+ msgid "Confirm new password"
2488
+ msgstr "تکرار کلمه عبور جدید"
2489
+
2490
+ #: templates/reset-pass-form.php:26
2491
+ msgid "Reset Password"
2492
+ msgstr "تنظیم دوباره کلمه عبور"
2493
+
2494
+ #: wpuf-functions.php:26
2495
+ msgid "Live"
2496
+ msgstr "منتشر شده"
2497
+
2498
+ #: wpuf-functions.php:30
2499
+ msgid "Offline"
2500
+ msgstr "آفلاین"
2501
+
2502
+ #: wpuf-functions.php:34
2503
+ msgid "Awaiting Approval"
2504
+ msgstr "در انتظار تائید"
2505
+
2506
+ #: wpuf-functions.php:37 wpuf-functions.php:71
2507
+ msgid "Scheduled"
2508
+ msgstr "زمان بندی شده"
2509
+
2510
+ #: wpuf-functions.php:41
2511
+ msgid "Private"
2512
+ msgstr "خصوصی"
2513
+
2514
+ #: wpuf-functions.php:60
2515
+ msgid "Published"
2516
+ msgstr "منتشر شده"
2517
+
2518
+ #: wpuf-functions.php:64
2519
+ msgid "Draft"
2520
+ msgstr "پیش نویس"
2521
+
2522
+ #: wpuf-functions.php:68
2523
+ msgid "Pending"
2524
+ msgstr "در حال انتظار"
2525
+
2526
+ #: wpuf-functions.php:204
2527
+ msgid "-- select --"
2528
+ msgstr "- انتخاب -"
2529
+
2530
+ #: wpuf-functions.php:395
2531
+ msgid "Images"
2532
+ msgstr "تصاویر"
2533
+
2534
+ #: wpuf-functions.php:396
2535
+ msgid "Audio"
2536
+ msgstr "صوتی"
2537
+
2538
+ #: wpuf-functions.php:397
2539
+ msgid "Videos"
2540
+ msgstr "ویدئوها"
2541
+
2542
+ #: wpuf-functions.php:398
2543
+ msgid "PDF"
2544
+ msgstr "PDF"
2545
+
2546
+ #: wpuf-functions.php:399
2547
+ msgid "Office Documents"
2548
+ msgstr "اسناد آفیس"
2549
+
2550
+ #: wpuf-functions.php:400
2551
+ msgid "Zip Archives"
2552
+ msgstr "فایل های فشرده شده"
2553
+
2554
+ #: wpuf-functions.php:401
2555
+ msgid "Executable Files"
2556
+ msgstr "فایل های اجرایی"
2557
+
2558
+ #: wpuf-functions.php:402
2559
+ msgid "CSV"
2560
+ msgstr "CSV"
2561
+
2562
+ #: wpuf-functions.php:925
2563
+ msgctxt "tag delimiter"
2564
+ msgid ","
2565
+ msgstr ","
2566
+
2567
+ #: wpuf.php:106
2568
+ msgid "Your Post Has Been Expired"
2569
+ msgstr "نوشته شما منقضی شده است"
2570
+
2571
+ #: wpuf.php:278
2572
+ msgid "Please fix the errors to proceed"
2573
+ msgstr "برای انجام عملیات لطفا این خطا ها را رفع کنید"
2574
+
2575
+ #. Plugin URI of the plugin/theme
2576
+ msgid "https://wordpress.org/plugins/wp-user-frontend/"
2577
+ msgstr "https://wordpress.org/plugins/wp-user-frontend/"
2578
+
2579
+ #. Description of the plugin/theme
2580
+ msgid ""
2581
+ "Create, edit, delete, manages your post, pages or custom post types from "
2582
+ "frontend. Create registration forms, frontend profile and more..."
2583
+ msgstr ""
2584
+ "ایجاد، ویرایش، حذف، مدیریت مطالب، برگه ها و یا نوع نوشته سفارشی در ظاهر خود "
2585
+ "پوسته وبسایت. ساخت فرم های ثبت نام، ورود، پروفایل و موارد بیشتر ..."
2586
+
2587
+ #. Author of the plugin/theme
2588
+ msgid "Tareq Hasan"
2589
+ msgstr "Tareq Hasan"
2590
+
2591
+ #. Author URI of the plugin/theme
2592
+ msgid "http://tareq.weDevs.com"
2593
+ msgstr "http://tareq.weDevs.com"
languages/wpuf-zh_CN.mo ADDED
Binary file
languages/wpuf-zh_CN.po ADDED
@@ -0,0 +1,3119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: WP User Frontend\n"
4
+ "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2016-05-17 18:20+0800\n"
6
+ "PO-Revision-Date: 2016-05-17 18:22+0800\n"
7
+ "Last-Translator: Amos Lee <iwillhappy1314@gmail.com>\n"
8
+ "Language-Team: \n"
9
+ "Language: zh_CN\n"
10
+ "MIME-Version: 1.0\n"
11
+ "Content-Type: text/plain; charset=UTF-8\n"
12
+ "Content-Transfer-Encoding: 8bit\n"
13
+ "X-Poedit-KeywordsList: _e;__\n"
14
+ "X-Poedit-Basepath: .\n"
15
+ "X-Generator: Poedit 1.8.7\n"
16
+ "X-Poedit-SearchPath-0: ..\n"
17
+
18
+ #: ../admin/add-ons.php:2
19
+ msgid "WP User Frontend - Add-Ons"
20
+ msgstr "WP用户前端插件-扩展"
21
+
22
+ #: ../admin/form.php:155 ../admin/form.php:175 ../admin/form.php:177
23
+ #: ../admin/form.php:213
24
+ msgid "Forms"
25
+ msgstr "表单"
26
+
27
+ #: ../admin/form.php:176 ../admin/form.php:214
28
+ msgid "Form"
29
+ msgstr "表单"
30
+
31
+ #: ../admin/form.php:178 ../admin/form.php:216
32
+ msgid "Add Form"
33
+ msgstr "添加表单"
34
+
35
+ #: ../admin/form.php:179 ../admin/form.php:217
36
+ msgid "Add New Form"
37
+ msgstr "添加新表单"
38
+
39
+ #: ../admin/form.php:180 ../admin/form.php:218 ../admin/installer.php:74
40
+ #: ../admin/subscription.php:228 ../class/subscription.php:360
41
+ #: ../includes/free/edit-user.php:99 ../templates/dashboard.php:102
42
+ msgid "Edit"
43
+ msgstr "编辑"
44
+
45
+ #: ../admin/form.php:181 ../admin/form.php:219
46
+ msgid "Edit Form"
47
+ msgstr "编辑表单"
48
+
49
+ #: ../admin/form.php:182 ../admin/form.php:220
50
+ msgid "New Form"
51
+ msgstr "新表单"
52
+
53
+ #: ../admin/form.php:183 ../admin/form.php:184 ../admin/form.php:221
54
+ #: ../admin/form.php:222
55
+ msgid "View Form"
56
+ msgstr "查看表单"
57
+
58
+ #: ../admin/form.php:185 ../admin/form.php:223
59
+ msgid "Search Form"
60
+ msgstr "搜索表单"
61
+
62
+ #: ../admin/form.php:186 ../admin/form.php:224
63
+ msgid "No Form Found"
64
+ msgstr "没找到表单"
65
+
66
+ #: ../admin/form.php:187 ../admin/form.php:225
67
+ msgid "No Form Found in Trash"
68
+ msgstr "回收站里没有表单"
69
+
70
+ #: ../admin/form.php:188 ../admin/form.php:226
71
+ msgid "Parent Form"
72
+ msgstr "父表单"
73
+
74
+ #: ../admin/form.php:193
75
+ msgid "Registraton Forms"
76
+ msgstr "注册表单"
77
+
78
+ #: ../admin/form.php:215 ../includes/free/loader.php:57
79
+ msgid "Registration Forms"
80
+ msgstr "注册表单"
81
+
82
+ #: ../admin/form.php:246 ../admin/form.php:249
83
+ msgid "Form updated."
84
+ msgstr "表单已更新"
85
+
86
+ #: ../admin/form.php:247 ../admin/subscription.php:53
87
+ msgid "Custom field updated."
88
+ msgstr "自定义字段已更新"
89
+
90
+ #: ../admin/form.php:248 ../admin/subscription.php:54
91
+ msgid "Custom field deleted."
92
+ msgstr "自定义字段已删除"
93
+
94
+ #: ../admin/form.php:250
95
+ #, php-format
96
+ msgid "Form restored to revision from %s"
97
+ msgstr "表单已从 %s版本中恢复"
98
+
99
+ #: ../admin/form.php:251
100
+ msgid "Form published."
101
+ msgstr "表单已发布"
102
+
103
+ #: ../admin/form.php:252
104
+ msgid "Form saved."
105
+ msgstr "表单已保存。"
106
+
107
+ #: ../admin/form.php:253
108
+ msgid "Form submitted."
109
+ msgstr "表单已提交"
110
+
111
+ #: ../admin/form.php:255
112
+ msgid "Form draft updated."
113
+ msgstr "表单草稿已更新"
114
+
115
+ #: ../admin/form.php:284 ../admin/form.php:303
116
+ msgid "Form Name"
117
+ msgstr "表单名"
118
+
119
+ #: ../admin/form.php:285 ../admin/form.php:676
120
+ msgid "Post Type"
121
+ msgstr "文章类型"
122
+
123
+ #: ../admin/form.php:286 ../admin/form.php:696
124
+ msgid "Post Status"
125
+ msgstr "文章状态"
126
+
127
+ #: ../admin/form.php:287 ../admin/form.php:745
128
+ msgid "Guest Post"
129
+ msgstr "访客文章"
130
+
131
+ #: ../admin/form.php:288 ../admin/form.php:305 ../admin/form.php:461
132
+ #: ../admin/form.php:472
133
+ msgid "Shortcode"
134
+ msgstr "简码"
135
+
136
+ #: ../admin/form.php:304
137
+ msgid "User Role"
138
+ msgstr "用户角色"
139
+
140
+ #: ../admin/form.php:339 ../admin/settings-options.php:86
141
+ #: ../admin/settings-options.php:160 ../admin/settings-options.php:171
142
+ #: ../admin/settings-options.php:260 ../admin/subscription.php:148
143
+ #: ../admin/template.php:74 ../includes/free/form.php:476
144
+ msgid "No"
145
+ msgstr "否"
146
+
147
+ #: ../admin/form.php:339 ../admin/settings-options.php:85
148
+ #: ../admin/settings-options.php:159 ../admin/settings-options.php:170
149
+ #: ../admin/settings-options.php:259 ../admin/subscription.php:146
150
+ #: ../admin/template.php:73 ../includes/free/form.php:475
151
+ msgid "Yes"
152
+ msgstr "是"
153
+
154
+ #: ../admin/form.php:386
155
+ msgid "Duplicate form"
156
+ msgstr "复制表单"
157
+
158
+ #: ../admin/form.php:386
159
+ msgid "Duplicate"
160
+ msgstr "复制"
161
+
162
+ #: ../admin/form.php:449
163
+ msgid "WPUF Form"
164
+ msgstr "WPUF 表单"
165
+
166
+ #: ../admin/form.php:459 ../admin/form.php:470 ../admin/form.php:1046
167
+ #: ../admin/form.php:1086
168
+ msgid "Form Editor"
169
+ msgstr "表单编辑器"
170
+
171
+ #: ../admin/form.php:460 ../admin/form.php:471
172
+ msgid "Form Elements"
173
+ msgstr "表单元素"
174
+
175
+ #: ../admin/form.php:486 ../admin/form.php:503
176
+ msgid "Copy and insert this shortcode to a page:"
177
+ msgstr "复制并插入该简码到页面:"
178
+
179
+ #: ../admin/form.php:507
180
+ msgid "Profile Shortcode:"
181
+ msgstr "个人资料简介:"
182
+
183
+ #: ../admin/form.php:515
184
+ msgid "Registration Shortcode:"
185
+ msgstr "注册简码:"
186
+
187
+ #: ../admin/form.php:538
188
+ msgid "Preview Form"
189
+ msgstr "预览表单"
190
+
191
+ #: ../admin/form.php:548
192
+ msgid "Schedule"
193
+ msgstr "日程"
194
+
195
+ #: ../admin/form.php:551
196
+ msgid "Publish"
197
+ msgstr "发布"
198
+
199
+ #: ../admin/form.php:556
200
+ msgid "Submit for Review"
201
+ msgstr "提交评论"
202
+
203
+ #: ../admin/form.php:634
204
+ msgid "This page is restricted. Please Log in / Register to view this page."
205
+ msgstr "本文访问受限。请登录/注册以查看本文。"
206
+
207
+ #: ../admin/form.php:643 ../admin/subscription.php:206
208
+ #: ../admin/template-post.php:177 ../includes/free/edit-profile.php:92
209
+ msgid "Name"
210
+ msgstr "名称"
211
+
212
+ #: ../admin/form.php:644 ../admin/form.php:1118 ../admin/transaction.php:107
213
+ #: ../includes/free/edit-user.php:152
214
+ msgid "Email"
215
+ msgstr "Email"
216
+
217
+ #: ../admin/form.php:648
218
+ msgid "Post saved"
219
+ msgstr "文章已保存"
220
+
221
+ #: ../admin/form.php:649 ../admin/form.php:895
222
+ msgid "Post updated successfully"
223
+ msgstr "文章已更新成功"
224
+
225
+ #: ../admin/form.php:654
226
+ msgid "Submit"
227
+ msgstr "提交"
228
+
229
+ #: ../admin/form.php:655 ../class/render-form.php:577
230
+ msgid "Save Draft"
231
+ msgstr "保存草稿"
232
+
233
+ #: ../admin/form.php:656
234
+ msgid "Preview"
235
+ msgstr "预览"
236
+
237
+ #: ../admin/form.php:664 ../admin/form.php:668
238
+ msgid "Disable Subscription"
239
+ msgstr "禁用订阅"
240
+
241
+ #: ../admin/form.php:671
242
+ msgid ""
243
+ "If checked, any subscription and pay-per-post will be disabled on the form "
244
+ "and will take no effect."
245
+ msgstr "如果勾选此项,所有套餐或按次付费的功能将被禁用,并处于不可用状态。"
246
+
247
+ #: ../admin/form.php:710
248
+ msgid "Post Format"
249
+ msgstr "文章格式"
250
+
251
+ #: ../admin/form.php:713 ../admin/form.php:737
252
+ msgid "- None -"
253
+ msgstr "- 无 -"
254
+
255
+ #: ../admin/form.php:729
256
+ msgid "Default Post Category"
257
+ msgstr "默认文章类别"
258
+
259
+ #: ../admin/form.php:740
260
+ msgid ""
261
+ "If users are not allowed to choose any category, this category will be used "
262
+ "instead (if post type supports)"
263
+ msgstr "如果用户被不允许选择分类,将使用这个分类"
264
+
265
+ #: ../admin/form.php:750
266
+ msgid "Enable Guest Post"
267
+ msgstr "启用访客发文章"
268
+
269
+ #: ../admin/form.php:752
270
+ msgid "Unregistered users will be able to submit posts"
271
+ msgstr "未注册用户将可以提交文章"
272
+
273
+ #: ../admin/form.php:757
274
+ msgid "User Details"
275
+ msgstr "用户详情"
276
+
277
+ #: ../admin/form.php:762
278
+ msgid "Require Name and Email address"
279
+ msgstr "需要名称和Email 地址"
280
+
281
+ #: ../admin/form.php:764
282
+ msgid ""
283
+ "If requires, users will be automatically registered to the site using the "
284
+ "name and email address"
285
+ msgstr "如果需要,用户将使用这个用户名和email注册为网站用户。"
286
+
287
+ #: ../admin/form.php:769
288
+ msgid "Name Label"
289
+ msgstr "姓名标签"
290
+
291
+ #: ../admin/form.php:774
292
+ msgid "Label text for name field"
293
+ msgstr "名称字段的文字标签"
294
+
295
+ #: ../admin/form.php:779
296
+ msgid "E-Mail Label"
297
+ msgstr "E-Mail 标签"
298
+
299
+ #: ../admin/form.php:784
300
+ msgid "Label text for email field"
301
+ msgstr "email 字段的标签文字"
302
+
303
+ #: ../admin/form.php:789 ../admin/settings-options.php:216
304
+ msgid "Unauthorized Message"
305
+ msgstr "未注册用户管理"
306
+
307
+ #: ../admin/form.php:792 ../admin/settings-options.php:217
308
+ msgid "Not logged in users will see this message"
309
+ msgstr "没有登录用户将看到这个信息"
310
+
311
+ #: ../admin/form.php:797 ../admin/form.php:921 ../includes/free/form.php:374
312
+ msgid "Redirect To"
313
+ msgstr "重定向到"
314
+
315
+ #: ../admin/form.php:802 ../admin/form.php:926
316
+ msgid "Newly created post"
317
+ msgstr "新创建的文章"
318
+
319
+ #: ../admin/form.php:803 ../admin/form.php:927 ../includes/free/form.php:379
320
+ msgid "Same Page"
321
+ msgstr "同一页"
322
+
323
+ #: ../admin/form.php:804 ../admin/form.php:928 ../includes/free/form.php:380
324
+ msgid "To a page"
325
+ msgstr "到一个页面"
326
+
327
+ #: ../admin/form.php:805 ../admin/form.php:929 ../includes/free/form.php:381
328
+ msgid "To a custom URL"
329
+ msgstr "到一个自定义URL"
330
+
331
+ #: ../admin/form.php:814 ../admin/form.php:938 ../includes/free/form.php:390
332
+ msgid "After successfull submit, where the page will redirect to"
333
+ msgstr "提交成功以后,页面将重定向到"
334
+
335
+ #: ../admin/form.php:820
336
+ msgid "Message to show"
337
+ msgstr "信息显示"
338
+
339
+ #: ../admin/form.php:828 ../admin/form.php:951 ../includes/free/form.php:410
340
+ msgid "Page"
341
+ msgstr "页面"
342
+
343
+ #: ../admin/form.php:843 ../admin/form.php:966 ../includes/free/form.php:425
344
+ msgid "Custom URL"
345
+ msgstr "自定义URL"
346
+
347
+ #: ../admin/form.php:850
348
+ msgid "Comment Status"
349
+ msgstr "评论状态"
350
+
351
+ #: ../admin/form.php:853
352
+ msgid "Open"
353
+ msgstr "打开"
354
+
355
+ #: ../admin/form.php:854
356
+ msgid "Closed"
357
+ msgstr "关闭"
358
+
359
+ #: ../admin/form.php:860
360
+ msgid "Submit Post Button text"
361
+ msgstr "提交文章按钮文字"
362
+
363
+ #: ../admin/form.php:867
364
+ msgid "Post Draft"
365
+ msgstr "文章草稿"
366
+
367
+ #: ../admin/form.php:872
368
+ msgid "Enable Saving as draft"
369
+ msgstr "启用保存为草稿"
370
+
371
+ #: ../admin/form.php:874
372
+ msgid "It will show a button to save as draft"
373
+ msgstr "会显示一个保存为草稿按钮"
374
+
375
+ #: ../admin/form.php:898
376
+ msgid "Update"
377
+ msgstr "更新"
378
+
379
+ #: ../admin/form.php:904
380
+ msgid "Set Post Status to"
381
+ msgstr "设置文章状态到"
382
+
383
+ #: ../admin/form.php:914
384
+ msgid "No Change"
385
+ msgstr "未改变"
386
+
387
+ #: ../admin/form.php:944
388
+ msgid "Post Update Message"
389
+ msgstr "文章更新信息"
390
+
391
+ #: ../admin/form.php:973
392
+ msgid "Subscription Title"
393
+ msgstr "套餐名称"
394
+
395
+ #: ../admin/form.php:982
396
+ msgid "Update Post Button text"
397
+ msgstr "更新文章按钮文字"
398
+
399
+ #: ../admin/form.php:995 ../admin/form.php:999
400
+ msgid "- Select -"
401
+ msgstr "- 选择 -"
402
+
403
+ #: ../admin/form.php:1047
404
+ msgid "Post Settings"
405
+ msgstr "文章设置"
406
+
407
+ #: ../admin/form.php:1048
408
+ msgid "Edit Settings"
409
+ msgstr "编辑设置"
410
+
411
+ #: ../admin/form.php:1049 ../includes/free/form.php:211
412
+ #: ../includes/free/form.php:248
413
+ msgid "Notification"
414
+ msgstr "通知"
415
+
416
+ #: ../admin/form.php:1050 ../includes/free/form.php:55
417
+ msgid "Post Expiration"
418
+ msgstr "文章有效期"
419
+
420
+ #: ../admin/form.php:1087 ../admin/settings.php:69
421
+ msgid "Settings"
422
+ msgstr "设置"
423
+
424
+ #: ../admin/form.php:1107 ../admin/form.php:1148 ../admin/form.php:1149
425
+ #: ../admin/form.php:1150 ../admin/form.php:1151 ../admin/form.php:1152
426
+ #: ../admin/form.php:1153 ../includes/free/form.php:6
427
+ #: ../includes/free/form.php:26
428
+ msgid "Click to add to the editor"
429
+ msgstr "勾选添加到编辑器"
430
+
431
+ #: ../admin/form.php:1109
432
+ msgid "Custom Fields"
433
+ msgstr "自定义字段"
434
+
435
+ #: ../admin/form.php:1111
436
+ msgid "Text"
437
+ msgstr "文字"
438
+
439
+ #: ../admin/form.php:1112 ../admin/template.php:185
440
+ msgid "Textarea"
441
+ msgstr "文字区域"
442
+
443
+ #: ../admin/form.php:1113 ../admin/template-post.php:166
444
+ msgid "Dropdown"
445
+ msgstr "下拉"
446
+
447
+ #: ../admin/form.php:1114 ../admin/template-post.php:167
448
+ msgid "Multi Select"
449
+ msgstr "多选"
450
+
451
+ #: ../admin/form.php:1115
452
+ msgid "Radio"
453
+ msgstr "单选"
454
+
455
+ #: ../admin/form.php:1116 ../admin/template-post.php:168
456
+ msgid "Checkbox"
457
+ msgstr "复选"
458
+
459
+ #: ../admin/form.php:1117
460
+ msgid "URL"
461
+ msgstr "URL"
462
+
463
+ #: ../admin/form.php:1119
464
+ msgid "Hidden Field"
465
+ msgstr "隐藏字段"
466
+
467
+ #: ../admin/form.php:1126
468
+ msgid "Others"
469
+ msgstr "其他"
470
+
471
+ #: ../admin/form.php:1128
472
+ msgid "Section Break"
473
+ msgstr "分节符"
474
+
475
+ #: ../admin/form.php:1129
476
+ msgid "HTML"
477
+ msgstr "HTML"
478
+
479
+ #: ../admin/form.php:1146
480
+ msgid "Post Fields"
481
+ msgstr "文章字段"
482
+
483
+ #: ../admin/form.php:1148
484
+ msgid "Post Title"
485
+ msgstr "文章标题"
486
+
487
+ #: ../admin/form.php:1149
488
+ msgid "Post Body"
489
+ msgstr "文章正文"
490
+
491
+ #: ../admin/form.php:1150
492
+ msgid "Excerpt"
493
+ msgstr "摘录"
494
+
495
+ #: ../admin/form.php:1151
496
+ msgid "Tags"
497
+ msgstr "标签"
498
+
499
+ #: ../admin/form.php:1152
500
+ msgid "Category"
501
+ msgstr "分类"
502
+
503
+ #: ../admin/form.php:1153 ../templates/dashboard.php:23
504
+ msgid "Featured Image"
505
+ msgstr "特色图像"
506
+
507
+ #: ../admin/form.php:1159
508
+ msgid "Custom Taxonomies"
509
+ msgstr "自定义分类"
510
+
511
+ #: ../admin/form.php:1183
512
+ msgid "Profile Fields"
513
+ msgstr "简介字段"
514
+
515
+ #: ../admin/form.php:1185 ../admin/form.php:1599
516
+ #: ../includes/free/edit-profile.php:96 ../includes/free/edit-user.php:92
517
+ #: ../includes/free/edit-user.php:144 ../templates/login-form.php:21
518
+ msgid "Username"
519
+ msgstr "用户名"
520
+
521
+ #: ../admin/form.php:1186 ../admin/form.php:1603
522
+ #: ../includes/free/edit-profile.php:100
523
+ msgid "First Name"
524
+ msgstr "姓"
525
+
526
+ #: ../admin/form.php:1187 ../admin/form.php:1607
527
+ #: ../includes/free/edit-profile.php:105
528
+ msgid "Last Name"
529
+ msgstr "名"
530
+
531
+ #: ../admin/form.php:1188 ../admin/form.php:1611
532
+ #: ../includes/free/edit-profile.php:110
533
+ msgid "Nickname"
534
+ msgstr "昵称"
535
+
536
+ #: ../admin/form.php:1189 ../admin/form.php:1615
537
+ #: ../includes/free/edit-profile.php:151
538
+ msgid "E-mail"
539
+ msgstr "E-mail"
540
+
541
+ #: ../admin/form.php:1190 ../admin/form.php:1619
542
+ #: ../includes/free/edit-profile.php:156
543
+ msgid "Website"
544
+ msgstr "网址"
545
+
546
+ #: ../admin/form.php:1191 ../admin/form.php:1623
547
+ #: ../includes/free/edit-profile.php:178
548
+ msgid "Biographical Info"
549
+ msgstr "简历信息"
550
+
551
+ #: ../admin/form.php:1192 ../admin/form.php:1627 ../templates/login-form.php:25
552
+ msgid "Password"
553
+ msgstr "密码"
554
+
555
+ #: ../admin/form.php:1193 ../admin/form.php:1631
556
+ msgid "Avatar"
557
+ msgstr "头像"
558
+
559
+ #: ../admin/form.php:1353 ../includes/free/form.php:301
560
+ msgid "Toggle All"
561
+ msgstr "展开/收起全部"
562
+
563
+ #: ../admin/form.php:1357 ../includes/free/form.php:305
564
+ msgid "Click on a form element to add to the editor"
565
+ msgstr "单击右侧的表单元素自动添加到编辑器"
566
+
567
+ #: ../admin/installer.php:27
568
+ msgid ""
569
+ "If you have not created <strong>WP User Frontend Pro</strong> pages yet, you "
570
+ "can do this by one click."
571
+ msgstr ""
572
+ "如果您尚未创建<strong>WP User Frontend Pro</strong>页面,您可以点击这里来创"
573
+ "建。"
574
+
575
+ #: ../admin/installer.php:30 ../admin/tools.php:348
576
+ msgid "Install WPUF Pages"
577
+ msgstr "安装 WP User Frontend 页面"
578
+
579
+ #: ../admin/installer.php:32
580
+ msgid "Skip Setup"
581
+ msgstr "跳过安装"
582
+
583
+ #: ../admin/installer.php:42
584
+ msgid "Congratulations!"
585
+ msgstr "恭喜!"
586
+
587
+ #: ../admin/installer.php:42
588
+ msgid ""
589
+ "Pages for <strong>WP User Frontend Pro</strong> has been successfully "
590
+ "installed and saved!"
591
+ msgstr "<strong>WP User Frontend Pro</strong>所需的网页已成功安装并保存!"
592
+
593
+ #: ../admin/installer.php:73 ../admin/settings-options.php:17
594
+ msgid "Dashboard"
595
+ msgstr "仪表盘"
596
+
597
+ #: ../admin/installer.php:77
598
+ msgid "Login"
599
+ msgstr "登录"
600
+
601
+ #: ../admin/installer.php:82 ../admin/settings.php:62
602
+ #: ../class/subscription.php:335 ../class/subscription.php:355
603
+ #: ../class/subscription.php:356 ../class/subscription.php:357
604
+ msgid "Subscription"
605
+ msgstr "订阅"
606
+
607
+ #: ../admin/installer.php:82
608
+ msgid "[wpuf_sub_pack]"
609
+ msgstr "[wpuf_sub_pack]"
610
+
611
+ #: ../admin/installer.php:83 ../templates/dashboard.php:33
612
+ msgid "Payment"
613
+ msgstr "支付"
614
+
615
+ #: ../admin/installer.php:83
616
+ msgid "Please select a gateway for payment"
617
+ msgstr "请选择支付网关"
618
+
619
+ #: ../admin/installer.php:84
620
+ msgid "Thank You"
621
+ msgstr "非常感谢!"
622
+
623
+ #: ../admin/installer.php:84
624
+ msgid ""
625
+ "<h1>Payment is complete</h1><p>Congratulations, your payment has been "
626
+ "completed!</p>"
627
+ msgstr "<h1>支付成功</h1><p>恭喜您,您的付款已完成! </p>"
628
+
629
+ #: ../admin/installer.php:85
630
+ msgid "Order Received"
631
+ msgstr "已收到订单"
632
+
633
+ #: ../admin/installer.php:85
634
+ msgid ""
635
+ "Hi, we have received your order. We will validate the order and will take "
636
+ "necessary steps to move forward."
637
+ msgstr "亲,我们已收到您的订单!我们将马不停蹄为您处理"
638
+
639
+ #: ../admin/installer.php:164
640
+ msgid "Registration"
641
+ msgstr "注册"
642
+
643
+ #: ../admin/installer.php:229
644
+ msgid "Sample Form"
645
+ msgstr "样例表单"
646
+
647
+ #: ../admin/posting.php:38 ../class/render-form.php:1432 ../wpuf.php:338
648
+ msgid "Are you sure?"
649
+ msgstr "你确定?"
650
+
651
+ #: ../admin/posting.php:44 ../wpuf.php:344
652
+ msgid "Allowed Files"
653
+ msgstr "允许上传的文件"
654
+
655
+ #: ../admin/posting.php:55
656
+ msgid "WPUF Custom Fields"
657
+ msgstr "WPUF 自定义字段"
658
+
659
+ #: ../admin/posting.php:83
660
+ msgid "No custom fields found."
661
+ msgstr "没找到自定义字段。"
662
+
663
+ #: ../admin/settings-options.php:13
664
+ msgid "General Options"
665
+ msgstr "常规选项"
666
+
667
+ #: ../admin/settings-options.php:21
668
+ msgid "Login / Registration"
669
+ msgstr "登录 / 注册"
670
+
671
+ #: ../admin/settings-options.php:25
672
+ msgid "Payments"
673
+ msgstr "支付"
674
+
675
+ #: ../admin/settings-options.php:29
676
+ msgid "Support"
677
+ msgstr "支持"
678
+
679
+ #: ../admin/settings-options.php:44
680
+ msgid "Fixed Form Elements "
681
+ msgstr "固定表单元素"
682
+
683
+ #: ../admin/settings-options.php:45
684
+ msgid "Show fixed form elements sidebar in form editor"
685
+ msgstr "在表单编辑器固定显示表单元素侧边栏"
686
+
687
+ #: ../admin/settings-options.php:51
688
+ msgid "Edit Page"
689
+ msgstr "编辑页面"
690
+
691
+ #: ../admin/settings-options.php:52
692
+ msgid "Select the page where [wpuf_edit] is located"
693
+ msgstr "选择 [wpuf_edit] 所在的页面"
694
+
695
+ #: ../admin/settings-options.php:58
696
+ msgid "Default Post Owner"
697
+ msgstr "默认文章作者"
698
+
699
+ #: ../admin/settings-options.php:59
700
+ msgid ""
701
+ "If guest post is enabled and user details are OFF, the posts are assigned to "
702
+ "this user"
703
+ msgstr "如果访客发表文章是开启并且用户详情是关闭,本文指派给这个用户。"
704
+
705
+ #: ../admin/settings-options.php:66
706
+ msgid "Admin area access"
707
+ msgstr "管理区域访问"
708
+
709
+ #: ../admin/settings-options.php:67
710
+ msgid "Allow you to block specific user role to WordPress admin area."
711
+ msgstr "允许你阻止特定的用户角色访问WordPress管理区域。"
712
+
713
+ #: ../admin/settings-options.php:71
714
+ msgid "Admin Only"
715
+ msgstr "仅管理员"
716
+
717
+ #: ../admin/settings-options.php:72
718
+ msgid "Admins, Editors"
719
+ msgstr "管理员,编辑者"
720
+
721
+ #: ../admin/settings-options.php:73
722
+ msgid "Admins, Editors, Authors"
723
+ msgstr "管理员,编辑者,作者"
724
+
725
+ #: ../admin/settings-options.php:74
726
+ msgid "Admins, Editors, Authors, Contributors"
727
+ msgstr "管理员,编辑者,作者,投稿者"
728
+
729
+ #: ../admin/settings-options.php:75
730
+ msgid "Default"
731
+ msgstr "默认"
732
+
733
+ #: ../admin/settings-options.php:80
734
+ msgid "Override the post edit link"
735
+ msgstr "重写文章编辑链接"
736
+
737
+ #: ../admin/settings-options.php:81
738
+ msgid ""
739
+ "Users see the edit link in post if s/he is capable to edit the post/page. "
740
+ "Selecting <strong>Yes</strong> will override the default WordPress edit post "
741
+ "link in frontend"
742
+ msgstr ""
743
+ "如果用户可以编辑文章/页面则他可以看到文章编辑链接. 选择 <strong>是</strong> "
744
+ "将在前端重写链接地址"
745
+
746
+ #: ../admin/settings-options.php:91
747
+ msgid "Custom Fields in post"
748
+ msgstr "文章自定义字段"
749
+
750
+ #: ../admin/settings-options.php:92
751
+ msgid "Show custom fields on post content area"
752
+ msgstr "在文章内容区域显示自定义字段"
753
+
754
+ #: ../admin/settings-options.php:98
755
+ msgid "Load Scripts"
756
+ msgstr "加载代码"
757
+
758
+ #: ../admin/settings-options.php:99
759
+ msgid "Load scripts/styles in all pages"
760
+ msgstr "加载代码/样式到全部页面"
761
+
762
+ #: ../admin/settings-options.php:105
763
+ msgid "Insert Photo image size"
764
+ msgstr "插入照片尺寸"
765
+
766
+ #: ../admin/settings-options.php:106
767
+ msgid ""
768
+ "Default image size of \"<strong>Insert Photo</strong>\" button in post "
769
+ "content area"
770
+ msgstr "默认图像尺寸 \"<strong>插入图像</strong>\" 按钮在文章内容区域"
771
+
772
+ #: ../admin/settings-options.php:113
773
+ msgid "Insert Photo image type"
774
+ msgstr "插入照片类型"
775
+
776
+ #: ../admin/settings-options.php:114
777
+ msgid ""
778
+ "Default image type of \"<strong>Insert Photo</strong>\" button in post "
779
+ "content area"
780
+ msgstr "默认图像类型 \"<strong>插入图像</strong>\" 按钮在文章内容区域"
781
+
782
+ #: ../admin/settings-options.php:117
783
+ msgid "Image only"
784
+ msgstr "仅图片"
785
+
786
+ #: ../admin/settings-options.php:118
787
+ msgid "Image with link"
788
+ msgstr "图像链接"
789
+
790
+ #: ../admin/settings-options.php:124
791
+ msgid "Enable Image Caption"
792
+ msgstr "启用图像说明"
793
+
794
+ #: ../admin/settings-options.php:125
795
+ msgid "Allow users to update image/video title, caption and description"
796
+ msgstr "允许用户更新图像/视频标题,标题和说明"
797
+
798
+ #: ../admin/settings-options.php:131
799
+ msgid "Default Post Form"
800
+ msgstr "默认文章表单"
801
+
802
+ #: ../admin/settings-options.php:132
803
+ msgid "Fallback form for post editing if no associated form found"
804
+ msgstr "文章编辑后备表格,如果没有找到相关表格"
805
+
806
+ #: ../admin/settings-options.php:138
807
+ msgid "reCAPTCHA Public Key"
808
+ msgstr "验证码公开密匙"
809
+
810
+ #: ../admin/settings-options.php:142
811
+ msgid "reCAPTCHA Private Key"
812
+ msgstr "验证码私密密匙"
813
+
814
+ #: ../admin/settings-options.php:146
815
+ msgid "Custom CSS codes"
816
+ msgstr "自定义CSS代码"
817
+
818
+ #: ../admin/settings-options.php:147
819
+ msgid ""
820
+ "If you want to add your custom CSS code, it will be added on page header "
821
+ "wrapped with style tag"
822
+ msgstr "如果你想添加自定义CSS代码,它将被添加到页面页眉"
823
+
824
+ #: ../admin/settings-options.php:154
825
+ msgid "Users can edit post?"
826
+ msgstr "用户可以编辑文章?"
827
+
828
+ #: ../admin/settings-options.php:155
829
+ msgid "Users will be able to edit their own posts"
830
+ msgstr "用户将可以编辑他们的文章"
831
+
832
+ #: ../admin/settings-options.php:165
833
+ msgid "User can delete post?"
834
+ msgstr "用户可以删除文章?"
835
+
836
+ #: ../admin/settings-options.php:166
837
+ msgid "Users will be able to delete their own posts"
838
+ msgstr "用户可以删除他们自己的文章"
839
+
840
+ #: ../admin/settings-options.php:176
841
+ msgid "Pending Post Edit"
842
+ msgstr "待发表编辑"
843
+
844
+ #: ../admin/settings-options.php:177
845
+ msgid "Disable post editing while post in \"pending\" status"
846
+ msgstr "禁用文章编辑,如果文章是 \"等待\" 状态"
847
+
848
+ #: ../admin/settings-options.php:183
849
+ msgid "Posts per page"
850
+ msgstr "每页文章数"
851
+
852
+ #: ../admin/settings-options.php:184
853
+ msgid "How many posts will be listed in a page"
854
+ msgstr "多少文章将在一页被呈现"
855
+
856
+ #: ../admin/settings-options.php:190
857
+ msgid "Show user bio"
858
+ msgstr "显示用户简介"
859
+
860
+ #: ../admin/settings-options.php:191
861
+ msgid "Users biographical info will be shown"
862
+ msgstr "用户简历信息将显示"
863
+
864
+ #: ../admin/settings-options.php:197
865
+ msgid "Show post count"
866
+ msgstr "显示文章数"
867
+
868
+ #: ../admin/settings-options.php:198
869
+ msgid "Show how many posts are created by the user"
870
+ msgstr "显示用户创作的多少文章"
871
+
872
+ #: ../admin/settings-options.php:204
873
+ msgid "Show Featured Image"
874
+ msgstr "显示特色图像"
875
+
876
+ #: ../admin/settings-options.php:205
877
+ msgid "Show featured image of the post"
878
+ msgstr "显示文章特色图像"
879
+
880
+ #: ../admin/settings-options.php:210
881
+ msgid "Featured Image size"
882
+ msgstr "特色图像尺寸"
883
+
884
+ #: ../admin/settings-options.php:224
885
+ msgid "Auto Login After Registration"
886
+ msgstr "注册后自动登录"
887
+
888
+ #: ../admin/settings-options.php:225
889
+ msgid "If enabled, users after registration will be logged in to the system"
890
+ msgstr "如果启用,用户注册后将自动登录。"
891
+
892
+ #: ../admin/settings-options.php:231
893
+ msgid "Login/Registration override"
894
+ msgstr "登录/注册覆盖"
895
+
896
+ #: ../admin/settings-options.php:232
897
+ msgid ""
898
+ "If enabled, default login and registration forms will be overridden by WPUF "
899
+ "with pages below"
900
+ msgstr "如果启用,默认的登录和注册表格将被WPUF下面的页面覆盖"
901
+
902
+ #: ../admin/settings-options.php:238
903
+ msgid "Registration Page"
904
+ msgstr "注册页面"
905
+
906
+ #: ../admin/settings-options.php:239
907
+ msgid ""
908
+ "Select the page you want to use as registration page override <em>(should "
909
+ "have shortcode)</em>"
910
+ msgstr "选择你想用户用来注册的页面 <em>(应该有简码)</em>"
911
+
912
+ #: ../admin/settings-options.php:245
913
+ msgid "Login Page"
914
+ msgstr "登录页面"
915
+
916
+ #: ../admin/settings-options.php:246
917
+ msgid "Select the page which contains <code>[wpuf-login]</code> shortcode"
918
+ msgstr "选择包含页<code>[wpuf-login]</code>简码的页面。"
919
+
920
+ #: ../admin/settings-options.php:254
921
+ msgid "Charge for posting"
922
+ msgstr "发文章收费"
923
+
924
+ #: ../admin/settings-options.php:255
925
+ msgid "Charge user for submitting a post"
926
+ msgstr "收费用户才能提交文章"
927
+
928
+ #: ../admin/settings-options.php:265
929
+ msgid "Force pack purchase"
930
+ msgstr "强制购买套餐"
931
+
932
+ #: ../admin/settings-options.php:266
933
+ msgid "When active, users must have to buy a pack for posting"
934
+ msgstr "激活时,用户必须购买一个套餐才能发布文章。"
935
+
936
+ #: ../admin/settings-options.php:270
937
+ msgid "Disable"
938
+ msgstr "禁用"
939
+
940
+ #: ../admin/settings-options.php:271
941
+ msgid "Enable"
942
+ msgstr "启用"
943
+
944
+ #: ../admin/settings-options.php:276
945
+ msgid "Subscription Pack Page"
946
+ msgstr "套餐页面"
947
+
948
+ #: ../admin/settings-options.php:277
949
+ msgid "Select the page where <code>[wpuf_sub_pack]</code> located."
950
+ msgstr "选择 <code>[wpuf_sub_pack]</code> 所在的页面"
951
+
952
+ #: ../admin/settings-options.php:283
953
+ msgid "Subscription at registration"
954
+ msgstr "注册时购买套餐"
955
+
956
+ #: ../admin/settings-options.php:284
957
+ msgid "Registration time redirect to subscription page"
958
+ msgstr "注册时重定向到订阅页面。"
959
+
960
+ #: ../admin/settings-options.php:289
961
+ msgid "Currency"
962
+ msgstr "货币"
963
+
964
+ #: ../admin/settings-options.php:321
965
+ msgid "Currency Symbol"
966
+ msgstr "货币符号"
967
+
968
+ #: ../admin/settings-options.php:327 ../admin/subscription.php:208
969
+ #: ../admin/transaction.php:103 ../admin/transaction.php:181
970
+ msgid "Cost"
971
+ msgstr "费用"
972
+
973
+ #: ../admin/settings-options.php:328
974
+ msgid "Cost per post"
975
+ msgstr "每文费用"
976
+
977
+ #: ../admin/settings-options.php:334
978
+ msgid "Enable demo/sandbox mode"
979
+ msgstr "启用演示/沙盒模式"
980
+
981
+ #: ../admin/settings-options.php:335
982
+ msgid ""
983
+ "When sandbox mode is active, all payment gateway will be used in demo mode"
984
+ msgstr "当沙盒模式激活,全部支付方式将用于演示模式"
985
+
986
+ #: ../admin/settings-options.php:341
987
+ msgid "Payment Page"
988
+ msgstr "付款页面"
989
+
990
+ #: ../admin/settings-options.php:342
991
+ msgid "This page will be used to process payment options"
992
+ msgstr "这个页面将用于付款流程选项"
993
+
994
+ #: ../admin/settings-options.php:348
995
+ msgid "Payment Success Page"
996
+ msgstr "付款成功页面"
997
+
998
+ #: ../admin/settings-options.php:349 ../lib/gateway/bank.php:37
999
+ msgid "After payment users will be redirected here"
1000
+ msgstr "用户完成付款以后返回的页面"
1001
+
1002
+ #: ../admin/settings-options.php:355
1003
+ msgid "Payment Gateways"
1004
+ msgstr "支付方式"
1005
+
1006
+ #: ../admin/settings-options.php:356
1007
+ msgid "Active payment gateways"
1008
+ msgstr "激活支付方式"
1009
+
1010
+ #: ../admin/settings-options.php:364
1011
+ msgid "Need Help?"
1012
+ msgstr "需要帮助?"
1013
+
1014
+ #: ../admin/settings-options.php:398
1015
+ msgid ""
1016
+ "Select profile/registration forms for user roles. These forms will be used "
1017
+ "to populate extra edit profile fields in backend."
1018
+ msgstr ""
1019
+ "选择用户角色的个人资料/注册表单。这个表单将用于填写后端额外的编辑个人资料文件"
1020
+ "中的字段。"
1021
+
1022
+ #: ../admin/settings-options.php:409
1023
+ msgid " - select - "
1024
+ msgstr " - 选择 - "
1025
+
1026
+ #: ../admin/settings.php:55
1027
+ msgid "WP User Frontend"
1028
+ msgstr "前端用户中心"
1029
+
1030
+ #: ../admin/settings.php:55
1031
+ msgid "User Frontend"
1032
+ msgstr "前端用户中心"
1033
+
1034
+ #: ../admin/settings.php:66
1035
+ msgid "Transaction"
1036
+ msgstr "交易"
1037
+
1038
+ #: ../admin/settings.php:67
1039
+ msgid "Add-ons"
1040
+ msgstr "添加"
1041
+
1042
+ #: ../admin/settings.php:68 ../admin/tools.php:398
1043
+ msgid "Tools"
1044
+ msgstr "工具"
1045
+
1046
+ #: ../admin/subscription.php:52 ../admin/subscription.php:55
1047
+ msgid "Subscription pack updated."
1048
+ msgstr "套餐已更新"
1049
+
1050
+ #: ../admin/subscription.php:56
1051
+ #, php-format
1052
+ msgid "Subscription pack restored to revision from %s"
1053
+ msgstr "套餐已恢复到%s版本。"
1054
+
1055
+ #: ../admin/subscription.php:57
1056
+ msgid "Subscription pack published."
1057
+ msgstr "套餐已发布。"
1058
+
1059
+ #: ../admin/subscription.php:58
1060
+ msgid "Subscription pack saved."
1061
+ msgstr "套餐已保存。"
1062
+
1063
+ #: ../admin/subscription.php:59
1064
+ msgid "Subscription pack submitted."
1065
+ msgstr "套餐已提交。"
1066
+
1067
+ #: ../admin/subscription.php:61
1068
+ msgid "Subscription pack draft updated."
1069
+ msgstr "套餐草稿已更新。"
1070
+
1071
+ #: ../admin/subscription.php:134 ../admin/subscription.php:460
1072
+ #: ../class/subscription.php:671 ../class/subscription.php:830
1073
+ #: ../class/subscription.php:841 ../class/subscription.php:854
1074
+ msgid "Free"
1075
+ msgstr "免费"
1076
+
1077
+ #: ../admin/subscription.php:171 ../class/subscription.php:277
1078
+ msgid "Pack Name"
1079
+ msgstr "套餐名称"
1080
+
1081
+ #: ../admin/subscription.php:172
1082
+ msgid "Amount"
1083
+ msgstr "数量"
1084
+
1085
+ #: ../admin/subscription.php:173 ../includes/free/subscription.php:8
1086
+ msgid "Recurring"
1087
+ msgstr "重复"
1088
+
1089
+ #: ../admin/subscription.php:174
1090
+ msgid "Duration"
1091
+ msgstr "持续时间"
1092
+
1093
+ #: ../admin/subscription.php:197
1094
+ msgid "Pack Deleted"
1095
+ msgstr "套餐已删除"
1096
+
1097
+ #: ../admin/subscription.php:207 ../admin/template.php:599
1098
+ #: ../class/upload.php:166 ../wpuf-functions.php:700
1099
+ msgid "Description"
1100
+ msgstr "描述"
1101
+
1102
+ #: ../admin/subscription.php:209
1103
+ msgid "Validity"
1104
+ msgstr "有效期"
1105
+
1106
+ #: ../admin/subscription.php:210
1107
+ msgid "Post Count"
1108
+ msgstr "文章数"
1109
+
1110
+ #: ../admin/subscription.php:211 ../admin/transaction.php:184
1111
+ #: ../includes/free/edit-user.php:93
1112
+ msgid "Action"
1113
+ msgstr "动作"
1114
+
1115
+ #: ../admin/subscription.php:231
1116
+ msgid "Are you sure to delete this pack?"
1117
+ msgstr "你确定删除这个套餐?"
1118
+
1119
+ #: ../admin/subscription.php:232 ../class/render-form.php:1432
1120
+ #: ../class/upload.php:171 ../includes/free/edit-user.php:100
1121
+ #: ../templates/dashboard.php:112
1122
+ msgid "Delete"
1123
+ msgstr "删除"
1124
+
1125
+ #: ../admin/subscription.php:243
1126
+ msgid "No subscription pack found"
1127
+ msgstr "未发现套餐"
1128
+
1129
+ #: ../admin/subscription.php:290
1130
+ msgid "Pack Description"
1131
+ msgstr "套餐描述"
1132
+
1133
+ #: ../admin/subscription.php:297
1134
+ msgid "Billing amount:"
1135
+ msgstr "账单金额:"
1136
+
1137
+ #: ../admin/subscription.php:298
1138
+ msgid "Billing amount each cycle:"
1139
+ msgstr "每期账单金额:"
1140
+
1141
+ #: ../admin/subscription.php:306
1142
+ msgid "Expires In:"
1143
+ msgstr "截止时间:"
1144
+
1145
+ #: ../admin/subscription.php:328 ../includes/free/form.php:59
1146
+ msgid "Enable Post Expiration"
1147
+ msgstr "启用文章有效期"
1148
+
1149
+ #: ../admin/subscription.php:341 ../admin/subscription.php:539
1150
+ #: ../includes/free/form.php:64
1151
+ msgid "Post Expiration Time"
1152
+ msgstr "文章有效期"
1153
+
1154
+ #: ../admin/subscription.php:380 ../includes/free/form.php:110
1155
+ msgid "Status of post after post expiration time is over "
1156
+ msgstr "文章到期后的状态"
1157
+
1158
+ #: ../admin/subscription.php:411
1159
+ msgid "Day(s)"
1160
+ msgstr "天"
1161
+
1162
+ #: ../admin/subscription.php:412
1163
+ msgid "Week(s)"
1164
+ msgstr "周"
1165
+
1166
+ #: ../admin/subscription.php:413
1167
+ msgid "Month(s)"
1168
+ msgstr "月"
1169
+
1170
+ #: ../admin/subscription.php:414
1171
+ msgid "Year(s)"
1172
+ msgstr "年"
1173
+
1174
+ #: ../admin/subscription.php:451 ../includes/free/edit-profile.php:275
1175
+ msgid "WPUF Subscription"
1176
+ msgstr "WPUF 订阅"
1177
+
1178
+ #: ../admin/subscription.php:471 ../class/subscription.php:682
1179
+ msgid "Subscription Details"
1180
+ msgstr "订阅详情"
1181
+
1182
+ #: ../admin/subscription.php:475
1183
+ msgid "This user is using recurring subscription pack"
1184
+ msgstr "该用户使用的是定期套餐"
1185
+
1186
+ #: ../admin/subscription.php:480 ../class/subscription.php:684
1187
+ msgid "Subcription Name: "
1188
+ msgstr "订阅名称:"
1189
+
1190
+ #: ../admin/subscription.php:482
1191
+ msgid "Package billing details: "
1192
+ msgstr "套餐帐单明细:"
1193
+
1194
+ #: ../admin/subscription.php:492 ../class/subscription.php:697
1195
+ msgid "Remaining post: "
1196
+ msgstr "剩余文章:"
1197
+
1198
+ #: ../admin/subscription.php:514 ../class/subscription.php:724
1199
+ msgid "Expire date:"
1200
+ msgstr "过期日期:"
1201
+
1202
+ #: ../admin/subscription.php:528
1203
+ msgid "Post Expiration Enabled"
1204
+ msgstr "文章有效期已启用"
1205
+
1206
+ #: ../admin/subscription.php:566
1207
+ msgid "Assign Package"
1208
+ msgstr "指定套餐"
1209
+
1210
+ #: ../admin/subscription.php:567
1211
+ msgid "Show Package"
1212
+ msgstr "显示套餐"
1213
+
1214
+ #: ../admin/subscription.php:570 ../includes/free/edit-profile.php:279
1215
+ msgid "Pack:"
1216
+ msgstr "套餐:"
1217
+
1218
+ #: ../admin/subscription.php:573
1219
+ msgid "--Select--"
1220
+ msgstr "— 选择 —"
1221
+
1222
+ #: ../admin/subscription.php:581
1223
+ msgid "Delete Package"
1224
+ msgstr "删除套餐"
1225
+
1226
+ #: ../admin/template-post.php:43
1227
+ msgid "Enable Image Insertion"
1228
+ msgstr "启用图像插入"
1229
+
1230
+ #: ../admin/template-post.php:49
1231
+ msgid "Enable image upload in post area"
1232
+ msgstr "启用图像删除到文章区域"
1233
+
1234
+ #: ../admin/template-post.php:53 ../admin/template.php:363
1235
+ msgid "Word Restriction"
1236
+ msgstr "字数限制"
1237
+
1238
+ #: ../admin/template-post.php:103 ../admin/template.php:624
1239
+ msgid "Enter maximum upload size limit in KB"
1240
+ msgstr "输入最大上传大小 KB"
1241
+
1242
+ #: ../admin/template-post.php:115 ../admin/template.php:636
1243
+ msgid "Max. file size"
1244
+ msgstr "最大文件大小"
1245
+
1246
+ #: ../admin/template-post.php:164 ../admin/transaction.php:108
1247
+ #: ../admin/transaction.php:180
1248
+ msgid "Type"
1249
+ msgstr "类型"
1250
+
1251
+ #: ../admin/template-post.php:169
1252
+ msgid "Text Input"
1253
+ msgstr "文本输入框"
1254
+
1255
+ #: ../admin/template-post.php:170
1256
+ msgid "Ajax"
1257
+ msgstr "Ajax"
1258
+
1259
+ #: ../admin/template-post.php:175
1260
+ msgid "Order By"
1261
+ msgstr "排序方式"
1262
+
1263
+ #: ../admin/template-post.php:178
1264
+ msgid "Term ID"
1265
+ msgstr "项目ID"
1266
+
1267
+ #: ../admin/template-post.php:179
1268
+ msgid "Slug"
1269
+ msgstr "别名"
1270
+
1271
+ #: ../admin/template-post.php:180
1272
+ msgid "Count"
1273
+ msgstr "数"
1274
+
1275
+ #: ../admin/template-post.php:181
1276
+ msgid "Term Group"
1277
+ msgstr "Term Group"
1278
+
1279
+ #: ../admin/template-post.php:186
1280
+ msgid "Order"
1281
+ msgstr "订单"
1282
+
1283
+ #: ../admin/template-post.php:188
1284
+ msgid "ASC"
1285
+ msgstr "正序"
1286
+
1287
+ #: ../admin/template-post.php:189
1288
+ msgid "DESC"
1289
+ msgstr "倒序"
1290
+
1291
+ #: ../admin/template-post.php:194
1292
+ msgid "Selection Type"
1293
+ msgstr "选择类型"
1294
+
1295
+ #: ../admin/template-post.php:196
1296
+ msgid "Exclude"
1297
+ msgstr "排除"
1298
+
1299
+ #: ../admin/template-post.php:197
1300
+ msgid "Include"
1301
+ msgstr "包含"
1302
+
1303
+ #: ../admin/template-post.php:198
1304
+ msgid "Child of"
1305
+ msgstr "子"
1306
+
1307
+ #: ../admin/template-post.php:203
1308
+ msgid "Selection terms"
1309
+ msgstr "选择条款"
1310
+
1311
+ #: ../admin/template-post.php:204
1312
+ msgid ""
1313
+ "Enter the term IDs as comma separated (without space) to exclude/include in "
1314
+ "the form."
1315
+ msgstr "输入条款的ID,使用英文逗号分隔(不是空格)以从表单排除/包含。"
1316
+
1317
+ #: ../admin/template-post.php:208
1318
+ msgid "WooCommerce Attribute"
1319
+ msgstr "WooCommerce 属性"
1320
+
1321
+ #: ../admin/template-post.php:214
1322
+ msgid "This taxonomy is a WooCommerce attribute"
1323
+ msgstr "这个分类是WooCommerce属性"
1324
+
1325
+ #: ../admin/template-post.php:220
1326
+ msgid "Visibility"
1327
+ msgstr "可见性"
1328
+
1329
+ #: ../admin/template-post.php:226
1330
+ msgid "Visible on product page"
1331
+ msgstr "产品页面上可见"
1332
+
1333
+ #: ../admin/template-post.php:267
1334
+ msgid "all"
1335
+ msgstr "全部"
1336
+
1337
+ #: ../admin/template-post.php:267
1338
+ msgid "Show All"
1339
+ msgstr "显示所有"
1340
+
1341
+ #: ../admin/template-post.php:270
1342
+ msgid "hide"
1343
+ msgstr "隐藏"
1344
+
1345
+ #: ../admin/template-post.php:270
1346
+ msgid "Hide These Countries"
1347
+ msgstr "隐藏这些国家"
1348
+
1349
+ #: ../admin/template-post.php:275
1350
+ msgid "show"
1351
+ msgstr "显示"
1352
+
1353
+ #: ../admin/template-post.php:275
1354
+ msgid "Show These Countries"
1355
+ msgstr "显示这些国家"
1356
+
1357
+ #: ../admin/template.php:25
1358
+ msgid "Click and Drag to rearrange"
1359
+ msgstr "单击并拖动重新排列"
1360
+
1361
+ #: ../admin/template.php:29
1362
+ msgid "Remove"
1363
+ msgstr "移除"
1364
+
1365
+ #: ../admin/template.php:30
1366
+ msgid "Toggle"
1367
+ msgstr "切换"
1368
+
1369
+ #: ../admin/template.php:70
1370
+ msgid "Required"
1371
+ msgstr "必需"
1372
+
1373
+ #: ../admin/template.php:79
1374
+ msgid "Field Label"
1375
+ msgstr "字段标签"
1376
+
1377
+ #: ../admin/template.php:80
1378
+ msgid "Enter a title of this field"
1379
+ msgstr "输入此字段标题"
1380
+
1381
+ #: ../admin/template.php:85 ../admin/template.php:565
1382
+ msgid "Meta Key"
1383
+ msgstr "Meta Key"
1384
+
1385
+ #: ../admin/template.php:86 ../admin/template.php:566
1386
+ msgid "Name of the meta key this field will save to"
1387
+ msgstr "meta key 名称这个字段将保存到"
1388
+
1389
+ #: ../admin/template.php:97
1390
+ msgid "Help text"
1391
+ msgstr "帮助文字"
1392
+
1393
+ #: ../admin/template.php:98
1394
+ msgid "Give the user some information about this field"
1395
+ msgstr "关于这个字段给用户一些提示信息"
1396
+
1397
+ #: ../admin/template.php:102
1398
+ msgid "CSS Class Name"
1399
+ msgstr "CSS类名称"
1400
+
1401
+ #: ../admin/template.php:103
1402
+ msgid "Add a CSS class name for this field"
1403
+ msgstr "为这个字段添加一个CSS类名称"
1404
+
1405
+ #: ../admin/template.php:127 ../admin/template.php:175
1406
+ msgid "Placeholder text"
1407
+ msgstr "占位符文本"
1408
+
1409
+ #: ../admin/template.php:132 ../admin/template.php:180
1410
+ msgid "Default value"
1411
+ msgstr "默认值"
1412
+
1413
+ #: ../admin/template.php:137
1414
+ msgid "Size"
1415
+ msgstr "大小"
1416
+
1417
+ #: ../admin/template.php:165
1418
+ msgid "Rows"
1419
+ msgstr "行"
1420
+
1421
+ #: ../admin/template.php:170
1422
+ msgid "Columns"
1423
+ msgstr "列"
1424
+
1425
+ #: ../admin/template.php:188
1426
+ msgid "Normal"
1427
+ msgstr "正常"
1428
+
1429
+ #: ../admin/template.php:189
1430
+ msgid "Rich textarea"
1431
+ msgstr "丰富文本区域"
1432
+
1433
+ #: ../admin/template.php:190
1434
+ msgid "Teeny Rich textarea"
1435
+ msgstr "极小丰富文本区域"
1436
+
1437
+ #: ../admin/template.php:223
1438
+ msgid "Show values"
1439
+ msgstr "显示值"
1440
+
1441
+ #: ../admin/template.php:226 ../admin/template.php:284
1442
+ msgid "Label"
1443
+ msgstr "标签"
1444
+
1445
+ #: ../admin/template.php:226 ../admin/template.php:284
1446
+ msgid "Value"
1447
+ msgstr "值"
1448
+
1449
+ #: ../admin/template.php:283
1450
+ msgid "show values"
1451
+ msgstr "显示值"
1452
+
1453
+ #: ../admin/template.php:388 ../admin/template.php:412
1454
+ #: ../admin/template.php:444 ../admin/template.php:476
1455
+ #: ../templates/dashboard.php:36
1456
+ msgid "Options"
1457
+ msgstr "选项"
1458
+
1459
+ #: ../admin/template.php:428 ../admin/template.php:460
1460
+ msgid ""
1461
+ "First element of the select dropdown. Leave this empty if you don't want to "
1462
+ "show this field"
1463
+ msgstr "选择下拉的第一个元素。如果你不想显示这个字段请留空"
1464
+
1465
+ #: ../admin/template.php:439 ../admin/template.php:471
1466
+ msgid "Select Text"
1467
+ msgstr "选择文字"
1468
+
1469
+ #: ../admin/template.php:534 ../admin/template.php:594 ../class/upload.php:164
1470
+ #: ../templates/dashboard.php:26 ../wpuf-functions.php:694
1471
+ msgid "Title"
1472
+ msgstr "标签"
1473
+
1474
+ #: ../admin/template.php:539
1475
+ msgid "HTML Codes"
1476
+ msgstr "HTML 代码"
1477
+
1478
+ #: ../admin/template.php:572
1479
+ msgid "Meta Value"
1480
+ msgstr "Meta 值"
1481
+
1482
+ #: ../admin/template.php:625
1483
+ msgid "Number of images can be uploaded"
1484
+ msgstr "可以上传的图片数量"
1485
+
1486
+ #: ../admin/template.php:641
1487
+ msgid "Max. files"
1488
+ msgstr "最大文件"
1489
+
1490
+ #: ../admin/tools.php:32
1491
+ msgid "Form Export"
1492
+ msgstr "表单导出"
1493
+
1494
+ #: ../admin/tools.php:38 ../admin/tools.php:94
1495
+ msgid "All"
1496
+ msgstr "所有"
1497
+
1498
+ #: ../admin/tools.php:43 ../admin/tools.php:99
1499
+ msgid "Select individual"
1500
+ msgstr "选择一个"
1501
+
1502
+ #: ../admin/tools.php:53 ../admin/tools.php:112 ../admin/tools.php:397
1503
+ msgid "Export"
1504
+ msgstr "导出"
1505
+
1506
+ #: ../admin/tools.php:61 ../admin/tools.php:119
1507
+ msgid "Sorry you have no form to export"
1508
+ msgstr "对不起,没有表单可以导出"
1509
+
1510
+ #: ../admin/tools.php:86
1511
+ msgid "Registration Form Export"
1512
+ msgstr "注册表单导出"
1513
+
1514
+ #: ../admin/tools.php:132
1515
+ msgid "Somthing went wrong. Please choose a file again"
1516
+ msgstr "出现错误。请重新选择一个文件"
1517
+
1518
+ #: ../admin/tools.php:144
1519
+ msgid "Import successful. Have fun!"
1520
+ msgstr "导入成功。 玩的开心!"
1521
+
1522
+ #: ../admin/tools.php:147
1523
+ msgid "Invalid file or file size too big."
1524
+ msgstr "文件无效或太大"
1525
+
1526
+ #: ../admin/tools.php:153
1527
+ msgid "Import forms"
1528
+ msgstr "导入表单"
1529
+
1530
+ #: ../admin/tools.php:155
1531
+ msgid "Click Browse button and choose a json file that you backup before."
1532
+ msgstr "点击浏览按钮,然后选择一个您之前备份的JSON文件。"
1533
+
1534
+ #: ../admin/tools.php:156
1535
+ msgid "Press Restore button, WordPress does the rest for you."
1536
+ msgstr "点击还原按钮,WP将为您自动还原。"
1537
+
1538
+ #: ../admin/tools.php:161 ../admin/tools.php:396
1539
+ msgid "Import"
1540
+ msgstr "导入"
1541
+
1542
+ #: ../admin/tools.php:215 ../admin/tools.php:235
1543
+ msgid "Please select some form for exporting"
1544
+ msgstr "请选择需要导出的表单"
1545
+
1546
+ #: ../admin/tools.php:319
1547
+ msgid "All forms has been deleted"
1548
+ msgstr "所有表单已被删除"
1549
+
1550
+ #: ../admin/tools.php:323
1551
+ msgid "Settings has been cleared!"
1552
+ msgstr "设置已被清除!"
1553
+
1554
+ #: ../admin/tools.php:327
1555
+ msgid "All transactions has been deleted!"
1556
+ msgstr "所有交易已被删除!"
1557
+
1558
+ #: ../admin/tools.php:344
1559
+ msgid "Page Installation"
1560
+ msgstr "安装页面"
1561
+
1562
+ #: ../admin/tools.php:347
1563
+ msgid ""
1564
+ "Clicking this button will create required pages for the plugin. Note: It'll "
1565
+ "not delete/replace existing pages."
1566
+ msgstr "单击此按钮将创建所需的页面插件。注意:这将不会删除或替换现有的网页。"
1567
+
1568
+ #: ../admin/tools.php:353 ../admin/tools.php:357
1569
+ msgid "Reset Settings"
1570
+ msgstr "重置设置"
1571
+
1572
+ #: ../admin/tools.php:356
1573
+ msgid ""
1574
+ "<strong>Caution:</strong> This tool will delete all the plugin settings of "
1575
+ "WP User Frontend Pro"
1576
+ msgstr ""
1577
+ "<strong>注意:</strong>该工具会删除 WP User Frontend Pro 插件的所有设置"
1578
+
1579
+ #: ../admin/tools.php:362
1580
+ msgid "Delete Forms"
1581
+ msgstr "刪除表单"
1582
+
1583
+ #: ../admin/tools.php:365
1584
+ msgid ""
1585
+ "<strong>Caution:</strong> This tool will delete all the post and "
1586
+ "registration/profile forms."
1587
+ msgstr "<strong>注意:</strong>此工具将删除所有文章和注册/个人资料表单。"
1588
+
1589
+ #: ../admin/tools.php:367
1590
+ msgid "Delete Post Forms"
1591
+ msgstr "刪除文章表单"
1592
+
1593
+ #: ../admin/tools.php:368
1594
+ msgid "Delete Registration Forms"
1595
+ msgstr "删除注册表单"
1596
+
1597
+ #: ../admin/tools.php:369
1598
+ msgid "Delete Subscriptions"
1599
+ msgstr "删除套餐"
1600
+
1601
+ #: ../admin/tools.php:370
1602
+ msgid "Delete Coupons"
1603
+ msgstr "删除优惠券"
1604
+
1605
+ #: ../admin/tools.php:375
1606
+ msgid "Transactions"
1607
+ msgstr "交易"
1608
+
1609
+ #: ../admin/tools.php:378
1610
+ msgid "This tool will delete all the transactions from the transaction table."
1611
+ msgstr "此工具将删除表格中的所有交易"
1612
+
1613
+ #: ../admin/tools.php:380
1614
+ msgid "Delete Transactions"
1615
+ msgstr "删除交易"
1616
+
1617
+ #: ../admin/transaction.php:77
1618
+ msgid "WP User Frontend: Payments Received"
1619
+ msgstr "前端用户中心: 付款"
1620
+
1621
+ #: ../admin/transaction.php:81
1622
+ msgid "Total Income:"
1623
+ msgstr "总收入:"
1624
+
1625
+ #: ../admin/transaction.php:84
1626
+ msgid "This Month:"
1627
+ msgstr "本月:"
1628
+
1629
+ #: ../admin/transaction.php:90
1630
+ msgid "Transaction(s) deleted"
1631
+ msgstr "交易删除"
1632
+
1633
+ #: ../admin/transaction.php:101
1634
+ msgid "User ID"
1635
+ msgstr "用户 ID"
1636
+
1637
+ #: ../admin/transaction.php:102 ../templates/dashboard.php:27
1638
+ msgid "Status"
1639
+ msgstr "状态"
1640
+
1641
+ #: ../admin/transaction.php:104
1642
+ msgid "Post"
1643
+ msgstr "文章"
1644
+
1645
+ #: ../admin/transaction.php:105
1646
+ msgid "Pack ID"
1647
+ msgstr "套餐 ID"
1648
+
1649
+ #: ../admin/transaction.php:106
1650
+ msgid "Payer"
1651
+ msgstr "付款人"
1652
+
1653
+ #: ../admin/transaction.php:109
1654
+ msgid "Transaction ID"
1655
+ msgstr "交易ID"
1656
+
1657
+ #: ../admin/transaction.php:110
1658
+ msgid "Created"
1659
+ msgstr "已创建"
1660
+
1661
+ #: ../admin/transaction.php:151 ../admin/transaction.php:213
1662
+ msgid "Nothing Found"
1663
+ msgstr "没有找到"
1664
+
1665
+ #: ../admin/transaction.php:162
1666
+ msgid "Pending Orders"
1667
+ msgstr "等待中的订单"
1668
+
1669
+ #: ../admin/transaction.php:178
1670
+ msgid "ID"
1671
+ msgstr "ID"
1672
+
1673
+ #: ../admin/transaction.php:179
1674
+ msgid "User"
1675
+ msgstr "用户"
1676
+
1677
+ #: ../admin/transaction.php:182
1678
+ msgid "Item Details"
1679
+ msgstr "项目详情"
1680
+
1681
+ #: ../admin/transaction.php:183 ../includes/free/form.php:12
1682
+ msgid "Date"
1683
+ msgstr "日期"
1684
+
1685
+ #: ../admin/transaction.php:202
1686
+ msgid "Accept"
1687
+ msgstr "接受"
1688
+
1689
+ #: ../admin/transaction.php:203
1690
+ msgid "Reject"
1691
+ msgstr "拒绝"
1692
+
1693
+ #: ../admin/transaction.php:220
1694
+ msgid "No pending orders found"
1695
+ msgstr "没有找到等待订单"
1696
+
1697
+ #: ../class/frontend-dashboard.php:35 ../includes/free/edit-profile.php:27
1698
+ #: ../includes/free/edit-user.php:37
1699
+ #, php-format
1700
+ msgid "This page is restricted. Please %s to view this page."
1701
+ msgstr "此页面访问受限制。 请到%s 查看此页面。"
1702
+
1703
+ #: ../class/frontend-dashboard.php:67
1704
+ msgid "Post Deleted"
1705
+ msgstr "文章已删除"
1706
+
1707
+ #: ../class/frontend-dashboard.php:105
1708
+ msgid "Author Info"
1709
+ msgstr "作者信息"
1710
+
1711
+ #: ../class/frontend-dashboard.php:141
1712
+ msgid "You are not the post author. Cheeting huh!"
1713
+ msgstr "你不是文章作者,Cheeting huh!"
1714
+
1715
+ #: ../class/frontend-form-post.php:74
1716
+ msgid "You are not logged in"
1717
+ msgstr "你没有登录"
1718
+
1719
+ #: ../class/frontend-form-post.php:83
1720
+ msgid "Post Editing is disabled"
1721
+ msgstr "禁止文章编辑"
1722
+
1723
+ #: ../class/frontend-form-post.php:89
1724
+ msgid "Invalid post"
1725
+ msgstr "无效文章"
1726
+
1727
+ #: ../class/frontend-form-post.php:94
1728
+ msgid "You are not allowed to edit"
1729
+ msgstr "你没有权限编辑"
1730
+
1731
+ #: ../class/frontend-form-post.php:106
1732
+ msgid "I don't know how to edit this post, I don't have the form ID"
1733
+ msgstr "我不知道如何编辑这个文章,我没有这个表单ID"
1734
+
1735
+ #: ../class/frontend-form-post.php:112
1736
+ msgid "You can't edit a post while in pending mode."
1737
+ msgstr "你不能编辑等待模式的文章"
1738
+
1739
+ #: ../class/frontend-form-post.php:180
1740
+ msgid "Invalid email address."
1741
+ msgstr "电子邮件地址无效"
1742
+
1743
+ #: ../class/frontend-form-post.php:189
1744
+ msgid ""
1745
+ "You already have an account in our site. Please login to continue.\n"
1746
+ "\n"
1747
+ "Clicking 'OK' will redirect you to the login page and you will lost the form "
1748
+ "data.\n"
1749
+ "Click 'Cancel' to stay at this page."
1750
+ msgstr ""
1751
+ "你已注册,请登录以继续。点击“确定”跳转到登录页面后,你将会丢失此表单数据。点"
1752
+ "击“取消”留在这个页面。"
1753
+
1754
+ #: ../class/frontend-form-post.php:553
1755
+ msgid "Something went wrong"
1756
+ msgstr "未知错误"
1757
+
1758
+ #: ../class/payment.php:22 ../class/payment.php:23
1759
+ msgid "PayPal"
1760
+ msgstr "PayPal"
1761
+
1762
+ #: ../class/payment.php:27 ../class/payment.php:28
1763
+ msgid "Bank Payment"
1764
+ msgstr "银行卡支付"
1765
+
1766
+ #: ../class/payment.php:69
1767
+ msgid "Please select your payment page from admin panel"
1768
+ msgstr "请从管理面板选择付款页面"
1769
+
1770
+ #: ../class/payment.php:117
1771
+ msgid "Your free package has been activated. Enjoy!"
1772
+ msgstr "你的免费套餐已经激活。"
1773
+
1774
+ #: ../class/payment.php:119
1775
+ msgid "You already have activated a free package previously."
1776
+ msgstr "你之前已经激活一个免费套餐。"
1777
+
1778
+ #: ../class/payment.php:143
1779
+ msgid "Pricing & Plans"
1780
+ msgstr "定价与计划"
1781
+
1782
+ #: ../class/payment.php:145
1783
+ msgid "Change Pack"
1784
+ msgstr "更改套餐"
1785
+
1786
+ #: ../class/payment.php:156
1787
+ msgid "Selected Pack "
1788
+ msgstr "已选套餐"
1789
+
1790
+ #: ../class/payment.php:157
1791
+ msgid "Pack Price "
1792
+ msgstr "套餐价格"
1793
+
1794
+ #: ../class/payment.php:169
1795
+ msgid "Apply Coupon"
1796
+ msgstr "使用优惠券"
1797
+
1798
+ #: ../class/payment.php:170 ../class/subscription.php:785
1799
+ msgid "Cancel"
1800
+ msgstr "取消"
1801
+
1802
+ #: ../class/payment.php:173
1803
+ msgid "Have a discount code?"
1804
+ msgstr "有优惠码?"
1805
+
1806
+ #: ../class/payment.php:184
1807
+ msgid "Choose Your Payment Method"
1808
+ msgstr "选择你的支付方式"
1809
+
1810
+ #: ../class/payment.php:221
1811
+ msgid "Proceed"
1812
+ msgstr "继续进行"
1813
+
1814
+ #: ../class/payment.php:225
1815
+ msgid "No Payment gateway found"
1816
+ msgstr "没找到支付方式"
1817
+
1818
+ #: ../class/payment.php:407 ../lib/gateway/bank.php:99
1819
+ #, php-format
1820
+ msgid "[%s] Payment Received"
1821
+ msgstr "[%s] 已收到付款"
1822
+
1823
+ #: ../class/payment.php:408
1824
+ #, php-format
1825
+ msgid "New payment received at %s"
1826
+ msgstr "新的付款收到在%s"
1827
+
1828
+ #: ../class/render-form.php:76
1829
+ msgid "Really Simple Captcha validation failed"
1830
+ msgstr "真正简单验证码验证失败"
1831
+
1832
+ #: ../class/render-form.php:103 ../class/render-form.php:114
1833
+ msgid "reCAPTCHA validation failed"
1834
+ msgstr "验证码验证失败"
1835
+
1836
+ #: ../class/render-form.php:810
1837
+ msgid "Word Limit Reached !"
1838
+ msgstr "字数已达上限!"
1839
+
1840
+ #: ../class/render-form.php:907
1841
+ msgid "Insert Photo"
1842
+ msgstr "插入照片"
1843
+
1844
+ #: ../class/render-form.php:1157 ../class/render-form.php:1162
1845
+ #: ../includes/free/edit-profile.php:198
1846
+ msgid "Strength indicator"
1847
+ msgstr "强度指标"
1848
+
1849
+ #: ../class/render-form.php:1163
1850
+ msgid "Very weak"
1851
+ msgstr "非常弱"
1852
+
1853
+ #: ../class/render-form.php:1164
1854
+ msgid "Weak"
1855
+ msgstr "弱"
1856
+
1857
+ #: ../class/render-form.php:1165
1858
+ msgid "Medium"
1859
+ msgstr "中等"
1860
+
1861
+ #: ../class/render-form.php:1166
1862
+ msgid "Strong"
1863
+ msgstr "强"
1864
+
1865
+ #: ../class/render-form.php:1167
1866
+ msgid "Mismatch"
1867
+ msgstr "不匹配"
1868
+
1869
+ #: ../class/render-form.php:1189 ../class/render-form.php:1297
1870
+ msgid "-- Select --"
1871
+ msgstr "-- 选择 --"
1872
+
1873
+ #: ../class/render-form.php:1420
1874
+ msgid "Select Image"
1875
+ msgstr "选择图像"
1876
+
1877
+ #: ../class/subscription.php:58
1878
+ msgid "Nonce failure"
1879
+ msgstr "随机数验证失败"
1880
+
1881
+ #: ../class/subscription.php:358
1882
+ msgid "Add Subscription"
1883
+ msgstr "添加订阅"
1884
+
1885
+ #: ../class/subscription.php:359
1886
+ msgid "Add New Subscription"
1887
+ msgstr "添加新订阅"
1888
+
1889
+ #: ../class/subscription.php:361
1890
+ msgid "Edit Subscription"
1891
+ msgstr "编辑订阅"
1892
+
1893
+ #: ../class/subscription.php:362
1894
+ msgid "New Subscription"
1895
+ msgstr "新订阅"
1896
+
1897
+ #: ../class/subscription.php:363 ../class/subscription.php:364
1898
+ msgid "View Subscription"
1899
+ msgstr "查看订阅"
1900
+
1901
+ #: ../class/subscription.php:365
1902
+ msgid "Search Subscription"
1903
+ msgstr "搜索订阅"
1904
+
1905
+ #: ../class/subscription.php:366
1906
+ msgid "No Subscription Found"
1907
+ msgstr "未发现订阅"
1908
+
1909
+ #: ../class/subscription.php:367
1910
+ msgid "No Subscription Found in Trash"
1911
+ msgstr "回收站里没有订阅"
1912
+
1913
+ #: ../class/subscription.php:368
1914
+ msgid "Parent Subscription"
1915
+ msgstr "父级订阅"
1916
+
1917
+ #: ../class/subscription.php:397
1918
+ msgid "Billing Details"
1919
+ msgstr "账单详情"
1920
+
1921
+ #: ../class/subscription.php:686
1922
+ msgid "Package & billing details: "
1923
+ msgstr "套餐及帐单明细:"
1924
+
1925
+ #: ../class/subscription.php:743
1926
+ msgid "Change"
1927
+ msgstr "更改"
1928
+
1929
+ #: ../class/subscription.php:762
1930
+ msgid "Please enable force pack and charge posting from admin panel"
1931
+ msgstr "请启用强制套餐,然后修改后台价格"
1932
+
1933
+ #: ../class/subscription.php:772
1934
+ msgid "Payment is complete"
1935
+ msgstr "支付完成"
1936
+
1937
+ #: ../class/subscription.php:772
1938
+ msgid "Congratulations, your payment has been completed!"
1939
+ msgstr "恭喜,支付成功!"
1940
+
1941
+ #: ../class/subscription.php:779
1942
+ msgid "<p><i>You have a subscription pack activated. </i></p>"
1943
+ msgstr "<p> <i>你有一个已激活的套餐。</i> </p>"
1944
+
1945
+ #: ../class/subscription.php:780
1946
+ msgid "<p><i>Pack name : "
1947
+ msgstr "<p><i>套餐名称:"
1948
+
1949
+ #: ../class/subscription.php:781
1950
+ msgid "<p><i>To cancel the pack, press the following cancel button</i></p>"
1951
+ msgstr "<p> <i>要取消套餐,按点击取消按钮</i> </p>"
1952
+
1953
+ #: ../class/subscription.php:825
1954
+ msgid "One time payment"
1955
+ msgstr "一次性支付"
1956
+
1957
+ #: ../class/subscription.php:838
1958
+ msgid "Sign Up"
1959
+ msgstr "注册"
1960
+
1961
+ #: ../class/subscription.php:843
1962
+ msgid "Buy Now"
1963
+ msgstr "立即购买"
1964
+
1965
+ #: ../class/subscription.php:899
1966
+ #, php-format
1967
+ msgid "This will cost you <strong>%s</strong> to add a new post. "
1968
+ msgstr "将花费你 <strong>%s</strong> 以创建新的文章。"
1969
+
1970
+ #: ../class/subscription.php:918
1971
+ #, php-format
1972
+ msgid "You must <a href=\"%s\">purchase a pack</a> before posting"
1973
+ msgstr "你必须<a href=“%s”>购买一个套餐</a>用于发表文章"
1974
+
1975
+ #: ../class/upload.php:165 ../wpuf-functions.php:697
1976
+ msgid "Caption"
1977
+ msgstr "说明"
1978
+
1979
+ #: ../includes/free/edit-profile.php:66
1980
+ msgid "<strong>Success</strong>: Profile updated"
1981
+ msgstr "<strong>成功</strong>: 个人资料已更新"
1982
+
1983
+ #: ../includes/free/edit-profile.php:97
1984
+ msgid "Usernames cannot be changed."
1985
+ msgstr "用户名不能改变"
1986
+
1987
+ #: ../includes/free/edit-profile.php:110 ../includes/free/edit-profile.php:151
1988
+ msgid "(required)"
1989
+ msgstr "(必填)"
1990
+
1991
+ #: ../includes/free/edit-profile.php:115
1992
+ msgid "Display to Public as"
1993
+ msgstr "公开显示为"
1994
+
1995
+ #: ../includes/free/edit-profile.php:147
1996
+ msgid "Contact Info"
1997
+ msgstr "联系信息"
1998
+
1999
+ #: ../includes/free/edit-profile.php:174
2000
+ msgid "About Yourself"
2001
+ msgstr "关于你自己"
2002
+
2003
+ #: ../includes/free/edit-profile.php:180
2004
+ msgid ""
2005
+ "Share a little biographical information to fill out your profile. This may "
2006
+ "be shown publicly."
2007
+ msgstr "分享一个个人资料信息。这可能是公开的。"
2008
+
2009
+ #: ../includes/free/edit-profile.php:183
2010
+ msgid "New Password"
2011
+ msgstr "新密码"
2012
+
2013
+ #: ../includes/free/edit-profile.php:189
2014
+ msgid "Confirm Password"
2015
+ msgstr "确认密码"
2016
+
2017
+ #: ../includes/free/edit-profile.php:191
2018
+ msgid "Type your new password again."
2019
+ msgstr "再次输入你的新密码"
2020
+
2021
+ #: ../includes/free/edit-profile.php:196
2022
+ msgid "Password Strength"
2023
+ msgstr "密码强度"
2024
+
2025
+ #: ../includes/free/edit-profile.php:222 ../includes/free/form.php:344
2026
+ msgid "Update Profile"
2027
+ msgstr "更新个人资料"
2028
+
2029
+ #: ../includes/free/edit-profile.php:241
2030
+ msgid "WPUF Post Lock"
2031
+ msgstr "WPUF 文章加密"
2032
+
2033
+ #: ../includes/free/edit-profile.php:244
2034
+ msgid "Lock Post:"
2035
+ msgstr "加密文章:"
2036
+
2037
+ #: ../includes/free/edit-profile.php:250
2038
+ msgid "Lock user from creating new post."
2039
+ msgstr "加密从用户表单创建的新文章"
2040
+
2041
+ #: ../includes/free/edit-profile.php:255
2042
+ msgid "Lock Reason:"
2043
+ msgstr "加密原因:"
2044
+
2045
+ #: ../includes/free/edit-profile.php:285
2046
+ msgid "Post Count:"
2047
+ msgstr "文章数:"
2048
+
2049
+ #: ../includes/free/edit-profile.php:291
2050
+ msgid "Validity:"
2051
+ msgstr "有效性:"
2052
+
2053
+ #: ../includes/free/edit-user.php:23
2054
+ msgid "User doesn't exists"
2055
+ msgstr "用户不存在"
2056
+
2057
+ #: ../includes/free/edit-user.php:34
2058
+ msgid "You don't have permission for this purpose"
2059
+ msgstr "你没有权限使用此功能"
2060
+
2061
+ #: ../includes/free/edit-user.php:77
2062
+ msgid "User Deleted"
2063
+ msgstr "用户已删除"
2064
+
2065
+ #: ../includes/free/edit-user.php:119 ../includes/free/edit-user.php:177
2066
+ msgid "Add New User"
2067
+ msgstr "添加新用户"
2068
+
2069
+ #: ../includes/free/edit-user.php:132
2070
+ msgid "User Added"
2071
+ msgstr "用户已添加"
2072
+
2073
+ #: ../includes/free/edit-user.php:160
2074
+ msgid "Role"
2075
+ msgstr "角色"
2076
+
2077
+ #: ../includes/free/edit-user.php:204
2078
+ msgid "<strong>ERROR</strong>: Please enter a username."
2079
+ msgstr "<strong>错误</strong>: 请输入一个用户名。"
2080
+
2081
+ #: ../includes/free/edit-user.php:206
2082
+ msgid ""
2083
+ "<strong>ERROR</strong>: This username is invalid because it uses illegal "
2084
+ "characters. Please enter a valid username."
2085
+ msgstr ""
2086
+ "<strong>错误</strong>: 这个用户名使用非法字符无效。请输入一个有效的用户名。"
2087
+
2088
+ #: ../includes/free/edit-user.php:209
2089
+ msgid ""
2090
+ "<strong>ERROR</strong>: This username is already registered, please choose "
2091
+ "another one."
2092
+ msgstr "<strong>错误</strong>: 这个用户名已被注册,请选择另一个"
2093
+
2094
+ #: ../includes/free/edit-user.php:214
2095
+ msgid "<strong>ERROR</strong>: Please type your e-mail address."
2096
+ msgstr "<strong>错误</strong>: 请输入你的e-mail 地址"
2097
+
2098
+ #: ../includes/free/edit-user.php:216
2099
+ msgid "<strong>ERROR</strong>: The email address isn&#8217;t correct."
2100
+ msgstr "<strong>错误</strong>: email 地址不正确"
2101
+
2102
+ #: ../includes/free/edit-user.php:219
2103
+ msgid ""
2104
+ "<strong>ERROR</strong>: This email is already registered, please choose "
2105
+ "another one."
2106
+ msgstr "<strong>错误</strong>: email 已被注册,请选择其他的"
2107
+
2108
+ #: ../includes/free/edit-user.php:242
2109
+ #, php-format
2110
+ msgid ""
2111
+ "<strong>ERROR</strong>: Couldn&#8217;t register you... please contact the <a "
2112
+ "href=\"mailto:%s\">webmaster</a> !"
2113
+ msgstr ""
2114
+ "<strong>错误</strong>: 不能注册,请联系<a href=\"mailto:%s\">站长</a> !"
2115
+
2116
+ #: ../includes/free/form.php:8
2117
+ msgid "Image Upload"
2118
+ msgstr "图片上传"
2119
+
2120
+ #: ../includes/free/form.php:11
2121
+ msgid "Repeat Field"
2122
+ msgstr "重复字段"
2123
+
2124
+ #: ../includes/free/form.php:13
2125
+ msgid "File Upload"
2126
+ msgstr "文件上传"
2127
+
2128
+ #: ../includes/free/form.php:14
2129
+ msgid "Google Maps"
2130
+ msgstr "谷歌地图"
2131
+
2132
+ #: ../includes/free/form.php:15
2133
+ msgid "Country List"
2134
+ msgstr "国家列表"
2135
+
2136
+ #: ../includes/free/form.php:16
2137
+ msgid "Numeric Field"
2138
+ msgstr "数字字段"
2139
+
2140
+ #: ../includes/free/form.php:17
2141
+ msgid "Address Field"
2142
+ msgstr "地址字段"
2143
+
2144
+ #: ../includes/free/form.php:18
2145
+ msgid "Step Start"
2146
+ msgstr "开始步骤"
2147
+
2148
+ #: ../includes/free/form.php:30
2149
+ msgid "reCaptcha"
2150
+ msgstr "验证码"
2151
+
2152
+ #: ../includes/free/form.php:31
2153
+ msgid "Really Simple Captcha"
2154
+ msgstr "真正简单的验证码"
2155
+
2156
+ #: ../includes/free/form.php:32
2157
+ msgid "Action Hook"
2158
+ msgstr "动作 Hook"
2159
+
2160
+ #: ../includes/free/form.php:33
2161
+ msgid "Term &amp; Conditions"
2162
+ msgstr "协议条款"
2163
+
2164
+ #: ../includes/free/form.php:121
2165
+ msgid "Send Email to Author After Exceeding Post Expiration Time"
2166
+ msgstr "文章过期时发送电子邮件给作者"
2167
+
2168
+ #: ../includes/free/form.php:146 ../includes/free/form.php:150
2169
+ msgid "Enable Multistep"
2170
+ msgstr "启用多步"
2171
+
2172
+ #: ../includes/free/form.php:153
2173
+ msgid "If checked, form will be displayed in frontend in multiple steps"
2174
+ msgstr "如果选中,表格将在前端显示多个步骤。"
2175
+
2176
+ #: ../includes/free/form.php:157
2177
+ msgid "Multistep Progressbar Type"
2178
+ msgstr "多步表单进度条类型"
2179
+
2180
+ #: ../includes/free/form.php:167
2181
+ msgid "Choose how you want the progressbar"
2182
+ msgstr "选择您需要的进度条"
2183
+
2184
+ #: ../includes/free/form.php:197
2185
+ msgid "New post created"
2186
+ msgstr "新文章已创建"
2187
+
2188
+ #: ../includes/free/form.php:202
2189
+ msgid "A post has been edited"
2190
+ msgstr "一个文章已被编辑"
2191
+
2192
+ #: ../includes/free/form.php:208
2193
+ msgid "New Post Notificatoin"
2194
+ msgstr "新文章通知"
2195
+
2196
+ #: ../includes/free/form.php:216 ../includes/free/form.php:253
2197
+ msgid "Enable post notification"
2198
+ msgstr "启用文章通知"
2199
+
2200
+ #: ../includes/free/form.php:222 ../includes/free/form.php:259
2201
+ msgid "To"
2202
+ msgstr "发送到"
2203
+
2204
+ #: ../includes/free/form.php:230 ../includes/free/form.php:264
2205
+ msgid "Subject"
2206
+ msgstr "邮件标题"
2207
+
2208
+ #: ../includes/free/form.php:236 ../includes/free/form.php:269
2209
+ msgid "Message"
2210
+ msgstr "邮件内容"
2211
+
2212
+ #: ../includes/free/form.php:244
2213
+ msgid "Update Post Notificatoin"
2214
+ msgstr "更新文章通知"
2215
+
2216
+ #: ../includes/free/form.php:276
2217
+ msgid "You may use in message:"
2218
+ msgstr "你可以使用信息:"
2219
+
2220
+ #: ../includes/free/form.php:339
2221
+ msgid "Registration successful"
2222
+ msgstr "注册成功"
2223
+
2224
+ #: ../includes/free/form.php:340
2225
+ msgid "Profile updated successfully"
2226
+ msgstr "个人信息更新成功"
2227
+
2228
+ #: ../includes/free/form.php:343
2229
+ msgid "Register"
2230
+ msgstr "注册"
2231
+
2232
+ #: ../includes/free/form.php:352
2233
+ msgid "Enable Email Verfication"
2234
+ msgstr "启用邮件验证"
2235
+
2236
+ #: ../includes/free/form.php:360
2237
+ msgid "New User Role"
2238
+ msgstr "新用户角色"
2239
+
2240
+ #: ../includes/free/form.php:396
2241
+ msgid "Registration success message"
2242
+ msgstr "注册成功信息"
2243
+
2244
+ #: ../includes/free/form.php:403
2245
+ msgid "Update profile message"
2246
+ msgstr "更新简介信息"
2247
+
2248
+ #: ../includes/free/form.php:432
2249
+ msgid "Submit Button text"
2250
+ msgstr "提交按钮文字"
2251
+
2252
+ #: ../includes/free/form.php:439
2253
+ msgid "Update Button text"
2254
+ msgstr "更新按钮文字"
2255
+
2256
+ #: ../includes/free/form.php:472
2257
+ msgid "Conditional Logic"
2258
+ msgstr "条件逻辑"
2259
+
2260
+ #: ../includes/free/loader.php:63 ../includes/free/loader.php:92
2261
+ msgid "Coupons"
2262
+ msgstr "优惠券"
2263
+
2264
+ #: ../includes/free/loader.php:68
2265
+ msgid "Registration Form"
2266
+ msgstr "注册表单"
2267
+
2268
+ #: ../includes/free/loader.php:72
2269
+ msgid ""
2270
+ "Registration form builder is a two way form which can be used both for "
2271
+ "<strong>user registration</strong> and <strong>profile editing</strong>."
2272
+ msgstr ""
2273
+ "注册表单生成器有两种功能,既可以用于<strong>用户注册</strong>,也可以用于"
2274
+ "<strong>编辑用户资料</strong>。"
2275
+
2276
+ #: ../includes/free/loader.php:76
2277
+ msgid "Users can also register themselves by using a subscription pack."
2278
+ msgstr "用户还可以通过选择一个订阅包套餐来注册。"
2279
+
2280
+ #: ../includes/free/loader.php:80 ../includes/free/loader.php:100
2281
+ msgid "This feature is only available in the Pro Version."
2282
+ msgstr "此功能仅在专业版中可用。"
2283
+
2284
+ #: ../includes/free/loader.php:84 ../includes/free/loader.php:104
2285
+ msgid "Upgrade to Pro Version"
2286
+ msgstr "升级到专业版"
2287
+
2288
+ #: ../includes/free/loader.php:96
2289
+ msgid "Use Coupon codes for subscription for discounts."
2290
+ msgstr "使用优惠券券购买享受折扣。"
2291
+
2292
+ #: ../includes/free/loader.php:131
2293
+ msgid "Pro Feature"
2294
+ msgstr "专业版特性"
2295
+
2296
+ #: ../includes/free/loader.php:149
2297
+ msgid "Upgrade to Pro"
2298
+ msgstr "升级到专业版"
2299
+
2300
+ #: ../includes/free/subscription.php:12
2301
+ msgid "Enable Recurring Payment"
2302
+ msgstr "启用定期付款"
2303
+
2304
+ #: ../lib/gateway/bank.php:29
2305
+ msgid "Bank Instruction"
2306
+ msgstr "银行指令"
2307
+
2308
+ #: ../lib/gateway/bank.php:36
2309
+ msgid "Bank Payment Success Page"
2310
+ msgstr "银行卡付款成功页面"
2311
+
2312
+ #: ../lib/gateway/bank.php:77
2313
+ #, php-format
2314
+ msgid "[%s] New Bank Order Received"
2315
+ msgstr "[%s] 新银行卡已收到付款"
2316
+
2317
+ #: ../lib/gateway/bank.php:78
2318
+ #, php-format
2319
+ msgid "New bank order received at %s, please check it out: %s"
2320
+ msgstr "新银行已收到订单%s,请单击 %s"
2321
+
2322
+ #: ../lib/gateway/bank.php:100
2323
+ #, php-format
2324
+ msgid "Hello %s,"
2325
+ msgstr "Hello %s,"
2326
+
2327
+ #: ../lib/gateway/bank.php:101
2328
+ msgid "We have received your bank payment."
2329
+ msgstr "我们已经收到您的银行付款。"
2330
+
2331
+ #: ../lib/gateway/bank.php:102
2332
+ msgid "Thanks for being with us."
2333
+ msgstr "谢谢你加入我们队伍"
2334
+
2335
+ #: ../lib/gateway/paypal.php:58
2336
+ #, php-format
2337
+ msgid "Subscription %s at %s"
2338
+ msgstr "订阅 %s 于 %s"
2339
+
2340
+ #: ../lib/gateway/paypal.php:89
2341
+ msgid "PayPal Email"
2342
+ msgstr "PayPal 电子邮件"
2343
+
2344
+ #: ../lib/gateway/paypal.php:94
2345
+ msgid "PayPal Instruction"
2346
+ msgstr "PayPal 指令"
2347
+
2348
+ #: ../lib/gateway/paypal.php:101
2349
+ msgid "PayPal API username"
2350
+ msgstr "PayPal API 用户名"
2351
+
2352
+ #: ../lib/gateway/paypal.php:105
2353
+ msgid "PayPal API password"
2354
+ msgstr "PayPal API 密码"
2355
+
2356
+ #: ../lib/gateway/paypal.php:109
2357
+ msgid "PayPal API signature"
2358
+ msgstr "PayPal API 签名"
2359
+
2360
+ #: ../templates/dashboard.php:2
2361
+ #, php-format
2362
+ msgid "%s's Dashboard"
2363
+ msgstr "%s's 的仪表盘"
2364
+
2365
+ #: ../templates/dashboard.php:6
2366
+ #, php-format
2367
+ msgid "You have created <span>%d</span> %s"
2368
+ msgstr "你已创建<span>%d</span> %s"
2369
+
2370
+ #: ../templates/dashboard.php:56
2371
+ msgid "No Image"
2372
+ msgstr "没有图片"
2373
+
2374
+ #: ../templates/dashboard.php:86
2375
+ msgid "Pay Now"
2376
+ msgstr "立即支付"
2377
+
2378
+ #: ../templates/dashboard.php:130
2379
+ msgid "&laquo;"
2380
+ msgstr "&laquo;"
2381
+
2382
+ #: ../templates/dashboard.php:131
2383
+ msgid "&raquo;"
2384
+ msgstr "&raquo;"
2385
+
2386
+ #: ../templates/dashboard.php:145
2387
+ #, php-format
2388
+ msgid "No %s found"
2389
+ msgstr "没%s找到"
2390
+
2391
+ #: ../templates/logged-in.php:8
2392
+ #, php-format
2393
+ msgid "Hello %s"
2394
+ msgstr "你好 %s"
2395
+
2396
+ #: ../templates/logged-in.php:11
2397
+ #, php-format
2398
+ msgid "You are currently logged in! %s?"
2399
+ msgstr "您已登录! %s?"
2400
+
2401
+ #: ../templates/lost-pass-form.php:14
2402
+ msgid "Username or E-mail:"
2403
+ msgstr "用户名或电子邮箱:"
2404
+
2405
+ #: ../templates/reset-pass-form.php:14
2406
+ msgid "New password"
2407
+ msgstr "新密码"
2408
+
2409
+ #: ../templates/reset-pass-form.php:19
2410
+ msgid "Confirm new password"
2411
+ msgstr "确认新密码"
2412
+
2413
+ #: ../wpuf-functions.php:26
2414
+ msgid "Live"
2415
+ msgstr "在线"
2416
+
2417
+ #: ../wpuf-functions.php:30
2418
+ msgid "Offline"
2419
+ msgstr "离线"
2420
+
2421
+ #: ../wpuf-functions.php:34
2422
+ msgid "Awaiting Approval"
2423
+ msgstr "正在等待批准"
2424
+
2425
+ #: ../wpuf-functions.php:37 ../wpuf-functions.php:71
2426
+ msgid "Scheduled"
2427
+ msgstr "预定"
2428
+
2429
+ #: ../wpuf-functions.php:41
2430
+ msgid "Private"
2431
+ msgstr "私人"
2432
+
2433
+ #: ../wpuf-functions.php:60
2434
+ msgid "Published"
2435
+ msgstr "已发布"
2436
+
2437
+ #: ../wpuf-functions.php:64
2438
+ msgid "Draft"
2439
+ msgstr "草稿"
2440
+
2441
+ #: ../wpuf-functions.php:68
2442
+ msgid "Pending"
2443
+ msgstr "等待中"
2444
+
2445
+ #: ../wpuf-functions.php:204
2446
+ msgid "-- select --"
2447
+ msgstr "— 选择—"
2448
+
2449
+ #: ../wpuf-functions.php:395
2450
+ msgid "Images"
2451
+ msgstr "图像"
2452
+
2453
+ #: ../wpuf-functions.php:396
2454
+ msgid "Audio"
2455
+ msgstr "音频"
2456
+
2457
+ #: ../wpuf-functions.php:397
2458
+ msgid "Videos"
2459
+ msgstr "视频"
2460
+
2461
+ #: ../wpuf-functions.php:398
2462
+ msgid "PDF"
2463
+ msgstr "PDF"
2464
+
2465
+ #: ../wpuf-functions.php:399
2466
+ msgid "Office Documents"
2467
+ msgstr "办公文档"
2468
+
2469
+ #: ../wpuf-functions.php:400
2470
+ msgid "Zip Archives"
2471
+ msgstr "Zip 压缩包"
2472
+
2473
+ #: ../wpuf-functions.php:401
2474
+ msgid "Executable Files"
2475
+ msgstr "可执行文件"
2476
+
2477
+ #: ../wpuf-functions.php:402
2478
+ msgid "CSV"
2479
+ msgstr "CSV"
2480
+
2481
+ #: ../wpuf.php:109
2482
+ msgid "Your Post Has Been Expired"
2483
+ msgstr "您的文章已过期"
2484
+
2485
+ #: ../wpuf.php:273
2486
+ msgid "is required"
2487
+ msgstr "为必填项"
2488
+
2489
+ #: ../wpuf.php:274
2490
+ msgid "does not match"
2491
+ msgstr "不匹配"
2492
+
2493
+ #: ../wpuf.php:275
2494
+ msgid "is not valid"
2495
+ msgstr "无效"
2496
+
2497
+ #: ../wpuf.php:333
2498
+ msgid "Please fix the errors to proceed"
2499
+ msgstr "请修正错误以继续进行"
2500
+
2501
+ #~ msgid "Fixed Price"
2502
+ #~ msgstr "固定价格"
2503
+
2504
+ #~ msgid "Percentage"
2505
+ #~ msgstr "百分比"
2506
+
2507
+ #~ msgid "Amount without <code>%</code> or currency symbol"
2508
+ #~ msgstr "请直接填写数值,不要输入<code>%</code> 或货币符号。"
2509
+
2510
+ #~ msgid "Give a description of this coupon"
2511
+ #~ msgstr "优惠券说明"
2512
+
2513
+ #~ msgid "Package"
2514
+ #~ msgstr "添加套餐"
2515
+
2516
+ #~ msgid "Select one or more packages to apply coupon"
2517
+ #~ msgstr "选择一