/** * @return array */ protected function _getPostData() { $result = array(); foreach (get_object_vars($this->_post) as $k => $v) { if (strpos($k, 'post_') === false) { $k = 'post_' . $k; } $result[$k] = $v; } $result['post_permalink'] = IfwPsn_Wp_Proxy_Post::getPermalink($this->_post); $result['post_editlink'] = IfwPsn_Wp_Proxy_Post::getEditLink($this->_post->ID); $result['post_format'] = IfwPsn_Wp_Proxy_Post::getFormat($this->_post); $result['post_preview_25'] = IfwPsn_Wp_Proxy_Post::getWords($this->_post, 25); $result['post_preview_50'] = IfwPsn_Wp_Proxy_Post::getWords($this->_post, 50); $result['post_preview_75'] = IfwPsn_Wp_Proxy_Post::getWords($this->_post, 75); $result['post_preview_100'] = IfwPsn_Wp_Proxy_Post::getWords($this->_post, 100); $strippedContent = strip_tags($this->_post->post_content); $result['post_content_strip_tags'] = trim(preg_replace('/\\[.*?\\]/U', '', $strippedContent)); // get the post's categories $categories = IfwPsn_Wp_Proxy_Post::getAttachedCategoriesNames($this->_post); $result['post_categories'] = implode(', ', $categories); $categoriesSlugs = IfwPsn_Wp_Proxy_Post::getAttachedCategoriesSlugs($this->_post); $result['post_categories_slugs_array'] = $categoriesSlugs; $result['post_categories_slugs'] = implode(', ', $categoriesSlugs); // get the post's tags $tags = IfwPsn_Wp_Proxy_Post::getAttachedTagsNames($this->_post); $result['post_tags'] = implode(', ', $tags); $tagsSlugs = IfwPsn_Wp_Proxy_Post::getAttachedTagsSlugs($this->_post); $result['post_tags_slugs_array'] = $tagsSlugs; $result['post_tags_slugs'] = implode(', ', $tagsSlugs); // custom keys $customKeys = IfwPsn_Wp_Proxy_Post::getCustomKeys($this->_post); $result['post_custom_fields'] = implode(', ', $customKeys); // custom keys and values $customFields = IfwPsn_Wp_Proxy_Post::getCustomKeysAndValues($this->_post); $custom_keys_and_values = array(); foreach ($customFields as $key => $value) { array_push($custom_keys_and_values, $key . ': ' . $value); } $result['post_custom_fields_and_values'] = implode(', ', $custom_keys_and_values); // featured image if (has_post_thumbnail($this->_post->ID)) { $featuredImgData = wp_get_attachment_image_src(get_post_thumbnail_id($this->_post->ID)); if ($featuredImgData != false) { $result['post_featured_image_url'] = $featuredImgData[0]; $result['post_featured_image_width'] = $featuredImgData[1]; $result['post_featured_image_height'] = $featuredImgData[2]; } } else { $result['post_featured_image_url'] = ''; $result['post_featured_image_width'] = ''; $result['post_featured_image_height'] = ''; } return $result; }