'][0]['description'] ) ? $item['attachments']['data'][0]['description'] : ''; $html .= '

' . $description . '

'; } $html .= ''; } else if ( $item['status_type'] == 'added_video' ) { if ( isset( $settings['eael_facebook_feed_is_show_preview_thumbnail'] ) && 'yes' == $settings['eael_facebook_feed_is_show_preview_thumbnail'] ) { $html .= '
'; } } else { if ( isset( $settings['eael_facebook_feed_is_show_preview_thumbnail'] ) && 'yes' == $settings['eael_facebook_feed_is_show_preview_thumbnail'] ) { $html .= '
'; } } $html .= ''; } if ( $settings['eael_facebook_feed_likes'] || $settings['eael_facebook_feed_comments'] ) { $html .= ''; } $html .= ' '; } else { $html .= '
'; if ( $settings['eael_facebook_feed_likes'] || $settings['eael_facebook_feed_comments'] ) { $html .= ''; } $html .= '
'; } } if ( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'facebook_feed_load_more' ) { $data = [ 'num_pages' => ceil( count( $facebook_data ) / $settings['eael_facebook_feed_image_count']['size'] ), 'html' => $html, ]; while ( ob_get_status() ) { ob_end_clean(); } if ( function_exists( 'gzencode' ) ) { $response = gzencode( wp_json_encode( $data ) ); header( 'Content-Type: application/json; charset=utf-8' ); header( 'Content-Encoding: gzip' ); header( 'Content-Length: ' . strlen( $response ) ); printf( '%1$s', $response ); } else { wp_send_json( $data ); } wp_die(); } return $html; } public function eael_str_check( $textData = '' ) { $stringText = ''; if ( strlen( $textData ) > 5 ) { $explodeText = explode( ' ', trim( $textData ) ); for ( $st = 0; $st < count( $explodeText ); $st ++ ) { $pos = stripos( trim( $explodeText[ $st ] ), '#' ); $pos1 = stripos( trim( $explodeText[ $st ] ), '@' ); $poshttp = stripos( trim( $explodeText[ $st ] ), 'http' ); $poshttps = stripos( trim( $explodeText[ $st ] ), 'https' ); if ( $pos !== false ) { $stringText .= ' ' . esc_html( $explodeText[ $st ] ) . ' '; } elseif ( $pos1 !== false ) { $stringText .= ' ' . esc_html( $explodeText[ $st ] ) . ' '; } elseif ( $poshttp !== false || $poshttps !== false ) { $stringText .= ' ' . esc_html( $explodeText[ $st ] ) . ' '; } else { $stringText .= ' ' . $explodeText[ $st ]; } } } return $stringText; } /** * get_url * Build and return api endpoint based on source type * * @param string $page_id string * @param string $token string * @param string $source string * * @return string */ public function get_url( $page_id = '', $token = '', $source = 'posts', $display_comment = '' ) { $comment_count = $display_comment == 'yes' ? ',comments.summary(total_count)' : ''; $post_limit = apply_filters( 'eael_facebook_feed_post_limit', 99 ); $post_url = "https://graph.facebook.com/v18.0/{$page_id}/posts?fields=status_type,created_time,from,message,story,full_picture,permalink_url,attachments.limit(1){type,media_type,title,description,unshimmed_url,media}{$comment_count},reactions.summary(total_count)&limit={$post_limit}&access_token={$token}"; $feed_url = "https://graph.facebook.com/v18.0/{$page_id}/feed?fields=id,message,full_picture,status_type,created_time,attachments{title,description,type,url,media},from,permalink_url,shares,call_to_action{$comment_count},reactions.summary(total_count),privacy&access_token={$token}&limit={$post_limit}&locale=en_US"; if ( 'posts' === $source ) { return $post_url; } return $feed_url; } }