Edit File by line
/home/zeestwma/richards.../wp-conte.../plugins/wpforms-.../includes/admin
File: admin.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* Global admin related items and functionality.
[2] Fix | Delete
*
[3] Fix | Delete
* @since 1.3.9
[4] Fix | Delete
*/
[5] Fix | Delete
[6] Fix | Delete
if ( ! defined( 'ABSPATH' ) ) {
[7] Fix | Delete
exit;
[8] Fix | Delete
}
[9] Fix | Delete
[10] Fix | Delete
use WPForms\Admin\Blocks\Links;
[11] Fix | Delete
use WPForms\Admin\Notice;
[12] Fix | Delete
[13] Fix | Delete
/**
[14] Fix | Delete
* Load styles for all WPForms-related admin screens.
[15] Fix | Delete
*
[16] Fix | Delete
* @since 1.3.9
[17] Fix | Delete
*/
[18] Fix | Delete
function wpforms_admin_styles() {
[19] Fix | Delete
[20] Fix | Delete
if ( ! wpforms_is_admin_page() ) {
[21] Fix | Delete
return;
[22] Fix | Delete
}
[23] Fix | Delete
[24] Fix | Delete
$min = wpforms_get_min_suffix();
[25] Fix | Delete
[26] Fix | Delete
// jQuery.Confirm Reloaded.
[27] Fix | Delete
wp_enqueue_style(
[28] Fix | Delete
'jquery-confirm',
[29] Fix | Delete
WPFORMS_PLUGIN_URL . 'assets/lib/jquery.confirm/jquery-confirm.min.css',
[30] Fix | Delete
[],
[31] Fix | Delete
'1.0.0'
[32] Fix | Delete
);
[33] Fix | Delete
[34] Fix | Delete
// Minicolors (color picker).
[35] Fix | Delete
wp_enqueue_style(
[36] Fix | Delete
'minicolors',
[37] Fix | Delete
WPFORMS_PLUGIN_URL . 'assets/lib/jquery.minicolors/jquery.minicolors.min.css',
[38] Fix | Delete
[],
[39] Fix | Delete
'2.3.6'
[40] Fix | Delete
);
[41] Fix | Delete
[42] Fix | Delete
// FontAwesome.
[43] Fix | Delete
wp_enqueue_style(
[44] Fix | Delete
'wpforms-font-awesome',
[45] Fix | Delete
WPFORMS_PLUGIN_URL . 'assets/lib/font-awesome/font-awesome.min.css',
[46] Fix | Delete
null,
[47] Fix | Delete
'4.7.0'
[48] Fix | Delete
);
[49] Fix | Delete
[50] Fix | Delete
// Main admin styles.
[51] Fix | Delete
wp_enqueue_style(
[52] Fix | Delete
'wpforms-admin',
[53] Fix | Delete
WPFORMS_PLUGIN_URL . "assets/css/admin{$min}.css",
[54] Fix | Delete
[],
[55] Fix | Delete
WPFORMS_VERSION
[56] Fix | Delete
);
[57] Fix | Delete
[58] Fix | Delete
wp_enqueue_style(
[59] Fix | Delete
'wpforms-multiselect-checkboxes',
[60] Fix | Delete
WPFORMS_PLUGIN_URL . 'assets/lib/wpforms-multiselect/wpforms-multiselect-checkboxes.min.css',
[61] Fix | Delete
[],
[62] Fix | Delete
'1.0.0'
[63] Fix | Delete
);
[64] Fix | Delete
[65] Fix | Delete
// Remove TinyMCE editor styles from third-party themes and plugins.
[66] Fix | Delete
remove_editor_styles();
[67] Fix | Delete
[68] Fix | Delete
// WordPress 5.7 color set.
[69] Fix | Delete
if ( version_compare( get_bloginfo( 'version' ), '5.7', '>=' ) ) {
[70] Fix | Delete
wp_enqueue_style(
[71] Fix | Delete
'wpforms-admin-wp5.7-color',
[72] Fix | Delete
WPFORMS_PLUGIN_URL . "assets/css/admin-wp5.7-colors{$min}.css",
[73] Fix | Delete
[ 'wpforms-admin' ],
[74] Fix | Delete
WPFORMS_VERSION
[75] Fix | Delete
);
[76] Fix | Delete
}
[77] Fix | Delete
}
[78] Fix | Delete
add_action( 'admin_enqueue_scripts', 'wpforms_admin_styles', 5 );
[79] Fix | Delete
[80] Fix | Delete
/**
[81] Fix | Delete
* Load scripts for all WPForms-related admin screens.
[82] Fix | Delete
*
[83] Fix | Delete
* @since 1.3.9
[84] Fix | Delete
*
[85] Fix | Delete
* @noinspection HtmlUnknownTarget
[86] Fix | Delete
*/
[87] Fix | Delete
function wpforms_admin_scripts() {
[88] Fix | Delete
[89] Fix | Delete
if ( ! wpforms_is_admin_page() ) {
[90] Fix | Delete
return;
[91] Fix | Delete
}
[92] Fix | Delete
[93] Fix | Delete
$min = wpforms_get_min_suffix();
[94] Fix | Delete
[95] Fix | Delete
if ( wpforms_is_admin_page( 'settings', 'email' ) ) {
[96] Fix | Delete
wp_enqueue_media();
[97] Fix | Delete
}
[98] Fix | Delete
[99] Fix | Delete
// jQuery.Confirm Reloaded.
[100] Fix | Delete
wp_enqueue_script(
[101] Fix | Delete
'jquery-confirm',
[102] Fix | Delete
WPFORMS_PLUGIN_URL . 'assets/lib/jquery.confirm/jquery-confirm.min.js',
[103] Fix | Delete
[ 'jquery' ],
[104] Fix | Delete
'1.0.0',
[105] Fix | Delete
false
[106] Fix | Delete
);
[107] Fix | Delete
[108] Fix | Delete
// Minicolors (color picker).
[109] Fix | Delete
wp_enqueue_script(
[110] Fix | Delete
'minicolors',
[111] Fix | Delete
WPFORMS_PLUGIN_URL . 'assets/lib/jquery.minicolors/jquery.minicolors.min.js',
[112] Fix | Delete
[ 'jquery' ],
[113] Fix | Delete
'2.3.6',
[114] Fix | Delete
false
[115] Fix | Delete
);
[116] Fix | Delete
[117] Fix | Delete
// Choices.js.
[118] Fix | Delete
wp_enqueue_script(
[119] Fix | Delete
'choicesjs',
[120] Fix | Delete
WPFORMS_PLUGIN_URL . 'assets/lib/choices.min.js',
[121] Fix | Delete
[],
[122] Fix | Delete
'10.2.0',
[123] Fix | Delete
false
[124] Fix | Delete
);
[125] Fix | Delete
[126] Fix | Delete
// jQuery Conditionals.
[127] Fix | Delete
wp_enqueue_script(
[128] Fix | Delete
'conditions',
[129] Fix | Delete
WPFORMS_PLUGIN_URL . 'assets/lib/conditions.min.js',
[130] Fix | Delete
[ 'jquery' ],
[131] Fix | Delete
'1.1.0',
[132] Fix | Delete
false
[133] Fix | Delete
);
[134] Fix | Delete
[135] Fix | Delete
wp_enqueue_script(
[136] Fix | Delete
'wpforms-generic-utils',
[137] Fix | Delete
WPFORMS_PLUGIN_URL . "assets/js/share/utils{$min}.js",
[138] Fix | Delete
[ 'jquery' ],
[139] Fix | Delete
WPFORMS_VERSION,
[140] Fix | Delete
true
[141] Fix | Delete
);
[142] Fix | Delete
[143] Fix | Delete
// Load admin utils JS.
[144] Fix | Delete
wp_enqueue_script(
[145] Fix | Delete
'wpforms-admin-utils',
[146] Fix | Delete
WPFORMS_PLUGIN_URL . "assets/js/admin/share/admin-utils{$min}.js",
[147] Fix | Delete
[ 'jquery' ],
[148] Fix | Delete
WPFORMS_VERSION,
[149] Fix | Delete
true
[150] Fix | Delete
);
[151] Fix | Delete
[152] Fix | Delete
// Main admin script.
[153] Fix | Delete
wp_enqueue_script(
[154] Fix | Delete
'wpforms-admin',
[155] Fix | Delete
WPFORMS_PLUGIN_URL . "assets/js/admin/admin{$min}.js",
[156] Fix | Delete
[ 'jquery', 'underscore', 'wp-util' ],
[157] Fix | Delete
WPFORMS_VERSION,
[158] Fix | Delete
false
[159] Fix | Delete
);
[160] Fix | Delete
[161] Fix | Delete
wp_enqueue_script(
[162] Fix | Delete
'wpforms-multiselect-checkboxes',
[163] Fix | Delete
WPFORMS_PLUGIN_URL . 'assets/lib/wpforms-multiselect/wpforms-multiselect-checkboxes.min.js',
[164] Fix | Delete
[],
[165] Fix | Delete
WPFORMS_VERSION,
[166] Fix | Delete
true
[167] Fix | Delete
);
[168] Fix | Delete
[169] Fix | Delete
$default_choicesjs_loading_text = esc_html__( 'Loading...', 'wpforms-lite' );
[170] Fix | Delete
$default_choicesjs_no_results_text = esc_html__( 'No results found', 'wpforms-lite' );
[171] Fix | Delete
$default_choicesjs_no_choices_text = esc_html__( 'No choices to choose from', 'wpforms-lite' );
[172] Fix | Delete
[173] Fix | Delete
$image_extensions = wpforms_chain( get_allowed_mime_types() )
[174] Fix | Delete
->map(
[175] Fix | Delete
static function ( $mime ) {
[176] Fix | Delete
[177] Fix | Delete
return strpos( $mime, 'image/' ) === 0 ? $mime : '';
[178] Fix | Delete
}
[179] Fix | Delete
)
[180] Fix | Delete
->array_filter()
[181] Fix | Delete
->array_values()
[182] Fix | Delete
->value();
[183] Fix | Delete
[184] Fix | Delete
$strings = [
[185] Fix | Delete
'addon_activate' => esc_html__( 'Activate', 'wpforms-lite' ),
[186] Fix | Delete
'addon_activated' => esc_html__( 'Activated', 'wpforms-lite' ),
[187] Fix | Delete
'addon_active' => esc_html__( 'Active', 'wpforms-lite' ),
[188] Fix | Delete
'addon_deactivate' => esc_html__( 'Deactivate', 'wpforms-lite' ),
[189] Fix | Delete
'addon_inactive' => esc_html__( 'Inactive', 'wpforms-lite' ),
[190] Fix | Delete
'addon_install' => esc_html__( 'Install Addon', 'wpforms-lite' ),
[191] Fix | Delete
'addon_error' => sprintf(
[192] Fix | Delete
wp_kses( /* translators: %1$s - addon download URL, %2$s - link to manual installation guide, %3$s - link to contact support. */
[193] Fix | Delete
__( 'Could not install the addon. Please <a href="%1$s" target="_blank" rel="noopener noreferrer">download it from wpforms.com</a> and <a href="%2$s" target="_blank" rel="noopener noreferrer">install it manually</a>, or <a href="%3$s" target="_blank" rel="noopener noreferrer">contact support</a> for assistance.', 'wpforms-lite' ),
[194] Fix | Delete
[
[195] Fix | Delete
'a' => [
[196] Fix | Delete
'href' => true,
[197] Fix | Delete
'target' => true,
[198] Fix | Delete
'rel' => true,
[199] Fix | Delete
],
[200] Fix | Delete
]
[201] Fix | Delete
),
[202] Fix | Delete
esc_url( wpforms_utm_link( 'https://wpforms.com/account/licenses/', 'Licenses', 'Addons Error' ) ),
[203] Fix | Delete
esc_url( wpforms_utm_link( 'https://wpforms.com/docs/how-to-manually-install-addons-in-wpforms/', 'Addons Doc', 'Addons Error' ) ),
[204] Fix | Delete
esc_url( wpforms_utm_link( 'https://wpforms.com/contact/', 'Contact', 'Addons Error' ) )
[205] Fix | Delete
),
[206] Fix | Delete
'plugin_error' => esc_html__( 'Could not install the plugin automatically. Please download and install it manually.', 'wpforms-lite' ),
[207] Fix | Delete
'addon_search' => esc_html__( 'Searching Addons', 'wpforms-lite' ),
[208] Fix | Delete
'ajax_url' => admin_url( 'admin-ajax.php' ),
[209] Fix | Delete
'cancel' => esc_html__( 'Cancel', 'wpforms-lite' ),
[210] Fix | Delete
'continue' => esc_html__( 'Continue', 'wpforms-lite' ),
[211] Fix | Delete
'close' => esc_html__( 'Close', 'wpforms-lite' ),
[212] Fix | Delete
'close_refresh' => esc_html__( 'Close and Refresh', 'wpforms-lite' ),
[213] Fix | Delete
'column_selector_title' => esc_html__( 'Change columns to display', 'wpforms-lite' ),
[214] Fix | Delete
'column_selector_no_fields' => esc_html__( 'Sorry, there are no form fields that match your criteria.', 'wpforms-lite' ),
[215] Fix | Delete
'column_selector_no_meta' => esc_html__( 'Sorry, there is no entry meta that match your criteria.', 'wpforms-lite' ),
[216] Fix | Delete
'entry_delete_confirm' => esc_html__( 'Are you sure you want to delete this entry? This will also remove all associated files, notes, and logs.', 'wpforms-lite' ),
[217] Fix | Delete
'entry_delete_all_confirm' => esc_html__( 'Are you sure you want to delete ALL entries? This will also remove all associated files, notes, and logs.', 'wpforms-lite' ),
[218] Fix | Delete
'entry_delete_n_confirm' => sprintf( /* translators: %s - entry count. */
[219] Fix | Delete
esc_html__( 'Are you sure you want to delete %s entries? This will also remove all associated files, notes, and logs.', 'wpforms-lite' ),
[220] Fix | Delete
'{entry_count}'
[221] Fix | Delete
),
[222] Fix | Delete
'entry_trash_confirm' => esc_html__( 'Are you sure you want to trash this entry? This will also remove all associated files, notes, and logs.', 'wpforms-lite' ),
[223] Fix | Delete
'entry_trash_all_confirm' => esc_html__( 'Are you sure you want to trash ALL entries? This will also remove all associated files, notes, and logs.', 'wpforms-lite' ),
[224] Fix | Delete
'entry_trash_n_confirm' => sprintf( /* translators: %s - entry count. */
[225] Fix | Delete
esc_html__( 'Are you sure you want to trash %s entries? This will also remove all associated files, notes, and logs.', 'wpforms-lite' ),
[226] Fix | Delete
'{entry_count}'
[227] Fix | Delete
),
[228] Fix | Delete
'entry_empty_fields_hide' => esc_html__( 'Hide Empty Fields', 'wpforms-lite' ),
[229] Fix | Delete
'entry_empty_fields_show' => esc_html__( 'Show Empty Fields', 'wpforms-lite' ),
[230] Fix | Delete
'entry_note_delete_confirm' => esc_html__( 'Are you sure you want to delete this note?', 'wpforms-lite' ),
[231] Fix | Delete
'entry_unstar' => esc_html__( 'Unstar entry', 'wpforms-lite' ),
[232] Fix | Delete
'entry_star' => esc_html__( 'Star entry', 'wpforms-lite' ),
[233] Fix | Delete
'entry_read' => esc_html__( 'Mark entry read', 'wpforms-lite' ),
[234] Fix | Delete
'entry_unread' => esc_html__( 'Mark entry unread', 'wpforms-lite' ),
[235] Fix | Delete
'form_delete_confirm' => esc_html__( 'Are you sure you want to delete this form and all its entries?', 'wpforms-lite' ),
[236] Fix | Delete
'template_delete_confirm' => esc_html__( 'Are you sure you want to delete this template and all its entries?', 'wpforms-lite' ),
[237] Fix | Delete
'form_delete_n_confirm' => esc_html__( 'Are you sure you want to delete the selected forms and all their entries?', 'wpforms-lite' ),
[238] Fix | Delete
'form_delete_all_confirm' => esc_html__( 'Are you sure you want to delete ALL the forms in the trash and all their entries?', 'wpforms-lite' ),
[239] Fix | Delete
'form_duplicate_confirm' => esc_html__( 'Are you sure you want to duplicate this form?', 'wpforms-lite' ),
[240] Fix | Delete
'template_duplicate_confirm' => esc_html__( 'Are you sure you want to duplicate this template?', 'wpforms-lite' ),
[241] Fix | Delete
'heads_up' => esc_html__( 'Heads up!', 'wpforms-lite' ),
[242] Fix | Delete
'importer_forms_required' => esc_html__( 'Please select at least one form to import.', 'wpforms-lite' ),
[243] Fix | Delete
'isPro' => wpforms()->is_pro(),
[244] Fix | Delete
'nonce' => wp_create_nonce( 'wpforms-admin' ),
[245] Fix | Delete
'almost_done' => esc_html__( 'Almost Done', 'wpforms-lite' ),
[246] Fix | Delete
'thanks_for_interest' => esc_html__( 'Thanks for your interest in WPForms Pro!', 'wpforms-lite' ),
[247] Fix | Delete
'oops' => esc_html__( 'Oops!', 'wpforms-lite' ),
[248] Fix | Delete
'uh_oh' => esc_html__( 'Uh oh!', 'wpforms-lite' ),
[249] Fix | Delete
'ok' => esc_html__( 'OK', 'wpforms-lite' ),
[250] Fix | Delete
'plugin_install_activate_btn' => esc_html__( 'Install and Activate', 'wpforms-lite' ),
[251] Fix | Delete
'plugin_install_activate_confirm' => esc_html__( 'needs to be installed and activated to import its forms. Would you like us to install and activate it for you?', 'wpforms-lite' ),
[252] Fix | Delete
'plugin_activate_btn' => esc_html__( 'Activate', 'wpforms-lite' ),
[253] Fix | Delete
'plugin_activate_confirm' => esc_html__( 'needs to be activated to import its forms. Would you like us to activate it for you?', 'wpforms-lite' ),
[254] Fix | Delete
'provider_delete_confirm' => esc_html__( 'Are you sure you want to disconnect this account? Any form connections you have set up will be lost.', 'wpforms-lite' ),
[255] Fix | Delete
'provider_delete_error' => esc_html__( 'Could not disconnect this account.', 'wpforms-lite' ),
[256] Fix | Delete
'provider_auth_error' => esc_html__( 'Could not authenticate with the provider.', 'wpforms-lite' ),
[257] Fix | Delete
'connecting' => esc_html__( 'Connecting...', 'wpforms-lite' ),
[258] Fix | Delete
'save_refresh' => esc_html__( 'Save and Refresh', 'wpforms-lite' ),
[259] Fix | Delete
'save_changes' => esc_html__( 'Save Changes', 'wpforms-lite' ),
[260] Fix | Delete
'server_error' => esc_html__( 'Unfortunately there was a server connection error.', 'wpforms-lite' ),
[261] Fix | Delete
'unknown_error' => esc_html__( 'Unknown error.', 'wpforms-lite' ),
[262] Fix | Delete
'settings_form_style_base' => sprintf(
[263] Fix | Delete
wp_kses( /* translators: %s - WPForms.com docs page URL. */
[264] Fix | Delete
__( 'You\'ve selected <strong>Base Styling Only</strong>, which may result in styling issues. <a href="%s" target="_blank" rel="noopener noreferrer">Please check out our tutorial</a> for common issues and recommendations.', 'wpforms-lite' ),
[265] Fix | Delete
[
[266] Fix | Delete
'strong' => [],
[267] Fix | Delete
'a' => [
[268] Fix | Delete
'href' => [],
[269] Fix | Delete
'target' => [],
[270] Fix | Delete
'rel' => [],
[271] Fix | Delete
],
[272] Fix | Delete
]
[273] Fix | Delete
),
[274] Fix | Delete
esc_url( wpforms_utm_link( 'https://wpforms.com/docs/how-to-choose-an-include-form-styling-setting/', 'settings-license-modal', 'Base Styling Only' ) )
[275] Fix | Delete
),
[276] Fix | Delete
'settings_form_style_none' => sprintf(
[277] Fix | Delete
wp_kses( /* translators: %s - WPForms.com docs page URL. */
[278] Fix | Delete
__( 'You\'ve selected <strong>No Styling</strong>, which will likely result in significant styling issues and is recommended only for developers. <a href="%s" target="_blank" rel="noopener noreferrer">Please check out our tutorial</a> for more details and recommendations.', 'wpforms-lite' ),
[279] Fix | Delete
[
[280] Fix | Delete
'strong' => [],
[281] Fix | Delete
'a' => [
[282] Fix | Delete
'href' => [],
[283] Fix | Delete
'target' => [],
[284] Fix | Delete
'rel' => [],
[285] Fix | Delete
],
[286] Fix | Delete
]
[287] Fix | Delete
),
[288] Fix | Delete
esc_url( wpforms_utm_link( 'https://wpforms.com/docs/how-to-choose-an-include-form-styling-setting/', 'settings-license-modal', 'No Styling' ) )
[289] Fix | Delete
),
[290] Fix | Delete
'testing' => esc_html__( 'Testing', 'wpforms-lite' ),
[291] Fix | Delete
'recreating' => esc_html__( 'Recreating', 'wpforms-lite' ),
[292] Fix | Delete
'upgrade_completed' => esc_html__( 'Upgrade was successfully completed!', 'wpforms-lite' ),
[293] Fix | Delete
'upload_image_title' => esc_html__( 'Upload or Choose Your Image', 'wpforms-lite' ),
[294] Fix | Delete
'upload_image_button' => esc_html__( 'Use Image', 'wpforms-lite' ),
[295] Fix | Delete
'upload_image_extensions' => $image_extensions,
[296] Fix | Delete
'upload_image_extensions_error' => esc_html__( 'You tried uploading a file type that is not allowed. Please try again.', 'wpforms-lite' ),
[297] Fix | Delete
'upgrade_modal' => wpforms_get_upgrade_modal_text(),
[298] Fix | Delete
'choicesjs_loading' => $default_choicesjs_loading_text,
[299] Fix | Delete
'choicesjs_no_results' => $default_choicesjs_no_results_text,
[300] Fix | Delete
'choicesjs_no_choices' => $default_choicesjs_no_choices_text,
[301] Fix | Delete
'debug' => wpforms_debug(),
[302] Fix | Delete
'edit_license' => esc_html__( 'To edit the License Key, please first click the Remove Key button. Please note that removing this key will remove access to updates, addons, and support.', 'wpforms-lite' ),
[303] Fix | Delete
'something_went_wrong' => esc_html__( 'Something went wrong', 'wpforms-lite' ),
[304] Fix | Delete
'success' => esc_html__( 'Success', 'wpforms-lite' ),
[305] Fix | Delete
'loading' => esc_html__( 'Loading...', 'wpforms-lite' ),
[306] Fix | Delete
'use_default_template' => esc_html__( 'Use Default Template', 'wpforms-lite' ),
[307] Fix | Delete
'error_select_template' => esc_html__( 'Something went wrong while applying the form template. Please try again. If the error persists, contact our support team.', 'wpforms-lite' ),
[308] Fix | Delete
'try_again' => sprintf(
[309] Fix | Delete
wp_kses( /* translators: %s - link to WPForms.com docs page. */
[310] Fix | Delete
__( 'Something went wrong. Please try again, and if the problem persists, <a href="%1$s" target="_blank" rel="noopener noreferrer">contact our support team</a>.', 'wpforms-lite' ),
[311] Fix | Delete
[
[312] Fix | Delete
'a' => [
[313] Fix | Delete
'href' => [],
[314] Fix | Delete
'target' => [],
[315] Fix | Delete
'rel' => [],
[316] Fix | Delete
],
[317] Fix | Delete
]
[318] Fix | Delete
),
[319] Fix | Delete
esc_url( wpforms_utm_link( 'https://wpforms.com/contact/', 'error-modal', 'contact our support team' ) )
[320] Fix | Delete
),
[321] Fix | Delete
];
[322] Fix | Delete
[323] Fix | Delete
/**
[324] Fix | Delete
* Allow theme/plugin developers to adjust main strings on backend/admin part.
[325] Fix | Delete
*
[326] Fix | Delete
* @since 1.3.9
[327] Fix | Delete
*
[328] Fix | Delete
* @param array $strings Main admin localized strings.
[329] Fix | Delete
*/
[330] Fix | Delete
$strings = (array) apply_filters( 'wpforms_admin_strings', $strings );
[331] Fix | Delete
[332] Fix | Delete
/**
[333] Fix | Delete
* Allow theme/plugin developers to adjust Choices.js settings on backend/admin part.
[334] Fix | Delete
*
[335] Fix | Delete
* @see https://github.com/Choices-js/Choices#setup For configuration options.
[336] Fix | Delete
*
[337] Fix | Delete
* @since 1.7.3
[338] Fix | Delete
*
[339] Fix | Delete
* @param array $choicesjs_config Choicesjs configuration.
[340] Fix | Delete
*/
[341] Fix | Delete
$choicesjs_config = (array) apply_filters(
[342] Fix | Delete
'wpforms_admin_scripts_choicesjs_config',
[343] Fix | Delete
[
[344] Fix | Delete
'searchEnabled' => false,
[345] Fix | Delete
// Forces the search to look for exact matches anywhere in the string.
[346] Fix | Delete
'fuseOptions' => [
[347] Fix | Delete
'threshold' => 0.1,
[348] Fix | Delete
'distance' => 1000,
[349] Fix | Delete
],
[350] Fix | Delete
'loadingText' => ! empty( $strings['choicesjs_loading'] ) ? $strings['choicesjs_loading'] : $default_choicesjs_loading_text,
[351] Fix | Delete
'noResultsText' => ! empty( $strings['choicesjs_no_results'] ) ? $strings['choicesjs_no_results'] : $default_choicesjs_no_results_text,
[352] Fix | Delete
'noChoicesText' => ! empty( $strings['choicesjs_no_choices'] ) ? $strings['choicesjs_no_choices'] : $default_choicesjs_no_choices_text,
[353] Fix | Delete
]
[354] Fix | Delete
);
[355] Fix | Delete
[356] Fix | Delete
wp_localize_script(
[357] Fix | Delete
'wpforms-admin',
[358] Fix | Delete
'wpforms_admin_choicesjs_config',
[359] Fix | Delete
$choicesjs_config
[360] Fix | Delete
);
[361] Fix | Delete
[362] Fix | Delete
wp_localize_script(
[363] Fix | Delete
'wpforms-admin',
[364] Fix | Delete
'wpforms_admin',
[365] Fix | Delete
$strings
[366] Fix | Delete
);
[367] Fix | Delete
}
[368] Fix | Delete
add_action( 'admin_enqueue_scripts', 'wpforms_admin_scripts' );
[369] Fix | Delete
[370] Fix | Delete
/**
[371] Fix | Delete
* Add body class to WPForms admin pages for easy reference.
[372] Fix | Delete
*
[373] Fix | Delete
* @since 1.3.9
[374] Fix | Delete
*
[375] Fix | Delete
* @param string $classes CSS classes, space separated.
[376] Fix | Delete
*
[377] Fix | Delete
* @return string
[378] Fix | Delete
*/
[379] Fix | Delete
function wpforms_admin_body_class( $classes ) {
[380] Fix | Delete
[381] Fix | Delete
if ( ! wpforms_is_admin_page() ) {
[382] Fix | Delete
return $classes;
[383] Fix | Delete
}
[384] Fix | Delete
[385] Fix | Delete
return "$classes wpforms-admin-page";
[386] Fix | Delete
}
[387] Fix | Delete
add_filter( 'admin_body_class', 'wpforms_admin_body_class' );
[388] Fix | Delete
[389] Fix | Delete
/**
[390] Fix | Delete
* Output the WPForms admin header.
[391] Fix | Delete
*
[392] Fix | Delete
* @since 1.3.9
[393] Fix | Delete
*/
[394] Fix | Delete
function wpforms_admin_header() {
[395] Fix | Delete
[396] Fix | Delete
// Bail if we're not on a WPForms screen or page (also exclude form builder).
[397] Fix | Delete
if ( ! wpforms_is_admin_page() ) {
[398] Fix | Delete
return;
[399] Fix | Delete
}
[400] Fix | Delete
[401] Fix | Delete
/**
[402] Fix | Delete
* Prevent admin header outputting if needed.
[403] Fix | Delete
*
[404] Fix | Delete
* @since 1.5.7
[405] Fix | Delete
*
[406] Fix | Delete
* @param bool $is_admin_header_visible True if admin page header should be outputted.
[407] Fix | Delete
*/
[408] Fix | Delete
if ( ! apply_filters( 'wpforms_admin_header', true ) ) {
[409] Fix | Delete
return;
[410] Fix | Delete
}
[411] Fix | Delete
[412] Fix | Delete
// Omit header from the Welcome activation screen.
[413] Fix | Delete
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.InputNotValidated
[414] Fix | Delete
if ( sanitize_key( $_REQUEST['page'] ) === 'wpforms-getting-started' ) {
[415] Fix | Delete
return;
[416] Fix | Delete
}
[417] Fix | Delete
[418] Fix | Delete
$current_screen = get_current_screen();
[419] Fix | Delete
$show_screen_options = $current_screen && $current_screen->show_screen_options();
[420] Fix | Delete
[421] Fix | Delete
/**
[422] Fix | Delete
* Fire before the admin header is outputted.
[423] Fix | Delete
*
[424] Fix | Delete
* @since 1.5.7
[425] Fix | Delete
*/
[426] Fix | Delete
do_action( 'wpforms_admin_header_before' );
[427] Fix | Delete
?>
[428] Fix | Delete
<div id="wpforms-header-temp"></div>
[429] Fix | Delete
<div id="wpforms-header" class="wpforms-header <?php echo esc_attr( $show_screen_options ? 'wpforms-header-show-screen-options' : '' ); ?>">
[430] Fix | Delete
<img class="wpforms-header-logo" src="<?php echo esc_url( WPFORMS_PLUGIN_URL . 'assets/images/logo.png' ); ?>" alt="WPForms Logo">
[431] Fix | Delete
<?php
[432] Fix | Delete
$current_page = sanitize_text_field( wp_unslash( $_REQUEST['page'] ?? '' ) ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
[433] Fix | Delete
$current_page = str_replace( 'wpforms-', '', $current_page );
[434] Fix | Delete
[435] Fix | Delete
Links::render(
[436] Fix | Delete
[
[437] Fix | Delete
'docs' => [
[438] Fix | Delete
'medium' => 'header_links',
[439] Fix | Delete
'content' => $current_page . '_docs',
[440] Fix | Delete
],
[441] Fix | Delete
'support' => [
[442] Fix | Delete
'medium' => 'header_links',
[443] Fix | Delete
'content' => $current_page . '_support',
[444] Fix | Delete
],
[445] Fix | Delete
]
[446] Fix | Delete
);
[447] Fix | Delete
?>
[448] Fix | Delete
</div>
[449] Fix | Delete
<?php
[450] Fix | Delete
/**
[451] Fix | Delete
* Fire after the admin header is outputted.
[452] Fix | Delete
*
[453] Fix | Delete
* @since 1.5.7
[454] Fix | Delete
*/
[455] Fix | Delete
do_action( 'wpforms_admin_header_after' );
[456] Fix | Delete
}
[457] Fix | Delete
add_action( 'in_admin_header', 'wpforms_admin_header', 100 );
[458] Fix | Delete
[459] Fix | Delete
/**
[460] Fix | Delete
* Remove non-WPForms notices from WPForms pages.
[461] Fix | Delete
*
[462] Fix | Delete
* @since 1.3.9
[463] Fix | Delete
* @since 1.6.9 Added callback for removing on `admin_footer` hook.
[464] Fix | Delete
*/
[465] Fix | Delete
function wpforms_admin_hide_unrelated_notices() { // phpcs:ignore Generic.Metrics.CyclomaticComplexity.TooHigh, Generic.Metrics.NestingLevel.MaxExceeded
[466] Fix | Delete
[467] Fix | Delete
if ( ! wpforms_is_admin_page() ) {
[468] Fix | Delete
return;
[469] Fix | Delete
}
[470] Fix | Delete
[471] Fix | Delete
global $wp_filter;
[472] Fix | Delete
[473] Fix | Delete
// Define rules to remove callbacks.
[474] Fix | Delete
$rules = [
[475] Fix | Delete
'user_admin_notices' => [], // remove all callbacks.
[476] Fix | Delete
'admin_notices' => [],
[477] Fix | Delete
'all_admin_notices' => [],
[478] Fix | Delete
'admin_footer' => [
[479] Fix | Delete
'render_delayed_admin_notices', // remove this particular callback.
[480] Fix | Delete
],
[481] Fix | Delete
];
[482] Fix | Delete
[483] Fix | Delete
// Extra deny callbacks (will be removed for each hook tag defined in $rules).
[484] Fix | Delete
$common_deny_callbacks = [
[485] Fix | Delete
'wpformsdb_admin_notice', // 'Database for WPForms' plugin.
[486] Fix | Delete
];
[487] Fix | Delete
[488] Fix | Delete
$notice_types = array_keys( $rules );
[489] Fix | Delete
[490] Fix | Delete
foreach ( $notice_types as $notice_type ) {
[491] Fix | Delete
if ( empty( $wp_filter[ $notice_type ]->callbacks ) || ! is_array( $wp_filter[ $notice_type ]->callbacks ) ) {
[492] Fix | Delete
continue;
[493] Fix | Delete
}
[494] Fix | Delete
[495] Fix | Delete
$remove_all_filters = empty( $rules[ $notice_type ] );
[496] Fix | Delete
[497] Fix | Delete
foreach ( $wp_filter[ $notice_type ]->callbacks as $priority => $hooks ) {
[498] Fix | Delete
foreach ( $hooks as $name => $arr ) {
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function