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/clone/wp-conte.../plugins/wpforms-.../src/Admin/Tools/Importer...
File: PirateForms.php
$wpforms_settings['recaptcha-secret-key'] = $pf_form['pirateformsopt_recaptcha_secretkey'];
[500] Fix | Delete
$wpforms_settings['recaptcha-type'] = 'v2';
[501] Fix | Delete
[502] Fix | Delete
update_option( 'wpforms_settings', $wpforms_settings );
[503] Fix | Delete
}
[504] Fix | Delete
}
[505] Fix | Delete
[506] Fix | Delete
if (
[507] Fix | Delete
( ! empty( $site_key ) && ! empty( $secret_key ) ) ||
[508] Fix | Delete
( ! empty( $wpforms_settings['recaptcha-site-key'] ) && ! empty( $wpforms_settings['recaptcha-secret-key'] ) )
[509] Fix | Delete
) {
[510] Fix | Delete
$form['settings']['recaptcha'] = '1';
[511] Fix | Delete
}
[512] Fix | Delete
}
[513] Fix | Delete
[514] Fix | Delete
$this->import_smtp( $pf_form_id, $form );
[515] Fix | Delete
[516] Fix | Delete
$this->add_form( $form, $unsupported, $upgrade_plain, $upgrade_omit );
[517] Fix | Delete
}
[518] Fix | Delete
[519] Fix | Delete
/**
[520] Fix | Delete
* Replace 3rd-party form provider tags/shortcodes with our own Smart Tags.
[521] Fix | Delete
* See: PirateForms_Util::get_magic_tags() for all PF tags.
[522] Fix | Delete
*
[523] Fix | Delete
* @since 1.6.6
[524] Fix | Delete
*
[525] Fix | Delete
* @param string $string String to process the smart tag in.
[526] Fix | Delete
* @param array $fields List of fields for the form.
[527] Fix | Delete
*
[528] Fix | Delete
* @return string
[529] Fix | Delete
*/
[530] Fix | Delete
public function get_smarttags( $string, $fields ) {
[531] Fix | Delete
[532] Fix | Delete
foreach ( self::$tags as $tag ) {
[533] Fix | Delete
$wpf_tag = '';
[534] Fix | Delete
[535] Fix | Delete
if ( $tag === '[email]' ) {
[536] Fix | Delete
foreach ( $fields as $field ) {
[537] Fix | Delete
if ( $field['type'] === 'email' ) {
[538] Fix | Delete
$wpf_tag = '{field_id="' . $field['id'] . '"}';
[539] Fix | Delete
[540] Fix | Delete
break;
[541] Fix | Delete
}
[542] Fix | Delete
}
[543] Fix | Delete
}
[544] Fix | Delete
[545] Fix | Delete
$string = str_replace( $tag, $wpf_tag, $string );
[546] Fix | Delete
}
[547] Fix | Delete
[548] Fix | Delete
return $string;
[549] Fix | Delete
}
[550] Fix | Delete
[551] Fix | Delete
/**
[552] Fix | Delete
* Import SMTP settings from Default form only.
[553] Fix | Delete
*
[554] Fix | Delete
* @since 1.6.6
[555] Fix | Delete
*
[556] Fix | Delete
* @param int $pf_form_id PirateForms form ID.
[557] Fix | Delete
* @param array $form WPForms form array.
[558] Fix | Delete
*/
[559] Fix | Delete
protected function import_smtp( $pf_form_id, $form ) {
[560] Fix | Delete
[561] Fix | Delete
// At this point we import only default form SMTP settings.
[562] Fix | Delete
if ( $pf_form_id !== 0 ) {
[563] Fix | Delete
return;
[564] Fix | Delete
}
[565] Fix | Delete
[566] Fix | Delete
$pf_form = $this->get_form( 0 );
[567] Fix | Delete
[568] Fix | Delete
// Use only if enabled.
[569] Fix | Delete
if ( empty( $pf_form['pirateformsopt_use_smtp'] ) || $pf_form['pirateformsopt_use_smtp'] !== 'yes' ) {
[570] Fix | Delete
return;
[571] Fix | Delete
}
[572] Fix | Delete
[573] Fix | Delete
// If user has WP Mail SMTP already activated - do nothing as it's most likely already configured.
[574] Fix | Delete
if ( is_plugin_active( self::SLUG_SMTP_PLUGIN ) ) {
[575] Fix | Delete
return;
[576] Fix | Delete
}
[577] Fix | Delete
[578] Fix | Delete
// Check that we successfully installed and activated the plugin.
[579] Fix | Delete
if ( ! $this->install_activate_smtp() ) {
[580] Fix | Delete
return;
[581] Fix | Delete
}
[582] Fix | Delete
[583] Fix | Delete
/*
[584] Fix | Delete
* Finally, start the settings importing.
[585] Fix | Delete
*/
[586] Fix | Delete
// WP Mail SMTP 1.x and PHP 5.3+ are allowed. Older WPMS versions are ignored.
[587] Fix | Delete
if ( ! function_exists( 'wp_mail_smtp' ) ) {
[588] Fix | Delete
return;
[589] Fix | Delete
}
[590] Fix | Delete
[591] Fix | Delete
// TODO: change to \WPMailSMTP\Options in future.
[592] Fix | Delete
$options = get_option( 'wp_mail_smtp', [] );
[593] Fix | Delete
[594] Fix | Delete
$options['mail']['from_email'] = $this->get_smarttags( $pf_form['pirateformsopt_email'], $form['fields'] );
[595] Fix | Delete
$options['mail']['mailer'] = 'smtp';
[596] Fix | Delete
$options['smtp']['host'] = $pf_form['pirateformsopt_smtp_host'];
[597] Fix | Delete
$options['smtp']['port'] = $pf_form['pirateformsopt_smtp_port'];
[598] Fix | Delete
$options['smtp']['encryption'] = empty( $pf_form['pirateformsopt_use_secure'] ) ? 'none' : $pf_form['pirateformsopt_use_secure'];
[599] Fix | Delete
$options['smtp']['auth'] = ! empty( $pf_form['pirateformsopt_use_smtp_authentication'] ) && $pf_form['pirateformsopt_use_smtp_authentication'] === 'yes';
[600] Fix | Delete
$options['smtp']['user'] = $pf_form['pirateformsopt_smtp_username'];
[601] Fix | Delete
$options['smtp']['pass'] = $pf_form['pirateformsopt_smtp_password'];
[602] Fix | Delete
[603] Fix | Delete
update_option( 'wp_mail_smtp', $options );
[604] Fix | Delete
}
[605] Fix | Delete
[606] Fix | Delete
/**
[607] Fix | Delete
* Do all the voodoo to install and activate the WP Mail SMTP plugin behind the scene.
[608] Fix | Delete
* No user interaction is needed.
[609] Fix | Delete
*
[610] Fix | Delete
* @since 1.6.6
[611] Fix | Delete
*
[612] Fix | Delete
* @return bool
[613] Fix | Delete
*/
[614] Fix | Delete
protected function install_activate_smtp() {
[615] Fix | Delete
/*
[616] Fix | Delete
* Check installation.
[617] Fix | Delete
* If installed but not activated - bail.
[618] Fix | Delete
* We don't want to break current site email deliverability.
[619] Fix | Delete
*/
[620] Fix | Delete
[621] Fix | Delete
if ( ! function_exists( 'get_plugins' ) ) {
[622] Fix | Delete
require_once ABSPATH . 'wp-admin/includes/plugin.php';
[623] Fix | Delete
}
[624] Fix | Delete
[625] Fix | Delete
// FALSE will bail the import.
[626] Fix | Delete
if ( array_key_exists( self::SLUG_SMTP_PLUGIN, get_plugins() ) ) {
[627] Fix | Delete
return false;
[628] Fix | Delete
}
[629] Fix | Delete
[630] Fix | Delete
/*
[631] Fix | Delete
* Let's try to install.
[632] Fix | Delete
*/
[633] Fix | Delete
$url = add_query_arg(
[634] Fix | Delete
[
[635] Fix | Delete
'provider' => $this->slug,
[636] Fix | Delete
'page' => 'wpforms-tools',
[637] Fix | Delete
'view' => 'importer',
[638] Fix | Delete
],
[639] Fix | Delete
admin_url( 'admin.php' )
[640] Fix | Delete
);
[641] Fix | Delete
[642] Fix | Delete
$creds = request_filesystem_credentials( esc_url_raw( $url ), '', false, false, null );
[643] Fix | Delete
[644] Fix | Delete
// Check for file system permissions.
[645] Fix | Delete
if ( $creds === false ) {
[646] Fix | Delete
return false;
[647] Fix | Delete
}
[648] Fix | Delete
[649] Fix | Delete
if ( ! WP_Filesystem( $creds ) ) {
[650] Fix | Delete
return false;
[651] Fix | Delete
}
[652] Fix | Delete
[653] Fix | Delete
// Do not allow WordPress to search/download translations, as this will break JS output.
[654] Fix | Delete
remove_action( 'upgrader_process_complete', [ 'Language_Pack_Upgrader', 'async_upgrade' ], 20 );
[655] Fix | Delete
[656] Fix | Delete
// Create the plugin upgrader with our custom skin.
[657] Fix | Delete
$installer = new PluginSilentUpgrader( new PluginSilentUpgraderSkin() );
[658] Fix | Delete
[659] Fix | Delete
// Error check.
[660] Fix | Delete
if ( ! method_exists( $installer, 'install' ) ) {
[661] Fix | Delete
return false;
[662] Fix | Delete
}
[663] Fix | Delete
[664] Fix | Delete
$installer->install( self::URL_SMTP_ZIP );
[665] Fix | Delete
[666] Fix | Delete
// Flush the cache and return the newly installed plugin basename.
[667] Fix | Delete
wp_cache_flush();
[668] Fix | Delete
[669] Fix | Delete
if ( $installer->plugin_info() ) {
[670] Fix | Delete
$plugin_basename = $installer->plugin_info();
[671] Fix | Delete
[672] Fix | Delete
// Activate, do not redirect, run the plugin activation routine.
[673] Fix | Delete
$activated = activate_plugin( $plugin_basename );
[674] Fix | Delete
[675] Fix | Delete
if ( ! is_wp_error( $activated ) ) {
[676] Fix | Delete
return true;
[677] Fix | Delete
}
[678] Fix | Delete
}
[679] Fix | Delete
[680] Fix | Delete
return false;
[681] Fix | Delete
}
[682] Fix | Delete
}
[683] Fix | Delete
[684] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function