PS Auto Sitemap - Version 1.0.7

Version Description

Download this release

Release Info

Developer jim912
Plugin Icon wp plugin PS Auto Sitemap
Version 1.0.7
Comparing to
See all releases

Code changes from version 1.0.6 to 1.0.7

Files changed (2) hide show
  1. ps_auto_sitemap.php +24 -9
  2. readme.txt +14 -4
ps_auto_sitemap.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: PS Auto Sitemap
4
  Plugin URI: http://www.web-strategy.jp/wp_plugin/ps_auto_sitemap/
5
  Description: Auto generator of a customizable and designed sitemap page.
6
  Author: Hitoshi Omagari
7
- Version: 1.0.6
8
  Author URI: http://www.web-strategy.jp/
9
  */
10
 
@@ -124,9 +124,14 @@ class ps_auto_sitemap {
124
 
125
 
126
  function make_post_list( $ex_post_ids, $category_tree, $depth, $cur_depth = 1 , $child = true ) {
 
 
127
  if ( ! is_array( $category_tree ) ) { return; }
128
 
129
  $ps_sitemap_query = new WP_query();
 
 
 
130
 
131
  if ( $child ) {
132
  $post_list = "\n<ul>\n";
@@ -137,17 +142,28 @@ class ps_auto_sitemap {
137
  foreach( $category_tree as $cat_id => $category ) {
138
  $post_list .= '<li class="cat-item cat-item-' . $cat_id . '"><a href="' . get_category_link( $cat_id ). '" title="' . get_the_category_by_ID( $cat_id ) . '">' . wp_specialchars( get_the_category_by_ID( $cat_id ) ) . '</a>';
139
 
140
- $query = array(
141
- 'showposts' => '-1',
142
- 'category__in' => array( $cat_id ),
143
- 'post__not_in' => explode( ',', $ex_post_ids )
144
- );
145
  if ( ! $depth || $depth > $cur_depth ) {
146
- $category_posts = $ps_sitemap_query->query( $query );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
147
  if ( $category_posts ) {
148
  $post_list .= "\n<ul>\n";
149
  foreach( $category_posts as $post ) {
150
- $post_list .= "\t" . '<li class="post-item post-item-' . $post->ID . '"><a href="' . get_permalink( $post->ID ) . '" title="' . $post->post_title . '">' . wp_specialchars( $post->post_title ) . "</a></li>\n";
151
  }
152
  if ( ! count( $category ) ) {
153
  $post_list .= "</ul>\n";
@@ -165,7 +181,6 @@ class ps_auto_sitemap {
165
  if ( $child ) {
166
  $post_list .= "</ul>\n";
167
  }
168
- unset( $ps_sitemap_query );
169
  return $post_list;
170
  }
171
 
4
  Plugin URI: http://www.web-strategy.jp/wp_plugin/ps_auto_sitemap/
5
  Description: Auto generator of a customizable and designed sitemap page.
6
  Author: Hitoshi Omagari
7
+ Version: 1.0.7
8
  Author URI: http://www.web-strategy.jp/
9
  */
10
 
124
 
125
 
126
  function make_post_list( $ex_post_ids, $category_tree, $depth, $cur_depth = 1 , $child = true ) {
127
+ global $wpdb;
128
+
129
  if ( ! is_array( $category_tree ) ) { return; }
130
 
131
  $ps_sitemap_query = new WP_query();
132
+ $ex_post_ids = preg_replace( '/[^\d,]/', '', $ex_post_ids );
133
+ $ex_post_ids = trim( $ex_post_ids, ',' );
134
+ $ex_post_ids = "'" . str_replace( ',', "','", $ex_post_ids ) . "'";
135
 
136
  if ( $child ) {
137
  $post_list = "\n<ul>\n";
142
  foreach( $category_tree as $cat_id => $category ) {
143
  $post_list .= '<li class="cat-item cat-item-' . $cat_id . '"><a href="' . get_category_link( $cat_id ). '" title="' . get_the_category_by_ID( $cat_id ) . '">' . wp_specialchars( get_the_category_by_ID( $cat_id ) ) . '</a>';
144
 
 
 
 
 
 
145
  if ( ! $depth || $depth > $cur_depth ) {
146
+ $query = "
147
+ SELECT `posts`.`ID`,
148
+ `posts`.`post_title`
149
+ FROM $wpdb->posts as `posts`
150
+ INNER JOIN $wpdb->term_relationships as `relation`
151
+ ON ( `posts`.`ID` = `relation`.`object_id` )
152
+ INNER JOIN $wpdb->term_taxonomy as `taxonomy`
153
+ ON (`relation`.`term_taxonomy_id` = `taxonomy`.`term_taxonomy_id` )
154
+ INNER JOIN $wpdb->terms as `terms`
155
+ ON ( `taxonomy`.`term_id` = `terms`.`term_id` )
156
+ WHERE `posts`.`post_status` = 'publish'
157
+ AND `posts`.`post_type` = 'post'
158
+ AND `posts`.`ID` NOT IN ( $ex_post_ids )
159
+ AND `terms`.`term_id` = '$cat_id'
160
+ ORDER BY `posts`.`post_date`
161
+ DESC";
162
+ $category_posts = $wpdb->get_results( $query, ARRAY_A );
163
  if ( $category_posts ) {
164
  $post_list .= "\n<ul>\n";
165
  foreach( $category_posts as $post ) {
166
+ $post_list .= "\t" . '<li class="post-item post-item-' . $post['ID'] . '"><a href="' . get_permalink( $post['ID'] ) . '" title="' . attribute_escape( $post['post_title'] ) . '">' . wp_specialchars( $post['post_title'] ) . "</a></li>\n";
167
  }
168
  if ( ! count( $category ) ) {
169
  $post_list .= "</ul>\n";
181
  if ( $child ) {
182
  $post_list .= "</ul>\n";
183
  }
 
184
  return $post_list;
185
  }
186
 
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: jim912
3
  Tags: sitemap, post, page, seo, cms
4
  Requires at least: 2.3.1
5
  Tested up to: 2.7
6
- Stable tag: 1.0.6
7
 
8
  Auto generator of a customizable and designed sitemap page.
9
 
@@ -16,8 +16,7 @@ It can change the settings of the display of the lists from administration page,
16
 
17
  When you use WordPress as CMS of the Web site, you can expect the **effect of SEO**, **improvement of the usability**, and so on.
18
 
19
- Functions of "PS Auto Sitemap":
20
-
21
  * Display/hide of particular categories and posts.
22
  * Display/hide of pages.
23
  * Limitation of the depth of the list.
@@ -26,7 +25,18 @@ Functions of "PS Auto Sitemap":
26
  * Set the excluded posts or pages from the list.
27
  * Select the display style of the site map from five prepared designs (or no style).
28
 
29
-
 
 
 
 
 
 
 
 
 
 
 
30
  == Installation ==
31
  1. Unzip the downloaded package and upload into your WordPress plugins directory.
32
  If you use WordPress 2.7 or later, you can install from admin page.
3
  Tags: sitemap, post, page, seo, cms
4
  Requires at least: 2.3.1
5
  Tested up to: 2.7
6
+ Stable tag: trunk
7
 
8
  Auto generator of a customizable and designed sitemap page.
9
 
16
 
17
  When you use WordPress as CMS of the Web site, you can expect the **effect of SEO**, **improvement of the usability**, and so on.
18
 
19
+ = Functions of "PS Auto Sitemap": =
 
20
  * Display/hide of particular categories and posts.
21
  * Display/hide of pages.
22
  * Limitation of the depth of the list.
25
  * Set the excluded posts or pages from the list.
26
  * Select the display style of the site map from five prepared designs (or no style).
27
 
28
+ = Version history =
29
+ * **1.0.7**
30
+ * reduce using memory.
31
+ * **1.0.6**
32
+ * Bugfix : foreach error in case of all categories set as top level
33
+ * **1.0.5**
34
+ * Added 5 preset styles( Label, Music, Arrows, Business, Index )
35
+ * Bugfix : wrong URL of css file in windows server and windows local pc.
36
+ * some code refactoring
37
+ * **1.0.0**
38
+ * Public release
39
+
40
  == Installation ==
41
  1. Unzip the downloaded package and upload into your WordPress plugins directory.
42
  If you use WordPress 2.7 or later, you can install from admin page.