| @@ -46,9 +46,12 @@ | ||
| 46 | 46 | } |
| 47 | 47 | ?> |
| 48 | 48 | |
| 49 | 49 | <ul class="subsubsub"> |
| 50 | - <li><a href="javascript:void(0)" class="current frmids"><?php esc_html_e( 'IDs', 'formidable' ); ?></a> |</li> | |
| 50 | + <li> | |
| 51 | + <a href="javascript:void(0)" class="current frmids"><?php esc_html_e( 'IDs', 'formidable' ); ?></a> | |
| 52 | + <span class="frm-vertical-separator"></span> | |
| 53 | + </li> | |
| 51 | 54 | <li><a href="javascript:void(0)" class="frmkeys"><?php esc_html_e( 'Keys', 'formidable' ); ?></a></li> |
| 52 | 55 | </ul> |
| 53 | 56 | <ul class="frm_code_list frm_customize_field_list frm-full-hover"> |
| 54 | 57 | <?php |
| @@ -57,18 +60,19 @@ | ||
| 57 | 60 | if ( FrmField::is_no_save_field( $f->type ) ) { |
| 58 | 61 | continue; |
| 59 | 62 | } |
| 60 | 63 | |
| 61 | - if ( $f->type == 'data' && ( ! isset( $f->field_options['data_type'] ) || $f->field_options['data_type'] == 'data' || $f->field_options['data_type'] == '' ) ) { | |
| 64 | + // phpcs:ignore Universal.Operators.StrictComparisons | |
| 65 | + if ( $f->type === 'data' && ( ! isset( $f->field_options['data_type'] ) || $f->field_options['data_type'] === 'data' || $f->field_options['data_type'] == '' ) ) { | |
| 62 | 66 | continue; |
| 63 | 67 | } |
| 64 | 68 | |
| 65 | 69 | FrmFormsHelper::insert_opt_html( |
| 66 | 70 | array( |
| 67 | - 'id' => $f->id, | |
| 68 | - 'key' => $f->field_key, | |
| 69 | - 'name' => $f->name, | |
| 70 | - 'type' => $f->type, | |
| 71 | + 'id' => $f->id, | |
| 72 | + 'key' => $f->field_key, | |
| 73 | + 'name' => $f->name, | |
| 74 | + 'type' => $f->type, | |
| 71 | 75 | 'class' => 'frm-customize-list dropdown-item', |
| 72 | 76 | ) |
| 73 | 77 | ); |
| 74 | 78 | |
| @@ -73,14 +77,14 @@ | ||
| 73 | 77 | ); |
| 74 | 78 | |
| 75 | 79 | do_action( 'frm_field_code_tab', array( 'field' => $f ) ); |
| 76 | 80 | |
| 77 | - if ( $f->type == 'user_id' ) { | |
| 81 | + if ( $f->type === 'user_id' ) { | |
| 78 | 82 | $uid = $f->id; |
| 79 | 83 | } |
| 80 | 84 | unset( $f ); |
| 81 | - } | |
| 82 | - } | |
| 85 | + }//end foreach | |
| 86 | + }//end if | |
| 83 | 87 | ?> |
| 84 | 88 | </ul> |
| 85 | 89 | </div> |
| 86 | 90 | |
| @@ -85,36 +89,31 @@ | ||
| 85 | 89 | </div> |
| 86 | 90 | |
| 87 | 91 | <?php |
| 88 | 92 | $show_logic = ! empty( $cond_shortcodes ) && ! empty( $fields ); |
| 93 | + | |
| 89 | 94 | if ( $show_logic ) { |
| 90 | 95 | ?> |
| 91 | - <div id="frm-conditionals" class="tabs-panel"> | |
| 92 | - <div class="frmcenter"> | |
| 93 | - <?php | |
| 94 | - FrmHtmlHelper::toggle( | |
| 95 | - 'frm-id-key-condition', | |
| 96 | - '', | |
| 97 | - array( | |
| 98 | - 'checked' => true, | |
| 99 | - 'on_label' => __( 'Use IDs', 'formidable' ), | |
| 100 | - 'off_label' => __( 'Use Keys', 'formidable' ), | |
| 101 | - 'value' => 'id', | |
| 102 | - 'show_labels' => true, | |
| 103 | - 'echo' => true, | |
| 104 | - ) | |
| 105 | - ); | |
| 106 | - ?> | |
| 96 | + <div id="frm-conditionals" class="tabs-panel frm-text-grey-700 frm-px-xs"> | |
| 97 | + <div class="frm-h-stack-sm"> | |
| 98 | + <label class="frm-h-stack-xs" for="frm-id-key-condition-key"> | |
| 99 | + <input type="radio" id="frm-id-key-condition-key" name="frm-id-key-condition" value="key"> | |
| 100 | + <span><?php esc_html_e( 'Use Keys', 'formidable' ); ?></span> | |
| 101 | + </label> | |
| 102 | + <label class="frm-h-stack-xs" for="frm-id-key-condition-id"> | |
| 103 | + <input type="radio" id="frm-id-key-condition-id" name="frm-id-key-condition" value="id" checked> | |
| 104 | + <span><?php esc_html_e( 'Use IDs', 'formidable' ); ?></span> | |
| 105 | + </label> | |
| 107 | 106 | </div> |
| 108 | 107 | |
| 109 | - <div class="frm_grid_container frm-fields frm-mx-sm"> | |
| 110 | - <div class="frm1 frm_form_field frm-inline-select"> | |
| 108 | + <div class="frm_grid_container frm-fields"> | |
| 109 | + <div class="frm-pb-xs"> | |
| 111 | 110 | <label for="frm-id-condition"> |
| 112 | 111 | <?php esc_html_e( 'IF', 'formidable' ); ?> |
| 113 | 112 | </label> |
| 114 | - </div> | |
| 113 | + </div> | |
| 115 | 114 | |
| 116 | - <div class="frm11 frm_form_field"> | |
| 115 | + <div class="frm_form_field frm-mt-0"> | |
| 117 | 116 | <select id="frm-id-condition" class="frm-build-logic"> |
| 118 | 117 | <option value="x"> |
| 119 | 118 | <?php esc_html_e( 'Select a Field', 'formidable' ); ?> |
| 120 | 119 | </option> |
| @@ -119,13 +118,15 @@ | ||
| 119 | 118 | <?php esc_html_e( 'Select a Field', 'formidable' ); ?> |
| 120 | 119 | </option> |
| 121 | 120 | <?php |
| 122 | 121 | foreach ( $fields as $f ) { |
| 123 | - ?> | |
| 124 | - <option value="<?php echo esc_attr( $f->id ); ?>"> | |
| 125 | - <?php echo esc_html( $f->name ); ?> | |
| 126 | - </option> | |
| 127 | - <?php | |
| 122 | + FrmHtmlHelper::echo_dropdown_option( | |
| 123 | + $f->name, | |
| 124 | + false, | |
| 125 | + array( | |
| 126 | + 'value' => $f->id, | |
| 127 | + ) | |
| 128 | + ); | |
| 128 | 129 | } |
| 129 | 130 | ?> |
| 130 | 131 | </select> |
| 131 | 132 | <select id="frm-key-condition" class="frm_hidden frm-build-logic"> |
| @@ -133,28 +134,31 @@ | ||
| 133 | 134 | <?php esc_html_e( 'Select a Field', 'formidable' ); ?> |
| 134 | 135 | </option> |
| 135 | 136 | <?php |
| 136 | 137 | foreach ( $fields as $f ) { |
| 137 | - ?> | |
| 138 | - <option value="<?php echo esc_attr( $f->field_key ); ?>"> | |
| 139 | - <?php echo esc_html( $f->name ); ?> | |
| 140 | - </option> | |
| 141 | - <?php | |
| 138 | + FrmHtmlHelper::echo_dropdown_option( | |
| 139 | + $f->name, | |
| 140 | + false, | |
| 141 | + array( | |
| 142 | + 'value' => $f->field_key, | |
| 143 | + ) | |
| 144 | + ); | |
| 142 | 145 | } |
| 143 | 146 | ?> |
| 144 | 147 | </select> |
| 145 | 148 | </div> |
| 146 | 149 | |
| 147 | - <div class="frm1 frm_form_field"></div> | |
| 148 | - <div class="frm11 frm_form_field"> | |
| 150 | + <div class="frm_form_field frm-mt-0"> | |
| 149 | 151 | <select id="frm-is-condition" class="frm-build-logic"> |
| 150 | 152 | <?php |
| 151 | 153 | foreach ( $cond_shortcodes as $skey => $sname ) { |
| 152 | - ?> | |
| 153 | - <option value="<?php echo esc_attr( $skey ); ?>"> | |
| 154 | - <?php echo esc_html( $sname ); ?> | |
| 155 | - </option> | |
| 156 | - <?php | |
| 154 | + FrmHtmlHelper::echo_dropdown_option( | |
| 155 | + $sname, | |
| 156 | + false, | |
| 157 | + array( | |
| 158 | + 'value' => $skey, | |
| 159 | + ) | |
| 160 | + ); | |
| 157 | 161 | unset( $skey, $sname ); |
| 158 | 162 | } |
| 159 | 163 | ?> |
| 160 | 164 | </select> |
| @@ -159,52 +163,57 @@ | ||
| 159 | 163 | ?> |
| 160 | 164 | </select> |
| 161 | 165 | </div> |
| 162 | 166 | |
| 163 | - <div class="frm1 frm_form_field"></div> | |
| 164 | - <div class="frm11 frm_form_field"> | |
| 167 | + <div class="frm_form_field frm-m-0"> | |
| 165 | 168 | <input id="frm-text-condition" type="text" value="" placeholder="<?php esc_attr_e( 'A blank value', 'formidable' ); ?>" class="frm-build-logic" /> |
| 166 | 169 | </div> |
| 167 | 170 | </div> |
| 168 | - <p class="frmcenter frm-mb-0"> | |
| 169 | - <?php esc_html_e( 'Click to Insert', 'formidable' ); ?>: | |
| 170 | - </p> | |
| 171 | - <ul class="frm_code_list frm-full-hover frmcenter frm-m-0"> | |
| 172 | - <li> | |
| 173 | - <a href="#" id="frm-insert-condition" class="frm_insert_code" data-code="if x equals='']<?php esc_attr_e( 'Conditional content here', 'formidable' ); ?>[/if x"> | |
| 174 | - [if x equals=""][/if x] | |
| 175 | - </a> | |
| 176 | - </li> | |
| 177 | - </ul> | |
| 171 | + | |
| 172 | + <p class="frm-m-0 frm-pb-xs"><?php esc_html_e( 'Click to Insert', 'formidable' ); ?>:</p> | |
| 173 | + <ul class="frm_code_list frm-full-hover frm-m-0"> | |
| 174 | + <li> | |
| 175 | + <a href="#" id="frm-insert-condition" class="frm_insert_code" data-code="if x equals='']<?php esc_attr_e( 'Conditional content here', 'formidable' ); ?>[/if x"> | |
| 176 | + [if x equals=""][/if x] | |
| 177 | + </a> | |
| 178 | + </li> | |
| 179 | + </ul> | |
| 178 | 180 | </div> |
| 179 | 181 | <?php |
| 180 | - } | |
| 182 | + }//end if | |
| 181 | 183 | ?> |
| 182 | 184 | |
| 183 | 185 | <div id="frm-adv-info-tab" class="tabs-panel"> |
| 184 | 186 | <div class="dropdown-item frm-with-search"> |
| 185 | - <?php | |
| 186 | - FrmAppHelper::show_search_box( | |
| 187 | - array( | |
| 188 | - 'input_id' => 'advanced', | |
| 189 | - 'placeholder' => __( 'Search', 'formidable' ), | |
| 190 | - 'tosearch' => 'frm-advanced-list', | |
| 191 | - ) | |
| 192 | - ); | |
| 193 | - ?> | |
| 187 | + <?php | |
| 188 | + FrmAppHelper::show_search_box( | |
| 189 | + array( | |
| 190 | + 'input_id' => 'advanced', | |
| 191 | + 'placeholder' => __( 'Search', 'formidable' ), | |
| 192 | + 'tosearch' => 'frm-advanced-list', | |
| 193 | + ) | |
| 194 | + ); | |
| 195 | + ?> | |
| 194 | 196 | </div> |
| 195 | - <ul class="frm_code_list frm-full-hover"> | |
| 197 | + | |
| 198 | + <ul class="frm_code_list frm-full-hover frm-mt-0"> | |
| 196 | 199 | <?php |
| 200 | + $contextual_codes = FrmShortcodeHelper::get_contextual_codes(); | |
| 201 | + | |
| 197 | 202 | foreach ( $entry_shortcodes as $skey => $sname ) { |
| 198 | - if ( empty( $skey ) ) { | |
| 203 | + if ( ! $skey ) { | |
| 199 | 204 | echo '<li class="clear frm_block"></li>'; |
| 200 | 205 | continue; |
| 201 | 206 | } |
| 202 | 207 | |
| 203 | - $classes = 'frm-advanced-list'; | |
| 204 | - $classes .= ( in_array( $skey, array( 'siteurl', 'sitename', 'entry_count' ) ) ) ? ' show_before_content show_after_content' : ''; | |
| 205 | - $classes .= ( strpos( $skey, 'default-' ) === 0 ) ? ' hide_frm_not_email_subject' : ''; | |
| 208 | + $classes = 'frm-advanced-list'; | |
| 209 | + $classes .= in_array( $skey, array( 'siteurl', 'sitename', 'entry_count' ), true ) ? ' show_before_content show_after_content' : ''; | |
| 210 | + $classes .= str_starts_with( $skey, 'default-' ) ? ' hide_frm_not_email_subject' : ''; | |
| 206 | 211 | |
| 212 | + if ( array_key_exists( $skey, $contextual_codes ) ) { | |
| 213 | + $classes .= ' frm_hidden'; | |
| 214 | + } | |
| 215 | + | |
| 207 | 216 | FrmFormsHelper::insert_code_html( |
| 208 | 217 | array( |
| 209 | 218 | 'code' => $skey, |
| 210 | 219 | 'label' => $sname, |
| @@ -212,9 +221,9 @@ | ||
| 212 | 221 | ) |
| 213 | 222 | ); |
| 214 | 223 | |
| 215 | 224 | unset( $skey, $sname, $classes ); |
| 216 | - } | |
| 225 | + }//end foreach | |
| 217 | 226 | |
| 218 | 227 | foreach ( $advanced_helpers as $helper_type => $helper ) { |
| 219 | 228 | if ( 'user_id' === $helper_type && ! isset( $uid ) ) { |
| 220 | 229 | continue; |
| @@ -219,9 +228,9 @@ | ||
| 219 | 228 | if ( 'user_id' === $helper_type && ! isset( $uid ) ) { |
| 220 | 229 | continue; |
| 221 | 230 | } |
| 222 | 231 | |
| 223 | - if ( isset( $helper['heading'] ) && ! empty( $helper['heading'] ) ) { | |
| 232 | + if ( ! empty( $helper['heading'] ) ) { | |
| 224 | 233 | ?> |
| 225 | 234 | <li style="padding:0 25px;"> |
| 226 | 235 | <p class="howto"><?php echo esc_html( $helper['heading'] ); ?></p> |
| 227 | 236 | </li> |
| @@ -228,13 +237,9 @@ | ||
| 228 | 237 | <?php |
| 229 | 238 | } |
| 230 | 239 | |
| 231 | 240 | foreach ( $helper['codes'] as $code => $code_label ) { |
| 232 | - if ( isset( $uid ) ) { | |
| 233 | - $code = str_replace( '|user_id|', $uid, $code ); | |
| 234 | - } else { | |
| 235 | - $code = str_replace( '|user_id|', 'x', $code ); | |
| 236 | - } | |
| 241 | + $code = isset( $uid ) ? str_replace( '|user_id|', $uid, $code ) : str_replace( '|user_id|', 'x', $code ); | |
| 237 | 242 | $include_x = strpos( $code, ' ' ) ? '' : 'x '; |
| 238 | 243 | |
| 239 | 244 | if ( ! is_array( $code_label ) ) { |
| 240 | 245 | $code_label = array( |
| @@ -245,16 +250,16 @@ | ||
| 245 | 250 | FrmFormsHelper::insert_code_html( |
| 246 | 251 | array( |
| 247 | 252 | 'code' => $include_x . $code, |
| 248 | 253 | 'label' => $code_label['label'], |
| 249 | - 'title' => isset( $code_label['title'] ) ? $code_label['title'] : '', | |
| 254 | + 'title' => $code_label['title'] ?? '', | |
| 250 | 255 | 'class' => 'frm-advanced-list', |
| 251 | 256 | ) |
| 252 | 257 | ); |
| 253 | 258 | |
| 254 | 259 | unset( $code ); |
| 255 | - } | |
| 256 | - } | |
| 260 | + }//end foreach | |
| 261 | + }//end foreach | |
| 257 | 262 | ?> |
| 258 | 263 | </ul> |
| 259 | 264 | </div> |
| 260 | 265 | |
| @@ -259,8 +264,8 @@ | ||
| 259 | 264 | </div> |
| 260 | 265 | |
| 261 | 266 | <?php |
| 262 | 267 | if ( $settings_tab ) { |
| 263 | - include( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/mb_html_tab.php' ); | |
| 268 | + include FrmAppHelper::plugin_path() . '/classes/views/frm-forms/mb_html_tab.php'; | |
| 264 | 269 | } |
| 265 | 270 | ?> |
| 266 | 271 | </div> |