@@ -17,6 +17,6 @@ |
||
17 | 17 | </ul> |
18 | 18 | |
19 | 19 | <?php if ( $form && $title == 'show' ) { ?> |
20 | - <input id="title" type="text" value="<?php echo esc_attr( $form->name == '' ? __( '(no title)') : $form->name ) ?>" readonly="readonly" disabled="disabled" /> |
|
20 | + <input id="title" type="text" value="<?php echo esc_attr( $form->name == '' ? __( '(no title)' ) : $form->name ) ?>" readonly="readonly" disabled="disabled" /> |
|
21 | 21 | <?php } ?> |
22 | 22 | </div> |
@@ -42,51 +42,51 @@ discard block |
||
42 | 42 | |
43 | 43 | if ( $f->type == 'data' ) { |
44 | 44 | //get all fields from linked form |
45 | - if ( isset($f->field_options['form_select']) && is_numeric($f->field_options['form_select']) ) { |
|
46 | - $linked_form = FrmDb::get_var( $wpdb->prefix .'frm_fields', array( 'id' => $f->field_options['form_select'] ), 'form_id' ); |
|
47 | - if ( ! in_array( $linked_form, $linked_forms ) ) { |
|
48 | - $linked_forms[] = $linked_form; |
|
45 | + if ( isset($f->field_options['form_select']) && is_numeric($f->field_options['form_select']) ) { |
|
46 | + $linked_form = FrmDb::get_var( $wpdb->prefix .'frm_fields', array( 'id' => $f->field_options['form_select'] ), 'form_id' ); |
|
47 | + if ( ! in_array( $linked_form, $linked_forms ) ) { |
|
48 | + $linked_forms[] = $linked_form; |
|
49 | 49 | $linked_fields = FrmField::getAll( array( 'fi.type not' => FrmField::no_save_fields(), 'fi.form_id' => $linked_form ) ); |
50 | - $ldfe = ''; |
|
50 | + $ldfe = ''; |
|
51 | 51 | if ( $linked_fields ) { |
52 | 52 | foreach ( $linked_fields as $linked_field ) { |
53 | - FrmAppHelper::insert_opt_html( array( 'id' => $f->id . ' show=' . $linked_field->id, 'key' => $f->field_key . ' show=' . $linked_field->field_key, 'name' => $linked_field->name, 'type' => $linked_field->type ) ); |
|
54 | - |
|
55 | - $ldfe = $linked_field->id; |
|
56 | - unset($linked_field); |
|
57 | - } |
|
58 | - } |
|
59 | - } |
|
60 | - } |
|
61 | - $dfe = $f->id; |
|
62 | - } |
|
63 | - unset($f); |
|
64 | - } |
|
65 | - } ?> |
|
53 | + FrmAppHelper::insert_opt_html( array( 'id' => $f->id . ' show=' . $linked_field->id, 'key' => $f->field_key . ' show=' . $linked_field->field_key, 'name' => $linked_field->name, 'type' => $linked_field->type ) ); |
|
54 | + |
|
55 | + $ldfe = $linked_field->id; |
|
56 | + unset($linked_field); |
|
57 | + } |
|
58 | + } |
|
59 | + } |
|
60 | + } |
|
61 | + $dfe = $f->id; |
|
62 | + } |
|
63 | + unset($f); |
|
64 | + } |
|
65 | + } ?> |
|
66 | 66 | </ul> |
67 | 67 | |
68 | 68 | <?php _e( 'Helpers', 'formidable' ) ?>: |
69 | 69 | <ul class="frm_code_list"> |
70 | 70 | <?php |
71 | - $col = 'one'; |
|
71 | + $col = 'one'; |
|
72 | 72 | foreach ( $entry_shortcodes as $skey => $sname ) { |
73 | 73 | if ( empty( $skey ) ) { |
74 | - $col = 'one'; |
|
75 | - echo '<li class="clear frm_block"></li>'; |
|
76 | - continue; |
|
77 | - } |
|
78 | - ?> |
|
74 | + $col = 'one'; |
|
75 | + echo '<li class="clear frm_block"></li>'; |
|
76 | + continue; |
|
77 | + } |
|
78 | + ?> |
|
79 | 79 | <li class="frm_col_<?php echo esc_attr( $col ) ?>"> |
80 | 80 | <a href="javascript:void(0)" class="frmbutton button <?php |
81 | 81 | echo ( in_array( $skey, array( 'siteurl', 'sitename', 'entry_count' ) ) ) ? 'show_before_content show_after_content' : ''; |
82 | - echo ( strpos( $skey, 'default-' ) === 0 ) ? 'hide_frm_not_email_subject' : ''; |
|
83 | - ?> frm_insert_code" data-code="<?php echo esc_attr( $skey ) ?>"><?php echo esc_html( $sname ) ?></a> |
|
82 | + echo ( strpos( $skey, 'default-' ) === 0 ) ? 'hide_frm_not_email_subject' : ''; |
|
83 | + ?> frm_insert_code" data-code="<?php echo esc_attr( $skey ) ?>"><?php echo esc_html( $sname ) ?></a> |
|
84 | 84 | </li> |
85 | 85 | <?php |
86 | - $col = ( $col == 'one' ) ? 'two' : 'one'; |
|
87 | - unset($skey, $sname); |
|
88 | - } |
|
89 | - ?> |
|
86 | + $col = ( $col == 'one' ) ? 'two' : 'one'; |
|
87 | + unset($skey, $sname); |
|
88 | + } |
|
89 | + ?> |
|
90 | 90 | </ul> |
91 | 91 | </div> |
92 | 92 | |
@@ -99,11 +99,11 @@ discard block |
||
99 | 99 | <ul class="alignleft"><li><?php _e( 'Fields from your form', 'formidable' ) ?>:</li></ul> |
100 | 100 | <ul class="frm_code_list frm_full_width"> |
101 | 101 | <?php if ( ! empty( $fields ) ) { |
102 | - foreach ( $fields as $f ) { |
|
102 | + foreach ( $fields as $f ) { |
|
103 | 103 | if ( FrmField::is_no_save_field( $f->type ) || ( $f->type == 'data' && ( ! isset( $f->field_options['data_type'] ) || $f->field_options['data_type'] == 'data' || $f->field_options['data_type'] == '' ) ) ) { |
104 | - continue; |
|
105 | - } |
|
106 | - ?> |
|
104 | + continue; |
|
105 | + } |
|
106 | + ?> |
|
107 | 107 | <li> |
108 | 108 | <a href="javascript:void(0)" class="frmids alignright frm_insert_code" data-code="if <?php echo esc_attr( $f->id ) ?>]<?php esc_attr_e( 'Conditional text here', 'formidable' ) ?>[/if <?php echo esc_attr( $f->id ) ?>">[if <?php echo (int) $f->id ?>]</a> |
109 | 109 | <a href="javascript:void(0)" class="frmkeys alignright frm_insert_code" data-code="if <?php echo esc_attr( $f->field_key ) ?>]something[/if <?php echo esc_attr( $f->field_key ) ?>">[if <?php echo FrmAppHelper::truncate($f->field_key, 10) ?>]</a> |
@@ -111,30 +111,30 @@ discard block |
||
111 | 111 | </li> |
112 | 112 | <?php |
113 | 113 | |
114 | - if ( $f->type == 'user_id' ) { |
|
115 | - $uid = $f; |
|
116 | - } else if ( $f->type == 'file' ) { |
|
117 | - $file = $f; |
|
118 | - } |
|
119 | - unset($f); |
|
120 | - } |
|
121 | - } ?> |
|
114 | + if ( $f->type == 'user_id' ) { |
|
115 | + $uid = $f; |
|
116 | + } else if ( $f->type == 'file' ) { |
|
117 | + $file = $f; |
|
118 | + } |
|
119 | + unset($f); |
|
120 | + } |
|
121 | + } ?> |
|
122 | 122 | </ul> |
123 | 123 | |
124 | 124 | <p class="howto"><?php _e( 'Click a button below to insert sample logic into your view', 'formidable' ) ?></p> |
125 | 125 | <ul class="frm_code_list"> |
126 | 126 | <?php |
127 | - $col = 'one'; |
|
127 | + $col = 'one'; |
|
128 | 128 | foreach ( $cond_shortcodes as $skey => $sname ) { |
129 | - ?> |
|
129 | + ?> |
|
130 | 130 | <li class="frm_col_<?php echo esc_attr( $col ) ?>"> |
131 | 131 | <a href="javascript:void(0)" class="frmbutton button frm_insert_code" data-code="if 125 <?php echo esc_attr($skey) ?>][/if 125"><?php echo esc_html( $sname ) ?></a> |
132 | 132 | </li> |
133 | 133 | <?php |
134 | - $col = ( $col == 'one' ) ? 'two' : 'one'; |
|
135 | - unset($skey, $sname); |
|
136 | - } |
|
137 | - ?> |
|
134 | + $col = ( $col == 'one' ) ? 'two' : 'one'; |
|
135 | + unset($skey, $sname); |
|
136 | + } |
|
137 | + ?> |
|
138 | 138 | </ul> |
139 | 139 | </div> |
140 | 140 | <?php } ?> |
@@ -142,17 +142,17 @@ discard block |
||
142 | 142 | <div id="frm-adv-info-tab" class="tabs-panel"> |
143 | 143 | <ul class="frm_code_list"> |
144 | 144 | <?php |
145 | - $col = 'one'; |
|
145 | + $col = 'one'; |
|
146 | 146 | foreach ( $adv_shortcodes as $skey => $sname ) { |
147 | - ?> |
|
147 | + ?> |
|
148 | 148 | <li class="frm_col_<?php echo esc_attr( $col ) ?>"> |
149 | 149 | <a href="javascript:void(0)" class="frmbutton button frm_insert_code <?php echo is_array( $sname ) ? 'frm_help' : ''; ?>" data-code="125 <?php echo esc_attr( $skey ) ?>" <?php echo is_array( $sname ) ? 'title="'. esc_attr( $sname['title'] ) .'"' : ''; ?>><?php echo is_array( $sname ) ? $sname['label'] : $sname; ?></a> |
150 | 150 | </li> |
151 | 151 | <?php |
152 | - $col = ($col == 'one') ? 'two' : 'one'; |
|
153 | - unset($skey, $sname); |
|
154 | - } |
|
155 | - ?> |
|
152 | + $col = ($col == 'one') ? 'two' : 'one'; |
|
153 | + unset($skey, $sname); |
|
154 | + } |
|
155 | + ?> |
|
156 | 156 | <?php if ( isset($file) ) { ?> |
157 | 157 | <li class="frm_col_<?php echo esc_attr( $col ) ?>"> |
158 | 158 | <a href="javascript:void(0)" class="frmbutton button frm_insert_code" data-code="<?php echo esc_attr($file->id) ?> size=thumbnail html=1"><?php _e( 'Image Size', 'formidable' ) ?></a> |
@@ -169,8 +169,8 @@ discard block |
||
169 | 169 | <div class="clear"></div> |
170 | 170 | <?php |
171 | 171 | |
172 | - if ( isset($uid) && ! empty($user_fields) ) { |
|
173 | - $col = 'one'; ?> |
|
172 | + if ( isset($uid) && ! empty($user_fields) ) { |
|
173 | + $col = 'one'; ?> |
|
174 | 174 | <p class="howto"><?php _e( 'Insert user information', 'formidable' ) ?></p> |
175 | 175 | <ul class="frm_code_list"> |
176 | 176 | <?php foreach ( $user_fields as $uk => $uf ) { ?> |
@@ -178,14 +178,14 @@ discard block |
||
178 | 178 | <a href="javascript:void(0)" class="frmbutton button frm_insert_code" data-code="<?php echo esc_attr( $uid->id . ' show="' . $uk . '"' ) ?>"><?php echo esc_html( $uf ) ?></a> |
179 | 179 | </li> |
180 | 180 | <?php |
181 | - $col = ($col == 'one') ? 'two' : 'one'; |
|
182 | - unset($uf, $uk); |
|
183 | - } |
|
184 | - unset($uid); ?> |
|
181 | + $col = ($col == 'one') ? 'two' : 'one'; |
|
182 | + unset($uf, $uk); |
|
183 | + } |
|
184 | + unset($uid); ?> |
|
185 | 185 | </ul> |
186 | 186 | <?php } |
187 | 187 | |
188 | - if ( isset($repeat_field) ) { ?> |
|
188 | + if ( isset($repeat_field) ) { ?> |
|
189 | 189 | <div class="clear"></div> |
190 | 190 | <p class="howto"><?php _e( 'Repeating field options', 'formidable' ) ?></p> |
191 | 191 | <ul class="frm_code_list"> |
@@ -194,9 +194,9 @@ discard block |
||
194 | 194 | </li> |
195 | 195 | </ul> |
196 | 196 | <?php |
197 | - } |
|
197 | + } |
|
198 | 198 | |
199 | - if ( isset($dfe) ) { ?> |
|
199 | + if ( isset($dfe) ) { ?> |
|
200 | 200 | |
201 | 201 | <div class="clear"></div> |
202 | 202 | <p class="howto"><?php _e( 'Dynamic field options', 'formidable' ) ?></p> |
@@ -215,8 +215,8 @@ discard block |
||
215 | 215 | </div> |
216 | 216 | |
217 | 217 | <?php |
218 | - if ( $settings_tab ) { |
|
219 | - include(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/mb_html_tab.php'); |
|
220 | - } |
|
221 | - ?> |
|
218 | + if ( $settings_tab ) { |
|
219 | + include(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/mb_html_tab.php'); |
|
220 | + } |
|
221 | + ?> |
|
222 | 222 | </div> |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | |
43 | 43 | if ( $f->type == 'data' ) { |
44 | 44 | //get all fields from linked form |
45 | - if ( isset($f->field_options['form_select']) && is_numeric($f->field_options['form_select']) ) { |
|
46 | - $linked_form = FrmDb::get_var( $wpdb->prefix .'frm_fields', array( 'id' => $f->field_options['form_select'] ), 'form_id' ); |
|
45 | + if ( isset( $f->field_options['form_select'] ) && is_numeric( $f->field_options['form_select'] ) ) { |
|
46 | + $linked_form = FrmDb::get_var( $wpdb->prefix . 'frm_fields', array( 'id' => $f->field_options['form_select'] ), 'form_id' ); |
|
47 | 47 | if ( ! in_array( $linked_form, $linked_forms ) ) { |
48 | 48 | $linked_forms[] = $linked_form; |
49 | 49 | $linked_fields = FrmField::getAll( array( 'fi.type not' => FrmField::no_save_fields(), 'fi.form_id' => $linked_form ) ); |
@@ -53,14 +53,14 @@ discard block |
||
53 | 53 | FrmAppHelper::insert_opt_html( array( 'id' => $f->id . ' show=' . $linked_field->id, 'key' => $f->field_key . ' show=' . $linked_field->field_key, 'name' => $linked_field->name, 'type' => $linked_field->type ) ); |
54 | 54 | |
55 | 55 | $ldfe = $linked_field->id; |
56 | - unset($linked_field); |
|
56 | + unset( $linked_field ); |
|
57 | 57 | } |
58 | 58 | } |
59 | 59 | } |
60 | 60 | } |
61 | 61 | $dfe = $f->id; |
62 | 62 | } |
63 | - unset($f); |
|
63 | + unset( $f ); |
|
64 | 64 | } |
65 | 65 | } ?> |
66 | 66 | </ul> |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | </li> |
85 | 85 | <?php |
86 | 86 | $col = ( $col == 'one' ) ? 'two' : 'one'; |
87 | - unset($skey, $sname); |
|
87 | + unset( $skey, $sname ); |
|
88 | 88 | } |
89 | 89 | ?> |
90 | 90 | </ul> |
@@ -106,8 +106,8 @@ discard block |
||
106 | 106 | ?> |
107 | 107 | <li> |
108 | 108 | <a href="javascript:void(0)" class="frmids alignright frm_insert_code" data-code="if <?php echo esc_attr( $f->id ) ?>]<?php esc_attr_e( 'Conditional text here', 'formidable' ) ?>[/if <?php echo esc_attr( $f->id ) ?>">[if <?php echo (int) $f->id ?>]</a> |
109 | - <a href="javascript:void(0)" class="frmkeys alignright frm_insert_code" data-code="if <?php echo esc_attr( $f->field_key ) ?>]something[/if <?php echo esc_attr( $f->field_key ) ?>">[if <?php echo FrmAppHelper::truncate($f->field_key, 10) ?>]</a> |
|
110 | - <a href="javascript:void(0)" class="frm_insert_code" data-code="<?php echo esc_attr($f->id) ?>"><?php echo FrmAppHelper::truncate($f->name, 60) ?></a> |
|
109 | + <a href="javascript:void(0)" class="frmkeys alignright frm_insert_code" data-code="if <?php echo esc_attr( $f->field_key ) ?>]something[/if <?php echo esc_attr( $f->field_key ) ?>">[if <?php echo FrmAppHelper::truncate( $f->field_key, 10 ) ?>]</a> |
|
110 | + <a href="javascript:void(0)" class="frm_insert_code" data-code="<?php echo esc_attr( $f->id ) ?>"><?php echo FrmAppHelper::truncate( $f->name, 60 ) ?></a> |
|
111 | 111 | </li> |
112 | 112 | <?php |
113 | 113 | |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | } else if ( $f->type == 'file' ) { |
117 | 117 | $file = $f; |
118 | 118 | } |
119 | - unset($f); |
|
119 | + unset( $f ); |
|
120 | 120 | } |
121 | 121 | } ?> |
122 | 122 | </ul> |
@@ -128,11 +128,11 @@ discard block |
||
128 | 128 | foreach ( $cond_shortcodes as $skey => $sname ) { |
129 | 129 | ?> |
130 | 130 | <li class="frm_col_<?php echo esc_attr( $col ) ?>"> |
131 | - <a href="javascript:void(0)" class="frmbutton button frm_insert_code" data-code="if x <?php echo esc_attr($skey) ?>][/if x"><?php echo esc_html( $sname ) ?></a> |
|
131 | + <a href="javascript:void(0)" class="frmbutton button frm_insert_code" data-code="if x <?php echo esc_attr( $skey ) ?>][/if x"><?php echo esc_html( $sname ) ?></a> |
|
132 | 132 | </li> |
133 | 133 | <?php |
134 | 134 | $col = ( $col == 'one' ) ? 'two' : 'one'; |
135 | - unset($skey, $sname); |
|
135 | + unset( $skey, $sname ); |
|
136 | 136 | } |
137 | 137 | ?> |
138 | 138 | </ul> |
@@ -146,22 +146,22 @@ discard block |
||
146 | 146 | foreach ( $adv_shortcodes as $skey => $sname ) { |
147 | 147 | ?> |
148 | 148 | <li class="frm_col_<?php echo esc_attr( $col ) ?>"> |
149 | - <a href="javascript:void(0)" class="frmbutton button frm_insert_code <?php echo is_array( $sname ) ? 'frm_help' : ''; ?>" data-code="125 <?php echo esc_attr( $skey ) ?>" <?php echo is_array( $sname ) ? 'title="'. esc_attr( $sname['title'] ) .'"' : ''; ?>><?php echo is_array( $sname ) ? $sname['label'] : $sname; ?></a> |
|
149 | + <a href="javascript:void(0)" class="frmbutton button frm_insert_code <?php echo is_array( $sname ) ? 'frm_help' : ''; ?>" data-code="125 <?php echo esc_attr( $skey ) ?>" <?php echo is_array( $sname ) ? 'title="' . esc_attr( $sname['title'] ) . '"' : ''; ?>><?php echo is_array( $sname ) ? $sname['label'] : $sname; ?></a> |
|
150 | 150 | </li> |
151 | 151 | <?php |
152 | - $col = ($col == 'one') ? 'two' : 'one'; |
|
153 | - unset($skey, $sname); |
|
152 | + $col = ( $col == 'one' ) ? 'two' : 'one'; |
|
153 | + unset( $skey, $sname ); |
|
154 | 154 | } |
155 | 155 | ?> |
156 | - <?php if ( isset($file) ) { ?> |
|
156 | + <?php if ( isset( $file ) ) { ?> |
|
157 | 157 | <li class="frm_col_<?php echo esc_attr( $col ) ?>"> |
158 | - <a href="javascript:void(0)" class="frmbutton button frm_insert_code" data-code="<?php echo esc_attr($file->id) ?> size=thumbnail html=1"><?php _e( 'Image Size', 'formidable' ) ?></a> |
|
158 | + <a href="javascript:void(0)" class="frmbutton button frm_insert_code" data-code="<?php echo esc_attr( $file->id ) ?> size=thumbnail html=1"><?php _e( 'Image Size', 'formidable' ) ?></a> |
|
159 | 159 | </li> |
160 | - <li class="frm_col_<?php echo $col = (($col == 'one') ? 'two' : 'one') ?>"> |
|
161 | - <a href="javascript:void(0)" class="frmbutton button frm_insert_code" data-code="<?php echo esc_attr($file->id) ?> show=id"><?php _e( 'Image ID', 'formidable' ) ?></a> |
|
160 | + <li class="frm_col_<?php echo $col = ( ( $col == 'one' ) ? 'two' : 'one' ) ?>"> |
|
161 | + <a href="javascript:void(0)" class="frmbutton button frm_insert_code" data-code="<?php echo esc_attr( $file->id ) ?> show=id"><?php _e( 'Image ID', 'formidable' ) ?></a> |
|
162 | 162 | </li> |
163 | - <li class="frm_col_<?php echo $col = (($col == 'one') ? 'two' : 'one') ?>"> |
|
164 | - <a href="javascript:void(0)" class="frmbutton button frm_insert_code" data-code="<?php echo esc_attr($file->id) ?> show=label"><?php _e( 'Image Name', 'formidable' ) ?></a> |
|
163 | + <li class="frm_col_<?php echo $col = ( ( $col == 'one' ) ? 'two' : 'one' ) ?>"> |
|
164 | + <a href="javascript:void(0)" class="frmbutton button frm_insert_code" data-code="<?php echo esc_attr( $file->id ) ?> show=label"><?php _e( 'Image Name', 'formidable' ) ?></a> |
|
165 | 165 | </li> |
166 | 166 | <?php } ?> |
167 | 167 | </ul> |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | <div class="clear"></div> |
170 | 170 | <?php |
171 | 171 | |
172 | - if ( isset($uid) && ! empty($user_fields) ) { |
|
172 | + if ( isset( $uid ) && ! empty( $user_fields ) ) { |
|
173 | 173 | $col = 'one'; ?> |
174 | 174 | <p class="howto"><?php _e( 'Insert user information', 'formidable' ) ?></p> |
175 | 175 | <ul class="frm_code_list"> |
@@ -178,14 +178,14 @@ discard block |
||
178 | 178 | <a href="javascript:void(0)" class="frmbutton button frm_insert_code" data-code="<?php echo esc_attr( $uid->id . ' show="' . $uk . '"' ) ?>"><?php echo esc_html( $uf ) ?></a> |
179 | 179 | </li> |
180 | 180 | <?php |
181 | - $col = ($col == 'one') ? 'two' : 'one'; |
|
182 | - unset($uf, $uk); |
|
181 | + $col = ( $col == 'one' ) ? 'two' : 'one'; |
|
182 | + unset( $uf, $uk ); |
|
183 | 183 | } |
184 | - unset($uid); ?> |
|
184 | + unset( $uid ); ?> |
|
185 | 185 | </ul> |
186 | 186 | <?php } |
187 | 187 | |
188 | - if ( isset($repeat_field) ) { ?> |
|
188 | + if ( isset( $repeat_field ) ) { ?> |
|
189 | 189 | <div class="clear"></div> |
190 | 190 | <p class="howto"><?php _e( 'Repeating field options', 'formidable' ) ?></p> |
191 | 191 | <ul class="frm_code_list"> |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | <?php |
197 | 197 | } |
198 | 198 | |
199 | - if ( isset($dfe) ) { ?> |
|
199 | + if ( isset( $dfe ) ) { ?> |
|
200 | 200 | |
201 | 201 | <div class="clear"></div> |
202 | 202 | <p class="howto"><?php _e( 'Dynamic field options', 'formidable' ) ?></p> |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | <li class="frm_col_one"> |
205 | 205 | <a href="javascript:void(0)" class="frmbutton button frm_insert_code" data-code="<?php echo esc_attr( $dfe . ' show="created-at"' ) ?>"><?php _e( 'Creation Date', 'formidable' ) ?></a> |
206 | 206 | </li> |
207 | - <?php if ( isset($ldfe) ) { ?> |
|
207 | + <?php if ( isset( $ldfe ) ) { ?> |
|
208 | 208 | <li class="frm_col_two"> |
209 | 209 | <a href="javascript:void(0)" class="frmbutton button frm_insert_code" data-code="<?php echo esc_attr( $dfe . ' show="' . $ldfe . '"' ) ?>"><?php _e( 'Field From Entry', 'formidable' ) ?></a> |
210 | 210 | </li> |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | |
217 | 217 | <?php |
218 | 218 | if ( $settings_tab ) { |
219 | - include(FrmAppHelper::plugin_path() .'/classes/views/frm-forms/mb_html_tab.php'); |
|
219 | + include( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/mb_html_tab.php' ); |
|
220 | 220 | } |
221 | 221 | ?> |
222 | 222 | </div> |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -class FrmCSVExportHelper{ |
|
3 | +class FrmCSVExportHelper { |
|
4 | 4 | protected static $separator = ', '; |
5 | 5 | protected static $column_separator = ','; |
6 | 6 | protected static $line_break = 'return'; |
@@ -235,50 +235,50 @@ discard block |
||
235 | 235 | return $line; |
236 | 236 | } |
237 | 237 | |
238 | - $convmap = false; |
|
238 | + $convmap = false; |
|
239 | 239 | |
240 | 240 | switch ( self::$to_encoding ) { |
241 | - case 'macintosh': |
|
241 | + case 'macintosh': |
|
242 | 242 | // this map was derived from the differences between the MacRoman and UTF-8 Charsets |
243 | 243 | // Reference: |
244 | 244 | // - http://www.alanwood.net/demos/macroman.html |
245 | - $convmap = array( |
|
246 | - 256, 304, 0, 0xffff, |
|
247 | - 306, 337, 0, 0xffff, |
|
248 | - 340, 375, 0, 0xffff, |
|
249 | - 377, 401, 0, 0xffff, |
|
250 | - 403, 709, 0, 0xffff, |
|
251 | - 712, 727, 0, 0xffff, |
|
252 | - 734, 936, 0, 0xffff, |
|
253 | - 938, 959, 0, 0xffff, |
|
254 | - 961, 8210, 0, 0xffff, |
|
255 | - 8213, 8215, 0, 0xffff, |
|
256 | - 8219, 8219, 0, 0xffff, |
|
257 | - 8227, 8229, 0, 0xffff, |
|
258 | - 8231, 8239, 0, 0xffff, |
|
259 | - 8241, 8248, 0, 0xffff, |
|
260 | - 8251, 8259, 0, 0xffff, |
|
261 | - 8261, 8363, 0, 0xffff, |
|
262 | - 8365, 8481, 0, 0xffff, |
|
263 | - 8483, 8705, 0, 0xffff, |
|
264 | - 8707, 8709, 0, 0xffff, |
|
265 | - 8711, 8718, 0, 0xffff, |
|
266 | - 8720, 8720, 0, 0xffff, |
|
267 | - 8722, 8729, 0, 0xffff, |
|
268 | - 8731, 8733, 0, 0xffff, |
|
269 | - 8735, 8746, 0, 0xffff, |
|
270 | - 8748, 8775, 0, 0xffff, |
|
271 | - 8777, 8799, 0, 0xffff, |
|
272 | - 8801, 8803, 0, 0xffff, |
|
273 | - 8806, 9673, 0, 0xffff, |
|
274 | - 9675, 63742, 0, 0xffff, |
|
275 | - 63744, 64256, 0, 0xffff, |
|
276 | - ); |
|
277 | - break; |
|
278 | - case 'ISO-8859-1': |
|
279 | - $convmap = array( 256, 10000, 0, 0xffff ); |
|
280 | - break; |
|
281 | - } |
|
245 | + $convmap = array( |
|
246 | + 256, 304, 0, 0xffff, |
|
247 | + 306, 337, 0, 0xffff, |
|
248 | + 340, 375, 0, 0xffff, |
|
249 | + 377, 401, 0, 0xffff, |
|
250 | + 403, 709, 0, 0xffff, |
|
251 | + 712, 727, 0, 0xffff, |
|
252 | + 734, 936, 0, 0xffff, |
|
253 | + 938, 959, 0, 0xffff, |
|
254 | + 961, 8210, 0, 0xffff, |
|
255 | + 8213, 8215, 0, 0xffff, |
|
256 | + 8219, 8219, 0, 0xffff, |
|
257 | + 8227, 8229, 0, 0xffff, |
|
258 | + 8231, 8239, 0, 0xffff, |
|
259 | + 8241, 8248, 0, 0xffff, |
|
260 | + 8251, 8259, 0, 0xffff, |
|
261 | + 8261, 8363, 0, 0xffff, |
|
262 | + 8365, 8481, 0, 0xffff, |
|
263 | + 8483, 8705, 0, 0xffff, |
|
264 | + 8707, 8709, 0, 0xffff, |
|
265 | + 8711, 8718, 0, 0xffff, |
|
266 | + 8720, 8720, 0, 0xffff, |
|
267 | + 8722, 8729, 0, 0xffff, |
|
268 | + 8731, 8733, 0, 0xffff, |
|
269 | + 8735, 8746, 0, 0xffff, |
|
270 | + 8748, 8775, 0, 0xffff, |
|
271 | + 8777, 8799, 0, 0xffff, |
|
272 | + 8801, 8803, 0, 0xffff, |
|
273 | + 8806, 9673, 0, 0xffff, |
|
274 | + 9675, 63742, 0, 0xffff, |
|
275 | + 63744, 64256, 0, 0xffff, |
|
276 | + ); |
|
277 | + break; |
|
278 | + case 'ISO-8859-1': |
|
279 | + $convmap = array( 256, 10000, 0, 0xffff ); |
|
280 | + break; |
|
281 | + } |
|
282 | 282 | |
283 | 283 | if ( is_array( $convmap ) ) { |
284 | 284 | $line = mb_encode_numericentity( $line, $convmap, self::$charset ); |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | } |
290 | 290 | |
291 | 291 | return self::escape_csv( $line ); |
292 | - } |
|
292 | + } |
|
293 | 293 | |
294 | 294 | /** |
295 | 295 | * Escape a " in a csv with another " |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -class FrmCSVExportHelper{ |
|
3 | +class FrmCSVExportHelper { |
|
4 | 4 | protected static $separator = ', '; |
5 | 5 | protected static $column_separator = ','; |
6 | 6 | protected static $line_break = 'return'; |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | header( 'Content-Description: File Transfer' ); |
64 | 64 | header( 'Content-Disposition: attachment; filename="' . esc_attr( $filename ) . '"' ); |
65 | 65 | header( 'Content-Type: text/csv; charset=' . self::$charset, true ); |
66 | - header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', mktime( date( 'H' ) + 2, date( 'i' ), date( 's' ), date( 'm' ), date( 'd' ), date('Y' ) ) ) . ' GMT' ); |
|
66 | + header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', mktime( date( 'H' ) + 2, date( 'i' ), date( 's' ), date( 'm' ), date( 'd' ), date( 'Y' ) ) ) . ' GMT' ); |
|
67 | 67 | header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s' ) . ' GMT' ); |
68 | 68 | header( 'Cache-Control: no-cache, must-revalidate' ); |
69 | 69 | header( 'Pragma: no-cache' ); |
@@ -87,19 +87,19 @@ discard block |
||
87 | 87 | private static function csv_headings( &$headings ) { |
88 | 88 | foreach ( self::$fields as $col ) { |
89 | 89 | if ( isset( $col->field_options['separate_value'] ) && $col->field_options['separate_value'] && ! in_array( $col->type, array( 'user_id', 'file', 'data', 'date' ) ) ) { |
90 | - $headings[ $col->id . '_label' ] = strip_tags( $col->name . ' ' . __( '(label)', 'formidable' ) ); |
|
90 | + $headings[$col->id . '_label'] = strip_tags( $col->name . ' ' . __( '(label)', 'formidable' ) ); |
|
91 | 91 | } |
92 | 92 | |
93 | - $headings[ $col->id ] = strip_tags( $col->name ); |
|
93 | + $headings[$col->id] = strip_tags( $col->name ); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | if ( self::$comment_count ) { |
97 | - for ( $i = 0; $i < self::$comment_count; $i++ ) { |
|
98 | - $headings[ 'comment' . $i ] = __( 'Comment', 'formidable' ); |
|
99 | - $headings[ 'comment_user_id' . $i ] = __( 'Comment User', 'formidable' ); |
|
100 | - $headings[ 'comment_created_at' . $i ] = __( 'Comment Date', 'formidable' ); |
|
97 | + for ( $i = 0; $i < self::$comment_count; $i ++ ) { |
|
98 | + $headings['comment' . $i] = __( 'Comment', 'formidable' ); |
|
99 | + $headings['comment_user_id' . $i] = __( 'Comment User', 'formidable' ); |
|
100 | + $headings['comment_created_at' . $i] = __( 'Comment Date', 'formidable' ); |
|
101 | 101 | } |
102 | - unset($i); |
|
102 | + unset( $i ); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | $headings['created_at'] = __( 'Timestamp', 'formidable' ); |
@@ -146,30 +146,30 @@ discard block |
||
146 | 146 | continue; |
147 | 147 | } |
148 | 148 | |
149 | - if ( ! isset( $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] ) ) { |
|
150 | - $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] = array(); |
|
151 | - } else if ( ! is_array( $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] ) ) { |
|
149 | + if ( ! isset( $entries[self::$entry->parent_item_id]->metas[$meta_id] ) ) { |
|
150 | + $entries[self::$entry->parent_item_id]->metas[$meta_id] = array(); |
|
151 | + } else if ( ! is_array( $entries[self::$entry->parent_item_id]->metas[$meta_id] ) ) { |
|
152 | 152 | // if the data is here, it should be an array but if this field has collected data |
153 | 153 | // both while inside and outside of the repeating section, it's possible this is a string |
154 | - $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] = (array) $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ]; |
|
154 | + $entries[self::$entry->parent_item_id]->metas[$meta_id] = (array) $entries[self::$entry->parent_item_id]->metas[$meta_id]; |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | //add the repeated values |
158 | - $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ][] = $meta_value; |
|
158 | + $entries[self::$entry->parent_item_id]->metas[$meta_id][] = $meta_value; |
|
159 | 159 | } |
160 | - $entries[ self::$entry->parent_item_id ]->metas += self::$entry->metas; |
|
160 | + $entries[self::$entry->parent_item_id]->metas += self::$entry->metas; |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | // add the embedded form id |
164 | - if ( ! isset( $entries[ self::$entry->parent_item_id ]->embedded_fields ) ) { |
|
165 | - $entries[ self::$entry->parent_item_id ]->embedded_fields = array(); |
|
164 | + if ( ! isset( $entries[self::$entry->parent_item_id]->embedded_fields ) ) { |
|
165 | + $entries[self::$entry->parent_item_id]->embedded_fields = array(); |
|
166 | 166 | } |
167 | - $entries[ self::$entry->parent_item_id ]->embedded_fields[ self::$entry->id ] = self::$entry->form_id; |
|
167 | + $entries[self::$entry->parent_item_id]->embedded_fields[self::$entry->id] = self::$entry->form_id; |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | private static function add_field_values_to_csv( &$row ) { |
171 | 171 | foreach ( self::$fields as $col ) { |
172 | - $field_value = isset( self::$entry->metas[ $col->id ] ) ? self::$entry->metas[ $col->id ] : false; |
|
172 | + $field_value = isset( self::$entry->metas[$col->id] ) ? self::$entry->metas[$col->id] : false; |
|
173 | 173 | |
174 | 174 | $field_value = maybe_unserialize( $field_value ); |
175 | 175 | $field_value = apply_filters( 'frm_csv_value', $field_value, array( 'field' => $col, 'entry' => self::$entry, 'separator' => self::$separator ) ); |
@@ -178,13 +178,13 @@ discard block |
||
178 | 178 | $sep_value = FrmEntriesHelper::display_value( $field_value, $col, array( |
179 | 179 | 'type' => $col->type, 'post_id' => self::$entry->post_id, 'show_icon' => false, |
180 | 180 | 'entry_id' => self::$entry->id, 'sep' => self::$separator, |
181 | - 'embedded_field_id' => ( isset( self::$entry->embedded_fields ) && isset( self::$entry->embedded_fields[ self::$entry->id ] ) ) ? 'form' . self::$entry->embedded_fields[ self::$entry->id ] : 0, |
|
181 | + 'embedded_field_id' => ( isset( self::$entry->embedded_fields ) && isset( self::$entry->embedded_fields[self::$entry->id] ) ) ? 'form' . self::$entry->embedded_fields[self::$entry->id] : 0, |
|
182 | 182 | ) ); |
183 | - $row[ $col->id . '_label' ] = $sep_value; |
|
183 | + $row[$col->id . '_label'] = $sep_value; |
|
184 | 184 | unset( $sep_value ); |
185 | 185 | } |
186 | 186 | |
187 | - $row[ $col->id ] = $field_value; |
|
187 | + $row[$col->id] = $field_value; |
|
188 | 188 | |
189 | 189 | unset( $col, $field_value ); |
190 | 190 | } |
@@ -205,9 +205,9 @@ discard block |
||
205 | 205 | $col_count = count( $rows ); |
206 | 206 | $this_col = 0; |
207 | 207 | foreach ( $rows as $k => $row ) { |
208 | - $this_col++; |
|
208 | + $this_col ++; |
|
209 | 209 | |
210 | - if ( ! isset( self::$headings[ $k ] ) ) { |
|
210 | + if ( ! isset( self::$headings[$k] ) ) { |
|
211 | 211 | // this column has been removed from the csv, so skip it |
212 | 212 | continue; |
213 | 213 | } |
@@ -87,9 +87,9 @@ |
||
87 | 87 | } else if ( $form->is_template ) { |
88 | 88 | echo ' ' . __( '(template)', 'formidable' ); |
89 | 89 | } |
90 | - ?></option> |
|
90 | + ?></option> |
|
91 | 91 | <?php |
92 | - } ?> |
|
92 | + } ?> |
|
93 | 93 | </select> |
94 | 94 | <p class="howto"><?php _e( 'Hold down the CTRL/Command button to select multiple forms', 'formidable' ); ?></p> |
95 | 95 | </td> |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | <div class="frmicon icon32"><br/></div> |
3 | 3 | <h2><?php _e( 'Import/Export', 'formidable' ); ?></h2> |
4 | 4 | |
5 | - <?php include(FrmAppHelper::plugin_path() .'/classes/views/shared/errors.php'); ?> |
|
5 | + <?php include( FrmAppHelper::plugin_path() . '/classes/views/shared/errors.php' ); ?> |
|
6 | 6 | <div id="poststuff" class="metabox-holder"> |
7 | 7 | <div id="post-body"> |
8 | 8 | <div id="post-body-content"> |
@@ -10,16 +10,16 @@ discard block |
||
10 | 10 | <div class="postbox "> |
11 | 11 | <h3 class="hndle"><span><?php _e( 'Import', 'formidable' ) ?></span></h3> |
12 | 12 | <div class="inside"> |
13 | - <p class="howto"><?php echo apply_filters('frm_upload_instructions1', __( 'Upload your Formidable XML file to import forms into this site. If your imported form key and creation date match a form on your site, that form will be updated.', 'formidable' )) ?></p> |
|
13 | + <p class="howto"><?php echo apply_filters( 'frm_upload_instructions1', __( 'Upload your Formidable XML file to import forms into this site. If your imported form key and creation date match a form on your site, that form will be updated.', 'formidable' ) ) ?></p> |
|
14 | 14 | <br/> |
15 | 15 | <form enctype="multipart/form-data" method="post"> |
16 | 16 | <input type="hidden" name="frm_action" value="import_xml" /> |
17 | - <?php wp_nonce_field('import-xml-nonce', 'import-xml'); ?> |
|
18 | - <p><label><?php echo apply_filters('frm_upload_instructions2', __( 'Choose a Formidable XML file', 'formidable' )) ?> (<?php printf(__( 'Maximum size: %s', 'formidable' ), ini_get('upload_max_filesize')) ?>)</label> |
|
17 | + <?php wp_nonce_field( 'import-xml-nonce', 'import-xml' ); ?> |
|
18 | + <p><label><?php echo apply_filters( 'frm_upload_instructions2', __( 'Choose a Formidable XML file', 'formidable' ) ) ?> (<?php printf( __( 'Maximum size: %s', 'formidable' ), ini_get( 'upload_max_filesize' ) ) ?>)</label> |
|
19 | 19 | <input type="file" name="frm_import_file" size="25" /> |
20 | 20 | </p> |
21 | 21 | |
22 | - <?php do_action('frm_csv_opts', $forms) ?> |
|
22 | + <?php do_action( 'frm_csv_opts', $forms ) ?> |
|
23 | 23 | |
24 | 24 | <p class="submit"> |
25 | 25 | <input type="submit" value="<?php esc_attr_e( 'Upload file and import', 'formidable' ) ?>" class="button-primary" /> |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | <div class="inside with_frm_style"> |
35 | 35 | <form method="post" action="<?php echo esc_url( admin_url( 'admin-ajax.php' ) ); ?>" id="frm_export_xml"> |
36 | 36 | <input type="hidden" name="action" value="frm_export_xml" /> |
37 | - <?php wp_nonce_field('export-xml-nonce', 'export-xml'); ?> |
|
37 | + <?php wp_nonce_field( 'export-xml-nonce', 'export-xml' ); ?> |
|
38 | 38 | |
39 | 39 | <table class="form-table"> |
40 | 40 | <tr class="form-field"> |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | <td> |
43 | 43 | <select name="format"> |
44 | 44 | <?php foreach ( $export_format as $t => $type ) { ?> |
45 | - <option value="<?php echo esc_attr( $t ) ?>" data-support="<?php echo esc_attr( $type['support'] ) ?>" <?php echo isset( $type['count'] ) ? 'data-count="'. esc_attr( $type['count'] ) .'"' : ''; ?>><?php echo isset( $type['name'] ) ? $type['name'] : $t ?></option> |
|
45 | + <option value="<?php echo esc_attr( $t ) ?>" data-support="<?php echo esc_attr( $type['support'] ) ?>" <?php echo isset( $type['count'] ) ? 'data-count="' . esc_attr( $type['count'] ) . '"' : ''; ?>><?php echo isset( $type['name'] ) ? $type['name'] : $t ?></option> |
|
46 | 46 | <?php } ?> |
47 | 47 | </select> |
48 | 48 |
@@ -2,110 +2,110 @@ discard block |
||
2 | 2 | |
3 | 3 | class FrmXMLController { |
4 | 4 | |
5 | - public static function menu() { |
|
6 | - add_submenu_page('formidable', 'Formidable | '. __( 'Import/Export', 'formidable' ), __( 'Import/Export', 'formidable' ), 'frm_edit_forms', 'formidable-import', 'FrmXMLController::route'); |
|
7 | - } |
|
5 | + public static function menu() { |
|
6 | + add_submenu_page('formidable', 'Formidable | '. __( 'Import/Export', 'formidable' ), __( 'Import/Export', 'formidable' ), 'frm_edit_forms', 'formidable-import', 'FrmXMLController::route'); |
|
7 | + } |
|
8 | 8 | |
9 | - public static function add_default_templates() { |
|
9 | + public static function add_default_templates() { |
|
10 | 10 | if ( ! function_exists( 'libxml_disable_entity_loader' ) ) { |
11 | - // XML import is not enabled on your server |
|
12 | - return; |
|
13 | - } |
|
11 | + // XML import is not enabled on your server |
|
12 | + return; |
|
13 | + } |
|
14 | 14 | |
15 | - $set_err = libxml_use_internal_errors(true); |
|
16 | - $loader = libxml_disable_entity_loader( true ); |
|
15 | + $set_err = libxml_use_internal_errors(true); |
|
16 | + $loader = libxml_disable_entity_loader( true ); |
|
17 | 17 | |
18 | 18 | $files = apply_filters( 'frm_default_templates_files', array( FrmAppHelper::plugin_path() . '/classes/views/xml/default-templates.xml' ) ); |
19 | 19 | |
20 | - foreach ( (array) $files as $file ) { |
|
21 | - FrmXMLHelper::import_xml($file); |
|
22 | - unset($file); |
|
23 | - } |
|
24 | - /* |
|
20 | + foreach ( (array) $files as $file ) { |
|
21 | + FrmXMLHelper::import_xml($file); |
|
22 | + unset($file); |
|
23 | + } |
|
24 | + /* |
|
25 | 25 | if(is_wp_error($result)) |
26 | 26 | $errors[] = $result->get_error_message(); |
27 | 27 | else if($result) |
28 | 28 | $message = $result; |
29 | 29 | */ |
30 | 30 | |
31 | - unset( $files ); |
|
31 | + unset( $files ); |
|
32 | 32 | |
33 | - libxml_use_internal_errors( $set_err ); |
|
34 | - libxml_disable_entity_loader( $loader ); |
|
35 | - } |
|
33 | + libxml_use_internal_errors( $set_err ); |
|
34 | + libxml_disable_entity_loader( $loader ); |
|
35 | + } |
|
36 | 36 | |
37 | - public static function route() { |
|
38 | - $action = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action'; |
|
37 | + public static function route() { |
|
38 | + $action = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action'; |
|
39 | 39 | $action = FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' ); |
40 | 40 | if ( $action == 'import_xml' ) { |
41 | - return self::import_xml(); |
|
41 | + return self::import_xml(); |
|
42 | 42 | } else if ( $action == 'export_xml' ) { |
43 | - return self::export_xml(); |
|
44 | - } else { |
|
45 | - if ( apply_filters( 'frm_xml_route', true, $action ) ) { |
|
46 | - return self::form(); |
|
47 | - } |
|
48 | - } |
|
49 | - } |
|
50 | - |
|
51 | - public static function form( $errors = array(), $message = '' ) { |
|
43 | + return self::export_xml(); |
|
44 | + } else { |
|
45 | + if ( apply_filters( 'frm_xml_route', true, $action ) ) { |
|
46 | + return self::form(); |
|
47 | + } |
|
48 | + } |
|
49 | + } |
|
50 | + |
|
51 | + public static function form( $errors = array(), $message = '' ) { |
|
52 | 52 | $where = array( |
53 | 53 | 'parent_form_id' => array( null, 0 ), |
54 | 54 | 'status' => array( null, '', 'published' ) |
55 | 55 | ); |
56 | 56 | $forms = FrmForm::getAll( $where, 'name' ); |
57 | 57 | |
58 | - $export_types = apply_filters( 'frm_xml_export_types', |
|
59 | - array( 'forms' => __( 'Forms', 'formidable' ), 'items' => __( 'Entries', 'formidable' ) ) |
|
60 | - ); |
|
58 | + $export_types = apply_filters( 'frm_xml_export_types', |
|
59 | + array( 'forms' => __( 'Forms', 'formidable' ), 'items' => __( 'Entries', 'formidable' ) ) |
|
60 | + ); |
|
61 | 61 | |
62 | - $export_format = apply_filters( 'frm_export_formats', array( |
|
63 | - 'xml' => array( 'name' => 'XML', 'support' => 'forms', 'count' => 'multiple' ), |
|
62 | + $export_format = apply_filters( 'frm_export_formats', array( |
|
63 | + 'xml' => array( 'name' => 'XML', 'support' => 'forms', 'count' => 'multiple' ), |
|
64 | 64 | 'csv' => array( 'name' => 'CSV', 'support' => 'items', 'count' => 'single' ), |
65 | - ) ); |
|
65 | + ) ); |
|
66 | 66 | |
67 | - include(FrmAppHelper::plugin_path() .'/classes/views/xml/import_form.php'); |
|
68 | - } |
|
67 | + include(FrmAppHelper::plugin_path() .'/classes/views/xml/import_form.php'); |
|
68 | + } |
|
69 | 69 | |
70 | - public static function import_xml() { |
|
71 | - $errors = array(); |
|
72 | - $message = ''; |
|
70 | + public static function import_xml() { |
|
71 | + $errors = array(); |
|
72 | + $message = ''; |
|
73 | 73 | |
74 | - $permission_error = FrmAppHelper::permission_nonce_error('frm_edit_forms', 'import-xml', 'import-xml-nonce'); |
|
75 | - if ( $permission_error !== false ) { |
|
76 | - $errors[] = $permission_error; |
|
77 | - self::form($errors); |
|
78 | - return; |
|
79 | - } |
|
74 | + $permission_error = FrmAppHelper::permission_nonce_error('frm_edit_forms', 'import-xml', 'import-xml-nonce'); |
|
75 | + if ( $permission_error !== false ) { |
|
76 | + $errors[] = $permission_error; |
|
77 | + self::form($errors); |
|
78 | + return; |
|
79 | + } |
|
80 | 80 | |
81 | - if ( ! isset($_FILES) || ! isset($_FILES['frm_import_file']) || empty($_FILES['frm_import_file']['name']) || (int) $_FILES['frm_import_file']['size'] < 1 ) { |
|
82 | - $errors[] = __( 'Oops, you didn\'t select a file.', 'formidable' ); |
|
83 | - self::form($errors); |
|
84 | - return; |
|
85 | - } |
|
81 | + if ( ! isset($_FILES) || ! isset($_FILES['frm_import_file']) || empty($_FILES['frm_import_file']['name']) || (int) $_FILES['frm_import_file']['size'] < 1 ) { |
|
82 | + $errors[] = __( 'Oops, you didn\'t select a file.', 'formidable' ); |
|
83 | + self::form($errors); |
|
84 | + return; |
|
85 | + } |
|
86 | 86 | |
87 | - $file = $_FILES['frm_import_file']['tmp_name']; |
|
87 | + $file = $_FILES['frm_import_file']['tmp_name']; |
|
88 | 88 | |
89 | - if ( ! is_uploaded_file( $file ) ) { |
|
90 | - unset($file); |
|
91 | - $errors[] = __( 'The file does not exist, please try again.', 'formidable' ); |
|
92 | - self::form($errors); |
|
93 | - return; |
|
94 | - } |
|
89 | + if ( ! is_uploaded_file( $file ) ) { |
|
90 | + unset($file); |
|
91 | + $errors[] = __( 'The file does not exist, please try again.', 'formidable' ); |
|
92 | + self::form($errors); |
|
93 | + return; |
|
94 | + } |
|
95 | 95 | |
96 | - //add_filter('upload_mimes', 'FrmXMLController::allow_mime'); |
|
96 | + //add_filter('upload_mimes', 'FrmXMLController::allow_mime'); |
|
97 | 97 | |
98 | - $export_format = apply_filters('frm_export_formats', array( |
|
98 | + $export_format = apply_filters('frm_export_formats', array( |
|
99 | 99 | 'xml' => array( 'name' => 'XML', 'support' => 'forms', 'count' => 'multiple' ), |
100 | 100 | ) ); |
101 | 101 | |
102 | - $file_type = strtolower(pathinfo($_FILES['frm_import_file']['name'], PATHINFO_EXTENSION)); |
|
103 | - if ( $file_type != 'xml' && isset( $export_format[ $file_type ] ) ) { |
|
104 | - // allow other file types to be imported |
|
105 | - do_action('frm_before_import_'. $file_type ); |
|
106 | - return; |
|
107 | - } |
|
108 | - unset($file_type); |
|
102 | + $file_type = strtolower(pathinfo($_FILES['frm_import_file']['name'], PATHINFO_EXTENSION)); |
|
103 | + if ( $file_type != 'xml' && isset( $export_format[ $file_type ] ) ) { |
|
104 | + // allow other file types to be imported |
|
105 | + do_action('frm_before_import_'. $file_type ); |
|
106 | + return; |
|
107 | + } |
|
108 | + unset($file_type); |
|
109 | 109 | |
110 | 110 | if ( ! function_exists( 'libxml_disable_entity_loader' ) ) { |
111 | 111 | $errors[] = __( 'XML import is not enabled on your server.', 'formidable' ); |
@@ -124,148 +124,148 @@ discard block |
||
124 | 124 | libxml_use_internal_errors( $set_err ); |
125 | 125 | libxml_disable_entity_loader( $loader ); |
126 | 126 | |
127 | - self::form($errors, $message); |
|
128 | - } |
|
127 | + self::form($errors, $message); |
|
128 | + } |
|
129 | 129 | |
130 | - public static function export_xml() { |
|
131 | - $error = FrmAppHelper::permission_nonce_error( 'frm_edit_forms', 'export-xml', 'export-xml-nonce' ); |
|
132 | - if ( ! empty($error) ) { |
|
133 | - wp_die( $error ); |
|
134 | - } |
|
130 | + public static function export_xml() { |
|
131 | + $error = FrmAppHelper::permission_nonce_error( 'frm_edit_forms', 'export-xml', 'export-xml-nonce' ); |
|
132 | + if ( ! empty($error) ) { |
|
133 | + wp_die( $error ); |
|
134 | + } |
|
135 | 135 | |
136 | 136 | $ids = FrmAppHelper::get_post_param( 'frm_export_forms', array() ); |
137 | 137 | $type = FrmAppHelper::get_post_param( 'type', array() ); |
138 | 138 | $format = FrmAppHelper::get_post_param( 'format', 'xml', 'sanitize_title' ); |
139 | 139 | |
140 | - if ( ! headers_sent() && ! $type ) { |
|
141 | - wp_redirect( esc_url_raw( admin_url( 'admin.php?page=formidable-import' ) ) ); |
|
142 | - die(); |
|
143 | - } |
|
140 | + if ( ! headers_sent() && ! $type ) { |
|
141 | + wp_redirect( esc_url_raw( admin_url( 'admin.php?page=formidable-import' ) ) ); |
|
142 | + die(); |
|
143 | + } |
|
144 | 144 | |
145 | - if ( $format == 'xml' ) { |
|
146 | - self::generate_xml($type, compact('ids')); |
|
145 | + if ( $format == 'xml' ) { |
|
146 | + self::generate_xml($type, compact('ids')); |
|
147 | 147 | } if ( $format == 'csv' ) { |
148 | 148 | self::generate_csv( compact('ids') ); |
149 | - } else { |
|
150 | - do_action('frm_export_format_'. $format, compact('ids')); |
|
151 | - } |
|
149 | + } else { |
|
150 | + do_action('frm_export_format_'. $format, compact('ids')); |
|
151 | + } |
|
152 | 152 | |
153 | - wp_die(); |
|
154 | - } |
|
153 | + wp_die(); |
|
154 | + } |
|
155 | 155 | |
156 | 156 | public static function generate_xml( $type, $args = array() ) { |
157 | - global $wpdb; |
|
158 | - |
|
159 | - $type = (array) $type; |
|
160 | - if ( in_array( 'items', $type) && ! in_array( 'forms', $type) ) { |
|
161 | - // make sure the form is included if there are entries |
|
162 | - $type[] = 'forms'; |
|
163 | - } |
|
164 | - |
|
165 | - if ( in_array( 'forms', $type) ) { |
|
166 | - // include actions with forms |
|
167 | - $type[] = 'actions'; |
|
168 | - } |
|
169 | - |
|
170 | - $tables = array( |
|
171 | - 'items' => $wpdb->prefix .'frm_items', |
|
172 | - 'forms' => $wpdb->prefix .'frm_forms', |
|
173 | - 'posts' => $wpdb->posts, |
|
174 | - 'styles' => $wpdb->posts, |
|
175 | - 'actions' => $wpdb->posts, |
|
176 | - ); |
|
157 | + global $wpdb; |
|
158 | + |
|
159 | + $type = (array) $type; |
|
160 | + if ( in_array( 'items', $type) && ! in_array( 'forms', $type) ) { |
|
161 | + // make sure the form is included if there are entries |
|
162 | + $type[] = 'forms'; |
|
163 | + } |
|
164 | + |
|
165 | + if ( in_array( 'forms', $type) ) { |
|
166 | + // include actions with forms |
|
167 | + $type[] = 'actions'; |
|
168 | + } |
|
169 | + |
|
170 | + $tables = array( |
|
171 | + 'items' => $wpdb->prefix .'frm_items', |
|
172 | + 'forms' => $wpdb->prefix .'frm_forms', |
|
173 | + 'posts' => $wpdb->posts, |
|
174 | + 'styles' => $wpdb->posts, |
|
175 | + 'actions' => $wpdb->posts, |
|
176 | + ); |
|
177 | 177 | |
178 | 178 | $defaults = array( 'ids' => false ); |
179 | - $args = wp_parse_args( $args, $defaults ); |
|
179 | + $args = wp_parse_args( $args, $defaults ); |
|
180 | 180 | |
181 | - $sitename = sanitize_key( get_bloginfo( 'name' ) ); |
|
181 | + $sitename = sanitize_key( get_bloginfo( 'name' ) ); |
|
182 | 182 | |
183 | - if ( ! empty( $sitename ) ) { |
|
183 | + if ( ! empty( $sitename ) ) { |
|
184 | 184 | $sitename .= '.'; |
185 | 185 | } |
186 | - $filename = $sitename . 'formidable.' . date( 'Y-m-d' ) . '.xml'; |
|
186 | + $filename = $sitename . 'formidable.' . date( 'Y-m-d' ) . '.xml'; |
|
187 | 187 | |
188 | - header( 'Content-Description: File Transfer' ); |
|
189 | - header( 'Content-Disposition: attachment; filename=' . $filename ); |
|
190 | - header( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ), true ); |
|
188 | + header( 'Content-Description: File Transfer' ); |
|
189 | + header( 'Content-Disposition: attachment; filename=' . $filename ); |
|
190 | + header( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ), true ); |
|
191 | 191 | |
192 | - //make sure ids are numeric |
|
193 | - if ( is_array( $args['ids'] ) && ! empty( $args['ids'] ) ) { |
|
194 | - $args['ids'] = array_filter( $args['ids'], 'is_numeric' ); |
|
195 | - } |
|
192 | + //make sure ids are numeric |
|
193 | + if ( is_array( $args['ids'] ) && ! empty( $args['ids'] ) ) { |
|
194 | + $args['ids'] = array_filter( $args['ids'], 'is_numeric' ); |
|
195 | + } |
|
196 | 196 | |
197 | - $records = array(); |
|
197 | + $records = array(); |
|
198 | 198 | |
199 | 199 | foreach ( $type as $tb_type ) { |
200 | - $where = array(); |
|
200 | + $where = array(); |
|
201 | 201 | $join = ''; |
202 | - $table = $tables[ $tb_type ]; |
|
202 | + $table = $tables[ $tb_type ]; |
|
203 | 203 | |
204 | - $select = $table .'.id'; |
|
205 | - $query_vars = array(); |
|
204 | + $select = $table .'.id'; |
|
205 | + $query_vars = array(); |
|
206 | 206 | |
207 | - switch ( $tb_type ) { |
|
208 | - case 'forms': |
|
209 | - //add forms |
|
210 | - if ( $args['ids'] ) { |
|
207 | + switch ( $tb_type ) { |
|
208 | + case 'forms': |
|
209 | + //add forms |
|
210 | + if ( $args['ids'] ) { |
|
211 | 211 | $where[] = array( 'or' => 1, $table . '.id' => $args['ids'], $table .'.parent_form_id' => $args['ids'] ); |
212 | - } else { |
|
212 | + } else { |
|
213 | 213 | $where[ $table . '.status !' ] = 'draft'; |
214 | - } |
|
215 | - break; |
|
216 | - case 'actions': |
|
217 | - $select = $table .'.ID'; |
|
214 | + } |
|
215 | + break; |
|
216 | + case 'actions': |
|
217 | + $select = $table .'.ID'; |
|
218 | 218 | $where['post_type'] = FrmFormActionsController::$action_post_type; |
219 | - if ( ! empty($args['ids']) ) { |
|
219 | + if ( ! empty($args['ids']) ) { |
|
220 | 220 | $where['menu_order'] = $args['ids']; |
221 | - } |
|
222 | - break; |
|
223 | - case 'items': |
|
224 | - //$join = "INNER JOIN {$wpdb->prefix}frm_item_metas im ON ($table.id = im.item_id)"; |
|
225 | - if ( $args['ids'] ) { |
|
221 | + } |
|
222 | + break; |
|
223 | + case 'items': |
|
224 | + //$join = "INNER JOIN {$wpdb->prefix}frm_item_metas im ON ($table.id = im.item_id)"; |
|
225 | + if ( $args['ids'] ) { |
|
226 | 226 | $where[ $table . '.form_id' ] = $args['ids']; |
227 | - } |
|
228 | - break; |
|
229 | - case 'styles': |
|
230 | - // Loop through all exported forms and get their selected style IDs |
|
231 | - $form_ids = $args['ids']; |
|
232 | - $style_ids = array(); |
|
233 | - foreach ( $form_ids as $form_id ) { |
|
234 | - $form_data = FrmForm::getOne( $form_id ); |
|
235 | - // For forms that have not been updated while running 2.0, check if custom_style is set |
|
236 | - if ( isset( $form_data->options['custom_style'] ) ) { |
|
237 | - $style_ids[] = $form_data->options['custom_style']; |
|
238 | - } |
|
239 | - unset( $form_id, $form_data ); |
|
240 | - } |
|
241 | - $select = $table .'.ID'; |
|
242 | - $where['post_type'] = 'frm_styles'; |
|
243 | - |
|
244 | - // Only export selected styles |
|
245 | - if ( ! empty( $style_ids ) ) { |
|
246 | - $where['ID'] = $style_ids; |
|
247 | - } |
|
248 | - break; |
|
249 | - default: |
|
250 | - $select = $table .'.ID'; |
|
251 | - $join = ' INNER JOIN ' . $wpdb->postmeta . ' pm ON (pm.post_id=' . $table . '.ID)'; |
|
252 | - $where['pm.meta_key'] = 'frm_form_id'; |
|
253 | - |
|
254 | - if ( empty($args['ids']) ) { |
|
255 | - $where['pm.meta_value >'] = 1; |
|
256 | - } else { |
|
257 | - $where['pm.meta_value'] = $args['ids']; |
|
258 | - } |
|
259 | - break; |
|
260 | - } |
|
227 | + } |
|
228 | + break; |
|
229 | + case 'styles': |
|
230 | + // Loop through all exported forms and get their selected style IDs |
|
231 | + $form_ids = $args['ids']; |
|
232 | + $style_ids = array(); |
|
233 | + foreach ( $form_ids as $form_id ) { |
|
234 | + $form_data = FrmForm::getOne( $form_id ); |
|
235 | + // For forms that have not been updated while running 2.0, check if custom_style is set |
|
236 | + if ( isset( $form_data->options['custom_style'] ) ) { |
|
237 | + $style_ids[] = $form_data->options['custom_style']; |
|
238 | + } |
|
239 | + unset( $form_id, $form_data ); |
|
240 | + } |
|
241 | + $select = $table .'.ID'; |
|
242 | + $where['post_type'] = 'frm_styles'; |
|
243 | + |
|
244 | + // Only export selected styles |
|
245 | + if ( ! empty( $style_ids ) ) { |
|
246 | + $where['ID'] = $style_ids; |
|
247 | + } |
|
248 | + break; |
|
249 | + default: |
|
250 | + $select = $table .'.ID'; |
|
251 | + $join = ' INNER JOIN ' . $wpdb->postmeta . ' pm ON (pm.post_id=' . $table . '.ID)'; |
|
252 | + $where['pm.meta_key'] = 'frm_form_id'; |
|
253 | + |
|
254 | + if ( empty($args['ids']) ) { |
|
255 | + $where['pm.meta_value >'] = 1; |
|
256 | + } else { |
|
257 | + $where['pm.meta_value'] = $args['ids']; |
|
258 | + } |
|
259 | + break; |
|
260 | + } |
|
261 | 261 | |
262 | 262 | $records[ $tb_type ] = FrmDb::get_col( $table . $join, $where, $select ); |
263 | - unset($tb_type); |
|
264 | - } |
|
263 | + unset($tb_type); |
|
264 | + } |
|
265 | 265 | |
266 | 266 | echo '<?xml version="1.0" encoding="' . esc_attr( get_bloginfo('charset') ) . "\" ?>\n"; |
267 | - include(FrmAppHelper::plugin_path() .'/classes/views/xml/xml.php'); |
|
268 | - } |
|
267 | + include(FrmAppHelper::plugin_path() .'/classes/views/xml/xml.php'); |
|
268 | + } |
|
269 | 269 | |
270 | 270 | |
271 | 271 | public static function generate_csv( $atts ) { |
@@ -336,14 +336,14 @@ discard block |
||
336 | 336 | } |
337 | 337 | |
338 | 338 | /** |
339 | - * Get the fields that should be included in the CSV export |
|
340 | - * |
|
341 | - * @since 2.0.19 |
|
342 | - * |
|
343 | - * @param int $form_id |
|
344 | - * @param object $form |
|
345 | - * @return array $csv_fields |
|
346 | - */ |
|
339 | + * Get the fields that should be included in the CSV export |
|
340 | + * |
|
341 | + * @since 2.0.19 |
|
342 | + * |
|
343 | + * @param int $form_id |
|
344 | + * @param object $form |
|
345 | + * @return array $csv_fields |
|
346 | + */ |
|
347 | 347 | private static function get_fields_for_csv_export( $form_id, $form ) { |
348 | 348 | $csv_field_ids = apply_filters( 'frm_csv_field_ids', '', $form_id, array( 'form' => $form ) ); |
349 | 349 | |
@@ -371,16 +371,16 @@ discard block |
||
371 | 371 | } |
372 | 372 | |
373 | 373 | public static function allow_mime( $mimes ) { |
374 | - if ( ! isset( $mimes['csv'] ) ) { |
|
375 | - // allow csv files |
|
376 | - $mimes['csv'] = 'text/csv'; |
|
377 | - } |
|
378 | - |
|
379 | - if ( ! isset( $mimes['xml'] ) ) { |
|
380 | - // allow xml |
|
381 | - $mimes['xml'] = 'text/xml'; |
|
382 | - } |
|
383 | - |
|
384 | - return $mimes; |
|
385 | - } |
|
374 | + if ( ! isset( $mimes['csv'] ) ) { |
|
375 | + // allow csv files |
|
376 | + $mimes['csv'] = 'text/csv'; |
|
377 | + } |
|
378 | + |
|
379 | + if ( ! isset( $mimes['xml'] ) ) { |
|
380 | + // allow xml |
|
381 | + $mimes['xml'] = 'text/xml'; |
|
382 | + } |
|
383 | + |
|
384 | + return $mimes; |
|
385 | + } |
|
386 | 386 | } |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | class FrmXMLController { |
4 | 4 | |
5 | 5 | public static function menu() { |
6 | - add_submenu_page('formidable', 'Formidable | '. __( 'Import/Export', 'formidable' ), __( 'Import/Export', 'formidable' ), 'frm_edit_forms', 'formidable-import', 'FrmXMLController::route'); |
|
6 | + add_submenu_page( 'formidable', 'Formidable | ' . __( 'Import/Export', 'formidable' ), __( 'Import/Export', 'formidable' ), 'frm_edit_forms', 'formidable-import', 'FrmXMLController::route' ); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | public static function add_default_templates() { |
@@ -12,14 +12,14 @@ discard block |
||
12 | 12 | return; |
13 | 13 | } |
14 | 14 | |
15 | - $set_err = libxml_use_internal_errors(true); |
|
15 | + $set_err = libxml_use_internal_errors( true ); |
|
16 | 16 | $loader = libxml_disable_entity_loader( true ); |
17 | 17 | |
18 | 18 | $files = apply_filters( 'frm_default_templates_files', array( FrmAppHelper::plugin_path() . '/classes/views/xml/default-templates.xml' ) ); |
19 | 19 | |
20 | 20 | foreach ( (array) $files as $file ) { |
21 | - FrmXMLHelper::import_xml($file); |
|
22 | - unset($file); |
|
21 | + FrmXMLHelper::import_xml( $file ); |
|
22 | + unset( $file ); |
|
23 | 23 | } |
24 | 24 | /* |
25 | 25 | if(is_wp_error($result)) |
@@ -64,48 +64,48 @@ discard block |
||
64 | 64 | 'csv' => array( 'name' => 'CSV', 'support' => 'items', 'count' => 'single' ), |
65 | 65 | ) ); |
66 | 66 | |
67 | - include(FrmAppHelper::plugin_path() .'/classes/views/xml/import_form.php'); |
|
67 | + include( FrmAppHelper::plugin_path() . '/classes/views/xml/import_form.php' ); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | public static function import_xml() { |
71 | 71 | $errors = array(); |
72 | 72 | $message = ''; |
73 | 73 | |
74 | - $permission_error = FrmAppHelper::permission_nonce_error('frm_edit_forms', 'import-xml', 'import-xml-nonce'); |
|
74 | + $permission_error = FrmAppHelper::permission_nonce_error( 'frm_edit_forms', 'import-xml', 'import-xml-nonce' ); |
|
75 | 75 | if ( $permission_error !== false ) { |
76 | 76 | $errors[] = $permission_error; |
77 | - self::form($errors); |
|
77 | + self::form( $errors ); |
|
78 | 78 | return; |
79 | 79 | } |
80 | 80 | |
81 | - if ( ! isset($_FILES) || ! isset($_FILES['frm_import_file']) || empty($_FILES['frm_import_file']['name']) || (int) $_FILES['frm_import_file']['size'] < 1 ) { |
|
81 | + if ( ! isset( $_FILES ) || ! isset( $_FILES['frm_import_file'] ) || empty( $_FILES['frm_import_file']['name'] ) || (int) $_FILES['frm_import_file']['size'] < 1 ) { |
|
82 | 82 | $errors[] = __( 'Oops, you didn\'t select a file.', 'formidable' ); |
83 | - self::form($errors); |
|
83 | + self::form( $errors ); |
|
84 | 84 | return; |
85 | 85 | } |
86 | 86 | |
87 | 87 | $file = $_FILES['frm_import_file']['tmp_name']; |
88 | 88 | |
89 | 89 | if ( ! is_uploaded_file( $file ) ) { |
90 | - unset($file); |
|
90 | + unset( $file ); |
|
91 | 91 | $errors[] = __( 'The file does not exist, please try again.', 'formidable' ); |
92 | - self::form($errors); |
|
92 | + self::form( $errors ); |
|
93 | 93 | return; |
94 | 94 | } |
95 | 95 | |
96 | 96 | //add_filter('upload_mimes', 'FrmXMLController::allow_mime'); |
97 | 97 | |
98 | - $export_format = apply_filters('frm_export_formats', array( |
|
98 | + $export_format = apply_filters( 'frm_export_formats', array( |
|
99 | 99 | 'xml' => array( 'name' => 'XML', 'support' => 'forms', 'count' => 'multiple' ), |
100 | 100 | ) ); |
101 | 101 | |
102 | - $file_type = strtolower(pathinfo($_FILES['frm_import_file']['name'], PATHINFO_EXTENSION)); |
|
103 | - if ( $file_type != 'xml' && isset( $export_format[ $file_type ] ) ) { |
|
102 | + $file_type = strtolower( pathinfo( $_FILES['frm_import_file']['name'], PATHINFO_EXTENSION ) ); |
|
103 | + if ( $file_type != 'xml' && isset( $export_format[$file_type] ) ) { |
|
104 | 104 | // allow other file types to be imported |
105 | - do_action('frm_before_import_'. $file_type ); |
|
105 | + do_action( 'frm_before_import_' . $file_type ); |
|
106 | 106 | return; |
107 | 107 | } |
108 | - unset($file_type); |
|
108 | + unset( $file_type ); |
|
109 | 109 | |
110 | 110 | if ( ! function_exists( 'libxml_disable_entity_loader' ) ) { |
111 | 111 | $errors[] = __( 'XML import is not enabled on your server.', 'formidable' ); |
@@ -124,12 +124,12 @@ discard block |
||
124 | 124 | libxml_use_internal_errors( $set_err ); |
125 | 125 | libxml_disable_entity_loader( $loader ); |
126 | 126 | |
127 | - self::form($errors, $message); |
|
127 | + self::form( $errors, $message ); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | public static function export_xml() { |
131 | 131 | $error = FrmAppHelper::permission_nonce_error( 'frm_edit_forms', 'export-xml', 'export-xml-nonce' ); |
132 | - if ( ! empty($error) ) { |
|
132 | + if ( ! empty( $error ) ) { |
|
133 | 133 | wp_die( $error ); |
134 | 134 | } |
135 | 135 | |
@@ -143,11 +143,11 @@ discard block |
||
143 | 143 | } |
144 | 144 | |
145 | 145 | if ( $format == 'xml' ) { |
146 | - self::generate_xml($type, compact('ids')); |
|
146 | + self::generate_xml( $type, compact( 'ids' ) ); |
|
147 | 147 | } if ( $format == 'csv' ) { |
148 | - self::generate_csv( compact('ids') ); |
|
148 | + self::generate_csv( compact( 'ids' ) ); |
|
149 | 149 | } else { |
150 | - do_action('frm_export_format_'. $format, compact('ids')); |
|
150 | + do_action( 'frm_export_format_' . $format, compact( 'ids' ) ); |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | wp_die(); |
@@ -157,19 +157,19 @@ discard block |
||
157 | 157 | global $wpdb; |
158 | 158 | |
159 | 159 | $type = (array) $type; |
160 | - if ( in_array( 'items', $type) && ! in_array( 'forms', $type) ) { |
|
160 | + if ( in_array( 'items', $type ) && ! in_array( 'forms', $type ) ) { |
|
161 | 161 | // make sure the form is included if there are entries |
162 | 162 | $type[] = 'forms'; |
163 | 163 | } |
164 | 164 | |
165 | - if ( in_array( 'forms', $type) ) { |
|
165 | + if ( in_array( 'forms', $type ) ) { |
|
166 | 166 | // include actions with forms |
167 | 167 | $type[] = 'actions'; |
168 | 168 | } |
169 | 169 | |
170 | 170 | $tables = array( |
171 | - 'items' => $wpdb->prefix .'frm_items', |
|
172 | - 'forms' => $wpdb->prefix .'frm_forms', |
|
171 | + 'items' => $wpdb->prefix . 'frm_items', |
|
172 | + 'forms' => $wpdb->prefix . 'frm_forms', |
|
173 | 173 | 'posts' => $wpdb->posts, |
174 | 174 | 'styles' => $wpdb->posts, |
175 | 175 | 'actions' => $wpdb->posts, |
@@ -199,31 +199,31 @@ discard block |
||
199 | 199 | foreach ( $type as $tb_type ) { |
200 | 200 | $where = array(); |
201 | 201 | $join = ''; |
202 | - $table = $tables[ $tb_type ]; |
|
202 | + $table = $tables[$tb_type]; |
|
203 | 203 | |
204 | - $select = $table .'.id'; |
|
204 | + $select = $table . '.id'; |
|
205 | 205 | $query_vars = array(); |
206 | 206 | |
207 | 207 | switch ( $tb_type ) { |
208 | 208 | case 'forms': |
209 | 209 | //add forms |
210 | 210 | if ( $args['ids'] ) { |
211 | - $where[] = array( 'or' => 1, $table . '.id' => $args['ids'], $table .'.parent_form_id' => $args['ids'] ); |
|
211 | + $where[] = array( 'or' => 1, $table . '.id' => $args['ids'], $table . '.parent_form_id' => $args['ids'] ); |
|
212 | 212 | } else { |
213 | - $where[ $table . '.status !' ] = 'draft'; |
|
213 | + $where[$table . '.status !'] = 'draft'; |
|
214 | 214 | } |
215 | 215 | break; |
216 | 216 | case 'actions': |
217 | - $select = $table .'.ID'; |
|
217 | + $select = $table . '.ID'; |
|
218 | 218 | $where['post_type'] = FrmFormActionsController::$action_post_type; |
219 | - if ( ! empty($args['ids']) ) { |
|
219 | + if ( ! empty( $args['ids'] ) ) { |
|
220 | 220 | $where['menu_order'] = $args['ids']; |
221 | 221 | } |
222 | 222 | break; |
223 | 223 | case 'items': |
224 | 224 | //$join = "INNER JOIN {$wpdb->prefix}frm_item_metas im ON ($table.id = im.item_id)"; |
225 | 225 | if ( $args['ids'] ) { |
226 | - $where[ $table . '.form_id' ] = $args['ids']; |
|
226 | + $where[$table . '.form_id'] = $args['ids']; |
|
227 | 227 | } |
228 | 228 | break; |
229 | 229 | case 'styles': |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | } |
239 | 239 | unset( $form_id, $form_data ); |
240 | 240 | } |
241 | - $select = $table .'.ID'; |
|
241 | + $select = $table . '.ID'; |
|
242 | 242 | $where['post_type'] = 'frm_styles'; |
243 | 243 | |
244 | 244 | // Only export selected styles |
@@ -247,11 +247,11 @@ discard block |
||
247 | 247 | } |
248 | 248 | break; |
249 | 249 | default: |
250 | - $select = $table .'.ID'; |
|
250 | + $select = $table . '.ID'; |
|
251 | 251 | $join = ' INNER JOIN ' . $wpdb->postmeta . ' pm ON (pm.post_id=' . $table . '.ID)'; |
252 | 252 | $where['pm.meta_key'] = 'frm_form_id'; |
253 | 253 | |
254 | - if ( empty($args['ids']) ) { |
|
254 | + if ( empty( $args['ids'] ) ) { |
|
255 | 255 | $where['pm.meta_value >'] = 1; |
256 | 256 | } else { |
257 | 257 | $where['pm.meta_value'] = $args['ids']; |
@@ -259,12 +259,12 @@ discard block |
||
259 | 259 | break; |
260 | 260 | } |
261 | 261 | |
262 | - $records[ $tb_type ] = FrmDb::get_col( $table . $join, $where, $select ); |
|
263 | - unset($tb_type); |
|
262 | + $records[$tb_type] = FrmDb::get_col( $table . $join, $where, $select ); |
|
263 | + unset( $tb_type ); |
|
264 | 264 | } |
265 | 265 | |
266 | - echo '<?xml version="1.0" encoding="' . esc_attr( get_bloginfo('charset') ) . "\" ?>\n"; |
|
267 | - include(FrmAppHelper::plugin_path() .'/classes/views/xml/xml.php'); |
|
266 | + echo '<?xml version="1.0" encoding="' . esc_attr( get_bloginfo( 'charset' ) ) . "\" ?>\n"; |
|
267 | + include( FrmAppHelper::plugin_path() . '/classes/views/xml/xml.php' ); |
|
268 | 268 | } |
269 | 269 | |
270 | 270 | |
@@ -289,11 +289,11 @@ discard block |
||
289 | 289 | $fid = FrmAppHelper::get_param( 'fid', '', 'get', 'sanitize_text_field' ); |
290 | 290 | } |
291 | 291 | |
292 | - if ( ! ini_get('safe_mode') ) { |
|
293 | - set_time_limit(0); //Remove time limit to execute this function |
|
294 | - $mem_limit = str_replace('M', '', ini_get('memory_limit')); |
|
292 | + if ( ! ini_get( 'safe_mode' ) ) { |
|
293 | + set_time_limit( 0 ); //Remove time limit to execute this function |
|
294 | + $mem_limit = str_replace( 'M', '', ini_get( 'memory_limit' ) ); |
|
295 | 295 | if ( (int) $mem_limit < 256 ) { |
296 | - ini_set('memory_limit', '256M'); |
|
296 | + ini_set( 'memory_limit', '256M' ); |
|
297 | 297 | } |
298 | 298 | } |
299 | 299 | |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | */ |
324 | 324 | $query = apply_filters( 'frm_csv_where', $query, compact( 'form_id', 'search', 'fid', 'item_id' ) ); |
325 | 325 | |
326 | - $entry_ids = FrmDb::get_col( $wpdb->prefix .'frm_items it', $query ); |
|
326 | + $entry_ids = FrmDb::get_col( $wpdb->prefix . 'frm_items it', $query ); |
|
327 | 327 | unset( $query ); |
328 | 328 | |
329 | 329 | if ( empty( $entry_ids ) ) { |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | $no_export_fields = FrmField::no_save_fields(); |
365 | 365 | foreach ( $csv_fields as $k => $f ) { |
366 | 366 | if ( in_array( $f->type, $no_export_fields ) ) { |
367 | - unset( $csv_fields[ $k ] ); |
|
367 | + unset( $csv_fields[$k] ); |
|
368 | 368 | } |
369 | 369 | } |
370 | 370 | } |
@@ -45,7 +45,7 @@ |
||
45 | 45 | /** |
46 | 46 | * Get the singleton instance of this class |
47 | 47 | * |
48 | - * @return object |
|
48 | + * @return FrmPointers |
|
49 | 49 | */ |
50 | 50 | public static function get_instance() { |
51 | 51 | if ( ! ( self::$instance instanceof self ) ) { |
@@ -184,7 +184,7 @@ |
||
184 | 184 | private function do_page_pointer( $page ) { |
185 | 185 | $selector = 'h2'; |
186 | 186 | |
187 | - $pointer = call_user_func( array( $this, $this->admin_pages[ $page ] ) ); |
|
187 | + $pointer = call_user_func( array( $this, $this->admin_pages[$page] ) ); |
|
188 | 188 | |
189 | 189 | $opt_arr = array( |
190 | 190 | 'content' => $pointer['content'], |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | $selector = 'li.toplevel_page_formidable'; |
166 | 166 | |
167 | 167 | $content = '<h3>' . __( 'Congratulations!', 'formidable' ) . '</h3>' |
168 | - .'<p>' . $this->opening_line() . ' ' . sprintf( __( 'Click “Start Tour” to view a quick introduction of this plugin’s core functionality.' ), 'formidable' ) . '</p>'; |
|
168 | + .'<p>' . $this->opening_line() . ' ' . sprintf( __( 'Click “Start Tour” to view a quick introduction of this plugin’s core functionality.' ), 'formidable' ) . '</p>'; |
|
169 | 169 | $opt_arr = array( |
170 | 170 | 'content' => $content, |
171 | 171 | 'position' => array( 'edge' => 'top', 'align' => 'center' ), |
@@ -243,16 +243,16 @@ discard block |
||
243 | 243 | |
244 | 244 | return array( |
245 | 245 | 'content' => '<h3>' . __( 'Forms', 'formidable' ) . '</h3>' |
246 | - . '<p>' . __( 'All your forms will be listed on this page. Create your first form by clicking on the "Add New" button.', 'formidable' ) . '</p>' |
|
247 | - . '<p><strong>' . __( 'Subscribe to our Newsletter', 'formidable' ) . '</strong><br/>' |
|
248 | - . sprintf( __( 'If you would like to hear about new features and updates for %1$s, subscribe to our newsletter:', 'formidable' ), 'Formidable' ) . '</p>' |
|
249 | - . '<form target="_blank" action="//formidablepro.us1.list-manage.com/subscribe/post?u=a4a913790ffb892daacc6f271&id=7e7df15967" method="post" selector="newsletter-form" accept-charset="' . esc_attr( get_bloginfo( 'charset' ) ) . '">' |
|
250 | - . '<p>' |
|
251 | - . '<input style="margin: 5px; color:#666" name="EMAIL" value="' . esc_attr( $current_user->user_email ) . '" selector="newsletter-email" placeholder="' . esc_attr__( 'Email', 'formidable' ) . '"/>' |
|
246 | + . '<p>' . __( 'All your forms will be listed on this page. Create your first form by clicking on the "Add New" button.', 'formidable' ) . '</p>' |
|
247 | + . '<p><strong>' . __( 'Subscribe to our Newsletter', 'formidable' ) . '</strong><br/>' |
|
248 | + . sprintf( __( 'If you would like to hear about new features and updates for %1$s, subscribe to our newsletter:', 'formidable' ), 'Formidable' ) . '</p>' |
|
249 | + . '<form target="_blank" action="//formidablepro.us1.list-manage.com/subscribe/post?u=a4a913790ffb892daacc6f271&id=7e7df15967" method="post" selector="newsletter-form" accept-charset="' . esc_attr( get_bloginfo( 'charset' ) ) . '">' |
|
250 | + . '<p>' |
|
251 | + . '<input style="margin: 5px; color:#666" name="EMAIL" value="' . esc_attr( $current_user->user_email ) . '" selector="newsletter-email" placeholder="' . esc_attr__( 'Email', 'formidable' ) . '"/>' |
|
252 | 252 | . '<input type="hidden" name="group[4505]" value="4" />' |
253 | - . '<button type="submit" class="button-primary">' . esc_html__( 'Subscribe', 'formidable' ) . '</button>' |
|
254 | - . '</p>' |
|
255 | - . '</form>', |
|
253 | + . '<button type="submit" class="button-primary">' . esc_html__( 'Subscribe', 'formidable' ) . '</button>' |
|
254 | + . '</p>' |
|
255 | + . '</form>', |
|
256 | 256 | 'next_page' => 'entries', |
257 | 257 | ); |
258 | 258 | } |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | private function entries_pointer() { |
266 | 266 | return array( |
267 | 267 | 'content' => '<h3>' . __( 'Entries', 'formidable' ) . '</h3>' |
268 | - . '<p>' . __( 'Each time one of your forms is submitted, an entry is created. You will find every form submission listed here so you will always have a backup if an email fails.', 'formidable' ) . '</p>', |
|
268 | + . '<p>' . __( 'Each time one of your forms is submitted, an entry is created. You will find every form submission listed here so you will always have a backup if an email fails.', 'formidable' ) . '</p>', |
|
269 | 269 | 'prev_page' => '', |
270 | 270 | 'next_page' => 'styles', |
271 | 271 | 'selector' => '.wp-list-table', |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | private function styles_pointer() { |
282 | 282 | return array( |
283 | 283 | 'content' => '<h3>' . __( 'Styles', 'formidable' ) . '</h3>' |
284 | - . '<p>' . __( 'Want to make changes to the way your forms look? Make all the changes you would like right here, and watch the sample form change before your eyes.', 'formidable' ) . '</p>', |
|
284 | + . '<p>' . __( 'Want to make changes to the way your forms look? Make all the changes you would like right here, and watch the sample form change before your eyes.', 'formidable' ) . '</p>', |
|
285 | 285 | 'prev_page' => 'entries', |
286 | 286 | 'next_page' => 'import', |
287 | 287 | 'selector' => '.general-style', |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | private function import_pointer() { |
298 | 298 | return array( |
299 | 299 | 'content' => '<h3>' . __( 'Import/Export', 'formidable' ) . '</h3>' |
300 | - . '<p>' . __( 'Import and export forms and styles when copying from one site to another or sharing with someone else. Your entries can be exported to a CSV as well. The Premium version also includes the option to import entries to your site from a CSV.', 'formidable' ) . '</p>', |
|
300 | + . '<p>' . __( 'Import and export forms and styles when copying from one site to another or sharing with someone else. Your entries can be exported to a CSV as well. The Premium version also includes the option to import entries to your site from a CSV.', 'formidable' ) . '</p>', |
|
301 | 301 | 'prev_page' => 'styles', |
302 | 302 | 'next_page' => 'settings', |
303 | 303 | 'selector' => '.inside.with_frm_style', |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | . __( 'Turn stylesheets and scripts off, set which user roles have access to change and create forms, setup your reCaptcha, and set default messages for new forms and fields.', 'formidable' ) |
318 | 318 | . '<p><strong>' . __( 'Plugin Licenses', 'formidable' ) . '</strong><br/>' |
319 | 319 | . sprintf( __( 'Once you’ve purchased %1$s or any addons, you’ll have to enter a license key to get access to all of their powerful features. A Plugin Licenses tab will appear here for you to enter your license key.', 'formidable' ), 'Formidable Pro' ) |
320 | - . '</p>', |
|
320 | + . '</p>', |
|
321 | 321 | 'prev_page' => 'import', |
322 | 322 | 'next_page' => 'addons', |
323 | 323 | ); |
@@ -331,10 +331,10 @@ discard block |
||
331 | 331 | private function addons_pointer() { |
332 | 332 | return array( |
333 | 333 | 'content' => '<h3>' . __( 'Addons', 'formidable' ) . '</h3>' |
334 | - . '<p>' . sprintf( __( 'The powerful functions of %1$s can be extended with %2$spremium plugins%3$s. You can read all about the Formidable Premium Plugins %2$shere%3$s.', 'formidable' ), 'Formidable', '<a target="_blank" href="' . esc_url( FrmAppHelper::make_affiliate_url( 'https://formidablepro.com/' ) ) . '">', '</a>' ) |
|
334 | + . '<p>' . sprintf( __( 'The powerful functions of %1$s can be extended with %2$spremium plugins%3$s. You can read all about the Formidable Premium Plugins %2$shere%3$s.', 'formidable' ), 'Formidable', '<a target="_blank" href="' . esc_url( FrmAppHelper::make_affiliate_url( 'https://formidablepro.com/' ) ) . '">', '</a>' ) |
|
335 | 335 | . '</p>' |
336 | - . '<p><strong>' . __( 'Like this plugin?', 'formidable' ) . '</strong><br/>' . sprintf( __( 'So, we’ve come to the end of the tour. If you like the plugin, please %srate it 5 stars on WordPress.org%s!', 'formidable' ), '<a target="_blank" href="https://wordpress.org/plugins/formidable/">', '</a>' ) . '</p>' |
|
337 | - . '<p>' . sprintf( __( 'Thank you for using our plugin and good luck with your forms!<br/><br/>Best,<br/>Team Formidable - %1$sformidablepro.com%2$s', 'formidable' ), '<a target="_blank" href="' . esc_url( FrmAppHelper::make_affiliate_url( 'https://formidablepro.com/' ) ) . '">', '</a>' ) . '</p>', |
|
336 | + . '<p><strong>' . __( 'Like this plugin?', 'formidable' ) . '</strong><br/>' . sprintf( __( 'So, we’ve come to the end of the tour. If you like the plugin, please %srate it 5 stars on WordPress.org%s!', 'formidable' ), '<a target="_blank" href="https://wordpress.org/plugins/formidable/">', '</a>' ) . '</p>' |
|
337 | + . '<p>' . sprintf( __( 'Thank you for using our plugin and good luck with your forms!<br/><br/>Best,<br/>Team Formidable - %1$sformidablepro.com%2$s', 'formidable' ), '<a target="_blank" href="' . esc_url( FrmAppHelper::make_affiliate_url( 'https://formidablepro.com/' ) ) . '">', '</a>' ) . '</p>', |
|
338 | 338 | 'prev_page' => 'settings', |
339 | 339 | ); |
340 | 340 | } |
@@ -1,8 +1,8 @@ |
||
1 | -<div class="general_settings metabox-holder tabs-panel frm_license_box <?php echo ($a == 'general_settings') ? 'frm_block' : 'frm_hidden'; ?>"> |
|
1 | +<div class="general_settings metabox-holder tabs-panel frm_license_box <?php echo ( $a == 'general_settings' ) ? 'frm_block' : 'frm_hidden'; ?>"> |
|
2 | 2 | <?php if ( ! is_multisite() || is_super_admin() ) { ?> |
3 | 3 | <div class="postbox"> |
4 | 4 | <div class="inside"> |
5 | - <p class="alignright"><?php printf( __( '%1$sClick here%2$s to get it now', 'formidable' ), '<a href="'. esc_url( FrmAppHelper::make_affiliate_url( 'http://formidablepro.com' ) ) . '">', '</a>' ) ?> »</p> |
|
5 | + <p class="alignright"><?php printf( __( '%1$sClick here%2$s to get it now', 'formidable' ), '<a href="' . esc_url( FrmAppHelper::make_affiliate_url( 'http://formidablepro.com' ) ) . '">', '</a>' ) ?> »</p> |
|
6 | 6 | <p><?php _e( 'Ready to take your forms to the next level?<br/>Formidable Forms will help you create views, manage data, and get reports.', 'formidable' ) ?></p> |
7 | 7 | |
8 | 8 | <p>Already signed up? <a href="<?php echo esc_url( FrmAppHelper::make_affiliate_url( 'https://formidablepro.com/knowledgebase/install-formidable-forms/' ) ) ?>" target="_blank"><?php _e( 'Click here', 'formidable' ) ?></a> to get installation instructions and download the pro version.</p> |
@@ -2,200 +2,200 @@ discard block |
||
2 | 2 | |
3 | 3 | class FrmEntriesController { |
4 | 4 | |
5 | - public static function menu() { |
|
5 | + public static function menu() { |
|
6 | 6 | FrmAppHelper::force_capability( 'frm_view_entries' ); |
7 | 7 | |
8 | - add_submenu_page('formidable', 'Formidable | '. __( 'Entries', 'formidable' ), __( 'Entries', 'formidable' ), 'frm_view_entries', 'formidable-entries', 'FrmEntriesController::route' ); |
|
8 | + add_submenu_page('formidable', 'Formidable | '. __( 'Entries', 'formidable' ), __( 'Entries', 'formidable' ), 'frm_view_entries', 'formidable-entries', 'FrmEntriesController::route' ); |
|
9 | 9 | |
10 | 10 | if ( ! in_array( FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' ), array( 'edit', 'show' ) ) ) { |
11 | - $frm_settings = FrmAppHelper::get_settings(); |
|
11 | + $frm_settings = FrmAppHelper::get_settings(); |
|
12 | 12 | add_filter( 'manage_' . sanitize_title( $frm_settings->menu ) . '_page_formidable-entries_columns', 'FrmEntriesController::manage_columns' ); |
13 | 13 | add_filter( 'get_user_option_manage' . sanitize_title( $frm_settings->menu ) . '_page_formidable-entriescolumnshidden', 'FrmEntriesController::hidden_columns' ); |
14 | 14 | add_filter( 'manage_' . sanitize_title( $frm_settings->menu ) . '_page_formidable-entries_sortable_columns', 'FrmEntriesController::sortable_columns' ); |
15 | - } |
|
16 | - } |
|
15 | + } |
|
16 | + } |
|
17 | 17 | |
18 | - /* Display in Back End */ |
|
19 | - public static function route() { |
|
18 | + /* Display in Back End */ |
|
19 | + public static function route() { |
|
20 | 20 | $action = FrmAppHelper::get_param( 'frm_action', '', 'get', 'sanitize_title' ); |
21 | 21 | |
22 | - switch ( $action ) { |
|
23 | - case 'show': |
|
24 | - case 'destroy': |
|
25 | - case 'destroy_all': |
|
26 | - return self::$action(); |
|
22 | + switch ( $action ) { |
|
23 | + case 'show': |
|
24 | + case 'destroy': |
|
25 | + case 'destroy_all': |
|
26 | + return self::$action(); |
|
27 | 27 | |
28 | - default: |
|
29 | - do_action( 'frm_entry_action_route', $action ); |
|
30 | - if ( apply_filters( 'frm_entry_stop_action_route', false, $action ) ) { |
|
31 | - return; |
|
32 | - } |
|
28 | + default: |
|
29 | + do_action( 'frm_entry_action_route', $action ); |
|
30 | + if ( apply_filters( 'frm_entry_stop_action_route', false, $action ) ) { |
|
31 | + return; |
|
32 | + } |
|
33 | 33 | |
34 | - return self::display_list(); |
|
35 | - } |
|
36 | - } |
|
34 | + return self::display_list(); |
|
35 | + } |
|
36 | + } |
|
37 | 37 | |
38 | 38 | public static function contextual_help( $help, $screen_id, $screen ) { |
39 | - // Only add to certain screens. add_help_tab was introduced in WordPress 3.3 |
|
40 | - if ( ! method_exists( $screen, 'add_help_tab' ) ) { |
|
41 | - return $help; |
|
42 | - } |
|
39 | + // Only add to certain screens. add_help_tab was introduced in WordPress 3.3 |
|
40 | + if ( ! method_exists( $screen, 'add_help_tab' ) ) { |
|
41 | + return $help; |
|
42 | + } |
|
43 | 43 | |
44 | 44 | $action = FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' ); |
45 | 45 | $page = FrmAppHelper::simple_get( 'page', 'sanitize_title' ); |
46 | 46 | if ( $page != 'formidable-entries' || ( ! empty( $action ) && $action != 'list' ) ) { |
47 | - return $help; |
|
48 | - } |
|
47 | + return $help; |
|
48 | + } |
|
49 | 49 | |
50 | 50 | unset( $action, $page ); |
51 | 51 | |
52 | - $screen->add_help_tab( array( |
|
53 | - 'id' => 'formidable-entries-tab', |
|
54 | - 'title' => __( 'Overview', 'formidable' ), |
|
52 | + $screen->add_help_tab( array( |
|
53 | + 'id' => 'formidable-entries-tab', |
|
54 | + 'title' => __( 'Overview', 'formidable' ), |
|
55 | 55 | 'content' => '<p>' . esc_html__( 'This screen provides access to all of your entries. You can customize the display of this screen to suit your workflow.', 'formidable' ) .'</p> <p>'. esc_html__( 'Hovering over a row in the entries list will display action links that allow you to manage your entry.', 'formidable' ) . '</p>', |
56 | - )); |
|
56 | + )); |
|
57 | 57 | |
58 | - $screen->set_help_sidebar( |
|
58 | + $screen->set_help_sidebar( |
|
59 | 59 | '<p><strong>' . esc_html__( 'For more information:', 'formidable' ) . '</strong></p>' . |
60 | 60 | '<p><a href="' . esc_url( FrmAppHelper::make_affiliate_url( 'http://formidablepro.com/knowledgebase/manage-entries-from-the-back-end/' ) ) . '" target="_blank">' . esc_html__( 'Documentation on Entries', 'formidable' ) . '</a></p>' . |
61 | 61 | '<p><a href="'. esc_url( FrmAppHelper::make_affiliate_url( 'http://formidablepro.com/help-desk/' ) ) . '" target="_blank">' . esc_html__( 'Support', 'formidable' ) . '</a></p>' |
62 | - ); |
|
62 | + ); |
|
63 | 63 | |
64 | - return $help; |
|
65 | - } |
|
64 | + return $help; |
|
65 | + } |
|
66 | 66 | |
67 | 67 | public static function manage_columns( $columns ) { |
68 | - global $frm_vars, $wpdb; |
|
68 | + global $frm_vars, $wpdb; |
|
69 | 69 | $form_id = FrmForm::get_current_form_id(); |
70 | 70 | |
71 | - $columns[ $form_id .'_id' ] = 'ID'; |
|
71 | + $columns[ $form_id .'_id' ] = 'ID'; |
|
72 | 72 | $columns[ $form_id . '_item_key' ] = esc_html__( 'Entry Key', 'formidable' ); |
73 | 73 | |
74 | - if ( ! $form_id ) { |
|
75 | - return $columns; |
|
76 | - } |
|
74 | + if ( ! $form_id ) { |
|
75 | + return $columns; |
|
76 | + } |
|
77 | 77 | |
78 | - $form_cols = FrmField::get_all_for_form($form_id, '', 'include'); |
|
78 | + $form_cols = FrmField::get_all_for_form($form_id, '', 'include'); |
|
79 | 79 | |
80 | - foreach ( $form_cols as $form_col ) { |
|
80 | + foreach ( $form_cols as $form_col ) { |
|
81 | 81 | if ( FrmField::is_no_save_field( $form_col->type ) ) { |
82 | - continue; |
|
83 | - } |
|
82 | + continue; |
|
83 | + } |
|
84 | 84 | |
85 | - if ( $form_col->type == 'form' && isset( $form_col->field_options['form_select'] ) && ! empty( $form_col->field_options['form_select'] ) ) { |
|
85 | + if ( $form_col->type == 'form' && isset( $form_col->field_options['form_select'] ) && ! empty( $form_col->field_options['form_select'] ) ) { |
|
86 | 86 | $sub_form_cols = FrmField::get_all_for_form( $form_col->field_options['form_select'] ); |
87 | 87 | |
88 | - if ( $sub_form_cols ) { |
|
89 | - foreach ( $sub_form_cols as $k => $sub_form_col ) { |
|
88 | + if ( $sub_form_cols ) { |
|
89 | + foreach ( $sub_form_cols as $k => $sub_form_col ) { |
|
90 | 90 | if ( FrmField::is_no_save_field( $sub_form_col->type ) ) { |
91 | - unset( $sub_form_cols[ $k ] ); |
|
92 | - continue; |
|
93 | - } |
|
91 | + unset( $sub_form_cols[ $k ] ); |
|
92 | + continue; |
|
93 | + } |
|
94 | 94 | $columns[ $form_id . '_' . $sub_form_col->field_key . '-_-' . $form_col->id ] = FrmAppHelper::truncate( $sub_form_col->name, 35 ); |
95 | - unset($sub_form_col); |
|
96 | - } |
|
97 | - } |
|
98 | - unset($sub_form_cols); |
|
99 | - } else { |
|
100 | - $col_id = $form_col->field_key; |
|
101 | - if ( $form_col->form_id != $form_id ) { |
|
102 | - $col_id .= '-_-form'. $form_col->form_id; |
|
103 | - } |
|
104 | - |
|
105 | - if ( isset($form_col->field_options['separate_value']) && $form_col->field_options['separate_value'] ) { |
|
106 | - $columns[ $form_id .'_frmsep_'. $col_id ] = FrmAppHelper::truncate( $form_col->name, 35 ); |
|
107 | - } |
|
108 | - $columns[ $form_id .'_'. $col_id ] = FrmAppHelper::truncate( $form_col->name, 35 ); |
|
109 | - } |
|
110 | - } |
|
111 | - |
|
112 | - $columns[ $form_id .'_created_at' ] = __( 'Entry creation date', 'formidable' ); |
|
113 | - $columns[ $form_id .'_updated_at' ] = __( 'Entry update date', 'formidable' ); |
|
114 | - $columns[ $form_id .'_ip' ] = 'IP'; |
|
115 | - |
|
116 | - $frm_vars['cols'] = $columns; |
|
95 | + unset($sub_form_col); |
|
96 | + } |
|
97 | + } |
|
98 | + unset($sub_form_cols); |
|
99 | + } else { |
|
100 | + $col_id = $form_col->field_key; |
|
101 | + if ( $form_col->form_id != $form_id ) { |
|
102 | + $col_id .= '-_-form'. $form_col->form_id; |
|
103 | + } |
|
104 | + |
|
105 | + if ( isset($form_col->field_options['separate_value']) && $form_col->field_options['separate_value'] ) { |
|
106 | + $columns[ $form_id .'_frmsep_'. $col_id ] = FrmAppHelper::truncate( $form_col->name, 35 ); |
|
107 | + } |
|
108 | + $columns[ $form_id .'_'. $col_id ] = FrmAppHelper::truncate( $form_col->name, 35 ); |
|
109 | + } |
|
110 | + } |
|
111 | + |
|
112 | + $columns[ $form_id .'_created_at' ] = __( 'Entry creation date', 'formidable' ); |
|
113 | + $columns[ $form_id .'_updated_at' ] = __( 'Entry update date', 'formidable' ); |
|
114 | + $columns[ $form_id .'_ip' ] = 'IP'; |
|
115 | + |
|
116 | + $frm_vars['cols'] = $columns; |
|
117 | 117 | |
118 | 118 | $action = FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' ); |
119 | 119 | if ( FrmAppHelper::is_admin_page( 'formidable-entries' ) && in_array( $action, array( '', 'list', 'destroy' ) ) ) { |
120 | 120 | add_screen_option( 'per_page', array( 'label' => __( 'Entries', 'formidable' ), 'default' => 20, 'option' => 'formidable_page_formidable_entries_per_page' ) ); |
121 | - } |
|
121 | + } |
|
122 | 122 | |
123 | - return $columns; |
|
124 | - } |
|
123 | + return $columns; |
|
124 | + } |
|
125 | 125 | |
126 | 126 | public static function check_hidden_cols( $check, $object_id, $meta_key, $meta_value, $prev_value ) { |
127 | - $frm_settings = FrmAppHelper::get_settings(); |
|
128 | - if ( $meta_key != 'manage'. sanitize_title($frm_settings->menu) .'_page_formidable-entriescolumnshidden' || $meta_value == $prev_value ) { |
|
129 | - return $check; |
|
130 | - } |
|
127 | + $frm_settings = FrmAppHelper::get_settings(); |
|
128 | + if ( $meta_key != 'manage'. sanitize_title($frm_settings->menu) .'_page_formidable-entriescolumnshidden' || $meta_value == $prev_value ) { |
|
129 | + return $check; |
|
130 | + } |
|
131 | 131 | |
132 | 132 | if ( empty( $prev_value ) ) { |
133 | 133 | $prev_value = get_metadata( 'user', $object_id, $meta_key, true ); |
134 | 134 | } |
135 | 135 | |
136 | - global $frm_vars; |
|
137 | - //add a check so we don't create a loop |
|
138 | - $frm_vars['prev_hidden_cols'] = ( isset($frm_vars['prev_hidden_cols']) && $frm_vars['prev_hidden_cols'] ) ? false : $prev_value; |
|
136 | + global $frm_vars; |
|
137 | + //add a check so we don't create a loop |
|
138 | + $frm_vars['prev_hidden_cols'] = ( isset($frm_vars['prev_hidden_cols']) && $frm_vars['prev_hidden_cols'] ) ? false : $prev_value; |
|
139 | 139 | |
140 | - return $check; |
|
141 | - } |
|
140 | + return $check; |
|
141 | + } |
|
142 | 142 | |
143 | - //add hidden columns back from other forms |
|
143 | + //add hidden columns back from other forms |
|
144 | 144 | public static function update_hidden_cols( $meta_id, $object_id, $meta_key, $meta_value ) { |
145 | - $frm_settings = FrmAppHelper::get_settings(); |
|
146 | - |
|
147 | - $sanitized = sanitize_title($frm_settings->menu); |
|
148 | - if ( $meta_key != 'manage'. $sanitized .'_page_formidable-entriescolumnshidden' ) { |
|
149 | - return; |
|
150 | - } |
|
151 | - |
|
152 | - global $frm_vars; |
|
153 | - if ( ! isset($frm_vars['prev_hidden_cols']) || ! $frm_vars['prev_hidden_cols'] ) { |
|
154 | - return; //don't continue if there's no previous value |
|
155 | - } |
|
156 | - |
|
157 | - foreach ( $meta_value as $mk => $mv ) { |
|
158 | - //remove blank values |
|
159 | - if ( empty( $mv ) ) { |
|
160 | - unset( $meta_value[ $mk ] ); |
|
161 | - } |
|
162 | - } |
|
163 | - |
|
164 | - $cur_form_prefix = reset($meta_value); |
|
165 | - $cur_form_prefix = explode('_', $cur_form_prefix); |
|
166 | - $cur_form_prefix = $cur_form_prefix[0]; |
|
167 | - $save = false; |
|
168 | - |
|
169 | - foreach ( (array) $frm_vars['prev_hidden_cols'] as $prev_hidden ) { |
|
145 | + $frm_settings = FrmAppHelper::get_settings(); |
|
146 | + |
|
147 | + $sanitized = sanitize_title($frm_settings->menu); |
|
148 | + if ( $meta_key != 'manage'. $sanitized .'_page_formidable-entriescolumnshidden' ) { |
|
149 | + return; |
|
150 | + } |
|
151 | + |
|
152 | + global $frm_vars; |
|
153 | + if ( ! isset($frm_vars['prev_hidden_cols']) || ! $frm_vars['prev_hidden_cols'] ) { |
|
154 | + return; //don't continue if there's no previous value |
|
155 | + } |
|
156 | + |
|
157 | + foreach ( $meta_value as $mk => $mv ) { |
|
158 | + //remove blank values |
|
159 | + if ( empty( $mv ) ) { |
|
160 | + unset( $meta_value[ $mk ] ); |
|
161 | + } |
|
162 | + } |
|
163 | + |
|
164 | + $cur_form_prefix = reset($meta_value); |
|
165 | + $cur_form_prefix = explode('_', $cur_form_prefix); |
|
166 | + $cur_form_prefix = $cur_form_prefix[0]; |
|
167 | + $save = false; |
|
168 | + |
|
169 | + foreach ( (array) $frm_vars['prev_hidden_cols'] as $prev_hidden ) { |
|
170 | 170 | if ( empty( $prev_hidden ) || in_array( $prev_hidden, $meta_value ) ) { |
171 | - //don't add blank cols or process included cols |
|
172 | - continue; |
|
173 | - } |
|
171 | + //don't add blank cols or process included cols |
|
172 | + continue; |
|
173 | + } |
|
174 | 174 | |
175 | 175 | $form_prefix = explode( '_', $prev_hidden ); |
176 | - $form_prefix = $form_prefix[0]; |
|
177 | - if ( $form_prefix == $cur_form_prefix ) { |
|
178 | - //don't add back columns that are meant to be hidden |
|
179 | - continue; |
|
180 | - } |
|
176 | + $form_prefix = $form_prefix[0]; |
|
177 | + if ( $form_prefix == $cur_form_prefix ) { |
|
178 | + //don't add back columns that are meant to be hidden |
|
179 | + continue; |
|
180 | + } |
|
181 | 181 | |
182 | - $meta_value[] = $prev_hidden; |
|
183 | - $save = true; |
|
184 | - unset($form_prefix); |
|
185 | - } |
|
182 | + $meta_value[] = $prev_hidden; |
|
183 | + $save = true; |
|
184 | + unset($form_prefix); |
|
185 | + } |
|
186 | 186 | |
187 | 187 | if ( $save ) { |
188 | - $user = wp_get_current_user(); |
|
189 | - update_user_option( $user->ID, 'manage'. $sanitized .'_page_formidable-entriescolumnshidden', $meta_value, true ); |
|
190 | - } |
|
191 | - } |
|
188 | + $user = wp_get_current_user(); |
|
189 | + update_user_option( $user->ID, 'manage'. $sanitized .'_page_formidable-entriescolumnshidden', $meta_value, true ); |
|
190 | + } |
|
191 | + } |
|
192 | 192 | |
193 | 193 | public static function save_per_page( $save, $option, $value ) { |
194 | - if ( $option == 'formidable_page_formidable_entries_per_page' ) { |
|
195 | - $save = (int) $value; |
|
196 | - } |
|
197 | - return $save; |
|
198 | - } |
|
194 | + if ( $option == 'formidable_page_formidable_entries_per_page' ) { |
|
195 | + $save = (int) $value; |
|
196 | + } |
|
197 | + return $save; |
|
198 | + } |
|
199 | 199 | |
200 | 200 | public static function sortable_columns() { |
201 | 201 | $form_id = FrmForm::get_current_form_id(); |
@@ -221,226 +221,226 @@ discard block |
||
221 | 221 | } |
222 | 222 | |
223 | 223 | public static function hidden_columns( $result ) { |
224 | - global $frm_vars; |
|
224 | + global $frm_vars; |
|
225 | 225 | |
226 | 226 | $form_id = FrmForm::get_current_form_id(); |
227 | 227 | |
228 | - $return = false; |
|
229 | - foreach ( (array) $result as $r ) { |
|
230 | - if ( ! empty( $r ) ) { |
|
231 | - $form_prefix = explode( '_', $r ); |
|
232 | - $form_prefix = $form_prefix[0]; |
|
228 | + $return = false; |
|
229 | + foreach ( (array) $result as $r ) { |
|
230 | + if ( ! empty( $r ) ) { |
|
231 | + $form_prefix = explode( '_', $r ); |
|
232 | + $form_prefix = $form_prefix[0]; |
|
233 | 233 | |
234 | - if ( (int) $form_prefix == (int) $form_id ) { |
|
235 | - $return = true; |
|
236 | - break; |
|
237 | - } |
|
234 | + if ( (int) $form_prefix == (int) $form_id ) { |
|
235 | + $return = true; |
|
236 | + break; |
|
237 | + } |
|
238 | 238 | |
239 | - unset($form_prefix); |
|
240 | - } |
|
241 | - } |
|
239 | + unset($form_prefix); |
|
240 | + } |
|
241 | + } |
|
242 | 242 | |
243 | - if ( $return ) { |
|
243 | + if ( $return ) { |
|
244 | 244 | return $result; |
245 | 245 | } |
246 | 246 | |
247 | - $i = isset($frm_vars['cols']) ? count($frm_vars['cols']) : 0; |
|
248 | - $max_columns = 8; |
|
249 | - if ( $i <= $max_columns ) { |
|
247 | + $i = isset($frm_vars['cols']) ? count($frm_vars['cols']) : 0; |
|
248 | + $max_columns = 8; |
|
249 | + if ( $i <= $max_columns ) { |
|
250 | 250 | return $result; |
251 | 251 | } |
252 | 252 | |
253 | - global $frm_vars; |
|
254 | - if ( isset($frm_vars['current_form']) && $frm_vars['current_form'] ) { |
|
255 | - $frm_vars['current_form']->options = maybe_unserialize($frm_vars['current_form']->options); |
|
256 | - } |
|
253 | + global $frm_vars; |
|
254 | + if ( isset($frm_vars['current_form']) && $frm_vars['current_form'] ) { |
|
255 | + $frm_vars['current_form']->options = maybe_unserialize($frm_vars['current_form']->options); |
|
256 | + } |
|
257 | 257 | |
258 | - if ( isset($frm_vars['current_form']) && $frm_vars['current_form'] && isset($frm_vars['current_form']->options['hidden_cols']) && ! empty($frm_vars['current_form']->options['hidden_cols']) ) { |
|
259 | - $result = $frm_vars['current_form']->options['hidden_cols']; |
|
260 | - } else { |
|
261 | - $cols = $frm_vars['cols']; |
|
262 | - $cols = array_reverse($cols, true); |
|
258 | + if ( isset($frm_vars['current_form']) && $frm_vars['current_form'] && isset($frm_vars['current_form']->options['hidden_cols']) && ! empty($frm_vars['current_form']->options['hidden_cols']) ) { |
|
259 | + $result = $frm_vars['current_form']->options['hidden_cols']; |
|
260 | + } else { |
|
261 | + $cols = $frm_vars['cols']; |
|
262 | + $cols = array_reverse($cols, true); |
|
263 | 263 | |
264 | - $result[] = $form_id .'_id'; |
|
265 | - $i--; |
|
264 | + $result[] = $form_id .'_id'; |
|
265 | + $i--; |
|
266 | 266 | |
267 | - $result[] = $form_id .'_item_key'; |
|
268 | - $i--; |
|
267 | + $result[] = $form_id .'_item_key'; |
|
268 | + $i--; |
|
269 | 269 | |
270 | 270 | foreach ( $cols as $col_key => $col ) { |
271 | - if ( $i > $max_columns ) { |
|
271 | + if ( $i > $max_columns ) { |
|
272 | 272 | $result[] = $col_key; |
273 | 273 | } |
274 | - //remove some columns by default |
|
275 | - $i--; |
|
276 | - unset($col_key, $col); |
|
277 | - } |
|
278 | - } |
|
274 | + //remove some columns by default |
|
275 | + $i--; |
|
276 | + unset($col_key, $col); |
|
277 | + } |
|
278 | + } |
|
279 | 279 | |
280 | - return $result; |
|
281 | - } |
|
280 | + return $result; |
|
281 | + } |
|
282 | 282 | |
283 | 283 | public static function display_list( $message = '', $errors = array() ) { |
284 | - global $wpdb, $frm_vars; |
|
284 | + global $wpdb, $frm_vars; |
|
285 | 285 | |
286 | 286 | $form = FrmForm::get_current_form(); |
287 | 287 | $params = FrmForm::get_admin_params( $form ); |
288 | 288 | |
289 | - if ( $form ) { |
|
290 | - $params['form'] = $form->id; |
|
291 | - $frm_vars['current_form'] = $form; |
|
289 | + if ( $form ) { |
|
290 | + $params['form'] = $form->id; |
|
291 | + $frm_vars['current_form'] = $form; |
|
292 | 292 | |
293 | - if ( 'trash' == $form->status ) { |
|
294 | - $delete_timestamp = time() - ( DAY_IN_SECONDS * EMPTY_TRASH_DAYS ); |
|
295 | - $time_to_delete = FrmAppHelper::human_time_diff( $delete_timestamp, ( isset( $form->options['trash_time'] ) ? ( $form->options['trash_time'] ) : time() ) ); |
|
296 | - $errors['trash'] = sprintf( __( 'This form is in the trash and is scheduled to be deleted permanently in %s along with any entries.', 'formidable' ), $time_to_delete ); |
|
297 | - unset( $time_to_delete, $delete_timestamp ); |
|
298 | - } |
|
293 | + if ( 'trash' == $form->status ) { |
|
294 | + $delete_timestamp = time() - ( DAY_IN_SECONDS * EMPTY_TRASH_DAYS ); |
|
295 | + $time_to_delete = FrmAppHelper::human_time_diff( $delete_timestamp, ( isset( $form->options['trash_time'] ) ? ( $form->options['trash_time'] ) : time() ) ); |
|
296 | + $errors['trash'] = sprintf( __( 'This form is in the trash and is scheduled to be deleted permanently in %s along with any entries.', 'formidable' ), $time_to_delete ); |
|
297 | + unset( $time_to_delete, $delete_timestamp ); |
|
298 | + } |
|
299 | 299 | } |
300 | 300 | |
301 | - $table_class = apply_filters( 'frm_entries_list_class', 'FrmEntriesListHelper' ); |
|
301 | + $table_class = apply_filters( 'frm_entries_list_class', 'FrmEntriesListHelper' ); |
|
302 | 302 | |
303 | - $wp_list_table = new $table_class( array( 'params' => $params ) ); |
|
303 | + $wp_list_table = new $table_class( array( 'params' => $params ) ); |
|
304 | 304 | |
305 | - $pagenum = $wp_list_table->get_pagenum(); |
|
305 | + $pagenum = $wp_list_table->get_pagenum(); |
|
306 | 306 | |
307 | - $wp_list_table->prepare_items(); |
|
307 | + $wp_list_table->prepare_items(); |
|
308 | 308 | |
309 | - $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' ); |
|
310 | - if ( $pagenum > $total_pages && $total_pages > 0 ) { |
|
309 | + $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' ); |
|
310 | + if ( $pagenum > $total_pages && $total_pages > 0 ) { |
|
311 | 311 | $url = add_query_arg( 'paged', $total_pages ); |
312 | - if ( headers_sent() ) { |
|
313 | - echo FrmAppHelper::js_redirect($url); |
|
314 | - } else { |
|
315 | - wp_redirect( esc_url_raw( $url ) ); |
|
316 | - } |
|
317 | - die(); |
|
318 | - } |
|
319 | - |
|
320 | - if ( empty($message) && isset($_GET['import-message']) ) { |
|
321 | - $message = __( 'Your import is complete', 'formidable' ); |
|
322 | - } |
|
323 | - |
|
324 | - require(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/list.php'); |
|
325 | - } |
|
326 | - |
|
327 | - /* Back End CRUD */ |
|
312 | + if ( headers_sent() ) { |
|
313 | + echo FrmAppHelper::js_redirect($url); |
|
314 | + } else { |
|
315 | + wp_redirect( esc_url_raw( $url ) ); |
|
316 | + } |
|
317 | + die(); |
|
318 | + } |
|
319 | + |
|
320 | + if ( empty($message) && isset($_GET['import-message']) ) { |
|
321 | + $message = __( 'Your import is complete', 'formidable' ); |
|
322 | + } |
|
323 | + |
|
324 | + require(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/list.php'); |
|
325 | + } |
|
326 | + |
|
327 | + /* Back End CRUD */ |
|
328 | 328 | public static function show( $id = 0 ) { |
329 | - FrmAppHelper::permission_check('frm_view_entries'); |
|
329 | + FrmAppHelper::permission_check('frm_view_entries'); |
|
330 | 330 | |
331 | - if ( ! $id ) { |
|
331 | + if ( ! $id ) { |
|
332 | 332 | $id = FrmAppHelper::get_param( 'id', 0, 'get', 'absint' ); |
333 | 333 | |
334 | - if ( ! $id ) { |
|
334 | + if ( ! $id ) { |
|
335 | 335 | $id = FrmAppHelper::get_param( 'item_id', 0, 'get', 'absint' ); |
336 | - } |
|
337 | - } |
|
336 | + } |
|
337 | + } |
|
338 | 338 | |
339 | - $entry = FrmEntry::getOne($id, true); |
|
339 | + $entry = FrmEntry::getOne($id, true); |
|
340 | 340 | |
341 | - $data = maybe_unserialize($entry->description); |
|
341 | + $data = maybe_unserialize($entry->description); |
|
342 | 342 | if ( ! is_array( $data ) || ! isset( $data['referrer'] ) ) { |
343 | 343 | $data = array( 'referrer' => $data ); |
344 | 344 | } |
345 | 345 | |
346 | 346 | $fields = FrmField::get_all_for_form( $entry->form_id, '', 'include' ); |
347 | - $to_emails = array(); |
|
347 | + $to_emails = array(); |
|
348 | 348 | |
349 | - include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/show.php'); |
|
350 | - } |
|
349 | + include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/show.php'); |
|
350 | + } |
|
351 | 351 | |
352 | - public static function destroy() { |
|
353 | - FrmAppHelper::permission_check('frm_delete_entries'); |
|
352 | + public static function destroy() { |
|
353 | + FrmAppHelper::permission_check('frm_delete_entries'); |
|
354 | 354 | |
355 | 355 | $params = FrmForm::get_admin_params(); |
356 | 356 | |
357 | - if ( isset($params['keep_post']) && $params['keep_post'] ) { |
|
358 | - //unlink entry from post |
|
359 | - global $wpdb; |
|
357 | + if ( isset($params['keep_post']) && $params['keep_post'] ) { |
|
358 | + //unlink entry from post |
|
359 | + global $wpdb; |
|
360 | 360 | $wpdb->update( $wpdb->prefix .'frm_items', array( 'post_id' => '' ), array( 'id' => $params['id'] ) ); |
361 | - } |
|
361 | + } |
|
362 | 362 | |
363 | - $message = ''; |
|
364 | - if ( FrmEntry::destroy( $params['id'] ) ) { |
|
365 | - $message = __( 'Entry was Successfully Destroyed', 'formidable' ); |
|
366 | - } |
|
363 | + $message = ''; |
|
364 | + if ( FrmEntry::destroy( $params['id'] ) ) { |
|
365 | + $message = __( 'Entry was Successfully Destroyed', 'formidable' ); |
|
366 | + } |
|
367 | 367 | |
368 | - self::display_list( $message ); |
|
369 | - } |
|
368 | + self::display_list( $message ); |
|
369 | + } |
|
370 | 370 | |
371 | - public static function destroy_all() { |
|
372 | - if ( ! current_user_can( 'frm_delete_entries' ) ) { |
|
373 | - $frm_settings = FrmAppHelper::get_settings(); |
|
374 | - wp_die( $frm_settings->admin_permission ); |
|
375 | - } |
|
371 | + public static function destroy_all() { |
|
372 | + if ( ! current_user_can( 'frm_delete_entries' ) ) { |
|
373 | + $frm_settings = FrmAppHelper::get_settings(); |
|
374 | + wp_die( $frm_settings->admin_permission ); |
|
375 | + } |
|
376 | 376 | |
377 | - global $wpdb; |
|
377 | + global $wpdb; |
|
378 | 378 | $params = FrmForm::get_admin_params(); |
379 | - $message = ''; |
|
380 | - $errors = array(); |
|
381 | - $form_id = (int) $params['form']; |
|
379 | + $message = ''; |
|
380 | + $errors = array(); |
|
381 | + $form_id = (int) $params['form']; |
|
382 | 382 | |
383 | - if ( $form_id ) { |
|
384 | - $entry_ids = FrmDb::get_col( 'frm_items', array( 'form_id' => $form_id ) ); |
|
383 | + if ( $form_id ) { |
|
384 | + $entry_ids = FrmDb::get_col( 'frm_items', array( 'form_id' => $form_id ) ); |
|
385 | 385 | $action = FrmFormAction::get_action_for_form( $form_id, 'wppost', 1 ); |
386 | 386 | |
387 | - if ( $action ) { |
|
388 | - // this action takes a while, so only trigger it if there are posts to delete |
|
389 | - foreach ( $entry_ids as $entry_id ) { |
|
390 | - do_action( 'frm_before_destroy_entry', $entry_id ); |
|
391 | - unset( $entry_id ); |
|
392 | - } |
|
393 | - } |
|
394 | - |
|
395 | - $wpdb->query( $wpdb->prepare( "DELETE em.* FROM {$wpdb->prefix}frm_item_metas as em INNER JOIN {$wpdb->prefix}frm_items as e on (em.item_id=e.id) and form_id=%d", $form_id ) ); |
|
396 | - $results = $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->prefix}frm_items WHERE form_id=%d", $form_id ) ); |
|
397 | - if ( $results ) { |
|
398 | - $message = __( 'Entries were Successfully Destroyed', 'formidable' ); |
|
399 | - } |
|
400 | - } else { |
|
401 | - $errors = __( 'No entries were specified', 'formidable' ); |
|
402 | - } |
|
403 | - |
|
404 | - self::display_list( $message, $errors ); |
|
405 | - } |
|
406 | - |
|
407 | - public static function show_form( $id = '', $key = '', $title = false, $description = false ) { |
|
408 | - _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::show_form()' ); |
|
409 | - return FrmFormsController::show_form( $id, $key, $title, $description ); |
|
410 | - } |
|
411 | - |
|
412 | - public static function get_form( $filename, $form, $title, $description ) { |
|
413 | - _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::get_form()' ); |
|
414 | - return FrmFormsController::get_form( $form, $title, $description ); |
|
415 | - } |
|
416 | - |
|
417 | - public static function process_entry( $errors = '', $ajax = false ) { |
|
387 | + if ( $action ) { |
|
388 | + // this action takes a while, so only trigger it if there are posts to delete |
|
389 | + foreach ( $entry_ids as $entry_id ) { |
|
390 | + do_action( 'frm_before_destroy_entry', $entry_id ); |
|
391 | + unset( $entry_id ); |
|
392 | + } |
|
393 | + } |
|
394 | + |
|
395 | + $wpdb->query( $wpdb->prepare( "DELETE em.* FROM {$wpdb->prefix}frm_item_metas as em INNER JOIN {$wpdb->prefix}frm_items as e on (em.item_id=e.id) and form_id=%d", $form_id ) ); |
|
396 | + $results = $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->prefix}frm_items WHERE form_id=%d", $form_id ) ); |
|
397 | + if ( $results ) { |
|
398 | + $message = __( 'Entries were Successfully Destroyed', 'formidable' ); |
|
399 | + } |
|
400 | + } else { |
|
401 | + $errors = __( 'No entries were specified', 'formidable' ); |
|
402 | + } |
|
403 | + |
|
404 | + self::display_list( $message, $errors ); |
|
405 | + } |
|
406 | + |
|
407 | + public static function show_form( $id = '', $key = '', $title = false, $description = false ) { |
|
408 | + _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::show_form()' ); |
|
409 | + return FrmFormsController::show_form( $id, $key, $title, $description ); |
|
410 | + } |
|
411 | + |
|
412 | + public static function get_form( $filename, $form, $title, $description ) { |
|
413 | + _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::get_form()' ); |
|
414 | + return FrmFormsController::get_form( $form, $title, $description ); |
|
415 | + } |
|
416 | + |
|
417 | + public static function process_entry( $errors = '', $ajax = false ) { |
|
418 | 418 | $form_id = FrmAppHelper::get_post_param( 'form_id', '', 'absint' ); |
419 | 419 | if ( FrmAppHelper::is_admin() || empty( $_POST ) || empty( $form_id ) || ! isset( $_POST['item_key'] ) ) { |
420 | - return; |
|
421 | - } |
|
420 | + return; |
|
421 | + } |
|
422 | 422 | |
423 | - global $frm_vars; |
|
423 | + global $frm_vars; |
|
424 | 424 | |
425 | 425 | $form = FrmForm::getOne( $form_id ); |
426 | - if ( ! $form ) { |
|
427 | - return; |
|
428 | - } |
|
426 | + if ( ! $form ) { |
|
427 | + return; |
|
428 | + } |
|
429 | 429 | |
430 | 430 | $params = FrmForm::get_params( $form ); |
431 | 431 | |
432 | - if ( ! isset( $frm_vars['form_params'] ) ) { |
|
433 | - $frm_vars['form_params'] = array(); |
|
434 | - } |
|
432 | + if ( ! isset( $frm_vars['form_params'] ) ) { |
|
433 | + $frm_vars['form_params'] = array(); |
|
434 | + } |
|
435 | 435 | $frm_vars['form_params'][ $form->id ] = $params; |
436 | 436 | |
437 | 437 | if ( isset( $frm_vars['created_entries'][ $form_id ] ) ) { |
438 | - return; |
|
439 | - } |
|
438 | + return; |
|
439 | + } |
|
440 | 440 | |
441 | - if ( $errors == '' ) { |
|
441 | + if ( $errors == '' ) { |
|
442 | 442 | $errors = FrmEntryValidate::validate( $_POST ); |
443 | - } |
|
443 | + } |
|
444 | 444 | |
445 | 445 | /** |
446 | 446 | * Use this filter to add trigger actions and add errors after |
@@ -451,102 +451,102 @@ discard block |
||
451 | 451 | |
452 | 452 | $frm_vars['created_entries'][ $form_id ] = array( 'errors' => $errors ); |
453 | 453 | |
454 | - if ( empty( $errors ) ) { |
|
454 | + if ( empty( $errors ) ) { |
|
455 | 455 | $_POST['frm_skip_cookie'] = 1; |
456 | - if ( $params['action'] == 'create' ) { |
|
456 | + if ( $params['action'] == 'create' ) { |
|
457 | 457 | if ( apply_filters( 'frm_continue_to_create', true, $form_id ) && ! isset( $frm_vars['created_entries'][ $form_id ]['entry_id'] ) ) { |
458 | 458 | $frm_vars['created_entries'][ $form_id ]['entry_id'] = FrmEntry::create( $_POST ); |
459 | - } |
|
460 | - } |
|
459 | + } |
|
460 | + } |
|
461 | 461 | |
462 | - do_action( 'frm_process_entry', $params, $errors, $form, array( 'ajax' => $ajax ) ); |
|
462 | + do_action( 'frm_process_entry', $params, $errors, $form, array( 'ajax' => $ajax ) ); |
|
463 | 463 | unset( $_POST['frm_skip_cookie'] ); |
464 | - } |
|
465 | - } |
|
466 | - |
|
467 | - public static function delete_entry_before_redirect( $url, $form, $atts ) { |
|
468 | - self::_delete_entry( $atts['id'], $form ); |
|
469 | - return $url; |
|
470 | - } |
|
471 | - |
|
472 | - //Delete entry if not redirected |
|
473 | - public static function delete_entry_after_save( $atts ) { |
|
474 | - self::_delete_entry( $atts['entry_id'], $atts['form'] ); |
|
475 | - } |
|
476 | - |
|
477 | - private static function _delete_entry( $entry_id, $form ) { |
|
478 | - if ( ! $form ) { |
|
479 | - return; |
|
480 | - } |
|
481 | - |
|
482 | - $form->options = maybe_unserialize( $form->options ); |
|
483 | - if ( isset( $form->options['no_save'] ) && $form->options['no_save'] ) { |
|
484 | - FrmEntry::destroy( $entry_id ); |
|
485 | - } |
|
486 | - } |
|
464 | + } |
|
465 | + } |
|
466 | + |
|
467 | + public static function delete_entry_before_redirect( $url, $form, $atts ) { |
|
468 | + self::_delete_entry( $atts['id'], $form ); |
|
469 | + return $url; |
|
470 | + } |
|
471 | + |
|
472 | + //Delete entry if not redirected |
|
473 | + public static function delete_entry_after_save( $atts ) { |
|
474 | + self::_delete_entry( $atts['entry_id'], $atts['form'] ); |
|
475 | + } |
|
476 | + |
|
477 | + private static function _delete_entry( $entry_id, $form ) { |
|
478 | + if ( ! $form ) { |
|
479 | + return; |
|
480 | + } |
|
481 | + |
|
482 | + $form->options = maybe_unserialize( $form->options ); |
|
483 | + if ( isset( $form->options['no_save'] ) && $form->options['no_save'] ) { |
|
484 | + FrmEntry::destroy( $entry_id ); |
|
485 | + } |
|
486 | + } |
|
487 | 487 | |
488 | 488 | public static function show_entry_shortcode( $atts ) { |
489 | 489 | return FrmEntryFormat::show_entry( $atts ); |
490 | 490 | } |
491 | 491 | |
492 | - public static function &filter_email_value( $value, $meta, $entry, $atts = array() ) { |
|
493 | - $field = FrmField::getOne($meta->field_id); |
|
494 | - if ( ! $field ) { |
|
495 | - return $value; |
|
496 | - } |
|
492 | + public static function &filter_email_value( $value, $meta, $entry, $atts = array() ) { |
|
493 | + $field = FrmField::getOne($meta->field_id); |
|
494 | + if ( ! $field ) { |
|
495 | + return $value; |
|
496 | + } |
|
497 | 497 | |
498 | - $value = self::filter_display_value($value, $field, $atts); |
|
499 | - return $value; |
|
500 | - } |
|
498 | + $value = self::filter_display_value($value, $field, $atts); |
|
499 | + return $value; |
|
500 | + } |
|
501 | 501 | |
502 | 502 | public static function &filter_shortcode_value( $value, $tag, $atts, $field ) { |
503 | - $plain_text = add_filter('frm_plain_text_email', true); |
|
503 | + $plain_text = add_filter('frm_plain_text_email', true); |
|
504 | 504 | FrmEntryFormat::textarea_display_value( $field->type, $plain_text, $value ); |
505 | 505 | |
506 | - if ( isset($atts['show']) && $atts['show'] == 'value' ) { |
|
507 | - return $value; |
|
508 | - } |
|
506 | + if ( isset($atts['show']) && $atts['show'] == 'value' ) { |
|
507 | + return $value; |
|
508 | + } |
|
509 | 509 | |
510 | - return self::filter_display_value($value, $field, $atts); |
|
511 | - } |
|
510 | + return self::filter_display_value($value, $field, $atts); |
|
511 | + } |
|
512 | 512 | |
513 | - public static function &filter_display_value( $value, $field, $atts = array() ) { |
|
514 | - $saved_value = ( isset($atts['saved_value']) && $atts['saved_value'] ) ? true : false; |
|
513 | + public static function &filter_display_value( $value, $field, $atts = array() ) { |
|
514 | + $saved_value = ( isset($atts['saved_value']) && $atts['saved_value'] ) ? true : false; |
|
515 | 515 | if ( ! in_array( $field->type, array( 'radio', 'checkbox', 'radio', 'select' ) ) || ! FrmField::is_option_true( $field, 'separate_value' ) || $saved_value ) { |
516 | - return $value; |
|
517 | - } |
|
518 | - |
|
519 | - $f_values = $f_labels = array(); |
|
520 | - |
|
521 | - foreach ( $field->options as $opt_key => $opt ) { |
|
522 | - if ( ! is_array($opt) ) { |
|
523 | - continue; |
|
524 | - } |
|
525 | - |
|
526 | - $f_labels[ $opt_key ] = isset( $opt['label'] ) ? $opt['label'] : reset($opt); |
|
527 | - $f_values[ $opt_key ] = isset( $opt['value'] ) ? $opt['value'] : $f_labels[ $opt_key ]; |
|
528 | - if ( $f_labels[ $opt_key ] == $f_values[ $opt_key ] ) { |
|
529 | - unset( $f_values[ $opt_key ], $f_labels[ $opt_key ] ); |
|
530 | - } |
|
531 | - unset($opt_key, $opt); |
|
532 | - } |
|
533 | - |
|
534 | - if ( ! empty($f_values) ) { |
|
535 | - foreach ( (array) $value as $v_key => $val ) { |
|
536 | - if ( in_array($val, $f_values) ) { |
|
537 | - $opt = array_search($val, $f_values); |
|
538 | - if ( is_array($value) ) { |
|
539 | - $value[ $v_key ] = $f_labels[ $opt ]; |
|
540 | - } else { |
|
541 | - $value = $f_labels[ $opt ]; |
|
542 | - } |
|
543 | - } |
|
544 | - unset($v_key, $val); |
|
545 | - } |
|
546 | - } |
|
547 | - |
|
548 | - return $value; |
|
549 | - } |
|
516 | + return $value; |
|
517 | + } |
|
518 | + |
|
519 | + $f_values = $f_labels = array(); |
|
520 | + |
|
521 | + foreach ( $field->options as $opt_key => $opt ) { |
|
522 | + if ( ! is_array($opt) ) { |
|
523 | + continue; |
|
524 | + } |
|
525 | + |
|
526 | + $f_labels[ $opt_key ] = isset( $opt['label'] ) ? $opt['label'] : reset($opt); |
|
527 | + $f_values[ $opt_key ] = isset( $opt['value'] ) ? $opt['value'] : $f_labels[ $opt_key ]; |
|
528 | + if ( $f_labels[ $opt_key ] == $f_values[ $opt_key ] ) { |
|
529 | + unset( $f_values[ $opt_key ], $f_labels[ $opt_key ] ); |
|
530 | + } |
|
531 | + unset($opt_key, $opt); |
|
532 | + } |
|
533 | + |
|
534 | + if ( ! empty($f_values) ) { |
|
535 | + foreach ( (array) $value as $v_key => $val ) { |
|
536 | + if ( in_array($val, $f_values) ) { |
|
537 | + $opt = array_search($val, $f_values); |
|
538 | + if ( is_array($value) ) { |
|
539 | + $value[ $v_key ] = $f_labels[ $opt ]; |
|
540 | + } else { |
|
541 | + $value = $f_labels[ $opt ]; |
|
542 | + } |
|
543 | + } |
|
544 | + unset($v_key, $val); |
|
545 | + } |
|
546 | + } |
|
547 | + |
|
548 | + return $value; |
|
549 | + } |
|
550 | 550 | |
551 | 551 | public static function get_params( $form = null ) { |
552 | 552 | _deprecated_function( __FUNCTION__, '2.0.9', 'FrmForm::get_params' ); |
@@ -554,13 +554,13 @@ discard block |
||
554 | 554 | } |
555 | 555 | |
556 | 556 | public static function entry_sidebar( $entry ) { |
557 | - $data = maybe_unserialize($entry->description); |
|
558 | - $date_format = get_option('date_format'); |
|
559 | - $time_format = get_option('time_format'); |
|
557 | + $data = maybe_unserialize($entry->description); |
|
558 | + $date_format = get_option('date_format'); |
|
559 | + $time_format = get_option('time_format'); |
|
560 | 560 | if ( isset( $data['browser'] ) ) { |
561 | 561 | $browser = FrmEntryFormat::get_browser( $data['browser'] ); |
562 | 562 | } |
563 | 563 | |
564 | - include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/sidebar-shared.php'); |
|
565 | - } |
|
564 | + include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/sidebar-shared.php'); |
|
565 | + } |
|
566 | 566 | } |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | public static function menu() { |
6 | 6 | FrmAppHelper::force_capability( 'frm_view_entries' ); |
7 | 7 | |
8 | - add_submenu_page('formidable', 'Formidable | '. __( 'Entries', 'formidable' ), __( 'Entries', 'formidable' ), 'frm_view_entries', 'formidable-entries', 'FrmEntriesController::route' ); |
|
8 | + add_submenu_page( 'formidable', 'Formidable | ' . __( 'Entries', 'formidable' ), __( 'Entries', 'formidable' ), 'frm_view_entries', 'formidable-entries', 'FrmEntriesController::route' ); |
|
9 | 9 | |
10 | 10 | if ( ! in_array( FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' ), array( 'edit', 'show' ) ) ) { |
11 | 11 | $frm_settings = FrmAppHelper::get_settings(); |
@@ -52,13 +52,13 @@ discard block |
||
52 | 52 | $screen->add_help_tab( array( |
53 | 53 | 'id' => 'formidable-entries-tab', |
54 | 54 | 'title' => __( 'Overview', 'formidable' ), |
55 | - 'content' => '<p>' . esc_html__( 'This screen provides access to all of your entries. You can customize the display of this screen to suit your workflow.', 'formidable' ) .'</p> <p>'. esc_html__( 'Hovering over a row in the entries list will display action links that allow you to manage your entry.', 'formidable' ) . '</p>', |
|
56 | - )); |
|
55 | + 'content' => '<p>' . esc_html__( 'This screen provides access to all of your entries. You can customize the display of this screen to suit your workflow.', 'formidable' ) . '</p> <p>' . esc_html__( 'Hovering over a row in the entries list will display action links that allow you to manage your entry.', 'formidable' ) . '</p>', |
|
56 | + ) ); |
|
57 | 57 | |
58 | 58 | $screen->set_help_sidebar( |
59 | 59 | '<p><strong>' . esc_html__( 'For more information:', 'formidable' ) . '</strong></p>' . |
60 | 60 | '<p><a href="' . esc_url( FrmAppHelper::make_affiliate_url( 'http://formidablepro.com/knowledgebase/manage-entries-from-the-back-end/' ) ) . '" target="_blank">' . esc_html__( 'Documentation on Entries', 'formidable' ) . '</a></p>' . |
61 | - '<p><a href="'. esc_url( FrmAppHelper::make_affiliate_url( 'http://formidablepro.com/help-desk/' ) ) . '" target="_blank">' . esc_html__( 'Support', 'formidable' ) . '</a></p>' |
|
61 | + '<p><a href="' . esc_url( FrmAppHelper::make_affiliate_url( 'http://formidablepro.com/help-desk/' ) ) . '" target="_blank">' . esc_html__( 'Support', 'formidable' ) . '</a></p>' |
|
62 | 62 | ); |
63 | 63 | |
64 | 64 | return $help; |
@@ -68,14 +68,14 @@ discard block |
||
68 | 68 | global $frm_vars, $wpdb; |
69 | 69 | $form_id = FrmForm::get_current_form_id(); |
70 | 70 | |
71 | - $columns[ $form_id .'_id' ] = 'ID'; |
|
72 | - $columns[ $form_id . '_item_key' ] = esc_html__( 'Entry Key', 'formidable' ); |
|
71 | + $columns[$form_id . '_id'] = 'ID'; |
|
72 | + $columns[$form_id . '_item_key'] = esc_html__( 'Entry Key', 'formidable' ); |
|
73 | 73 | |
74 | 74 | if ( ! $form_id ) { |
75 | 75 | return $columns; |
76 | 76 | } |
77 | 77 | |
78 | - $form_cols = FrmField::get_all_for_form($form_id, '', 'include'); |
|
78 | + $form_cols = FrmField::get_all_for_form( $form_id, '', 'include' ); |
|
79 | 79 | |
80 | 80 | foreach ( $form_cols as $form_col ) { |
81 | 81 | if ( FrmField::is_no_save_field( $form_col->type ) ) { |
@@ -88,30 +88,30 @@ discard block |
||
88 | 88 | if ( $sub_form_cols ) { |
89 | 89 | foreach ( $sub_form_cols as $k => $sub_form_col ) { |
90 | 90 | if ( FrmField::is_no_save_field( $sub_form_col->type ) ) { |
91 | - unset( $sub_form_cols[ $k ] ); |
|
91 | + unset( $sub_form_cols[$k] ); |
|
92 | 92 | continue; |
93 | 93 | } |
94 | - $columns[ $form_id . '_' . $sub_form_col->field_key . '-_-' . $form_col->id ] = FrmAppHelper::truncate( $sub_form_col->name, 35 ); |
|
95 | - unset($sub_form_col); |
|
94 | + $columns[$form_id . '_' . $sub_form_col->field_key . '-_-' . $form_col->id] = FrmAppHelper::truncate( $sub_form_col->name, 35 ); |
|
95 | + unset( $sub_form_col ); |
|
96 | 96 | } |
97 | 97 | } |
98 | - unset($sub_form_cols); |
|
98 | + unset( $sub_form_cols ); |
|
99 | 99 | } else { |
100 | 100 | $col_id = $form_col->field_key; |
101 | 101 | if ( $form_col->form_id != $form_id ) { |
102 | - $col_id .= '-_-form'. $form_col->form_id; |
|
102 | + $col_id .= '-_-form' . $form_col->form_id; |
|
103 | 103 | } |
104 | 104 | |
105 | - if ( isset($form_col->field_options['separate_value']) && $form_col->field_options['separate_value'] ) { |
|
106 | - $columns[ $form_id .'_frmsep_'. $col_id ] = FrmAppHelper::truncate( $form_col->name, 35 ); |
|
105 | + if ( isset( $form_col->field_options['separate_value'] ) && $form_col->field_options['separate_value'] ) { |
|
106 | + $columns[$form_id . '_frmsep_' . $col_id] = FrmAppHelper::truncate( $form_col->name, 35 ); |
|
107 | 107 | } |
108 | - $columns[ $form_id .'_'. $col_id ] = FrmAppHelper::truncate( $form_col->name, 35 ); |
|
108 | + $columns[$form_id . '_' . $col_id] = FrmAppHelper::truncate( $form_col->name, 35 ); |
|
109 | 109 | } |
110 | 110 | } |
111 | 111 | |
112 | - $columns[ $form_id .'_created_at' ] = __( 'Entry creation date', 'formidable' ); |
|
113 | - $columns[ $form_id .'_updated_at' ] = __( 'Entry update date', 'formidable' ); |
|
114 | - $columns[ $form_id .'_ip' ] = 'IP'; |
|
112 | + $columns[$form_id . '_created_at'] = __( 'Entry creation date', 'formidable' ); |
|
113 | + $columns[$form_id . '_updated_at'] = __( 'Entry update date', 'formidable' ); |
|
114 | + $columns[$form_id . '_ip'] = 'IP'; |
|
115 | 115 | |
116 | 116 | $frm_vars['cols'] = $columns; |
117 | 117 | |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | |
126 | 126 | public static function check_hidden_cols( $check, $object_id, $meta_key, $meta_value, $prev_value ) { |
127 | 127 | $frm_settings = FrmAppHelper::get_settings(); |
128 | - if ( $meta_key != 'manage'. sanitize_title($frm_settings->menu) .'_page_formidable-entriescolumnshidden' || $meta_value == $prev_value ) { |
|
128 | + if ( $meta_key != 'manage' . sanitize_title( $frm_settings->menu ) . '_page_formidable-entriescolumnshidden' || $meta_value == $prev_value ) { |
|
129 | 129 | return $check; |
130 | 130 | } |
131 | 131 | |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | |
136 | 136 | global $frm_vars; |
137 | 137 | //add a check so we don't create a loop |
138 | - $frm_vars['prev_hidden_cols'] = ( isset($frm_vars['prev_hidden_cols']) && $frm_vars['prev_hidden_cols'] ) ? false : $prev_value; |
|
138 | + $frm_vars['prev_hidden_cols'] = ( isset( $frm_vars['prev_hidden_cols'] ) && $frm_vars['prev_hidden_cols'] ) ? false : $prev_value; |
|
139 | 139 | |
140 | 140 | return $check; |
141 | 141 | } |
@@ -144,25 +144,25 @@ discard block |
||
144 | 144 | public static function update_hidden_cols( $meta_id, $object_id, $meta_key, $meta_value ) { |
145 | 145 | $frm_settings = FrmAppHelper::get_settings(); |
146 | 146 | |
147 | - $sanitized = sanitize_title($frm_settings->menu); |
|
148 | - if ( $meta_key != 'manage'. $sanitized .'_page_formidable-entriescolumnshidden' ) { |
|
147 | + $sanitized = sanitize_title( $frm_settings->menu ); |
|
148 | + if ( $meta_key != 'manage' . $sanitized . '_page_formidable-entriescolumnshidden' ) { |
|
149 | 149 | return; |
150 | 150 | } |
151 | 151 | |
152 | 152 | global $frm_vars; |
153 | - if ( ! isset($frm_vars['prev_hidden_cols']) || ! $frm_vars['prev_hidden_cols'] ) { |
|
153 | + if ( ! isset( $frm_vars['prev_hidden_cols'] ) || ! $frm_vars['prev_hidden_cols'] ) { |
|
154 | 154 | return; //don't continue if there's no previous value |
155 | 155 | } |
156 | 156 | |
157 | 157 | foreach ( $meta_value as $mk => $mv ) { |
158 | 158 | //remove blank values |
159 | - if ( empty( $mv ) ) { |
|
160 | - unset( $meta_value[ $mk ] ); |
|
159 | + if ( empty( $mv ) ) { |
|
160 | + unset( $meta_value[$mk] ); |
|
161 | 161 | } |
162 | 162 | } |
163 | 163 | |
164 | - $cur_form_prefix = reset($meta_value); |
|
165 | - $cur_form_prefix = explode('_', $cur_form_prefix); |
|
164 | + $cur_form_prefix = reset( $meta_value ); |
|
165 | + $cur_form_prefix = explode( '_', $cur_form_prefix ); |
|
166 | 166 | $cur_form_prefix = $cur_form_prefix[0]; |
167 | 167 | $save = false; |
168 | 168 | |
@@ -181,12 +181,12 @@ discard block |
||
181 | 181 | |
182 | 182 | $meta_value[] = $prev_hidden; |
183 | 183 | $save = true; |
184 | - unset($form_prefix); |
|
184 | + unset( $form_prefix ); |
|
185 | 185 | } |
186 | 186 | |
187 | 187 | if ( $save ) { |
188 | 188 | $user = wp_get_current_user(); |
189 | - update_user_option( $user->ID, 'manage'. $sanitized .'_page_formidable-entriescolumnshidden', $meta_value, true ); |
|
189 | + update_user_option( $user->ID, 'manage' . $sanitized . '_page_formidable-entriescolumnshidden', $meta_value, true ); |
|
190 | 190 | } |
191 | 191 | } |
192 | 192 | |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | foreach ( $fields as $field ) { |
214 | 214 | if ( $field->type != 'checkbox' && ( ! isset( $field->field_options['post_field'] ) || $field->field_options['post_field'] == '' ) ) { |
215 | 215 | // Can't sort on checkboxes because they are stored serialized, or post fields |
216 | - $columns[ $form_id . '_' . $field->field_key ] = 'meta_' . $field->id; |
|
216 | + $columns[$form_id . '_' . $field->field_key] = 'meta_' . $field->id; |
|
217 | 217 | } |
218 | 218 | } |
219 | 219 | |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | break; |
237 | 237 | } |
238 | 238 | |
239 | - unset($form_prefix); |
|
239 | + unset( $form_prefix ); |
|
240 | 240 | } |
241 | 241 | } |
242 | 242 | |
@@ -244,36 +244,36 @@ discard block |
||
244 | 244 | return $result; |
245 | 245 | } |
246 | 246 | |
247 | - $i = isset($frm_vars['cols']) ? count($frm_vars['cols']) : 0; |
|
247 | + $i = isset( $frm_vars['cols'] ) ? count( $frm_vars['cols'] ) : 0; |
|
248 | 248 | $max_columns = 8; |
249 | 249 | if ( $i <= $max_columns ) { |
250 | 250 | return $result; |
251 | 251 | } |
252 | 252 | |
253 | 253 | global $frm_vars; |
254 | - if ( isset($frm_vars['current_form']) && $frm_vars['current_form'] ) { |
|
255 | - $frm_vars['current_form']->options = maybe_unserialize($frm_vars['current_form']->options); |
|
254 | + if ( isset( $frm_vars['current_form'] ) && $frm_vars['current_form'] ) { |
|
255 | + $frm_vars['current_form']->options = maybe_unserialize( $frm_vars['current_form']->options ); |
|
256 | 256 | } |
257 | 257 | |
258 | - if ( isset($frm_vars['current_form']) && $frm_vars['current_form'] && isset($frm_vars['current_form']->options['hidden_cols']) && ! empty($frm_vars['current_form']->options['hidden_cols']) ) { |
|
258 | + if ( isset( $frm_vars['current_form'] ) && $frm_vars['current_form'] && isset( $frm_vars['current_form']->options['hidden_cols'] ) && ! empty( $frm_vars['current_form']->options['hidden_cols'] ) ) { |
|
259 | 259 | $result = $frm_vars['current_form']->options['hidden_cols']; |
260 | 260 | } else { |
261 | 261 | $cols = $frm_vars['cols']; |
262 | - $cols = array_reverse($cols, true); |
|
262 | + $cols = array_reverse( $cols, true ); |
|
263 | 263 | |
264 | - $result[] = $form_id .'_id'; |
|
265 | - $i--; |
|
264 | + $result[] = $form_id . '_id'; |
|
265 | + $i --; |
|
266 | 266 | |
267 | - $result[] = $form_id .'_item_key'; |
|
268 | - $i--; |
|
267 | + $result[] = $form_id . '_item_key'; |
|
268 | + $i --; |
|
269 | 269 | |
270 | 270 | foreach ( $cols as $col_key => $col ) { |
271 | 271 | if ( $i > $max_columns ) { |
272 | 272 | $result[] = $col_key; |
273 | 273 | } |
274 | 274 | //remove some columns by default |
275 | - $i--; |
|
276 | - unset($col_key, $col); |
|
275 | + $i --; |
|
276 | + unset( $col_key, $col ); |
|
277 | 277 | } |
278 | 278 | } |
279 | 279 | |
@@ -310,23 +310,23 @@ discard block |
||
310 | 310 | if ( $pagenum > $total_pages && $total_pages > 0 ) { |
311 | 311 | $url = add_query_arg( 'paged', $total_pages ); |
312 | 312 | if ( headers_sent() ) { |
313 | - echo FrmAppHelper::js_redirect($url); |
|
313 | + echo FrmAppHelper::js_redirect( $url ); |
|
314 | 314 | } else { |
315 | 315 | wp_redirect( esc_url_raw( $url ) ); |
316 | 316 | } |
317 | 317 | die(); |
318 | 318 | } |
319 | 319 | |
320 | - if ( empty($message) && isset($_GET['import-message']) ) { |
|
320 | + if ( empty( $message ) && isset( $_GET['import-message'] ) ) { |
|
321 | 321 | $message = __( 'Your import is complete', 'formidable' ); |
322 | 322 | } |
323 | 323 | |
324 | - require(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/list.php'); |
|
324 | + require( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/list.php' ); |
|
325 | 325 | } |
326 | 326 | |
327 | 327 | /* Back End CRUD */ |
328 | 328 | public static function show( $id = 0 ) { |
329 | - FrmAppHelper::permission_check('frm_view_entries'); |
|
329 | + FrmAppHelper::permission_check( 'frm_view_entries' ); |
|
330 | 330 | |
331 | 331 | if ( ! $id ) { |
332 | 332 | $id = FrmAppHelper::get_param( 'id', 0, 'get', 'absint' ); |
@@ -336,9 +336,9 @@ discard block |
||
336 | 336 | } |
337 | 337 | } |
338 | 338 | |
339 | - $entry = FrmEntry::getOne($id, true); |
|
339 | + $entry = FrmEntry::getOne( $id, true ); |
|
340 | 340 | |
341 | - $data = maybe_unserialize($entry->description); |
|
341 | + $data = maybe_unserialize( $entry->description ); |
|
342 | 342 | if ( ! is_array( $data ) || ! isset( $data['referrer'] ) ) { |
343 | 343 | $data = array( 'referrer' => $data ); |
344 | 344 | } |
@@ -346,18 +346,18 @@ discard block |
||
346 | 346 | $fields = FrmField::get_all_for_form( $entry->form_id, '', 'include' ); |
347 | 347 | $to_emails = array(); |
348 | 348 | |
349 | - include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/show.php'); |
|
349 | + include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/show.php' ); |
|
350 | 350 | } |
351 | 351 | |
352 | 352 | public static function destroy() { |
353 | - FrmAppHelper::permission_check('frm_delete_entries'); |
|
353 | + FrmAppHelper::permission_check( 'frm_delete_entries' ); |
|
354 | 354 | |
355 | 355 | $params = FrmForm::get_admin_params(); |
356 | 356 | |
357 | - if ( isset($params['keep_post']) && $params['keep_post'] ) { |
|
357 | + if ( isset( $params['keep_post'] ) && $params['keep_post'] ) { |
|
358 | 358 | //unlink entry from post |
359 | 359 | global $wpdb; |
360 | - $wpdb->update( $wpdb->prefix .'frm_items', array( 'post_id' => '' ), array( 'id' => $params['id'] ) ); |
|
360 | + $wpdb->update( $wpdb->prefix . 'frm_items', array( 'post_id' => '' ), array( 'id' => $params['id'] ) ); |
|
361 | 361 | } |
362 | 362 | |
363 | 363 | $message = ''; |
@@ -432,9 +432,9 @@ discard block |
||
432 | 432 | if ( ! isset( $frm_vars['form_params'] ) ) { |
433 | 433 | $frm_vars['form_params'] = array(); |
434 | 434 | } |
435 | - $frm_vars['form_params'][ $form->id ] = $params; |
|
435 | + $frm_vars['form_params'][$form->id] = $params; |
|
436 | 436 | |
437 | - if ( isset( $frm_vars['created_entries'][ $form_id ] ) ) { |
|
437 | + if ( isset( $frm_vars['created_entries'][$form_id] ) ) { |
|
438 | 438 | return; |
439 | 439 | } |
440 | 440 | |
@@ -449,13 +449,13 @@ discard block |
||
449 | 449 | */ |
450 | 450 | $errors = apply_filters( 'frm_entries_before_create', $errors, $form ); |
451 | 451 | |
452 | - $frm_vars['created_entries'][ $form_id ] = array( 'errors' => $errors ); |
|
452 | + $frm_vars['created_entries'][$form_id] = array( 'errors' => $errors ); |
|
453 | 453 | |
454 | 454 | if ( empty( $errors ) ) { |
455 | 455 | $_POST['frm_skip_cookie'] = 1; |
456 | 456 | if ( $params['action'] == 'create' ) { |
457 | - if ( apply_filters( 'frm_continue_to_create', true, $form_id ) && ! isset( $frm_vars['created_entries'][ $form_id ]['entry_id'] ) ) { |
|
458 | - $frm_vars['created_entries'][ $form_id ]['entry_id'] = FrmEntry::create( $_POST ); |
|
457 | + if ( apply_filters( 'frm_continue_to_create', true, $form_id ) && ! isset( $frm_vars['created_entries'][$form_id]['entry_id'] ) ) { |
|
458 | + $frm_vars['created_entries'][$form_id]['entry_id'] = FrmEntry::create( $_POST ); |
|
459 | 459 | } |
460 | 460 | } |
461 | 461 | |
@@ -490,28 +490,28 @@ discard block |
||
490 | 490 | } |
491 | 491 | |
492 | 492 | public static function &filter_email_value( $value, $meta, $entry, $atts = array() ) { |
493 | - $field = FrmField::getOne($meta->field_id); |
|
493 | + $field = FrmField::getOne( $meta->field_id ); |
|
494 | 494 | if ( ! $field ) { |
495 | 495 | return $value; |
496 | 496 | } |
497 | 497 | |
498 | - $value = self::filter_display_value($value, $field, $atts); |
|
498 | + $value = self::filter_display_value( $value, $field, $atts ); |
|
499 | 499 | return $value; |
500 | 500 | } |
501 | 501 | |
502 | 502 | public static function &filter_shortcode_value( $value, $tag, $atts, $field ) { |
503 | - $plain_text = add_filter('frm_plain_text_email', true); |
|
503 | + $plain_text = add_filter( 'frm_plain_text_email', true ); |
|
504 | 504 | FrmEntryFormat::textarea_display_value( $field->type, $plain_text, $value ); |
505 | 505 | |
506 | - if ( isset($atts['show']) && $atts['show'] == 'value' ) { |
|
506 | + if ( isset( $atts['show'] ) && $atts['show'] == 'value' ) { |
|
507 | 507 | return $value; |
508 | 508 | } |
509 | 509 | |
510 | - return self::filter_display_value($value, $field, $atts); |
|
510 | + return self::filter_display_value( $value, $field, $atts ); |
|
511 | 511 | } |
512 | 512 | |
513 | 513 | public static function &filter_display_value( $value, $field, $atts = array() ) { |
514 | - $saved_value = ( isset($atts['saved_value']) && $atts['saved_value'] ) ? true : false; |
|
514 | + $saved_value = ( isset( $atts['saved_value'] ) && $atts['saved_value'] ) ? true : false; |
|
515 | 515 | if ( ! in_array( $field->type, array( 'radio', 'checkbox', 'radio', 'select' ) ) || ! FrmField::is_option_true( $field, 'separate_value' ) || $saved_value ) { |
516 | 516 | return $value; |
517 | 517 | } |
@@ -519,29 +519,29 @@ discard block |
||
519 | 519 | $f_values = $f_labels = array(); |
520 | 520 | |
521 | 521 | foreach ( $field->options as $opt_key => $opt ) { |
522 | - if ( ! is_array($opt) ) { |
|
522 | + if ( ! is_array( $opt ) ) { |
|
523 | 523 | continue; |
524 | 524 | } |
525 | 525 | |
526 | - $f_labels[ $opt_key ] = isset( $opt['label'] ) ? $opt['label'] : reset($opt); |
|
527 | - $f_values[ $opt_key ] = isset( $opt['value'] ) ? $opt['value'] : $f_labels[ $opt_key ]; |
|
528 | - if ( $f_labels[ $opt_key ] == $f_values[ $opt_key ] ) { |
|
529 | - unset( $f_values[ $opt_key ], $f_labels[ $opt_key ] ); |
|
526 | + $f_labels[$opt_key] = isset( $opt['label'] ) ? $opt['label'] : reset( $opt ); |
|
527 | + $f_values[$opt_key] = isset( $opt['value'] ) ? $opt['value'] : $f_labels[$opt_key]; |
|
528 | + if ( $f_labels[$opt_key] == $f_values[$opt_key] ) { |
|
529 | + unset( $f_values[$opt_key], $f_labels[$opt_key] ); |
|
530 | 530 | } |
531 | - unset($opt_key, $opt); |
|
531 | + unset( $opt_key, $opt ); |
|
532 | 532 | } |
533 | 533 | |
534 | - if ( ! empty($f_values) ) { |
|
534 | + if ( ! empty( $f_values ) ) { |
|
535 | 535 | foreach ( (array) $value as $v_key => $val ) { |
536 | - if ( in_array($val, $f_values) ) { |
|
537 | - $opt = array_search($val, $f_values); |
|
538 | - if ( is_array($value) ) { |
|
539 | - $value[ $v_key ] = $f_labels[ $opt ]; |
|
536 | + if ( in_array( $val, $f_values ) ) { |
|
537 | + $opt = array_search( $val, $f_values ); |
|
538 | + if ( is_array( $value ) ) { |
|
539 | + $value[$v_key] = $f_labels[$opt]; |
|
540 | 540 | } else { |
541 | - $value = $f_labels[ $opt ]; |
|
541 | + $value = $f_labels[$opt]; |
|
542 | 542 | } |
543 | 543 | } |
544 | - unset($v_key, $val); |
|
544 | + unset( $v_key, $val ); |
|
545 | 545 | } |
546 | 546 | } |
547 | 547 | |
@@ -554,13 +554,13 @@ discard block |
||
554 | 554 | } |
555 | 555 | |
556 | 556 | public static function entry_sidebar( $entry ) { |
557 | - $data = maybe_unserialize($entry->description); |
|
558 | - $date_format = get_option('date_format'); |
|
559 | - $time_format = get_option('time_format'); |
|
557 | + $data = maybe_unserialize( $entry->description ); |
|
558 | + $date_format = get_option( 'date_format' ); |
|
559 | + $time_format = get_option( 'time_format' ); |
|
560 | 560 | if ( isset( $data['browser'] ) ) { |
561 | 561 | $browser = FrmEntryFormat::get_browser( $data['browser'] ); |
562 | 562 | } |
563 | 563 | |
564 | - include(FrmAppHelper::plugin_path() .'/classes/views/frm-entries/sidebar-shared.php'); |
|
564 | + include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/sidebar-shared.php' ); |
|
565 | 565 | } |
566 | 566 | } |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | <a href="?page=formidable-styles&page-tab=default#tabs-panel-default-color" class="nav-tab-link" data-type="tabs-panel-default-color"><?php _e( 'Default', 'formidable' ) ?></a> |
5 | 5 | </li> |
6 | 6 | <li <?php echo ( 'active-color' == $current_tab ? ' class="tabs"' : '' ); ?>> |
7 | - <a href="<?php echo esc_url('?page=formidable-styles&page-tab=active-color#page-active-color') ?>" class="nav-tab-link" data-type="tabs-panel-active-color"><?php _e( 'Active', 'formidable' ) ?></a> |
|
7 | + <a href="<?php echo esc_url( '?page=formidable-styles&page-tab=active-color#page-active-color' ) ?>" class="nav-tab-link" data-type="tabs-panel-active-color"><?php _e( 'Active', 'formidable' ) ?></a> |
|
8 | 8 | </li> |
9 | 9 | <li <?php echo ( 'active-error' == $current_tab ? ' class="tabs"' : '' ); ?>> |
10 | 10 | <a href="?page=formidable-styles&page-tab=active-error#tabs-panel-active-error" class="nav-tab-link" data-type="tabs-panel-active-error"><?php _e( 'Error', 'formidable' ) ?></a> |
@@ -19,34 +19,34 @@ discard block |
||
19 | 19 | ?>"> |
20 | 20 | <div class="field-group field-group-border clearfix"> |
21 | 21 | <label class="background"><?php _e( 'BG color', 'formidable' ) ?></label> |
22 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('bg_color') ) ?>" id="frm_bg_color" class="hex" value="<?php echo esc_attr( $style->post_content['bg_color'] ) ?>" /> |
|
22 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'bg_color' ) ) ?>" id="frm_bg_color" class="hex" value="<?php echo esc_attr( $style->post_content['bg_color'] ) ?>" /> |
|
23 | 23 | </div> |
24 | 24 | <div class="field-group clearfix"> |
25 | 25 | <label><?php _e( 'Text', 'formidable' ) ?></label> |
26 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('text_color') ) ?>" id="frm_text_color" class="hex" value="<?php echo esc_attr( $style->post_content['text_color'] ) ?>" /> |
|
26 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'text_color' ) ) ?>" id="frm_text_color" class="hex" value="<?php echo esc_attr( $style->post_content['text_color'] ) ?>" /> |
|
27 | 27 | </div> |
28 | 28 | |
29 | 29 | <div class="field-group field-group-border clearfix"> |
30 | 30 | <label><?php _e( 'Border', 'formidable' ) ?></label> |
31 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('border_color') ) ?>" id="frm_border_color" class="hex" value="<?php echo esc_attr( $style->post_content['border_color'] ) ?>" /> |
|
31 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'border_color' ) ) ?>" id="frm_border_color" class="hex" value="<?php echo esc_attr( $style->post_content['border_color'] ) ?>" /> |
|
32 | 32 | </div> |
33 | 33 | <div class="field-group clearfix"> |
34 | 34 | <label><?php _e( 'Thickness', 'formidable' ) ?></label> |
35 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('field_border_width') ) ?>" id="frm_field_border_width" value="<?php echo esc_attr( $style->post_content['field_border_width'] ) ?>" size="4" /> |
|
35 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'field_border_width' ) ) ?>" id="frm_field_border_width" value="<?php echo esc_attr( $style->post_content['field_border_width'] ) ?>" size="4" /> |
|
36 | 36 | </div> |
37 | 37 | <div class="field-group clearfix"> |
38 | 38 | <label><?php _e( 'Style', 'formidable' ) ?></label> |
39 | - <select name="<?php echo esc_attr( $frm_style->get_field_name('field_border_style') ) ?>" id="frm_field_border_style"> |
|
40 | - <option value="solid" <?php selected($style->post_content['field_border_style'], 'solid') ?>><?php _e( 'solid', 'formidable' ) ?></option> |
|
41 | - <option value="dotted" <?php selected($style->post_content['field_border_style'], 'dotted') ?>><?php _e( 'dotted', 'formidable' ) ?></option> |
|
42 | - <option value="dashed" <?php selected($style->post_content['field_border_style'], 'dashed') ?>><?php _e( 'dashed', 'formidable' ) ?></option> |
|
43 | - <option value="double" <?php selected($style->post_content['field_border_style'], 'double') ?>><?php _e( 'double', 'formidable' ) ?></option> |
|
39 | + <select name="<?php echo esc_attr( $frm_style->get_field_name( 'field_border_style' ) ) ?>" id="frm_field_border_style"> |
|
40 | + <option value="solid" <?php selected( $style->post_content['field_border_style'], 'solid' ) ?>><?php _e( 'solid', 'formidable' ) ?></option> |
|
41 | + <option value="dotted" <?php selected( $style->post_content['field_border_style'], 'dotted' ) ?>><?php _e( 'dotted', 'formidable' ) ?></option> |
|
42 | + <option value="dashed" <?php selected( $style->post_content['field_border_style'], 'dashed' ) ?>><?php _e( 'dashed', 'formidable' ) ?></option> |
|
43 | + <option value="double" <?php selected( $style->post_content['field_border_style'], 'double' ) ?>><?php _e( 'double', 'formidable' ) ?></option> |
|
44 | 44 | </select> |
45 | 45 | </div> |
46 | 46 | <div class="clear"></div> |
47 | 47 | <p class="frm_no_bottom_margin"> |
48 | 48 | <label> |
49 | - <input type="checkbox" name="<?php echo esc_attr( $frm_style->get_field_name('remove_box_shadow') ) ?>" id="frm_remove_box_shadow" value="1" <?php checked($style->post_content['remove_box_shadow'], 1) ?> /> |
|
49 | + <input type="checkbox" name="<?php echo esc_attr( $frm_style->get_field_name( 'remove_box_shadow' ) ) ?>" id="frm_remove_box_shadow" value="1" <?php checked( $style->post_content['remove_box_shadow'], 1 ) ?> /> |
|
50 | 50 | <?php _e( 'Remove box shadow', 'formidable' ) ?> |
51 | 51 | </label> |
52 | 52 | </p> |
@@ -57,16 +57,16 @@ discard block |
||
57 | 57 | ?>"> |
58 | 58 | <div class="field-group field-group-border clearfix"> |
59 | 59 | <label class="background"><?php _e( 'BG color', 'formidable' ) ?></label> |
60 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('bg_color_active') ) ?>" id="frm_bg_color_active" class="hex" value="<?php echo esc_attr( $style->post_content['bg_color_active'] ) ?>" /> |
|
60 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'bg_color_active' ) ) ?>" id="frm_bg_color_active" class="hex" value="<?php echo esc_attr( $style->post_content['bg_color_active'] ) ?>" /> |
|
61 | 61 | </div> |
62 | 62 | <div class="field-group clearfix"> |
63 | 63 | <label><?php _e( 'Border', 'formidable' ) ?></label> |
64 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('border_color_active') ) ?>" id="frm_border_color_active" class="hex" value="<?php echo esc_attr( $style->post_content['border_color_active'] ) ?>" /> |
|
64 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'border_color_active' ) ) ?>" id="frm_border_color_active" class="hex" value="<?php echo esc_attr( $style->post_content['border_color_active'] ) ?>" /> |
|
65 | 65 | </div> |
66 | 66 | <div class="clear"></div> |
67 | 67 | <p class="frm_no_bottom_margin"> |
68 | 68 | <label> |
69 | - <input type="checkbox" name="<?php echo esc_attr( $frm_style->get_field_name('remove_box_shadow_active') ) ?>" id="frm_remove_box_shadow_active" value="1" <?php checked($style->post_content['remove_box_shadow_active'], 1) ?> /> |
|
69 | + <input type="checkbox" name="<?php echo esc_attr( $frm_style->get_field_name( 'remove_box_shadow_active' ) ) ?>" id="frm_remove_box_shadow_active" value="1" <?php checked( $style->post_content['remove_box_shadow_active'], 1 ) ?> /> |
|
70 | 70 | <?php _e( 'Remove box shadow', 'formidable' ) ?> |
71 | 71 | </label> |
72 | 72 | </p> |
@@ -77,28 +77,28 @@ discard block |
||
77 | 77 | ?>"> |
78 | 78 | <div class="field-group field-group-border clearfix"> |
79 | 79 | <label class="background"><?php _e( 'BG color', 'formidable' ) ?></label> |
80 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('bg_color_error') ) ?>" id="frm_bg_color_error" class="hex" value="<?php echo esc_attr( $style->post_content['bg_color_error'] ) ?>" /> |
|
80 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'bg_color_error' ) ) ?>" id="frm_bg_color_error" class="hex" value="<?php echo esc_attr( $style->post_content['bg_color_error'] ) ?>" /> |
|
81 | 81 | </div> |
82 | 82 | <div class="field-group clearfix"> |
83 | 83 | <label><?php _e( 'Text', 'formidable' ) ?></label> |
84 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('text_color_error') ) ?>" id="frm_text_color_error" class="hex" value="<?php echo esc_attr( $style->post_content['text_color_error'] ) ?>" /> |
|
84 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'text_color_error' ) ) ?>" id="frm_text_color_error" class="hex" value="<?php echo esc_attr( $style->post_content['text_color_error'] ) ?>" /> |
|
85 | 85 | </div> |
86 | 86 | |
87 | 87 | <div class="field-group field-group-border clearfix"> |
88 | 88 | <label><?php _e( 'Border', 'formidable' ) ?></label> |
89 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('border_color_error') ) ?>" id="frm_border_color_error" class="hex" value="<?php echo esc_attr( $style->post_content['border_color_error'] ) ?>" /> |
|
89 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'border_color_error' ) ) ?>" id="frm_border_color_error" class="hex" value="<?php echo esc_attr( $style->post_content['border_color_error'] ) ?>" /> |
|
90 | 90 | </div> |
91 | 91 | <div class="field-group clearfix"> |
92 | 92 | <label><?php _e( 'Thickness', 'formidable' ) ?></label> |
93 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('border_width_error') ) ?>" id="frm_border_width_error" value="<?php echo esc_attr( $style->post_content['border_width_error'] ) ?>" size="4" /> |
|
93 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'border_width_error' ) ) ?>" id="frm_border_width_error" value="<?php echo esc_attr( $style->post_content['border_width_error'] ) ?>" size="4" /> |
|
94 | 94 | </div> |
95 | 95 | <div class="field-group clearfix"> |
96 | 96 | <label><?php _e( 'Style', 'formidable' ) ?></label> |
97 | - <select name="<?php echo esc_attr( $frm_style->get_field_name('border_style_error') ) ?>" id="frm_border_style_error"> |
|
98 | - <option value="solid" <?php selected($style->post_content['border_style_error'], 'solid') ?>><?php _e( 'solid', 'formidable' ) ?></option> |
|
99 | - <option value="dotted" <?php selected($style->post_content['border_style_error'], 'dotted') ?>><?php _e( 'dotted', 'formidable' ) ?></option> |
|
100 | - <option value="dashed" <?php selected($style->post_content['border_style_error'], 'dashed') ?>><?php _e( 'dashed', 'formidable' ) ?></option> |
|
101 | - <option value="double" <?php selected($style->post_content['border_style_error'], 'double') ?>><?php _e( 'double', 'formidable' ) ?></option> |
|
97 | + <select name="<?php echo esc_attr( $frm_style->get_field_name( 'border_style_error' ) ) ?>" id="frm_border_style_error"> |
|
98 | + <option value="solid" <?php selected( $style->post_content['border_style_error'], 'solid' ) ?>><?php _e( 'solid', 'formidable' ) ?></option> |
|
99 | + <option value="dotted" <?php selected( $style->post_content['border_style_error'], 'dotted' ) ?>><?php _e( 'dotted', 'formidable' ) ?></option> |
|
100 | + <option value="dashed" <?php selected( $style->post_content['border_style_error'], 'dashed' ) ?>><?php _e( 'dashed', 'formidable' ) ?></option> |
|
101 | + <option value="double" <?php selected( $style->post_content['border_style_error'], 'double' ) ?>><?php _e( 'double', 'formidable' ) ?></option> |
|
102 | 102 | </select> |
103 | 103 | </div> |
104 | 104 | |
@@ -110,16 +110,16 @@ discard block |
||
110 | 110 | ?>"> |
111 | 111 | <div class="field-group field-group-border clearfix"> |
112 | 112 | <label class="background"><?php _e( 'BG color', 'formidable' ) ?></label> |
113 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('bg_color_disabled') ) ?>" id="frm_bg_color_disabled" class="hex" value="<?php echo esc_attr( $style->post_content['bg_color_disabled'] ) ?>" /> |
|
113 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'bg_color_disabled' ) ) ?>" id="frm_bg_color_disabled" class="hex" value="<?php echo esc_attr( $style->post_content['bg_color_disabled'] ) ?>" /> |
|
114 | 114 | </div> |
115 | 115 | <div class="field-group clearfix"> |
116 | 116 | <label><?php _e( 'Text', 'formidable' ) ?></label> |
117 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('text_color_disabled') ) ?>" id="frm_text_color_disabled" class="hex" value="<?php echo esc_attr( $style->post_content['text_color_disabled'] ) ?>" /> |
|
117 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'text_color_disabled' ) ) ?>" id="frm_text_color_disabled" class="hex" value="<?php echo esc_attr( $style->post_content['text_color_disabled'] ) ?>" /> |
|
118 | 118 | </div> |
119 | 119 | |
120 | 120 | <div class="field-group clearfix"> |
121 | 121 | <label><?php _e( 'Border', 'formidable' ) ?></label> |
122 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('border_color_disabled') ) ?>" id="frm_border_color_disabled" class="hex" value="<?php echo esc_attr( $style->post_content['border_color_disabled'] ) ?>" /> |
|
122 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'border_color_disabled' ) ) ?>" id="frm_border_color_disabled" class="hex" value="<?php echo esc_attr( $style->post_content['border_color_disabled'] ) ?>" /> |
|
123 | 123 | </div> |
124 | 124 | <div class="clear"></div> |
125 | 125 | </div><!-- /.tabs-panel --> |