@@ -375,6 +375,9 @@ |
||
| 375 | 375 | $reset_fields = true; |
| 376 | 376 | } |
| 377 | 377 | |
| 378 | + /** |
|
| 379 | + * @return string |
|
| 380 | + */ |
|
| 378 | 381 | public static function replace_shortcodes( $html, $form, $title = false, $description = false, $values = array() ) { |
| 379 | 382 | foreach ( array( 'form_name' => $title, 'form_description' => $description, 'entry_key' => true ) as $code => $show ) { |
| 380 | 383 | if ( $code == 'form_name' ) { |
@@ -14,38 +14,38 @@ discard block |
||
| 14 | 14 | |
| 15 | 15 | public static function get_direct_link( $key, $form = false ) { |
| 16 | 16 | $target_url = esc_url( admin_url( 'admin-ajax.php?action=frm_forms_preview&form=' . $key ) ); |
| 17 | - $target_url = apply_filters('frm_direct_link', $target_url, $key, $form); |
|
| 18 | - |
|
| 19 | - return $target_url; |
|
| 20 | - } |
|
| 21 | - |
|
| 22 | - public static function forms_dropdown( $field_name, $field_value = '', $args = array() ) { |
|
| 23 | - $defaults = array( |
|
| 24 | - 'blank' => true, |
|
| 25 | - 'field_id' => false, |
|
| 26 | - 'onchange' => false, |
|
| 27 | - 'exclude' => false, |
|
| 28 | - 'class' => '', |
|
| 17 | + $target_url = apply_filters('frm_direct_link', $target_url, $key, $form); |
|
| 18 | + |
|
| 19 | + return $target_url; |
|
| 20 | + } |
|
| 21 | + |
|
| 22 | + public static function forms_dropdown( $field_name, $field_value = '', $args = array() ) { |
|
| 23 | + $defaults = array( |
|
| 24 | + 'blank' => true, |
|
| 25 | + 'field_id' => false, |
|
| 26 | + 'onchange' => false, |
|
| 27 | + 'exclude' => false, |
|
| 28 | + 'class' => '', |
|
| 29 | 29 | 'inc_children' => 'exclude', |
| 30 | - ); |
|
| 31 | - $args = wp_parse_args( $args, $defaults ); |
|
| 30 | + ); |
|
| 31 | + $args = wp_parse_args( $args, $defaults ); |
|
| 32 | 32 | |
| 33 | - if ( ! $args['field_id'] ) { |
|
| 34 | - $args['field_id'] = $field_name; |
|
| 35 | - } |
|
| 33 | + if ( ! $args['field_id'] ) { |
|
| 34 | + $args['field_id'] = $field_name; |
|
| 35 | + } |
|
| 36 | 36 | |
| 37 | 37 | $query = array(); |
| 38 | - if ( $args['exclude'] ) { |
|
| 38 | + if ( $args['exclude'] ) { |
|
| 39 | 39 | $query['id !'] = $args['exclude']; |
| 40 | - } |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | - $where = apply_filters('frm_forms_dropdown', $query, $field_name); |
|
| 42 | + $where = apply_filters('frm_forms_dropdown', $query, $field_name); |
|
| 43 | 43 | $forms = FrmForm::get_published_forms( $where, 999, $args['inc_children'] ); |
| 44 | 44 | $add_html = array(); |
| 45 | 45 | self::add_html_attr( $args['onchange'], 'onchange', $add_html ); |
| 46 | 46 | self::add_html_attr( $args['class'], 'class', $add_html ); |
| 47 | 47 | |
| 48 | - ?> |
|
| 48 | + ?> |
|
| 49 | 49 | <select name="<?php echo esc_attr( $field_name ); ?>" id="<?php echo esc_attr( $args['field_id'] ) ?>" <?php echo implode( ' ', $add_html ); ?>> |
| 50 | 50 | <?php if ( $args['blank'] ) { ?> |
| 51 | 51 | <option value=""><?php echo ( $args['blank'] == 1 ) ? ' ' : '- ' . esc_attr( $args['blank'] ) . ' -'; ?></option> |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | <?php } ?> |
| 58 | 58 | </select> |
| 59 | 59 | <?php |
| 60 | - } |
|
| 60 | + } |
|
| 61 | 61 | |
| 62 | 62 | /** |
| 63 | 63 | * @param string $class |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | } |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | - public static function form_switcher() { |
|
| 75 | + public static function form_switcher() { |
|
| 76 | 76 | $where = apply_filters( 'frm_forms_dropdown', array(), '' ); |
| 77 | 77 | $forms = FrmForm::get_published_forms( $where ); |
| 78 | 78 | |
@@ -81,32 +81,32 @@ discard block |
||
| 81 | 81 | unset( $args['form'] ); |
| 82 | 82 | } else if ( isset( $_GET['form']) && ! isset( $_GET['id'] ) ) { |
| 83 | 83 | unset( $args['id'] ); |
| 84 | - } |
|
| 84 | + } |
|
| 85 | 85 | |
| 86 | 86 | $frm_action = FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' ); |
| 87 | 87 | if ( FrmAppHelper::is_admin_page( 'formidable-entries' ) && in_array( $frm_action, array( 'edit', 'show', 'destroy_all' ) ) ) { |
| 88 | - $args['frm_action'] = 'list'; |
|
| 89 | - $args['form'] = 0; |
|
| 88 | + $args['frm_action'] = 'list'; |
|
| 89 | + $args['form'] = 0; |
|
| 90 | 90 | } else if ( FrmAppHelper::is_admin_page('formidable' ) && in_array( $frm_action, array( 'new', 'duplicate' ) ) ) { |
| 91 | - $args['frm_action'] = 'edit'; |
|
| 91 | + $args['frm_action'] = 'edit'; |
|
| 92 | 92 | } else if ( isset( $_GET['post'] ) ) { |
| 93 | - $args['form'] = 0; |
|
| 94 | - $base = admin_url('edit.php?post_type=frm_display'); |
|
| 95 | - } |
|
| 93 | + $args['form'] = 0; |
|
| 94 | + $base = admin_url('edit.php?post_type=frm_display'); |
|
| 95 | + } |
|
| 96 | 96 | |
| 97 | - ?> |
|
| 97 | + ?> |
|
| 98 | 98 | <li class="dropdown last" id="frm_bs_dropdown"> |
| 99 | 99 | <a href="#" id="frm-navbarDrop" class="frm-dropdown-toggle" data-toggle="dropdown"><?php _e( 'Switch Form', 'formidable' ) ?> <b class="caret"></b></a> |
| 100 | 100 | <ul class="frm-dropdown-menu frm-on-top" role="menu" aria-labelledby="frm-navbarDrop"> |
| 101 | 101 | <?php |
| 102 | 102 | foreach ( $forms as $form ) { |
| 103 | 103 | if ( isset( $args['id'] ) ) { |
| 104 | - $args['id'] = $form->id; |
|
| 104 | + $args['id'] = $form->id; |
|
| 105 | 105 | } |
| 106 | - if ( isset( $args['form'] ) ) { |
|
| 107 | - $args['form'] = $form->id; |
|
| 106 | + if ( isset( $args['form'] ) ) { |
|
| 107 | + $args['form'] = $form->id; |
|
| 108 | 108 | } |
| 109 | - ?> |
|
| 109 | + ?> |
|
| 110 | 110 | <li><a href="<?php echo esc_url( isset( $base ) ? add_query_arg( $args, $base ) : add_query_arg( $args ) ); ?>" tabindex="-1"><?php echo esc_html( empty( $form->name ) ? __( '(no title)') : FrmAppHelper::truncate( $form->name, 60 ) ); ?></a></li> |
| 111 | 111 | <?php |
| 112 | 112 | unset( $form ); |
@@ -114,12 +114,12 @@ discard block |
||
| 114 | 114 | </ul> |
| 115 | 115 | </li> |
| 116 | 116 | <?php |
| 117 | - } |
|
| 117 | + } |
|
| 118 | 118 | |
| 119 | 119 | public static function get_sortable_classes( $col, $sort_col, $sort_dir ) { |
| 120 | - echo ($sort_col == $col) ? 'sorted' : 'sortable'; |
|
| 121 | - echo ($sort_col == $col && $sort_dir == 'desc') ? ' asc' : ' desc'; |
|
| 122 | - } |
|
| 120 | + echo ($sort_col == $col) ? 'sorted' : 'sortable'; |
|
| 121 | + echo ($sort_col == $col && $sort_dir == 'desc') ? ' asc' : ' desc'; |
|
| 122 | + } |
|
| 123 | 123 | |
| 124 | 124 | /** |
| 125 | 125 | * Get the invalid form error message |
@@ -143,104 +143,104 @@ discard block |
||
| 143 | 143 | return $message; |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | - /** |
|
| 147 | - * Used when a form is created |
|
| 148 | - */ |
|
| 149 | - public static function setup_new_vars( $values = array() ) { |
|
| 150 | - global $wpdb; |
|
| 146 | + /** |
|
| 147 | + * Used when a form is created |
|
| 148 | + */ |
|
| 149 | + public static function setup_new_vars( $values = array() ) { |
|
| 150 | + global $wpdb; |
|
| 151 | 151 | |
| 152 | - if ( ! empty( $values ) ) { |
|
| 153 | - $post_values = $values; |
|
| 154 | - } else { |
|
| 155 | - $values = array(); |
|
| 156 | - $post_values = isset($_POST) ? $_POST : array(); |
|
| 157 | - } |
|
| 152 | + if ( ! empty( $values ) ) { |
|
| 153 | + $post_values = $values; |
|
| 154 | + } else { |
|
| 155 | + $values = array(); |
|
| 156 | + $post_values = isset($_POST) ? $_POST : array(); |
|
| 157 | + } |
|
| 158 | 158 | |
| 159 | 159 | foreach ( array( 'name' => '', 'description' => '' ) as $var => $default ) { |
| 160 | 160 | if ( ! isset( $values[ $var ] ) ) { |
| 161 | 161 | $values[ $var ] = FrmAppHelper::get_param( $var, $default ); |
| 162 | - } |
|
| 163 | - } |
|
| 162 | + } |
|
| 163 | + } |
|
| 164 | 164 | |
| 165 | - $values['description'] = FrmAppHelper::use_wpautop($values['description']); |
|
| 165 | + $values['description'] = FrmAppHelper::use_wpautop($values['description']); |
|
| 166 | 166 | |
| 167 | 167 | foreach ( array( 'form_id' => '', 'logged_in' => '', 'editable' => '', 'default_template' => 0, 'is_template' => 0, 'status' => 'draft', 'parent_form_id' => 0 ) as $var => $default ) { |
| 168 | - if ( ! isset( $values[ $var ] ) ) { |
|
| 168 | + if ( ! isset( $values[ $var ] ) ) { |
|
| 169 | 169 | $values[ $var ] = FrmAppHelper::get_param( $var, $default ); |
| 170 | - } |
|
| 171 | - } |
|
| 170 | + } |
|
| 171 | + } |
|
| 172 | 172 | |
| 173 | - if ( ! isset( $values['form_key'] ) ) { |
|
| 173 | + if ( ! isset( $values['form_key'] ) ) { |
|
| 174 | 174 | $values['form_key'] = ( $post_values && isset( $post_values['form_key'] ) ) ? $post_values['form_key'] : FrmAppHelper::get_unique_key( '', $wpdb->prefix . 'frm_forms', 'form_key' ); |
| 175 | - } |
|
| 175 | + } |
|
| 176 | 176 | |
| 177 | 177 | $values = self::fill_default_opts( $values, false, $post_values ); |
| 178 | 178 | $values['custom_style'] = FrmAppHelper::custom_style_value( $post_values ); |
| 179 | 179 | |
| 180 | - return apply_filters('frm_setup_new_form_vars', $values); |
|
| 181 | - } |
|
| 180 | + return apply_filters('frm_setup_new_form_vars', $values); |
|
| 181 | + } |
|
| 182 | 182 | |
| 183 | - /** |
|
| 184 | - * Used when editing a form |
|
| 185 | - */ |
|
| 186 | - public static function setup_edit_vars( $values, $record, $post_values = array() ) { |
|
| 183 | + /** |
|
| 184 | + * Used when editing a form |
|
| 185 | + */ |
|
| 186 | + public static function setup_edit_vars( $values, $record, $post_values = array() ) { |
|
| 187 | 187 | if ( empty( $post_values ) ) { |
| 188 | 188 | $post_values = stripslashes_deep( $_POST ); |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | - $values['form_key'] = isset($post_values['form_key']) ? $post_values['form_key'] : $record->form_key; |
|
| 192 | - $values['default_template'] = isset($post_values['default_template']) ? $post_values['default_template'] : $record->default_template; |
|
| 193 | - $values['is_template'] = isset($post_values['is_template']) ? $post_values['is_template'] : $record->is_template; |
|
| 194 | - $values['status'] = $record->status; |
|
| 191 | + $values['form_key'] = isset($post_values['form_key']) ? $post_values['form_key'] : $record->form_key; |
|
| 192 | + $values['default_template'] = isset($post_values['default_template']) ? $post_values['default_template'] : $record->default_template; |
|
| 193 | + $values['is_template'] = isset($post_values['is_template']) ? $post_values['is_template'] : $record->is_template; |
|
| 194 | + $values['status'] = $record->status; |
|
| 195 | 195 | |
| 196 | - $values = self::fill_default_opts($values, $record, $post_values); |
|
| 196 | + $values = self::fill_default_opts($values, $record, $post_values); |
|
| 197 | 197 | |
| 198 | - return apply_filters('frm_setup_edit_form_vars', $values); |
|
| 199 | - } |
|
| 198 | + return apply_filters('frm_setup_edit_form_vars', $values); |
|
| 199 | + } |
|
| 200 | 200 | |
| 201 | 201 | public static function fill_default_opts( $values, $record, $post_values ) { |
| 202 | 202 | |
| 203 | - $defaults = self::get_default_opts(); |
|
| 203 | + $defaults = self::get_default_opts(); |
|
| 204 | 204 | foreach ( $defaults as $var => $default ) { |
| 205 | - if ( is_array($default) ) { |
|
| 206 | - if ( ! isset( $values[ $var ] ) ) { |
|
| 205 | + if ( is_array($default) ) { |
|
| 206 | + if ( ! isset( $values[ $var ] ) ) { |
|
| 207 | 207 | $values[ $var ] = ( $record && isset( $record->options[ $var ] ) ) ? $record->options[ $var ] : array(); |
| 208 | - } |
|
| 208 | + } |
|
| 209 | 209 | |
| 210 | - foreach ( $default as $k => $v ) { |
|
| 210 | + foreach ( $default as $k => $v ) { |
|
| 211 | 211 | $values[ $var ][ $k ] = ( $post_values && isset( $post_values[ $var ][ $k ] ) ) ? $post_values[ $var ][ $k ] : ( ( $record && isset( $record->options[ $var ] ) && isset( $record->options[ $var ][ $k ] ) ) ? $record->options[ $var ][ $k ] : $v); |
| 212 | 212 | |
| 213 | - if ( is_array( $v ) ) { |
|
| 214 | - foreach ( $v as $k1 => $v1 ) { |
|
| 213 | + if ( is_array( $v ) ) { |
|
| 214 | + foreach ( $v as $k1 => $v1 ) { |
|
| 215 | 215 | $values[ $var ][ $k ][ $k1 ] = ( $post_values && isset( $post_values[ $var ][ $k ][ $k1 ] ) ) ? $post_values[ $var ][ $k ][ $k1 ] : ( ( $record && isset( $record->options[ $var ] ) && isset( $record->options[ $var ][ $k ] ) && isset( $record->options[ $var ][ $k ][ $k1 ] ) ) ? $record->options[ $var ][ $k ][ $k1 ] : $v1 ); |
| 216 | - unset( $k1, $v1 ); |
|
| 217 | - } |
|
| 218 | - } |
|
| 216 | + unset( $k1, $v1 ); |
|
| 217 | + } |
|
| 218 | + } |
|
| 219 | 219 | |
| 220 | - unset($k, $v); |
|
| 221 | - } |
|
| 222 | - } else { |
|
| 220 | + unset($k, $v); |
|
| 221 | + } |
|
| 222 | + } else { |
|
| 223 | 223 | $values[ $var ] = ( $post_values && isset( $post_values['options'][ $var ] ) ) ? $post_values['options'][ $var ] : ( ( $record && isset( $record->options[ $var ] ) ) ? $record->options[ $var ] : $default ); |
| 224 | - } |
|
| 224 | + } |
|
| 225 | 225 | |
| 226 | - unset($var, $default); |
|
| 227 | - } |
|
| 226 | + unset($var, $default); |
|
| 227 | + } |
|
| 228 | 228 | |
| 229 | - return $values; |
|
| 230 | - } |
|
| 229 | + return $values; |
|
| 230 | + } |
|
| 231 | 231 | |
| 232 | - public static function get_default_opts() { |
|
| 233 | - $frm_settings = FrmAppHelper::get_settings(); |
|
| 232 | + public static function get_default_opts() { |
|
| 233 | + $frm_settings = FrmAppHelper::get_settings(); |
|
| 234 | 234 | |
| 235 | - return array( |
|
| 236 | - 'submit_value' => $frm_settings->submit_value, 'success_action' => 'message', |
|
| 237 | - 'success_msg' => $frm_settings->success_msg, 'show_form' => 0, 'akismet' => '', |
|
| 238 | - 'no_save' => 0, 'ajax_load' => 0, 'form_class' => '', 'custom_style' => 1, |
|
| 239 | - 'before_html' => self::get_default_html('before'), |
|
| 240 | - 'after_html' => '', |
|
| 241 | - 'submit_html' => self::get_default_html('submit'), |
|
| 242 | - ); |
|
| 243 | - } |
|
| 235 | + return array( |
|
| 236 | + 'submit_value' => $frm_settings->submit_value, 'success_action' => 'message', |
|
| 237 | + 'success_msg' => $frm_settings->success_msg, 'show_form' => 0, 'akismet' => '', |
|
| 238 | + 'no_save' => 0, 'ajax_load' => 0, 'form_class' => '', 'custom_style' => 1, |
|
| 239 | + 'before_html' => self::get_default_html('before'), |
|
| 240 | + 'after_html' => '', |
|
| 241 | + 'submit_html' => self::get_default_html('submit'), |
|
| 242 | + ); |
|
| 243 | + } |
|
| 244 | 244 | |
| 245 | 245 | /** |
| 246 | 246 | * @param array $options |
@@ -255,13 +255,13 @@ discard block |
||
| 255 | 255 | } |
| 256 | 256 | } |
| 257 | 257 | |
| 258 | - /** |
|
| 259 | - * @param string $loc |
|
| 260 | - */ |
|
| 258 | + /** |
|
| 259 | + * @param string $loc |
|
| 260 | + */ |
|
| 261 | 261 | public static function get_default_html( $loc ) { |
| 262 | 262 | if ( $loc == 'submit' ) { |
| 263 | - $draft_link = self::get_draft_link(); |
|
| 264 | - $default_html = <<<SUBMIT_HTML |
|
| 263 | + $draft_link = self::get_draft_link(); |
|
| 264 | + $default_html = <<<SUBMIT_HTML |
|
| 265 | 265 | <div class="frm_submit"> |
| 266 | 266 | [if back_button]<button type="submit" name="frm_prev_page" formnovalidate="formnovalidate" class="frm_prev_page" [back_hook]>[back_label]</button>[/if back_button] |
| 267 | 267 | <button class="frm_button_submit" type="submit" [button_action]>[button_label]</button> |
@@ -269,22 +269,22 @@ discard block |
||
| 269 | 269 | </div> |
| 270 | 270 | SUBMIT_HTML; |
| 271 | 271 | } else if ( $loc == 'before' ) { |
| 272 | - $default_html = <<<BEFORE_HTML |
|
| 272 | + $default_html = <<<BEFORE_HTML |
|
| 273 | 273 | <legend class="frm_hidden">[form_name]</legend> |
| 274 | 274 | [if form_name]<h3 class="frm_form_title">[form_name]</h3>[/if form_name] |
| 275 | 275 | [if form_description]<div class="frm_description">[form_description]</div>[/if form_description] |
| 276 | 276 | BEFORE_HTML; |
| 277 | 277 | } else { |
| 278 | - $default_html = ''; |
|
| 279 | - } |
|
| 278 | + $default_html = ''; |
|
| 279 | + } |
|
| 280 | 280 | |
| 281 | - return $default_html; |
|
| 282 | - } |
|
| 281 | + return $default_html; |
|
| 282 | + } |
|
| 283 | 283 | |
| 284 | - public static function get_draft_link() { |
|
| 285 | - $link = '[if save_draft]<a href="#" class="frm_save_draft" [draft_hook]>[draft_label]</a>[/if save_draft]'; |
|
| 286 | - return $link; |
|
| 287 | - } |
|
| 284 | + public static function get_draft_link() { |
|
| 285 | + $link = '[if save_draft]<a href="#" class="frm_save_draft" [draft_hook]>[draft_label]</a>[/if save_draft]'; |
|
| 286 | + return $link; |
|
| 287 | + } |
|
| 288 | 288 | |
| 289 | 289 | public static function get_custom_submit( $html, $form, $submit, $form_action, $values ) { |
| 290 | 290 | $button = self::replace_shortcodes( $html, $form, $submit, $form_action, $values ); |
@@ -311,13 +311,13 @@ discard block |
||
| 311 | 311 | echo $button_parts[1]; |
| 312 | 312 | } |
| 313 | 313 | |
| 314 | - /** |
|
| 315 | - * Automatically add end section fields if they don't exist (2.0 migration) |
|
| 316 | - * @since 2.0 |
|
| 317 | - * |
|
| 318 | - * @param boolean $reset_fields |
|
| 319 | - */ |
|
| 320 | - public static function auto_add_end_section_fields( $form, $fields, &$reset_fields ) { |
|
| 314 | + /** |
|
| 315 | + * Automatically add end section fields if they don't exist (2.0 migration) |
|
| 316 | + * @since 2.0 |
|
| 317 | + * |
|
| 318 | + * @param boolean $reset_fields |
|
| 319 | + */ |
|
| 320 | + public static function auto_add_end_section_fields( $form, $fields, &$reset_fields ) { |
|
| 321 | 321 | if ( empty( $fields ) ) { |
| 322 | 322 | return; |
| 323 | 323 | } |
@@ -327,7 +327,7 @@ discard block |
||
| 327 | 327 | $prev_order = false; |
| 328 | 328 | $add_order = 0; |
| 329 | 329 | $last_field = false; |
| 330 | - foreach ( $fields as $field ) { |
|
| 330 | + foreach ( $fields as $field ) { |
|
| 331 | 331 | if ( $prev_order === $field->field_order ) { |
| 332 | 332 | $add_order++; |
| 333 | 333 | } |
@@ -338,48 +338,48 @@ discard block |
||
| 338 | 338 | FrmField::update( $field->id, array( 'field_order' => $field->field_order ) ); |
| 339 | 339 | } |
| 340 | 340 | |
| 341 | - switch ( $field->type ) { |
|
| 342 | - case 'divider': |
|
| 343 | - // create an end section if open |
|
| 341 | + switch ( $field->type ) { |
|
| 342 | + case 'divider': |
|
| 343 | + // create an end section if open |
|
| 344 | 344 | self::maybe_create_end_section( $open, $reset_fields, $add_order, $end_section_values, $field, 'move' ); |
| 345 | 345 | |
| 346 | - // mark it open for the next end section |
|
| 347 | - $open = true; |
|
| 348 | - break; |
|
| 349 | - case 'break'; |
|
| 346 | + // mark it open for the next end section |
|
| 347 | + $open = true; |
|
| 348 | + break; |
|
| 349 | + case 'break'; |
|
| 350 | 350 | self::maybe_create_end_section( $open, $reset_fields, $add_order, $end_section_values, $field, 'move' ); |
| 351 | - break; |
|
| 352 | - case 'end_divider': |
|
| 353 | - if ( ! $open ) { |
|
| 354 | - // the section isn't open, so this is an extra field that needs to be removed |
|
| 355 | - FrmField::destroy( $field->id ); |
|
| 356 | - $reset_fields = true; |
|
| 357 | - } |
|
| 358 | - |
|
| 359 | - // There is already an end section here, so there is no need to create one |
|
| 360 | - $open = false; |
|
| 361 | - } |
|
| 351 | + break; |
|
| 352 | + case 'end_divider': |
|
| 353 | + if ( ! $open ) { |
|
| 354 | + // the section isn't open, so this is an extra field that needs to be removed |
|
| 355 | + FrmField::destroy( $field->id ); |
|
| 356 | + $reset_fields = true; |
|
| 357 | + } |
|
| 358 | + |
|
| 359 | + // There is already an end section here, so there is no need to create one |
|
| 360 | + $open = false; |
|
| 361 | + } |
|
| 362 | 362 | $prev_order = $field->field_order; |
| 363 | 363 | |
| 364 | 364 | $last_field = $field; |
| 365 | 365 | unset( $field ); |
| 366 | - } |
|
| 366 | + } |
|
| 367 | 367 | |
| 368 | 368 | self::maybe_create_end_section( $open, $reset_fields, $add_order, $end_section_values, $last_field ); |
| 369 | - } |
|
| 369 | + } |
|
| 370 | 370 | |
| 371 | 371 | /** |
| 372 | 372 | * Create end section field if it doesn't exist. This is for migration from < 2.0 |
| 373 | 373 | * Fix any ordering that may be messed up |
| 374 | 374 | */ |
| 375 | 375 | public static function maybe_create_end_section( &$open, &$reset_fields, &$add_order, $end_section_values, $field, $move = 'no' ) { |
| 376 | - if ( ! $open ) { |
|
| 377 | - return; |
|
| 378 | - } |
|
| 376 | + if ( ! $open ) { |
|
| 377 | + return; |
|
| 378 | + } |
|
| 379 | 379 | |
| 380 | 380 | $end_section_values['field_order'] = $field->field_order + 1; |
| 381 | 381 | |
| 382 | - FrmField::create( $end_section_values ); |
|
| 382 | + FrmField::create( $end_section_values ); |
|
| 383 | 383 | |
| 384 | 384 | if ( $move == 'move' ) { |
| 385 | 385 | // bump the order of current field unless we're at the end of the form |
@@ -387,39 +387,39 @@ discard block |
||
| 387 | 387 | } |
| 388 | 388 | |
| 389 | 389 | $add_order += 2; |
| 390 | - $open = false; |
|
| 391 | - $reset_fields = true; |
|
| 392 | - } |
|
| 390 | + $open = false; |
|
| 391 | + $reset_fields = true; |
|
| 392 | + } |
|
| 393 | 393 | |
| 394 | - public static function replace_shortcodes( $html, $form, $title = false, $description = false, $values = array() ) { |
|
| 394 | + public static function replace_shortcodes( $html, $form, $title = false, $description = false, $values = array() ) { |
|
| 395 | 395 | foreach ( array( 'form_name' => $title, 'form_description' => $description, 'entry_key' => true ) as $code => $show ) { |
| 396 | - if ( $code == 'form_name' ) { |
|
| 397 | - $replace_with = $form->name; |
|
| 398 | - } else if ( $code == 'form_description' ) { |
|
| 399 | - $replace_with = FrmAppHelper::use_wpautop($form->description); |
|
| 400 | - } else if ( $code == 'entry_key' && isset($_GET) && isset($_GET['entry']) ) { |
|
| 401 | - $replace_with = FrmAppHelper::simple_get( 'entry' ); |
|
| 402 | - } else { |
|
| 403 | - $replace_with = ''; |
|
| 404 | - } |
|
| 396 | + if ( $code == 'form_name' ) { |
|
| 397 | + $replace_with = $form->name; |
|
| 398 | + } else if ( $code == 'form_description' ) { |
|
| 399 | + $replace_with = FrmAppHelper::use_wpautop($form->description); |
|
| 400 | + } else if ( $code == 'entry_key' && isset($_GET) && isset($_GET['entry']) ) { |
|
| 401 | + $replace_with = FrmAppHelper::simple_get( 'entry' ); |
|
| 402 | + } else { |
|
| 403 | + $replace_with = ''; |
|
| 404 | + } |
|
| 405 | 405 | |
| 406 | 406 | FrmShortcodeHelper::remove_inline_conditions( ( FrmAppHelper::is_true( $show ) && $replace_with != '' ), $code, $replace_with, $html ); |
| 407 | - } |
|
| 407 | + } |
|
| 408 | 408 | |
| 409 | - //replace [form_key] |
|
| 410 | - $html = str_replace('[form_key]', $form->form_key, $html); |
|
| 409 | + //replace [form_key] |
|
| 410 | + $html = str_replace('[form_key]', $form->form_key, $html); |
|
| 411 | 411 | |
| 412 | - //replace [frmurl] |
|
| 413 | - $html = str_replace('[frmurl]', FrmFieldsHelper::dynamic_default_values( 'frmurl' ), $html); |
|
| 412 | + //replace [frmurl] |
|
| 413 | + $html = str_replace('[frmurl]', FrmFieldsHelper::dynamic_default_values( 'frmurl' ), $html); |
|
| 414 | 414 | |
| 415 | 415 | if ( strpos( $html, '[button_label]' ) ) { |
| 416 | 416 | add_filter( 'frm_submit_button', 'FrmFormsHelper::submit_button_label', 1 ); |
| 417 | 417 | $submit_label = apply_filters( 'frm_submit_button', $title, $form ); |
| 418 | 418 | $submit_label = esc_attr( do_shortcode( $submit_label ) ); |
| 419 | 419 | $html = str_replace( '[button_label]', $submit_label, $html ); |
| 420 | - } |
|
| 420 | + } |
|
| 421 | 421 | |
| 422 | - $html = apply_filters('frm_form_replace_shortcodes', $html, $form, $values); |
|
| 422 | + $html = apply_filters('frm_form_replace_shortcodes', $html, $form, $values); |
|
| 423 | 423 | |
| 424 | 424 | if ( strpos( $html, '[if back_button]' ) ) { |
| 425 | 425 | $html = preg_replace( '/(\[if\s+back_button\])(.*?)(\[\/if\s+back_button\])/mis', '', $html ); |
@@ -433,17 +433,17 @@ discard block |
||
| 433 | 433 | $html = do_shortcode( $html ); |
| 434 | 434 | } |
| 435 | 435 | |
| 436 | - return $html; |
|
| 437 | - } |
|
| 436 | + return $html; |
|
| 437 | + } |
|
| 438 | 438 | |
| 439 | 439 | public static function submit_button_label( $submit ) { |
| 440 | - if ( ! $submit || empty($submit) ) { |
|
| 441 | - $frm_settings = FrmAppHelper::get_settings(); |
|
| 442 | - $submit = $frm_settings->submit_value; |
|
| 443 | - } |
|
| 440 | + if ( ! $submit || empty($submit) ) { |
|
| 441 | + $frm_settings = FrmAppHelper::get_settings(); |
|
| 442 | + $submit = $frm_settings->submit_value; |
|
| 443 | + } |
|
| 444 | 444 | |
| 445 | - return $submit; |
|
| 446 | - } |
|
| 445 | + return $submit; |
|
| 446 | + } |
|
| 447 | 447 | |
| 448 | 448 | /** |
| 449 | 449 | * If the Formidable styling isn't being loaded, |
@@ -460,19 +460,19 @@ discard block |
||
| 460 | 460 | } |
| 461 | 461 | |
| 462 | 462 | public static function get_form_style_class( $form = false ) { |
| 463 | - $style = self::get_form_style($form); |
|
| 464 | - $class = ' with_frm_style'; |
|
| 465 | - |
|
| 466 | - if ( empty($style) ) { |
|
| 467 | - if ( FrmAppHelper::is_admin_page('formidable-entries') ) { |
|
| 468 | - return $class; |
|
| 469 | - } else { |
|
| 470 | - return; |
|
| 471 | - } |
|
| 472 | - } |
|
| 473 | - |
|
| 474 | - //If submit button needs to be inline or centered |
|
| 475 | - if ( is_object($form) ) { |
|
| 463 | + $style = self::get_form_style($form); |
|
| 464 | + $class = ' with_frm_style'; |
|
| 465 | + |
|
| 466 | + if ( empty($style) ) { |
|
| 467 | + if ( FrmAppHelper::is_admin_page('formidable-entries') ) { |
|
| 468 | + return $class; |
|
| 469 | + } else { |
|
| 470 | + return; |
|
| 471 | + } |
|
| 472 | + } |
|
| 473 | + |
|
| 474 | + //If submit button needs to be inline or centered |
|
| 475 | + if ( is_object($form) ) { |
|
| 476 | 476 | $form = $form->options; |
| 477 | 477 | } |
| 478 | 478 | |
@@ -484,17 +484,17 @@ discard block |
||
| 484 | 484 | $class .= ' frm_center_submit'; |
| 485 | 485 | } |
| 486 | 486 | |
| 487 | - $class = apply_filters('frm_add_form_style_class', $class, $style); |
|
| 487 | + $class = apply_filters('frm_add_form_style_class', $class, $style); |
|
| 488 | 488 | |
| 489 | - return $class; |
|
| 490 | - } |
|
| 489 | + return $class; |
|
| 490 | + } |
|
| 491 | 491 | |
| 492 | - /** |
|
| 493 | - * @param string|boolean $form |
|
| 494 | - * |
|
| 495 | - * @return string |
|
| 496 | - */ |
|
| 497 | - public static function get_form_style( $form ) { |
|
| 492 | + /** |
|
| 493 | + * @param string|boolean $form |
|
| 494 | + * |
|
| 495 | + * @return string |
|
| 496 | + */ |
|
| 497 | + public static function get_form_style( $form ) { |
|
| 498 | 498 | $style = 1; |
| 499 | 499 | if ( empty( $form ) || 'default' == 'form' ) { |
| 500 | 500 | return $style; |
@@ -514,7 +514,7 @@ discard block |
||
| 514 | 514 | $style = ( $form && is_object( $form ) && isset( $form->options['custom_style'] ) ) ? $form->options['custom_style'] : $style; |
| 515 | 515 | |
| 516 | 516 | return $style; |
| 517 | - } |
|
| 517 | + } |
|
| 518 | 518 | |
| 519 | 519 | /** |
| 520 | 520 | * Display the validation error messages when an entry is submitted |
@@ -576,72 +576,72 @@ discard block |
||
| 576 | 576 | } |
| 577 | 577 | |
| 578 | 578 | public static function get_scroll_js( $form_id ) { |
| 579 | - ?><script type="text/javascript">document.addEventListener('DOMContentLoaded',function(){frmFrontForm.scrollMsg(<?php echo (int) $form_id ?>);})</script><?php |
|
| 580 | - } |
|
| 579 | + ?><script type="text/javascript">document.addEventListener('DOMContentLoaded',function(){frmFrontForm.scrollMsg(<?php echo (int) $form_id ?>);})</script><?php |
|
| 580 | + } |
|
| 581 | 581 | |
| 582 | 582 | public static function edit_form_link( $form_id ) { |
| 583 | - if ( is_object($form_id) ) { |
|
| 584 | - $form = $form_id; |
|
| 585 | - $name = $form->name; |
|
| 586 | - $form_id = $form->id; |
|
| 587 | - } else { |
|
| 588 | - $name = FrmForm::getName($form_id); |
|
| 589 | - } |
|
| 590 | - |
|
| 591 | - if ( $form_id ) { |
|
| 583 | + if ( is_object($form_id) ) { |
|
| 584 | + $form = $form_id; |
|
| 585 | + $name = $form->name; |
|
| 586 | + $form_id = $form->id; |
|
| 587 | + } else { |
|
| 588 | + $name = FrmForm::getName($form_id); |
|
| 589 | + } |
|
| 590 | + |
|
| 591 | + if ( $form_id ) { |
|
| 592 | 592 | $val = '<a href="' . esc_url( admin_url( 'admin.php?page=formidable&frm_action=edit&id=' . $form_id ) ) . '">' . ( '' == $name ? __( '(no title)' ) : FrmAppHelper::truncate( $name, 40 ) ) . '</a>'; |
| 593 | - } else { |
|
| 594 | - $val = ''; |
|
| 595 | - } |
|
| 593 | + } else { |
|
| 594 | + $val = ''; |
|
| 595 | + } |
|
| 596 | 596 | |
| 597 | - return $val; |
|
| 597 | + return $val; |
|
| 598 | 598 | } |
| 599 | 599 | |
| 600 | 600 | public static function delete_trash_link( $id, $status, $length = 'long' ) { |
| 601 | - $link = ''; |
|
| 602 | - $labels = array( |
|
| 603 | - 'restore' => array( |
|
| 604 | - 'long' => __( 'Restore from Trash', 'formidable' ), |
|
| 605 | - 'short' => __( 'Restore', 'formidable' ), |
|
| 606 | - ), |
|
| 607 | - 'trash' => array( |
|
| 608 | - 'long' => __( 'Move to Trash', 'formidable' ), |
|
| 609 | - 'short' => __( 'Trash', 'formidable' ), |
|
| 610 | - ), |
|
| 611 | - 'delete' => array( |
|
| 612 | - 'long' => __( 'Delete Permanently', 'formidable' ), |
|
| 613 | - 'short' => __( 'Delete', 'formidable' ), |
|
| 614 | - ), |
|
| 615 | - ); |
|
| 616 | - |
|
| 617 | - $current_page = isset( $_REQUEST['form_type'] ) ? $_REQUEST['form_type'] : ''; |
|
| 601 | + $link = ''; |
|
| 602 | + $labels = array( |
|
| 603 | + 'restore' => array( |
|
| 604 | + 'long' => __( 'Restore from Trash', 'formidable' ), |
|
| 605 | + 'short' => __( 'Restore', 'formidable' ), |
|
| 606 | + ), |
|
| 607 | + 'trash' => array( |
|
| 608 | + 'long' => __( 'Move to Trash', 'formidable' ), |
|
| 609 | + 'short' => __( 'Trash', 'formidable' ), |
|
| 610 | + ), |
|
| 611 | + 'delete' => array( |
|
| 612 | + 'long' => __( 'Delete Permanently', 'formidable' ), |
|
| 613 | + 'short' => __( 'Delete', 'formidable' ), |
|
| 614 | + ), |
|
| 615 | + ); |
|
| 616 | + |
|
| 617 | + $current_page = isset( $_REQUEST['form_type'] ) ? $_REQUEST['form_type'] : ''; |
|
| 618 | 618 | $base_url = '?page=formidable&form_type=' . $current_page . '&id=' . $id; |
| 619 | - if ( 'trash' == $status ) { |
|
| 619 | + if ( 'trash' == $status ) { |
|
| 620 | 620 | $link = '<a href="' . esc_url( wp_nonce_url( $base_url . '&frm_action=untrash', 'untrash_form_' . $id ) ) . '" class="submitdelete deletion">' . $labels['restore'][ $length ] . '</a>'; |
| 621 | - } else if ( current_user_can('frm_delete_forms') ) { |
|
| 622 | - if ( EMPTY_TRASH_DAYS ) { |
|
| 621 | + } else if ( current_user_can('frm_delete_forms') ) { |
|
| 622 | + if ( EMPTY_TRASH_DAYS ) { |
|
| 623 | 623 | $link = '<a href="' . esc_url( wp_nonce_url( $base_url . '&frm_action=trash', 'trash_form_' . $id ) ) . '" class="submitdelete deletion">' . $labels['trash'][ $length ] . '</a>'; |
| 624 | - } else { |
|
| 624 | + } else { |
|
| 625 | 625 | $link = '<a href="' . esc_url( wp_nonce_url( $base_url . '&frm_action=destroy', 'destroy_form_' . $id ) ) . '" class="submitdelete deletion" onclick="return confirm(\'' . esc_attr( __( 'Are you sure you want to delete this form and all its entries?', 'formidable' ) ) . '\')">' . $labels['delete'][ $length ] . '</a>'; |
| 626 | - } |
|
| 627 | - } |
|
| 626 | + } |
|
| 627 | + } |
|
| 628 | 628 | |
| 629 | - return $link; |
|
| 630 | - } |
|
| 629 | + return $link; |
|
| 630 | + } |
|
| 631 | 631 | |
| 632 | 632 | public static function status_nice_name( $status ) { |
| 633 | - $nice_names = array( |
|
| 634 | - 'draft' => __( 'Draft', 'formidable' ), |
|
| 635 | - 'trash' => __( 'Trash', 'formidable' ), |
|
| 636 | - 'publish' => __( 'Published', 'formidable' ), |
|
| 637 | - ); |
|
| 638 | - |
|
| 639 | - if ( ! in_array($status, array_keys($nice_names)) ) { |
|
| 640 | - $status = 'publish'; |
|
| 641 | - } |
|
| 633 | + $nice_names = array( |
|
| 634 | + 'draft' => __( 'Draft', 'formidable' ), |
|
| 635 | + 'trash' => __( 'Trash', 'formidable' ), |
|
| 636 | + 'publish' => __( 'Published', 'formidable' ), |
|
| 637 | + ); |
|
| 638 | + |
|
| 639 | + if ( ! in_array($status, array_keys($nice_names)) ) { |
|
| 640 | + $status = 'publish'; |
|
| 641 | + } |
|
| 642 | 642 | |
| 643 | 643 | $name = $nice_names[ $status ]; |
| 644 | 644 | |
| 645 | - return $name; |
|
| 646 | - } |
|
| 645 | + return $name; |
|
| 646 | + } |
|
| 647 | 647 | } |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if ( ! defined('ABSPATH') ) { |
|
| 2 | +if ( ! defined( 'ABSPATH' ) ) { |
|
| 3 | 3 | die( 'You are not allowed to call this page directly.' ); |
| 4 | 4 | } |
| 5 | 5 | |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | |
| 15 | 15 | public static function get_direct_link( $key, $form = false ) { |
| 16 | 16 | $target_url = esc_url( admin_url( 'admin-ajax.php?action=frm_forms_preview&form=' . $key ) ); |
| 17 | - $target_url = apply_filters('frm_direct_link', $target_url, $key, $form); |
|
| 17 | + $target_url = apply_filters( 'frm_direct_link', $target_url, $key, $form ); |
|
| 18 | 18 | |
| 19 | 19 | return $target_url; |
| 20 | 20 | } |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | $query['id !'] = $args['exclude']; |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - $where = apply_filters('frm_forms_dropdown', $query, $field_name); |
|
| 42 | + $where = apply_filters( 'frm_forms_dropdown', $query, $field_name ); |
|
| 43 | 43 | $forms = FrmForm::get_published_forms( $where, 999, $args['inc_children'] ); |
| 44 | 44 | $add_html = array(); |
| 45 | 45 | self::add_html_attr( $args['onchange'], 'onchange', $add_html ); |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | <?php } ?> |
| 53 | 53 | <?php foreach ( $forms as $form ) { ?> |
| 54 | 54 | <option value="<?php echo esc_attr( $form->id ); ?>" <?php selected( $field_value, $form->id ); ?>><?php |
| 55 | - echo ( '' == $form->name ) ? esc_html__( '(no title)', 'formidable' ) : esc_html( FrmAppHelper::truncate( $form->name, 50 ) ) . ( $form->parent_form_id ? esc_html__( ' (child)', 'formidable' ) : '' ) ; |
|
| 55 | + echo ( '' == $form->name ) ? esc_html__( '(no title)', 'formidable' ) : esc_html( FrmAppHelper::truncate( $form->name, 50 ) ) . ( $form->parent_form_id ? esc_html__( ' (child)', 'formidable' ) : '' ); |
|
| 56 | 56 | ?></option> |
| 57 | 57 | <?php } ?> |
| 58 | 58 | </select> |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | */ |
| 69 | 69 | public static function add_html_attr( $class, $param, &$add_html ) { |
| 70 | 70 | if ( ! empty( $class ) ) { |
| 71 | - $add_html[ $param ] = sanitize_title( $param ) . '="' . esc_attr( trim( sanitize_text_field( $class ) ) ) . '"'; |
|
| 71 | + $add_html[$param] = sanitize_title( $param ) . '="' . esc_attr( trim( sanitize_text_field( $class ) ) ) . '"'; |
|
| 72 | 72 | } |
| 73 | 73 | } |
| 74 | 74 | |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | $args = array( 'id' => 0, 'form' => 0 ); |
| 80 | 80 | if ( isset( $_GET['id'] ) && ! isset( $_GET['form'] ) ) { |
| 81 | 81 | unset( $args['form'] ); |
| 82 | - } else if ( isset( $_GET['form']) && ! isset( $_GET['id'] ) ) { |
|
| 82 | + } else if ( isset( $_GET['form'] ) && ! isset( $_GET['id'] ) ) { |
|
| 83 | 83 | unset( $args['id'] ); |
| 84 | 84 | } |
| 85 | 85 | |
@@ -87,11 +87,11 @@ discard block |
||
| 87 | 87 | if ( FrmAppHelper::is_admin_page( 'formidable-entries' ) && in_array( $frm_action, array( 'edit', 'show', 'destroy_all' ) ) ) { |
| 88 | 88 | $args['frm_action'] = 'list'; |
| 89 | 89 | $args['form'] = 0; |
| 90 | - } else if ( FrmAppHelper::is_admin_page('formidable' ) && in_array( $frm_action, array( 'new', 'duplicate' ) ) ) { |
|
| 90 | + } else if ( FrmAppHelper::is_admin_page( 'formidable' ) && in_array( $frm_action, array( 'new', 'duplicate' ) ) ) { |
|
| 91 | 91 | $args['frm_action'] = 'edit'; |
| 92 | 92 | } else if ( isset( $_GET['post'] ) ) { |
| 93 | 93 | $args['form'] = 0; |
| 94 | - $base = admin_url('edit.php?post_type=frm_display'); |
|
| 94 | + $base = admin_url( 'edit.php?post_type=frm_display' ); |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | ?> |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | $args['form'] = $form->id; |
| 108 | 108 | } |
| 109 | 109 | ?> |
| 110 | - <li><a href="<?php echo esc_url( isset( $base ) ? add_query_arg( $args, $base ) : add_query_arg( $args ) ); ?>" tabindex="-1"><?php echo esc_html( empty( $form->name ) ? __( '(no title)') : FrmAppHelper::truncate( $form->name, 60 ) ); ?></a></li> |
|
| 110 | + <li><a href="<?php echo esc_url( isset( $base ) ? add_query_arg( $args, $base ) : add_query_arg( $args ) ); ?>" tabindex="-1"><?php echo esc_html( empty( $form->name ) ? __( '(no title)' ) : FrmAppHelper::truncate( $form->name, 60 ) ); ?></a></li> |
|
| 111 | 111 | <?php |
| 112 | 112 | unset( $form ); |
| 113 | 113 | } ?> |
@@ -117,8 +117,8 @@ discard block |
||
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | public static function get_sortable_classes( $col, $sort_col, $sort_dir ) { |
| 120 | - echo ($sort_col == $col) ? 'sorted' : 'sortable'; |
|
| 121 | - echo ($sort_col == $col && $sort_dir == 'desc') ? ' asc' : ' desc'; |
|
| 120 | + echo ( $sort_col == $col ) ? 'sorted' : 'sortable'; |
|
| 121 | + echo ( $sort_col == $col && $sort_dir == 'desc' ) ? ' asc' : ' desc'; |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | /** |
@@ -153,20 +153,20 @@ discard block |
||
| 153 | 153 | $post_values = $values; |
| 154 | 154 | } else { |
| 155 | 155 | $values = array(); |
| 156 | - $post_values = isset($_POST) ? $_POST : array(); |
|
| 156 | + $post_values = isset( $_POST ) ? $_POST : array(); |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | foreach ( array( 'name' => '', 'description' => '' ) as $var => $default ) { |
| 160 | - if ( ! isset( $values[ $var ] ) ) { |
|
| 161 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default ); |
|
| 160 | + if ( ! isset( $values[$var] ) ) { |
|
| 161 | + $values[$var] = FrmAppHelper::get_param( $var, $default ); |
|
| 162 | 162 | } |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | - $values['description'] = FrmAppHelper::use_wpautop($values['description']); |
|
| 165 | + $values['description'] = FrmAppHelper::use_wpautop( $values['description'] ); |
|
| 166 | 166 | |
| 167 | 167 | foreach ( array( 'form_id' => '', 'logged_in' => '', 'editable' => '', 'default_template' => 0, 'is_template' => 0, 'status' => 'draft', 'parent_form_id' => 0 ) as $var => $default ) { |
| 168 | - if ( ! isset( $values[ $var ] ) ) { |
|
| 169 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default ); |
|
| 168 | + if ( ! isset( $values[$var] ) ) { |
|
| 169 | + $values[$var] = FrmAppHelper::get_param( $var, $default ); |
|
| 170 | 170 | } |
| 171 | 171 | } |
| 172 | 172 | |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | $values = self::fill_default_opts( $values, false, $post_values ); |
| 178 | 178 | $values['custom_style'] = FrmAppHelper::custom_style_value( $post_values ); |
| 179 | 179 | |
| 180 | - return apply_filters('frm_setup_new_form_vars', $values); |
|
| 180 | + return apply_filters( 'frm_setup_new_form_vars', $values ); |
|
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | /** |
@@ -188,42 +188,42 @@ discard block |
||
| 188 | 188 | $post_values = stripslashes_deep( $_POST ); |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | - $values['form_key'] = isset($post_values['form_key']) ? $post_values['form_key'] : $record->form_key; |
|
| 192 | - $values['default_template'] = isset($post_values['default_template']) ? $post_values['default_template'] : $record->default_template; |
|
| 193 | - $values['is_template'] = isset($post_values['is_template']) ? $post_values['is_template'] : $record->is_template; |
|
| 191 | + $values['form_key'] = isset( $post_values['form_key'] ) ? $post_values['form_key'] : $record->form_key; |
|
| 192 | + $values['default_template'] = isset( $post_values['default_template'] ) ? $post_values['default_template'] : $record->default_template; |
|
| 193 | + $values['is_template'] = isset( $post_values['is_template'] ) ? $post_values['is_template'] : $record->is_template; |
|
| 194 | 194 | $values['status'] = $record->status; |
| 195 | 195 | |
| 196 | - $values = self::fill_default_opts($values, $record, $post_values); |
|
| 196 | + $values = self::fill_default_opts( $values, $record, $post_values ); |
|
| 197 | 197 | |
| 198 | - return apply_filters('frm_setup_edit_form_vars', $values); |
|
| 198 | + return apply_filters( 'frm_setup_edit_form_vars', $values ); |
|
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | public static function fill_default_opts( $values, $record, $post_values ) { |
| 202 | 202 | |
| 203 | 203 | $defaults = self::get_default_opts(); |
| 204 | 204 | foreach ( $defaults as $var => $default ) { |
| 205 | - if ( is_array($default) ) { |
|
| 206 | - if ( ! isset( $values[ $var ] ) ) { |
|
| 207 | - $values[ $var ] = ( $record && isset( $record->options[ $var ] ) ) ? $record->options[ $var ] : array(); |
|
| 205 | + if ( is_array( $default ) ) { |
|
| 206 | + if ( ! isset( $values[$var] ) ) { |
|
| 207 | + $values[$var] = ( $record && isset( $record->options[$var] ) ) ? $record->options[$var] : array(); |
|
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | foreach ( $default as $k => $v ) { |
| 211 | - $values[ $var ][ $k ] = ( $post_values && isset( $post_values[ $var ][ $k ] ) ) ? $post_values[ $var ][ $k ] : ( ( $record && isset( $record->options[ $var ] ) && isset( $record->options[ $var ][ $k ] ) ) ? $record->options[ $var ][ $k ] : $v); |
|
| 211 | + $values[$var][$k] = ( $post_values && isset( $post_values[$var][$k] ) ) ? $post_values[$var][$k] : ( ( $record && isset( $record->options[$var] ) && isset( $record->options[$var][$k] ) ) ? $record->options[$var][$k] : $v ); |
|
| 212 | 212 | |
| 213 | 213 | if ( is_array( $v ) ) { |
| 214 | 214 | foreach ( $v as $k1 => $v1 ) { |
| 215 | - $values[ $var ][ $k ][ $k1 ] = ( $post_values && isset( $post_values[ $var ][ $k ][ $k1 ] ) ) ? $post_values[ $var ][ $k ][ $k1 ] : ( ( $record && isset( $record->options[ $var ] ) && isset( $record->options[ $var ][ $k ] ) && isset( $record->options[ $var ][ $k ][ $k1 ] ) ) ? $record->options[ $var ][ $k ][ $k1 ] : $v1 ); |
|
| 215 | + $values[$var][$k][$k1] = ( $post_values && isset( $post_values[$var][$k][$k1] ) ) ? $post_values[$var][$k][$k1] : ( ( $record && isset( $record->options[$var] ) && isset( $record->options[$var][$k] ) && isset( $record->options[$var][$k][$k1] ) ) ? $record->options[$var][$k][$k1] : $v1 ); |
|
| 216 | 216 | unset( $k1, $v1 ); |
| 217 | 217 | } |
| 218 | 218 | } |
| 219 | 219 | |
| 220 | - unset($k, $v); |
|
| 220 | + unset( $k, $v ); |
|
| 221 | 221 | } |
| 222 | 222 | } else { |
| 223 | - $values[ $var ] = ( $post_values && isset( $post_values['options'][ $var ] ) ) ? $post_values['options'][ $var ] : ( ( $record && isset( $record->options[ $var ] ) ) ? $record->options[ $var ] : $default ); |
|
| 223 | + $values[$var] = ( $post_values && isset( $post_values['options'][$var] ) ) ? $post_values['options'][$var] : ( ( $record && isset( $record->options[$var] ) ) ? $record->options[$var] : $default ); |
|
| 224 | 224 | } |
| 225 | 225 | |
| 226 | - unset($var, $default); |
|
| 226 | + unset( $var, $default ); |
|
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | return $values; |
@@ -236,9 +236,9 @@ discard block |
||
| 236 | 236 | 'submit_value' => $frm_settings->submit_value, 'success_action' => 'message', |
| 237 | 237 | 'success_msg' => $frm_settings->success_msg, 'show_form' => 0, 'akismet' => '', |
| 238 | 238 | 'no_save' => 0, 'ajax_load' => 0, 'form_class' => '', 'custom_style' => 1, |
| 239 | - 'before_html' => self::get_default_html('before'), |
|
| 239 | + 'before_html' => self::get_default_html( 'before' ), |
|
| 240 | 240 | 'after_html' => '', |
| 241 | - 'submit_html' => self::get_default_html('submit'), |
|
| 241 | + 'submit_html' => self::get_default_html( 'submit' ), |
|
| 242 | 242 | ); |
| 243 | 243 | } |
| 244 | 244 | |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | public static function fill_form_options( &$options, $values ) { |
| 251 | 251 | $defaults = self::get_default_opts(); |
| 252 | 252 | foreach ( $defaults as $var => $default ) { |
| 253 | - $options[ $var ] = isset( $values['options'][ $var ] ) ? $values['options'][ $var ] : $default; |
|
| 253 | + $options[$var] = isset( $values['options'][$var] ) ? $values['options'][$var] : $default; |
|
| 254 | 254 | unset( $var, $default ); |
| 255 | 255 | } |
| 256 | 256 | } |
@@ -329,7 +329,7 @@ discard block |
||
| 329 | 329 | $last_field = false; |
| 330 | 330 | foreach ( $fields as $field ) { |
| 331 | 331 | if ( $prev_order === $field->field_order ) { |
| 332 | - $add_order++; |
|
| 332 | + $add_order ++; |
|
| 333 | 333 | } |
| 334 | 334 | |
| 335 | 335 | if ( $add_order ) { |
@@ -396,8 +396,8 @@ discard block |
||
| 396 | 396 | if ( $code == 'form_name' ) { |
| 397 | 397 | $replace_with = $form->name; |
| 398 | 398 | } else if ( $code == 'form_description' ) { |
| 399 | - $replace_with = FrmAppHelper::use_wpautop($form->description); |
|
| 400 | - } else if ( $code == 'entry_key' && isset($_GET) && isset($_GET['entry']) ) { |
|
| 399 | + $replace_with = FrmAppHelper::use_wpautop( $form->description ); |
|
| 400 | + } else if ( $code == 'entry_key' && isset( $_GET ) && isset( $_GET['entry'] ) ) { |
|
| 401 | 401 | $replace_with = FrmAppHelper::simple_get( 'entry' ); |
| 402 | 402 | } else { |
| 403 | 403 | $replace_with = ''; |
@@ -407,10 +407,10 @@ discard block |
||
| 407 | 407 | } |
| 408 | 408 | |
| 409 | 409 | //replace [form_key] |
| 410 | - $html = str_replace('[form_key]', $form->form_key, $html); |
|
| 410 | + $html = str_replace( '[form_key]', $form->form_key, $html ); |
|
| 411 | 411 | |
| 412 | 412 | //replace [frmurl] |
| 413 | - $html = str_replace('[frmurl]', FrmFieldsHelper::dynamic_default_values( 'frmurl' ), $html); |
|
| 413 | + $html = str_replace( '[frmurl]', FrmFieldsHelper::dynamic_default_values( 'frmurl' ), $html ); |
|
| 414 | 414 | |
| 415 | 415 | if ( strpos( $html, '[button_label]' ) ) { |
| 416 | 416 | add_filter( 'frm_submit_button', 'FrmFormsHelper::submit_button_label', 1 ); |
@@ -419,7 +419,7 @@ discard block |
||
| 419 | 419 | $html = str_replace( '[button_label]', $submit_label, $html ); |
| 420 | 420 | } |
| 421 | 421 | |
| 422 | - $html = apply_filters('frm_form_replace_shortcodes', $html, $form, $values); |
|
| 422 | + $html = apply_filters( 'frm_form_replace_shortcodes', $html, $form, $values ); |
|
| 423 | 423 | |
| 424 | 424 | if ( strpos( $html, '[if back_button]' ) ) { |
| 425 | 425 | $html = preg_replace( '/(\[if\s+back_button\])(.*?)(\[\/if\s+back_button\])/mis', '', $html ); |
@@ -437,7 +437,7 @@ discard block |
||
| 437 | 437 | } |
| 438 | 438 | |
| 439 | 439 | public static function submit_button_label( $submit ) { |
| 440 | - if ( ! $submit || empty($submit) ) { |
|
| 440 | + if ( ! $submit || empty( $submit ) ) { |
|
| 441 | 441 | $frm_settings = FrmAppHelper::get_settings(); |
| 442 | 442 | $submit = $frm_settings->submit_value; |
| 443 | 443 | } |
@@ -460,11 +460,11 @@ discard block |
||
| 460 | 460 | } |
| 461 | 461 | |
| 462 | 462 | public static function get_form_style_class( $form = false ) { |
| 463 | - $style = self::get_form_style($form); |
|
| 463 | + $style = self::get_form_style( $form ); |
|
| 464 | 464 | $class = ' with_frm_style'; |
| 465 | 465 | |
| 466 | - if ( empty($style) ) { |
|
| 467 | - if ( FrmAppHelper::is_admin_page('formidable-entries') ) { |
|
| 466 | + if ( empty( $style ) ) { |
|
| 467 | + if ( FrmAppHelper::is_admin_page( 'formidable-entries' ) ) { |
|
| 468 | 468 | return $class; |
| 469 | 469 | } else { |
| 470 | 470 | return; |
@@ -472,7 +472,7 @@ discard block |
||
| 472 | 472 | } |
| 473 | 473 | |
| 474 | 474 | //If submit button needs to be inline or centered |
| 475 | - if ( is_object($form) ) { |
|
| 475 | + if ( is_object( $form ) ) { |
|
| 476 | 476 | $form = $form->options; |
| 477 | 477 | } |
| 478 | 478 | |
@@ -484,7 +484,7 @@ discard block |
||
| 484 | 484 | $class .= ' frm_center_submit'; |
| 485 | 485 | } |
| 486 | 486 | |
| 487 | - $class = apply_filters('frm_add_form_style_class', $class, $style); |
|
| 487 | + $class = apply_filters( 'frm_add_form_style_class', $class, $style ); |
|
| 488 | 488 | |
| 489 | 489 | return $class; |
| 490 | 490 | } |
@@ -580,12 +580,12 @@ discard block |
||
| 580 | 580 | } |
| 581 | 581 | |
| 582 | 582 | public static function edit_form_link( $form_id ) { |
| 583 | - if ( is_object($form_id) ) { |
|
| 583 | + if ( is_object( $form_id ) ) { |
|
| 584 | 584 | $form = $form_id; |
| 585 | 585 | $name = $form->name; |
| 586 | 586 | $form_id = $form->id; |
| 587 | 587 | } else { |
| 588 | - $name = FrmForm::getName($form_id); |
|
| 588 | + $name = FrmForm::getName( $form_id ); |
|
| 589 | 589 | } |
| 590 | 590 | |
| 591 | 591 | if ( $form_id ) { |
@@ -617,12 +617,12 @@ discard block |
||
| 617 | 617 | $current_page = isset( $_REQUEST['form_type'] ) ? $_REQUEST['form_type'] : ''; |
| 618 | 618 | $base_url = '?page=formidable&form_type=' . $current_page . '&id=' . $id; |
| 619 | 619 | if ( 'trash' == $status ) { |
| 620 | - $link = '<a href="' . esc_url( wp_nonce_url( $base_url . '&frm_action=untrash', 'untrash_form_' . $id ) ) . '" class="submitdelete deletion">' . $labels['restore'][ $length ] . '</a>'; |
|
| 621 | - } else if ( current_user_can('frm_delete_forms') ) { |
|
| 620 | + $link = '<a href="' . esc_url( wp_nonce_url( $base_url . '&frm_action=untrash', 'untrash_form_' . $id ) ) . '" class="submitdelete deletion">' . $labels['restore'][$length] . '</a>'; |
|
| 621 | + } else if ( current_user_can( 'frm_delete_forms' ) ) { |
|
| 622 | 622 | if ( EMPTY_TRASH_DAYS ) { |
| 623 | - $link = '<a href="' . esc_url( wp_nonce_url( $base_url . '&frm_action=trash', 'trash_form_' . $id ) ) . '" class="submitdelete deletion">' . $labels['trash'][ $length ] . '</a>'; |
|
| 623 | + $link = '<a href="' . esc_url( wp_nonce_url( $base_url . '&frm_action=trash', 'trash_form_' . $id ) ) . '" class="submitdelete deletion">' . $labels['trash'][$length] . '</a>'; |
|
| 624 | 624 | } else { |
| 625 | - $link = '<a href="' . esc_url( wp_nonce_url( $base_url . '&frm_action=destroy', 'destroy_form_' . $id ) ) . '" class="submitdelete deletion" onclick="return confirm(\'' . esc_attr( __( 'Are you sure you want to delete this form and all its entries?', 'formidable' ) ) . '\')">' . $labels['delete'][ $length ] . '</a>'; |
|
| 625 | + $link = '<a href="' . esc_url( wp_nonce_url( $base_url . '&frm_action=destroy', 'destroy_form_' . $id ) ) . '" class="submitdelete deletion" onclick="return confirm(\'' . esc_attr( __( 'Are you sure you want to delete this form and all its entries?', 'formidable' ) ) . '\')">' . $labels['delete'][$length] . '</a>'; |
|
| 626 | 626 | } |
| 627 | 627 | } |
| 628 | 628 | |
@@ -636,11 +636,11 @@ discard block |
||
| 636 | 636 | 'publish' => __( 'Published', 'formidable' ), |
| 637 | 637 | ); |
| 638 | 638 | |
| 639 | - if ( ! in_array($status, array_keys($nice_names)) ) { |
|
| 639 | + if ( ! in_array( $status, array_keys( $nice_names ) ) ) { |
|
| 640 | 640 | $status = 'publish'; |
| 641 | 641 | } |
| 642 | 642 | |
| 643 | - $name = $nice_names[ $status ]; |
|
| 643 | + $name = $nice_names[$status]; |
|
| 644 | 644 | |
| 645 | 645 | return $name; |
| 646 | 646 | } |
@@ -253,6 +253,9 @@ discard block |
||
| 253 | 253 | <?php |
| 254 | 254 | } |
| 255 | 255 | |
| 256 | + /** |
|
| 257 | + * @param string $param_name |
|
| 258 | + */ |
|
| 256 | 259 | private function hidden_search_inputs( $param_name ) { |
| 257 | 260 | if ( ! empty( $_REQUEST[ $param_name ] ) ) { |
| 258 | 261 | echo '<input type="hidden" name="' . esc_attr( $param_name ) . '" value="' . esc_attr( $_REQUEST[ $param_name ] ) . '" />'; |
@@ -389,6 +392,9 @@ discard block |
||
| 389 | 392 | return $action; |
| 390 | 393 | } |
| 391 | 394 | |
| 395 | + /** |
|
| 396 | + * @param string $action_name |
|
| 397 | + */ |
|
| 392 | 398 | private static function get_bulk_action( $action_name ) { |
| 393 | 399 | $action = false; |
| 394 | 400 | if ( isset( $_REQUEST[ $action_name ] ) && -1 != sanitize_text_field( $_REQUEST[ $action_name ] ) ) { |
@@ -67,10 +67,10 @@ discard block |
||
| 67 | 67 | protected $modes = array(); |
| 68 | 68 | |
| 69 | 69 | /** |
| 70 | - * |
|
| 71 | - * @var array |
|
| 72 | - */ |
|
| 73 | - protected $params; |
|
| 70 | + * |
|
| 71 | + * @var array |
|
| 72 | + */ |
|
| 73 | + protected $params; |
|
| 74 | 74 | |
| 75 | 75 | /** |
| 76 | 76 | * Stores the value returned by ->get_column_info() |
@@ -89,10 +89,10 @@ discard block |
||
| 89 | 89 | ); |
| 90 | 90 | |
| 91 | 91 | /** |
| 92 | - * Construct the table object |
|
| 93 | - */ |
|
| 92 | + * Construct the table object |
|
| 93 | + */ |
|
| 94 | 94 | public function __construct( $args ) { |
| 95 | - $args = wp_parse_args( $args, array( |
|
| 95 | + $args = wp_parse_args( $args, array( |
|
| 96 | 96 | 'params' => array(), |
| 97 | 97 | 'plural' => '', |
| 98 | 98 | 'singular' => '', |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if ( ! defined('ABSPATH') ) { |
|
| 2 | +if ( ! defined( 'ABSPATH' ) ) { |
|
| 3 | 3 | die( 'You are not allowed to call this page directly.' ); |
| 4 | 4 | } |
| 5 | 5 | |
@@ -197,8 +197,8 @@ discard block |
||
| 197 | 197 | return $this->get_pagenum(); |
| 198 | 198 | } |
| 199 | 199 | |
| 200 | - if ( isset( $this->_pagination_args[ $key ] ) ) { |
|
| 201 | - return $this->_pagination_args[ $key ]; |
|
| 200 | + if ( isset( $this->_pagination_args[$key] ) ) { |
|
| 201 | + return $this->_pagination_args[$key]; |
|
| 202 | 202 | } |
| 203 | 203 | } |
| 204 | 204 | |
@@ -253,8 +253,8 @@ discard block |
||
| 253 | 253 | } |
| 254 | 254 | |
| 255 | 255 | private function hidden_search_inputs( $param_name ) { |
| 256 | - if ( ! empty( $_REQUEST[ $param_name ] ) ) { |
|
| 257 | - echo '<input type="hidden" name="' . esc_attr( $param_name ) . '" value="' . esc_attr( $_REQUEST[ $param_name ] ) . '" />'; |
|
| 256 | + if ( ! empty( $_REQUEST[$param_name] ) ) { |
|
| 257 | + echo '<input type="hidden" name="' . esc_attr( $param_name ) . '" value="' . esc_attr( $_REQUEST[$param_name] ) . '" />'; |
|
| 258 | 258 | } |
| 259 | 259 | } |
| 260 | 260 | |
@@ -297,7 +297,7 @@ discard block |
||
| 297 | 297 | |
| 298 | 298 | echo "<ul class='subsubsub'>\n"; |
| 299 | 299 | foreach ( $views as $class => $view ) { |
| 300 | - $views[ $class ] = "\t<li class='$class'>$view"; |
|
| 300 | + $views[$class] = "\t<li class='$class'>$view"; |
|
| 301 | 301 | } |
| 302 | 302 | echo implode( " |</li>\n", $views ) . "</li>\n"; |
| 303 | 303 | echo '</ul>'; |
@@ -392,8 +392,8 @@ discard block |
||
| 392 | 392 | |
| 393 | 393 | private static function get_bulk_action( $action_name ) { |
| 394 | 394 | $action = false; |
| 395 | - if ( isset( $_REQUEST[ $action_name ] ) && -1 != sanitize_text_field( $_REQUEST[ $action_name ] ) ) { |
|
| 396 | - $action = sanitize_text_field( $_REQUEST[ $action_name ] ); |
|
| 395 | + if ( isset( $_REQUEST[$action_name] ) && -1 != sanitize_text_field( $_REQUEST[$action_name] ) ) { |
|
| 396 | + $action = sanitize_text_field( $_REQUEST[$action_name] ); |
|
| 397 | 397 | } |
| 398 | 398 | return $action; |
| 399 | 399 | } |
@@ -418,7 +418,7 @@ discard block |
||
| 418 | 418 | |
| 419 | 419 | $out = '<div class="' . ( $always_visible ? 'row-actions visible' : 'row-actions' ) . '">'; |
| 420 | 420 | foreach ( $actions as $action => $link ) { |
| 421 | - ++$i; |
|
| 421 | + ++ $i; |
|
| 422 | 422 | ( $i == $action_count ) ? $sep = '' : $sep = ' | '; |
| 423 | 423 | $out .= "<span class='$action'>$link$sep</span>"; |
| 424 | 424 | } |
@@ -627,7 +627,7 @@ discard block |
||
| 627 | 627 | 'prev' => __( 'Previous page' ), |
| 628 | 628 | 'next' => __( 'Next page' ), |
| 629 | 629 | ); |
| 630 | - return $labels[ $link ]; |
|
| 630 | + return $labels[$link]; |
|
| 631 | 631 | } |
| 632 | 632 | |
| 633 | 633 | private function current_url() { |
@@ -715,7 +715,7 @@ discard block |
||
| 715 | 715 | |
| 716 | 716 | // If the primary column doesn't exist fall back to the |
| 717 | 717 | // first non-checkbox column. |
| 718 | - if ( ! isset( $columns[ $default ] ) ) { |
|
| 718 | + if ( ! isset( $columns[$default] ) ) { |
|
| 719 | 719 | $default = FrmListHelper::get_default_primary_column_name(); |
| 720 | 720 | } |
| 721 | 721 | |
@@ -729,7 +729,7 @@ discard block |
||
| 729 | 729 | */ |
| 730 | 730 | $column = apply_filters( 'list_table_primary_column', $default, $this->screen->id ); |
| 731 | 731 | |
| 732 | - if ( empty( $column ) || ! isset( $columns[ $column ] ) ) { |
|
| 732 | + if ( empty( $column ) || ! isset( $columns[$column] ) ) { |
|
| 733 | 733 | $column = $default; |
| 734 | 734 | } |
| 735 | 735 | |
@@ -751,7 +751,7 @@ discard block |
||
| 751 | 751 | // In 4.3, we added a fourth argument for primary column. |
| 752 | 752 | $column_headers = array( array(), array(), array(), $this->get_primary_column_name() ); |
| 753 | 753 | foreach ( $this->_column_headers as $key => $value ) { |
| 754 | - $column_headers[ $key ] = $value; |
|
| 754 | + $column_headers[$key] = $value; |
|
| 755 | 755 | } |
| 756 | 756 | |
| 757 | 757 | return $column_headers; |
@@ -784,7 +784,7 @@ discard block |
||
| 784 | 784 | $data[1] = false; |
| 785 | 785 | } |
| 786 | 786 | |
| 787 | - $sortable[ $id ] = $data; |
|
| 787 | + $sortable[$id] = $data; |
|
| 788 | 788 | } |
| 789 | 789 | |
| 790 | 790 | $primary = $this->get_primary_column_name(); |
@@ -839,7 +839,7 @@ discard block |
||
| 839 | 839 | static $cb_counter = 1; |
| 840 | 840 | $columns['cb'] = '<label class="screen-reader-text" for="cb-select-all-' . $cb_counter . '">' . __( 'Select All' ) . '</label>' |
| 841 | 841 | . '<input id="cb-select-all-' . esc_attr( $cb_counter ) . '" type="checkbox" />'; |
| 842 | - $cb_counter++; |
|
| 842 | + $cb_counter ++; |
|
| 843 | 843 | } |
| 844 | 844 | |
| 845 | 845 | foreach ( $columns as $column_key => $column_display_name ) { |
@@ -859,8 +859,8 @@ discard block |
||
| 859 | 859 | $class[] = 'column-primary'; |
| 860 | 860 | } |
| 861 | 861 | |
| 862 | - if ( isset( $sortable[ $column_key ] ) ) { |
|
| 863 | - list( $orderby, $desc_first ) = $sortable[ $column_key ]; |
|
| 862 | + if ( isset( $sortable[$column_key] ) ) { |
|
| 863 | + list( $orderby, $desc_first ) = $sortable[$column_key]; |
|
| 864 | 864 | |
| 865 | 865 | if ( $current_orderby == $orderby ) { |
| 866 | 866 | $order = 'asc' == $current_order ? 'desc' : 'asc'; |
@@ -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> |
@@ -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 " |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | header( 'Content-Description: File Transfer' ); |
| 65 | 65 | header( 'Content-Disposition: attachment; filename="' . esc_attr( $filename ) . '"' ); |
| 66 | 66 | header( 'Content-Type: text/csv; charset=' . self::$charset, true ); |
| 67 | - 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 | + 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' ); |
|
| 68 | 68 | header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s' ) . ' GMT' ); |
| 69 | 69 | header( 'Cache-Control: no-cache, must-revalidate' ); |
| 70 | 70 | header( 'Pragma: no-cache' ); |
@@ -91,21 +91,21 @@ discard block |
||
| 91 | 91 | foreach ( self::$fields as $col ) { |
| 92 | 92 | $field_headings = array(); |
| 93 | 93 | if ( isset( $col->field_options['separate_value'] ) && $col->field_options['separate_value'] && ! in_array( $col->type, array( 'user_id', 'file', 'data', 'date' ) ) ) { |
| 94 | - $field_headings[ $col->id . '_label' ] = strip_tags( $col->name . ' ' . __( '(label)', 'formidable' ) ); |
|
| 94 | + $field_headings[$col->id . '_label'] = strip_tags( $col->name . ' ' . __( '(label)', 'formidable' ) ); |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | - $field_headings[ $col->id ] = strip_tags( $col->name ); |
|
| 97 | + $field_headings[$col->id] = strip_tags( $col->name ); |
|
| 98 | 98 | $field_headings = apply_filters( 'frm_csv_field_columns', $field_headings, array( 'field' => $col ) ); |
| 99 | 99 | $headings += $field_headings; |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | if ( self::$comment_count ) { |
| 103 | - for ( $i = 0; $i < self::$comment_count; $i++ ) { |
|
| 104 | - $headings[ 'comment' . $i ] = __( 'Comment', 'formidable' ); |
|
| 105 | - $headings[ 'comment_user_id' . $i ] = __( 'Comment User', 'formidable' ); |
|
| 106 | - $headings[ 'comment_created_at' . $i ] = __( 'Comment Date', 'formidable' ); |
|
| 103 | + for ( $i = 0; $i < self::$comment_count; $i ++ ) { |
|
| 104 | + $headings['comment' . $i] = __( 'Comment', 'formidable' ); |
|
| 105 | + $headings['comment_user_id' . $i] = __( 'Comment User', 'formidable' ); |
|
| 106 | + $headings['comment_created_at' . $i] = __( 'Comment Date', 'formidable' ); |
|
| 107 | 107 | } |
| 108 | - unset($i); |
|
| 108 | + unset( $i ); |
|
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | $headings['created_at'] = __( 'Timestamp', 'formidable' ); |
@@ -152,30 +152,30 @@ discard block |
||
| 152 | 152 | continue; |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | - if ( ! isset( $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] ) ) { |
|
| 156 | - $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] = array(); |
|
| 157 | - } else if ( ! is_array( $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] ) ) { |
|
| 155 | + if ( ! isset( $entries[self::$entry->parent_item_id]->metas[$meta_id] ) ) { |
|
| 156 | + $entries[self::$entry->parent_item_id]->metas[$meta_id] = array(); |
|
| 157 | + } else if ( ! is_array( $entries[self::$entry->parent_item_id]->metas[$meta_id] ) ) { |
|
| 158 | 158 | // if the data is here, it should be an array but if this field has collected data |
| 159 | 159 | // both while inside and outside of the repeating section, it's possible this is a string |
| 160 | - $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] = (array) $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ]; |
|
| 160 | + $entries[self::$entry->parent_item_id]->metas[$meta_id] = (array) $entries[self::$entry->parent_item_id]->metas[$meta_id]; |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | //add the repeated values |
| 164 | - $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ][] = $meta_value; |
|
| 164 | + $entries[self::$entry->parent_item_id]->metas[$meta_id][] = $meta_value; |
|
| 165 | 165 | } |
| 166 | - $entries[ self::$entry->parent_item_id ]->metas += self::$entry->metas; |
|
| 166 | + $entries[self::$entry->parent_item_id]->metas += self::$entry->metas; |
|
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | // add the embedded form id |
| 170 | - if ( ! isset( $entries[ self::$entry->parent_item_id ]->embedded_fields ) ) { |
|
| 171 | - $entries[ self::$entry->parent_item_id ]->embedded_fields = array(); |
|
| 170 | + if ( ! isset( $entries[self::$entry->parent_item_id]->embedded_fields ) ) { |
|
| 171 | + $entries[self::$entry->parent_item_id]->embedded_fields = array(); |
|
| 172 | 172 | } |
| 173 | - $entries[ self::$entry->parent_item_id ]->embedded_fields[ self::$entry->id ] = self::$entry->form_id; |
|
| 173 | + $entries[self::$entry->parent_item_id]->embedded_fields[self::$entry->id] = self::$entry->form_id; |
|
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 | private static function add_field_values_to_csv( &$row ) { |
| 177 | 177 | foreach ( self::$fields as $col ) { |
| 178 | - $field_value = isset( self::$entry->metas[ $col->id ] ) ? self::$entry->metas[ $col->id ] : false; |
|
| 178 | + $field_value = isset( self::$entry->metas[$col->id] ) ? self::$entry->metas[$col->id] : false; |
|
| 179 | 179 | |
| 180 | 180 | $field_value = maybe_unserialize( $field_value ); |
| 181 | 181 | self::add_array_values_to_columns( $row, compact( 'col', 'field_value' ) ); |
@@ -186,13 +186,13 @@ discard block |
||
| 186 | 186 | $sep_value = FrmEntriesHelper::display_value( $field_value, $col, array( |
| 187 | 187 | 'type' => $col->type, 'post_id' => self::$entry->post_id, 'show_icon' => false, |
| 188 | 188 | 'entry_id' => self::$entry->id, 'sep' => self::$separator, |
| 189 | - '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, |
|
| 189 | + '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, |
|
| 190 | 190 | ) ); |
| 191 | - $row[ $col->id . '_label' ] = $sep_value; |
|
| 191 | + $row[$col->id . '_label'] = $sep_value; |
|
| 192 | 192 | unset( $sep_value ); |
| 193 | 193 | } |
| 194 | 194 | |
| 195 | - $row[ $col->id ] = $field_value; |
|
| 195 | + $row[$col->id] = $field_value; |
|
| 196 | 196 | |
| 197 | 197 | unset( $col, $field_value ); |
| 198 | 198 | } |
@@ -205,8 +205,8 @@ discard block |
||
| 205 | 205 | if ( is_array( $atts['field_value'] ) ) { |
| 206 | 206 | foreach ( $atts['field_value'] as $key => $sub_value ) { |
| 207 | 207 | $column_key = $atts['col']->id . '_' . $key; |
| 208 | - if ( ! is_numeric( $key ) && isset( self::$headings[ $column_key ] ) ) { |
|
| 209 | - $row[ $column_key ] = $sub_value; |
|
| 208 | + if ( ! is_numeric( $key ) && isset( self::$headings[$column_key] ) ) { |
|
| 209 | + $row[$column_key] = $sub_value; |
|
| 210 | 210 | } |
| 211 | 211 | } |
| 212 | 212 | } |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | $sep = ''; |
| 228 | 228 | |
| 229 | 229 | foreach ( self::$headings as $k => $heading ) { |
| 230 | - $row = isset( $rows[ $k ] ) ? $rows[ $k ] : ''; |
|
| 230 | + $row = isset( $rows[$k] ) ? $rows[$k] : ''; |
|
| 231 | 231 | if ( is_array( $row ) ) { |
| 232 | 232 | // implode the repeated field values |
| 233 | 233 | $row = implode( self::$separator, FrmAppHelper::array_flatten( $row, 'reset' ) ); |
@@ -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 ) ) { |
@@ -239,16 +239,16 @@ discard block |
||
| 239 | 239 | |
| 240 | 240 | return array( |
| 241 | 241 | 'content' => '<h3>' . __( 'Forms', 'formidable' ) . '</h3>' |
| 242 | - . '<p>' . __( 'All your forms will be listed on this page. Create your first form by clicking on the "Add New" button.', 'formidable' ) . '</p>' |
|
| 243 | - . '<p><strong>' . __( 'Subscribe to our Newsletter', 'formidable' ) . '</strong><br/>' |
|
| 244 | - . sprintf( __( 'If you would like to hear about new features and updates for %1$s, subscribe to our newsletter:', 'formidable' ), 'Formidable' ) . '</p>' |
|
| 245 | - . '<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' ) ) . '">' |
|
| 246 | - . '<p>' |
|
| 247 | - . '<input style="margin: 5px; color:#666" name="EMAIL" value="' . esc_attr( $current_user->user_email ) . '" selector="newsletter-email" placeholder="' . esc_attr__( 'Email', 'formidable' ) . '"/>' |
|
| 242 | + . '<p>' . __( 'All your forms will be listed on this page. Create your first form by clicking on the "Add New" button.', 'formidable' ) . '</p>' |
|
| 243 | + . '<p><strong>' . __( 'Subscribe to our Newsletter', 'formidable' ) . '</strong><br/>' |
|
| 244 | + . sprintf( __( 'If you would like to hear about new features and updates for %1$s, subscribe to our newsletter:', 'formidable' ), 'Formidable' ) . '</p>' |
|
| 245 | + . '<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' ) ) . '">' |
|
| 246 | + . '<p>' |
|
| 247 | + . '<input style="margin: 5px; color:#666" name="EMAIL" value="' . esc_attr( $current_user->user_email ) . '" selector="newsletter-email" placeholder="' . esc_attr__( 'Email', 'formidable' ) . '"/>' |
|
| 248 | 248 | . '<input type="hidden" name="group[4505]" value="4" />' |
| 249 | - . '<button type="submit" class="button-primary">' . esc_html__( 'Subscribe', 'formidable' ) . '</button>' |
|
| 250 | - . '</p>' |
|
| 251 | - . '</form>', |
|
| 249 | + . '<button type="submit" class="button-primary">' . esc_html__( 'Subscribe', 'formidable' ) . '</button>' |
|
| 250 | + . '</p>' |
|
| 251 | + . '</form>', |
|
| 252 | 252 | 'next_page' => 'entries', |
| 253 | 253 | ); |
| 254 | 254 | } |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | private function entries_pointer() { |
| 262 | 262 | return array( |
| 263 | 263 | 'content' => '<h3>' . __( 'Entries', 'formidable' ) . '</h3>' |
| 264 | - . '<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>', |
|
| 264 | + . '<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>', |
|
| 265 | 265 | 'prev_page' => '', |
| 266 | 266 | 'next_page' => 'styles', |
| 267 | 267 | 'selector' => '.wp-list-table', |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | private function styles_pointer() { |
| 278 | 278 | return array( |
| 279 | 279 | 'content' => '<h3>' . __( 'Styles', 'formidable' ) . '</h3>' |
| 280 | - . '<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>', |
|
| 280 | + . '<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>', |
|
| 281 | 281 | 'prev_page' => 'entries', |
| 282 | 282 | 'next_page' => 'import', |
| 283 | 283 | 'selector' => '.general-style', |
@@ -293,7 +293,7 @@ discard block |
||
| 293 | 293 | private function import_pointer() { |
| 294 | 294 | return array( |
| 295 | 295 | 'content' => '<h3>' . __( 'Import/Export', 'formidable' ) . '</h3>' |
| 296 | - . '<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>', |
|
| 296 | + . '<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>', |
|
| 297 | 297 | 'prev_page' => 'styles', |
| 298 | 298 | 'next_page' => 'settings', |
| 299 | 299 | 'selector' => '.inside.with_frm_style', |
@@ -313,7 +313,7 @@ discard block |
||
| 313 | 313 | . __( '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' ) |
| 314 | 314 | . '<p><strong>' . __( 'Plugin Licenses', 'formidable' ) . '</strong><br/>' |
| 315 | 315 | . 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' ) |
| 316 | - . '</p>', |
|
| 316 | + . '</p>', |
|
| 317 | 317 | 'prev_page' => 'import', |
| 318 | 318 | 'next_page' => 'addons', |
| 319 | 319 | ); |
@@ -327,10 +327,10 @@ discard block |
||
| 327 | 327 | private function addons_pointer() { |
| 328 | 328 | return array( |
| 329 | 329 | 'content' => '<h3>' . __( 'Addons', 'formidable' ) . '</h3>' |
| 330 | - . '<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://formidableforms.com/' ) ) . '">', '</a>' ) |
|
| 330 | + . '<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://formidableforms.com/' ) ) . '">', '</a>' ) |
|
| 331 | 331 | . '</p>' |
| 332 | - . '<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 %1$srate it 5 stars on WordPress.org%2$s!', 'formidable' ), '<a target="_blank" href="https://wordpress.org/plugins/formidable/">', '</a>' ) . '</p>' |
|
| 333 | - . '<p>' . sprintf( __( 'Thank you for using our plugin and good luck with your forms!<br/><br/>Best,<br/>Team Formidable - %1$sformidableforms.com%2$s', 'formidable' ), '<a target="_blank" href="' . esc_url( FrmAppHelper::make_affiliate_url( 'https://formidableforms.com/' ) ) . '">', '</a>' ) . '</p>', |
|
| 332 | + . '<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 %1$srate it 5 stars on WordPress.org%2$s!', 'formidable' ), '<a target="_blank" href="https://wordpress.org/plugins/formidable/">', '</a>' ) . '</p>' |
|
| 333 | + . '<p>' . sprintf( __( 'Thank you for using our plugin and good luck with your forms!<br/><br/>Best,<br/>Team Formidable - %1$sformidableforms.com%2$s', 'formidable' ), '<a target="_blank" href="' . esc_url( FrmAppHelper::make_affiliate_url( 'https://formidableforms.com/' ) ) . '">', '</a>' ) . '</p>', |
|
| 334 | 334 | 'prev_page' => 'settings', |
| 335 | 335 | ); |
| 336 | 336 | } |
@@ -188,7 +188,7 @@ |
||
| 188 | 188 | * @param string $page Admin page key. |
| 189 | 189 | */ |
| 190 | 190 | private function do_page_pointer( $page ) { |
| 191 | - $pointer = call_user_func( array( $this, $this->admin_pages[ $page ] ) ); |
|
| 191 | + $pointer = call_user_func( array( $this, $this->admin_pages[$page] ) ); |
|
| 192 | 192 | |
| 193 | 193 | $opt_arr = array( |
| 194 | 194 | 'content' => $pointer['content'], |
@@ -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 --> |
@@ -1,59 +1,59 @@ |
||
| 1 | 1 | <p> |
| 2 | - <label><input type="checkbox" name="<?php echo esc_attr( $frm_style->get_field_name('center_form') ) ?>" id="frm_center_form" value="1" <?php checked($style->post_content['center_form'], 1) ?> /> |
|
| 2 | + <label><input type="checkbox" name="<?php echo esc_attr( $frm_style->get_field_name( 'center_form' ) ) ?>" id="frm_center_form" value="1" <?php checked( $style->post_content['center_form'], 1 ) ?> /> |
|
| 3 | 3 | <?php _e( 'Center form on page', 'formidable' ) ?> <span class="frm_help frm_icon_font frm_tooltip_icon" title="<?php esc_attr_e( 'This will center your form on the page where it is published if the form width is less than the available width on the page.', 'formidable' ) ?>" ></span> |
| 4 | 4 | </label> |
| 5 | 5 | </p> |
| 6 | 6 | |
| 7 | 7 | <div class="field-group clearfix frm-first-row"> |
| 8 | 8 | <label><?php _e( 'Alignment', 'formidable' ) ?></label> |
| 9 | - <select name="<?php echo esc_attr( $frm_style->get_field_name('form_align') ) ?>" id="frm_form_align"> |
|
| 10 | - <option value="left" <?php selected($style->post_content['form_align'], 'left') ?>><?php _e( 'left', 'formidable' ) ?></option> |
|
| 11 | - <option value="right" <?php selected($style->post_content['form_align'], 'right') ?>><?php _e( 'right', 'formidable' ) ?></option> |
|
| 12 | - <option value="center" <?php selected($style->post_content['form_align'], 'center') ?>><?php _e( 'center', 'formidable' ) ?></option> |
|
| 9 | + <select name="<?php echo esc_attr( $frm_style->get_field_name( 'form_align' ) ) ?>" id="frm_form_align"> |
|
| 10 | + <option value="left" <?php selected( $style->post_content['form_align'], 'left' ) ?>><?php _e( 'left', 'formidable' ) ?></option> |
|
| 11 | + <option value="right" <?php selected( $style->post_content['form_align'], 'right' ) ?>><?php _e( 'right', 'formidable' ) ?></option> |
|
| 12 | + <option value="center" <?php selected( $style->post_content['form_align'], 'center' ) ?>><?php _e( 'center', 'formidable' ) ?></option> |
|
| 13 | 13 | </select> |
| 14 | 14 | </div> |
| 15 | 15 | |
| 16 | 16 | <div class="field-group clearfix frm-first-row"> |
| 17 | 17 | <label><?php _e( 'Max Width', 'formidable' ) ?></label> |
| 18 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('form_width') ) ?>" value="<?php echo esc_attr( $style->post_content['form_width'] ) ?>"/> |
|
| 18 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'form_width' ) ) ?>" value="<?php echo esc_attr( $style->post_content['form_width'] ) ?>"/> |
|
| 19 | 19 | </div> |
| 20 | 20 | |
| 21 | 21 | <div class="field-group clearfix frm-first-row"> |
| 22 | 22 | <label><?php _e( 'Background', 'formidable' ) ?></label> |
| 23 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('fieldset_bg_color') ) ?>" id="frm_fieldset_bg_color" class="hex" value="<?php echo esc_attr( $style->post_content['fieldset_bg_color'] ) ?>" size="4" /> |
|
| 23 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'fieldset_bg_color' ) ) ?>" id="frm_fieldset_bg_color" class="hex" value="<?php echo esc_attr( $style->post_content['fieldset_bg_color'] ) ?>" size="4" /> |
|
| 24 | 24 | </div> |
| 25 | 25 | |
| 26 | 26 | <div class="field-group field-group-border clearfix"> |
| 27 | 27 | <label><?php _e( 'Border', 'formidable' ) ?></label> |
| 28 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('fieldset') ) ?>" id="frm_fieldset" value="<?php echo esc_attr( $style->post_content['fieldset'] ) ?>" size="4" /> |
|
| 28 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'fieldset' ) ) ?>" id="frm_fieldset" value="<?php echo esc_attr( $style->post_content['fieldset'] ) ?>" size="4" /> |
|
| 29 | 29 | </div> |
| 30 | 30 | |
| 31 | 31 | <div class="field-group clearfix"> |
| 32 | 32 | <label><?php _e( 'Color', 'formidable' ) ?></label> |
| 33 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('fieldset_color') ) ?>" id="frm_fieldset_color" class="hex" value="<?php echo esc_attr( $style->post_content['fieldset_color'] ) ?>" /> |
|
| 33 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'fieldset_color' ) ) ?>" id="frm_fieldset_color" class="hex" value="<?php echo esc_attr( $style->post_content['fieldset_color'] ) ?>" /> |
|
| 34 | 34 | </div> |
| 35 | 35 | |
| 36 | 36 | <div class="field-group clearfix"> |
| 37 | 37 | <label><?php _e( 'Padding', 'formidable' ) ?></label> |
| 38 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('fieldset_padding') ) ?>" id="frm_fieldset_padding" value="<?php echo esc_attr( $style->post_content['fieldset_padding'] ) ?>" size="4" /> |
|
| 38 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'fieldset_padding' ) ) ?>" id="frm_fieldset_padding" value="<?php echo esc_attr( $style->post_content['fieldset_padding'] ) ?>" size="4" /> |
|
| 39 | 39 | </div> |
| 40 | 40 | |
| 41 | 41 | <div id="frm_gen_font_box" class="field-group clearfix"> |
| 42 | 42 | <label><?php _e( 'Font Family', 'formidable' ) ?></label> |
| 43 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('font') ) ?>" id="frm_font" value="<?php echo esc_attr( $style->post_content['font'] ) ?>" class="frm_full_width" /> |
|
| 43 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'font' ) ) ?>" id="frm_font" value="<?php echo esc_attr( $style->post_content['font'] ) ?>" class="frm_full_width" /> |
|
| 44 | 44 | </div> |
| 45 | 45 | |
| 46 | 46 | <div class="field-group clearfix frm-half"> |
| 47 | 47 | <label><?php _e( 'Direction', 'formidable' ) ?></label> |
| 48 | - <select name="<?php echo esc_attr( $frm_style->get_field_name('direction') ) ?>" id="frm_direction"> |
|
| 49 | - <option value="ltr" <?php selected($style->post_content['direction'], 'ltr') ?>><?php _e( 'Left to Right', 'formidable' ) ?></option> |
|
| 50 | - <option value="rtl" <?php selected($style->post_content['direction'], 'rtl') ?>><?php _e( 'Right to Left', 'formidable' ) ?></option> |
|
| 48 | + <select name="<?php echo esc_attr( $frm_style->get_field_name( 'direction' ) ) ?>" id="frm_direction"> |
|
| 49 | + <option value="ltr" <?php selected( $style->post_content['direction'], 'ltr' ) ?>><?php _e( 'Left to Right', 'formidable' ) ?></option> |
|
| 50 | + <option value="rtl" <?php selected( $style->post_content['direction'], 'rtl' ) ?>><?php _e( 'Right to Left', 'formidable' ) ?></option> |
|
| 51 | 51 | </select> |
| 52 | 52 | </div> |
| 53 | 53 | |
| 54 | 54 | <div class="clear"></div> |
| 55 | 55 | <p class="frm_no_bottom_margin"> |
| 56 | - <label><input type="checkbox" name="<?php echo esc_attr( $frm_style->get_field_name('important_style') ) ?>" id="frm_important_style" value="1" <?php checked($style->post_content['important_style'], 1) ?> /> |
|
| 56 | + <label><input type="checkbox" name="<?php echo esc_attr( $frm_style->get_field_name( 'important_style' ) ) ?>" id="frm_important_style" value="1" <?php checked( $style->post_content['important_style'], 1 ) ?> /> |
|
| 57 | 57 | <?php _e( 'Override theme styling', 'formidable' ) ?> <span class="frm_help frm_icon_font frm_tooltip_icon" title="<?php esc_attr_e( 'This will add !important to many of the lines in the Formidable styling to make sure it will be used.', 'formidable' ) ?>" ></span> |
| 58 | 58 | </label> |
| 59 | 59 | </p> |
@@ -121,6 +121,9 @@ |
||
| 121 | 121 | $stylesheet_urls['formidable'] = $url; |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | + /** |
|
| 125 | + * @param string $version |
|
| 126 | + */ |
|
| 124 | 127 | private static function get_css_version( $css_key, $version ) { |
| 125 | 128 | if ( 'formidable' == $css_key ) { |
| 126 | 129 | $this_version = get_option( 'frm_last_style_update' ); |
@@ -1,21 +1,21 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | class FrmStylesController { |
| 4 | - public static $post_type = 'frm_styles'; |
|
| 5 | - public static $screen = 'formidable_page_formidable-styles'; |
|
| 6 | - |
|
| 7 | - public static function load_pro_hooks() { |
|
| 8 | - if ( FrmAppHelper::pro_is_installed() ) { |
|
| 9 | - FrmProStylesController::load_pro_hooks(); |
|
| 10 | - } |
|
| 11 | - } |
|
| 12 | - |
|
| 13 | - public static function register_post_types() { |
|
| 14 | - register_post_type( self::$post_type, array( |
|
| 15 | - 'label' => __( 'Styles', 'formidable' ), |
|
| 16 | - 'public' => false, |
|
| 17 | - 'show_ui' => false, |
|
| 18 | - 'capability_type' => 'page', |
|
| 4 | + public static $post_type = 'frm_styles'; |
|
| 5 | + public static $screen = 'formidable_page_formidable-styles'; |
|
| 6 | + |
|
| 7 | + public static function load_pro_hooks() { |
|
| 8 | + if ( FrmAppHelper::pro_is_installed() ) { |
|
| 9 | + FrmProStylesController::load_pro_hooks(); |
|
| 10 | + } |
|
| 11 | + } |
|
| 12 | + |
|
| 13 | + public static function register_post_types() { |
|
| 14 | + register_post_type( self::$post_type, array( |
|
| 15 | + 'label' => __( 'Styles', 'formidable' ), |
|
| 16 | + 'public' => false, |
|
| 17 | + 'show_ui' => false, |
|
| 18 | + 'capability_type' => 'page', |
|
| 19 | 19 | 'capabilities' => array( |
| 20 | 20 | 'edit_post' => 'frm_change_settings', |
| 21 | 21 | 'edit_posts' => 'frm_change_settings', |
@@ -25,11 +25,11 @@ discard block |
||
| 25 | 25 | 'delete_posts' => 'frm_change_settings', |
| 26 | 26 | 'read_private_posts' => 'read_private_posts', |
| 27 | 27 | ), |
| 28 | - 'supports' => array( |
|
| 28 | + 'supports' => array( |
|
| 29 | 29 | 'title', |
| 30 | - ), |
|
| 31 | - 'has_archive' => false, |
|
| 32 | - 'labels' => array( |
|
| 30 | + ), |
|
| 31 | + 'has_archive' => false, |
|
| 32 | + 'labels' => array( |
|
| 33 | 33 | 'name' => __( 'Styles', 'formidable' ), |
| 34 | 34 | 'singular_name' => __( 'Style', 'formidable' ), |
| 35 | 35 | 'menu_name' => __( 'Style', 'formidable' ), |
@@ -37,19 +37,19 @@ discard block |
||
| 37 | 37 | 'add_new_item' => __( 'Create a New Style', 'formidable' ), |
| 38 | 38 | 'edit_item' => __( 'Edit Style', 'formidable' ), |
| 39 | 39 | ), |
| 40 | - ) ); |
|
| 41 | - } |
|
| 40 | + ) ); |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | - public static function menu() { |
|
| 43 | + public static function menu() { |
|
| 44 | 44 | add_submenu_page('formidable', 'Formidable | ' . __( 'Styles', 'formidable' ), __( 'Styles', 'formidable' ), 'frm_change_settings', 'formidable-styles', 'FrmStylesController::route' ); |
| 45 | - } |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | - public static function admin_init() { |
|
| 48 | - if ( ! FrmAppHelper::is_admin_page('formidable-styles') ) { |
|
| 49 | - return; |
|
| 50 | - } |
|
| 47 | + public static function admin_init() { |
|
| 48 | + if ( ! FrmAppHelper::is_admin_page('formidable-styles') ) { |
|
| 49 | + return; |
|
| 50 | + } |
|
| 51 | 51 | |
| 52 | - self::load_pro_hooks(); |
|
| 52 | + self::load_pro_hooks(); |
|
| 53 | 53 | |
| 54 | 54 | $style_tab = FrmAppHelper::get_param( 'frm_action', '', 'get', 'sanitize_title' ); |
| 55 | 55 | if ( $style_tab == 'manage' || $style_tab == 'custom_css' ) { |
@@ -57,19 +57,19 @@ discard block |
||
| 57 | 57 | return; |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - wp_enqueue_script('jquery-ui-datepicker'); |
|
| 60 | + wp_enqueue_script('jquery-ui-datepicker'); |
|
| 61 | 61 | |
| 62 | - $version = FrmAppHelper::plugin_version(); |
|
| 62 | + $version = FrmAppHelper::plugin_version(); |
|
| 63 | 63 | $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; |
| 64 | 64 | wp_enqueue_script( 'jquery-frm-themepicker', FrmAppHelper::plugin_url() . '/js/jquery/jquery-ui-themepicker' . $suffix . '.js', array( 'jquery' ), $version ); |
| 65 | 65 | |
| 66 | 66 | wp_enqueue_style( 'frm-custom-theme', admin_url('admin-ajax.php?action=frmpro_css' ) ); |
| 67 | 67 | |
| 68 | - $style = apply_filters('frm_style_head', false); |
|
| 69 | - if ( $style ) { |
|
| 68 | + $style = apply_filters('frm_style_head', false); |
|
| 69 | + if ( $style ) { |
|
| 70 | 70 | wp_enqueue_style( 'frm-single-custom-theme', admin_url( 'admin-ajax.php?action=frmpro_load_css&flat=1' ) . '&' . http_build_query( $style->post_content ) ); |
| 71 | - } |
|
| 72 | - } |
|
| 71 | + } |
|
| 72 | + } |
|
| 73 | 73 | |
| 74 | 74 | public static function enqueue_css( $register = 'enqueue' ) { |
| 75 | 75 | global $frm_vars; |
@@ -163,207 +163,207 @@ discard block |
||
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | public static function new_style( $return = '' ) { |
| 166 | - self::load_styler('default'); |
|
| 167 | - } |
|
| 166 | + self::load_styler('default'); |
|
| 167 | + } |
|
| 168 | 168 | |
| 169 | 169 | public static function duplicate() { |
| 170 | 170 | self::load_styler('default'); |
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | public static function edit( $style_id = false, $message = '' ) { |
| 174 | - if ( ! $style_id ) { |
|
| 174 | + if ( ! $style_id ) { |
|
| 175 | 175 | $style_id = FrmAppHelper::get_param( 'id', '', 'get', 'absint' ); |
| 176 | - if ( empty($style_id) ) { |
|
| 177 | - $style_id = 'default'; |
|
| 178 | - } |
|
| 179 | - } |
|
| 180 | - |
|
| 181 | - if ( 'default' == $style_id ) { |
|
| 182 | - $style = 'default'; |
|
| 183 | - } else { |
|
| 184 | - $frm_style = new FrmStyle($style_id); |
|
| 185 | - $style = $frm_style->get_one(); |
|
| 186 | - $style = $style->ID; |
|
| 187 | - } |
|
| 188 | - |
|
| 189 | - self::load_styler($style, $message); |
|
| 190 | - } |
|
| 191 | - |
|
| 192 | - public static function save() { |
|
| 193 | - $frm_style = new FrmStyle(); |
|
| 194 | - $message = ''; |
|
| 176 | + if ( empty($style_id) ) { |
|
| 177 | + $style_id = 'default'; |
|
| 178 | + } |
|
| 179 | + } |
|
| 180 | + |
|
| 181 | + if ( 'default' == $style_id ) { |
|
| 182 | + $style = 'default'; |
|
| 183 | + } else { |
|
| 184 | + $frm_style = new FrmStyle($style_id); |
|
| 185 | + $style = $frm_style->get_one(); |
|
| 186 | + $style = $style->ID; |
|
| 187 | + } |
|
| 188 | + |
|
| 189 | + self::load_styler($style, $message); |
|
| 190 | + } |
|
| 191 | + |
|
| 192 | + public static function save() { |
|
| 193 | + $frm_style = new FrmStyle(); |
|
| 194 | + $message = ''; |
|
| 195 | 195 | $post_id = FrmAppHelper::get_post_param( 'ID', false, 'sanitize_title' ); |
| 196 | 196 | $style_nonce = FrmAppHelper::get_post_param( 'frm_style', '', 'sanitize_text_field' ); |
| 197 | 197 | |
| 198 | 198 | if ( $post_id !== false && wp_verify_nonce( $style_nonce, 'frm_style_nonce' ) ) { |
| 199 | - $id = $frm_style->update($post_id); |
|
| 200 | - if ( empty($post_id) && ! empty($id) ) { |
|
| 201 | - // set the post id to the new style so it will be loaded for editing |
|
| 202 | - $post_id = reset($id); |
|
| 203 | - } |
|
| 204 | - // include the CSS that includes this style |
|
| 199 | + $id = $frm_style->update($post_id); |
|
| 200 | + if ( empty($post_id) && ! empty($id) ) { |
|
| 201 | + // set the post id to the new style so it will be loaded for editing |
|
| 202 | + $post_id = reset($id); |
|
| 203 | + } |
|
| 204 | + // include the CSS that includes this style |
|
| 205 | 205 | echo '<link href="' . esc_url( admin_url( 'admin-ajax.php?action=frmpro_css' ) ) . '" type="text/css" rel="Stylesheet" class="frm-custom-theme" />'; |
| 206 | - $message = __( 'Your styling settings have been saved.', 'formidable' ); |
|
| 207 | - } |
|
| 206 | + $message = __( 'Your styling settings have been saved.', 'formidable' ); |
|
| 207 | + } |
|
| 208 | 208 | |
| 209 | - return self::edit($post_id, $message); |
|
| 210 | - } |
|
| 209 | + return self::edit($post_id, $message); |
|
| 210 | + } |
|
| 211 | 211 | |
| 212 | 212 | public static function load_styler( $style, $message = '' ) { |
| 213 | - global $frm_settings; |
|
| 213 | + global $frm_settings; |
|
| 214 | 214 | |
| 215 | - $frm_style = new FrmStyle(); |
|
| 216 | - $styles = $frm_style->get_all(); |
|
| 215 | + $frm_style = new FrmStyle(); |
|
| 216 | + $styles = $frm_style->get_all(); |
|
| 217 | 217 | |
| 218 | - if ( is_numeric($style) ) { |
|
| 219 | - $style = $styles[ $style ]; |
|
| 220 | - } else if ( 'default' == $style ) { |
|
| 221 | - $style = $frm_style->get_default_style($styles); |
|
| 222 | - } |
|
| 218 | + if ( is_numeric($style) ) { |
|
| 219 | + $style = $styles[ $style ]; |
|
| 220 | + } else if ( 'default' == $style ) { |
|
| 221 | + $style = $frm_style->get_default_style($styles); |
|
| 222 | + } |
|
| 223 | 223 | |
| 224 | - self::add_meta_boxes(); |
|
| 224 | + self::add_meta_boxes(); |
|
| 225 | 225 | |
| 226 | 226 | include( FrmAppHelper::plugin_path() . '/classes/views/styles/show.php' ); |
| 227 | - } |
|
| 227 | + } |
|
| 228 | 228 | |
| 229 | 229 | /** |
| 230 | 230 | * @param string $message |
| 231 | 231 | * @param array|object $forms |
| 232 | 232 | */ |
| 233 | 233 | private static function manage( $message = '', $forms = array() ) { |
| 234 | - $frm_style = new FrmStyle(); |
|
| 235 | - $styles = $frm_style->get_all(); |
|
| 236 | - $default_style = $frm_style->get_default_style($styles); |
|
| 234 | + $frm_style = new FrmStyle(); |
|
| 235 | + $styles = $frm_style->get_all(); |
|
| 236 | + $default_style = $frm_style->get_default_style($styles); |
|
| 237 | 237 | |
| 238 | - if ( empty($forms) ) { |
|
| 239 | - $forms = FrmForm::get_published_forms(); |
|
| 240 | - } |
|
| 238 | + if ( empty($forms) ) { |
|
| 239 | + $forms = FrmForm::get_published_forms(); |
|
| 240 | + } |
|
| 241 | 241 | |
| 242 | 242 | include( FrmAppHelper::plugin_path() . '/classes/views/styles/manage.php' ); |
| 243 | - } |
|
| 243 | + } |
|
| 244 | 244 | |
| 245 | - private static function manage_styles() { |
|
| 245 | + private static function manage_styles() { |
|
| 246 | 246 | $style_nonce = FrmAppHelper::get_post_param( 'frm_manage_style', '', 'sanitize_text_field' ); |
| 247 | 247 | if ( ! $_POST || ! isset( $_POST['style'] ) || ! wp_verify_nonce( $style_nonce, 'frm_manage_style_nonce' ) ) { |
| 248 | - return self::manage(); |
|
| 249 | - } |
|
| 248 | + return self::manage(); |
|
| 249 | + } |
|
| 250 | 250 | |
| 251 | - global $wpdb; |
|
| 251 | + global $wpdb; |
|
| 252 | 252 | |
| 253 | 253 | $forms = FrmForm::get_published_forms(); |
| 254 | - foreach ( $forms as $form ) { |
|
| 255 | - if ( $_POST['style'][ $form->id ] == $_POST['prev_style'][ $form->id ] ) { |
|
| 256 | - continue; |
|
| 257 | - } |
|
| 254 | + foreach ( $forms as $form ) { |
|
| 255 | + if ( $_POST['style'][ $form->id ] == $_POST['prev_style'][ $form->id ] ) { |
|
| 256 | + continue; |
|
| 257 | + } |
|
| 258 | 258 | |
| 259 | - $form->options['custom_style'] = $_POST['style'][ $form->id ]; |
|
| 259 | + $form->options['custom_style'] = $_POST['style'][ $form->id ]; |
|
| 260 | 260 | |
| 261 | 261 | $wpdb->update( $wpdb->prefix . 'frm_forms', array( 'options' => maybe_serialize( $form->options ) ), array( 'id' => $form->id ) ); |
| 262 | - unset($form); |
|
| 263 | - } |
|
| 262 | + unset($form); |
|
| 263 | + } |
|
| 264 | 264 | |
| 265 | - $message = __( 'Your form styles have been saved.', 'formidable' ); |
|
| 266 | - return self::manage($message, $forms); |
|
| 267 | - } |
|
| 265 | + $message = __( 'Your form styles have been saved.', 'formidable' ); |
|
| 266 | + return self::manage($message, $forms); |
|
| 267 | + } |
|
| 268 | 268 | |
| 269 | - public static function custom_css( $message = '', $style = null ) { |
|
| 270 | - wp_enqueue_style('codemirror', FrmAppHelper::plugin_url() . '/css/codemirror.css'); |
|
| 271 | - wp_enqueue_script('codemirror', FrmAppHelper::plugin_url() . '/js/codemirror/codemirror.js', array(), '4.7'); |
|
| 272 | - wp_enqueue_script( 'codemirror-css', FrmAppHelper::plugin_url() . '/js/codemirror/css.js', array( 'codemirror' ), '4.7' ); |
|
| 269 | + public static function custom_css( $message = '', $style = null ) { |
|
| 270 | + wp_enqueue_style('codemirror', FrmAppHelper::plugin_url() . '/css/codemirror.css'); |
|
| 271 | + wp_enqueue_script('codemirror', FrmAppHelper::plugin_url() . '/js/codemirror/codemirror.js', array(), '4.7'); |
|
| 272 | + wp_enqueue_script( 'codemirror-css', FrmAppHelper::plugin_url() . '/js/codemirror/css.js', array( 'codemirror' ), '4.7' ); |
|
| 273 | 273 | |
| 274 | - if ( ! isset($style) ) { |
|
| 275 | - $frm_style = new FrmStyle(); |
|
| 276 | - $style = $frm_style->get_default_style(); |
|
| 277 | - } |
|
| 274 | + if ( ! isset($style) ) { |
|
| 275 | + $frm_style = new FrmStyle(); |
|
| 276 | + $style = $frm_style->get_default_style(); |
|
| 277 | + } |
|
| 278 | 278 | |
| 279 | 279 | include( FrmAppHelper::plugin_path() . '/classes/views/styles/custom_css.php' ); |
| 280 | - } |
|
| 280 | + } |
|
| 281 | 281 | |
| 282 | - public static function save_css() { |
|
| 283 | - $frm_style = new FrmStyle(); |
|
| 282 | + public static function save_css() { |
|
| 283 | + $frm_style = new FrmStyle(); |
|
| 284 | 284 | |
| 285 | - $message = ''; |
|
| 285 | + $message = ''; |
|
| 286 | 286 | $post_id = FrmAppHelper::get_post_param( 'ID', false, 'sanitize_text_field' ); |
| 287 | 287 | $nonce = FrmAppHelper::get_post_param( 'frm_custom_css', '', 'sanitize_text_field' ); |
| 288 | 288 | if ( wp_verify_nonce( $nonce, 'frm_custom_css_nonce' ) ) { |
| 289 | - $frm_style->update($post_id); |
|
| 290 | - $message = __( 'Your styling settings have been saved.', 'formidable' ); |
|
| 291 | - } |
|
| 289 | + $frm_style->update($post_id); |
|
| 290 | + $message = __( 'Your styling settings have been saved.', 'formidable' ); |
|
| 291 | + } |
|
| 292 | 292 | |
| 293 | - return self::custom_css($message); |
|
| 294 | - } |
|
| 293 | + return self::custom_css($message); |
|
| 294 | + } |
|
| 295 | 295 | |
| 296 | - public static function route() { |
|
| 296 | + public static function route() { |
|
| 297 | 297 | $action = FrmAppHelper::get_param( 'frm_action', '', 'get', 'sanitize_title' ); |
| 298 | 298 | |
| 299 | - switch ( $action ) { |
|
| 300 | - case 'edit': |
|
| 301 | - case 'save': |
|
| 302 | - case 'manage': |
|
| 303 | - case 'manage_styles': |
|
| 304 | - case 'custom_css': |
|
| 305 | - case 'save_css': |
|
| 299 | + switch ( $action ) { |
|
| 300 | + case 'edit': |
|
| 301 | + case 'save': |
|
| 302 | + case 'manage': |
|
| 303 | + case 'manage_styles': |
|
| 304 | + case 'custom_css': |
|
| 305 | + case 'save_css': |
|
| 306 | 306 | return self::$action(); |
| 307 | - default: |
|
| 308 | - do_action( 'frm_style_action_route', $action ); |
|
| 309 | - if ( apply_filters( 'frm_style_stop_action_route', false, $action ) ) { |
|
| 310 | - return; |
|
| 311 | - } |
|
| 307 | + default: |
|
| 308 | + do_action( 'frm_style_action_route', $action ); |
|
| 309 | + if ( apply_filters( 'frm_style_stop_action_route', false, $action ) ) { |
|
| 310 | + return; |
|
| 311 | + } |
|
| 312 | 312 | |
| 313 | - if ( 'new_style' == $action || 'duplicate' == $action ) { |
|
| 314 | - return self::$action(); |
|
| 315 | - } |
|
| 313 | + if ( 'new_style' == $action || 'duplicate' == $action ) { |
|
| 314 | + return self::$action(); |
|
| 315 | + } |
|
| 316 | 316 | |
| 317 | - return self::edit(); |
|
| 318 | - } |
|
| 319 | - } |
|
| 317 | + return self::edit(); |
|
| 318 | + } |
|
| 319 | + } |
|
| 320 | 320 | |
| 321 | - public static function reset_styling() { |
|
| 321 | + public static function reset_styling() { |
|
| 322 | 322 | FrmAppHelper::permission_check('frm_change_settings'); |
| 323 | - check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 323 | + check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 324 | 324 | |
| 325 | - $frm_style = new FrmStyle(); |
|
| 326 | - $defaults = $frm_style->get_defaults(); |
|
| 325 | + $frm_style = new FrmStyle(); |
|
| 326 | + $defaults = $frm_style->get_defaults(); |
|
| 327 | 327 | |
| 328 | - echo json_encode( $defaults ); |
|
| 329 | - wp_die(); |
|
| 330 | - } |
|
| 328 | + echo json_encode( $defaults ); |
|
| 329 | + wp_die(); |
|
| 330 | + } |
|
| 331 | 331 | |
| 332 | - public static function change_styling() { |
|
| 333 | - check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 332 | + public static function change_styling() { |
|
| 333 | + check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 334 | 334 | |
| 335 | - $frm_style = new FrmStyle(); |
|
| 336 | - $defaults = $frm_style->get_defaults(); |
|
| 335 | + $frm_style = new FrmStyle(); |
|
| 336 | + $defaults = $frm_style->get_defaults(); |
|
| 337 | 337 | $style = ''; |
| 338 | 338 | |
| 339 | - // remove the # from the colors |
|
| 340 | - foreach ( $_GET['frm_style_setting']['post_content'] as $k => $v ) { |
|
| 341 | - if ( ! is_array($v) && strpos($v, '#') === 0 ) { |
|
| 342 | - $_GET['frm_style_setting']['post_content'][ $k ] = str_replace( '#', '', $v ); |
|
| 343 | - } |
|
| 344 | - } |
|
| 339 | + // remove the # from the colors |
|
| 340 | + foreach ( $_GET['frm_style_setting']['post_content'] as $k => $v ) { |
|
| 341 | + if ( ! is_array($v) && strpos($v, '#') === 0 ) { |
|
| 342 | + $_GET['frm_style_setting']['post_content'][ $k ] = str_replace( '#', '', $v ); |
|
| 343 | + } |
|
| 344 | + } |
|
| 345 | 345 | |
| 346 | - echo '<style type="text/css">'; |
|
| 346 | + echo '<style type="text/css">'; |
|
| 347 | 347 | include( FrmAppHelper::plugin_path() . '/css/_single_theme.css.php' ); |
| 348 | - echo '</style>'; |
|
| 349 | - wp_die(); |
|
| 350 | - } |
|
| 351 | - |
|
| 352 | - private static function add_meta_boxes() { |
|
| 353 | - |
|
| 354 | - // setup meta boxes |
|
| 355 | - $meta_boxes = array( |
|
| 356 | - 'general' => __( 'General', 'formidable' ), |
|
| 357 | - 'form-title' => __( 'Form Title', 'formidable' ), |
|
| 358 | - 'form-description' => __( 'Form Description', 'formidable' ), |
|
| 359 | - 'field-labels' => __( 'Field Labels', 'formidable' ), |
|
| 360 | - 'field-description' => __( 'Field Description', 'formidable' ), |
|
| 361 | - 'field-colors' => __( 'Field Colors', 'formidable' ), |
|
| 362 | - 'field-sizes' => __( 'Field Settings', 'formidable' ), |
|
| 363 | - 'check-box-radio-fields' => __( 'Check Box & Radio Fields', 'formidable' ), |
|
| 364 | - 'buttons' => __( 'Buttons', 'formidable' ), |
|
| 365 | - 'form-messages' => __( 'Form Messages', 'formidable' ), |
|
| 366 | - ); |
|
| 348 | + echo '</style>'; |
|
| 349 | + wp_die(); |
|
| 350 | + } |
|
| 351 | + |
|
| 352 | + private static function add_meta_boxes() { |
|
| 353 | + |
|
| 354 | + // setup meta boxes |
|
| 355 | + $meta_boxes = array( |
|
| 356 | + 'general' => __( 'General', 'formidable' ), |
|
| 357 | + 'form-title' => __( 'Form Title', 'formidable' ), |
|
| 358 | + 'form-description' => __( 'Form Description', 'formidable' ), |
|
| 359 | + 'field-labels' => __( 'Field Labels', 'formidable' ), |
|
| 360 | + 'field-description' => __( 'Field Description', 'formidable' ), |
|
| 361 | + 'field-colors' => __( 'Field Colors', 'formidable' ), |
|
| 362 | + 'field-sizes' => __( 'Field Settings', 'formidable' ), |
|
| 363 | + 'check-box-radio-fields' => __( 'Check Box & Radio Fields', 'formidable' ), |
|
| 364 | + 'buttons' => __( 'Buttons', 'formidable' ), |
|
| 365 | + 'form-messages' => __( 'Form Messages', 'formidable' ), |
|
| 366 | + ); |
|
| 367 | 367 | |
| 368 | 368 | /** |
| 369 | 369 | * Add custom boxes to the styling settings |
@@ -371,14 +371,14 @@ discard block |
||
| 371 | 371 | */ |
| 372 | 372 | $meta_boxes = apply_filters( 'frm_style_boxes', $meta_boxes ); |
| 373 | 373 | |
| 374 | - foreach ( $meta_boxes as $nicename => $name ) { |
|
| 374 | + foreach ( $meta_boxes as $nicename => $name ) { |
|
| 375 | 375 | add_meta_box( $nicename . '-style', $name, 'FrmStylesController::include_style_section', self::$screen, 'side', 'default', $nicename ); |
| 376 | - unset($nicename, $name); |
|
| 377 | - } |
|
| 378 | - } |
|
| 376 | + unset($nicename, $name); |
|
| 377 | + } |
|
| 378 | + } |
|
| 379 | 379 | |
| 380 | 380 | public static function include_style_section( $atts, $sec ) { |
| 381 | - extract($atts); |
|
| 381 | + extract($atts); |
|
| 382 | 382 | $current_tab = FrmAppHelper::simple_get( 'page-tab', 'sanitize_title', 'default' ); |
| 383 | 383 | $file_name = FrmAppHelper::plugin_path() . '/classes/views/styles/_' . $sec['args'] . '.php'; |
| 384 | 384 | |
@@ -392,18 +392,18 @@ discard block |
||
| 392 | 392 | $file_name = apply_filters( 'frm_style_settings_' . $sec['args'], $file_name ); |
| 393 | 393 | |
| 394 | 394 | include( $file_name ); |
| 395 | - } |
|
| 395 | + } |
|
| 396 | 396 | |
| 397 | - public static function load_css() { |
|
| 398 | - header('Content-type: text/css'); |
|
| 397 | + public static function load_css() { |
|
| 398 | + header('Content-type: text/css'); |
|
| 399 | 399 | |
| 400 | - $frm_style = new FrmStyle(); |
|
| 401 | - $defaults = $frm_style->get_defaults(); |
|
| 400 | + $frm_style = new FrmStyle(); |
|
| 401 | + $defaults = $frm_style->get_defaults(); |
|
| 402 | 402 | $style = ''; |
| 403 | 403 | |
| 404 | 404 | include( FrmAppHelper::plugin_path() . '/css/_single_theme.css.php' ); |
| 405 | - wp_die(); |
|
| 406 | - } |
|
| 405 | + wp_die(); |
|
| 406 | + } |
|
| 407 | 407 | |
| 408 | 408 | public static function load_saved_css() { |
| 409 | 409 | $css = get_transient( 'frmpro_css' ); |
@@ -412,142 +412,142 @@ discard block |
||
| 412 | 412 | wp_die(); |
| 413 | 413 | } |
| 414 | 414 | |
| 415 | - /** |
|
| 416 | - * Check if the Formidable styling should be loaded, |
|
| 417 | - * then enqueue it for the footer |
|
| 418 | - * @since 2.0 |
|
| 419 | - */ |
|
| 420 | - public static function enqueue_style() { |
|
| 421 | - global $frm_vars; |
|
| 422 | - |
|
| 423 | - if ( isset( $frm_vars['css_loaded'] ) && $frm_vars['css_loaded'] ) { |
|
| 424 | - // the CSS has already been loaded |
|
| 425 | - return; |
|
| 426 | - } |
|
| 427 | - |
|
| 428 | - $frm_settings = FrmAppHelper::get_settings(); |
|
| 429 | - if ( $frm_settings->load_style != 'none' ) { |
|
| 430 | - wp_enqueue_style( 'formidable' ); |
|
| 431 | - $frm_vars['css_loaded'] = true; |
|
| 432 | - } |
|
| 433 | - } |
|
| 434 | - |
|
| 435 | - // Get the stylesheets for the form settings page |
|
| 436 | - public static function get_style_opts() { |
|
| 437 | - $frm_style = new FrmStyle(); |
|
| 438 | - $styles = $frm_style->get_all(); |
|
| 439 | - |
|
| 440 | - return $styles; |
|
| 441 | - } |
|
| 442 | - |
|
| 443 | - public static function get_form_style( $form = 'default' ) { |
|
| 444 | - $style = FrmFormsHelper::get_form_style( $form ); |
|
| 445 | - |
|
| 446 | - if ( empty( $style ) || 1 == $style ) { |
|
| 447 | - $style = 'default'; |
|
| 448 | - } |
|
| 449 | - |
|
| 450 | - $frm_style = new FrmStyle( $style ); |
|
| 451 | - return $frm_style->get_one(); |
|
| 452 | - } |
|
| 453 | - |
|
| 454 | - /** |
|
| 455 | - * @param string $class |
|
| 456 | - * @param string $style |
|
| 457 | - */ |
|
| 415 | + /** |
|
| 416 | + * Check if the Formidable styling should be loaded, |
|
| 417 | + * then enqueue it for the footer |
|
| 418 | + * @since 2.0 |
|
| 419 | + */ |
|
| 420 | + public static function enqueue_style() { |
|
| 421 | + global $frm_vars; |
|
| 422 | + |
|
| 423 | + if ( isset( $frm_vars['css_loaded'] ) && $frm_vars['css_loaded'] ) { |
|
| 424 | + // the CSS has already been loaded |
|
| 425 | + return; |
|
| 426 | + } |
|
| 427 | + |
|
| 428 | + $frm_settings = FrmAppHelper::get_settings(); |
|
| 429 | + if ( $frm_settings->load_style != 'none' ) { |
|
| 430 | + wp_enqueue_style( 'formidable' ); |
|
| 431 | + $frm_vars['css_loaded'] = true; |
|
| 432 | + } |
|
| 433 | + } |
|
| 434 | + |
|
| 435 | + // Get the stylesheets for the form settings page |
|
| 436 | + public static function get_style_opts() { |
|
| 437 | + $frm_style = new FrmStyle(); |
|
| 438 | + $styles = $frm_style->get_all(); |
|
| 439 | + |
|
| 440 | + return $styles; |
|
| 441 | + } |
|
| 442 | + |
|
| 443 | + public static function get_form_style( $form = 'default' ) { |
|
| 444 | + $style = FrmFormsHelper::get_form_style( $form ); |
|
| 445 | + |
|
| 446 | + if ( empty( $style ) || 1 == $style ) { |
|
| 447 | + $style = 'default'; |
|
| 448 | + } |
|
| 449 | + |
|
| 450 | + $frm_style = new FrmStyle( $style ); |
|
| 451 | + return $frm_style->get_one(); |
|
| 452 | + } |
|
| 453 | + |
|
| 454 | + /** |
|
| 455 | + * @param string $class |
|
| 456 | + * @param string $style |
|
| 457 | + */ |
|
| 458 | 458 | public static function get_form_style_class( $class, $style ) { |
| 459 | - if ( 1 == $style ) { |
|
| 460 | - $style = 'default'; |
|
| 461 | - } |
|
| 459 | + if ( 1 == $style ) { |
|
| 460 | + $style = 'default'; |
|
| 461 | + } |
|
| 462 | 462 | |
| 463 | - $frm_style = new FrmStyle($style); |
|
| 464 | - $style = $frm_style->get_one(); |
|
| 463 | + $frm_style = new FrmStyle($style); |
|
| 464 | + $style = $frm_style->get_one(); |
|
| 465 | 465 | |
| 466 | - if ( $style ) { |
|
| 466 | + if ( $style ) { |
|
| 467 | 467 | $class .= ' frm_style_' . $style->post_name; |
| 468 | - } |
|
| 468 | + } |
|
| 469 | 469 | |
| 470 | - return $class; |
|
| 471 | - } |
|
| 470 | + return $class; |
|
| 471 | + } |
|
| 472 | 472 | |
| 473 | - /** |
|
| 474 | - * @param string $val |
|
| 475 | - */ |
|
| 473 | + /** |
|
| 474 | + * @param string $val |
|
| 475 | + */ |
|
| 476 | 476 | public static function get_style_val( $val, $form = 'default' ) { |
| 477 | - $style = self::get_form_style($form); |
|
| 478 | - if ( $style && isset( $style->post_content[ $val ] ) ) { |
|
| 479 | - return $style->post_content[ $val ]; |
|
| 480 | - } |
|
| 481 | - } |
|
| 477 | + $style = self::get_form_style($form); |
|
| 478 | + if ( $style && isset( $style->post_content[ $val ] ) ) { |
|
| 479 | + return $style->post_content[ $val ]; |
|
| 480 | + } |
|
| 481 | + } |
|
| 482 | 482 | |
| 483 | 483 | public static function show_entry_styles( $default_styles ) { |
| 484 | - $frm_style = new FrmStyle('default'); |
|
| 485 | - $style = $frm_style->get_one(); |
|
| 486 | - |
|
| 487 | - if ( ! $style ) { |
|
| 488 | - return $default_styles; |
|
| 489 | - } |
|
| 490 | - |
|
| 491 | - foreach ( $default_styles as $name => $val ) { |
|
| 492 | - $setting = $name; |
|
| 493 | - if ( 'border_width' == $name ) { |
|
| 494 | - $setting = 'field_border_width'; |
|
| 495 | - } else if ( 'alt_bg_color' == $name ) { |
|
| 496 | - $setting = 'bg_color_active'; |
|
| 497 | - } |
|
| 498 | - $default_styles[ $name ] = $style->post_content[ $setting ]; |
|
| 499 | - unset($name, $val); |
|
| 500 | - } |
|
| 501 | - |
|
| 502 | - return $default_styles; |
|
| 503 | - } |
|
| 484 | + $frm_style = new FrmStyle('default'); |
|
| 485 | + $style = $frm_style->get_one(); |
|
| 486 | + |
|
| 487 | + if ( ! $style ) { |
|
| 488 | + return $default_styles; |
|
| 489 | + } |
|
| 490 | + |
|
| 491 | + foreach ( $default_styles as $name => $val ) { |
|
| 492 | + $setting = $name; |
|
| 493 | + if ( 'border_width' == $name ) { |
|
| 494 | + $setting = 'field_border_width'; |
|
| 495 | + } else if ( 'alt_bg_color' == $name ) { |
|
| 496 | + $setting = 'bg_color_active'; |
|
| 497 | + } |
|
| 498 | + $default_styles[ $name ] = $style->post_content[ $setting ]; |
|
| 499 | + unset($name, $val); |
|
| 500 | + } |
|
| 501 | + |
|
| 502 | + return $default_styles; |
|
| 503 | + } |
|
| 504 | 504 | |
| 505 | 505 | public static function &important_style( $important, $field ) { |
| 506 | - $important = self::get_style_val('important_style', $field['form_id']); |
|
| 507 | - return $important; |
|
| 508 | - } |
|
| 506 | + $important = self::get_style_val('important_style', $field['form_id']); |
|
| 507 | + return $important; |
|
| 508 | + } |
|
| 509 | 509 | |
| 510 | - /** |
|
| 511 | - * Fallback for WP < 3.6 |
|
| 512 | - */ |
|
| 513 | - public static function do_accordion_sections( $screen, $context, $object ) { |
|
| 514 | - if ( function_exists( 'do_accordion_sections' ) ) { |
|
| 515 | - return do_accordion_sections( $screen, $context, $object ); |
|
| 516 | - } |
|
| 510 | + /** |
|
| 511 | + * Fallback for WP < 3.6 |
|
| 512 | + */ |
|
| 513 | + public static function do_accordion_sections( $screen, $context, $object ) { |
|
| 514 | + if ( function_exists( 'do_accordion_sections' ) ) { |
|
| 515 | + return do_accordion_sections( $screen, $context, $object ); |
|
| 516 | + } |
|
| 517 | 517 | |
| 518 | - global $wp_meta_boxes; |
|
| 518 | + global $wp_meta_boxes; |
|
| 519 | 519 | |
| 520 | - $screen = 'formidable_page_formidable-styles'; |
|
| 521 | - $screen = convert_to_screen( $screen ); |
|
| 520 | + $screen = 'formidable_page_formidable-styles'; |
|
| 521 | + $screen = convert_to_screen( $screen ); |
|
| 522 | 522 | |
| 523 | - $page = $screen->id; |
|
| 523 | + $page = $screen->id; |
|
| 524 | 524 | |
| 525 | - $hidden = get_hidden_meta_boxes( $screen ); |
|
| 526 | - ?> |
|
| 525 | + $hidden = get_hidden_meta_boxes( $screen ); |
|
| 526 | + ?> |
|
| 527 | 527 | <div id="side-sortables" class="accordion-container"> |
| 528 | 528 | <?php |
| 529 | - $i = 0; |
|
| 530 | - $first_open = false; |
|
| 531 | - do { |
|
| 529 | + $i = 0; |
|
| 530 | + $first_open = false; |
|
| 531 | + do { |
|
| 532 | 532 | if ( ! isset( $wp_meta_boxes ) || ! isset( $wp_meta_boxes[ $page ] ) || ! isset( $wp_meta_boxes[ $page ][ $context ] ) ) { |
| 533 | 533 | break; |
| 534 | 534 | } |
| 535 | 535 | |
| 536 | - foreach ( array( 'high', 'core', 'default', 'low' ) as $priority ) { |
|
| 537 | - if ( isset( $wp_meta_boxes[ $page ][ $context ][ $priority ] ) ) { |
|
| 538 | - foreach ( $wp_meta_boxes[ $page ][ $context ][ $priority ] as $box ) { |
|
| 539 | - if ( false == $box || ! $box['title'] ) { |
|
| 540 | - continue; |
|
| 536 | + foreach ( array( 'high', 'core', 'default', 'low' ) as $priority ) { |
|
| 537 | + if ( isset( $wp_meta_boxes[ $page ][ $context ][ $priority ] ) ) { |
|
| 538 | + foreach ( $wp_meta_boxes[ $page ][ $context ][ $priority ] as $box ) { |
|
| 539 | + if ( false == $box || ! $box['title'] ) { |
|
| 540 | + continue; |
|
| 541 | 541 | } |
| 542 | 542 | |
| 543 | - $i++; |
|
| 544 | - $hidden_class = in_array( $box['id'], $hidden ) ? 'hide-if-js' : ''; |
|
| 543 | + $i++; |
|
| 544 | + $hidden_class = in_array( $box['id'], $hidden ) ? 'hide-if-js' : ''; |
|
| 545 | 545 | |
| 546 | - if ( ! $first_open && empty( $hidden_class ) ) { |
|
| 547 | - $first_open = true; |
|
| 548 | - } |
|
| 546 | + if ( ! $first_open && empty( $hidden_class ) ) { |
|
| 547 | + $first_open = true; |
|
| 548 | + } |
|
| 549 | 549 | |
| 550 | - ?> |
|
| 550 | + ?> |
|
| 551 | 551 | <div class="postbox <?php echo esc_attr( $box['id'] ); ?>"> |
| 552 | 552 | <div class="handlediv" title="<?php esc_attr_e( 'Click to toggle', 'formidable' ) ?>"><br/></div> |
| 553 | 553 | <h3 class='hndle'><span><?php echo esc_html( $box['title'] ); ?></span></h3> |
@@ -558,13 +558,13 @@ discard block |
||
| 558 | 558 | </div><!-- .accordion-section-content --> |
| 559 | 559 | </div><!-- .postbox --> |
| 560 | 560 | <?php |
| 561 | - } |
|
| 562 | - } |
|
| 563 | - } |
|
| 564 | - } while ( 0 ); |
|
| 565 | - ?> |
|
| 561 | + } |
|
| 562 | + } |
|
| 563 | + } |
|
| 564 | + } while ( 0 ); |
|
| 565 | + ?> |
|
| 566 | 566 | </div><!-- .accordion-container --> |
| 567 | 567 | <?php |
| 568 | - return $i; |
|
| 569 | - } |
|
| 568 | + return $i; |
|
| 569 | + } |
|
| 570 | 570 | } |
@@ -41,11 +41,11 @@ discard block |
||
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | public static function menu() { |
| 44 | - add_submenu_page('formidable', 'Formidable | ' . __( 'Styles', 'formidable' ), __( 'Styles', 'formidable' ), 'frm_change_settings', 'formidable-styles', 'FrmStylesController::route' ); |
|
| 44 | + add_submenu_page( 'formidable', 'Formidable | ' . __( 'Styles', 'formidable' ), __( 'Styles', 'formidable' ), 'frm_change_settings', 'formidable-styles', 'FrmStylesController::route' ); |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | public static function admin_init() { |
| 48 | - if ( ! FrmAppHelper::is_admin_page('formidable-styles') ) { |
|
| 48 | + if ( ! FrmAppHelper::is_admin_page( 'formidable-styles' ) ) { |
|
| 49 | 49 | return; |
| 50 | 50 | } |
| 51 | 51 | |
@@ -57,15 +57,15 @@ discard block |
||
| 57 | 57 | return; |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - wp_enqueue_script('jquery-ui-datepicker'); |
|
| 60 | + wp_enqueue_script( 'jquery-ui-datepicker' ); |
|
| 61 | 61 | |
| 62 | 62 | $version = FrmAppHelper::plugin_version(); |
| 63 | 63 | $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; |
| 64 | 64 | wp_enqueue_script( 'jquery-frm-themepicker', FrmAppHelper::plugin_url() . '/js/jquery/jquery-ui-themepicker' . $suffix . '.js', array( 'jquery' ), $version ); |
| 65 | 65 | |
| 66 | - wp_enqueue_style( 'frm-custom-theme', admin_url('admin-ajax.php?action=frmpro_css' ) ); |
|
| 66 | + wp_enqueue_style( 'frm-custom-theme', admin_url( 'admin-ajax.php?action=frmpro_css' ) ); |
|
| 67 | 67 | |
| 68 | - $style = apply_filters('frm_style_head', false); |
|
| 68 | + $style = apply_filters( 'frm_style_head', false ); |
|
| 69 | 69 | if ( $style ) { |
| 70 | 70 | wp_enqueue_style( 'frm-single-custom-theme', admin_url( 'admin-ajax.php?action=frmpro_load_css&flat=1' ) . '&' . http_build_query( $style->post_content ) ); |
| 71 | 71 | } |
@@ -163,17 +163,17 @@ discard block |
||
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | public static function new_style( $return = '' ) { |
| 166 | - self::load_styler('default'); |
|
| 166 | + self::load_styler( 'default' ); |
|
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | public static function duplicate() { |
| 170 | - self::load_styler('default'); |
|
| 170 | + self::load_styler( 'default' ); |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | public static function edit( $style_id = false, $message = '' ) { |
| 174 | 174 | if ( ! $style_id ) { |
| 175 | 175 | $style_id = FrmAppHelper::get_param( 'id', '', 'get', 'absint' ); |
| 176 | - if ( empty($style_id) ) { |
|
| 176 | + if ( empty( $style_id ) ) { |
|
| 177 | 177 | $style_id = 'default'; |
| 178 | 178 | } |
| 179 | 179 | } |
@@ -181,12 +181,12 @@ discard block |
||
| 181 | 181 | if ( 'default' == $style_id ) { |
| 182 | 182 | $style = 'default'; |
| 183 | 183 | } else { |
| 184 | - $frm_style = new FrmStyle($style_id); |
|
| 184 | + $frm_style = new FrmStyle( $style_id ); |
|
| 185 | 185 | $style = $frm_style->get_one(); |
| 186 | 186 | $style = $style->ID; |
| 187 | 187 | } |
| 188 | 188 | |
| 189 | - self::load_styler($style, $message); |
|
| 189 | + self::load_styler( $style, $message ); |
|
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | public static function save() { |
@@ -196,17 +196,17 @@ discard block |
||
| 196 | 196 | $style_nonce = FrmAppHelper::get_post_param( 'frm_style', '', 'sanitize_text_field' ); |
| 197 | 197 | |
| 198 | 198 | if ( $post_id !== false && wp_verify_nonce( $style_nonce, 'frm_style_nonce' ) ) { |
| 199 | - $id = $frm_style->update($post_id); |
|
| 200 | - if ( empty($post_id) && ! empty($id) ) { |
|
| 199 | + $id = $frm_style->update( $post_id ); |
|
| 200 | + if ( empty( $post_id ) && ! empty( $id ) ) { |
|
| 201 | 201 | // set the post id to the new style so it will be loaded for editing |
| 202 | - $post_id = reset($id); |
|
| 202 | + $post_id = reset( $id ); |
|
| 203 | 203 | } |
| 204 | 204 | // include the CSS that includes this style |
| 205 | 205 | echo '<link href="' . esc_url( admin_url( 'admin-ajax.php?action=frmpro_css' ) ) . '" type="text/css" rel="Stylesheet" class="frm-custom-theme" />'; |
| 206 | 206 | $message = __( 'Your styling settings have been saved.', 'formidable' ); |
| 207 | 207 | } |
| 208 | 208 | |
| 209 | - return self::edit($post_id, $message); |
|
| 209 | + return self::edit( $post_id, $message ); |
|
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | public static function load_styler( $style, $message = '' ) { |
@@ -215,10 +215,10 @@ discard block |
||
| 215 | 215 | $frm_style = new FrmStyle(); |
| 216 | 216 | $styles = $frm_style->get_all(); |
| 217 | 217 | |
| 218 | - if ( is_numeric($style) ) { |
|
| 219 | - $style = $styles[ $style ]; |
|
| 218 | + if ( is_numeric( $style ) ) { |
|
| 219 | + $style = $styles[$style]; |
|
| 220 | 220 | } else if ( 'default' == $style ) { |
| 221 | - $style = $frm_style->get_default_style($styles); |
|
| 221 | + $style = $frm_style->get_default_style( $styles ); |
|
| 222 | 222 | } |
| 223 | 223 | |
| 224 | 224 | self::add_meta_boxes(); |
@@ -233,9 +233,9 @@ discard block |
||
| 233 | 233 | private static function manage( $message = '', $forms = array() ) { |
| 234 | 234 | $frm_style = new FrmStyle(); |
| 235 | 235 | $styles = $frm_style->get_all(); |
| 236 | - $default_style = $frm_style->get_default_style($styles); |
|
| 236 | + $default_style = $frm_style->get_default_style( $styles ); |
|
| 237 | 237 | |
| 238 | - if ( empty($forms) ) { |
|
| 238 | + if ( empty( $forms ) ) { |
|
| 239 | 239 | $forms = FrmForm::get_published_forms(); |
| 240 | 240 | } |
| 241 | 241 | |
@@ -252,26 +252,26 @@ discard block |
||
| 252 | 252 | |
| 253 | 253 | $forms = FrmForm::get_published_forms(); |
| 254 | 254 | foreach ( $forms as $form ) { |
| 255 | - if ( $_POST['style'][ $form->id ] == $_POST['prev_style'][ $form->id ] ) { |
|
| 255 | + if ( $_POST['style'][$form->id] == $_POST['prev_style'][$form->id] ) { |
|
| 256 | 256 | continue; |
| 257 | 257 | } |
| 258 | 258 | |
| 259 | - $form->options['custom_style'] = $_POST['style'][ $form->id ]; |
|
| 259 | + $form->options['custom_style'] = $_POST['style'][$form->id]; |
|
| 260 | 260 | |
| 261 | 261 | $wpdb->update( $wpdb->prefix . 'frm_forms', array( 'options' => maybe_serialize( $form->options ) ), array( 'id' => $form->id ) ); |
| 262 | - unset($form); |
|
| 262 | + unset( $form ); |
|
| 263 | 263 | } |
| 264 | 264 | |
| 265 | 265 | $message = __( 'Your form styles have been saved.', 'formidable' ); |
| 266 | - return self::manage($message, $forms); |
|
| 266 | + return self::manage( $message, $forms ); |
|
| 267 | 267 | } |
| 268 | 268 | |
| 269 | 269 | public static function custom_css( $message = '', $style = null ) { |
| 270 | - wp_enqueue_style('codemirror', FrmAppHelper::plugin_url() . '/css/codemirror.css'); |
|
| 271 | - wp_enqueue_script('codemirror', FrmAppHelper::plugin_url() . '/js/codemirror/codemirror.js', array(), '4.7'); |
|
| 270 | + wp_enqueue_style( 'codemirror', FrmAppHelper::plugin_url() . '/css/codemirror.css' ); |
|
| 271 | + wp_enqueue_script( 'codemirror', FrmAppHelper::plugin_url() . '/js/codemirror/codemirror.js', array(), '4.7' ); |
|
| 272 | 272 | wp_enqueue_script( 'codemirror-css', FrmAppHelper::plugin_url() . '/js/codemirror/css.js', array( 'codemirror' ), '4.7' ); |
| 273 | 273 | |
| 274 | - if ( ! isset($style) ) { |
|
| 274 | + if ( ! isset( $style ) ) { |
|
| 275 | 275 | $frm_style = new FrmStyle(); |
| 276 | 276 | $style = $frm_style->get_default_style(); |
| 277 | 277 | } |
@@ -286,11 +286,11 @@ discard block |
||
| 286 | 286 | $post_id = FrmAppHelper::get_post_param( 'ID', false, 'sanitize_text_field' ); |
| 287 | 287 | $nonce = FrmAppHelper::get_post_param( 'frm_custom_css', '', 'sanitize_text_field' ); |
| 288 | 288 | if ( wp_verify_nonce( $nonce, 'frm_custom_css_nonce' ) ) { |
| 289 | - $frm_style->update($post_id); |
|
| 289 | + $frm_style->update( $post_id ); |
|
| 290 | 290 | $message = __( 'Your styling settings have been saved.', 'formidable' ); |
| 291 | 291 | } |
| 292 | 292 | |
| 293 | - return self::custom_css($message); |
|
| 293 | + return self::custom_css( $message ); |
|
| 294 | 294 | } |
| 295 | 295 | |
| 296 | 296 | public static function route() { |
@@ -319,7 +319,7 @@ discard block |
||
| 319 | 319 | } |
| 320 | 320 | |
| 321 | 321 | public static function reset_styling() { |
| 322 | - FrmAppHelper::permission_check('frm_change_settings'); |
|
| 322 | + FrmAppHelper::permission_check( 'frm_change_settings' ); |
|
| 323 | 323 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
| 324 | 324 | |
| 325 | 325 | $frm_style = new FrmStyle(); |
@@ -338,8 +338,8 @@ discard block |
||
| 338 | 338 | |
| 339 | 339 | // remove the # from the colors |
| 340 | 340 | foreach ( $_GET['frm_style_setting']['post_content'] as $k => $v ) { |
| 341 | - if ( ! is_array($v) && strpos($v, '#') === 0 ) { |
|
| 342 | - $_GET['frm_style_setting']['post_content'][ $k ] = str_replace( '#', '', $v ); |
|
| 341 | + if ( ! is_array( $v ) && strpos( $v, '#' ) === 0 ) { |
|
| 342 | + $_GET['frm_style_setting']['post_content'][$k] = str_replace( '#', '', $v ); |
|
| 343 | 343 | } |
| 344 | 344 | } |
| 345 | 345 | |
@@ -373,12 +373,12 @@ discard block |
||
| 373 | 373 | |
| 374 | 374 | foreach ( $meta_boxes as $nicename => $name ) { |
| 375 | 375 | add_meta_box( $nicename . '-style', $name, 'FrmStylesController::include_style_section', self::$screen, 'side', 'default', $nicename ); |
| 376 | - unset($nicename, $name); |
|
| 376 | + unset( $nicename, $name ); |
|
| 377 | 377 | } |
| 378 | 378 | } |
| 379 | 379 | |
| 380 | 380 | public static function include_style_section( $atts, $sec ) { |
| 381 | - extract($atts); |
|
| 381 | + extract( $atts ); |
|
| 382 | 382 | $current_tab = FrmAppHelper::simple_get( 'page-tab', 'sanitize_title', 'default' ); |
| 383 | 383 | $file_name = FrmAppHelper::plugin_path() . '/classes/views/styles/_' . $sec['args'] . '.php'; |
| 384 | 384 | |
@@ -395,7 +395,7 @@ discard block |
||
| 395 | 395 | } |
| 396 | 396 | |
| 397 | 397 | public static function load_css() { |
| 398 | - header('Content-type: text/css'); |
|
| 398 | + header( 'Content-type: text/css' ); |
|
| 399 | 399 | |
| 400 | 400 | $frm_style = new FrmStyle(); |
| 401 | 401 | $defaults = $frm_style->get_defaults(); |
@@ -460,7 +460,7 @@ discard block |
||
| 460 | 460 | $style = 'default'; |
| 461 | 461 | } |
| 462 | 462 | |
| 463 | - $frm_style = new FrmStyle($style); |
|
| 463 | + $frm_style = new FrmStyle( $style ); |
|
| 464 | 464 | $style = $frm_style->get_one(); |
| 465 | 465 | |
| 466 | 466 | if ( $style ) { |
@@ -474,14 +474,14 @@ discard block |
||
| 474 | 474 | * @param string $val |
| 475 | 475 | */ |
| 476 | 476 | public static function get_style_val( $val, $form = 'default' ) { |
| 477 | - $style = self::get_form_style($form); |
|
| 478 | - if ( $style && isset( $style->post_content[ $val ] ) ) { |
|
| 479 | - return $style->post_content[ $val ]; |
|
| 477 | + $style = self::get_form_style( $form ); |
|
| 478 | + if ( $style && isset( $style->post_content[$val] ) ) { |
|
| 479 | + return $style->post_content[$val]; |
|
| 480 | 480 | } |
| 481 | 481 | } |
| 482 | 482 | |
| 483 | 483 | public static function show_entry_styles( $default_styles ) { |
| 484 | - $frm_style = new FrmStyle('default'); |
|
| 484 | + $frm_style = new FrmStyle( 'default' ); |
|
| 485 | 485 | $style = $frm_style->get_one(); |
| 486 | 486 | |
| 487 | 487 | if ( ! $style ) { |
@@ -495,15 +495,15 @@ discard block |
||
| 495 | 495 | } else if ( 'alt_bg_color' == $name ) { |
| 496 | 496 | $setting = 'bg_color_active'; |
| 497 | 497 | } |
| 498 | - $default_styles[ $name ] = $style->post_content[ $setting ]; |
|
| 499 | - unset($name, $val); |
|
| 498 | + $default_styles[$name] = $style->post_content[$setting]; |
|
| 499 | + unset( $name, $val ); |
|
| 500 | 500 | } |
| 501 | 501 | |
| 502 | 502 | return $default_styles; |
| 503 | 503 | } |
| 504 | 504 | |
| 505 | 505 | public static function &important_style( $important, $field ) { |
| 506 | - $important = self::get_style_val('important_style', $field['form_id']); |
|
| 506 | + $important = self::get_style_val( 'important_style', $field['form_id'] ); |
|
| 507 | 507 | return $important; |
| 508 | 508 | } |
| 509 | 509 | |
@@ -529,18 +529,18 @@ discard block |
||
| 529 | 529 | $i = 0; |
| 530 | 530 | $first_open = false; |
| 531 | 531 | do { |
| 532 | - if ( ! isset( $wp_meta_boxes ) || ! isset( $wp_meta_boxes[ $page ] ) || ! isset( $wp_meta_boxes[ $page ][ $context ] ) ) { |
|
| 532 | + if ( ! isset( $wp_meta_boxes ) || ! isset( $wp_meta_boxes[$page] ) || ! isset( $wp_meta_boxes[$page][$context] ) ) { |
|
| 533 | 533 | break; |
| 534 | 534 | } |
| 535 | 535 | |
| 536 | 536 | foreach ( array( 'high', 'core', 'default', 'low' ) as $priority ) { |
| 537 | - if ( isset( $wp_meta_boxes[ $page ][ $context ][ $priority ] ) ) { |
|
| 538 | - foreach ( $wp_meta_boxes[ $page ][ $context ][ $priority ] as $box ) { |
|
| 537 | + if ( isset( $wp_meta_boxes[$page][$context][$priority] ) ) { |
|
| 538 | + foreach ( $wp_meta_boxes[$page][$context][$priority] as $box ) { |
|
| 539 | 539 | if ( false == $box || ! $box['title'] ) { |
| 540 | 540 | continue; |
| 541 | 541 | } |
| 542 | 542 | |
| 543 | - $i++; |
|
| 543 | + $i ++; |
|
| 544 | 544 | $hidden_class = in_array( $box['id'], $hidden ) ? 'hide-if-js' : ''; |
| 545 | 545 | |
| 546 | 546 | if ( ! $first_open && empty( $hidden_class ) ) { |
@@ -275,7 +275,7 @@ |
||
| 275 | 275 | return $message; |
| 276 | 276 | } |
| 277 | 277 | |
| 278 | - public function manually_queue_update() { |
|
| 279 | - set_site_transient( 'update_plugins', null ); |
|
| 280 | - } |
|
| 278 | + public function manually_queue_update() { |
|
| 279 | + set_site_transient( 'update_plugins', null ); |
|
| 280 | + } |
|
| 281 | 281 | } |
@@ -38,15 +38,15 @@ discard block |
||
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | public function insert_installed_addon( $plugins ) { |
| 41 | - $plugins[ $this->plugin_slug ] = $this; |
|
| 41 | + $plugins[$this->plugin_slug] = $this; |
|
| 42 | 42 | return $plugins; |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | public static function get_addon( $plugin_slug ) { |
| 46 | 46 | $plugins = apply_filters( 'frm_installed_addons', array() ); |
| 47 | 47 | $plugin = false; |
| 48 | - if ( isset( $plugins[ $plugin_slug ] ) ) { |
|
| 49 | - $plugin = $plugins[ $plugin_slug ]; |
|
| 48 | + if ( isset( $plugins[$plugin_slug] ) ) { |
|
| 49 | + $plugin = $plugins[$plugin_slug]; |
|
| 50 | 50 | } |
| 51 | 51 | return $plugin; |
| 52 | 52 | } |
@@ -122,8 +122,8 @@ discard block |
||
| 122 | 122 | * @since 2.04 |
| 123 | 123 | */ |
| 124 | 124 | private function is_time_to_auto_activate() { |
| 125 | - $last_try = get_option( $this->option_name .'last_activate' ); |
|
| 126 | - return ( ! $last_try || $last_try < strtotime('-1 day') ); |
|
| 125 | + $last_try = get_option( $this->option_name . 'last_activate' ); |
|
| 126 | + return ( ! $last_try || $last_try < strtotime( '-1 day' ) ); |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | private function set_auto_activate_time() { |
@@ -138,19 +138,19 @@ discard block |
||
| 138 | 138 | delete_option( $this->option_name . 'active' ); |
| 139 | 139 | delete_option( $this->option_name . 'key' ); |
| 140 | 140 | delete_site_transient( $this->transient_key() ); |
| 141 | - delete_transient('frm_api_licence'); |
|
| 141 | + delete_transient( 'frm_api_licence' ); |
|
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | public function set_active( $is_active ) { |
| 145 | 145 | update_option( $this->option_name . 'active', $is_active ); |
| 146 | - delete_transient('frm_api_licence'); |
|
| 146 | + delete_transient( 'frm_api_licence' ); |
|
| 147 | 147 | FrmAppHelper::save_combined_js(); |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | public function show_license_message( $file, $plugin ) { |
| 151 | 151 | $wp_list_table = _get_list_table( 'WP_Plugins_List_Table' ); |
| 152 | 152 | echo '<tr class="plugin-update-tr active"><td colspan="' . esc_attr( $wp_list_table->get_column_count() ) . '" class="plugin-update colspanchange"><div class="update-message">'; |
| 153 | - echo sprintf( __( 'Your %1$s license key is missing. Please add it on the %2$slicenses page%3$s.', 'formidable' ), $this->plugin_name, '<a href="' . esc_url( admin_url('admin.php?page=formidable-settings&t=licenses_settings' ) ) . '">', '</a>' ); |
|
| 153 | + echo sprintf( __( 'Your %1$s license key is missing. Please add it on the %2$slicenses page%3$s.', 'formidable' ), $this->plugin_name, '<a href="' . esc_url( admin_url( 'admin.php?page=formidable-settings&t=licenses_settings' ) ) . '">', '</a>' ); |
|
| 154 | 154 | $id = sanitize_title( $plugin['Name'] ); |
| 155 | 155 | echo '<script type="text/javascript">var d = document.getElementById("' . esc_attr( $id ) . '");if ( d !== null ){ d.className = d.className + " update"; }</script>'; |
| 156 | 156 | echo '</div></td></tr>'; |
@@ -163,10 +163,10 @@ discard block |
||
| 163 | 163 | |
| 164 | 164 | if ( $this->is_current_version( $transient ) ) { |
| 165 | 165 | //make sure it doesn't show there is an update if plugin is up-to-date |
| 166 | - if ( isset( $transient->response[ $this->plugin_folder ] ) ) { |
|
| 167 | - unset( $transient->response[ $this->plugin_folder ] ); |
|
| 166 | + if ( isset( $transient->response[$this->plugin_folder] ) ) { |
|
| 167 | + unset( $transient->response[$this->plugin_folder] ); |
|
| 168 | 168 | } |
| 169 | - } else if ( isset( $transient->response ) && isset( $transient->response[ $this->plugin_folder ] ) ) { |
|
| 169 | + } else if ( isset( $transient->response ) && isset( $transient->response[$this->plugin_folder] ) ) { |
|
| 170 | 170 | $cache_key = 'edd_plugin_' . md5( sanitize_key( $this->license . $this->version ) . '_get_version' ); |
| 171 | 171 | $version_info = get_transient( $cache_key ); |
| 172 | 172 | |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | if ( $version_info !== false && version_compare( $version_info->new_version, $this->version, '>' ) ) { |
| 180 | - $transient->response[ $this->plugin_folder ] = $version_info; |
|
| 180 | + $transient->response[$this->plugin_folder] = $version_info; |
|
| 181 | 181 | } else { |
| 182 | 182 | delete_transient( $cache_key ); |
| 183 | 183 | if ( ! $this->has_been_cleared() ) { |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | $this->manually_queue_update(); |
| 187 | 187 | } |
| 188 | 188 | |
| 189 | - unset( $transient->response[ $this->plugin_folder ] ); |
|
| 189 | + unset( $transient->response[$this->plugin_folder] ); |
|
| 190 | 190 | } |
| 191 | 191 | } |
| 192 | 192 | |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | private function is_current_version( $transient ) { |
| 197 | - if ( empty( $transient->checked ) || ! isset( $transient->checked[ $this->plugin_folder ] ) ) { |
|
| 197 | + if ( empty( $transient->checked ) || ! isset( $transient->checked[$this->plugin_folder] ) ) { |
|
| 198 | 198 | return false; |
| 199 | 199 | } |
| 200 | 200 | |
@@ -203,16 +203,16 @@ discard block |
||
| 203 | 203 | return true; |
| 204 | 204 | } |
| 205 | 205 | |
| 206 | - return isset( $transient->response ) && isset( $transient->response[ $this->plugin_folder ] ) && $transient->checked[ $this->plugin_folder ] == $transient->response[ $this->plugin_folder ]->new_version; |
|
| 206 | + return isset( $transient->response ) && isset( $transient->response[$this->plugin_folder] ) && $transient->checked[$this->plugin_folder] == $transient->response[$this->plugin_folder]->new_version; |
|
| 207 | 207 | } |
| 208 | 208 | |
| 209 | 209 | private function has_been_cleared() { |
| 210 | 210 | $last_cleared = get_option( 'frm_last_cleared' ); |
| 211 | - return ( $last_cleared && $last_cleared > date( 'Y-m-d H:i:s', strtotime('-5 minutes') ) ); |
|
| 211 | + return ( $last_cleared && $last_cleared > date( 'Y-m-d H:i:s', strtotime( '-5 minutes' ) ) ); |
|
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | private function cleared_plugins() { |
| 215 | - update_option( 'frm_last_cleared', date('Y-m-d H:i:s') ); |
|
| 215 | + update_option( 'frm_last_cleared', date( 'Y-m-d H:i:s' ) ); |
|
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | private function is_license_revoked() { |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | } |
| 222 | 222 | |
| 223 | 223 | $last_checked = get_site_option( $this->transient_key() ); |
| 224 | - $seven_days_ago = date( 'Y-m-d H:i:s', strtotime('-7 days') ); |
|
| 224 | + $seven_days_ago = date( 'Y-m-d H:i:s', strtotime( '-7 days' ) ); |
|
| 225 | 225 | |
| 226 | 226 | if ( ! $last_checked || $last_checked < $seven_days_ago ) { |
| 227 | 227 | update_site_option( $this->transient_key(), date( 'Y-m-d H:i:s' ) ); // check weekly |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | public static function activate() { |
| 240 | - FrmAppHelper::permission_check('frm_change_settings'); |
|
| 240 | + FrmAppHelper::permission_check( 'frm_change_settings' ); |
|
| 241 | 241 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
| 242 | 242 | |
| 243 | 243 | if ( ! isset( $_POST['license'] ) || empty( $_POST['license'] ) ) { |
@@ -268,8 +268,8 @@ discard block |
||
| 268 | 268 | $response['message'] = $response['status']; |
| 269 | 269 | } else { |
| 270 | 270 | $messages = $this->get_messages(); |
| 271 | - if ( is_string( $response['status'] ) && isset( $messages[ $response['status'] ] ) ) { |
|
| 272 | - $response['message'] = $messages[ $response['status'] ]; |
|
| 271 | + if ( is_string( $response['status'] ) && isset( $messages[$response['status']] ) ) { |
|
| 272 | + $response['message'] = $messages[$response['status']]; |
|
| 273 | 273 | } else { |
| 274 | 274 | $response['message'] = FrmAppHelper::kses( $response['status'], array( 'a' ) ); |
| 275 | 275 | } |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | } |
| 325 | 325 | |
| 326 | 326 | public static function deactivate() { |
| 327 | - FrmAppHelper::permission_check('frm_change_settings'); |
|
| 327 | + FrmAppHelper::permission_check( 'frm_change_settings' ); |
|
| 328 | 328 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
| 329 | 329 | |
| 330 | 330 | $plugin_slug = sanitize_text_field( $_POST['plugin'] ); |
@@ -376,7 +376,7 @@ discard block |
||
| 376 | 376 | |
| 377 | 377 | $message = __( 'Your License Key was invalid', 'formidable' ); |
| 378 | 378 | if ( is_wp_error( $resp ) ) { |
| 379 | - $message = sprintf( __( 'You had an error communicating with the Formidable API. %1$sClick here%2$s for more information.', 'formidable' ), '<a href="https://formidableforms.com/knowledgebase/why-cant-i-activate-formidable-pro/" target="_blank">', '</a>'); |
|
| 379 | + $message = sprintf( __( 'You had an error communicating with the Formidable API. %1$sClick here%2$s for more information.', 'formidable' ), '<a href="https://formidableforms.com/knowledgebase/why-cant-i-activate-formidable-pro/" target="_blank">', '</a>' ); |
|
| 380 | 380 | $message .= ' ' . $resp->get_error_message(); |
| 381 | 381 | } else if ( $body == 'error' || is_wp_error( $body ) ) { |
| 382 | 382 | $message = __( 'You had an HTTP error connecting to the Formidable API', 'formidable' ); |