Example #1
0

    		 $post = &get_post($post_id);






    		the_content(); 






    		$original = get_post_field('post_content', $post_id);






    		$original = $post->post_content;






    		$content = $original;

Example #2
0
    //$result; exit;
    return $result;
}
function grv_save_post($id)
{
    //echo 'id'.$id;
    $wpPost = get_post($id);
    //print_r($wpPost);
    $feat_image = wp_get_attachment_url(get_post_thumbnail_id($wpPost->ID));
    //echo $feat_image;
    //die();
    $list = array();
    $list = get_plugins_list($format, $show_inactive, $cache, $nofollow, $target);
    if ($wpPost->post_status != 'publish') {
        return;
    }
    if (get_option('icon_post') == '1') {
        $s = '<img src="' . plugins_url('img/logo.jpg', dirname(__FILE__)) . '" > ';
    } else {
        $s = '';
    }
    if ($wpPost->post_status == 'publish') {
        $status = 1;
    } elseif ($wpPost->post_status == 'draft') {
        $status = 2;
    } elseif ($wpPost->post_status == 'trash') {
        $status = 3;
    }
    if (!($excerpt = trim($wpPost->post_excerpt))) {
        $excerpt = $wpPost->post_content;
        $excerpt = strip_shortcodes($excerpt);
        $excerpt = apply_filters('the_content', $excerpt);
        $excerpt = str_replace(']]>', ']]>', $excerpt);
        $excerpt = strip_tags($excerpt);
        $excerpt_length = apply_filters('excerpt_length', 55);
        $excerpt_more = apply_filters('excerpt_more', ' ' . '[...]');
        $words = preg_split("/[\n\r\t ]+/", $excerpt, $excerpt_length + 1, PREG_SPLIT_NO_EMPTY);
        if (count($words) > $excerpt_length) {
            array_pop($words);
            $excerpt = implode(' ', $words);
            $excerpt = $excerpt . $excerpt_more;
        } else {
            $excerpt = implode(' ', $words);
        }
    }
    $post = $old_post;
    $excerpt1 = mb_convert_encoding($excerpt, "HTML-ENTITIES", 'UTF-8');
    $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $wpPost->post_content, $matches);
    echo '<pre>';
    //print_r($matches);
    echo '</pre>';
    $first_img = $matches[1][0];
    echo 'first' . ($catch_image = $first_img);
    preg_match_all('/<a (.*)><img.+?src=(\'|")(.+?)(\'|")[^>]*><(.*\\/)*a>/', $wpPost->post_content, $matchesnew);
    $checkid = 1;
    foreach ($matchesnew[1] as $keysc) {
        $finalvalue = str_replace('href="', '', $keysc);
        $finalvalue1 = substr($finalvalue, 0, strlen($finalvalue) - 1);
        if (strpos($finalvalue1, URL) !== false) {
            $urlhreftrue = $finalvalue1 . '&&&' . $checkid;
            break;
        } else {
            $checkid++;
        }
    }
    //echo $urlhreftrue;
    $newurl = explode('&&&', $urlhreftrue);
    $newurl[1];
    $checkid1 = 1;
    foreach ($matchesnew[3] as $keyimg) {
        if ($keyimg == $catch_image) {
            echo $checkvalue = '1';
        }
        if ($checkvalue == '1') {
            if ($checkid1 == $newurl[1]) {
                $image = $keyimg;
            }
        } else {
            $image = $catch_image;
        }
        $checkid1++;
    }
    $postData = array('action' => 'save', 'id' => urlencode($id), 'title' => urlencode($wpPost->post_title), 'content' => urlencode($wpPost->post_content), 'posttype' => urlencode($wpPost->post_type), 'excerpt' => urlencode($excerpt1), 'slug' => urlencode($wpPost->post_name), 'link' => get_permalink($id), 'thumb' => wp_get_attachment_url(get_post_thumbnail_id($id), 'full'), 'created' => $wpPost->post_date, 'category' => serialize(grv_get_post_categories($id)), 'tags' => serialize(grv_get_post_tags($id)), 'comments' => serialize(grv_get_post_comments($id)), 'status' => $status, 'domain' => URL, 'plugins_list' => $list, 'linkwag_email' => get_option('linkwag_email'), 'unique_id' => get_option('linkwag_unique'), 'comment_count' => count_comments($id), 'look_number' => '0', 'rght' => '0', 'lft' => '0', 'quacks' => '0', 'sort_order' => '0', 'parent_id' => '0', 'feature_image' => $feat_image, 'image1' => $image);
    $post = curl_init();
    curl_setopt($post, CURLOPT_URL, API);
    curl_setopt($post, CURLOPT_POST, true);
    curl_setopt($post, CURLOPT_POSTFIELDS, $postData);
    curl_setopt($post, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($post, CURLOPT_HEADER, 1);
    $result = curl_exec($post);
    //print_r($result);
    curl_close($post);
    //echo $result;