| @@ -63,9 +63,9 @@ | ||
| 63 | 63 | |
| 64 | 64 | /** |
| 65 | 65 | * @param string $class |
| 66 | 66 | * @param string $param |
| 67 | - * @param array $add_html | |
| 67 | + * @param array $add_html | |
| 68 | 68 | * |
| 69 | 69 | * @since 2.0.6 |
| 70 | 70 | */ |
| 71 | 71 | public static function add_html_attr( $class, $param, &$add_html ) { |
| @@ -97,9 +97,10 @@ | ||
| 97 | 97 | $args['form'] = 0; |
| 98 | 98 | } elseif ( FrmAppHelper::is_admin_page( 'formidable' ) && in_array( $frm_action, array( 'new', 'duplicate' ) ) ) { |
| 99 | 99 | $args['frm_action'] = 'edit'; |
| 100 | 100 | } elseif ( FrmAppHelper::is_style_editor_page() ) { |
| 101 | - unset( $args['id'] ); // Avoid passing style into form switcher on style page. | |
| 101 | + // Avoid passing style into form switcher on style page. | |
| 102 | + unset( $args['id'] ); | |
| 102 | 103 | $query_args = array( |
| 103 | 104 | 'page' => 'formidable-styles', |
| 104 | 105 | ); |
| 105 | 106 | if ( $frm_action ) { |
| @@ -190,9 +191,9 @@ | ||
| 190 | 191 | </a> |
| 191 | 192 | </li> |
| 192 | 193 | <?php |
| 193 | 194 | unset( $form ); |
| 194 | - } | |
| 195 | + }//end foreach | |
| 195 | 196 | ?> |
| 196 | 197 | </ul> |
| 197 | 198 | </div> |
| 198 | 199 | <?php |
| @@ -201,9 +202,9 @@ | ||
| 201 | 202 | /** |
| 202 | 203 | * @since 3.05 |
| 203 | 204 | * @deprecated 4.0 |
| 204 | 205 | * |
| 205 | - * @param array $values - The form array | |
| 206 | + * @param array $values The form array. | |
| 206 | 207 | */ |
| 207 | 208 | public static function builder_submit_button( $values ) { |
| 208 | 209 | FrmDeprecated::builder_submit_button( $values ); |
| 209 | 210 | } |
| @@ -260,8 +261,10 @@ | ||
| 260 | 261 | } |
| 261 | 262 | |
| 262 | 263 | /** |
| 263 | 264 | * @param array $atts { |
| 265 | + * The success message details. | |
| 266 | + * | |
| 264 | 267 | * @type string $message |
| 265 | 268 | * @type stdClass $form |
| 266 | 269 | * @type int $entry_id |
| 267 | 270 | * @type string $class |
| @@ -284,9 +287,9 @@ | ||
| 284 | 287 | if ( ! empty( $values ) ) { |
| 285 | 288 | $post_values = $values; |
| 286 | 289 | } else { |
| 287 | 290 | $values = array(); |
| 288 | - $post_values = isset( $_POST ) ? $_POST : array(); // phpcs:ignore WordPress.Security.NonceVerification.Missing | |
| 291 | + $post_values = ! empty( $_POST ) ? $_POST : array(); // phpcs:ignore WordPress.Security.NonceVerification.Missing | |
| 289 | 292 | } |
| 290 | 293 | |
| 291 | 294 | $defaults = array( |
| 292 | 295 | 'name' => '', |
| @@ -367,9 +370,9 @@ | ||
| 367 | 370 | $values[ $var ] = ( $post_values && isset( $post_values['options'][ $var ] ) ) ? $post_values['options'][ $var ] : ( ( $record && isset( $record->options[ $var ] ) ) ? $record->options[ $var ] : $default ); |
| 368 | 371 | } |
| 369 | 372 | |
| 370 | 373 | unset( $var, $default ); |
| 371 | - } | |
| 374 | + }//end foreach | |
| 372 | 375 | |
| 373 | 376 | return $values; |
| 374 | 377 | } |
| 375 | 378 | |
| @@ -418,20 +421,20 @@ | ||
| 418 | 421 | /** |
| 419 | 422 | * @param string $loc |
| 420 | 423 | */ |
| 421 | 424 | public static function get_default_html( $loc ) { |
| 422 | - if ( $loc == 'submit' ) { | |
| 425 | + if ( $loc === 'submit' ) { | |
| 423 | 426 | $draft_link = self::get_draft_link(); |
| 424 | 427 | $start_over = self::get_start_over_shortcode(); |
| 425 | 428 | $default_html = <<<SUBMIT_HTML |
| 426 | -<div class="frm_submit"> | |
| 429 | +<div class="frm_submit frm_flex"> | |
| 430 | +<button class="frm_button_submit" type="submit" [button_action]>[button_label]</button> | |
| 427 | 431 | [if back_button]<button type="submit" name="frm_prev_page" formnovalidate="formnovalidate" class="frm_prev_page" [back_hook]>[back_label]</button>[/if back_button] |
| 428 | -<button class="frm_button_submit" type="submit" [button_action]>[button_label]</button> | |
| 429 | 432 | $draft_link |
| 430 | 433 | $start_over |
| 431 | 434 | </div> |
| 432 | 435 | SUBMIT_HTML; |
| 433 | - } elseif ( $loc == 'before' ) { | |
| 436 | + } elseif ( $loc === 'before' ) { | |
| 434 | 437 | $default_html = <<<BEFORE_HTML |
| 435 | 438 | <legend class="frm_screen_reader">[form_name]</legend> |
| 436 | 439 | [if form_name]<h3 class="frm_form_title">[form_name]</h3>[/if form_name] |
| 437 | 440 | [if form_description]<div class="frm_description">[form_description]</div>[/if form_description] |
| @@ -669,8 +672,10 @@ | ||
| 669 | 672 | * Automatically add end section fields if they don't exist (2.0 migration) |
| 670 | 673 | * |
| 671 | 674 | * @since 2.0 |
| 672 | 675 | * |
| 676 | + * @param object $form | |
| 677 | + * @param array $fields | |
| 673 | 678 | * @param boolean $reset_fields |
| 674 | 679 | */ |
| 675 | 680 | public static function auto_add_end_section_fields( $form, $fields, &$reset_fields ) { |
| 676 | 681 | if ( empty( $fields ) ) { |
| @@ -712,14 +717,14 @@ | ||
| 712 | 717 | } |
| 713 | 718 | |
| 714 | 719 | // There is already an end section here, so there is no need to create one. |
| 715 | 720 | $open = false; |
| 716 | - } | |
| 721 | + }//end switch | |
| 717 | 722 | $prev_order = $field->field_order; |
| 718 | 723 | |
| 719 | 724 | $last_field = $field; |
| 720 | 725 | unset( $field ); |
| 721 | - } | |
| 726 | + }//end foreach | |
| 722 | 727 | |
| 723 | 728 | self::maybe_create_end_section( $open, $reset_fields, $add_order, $end_section_values, $last_field ); |
| 724 | 729 | } |
| 725 | 730 | |
| @@ -756,9 +761,9 @@ | ||
| 756 | 761 | if ( $code === 'form_name' ) { |
| 757 | 762 | $replace_with = $form->name; |
| 758 | 763 | } elseif ( $code === 'form_description' ) { |
| 759 | 764 | $replace_with = FrmAppHelper::use_wpautop( $form->description ); |
| 760 | - } elseif ( $code === 'entry_key' && isset( $_GET ) && isset( $_GET['entry'] ) ) { | |
| 765 | + } elseif ( $code === 'entry_key' && ! empty( $_GET ) && isset( $_GET['entry'] ) ) { | |
| 761 | 766 | $replace_with = FrmAppHelper::simple_get( 'entry' ); |
| 762 | 767 | } else { |
| 763 | 768 | $replace_with = ''; |
| 764 | 769 | } |
| @@ -765,12 +770,12 @@ | ||
| 765 | 770 | |
| 766 | 771 | FrmShortcodeHelper::remove_inline_conditions( ( FrmAppHelper::is_true( $show ) && $replace_with != '' ), $code, $replace_with, $html ); |
| 767 | 772 | } |
| 768 | 773 | |
| 769 | - //replace [form_key] | |
| 774 | + // Replace [form_key]. | |
| 770 | 775 | $html = str_replace( '[form_key]', $form->form_key, $html ); |
| 771 | 776 | |
| 772 | - //replace [frmurl] | |
| 777 | + // Replace [frmurl]. | |
| 773 | 778 | $html = str_replace( '[frmurl]', FrmFieldsHelper::dynamic_default_values( 'frmurl' ), $html ); |
| 774 | 779 | |
| 775 | 780 | if ( strpos( $html, '[button_label]' ) ) { |
| 776 | 781 | add_filter( 'frm_submit_button', 'FrmFormsHelper::submit_button_label', 1 ); |
| @@ -879,9 +884,9 @@ | ||
| 879 | 884 | |
| 880 | 885 | /** |
| 881 | 886 | * Returns appropriate class if form has top labels |
| 882 | 887 | * |
| 883 | - * @param $form | |
| 888 | + * @param array $form | |
| 884 | 889 | * |
| 885 | 890 | * @return string |
| 886 | 891 | */ |
| 887 | 892 | private static function maybe_align_fields_top( $form ) { |
| @@ -890,9 +895,9 @@ | ||
| 890 | 895 | |
| 891 | 896 | /** |
| 892 | 897 | * Determine if a form has fields with top labels so submit button can be aligned properly |
| 893 | 898 | * |
| 894 | - * @param $form | |
| 899 | + * @param array $form | |
| 895 | 900 | * |
| 896 | 901 | * @return bool |
| 897 | 902 | */ |
| 898 | 903 | private static function form_has_top_labels( $form ) { |
| @@ -904,9 +909,10 @@ | ||
| 904 | 909 | if ( count( $fields ) <= 0 ) { |
| 905 | 910 | return false; |
| 906 | 911 | } |
| 907 | 912 | |
| 908 | - $fields = array_reverse( $fields ); // start from the fields closest to the submit button | |
| 913 | + // Start from the fields closest to the submit button. | |
| 914 | + $fields = array_reverse( $fields ); | |
| 909 | 915 | foreach ( $fields as $field ) { |
| 910 | 916 | $type = isset( $field['original_type'] ) ? $field['original_type'] : $field['type']; |
| 911 | 917 | $has_input = FrmFieldFactory::field_has_property( $type, 'has_input' ); |
| 912 | 918 | if ( $has_input ) { |
| @@ -919,10 +925,10 @@ | ||
| 919 | 925 | |
| 920 | 926 | /** |
| 921 | 927 | * Check if a field's label position is set to "top" |
| 922 | 928 | * |
| 923 | - * @param $field | |
| 924 | - * @param $form | |
| 929 | + * @param array $field | |
| 930 | + * @param object|string|bool $form | |
| 925 | 931 | * |
| 926 | 932 | * @return bool |
| 927 | 933 | */ |
| 928 | 934 | private static function field_has_top_label( $field, $form ) { |
| @@ -942,9 +948,9 @@ | ||
| 942 | 948 | return $style; |
| 943 | 949 | } elseif ( is_object( $form ) && $form->parent_form_id ) { |
| 944 | 950 | // get the parent form if this is a child |
| 945 | 951 | $form = $form->parent_form_id; |
| 946 | - } elseif ( is_array( $form ) && isset( $form['parent_form_id'] ) && $form['parent_form_id'] ) { | |
| 952 | + } elseif ( is_array( $form ) && ! empty( $form['parent_form_id'] ) ) { | |
| 947 | 953 | $form = $form['parent_form_id']; |
| 948 | 954 | } elseif ( is_array( $form ) && isset( $form['custom_style'] ) ) { |
| 949 | 955 | $style = $form['custom_style']; |
| 950 | 956 | } |
| @@ -960,9 +966,9 @@ | ||
| 960 | 966 | |
| 961 | 967 | /** |
| 962 | 968 | * Display the validation error messages when an entry is submitted |
| 963 | 969 | * |
| 964 | - * @param array $args - includes img, errors | |
| 970 | + * @param array $args Includes img, errors. | |
| 965 | 971 | * |
| 966 | 972 | * @since 2.0.6 |
| 967 | 973 | */ |
| 968 | 974 | public static function show_errors( $args ) { |
| @@ -988,9 +994,9 @@ | ||
| 988 | 994 | * Display the error message in the front-end along with the image if set |
| 989 | 995 | * The image was removed from the styling settings, but it may still be set with a hook |
| 990 | 996 | * If the message in the global settings is empty, show every validation message in the error box |
| 991 | 997 | * |
| 992 | - * @param array $args - includes img, errors, and show_img | |
| 998 | + * @param array $args Includes img, errors, and show_img. | |
| 993 | 999 | * |
| 994 | 1000 | * @since 2.0.6 |
| 995 | 1001 | */ |
| 996 | 1002 | public static function show_error( $args ) { |
| @@ -1074,9 +1080,9 @@ | ||
| 1074 | 1080 | ); |
| 1075 | 1081 | } |
| 1076 | 1082 | |
| 1077 | 1083 | $actions['trash'] = self::delete_trash_info( $form_id, $form->status ); |
| 1078 | - } | |
| 1084 | + }//end if | |
| 1079 | 1085 | |
| 1080 | 1086 | return $actions; |
| 1081 | 1087 | } |
| 1082 | 1088 | |
| @@ -1100,9 +1106,9 @@ | ||
| 1100 | 1106 | return FrmAppHelper::truncate( $name, 40 ); |
| 1101 | 1107 | } |
| 1102 | 1108 | |
| 1103 | 1109 | /** |
| 1104 | - * @param mixed data | |
| 1110 | + * @param mixed $data | |
| 1105 | 1111 | * @return int |
| 1106 | 1112 | */ |
| 1107 | 1113 | private static function get_form_id_from_data( $data ) { |
| 1108 | 1114 | if ( is_object( $data ) ) { |
| @@ -1183,9 +1189,9 @@ | ||
| 1183 | 1189 | |
| 1184 | 1190 | /** |
| 1185 | 1191 | * @since 3.0 |
| 1186 | 1192 | */ |
| 1187 | - private static function delete_trash_links( $id ) { | |
| 1193 | + public static function delete_trash_links( $id ) { | |
| 1188 | 1194 | $current_page = FrmAppHelper::get_simple_request( array( 'param' => 'form_type' ) ); |
| 1189 | 1195 | $base_url = '?page=formidable&form_type=' . $current_page . '&id=' . $id; |
| 1190 | 1196 | |
| 1191 | 1197 | return array( |
| @@ -1301,26 +1307,31 @@ | ||
| 1301 | 1307 | return $name; |
| 1302 | 1308 | } |
| 1303 | 1309 | |
| 1304 | 1310 | /** |
| 1305 | - * @param array $categories | |
| 1311 | + * Renders a template icon based on the given categories. | |
| 1312 | + * | |
| 1313 | + * @param array $categories The categories to render the icon for. | |
| 1306 | 1314 | * @param array $atts { |
| 1307 | - * @type string $html 'span' or 'div'. | |
| 1308 | - * @type boolean $bg Whether to add a bg color or not. | |
| 1315 | + * Optional. An array of attributes for rendering. | |
| 1316 | + * @type string $html 'span' or 'div'. Default 'span'. | |
| 1317 | + * @type boolean $bg Whether to add a background color or not. Default false. | |
| 1309 | 1318 | * } |
| 1310 | 1319 | * |
| 1311 | 1320 | * @return void |
| 1312 | 1321 | */ |
| 1313 | 1322 | public static function template_icon( $categories, $atts = array() ) { |
| 1323 | + // Define defaults. | |
| 1314 | 1324 | $defaults = array( |
| 1315 | - 'html' => 'span', | |
| 1316 | - 'bg' => false, | |
| 1325 | + 'bg' => true, | |
| 1317 | 1326 | ); |
| 1318 | 1327 | $atts = array_merge( $defaults, $atts ); |
| 1319 | 1328 | |
| 1329 | + // Filter out ignored categories. | |
| 1320 | 1330 | $ignore = self::ignore_template_categories(); |
| 1321 | 1331 | $categories = array_diff( $categories, $ignore ); |
| 1322 | 1332 | |
| 1333 | + // Define icons mapping. | |
| 1323 | 1334 | $icons = array( |
| 1324 | 1335 | 'WooCommerce' => array( 'woocommerce', 'var(--purple)' ), |
| 1325 | 1336 | 'Post' => array( 'wordpress', 'rgb(0,160,210)' ), |
| 1326 | 1337 | 'User Registration' => array( 'register', 'var(--pink)' ), |
| @@ -1350,45 +1361,38 @@ | ||
| 1350 | 1361 | 'Signature' => array( 'signature' ), |
| 1351 | 1362 | '' => array( 'align_right' ), |
| 1352 | 1363 | ); |
| 1353 | 1364 | |
| 1354 | - $icons[ __( 'My Templates', 'formidable' ) ] = array( 'user', 'var(--orange)' ); | |
| 1355 | - | |
| 1365 | + // Determine the icon to be used. | |
| 1356 | 1366 | $icon = $icons['']; |
| 1357 | - | |
| 1358 | 1367 | if ( count( $categories ) === 1 ) { |
| 1359 | 1368 | $category = reset( $categories ); |
| 1360 | 1369 | $icon = isset( $icons[ $category ] ) ? $icons[ $category ] : $icon; |
| 1361 | 1370 | } elseif ( ! empty( $categories ) ) { |
| 1362 | - foreach ( $icons as $cat => $icon ) { | |
| 1363 | - if ( ! in_array( $cat, $categories ) ) { | |
| 1364 | - unset( $icons[ $cat ] ); | |
| 1365 | - } | |
| 1366 | - } | |
| 1371 | + $icons = array_intersect_key( $icons, array_flip( $categories ) ); | |
| 1367 | 1372 | $icon = reset( $icons ); |
| 1368 | 1373 | } |
| 1369 | 1374 | |
| 1370 | - $bg = isset( $icon[1] ) ? $icon[1] : ''; | |
| 1375 | + // Prepare variables for output. | |
| 1376 | + $icon_name = $icon[0]; | |
| 1377 | + $bg_color = isset( $icon[1] ) ? $icon[1] : ''; | |
| 1371 | 1378 | |
| 1372 | - if ( $atts['html'] === 'div' ) { | |
| 1373 | - echo '<div class="frm-category-icon frm-icon-wrapper" role="button"'; | |
| 1374 | - } else { | |
| 1375 | - echo '<span class="frm-inner-circle"'; | |
| 1379 | + // Render the icon. | |
| 1380 | + echo '<span class="frm-category-icon frm-icon-wrapper"'; | |
| 1381 | + if ( $bg_color && $atts['bg'] ) { | |
| 1382 | + echo ' style="background-color:' . esc_attr( $bg_color ) . '"'; | |
| 1376 | 1383 | } |
| 1377 | - echo empty( $bg ) || empty( $atts['bg'] ) ? '' : ' style="background-color:' . esc_attr( $bg ) . '"'; | |
| 1378 | 1384 | echo '>'; |
| 1379 | - | |
| 1380 | - FrmAppHelper::icon_by_class( 'frmfont frm_' . $icon[0] . '_icon' ); | |
| 1381 | - echo '<span class="frm_hidden">'; | |
| 1382 | - FrmAppHelper::icon_by_class( 'frmfont frm_lock_icon' ); | |
| 1385 | + FrmAppHelper::icon_by_class( 'frmfont frm_' . $icon_name . '_icon' ); | |
| 1383 | 1386 | echo '</span>'; |
| 1384 | - echo '</' . esc_attr( $atts['html'] ) . '>'; | |
| 1385 | 1387 | } |
| 1386 | 1388 | |
| 1387 | 1389 | /** |
| 1390 | + * Retrieves the list of template categories to ignore. | |
| 1391 | + * | |
| 1388 | 1392 | * @since 4.03.01 |
| 1389 | 1393 | * |
| 1390 | - * @return array<string> | |
| 1394 | + * @return string[] Array of categories to ignore. | |
| 1391 | 1395 | */ |
| 1392 | 1396 | public static function ignore_template_categories() { |
| 1393 | 1397 | return array( 'Business', 'Elite', 'Personal', 'Creator', 'Basic', 'free' ); |
| 1394 | 1398 | } |
| @@ -1393,9 +1397,15 @@ | ||
| 1393 | 1397 | return array( 'Business', 'Elite', 'Personal', 'Creator', 'Basic', 'free' ); |
| 1394 | 1398 | } |
| 1395 | 1399 | |
| 1396 | 1400 | /** |
| 1401 | + * Get template install link. | |
| 1402 | + * | |
| 1397 | 1403 | * @since 4.02 |
| 1404 | + * | |
| 1405 | + * @param array $template Template details. | |
| 1406 | + * @param array $args Additional arguments. | |
| 1407 | + * @return array The link attributes. | |
| 1398 | 1408 | */ |
| 1399 | 1409 | public static function get_template_install_link( $template, $args ) { |
| 1400 | 1410 | $defaults = array( |
| 1401 | 1411 | 'class' => 'install-now', |
| @@ -1431,9 +1441,8 @@ | ||
| 1431 | 1441 | * |
| 1432 | 1442 | * @since 4.02.02 |
| 1433 | 1443 | * |
| 1434 | 1444 | * @param array $args |
| 1435 | - * | |
| 1436 | 1445 | * @return bool |
| 1437 | 1446 | */ |
| 1438 | 1447 | public static function plan_is_allowed( $args ) { |
| 1439 | 1448 | if ( empty( $args['license_type'] ) ) { |
| @@ -1439,20 +1448,22 @@ | ||
| 1439 | 1448 | if ( empty( $args['license_type'] ) ) { |
| 1440 | 1449 | return false; |
| 1441 | 1450 | } |
| 1442 | 1451 | |
| 1443 | - $included = $args['license_type'] === strtolower( $args['plan_required'] ); | |
| 1452 | + $plans = array( 'free', 'personal', 'business', 'elite' ); | |
| 1453 | + $license_type = strtolower( $args['license_type'] ); | |
| 1454 | + $plan_required = strtolower( $args['plan_required'] ); | |
| 1455 | + $included = $license_type === $plan_required; | |
| 1444 | 1456 | |
| 1445 | - $plans = array( 'free', 'personal', 'business', 'elite' ); | |
| 1446 | - if ( $included || ! in_array( strtolower( $args['plan_required'] ), $plans, true ) ) { | |
| 1457 | + if ( $included || ! in_array( $plan_required, $plans, true ) ) { | |
| 1447 | 1458 | return $included; |
| 1448 | 1459 | } |
| 1449 | 1460 | |
| 1450 | 1461 | foreach ( $plans as $plan ) { |
| 1451 | - if ( $included || $plan === $args['license_type'] ) { | |
| 1462 | + if ( $included || $plan === $license_type ) { | |
| 1452 | 1463 | break; |
| 1453 | 1464 | } |
| 1454 | - $included = $plan === strtolower( $args['plan_required'] ); | |
| 1465 | + $included = $plan === $plan_required; | |
| 1455 | 1466 | } |
| 1456 | 1467 | |
| 1457 | 1468 | return $included; |
| 1458 | 1469 | } |
| @@ -1457,16 +1468,8 @@ | ||
| 1457 | 1468 | return $included; |
| 1458 | 1469 | } |
| 1459 | 1470 | |
| 1460 | 1471 | /** |
| 1461 | - * @since 4.02 | |
| 1462 | - */ | |
| 1463 | - public static function template_install_html( $link, $class = '' ) { | |
| 1464 | - $link['class'] .= ' ' . $class; | |
| 1465 | - echo '<a ' . esc_attr( $link['href'] ) . '="' . esc_url( $link['url'] ) . '" class="' . esc_attr( $link['class'] ) . ' " aria-label="' . esc_attr( $link['label'] ) . '"' . ( $link['atts'] ? ' target="_blank" rel="noopener"' : '' ) . '>'; | |
| 1466 | - } | |
| 1467 | - | |
| 1468 | - /** | |
| 1469 | 1472 | * If a template or add-on cannot be installed, show a message |
| 1470 | 1473 | * about which plan is required. |
| 1471 | 1474 | * |
| 1472 | 1475 | * @since 4.0 |
| @@ -1671,34 +1674,8 @@ | ||
| 1671 | 1674 | ); |
| 1672 | 1675 | } |
| 1673 | 1676 | |
| 1674 | 1677 | /** |
| 1675 | - * Check an array of templates, determine how many the logged in user can use | |
| 1676 | - * | |
| 1677 | - * @param array $templates | |
| 1678 | - * @param array $args | |
| 1679 | - * @return int | |
| 1680 | - */ | |
| 1681 | - public static function available_count( $templates, $args ) { | |
| 1682 | - return array_reduce( | |
| 1683 | - $templates, | |
| 1684 | - function( $total, $template ) use ( $args ) { | |
| 1685 | - if ( ! empty( $template['url'] ) ) { | |
| 1686 | - return $total + 1; | |
| 1687 | - } | |
| 1688 | - | |
| 1689 | - $args['plan_required'] = self::get_plan_required( $template ); | |
| 1690 | - if ( self::plan_is_allowed( $args ) ) { | |
| 1691 | - return $total + 1; | |
| 1692 | - } | |
| 1693 | - | |
| 1694 | - return $total; | |
| 1695 | - }, | |
| 1696 | - 0 | |
| 1697 | - ); | |
| 1698 | - } | |
| 1699 | - | |
| 1700 | - /** | |
| 1701 | 1678 | * Make sure the field shortcodes in a url always add the sanitize_url=1 option if nothing is defined. |
| 1702 | 1679 | * This is to prevent some field characters like ', @, and | from being stripped from the redirect URL. |
| 1703 | 1680 | * |
| 1704 | 1681 | * @since 5.0.16 |
| @@ -1747,9 +1724,9 @@ | ||
| 1747 | 1724 | } |
| 1748 | 1725 | $new_shortcode .= ' sanitize_url=1]'; |
| 1749 | 1726 | |
| 1750 | 1727 | $query = str_replace( $shortcode, $new_shortcode, $query ); |
| 1751 | - } | |
| 1728 | + }//end foreach | |
| 1752 | 1729 | |
| 1753 | 1730 | if ( $query === $original_query ) { |
| 1754 | 1731 | return $url; |
| 1755 | 1732 | } |
| @@ -1766,6 +1743,44 @@ | ||
| 1766 | 1743 | * @return bool |
| 1767 | 1744 | */ |
| 1768 | 1745 | public static function should_use_pro_for_ajax_submit() { |
| 1769 | 1746 | return is_callable( 'FrmProForm::is_ajax_on' ) && ! is_callable( 'FrmProFormsHelper::lite_supports_ajax_submit' ); |
| 1747 | + } | |
| 1748 | + | |
| 1749 | + /** | |
| 1750 | + * Outputs the appropriate button text in the publish box. | |
| 1751 | + * | |
| 1752 | + * @return void | |
| 1753 | + */ | |
| 1754 | + public static function publish_box_button_text() { | |
| 1755 | + $is_new_template = FrmAppHelper::simple_get( 'new_template' ); | |
| 1756 | + $action = FrmAppHelper::simple_get( 'frm_action' ); | |
| 1757 | + | |
| 1758 | + if ( ( 'edit' === $action || 'settings' === $action ) && $is_new_template ) { | |
| 1759 | + esc_html_e( 'Save', 'formidable' ); | |
| 1760 | + } else { | |
| 1761 | + esc_html_e( 'Update', 'formidable' ); | |
| 1762 | + } | |
| 1763 | + } | |
| 1764 | + | |
| 1765 | + /** | |
| 1766 | + * @since 4.02 | |
| 1767 | + * @deprecated 6.7 | |
| 1768 | + */ | |
| 1769 | + public static function template_install_html( $link, $class = '' ) { | |
| 1770 | + _deprecated_function( __METHOD__, '6.7' ); | |
| 1771 | + } | |
| 1772 | + | |
| 1773 | + /** | |
| 1774 | + * Check an array of templates, determine how many the logged in user can use | |
| 1775 | + * | |
| 1776 | + * @deprecated 6.7 | |
| 1777 | + * | |
| 1778 | + * @param array $templates | |
| 1779 | + * @param array $args | |
| 1780 | + * @return int | |
| 1781 | + */ | |
| 1782 | + public static function available_count( $templates, $args ) { | |
| 1783 | + _deprecated_function( __METHOD__, '6.7' ); | |
| 1784 | + return 0; | |
| 1770 | 1785 | } |
| 1771 | 1786 | } |