Changeset 740878
- Timestamp:
- 07/15/2013 08:04:09 AM (13 years ago)
- Location:
- wp-over-network
- Files:
-
- 6 edited
- 1 copied
-
tags/0.4.3 (copied) (copied from wp-over-network/trunk)
-
tags/0.4.3/WPONW_RecentPostsWidget.php (modified) (2 diffs)
-
tags/0.4.3/readme.txt (modified) (5 diffs)
-
tags/0.4.3/wp-over-network.php (modified) (13 diffs)
-
trunk/WPONW_RecentPostsWidget.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (5 diffs)
-
trunk/wp-over-network.php (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-over-network/tags/0.4.3/WPONW_RecentPostsWidget.php
r739008 r740878 12 12 13 13 14 14 15 function __construct() { 15 16 $widget_ops = array( … … 18 19 ); 19 20 parent::__construct( self::IDENTIFIER, __( 'Recent Posts over Network', wponw::WPONW_PREFIX ), $widget_ops ); 20 $this->alt_option_name = 'WPONW_RecentPostsWidget';21 // $this->alt_option_name = 'WPONW_RecentPostsWidget'; 21 22 22 23 add_action( 'save_post', array( $this, 'flush_widget_cache' ) ); -
wp-over-network/tags/0.4.3/readme.txt
r739023 r740878 5 5 Requires at least: 3.5 6 6 Tested up to: 3.5.1 7 Stable tag: 0.4. 27 Stable tag: 0.4.3 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 71 71 = Using as Shortcode = 72 72 73 Arguments, can be used the same as `wponw::render_post_archive_to_string`.74 75 73 **Display with default.** 76 74 77 75 [wponw_recent_post_list] 76 77 Arguments, can be used the same as `wponw::render_post_archive_to_string`. 78 78 79 79 **Use your template file, includes 3 post types** … … 91 91 You create the new page, and write the below shortcode in the post content. 92 92 93 [wponw_recent_post_list post_type=p roducts,updates]93 [wponw_recent_post_list post_type=post exclude_blog_ids=1 affect_wp_query=true] 94 94 95 95 … … 112 112 == Upgrade Notice == 113 113 114 = 0.4.3 = 115 * Deprecated the `wponw_recent_post_list`. Please use the `wponw_post_list` instead. 116 114 117 = 0.4.2 = 115 118 * I changed the file name, for the plug-in file management issues on. 116 117 119 118 120 = 0.4.0 / 0.4.1 = … … 127 129 128 130 == Changelog == 131 132 = 0.4.3 = 133 * Added the shortcode of `wponw_reset_query` and `wponw_post_list`. 134 * Deprecated the `wponw_recent_post_list`. Please use the `wponw_post_list` instead. 129 135 130 136 = 0.4.2 = -
wp-over-network/tags/0.4.3/wp-over-network.php
r739020 r740878 6 6 Author: HissyNC, yuka2py 7 7 Author URI: https://github.com/yuka2py/wp_over_network 8 Version: 0.4. 28 Version: 0.4.3 9 9 */ 10 10 … … 48 48 */ 49 49 static public function setup() { 50 51 50 //Loading transration. 52 51 load_plugin_textdomain( wponw::WPONW_PREFIX, false, 'wp_over_network/languages' ); … … 59 58 60 59 //Add shortcode. 61 add_shortcode('wponw_recent_post_list', array( 'wponw', 'render_post_archive_to_string' ) ); 60 add_shortcode('wponw_recent_post_list', array( 'wponw', 'render_post_archive_to_string' ) ); //deprecation 61 add_shortcode('wponw_post_list', array( 'wponw', 'render_post_archive_to_string' ) ); 62 add_shortcode('wponw_reset_query', 'wp_reset_query' ); 62 63 } 63 64 … … 84 85 /** 85 86 * Get posts over network. 86 * @param mixed $args87 * @param mixed[optional] $args 87 88 * numberposts Max number of posts to get。Default is 5. 88 89 * offset Offset number to get. Default is false. If specified, it takes precedence over 'paged'. … … 94 95 * blog_ids IDs of the blog to get. Default is null. 95 96 * exclude_blog_ids IDs of the blog that you want to exclude. Default is null. 97 * blog_conditions get_blogs 96 98 * affect_wp_query Whether or not affect the $wp_query. Default is false, means NOT affect. Specify true for the plugins that depend on $wp_query. 97 99 * transient_expires_in Specify seconds of the expiry for the cache. Default is 0, means Transient not use. … … 110 112 'order' => 'DESC', 111 113 'post_status' => 'publish', 114 'affect_wp_query' => false, 112 115 'blog_ids' => null, 113 116 'exclude_blog_ids' => null, 114 ' affect_wp_query' => false,115 'transient_expires_in' => 0,117 'blog_conditions' => array(), 118 'transient_expires_in' => false, 116 119 ) ); 117 120 … … 137 140 } 138 141 139 //Get blog information 140 $blogs = self::get_blogs( compact( 'blog_ids', 'exclude_blog_ids', 'transient_expires_in' ) ); 142 //Get blogs 143 $blog_conditions = (array) $blog_conditions; 144 if ( ! empty( $blog_ids ) ) { 145 $blog_conditions['blog_ids'] = $blog_ids; 146 } 147 if ( ! empty( $exclude_blog_ids ) ) { 148 $blog_conditions['exclude_blog_ids'] = $exclude_blog_ids; 149 } 150 $blogs = self::get_blogs( $blog_conditions ); 141 151 142 152 //Prepare common where clause. … … 169 179 //Execute query 170 180 $posts = $wpdb->get_results( $query ); 181 171 182 $found_posts = $wpdb->get_results( 'SELECT FOUND_ROWS() as count' ); 172 183 $found_posts = $found_posts[0]->count; … … 198 209 * Get blog list. 199 210 * Object to be returned, including the Home URL and blog name in addition to the blog data. 200 * @param mixed $args211 * @param mixed[optional] $args 201 212 * blog_ids Specifies the blog ID to get. Default is null. 202 213 * exclude_blog_ids Specifies the blog ID to exclude. Default is null. 214 * public Default is 1. 215 * archived Default is 0. 216 * mature Default is 0. 217 * spam Default is 0. 218 * deleted Default is 0. 203 219 * transient_expires_in Specify when using the Transient API. specify the value, in seconds. Default is false, means not use Transient API. 204 220 * @return array<stdClass> … … 211 227 'blog_ids' => null, 212 228 'exclude_blog_ids' => null, 229 'public' => 1, 230 'archived' => 0, 231 'mature' => 0, 232 'spam' => 0, 233 'deleted' => 0, 213 234 'transient_expires_in' => false, 214 235 ) ); … … 223 244 extract( $args ); 224 245 225 if ( empty( $blogs ) ) {226 //If necessary, prepare the where clause246 if ( empty( $blogs ) ) 247 { 227 248 $where = array(); 228 if ( $blog_ids ) { 249 if ( ! is_null( $public ) ) 250 $where[] = sprintf( 'public = %d', $public ); 251 if ( ! is_null( $archived ) ) 252 $where[] = sprintf( 'archived = \'%s\'', (int) $archived ); 253 if ( ! is_null( $mature ) ) 254 $where[] = sprintf( 'mature = %d', $mature ); 255 if ( ! is_null( $spam ) ) 256 $where[] = sprintf( 'spam = %d', $spam ); 257 if ( ! is_null( $deleted ) ) 258 $where[] = sprintf( 'deleted = %d', $deleted ); 259 if ( $blog_ids ) 229 260 $where[] = sprintf( 'blog_id IN (%s)', self::cleanids( $blog_ids ) ); 230 } 231 if ( $exclude_blog_ids ) { 261 if ( $exclude_blog_ids ) 232 262 $where[] = sprintf( 'blog_id NOT IN (%s)', self::cleanids( $exclude_blog_ids ) ); 233 }234 263 235 264 //Build query … … 320 349 if ( empty( $args['renderer'] ) ) { 321 350 $args['posts'] = $posts; 322 returnself::render_to_string( $args['template'], $args );351 $rendered = self::render_to_string( $args['template'], $args ); 323 352 } else { 324 353 ob_start(); 325 354 call_user_func( $args['renderer'], $posts, $args ); 326 return ob_get_clean(); 327 } 355 $rendered = ob_get_clean(); 356 } 357 358 return $rendered; 328 359 } 329 360 … … 409 440 410 441 411 static public function cleanids($ids) { 412 if ( is_array( $ids ) ) { 413 $ids = array_map( 'intval', $ids ); 414 } else { 415 $ids = preg_split( '/[^\d]+/', strval( $ids ), -1, PREG_SPLIT_NO_EMPTY ); 416 } 417 $ids = implode(',', $ids); 418 return $ids; 442 static public function cleanids( $ids ) { 443 return implode( ',', wp_parse_id_list( $ids ) ); 419 444 } 420 445 -
wp-over-network/trunk/WPONW_RecentPostsWidget.php
r739008 r740878 12 12 13 13 14 14 15 function __construct() { 15 16 $widget_ops = array( … … 18 19 ); 19 20 parent::__construct( self::IDENTIFIER, __( 'Recent Posts over Network', wponw::WPONW_PREFIX ), $widget_ops ); 20 $this->alt_option_name = 'WPONW_RecentPostsWidget';21 // $this->alt_option_name = 'WPONW_RecentPostsWidget'; 21 22 22 23 add_action( 'save_post', array( $this, 'flush_widget_cache' ) ); -
wp-over-network/trunk/readme.txt
r739023 r740878 5 5 Requires at least: 3.5 6 6 Tested up to: 3.5.1 7 Stable tag: 0.4. 27 Stable tag: 0.4.3 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 71 71 = Using as Shortcode = 72 72 73 Arguments, can be used the same as `wponw::render_post_archive_to_string`.74 75 73 **Display with default.** 76 74 77 75 [wponw_recent_post_list] 76 77 Arguments, can be used the same as `wponw::render_post_archive_to_string`. 78 78 79 79 **Use your template file, includes 3 post types** … … 91 91 You create the new page, and write the below shortcode in the post content. 92 92 93 [wponw_recent_post_list post_type=p roducts,updates]93 [wponw_recent_post_list post_type=post exclude_blog_ids=1 affect_wp_query=true] 94 94 95 95 … … 112 112 == Upgrade Notice == 113 113 114 = 0.4.3 = 115 * Deprecated the `wponw_recent_post_list`. Please use the `wponw_post_list` instead. 116 114 117 = 0.4.2 = 115 118 * I changed the file name, for the plug-in file management issues on. 116 117 119 118 120 = 0.4.0 / 0.4.1 = … … 127 129 128 130 == Changelog == 131 132 = 0.4.3 = 133 * Added the shortcode of `wponw_reset_query` and `wponw_post_list`. 134 * Deprecated the `wponw_recent_post_list`. Please use the `wponw_post_list` instead. 129 135 130 136 = 0.4.2 = -
wp-over-network/trunk/wp-over-network.php
r739020 r740878 6 6 Author: HissyNC, yuka2py 7 7 Author URI: https://github.com/yuka2py/wp_over_network 8 Version: 0.4. 28 Version: 0.4.3 9 9 */ 10 10 … … 48 48 */ 49 49 static public function setup() { 50 51 50 //Loading transration. 52 51 load_plugin_textdomain( wponw::WPONW_PREFIX, false, 'wp_over_network/languages' ); … … 59 58 60 59 //Add shortcode. 61 add_shortcode('wponw_recent_post_list', array( 'wponw', 'render_post_archive_to_string' ) ); 60 add_shortcode('wponw_recent_post_list', array( 'wponw', 'render_post_archive_to_string' ) ); //deprecation 61 add_shortcode('wponw_post_list', array( 'wponw', 'render_post_archive_to_string' ) ); 62 add_shortcode('wponw_reset_query', 'wp_reset_query' ); 62 63 } 63 64 … … 84 85 /** 85 86 * Get posts over network. 86 * @param mixed $args87 * @param mixed[optional] $args 87 88 * numberposts Max number of posts to get。Default is 5. 88 89 * offset Offset number to get. Default is false. If specified, it takes precedence over 'paged'. … … 94 95 * blog_ids IDs of the blog to get. Default is null. 95 96 * exclude_blog_ids IDs of the blog that you want to exclude. Default is null. 97 * blog_conditions get_blogs 96 98 * affect_wp_query Whether or not affect the $wp_query. Default is false, means NOT affect. Specify true for the plugins that depend on $wp_query. 97 99 * transient_expires_in Specify seconds of the expiry for the cache. Default is 0, means Transient not use. … … 110 112 'order' => 'DESC', 111 113 'post_status' => 'publish', 114 'affect_wp_query' => false, 112 115 'blog_ids' => null, 113 116 'exclude_blog_ids' => null, 114 ' affect_wp_query' => false,115 'transient_expires_in' => 0,117 'blog_conditions' => array(), 118 'transient_expires_in' => false, 116 119 ) ); 117 120 … … 137 140 } 138 141 139 //Get blog information 140 $blogs = self::get_blogs( compact( 'blog_ids', 'exclude_blog_ids', 'transient_expires_in' ) ); 142 //Get blogs 143 $blog_conditions = (array) $blog_conditions; 144 if ( ! empty( $blog_ids ) ) { 145 $blog_conditions['blog_ids'] = $blog_ids; 146 } 147 if ( ! empty( $exclude_blog_ids ) ) { 148 $blog_conditions['exclude_blog_ids'] = $exclude_blog_ids; 149 } 150 $blogs = self::get_blogs( $blog_conditions ); 141 151 142 152 //Prepare common where clause. … … 169 179 //Execute query 170 180 $posts = $wpdb->get_results( $query ); 181 171 182 $found_posts = $wpdb->get_results( 'SELECT FOUND_ROWS() as count' ); 172 183 $found_posts = $found_posts[0]->count; … … 198 209 * Get blog list. 199 210 * Object to be returned, including the Home URL and blog name in addition to the blog data. 200 * @param mixed $args211 * @param mixed[optional] $args 201 212 * blog_ids Specifies the blog ID to get. Default is null. 202 213 * exclude_blog_ids Specifies the blog ID to exclude. Default is null. 214 * public Default is 1. 215 * archived Default is 0. 216 * mature Default is 0. 217 * spam Default is 0. 218 * deleted Default is 0. 203 219 * transient_expires_in Specify when using the Transient API. specify the value, in seconds. Default is false, means not use Transient API. 204 220 * @return array<stdClass> … … 211 227 'blog_ids' => null, 212 228 'exclude_blog_ids' => null, 229 'public' => 1, 230 'archived' => 0, 231 'mature' => 0, 232 'spam' => 0, 233 'deleted' => 0, 213 234 'transient_expires_in' => false, 214 235 ) ); … … 223 244 extract( $args ); 224 245 225 if ( empty( $blogs ) ) {226 //If necessary, prepare the where clause246 if ( empty( $blogs ) ) 247 { 227 248 $where = array(); 228 if ( $blog_ids ) { 249 if ( ! is_null( $public ) ) 250 $where[] = sprintf( 'public = %d', $public ); 251 if ( ! is_null( $archived ) ) 252 $where[] = sprintf( 'archived = \'%s\'', (int) $archived ); 253 if ( ! is_null( $mature ) ) 254 $where[] = sprintf( 'mature = %d', $mature ); 255 if ( ! is_null( $spam ) ) 256 $where[] = sprintf( 'spam = %d', $spam ); 257 if ( ! is_null( $deleted ) ) 258 $where[] = sprintf( 'deleted = %d', $deleted ); 259 if ( $blog_ids ) 229 260 $where[] = sprintf( 'blog_id IN (%s)', self::cleanids( $blog_ids ) ); 230 } 231 if ( $exclude_blog_ids ) { 261 if ( $exclude_blog_ids ) 232 262 $where[] = sprintf( 'blog_id NOT IN (%s)', self::cleanids( $exclude_blog_ids ) ); 233 }234 263 235 264 //Build query … … 320 349 if ( empty( $args['renderer'] ) ) { 321 350 $args['posts'] = $posts; 322 returnself::render_to_string( $args['template'], $args );351 $rendered = self::render_to_string( $args['template'], $args ); 323 352 } else { 324 353 ob_start(); 325 354 call_user_func( $args['renderer'], $posts, $args ); 326 return ob_get_clean(); 327 } 355 $rendered = ob_get_clean(); 356 } 357 358 return $rendered; 328 359 } 329 360 … … 409 440 410 441 411 static public function cleanids($ids) { 412 if ( is_array( $ids ) ) { 413 $ids = array_map( 'intval', $ids ); 414 } else { 415 $ids = preg_split( '/[^\d]+/', strval( $ids ), -1, PREG_SPLIT_NO_EMPTY ); 416 } 417 $ids = implode(',', $ids); 418 return $ids; 442 static public function cleanids( $ids ) { 443 return implode( ',', wp_parse_id_list( $ids ) ); 419 444 } 420 445
Note: See TracChangeset
for help on using the changeset viewer.