Пример #1
0
function rcl_feed_shortcode($atts)
{
    global $wpdb, $user_ID, $rcl_feed;
    if (!$user_ID) {
        return '<p class="aligncenter">' . __('Login or register to view the latest publications and comments from users on which you will you subscribed.', 'wp-recall') . '</p>';
    }
    include_once 'classes/class-rcl-feed.php';
    $list = new Rcl_Feed($atts);
    $count = false;
    if (!$list->number) {
        $rqst = $list->search_request();
        $search_string = $rqst ? '&' . implode('&', $rqst) : '';
        $count = $list->count_feed_posts();
        $rclnavi = new RCL_navi($list->inpage, $count, $search_string, $list->paged);
        $list->offset = $rclnavi->offset;
        $list->number = $rclnavi->inpage;
    }
    $feedsdata = $list->get_feed();
    $content = $list->get_filters($count);
    if (!$feedsdata) {
        $content .= '<p align="center">' . __('News not found', 'wp-recall') . '</p>';
        return $content;
    }
    $load = $rclnavi->inpage ? 'data-load="' . $list->load . '"' : '';
    $content .= '<div id="rcl-feed" data-feed="' . $list->content . '" ' . $load . '>';
    foreach ($feedsdata as $rcl_feed) {
        $list->setup_data($rcl_feed);
        $content .= '<div id="feed-' . $rcl_feed->feed_type . '-' . $rcl_feed->feed_ID . '" class="feed-box feed-user-' . $rcl_feed->feed_author . ' feed-' . $rcl_feed->feed_type . '">';
        $content .= rcl_get_include_template('feed-post.php', __FILE__);
        $content .= '</div>';
    }
    if ($list->load == 'ajax' && $rclnavi->inpage) {
        $content .= '<div id="feed-preloader"><div></div></div>' . '<div id="feed-bottom"></div>';
    }
    $content .= '</div>';
    if ($list->load == 'pagenavi' && $rclnavi->inpage) {
        $content .= $rclnavi->navi();
    }
    $list->remove_data();
    return $content;
}
Пример #2
0
function rcl_feed_progress()
{
    global $rcl_feed;
    $content = $_POST['content'];
    $paged = $_POST['paged'];
    include_once 'classes/class-rcl-feed.php';
    $list = new Rcl_Feed(array('paged' => $paged, 'content' => $content, 'filters' => 0));
    $count = false;
    if (!$list->number) {
        $rqst = $list->search_request();
        $search_string = $rqst ? '&' . implode('&', $rqst) : '';
        $count = $list->count_feed_posts();
        $rclnavi = new RCL_navi($list->inpage, $count, $search_string, $list->paged);
        $list->offset = $rclnavi->offset;
        $list->number = $rclnavi->inpage;
    }
    $feedsdata = $list->get_feed();
    $content = '';
    if (!$feedsdata) {
        $content .= '<p align="center">' . __('News not found', 'wp-recall') . '</p>';
        $result['content'] = $content;
        $result['code'] = 0;
        echo json_encode($result);
        exit;
    }
    foreach ($feedsdata as $rcl_feed) {
        $list->setup_data($rcl_feed);
        $content .= '<div id="feed-' . $rcl_feed->feed_type . '-' . $rcl_feed->feed_ID . '" class="feed-box feed-user-' . $rcl_feed->feed_author . ' feed-' . $rcl_feed->feed_type . '">';
        $content .= rcl_get_include_template('feed-post.php', __FILE__);
        $content .= '</div>';
    }
    $list->remove_data();
    $result['content'] = $content;
    $result['code'] = 100;
    echo json_encode($result);
    exit;
}