Edit File by line
/home/zeestwma/ceyloniy.../wp-conte.../plugins/wpforms-.../src/Admin/Addons
File: Addons.php
[500] Fix | Delete
// We need the cleared name of the addon, without the 'addon' suffix, for further use.
[501] Fix | Delete
$addon['name'] = preg_replace( '/ addon$/i', '', $addon['title'] );
[502] Fix | Delete
[503] Fix | Delete
$addon['modal_name'] = sprintf( /* translators: %s - addon name. */
[504] Fix | Delete
esc_html__( '%s addon', 'wpforms-lite' ),
[505] Fix | Delete
$addon['name']
[506] Fix | Delete
);
[507] Fix | Delete
$addon['clear_slug'] = str_replace( 'wpforms-', '', $addon['slug'] );
[508] Fix | Delete
$addon['utm_content'] = ucwords( str_replace( '-', ' ', $addon['clear_slug'] ) );
[509] Fix | Delete
$addon['license'] = $this->default_data( $addon, 'license', [] );
[510] Fix | Delete
$addon['license_level'] = $this->get_license_level( $addon );
[511] Fix | Delete
$addon['icon'] = $this->default_data( $addon, 'icon', '' );
[512] Fix | Delete
$addon['path'] = sprintf( '%1$s/%1$s.php', $addon['slug'] );
[513] Fix | Delete
$addon['video'] = $this->default_data( $addon, 'video', '' );
[514] Fix | Delete
$addon['plugin_allow'] = $this->has_access( $addon );
[515] Fix | Delete
$addon['status'] = 'missing';
[516] Fix | Delete
$addon['action'] = 'upgrade';
[517] Fix | Delete
$addon['page_url'] = $this->default_data( $addon, 'url', '' );
[518] Fix | Delete
$addon['doc_url'] = $this->default_data( $addon, 'doc', '' );
[519] Fix | Delete
$addon['url'] = '';
[520] Fix | Delete
[521] Fix | Delete
static $nonce = '';
[522] Fix | Delete
$nonce = empty( $nonce ) ? wp_create_nonce( 'wpforms-admin' ) : $nonce;
[523] Fix | Delete
$addon['nonce'] = $nonce;
[524] Fix | Delete
[525] Fix | Delete
return $addon;
[526] Fix | Delete
}
[527] Fix | Delete
[528] Fix | Delete
/**
[529] Fix | Delete
* Get default data.
[530] Fix | Delete
*
[531] Fix | Delete
* @since 1.8.2
[532] Fix | Delete
*
[533] Fix | Delete
* @param array|mixed $addon Addon data.
[534] Fix | Delete
* @param string $key Key.
[535] Fix | Delete
* @param mixed $default_data Default data.
[536] Fix | Delete
*
[537] Fix | Delete
* @return array|string|mixed
[538] Fix | Delete
*/
[539] Fix | Delete
private function default_data( $addon, string $key, $default_data ) {
[540] Fix | Delete
[541] Fix | Delete
if ( is_string( $default_data ) ) {
[542] Fix | Delete
return ! empty( $addon[ $key ] ) ? $addon[ $key ] : $default_data;
[543] Fix | Delete
}
[544] Fix | Delete
[545] Fix | Delete
if ( is_array( $default_data ) ) {
[546] Fix | Delete
return ! empty( $addon[ $key ] ) ? (array) $addon[ $key ] : $default_data;
[547] Fix | Delete
}
[548] Fix | Delete
[549] Fix | Delete
return $addon[ $key ] ?? '';
[550] Fix | Delete
}
[551] Fix | Delete
[552] Fix | Delete
/**
[553] Fix | Delete
* Populate addons data.
[554] Fix | Delete
*
[555] Fix | Delete
* @since 1.9.2
[556] Fix | Delete
*
[557] Fix | Delete
* @return void
[558] Fix | Delete
*/
[559] Fix | Delete
private function populate_addons_data() {
[560] Fix | Delete
[561] Fix | Delete
foreach ( $this->addons as $addon ) {
[562] Fix | Delete
$this->addons_text_domains[] = $addon['slug'];
[563] Fix | Delete
$this->addons_titles[] = 'WPForms ' . str_replace( ' Addon', '', $addon['title'] );
[564] Fix | Delete
}
[565] Fix | Delete
}
[566] Fix | Delete
[567] Fix | Delete
/**
[568] Fix | Delete
* Filter Gettext.
[569] Fix | Delete
*
[570] Fix | Delete
* This filter allows us to prevent empty translations from being returned
[571] Fix | Delete
* on the `plugins` page for addon name and description.
[572] Fix | Delete
*
[573] Fix | Delete
* @since 1.9.2
[574] Fix | Delete
*
[575] Fix | Delete
* @param string|mixed $translation Translated text.
[576] Fix | Delete
* @param string|mixed $text Text to translate.
[577] Fix | Delete
* @param string|mixed $domain Text domain.
[578] Fix | Delete
*
[579] Fix | Delete
* @return string Translated text.
[580] Fix | Delete
*/
[581] Fix | Delete
public function filter_gettext( $translation, $text, $domain ): string {
[582] Fix | Delete
[583] Fix | Delete
$translation = (string) $translation;
[584] Fix | Delete
$text = (string) $text;
[585] Fix | Delete
$domain = (string) $domain;
[586] Fix | Delete
[587] Fix | Delete
if ( ! in_array( $domain, $this->addons_text_domains, true ) ) {
[588] Fix | Delete
return $translation;
[589] Fix | Delete
}
[590] Fix | Delete
[591] Fix | Delete
// Prevent empty translations from being returned and don't translate addon names.
[592] Fix | Delete
if ( ! trim( $translation ) || in_array( $text, $this->addons_titles, true ) ) {
[593] Fix | Delete
$translation = $text;
[594] Fix | Delete
}
[595] Fix | Delete
[596] Fix | Delete
return $translation;
[597] Fix | Delete
}
[598] Fix | Delete
}
[599] Fix | Delete
[600] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function