| @@ -1,7 +1,8 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | defined('ABSPATH') or die("You can't access this file directly."); |
| 3 | 3 | |
| 4 | +// phpcs:disable WordPress.WP.AlternativeFunctions.curl_curl_init, WordPress.WP.AlternativeFunctions.curl_curl_setopt, WordPress.WP.AlternativeFunctions.curl_curl_exec, WordPress.WP.AlternativeFunctions.curl_curl_errno, WordPress.WP.AlternativeFunctions.curl_curl_error, WordPress.WP.AlternativeFunctions.curl_curl_close -- Legacy OpenAI HTTP calls in this module. | |
| 4 | 5 | |
| 5 | 6 | add_filter('qc_wpbotpro_floating_openai_filter_for_style', 'qc_wpbotpro_floating_help_openai_filter_for_style', 10, 2); |
| 6 | 7 | if ( ! function_exists( 'qc_wpbotpro_floating_help_openai_filter_for_style' ) ) { |
| 7 | 8 | function qc_wpbotpro_floating_help_openai_filter_for_style($qcld_writing_style, $qcld_language){ |
| @@ -5673,11 +5674,16 @@ | ||
| 5673 | 5674 | $uploaddir = wp_upload_dir(); |
| 5674 | 5675 | $target_file_name = $uploaddir['path'] . '/' . $filename; |
| 5675 | 5676 | |
| 5676 | 5677 | $contents = file_get_contents( $imgresult ); |
| 5677 | - $savefile = fopen($target_file_name, 'w'); | |
| 5678 | - fwrite($savefile, $contents); | |
| 5679 | - fclose($savefile); | |
| 5678 | + global $wp_filesystem; | |
| 5679 | + if ( empty( $wp_filesystem ) ) { | |
| 5680 | + require_once ABSPATH . 'wp-admin/includes/file.php'; | |
| 5681 | + WP_Filesystem(); | |
| 5682 | + } | |
| 5683 | + if ( $wp_filesystem ) { | |
| 5684 | + $wp_filesystem->put_contents( $target_file_name, $contents, FS_CHMOD_FILE ); | |
| 5685 | + } | |
| 5680 | 5686 | |
| 5681 | 5687 | /* add the image title */ |
| 5682 | 5688 | $image_title = ucwords( $uniq_name ); |
| 5683 | 5689 | |
| @@ -5723,5 +5729,6 @@ | ||
| 5723 | 5729 | |
| 5724 | 5730 | return $imgresult; |
| 5725 | 5731 | |
| 5726 | 5732 | } |
| 5733 | +// phpcs:enable WordPress.WP.AlternativeFunctions.curl_curl_init, WordPress.WP.AlternativeFunctions.curl_curl_setopt, WordPress.WP.AlternativeFunctions.curl_curl_exec, WordPress.WP.AlternativeFunctions.curl_curl_errno, WordPress.WP.AlternativeFunctions.curl_curl_error, WordPress.WP.AlternativeFunctions.curl_curl_close | |
| 5727 | 5734 | } |