connect = new Connect_DB(); } // ****************************** CACHE ********************************// /** * * SAVE CACHE FILE * * @param string $html_conteudo html content to cache * * @return */ // ***********************************************************************// public function cache_file( $html_conteudo, $path_file ) { file_put_contents( $path_file, ''.$html_conteudo ); } // ********************* DOWNLOAD IMAGES LOCALY ************************// /** * * DOWNLOAD IMAGES TO LOCAL SERVER * * @param string $image_url | string $file_name * * @return string "Image path url" */ // ***********************************************************************// public function download_and_get_path_image($image_url, $file_name) { $image_temp_file = WP_CONTENT_DIR.'/cache/'; $get_image_file = WP_CONTENT_URL.'/cache/'; $image = wp_remote_retrieve_body( wp_remote_get($image_url) ); file_put_contents( $image_temp_file.$file_name, $image ); return $get_image_file.$file_name; } // **************************** BUILD STRUCTURE **************************// /** * * RETURN THE PLUGIN HTML STRUCTURE * * @param boolean $premium_user false if check if user is premium * * @return string */ // ***********************************************************************// public function build_structure( $premium_user = false, $theme, $path_file ) { // if permission denied if ( !is_writable( WP_CONTENT_DIR.'/cache/' ) ) { /********************* > ERROR - if directory doesn't exist or isn't writable. **********************/ add_action( 'admin_notices', array( $this, 'gchelp_notice_error_write' ) ); } else { require_once plugin_dir_path(__DIR__) . 'includes/gchelp-restapi.php'; $api = new GCHelp_API(); // function get_posts( $postperpage = 10, $orderby = 'name', $order = 'asc', $category = null ) $posts_insights = $api->get_posts( 15, 'date', 'desc', 1 ); $posts_cursos = $api->get_posts( 15, 'date', 'desc', 2 ); if ( ! empty( $posts_cursos ) && ! is_wp_error( $posts_cursos ) ) { if ( ! empty( $posts_insights ) && ! is_wp_error( $posts_insights ) ) { if ( $theme == 'darktech' ) { $tech = 'is-tech'; $tech_img = 'tech-'; $active_t = '-active'; } else { $tech = ''; $tech_img = ''; $active_t = ''; } /******** PREPARA O CONTEÚDO DE INSIGHTS *********/ $conteudo_dinamico_insights = ''; $i = 0; foreach ($posts_insights as $value) { $id_image = ''; $image_url = ''; $id_image = $value->featured_media; if ( $id_image != 0 ) { $object_image = $api->get_post_media( $id_image ); if ( isset( $object_image->guid->rendered ) ) { $image_url = $object_image->guid->rendered; } } if ( $image_url == '' ) $image_url = plugins_url().'/gc-help/admin/images/gcampaner.jpg'; $conteudo = $value->content->rendered; $titulo = $value->title->rendered; //if ( $i != 0 ) { if ( true ) { //download_and_get_path_image($image_url, $file_name) $image_path = self::download_and_get_path_image($image_url, sanitize_title($titulo).'.jpg' ); $conteudo_dinamico_insights .= '
'.substr( strip_tags($conteudo), 0, 150).'...
'.substr( strip_tags($value->content->rendered), 0, 150).'...
Erro de permissão de escrita em /wp-content/cache', 'sample-text-domain' ); ?>
A função allow_url_fopen de seu servidor está desativada. Contate o administrador ou ative-a para o funcionamento do plugin', 'sample-text-domain' ); ?>