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
File: ajax-actions.php
);
[500] Fix | Delete
$total = wp_count_posts( $source );
[501] Fix | Delete
$total = $total->publish;
[502] Fix | Delete
$pt = get_post_type_object( $source );
[503] Fix | Delete
$source_name = '';
[504] Fix | Delete
[505] Fix | Delete
if ( $pt !== null ) {
[506] Fix | Delete
$source_name = $pt->labels->name;
[507] Fix | Delete
}
[508] Fix | Delete
[509] Fix | Delete
foreach ( $posts as $post ) {
[510] Fix | Delete
$items[] = esc_html( wpforms_get_post_title( $post ) );
[511] Fix | Delete
}
[512] Fix | Delete
} elseif ( $type === 'taxonomy' ) {
[513] Fix | Delete
[514] Fix | Delete
$type_name = esc_html__( 'taxonomy', 'wpforms-lite' );
[515] Fix | Delete
$args = [
[516] Fix | Delete
'taxonomy' => $source,
[517] Fix | Delete
'hide_empty' => false,
[518] Fix | Delete
'number' => 20,
[519] Fix | Delete
];
[520] Fix | Delete
$terms = wpforms_get_hierarchical_object(
[521] Fix | Delete
apply_filters(
[522] Fix | Delete
'wpforms_dynamic_choice_taxonomy_args',
[523] Fix | Delete
$args,
[524] Fix | Delete
[
[525] Fix | Delete
'id' => $id,
[526] Fix | Delete
],
[527] Fix | Delete
$form_id
[528] Fix | Delete
),
[529] Fix | Delete
true
[530] Fix | Delete
);
[531] Fix | Delete
$total = wp_count_terms( $source );
[532] Fix | Delete
$tax = get_taxonomy( $source );
[533] Fix | Delete
$source_name = $tax->labels->name;
[534] Fix | Delete
[535] Fix | Delete
foreach ( $terms as $term ) {
[536] Fix | Delete
$items[] = esc_html( wpforms_get_term_name( $term ) );
[537] Fix | Delete
}
[538] Fix | Delete
}
[539] Fix | Delete
[540] Fix | Delete
if ( empty( $items ) ) {
[541] Fix | Delete
$items = [];
[542] Fix | Delete
}
[543] Fix | Delete
[544] Fix | Delete
wp_send_json_success(
[545] Fix | Delete
[
[546] Fix | Delete
'items' => $items,
[547] Fix | Delete
'source' => $source,
[548] Fix | Delete
'source_name' => $source_name,
[549] Fix | Delete
'total' => $total,
[550] Fix | Delete
'type' => $type,
[551] Fix | Delete
'type_name' => $type_name,
[552] Fix | Delete
]
[553] Fix | Delete
);
[554] Fix | Delete
}
[555] Fix | Delete
[556] Fix | Delete
add_action( 'wp_ajax_wpforms_builder_dynamic_source', 'wpforms_builder_dynamic_source' );
[557] Fix | Delete
[558] Fix | Delete
/**
[559] Fix | Delete
* Perform test connection to verify that the current web host can successfully
[560] Fix | Delete
* make outbound SSL connections.
[561] Fix | Delete
*
[562] Fix | Delete
* @since 1.4.5
[563] Fix | Delete
*/
[564] Fix | Delete
function wpforms_verify_ssl() {
[565] Fix | Delete
[566] Fix | Delete
// Run a security check.
[567] Fix | Delete
check_ajax_referer( 'wpforms-admin', 'nonce' );
[568] Fix | Delete
[569] Fix | Delete
// Check for permissions.
[570] Fix | Delete
if ( ! wpforms_current_user_can() ) {
[571] Fix | Delete
wp_send_json_error(
[572] Fix | Delete
[
[573] Fix | Delete
'msg' => esc_html__( 'You do not have permission to perform this operation.', 'wpforms-lite' ),
[574] Fix | Delete
]
[575] Fix | Delete
);
[576] Fix | Delete
}
[577] Fix | Delete
[578] Fix | Delete
$response = wp_remote_post( 'https://wpforms.com/connection-test.php' );
[579] Fix | Delete
[580] Fix | Delete
if ( 200 === wp_remote_retrieve_response_code( $response ) ) {
[581] Fix | Delete
wp_send_json_success(
[582] Fix | Delete
[
[583] Fix | Delete
'msg' => esc_html__( 'Success! Your server can make SSL connections.', 'wpforms-lite' ),
[584] Fix | Delete
]
[585] Fix | Delete
);
[586] Fix | Delete
}
[587] Fix | Delete
[588] Fix | Delete
wp_send_json_error(
[589] Fix | Delete
[
[590] Fix | Delete
'msg' => esc_html__( 'There was an error and the connection failed. Please contact your web host with the technical details below.', 'wpforms-lite' ),
[591] Fix | Delete
'debug' => '<pre>' . print_r( map_deep( $response, 'wp_strip_all_tags' ), true ) . '</pre>',
[592] Fix | Delete
]
[593] Fix | Delete
);
[594] Fix | Delete
}
[595] Fix | Delete
add_action( 'wp_ajax_wpforms_verify_ssl', 'wpforms_verify_ssl' );
[596] Fix | Delete
[597] Fix | Delete
/**
[598] Fix | Delete
* Deactivate addon.
[599] Fix | Delete
*
[600] Fix | Delete
* @since 1.0.0
[601] Fix | Delete
* @since 1.6.2.3 Updated the permissions checking.
[602] Fix | Delete
*/
[603] Fix | Delete
function wpforms_deactivate_addon() {
[604] Fix | Delete
[605] Fix | Delete
// Run a security check.
[606] Fix | Delete
check_ajax_referer( 'wpforms-admin', 'nonce' );
[607] Fix | Delete
[608] Fix | Delete
// Check for permissions.
[609] Fix | Delete
if ( ! current_user_can( 'deactivate_plugins' ) ) {
[610] Fix | Delete
wp_send_json_error( esc_html__( 'Plugin deactivation is disabled for you on this site.', 'wpforms-lite' ) );
[611] Fix | Delete
}
[612] Fix | Delete
[613] Fix | Delete
$type = empty( $_POST['type'] ) ? 'addon' : sanitize_key( $_POST['type'] );
[614] Fix | Delete
[615] Fix | Delete
if ( isset( $_POST['plugin'] ) ) {
[616] Fix | Delete
$plugin = sanitize_text_field( wp_unslash( $_POST['plugin'] ) );
[617] Fix | Delete
[618] Fix | Delete
deactivate_plugins( $plugin );
[619] Fix | Delete
[620] Fix | Delete
do_action( 'wpforms_plugin_deactivated', $plugin );
[621] Fix | Delete
[622] Fix | Delete
if ( $type === 'plugin' ) {
[623] Fix | Delete
wp_send_json_success( esc_html__( 'Plugin deactivated.', 'wpforms-lite' ) );
[624] Fix | Delete
} else {
[625] Fix | Delete
wp_send_json_success( esc_html__( 'Addon deactivated.', 'wpforms-lite' ) );
[626] Fix | Delete
}
[627] Fix | Delete
}
[628] Fix | Delete
[629] Fix | Delete
wp_send_json_error( esc_html__( 'Could not deactivate the addon. Please deactivate from the Plugins page.', 'wpforms-lite' ) );
[630] Fix | Delete
}
[631] Fix | Delete
add_action( 'wp_ajax_wpforms_deactivate_addon', 'wpforms_deactivate_addon' );
[632] Fix | Delete
[633] Fix | Delete
/**
[634] Fix | Delete
* Activate addon.
[635] Fix | Delete
*
[636] Fix | Delete
* @since 1.0.0
[637] Fix | Delete
* @since 1.6.2.3 Updated the permissions checking.
[638] Fix | Delete
*/
[639] Fix | Delete
function wpforms_activate_addon() {
[640] Fix | Delete
[641] Fix | Delete
// Run a security check.
[642] Fix | Delete
check_ajax_referer( 'wpforms-admin', 'nonce' );
[643] Fix | Delete
[644] Fix | Delete
// Check for permissions.
[645] Fix | Delete
if ( ! current_user_can( 'activate_plugins' ) ) {
[646] Fix | Delete
wp_send_json_error( esc_html__( 'Plugin activation is disabled for you on this site.', 'wpforms-lite' ) );
[647] Fix | Delete
}
[648] Fix | Delete
[649] Fix | Delete
$success_messages = [
[650] Fix | Delete
'plugin' => __( 'Plugin activated.', 'wpforms-lite' ),
[651] Fix | Delete
'addon' => __( 'Addon activated.', 'wpforms-lite' ),
[652] Fix | Delete
];
[653] Fix | Delete
$error_messages = [
[654] Fix | Delete
'plugin' => __( 'Could not activate the plugin. Please activate it on the Plugins page.', 'wpforms-lite' ),
[655] Fix | Delete
'addon' => __( 'Could not activate the addon. Please activate it on the Plugins page.', 'wpforms-lite' ),
[656] Fix | Delete
];
[657] Fix | Delete
[658] Fix | Delete
$type = ! empty( $_POST['type'] ) ? sanitize_key( $_POST['type'] ) : 'addon';
[659] Fix | Delete
$success_message = $success_messages[ $type ];
[660] Fix | Delete
$error_message = $error_messages[ $type ];
[661] Fix | Delete
[662] Fix | Delete
if ( isset( $_POST['plugin'] ) ) {
[663] Fix | Delete
$plugin = sanitize_text_field( wp_unslash( $_POST['plugin'] ) );
[664] Fix | Delete
$activate = wpforms_activate_plugin( $plugin );
[665] Fix | Delete
[666] Fix | Delete
/**
[667] Fix | Delete
* Fire after plugin activating via the WPForms installer.
[668] Fix | Delete
*
[669] Fix | Delete
* @since 1.6.3.1
[670] Fix | Delete
*
[671] Fix | Delete
* @param string $plugin Path to the plugin file relative to the plugins' directory.
[672] Fix | Delete
*/
[673] Fix | Delete
do_action( 'wpforms_plugin_activated', $plugin );
[674] Fix | Delete
[675] Fix | Delete
if ( $activate === null ) {
[676] Fix | Delete
wp_send_json_success( wp_kses_post( $success_message ) );
[677] Fix | Delete
}
[678] Fix | Delete
[679] Fix | Delete
$error_message = $activate->get_error_message();
[680] Fix | Delete
}
[681] Fix | Delete
[682] Fix | Delete
wp_send_json_error( wp_kses_post( $error_message ) );
[683] Fix | Delete
}
[684] Fix | Delete
[685] Fix | Delete
add_action( 'wp_ajax_wpforms_activate_addon', 'wpforms_activate_addon' );
[686] Fix | Delete
[687] Fix | Delete
/**
[688] Fix | Delete
* Install addon.
[689] Fix | Delete
*
[690] Fix | Delete
* @since 1.0.0
[691] Fix | Delete
* @since 1.6.2.3 Updated the permissions checking.
[692] Fix | Delete
*/
[693] Fix | Delete
function wpforms_install_addon() {
[694] Fix | Delete
[695] Fix | Delete
// Run a security check.
[696] Fix | Delete
check_ajax_referer( 'wpforms-admin', 'nonce' );
[697] Fix | Delete
[698] Fix | Delete
$generic_error = esc_html__( 'There was an error while performing your request.', 'wpforms-lite' );
[699] Fix | Delete
$type = ! empty( $_POST['type'] ) ? sanitize_key( $_POST['type'] ) : 'addon';
[700] Fix | Delete
[701] Fix | Delete
// Check if new installations are allowed.
[702] Fix | Delete
if ( ! wpforms_can_install( $type ) ) {
[703] Fix | Delete
wp_send_json_error( $generic_error );
[704] Fix | Delete
}
[705] Fix | Delete
[706] Fix | Delete
$error = $type === 'plugin'
[707] Fix | Delete
? esc_html__( 'Could not install the plugin. Please download and install it manually.', 'wpforms-lite' )
[708] Fix | Delete
: sprintf(
[709] Fix | Delete
wp_kses( /* translators: %1$s - addon download URL, %2$s - link to manual installation guide, %3$s - link to contact support. */
[710] 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' ),
[711] Fix | Delete
[
[712] Fix | Delete
'a' => [
[713] Fix | Delete
'href' => true,
[714] Fix | Delete
'target' => true,
[715] Fix | Delete
'rel' => true,
[716] Fix | Delete
],
[717] Fix | Delete
]
[718] Fix | Delete
),
[719] Fix | Delete
esc_url( wpforms_utm_link( 'https://wpforms.com/account/licenses/', 'Licenses', 'Addons Error' ) ),
[720] Fix | Delete
esc_url( wpforms_utm_link( 'https://wpforms.com/docs/how-to-manually-install-addons-in-wpforms/', 'Addons Doc', 'Addons Error' ) ),
[721] Fix | Delete
esc_url( wpforms_utm_link( 'https://wpforms.com/contact/', 'Contact', 'Addons Error' ) )
[722] Fix | Delete
);
[723] Fix | Delete
[724] Fix | Delete
$plugin_url = ! empty( $_POST['plugin'] ) ? esc_url_raw( wp_unslash( $_POST['plugin'] ) ) : '';
[725] Fix | Delete
[726] Fix | Delete
if ( empty( $plugin_url ) ) {
[727] Fix | Delete
wp_send_json_error( $error );
[728] Fix | Delete
}
[729] Fix | Delete
[730] Fix | Delete
$args_str = ! empty( $_POST['args'] ) ? sanitize_text_field( wp_unslash( $_POST['args'] ) ) : '';
[731] Fix | Delete
$args = json_decode( $args_str, true ) ?? [];
[732] Fix | Delete
[733] Fix | Delete
// Set the current screen to avoid undefined notices.
[734] Fix | Delete
set_current_screen( 'wpforms_page_wpforms-settings' );
[735] Fix | Delete
[736] Fix | Delete
// Prepare variables.
[737] Fix | Delete
$url = esc_url_raw(
[738] Fix | Delete
add_query_arg(
[739] Fix | Delete
[
[740] Fix | Delete
'page' => 'wpforms-addons',
[741] Fix | Delete
],
[742] Fix | Delete
admin_url( 'admin.php' )
[743] Fix | Delete
)
[744] Fix | Delete
);
[745] Fix | Delete
[746] Fix | Delete
ob_start();
[747] Fix | Delete
$creds = request_filesystem_credentials( $url, '', false, false, null );
[748] Fix | Delete
[749] Fix | Delete
// Hide the filesystem credentials form.
[750] Fix | Delete
ob_end_clean();
[751] Fix | Delete
[752] Fix | Delete
// Check for file system permissions.
[753] Fix | Delete
if ( $creds === false ) {
[754] Fix | Delete
wp_send_json_error( $error );
[755] Fix | Delete
}
[756] Fix | Delete
[757] Fix | Delete
if ( ! WP_Filesystem( $creds ) ) {
[758] Fix | Delete
wp_send_json_error( $error );
[759] Fix | Delete
}
[760] Fix | Delete
[761] Fix | Delete
/*
[762] Fix | Delete
* We do not need any extra credentials if we have gotten this far, so let's install the plugin.
[763] Fix | Delete
*/
[764] Fix | Delete
[765] Fix | Delete
require_once WPFORMS_PLUGIN_DIR . 'includes/admin/class-install-skin.php';
[766] Fix | Delete
[767] Fix | Delete
// Do not allow WordPress to search/download translations, as this will break JS output.
[768] Fix | Delete
remove_action( 'upgrader_process_complete', [ 'Language_Pack_Upgrader', 'async_upgrade' ], 20 );
[769] Fix | Delete
[770] Fix | Delete
// Create the plugin upgrader with our custom skin.
[771] Fix | Delete
$installer = new WPForms\Helpers\PluginSilentUpgrader( new WPForms_Install_Skin() );
[772] Fix | Delete
[773] Fix | Delete
// Error check.
[774] Fix | Delete
if ( ! method_exists( $installer, 'install' ) ) {
[775] Fix | Delete
wp_send_json_error( $error );
[776] Fix | Delete
}
[777] Fix | Delete
[778] Fix | Delete
$installer->install( $plugin_url, $args );
[779] Fix | Delete
[780] Fix | Delete
// Flush the cache and return the newly installed plugin basename.
[781] Fix | Delete
wp_cache_flush();
[782] Fix | Delete
[783] Fix | Delete
$plugin_basename = $installer->plugin_info();
[784] Fix | Delete
[785] Fix | Delete
if ( empty( $plugin_basename ) ) {
[786] Fix | Delete
wp_send_json_error( $error );
[787] Fix | Delete
}
[788] Fix | Delete
[789] Fix | Delete
$result = [
[790] Fix | Delete
'msg' => $generic_error,
[791] Fix | Delete
'is_activated' => false,
[792] Fix | Delete
'basename' => $plugin_basename,
[793] Fix | Delete
];
[794] Fix | Delete
[795] Fix | Delete
// Check for permissions.
[796] Fix | Delete
if ( ! current_user_can( 'activate_plugins' ) ) {
[797] Fix | Delete
$result['msg'] = $type === 'plugin' ? esc_html__( 'Plugin installed.', 'wpforms-lite' ) : esc_html__( 'Addon installed.', 'wpforms-lite' );
[798] Fix | Delete
[799] Fix | Delete
wp_send_json_success( $result );
[800] Fix | Delete
}
[801] Fix | Delete
[802] Fix | Delete
// Activate the plugin silently.
[803] Fix | Delete
$activated = activate_plugin( $plugin_basename );
[804] Fix | Delete
[805] Fix | Delete
if ( ! is_wp_error( $activated ) ) {
[806] Fix | Delete
[807] Fix | Delete
/**
[808] Fix | Delete
* Fire after plugin activating via the WPForms installer.
[809] Fix | Delete
*
[810] Fix | Delete
* @since 1.7.0
[811] Fix | Delete
*
[812] Fix | Delete
* @param string $plugin_basename Path to the plugin file relative to the plugins directory.
[813] Fix | Delete
*/
[814] Fix | Delete
do_action( 'wpforms_plugin_activated', $plugin_basename );
[815] Fix | Delete
[816] Fix | Delete
$result['is_activated'] = true;
[817] Fix | Delete
$result['msg'] = $type === 'plugin' ? esc_html__( 'Plugin installed & activated.', 'wpforms-lite' ) : esc_html__( 'Addon installed & activated.', 'wpforms-lite' );
[818] Fix | Delete
[819] Fix | Delete
wp_send_json_success( $result );
[820] Fix | Delete
}
[821] Fix | Delete
[822] Fix | Delete
// Fallback error just in case.
[823] Fix | Delete
wp_send_json_error( $result );
[824] Fix | Delete
}
[825] Fix | Delete
add_action( 'wp_ajax_wpforms_install_addon', 'wpforms_install_addon' );
[826] Fix | Delete
[827] Fix | Delete
/**
[828] Fix | Delete
* Search pages for dropdown.
[829] Fix | Delete
*
[830] Fix | Delete
* @since 1.7.9
[831] Fix | Delete
*/
[832] Fix | Delete
function wpforms_ajax_search_pages_for_dropdown() {
[833] Fix | Delete
[834] Fix | Delete
// Run a security check.
[835] Fix | Delete
if ( ! check_ajax_referer( 'wpforms-builder', 'nonce', false ) ) {
[836] Fix | Delete
wp_send_json_error( esc_html__( 'Your session expired. Please reload the builder.', 'wpforms-lite' ) );
[837] Fix | Delete
}
[838] Fix | Delete
[839] Fix | Delete
if ( ! array_key_exists( 'search', $_GET ) ) {
[840] Fix | Delete
wp_send_json_error( esc_html__( 'Incorrect usage of this operation.', 'wpforms-lite' ) );
[841] Fix | Delete
}
[842] Fix | Delete
[843] Fix | Delete
$result_pages = wpforms_search_pages_for_dropdown(
[844] Fix | Delete
sanitize_text_field( wp_unslash( $_GET['search'] ) )
[845] Fix | Delete
);
[846] Fix | Delete
[847] Fix | Delete
if ( empty( $result_pages ) ) {
[848] Fix | Delete
wp_send_json_success( [] );
[849] Fix | Delete
}
[850] Fix | Delete
[851] Fix | Delete
wp_send_json_success( $result_pages );
[852] Fix | Delete
}
[853] Fix | Delete
add_action( 'wp_ajax_wpforms_ajax_search_pages_for_dropdown', 'wpforms_ajax_search_pages_for_dropdown' );
[854] Fix | Delete
[855] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function