Example #1
0
 function widget_subpagehierarchy_page_rows($headpage, $parent = 0, $level = 0, $pages = 0)
 {
     global $wpdb, $class, $post;
     if (!$pages) {
         $pages = $wpdb->get_results("SELECT * FROM {$wpdb->posts} WHERE post_status = 'static' ORDER BY menu_order");
     }
     if ($pages) {
         foreach ($pages as $post) {
             start_wp();
             if ($post->post_parent == $parent) {
                 $post->post_title = wp_specialchars($post->post_title);
                 $pad = str_repeat('—', $level);
                 $id = $post->ID;
                 if ($id == $headpage) {
                     $selectString = ' selected';
                 } else {
                     unset($selectString);
                 }
                 $class = 'alternate' == $class ? '' : 'alternate';
                 echo '  <option value="' . $post->ID . '"' . $selectString . ">{$pad}" . $post->post_title . "</option>\n";
                 widget_subpagehierarchy_page_rows($headpage, $id, $level + 1, $pages);
             }
         }
     } else {
         return false;
     }
 }
function b_wp_contents_show($options)
{
    //	global $xoopsDB,$xoopsUser;
    //	global $tableoptions,$tableusers;
    //	global $id, $posts, $post, $day, $previousday, $newday;
    $id = 1;
    global $posts, $post, $day, $previousday, $newday;
    global $dateformat, $time_difference, $siteurl, $blogfilename;
    global $tablelinks, $tablelinkcategories;
    global $querystring_start, $querystring_equal, $querystring_separator, $month, $wpdb, $start_of_week;
    global $tableposts, $tablepost2cat, $tablecomments, $tablecategories;
    global $smilies_directory, $use_smilies, $wp_smiliessearch, $wp_smiliesreplace;
    global $wp_bbcode, $use_bbcode, $wp_gmcode, $use_gmcode, $use_htmltrans, $wp_htmltrans, $wp_htmltranswinuni;
    require_once dirname(__FILE__) . '/../wp-blog-header.php';
    $blog = 1;
    $block = array();
    $block['siteurl'] = $siteurl;
    foreach ($posts as $post) {
        $content = array();
        start_wp();
        $content['date'] = the_date('', '<h2>', '</h2>', false);
        $content['time'] = the_time('', false);
        $content['title'] = the_title('', '', false);
        $content['permlink'] = get_permalink();
        //
        ob_start();
        the_author();
        $content['author'] = ob_get_contents();
        ob_end_clean();
        //
        ob_start();
        the_category();
        $content['category'] = ob_get_contents();
        ob_end_clean();
        //
        ob_start();
        the_content();
        $content['body'] = ob_get_contents();
        ob_end_clean();
        //
        ob_start();
        link_pages('<br />Pages: ', '<br />', 'number');
        $content['linkpage'] = ob_get_contents();
        ob_end_clean();
        //
        ob_start();
        comments_popup_link('Comments (0)', 'Comments (1)', 'Comments (%)');
        $content['comments'] = ob_get_contents();
        ob_end_clean();
        //
        ob_start();
        trackback_rdf();
        $content['trackback'] = ob_get_contents();
        ob_end_clean();
        //
        $block['contents'][] = $content;
    }
    return $block;
}
function b_wp_contents_show($options)
{
    global $xoopsDB, $xoopsUser, $wpdb, $siteurl;
    global $tableoptions, $tableposts, $tableusers, $tablecategories, $tablecomments, $tablepost2cat;
    global $querystring_start, $querystring_equal, $querystring_separator;
    global $id, $posts, $post, $day, $previousday, $dateformat, $newday;
    require_once dirname(__FILE__) . '/../wp-blog-header.php';
    $blog = 1;
    $block = array();
    $block['siteurl'] = $siteurl;
    foreach ($posts as $post) {
        $content = array();
        start_wp();
        $content['date'] = the_date('', '<h2>', '</h2>', false);
        $content['time'] = the_time('', false);
        $content['title'] = the_title('', '', false);
        $content['permlink'] = get_permalink();
        //
        ob_start();
        the_author();
        $content['author'] = ob_get_contents();
        ob_end_clean();
        //
        ob_start();
        the_category();
        $content['category'] = ob_get_contents();
        ob_end_clean();
        //
        ob_start();
        the_content();
        $content['body'] = ob_get_contents();
        ob_end_clean();
        //
        ob_start();
        link_pages('<br />Pages: ', '<br />', 'number');
        $content['linkpage'] = ob_get_contents();
        ob_end_clean();
        //
        ob_start();
        comments_popup_link('Comments (0)', 'Comments (1)', 'Comments (%)');
        $content['comments'] = ob_get_contents();
        ob_end_clean();
        //
        ob_start();
        trackback_rdf();
        $content['trackback'] = ob_get_contents();
        ob_end_clean();
        //
        $block['contents'][] = $content;
    }
    return $block;
}
function page_rows($parent = 0, $level = 0, $pages = 0)
{
    global $wpdb, $class, $post;
    if (!$pages) {
        $pages = $wpdb->get_results("SELECT * FROM {$wpdb->posts} WHERE post_status = 'static' ORDER BY menu_order");
    }
    if ($pages) {
        foreach ($pages as $post) {
            start_wp();
            if ($post->post_parent == $parent) {
                $post->post_title = wp_specialchars($post->post_title);
                $pad = str_repeat('&#8212; ', $level);
                $id = $post->ID;
                $class = 'alternate' == $class ? '' : 'alternate';
                ?>
  <tr id='page-<?php 
                echo $id;
                ?>
' class='<?php 
                echo $class;
                ?>
'> 
    <th scope="row"><?php 
                echo $post->ID;
                ?>
</th> 
    <td>
      <?php 
                echo $pad;
                the_title();
                ?>
 
    </td> 
    <td><?php 
                the_author();
                ?>
</td>
    <td><?php 
                echo mysql2date('Y-m-d g:i a', $post->post_modified);
                ?>
</td> 
	<td><a href="<?php 
                the_permalink();
                ?>
" rel="permalink" class="edit"><?php 
                _e('View');
                ?>
</a></td>
    <td><?php 
                if (current_user_can('edit_pages')) {
                    echo "<a href='post.php?action=edit&amp;post={$id}' class='edit'>" . __('Edit') . "</a>";
                }
                ?>
</td> 
    <td><?php 
                if (current_user_can('edit_pages')) {
                    echo "<a href='" . wp_nonce_url("post.php?action=delete&amp;post={$id}", 'delete-post_' . $id) . "' class='delete' onclick=\"return deleteSomething( 'page', " . $id . ", '" . sprintf(__("You are about to delete the &quot;%s&quot; page.\\n&quot;OK&quot; to delete, &quot;Cancel&quot; to stop."), js_escape(get_the_title())) . "' );\">" . __('Delete') . "</a>";
                }
                ?>
</td> 
  </tr> 

<?php 
                page_rows($id, $level + 1, $pages);
            }
        }
    } else {
        return false;
    }
}
function get_a_post($id = 'GETPOST')
{
    global $post, $tableposts, $tablepostmeta, $wp_version, $wpdb;
    if ($wp_version < 1.5) {
        $table = $tableposts;
    } else {
        $table = $wpdb->posts;
    }
    $now = current_time('mysql');
    $name_or_id = '';
    $orderby = 'post_date';
    if (!$id || 'GETPOST' == $id || 'GETRANDOM' == $id) {
        if ($wp_version < 2.1) {
            $query_suffix = "post_status = 'publish'";
        } else {
            $query_suffix = "post_type = 'post' AND post_status = 'publish'";
        }
    } elseif ('GETPAGE' == $id) {
        if ($wp_version < 2.1) {
            $query_suffix = "post_status = 'static'";
        } else {
            $query_suffix = "post_type = 'page' AND post_status = 'publish'";
        }
    } elseif ('GETSTICKY' == $id) {
        if ($wp_version < 1.5) {
            $table .= ', ' . $tablepostmeta;
        } else {
            $table .= ', ' . $wpdb->postmeta;
        }
        $query_suffix = "ID = post_id AND meta_key = 'sticky' AND meta_value = 1";
    } else {
        $query_suffix = "(post_status = 'publish' OR post_status = 'static')";
        if (is_numeric($id)) {
            $name_or_id = "ID = '{$id}' AND";
        } else {
            $name_or_id = "post_name = '{$id}' AND";
        }
    }
    if ('GETRANDOM' == $id) {
        $orderby = 'RAND()';
    }
    $post = $wpdb->get_row("SELECT * FROM {$table} WHERE {$name_or_id} post_date <= '{$now}' AND {$query_suffix} ORDER BY {$orderby} DESC LIMIT 1");
    get_post_custom($post->ID);
    if ($wp_version < 1.5) {
        start_wp();
    } else {
        setup_postdata($post);
    }
}
 function b_wp_contents_show($options, $wp_num = "")
 {
     $no_posts = empty($options[0]) ? 10 : $options[0];
     global $wpdb, $siteurl, $post, $use_cache, $category_cache, $comment_count_cache;
     global $smilies_directory, $wp_smiliessearch, $wp_smiliesreplace, $authordata;
     global $wp_bbcode, $wp_gmcode, $wp_htmltrans, $wp_htmltranswinuni, $wp_filter;
     global $wp_id, $wp_mod, $wp_base, $wp_inblock, $xoopsConfig, $previousday, $time_difference, $day;
     $id = 1;
     $use_cache = 1;
     if ($wp_num == "") {
         $wp_id = $wp_num;
         $wp_inblock = 2;
         require dirname(__FILE__) . '/../wp-config.php';
         $wp_inblock = 0;
     }
     global $dateformat, $timeformat;
     $dateformat = stripslashes(get_settings('date_format'));
     $timeformat = stripslashes(get_settings('time_format'));
     $now = date('Y-m-d H:i:s', time() + get_settings('time_difference') * 3600);
     $request = "SELECT DISTINCT * FROM {$wpdb->posts[$wp_id]} ";
     $request .= " LEFT JOIN {$wpdb->post2cat[$wp_id]} ON ({$wpdb->posts[$wp_id]}.ID = {$wpdb->post2cat[$wp_id]}.post_id) ";
     $request .= "WHERE post_status = 'publish' ";
     $request .= " AND post_date <= '" . $now . "'";
     $request .= " GROUP BY {$wpdb->posts[$wp_id]}.ID ORDER BY post_date DESC LIMIT 0, {$no_posts}";
     $lposts = $wpdb->get_results($request);
     if ($lposts) {
         // Get the categories for all the posts
         foreach ($lposts as $post) {
             $post_id_list[] = $post->ID;
             $category_cache[$wp_id][$post->ID] = array();
         }
         $post_id_list = implode(',', $post_id_list);
         $dogs = $wpdb->get_results("SELECT DISTINCT\n\t\t\t\tID, category_id, cat_name, category_nicename, category_description, category_parent\n\t\t\t\tFROM {$wpdb->categories[$wp_id]}, {$wpdb->post2cat[$wp_id]}, {$wpdb->posts[$wp_id]}\n\t\t\t\tWHERE category_id = cat_ID AND post_id = ID AND post_id IN ({$post_id_list})");
         foreach ($dogs as $catt) {
             $category_cache[$wp_id][$catt->ID][] = $catt;
         }
         // Do the same for comment numbers
         $comment_counts = $wpdb->get_results("SELECT ID, COUNT( comment_ID ) AS ccount\n\t\t\t\tFROM {$wpdb->posts[$wp_id]}\n\t\t\t\tLEFT JOIN {$wpdb->comments[$wp_id]} ON ( comment_post_ID = ID  AND comment_approved =  '1')\n\t\t\t\tWHERE post_status =  'publish' AND ID IN ({$post_id_list})\n\t\t\t\tGROUP BY ID");
         foreach ($comment_counts as $comment_count) {
             $comment_count_cache[$wp_id]["{$comment_count->ID}"] = $comment_count->ccount;
         }
     }
     $blog = 1;
     $block = array();
     $block['use_theme_template'] = get_xoops_option('wordpress' . $wp_num, 'use_theme_template');
     $block['style'] = block_style_get($wp_num, false);
     $block['divid'] = 'wpBlockContent' . $wp_num;
     $block['template_content'] = "";
     $i = 0;
     $previousday = 0;
     foreach ($lposts as $post) {
         if ($block['use_theme_template'] == 0) {
             $content = array();
             start_wp();
             $content['date'] = the_date($dateformat, '', '', false);
             $content['time'] = the_time('', false);
             $content['title'] = the_title('', '', false);
             $content['permlink'] = get_permalink();
             //
             ob_start();
             the_author_posts_link();
             $content['author'] = ob_get_contents();
             ob_end_clean();
             //
             ob_start();
             the_category();
             $content['category'] = ob_get_contents();
             ob_end_clean();
             //
             ob_start();
             the_content();
             $content['body'] = ob_get_contents();
             ob_end_clean();
             //
             ob_start();
             link_pages('<br />Pages: ', '<br />', 'number');
             $content['linkpage'] = ob_get_contents();
             ob_end_clean();
             //
             ob_start();
             if (get_xoops_option($wp_mod[$wp_id], 'wp_use_xoops_comments') == 0) {
                 comments_popup_link(_WP_TPL_COMMENT0, _WP_TPL_COMMENT1, _WP_TPL_COMMENTS);
             } else {
                 xcomments_popup_link(_WP_TPL_COMMENT0, _WP_TPL_COMMENT1, _WP_TPL_COMMENTS);
                 echo " | ";
                 comments_popup_link(_WP_TPL_TRACKBACK0, _WP_TPL_TRACKBACK1, _WP_TPL_TRACKBACKS);
             }
             //				comments_popup_link(_WP_TPL_COMMENT0, _WP_TPL_COMMENT1, _WP_TPL_COMMENTS);
             $content['comments'] = ob_get_contents();
             ob_end_clean();
             //
             ob_start();
             trackback_rdf();
             $content['trackback'] = ob_get_contents();
             ob_end_clean();
             //
             $block['contents'][] = $content;
         } else {
             ob_start();
             include get_custom_path('content_block-template.php');
             $block['template_content'] .= ob_get_contents();
             ob_end_clean();
         }
     }
     $previousday = 0;
     $day = 0;
     $comment_count_cache[$wp_id] = array();
     return $block;
 }
Example #7
0
    function show_report_extended($type = 'popular', $limit = 50)
    {
        global $wpdb, $post;
        $columns = array('popularity' => __('', 'alexking.org'), 'title' => __('Title'), 'categories' => __('Categories'), 'single_views' => __('Post', 'alexking.org'), 'category_views' => __('Cat', 'alexking.org'), 'archive_views' => __('Arch', 'alexking.org'), 'home_views' => __('Home', 'alexking.org'), 'feed_views' => __('Feed', 'alexking.org'), 'comments' => __('Com'), 'pingbacks' => __('Ping'), 'trackbacks' => __('Track'));
        ?>
<div id="akpc_most_popular">
	<table width="100%" cellpadding="3" cellspacing="2"> 
		<tr>
<?php 
        foreach ($columns as $column_display_name) {
            ?>
			<th scope="col"><?php 
            echo $column_display_name;
            ?>
</th>
<?php 
        }
        ?>
			</tr>
<?php 
        $posts = $wpdb->get_results("\n\t\t\tSELECT p.*, pop.*\n\t\t\tFROM {$wpdb->posts} p\n\t\t\tLEFT JOIN {$wpdb->ak_popularity} pop\n\t\t\tON p.ID = pop.post_id\n\t\t\tWHERE p.post_status = 'publish'\n\t\t\tORDER BY pop.total DESC\n\t\t\tLIMIT " . intval($limit));
        if ($posts) {
            $bgcolor = '';
            foreach ($posts as $post) {
                start_wp();
                $class = 'alternate' == $class ? '' : 'alternate';
                ?>
 
		<tr class='<?php 
                echo $class;
                ?>
'>
<?php 
                foreach ($columns as $column_name => $column_display_name) {
                    switch ($column_name) {
                        case 'popularity':
                            ?>
				<td><?php 
                            $this->show_post_rank(-1, $post->total);
                            ?>
</td>
<?php 
                            break;
                        case 'title':
                            ?>
				<td><a href="<?php 
                            the_permalink();
                            ?>
"><?php 
                            the_title();
                            ?>
</a></td>
<?php 
                            break;
                        case 'categories':
                            ?>
				<td><?php 
                            the_category(',');
                            ?>
</td>
<?php 
                            break;
                        case 'single_views':
                            ?>
				<td class="right"><?php 
                            print $post->single_views;
                            ?>
</td>
<?php 
                            break;
                        case 'category_views':
                            ?>
				<td class="right"><?php 
                            print $post->category_views;
                            ?>
</td>
<?php 
                            break;
                        case 'archive_views':
                            ?>
				<td class="right"><?php 
                            print $post->archive_views;
                            ?>
</td>
<?php 
                            break;
                        case 'home_views':
                            ?>
				<td class="right"><?php 
                            print $post->home_views;
                            ?>
</td>
<?php 
                            break;
                        case 'feed_views':
                            ?>
				<td class="right"><?php 
                            print $post->feed_views;
                            ?>
</td>
<?php 
                            break;
                        case 'comments':
                            ?>
				<td class="right"><?php 
                            print $post->comments;
                            ?>
</td>
<?php 
                            break;
                        case 'pingbacks':
                            ?>
				<td class="right"><?php 
                            print $post->pingbacks;
                            ?>
</td>
<?php 
                            break;
                        case 'trackbacks':
                            ?>
				<td class="right"><?php 
                            print $post->trackbacks;
                            ?>
</td>
<?php 
                            break;
                    }
                }
                ?>
		</tr> 
<?php 
            }
        } else {
            ?>
	  <tr style='background-color: <?php 
            echo $bgcolor;
            ?>
'> 
		<td colspan="8"><?php 
            _e('No posts found.');
            ?>
</td> 
	  </tr> 
<?php 
        }
        // end if ($posts)
        ?>
 
	</table> 
</div>
<?php 
    }
}

header('Content-type: text/xml; charset=' . get_settings('blog_charset'), true);
$more = 1;

?>
<?php echo '<?xml version="1.0" encoding="'.get_settings('blog_charset').'"?'.'>'; ?>
<!-- generator="wordpress/<?php echo $wp_version ?>" -->
<rss version="0.92">
<channel>
	<title><?php bloginfo_rss('name') ?></title>
	<link><?php bloginfo_rss('url') ?></link>
	<description><?php bloginfo_rss('description') ?></description>
	<lastBuildDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), 0); ?></lastBuildDate>
	<docs>http://backend.userland.com/rss092</docs>
	<language><?php echo get_option('rss_language'); ?></language>

<?php $items_count = 0; if ($posts) { foreach ($posts as $post) { start_wp(); ?>
	<item>
		<title><?php the_title_rss() ?></title>
<?php if (get_settings('rss_use_excerpt')) { ?>
		<description><![CDATA[<?php the_excerpt_rss() ?>]]></description>
<?php } else { // use content ?>
		<description><?php the_content_rss('', 0, '', get_settings('rss_excerpt_length')) ?></description>
<?php } ?>
		<link><?php permalink_single_rss() ?></link>
	</item>
<?php $items_count++; if (($items_count == get_settings('posts_per_rss')) && empty($m)) { break; } } } ?>
</channel>
</rss>
Example #9
0
			
				<div class="column medium-3 front-info">
					<div class="row collapse">
						<div id="latest-post" class="column small-12">
							<i class="fa fa-newspaper-o"></i>
							<a href="http://visiblesandbox.com/grainne/blog/"><h3>LATEST NEWS</h3></a>
							
						
								
								<?php 
query_posts('showposts=3');
?>
								<?php 
$posts = get_posts('category_name=news&numberposts=3&offset=0');
foreach ($posts as $post) {
    start_wp();
    ?>
								
								<div class="news-summary-item row collapse">
									<div class="column medium-3">
											<?php 
    if (has_post_thumbnail()) {
        the_post_thumbnail(array(29, 29));
    } else {
        ?>
											
											
											
											<?php 
    }
    ?>
function export_wp() {
global $wpdb, $posts, $post;

$filename = 'wordpress.' . date('Y-m-d') . '.xml';

header('Content-Description: File Transfer');
header("Content-Disposition: attachment; filename=$filename");
header('Content-type: text/xml; charset=' . get_option('blog_charset'), true);

$where = '';
if ( isset( $_GET['author'] ) && $_GET['author'] != 'all' ) {
	$author_id = (int) $_GET['author'];
	$where = " WHERE post_author = '$author_id' ";
}

$posts = $wpdb->get_results("SELECT * FROM $wpdb->posts $where ORDER BY post_date_gmt ASC");

$categories = (array) $wpdb->get_results("SELECT cat_ID, cat_name, category_nicename, category_description, category_parent, posts_private, links_private FROM $wpdb->categories LEFT JOIN $wpdb->post2cat ON (category_id = cat_id) LEFT JOIN $wpdb->posts ON (post_id <=> id) $where GROUP BY cat_id");

function wxr_missing_parents($categories) {
	if ( !is_array($categories) || empty($categories) )
		return array();

	foreach ( $categories as $category )
		$parents[$category->cat_ID] = $category->category_parent;

	$parents = array_unique(array_diff($parents, array_keys($parents)));

	if ( $zero = array_search('0', $parents) )
		unset($parents[$zero]);

	return $parents;
}

while ( $parents = wxr_missing_parents($categories) ) {
	$found_parents = $wpdb->get_results("SELECT cat_ID, cat_name, category_nicename, category_description, category_parent, posts_private, links_private FROM $wpdb->categories WHERE cat_ID IN (" . join(', ', $parents) . ")");
	if ( is_array($found_parents) && count($found_parents) )
		$categories = array_merge($categories, $found_parents);
	else
		break;
}

// Put them in order to be inserted with no child going before its parent
$pass = 0;
$passes = 1000 + count($categories);
while ( ( $cat = array_shift($categories) ) && ++$pass < $passes ) {
	if ( $cat->category_parent == 0 || isset($cats[$cat->category_parent]) ) {
		$cats[$cat->cat_ID] = $cat;
	} else {
		$categories[] = $cat;
	}
}
unset($categories);

function wxr_cdata($str) {
	if ( seems_utf8($str) == false )
		$str = utf8_encode($str);

	// $str = ent2ncr(wp_specialchars($str));

	$str = "<![CDATA[$str" . ( ( substr($str, -1) == ']' ) ? ' ' : '') . "]]>";

	return $str;
}

function wxr_cat_name($c) {
	if ( empty($c->cat_name) )
		return;

	echo '<wp:cat_name>' . wxr_cdata($c->cat_name) . '</wp:cat_name>';
}

function wxr_category_description($c) {
	if ( empty($c->category_description) )
		return;

	echo '<wp:category_description>' . wxr_cdata($c->category_description) . '</wp:category_description>';
}

print '<?xml version="1.0" encoding="' . get_bloginfo('charset') . '"?' . ">\n";

?>

<!--
	This is a WordPress eXtended RSS file generated by WordPress as an export of 
	your blog. It contains information about your blog's posts, comments, and 
	categories. You may use this file to transfer that content from one site to 
	another. This file is not intended to serve as a complete backup of your 
	blog.
	
	To import this information into a WordPress blog follow these steps:
	
	1.	Log into that blog as an administrator.
	2.	Go to Manage > Import in the blog's admin.
	3.	Choose "WordPress" from the list of importers.
	4.	Upload this file using the form provided on that page.
	5.	You will first be asked to map the authors in this export file to users 
		on the blog. For each author, you may choose to map an existing user on 
		the blog or to create a new user.
	6.	WordPress will then import each of the posts, comments, and categories 
		contained in this file onto your blog.
-->

<!-- generator="wordpress/<?php bloginfo_rss('version') ?>" created="<?php echo date('Y-m-d H:m'); ?>"-->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:wp="http://wordpress.org/export/1.0/"
>

<channel>
	<title><?php bloginfo_rss('name'); ?></title>
	<link><?php bloginfo_rss('url') ?></link>
	<description><?php bloginfo_rss("description") ?></description>
	<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), false); ?></pubDate>
	<generator>http://wordpress.org/?v=<?php bloginfo_rss('version'); ?></generator>
	<language><?php echo get_option('rss_language'); ?></language>
<?php if ( $cats ) : foreach ( $cats as $c ) : ?>
	<wp:category><wp:category_nicename><?php echo $c->category_nicename; ?></wp:category_nicename><wp:category_parent><?php echo $c->category_parent ? $cats[$c->category_parent]->cat_name : ''; ?></wp:category_parent><wp:posts_private><?php echo $c->posts_private ? '1' : '0'; ?></wp:posts_private><wp:links_private><?php echo $c->links_private ? '1' : '0'; ?></wp:links_private><?php wxr_cat_name($c); ?><?php wxr_category_description($c); ?></wp:category>
<?php endforeach; endif; ?>
	<?php do_action('rss2_head'); ?>
	<?php if ($posts) { foreach ($posts as $post) { start_wp(); ?>
<item>
<title><?php the_title_rss() ?></title>
<link><?php permalink_single_rss() ?></link>
<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_post_time('Y-m-d H:i:s', true), false); ?></pubDate>
<dc:creator><?php the_author() ?></dc:creator>
<?php the_category_rss() ?>

<guid isPermaLink="false"><?php the_guid(); ?></guid>
<description></description>
<content:encoded><![CDATA[<?php echo $post->post_content ?>]]></content:encoded>
<wp:post_id><?php echo $post->ID; ?></wp:post_id>
<wp:post_date><?php echo $post->post_date; ?></wp:post_date>
<wp:post_date_gmt><?php echo $post->post_date_gmt; ?></wp:post_date_gmt>
<wp:comment_status><?php echo $post->comment_status; ?></wp:comment_status>
<wp:ping_status><?php echo $post->ping_status; ?></wp:ping_status>
<wp:post_name><?php echo $post->post_name; ?></wp:post_name>
<wp:status><?php echo $post->post_status; ?></wp:status>
<wp:post_parent><?php echo $post->post_parent; ?></wp:post_parent>
<wp:menu_order><?php echo $post->menu_order; ?></wp:menu_order>
<wp:post_type><?php echo $post->post_type; ?></wp:post_type>
<?php
$postmeta = $wpdb->get_results("SELECT * FROM $wpdb->postmeta WHERE post_id = $post->ID");
if ( $postmeta ) {
?>
<?php foreach( $postmeta as $meta ) { ?>
<wp:postmeta>
<wp:meta_key><?php echo $meta->meta_key; ?></wp:meta_key>
<wp:meta_value><?Php echo $meta->meta_value; ?></wp:meta_value>
</wp:postmeta>
<?php } ?>
<?php } ?>
<?php
$comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = $post->ID");
if ( $comments ) { foreach ( $comments as $c ) { ?>
<wp:comment>
<wp:comment_id><?php echo $c->comment_ID; ?></wp:comment_id>
<wp:comment_author><?php echo $c->comment_author; ?></wp:comment_author>
<wp:comment_author_email><?php echo $c->comment_author_email; ?></wp:comment_author_email>
<wp:comment_author_url><?php echo $c->comment_author_url; ?></wp:comment_author_url>
<wp:comment_author_IP><?php echo $c->comment_author_IP; ?></wp:comment_author_IP>
<wp:comment_date><?php echo $c->comment_date; ?></wp:comment_date>
<wp:comment_date_gmt><?php echo $c->comment_date_gmt; ?></wp:comment_date_gmt>
<wp:comment_content><?php echo $c->comment_content; ?></wp:comment_content>
<wp:comment_approved><?php echo $c->comment_approved; ?></wp:comment_approved>
<wp:comment_type><?php echo $c->comment_type; ?></wp:comment_type>
<wp:comment_parent><?php echo $c->comment_parent; ?></wp:comment_parent>
</wp:comment>
<?php } } ?>
	</item>
<?php } } ?>
</channel>
</rss>
<?php
	die();
}
 function _b_wp_contents_show($options, $wp_num = "")
 {
     $no_posts = empty($options[0]) ? 10 : $options[0];
     $tpl_file = empty($options[1]) ? 'wp_contents.html' : $options[1];
     $category = empty($options[2]) ? "all" : intval($options[2]);
     $GLOBALS['dateformat'] = get_settings('date_format');
     $GLOBALS['timeformat'] = get_settings('time_format');
     $_criteria = new CriteriaCompo(new Criteria('post_status', 'publish'));
     $_criteria->add(new Criteria('post_date', current_time('mysql'), '<='));
     if (empty($category) || $category == 'all' || $category == '0') {
         $_joinCriteria = null;
     } else {
         $_joinCriteria =& new XoopsJoinCriteria(wp_table('post2cat'), 'ID', 'post_id');
         $_wCriteria =& new CriteriaCompo();
         $_wCriteria->add(new Criteria('category_id', intCriteriaVal($category)), 'OR');
         $_catc = trim(get_category_children($category, '', ' '));
         if ($_catc !== "") {
             $_catc_array = explode(' ', $_catc);
             for ($_j = 0; $_j < count($_catc_array); $_j++) {
                 $_wCriteria->add(new Criteria('category_id', intCriteriaVal($_catc_array[$_j])), 'OR');
             }
         }
         $_criteria->add($_wCriteria);
     }
     $_criteria->setGroupBy(wp_table('posts') . '.ID');
     $_criteria->setSort('post_date');
     $_criteria->setOrder('DESC');
     $_criteria->setLimit($no_posts);
     $_criteria->setStart(0);
     $postHandler =& wp_handler('Post');
     $postObjects =& $postHandler->getObjects($_criteria, false, '', 'DISTINCT', $_joinCriteria);
     //		echo $postHandler->getLastSQL();
     $lposts = array();
     foreach ($postObjects as $postObject) {
         $lposts[] =& $postObject->exportWpObject();
     }
     if ($lposts) {
         // Get the categories for all the posts
         $_post_id_list = array();
         foreach ($lposts as $post) {
             $_post_id_list[] = $post->ID;
             $GLOBALS['category_cache'][wp_id()][$post->ID] = array();
         }
         $_post_id_list = implode(',', $_post_id_list);
         $_post_id_criteria =& new Criteria('post_id', '(' . $_post_id_list . ')', 'IN');
         $_joinCriteria =& new XoopsJoinCriteria(wp_table('post2cat'), 'ID', 'post_id');
         $_joinCriteria->cascade(new XoopsJoinCriteria(wp_table('categories'), 'category_id', 'cat_ID'));
         $postObjects =& $postHandler->getObjects($_post_id_criteria, false, 'ID, category_id, cat_name, category_nicename, category_description, category_parent', true, $_joinCriteria);
         foreach ($postObjects as $postObject) {
             $_cat->ID = $postObject->getVar('ID');
             $_cat->category_id = $postObject->getExtraVar('category_id');
             $_cat->cat_name = $postObject->getExtraVar('cat_name');
             $_cat->category_nicename = $postObject->getExtraVar('category_nicename');
             $_cat->category_description = $postObject->getExtraVar('category_description');
             $_cat->category_parent = $postObject->getExtraVar('category_parent');
             $GLOBALS['category_cache'][wp_id()][$postObject->getVar('ID')][] =& $_cat;
             unset($_cat);
         }
         // Do the same for comment numbers
         $_post_id_criteria =& new Criteria('comment_post_ID', '(' . $_post_id_list . ')', 'IN');
         $_criteria =& new CriteriaCompo(new Criteria('post_status', 'publish'));
         $_criteria->add(new Criteria('comment_approved', '1 '));
         $_criteria->add($_post_id_criteria);
         $_criteria->setGroupBy('ID');
         $_joinCriteria =& new XoopsJoinCriteria(wp_table('comments'), 'ID', 'comment_post_ID');
         $postObjects =& $postHandler->getObjects($_criteria, false, 'ID, COUNT( comment_ID ) AS ccount', false, $_joinCriteria);
         foreach ($postObjects as $postObject) {
             $GLOBALS['comment_count_cache'][wp_id()]['' . $postObject->getVar('ID')] = $postObject->getExtraVar('ccount');
         }
         // Get post-meta info
         if ($meta_list = $GLOBALS['wpdb']->get_results('SELECT post_id, meta_key, meta_value FROM ' . wp_table('postmeta') . ' WHERE post_id IN(' . $_post_id_list . ') ORDER BY post_id, meta_key', ARRAY_A)) {
             // Change from flat structure to hierarchical:
             $GLOBALS['post_meta_cache'][wp_id()] = array();
             foreach ($meta_list as $metarow) {
                 $mpid = $metarow['post_id'];
                 $mkey = $metarow['meta_key'];
                 $mval = $metarow['meta_value'];
                 // Force subkeys to be array type:
                 if (!isset($GLOBALS['post_meta_cache'][wp_id()][$mpid]) || !is_array($GLOBALS['post_meta_cache'][wp_id()][$mpid])) {
                     $GLOBALS['post_meta_cache'][wp_id()][$mpid] = array();
                 }
                 if (!isset($GLOBALS['post_meta_cache'][wp_id()][$mpid]["{$mkey}"]) || !is_array($GLOBALS['post_meta_cache'][wp_id()][$mpid]["{$mkey}"])) {
                     $GLOBALS['post_meta_cache'][wp_id()][$mpid]["{$mkey}"] = array();
                 }
                 // Add a value to the current pid/key:
                 $GLOBALS['post_meta_cache'][wp_id()][$mpid]["{$mkey}"][] = $mval;
             }
         }
     }
     $blog = 1;
     $block = array();
     $block['use_theme_template'] = get_xoops_option(wp_mod(), 'use_theme_template');
     $block['style'] = block_style_get(false);
     $block['divid'] = 'wpBlockContent' . $wp_num;
     $block['template_content'] = "";
     $i = 0;
     $GLOBALS['previousday'] = 0;
     foreach ($lposts as $post) {
         $GLOBALS['post'] = $post;
         if ($block['use_theme_template'] == 0) {
             $content = array();
             start_wp();
             $content['date'] = the_date($GLOBALS['dateformat'], '', '', false);
             $content['time'] = the_time('', false);
             $content['title'] = the_title('', '', false);
             $content['permlink'] = get_permalink();
             $content['author'] = the_author_posts_link('', false);
             $content['category'] = the_category('', '', false);
             $content['body'] = the_content(_WP_TPL_MORE, 0, '', false);
             $content['linkpage'] = link_pages('<br />Pages: ', '<br />', 'number', 'next page', 'previous page', '%', '', false);
             if (get_xoops_option(wp_mod(), 'wp_use_xoops_comments') == 0) {
                 $content['comments'] = comments_popup_link(_WP_TPL_COMMENT0, _WP_TPL_COMMENT1, _WP_TPL_COMMENTS, '', 'Comments Off', false);
             } else {
                 $content['comments'] = xcomments_popup_link(_WP_TPL_COMMENT0, _WP_TPL_COMMENT1, _WP_TPL_COMMENTS, '', 'Comments Off', false);
                 $content['comments'] .= " | ";
                 $content['comments'] .= comments_popup_link(_WP_TPL_TRACKBACK0, _WP_TPL_TRACKBACK1, _WP_TPL_TRACKBACKS, '', 'Trackback Off', false);
             }
             $content['trackback'] = trackback_rdf(0, false);
             $block['contents'][] = $content;
         } else {
             ob_start();
             include get_custom_path('content_block-template.php');
             $block['template_content'] .= ob_get_contents();
             ob_end_clean();
         }
     }
     $_wpTpl =& new WordPresTpl('theme');
     $_wpTpl->assign('block', $block);
     if (!$_wpTpl->tpl_exists($tpl_file)) {
         $tpl_file = 'wp_contents.html';
     }
     $block['content'] = $_wpTpl->fetch($tpl_file);
     $GLOBALS['previousday'] = 0;
     $GLOBALS['day'] = 0;
     $GLOBALS['comment_count_cache'][wp_id()] = array();
     return $block;
 }
 function _b_wp_contents_show($options, $wp_num = "")
 {
     $no_posts = empty($options[0]) ? 10 : $options[0];
     $GLOBALS['dateformat'] = stripslashes(get_settings('date_format'));
     $GLOBALS['timeformat'] = stripslashes(get_settings('time_format'));
     $_criteria = new CriteriaCompo(new Criteria('post_status', 'publish'));
     $_criteria->add(new Criteria('post_date', current_time('mysql'), '<='));
     $_criteria->setGroupBy(wp_table('posts') . '.ID');
     $_criteria->setSort('post_date');
     $_criteria->setOrder('DESC');
     $_criteria->setLimit($no_posts);
     $_criteria->setStart(0);
     $postHandler =& wp_handler('Post');
     $postObjects =& $postHandler->getObjects($_criteria, false, '', 'DISTINCT');
     $lposts = array();
     foreach ($postObjects as $postObject) {
         $lposts[] =& $postObject->exportWpObject();
     }
     if ($lposts) {
         // Get the categories for all the posts
         $_post_id_list = array();
         foreach ($lposts as $post) {
             $_post_id_list[] = $post->ID;
             $GLOBALS['category_cache'][wp_id()][$post->ID] = array();
         }
         $_post_id_list = implode(',', $_post_id_list);
         $_post_id_criteria =& new Criteria('post_id', '(' . $_post_id_list . ')', 'IN');
         $_joinCriteria =& new XoopsJoinCriteria(wp_table('post2cat'), 'ID', 'post_id');
         $_joinCriteria->cascade(new XoopsJoinCriteria(wp_table('categories'), 'category_id', 'cat_ID'));
         $postObjects =& $postHandler->getObjects($_post_id_criteria, false, 'ID, category_id, cat_name, category_nicename, category_description, category_parent', true, $_joinCriteria);
         foreach ($postObjects as $postObject) {
             $_cat->ID = $postObject->getVar('ID');
             $_cat->category_id = $postObject->getExtraVar('category_id');
             $_cat->cat_name = $postObject->getExtraVar('cat_name');
             $_cat->category_nicename = $postObject->getExtraVar('category_nicename');
             $_cat->category_description = $postObject->getExtraVar('category_description');
             $_cat->category_parent = $postObject->getExtraVar('category_parent');
             $GLOBALS['category_cache'][wp_id()][$postObject->getVar('ID')][] =& $_cat;
             unset($_cat);
         }
         // Do the same for comment numbers
         $_criteria =& new CriteriaCompo(new Criteria('post_status', 'publish'));
         $_criteria->add(new Criteria('comment_approved', '1 '));
         $_criteria->add($_post_id_criteria);
         $_criteria->setGroupBy('ID');
         $_joinCriteria =& new XoopsJoinCriteria(wp_table('comments'), 'ID', 'comment_post_ID');
         $postObjects =& $postHandler->getObjects($_criteria, false, 'ID, COUNT( comment_ID ) AS ccount', false, $_joinCriteria);
         foreach ($postObjects as $postObject) {
             $GLOBALS['comment_count_cache'][wp_id()]['' . $postObject->getVar('ID')] = $postObject->getExtraVar('ccount');
         }
     }
     $blog = 1;
     $block = array();
     $block['use_theme_template'] = get_xoops_option(wp_mod(), 'use_theme_template');
     $block['style'] = block_style_get(false);
     $block['divid'] = 'wpBlockContent' . $wp_num;
     $block['template_content'] = "";
     $i = 0;
     $GLOBALS['previousday'] = 0;
     foreach ($lposts as $post) {
         $GLOBALS['post'] = $post;
         if ($block['use_theme_template'] == 0) {
             $content = array();
             start_wp();
             $content['date'] = the_date($GLOBALS['dateformat'], '', '', false);
             $content['time'] = the_time('', false);
             $content['title'] = the_title('', '', false);
             $content['permlink'] = get_permalink();
             $content['author'] = the_author_posts_link('', false);
             $content['category'] = the_category('', '', false);
             $content['body'] = the_content(_WP_TPL_MORE, 0, '', false);
             $content['linkpage'] = link_pages('<br />Pages: ', '<br />', 'number', 'next page', 'previous page', '%', '', false);
             if (get_xoops_option(wp_mod(), 'wp_use_xoops_comments') == 0) {
                 $content['comments'] = comments_popup_link(_WP_TPL_COMMENT0, _WP_TPL_COMMENT1, _WP_TPL_COMMENTS, '', 'Comments Off', false);
             } else {
                 $content['comments'] = xcomments_popup_link(_WP_TPL_COMMENT0, _WP_TPL_COMMENT1, _WP_TPL_COMMENTS, '', 'Comments Off', false);
                 $content['comments'] .= " | ";
                 $content['comments'] .= comments_popup_link(_WP_TPL_COMMENT0, _WP_TPL_COMMENT1, _WP_TPL_COMMENTS, '', 'Comments Off', false);
             }
             $content['trackback'] = trackback_rdf(0, false);
             $block['contents'][] = $content;
         } else {
             ob_start();
             include get_custom_path('content_block-template.php');
             $block['template_content'] .= ob_get_contents();
             ob_end_clean();
         }
     }
     $GLOBALS['previousday'] = 0;
     $GLOBALS['day'] = 0;
     $GLOBALS['comment_count_cache'][wp_id()] = array();
     return $block;
 }
Example #13
0
        function export_wp($cats)
        {
            global $wpdb, $posts, $post;
            $filename = 'wordpress.' . date('Y-m-d') . '.xml';
            header('Content-Description: File Transfer');
            header('Content-Type: application/octet-stream');
            header("Content-Disposition: attachment; filename={$filename}");
            header('Content-type: text/xml; charset=' . get_settings('blog_charset'), true);
            $posts = query_posts('');
            $cats = implode(',', $cats);
            $postswithcats = $wpdb->get_col("SELECT DISTINCT(post_id) FROM " . $wpdb->post2cat . " WHERE category_id IN ({$cats})");
            $postcats = implode(',', $postswithcats);
            $posts = $wpdb->get_results("SELECT * FROM {$wpdb->posts} WHERE ID IN ({$postcats}) ORDER BY post_date_gmt ASC");
            ?>
<!-- generator="wordpress/<?php 
            bloginfo_rss('version');
            ?>
" created="<?php 
            echo date('Y-m-d H:m');
            ?>
"-->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:wp="http://wordpress.org/export/1.0/"
>

<channel>
	<title><?php 
            bloginfo_rss('name');
            ?>
</title>
	<link><?php 
            bloginfo_rss('url');
            ?>
</link>
	<description><?php 
            bloginfo_rss("description");
            ?>
</description>
	<pubDate><?php 
            echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), false);
            ?>
</pubDate>
	<generator>http://wordpress.org/?v=<?php 
            bloginfo_rss('version');
            ?>
</generator>
	<language><?php 
            echo get_option('rss_language');
            ?>
</language>
	<?php 
            do_action('rss2_head');
            if ($posts) {
                foreach ($posts as $post) {
                    start_wp();
                    ?>
<item>
<title><?php 
                    the_title_rss();
                    ?>
</title>
<link><?php 
                    permalink_single_rss();
                    ?>
</link>
<pubDate><?php 
                    echo mysql2date('D, d M Y H:i:s +0000', get_post_time('Y-m-d H:i:s', true), false);
                    ?>
</pubDate>
<dc:creator><?php 
                    the_author();
                    ?>
</dc:creator>
<?php 
                    the_category_rss();
                    ?>

<guid isPermaLink="false"><?php 
                    the_guid();
                    ?>
</guid>
<description></description>
<wp:excerpt><![CDATA[<?php 
                    echo $post->post_excerpt;
                    ?>
]]></wp:excerpt>
<content:encoded><![CDATA[<?php 
                    echo $post->post_content;
                    ?>
]]></content:encoded>
<wp:post_date><?php 
                    echo $post->post_date;
                    ?>
</wp:post_date>
<wp:post_date_gmt><?php 
                    echo $post->post_date_gmt;
                    ?>
</wp:post_date_gmt>
<wp:comment_status><?php 
                    echo $post->comment_status;
                    ?>
</wp:comment_status>
<wp:ping_status><?php 
                    echo $post->ping_status;
                    ?>
</wp:ping_status>
<wp:post_name><?php 
                    echo $post->post_name;
                    ?>
</wp:post_name>
<wp:status><?php 
                    echo $post->post_status;
                    ?>
</wp:status>
<wp:post_parent><?php 
                    echo $post->post_parent;
                    ?>
</wp:post_parent>
<wp:post_type><?php 
                    echo $post->post_type;
                    ?>
</wp:post_type>
<?php 
                    $postmeta = $wpdb->get_results("SELECT * FROM {$wpdb->postmeta} WHERE post_id = {$post->ID}");
                    if ($postmeta) {
                        foreach ($postmeta as $meta) {
                            ?>
	
<wp:postmeta>
<wp:meta_key><?php 
                            echo $meta->meta_key;
                            ?>
</wp:meta_key>
<wp:meta_value><?php 
                            echo $meta->meta_value;
                            ?>
</wp:meta_value>
</wp:postmeta>
<?php 
                        }
                    }
                    $comments = $wpdb->get_results("SELECT * FROM {$wpdb->comments} WHERE comment_post_ID = {$post->ID}");
                    if ($comments) {
                        foreach ($comments as $c) {
                            ?>
<wp:comment>
<wp:comment_author><?php 
                            echo htmlent2numeric($c->comment_author);
                            ?>
</wp:comment_author>
<wp:comment_author_email><?php 
                            echo $c->comment_author_email;
                            ?>
</wp:comment_author_email>
<wp:comment_author_url><?php 
                            echo $c->comment_author_url;
                            ?>
</wp:comment_author_url>
<wp:comment_author_IP><?php 
                            echo $c->comment_author_IP;
                            ?>
</wp:comment_author_IP>
<wp:comment_date><?php 
                            echo $c->comment_date;
                            ?>
</wp:comment_date>
<wp:comment_date_gmt><?php 
                            echo $c->comment_date_gmt;
                            ?>
</wp:comment_date_gmt>
<wp:comment_content><?php 
                            echo htmlent2numeric($c->comment_content);
                            ?>
</wp:comment_content>
<wp:comment_approved><?php 
                            echo $c->comment_approved;
                            ?>
</wp:comment_approved>
<wp:comment_type><?php 
                            echo $c->comment_type;
                            ?>
</wp:comment_type>
<wp:comment_parent><?php 
                            echo $c->comment_parent;
                            ?>
</wp:comment_parent>
</wp:comment>
<?php 
                        }
                    }
                    ?>
	</item>
<?php 
                }
            }
            ?>
</channel>
</rss>
<?php 
            exit;
            wp_redirect('admin.php');
        }
Example #14
0
  <?php if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('Bottom Widgets')) : ?>
  
  
  
  <div class="three"><h4>Theme Features</h4>
  <div class="textwidget"><p>Welcome to the Layers Theme which was designed for the artist in mind. Whether you are an illustrator, graphic designer, a Photographer, or other, you will find this theme is best suited to showcase your artistic abilities. Use it as a blog or even a portfolio...the clean style and clean edges will help put more focus on your creativity.</p>
  <ul>
  <li>Theme Settings for personalization</li>
  <li>Almost unlimited colour variations</li>
  <li>4 Showcase options</li>
  <li>Custom Google Fonts</li>
  <li>...and more!</li>
  </ul></div>
		</div><div class="three"><h4>Showcase Options</h4><div class="textwidget"><p>Layers comes with 4 Showcase options to give you choices without using plugins.</p>
		<img src="<?php bloginfo('template_directory'); ?>/images/smScreenshot.jpg" class="aligncenter"></div>

		</div><div class="three"><h4><?php _e( 'Recent Posts', 'pts' ); ?></h4>			<div class="textwidget"><p>Check out the recent articles posted here with the Layers Theme and keep up to date with the latest news along with great photographic imagery that shows the great things in nature. </p>
		
<ul>
<?php query_posts('category_id=1&showposts=5');?>
<?php $posts = get_posts('category=#&numberposts=#&offset=0');
	foreach ($posts as $post) : start_wp(); ?>
<li><a href="<?php echo get_permalink() ?>"><?php the_title(); ?></a></li>
<?php endforeach; ?></ul></div>
		</div><div class="clearfix"></div>
		
		
		
  <?php endif; ?>
  <div  class="clearfix"></div></div>
</div>
function podPress_xspf_playlist()
{
    global $podPress, $more, $posts, $post, $m;
    header('HTTP/1.0 200 OK');
    header('Content-type: application/xspf+xml; charset=' . get_bloginfo('charset'), true);
    header('Content-Disposition: attachment; filename="playlist.xspf"');
    header('Cache-Control: no-cache, must-revalidate');
    // HTTP/1.1
    header('Expires: Wed, 28 Oct 2010 05:00:00 GMT');
    // Date in the past
    $more = 1;
    echo '<?xml version="1.0" encoding="' . get_bloginfo('charset') . '" ?' . ">\n";
    echo '<playlist version="1" xmlns="http://xspf.org/ns/0/">' . "\n";
    echo "\t" . '<title>' . podPress_feedSafeContent(get_bloginfo('blogname')) . '</title>' . "\n";
    echo "\t" . '<annotation><![CDATA[' . $podPress->settings['iTunes']['summary'] . ']]></annotation>' . "\n";
    if (empty($podPress->settings['iTunes']['author'])) {
        $creator = get_bloginfo('blogname');
    } else {
        $creator = $podPress->settings['iTunes']['author'];
    }
    echo "\t" . '<creator>' . podPress_feedSafeContent($creator) . '</creator>' . "\n";
    echo "\t" . '<location>' . get_feed_link('playlist.xspf') . '</location>' . "\n";
    if (!empty($podPress->settings['rss_license_url'])) {
        echo "\t" . '<license>' . $podPress->settings['rss_license_url'] . '</license>' . "\n";
    }
    echo "\t" . '<trackList>' . "\n";
    if (isset($posts)) {
        foreach ($posts as $post) {
            start_wp();
            /* This is a call to a very very old function and it seems to be not necessary if $post is global. */
            $enclosureTag = podPress_getEnclosureTags('xspf');
            if ($enclosureTag != '') {
                // if no enclosure tag, no need for track tags
                $is_password_protected = podpress_post_is_password_protected();
                if (FALSE === $is_password_protected) {
                    echo $enclosureTag;
                }
            }
        }
    }
    echo "\t" . '</trackList>' . "\n";
    echo '</playlist>' . "\n";
    exit;
}
<?php } ?>

	</tr>
<?php
$what_to_show = 'posts';
if ( empty($_GET['m']) || 0 == $_GET['m'] && empty($_GET['s']) ) {
  $showposts = 15;
} else {
  $nopaging = true;
}

include(ABSPATH.'wp-blog-header.php');

if ($posts) {
$bgcolor = '';
foreach ($posts as $post) { start_wp();
$class = ('alternate' == $class) ? '' : 'alternate';
?> 
	<tr class='<?php echo $class; ?>'>

<?php

foreach($posts_columns as $column_name=>$column_display_name) {

	switch($column_name) {
	
	case 'id':
		?>
		<th scope="row"><?php echo $id ?></th>
		<?php
		break;
function page_rows($parent = 0, $level = 0, $pages = 0)
{
    global $wpdb, $class, $user_level, $post;
    if (!$pages) {
        $pages = $wpdb->get_results("SELECT * FROM {$wpdb->posts} WHERE post_status = 'static' ORDER BY menu_order");
    }
    if ($pages) {
        foreach ($pages as $post) {
            start_wp();
            if ($post->post_parent == $parent) {
                $post->post_title = wp_specialchars($post->post_title);
                $pad = str_repeat('&#8212; ', $level);
                $id = $post->ID;
                $class = 'alternate' == $class ? '' : 'alternate';
                ?>
<tr class='<?php 
                echo $class;
                ?>
'>
	<th scope="row"><?php 
                echo $post->ID;
                ?>
</th>
	<td>
	<?php 
                echo $pad;
                the_title();
                ?>
	</td>
	<td><?php 
                the_author();
                ?>
</td>
	<td><?php 
                echo mysql2date('Y-m-d g:i a', $post->post_modified);
                ?>
</td>
	<td><a href="<?php 
                the_permalink();
                ?>
" rel="permalink" class="edit"><?php 
                _e('View');
                ?>
</a></td>
	<td><?php 
                if ($user_level > $authordata->user_level or $user_login == $authordata->user_login) {
                    echo "<a href='post.php?action=edit&amp;post={$id}' class='edit'>" . __('Edit') . "</a>";
                }
                ?>
</td>
	<td><?php 
                if ($user_level > $authordata->user_level or $user_login == $authordata->user_login) {
                    echo "<a href='post.php?action=delete&amp;post={$id}' class='delete' onclick=\"return confirm('" . sprintf(__("You are about to delete this post \\'%s\\'\\n  \\'OK\\' to delete, \\'Cancel\\' to stop."), the_title('', '', 0)) . "')\">" . __('Delete') . "</a>";
                }
                ?>
</td>
</tr>

<?php 
                page_rows($id, $level + 1, $pages);
            }
        }
    } else {
        return false;
    }
}
 function b_wp_contents_show($options, $wp_num = "")
 {
     $no_posts = empty($options[0]) ? 10 : $options[0];
     global $wpdb, $siteurl, $post, $use_cache;
     global $smilies_directory, $wp_smiliessearch, $wp_smiliesreplace;
     global $wp_bbcode, $wp_gmcode, $wp_htmltrans, $wp_htmltranswinuni;
     global $wp_id, $wp_inblock, $xoopsConfig, $previousday, $time_difference;
     $id = 1;
     $use_cache = 1;
     if ($wp_num == "") {
         $wp_id = $wp_num;
         $wp_inblock = 1;
         require dirname(__FILE__) . '/../wp-config.php';
         $wp_inblock = 0;
     }
     global $dateformat, $timeformat;
     $dateformat = stripslashes(get_settings('date_format'));
     $timeformat = stripslashes(get_settings('time_format'));
     $now = date('Y-m-d H:i:s', time() + $time_difference * 3600);
     $request = "SELECT DISTINCT * FROM {$wpdb->posts[$wp_id]} ";
     $request .= " LEFT JOIN {$wpdb->post2cat[$wp_id]} ON ({$wpdb->posts[$wp_id]}.ID = {$wpdb->post2cat[$wp_id]}.post_id) ";
     $request .= "WHERE post_status = 'publish' ";
     $request .= " AND post_date <= '" . $now . "'";
     $request .= " GROUP BY {$wpdb->posts[$wp_id]}.ID ORDER BY post_date DESC LIMIT 0, {$no_posts}";
     $lposts = $wpdb->get_results($request);
     $blog = 1;
     $block = array();
     $block['use_theme_template'] = get_xoops_option('wordpress' . $wp_num, 'use_theme_template');
     //		if (file_exists(XOOPS_ROOT_PATH.'/modules/wordpress'. (($wp_id=='-')?'':$wp_id) .'/themes/'.$xoopsConfig['theme_set'].'/wp-blocks.css.php')) {
     //			$themes = $xoopsConfig['theme_set'];
     //		} else {
     //			$themes = "default";
     //		}
     //		include_once(XOOPS_ROOT_PATH."/modules/wordpress". (($wp_id=='-')?'':$wp_id) ."/themes/".$themes."/wp-blocks.css.php");
     //
     if (file_exists(XOOPS_ROOT_PATH . '/modules/wordpress' . ($wp_id == '-' ? '' : $wp_id) . '/themes/' . $xoopsConfig['theme_set'] . '/content_block-template.php')) {
         $themes = $xoopsConfig['theme_set'];
     } else {
         $themes = "default";
     }
     $template_fname = XOOPS_ROOT_PATH . "/modules/wordpress" . ($wp_id == '-' ? '' : $wp_id) . "/themes/" . $themes . "/content_block-template.php";
     $block['style'] = block_style_get($wp_num, false);
     $block['divid'] = 'wpBlockContent' . $wp_num;
     $block['template_content'] = "";
     $i = 0;
     $previousday = 0;
     foreach ($lposts as $post) {
         if ($block['use_theme_template'] == 0) {
             $content = array();
             start_wp();
             $content['date'] = the_date($dateformat, '', '', false);
             $content['time'] = the_time('', false);
             $content['title'] = the_title('', '', false);
             $content['permlink'] = get_permalink();
             //
             ob_start();
             the_author();
             $content['author'] = ob_get_contents();
             ob_end_clean();
             //
             ob_start();
             the_category();
             $content['category'] = ob_get_contents();
             ob_end_clean();
             //
             ob_start();
             the_content();
             $content['body'] = ob_get_contents();
             ob_end_clean();
             //
             ob_start();
             link_pages('<br />Pages: ', '<br />', 'number');
             $content['linkpage'] = ob_get_contents();
             ob_end_clean();
             //
             ob_start();
             comments_popup_link(_WP_TPL_COMMENT0, _WP_TPL_COMMENT1, _WP_TPL_COMMENTS);
             $content['comments'] = ob_get_contents();
             ob_end_clean();
             //
             ob_start();
             trackback_rdf();
             $content['trackback'] = ob_get_contents();
             ob_end_clean();
             //
             $block['contents'][] = $content;
         } else {
             ob_start();
             include $template_fname;
             $block['template_content'] .= ob_get_contents();
             ob_end_clean();
         }
     }
     $previousday = 0;
     return $block;
 }
Example #19
0
function dsq_export_wp()
{
    global $wpdb, $posts, $post, $wp_version;
    global $dsq_api;
    $filename = dsq_get_temp_dir() . 'disqus-wordpress.' . date('Y-m-d') . '.xml';
    $fp = fopen($filename, 'w');
    ob_start();
    $where = '';
    if (isset($_GET['author']) && $_GET['author'] != 'all') {
        $author_id = (int) $_GET['author'];
        $where = " WHERE post_author = '{$author_id}' ";
    }
    $posts = $wpdb->get_results("SELECT * FROM {$wpdb->posts} {$where} ORDER BY post_date_gmt ASC");
    function wxr_site_url()
    {
        global $current_site;
        // mu: the base url
        if (isset($current_site->domain)) {
            return 'http://' . $current_site->domain . $current_site->path;
        } else {
            return get_bloginfo_rss('url');
        }
    }
    function wxr_cdata($str)
    {
        if (seems_utf8($str) == false) {
            $str = utf8_encode($str);
        }
        // $str = ent2ncr(wp_specialchars($str));
        $str = "<![CDATA[{$str}" . (substr($str, -1) == ']' ? ' ' : '') . "]]>";
        return $str;
    }
    function wxr_cat_name($c)
    {
        if (empty($c->cat_name)) {
            return;
        }
        echo '<wp:cat_name>' . wxr_cdata($c->cat_name) . '</wp:cat_name>';
    }
    function wxr_category_description($c)
    {
        if (empty($c->category_description)) {
            return;
        }
        echo '<wp:category_description>' . wxr_cdata($c->category_description) . '</wp:category_description>';
    }
    print '<?xml version="1.0" encoding="' . get_bloginfo('charset') . '"?' . ">\n";
    ?>

	<!--
		This is a WordPress eXtended RSS file generated by WordPress as an export of
		your blog. It contains information about your blog's posts, comments, and
		categories. You may use this file to transfer that content from one site to
		another. This file is not intended to serve as a complete backup of your
		blog.

		To import this information into a WordPress blog follow these steps:

		1.	Log into that blog as an administrator.
		2.	Go to Manage > Import in the blog's admin.
		3.	Choose "WordPress" from the list of importers.
		4.	Upload this file using the form provided on that page.
		5.	You will first be asked to map the authors in this export file to users
			on the blog. For each author, you may choose to map an existing user on
			the blog or to create a new user.
		6.	WordPress will then import each of the posts, comments, and categories
			contained in this file onto your blog.
	-->

	<!-- generator="wordpress/<?php 
    bloginfo_rss('version');
    ?>
" created="<?php 
    echo date('Y-m-d H:i');
    ?>
"-->
	<rss version="2.0"
		xmlns:content="http://purl.org/rss/1.0/modules/content/"
		xmlns:wfw="http://wellformedweb.org/CommentAPI/"
		xmlns:dc="http://purl.org/dc/elements/1.1/"
		xmlns:wp="http://wordpress.org/export/<?php 
    echo WXR_VERSION;
    ?>
/"
	>

	<channel>
		<title><?php 
    bloginfo_rss('name');
    ?>
</title>
		<link><?php 
    bloginfo_rss('url');
    ?>
</link>
		<description><?php 
    bloginfo_rss("description");
    ?>
</description>
		<pubDate><?php 
    echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), false);
    ?>
</pubDate>
		<generator>http://wordpress.org/?v=<?php 
    bloginfo_rss('version');
    ?>
</generator>
		<language><?php 
    echo get_option('rss_language');
    ?>
</language>
		<wp:wxr_version><?php 
    echo WXR_VERSION;
    ?>
</wp:wxr_version>
		<wp:base_site_url><?php 
    echo wxr_site_url();
    ?>
</wp:base_site_url>
		<wp:base_blog_url><?php 
    bloginfo_rss('url');
    ?>
</wp:base_blog_url>

	<?php 
    $contents = ob_get_clean();
    fwrite($fp, $contents);
    ?>

	<?php 
    if ($cats) {
        foreach ($cats as $c) {
            ?>
	<?php 
            ob_start();
            ?>
		<wp:category><wp:category_nicename><?php 
            echo $c->category_nicename;
            ?>
</wp:category_nicename><wp:category_parent><?php 
            echo $c->category_parent ? $cats[$c->category_parent]->cat_name : '';
            ?>
</wp:category_parent><wp:posts_private><?php 
            echo $c->posts_private ? '1' : '0';
            ?>
</wp:posts_private><wp:links_private><?php 
            echo $c->links_private ? '1' : '0';
            ?>
</wp:links_private><?php 
            wxr_cat_name($c);
            wxr_category_description($c);
            ?>
</wp:category>
	<?php 
            $contents = ob_get_clean();
            fwrite($fp, $contents);
            ?>
	<?php 
        }
    }
    ?>
		<?php 
    do_action('rss2_head');
    ?>
		<?php 
    if ($posts) {
        foreach ($posts as $post) {
            ob_start();
            start_wp();
            ?>
	<item>
	<title><?php 
            the_title_rss();
            ?>
</title>
	<link><?php 
            permalink_single_rss();
            ?>
</link>
	<pubDate><?php 
            echo mysql2date('D, d M Y H:i:s +0000', get_post_time('Y-m-d H:i:s', true), false);
            ?>
</pubDate>
	<dc:creator><?php 
            the_author();
            ?>
</dc:creator>
	<?php 
            the_category_rss();
            ?>

	<guid isPermaLink="false"><?php 
            the_guid();
            ?>
</guid>
	<description></description>
	<content:encoded><![CDATA[<?php 
            echo $post->post_content;
            ?>
]]></content:encoded>
	<wp:post_id><?php 
            echo $post->ID;
            ?>
</wp:post_id>
	<wp:post_date><?php 
            echo $post->post_date;
            ?>
</wp:post_date>
	<wp:post_date_gmt><?php 
            echo $post->post_date_gmt;
            ?>
</wp:post_date_gmt>
	<wp:comment_status><?php 
            echo $post->comment_status;
            ?>
</wp:comment_status>
	<wp:ping_status><?php 
            echo $post->ping_status;
            ?>
</wp:ping_status>
	<wp:post_name><?php 
            echo $post->post_name;
            ?>
</wp:post_name>
	<wp:status><?php 
            echo $post->post_status;
            ?>
</wp:status>
	<wp:post_parent><?php 
            echo $post->post_parent;
            ?>
</wp:post_parent>
	<wp:menu_order><?php 
            echo $post->menu_order;
            ?>
</wp:menu_order>
	<wp:post_type><?php 
            echo $post->post_type;
            ?>
</wp:post_type>
	<?php 
            $postmeta = $wpdb->get_results("SELECT * FROM {$wpdb->postmeta} WHERE post_id = {$post->ID}");
            if ($postmeta) {
                ?>
	<?php 
                foreach ($postmeta as $meta) {
                    ?>
	<wp:postmeta>
	<wp:meta_key><?php 
                    echo $meta->meta_key;
                    ?>
</wp:meta_key>
	<wp:meta_value><?php 
                    echo $meta->meta_value;
                    ?>
</wp:meta_value>
	</wp:postmeta>
	<?php 
                }
                ?>
	<?php 
            }
            ?>
	<?php 
            $contents = ob_get_clean();
            fwrite($fp, $contents);
            ?>
	<?php 
            $comments = $wpdb->get_results("SELECT * FROM {$wpdb->comments} WHERE comment_post_ID = {$post->ID} AND comment_agent NOT LIKE 'Disqus/%'");
            ob_start();
            if ($comments) {
                foreach ($comments as $c) {
                    ?>
	<wp:comment>
	<wp:comment_id><?php 
                    echo $c->comment_ID;
                    ?>
</wp:comment_id>
	<wp:comment_author><?php 
                    echo $c->comment_author;
                    ?>
</wp:comment_author>
	<wp:comment_author_email><?php 
                    echo $c->comment_author_email;
                    ?>
</wp:comment_author_email>
	<wp:comment_author_url><?php 
                    echo $c->comment_author_url;
                    ?>
</wp:comment_author_url>
	<wp:comment_author_IP><?php 
                    echo $c->comment_author_IP;
                    ?>
</wp:comment_author_IP>
	<wp:comment_date><?php 
                    echo $c->comment_date;
                    ?>
</wp:comment_date>
	<wp:comment_date_gmt><?php 
                    echo $c->comment_date_gmt;
                    ?>
</wp:comment_date_gmt>
	<wp:comment_content><?php 
                    echo $c->comment_content;
                    ?>
</wp:comment_content>
	<wp:comment_approved><?php 
                    echo $c->comment_approved;
                    ?>
</wp:comment_approved>
	<wp:comment_type><?php 
                    echo $c->comment_type;
                    ?>
</wp:comment_type>
	<wp:comment_parent><?php 
                    echo $c->comment_parent;
                    ?>
</wp:comment_parent>
	</wp:comment>
	<?php 
                }
            }
            ?>
		</item>
	<?php 
            $contents = ob_get_clean();
            fwrite($fp, $contents);
            ?>
	<?php 
        }
    }
    ?>
	<?php 
    ob_start();
    ?>
	</channel>
	</rss>
<?php 
    $contents = ob_get_clean();
    fwrite($fp, $contents);
    $response = $dsq_api->import_wordpress_comments($filename);
    $import_id = $response;
    unlink($filename);
    if ($response < 0) {
        dsq_manage_dialog("There was an error exporting your comments. If your API key has changed, you may need to reinstall DISQUS (deactivate the plugin and then reactivate it). If you are still having issues, refer to the <a href='http://disqus.com/comments/wordpress'>WordPress help page</a>.", true);
    } else {
        update_option('disqus_last_import_id', $import_id);
        dsq_manage_dialog('Your comments have been queued for importing to DISQUS. You may check the advanced options tab for a status update.');
    }
}
	<link><?php bloginfo_rss('url') ?></link>
	<description><?php bloginfo_rss('description') ?></description>
	<dc:date><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastpostmodified('GMT')); ?></dc:date>
	<admin:generatorAgent rdf:resource="http://wordpress.org/?v=<?php echo $wp_version ?>"/>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<sy:updateBase>2000-01-01T12:00+00:00</sy:updateBase>
	<items>
		<rdf:Seq>
		<?php $items_count = 0; if ($posts) { foreach ($posts as $post) { start_wp(); ?>
			<rdf:li rdf:resource="<?php permalink_single_rss() ?>"/>
		<?php $wp_items[] = $row; $items_count++; if (($items_count == get_settings('posts_per_rss')) && empty($m)) { break; } } } ?>
		</rdf:Seq>
	</items>
</channel>
<?php if ($posts) { foreach ($posts as $post) { start_wp(); ?>
<item rdf:about="<?php permalink_single_rss() ?>">
	<title><?php the_title_rss() ?></title>
	<link><?php permalink_single_rss() ?></link>
	<dc:date><?php echo mysql2date('Y-m-d\TH:i:s\Z', $post->post_date_gmt); ?></dc:date>
	<dc:creator><?php the_author() ?></dc:creator>
	<?php the_category_rss('rdf') ?>
<?php if (get_settings('rss_use_excerpt')) : ?>
	<description><?php the_excerpt_rss() ?></description>
<?php else : ?>
	<description><?php the_content_rss('', 0, '', get_settings('rss_excerpt_length'), 2) ?></description>
	<content:encoded><![CDATA[<?php the_content('', 0, '') ?>]]></content:encoded>
<?php endif; ?>
	
</item>
<?php } }  ?>