Edit File by line
/home/zeestwma/richards.../wp-conte.../plugins/wpforms-.../src/Tasks/Actions
File: FormsLocatorScanTask.php
[500] Fix | Delete
return $locations;
[501] Fix | Delete
}
[502] Fix | Delete
[503] Fix | Delete
/**
[504] Fix | Delete
* Search in standalone forms.
[505] Fix | Delete
*
[506] Fix | Delete
* @since 1.8.7
[507] Fix | Delete
*
[508] Fix | Delete
* @return array
[509] Fix | Delete
*/
[510] Fix | Delete
private function search_in_standalone_forms(): array {
[511] Fix | Delete
[512] Fix | Delete
global $wpdb;
[513] Fix | Delete
[514] Fix | Delete
$location_types = [];
[515] Fix | Delete
[516] Fix | Delete
foreach ( Locator::STANDALONE_LOCATION_TYPES as $location_type ) {
[517] Fix | Delete
$location_types[] = '"' . $location_type . '_enable":"1"';
[518] Fix | Delete
}
[519] Fix | Delete
[520] Fix | Delete
$regexp = implode( '|', $location_types );
[521] Fix | Delete
[522] Fix | Delete
$post_statuses = wpforms_wpdb_prepare_in( $this->locator->get_post_statuses() );
[523] Fix | Delete
[524] Fix | Delete
// phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.InterpolatedNotPrepared
[525] Fix | Delete
$standalone_forms = $wpdb->get_results(
[526] Fix | Delete
"SELECT ID, post_content, post_status
[527] Fix | Delete
FROM $wpdb->posts
[528] Fix | Delete
WHERE post_status IN ( $post_statuses ) AND
[529] Fix | Delete
post_type = 'wpforms' AND
[530] Fix | Delete
post_content REGEXP '$regexp';"
[531] Fix | Delete
);
[532] Fix | Delete
// phpcs:enable WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.InterpolatedNotPrepared
[533] Fix | Delete
[534] Fix | Delete
$locations = [];
[535] Fix | Delete
[536] Fix | Delete
foreach ( $standalone_forms as $standalone_form ) {
[537] Fix | Delete
$form_data = json_decode( $standalone_form->post_content, true );
[538] Fix | Delete
[539] Fix | Delete
$locations[] = $this->locator->build_standalone_location(
[540] Fix | Delete
(int) $standalone_form->ID,
[541] Fix | Delete
$form_data,
[542] Fix | Delete
$standalone_form->post_status
[543] Fix | Delete
);
[544] Fix | Delete
}
[545] Fix | Delete
[546] Fix | Delete
return $locations;
[547] Fix | Delete
}
[548] Fix | Delete
[549] Fix | Delete
/**
[550] Fix | Delete
* Get form location metas.
[551] Fix | Delete
*
[552] Fix | Delete
* @param array $locations Locations.
[553] Fix | Delete
*
[554] Fix | Delete
* @since 1.7.4
[555] Fix | Delete
*
[556] Fix | Delete
* @return array
[557] Fix | Delete
*/
[558] Fix | Delete
private function get_form_location_metas( $locations ) {
[559] Fix | Delete
[560] Fix | Delete
$metas = [];
[561] Fix | Delete
[562] Fix | Delete
foreach ( $locations as $location ) {
[563] Fix | Delete
[564] Fix | Delete
if ( empty( $location['form_id'] ) ) {
[565] Fix | Delete
continue;
[566] Fix | Delete
}
[567] Fix | Delete
[568] Fix | Delete
$metas[ $location['form_id'] ][] = $location;
[569] Fix | Delete
}
[570] Fix | Delete
[571] Fix | Delete
return $metas;
[572] Fix | Delete
}
[573] Fix | Delete
}
[574] Fix | Delete
[575] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function