Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/wp-conte.../plugins/wpforms-.../includes/admin/builder
File: class-builder.php
}
[1000] Fix | Delete
[1001] Fix | Delete
/**
[1002] Fix | Delete
* Allow developers to disable Form Builder output.
[1003] Fix | Delete
*
[1004] Fix | Delete
* @since 1.5.8.2
[1005] Fix | Delete
*
[1006] Fix | Delete
* @param bool $is_enabled Is builder output enabled? Defaults to `true`.
[1007] Fix | Delete
*/
[1008] Fix | Delete
if ( ! (bool) apply_filters( 'wpforms_builder_output', true ) ) {
[1009] Fix | Delete
return;
[1010] Fix | Delete
}
[1011] Fix | Delete
[1012] Fix | Delete
$form_id = $this->form ? absint( $this->form->ID ) : '';
[1013] Fix | Delete
$field_id = ! empty( $this->form_data['field_id'] ) ? $this->form_data['field_id'] : '';
[1014] Fix | Delete
$revision = wpforms()->get( 'revisions' )->get_revision();
[1015] Fix | Delete
$preview_url = wpforms_get_form_preview_url( $form_id, true );
[1016] Fix | Delete
$allowed_caps = [ 'edit_posts', 'edit_other_posts', 'edit_private_posts', 'edit_published_posts', 'edit_pages', 'edit_other_pages', 'edit_published_pages', 'edit_private_pages' ];
[1017] Fix | Delete
$can_embed = array_filter( $allowed_caps, 'current_user_can' );
[1018] Fix | Delete
$preview_classes = [ 'wpforms-btn', 'wpforms-btn-toolbar', 'wpforms-btn-light-grey' ];
[1019] Fix | Delete
$builder_classes = [ 'wpforms-admin-page' ];
[1020] Fix | Delete
[1021] Fix | Delete
if ( ! $can_embed ) {
[1022] Fix | Delete
$preview_classes[] = 'wpforms-alone';
[1023] Fix | Delete
}
[1024] Fix | Delete
[1025] Fix | Delete
$revision_id = null;
[1026] Fix | Delete
[1027] Fix | Delete
if ( $revision ) {
[1028] Fix | Delete
$revision_id = $revision->ID;
[1029] Fix | Delete
$builder_classes[] = 'wpforms-is-revision';
[1030] Fix | Delete
}
[1031] Fix | Delete
[1032] Fix | Delete
if ( $this->form && wp_revisions_enabled( $this->form ) ) {
[1033] Fix | Delete
$builder_classes[] = 'wpforms-revisions-enabled';
[1034] Fix | Delete
}
[1035] Fix | Delete
[1036] Fix | Delete
/**
[1037] Fix | Delete
* Allow to modify builder container classes.
[1038] Fix | Delete
*
[1039] Fix | Delete
* @since 1.7.9
[1040] Fix | Delete
*
[1041] Fix | Delete
* @param array $classes List of classes.
[1042] Fix | Delete
* @param array $form_data Form data and settings.
[1043] Fix | Delete
*/
[1044] Fix | Delete
$builder_classes = (array) apply_filters( 'wpforms_builder_output_classes', $builder_classes, $this->form_data );
[1045] Fix | Delete
[1046] Fix | Delete
/**
[1047] Fix | Delete
* Allow developers to add content before the top toolbar in the Form Builder.
[1048] Fix | Delete
*
[1049] Fix | Delete
* @since 1.7.4
[1050] Fix | Delete
*
[1051] Fix | Delete
* @param string $content Content before toolbar. Defaults to empty string.
[1052] Fix | Delete
*/
[1053] Fix | Delete
$before_toolbar = apply_filters( 'wpforms_builder_output_before_toolbar', '' );
[1054] Fix | Delete
?>
[1055] Fix | Delete
[1056] Fix | Delete
<div id="wpforms-builder" class="<?php echo wpforms_sanitize_classes( $builder_classes, true ); ?>">
[1057] Fix | Delete
[1058] Fix | Delete
<?php
[1059] Fix | Delete
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
[1060] Fix | Delete
echo wpforms_render( 'builder/fullscreen/ie-notice' );
[1061] Fix | Delete
[1062] Fix | Delete
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
[1063] Fix | Delete
if ( empty( $_GET['force_desktop_view'] ) ) {
[1064] Fix | Delete
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
[1065] Fix | Delete
echo wpforms_render( 'builder/fullscreen/mobile-notice' );
[1066] Fix | Delete
}
[1067] Fix | Delete
?>
[1068] Fix | Delete
[1069] Fix | Delete
<div id="wpforms-builder-overlay">
[1070] Fix | Delete
<div class="wpforms-builder-overlay-content">
[1071] Fix | Delete
<i class="spinner"></i>
[1072] Fix | Delete
<i class="avatar"></i>
[1073] Fix | Delete
</div>
[1074] Fix | Delete
</div>
[1075] Fix | Delete
[1076] Fix | Delete
<form
[1077] Fix | Delete
name="wpforms-builder" id="wpforms-builder-form" method="post"
[1078] Fix | Delete
data-id="<?php echo esc_attr( $form_id ); ?>"
[1079] Fix | Delete
data-revision="<?php echo esc_attr( $revision_id ); ?>"
[1080] Fix | Delete
>
[1081] Fix | Delete
[1082] Fix | Delete
<input type="hidden" name="id" value="<?php echo esc_attr( $form_id ); ?>">
[1083] Fix | Delete
<input type="hidden" value="<?php echo wpforms_validate_field_id( $field_id ); ?>" name="field_id" id="wpforms-field-id">
[1084] Fix | Delete
[1085] Fix | Delete
<?php echo $before_toolbar; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
[1086] Fix | Delete
[1087] Fix | Delete
<!-- Toolbar -->
[1088] Fix | Delete
<div class="wpforms-toolbar">
[1089] Fix | Delete
[1090] Fix | Delete
<div class="wpforms-left">
[1091] Fix | Delete
<img src="<?php echo esc_url( WPFORMS_PLUGIN_URL . 'assets/images/sullie-alt.png' ); ?>" alt="<?php esc_attr_e( 'Sullie the WPForms mascot', 'wpforms-lite' ); ?>">
[1092] Fix | Delete
</div>
[1093] Fix | Delete
[1094] Fix | Delete
<div class="wpforms-center">
[1095] Fix | Delete
[1096] Fix | Delete
<?php if ( $this->form ) : ?>
[1097] Fix | Delete
[1098] Fix | Delete
<span class="wpforms-center-form-name-prefix">
[1099] Fix | Delete
<?php esc_html_e( 'Now editing', 'wpforms-lite' ); ?>
[1100] Fix | Delete
</span>
[1101] Fix | Delete
[1102] Fix | Delete
<span class="wpforms-center-form-name wpforms-form-name">
[1103] Fix | Delete
<?php echo esc_html( isset( $this->form_data['settings']['form_title'] ) ? $this->form_data['settings']['form_title'] : $this->form->post_title ); ?>
[1104] Fix | Delete
</span>
[1105] Fix | Delete
[1106] Fix | Delete
<?php if ( $this->form->post_type === 'wpforms-template' ) : ?>
[1107] Fix | Delete
<span class="wpforms-center-form-template-badge">
[1108] Fix | Delete
<?php echo esc_html__( 'Template', 'wpforms-lite' ); ?>
[1109] Fix | Delete
</span>
[1110] Fix | Delete
<?php endif; ?>
[1111] Fix | Delete
[1112] Fix | Delete
<?php endif; ?>
[1113] Fix | Delete
[1114] Fix | Delete
</div>
[1115] Fix | Delete
[1116] Fix | Delete
<div class="wpforms-right">
[1117] Fix | Delete
[1118] Fix | Delete
<button id="wpforms-help"
[1119] Fix | Delete
class="wpforms-btn wpforms-btn-toolbar wpforms-btn-light-grey"
[1120] Fix | Delete
title="<?php esc_attr_e( 'Help Ctrl+H', 'wpforms-lite' ); ?>">
[1121] Fix | Delete
<i class="fa fa-question-circle-o"></i>
[1122] Fix | Delete
<span<?php echo $this->form ? ' class="screen-reader-text"' : ''; ?>>
[1123] Fix | Delete
<?php esc_html_e( 'Help', 'wpforms-lite' ); ?>
[1124] Fix | Delete
</span>
[1125] Fix | Delete
</button>
[1126] Fix | Delete
[1127] Fix | Delete
<?php if ( $this->form ) : ?>
[1128] Fix | Delete
<div id="wpforms-context-menu-container"
[1129] Fix | Delete
class="wpforms-btn wpforms-btn-toolbar wpforms-btn-light-grey">
[1130] Fix | Delete
<svg width="16" height="16" fill="currentColor">
[1131] Fix | Delete
<path d="M2 4a2 2 0 0 0 2-2 2 2 0 0 0-2-2 2 2 0 0 0-2 2c0 1.1.9 2 2 2Zm6 12a2 2 0 0 0 2-2 2 2 0 0 0-2-2 2 2 0 0 0-2 2c0 1.1.9 2 2 2Zm-6 0a2 2 0 0 0 2-2 2 2 0 0 0-2-2 2 2 0 0 0-2 2c0 1.1.9 2 2 2Zm0-6a2 2 0 0 0 2-2 2 2 0 0 0-2-2 2 2 0 0 0-2 2c0 1.1.9 2 2 2Zm6 0a2 2 0 0 0 2-2 2 2 0 0 0-2-2 2 2 0 0 0-2 2c0 1.1.9 2 2 2Zm4-8c0 1.1.9 2 2 2a2 2 0 0 0 2-2 2 2 0 0 0-2-2 2 2 0 0 0-2 2ZM8 4a2 2 0 0 0 2-2 2 2 0 0 0-2-2 2 2 0 0 0-2 2c0 1.1.9 2 2 2Zm6 6a2 2 0 0 0 2-2 2 2 0 0 0-2-2 2 2 0 0 0-2 2c0 1.1.9 2 2 2Zm0 6a2 2 0 0 0 2-2 2 2 0 0 0-2-2 2 2 0 0 0-2 2c0 1.1.9 2 2 2Z"/>
[1132] Fix | Delete
</svg>
[1133] Fix | Delete
<?php echo wpforms_render( 'builder/context-menu', $this->get_context_menu_args(), true ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
[1134] Fix | Delete
</div>
[1135] Fix | Delete
[1136] Fix | Delete
<?php if ( ! $revision ) : ?>
[1137] Fix | Delete
<a href="<?php echo esc_url( $preview_url ); ?>"
[1138] Fix | Delete
id="wpforms-preview-btn"
[1139] Fix | Delete
class="<?php echo wpforms_sanitize_classes( $preview_classes, true ); ?>"
[1140] Fix | Delete
title="<?php esc_attr_e( 'Preview Form Ctrl+P', 'wpforms-lite' ); ?>"
[1141] Fix | Delete
target="_blank"
[1142] Fix | Delete
rel="noopener noreferrer">
[1143] Fix | Delete
<i class="fa fa-eye"></i><span class="text"><?php esc_html_e( 'Preview', 'wpforms-lite' ); ?></span>
[1144] Fix | Delete
</a>
[1145] Fix | Delete
<?php endif; ?>
[1146] Fix | Delete
[1147] Fix | Delete
<?php if ( $can_embed && ! $revision ) : ?>
[1148] Fix | Delete
<?php if ( $this->form->post_type === 'wpforms-template' ) : ?>
[1149] Fix | Delete
<button id="wpforms-embed"
[1150] Fix | Delete
class="wpforms-btn wpforms-btn-toolbar wpforms-btn-light-grey wpforms-btn-light-grey-disabled"
[1151] Fix | Delete
title="<?php esc_attr_e( 'You cannot embed a form template', 'wpforms-lite' ); ?>">
[1152] Fix | Delete
<i class="fa fa-code"></i><span class="text"><?php esc_html_e( 'Embed', 'wpforms-lite' ); ?></span>
[1153] Fix | Delete
</button>
[1154] Fix | Delete
<?php else : ?>
[1155] Fix | Delete
<button id="wpforms-embed"
[1156] Fix | Delete
class="wpforms-btn wpforms-btn-toolbar wpforms-btn-light-grey"
[1157] Fix | Delete
title="<?php esc_attr_e( 'Embed Form Ctrl+B', 'wpforms-lite' ); ?>">
[1158] Fix | Delete
<i class="fa fa-code"></i><span class="text"><?php esc_html_e( 'Embed', 'wpforms-lite' ); ?></span>
[1159] Fix | Delete
</button>
[1160] Fix | Delete
<?php endif; ?>
[1161] Fix | Delete
<?php endif; ?>
[1162] Fix | Delete
[1163] Fix | Delete
<button id="wpforms-save"
[1164] Fix | Delete
class="wpforms-btn wpforms-btn-toolbar wpforms-btn-orange"
[1165] Fix | Delete
title="<?php esc_attr_e( 'Save Form Ctrl+S', 'wpforms-lite' ); ?>">
[1166] Fix | Delete
<i class="fa fa-check"></i><i class="wpforms-loading-spinner wpforms-loading-white wpforms-loading-inline wpforms-hidden"></i><span class="text"><?php esc_html_e( 'Save', 'wpforms-lite' ); ?></span>
[1167] Fix | Delete
</button>
[1168] Fix | Delete
[1169] Fix | Delete
<?php endif; ?>
[1170] Fix | Delete
[1171] Fix | Delete
<button id="wpforms-exit" title="<?php esc_attr_e( 'Exit Ctrl+Q', 'wpforms-lite' ); ?>">
[1172] Fix | Delete
<i class="fa fa-times"></i>
[1173] Fix | Delete
</button>
[1174] Fix | Delete
[1175] Fix | Delete
</div>
[1176] Fix | Delete
[1177] Fix | Delete
</div>
[1178] Fix | Delete
[1179] Fix | Delete
<!-- Panel toggle buttons. -->
[1180] Fix | Delete
<div class="wpforms-panels-toggle" id="wpforms-panels-toggle">
[1181] Fix | Delete
[1182] Fix | Delete
<?php
[1183] Fix | Delete
/**
[1184] Fix | Delete
* Outputs the buttons to toggle between Form Builder panels.
[1185] Fix | Delete
*
[1186] Fix | Delete
* @since 1.0.0
[1187] Fix | Delete
*
[1188] Fix | Delete
* @param WP_Post $form The form object.
[1189] Fix | Delete
* @param string $view Current view (panel) name.
[1190] Fix | Delete
*/
[1191] Fix | Delete
do_action( 'wpforms_builder_panel_buttons', $this->form, $this->view );
[1192] Fix | Delete
?>
[1193] Fix | Delete
[1194] Fix | Delete
</div>
[1195] Fix | Delete
[1196] Fix | Delete
<div class="wpforms-panels">
[1197] Fix | Delete
[1198] Fix | Delete
<?php
[1199] Fix | Delete
/**
[1200] Fix | Delete
* Outputs the contents of Form Builder panels.
[1201] Fix | Delete
*
[1202] Fix | Delete
* @since 1.0.0
[1203] Fix | Delete
*
[1204] Fix | Delete
* @param WP_Post $form The form object.
[1205] Fix | Delete
* @param string $view Current view (panel) name.
[1206] Fix | Delete
*/
[1207] Fix | Delete
do_action( 'wpforms_builder_panels', $this->form, $this->view );
[1208] Fix | Delete
?>
[1209] Fix | Delete
[1210] Fix | Delete
</div>
[1211] Fix | Delete
[1212] Fix | Delete
</form>
[1213] Fix | Delete
[1214] Fix | Delete
</div>
[1215] Fix | Delete
[1216] Fix | Delete
<?php
[1217] Fix | Delete
}
[1218] Fix | Delete
[1219] Fix | Delete
/**
[1220] Fix | Delete
* Display abort message using empty state page.
[1221] Fix | Delete
*
[1222] Fix | Delete
* @since 1.7.3
[1223] Fix | Delete
*/
[1224] Fix | Delete
public function display_abort_message() {
[1225] Fix | Delete
[1226] Fix | Delete
if ( ! $this->abort ) {
[1227] Fix | Delete
return;
[1228] Fix | Delete
}
[1229] Fix | Delete
[1230] Fix | Delete
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
[1231] Fix | Delete
echo wpforms_render(
[1232] Fix | Delete
'builder/fullscreen/abort-message',
[1233] Fix | Delete
[
[1234] Fix | Delete
'message' => $this->abort_message,
[1235] Fix | Delete
],
[1236] Fix | Delete
true
[1237] Fix | Delete
);
[1238] Fix | Delete
}
[1239] Fix | Delete
[1240] Fix | Delete
/**
[1241] Fix | Delete
* Change default admin meta viewport tag upon request to force scrollable
[1242] Fix | Delete
* desktop view on small screens.
[1243] Fix | Delete
*
[1244] Fix | Delete
* @since 1.7.8
[1245] Fix | Delete
*
[1246] Fix | Delete
* @param string $value Default meta viewport tag value.
[1247] Fix | Delete
*
[1248] Fix | Delete
* @return string
[1249] Fix | Delete
*/
[1250] Fix | Delete
public function viewport_meta( $value ) {
[1251] Fix | Delete
[1252] Fix | Delete
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
[1253] Fix | Delete
if ( ! empty( $_GET['force_desktop_view'] ) ) {
[1254] Fix | Delete
return 'width=1024, initial-scale=1';
[1255] Fix | Delete
}
[1256] Fix | Delete
[1257] Fix | Delete
return $value;
[1258] Fix | Delete
}
[1259] Fix | Delete
[1260] Fix | Delete
/**
[1261] Fix | Delete
* Get localized currency strings for the builder.
[1262] Fix | Delete
*
[1263] Fix | Delete
* @since 1.8.2
[1264] Fix | Delete
*
[1265] Fix | Delete
* @param array $strings Array of localized strings.
[1266] Fix | Delete
*
[1267] Fix | Delete
* @return array
[1268] Fix | Delete
*/
[1269] Fix | Delete
private function add_localized_currencies( array $strings ) {
[1270] Fix | Delete
[1271] Fix | Delete
$currency = wpforms_get_currency();
[1272] Fix | Delete
$currencies = wpforms_get_currencies();
[1273] Fix | Delete
[1274] Fix | Delete
$strings['currency'] = sanitize_text_field( $currency );
[1275] Fix | Delete
$strings['currency_name'] = isset( $currencies[ $currency ]['name'] ) ? sanitize_text_field( $currencies[ $currency ]['name'] ) : '';
[1276] Fix | Delete
$strings['currency_decimals'] = wpforms_get_currency_decimals( $currencies[ $currency ] );
[1277] Fix | Delete
$strings['currency_decimal'] = isset( $currencies[ $currency ]['decimal_separator'] ) ? sanitize_text_field( $currencies[ $currency ]['decimal_separator'] ) : '.';
[1278] Fix | Delete
$strings['currency_thousands'] = isset( $currencies[ $currency ]['thousands_separator'] ) ? sanitize_text_field( $currencies[ $currency ]['thousands_separator'] ) : ',';
[1279] Fix | Delete
$strings['currency_symbol'] = isset( $currencies[ $currency ]['symbol'] ) ? sanitize_text_field( $currencies[ $currency ]['symbol'] ) : '$';
[1280] Fix | Delete
$strings['currency_symbol_pos'] = isset( $currencies[ $currency ]['symbol_pos'] ) ? sanitize_text_field( $currencies[ $currency ]['symbol_pos'] ) : 'left';
[1281] Fix | Delete
[1282] Fix | Delete
return $strings;
[1283] Fix | Delete
}
[1284] Fix | Delete
[1285] Fix | Delete
/**
[1286] Fix | Delete
* Get context menu arguments, depending on the Lite/Pro version and form or form template type.
[1287] Fix | Delete
*
[1288] Fix | Delete
* @since 1.8.8
[1289] Fix | Delete
*
[1290] Fix | Delete
* @return array
[1291] Fix | Delete
*/
[1292] Fix | Delete
private function get_context_menu_args(): array {
[1293] Fix | Delete
[1294] Fix | Delete
$args = [
[1295] Fix | Delete
'form_id' => $this->form->ID,
[1296] Fix | Delete
'is_form_template' => $this->form->post_type === 'wpforms-template',
[1297] Fix | Delete
'has_payments' => wpforms()->get( 'payment' )->get_by( 'form_id', $this->form->ID ) !== null,
[1298] Fix | Delete
'show_whats_new' => wpforms()->get( 'splash_screen' )->is_available_for_display(),
[1299] Fix | Delete
];
[1300] Fix | Delete
[1301] Fix | Delete
if ( wpforms()->is_pro() ) {
[1302] Fix | Delete
$args['has_entries'] = wpforms()->get( 'entry' )->get_entries( [ 'form_id' => $this->form->ID ], true ) > 0;
[1303] Fix | Delete
$args['can_duplicate'] = $this->can_duplicate();
[1304] Fix | Delete
}
[1305] Fix | Delete
[1306] Fix | Delete
return $args;
[1307] Fix | Delete
}
[1308] Fix | Delete
[1309] Fix | Delete
/**
[1310] Fix | Delete
* Check if the current user is allowed to duplicate the form.
[1311] Fix | Delete
*
[1312] Fix | Delete
* @since 1.8.8
[1313] Fix | Delete
*
[1314] Fix | Delete
* @return bool
[1315] Fix | Delete
*/
[1316] Fix | Delete
private function can_duplicate(): bool {
[1317] Fix | Delete
[1318] Fix | Delete
if ( ! wpforms_current_user_can( 'create_forms' ) ) {
[1319] Fix | Delete
return false;
[1320] Fix | Delete
}
[1321] Fix | Delete
[1322] Fix | Delete
if ( ! wpforms_current_user_can( 'view_form_single', $this->form->ID ) ) {
[1323] Fix | Delete
return false;
[1324] Fix | Delete
}
[1325] Fix | Delete
[1326] Fix | Delete
return true;
[1327] Fix | Delete
}
[1328] Fix | Delete
}
[1329] Fix | Delete
[1330] Fix | Delete
WPForms_Builder::instance();
[1331] Fix | Delete
[1332] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function