@@ -1,11 +1,11 @@ |
||
1 | 1 | <div id="postbox-container-1" class="postbox-container"> |
2 | 2 | <?php |
3 | 3 | |
4 | - if ( ! isset($hide_preview) || ! $hide_preview ) { |
|
4 | + if ( ! isset($hide_preview) || ! $hide_preview ) { |
|
5 | 5 | include( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/_publish_box.php' ); |
6 | - } |
|
6 | + } |
|
7 | 7 | |
8 | 8 | include( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/mb_insert_fields.php' ); |
9 | 9 | |
10 | - ?> |
|
10 | + ?> |
|
11 | 11 | </div> |
@@ -1,7 +1,7 @@ |
||
1 | 1 | <div id="postbox-container-1" class="postbox-container"> |
2 | 2 | <?php |
3 | 3 | |
4 | - if ( ! isset($hide_preview) || ! $hide_preview ) { |
|
4 | + if ( ! isset( $hide_preview ) || ! $hide_preview ) { |
|
5 | 5 | include( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/_publish_box.php' ); |
6 | 6 | } |
7 | 7 |
@@ -21,15 +21,15 @@ |
||
21 | 21 | </div> |
22 | 22 | <div class="widget-inside frm_hidden"> |
23 | 23 | <?php |
24 | - if ( defined('DOING_AJAX') || ! $action_control->action_options['ajax_load'] ) { |
|
25 | - // only load settings if they are just added or are open |
|
24 | + if ( defined('DOING_AJAX') || ! $action_control->action_options['ajax_load'] ) { |
|
25 | + // only load settings if they are just added or are open |
|
26 | 26 | include( dirname( __FILE__ ) . '/_action_inside.php' ); |
27 | - } else { |
|
28 | - // include hidden settings so action won't get lost on update ?> |
|
27 | + } else { |
|
28 | + // include hidden settings so action won't get lost on update ?> |
|
29 | 29 | <input type="hidden" name="<?php echo esc_attr( $action_control->get_field_name('post_excerpt', '') ) ?>" class="frm_action_name" value="<?php echo esc_attr( $form_action->post_excerpt ); ?>" /> |
30 | 30 | <input type="hidden" name="<?php echo esc_attr( $action_control->get_field_name('ID', '') ) ?>" value="<?php echo esc_attr( $form_action->ID ); ?>" /> |
31 | 31 | <?php |
32 | - } ?> |
|
32 | + } ?> |
|
33 | 33 | </div> |
34 | 34 | <style type="text/css"> |
35 | 35 | .frm_no_actions{ |
@@ -21,13 +21,13 @@ |
||
21 | 21 | </div> |
22 | 22 | <div class="widget-inside frm_hidden"> |
23 | 23 | <?php |
24 | - if ( defined('DOING_AJAX') || ! $action_control->action_options['ajax_load'] ) { |
|
24 | + if ( defined( 'DOING_AJAX' ) || ! $action_control->action_options['ajax_load'] ) { |
|
25 | 25 | // only load settings if they are just added or are open |
26 | 26 | include( dirname( __FILE__ ) . '/_action_inside.php' ); |
27 | 27 | } else { |
28 | 28 | // include hidden settings so action won't get lost on update ?> |
29 | - <input type="hidden" name="<?php echo esc_attr( $action_control->get_field_name('post_excerpt', '') ) ?>" class="frm_action_name" value="<?php echo esc_attr( $form_action->post_excerpt ); ?>" /> |
|
30 | - <input type="hidden" name="<?php echo esc_attr( $action_control->get_field_name('ID', '') ) ?>" value="<?php echo esc_attr( $form_action->ID ); ?>" /> |
|
29 | + <input type="hidden" name="<?php echo esc_attr( $action_control->get_field_name( 'post_excerpt', '' ) ) ?>" class="frm_action_name" value="<?php echo esc_attr( $form_action->post_excerpt ); ?>" /> |
|
30 | + <input type="hidden" name="<?php echo esc_attr( $action_control->get_field_name( 'ID', '' ) ) ?>" value="<?php echo esc_attr( $form_action->ID ); ?>" /> |
|
31 | 31 | <?php |
32 | 32 | } ?> |
33 | 33 | </div> |
@@ -4,12 +4,12 @@ discard block |
||
4 | 4 | |
5 | 5 | public function __construct() { |
6 | 6 | $action_ops = array( |
7 | - 'classes' => 'frm_email_icon frm_icon_font', |
|
8 | - 'active' => true, |
|
7 | + 'classes' => 'frm_email_icon frm_icon_font', |
|
8 | + 'active' => true, |
|
9 | 9 | 'event' => array( 'create' ), |
10 | - 'limit' => 99, |
|
11 | - 'priority' => 10, |
|
12 | - 'ajax_load' => false, |
|
10 | + 'limit' => 99, |
|
11 | + 'priority' => 10, |
|
12 | + 'ajax_load' => false, |
|
13 | 13 | ); |
14 | 14 | $action_ops = apply_filters('frm_email_control_settings', $action_ops); |
15 | 15 | |
@@ -17,23 +17,23 @@ discard block |
||
17 | 17 | } |
18 | 18 | |
19 | 19 | public function form( $form_action, $args = array() ) { |
20 | - extract($args); |
|
20 | + extract($args); |
|
21 | 21 | |
22 | 22 | include( FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/_email_settings.php' ); |
23 | 23 | } |
24 | 24 | |
25 | 25 | public function get_defaults() { |
26 | - return array( |
|
27 | - 'email_to' => '[admin_email]', |
|
28 | - 'cc' => '', |
|
29 | - 'bcc' => '', |
|
30 | - 'from' => '[sitename] <[admin_email]>', |
|
31 | - 'reply_to' => '', |
|
32 | - 'email_subject' => '', |
|
33 | - 'email_message' => '[default-message]', |
|
34 | - 'inc_user_info' => 0, |
|
35 | - 'plain_text' => 0, |
|
26 | + return array( |
|
27 | + 'email_to' => '[admin_email]', |
|
28 | + 'cc' => '', |
|
29 | + 'bcc' => '', |
|
30 | + 'from' => '[sitename] <[admin_email]>', |
|
31 | + 'reply_to' => '', |
|
32 | + 'email_subject' => '', |
|
33 | + 'email_message' => '[default-message]', |
|
34 | + 'inc_user_info' => 0, |
|
35 | + 'plain_text' => 0, |
|
36 | 36 | 'event' => array( 'create' ), |
37 | - ); |
|
37 | + ); |
|
38 | 38 | } |
39 | 39 | } |
@@ -11,13 +11,13 @@ |
||
11 | 11 | 'priority' => 10, |
12 | 12 | 'ajax_load' => false, |
13 | 13 | ); |
14 | - $action_ops = apply_filters('frm_email_control_settings', $action_ops); |
|
14 | + $action_ops = apply_filters( 'frm_email_control_settings', $action_ops ); |
|
15 | 15 | |
16 | - parent::__construct('email', __( 'Email Notification', 'formidable' ), $action_ops); |
|
16 | + parent::__construct( 'email', __( 'Email Notification', 'formidable' ), $action_ops ); |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | public function form( $form_action, $args = array() ) { |
20 | - extract($args); |
|
20 | + extract( $args ); |
|
21 | 21 | |
22 | 22 | include( FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/_email_settings.php' ); |
23 | 23 | } |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | } |
5 | 5 | |
6 | 6 | class FrmFormsListHelper extends FrmListHelper { |
7 | - var $status = ''; |
|
7 | + var $status = ''; |
|
8 | 8 | |
9 | 9 | public function __construct( $args ) { |
10 | 10 | $this->status = isset( $_REQUEST['form_type'] ) ? $_REQUEST['form_type'] : ''; |
@@ -13,14 +13,14 @@ discard block |
||
13 | 13 | } |
14 | 14 | |
15 | 15 | public function prepare_items() { |
16 | - global $wpdb, $per_page, $mode; |
|
16 | + global $wpdb, $per_page, $mode; |
|
17 | 17 | |
18 | - $mode = empty( $_REQUEST['mode'] ) ? 'list' : $_REQUEST['mode']; |
|
18 | + $mode = empty( $_REQUEST['mode'] ) ? 'list' : $_REQUEST['mode']; |
|
19 | 19 | |
20 | 20 | $default_orderby = 'name'; |
21 | 21 | $default_order = 'ASC'; |
22 | 22 | |
23 | - $orderby = ( isset( $_REQUEST['orderby'] ) ) ? $_REQUEST['orderby'] : $default_orderby; |
|
23 | + $orderby = ( isset( $_REQUEST['orderby'] ) ) ? $_REQUEST['orderby'] : $default_orderby; |
|
24 | 24 | $order = ( isset( $_REQUEST['order'] ) ) ? $_REQUEST['order'] : $default_order; |
25 | 25 | |
26 | 26 | $page = $this->get_pagenum(); |
@@ -28,40 +28,40 @@ discard block |
||
28 | 28 | |
29 | 29 | $start = ( isset( $_REQUEST['start'] ) ) ? $_REQUEST['start'] : (( $page - 1 ) * $per_page); |
30 | 30 | |
31 | - $s_query = array(); |
|
32 | - $s_query[] = array( 'or' => 1, 'parent_form_id' => null, 'parent_form_id <' => 1 ); |
|
31 | + $s_query = array(); |
|
32 | + $s_query[] = array( 'or' => 1, 'parent_form_id' => null, 'parent_form_id <' => 1 ); |
|
33 | 33 | switch ( $this->status ) { |
34 | - case 'template': |
|
35 | - $s_query['is_template'] = 1; |
|
36 | - $s_query['status !'] = 'trash'; |
|
37 | - break; |
|
38 | - case 'draft': |
|
39 | - $s_query['is_template'] = 0; |
|
40 | - $s_query['status'] = 'draft'; |
|
41 | - break; |
|
42 | - case 'trash': |
|
43 | - $s_query['status'] = 'trash'; |
|
44 | - break; |
|
45 | - default: |
|
46 | - $s_query['is_template'] = 0; |
|
47 | - $s_query['status !'] = 'trash'; |
|
48 | - break; |
|
34 | + case 'template': |
|
35 | + $s_query['is_template'] = 1; |
|
36 | + $s_query['status !'] = 'trash'; |
|
37 | + break; |
|
38 | + case 'draft': |
|
39 | + $s_query['is_template'] = 0; |
|
40 | + $s_query['status'] = 'draft'; |
|
41 | + break; |
|
42 | + case 'trash': |
|
43 | + $s_query['status'] = 'trash'; |
|
44 | + break; |
|
45 | + default: |
|
46 | + $s_query['is_template'] = 0; |
|
47 | + $s_query['status !'] = 'trash'; |
|
48 | + break; |
|
49 | 49 | } |
50 | 50 | |
51 | - $s = isset( $_REQUEST['s'] ) ? stripslashes($_REQUEST['s']) : ''; |
|
52 | - if ( $s != '' ) { |
|
53 | - preg_match_all('/".*?("|$)|((?<=[\\s",+])|^)[^\\s",+]+/', $s, $matches); |
|
54 | - $search_terms = array_map('trim', $matches[0]); |
|
55 | - foreach ( (array) $search_terms as $term ) { |
|
56 | - $s_query[] = array( |
|
57 | - 'or' => true, 'name LIKE' => $term, 'description LIKE' => $term, 'created_at LIKE' => $term, |
|
58 | - ); |
|
59 | - unset($term); |
|
60 | - } |
|
61 | - } |
|
51 | + $s = isset( $_REQUEST['s'] ) ? stripslashes($_REQUEST['s']) : ''; |
|
52 | + if ( $s != '' ) { |
|
53 | + preg_match_all('/".*?("|$)|((?<=[\\s",+])|^)[^\\s",+]+/', $s, $matches); |
|
54 | + $search_terms = array_map('trim', $matches[0]); |
|
55 | + foreach ( (array) $search_terms as $term ) { |
|
56 | + $s_query[] = array( |
|
57 | + 'or' => true, 'name LIKE' => $term, 'description LIKE' => $term, 'created_at LIKE' => $term, |
|
58 | + ); |
|
59 | + unset($term); |
|
60 | + } |
|
61 | + } |
|
62 | 62 | |
63 | 63 | $this->items = FrmForm::getAll( $s_query, $orderby . ' ' . $order, $start . ',' . $per_page ); |
64 | - $total_items = FrmDb::get_count( 'frm_forms', $s_query ); |
|
64 | + $total_items = FrmDb::get_count( 'frm_forms', $s_query ); |
|
65 | 65 | |
66 | 66 | $this->set_pagination_args( array( |
67 | 67 | 'total_items' => $total_items, |
@@ -70,69 +70,69 @@ discard block |
||
70 | 70 | } |
71 | 71 | |
72 | 72 | public function no_items() { |
73 | - if ( 'template' == $this->status ) { |
|
74 | - _e( 'No Templates Found.', 'formidable' ) ?> |
|
73 | + if ( 'template' == $this->status ) { |
|
74 | + _e( 'No Templates Found.', 'formidable' ) ?> |
|
75 | 75 | <br/><br/><?php _e( 'To add a new template:', 'formidable' ) ?> |
76 | 76 | <ol><li><?php printf( __( 'Create a new %1$sform%2$s.', 'formidable' ), '<a href="' . esc_url( admin_url( 'admin?page=formidable&frm_action=new' ) ) . '"', '</a>' ) ?></li> |
77 | 77 | <li><?php printf(__( 'After your form is created, go to Formidable -> %1$sForms%2$s.', 'formidable' ), '<a href="?page=formidable">', '</a>') ?></li> |
78 | 78 | <li><?php _e( 'Place your mouse over the name of the form you just created, and click the "Create Template" link.', 'formidable' ) ?></li> |
79 | 79 | </ol> |
80 | 80 | <?php } else { |
81 | - _e( 'No Forms Found.', 'formidable' ) ?> |
|
81 | + _e( 'No Forms Found.', 'formidable' ) ?> |
|
82 | 82 | <a href="<?php echo esc_url( admin_url( 'admin.php?page=formidable&frm_action=new' ) ) ?>"><?php _e( 'Add New', 'formidable' ); ?></a> |
83 | 83 | <?php } |
84 | 84 | } |
85 | 85 | |
86 | 86 | public function get_bulk_actions() { |
87 | - $actions = array(); |
|
87 | + $actions = array(); |
|
88 | 88 | |
89 | 89 | if ( in_array( $this->status, array( '', 'published' ) ) ) { |
90 | - $actions['bulk_create_template'] = __( 'Create Template', 'formidable' ); |
|
91 | - } |
|
92 | - |
|
93 | - if ( 'trash' == $this->status ) { |
|
94 | - if ( current_user_can('frm_edit_forms') ) { |
|
95 | - $actions['bulk_untrash'] = __( 'Restore', 'formidable' ); |
|
96 | - } |
|
97 | - |
|
98 | - if ( current_user_can('frm_delete_forms') ) { |
|
99 | - $actions['bulk_delete'] = __( 'Delete Permanently', 'formidable' ); |
|
100 | - } |
|
101 | - } else if ( EMPTY_TRASH_DAYS && current_user_can('frm_delete_forms') ) { |
|
102 | - $actions['bulk_trash'] = __( 'Move to Trash', 'formidable' ); |
|
103 | - } else if ( current_user_can('frm_delete_forms') ) { |
|
104 | - $actions['bulk_delete'] = __( 'Delete'); |
|
105 | - } |
|
106 | - |
|
107 | - return $actions; |
|
108 | - } |
|
90 | + $actions['bulk_create_template'] = __( 'Create Template', 'formidable' ); |
|
91 | + } |
|
92 | + |
|
93 | + if ( 'trash' == $this->status ) { |
|
94 | + if ( current_user_can('frm_edit_forms') ) { |
|
95 | + $actions['bulk_untrash'] = __( 'Restore', 'formidable' ); |
|
96 | + } |
|
97 | + |
|
98 | + if ( current_user_can('frm_delete_forms') ) { |
|
99 | + $actions['bulk_delete'] = __( 'Delete Permanently', 'formidable' ); |
|
100 | + } |
|
101 | + } else if ( EMPTY_TRASH_DAYS && current_user_can('frm_delete_forms') ) { |
|
102 | + $actions['bulk_trash'] = __( 'Move to Trash', 'formidable' ); |
|
103 | + } else if ( current_user_can('frm_delete_forms') ) { |
|
104 | + $actions['bulk_delete'] = __( 'Delete'); |
|
105 | + } |
|
106 | + |
|
107 | + return $actions; |
|
108 | + } |
|
109 | 109 | |
110 | 110 | public function extra_tablenav( $which ) { |
111 | - if ( 'top' != $which ) { |
|
112 | - return; |
|
113 | - } |
|
111 | + if ( 'top' != $which ) { |
|
112 | + return; |
|
113 | + } |
|
114 | 114 | |
115 | - if ( 'trash' == $this->status && current_user_can('frm_delete_forms') ) { |
|
115 | + if ( 'trash' == $this->status && current_user_can('frm_delete_forms') ) { |
|
116 | 116 | ?> |
117 | 117 | <div class="alignleft actions frm_visible_overflow"> |
118 | 118 | <?php submit_button( __( 'Empty Trash' ), 'apply', 'delete_all', false ); ?> |
119 | 119 | </div> |
120 | 120 | <?php |
121 | - return; |
|
122 | - } |
|
121 | + return; |
|
122 | + } |
|
123 | 123 | |
124 | - if ( 'template' != $this->status ) { |
|
125 | - return; |
|
126 | - } |
|
124 | + if ( 'template' != $this->status ) { |
|
125 | + return; |
|
126 | + } |
|
127 | 127 | |
128 | 128 | $where = apply_filters( 'frm_forms_dropdown', array(), '' ); |
129 | 129 | $forms = FrmForm::get_published_forms( $where ); |
130 | 130 | |
131 | - $base = admin_url('admin.php?page=formidable&form_type=template'); |
|
132 | - $args = array( |
|
133 | - 'frm_action' => 'duplicate', |
|
134 | - 'template' => true, |
|
135 | - ); |
|
131 | + $base = admin_url('admin.php?page=formidable&form_type=template'); |
|
132 | + $args = array( |
|
133 | + 'frm_action' => 'duplicate', |
|
134 | + 'template' => true, |
|
135 | + ); |
|
136 | 136 | |
137 | 137 | ?> |
138 | 138 | <div class="alignleft actions frm_visible_overflow"> |
@@ -140,18 +140,18 @@ discard block |
||
140 | 140 | <a href="#" id="frm-templateDrop" class="frm-dropdown-toggle button" data-toggle="dropdown"><?php _e( 'Create New Template', 'formidable' ) ?> <b class="caret"></b></a> |
141 | 141 | <ul class="frm-dropdown-menu" role="menu" aria-labelledby="frm-templateDrop"> |
142 | 142 | <?php |
143 | - if ( empty( $forms ) ) { ?> |
|
143 | + if ( empty( $forms ) ) { ?> |
|
144 | 144 | <li class="frm_dropdown_li"><?php _e( 'You have not created any forms yet. <br/>You must create a form before you can make a template.', 'formidable' ) ?></li> |
145 | 145 | <?php |
146 | - } else { |
|
147 | - foreach ( $forms as $form ) { |
|
148 | - $args['id'] = $form->id; ?> |
|
146 | + } else { |
|
147 | + foreach ( $forms as $form ) { |
|
148 | + $args['id'] = $form->id; ?> |
|
149 | 149 | <li><a href="<?php echo esc_url( add_query_arg( $args, $base ) ); ?>" tabindex="-1"><?php echo esc_html( empty( $form->name ) ? __( '(no title)' ) : FrmAppHelper::truncate( $form->name, 33 ) ); ?></a></li> |
150 | 150 | <?php |
151 | - unset($form); |
|
151 | + unset($form); |
|
152 | 152 | } |
153 | - } |
|
154 | - ?> |
|
153 | + } |
|
154 | + ?> |
|
155 | 155 | </ul> |
156 | 156 | </div> |
157 | 157 | </div> |
@@ -161,30 +161,30 @@ discard block |
||
161 | 161 | public function get_views() { |
162 | 162 | |
163 | 163 | $statuses = array( |
164 | - 'published' => __( 'My Forms', 'formidable' ), |
|
165 | - 'template' => __( 'Templates', 'formidable' ), |
|
166 | - 'draft' => __( 'Drafts', 'formidable' ), |
|
167 | - 'trash' => __( 'Trash', 'formidable' ), |
|
164 | + 'published' => __( 'My Forms', 'formidable' ), |
|
165 | + 'template' => __( 'Templates', 'formidable' ), |
|
166 | + 'draft' => __( 'Drafts', 'formidable' ), |
|
167 | + 'trash' => __( 'Trash', 'formidable' ), |
|
168 | 168 | ); |
169 | 169 | |
170 | - $links = array(); |
|
171 | - $counts = FrmForm::get_count(); |
|
172 | - $form_type = isset( $_REQUEST['form_type'] ) ? sanitize_text_field( $_REQUEST['form_type'] ) : 'published'; |
|
170 | + $links = array(); |
|
171 | + $counts = FrmForm::get_count(); |
|
172 | + $form_type = isset( $_REQUEST['form_type'] ) ? sanitize_text_field( $_REQUEST['form_type'] ) : 'published'; |
|
173 | 173 | |
174 | - foreach ( $statuses as $status => $name ) { |
|
174 | + foreach ( $statuses as $status => $name ) { |
|
175 | 175 | |
176 | - if ( $status == $form_type ) { |
|
177 | - $class = ' class="current"'; |
|
178 | - } else { |
|
179 | - $class = ''; |
|
180 | - } |
|
176 | + if ( $status == $form_type ) { |
|
177 | + $class = ' class="current"'; |
|
178 | + } else { |
|
179 | + $class = ''; |
|
180 | + } |
|
181 | 181 | |
182 | - if ( $counts->{$status} || 'published' == $status ) { |
|
182 | + if ( $counts->{$status} || 'published' == $status ) { |
|
183 | 183 | $links[ $status ] = '<a href="' . esc_url( '?page=formidable&form_type=' . $status ) . '" ' . $class . '>' . sprintf( __( '%1$s <span class="count">(%2$s)</span>', 'formidable' ), $name, number_format_i18n( $counts->{$status} ) ) . '</a>'; |
184 | - } |
|
184 | + } |
|
185 | 185 | |
186 | - unset($status, $name); |
|
187 | - } |
|
186 | + unset($status, $name); |
|
187 | + } |
|
188 | 188 | |
189 | 189 | return $links; |
190 | 190 | } |
@@ -200,16 +200,16 @@ discard block |
||
200 | 200 | } |
201 | 201 | |
202 | 202 | public function single_row( $item, $style = '' ) { |
203 | - global $frm_vars, $mode; |
|
203 | + global $frm_vars, $mode; |
|
204 | 204 | |
205 | 205 | // Set up the hover actions for this user |
206 | 206 | $actions = array(); |
207 | 207 | $edit_link = '?page=formidable&frm_action=edit&id=' . $item->id; |
208 | 208 | $duplicate_link = '?page=formidable&frm_action=duplicate&id=' . $item->id; |
209 | 209 | |
210 | - $this->get_actions($actions, $item, $edit_link, $duplicate_link); |
|
210 | + $this->get_actions($actions, $item, $edit_link, $duplicate_link); |
|
211 | 211 | |
212 | - $action_links = $this->row_actions( $actions ); |
|
212 | + $action_links = $this->row_actions( $actions ); |
|
213 | 213 | |
214 | 214 | // Set up the checkbox ( because the user is editable, otherwise its empty ) |
215 | 215 | $checkbox = '<input type="checkbox" name="item-action[]" id="cb-item-action-' . absint( $item->id ) . '" value="' . esc_attr( $item->id ) . '" />'; |
@@ -218,9 +218,9 @@ discard block |
||
218 | 218 | |
219 | 219 | list( $columns, $hidden ) = $this->get_column_info(); |
220 | 220 | |
221 | - $format = 'Y/m/d'; |
|
222 | - if ( 'list' != $mode ) { |
|
223 | - $format .= ' \<\b\r \/\> g:i:s a'; |
|
221 | + $format = 'Y/m/d'; |
|
222 | + if ( 'list' != $mode ) { |
|
223 | + $format .= ' \<\b\r \/\> g:i:s a'; |
|
224 | 224 | } |
225 | 225 | |
226 | 226 | foreach ( $columns as $column_name => $column_display_name ) { |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | |
229 | 229 | $style = ''; |
230 | 230 | if ( in_array( $column_name, $hidden ) ) { |
231 | - $class .= ' frm_hidden'; |
|
231 | + $class .= ' frm_hidden'; |
|
232 | 232 | } |
233 | 233 | |
234 | 234 | $class = 'class="' . esc_attr( $class ) . '"'; |
@@ -241,41 +241,41 @@ discard block |
||
241 | 241 | break; |
242 | 242 | case 'id': |
243 | 243 | case 'form_key': |
244 | - $val = $item->{$column_name}; |
|
245 | - break; |
|
244 | + $val = $item->{$column_name}; |
|
245 | + break; |
|
246 | 246 | case 'name': |
247 | - $val = $this->get_form_name( $item, $actions, $edit_link, $mode ); |
|
248 | - $val .= $action_links; |
|
247 | + $val = $this->get_form_name( $item, $actions, $edit_link, $mode ); |
|
248 | + $val .= $action_links; |
|
249 | 249 | |
250 | - break; |
|
250 | + break; |
|
251 | 251 | case 'created_at': |
252 | - $date = date($format, strtotime($item->created_at)); |
|
252 | + $date = date($format, strtotime($item->created_at)); |
|
253 | 253 | $val = '<abbr title="' . esc_attr( date( 'Y/m/d g:i:s A', strtotime( $item->created_at ) ) ) . '">' . $date . '</abbr>'; |
254 | 254 | break; |
255 | 255 | case 'shortcode': |
256 | 256 | $val = '<input type="text" readonly="readonly" class="frm_select_box" value="' . esc_attr( '[formidable id=' . $item->id . ']' ) . '" /><br/>'; |
257 | - if ( 'excerpt' == $mode ) { |
|
257 | + if ( 'excerpt' == $mode ) { |
|
258 | 258 | $val .= '<input type="text" readonly="readonly" class="frm_select_box" value="' . esc_attr( '[formidable key=' . $item->form_key . ']' ) . '" />'; |
259 | - } |
|
260 | - break; |
|
261 | - case 'entries': |
|
259 | + } |
|
260 | + break; |
|
261 | + case 'entries': |
|
262 | 262 | if ( isset( $item->options['no_save'] ) && $item->options['no_save'] ) { |
263 | 263 | $val = '<i class="frm_icon_font frm_forbid_icon frm_bstooltip" title="' . esc_attr('Entries are not being saved', 'formidable' ) . '"></i>'; |
264 | - } else { |
|
265 | - $text = FrmEntry::getRecordCount($item->id); |
|
264 | + } else { |
|
265 | + $text = FrmEntry::getRecordCount($item->id); |
|
266 | 266 | $val = current_user_can('frm_view_entries') ? '<a href="' . esc_url( admin_url( 'admin.php?page=formidable-entries&form=' . $item->id ) ) . '">' . $text . '</a>' : $text; |
267 | - unset($text); |
|
268 | - } |
|
269 | - break; |
|
270 | - case 'type': |
|
271 | - $val = ( $item->is_template && $item->default_template ) ? __( 'Default', 'formidable' ) : __( 'Custom', 'formidable' ); |
|
272 | - break; |
|
267 | + unset($text); |
|
268 | + } |
|
269 | + break; |
|
270 | + case 'type': |
|
271 | + $val = ( $item->is_template && $item->default_template ) ? __( 'Default', 'formidable' ) : __( 'Custom', 'formidable' ); |
|
272 | + break; |
|
273 | 273 | } |
274 | 274 | |
275 | 275 | if ( isset($val) ) { |
276 | - $r .= "<td $attributes>"; |
|
277 | - $r .= $val; |
|
278 | - $r .= '</td>'; |
|
276 | + $r .= "<td $attributes>"; |
|
277 | + $r .= $val; |
|
278 | + $r .= '</td>'; |
|
279 | 279 | } |
280 | 280 | unset($val); |
281 | 281 | } |
@@ -284,38 +284,38 @@ discard block |
||
284 | 284 | return $r; |
285 | 285 | } |
286 | 286 | |
287 | - /** |
|
288 | - * @param string $edit_link |
|
289 | - * @param string $duplicate_link |
|
290 | - */ |
|
291 | - private function get_actions( &$actions, $item, $edit_link, $duplicate_link ) { |
|
287 | + /** |
|
288 | + * @param string $edit_link |
|
289 | + * @param string $duplicate_link |
|
290 | + */ |
|
291 | + private function get_actions( &$actions, $item, $edit_link, $duplicate_link ) { |
|
292 | 292 | if ( 'trash' == $this->status ) { |
293 | 293 | if ( current_user_can('frm_edit_forms') ) { |
294 | 294 | $actions['restore'] = FrmFormsHelper::delete_trash_link( $item->id, $item->status, 'short' ); |
295 | 295 | } |
296 | 296 | |
297 | - if ( current_user_can('frm_delete_forms') ) { |
|
297 | + if ( current_user_can('frm_delete_forms') ) { |
|
298 | 298 | $trash_url = wp_nonce_url( '?page=formidable&form_status=trash&frm_action=destroy&id=' . $item->id, 'destroy_form_' . $item->id ); |
299 | 299 | $actions['trash'] = '<a href="' . esc_url( $trash_url ) .'" class="submitdelete" onclick="return confirm(\'' . __( 'Are you sure you want to permanently delete that?', 'formidable' ) . '\')">' . __( 'Delete Permanently' ) . '</a>'; |
300 | - } |
|
301 | - return; |
|
300 | + } |
|
301 | + return; |
|
302 | 302 | } |
303 | 303 | |
304 | 304 | if ( current_user_can('frm_edit_forms') ) { |
305 | - if ( ! $item->is_template || ! $item->default_template ) { |
|
305 | + if ( ! $item->is_template || ! $item->default_template ) { |
|
306 | 306 | $actions['frm_edit'] = '<a href="' . esc_url( $edit_link ) . '">' . __( 'Edit' ) . '</a>'; |
307 | - } |
|
307 | + } |
|
308 | 308 | |
309 | - if ( $item->is_template ) { |
|
309 | + if ( $item->is_template ) { |
|
310 | 310 | $actions['frm_duplicate'] = '<a href="'. esc_url( wp_nonce_url( $duplicate_link ) ) . '">' . __( 'Create Form from Template', 'formidable' ) . '</a>'; |
311 | - } else { |
|
311 | + } else { |
|
312 | 312 | $actions['frm_settings'] = '<a href="' . esc_url( '?page=formidable&frm_action=settings&id=' . $item->id ) . '">' . __( 'Settings', 'formidable' ) . '</a>'; |
313 | 313 | |
314 | - if ( FrmAppHelper::pro_is_installed() ) { |
|
314 | + if ( FrmAppHelper::pro_is_installed() ) { |
|
315 | 315 | $actions['duplicate'] = '<a href="' . esc_url( wp_nonce_url( $duplicate_link ) ) . '">' . __( 'Duplicate', 'formidable' ) . '</a>'; |
316 | - } |
|
317 | - } |
|
318 | - } |
|
316 | + } |
|
317 | + } |
|
318 | + } |
|
319 | 319 | |
320 | 320 | $actions['trash'] = FrmFormsHelper::delete_trash_link( $item->id, $item->status, 'short' ); |
321 | 321 | if ( empty( $actions['trash'] ) ) { |
@@ -324,52 +324,52 @@ discard block |
||
324 | 324 | } |
325 | 325 | |
326 | 326 | $actions['view'] = '<a href="' . esc_url( FrmFormsHelper::get_direct_link( $item->form_key, $item ) ) . '" target="_blank">' . __( 'Preview') . '</a>'; |
327 | - } |
|
327 | + } |
|
328 | 328 | |
329 | - /** |
|
330 | - * @param string $edit_link |
|
331 | - */ |
|
329 | + /** |
|
330 | + * @param string $edit_link |
|
331 | + */ |
|
332 | 332 | private function get_form_name( $item, $actions, $edit_link, $mode = 'list' ) { |
333 | - $form_name = $item->name; |
|
334 | - if ( trim($form_name) == '' ) { |
|
335 | - $form_name = __( '(no title)'); |
|
336 | - } |
|
333 | + $form_name = $item->name; |
|
334 | + if ( trim($form_name) == '' ) { |
|
335 | + $form_name = __( '(no title)'); |
|
336 | + } |
|
337 | 337 | $form_name = FrmAppHelper::kses( $form_name ); |
338 | 338 | if ( 'excerpt' != $mode ) { |
339 | 339 | $form_name = FrmAppHelper::truncate( $form_name, 50 ); |
340 | 340 | } |
341 | 341 | |
342 | - $val = '<strong>'; |
|
343 | - if ( 'trash' == $this->status ) { |
|
344 | - $val .= $form_name; |
|
345 | - } else { |
|
342 | + $val = '<strong>'; |
|
343 | + if ( 'trash' == $this->status ) { |
|
344 | + $val .= $form_name; |
|
345 | + } else { |
|
346 | 346 | $val .= '<a href="' . esc_url( isset( $actions['frm_edit'] ) ? $edit_link : FrmFormsHelper::get_direct_link( $item->form_key, $item ) ) . '" class="row-title">' . FrmAppHelper::kses( $form_name ) . '</a> '; |
347 | - } |
|
347 | + } |
|
348 | 348 | |
349 | - $this->add_draft_label( $item, $val ); |
|
350 | - $val .= '</strong>'; |
|
349 | + $this->add_draft_label( $item, $val ); |
|
350 | + $val .= '</strong>'; |
|
351 | 351 | |
352 | - $this->add_form_description( $item, $val ); |
|
352 | + $this->add_form_description( $item, $val ); |
|
353 | 353 | |
354 | - return $val; |
|
355 | - } |
|
354 | + return $val; |
|
355 | + } |
|
356 | 356 | |
357 | - /** |
|
358 | - * @param string $val |
|
359 | - */ |
|
360 | - private function add_draft_label( $item, &$val ) { |
|
361 | - if ( 'draft' == $item->status && 'draft' != $this->status ) { |
|
357 | + /** |
|
358 | + * @param string $val |
|
359 | + */ |
|
360 | + private function add_draft_label( $item, &$val ) { |
|
361 | + if ( 'draft' == $item->status && 'draft' != $this->status ) { |
|
362 | 362 | $val .= ' - <span class="post-state">' . __( 'Draft', 'formidable' ) . '</span>'; |
363 | - } |
|
364 | - } |
|
365 | - |
|
366 | - /** |
|
367 | - * @param string $val |
|
368 | - */ |
|
369 | - private function add_form_description( $item, &$val ) { |
|
370 | - global $mode; |
|
371 | - if ( 'excerpt' == $mode ) { |
|
372 | - $val .= FrmAppHelper::truncate(strip_tags($item->description), 50); |
|
373 | - } |
|
374 | - } |
|
363 | + } |
|
364 | + } |
|
365 | + |
|
366 | + /** |
|
367 | + * @param string $val |
|
368 | + */ |
|
369 | + private function add_form_description( $item, &$val ) { |
|
370 | + global $mode; |
|
371 | + if ( 'excerpt' == $mode ) { |
|
372 | + $val .= FrmAppHelper::truncate(strip_tags($item->description), 50); |
|
373 | + } |
|
374 | + } |
|
375 | 375 | } |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | $page = $this->get_pagenum(); |
27 | 27 | $per_page = $this->get_items_per_page( 'formidable_page_formidable_per_page' ); |
28 | 28 | |
29 | - $start = ( isset( $_REQUEST['start'] ) ) ? $_REQUEST['start'] : (( $page - 1 ) * $per_page); |
|
29 | + $start = ( isset( $_REQUEST['start'] ) ) ? $_REQUEST['start'] : ( ( $page - 1 ) * $per_page ); |
|
30 | 30 | |
31 | 31 | $s_query = array(); |
32 | 32 | $s_query[] = array( 'or' => 1, 'parent_form_id' => null, 'parent_form_id <' => 1 ); |
@@ -48,15 +48,15 @@ discard block |
||
48 | 48 | break; |
49 | 49 | } |
50 | 50 | |
51 | - $s = isset( $_REQUEST['s'] ) ? stripslashes($_REQUEST['s']) : ''; |
|
51 | + $s = isset( $_REQUEST['s'] ) ? stripslashes( $_REQUEST['s'] ) : ''; |
|
52 | 52 | if ( $s != '' ) { |
53 | - preg_match_all('/".*?("|$)|((?<=[\\s",+])|^)[^\\s",+]+/', $s, $matches); |
|
54 | - $search_terms = array_map('trim', $matches[0]); |
|
53 | + preg_match_all( '/".*?("|$)|((?<=[\\s",+])|^)[^\\s",+]+/', $s, $matches ); |
|
54 | + $search_terms = array_map( 'trim', $matches[0] ); |
|
55 | 55 | foreach ( (array) $search_terms as $term ) { |
56 | 56 | $s_query[] = array( |
57 | 57 | 'or' => true, 'name LIKE' => $term, 'description LIKE' => $term, 'created_at LIKE' => $term, |
58 | 58 | ); |
59 | - unset($term); |
|
59 | + unset( $term ); |
|
60 | 60 | } |
61 | 61 | } |
62 | 62 | |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | _e( 'No Templates Found.', 'formidable' ) ?> |
75 | 75 | <br/><br/><?php _e( 'To add a new template:', 'formidable' ) ?> |
76 | 76 | <ol><li><?php printf( __( 'Create a new %1$sform%2$s.', 'formidable' ), '<a href="' . esc_url( admin_url( 'admin?page=formidable&frm_action=new' ) ) . '"', '</a>' ) ?></li> |
77 | - <li><?php printf(__( 'After your form is created, go to Formidable -> %1$sForms%2$s.', 'formidable' ), '<a href="?page=formidable">', '</a>') ?></li> |
|
77 | + <li><?php printf( __( 'After your form is created, go to Formidable -> %1$sForms%2$s.', 'formidable' ), '<a href="?page=formidable">', '</a>' ) ?></li> |
|
78 | 78 | <li><?php _e( 'Place your mouse over the name of the form you just created, and click the "Create Template" link.', 'formidable' ) ?></li> |
79 | 79 | </ol> |
80 | 80 | <?php } else { |
@@ -91,17 +91,17 @@ discard block |
||
91 | 91 | } |
92 | 92 | |
93 | 93 | if ( 'trash' == $this->status ) { |
94 | - if ( current_user_can('frm_edit_forms') ) { |
|
94 | + if ( current_user_can( 'frm_edit_forms' ) ) { |
|
95 | 95 | $actions['bulk_untrash'] = __( 'Restore', 'formidable' ); |
96 | 96 | } |
97 | 97 | |
98 | - if ( current_user_can('frm_delete_forms') ) { |
|
98 | + if ( current_user_can( 'frm_delete_forms' ) ) { |
|
99 | 99 | $actions['bulk_delete'] = __( 'Delete Permanently', 'formidable' ); |
100 | 100 | } |
101 | - } else if ( EMPTY_TRASH_DAYS && current_user_can('frm_delete_forms') ) { |
|
101 | + } else if ( EMPTY_TRASH_DAYS && current_user_can( 'frm_delete_forms' ) ) { |
|
102 | 102 | $actions['bulk_trash'] = __( 'Move to Trash', 'formidable' ); |
103 | - } else if ( current_user_can('frm_delete_forms') ) { |
|
104 | - $actions['bulk_delete'] = __( 'Delete'); |
|
103 | + } else if ( current_user_can( 'frm_delete_forms' ) ) { |
|
104 | + $actions['bulk_delete'] = __( 'Delete' ); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | return $actions; |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | return; |
113 | 113 | } |
114 | 114 | |
115 | - if ( 'trash' == $this->status && current_user_can('frm_delete_forms') ) { |
|
115 | + if ( 'trash' == $this->status && current_user_can( 'frm_delete_forms' ) ) { |
|
116 | 116 | ?> |
117 | 117 | <div class="alignleft actions frm_visible_overflow"> |
118 | 118 | <?php submit_button( __( 'Empty Trash' ), 'apply', 'delete_all', false ); ?> |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | $where = apply_filters( 'frm_forms_dropdown', array(), '' ); |
129 | 129 | $forms = FrmForm::get_published_forms( $where ); |
130 | 130 | |
131 | - $base = admin_url('admin.php?page=formidable&form_type=template'); |
|
131 | + $base = admin_url( 'admin.php?page=formidable&form_type=template' ); |
|
132 | 132 | $args = array( |
133 | 133 | 'frm_action' => 'duplicate', |
134 | 134 | 'template' => true, |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | $args['id'] = $form->id; ?> |
149 | 149 | <li><a href="<?php echo esc_url( add_query_arg( $args, $base ) ); ?>" tabindex="-1"><?php echo esc_html( empty( $form->name ) ? __( '(no title)' ) : FrmAppHelper::truncate( $form->name, 33 ) ); ?></a></li> |
150 | 150 | <?php |
151 | - unset($form); |
|
151 | + unset( $form ); |
|
152 | 152 | } |
153 | 153 | } |
154 | 154 | ?> |
@@ -180,10 +180,10 @@ discard block |
||
180 | 180 | } |
181 | 181 | |
182 | 182 | if ( $counts->{$status} || 'published' == $status ) { |
183 | - $links[ $status ] = '<a href="' . esc_url( '?page=formidable&form_type=' . $status ) . '" ' . $class . '>' . sprintf( __( '%1$s <span class="count">(%2$s)</span>', 'formidable' ), $name, number_format_i18n( $counts->{$status} ) ) . '</a>'; |
|
183 | + $links[$status] = '<a href="' . esc_url( '?page=formidable&form_type=' . $status ) . '" ' . $class . '>' . sprintf( __( '%1$s <span class="count">(%2$s)</span>', 'formidable' ), $name, number_format_i18n( $counts->{$status} ) ) . '</a>'; |
|
184 | 184 | } |
185 | 185 | |
186 | - unset($status, $name); |
|
186 | + unset( $status, $name ); |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | return $links; |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | $edit_link = '?page=formidable&frm_action=edit&id=' . $item->id; |
208 | 208 | $duplicate_link = '?page=formidable&frm_action=duplicate&id=' . $item->id; |
209 | 209 | |
210 | - $this->get_actions($actions, $item, $edit_link, $duplicate_link); |
|
210 | + $this->get_actions( $actions, $item, $edit_link, $duplicate_link ); |
|
211 | 211 | |
212 | 212 | $action_links = $this->row_actions( $actions ); |
213 | 213 | |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | |
250 | 250 | break; |
251 | 251 | case 'created_at': |
252 | - $date = date($format, strtotime($item->created_at)); |
|
252 | + $date = date( $format, strtotime( $item->created_at ) ); |
|
253 | 253 | $val = '<abbr title="' . esc_attr( date( 'Y/m/d g:i:s A', strtotime( $item->created_at ) ) ) . '">' . $date . '</abbr>'; |
254 | 254 | break; |
255 | 255 | case 'shortcode': |
@@ -260,11 +260,11 @@ discard block |
||
260 | 260 | break; |
261 | 261 | case 'entries': |
262 | 262 | if ( isset( $item->options['no_save'] ) && $item->options['no_save'] ) { |
263 | - $val = '<i class="frm_icon_font frm_forbid_icon frm_bstooltip" title="' . esc_attr('Saving entries is disabled for this form', 'formidable' ) . '"></i>'; |
|
263 | + $val = '<i class="frm_icon_font frm_forbid_icon frm_bstooltip" title="' . esc_attr( 'Saving entries is disabled for this form', 'formidable' ) . '"></i>'; |
|
264 | 264 | } else { |
265 | - $text = FrmEntry::getRecordCount($item->id); |
|
266 | - $val = current_user_can('frm_view_entries') ? '<a href="' . esc_url( admin_url( 'admin.php?page=formidable-entries&form=' . $item->id ) ) . '">' . $text . '</a>' : $text; |
|
267 | - unset($text); |
|
265 | + $text = FrmEntry::getRecordCount( $item->id ); |
|
266 | + $val = current_user_can( 'frm_view_entries' ) ? '<a href="' . esc_url( admin_url( 'admin.php?page=formidable-entries&form=' . $item->id ) ) . '">' . $text . '</a>' : $text; |
|
267 | + unset( $text ); |
|
268 | 268 | } |
269 | 269 | break; |
270 | 270 | case 'type': |
@@ -272,12 +272,12 @@ discard block |
||
272 | 272 | break; |
273 | 273 | } |
274 | 274 | |
275 | - if ( isset($val) ) { |
|
275 | + if ( isset( $val ) ) { |
|
276 | 276 | $r .= "<td $attributes>"; |
277 | 277 | $r .= $val; |
278 | 278 | $r .= '</td>'; |
279 | 279 | } |
280 | - unset($val); |
|
280 | + unset( $val ); |
|
281 | 281 | } |
282 | 282 | $r .= '</tr>'; |
283 | 283 | |
@@ -290,18 +290,18 @@ discard block |
||
290 | 290 | */ |
291 | 291 | private function get_actions( &$actions, $item, $edit_link, $duplicate_link ) { |
292 | 292 | if ( 'trash' == $this->status ) { |
293 | - if ( current_user_can('frm_edit_forms') ) { |
|
293 | + if ( current_user_can( 'frm_edit_forms' ) ) { |
|
294 | 294 | $actions['restore'] = FrmFormsHelper::delete_trash_link( $item->id, $item->status, 'short' ); |
295 | 295 | } |
296 | 296 | |
297 | - if ( current_user_can('frm_delete_forms') ) { |
|
297 | + if ( current_user_can( 'frm_delete_forms' ) ) { |
|
298 | 298 | $trash_url = wp_nonce_url( '?page=formidable&form_status=trash&frm_action=destroy&id=' . $item->id, 'destroy_form_' . $item->id ); |
299 | 299 | $actions['trash'] = '<a href="' . esc_url( $trash_url ) . '" class="submitdelete" onclick="return confirm(\'' . __( 'Are you sure you want to permanently delete that?', 'formidable' ) . '\')">' . __( 'Delete Permanently' ) . '</a>'; |
300 | 300 | } |
301 | 301 | return; |
302 | 302 | } |
303 | 303 | |
304 | - if ( current_user_can('frm_edit_forms') ) { |
|
304 | + if ( current_user_can( 'frm_edit_forms' ) ) { |
|
305 | 305 | if ( ! $item->is_template || ! $item->default_template ) { |
306 | 306 | $actions['frm_edit'] = '<a href="' . esc_url( $edit_link ) . '">' . __( 'Edit' ) . '</a>'; |
307 | 307 | } |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | unset( $actions['trash'] ); |
324 | 324 | } |
325 | 325 | |
326 | - $actions['view'] = '<a href="' . esc_url( FrmFormsHelper::get_direct_link( $item->form_key, $item ) ) . '" target="_blank">' . __( 'Preview') . '</a>'; |
|
326 | + $actions['view'] = '<a href="' . esc_url( FrmFormsHelper::get_direct_link( $item->form_key, $item ) ) . '" target="_blank">' . __( 'Preview' ) . '</a>'; |
|
327 | 327 | } |
328 | 328 | |
329 | 329 | /** |
@@ -331,8 +331,8 @@ discard block |
||
331 | 331 | */ |
332 | 332 | private function get_form_name( $item, $actions, $edit_link, $mode = 'list' ) { |
333 | 333 | $form_name = $item->name; |
334 | - if ( trim($form_name) == '' ) { |
|
335 | - $form_name = __( '(no title)'); |
|
334 | + if ( trim( $form_name ) == '' ) { |
|
335 | + $form_name = __( '(no title)' ); |
|
336 | 336 | } |
337 | 337 | $form_name = FrmAppHelper::kses( $form_name ); |
338 | 338 | if ( 'excerpt' != $mode ) { |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | private function add_form_description( $item, &$val ) { |
370 | 370 | global $mode; |
371 | 371 | if ( 'excerpt' == $mode ) { |
372 | - $val .= FrmAppHelper::truncate(strip_tags($item->description), 50); |
|
372 | + $val .= FrmAppHelper::truncate( strip_tags( $item->description ), 50 ); |
|
373 | 373 | } |
374 | 374 | } |
375 | 375 | } |
@@ -6,46 +6,46 @@ discard block |
||
6 | 6 | protected $field; |
7 | 7 | |
8 | 8 | public function prepare_items() { |
9 | - global $wpdb, $per_page; |
|
9 | + global $wpdb, $per_page; |
|
10 | 10 | |
11 | 11 | $per_page = $this->get_items_per_page( 'formidable_page_formidable_entries_per_page' ); |
12 | 12 | |
13 | - $form_id = $this->params['form']; |
|
14 | - if ( ! $form_id ) { |
|
15 | - $this->items = array(); |
|
16 | - $this->set_pagination_args( array( |
|
17 | - 'total_items' => 0, |
|
13 | + $form_id = $this->params['form']; |
|
14 | + if ( ! $form_id ) { |
|
15 | + $this->items = array(); |
|
16 | + $this->set_pagination_args( array( |
|
17 | + 'total_items' => 0, |
|
18 | 18 | 'per_page' => $per_page, |
19 | - ) ); |
|
20 | - return; |
|
21 | - } |
|
19 | + ) ); |
|
20 | + return; |
|
21 | + } |
|
22 | 22 | |
23 | 23 | $default_orderby = 'id'; |
24 | 24 | $default_order = 'DESC'; |
25 | 25 | |
26 | - $s_query = array( 'it.form_id' => $form_id ); |
|
26 | + $s_query = array( 'it.form_id' => $form_id ); |
|
27 | 27 | |
28 | 28 | $s = isset( $_REQUEST['s'] ) ? stripslashes($_REQUEST['s']) : ''; |
29 | 29 | |
30 | - if ( $s != '' && FrmAppHelper::pro_is_installed() ) { |
|
31 | - $fid = isset( $_REQUEST['fid'] ) ? sanitize_title( $_REQUEST['fid'] ) : ''; |
|
32 | - $s_query = FrmProEntriesHelper::get_search_str( $s_query, $s, $form_id, $fid); |
|
33 | - } |
|
30 | + if ( $s != '' && FrmAppHelper::pro_is_installed() ) { |
|
31 | + $fid = isset( $_REQUEST['fid'] ) ? sanitize_title( $_REQUEST['fid'] ) : ''; |
|
32 | + $s_query = FrmProEntriesHelper::get_search_str( $s_query, $s, $form_id, $fid); |
|
33 | + } |
|
34 | 34 | |
35 | - $orderby = isset( $_REQUEST['orderby'] ) ? sanitize_title( $_REQUEST['orderby'] ) : $default_orderby; |
|
36 | - if ( strpos($orderby, 'meta') !== false ) { |
|
37 | - $order_field_type = FrmField::get_type( str_replace( 'meta_', '', $orderby ) ); |
|
35 | + $orderby = isset( $_REQUEST['orderby'] ) ? sanitize_title( $_REQUEST['orderby'] ) : $default_orderby; |
|
36 | + if ( strpos($orderby, 'meta') !== false ) { |
|
37 | + $order_field_type = FrmField::get_type( str_replace( 'meta_', '', $orderby ) ); |
|
38 | 38 | $orderby .= in_array( $order_field_type, array( 'number', 'scale' ) ) ? ' +0 ' : ''; |
39 | - } |
|
39 | + } |
|
40 | 40 | |
41 | 41 | $order = isset( $_REQUEST['order'] ) ? sanitize_title( $_REQUEST['order'] ) : $default_order; |
42 | 42 | $order = ' ORDER BY ' . $orderby . ' ' . $order; |
43 | 43 | |
44 | - $page = $this->get_pagenum(); |
|
44 | + $page = $this->get_pagenum(); |
|
45 | 45 | $start = (int) isset( $_REQUEST['start'] ) ? absint( $_REQUEST['start'] ) : ( ( $page - 1 ) * $per_page ); |
46 | 46 | |
47 | 47 | $this->items = FrmEntry::getAll( $s_query, $order, ' LIMIT ' . $start . ',' . $per_page, true, false ); |
48 | - $total_items = FrmEntry::getRecordCount($s_query); |
|
48 | + $total_items = FrmEntry::getRecordCount($s_query); |
|
49 | 49 | |
50 | 50 | $this->set_pagination_args( array( |
51 | 51 | 'total_items' => $total_items, |
@@ -54,17 +54,17 @@ discard block |
||
54 | 54 | } |
55 | 55 | |
56 | 56 | public function no_items() { |
57 | - $s = isset( $_REQUEST['s'] ) ? $_REQUEST['s'] : ''; |
|
58 | - if ( ! empty($s) ) { |
|
59 | - _e( 'No Entries Found', 'formidable' ); |
|
60 | - return; |
|
61 | - } |
|
62 | - |
|
63 | - $form_id = $form = $this->params['form']; |
|
64 | - if ( $form_id ) { |
|
65 | - $form = FrmForm::getOne($form_id); |
|
66 | - } |
|
67 | - $colspan = $this->get_column_count(); |
|
57 | + $s = isset( $_REQUEST['s'] ) ? $_REQUEST['s'] : ''; |
|
58 | + if ( ! empty($s) ) { |
|
59 | + _e( 'No Entries Found', 'formidable' ); |
|
60 | + return; |
|
61 | + } |
|
62 | + |
|
63 | + $form_id = $form = $this->params['form']; |
|
64 | + if ( $form_id ) { |
|
65 | + $form = FrmForm::getOne($form_id); |
|
66 | + } |
|
67 | + $colspan = $this->get_column_count(); |
|
68 | 68 | |
69 | 69 | include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/no_entries.php' ); |
70 | 70 | } |
@@ -74,12 +74,12 @@ discard block |
||
74 | 74 | } |
75 | 75 | |
76 | 76 | /** |
77 | - * Gets the name of the primary column in the Entries screen |
|
78 | - * |
|
79 | - * @since 2.0.14 |
|
80 | - * |
|
81 | - * @return string $primary_column |
|
82 | - */ |
|
77 | + * Gets the name of the primary column in the Entries screen |
|
78 | + * |
|
79 | + * @since 2.0.14 |
|
80 | + * |
|
81 | + * @return string $primary_column |
|
82 | + */ |
|
83 | 83 | protected function get_primary_column_name() { |
84 | 84 | $columns = get_column_headers( $this->screen ); |
85 | 85 | $hidden = get_hidden_columns( $this->screen ); |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | |
104 | 104 | $this->get_actions( $actions, $item, $view_link ); |
105 | 105 | |
106 | - $action_links = $this->row_actions( $actions ); |
|
106 | + $action_links = $this->row_actions( $actions ); |
|
107 | 107 | |
108 | 108 | // Set up the checkbox ( because the user is editable, otherwise its empty ) |
109 | 109 | $checkbox = "<input type='checkbox' name='item-action[]' id='cb-item-action-{$item->id}' value='{$item->id}' />"; |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | $r = "<tr id='item-action-{$item->id}'$style>"; |
112 | 112 | |
113 | 113 | list( $columns, $hidden, , $primary ) = $this->get_column_info(); |
114 | - $action_col = false; |
|
114 | + $action_col = false; |
|
115 | 115 | |
116 | 116 | foreach ( $columns as $column_name => $column_display_name ) { |
117 | 117 | $class = $column_name . ' column-' . $column_name; |
@@ -123,8 +123,8 @@ discard block |
||
123 | 123 | if ( in_array( $column_name, $hidden ) ) { |
124 | 124 | $class .= ' frm_hidden'; |
125 | 125 | } else if ( ! $action_col && ! in_array( $column_name, array( 'cb', 'id', 'form_id', 'post_id' ) ) ) { |
126 | - $action_col = $column_name; |
|
127 | - } |
|
126 | + $action_col = $column_name; |
|
127 | + } |
|
128 | 128 | |
129 | 129 | $attributes = 'class="' . esc_attr( $class ) . '"'; |
130 | 130 | unset($class); |
@@ -140,30 +140,30 @@ discard block |
||
140 | 140 | case 'ip': |
141 | 141 | case 'id': |
142 | 142 | case 'item_key': |
143 | - $val = $item->{$col_name}; |
|
144 | - break; |
|
143 | + $val = $item->{$col_name}; |
|
144 | + break; |
|
145 | 145 | case 'name': |
146 | 146 | case 'description': |
147 | - $val = FrmAppHelper::truncate(strip_tags($item->{$col_name}), 100); |
|
148 | - break; |
|
147 | + $val = FrmAppHelper::truncate(strip_tags($item->{$col_name}), 100); |
|
148 | + break; |
|
149 | 149 | case 'created_at': |
150 | 150 | case 'updated_at': |
151 | - $date = FrmAppHelper::get_formatted_time($item->{$col_name}); |
|
151 | + $date = FrmAppHelper::get_formatted_time($item->{$col_name}); |
|
152 | 152 | $val = '<abbr title="' . esc_attr( FrmAppHelper::get_formatted_time( $item->{$col_name}, '', 'g:i:s A' ) ) . '">' . $date . '</abbr>'; |
153 | 153 | break; |
154 | 154 | case 'is_draft': |
155 | - $val = empty($item->is_draft) ? __( 'No') : __( 'Yes'); |
|
156 | - break; |
|
155 | + $val = empty($item->is_draft) ? __( 'No') : __( 'Yes'); |
|
156 | + break; |
|
157 | 157 | case 'form_id': |
158 | - $val = FrmFormsHelper::edit_form_link($item->form_id); |
|
159 | - break; |
|
158 | + $val = FrmFormsHelper::edit_form_link($item->form_id); |
|
159 | + break; |
|
160 | 160 | case 'post_id': |
161 | - $val = FrmAppHelper::post_edit_link($item->post_id); |
|
162 | - break; |
|
161 | + $val = FrmAppHelper::post_edit_link($item->post_id); |
|
162 | + break; |
|
163 | 163 | case 'user_id': |
164 | - $user = get_userdata($item->user_id); |
|
165 | - $val = $user->user_login; |
|
166 | - break; |
|
164 | + $user = get_userdata($item->user_id); |
|
165 | + $val = $user->user_login; |
|
166 | + break; |
|
167 | 167 | default: |
168 | 168 | $val = apply_filters( 'frm_entries_' . $col_name . '_column', false, compact( 'item' ) ); |
169 | 169 | if ( $val === false ) { |
@@ -173,15 +173,15 @@ discard block |
||
173 | 173 | } |
174 | 174 | |
175 | 175 | if ( isset( $val ) ) { |
176 | - $r .= "<td $attributes>"; |
|
176 | + $r .= "<td $attributes>"; |
|
177 | 177 | if ( $column_name == $action_col ) { |
178 | 178 | $edit_link = '?page=formidable-entries&frm_action=edit&id=' . $item->id; |
179 | 179 | $r .= '<a href="' . esc_url( isset( $actions['edit'] ) ? $edit_link : $view_link ) . '" class="row-title" >' . $val . '</a> '; |
180 | - $r .= $action_links; |
|
180 | + $r .= $action_links; |
|
181 | 181 | } else { |
182 | - $r .= $val; |
|
183 | - } |
|
184 | - $r .= '</td>'; |
|
182 | + $r .= $val; |
|
183 | + } |
|
184 | + $r .= '</td>'; |
|
185 | 185 | } |
186 | 186 | unset($val); |
187 | 187 | } |
@@ -190,19 +190,19 @@ discard block |
||
190 | 190 | return $r; |
191 | 191 | } |
192 | 192 | |
193 | - /** |
|
194 | - * @param string $view_link |
|
195 | - */ |
|
196 | - private function get_actions( &$actions, $item, $view_link ) { |
|
193 | + /** |
|
194 | + * @param string $view_link |
|
195 | + */ |
|
196 | + private function get_actions( &$actions, $item, $view_link ) { |
|
197 | 197 | $actions['view'] = '<a href="' . esc_url( $view_link ) . '">' . __( 'View', 'formidable' ) . '</a>'; |
198 | 198 | |
199 | - if ( current_user_can('frm_delete_entries') ) { |
|
199 | + if ( current_user_can('frm_delete_entries') ) { |
|
200 | 200 | $delete_link = '?page=formidable-entries&frm_action=destroy&id=' . $item->id . '&form=' . $this->params['form']; |
201 | 201 | $actions['delete'] = '<a href="' . esc_url( wp_nonce_url( $delete_link ) ) . '" class="submitdelete" onclick="return confirm(\'' . esc_attr( __( 'Are you sure you want to delete that?', 'formidable' ) ) . '\')">' . __( 'Delete' ) . '</a>'; |
202 | - } |
|
202 | + } |
|
203 | 203 | |
204 | - $actions = apply_filters('frm_row_actions', $actions, $item); |
|
205 | - } |
|
204 | + $actions = apply_filters('frm_row_actions', $actions, $item); |
|
205 | + } |
|
206 | 206 | |
207 | 207 | private function get_column_value( $item, &$val ) { |
208 | 208 | $col_name = $this->column_name; |
@@ -25,15 +25,15 @@ discard block |
||
25 | 25 | |
26 | 26 | $s_query = array( 'it.form_id' => $form_id ); |
27 | 27 | |
28 | - $s = isset( $_REQUEST['s'] ) ? stripslashes($_REQUEST['s']) : ''; |
|
28 | + $s = isset( $_REQUEST['s'] ) ? stripslashes( $_REQUEST['s'] ) : ''; |
|
29 | 29 | |
30 | 30 | if ( $s != '' && FrmAppHelper::pro_is_installed() ) { |
31 | 31 | $fid = isset( $_REQUEST['fid'] ) ? sanitize_title( $_REQUEST['fid'] ) : ''; |
32 | - $s_query = FrmProEntriesHelper::get_search_str( $s_query, $s, $form_id, $fid); |
|
32 | + $s_query = FrmProEntriesHelper::get_search_str( $s_query, $s, $form_id, $fid ); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | $orderby = isset( $_REQUEST['orderby'] ) ? sanitize_title( $_REQUEST['orderby'] ) : $default_orderby; |
36 | - if ( strpos($orderby, 'meta') !== false ) { |
|
36 | + if ( strpos( $orderby, 'meta' ) !== false ) { |
|
37 | 37 | $order_field_type = FrmField::get_type( str_replace( 'meta_', '', $orderby ) ); |
38 | 38 | $orderby .= in_array( $order_field_type, array( 'number', 'scale' ) ) ? ' +0 ' : ''; |
39 | 39 | } |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | $start = (int) isset( $_REQUEST['start'] ) ? absint( $_REQUEST['start'] ) : ( ( $page - 1 ) * $per_page ); |
46 | 46 | |
47 | 47 | $this->items = FrmEntry::getAll( $s_query, $order, ' LIMIT ' . $start . ',' . $per_page, true, false ); |
48 | - $total_items = FrmEntry::getRecordCount($s_query); |
|
48 | + $total_items = FrmEntry::getRecordCount( $s_query ); |
|
49 | 49 | |
50 | 50 | $this->set_pagination_args( array( |
51 | 51 | 'total_items' => $total_items, |
@@ -55,14 +55,14 @@ discard block |
||
55 | 55 | |
56 | 56 | public function no_items() { |
57 | 57 | $s = isset( $_REQUEST['s'] ) ? $_REQUEST['s'] : ''; |
58 | - if ( ! empty($s) ) { |
|
58 | + if ( ! empty( $s ) ) { |
|
59 | 59 | _e( 'No Entries Found', 'formidable' ); |
60 | 60 | return; |
61 | 61 | } |
62 | 62 | |
63 | 63 | $form_id = $form = $this->params['form']; |
64 | 64 | if ( $form_id ) { |
65 | - $form = FrmForm::getOne($form_id); |
|
65 | + $form = FrmForm::getOne( $form_id ); |
|
66 | 66 | } |
67 | 67 | $colspan = $this->get_column_count(); |
68 | 68 | |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | |
111 | 111 | $r = "<tr id='item-action-{$item->id}'$style>"; |
112 | 112 | |
113 | - list( $columns, $hidden, , $primary ) = $this->get_column_info(); |
|
113 | + list( $columns, $hidden,, $primary ) = $this->get_column_info(); |
|
114 | 114 | $action_col = false; |
115 | 115 | |
116 | 116 | foreach ( $columns as $column_name => $column_display_name ) { |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | } |
128 | 128 | |
129 | 129 | $attributes = 'class="' . esc_attr( $class ) . '"'; |
130 | - unset($class); |
|
130 | + unset( $class ); |
|
131 | 131 | $attributes .= ' data-colname="' . $column_display_name . '"'; |
132 | 132 | |
133 | 133 | $col_name = preg_replace( '/^(' . $this->params['form'] . '_)/', '', $column_name ); |
@@ -144,24 +144,24 @@ discard block |
||
144 | 144 | break; |
145 | 145 | case 'name': |
146 | 146 | case 'description': |
147 | - $val = FrmAppHelper::truncate(strip_tags($item->{$col_name}), 100); |
|
147 | + $val = FrmAppHelper::truncate( strip_tags( $item->{$col_name}), 100 ); |
|
148 | 148 | break; |
149 | 149 | case 'created_at': |
150 | 150 | case 'updated_at': |
151 | - $date = FrmAppHelper::get_formatted_time($item->{$col_name}); |
|
151 | + $date = FrmAppHelper::get_formatted_time( $item->{$col_name}); |
|
152 | 152 | $val = '<abbr title="' . esc_attr( FrmAppHelper::get_formatted_time( $item->{$col_name}, '', 'g:i:s A' ) ) . '">' . $date . '</abbr>'; |
153 | 153 | break; |
154 | 154 | case 'is_draft': |
155 | - $val = empty($item->is_draft) ? __( 'No') : __( 'Yes'); |
|
155 | + $val = empty( $item->is_draft ) ? __( 'No' ) : __( 'Yes' ); |
|
156 | 156 | break; |
157 | 157 | case 'form_id': |
158 | - $val = FrmFormsHelper::edit_form_link($item->form_id); |
|
158 | + $val = FrmFormsHelper::edit_form_link( $item->form_id ); |
|
159 | 159 | break; |
160 | 160 | case 'post_id': |
161 | - $val = FrmAppHelper::post_edit_link($item->post_id); |
|
161 | + $val = FrmAppHelper::post_edit_link( $item->post_id ); |
|
162 | 162 | break; |
163 | 163 | case 'user_id': |
164 | - $user = get_userdata($item->user_id); |
|
164 | + $user = get_userdata( $item->user_id ); |
|
165 | 165 | $val = $user->user_login; |
166 | 166 | break; |
167 | 167 | default: |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | } |
184 | 184 | $r .= '</td>'; |
185 | 185 | } |
186 | - unset($val); |
|
186 | + unset( $val ); |
|
187 | 187 | } |
188 | 188 | $r .= '</tr>'; |
189 | 189 | |
@@ -196,12 +196,12 @@ discard block |
||
196 | 196 | private function get_actions( &$actions, $item, $view_link ) { |
197 | 197 | $actions['view'] = '<a href="' . esc_url( $view_link ) . '">' . __( 'View', 'formidable' ) . '</a>'; |
198 | 198 | |
199 | - if ( current_user_can('frm_delete_entries') ) { |
|
199 | + if ( current_user_can( 'frm_delete_entries' ) ) { |
|
200 | 200 | $delete_link = '?page=formidable-entries&frm_action=destroy&id=' . $item->id . '&form=' . $this->params['form']; |
201 | 201 | $actions['delete'] = '<a href="' . esc_url( wp_nonce_url( $delete_link ) ) . '" class="submitdelete" onclick="return confirm(\'' . esc_attr( __( 'Are you sure you want to delete that?', 'formidable' ) ) . '\')">' . __( 'Delete' ) . '</a>'; |
202 | 202 | } |
203 | 203 | |
204 | - $actions = apply_filters('frm_row_actions', $actions, $item); |
|
204 | + $actions = apply_filters( 'frm_row_actions', $actions, $item ); |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | private function get_column_value( $item, &$val ) { |
@@ -1,67 +1,67 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | class FrmStylesHelper { |
3 | 3 | |
4 | - public static function jquery_themes() { |
|
5 | - $themes = array( |
|
6 | - 'ui-lightness' => 'UI Lightness', |
|
7 | - 'ui-darkness' => 'UI Darkness', |
|
8 | - 'smoothness' => 'Smoothness', |
|
9 | - 'start' => 'Start', |
|
10 | - 'redmond' => 'Redmond', |
|
11 | - 'sunny' => 'Sunny', |
|
12 | - 'overcast' => 'Overcast', |
|
13 | - 'le-frog' => 'Le Frog', |
|
14 | - 'flick' => 'Flick', |
|
4 | + public static function jquery_themes() { |
|
5 | + $themes = array( |
|
6 | + 'ui-lightness' => 'UI Lightness', |
|
7 | + 'ui-darkness' => 'UI Darkness', |
|
8 | + 'smoothness' => 'Smoothness', |
|
9 | + 'start' => 'Start', |
|
10 | + 'redmond' => 'Redmond', |
|
11 | + 'sunny' => 'Sunny', |
|
12 | + 'overcast' => 'Overcast', |
|
13 | + 'le-frog' => 'Le Frog', |
|
14 | + 'flick' => 'Flick', |
|
15 | 15 | 'pepper-grinder' => 'Pepper Grinder', |
16 | - 'eggplant' => 'Eggplant', |
|
17 | - 'dark-hive' => 'Dark Hive', |
|
18 | - 'cupertino' => 'Cupertino', |
|
19 | - 'south-street' => 'South Street', |
|
20 | - 'blitzer' => 'Blitzer', |
|
21 | - 'humanity' => 'Humanity', |
|
22 | - 'hot-sneaks' => 'Hot Sneaks', |
|
23 | - 'excite-bike' => 'Excite Bike', |
|
24 | - 'vader' => 'Vader', |
|
25 | - 'dot-luv' => 'Dot Luv', |
|
26 | - 'mint-choc' => 'Mint Choc', |
|
27 | - 'black-tie' => 'Black Tie', |
|
28 | - 'trontastic' => 'Trontastic', |
|
29 | - 'swanky-purse' => 'Swanky Purse', |
|
30 | - ); |
|
31 | - |
|
32 | - $themes = apply_filters('frm_jquery_themes', $themes); |
|
33 | - return $themes; |
|
34 | - } |
|
16 | + 'eggplant' => 'Eggplant', |
|
17 | + 'dark-hive' => 'Dark Hive', |
|
18 | + 'cupertino' => 'Cupertino', |
|
19 | + 'south-street' => 'South Street', |
|
20 | + 'blitzer' => 'Blitzer', |
|
21 | + 'humanity' => 'Humanity', |
|
22 | + 'hot-sneaks' => 'Hot Sneaks', |
|
23 | + 'excite-bike' => 'Excite Bike', |
|
24 | + 'vader' => 'Vader', |
|
25 | + 'dot-luv' => 'Dot Luv', |
|
26 | + 'mint-choc' => 'Mint Choc', |
|
27 | + 'black-tie' => 'Black Tie', |
|
28 | + 'trontastic' => 'Trontastic', |
|
29 | + 'swanky-purse' => 'Swanky Purse', |
|
30 | + ); |
|
31 | + |
|
32 | + $themes = apply_filters('frm_jquery_themes', $themes); |
|
33 | + return $themes; |
|
34 | + } |
|
35 | 35 | |
36 | 36 | public static function jquery_css_url( $theme_css ) { |
37 | - if ( $theme_css == -1 ) { |
|
38 | - return; |
|
39 | - } |
|
40 | - |
|
41 | - if ( ! $theme_css || $theme_css == '' || $theme_css == 'ui-lightness' ) { |
|
42 | - $css_file = FrmAppHelper::plugin_url() . '/css/ui-lightness/jquery-ui.css'; |
|
43 | - } else if ( preg_match('/^http.?:\/\/.*\..*$/', $theme_css) ) { |
|
44 | - $css_file = $theme_css; |
|
45 | - } else { |
|
46 | - $uploads = self::get_upload_base(); |
|
37 | + if ( $theme_css == -1 ) { |
|
38 | + return; |
|
39 | + } |
|
40 | + |
|
41 | + if ( ! $theme_css || $theme_css == '' || $theme_css == 'ui-lightness' ) { |
|
42 | + $css_file = FrmAppHelper::plugin_url() . '/css/ui-lightness/jquery-ui.css'; |
|
43 | + } else if ( preg_match('/^http.?:\/\/.*\..*$/', $theme_css) ) { |
|
44 | + $css_file = $theme_css; |
|
45 | + } else { |
|
46 | + $uploads = self::get_upload_base(); |
|
47 | 47 | $file_path = '/formidable/css/' . $theme_css . '/jquery-ui.css'; |
48 | - if ( file_exists($uploads['basedir'] . $file_path) ) { |
|
49 | - $css_file = $uploads['baseurl'] . $file_path; |
|
50 | - } else { |
|
48 | + if ( file_exists($uploads['basedir'] . $file_path) ) { |
|
49 | + $css_file = $uploads['baseurl'] . $file_path; |
|
50 | + } else { |
|
51 | 51 | $css_file = FrmAppHelper::jquery_ui_base_url() . '/themes/' . $theme_css . '/jquery-ui.min.css'; |
52 | - } |
|
53 | - } |
|
52 | + } |
|
53 | + } |
|
54 | 54 | |
55 | - return $css_file; |
|
56 | - } |
|
55 | + return $css_file; |
|
56 | + } |
|
57 | 57 | |
58 | - public static function enqueue_jquery_css() { |
|
58 | + public static function enqueue_jquery_css() { |
|
59 | 59 | $form = self::get_form_for_page(); |
60 | 60 | $theme_css = FrmStylesController::get_style_val( 'theme_css', $form ); |
61 | - if ( $theme_css != -1 ) { |
|
62 | - wp_enqueue_style('jquery-theme', self::jquery_css_url($theme_css), array(), FrmAppHelper::plugin_version()); |
|
63 | - } |
|
64 | - } |
|
61 | + if ( $theme_css != -1 ) { |
|
62 | + wp_enqueue_style('jquery-theme', self::jquery_css_url($theme_css), array(), FrmAppHelper::plugin_version()); |
|
63 | + } |
|
64 | + } |
|
65 | 65 | |
66 | 66 | public static function get_form_for_page() { |
67 | 67 | global $frm_vars; |
@@ -77,14 +77,14 @@ discard block |
||
77 | 77 | return $form_id; |
78 | 78 | } |
79 | 79 | |
80 | - public static function get_upload_base() { |
|
81 | - $uploads = wp_upload_dir(); |
|
82 | - if ( is_ssl() && ! preg_match('/^https:\/\/.*\..*$/', $uploads['baseurl']) ) { |
|
83 | - $uploads['baseurl'] = str_replace('http://', 'https://', $uploads['baseurl']); |
|
84 | - } |
|
80 | + public static function get_upload_base() { |
|
81 | + $uploads = wp_upload_dir(); |
|
82 | + if ( is_ssl() && ! preg_match('/^https:\/\/.*\..*$/', $uploads['baseurl']) ) { |
|
83 | + $uploads['baseurl'] = str_replace('http://', 'https://', $uploads['baseurl']); |
|
84 | + } |
|
85 | 85 | |
86 | - return $uploads; |
|
87 | - } |
|
86 | + return $uploads; |
|
87 | + } |
|
88 | 88 | |
89 | 89 | public static function style_menu( $active = '' ) { |
90 | 90 | ?> |
@@ -94,22 +94,22 @@ discard block |
||
94 | 94 | <a href="<?php echo esc_url( admin_url('admin.php?page=formidable-styles&frm_action=custom_css' ) ) ?>" class="nav-tab <?php echo ( 'custom_css' == $active ) ? 'nav-tab-active' : '' ?>"><?php _e( 'Custom CSS', 'formidable' ) ?></a> |
95 | 95 | </h2> |
96 | 96 | <?php |
97 | - } |
|
97 | + } |
|
98 | 98 | |
99 | - public static function minus_icons() { |
|
100 | - return array( |
|
99 | + public static function minus_icons() { |
|
100 | + return array( |
|
101 | 101 | 0 => array( '-' => '62e', '+' => '62f' ), |
102 | 102 | 1 => array( '-' => '600', '+' => '602' ), |
103 | 103 | 2 => array( '-' => '604', '+' => '603' ), |
104 | 104 | 3 => array( '-' => '633', '+' => '632' ), |
105 | 105 | 4 => array( '-' => '613', '+' => '60f' ), |
106 | - ); |
|
107 | - } |
|
106 | + ); |
|
107 | + } |
|
108 | 108 | |
109 | - public static function arrow_icons() { |
|
110 | - $minus_icons = self::minus_icons(); |
|
109 | + public static function arrow_icons() { |
|
110 | + $minus_icons = self::minus_icons(); |
|
111 | 111 | |
112 | - return array( |
|
112 | + return array( |
|
113 | 113 | 6 => array( '-' => '62d', '+' => '62a' ), |
114 | 114 | 0 => array( '-' => '60d', '+' => '609' ), |
115 | 115 | 1 => array( '-' => '60e', '+' => '60c' ), |
@@ -117,44 +117,44 @@ discard block |
||
117 | 117 | 3 => array( '-' => '62b', '+' => '628' ), |
118 | 118 | 4 => array( '-' => '62c', '+' => '629' ), |
119 | 119 | 5 => array( '-' => '635', '+' => '634' ), |
120 | - 'p0' => $minus_icons[0], |
|
121 | - 'p1' => $minus_icons[1], |
|
122 | - 'p2' => $minus_icons[2], |
|
123 | - 'p3' => $minus_icons[3], |
|
124 | - 'p4' => $minus_icons[4], |
|
125 | - ); |
|
126 | - } |
|
127 | - |
|
128 | - /** |
|
129 | - * @since 2.0 |
|
130 | - * @return The class for this icon |
|
131 | - */ |
|
120 | + 'p0' => $minus_icons[0], |
|
121 | + 'p1' => $minus_icons[1], |
|
122 | + 'p2' => $minus_icons[2], |
|
123 | + 'p3' => $minus_icons[3], |
|
124 | + 'p4' => $minus_icons[4], |
|
125 | + ); |
|
126 | + } |
|
127 | + |
|
128 | + /** |
|
129 | + * @since 2.0 |
|
130 | + * @return The class for this icon |
|
131 | + */ |
|
132 | 132 | public static function icon_key_to_class( $key, $icon = '+', $type = 'arrow' ) { |
133 | - if ( 'arrow' == $type && is_numeric($key) ) { |
|
134 | - //frm_arrowup6_icon |
|
133 | + if ( 'arrow' == $type && is_numeric($key) ) { |
|
134 | + //frm_arrowup6_icon |
|
135 | 135 | $arrow = array( '-' => 'down', '+' => 'up' ); |
136 | 136 | $class = 'frm_arrow' . $arrow[ $icon ]; |
137 | - } else { |
|
138 | - //frm_minus1_icon |
|
139 | - $key = str_replace('p', '', $key); |
|
137 | + } else { |
|
138 | + //frm_minus1_icon |
|
139 | + $key = str_replace('p', '', $key); |
|
140 | 140 | $plus = array( '-' => 'minus', '+' => 'plus' ); |
141 | 141 | $class = 'frm_' . $plus[ $icon ]; |
142 | - } |
|
142 | + } |
|
143 | 143 | |
144 | - if ( $key ) { |
|
145 | - $class .= $key; |
|
146 | - } |
|
147 | - $class .= '_icon'; |
|
144 | + if ( $key ) { |
|
145 | + $class .= $key; |
|
146 | + } |
|
147 | + $class .= '_icon'; |
|
148 | 148 | |
149 | - return $class; |
|
150 | - } |
|
149 | + return $class; |
|
150 | + } |
|
151 | 151 | |
152 | 152 | public static function bs_icon_select( $style, $frm_style, $type = 'arrow' ) { |
153 | 153 | $function_name = $type . '_icons'; |
154 | 154 | $icons = self::$function_name(); |
155 | 155 | unset( $function_name ); |
156 | 156 | |
157 | - $name = ( 'arrow' == $type ) ? 'collapse_icon' : 'repeat_icon'; |
|
157 | + $name = ( 'arrow' == $type ) ? 'collapse_icon' : 'repeat_icon'; |
|
158 | 158 | ?> |
159 | 159 | <select name="<?php echo esc_attr( $frm_style->get_field_name($name) ) ?>" id="frm_<?php echo esc_attr( $name ) ?>" class="frm_icon_font frm_multiselect hide-if-js"> |
160 | 160 | <?php foreach ( $icons as $key => $icon ) { ?> |
@@ -187,22 +187,22 @@ discard block |
||
187 | 187 | </ul> |
188 | 188 | </div> |
189 | 189 | <?php |
190 | - } |
|
190 | + } |
|
191 | 191 | |
192 | 192 | public static function hex2rgb( $hex ) { |
193 | - $hex = str_replace('#', '', $hex); |
|
193 | + $hex = str_replace('#', '', $hex); |
|
194 | 194 | |
195 | - if ( strlen($hex) == 3 ) { |
|
195 | + if ( strlen($hex) == 3 ) { |
|
196 | 196 | $r = hexdec( substr( $hex, 0, 1 ) . substr( $hex, 0, 1 ) ); |
197 | 197 | $g = hexdec( substr( $hex, 1, 1 ) . substr( $hex, 1, 1 ) ); |
198 | 198 | $b = hexdec( substr( $hex, 2, 1 ) . substr( $hex, 2, 1 ) ); |
199 | - } else { |
|
199 | + } else { |
|
200 | 200 | $r = hexdec( substr( $hex, 0, 2 ) ); |
201 | 201 | $g = hexdec( substr( $hex, 2, 2 ) ); |
202 | 202 | $b = hexdec( substr( $hex, 4, 2 ) ); |
203 | - } |
|
203 | + } |
|
204 | 204 | $rgb = array( $r, $g, $b ); |
205 | - return implode(',', $rgb); // returns the rgb values separated by commas |
|
206 | - //return $rgb; // returns an array with the rgb values |
|
207 | - } |
|
205 | + return implode(',', $rgb); // returns the rgb values separated by commas |
|
206 | + //return $rgb; // returns an array with the rgb values |
|
207 | + } |
|
208 | 208 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | 'swanky-purse' => 'Swanky Purse', |
30 | 30 | ); |
31 | 31 | |
32 | - $themes = apply_filters('frm_jquery_themes', $themes); |
|
32 | + $themes = apply_filters( 'frm_jquery_themes', $themes ); |
|
33 | 33 | return $themes; |
34 | 34 | } |
35 | 35 | |
@@ -40,12 +40,12 @@ discard block |
||
40 | 40 | |
41 | 41 | if ( ! $theme_css || $theme_css == '' || $theme_css == 'ui-lightness' ) { |
42 | 42 | $css_file = FrmAppHelper::plugin_url() . '/css/ui-lightness/jquery-ui.css'; |
43 | - } else if ( preg_match('/^http.?:\/\/.*\..*$/', $theme_css) ) { |
|
43 | + } else if ( preg_match( '/^http.?:\/\/.*\..*$/', $theme_css ) ) { |
|
44 | 44 | $css_file = $theme_css; |
45 | 45 | } else { |
46 | 46 | $uploads = self::get_upload_base(); |
47 | 47 | $file_path = '/formidable/css/' . $theme_css . '/jquery-ui.css'; |
48 | - if ( file_exists($uploads['basedir'] . $file_path) ) { |
|
48 | + if ( file_exists( $uploads['basedir'] . $file_path ) ) { |
|
49 | 49 | $css_file = $uploads['baseurl'] . $file_path; |
50 | 50 | } else { |
51 | 51 | $css_file = FrmAppHelper::jquery_ui_base_url() . '/themes/' . $theme_css . '/jquery-ui.min.css'; |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | $form = self::get_form_for_page(); |
60 | 60 | $theme_css = FrmStylesController::get_style_val( 'theme_css', $form ); |
61 | 61 | if ( $theme_css != -1 ) { |
62 | - wp_enqueue_style('jquery-theme', self::jquery_css_url($theme_css), array(), FrmAppHelper::plugin_version()); |
|
62 | + wp_enqueue_style( 'jquery-theme', self::jquery_css_url( $theme_css ), array(), FrmAppHelper::plugin_version() ); |
|
63 | 63 | } |
64 | 64 | } |
65 | 65 | |
@@ -79,8 +79,8 @@ discard block |
||
79 | 79 | |
80 | 80 | public static function get_upload_base() { |
81 | 81 | $uploads = wp_upload_dir(); |
82 | - if ( is_ssl() && ! preg_match('/^https:\/\/.*\..*$/', $uploads['baseurl']) ) { |
|
83 | - $uploads['baseurl'] = str_replace('http://', 'https://', $uploads['baseurl']); |
|
82 | + if ( is_ssl() && ! preg_match( '/^https:\/\/.*\..*$/', $uploads['baseurl'] ) ) { |
|
83 | + $uploads['baseurl'] = str_replace( 'http://', 'https://', $uploads['baseurl'] ); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | return $uploads; |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | <h2 class="nav-tab-wrapper"> |
92 | 92 | <a href="<?php echo esc_url( admin_url( 'admin.php?page=formidable-styles' ) ) ?>" class="nav-tab <?php echo ( '' == $active ) ? 'nav-tab-active' : '' ?>"><?php _e( 'Edit Styles', 'formidable' ) ?></a> |
93 | 93 | <a href="<?php echo esc_url( admin_url( 'admin.php?page=formidable-styles&frm_action=manage' ) ) ?>" class="nav-tab <?php echo ( 'manage' == $active ) ? 'nav-tab-active' : '' ?>"><?php _e( 'Manage Form Styles', 'formidable' ) ?></a> |
94 | - <a href="<?php echo esc_url( admin_url('admin.php?page=formidable-styles&frm_action=custom_css' ) ) ?>" class="nav-tab <?php echo ( 'custom_css' == $active ) ? 'nav-tab-active' : '' ?>"><?php _e( 'Custom CSS', 'formidable' ) ?></a> |
|
94 | + <a href="<?php echo esc_url( admin_url( 'admin.php?page=formidable-styles&frm_action=custom_css' ) ) ?>" class="nav-tab <?php echo ( 'custom_css' == $active ) ? 'nav-tab-active' : '' ?>"><?php _e( 'Custom CSS', 'formidable' ) ?></a> |
|
95 | 95 | </h2> |
96 | 96 | <?php |
97 | 97 | } |
@@ -130,15 +130,15 @@ discard block |
||
130 | 130 | * @return The class for this icon |
131 | 131 | */ |
132 | 132 | public static function icon_key_to_class( $key, $icon = '+', $type = 'arrow' ) { |
133 | - if ( 'arrow' == $type && is_numeric($key) ) { |
|
133 | + if ( 'arrow' == $type && is_numeric( $key ) ) { |
|
134 | 134 | //frm_arrowup6_icon |
135 | 135 | $arrow = array( '-' => 'down', '+' => 'up' ); |
136 | - $class = 'frm_arrow' . $arrow[ $icon ]; |
|
136 | + $class = 'frm_arrow' . $arrow[$icon]; |
|
137 | 137 | } else { |
138 | 138 | //frm_minus1_icon |
139 | - $key = str_replace('p', '', $key); |
|
139 | + $key = str_replace( 'p', '', $key ); |
|
140 | 140 | $plus = array( '-' => 'minus', '+' => 'plus' ); |
141 | - $class = 'frm_' . $plus[ $icon ]; |
|
141 | + $class = 'frm_' . $plus[$icon]; |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | if ( $key ) { |
@@ -156,9 +156,9 @@ discard block |
||
156 | 156 | |
157 | 157 | $name = ( 'arrow' == $type ) ? 'collapse_icon' : 'repeat_icon'; |
158 | 158 | ?> |
159 | - <select name="<?php echo esc_attr( $frm_style->get_field_name($name) ) ?>" id="frm_<?php echo esc_attr( $name ) ?>" class="frm_icon_font frm_multiselect hide-if-js"> |
|
159 | + <select name="<?php echo esc_attr( $frm_style->get_field_name( $name ) ) ?>" id="frm_<?php echo esc_attr( $name ) ?>" class="frm_icon_font frm_multiselect hide-if-js"> |
|
160 | 160 | <?php foreach ( $icons as $key => $icon ) { ?> |
161 | - <option value="<?php echo esc_attr( $key ) ?>" <?php selected( $style->post_content[ $name ], $key ) ?>> |
|
161 | + <option value="<?php echo esc_attr( $key ) ?>" <?php selected( $style->post_content[$name], $key ) ?>> |
|
162 | 162 | <?php echo '' . $icon['+'] . '; ' . $icon['-'] . ';'; ?> |
163 | 163 | </option> |
164 | 164 | <?php } ?> |
@@ -166,8 +166,8 @@ discard block |
||
166 | 166 | |
167 | 167 | <div class="btn-group hide-if-no-js" id="frm_<?php echo esc_attr( $name ) ?>_select"> |
168 | 168 | <button class="multiselect dropdown-toggle btn btn-default" data-toggle="dropdown" type="button"> |
169 | - <i class="frm_icon_font <?php echo esc_attr( self::icon_key_to_class( $style->post_content[ $name ], '+', $type ) ) ?>"></i> |
|
170 | - <i class="frm_icon_font <?php echo esc_attr( self::icon_key_to_class( $style->post_content[ $name ], '-', $type ) ) ?>"></i> |
|
169 | + <i class="frm_icon_font <?php echo esc_attr( self::icon_key_to_class( $style->post_content[$name], '+', $type ) ) ?>"></i> |
|
170 | + <i class="frm_icon_font <?php echo esc_attr( self::icon_key_to_class( $style->post_content[$name], '-', $type ) ) ?>"></i> |
|
171 | 171 | <b class="caret"></b> |
172 | 172 | </button> |
173 | 173 | <ul class="multiselect-container frm-dropdown-menu"> |
@@ -190,9 +190,9 @@ discard block |
||
190 | 190 | } |
191 | 191 | |
192 | 192 | public static function hex2rgb( $hex ) { |
193 | - $hex = str_replace('#', '', $hex); |
|
193 | + $hex = str_replace( '#', '', $hex ); |
|
194 | 194 | |
195 | - if ( strlen($hex) == 3 ) { |
|
195 | + if ( strlen( $hex ) == 3 ) { |
|
196 | 196 | $r = hexdec( substr( $hex, 0, 1 ) . substr( $hex, 0, 1 ) ); |
197 | 197 | $g = hexdec( substr( $hex, 1, 1 ) . substr( $hex, 1, 1 ) ); |
198 | 198 | $b = hexdec( substr( $hex, 2, 1 ) . substr( $hex, 2, 1 ) ); |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | $b = hexdec( substr( $hex, 4, 2 ) ); |
203 | 203 | } |
204 | 204 | $rgb = array( $r, $g, $b ); |
205 | - return implode(',', $rgb); // returns the rgb values separated by commas |
|
205 | + return implode( ',', $rgb ); // returns the rgb values separated by commas |
|
206 | 206 | //return $rgb; // returns an array with the rgb values |
207 | 207 | } |
208 | 208 | } |
@@ -3,23 +3,23 @@ discard block |
||
3 | 3 | if ( isset($_GET['frm_style_setting']) || isset($_GET['flat']) ) { |
4 | 4 | if ( isset( $_GET['frm_style_setting'] ) ) { |
5 | 5 | extract( $_GET['frm_style_setting']['post_content'] ); |
6 | - } else { |
|
7 | - extract($_GET); |
|
8 | - } |
|
6 | + } else { |
|
7 | + extract($_GET); |
|
8 | + } |
|
9 | 9 | |
10 | - $important_style = isset($important_style) ? $important_style : 0; |
|
11 | - $auto_width = isset($auto_width) ? $auto_width : 0; |
|
12 | - $submit_style = isset($submit_style) ? $submit_style : 0; |
|
10 | + $important_style = isset($important_style) ? $important_style : 0; |
|
11 | + $auto_width = isset($auto_width) ? $auto_width : 0; |
|
12 | + $submit_style = isset($submit_style) ? $submit_style : 0; |
|
13 | 13 | |
14 | 14 | $style_name = FrmAppHelper::simple_get( 'style_name', 'sanitize_title' ); |
15 | 15 | if ( ! empty( $style_name ) ) { |
16 | 16 | $style_class = $style_name . '.with_frm_style'; |
17 | - } else { |
|
18 | - $style_class = 'with_frm_style'; |
|
19 | - } |
|
17 | + } else { |
|
18 | + $style_class = 'with_frm_style'; |
|
19 | + } |
|
20 | 20 | } else { |
21 | 21 | $style_class = 'frm_style_' . $style->post_name . '.with_frm_style'; |
22 | - extract($style->post_content); |
|
22 | + extract($style->post_content); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | $important = empty($important_style) ? '' : ' !important'; |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | } |
41 | 41 | |
42 | 42 | if ( ! isset($collapse_icon) ) { |
43 | - $collapse_icon = 0; |
|
43 | + $collapse_icon = 0; |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | if ( ! isset( $center_form ) ) { |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | color:#<?php echo esc_html( $text_color . $important ) ?>; |
338 | 338 | background-color:<?php echo esc_html( ( empty( $bg_color ) ? 'transparent' : '#' . $bg_color ) . $important ); ?>; |
339 | 339 | <?php if ( ! empty($important) ) { |
340 | - echo esc_html( 'background-image:none' . $important . ';' ); |
|
340 | + echo esc_html( 'background-image:none' . $important . ';' ); |
|
341 | 341 | } |
342 | 342 | ?> |
343 | 343 | border-color:#<?php echo esc_html( $border_color . $important ) ?>; |
@@ -548,7 +548,7 @@ discard block |
||
548 | 548 | color:#<?php echo esc_html( $submit_active_color . $important ) ?>; |
549 | 549 | } |
550 | 550 | <?php |
551 | - } |
|
551 | + } |
|
552 | 552 | } |
553 | 553 | ?> |
554 | 554 | |
@@ -851,11 +851,11 @@ discard block |
||
851 | 851 | |
852 | 852 | .<?php echo esc_html( $style_class ) ?> .chosen-container-single .chosen-single div{ |
853 | 853 | <?php |
854 | - // calculate the top position based on field padding |
|
855 | - $top_pad = explode(' ', $field_pad); |
|
856 | - $top_pad = reset($top_pad); // the top padding is listed first |
|
857 | - $pad_unit = preg_replace('/[0-9]+/', '', $top_pad); //px, em, rem... |
|
858 | - $top_margin = (int) str_replace($pad_unit, '', $top_pad) / 2; |
|
854 | + // calculate the top position based on field padding |
|
855 | + $top_pad = explode(' ', $field_pad); |
|
856 | + $top_pad = reset($top_pad); // the top padding is listed first |
|
857 | + $pad_unit = preg_replace('/[0-9]+/', '', $top_pad); //px, em, rem... |
|
858 | + $top_margin = (int) str_replace($pad_unit, '', $top_pad) / 2; |
|
859 | 859 | ?> |
860 | 860 | top:<?php echo esc_html( $top_margin . $pad_unit . $important ) ?>; |
861 | 861 | } |
@@ -1,15 +1,15 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if ( isset($_GET['frm_style_setting']) || isset($_GET['flat']) ) { |
|
3 | +if ( isset( $_GET['frm_style_setting'] ) || isset( $_GET['flat'] ) ) { |
|
4 | 4 | if ( isset( $_GET['frm_style_setting'] ) ) { |
5 | 5 | extract( $_GET['frm_style_setting']['post_content'] ); |
6 | 6 | } else { |
7 | - extract($_GET); |
|
7 | + extract( $_GET ); |
|
8 | 8 | } |
9 | 9 | |
10 | - $important_style = isset($important_style) ? $important_style : 0; |
|
11 | - $auto_width = isset($auto_width) ? $auto_width : 0; |
|
12 | - $submit_style = isset($submit_style) ? $submit_style : 0; |
|
10 | + $important_style = isset( $important_style ) ? $important_style : 0; |
|
11 | + $auto_width = isset( $auto_width ) ? $auto_width : 0; |
|
12 | + $submit_style = isset( $submit_style ) ? $submit_style : 0; |
|
13 | 13 | |
14 | 14 | $style_name = FrmAppHelper::simple_get( 'style_name', 'sanitize_title' ); |
15 | 15 | if ( ! empty( $style_name ) ) { |
@@ -19,10 +19,10 @@ discard block |
||
19 | 19 | } |
20 | 20 | } else { |
21 | 21 | $style_class = 'frm_style_' . $style->post_name . '.with_frm_style'; |
22 | - extract($style->post_content); |
|
22 | + extract( $style->post_content ); |
|
23 | 23 | } |
24 | 24 | |
25 | -$important = empty($important_style) ? '' : ' !important'; |
|
25 | +$important = empty( $important_style ) ? '' : ' !important'; |
|
26 | 26 | $label_margin = (int) $width + 10; |
27 | 27 | |
28 | 28 | $minus_icons = FrmStylesHelper::minus_icons(); |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | $change_margin = 650 . 'px'; |
42 | 42 | } |
43 | 43 | |
44 | -if ( ! isset($collapse_icon) ) { |
|
44 | +if ( ! isset( $collapse_icon ) ) { |
|
45 | 45 | $collapse_icon = 0; |
46 | 46 | } |
47 | 47 | |
@@ -150,11 +150,11 @@ discard block |
||
150 | 150 | } |
151 | 151 | |
152 | 152 | .<?php echo esc_html( $style_class ) ?> .frm_icon_font.frm_minus_icon:before{ |
153 | - content:"\e<?php echo esc_html( isset( $minus_icons[ $repeat_icon ] ) ? $minus_icons[ $repeat_icon ]['-'] : $minus_icons[1]['-'] ) ?>"; |
|
153 | + content:"\e<?php echo esc_html( isset( $minus_icons[$repeat_icon] ) ? $minus_icons[$repeat_icon]['-'] : $minus_icons[1]['-'] ) ?>"; |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | .<?php echo esc_html( $style_class ) ?> .frm_icon_font.frm_plus_icon:before{ |
157 | - content:"\e<?php echo esc_html( isset( $minus_icons[ $repeat_icon ] ) ? $minus_icons[ $repeat_icon ]['+'] : $minus_icons[1]['+'] ) ?>"; |
|
157 | + content:"\e<?php echo esc_html( isset( $minus_icons[$repeat_icon] ) ? $minus_icons[$repeat_icon]['+'] : $minus_icons[1]['+'] ) ?>"; |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | .<?php echo esc_html( $style_class ) ?> .frm_icon_font.frm_minus_icon:before, |
@@ -163,11 +163,11 @@ discard block |
||
163 | 163 | } |
164 | 164 | |
165 | 165 | .<?php echo esc_html( $style_class ) ?> .frm_trigger.active .frm_icon_font.frm_arrow_icon:before{ |
166 | - content:"\e<?php echo esc_html( isset( $arrow_icons[ $collapse_icon ] ) ? $arrow_icons[ $collapse_icon ]['-'] : $arrow_icons[1]['-'] ) ?>"; |
|
166 | + content:"\e<?php echo esc_html( isset( $arrow_icons[$collapse_icon] ) ? $arrow_icons[$collapse_icon]['-'] : $arrow_icons[1]['-'] ) ?>"; |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | .<?php echo esc_html( $style_class ) ?> .frm_trigger .frm_icon_font.frm_arrow_icon:before{ |
170 | - content:"\e<?php echo esc_html( isset( $arrow_icons[ $collapse_icon ] ) ? $arrow_icons[ $collapse_icon ]['+'] : $arrow_icons[1]['+'] ) ?>"; |
|
170 | + content:"\e<?php echo esc_html( isset( $arrow_icons[$collapse_icon] ) ? $arrow_icons[$collapse_icon]['+'] : $arrow_icons[1]['+'] ) ?>"; |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | .<?php echo esc_html( $style_class ) ?> .form-field{ |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | .<?php echo esc_html( $style_class ) ?> .chosen-container-single .chosen-single{ |
343 | 343 | color:#<?php echo esc_html( $text_color . $important ) ?>; |
344 | 344 | background-color:<?php echo esc_html( ( empty( $bg_color ) ? 'transparent' : '#' . $bg_color ) . $important ); ?>; |
345 | -<?php if ( ! empty($important) ) { |
|
345 | +<?php if ( ! empty( $important ) ) { |
|
346 | 346 | echo esc_html( 'background-image:none' . $important . ';' ); |
347 | 347 | } |
348 | 348 | ?> |
@@ -500,7 +500,7 @@ discard block |
||
500 | 500 | line-height:normal<?php echo esc_html( $important ) ?>; |
501 | 501 | text-align:center; |
502 | 502 | background:#<?php echo esc_html( $submit_bg_color ); |
503 | - if ( ! empty($submit_bg_img) ) { |
|
503 | + if ( ! empty( $submit_bg_img ) ) { |
|
504 | 504 | echo esc_html( ' url(' . $submit_bg_img . ')' ); |
505 | 505 | } |
506 | 506 | echo esc_html( $important ); ?>; |
@@ -861,10 +861,10 @@ discard block |
||
861 | 861 | .<?php echo esc_html( $style_class ) ?> .chosen-container-single .chosen-single div{ |
862 | 862 | <?php |
863 | 863 | // calculate the top position based on field padding |
864 | - $top_pad = explode(' ', $field_pad); |
|
865 | - $top_pad = reset($top_pad); // the top padding is listed first |
|
866 | - $pad_unit = preg_replace('/[0-9]+/', '', $top_pad); //px, em, rem... |
|
867 | - $top_margin = (int) str_replace($pad_unit, '', $top_pad) / 2; |
|
864 | + $top_pad = explode( ' ', $field_pad ); |
|
865 | + $top_pad = reset( $top_pad ); // the top padding is listed first |
|
866 | + $pad_unit = preg_replace( '/[0-9]+/', '', $top_pad ); //px, em, rem... |
|
867 | + $top_margin = (int) str_replace( $pad_unit, '', $top_pad ) / 2; |
|
868 | 868 | ?> |
869 | 869 | top:<?php echo esc_html( $top_margin . $pad_unit . $important ) ?>; |
870 | 870 | } |
@@ -1,15 +1,15 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if ( ! isset($saving) ) { |
3 | - header( 'Content-type: text/css' ); |
|
3 | + header( 'Content-type: text/css' ); |
|
4 | 4 | |
5 | - if ( isset($css) && $css ) { |
|
6 | - echo $css; |
|
7 | - die(); |
|
8 | - } |
|
5 | + if ( isset($css) && $css ) { |
|
6 | + echo $css; |
|
7 | + die(); |
|
8 | + } |
|
9 | 9 | } |
10 | 10 | |
11 | 11 | if ( ! isset($frm_style) ) { |
12 | - $frm_style = new FrmStyle(); |
|
12 | + $frm_style = new FrmStyle(); |
|
13 | 13 | } |
14 | 14 | |
15 | 15 | $styles = $frm_style->get_all(); |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | <?php |
188 | 188 | foreach ( $styles as $style ) { |
189 | 189 | include( dirname( __FILE__ ) . '/_single_theme.css.php' ); |
190 | - unset($style); |
|
190 | + unset($style); |
|
191 | 191 | } |
192 | 192 | ?> |
193 | 193 |
@@ -1,19 +1,19 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! isset($saving) ) { |
|
2 | +if ( ! isset( $saving ) ) { |
|
3 | 3 | header( 'Content-type: text/css' ); |
4 | 4 | |
5 | - if ( isset($css) && $css ) { |
|
5 | + if ( isset( $css ) && $css ) { |
|
6 | 6 | echo $css; |
7 | 7 | die(); |
8 | 8 | } |
9 | 9 | } |
10 | 10 | |
11 | -if ( ! isset($frm_style) ) { |
|
11 | +if ( ! isset( $frm_style ) ) { |
|
12 | 12 | $frm_style = new FrmStyle(); |
13 | 13 | } |
14 | 14 | |
15 | 15 | $styles = $frm_style->get_all(); |
16 | -$default_style = $frm_style->get_default_style($styles); |
|
16 | +$default_style = $frm_style->get_default_style( $styles ); |
|
17 | 17 | $defaults = $default_style->post_content; |
18 | 18 | ?> |
19 | 19 | |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | <?php |
195 | 195 | foreach ( $styles as $style ) { |
196 | 196 | include( dirname( __FILE__ ) . '/_single_theme.css.php' ); |
197 | - unset($style); |
|
197 | + unset( $style ); |
|
198 | 198 | } |
199 | 199 | ?> |
200 | 200 | |
@@ -619,7 +619,7 @@ discard block |
||
619 | 619 | overflow:hidden!important; |
620 | 620 | } |
621 | 621 | |
622 | -<?php include( dirname(__FILE__) . '/frm_grids.css' ); ?> |
|
622 | +<?php include( dirname( __FILE__ ) . '/frm_grids.css' ); ?> |
|
623 | 623 | |
624 | 624 | /* Left and right label styling for non-Formidable styling - very basic, not responsive */ |
625 | 625 | .frm_form_field.frm_left_container label.frm_primary_label{ |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | public static function menu() { |
6 | 6 | FrmAppHelper::force_capability( 'frm_view_entries' ); |
7 | 7 | |
8 | - add_submenu_page('formidable', 'Formidable | ' . __( 'Entries', 'formidable' ), __( 'Entries', 'formidable' ), 'frm_view_entries', 'formidable-entries', 'FrmEntriesController::route' ); |
|
8 | + add_submenu_page( 'formidable', 'Formidable | ' . __( 'Entries', 'formidable' ), __( 'Entries', 'formidable' ), 'frm_view_entries', 'formidable-entries', 'FrmEntriesController::route' ); |
|
9 | 9 | |
10 | 10 | if ( ! in_array( FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' ), array( 'edit', 'show' ) ) ) { |
11 | 11 | $menu_name = FrmAppHelper::get_menu_name(); |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | 'id' => 'formidable-entries-tab', |
54 | 54 | 'title' => __( 'Overview', 'formidable' ), |
55 | 55 | 'content' => '<p>' . esc_html__( 'This screen provides access to all of your entries. You can customize the display of this screen to suit your workflow.', 'formidable' ) . '</p> <p>' . esc_html__( 'Hovering over a row in the entries list will display action links that allow you to manage your entry.', 'formidable' ) . '</p>', |
56 | - )); |
|
56 | + ) ); |
|
57 | 57 | |
58 | 58 | $screen->set_help_sidebar( |
59 | 59 | '<p><strong>' . esc_html__( 'For more information:', 'formidable' ) . '</strong></p>' . |
@@ -68,14 +68,14 @@ discard block |
||
68 | 68 | global $frm_vars, $wpdb; |
69 | 69 | $form_id = FrmForm::get_current_form_id(); |
70 | 70 | |
71 | - $columns[ $form_id . '_id' ] = 'ID'; |
|
72 | - $columns[ $form_id . '_item_key' ] = esc_html__( 'Entry Key', 'formidable' ); |
|
71 | + $columns[$form_id . '_id'] = 'ID'; |
|
72 | + $columns[$form_id . '_item_key'] = esc_html__( 'Entry Key', 'formidable' ); |
|
73 | 73 | |
74 | 74 | if ( ! $form_id ) { |
75 | 75 | return $columns; |
76 | 76 | } |
77 | 77 | |
78 | - $form_cols = FrmField::get_all_for_form($form_id, '', 'include'); |
|
78 | + $form_cols = FrmField::get_all_for_form( $form_id, '', 'include' ); |
|
79 | 79 | |
80 | 80 | foreach ( $form_cols as $form_col ) { |
81 | 81 | if ( FrmField::is_no_save_field( $form_col->type ) ) { |
@@ -88,30 +88,30 @@ discard block |
||
88 | 88 | if ( $sub_form_cols ) { |
89 | 89 | foreach ( $sub_form_cols as $k => $sub_form_col ) { |
90 | 90 | if ( FrmField::is_no_save_field( $sub_form_col->type ) ) { |
91 | - unset( $sub_form_cols[ $k ] ); |
|
91 | + unset( $sub_form_cols[$k] ); |
|
92 | 92 | continue; |
93 | 93 | } |
94 | - $columns[ $form_id . '_' . $sub_form_col->field_key . '-_-' . $form_col->id ] = FrmAppHelper::truncate( $sub_form_col->name, 35 ); |
|
95 | - unset($sub_form_col); |
|
94 | + $columns[$form_id . '_' . $sub_form_col->field_key . '-_-' . $form_col->id] = FrmAppHelper::truncate( $sub_form_col->name, 35 ); |
|
95 | + unset( $sub_form_col ); |
|
96 | 96 | } |
97 | 97 | } |
98 | - unset($sub_form_cols); |
|
98 | + unset( $sub_form_cols ); |
|
99 | 99 | } else { |
100 | 100 | $col_id = $form_col->field_key; |
101 | 101 | if ( $form_col->form_id != $form_id ) { |
102 | 102 | $col_id .= '-_-form' . $form_col->form_id; |
103 | 103 | } |
104 | 104 | |
105 | - if ( isset($form_col->field_options['separate_value']) && $form_col->field_options['separate_value'] ) { |
|
106 | - $columns[ $form_id . '_frmsep_' . $col_id ] = FrmAppHelper::truncate( $form_col->name, 35 ); |
|
105 | + if ( isset( $form_col->field_options['separate_value'] ) && $form_col->field_options['separate_value'] ) { |
|
106 | + $columns[$form_id . '_frmsep_' . $col_id] = FrmAppHelper::truncate( $form_col->name, 35 ); |
|
107 | 107 | } |
108 | - $columns[ $form_id . '_' . $col_id ] = FrmAppHelper::truncate( $form_col->name, 35 ); |
|
108 | + $columns[$form_id . '_' . $col_id] = FrmAppHelper::truncate( $form_col->name, 35 ); |
|
109 | 109 | } |
110 | 110 | } |
111 | 111 | |
112 | - $columns[ $form_id . '_created_at' ] = __( 'Entry creation date', 'formidable' ); |
|
113 | - $columns[ $form_id . '_updated_at' ] = __( 'Entry update date', 'formidable' ); |
|
114 | - $columns[ $form_id . '_ip' ] = 'IP'; |
|
112 | + $columns[$form_id . '_created_at'] = __( 'Entry creation date', 'formidable' ); |
|
113 | + $columns[$form_id . '_updated_at'] = __( 'Entry update date', 'formidable' ); |
|
114 | + $columns[$form_id . '_ip'] = 'IP'; |
|
115 | 115 | |
116 | 116 | $frm_vars['cols'] = $columns; |
117 | 117 | |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | |
137 | 137 | global $frm_vars; |
138 | 138 | //add a check so we don't create a loop |
139 | - $frm_vars['prev_hidden_cols'] = ( isset($frm_vars['prev_hidden_cols']) && $frm_vars['prev_hidden_cols'] ) ? false : $prev_value; |
|
139 | + $frm_vars['prev_hidden_cols'] = ( isset( $frm_vars['prev_hidden_cols'] ) && $frm_vars['prev_hidden_cols'] ) ? false : $prev_value; |
|
140 | 140 | |
141 | 141 | return $check; |
142 | 142 | } |
@@ -151,19 +151,19 @@ discard block |
||
151 | 151 | } |
152 | 152 | |
153 | 153 | global $frm_vars; |
154 | - if ( ! isset($frm_vars['prev_hidden_cols']) || ! $frm_vars['prev_hidden_cols'] ) { |
|
154 | + if ( ! isset( $frm_vars['prev_hidden_cols'] ) || ! $frm_vars['prev_hidden_cols'] ) { |
|
155 | 155 | return; //don't continue if there's no previous value |
156 | 156 | } |
157 | 157 | |
158 | 158 | foreach ( $meta_value as $mk => $mv ) { |
159 | 159 | //remove blank values |
160 | - if ( empty( $mv ) ) { |
|
161 | - unset( $meta_value[ $mk ] ); |
|
160 | + if ( empty( $mv ) ) { |
|
161 | + unset( $meta_value[$mk] ); |
|
162 | 162 | } |
163 | 163 | } |
164 | 164 | |
165 | - $cur_form_prefix = reset($meta_value); |
|
166 | - $cur_form_prefix = explode('_', $cur_form_prefix); |
|
165 | + $cur_form_prefix = reset( $meta_value ); |
|
166 | + $cur_form_prefix = explode( '_', $cur_form_prefix ); |
|
167 | 167 | $cur_form_prefix = $cur_form_prefix[0]; |
168 | 168 | $save = false; |
169 | 169 | |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | |
183 | 183 | $meta_value[] = $prev_hidden; |
184 | 184 | $save = true; |
185 | - unset($form_prefix); |
|
185 | + unset( $form_prefix ); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | if ( $save ) { |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | foreach ( $fields as $field ) { |
215 | 215 | if ( $field->type != 'checkbox' && ( ! isset( $field->field_options['post_field'] ) || $field->field_options['post_field'] == '' ) ) { |
216 | 216 | // Can't sort on checkboxes because they are stored serialized, or post fields |
217 | - $columns[ $form_id . '_' . $field->field_key ] = 'meta_' . $field->id; |
|
217 | + $columns[$form_id . '_' . $field->field_key] = 'meta_' . $field->id; |
|
218 | 218 | } |
219 | 219 | } |
220 | 220 | |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | break; |
238 | 238 | } |
239 | 239 | |
240 | - unset($form_prefix); |
|
240 | + unset( $form_prefix ); |
|
241 | 241 | } |
242 | 242 | } |
243 | 243 | |
@@ -245,36 +245,36 @@ discard block |
||
245 | 245 | return $result; |
246 | 246 | } |
247 | 247 | |
248 | - $i = isset($frm_vars['cols']) ? count($frm_vars['cols']) : 0; |
|
248 | + $i = isset( $frm_vars['cols'] ) ? count( $frm_vars['cols'] ) : 0; |
|
249 | 249 | $max_columns = 8; |
250 | 250 | if ( $i <= $max_columns ) { |
251 | 251 | return $result; |
252 | 252 | } |
253 | 253 | |
254 | 254 | global $frm_vars; |
255 | - if ( isset($frm_vars['current_form']) && $frm_vars['current_form'] ) { |
|
256 | - $frm_vars['current_form']->options = maybe_unserialize($frm_vars['current_form']->options); |
|
255 | + if ( isset( $frm_vars['current_form'] ) && $frm_vars['current_form'] ) { |
|
256 | + $frm_vars['current_form']->options = maybe_unserialize( $frm_vars['current_form']->options ); |
|
257 | 257 | } |
258 | 258 | |
259 | - if ( isset($frm_vars['current_form']) && $frm_vars['current_form'] && isset($frm_vars['current_form']->options['hidden_cols']) && ! empty($frm_vars['current_form']->options['hidden_cols']) ) { |
|
259 | + if ( isset( $frm_vars['current_form'] ) && $frm_vars['current_form'] && isset( $frm_vars['current_form']->options['hidden_cols'] ) && ! empty( $frm_vars['current_form']->options['hidden_cols'] ) ) { |
|
260 | 260 | $result = $frm_vars['current_form']->options['hidden_cols']; |
261 | 261 | } else { |
262 | 262 | $cols = $frm_vars['cols']; |
263 | - $cols = array_reverse($cols, true); |
|
263 | + $cols = array_reverse( $cols, true ); |
|
264 | 264 | |
265 | 265 | $result[] = $form_id . '_id'; |
266 | - $i--; |
|
266 | + $i --; |
|
267 | 267 | |
268 | 268 | $result[] = $form_id . '_item_key'; |
269 | - $i--; |
|
269 | + $i --; |
|
270 | 270 | |
271 | 271 | foreach ( $cols as $col_key => $col ) { |
272 | 272 | if ( $i > $max_columns ) { |
273 | 273 | $result[] = $col_key; |
274 | 274 | } |
275 | 275 | //remove some columns by default |
276 | - $i--; |
|
277 | - unset($col_key, $col); |
|
276 | + $i --; |
|
277 | + unset( $col_key, $col ); |
|
278 | 278 | } |
279 | 279 | } |
280 | 280 | |
@@ -311,14 +311,14 @@ discard block |
||
311 | 311 | if ( $pagenum > $total_pages && $total_pages > 0 ) { |
312 | 312 | $url = add_query_arg( 'paged', $total_pages ); |
313 | 313 | if ( headers_sent() ) { |
314 | - echo FrmAppHelper::js_redirect($url); |
|
314 | + echo FrmAppHelper::js_redirect( $url ); |
|
315 | 315 | } else { |
316 | 316 | wp_redirect( esc_url_raw( $url ) ); |
317 | 317 | } |
318 | 318 | die(); |
319 | 319 | } |
320 | 320 | |
321 | - if ( empty($message) && isset($_GET['import-message']) ) { |
|
321 | + if ( empty( $message ) && isset( $_GET['import-message'] ) ) { |
|
322 | 322 | $message = __( 'Your import is complete', 'formidable' ); |
323 | 323 | } |
324 | 324 | |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | |
328 | 328 | /* Back End CRUD */ |
329 | 329 | public static function show( $id = 0 ) { |
330 | - FrmAppHelper::permission_check('frm_view_entries'); |
|
330 | + FrmAppHelper::permission_check( 'frm_view_entries' ); |
|
331 | 331 | |
332 | 332 | if ( ! $id ) { |
333 | 333 | $id = FrmAppHelper::get_param( 'id', 0, 'get', 'absint' ); |
@@ -337,9 +337,9 @@ discard block |
||
337 | 337 | } |
338 | 338 | } |
339 | 339 | |
340 | - $entry = FrmEntry::getOne($id, true); |
|
340 | + $entry = FrmEntry::getOne( $id, true ); |
|
341 | 341 | |
342 | - $data = maybe_unserialize($entry->description); |
|
342 | + $data = maybe_unserialize( $entry->description ); |
|
343 | 343 | if ( ! is_array( $data ) || ! isset( $data['referrer'] ) ) { |
344 | 344 | $data = array( 'referrer' => $data ); |
345 | 345 | } |
@@ -351,11 +351,11 @@ discard block |
||
351 | 351 | } |
352 | 352 | |
353 | 353 | public static function destroy() { |
354 | - FrmAppHelper::permission_check('frm_delete_entries'); |
|
354 | + FrmAppHelper::permission_check( 'frm_delete_entries' ); |
|
355 | 355 | |
356 | 356 | $params = FrmForm::get_admin_params(); |
357 | 357 | |
358 | - if ( isset($params['keep_post']) && $params['keep_post'] ) { |
|
358 | + if ( isset( $params['keep_post'] ) && $params['keep_post'] ) { |
|
359 | 359 | //unlink entry from post |
360 | 360 | global $wpdb; |
361 | 361 | $wpdb->update( $wpdb->prefix . 'frm_items', array( 'post_id' => '' ), array( 'id' => $params['id'] ) ); |
@@ -433,9 +433,9 @@ discard block |
||
433 | 433 | if ( ! isset( $frm_vars['form_params'] ) ) { |
434 | 434 | $frm_vars['form_params'] = array(); |
435 | 435 | } |
436 | - $frm_vars['form_params'][ $form->id ] = $params; |
|
436 | + $frm_vars['form_params'][$form->id] = $params; |
|
437 | 437 | |
438 | - if ( isset( $frm_vars['created_entries'][ $form_id ] ) ) { |
|
438 | + if ( isset( $frm_vars['created_entries'][$form_id] ) ) { |
|
439 | 439 | return; |
440 | 440 | } |
441 | 441 | |
@@ -450,13 +450,13 @@ discard block |
||
450 | 450 | */ |
451 | 451 | $errors = apply_filters( 'frm_entries_before_create', $errors, $form ); |
452 | 452 | |
453 | - $frm_vars['created_entries'][ $form_id ] = array( 'errors' => $errors ); |
|
453 | + $frm_vars['created_entries'][$form_id] = array( 'errors' => $errors ); |
|
454 | 454 | |
455 | 455 | if ( empty( $errors ) ) { |
456 | 456 | $_POST['frm_skip_cookie'] = 1; |
457 | 457 | if ( $params['action'] == 'create' ) { |
458 | - if ( apply_filters( 'frm_continue_to_create', true, $form_id ) && ! isset( $frm_vars['created_entries'][ $form_id ]['entry_id'] ) ) { |
|
459 | - $frm_vars['created_entries'][ $form_id ]['entry_id'] = FrmEntry::create( $_POST ); |
|
458 | + if ( apply_filters( 'frm_continue_to_create', true, $form_id ) && ! isset( $frm_vars['created_entries'][$form_id]['entry_id'] ) ) { |
|
459 | + $frm_vars['created_entries'][$form_id]['entry_id'] = FrmEntry::create( $_POST ); |
|
460 | 460 | } |
461 | 461 | } |
462 | 462 | |
@@ -491,28 +491,28 @@ discard block |
||
491 | 491 | } |
492 | 492 | |
493 | 493 | public static function &filter_email_value( $value, $meta, $entry, $atts = array() ) { |
494 | - $field = FrmField::getOne($meta->field_id); |
|
494 | + $field = FrmField::getOne( $meta->field_id ); |
|
495 | 495 | if ( ! $field ) { |
496 | 496 | return $value; |
497 | 497 | } |
498 | 498 | |
499 | - $value = self::filter_display_value($value, $field, $atts); |
|
499 | + $value = self::filter_display_value( $value, $field, $atts ); |
|
500 | 500 | return $value; |
501 | 501 | } |
502 | 502 | |
503 | 503 | public static function &filter_shortcode_value( $value, $tag, $atts, $field ) { |
504 | - $plain_text = add_filter('frm_plain_text_email', true); |
|
504 | + $plain_text = add_filter( 'frm_plain_text_email', true ); |
|
505 | 505 | FrmEntryFormat::textarea_display_value( $field->type, $plain_text, $value ); |
506 | 506 | |
507 | - if ( isset($atts['show']) && $atts['show'] == 'value' ) { |
|
507 | + if ( isset( $atts['show'] ) && $atts['show'] == 'value' ) { |
|
508 | 508 | return $value; |
509 | 509 | } |
510 | 510 | |
511 | - return self::filter_display_value($value, $field, $atts); |
|
511 | + return self::filter_display_value( $value, $field, $atts ); |
|
512 | 512 | } |
513 | 513 | |
514 | 514 | public static function &filter_display_value( $value, $field, $atts = array() ) { |
515 | - $saved_value = ( isset($atts['saved_value']) && $atts['saved_value'] ) ? true : false; |
|
515 | + $saved_value = ( isset( $atts['saved_value'] ) && $atts['saved_value'] ) ? true : false; |
|
516 | 516 | if ( ! in_array( $field->type, array( 'radio', 'checkbox', 'radio', 'select' ) ) || ! FrmField::is_option_true( $field, 'separate_value' ) || $saved_value ) { |
517 | 517 | return $value; |
518 | 518 | } |
@@ -520,29 +520,29 @@ discard block |
||
520 | 520 | $f_values = $f_labels = array(); |
521 | 521 | |
522 | 522 | foreach ( $field->options as $opt_key => $opt ) { |
523 | - if ( ! is_array($opt) ) { |
|
523 | + if ( ! is_array( $opt ) ) { |
|
524 | 524 | continue; |
525 | 525 | } |
526 | 526 | |
527 | - $f_labels[ $opt_key ] = isset( $opt['label'] ) ? $opt['label'] : reset($opt); |
|
528 | - $f_values[ $opt_key ] = isset( $opt['value'] ) ? $opt['value'] : $f_labels[ $opt_key ]; |
|
529 | - if ( $f_labels[ $opt_key ] == $f_values[ $opt_key ] ) { |
|
530 | - unset( $f_values[ $opt_key ], $f_labels[ $opt_key ] ); |
|
527 | + $f_labels[$opt_key] = isset( $opt['label'] ) ? $opt['label'] : reset( $opt ); |
|
528 | + $f_values[$opt_key] = isset( $opt['value'] ) ? $opt['value'] : $f_labels[$opt_key]; |
|
529 | + if ( $f_labels[$opt_key] == $f_values[$opt_key] ) { |
|
530 | + unset( $f_values[$opt_key], $f_labels[$opt_key] ); |
|
531 | 531 | } |
532 | - unset($opt_key, $opt); |
|
532 | + unset( $opt_key, $opt ); |
|
533 | 533 | } |
534 | 534 | |
535 | - if ( ! empty($f_values) ) { |
|
535 | + if ( ! empty( $f_values ) ) { |
|
536 | 536 | foreach ( (array) $value as $v_key => $val ) { |
537 | - if ( in_array($val, $f_values) ) { |
|
538 | - $opt = array_search($val, $f_values); |
|
539 | - if ( is_array($value) ) { |
|
540 | - $value[ $v_key ] = $f_labels[ $opt ]; |
|
537 | + if ( in_array( $val, $f_values ) ) { |
|
538 | + $opt = array_search( $val, $f_values ); |
|
539 | + if ( is_array( $value ) ) { |
|
540 | + $value[$v_key] = $f_labels[$opt]; |
|
541 | 541 | } else { |
542 | - $value = $f_labels[ $opt ]; |
|
542 | + $value = $f_labels[$opt]; |
|
543 | 543 | } |
544 | 544 | } |
545 | - unset($v_key, $val); |
|
545 | + unset( $v_key, $val ); |
|
546 | 546 | } |
547 | 547 | } |
548 | 548 | |
@@ -555,9 +555,9 @@ discard block |
||
555 | 555 | } |
556 | 556 | |
557 | 557 | public static function entry_sidebar( $entry ) { |
558 | - $data = maybe_unserialize($entry->description); |
|
559 | - $date_format = get_option('date_format'); |
|
560 | - $time_format = get_option('time_format'); |
|
558 | + $data = maybe_unserialize( $entry->description ); |
|
559 | + $date_format = get_option( 'date_format' ); |
|
560 | + $time_format = get_option( 'time_format' ); |
|
561 | 561 | if ( isset( $data['browser'] ) ) { |
562 | 562 | $browser = FrmEntryFormat::get_browser( $data['browser'] ); |
563 | 563 | } |
@@ -2,201 +2,201 @@ discard block |
||
2 | 2 | |
3 | 3 | class FrmEntriesController { |
4 | 4 | |
5 | - public static function menu() { |
|
5 | + public static function menu() { |
|
6 | 6 | FrmAppHelper::force_capability( 'frm_view_entries' ); |
7 | 7 | |
8 | - add_submenu_page('formidable', 'Formidable | ' . __( 'Entries', 'formidable' ), __( 'Entries', 'formidable' ), 'frm_view_entries', 'formidable-entries', 'FrmEntriesController::route' ); |
|
8 | + add_submenu_page('formidable', 'Formidable | ' . __( 'Entries', 'formidable' ), __( 'Entries', 'formidable' ), 'frm_view_entries', 'formidable-entries', 'FrmEntriesController::route' ); |
|
9 | 9 | |
10 | 10 | if ( ! in_array( FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' ), array( 'edit', 'show' ) ) ) { |
11 | 11 | $menu_name = FrmAppHelper::get_menu_name(); |
12 | 12 | add_filter( 'manage_' . sanitize_title( $menu_name ) . '_page_formidable-entries_columns', 'FrmEntriesController::manage_columns' ); |
13 | 13 | add_filter( 'get_user_option_manage' . sanitize_title( $menu_name ) . '_page_formidable-entriescolumnshidden', 'FrmEntriesController::hidden_columns' ); |
14 | 14 | add_filter( 'manage_' . sanitize_title( $menu_name ) . '_page_formidable-entries_sortable_columns', 'FrmEntriesController::sortable_columns' ); |
15 | - } |
|
16 | - } |
|
15 | + } |
|
16 | + } |
|
17 | 17 | |
18 | - /* Display in Back End */ |
|
19 | - public static function route() { |
|
18 | + /* Display in Back End */ |
|
19 | + public static function route() { |
|
20 | 20 | $action = FrmAppHelper::get_param( 'frm_action', '', 'get', 'sanitize_title' ); |
21 | 21 | |
22 | - switch ( $action ) { |
|
23 | - case 'show': |
|
24 | - case 'destroy': |
|
25 | - case 'destroy_all': |
|
26 | - return self::$action(); |
|
22 | + switch ( $action ) { |
|
23 | + case 'show': |
|
24 | + case 'destroy': |
|
25 | + case 'destroy_all': |
|
26 | + return self::$action(); |
|
27 | 27 | |
28 | - default: |
|
29 | - do_action( 'frm_entry_action_route', $action ); |
|
30 | - if ( apply_filters( 'frm_entry_stop_action_route', false, $action ) ) { |
|
31 | - return; |
|
32 | - } |
|
28 | + default: |
|
29 | + do_action( 'frm_entry_action_route', $action ); |
|
30 | + if ( apply_filters( 'frm_entry_stop_action_route', false, $action ) ) { |
|
31 | + return; |
|
32 | + } |
|
33 | 33 | |
34 | - return self::display_list(); |
|
35 | - } |
|
36 | - } |
|
34 | + return self::display_list(); |
|
35 | + } |
|
36 | + } |
|
37 | 37 | |
38 | 38 | public static function contextual_help( $help, $screen_id, $screen ) { |
39 | - // Only add to certain screens. add_help_tab was introduced in WordPress 3.3 |
|
40 | - if ( ! method_exists( $screen, 'add_help_tab' ) ) { |
|
41 | - return $help; |
|
42 | - } |
|
39 | + // Only add to certain screens. add_help_tab was introduced in WordPress 3.3 |
|
40 | + if ( ! method_exists( $screen, 'add_help_tab' ) ) { |
|
41 | + return $help; |
|
42 | + } |
|
43 | 43 | |
44 | 44 | $action = FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' ); |
45 | 45 | $page = FrmAppHelper::simple_get( 'page', 'sanitize_title' ); |
46 | 46 | if ( $page != 'formidable-entries' || ( ! empty( $action ) && $action != 'list' ) ) { |
47 | - return $help; |
|
48 | - } |
|
47 | + return $help; |
|
48 | + } |
|
49 | 49 | |
50 | 50 | unset( $action, $page ); |
51 | 51 | |
52 | - $screen->add_help_tab( array( |
|
53 | - 'id' => 'formidable-entries-tab', |
|
54 | - 'title' => __( 'Overview', 'formidable' ), |
|
52 | + $screen->add_help_tab( array( |
|
53 | + 'id' => 'formidable-entries-tab', |
|
54 | + 'title' => __( 'Overview', 'formidable' ), |
|
55 | 55 | 'content' => '<p>' . esc_html__( 'This screen provides access to all of your entries. You can customize the display of this screen to suit your workflow.', 'formidable' ) . '</p> <p>' . esc_html__( 'Hovering over a row in the entries list will display action links that allow you to manage your entry.', 'formidable' ) . '</p>', |
56 | - )); |
|
56 | + )); |
|
57 | 57 | |
58 | - $screen->set_help_sidebar( |
|
58 | + $screen->set_help_sidebar( |
|
59 | 59 | '<p><strong>' . esc_html__( 'For more information:', 'formidable' ) . '</strong></p>' . |
60 | 60 | '<p><a href="' . esc_url( FrmAppHelper::make_affiliate_url( 'http://formidablepro.com/knowledgebase/manage-entries-from-the-back-end/' ) ) . '" target="_blank">' . esc_html__( 'Documentation on Entries', 'formidable' ) . '</a></p>' . |
61 | 61 | '<p><a href="' . esc_url( FrmAppHelper::make_affiliate_url( 'http://formidablepro.com/help-desk/' ) ) . '" target="_blank">' . esc_html__( 'Support', 'formidable' ) . '</a></p>' |
62 | - ); |
|
62 | + ); |
|
63 | 63 | |
64 | - return $help; |
|
65 | - } |
|
64 | + return $help; |
|
65 | + } |
|
66 | 66 | |
67 | 67 | public static function manage_columns( $columns ) { |
68 | - global $frm_vars, $wpdb; |
|
68 | + global $frm_vars, $wpdb; |
|
69 | 69 | $form_id = FrmForm::get_current_form_id(); |
70 | 70 | |
71 | 71 | $columns[ $form_id . '_id' ] = 'ID'; |
72 | 72 | $columns[ $form_id . '_item_key' ] = esc_html__( 'Entry Key', 'formidable' ); |
73 | 73 | |
74 | - if ( ! $form_id ) { |
|
75 | - return $columns; |
|
76 | - } |
|
74 | + if ( ! $form_id ) { |
|
75 | + return $columns; |
|
76 | + } |
|
77 | 77 | |
78 | - $form_cols = FrmField::get_all_for_form($form_id, '', 'include'); |
|
78 | + $form_cols = FrmField::get_all_for_form($form_id, '', 'include'); |
|
79 | 79 | |
80 | - foreach ( $form_cols as $form_col ) { |
|
80 | + foreach ( $form_cols as $form_col ) { |
|
81 | 81 | if ( FrmField::is_no_save_field( $form_col->type ) ) { |
82 | - continue; |
|
83 | - } |
|
82 | + continue; |
|
83 | + } |
|
84 | 84 | |
85 | - if ( $form_col->type == 'form' && isset( $form_col->field_options['form_select'] ) && ! empty( $form_col->field_options['form_select'] ) ) { |
|
85 | + if ( $form_col->type == 'form' && isset( $form_col->field_options['form_select'] ) && ! empty( $form_col->field_options['form_select'] ) ) { |
|
86 | 86 | $sub_form_cols = FrmField::get_all_for_form( $form_col->field_options['form_select'] ); |
87 | 87 | |
88 | - if ( $sub_form_cols ) { |
|
89 | - foreach ( $sub_form_cols as $k => $sub_form_col ) { |
|
88 | + if ( $sub_form_cols ) { |
|
89 | + foreach ( $sub_form_cols as $k => $sub_form_col ) { |
|
90 | 90 | if ( FrmField::is_no_save_field( $sub_form_col->type ) ) { |
91 | - unset( $sub_form_cols[ $k ] ); |
|
92 | - continue; |
|
93 | - } |
|
91 | + unset( $sub_form_cols[ $k ] ); |
|
92 | + continue; |
|
93 | + } |
|
94 | 94 | $columns[ $form_id . '_' . $sub_form_col->field_key . '-_-' . $form_col->id ] = FrmAppHelper::truncate( $sub_form_col->name, 35 ); |
95 | - unset($sub_form_col); |
|
96 | - } |
|
97 | - } |
|
98 | - unset($sub_form_cols); |
|
99 | - } else { |
|
100 | - $col_id = $form_col->field_key; |
|
101 | - if ( $form_col->form_id != $form_id ) { |
|
95 | + unset($sub_form_col); |
|
96 | + } |
|
97 | + } |
|
98 | + unset($sub_form_cols); |
|
99 | + } else { |
|
100 | + $col_id = $form_col->field_key; |
|
101 | + if ( $form_col->form_id != $form_id ) { |
|
102 | 102 | $col_id .= '-_-form' . $form_col->form_id; |
103 | - } |
|
103 | + } |
|
104 | 104 | |
105 | - if ( isset($form_col->field_options['separate_value']) && $form_col->field_options['separate_value'] ) { |
|
105 | + if ( isset($form_col->field_options['separate_value']) && $form_col->field_options['separate_value'] ) { |
|
106 | 106 | $columns[ $form_id . '_frmsep_' . $col_id ] = FrmAppHelper::truncate( $form_col->name, 35 ); |
107 | - } |
|
107 | + } |
|
108 | 108 | $columns[ $form_id . '_' . $col_id ] = FrmAppHelper::truncate( $form_col->name, 35 ); |
109 | - } |
|
110 | - } |
|
109 | + } |
|
110 | + } |
|
111 | 111 | |
112 | 112 | $columns[ $form_id . '_created_at' ] = __( 'Entry creation date', 'formidable' ); |
113 | 113 | $columns[ $form_id . '_updated_at' ] = __( 'Entry update date', 'formidable' ); |
114 | 114 | $columns[ $form_id . '_ip' ] = 'IP'; |
115 | 115 | |
116 | - $frm_vars['cols'] = $columns; |
|
116 | + $frm_vars['cols'] = $columns; |
|
117 | 117 | |
118 | 118 | $action = FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' ); |
119 | 119 | if ( FrmAppHelper::is_admin_page( 'formidable-entries' ) && in_array( $action, array( '', 'list', 'destroy' ) ) ) { |
120 | 120 | add_screen_option( 'per_page', array( 'label' => __( 'Entries', 'formidable' ), 'default' => 20, 'option' => 'formidable_page_formidable_entries_per_page' ) ); |
121 | - } |
|
121 | + } |
|
122 | 122 | |
123 | - return $columns; |
|
124 | - } |
|
123 | + return $columns; |
|
124 | + } |
|
125 | 125 | |
126 | 126 | public static function check_hidden_cols( $check, $object_id, $meta_key, $meta_value, $prev_value ) { |
127 | 127 | $menu_name = FrmAppHelper::get_menu_name(); |
128 | 128 | $this_page_name = 'manage' . sanitize_title( $menu_name ) . '_page_formidable-entriescolumnshidden'; |
129 | 129 | if ( $meta_key != $this_page_name || $meta_value == $prev_value ) { |
130 | - return $check; |
|
131 | - } |
|
130 | + return $check; |
|
131 | + } |
|
132 | 132 | |
133 | 133 | if ( empty( $prev_value ) ) { |
134 | 134 | $prev_value = get_metadata( 'user', $object_id, $meta_key, true ); |
135 | 135 | } |
136 | 136 | |
137 | - global $frm_vars; |
|
138 | - //add a check so we don't create a loop |
|
139 | - $frm_vars['prev_hidden_cols'] = ( isset($frm_vars['prev_hidden_cols']) && $frm_vars['prev_hidden_cols'] ) ? false : $prev_value; |
|
137 | + global $frm_vars; |
|
138 | + //add a check so we don't create a loop |
|
139 | + $frm_vars['prev_hidden_cols'] = ( isset($frm_vars['prev_hidden_cols']) && $frm_vars['prev_hidden_cols'] ) ? false : $prev_value; |
|
140 | 140 | |
141 | - return $check; |
|
142 | - } |
|
141 | + return $check; |
|
142 | + } |
|
143 | 143 | |
144 | - //add hidden columns back from other forms |
|
144 | + //add hidden columns back from other forms |
|
145 | 145 | public static function update_hidden_cols( $meta_id, $object_id, $meta_key, $meta_value ) { |
146 | 146 | $menu_name = FrmAppHelper::get_menu_name(); |
147 | 147 | $sanitized = sanitize_title( $menu_name ); |
148 | 148 | $this_page_name = 'manage' . $sanitized . '_page_formidable-entriescolumnshidden'; |
149 | 149 | if ( $meta_key != $this_page_name ) { |
150 | - return; |
|
151 | - } |
|
152 | - |
|
153 | - global $frm_vars; |
|
154 | - if ( ! isset($frm_vars['prev_hidden_cols']) || ! $frm_vars['prev_hidden_cols'] ) { |
|
155 | - return; //don't continue if there's no previous value |
|
156 | - } |
|
157 | - |
|
158 | - foreach ( $meta_value as $mk => $mv ) { |
|
159 | - //remove blank values |
|
160 | - if ( empty( $mv ) ) { |
|
161 | - unset( $meta_value[ $mk ] ); |
|
162 | - } |
|
163 | - } |
|
164 | - |
|
165 | - $cur_form_prefix = reset($meta_value); |
|
166 | - $cur_form_prefix = explode('_', $cur_form_prefix); |
|
167 | - $cur_form_prefix = $cur_form_prefix[0]; |
|
168 | - $save = false; |
|
169 | - |
|
170 | - foreach ( (array) $frm_vars['prev_hidden_cols'] as $prev_hidden ) { |
|
150 | + return; |
|
151 | + } |
|
152 | + |
|
153 | + global $frm_vars; |
|
154 | + if ( ! isset($frm_vars['prev_hidden_cols']) || ! $frm_vars['prev_hidden_cols'] ) { |
|
155 | + return; //don't continue if there's no previous value |
|
156 | + } |
|
157 | + |
|
158 | + foreach ( $meta_value as $mk => $mv ) { |
|
159 | + //remove blank values |
|
160 | + if ( empty( $mv ) ) { |
|
161 | + unset( $meta_value[ $mk ] ); |
|
162 | + } |
|
163 | + } |
|
164 | + |
|
165 | + $cur_form_prefix = reset($meta_value); |
|
166 | + $cur_form_prefix = explode('_', $cur_form_prefix); |
|
167 | + $cur_form_prefix = $cur_form_prefix[0]; |
|
168 | + $save = false; |
|
169 | + |
|
170 | + foreach ( (array) $frm_vars['prev_hidden_cols'] as $prev_hidden ) { |
|
171 | 171 | if ( empty( $prev_hidden ) || in_array( $prev_hidden, $meta_value ) ) { |
172 | - //don't add blank cols or process included cols |
|
173 | - continue; |
|
174 | - } |
|
172 | + //don't add blank cols or process included cols |
|
173 | + continue; |
|
174 | + } |
|
175 | 175 | |
176 | 176 | $form_prefix = explode( '_', $prev_hidden ); |
177 | - $form_prefix = $form_prefix[0]; |
|
178 | - if ( $form_prefix == $cur_form_prefix ) { |
|
179 | - //don't add back columns that are meant to be hidden |
|
180 | - continue; |
|
181 | - } |
|
177 | + $form_prefix = $form_prefix[0]; |
|
178 | + if ( $form_prefix == $cur_form_prefix ) { |
|
179 | + //don't add back columns that are meant to be hidden |
|
180 | + continue; |
|
181 | + } |
|
182 | 182 | |
183 | - $meta_value[] = $prev_hidden; |
|
184 | - $save = true; |
|
185 | - unset($form_prefix); |
|
186 | - } |
|
183 | + $meta_value[] = $prev_hidden; |
|
184 | + $save = true; |
|
185 | + unset($form_prefix); |
|
186 | + } |
|
187 | 187 | |
188 | 188 | if ( $save ) { |
189 | - $user = wp_get_current_user(); |
|
189 | + $user = wp_get_current_user(); |
|
190 | 190 | update_user_option( $user->ID, $this_page_name, $meta_value, true ); |
191 | - } |
|
192 | - } |
|
191 | + } |
|
192 | + } |
|
193 | 193 | |
194 | 194 | public static function save_per_page( $save, $option, $value ) { |
195 | - if ( $option == 'formidable_page_formidable_entries_per_page' ) { |
|
196 | - $save = (int) $value; |
|
197 | - } |
|
198 | - return $save; |
|
199 | - } |
|
195 | + if ( $option == 'formidable_page_formidable_entries_per_page' ) { |
|
196 | + $save = (int) $value; |
|
197 | + } |
|
198 | + return $save; |
|
199 | + } |
|
200 | 200 | |
201 | 201 | public static function sortable_columns() { |
202 | 202 | $form_id = FrmForm::get_current_form_id(); |
@@ -222,122 +222,122 @@ discard block |
||
222 | 222 | } |
223 | 223 | |
224 | 224 | public static function hidden_columns( $result ) { |
225 | - global $frm_vars; |
|
225 | + global $frm_vars; |
|
226 | 226 | |
227 | 227 | $form_id = FrmForm::get_current_form_id(); |
228 | 228 | |
229 | - $return = false; |
|
230 | - foreach ( (array) $result as $r ) { |
|
231 | - if ( ! empty( $r ) ) { |
|
232 | - $form_prefix = explode( '_', $r ); |
|
233 | - $form_prefix = $form_prefix[0]; |
|
229 | + $return = false; |
|
230 | + foreach ( (array) $result as $r ) { |
|
231 | + if ( ! empty( $r ) ) { |
|
232 | + $form_prefix = explode( '_', $r ); |
|
233 | + $form_prefix = $form_prefix[0]; |
|
234 | 234 | |
235 | - if ( (int) $form_prefix == (int) $form_id ) { |
|
236 | - $return = true; |
|
237 | - break; |
|
238 | - } |
|
235 | + if ( (int) $form_prefix == (int) $form_id ) { |
|
236 | + $return = true; |
|
237 | + break; |
|
238 | + } |
|
239 | 239 | |
240 | - unset($form_prefix); |
|
241 | - } |
|
242 | - } |
|
240 | + unset($form_prefix); |
|
241 | + } |
|
242 | + } |
|
243 | 243 | |
244 | - if ( $return ) { |
|
244 | + if ( $return ) { |
|
245 | 245 | return $result; |
246 | 246 | } |
247 | 247 | |
248 | - $i = isset($frm_vars['cols']) ? count($frm_vars['cols']) : 0; |
|
249 | - $max_columns = 8; |
|
250 | - if ( $i <= $max_columns ) { |
|
248 | + $i = isset($frm_vars['cols']) ? count($frm_vars['cols']) : 0; |
|
249 | + $max_columns = 8; |
|
250 | + if ( $i <= $max_columns ) { |
|
251 | 251 | return $result; |
252 | 252 | } |
253 | 253 | |
254 | - global $frm_vars; |
|
255 | - if ( isset($frm_vars['current_form']) && $frm_vars['current_form'] ) { |
|
256 | - $frm_vars['current_form']->options = maybe_unserialize($frm_vars['current_form']->options); |
|
257 | - } |
|
254 | + global $frm_vars; |
|
255 | + if ( isset($frm_vars['current_form']) && $frm_vars['current_form'] ) { |
|
256 | + $frm_vars['current_form']->options = maybe_unserialize($frm_vars['current_form']->options); |
|
257 | + } |
|
258 | 258 | |
259 | - if ( isset($frm_vars['current_form']) && $frm_vars['current_form'] && isset($frm_vars['current_form']->options['hidden_cols']) && ! empty($frm_vars['current_form']->options['hidden_cols']) ) { |
|
260 | - $result = $frm_vars['current_form']->options['hidden_cols']; |
|
261 | - } else { |
|
262 | - $cols = $frm_vars['cols']; |
|
263 | - $cols = array_reverse($cols, true); |
|
259 | + if ( isset($frm_vars['current_form']) && $frm_vars['current_form'] && isset($frm_vars['current_form']->options['hidden_cols']) && ! empty($frm_vars['current_form']->options['hidden_cols']) ) { |
|
260 | + $result = $frm_vars['current_form']->options['hidden_cols']; |
|
261 | + } else { |
|
262 | + $cols = $frm_vars['cols']; |
|
263 | + $cols = array_reverse($cols, true); |
|
264 | 264 | |
265 | 265 | $result[] = $form_id . '_id'; |
266 | - $i--; |
|
266 | + $i--; |
|
267 | 267 | |
268 | 268 | $result[] = $form_id . '_item_key'; |
269 | - $i--; |
|
269 | + $i--; |
|
270 | 270 | |
271 | 271 | foreach ( $cols as $col_key => $col ) { |
272 | - if ( $i > $max_columns ) { |
|
272 | + if ( $i > $max_columns ) { |
|
273 | 273 | $result[] = $col_key; |
274 | 274 | } |
275 | - //remove some columns by default |
|
276 | - $i--; |
|
277 | - unset($col_key, $col); |
|
278 | - } |
|
279 | - } |
|
275 | + //remove some columns by default |
|
276 | + $i--; |
|
277 | + unset($col_key, $col); |
|
278 | + } |
|
279 | + } |
|
280 | 280 | |
281 | - return $result; |
|
282 | - } |
|
281 | + return $result; |
|
282 | + } |
|
283 | 283 | |
284 | 284 | public static function display_list( $message = '', $errors = array() ) { |
285 | - global $wpdb, $frm_vars; |
|
285 | + global $wpdb, $frm_vars; |
|
286 | 286 | |
287 | 287 | $form = FrmForm::get_current_form(); |
288 | 288 | $params = FrmForm::get_admin_params( $form ); |
289 | 289 | |
290 | - if ( $form ) { |
|
291 | - $params['form'] = $form->id; |
|
292 | - $frm_vars['current_form'] = $form; |
|
290 | + if ( $form ) { |
|
291 | + $params['form'] = $form->id; |
|
292 | + $frm_vars['current_form'] = $form; |
|
293 | 293 | |
294 | - if ( 'trash' == $form->status ) { |
|
295 | - $delete_timestamp = time() - ( DAY_IN_SECONDS * EMPTY_TRASH_DAYS ); |
|
296 | - $time_to_delete = FrmAppHelper::human_time_diff( $delete_timestamp, ( isset( $form->options['trash_time'] ) ? ( $form->options['trash_time'] ) : time() ) ); |
|
297 | - $errors['trash'] = sprintf( __( 'This form is in the trash and is scheduled to be deleted permanently in %s along with any entries.', 'formidable' ), $time_to_delete ); |
|
298 | - unset( $time_to_delete, $delete_timestamp ); |
|
299 | - } |
|
294 | + if ( 'trash' == $form->status ) { |
|
295 | + $delete_timestamp = time() - ( DAY_IN_SECONDS * EMPTY_TRASH_DAYS ); |
|
296 | + $time_to_delete = FrmAppHelper::human_time_diff( $delete_timestamp, ( isset( $form->options['trash_time'] ) ? ( $form->options['trash_time'] ) : time() ) ); |
|
297 | + $errors['trash'] = sprintf( __( 'This form is in the trash and is scheduled to be deleted permanently in %s along with any entries.', 'formidable' ), $time_to_delete ); |
|
298 | + unset( $time_to_delete, $delete_timestamp ); |
|
299 | + } |
|
300 | 300 | } |
301 | 301 | |
302 | - $table_class = apply_filters( 'frm_entries_list_class', 'FrmEntriesListHelper' ); |
|
302 | + $table_class = apply_filters( 'frm_entries_list_class', 'FrmEntriesListHelper' ); |
|
303 | 303 | |
304 | - $wp_list_table = new $table_class( array( 'params' => $params ) ); |
|
304 | + $wp_list_table = new $table_class( array( 'params' => $params ) ); |
|
305 | 305 | |
306 | - $pagenum = $wp_list_table->get_pagenum(); |
|
306 | + $pagenum = $wp_list_table->get_pagenum(); |
|
307 | 307 | |
308 | - $wp_list_table->prepare_items(); |
|
308 | + $wp_list_table->prepare_items(); |
|
309 | 309 | |
310 | - $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' ); |
|
311 | - if ( $pagenum > $total_pages && $total_pages > 0 ) { |
|
310 | + $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' ); |
|
311 | + if ( $pagenum > $total_pages && $total_pages > 0 ) { |
|
312 | 312 | $url = add_query_arg( 'paged', $total_pages ); |
313 | - if ( headers_sent() ) { |
|
314 | - echo FrmAppHelper::js_redirect($url); |
|
315 | - } else { |
|
316 | - wp_redirect( esc_url_raw( $url ) ); |
|
317 | - } |
|
318 | - die(); |
|
319 | - } |
|
320 | - |
|
321 | - if ( empty($message) && isset($_GET['import-message']) ) { |
|
322 | - $message = __( 'Your import is complete', 'formidable' ); |
|
323 | - } |
|
313 | + if ( headers_sent() ) { |
|
314 | + echo FrmAppHelper::js_redirect($url); |
|
315 | + } else { |
|
316 | + wp_redirect( esc_url_raw( $url ) ); |
|
317 | + } |
|
318 | + die(); |
|
319 | + } |
|
320 | + |
|
321 | + if ( empty($message) && isset($_GET['import-message']) ) { |
|
322 | + $message = __( 'Your import is complete', 'formidable' ); |
|
323 | + } |
|
324 | 324 | |
325 | 325 | require( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/list.php' ); |
326 | - } |
|
326 | + } |
|
327 | 327 | |
328 | - /* Back End CRUD */ |
|
328 | + /* Back End CRUD */ |
|
329 | 329 | public static function show( $id = 0 ) { |
330 | - FrmAppHelper::permission_check('frm_view_entries'); |
|
330 | + FrmAppHelper::permission_check('frm_view_entries'); |
|
331 | 331 | |
332 | - if ( ! $id ) { |
|
332 | + if ( ! $id ) { |
|
333 | 333 | $id = FrmAppHelper::get_param( 'id', 0, 'get', 'absint' ); |
334 | 334 | |
335 | - if ( ! $id ) { |
|
335 | + if ( ! $id ) { |
|
336 | 336 | $id = FrmAppHelper::get_param( 'item_id', 0, 'get', 'absint' ); |
337 | - } |
|
338 | - } |
|
337 | + } |
|
338 | + } |
|
339 | 339 | |
340 | - $entry = FrmEntry::getOne($id, true); |
|
340 | + $entry = FrmEntry::getOne($id, true); |
|
341 | 341 | if ( ! $entry ) { |
342 | 342 | echo '<div id="form_show_entry_page" class="wrap">' . |
343 | 343 | __( 'You are trying to view an entry that does not exist.', 'formidable' ) . |
@@ -345,110 +345,110 @@ discard block |
||
345 | 345 | return; |
346 | 346 | } |
347 | 347 | |
348 | - $data = maybe_unserialize($entry->description); |
|
348 | + $data = maybe_unserialize($entry->description); |
|
349 | 349 | if ( ! is_array( $data ) || ! isset( $data['referrer'] ) ) { |
350 | 350 | $data = array( 'referrer' => $data ); |
351 | 351 | } |
352 | 352 | |
353 | 353 | $fields = FrmField::get_all_for_form( $entry->form_id, '', 'include' ); |
354 | - $to_emails = array(); |
|
354 | + $to_emails = array(); |
|
355 | 355 | |
356 | 356 | include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/show.php' ); |
357 | - } |
|
357 | + } |
|
358 | 358 | |
359 | - public static function destroy() { |
|
360 | - FrmAppHelper::permission_check('frm_delete_entries'); |
|
359 | + public static function destroy() { |
|
360 | + FrmAppHelper::permission_check('frm_delete_entries'); |
|
361 | 361 | |
362 | 362 | $params = FrmForm::get_admin_params(); |
363 | 363 | |
364 | - if ( isset($params['keep_post']) && $params['keep_post'] ) { |
|
365 | - //unlink entry from post |
|
366 | - global $wpdb; |
|
364 | + if ( isset($params['keep_post']) && $params['keep_post'] ) { |
|
365 | + //unlink entry from post |
|
366 | + global $wpdb; |
|
367 | 367 | $wpdb->update( $wpdb->prefix . 'frm_items', array( 'post_id' => '' ), array( 'id' => $params['id'] ) ); |
368 | - } |
|
368 | + } |
|
369 | 369 | |
370 | - $message = ''; |
|
371 | - if ( FrmEntry::destroy( $params['id'] ) ) { |
|
372 | - $message = __( 'Entry was Successfully Destroyed', 'formidable' ); |
|
373 | - } |
|
370 | + $message = ''; |
|
371 | + if ( FrmEntry::destroy( $params['id'] ) ) { |
|
372 | + $message = __( 'Entry was Successfully Destroyed', 'formidable' ); |
|
373 | + } |
|
374 | 374 | |
375 | - self::display_list( $message ); |
|
376 | - } |
|
375 | + self::display_list( $message ); |
|
376 | + } |
|
377 | 377 | |
378 | - public static function destroy_all() { |
|
379 | - if ( ! current_user_can( 'frm_delete_entries' ) ) { |
|
380 | - $frm_settings = FrmAppHelper::get_settings(); |
|
381 | - wp_die( $frm_settings->admin_permission ); |
|
382 | - } |
|
378 | + public static function destroy_all() { |
|
379 | + if ( ! current_user_can( 'frm_delete_entries' ) ) { |
|
380 | + $frm_settings = FrmAppHelper::get_settings(); |
|
381 | + wp_die( $frm_settings->admin_permission ); |
|
382 | + } |
|
383 | 383 | |
384 | - global $wpdb; |
|
384 | + global $wpdb; |
|
385 | 385 | $params = FrmForm::get_admin_params(); |
386 | - $message = ''; |
|
387 | - $errors = array(); |
|
388 | - $form_id = (int) $params['form']; |
|
386 | + $message = ''; |
|
387 | + $errors = array(); |
|
388 | + $form_id = (int) $params['form']; |
|
389 | 389 | |
390 | - if ( $form_id ) { |
|
391 | - $entry_ids = FrmDb::get_col( 'frm_items', array( 'form_id' => $form_id ) ); |
|
390 | + if ( $form_id ) { |
|
391 | + $entry_ids = FrmDb::get_col( 'frm_items', array( 'form_id' => $form_id ) ); |
|
392 | 392 | $action = FrmFormAction::get_action_for_form( $form_id, 'wppost', 1 ); |
393 | 393 | |
394 | - if ( $action ) { |
|
395 | - // this action takes a while, so only trigger it if there are posts to delete |
|
396 | - foreach ( $entry_ids as $entry_id ) { |
|
397 | - do_action( 'frm_before_destroy_entry', $entry_id ); |
|
398 | - unset( $entry_id ); |
|
399 | - } |
|
400 | - } |
|
401 | - |
|
402 | - $wpdb->query( $wpdb->prepare( "DELETE em.* FROM {$wpdb->prefix}frm_item_metas as em INNER JOIN {$wpdb->prefix}frm_items as e on (em.item_id=e.id) and form_id=%d", $form_id ) ); |
|
403 | - $results = $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->prefix}frm_items WHERE form_id=%d", $form_id ) ); |
|
404 | - if ( $results ) { |
|
394 | + if ( $action ) { |
|
395 | + // this action takes a while, so only trigger it if there are posts to delete |
|
396 | + foreach ( $entry_ids as $entry_id ) { |
|
397 | + do_action( 'frm_before_destroy_entry', $entry_id ); |
|
398 | + unset( $entry_id ); |
|
399 | + } |
|
400 | + } |
|
401 | + |
|
402 | + $wpdb->query( $wpdb->prepare( "DELETE em.* FROM {$wpdb->prefix}frm_item_metas as em INNER JOIN {$wpdb->prefix}frm_items as e on (em.item_id=e.id) and form_id=%d", $form_id ) ); |
|
403 | + $results = $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->prefix}frm_items WHERE form_id=%d", $form_id ) ); |
|
404 | + if ( $results ) { |
|
405 | 405 | FrmEntry::clear_cache(); |
406 | - $message = __( 'Entries were Successfully Destroyed', 'formidable' ); |
|
407 | - } |
|
408 | - } else { |
|
409 | - $errors = __( 'No entries were specified', 'formidable' ); |
|
410 | - } |
|
411 | - |
|
412 | - self::display_list( $message, $errors ); |
|
413 | - } |
|
414 | - |
|
415 | - public static function show_form( $id = '', $key = '', $title = false, $description = false ) { |
|
416 | - _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::show_form()' ); |
|
417 | - return FrmFormsController::show_form( $id, $key, $title, $description ); |
|
418 | - } |
|
419 | - |
|
420 | - public static function get_form( $filename, $form, $title, $description ) { |
|
421 | - _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::get_form()' ); |
|
422 | - return FrmFormsController::get_form( $form, $title, $description ); |
|
423 | - } |
|
424 | - |
|
425 | - public static function process_entry( $errors = '', $ajax = false ) { |
|
406 | + $message = __( 'Entries were Successfully Destroyed', 'formidable' ); |
|
407 | + } |
|
408 | + } else { |
|
409 | + $errors = __( 'No entries were specified', 'formidable' ); |
|
410 | + } |
|
411 | + |
|
412 | + self::display_list( $message, $errors ); |
|
413 | + } |
|
414 | + |
|
415 | + public static function show_form( $id = '', $key = '', $title = false, $description = false ) { |
|
416 | + _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::show_form()' ); |
|
417 | + return FrmFormsController::show_form( $id, $key, $title, $description ); |
|
418 | + } |
|
419 | + |
|
420 | + public static function get_form( $filename, $form, $title, $description ) { |
|
421 | + _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::get_form()' ); |
|
422 | + return FrmFormsController::get_form( $form, $title, $description ); |
|
423 | + } |
|
424 | + |
|
425 | + public static function process_entry( $errors = '', $ajax = false ) { |
|
426 | 426 | $form_id = FrmAppHelper::get_post_param( 'form_id', '', 'absint' ); |
427 | 427 | if ( FrmAppHelper::is_admin() || empty( $_POST ) || empty( $form_id ) || ! isset( $_POST['item_key'] ) ) { |
428 | - return; |
|
429 | - } |
|
428 | + return; |
|
429 | + } |
|
430 | 430 | |
431 | - global $frm_vars; |
|
431 | + global $frm_vars; |
|
432 | 432 | |
433 | 433 | $form = FrmForm::getOne( $form_id ); |
434 | - if ( ! $form ) { |
|
435 | - return; |
|
436 | - } |
|
434 | + if ( ! $form ) { |
|
435 | + return; |
|
436 | + } |
|
437 | 437 | |
438 | 438 | $params = FrmForm::get_params( $form ); |
439 | 439 | |
440 | - if ( ! isset( $frm_vars['form_params'] ) ) { |
|
441 | - $frm_vars['form_params'] = array(); |
|
442 | - } |
|
440 | + if ( ! isset( $frm_vars['form_params'] ) ) { |
|
441 | + $frm_vars['form_params'] = array(); |
|
442 | + } |
|
443 | 443 | $frm_vars['form_params'][ $form->id ] = $params; |
444 | 444 | |
445 | 445 | if ( isset( $frm_vars['created_entries'][ $form_id ] ) ) { |
446 | - return; |
|
447 | - } |
|
446 | + return; |
|
447 | + } |
|
448 | 448 | |
449 | - if ( $errors == '' && ! $ajax ) { |
|
449 | + if ( $errors == '' && ! $ajax ) { |
|
450 | 450 | $errors = FrmEntryValidate::validate( $_POST ); |
451 | - } |
|
451 | + } |
|
452 | 452 | |
453 | 453 | /** |
454 | 454 | * Use this filter to add trigger actions and add errors after |
@@ -459,102 +459,102 @@ discard block |
||
459 | 459 | |
460 | 460 | $frm_vars['created_entries'][ $form_id ] = array( 'errors' => $errors ); |
461 | 461 | |
462 | - if ( empty( $errors ) ) { |
|
462 | + if ( empty( $errors ) ) { |
|
463 | 463 | $_POST['frm_skip_cookie'] = 1; |
464 | - if ( $params['action'] == 'create' ) { |
|
464 | + if ( $params['action'] == 'create' ) { |
|
465 | 465 | if ( apply_filters( 'frm_continue_to_create', true, $form_id ) && ! isset( $frm_vars['created_entries'][ $form_id ]['entry_id'] ) ) { |
466 | 466 | $frm_vars['created_entries'][ $form_id ]['entry_id'] = FrmEntry::create( $_POST ); |
467 | - } |
|
468 | - } |
|
467 | + } |
|
468 | + } |
|
469 | 469 | |
470 | - do_action( 'frm_process_entry', $params, $errors, $form, array( 'ajax' => $ajax ) ); |
|
470 | + do_action( 'frm_process_entry', $params, $errors, $form, array( 'ajax' => $ajax ) ); |
|
471 | 471 | unset( $_POST['frm_skip_cookie'] ); |
472 | - } |
|
473 | - } |
|
474 | - |
|
475 | - public static function delete_entry_before_redirect( $url, $form, $atts ) { |
|
476 | - self::_delete_entry( $atts['id'], $form ); |
|
477 | - return $url; |
|
478 | - } |
|
479 | - |
|
480 | - //Delete entry if not redirected |
|
481 | - public static function delete_entry_after_save( $atts ) { |
|
482 | - self::_delete_entry( $atts['entry_id'], $atts['form'] ); |
|
483 | - } |
|
484 | - |
|
485 | - private static function _delete_entry( $entry_id, $form ) { |
|
486 | - if ( ! $form ) { |
|
487 | - return; |
|
488 | - } |
|
489 | - |
|
490 | - $form->options = maybe_unserialize( $form->options ); |
|
491 | - if ( isset( $form->options['no_save'] ) && $form->options['no_save'] ) { |
|
492 | - FrmEntry::destroy( $entry_id ); |
|
493 | - } |
|
494 | - } |
|
472 | + } |
|
473 | + } |
|
474 | + |
|
475 | + public static function delete_entry_before_redirect( $url, $form, $atts ) { |
|
476 | + self::_delete_entry( $atts['id'], $form ); |
|
477 | + return $url; |
|
478 | + } |
|
479 | + |
|
480 | + //Delete entry if not redirected |
|
481 | + public static function delete_entry_after_save( $atts ) { |
|
482 | + self::_delete_entry( $atts['entry_id'], $atts['form'] ); |
|
483 | + } |
|
484 | + |
|
485 | + private static function _delete_entry( $entry_id, $form ) { |
|
486 | + if ( ! $form ) { |
|
487 | + return; |
|
488 | + } |
|
489 | + |
|
490 | + $form->options = maybe_unserialize( $form->options ); |
|
491 | + if ( isset( $form->options['no_save'] ) && $form->options['no_save'] ) { |
|
492 | + FrmEntry::destroy( $entry_id ); |
|
493 | + } |
|
494 | + } |
|
495 | 495 | |
496 | 496 | public static function show_entry_shortcode( $atts ) { |
497 | 497 | return FrmEntryFormat::show_entry( $atts ); |
498 | 498 | } |
499 | 499 | |
500 | - public static function &filter_email_value( $value, $meta, $entry, $atts = array() ) { |
|
501 | - $field = FrmField::getOne($meta->field_id); |
|
502 | - if ( ! $field ) { |
|
503 | - return $value; |
|
504 | - } |
|
500 | + public static function &filter_email_value( $value, $meta, $entry, $atts = array() ) { |
|
501 | + $field = FrmField::getOne($meta->field_id); |
|
502 | + if ( ! $field ) { |
|
503 | + return $value; |
|
504 | + } |
|
505 | 505 | |
506 | - $value = self::filter_display_value($value, $field, $atts); |
|
507 | - return $value; |
|
508 | - } |
|
506 | + $value = self::filter_display_value($value, $field, $atts); |
|
507 | + return $value; |
|
508 | + } |
|
509 | 509 | |
510 | 510 | public static function &filter_shortcode_value( $value, $tag, $atts, $field ) { |
511 | - $plain_text = add_filter('frm_plain_text_email', true); |
|
511 | + $plain_text = add_filter('frm_plain_text_email', true); |
|
512 | 512 | FrmEntryFormat::textarea_display_value( $field->type, $plain_text, $value ); |
513 | 513 | |
514 | - if ( isset($atts['show']) && $atts['show'] == 'value' ) { |
|
515 | - return $value; |
|
516 | - } |
|
514 | + if ( isset($atts['show']) && $atts['show'] == 'value' ) { |
|
515 | + return $value; |
|
516 | + } |
|
517 | 517 | |
518 | - return self::filter_display_value($value, $field, $atts); |
|
519 | - } |
|
518 | + return self::filter_display_value($value, $field, $atts); |
|
519 | + } |
|
520 | 520 | |
521 | - public static function &filter_display_value( $value, $field, $atts = array() ) { |
|
522 | - $saved_value = ( isset($atts['saved_value']) && $atts['saved_value'] ) ? true : false; |
|
521 | + public static function &filter_display_value( $value, $field, $atts = array() ) { |
|
522 | + $saved_value = ( isset($atts['saved_value']) && $atts['saved_value'] ) ? true : false; |
|
523 | 523 | if ( ! in_array( $field->type, array( 'radio', 'checkbox', 'radio', 'select' ) ) || ! FrmField::is_option_true( $field, 'separate_value' ) || $saved_value ) { |
524 | - return $value; |
|
525 | - } |
|
526 | - |
|
527 | - $f_values = $f_labels = array(); |
|
528 | - |
|
529 | - foreach ( $field->options as $opt_key => $opt ) { |
|
530 | - if ( ! is_array($opt) ) { |
|
531 | - continue; |
|
532 | - } |
|
533 | - |
|
534 | - $f_labels[ $opt_key ] = isset( $opt['label'] ) ? $opt['label'] : reset($opt); |
|
535 | - $f_values[ $opt_key ] = isset( $opt['value'] ) ? $opt['value'] : $f_labels[ $opt_key ]; |
|
536 | - if ( $f_labels[ $opt_key ] == $f_values[ $opt_key ] ) { |
|
537 | - unset( $f_values[ $opt_key ], $f_labels[ $opt_key ] ); |
|
538 | - } |
|
539 | - unset($opt_key, $opt); |
|
540 | - } |
|
541 | - |
|
542 | - if ( ! empty($f_values) ) { |
|
543 | - foreach ( (array) $value as $v_key => $val ) { |
|
544 | - if ( in_array($val, $f_values) ) { |
|
545 | - $opt = array_search($val, $f_values); |
|
546 | - if ( is_array($value) ) { |
|
547 | - $value[ $v_key ] = $f_labels[ $opt ]; |
|
548 | - } else { |
|
549 | - $value = $f_labels[ $opt ]; |
|
550 | - } |
|
551 | - } |
|
552 | - unset($v_key, $val); |
|
553 | - } |
|
554 | - } |
|
555 | - |
|
556 | - return $value; |
|
557 | - } |
|
524 | + return $value; |
|
525 | + } |
|
526 | + |
|
527 | + $f_values = $f_labels = array(); |
|
528 | + |
|
529 | + foreach ( $field->options as $opt_key => $opt ) { |
|
530 | + if ( ! is_array($opt) ) { |
|
531 | + continue; |
|
532 | + } |
|
533 | + |
|
534 | + $f_labels[ $opt_key ] = isset( $opt['label'] ) ? $opt['label'] : reset($opt); |
|
535 | + $f_values[ $opt_key ] = isset( $opt['value'] ) ? $opt['value'] : $f_labels[ $opt_key ]; |
|
536 | + if ( $f_labels[ $opt_key ] == $f_values[ $opt_key ] ) { |
|
537 | + unset( $f_values[ $opt_key ], $f_labels[ $opt_key ] ); |
|
538 | + } |
|
539 | + unset($opt_key, $opt); |
|
540 | + } |
|
541 | + |
|
542 | + if ( ! empty($f_values) ) { |
|
543 | + foreach ( (array) $value as $v_key => $val ) { |
|
544 | + if ( in_array($val, $f_values) ) { |
|
545 | + $opt = array_search($val, $f_values); |
|
546 | + if ( is_array($value) ) { |
|
547 | + $value[ $v_key ] = $f_labels[ $opt ]; |
|
548 | + } else { |
|
549 | + $value = $f_labels[ $opt ]; |
|
550 | + } |
|
551 | + } |
|
552 | + unset($v_key, $val); |
|
553 | + } |
|
554 | + } |
|
555 | + |
|
556 | + return $value; |
|
557 | + } |
|
558 | 558 | |
559 | 559 | public static function get_params( $form = null ) { |
560 | 560 | _deprecated_function( __FUNCTION__, '2.0.9', 'FrmForm::get_params' ); |
@@ -562,13 +562,13 @@ discard block |
||
562 | 562 | } |
563 | 563 | |
564 | 564 | public static function entry_sidebar( $entry ) { |
565 | - $data = maybe_unserialize($entry->description); |
|
566 | - $date_format = get_option('date_format'); |
|
567 | - $time_format = get_option('time_format'); |
|
565 | + $data = maybe_unserialize($entry->description); |
|
566 | + $date_format = get_option('date_format'); |
|
567 | + $time_format = get_option('time_format'); |
|
568 | 568 | if ( isset( $data['browser'] ) ) { |
569 | 569 | $browser = FrmEntryFormat::get_browser( $data['browser'] ); |
570 | 570 | } |
571 | 571 | |
572 | 572 | include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/sidebar-shared.php' ); |
573 | - } |
|
573 | + } |
|
574 | 574 | } |